iobroker.vis-2
Version:
Next generation graphical user interface for ioBroker.
40,580 lines • 1.46 MB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./visRxWidget-404DmCpH.js","./jsx-runtime-DXKJPqi2.js","./iobroker_vis__loadShare__react__loadShare__.js_commonjs-proxy-DZ2NGvQn.js","./iobroker_vis__loadShare__react__loadShare__.js-QKtVi7r1.js","./iobroker_vis__loadShare___mf_0_mui_mf_1_material__loadShare__.js-B8Z0SsW4.js","./iobroker_vis__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__.js-CsN8r17m.js","./preload-helper-D5QYaGzd.js","./iobroker_vis__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__.js-CG0yp7Ex.js"])))=>i.map(i=>d[i]);
import { _ as __vitePreload } from "./preload-helper-D5QYaGzd.js";
import { d as dist, __tla as __tla_0 } from "./virtual_mf-REMOTE_ENTRY_ID_iobroker_vis__remoteEntry_js-C1lLKz-z.js";
import { j as jsxRuntimeExports, __tla as __tla_1 } from "./jsx-runtime-DXKJPqi2.js";
import { _ as __mf_0$1, __tla as __tla_2 } from "./iobroker_vis__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-ZIxpVjoC.js";
import { _ as __mf_0, a as __mf_15, b as __mf_70, c as __mf_2, d as __mf_85, e as __mf_1, f as __mf_77, g as __mf_76, h as __mf_75, i as __mf_50, j as __mf_121$1, __tla as __tla_3 } from "./iobroker_vis__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__.js-CsN8r17m.js";
import { P as PropTypes, __tla as __tla_4 } from "./iobroker_vis__loadShare__prop_mf_2_types__loadShare__.js-OoAqYupB.js";
import { _ as __mf_14, a as __mf_120, b as __mf_109, c as __mf_37, d as __mf_63, e as __mf_64, f as __mf_66, g as __mf_67, h as __mf_69, i as __mf_126, j as __mf_53, k as __mf_121, l as __mf_32, m as __mf_36, n as __mf_34, o as __mf_72, p as __mf_70$1, q as __mf_42, r as __mf_60, s as __mf_89, t as __mf_18, u as __mf_16, v as __mf_122, w as __mf_33, x as __mf_83, y as __mf_81, z as __mf_7, A as __mf_39, B as __mf_58, C as __mf_108, D as __mf_43, E as __mf_25, F as __mf_85$1, G as __mf_92, H as __mf_46, I as __mf_86, J as __mf_98, K as __mf_61, L as __mf_93, M as __mf_73, __tla as __tla_5 } from "./iobroker_vis__loadShare___mf_0_mui_mf_1_material__loadShare__.js-B8Z0SsW4.js";
import { _ as __mf_2256, a as __mf_1711, b as __mf_4885, c as __mf_2876, d as __mf_2326, e as __mf_1671, f as __mf_1776, g as __mf_10269, h as __mf_85$2, i as __mf_3386, __tla as __tla_6 } from "./iobroker_vis__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__.js-CG0yp7Ex.js";
import { a as React, _ as __mf_32$1, b as __mf_21, c as __mf_29, d as __mf_10, e as __mf_31, f as __mf_2$1, g as __mf_14$1, h as __mf_24, i as __mf_20, j as __mf_17, k as __mf_35, l as __mf_26, m as __mf_30, n as __mf_9, o as __mf_13, __tla as __tla_7 } from "./iobroker_vis__loadShare__react__loadShare__.js-QKtVi7r1.js";
import { V as VisBaseWidget, g as getUsedObjectIDsInWidget, a as addClass$1, c as calculateOverflow, d as deepClone, i as isVarFinite, r as replaceGroupAttr, b as VisRxWidget, N as NOTHING_SELECTED, s as store, e as recalculateFields, f as selectView, p as parseDimension, h as hasWidgetAccess, j as extractBinding, k as isLocalStateId, l as getUrlParameter, m as readFile, n as findWidgetUsages, o as applyTitleAndIcon, u as updateProject, q as updateActiveUser, t as hasProjectAccess, v as hasViewAccess, __tla as __tla_8 } from "./visRxWidget-404DmCpH.js";
import { E as EditIcon, F as FileIcon, __tla as __tla_9 } from "./InsertDriveFile-aDtVRikn.js";
import { _ as _objectWithoutPropertiesLoose$1, a as _extends$1, b as _inheritsLoose } from "./assertThisInitialized-DtkDSj7h.js";
import { u as useThemeProps, f as forceReflow, T as Transition, a as useSlotProps, b as Typography, I as IconButton, c as useControlled, d as useEventCallback, e as useForkRef, M as MenuItem, g as MenuList, B as ButtonBase, h as InputAdornment, i as useFormControl, v as visuallyHidden, j as InputLabel, F as FormHelperText, k as FormControl, l as TextField, m as useTheme, n as Fade, o as TransitionGroup, p as useMediaQuery, G as Grow, q as FocusTrap, r as ownerDocument, P as Paper, s as Popper, t as Button, D as DialogActions, L as List, w as ListItem, C as Chip, x as resolveComponentProps, y as Dialog, z as dialogClasses, A as DialogContent, E as ThemeProvider, __tla as __tla_10 } from "./Dialog-Dgkz1L-r.js";
import { c as clsx, a as capitalize, __tla as __tla_11 } from "./clsx-DKpeWZFz.js";
import { g as generateUtilityClass, a as generateUtilityClasses, c as composeClasses, __tla as __tla_12 } from "./createStyled-CtLRJdF1.js";
import { c as createSvgIcon, s as styled, __tla as __tla_13 } from "./createSvgIcon-BEOyHFEj.js";
import { u as useRtl, a as useEnhancedEffect, b as useId, __tla as __tla_14 } from "./useMediaQuery-DfRjuqob.js";
import { _ as __mf_133, a as __mf_131, b as __mf_6, __tla as __tla_15 } from "./iobroker_vis__loadShare___mf_0_mui_mf_1_system__loadShare__.js-Zvkdie3d.js";
import { __tla as __tla_16 } from "./iobroker_vis__loadShare__react_mf_2_dom__loadShare__.js-D8CM_cOC.js";
Promise.all([
(() => {
try {
return __tla_0;
} catch {
}
})(),
(() => {
try {
return __tla_1;
} catch {
}
})(),
(() => {
try {
return __tla_2;
} catch {
}
})(),
(() => {
try {
return __tla_3;
} catch {
}
})(),
(() => {
try {
return __tla_4;
} catch {
}
})(),
(() => {
try {
return __tla_5;
} catch {
}
})(),
(() => {
try {
return __tla_6;
} catch {
}
})(),
(() => {
try {
return __tla_7;
} catch {
}
})(),
(() => {
try {
return __tla_8;
} catch {
}
})(),
(() => {
try {
return __tla_9;
} catch {
}
})(),
(() => {
try {
return __tla_10;
} catch {
}
})(),
(() => {
try {
return __tla_11;
} catch {
}
})(),
(() => {
try {
return __tla_12;
} catch {
}
})(),
(() => {
try {
return __tla_13;
} catch {
}
})(),
(() => {
try {
return __tla_14;
} catch {
}
})(),
(() => {
try {
return __tla_15;
} catch {
}
})(),
(() => {
try {
return __tla_16;
} catch {
}
})()
]).then(async () => {
function getDefaultExportFromCjs(x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
}
(function polyfill() {
const relList = document.createElement("link").relList;
if (relList && relList.supports && relList.supports("modulepreload")) return;
for (const link of document.querySelectorAll('link[rel="modulepreload"]')) processPreload(link);
new MutationObserver((mutations) => {
for (const mutation of mutations) {
if (mutation.type !== "childList") continue;
for (const node of mutation.addedNodes) if (node.tagName === "LINK" && node.rel === "modulepreload") processPreload(node);
}
}).observe(document, {
childList: true,
subtree: true
});
function getFetchOpts(link) {
const fetchOpts = {};
if (link.integrity) fetchOpts.integrity = link.integrity;
if (link.referrerPolicy) fetchOpts.referrerPolicy = link.referrerPolicy;
if (link.crossOrigin === "use-credentials") fetchOpts.credentials = "include";
else if (link.crossOrigin === "anonymous") fetchOpts.credentials = "omit";
else fetchOpts.credentials = "same-origin";
return fetchOpts;
}
function processPreload(link) {
if (link.ep) return;
link.ep = true;
const fetchOpts = getFetchOpts(link);
fetch(link.href, fetchOpts);
}
})();
const refType = PropTypes.oneOfType([
PropTypes.func,
PropTypes.object
]);
var DefaultContext = {
color: void 0,
size: void 0,
className: void 0,
style: void 0,
attr: void 0
};
var IconContext = React.createContext && React.createContext(DefaultContext);
var _excluded$G = [
"attr",
"size",
"title"
];
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
}
function _extends() {
_extends = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function ownKeys(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
_defineProperty(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey(t) {
var i = _toPrimitive(t, "string");
return "symbol" == typeof i ? i : i + "";
}
function _toPrimitive(t, r) {
if ("object" != typeof t || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r);
if ("object" != typeof i) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function Tree2Element(tree) {
return tree && tree.map((node, i) => React.createElement(node.tag, _objectSpread({
key: i
}, node.attr), Tree2Element(node.child)));
}
function GenIcon(data) {
return (props) => React.createElement(IconBase, _extends({
attr: _objectSpread({}, data.attr)
}, props), Tree2Element(data.child));
}
function IconBase(props) {
var elem = (conf) => {
var { attr, size, title } = props, svgProps = _objectWithoutProperties(props, _excluded$G);
var computedSize = size || conf.size || "1em";
var className;
if (conf.className) className = conf.className;
if (props.className) className = (className ? className + " " : "") + props.className;
return React.createElement("svg", _extends({
stroke: "currentColor",
fill: "currentColor",
strokeWidth: "0"
}, conf.attr, attr, svgProps, {
className,
style: _objectSpread(_objectSpread({
color: props.color || conf.color
}, conf.style), props.style),
height: computedSize,
width: computedSize,
xmlns: "http://www.w3.org/2000/svg"
}), title && React.createElement("title", null, title), props.children);
};
return IconContext !== void 0 ? React.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
}
function BiImport(props) {
return GenIcon({
"attr": {
"viewBox": "0 0 24 24"
},
"child": [
{
"tag": "path",
"attr": {
"d": "m12 18 4-5h-3V2h-2v11H8z"
},
"child": []
},
{
"tag": "path",
"attr": {
"d": "M19 9h-4v2h4v9H5v-9h4V9H5c-1.103 0-2 .897-2 2v9c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2v-9c0-1.103-.897-2-2-2z"
},
"child": []
}
]
})(props);
}
var hookCallback;
function hooks() {
return hookCallback.apply(null, arguments);
}
function setHookCallback(callback) {
hookCallback = callback;
}
function isArray(input) {
return input instanceof Array || Object.prototype.toString.call(input) === "[object Array]";
}
function isObject(input) {
return input != null && Object.prototype.toString.call(input) === "[object Object]";
}
function hasOwnProp(a, b) {
return Object.prototype.hasOwnProperty.call(a, b);
}
function isObjectEmpty(obj) {
if (Object.getOwnPropertyNames) {
return Object.getOwnPropertyNames(obj).length === 0;
} else {
var k;
for (k in obj) {
if (hasOwnProp(obj, k)) {
return false;
}
}
return true;
}
}
function isUndefined(input) {
return input === void 0;
}
function isNumber(input) {
return typeof input === "number" || Object.prototype.toString.call(input) === "[object Number]";
}
function isDate(input) {
return input instanceof Date || Object.prototype.toString.call(input) === "[object Date]";
}
function map(arr, fn) {
var res = [], i, arrLen = arr.length;
for (i = 0; i < arrLen; ++i) {
res.push(fn(arr[i], i));
}
return res;
}
function extend(a, b) {
for (var i in b) {
if (hasOwnProp(b, i)) {
a[i] = b[i];
}
}
if (hasOwnProp(b, "toString")) {
a.toString = b.toString;
}
if (hasOwnProp(b, "valueOf")) {
a.valueOf = b.valueOf;
}
return a;
}
function createUTC(input, format2, locale2, strict) {
return createLocalOrUTC(input, format2, locale2, strict, true).utc();
}
function defaultParsingFlags() {
return {
empty: false,
unusedTokens: [],
unusedInput: [],
overflow: -2,
charsLeftOver: 0,
nullInput: false,
invalidEra: null,
invalidMonth: null,
invalidFormat: false,
userInvalidated: false,
iso: false,
parsedDateParts: [],
era: null,
meridiem: null,
rfc2822: false,
weekdayMismatch: false
};
}
function getParsingFlags(m) {
if (m._pf == null) {
m._pf = defaultParsingFlags();
}
return m._pf;
}
var some;
if (Array.prototype.some) {
some = Array.prototype.some;
} else {
some = function(fun) {
var t = Object(this), len = t.length >>> 0, i;
for (i = 0; i < len; i++) {
if (i in t && fun.call(this, t[i], i, t)) {
return true;
}
}
return false;
};
}
function isValid(m) {
var flags = null, parsedParts = false, isNowValid = m._d && !isNaN(m._d.getTime());
if (isNowValid) {
flags = getParsingFlags(m);
parsedParts = some.call(flags.parsedDateParts, function(i) {
return i != null;
});
isNowValid = flags.overflow < 0 && !flags.empty && !flags.invalidEra && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts);
if (m._strict) {
isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === void 0;
}
}
if (Object.isFrozen == null || !Object.isFrozen(m)) {
m._isValid = isNowValid;
} else {
return isNowValid;
}
return m._isValid;
}
function createInvalid(flags) {
var m = createUTC(NaN);
if (flags != null) {
extend(getParsingFlags(m), flags);
} else {
getParsingFlags(m).userInvalidated = true;
}
return m;
}
var momentProperties = hooks.momentProperties = [], updateInProgress = false;
function copyConfig(to2, from2) {
var i, prop, val, momentPropertiesLen = momentProperties.length;
if (!isUndefined(from2._isAMomentObject)) {
to2._isAMomentObject = from2._isAMomentObject;
}
if (!isUndefined(from2._i)) {
to2._i = from2._i;
}
if (!isUndefined(from2._f)) {
to2._f = from2._f;
}
if (!isUndefined(from2._l)) {
to2._l = from2._l;
}
if (!isUndefined(from2._strict)) {
to2._strict = from2._strict;
}
if (!isUndefined(from2._tzm)) {
to2._tzm = from2._tzm;
}
if (!isUndefined(from2._isUTC)) {
to2._isUTC = from2._isUTC;
}
if (!isUndefined(from2._offset)) {
to2._offset = from2._offset;
}
if (!isUndefined(from2._pf)) {
to2._pf = getParsingFlags(from2);
}
if (!isUndefined(from2._locale)) {
to2._locale = from2._locale;
}
if (momentPropertiesLen > 0) {
for (i = 0; i < momentPropertiesLen; i++) {
prop = momentProperties[i];
val = from2[prop];
if (!isUndefined(val)) {
to2[prop] = val;
}
}
}
return to2;
}
function Moment(config) {
copyConfig(this, config);
this._d = new Date(config._d != null ? config._d.getTime() : NaN);
if (!this.isValid()) {
this._d = /* @__PURE__ */ new Date(NaN);
}
if (updateInProgress === false) {
updateInProgress = true;
hooks.updateOffset(this);
updateInProgress = false;
}
}
function isMoment(obj) {
return obj instanceof Moment || obj != null && obj._isAMomentObject != null;
}
function warn(msg) {
if (hooks.suppressDeprecationWarnings === false && typeof console !== "undefined" && console.warn) {
console.warn("Deprecation warning: " + msg);
}
}
function deprecate(msg, fn) {
var firstTime = true;
return extend(function() {
if (hooks.deprecationHandler != null) {
hooks.deprecationHandler(null, msg);
}
if (firstTime) {
var args = [], arg, i, key, argLen = arguments.length;
for (i = 0; i < argLen; i++) {
arg = "";
if (typeof arguments[i] === "object") {
arg += "\n[" + i + "] ";
for (key in arguments[0]) {
if (hasOwnProp(arguments[0], key)) {
arg += key + ": " + arguments[0][key] + ", ";
}
}
arg = arg.slice(0, -2);
} else {
arg = arguments[i];
}
args.push(arg);
}
warn(msg + "\nArguments: " + Array.prototype.slice.call(args).join("") + "\n" + new Error().stack);
firstTime = false;
}
return fn.apply(this, arguments);
}, fn);
}
var deprecations = {};
function deprecateSimple(name, msg) {
if (hooks.deprecationHandler != null) {
hooks.deprecationHandler(name, msg);
}
if (!deprecations[name]) {
warn(msg);
deprecations[name] = true;
}
}
hooks.suppressDeprecationWarnings = false;
hooks.deprecationHandler = null;
function isFunction(input) {
return typeof Function !== "undefined" && input instanceof Function || Object.prototype.toString.call(input) === "[object Function]";
}
function set(config) {
var prop, i;
for (i in config) {
if (hasOwnProp(config, i)) {
prop = config[i];
if (isFunction(prop)) {
this[i] = prop;
} else {
this["_" + i] = prop;
}
}
}
this._config = config;
this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source);
}
function mergeConfigs(parentConfig, childConfig) {
var res = extend({}, parentConfig), prop;
for (prop in childConfig) {
if (hasOwnProp(childConfig, prop)) {
if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
res[prop] = {};
extend(res[prop], parentConfig[prop]);
extend(res[prop], childConfig[prop]);
} else if (childConfig[prop] != null) {
res[prop] = childConfig[prop];
} else {
delete res[prop];
}
}
}
for (prop in parentConfig) {
if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop])) {
res[prop] = extend({}, res[prop]);
}
}
return res;
}
function Locale(config) {
if (config != null) {
this.set(config);
}
}
var keys;
if (Object.keys) {
keys = Object.keys;
} else {
keys = function(obj) {
var i, res = [];
for (i in obj) {
if (hasOwnProp(obj, i)) {
res.push(i);
}
}
return res;
};
}
var defaultCalendar = {
sameDay: "[Today at] LT",
nextDay: "[Tomorrow at] LT",
nextWeek: "dddd [at] LT",
lastDay: "[Yesterday at] LT",
lastWeek: "[Last] dddd [at] LT",
sameElse: "L"
};
function calendar(key, mom, now2) {
var output = this._calendar[key] || this._calendar["sameElse"];
return isFunction(output) ? output.call(mom, now2) : output;
}
function zeroFill(number, targetLength, forceSign) {
var absNumber = "" + Math.abs(number), zerosToFill = targetLength - absNumber.length, sign2 = number >= 0;
return (sign2 ? forceSign ? "+" : "" : "-") + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
}
var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, formatFunctions = {}, formatTokenFunctions = {};
function addFormatToken(token2, padded, ordinal2, callback) {
var func = callback;
if (typeof callback === "string") {
func = function() {
return this[callback]();
};
}
if (token2) {
formatTokenFunctions[token2] = func;
}
if (padded) {
formatTokenFunctions[padded[0]] = function() {
return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
};
}
if (ordinal2) {
formatTokenFunctions[ordinal2] = function() {
return this.localeData().ordinal(func.apply(this, arguments), token2);
};
}
}
function removeFormattingTokens(input) {
if (input.match(/\[[\s\S]/)) {
return input.replace(/^\[|\]$/g, "");
}
return input.replace(/\\/g, "");
}
function makeFormatFunction(format2) {
var array = format2.match(formattingTokens), i, length;
for (i = 0, length = array.length; i < length; i++) {
if (formatTokenFunctions[array[i]]) {
array[i] = formatTokenFunctions[array[i]];
} else {
array[i] = removeFormattingTokens(array[i]);
}
}
return function(mom) {
var output = "", i2;
for (i2 = 0; i2 < length; i2++) {
output += isFunction(array[i2]) ? array[i2].call(mom, format2) : array[i2];
}
return output;
};
}
function formatMoment(m, format2) {
if (!m.isValid()) {
return m.localeData().invalidDate();
}
format2 = expandFormat$1(format2, m.localeData());
formatFunctions[format2] = formatFunctions[format2] || makeFormatFunction(format2);
return formatFunctions[format2](m);
}
function expandFormat$1(format2, locale2) {
var i = 5;
function replaceLongDateFormatTokens(input) {
return locale2.longDateFormat(input) || input;
}
localFormattingTokens.lastIndex = 0;
while (i >= 0 && localFormattingTokens.test(format2)) {
format2 = format2.replace(localFormattingTokens, replaceLongDateFormatTokens);
localFormattingTokens.lastIndex = 0;
i -= 1;
}
return format2;
}
var defaultLongDateFormat = {
LTS: "h:mm:ss A",
LT: "h:mm A",
L: "MM/DD/YYYY",
LL: "MMMM D, YYYY",
LLL: "MMMM D, YYYY h:mm A",
LLLL: "dddd, MMMM D, YYYY h:mm A"
};
function longDateFormat(key) {
var format2 = this._longDateFormat[key], formatUpper = this._longDateFormat[key.toUpperCase()];
if (format2 || !formatUpper) {
return format2;
}
this._longDateFormat[key] = formatUpper.match(formattingTokens).map(function(tok) {
if (tok === "MMMM" || tok === "MM" || tok === "DD" || tok === "dddd") {
return tok.slice(1);
}
return tok;
}).join("");
return this._longDateFormat[key];
}
var defaultInvalidDate = "Invalid date";
function invalidDate() {
return this._invalidDate;
}
var defaultOrdinal = "%d", defaultDayOfMonthOrdinalParse = /\d{1,2}/;
function ordinal(number) {
return this._ordinal.replace("%d", number);
}
var defaultRelativeTime = {
future: "in %s",
past: "%s ago",
s: "a few seconds",
ss: "%d seconds",
m: "a minute",
mm: "%d minutes",
h: "an hour",
hh: "%d hours",
d: "a day",
dd: "%d days",
w: "a week",
ww: "%d weeks",
M: "a month",
MM: "%d months",
y: "a year",
yy: "%d years"
};
function relativeTime(number, withoutSuffix, string, isFuture) {
var output = this._relativeTime[string];
return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number);
}
function pastFuture(diff2, output) {
var format2 = this._relativeTime[diff2 > 0 ? "future" : "past"];
return isFunction(format2) ? format2(output) : format2.replace(/%s/i, output);
}
var aliases = {
D: "date",
dates: "date",
date: "date",
d: "day",
days: "day",
day: "day",
e: "weekday",
weekdays: "weekday",
weekday: "weekday",
E: "isoWeekday",
isoweekdays: "isoWeekday",
isoweekday: "isoWeekday",
DDD: "dayOfYear",
dayofyears: "dayOfYear",
dayofyear: "dayOfYear",
h: "hour",
hours: "hour",
hour: "hour",
ms: "millisecond",
milliseconds: "millisecond",
millisecond: "millisecond",
m: "minute",
minutes: "minute",
minute: "minute",
M: "month",
months: "month",
month: "month",
Q: "quarter",
quarters: "quarter",
quarter: "quarter",
s: "second",
seconds: "second",
second: "second",
gg: "weekYear",
weekyears: "weekYear",
weekyear: "weekYear",
GG: "isoWeekYear",
isoweekyears: "isoWeekYear",
isoweekyear: "isoWeekYear",
w: "week",
weeks: "week",
week: "week",
W: "isoWeek",
isoweeks: "isoWeek",
isoweek: "isoWeek",
y: "year",
years: "year",
year: "year"
};
function normalizeUnits(units) {
return typeof units === "string" ? aliases[units] || aliases[units.toLowerCase()] : void 0;
}
function normalizeObjectUnits(inputObject) {
var normalizedInput = {}, normalizedProp, prop;
for (prop in inputObject) {
if (hasOwnProp(inputObject, prop)) {
normalizedProp = normalizeUnits(prop);
if (normalizedProp) {
normalizedInput[normalizedProp] = inputObject[prop];
}
}
}
return normalizedInput;
}
var priorities = {
date: 9,
day: 11,
weekday: 11,
isoWeekday: 11,
dayOfYear: 4,
hour: 13,
millisecond: 16,
minute: 14,
month: 8,
quarter: 7,
second: 15,
weekYear: 1,
isoWeekYear: 1,
week: 5,
isoWeek: 5,
year: 1
};
function getPrioritizedUnits(unitsObj) {
var units = [], u;
for (u in unitsObj) {
if (hasOwnProp(unitsObj, u)) {
units.push({
unit: u,
priority: priorities[u]
});
}
}
units.sort(function(a, b) {
return a.priority - b.priority;
});
return units;
}
var match1 = /\d/, match2 = /\d\d/, match3 = /\d{3}/, match4 = /\d{4}/, match6 = /[+-]?\d{6}/, match1to2 = /\d\d?/, match3to4 = /\d\d\d\d?/, match5to6 = /\d\d\d\d\d\d?/, match1to3 = /\d{1,3}/, match1to4 = /\d{1,4}/, match1to6 = /[+-]?\d{1,6}/, matchUnsigned = /\d+/, matchSigned = /[+-]?\d+/, matchOffset = /Z|[+-]\d\d:?\d\d/gi, matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, match1to2NoLeadingZero = /^[1-9]\d?/, match1to2HasZero = /^([1-9]\d|\d)/, regexes;
regexes = {};
function addRegexToken(token2, regex, strictRegex) {
regexes[token2] = isFunction(regex) ? regex : function(isStrict, localeData2) {
return isStrict && strictRegex ? strictRegex : regex;
};
}
function getParseRegexForToken(token2, config) {
if (!hasOwnProp(regexes, token2)) {
return new RegExp(unescapeFormat(token2));
}
return regexes[token2](config._strict, config._locale);
}
function unescapeFormat(s) {
return regexEscape(s.replace("\\", "").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function(matched, p1, p2, p3, p4) {
return p1 || p2 || p3 || p4;
}));
}
function regexEscape(s) {
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
}
function absFloor(number) {
if (number < 0) {
return Math.ceil(number) || 0;
} else {
return Math.floor(number);
}
}
function toInt(argumentForCoercion) {
var coercedNumber = +argumentForCoercion, value = 0;
if (coercedNumber !== 0 && isFinite(coercedNumber)) {
value = absFloor(coercedNumber);
}
return value;
}
var tokens = {};
function addParseToken(token2, callback) {
var i, func = callback, tokenLen;
if (typeof token2 === "string") {
token2 = [
token2
];
}
if (isNumber(callback)) {
func = function(input, array) {
array[callback] = toInt(input);
};
}
tokenLen = token2.length;
for (i = 0; i < tokenLen; i++) {
tokens[token2[i]] = func;
}
}
function addWeekParseToken(token2, callback) {
addParseToken(token2, function(input, array, config, token3) {
config._w = config._w || {};
callback(input, config._w, config, token3);
});
}
function addTimeToArrayFromToken(token2, input, config) {
if (input != null && hasOwnProp(tokens, token2)) {
tokens[token2](input, config._a, config, token2);
}
}
function isLeapYear(year) {
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
}
var YEAR = 0, MONTH = 1, DATE = 2, HOUR = 3, MINUTE = 4, SECOND = 5, MILLISECOND = 6, WEEK = 7, WEEKDAY = 8;
addFormatToken("Y", 0, 0, function() {
var y = this.year();
return y <= 9999 ? zeroFill(y, 4) : "+" + y;
});
addFormatToken(0, [
"YY",
2
], 0, function() {
return this.year() % 100;
});
addFormatToken(0, [
"YYYY",
4
], 0, "year");
addFormatToken(0, [
"YYYYY",
5
], 0, "year");
addFormatToken(0, [
"YYYYYY",
6,
true
], 0, "year");
addRegexToken("Y", matchSigned);
addRegexToken("YY", match1to2, match2);
addRegexToken("YYYY", match1to4, match4);
addRegexToken("YYYYY", match1to6, match6);
addRegexToken("YYYYYY", match1to6, match6);
addParseToken([
"YYYYY",
"YYYYYY"
], YEAR);
addParseToken("YYYY", function(input, array) {
array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
});
addParseToken("YY", function(input, array) {
array[YEAR] = hooks.parseTwoDigitYear(input);
});
addParseToken("Y", function(input, array) {
array[YEAR] = parseInt(input, 10);
});
function daysInYear(year) {
return isLeapYear(year) ? 366 : 365;
}
hooks.parseTwoDigitYear = function(input) {
return toInt(input) + (toInt(input) > 68 ? 1900 : 2e3);
};
var getSetYear = makeGetSet("FullYear", true);
function getIsLeapYear() {
return isLeapYear(this.year());
}
function makeGetSet(unit, keepTime) {
return function(value) {
if (value != null) {
set$1(this, unit, value);
hooks.updateOffset(this, keepTime);
return this;
} else {
return get(this, unit);
}
};
}
function get(mom, unit) {
if (!mom.isValid()) {
return NaN;
}
var d = mom._d, isUTC = mom._isUTC;
switch (unit) {
case "Milliseconds":
return isUTC ? d.getUTCMilliseconds() : d.getMilliseconds();
case "Seconds":
return isUTC ? d.getUTCSeconds() : d.getSeconds();
case "Minutes":
return isUTC ? d.getUTCMinutes() : d.getMinutes();
case "Hours":
return isUTC ? d.getUTCHours() : d.getHours();
case "Date":
return isUTC ? d.getUTCDate() : d.getDate();
case "Day":
return isUTC ? d.getUTCDay() : d.getDay();
case "Month":
return isUTC ? d.getUTCMonth() : d.getMonth();
case "FullYear":
return isUTC ? d.getUTCFullYear() : d.getFullYear();
default:
return NaN;
}
}
function set$1(mom, unit, value) {
var d, isUTC, year, month, date;
if (!mom.isValid() || isNaN(value)) {
return;
}
d = mom._d;
isUTC = mom._isUTC;
switch (unit) {
case "Milliseconds":
return void (isUTC ? d.setUTCMilliseconds(value) : d.setMilliseconds(value));
case "Seconds":
return void (isUTC ? d.setUTCSeconds(value) : d.setSeconds(value));
case "Minutes":
return void (isUTC ? d.setUTCMinutes(value) : d.setMinutes(value));
case "Hours":
return void (isUTC ? d.setUTCHours(value) : d.setHours(value));
case "Date":
return void (isUTC ? d.setUTCDate(value) : d.setDate(value));
case "FullYear":
break;
default:
return;
}
year = value;
month = mom.month();
date = mom.date();
date = date === 29 && month === 1 && !isLeapYear(year) ? 28 : date;
void (isUTC ? d.setUTCFullYear(year, month, date) : d.setFullYear(year, month, date));
}
function stringGet(units) {
units = normalizeUnits(units);
if (isFunction(this[units])) {
return this[units]();
}
return this;
}
function stringSet(units, value) {
if (typeof units === "object") {
units = normalizeObjectUnits(units);
var prioritized = getPrioritizedUnits(units), i, prioritizedLen = prioritized.length;
for (i = 0; i < prioritizedLen; i++) {
this[prioritized[i].unit](units[prioritized[i].unit]);
}
} else {
units = normalizeUnits(units);
if (isFunction(this[units])) {
return this[units](value);
}
}
return this;
}
function mod(n, x) {
return (n % x + x) % x;
}
var indexOf;
if (Array.prototype.indexOf) {
indexOf = Array.prototype.indexOf;
} else {
indexOf = function(o) {
var i;
for (i = 0; i < this.length; ++i) {
if (this[i] === o) {
return i;
}
}
return -1;
};
}
function daysInMonth(year, month) {
if (isNaN(year) || isNaN(month)) {
return NaN;
}
var modMonth = mod(month, 12);
year += (month - modMonth) / 12;
return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2;
}
addFormatToken("M", [
"MM",
2
], "Mo", function() {
return this.month() + 1;
});
addFormatToken("MMM", 0, 0, function(format2) {
return this.localeData().monthsShort(this, format2);
});
addFormatToken("MMMM", 0, 0, function(format2) {
return this.localeData().months(this, format2);
});
addRegexToken("M", match1to2, match1to2NoLeadingZero);
addRegexToken("MM", match1to2, match2);
addRegexToken("MMM", function(isStrict, locale2) {
return locale2.monthsShortRegex(isStrict);
});
addRegexToken("MMMM", function(isStrict, locale2) {
return locale2.monthsRegex(isStrict);
});
addParseToken([
"M",
"MM"
], function(input, array) {
array[MONTH] = toInt(input) - 1;
});
addParseToken([
"MMM",
"MMMM"
], function(input, array, config, token2) {
var month = config._locale.monthsParse(input, token2, config._strict);
if (month != null) {
array[MONTH] = month;
} else {
getParsingFlags(config).invalidMonth = input;
}
});
var defaultLocaleMonths = "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), defaultLocaleMonthsShort = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, defaultMonthsShortRegex = matchWord, defaultMonthsRegex = matchWord;
function localeMonths(m, format2) {
if (!m) {
return isArray(this._months) ? this._months : this._months["standalone"];
}
return isArray(this._months) ? this._months[m.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format2) ? "format" : "standalone"][m.month()];
}
function localeMonthsShort(m, format2) {
if (!m) {
return isArray(this._monthsShort) ? this._monthsShort : this._monthsShort["standalone"];
}
return isArray(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format2) ? "format" : "standalone"][m.month()];
}
function handleStrictParse(monthName, format2, strict) {
var i, ii, mom, llc = monthName.toLocaleLowerCase();
if (!this._monthsParse) {
this._monthsParse = [];
this._longMonthsParse = [];
this._shortMonthsParse = [];
for (i = 0; i < 12; ++i) {
mom = createUTC([
2e3,
i
]);
this._shortMonthsParse[i] = this.monthsShort(mom, "").toLocaleLowerCase();
this._longMonthsParse[i] = this.months(mom, "").toLocaleLowerCase();
}
}
if (strict) {
if (format2 === "MMM") {
ii = indexOf.call(this._shortMonthsParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._longMonthsParse, llc);
return ii !== -1 ? ii : null;
}
} else {
if (format2 === "MMM") {
ii = indexOf.call(this._shortMonthsParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._longMonthsParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._longMonthsParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._shortMonthsParse, llc);
return ii !== -1 ? ii : null;
}
}
}
function localeMonthsParse(monthName, format2, strict) {
var i, mom, regex;
if (this._monthsParseExact) {
return handleStrictParse.call(this, monthName, format2, strict);
}
if (!this._monthsParse) {
this._monthsParse = [];
this._longMonthsParse = [];
this._shortMonthsParse = [];
}
for (i = 0; i < 12; i++) {
mom = createUTC([
2e3,
i
]);
if (strict && !this._longMonthsParse[i]) {
this._longMonthsParse[i] = new RegExp("^" + this.months(mom, "").replace(".", "") + "$", "i");
this._shortMonthsParse[i] = new RegExp("^" + this.monthsShort(mom, "").replace(".", "") + "$", "i");
}
if (!strict && !this._monthsParse[i]) {
regex = "^" + this.months(mom, "") + "|^" + this.monthsShort(mom, "");
this._monthsParse[i] = new RegExp(regex.replace(".", ""), "i");
}
if (strict && format2 === "MMMM" && this._longMonthsParse[i].test(monthName)) {
return i;
} else if (strict && format2 === "MMM" && this._shortMonthsParse[i].test(monthName)) {
return i;
} else if (!strict && this._monthsParse[i].test(monthName)) {
return i;
}
}
}
function setMonth(mom, value) {
if (!mom.isValid()) {
return mom;
}
if (typeof value === "string") {
if (/^\d+$/.test(value)) {
value = toInt(value);
} else {
value = mom.localeData().monthsParse(value);
if (!isNumber(value)) {
return mom;
}
}
}
var month = value, date = mom.date();
date = date < 29 ? date : Math.min(date, daysInMonth(mom.year(), month));
void (mom._isUTC ? mom._d.setUTCMonth(month, date) : mom._d.setMonth(month, date));
return mom;
}
function getSetMonth(value) {
if (value != null) {
setMonth(this, value);
hooks.updateOffset(this, true);
return this;
} else {
return get(this, "Month");
}
}
function getDaysInMonth() {
return daysInMonth(this.year(), this.month());
}
function monthsShortRegex(isStrict) {
if (this._monthsParseExact) {
if (!hasOwnProp(this, "_monthsRegex")) {
computeMonthsParse.call(this);
}
if (isStrict) {
return this._monthsShortStrictRegex;
} else {
return this._monthsShortRegex;
}
} else {
if (!hasOwnProp(this, "_monthsShortRegex")) {
this._monthsShortRegex = defaultMonthsShortRegex;
}
return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex;
}
}
function monthsRegex(isStrict) {
if (this._monthsParseExact) {
if (!hasOwnProp(this, "_monthsRegex")) {
computeMonthsParse.call(this);
}
if (isStrict) {
return this._monthsStrictRegex;
} else {
return this._monthsRegex;
}
} else {
if (!hasOwnProp(this, "_monthsRegex")) {
this._monthsRegex = defaultMonthsRegex;
}
return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex;
}
}
function computeMonthsParse() {
function cmpLenRev(a, b) {
return b.length - a.length;
}
var shortPieces = [], longPieces = [], mixedPieces = [], i, mom, shortP, longP;
for (i = 0; i < 12; i++) {
mom = createUTC([
2e3,
i
]);
shortP = regexEscape(this.monthsShort(mom, ""));
longP = regexEscape(this.months(mom, ""));
shortPieces.push(shortP);
longPieces.push(longP);
mixedPieces.push(longP);
mixedPieces.push(shortP);
}
shortPieces.sort(cmpLenRev);
longPieces.sort(cmpLenRev);
mixedPieces.sort(cmpLenRev);
this._monthsRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
this._monthsShortRegex = this._monthsRegex;
this._monthsStrictRegex = new RegExp("^(" + longPieces.join("|") + ")", "i");
this._monthsShortStrictRegex = new RegExp("^(" + shortPieces.join("|") + ")", "i");
}
function createDate(y, m, d, h, M, s, ms) {
var date;
if (y < 100 && y >= 0) {
date = new Date(y + 400, m, d, h, M, s, ms);
if (isFinite(date.getFullYear())) {
date.setFullYear(y);
}
} else {
date = new Date(y, m, d, h, M, s, ms);
}
return date;
}
function createUTCDate(y) {
var date, args;
if (y < 100 && y >= 0) {
args = Array.prototype.slice.call(arguments);
args[0] = y + 400;
date = new Date(Date.UTC.apply(null, args));
if (isFinite(date.getUTCFullYear())) {
date.setUTCFullYear(y);
}
} else {
date = new Date(Date.UTC.apply(null, arguments));
}
return date;
}
function firstWeekOffset(year, dow, doy) {
var fwd = 7 + dow - doy, fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
return -fwdlw + fwd - 1;
}
function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear;
if (dayOfYear <= 0) {
resYear = year - 1;
resDayOfYear = daysInYear(resYear) + dayOfYear;
} else if (dayOfYear > daysInYear(year)) {
resYear = year + 1;
resDayOfYear = dayOfYear - daysInYear(year);
} else {
resYear = year;
resDayOfYear = dayOfYear;
}
return {
year: resYear,
dayOfYear: resDayOfYear
};
}
function weekOfYear$2(mom, dow, doy) {
var weekOffset = firstWeekOffset(mom.year(), dow, doy), week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, resWeek, resYear;
if (week < 1) {
resYear = mom.year() - 1;
resWeek = week + weeksInYear(resYear, dow, doy);
} else if (week > weeksInYear(mom.year(), dow, doy)) {
resWeek = week - weeksInYear(mom.year(), dow, doy);
resYear = mom.year() + 1;
} else {
resYear = mom.year();
resWeek = week;
}
return {
week: resWeek,
year: resYear
};
}
function weeksInYear(year, dow, doy) {
var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
}
addFormatToken("w", [
"ww",
2
], "wo", "week");
addFormatToken("W", [
"WW",
2
], "Wo", "isoWeek");
addRegexToken("w", match1to2, match1to2NoLeadingZero);
addRegexToken("ww", match1to2, match2);
addRegexToken("W", match1to2, match1to2NoLeadingZero);
addRegexToken("WW", match1to2, match2);
addWeekParseToken([
"w",
"ww",
"W",
"WW"
], function(input, week, config, token2) {
week[token2.substr(0, 1)] = toInt(input);
});
function localeWeek(mom) {
return weekOfYear$2(mom, this._week.dow, this._week.doy).week;
}
var defaultLocaleWeek = {
dow: 0,
doy: 6
};
function localeFirstDayOfWeek() {
return this._week.dow;
}
function localeFirstDayOfYear() {
return this._week.doy;
}
function getSetWeek(input) {
var week = this.localeData().week(this);
return input == null ? week : this.add((input - week) * 7, "d");
}
function getSetISOWeek(input) {
var week = weekOfYear$2(this, 1, 4).week;
return input == null ? week : this.add((input - week) * 7, "d");
}
addFormatToken("d", 0, "do", "day");
addFormatToken("dd", 0, 0, function(format2) {
return this.localeData().weekdaysMin(this, format2);
});
addFormatToken("ddd", 0, 0, function(format2) {
return this.localeData().weekdaysShort(this, format2);
});
addFormatToken("dddd", 0, 0, function(format2) {
return this.localeData().weekdays(this, format2);
});
addFormatToken("e", 0, 0, "weekday");
addFormatToken("E", 0, 0, "isoWeekday");
addRegexToken("d", match1to2);
addRegexToken("e", match1to2);
addRegexToken("E", match1to2);
addRegexToken("dd", function(isStrict, locale2) {
return locale2.weekdaysMinRegex(isStrict);
});
addRegexToken("ddd", function(isStrict, locale2) {
return locale2.weekdaysShortRegex(isStrict);
});
addRegexToken("dddd", function(isStrict, locale2) {
return locale2.weekdaysRegex(isStrict);
});
addWeekParseToken([
"dd",
"ddd",
"dddd"
], function(input, week, config, token2) {
var weekday = config._locale.weekdaysParse(input, token2, config._strict);
if (weekday != null) {
week.d = weekday;
} else {
getParsingFlags(config).invalidWeekday = input;
}
});
addWeekParseToken([
"d",
"e",
"E"
], function(input, week, config, token2) {
week[token2] = toInt(input);
});
function parseWeekday(input, locale2) {
if (typeof input !== "string") {
return input;
}
if (!isNaN(input)) {
return parseInt(input, 10);
}
input = locale2.weekdaysParse(input);
if (typeof input === "number") {
return input;
}
return null;
}
function parseIsoWeekday(input, locale2) {
if (typeof input === "string") {
return locale2.weekdaysParse(input) % 7 || 7;
}
return isNaN(input) ? null : input;
}
function shiftWeekdays(ws, n) {
return ws.slice(n, 7).concat(ws.slice(0, n));
}
var defaultLocaleWeekdays = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), defaultLocaleWeekdaysShort = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), defaultLocaleWeekdaysMin = "Su_Mo_Tu_We_Th_Fr_Sa".split("_"), defaultWeekdaysRegex = matchWord, defaultWeekdaysShortRegex = matchWord, defaultWeekdaysMinRegex = matchWord;
function localeWeekdays(m, format2) {
var weekdays = isArray(this._weekdays) ? this._weekdays : this._weekdays[m && m !== true && this._weekdays.isFormat.test(format2) ? "format" : "standalone"];
return m === true ? shiftWeekdays(weekdays, this._week.dow) : m ? weekdays[m.day()] : weekdays;
}
function localeWeekdaysShort(m) {
return m === true ? shiftWeekdays(this._weekdaysShort, this._week.dow) : m ? this._weekdaysShort[m.day()] : this._weekdaysShort;
}
function localeWeekdaysMin(m) {
return m === true ? shiftWeekdays(this._weekdaysMin, this._week.dow) : m ? this._weekdaysMin[m.day()] : this._weekdaysMin;
}
function handleStrictParse$1(weekdayName, format2, strict) {
var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
if (!this._weekdaysParse) {
this._weekdaysParse = [];
this._shortWeekdaysParse = [];
this._minWeekdaysParse = [];
for (i = 0; i < 7; ++i) {
mom = createUTC([
2e3,
1
]).day(i);
this._minWeekdaysParse[i] = this.weekdaysMin(mom, "").toLocaleLowerCase();
this._shortWeekdaysParse[i] = this.weekdaysShort(mom, "").toLocaleLowerCase();
this._weekdaysParse[i] = this.weekdays(mom, "").toLocaleLowerCase();
}
}
if (strict) {
if (format2 === "dddd") {
ii = indexOf.call(this._weekdaysParse, llc);
return ii !== -1 ? ii : null;
} else if (format2 === "ddd") {
ii = indexOf.call(this._shortWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
}
} else {
if (format2 === "dddd") {
ii = indexOf.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._shortWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else if (format2 === "ddd") {
ii = indexOf.call(this._shortWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._minWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._shortWeekdaysParse, llc);
return ii !== -1 ? ii : null;
}
}
}
function localeWeekdaysParse(weekdayName, format2, strict) {
var i, mom, regex;
if (this._weekdaysParseExact) {
return handleStrictParse$1.call(this, weekdayName, format2, strict);
}
if (!this._weekdaysParse) {
this._weekdaysParse = [];
this._minWeekdaysParse = [];
this._shortWeekdaysParse = [];
this._fullWeekdaysParse = [];
}
for (i = 0; i < 7; i++) {
mom = createUTC([
2e3,
1
]).day(i);
if (strict && !this._fullWeekdaysParse[i]) {
this._fullWeekdaysParse[i] = new RegExp("^" + this.weekdays(mom, "").replace(".", "\\.?") + "$", "i");
this._shortWeekdaysParse[i] = new RegExp("^" + this.weekdaysShort(mom, "").replace(".", "\\.?") + "$", "i");
this._minWeekdaysParse[i] = new RegExp("^" + this.weekdaysMin(mom, "").replace(".", "\\.?") + "$", "i");
}
if (!this._weekdaysParse[i]) {
regex = "^" + this.weekdays(mom, "") + "|^" + this.weekdaysShort(mom, "") + "|^" + this.weekdaysMin(mom, "");
this._weekdaysParse[i] = new RegExp(regex.replace(".", ""), "i");
}
if (strict && format2 === "dddd" && this._fullWeekdaysParse[i].test(weekdayName)) {
return i;
} else if (strict && format2 === "ddd" && this._shortWeekdaysParse[i].test(weekdayName)) {
return i;
} else if (strict && format2 === "dd" && this._minWeekdaysParse[i].test(weekdayName)) {
return i;
} else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
return i;
}
}
}
function getSetDayOfWeek(input) {
if (!this.isValid()) {
return input != null ? this : NaN;
}
var day = get(this, "Day");
if (input != null) {
input = parseWeekday(input, this.localeData());
return this.add(input - day, "d");
} else {
return day;
}
}
function getSetLocaleDayOfWeek(input) {
if (!this.isValid()) {
return input != null ? this : NaN;
}
var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
return input == null ? weekday : this.add(input - weekday, "d");
}
function getSetISODayOfWeek(input) {
if (!this.isValid()) {
return input != null ? this : NaN;
}
if (input != null) {
var weekday = parseIsoWeekday(input, this.localeData());
return this.day(this.day() % 7 ? weekday : weekday - 7);
} else {
return this.day() || 7;
}
}
function weekdaysRegex(isStrict) {
if (this._weekdaysParseExact) {
if (!hasOwnProp(this, "_weekdaysRegex")) {
computeWeekdaysParse.call(this);
}
if (isStrict) {
return this._weekdaysStrictRegex;
} else {
return this._weekdaysRegex;
}
} else {
if (!hasOwnProp(this, "_weekdaysRegex")) {
this._weekdaysRegex = defaultWeekdaysRegex;
}
return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex;
}
}
function weekdaysShortRegex(isStrict) {
if (this._weekdaysParseExact) {
if (!hasOwnProp(this, "_weekdaysRegex")) {
computeWeekdaysParse.call(this);
}
if (isStrict) {
return this._weekdaysShortStrictRegex;
} else {
return this._weekdaysShortRegex;
}
} else {
if (!hasOwnProp(this, "_weekdaysShortRegex")) {
this._weekdaysShortRegex = defaultWeekdaysShortRegex;
}
return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
}
}
function weekdaysMinRegex(isStrict) {
if (this._weekdaysParseExact) {
if (!hasOwnProp(this, "_weekdaysRegex")) {
computeWeekdaysParse.call(this);
}
if (isStrict) {
return this._weekdaysMinStrictRegex;
} else {
return this._weekdaysMinRegex;
}
} else {
if (!hasOwnProp(this, "_weekdaysMinRegex")) {
this._weekdaysMinRegex = defaultWeekdaysMinRegex;
}
return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
}
}
function computeWeekdaysParse() {
function cmpLenRev(a, b) {
return b.length - a.length;
}
var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], i, mom, minp, shortp, longp;
for (i = 0; i < 7; i++) {
mom = createUTC([
2e3,
1
]).day(i);
minp = regexEscape(this.weekdaysMin(mom, ""));
shortp = regexEscape(this.weekdaysShort(mom, ""));
longp = regexEscape(this.weekdays(mom, ""));
minPieces.push(minp);
shortPieces.push(shortp);
longPieces.push(longp);
mixedPieces.push(minp);
mixedPieces.push(shortp);
mixedPieces.push(longp);
}
minPieces.sort(cmpLenRev);
shortPieces.sort(cmpLenRev);
longPieces.sort(cmpLenRev);
mixedPieces.sort(cmpLenRev);
this._weekdaysRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
this._weekdaysShortRegex = this._weekdaysRegex;
this._weekdaysMinRegex = this._weekdaysRegex;
this._weekdaysStrictRegex = new RegExp("^(" + longPieces.join("|") + ")", "i");
this._weekdaysShortStrictRegex = new RegExp("^(" + shortPieces.join("|") + ")", "i");
this._weekdaysMinStrictRegex = new RegExp("^(" + minPieces.join("|") + ")", "i");
}
function hFormat() {
return this.hours() % 12 || 12;
}
function kFormat() {
return this.hours() || 24;
}
addFormatToken("H", [
"HH",
2
], 0, "hour");
addFormatToken("h", [
"hh",
2
], 0, hFormat);
addFormatToken("k", [
"kk",
2
], 0, kFormat);
addFormatToken("hmm", 0, 0, function() {
return "" + hFormat.apply(this) + zeroFill(this.minutes(), 2);
});
addFormatToken("hmmss", 0, 0, function() {
return "" + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
});
addFormatToken("Hmm", 0, 0, function() {
return "" + this.hours() + zeroFill(this.minutes(), 2);
});
addFormatToken("Hmmss", 0, 0, function() {
return "" + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
});
function meridiem(token2, lowercase) {
addFormatToken(token2, 0, 0, function() {
return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
});
}
meridiem("a", true);
meridiem("A", false);
function matchMeridiem(isStrict, locale2) {
return locale2._meridiemParse;
}
addRegexToken("a", matchMeridiem);
addRegexToken("A", matchMeridiem);
addRegexToken("H", match1to2, match1to2HasZero);
addRegexToken("h", match1to2, match1to2NoLeadingZero);
addRegexToken("k", match1to2, match1to2NoLeadingZero);
addRegexToken("HH", match1to2, match2);
addRegexToken("hh", match1to2, match2);
addRegexToken("kk", match1to2, match2);
addRegexToken("hmm", match3to4);
addRegexToken("hmmss", match5to6);
addRegexToken("Hmm", match3to4);
addRegexToken("Hmmss", match5to6);
addParseToken([
"H",
"HH"
], HOUR);
addParseToken([
"k",
"kk"
], function(input, array, config) {
var kInput = toInt(input);
array[HOUR] = kInput === 24 ? 0 : kInput;
});
addParseToken([
"a",
"A"
], function(input, array, config) {
config._isPm = config._locale.isPM(input);
config._meridiem = input;
});
addParseToken([
"h",
"hh"
], function(input, array, config) {
array[HOUR] = toInt(input);
getParsingFlags(config).bigHour = true;
});
addParseToken("hmm", function(input, array, config) {
var pos = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos));
array[MINUTE] = toInt(input.substr(pos));
getParsingFlags(config).bigHour = true;
});
addParseToken("hmmss", function(input, array, config) {
var pos1 = input.length - 4, pos2 = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos1));
array[MINUTE] = toInt(input.substr(pos1, 2));
array[SECOND] = toInt(input.substr(pos2));
getParsingFlags(config).bigHour = true;
});
addParseToken("Hmm", function(input, array, config) {
var pos = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos));
array[MINUTE] = toInt(input.substr(pos));
});
addParseToken("Hmmss", function(input, array, config) {
var pos1 = input.length - 4, pos2 = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos1));
array[MINUTE] = toInt(input.substr(pos1, 2));
array[SECOND] = toInt(input.substr(pos2));
});
function localeIsPM(input) {
return (input + "").toLowerCase().charAt(0) === "p";
}
var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i, getSetHour = makeGetSet("Hours", true);
function localeMeridiem(hours2, minutes2, isLower) {
if (hours2 > 11) {
return isLower ? "pm" : "PM";
} else {
return isLower ? "am" : "AM";
}
}
var baseConfig = {
calendar: defaultCalendar,
longDateFormat: defaultLongDateFormat,
invalidDate: defaultInvalidDate,
ordinal: defaultOrdinal,
dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
relativeTime: defaultRelativeTime,
months: defaultLocaleMonths,
monthsShort: defaultLocaleMonthsShort,
week: defaultLocaleWeek,
weekdays: defaultLocaleWeekdays,
weekdaysMin: defaultLocaleWeekdaysMin,
weekdaysShort: defaultLocaleWeekdaysShort,
meridiemParse: defaultLocaleMeridiemParse
};
var locales = {}, localeFamilies = {}, globalLocale;
function commonPrefix(arr1, arr2) {
var i, minl = Math.min(arr1.length, arr2.length);
for (i = 0; i < minl; i += 1) {
if (arr1[i] !== arr2[i]) {
return i;
}
}
return minl;
}
function normalizeLocale(key) {
return key ? key.toLowerCase().replace("_", "-") : key;
}
function chooseLocale(names) {
var i = 0, j, next, locale2, split;
while (i < names.length) {
split = normalizeLocale(names[i]).split("-");
j = split.length;
next = normalizeLocale(names[i + 1]);
next = next ? next.split("-") : null;
while (j > 0) {
locale2 = loadLocale(split.slice(0, j).join("-"));
if (locale2) {
return locale2;
}
if (next && next.length >= j && commonPrefix(split, next) >= j - 1) {
break;
}
j--;
}
i++;
}
return globalLocale;
}
function isLocaleNameSane(name) {
return !!(name && name.match("^[^/\\\\]*$"));
}
function loadLocale(name) {
var oldLocale = null, aliasedRequire;
if (locales[name] === void 0 && typeof module !== "undefined" && module && module.exports && isLocaleNameSane(name)) {
try {
oldLocale = globalLocale._abbr;
aliasedRequire = require;
aliasedRequire("./locale/" + name);
getSetGlobalLocale(oldLocale);
} catch (e) {
locales[name] = null;
}
}
return locales[name];
}
function getSetGlobalLocale(key, values) {
var data;
if (key) {
if (isUndefined(values)) {
data = getLocale(key);
} else {
data = defineLocale(key, values);
}
if (data) {
globalLocale = data;
} else {
if (typeof console !== "undefined" && console.warn) {
console.warn("Locale " + key + " not found. Did you forget to load it?");
}
}
}
return globalLocale._abbr;
}
function defineLocale(name, config) {
if (config !== null) {
var locale2, parentConfig = baseConfig;
config.abbr = name;
if (locales[name] != null) {
deprecateSimple("defineLocaleOverride", "use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info.");
parentConfig = locales[name]._config;
} else if (config.parentLocale != null) {
if (locales[config.parentLocale] != null) {
parentConfig = locales[config.parentLocale]._config;
} else {
locale2 = loadLocale(config.parentLocale);
if (locale2 != null) {
parentConfig = locale2._config;
} else {
if (!localeFamilies[config.parentLocale]) {
localeFamilies[config.parentLocale] = [];
}
localeFamilies[config.parentLocale].push({
name,
config
});
return null;
}
}
}
locales[name] = new Locale(mergeConfigs(parentConfig, config));
if (localeFamilies[name]) {
localeFamilies[name].forEach(function(x) {
defineLocale(x.name, x.config);
});
}
getSetGlobalLocale(name);
return locales[name];
} else {
delete locales[name];
return null;
}
}
function updateLocale(name, config) {
if (config != null) {
var locale2, tmpLocale, parentConfig = baseConfig;
if (locales[name] != null && locales[name].parentLocale != null) {
locales[name].set(mergeConfigs(locales[name]._config, config));
} else {
tmpLocale = loadLocale(name);
if (tmpLocale != null) {
parentConfig = tmpLocale._config;
}
config = mergeConfigs(parentConfig, config);
if (tmpLocale == null) {
config.abbr = name;
}
locale2 = new Locale(config);
locale2.parentLocale = locales[name];
locales[name] = locale2;
}
getSetGlobalLocale(name);
} else {
if (locales[name] != null) {
if (locales[name].parentLocale != null) {
locales[name] = locales[name].parentLocale;
if (name === getSetGlobalLocale()) {
getSetGlobalLocale(name);
}
} else if (locales[name] != null) {
delete locales[name];
}
}
}
return locales[name];
}
function getLocale(key) {
var locale2;
if (key && key._locale && key._locale._abbr) {
key = key._locale._abbr;
}
if (!key) {
return globalLocale;
}
if (!isArray(key)) {
locale2 = loadLocale(key);
if (locale2) {
return locale2;
}
key = [
key
];
}
return chooseLocale(key);
}
function listLocales() {
return keys(locales);
}
function checkOverflow(m) {
var overflow, a = m._a;
if (a && getParsingFlags(m).overflow === -2) {
overflow = a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[HOUR] < 0 || a[HOUR] > 24 || a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0) ? HOUR : a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : -1;
if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
overflow = DATE;
}
if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
overflow = WEEK;
}
if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
overflow = WEEKDAY;
}
getParsingFlags(m).overflow = overflow;
}
return m;
}
var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, isoDates = [
[
"YYYYYY-MM-DD",
/[+-]\d{6}-\d\d-\d\d/
],
[
"YYYY-MM-DD",
/\d{4}-\d\d-\d\d/
],
[
"GGGG-[W]WW-E",
/\d{4}-W\d\d-\d/
],
[
"GGGG-[W]WW",
/\d{4}-W\d\d/,
false
],
[
"YYYY-DDD",
/\d{4}-\d{3}/
],
[
"YYYY-MM",
/\d{4}-\d\d/,
false
],
[
"YYYYYYMMDD",
/[+-]\d{10}/
],
[
"YYYYMMDD",
/\d{8}/
],
[
"GGGG[W]WWE",
/\d{4}W\d{3}/
],
[
"GGGG[W]WW",
/\d{4}W\d{2}/,
false
],
[
"YYYYDDD",
/\d{7}/
],
[
"YYYYMM",
/\d{6}/,
false
],
[
"YYYY",
/\d{4}/,
false
]
], isoTimes = [
[
"HH:mm:ss.SSSS",
/\d\d:\d\d:\d\d\.\d+/
],
[
"HH:mm:ss,SSSS",
/\d\d:\d\d:\d\d,\d+/
],
[
"HH:mm:ss",
/\d\d:\d\d:\d\d/
],
[
"HH:mm",
/\d\d:\d\d/
],
[
"HHmmss.SSSS",
/\d\d\d\d\d\d\.\d+/
],
[
"HHmmss,SSSS",
/\d\d\d\d\d\d,\d+/
],
[
"HHmmss",
/\d\d\d\d\d\d/
],
[
"HHmm",
/\d\d\d\d/
],
[
"HH",
/\d\d/
]
], aspNetJsonRegex = /^\/?Date\((-?\d+)/i, rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/, obsOffsets = {
UT: 0,
GMT: 0,
EDT: -4 * 60,
EST: -5 * 60,
CDT: -5 * 60,
CST: -6 * 60,
MDT: -6 * 60,
MST: -7 * 60,
PDT: -7 * 60,
PST: -8 * 60
};
function configFromISO(config) {
var i, l, string = config._i, match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), allowTime, dateFormat, timeFormat, tzFormat, isoDatesLen = isoDates.length, isoTimesLen = isoTimes.length;
if (match) {
getParsingFlags(config).iso = true;
for (i = 0, l = isoDatesLen; i < l; i++) {
if (isoDates[i][1].exec(match[1])) {
dateFormat = isoDates[i][0];
allowTime = isoDates[i][2] !== false;
break;
}
}
if (dateFormat == null) {
config._isValid = false;
return;
}
if (match[3]) {
for (i = 0, l = isoTimesLen; i < l; i++) {
if (isoTimes[i][1].exec(match[3])) {
timeFormat = (match[2] || " ") + isoTimes[i][0];
break;
}
}
if (timeFormat == null) {
config._isValid = false;
return;
}
}
if (!allowTime && timeFormat != null) {
config._isValid = false;
return;
}
if (match[4]) {
if (tzRegex.exec(match[4])) {
tzFormat = "Z";
} else {
config._isValid = false;
return;
}
}
config._f = dateFormat + (timeFormat || "") + (tzFormat || "");
configFromStringAndFormat(config);
} else {
config._isValid = false;
}
}
function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
var result = [
untruncateYear(yearStr),
defaultLocaleMonthsShort.indexOf(monthStr),
parseInt(dayStr, 10),
parseInt(hourStr, 10),
parseInt(minuteStr, 10)
];
if (secondStr) {
result.push(parseInt(secondStr, 10));
}
return result;
}
function untruncateYear(yearStr) {
var year = parseInt(yearStr, 10);
if (year <= 49) {
return 2e3 + year;
} else if (year <= 999) {
return 1900 + year;
}
return year;
}
function preprocessRFC2822(s) {
return s.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "");
}
function checkWeekday(weekdayStr, parsedInput, config) {
if (weekdayStr) {
var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay();
if (weekdayProvided !== weekdayActual) {
getParsingFlags(config).weekdayMismatch = true;
config._isValid = false;
return false;
}
}
return true;
}
function calculateOffset(obsOffset, militaryOffset, numOffset) {
if (obsOffset) {
return obsOffsets[obsOffset];
} else if (militaryOffset) {
return 0;
} else {
var hm = parseInt(numOffset, 10), m = hm % 100, h = (hm - m) / 100;
return h * 60 + m;
}
}
function configFromRFC2822(config) {
var match = rfc2822.exec(preprocessRFC2822(config._i)), parsedArray;
if (match) {
parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]);
if (!checkWeekday(match[1], parsedArray, config)) {
return;
}
config._a = parsedArray;
config._tzm = calculateOffset(match[8], match[9], match[10]);
config._d = createUTCDate.apply(null, config._a);
config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
getParsingFlags(config).rfc2822 = true;
} else {
config._isValid = false;
}
}
function configFromString(config) {
var matched = aspNetJsonRegex.exec(config._i);
if (matched !== null) {
config._d = /* @__PURE__ */ new Date(+matched[1]);
return;
}
configFromISO(config);
if (config._isValid === false) {
delete config._isValid;
} else {
return;
}
configFromRFC2822(config);
if (config._isValid === false) {
delete config._isValid;
} else {
return;
}
if (config._strict) {
config._isValid = false;
} else {
hooks.createFromInputFallback(config);
}
}
hooks.createFromInputFallback = deprecate("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.", function(config) {
config._d = /* @__PURE__ */ new Date(config._i + (config._useUTC ? " UTC" : ""));
});
function defaults(a, b, c) {
if (a != null) {
return a;
}
if (b != null) {
return b;
}
return c;
}
function currentDateArray(config) {
var nowValue = new Date(hooks.now());
if (config._useUTC) {
return [
nowValue.getUTCFullYear(),
nowValue.getUTCMonth(),
nowValue.getUTCDate()
];
}
return [
nowValue.getFullYear(),
nowValue.getMonth(),
nowValue.getDate()
];
}
function configFromArray(config) {
var i, date, input = [], currentDate, expectedWeekday, yearToUse;
if (config._d) {
return;
}
currentDate = currentDateArray(config);
if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
dayOfYearFromWeekInfo(config);
}
if (config._dayOfYear != null) {
yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
getParsingFlags(config)._overflowDayOfYear = true;
}
date = createUTCDate(yearToUse, 0, config._dayOfYear);
config._a[MONTH] = date.getUTCMonth();
config._a[DATE] = date.getUTCDate();
}
for (i = 0; i < 3 && config._a[i] == null; ++i) {
config._a[i] = input[i] = currentDate[i];
}
for (; i < 7; i++) {
config._a[i] = input[i] = config._a[i] == null ? i === 2 ? 1 : 0 : config._a[i];
}
if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) {
config._nextDay = true;
config._a[HOUR] = 0;
}
config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
if (config._tzm != null) {
config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
}
if (config._nextDay) {
config._a[HOUR] = 24;
}
if (config._w && typeof config._w.d !== "undefined" && config._w.d !== expectedWeekday) {
getParsingFlags(config).weekdayMismatch = true;
}
}
function dayOfYearFromWeekInfo(config) {
var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
w = config._w;
if (w.GG != null || w.W != null || w.E != null) {
dow = 1;
doy = 4;
weekYear = defaults(w.GG, config._a[YEAR], weekOfYear$2(createLocal(), 1, 4).year);
week = defaults(w.W, 1);
weekday = defaults(w.E, 1);
if (weekday < 1 || weekday > 7) {
weekdayOverflow = true;
}
} else {
dow = config._locale._week.dow;
doy = config._locale._week.doy;
curWeek = weekOfYear$2(createLocal(), dow, doy);
weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
week = defaults(w.w, curWeek.week);
if (w.d != null) {
weekday = w.d;
if (weekday < 0 || weekday > 6) {
weekdayOverflow = true;
}
} else if (w.e != null) {
weekday = w.e + dow;
if (w.e < 0 || w.e > 6) {
weekdayOverflow = true;
}
} else {
weekday = dow;
}
}
if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
getParsingFlags(config)._overflowWeeks = true;
} else if (weekdayOverflow != null) {
getParsingFlags(config)._overflowWeekday = true;
} else {
temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
config._a[YEAR] = temp.year;
config._dayOfYear = temp.dayOfYear;
}
}
hooks.ISO_8601 = function() {
};
hooks.RFC_2822 = function() {
};
function configFromStringAndFormat(config) {
if (config._f === hooks.ISO_8601) {
configFromISO(config);
return;
}
if (config._f === hooks.RFC_2822) {
configFromRFC2822(config);
return;
}
config._a = [];
getParsingFlags(config).empty = true;
var string = "" + config._i, i, parsedInput, tokens2, token2, skipped, stringLength = string.length, totalParsedInputLength = 0, era, tokenLen;
tokens2 = expandFormat$1(config._f, config._locale).match(formattingTokens) || [];
tokenLen = tokens2.length;
for (i = 0; i < tokenLen; i++) {
token2 = tokens2[i];
parsedInput = (string.match(getParseRegexForToken(token2, config)) || [])[0];
if (parsedInput) {
skipped = string.substr(0, string.indexOf(parsedInput));
if (skipped.length > 0) {
getParsingFlags(config).unusedInput.push(skipped);
}
string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
totalParsedInputLength += parsedInput.length;
}
if (formatTokenFunctions[token2]) {
if (parsedInput) {
getParsingFlags(config).empty = false;
} else {
getParsingFlags(config).unusedTokens.push(token2);
}
addTimeToArrayFromToken(token2, parsedInput, config);
} else if (config._strict && !parsedInput) {
getParsingFlags(config).unusedTokens.push(token2);
}
}
getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
if (string.length > 0) {
getParsingFlags(config).unusedInput.push(string);
}
if (config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0) {
getParsingFlags(config).bigHour = void 0;
}
getParsingFlags(config).parsedDateParts = config._a.slice(0);
getParsingFlags(config).meridiem = config._meridiem;
config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
era = getParsingFlags(config).era;
if (era !== null) {
config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);
}
configFromArray(config);
checkOverflow(config);
}
function meridiemFixWrap(locale2, hour, meridiem2) {
var isPm;
if (meridiem2 == null) {
return hour;
}
if (locale2.meridiemHour != null) {
return locale2.meridiemHour(hour, meridiem2);
} else if (locale2.isPM != null) {
isPm = locale2.isPM(meridiem2);
if (isPm && hour < 12) {
hour += 12;
}
if (!isPm && hour === 12) {
hour = 0;
}
return hour;
} else {
return hour;
}
}
function configFromStringAndArray(config) {
var tempConfig, bestMoment, scoreToBeat, i, currentScore, validFormatFound, bestFormatIsValid = false, configfLen = config._f.length;
if (configfLen === 0) {
getParsingFlags(config).invalidFormat = true;
config._d = /* @__PURE__ */ new Date(NaN);
return;
}
for (i = 0; i < configfLen; i++) {
currentScore = 0;
validFormatFound = false;
tempConfig = copyConfig({}, config);
if (config._useUTC != null) {
tempConfig._useUTC = config._useUTC;
}
tempConfig._f = config._f[i];
configFromStringAndFormat(tempConfig);
if (isValid(tempConfig)) {
validFormatFound = true;
}
currentScore += getParsingFlags(tempConfig).charsLeftOver;
currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
getParsingFlags(tempConfig).score = currentScore;
if (!bestFormatIsValid) {
if (scoreToBeat == null || currentScore < scoreToBeat || validFormatFound) {
scoreToBeat = currentScore;
bestMoment = tempConfig;
if (validFormatFound) {
bestFormatIsValid = true;
}
}
} else {
if (currentScore < scoreToBeat) {
scoreToBeat = currentScore;
bestMoment = tempConfig;
}
}
}
extend(config, bestMoment || tempConfig);
}
function configFromObject(config) {
if (config._d) {
return;
}
var i = normalizeObjectUnits(config._i), dayOrDate = i.day === void 0 ? i.date : i.day;
config._a = map([
i.year,
i.month,
dayOrDate,
i.hour,
i.minute,
i.second,
i.millisecond
], function(obj) {
return obj && parseInt(obj, 10);
});
configFromArray(config);
}
function createFromConfig(config) {
var res = new Moment(checkOverflow(prepareConfig(config)));
if (res._nextDay) {
res.add(1, "d");
res._nextDay = void 0;
}
return res;
}
function prepareConfig(config) {
var input = config._i, format2 = config._f;
config._locale = config._locale || getLocale(config._l);
if (input === null || format2 === void 0 && input === "") {
return createInvalid({
nullInput: true
});
}
if (typeof input === "string") {
config._i = input = config._locale.preparse(input);
}
if (isMoment(input)) {
return new Moment(checkOverflow(input));
} else if (isDate(input)) {
config._d = input;
} else if (isArray(format2)) {
configFromStringAndArray(config);
} else if (format2) {
configFromStringAndFormat(config);
} else {
configFromInput(config);
}
if (!isValid(config)) {
config._d = null;
}
return config;
}
function configFromInput(config) {
var input = config._i;
if (isUndefined(input)) {
config._d = new Date(hooks.now());
} else if (isDate(input)) {
config._d = new Date(input.valueOf());
} else if (typeof input === "string") {
configFromString(config);
} else if (isArray(input)) {
config._a = map(input.slice(0), function(obj) {
return parseInt(obj, 10);
});
configFromArray(config);
} else if (isObject(input)) {
configFromObject(config);
} else if (isNumber(input)) {
config._d = new Date(input);
} else {
hooks.createFromInputFallback(config);
}
}
function createLocalOrUTC(input, format2, locale2, strict, isUTC) {
var c = {};
if (format2 === true || format2 === false) {
strict = format2;
format2 = void 0;
}
if (locale2 === true || locale2 === false) {
strict = locale2;
locale2 = void 0;
}
if (isObject(input) && isObjectEmpty(input) || isArray(input) && input.length === 0) {
input = void 0;
}
c._isAMomentObject = true;
c._useUTC = c._isUTC = isUTC;
c._l = locale2;
c._i = input;
c._f = format2;
c._strict = strict;
return createFromConfig(c);
}
function createLocal(input, format2, locale2, strict) {
return createLocalOrUTC(input, format2, locale2, strict, false);
}
var prototypeMin = deprecate("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/", function() {
var other = createLocal.apply(null, arguments);
if (this.isValid() && other.isValid()) {
return other < this ? this : other;
} else {
return createInvalid();
}
}), prototypeMax = deprecate("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/", function() {
var other = createLocal.apply(null, arguments);
if (this.isValid() && other.isValid()) {
return other > this ? this : other;
} else {
return createInvalid();
}
});
function pickBy(fn, moments) {
var res, i;
if (moments.length === 1 && isArray(moments[0])) {
moments = moments[0];
}
if (!moments.length) {
return createLocal();
}
res = moments[0];
for (i = 1; i < moments.length; ++i) {
if (!moments[i].isValid() || moments[i][fn](res)) {
res = moments[i];
}
}
return res;
}
function min() {
var args = [].slice.call(arguments, 0);
return pickBy("isBefore", args);
}
function max() {
var args = [].slice.call(arguments, 0);
return pickBy("isAfter", args);
}
var now = function() {
return Date.now ? Date.now() : +/* @__PURE__ */ new Date();
};
var ordering = [
"year",
"quarter",
"month",
"week",
"day",
"hour",
"minute",
"second",
"millisecond"
];
function isDurationValid(m) {
var key, unitHasDecimal = false, i, orderLen = ordering.length;
for (key in m) {
if (hasOwnProp(m, key) && !(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
return false;
}
}
for (i = 0; i < orderLen; ++i) {
if (m[ordering[i]]) {
if (unitHasDecimal) {
return false;
}
if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
unitHasDecimal = true;
}
}
}
return true;
}
function isValid$1() {
return this._isValid;
}
function createInvalid$1() {
return createDuration(NaN);
}
function Duration(duration) {
var normalizedInput = normalizeObjectUnits(duration), years2 = normalizedInput.year || 0, quarters = normalizedInput.quarter || 0, months2 = normalizedInput.month || 0, weeks2 = normalizedInput.week || normalizedInput.isoWeek || 0, days2 = normalizedInput.day || 0, hours2 = normalizedInput.hour || 0, minutes2 = normalizedInput.minute || 0, seconds2 = normalizedInput.second || 0, milliseconds2 = normalizedInput.millisecond || 0;
this._isValid = isDurationValid(normalizedInput);
this._milliseconds = +milliseconds2 + seconds2 * 1e3 + minutes2 * 6e4 + hours2 * 1e3 * 60 * 60;
this._days = +days2 + weeks2 * 7;
this._months = +months2 + quarters * 3 + years2 * 12;
this._data = {};
this._locale = getLocale();
this._bubble();
}
function isDuration(obj) {
return obj instanceof Duration;
}
function absRound(number) {
if (number < 0) {
return Math.round(-1 * number) * -1;
} else {
return Math.round(number);
}
}
function compareArrays(array1, array2, dontConvert) {
var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i;
for (i = 0; i < len; i++) {
if (toInt(array1[i]) !== toInt(array2[i])) {
diffs++;
}
}
return diffs + lengthDiff;
}
function offset(token2, separator) {
addFormatToken(token2, 0, 0, function() {
var offset2 = this.utcOffset(), sign2 = "+";
if (offset2 < 0) {
offset2 = -offset2;
sign2 = "-";
}
return sign2 + zeroFill(~~(offset2 / 60), 2) + separator + zeroFill(~~offset2 % 60, 2);
});
}
offset("Z", ":");
offset("ZZ", "");
addRegexToken("Z", matchShortOffset);
addRegexToken("ZZ", matchShortOffset);
addParseToken([
"Z",
"ZZ"
], function(input, array, config) {
config._useUTC = true;
config._tzm = offsetFromString(matchShortOffset, input);
});
var chunkOffset = /([\+\-]|\d\d)/gi;
function offsetFromString(matcher, string) {
var matches = (string || "").match(matcher), chunk, parts, minutes2;
if (matches === null) {
return null;
}
chunk = matches[matches.length - 1] || [];
parts = (chunk + "").match(chunkOffset) || [
"-",
0,
0
];
minutes2 = +(parts[1] * 60) + toInt(parts[2]);
return minutes2 === 0 ? 0 : parts[0] === "+" ? minutes2 : -minutes2;
}
function cloneWithOffset(input, model) {
var res, diff2;
if (model._isUTC) {
res = model.clone();
diff2 = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();
res._d.setTime(res._d.valueOf() + diff2);
hooks.updateOffset(res, false);
return res;
} else {
return createLocal(input).local();
}
}
function getDateOffset(m) {
return -Math.round(m._d.getTimezoneOffset());
}
hooks.updateOffset = function() {
};
function getSetOffset(input, keepLocalTime, keepMinutes) {
var offset2 = this._offset || 0, localAdjust;
if (!this.isValid()) {
return input != null ? this : NaN;
}
if (input != null) {
if (typeof input === "string") {
input = offsetFromString(matchShortOffset, input);
if (input === null) {
return this;
}
} else if (Math.abs(input) < 16 && !keepMinutes) {
input = input * 60;
}
if (!this._isUTC && keepLocalTime) {
localAdjust = getDateOffset(this);
}
this._offset = input;
this._isUTC = true;
if (localAdjust != null) {
this.add(localAdjust, "m");
}
if (offset2 !== input) {
if (!keepLocalTime || this._changeInProgress) {
addSubtract(this, createDuration(input - offset2, "m"), 1, false);
} else if (!this._changeInProgress) {
this._changeInProgress = true;
hooks.updateOffset(this, true);
this._changeInProgress = null;
}
}
return this;
} else {
return this._isUTC ? offset2 : getDateOffset(this);
}
}
function getSetZone(input, keepLocalTime) {
if (input != null) {
if (typeof input !== "string") {
input = -input;
}
this.utcOffset(input, keepLocalTime);
return this;
} else {
return -this.utcOffset();
}
}
function setOffsetToUTC(keepLocalTime) {
return this.utcOffset(0, keepLocalTime);
}
function setOffsetToLocal(keepLocalTime) {
if (this._isUTC) {
this.utcOffset(0, keepLocalTime);
this._isUTC = false;
if (keepLocalTime) {
this.subtract(getDateOffset(this), "m");
}
}
return this;
}
function setOffsetToParsedOffset() {
if (this._tzm != null) {
this.utcOffset(this._tzm, false, true);
} else if (typeof this._i === "string") {
var tZone = offsetFromString(matchOffset, this._i);
if (tZone != null) {
this.utcOffset(tZone);
} else {
this.utcOffset(0, true);
}
}
return this;
}
function hasAlignedHourOffset(input) {
if (!this.isValid()) {
return false;
}
input = input ? createLocal(input).utcOffset() : 0;
return (this.utcOffset() - input) % 60 === 0;
}
function isDaylightSavingTime() {
return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset();
}
function isDaylightSavingTimeShifted() {
if (!isUndefined(this._isDSTShifted)) {
return this._isDSTShifted;
}
var c = {}, other;
copyConfig(c, this);
c = prepareConfig(c);
if (c._a) {
other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
this._isDSTShifted = this.isValid() && compareArrays(c._a, other.toArray()) > 0;
} else {
this._isDSTShifted = false;
}
return this._isDSTShifted;
}
function isLocal() {
return this.isValid() ? !this._isUTC : false;
}
function isUtcOffset() {
return this.isValid() ? this._isUTC : false;
}
function isUtc() {
return this.isValid() ? this._isUTC && this._offset === 0 : false;
}
var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
function createDuration(input, key) {
var duration = input, match = null, sign2, ret, diffRes;
if (isDuration(input)) {
duration = {
ms: input._milliseconds,
d: input._days,
M: input._months
};
} else if (isNumber(input) || !isNaN(+input)) {
duration = {};
if (key) {
duration[key] = +input;
} else {
duration.milliseconds = +input;
}
} else if (match = aspNetRegex.exec(input)) {
sign2 = match[1] === "-" ? -1 : 1;
duration = {
y: 0,
d: toInt(match[DATE]) * sign2,
h: toInt(match[HOUR]) * sign2,
m: toInt(match[MINUTE]) * sign2,
s: toInt(match[SECOND]) * sign2,
ms: toInt(absRound(match[MILLISECOND] * 1e3)) * sign2
};
} else if (match = isoRegex.exec(input)) {
sign2 = match[1] === "-" ? -1 : 1;
duration = {
y: parseIso(match[2], sign2),
M: parseIso(match[3], sign2),
w: parseIso(match[4], sign2),
d: parseIso(match[5], sign2),
h: parseIso(match[6], sign2),
m: parseIso(match[7], sign2),
s: parseIso(match[8], sign2)
};
} else if (duration == null) {
duration = {};
} else if (typeof duration === "object" && ("from" in duration || "to" in duration)) {
diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));
duration = {};
duration.ms = diffRes.milliseconds;
duration.M = diffRes.months;
}
ret = new Duration(duration);
if (isDuration(input) && hasOwnProp(input, "_locale")) {
ret._locale = input._locale;
}
if (isDuration(input) && hasOwnProp(input, "_isValid")) {
ret._isValid = input._isValid;
}
return ret;
}
createDuration.fn = Duration.prototype;
createDuration.invalid = createInvalid$1;
function parseIso(inp, sign2) {
var res = inp && parseFloat(inp.replace(",", "."));
return (isNaN(res) ? 0 : res) * sign2;
}
function positiveMomentsDifference(base, other) {
var res = {};
res.months = other.month() - base.month() + (other.year() - base.year()) * 12;
if (base.clone().add(res.months, "M").isAfter(other)) {
--res.months;
}
res.milliseconds = +other - +base.clone().add(res.months, "M");
return res;
}
function momentsDifference(base, other) {
var res;
if (!(base.isValid() && other.isValid())) {
return {
milliseconds: 0,
months: 0
};
}
other = cloneWithOffset(other, base);
if (base.isBefore(other)) {
res = positiveMomentsDifference(base, other);
} else {
res = positiveMomentsDifference(other, base);
res.milliseconds = -res.milliseconds;
res.months = -res.months;
}
return res;
}
function createAdder(direction, name) {
return function(val, period) {
var dur, tmp;
if (period !== null && !isNaN(+period)) {
deprecateSimple(name, "moment()." + name + "(period, number) is deprecated. Please use moment()." + name + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.");
tmp = val;
val = period;
period = tmp;
}
dur = createDuration(val, period);
addSubtract(this, dur, direction);
return this;
};
}
function addSubtract(mom, duration, isAdding, updateOffset) {
var milliseconds2 = duration._milliseconds, days2 = absRound(duration._days), months2 = absRound(duration._months);
if (!mom.isValid()) {
return;
}
updateOffset = updateOffset == null ? true : updateOffset;
if (months2) {
setMonth(mom, get(mom, "Month") + months2 * isAdding);
}
if (days2) {
set$1(mom, "Date", get(mom, "Date") + days2 * isAdding);
}
if (milliseconds2) {
mom._d.setTime(mom._d.valueOf() + milliseconds2 * isAdding);
}
if (updateOffset) {
hooks.updateOffset(mom, days2 || months2);
}
}
var add = createAdder(1, "add"), subtract = createAdder(-1, "subtract");
function isString(input) {
return typeof input === "string" || input instanceof String;
}
function isMomentInput(input) {
return isMoment(input) || isDate(input) || isString(input) || isNumber(input) || isNumberOrStringArray(input) || isMomentInputObject(input) || input === null || input === void 0;
}
function isMomentInputObject(input) {
var objectTest = isObject(input) && !isObjectEmpty(input), propertyTest = false, properties = [
"years",
"year",
"y",
"months",
"month",
"M",
"days",
"day",
"d",
"dates",
"date",
"D",
"hours",
"hour",
"h",
"minutes",
"minute",
"m",
"seconds",
"second",
"s",
"milliseconds",
"millisecond",
"ms"
], i, property, propertyLen = properties.length;
for (i = 0; i < propertyLen; i += 1) {
property = properties[i];
propertyTest = propertyTest || hasOwnProp(input, property);
}
return objectTest && propertyTest;
}
function isNumberOrStringArray(input) {
var arrayTest = isArray(input), dataTypeTest = false;
if (arrayTest) {
dataTypeTest = input.filter(function(item) {
return !isNumber(item) && isString(input);
}).length === 0;
}
return arrayTest && dataTypeTest;
}
function isCalendarSpec(input) {
var objectTest = isObject(input) && !isObjectEmpty(input), propertyTest = false, properties = [
"sameDay",
"nextDay",
"lastDay",
"nextWeek",
"lastWeek",
"sameElse"
], i, property;
for (i = 0; i < properties.length; i += 1) {
property = properties[i];
propertyTest = propertyTest || hasOwnProp(input, property);
}
return objectTest && propertyTest;
}
function getCalendarFormat(myMoment, now2) {
var diff2 = myMoment.diff(now2, "days", true);
return diff2 < -6 ? "sameElse" : diff2 < -1 ? "lastWeek" : diff2 < 0 ? "lastDay" : diff2 < 1 ? "sameDay" : diff2 < 2 ? "nextDay" : diff2 < 7 ? "nextWeek" : "sameElse";
}
function calendar$1(time, formats) {
if (arguments.length === 1) {
if (!arguments[0]) {
time = void 0;
formats = void 0;
} else if (isMomentInput(arguments[0])) {
time = arguments[0];
formats = void 0;
} else if (isCalendarSpec(arguments[0])) {
formats = arguments[0];
time = void 0;
}
}
var now2 = time || createLocal(), sod = cloneWithOffset(now2, this).startOf("day"), format2 = hooks.calendarFormat(this, sod) || "sameElse", output = formats && (isFunction(formats[format2]) ? formats[format2].call(this, now2) : formats[format2]);
return this.format(output || this.localeData().calendar(format2, this, createLocal(now2)));
}
function clone() {
return new Moment(this);
}
function isAfter(input, units) {
var localInput = isMoment(input) ? input : createLocal(input);
if (!(this.isValid() && localInput.isValid())) {
return false;
}
units = normalizeUnits(units) || "millisecond";
if (units === "millisecond") {
return this.valueOf() > localInput.valueOf();
} else {
return localInput.valueOf() < this.clone().startOf(units).valueOf();
}
}
function isBefore(input, units) {
var localInput = isMoment(input) ? input : createLocal(input);
if (!(this.isValid() && localInput.isValid())) {
return false;
}
units = normalizeUnits(units) || "millisecond";
if (units === "millisecond") {
return this.valueOf() < localInput.valueOf();
} else {
return this.clone().endOf(units).valueOf() < localInput.valueOf();
}
}
function isBetween$2(from2, to2, units, inclusivity) {
var localFrom = isMoment(from2) ? from2 : createLocal(from2), localTo = isMoment(to2) ? to2 : createLocal(to2);
if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
return false;
}
inclusivity = inclusivity || "()";
return (inclusivity[0] === "(" ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) && (inclusivity[1] === ")" ? this.isBefore(localTo, units) : !this.isAfter(localTo, units));
}
function isSame(input, units) {
var localInput = isMoment(input) ? input : createLocal(input), inputMs;
if (!(this.isValid() && localInput.isValid())) {
return false;
}
units = normalizeUnits(units) || "millisecond";
if (units === "millisecond") {
return this.valueOf() === localInput.valueOf();
} else {
inputMs = localInput.valueOf();
return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
}
}
function isSameOrAfter(input, units) {
return this.isSame(input, units) || this.isAfter(input, units);
}
function isSameOrBefore(input, units) {
return this.isSame(input, units) || this.isBefore(input, units);
}
function diff(input, units, asFloat) {
var that, zoneDelta, output;
if (!this.isValid()) {
return NaN;
}
that = cloneWithOffset(input, this);
if (!that.isValid()) {
return NaN;
}
zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
units = normalizeUnits(units);
switch (units) {
case "year":
output = monthDiff(this, that) / 12;
break;
case "month":
output = monthDiff(this, that);
break;
case "quarter":
output = monthDiff(this, that) / 3;
break;
case "second":
output = (this - that) / 1e3;
break;
case "minute":
output = (this - that) / 6e4;
break;
case "hour":
output = (this - that) / 36e5;
break;
case "day":
output = (this - that - zoneDelta) / 864e5;
break;
case "week":
output = (this - that - zoneDelta) / 6048e5;
break;
default:
output = this - that;
}
return asFloat ? output : absFloor(output);
}
function monthDiff(a, b) {
if (a.date() < b.date()) {
return -monthDiff(b, a);
}
var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), anchor = a.clone().add(wholeMonthDiff, "months"), anchor2, adjust;
if (b - anchor < 0) {
anchor2 = a.clone().add(wholeMonthDiff - 1, "months");
adjust = (b - anchor) / (anchor - anchor2);
} else {
anchor2 = a.clone().add(wholeMonthDiff + 1, "months");
adjust = (b - anchor) / (anchor2 - anchor);
}
return -(wholeMonthDiff + adjust) || 0;
}
hooks.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ";
hooks.defaultFormatUtc = "YYYY-MM-DDTHH:mm:ss[Z]";
function toString() {
return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ");
}
function toISOString(keepOffset) {
if (!this.isValid()) {
return null;
}
var utc = keepOffset !== true, m = utc ? this.clone().utc() : this;
if (m.year() < 0 || m.year() > 9999) {
return formatMoment(m, utc ? "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYYYY-MM-DD[T]HH:mm:ss.SSSZ");
}
if (isFunction(Date.prototype.toISOString)) {
if (utc) {
return this.toDate().toISOString();
} else {
return new Date(this.valueOf() + this.utcOffset() * 60 * 1e3).toISOString().replace("Z", formatMoment(m, "Z"));
}
}
return formatMoment(m, utc ? "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYY-MM-DD[T]HH:mm:ss.SSSZ");
}
function inspect() {
if (!this.isValid()) {
return "moment.invalid(/* " + this._i + " */)";
}
var func = "moment", zone = "", prefix, year, datetime, suffix;
if (!this.isLocal()) {
func = this.utcOffset() === 0 ? "moment.utc" : "moment.parseZone";
zone = "Z";
}
prefix = "[" + func + '("]';
year = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY";
datetime = "-MM-DD[T]HH:mm:ss.SSS";
suffix = zone + '[")]';
return this.format(prefix + year + datetime + suffix);
}
function format(inputString) {
if (!inputString) {
inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
}
var output = formatMoment(this, inputString);
return this.localeData().postformat(output);
}
function from(time, withoutSuffix) {
if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) {
return createDuration({
to: this,
from: time
}).locale(this.locale()).humanize(!withoutSuffix);
} else {
return this.localeData().invalidDate();
}
}
function fromNow(withoutSuffix) {
return this.from(createLocal(), withoutSuffix);
}
function to(time, withoutSuffix) {
if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) {
return createDuration({
from: this,
to: time
}).locale(this.locale()).humanize(!withoutSuffix);
} else {
return this.localeData().invalidDate();
}
}
function toNow(withoutSuffix) {
return this.to(createLocal(), withoutSuffix);
}
function locale(key) {
var newLocaleData;
if (key === void 0) {
return this._locale._abbr;
} else {
newLocaleData = getLocale(key);
if (newLocaleData != null) {
this._locale = newLocaleData;
}
return this;
}
}
var lang = deprecate("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.", function(key) {
if (key === void 0) {
return this.localeData();
} else {
return this.locale(key);
}
});
function localeData() {
return this._locale;
}
var MS_PER_SECOND = 1e3, MS_PER_MINUTE = 60 * MS_PER_SECOND, MS_PER_HOUR = 60 * MS_PER_MINUTE, MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
function mod$1(dividend, divisor) {
return (dividend % divisor + divisor) % divisor;
}
function localStartOfDate(y, m, d) {
if (y < 100 && y >= 0) {
return new Date(y + 400, m, d) - MS_PER_400_YEARS;
} else {
return new Date(y, m, d).valueOf();
}
}
function utcStartOfDate(y, m, d) {
if (y < 100 && y >= 0) {
return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
} else {
return Date.UTC(y, m, d);
}
}
function startOf(units) {
var time, startOfDate;
units = normalizeUnits(units);
if (units === void 0 || units === "millisecond" || !this.isValid()) {
return this;
}
startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
switch (units) {
case "year":
time = startOfDate(this.year(), 0, 1);
break;
case "quarter":
time = startOfDate(this.year(), this.month() - this.month() % 3, 1);
break;
case "month":
time = startOfDate(this.year(), this.month(), 1);
break;
case "week":
time = startOfDate(this.year(), this.month(), this.date() - this.weekday());
break;
case "isoWeek":
time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1));
break;
case "day":
case "date":
time = startOfDate(this.year(), this.month(), this.date());
break;
case "hour":
time = this._d.valueOf();
time -= mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR);
break;
case "minute":
time = this._d.valueOf();
time -= mod$1(time, MS_PER_MINUTE);
break;
case "second":
time = this._d.valueOf();
time -= mod$1(time, MS_PER_SECOND);
break;
}
this._d.setTime(time);
hooks.updateOffset(this, true);
return this;
}
function endOf(units) {
var time, startOfDate;
units = normalizeUnits(units);
if (units === void 0 || units === "millisecond" || !this.isValid()) {
return this;
}
startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
switch (units) {
case "year":
time = startOfDate(this.year() + 1, 0, 1) - 1;
break;
case "quarter":
time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1;
break;
case "month":
time = startOfDate(this.year(), this.month() + 1, 1) - 1;
break;
case "week":
time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1;
break;
case "isoWeek":
time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1;
break;
case "day":
case "date":
time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
break;
case "hour":
time = this._d.valueOf();
time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1;
break;
case "minute":
time = this._d.valueOf();
time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
break;
case "second":
time = this._d.valueOf();
time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
break;
}
this._d.setTime(time);
hooks.updateOffset(this, true);
return this;
}
function valueOf() {
return this._d.valueOf() - (this._offset || 0) * 6e4;
}
function unix() {
return Math.floor(this.valueOf() / 1e3);
}
function toDate() {
return new Date(this.valueOf());
}
function toArray() {
var m = this;
return [
m.year(),
m.month(),
m.date(),
m.hour(),
m.minute(),
m.second(),
m.millisecond()
];
}
function toObject() {
var m = this;
return {
years: m.year(),
months: m.month(),
date: m.date(),
hours: m.hours(),
minutes: m.minutes(),
seconds: m.seconds(),
milliseconds: m.milliseconds()
};
}
function toJSON() {
return this.isValid() ? this.toISOString() : null;
}
function isValid$2() {
return isValid(this);
}
function parsingFlags() {
return extend({}, getParsingFlags(this));
}
function invalidAt() {
return getParsingFlags(this).overflow;
}
function creationData() {
return {
input: this._i,
format: this._f,
locale: this._locale,
isUTC: this._isUTC,
strict: this._strict
};
}
addFormatToken("N", 0, 0, "eraAbbr");
addFormatToken("NN", 0, 0, "eraAbbr");
addFormatToken("NNN", 0, 0, "eraAbbr");
addFormatToken("NNNN", 0, 0, "eraName");
addFormatToken("NNNNN", 0, 0, "eraNarrow");
addFormatToken("y", [
"y",
1
], "yo", "eraYear");
addFormatToken("y", [
"yy",
2
], 0, "eraYear");
addFormatToken("y", [
"yyy",
3
], 0, "eraYear");
addFormatToken("y", [
"yyyy",
4
], 0, "eraYear");
addRegexToken("N", matchEraAbbr);
addRegexToken("NN", matchEraAbbr);
addRegexToken("NNN", matchEraAbbr);
addRegexToken("NNNN", matchEraName);
addRegexToken("NNNNN", matchEraNarrow);
addParseToken([
"N",
"NN",
"NNN",
"NNNN",
"NNNNN"
], function(input, array, config, token2) {
var era = config._locale.erasParse(input, token2, config._strict);
if (era) {
getParsingFlags(config).era = era;
} else {
getParsingFlags(config).invalidEra = input;
}
});
addRegexToken("y", matchUnsigned);
addRegexToken("yy", matchUnsigned);
addRegexToken("yyy", matchUnsigned);
addRegexToken("yyyy", matchUnsigned);
addRegexToken("yo", matchEraYearOrdinal);
addParseToken([
"y",
"yy",
"yyy",
"yyyy"
], YEAR);
addParseToken([
"yo"
], function(input, array, config, token2) {
var match;
if (config._locale._eraYearOrdinalRegex) {
match = input.match(config._locale._eraYearOrdinalRegex);
}
if (config._locale.eraYearOrdinalParse) {
array[YEAR] = config._locale.eraYearOrdinalParse(input, match);
} else {
array[YEAR] = parseInt(input, 10);
}
});
function localeEras(m, format2) {
var i, l, date, eras = this._eras || getLocale("en")._eras;
for (i = 0, l = eras.length; i < l; ++i) {
switch (typeof eras[i].since) {
case "string":
date = hooks(eras[i].since).startOf("day");
eras[i].since = date.valueOf();
break;
}
switch (typeof eras[i].until) {
case "undefined":
eras[i].until = Infinity;
break;
case "string":
date = hooks(eras[i].until).startOf("day").valueOf();
eras[i].until = date.valueOf();
break;
}
}
return eras;
}
function localeErasParse(eraName, format2, strict) {
var i, l, eras = this.eras(), name, abbr, narrow;
eraName = eraName.toUpperCase();
for (i = 0, l = eras.length; i < l; ++i) {
name = eras[i].name.toUpperCase();
abbr = eras[i].abbr.toUpperCase();
narrow = eras[i].narrow.toUpperCase();
if (strict) {
switch (format2) {
case "N":
case "NN":
case "NNN":
if (abbr === eraName) {
return eras[i];
}
break;
case "NNNN":
if (name === eraName) {
return eras[i];
}
break;
case "NNNNN":
if (narrow === eraName) {
return eras[i];
}
break;
}
} else if ([
name,
abbr,
narrow
].indexOf(eraName) >= 0) {
return eras[i];
}
}
}
function localeErasConvertYear(era, year) {
var dir = era.since <= era.until ? 1 : -1;
if (year === void 0) {
return hooks(era.since).year();
} else {
return hooks(era.since).year() + (year - era.offset) * dir;
}
}
function getEraName() {
var i, l, val, eras = this.localeData().eras();
for (i = 0, l = eras.length; i < l; ++i) {
val = this.clone().startOf("day").valueOf();
if (eras[i].since <= val && val <= eras[i].until) {
return eras[i].name;
}
if (eras[i].until <= val && val <= eras[i].since) {
return eras[i].name;
}
}
return "";
}
function getEraNarrow() {
var i, l, val, eras = this.localeData().eras();
for (i = 0, l = eras.length; i < l; ++i) {
val = this.clone().startOf("day").valueOf();
if (eras[i].since <= val && val <= eras[i].until) {
return eras[i].narrow;
}
if (eras[i].until <= val && val <= eras[i].since) {
return eras[i].narrow;
}
}
return "";
}
function getEraAbbr() {
var i, l, val, eras = this.localeData().eras();
for (i = 0, l = eras.length; i < l; ++i) {
val = this.clone().startOf("day").valueOf();
if (eras[i].since <= val && val <= eras[i].until) {
return eras[i].abbr;
}
if (eras[i].until <= val && val <= eras[i].since) {
return eras[i].abbr;
}
}
return "";
}
function getEraYear() {
var i, l, dir, val, eras = this.localeData().eras();
for (i = 0, l = eras.length; i < l; ++i) {
dir = eras[i].since <= eras[i].until ? 1 : -1;
val = this.clone().startOf("day").valueOf();
if (eras[i].since <= val && val <= eras[i].until || eras[i].until <= val && val <= eras[i].since) {
return (this.year() - hooks(eras[i].since).year()) * dir + eras[i].offset;
}
}
return this.year();
}
function erasNameRegex(isStrict) {
if (!hasOwnProp(this, "_erasNameRegex")) {
computeErasParse.call(this);
}
return isStrict ? this._erasNameRegex : this._erasRegex;
}
function erasAbbrRegex(isStrict) {
if (!hasOwnProp(this, "_erasAbbrRegex")) {
computeErasParse.call(this);
}
return isStrict ? this._erasAbbrRegex : this._erasRegex;
}
function erasNarrowRegex(isStrict) {
if (!hasOwnProp(this, "_erasNarrowRegex")) {
computeErasParse.call(this);
}
return isStrict ? this._erasNarrowRegex : this._erasRegex;
}
function matchEraAbbr(isStrict, locale2) {
return locale2.erasAbbrRegex(isStrict);
}
function matchEraName(isStrict, locale2) {
return locale2.erasNameRegex(isStrict);
}
function matchEraNarrow(isStrict, locale2) {
return locale2.erasNarrowRegex(isStrict);
}
function matchEraYearOrdinal(isStrict, locale2) {
return locale2._eraYearOrdinalRegex || matchUnsigned;
}
function computeErasParse() {
var abbrPieces = [], namePieces = [], narrowPieces = [], mixedPieces = [], i, l, erasName, erasAbbr, erasNarrow, eras = this.eras();
for (i = 0, l = eras.length; i < l; ++i) {
erasName = regexEscape(eras[i].name);
erasAbbr = regexEscape(eras[i].abbr);
erasNarrow = regexEscape(eras[i].narrow);
namePieces.push(erasName);
abbrPieces.push(erasAbbr);
narrowPieces.push(erasNarrow);
mixedPieces.push(erasName);
mixedPieces.push(erasAbbr);
mixedPieces.push(erasNarrow);
}
this._erasRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
this._erasNameRegex = new RegExp("^(" + namePieces.join("|") + ")", "i");
this._erasAbbrRegex = new RegExp("^(" + abbrPieces.join("|") + ")", "i");
this._erasNarrowRegex = new RegExp("^(" + narrowPieces.join("|") + ")", "i");
}
addFormatToken(0, [
"gg",
2
], 0, function() {
return this.weekYear() % 100;
});
addFormatToken(0, [
"GG",
2
], 0, function() {
return this.isoWeekYear() % 100;
});
function addWeekYearFormatToken(token2, getter) {
addFormatToken(0, [
token2,
token2.length
], 0, getter);
}
addWeekYearFormatToken("gggg", "weekYear");
addWeekYearFormatToken("ggggg", "weekYear");
addWeekYearFormatToken("GGGG", "isoWeekYear");
addWeekYearFormatToken("GGGGG", "isoWeekYear");
addRegexToken("G", matchSigned);
addRegexToken("g", matchSigned);
addRegexToken("GG", match1to2, match2);
addRegexToken("gg", match1to2, match2);
addRegexToken("GGGG", match1to4, match4);
addRegexToken("gggg", match1to4, match4);
addRegexToken("GGGGG", match1to6, match6);
addRegexToken("ggggg", match1to6, match6);
addWeekParseToken([
"gggg",
"ggggg",
"GGGG",
"GGGGG"
], function(input, week, config, token2) {
week[token2.substr(0, 2)] = toInt(input);
});
addWeekParseToken([
"gg",
"GG"
], function(input, week, config, token2) {
week[token2] = hooks.parseTwoDigitYear(input);
});
function getSetWeekYear(input) {
return getSetWeekYearHelper.call(this, input, this.week(), this.weekday() + this.localeData()._week.dow, this.localeData()._week.dow, this.localeData()._week.doy);
}
function getSetISOWeekYear(input) {
return getSetWeekYearHelper.call(this, input, this.isoWeek(), this.isoWeekday(), 1, 4);
}
function getISOWeeksInYear() {
return weeksInYear(this.year(), 1, 4);
}
function getISOWeeksInISOWeekYear() {
return weeksInYear(this.isoWeekYear(), 1, 4);
}
function getWeeksInYear() {
var weekInfo = this.localeData()._week;
return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
}
function getWeeksInWeekYear() {
var weekInfo = this.localeData()._week;
return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);
}
function getSetWeekYearHelper(input, week, weekday, dow, doy) {
var weeksTarget;
if (input == null) {
return weekOfYear$2(this, dow, doy).year;
} else {
weeksTarget = weeksInYear(input, dow, doy);
if (week > weeksTarget) {
week = weeksTarget;
}
return setWeekAll.call(this, input, week, weekday, dow, doy);
}
}
function setWeekAll(weekYear, week, weekday, dow, doy) {
var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
this.year(date.getUTCFullYear());
this.month(date.getUTCMonth());
this.date(date.getUTCDate());
return this;
}
addFormatToken("Q", 0, "Qo", "quarter");
addRegexToken("Q", match1);
addParseToken("Q", function(input, array) {
array[MONTH] = (toInt(input) - 1) * 3;
});
function getSetQuarter(input) {
return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
}
addFormatToken("D", [
"DD",
2
], "Do", "date");
addRegexToken("D", match1to2, match1to2NoLeadingZero);
addRegexToken("DD", match1to2, match2);
addRegexToken("Do", function(isStrict, locale2) {
return isStrict ? locale2._dayOfMonthOrdinalParse || locale2._ordinalParse : locale2._dayOfMonthOrdinalParseLenient;
});
addParseToken([
"D",
"DD"
], DATE);
addParseToken("Do", function(input, array) {
array[DATE] = toInt(input.match(match1to2)[0]);
});
var getSetDayOfMonth = makeGetSet("Date", true);
addFormatToken("DDD", [
"DDDD",
3
], "DDDo", "dayOfYear");
addRegexToken("DDD", match1to3);
addRegexToken("DDDD", match3);
addParseToken([
"DDD",
"DDDD"
], function(input, array, config) {
config._dayOfYear = toInt(input);
});
function getSetDayOfYear(input) {
var dayOfYear = Math.round((this.clone().startOf("day") - this.clone().startOf("year")) / 864e5) + 1;
return input == null ? dayOfYear : this.add(input - dayOfYear, "d");
}
addFormatToken("m", [
"mm",
2
], 0, "minute");
addRegexToken("m", match1to2, match1to2HasZero);
addRegexToken("mm", match1to2, match2);
addParseToken([
"m",
"mm"
], MINUTE);
var getSetMinute = makeGetSet("Minutes", false);
addFormatToken("s", [
"ss",
2
], 0, "second");
addRegexToken("s", match1to2, match1to2HasZero);
addRegexToken("ss", match1to2, match2);
addParseToken([
"s",
"ss"
], SECOND);
var getSetSecond = makeGetSet("Seconds", false);
addFormatToken("S", 0, 0, function() {
return ~~(this.millisecond() / 100);
});
addFormatToken(0, [
"SS",
2
], 0, function() {
return ~~(this.millisecond() / 10);
});
addFormatToken(0, [
"SSS",
3
], 0, "millisecond");
addFormatToken(0, [
"SSSS",
4
], 0, function() {
return this.millisecond() * 10;
});
addFormatToken(0, [
"SSSSS",
5
], 0, function() {
return this.millisecond() * 100;
});
addFormatToken(0, [
"SSSSSS",
6
], 0, function() {
return this.millisecond() * 1e3;
});
addFormatToken(0, [
"SSSSSSS",
7
], 0, function() {
return this.millisecond() * 1e4;
});
addFormatToken(0, [
"SSSSSSSS",
8
], 0, function() {
return this.millisecond() * 1e5;
});
addFormatToken(0, [
"SSSSSSSSS",
9
], 0, function() {
return this.millisecond() * 1e6;
});
addRegexToken("S", match1to3, match1);
addRegexToken("SS", match1to3, match2);
addRegexToken("SSS", match1to3, match3);
var token, getSetMillisecond;
for (token = "SSSS"; token.length <= 9; token += "S") {
addRegexToken(token, matchUnsigned);
}
function parseMs(input, array) {
array[MILLISECOND] = toInt(("0." + input) * 1e3);
}
for (token = "S"; token.length <= 9; token += "S") {
addParseToken(token, parseMs);
}
getSetMillisecond = makeGetSet("Milliseconds", false);
addFormatToken("z", 0, 0, "zoneAbbr");
addFormatToken("zz", 0, 0, "zoneName");
function getZoneAbbr() {
return this._isUTC ? "UTC" : "";
}
function getZoneName() {
return this._isUTC ? "Coordinated Universal Time" : "";
}
var proto = Moment.prototype;
proto.add = add;
proto.calendar = calendar$1;
proto.clone = clone;
proto.diff = diff;
proto.endOf = endOf;
proto.format = format;
proto.from = from;
proto.fromNow = fromNow;
proto.to = to;
proto.toNow = toNow;
proto.get = stringGet;
proto.invalidAt = invalidAt;
proto.isAfter = isAfter;
proto.isBefore = isBefore;
proto.isBetween = isBetween$2;
proto.isSame = isSame;
proto.isSameOrAfter = isSameOrAfter;
proto.isSameOrBefore = isSameOrBefore;
proto.isValid = isValid$2;
proto.lang = lang;
proto.locale = locale;
proto.localeData = localeData;
proto.max = prototypeMax;
proto.min = prototypeMin;
proto.parsingFlags = parsingFlags;
proto.set = stringSet;
proto.startOf = startOf;
proto.subtract = subtract;
proto.toArray = toArray;
proto.toObject = toObject;
proto.toDate = toDate;
proto.toISOString = toISOString;
proto.inspect = inspect;
if (typeof Symbol !== "undefined" && Symbol.for != null) {
proto[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = function() {
return "Moment<" + this.format() + ">";
};
}
proto.toJSON = toJSON;
proto.toString = toString;
proto.unix = unix;
proto.valueOf = valueOf;
proto.creationData = creationData;
proto.eraName = getEraName;
proto.eraNarrow = getEraNarrow;
proto.eraAbbr = getEraAbbr;
proto.eraYear = getEraYear;
proto.year = getSetYear;
proto.isLeapYear = getIsLeapYear;
proto.weekYear = getSetWeekYear;
proto.isoWeekYear = getSetISOWeekYear;
proto.quarter = proto.quarters = getSetQuarter;
proto.month = getSetMonth;
proto.daysInMonth = getDaysInMonth;
proto.week = proto.weeks = getSetWeek;
proto.isoWeek = proto.isoWeeks = getSetISOWeek;
proto.weeksInYear = getWeeksInYear;
proto.weeksInWeekYear = getWeeksInWeekYear;
proto.isoWeeksInYear = getISOWeeksInYear;
proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
proto.date = getSetDayOfMonth;
proto.day = proto.days = getSetDayOfWeek;
proto.weekday = getSetLocaleDayOfWeek;
proto.isoWeekday = getSetISODayOfWeek;
proto.dayOfYear = getSetDayOfYear;
proto.hour = proto.hours = getSetHour;
proto.minute = proto.minutes = getSetMinute;
proto.second = proto.seconds = getSetSecond;
proto.millisecond = proto.milliseconds = getSetMillisecond;
proto.utcOffset = getSetOffset;
proto.utc = setOffsetToUTC;
proto.local = setOffsetToLocal;
proto.parseZone = setOffsetToParsedOffset;
proto.hasAlignedHourOffset = hasAlignedHourOffset;
proto.isDST = isDaylightSavingTime;
proto.isLocal = isLocal;
proto.isUtcOffset = isUtcOffset;
proto.isUtc = isUtc;
proto.isUTC = isUtc;
proto.zoneAbbr = getZoneAbbr;
proto.zoneName = getZoneName;
proto.dates = deprecate("dates accessor is deprecated. Use date instead.", getSetDayOfMonth);
proto.months = deprecate("months accessor is deprecated. Use month instead", getSetMonth);
proto.years = deprecate("years accessor is deprecated. Use year instead", getSetYear);
proto.zone = deprecate("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/", getSetZone);
proto.isDSTShifted = deprecate("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information", isDaylightSavingTimeShifted);
function createUnix(input) {
return createLocal(input * 1e3);
}
function createInZone() {
return createLocal.apply(null, arguments).parseZone();
}
function preParsePostFormat(string) {
return string;
}
var proto$1 = Locale.prototype;
proto$1.calendar = calendar;
proto$1.longDateFormat = longDateFormat;
proto$1.invalidDate = invalidDate;
proto$1.ordinal = ordinal;
proto$1.preparse = preParsePostFormat;
proto$1.postformat = preParsePostFormat;
proto$1.relativeTime = relativeTime;
proto$1.pastFuture = pastFuture;
proto$1.set = set;
proto$1.eras = localeEras;
proto$1.erasParse = localeErasParse;
proto$1.erasConvertYear = localeErasConvertYear;
proto$1.erasAbbrRegex = erasAbbrRegex;
proto$1.erasNameRegex = erasNameRegex;
proto$1.erasNarrowRegex = erasNarrowRegex;
proto$1.months = localeMonths;
proto$1.monthsShort = localeMonthsShort;
proto$1.monthsParse = localeMonthsParse;
proto$1.monthsRegex = monthsRegex;
proto$1.monthsShortRegex = monthsShortRegex;
proto$1.week = localeWeek;
proto$1.firstDayOfYear = localeFirstDayOfYear;
proto$1.firstDayOfWeek = localeFirstDayOfWeek;
proto$1.weekdays = localeWeekdays;
proto$1.weekdaysMin = localeWeekdaysMin;
proto$1.weekdaysShort = localeWeekdaysShort;
proto$1.weekdaysParse = localeWeekdaysParse;
proto$1.weekdaysRegex = weekdaysRegex;
proto$1.weekdaysShortRegex = weekdaysShortRegex;
proto$1.weekdaysMinRegex = weekdaysMinRegex;
proto$1.isPM = localeIsPM;
proto$1.meridiem = localeMeridiem;
function get$1(format2, index, field, setter) {
var locale2 = getLocale(), utc = createUTC().set(setter, index);
return locale2[field](utc, format2);
}
function listMonthsImpl(format2, index, field) {
if (isNumber(format2)) {
index = format2;
format2 = void 0;
}
format2 = format2 || "";
if (index != null) {
return get$1(format2, index, field, "month");
}
var i, out = [];
for (i = 0; i < 12; i++) {
out[i] = get$1(format2, i, field, "month");
}
return out;
}
function listWeekdaysImpl(localeSorted, format2, index, field) {
if (typeof localeSorted === "boolean") {
if (isNumber(format2)) {
index = format2;
format2 = void 0;
}
format2 = format2 || "";
} else {
format2 = localeSorted;
index = format2;
localeSorted = false;
if (isNumber(format2)) {
index = format2;
format2 = void 0;
}
format2 = format2 || "";
}
var locale2 = getLocale(), shift = localeSorted ? locale2._week.dow : 0, i, out = [];
if (index != null) {
return get$1(format2, (index + shift) % 7, field, "day");
}
for (i = 0; i < 7; i++) {
out[i] = get$1(format2, (i + shift) % 7, field, "day");
}
return out;
}
function listMonths(format2, index) {
return listMonthsImpl(format2, index, "months");
}
function listMonthsShort(format2, index) {
return listMonthsImpl(format2, index, "monthsShort");
}
function listWeekdays(localeSorted, format2, index) {
return listWeekdaysImpl(localeSorted, format2, index, "weekdays");
}
function listWeekdaysShort(localeSorted, format2, index) {
return listWeekdaysImpl(localeSorted, format2, index, "weekdaysShort");
}
function listWeekdaysMin(localeSorted, format2, index) {
return listWeekdaysImpl(localeSorted, format2, index, "weekdaysMin");
}
getSetGlobalLocale("en", {
eras: [
{
since: "0001-01-01",
until: Infinity,
offset: 1,
name: "Anno Domini",
narrow: "AD",
abbr: "AD"
},
{
since: "0000-12-31",
until: -Infinity,
offset: 1,
name: "Before Christ",
narrow: "BC",
abbr: "BC"
}
],
dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
ordinal: function(number) {
var b = number % 10, output = toInt(number % 100 / 10) === 1 ? "th" : b === 1 ? "st" : b === 2 ? "nd" : b === 3 ? "rd" : "th";
return number + output;
}
});
hooks.lang = deprecate("moment.lang is deprecated. Use moment.locale instead.", getSetGlobalLocale);
hooks.langData = deprecate("moment.langData is deprecated. Use moment.localeData instead.", getLocale);
var mathAbs = Math.abs;
function abs() {
var data = this._data;
this._milliseconds = mathAbs(this._milliseconds);
this._days = mathAbs(this._days);
this._months = mathAbs(this._months);
data.milliseconds = mathAbs(data.milliseconds);
data.seconds = mathAbs(data.seconds);
data.minutes = mathAbs(data.minutes);
data.hours = mathAbs(data.hours);
data.months = mathAbs(data.months);
data.years = mathAbs(data.years);
return this;
}
function addSubtract$1(duration, input, value, direction) {
var other = createDuration(input, value);
duration._milliseconds += direction * other._milliseconds;
duration._days += direction * other._days;
duration._months += direction * other._months;
return duration._bubble();
}
function add$1(input, value) {
return addSubtract$1(this, input, value, 1);
}
function subtract$1(input, value) {
return addSubtract$1(this, input, value, -1);
}
function absCeil(number) {
if (number < 0) {
return Math.floor(number);
} else {
return Math.ceil(number);
}
}
function bubble() {
var milliseconds2 = this._milliseconds, days2 = this._days, months2 = this._months, data = this._data, seconds2, minutes2, hours2, years2, monthsFromDays;
if (!(milliseconds2 >= 0 && days2 >= 0 && months2 >= 0 || milliseconds2 <= 0 && days2 <= 0 && months2 <= 0)) {
milliseconds2 += absCeil(monthsToDays(months2) + days2) * 864e5;
days2 = 0;
months2 = 0;
}
data.milliseconds = milliseconds2 % 1e3;
seconds2 = absFloor(milliseconds2 / 1e3);
data.seconds = seconds2 % 60;
minutes2 = absFloor(seconds2 / 60);
data.minutes = minutes2 % 60;
hours2 = absFloor(minutes2 / 60);
data.hours = hours2 % 24;
days2 += absFloor(hours2 / 24);
monthsFromDays = absFloor(daysToMonths(days2));
months2 += monthsFromDays;
days2 -= absCeil(monthsToDays(monthsFromDays));
years2 = absFloor(months2 / 12);
months2 %= 12;
data.days = days2;
data.months = months2;
data.years = years2;
return this;
}
function daysToMonths(days2) {
return days2 * 4800 / 146097;
}
function monthsToDays(months2) {
return months2 * 146097 / 4800;
}
function as(units) {
if (!this.isValid()) {
return NaN;
}
var days2, months2, milliseconds2 = this._milliseconds;
units = normalizeUnits(units);
if (units === "month" || units === "quarter" || units === "year") {
days2 = this._days + milliseconds2 / 864e5;
months2 = this._months + daysToMonths(days2);
switch (units) {
case "month":
return months2;
case "quarter":
return months2 / 3;
case "year":
return months2 / 12;
}
} else {
days2 = this._days + Math.round(monthsToDays(this._months));
switch (units) {
case "week":
return days2 / 7 + milliseconds2 / 6048e5;
case "day":
return days2 + milliseconds2 / 864e5;
case "hour":
return days2 * 24 + milliseconds2 / 36e5;
case "minute":
return days2 * 1440 + milliseconds2 / 6e4;
case "second":
return days2 * 86400 + milliseconds2 / 1e3;
case "millisecond":
return Math.floor(days2 * 864e5) + milliseconds2;
default:
throw new Error("Unknown unit " + units);
}
}
}
function makeAs(alias) {
return function() {
return this.as(alias);
};
}
var asMilliseconds = makeAs("ms"), asSeconds = makeAs("s"), asMinutes = makeAs("m"), asHours = makeAs("h"), asDays = makeAs("d"), asWeeks = makeAs("w"), asMonths = makeAs("M"), asQuarters = makeAs("Q"), asYears = makeAs("y"), valueOf$1 = asMilliseconds;
function clone$1() {
return createDuration(this);
}
function get$2(units) {
units = normalizeUnits(units);
return this.isValid() ? this[units + "s"]() : NaN;
}
function makeGetter(name) {
return function() {
return this.isValid() ? this._data[name] : NaN;
};
}
var milliseconds = makeGetter("milliseconds"), seconds = makeGetter("seconds"), minutes = makeGetter("minutes"), hours = makeGetter("hours"), days = makeGetter("days"), months = makeGetter("months"), years = makeGetter("years");
function weeks() {
return absFloor(this.days() / 7);
}
var round$1 = Math.round, thresholds = {
ss: 44,
s: 45,
m: 45,
h: 22,
d: 26,
w: null,
M: 11
};
function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale2) {
return locale2.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
}
function relativeTime$1(posNegDuration, withoutSuffix, thresholds2, locale2) {
var duration = createDuration(posNegDuration).abs(), seconds2 = round$1(duration.as("s")), minutes2 = round$1(duration.as("m")), hours2 = round$1(duration.as("h")), days2 = round$1(duration.as("d")), months2 = round$1(duration.as("M")), weeks2 = round$1(duration.as("w")), years2 = round$1(duration.as("y")), a = seconds2 <= thresholds2.ss && [
"s",
seconds2
] || seconds2 < thresholds2.s && [
"ss",
seconds2
] || minutes2 <= 1 && [
"m"
] || minutes2 < thresholds2.m && [
"mm",
minutes2
] || hours2 <= 1 && [
"h"
] || hours2 < thresholds2.h && [
"hh",
hours2
] || days2 <= 1 && [
"d"
] || days2 < thresholds2.d && [
"dd",
days2
];
if (thresholds2.w != null) {
a = a || weeks2 <= 1 && [
"w"
] || weeks2 < thresholds2.w && [
"ww",
weeks2
];
}
a = a || months2 <= 1 && [
"M"
] || months2 < thresholds2.M && [
"MM",
months2
] || years2 <= 1 && [
"y"
] || [
"yy",
years2
];
a[2] = withoutSuffix;
a[3] = +posNegDuration > 0;
a[4] = locale2;
return substituteTimeAgo.apply(null, a);
}
function getSetRelativeTimeRounding(roundingFunction) {
if (roundingFunction === void 0) {
return round$1;
}
if (typeof roundingFunction === "function") {
round$1 = roundingFunction;
return true;
}
return false;
}
function getSetRelativeTimeThreshold(threshold, limit) {
if (thresholds[threshold] === void 0) {
return false;
}
if (limit === void 0) {
return thresholds[threshold];
}
thresholds[threshold] = limit;
if (threshold === "s") {
thresholds.ss = limit - 1;
}
return true;
}
function humanize(argWithSuffix, argThresholds) {
if (!this.isValid()) {
return this.localeData().invalidDate();
}
var withSuffix = false, th = thresholds, locale2, output;
if (typeof argWithSuffix === "object") {
argThresholds = argWithSuffix;
argWithSuffix = false;
}
if (typeof argWithSuffix === "boolean") {
withSuffix = argWithSuffix;
}
if (typeof argThresholds === "object") {
th = Object.assign({}, thresholds, argThresholds);
if (argThresholds.s != null && argThresholds.ss == null) {
th.ss = argThresholds.s - 1;
}
}
locale2 = this.localeData();
output = relativeTime$1(this, !withSuffix, th, locale2);
if (withSuffix) {
output = locale2.pastFuture(+this, output);
}
return locale2.postformat(output);
}
var abs$1 = Math.abs;
function sign(x) {
return (x > 0) - (x < 0) || +x;
}
function toISOString$1() {
if (!this.isValid()) {
return this.localeData().invalidDate();
}
var seconds2 = abs$1(this._milliseconds) / 1e3, days2 = abs$1(this._days), months2 = abs$1(this._months), minutes2, hours2, years2, s, total = this.asSeconds(), totalSign, ymSign, daysSign, hmsSign;
if (!total) {
return "P0D";
}
minutes2 = absFloor(seconds2 / 60);
hours2 = absFloor(minutes2 / 60);
seconds2 %= 60;
minutes2 %= 60;
years2 = absFloor(months2 / 12);
months2 %= 12;
s = seconds2 ? seconds2.toFixed(3).replace(/\.?0+$/, "") : "";
totalSign = total < 0 ? "-" : "";
ymSign = sign(this._months) !== sign(total) ? "-" : "";
daysSign = sign(this._days) !== sign(total) ? "-" : "";
hmsSign = sign(this._milliseconds) !== sign(total) ? "-" : "";
return totalSign + "P" + (years2 ? ymSign + years2 + "Y" : "") + (months2 ? ymSign + months2 + "M" : "") + (days2 ? daysSign + days2 + "D" : "") + (hours2 || minutes2 || seconds2 ? "T" : "") + (hours2 ? hmsSign + hours2 + "H" : "") + (minutes2 ? hmsSign + minutes2 + "M" : "") + (seconds2 ? hmsSign + s + "S" : "");
}
var proto$2 = Duration.prototype;
proto$2.isValid = isValid$1;
proto$2.abs = abs;
proto$2.add = add$1;
proto$2.subtract = subtract$1;
proto$2.as = as;
proto$2.asMilliseconds = asMilliseconds;
proto$2.asSeconds = asSeconds;
proto$2.asMinutes = asMinutes;
proto$2.asHours = asHours;
proto$2.asDays = asDays;
proto$2.asWeeks = asWeeks;
proto$2.asMonths = asMonths;
proto$2.asQuarters = asQuarters;
proto$2.asYears = asYears;
proto$2.valueOf = valueOf$1;
proto$2._bubble = bubble;
proto$2.clone = clone$1;
proto$2.get = get$2;
proto$2.milliseconds = milliseconds;
proto$2.seconds = seconds;
proto$2.minutes = minutes;
proto$2.hours = hours;
proto$2.days = days;
proto$2.weeks = weeks;
proto$2.months = months;
proto$2.years = years;
proto$2.humanize = humanize;
proto$2.toISOString = toISOString$1;
proto$2.toString = toISOString$1;
proto$2.toJSON = toISOString$1;
proto$2.locale = locale;
proto$2.localeData = localeData;
proto$2.toIsoString = deprecate("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)", toISOString$1);
proto$2.lang = lang;
addFormatToken("X", 0, 0, "unix");
addFormatToken("x", 0, 0, "valueOf");
addRegexToken("x", matchSigned);
addRegexToken("X", matchTimestamp);
addParseToken("X", function(input, array, config) {
config._d = new Date(parseFloat(input) * 1e3);
});
addParseToken("x", function(input, array, config) {
config._d = new Date(toInt(input));
});
hooks.version = "2.30.1";
setHookCallback(createLocal);
hooks.fn = proto;
hooks.min = min;
hooks.max = max;
hooks.now = now;
hooks.utc = createUTC;
hooks.unix = createUnix;
hooks.months = listMonths;
hooks.isDate = isDate;
hooks.locale = getSetGlobalLocale;
hooks.invalid = createInvalid;
hooks.duration = createDuration;
hooks.isMoment = isMoment;
hooks.weekdays = listWeekdays;
hooks.parseZone = createInZone;
hooks.localeData = getLocale;
hooks.isDuration = isDuration;
hooks.monthsShort = listMonthsShort;
hooks.weekdaysMin = listWeekdaysMin;
hooks.defineLocale = defineLocale;
hooks.updateLocale = updateLocale;
hooks.locales = listLocales;
hooks.weekdaysShort = listWeekdaysShort;
hooks.normalizeUnits = normalizeUnits;
hooks.relativeTimeRounding = getSetRelativeTimeRounding;
hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
hooks.calendarFormat = getCalendarFormat;
hooks.prototype = proto;
hooks.HTML5_FMT = {
DATETIME_LOCAL: "YYYY-MM-DDTHH:mm",
DATETIME_LOCAL_SECONDS: "YYYY-MM-DDTHH:mm:ss",
DATETIME_LOCAL_MS: "YYYY-MM-DDTHH:mm:ss.SSS",
DATE: "YYYY-MM-DD",
TIME: "HH:mm",
TIME_SECONDS: "HH:mm:ss",
TIME_MS: "HH:mm:ss.SSS",
WEEK: "GGGG-[W]WW",
MONTH: "YYYY-MM"
};
function commonjsRequire(path) {
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
}
var de$3 = {
exports: {}
};
var moment$1 = {
exports: {}
};
var moment = moment$1.exports;
var hasRequiredMoment;
function requireMoment() {
if (hasRequiredMoment) return moment$1.exports;
hasRequiredMoment = 1;
(function(module2, exports$1) {
(function(global, factory) {
module2.exports = factory();
})(moment, (function() {
var hookCallback2;
function hooks2() {
return hookCallback2.apply(null, arguments);
}
function setHookCallback2(callback) {
hookCallback2 = callback;
}
function isArray2(input) {
return input instanceof Array || Object.prototype.toString.call(input) === "[object Array]";
}
function isObject2(input) {
return input != null && Object.prototype.toString.call(input) === "[object Object]";
}
function hasOwnProp2(a, b) {
return Object.prototype.hasOwnProperty.call(a, b);
}
function isObjectEmpty2(obj) {
if (Object.getOwnPropertyNames) {
return Object.getOwnPropertyNames(obj).length === 0;
} else {
var k;
for (k in obj) {
if (hasOwnProp2(obj, k)) {
return false;
}
}
return true;
}
}
function isUndefined2(input) {
return input === void 0;
}
function isNumber2(input) {
return typeof input === "number" || Object.prototype.toString.call(input) === "[object Number]";
}
function isDate2(input) {
return input instanceof Date || Object.prototype.toString.call(input) === "[object Date]";
}
function map2(arr, fn) {
var res = [], i, arrLen = arr.length;
for (i = 0; i < arrLen; ++i) {
res.push(fn(arr[i], i));
}
return res;
}
function extend2(a, b) {
for (var i in b) {
if (hasOwnProp2(b, i)) {
a[i] = b[i];
}
}
if (hasOwnProp2(b, "toString")) {
a.toString = b.toString;
}
if (hasOwnProp2(b, "valueOf")) {
a.valueOf = b.valueOf;
}
return a;
}
function createUTC2(input, format3, locale3, strict) {
return createLocalOrUTC2(input, format3, locale3, strict, true).utc();
}
function defaultParsingFlags2() {
return {
empty: false,
unusedTokens: [],
unusedInput: [],
overflow: -2,
charsLeftOver: 0,
nullInput: false,
invalidEra: null,
invalidMonth: null,
invalidFormat: false,
userInvalidated: false,
iso: false,
parsedDateParts: [],
era: null,
meridiem: null,
rfc2822: false,
weekdayMismatch: false
};
}
function getParsingFlags2(m) {
if (m._pf == null) {
m._pf = defaultParsingFlags2();
}
return m._pf;
}
var some2;
if (Array.prototype.some) {
some2 = Array.prototype.some;
} else {
some2 = function(fun) {
var t = Object(this), len = t.length >>> 0, i;
for (i = 0; i < len; i++) {
if (i in t && fun.call(this, t[i], i, t)) {
return true;
}
}
return false;
};
}
function isValid2(m) {
var flags = null, parsedParts = false, isNowValid = m._d && !isNaN(m._d.getTime());
if (isNowValid) {
flags = getParsingFlags2(m);
parsedParts = some2.call(flags.parsedDateParts, function(i) {
return i != null;
});
isNowValid = flags.overflow < 0 && !flags.empty && !flags.invalidEra && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts);
if (m._strict) {
isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === void 0;
}
}
if (Object.isFrozen == null || !Object.isFrozen(m)) {
m._isValid = isNowValid;
} else {
return isNowValid;
}
return m._isValid;
}
function createInvalid2(flags) {
var m = createUTC2(NaN);
if (flags != null) {
extend2(getParsingFlags2(m), flags);
} else {
getParsingFlags2(m).userInvalidated = true;
}
return m;
}
var momentProperties2 = hooks2.momentProperties = [], updateInProgress2 = false;
function copyConfig2(to3, from3) {
var i, prop, val, momentPropertiesLen = momentProperties2.length;
if (!isUndefined2(from3._isAMomentObject)) {
to3._isAMomentObject = from3._isAMomentObject;
}
if (!isUndefined2(from3._i)) {
to3._i = from3._i;
}
if (!isUndefined2(from3._f)) {
to3._f = from3._f;
}
if (!isUndefined2(from3._l)) {
to3._l = from3._l;
}
if (!isUndefined2(from3._strict)) {
to3._strict = from3._strict;
}
if (!isUndefined2(from3._tzm)) {
to3._tzm = from3._tzm;
}
if (!isUndefined2(from3._isUTC)) {
to3._isUTC = from3._isUTC;
}
if (!isUndefined2(from3._offset)) {
to3._offset = from3._offset;
}
if (!isUndefined2(from3._pf)) {
to3._pf = getParsingFlags2(from3);
}
if (!isUndefined2(from3._locale)) {
to3._locale = from3._locale;
}
if (momentPropertiesLen > 0) {
for (i = 0; i < momentPropertiesLen; i++) {
prop = momentProperties2[i];
val = from3[prop];
if (!isUndefined2(val)) {
to3[prop] = val;
}
}
}
return to3;
}
function Moment2(config) {
copyConfig2(this, config);
this._d = new Date(config._d != null ? config._d.getTime() : NaN);
if (!this.isValid()) {
this._d = /* @__PURE__ */ new Date(NaN);
}
if (updateInProgress2 === false) {
updateInProgress2 = true;
hooks2.updateOffset(this);
updateInProgress2 = false;
}
}
function isMoment2(obj) {
return obj instanceof Moment2 || obj != null && obj._isAMomentObject != null;
}
function warn2(msg) {
if (hooks2.suppressDeprecationWarnings === false && typeof console !== "undefined" && console.warn) {
console.warn("Deprecation warning: " + msg);
}
}
function deprecate2(msg, fn) {
var firstTime = true;
return extend2(function() {
if (hooks2.deprecationHandler != null) {
hooks2.deprecationHandler(null, msg);
}
if (firstTime) {
var args = [], arg, i, key, argLen = arguments.length;
for (i = 0; i < argLen; i++) {
arg = "";
if (typeof arguments[i] === "object") {
arg += "\n[" + i + "] ";
for (key in arguments[0]) {
if (hasOwnProp2(arguments[0], key)) {
arg += key + ": " + arguments[0][key] + ", ";
}
}
arg = arg.slice(0, -2);
} else {
arg = arguments[i];
}
args.push(arg);
}
warn2(msg + "\nArguments: " + Array.prototype.slice.call(args).join("") + "\n" + new Error().stack);
firstTime = false;
}
return fn.apply(this, arguments);
}, fn);
}
var deprecations2 = {};
function deprecateSimple2(name, msg) {
if (hooks2.deprecationHandler != null) {
hooks2.deprecationHandler(name, msg);
}
if (!deprecations2[name]) {
warn2(msg);
deprecations2[name] = true;
}
}
hooks2.suppressDeprecationWarnings = false;
hooks2.deprecationHandler = null;
function isFunction2(input) {
return typeof Function !== "undefined" && input instanceof Function || Object.prototype.toString.call(input) === "[object Function]";
}
function set2(config) {
var prop, i;
for (i in config) {
if (hasOwnProp2(config, i)) {
prop = config[i];
if (isFunction2(prop)) {
this[i] = prop;
} else {
this["_" + i] = prop;
}
}
}
this._config = config;
this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source);
}
function mergeConfigs2(parentConfig, childConfig) {
var res = extend2({}, parentConfig), prop;
for (prop in childConfig) {
if (hasOwnProp2(childConfig, prop)) {
if (isObject2(parentConfig[prop]) && isObject2(childConfig[prop])) {
res[prop] = {};
extend2(res[prop], parentConfig[prop]);
extend2(res[prop], childConfig[prop]);
} else if (childConfig[prop] != null) {
res[prop] = childConfig[prop];
} else {
delete res[prop];
}
}
}
for (prop in parentConfig) {
if (hasOwnProp2(parentConfig, prop) && !hasOwnProp2(childConfig, prop) && isObject2(parentConfig[prop])) {
res[prop] = extend2({}, res[prop]);
}
}
return res;
}
function Locale2(config) {
if (config != null) {
this.set(config);
}
}
var keys2;
if (Object.keys) {
keys2 = Object.keys;
} else {
keys2 = function(obj) {
var i, res = [];
for (i in obj) {
if (hasOwnProp2(obj, i)) {
res.push(i);
}
}
return res;
};
}
var defaultCalendar2 = {
sameDay: "[Today at] LT",
nextDay: "[Tomorrow at] LT",
nextWeek: "dddd [at] LT",
lastDay: "[Yesterday at] LT",
lastWeek: "[Last] dddd [at] LT",
sameElse: "L"
};
function calendar2(key, mom, now3) {
var output = this._calendar[key] || this._calendar["sameElse"];
return isFunction2(output) ? output.call(mom, now3) : output;
}
function zeroFill2(number, targetLength, forceSign) {
var absNumber = "" + Math.abs(number), zerosToFill = targetLength - absNumber.length, sign3 = number >= 0;
return (sign3 ? forceSign ? "+" : "" : "-") + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
}
var formattingTokens2 = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, localFormattingTokens2 = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, formatFunctions2 = {}, formatTokenFunctions2 = {};
function addFormatToken2(token3, padded, ordinal3, callback) {
var func = callback;
if (typeof callback === "string") {
func = function() {
return this[callback]();
};
}
if (token3) {
formatTokenFunctions2[token3] = func;
}
if (padded) {
formatTokenFunctions2[padded[0]] = function() {
return zeroFill2(func.apply(this, arguments), padded[1], padded[2]);
};
}
if (ordinal3) {
formatTokenFunctions2[ordinal3] = function() {
return this.localeData().ordinal(func.apply(this, arguments), token3);
};
}
}
function removeFormattingTokens2(input) {
if (input.match(/\[[\s\S]/)) {
return input.replace(/^\[|\]$/g, "");
}
return input.replace(/\\/g, "");
}
function makeFormatFunction2(format3) {
var array = format3.match(formattingTokens2), i, length;
for (i = 0, length = array.length; i < length; i++) {
if (formatTokenFunctions2[array[i]]) {
array[i] = formatTokenFunctions2[array[i]];
} else {
array[i] = removeFormattingTokens2(array[i]);
}
}
return function(mom) {
var output = "", i2;
for (i2 = 0; i2 < length; i2++) {
output += isFunction2(array[i2]) ? array[i2].call(mom, format3) : array[i2];
}
return output;
};
}
function formatMoment2(m, format3) {
if (!m.isValid()) {
return m.localeData().invalidDate();
}
format3 = expandFormat2(format3, m.localeData());
formatFunctions2[format3] = formatFunctions2[format3] || makeFormatFunction2(format3);
return formatFunctions2[format3](m);
}
function expandFormat2(format3, locale3) {
var i = 5;
function replaceLongDateFormatTokens(input) {
return locale3.longDateFormat(input) || input;
}
localFormattingTokens2.lastIndex = 0;
while (i >= 0 && localFormattingTokens2.test(format3)) {
format3 = format3.replace(localFormattingTokens2, replaceLongDateFormatTokens);
localFormattingTokens2.lastIndex = 0;
i -= 1;
}
return format3;
}
var defaultLongDateFormat2 = {
LTS: "h:mm:ss A",
LT: "h:mm A",
L: "MM/DD/YYYY",
LL: "MMMM D, YYYY",
LLL: "MMMM D, YYYY h:mm A",
LLLL: "dddd, MMMM D, YYYY h:mm A"
};
function longDateFormat2(key) {
var format3 = this._longDateFormat[key], formatUpper = this._longDateFormat[key.toUpperCase()];
if (format3 || !formatUpper) {
return format3;
}
this._longDateFormat[key] = formatUpper.match(formattingTokens2).map(function(tok) {
if (tok === "MMMM" || tok === "MM" || tok === "DD" || tok === "dddd") {
return tok.slice(1);
}
return tok;
}).join("");
return this._longDateFormat[key];
}
var defaultInvalidDate2 = "Invalid date";
function invalidDate2() {
return this._invalidDate;
}
var defaultOrdinal2 = "%d", defaultDayOfMonthOrdinalParse2 = /\d{1,2}/;
function ordinal2(number) {
return this._ordinal.replace("%d", number);
}
var defaultRelativeTime2 = {
future: "in %s",
past: "%s ago",
s: "a few seconds",
ss: "%d seconds",
m: "a minute",
mm: "%d minutes",
h: "an hour",
hh: "%d hours",
d: "a day",
dd: "%d days",
w: "a week",
ww: "%d weeks",
M: "a month",
MM: "%d months",
y: "a year",
yy: "%d years"
};
function relativeTime2(number, withoutSuffix, string, isFuture) {
var output = this._relativeTime[string];
return isFunction2(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number);
}
function pastFuture2(diff3, output) {
var format3 = this._relativeTime[diff3 > 0 ? "future" : "past"];
return isFunction2(format3) ? format3(output) : format3.replace(/%s/i, output);
}
var aliases2 = {
D: "date",
dates: "date",
date: "date",
d: "day",
days: "day",
day: "day",
e: "weekday",
weekdays: "weekday",
weekday: "weekday",
E: "isoWeekday",
isoweekdays: "isoWeekday",
isoweekday: "isoWeekday",
DDD: "dayOfYear",
dayofyears: "dayOfYear",
dayofyear: "dayOfYear",
h: "hour",
hours: "hour",
hour: "hour",
ms: "millisecond",
milliseconds: "millisecond",
millisecond: "millisecond",
m: "minute",
minutes: "minute",
minute: "minute",
M: "month",
months: "month",
month: "month",
Q: "quarter",
quarters: "quarter",
quarter: "quarter",
s: "second",
seconds: "second",
second: "second",
gg: "weekYear",
weekyears: "weekYear",
weekyear: "weekYear",
GG: "isoWeekYear",
isoweekyears: "isoWeekYear",
isoweekyear: "isoWeekYear",
w: "week",
weeks: "week",
week: "week",
W: "isoWeek",
isoweeks: "isoWeek",
isoweek: "isoWeek",
y: "year",
years: "year",
year: "year"
};
function normalizeUnits2(units) {
return typeof units === "string" ? aliases2[units] || aliases2[units.toLowerCase()] : void 0;
}
function normalizeObjectUnits2(inputObject) {
var normalizedInput = {}, normalizedProp, prop;
for (prop in inputObject) {
if (hasOwnProp2(inputObject, prop)) {
normalizedProp = normalizeUnits2(prop);
if (normalizedProp) {
normalizedInput[normalizedProp] = inputObject[prop];
}
}
}
return normalizedInput;
}
var priorities2 = {
date: 9,
day: 11,
weekday: 11,
isoWeekday: 11,
dayOfYear: 4,
hour: 13,
millisecond: 16,
minute: 14,
month: 8,
quarter: 7,
second: 15,
weekYear: 1,
isoWeekYear: 1,
week: 5,
isoWeek: 5,
year: 1
};
function getPrioritizedUnits2(unitsObj) {
var units = [], u;
for (u in unitsObj) {
if (hasOwnProp2(unitsObj, u)) {
units.push({
unit: u,
priority: priorities2[u]
});
}
}
units.sort(function(a, b) {
return a.priority - b.priority;
});
return units;
}
var match12 = /\d/, match22 = /\d\d/, match32 = /\d{3}/, match42 = /\d{4}/, match62 = /[+-]?\d{6}/, match1to22 = /\d\d?/, match3to42 = /\d\d\d\d?/, match5to62 = /\d\d\d\d\d\d?/, match1to32 = /\d{1,3}/, match1to42 = /\d{1,4}/, match1to62 = /[+-]?\d{1,6}/, matchUnsigned2 = /\d+/, matchSigned2 = /[+-]?\d+/, matchOffset2 = /Z|[+-]\d\d:?\d\d/gi, matchShortOffset2 = /Z|[+-]\d\d(?::?\d\d)?/gi, matchTimestamp2 = /[+-]?\d+(\.\d{1,3})?/, matchWord2 = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, match1to2NoLeadingZero2 = /^[1-9]\d?/, match1to2HasZero2 = /^([1-9]\d|\d)/, regexes2;
regexes2 = {};
function addRegexToken2(token3, regex, strictRegex) {
regexes2[token3] = isFunction2(regex) ? regex : function(isStrict, localeData3) {
return isStrict && strictRegex ? strictRegex : regex;
};
}
function getParseRegexForToken2(token3, config) {
if (!hasOwnProp2(regexes2, token3)) {
return new RegExp(unescapeFormat2(token3));
}
return regexes2[token3](config._strict, config._locale);
}
function unescapeFormat2(s) {
return regexEscape2(s.replace("\\", "").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function(matched, p1, p2, p3, p4) {
return p1 || p2 || p3 || p4;
}));
}
function regexEscape2(s) {
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
}
function absFloor2(number) {
if (number < 0) {
return Math.ceil(number) || 0;
} else {
return Math.floor(number);
}
}
function toInt2(argumentForCoercion) {
var coercedNumber = +argumentForCoercion, value = 0;
if (coercedNumber !== 0 && isFinite(coercedNumber)) {
value = absFloor2(coercedNumber);
}
return value;
}
var tokens2 = {};
function addParseToken2(token3, callback) {
var i, func = callback, tokenLen;
if (typeof token3 === "string") {
token3 = [
token3
];
}
if (isNumber2(callback)) {
func = function(input, array) {
array[callback] = toInt2(input);
};
}
tokenLen = token3.length;
for (i = 0; i < tokenLen; i++) {
tokens2[token3[i]] = func;
}
}
function addWeekParseToken2(token3, callback) {
addParseToken2(token3, function(input, array, config, token4) {
config._w = config._w || {};
callback(input, config._w, config, token4);
});
}
function addTimeToArrayFromToken2(token3, input, config) {
if (input != null && hasOwnProp2(tokens2, token3)) {
tokens2[token3](input, config._a, config, token3);
}
}
function isLeapYear2(year) {
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
}
var YEAR2 = 0, MONTH2 = 1, DATE2 = 2, HOUR2 = 3, MINUTE2 = 4, SECOND2 = 5, MILLISECOND2 = 6, WEEK2 = 7, WEEKDAY2 = 8;
addFormatToken2("Y", 0, 0, function() {
var y = this.year();
return y <= 9999 ? zeroFill2(y, 4) : "+" + y;
});
addFormatToken2(0, [
"YY",
2
], 0, function() {
return this.year() % 100;
});
addFormatToken2(0, [
"YYYY",
4
], 0, "year");
addFormatToken2(0, [
"YYYYY",
5
], 0, "year");
addFormatToken2(0, [
"YYYYYY",
6,
true
], 0, "year");
addRegexToken2("Y", matchSigned2);
addRegexToken2("YY", match1to22, match22);
addRegexToken2("YYYY", match1to42, match42);
addRegexToken2("YYYYY", match1to62, match62);
addRegexToken2("YYYYYY", match1to62, match62);
addParseToken2([
"YYYYY",
"YYYYYY"
], YEAR2);
addParseToken2("YYYY", function(input, array) {
array[YEAR2] = input.length === 2 ? hooks2.parseTwoDigitYear(input) : toInt2(input);
});
addParseToken2("YY", function(input, array) {
array[YEAR2] = hooks2.parseTwoDigitYear(input);
});
addParseToken2("Y", function(input, array) {
array[YEAR2] = parseInt(input, 10);
});
function daysInYear2(year) {
return isLeapYear2(year) ? 366 : 365;
}
hooks2.parseTwoDigitYear = function(input) {
return toInt2(input) + (toInt2(input) > 68 ? 1900 : 2e3);
};
var getSetYear2 = makeGetSet2("FullYear", true);
function getIsLeapYear2() {
return isLeapYear2(this.year());
}
function makeGetSet2(unit, keepTime) {
return function(value) {
if (value != null) {
set$12(this, unit, value);
hooks2.updateOffset(this, keepTime);
return this;
} else {
return get2(this, unit);
}
};
}
function get2(mom, unit) {
if (!mom.isValid()) {
return NaN;
}
var d = mom._d, isUTC = mom._isUTC;
switch (unit) {
case "Milliseconds":
return isUTC ? d.getUTCMilliseconds() : d.getMilliseconds();
case "Seconds":
return isUTC ? d.getUTCSeconds() : d.getSeconds();
case "Minutes":
return isUTC ? d.getUTCMinutes() : d.getMinutes();
case "Hours":
return isUTC ? d.getUTCHours() : d.getHours();
case "Date":
return isUTC ? d.getUTCDate() : d.getDate();
case "Day":
return isUTC ? d.getUTCDay() : d.getDay();
case "Month":
return isUTC ? d.getUTCMonth() : d.getMonth();
case "FullYear":
return isUTC ? d.getUTCFullYear() : d.getFullYear();
default:
return NaN;
}
}
function set$12(mom, unit, value) {
var d, isUTC, year, month, date;
if (!mom.isValid() || isNaN(value)) {
return;
}
d = mom._d;
isUTC = mom._isUTC;
switch (unit) {
case "Milliseconds":
return void (isUTC ? d.setUTCMilliseconds(value) : d.setMilliseconds(value));
case "Seconds":
return void (isUTC ? d.setUTCSeconds(value) : d.setSeconds(value));
case "Minutes":
return void (isUTC ? d.setUTCMinutes(value) : d.setMinutes(value));
case "Hours":
return void (isUTC ? d.setUTCHours(value) : d.setHours(value));
case "Date":
return void (isUTC ? d.setUTCDate(value) : d.setDate(value));
case "FullYear":
break;
default:
return;
}
year = value;
month = mom.month();
date = mom.date();
date = date === 29 && month === 1 && !isLeapYear2(year) ? 28 : date;
void (isUTC ? d.setUTCFullYear(year, month, date) : d.setFullYear(year, month, date));
}
function stringGet2(units) {
units = normalizeUnits2(units);
if (isFunction2(this[units])) {
return this[units]();
}
return this;
}
function stringSet2(units, value) {
if (typeof units === "object") {
units = normalizeObjectUnits2(units);
var prioritized = getPrioritizedUnits2(units), i, prioritizedLen = prioritized.length;
for (i = 0; i < prioritizedLen; i++) {
this[prioritized[i].unit](units[prioritized[i].unit]);
}
} else {
units = normalizeUnits2(units);
if (isFunction2(this[units])) {
return this[units](value);
}
}
return this;
}
function mod2(n, x) {
return (n % x + x) % x;
}
var indexOf2;
if (Array.prototype.indexOf) {
indexOf2 = Array.prototype.indexOf;
} else {
indexOf2 = function(o) {
var i;
for (i = 0; i < this.length; ++i) {
if (this[i] === o) {
return i;
}
}
return -1;
};
}
function daysInMonth2(year, month) {
if (isNaN(year) || isNaN(month)) {
return NaN;
}
var modMonth = mod2(month, 12);
year += (month - modMonth) / 12;
return modMonth === 1 ? isLeapYear2(year) ? 29 : 28 : 31 - modMonth % 7 % 2;
}
addFormatToken2("M", [
"MM",
2
], "Mo", function() {
return this.month() + 1;
});
addFormatToken2("MMM", 0, 0, function(format3) {
return this.localeData().monthsShort(this, format3);
});
addFormatToken2("MMMM", 0, 0, function(format3) {
return this.localeData().months(this, format3);
});
addRegexToken2("M", match1to22, match1to2NoLeadingZero2);
addRegexToken2("MM", match1to22, match22);
addRegexToken2("MMM", function(isStrict, locale3) {
return locale3.monthsShortRegex(isStrict);
});
addRegexToken2("MMMM", function(isStrict, locale3) {
return locale3.monthsRegex(isStrict);
});
addParseToken2([
"M",
"MM"
], function(input, array) {
array[MONTH2] = toInt2(input) - 1;
});
addParseToken2([
"MMM",
"MMMM"
], function(input, array, config, token3) {
var month = config._locale.monthsParse(input, token3, config._strict);
if (month != null) {
array[MONTH2] = month;
} else {
getParsingFlags2(config).invalidMonth = input;
}
});
var defaultLocaleMonths2 = "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), defaultLocaleMonthsShort2 = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), MONTHS_IN_FORMAT2 = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, defaultMonthsShortRegex2 = matchWord2, defaultMonthsRegex2 = matchWord2;
function localeMonths2(m, format3) {
if (!m) {
return isArray2(this._months) ? this._months : this._months["standalone"];
}
return isArray2(this._months) ? this._months[m.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT2).test(format3) ? "format" : "standalone"][m.month()];
}
function localeMonthsShort2(m, format3) {
if (!m) {
return isArray2(this._monthsShort) ? this._monthsShort : this._monthsShort["standalone"];
}
return isArray2(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[MONTHS_IN_FORMAT2.test(format3) ? "format" : "standalone"][m.month()];
}
function handleStrictParse2(monthName, format3, strict) {
var i, ii, mom, llc = monthName.toLocaleLowerCase();
if (!this._monthsParse) {
this._monthsParse = [];
this._longMonthsParse = [];
this._shortMonthsParse = [];
for (i = 0; i < 12; ++i) {
mom = createUTC2([
2e3,
i
]);
this._shortMonthsParse[i] = this.monthsShort(mom, "").toLocaleLowerCase();
this._longMonthsParse[i] = this.months(mom, "").toLocaleLowerCase();
}
}
if (strict) {
if (format3 === "MMM") {
ii = indexOf2.call(this._shortMonthsParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf2.call(this._longMonthsParse, llc);
return ii !== -1 ? ii : null;
}
} else {
if (format3 === "MMM") {
ii = indexOf2.call(this._shortMonthsParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf2.call(this._longMonthsParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf2.call(this._longMonthsParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf2.call(this._shortMonthsParse, llc);
return ii !== -1 ? ii : null;
}
}
}
function localeMonthsParse2(monthName, format3, strict) {
var i, mom, regex;
if (this._monthsParseExact) {
return handleStrictParse2.call(this, monthName, format3, strict);
}
if (!this._monthsParse) {
this._monthsParse = [];
this._longMonthsParse = [];
this._shortMonthsParse = [];
}
for (i = 0; i < 12; i++) {
mom = createUTC2([
2e3,
i
]);
if (strict && !this._longMonthsParse[i]) {
this._longMonthsParse[i] = new RegExp("^" + this.months(mom, "").replace(".", "") + "$", "i");
this._shortMonthsParse[i] = new RegExp("^" + this.monthsShort(mom, "").replace(".", "") + "$", "i");
}
if (!strict && !this._monthsParse[i]) {
regex = "^" + this.months(mom, "") + "|^" + this.monthsShort(mom, "");
this._monthsParse[i] = new RegExp(regex.replace(".", ""), "i");
}
if (strict && format3 === "MMMM" && this._longMonthsParse[i].test(monthName)) {
return i;
} else if (strict && format3 === "MMM" && this._shortMonthsParse[i].test(monthName)) {
return i;
} else if (!strict && this._monthsParse[i].test(monthName)) {
return i;
}
}
}
function setMonth2(mom, value) {
if (!mom.isValid()) {
return mom;
}
if (typeof value === "string") {
if (/^\d+$/.test(value)) {
value = toInt2(value);
} else {
value = mom.localeData().monthsParse(value);
if (!isNumber2(value)) {
return mom;
}
}
}
var month = value, date = mom.date();
date = date < 29 ? date : Math.min(date, daysInMonth2(mom.year(), month));
void (mom._isUTC ? mom._d.setUTCMonth(month, date) : mom._d.setMonth(month, date));
return mom;
}
function getSetMonth2(value) {
if (value != null) {
setMonth2(this, value);
hooks2.updateOffset(this, true);
return this;
} else {
return get2(this, "Month");
}
}
function getDaysInMonth2() {
return daysInMonth2(this.year(), this.month());
}
function monthsShortRegex2(isStrict) {
if (this._monthsParseExact) {
if (!hasOwnProp2(this, "_monthsRegex")) {
computeMonthsParse2.call(this);
}
if (isStrict) {
return this._monthsShortStrictRegex;
} else {
return this._monthsShortRegex;
}
} else {
if (!hasOwnProp2(this, "_monthsShortRegex")) {
this._monthsShortRegex = defaultMonthsShortRegex2;
}
return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex;
}
}
function monthsRegex2(isStrict) {
if (this._monthsParseExact) {
if (!hasOwnProp2(this, "_monthsRegex")) {
computeMonthsParse2.call(this);
}
if (isStrict) {
return this._monthsStrictRegex;
} else {
return this._monthsRegex;
}
} else {
if (!hasOwnProp2(this, "_monthsRegex")) {
this._monthsRegex = defaultMonthsRegex2;
}
return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex;
}
}
function computeMonthsParse2() {
function cmpLenRev(a, b) {
return b.length - a.length;
}
var shortPieces = [], longPieces = [], mixedPieces = [], i, mom, shortP, longP;
for (i = 0; i < 12; i++) {
mom = createUTC2([
2e3,
i
]);
shortP = regexEscape2(this.monthsShort(mom, ""));
longP = regexEscape2(this.months(mom, ""));
shortPieces.push(shortP);
longPieces.push(longP);
mixedPieces.push(longP);
mixedPieces.push(shortP);
}
shortPieces.sort(cmpLenRev);
longPieces.sort(cmpLenRev);
mixedPieces.sort(cmpLenRev);
this._monthsRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
this._monthsShortRegex = this._monthsRegex;
this._monthsStrictRegex = new RegExp("^(" + longPieces.join("|") + ")", "i");
this._monthsShortStrictRegex = new RegExp("^(" + shortPieces.join("|") + ")", "i");
}
function createDate2(y, m, d, h, M, s, ms) {
var date;
if (y < 100 && y >= 0) {
date = new Date(y + 400, m, d, h, M, s, ms);
if (isFinite(date.getFullYear())) {
date.setFullYear(y);
}
} else {
date = new Date(y, m, d, h, M, s, ms);
}
return date;
}
function createUTCDate2(y) {
var date, args;
if (y < 100 && y >= 0) {
args = Array.prototype.slice.call(arguments);
args[0] = y + 400;
date = new Date(Date.UTC.apply(null, args));
if (isFinite(date.getUTCFullYear())) {
date.setUTCFullYear(y);
}
} else {
date = new Date(Date.UTC.apply(null, arguments));
}
return date;
}
function firstWeekOffset2(year, dow, doy) {
var fwd = 7 + dow - doy, fwdlw = (7 + createUTCDate2(year, 0, fwd).getUTCDay() - dow) % 7;
return -fwdlw + fwd - 1;
}
function dayOfYearFromWeeks2(year, week, weekday, dow, doy) {
var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset2(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear;
if (dayOfYear <= 0) {
resYear = year - 1;
resDayOfYear = daysInYear2(resYear) + dayOfYear;
} else if (dayOfYear > daysInYear2(year)) {
resYear = year + 1;
resDayOfYear = dayOfYear - daysInYear2(year);
} else {
resYear = year;
resDayOfYear = dayOfYear;
}
return {
year: resYear,
dayOfYear: resDayOfYear
};
}
function weekOfYear2(mom, dow, doy) {
var weekOffset = firstWeekOffset2(mom.year(), dow, doy), week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, resWeek, resYear;
if (week < 1) {
resYear = mom.year() - 1;
resWeek = week + weeksInYear2(resYear, dow, doy);
} else if (week > weeksInYear2(mom.year(), dow, doy)) {
resWeek = week - weeksInYear2(mom.year(), dow, doy);
resYear = mom.year() + 1;
} else {
resYear = mom.year();
resWeek = week;
}
return {
week: resWeek,
year: resYear
};
}
function weeksInYear2(year, dow, doy) {
var weekOffset = firstWeekOffset2(year, dow, doy), weekOffsetNext = firstWeekOffset2(year + 1, dow, doy);
return (daysInYear2(year) - weekOffset + weekOffsetNext) / 7;
}
addFormatToken2("w", [
"ww",
2
], "wo", "week");
addFormatToken2("W", [
"WW",
2
], "Wo", "isoWeek");
addRegexToken2("w", match1to22, match1to2NoLeadingZero2);
addRegexToken2("ww", match1to22, match22);
addRegexToken2("W", match1to22, match1to2NoLeadingZero2);
addRegexToken2("WW", match1to22, match22);
addWeekParseToken2([
"w",
"ww",
"W",
"WW"
], function(input, week, config, token3) {
week[token3.substr(0, 1)] = toInt2(input);
});
function localeWeek2(mom) {
return weekOfYear2(mom, this._week.dow, this._week.doy).week;
}
var defaultLocaleWeek2 = {
dow: 0,
doy: 6
};
function localeFirstDayOfWeek2() {
return this._week.dow;
}
function localeFirstDayOfYear2() {
return this._week.doy;
}
function getSetWeek2(input) {
var week = this.localeData().week(this);
return input == null ? week : this.add((input - week) * 7, "d");
}
function getSetISOWeek2(input) {
var week = weekOfYear2(this, 1, 4).week;
return input == null ? week : this.add((input - week) * 7, "d");
}
addFormatToken2("d", 0, "do", "day");
addFormatToken2("dd", 0, 0, function(format3) {
return this.localeData().weekdaysMin(this, format3);
});
addFormatToken2("ddd", 0, 0, function(format3) {
return this.localeData().weekdaysShort(this, format3);
});
addFormatToken2("dddd", 0, 0, function(format3) {
return this.localeData().weekdays(this, format3);
});
addFormatToken2("e", 0, 0, "weekday");
addFormatToken2("E", 0, 0, "isoWeekday");
addRegexToken2("d", match1to22);
addRegexToken2("e", match1to22);
addRegexToken2("E", match1to22);
addRegexToken2("dd", function(isStrict, locale3) {
return locale3.weekdaysMinRegex(isStrict);
});
addRegexToken2("ddd", function(isStrict, locale3) {
return locale3.weekdaysShortRegex(isStrict);
});
addRegexToken2("dddd", function(isStrict, locale3) {
return locale3.weekdaysRegex(isStrict);
});
addWeekParseToken2([
"dd",
"ddd",
"dddd"
], function(input, week, config, token3) {
var weekday = config._locale.weekdaysParse(input, token3, config._strict);
if (weekday != null) {
week.d = weekday;
} else {
getParsingFlags2(config).invalidWeekday = input;
}
});
addWeekParseToken2([
"d",
"e",
"E"
], function(input, week, config, token3) {
week[token3] = toInt2(input);
});
function parseWeekday2(input, locale3) {
if (typeof input !== "string") {
return input;
}
if (!isNaN(input)) {
return parseInt(input, 10);
}
input = locale3.weekdaysParse(input);
if (typeof input === "number") {
return input;
}
return null;
}
function parseIsoWeekday2(input, locale3) {
if (typeof input === "string") {
return locale3.weekdaysParse(input) % 7 || 7;
}
return isNaN(input) ? null : input;
}
function shiftWeekdays2(ws, n) {
return ws.slice(n, 7).concat(ws.slice(0, n));
}
var defaultLocaleWeekdays2 = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), defaultLocaleWeekdaysShort2 = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), defaultLocaleWeekdaysMin2 = "Su_Mo_Tu_We_Th_Fr_Sa".split("_"), defaultWeekdaysRegex2 = matchWord2, defaultWeekdaysShortRegex2 = matchWord2, defaultWeekdaysMinRegex2 = matchWord2;
function localeWeekdays2(m, format3) {
var weekdays = isArray2(this._weekdays) ? this._weekdays : this._weekdays[m && m !== true && this._weekdays.isFormat.test(format3) ? "format" : "standalone"];
return m === true ? shiftWeekdays2(weekdays, this._week.dow) : m ? weekdays[m.day()] : weekdays;
}
function localeWeekdaysShort2(m) {
return m === true ? shiftWeekdays2(this._weekdaysShort, this._week.dow) : m ? this._weekdaysShort[m.day()] : this._weekdaysShort;
}
function localeWeekdaysMin2(m) {
return m === true ? shiftWeekdays2(this._weekdaysMin, this._week.dow) : m ? this._weekdaysMin[m.day()] : this._weekdaysMin;
}
function handleStrictParse$12(weekdayName, format3, strict) {
var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
if (!this._weekdaysParse) {
this._weekdaysParse = [];
this._shortWeekdaysParse = [];
this._minWeekdaysParse = [];
for (i = 0; i < 7; ++i) {
mom = createUTC2([
2e3,
1
]).day(i);
this._minWeekdaysParse[i] = this.weekdaysMin(mom, "").toLocaleLowerCase();
this._shortWeekdaysParse[i] = this.weekdaysShort(mom, "").toLocaleLowerCase();
this._weekdaysParse[i] = this.weekdays(mom, "").toLocaleLowerCase();
}
}
if (strict) {
if (format3 === "dddd") {
ii = indexOf2.call(this._weekdaysParse, llc);
return ii !== -1 ? ii : null;
} else if (format3 === "ddd") {
ii = indexOf2.call(this._shortWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf2.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
}
} else {
if (format3 === "dddd") {
ii = indexOf2.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf2.call(this._shortWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf2.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else if (format3 === "ddd") {
ii = indexOf2.call(this._shortWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf2.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf2.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf2.call(this._minWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf2.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf2.call(this._shortWeekdaysParse, llc);
return ii !== -1 ? ii : null;
}
}
}
function localeWeekdaysParse2(weekdayName, format3, strict) {
var i, mom, regex;
if (this._weekdaysParseExact) {
return handleStrictParse$12.call(this, weekdayName, format3, strict);
}
if (!this._weekdaysParse) {
this._weekdaysParse = [];
this._minWeekdaysParse = [];
this._shortWeekdaysParse = [];
this._fullWeekdaysParse = [];
}
for (i = 0; i < 7; i++) {
mom = createUTC2([
2e3,
1
]).day(i);
if (strict && !this._fullWeekdaysParse[i]) {
this._fullWeekdaysParse[i] = new RegExp("^" + this.weekdays(mom, "").replace(".", "\\.?") + "$", "i");
this._shortWeekdaysParse[i] = new RegExp("^" + this.weekdaysShort(mom, "").replace(".", "\\.?") + "$", "i");
this._minWeekdaysParse[i] = new RegExp("^" + this.weekdaysMin(mom, "").replace(".", "\\.?") + "$", "i");
}
if (!this._weekdaysParse[i]) {
regex = "^" + this.weekdays(mom, "") + "|^" + this.weekdaysShort(mom, "") + "|^" + this.weekdaysMin(mom, "");
this._weekdaysParse[i] = new RegExp(regex.replace(".", ""), "i");
}
if (strict && format3 === "dddd" && this._fullWeekdaysParse[i].test(weekdayName)) {
return i;
} else if (strict && format3 === "ddd" && this._shortWeekdaysParse[i].test(weekdayName)) {
return i;
} else if (strict && format3 === "dd" && this._minWeekdaysParse[i].test(weekdayName)) {
return i;
} else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
return i;
}
}
}
function getSetDayOfWeek2(input) {
if (!this.isValid()) {
return input != null ? this : NaN;
}
var day = get2(this, "Day");
if (input != null) {
input = parseWeekday2(input, this.localeData());
return this.add(input - day, "d");
} else {
return day;
}
}
function getSetLocaleDayOfWeek2(input) {
if (!this.isValid()) {
return input != null ? this : NaN;
}
var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
return input == null ? weekday : this.add(input - weekday, "d");
}
function getSetISODayOfWeek2(input) {
if (!this.isValid()) {
return input != null ? this : NaN;
}
if (input != null) {
var weekday = parseIsoWeekday2(input, this.localeData());
return this.day(this.day() % 7 ? weekday : weekday - 7);
} else {
return this.day() || 7;
}
}
function weekdaysRegex2(isStrict) {
if (this._weekdaysParseExact) {
if (!hasOwnProp2(this, "_weekdaysRegex")) {
computeWeekdaysParse2.call(this);
}
if (isStrict) {
return this._weekdaysStrictRegex;
} else {
return this._weekdaysRegex;
}
} else {
if (!hasOwnProp2(this, "_weekdaysRegex")) {
this._weekdaysRegex = defaultWeekdaysRegex2;
}
return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex;
}
}
function weekdaysShortRegex2(isStrict) {
if (this._weekdaysParseExact) {
if (!hasOwnProp2(this, "_weekdaysRegex")) {
computeWeekdaysParse2.call(this);
}
if (isStrict) {
return this._weekdaysShortStrictRegex;
} else {
return this._weekdaysShortRegex;
}
} else {
if (!hasOwnProp2(this, "_weekdaysShortRegex")) {
this._weekdaysShortRegex = defaultWeekdaysShortRegex2;
}
return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
}
}
function weekdaysMinRegex2(isStrict) {
if (this._weekdaysParseExact) {
if (!hasOwnProp2(this, "_weekdaysRegex")) {
computeWeekdaysParse2.call(this);
}
if (isStrict) {
return this._weekdaysMinStrictRegex;
} else {
return this._weekdaysMinRegex;
}
} else {
if (!hasOwnProp2(this, "_weekdaysMinRegex")) {
this._weekdaysMinRegex = defaultWeekdaysMinRegex2;
}
return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
}
}
function computeWeekdaysParse2() {
function cmpLenRev(a, b) {
return b.length - a.length;
}
var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], i, mom, minp, shortp, longp;
for (i = 0; i < 7; i++) {
mom = createUTC2([
2e3,
1
]).day(i);
minp = regexEscape2(this.weekdaysMin(mom, ""));
shortp = regexEscape2(this.weekdaysShort(mom, ""));
longp = regexEscape2(this.weekdays(mom, ""));
minPieces.push(minp);
shortPieces.push(shortp);
longPieces.push(longp);
mixedPieces.push(minp);
mixedPieces.push(shortp);
mixedPieces.push(longp);
}
minPieces.sort(cmpLenRev);
shortPieces.sort(cmpLenRev);
longPieces.sort(cmpLenRev);
mixedPieces.sort(cmpLenRev);
this._weekdaysRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
this._weekdaysShortRegex = this._weekdaysRegex;
this._weekdaysMinRegex = this._weekdaysRegex;
this._weekdaysStrictRegex = new RegExp("^(" + longPieces.join("|") + ")", "i");
this._weekdaysShortStrictRegex = new RegExp("^(" + shortPieces.join("|") + ")", "i");
this._weekdaysMinStrictRegex = new RegExp("^(" + minPieces.join("|") + ")", "i");
}
function hFormat2() {
return this.hours() % 12 || 12;
}
function kFormat2() {
return this.hours() || 24;
}
addFormatToken2("H", [
"HH",
2
], 0, "hour");
addFormatToken2("h", [
"hh",
2
], 0, hFormat2);
addFormatToken2("k", [
"kk",
2
], 0, kFormat2);
addFormatToken2("hmm", 0, 0, function() {
return "" + hFormat2.apply(this) + zeroFill2(this.minutes(), 2);
});
addFormatToken2("hmmss", 0, 0, function() {
return "" + hFormat2.apply(this) + zeroFill2(this.minutes(), 2) + zeroFill2(this.seconds(), 2);
});
addFormatToken2("Hmm", 0, 0, function() {
return "" + this.hours() + zeroFill2(this.minutes(), 2);
});
addFormatToken2("Hmmss", 0, 0, function() {
return "" + this.hours() + zeroFill2(this.minutes(), 2) + zeroFill2(this.seconds(), 2);
});
function meridiem2(token3, lowercase) {
addFormatToken2(token3, 0, 0, function() {
return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
});
}
meridiem2("a", true);
meridiem2("A", false);
function matchMeridiem2(isStrict, locale3) {
return locale3._meridiemParse;
}
addRegexToken2("a", matchMeridiem2);
addRegexToken2("A", matchMeridiem2);
addRegexToken2("H", match1to22, match1to2HasZero2);
addRegexToken2("h", match1to22, match1to2NoLeadingZero2);
addRegexToken2("k", match1to22, match1to2NoLeadingZero2);
addRegexToken2("HH", match1to22, match22);
addRegexToken2("hh", match1to22, match22);
addRegexToken2("kk", match1to22, match22);
addRegexToken2("hmm", match3to42);
addRegexToken2("hmmss", match5to62);
addRegexToken2("Hmm", match3to42);
addRegexToken2("Hmmss", match5to62);
addParseToken2([
"H",
"HH"
], HOUR2);
addParseToken2([
"k",
"kk"
], function(input, array, config) {
var kInput = toInt2(input);
array[HOUR2] = kInput === 24 ? 0 : kInput;
});
addParseToken2([
"a",
"A"
], function(input, array, config) {
config._isPm = config._locale.isPM(input);
config._meridiem = input;
});
addParseToken2([
"h",
"hh"
], function(input, array, config) {
array[HOUR2] = toInt2(input);
getParsingFlags2(config).bigHour = true;
});
addParseToken2("hmm", function(input, array, config) {
var pos = input.length - 2;
array[HOUR2] = toInt2(input.substr(0, pos));
array[MINUTE2] = toInt2(input.substr(pos));
getParsingFlags2(config).bigHour = true;
});
addParseToken2("hmmss", function(input, array, config) {
var pos1 = input.length - 4, pos2 = input.length - 2;
array[HOUR2] = toInt2(input.substr(0, pos1));
array[MINUTE2] = toInt2(input.substr(pos1, 2));
array[SECOND2] = toInt2(input.substr(pos2));
getParsingFlags2(config).bigHour = true;
});
addParseToken2("Hmm", function(input, array, config) {
var pos = input.length - 2;
array[HOUR2] = toInt2(input.substr(0, pos));
array[MINUTE2] = toInt2(input.substr(pos));
});
addParseToken2("Hmmss", function(input, array, config) {
var pos1 = input.length - 4, pos2 = input.length - 2;
array[HOUR2] = toInt2(input.substr(0, pos1));
array[MINUTE2] = toInt2(input.substr(pos1, 2));
array[SECOND2] = toInt2(input.substr(pos2));
});
function localeIsPM2(input) {
return (input + "").toLowerCase().charAt(0) === "p";
}
var defaultLocaleMeridiemParse2 = /[ap]\.?m?\.?/i, getSetHour2 = makeGetSet2("Hours", true);
function localeMeridiem2(hours3, minutes3, isLower) {
if (hours3 > 11) {
return isLower ? "pm" : "PM";
} else {
return isLower ? "am" : "AM";
}
}
var baseConfig2 = {
calendar: defaultCalendar2,
longDateFormat: defaultLongDateFormat2,
invalidDate: defaultInvalidDate2,
ordinal: defaultOrdinal2,
dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse2,
relativeTime: defaultRelativeTime2,
months: defaultLocaleMonths2,
monthsShort: defaultLocaleMonthsShort2,
week: defaultLocaleWeek2,
weekdays: defaultLocaleWeekdays2,
weekdaysMin: defaultLocaleWeekdaysMin2,
weekdaysShort: defaultLocaleWeekdaysShort2,
meridiemParse: defaultLocaleMeridiemParse2
};
var locales2 = {}, localeFamilies2 = {}, globalLocale2;
function commonPrefix2(arr1, arr2) {
var i, minl = Math.min(arr1.length, arr2.length);
for (i = 0; i < minl; i += 1) {
if (arr1[i] !== arr2[i]) {
return i;
}
}
return minl;
}
function normalizeLocale2(key) {
return key ? key.toLowerCase().replace("_", "-") : key;
}
function chooseLocale2(names) {
var i = 0, j, next, locale3, split;
while (i < names.length) {
split = normalizeLocale2(names[i]).split("-");
j = split.length;
next = normalizeLocale2(names[i + 1]);
next = next ? next.split("-") : null;
while (j > 0) {
locale3 = loadLocale2(split.slice(0, j).join("-"));
if (locale3) {
return locale3;
}
if (next && next.length >= j && commonPrefix2(split, next) >= j - 1) {
break;
}
j--;
}
i++;
}
return globalLocale2;
}
function isLocaleNameSane2(name) {
return !!(name && name.match("^[^/\\\\]*$"));
}
function loadLocale2(name) {
var oldLocale = null, aliasedRequire;
if (locales2[name] === void 0 && true && module2 && module2.exports && isLocaleNameSane2(name)) {
try {
oldLocale = globalLocale2._abbr;
aliasedRequire = commonjsRequire;
aliasedRequire("./locale/" + name);
getSetGlobalLocale2(oldLocale);
} catch (e) {
locales2[name] = null;
}
}
return locales2[name];
}
function getSetGlobalLocale2(key, values) {
var data;
if (key) {
if (isUndefined2(values)) {
data = getLocale2(key);
} else {
data = defineLocale2(key, values);
}
if (data) {
globalLocale2 = data;
} else {
if (typeof console !== "undefined" && console.warn) {
console.warn("Locale " + key + " not found. Did you forget to load it?");
}
}
}
return globalLocale2._abbr;
}
function defineLocale2(name, config) {
if (config !== null) {
var locale3, parentConfig = baseConfig2;
config.abbr = name;
if (locales2[name] != null) {
deprecateSimple2("defineLocaleOverride", "use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info.");
parentConfig = locales2[name]._config;
} else if (config.parentLocale != null) {
if (locales2[config.parentLocale] != null) {
parentConfig = locales2[config.parentLocale]._config;
} else {
locale3 = loadLocale2(config.parentLocale);
if (locale3 != null) {
parentConfig = locale3._config;
} else {
if (!localeFamilies2[config.parentLocale]) {
localeFamilies2[config.parentLocale] = [];
}
localeFamilies2[config.parentLocale].push({
name,
config
});
return null;
}
}
}
locales2[name] = new Locale2(mergeConfigs2(parentConfig, config));
if (localeFamilies2[name]) {
localeFamilies2[name].forEach(function(x) {
defineLocale2(x.name, x.config);
});
}
getSetGlobalLocale2(name);
return locales2[name];
} else {
delete locales2[name];
return null;
}
}
function updateLocale2(name, config) {
if (config != null) {
var locale3, tmpLocale, parentConfig = baseConfig2;
if (locales2[name] != null && locales2[name].parentLocale != null) {
locales2[name].set(mergeConfigs2(locales2[name]._config, config));
} else {
tmpLocale = loadLocale2(name);
if (tmpLocale != null) {
parentConfig = tmpLocale._config;
}
config = mergeConfigs2(parentConfig, config);
if (tmpLocale == null) {
config.abbr = name;
}
locale3 = new Locale2(config);
locale3.parentLocale = locales2[name];
locales2[name] = locale3;
}
getSetGlobalLocale2(name);
} else {
if (locales2[name] != null) {
if (locales2[name].parentLocale != null) {
locales2[name] = locales2[name].parentLocale;
if (name === getSetGlobalLocale2()) {
getSetGlobalLocale2(name);
}
} else if (locales2[name] != null) {
delete locales2[name];
}
}
}
return locales2[name];
}
function getLocale2(key) {
var locale3;
if (key && key._locale && key._locale._abbr) {
key = key._locale._abbr;
}
if (!key) {
return globalLocale2;
}
if (!isArray2(key)) {
locale3 = loadLocale2(key);
if (locale3) {
return locale3;
}
key = [
key
];
}
return chooseLocale2(key);
}
function listLocales2() {
return keys2(locales2);
}
function checkOverflow2(m) {
var overflow, a = m._a;
if (a && getParsingFlags2(m).overflow === -2) {
overflow = a[MONTH2] < 0 || a[MONTH2] > 11 ? MONTH2 : a[DATE2] < 1 || a[DATE2] > daysInMonth2(a[YEAR2], a[MONTH2]) ? DATE2 : a[HOUR2] < 0 || a[HOUR2] > 24 || a[HOUR2] === 24 && (a[MINUTE2] !== 0 || a[SECOND2] !== 0 || a[MILLISECOND2] !== 0) ? HOUR2 : a[MINUTE2] < 0 || a[MINUTE2] > 59 ? MINUTE2 : a[SECOND2] < 0 || a[SECOND2] > 59 ? SECOND2 : a[MILLISECOND2] < 0 || a[MILLISECOND2] > 999 ? MILLISECOND2 : -1;
if (getParsingFlags2(m)._overflowDayOfYear && (overflow < YEAR2 || overflow > DATE2)) {
overflow = DATE2;
}
if (getParsingFlags2(m)._overflowWeeks && overflow === -1) {
overflow = WEEK2;
}
if (getParsingFlags2(m)._overflowWeekday && overflow === -1) {
overflow = WEEKDAY2;
}
getParsingFlags2(m).overflow = overflow;
}
return m;
}
var extendedIsoRegex2 = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, basicIsoRegex2 = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, tzRegex2 = /Z|[+-]\d\d(?::?\d\d)?/, isoDates2 = [
[
"YYYYYY-MM-DD",
/[+-]\d{6}-\d\d-\d\d/
],
[
"YYYY-MM-DD",
/\d{4}-\d\d-\d\d/
],
[
"GGGG-[W]WW-E",
/\d{4}-W\d\d-\d/
],
[
"GGGG-[W]WW",
/\d{4}-W\d\d/,
false
],
[
"YYYY-DDD",
/\d{4}-\d{3}/
],
[
"YYYY-MM",
/\d{4}-\d\d/,
false
],
[
"YYYYYYMMDD",
/[+-]\d{10}/
],
[
"YYYYMMDD",
/\d{8}/
],
[
"GGGG[W]WWE",
/\d{4}W\d{3}/
],
[
"GGGG[W]WW",
/\d{4}W\d{2}/,
false
],
[
"YYYYDDD",
/\d{7}/
],
[
"YYYYMM",
/\d{6}/,
false
],
[
"YYYY",
/\d{4}/,
false
]
], isoTimes2 = [
[
"HH:mm:ss.SSSS",
/\d\d:\d\d:\d\d\.\d+/
],
[
"HH:mm:ss,SSSS",
/\d\d:\d\d:\d\d,\d+/
],
[
"HH:mm:ss",
/\d\d:\d\d:\d\d/
],
[
"HH:mm",
/\d\d:\d\d/
],
[
"HHmmss.SSSS",
/\d\d\d\d\d\d\.\d+/
],
[
"HHmmss,SSSS",
/\d\d\d\d\d\d,\d+/
],
[
"HHmmss",
/\d\d\d\d\d\d/
],
[
"HHmm",
/\d\d\d\d/
],
[
"HH",
/\d\d/
]
], aspNetJsonRegex2 = /^\/?Date\((-?\d+)/i, rfc28222 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/, obsOffsets2 = {
UT: 0,
GMT: 0,
EDT: -4 * 60,
EST: -5 * 60,
CDT: -5 * 60,
CST: -6 * 60,
MDT: -6 * 60,
MST: -7 * 60,
PDT: -7 * 60,
PST: -8 * 60
};
function configFromISO2(config) {
var i, l, string = config._i, match = extendedIsoRegex2.exec(string) || basicIsoRegex2.exec(string), allowTime, dateFormat, timeFormat, tzFormat, isoDatesLen = isoDates2.length, isoTimesLen = isoTimes2.length;
if (match) {
getParsingFlags2(config).iso = true;
for (i = 0, l = isoDatesLen; i < l; i++) {
if (isoDates2[i][1].exec(match[1])) {
dateFormat = isoDates2[i][0];
allowTime = isoDates2[i][2] !== false;
break;
}
}
if (dateFormat == null) {
config._isValid = false;
return;
}
if (match[3]) {
for (i = 0, l = isoTimesLen; i < l; i++) {
if (isoTimes2[i][1].exec(match[3])) {
timeFormat = (match[2] || " ") + isoTimes2[i][0];
break;
}
}
if (timeFormat == null) {
config._isValid = false;
return;
}
}
if (!allowTime && timeFormat != null) {
config._isValid = false;
return;
}
if (match[4]) {
if (tzRegex2.exec(match[4])) {
tzFormat = "Z";
} else {
config._isValid = false;
return;
}
}
config._f = dateFormat + (timeFormat || "") + (tzFormat || "");
configFromStringAndFormat2(config);
} else {
config._isValid = false;
}
}
function extractFromRFC2822Strings2(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
var result = [
untruncateYear2(yearStr),
defaultLocaleMonthsShort2.indexOf(monthStr),
parseInt(dayStr, 10),
parseInt(hourStr, 10),
parseInt(minuteStr, 10)
];
if (secondStr) {
result.push(parseInt(secondStr, 10));
}
return result;
}
function untruncateYear2(yearStr) {
var year = parseInt(yearStr, 10);
if (year <= 49) {
return 2e3 + year;
} else if (year <= 999) {
return 1900 + year;
}
return year;
}
function preprocessRFC28222(s) {
return s.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "");
}
function checkWeekday2(weekdayStr, parsedInput, config) {
if (weekdayStr) {
var weekdayProvided = defaultLocaleWeekdaysShort2.indexOf(weekdayStr), weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay();
if (weekdayProvided !== weekdayActual) {
getParsingFlags2(config).weekdayMismatch = true;
config._isValid = false;
return false;
}
}
return true;
}
function calculateOffset2(obsOffset, militaryOffset, numOffset) {
if (obsOffset) {
return obsOffsets2[obsOffset];
} else if (militaryOffset) {
return 0;
} else {
var hm = parseInt(numOffset, 10), m = hm % 100, h = (hm - m) / 100;
return h * 60 + m;
}
}
function configFromRFC28222(config) {
var match = rfc28222.exec(preprocessRFC28222(config._i)), parsedArray;
if (match) {
parsedArray = extractFromRFC2822Strings2(match[4], match[3], match[2], match[5], match[6], match[7]);
if (!checkWeekday2(match[1], parsedArray, config)) {
return;
}
config._a = parsedArray;
config._tzm = calculateOffset2(match[8], match[9], match[10]);
config._d = createUTCDate2.apply(null, config._a);
config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
getParsingFlags2(config).rfc2822 = true;
} else {
config._isValid = false;
}
}
function configFromString2(config) {
var matched = aspNetJsonRegex2.exec(config._i);
if (matched !== null) {
config._d = /* @__PURE__ */ new Date(+matched[1]);
return;
}
configFromISO2(config);
if (config._isValid === false) {
delete config._isValid;
} else {
return;
}
configFromRFC28222(config);
if (config._isValid === false) {
delete config._isValid;
} else {
return;
}
if (config._strict) {
config._isValid = false;
} else {
hooks2.createFromInputFallback(config);
}
}
hooks2.createFromInputFallback = deprecate2("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.", function(config) {
config._d = /* @__PURE__ */ new Date(config._i + (config._useUTC ? " UTC" : ""));
});
function defaults2(a, b, c) {
if (a != null) {
return a;
}
if (b != null) {
return b;
}
return c;
}
function currentDateArray2(config) {
var nowValue = new Date(hooks2.now());
if (config._useUTC) {
return [
nowValue.getUTCFullYear(),
nowValue.getUTCMonth(),
nowValue.getUTCDate()
];
}
return [
nowValue.getFullYear(),
nowValue.getMonth(),
nowValue.getDate()
];
}
function configFromArray2(config) {
var i, date, input = [], currentDate, expectedWeekday, yearToUse;
if (config._d) {
return;
}
currentDate = currentDateArray2(config);
if (config._w && config._a[DATE2] == null && config._a[MONTH2] == null) {
dayOfYearFromWeekInfo2(config);
}
if (config._dayOfYear != null) {
yearToUse = defaults2(config._a[YEAR2], currentDate[YEAR2]);
if (config._dayOfYear > daysInYear2(yearToUse) || config._dayOfYear === 0) {
getParsingFlags2(config)._overflowDayOfYear = true;
}
date = createUTCDate2(yearToUse, 0, config._dayOfYear);
config._a[MONTH2] = date.getUTCMonth();
config._a[DATE2] = date.getUTCDate();
}
for (i = 0; i < 3 && config._a[i] == null; ++i) {
config._a[i] = input[i] = currentDate[i];
}
for (; i < 7; i++) {
config._a[i] = input[i] = config._a[i] == null ? i === 2 ? 1 : 0 : config._a[i];
}
if (config._a[HOUR2] === 24 && config._a[MINUTE2] === 0 && config._a[SECOND2] === 0 && config._a[MILLISECOND2] === 0) {
config._nextDay = true;
config._a[HOUR2] = 0;
}
config._d = (config._useUTC ? createUTCDate2 : createDate2).apply(null, input);
expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
if (config._tzm != null) {
config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
}
if (config._nextDay) {
config._a[HOUR2] = 24;
}
if (config._w && typeof config._w.d !== "undefined" && config._w.d !== expectedWeekday) {
getParsingFlags2(config).weekdayMismatch = true;
}
}
function dayOfYearFromWeekInfo2(config) {
var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
w = config._w;
if (w.GG != null || w.W != null || w.E != null) {
dow = 1;
doy = 4;
weekYear = defaults2(w.GG, config._a[YEAR2], weekOfYear2(createLocal2(), 1, 4).year);
week = defaults2(w.W, 1);
weekday = defaults2(w.E, 1);
if (weekday < 1 || weekday > 7) {
weekdayOverflow = true;
}
} else {
dow = config._locale._week.dow;
doy = config._locale._week.doy;
curWeek = weekOfYear2(createLocal2(), dow, doy);
weekYear = defaults2(w.gg, config._a[YEAR2], curWeek.year);
week = defaults2(w.w, curWeek.week);
if (w.d != null) {
weekday = w.d;
if (weekday < 0 || weekday > 6) {
weekdayOverflow = true;
}
} else if (w.e != null) {
weekday = w.e + dow;
if (w.e < 0 || w.e > 6) {
weekdayOverflow = true;
}
} else {
weekday = dow;
}
}
if (week < 1 || week > weeksInYear2(weekYear, dow, doy)) {
getParsingFlags2(config)._overflowWeeks = true;
} else if (weekdayOverflow != null) {
getParsingFlags2(config)._overflowWeekday = true;
} else {
temp = dayOfYearFromWeeks2(weekYear, week, weekday, dow, doy);
config._a[YEAR2] = temp.year;
config._dayOfYear = temp.dayOfYear;
}
}
hooks2.ISO_8601 = function() {
};
hooks2.RFC_2822 = function() {
};
function configFromStringAndFormat2(config) {
if (config._f === hooks2.ISO_8601) {
configFromISO2(config);
return;
}
if (config._f === hooks2.RFC_2822) {
configFromRFC28222(config);
return;
}
config._a = [];
getParsingFlags2(config).empty = true;
var string = "" + config._i, i, parsedInput, tokens3, token3, skipped, stringLength = string.length, totalParsedInputLength = 0, era, tokenLen;
tokens3 = expandFormat2(config._f, config._locale).match(formattingTokens2) || [];
tokenLen = tokens3.length;
for (i = 0; i < tokenLen; i++) {
token3 = tokens3[i];
parsedInput = (string.match(getParseRegexForToken2(token3, config)) || [])[0];
if (parsedInput) {
skipped = string.substr(0, string.indexOf(parsedInput));
if (skipped.length > 0) {
getParsingFlags2(config).unusedInput.push(skipped);
}
string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
totalParsedInputLength += parsedInput.length;
}
if (formatTokenFunctions2[token3]) {
if (parsedInput) {
getParsingFlags2(config).empty = false;
} else {
getParsingFlags2(config).unusedTokens.push(token3);
}
addTimeToArrayFromToken2(token3, parsedInput, config);
} else if (config._strict && !parsedInput) {
getParsingFlags2(config).unusedTokens.push(token3);
}
}
getParsingFlags2(config).charsLeftOver = stringLength - totalParsedInputLength;
if (string.length > 0) {
getParsingFlags2(config).unusedInput.push(string);
}
if (config._a[HOUR2] <= 12 && getParsingFlags2(config).bigHour === true && config._a[HOUR2] > 0) {
getParsingFlags2(config).bigHour = void 0;
}
getParsingFlags2(config).parsedDateParts = config._a.slice(0);
getParsingFlags2(config).meridiem = config._meridiem;
config._a[HOUR2] = meridiemFixWrap2(config._locale, config._a[HOUR2], config._meridiem);
era = getParsingFlags2(config).era;
if (era !== null) {
config._a[YEAR2] = config._locale.erasConvertYear(era, config._a[YEAR2]);
}
configFromArray2(config);
checkOverflow2(config);
}
function meridiemFixWrap2(locale3, hour, meridiem3) {
var isPm;
if (meridiem3 == null) {
return hour;
}
if (locale3.meridiemHour != null) {
return locale3.meridiemHour(hour, meridiem3);
} else if (locale3.isPM != null) {
isPm = locale3.isPM(meridiem3);
if (isPm && hour < 12) {
hour += 12;
}
if (!isPm && hour === 12) {
hour = 0;
}
return hour;
} else {
return hour;
}
}
function configFromStringAndArray2(config) {
var tempConfig, bestMoment, scoreToBeat, i, currentScore, validFormatFound, bestFormatIsValid = false, configfLen = config._f.length;
if (configfLen === 0) {
getParsingFlags2(config).invalidFormat = true;
config._d = /* @__PURE__ */ new Date(NaN);
return;
}
for (i = 0; i < configfLen; i++) {
currentScore = 0;
validFormatFound = false;
tempConfig = copyConfig2({}, config);
if (config._useUTC != null) {
tempConfig._useUTC = config._useUTC;
}
tempConfig._f = config._f[i];
configFromStringAndFormat2(tempConfig);
if (isValid2(tempConfig)) {
validFormatFound = true;
}
currentScore += getParsingFlags2(tempConfig).charsLeftOver;
currentScore += getParsingFlags2(tempConfig).unusedTokens.length * 10;
getParsingFlags2(tempConfig).score = currentScore;
if (!bestFormatIsValid) {
if (scoreToBeat == null || currentScore < scoreToBeat || validFormatFound) {
scoreToBeat = currentScore;
bestMoment = tempConfig;
if (validFormatFound) {
bestFormatIsValid = true;
}
}
} else {
if (currentScore < scoreToBeat) {
scoreToBeat = currentScore;
bestMoment = tempConfig;
}
}
}
extend2(config, bestMoment || tempConfig);
}
function configFromObject2(config) {
if (config._d) {
return;
}
var i = normalizeObjectUnits2(config._i), dayOrDate = i.day === void 0 ? i.date : i.day;
config._a = map2([
i.year,
i.month,
dayOrDate,
i.hour,
i.minute,
i.second,
i.millisecond
], function(obj) {
return obj && parseInt(obj, 10);
});
configFromArray2(config);
}
function createFromConfig2(config) {
var res = new Moment2(checkOverflow2(prepareConfig2(config)));
if (res._nextDay) {
res.add(1, "d");
res._nextDay = void 0;
}
return res;
}
function prepareConfig2(config) {
var input = config._i, format3 = config._f;
config._locale = config._locale || getLocale2(config._l);
if (input === null || format3 === void 0 && input === "") {
return createInvalid2({
nullInput: true
});
}
if (typeof input === "string") {
config._i = input = config._locale.preparse(input);
}
if (isMoment2(input)) {
return new Moment2(checkOverflow2(input));
} else if (isDate2(input)) {
config._d = input;
} else if (isArray2(format3)) {
configFromStringAndArray2(config);
} else if (format3) {
configFromStringAndFormat2(config);
} else {
configFromInput2(config);
}
if (!isValid2(config)) {
config._d = null;
}
return config;
}
function configFromInput2(config) {
var input = config._i;
if (isUndefined2(input)) {
config._d = new Date(hooks2.now());
} else if (isDate2(input)) {
config._d = new Date(input.valueOf());
} else if (typeof input === "string") {
configFromString2(config);
} else if (isArray2(input)) {
config._a = map2(input.slice(0), function(obj) {
return parseInt(obj, 10);
});
configFromArray2(config);
} else if (isObject2(input)) {
configFromObject2(config);
} else if (isNumber2(input)) {
config._d = new Date(input);
} else {
hooks2.createFromInputFallback(config);
}
}
function createLocalOrUTC2(input, format3, locale3, strict, isUTC) {
var c = {};
if (format3 === true || format3 === false) {
strict = format3;
format3 = void 0;
}
if (locale3 === true || locale3 === false) {
strict = locale3;
locale3 = void 0;
}
if (isObject2(input) && isObjectEmpty2(input) || isArray2(input) && input.length === 0) {
input = void 0;
}
c._isAMomentObject = true;
c._useUTC = c._isUTC = isUTC;
c._l = locale3;
c._i = input;
c._f = format3;
c._strict = strict;
return createFromConfig2(c);
}
function createLocal2(input, format3, locale3, strict) {
return createLocalOrUTC2(input, format3, locale3, strict, false);
}
var prototypeMin2 = deprecate2("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/", function() {
var other = createLocal2.apply(null, arguments);
if (this.isValid() && other.isValid()) {
return other < this ? this : other;
} else {
return createInvalid2();
}
}), prototypeMax2 = deprecate2("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/", function() {
var other = createLocal2.apply(null, arguments);
if (this.isValid() && other.isValid()) {
return other > this ? this : other;
} else {
return createInvalid2();
}
});
function pickBy2(fn, moments) {
var res, i;
if (moments.length === 1 && isArray2(moments[0])) {
moments = moments[0];
}
if (!moments.length) {
return createLocal2();
}
res = moments[0];
for (i = 1; i < moments.length; ++i) {
if (!moments[i].isValid() || moments[i][fn](res)) {
res = moments[i];
}
}
return res;
}
function min2() {
var args = [].slice.call(arguments, 0);
return pickBy2("isBefore", args);
}
function max2() {
var args = [].slice.call(arguments, 0);
return pickBy2("isAfter", args);
}
var now2 = function() {
return Date.now ? Date.now() : +/* @__PURE__ */ new Date();
};
var ordering2 = [
"year",
"quarter",
"month",
"week",
"day",
"hour",
"minute",
"second",
"millisecond"
];
function isDurationValid2(m) {
var key, unitHasDecimal = false, i, orderLen = ordering2.length;
for (key in m) {
if (hasOwnProp2(m, key) && !(indexOf2.call(ordering2, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
return false;
}
}
for (i = 0; i < orderLen; ++i) {
if (m[ordering2[i]]) {
if (unitHasDecimal) {
return false;
}
if (parseFloat(m[ordering2[i]]) !== toInt2(m[ordering2[i]])) {
unitHasDecimal = true;
}
}
}
return true;
}
function isValid$12() {
return this._isValid;
}
function createInvalid$12() {
return createDuration2(NaN);
}
function Duration2(duration) {
var normalizedInput = normalizeObjectUnits2(duration), years3 = normalizedInput.year || 0, quarters = normalizedInput.quarter || 0, months3 = normalizedInput.month || 0, weeks3 = normalizedInput.week || normalizedInput.isoWeek || 0, days3 = normalizedInput.day || 0, hours3 = normalizedInput.hour || 0, minutes3 = normalizedInput.minute || 0, seconds3 = normalizedInput.second || 0, milliseconds3 = normalizedInput.millisecond || 0;
this._isValid = isDurationValid2(normalizedInput);
this._milliseconds = +milliseconds3 + seconds3 * 1e3 + minutes3 * 6e4 + hours3 * 1e3 * 60 * 60;
this._days = +days3 + weeks3 * 7;
this._months = +months3 + quarters * 3 + years3 * 12;
this._data = {};
this._locale = getLocale2();
this._bubble();
}
function isDuration2(obj) {
return obj instanceof Duration2;
}
function absRound2(number) {
if (number < 0) {
return Math.round(-1 * number) * -1;
} else {
return Math.round(number);
}
}
function compareArrays2(array1, array2, dontConvert) {
var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i;
for (i = 0; i < len; i++) {
if (toInt2(array1[i]) !== toInt2(array2[i])) {
diffs++;
}
}
return diffs + lengthDiff;
}
function offset2(token3, separator) {
addFormatToken2(token3, 0, 0, function() {
var offset3 = this.utcOffset(), sign3 = "+";
if (offset3 < 0) {
offset3 = -offset3;
sign3 = "-";
}
return sign3 + zeroFill2(~~(offset3 / 60), 2) + separator + zeroFill2(~~offset3 % 60, 2);
});
}
offset2("Z", ":");
offset2("ZZ", "");
addRegexToken2("Z", matchShortOffset2);
addRegexToken2("ZZ", matchShortOffset2);
addParseToken2([
"Z",
"ZZ"
], function(input, array, config) {
config._useUTC = true;
config._tzm = offsetFromString2(matchShortOffset2, input);
});
var chunkOffset2 = /([\+\-]|\d\d)/gi;
function offsetFromString2(matcher, string) {
var matches = (string || "").match(matcher), chunk, parts, minutes3;
if (matches === null) {
return null;
}
chunk = matches[matches.length - 1] || [];
parts = (chunk + "").match(chunkOffset2) || [
"-",
0,
0
];
minutes3 = +(parts[1] * 60) + toInt2(parts[2]);
return minutes3 === 0 ? 0 : parts[0] === "+" ? minutes3 : -minutes3;
}
function cloneWithOffset2(input, model) {
var res, diff3;
if (model._isUTC) {
res = model.clone();
diff3 = (isMoment2(input) || isDate2(input) ? input.valueOf() : createLocal2(input).valueOf()) - res.valueOf();
res._d.setTime(res._d.valueOf() + diff3);
hooks2.updateOffset(res, false);
return res;
} else {
return createLocal2(input).local();
}
}
function getDateOffset2(m) {
return -Math.round(m._d.getTimezoneOffset());
}
hooks2.updateOffset = function() {
};
function getSetOffset2(input, keepLocalTime, keepMinutes) {
var offset3 = this._offset || 0, localAdjust;
if (!this.isValid()) {
return input != null ? this : NaN;
}
if (input != null) {
if (typeof input === "string") {
input = offsetFromString2(matchShortOffset2, input);
if (input === null) {
return this;
}
} else if (Math.abs(input) < 16 && !keepMinutes) {
input = input * 60;
}
if (!this._isUTC && keepLocalTime) {
localAdjust = getDateOffset2(this);
}
this._offset = input;
this._isUTC = true;
if (localAdjust != null) {
this.add(localAdjust, "m");
}
if (offset3 !== input) {
if (!keepLocalTime || this._changeInProgress) {
addSubtract2(this, createDuration2(input - offset3, "m"), 1, false);
} else if (!this._changeInProgress) {
this._changeInProgress = true;
hooks2.updateOffset(this, true);
this._changeInProgress = null;
}
}
return this;
} else {
return this._isUTC ? offset3 : getDateOffset2(this);
}
}
function getSetZone2(input, keepLocalTime) {
if (input != null) {
if (typeof input !== "string") {
input = -input;
}
this.utcOffset(input, keepLocalTime);
return this;
} else {
return -this.utcOffset();
}
}
function setOffsetToUTC2(keepLocalTime) {
return this.utcOffset(0, keepLocalTime);
}
function setOffsetToLocal2(keepLocalTime) {
if (this._isUTC) {
this.utcOffset(0, keepLocalTime);
this._isUTC = false;
if (keepLocalTime) {
this.subtract(getDateOffset2(this), "m");
}
}
return this;
}
function setOffsetToParsedOffset2() {
if (this._tzm != null) {
this.utcOffset(this._tzm, false, true);
} else if (typeof this._i === "string") {
var tZone = offsetFromString2(matchOffset2, this._i);
if (tZone != null) {
this.utcOffset(tZone);
} else {
this.utcOffset(0, true);
}
}
return this;
}
function hasAlignedHourOffset2(input) {
if (!this.isValid()) {
return false;
}
input = input ? createLocal2(input).utcOffset() : 0;
return (this.utcOffset() - input) % 60 === 0;
}
function isDaylightSavingTime2() {
return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset();
}
function isDaylightSavingTimeShifted2() {
if (!isUndefined2(this._isDSTShifted)) {
return this._isDSTShifted;
}
var c = {}, other;
copyConfig2(c, this);
c = prepareConfig2(c);
if (c._a) {
other = c._isUTC ? createUTC2(c._a) : createLocal2(c._a);
this._isDSTShifted = this.isValid() && compareArrays2(c._a, other.toArray()) > 0;
} else {
this._isDSTShifted = false;
}
return this._isDSTShifted;
}
function isLocal2() {
return this.isValid() ? !this._isUTC : false;
}
function isUtcOffset2() {
return this.isValid() ? this._isUTC : false;
}
function isUtc2() {
return this.isValid() ? this._isUTC && this._offset === 0 : false;
}
var aspNetRegex2 = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, isoRegex2 = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
function createDuration2(input, key) {
var duration = input, match = null, sign3, ret, diffRes;
if (isDuration2(input)) {
duration = {
ms: input._milliseconds,
d: input._days,
M: input._months
};
} else if (isNumber2(input) || !isNaN(+input)) {
duration = {};
if (key) {
duration[key] = +input;
} else {
duration.milliseconds = +input;
}
} else if (match = aspNetRegex2.exec(input)) {
sign3 = match[1] === "-" ? -1 : 1;
duration = {
y: 0,
d: toInt2(match[DATE2]) * sign3,
h: toInt2(match[HOUR2]) * sign3,
m: toInt2(match[MINUTE2]) * sign3,
s: toInt2(match[SECOND2]) * sign3,
ms: toInt2(absRound2(match[MILLISECOND2] * 1e3)) * sign3
};
} else if (match = isoRegex2.exec(input)) {
sign3 = match[1] === "-" ? -1 : 1;
duration = {
y: parseIso2(match[2], sign3),
M: parseIso2(match[3], sign3),
w: parseIso2(match[4], sign3),
d: parseIso2(match[5], sign3),
h: parseIso2(match[6], sign3),
m: parseIso2(match[7], sign3),
s: parseIso2(match[8], sign3)
};
} else if (duration == null) {
duration = {};
} else if (typeof duration === "object" && ("from" in duration || "to" in duration)) {
diffRes = momentsDifference2(createLocal2(duration.from), createLocal2(duration.to));
duration = {};
duration.ms = diffRes.milliseconds;
duration.M = diffRes.months;
}
ret = new Duration2(duration);
if (isDuration2(input) && hasOwnProp2(input, "_locale")) {
ret._locale = input._locale;
}
if (isDuration2(input) && hasOwnProp2(input, "_isValid")) {
ret._isValid = input._isValid;
}
return ret;
}
createDuration2.fn = Duration2.prototype;
createDuration2.invalid = createInvalid$12;
function parseIso2(inp, sign3) {
var res = inp && parseFloat(inp.replace(",", "."));
return (isNaN(res) ? 0 : res) * sign3;
}
function positiveMomentsDifference2(base, other) {
var res = {};
res.months = other.month() - base.month() + (other.year() - base.year()) * 12;
if (base.clone().add(res.months, "M").isAfter(other)) {
--res.months;
}
res.milliseconds = +other - +base.clone().add(res.months, "M");
return res;
}
function momentsDifference2(base, other) {
var res;
if (!(base.isValid() && other.isValid())) {
return {
milliseconds: 0,
months: 0
};
}
other = cloneWithOffset2(other, base);
if (base.isBefore(other)) {
res = positiveMomentsDifference2(base, other);
} else {
res = positiveMomentsDifference2(other, base);
res.milliseconds = -res.milliseconds;
res.months = -res.months;
}
return res;
}
function createAdder2(direction, name) {
return function(val, period) {
var dur, tmp;
if (period !== null && !isNaN(+period)) {
deprecateSimple2(name, "moment()." + name + "(period, number) is deprecated. Please use moment()." + name + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.");
tmp = val;
val = period;
period = tmp;
}
dur = createDuration2(val, period);
addSubtract2(this, dur, direction);
return this;
};
}
function addSubtract2(mom, duration, isAdding, updateOffset) {
var milliseconds3 = duration._milliseconds, days3 = absRound2(duration._days), months3 = absRound2(duration._months);
if (!mom.isValid()) {
return;
}
updateOffset = updateOffset == null ? true : updateOffset;
if (months3) {
setMonth2(mom, get2(mom, "Month") + months3 * isAdding);
}
if (days3) {
set$12(mom, "Date", get2(mom, "Date") + days3 * isAdding);
}
if (milliseconds3) {
mom._d.setTime(mom._d.valueOf() + milliseconds3 * isAdding);
}
if (updateOffset) {
hooks2.updateOffset(mom, days3 || months3);
}
}
var add2 = createAdder2(1, "add"), subtract2 = createAdder2(-1, "subtract");
function isString2(input) {
return typeof input === "string" || input instanceof String;
}
function isMomentInput2(input) {
return isMoment2(input) || isDate2(input) || isString2(input) || isNumber2(input) || isNumberOrStringArray2(input) || isMomentInputObject2(input) || input === null || input === void 0;
}
function isMomentInputObject2(input) {
var objectTest = isObject2(input) && !isObjectEmpty2(input), propertyTest = false, properties = [
"years",
"year",
"y",
"months",
"month",
"M",
"days",
"day",
"d",
"dates",
"date",
"D",
"hours",
"hour",
"h",
"minutes",
"minute",
"m",
"seconds",
"second",
"s",
"milliseconds",
"millisecond",
"ms"
], i, property, propertyLen = properties.length;
for (i = 0; i < propertyLen; i += 1) {
property = properties[i];
propertyTest = propertyTest || hasOwnProp2(input, property);
}
return objectTest && propertyTest;
}
function isNumberOrStringArray2(input) {
var arrayTest = isArray2(input), dataTypeTest = false;
if (arrayTest) {
dataTypeTest = input.filter(function(item) {
return !isNumber2(item) && isString2(input);
}).length === 0;
}
return arrayTest && dataTypeTest;
}
function isCalendarSpec2(input) {
var objectTest = isObject2(input) && !isObjectEmpty2(input), propertyTest = false, properties = [
"sameDay",
"nextDay",
"lastDay",
"nextWeek",
"lastWeek",
"sameElse"
], i, property;
for (i = 0; i < properties.length; i += 1) {
property = properties[i];
propertyTest = propertyTest || hasOwnProp2(input, property);
}
return objectTest && propertyTest;
}
function getCalendarFormat2(myMoment, now3) {
var diff3 = myMoment.diff(now3, "days", true);
return diff3 < -6 ? "sameElse" : diff3 < -1 ? "lastWeek" : diff3 < 0 ? "lastDay" : diff3 < 1 ? "sameDay" : diff3 < 2 ? "nextDay" : diff3 < 7 ? "nextWeek" : "sameElse";
}
function calendar$12(time, formats) {
if (arguments.length === 1) {
if (!arguments[0]) {
time = void 0;
formats = void 0;
} else if (isMomentInput2(arguments[0])) {
time = arguments[0];
formats = void 0;
} else if (isCalendarSpec2(arguments[0])) {
formats = arguments[0];
time = void 0;
}
}
var now3 = time || createLocal2(), sod = cloneWithOffset2(now3, this).startOf("day"), format3 = hooks2.calendarFormat(this, sod) || "sameElse", output = formats && (isFunction2(formats[format3]) ? formats[format3].call(this, now3) : formats[format3]);
return this.format(output || this.localeData().calendar(format3, this, createLocal2(now3)));
}
function clone2() {
return new Moment2(this);
}
function isAfter2(input, units) {
var localInput = isMoment2(input) ? input : createLocal2(input);
if (!(this.isValid() && localInput.isValid())) {
return false;
}
units = normalizeUnits2(units) || "millisecond";
if (units === "millisecond") {
return this.valueOf() > localInput.valueOf();
} else {
return localInput.valueOf() < this.clone().startOf(units).valueOf();
}
}
function isBefore2(input, units) {
var localInput = isMoment2(input) ? input : createLocal2(input);
if (!(this.isValid() && localInput.isValid())) {
return false;
}
units = normalizeUnits2(units) || "millisecond";
if (units === "millisecond") {
return this.valueOf() < localInput.valueOf();
} else {
return this.clone().endOf(units).valueOf() < localInput.valueOf();
}
}
function isBetween2(from3, to3, units, inclusivity) {
var localFrom = isMoment2(from3) ? from3 : createLocal2(from3), localTo = isMoment2(to3) ? to3 : createLocal2(to3);
if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
return false;
}
inclusivity = inclusivity || "()";
return (inclusivity[0] === "(" ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) && (inclusivity[1] === ")" ? this.isBefore(localTo, units) : !this.isAfter(localTo, units));
}
function isSame2(input, units) {
var localInput = isMoment2(input) ? input : createLocal2(input), inputMs;
if (!(this.isValid() && localInput.isValid())) {
return false;
}
units = normalizeUnits2(units) || "millisecond";
if (units === "millisecond") {
return this.valueOf() === localInput.valueOf();
} else {
inputMs = localInput.valueOf();
return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
}
}
function isSameOrAfter2(input, units) {
return this.isSame(input, units) || this.isAfter(input, units);
}
function isSameOrBefore2(input, units) {
return this.isSame(input, units) || this.isBefore(input, units);
}
function diff2(input, units, asFloat) {
var that, zoneDelta, output;
if (!this.isValid()) {
return NaN;
}
that = cloneWithOffset2(input, this);
if (!that.isValid()) {
return NaN;
}
zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
units = normalizeUnits2(units);
switch (units) {
case "year":
output = monthDiff2(this, that) / 12;
break;
case "month":
output = monthDiff2(this, that);
break;
case "quarter":
output = monthDiff2(this, that) / 3;
break;
case "second":
output = (this - that) / 1e3;
break;
case "minute":
output = (this - that) / 6e4;
break;
case "hour":
output = (this - that) / 36e5;
break;
case "day":
output = (this - that - zoneDelta) / 864e5;
break;
case "week":
output = (this - that - zoneDelta) / 6048e5;
break;
default:
output = this - that;
}
return asFloat ? output : absFloor2(output);
}
function monthDiff2(a, b) {
if (a.date() < b.date()) {
return -monthDiff2(b, a);
}
var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), anchor = a.clone().add(wholeMonthDiff, "months"), anchor2, adjust;
if (b - anchor < 0) {
anchor2 = a.clone().add(wholeMonthDiff - 1, "months");
adjust = (b - anchor) / (anchor - anchor2);
} else {
anchor2 = a.clone().add(wholeMonthDiff + 1, "months");
adjust = (b - anchor) / (anchor2 - anchor);
}
return -(wholeMonthDiff + adjust) || 0;
}
hooks2.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ";
hooks2.defaultFormatUtc = "YYYY-MM-DDTHH:mm:ss[Z]";
function toString2() {
return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ");
}
function toISOString2(keepOffset) {
if (!this.isValid()) {
return null;
}
var utc = keepOffset !== true, m = utc ? this.clone().utc() : this;
if (m.year() < 0 || m.year() > 9999) {
return formatMoment2(m, utc ? "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYYYY-MM-DD[T]HH:mm:ss.SSSZ");
}
if (isFunction2(Date.prototype.toISOString)) {
if (utc) {
return this.toDate().toISOString();
} else {
return new Date(this.valueOf() + this.utcOffset() * 60 * 1e3).toISOString().replace("Z", formatMoment2(m, "Z"));
}
}
return formatMoment2(m, utc ? "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYY-MM-DD[T]HH:mm:ss.SSSZ");
}
function inspect2() {
if (!this.isValid()) {
return "moment.invalid(/* " + this._i + " */)";
}
var func = "moment", zone = "", prefix, year, datetime, suffix;
if (!this.isLocal()) {
func = this.utcOffset() === 0 ? "moment.utc" : "moment.parseZone";
zone = "Z";
}
prefix = "[" + func + '("]';
year = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY";
datetime = "-MM-DD[T]HH:mm:ss.SSS";
suffix = zone + '[")]';
return this.format(prefix + year + datetime + suffix);
}
function format2(inputString) {
if (!inputString) {
inputString = this.isUtc() ? hooks2.defaultFormatUtc : hooks2.defaultFormat;
}
var output = formatMoment2(this, inputString);
return this.localeData().postformat(output);
}
function from2(time, withoutSuffix) {
if (this.isValid() && (isMoment2(time) && time.isValid() || createLocal2(time).isValid())) {
return createDuration2({
to: this,
from: time
}).locale(this.locale()).humanize(!withoutSuffix);
} else {
return this.localeData().invalidDate();
}
}
function fromNow2(withoutSuffix) {
return this.from(createLocal2(), withoutSuffix);
}
function to2(time, withoutSuffix) {
if (this.isValid() && (isMoment2(time) && time.isValid() || createLocal2(time).isValid())) {
return createDuration2({
from: this,
to: time
}).locale(this.locale()).humanize(!withoutSuffix);
} else {
return this.localeData().invalidDate();
}
}
function toNow2(withoutSuffix) {
return this.to(createLocal2(), withoutSuffix);
}
function locale2(key) {
var newLocaleData;
if (key === void 0) {
return this._locale._abbr;
} else {
newLocaleData = getLocale2(key);
if (newLocaleData != null) {
this._locale = newLocaleData;
}
return this;
}
}
var lang2 = deprecate2("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.", function(key) {
if (key === void 0) {
return this.localeData();
} else {
return this.locale(key);
}
});
function localeData2() {
return this._locale;
}
var MS_PER_SECOND2 = 1e3, MS_PER_MINUTE2 = 60 * MS_PER_SECOND2, MS_PER_HOUR2 = 60 * MS_PER_MINUTE2, MS_PER_400_YEARS2 = (365 * 400 + 97) * 24 * MS_PER_HOUR2;
function mod$12(dividend, divisor) {
return (dividend % divisor + divisor) % divisor;
}
function localStartOfDate2(y, m, d) {
if (y < 100 && y >= 0) {
return new Date(y + 400, m, d) - MS_PER_400_YEARS2;
} else {
return new Date(y, m, d).valueOf();
}
}
function utcStartOfDate2(y, m, d) {
if (y < 100 && y >= 0) {
return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS2;
} else {
return Date.UTC(y, m, d);
}
}
function startOf2(units) {
var time, startOfDate;
units = normalizeUnits2(units);
if (units === void 0 || units === "millisecond" || !this.isValid()) {
return this;
}
startOfDate = this._isUTC ? utcStartOfDate2 : localStartOfDate2;
switch (units) {
case "year":
time = startOfDate(this.year(), 0, 1);
break;
case "quarter":
time = startOfDate(this.year(), this.month() - this.month() % 3, 1);
break;
case "month":
time = startOfDate(this.year(), this.month(), 1);
break;
case "week":
time = startOfDate(this.year(), this.month(), this.date() - this.weekday());
break;
case "isoWeek":
time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1));
break;
case "day":
case "date":
time = startOfDate(this.year(), this.month(), this.date());
break;
case "hour":
time = this._d.valueOf();
time -= mod$12(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE2), MS_PER_HOUR2);
break;
case "minute":
time = this._d.valueOf();
time -= mod$12(time, MS_PER_MINUTE2);
break;
case "second":
time = this._d.valueOf();
time -= mod$12(time, MS_PER_SECOND2);
break;
}
this._d.setTime(time);
hooks2.updateOffset(this, true);
return this;
}
function endOf2(units) {
var time, startOfDate;
units = normalizeUnits2(units);
if (units === void 0 || units === "millisecond" || !this.isValid()) {
return this;
}
startOfDate = this._isUTC ? utcStartOfDate2 : localStartOfDate2;
switch (units) {
case "year":
time = startOfDate(this.year() + 1, 0, 1) - 1;
break;
case "quarter":
time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1;
break;
case "month":
time = startOfDate(this.year(), this.month() + 1, 1) - 1;
break;
case "week":
time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1;
break;
case "isoWeek":
time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1;
break;
case "day":
case "date":
time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
break;
case "hour":
time = this._d.valueOf();
time += MS_PER_HOUR2 - mod$12(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE2), MS_PER_HOUR2) - 1;
break;
case "minute":
time = this._d.valueOf();
time += MS_PER_MINUTE2 - mod$12(time, MS_PER_MINUTE2) - 1;
break;
case "second":
time = this._d.valueOf();
time += MS_PER_SECOND2 - mod$12(time, MS_PER_SECOND2) - 1;
break;
}
this._d.setTime(time);
hooks2.updateOffset(this, true);
return this;
}
function valueOf2() {
return this._d.valueOf() - (this._offset || 0) * 6e4;
}
function unix2() {
return Math.floor(this.valueOf() / 1e3);
}
function toDate2() {
return new Date(this.valueOf());
}
function toArray2() {
var m = this;
return [
m.year(),
m.month(),
m.date(),
m.hour(),
m.minute(),
m.second(),
m.millisecond()
];
}
function toObject2() {
var m = this;
return {
years: m.year(),
months: m.month(),
date: m.date(),
hours: m.hours(),
minutes: m.minutes(),
seconds: m.seconds(),
milliseconds: m.milliseconds()
};
}
function toJSON2() {
return this.isValid() ? this.toISOString() : null;
}
function isValid$22() {
return isValid2(this);
}
function parsingFlags2() {
return extend2({}, getParsingFlags2(this));
}
function invalidAt2() {
return getParsingFlags2(this).overflow;
}
function creationData2() {
return {
input: this._i,
format: this._f,
locale: this._locale,
isUTC: this._isUTC,
strict: this._strict
};
}
addFormatToken2("N", 0, 0, "eraAbbr");
addFormatToken2("NN", 0, 0, "eraAbbr");
addFormatToken2("NNN", 0, 0, "eraAbbr");
addFormatToken2("NNNN", 0, 0, "eraName");
addFormatToken2("NNNNN", 0, 0, "eraNarrow");
addFormatToken2("y", [
"y",
1
], "yo", "eraYear");
addFormatToken2("y", [
"yy",
2
], 0, "eraYear");
addFormatToken2("y", [
"yyy",
3
], 0, "eraYear");
addFormatToken2("y", [
"yyyy",
4
], 0, "eraYear");
addRegexToken2("N", matchEraAbbr2);
addRegexToken2("NN", matchEraAbbr2);
addRegexToken2("NNN", matchEraAbbr2);
addRegexToken2("NNNN", matchEraName2);
addRegexToken2("NNNNN", matchEraNarrow2);
addParseToken2([
"N",
"NN",
"NNN",
"NNNN",
"NNNNN"
], function(input, array, config, token3) {
var era = config._locale.erasParse(input, token3, config._strict);
if (era) {
getParsingFlags2(config).era = era;
} else {
getParsingFlags2(config).invalidEra = input;
}
});
addRegexToken2("y", matchUnsigned2);
addRegexToken2("yy", matchUnsigned2);
addRegexToken2("yyy", matchUnsigned2);
addRegexToken2("yyyy", matchUnsigned2);
addRegexToken2("yo", matchEraYearOrdinal2);
addParseToken2([
"y",
"yy",
"yyy",
"yyyy"
], YEAR2);
addParseToken2([
"yo"
], function(input, array, config, token3) {
var match;
if (config._locale._eraYearOrdinalRegex) {
match = input.match(config._locale._eraYearOrdinalRegex);
}
if (config._locale.eraYearOrdinalParse) {
array[YEAR2] = config._locale.eraYearOrdinalParse(input, match);
} else {
array[YEAR2] = parseInt(input, 10);
}
});
function localeEras2(m, format3) {
var i, l, date, eras = this._eras || getLocale2("en")._eras;
for (i = 0, l = eras.length; i < l; ++i) {
switch (typeof eras[i].since) {
case "string":
date = hooks2(eras[i].since).startOf("day");
eras[i].since = date.valueOf();
break;
}
switch (typeof eras[i].until) {
case "undefined":
eras[i].until = Infinity;
break;
case "string":
date = hooks2(eras[i].until).startOf("day").valueOf();
eras[i].until = date.valueOf();
break;
}
}
return eras;
}
function localeErasParse2(eraName, format3, strict) {
var i, l, eras = this.eras(), name, abbr, narrow;
eraName = eraName.toUpperCase();
for (i = 0, l = eras.length; i < l; ++i) {
name = eras[i].name.toUpperCase();
abbr = eras[i].abbr.toUpperCase();
narrow = eras[i].narrow.toUpperCase();
if (strict) {
switch (format3) {
case "N":
case "NN":
case "NNN":
if (abbr === eraName) {
return eras[i];
}
break;
case "NNNN":
if (name === eraName) {
return eras[i];
}
break;
case "NNNNN":
if (narrow === eraName) {
return eras[i];
}
break;
}
} else if ([
name,
abbr,
narrow
].indexOf(eraName) >= 0) {
return eras[i];
}
}
}
function localeErasConvertYear2(era, year) {
var dir = era.since <= era.until ? 1 : -1;
if (year === void 0) {
return hooks2(era.since).year();
} else {
return hooks2(era.since).year() + (year - era.offset) * dir;
}
}
function getEraName2() {
var i, l, val, eras = this.localeData().eras();
for (i = 0, l = eras.length; i < l; ++i) {
val = this.clone().startOf("day").valueOf();
if (eras[i].since <= val && val <= eras[i].until) {
return eras[i].name;
}
if (eras[i].until <= val && val <= eras[i].since) {
return eras[i].name;
}
}
return "";
}
function getEraNarrow2() {
var i, l, val, eras = this.localeData().eras();
for (i = 0, l = eras.length; i < l; ++i) {
val = this.clone().startOf("day").valueOf();
if (eras[i].since <= val && val <= eras[i].until) {
return eras[i].narrow;
}
if (eras[i].until <= val && val <= eras[i].since) {
return eras[i].narrow;
}
}
return "";
}
function getEraAbbr2() {
var i, l, val, eras = this.localeData().eras();
for (i = 0, l = eras.length; i < l; ++i) {
val = this.clone().startOf("day").valueOf();
if (eras[i].since <= val && val <= eras[i].until) {
return eras[i].abbr;
}
if (eras[i].until <= val && val <= eras[i].since) {
return eras[i].abbr;
}
}
return "";
}
function getEraYear2() {
var i, l, dir, val, eras = this.localeData().eras();
for (i = 0, l = eras.length; i < l; ++i) {
dir = eras[i].since <= eras[i].until ? 1 : -1;
val = this.clone().startOf("day").valueOf();
if (eras[i].since <= val && val <= eras[i].until || eras[i].until <= val && val <= eras[i].since) {
return (this.year() - hooks2(eras[i].since).year()) * dir + eras[i].offset;
}
}
return this.year();
}
function erasNameRegex2(isStrict) {
if (!hasOwnProp2(this, "_erasNameRegex")) {
computeErasParse2.call(this);
}
return isStrict ? this._erasNameRegex : this._erasRegex;
}
function erasAbbrRegex2(isStrict) {
if (!hasOwnProp2(this, "_erasAbbrRegex")) {
computeErasParse2.call(this);
}
return isStrict ? this._erasAbbrRegex : this._erasRegex;
}
function erasNarrowRegex2(isStrict) {
if (!hasOwnProp2(this, "_erasNarrowRegex")) {
computeErasParse2.call(this);
}
return isStrict ? this._erasNarrowRegex : this._erasRegex;
}
function matchEraAbbr2(isStrict, locale3) {
return locale3.erasAbbrRegex(isStrict);
}
function matchEraName2(isStrict, locale3) {
return locale3.erasNameRegex(isStrict);
}
function matchEraNarrow2(isStrict, locale3) {
return locale3.erasNarrowRegex(isStrict);
}
function matchEraYearOrdinal2(isStrict, locale3) {
return locale3._eraYearOrdinalRegex || matchUnsigned2;
}
function computeErasParse2() {
var abbrPieces = [], namePieces = [], narrowPieces = [], mixedPieces = [], i, l, erasName, erasAbbr, erasNarrow, eras = this.eras();
for (i = 0, l = eras.length; i < l; ++i) {
erasName = regexEscape2(eras[i].name);
erasAbbr = regexEscape2(eras[i].abbr);
erasNarrow = regexEscape2(eras[i].narrow);
namePieces.push(erasName);
abbrPieces.push(erasAbbr);
narrowPieces.push(erasNarrow);
mixedPieces.push(erasName);
mixedPieces.push(erasAbbr);
mixedPieces.push(erasNarrow);
}
this._erasRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
this._erasNameRegex = new RegExp("^(" + namePieces.join("|") + ")", "i");
this._erasAbbrRegex = new RegExp("^(" + abbrPieces.join("|") + ")", "i");
this._erasNarrowRegex = new RegExp("^(" + narrowPieces.join("|") + ")", "i");
}
addFormatToken2(0, [
"gg",
2
], 0, function() {
return this.weekYear() % 100;
});
addFormatToken2(0, [
"GG",
2
], 0, function() {
return this.isoWeekYear() % 100;
});
function addWeekYearFormatToken2(token3, getter) {
addFormatToken2(0, [
token3,
token3.length
], 0, getter);
}
addWeekYearFormatToken2("gggg", "weekYear");
addWeekYearFormatToken2("ggggg", "weekYear");
addWeekYearFormatToken2("GGGG", "isoWeekYear");
addWeekYearFormatToken2("GGGGG", "isoWeekYear");
addRegexToken2("G", matchSigned2);
addRegexToken2("g", matchSigned2);
addRegexToken2("GG", match1to22, match22);
addRegexToken2("gg", match1to22, match22);
addRegexToken2("GGGG", match1to42, match42);
addRegexToken2("gggg", match1to42, match42);
addRegexToken2("GGGGG", match1to62, match62);
addRegexToken2("ggggg", match1to62, match62);
addWeekParseToken2([
"gggg",
"ggggg",
"GGGG",
"GGGGG"
], function(input, week, config, token3) {
week[token3.substr(0, 2)] = toInt2(input);
});
addWeekParseToken2([
"gg",
"GG"
], function(input, week, config, token3) {
week[token3] = hooks2.parseTwoDigitYear(input);
});
function getSetWeekYear2(input) {
return getSetWeekYearHelper2.call(this, input, this.week(), this.weekday() + this.localeData()._week.dow, this.localeData()._week.dow, this.localeData()._week.doy);
}
function getSetISOWeekYear2(input) {
return getSetWeekYearHelper2.call(this, input, this.isoWeek(), this.isoWeekday(), 1, 4);
}
function getISOWeeksInYear2() {
return weeksInYear2(this.year(), 1, 4);
}
function getISOWeeksInISOWeekYear2() {
return weeksInYear2(this.isoWeekYear(), 1, 4);
}
function getWeeksInYear2() {
var weekInfo = this.localeData()._week;
return weeksInYear2(this.year(), weekInfo.dow, weekInfo.doy);
}
function getWeeksInWeekYear2() {
var weekInfo = this.localeData()._week;
return weeksInYear2(this.weekYear(), weekInfo.dow, weekInfo.doy);
}
function getSetWeekYearHelper2(input, week, weekday, dow, doy) {
var weeksTarget;
if (input == null) {
return weekOfYear2(this, dow, doy).year;
} else {
weeksTarget = weeksInYear2(input, dow, doy);
if (week > weeksTarget) {
week = weeksTarget;
}
return setWeekAll2.call(this, input, week, weekday, dow, doy);
}
}
function setWeekAll2(weekYear, week, weekday, dow, doy) {
var dayOfYearData = dayOfYearFromWeeks2(weekYear, week, weekday, dow, doy), date = createUTCDate2(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
this.year(date.getUTCFullYear());
this.month(date.getUTCMonth());
this.date(date.getUTCDate());
return this;
}
addFormatToken2("Q", 0, "Qo", "quarter");
addRegexToken2("Q", match12);
addParseToken2("Q", function(input, array) {
array[MONTH2] = (toInt2(input) - 1) * 3;
});
function getSetQuarter2(input) {
return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
}
addFormatToken2("D", [
"DD",
2
], "Do", "date");
addRegexToken2("D", match1to22, match1to2NoLeadingZero2);
addRegexToken2("DD", match1to22, match22);
addRegexToken2("Do", function(isStrict, locale3) {
return isStrict ? locale3._dayOfMonthOrdinalParse || locale3._ordinalParse : locale3._dayOfMonthOrdinalParseLenient;
});
addParseToken2([
"D",
"DD"
], DATE2);
addParseToken2("Do", function(input, array) {
array[DATE2] = toInt2(input.match(match1to22)[0]);
});
var getSetDayOfMonth2 = makeGetSet2("Date", true);
addFormatToken2("DDD", [
"DDDD",
3
], "DDDo", "dayOfYear");
addRegexToken2("DDD", match1to32);
addRegexToken2("DDDD", match32);
addParseToken2([
"DDD",
"DDDD"
], function(input, array, config) {
config._dayOfYear = toInt2(input);
});
function getSetDayOfYear2(input) {
var dayOfYear = Math.round((this.clone().startOf("day") - this.clone().startOf("year")) / 864e5) + 1;
return input == null ? dayOfYear : this.add(input - dayOfYear, "d");
}
addFormatToken2("m", [
"mm",
2
], 0, "minute");
addRegexToken2("m", match1to22, match1to2HasZero2);
addRegexToken2("mm", match1to22, match22);
addParseToken2([
"m",
"mm"
], MINUTE2);
var getSetMinute2 = makeGetSet2("Minutes", false);
addFormatToken2("s", [
"ss",
2
], 0, "second");
addRegexToken2("s", match1to22, match1to2HasZero2);
addRegexToken2("ss", match1to22, match22);
addParseToken2([
"s",
"ss"
], SECOND2);
var getSetSecond2 = makeGetSet2("Seconds", false);
addFormatToken2("S", 0, 0, function() {
return ~~(this.millisecond() / 100);
});
addFormatToken2(0, [
"SS",
2
], 0, function() {
return ~~(this.millisecond() / 10);
});
addFormatToken2(0, [
"SSS",
3
], 0, "millisecond");
addFormatToken2(0, [
"SSSS",
4
], 0, function() {
return this.millisecond() * 10;
});
addFormatToken2(0, [
"SSSSS",
5
], 0, function() {
return this.millisecond() * 100;
});
addFormatToken2(0, [
"SSSSSS",
6
], 0, function() {
return this.millisecond() * 1e3;
});
addFormatToken2(0, [
"SSSSSSS",
7
], 0, function() {
return this.millisecond() * 1e4;
});
addFormatToken2(0, [
"SSSSSSSS",
8
], 0, function() {
return this.millisecond() * 1e5;
});
addFormatToken2(0, [
"SSSSSSSSS",
9
], 0, function() {
return this.millisecond() * 1e6;
});
addRegexToken2("S", match1to32, match12);
addRegexToken2("SS", match1to32, match22);
addRegexToken2("SSS", match1to32, match32);
var token2, getSetMillisecond2;
for (token2 = "SSSS"; token2.length <= 9; token2 += "S") {
addRegexToken2(token2, matchUnsigned2);
}
function parseMs2(input, array) {
array[MILLISECOND2] = toInt2(("0." + input) * 1e3);
}
for (token2 = "S"; token2.length <= 9; token2 += "S") {
addParseToken2(token2, parseMs2);
}
getSetMillisecond2 = makeGetSet2("Milliseconds", false);
addFormatToken2("z", 0, 0, "zoneAbbr");
addFormatToken2("zz", 0, 0, "zoneName");
function getZoneAbbr2() {
return this._isUTC ? "UTC" : "";
}
function getZoneName2() {
return this._isUTC ? "Coordinated Universal Time" : "";
}
var proto2 = Moment2.prototype;
proto2.add = add2;
proto2.calendar = calendar$12;
proto2.clone = clone2;
proto2.diff = diff2;
proto2.endOf = endOf2;
proto2.format = format2;
proto2.from = from2;
proto2.fromNow = fromNow2;
proto2.to = to2;
proto2.toNow = toNow2;
proto2.get = stringGet2;
proto2.invalidAt = invalidAt2;
proto2.isAfter = isAfter2;
proto2.isBefore = isBefore2;
proto2.isBetween = isBetween2;
proto2.isSame = isSame2;
proto2.isSameOrAfter = isSameOrAfter2;
proto2.isSameOrBefore = isSameOrBefore2;
proto2.isValid = isValid$22;
proto2.lang = lang2;
proto2.locale = locale2;
proto2.localeData = localeData2;
proto2.max = prototypeMax2;
proto2.min = prototypeMin2;
proto2.parsingFlags = parsingFlags2;
proto2.set = stringSet2;
proto2.startOf = startOf2;
proto2.subtract = subtract2;
proto2.toArray = toArray2;
proto2.toObject = toObject2;
proto2.toDate = toDate2;
proto2.toISOString = toISOString2;
proto2.inspect = inspect2;
if (typeof Symbol !== "undefined" && Symbol.for != null) {
proto2[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = function() {
return "Moment<" + this.format() + ">";
};
}
proto2.toJSON = toJSON2;
proto2.toString = toString2;
proto2.unix = unix2;
proto2.valueOf = valueOf2;
proto2.creationData = creationData2;
proto2.eraName = getEraName2;
proto2.eraNarrow = getEraNarrow2;
proto2.eraAbbr = getEraAbbr2;
proto2.eraYear = getEraYear2;
proto2.year = getSetYear2;
proto2.isLeapYear = getIsLeapYear2;
proto2.weekYear = getSetWeekYear2;
proto2.isoWeekYear = getSetISOWeekYear2;
proto2.quarter = proto2.quarters = getSetQuarter2;
proto2.month = getSetMonth2;
proto2.daysInMonth = getDaysInMonth2;
proto2.week = proto2.weeks = getSetWeek2;
proto2.isoWeek = proto2.isoWeeks = getSetISOWeek2;
proto2.weeksInYear = getWeeksInYear2;
proto2.weeksInWeekYear = getWeeksInWeekYear2;
proto2.isoWeeksInYear = getISOWeeksInYear2;
proto2.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear2;
proto2.date = getSetDayOfMonth2;
proto2.day = proto2.days = getSetDayOfWeek2;
proto2.weekday = getSetLocaleDayOfWeek2;
proto2.isoWeekday = getSetISODayOfWeek2;
proto2.dayOfYear = getSetDayOfYear2;
proto2.hour = proto2.hours = getSetHour2;
proto2.minute = proto2.minutes = getSetMinute2;
proto2.second = proto2.seconds = getSetSecond2;
proto2.millisecond = proto2.milliseconds = getSetMillisecond2;
proto2.utcOffset = getSetOffset2;
proto2.utc = setOffsetToUTC2;
proto2.local = setOffsetToLocal2;
proto2.parseZone = setOffsetToParsedOffset2;
proto2.hasAlignedHourOffset = hasAlignedHourOffset2;
proto2.isDST = isDaylightSavingTime2;
proto2.isLocal = isLocal2;
proto2.isUtcOffset = isUtcOffset2;
proto2.isUtc = isUtc2;
proto2.isUTC = isUtc2;
proto2.zoneAbbr = getZoneAbbr2;
proto2.zoneName = getZoneName2;
proto2.dates = deprecate2("dates accessor is deprecated. Use date instead.", getSetDayOfMonth2);
proto2.months = deprecate2("months accessor is deprecated. Use month instead", getSetMonth2);
proto2.years = deprecate2("years accessor is deprecated. Use year instead", getSetYear2);
proto2.zone = deprecate2("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/", getSetZone2);
proto2.isDSTShifted = deprecate2("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information", isDaylightSavingTimeShifted2);
function createUnix2(input) {
return createLocal2(input * 1e3);
}
function createInZone2() {
return createLocal2.apply(null, arguments).parseZone();
}
function preParsePostFormat2(string) {
return string;
}
var proto$12 = Locale2.prototype;
proto$12.calendar = calendar2;
proto$12.longDateFormat = longDateFormat2;
proto$12.invalidDate = invalidDate2;
proto$12.ordinal = ordinal2;
proto$12.preparse = preParsePostFormat2;
proto$12.postformat = preParsePostFormat2;
proto$12.relativeTime = relativeTime2;
proto$12.pastFuture = pastFuture2;
proto$12.set = set2;
proto$12.eras = localeEras2;
proto$12.erasParse = localeErasParse2;
proto$12.erasConvertYear = localeErasConvertYear2;
proto$12.erasAbbrRegex = erasAbbrRegex2;
proto$12.erasNameRegex = erasNameRegex2;
proto$12.erasNarrowRegex = erasNarrowRegex2;
proto$12.months = localeMonths2;
proto$12.monthsShort = localeMonthsShort2;
proto$12.monthsParse = localeMonthsParse2;
proto$12.monthsRegex = monthsRegex2;
proto$12.monthsShortRegex = monthsShortRegex2;
proto$12.week = localeWeek2;
proto$12.firstDayOfYear = localeFirstDayOfYear2;
proto$12.firstDayOfWeek = localeFirstDayOfWeek2;
proto$12.weekdays = localeWeekdays2;
proto$12.weekdaysMin = localeWeekdaysMin2;
proto$12.weekdaysShort = localeWeekdaysShort2;
proto$12.weekdaysParse = localeWeekdaysParse2;
proto$12.weekdaysRegex = weekdaysRegex2;
proto$12.weekdaysShortRegex = weekdaysShortRegex2;
proto$12.weekdaysMinRegex = weekdaysMinRegex2;
proto$12.isPM = localeIsPM2;
proto$12.meridiem = localeMeridiem2;
function get$12(format3, index, field, setter) {
var locale3 = getLocale2(), utc = createUTC2().set(setter, index);
return locale3[field](utc, format3);
}
function listMonthsImpl2(format3, index, field) {
if (isNumber2(format3)) {
index = format3;
format3 = void 0;
}
format3 = format3 || "";
if (index != null) {
return get$12(format3, index, field, "month");
}
var i, out = [];
for (i = 0; i < 12; i++) {
out[i] = get$12(format3, i, field, "month");
}
return out;
}
function listWeekdaysImpl2(localeSorted, format3, index, field) {
if (typeof localeSorted === "boolean") {
if (isNumber2(format3)) {
index = format3;
format3 = void 0;
}
format3 = format3 || "";
} else {
format3 = localeSorted;
index = format3;
localeSorted = false;
if (isNumber2(format3)) {
index = format3;
format3 = void 0;
}
format3 = format3 || "";
}
var locale3 = getLocale2(), shift = localeSorted ? locale3._week.dow : 0, i, out = [];
if (index != null) {
return get$12(format3, (index + shift) % 7, field, "day");
}
for (i = 0; i < 7; i++) {
out[i] = get$12(format3, (i + shift) % 7, field, "day");
}
return out;
}
function listMonths2(format3, index) {
return listMonthsImpl2(format3, index, "months");
}
function listMonthsShort2(format3, index) {
return listMonthsImpl2(format3, index, "monthsShort");
}
function listWeekdays2(localeSorted, format3, index) {
return listWeekdaysImpl2(localeSorted, format3, index, "weekdays");
}
function listWeekdaysShort2(localeSorted, format3, index) {
return listWeekdaysImpl2(localeSorted, format3, index, "weekdaysShort");
}
function listWeekdaysMin2(localeSorted, format3, index) {
return listWeekdaysImpl2(localeSorted, format3, index, "weekdaysMin");
}
getSetGlobalLocale2("en", {
eras: [
{
since: "0001-01-01",
until: Infinity,
offset: 1,
name: "Anno Domini",
narrow: "AD",
abbr: "AD"
},
{
since: "0000-12-31",
until: -Infinity,
offset: 1,
name: "Before Christ",
narrow: "BC",
abbr: "BC"
}
],
dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
ordinal: function(number) {
var b = number % 10, output = toInt2(number % 100 / 10) === 1 ? "th" : b === 1 ? "st" : b === 2 ? "nd" : b === 3 ? "rd" : "th";
return number + output;
}
});
hooks2.lang = deprecate2("moment.lang is deprecated. Use moment.locale instead.", getSetGlobalLocale2);
hooks2.langData = deprecate2("moment.langData is deprecated. Use moment.localeData instead.", getLocale2);
var mathAbs2 = Math.abs;
function abs2() {
var data = this._data;
this._milliseconds = mathAbs2(this._milliseconds);
this._days = mathAbs2(this._days);
this._months = mathAbs2(this._months);
data.milliseconds = mathAbs2(data.milliseconds);
data.seconds = mathAbs2(data.seconds);
data.minutes = mathAbs2(data.minutes);
data.hours = mathAbs2(data.hours);
data.months = mathAbs2(data.months);
data.years = mathAbs2(data.years);
return this;
}
function addSubtract$12(duration, input, value, direction) {
var other = createDuration2(input, value);
duration._milliseconds += direction * other._milliseconds;
duration._days += direction * other._days;
duration._months += direction * other._months;
return duration._bubble();
}
function add$12(input, value) {
return addSubtract$12(this, input, value, 1);
}
function subtract$12(input, value) {
return addSubtract$12(this, input, value, -1);
}
function absCeil2(number) {
if (number < 0) {
return Math.floor(number);
} else {
return Math.ceil(number);
}
}
function bubble2() {
var milliseconds3 = this._milliseconds, days3 = this._days, months3 = this._months, data = this._data, seconds3, minutes3, hours3, years3, monthsFromDays;
if (!(milliseconds3 >= 0 && days3 >= 0 && months3 >= 0 || milliseconds3 <= 0 && days3 <= 0 && months3 <= 0)) {
milliseconds3 += absCeil2(monthsToDays2(months3) + days3) * 864e5;
days3 = 0;
months3 = 0;
}
data.milliseconds = milliseconds3 % 1e3;
seconds3 = absFloor2(milliseconds3 / 1e3);
data.seconds = seconds3 % 60;
minutes3 = absFloor2(seconds3 / 60);
data.minutes = minutes3 % 60;
hours3 = absFloor2(minutes3 / 60);
data.hours = hours3 % 24;
days3 += absFloor2(hours3 / 24);
monthsFromDays = absFloor2(daysToMonths2(days3));
months3 += monthsFromDays;
days3 -= absCeil2(monthsToDays2(monthsFromDays));
years3 = absFloor2(months3 / 12);
months3 %= 12;
data.days = days3;
data.months = months3;
data.years = years3;
return this;
}
function daysToMonths2(days3) {
return days3 * 4800 / 146097;
}
function monthsToDays2(months3) {
return months3 * 146097 / 4800;
}
function as2(units) {
if (!this.isValid()) {
return NaN;
}
var days3, months3, milliseconds3 = this._milliseconds;
units = normalizeUnits2(units);
if (units === "month" || units === "quarter" || units === "year") {
days3 = this._days + milliseconds3 / 864e5;
months3 = this._months + daysToMonths2(days3);
switch (units) {
case "month":
return months3;
case "quarter":
return months3 / 3;
case "year":
return months3 / 12;
}
} else {
days3 = this._days + Math.round(monthsToDays2(this._months));
switch (units) {
case "week":
return days3 / 7 + milliseconds3 / 6048e5;
case "day":
return days3 + milliseconds3 / 864e5;
case "hour":
return days3 * 24 + milliseconds3 / 36e5;
case "minute":
return days3 * 1440 + milliseconds3 / 6e4;
case "second":
return days3 * 86400 + milliseconds3 / 1e3;
case "millisecond":
return Math.floor(days3 * 864e5) + milliseconds3;
default:
throw new Error("Unknown unit " + units);
}
}
}
function makeAs2(alias) {
return function() {
return this.as(alias);
};
}
var asMilliseconds2 = makeAs2("ms"), asSeconds2 = makeAs2("s"), asMinutes2 = makeAs2("m"), asHours2 = makeAs2("h"), asDays2 = makeAs2("d"), asWeeks2 = makeAs2("w"), asMonths2 = makeAs2("M"), asQuarters2 = makeAs2("Q"), asYears2 = makeAs2("y"), valueOf$12 = asMilliseconds2;
function clone$12() {
return createDuration2(this);
}
function get$22(units) {
units = normalizeUnits2(units);
return this.isValid() ? this[units + "s"]() : NaN;
}
function makeGetter2(name) {
return function() {
return this.isValid() ? this._data[name] : NaN;
};
}
var milliseconds2 = makeGetter2("milliseconds"), seconds2 = makeGetter2("seconds"), minutes2 = makeGetter2("minutes"), hours2 = makeGetter2("hours"), days2 = makeGetter2("days"), months2 = makeGetter2("months"), years2 = makeGetter2("years");
function weeks2() {
return absFloor2(this.days() / 7);
}
var round2 = Math.round, thresholds2 = {
ss: 44,
s: 45,
m: 45,
h: 22,
d: 26,
w: null,
M: 11
};
function substituteTimeAgo2(string, number, withoutSuffix, isFuture, locale3) {
return locale3.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
}
function relativeTime$12(posNegDuration, withoutSuffix, thresholds3, locale3) {
var duration = createDuration2(posNegDuration).abs(), seconds3 = round2(duration.as("s")), minutes3 = round2(duration.as("m")), hours3 = round2(duration.as("h")), days3 = round2(duration.as("d")), months3 = round2(duration.as("M")), weeks3 = round2(duration.as("w")), years3 = round2(duration.as("y")), a = seconds3 <= thresholds3.ss && [
"s",
seconds3
] || seconds3 < thresholds3.s && [
"ss",
seconds3
] || minutes3 <= 1 && [
"m"
] || minutes3 < thresholds3.m && [
"mm",
minutes3
] || hours3 <= 1 && [
"h"
] || hours3 < thresholds3.h && [
"hh",
hours3
] || days3 <= 1 && [
"d"
] || days3 < thresholds3.d && [
"dd",
days3
];
if (thresholds3.w != null) {
a = a || weeks3 <= 1 && [
"w"
] || weeks3 < thresholds3.w && [
"ww",
weeks3
];
}
a = a || months3 <= 1 && [
"M"
] || months3 < thresholds3.M && [
"MM",
months3
] || years3 <= 1 && [
"y"
] || [
"yy",
years3
];
a[2] = withoutSuffix;
a[3] = +posNegDuration > 0;
a[4] = locale3;
return substituteTimeAgo2.apply(null, a);
}
function getSetRelativeTimeRounding2(roundingFunction) {
if (roundingFunction === void 0) {
return round2;
}
if (typeof roundingFunction === "function") {
round2 = roundingFunction;
return true;
}
return false;
}
function getSetRelativeTimeThreshold2(threshold, limit) {
if (thresholds2[threshold] === void 0) {
return false;
}
if (limit === void 0) {
return thresholds2[threshold];
}
thresholds2[threshold] = limit;
if (threshold === "s") {
thresholds2.ss = limit - 1;
}
return true;
}
function humanize2(argWithSuffix, argThresholds) {
if (!this.isValid()) {
return this.localeData().invalidDate();
}
var withSuffix = false, th = thresholds2, locale3, output;
if (typeof argWithSuffix === "object") {
argThresholds = argWithSuffix;
argWithSuffix = false;
}
if (typeof argWithSuffix === "boolean") {
withSuffix = argWithSuffix;
}
if (typeof argThresholds === "object") {
th = Object.assign({}, thresholds2, argThresholds);
if (argThresholds.s != null && argThresholds.ss == null) {
th.ss = argThresholds.s - 1;
}
}
locale3 = this.localeData();
output = relativeTime$12(this, !withSuffix, th, locale3);
if (withSuffix) {
output = locale3.pastFuture(+this, output);
}
return locale3.postformat(output);
}
var abs$12 = Math.abs;
function sign2(x) {
return (x > 0) - (x < 0) || +x;
}
function toISOString$12() {
if (!this.isValid()) {
return this.localeData().invalidDate();
}
var seconds3 = abs$12(this._milliseconds) / 1e3, days3 = abs$12(this._days), months3 = abs$12(this._months), minutes3, hours3, years3, s, total = this.asSeconds(), totalSign, ymSign, daysSign, hmsSign;
if (!total) {
return "P0D";
}
minutes3 = absFloor2(seconds3 / 60);
hours3 = absFloor2(minutes3 / 60);
seconds3 %= 60;
minutes3 %= 60;
years3 = absFloor2(months3 / 12);
months3 %= 12;
s = seconds3 ? seconds3.toFixed(3).replace(/\.?0+$/, "") : "";
totalSign = total < 0 ? "-" : "";
ymSign = sign2(this._months) !== sign2(total) ? "-" : "";
daysSign = sign2(this._days) !== sign2(total) ? "-" : "";
hmsSign = sign2(this._milliseconds) !== sign2(total) ? "-" : "";
return totalSign + "P" + (years3 ? ymSign + years3 + "Y" : "") + (months3 ? ymSign + months3 + "M" : "") + (days3 ? daysSign + days3 + "D" : "") + (hours3 || minutes3 || seconds3 ? "T" : "") + (hours3 ? hmsSign + hours3 + "H" : "") + (minutes3 ? hmsSign + minutes3 + "M" : "") + (seconds3 ? hmsSign + s + "S" : "");
}
var proto$22 = Duration2.prototype;
proto$22.isValid = isValid$12;
proto$22.abs = abs2;
proto$22.add = add$12;
proto$22.subtract = subtract$12;
proto$22.as = as2;
proto$22.asMilliseconds = asMilliseconds2;
proto$22.asSeconds = asSeconds2;
proto$22.asMinutes = asMinutes2;
proto$22.asHours = asHours2;
proto$22.asDays = asDays2;
proto$22.asWeeks = asWeeks2;
proto$22.asMonths = asMonths2;
proto$22.asQuarters = asQuarters2;
proto$22.asYears = asYears2;
proto$22.valueOf = valueOf$12;
proto$22._bubble = bubble2;
proto$22.clone = clone$12;
proto$22.get = get$22;
proto$22.milliseconds = milliseconds2;
proto$22.seconds = seconds2;
proto$22.minutes = minutes2;
proto$22.hours = hours2;
proto$22.days = days2;
proto$22.weeks = weeks2;
proto$22.months = months2;
proto$22.years = years2;
proto$22.humanize = humanize2;
proto$22.toISOString = toISOString$12;
proto$22.toString = toISOString$12;
proto$22.toJSON = toISOString$12;
proto$22.locale = locale2;
proto$22.localeData = localeData2;
proto$22.toIsoString = deprecate2("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)", toISOString$12);
proto$22.lang = lang2;
addFormatToken2("X", 0, 0, "unix");
addFormatToken2("x", 0, 0, "valueOf");
addRegexToken2("x", matchSigned2);
addRegexToken2("X", matchTimestamp2);
addParseToken2("X", function(input, array, config) {
config._d = new Date(parseFloat(input) * 1e3);
});
addParseToken2("x", function(input, array, config) {
config._d = new Date(toInt2(input));
});
hooks2.version = "2.30.1";
setHookCallback2(createLocal2);
hooks2.fn = proto2;
hooks2.min = min2;
hooks2.max = max2;
hooks2.now = now2;
hooks2.utc = createUTC2;
hooks2.unix = createUnix2;
hooks2.months = listMonths2;
hooks2.isDate = isDate2;
hooks2.locale = getSetGlobalLocale2;
hooks2.invalid = createInvalid2;
hooks2.duration = createDuration2;
hooks2.isMoment = isMoment2;
hooks2.weekdays = listWeekdays2;
hooks2.parseZone = createInZone2;
hooks2.localeData = getLocale2;
hooks2.isDuration = isDuration2;
hooks2.monthsShort = listMonthsShort2;
hooks2.weekdaysMin = listWeekdaysMin2;
hooks2.defineLocale = defineLocale2;
hooks2.updateLocale = updateLocale2;
hooks2.locales = listLocales2;
hooks2.weekdaysShort = listWeekdaysShort2;
hooks2.normalizeUnits = normalizeUnits2;
hooks2.relativeTimeRounding = getSetRelativeTimeRounding2;
hooks2.relativeTimeThreshold = getSetRelativeTimeThreshold2;
hooks2.calendarFormat = getCalendarFormat2;
hooks2.prototype = proto2;
hooks2.HTML5_FMT = {
DATETIME_LOCAL: "YYYY-MM-DDTHH:mm",
DATETIME_LOCAL_SECONDS: "YYYY-MM-DDTHH:mm:ss",
DATETIME_LOCAL_MS: "YYYY-MM-DDTHH:mm:ss.SSS",
DATE: "YYYY-MM-DD",
TIME: "HH:mm",
TIME_SECONDS: "HH:mm:ss",
TIME_MS: "HH:mm:ss.SSS",
WEEK: "GGGG-[W]WW",
MONTH: "YYYY-MM"
};
return hooks2;
}));
})(moment$1);
return moment$1.exports;
}
var de$2 = de$3.exports;
(function(module2, exports$1) {
(function(global, factory) {
typeof commonjsRequire === "function" ? factory(requireMoment()) : factory(global.moment);
})(de$2, (function(moment2) {
function processRelativeTime(number, withoutSuffix, key, isFuture) {
var format2 = {
m: [
"eine Minute",
"einer Minute"
],
h: [
"eine Stunde",
"einer Stunde"
],
d: [
"ein Tag",
"einem Tag"
],
dd: [
number + " Tage",
number + " Tagen"
],
w: [
"eine Woche",
"einer Woche"
],
M: [
"ein Monat",
"einem Monat"
],
MM: [
number + " Monate",
number + " Monaten"
],
y: [
"ein Jahr",
"einem Jahr"
],
yy: [
number + " Jahre",
number + " Jahren"
]
};
return withoutSuffix ? format2[key][0] : format2[key][1];
}
var de2 = moment2.defineLocale("de", {
months: "Januar_Februar_M\xE4rz_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),
monthsShort: "Jan._Feb._M\xE4rz_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),
monthsParseExact: true,
weekdays: "Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),
weekdaysShort: "So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),
weekdaysMin: "So_Mo_Di_Mi_Do_Fr_Sa".split("_"),
weekdaysParseExact: true,
longDateFormat: {
LT: "HH:mm",
LTS: "HH:mm:ss",
L: "DD.MM.YYYY",
LL: "D. MMMM YYYY",
LLL: "D. MMMM YYYY HH:mm",
LLLL: "dddd, D. MMMM YYYY HH:mm"
},
calendar: {
sameDay: "[heute um] LT [Uhr]",
sameElse: "L",
nextDay: "[morgen um] LT [Uhr]",
nextWeek: "dddd [um] LT [Uhr]",
lastDay: "[gestern um] LT [Uhr]",
lastWeek: "[letzten] dddd [um] LT [Uhr]"
},
relativeTime: {
future: "in %s",
past: "vor %s",
s: "ein paar Sekunden",
ss: "%d Sekunden",
m: processRelativeTime,
mm: "%d Minuten",
h: processRelativeTime,
hh: "%d Stunden",
d: processRelativeTime,
dd: processRelativeTime,
w: processRelativeTime,
ww: "%d Wochen",
M: processRelativeTime,
MM: processRelativeTime,
y: processRelativeTime,
yy: processRelativeTime
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal: "%d.",
week: {
dow: 1,
doy: 4
}
});
return de2;
}));
})();
var ru$3 = {
exports: {}
};
var ru$2 = ru$3.exports;
(function(module2, exports$1) {
(function(global, factory) {
typeof commonjsRequire === "function" ? factory(requireMoment()) : factory(global.moment);
})(ru$2, (function(moment2) {
function plural(word, num) {
var forms = word.split("_");
return num % 10 === 1 && num % 100 !== 11 ? forms[0] : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2];
}
function relativeTimeWithPlural(number, withoutSuffix, key) {
var format2 = {
ss: withoutSuffix ? "\u0441\u0435\u043A\u0443\u043D\u0434\u0430_\u0441\u0435\u043A\u0443\u043D\u0434\u044B_\u0441\u0435\u043A\u0443\u043D\u0434" : "\u0441\u0435\u043A\u0443\u043D\u0434\u0443_\u0441\u0435\u043A\u0443\u043D\u0434\u044B_\u0441\u0435\u043A\u0443\u043D\u0434",
mm: withoutSuffix ? "\u043C\u0438\u043D\u0443\u0442\u0430_\u043C\u0438\u043D\u0443\u0442\u044B_\u043C\u0438\u043D\u0443\u0442" : "\u043C\u0438\u043D\u0443\u0442\u0443_\u043C\u0438\u043D\u0443\u0442\u044B_\u043C\u0438\u043D\u0443\u0442",
hh: "\u0447\u0430\u0441_\u0447\u0430\u0441\u0430_\u0447\u0430\u0441\u043E\u0432",
dd: "\u0434\u0435\u043D\u044C_\u0434\u043D\u044F_\u0434\u043D\u0435\u0439",
ww: "\u043D\u0435\u0434\u0435\u043B\u044F_\u043D\u0435\u0434\u0435\u043B\u0438_\u043D\u0435\u0434\u0435\u043B\u044C",
MM: "\u043C\u0435\u0441\u044F\u0446_\u043C\u0435\u0441\u044F\u0446\u0430_\u043C\u0435\u0441\u044F\u0446\u0435\u0432",
yy: "\u0433\u043E\u0434_\u0433\u043E\u0434\u0430_\u043B\u0435\u0442"
};
if (key === "m") {
return withoutSuffix ? "\u043C\u0438\u043D\u0443\u0442\u0430" : "\u043C\u0438\u043D\u0443\u0442\u0443";
} else {
return number + " " + plural(format2[key], +number);
}
}
var monthsParse = [
/^янв/i,
/^фев/i,
/^мар/i,
/^апр/i,
/^ма[йя]/i,
/^июн/i,
/^июл/i,
/^авг/i,
/^сен/i,
/^окт/i,
/^ноя/i,
/^дек/i
];
var ru2 = moment2.defineLocale("ru", {
months: {
format: "\u044F\u043D\u0432\u0430\u0440\u044F_\u0444\u0435\u0432\u0440\u0430\u043B\u044F_\u043C\u0430\u0440\u0442\u0430_\u0430\u043F\u0440\u0435\u043B\u044F_\u043C\u0430\u044F_\u0438\u044E\u043D\u044F_\u0438\u044E\u043B\u044F_\u0430\u0432\u0433\u0443\u0441\u0442\u0430_\u0441\u0435\u043D\u0442\u044F\u0431\u0440\u044F_\u043E\u043A\u0442\u044F\u0431\u0440\u044F_\u043D\u043E\u044F\u0431\u0440\u044F_\u0434\u0435\u043A\u0430\u0431\u0440\u044F".split("_"),
standalone: "\u044F\u043D\u0432\u0430\u0440\u044C_\u0444\u0435\u0432\u0440\u0430\u043B\u044C_\u043C\u0430\u0440\u0442_\u0430\u043F\u0440\u0435\u043B\u044C_\u043C\u0430\u0439_\u0438\u044E\u043D\u044C_\u0438\u044E\u043B\u044C_\u0430\u0432\u0433\u0443\u0441\u0442_\u0441\u0435\u043D\u0442\u044F\u0431\u0440\u044C_\u043E\u043A\u0442\u044F\u0431\u0440\u044C_\u043D\u043E\u044F\u0431\u0440\u044C_\u0434\u0435\u043A\u0430\u0431\u0440\u044C".split("_")
},
monthsShort: {
format: "\u044F\u043D\u0432._\u0444\u0435\u0432\u0440._\u043C\u0430\u0440._\u0430\u043F\u0440._\u043C\u0430\u044F_\u0438\u044E\u043D\u044F_\u0438\u044E\u043B\u044F_\u0430\u0432\u0433._\u0441\u0435\u043D\u0442._\u043E\u043A\u0442._\u043D\u043E\u044F\u0431._\u0434\u0435\u043A.".split("_"),
standalone: "\u044F\u043D\u0432._\u0444\u0435\u0432\u0440._\u043C\u0430\u0440\u0442_\u0430\u043F\u0440._\u043C\u0430\u0439_\u0438\u044E\u043D\u044C_\u0438\u044E\u043B\u044C_\u0430\u0432\u0433._\u0441\u0435\u043D\u0442._\u043E\u043A\u0442._\u043D\u043E\u044F\u0431._\u0434\u0435\u043A.".split("_")
},
weekdays: {
standalone: "\u0432\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u0435_\u043F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A_\u0432\u0442\u043E\u0440\u043D\u0438\u043A_\u0441\u0440\u0435\u0434\u0430_\u0447\u0435\u0442\u0432\u0435\u0440\u0433_\u043F\u044F\u0442\u043D\u0438\u0446\u0430_\u0441\u0443\u0431\u0431\u043E\u0442\u0430".split("_"),
format: "\u0432\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u0435_\u043F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A_\u0432\u0442\u043E\u0440\u043D\u0438\u043A_\u0441\u0440\u0435\u0434\u0443_\u0447\u0435\u0442\u0432\u0435\u0440\u0433_\u043F\u044F\u0442\u043D\u0438\u0446\u0443_\u0441\u0443\u0431\u0431\u043E\u0442\u0443".split("_"),
isFormat: /\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?] ?dddd/
},
weekdaysShort: "\u0432\u0441_\u043F\u043D_\u0432\u0442_\u0441\u0440_\u0447\u0442_\u043F\u0442_\u0441\u0431".split("_"),
weekdaysMin: "\u0432\u0441_\u043F\u043D_\u0432\u0442_\u0441\u0440_\u0447\u0442_\u043F\u0442_\u0441\u0431".split("_"),
monthsParse,
longMonthsParse: monthsParse,
shortMonthsParse: monthsParse,
monthsRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,
monthsShortRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,
monthsStrictRegex: /^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i,
monthsShortStrictRegex: /^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i,
longDateFormat: {
LT: "H:mm",
LTS: "H:mm:ss",
L: "DD.MM.YYYY",
LL: "D MMMM YYYY \u0433.",
LLL: "D MMMM YYYY \u0433., H:mm",
LLLL: "dddd, D MMMM YYYY \u0433., H:mm"
},
calendar: {
sameDay: "[\u0421\u0435\u0433\u043E\u0434\u043D\u044F, \u0432] LT",
nextDay: "[\u0417\u0430\u0432\u0442\u0440\u0430, \u0432] LT",
lastDay: "[\u0412\u0447\u0435\u0440\u0430, \u0432] LT",
nextWeek: function(now2) {
if (now2.week() !== this.week()) {
switch (this.day()) {
case 0:
return "[\u0412 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0435] dddd, [\u0432] LT";
case 1:
case 2:
case 4:
return "[\u0412 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439] dddd, [\u0432] LT";
case 3:
case 5:
case 6:
return "[\u0412 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0443\u044E] dddd, [\u0432] LT";
}
} else {
if (this.day() === 2) {
return "[\u0412\u043E] dddd, [\u0432] LT";
} else {
return "[\u0412] dddd, [\u0432] LT";
}
}
},
lastWeek: function(now2) {
if (now2.week() !== this.week()) {
switch (this.day()) {
case 0:
return "[\u0412 \u043F\u0440\u043E\u0448\u043B\u043E\u0435] dddd, [\u0432] LT";
case 1:
case 2:
case 4:
return "[\u0412 \u043F\u0440\u043E\u0448\u043B\u044B\u0439] dddd, [\u0432] LT";
case 3:
case 5:
case 6:
return "[\u0412 \u043F\u0440\u043E\u0448\u043B\u0443\u044E] dddd, [\u0432] LT";
}
} else {
if (this.day() === 2) {
return "[\u0412\u043E] dddd, [\u0432] LT";
} else {
return "[\u0412] dddd, [\u0432] LT";
}
}
},
sameElse: "L"
},
relativeTime: {
future: "\u0447\u0435\u0440\u0435\u0437 %s",
past: "%s \u043D\u0430\u0437\u0430\u0434",
s: "\u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0441\u0435\u043A\u0443\u043D\u0434",
ss: relativeTimeWithPlural,
m: relativeTimeWithPlural,
mm: relativeTimeWithPlural,
h: "\u0447\u0430\u0441",
hh: relativeTimeWithPlural,
d: "\u0434\u0435\u043D\u044C",
dd: relativeTimeWithPlural,
w: "\u043D\u0435\u0434\u0435\u043B\u044F",
ww: relativeTimeWithPlural,
M: "\u043C\u0435\u0441\u044F\u0446",
MM: relativeTimeWithPlural,
y: "\u0433\u043E\u0434",
yy: relativeTimeWithPlural
},
meridiemParse: /ночи|утра|дня|вечера/i,
isPM: function(input) {
return /^(дня|вечера)$/.test(input);
},
meridiem: function(hour, minute, isLower) {
if (hour < 4) {
return "\u043D\u043E\u0447\u0438";
} else if (hour < 12) {
return "\u0443\u0442\u0440\u0430";
} else if (hour < 17) {
return "\u0434\u043D\u044F";
} else {
return "\u0432\u0435\u0447\u0435\u0440\u0430";
}
},
dayOfMonthOrdinalParse: /\d{1,2}-(й|го|я)/,
ordinal: function(number, period) {
switch (period) {
case "M":
case "d":
case "DDD":
return number + "-\u0439";
case "D":
return number + "-\u0433\u043E";
case "w":
case "W":
return number + "-\u044F";
default:
return number;
}
},
week: {
dow: 1,
doy: 4
}
});
return ru2;
}));
})();
var enGb$1 = {
exports: {}
};
var enGb = enGb$1.exports;
(function(module2, exports$1) {
(function(global, factory) {
typeof commonjsRequire === "function" ? factory(requireMoment()) : factory(global.moment);
})(enGb, (function(moment2) {
var enGb2 = moment2.defineLocale("en-gb", {
months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
monthsShort: "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),
weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
weekdaysShort: "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),
weekdaysMin: "Su_Mo_Tu_We_Th_Fr_Sa".split("_"),
longDateFormat: {
LT: "HH:mm",
LTS: "HH:mm:ss",
L: "DD/MM/YYYY",
LL: "D MMMM YYYY",
LLL: "D MMMM YYYY HH:mm",
LLLL: "dddd, D MMMM YYYY HH:mm"
},
calendar: {
sameDay: "[Today at] LT",
nextDay: "[Tomorrow at] LT",
nextWeek: "dddd [at] LT",
lastDay: "[Yesterday at] LT",
lastWeek: "[Last] dddd [at] LT",
sameElse: "L"
},
relativeTime: {
future: "in %s",
past: "%s ago",
s: "a few seconds",
ss: "%d seconds",
m: "a minute",
mm: "%d minutes",
h: "an hour",
hh: "%d hours",
d: "a day",
dd: "%d days",
M: "a month",
MM: "%d months",
y: "a year",
yy: "%d years"
},
dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
ordinal: function(number) {
var b = number % 10, output = ~~(number % 100 / 10) === 1 ? "th" : b === 1 ? "st" : b === 2 ? "nd" : b === 3 ? "rd" : "th";
return number + output;
},
week: {
dow: 1,
doy: 4
}
});
return enGb2;
}));
})();
var fr$3 = {
exports: {}
};
var fr$2 = fr$3.exports;
(function(module2, exports$1) {
(function(global, factory) {
typeof commonjsRequire === "function" ? factory(requireMoment()) : factory(global.moment);
})(fr$2, (function(moment2) {
var monthsStrictRegex = /^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i, monthsShortStrictRegex = /(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?)/i, monthsRegex2 = /(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?|janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i, monthsParse = [
/^janv/i,
/^févr/i,
/^mars/i,
/^avr/i,
/^mai/i,
/^juin/i,
/^juil/i,
/^août/i,
/^sept/i,
/^oct/i,
/^nov/i,
/^déc/i
];
var fr2 = moment2.defineLocale("fr", {
months: "janvier_f\xE9vrier_mars_avril_mai_juin_juillet_ao\xFBt_septembre_octobre_novembre_d\xE9cembre".split("_"),
monthsShort: "janv._f\xE9vr._mars_avr._mai_juin_juil._ao\xFBt_sept._oct._nov._d\xE9c.".split("_"),
monthsRegex: monthsRegex2,
monthsShortRegex: monthsRegex2,
monthsStrictRegex,
monthsShortStrictRegex,
monthsParse,
longMonthsParse: monthsParse,
shortMonthsParse: monthsParse,
weekdays: "dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),
weekdaysShort: "dim._lun._mar._mer._jeu._ven._sam.".split("_"),
weekdaysMin: "di_lu_ma_me_je_ve_sa".split("_"),
weekdaysParseExact: true,
longDateFormat: {
LT: "HH:mm",
LTS: "HH:mm:ss",
L: "DD/MM/YYYY",
LL: "D MMMM YYYY",
LLL: "D MMMM YYYY HH:mm",
LLLL: "dddd D MMMM YYYY HH:mm"
},
calendar: {
sameDay: "[Aujourd\u2019hui \xE0] LT",
nextDay: "[Demain \xE0] LT",
nextWeek: "dddd [\xE0] LT",
lastDay: "[Hier \xE0] LT",
lastWeek: "dddd [dernier \xE0] LT",
sameElse: "L"
},
relativeTime: {
future: "dans %s",
past: "il y a %s",
s: "quelques secondes",
ss: "%d secondes",
m: "une minute",
mm: "%d minutes",
h: "une heure",
hh: "%d heures",
d: "un jour",
dd: "%d jours",
w: "une semaine",
ww: "%d semaines",
M: "un mois",
MM: "%d mois",
y: "un an",
yy: "%d ans"
},
dayOfMonthOrdinalParse: /\d{1,2}(er|)/,
ordinal: function(number, period) {
switch (period) {
case "D":
return number + (number === 1 ? "er" : "");
default:
case "M":
case "Q":
case "DDD":
case "d":
return number + (number === 1 ? "er" : "e");
case "w":
case "W":
return number + (number === 1 ? "re" : "e");
}
},
week: {
dow: 1,
doy: 4
}
});
return fr2;
}));
})();
var it$3 = {
exports: {}
};
var it$2 = it$3.exports;
(function(module2, exports$1) {
(function(global, factory) {
typeof commonjsRequire === "function" ? factory(requireMoment()) : factory(global.moment);
})(it$2, (function(moment2) {
var it2 = moment2.defineLocale("it", {
months: "gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),
monthsShort: "gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),
weekdays: "domenica_luned\xEC_marted\xEC_mercoled\xEC_gioved\xEC_venerd\xEC_sabato".split("_"),
weekdaysShort: "dom_lun_mar_mer_gio_ven_sab".split("_"),
weekdaysMin: "do_lu_ma_me_gi_ve_sa".split("_"),
longDateFormat: {
LT: "HH:mm",
LTS: "HH:mm:ss",
L: "DD/MM/YYYY",
LL: "D MMMM YYYY",
LLL: "D MMMM YYYY HH:mm",
LLLL: "dddd D MMMM YYYY HH:mm"
},
calendar: {
sameDay: function() {
return "[Oggi a" + (this.hours() > 1 ? "lle " : this.hours() === 0 ? " " : "ll'") + "]LT";
},
nextDay: function() {
return "[Domani a" + (this.hours() > 1 ? "lle " : this.hours() === 0 ? " " : "ll'") + "]LT";
},
nextWeek: function() {
return "dddd [a" + (this.hours() > 1 ? "lle " : this.hours() === 0 ? " " : "ll'") + "]LT";
},
lastDay: function() {
return "[Ieri a" + (this.hours() > 1 ? "lle " : this.hours() === 0 ? " " : "ll'") + "]LT";
},
lastWeek: function() {
switch (this.day()) {
case 0:
return "[La scorsa] dddd [a" + (this.hours() > 1 ? "lle " : this.hours() === 0 ? " " : "ll'") + "]LT";
default:
return "[Lo scorso] dddd [a" + (this.hours() > 1 ? "lle " : this.hours() === 0 ? " " : "ll'") + "]LT";
}
},
sameElse: "L"
},
relativeTime: {
future: "tra %s",
past: "%s fa",
s: "alcuni secondi",
ss: "%d secondi",
m: "un minuto",
mm: "%d minuti",
h: "un'ora",
hh: "%d ore",
d: "un giorno",
dd: "%d giorni",
w: "una settimana",
ww: "%d settimane",
M: "un mese",
MM: "%d mesi",
y: "un anno",
yy: "%d anni"
},
dayOfMonthOrdinalParse: /\d{1,2}º/,
ordinal: "%d\xBA",
week: {
dow: 1,
doy: 4
}
});
return it2;
}));
})();
var es$3 = {
exports: {}
};
var es$2 = es$3.exports;
(function(module2, exports$1) {
(function(global, factory) {
typeof commonjsRequire === "function" ? factory(requireMoment()) : factory(global.moment);
})(es$2, (function(moment2) {
var monthsShortDot = "ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"), monthsShort = "ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"), monthsParse = [
/^ene/i,
/^feb/i,
/^mar/i,
/^abr/i,
/^may/i,
/^jun/i,
/^jul/i,
/^ago/i,
/^sep/i,
/^oct/i,
/^nov/i,
/^dic/i
], monthsRegex2 = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;
var es2 = moment2.defineLocale("es", {
months: "enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),
monthsShort: function(m, format2) {
if (!m) {
return monthsShortDot;
} else if (/-MMM-/.test(format2)) {
return monthsShort[m.month()];
} else {
return monthsShortDot[m.month()];
}
},
monthsRegex: monthsRegex2,
monthsShortRegex: monthsRegex2,
monthsStrictRegex: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,
monthsShortStrictRegex: /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,
monthsParse,
longMonthsParse: monthsParse,
shortMonthsParse: monthsParse,
weekdays: "domingo_lunes_martes_mi\xE9rcoles_jueves_viernes_s\xE1bado".split("_"),
weekdaysShort: "dom._lun._mar._mi\xE9._jue._vie._s\xE1b.".split("_"),
weekdaysMin: "do_lu_ma_mi_ju_vi_s\xE1".split("_"),
weekdaysParseExact: true,
longDateFormat: {
LT: "H:mm",
LTS: "H:mm:ss",
L: "DD/MM/YYYY",
LL: "D [de] MMMM [de] YYYY",
LLL: "D [de] MMMM [de] YYYY H:mm",
LLLL: "dddd, D [de] MMMM [de] YYYY H:mm"
},
calendar: {
sameDay: function() {
return "[hoy a la" + (this.hours() !== 1 ? "s" : "") + "] LT";
},
nextDay: function() {
return "[ma\xF1ana a la" + (this.hours() !== 1 ? "s" : "") + "] LT";
},
nextWeek: function() {
return "dddd [a la" + (this.hours() !== 1 ? "s" : "") + "] LT";
},
lastDay: function() {
return "[ayer a la" + (this.hours() !== 1 ? "s" : "") + "] LT";
},
lastWeek: function() {
return "[el] dddd [pasado a la" + (this.hours() !== 1 ? "s" : "") + "] LT";
},
sameElse: "L"
},
relativeTime: {
future: "en %s",
past: "hace %s",
s: "unos segundos",
ss: "%d segundos",
m: "un minuto",
mm: "%d minutos",
h: "una hora",
hh: "%d horas",
d: "un d\xEDa",
dd: "%d d\xEDas",
w: "una semana",
ww: "%d semanas",
M: "un mes",
MM: "%d meses",
y: "un a\xF1o",
yy: "%d a\xF1os"
},
dayOfMonthOrdinalParse: /\d{1,2}º/,
ordinal: "%d\xBA",
week: {
dow: 1,
doy: 4
},
invalidDate: "Fecha inv\xE1lida"
});
return es2;
}));
})();
var pl$3 = {
exports: {}
};
var pl$2 = pl$3.exports;
(function(module2, exports$1) {
(function(global, factory) {
typeof commonjsRequire === "function" ? factory(requireMoment()) : factory(global.moment);
})(pl$2, (function(moment2) {
var monthsNominative = "stycze\u0144_luty_marzec_kwiecie\u0144_maj_czerwiec_lipiec_sierpie\u0144_wrzesie\u0144_pa\u017Adziernik_listopad_grudzie\u0144".split("_"), monthsSubjective = "stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_wrze\u015Bnia_pa\u017Adziernika_listopada_grudnia".split("_"), monthsParse = [
/^sty/i,
/^lut/i,
/^mar/i,
/^kwi/i,
/^maj/i,
/^cze/i,
/^lip/i,
/^sie/i,
/^wrz/i,
/^paź/i,
/^lis/i,
/^gru/i
];
function plural(n) {
return n % 10 < 5 && n % 10 > 1 && ~~(n / 10) % 10 !== 1;
}
function translate2(number, withoutSuffix, key) {
var result = number + " ";
switch (key) {
case "ss":
return result + (plural(number) ? "sekundy" : "sekund");
case "m":
return withoutSuffix ? "minuta" : "minut\u0119";
case "mm":
return result + (plural(number) ? "minuty" : "minut");
case "h":
return withoutSuffix ? "godzina" : "godzin\u0119";
case "hh":
return result + (plural(number) ? "godziny" : "godzin");
case "ww":
return result + (plural(number) ? "tygodnie" : "tygodni");
case "MM":
return result + (plural(number) ? "miesi\u0105ce" : "miesi\u0119cy");
case "yy":
return result + (plural(number) ? "lata" : "lat");
}
}
var pl2 = moment2.defineLocale("pl", {
months: function(momentToFormat, format2) {
if (!momentToFormat) {
return monthsNominative;
} else if (/D MMMM/.test(format2)) {
return monthsSubjective[momentToFormat.month()];
} else {
return monthsNominative[momentToFormat.month()];
}
},
monthsShort: "sty_lut_mar_kwi_maj_cze_lip_sie_wrz_pa\u017A_lis_gru".split("_"),
monthsParse,
longMonthsParse: monthsParse,
shortMonthsParse: monthsParse,
weekdays: "niedziela_poniedzia\u0142ek_wtorek_\u015Broda_czwartek_pi\u0105tek_sobota".split("_"),
weekdaysShort: "ndz_pon_wt_\u015Br_czw_pt_sob".split("_"),
weekdaysMin: "Nd_Pn_Wt_\u015Ar_Cz_Pt_So".split("_"),
longDateFormat: {
LT: "HH:mm",
LTS: "HH:mm:ss",
L: "DD.MM.YYYY",
LL: "D MMMM YYYY",
LLL: "D MMMM YYYY HH:mm",
LLLL: "dddd, D MMMM YYYY HH:mm"
},
calendar: {
sameDay: "[Dzi\u015B o] LT",
nextDay: "[Jutro o] LT",
nextWeek: function() {
switch (this.day()) {
case 0:
return "[W niedziel\u0119 o] LT";
case 2:
return "[We wtorek o] LT";
case 3:
return "[W \u015Brod\u0119 o] LT";
case 6:
return "[W sobot\u0119 o] LT";
default:
return "[W] dddd [o] LT";
}
},
lastDay: "[Wczoraj o] LT",
lastWeek: function() {
switch (this.day()) {
case 0:
return "[W zesz\u0142\u0105 niedziel\u0119 o] LT";
case 3:
return "[W zesz\u0142\u0105 \u015Brod\u0119 o] LT";
case 6:
return "[W zesz\u0142\u0105 sobot\u0119 o] LT";
default:
return "[W zesz\u0142y] dddd [o] LT";
}
},
sameElse: "L"
},
relativeTime: {
future: "za %s",
past: "%s temu",
s: "kilka sekund",
ss: translate2,
m: translate2,
mm: translate2,
h: translate2,
hh: translate2,
d: "1 dzie\u0144",
dd: "%d dni",
w: "tydzie\u0144",
ww: translate2,
M: "miesi\u0105c",
MM: translate2,
y: "rok",
yy: translate2
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal: "%d.",
week: {
dow: 1,
doy: 4
}
});
return pl2;
}));
})();
var nl$3 = {
exports: {}
};
var nl$2 = nl$3.exports;
(function(module2, exports$1) {
(function(global, factory) {
typeof commonjsRequire === "function" ? factory(requireMoment()) : factory(global.moment);
})(nl$2, (function(moment2) {
var monthsShortWithDots = "jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"), monthsShortWithoutDots = "jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"), monthsParse = [
/^jan/i,
/^feb/i,
/^(maart|mrt\.?)$/i,
/^apr/i,
/^mei$/i,
/^jun[i.]?$/i,
/^jul[i.]?$/i,
/^aug/i,
/^sep/i,
/^okt/i,
/^nov/i,
/^dec/i
], monthsRegex2 = /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;
var nl2 = moment2.defineLocale("nl", {
months: "januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),
monthsShort: function(m, format2) {
if (!m) {
return monthsShortWithDots;
} else if (/-MMM-/.test(format2)) {
return monthsShortWithoutDots[m.month()];
} else {
return monthsShortWithDots[m.month()];
}
},
monthsRegex: monthsRegex2,
monthsShortRegex: monthsRegex2,
monthsStrictRegex: /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,
monthsShortStrictRegex: /^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,
monthsParse,
longMonthsParse: monthsParse,
shortMonthsParse: monthsParse,
weekdays: "zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),
weekdaysShort: "zo._ma._di._wo._do._vr._za.".split("_"),
weekdaysMin: "zo_ma_di_wo_do_vr_za".split("_"),
weekdaysParseExact: true,
longDateFormat: {
LT: "HH:mm",
LTS: "HH:mm:ss",
L: "DD-MM-YYYY",
LL: "D MMMM YYYY",
LLL: "D MMMM YYYY HH:mm",
LLLL: "dddd D MMMM YYYY HH:mm"
},
calendar: {
sameDay: "[vandaag om] LT",
nextDay: "[morgen om] LT",
nextWeek: "dddd [om] LT",
lastDay: "[gisteren om] LT",
lastWeek: "[afgelopen] dddd [om] LT",
sameElse: "L"
},
relativeTime: {
future: "over %s",
past: "%s geleden",
s: "een paar seconden",
ss: "%d seconden",
m: "\xE9\xE9n minuut",
mm: "%d minuten",
h: "\xE9\xE9n uur",
hh: "%d uur",
d: "\xE9\xE9n dag",
dd: "%d dagen",
w: "\xE9\xE9n week",
ww: "%d weken",
M: "\xE9\xE9n maand",
MM: "%d maanden",
y: "\xE9\xE9n jaar",
yy: "%d jaar"
},
dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/,
ordinal: function(number) {
return number + (number === 1 || number === 8 || number >= 20 ? "ste" : "de");
},
week: {
dow: 1,
doy: 4
}
});
return nl2;
}));
})();
var pt$3 = {
exports: {}
};
var pt$2 = pt$3.exports;
(function(module2, exports$1) {
(function(global, factory) {
typeof commonjsRequire === "function" ? factory(requireMoment()) : factory(global.moment);
})(pt$2, (function(moment2) {
var pt2 = moment2.defineLocale("pt", {
months: "janeiro_fevereiro_mar\xE7o_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),
monthsShort: "jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),
weekdays: "Domingo_Segunda-feira_Ter\xE7a-feira_Quarta-feira_Quinta-feira_Sexta-feira_S\xE1bado".split("_"),
weekdaysShort: "Dom_Seg_Ter_Qua_Qui_Sex_S\xE1b".split("_"),
weekdaysMin: "Do_2\xAA_3\xAA_4\xAA_5\xAA_6\xAA_S\xE1".split("_"),
weekdaysParseExact: true,
longDateFormat: {
LT: "HH:mm",
LTS: "HH:mm:ss",
L: "DD/MM/YYYY",
LL: "D [de] MMMM [de] YYYY",
LLL: "D [de] MMMM [de] YYYY HH:mm",
LLLL: "dddd, D [de] MMMM [de] YYYY HH:mm"
},
calendar: {
sameDay: "[Hoje \xE0s] LT",
nextDay: "[Amanh\xE3 \xE0s] LT",
nextWeek: "dddd [\xE0s] LT",
lastDay: "[Ontem \xE0s] LT",
lastWeek: function() {
return this.day() === 0 || this.day() === 6 ? "[\xDAltimo] dddd [\xE0s] LT" : "[\xDAltima] dddd [\xE0s] LT";
},
sameElse: "L"
},
relativeTime: {
future: "em %s",
past: "h\xE1 %s",
s: "segundos",
ss: "%d segundos",
m: "um minuto",
mm: "%d minutos",
h: "uma hora",
hh: "%d horas",
d: "um dia",
dd: "%d dias",
w: "uma semana",
ww: "%d semanas",
M: "um m\xEAs",
MM: "%d meses",
y: "um ano",
yy: "%d anos"
},
dayOfMonthOrdinalParse: /\d{1,2}º/,
ordinal: "%d\xBA",
week: {
dow: 1,
doy: 4
}
});
return pt2;
}));
})();
var uk$3 = {
exports: {}
};
var uk$2 = uk$3.exports;
(function(module2, exports$1) {
(function(global, factory) {
typeof commonjsRequire === "function" ? factory(requireMoment()) : factory(global.moment);
})(uk$2, (function(moment2) {
function plural(word, num) {
var forms = word.split("_");
return num % 10 === 1 && num % 100 !== 11 ? forms[0] : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2];
}
function relativeTimeWithPlural(number, withoutSuffix, key) {
var format2 = {
ss: withoutSuffix ? "\u0441\u0435\u043A\u0443\u043D\u0434\u0430_\u0441\u0435\u043A\u0443\u043D\u0434\u0438_\u0441\u0435\u043A\u0443\u043D\u0434" : "\u0441\u0435\u043A\u0443\u043D\u0434\u0443_\u0441\u0435\u043A\u0443\u043D\u0434\u0438_\u0441\u0435\u043A\u0443\u043D\u0434",
mm: withoutSuffix ? "\u0445\u0432\u0438\u043B\u0438\u043D\u0430_\u0445\u0432\u0438\u043B\u0438\u043D\u0438_\u0445\u0432\u0438\u043B\u0438\u043D" : "\u0445\u0432\u0438\u043B\u0438\u043D\u0443_\u0445\u0432\u0438\u043B\u0438\u043D\u0438_\u0445\u0432\u0438\u043B\u0438\u043D",
hh: withoutSuffix ? "\u0433\u043E\u0434\u0438\u043D\u0430_\u0433\u043E\u0434\u0438\u043D\u0438_\u0433\u043E\u0434\u0438\u043D" : "\u0433\u043E\u0434\u0438\u043D\u0443_\u0433\u043E\u0434\u0438\u043D\u0438_\u0433\u043E\u0434\u0438\u043D",
dd: "\u0434\u0435\u043D\u044C_\u0434\u043D\u0456_\u0434\u043D\u0456\u0432",
MM: "\u043C\u0456\u0441\u044F\u0446\u044C_\u043C\u0456\u0441\u044F\u0446\u0456_\u043C\u0456\u0441\u044F\u0446\u0456\u0432",
yy: "\u0440\u0456\u043A_\u0440\u043E\u043A\u0438_\u0440\u043E\u043A\u0456\u0432"
};
if (key === "m") {
return withoutSuffix ? "\u0445\u0432\u0438\u043B\u0438\u043D\u0430" : "\u0445\u0432\u0438\u043B\u0438\u043D\u0443";
} else if (key === "h") {
return withoutSuffix ? "\u0433\u043E\u0434\u0438\u043D\u0430" : "\u0433\u043E\u0434\u0438\u043D\u0443";
} else {
return number + " " + plural(format2[key], +number);
}
}
function weekdaysCaseReplace(m, format2) {
var weekdays = {
nominative: "\u043D\u0435\u0434\u0456\u043B\u044F_\u043F\u043E\u043D\u0435\u0434\u0456\u043B\u043E\u043A_\u0432\u0456\u0432\u0442\u043E\u0440\u043E\u043A_\u0441\u0435\u0440\u0435\u0434\u0430_\u0447\u0435\u0442\u0432\u0435\u0440_\u043F\u2019\u044F\u0442\u043D\u0438\u0446\u044F_\u0441\u0443\u0431\u043E\u0442\u0430".split("_"),
accusative: "\u043D\u0435\u0434\u0456\u043B\u044E_\u043F\u043E\u043D\u0435\u0434\u0456\u043B\u043E\u043A_\u0432\u0456\u0432\u0442\u043E\u0440\u043E\u043A_\u0441\u0435\u0440\u0435\u0434\u0443_\u0447\u0435\u0442\u0432\u0435\u0440_\u043F\u2019\u044F\u0442\u043D\u0438\u0446\u044E_\u0441\u0443\u0431\u043E\u0442\u0443".split("_"),
genitive: "\u043D\u0435\u0434\u0456\u043B\u0456_\u043F\u043E\u043D\u0435\u0434\u0456\u043B\u043A\u0430_\u0432\u0456\u0432\u0442\u043E\u0440\u043A\u0430_\u0441\u0435\u0440\u0435\u0434\u0438_\u0447\u0435\u0442\u0432\u0435\u0440\u0433\u0430_\u043F\u2019\u044F\u0442\u043D\u0438\u0446\u0456_\u0441\u0443\u0431\u043E\u0442\u0438".split("_")
}, nounCase;
if (m === true) {
return weekdays["nominative"].slice(1, 7).concat(weekdays["nominative"].slice(0, 1));
}
if (!m) {
return weekdays["nominative"];
}
nounCase = /(\[[ВвУу]\]) ?dddd/.test(format2) ? "accusative" : /\[?(?:минулої|наступної)? ?\] ?dddd/.test(format2) ? "genitive" : "nominative";
return weekdays[nounCase][m.day()];
}
function processHoursFunction(str) {
return function() {
return str + "\u043E" + (this.hours() === 11 ? "\u0431" : "") + "] LT";
};
}
var uk2 = moment2.defineLocale("uk", {
months: {
format: "\u0441\u0456\u0447\u043D\u044F_\u043B\u044E\u0442\u043E\u0433\u043E_\u0431\u0435\u0440\u0435\u0437\u043D\u044F_\u043A\u0432\u0456\u0442\u043D\u044F_\u0442\u0440\u0430\u0432\u043D\u044F_\u0447\u0435\u0440\u0432\u043D\u044F_\u043B\u0438\u043F\u043D\u044F_\u0441\u0435\u0440\u043F\u043D\u044F_\u0432\u0435\u0440\u0435\u0441\u043D\u044F_\u0436\u043E\u0432\u0442\u043D\u044F_\u043B\u0438\u0441\u0442\u043E\u043F\u0430\u0434\u0430_\u0433\u0440\u0443\u0434\u043D\u044F".split("_"),
standalone: "\u0441\u0456\u0447\u0435\u043D\u044C_\u043B\u044E\u0442\u0438\u0439_\u0431\u0435\u0440\u0435\u0437\u0435\u043D\u044C_\u043A\u0432\u0456\u0442\u0435\u043D\u044C_\u0442\u0440\u0430\u0432\u0435\u043D\u044C_\u0447\u0435\u0440\u0432\u0435\u043D\u044C_\u043B\u0438\u043F\u0435\u043D\u044C_\u0441\u0435\u0440\u043F\u0435\u043D\u044C_\u0432\u0435\u0440\u0435\u0441\u0435\u043D\u044C_\u0436\u043E\u0432\u0442\u0435\u043D\u044C_\u043B\u0438\u0441\u0442\u043E\u043F\u0430\u0434_\u0433\u0440\u0443\u0434\u0435\u043D\u044C".split("_")
},
monthsShort: "\u0441\u0456\u0447_\u043B\u044E\u0442_\u0431\u0435\u0440_\u043A\u0432\u0456\u0442_\u0442\u0440\u0430\u0432_\u0447\u0435\u0440\u0432_\u043B\u0438\u043F_\u0441\u0435\u0440\u043F_\u0432\u0435\u0440_\u0436\u043E\u0432\u0442_\u043B\u0438\u0441\u0442_\u0433\u0440\u0443\u0434".split("_"),
weekdays: weekdaysCaseReplace,
weekdaysShort: "\u043D\u0434_\u043F\u043D_\u0432\u0442_\u0441\u0440_\u0447\u0442_\u043F\u0442_\u0441\u0431".split("_"),
weekdaysMin: "\u043D\u0434_\u043F\u043D_\u0432\u0442_\u0441\u0440_\u0447\u0442_\u043F\u0442_\u0441\u0431".split("_"),
longDateFormat: {
LT: "HH:mm",
LTS: "HH:mm:ss",
L: "DD.MM.YYYY",
LL: "D MMMM YYYY \u0440.",
LLL: "D MMMM YYYY \u0440., HH:mm",
LLLL: "dddd, D MMMM YYYY \u0440., HH:mm"
},
calendar: {
sameDay: processHoursFunction("[\u0421\u044C\u043E\u0433\u043E\u0434\u043D\u0456 "),
nextDay: processHoursFunction("[\u0417\u0430\u0432\u0442\u0440\u0430 "),
lastDay: processHoursFunction("[\u0412\u0447\u043E\u0440\u0430 "),
nextWeek: processHoursFunction("[\u0423] dddd ["),
lastWeek: function() {
switch (this.day()) {
case 0:
case 3:
case 5:
case 6:
return processHoursFunction("[\u041C\u0438\u043D\u0443\u043B\u043E\u0457] dddd [").call(this);
case 1:
case 2:
case 4:
return processHoursFunction("[\u041C\u0438\u043D\u0443\u043B\u043E\u0433\u043E] dddd [").call(this);
}
},
sameElse: "L"
},
relativeTime: {
future: "\u0437\u0430 %s",
past: "%s \u0442\u043E\u043C\u0443",
s: "\u0434\u0435\u043A\u0456\u043B\u044C\u043A\u0430 \u0441\u0435\u043A\u0443\u043D\u0434",
ss: relativeTimeWithPlural,
m: relativeTimeWithPlural,
mm: relativeTimeWithPlural,
h: "\u0433\u043E\u0434\u0438\u043D\u0443",
hh: relativeTimeWithPlural,
d: "\u0434\u0435\u043D\u044C",
dd: relativeTimeWithPlural,
M: "\u043C\u0456\u0441\u044F\u0446\u044C",
MM: relativeTimeWithPlural,
y: "\u0440\u0456\u043A",
yy: relativeTimeWithPlural
},
meridiemParse: /ночі|ранку|дня|вечора/,
isPM: function(input) {
return /^(дня|вечора)$/.test(input);
},
meridiem: function(hour, minute, isLower) {
if (hour < 4) {
return "\u043D\u043E\u0447\u0456";
} else if (hour < 12) {
return "\u0440\u0430\u043D\u043A\u0443";
} else if (hour < 17) {
return "\u0434\u043D\u044F";
} else {
return "\u0432\u0435\u0447\u043E\u0440\u0430";
}
},
dayOfMonthOrdinalParse: /\d{1,2}-(й|го)/,
ordinal: function(number, period) {
switch (period) {
case "M":
case "d":
case "DDD":
case "w":
case "W":
return number + "-\u0439";
case "D":
return number + "-\u0433\u043E";
default:
return number;
}
},
week: {
dow: 1,
doy: 7
}
});
return uk2;
}));
})();
var zhCn$3 = {
exports: {}
};
var zhCn$2 = zhCn$3.exports;
(function(module2, exports$1) {
(function(global, factory) {
typeof commonjsRequire === "function" ? factory(requireMoment()) : factory(global.moment);
})(zhCn$2, (function(moment2) {
var zhCn2 = moment2.defineLocale("zh-cn", {
months: "\u4E00\u6708_\u4E8C\u6708_\u4E09\u6708_\u56DB\u6708_\u4E94\u6708_\u516D\u6708_\u4E03\u6708_\u516B\u6708_\u4E5D\u6708_\u5341\u6708_\u5341\u4E00\u6708_\u5341\u4E8C\u6708".split("_"),
monthsShort: "1\u6708_2\u6708_3\u6708_4\u6708_5\u6708_6\u6708_7\u6708_8\u6708_9\u6708_10\u6708_11\u6708_12\u6708".split("_"),
weekdays: "\u661F\u671F\u65E5_\u661F\u671F\u4E00_\u661F\u671F\u4E8C_\u661F\u671F\u4E09_\u661F\u671F\u56DB_\u661F\u671F\u4E94_\u661F\u671F\u516D".split("_"),
weekdaysShort: "\u5468\u65E5_\u5468\u4E00_\u5468\u4E8C_\u5468\u4E09_\u5468\u56DB_\u5468\u4E94_\u5468\u516D".split("_"),
weekdaysMin: "\u65E5_\u4E00_\u4E8C_\u4E09_\u56DB_\u4E94_\u516D".split("_"),
longDateFormat: {
LT: "HH:mm",
LTS: "HH:mm:ss",
L: "YYYY/MM/DD",
LL: "YYYY\u5E74M\u6708D\u65E5",
LLL: "YYYY\u5E74M\u6708D\u65E5Ah\u70B9mm\u5206",
LLLL: "YYYY\u5E74M\u6708D\u65E5ddddAh\u70B9mm\u5206",
l: "YYYY/M/D",
ll: "YYYY\u5E74M\u6708D\u65E5",
lll: "YYYY\u5E74M\u6708D\u65E5 HH:mm",
llll: "YYYY\u5E74M\u6708D\u65E5dddd HH:mm"
},
meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
meridiemHour: function(hour, meridiem2) {
if (hour === 12) {
hour = 0;
}
if (meridiem2 === "\u51CC\u6668" || meridiem2 === "\u65E9\u4E0A" || meridiem2 === "\u4E0A\u5348") {
return hour;
} else if (meridiem2 === "\u4E0B\u5348" || meridiem2 === "\u665A\u4E0A") {
return hour + 12;
} else {
return hour >= 11 ? hour : hour + 12;
}
},
meridiem: function(hour, minute, isLower) {
var hm = hour * 100 + minute;
if (hm < 600) {
return "\u51CC\u6668";
} else if (hm < 900) {
return "\u65E9\u4E0A";
} else if (hm < 1130) {
return "\u4E0A\u5348";
} else if (hm < 1230) {
return "\u4E2D\u5348";
} else if (hm < 1800) {
return "\u4E0B\u5348";
} else {
return "\u665A\u4E0A";
}
},
calendar: {
sameDay: "[\u4ECA\u5929]LT",
nextDay: "[\u660E\u5929]LT",
nextWeek: function(now2) {
if (now2.week() !== this.week()) {
return "[\u4E0B]dddLT";
} else {
return "[\u672C]dddLT";
}
},
lastDay: "[\u6628\u5929]LT",
lastWeek: function(now2) {
if (this.week() !== now2.week()) {
return "[\u4E0A]dddLT";
} else {
return "[\u672C]dddLT";
}
},
sameElse: "L"
},
dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/,
ordinal: function(number, period) {
switch (period) {
case "d":
case "D":
case "DDD":
return number + "\u65E5";
case "M":
return number + "\u6708";
case "w":
case "W":
return number + "\u5468";
default:
return number;
}
},
relativeTime: {
future: "%s\u540E",
past: "%s\u524D",
s: "\u51E0\u79D2",
ss: "%d \u79D2",
m: "1 \u5206\u949F",
mm: "%d \u5206\u949F",
h: "1 \u5C0F\u65F6",
hh: "%d \u5C0F\u65F6",
d: "1 \u5929",
dd: "%d \u5929",
w: "1 \u5468",
ww: "%d \u5468",
M: "1 \u4E2A\u6708",
MM: "%d \u4E2A\u6708",
y: "1 \u5E74",
yy: "%d \u5E74"
},
week: {
dow: 1,
doy: 4
}
});
return zhCn2;
}));
})();
window.systemDictionary = {};
window.systemLang = "en";
function _translateWord$1(text, lang2, dictionary) {
if (!text) {
return "";
}
lang2 = lang2 || window.systemLang || "en";
dictionary = dictionary || window.systemDictionary || {};
if (dictionary && dictionary[text]) {
let newText = dictionary[text][lang2];
if (newText) {
return newText;
}
if (lang2 !== "en") {
newText = dictionary[text].en;
if (newText) {
return newText;
}
}
} else if (typeof text === "string" && !text.match(/_tooltip$/)) ;
else if (typeof text !== "string") {
console.warn(`Trying to translate non-text: ${text}`);
}
return text;
}
window._ = (text, arg1, arg2, arg3) => {
text = _translateWord$1(text);
let pos = text.indexOf("%s");
if (pos !== -1) {
text = text.replace("%s", (arg1 == null ? void 0 : arg1.toString()) || "");
} else {
return text;
}
pos = text.indexOf("%s");
if (pos !== -1) {
text = text.replace("%s", (arg2 == null ? void 0 : arg2.toString()) || "");
} else {
return text;
}
pos = text.indexOf("%s");
if (pos !== -1) {
text = text.replace("%s", (arg3 == null ? void 0 : arg3.toString()) || "");
}
return text;
};
window.addWords = (words) => Object.assign(window.systemDictionary || {}, words);
window.addWords({
"No connection to Server": {
en: "No connection to Server",
de: "Keine Verbindung zum Server",
ru: "\u041D\u0435\u0442 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043E\u043C",
pt: "Nenhuma conex\xE3o ao servidor",
nl: "Geen verbinding met server",
fr: "Pas de connexion au serveur",
it: "Nessuna connessione al server",
es: "Sin conexi\xF3n al servidor",
pl: "Brak po\u0142\u0105czenia z serwerem",
uk: "\u041D\u0435\u043C\u0430\u0454 \u0437'\u0454\u0434\u043D\u0430\u043D\u043D\u044F \u0437 \u0441\u0435\u0440\u0432\u0435\u0440\u043E\u043C",
"zh-cn": "\u6CA1\u6709\u4E0E\u670D\u52A1\u5668\u7684\u8FDE\u63A5"
},
"Loading Views...": {
en: "Loading Views...",
de: "Lade Views...",
ru: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0445 \u0441\u0442\u0440\u0430\u043D\u0438\u0446...",
pt: "Carregando p\xE1ginas ...",
nl: "Pagina's laden ...",
fr: "Chargement des pages ...",
it: "Caricamento pagine ...",
es: "Cargando p\xE1ginas ...",
pl: "\u0141adowanie stron ...",
uk: "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A ...",
"zh-cn": "\u52A0\u8F7D\u9875\u9762......"
},
"Connecting to Server...": {
en: "Connecting to Server...",
de: "Verbinde mit dem Server...",
ru: "\u0421\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043E\u043C...",
pt: "Conectando ao servidor...",
nl: "Verbinden met de server...",
fr: "Connexion au serveur...",
it: "Connessione al server...",
es: "Conectando al servidor...",
pl: "\u0141\u0105czenie z serwerem...",
uk: "\u0417'\u0454\u0434\u043D\u0430\u043D\u043D\u044F \u0437 \u0441\u0435\u0440\u0432\u0435\u0440\u043E\u043C...",
"zh-cn": "\u8FDE\u63A5\u5230\u670D\u52A1\u5668..."
},
"Loading data objects...": {
en: "Loading data...",
de: "Lade Daten...",
ru: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0434\u0430\u043D\u043D\u044B\u0445...",
pt: "Carregando dados...",
nl: "Data laden...",
fr: "Chargement des donn\xE9es...",
it: "Caricamento dati...",
es: "Cargando datos...",
pl: "\u0141adowanie danych...",
uk: "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F \u0434\u0430\u043D\u0438\u0445...",
"zh-cn": "\u52A0\u8F7D\u6570\u636E\u4E2D..."
},
"Loading data values...": {
en: "Loading values...",
de: "Lade Werte...",
ru: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0439...",
pt: "Carregando valores ...",
nl: "Waarden laden ...",
fr: "Chargement des valeurs ...",
it: "Caricamento valori ...",
es: "Cargando valores ...",
pl: "\u0141adowanie warto\u015Bci ...",
uk: "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F \u0437\u043D\u0430\u0447\u0435\u043D\u044C ...",
"zh-cn": "\u8F7D\u5165\u503C..."
},
"error - View doesn't exist": {
en: "View doesn't exist!",
de: "View existiert nicht!",
ru: "\u0421\u0442\u0440\u0430\u043D\u0438\u0446\u0430 \u043D\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442!",
pt: "erro - a p\xE1gina n\xE3o existe",
nl: "error - Page bestaat niet",
fr: "error - La page n'existe pas",
it: "errore - La pagina non esiste",
es: "error - la p\xE1gina no existe",
pl: "b\u0142\u0105d - strona nie istnieje",
uk: "\u043F\u043E\u043C\u0438\u043B\u043A\u0430 - \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043D\u0435 \u0456\u0441\u043D\u0443\u0454",
"zh-cn": "\u9519\u8BEF - \u9875\u9762\u4E0D\u5B58\u5728"
},
"no views found!": {
en: "No views found!",
de: "Keine Views gefunden!",
ru: "\u041D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E \u0441\u0442\u0440\u0430\u043D\u0438\u0446!",
pt: "Nenhuma p\xE1gina encontrada!",
nl: "Geen pagina's gevonden!",
fr: "Aucune page trouv\xE9e!",
it: "Nessuna pagina trovata!",
es: "No se encontraron p\xE1ginas!",
pl: "Nie znaleziono stron!",
uk: "\u041D\u0435 \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u043E \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A!",
"zh-cn": "\u627E\u4E0D\u5230\u9875\u9762\uFF01"
},
"No valid license found!": {
en: "No valid vis license found! Please check vis settings.",
de: "Keine g\xFCltige vis Lizenz gefunden! Bitte vis Einstellungen pr\xFCfen.",
ru: "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u044F \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430! \u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438.",
pt: "Nenhuma licen\xE7a v\xE1lida encontrada! Por favor, verifique vis instance.",
nl: "Geen geldige licentie gevonden! Controleer de vis-aankondiging.",
fr: "Aucune licence valide trouv\xE9e ! Veuillez v\xE9rifier vis instance.",
it: "Nessuna licenza valida trovata! Si prega di controllare di persona.",
es: "No se encontr\xF3 ninguna licencia v\xE1lida! Por favor, compruebe la instancia de visita.",
pl: "Nie znaleziono wa\u017Cnej licencji! Prosz\u0119 sprawdzi\u0107 vis instance.",
uk: "\u041D\u0435 \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u043E \u0434\u0456\u0439\u0441\u043D\u043E\u0457 \u043B\u0456\u0446\u0435\u043D\u0437\u0456\u0457! \u0411\u0443\u0434\u044C \u043B\u0430\u0441\u043A\u0430, \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u0442\u0435 \u043D\u0430\u043B\u0430\u0448\u0442\u0443\u0432\u0430\u043D\u043D\u044F vis.",
"zh-cn": "\u627E\u4E0D\u5230\u6709\u6548\u7684\u8BB8\u53EF\u8BC1\uFF01\u8BF7\u68C0\u67E5vis\u5B9E\u4F8B\u3002"
},
"No Views found on Server": {
en: "No Views found on Server",
de: "Keine Views am Server gefunden.",
ru: "\u041D\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E \u043D\u0438\u043A\u0430\u043A\u0438\u0445 \u0441\u0442\u0440\u0430\u043D\u0438\u0446.",
pt: "Nenhuma p\xE1gina encontrada no servidor",
nl: "Geen pagina's gevonden op server",
fr: "Aucune page trouv\xE9e sur le serveur",
it: "Nessuna pagina trovata sul server",
es: "No se encontraron p\xE1ginas en el servidor",
pl: "Nie znaleziono stron na serwerze",
uk: "\u041D\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0456 \u043D\u0435 \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u043E \u0436\u043E\u0434\u043D\u0438\u0445 \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A",
"zh-cn": "\u5728\u670D\u52A1\u5668\u4E0A\u627E\u4E0D\u5230\u9875\u9762"
},
"All changes are saved locally. To reset changes clear the cache.": {
en: "All changes are saved locally. To reset changes clear the browser cache.",
de: "Alle \xC4nderungen sind lokal gespeichert. Um \xC4nderungen zu l\xF6schen, l\xF6sche Browsercache.",
ru: "\u0412\u0441\u0435 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u044B \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u043E. \u0414\u043B\u044F \u043E\u0442\u043C\u0435\u043D\u044B \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u044B\u0445 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439 \u043E\u0447\u0438\u0441\u0442\u0438\u0442\u0435 \u043A\u0435\u0448 \u0431\u0440\u043E\u0443\u0437\u0435\u0440\u0430.",
pt: "Todas as altera\xE7\xF5es s\xE3o salvas localmente. Para redefinir as altera\xE7\xF5es, limpe o cache do navegador.",
nl: "Alle wijzigingen worden lokaal opgeslagen. Als u de wijzigingen opnieuw wilt instellen, wist u de cache van de browser.",
fr: "Toutes les modifications sont enregistr\xE9es localement. Pour r\xE9initialiser les modifications, effacez le cache du navigateur.",
it: "Tutte le modifiche sono salvate localmente. Per ripristinare le modifiche, cancellare la cache del browser.",
es: "Todos los cambios se guardan localmente. Para restablecer los cambios borra el cach\xE9 del navegador.",
pl: "Wszystkie zmiany s\u0105 zapisywane lokalnie. Aby zresetowa\u0107 zmiany, wyczy\u015B\u0107 pami\u0119\u0107 podr\u0119czn\u0105 przegl\u0105darki.",
uk: "\u0412\u0441\u0456 \u0437\u043C\u0456\u043D\u0438 \u0437\u0431\u0435\u0440\u0456\u0433\u0430\u044E\u0442\u044C\u0441\u044F \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u043E. \u0429\u043E\u0431 \u0441\u043A\u0438\u043D\u0443\u0442\u0438 \u0437\u043C\u0456\u043D\u0438, \u043E\u0447\u0438\u0441\u0442\u0456\u0442\u044C \u043A\u0435\u0448 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430.",
"zh-cn": "\u6240\u6709\u66F4\u6539\u90FD\u4FDD\u5B58\u5728\u672C\u5730\u3002\u8981\u91CD\u7F6E\u66F4\u6539\uFF0C\u8BF7\u6E05\u9664\u6D4F\u89C8\u5668\u7F13\u5B58\u3002"
},
"please use /vis/edit.html instead of /vis/?edit": {
en: "Please use /vis/edit.html instead of /vis/?edit",
de: "Bitte geben Sie /vis/edit.html statt /vis/?edit",
ru: "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 /vis/edit.html \u0432\u043C\u0435\u0441\u0442\u043E /vis/?edit",
pt: "Por favor, use /vis/edit.html em vez de /vis/?edit",
nl: "Gebruik alsjeblieft /vis/edit.html in plaats van /vis/?edit",
fr: "Veuillez utiliser /vis/edit.html au lieu de /vis/?edit",
it: "Utilizza /vis/edit.html invece di /vis/?edit",
es: "Utilice /vis/edit.html en lugar de /vis/?edit",
pl: "U\u017Cyj /vis/edit.html zamiast /vis/?edit",
uk: "\u0411\u0443\u0434\u044C \u043B\u0430\u0441\u043A\u0430, \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u043E\u0432\u0443\u0439\u0442\u0435 /vis/edit.html \u0437\u0430\u043C\u0456\u0441\u0442\u044C /vis/?edit",
"zh-cn": "\u8BF7\u4F7F\u7528/vis/edit.html\u800C\u4E0D\u662F/vis/?edit"
},
"no views found on server.\nCreate new %s ?": {
en: "no views found on server.\nCreate new %s?",
de: "Keine Views am Server gefunden am.\nErzeugen %s?",
ru: "\u041D\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E \u043D\u0438\u043A\u0430\u043A\u0438\u0445 \u0441\u0442\u0440\u0430\u043D\u0438\u0446. \u0421\u043E\u0437\u0434\u0430\u0442\u044C %s?",
pt: "nenhuma vista encontrada no servidor.\nCrie novos %s?",
nl: "geen weergaven gevonden op server.\nNieuwe %s maken?",
fr: "aucune vue trouv\xE9e sur le serveur.\nCr\xE9er un nouveau %s?",
it: "nessuna vista trovata sul server.\nCrea nuovo %s?",
es: "No se han encontrado vistas en el servidor.\nCrear nuevo %s?",
pl: "nie znaleziono widok\xF3w na serwerze.\nUtw\xF3rz nowy %s?",
uk: "\u043D\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0456 \u043D\u0435 \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u043E \u0436\u043E\u0434\u043D\u0438\u0445 \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A.\n\u0421\u0442\u0432\u043E\u0440\u0438\u0442\u0438 \u043D\u043E\u0432\u0438\u0439 %s?",
"zh-cn": "\u5728\u670D\u52A1\u5668\u4E0A\u627E\u4E0D\u5230\u4EFB\u4F55\u89C6\u56FE\n\u521B\u5EFA\u65B0\u7684 %s\uFF1F"
},
"Update found, loading new Files...": {
en: "Update found.<br/>Loading new Files...",
de: "Neue Version gefunden.<br/>Lade neue Dateien\xA0\u2026",
ru: "\u041E\u0431\u043D\u0430\u0440\u0443\u0436\u0435\u043D\u043E \u041E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435.<br/>\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u044E \u043D\u043E\u0432\u044B\u0435 \u0444\u0430\u0439\u043B\u044B...",
pt: "Atualiza\xE7\xE3o encontrada. <br/> Carregando novos arquivos ...",
nl: "Update gevonden. <br/> Nieuwe bestanden laden ...",
fr: "Mise \xE0 jour trouv\xE9e. <br/> Chargement de nouveaux fichiers ...",
it: "Aggiornamento trovato. <br/> Caricamento di nuovi file ...",
es: "Actualizaci\xF3n encontrada. <br/> Cargando nuevos archivos ...",
pl: "Znaleziono aktualizacj\u0119. <br/> \u0141adowanie nowych plik\xF3w ...",
uk: "\u041E\u043D\u043E\u0432\u043B\u0435\u043D\u043D\u044F \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u043E. <br/> \u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F \u043D\u043E\u0432\u0438\u0445 \u0444\u0430\u0439\u043B\u0456\u0432 ...",
"zh-cn": "\u627E\u5230\u66F4\u65B0\u3002<br/>\u52A0\u8F7D\u65B0\u6587\u4EF6..."
},
"Loading Widget-Sets...": {
en: "Loading Widget-Sets...",
de: "Lade Widget-S\xE4tze...",
ru: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u043D\u0430\u0431\u043E\u0440\u043E\u0432 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432...",
pt: "Carregando Conjuntos de Widget ...",
nl: "Widgetsets laden ...",
fr: "Chargement des ensembles de widgets ...",
it: "Caricamento widget-set ...",
es: "Cargando conjuntos de widgets ...",
pl: "\u0141adowanie zestaw\xF3w widget\xF3w ...",
uk: "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F \u043D\u0430\u0431\u043E\u0440\u0456\u0432 \u0432\u0456\u0434\u0436\u0435\u0442\u0456\u0432 ...",
"zh-cn": "\u6B63\u5728\u52A0\u8F7DWidget-Sets ..."
},
"error: view not found.": {
en: "Error: view not found",
de: "Fehler: View wurde nicht gefunden",
ru: "\u041E\u0448\u0438\u0431\u043A\u0430: \u0421\u0442\u0440\u0430\u043D\u0438\u0446\u0430 \u043D\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442",
pt: "Erro: p\xE1gina n\xE3o encontrada",
nl: "Fout: pagina niet gevonden",
fr: "Erreur: page non trouv\xE9e",
it: "Errore: pagina non trovata",
es: "Error: p\xE1gina no encontrada",
pl: "B\u0142\u0105d: strona nie znaleziona",
uk: "\u041F\u043E\u043C\u0438\u043B\u043A\u0430: \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043D\u0435 \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u0430",
"zh-cn": "\u9519\u8BEF\uFF1A\u627E\u4E0D\u5230\u9875\u9762"
},
"error: view container recursion.": {
en: "Error: view container recursion",
de: "Fehler: View ist rekursiv",
ru: "\u041E\u0448\u0438\u0431\u043A\u0430: \u0421\u0442\u0440\u0430\u043D\u0438\u0446\u0430 \u0432\u044B\u0437\u044B\u0432\u0435\u0442 \u0441\u0430\u043C\u0443 \u0441\u0435\u0431\u044F",
pt: "Erro: recurs\xE3o do cont\xEAiner de p\xE1gina",
nl: "Fout: paginacontainer-recursie",
fr: "Erreur: r\xE9cursivit\xE9 du conteneur de page",
it: "Errore: ricorsione del contenitore della pagina",
es: "Error: p\xE1gina de recursi\xF3n del contenedor.",
pl: "B\u0142\u0105d: rekursja kontenera strony",
uk: "\u041F\u043E\u043C\u0438\u043B\u043A\u0430: \u0440\u0435\u043A\u0443\u0440\u0441\u0456\u044F \u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438",
"zh-cn": "\u9519\u8BEF\uFF1A\u9875\u9762\u5BB9\u5668\u9012\u5F52"
},
"Cannot execute %s for %s, because of insufficient permissions": {
en: "Cannot execute %s for %s, because of insufficient permissions.",
de: "Kann das Kommando '%s' f\xFCr %s nicht ausf\xFChren, weil nicht gen\xFCgend Zugriffsrechte vorhanden sind.",
ru: "\u041D\u0435 \u043C\u043E\u0433\u0443 \u0432\u044B\u043F\u043E\u043B\u043D\u0438\u0442\u044C '%s' \u0434\u043B\u044F %s, \u0442\u0430\u043A \u043A\u0430\u043A \u043D\u0435\u0434\u043E\u0441\u0442\u0430\u0442\u043E\u0447\u043D\u043E \u043F\u0440\u0430\u0432.",
pt: "N\xE3o \xE9 poss\xEDvel executar %s para %s, devido a permiss\xF5es insuficientes.",
nl: "Kan %s niet uitvoeren voor %s, vanwege onvoldoende machtigingen.",
fr: "Impossible d'ex\xE9cuter %s pour %s en raison d'autorisations insuffisantes.",
it: "Impossibile eseguire %s per %s, a causa di autorizzazioni insufficienti.",
es: "No se puede ejecutar %s para %s, debido a permisos insuficientes.",
pl: "Nie mo\u017Cna wykona\u0107 %s dla %s, z powodu niewystarczaj\u0105cych uprawnie\u0144.",
uk: "\u041D\u0435\u043C\u043E\u0436\u043B\u0438\u0432\u043E \u0432\u0438\u043A\u043E\u043D\u0430\u0442\u0438 %s \u0434\u043B\u044F %s \u0447\u0435\u0440\u0435\u0437 \u043D\u0435\u0434\u043E\u0441\u0442\u0430\u0442\u043D\u0456 \u043F\u0440\u0430\u0432\u0430.",
"zh-cn": "\u7531\u4E8E\u6743\u9650\u4E0D\u8DB3\uFF0C\u65E0\u6CD5\u4E3A\uFF05s\u6267\u884C%s\u3002"
},
"Insufficient permissions": {
en: "Insufficient permissions",
de: "Nicht gen\xFCgend Zugriffsrechte",
ru: "\u041D\u0435\u0434\u043E\u0441\u0442\u0430\u0442\u043E\u0447\u043D\u043E \u043F\u0440\u0430\u0432",
pt: "Permiss\xF5es insuficientes",
nl: "Onvoldoende rechten",
fr: "Permissions insuffisantes",
it: "Permessi insufficienti",
es: "Permisos insuficientes",
pl: "Niewystarczaj\u0105ce uprawnienia",
uk: "\u041D\u0435\u0434\u043E\u0441\u0442\u0430\u0442\u043D\u044C\u043E \u043F\u0440\u0430\u0432",
"zh-cn": "\u6743\u9650\u4E0D\u8DB3"
},
"View disabled for user %s": {
en: "View disabled for user <b>%s</b>",
de: "View ist f\xFCr Anwender <b>%s</b> deaktiviert",
ru: "\u0421\u0442\u0440\u0430\u043D\u0438\u0446\u0430 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0434\u043B\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F <b>%s</b>",
pt: "Visualiza\xE7\xE3o desativada para o usu\xE1rio <b>%s</b>",
nl: "Weergave uitgeschakeld voor gebruiker <b>%s</b>",
fr: "Affichage d\xE9sactiv\xE9 pour l'utilisateur <b>%s</b>",
it: "Visualizza disabilitato per l'utente <b>%s</b>",
es: "Vista deshabilitada para el usuario <b>%s</b>",
pl: "Widok wy\u0142\u0105czony dla u\u017Cytkownika <b>%s</b>",
uk: "\u0412\u0456\u0434\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044F \u0432\u0438\u043C\u043A\u043D\u0435\u043D\u043E \u0434\u043B\u044F \u043A\u043E\u0440\u0438\u0441\u0442\u0443\u0432\u0430\u0447\u0430 <b>%s</b>",
"zh-cn": "\u7528\u6237<b>%s</b>\u7684\u89C6\u56FE\u5DF2\u505C\u7528"
},
Today: {
en: "Today",
de: "Heute",
ru: "C\u0435\u0433\u043E\u0434\u043D\u044F",
pt: "Hoje",
nl: "Vandaag",
fr: "Aujourd'hui",
it: "Oggi",
es: "Hoy",
pl: "Dzisiaj",
uk: "\u0421\u044C\u043E\u0433\u043E\u0434\u043D\u0456",
"zh-cn": "\u4ECA\u5929"
},
Yesterday: {
en: "Yesterday",
de: "Gestern",
ru: "\u0412\u0447\u0435\u0440\u0430\u0448\u043D\u0438\u0439 \u0434\u0435\u043D\u044C",
pt: "Ontem",
nl: "Gisteren",
fr: "Hier",
it: "Ieri",
es: "Ayer",
pl: "Wczoraj",
uk: "\u0412\u0447\u043E\u0440\u0430",
"zh-cn": "\u6628\u5929"
}
});
function createTheme(themeName, overrides) {
const danger = "#dd5325";
const success = "#73b6a8";
const theme = __mf_0(themeName, overrides);
theme.palette.text.danger = {
color: danger
};
theme.palette.text.success = {
color: success
};
const classes = {
blockHeader: {
fontSize: 16,
textAlign: "left",
marginTop: "8px",
borderRadius: "2px",
paddingLeft: "8px"
},
viewTabs: {
minHeight: 0
},
viewTab: {
minWidth: 0,
minHeight: 0
},
lightedPanel: {
backgroundColor: themeName === "dark" || themeName === "blue" || themeName === "NW" ? "hsl(0deg 0% 20%)" : "hsl(0deg 0% 90%)"
},
toolbar: {
display: "flex",
alignItems: "center",
paddingTop: "10px",
paddingBottom: "10px"
},
viewManageBlock: {
display: "flex",
alignItems: "center"
},
viewManageButtonActions: {
textAlign: "right",
flex: 1
}
};
if (!theme.classes) {
theme.classes = classes;
} else {
Object.assign(theme.classes, classes);
}
return theme;
}
function analyzeDraggableResizable(el, result, widgetStyle) {
result = result || {};
result.resizable = true;
result.draggable = true;
if (el == null ? void 0 : el.dataset) {
const resizableOptionsStr = el.dataset.visResizable;
if (resizableOptionsStr) {
let resizableOptions = null;
try {
resizableOptions = JSON.parse(resizableOptionsStr);
} catch {
console.error(`Cannot parse resizable options by ${el.getAttribute("id")}: ${JSON.stringify(resizableOptions)}`);
}
if (resizableOptions) {
if (resizableOptions.disabled !== void 0) {
result.resizable = !resizableOptions.disabled;
}
if (resizableOptions.handles !== void 0) {
result.resizeHandles = resizableOptions.handles.split(",").map((h) => h.trim());
}
}
if (widgetStyle && !result.resizable && (!widgetStyle.width || !widgetStyle.height)) {
result.virtualHeight = el.clientHeight;
result.virtualWidth = el.clientWidth;
}
}
const draggableOptionsStr = el.dataset.visDraggable;
if (draggableOptionsStr) {
let draggableOptions = null;
try {
draggableOptions = JSON.parse(draggableOptionsStr);
} catch {
console.error(`Cannot parse draggable options by ${el.getAttribute("id")}: ${JSON.stringify(draggableOptions)}`);
}
if (draggableOptions) {
if (draggableOptions.disabled !== void 0) {
result.draggable = !draggableOptions.disabled;
}
}
}
result.hideHelper = el.dataset.visHideHelper === "true";
}
return result;
}
class VisCanWidget extends VisBaseWidget {
refViews = {};
isCanWidget = true;
bindings;
IDs;
bindingsTimer = null;
filterDisplay;
lastState;
oldEditMode;
oldData;
oldStyle;
updateOnStyle;
constructor(props) {
super(props);
Object.assign(this.state, {
mounted: false,
legacyViewContainers: [],
hideHelper: false,
resizable: true,
draggable: true
});
this.setupSubscriptions();
props.context.linkContext.registerChangeHandler(props.id, this.changeHandler);
props.context.buildLegacyStructures();
}
setupSubscriptions() {
this.bindings = {};
const linkContext = {
IDs: [],
bindings: this.bindings,
visibility: this.props.context.linkContext.visibility,
lastChanges: this.props.context.linkContext.lastChanges,
signals: this.props.context.linkContext.signals
};
getUsedObjectIDsInWidget(this.props.context.views, this.props.view, this.props.id, linkContext);
this.IDs = linkContext.IDs;
Object.keys(this.bindings).forEach((id) => {
this.props.context.linkContext.bindings[id] = this.props.context.linkContext.bindings[id] || [];
this.bindings[id].forEach((item) => this.props.context.linkContext.bindings[id].push(item));
});
Object.keys(linkContext).forEach((attr) => linkContext[attr] = null);
}
componentDidMount() {
super.componentDidMount();
this.props.context.linkContext.subscribe(this.IDs);
if (!this.widDiv) {
this.renderWidget(void 0, void 0, void 0, void 0, () => {
const newState = {
mounted: true
};
if (this.props.context.allWidgets[this.props.id]) {
analyzeDraggableResizable(this.widDiv, newState, this.props.context.allWidgets[this.props.id].style);
}
this.setState(newState);
});
}
}
componentWillUnmount() {
super.componentWillUnmount();
if (this.props.context.linkContext) {
if (this.props.context.linkContext && this.props.context.linkContext.unregisterChangeHandler) {
this.props.context.linkContext.unregisterChangeHandler(this.props.id, this.changeHandler);
}
}
this.bindings = {};
if (this.props.context.linkContext) {
if (this.props.context.linkContext.unsubscribe) {
this.props.context.linkContext.unsubscribe(this.IDs);
}
VisBaseWidget.removeFromArray(this.props.context.linkContext.visibility, this.IDs, this.props.view, this.props.id);
VisBaseWidget.removeFromArray(this.props.context.linkContext.lastChanges, this.IDs, this.props.view, this.props.id);
VisBaseWidget.removeFromArray(this.props.context.linkContext.signals, this.IDs, this.props.view, this.props.id);
VisBaseWidget.removeFromArray(this.props.context.linkContext.bindings, this.IDs, this.props.view, this.props.id);
}
this.destroy();
}
static applyStyle(el, style, isSelected, editMode) {
if (typeof style === "string") {
const styleFromString = VisBaseWidget.parseStyle(style);
Object.keys(styleFromString).forEach((attr) => {
if (!attr.startsWith("_")) {
let value = styleFromString[attr];
if (attr === "top" || attr === "left" || attr === "width" || attr === "height") {
if (value !== "0" && value !== 0 && value !== null && value !== "" && value.toString().match(/^[+-]?([0-9]*[.])?[0-9]+$/)) {
value = `${value}px`;
}
}
if (attr.includes("-")) {
console.log(`${attr} to ${value}`);
attr = attr.replace(/-([a-z])/g, (g) => g[1].toUpperCase());
}
if (value) {
el.style[attr] = value;
} else if (el.style[attr]) {
el.style[attr] = "";
}
}
});
} else if (style) {
const styleObj = style;
Object.keys(styleObj).forEach((attr) => {
let value = styleObj[attr];
if (attr && value !== void 0 && value !== null && !attr.startsWith("_")) {
if (attr === "top" || attr === "left" || attr === "width" || attr === "height") {
if (value !== "0" && value !== 0 && value !== null && value !== "" && value.toString().match(/^[+-]?([0-9]*[.])?[0-9]+$/)) {
value = `${value}px`;
}
}
if (attr.includes("-")) {
attr = attr.replace(/-([a-z])/g, (g) => g[1].toUpperCase());
}
if (value) {
el.style[attr] = value;
} else if (el.style[attr]) {
el.style[attr] = "";
}
}
});
if (editMode) {
if (isSelected) {
el.style.zIndex = (500 + (parseInt(styleObj["z-index"], 10) || 0)).toString();
}
const zIndex = parseInt(el.style.zIndex, 10) || 0;
const overlay = el.parentNode.querySelector(`#rx_${el.id}`);
if (overlay) {
overlay.style.zIndex = (zIndex + 1).toString();
}
el.style.userSelect = "none";
el.style.pointerEvents = "none";
}
if (el.style.position === "absolute") {
if (!el.style.top) {
el.style.top = "0px";
}
if (!el.style.left) {
el.style.left = "0px";
}
}
}
}
onCommand(command, options) {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
const result = super.onCommand(command, options);
if (result === false) {
if (command === "updatePosition") {
if (this.refService.current && this.widDiv) {
this.refService.current.style.width = `${this.widDiv.offsetWidth}px`;
this.refService.current.style.height = `${this.widDiv.offsetHeight}px`;
this.refService.current.style.left = `${this.widDiv.offsetLeft}px`;
this.refService.current.style.top = `${this.widDiv.offsetTop}px`;
}
} else if (command === "updateContainers") {
const containers = this.widDiv.querySelectorAll(".vis-view-container");
if (containers.length) {
const legacyViewContainers = [];
for (let v = 0; v < containers.length; v++) {
const view = (containers[v].dataset.visContains || "").trim();
if (view && view !== "undefined" && view !== "null") {
legacyViewContainers.push(view);
containers[v].className = addClass$1(containers[v].className, "vis-editmode-helper");
}
}
legacyViewContainers.sort();
if (JSON.stringify(legacyViewContainers) !== JSON.stringify(this.state.legacyViewContainers)) {
this.setState({
legacyViewContainers
});
}
}
} else if (command === "changeFilter") {
if (!this.widDiv) {
return null;
}
if (!((_a = options == null ? void 0 : options.filter) == null ? void 0 : _a.length)) {
if (this.filterDisplay !== void 0) {
this.widDiv.style.display = this.filterDisplay;
if ((_b = this.widDiv._customHandlers) == null ? void 0 : _b.onShow) {
this.widDiv._customHandlers.onShow(this.widDiv, this.props.id);
}
}
} else if (options.filter[0] === "$") {
if ((_d = (_c = this.props.context.allWidgets[this.props.id]) == null ? void 0 : _c.data) == null ? void 0 : _d.filterkey) {
if (this.widDiv.style.display !== "none") {
this.filterDisplay = this.widDiv.style.display;
this.widDiv.style.display = "none";
if ((_e = this.widDiv._customHandlers) == null ? void 0 : _e.onHide) {
this.widDiv._customHandlers.onHide(this.widDiv, this.props.id);
}
}
}
} else {
const wFilters = (_f = this.props.context.allWidgets[this.props.id]) == null ? void 0 : _f.data.filterkey;
if (wFilters) {
let found = false;
for (let w = 0; w < wFilters.length; w++) {
if (options.filter.includes(wFilters[w])) {
found = true;
break;
}
}
if (!found) {
if (this.widDiv.style.display !== "none") {
this.filterDisplay = this.widDiv.style.display;
this.widDiv.style.display = "none";
if ((_g = this.widDiv._customHandlers) == null ? void 0 : _g.onHide) {
(_h = this.widDiv._customHandlers) == null ? void 0 : _h.onHide(this.widDiv, this.props.id);
}
}
} else if (this.filterDisplay !== void 0 && this.widDiv.style.display === "none") {
this.widDiv.style.display = this.filterDisplay;
if ((_i = this.widDiv._customHandlers) == null ? void 0 : _i.onShow) {
(_j = this.widDiv._customHandlers) == null ? void 0 : _j.onShow(this.widDiv, this.props.id);
}
}
}
}
} else if (command === "collectFilters") {
return (_l = (_k = this.props.context.allWidgets[this.props.id]) == null ? void 0 : _k.data) == null ? void 0 : _l.filterkey;
}
}
return result;
}
destroy(update) {
if (this.props.context.allWidgets[this.props.id]) {
delete this.props.context.allWidgets[this.props.id];
}
if (this.widDiv && (!update || !this.props.id.startsWith("g"))) {
const $wid = this.props.context.jQuery(this.widDiv);
const destroy = $wid.data("destroy");
if (typeof destroy === "function") {
destroy(this.props.id, $wid);
$wid.data("destroy", null);
}
this.widDiv.remove();
this.widDiv = null;
}
}
changeHandler = (type, item, stateId) => {
if (this.widDiv) {
if (type === "style") {
if (this.props.context.allWidgets[this.props.id]) {
VisCanWidget.applyStyle(this.widDiv, this.props.context.allWidgets[this.props.id].style, this.state.selected, this.state.editMode);
}
} else if (type === "signal") {
this.updateSignal(item);
} else if (type === "visibility") {
this.updateVisibility();
} else if (type === "lastChange") {
this.updateLastChange();
} else if (type === "binding") {
this.applyBinding(stateId);
}
}
};
updateSignal(item) {
if (this.widDiv) {
const signalDiv = this.widDiv.querySelector(`.vis-signal[data-index="${item.index}"]`);
if (signalDiv) {
if (this.isSignalVisible(item.index)) {
signalDiv.style.display = "";
} else {
signalDiv.style.display = "none";
}
}
}
}
updateLastChange() {
var _a;
if (this.widDiv) {
const widgetData = (_a = this.props.context.allWidgets[this.props.id]) == null ? void 0 : _a.data;
if (widgetData) {
const lcDiv = this.widDiv.querySelector(".vis-last-change");
if (lcDiv) {
lcDiv.innerHTML = window.vis.binds.basic.formatDate(this.props.context.canStates.attr(`${widgetData["lc-oid"]}.${widgetData["lc-type"] === "last-change" ? "lc" : "ts"}`), widgetData["lc-format"], widgetData["lc-is-interval"], widgetData["lc-is-moment"]);
} else {
console.warn(`[${this.props.id}] Last change not found!`);
}
}
}
}
updateVisibility() {
var _a;
if (this.widDiv && !this.state.editMode) {
const widgetData = (_a = this.props.context.allWidgets[this.props.id]) == null ? void 0 : _a.data;
if (widgetData) {
if (VisBaseWidget.isWidgetHidden(widgetData, this.props.context.canStates, this.props.id) || this.isWidgetFilteredOut(widgetData)) {
this.widDiv._storedDisplay = this.widDiv.style.display;
this.widDiv.style.display = "none";
if (this.widDiv && this.widDiv._customHandlers && this.widDiv._customHandlers.onHide) {
this.widDiv._customHandlers.onHide(this.widDiv, this.props.id);
}
} else {
this.widDiv.style.display = this.widDiv._storedDisplay || "";
this.widDiv._storedDisplay = "";
if (this.widDiv && this.widDiv._customHandlers && this.widDiv._customHandlers.onShow) {
this.widDiv._customHandlers.onShow(this.widDiv, this.props.id);
}
}
}
}
}
isSignalVisible(index, widgetData) {
widgetData = widgetData || this.props.context.allWidgets[this.props.id].data;
if (!widgetData) {
return false;
}
if (this.state.editMode) {
return !widgetData[`signals-hide-edit-${index}`];
}
const oid = widgetData[`signals-oid-${index}`];
if (oid) {
const val = this.props.context.canStates.attr(`${oid}.val`);
const condition = widgetData[`signals-cond-${index}`];
let value = widgetData[`signals-val-${index}`];
if (val === void 0 || val === null) {
return condition === "not exist";
}
if (!condition || value === void 0 || value === null) {
return condition === "not exist";
}
if (val === "null" && condition !== "exist" && condition !== "not exist") {
return false;
}
let valNotNull = val;
const t = typeof valNotNull;
if (t === "boolean" || val === "false" || val === "true") {
value = value === "true" || value === true || value === 1 || value === "1";
} else if (t === "number") {
value = parseFloat(value);
} else if (t === "object") {
valNotNull = JSON.stringify(valNotNull);
}
switch (condition) {
case "==":
value = value.toString();
valNotNull = valNotNull.toString();
if (valNotNull === "1") {
valNotNull = "true";
}
if (value === "1") {
value = "true";
}
if (valNotNull === "0") {
valNotNull = "false";
}
if (value === "0") {
value = "false";
}
return value === valNotNull;
case "!=":
value = value.toString();
valNotNull = valNotNull.toString();
if (valNotNull === "1") {
valNotNull = "true";
}
if (value === "1") {
value = "true";
}
if (valNotNull === "0") {
valNotNull = "false";
}
if (value === "0") {
value = "false";
}
return value !== valNotNull;
case ">=":
return valNotNull >= value;
case "<=":
return valNotNull <= value;
case ">":
return valNotNull > value;
case "<":
return valNotNull < value;
case "consist":
value = value.toString();
valNotNull = valNotNull.toString();
return valNotNull.toString().includes(value);
case "not consist":
value = value.toString();
valNotNull = valNotNull.toString();
return !valNotNull.toString().includes(value);
case "exist":
return value !== "null";
case "not exist":
return value === "null";
default:
console.log(`[${this.props.id}] Unknown signals condition: ${condition}`);
return false;
}
} else {
return false;
}
}
addSignalIcon(widgetData, index) {
var _a;
widgetData || (widgetData = (_a = this.props.context.allWidgets[this.props.id]) == null ? void 0 : _a.data);
if (!widgetData) {
return;
}
const divSignal = window.document.createElement("div");
divSignal.className = `vis-signal ${widgetData[`signals-blink-${index}`] ? "vis-signals-blink" : ""} ${widgetData[`signals-text-class-${index}`] || ""}`;
divSignal.dataset.index = index.toString();
divSignal.style.display = this.isSignalVisible(index) ? "" : "none";
divSignal.style.pointerEvents = "none";
divSignal.style.position = "absolute";
divSignal.style.zIndex = "10";
divSignal.style.top = `${widgetData[`signals-vert-${index}`] || 0}%`;
divSignal.style.left = `${widgetData[`signals-horz-${index}`] || 0}%`;
const divIcon = window.document.createElement("img");
divIcon.className = "vis-signal-icon";
let src = widgetData[`signals-icon-${index}`];
if (src) {
if (src.startsWith("/vis/")) {
src = src.substring(5);
} else if (src.startsWith("/vis-2/")) {
src = src.substring(5);
} else if (src.startsWith("/vis-2-beta/")) {
src = src.substring(12);
}
}
divIcon.src = src;
divIcon.style.width = `${widgetData[`signals-icon-size-${index}`] || 32}px`;
divIcon.style.height = "auto";
VisCanWidget.applyStyle(divIcon, widgetData[`signals-icon-style-${index}`]);
divSignal.appendChild(divIcon);
const text = widgetData[`signals-text-${index}`];
if (text) {
const divText = window.document.createElement("div");
const val = this.props.context.canStates.attr(`${widgetData[`signals-oid-${index}`]}.val`);
divText.className = "vis-signal-text";
VisCanWidget.applyStyle(divText, widgetData[`signals-text-style-${index}`]);
divText.innerHTML = text.replace("%s", (val ?? "").toString());
divSignal.appendChild(divText);
}
this.widDiv.appendChild(divSignal);
}
addLastChange(widgetData) {
const border = `${parseInt(widgetData["lc-border-radius"], 10) || 0}px`;
const css = {
background: "rgba(182,182,182,0.6)",
fontFamily: "Tahoma",
position: "absolute",
zIndex: 0,
borderRadius: widgetData["lc-position-horz"] === "left" ? `${border} 0 0 ${border}` : widgetData["lc-position-horz"] === "right" ? `0 ${border} ${border} 0` : border,
whiteSpace: "nowrap"
};
if (widgetData["lc-font-size"]) {
css.fontSize = widgetData["lc-font-size"];
}
if (widgetData["lc-font-style"]) {
css.fontStyle = widgetData["lc-font-style"];
}
if (widgetData["lc-font-family"]) {
css.fontFamily = widgetData["lc-font-family"];
}
if (widgetData["lc-bkg-color"]) {
css.background = widgetData["lc-bkg-color"];
}
if (widgetData["lc-color"]) {
css.color = widgetData["lc-color"];
}
if (widgetData["lc-border-width"]) {
css.borderWidth = parseInt(widgetData["lc-border-width"], 10) || 0;
}
if (widgetData["lc-border-style"]) {
css.borderStyle = widgetData["lc-border-style"];
}
if (widgetData["lc-border-color"]) {
css.borderColor = widgetData["lc-border-color"];
}
if (widgetData["lc-padding"]) {
css.padding = widgetData["lc-padding"];
} else {
css.paddingTop = 3;
css.paddingBottom = 3;
}
if (widgetData["lc-zindex"]) {
css.zIndex = widgetData["lc-zindex"];
}
if (widgetData["lc-position-vert"] === "top") {
css.top = `${parseInt(widgetData["lc-offset-vert"], 10)}px`;
} else if (widgetData["lc-position-vert"] === "bottom") {
css.bottom = `${parseInt(widgetData["lc-offset-vert"], 10)}px`;
} else if (widgetData["lc-position-vert"] === "middle") {
css.top = `calc(50% + ${parseInt(widgetData["lc-offset-vert"], 10) - 10}px)`;
}
const offset2 = parseFloat(widgetData["lc-offset-horz"]) || 0;
if (widgetData["lc-position-horz"] === "left") {
css.right = `calc(100% - ${offset2}px)`;
if (!widgetData["lc-padding"]) {
css.paddingRight = 10;
css.paddingLeft = 10;
}
} else if (widgetData["lc-position-horz"] === "right") {
css.left = `calc(100% + ${offset2}px)`;
if (!widgetData["lc-padding"]) {
css.paddingRight = 10;
css.paddingLeft = 10;
}
} else if (widgetData["lc-position-horz"] === "middle") {
css.left = `calc(50% + ${offset2}px)`;
}
const divLastChange = window.document.createElement("div");
divLastChange.className = "vis-last-change";
divLastChange.innerHTML = this.formatDate(this.props.context.canStates.attr(`${widgetData["lc-oid"]}.${widgetData["lc-type"] === "last-change" ? "lc" : "ts"}`), widgetData["lc-format"], widgetData["lc-is-interval"], widgetData["lc-is-moment"]);
Object.keys(css).forEach((attr) => divLastChange.style[attr] = css[attr]);
this.widDiv.prepend(divLastChange);
calculateOverflow(this.widDiv.style);
}
addChart(widgetData) {
this.widDiv.onclick = () => {
console.log(`[${this.props.id}] Show dialog with chart for ${widgetData["echart-oid"]}`);
};
}
applyBindings(doNotApplyStyles, widgetData, widgetStyle) {
Object.keys(this.bindings).forEach((id) => this.applyBinding(id, doNotApplyStyles, widgetData, widgetStyle));
}
applyBinding(stateId, doNotApplyStyles, widgetData, widgetStyle) {
const widgetContext = this.props.context.allWidgets[this.props.id];
if (!widgetContext && (!widgetData || !widgetStyle)) {
return;
}
const widget = this.props.context.views[this.props.view].widgets[this.props.id];
this.bindings[stateId].forEach((item) => {
widgetStyle = widgetStyle || widgetContext.style;
const value = this.props.context.formatUtils.formatBinding({
format: item.format,
view: item.view,
wid: this.props.id,
widget,
widgetData: widgetData || widgetContext.data,
moment: this.props.context.moment
});
if (item.type === "data") {
if (widgetData) {
widgetData[item.attr] = value;
} else if (widgetContext) {
widgetContext.data.attr(item.attr, value);
}
} else if (item.type === "style") {
if (widgetStyle) {
widgetStyle[item.attr] = value;
!doNotApplyStyles && VisCanWidget.applyStyle(this.widDiv, widgetStyle, this.state.selected, this.state.editMode);
} else if (widgetContext) {
widgetContext.style.attr(item.attr, value);
!doNotApplyStyles && VisCanWidget.applyStyle(this.widDiv, widgetContext.style, this.state.selected, this.state.editMode);
}
}
});
}
calcData(wid, widget, newWidgetStyle) {
let widgetData;
let widgetStyle;
let isRelative;
try {
widgetData = {
wid,
...widget.data || {}
};
widgetStyle = deepClone(newWidgetStyle || widget.style || {});
Object.keys(widgetData).forEach((attr) => {
if (attr && widgetData[attr] && typeof widgetData[attr] === "string" && (attr.startsWith("src") || attr.endsWith("src") || attr.includes("icon")) && widgetData[attr].startsWith("_PRJ_NAME")) {
widgetData[attr] = `../${this.props.context.adapterName}.${this.props.context.instance}/${this.props.context.projectName}${widgetData[attr].substring(9)}`;
}
});
if (widgetStyle["background-image"] && widgetStyle["background-image"].startsWith("_PRJ_NAME")) {
widgetStyle["background-image"] = `../${this.props.context.adapterName}.${this.props.context.instance}/${this.props.context.projectName}${widgetStyle["background-image"].substring(9)}`;
}
this.applyBindings(true, widgetData, widgetStyle);
if (widgetData.filterkey && typeof widgetData.filterkey === "string") {
widgetData.filterKeyParsed = widgetData.filterkey.split(",").map((f) => f.trim()).filter((f) => f);
}
isRelative = this.props.isRelative !== void 0 ? this.props.isRelative : widgetStyle && (widgetStyle.position === "relative" || widgetStyle.position === "static" || widgetStyle.position === "sticky");
if (isRelative) {
delete widgetStyle.top;
delete widgetStyle.left;
if (isVarFinite(this.props.context.views[this.props.view].settings.rowGap)) {
widgetStyle["margin-bottom"] = `${parseFloat(this.props.context.views[this.props.view].settings.rowGap)}px`;
}
}
if (this.state.multiViewWidget && this.state.editMode) {
if (widgetStyle.opacity === void 0 || widgetStyle.opacity === null || widgetStyle.opacity > 0.3) {
widgetStyle.opacity = 0.3;
}
}
} catch (e) {
console.warn(`[${wid}] Cannot bind data of widget: ${e}`);
return {
widgetData: null,
widgetStyle: null,
isRelative: false
};
}
return {
widgetData,
widgetStyle,
isRelative
};
}
renderWidget(update, newWidgetData, newWidgetStyle, _count, cb) {
var _a;
_count = _count || 0;
const parentDivRef = this.props.refParent;
let parentDiv;
if (Object.prototype.hasOwnProperty.call(parentDivRef, "current")) {
parentDiv = parentDivRef.current;
} else {
console.log("IT does EXIST!!!. CHECK ME!");
parentDiv = parentDivRef;
}
if (!parentDiv) {
if (_count < 5) {
setTimeout(() => this.renderWidget(update, newWidgetData, newWidgetStyle, _count + 1, cb), 50);
}
return;
}
const wid = this.props.id;
let widget = this.props.context.views[this.props.view].widgets[wid];
if (!widget || typeof widget !== "object") {
return;
}
if (widget == null ? void 0 : widget.groupid) {
const parentWidgetData = this.props.context.views[this.props.view].widgets[widget.groupid].data;
const names = Object.keys(parentWidgetData).map((attr) => attr.startsWith("attrType_") ? attr.substring(9) : null).filter((attr) => attr);
if (names.length && widget.data) {
let copied = false;
Object.keys(widget.data).forEach((attr) => {
if (typeof widget.data[attr] === "string" && names.find((a) => widget.data[attr].includes(a))) {
const result = replaceGroupAttr(widget.data[attr], parentWidgetData);
if (result.doesMatch) {
if (!copied) {
copied = true;
widget = JSON.parse(JSON.stringify(widget));
}
widget.data[attr] = result.newString || "";
}
}
});
}
}
if (!update) {
const { isRelative: isRelative2, widgetData: widgetData2, widgetStyle: widgetStyle2 } = this.calcData(wid, widget, newWidgetStyle);
const newData2 = JSON.stringify(widgetData2);
const newStyle2 = JSON.stringify(widgetStyle2);
if (this.widDiv) {
if (this.oldEditMode === this.state.editMode) {
if (this.oldData === newData2 && !update) {
if (this.oldStyle === newStyle2 || widgetData2._no_style) {
return;
}
if (!this.updateOnStyle) {
this.oldStyle = newStyle2;
if (this.props.context.allWidgets[wid] && this.props.context.allWidgets[wid].style) {
const mStyle = this.props.context.allWidgets[wid].style;
Object.keys(widgetStyle2).forEach((attr) => {
if (typeof widgetStyle2[attr] === "function") {
return;
}
if (mStyle[attr] !== widgetStyle2[attr]) {
mStyle.attr(attr, widgetStyle2[attr]);
}
});
}
VisCanWidget.applyStyle(this.widDiv, widgetStyle2, this.state.selected, this.state.editMode);
this.widDiv.style.position = isRelative2 ? widgetStyle2.position || "relative" : "absolute";
console.log("Rerender ignored as only style applied");
return;
}
}
}
}
}
this.destroy(update);
const oldIDs = this.IDs;
VisBaseWidget.removeFromArray(this.props.context.linkContext.visibility, this.IDs, this.props.view, wid);
VisBaseWidget.removeFromArray(this.props.context.linkContext.lastChanges, this.IDs, this.props.view, wid);
VisBaseWidget.removeFromArray(this.props.context.linkContext.signals, this.IDs, this.props.view, wid);
VisBaseWidget.removeFromArray(this.props.context.linkContext.bindings, this.IDs, this.props.view, wid);
this.setupSubscriptions();
const unsubscribe = oldIDs.filter((id) => !this.IDs.includes(id));
if (unsubscribe.length) {
this.props.context.linkContext.unsubscribe(unsubscribe);
}
const subscribe = this.IDs.filter((id) => !oldIDs.includes(id));
if (subscribe.length) {
this.props.context.linkContext.subscribe(subscribe);
}
const { isRelative, widgetData, widgetStyle } = this.calcData(wid, widget, newWidgetStyle);
const newData = JSON.stringify(widgetData);
const newStyle = JSON.stringify(widgetStyle);
this.oldEditMode = this.state.editMode;
this.oldData = newData;
this.oldStyle = newStyle;
widgetData.wid = wid;
this.props.context.allWidgets[wid] = {
style: new this.props.context.can.Map(widgetStyle),
data: new this.props.context.can.Map(widgetData),
wid
};
let userGroups = widgetData["visibility-groups"];
if (!this.state.editMode && (userGroups == null ? void 0 : userGroups.length)) {
if (widgetData["visibility-groups-action"] === "hide") {
if (!this.isUserMemberOfGroup(this.props.context.user, userGroups)) {
return;
}
userGroups = null;
}
} else {
userGroups = null;
}
try {
if (this.props.tpl) {
if (!this.widDiv || !update || !((_a = widget == null ? void 0 : widget.data) == null ? void 0 : _a.members.length)) {
const options = {
data: this.props.context.allWidgets[wid].data,
viewDiv: this.props.view,
view: this.props.view,
style: this.props.context.allWidgets[wid].style
};
if (widgetData == null ? void 0 : widgetData.oid) {
options.val = this.props.context.canStates.attr(`${widgetData.oid}.val`);
}
const widgetFragment = this.props.context.can.view(this.props.tpl, options);
const scripts = Array.from(widgetFragment.querySelectorAll("script"));
for (let i = 0; i < scripts.length; i++) {
const script = scripts[i];
const newScript = document.createElement("script");
newScript.innerHTML = script.innerHTML;
script.parentNode.replaceChild(newScript, script);
}
if (isRelative) {
const pos = this.props.relativeWidgetOrder.indexOf(wid);
if (pos === 0) {
parentDiv.prepend(widgetFragment);
} else if (pos === this.props.relativeWidgetOrder.length - 1) {
parentDiv.appendChild(widgetFragment);
} else {
let div;
for (let i = pos + 1; i < this.props.relativeWidgetOrder.length; i++) {
div = parentDiv.querySelector(`#${this.props.relativeWidgetOrder[i]}`);
if (div) {
parentDiv.insertBefore(widgetFragment, div);
break;
}
}
if (!div) {
parentDiv.appendChild(widgetFragment);
}
}
} else {
parentDiv.appendChild(widgetFragment);
}
}
} else {
console.error(`[${wid}] Widget is invalid. Please delete it.`);
return;
}
this.widDiv = parentDiv.querySelector(`#${wid}`);
if (this.widDiv) {
if (this.props.context.allWidgets[wid].style && !widgetData._no_style) {
VisCanWidget.applyStyle(this.widDiv, this.props.context.allWidgets[wid].style, this.state.selected, this.state.editMode);
}
this.widDiv.style.position = isRelative ? this.props.context.allWidgets[wid].style.position || "relative" : "absolute";
this.widDiv.style.boxSizing = "border-box";
if (widgetData && widgetData.class) {
this.widDiv.className = addClass$1(this.widDiv.className, widgetData.class);
}
const tplEl = window.document.getElementById(this.props.tpl);
const visName = tplEl.dataset.visName || (wid[0] === "g" ? "group" : "noname");
const visSet = tplEl.dataset.visSet || "noset";
this.updateOnStyle = tplEl.dataset.visUpdateStyle === "true";
this.resizeLocked = tplEl.dataset.visResizeLocked === "true";
this.widDiv.className = addClass$1(this.widDiv.className, `vis-tpl-${visSet}-${visName.replace(/\s/g, "-")}`);
if (!this.state.editMode) {
this.updateVisibility();
} else if (this.props.context.allWidgets[this.props.id]) {
const newState = analyzeDraggableResizable(this.widDiv, null, this.props.context.allWidgets[this.props.id].style);
if (this.state.resizable !== newState.resizable || this.state.hideHelper !== newState.hideHelper || this.state.draggable !== newState.draggable) {
setTimeout(() => this.setState(newState), 50);
}
}
let s = 0;
while (widgetData[`signals-oid-${s}`]) {
this.addSignalIcon(widgetData, s);
s++;
}
if (widgetData["lc-oid"] && widgetData["lc-oid"] !== "nothing_selected") {
this.addLastChange(widgetData);
}
if (!this.state.editMode && widgetData["echart-oid"]) {
this.addChart(widgetData);
}
if (userGroups && widget.data["visibility-groups-action"] === "disabled" && !this.isUserMemberOfGroup(this.props.context.user, userGroups)) {
this.widDiv.className = addClass$1(this.widDiv.className, "vis-user-disabled");
}
if (this.refService.current) {
setTimeout(() => {
if (this.refService.current && this.widDiv) {
this.refService.current.style.width = `${this.widDiv.offsetWidth}px`;
this.refService.current.style.height = `${this.widDiv.offsetHeight}px`;
if (isRelative) {
this.refService.current.style.left = `${this.widDiv.offsetLeft}px`;
this.refService.current.style.top = `${this.widDiv.offsetTop}px`;
}
}
}, 50);
}
this.onCommand("updateContainers");
} else {
console.log("Div not yet rendered");
}
this.props.askView && this.props.askView("register", {
id: wid,
widDiv: this.widDiv || null,
refService: this.refService,
onMove: this.onMove,
onResize: this.onResize,
onTempSelect: this.onTempSelect,
onCommand: this.onCommandBound
});
} catch (e) {
const lines = (e.toString() + e.stack.toString()).split("\n");
const error = `can't render ${this.props.tpl} ${wid} on "${this.props.view}": `;
this.props.context.socket.log(error, "error");
console.error(error);
for (let l = 0; l < lines.length; l++) {
const line = `${l} - ${lines[l]}`;
this.props.context.socket.log(line, "error");
console.error(line);
}
}
cb && cb();
}
shouldComponentUpdate(_nextProps, nextState) {
const lastState = JSON.stringify(nextState);
if (!this.widDiv) {
this.lastState = lastState;
return true;
}
if (!this.lastState || lastState !== this.lastState) {
this.lastState = lastState;
return true;
}
return false;
}
renderWidgetBody(props) {
if (this.state.applyBindings && !this.bindingsTimer) {
this.bindingsTimer = setTimeout(() => {
this.bindingsTimer = null;
this.renderWidget(true);
}, 10);
}
if (this.widDiv && this.state.editMode && this.props.context.allWidgets[this.props.id]) {
const zIndexProp = this.props.context.allWidgets[this.props.id].style["z-index"];
const zIndex = parseInt(zIndexProp || 0, 10);
if (this.state.selected) {
this.widDiv.style.zIndex = (500 + (zIndex || 0)).toString();
} else if (zIndexProp !== void 0) {
this.widDiv.style.zIndex = parseInt(zIndexProp || 0, 10).toString();
}
if (this.state.selected) {
props.style.zIndex = 500 + (zIndex || 0) + 1;
} else {
props.style.zIndex = (zIndex || 0) + 1;
}
this.widDiv.style.userSelect = "none";
this.widDiv.style.pointerEvents = "none";
if (this.filterDisplay !== void 0) {
this.widDiv.style.display = this.filterDisplay;
delete this.filterDisplay;
}
}
props.style.position = "absolute";
const legacyViewContainers = this.state.legacyViewContainers.length ? this.state.legacyViewContainers.map((view) => {
const context = this.props.context;
const VisView2 = context.VisView;
this.refViews[view] = this.refViews[view] || React.createRef();
const otherRef = context.linkContext.getViewRef(view);
if (otherRef && otherRef !== this.refViews[view]) {
console.log("View is not rendered as used somewhere else!");
return null;
}
if (view && context.views[view]) {
return jsxRuntimeExports.jsx(VisView2, {
context,
activeView: view,
editMode: false,
view,
visInWidget: true,
theme: this.props.context.theme,
viewsActiveFilter: this.props.viewsActiveFilter
}, view);
}
return null;
}) : null;
if (!this.state.editMode) {
props.style.display = "none";
}
return legacyViewContainers;
}
}
const MENU_WIDTH_FULL = 200;
const MENU_WIDTH_NARROW = 56;
const TOOLBAR_SIZE = 48;
const styles$3 = {
root: {
width: "100%",
height: "100%",
display: "flex",
position: "relative"
},
rootHorizontal: {
width: "100%",
height: "100%",
display: "flex",
position: "relative",
flexDirection: "column"
},
toolBar: (theme) => ({
width: "100%",
height: TOOLBAR_SIZE,
overflow: "hidden",
lineHeight: `${TOOLBAR_SIZE}px`,
pl: "16px",
fontSize: 20,
backgroundColor: theme.palette.primary.main,
color: theme.palette.primary.contrastText,
transition: "padding-left 0.4s ease-in-out",
display: "flex",
alignItems: "center",
gap: 8
}),
toolbarIcon: {
height: 32,
width: "auto"
},
verticalMenu: (theme) => ({
width: "100%",
top: 0,
left: 0,
height: TOOLBAR_SIZE,
overflow: "hidden",
lineHeight: `${TOOLBAR_SIZE}px`,
backgroundColor: theme.palette.primary.main,
zIndex: 450
}),
toolBarWithClosedMenu: {
paddingLeft: `${16 + TOOLBAR_SIZE}px`
},
viewContentWithToolbar: {
position: "relative",
height: `calc(100% - ${TOOLBAR_SIZE}px)`,
width: "100%"
},
viewContentWithoutToolbar: {
position: "relative",
height: "100%",
width: "100%"
},
openMenuButton: {
position: "absolute",
top: 5,
width: TOOLBAR_SIZE,
height: TOOLBAR_SIZE,
zIndex: 999,
transition: "all 0.4s ease-in-out"
},
openMenuButtonFull: {},
openMenuButtonNarrow: {
left: 9
},
openMenuButtonHidden: {
left: 9,
opacity: 0.5
},
openMenuButtonIconHidden: {
transform: "rotate(180deg)",
transformOrigin: "center",
transition: "all 0.3s ease-in-out"
},
menu: {
transition: "width 0.4s ease-in-out, opacity 0.3s ease-in-out"
},
menuFull: {
height: "100%",
display: "inline-block",
overflow: "hidden",
opacity: 1
},
menuNarrow: {
width: MENU_WIDTH_NARROW,
height: "100%",
display: "inline-block",
overflow: "hidden",
opacity: 1
},
menuHidden: {
width: 0,
height: "100%",
display: "inline-block",
opacity: 0
},
afterMenu: {
transition: "width 0.4s ease-in-out"
},
afterMenuFull: {
height: "100%",
display: "inline-block"
},
afterMenuNarrow: {
width: `calc(100% - ${MENU_WIDTH_NARROW}px)`,
height: "100%",
display: "inline-block"
},
afterMenuHidden: {
width: "100%",
height: "100%",
display: "inline-block"
},
menuList: {
width: "100%",
height: "calc(100% - 49px)",
overflowY: "auto",
overflowX: "hidden"
},
menuItem: {
minHeight: TOOLBAR_SIZE
},
listItemIcon: {
width: 24,
height: 24
},
listItemIconText: {
paddingLeft: 8,
opacity: 1,
transition: "opacity 0.3s ease-in-out",
position: "absolute",
top: 12,
left: 16
},
listItemText: {
whiteSpace: "nowrap",
transition: "all 0.3s ease-in-out",
opacity: 1
},
listItemTextNarrow: {
opacity: 0
},
selectedMenu: (theme) => ({
backgroundColor: theme.palette.secondary.main,
color: theme.palette.secondary.contrastText
}),
menuToolbar: {
height: TOOLBAR_SIZE,
display: "flex",
lineHeight: `${TOOLBAR_SIZE}px`,
verticalAlign: "middle",
paddingLeft: 16,
fontSize: 20,
whiteSpace: "nowrap",
transition: "opacity 0.3s ease-in-out"
},
menuToolbarFull: {
opacity: 1
},
menuToolbarNarrow: {
opacity: 0
},
transparent: {
opacity: 0
}
};
class VisNavigation extends React.Component {
renderMenu(settings, menuFullWidth) {
const items = [];
Object.keys(this.props.context.views).forEach((view) => {
var _a;
if (view === "___settings") {
return;
}
const viewSettings = this.props.context.views[view].settings;
if (viewSettings.navigation) {
const item = {
text: settings.navigationOrientation === "horizontal" && viewSettings.navigationOnlyIcon ? null : viewSettings.navigationTitle || view,
color: viewSettings.navigationColor,
icon: viewSettings.navigationIcon || viewSettings.navigationImage,
noText: viewSettings.navigationOnlyIcon,
order: parseInt(viewSettings.navigationOrder || "0"),
view
};
items.push(item);
if ((_a = item.icon) == null ? void 0 : _a.startsWith("_PRJ_NAME/")) {
item.icon = `../${this.props.context.adapterName}.${this.props.context.instance}/${this.props.context.projectName}${item.icon.substring(9)}`;
}
}
});
items.sort((prevItem, nextItem) => prevItem.order === nextItem.order ? 0 : prevItem.order < nextItem.order ? -1 : 1);
if (settings.navigationOrientation === "horizontal") {
return jsxRuntimeExports.jsx(__mf_14, {
component: "div",
sx: styles$3.verticalMenu,
style: {
backgroundColor: settings.navigationBarColor || this.props.context.theme.palette.background.paper,
opacity: this.props.editMode ? 0.4 : 1,
position: this.props.context.runtime ? "fixed" : "relative"
},
children: jsxRuntimeExports.jsx(__mf_120, {
value: this.props.activeView,
children: items.map((item, index) => jsxRuntimeExports.jsx(__mf_109, {
iconPosition: "start",
style: {
minHeight: 48,
minWidth: item.noText ? 20 : void 0,
color: this.props.activeView === item.view ? settings.navigationSelectedColor : settings.navigationColor
},
icon: item.icon ? jsxRuntimeExports.jsx(__mf_15, {
src: item.icon,
style: {
...styles$3.listItemIcon,
color: this.props.activeView === item.view ? settings.navigationSelectedColor : settings.navigationColor
}
}) : void 0,
onClick: () => this.props.context.changeView(item.view),
value: item.view,
label: item.text
}, index))
})
});
}
const menuStyle = {
...styles$3.menu,
width: this.props.menuWidth === "full" ? menuFullWidth : void 0,
...this.props.menuWidth === "full" ? styles$3.menuFull : void 0,
...this.props.menuWidth === "narrow" ? styles$3.menuNarrow : void 0,
...this.props.menuWidth === "hidden" ? styles$3.menuHidden : void 0,
opacity: this.props.editMode ? 0.4 : 1,
backgroundColor: settings.navigationBackground || void 0
};
if (settings.navigationHideOnSelection) {
menuStyle.zIndex = 998;
menuStyle.position = this.props.context.runtime ? "fixed" : "absolute";
menuStyle.top = 0;
menuStyle.left = 0;
menuStyle.backgroundColor = settings.navigationBackground || this.props.context.theme.palette.background.paper;
}
const menuToolbarStyle = {
...styles$3.menuToolbar,
...this.props.menuWidth === "full" ? styles$3.menuToolbarFull : void 0,
...this.props.menuWidth === "narrow" ? styles$3.menuToolbarNarrow : void 0,
...this.props.menuWidth === "hidden" ? styles$3.menuToolbarNarrow : void 0,
color: settings.navigationHeaderTextColor || void 0
};
return jsxRuntimeExports.jsxs("div", {
style: menuStyle,
children: [
jsxRuntimeExports.jsx("div", {
style: menuToolbarStyle,
children: settings.navigationHeaderText || ""
}),
jsxRuntimeExports.jsx(__mf_37, {}),
jsxRuntimeExports.jsx("div", {
style: styles$3.menuList,
children: jsxRuntimeExports.jsx(__mf_63, {
children: items.map((item, index) => {
const menuItem = jsxRuntimeExports.jsx(__mf_64, {
disablePadding: true,
sx: __mf_70.getStyle(this.props.theme, styles$3.menuItem, this.props.activeView === item.view && styles$3.selectedMenu),
style: {
backgroundColor: this.props.activeView === item.view ? settings.navigationSelectedBackground : void 0
},
onClick: () => {
if (settings.navigationHideOnSelection) {
this.hideNavigationMenu();
}
this.props.context.changeView(item.view);
},
children: jsxRuntimeExports.jsxs(__mf_66, {
children: [
jsxRuntimeExports.jsx(__mf_67, {
children: item.icon ? jsxRuntimeExports.jsx(__mf_15, {
src: item.icon,
style: {
color: this.props.activeView === item.view ? settings.navigationSelectedColor : settings.navigationColor,
backgroundColor: "rgba(1,1,1,0)"
},
sx: __mf_70.getStyle(this.props.theme, styles$3.listItemIcon, this.props.activeView === item.view && styles$3.selectedMenu)
}) : jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
children: [
jsxRuntimeExports.jsx(__mf_2256, {
style: {
color: this.props.activeView === item.view ? settings.navigationSelectedColor : settings.navigationColor,
backgroundColor: "rgba(1,1,1,0)"
},
sx: __mf_70.getStyle(this.props.theme, this.props.menuWidth !== "full" && styles$3.transparent, this.props.activeView === item.view && styles$3.selectedMenu)
}),
item.text ? jsxRuntimeExports.jsx("span", {
style: {
...styles$3.listItemIconText,
...this.props.menuWidth === "full" ? styles$3.transparent : void 0,
color: this.props.activeView === item.view ? settings.navigationSelectedColor : settings.navigationColor
},
children: item.text[0].toUpperCase()
}) : null
]
})
}),
jsxRuntimeExports.jsx(__mf_69, {
primary: item.text,
style: {
color: this.props.activeView === item.view ? settings.navigationSelectedColor : settings.navigationColor
},
sx: {
"&.MuListItemText-primary": __mf_70.getStyle(this.props.theme, styles$3.listItemText, this.props.activeView === item.view && !settings.navigationSelectedColor && styles$3.selectedMenu, this.props.menuWidth === "narrow" && styles$3.listItemTextNarrow)
}
})
]
})
}, index);
return jsxRuntimeExports.jsx(__mf_126, {
title: this.props.menuWidth !== "full" ? item.text : "",
slotProps: {
popper: {
sx: {
pointerEvents: "none"
}
}
},
children: menuItem
}, index);
})
})
})
]
});
}
renderToolbar(settings) {
if (!settings.navigationBar) {
return null;
}
let style;
if (settings.navigationBarColor) {
style = {
backgroundColor: settings.navigationBarColor,
color: __mf_70.getInvertedColor(settings.navigationBarColor, this.props.context.themeType, true)
};
} else {
style = {};
}
style.opacity = this.props.editMode ? 0.4 : 1;
let icon = settings.navigationBarIcon || settings.navigationBarImage;
if (icon == null ? void 0 : icon.startsWith("_PRJ_NAME/")) {
icon = `../${this.props.context.adapterName}.${this.props.context.instance}/${this.props.context.projectName}${icon.substring(9)}`;
}
return jsxRuntimeExports.jsxs(__mf_14, {
component: "div",
sx: __mf_70.getStyle(this.props.theme, styles$3.toolBar, this.props.menuWidth === "hidden" && styles$3.toolBarWithClosedMenu),
style,
children: [
icon ? jsxRuntimeExports.jsx(__mf_15, {
src: icon,
style: styles$3.toolbarIcon
}) : null,
settings.navigationBarText || this.props.activeView
]
});
}
hideNavigationMenu() {
window.localStorage.setItem("vis.navOpened", "hidden");
this.props.setMenuWidth("hidden");
}
renderOpenMenuButton(settings) {
let backgroundColor;
let color;
if (this.props.menuWidth === "hidden") {
if (settings.navigationButtonBackground) {
backgroundColor = this.props.context.themeType === "dark" ? "#FFFFFF40" : "#00000040";
} else {
backgroundColor = "transparent";
}
if (settings.navigationBar && !settings.navigationChevronColor) {
if (settings.navigationBarColor) {
color = __mf_70.getInvertedColor(settings.navigationBarColor, this.props.context.themeType, true);
} else {
color = this.props.context.themeType === "dark" ? "#FFF" : "#000";
}
} else {
color = settings.navigationChevronColor;
}
} else {
backgroundColor = "transparent";
}
return jsxRuntimeExports.jsx(__mf_53, {
onClick: () => {
if (settings.navigationHideOnSelection) {
if (this.props.menuWidth === "full") {
this.hideNavigationMenu();
} else {
window.localStorage.setItem("vis.navOpened", "full");
this.props.setMenuWidth("full");
}
} else if (this.props.menuWidth === "full") {
window.localStorage.setItem("vis.navOpened", "narrow");
this.props.setMenuWidth("narrow");
} else if (this.props.menuWidth === "narrow") {
if (!settings.navigationNoHide) {
this.hideNavigationMenu();
} else {
window.localStorage.setItem("vis.navOpened", "full");
this.props.setMenuWidth("full");
}
} else {
window.localStorage.setItem("vis.navOpened", "full");
this.props.setMenuWidth("full");
}
},
style: {
backgroundColor
},
children: jsxRuntimeExports.jsx(__mf_1711, {
style: {
...this.props.menuWidth === "hidden" || this.props.menuWidth === "narrow" && settings.navigationNoHide ? styles$3.openMenuButtonIconHidden : void 0,
color
}
})
});
}
render() {
if (!this.props.context.views || !this.props.context.views[this.props.view]) {
return null;
}
const settings = this.props.context.views[this.props.view].settings;
const menuFullWidth = parseInt(settings.navigationWidth, 10) || MENU_WIDTH_FULL;
if (settings.navigation && !this.props.visInWidget && settings.navigationOrientation === "horizontal" && this.props.view === this.props.activeView) {
return jsxRuntimeExports.jsxs("div", {
style: styles$3.rootHorizontal,
children: [
this.renderMenu(settings, menuFullWidth),
jsxRuntimeExports.jsx("div", {
style: {
...styles$3.viewContentWithToolbar,
marginTop: this.props.context.runtime ? TOOLBAR_SIZE : void 0
},
children: this.props.children
})
]
});
}
if (!settings.navigation && settings.navigationBar) {
return jsxRuntimeExports.jsxs("div", {
style: styles$3.afterMenuHidden,
children: [
this.renderToolbar(settings),
jsxRuntimeExports.jsx("div", {
style: styles$3.viewContentWithToolbar,
children: this.props.children
})
]
});
}
const menuWidth = settings.navigationHideOnSelection ? "hidden" : this.props.menuWidth;
const styleMenu = {
...styles$3.openMenuButton
};
if (this.props.menuWidth === "full") {
styleMenu.left = menuFullWidth - TOOLBAR_SIZE;
Object.assign(styleMenu, styles$3.openMenuButtonFull);
} else if (this.props.menuWidth === "narrow") {
Object.assign(styleMenu, styles$3.openMenuButtonNarrow);
} else {
Object.assign(styleMenu, styles$3.openMenuButtonHidden);
if (settings.navigationBar) {
styleMenu.opacity = 1;
}
}
const styleView = {
...styles$3.afterMenu
};
if (!settings.navigationHideMenu) {
if (menuWidth === "full") {
Object.assign(styleView, styles$3.afterMenuFull);
styleView.width = `calc(100% - ${menuFullWidth}px)`;
} else if (menuWidth === "narrow") {
Object.assign(styleView, styles$3.afterMenuNarrow);
} else {
Object.assign(styleView, styles$3.afterMenuHidden);
}
} else {
Object.assign(styleView, styles$3.afterMenuHidden);
}
return jsxRuntimeExports.jsxs("div", {
style: styles$3.root,
children: [
!settings.navigationHideMenu ? jsxRuntimeExports.jsx("div", {
style: styleMenu,
children: this.renderOpenMenuButton(settings)
}) : null,
!settings.navigationHideMenu ? this.renderMenu(settings, menuFullWidth) : null,
jsxRuntimeExports.jsxs("div", {
style: styleView,
children: [
this.renderToolbar(settings),
jsxRuntimeExports.jsx("div", {
style: settings.navigationBar ? styles$3.viewContentWithToolbar : styles$3.viewContentWithoutToolbar,
children: this.props.children
})
]
})
]
});
}
}
function registerWidgetsLoadIndicator(cb) {
window.__widgetsLoadIndicator = cb;
}
dist.init({
name: "iobroker_vis",
remotes: []
});
function _loadComponentHelper(context) {
const promises = [];
for (let i = 0; i < context.visWidgetsCollection.components.length; i++) {
((index, _visWidgetsCollection) => {
context.countRef.max++;
const promise = dist.loadRemote(`${context.visWidgetsCollection.name}/${_visWidgetsCollection.components[index]}`).then((CustomComponent) => {
var _a;
if (CustomComponent) {
context.countRef.count++;
if (CustomComponent.default) {
CustomComponent.default.adapter = context.dynamicWidgetInstance._id.substring("system.adapter.".length).replace(/\.\d*$/, "");
CustomComponent.default.version = context.dynamicWidgetInstance.common.version;
CustomComponent.default.setIcon = context.dynamicWidgetInstance.common.icon;
CustomComponent.default.url = _visWidgetsCollection.url;
if (context.i18nPrefix) {
CustomComponent.default.i18nPrefix = context.i18nPrefix;
}
context.result.push(CustomComponent.default);
} else {
console.error(`Cannot load widget ${context.dynamicWidgetInstance._id}. No default found`);
}
(_a = window.__widgetsLoadIndicator) == null ? void 0 : _a.call(window, context.countRef.count, context.countRef.max);
}
}).catch((e) => {
console.error(`Cannot load widget ${context.dynamicWidgetInstance._id}: ${e.toString()}`);
console.error(`Cannot load widget ${context.dynamicWidgetInstance._id}: ${JSON.stringify(e)}`);
});
promises.push(promise);
})(i, context.visWidgetsCollection);
}
return Promise.all(promises);
}
function getText(text) {
if (typeof text === "object") {
return text[__mf_2.getLanguage()] || text.en || "";
}
return (text || "").toString();
}
const cloudVersions = {
echarts: void 0,
eventlist: void 0,
fullcalendar: void 0,
openweathermap: void 0,
scenes: void 0,
scheduler: "module",
"vis-2-widgets-energy": void 0,
"vis-2-widgets-gauges": "module",
"vis-2-widgets-jaeger-design": "module",
"vis-2-widgets-material": void 0
};
function fixCloudBundlerType(adapterName, visWidgetsCollection) {
if (window.location.hostname.includes("iobroker.")) {
if (adapterName in cloudVersions) {
visWidgetsCollection.bundlerType = cloudVersions[adapterName];
}
}
}
function getRemoteWidgets(socket, onlyWidgetSets) {
let getObjectViewSystem = socket.getObjectViewSystem.bind(socket);
if (socket.getObjectViewSystemCached) {
getObjectViewSystem = socket.getObjectViewSystemCached.bind(socket);
}
return getObjectViewSystem("instance", "system.adapter.", "system.adapter.\u9999").then((objects) => {
var _a;
const result = [];
const additionalSets = {};
const countRef = {
count: 0,
max: 0
};
const instances = Object.values(objects);
const dynamicWidgetInstances = instances.filter((obj) => {
if (!obj.common.visWidgets && !obj.common.visIconSets) {
return false;
}
if (obj.common.visWidgets) {
const ignoreVersions = obj.common.visWidgets.ignoreInVersions || [];
return !ignoreVersions.includes(2) && (!onlyWidgetSets || onlyWidgetSets.includes(getText(obj.common.name)));
}
return !onlyWidgetSets;
});
const promises = [];
for (let i = 0; i < dynamicWidgetInstances.length; i++) {
const dynamicWidgetInstance = dynamicWidgetInstances[i];
for (const widgetSetName in dynamicWidgetInstance.common.visWidgets) {
if (widgetSetName === "i18n") {
const _widgetSetName = Object.keys(dynamicWidgetInstance.common.visWidgets).find((name) => name !== "i18n");
console.warn(`common.visWidgets.i18n is deprecated. Use common.visWidgets.${_widgetSetName}.i18n instead.`);
} else {
const visWidgetsCollection = dynamicWidgetInstance.common.visWidgets[widgetSetName];
if (Array.isArray(visWidgetsCollection.ignoreInVersions) && visWidgetsCollection.ignoreInVersions.includes(2)) {
continue;
}
if (!((_a = visWidgetsCollection.url) == null ? void 0 : _a.startsWith("http"))) {
visWidgetsCollection.url = `./vis-2/widgets/${visWidgetsCollection.url}`;
}
fixCloudBundlerType(dynamicWidgetInstance.common.name, visWidgetsCollection);
dist.registerRemotes([
{
name: visWidgetsCollection.name,
entry: visWidgetsCollection.url,
type: visWidgetsCollection.bundlerType || void 0
}
]);
if (visWidgetsCollection.components) {
((collection, instance) => {
try {
let i18nPrefix = "";
let i18nPromiseWait;
if (collection.url && collection.i18n === true) {
const pos = collection.url.lastIndexOf("/");
let i18nURL;
if (pos !== -1) {
i18nURL = collection.url.substring(0, pos);
} else {
i18nURL = collection.url;
}
const lang2 = __mf_2.getLanguage();
i18nPromiseWait = fetch(`${i18nURL}/i18n/${lang2}.json`).then((data) => data.json()).then((json) => {
var _a2;
countRef.count++;
__mf_2.extendTranslations(json, lang2);
(_a2 = window.__widgetsLoadIndicator) == null ? void 0 : _a2.call(window, countRef.count, promises.length);
}).catch((error) => {
if (lang2 !== "en") {
return fetch(`${i18nURL}/i18n/en.json`).then((data) => data.json()).then((json) => {
var _a2;
countRef.count++;
__mf_2.extendTranslations(json, lang2);
(_a2 = window.__widgetsLoadIndicator) == null ? void 0 : _a2.call(window, countRef.count, promises.length);
}).catch((_error) => console.log(`Cannot load i18n "${i18nURL}/i18n/${lang2}.json": ${_error}`));
}
console.log(`Cannot load i18n "${i18nURL}/i18n/${lang2}.json": ${error}`);
return null;
});
promises.push(i18nPromiseWait);
} else if (collection.url && collection.i18n === "component") {
i18nPromiseWait = dist.loadRemote(`${collection.name}/translations`).then((translations) => {
var _a2;
countRef.count++;
if (translations.default.prefix === true) {
translations.default.prefix = `${instance.common.name}_`;
}
i18nPrefix = translations.default.prefix;
__mf_2.extendTranslations(translations.default);
(_a2 = window.__widgetsLoadIndicator) == null ? void 0 : _a2.call(window, countRef.count, promises.length);
}).catch((error) => console.log(`Cannot load i18n "${collection.name}": ${error}`));
} else if (collection.i18n && typeof collection.i18n === "object") {
try {
__mf_2.extendTranslations(collection.i18n);
} catch (error) {
console.error(`Cannot import i18n: ${error}`);
}
}
if (collection.components) {
if (i18nPromiseWait instanceof Promise) {
promises.push(i18nPromiseWait.then(() => _loadComponentHelper({
visWidgetsCollection: collection,
countRef,
dynamicWidgetInstance: instance,
i18nPrefix,
result
})));
} else {
promises.push(_loadComponentHelper({
visWidgetsCollection: collection,
countRef,
dynamicWidgetInstance: instance,
i18nPrefix,
result
}));
}
} else if (i18nPromiseWait instanceof Promise) {
promises.push(i18nPromiseWait);
}
} catch (e) {
console.error(e);
}
})(visWidgetsCollection, dynamicWidgetInstance);
}
}
}
if (!onlyWidgetSets) {
const visIconSets = dynamicWidgetInstance.common.visIconSets || {};
for (const iconSetName in visIconSets) {
const visIconSetCollection = visIconSets[iconSetName];
if (Array.isArray(visIconSetCollection.ignoreInVersions) && visIconSetCollection.ignoreInVersions.includes(2)) {
continue;
}
if (!visIconSetCollection.url) {
console.warn(`Icon set "${iconSetName}" of ${dynamicWidgetInstance._id} ignored: url missing`);
continue;
}
if (!visIconSetCollection.url.startsWith("http://") && !visIconSetCollection.url.startsWith("https://") && !visIconSetCollection.url.startsWith("file://")) {
visIconSetCollection.url = `widgets/${visIconSetCollection.url}`;
}
additionalSets[iconSetName] = {
name: visIconSetCollection.name,
url: visIconSetCollection.url,
icon: visIconSetCollection.icon
};
}
}
}
return Promise.all(promises).then(() => ({
widgetSets: result,
additionalSets
}));
}).catch((e) => {
console.error("Cannot read instances", e);
return void 0;
});
}
class BasicBar extends VisRxWidget {
static getWidgetInfo() {
return {
id: "tplValueFloatBar",
visSet: "basic",
visName: "Bar",
visPrev: "widgets/basic/img/Prev_ValueFloatBar.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "oid",
type: "id"
},
{
name: "min",
type: "number",
default: 0
},
{
name: "max",
type: "number",
default: 100
},
{
name: "orientation",
type: "select",
default: "horizontal",
options: [
{
value: "horizontal",
label: "horizontal"
},
{
value: "vertical",
label: "vertical"
}
]
},
{
name: "color",
type: "color",
default: "blue"
},
{
name: "border",
type: "text"
},
{
name: "shadow",
type: "text"
},
{
name: "reverse",
type: "checkbox"
}
]
}
],
visDefaultStyle: {
width: 200,
height: 130
}
};
}
getWidgetInfo() {
return BasicBar.getWidgetInfo();
}
extractWidth(css, multiplier) {
const m = css.match(/([0-9]+)(px|em)?/);
if (m) {
if (m[1] && m[2]) {
return parseInt(m[1], 10) * (multiplier || 1) + m[2];
}
return parseInt(m[1], 10) * (multiplier || 1);
}
return void 0;
}
getCalc() {
const min2 = this.state.rxData.min || this.state.rxData.min === 0 ? Number(this.state.rxData.min) : 0;
const max2 = this.state.rxData.max || this.state.rxData.max === 0 ? Number(this.state.rxData.max) : 100;
let val = parseFloat(this.state.values[`${this.state.rxData.oid}.val`]) || 0;
val = (val - min2) / (max2 - min2);
return this.state.rxData.border ? `calc(${Math.round(val * 100)}% - ${this.extractWidth(this.state.rxData.border, 2)})` : `${Math.round(val * 100)}%`;
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
let style;
if (this.state.rxData.orientation === "vertical") {
style = {
height: this.getCalc()
};
if (this.state.rxData.reverse) {
style = {
...style,
left: 0,
position: "absolute",
bottom: "0"
};
}
if (this.state.rxData.border) {
style = {
...style,
border: this.state.rxData.border,
width: `calc(100% - ${this.extractWidth(this.state.rxData.border, 2)}`
};
}
} else {
style = {
width: this.getCalc()
};
if (this.state.rxData.reverse) {
style = {
...style,
float: "right"
};
}
if (this.state.rxData.border) {
style = {
...style,
border: this.state.rxData.border,
height: `calc(100% - ${this.extractWidth(this.state.rxData.border, 2)}`
};
}
}
if (this.state.rxData.shadow) {
style = {
...style,
boxShadow: this.state.rxData.shadow
};
}
if (this.state.rxData.color) {
style = {
...style,
backgroundColor: this.state.rxData.color
};
}
return jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
children: jsxRuntimeExports.jsx("div", {
"data-oid": this.state.rxData.oid,
className: "vis-widget-body",
style
})
});
}
}
class BasicBulb extends VisRxWidget {
getWidgetInfo() {
return BasicBulb.getWidgetInfo();
}
static getWidgetInfo() {
return {
id: "tplBulbOnOffCtrl",
visSet: "basic",
visName: "Bulb on/off",
visPrev: "widgets/basic/img/Prev_BulbOnOffCtrl.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "oid",
type: "id"
},
{
name: "min"
},
{
name: "max"
},
{
name: "icon_off",
type: "image",
default: "img/bulb_off.png"
},
{
name: "icon_on",
type: "image",
default: "img/bulb_on.png"
},
{
name: "readOnly",
type: "checkbox"
}
]
},
{
name: "ccontrol",
fields: [
{
name: "urlTrue"
},
{
name: "urlFalse"
},
{
name: "oidTrue",
type: "id"
},
{
name: "oidFalse",
type: "id"
},
{
name: "oidTrueValue"
},
{
name: "oidFalseValue"
}
]
}
]
};
}
toggle() {
if (this.state.rxData.oid === NOTHING_SELECTED || this.state.rxData.readOnly) {
return;
}
let val = this.state.values[`${this.state.rxData.oid}.val`];
const { oidTrue, urlTrue, oid, min: min2, max: max2, oidTrueValue, oidFalseValue } = this.state.rxData;
let { urlFalse, oidFalse } = this.state.rxData;
let finalMin = min2 ?? "";
let finalMax = max2 ?? "";
let oidTrueValueFinal = oidTrueValue ?? "";
let oidFalseValueFinal = oidFalseValue ?? "";
if (oidTrue || urlTrue) {
if (!oidFalse && oidTrue) {
oidFalse = oidTrue;
}
if (!urlFalse && urlTrue) {
urlFalse = urlTrue;
}
if (finalMax !== "") {
if (finalMax === "true") {
finalMax = true;
} else if (finalMax === "false") {
finalMax = false;
}
if (val === "true") {
val = true;
} else if (val === "false") {
val = false;
}
val = val === finalMax;
} else {
val = val === 1 || val === "1" || val === true || val === "true";
}
val = !val;
if (finalMin === "" || finalMin === "false" || finalMin === null) {
finalMin = false;
} else if (finalMax === "" || finalMax === "true" || finalMax === null) {
finalMax = true;
}
if (oidTrue && typeof oidTrue === "string") {
if (val) {
if (oidTrueValueFinal === "") {
oidTrueValueFinal = finalMax;
}
if (oidTrueValueFinal === "false") {
oidTrueValueFinal = false;
} else if (oidTrueValueFinal === "true") {
oidTrueValueFinal = true;
}
if (typeof oidTrueValueFinal === "string") {
const f = parseFloat(oidTrueValueFinal);
if (f.toString() === oidTrueValueFinal) {
oidTrueValueFinal = f;
}
}
this.props.context.setValue(oidTrue, oidTrueValueFinal);
} else if (typeof oidFalse === "string") {
if (oidFalseValueFinal === "") {
oidFalseValueFinal = finalMin;
} else if (oidFalseValueFinal === "false") {
oidFalseValueFinal = false;
} else if (oidFalseValueFinal === "true") {
oidFalseValueFinal = true;
}
if (typeof oidFalseValueFinal === "string") {
const f = parseFloat(oidFalseValueFinal);
if (f.toString() === oidFalseValueFinal) {
oidFalseValueFinal = f;
}
}
this.props.context.setValue(oidFalse, oidFalseValueFinal);
}
}
if (urlTrue) {
if (val) {
this.props.context.socket.getRawSocket().emit("httpGet", urlTrue);
} else {
this.props.context.socket.getRawSocket().emit("httpGet", urlFalse);
}
}
} else if (finalMin === "" && (val === null || val === "" || val === void 0 || val === false || val === "false") || finalMin !== "" && finalMin === val) {
typeof oid === "string" && this.props.context.setValue(oid, finalMax !== "" ? finalMax : true);
} else if (finalMax === "" && (val === true || val === "true") || finalMax !== "" && val === finalMax) {
typeof oid === "string" && this.props.context.setValue(oid, finalMin !== "" ? finalMin : false);
} else if (typeof oid === "string") {
val = parseFloat(val);
if (finalMin !== "" && finalMax !== "" && (typeof finalMax === "number" || typeof finalMax === "string") && (typeof finalMin === "number" || typeof finalMin === "string")) {
if (val >= (parseFloat(finalMax) - parseFloat(finalMin)) / 2) {
val = finalMin;
} else {
val = finalMax;
}
} else if (val >= 0.5) {
val = 0;
} else {
val = 1;
}
this.props.context.setValue(oid, val);
}
}
isFalse(val, min2, max2) {
if (min2 !== void 0 && min2 !== null && min2 !== "") {
if (val !== void 0 && typeof val !== "string") {
val = val.toString();
}
if (max2 !== void 0 && max2 !== null && max2 !== "") {
return val !== max2;
}
return val === min2;
}
if (val === void 0 || val === null || val === false || val === "false" || val === "FALSE" || val === "False" || val === "OFF" || val === "Off" || val === "off" || val === "") {
return true;
}
if (val === "0" || val === 0) {
return true;
}
const f = parseFloat(val);
if (f.toString() !== "NaN") {
return !f;
}
return false;
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
const val = this.state.values[`${this.state.rxData.oid}.val`];
const isOff = this.isFalse(val, this.state.rxData.min, this.state.rxData.max);
let src;
if (isOff) {
src = this.state.rxData.icon_off || "img/bulb_off.png";
} else {
src = this.state.rxData.icon_on || "img/bulb_on.png";
}
return jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
onClick: () => this.toggle(),
children: jsxRuntimeExports.jsx("img", {
src: src.toString(),
alt: "tplBulbOnOffCtrl",
width: "100%"
})
});
}
}
const PinSvg = (props) => jsxRuntimeExports.jsx("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 16 24",
style: props.style,
children: jsxRuntimeExports.jsx("path", {
fill: "currentColor",
d: "m7.97,0.026c-4.324,0 -7.82,3.72 -7.82,8.324c0,6.24 7.82,15.46 7.82,15.46s7.82,-9.21 7.82,-15.46c0,-4.6 -3.49,-8.32 -7.82,-8.32zm0,0"
})
});
class BasicRedNumber extends VisRxWidget {
static getWidgetInfo() {
return {
id: "tplRedNumber",
visSet: "basic",
visName: "Red Number",
visPrev: "widgets/basic/img/Prev_RedNumber.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "oid",
type: "id"
},
{
name: "type",
type: "select",
options: [
{
value: "circle",
label: "basic_circle"
},
{
value: "pin",
label: "basic_pin"
}
]
},
{
name: "html_prepend",
type: "html"
},
{
name: "html_append_singular",
type: "html"
},
{
name: "html_append_plural",
type: "html"
},
{
name: "background",
type: "color"
},
{
name: "borderColor",
label: "basic_borderColor",
type: "color",
hidden: 'data.type === "pin"'
},
{
name: "borderRadius",
label: "basic_borderRadius",
type: "slider",
min: 0,
max: 100,
step: 1,
default: 16,
hidden: 'data.type === "pin"'
}
]
}
],
visDefaultStyle: {
width: 52,
height: 30
}
};
}
getWidgetInfo() {
return BasicRedNumber.getWidgetInfo();
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
const val = this.state.rxData.oid && this.state.rxData.oid !== "nothing_selected" ? parseFloat(this.state.values[`${this.state.rxData.oid}.val`]) : null;
if (!this.props.editMode && (!val || this.state.values[`${this.state.rxData.oid}.val`] === "false")) {
return null;
}
if (this.state.rxData.type === "pin") {
return jsxRuntimeExports.jsxs("div", {
className: "vis-widget-body",
children: [
jsxRuntimeExports.jsx(PinSvg, {
style: {
width: "100%",
height: "100%",
position: "absolute",
top: 0,
left: 0,
zIndex: 0,
color: typeof this.state.rxData.background === "string" ? this.state.rxData.background || "red" : "red"
}
}),
jsxRuntimeExports.jsxs("div", {
style: {
position: "absolute",
top: "22%",
width: "96%",
textAlign: "center",
zIndex: 1
},
children: [
this.state.rxData.html_prepend ? jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html_prepend
}
}) : null,
val === null ? "--" : val,
val === 1 ? jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html_append_singular
}
}) : jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html_append_plural
}
})
]
})
]
});
}
const style = {
padding: 3,
borderRadius: this.state.rxData.borderRadius !== void 0 && this.state.rxData.borderRadius !== null ? parseFloat(this.state.rxData.borderRadius) : 16,
borderColor: this.state.rxData.borderColor || "white",
borderWidth: 3,
borderStyle: "solid",
backgroundColor: this.state.rxData.background || "red",
minWidth: 21,
textAlign: "center",
color: props.style.color || "white",
fontSize: props.style.fontSize || 20,
fontFamily: props.style.fontFamily || "Helvetica",
display: "flex",
justifyContent: "center",
alignItems: "center",
boxSizing: "border-box"
};
return jsxRuntimeExports.jsxs("div", {
className: "vis-widget-body",
style,
children: [
this.state.rxData.html_prepend ? jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html_prepend
}
}) : null,
val === null ? "--" : val,
val === 1 ? jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html_append_singular
}
}) : jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html_append_plural
}
})
]
});
}
}
class DangerousHtmlWithScript extends React.Component {
componentDidMount() {
const doc = new DOMParser().parseFromString(this.props.html, "text/html");
const scriptElements = doc.getElementsByTagName("script");
let i = 0;
const existingScripts = Array.from(document.querySelectorAll("script[type='text/javascript']"));
for (const scriptElement of Array.from(scriptElements)) {
const id = `${this.props.wid}-${i++}`;
const scriptExists = existingScripts.find((script2) => script2.id === id);
if (scriptExists) {
return;
}
const script = document.createElement("script");
script.id = id;
script.type = "text/javascript";
script.async = true;
script.innerHTML = scriptElement.innerHTML;
document.body.appendChild(script);
}
}
render() {
const { isDiv, html, ...otherProps } = this.props;
if (isDiv) {
return jsxRuntimeExports.jsx("div", {
dangerouslySetInnerHTML: {
__html: html
},
...otherProps
});
}
return jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: html
},
...otherProps
});
}
}
class BasicHtml extends VisRxWidget {
interval = null;
static getWidgetInfo() {
return {
id: "tplHtml",
visSet: "basic",
visName: "HTML",
visPrev: "widgets/basic/img/Prev_HTML.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "html",
type: "html"
},
{
name: "refreshInterval",
type: "slider",
min: 0,
max: 18e4,
step: 100
}
]
}
],
visDefaultStyle: {
width: 200,
height: 130
}
};
}
getWidgetInfo() {
return BasicHtml.getWidgetInfo();
}
componentWillUnmount() {
if (this.interval) {
clearInterval(this.interval);
this.interval = null;
}
super.componentWillUnmount();
}
componentDidMount() {
super.componentDidMount();
if (parseInt(this.state.rxData.refreshInterval, 10)) {
this.interval = setInterval(() => this.forceUpdate(), parseInt(this.state.rxData.refreshInterval, 10));
}
}
onRxDataChanged(prevRxData) {
super.onRxDataChanged(prevRxData);
if (this.interval) {
clearInterval(this.interval);
this.interval = null;
}
if (parseInt(this.state.rxData.refreshInterval, 10)) {
this.interval = setInterval(() => this.forceUpdate(), parseInt(this.state.rxData.refreshInterval, 10));
}
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
return jsxRuntimeExports.jsx(DangerousHtmlWithScript, {
className: "vis-widget-body",
html: (this.state.rxData.html || "").toString(),
isDiv: true,
wid: this.props.id
});
}
}
class BasicValueString extends VisRxWidget {
static getWidgetInfo() {
return {
id: "tplValueString",
visSet: "basic",
visName: "String",
visPrev: "widgets/basic/img/Prev_ValueString.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "oid",
type: "id"
},
{
name: "html_prepend",
type: "html"
},
{
name: "html_append",
type: "html"
},
{
name: "test_html",
type: "html"
},
{
name: "icon",
type: "icon64"
},
{
name: "iconSize",
label: "icon_size_in_pixels",
type: "slider",
min: 5,
max: 200,
hidden: "!data.icon"
}
]
}
],
visWidgetLabel: "value_string",
visDefaultStyle: {
width: 100,
height: 30
}
};
}
getWidgetInfo() {
return BasicValueString.getWidgetInfo();
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
if (props.style.width === void 0) {
props.style.width = 50;
}
if (props.style.height === void 0) {
props.style.height = 20;
}
const oid = this.state.rxData.oid && this.state.rxData.oid.includes('"') ? "" : this.state.rxData.oid || "";
let body;
if (this.props.editMode && this.state.rxData.test_html) {
body = this.state.rxData.test_html;
} else if (this.state.rxData.oid) {
if (this.state.rxData.oid.includes('"')) {
body = this.state.rxData.oid.substring(1, this.state.rxData.oid.length - 1);
} else if (oid) {
body = this.state.values[`${oid}.val`];
} else {
body = "";
}
} else {
body = "";
}
const style = this.state.rxData.icon ? {
display: "flex",
alignItems: "center"
} : {};
return jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
children: jsxRuntimeExports.jsxs("div", {
"data-oid": oid,
style,
children: [
this.state.rxData.icon ? jsxRuntimeExports.jsx(__mf_15, {
src: this.state.rxData.icon,
style: {
width: this.state.rxData.iconSize || 24,
height: this.state.rxData.iconSize || 24
}
}) : null,
jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html_prepend ?? ""
}
}),
jsxRuntimeExports.jsx("span", {
children: body
}),
jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html_append ?? ""
}
})
]
})
});
}
}
class BasicValueInput extends VisRxWidget {
setTimer = null;
static getWidgetInfo() {
return {
id: "tplValueInput",
visSet: "basic",
visName: "Input val",
visWidgetLabel: "vis-2-widgets-basic-input_value",
visPrev: "widgets/basic/img/Prev_ValueInput.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "oid",
type: "id"
},
{
name: "html_prepend",
type: "html"
},
{
name: "html_append",
type: "html"
},
{
name: "numeric",
type: "checkbox"
},
{
name: "min",
type: "number",
hidden: "!data.numeric"
},
{
name: "max",
type: "number",
hidden: "!data.numeric"
},
{
name: "autoSet",
type: "checkbox"
},
{
name: "autoSetDelay",
label: "vis-2-widgets-basic-autoSetDelay",
type: "number",
hidden: "!data.autoSet",
default: 1e3
},
{
name: "readOnly",
type: "checkbox"
},
{
name: "autoFocus",
type: "checkbox"
},
{
name: "noStyle",
type: "checkbox",
label: "vis-2-widgets-basic-noStyle"
},
{
name: "withEnter",
type: "checkbox",
hidden: "!!data.noStyle"
},
{
name: "variant",
type: "select",
hidden: "!!data.noStyle",
noTranslation: true,
options: [
{
value: "standard",
label: "standard"
},
{
value: "outlined",
label: "outlined"
},
{
value: "standard",
label: "standard"
}
],
default: "standard"
}
]
}
],
visDefaultStyle: {
width: 150,
height: 70
}
};
}
componentDidMount() {
super.componentDidMount();
const oid = this.state.rxData.oid && this.state.rxData.oid !== "nothing_selected" && this.state.rxData.oid.includes('"') ? "" : this.state.rxData.oid || "";
let value;
if (this.state.rxData.oid) {
if (this.state.rxData.oid.includes('"')) {
value = this.state.rxData.oid.substring(1, this.state.rxData.oid.length - 1);
} else if (oid) {
value = this.state.values[`${oid}.val`] !== null && this.state.values[`${oid}.val`] !== void 0 ? this.state.values[`${oid}.val`].toString() : "";
} else {
value = "";
}
} else {
value = "";
}
this.setState({
value,
sentValue: true
});
}
onStateUpdated(id, state) {
if (id === this.state.rxData.oid && state && state.val !== null && state.val !== void 0) {
const valStr = state.val.toString();
if (this.state.value.toString() !== valStr) {
this.setState({
value: valStr
});
}
}
}
getWidgetInfo() {
return BasicValueInput.getWidgetInfo();
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
if (props.style.width === void 0) {
props.style.width = 100;
}
if (props.style.height === void 0) {
props.style.height = 25;
}
const oid = this.state.rxData.oid && this.state.rxData.oid !== "nothing_selected" && this.state.rxData.oid.includes('"') ? "" : this.state.rxData.oid || "";
let value;
if (this.state.rxData.oid) {
if (this.state.rxData.oid.includes('"')) {
value = this.state.rxData.oid.substring(1, this.state.rxData.oid.length - 1);
} else if (oid) {
value = this.state.value;
if (value === void 0 || value === null) {
value = "";
}
} else {
value = "";
}
} else {
value = "";
}
let content;
if (this.state.rxData.noStyle) {
content = jsxRuntimeExports.jsx("input", {
type: this.state.rxData.numeric ? "number" : "text",
style: {
flexGrow: 1,
height: "calc(100% - 6px)",
backgroundColor: this.props.context.themeType === "dark" ? "#333" : "#fff",
color: this.props.context.themeType === "dark" ? "#FFF" : "#000"
},
readOnly: this.state.rxData.readOnly || this.props.editMode,
autoFocus: this.state.rxData.autoFocus,
value,
onChange: (e) => this.setState({
value: e.target.value,
sentValue: false
}, () => {
if (this.state.rxData.autoSet) {
this.setTimer && clearTimeout(this.setTimer);
this.setTimer = setTimeout(() => {
this.setTimer = null;
this.setState({
sentValue: true
}, () => this.props.context.setValue(oid, this.state.value));
}, this.state.rxData.autoSetDelay || 1e3);
}
}),
onKeyDown: (e) => {
if (e.key === "Enter" && oid) {
this.setState({
sentValue: true
}, () => this.props.context.setValue(oid, this.state.value));
}
}
});
} else {
content = jsxRuntimeExports.jsx(__mf_121, {
type: this.state.rxData.numeric ? "number" : "text",
style: {
flexGrow: 1,
height: "100%"
},
sx: {
"& .MuiInputBase-root": {
height: "100%"
}
},
variant: this.state.rxData.variant,
slotProps: {
inputLabel: {
shrink: true
},
input: {
readOnly: this.state.rxData.readOnly || this.props.editMode,
endAdornment: !this.props.editMode && this.state.rxData.withEnter && oid && !this.state.sentValue ? jsxRuntimeExports.jsx(__mf_53, {
size: "small",
onClick: () => this.setState({
sentValue: true
}, () => this.props.context.setValue(oid, this.state.value)),
children: jsxRuntimeExports.jsx(__mf_4885, {})
}) : null
}
},
label: this.state.rxData.html_prepend,
helperText: this.state.rxData.html_append,
value,
onChange: (e) => {
this.setState({
value: e.target.value,
sentValue: false
}, () => {
if (this.state.rxData.autoSet && oid) {
this.setTimer && clearTimeout(this.setTimer);
this.setTimer = setTimeout(() => {
this.setTimer = null;
this.setState({
sentValue: true
}, () => this.props.context.setValue(oid, this.state.value));
}, this.state.rxData.autoSetDelay || 1e3);
}
});
},
onKeyDown: (e) => {
if (e.key === "Enter" && oid) {
this.setState({
sentValue: true
}, () => this.props.context.setValue(oid, this.state.value));
}
}
});
}
return jsxRuntimeExports.jsxs("div", {
className: "vis-widget-body",
style: {
display: "flex",
alignItems: "center",
gap: 3
},
children: [
this.state.rxData.noStyle ? jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html_prepend ?? ""
}
}) : null,
content,
this.state.rxData.noStyle ? jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html_append ?? ""
}
}) : null
]
});
}
}
function FaFolderOpen(props) {
return GenIcon({
"attr": {
"viewBox": "0 0 576 512"
},
"child": [
{
"tag": "path",
"attr": {
"d": "M572.694 292.093L500.27 416.248A63.997 63.997 0 0 1 444.989 448H45.025c-18.523 0-30.064-20.093-20.731-36.093l72.424-124.155A64 64 0 0 1 152 256h399.964c18.523 0 30.064 20.093 20.73 36.093zM152 224h328v-48c0-26.51-21.49-48-48-48H272l-64-64H48C21.49 64 0 85.49 0 112v278.046l69.077-118.418C86.214 242.25 117.989 224 152 224z"
},
"child": []
}
]
})(props);
}
class BasicViewInWidget extends VisRxWidget {
static getWidgetInfo() {
return {
id: "tplContainerView",
visSet: "basic",
visName: "View in widget",
visAttrs: [
{
name: "common",
fields: [
{
name: "contains_view",
label: "vis_2_widgets_basic_contains_view",
type: "views"
}
]
}
],
visPrev: "widgets/basic/img/Prev_ContainerView.png",
visWidgetLabel: "vis_2_widgets_basic_view_in_widget",
visSetLabel: "set_basic",
visDefaultStyle: {
width: 300,
height: 200
}
};
}
getWidgetInfo() {
return BasicViewInWidget.getWidgetInfo();
}
getViewOptions(project, options, parentId = null, level = 0) {
project.___settings.folders.filter((folder) => (folder.parentId || null) === parentId).forEach((folder) => {
options.push({
type: "folder",
folder,
level: level + 1
});
this.getViewOptions(project, options, folder.id, level + 1);
});
const keys2 = Object.keys(project).filter((view) => (project[view].parentId || null) === parentId && !view.startsWith("__"));
keys2.forEach((view) => {
options.push({
type: "view",
view,
level: level + 1
});
});
return options;
}
renderViewSelector() {
const options = this.getViewOptions(this.props.context.views, [], null, 0).filter((option) => option.type === "folder" || option.view !== this.props.view);
return [
jsxRuntimeExports.jsx(__mf_53, {
style: this.props.context.editModeComponentStyle,
onMouseDown: (e) => {
e.stopPropagation();
e.preventDefault();
this.props.onIgnoreMouseEvents(true);
this.setState({
showViewSelector: true
});
},
children: jsxRuntimeExports.jsx(EditIcon, {})
}, "button"),
this.state.showViewSelector ? jsxRuntimeExports.jsxs(__mf_32, {
open: true,
onClose: () => this.setState({
showViewSelector: false
}, () => this.props.onIgnoreMouseEvents(false)),
children: [
jsxRuntimeExports.jsx(__mf_36, {
children: __mf_2.t("vis_2_widgets_basic_contains_view")
}),
jsxRuntimeExports.jsx(__mf_34, {
children: options.map((option, key) => option.type === "view" ? jsxRuntimeExports.jsxs(__mf_72, {
value: option.view,
onClick: () => this.setState({
showViewSelector: false
}, () => {
this.props.onIgnoreMouseEvents(false);
this.props.context.onWidgetsChanged([
{
wid: this.props.id,
view: this.props.view,
data: {
contains_view: option.view
}
}
]);
}),
style: {
paddingLeft: option.level * 16,
lineHeight: "36px"
},
children: [
jsxRuntimeExports.jsx(FileIcon, {
style: {
verticalAlign: "middle",
marginRight: 4
}
}),
jsxRuntimeExports.jsx(__mf_69, {
primary: option.view,
style: {
verticalAlign: "middle"
}
})
]
}, key.toString()) : jsxRuntimeExports.jsxs(__mf_70$1, {
style: {
paddingLeft: option.level * 16,
lineHeight: "36px",
backgroundColor: "inherit"
},
children: [
jsxRuntimeExports.jsx(FaFolderOpen, {
style: {
verticalAlign: "middle",
marginRight: 6,
marginTop: -3,
fontSize: 20,
color: "#00dc00"
}
}),
jsxRuntimeExports.jsx("span", {
style: {
fontSize: "1rem"
},
children: option.folder.name
})
]
}, key))
})
]
}, "dialog") : null
];
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
if (props.style.width === void 0) {
props.style.width = 400;
}
if (props.style.height === void 0) {
props.style.height = 270;
}
const view = this.state.rxData.contains_view;
if (view === this.props.view) {
return jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
style: {
overflow: "hidden",
position: "absolute"
},
children: __mf_2.t("vis_2_widgets_basic_cannot_recursive")
});
}
if (!view) {
return jsxRuntimeExports.jsxs("div", {
className: "vis-widget-body",
style: {
overflow: "hidden",
position: "absolute"
},
children: [
__mf_2.t("vis_2_widgets_basic_view_not_defined"),
this.props.editMode ? this.renderViewSelector() : null
]
});
}
const style = {
position: "absolute"
};
if (this.state.rxStyle["overflow-x"] && this.state.rxStyle["overflow-y"]) {
delete props.style.overflow;
if (this.state.rxStyle["overflow-y"] === this.state.rxStyle["overflow-x"]) {
style.overflow = this.state.rxStyle["overflow-x"];
} else {
style.overflowX = this.state.rxStyle["overflow-x"];
style.overflowY = this.state.rxStyle["overflow-y"];
}
} else if (this.state.rxStyle["overflow-x"]) {
style.overflowX = this.state.rxStyle["overflow-x"];
delete props.style.overflow;
} else if (this.state.rxStyle["overflow-y"]) {
style.overflowY = this.state.rxStyle["overflow-y"];
delete props.style.overflow;
} else if (this.state.rxStyle.overflow) {
style.overflow = this.state.rxStyle.overflow;
} else {
style.overflow = "hidden";
}
delete props.style.overflow;
delete props.style.overflowX;
delete props.style.overflowY;
return jsxRuntimeExports.jsxs("div", {
className: "vis-widget-body",
style,
children: [
this.state.editMode ? jsxRuntimeExports.jsx("div", {
className: "vis-editmode-helper"
}) : null,
super.getWidgetView(view, void 0)
]
});
}
}
class BasicViewInWidget8 extends VisRxWidget {
static getWidgetInfo() {
return {
id: "tplStatefulContainerView8",
visSet: "basic",
visName: "View in widget 8",
visAttrs: "oid;count[1]/number;group.views;contains_view_(0-count)/views",
visPrev: "widgets/basic/img/Prev_StatefulContainerView8.png"
};
}
getWidgetInfo() {
return BasicViewInWidget8.getWidgetInfo();
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
if (props.style.width === void 0) {
props.style.width = 400;
}
if (props.style.height === void 0) {
props.style.height = 270;
}
const viewArr = [];
let i = 1;
while (this.state.rxData[`contains_view_${i}`] !== void 0) {
viewArr.push(this.state.rxData[`contains_view_${i}`]);
i++;
}
const oid = this.state.rxData.oid;
let val = this.state.values[`${oid}.val`];
let view;
if (oid !== "nothing_selected" && val !== void 0) {
if (val === "true" || val === true) {
val = 1;
}
if (val === "false" || val === false) {
val = 0;
}
view = viewArr[val];
} else {
view = viewArr[0];
}
if (view === this.props.view) {
return jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
style: {
overflow: "hidden",
position: "absolute"
},
children: __mf_2.t("vis_2_widgets_basic_cannot_recursive")
});
}
const style = {
position: "absolute"
};
if (this.state.rxStyle["overflow-x"] && this.state.rxStyle["overflow-y"]) {
delete props.style.overflow;
if (this.state.rxStyle["overflow-y"] === this.state.rxStyle["overflow-x"]) {
style.overflow = this.state.rxStyle["overflow-x"];
} else {
style.overflowX = this.state.rxStyle["overflow-x"];
style.overflowY = this.state.rxStyle["overflow-y"];
}
} else if (this.state.rxStyle["overflow-x"]) {
style.overflowX = this.state.rxStyle["overflow-x"];
delete props.style.overflow;
} else if (this.state.rxStyle["overflow-y"]) {
style.overflowY = this.state.rxStyle["overflow-y"];
delete props.style.overflow;
} else if (this.state.rxStyle.overflow) {
style.overflow = this.state.rxStyle.overflow;
} else {
style.overflow = "hidden";
}
delete props.style.overflow;
delete props.style.overflowX;
delete props.style.overflowY;
return jsxRuntimeExports.jsxs("div", {
className: "vis-widget-body",
style,
children: [
this.state.editMode ? jsxRuntimeExports.jsx("div", {
className: "vis-editmode-helper"
}) : null,
super.getWidgetView(view, void 0)
]
});
}
}
class BasicGroup extends VisRxWidget {
static getWidgetInfo() {
return {
id: "_tplGroup",
visSet: "basic",
visName: "Group",
visPrev: "",
visAttrs: [
{
name: "common",
fields: []
}
]
};
}
componentDidMount() {
super.componentDidMount();
this.setState({
mounted: true
});
}
static _visAttrs(data, views, view) {
const listOfWidgets = data.members;
const attributes = [];
listOfWidgets.forEach((wid) => {
var _a;
const widgetData = (_a = views[view].widgets[wid]) == null ? void 0 : _a.data;
widgetData && Object.keys(widgetData).forEach((attr) => {
if (typeof widgetData[attr] === "string") {
let ms = widgetData[attr].match(/(groupAttr\d+)+?/g);
if (ms) {
ms.forEach((m) => !attributes.includes(m) && attributes.push(m));
}
ms = widgetData[attr].match(/%([-_a-zA-Z\d]+)+?%/g);
if (ms) {
ms.forEach((m) => {
const _attr = m.substring(1, m.length - 1);
!attributes.includes(_attr) && attributes.push(_attr);
});
}
}
});
});
const common = {
name: "common",
fields: [
{
name: "group_hint",
label: "group_hint",
type: "help",
text: "group_help"
}
]
};
const objects = {
name: "objects",
label: "group_fields",
fields: []
};
const groupFields = [
common,
objects
];
for (let i = 0; i < attributes.length; i++) {
const attrName = attributes[i];
const num = attrName.startsWith("groupAttr") ? parseInt(attrName.substring(9), 10) : 0;
common.fields.push({
name: attrName,
title: data[`attrName_${attrName}`] || data[`attrName${num}`] || attrName,
type: data[`attrType_${attrName}`] || data[`attrType${num}`] || ""
});
objects.fields.push({
name: `attrName_${attrName}`,
title: `${__mf_2.t("group_attrName")} [${attrName}]`,
type: "text"
});
objects.fields.push({
name: `attrType_${attrName}`,
title: `${__mf_2.t("group_attrType")} [${attrName}]`,
type: "select",
noTranslation: true,
options: [
"",
"text",
"checkbox",
"number",
"html",
"image",
"icon",
"icon64",
"id",
"color",
"views",
"widget",
"history",
"password",
"fontname",
"widget",
"groups",
"class",
"filters",
"json"
]
});
}
return groupFields;
}
getWidgetInfo() {
const info = BasicGroup.getWidgetInfo();
info.visAttrs = BasicGroup._visAttrs(this.props.context.views[this.props.view].widgets[this.props.id].data, this.props.context.views, this.props.view);
return info;
}
renderWidgetBody(props) {
var _a;
const context = this.props.context;
super.renderWidgetBody(props);
const widget = context.views[this.props.view].widgets[this.props.id];
if (this.props.id === this.props.selectedGroup) {
props.style.overflow = "visible";
}
const groupWidgets = [
...((_a = widget == null ? void 0 : widget.data) == null ? void 0 : _a.members) || []
];
let rxGroupWidgets = null;
if ((groupWidgets == null ? void 0 : groupWidgets.length) && this.state.mounted) {
groupWidgets.sort((a, b) => {
const widgetA = context.views[this.props.view].widgets[a];
const widgetB = context.views[this.props.view].widgets[b];
const isRelativeA = (widgetA == null ? void 0 : widgetA.style) && (widgetA.style.position === "relative" || widgetA.style.position === "static" || widgetA.style.position === "sticky");
const isRelativeB = (widgetB == null ? void 0 : widgetB.style) && (widgetB.style.position === "relative" || widgetB.style.position === "static" || widgetB.style.position === "sticky");
if (isRelativeA && isRelativeB) {
return 0;
}
if (isRelativeA) {
return -1;
}
return 1;
});
rxGroupWidgets = groupWidgets.map((id, index) => {
const _widget = context.views[this.props.view].widgets[id];
if (!_widget) {
return null;
}
const isRelative = _widget.style && (_widget.style.position === "relative" || _widget.style.position === "static" || _widget.style.position === "sticky");
return VisView.getOneWidget(index, _widget, {
selectedGroup: this.props.selectedGroup,
selectedWidgets: this.props.selectedWidgets,
context: this.props.context,
editMode: this.props.editMode,
moveAllowed: this.props.moveAllowed,
mouseDownOnView: this.props.mouseDownOnView,
index,
id,
view: this.props.view,
isRelative,
askView: this.props.askView,
refParent: props.refService,
relativeWidgetOrder: groupWidgets,
viewsActiveFilter: this.props.viewsActiveFilter,
customSettings: this.props.customSettings
});
});
}
return rxGroupWidgets;
}
}
class BasicSvgBool extends VisRxWidget {
static getWidgetInfo() {
return {
id: "tplValueBoolCtrlSvg",
visSet: "basic",
visName: "Bool SVG",
visWidgetLabel: "qui_Bool SVG",
visPrev: "widgets/basic/img/Prev_ValueBoolCtrlSvg.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "oid",
type: "id"
},
{
name: "no_control",
type: "checkbox"
},
{
name: "svg_false",
type: "html",
default: "<polygon points='100,10 40,198 190,78 10,78 160,198' style='fill:lime; stroke:purple; stroke-width:5; fill-rule:nonzero' transform='scale(0.4)' />"
},
{
name: "svg_true",
type: "html",
default: "<polygon points='100,10 40,198 190,78 10,78 160,198' style='fill:yellow; stroke:red; stroke-width:5; fill-rule:nonzero' transform='scale(0.4)' />"
},
{
name: "svg_opacity",
type: "slider",
min: 0,
max: 1,
step: 0.05
}
]
}
],
visDefaultStyle: {
width: 85,
height: 85
}
};
}
getWidgetInfo() {
return BasicSvgBool.getWidgetInfo();
}
onSvgClick() {
const oid = this.state.rxData.oid;
let val = this.state.values[`${this.state.rxData.oid}.val`];
if (val === null || val === "" || val === void 0 || val === false || val === "false") {
this.props.context.setValue(oid, true);
} else if (val === true || val === "true") {
this.props.context.setValue(oid, false);
} else {
val = parseFloat(val);
if (val >= 0.5) {
val = 1;
} else {
val = 0;
}
this.props.context.setValue(oid, 1 - val);
}
}
renderSvg() {
let str = this.state.values[`${this.state.rxData.oid}.val`];
if (typeof str === "string") {
str = str.toLowerCase();
}
const val = parseFloat(str);
let opacity = this.state.rxData.svg_opacity;
if (this.props.editMode) {
if (opacity === void 0 || opacity === null || opacity === "") {
opacity = 1;
}
if (parseFloat(opacity) < 0.2) {
opacity = 0.2;
}
}
let svg;
if (val === 0 || str === "false" || str === "0" || str === "off" || str === false || str === null || str === void 0) {
svg = this.state.rxData.svg_false;
} else {
svg = this.state.rxData.svg_true;
}
return jsxRuntimeExports.jsx("svg", {
style: {
width: "100%",
height: "100%",
opacity
},
dangerouslySetInnerHTML: {
__html: svg
}
});
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
return jsxRuntimeExports.jsx("div", {
onClick: this.props.editMode ? null : () => this.onSvgClick(),
className: "vis-widget-body",
children: this.renderSvg()
});
}
}
class BasicSvgShape extends VisRxWidget {
static getWidgetInfo() {
return {
id: "tplShapes",
visSet: "basic",
visName: "SVG shape",
visPrev: "widgets/basic/img/Prev_SvgShape.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "svgType",
type: "select",
options: [
{
value: "line",
label: "basic_line"
},
{
value: "triangle",
label: "basic_triangle"
},
{
value: "square",
label: "basic_square"
},
{
value: "pentagone",
label: "basic_pentagone"
},
{
value: "hexagone",
label: "basic_hexagone"
},
{
value: "octagone",
label: "basic_octagone"
},
{
value: "circle",
label: "basic_circle"
},
{
value: "star",
label: "basic_star"
},
{
value: "arrow",
label: "basic_arrow"
},
{
value: "custom",
label: "basic_custom"
}
],
default: "circle"
},
{
name: "points",
type: "slider",
min: 3,
max: 20,
default: 3,
hidden: 'data.svgType !== "custom"'
},
{
name: "strokeColor",
type: "color",
default: "#009cb3"
},
{
name: "fill",
type: "color",
default: "#00b3ac"
},
{
name: "strokeWidth",
type: "slider",
min: 0,
max: 100,
default: 5
},
{
name: "rotate",
type: "slider",
min: 0,
max: 360,
default: 0
},
{
name: "scaleWidth",
type: "slider",
min: 0,
max: 1,
step: 0.05,
default: 1
},
{
name: "scaleHeight",
type: "slider",
min: 0,
max: 1,
step: 0.05,
default: 1
}
]
}
],
visDefaultStyle: {
width: 100,
height: 100
}
};
}
getWidgetInfo() {
return BasicSvgShape.getWidgetInfo();
}
static circlePoints(radius, num, step) {
step = step || 360 / num;
let text = "";
const radian = Math.PI / 180;
for (let i = 0; i < num; i++) {
const angle = radian * (i * step - 180);
const point = {
x: Math.sin(angle) * radius,
y: Math.cos(angle) * radius
};
text += `${point.x}, ${point.y} `;
}
return text;
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
let svg = null;
const rotate = Number(this.state.rxData.rotate) || 0;
const scaleWidth = Number(this.state.rxData.scaleWidth) || 1;
const scaleHeight = Number(this.state.rxData.scaleHeight) || 1;
const strokeWidth = Number(this.state.rxData.strokeWidth) || 0;
const transform = `rotate(${rotate}) scale(${scaleWidth}, ${scaleHeight})`;
if (this.state.rxData.svgType === "triangle") {
svg = jsxRuntimeExports.jsx("polygon", {
transform,
points: BasicSvgShape.circlePoints(50 - strokeWidth, 3)
});
} else if (this.state.rxData.svgType === "line") {
svg = jsxRuntimeExports.jsx("line", {
vectorEffect: "non-scaling-stroke",
transform: `rotate(${rotate})`,
x1: "-50",
y1: "0",
x2: "50",
y2: "0"
});
} else if (this.state.rxData.svgType === "circle") {
svg = jsxRuntimeExports.jsx("circle", {
transform,
cx: "0",
cy: "0",
r: 50 - strokeWidth / 2
});
} else if (this.state.rxData.svgType === "pentagone") {
svg = jsxRuntimeExports.jsx("polygon", {
transform,
points: BasicSvgShape.circlePoints(50 - strokeWidth, 5)
});
} else if (this.state.rxData.svgType === "square") {
svg = jsxRuntimeExports.jsx("polygon", {
transform,
points: BasicSvgShape.circlePoints(50 - strokeWidth, 4)
});
} else if (this.state.rxData.svgType === "hexagone") {
svg = jsxRuntimeExports.jsx("polygon", {
transform,
points: BasicSvgShape.circlePoints(50 - strokeWidth, 6)
});
} else if (this.state.rxData.svgType === "octagone") {
svg = jsxRuntimeExports.jsx("polygon", {
transform,
points: BasicSvgShape.circlePoints(50 - strokeWidth, 8)
});
} else if (this.state.rxData.svgType === "custom") {
svg = jsxRuntimeExports.jsx("polygon", {
transform,
points: BasicSvgShape.circlePoints(50 - strokeWidth, Number(this.state.rxData.points) || 3)
});
} else if (this.state.rxData.svgType === "star") {
svg = jsxRuntimeExports.jsx("polygon", {
transform,
points: BasicSvgShape.circlePoints(50 - strokeWidth, 5, 144)
});
} else if (this.state.rxData.svgType === "arrow") {
svg = jsxRuntimeExports.jsx("polygon", {
transform: `${transform} translate(0,10)`,
points: "0, -50 -43.3, 25 0,0 43.3, 25"
});
}
return jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
children: jsxRuntimeExports.jsx("svg", {
xmlns: "http://www.w3.org/2000/svg",
version: "1.1",
viewBox: "-50 -50 100 100",
style: {
display: "block",
width: "100%",
height: "100%",
fill: this.state.rxData.fill,
stroke: this.state.rxData.strokeColor,
strokeWidth: this.state.rxData.strokeWidth
},
children: svg
})
});
}
}
class BasicScreenResolution extends VisRxWidget {
essentialData;
constructor(props) {
super(props);
this.state = {
...this.state,
width: document.documentElement.clientWidth,
height: document.documentElement.clientHeight
};
this.essentialData = JSON.stringify(this.buildEssentialProjectData());
}
buildEssentialProjectData() {
return Object.keys(this.props.context.views).sort().filter((f) => f !== "___settings").map((viewId) => {
var _a, _b, _c, _d, _e, _f;
return {
id: viewId,
sizex: (_b = (_a = this.props.context.views[viewId]) == null ? void 0 : _a.settings) == null ? void 0 : _b.sizex,
sizey: (_d = (_c = this.props.context.views[viewId]) == null ? void 0 : _c.settings) == null ? void 0 : _d.sizey,
useAsDefault: (_f = (_e = this.props.context.views[viewId]) == null ? void 0 : _e.settings) == null ? void 0 : _f.useAsDefault
};
});
}
static getWidgetInfo() {
return {
id: "tplScreenResolution",
visSet: "basic",
visName: "Screen Resolution",
visPrev: "widgets/basic/img/Prev_ScreenResolution.png",
visAttrs: [],
visDefaultStyle: {
width: 170,
height: 75
}
};
}
componentDidMount() {
super.componentDidMount();
window.addEventListener("resize", this.onResize);
window.addEventListener("hashchange", this.onResize);
this.onResize();
}
componentWillUnmount() {
super.componentWillUnmount();
window.removeEventListener("resize", this.onResize);
window.removeEventListener("hashchange", this.onResize);
}
getWidgetInfo() {
return BasicScreenResolution.getWidgetInfo();
}
createScreenText() {
return jsxRuntimeExports.jsx("span", {
style: {
fontWeight: "bold",
cursor: "pointer"
},
onClick: () => {
if (!window.vis.instance) {
window.vis.generateInstance();
if (window.vis.instance) {
this.forceUpdate();
} else {
window.alert("Cannot generate!");
}
}
},
children: __mf_2.t("click to create")
});
}
onResize = () => {
var _a, _b, _c, _d;
let width;
let height;
let defaultView;
if (this.props.editMode) {
width = ((_b = (_a = this.props.context.views[this.props.context.activeView]) == null ? void 0 : _a.settings) == null ? void 0 : _b.sizex) || window.document.documentElement.clientWidth;
height = ((_d = (_c = this.props.context.views[this.props.context.activeView]) == null ? void 0 : _c.settings) == null ? void 0 : _d.sizey) || window.document.documentElement.clientHeight;
defaultView = window.vis.findNearestResolution(width, height);
} else {
width = document.documentElement.clientWidth || 0;
height = document.documentElement.clientHeight;
defaultView = window.vis.findNearestResolution();
}
this.setState({
width,
height,
defaultView
});
};
renderWidgetBody(props) {
super.renderWidgetBody(props);
const state = this.state;
const essentialData = JSON.stringify(this.buildEssentialProjectData());
if (essentialData !== this.essentialData) {
this.essentialData = essentialData;
setTimeout(() => this.onResize(), 100);
}
const style = {
border: "1px solid #888",
fontSize: 12,
opacity: 0.8,
width: "100%",
height: "100%",
boxSizing: "border-box",
padding: 10,
display: "flex",
flexDirection: "column",
overflow: "hidden",
justifyContent: "center"
};
const valueStyle = {
marginLeft: 8,
fontWeight: "bold"
};
return jsxRuntimeExports.jsxs("div", {
className: "vis-widget-body",
style,
children: [
jsxRuntimeExports.jsxs("div", {
children: [
__mf_2.t("Default view"),
":",
jsxRuntimeExports.jsx("span", {
style: valueStyle,
children: state.defaultView
})
]
}),
jsxRuntimeExports.jsxs("div", {
children: [
__mf_2.t("Width"),
":",
jsxRuntimeExports.jsxs("span", {
style: valueStyle,
children: [
state.width,
"px"
]
})
]
}),
jsxRuntimeExports.jsxs("div", {
children: [
__mf_2.t("Height"),
":",
jsxRuntimeExports.jsxs("span", {
style: valueStyle,
children: [
state.height,
"px"
]
})
]
}),
jsxRuntimeExports.jsxs("div", {
children: [
__mf_2.t("Instance"),
":",
jsxRuntimeExports.jsx("span", {
style: valueStyle,
children: window.vis.instance || this.createScreenText()
})
]
})
]
});
}
}
class BasicSpeechToText extends VisRxWidget {
recognition;
ignoreOnEnd = false;
componentDidMount() {
super.componentDidMount();
this.setState({
text: !window.webkitSpeechRecognition ? __mf_2.t("basic_speech2text_info_upgrade") : "",
image: this.state.rxData.imageInactive,
result: "",
resultColor: this.state.rxData.keyWordColor
});
if (!window.webkitSpeechRecognition) {
return;
}
if (this.state.rxData.speechMode === "continuous" && !this.state.editMode) {
this.startRecognition();
} else {
this.setState({
text: __mf_2.t("basic_speech2text_info_start")
});
}
}
getWidgetInfo() {
return BasicSpeechToText.getWidgetInfo();
}
static getWidgetInfo() {
return {
id: "tplSpeech2Text",
visSet: "basic",
visName: "Speech to Text",
visPrev: "widgets/basic/img/Prev_Speech2Text.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "oid",
type: "id"
},
{
name: "speechMode",
type: "select",
default: "single",
options: [
{
value: "single",
label: "basic_speech2text_single"
},
{
value: "startstop",
label: "basic_speech2text_start_stop"
},
{
value: "continuous",
label: "basic_speech2text_continuous"
}
]
},
{
name: "language",
type: "select",
options: [
{
value: "",
label: ""
},
{
value: "en-US",
label: "basic_speech2text_en_us"
},
{
value: "de",
label: "de"
},
{
value: "ru-RU",
label: "basic_speech2text_ru_ru"
}
]
},
{
name: "keywords"
}
]
},
{
name: "image",
label: "Image",
fields: [
{
name: "noImage",
type: "checkbox",
label: "basic_speech2text_no_image"
},
{
name: "imageInactive",
default: "widgets/basic/img/micInactive.svg",
type: "image",
label: "basic_speech2text_image_inactive"
},
{
name: "imageActive",
default: "widgets/basic/img/micActive.svg",
type: "image",
label: "basic_speech2text_image_active"
},
{
name: "imageStarted",
default: "widgets/basic/img/micStarted.svg",
type: "image",
label: "basic_speech2text_started"
},
{
name: "imageDetected",
default: "widgets/basic/img/micDetected.svg",
type: "image",
label: "basic_speech2text_detected"
},
{
name: "imageSent",
default: "widgets/basic/img/micSent.svg",
type: "image",
label: "basic_speech2text_sent"
},
{
name: "imageHeightPx",
default: 70,
type: "slider",
min: 0,
max: 200,
step: 1,
label: "basic_speech2text_height"
},
{
name: "imageWidthPx",
default: 70,
type: "slider",
min: 0,
max: 200,
step: 1,
label: "basic_speech2text_width"
}
]
},
{
name: "text",
label: "Text",
fields: [
{
name: "noText",
type: "checkbox",
label: "basic_speech2text_no_text"
},
{
name: "noResults",
type: "checkbox",
label: "basic_speech2text_no_results"
},
{
name: "keyWordColor",
type: "color",
default: "#FFB051",
label: "basic_speech2text_key_word_color",
tooltip: "basic_speech2text_key_word_color_tooltip"
},
{
name: "textSentColor",
type: "color",
default: "#7E88D3",
label: "basic_speech2text_text_sent_color",
tooltip: "basic_speech2text_text_sent_color_tooltip"
}
]
}
],
visDefaultStyle: {
width: 500,
height: 77
}
};
}
findKeyWord(text) {
const words = this.state.rxData.keywords ? this.state.rxData.keywords.toLowerCase().split(/[\s,;]+/g) : null;
let found = false;
if (words) {
const wwords = text.toLowerCase().split(" ");
for (let w = 0; w < words.length; w++) {
const pos = wwords.indexOf(words[w]);
if (pos !== -1) {
let offset2 = 0;
for (let p = 0; p < pos; p++) {
offset2 += wwords[p].length + 1;
}
text = `${text.substring(0, offset2)}<b>${text.substring(offset2, offset2 + wwords[pos].length)}</b>${text.substring(offset2 + wwords[pos].length)}`;
found = true;
break;
}
}
} else {
return true;
}
return found ? text : false;
}
startRecognition() {
if (this.recognition) {
if (this.state.rxData.speechMode === "startstop") {
this.recognition.onend = null;
this.recognition.stop();
this.recognition = null;
this.setState({
text: __mf_2.t("basic_speech2text_info_start"),
image: this.state.rxData.imageInactive
});
}
return;
}
this.recognition = new window.webkitSpeechRecognition();
this.recognition.continuous = this.state.rxData.speechMode === "continuous" || this.state.rxData.speechMode === "startstop";
this.recognition.interimResults = true;
this.recognition.maxAlternatives = 1;
const startTimestamp = Date.now();
let finalTranscript = "";
let timer;
let lastText = "";
let originalColor;
this.recognition.onstart = () => {
this.setState({
text: __mf_2.t("basic_speech2text_info_speak_now"),
image: this.state.rxData.imageActive,
result: ""
});
};
this.recognition.onerror = (event) => {
this.setState({
result: "",
image: this.state.rxData.imageInactive
});
if (event.error === "no-speech") {
this.setState({
text: __mf_2.t("basic_speech2text_info_no_speech")
});
}
if (event.error === "audio-capture") {
this.setState({
text: __mf_2.t("basic_speech2text_info_no_microphone")
});
this.ignoreOnEnd = true;
}
if (event.error === "not-allowed") {
if (event.timeStamp - startTimestamp < 100) {
this.setState({
text: __mf_2.t("basic_speech2text_info_blocked")
});
} else {
this.setState({
text: __mf_2.t("basic_speech2text_info_denied")
});
}
this.ignoreOnEnd = true;
}
};
this.recognition.onend = () => {
this.recognition.stop();
this.recognition = null;
if (!this.ignoreOnEnd) {
setTimeout(() => {
this.setState({
image: this.state.rxData.imageInactive
});
if (this.state.rxData.speechMode === "continuous") {
this.setState({
result: "",
text: __mf_2.t("basic_speech2text_info_speak_now")
});
this.startRecognition();
} else {
this.setState({
result: "",
text: __mf_2.t("basic_speech2text_info_start")
});
}
}, 1e3);
}
};
this.recognition.onresult = (event) => {
let interimTranscript = "";
if (typeof event.results === "undefined") {
this.recognition.onend = null;
this.recognition.stop();
return;
}
for (let i = event.resultIndex; i < event.results.length; ++i) {
if (event.results[i].isFinal) {
finalTranscript += event.results[i][0].transcript;
} else {
interimTranscript += event.results[i][0].transcript;
}
}
if (this.state.image === this.state.rxData.imageActive) {
this.setState({
image: this.state.rxData.imageStarted
});
}
this.setState({
text: ""
});
let text = finalTranscript || interimTranscript;
const foundKeyword = this.findKeyWord(text);
if (!originalColor) {
originalColor = this.state.resultColor;
}
if (foundKeyword) {
text = typeof foundKeyword === "string" ? foundKeyword : text;
if (this.state.image === this.state.rxData.imageStarted) {
this.setState({
image: this.state.rxData.imageDetected
});
}
if (this.state.rxData.keyWordColor) {
this.setState({
resultColor: this.state.rxData.keyWordColor
});
}
}
this.setState({
text
});
if (finalTranscript) {
if (timer) {
clearTimeout(timer);
}
if (foundKeyword) {
this.setState({
image: this.state.rxData.imageSent
});
if (this.state.rxData.textSentColor) {
this.setState({
resultColor: this.state.rxData.textSentColor
});
}
this.props.context.setValue(this.state.rxData.oid, finalTranscript);
}
finalTranscript = "";
lastText = "";
setTimeout(() => {
this.setState({
image: this.state.rxData.imageActive,
text: __mf_2.t("basic_speech2text_info_speak_now"),
resultColor: originalColor,
result: ""
});
}, 1e3);
} else {
lastText = interimTranscript;
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(() => {
this.recognition.onend = null;
this.recognition.stop();
this.recognition = null;
const hasKeyword = !!this.findKeyWord(lastText);
if (hasKeyword) {
this.setState({
image: this.state.rxData.imageSent
});
if (this.state.rxData.textSentColor) {
this.setState({
resultColor: this.state.rxData.textSentColor
});
}
this.props.context.setValue(this.state.rxData.oid, finalTranscript);
}
finalTranscript = "";
lastText = "";
setTimeout(() => {
this.setState({
image: this.state.rxData.imageActive,
text: __mf_2.t("basic_speech2text_info_speak_now"),
resultColor: originalColor,
result: ""
});
this.startRecognition();
}, 1e3);
}, 3e3);
}
};
this.recognition.lang = this.state.rxData.language;
this.recognition.start();
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
return jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
children: jsxRuntimeExports.jsx("table", {
style: {
height: "100%",
width: "100%"
},
onClick: () => {
if (this.state.rxData.speechMode !== "continuous" && !this.state.editMode && window.webkitSpeechRecognition) {
this.startRecognition();
}
},
children: jsxRuntimeExports.jsx("tbody", {
children: jsxRuntimeExports.jsxs("tr", {
children: [
jsxRuntimeExports.jsx("td", {
style: {
display: this.state.rxData.noImage ? "none" : void 0
},
children: jsxRuntimeExports.jsx(__mf_15, {
alt: "mic",
style: {
height: `${this.state.rxData.imageHeightPx}px`,
width: `${this.state.rxData.imageWidthPx}px`
},
src: this.state.image
})
}),
jsxRuntimeExports.jsxs("td", {
className: "mic-text",
style: {
width: "100%"
},
children: [
jsxRuntimeExports.jsx("div", {
style: {
display: this.state.rxData.noText ? "none" : void 0
},
dangerouslySetInnerHTML: {
__html: this.state.text
}
}),
jsxRuntimeExports.jsx("div", {
style: {
display: this.state.rxData.noResults ? "none" : void 0,
color: this.state.resultColor
},
dangerouslySetInnerHTML: {
__html: this.state.result
}
})
]
})
]
})
})
})
});
}
}
class BasicIFrame extends VisRxWidget {
refreshInterval = null;
frameRef;
hashInstalled = false;
onWakeUpInstalled = false;
startedInterval = 0;
constructor(props) {
super(props);
this.frameRef = React.createRef();
}
static getWidgetInfo() {
return {
id: "tplIFrame",
visSet: "basic",
visName: "iFrame",
visPrev: "widgets/basic/img/Prev_iFrame.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "src",
type: "url"
},
{
name: "refreshInterval",
tooltip: "basic_refreshInterval_tooltip",
type: "slider",
min: 0,
max: 18e4,
step: 100,
default: 0
},
{
name: "noSandbox",
type: "checkbox"
},
{
name: "refreshOnWakeUp",
type: "checkbox"
},
{
name: "refreshOnViewChange",
type: "checkbox"
},
{
name: "refreshWithNoQuery",
type: "checkbox"
},
{
name: "scrollX",
type: "checkbox"
},
{
name: "scrollY",
type: "checkbox"
},
{
name: "seamless",
type: "checkbox",
default: true
}
]
}
],
visDefaultStyle: {
width: 600,
height: 320
}
};
}
componentDidMount() {
super.componentDidMount();
this.onPropertyUpdate();
}
componentWillUnmount() {
super.componentWillUnmount();
if (this.refreshInterval) {
clearInterval(this.refreshInterval);
this.refreshInterval = null;
}
if (this.hashInstalled) {
this.hashInstalled = false;
window.removeEventListener("hashchange", this.onHashChange);
}
}
getWidgetInfo() {
return BasicIFrame.getWidgetInfo();
}
onHashChange = () => {
if (this.props.context.activeView === this.props.view) {
this.refreshIFrame();
}
};
refreshIFrame() {
var _a, _b;
if (this.state.rxData.refreshWithNoQuery === true) {
(_b = (_a = this.frameRef.current) == null ? void 0 : _a.contentWindow) == null ? void 0 : _b.location.reload();
} else if (this.frameRef.current) {
this.frameRef.current.src = `${this.state.rxData.src}${this.state.rxData.src.includes("?") ? "&" : "?"}_refts=${Date.now()}`;
}
}
static isHidden(el) {
return el.offsetParent === null;
}
static getParents(el) {
const els = [];
let pel = el;
do {
pel = pel.parentNode;
els.unshift(el);
} while (pel);
return els;
}
onPropertyUpdate() {
const src = this.state.rxData.src || "";
const refreshInterval = Number(this.state.rxData.refreshInterval) || 0;
const refreshOnViewChange = this.state.rxData.refreshOnViewChange === true;
const refreshOnWakeUp = this.state.rxData.refreshOnWakeUp === true;
if (src) {
if (refreshOnViewChange) {
if (!this.hashInstalled) {
this.hashInstalled = true;
window.addEventListener("hashchange", this.onHashChange);
}
} else if (this.hashInstalled) {
this.hashInstalled = false;
window.removeEventListener("hashchange", this.onHashChange);
}
if (refreshInterval > 0) {
if (this.startedInterval !== refreshInterval) {
this.startedInterval = refreshInterval;
this.refreshInterval && clearInterval(this.refreshInterval);
this.refreshInterval = null;
}
this.refreshInterval = this.refreshInterval || setInterval(() => {
if (this.frameRef.current && !BasicIFrame.isHidden(this.frameRef.current)) {
const parents = BasicIFrame.getParents(this.frameRef.current).filter((el) => BasicIFrame.isHidden(el));
if (!parents.length || parents[0].tagName === "BODY" || parents[0].id === "materialdesign-vuetify-container") {
this.refreshIFrame();
}
}
}, refreshInterval);
} else if (this.refreshInterval) {
this.startedInterval = 0;
clearInterval(this.refreshInterval);
this.refreshInterval = null;
}
if (refreshOnWakeUp) {
if (!this.onWakeUpInstalled) {
this.onWakeUpInstalled = true;
window.vis.onWakeUp(this.onHashChange, this.props.id);
}
} else if (this.onWakeUpInstalled) {
this.onWakeUpInstalled = false;
window.vis.onWakeUp(null, this.props.id);
}
}
}
onRxDataChanged() {
this.onPropertyUpdate();
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
if (this.props.editMode) {
props.overlayClassNames.push("vis-editmode-helper");
}
const style = {
position: "absolute",
boxSizing: "border-box",
padding: 0,
margin: 0,
border: 0,
width: "100%",
height: "100%",
overflowX: this.state.rxData.scrollX ? "scroll" : "hidden",
overflowY: this.state.rxData.scrollY ? "scroll" : "hidden"
};
const src = this.state.rxData.src || "";
return src ? jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
children: jsxRuntimeExports.jsx("iframe", {
style,
ref: this.frameRef,
title: this.props.id,
src: this.state.rxData.src,
sandbox: this.state.rxData.noSandbox ? "allow-modals allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts" : void 0,
seamless: this.state.rxData.seamless
})
}) : null;
}
}
class BasicIFrame8 extends VisRxWidget {
refreshInterval = null;
frameRef;
hashInstalled = false;
onWakeUpInstalled = false;
startedInterval = 0;
constructor(props) {
super(props);
this.frameRef = React.createRef();
}
static getWidgetInfo() {
return {
id: "tplStatefulIFrame8",
visSet: "basic",
visName: "iFrame 8",
visPrev: "widgets/basic/img/Prev_StatefulIFrame8.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "oid",
type: "id"
},
{
name: "refreshInterval",
tooltip: "basic_refreshInterval_tooltip",
type: "slider",
min: 0,
max: 18e4,
step: 100,
default: 0
},
{
name: "refreshOnWakeUp",
type: "checkbox"
},
{
name: "refreshOnViewChange",
type: "checkbox"
},
{
name: "refreshWithNoQuery",
type: "checkbox"
},
{
name: "scrollX",
type: "checkbox"
},
{
name: "scrollY",
type: "checkbox"
},
{
name: "seamless",
type: "checkbox",
default: true
},
{
name: "count",
type: "slider",
min: 1,
max: 20,
default: 2
}
]
},
{
name: "frames",
label: "frames",
indexFrom: 0,
indexTo: "count",
fields: [
{
name: "src_",
type: "id"
},
{
name: "noSandbox",
type: "checkbox"
}
]
}
],
visDefaultStyle: {
width: 600,
height: 320
}
};
}
componentDidMount() {
super.componentDidMount();
this.onPropertyUpdate();
}
componentWillUnmount() {
super.componentWillUnmount();
this.refreshInterval && clearInterval(this.refreshInterval);
if (this.hashInstalled) {
this.hashInstalled = false;
window.removeEventListener("hashchange", this.onHashChange);
}
}
getWidgetInfo() {
return BasicIFrame8.getWidgetInfo();
}
getSrc() {
const value = this.state.values[`${this.state.rxData.oid}.val`];
if (value === void 0 || value === null) {
return this.state.rxData.src_1;
}
return this.state.rxData[`src_${value}`] || "";
}
getNoSandBox() {
const value = this.state.values[`${this.state.rxData.oid}.val`];
if (value === void 0 || value === null) {
return this.state.rxData.noSandbox1;
}
return this.state.rxData[`noSandbox${value}`] === true || this.state.rxData[`noSandbox${value}`] === "true";
}
onHashChange = () => {
if (this.props.context.activeView === this.props.view) {
this.refreshIFrame();
}
};
refreshIFrame() {
var _a, _b;
if (this.state.rxData.refreshWithNoQuery === true) {
(_b = (_a = this.frameRef.current) == null ? void 0 : _a.contentWindow) == null ? void 0 : _b.location.reload();
} else if (this.frameRef.current) {
const src = this.getSrc();
this.frameRef.current.src = `${src}${src.includes("?") ? "&" : "?"}_refts=${Date.now()}`;
}
}
static isHidden(el) {
return el.offsetParent === null;
}
static getParents(el) {
const els = [];
let pel = el;
do {
pel = pel.parentNode;
els.unshift(el);
} while (pel);
return els;
}
onPropertyUpdate() {
const src = this.getSrc();
const refreshInterval = Number(this.state.rxData.refreshInterval) || 0;
const refreshOnViewChange = this.state.rxData.refreshOnViewChange === true;
const refreshOnWakeUp = this.state.rxData.refreshOnWakeUp === true;
if (src) {
if (refreshOnViewChange) {
if (!this.hashInstalled) {
this.hashInstalled = true;
window.addEventListener("hashchange", this.onHashChange);
}
} else if (this.hashInstalled) {
this.hashInstalled = false;
window.removeEventListener("hashchange", this.onHashChange);
}
if (refreshInterval > 0) {
if (this.startedInterval !== refreshInterval) {
this.startedInterval = refreshInterval;
this.refreshInterval && clearInterval(this.refreshInterval);
this.refreshInterval = null;
}
this.refreshInterval = this.refreshInterval || setInterval(() => {
if (this.frameRef.current && !BasicIFrame8.isHidden(this.frameRef.current)) {
const parents = BasicIFrame8.getParents(this.frameRef.current).filter((el) => BasicIFrame8.isHidden(el));
if (!parents.length || parents[0].tagName === "BODY" || parents[0].id === "materialdesign-vuetify-container") {
this.refreshIFrame();
}
}
}, refreshInterval);
} else if (this.refreshInterval) {
this.startedInterval = 0;
clearInterval(this.refreshInterval);
this.refreshInterval = null;
}
if (refreshOnWakeUp) {
if (!this.onWakeUpInstalled) {
this.onWakeUpInstalled = true;
window.vis.onWakeUp(this.onHashChange, this.props.id);
}
} else if (this.onWakeUpInstalled) {
this.onWakeUpInstalled = false;
window.vis.onWakeUp(null, this.props.id);
}
}
}
onRxDataChanged() {
this.onPropertyUpdate();
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
if (this.props.editMode) {
props.overlayClassNames.push("vis-editmode-helper");
}
const style = {
position: "absolute",
boxSizing: "border-box",
padding: 0,
margin: 0,
border: 0,
width: "100%",
height: "100%",
overflowX: this.state.rxData.scrollX ? "scroll" : "hidden",
overflowY: this.state.rxData.scrollY ? "scroll" : "hidden"
};
const src = this.getSrc();
const noSandbox = this.getNoSandBox();
return src ? jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
children: jsxRuntimeExports.jsx("iframe", {
style,
ref: this.frameRef,
title: this.props.id,
src,
sandbox: noSandbox ? "allow-modals allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts" : void 0,
seamless: this.state.rxData.seamless
})
}) : null;
}
}
class BasicImageGeneric extends VisRxWidget {
refreshInterval = null;
imageRef = React.createRef();
hashInstalled = false;
onWakeUpInstalled = false;
startedInterval = 0;
constructor(props) {
super(props);
}
componentDidMount() {
super.componentDidMount();
this.onPropertyUpdate();
}
componentWillUnmount() {
super.componentWillUnmount();
if (this.refreshInterval) {
clearInterval(this.refreshInterval);
}
if (this.hashInstalled) {
this.hashInstalled = false;
window.removeEventListener("hashchange", this.onHashChange);
}
}
onHashChange = () => {
if (this.props.context.activeView === this.props.view) {
this.refreshImage();
}
};
refreshImage() {
if (this.imageRef.current) {
const str = this.getImage();
if (this.state.rxData.refreshWithNoQuery === true) {
this.imageRef.current.src = str;
} else {
this.imageRef.current.src = `${str}${str.includes("?") ? "&" : "?"}_refts=${Date.now()}`;
}
}
}
static isHidden(el) {
return el.offsetParent === null;
}
static getParents(el) {
const els = [];
let pel = el;
do {
pel = pel.parentNode;
els.unshift(el);
} while (pel);
return els;
}
onPropertyUpdate() {
const src = this.getImage();
const refreshInterval = Number(this.state.rxData.refreshInterval) || 0;
const refreshOnViewChange = this.state.rxData.refreshOnViewChange === true;
const refreshOnWakeUp = this.state.rxData.refreshOnWakeUp === true;
if (src) {
if (refreshOnViewChange) {
if (!this.hashInstalled) {
this.hashInstalled = true;
window.addEventListener("hashchange", this.onHashChange);
}
} else if (this.hashInstalled) {
this.hashInstalled = false;
window.removeEventListener("hashchange", this.onHashChange);
}
if (refreshInterval > 0) {
if (this.startedInterval !== refreshInterval) {
this.startedInterval = refreshInterval;
if (this.refreshInterval) {
clearInterval(this.refreshInterval);
this.refreshInterval = null;
}
}
this.refreshInterval || (this.refreshInterval = setInterval(() => {
if (this.imageRef.current && !BasicImageGeneric.isHidden(this.imageRef.current)) {
const parents = BasicImageGeneric.getParents(this.imageRef.current).filter((el) => BasicImageGeneric.isHidden(el));
if (!parents.length || parents[0].tagName === "BODY" || parents[0].id === "materialdesign-vuetify-container") {
this.refreshImage();
}
}
}, refreshInterval));
} else if (this.refreshInterval) {
this.startedInterval = 0;
clearInterval(this.refreshInterval);
this.refreshInterval = null;
}
if (refreshOnWakeUp) {
if (!this.onWakeUpInstalled) {
this.onWakeUpInstalled = true;
window.vis.onWakeUp(this.onHashChange, this.props.id);
}
} else if (this.onWakeUpInstalled) {
this.onWakeUpInstalled = false;
window.vis.onWakeUp(null, this.props.id);
}
}
}
onRxDataChanged() {
this.onPropertyUpdate();
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
if (this.props.editMode) {
props.overlayClassNames.push("vis-editmode-helper");
} else if (!this.state.rxData.allowUserInteractions) {
props.style.pointerEvents = "none";
props.style.userSelect = "none";
props.style.touchAction = "none";
}
const style = {
padding: 0,
margin: 0,
border: 0,
width: "100%",
height: "auto"
};
if (this.state.rxData.stretch) {
style.height = "100%";
}
if (!this.state.rxData.allowUserInteractions) {
style.touchAction = "none";
style.userSelect = "none";
style.pointerEvents = "none";
}
const src = this.getImage();
return src ? jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
style: {
overflow: "hidden",
pointerEvents: this.state.rxData.allowUserInteractions ? void 0 : "none",
touchAction: this.state.rxData.allowUserInteractions ? void 0 : "none",
userSelect: this.state.rxData.allowUserInteractions ? void 0 : "none"
},
children: jsxRuntimeExports.jsx(__mf_15, {
style,
ref: this.imageRef,
src,
alt: this.props.id
})
}) : null;
}
}
class BasicImage extends BasicImageGeneric {
static getWidgetInfo() {
return {
id: "tplImage",
visSet: "basic",
visName: "Image",
visPrev: "widgets/basic/img/Prev_Image.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "src",
type: "image"
},
{
name: "stretch",
type: "checkbox"
},
{
name: "refreshInterval",
tooltip: "basic_refreshInterval_tooltip",
type: "slider",
min: 0,
max: 18e4,
step: 100,
default: 0
},
{
name: "refreshOnWakeUp",
type: "checkbox"
},
{
name: "refreshOnViewChange",
type: "checkbox"
},
{
name: "refreshWithNoQuery",
type: "checkbox"
},
{
name: "allowUserInteractions",
type: "checkbox"
}
]
}
],
visDefaultStyle: {
width: 200,
height: 130
}
};
}
getWidgetInfo() {
return BasicImage.getWidgetInfo();
}
getImage() {
return this.state.rxData.src || "";
}
}
class BasicHtmlNav extends VisRxWidget {
static getWidgetInfo() {
return {
id: "tplHtmlNav",
visSet: "basic",
visName: "HTML navigation",
visPrev: "widgets/basic/img/Prev_HTMLnavigation.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "html",
type: "html"
},
{
name: "nav_view",
type: "views"
},
{
name: "sub_view",
label: "basic_sub_view",
type: "text",
tooltip: "sub_view_tooltip",
hidden: "!data.nav_view"
}
]
}
],
visDefaultStyle: {
width: 200,
height: 130
}
};
}
getWidgetInfo() {
return BasicHtmlNav.getWidgetInfo();
}
onNavigate = () => {
if (this.state.rxData.nav_view) {
this.props.context.changeView((this.state.rxData.nav_view || "").toString(), this.state.rxData.sub_view ? this.state.rxData.sub_view.toString() : void 0);
}
};
renderWidgetBody(props) {
super.renderWidgetBody(props);
if (props.style.width === void 0) {
props.style.width = 200;
}
if (props.style.height === void 0) {
props.style.height = 130;
}
return jsxRuntimeExports.jsx(DangerousHtmlWithScript, {
className: "vis-widget-body",
html: (this.state.rxData.html || "").toString(),
isDiv: true,
wid: this.props.id,
onClick: this.props.editMode ? null : this.onNavigate
});
}
}
class FiltersEditorDialog extends React.Component {
render() {
return null;
}
}
function processFilter(filters) {
const len = filters.length;
for (let f = 0; f < len; f++) {
const filter = filters[f];
if (filter.includes(",")) {
const ff = filter.split(",").map((t) => t.trim()).filter((t) => t);
const first = ff.shift();
if (first) {
filters[f] = first;
if (ff.length) {
filters.push(...ff);
}
}
} else if (filter.includes(";")) {
const ff = filter.split(";").map((t) => t.trim()).filter((t) => t);
const first = ff.shift();
if (first) {
filters[f] = first;
if (ff.length) {
filters.push(...ff);
}
}
}
}
}
const ItemsEditor = (props) => {
const [open, setOpen] = __mf_32$1(false);
let items = props.data.items;
if (open && !items && props.data.filters) {
items = props.data.filters.split(";").map((item) => ({
label: item.trim(),
value: item.trim()
})).filter((item) => item.value);
}
if (open && typeof items === "string") {
try {
items = JSON.parse(items);
} catch {
items = [];
}
}
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
children: [
jsxRuntimeExports.jsx(__mf_16, {
style: {
whiteSpace: "nowrap"
},
onClick: () => setOpen(true),
variant: "outlined",
startIcon: jsxRuntimeExports.jsx(__mf_2876, {}),
children: __mf_2.t("Edit")
}),
open ? jsxRuntimeExports.jsx(FiltersEditorDialog, {
context: props.context,
items: items || [],
multiple: props.data.multiple,
onClose: (newItems) => {
if (newItems) {
const data = JSON.parse(JSON.stringify(props.data));
data.items = JSON.stringify(newItems);
props.setData(data);
}
setOpen(false);
}
}) : null
]
});
};
class BasicFilterDropdown extends VisRxWidget {
editMode;
static getWidgetInfo() {
return {
id: "tplFilterDropdown",
visSet: "basic",
visName: "filter - dropdown",
visPrev: "widgets/basic/img/Prev_FilterDropdown.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "items",
label: "editor",
type: "custom",
noBinding: true,
component: (_field, data, onDataChange, props) => jsxRuntimeExports.jsx(ItemsEditor, {
data,
setData: onDataChange,
context: props.context
}),
default: "[]"
},
{
name: "type",
label: "Type",
type: "select",
options: [
{
value: "dropdown",
label: "basic_filter_type_dropdown"
},
{
value: "horizontal_buttons",
label: "basic_filter_type_horizontal_buttons"
},
{
value: "vertical_buttons",
label: "basic_filter_type_vertical_buttons"
}
],
default: "horizontal_buttons"
},
{
name: "widgetTitle",
label: "name",
hidden: 'data.type !== "dropdown"'
},
{
name: "autoFocus",
type: "checkbox",
hidden: 'data.type !== "dropdown"'
},
{
name: "multiple",
label: "basic_filter_multiple",
type: "checkbox"
},
{
name: "noAllOption",
label: "basic_no_all_option",
type: "checkbox"
},
{
name: "noFilterText",
label: "basic_no_filter_text",
type: "text",
hidden: "!!data.noAllOption"
},
{
name: "dropdownVariant",
label: "jqui_variant",
type: "select",
noTranslation: true,
options: [
{
value: "standard",
label: "standard"
},
{
value: "outlined",
label: "outlined"
},
{
value: "filled",
label: "filled"
}
],
default: "standard",
hidden: 'data.type !== "dropdown"'
},
{
name: "buttonsVariant",
label: "jqui_variant",
type: "select",
noTranslation: true,
options: [
{
value: "outlined",
label: "outlined"
},
{
value: "contained",
label: "contained"
},
{
value: "text",
label: "text"
}
],
default: "outlined",
hidden: 'data.type === "dropdown"'
},
{
name: "dropdownSmall",
label: "basic_small",
default: false,
type: "checkbox",
hidden: 'data.type !== "dropdown"'
}
]
}
],
visDefaultStyle: {
width: 200,
height: 50
}
};
}
getWidgetInfo() {
return BasicFilterDropdown.getWidgetInfo();
}
componentDidMount() {
super.componentDidMount();
if (!this.props.editMode) {
this.editMode = false;
const items = this.getItems();
if (items.find((item) => item.default && item.value)) {
const filter = [];
items.forEach((item) => item.default && filter.push(item.value));
processFilter(filter);
setTimeout(() => {
const view = this.props.askView("getViewClass");
view.onCommand("changeFilter", {
filter
});
}, 0);
}
} else {
this.editMode = true;
}
}
onCommand(command) {
if (command === "changeFilter") {
this.forceUpdate();
}
super.onCommand(command);
}
renderDropdown(items) {
const viewsActiveFilter = this.props.viewsActiveFilter[this.props.view] || [];
let value;
if (this.state.rxData.multiple) {
value = viewsActiveFilter;
} else {
value = viewsActiveFilter[0] || "";
}
return jsxRuntimeExports.jsxs(__mf_42, {
fullWidth: true,
variant: this.state.rxData.dropdownVariant || "standard",
children: [
this.state.rxData.widgetTitle ? jsxRuntimeExports.jsx(__mf_60, {
children: this.state.rxData.widgetTitle
}) : null,
jsxRuntimeExports.jsxs(__mf_89, {
fullWidth: true,
value: value || "_",
onChange: (e) => {
let filter = e.target.value === "_" ? [] : e.target.value;
if (typeof filter === "string") {
filter = filter.split(",");
}
if (filter.includes("") || filter.includes("_")) {
filter = [];
}
processFilter(filter);
const view = this.props.askView("getViewClass");
view.onCommand("changeFilter", {
filter
});
},
renderValue: (val) => {
const option = items.find((item) => item.value === val);
if (option) {
return jsxRuntimeExports.jsx("span", {
style: {
color: option.color
},
children: option.label
});
}
if (val === "_" || !val) {
return this.state.rxData.noAllOption ? "" : __mf_2.t("basic_no_filter");
}
return val;
},
multiple: !!this.state.rxData.multiple,
autoFocus: !!this.state.rxData.autoFocus,
children: [
this.state.rxData.noAllOption ? null : jsxRuntimeExports.jsx(__mf_72, {
value: "_",
children: jsxRuntimeExports.jsx("em", {
children: this.state.rxData.noFilterText || __mf_2.t("basic_no_filter")
})
}),
items.map((option) => {
let image = option.icon;
if (!image && option.image) {
image = option.image;
if (image.startsWith("_PRJ_NAME/")) {
image = image.replace("_PRJ_NAME/", `../${this.props.context.adapterName}.${this.props.context.instance}/${this.props.context.projectName}/`);
}
}
return jsxRuntimeExports.jsxs(__mf_72, {
value: option.value,
selected: viewsActiveFilter.includes(option.value),
style: {
color: viewsActiveFilter.includes(option.value) ? option.color : option.activeColor || option.color
},
children: [
image ? jsxRuntimeExports.jsx(__mf_15, {
src: image,
style: {
width: 24,
height: 24,
marginRight: 8
}
}) : null,
option.label
]
}, option.value);
})
]
})
]
});
}
renderButtons(items) {
const viewsActiveFilter = this.props.viewsActiveFilter[this.props.view] || [];
return jsxRuntimeExports.jsxs(__mf_18, {
variant: this.state.rxData.buttonsVariant || "contained",
orientation: this.state.rxData.type === "horizontal_buttons" ? "horizontal" : "vertical",
style: {
width: "100%",
height: "100%"
},
children: [
this.state.rxData.noAllOption ? null : jsxRuntimeExports.jsx(__mf_16, {
style: {
flexGrow: 1
},
onClick: () => {
const view = this.props.askView("getViewClass");
view.onCommand("changeFilter", {
filter: []
});
},
children: jsxRuntimeExports.jsx("em", {
children: this.state.rxData.noFilterText || __mf_2.t("basic_no_filter")
})
}),
items.map((option) => {
let image = option.icon;
if (!image && option.image) {
image = option.image;
if (image.startsWith("_PRJ_NAME/")) {
image = image.replace("_PRJ_NAME/", `../${this.props.context.adapterName}.${this.props.context.instance}/${this.props.context.projectName}/`);
}
}
return jsxRuntimeExports.jsx(__mf_16, {
onClick: () => {
let filter;
if (this.state.rxData.multiple) {
filter = viewsActiveFilter.includes(option.value) ? viewsActiveFilter.filter((f) => f !== option.value) : [
...viewsActiveFilter,
option.value
];
} else {
filter = [
option.value
];
}
const view = this.props.askView("getViewClass");
processFilter(filter);
view.onCommand("changeFilter", {
filter
});
},
color: viewsActiveFilter.includes(option.value) ? "primary" : void 0,
sx: (theme) => ({
backgroundColor: viewsActiveFilter.includes(option.value) ? this.state.rxData.buttonsVariant === "contained" ? theme.palette.secondary.main : theme.palette.primary.main : void 0,
color: viewsActiveFilter.includes(option.value) ? this.state.rxData.buttonsVariant === "contained" ? theme.palette.secondary.contrastText : theme.palette.primary.contrastText : void 0,
"&:hover": {
backgroundColor: viewsActiveFilter.includes(option.value) ? this.state.rxData.buttonsVariant === "contained" ? theme.palette.secondary.light : theme.palette.primary.light : void 0,
color: viewsActiveFilter.includes(option.value) ? this.state.rxData.buttonsVariant === "contained" ? theme.palette.secondary.contrastText : theme.palette.primary.contrastText : void 0
}
}),
startIcon: image ? jsxRuntimeExports.jsx(__mf_15, {
src: image,
alt: option.label,
style: {
height: 24
}
}) : null,
style: {
flexGrow: 1,
color: viewsActiveFilter.includes(option.value) ? option.activeColor || option.color : option.color
},
children: option.label
}, option.value);
})
]
});
}
getItems() {
let items = this.state.data.items;
if (!items && this.state.data.filters) {
items = this.state.data.filters.split(";").map((item) => ({
label: item.trim(),
value: item.trim()
})).filter((item) => item.value);
}
if (typeof items === "string") {
try {
items = JSON.parse(items);
} catch {
items = [];
}
}
items = items || [];
return items;
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
if (props.style.width === void 0) {
props.style.width = 200;
}
if (props.style.height === void 0) {
props.style.height = 50;
}
const items = this.getItems();
if (this.editMode !== void 0 && this.editMode !== this.props.editMode) {
this.editMode = this.props.editMode;
if (!this.editMode && items.find((item) => item.default && item.value)) {
const filter = [];
items.forEach((item) => item.default && filter.push(item.value));
processFilter(filter);
setTimeout(() => {
const view = this.props.askView("getViewClass");
view.onCommand("changeFilter", {
filter
});
}, 0);
}
}
const type = this.state.rxData.type || "dropdown";
if (type === "horizontal_buttons" || type === "vertical_buttons") {
return this.renderButtons(items);
}
return this.renderDropdown(items);
}
}
class BasicLink extends VisRxWidget {
static getWidgetInfo() {
return {
id: "tplLink",
visSet: "basic",
visName: "link",
visPrev: "widgets/basic/img/Prev_tplLink.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "html",
type: "html"
},
{
name: "href",
type: "url"
},
{
name: "target",
label: "target",
type: "auto",
options: [
"auto",
"_blank",
"_self",
"_parent",
"_top"
],
hidden: "!data.href"
}
]
}
],
visDefaultStyle: {
width: 200,
height: 130
}
};
}
getWidgetInfo() {
return BasicLink.getWidgetInfo();
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
if (props.style.width === void 0) {
props.style.width = 200;
}
if (props.style.height === void 0) {
props.style.height = 130;
}
return jsxRuntimeExports.jsx("a", {
href: this.state.rxData.href,
target: this.state.rxData.target,
style: {
textDecoration: "none",
width: "100%",
height: "100%"
},
children: jsxRuntimeExports.jsx(DangerousHtmlWithScript, {
className: "vis-widget-body",
html: this.state.rxData.html,
isDiv: true,
wid: this.props.id
})
});
}
}
class BasicImage8 extends BasicImageGeneric {
static getWidgetInfo() {
return {
id: "tplStatefulImage8",
visSet: "basic",
visName: "Image 8",
visPrev: "widgets/basic/img/Prev_StatefulImage.png",
visDefaultStyle: {
width: 200,
height: 130
},
visAttrs: [
{
name: "common",
fields: [
{
name: "oid",
type: "id"
},
{
name: "count",
type: "number",
default: 0,
onChange: (_field, data, changeData) => {
const { count } = data;
for (let i = 0; i < count; i++) {
data[`g_images-${i}`] = true;
}
changeData(data);
store.dispatch(recalculateFields(true));
return Promise.resolve();
}
},
{
name: "stretch",
type: "checkbox"
},
{
name: "refreshInterval",
tooltip: "basic_refreshInterval_tooltip",
type: "slider",
min: 0,
max: 18e4,
step: 100,
default: 0
},
{
name: "refreshOnWakeUp",
type: "checkbox"
},
{
name: "refreshOnViewChange",
type: "checkbox"
},
{
name: "refreshWithNoQuery",
type: "checkbox"
},
{
name: "allowUserInteractions",
type: "checkbox"
}
]
},
{
name: "images",
label: "Image",
indexFrom: 0,
indexTo: "count",
fields: [
{
name: "src_",
type: "image"
}
]
}
]
};
}
getWidgetInfo() {
return BasicImage8.getWidgetInfo();
}
getImage() {
const images = [];
for (let i = 0; i <= this.state.rxData.count; i++) {
if (this.state.rxData[`src_${i}`]) {
images.push(this.state.rxData[`src_${i}`]);
}
}
if (this.state.rxData.oid !== "nothing_selected" && this.state.values[`${this.state.rxData.oid}.val`] !== void 0) {
let val = this.state.values[`${this.state.rxData.oid}.val`];
if (val === "true" || val === true) {
val = 1;
}
if (val === "false" || val === false) {
val = 0;
}
return images[val] || "";
}
return images[0] || "";
}
}
class BasicFrame extends VisRxWidget {
static getWidgetInfo() {
return {
id: "tplFrame",
visSet: "basic",
visName: "Border",
visPrev: "widgets/basic/img/Prev_tplFrame.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "title",
type: "text",
default: __mf_2.t("jqui_widgetTitle")
},
{
name: "title_back",
type: "color"
},
{
name: "title_top",
type: "slider",
min: -20,
max: 20,
default: -10
},
{
name: "title_left",
type: "slider",
min: -20,
max: 30,
default: 20
},
{
name: "header_height",
type: "slider",
min: 0,
max: 100
},
{
name: "header_color",
type: "color"
}
]
}
],
visDefaultStyle: {
width: 100,
height: 70,
"border-style": "solid",
"border-width": "1px",
"border-color": "#888",
"overflow-x": "visible",
"overflow-y": "visible"
}
};
}
getWidgetInfo() {
return BasicFrame.getWidgetInfo();
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
let content = jsxRuntimeExports.jsx("div", {
style: {
position: "absolute",
top: this.state.rxData.title_top,
left: this.state.rxData.title_left,
backgroundColor: this.state.rxData.title_back || (this.state.rxData.header_height ? void 0 : this.props.context.themeType === "dark" ? "#000" : "#fff"),
padding: "0 5px"
},
children: this.state.rxData.title
});
if (this.state.rxData.header_height) {
content = jsxRuntimeExports.jsx("div", {
style: {
width: "100%",
height: this.state.rxData.header_height,
backgroundColor: this.state.rxData.header_color || (this.props.context.themeType === "dark" ? "#000" : "#fff")
},
children: content
});
}
return jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
children: content
});
}
}
class BasicNote extends VisRxWidget {
constructor(props) {
super(props);
Object.assign(this.state, {
dialog: false,
text: ""
});
}
static getWidgetInfo() {
return {
id: "tplNote",
visSet: "basic",
visName: "Note",
visPrev: "widgets/basic/img/Prev_Note.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "oid",
type: "id"
},
{
name: "html_prepend",
type: "html"
},
{
name: "html_append",
type: "html"
},
{
name: "test_text",
type: "html"
},
{
name: "hide_corner",
label: "basic_node_hide_corner",
type: "checkbox"
}
]
}
],
visDefaultStyle: {
width: 100,
height: 70,
"border-radius": "5px",
"border-style": "solid",
"border-width": "1px",
"border-color": "#888",
"background-color": "rgba(255,255,105,0.8)"
}
};
}
getWidgetInfo() {
return BasicNote.getWidgetInfo();
}
renderDialog() {
if (!this.state.dialog) {
return null;
}
return jsxRuntimeExports.jsxs(__mf_32, {
open: true,
onClose: () => this.setState({
dialog: false
}),
fullWidth: true,
sx: {
"& .MuiDialog-paper": {}
},
children: [
jsxRuntimeExports.jsx(__mf_34, {
children: jsxRuntimeExports.jsx(__mf_122, {
style: {
width: "calc(100% - 6px)",
minHeight: 200,
backgroundColor: this.props.context.themeType === "dark" ? "black" : "white",
resize: "vertical",
color: this.props.context.themeType === "dark" ? "white" : "black"
},
value: this.state.text,
onChange: (e) => this.setState({
text: e.target.value
})
})
}),
jsxRuntimeExports.jsxs(__mf_33, {
children: [
this.state.text ? jsxRuntimeExports.jsx(__mf_53, {
onClick: (e) => {
e.stopPropagation();
this.setState({
text: ""
});
},
children: jsxRuntimeExports.jsx(__mf_2326, {})
}) : null,
jsxRuntimeExports.jsx("div", {
style: {
flex: 1
}
}),
jsxRuntimeExports.jsx(__mf_16, {
variant: "contained",
color: "primary",
onClick: (e) => {
e.stopPropagation();
this.setState({
dialog: false
});
this.props.context.setValue(this.state.rxData.oid, this.state.text);
},
children: jsxRuntimeExports.jsx(__mf_1671, {})
}),
jsxRuntimeExports.jsx(__mf_16, {
variant: "contained",
color: "grey",
onClick: (e) => {
e.stopPropagation();
this.setState({
dialog: false
});
},
children: jsxRuntimeExports.jsx(__mf_1776, {})
})
]
})
]
});
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
let corner = null;
if (!this.state.rxData.hide_corner) {
corner = jsxRuntimeExports.jsx("div", {
style: {
position: "absolute",
right: -10,
bottom: -10,
width: 20,
height: 20,
backgroundColor: this.state.rxStyle["border-color"],
transform: "rotate(45deg)"
}
});
}
return jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
onClick: () => !this.props.editMode && this.setState({
dialog: true,
text: this.state.values[`${this.state.rxData.oid}.val`]
}),
children: jsxRuntimeExports.jsxs("div", {
style: {
width: "100%",
height: "100%",
position: "relative",
overflow: this.state.rxData.hide_corner ? void 0 : "hidden"
},
children: [
jsxRuntimeExports.jsxs("div", {
style: {
padding: 10,
cursor: this.props.editMode ? "default" : "pointer",
width: "calc(100% - 20px)",
height: "calc(100% - 20px)"
},
children: [
!this.props.editMode ? this.renderDialog() : null,
this.state.rxData.html_prepend || "",
this.props.editMode && this.state.rxData.test_text ? this.state.rxData.test_text : this.state.values[`${this.state.rxData.oid}.val`] || "",
this.state.rxData.html_append || ""
]
}),
corner
]
})
});
}
}
class BasicLogout extends VisRxWidget {
static getWidgetInfo() {
return {
id: "tplHtmlLogout",
visSet: "basic",
visName: "HTML logout",
visPrev: "widgets/basic/img/Prev_HtmlLogout.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "html",
type: "html",
default: "Logout"
},
{
name: "redirect_url",
type: "url"
},
{
name: "in_app_close",
type: "checkbox"
},
{
name: "variant",
label: "jqui_variant",
type: "select",
noTranslation: true,
options: [
"contained",
"outlined",
"text"
],
default: "contained"
},
{
name: "icon",
label: "jqui_icon",
type: "icon64",
hidden: "!!data.image"
},
{
name: "image",
type: "image",
label: "jqui_image",
hidden: "!!data.icon"
}
]
}
],
visDefaultStyle: {
width: 70,
height: 30
}
};
}
getWidgetInfo() {
return BasicLogout.getWidgetInfo();
}
async onLogout() {
if (this.props.editMode) {
return;
}
if (this.state.rxData.in_app_close) {
if (typeof window.logout === "function") {
window.logout();
} else {
window.alert(__mf_2.t("This option works only in APP"));
}
} else {
if (!this.props.context.socket.isSecure) {
window.alert(__mf_2.t("This option works only for connection with authentication"));
return;
}
await this.props.context.socket.logout();
if (this.state.rxData.redirect_url) {
window.location.href = this.state.rxData.redirect_url;
} else {
window.location.reload();
}
}
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
return jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
children: jsxRuntimeExports.jsx(__mf_16, {
style: {
width: "100%",
height: "100%",
minWidth: 30,
background: this.state.rxStyle.background || void 0,
backgroundColor: this.state.rxStyle["background-color"] || void 0,
color: this.state.rxStyle.color || void 0,
borderStyle: this.state.rxStyle["border-style"] || void 0,
borderWidth: this.state.rxStyle["border-width"] || void 0,
borderColor: this.state.rxStyle["border-color"] || void 0,
borderRadius: this.state.rxStyle["border-radius"] || void 0
},
variant: this.state.rxData.variant,
onClick: () => this.onLogout(),
startIcon: this.state.rxData.html && (this.state.rxData.icon || this.state.rxData.image) ? jsxRuntimeExports.jsx(__mf_15, {
src: this.state.rxData.icon || this.state.rxData.image
}) : void 0,
children: this.state.rxData.html ? jsxRuntimeExports.jsx("div", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html
}
}) : this.state.rxData.icon || this.state.rxData.image ? jsxRuntimeExports.jsx(__mf_15, {
src: this.state.rxData.icon || this.state.rxData.image
}) : jsxRuntimeExports.jsx(__mf_1776, {})
})
});
}
}
class JQuiButton extends VisRxWidget {
refButton;
refDialog;
hideTimeout;
setObjectType;
constructor(props) {
super(props);
this.state.width = 0;
this.state.height = 0;
this.state.dialogVisible = false;
this.state.showPassword = false;
this.state.password = "";
this.refButton = React.createRef();
this.refDialog = React.createRef();
}
static getWidgetInfo() {
return {
id: "tplJquiButtonLink",
visSet: "jqui",
visName: "Button Link",
visSetLabel: "jqui_set_label",
visWidgetLabel: "jqui_button_link",
visPrev: "widgets/jqui/img/Prev_ButtonLink.png",
visOrder: 1,
visAttrs: [
{
name: "common",
fields: [
{
name: "buttontext",
type: "text",
default: "URL",
hidden: (data) => !!data.html || !!(data.buttontext_view && data.nav_view) || !!data.externalDialog
},
{
name: "html",
type: "html",
default: "",
tooltip: "jqui_html_tooltip",
disabled: (data) => !!data.buttontext || !!data.icon || !!data.src || !!data.externalDialog
},
{
name: "Password",
type: "password",
label: "password",
tooltip: "jqui_password_tooltip",
disabled: (data) => !data.nav_view && !data.url && !data.href && !data.html_dialog && !data.contains_view
}
]
},
{
name: "view",
label: "jqui_view_group",
hidden: (data) => !!data.url || !!data.href || !!data.html_dialog || !!data.contains_view,
fields: [
{
name: "nav_view",
label: "jqui_nav_view",
type: "views"
},
{
name: "buttontext_view",
label: "jqui_buttontext_view",
type: "checkbox",
hidden: (data) => !data.nav_view
},
{
name: "sub_view",
label: "basic_sub_view",
type: "text",
tooltip: "sub_view_tooltip",
hidden: (data) => !data.nav_view
}
]
},
{
name: "URL",
label: "jqui_url_group",
hidden: (data) => !!data.html_dialog || !!data.contains_view || !!data.nav_view,
fields: [
{
name: "href",
label: "jqui_url_in_browser",
type: "url",
hidden: (data) => !!data.url,
tooltip: "jqui_href_tooltip"
},
{
name: "url",
label: "jqui_url_in_background",
type: "url",
hidden: (data) => !!data.href,
tooltip: "jqui_url_tooltip"
},
{
name: "target",
type: "auto",
options: [
"_blank",
"_self",
"_parent",
"_top"
],
hidden: (data) => !!data.url || !data.href
}
]
},
{
name: "style",
label: "Style",
hidden: (data) => !!data.externalDialog,
fields: [
{
name: "no_style",
type: "checkbox",
hidden: (data) => data.jquery_style
},
{
name: "jquery_style",
label: "jqui_jquery_style",
type: "checkbox",
hidden: (data) => data.no_style
},
{
name: "padding",
type: "slider",
min: 0,
max: 100,
default: 5
},
{
name: "variant",
label: "jqui_variant",
type: "select",
noTranslation: true,
options: [
"contained",
"outlined",
"standard"
],
default: "contained",
hidden: (data) => data.jquery_style || data.no_style
},
{
name: "color",
label: "jqui_button_color",
type: "select",
noTranslation: true,
options: [
"",
"primary",
"secondary"
],
default: "",
hidden: (data) => data.jquery_style || data.no_style
},
{
name: "html_prepend",
type: "html"
},
{
name: "html_append",
type: "html"
},
{
name: "visResizable",
label: "visResizable",
type: "checkbox",
default: false,
desiredSize: false
}
]
},
{
name: "icon",
hidden: (data) => !!data.externalDialog || data.jquery_style,
fields: [
{
name: "src",
label: "jqui_image",
type: "image",
hidden: (data) => data.icon
},
{
name: "icon",
label: "jqui_icon",
type: "icon64",
hidden: (data) => data.src
},
{
name: "invert_icon",
type: "checkbox",
hidden: (data) => !data.icon && !data.src
},
{
name: "imageHeight",
type: "slider",
min: 0,
max: 200,
default: 100,
hidden: (data) => !data.src
}
]
},
{
name: "dialog",
hidden: (data) => !!data.url || !!data.href || !!data.nav_view,
fields: [
{
name: "html_dialog",
type: "html",
hidden: (data) => !!data.contains_view
},
{
name: "contains_view",
type: "views",
hidden: (data) => !!data.html_dialog
},
{
name: "title",
type: "text",
hidden: (data) => !data.html_dialog && !data.contains_view
},
{
name: "autoclose",
type: "slider",
min: 0,
max: 3e4,
step: 100,
hidden: (data) => !data.html_dialog && !data.contains_view
},
{
name: "modal",
type: "checkbox",
default: true,
hidden: (data) => !data.html_dialog && !data.contains_view
},
{
name: "dialog_width",
type: "text",
hidden: (data) => !data.html_dialog && !data.contains_view
},
{
name: "dialog_height",
type: "text",
hidden: (data) => !data.html_dialog && !data.contains_view
},
{
name: "dialog_class",
label: "CSS Class",
type: "text",
hidden: (data) => !data.html_dialog && !data.contains_view
},
{
name: "persistent",
type: "checkbox",
hidden: (data) => !data.html_dialog && !data.contains_view
},
{
name: "preload",
type: "checkbox",
hidden: (data) => !data.html_dialog && !data.contains_view
},
{
name: "closeOnClick",
type: "checkbox",
hidden: (data) => !data.html_dialog && !data.contains_view
},
{
name: "hideCloseButton",
label: "jqui_hide_close_button",
type: "checkbox",
hidden: (data) => !data.html_dialog && !data.contains_view && !!data.closeOnClick
},
{
name: "dialogBackgroundColor",
label: "Background color",
type: "color",
hidden: (data) => !data.html_dialog && !data.contains_view
},
{
name: "dialogTitleColor",
type: "color",
label: "Text color",
hidden: (data) => !data.html_dialog && !data.contains_view
},
{
name: "overflowX",
type: "select",
noTranslation: true,
options: [
"",
"auto",
"hidden",
"visible",
"scroll",
"initial",
"inherit"
],
hidden: (data) => !data.html_dialog && !data.contains_view
},
{
name: "overflowY",
type: "select",
noTranslation: true,
options: [
"",
"auto",
"hidden",
"visible",
"scroll",
"initial",
"inherit"
],
hidden: (data) => !data.html_dialog && !data.contains_view
},
{
name: "setId",
type: "id",
tooltip: "jqui_dialog_set_id_tooltip",
hidden: (data) => !data.html_dialog && !data.contains_view
},
{
name: "setValue",
type: "text",
hidden: (data) => !data.setId || !data.html_dialog && !data.contains_view
},
{
name: "dialogName",
label: "jqui_dialog_name",
type: "text",
hidden: (data) => !data.html_dialog && !data.contains_view
},
{
name: "externalDialog",
label: "jqui_external_dialog",
tooltip: "jqui_external_dialog_tooltip",
type: "checkbox",
hidden: (data) => !data.html_dialog && !data.contains_view
}
]
}
]
};
}
static findField(widgetInfo, name) {
return VisRxWidget.findField(widgetInfo, name);
}
getWidgetInfo() {
return JQuiButton.getWidgetInfo();
}
componentDidMount() {
super.componentDidMount();
this.componentDidUpdate();
}
componentWillUnmount() {
this.hideTimeout && clearTimeout(this.hideTimeout);
this.hideTimeout = null;
super.componentWillUnmount();
}
componentDidUpdate() {
if (this.refButton.current) {
if (this.state.rxData.jquery_style && !this.refButton.current._jQueryDone) {
this.refButton.current._jQueryDone = true;
window.jQuery(this.refButton.current).button();
}
if (this.refButton.current.clientWidth !== this.state.width || this.refButton.current.clientHeight !== this.state.height) {
this.setState({
width: this.refButton.current.clientWidth,
height: this.refButton.current.clientHeight
});
}
}
if (this.refService.current && (this.state.rxData.html_dialog || this.state.rxData.contains_view) && !this.refService.current._showDialog) {
this.refService.current._showDialog = this.showDialog;
}
if (this.refService.current) {
const dialogName = this.refService.current.dataset.dialogName;
if ((dialogName || "") !== (this.state.rxData.dialogName || "")) {
if (!this.state.rxData.dialogName) {
delete this.refService.current.dataset.dialogName;
} else {
this.refService.current.dataset.dialogName = this.state.rxData.dialogName;
}
}
}
}
showDialog = (show) => {
this.setState({
dialogVisible: show
});
let timeout = this.state.rxData.autoclose;
if (timeout === true || timeout === "true") {
timeout = 1e4;
}
if (timeout === null || timeout === void 0 || timeout === "") {
return;
}
timeout = parseInt(timeout, 10);
if (timeout < 60) {
timeout *= 1e3;
}
timeout = timeout || 1e3;
if (timeout) {
if (show) {
this.hideTimeout = setTimeout(() => {
this.hideTimeout = null;
this.showDialog(false);
}, timeout);
} else if (this.hideTimeout) {
clearTimeout(this.hideTimeout);
this.hideTimeout = null;
}
}
};
onPasswordEnter() {
if (this.state.password === this.state.rxData.Password) {
this.setState({
showPassword: false
}, () => this.onClick(true));
} else {
window.alert(__mf_2.t("Wrong password"));
this.setState({
passwordError: true
}, () => {
setTimeout(() => this.setState({
passwordError: false
}), 3e3);
});
}
}
renderPasswordDialog() {
if (!this.state.showPassword) {
return null;
}
return jsxRuntimeExports.jsxs(__mf_32, {
open: true,
onClose: () => this.setState({
showPassword: false
}),
children: [
jsxRuntimeExports.jsx(__mf_36, {
children: __mf_2.t("Enter password")
}),
jsxRuntimeExports.jsx(__mf_34, {
children: jsxRuntimeExports.jsx(__mf_121, {
label: __mf_2.t("Password"),
error: this.state.passwordError,
helperText: this.state.passwordError ? __mf_2.t("Wrong password") : null,
type: "password",
autoFocus: true,
fullWidth: true,
variant: "standard",
value: this.state.password || "",
onChange: (e) => this.setState({
password: e.target.value
}),
onKeyUp: (e) => e.key === "Enter" && this.onPasswordEnter()
})
}),
jsxRuntimeExports.jsxs(__mf_33, {
children: [
jsxRuntimeExports.jsx(__mf_16, {
disabled: !this.state.password,
startIcon: jsxRuntimeExports.jsx(__mf_1671, {}),
onClick: (e) => {
e.stopPropagation();
e.preventDefault();
this.onPasswordEnter();
},
color: "primary",
variant: "contained",
children: __mf_2.t("Enter")
}),
jsxRuntimeExports.jsx(__mf_16, {
startIcon: jsxRuntimeExports.jsx(__mf_1776, {}),
onClick: (e) => {
e.stopPropagation();
e.preventDefault();
this.setState({
showPassword: false
});
},
color: "grey",
variant: "contained",
children: __mf_2.t("Cancel")
})
]
})
]
});
}
async setObjectWithState(oid, value) {
var _a;
if (this.setObjectType === void 0) {
try {
const obj = await this.props.context.socket.getObject(oid);
this.setObjectType = ((_a = obj == null ? void 0 : obj.common) == null ? void 0 : _a.type) || "string";
await this.setObjectWithState(oid, value);
} catch (error) {
console.warn(`Object ${oid} not found: ${error}`);
}
return;
}
if (this.setObjectType === "boolean") {
value = value === "true" || value === true || value === "1" || value === 1 || value === "on" || value === "ON";
} else if (this.setObjectType === "number") {
value = parseFloat(value);
} else if (value !== null && value !== void 0) {
value = value.toString();
}
this.props.context.setValue(oid, value);
}
onCommand(command) {
super.onCommand(command);
if (command === "openDialog") {
this.showDialog(true);
return true;
}
if (command === "closeDialog") {
this.showDialog(false);
return true;
}
return false;
}
onClick(passwordChecked) {
if (this.state.dialogVisible) {
return;
}
if (!passwordChecked && this.state.rxData.Password) {
if (this.props.editMode) {
window.alert(__mf_2.t("Ignored in edit mode"));
} else {
this.setState({
showPassword: true,
password: ""
});
}
return;
}
if (this.state.rxData.nav_view) {
this.props.context.changeView(this.state.rxData.nav_view);
} else if (!this.props.editMode && this.state.rxData.href) {
if (this.state.rxData.target || this.props.tpl === "tplJquiButtonLinkBlank" && this.state.rxData.target === void 0) {
window.open(this.state.rxData.href, this.state.rxData.target);
} else {
window.location.href = this.state.rxData.href;
}
} else if (this.state.rxData.url) {
this.props.context.socket.getRawSocket().emit("httpGet", this.state.rxData.url, (data) => console.log("httpGet", this.state.rxData.url, data));
}
if (this.state.rxData.html_dialog || this.state.rxData.contains_view) {
if (this.state.rxData.setId) {
this.setObjectWithState(this.state.rxData.setId, this.state.rxData.setValue).catch((error) => console.warn(`Cannot set state: ${error}`));
}
this.showDialog(true);
}
}
renderRxDialog(dialogStyle, content) {
console.log("test");
if (this.state.rxData.modal) {
console.log("in");
return jsxRuntimeExports.jsx(__mf_32, {
maxWidth: "xl",
id: `${this.props.id}_dialog`,
ref: this.refDialog,
open: this.state.dialogVisible,
onClick: () => {
if (this.state.rxData.closeOnClick) {
this.showDialog(false);
}
},
children: jsxRuntimeExports.jsxs("div", {
style: {
backgroundColor: this.state.rxData.dialogBackgroundColor
},
children: [
this.state.rxData.title ? jsxRuntimeExports.jsx(__mf_36, {
sx: {
color: this.state.rxData.dialogTitleColor
},
children: this.state.rxData.title
}) : null,
!this.state.rxData.hideCloseButton || !this.state.rxData.closeOnClick ? jsxRuntimeExports.jsx(__mf_53, {
sx: {
color: this.state.rxData.dialogTitleColor
},
style: {
position: "absolute",
top: 0,
right: 0,
zIndex: 800
},
onClick: () => this.showDialog(false),
children: jsxRuntimeExports.jsx(__mf_1776, {})
}) : null,
jsxRuntimeExports.jsx(__mf_34, {
children: content
})
]
})
});
}
if (!this.state.dialogVisible) {
dialogStyle.display = "none";
}
if (!dialogStyle.minWidth || dialogStyle.minWidth < 200) {
dialogStyle.minWidth = 200;
}
if (!dialogStyle.minHeight || dialogStyle.minHeight < 100) {
dialogStyle.minHeight = 100;
}
dialogStyle.backgroundColor = "blue";
const paperStyle = {
...dialogStyle
};
delete paperStyle.top;
delete paperStyle.left;
paperStyle.padding = this.state.rxData.title ? "0 24px 24px 24px" : "26px 24px 24px 24px";
return jsxRuntimeExports.jsx(__mf_83, {
open: this.state.dialogVisible,
id: `${this.props.id}_dialog`,
ref: this.refDialog,
anchorEl: this.refButton.current,
style: dialogStyle,
onClick: () => {
if (this.state.rxData.closeOnClick) {
this.showDialog(false);
}
},
children: jsxRuntimeExports.jsxs(__mf_81, {
style: {
...paperStyle,
background: "red !important"
},
children: [
this.state.rxData.title ? jsxRuntimeExports.jsx(__mf_36, {
style: {
padding: "16px 0 0 0"
},
children: jsxRuntimeExports.jsx("div", {
children: this.state.rxData.title
})
}) : null,
jsxRuntimeExports.jsx(__mf_53, {
style: {
position: "absolute",
top: 0,
right: 0,
zIndex: 800
},
onClick: () => this.showDialog(false),
children: jsxRuntimeExports.jsx(__mf_1776, {})
}),
jsxRuntimeExports.jsx(__mf_34, {
children: content
})
]
})
});
}
renderJQueryDialog(dialogStyle, content) {
return jsxRuntimeExports.jsx("div", {
id: `${this.props.id}_dialog`,
className: "vis-widget-dialog",
title: this.state.rxData.title,
style: dialogStyle,
ref: this.refDialog,
children: this.state.rxData.preload ? content : null
});
}
renderDialog() {
if (this.props.editMode || !this.state.dialogVisible && !this.state.rxData.persistent && !this.state.rxData.externalDialog || !this.state.rxData.html_dialog && !this.state.rxData.contains_view) {
return null;
}
const width = isVarFinite(this.state.rxData.dialog_width) ? parseFloat(this.state.rxData.dialog_width) : this.state.rxData.dialog_width;
const height = isVarFinite(this.state.rxData.dialog_height) ? parseFloat(this.state.rxData.dialog_height) : this.state.rxData.dialog_height;
const dialogStyle = {
minWidth: width || window.innerWidth - 50,
minHeight: height || window.innerHeight - 50,
overflowX: this.state.rxData.overflowX,
overflowY: this.state.rxData.overflowY
};
let content;
if (this.state.rxData.contains_view) {
content = jsxRuntimeExports.jsx("div", {
style: dialogStyle,
className: this.state.rxData.dialog_class,
children: super.getWidgetView(this.state.rxData.contains_view, void 0)
});
} else {
content = jsxRuntimeExports.jsx("div", {
style: dialogStyle,
className: this.state.rxData.dialog_class,
dangerouslySetInnerHTML: {
__html: this.state.rxData.html_dialog
}
});
}
if (this.state.rxData.jquery_style) ;
return this.renderRxDialog(dialogStyle, content);
}
renderWidgetBody(props) {
var _a, _b;
super.renderWidgetBody(props);
const iconStyle = {
marginRight: 4,
filter: this.state.rxData.invert_icon ? "invert(1)" : void 0
};
if (!this.state.rxData.jquery_style && this.state.rxData.src) {
if (this.state.width > this.state.height) {
iconStyle.height = `${this.state.rxData.imageHeight || 100}%`;
iconStyle.width = "auto";
} else {
iconStyle.width = `${this.state.rxData.imageHeight || 100}%`;
iconStyle.height = "auto";
}
}
let iconSrc = !this.state.rxData.jquery_style && (this.state.rxData.src || this.state.rxData.icon);
if (iconSrc && iconSrc.startsWith("_PRJ_NAME/")) {
iconSrc = iconSrc.replace("_PRJ_NAME/", `../${this.props.context.adapterName}.${this.props.context.instance}/${this.props.context.projectName}/`);
}
const icon = iconSrc ? jsxRuntimeExports.jsx(__mf_15, {
src: iconSrc,
style: iconStyle
}) : null;
const buttonStyle = {
textTransform: "none"
};
Object.keys(this.state.rxStyle).forEach((attr) => {
const value = this.state.rxStyle[attr];
if (value !== null && value !== void 0 && VisRxWidget.POSSIBLE_MUI_STYLES.includes(attr)) {
attr = attr.replace(/(-\w)/g, (text) => text[1].toUpperCase());
buttonStyle[attr] = value;
}
});
if (buttonStyle.borderWidth) {
buttonStyle.borderWidth = VisBaseWidget.correctStylePxValue(buttonStyle.borderWidth);
}
if (buttonStyle.fontSize) {
buttonStyle.fontSize = VisBaseWidget.correctStylePxValue(buttonStyle.fontSize);
}
let visResizable = this.state.data.visResizable;
if (visResizable === void 0 || visResizable === null) {
if (this.props.tpl === "tplJquiButtonNav" || this.props.tpl === "tplJquiNavPw" || this.props.tpl === "tplContainerDialog" || this.props.tpl === "tplContainerIconDialog" || this.props.tpl === "tplJquiDialog" || this.props.tpl === "tplJquiIconDialog" || this.props.tpl === "tplIconHttpGet" || this.props.tpl === "tplIconLink" || this.props.tpl === "tplJquiIconNav") {
visResizable = true;
}
}
if (visResizable) {
buttonStyle.width = "100%";
buttonStyle.height = "100%";
} else {
buttonStyle.padding = this.state.rxData.padding;
}
buttonStyle.minWidth = "unset";
let buttonText;
if (this.state.rxData.html) ;
else if (this.state.rxData.nav_view && this.state.rxData.buttontext_view) {
buttonText = ((_b = (_a = this.props.context.views[this.state.rxData.nav_view]) == null ? void 0 : _a.settings) == null ? void 0 : _b.navigationTitle) || this.state.rxData.nav_view;
} else if (this.state.rxData.buttontext === void 0) {
buttonText = this.state.rxData.text || "";
} else {
buttonText = this.state.rxData.buttontext;
}
let content;
if (this.state.rxData.externalDialog) {
content = this.props.editMode ? jsxRuntimeExports.jsxs("div", {
style: {
width: "100%",
height: "100%",
border: "2px dashed red",
backgroundColor: "grey",
color: "white",
boxSizing: "border-box"
},
children: [
jsxRuntimeExports.jsx(__mf_53, {
style: {
...this.props.context.editModeComponentStyle,
position: "absolute",
bottom: 0,
right: 0,
opacity: 0.4
},
onClick: (e) => {
e.stopPropagation();
e.preventDefault();
const text = `setState('${this.props.context.adapterName}.${this.props.context.instance}.control.command', '${JSON.stringify({
command: "dialog",
instance: window.localStorage.getItem("visInstance"),
data: this.state.rxData.dialogName || this.props.id
})}')`;
window.alert(__mf_2.t("Copied %s", text));
__mf_70.copyToClipboard(text);
},
children: jsxRuntimeExports.jsx(__mf_85, {})
}),
jsxRuntimeExports.jsx("div", {
children: __mf_2.t("External dialog")
}),
jsxRuntimeExports.jsx("div", {
children: this.state.rxData.html_dialog ? "HTML" : `View: ${this.state.rxData.contains_view}`
}),
jsxRuntimeExports.jsx("div", {
children: `Name: ${this.state.rxData.dialogName ? `${this.state.rxData.dialogName} (${this.props.id})` : this.props.id}`
}),
jsxRuntimeExports.jsx("div", {
style: {
fontSize: 10
},
children: __mf_2.t("You can open dialog with following script:")
}),
jsxRuntimeExports.jsx("div", {
style: {
fontSize: 10
},
children: `setState('${this.props.context.adapterName}.${this.props.context.instance}.control.command', '${JSON.stringify({
command: "dialog",
instance: window.localStorage.getItem("visInstance"),
data: this.state.rxData.dialogName || this.props.id
})}')`
})
]
}) : null;
} else {
content = [
this.state.rxData.html_prepend ? jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html_prepend
}
}, "prepend") : null,
this.state.rxData.html ? jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html
}
}, "content") : this.state.rxData.no_style || this.state.rxData.jquery_style ? jsxRuntimeExports.jsxs("button", {
className: this.state.rxData.nav_view && this.state.rxData.nav_view === window.location.hash.slice(1) ? "ui-state-active" : void 0,
ref: this.refButton,
type: "button",
style: buttonStyle,
onClick: () => this.onClick(),
children: [
icon,
buttonText
]
}, "content") : jsxRuntimeExports.jsxs(__mf_16, {
ref: this.refButton,
style: buttonStyle,
color: this.state.rxData.nav_view && this.state.rxData.nav_view === window.location.hash.slice(1) ? this.state.rxData.color === "primary" ? "secondary" : "primary" : this.state.rxData.color || "grey",
variant: this.state.rxData.variant === void 0 ? "contained" : this.state.rxData.variant,
onClick: () => this.onClick(),
children: [
icon,
buttonText
]
}, "content"),
this.state.rxData.html_append ? jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html_append
}
}, "append") : null
];
}
return jsxRuntimeExports.jsxs("div", {
className: "vis-widget-body",
onClick: this.state.rxData.html ? () => this.onClick() : void 0,
children: [
content,
this.renderDialog(),
this.renderPasswordDialog()
]
});
}
}
class JQuiButtonBlank extends JQuiButton {
static getWidgetInfo() {
const widgetInfo = JQuiButton.getWidgetInfo();
const newWidgetInfo = {
id: "tplJquiButtonLinkBlank",
visSet: "jqui",
visName: "Button Link",
visWidgetLabel: "jqui_button_link_blank",
visPrev: "widgets/jqui/img/Prev_ButtonLinkBlank.png",
visOrder: 2,
visAttrs: widgetInfo.visAttrs
};
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_button_link_blank_note"
});
const target = JQuiButton.findField(newWidgetInfo, "target");
target.default = "_blank";
const visResizable = JQuiButton.findField(newWidgetInfo, "visResizable");
visResizable.default = false;
const text = JQuiButton.findField(newWidgetInfo, "buttontext");
text.default = "URL Browser";
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiButtonBlank.getWidgetInfo();
}
}
class JQuiIconLink extends JQuiButton {
static getWidgetInfo() {
const widgetInfo = JQuiButton.getWidgetInfo();
const newWidgetInfo = {
id: "tplIconLink",
visSet: "jqui",
visName: "Button Link",
visWidgetLabel: "jqui_icon_link",
visPrev: "widgets/jqui/img/Prev_IconLink.png",
visOrder: 3,
visAttrs: widgetInfo.visAttrs
};
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_button_link_blank_note"
});
const target = JQuiButton.findField(newWidgetInfo, "target");
target.default = "_blank";
const visResizable = JQuiButton.findField(newWidgetInfo, "visResizable");
visResizable.default = true;
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiIconLink.getWidgetInfo();
}
}
class JQuiWriteState extends VisRxWidget {
iterateInterval = null;
iterateTimeout = null;
constructor(props) {
super(props);
Object.assign(this.state, {
value: "",
valueType: null
});
}
static getWidgetInfo() {
return {
id: "tplIconState",
visSet: "jqui",
visName: "Icon State",
visWidgetLabel: "jqui_write_value",
visPrev: "widgets/jqui/img/Prev_WriteState.png",
visOrder: 26,
visAttrs: [
{
name: "common",
fields: [
{
name: "oid",
type: "id",
onChange: async (_field, data, changeData, socket) => {
var _a, _b, _c, _d, _e, _f;
if (data.oid && data.oid !== "nothing_selected") {
const obj = await socket.getObject(data.oid);
let changed = false;
if (((_a = obj == null ? void 0 : obj.common) == null ? void 0 : _a.min) !== void 0 && ((_b = obj == null ? void 0 : obj.common) == null ? void 0 : _b.min) !== null) {
if (data.min !== obj.common.min) {
data.min = obj.common.min;
changed = true;
}
}
if (((_c = obj == null ? void 0 : obj.common) == null ? void 0 : _c.max) !== void 0 && ((_d = obj == null ? void 0 : obj.common) == null ? void 0 : _d.max) !== null) {
if (data.max !== obj.common.max) {
data.max = obj.common.max;
changed = true;
}
if (data.step > 0) {
if (data.minmax !== obj.common.max) {
data.minmax = obj.common.max;
changed = true;
}
} else if (data.minmax !== obj.common.min) {
data.minmax = obj.common.min;
changed = true;
}
}
if (!data.step) {
if (((_e = obj == null ? void 0 : obj.common) == null ? void 0 : _e.step) !== void 0 && ((_f = obj == null ? void 0 : obj.common) == null ? void 0 : _f.step) !== null) {
if (data.step !== obj.common.step) {
data.step = obj.common.step;
changed = true;
}
}
}
changed && changeData(data);
}
}
},
{
name: "click_id",
type: "id",
noSubscribe: true
},
{
name: "type",
label: "jqui_type",
type: "select",
default: "value",
options: [
{
value: "value",
label: "jqui_from_value"
},
{
value: "oid",
label: "jqui_from_oid"
},
{
value: "toggle",
label: "jqui_toggle"
},
{
value: "change",
label: "jqui_increment_decrement"
}
]
},
{
name: "value_oid",
type: "id",
hidden: (data) => data.type !== "oid"
},
{
name: "value",
type: "text",
hidden: (data) => data.type !== "value"
},
{
name: "step",
type: "number",
hidden: (data) => data.type !== "change",
default: 1
},
{
name: "minmax",
label: "jqui_max",
type: "number",
hidden: (data) => data.type !== "change" || (parseFloat(data.step) || 0) < 0,
default: 1
},
{
name: "minmax",
label: "jqui_min",
type: "number",
hidden: (data) => data.type !== "change" || (parseFloat(data.step) || 0) >= 0,
default: 1
},
{
name: "repeat_delay",
type: "number",
label: "jqui_repeat_delay",
hidden: (data) => data.type !== "change",
default: 800
},
{
name: "repeat_interval",
type: "number",
label: "jqui_repeat_interval",
hidden: (data) => data.type !== "change",
default: 300
},
{
name: "min",
type: "number",
label: "jqui_min",
hidden: (data) => data.type !== "toggle",
default: 0
},
{
name: "max",
label: "jqui_max",
type: "number",
hidden: (data) => data.type !== "toggle",
default: 100
}
]
},
{
name: "style",
fields: [
{
name: "variant",
label: "jqui_variant",
type: "select",
noTranslation: true,
options: [
"contained",
"outlined",
"standard"
],
default: "contained"
},
{
name: "text",
type: "text",
default: __mf_2.t("jqui_Write state")
},
{
name: "src",
type: "image",
label: "jqui_image",
hidden: (data) => !!data.icon
},
{
name: "icon",
type: "icon64",
label: "jqui_icon",
hidden: (data) => !!data.src
},
{
name: "text_active",
label: "jqui_text_active",
type: "text"
},
{
name: "src_active",
type: "image",
label: "jqui_image_active",
hidden: (data) => !!data.icon_active
},
{
name: "icon_active",
type: "icon64",
label: "jqui_icon_active",
hidden: (data) => !!data.src_active
},
{
name: "invert_icon",
type: "checkbox",
hidden: (data) => !data.icon || !data.src
},
{
name: "invert_icon_active",
type: "checkbox",
hidden: (data) => !data.icon_active || !data.src_active
}
]
}
],
visDefaultStyle: {
width: 100,
height: 40
}
};
}
async componentDidMount() {
super.componentDidMount();
if (this.state.rxData.oid && this.state.rxData.oid !== "nothing_selected") {
try {
const state = await this.props.context.socket.getState(this.state.rxData.oid);
this.onStateUpdated(this.state.rxData.oid, state);
} catch (e) {
console.error(`Cannot get state ${this.state.rxData.oid}: ${e}`);
}
}
}
static findField(widgetInfo, name) {
return VisRxWidget.findField(widgetInfo, name);
}
getWidgetInfo() {
return JQuiWriteState.getWidgetInfo();
}
onStateUpdated(id, state) {
if (id === this.state.rxData.oid && state) {
const value = state.val === null || state.val === void 0 ? "" : state.val;
if (this.state.value !== value.toString()) {
this.setState({
value: value.toString()
});
}
}
}
getControlOid() {
if (this.state.rxData.click_id && this.state.rxData.click_id !== "nothing_selected") {
return this.state.rxData.click_id;
}
if (this.state.rxData.oid && this.state.rxData.oid !== "nothing_selected") {
return this.state.rxData.oid;
}
return "";
}
onClick() {
if (this.props.editMode) {
return;
}
let value;
switch (this.state.rxData.type) {
case "value":
value = this.state.rxData.value.toString();
break;
case "oid": {
value = this.state.values[`${this.state.rxData.value_oid}.val`];
if (value === void 0 || value === null) {
return;
}
break;
}
case "toggle":
value = parseFloat(this.state.values[`${this.state.rxData.oid}.val`]) || 0;
value = value.toString() === (this.state.rxData.max || 0).toString() ? this.state.rxData.min : this.state.rxData.max;
break;
case "change":
value = parseFloat(this.state.values[`${this.state.rxData.oid}.val`]) || 0;
value += parseFloat(this.state.rxData.step) || 0;
if (this.state.rxData.step > 0) {
if (value > parseFloat(this.state.rxData.minmax)) {
value = parseFloat(this.state.rxData.minmax);
}
} else if (value < parseFloat(this.state.rxData.minmax)) {
value = parseFloat(this.state.rxData.minmax);
}
break;
default:
return;
}
const oid = this.getControlOid();
if (oid) {
if (this.state.valueType === "number") {
this.props.context.setValue(oid, parseFloat(value));
} else {
this.props.context.setValue(oid, value);
}
}
this.setState({
value
});
}
renderIcon(isActive) {
let icon;
let invertIcon = null;
if (isActive) {
invertIcon = this.state.rxData.invert_icon_active;
icon = this.state.rxData.icon_active || this.state.rxData.src_active;
}
if (!icon) {
icon = this.state.rxData.icon || this.state.rxData.src;
invertIcon = this.state.rxData.invert_icon;
}
const color = this.state.rxStyle.color;
if (icon) {
if (icon.startsWith("_PRJ_NAME/")) {
icon = icon.replace("_PRJ_NAME/", `../${this.props.context.adapterName}.${this.props.context.instance}/${this.props.context.projectName}/`);
}
return jsxRuntimeExports.jsx(__mf_15, {
style: {
color,
filter: invertIcon ? "invert(100%)" : void 0,
width: "100%",
height: "100%"
},
src: icon
}, "icon");
}
return null;
}
renderText() {
let text = this.state.rxData.text;
const color = this.state.rxStyle.color;
if (!text) {
if (this.state.rxData.type === "oid") {
text = this.state.values[`${this.state.rxData.value_oid}.val`];
} else if (this.state.rxData.type === "value") {
text = this.state.rxData.value;
} else if (this.state.rxData.type === "change") {
if (this.state.rxData.step > 0) {
text = `+${this.state.rxData.step}`;
} else {
text = this.state.rxData.step.toString();
}
}
}
return text ? jsxRuntimeExports.jsx("span", {
style: {
color
},
children: text
}) : null;
}
getIsActive() {
let actualValue = this.state.value;
if (actualValue === void 0 || actualValue === null) {
actualValue = "";
}
switch (this.state.rxData.type) {
case "value": {
let desiredValue = this.state.rxData.value;
if (desiredValue === void 0 || desiredValue === null) {
desiredValue = "";
}
return actualValue.toString() === desiredValue.toString();
}
case "oid": {
let oidValue = this.state.values[`${this.state.rxData.value_oid}.val`];
if (oidValue === void 0 || oidValue === null) {
oidValue = "";
}
return actualValue.toString() === oidValue.toString();
}
case "toggle":
return actualValue.toString() === (this.state.rxData.max || 0).toString();
default:
return false;
}
}
componentWillUnmount() {
super.componentWillUnmount();
this.iterateInterval && clearInterval(this.iterateInterval);
this.iterateInterval = null;
this.iterateTimeout && clearTimeout(this.iterateTimeout);
this.iterateTimeout = null;
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
const isActive = this.getIsActive();
const buttonStyle = {};
Object.keys(this.state.rxStyle).forEach((attr) => {
const value = this.state.rxStyle[attr];
if (value !== null && value !== void 0 && VisRxWidget.POSSIBLE_MUI_STYLES.includes(attr)) {
attr = attr.replace(/(-\w)/g, (text2) => text2[1].toUpperCase());
buttonStyle[attr] = value;
}
});
if (buttonStyle.borderWidth) {
buttonStyle.borderWidth = VisBaseWidget.correctStylePxValue(buttonStyle.borderWidth);
}
if (buttonStyle.fontSize) {
buttonStyle.fontSize = VisBaseWidget.correctStylePxValue(buttonStyle.fontSize);
}
const text = this.renderText();
buttonStyle.width = "100%";
buttonStyle.height = "100%";
buttonStyle.minWidth = "unset";
const buttonColor = isActive ? "primary" : "grey";
const content = jsxRuntimeExports.jsx(__mf_16, {
style: buttonStyle,
color: buttonColor,
startIcon: text ? this.renderIcon(isActive) : null,
onClick: () => this.onClick(),
onMouseDown: () => {
if (this.props.editMode) {
return;
}
const delay = parseInt(this.state.rxData.repeat_delay, 10);
if (delay) {
this.iterateTimeout && clearTimeout(this.iterateTimeout);
this.iterateTimeout = setTimeout(() => {
this.iterateTimeout = null;
this.iterateInterval && clearInterval(this.iterateInterval);
this.iterateInterval = setInterval(() => this.onClick(), parseInt(this.state.rxData.repeat_interval, 10) || 500);
this.onClick();
}, delay);
}
},
onMouseUp: () => {
if (this.props.editMode) {
return;
}
this.iterateInterval && clearInterval(this.iterateInterval);
this.iterateInterval = null;
this.iterateTimeout && clearTimeout(this.iterateTimeout);
this.iterateTimeout = null;
},
variant: this.state.rxData.variant || "contained",
children: text || this.renderIcon(isActive)
});
return jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
children: content
});
}
}
class JQuiIconInc extends JQuiWriteState {
static getWidgetInfo() {
const widgetInfo = JQuiWriteState.getWidgetInfo();
const newWidgetInfo = {
id: "tplIconInc",
visSet: "jqui",
visName: "Icon Increment",
visWidgetLabel: "jqui_icon_increment",
visPrev: "widgets/jqui/img/Prev_IconInc.png",
visOrder: 27,
visAttrs: widgetInfo.visAttrs
};
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_write_state_note"
});
const target = JQuiWriteState.findField(newWidgetInfo, "type");
target.default = "change";
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiIconInc.getWidgetInfo();
}
}
class JQuiIconHttpGet extends JQuiButton {
static getWidgetInfo() {
const widgetInfo = JQuiButton.getWidgetInfo();
const newWidgetInfo = {
id: "tplIconHttpGet",
visSet: "jqui",
visName: "Icon HTTP GET",
visWidgetLabel: "jqui_icon_http_get",
visPrev: "widgets/jqui/img/Prev_IconHttpGet.png",
visOrder: 4,
visAttrs: widgetInfo.visAttrs
};
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_button_link_blank_note"
});
const url = JQuiButton.findField(newWidgetInfo, "url");
url.default = "http://";
const text = JQuiButton.findField(newWidgetInfo, "buttontext");
text.default = "URL Backend";
const visResizable = JQuiButton.findField(newWidgetInfo, "visResizable");
visResizable.default = true;
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiIconHttpGet.getWidgetInfo();
}
}
class JQuiDialog extends JQuiButton {
static getWidgetInfo() {
const widgetInfo = JQuiButton.getWidgetInfo();
const newWidgetInfo = {
id: "tplJquiDialog",
visSet: "jqui",
visName: "HTML - Dialog",
visWidgetLabel: "jqui_html_dialog",
visPrev: "widgets/jqui/img/Prev_JquiDialog.png",
visOrder: 5,
visAttrs: widgetInfo.visAttrs
};
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_button_link_blank_note"
});
const visResizable = JQuiButton.findField(newWidgetInfo, "visResizable");
visResizable.default = true;
const html = JQuiButton.findField(newWidgetInfo, "html");
html.default = "<div>HTML</div>";
const buttonText = JQuiButton.findField(newWidgetInfo, "buttontext");
delete buttonText.default;
const htmlDialog = JQuiButton.findField(newWidgetInfo, "html_dialog");
htmlDialog.default = "<div>HTML Dialog</div>";
newWidgetInfo.visDefaultStyle = {
"border-width": "1px",
"border-style": "solid",
"border-color": "#000",
width: "200px",
height: "130px",
cursor: "pointer"
};
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiDialog.getWidgetInfo();
}
}
class JQuiIconDialog extends JQuiButton {
static getWidgetInfo() {
const widgetInfo = JQuiButton.getWidgetInfo();
const newWidgetInfo = {
id: "tplJquiIconDialog",
visSet: "jqui",
visName: "Icon - Dialog",
visWidgetLabel: "jqui_icon_dialog",
visPrev: "widgets/jqui/img/Prev_JquiIconDialog.png",
visOrder: 6,
visAttrs: widgetInfo.visAttrs
};
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_button_link_blank_note"
});
const visResizable = JQuiButton.findField(newWidgetInfo, "visResizable");
visResizable.default = true;
const buttonText = JQuiButton.findField(newWidgetInfo, "buttontext");
buttonText.default = "Icon Dialog";
const htmlDialog = JQuiButton.findField(newWidgetInfo, "html_dialog");
htmlDialog.default = "<div>HTML Dialog</div>";
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiIconDialog.getWidgetInfo();
}
}
class JQuiContainerDialog extends JQuiButton {
static getWidgetInfo() {
const widgetInfo = JQuiButton.getWidgetInfo();
const newWidgetInfo = {
id: "tplContainerDialog",
visSet: "jqui",
visName: "container - HTML - view in jqui Dialog",
visWidgetLabel: "jqui_container_dialog",
visPrev: "widgets/jqui/img/Prev_ContainerDialog.png",
visOrder: 7,
visAttrs: widgetInfo.visAttrs
};
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_button_link_blank_note"
});
const visResizable = JQuiButton.findField(newWidgetInfo, "visResizable");
visResizable.default = true;
const buttonText = JQuiButton.findField(newWidgetInfo, "buttontext");
buttonText.default = "Container Dialog";
const htmlDialog = JQuiButton.findField(newWidgetInfo, "html_dialog");
htmlDialog.default = "<div>HTML Dialog</div>";
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiContainerDialog.getWidgetInfo();
}
}
class JQuiButtonNavigation extends JQuiButton {
static getWidgetInfo() {
const widgetInfo = JQuiButton.getWidgetInfo();
const newWidgetInfo = {
id: "tplJquiButtonNav",
visSet: "jqui",
visName: "Navigation Button",
visWidgetLabel: "jqui_navigation_button",
visPrev: "widgets/jqui/img/Prev_ButtonNav.png",
visOrder: 8,
visAttrs: widgetInfo.visAttrs
};
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_button_nav_blank_note"
});
const modal = JQuiButton.findField(newWidgetInfo, "modal");
delete modal.default;
const navView = JQuiButton.findField(newWidgetInfo, "nav_view");
navView.default = "";
const text = JQuiButton.findField(newWidgetInfo, "buttontext");
text.default = "View";
const visResizable = JQuiButton.findField(newWidgetInfo, "visResizable");
visResizable.default = true;
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiButtonNavigation.getWidgetInfo();
}
}
class JQuiIconNavigation extends JQuiButton {
static getWidgetInfo() {
const widgetInfo = JQuiButton.getWidgetInfo();
const newWidgetInfo = {
id: "tplJquiIconNav",
visSet: "jqui",
visName: "Navigation Icon",
visWidgetLabel: "jqui_navigation_icon",
visPrev: "widgets/jqui/img/Prev_IconNav.png",
visOrder: 9,
visAttrs: widgetInfo.visAttrs
};
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_button_nav_blank_note"
});
const buttonText = JQuiButton.findField(newWidgetInfo, "buttontext");
delete buttonText.default;
const modal = JQuiButton.findField(newWidgetInfo, "modal");
delete modal.default;
const navView = JQuiButton.findField(newWidgetInfo, "nav_view");
navView.default = "";
const icon = JQuiButton.findField(newWidgetInfo, "icon");
icon.default = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBmaWxsPSJjdXJyZW50Q29sb3IiIGQ9Ik0yMSAzTDMgMTAuNTN2Ljk4bDYuODQgMi42NUwxMi40OCAyMWguOThMMjEgM3oiLz48L3N2Zz4=";
const visResizable = JQuiButton.findField(newWidgetInfo, "visResizable");
visResizable.default = true;
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiIconNavigation.getWidgetInfo();
}
}
class JQuiButtonPasswordNavigation extends JQuiButton {
static getWidgetInfo() {
const widgetInfo = JQuiButton.getWidgetInfo();
const newWidgetInfo = {
id: "tplJquiNavPw",
visSet: "jqui",
visName: "Navigation with password",
visWidgetLabel: "jqui_navigation_password",
visPrev: "widgets/jqui/img/Prev_ButtonNavPw.png",
visOrder: 10,
visAttrs: widgetInfo.visAttrs
};
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_button_nav_blank_note"
});
const modal = JQuiButton.findField(newWidgetInfo, "modal");
delete modal.default;
const text = JQuiButton.findField(newWidgetInfo, "buttontext");
text.default = "Password";
const navView = JQuiButton.findField(newWidgetInfo, "nav_view");
navView.default = "";
const password = JQuiButton.findField(newWidgetInfo, "Password");
password.default = "";
const visResizable = JQuiButton.findField(newWidgetInfo, "visResizable");
visResizable.default = true;
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiButtonPasswordNavigation.getWidgetInfo();
}
}
class JQuiDialogExternal extends JQuiButton {
static getWidgetInfo() {
const widgetInfo = JQuiButton.getWidgetInfo();
const newWidgetInfo = {
id: "tplContainerDialogExternal",
visSet: "jqui",
visName: "External Dialog",
visWidgetLabel: "jqui_html_external_dialog",
visPrev: "widgets/jqui/img/Prev_JquiExternalDialog.png",
visOrder: 11,
visAttrs: widgetInfo.visAttrs
};
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_button_link_blank_note"
});
const externalDialog = JQuiButton.findField(newWidgetInfo, "externalDialog");
externalDialog.default = true;
const htmlDialog = JQuiButton.findField(newWidgetInfo, "html_dialog");
htmlDialog.default = "<div>HTML Dialog</div>";
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiDialogExternal.getWidgetInfo();
}
}
class JQuiButtonDialogClose extends VisRxWidget {
constructor(props) {
super(props);
this.state.width = 0;
this.state.height = 0;
}
static getWidgetInfo() {
return {
id: "tplJquiButtonDialogClose",
visSet: "jqui",
visName: "Button dialog close",
visWidgetLabel: "jqui_button_dialog_close",
visPrev: "widgets/jqui/img/Prev_ButtonDialogClose.png",
visOrder: 13,
visAttrs: [
{
name: "common",
fields: [
{
label: "jqui_dialog_name",
tooltip: "jqui_dialog_name_tooltip",
type: "custom",
component: (field, data, onDataChange, options) => {
const names = [];
Object.keys(options.context.views).forEach((id) => {
const widgets = options.context.views[id].widgets;
widgets && Object.keys(widgets).forEach((widget) => {
var _a, _b, _c;
if (((_a = widgets[widget].data) == null ? void 0 : _a.html_dialog) || ((_b = widgets[widget].data) == null ? void 0 : _b.contains_view) || ((_c = widgets[widget].data) == null ? void 0 : _c.externalDialog)) {
if (widgets[widget].data.dialogName) {
names.push({
label: `${widgets[widget].data.dialogName} (${widget})`,
value: widgets[widget].data.dialogName
});
} else {
names.push({
label: widget,
value: widget
});
}
}
});
});
return jsxRuntimeExports.jsx(__mf_7, {
freeSolo: true,
options: names,
value: data.dlgName || "",
sx: {
width: "100%"
},
onInputChange: (e, inputValue) => {
if (typeof inputValue === "object" && inputValue !== null) {
inputValue = inputValue.value;
}
onDataChange({
dlgName: inputValue
});
},
onChange: (e, inputValue) => {
if (typeof inputValue === "object" && inputValue !== null) {
inputValue = inputValue.value;
}
onDataChange({
dlgName: inputValue
});
},
getOptionLabel: (option) => {
if (typeof option === "string") {
return option;
}
return option.label;
},
renderInput: (params) => jsxRuntimeExports.jsx(__mf_121, {
variant: "standard",
...params
})
});
}
},
{
name: "buttontext",
type: "text",
default: __mf_2.t("jqui_Close").replace("jqui_", ""),
hidden: (data) => !!data.html
},
{
name: "html",
type: "html",
default: "",
tooltip: "jqui_html_tooltip",
disabled: (data) => !!data.buttontext || !!data.icon || !!data.src
}
]
},
{
name: "style",
hidden: (data) => !!data.externalDialog,
fields: [
{
name: "no_style",
type: "checkbox",
hidden: (data) => data.jquery_style
},
{
name: "jquery_style",
label: "jqui_jquery_style",
type: "checkbox",
hidden: (data) => data.no_style
},
{
name: "padding",
type: "slider",
min: 0,
max: 100,
default: 5
},
{
name: "variant",
label: "jqui_variant",
type: "select",
noTranslation: true,
options: [
"contained",
"outlined",
"standard"
],
default: "contained",
hidden: (data) => data.jquery_style || data.no_style
},
{
name: "color",
label: "jqui_button_color",
type: "select",
noTranslation: true,
options: [
"",
"primary",
"secondary"
],
default: "",
hidden: (data) => data.jquery_style || data.no_style
},
{
name: "html_prepend",
type: "html"
},
{
name: "html_append",
type: "html"
},
{
name: "visResizable",
label: "visResizable",
type: "checkbox",
default: false,
desiredSize: false
}
]
},
{
name: "icon",
hidden: (data) => !!data.html,
fields: [
{
name: "src",
label: "jqui_image",
type: "image",
hidden: (data) => data.icon || data.jquery_style
},
{
name: "icon",
label: "jqui_icon",
type: "icon64",
default: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBmaWxsPSJjdXJyZW50Q29sb3IiIGQ9Ik0xOSA2LjQxTDE3LjU5IDVMMTIgMTAuNTlMNi40MSA1TDUgNi40MUwxMC41OSAxMkw1IDE3LjU5TDYuNDEgMTlMMTIgMTMuNDFMMTcuNTkgMTlMMTkgMTcuNTlMMTMuNDEgMTJ6Ii8+PC9zdmc+",
hidden: (data) => data.src || data.jquery_style
},
{
name: "invert_icon",
type: "checkbox",
hidden: (data) => (!data.icon || !data.image) && data.jquery_style
},
{
name: "imageHeight",
type: "slider",
min: 0,
max: 200,
default: 100,
hidden: (data) => !data.src || data.jquery_style
}
]
}
]
};
}
getWidgetInfo() {
return JQuiButtonDialogClose.getWidgetInfo();
}
onClick() {
var _a;
let dlgName = this.state.rxData.dlgName;
if (!dlgName) {
const views = Object.keys(this.props.context.views);
for (let i = 0; i < views.length; i++) {
const widgets = this.props.context.views[views[i]].widgets;
if (widgets) {
const wids = Object.keys(widgets);
for (let j = 0; j < wids.length; j++) {
if (((_a = widgets[wids[j]].data) == null ? void 0 : _a.contains_view) === this.props.view) {
dlgName = wids[j];
break;
}
}
}
if (dlgName) {
break;
}
}
}
if (dlgName) {
const el = window.document.getElementById(dlgName) || window.document.querySelector(`[data-dialog-name="${dlgName}"]`);
const viewName = Object.keys(this.props.context.views).find((view) => this.props.context.views[view].widgets[dlgName]);
this.props.context.onCommand("closeDialog", viewName, dlgName);
if (el == null ? void 0 : el._showDialog) {
el._showDialog(false);
} else {
window.jQuery(`#${dlgName}_dialog`).dialog("close");
}
} else {
window.alert("Dialog not found");
}
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
const iconStyle = {
filter: this.state.rxData.invert_icon ? "invert(1)" : void 0
};
if (!this.state.rxData.jquery_style && this.state.rxData.src) {
if (this.state.width > this.state.height) {
iconStyle.height = `${this.state.rxData.imageHeight || 100}%`;
iconStyle.width = "auto";
} else {
iconStyle.width = `${this.state.rxData.imageHeight || 100}%`;
iconStyle.height = "auto";
}
}
let iconSrc = !this.state.rxData.jquery_style && (this.state.rxData.src || this.state.rxData.icon);
if (iconSrc && iconSrc.startsWith("_PRJ_NAME/")) {
iconSrc = iconSrc.replace("_PRJ_NAME/", `../${this.props.context.adapterName}.${this.props.context.instance}/${this.props.context.projectName}/`);
}
const icon = iconSrc ? jsxRuntimeExports.jsx(__mf_15, {
src: iconSrc,
style: iconStyle
}) : null;
const buttonStyle = {};
Object.keys(this.state.rxStyle).forEach((attr) => {
const value = this.state.rxStyle[attr];
if (value !== null && value !== void 0 && VisRxWidget.POSSIBLE_MUI_STYLES.includes(attr)) {
attr = attr.replace(/(-\w)/g, (text) => text[1].toUpperCase());
buttonStyle[attr] = value;
}
});
buttonStyle.minWidth = "unset";
if (buttonStyle.borderWidth) {
buttonStyle.borderWidth = VisBaseWidget.correctStylePxValue(buttonStyle.borderWidth);
}
if (buttonStyle.fontSize) {
buttonStyle.fontSize = VisBaseWidget.correctStylePxValue(buttonStyle.fontSize);
}
if (this.state.data.visResizable) {
buttonStyle.width = "100%";
buttonStyle.height = "100%";
} else {
buttonStyle.padding = this.state.rxData.padding;
}
let buttonText;
if (this.state.rxData.html) ;
else {
buttonText = this.state.rxData.buttontext;
}
const content = [
this.state.rxData.html_prepend ? jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html_prepend
}
}, "prepend") : null,
this.state.rxData.html ? jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html
}
}, "content") : this.state.rxData.no_style || this.state.rxData.jquery_style ? jsxRuntimeExports.jsxs("button", {
type: "button",
style: buttonStyle,
onClick: () => this.onClick(),
children: [
icon,
buttonText
]
}, "content") : !buttonText ? jsxRuntimeExports.jsx(__mf_39, {
style: {
zIndex: this.props.editMode ? 0 : void 0
},
color: this.state.rxData.color || "grey",
onClick: () => this.onClick(),
size: "small",
children: icon
}, "content") : jsxRuntimeExports.jsx(__mf_16, {
style: buttonStyle,
color: this.state.rxData.color || "grey",
variant: this.state.rxData.variant === void 0 ? "contained" : this.state.rxData.variant,
onClick: () => this.onClick(),
startIcon: icon,
children: buttonText
}, "content"),
this.state.rxData.html_append ? jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html_append
}
}, "append") : null
];
return jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
onClick: this.state.rxData.html ? () => this.onClick() : void 0,
children: content
});
}
}
class JQuiContainerButtonDialog extends JQuiButton {
static getWidgetInfo() {
const widgetInfo = JQuiButton.getWidgetInfo();
const newWidgetInfo = {
id: "tplContainerButtonDialog",
visSet: "jqui",
visName: "container - Button - view in jqui Dialog",
visWidgetLabel: "jqui_container_button_dialog",
visPrev: "widgets/jqui/img/Prev_ContainerButtonDialog.png",
visOrder: 11,
visAttrs: widgetInfo.visAttrs
};
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_button_link_blank_note"
});
const buttonText = JQuiButton.findField(newWidgetInfo, "buttontext");
buttonText.default = "Container Dialog";
const containsView = JQuiButton.findField(newWidgetInfo, "contains_view");
containsView.default = "";
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiContainerButtonDialog.getWidgetInfo();
}
}
class JQuiContainerIconDialog extends JQuiButton {
static getWidgetInfo() {
const widgetInfo = JQuiButton.getWidgetInfo();
const newWidgetInfo = {
id: "tplContainerIconDialog",
visSet: "jqui",
visName: "container - Icon - view in jqui Dialog",
visWidgetLabel: "jqui_container_icon_dialog",
visPrev: "widgets/jqui/img/Prev_ContainerIconDialog.png",
visOrder: 12,
visAttrs: widgetInfo.visAttrs
};
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_button_link_blank_note"
});
const visResizable = JQuiButton.findField(newWidgetInfo, "visResizable");
visResizable.default = true;
const icon = JQuiButton.findField(newWidgetInfo, "icon");
icon.default = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBmaWxsPSJjdXJyZW50Q29sb3IiIGQ9Ik0xOSAxOUg1VjVoN1YzSDVhMiAyIDAgMCAwLTIgMnYxNGEyIDIgMCAwIDAgMiAyaDE0YzEuMSAwIDItLjkgMi0ydi03aC0ydjd6TTE0IDN2MmgzLjU5bC05LjgzIDkuODNsMS40MSAxLjQxTDE5IDYuNDFWMTBoMlYzaC03eiIvPjwvc3ZnPg==";
const buttonText = JQuiButton.findField(newWidgetInfo, "buttontext");
delete buttonText.default;
const containsView = JQuiButton.findField(newWidgetInfo, "contains_view");
containsView.default = "";
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiContainerIconDialog.getWidgetInfo();
}
}
class JQuiInput extends VisRxWidget {
focused = false;
inputRef;
jQueryDone = false;
object = null;
constructor(props) {
super(props);
Object.assign(this.state, {
input: ""
});
this.inputRef = React.createRef();
}
static getWidgetInfo() {
return {
id: "tplJquiInput",
visSet: "jqui",
visName: "Input",
visWidgetLabel: "jqui_input",
visPrev: "widgets/jqui/img/Prev_Input.png",
visOrder: 13,
visAttrs: [
{
name: "common",
fields: [
{
name: "label",
type: "text",
default: __mf_2.t("jqui_input").replace("jqui_", "")
},
{
name: "oid",
type: "id",
onChange: async (_field, data, changeData, socket) => {
var _a, _b, _c;
if (data.oid && data.oid !== "nothing_selected") {
const obj = await socket.getObject(data.oid);
let changed = false;
if ((_a = obj == null ? void 0 : obj.common) == null ? void 0 : _a.unit) {
if (data.unit !== obj.common.unit) {
data.unit = obj.common.unit;
changed = true;
}
}
if (((_b = obj == null ? void 0 : obj.common) == null ? void 0 : _b.type) !== "number") {
if (!data.asString) {
data.asString = true;
changed = true;
}
} else if (((_c = obj == null ? void 0 : obj.common) == null ? void 0 : _c.type) === "number") {
if (data.asString) {
data.asString = false;
changed = true;
}
}
changed && changeData(data);
}
}
},
{
name: "asString",
type: "checkbox",
label: "jqui_as_string"
},
{
name: "autoFocus",
type: "checkbox"
},
{
name: "readOnly",
type: "checkbox",
label: "jqui_read_only"
},
{
name: "withEnter",
type: "checkbox",
label: "jqui_with_enter_button",
hidden: "!!data.readOnly"
},
{
name: "buttontext",
type: "text",
label: "jqui_button_text",
hidden: "!data.withEnter || !!data.readOnly"
},
{
name: "selectAllOnFocus",
type: "checkbox",
label: "jqui_select_all_on_focus",
tooltip: "jqui_select_all_on_focus_tooltip"
},
{
name: "unit",
type: "text",
label: "jqui_unit"
}
]
},
{
name: "style",
fields: [
{
name: "no_style",
type: "checkbox",
hidden: (data) => data.jquery_style
},
{
name: "jquery_style",
label: "jqui_jquery_style",
type: "checkbox",
hidden: (data) => data.no_style
},
{
name: "variant",
label: "jqui_variant",
type: "select",
noTranslation: true,
options: [
"filled",
"outlined",
"standard"
],
default: "standard",
hidden: (data) => data.jquery_style || data.no_style
},
{
name: "size",
type: "slider",
min: 4,
max: 100,
default: 10,
hidden: (data) => !data.no_style
}
]
}
]
};
}
getWidgetInfo() {
return JQuiInput.getWidgetInfo();
}
static findField(widgetInfo, name) {
return VisRxWidget.findField(widgetInfo, name);
}
async componentDidMount() {
super.componentDidMount();
try {
const input = await this.props.context.socket.getState(this.state.rxData.oid);
if (input && input.val !== void 0 && input.val !== null) {
input.val = input.val.toString();
this.setState({
input: input.val
});
}
} catch (error) {
console.error(`Cannot get state ${this.state.rxData.oid}: ${error}`);
}
if (this.inputRef.current && this.state.rxData.autoFocus && !this.props.editMode && (this.state.rxData.jquery_style || this.state.rxData.no_style)) {
setTimeout(() => this.inputRef.current.focus(), 100);
}
}
onStateUpdated(id, state) {
super.onStateUpdated(id, state);
if ((state == null ? void 0 : state.val) || (state == null ? void 0 : state.val) === 0) {
if (id === this.state.rxData.oid && !this.focused) {
if (state.val.toString() !== this.state.input.toString()) {
this.setState({
input: state.val
});
}
}
}
}
componentDidUpdate() {
if (this.inputRef.current) {
if (this.state.rxData.jquery_style && !this.jQueryDone) {
this.jQueryDone = true;
window.jQuery(this.inputRef.current).button().addClass("ui-state-default");
}
}
}
async setValue(value) {
var _a, _b, _c;
if (((_a = this.object) == null ? void 0 : _a._id) !== this.state.rxData.oid) {
this.object = await this.props.context.socket.getObject(this.state.rxData.oid);
if (!this.object) {
return;
}
}
if (((_c = (_b = this.object) == null ? void 0 : _b.common) == null ? void 0 : _c.type) === "number") {
let fValue = parseFloat(value.replace(",", "."));
if (Number.isNaN(value)) {
fValue = 0;
}
this.props.context.setValue(this.state.rxData.oid, fValue);
} else {
this.props.context.setValue(this.state.rxData.oid, value);
}
}
onChange(value) {
this.setState({
input: value
});
if (!this.state.rxData.withEnter) {
void this.setValue(value);
}
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
props.style.overflow = "visible";
let content;
const label = this.state.rxData.label;
if (!this.state.rxData.jquery_style && !this.state.rxData.no_style) {
content = jsxRuntimeExports.jsx(__mf_121, {
fullWidth: true,
value: this.state.input === null || this.state.input === void 0 ? "" : this.state.rxData.asString ? this.state.input.toString() : this.state.input,
type: this.state.rxData.asString ? "text" : "number",
onFocus: (e) => {
this.focused = true;
if (this.state.rxData.selectAllOnFocus) {
e.target.select();
}
},
onBlur: () => this.focused = false,
autoFocus: !this.props.editMode && this.state.rxData.autoFocus,
variant: this.state.rxData.variant === void 0 ? "standard" : this.state.rxData.variant,
slotProps: {
htmlInput: {
readOnly: this.state.rxData.readOnly
},
input: {
endAdornment: this.state.rxData.withEnter && !this.state.rxData.readOnly ? jsxRuntimeExports.jsx(__mf_58, {
position: "end",
children: this.state.rxData.buttontext ? jsxRuntimeExports.jsx(__mf_16, {
onClick: () => this.setValue(this.state.input),
variant: "contained",
style: {
marginBottom: 10,
minWidth: 40
},
children: this.state.rxData.buttontext
}) : jsxRuntimeExports.jsx(__mf_53, {
onClick: () => this.setValue(this.state.input),
edge: "end",
children: jsxRuntimeExports.jsx(__mf_4885, {})
})
}) : void 0,
startAdornment: this.state.rxData.unit ? jsxRuntimeExports.jsx(__mf_58, {
position: "start",
children: this.state.rxData.unit
}) : void 0
}
},
label,
onChange: (e) => this.onChange(e.target.value)
});
} else {
content = [
jsxRuntimeExports.jsx("div", {
style: {
marginRight: 8
},
children: label
}, "label"),
jsxRuntimeExports.jsx("input", {
style: {
flexGrow: 1
},
readOnly: this.state.rxData.readOnly,
value: this.state.input || "",
ref: this.inputRef,
size: this.state.rxData.size || 10,
onFocus: (e) => {
this.focused = true;
if (this.state.rxData.selectAllOnFocus) {
e.target.select();
}
},
onBlur: () => this.focused = false,
onChange: (e) => this.onChange(e.target.value)
}, "input"),
this.state.rxData.withEnter && !this.state.rxData.readOnly ? jsxRuntimeExports.jsx(__mf_53, {
style: {
marginRight: 5
},
onClick: () => this.setValue(this.state.input),
edge: "end",
children: jsxRuntimeExports.jsx(__mf_4885, {})
}, "button") : void 0
];
}
return jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
style: {
display: "flex",
alignItems: "center"
},
children: content
});
}
}
class JQuiInputSet extends JQuiInput {
static getWidgetInfo() {
const widgetInfo = JQuiInput.getWidgetInfo();
const newWidgetInfo = {
id: "tplJquiInputSet",
visSet: "jqui",
visName: "Input + Button",
visWidgetLabel: "jqui_input_with_button",
visPrev: "widgets/jqui/img/Prev_InputWithButton.png",
visOrder: 14,
visAttrs: widgetInfo.visAttrs,
visDefaultStyle: {
width: 150,
height: 45
}
};
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_button_input_note"
});
const withEnter = JQuiInput.findField(newWidgetInfo, "withEnter");
if (withEnter) {
withEnter.default = true;
}
const buttonText = JQuiInput.findField(newWidgetInfo, "buttontext");
if (buttonText) {
buttonText.default = "OK";
}
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiInputSet.getWidgetInfo();
}
}
class JQuiBinaryState extends VisRxWidget {
textsLengthCache = {};
constructor(props) {
super(props);
Object.assign(this.state, {
isOn: false,
height: 0,
width: 0
});
}
static getWidgetInfo() {
return {
id: "tplJquiBool",
visSet: "jqui",
visName: "Html Bool",
visWidgetLabel: "jqui_binary_control",
visPrev: "widgets/jqui/img/Prev_BinaryControl.png",
visOrder: 14,
visAttrs: [
{
name: "common",
fields: [
{
name: "type",
label: "jqui_type",
type: "select",
noTranslation: true,
default: "button",
options: [
"button",
"round-button",
"html",
"radio",
"checkbox",
"image",
"switch"
]
},
{
name: "oid",
type: "id"
},
{
name: "readOnly",
type: "checkbox"
},
{
name: "pushMode",
type: "checkbox",
label: "jqui_push_mode",
tooltip: "jqui_push_mode_tooltip",
hidden: (data) => data.type !== "button" && data.type !== "round-button" && data.type !== "image"
},
{
name: "click_id",
type: "id",
noSubscribe: true,
hidden: (data) => !!data.readOnly
},
{
name: "invert",
label: "jqui_inverted",
type: "checkbox"
},
{
name: "test",
type: "select",
label: "jqui_test",
options: [
{
value: "",
label: "none"
},
{
value: true,
label: "jqui_true"
},
{
value: false,
label: "jqui_false"
}
]
}
]
},
{
name: "html",
label: "jqui_html",
hidden: (data) => data.type !== "html",
fields: [
{
name: "html_true",
type: "html",
label: "jqui_html_true"
},
{
name: "html_false",
type: "html",
label: "jqui_html_false"
}
]
},
{
name: "text",
label: "group_text",
fields: [
{
name: "text_false",
type: "text",
label: "text_false",
default: __mf_2.t("jqui_off").replace("jqui_", ""),
hidden: (data) => data.type === "image" || data.type === "html"
},
{
name: "text_true",
type: "text",
label: "text_true",
default: __mf_2.t("jqui_on").replace("jqui_", ""),
hidden: (data) => data.type === "image" || data.type === "html" || data.type === "round-button"
},
{
name: "color_false",
type: "color",
label: "color_false",
hidden: (data) => data.type === "image" || data.type === "html" || !data.text_false
},
{
name: "color_true",
type: "color",
label: "color_true",
hidden: (data) => data.type === "image" || data.type === "html" || !data.text_true
},
{
name: "alt_false",
type: "text",
label: "alt_false"
},
{
name: "alt_true",
type: "text",
label: "alt_true"
},
{
name: "equal_text_length",
type: "checkbox",
label: "jqui_equal_text_length",
tooltip: "jqui_equal_text_length_tooltip",
hidden: (data) => !data.text_true || !data.text_false
}
]
},
{
name: "style",
fields: [
{
name: "jquery_style",
label: "jqui_jquery_style",
type: "checkbox",
hidden: (data) => data.type !== "button"
},
{
name: "padding",
type: "slider",
min: 0,
max: 100,
default: 5
},
{
name: "variant",
label: "jqui_variant",
type: "select",
noTranslation: true,
options: [
"contained",
"outlined",
"standard"
],
default: "contained",
hidden: (data) => data.type !== "button" && data.type !== "radio"
},
{
name: "orientation",
label: "jqui_orientation",
type: "select",
noTranslation: true,
options: [
"horizontal",
"vertical"
],
default: "horizontal",
hidden: (data) => data.type !== "radio"
},
{
name: "notEqualLength",
label: "jqui_not_equal_length",
type: "checkbox",
hidden: (data) => data.type !== "radio" || data.orientation !== "horizontal"
},
{
name: "html_prepend",
type: "html"
},
{
name: "html_append",
type: "html"
}
]
},
{
name: "icon_false",
label: "group_icon_false",
fields: [
{
name: "src_false",
label: "jqui_image",
type: "image",
hidden: (data) => data.icon_false
},
{
name: "icon_false",
label: "jqui_icon",
type: "icon64",
hidden: (data) => data.src_false
},
{
name: "icon_color_false",
label: "jqui_color",
type: "color",
hidden: (data) => !data.icon_false
},
{
name: "invert_icon_false",
label: "jqui_invert_icon",
type: "checkbox",
hidden: (data) => !data.src_false && !data.icon_false
},
{
name: "imageHeight_false",
label: "jqui_image_height",
type: "slider",
min: 0,
max: 200,
hidden: (data) => !data.src_false && !data.icon_false
}
]
},
{
name: "icon_true",
label: "group_icon_true",
fields: [
{
name: "src_true",
label: "jqui_image",
type: "image",
hidden: (data) => data.icon_true
},
{
name: "icon_true",
label: "jqui_icon",
type: "icon64",
hidden: (data) => data.src_true
},
{
name: "icon_color_true",
label: "jqui_color",
type: "color",
hidden: (data) => !data.icon_true && !data.icon_false
},
{
name: "invert_icon_true",
label: "jqui_invert_icon",
type: "checkbox",
hidden: (data) => !data.src_true && !data.icon_true
},
{
name: "imageHeight_true",
label: "jqui_image_height",
type: "slider",
min: 0,
max: 200,
hidden: (data) => !data.src_true && !data.icon_true
}
]
}
]
};
}
async componentDidMount() {
super.componentDidMount();
if ((this.props.tpl === "tplIconStateBool" || this.props.tpl === "tplIconStatePushButton") && (this.state.data.false_text || this.state.data.true_text)) {
const data = JSON.parse(JSON.stringify(this.state.data));
data.text_false = data.false_text;
data.text_true = data.true_text;
data.src_false = data.false_src;
data.src_true = data.true_src;
data.alt_false = data.false_alt;
data.alt_true = data.true_alt;
data.invert_icon_false = data.invert_icon;
data.invert_icon_true = data.invert_icon;
if (this.props.tpl === "tplIconStatePushButton") {
data.pushMode = true;
}
data.false_text = null;
data.true_text = null;
if (this.props.context.onWidgetsChanged) {
setTimeout(() => this.props.context.onWidgetsChanged([
{
wid: this.props.id,
view: this.props.view,
data
}
]), 100);
}
}
if (this.state.rxData.oid && this.state.rxData.oid !== "nothing_selected") {
try {
const state = await this.props.context.socket.getState(this.state.rxData.oid);
this.onStateUpdated(this.state.rxData.oid, state);
} catch (error) {
console.error(`Cannot get state ${this.state.rxData.oid}: ${error}`);
}
}
}
static findField(widgetInfo, name) {
return VisRxWidget.findField(widgetInfo, name);
}
getWidgetInfo() {
return JQuiBinaryState.getWidgetInfo();
}
onStateUpdated(id, state) {
if (id === this.state.rxData.oid && state) {
const isOn = state.val === true || state.val === "true" || state.val === 1 || state.val === "1" || state.val === "on" || state.val === "ON" || state.val === "On";
if (this.state.isOn !== isOn) {
this.setState({
isOn
});
}
}
}
getControlOid() {
if (this.state.rxData.click_id && this.state.rxData.click_id !== "nothing_selected") {
return this.state.rxData.click_id;
}
if (this.state.rxData.oid && this.state.rxData.oid !== "nothing_selected") {
return this.state.rxData.oid;
}
return "";
}
onClick(isOn) {
if (this.state.rxData.readOnly || this.props.editMode) {
return;
}
if (isOn !== false && isOn !== true) {
isOn = !this.isOn();
}
const oid = this.getControlOid();
if (oid) {
this.props.context.setValue(oid, isOn);
}
this.setState({
isOn
});
}
onMyMouseDown() {
const oid = this.getControlOid();
if (oid) {
this.props.context.setValue(oid, !this.state.rxData.invert);
}
this.setState({
isOn: true
});
}
onMyMouseUp() {
const oid = this.getControlOid();
if (oid) {
this.props.context.setValue(oid, !!this.state.rxData.invert);
}
this.setState({
isOn: false
});
}
isOn() {
let value;
if (this.props.editMode && (this.state.rxData.test === true || this.state.rxData.test === false)) {
value = this.state.rxData.test;
} else {
value = this.state.isOn;
}
if (value === void 0 || value === null) {
value = false;
}
if (this.state.rxData.invert) {
value = !value;
}
return value;
}
renderIcon(isOn, doNotFallback) {
let icon;
let invert;
let height;
let color;
if (isOn) {
icon = this.state.rxData.src_true || this.state.rxData.icon_true;
if (icon) {
invert = this.state.rxData.invert_icon_true;
height = this.state.rxData.imageHeight_true;
}
color = this.state.rxData.icon_color_true;
}
if (!icon && (!isOn || !doNotFallback)) {
icon = this.state.rxData.src_false || this.state.rxData.icon_false;
if (icon) {
invert = this.state.rxData.invert_icon_false;
height = this.state.rxData.imageHeight_false;
color = color || this.state.rxData.icon_color_false;
}
}
const style = {};
if (invert) {
style.filter = "invert(1)";
}
if (color) {
style.color = color;
}
if (height) {
style.height = height;
style.width = "auto";
} else if (this.state.width && this.state.rxData.type === "image") {
if (this.state.width < this.state.height) {
style.width = `calc(100% - ${(this.state.rxData.padding || 0) * 2}px)`;
style.height = "auto";
style.maxHeight = "100%";
} else {
style.height = `calc(100% - ${(this.state.rxData.padding || 0) * 2}px)`;
style.width = "auto";
style.maxWidth = "100%";
}
} else if (this.state.rxData.type === "round-button") {
if (this.state.width < this.state.height) {
style.width = `calc(70% - ${(this.state.rxData.padding || 0) * 2}px)`;
style.height = "auto";
style.maxHeight = "100%";
} else {
style.height = `calc(70% - ${(this.state.rxData.padding || 0) * 2}px)`;
style.width = "auto";
style.maxWidth = "100%";
}
} else if (this.state.width < this.state.height) {
style.width = `calc(100% - ${(this.state.rxData.padding || 0) * 2}px)`;
style.height = "auto";
style.maxHeight = "100%";
} else {
style.height = `calc(100% - ${(this.state.rxData.padding || 0) * 2}px)`;
style.width = "auto";
style.maxWidth = "100%";
}
if (this.state.rxData.padding) {
style.padding = this.state.rxData.padding;
}
if (icon) {
if (icon.startsWith("_PRJ_NAME/")) {
icon = icon.replace("_PRJ_NAME/", `../${this.props.context.adapterName}.${this.props.context.instance}/${this.props.context.projectName}/`);
}
return jsxRuntimeExports.jsx(__mf_15, {
style,
src: icon
}, "icon");
}
return null;
}
getTextWidth(text) {
if (!this.refService.current) {
return text * 14;
}
if (this.textsLengthCache[text]) {
return this.textsLengthCache[text];
}
const el = document.createElement("div");
el.style.position = "absolute";
el.style.visibility = "hidden";
el.style.height = "auto";
el.style.width = "auto";
el.innerHTML = text;
this.refService.current.appendChild(el);
const width = el.clientWidth;
this.refService.current.removeChild(el);
this.textsLengthCache[text] = width;
return width;
}
renderText(isOn) {
let text;
let color;
if (isOn) {
text = this.state.rxData.text_true !== void 0 ? this.state.rxData.text_true : this.state.rxData.on_text;
color = this.state.rxData.color_true;
}
text = text || (this.state.rxData.text_false !== void 0 ? this.state.rxData.text_false : this.state.rxData.off_text);
color = color || this.state.rxData.color_false;
if (this.state.rxData.equal_text_length && this.state.rxData.text_false && this.state.rxData.text_true) {
const falseLength = this.getTextWidth(this.state.rxData.text_false);
const trueLength = this.getTextWidth(this.state.rxData.text_true);
const length = Math.max(falseLength, trueLength);
return {
text: jsxRuntimeExports.jsx("div", {
style: {
width: length,
display: "inline-block",
color
},
children: text
}),
color
};
}
return {
text,
color
};
}
renderButton(isOn, style) {
const icon = this.renderIcon(isOn);
const text = this.renderText(isOn);
style.color = text.color || void 0;
return jsxRuntimeExports.jsxs(__mf_16, {
variant: this.state.rxData.variant === void 0 ? "contained" : this.state.rxData.variant,
color: isOn ? "primary" : "grey",
onMouseDown: this.state.rxData.pushMode && !this.state.rxData.readOnly && !this.props.editMode ? () => this.onMyMouseDown() : void 0,
onMouseUp: this.state.rxData.pushMode && !this.state.rxData.readOnly && !this.props.editMode ? () => this.onMyMouseUp() : void 0,
onClick: !this.state.rxData.pushMode && !this.state.rxData.readOnly && !this.props.editMode ? () => this.onClick() : void 0,
style,
children: [
icon,
text.text
]
});
}
renderFab(isOn, style) {
const icon = this.renderIcon(isOn);
const text = this.renderText(isOn);
style.zIndex = this.props.editMode ? 0 : void 0;
return jsxRuntimeExports.jsx(__mf_39, {
style,
color: isOn ? "primary" : "grey",
onMouseDown: this.state.rxData.pushMode && !this.state.rxData.readOnly && !this.props.editMode ? () => this.onMyMouseDown() : void 0,
onMouseUp: this.state.rxData.pushMode && !this.state.rxData.readOnly && !this.props.editMode ? () => this.onMyMouseUp() : void 0,
onClick: !this.state.rxData.pushMode && !this.state.rxData.readOnly && !this.props.editMode ? () => this.onClick() : void 0,
children: icon || text.text
});
}
renderHtml(isOn) {
let html;
if (isOn) {
html = this.state.rxData.html_true;
}
if (!html) {
html = this.state.rxData.html_false;
}
const icon = this.renderIcon(isOn);
return [
this.state.rxData.html_prepend ? jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html_prepend
}
}, "prepend") : null,
icon,
html ? jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: html
}
}, "content") : null,
this.state.rxData.html_append ? jsxRuntimeExports.jsx("span", {
dangerouslySetInnerHTML: {
__html: this.state.rxData.html_append
}
}, "append") : null
];
}
renderSwitch(isOn, style) {
const on = this.state.rxData.text_true !== void 0 ? this.state.rxData.text_true : this.state.rxData.on_text;
const textColorOn = this.state.rxData.color_true;
const off = this.state.rxData.text_false !== void 0 ? this.state.rxData.text_false : this.state.rxData.off_text;
const textColorOff = this.state.rxData.color_false;
const onIcon = this.renderIcon(true, true);
const offIcon = this.renderIcon(false);
if ((on || onIcon) && (off || offIcon)) {
style.display = "flex";
style.alignItems = "center";
return jsxRuntimeExports.jsxs("div", {
style,
children: [
jsxRuntimeExports.jsx("div", {
style: {
marginTop: -2,
color: textColorOff
},
children: off
}),
jsxRuntimeExports.jsx("div", {
children: offIcon
}),
jsxRuntimeExports.jsx(__mf_108, {
checked: isOn,
onChange: () => this.onClick()
}),
jsxRuntimeExports.jsx("div", {
children: onIcon
}),
jsxRuntimeExports.jsx("div", {
style: {
marginTop: -2,
color: textColorOn
},
children: on
})
]
});
}
if (off || offIcon) {
let text;
if (offIcon && off) {
text = jsxRuntimeExports.jsxs("div", {
style: {
display: "flex",
alignItems: "center",
color: textColorOff
},
children: [
offIcon,
off
]
});
} else {
text = off || offIcon;
}
style.marginLeft = 5;
return jsxRuntimeExports.jsx(__mf_43, {
style,
control: jsxRuntimeExports.jsx(__mf_108, {
checked: isOn,
onChange: () => this.onClick()
}),
label: text
});
}
return jsxRuntimeExports.jsx("div", {
style,
children: jsxRuntimeExports.jsx(__mf_108, {
checked: false,
onChange: () => this.onClick()
})
});
}
renderCheckbox(isOn, style) {
let text = isOn ? this.state.rxData.text_true !== void 0 ? this.state.rxData.text_true : this.state.rxData.on_text : this.state.rxData.text_false !== void 0 ? this.state.rxData.text_false : this.state.rxData.off_text;
if (!text) {
text = this.state.rxData.text_false !== void 0 ? this.state.rxData.text_false : this.state.rxData.off_text;
}
const icon = isOn ? this.renderIcon(true) : this.renderIcon(false);
style.marginLeft = 5;
if (text || icon) {
return jsxRuntimeExports.jsx(__mf_43, {
style,
control: jsxRuntimeExports.jsx(__mf_25, {
checked: isOn,
onChange: () => this.onClick()
}),
label: jsxRuntimeExports.jsxs("div", {
style: {
display: "flex",
alignItems: "center"
},
children: [
icon,
text
]
})
});
}
return jsxRuntimeExports.jsx(__mf_25, {
style,
checked: isOn,
onChange: () => this.onClick()
});
}
renderRadio(isOn, style) {
const on = this.state.rxData.text_true !== void 0 ? this.state.rxData.text_true : this.state.rxData.on_text;
const off = this.state.rxData.text_false !== void 0 ? this.state.rxData.text_false : this.state.rxData.off_text;
const onIcon = this.renderIcon(true);
const offIcon = this.renderIcon(false);
let variant = this.state.rxData.variant === void 0 ? "contained" : this.state.rxData.variant;
if (variant === "standard") {
variant = "text";
}
const buttonStyle = this.state.rxData.orientation === "vertical" ? {
height: "50%"
} : this.state.rxData.notEqualLength ? void 0 : {
width: "50%"
};
return jsxRuntimeExports.jsxs(__mf_18, {
style,
variant,
orientation: this.state.rxData.orientation || "horizontal",
children: [
jsxRuntimeExports.jsx(__mf_16, {
style: buttonStyle,
startIcon: offIcon,
color: isOn ? "grey" : "primary",
onClick: () => this.onClick(false),
children: off || __mf_2.t("off")
}),
jsxRuntimeExports.jsx(__mf_16, {
style: buttonStyle,
color: isOn ? "primary" : "grey",
startIcon: onIcon,
onClick: () => this.onClick(true),
children: on || __mf_2.t("on")
})
]
});
}
componentDidUpdate() {
if (!this.refService.current) {
return;
}
if (this.state.rxData.type === "image" || this.state.rxData.type === "html" || this.state.rxData.type === "button" && this.state.rxData.jquery_style) {
if (this.state.rxData.type === "button") {
const el = this.refService.current.getElementsByClassName("vis-widget-body");
if ((el == null ? void 0 : el.length) && !this.refService.current._jQueryDone) {
this.refService.current._jQueryDone = true;
window.jQuery(el[0]).button();
const textEl = el[0].getElementsByClassName("ui-button-text");
if (textEl == null ? void 0 : textEl.length) {
textEl[0].style.display = "flex";
textEl[0].style.alignItems = "center";
}
}
}
if (this.refService.current.clientWidth !== this.state.width || this.refService.current.clientHeight !== this.state.height) {
this.setState({
width: this.refService.current.clientWidth,
height: this.refService.current.clientHeight
});
}
}
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
const isOn = this.isOn();
const buttonStyle = {};
Object.keys(this.state.rxStyle).forEach((attr) => {
const value = this.state.rxStyle[attr];
if (value !== null && value !== void 0 && VisRxWidget.POSSIBLE_MUI_STYLES.includes(attr)) {
attr = attr.replace(/(-\w)/g, (text) => text[1].toUpperCase());
buttonStyle[attr] = value;
}
});
let type = this.state.rxData.type;
if (!type && this.props.tpl === "tplJquiRadio") {
type = "radio";
}
if (buttonStyle.borderWidth) {
buttonStyle.borderWidth = VisBaseWidget.correctStylePxValue(buttonStyle.borderWidth);
}
if (buttonStyle.fontSize) {
buttonStyle.fontSize = VisBaseWidget.correctStylePxValue(buttonStyle.fontSize);
}
buttonStyle.width = "100%";
buttonStyle.height = "100%";
buttonStyle.minWidth = "unset";
let content;
const bodyStyle = {
textAlign: "center"
};
if (type === "radio") {
content = this.renderRadio(isOn, buttonStyle);
} else if (type === "html" || type === "button" && this.state.rxData.jquery_style) {
bodyStyle.display = "flex";
bodyStyle.flexDirection = this.state.height > this.state.width ? "column" : "row";
bodyStyle.alignItems = "center";
bodyStyle.justifyContent = "center";
bodyStyle.cursor = !this.state.rxData.readOnly ? "pointer" : void 0;
content = this.renderHtml(isOn);
} else if (type === "switch") {
content = this.renderSwitch(isOn, buttonStyle);
} else if (type === "checkbox") {
content = this.renderCheckbox(isOn, buttonStyle);
} else if (type === "image") {
bodyStyle.cursor = !this.state.rxData.readOnly ? "pointer" : void 0;
content = this.renderIcon(isOn, !!buttonStyle);
} else if (type === "round-button") {
content = this.renderFab(isOn, buttonStyle);
} else if (!this.state.rxData.jquery_style) {
content = this.renderButton(isOn, buttonStyle);
}
const result = jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
style: bodyStyle,
onClick: type === "image" || type === "html" ? () => this.onClick() : void 0,
children: content
});
if (isOn && this.state.rxData.alt_true) {
return jsxRuntimeExports.jsx(__mf_126, {
title: this.state.rxData.alt_true,
slotProps: {
popper: {
sx: {
pointerEvents: "none"
}
}
},
children: result
});
}
if (!isOn && this.state.rxData.alt_false) {
return jsxRuntimeExports.jsx(__mf_126, {
title: this.state.rxData.alt_false,
slotProps: {
popper: {
sx: {
pointerEvents: "none"
}
}
},
children: result
});
}
return result;
}
}
class JQuiRadio extends JQuiBinaryState {
static getWidgetInfo() {
const widgetInfo = JQuiBinaryState.getWidgetInfo();
const newWidgetInfo = {
id: "tplJquiRadio",
visSet: "jqui",
visName: "Radiobuttons on/off",
visWidgetLabel: "jqui_radio_buttons_on_off",
visPrev: "widgets/jqui/img/Prev_RadioButtonsOnOff.png",
visOrder: 15,
visAttrs: widgetInfo.visAttrs,
visDefaultStyle: {
width: 150,
height: 45
}
};
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_button_binary_control_note"
});
const type = JQuiBinaryState.findField(newWidgetInfo, "type");
if (type) {
type.default = "radio";
}
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiRadio.getWidgetInfo();
}
}
class BulkEditor extends React.Component {
render() {
return null;
}
static async generateFields() {
return false;
}
}
class JQuiState extends VisRxWidget {
controlTimeout = null;
constructor(props) {
super(props);
Object.assign(this.state, {
value: "",
object: null
});
}
static getWidgetInfo() {
return {
id: "tplJquiButtonState",
visSet: "jqui",
visName: "States control",
visWidgetLabel: "jqui_states_control",
visPrev: "widgets/jqui/img/Prev_ButtonState.png",
visOrder: 14,
visAttrs: [
{
name: "common",
fields: [
{
name: "type",
label: "jqui_type",
type: "select",
noTranslation: true,
default: "button",
options: [
"button",
"select",
"radio",
"slider"
]
},
{
name: "oid",
type: "id",
onChange: async (_field, data, changeData, socket) => {
if (data.oid) {
if (await BulkEditor.generateFields(data, socket)) {
changeData(data);
}
}
}
},
{
name: "readOnly",
type: "checkbox"
},
{
name: "click_id",
type: "id",
noSubscribe: true,
hidden: (data) => !!data.readOnly
},
{
name: "count",
type: "slider",
min: 0,
default: 1,
max: 10,
hidden: (data) => !!data.percents
},
{
type: "custom",
component: (_field, data, onDataChange, props) => jsxRuntimeExports.jsx(BulkEditor, {
theme: props.context.theme,
data: data || {},
onDataChange,
socket: props.context.socket,
themeType: props.context.theme.palette.mode === "dark" ? "dark" : "light",
adapterName: props.context.adapterName,
instance: props.context.instance,
projectName: props.context.projectName,
additionalSets: props.context.additionalSets
})
},
{
name: "variant",
label: "jqui_variant",
type: "select",
noTranslation: true,
options: [
"contained",
"outlined",
"text",
"standard"
],
default: "contained",
hidden: (data) => data.type !== "button" && data.type !== "select"
},
{
name: "orientation",
label: "orientation",
type: "select",
options: [
"horizontal",
"vertical"
],
default: "horizontal",
hidden: (data) => data.type !== "button" && data.type !== "slider"
},
{
name: "widgetTitle",
label: "jqui_name",
type: "text"
},
{
name: "timeout",
label: "jqui_set_timeout",
type: "number",
hidden: (data) => data.type !== "slider"
},
{
name: "open",
label: "jqui_open",
type: "checkbox",
hidden: (data) => data.type !== "select"
}
]
},
{
name: "states",
label: "jqui_group_value",
indexFrom: 1,
indexTo: "count",
hidden: (data) => !!data.percents,
fields: [
{
name: "value",
type: "text",
label: "jqui_value",
default: "0"
},
{
name: "test",
type: "checkbox",
label: "jqui_test",
onChange: (field, data, changeData, _socket, index) => {
if (data[field.name]) {
let changed = false;
for (let i = 1; i <= data.count; i++) {
if (i !== index) {
if (data[`test${i}`]) {
changed = true;
data[`test${i}`] = false;
}
}
}
changed && changeData(data);
}
return Promise.resolve();
},
hidden: (data, index) => data.type === "slider" || data[`value${index}`] === "" || data[`value${index}`] === null || data[`value${index}`] === void 0
},
{
name: "onlyIcon",
type: "checkbox",
label: "jqui_only_icon"
},
{
name: "text",
default: __mf_2.t("Value"),
type: "text",
label: "jqui_text",
hidden: (data, index) => !!data[`onlyIcon${index}`] || data[`value${index}`] === "" || data[`value${index}`] === null || data[`value${index}`] === void 0
},
{
name: "color",
type: "color",
label: "color",
hidden: (data, index) => data.type === "slider" || data[`value${index}`] === "" || data[`value${index}`] === null || data[`value${index}`] === void 0
},
{
name: "activeColor",
type: "color",
label: "jqui_active_color",
hidden: (data, index) => data.type === "slider" || data[`value${index}`] === "" || data[`value${index}`] === null || data[`value${index}`] === void 0
},
{
name: "image",
label: "jqui_image",
type: "image",
hidden: (data, index) => data.type === "slider" || !!data.icon || data[`value${index}`] === "" || data[`value${index}`] === null || data[`value${index}`] === void 0
},
{
name: "icon",
label: "jqui_icon",
type: "icon64",
hidden: (data, index) => data.type === "slider" || !!data.image || data[`value${index}`] === "" || data[`value${index}`] === null || data[`value${index}`] === void 0
},
{
name: "tooltip",
label: "jqui_tooltip",
type: "text",
hidden: (data, index) => data.type === "slider" || data[`value${index}`] === "" || data[`value${index}`] === null || data[`value${index}`] === void 0
}
]
}
],
visDefaultStyle: {
width: 300,
height: 45
}
};
}
async componentDidMount() {
super.componentDidMount();
if (this.props.tpl === "tplJquiRadioSteps" && this.state.data && this.props.context.onWidgetsChanged && this.state.data.count === void 0) {
const data = deepClone(this.state.data);
data.count = 5;
const min2 = parseFloat(data.min || 0);
const max2 = parseFloat(data.max || 100);
data.value1 = min2;
data.text1 = __mf_2.t("jqui_off");
data["g_states-1"] = true;
data.value5 = max2;
data.text5 = "100%";
data["g_states-5"] = true;
data.value2 = (max2 - min2) * 0.25 + min2;
data.text2 = "25%";
data["g_states-2"] = true;
data.value3 = (max2 - min2) * 0.5 + min2;
data.text3 = "50%";
data["g_states-3"] = true;
data.value4 = (max2 - min2) * 0.75 + min2;
data.text4 = "75%";
data["g_states-4"] = true;
data.min = null;
data.max = null;
setTimeout(() => this.props.context.onWidgetsChanged([
{
wid: this.props.id,
view: this.props.view,
data
}
]), 100);
}
if ((this.props.tpl === "tplJquiRadioList" || this.props.tpl === "tplJquiSelectList") && this.state.data && this.state.data.values && this.state.data.texts && this.props.context.onWidgetsChanged) {
const values = this.state.data.values.split(";");
const texts = this.state.data.texts.split(";");
const data = deepClone(this.state.data);
data.values = null;
data.texts = null;
data.count = values.length;
for (let i = 1; i <= values.length; i++) {
data[`value${i}`] = values[i - 1];
data[`text${i}`] = texts[i - 1];
data[`g_states-${i}`] = true;
}
data.type = this.props.tpl === "tplJquiRadioList" ? "radio" : "select";
if (this.props.context.onWidgetsChanged) {
setTimeout(() => this.props.context.onWidgetsChanged([
{
wid: this.props.id,
view: this.props.view,
data
}
]), 100);
}
}
if (this.state.rxData.oid && this.state.rxData.oid !== "nothing_selected") {
try {
const state = await this.props.context.socket.getState(this.state.rxData.oid);
this.onStateUpdated(this.state.rxData.oid, state);
} catch (error) {
console.error(`Cannot get state ${this.state.rxData.oid}: ${error}`);
}
}
}
componentWillUnmount() {
super.componentWillUnmount();
if (this.controlTimeout) {
clearTimeout(this.controlTimeout);
this.controlTimeout = null;
}
}
static findField(widgetInfo, name) {
return VisRxWidget.findField(widgetInfo, name);
}
getWidgetInfo() {
return JQuiState.getWidgetInfo();
}
onStateUpdated(id, state) {
if (id === this.state.rxData.oid && state) {
const value = state.val === null || state.val === void 0 ? "" : state.val;
if (this.state.value !== value.toString()) {
this.setState({
value: value.toString()
});
}
}
}
getControlOid() {
if (this.state.rxData.click_id && this.state.rxData.click_id !== "nothing_selected") {
return this.state.rxData.click_id;
}
if (this.state.rxData.oid && this.state.rxData.oid !== "nothing_selected") {
return this.state.rxData.oid;
}
return "";
}
onClick(indexOrValue, immediately) {
var _a;
if (this.state.rxData.readOnly || this.props.editMode) {
return;
}
if (this.state.rxData.type === "slider") {
if (this.controlTimeout) {
clearTimeout(this.controlTimeout);
}
this.controlTimeout = setTimeout(() => {
this.controlTimeout = null;
const oid = this.getControlOid();
if (oid) {
this.props.context.setValue(oid, parseFloat(indexOrValue));
}
}, immediately ? 0 : parseInt(this.state.rxData.timeout, 10) || 300);
this.setState({
value: indexOrValue
});
} else {
const oid = this.getControlOid();
if (oid) {
if (typeof this.state.object === "object" && ((_a = this.state.object) == null ? void 0 : _a.common.type) === "number") {
this.props.context.setValue(oid, parseFloat(this.state.rxData[`value${indexOrValue}`]));
} else {
this.props.context.setValue(oid, this.state.rxData[`value${indexOrValue}`]);
}
}
this.setState({
value: this.state.rxData[`value${indexOrValue}`]
});
}
}
getSelectedIndex(value) {
if (value === void 0) {
value = this.state.value;
}
if (this.props.editMode) {
for (let i = 1; i <= this.state.rxData.count; i++) {
if (this.state.rxData[`test${i}`]) {
return i;
}
}
}
for (let i = 1; i <= this.state.rxData.count; i++) {
if (this.state.rxData[`value${i}`] === value) {
return i;
}
}
return 0;
}
renderIcon(i, selectedIndex) {
let color;
const rxData = this.state.rxData;
let icon = rxData[`icon${i}`] || rxData[`image${i}`];
if (icon && rxData[`color${i}`]) {
color = rxData[`color${i}`];
if (i === selectedIndex && rxData[`activeColor${i}`]) {
color = rxData[`activeColor${i}`];
}
}
if (icon) {
if (icon.startsWith("_PRJ_NAME/")) {
icon = icon.replace("_PRJ_NAME/", `../${this.props.context.adapterName}.${this.props.context.instance}/${this.props.context.projectName}/`);
}
const style = {
color
};
style.width = "auto";
style.height = 24;
return jsxRuntimeExports.jsx(__mf_15, {
style,
src: icon
}, "icon");
}
return null;
}
renderText(i, selectedIndex) {
const rxData = this.state.rxData;
if (rxData[`onlyIcon${i}`]) {
return null;
}
let text = rxData[`text${i}`];
let color = rxData[`color${i}`];
if (i === selectedIndex && rxData[`activeColor${i}`]) {
color = rxData[`activeColor${i}`];
}
text = text || rxData[`value${i}`];
return jsxRuntimeExports.jsx("span", {
style: {
color
},
children: text
});
}
renderButton(i, selectedIndex, buttonStyle) {
const rxData = this.state.rxData;
const icon = this.renderIcon(i, selectedIndex);
const text = this.renderText(i, selectedIndex);
const button = jsxRuntimeExports.jsx(__mf_16, {
disabled: this.props.editMode,
style: {
...buttonStyle,
flexGrow: 1
},
startIcon: text ? icon : void 0,
color: selectedIndex === i ? "primary" : "grey",
onClick: () => this.onClick(i),
children: text || icon
}, i);
if (rxData[`tooltip${i}`]) {
return jsxRuntimeExports.jsx(__mf_126, {
title: rxData[`tooltip${i}`],
slotProps: {
popper: {
sx: {
pointerEvents: "none"
}
}
},
children: button
}, i);
}
return button;
}
renderRadio(i, selectedIndex, buttonStyle) {
const rxData = this.state.rxData;
const icon = this.renderIcon(i, selectedIndex);
let text = this.renderText(i, selectedIndex);
if (icon && text) {
text = jsxRuntimeExports.jsxs("div", {
style: {
display: "flex",
gap: 4
},
children: [
icon,
text
]
});
}
const button = jsxRuntimeExports.jsx(__mf_43, {
style: buttonStyle,
control: jsxRuntimeExports.jsx(__mf_85$1, {
disabled: this.props.editMode,
onClick: () => this.onClick(i),
checked: selectedIndex === i
}),
labelPlacement: "end",
label: text || icon
}, i);
if (rxData[`tooltip${i}`]) {
return jsxRuntimeExports.jsx(__mf_126, {
title: rxData[`tooltip${i}`],
slotProps: {
popper: {
sx: {
pointerEvents: "none"
}
}
},
children: button
}, i);
}
return button;
}
renderMenuItem(i, selectedIndex, buttonStyle) {
const rxData = this.state.rxData;
const icon = this.renderIcon(i, selectedIndex);
let text = this.renderText(i, selectedIndex);
if (icon && text) {
text = jsxRuntimeExports.jsxs("div", {
style: {
display: "flex",
gap: 4
},
children: [
icon,
text
]
});
}
return jsxRuntimeExports.jsx(__mf_72, {
title: rxData[`tooltip${i}`],
disabled: this.props.editMode,
selected: selectedIndex === i,
style: buttonStyle,
value: rxData[`value${i}`],
onClick: rxData.open ? () => this.onClick(i) : void 0,
children: text || icon
}, i);
}
renderWidgetBody(props) {
var _a;
super.renderWidgetBody(props);
const selectedIndex = this.getSelectedIndex();
const rxData = this.state.rxData;
if (((_a = this.state.object) == null ? void 0 : _a._id) !== this.state.rxData.oid && this.state.object !== false) {
Object.assign(this.state, {
object: false
});
setTimeout(async () => {
var _a2;
if (this.state.rxData.oid && this.state.rxData.oid !== "nothing_selected") {
const obj = await this.props.context.socket.getObject(this.state.rxData.oid);
if ((_a2 = obj == null ? void 0 : obj.common) == null ? void 0 : _a2.type) {
this.setState({
object: {
_id: obj._id,
common: {
type: obj.common.type
},
type: "state",
native: {}
}
});
return;
}
}
this.setState({
object: {
_id: this.state.rxData.oid,
common: {
type: "string"
},
type: "state",
native: {}
}
});
}, 0);
}
const buttonStyle = {};
Object.keys(this.state.rxStyle).forEach((attr) => {
const value = rxData[attr];
if (value !== null && value !== void 0 && VisRxWidget.POSSIBLE_MUI_STYLES.includes(attr)) {
attr = attr.replace(/(-\w)/g, (text) => text[1].toUpperCase());
buttonStyle[attr] = value;
}
});
buttonStyle.minWidth = "unset";
if (buttonStyle.borderWidth) {
buttonStyle.borderWidth = VisBaseWidget.correctStylePxValue(buttonStyle.borderWidth);
}
if (buttonStyle.fontSize) {
buttonStyle.fontSize = VisBaseWidget.correctStylePxValue(buttonStyle.fontSize);
}
let content;
if ((!this.state.rxData.count || this.state.rxData.count === 1 && !rxData.text0 && !rxData.icon0 && !rxData.image0) && (!this.state.rxData.oid || this.state.rxData.oid === "nothing_selected")) {
content = jsxRuntimeExports.jsx(__mf_16, {
variant: "outlined",
style: {
width: "100%",
height: "100%"
},
children: __mf_2.t("Select object ID")
});
} else if (!this.state.rxData.count) {
content = jsxRuntimeExports.jsx(__mf_16, {
variant: "outlined",
style: {
width: "100%",
height: "100%"
},
children: __mf_2.t("Please define states")
});
} else if (this.state.rxData.type === "radio") {
const buttons = [];
for (let i = 1; i <= this.state.rxData.count; i++) {
buttons.push(this.renderRadio(i, selectedIndex, buttonStyle));
}
content = jsxRuntimeExports.jsx(__mf_86, {
style: {
width: "100%",
height: "100%"
},
children: buttons
});
} else if (this.state.rxData.type === "select") {
const buttons = [];
for (let i = 1; i <= this.state.rxData.count; i++) {
buttons.push(this.renderMenuItem(i, selectedIndex, buttonStyle));
}
let variant = "standard";
if (this.state.rxData.variant === "contained") {
variant = "filled";
} else if (this.state.rxData.variant === "outlined") {
variant = "outlined";
}
if (this.state.rxData.open) {
content = jsxRuntimeExports.jsx(__mf_63, {
style: {
width: "100%",
height: "100%"
},
children: buttons
});
} else {
content = jsxRuntimeExports.jsx(__mf_89, {
disabled: this.props.editMode,
style: {
width: "100%",
height: "100%"
},
value: this.state.value === void 0 ? "" : this.state.value,
onChange: (e) => this.onClick(this.getSelectedIndex(e.target.value)),
variant,
sx: {
"& .MuiSelect-select": variant === "filled" ? {
mb: "10px"
} : void 0
},
children: buttons
});
}
} else if (this.state.rxData.type === "slider") {
props.style.overflow = "visible";
const marks = [];
for (let i = 1; i <= this.state.rxData.count; i++) {
marks.push({
value: parseFloat(rxData[`value${i}`]) || 0,
label: rxData[`text${i}`] || 0
});
}
content = jsxRuntimeExports.jsx(__mf_92, {
disabled: this.props.editMode,
style: !this.state.rxData.orientation || this.state.rxData.orientation === "horizontal" ? {
marginLeft: 20,
marginRight: 20,
width: "calc(100% - 40px)"
} : {
marginTop: 10,
marginBottom: 10
},
value: parseFloat(this.state.value) || 0,
valueLabelDisplay: "auto",
min: marks[0].value,
max: marks[marks.length - 1].value,
orientation: this.state.rxData.orientation || "horizontal",
marks,
onChangeCommitted: (_e, value) => this.onClick(value, true),
onChange: (_e, value) => this.onClick(value)
});
} else {
const buttons = [];
for (let i = 1; i <= this.state.rxData.count; i++) {
buttons.push(this.renderButton(i, selectedIndex, buttonStyle));
}
content = jsxRuntimeExports.jsx(__mf_18, {
disabled: this.props.editMode,
style: {
width: "100%",
height: "100%"
},
orientation: this.state.rxData.orientation || "horizontal",
variant: this.state.rxData.variant === void 0 ? "contained" : this.state.rxData.variant === "standard" ? "text" : this.state.rxData.variant,
children: buttons
});
}
if (this.state.rxData.widgetTitle) {
content = jsxRuntimeExports.jsxs(__mf_42, {
fullWidth: true,
variant: this.state.rxData.variant === void 0 || this.state.rxData.variant === "text" ? "standard" : this.state.rxData.variant === "contained" ? "filled" : this.state.rxData.variant,
style: {
marginTop: this.state.rxData.type === "select" && this.state.rxData.variant === "outlined" ? 5 : void 0,
width: "100%",
height: this.state.rxData.type === "select" && this.state.rxData.variant === "outlined" ? "calc(100% - 5px)" : "100%"
},
children: [
this.state.rxData.type === "select" ? jsxRuntimeExports.jsx(__mf_60, {
children: this.state.rxData.widgetTitle
}) : jsxRuntimeExports.jsx(__mf_46, {
style: this.state.rxData.type === "slider" ? {
marginLeft: 10
} : void 0,
children: this.state.rxData.widgetTitle
}),
content
]
});
}
return jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
children: content
});
}
}
class JQuiRadioList extends JQuiState {
static getWidgetInfo() {
const widgetInfo = JQuiState.getWidgetInfo();
const newWidgetInfo = {
id: "tplJquiRadioList",
visSet: "jqui",
visName: "Radiobuttons ValueList",
visWidgetLabel: "jqui_radio_list",
visPrev: "widgets/jqui/img/Prev_RadioList.png",
visOrder: 15,
visAttrs: widgetInfo.visAttrs,
visDefaultStyle: {
width: 250,
height: 45
}
};
const type = JQuiState.findField(newWidgetInfo, "type");
type.default = "radio";
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_state_note"
});
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiRadioList.getWidgetInfo();
}
}
class JQuiSelectList extends JQuiState {
static getWidgetInfo() {
const widgetInfo = JQuiState.getWidgetInfo();
const newWidgetInfo = {
id: "tplJquiSelectList",
visSet: "jqui",
visName: "Select ValueList",
visWidgetLabel: "jqui_select_list",
visPrev: "widgets/jqui/img/Prev_SelectList.png",
visOrder: 16,
visAttrs: widgetInfo.visAttrs,
visDefaultStyle: {
width: 250,
height: 45
}
};
const type = JQuiState.findField(newWidgetInfo, "type");
type.default = "select";
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_state_note"
});
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiSelectList.getWidgetInfo();
}
}
class JQuiIconStatePushButton extends JQuiBinaryState {
static getWidgetInfo() {
const widgetInfo = JQuiBinaryState.getWidgetInfo();
const newWidgetInfo = {
id: "tplIconStatePushButton",
visSet: "jqui",
visName: "Binary Icon Push Button",
visWidgetLabel: "jqui_icon_state_push_button",
visPrev: "widgets/jqui/img/Prev_IconPushButton.png",
visOrder: 15,
visAttrs: widgetInfo.visAttrs,
visDefaultStyle: {
width: 70,
height: 30
}
};
const pushMode = JQuiBinaryState.findField(newWidgetInfo, "pushMode");
if (pushMode) {
pushMode.default = true;
}
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_button_binary_control_note"
});
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiIconStatePushButton.getWidgetInfo();
}
}
class JQuiIconStateBool extends JQuiBinaryState {
static getWidgetInfo() {
const widgetInfo = JQuiBinaryState.getWidgetInfo();
const newWidgetInfo = {
id: "tplIconStateBool",
visSet: "jqui",
visName: "Binary Icon State",
visWidgetLabel: "jqui_icon_state_bool",
visPrev: "widgets/jqui/img/Prev_IconStateBool.png",
visOrder: 15,
visAttrs: widgetInfo.visAttrs,
visDefaultStyle: {
width: 70,
height: 30
}
};
const iconFalse = JQuiBinaryState.findField(newWidgetInfo, "icon_false");
if (iconFalse) {
iconFalse.default = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBmaWxsPSJjdXJyZW50Q29sb3IiIGQ9Ik05IDIxYzAgLjUuNCAxIDEgMWg0Yy42IDAgMS0uNSAxLTF2LTFIOXYxem0zLTE5QzguMSAyIDUgNS4xIDUgOWMwIDIuNCAxLjIgNC41IDMgNS43VjE3YzAgLjUuNCAxIDEgMWg2Yy42IDAgMS0uNSAxLTF2LTIuM2MxLjgtMS4zIDMtMy40IDMtNS43YzAtMy45LTMuMS03LTctN3oiLz48L3N2Zz4=";
}
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_button_binary_control_note"
});
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiIconStateBool.getWidgetInfo();
}
}
class JQuiRadioSteps extends JQuiState {
static getWidgetInfo() {
const widgetInfo = JQuiState.getWidgetInfo();
const newWidgetInfo = {
id: "tplJquiRadioSteps",
visSet: "jqui",
visName: "Radiobuttons 25%",
visWidgetLabel: "jqui_radio_steps",
visPrev: "widgets/jqui/img/Prev_RadioSteps.png",
visOrder: 25,
visAttrs: widgetInfo.visAttrs,
visDefaultStyle: {
width: 350,
height: 35
}
};
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_state_note"
});
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiRadioSteps.getWidgetInfo();
}
}
class JQuiSlider extends VisRxWidget {
controlTimeout = null;
lastChanged = 0;
constructor(props) {
super(props);
Object.assign(this.state, {
value: "",
valueMax: null
});
}
static getWidgetInfo() {
return {
id: "tplJquiSlider",
visSet: "jqui",
visName: "Slider",
visWidgetLabel: "jqui_slider",
visPrev: "widgets/jqui/img/Prev_Slider.png",
visOrder: 24,
visAttrs: [
{
name: "common",
fields: [
{
name: "type",
label: "jqui_type",
type: "select",
options: [
{
value: "single",
label: "jqui_single"
},
{
value: "range",
label: "jqui_range"
}
]
},
{
name: "oid",
type: "id",
onChange: async (_field, data, changeData, socket) => {
var _a, _b, _c, _d, _e, _f, _g;
if (data.oid && data.oid !== "nothing_selected") {
const obj = await socket.getObject(data.oid);
let changed = false;
if (((_a = obj == null ? void 0 : obj.common) == null ? void 0 : _a.min) !== void 0 && ((_b = obj == null ? void 0 : obj.common) == null ? void 0 : _b.min) !== null) {
if (data.min !== obj.common.min) {
data.min = obj.common.min;
changed = true;
}
if (data.text !== obj.common.min.toString() + (obj.common.unit || "")) {
data.text = obj.common.min.toString() + (obj.common.unit || "");
changed = true;
}
}
if (((_c = obj == null ? void 0 : obj.common) == null ? void 0 : _c.max) !== void 0 && ((_d = obj == null ? void 0 : obj.common) == null ? void 0 : _d.max) !== null) {
if (data.max !== obj.common.max) {
data.max = obj.common.max;
changed = true;
}
if (data["text-2"] !== obj.common.max.toString() + (obj.common.unit || "")) {
data["text-2"] = obj.common.max.toString() + (obj.common.unit || "");
changed = true;
}
}
if ((_e = obj == null ? void 0 : obj.common) == null ? void 0 : _e.unit) {
if (data.unit !== obj.common.unit) {
data.unit = obj.common.unit;
changed = true;
}
}
if (!data.step) {
if (((_f = obj == null ? void 0 : obj.common) == null ? void 0 : _f.step) !== void 0 && ((_g = obj == null ? void 0 : obj.common) == null ? void 0 : _g.step) !== null) {
if (data.step !== obj.common.step) {
data.step = obj.common.step;
changed = true;
}
}
}
changed && changeData(data);
}
}
},
{
name: "click_id",
type: "id",
noSubscribe: true
},
{
name: "inverted",
type: "checkbox",
label: "jqui_inverted"
},
{
name: "min",
type: "number",
label: "jqui_min"
},
{
name: "max",
type: "number",
label: "jqui_max"
},
{
name: "min_distance",
type: "number",
hidden: (data) => data.type !== "range"
},
{
name: "shift_min_distance",
type: "checkbox",
hidden: (data) => data.type !== "range" || !data.min_distance
},
{
name: "step",
type: "number",
min: 0
},
{
name: "unit"
},
{
name: "timeout",
label: "jqui_set_timeout",
type: "number"
},
{
name: "oid-working",
label: "jqui_oid_working",
type: "id"
}
]
},
{
name: "second",
hidden: (data) => data.type !== "range",
fields: [
{
name: "inverted-2",
type: "checkbox",
label: "jqui_inverted"
},
{
name: "oid-2",
type: "id",
hidden: (data) => data.type !== "range"
},
{
name: "click_id-2",
type: "id",
noSubscribe: true,
hidden: (data) => !data["oid-2"] || data.type !== "range"
}
]
},
{
name: "style",
fields: [
{
name: "widgetTitle",
label: "jqui_name",
type: "text"
},
{
name: "orientation",
label: "orientation",
type: "select",
options: [
"horizontal",
"vertical"
],
default: "horizontal"
},
{
name: "text",
label: "jqui_text",
hidden: (data) => !!data.icon || !!data.image
},
{
name: "text-2",
label: "jqui_text_max",
hidden: (data) => !!data["icon-2"] || !!data["image-2"]
},
{
name: "image",
label: "jqui_image",
type: "image",
hidden: (data) => !!data.icon || !!data.text
},
{
name: "icon",
label: "jqui_icon",
type: "icon64",
hidden: (data) => !!data.image || !!data.text
},
{
name: "image-2",
label: "jqui_image_max",
type: "image",
hidden: (data) => !!data["icon-2"] || !!data["text-2"]
},
{
name: "icon-2",
label: "jqui_icon_max",
type: "icon64",
hidden: (data) => !!data["image-2"] || !!data["text-2"]
},
{
name: "valueLabelDisplay",
type: "select",
label: "jqui_value_label_display",
options: [
{
value: "auto",
label: "jqui_auto"
},
{
value: "on",
label: "jqui_on"
},
{
value: "off",
label: "jqui_off"
}
]
}
]
}
],
visDefaultStyle: {
width: 300,
height: 40
}
};
}
async componentDidMount() {
super.componentDidMount();
if (this.state.rxData.oid && this.state.rxData.oid !== "nothing_selected") {
try {
const state = await this.props.context.socket.getState(this.state.rxData.oid);
this.onStateUpdated(this.state.rxData.oid, state);
} catch (error) {
console.error(`Cannot get state ${this.state.rxData.oid}: ${error}`);
}
}
if (this.state.rxData.type === "range" && this.state.rxData["oid-2"] && this.state.rxData["oid-2"] !== "nothing_selected") {
try {
const state = await this.props.context.socket.getState(this.state.rxData["oid-2"]);
this.onStateUpdated(this.state.rxData["oid-2"], state);
} catch (error) {
console.error(`Cannot get state ${this.state.rxData.oid}: ${error}`);
}
}
}
componentWillUnmount() {
super.componentWillUnmount();
if (this.controlTimeout) {
clearTimeout(this.controlTimeout);
this.controlTimeout = null;
}
}
static findField(widgetInfo, name) {
return VisRxWidget.findField(widgetInfo, name);
}
getWidgetInfo() {
return JQuiSlider.getWidgetInfo();
}
onStateUpdated(id, state) {
if (id === this.state.rxData.oid && state) {
let value = parseFloat(state.val === null || state.val === void 0 ? "0" : state.val) || 0;
if (this.state.rxData.inverted) {
value = parseFloat(this.state.rxData.max) - value + parseFloat(this.state.rxData.min);
}
if (this.state.value !== value.toString()) {
this.setState({
value: value.toString()
});
}
} else if (id === this.state.rxData["oid-2"] && state) {
let value = parseFloat(state.val === null || state.val === void 0 ? "0" : state.val) || 0;
if (this.state.rxData["inverted-2"]) {
value = parseFloat(this.state.rxData.max) - value + parseFloat(this.state.rxData.min);
}
if (this.state.valueMax !== value) {
this.setState({
valueMax: value
});
}
}
}
getControlOid(isMax) {
if (isMax) {
if (this.state.rxData["click_id-2"] && this.state.rxData["click_id-2"] !== "nothing_selected") {
return this.state.rxData["click_id-2"];
}
if (this.state.rxData["oid-2"] && this.state.rxData["oid-2"] !== "nothing_selected") {
return this.state.rxData["oid-2"];
}
} else {
if (this.state.rxData.click_id && this.state.rxData.click_id !== "nothing_selected") {
return this.state.rxData.click_id;
}
if (this.state.rxData.oid && this.state.rxData.oid !== "nothing_selected") {
return this.state.rxData.oid;
}
}
return "";
}
onChange(value, isMax, immediate) {
if (this.props.editMode) {
return;
}
this.newState = this.newState || {};
const minDistance = isMax || this.state.rxData.type === "range" ? parseFloat(this.state.rxData.min_distance) || 0 : 0;
let valueMax;
let _value;
if (isMax) {
if (Array.isArray(value)) {
console.log(`Set ${value[0]} - ${value[1]}`);
_value = value[0];
valueMax = value[1];
if (minDistance) {
if (this.lastChanged === 2) {
if (this.state.rxData.shift_min_distance) {
valueMax = Math.max(valueMax, parseFloat(this.state.rxData.min) + minDistance);
if (valueMax - minDistance < _value) {
_value = valueMax - minDistance;
}
} else {
valueMax = Math.max(valueMax, parseFloat(this.state.value) + minDistance);
}
} else if (this.state.rxData.shift_min_distance) {
_value = Math.min(_value, parseFloat(this.state.rxData.max) - minDistance);
valueMax = this.state.valueMax;
if (valueMax - minDistance < _value) {
valueMax = _value + minDistance;
}
} else {
_value = Math.min(_value, this.state.valueMax - minDistance);
}
}
console.log(`Set ${_value} - ${valueMax}`);
} else {
this.lastChanged = 2;
valueMax = value;
if (minDistance) {
if (this.state.rxData.shift_min_distance) {
valueMax = Math.max(valueMax, parseFloat(this.state.rxData.min) + minDistance);
_value = parseFloat(this.state.value);
if (valueMax - minDistance < _value) {
_value = valueMax - minDistance;
}
} else {
valueMax = Math.max(value, parseFloat(this.state.value) + minDistance);
}
}
console.log(`Set (${_value || this.state.value}) - ${valueMax}`);
}
} else {
this.lastChanged = 1;
_value = value;
if (minDistance) {
if (this.state.rxData.shift_min_distance) {
_value = Math.min(_value, parseFloat(this.state.rxData.max) - minDistance);
valueMax = this.state.valueMax;
if (valueMax - minDistance < _value) {
valueMax = _value + minDistance;
}
} else {
_value = Math.min(_value, this.state.valueMax - minDistance);
}
}
console.log(`Set ${_value} - (${valueMax || this.state.valueMax})`);
}
this.newState.valueMax = valueMax;
this.newState.value = _value.toString();
if (this.controlTimeout) {
clearTimeout(this.controlTimeout);
}
this.controlTimeout = setTimeout(() => {
this.controlTimeout = null;
const newState = this.newState;
this.newState = null;
if (!newState) {
console.error("This can't be true!");
return;
}
if (newState.value !== void 0) {
const oid = this.getControlOid();
if (oid) {
let val = parseFloat(newState.value);
if (this.state.rxData.inverted) {
val = parseFloat(this.state.rxData.max) - val + parseFloat(this.state.rxData.min);
}
if (this.state.values[`${this.state.rxData.oid}.val`] !== val) {
this.props.context.setValue(oid, val);
}
}
}
if (newState.valueMax !== void 0) {
const oidMax = this.getControlOid(true);
if (oidMax) {
let val = newState.valueMax;
if (this.state.rxData["inverted-2"]) {
val = parseFloat(this.state.rxData.max) - val + parseFloat(this.state.rxData.min);
}
if (this.state.values[`${this.state.rxData["oid-2"]}.val`] !== val) {
this.props.context.setValue(oidMax, val);
}
}
}
}, immediate ? 0 : parseInt(this.state.rxData.timeout, 10) || 300);
this.setState(this.newState);
}
renderIcon(isMax) {
let icon;
if (isMax) {
icon = this.state.rxData["icon-2"] || this.state.rxData["image-2"];
} else {
icon = this.state.rxData.icon || this.state.rxData.image;
}
if (icon) {
if (icon && icon.startsWith("_PRJ_NAME/")) {
icon = icon.replace("_PRJ_NAME/", `../${this.props.context.adapterName}.${this.props.context.instance}/${this.props.context.projectName}/`);
}
return jsxRuntimeExports.jsx(__mf_15, {
src: icon
});
}
return null;
}
renderText(isMax) {
return isMax ? this.state.rxData["text-2"] : this.state.rxData.text;
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
props.style.overflow = "visible";
const step = this.state.rxData.step === void 0 || this.state.rxData.step === null ? 0 : parseFloat(this.state.rxData.step);
let content;
if (this.state.rxData.type === "range") {
content = jsxRuntimeExports.jsx(__mf_92, {
valueLabelFormat: (value) => value + (this.state.rxData.unit || ""),
value: [
parseFloat(this.state.value) || 0,
this.state.valueMax || 0
],
valueLabelDisplay: this.state.rxData.valueLabelDisplay || "auto",
min: parseFloat(this.state.rxData.min === void 0 || this.state.rxData.min === null ? "0" : this.state.rxData.min),
max: parseFloat(this.state.rxData.max === void 0 || this.state.rxData.max === null ? "100" : this.state.rxData.max),
orientation: this.state.rxData.orientation || "horizontal",
disabled: !!this.state.values[`${this.state.rxData["oid-working"]}.val`],
step: step === 0 ? void 0 : step,
disableSwap: this.state.rxData.type === "range" ? true : void 0,
marks: step === 0 ? void 0 : true,
onChangeCommitted: (_e, value) => this.onChange(value, true, true),
onChange: (_e, value, activeThumb) => this.onChange(value[activeThumb], !!activeThumb)
}, "control");
} else {
content = jsxRuntimeExports.jsx(__mf_92, {
valueLabelFormat: (value) => value + (this.state.rxData.unit || ""),
value: parseFloat(this.state.value) || 0,
valueLabelDisplay: this.state.rxData.valueLabelDisplay || "auto",
min: parseFloat(this.state.rxData.min === void 0 || this.state.rxData.min === null ? "0" : this.state.rxData.min),
max: parseFloat(this.state.rxData.max === void 0 || this.state.rxData.max === null ? "100" : this.state.rxData.max),
disabled: !!this.state.values[`${this.state.rxData["oid-working"]}.val`],
orientation: this.state.rxData.orientation || "horizontal",
step: step === 0 ? void 0 : step,
marks: step === 0 ? void 0 : true,
onChangeCommitted: (_e, value) => this.onChange(value, false, true),
onChange: (_e, value) => this.onChange(value)
}, "control2");
}
if (this.state.rxData.text || this.state.rxData["text-2"] || this.state.rxData.icon || this.state.rxData["icon-2"] || this.state.rxData.image || this.state.rxData["image-2"]) {
content = jsxRuntimeExports.jsxs(__mf_98, {
spacing: 1,
style: {
width: "100%",
height: "100%"
},
direction: this.state.rxData.orientation === "vertical" ? "column" : "row",
sx: {
mb: 1
},
alignItems: "center",
children: [
this.renderText(this.state.rxData.orientation === "vertical"),
this.renderIcon(this.state.rxData.orientation === "vertical"),
content,
this.renderIcon(this.state.rxData.orientation !== "vertical"),
this.renderText(this.state.rxData.orientation !== "vertical")
]
}, "stack");
}
if (this.state.rxData.widgetTitle) {
content = jsxRuntimeExports.jsxs(__mf_42, {
fullWidth: true,
style: {
width: "100%",
height: "100%"
},
children: [
jsxRuntimeExports.jsx(__mf_46, {
style: {
marginLeft: 10
},
children: this.state.rxData.widgetTitle
}),
content
]
}, "form");
}
if (this.state.rxData["oid-working"] && this.state.values[`${this.state.rxData["oid-working"]}.val`]) {
content = [
content,
jsxRuntimeExports.jsx(__mf_61, {
style: {
position: "absolute",
bottom: 0,
left: 0,
right: 0
}
}, "progress")
];
}
return jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
style: {
position: "relative"
},
children: content
});
}
}
class JQuiSliderVertical extends JQuiSlider {
static getWidgetInfo() {
const widgetInfo = JQuiSlider.getWidgetInfo();
const newWidgetInfo = {
id: "tplJquiSliderVertical",
visSet: "jqui",
visName: "Vertical slider ",
visWidgetLabel: "jqui_slider_vertical",
visPrev: "widgets/jqui/img/Prev_SliderVertical.png",
visOrder: 25,
visAttrs: widgetInfo.visAttrs,
visDefaultStyle: {
width: 40,
height: 300
}
};
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_slider_note"
});
const orientation = JQuiSlider.findField(newWidgetInfo, "orientation");
orientation.default = "vertical";
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiSliderVertical.getWidgetInfo();
}
}
var dayjs_min$1 = {
exports: {}
};
var dayjs_min = dayjs_min$1.exports;
var hasRequiredDayjs_min;
function requireDayjs_min() {
if (hasRequiredDayjs_min) return dayjs_min$1.exports;
hasRequiredDayjs_min = 1;
(function(module2, exports$1) {
!(function(t, e) {
module2.exports = e();
})(dayjs_min, (function() {
var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = {
name: "en",
weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
ordinal: function(t2) {
var e2 = [
"th",
"st",
"nd",
"rd"
], n2 = t2 % 100;
return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
}
}, m = function(t2, e2, n2) {
var r2 = String(t2);
return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
}, v = {
s: m,
z: function(t2) {
var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
},
m: function t2(e2, n2) {
if (e2.date() < n2.date()) return -t2(n2, e2);
var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
},
a: function(t2) {
return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
},
p: function(t2) {
return {
M: c,
y: h,
w: o,
d: a,
D: d,
h: u,
m: s,
s: i,
ms: r,
Q: f
}[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
},
u: function(t2) {
return void 0 === t2;
}
}, g = "en", D = {};
D[g] = M;
var p = "$isDayjsObject", S = function(t2) {
return t2 instanceof _ || !(!t2 || !t2[p]);
}, w = function t2(e2, n2, r2) {
var i2;
if (!e2) return g;
if ("string" == typeof e2) {
var s2 = e2.toLowerCase();
D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
var u2 = e2.split("-");
if (!i2 && u2.length > 1) return t2(u2[0]);
} else {
var a2 = e2.name;
D[a2] = e2, i2 = a2;
}
return !r2 && i2 && (g = i2), i2 || !r2 && g;
}, O = function(t2, e2) {
if (S(t2)) return t2.clone();
var n2 = "object" == typeof e2 ? e2 : {};
return n2.date = t2, n2.args = arguments, new _(n2);
}, b = v;
b.l = w, b.i = S, b.w = function(t2, e2) {
return O(t2, {
locale: e2.$L,
utc: e2.$u,
x: e2.$x,
$offset: e2.$offset
});
};
var _ = (function() {
function M2(t2) {
this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
}
var m2 = M2.prototype;
return m2.parse = function(t2) {
this.$d = (function(t3) {
var e2 = t3.date, n2 = t3.utc;
if (null === e2) return /* @__PURE__ */ new Date(NaN);
if (b.u(e2)) return /* @__PURE__ */ new Date();
if (e2 instanceof Date) return new Date(e2);
if ("string" == typeof e2 && !/Z$/i.test(e2)) {
var r2 = e2.match($);
if (r2) {
var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
}
}
return new Date(e2);
})(t2), this.init();
}, m2.init = function() {
var t2 = this.$d;
this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
}, m2.$utils = function() {
return b;
}, m2.isValid = function() {
return !(this.$d.toString() === l);
}, m2.isSame = function(t2, e2) {
var n2 = O(t2);
return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
}, m2.isAfter = function(t2, e2) {
return O(t2) < this.startOf(e2);
}, m2.isBefore = function(t2, e2) {
return this.endOf(e2) < O(t2);
}, m2.$g = function(t2, e2, n2) {
return b.u(t2) ? this[e2] : this.set(n2, t2);
}, m2.unix = function() {
return Math.floor(this.valueOf() / 1e3);
}, m2.valueOf = function() {
return this.$d.getTime();
}, m2.startOf = function(t2, e2) {
var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
return r2 ? i2 : i2.endOf(a);
}, $2 = function(t3, e3) {
return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [
0,
0,
0,
0
] : [
23,
59,
59,
999
]).slice(e3)), n2);
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
switch (f2) {
case h:
return r2 ? l2(1, 0) : l2(31, 11);
case c:
return r2 ? l2(1, M3) : l2(0, M3 + 1);
case o:
var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
case a:
case d:
return $2(v2 + "Hours", 0);
case u:
return $2(v2 + "Minutes", 1);
case s:
return $2(v2 + "Seconds", 2);
case i:
return $2(v2 + "Milliseconds", 3);
default:
return this.clone();
}
}, m2.endOf = function(t2) {
return this.startOf(t2, false);
}, m2.$set = function(t2, e2) {
var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
if (o2 === c || o2 === h) {
var y2 = this.clone().set(d, 1);
y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
} else l2 && this.$d[l2]($2);
return this.init(), this;
}, m2.set = function(t2, e2) {
return this.clone().$set(t2, e2);
}, m2.get = function(t2) {
return this[b.p(t2)]();
}, m2.add = function(r2, f2) {
var d2, l2 = this;
r2 = Number(r2);
var $2 = b.p(f2), y2 = function(t2) {
var e2 = O(l2);
return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
};
if ($2 === c) return this.set(c, this.$M + r2);
if ($2 === h) return this.set(h, this.$y + r2);
if ($2 === a) return y2(1);
if ($2 === o) return y2(7);
var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
return b.w(m3, this);
}, m2.subtract = function(t2, e2) {
return this.add(-1 * t2, e2);
}, m2.format = function(t2) {
var e2 = this, n2 = this.$locale();
if (!this.isValid()) return n2.invalidDate || l;
var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
}, d2 = function(t3) {
return b.s(s2 % 12 || 12, t3, "0");
}, $2 = f2 || function(t3, e3, n3) {
var r3 = t3 < 12 ? "AM" : "PM";
return n3 ? r3.toLowerCase() : r3;
};
return r2.replace(y, (function(t3, r3) {
return r3 || (function(t4) {
switch (t4) {
case "YY":
return String(e2.$y).slice(-2);
case "YYYY":
return b.s(e2.$y, 4, "0");
case "M":
return a2 + 1;
case "MM":
return b.s(a2 + 1, 2, "0");
case "MMM":
return h2(n2.monthsShort, a2, c2, 3);
case "MMMM":
return h2(c2, a2);
case "D":
return e2.$D;
case "DD":
return b.s(e2.$D, 2, "0");
case "d":
return String(e2.$W);
case "dd":
return h2(n2.weekdaysMin, e2.$W, o2, 2);
case "ddd":
return h2(n2.weekdaysShort, e2.$W, o2, 3);
case "dddd":
return o2[e2.$W];
case "H":
return String(s2);
case "HH":
return b.s(s2, 2, "0");
case "h":
return d2(1);
case "hh":
return d2(2);
case "a":
return $2(s2, u2, true);
case "A":
return $2(s2, u2, false);
case "m":
return String(u2);
case "mm":
return b.s(u2, 2, "0");
case "s":
return String(e2.$s);
case "ss":
return b.s(e2.$s, 2, "0");
case "SSS":
return b.s(e2.$ms, 3, "0");
case "Z":
return i2;
}
return null;
})(t3) || i2.replace(":", "");
}));
}, m2.utcOffset = function() {
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
}, m2.diff = function(r2, d2, l2) {
var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
return b.m(y2, m3);
};
switch (M3) {
case h:
$2 = D2() / 12;
break;
case c:
$2 = D2();
break;
case f:
$2 = D2() / 3;
break;
case o:
$2 = (g2 - v2) / 6048e5;
break;
case a:
$2 = (g2 - v2) / 864e5;
break;
case u:
$2 = g2 / n;
break;
case s:
$2 = g2 / e;
break;
case i:
$2 = g2 / t;
break;
default:
$2 = g2;
}
return l2 ? $2 : b.a($2);
}, m2.daysInMonth = function() {
return this.endOf(c).$D;
}, m2.$locale = function() {
return D[this.$L];
}, m2.locale = function(t2, e2) {
if (!t2) return this.$L;
var n2 = this.clone(), r2 = w(t2, e2, true);
return r2 && (n2.$L = r2), n2;
}, m2.clone = function() {
return b.w(this.$d, this);
}, m2.toDate = function() {
return new Date(this.valueOf());
}, m2.toJSON = function() {
return this.isValid() ? this.toISOString() : null;
}, m2.toISOString = function() {
return this.$d.toISOString();
}, m2.toString = function() {
return this.$d.toUTCString();
}, M2;
})(), k = _.prototype;
return O.prototype = k, [
[
"$ms",
r
],
[
"$s",
i
],
[
"$m",
s
],
[
"$H",
u
],
[
"$W",
a
],
[
"$M",
c
],
[
"$y",
h
],
[
"$D",
d
]
].forEach((function(t2) {
k[t2[1]] = function(e2) {
return this.$g(e2, t2[0], t2[1]);
};
})), O.extend = function(t2, e2) {
return t2.$i || (t2(e2, _, O), t2.$i = true), O;
}, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
return O(1e3 * t2);
}, O.en = D[g], O.Ls = D, O.p = {}, O;
}));
})(dayjs_min$1);
return dayjs_min$1.exports;
}
var dayjs_minExports = requireDayjs_min();
const dayjs = getDefaultExportFromCjs(dayjs_minExports);
const _excluded$F = [
"localeText"
];
const MuiPickersAdapterContext = __mf_10(null);
const LocalizationProvider = function LocalizationProvider2(inProps) {
const { localeText: inLocaleText } = inProps, otherInProps = _objectWithoutPropertiesLoose$1(inProps, _excluded$F);
const { utils: parentUtils, localeText: parentLocaleText } = __mf_21(MuiPickersAdapterContext) ?? {
utils: void 0,
localeText: void 0
};
const props = useThemeProps({
props: otherInProps,
name: "MuiLocalizationProvider"
});
const { children, dateAdapter: DateAdapter, dateFormats, dateLibInstance, adapterLocale, localeText: themeLocaleText } = props;
const localeText = __mf_29(() => _extends$1({}, themeLocaleText, parentLocaleText, inLocaleText), [
themeLocaleText,
parentLocaleText,
inLocaleText
]);
const utils = __mf_29(() => {
if (!DateAdapter) {
if (parentUtils) {
return parentUtils;
}
return null;
}
const adapter = new DateAdapter({
locale: adapterLocale,
formats: dateFormats,
instance: dateLibInstance
});
if (!adapter.isMUIAdapter) {
throw new Error([
"MUI X: The date adapter should be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`, not from `@date-io`",
"For example, `import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'` instead of `import AdapterDayjs from '@date-io/dayjs'`",
"More information on the installation documentation: https://mui.com/x/react-date-pickers/getting-started/#installation"
].join(`
`));
}
return adapter;
}, [
DateAdapter,
adapterLocale,
dateFormats,
dateLibInstance,
parentUtils
]);
const defaultDates = __mf_29(() => {
if (!utils) {
return null;
}
return {
minDate: utils.date("1900-01-01T00:00:00.000"),
maxDate: utils.date("2099-12-31T00:00:00.000")
};
}, [
utils
]);
const contextValue = __mf_29(() => {
return {
utils,
defaultDates,
localeText
};
}, [
defaultDates,
utils,
localeText
]);
return jsxRuntimeExports.jsx(MuiPickersAdapterContext.Provider, {
value: contextValue,
children
});
};
const getPickersLocalization = (pickersTranslations) => {
return {
components: {
MuiLocalizationProvider: {
defaultProps: {
localeText: _extends$1({}, pickersTranslations)
}
}
}
};
};
const buildGetOpenDialogAriaText = (params) => {
const { utils, formatKey, contextTranslation, propsTranslation } = params;
return (value) => {
const formattedValue = value !== null && utils.isValid(value) ? utils.format(value, formatKey) : null;
const translation = propsTranslation ?? contextTranslation;
return translation(value, utils, formattedValue);
};
};
const enUSPickers = {
previousMonth: "Previous month",
nextMonth: "Next month",
openPreviousView: "Open previous view",
openNextView: "Open next view",
calendarViewSwitchingButtonAriaLabel: (view) => view === "year" ? "year view is open, switch to calendar view" : "calendar view is open, switch to year view",
start: "Start",
end: "End",
startDate: "Start date",
startTime: "Start time",
endDate: "End date",
endTime: "End time",
cancelButtonLabel: "Cancel",
clearButtonLabel: "Clear",
okButtonLabel: "OK",
todayButtonLabel: "Today",
datePickerToolbarTitle: "Select date",
dateTimePickerToolbarTitle: "Select date & time",
timePickerToolbarTitle: "Select time",
dateRangePickerToolbarTitle: "Select date range",
clockLabelText: (view, time, utils, formattedTime) => `Select ${view}. ${!formattedTime && (time === null || !utils.isValid(time)) ? "No time selected" : `Selected time is ${formattedTime ?? utils.format(time, "fullTime")}`}`,
hoursClockNumberText: (hours2) => `${hours2} hours`,
minutesClockNumberText: (minutes2) => `${minutes2} minutes`,
secondsClockNumberText: (seconds2) => `${seconds2} seconds`,
selectViewText: (view) => `Select ${view}`,
calendarWeekNumberHeaderLabel: "Week number",
calendarWeekNumberHeaderText: "#",
calendarWeekNumberAriaLabelText: (weekNumber) => `Week ${weekNumber}`,
calendarWeekNumberText: (weekNumber) => `${weekNumber}`,
openDatePickerDialogue: (value, utils, formattedDate) => formattedDate || value !== null && utils.isValid(value) ? `Choose date, selected date is ${formattedDate ?? utils.format(value, "fullDate")}` : "Choose date",
openTimePickerDialogue: (value, utils, formattedTime) => formattedTime || value !== null && utils.isValid(value) ? `Choose time, selected time is ${formattedTime ?? utils.format(value, "fullTime")}` : "Choose time",
fieldClearLabel: "Clear",
timeTableLabel: "pick time",
dateTableLabel: "pick date",
fieldYearPlaceholder: (params) => "Y".repeat(params.digitAmount),
fieldMonthPlaceholder: (params) => params.contentType === "letter" ? "MMMM" : "MM",
fieldDayPlaceholder: () => "DD",
fieldWeekDayPlaceholder: (params) => params.contentType === "letter" ? "EEEE" : "EE",
fieldHoursPlaceholder: () => "hh",
fieldMinutesPlaceholder: () => "mm",
fieldSecondsPlaceholder: () => "ss",
fieldMeridiemPlaceholder: () => "aa",
year: "Year",
month: "Month",
day: "Day",
weekDay: "Week day",
hours: "Hours",
minutes: "Minutes",
seconds: "Seconds",
meridiem: "Meridiem",
empty: "Empty"
};
const DEFAULT_LOCALE = enUSPickers;
getPickersLocalization(enUSPickers);
const useLocalizationContext = () => {
const localization = __mf_21(MuiPickersAdapterContext);
if (localization === null) {
throw new Error([
"MUI X: Can not find the date and time pickers localization context.",
"It looks like you forgot to wrap your component in LocalizationProvider.",
"This can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package"
].join("\n"));
}
if (localization.utils === null) {
throw new Error([
"MUI X: Can not find the date and time pickers adapter from its localization context.",
"It looks like you forgot to pass a `dateAdapter` to your LocalizationProvider."
].join("\n"));
}
const localeText = __mf_29(() => _extends$1({}, DEFAULT_LOCALE, localization.localeText), [
localization.localeText
]);
return __mf_29(() => _extends$1({}, localization, {
localeText
}), [
localization,
localeText
]);
};
const useUtils = () => useLocalizationContext().utils;
const useDefaultDates = () => useLocalizationContext().defaultDates;
const useNow = (timezone) => {
const utils = useUtils();
const now2 = __mf_31(void 0);
if (now2.current === void 0) {
now2.current = utils.date(void 0, timezone);
}
return now2.current;
};
const usePickersTranslations = () => useLocalizationContext().localeText;
function hasClass(element, className) {
if (element.classList) return !!className && element.classList.contains(className);
return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
}
function addClass(element, className) {
if (element.classList) element.classList.add(className);
else if (!hasClass(element, className)) if (typeof element.className === "string") element.className = element.className + " " + className;
else element.setAttribute("class", (element.className && element.className.baseVal || "") + " " + className);
}
function replaceClassName(origClass, classToRemove) {
return origClass.replace(new RegExp("(^|\\s)" + classToRemove + "(?:\\s|$)", "g"), "$1").replace(/\s+/g, " ").replace(/^\s*|\s*$/g, "");
}
function removeClass$1(element, className) {
if (element.classList) {
element.classList.remove(className);
} else if (typeof element.className === "string") {
element.className = replaceClassName(element.className, className);
} else {
element.setAttribute("class", replaceClassName(element.className && element.className.baseVal || "", className));
}
}
var _addClass = function addClass$12(node, classes) {
return node && classes && classes.split(" ").forEach(function(c) {
return addClass(node, c);
});
};
var removeClass = function removeClass2(node, classes) {
return node && classes && classes.split(" ").forEach(function(c) {
return removeClass$1(node, c);
});
};
var CSSTransition = (function(_React$Component) {
_inheritsLoose(CSSTransition2, _React$Component);
function CSSTransition2() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [
this
].concat(args)) || this;
_this.appliedClasses = {
appear: {},
enter: {},
exit: {}
};
_this.onEnter = function(maybeNode, maybeAppearing) {
var _this$resolveArgument = _this.resolveArguments(maybeNode, maybeAppearing), node = _this$resolveArgument[0], appearing = _this$resolveArgument[1];
_this.removeClasses(node, "exit");
_this.addClass(node, appearing ? "appear" : "enter", "base");
if (_this.props.onEnter) {
_this.props.onEnter(maybeNode, maybeAppearing);
}
};
_this.onEntering = function(maybeNode, maybeAppearing) {
var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing), node = _this$resolveArgument2[0], appearing = _this$resolveArgument2[1];
var type = appearing ? "appear" : "enter";
_this.addClass(node, type, "active");
if (_this.props.onEntering) {
_this.props.onEntering(maybeNode, maybeAppearing);
}
};
_this.onEntered = function(maybeNode, maybeAppearing) {
var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing), node = _this$resolveArgument3[0], appearing = _this$resolveArgument3[1];
var type = appearing ? "appear" : "enter";
_this.removeClasses(node, type);
_this.addClass(node, type, "done");
if (_this.props.onEntered) {
_this.props.onEntered(maybeNode, maybeAppearing);
}
};
_this.onExit = function(maybeNode) {
var _this$resolveArgument4 = _this.resolveArguments(maybeNode), node = _this$resolveArgument4[0];
_this.removeClasses(node, "appear");
_this.removeClasses(node, "enter");
_this.addClass(node, "exit", "base");
if (_this.props.onExit) {
_this.props.onExit(maybeNode);
}
};
_this.onExiting = function(maybeNode) {
var _this$resolveArgument5 = _this.resolveArguments(maybeNode), node = _this$resolveArgument5[0];
_this.addClass(node, "exit", "active");
if (_this.props.onExiting) {
_this.props.onExiting(maybeNode);
}
};
_this.onExited = function(maybeNode) {
var _this$resolveArgument6 = _this.resolveArguments(maybeNode), node = _this$resolveArgument6[0];
_this.removeClasses(node, "exit");
_this.addClass(node, "exit", "done");
if (_this.props.onExited) {
_this.props.onExited(maybeNode);
}
};
_this.resolveArguments = function(maybeNode, maybeAppearing) {
return _this.props.nodeRef ? [
_this.props.nodeRef.current,
maybeNode
] : [
maybeNode,
maybeAppearing
];
};
_this.getClassNames = function(type) {
var classNames = _this.props.classNames;
var isStringClassNames = typeof classNames === "string";
var prefix = isStringClassNames && classNames ? classNames + "-" : "";
var baseClassName = isStringClassNames ? "" + prefix + type : classNames[type];
var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames[type + "Active"];
var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames[type + "Done"];
return {
baseClassName,
activeClassName,
doneClassName
};
};
return _this;
}
var _proto = CSSTransition2.prototype;
_proto.addClass = function addClass2(node, type, phase) {
var className = this.getClassNames(type)[phase + "ClassName"];
var _this$getClassNames = this.getClassNames("enter"), doneClassName = _this$getClassNames.doneClassName;
if (type === "appear" && phase === "done" && doneClassName) {
className += " " + doneClassName;
}
if (phase === "active") {
if (node) forceReflow(node);
}
if (className) {
this.appliedClasses[type][phase] = className;
_addClass(node, className);
}
};
_proto.removeClasses = function removeClasses(node, type) {
var _this$appliedClasses$ = this.appliedClasses[type], baseClassName = _this$appliedClasses$.base, activeClassName = _this$appliedClasses$.active, doneClassName = _this$appliedClasses$.done;
this.appliedClasses[type] = {};
if (baseClassName) {
removeClass(node, baseClassName);
}
if (activeClassName) {
removeClass(node, activeClassName);
}
if (doneClassName) {
removeClass(node, doneClassName);
}
};
_proto.render = function render() {
var _this$props = this.props;
_this$props.classNames;
var props = _objectWithoutPropertiesLoose$1(_this$props, [
"classNames"
]);
return React.createElement(Transition, _extends$1({}, props, {
onEnter: this.onEnter,
onEntered: this.onEntered,
onEntering: this.onEntering,
onExit: this.onExit,
onExiting: this.onExiting,
onExited: this.onExited
}));
};
return CSSTransition2;
})(React.Component);
CSSTransition.defaultProps = {
classNames: ""
};
CSSTransition.propTypes = {};
const ArrowDropDownIcon = createSvgIcon(jsxRuntimeExports.jsx("path", {
d: "M7 10l5 5 5-5z"
}), "ArrowDropDown");
const ArrowLeftIcon = createSvgIcon(jsxRuntimeExports.jsx("path", {
d: "M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"
}), "ArrowLeft");
const ArrowRightIcon = createSvgIcon(jsxRuntimeExports.jsx("path", {
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
}), "ArrowRight");
const CalendarIcon = createSvgIcon(jsxRuntimeExports.jsx("path", {
d: "M17 12h-5v5h5v-5zM16 1v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-1V1h-2zm3 18H5V8h14v11z"
}), "Calendar");
const ClockIcon = createSvgIcon(jsxRuntimeExports.jsxs(__mf_2$1, {
children: [
jsxRuntimeExports.jsx("path", {
d: "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
}),
jsxRuntimeExports.jsx("path", {
d: "M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"
})
]
}), "Clock");
createSvgIcon(jsxRuntimeExports.jsx("path", {
d: "M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z"
}), "DateRange");
createSvgIcon(jsxRuntimeExports.jsxs(__mf_2$1, {
children: [
jsxRuntimeExports.jsx("path", {
d: "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
}),
jsxRuntimeExports.jsx("path", {
d: "M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"
})
]
}), "Time");
const ClearIcon = createSvgIcon(jsxRuntimeExports.jsx("path", {
d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
}), "Clear");
function getPickersArrowSwitcherUtilityClass(slot) {
return generateUtilityClass("MuiPickersArrowSwitcher", slot);
}
generateUtilityClasses("MuiPickersArrowSwitcher", [
"root",
"spacer",
"button",
"previousIconButton",
"nextIconButton",
"leftArrowIcon",
"rightArrowIcon"
]);
const _excluded$E = [
"children",
"className",
"slots",
"slotProps",
"isNextDisabled",
"isNextHidden",
"onGoToNext",
"nextLabel",
"isPreviousDisabled",
"isPreviousHidden",
"onGoToPrevious",
"previousLabel",
"labelId"
], _excluded2$6 = [
"ownerState"
], _excluded3$2 = [
"ownerState"
];
const PickersArrowSwitcherRoot = styled("div", {
name: "MuiPickersArrowSwitcher",
slot: "Root",
overridesResolver: (props, styles2) => styles2.root
})({
display: "flex"
});
const PickersArrowSwitcherSpacer = styled("div", {
name: "MuiPickersArrowSwitcher",
slot: "Spacer",
overridesResolver: (props, styles2) => styles2.spacer
})(({ theme }) => ({
width: theme.spacing(3)
}));
const PickersArrowSwitcherButton = styled(IconButton, {
name: "MuiPickersArrowSwitcher",
slot: "Button",
overridesResolver: (props, styles2) => styles2.button
})({
variants: [
{
props: {
hidden: true
},
style: {
visibility: "hidden"
}
}
]
});
const useUtilityClasses$v = (ownerState) => {
const { classes } = ownerState;
const slots = {
root: [
"root"
],
spacer: [
"spacer"
],
button: [
"button"
],
previousIconButton: [
"previousIconButton"
],
nextIconButton: [
"nextIconButton"
],
leftArrowIcon: [
"leftArrowIcon"
],
rightArrowIcon: [
"rightArrowIcon"
]
};
return composeClasses(slots, getPickersArrowSwitcherUtilityClass, classes);
};
const PickersArrowSwitcher = __mf_14$1(function PickersArrowSwitcher2(inProps, ref) {
const isRtl = useRtl();
const props = useThemeProps({
props: inProps,
name: "MuiPickersArrowSwitcher"
});
const { children, className, slots, slotProps, isNextDisabled, isNextHidden, onGoToNext, nextLabel, isPreviousDisabled, isPreviousHidden, onGoToPrevious, previousLabel, labelId } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$E);
const ownerState = props;
const classes = useUtilityClasses$v(ownerState);
const nextProps = {
isDisabled: isNextDisabled,
isHidden: isNextHidden,
goTo: onGoToNext,
label: nextLabel
};
const previousProps = {
isDisabled: isPreviousDisabled,
isHidden: isPreviousHidden,
goTo: onGoToPrevious,
label: previousLabel
};
const PreviousIconButton = (slots == null ? void 0 : slots.previousIconButton) ?? PickersArrowSwitcherButton;
const previousIconButtonProps = useSlotProps({
elementType: PreviousIconButton,
externalSlotProps: slotProps == null ? void 0 : slotProps.previousIconButton,
additionalProps: {
size: "medium",
title: previousProps.label,
"aria-label": previousProps.label,
disabled: previousProps.isDisabled,
edge: "end",
onClick: previousProps.goTo
},
ownerState: _extends$1({}, ownerState, {
hidden: previousProps.isHidden
}),
className: clsx(classes.button, classes.previousIconButton)
});
const NextIconButton = (slots == null ? void 0 : slots.nextIconButton) ?? PickersArrowSwitcherButton;
const nextIconButtonProps = useSlotProps({
elementType: NextIconButton,
externalSlotProps: slotProps == null ? void 0 : slotProps.nextIconButton,
additionalProps: {
size: "medium",
title: nextProps.label,
"aria-label": nextProps.label,
disabled: nextProps.isDisabled,
edge: "start",
onClick: nextProps.goTo
},
ownerState: _extends$1({}, ownerState, {
hidden: nextProps.isHidden
}),
className: clsx(classes.button, classes.nextIconButton)
});
const LeftArrowIcon = (slots == null ? void 0 : slots.leftArrowIcon) ?? ArrowLeftIcon;
const _useSlotProps = useSlotProps({
elementType: LeftArrowIcon,
externalSlotProps: slotProps == null ? void 0 : slotProps.leftArrowIcon,
additionalProps: {
fontSize: "inherit"
},
ownerState,
className: classes.leftArrowIcon
}), leftArrowIconProps = _objectWithoutPropertiesLoose$1(_useSlotProps, _excluded2$6);
const RightArrowIcon = (slots == null ? void 0 : slots.rightArrowIcon) ?? ArrowRightIcon;
const _useSlotProps2 = useSlotProps({
elementType: RightArrowIcon,
externalSlotProps: slotProps == null ? void 0 : slotProps.rightArrowIcon,
additionalProps: {
fontSize: "inherit"
},
ownerState,
className: classes.rightArrowIcon
}), rightArrowIconProps = _objectWithoutPropertiesLoose$1(_useSlotProps2, _excluded3$2);
return jsxRuntimeExports.jsxs(PickersArrowSwitcherRoot, _extends$1({
ref,
className: clsx(classes.root, className),
ownerState
}, other, {
children: [
jsxRuntimeExports.jsx(PreviousIconButton, _extends$1({}, previousIconButtonProps, {
children: isRtl ? jsxRuntimeExports.jsx(RightArrowIcon, _extends$1({}, rightArrowIconProps)) : jsxRuntimeExports.jsx(LeftArrowIcon, _extends$1({}, leftArrowIconProps))
})),
children ? jsxRuntimeExports.jsx(Typography, {
variant: "subtitle1",
component: "span",
id: labelId,
children
}) : jsxRuntimeExports.jsx(PickersArrowSwitcherSpacer, {
className: classes.spacer,
ownerState
}),
jsxRuntimeExports.jsx(NextIconButton, _extends$1({}, nextIconButtonProps, {
children: isRtl ? jsxRuntimeExports.jsx(LeftArrowIcon, _extends$1({}, leftArrowIconProps)) : jsxRuntimeExports.jsx(RightArrowIcon, _extends$1({}, rightArrowIconProps))
}))
]
}));
});
const areViewsEqual = (views, expectedViews) => {
if (views.length !== expectedViews.length) {
return false;
}
return expectedViews.every((expectedView) => views.includes(expectedView));
};
const applyDefaultViewProps = ({ openTo, defaultOpenTo, views, defaultViews }) => {
const viewsWithDefault = views ?? defaultViews;
let openToWithDefault;
if (openTo != null) {
openToWithDefault = openTo;
} else if (viewsWithDefault.includes(defaultOpenTo)) {
openToWithDefault = defaultOpenTo;
} else if (viewsWithDefault.length > 0) {
openToWithDefault = viewsWithDefault[0];
} else {
throw new Error("MUI X: The `views` prop must contain at least one view.");
}
return {
views: viewsWithDefault,
openTo: openToWithDefault
};
};
const timeViews = [
"hours",
"minutes",
"seconds"
];
const isTimeView = (view) => timeViews.includes(view);
const isInternalTimeView = (view) => timeViews.includes(view) || view === "meridiem";
const getMeridiem = (date, utils) => {
if (!date) {
return null;
}
return utils.getHours(date) >= 12 ? "pm" : "am";
};
const convertValueToMeridiem = (value, meridiem2, ampm) => {
if (ampm) {
const currentMeridiem = value >= 12 ? "pm" : "am";
if (currentMeridiem !== meridiem2) {
return meridiem2 === "am" ? value - 12 : value + 12;
}
}
return value;
};
const convertToMeridiem = (time, meridiem2, ampm, utils) => {
const newHoursAmount = convertValueToMeridiem(utils.getHours(time), meridiem2, ampm);
return utils.setHours(time, newHoursAmount);
};
const getSecondsInDay = (date, utils) => {
return utils.getHours(date) * 3600 + utils.getMinutes(date) * 60 + utils.getSeconds(date);
};
const createIsAfterIgnoreDatePart = (disableIgnoringDatePartForTimeValidation, utils) => (dateLeft, dateRight) => {
if (disableIgnoringDatePartForTimeValidation) {
return utils.isAfter(dateLeft, dateRight);
}
return getSecondsInDay(dateLeft, utils) > getSecondsInDay(dateRight, utils);
};
const resolveTimeFormat = (utils, { format: format2, views, ampm }) => {
if (format2 != null) {
return format2;
}
const formats = utils.formats;
if (areViewsEqual(views, [
"hours"
])) {
return ampm ? `${formats.hours12h} ${formats.meridiem}` : formats.hours24h;
}
if (areViewsEqual(views, [
"minutes"
])) {
return formats.minutes;
}
if (areViewsEqual(views, [
"seconds"
])) {
return formats.seconds;
}
if (areViewsEqual(views, [
"minutes",
"seconds"
])) {
return `${formats.minutes}:${formats.seconds}`;
}
if (areViewsEqual(views, [
"hours",
"minutes",
"seconds"
])) {
return ampm ? `${formats.hours12h}:${formats.minutes}:${formats.seconds} ${formats.meridiem}` : `${formats.hours24h}:${formats.minutes}:${formats.seconds}`;
}
return ampm ? `${formats.hours12h}:${formats.minutes} ${formats.meridiem}` : `${formats.hours24h}:${formats.minutes}`;
};
function useViews({ onChange, onViewChange, openTo, view: inView, views, autoFocus, focusedView: inFocusedView, onFocusedViewChange }) {
const previousOpenTo = __mf_31(openTo);
const previousViews = __mf_31(views);
const defaultView = __mf_31(views.includes(openTo) ? openTo : views[0]);
const [view, setView] = useControlled({
name: "useViews",
state: "view",
controlled: inView,
default: defaultView.current
});
const defaultFocusedView = __mf_31(autoFocus ? view : null);
const [focusedView, setFocusedView] = useControlled({
name: "useViews",
state: "focusedView",
controlled: inFocusedView,
default: defaultFocusedView.current
});
__mf_24(() => {
if (previousOpenTo.current && previousOpenTo.current !== openTo || previousViews.current && previousViews.current.some((previousView2) => !views.includes(previousView2))) {
setView(views.includes(openTo) ? openTo : views[0]);
previousViews.current = views;
previousOpenTo.current = openTo;
}
}, [
openTo,
setView,
view,
views
]);
const viewIndex = views.indexOf(view);
const previousView = views[viewIndex - 1] ?? null;
const nextView = views[viewIndex + 1] ?? null;
const handleFocusedViewChange = useEventCallback((viewToFocus, hasFocus) => {
if (hasFocus) {
setFocusedView(viewToFocus);
} else {
setFocusedView((prevFocusedView) => viewToFocus === prevFocusedView ? null : prevFocusedView);
}
onFocusedViewChange == null ? void 0 : onFocusedViewChange(viewToFocus, hasFocus);
});
const handleChangeView = useEventCallback((newView) => {
handleFocusedViewChange(newView, true);
if (newView === view) {
return;
}
setView(newView);
if (onViewChange) {
onViewChange(newView);
}
});
const goToNextView = useEventCallback(() => {
if (nextView) {
handleChangeView(nextView);
}
});
const setValueAndGoToNextView = useEventCallback((value, currentViewSelectionState, selectedView) => {
const isSelectionFinishedOnCurrentView = currentViewSelectionState === "finish";
const hasMoreViews = selectedView ? views.indexOf(selectedView) < views.length - 1 : Boolean(nextView);
const globalSelectionState = isSelectionFinishedOnCurrentView && hasMoreViews ? "partial" : currentViewSelectionState;
onChange(value, globalSelectionState, selectedView);
if (selectedView && selectedView !== view) {
const nextViewAfterSelected = views[views.indexOf(selectedView) + 1];
if (nextViewAfterSelected) {
handleChangeView(nextViewAfterSelected);
}
} else if (isSelectionFinishedOnCurrentView) {
goToNextView();
}
});
return {
view,
setView: handleChangeView,
focusedView,
setFocusedView: handleFocusedViewChange,
nextView,
previousView,
defaultView: views.includes(openTo) ? openTo : views[0],
goToNextView,
setValueAndGoToNextView
};
}
function useNextMonthDisabled(month, { disableFuture, maxDate, timezone }) {
const utils = useUtils();
return __mf_29(() => {
const now2 = utils.date(void 0, timezone);
const lastEnabledMonth = utils.startOfMonth(disableFuture && utils.isBefore(now2, maxDate) ? now2 : maxDate);
return !utils.isAfter(lastEnabledMonth, month);
}, [
disableFuture,
maxDate,
month,
utils,
timezone
]);
}
function usePreviousMonthDisabled(month, { disablePast, minDate, timezone }) {
const utils = useUtils();
return __mf_29(() => {
const now2 = utils.date(void 0, timezone);
const firstEnabledMonth = utils.startOfMonth(disablePast && utils.isAfter(now2, minDate) ? now2 : minDate);
return !utils.isBefore(firstEnabledMonth, month);
}, [
disablePast,
minDate,
month,
utils,
timezone
]);
}
function useMeridiemMode(date, ampm, onChange, selectionState) {
const utils = useUtils();
const meridiemMode = getMeridiem(date, utils);
const handleMeridiemChange = __mf_20((mode) => {
const timeWithMeridiem = date == null ? null : convertToMeridiem(date, mode, Boolean(ampm), utils);
onChange(timeWithMeridiem, selectionState ?? "partial");
}, [
ampm,
date,
onChange,
selectionState,
utils
]);
return {
meridiemMode,
handleMeridiemChange
};
}
const DAY_SIZE = 36;
const DAY_MARGIN = 2;
const DIALOG_WIDTH = 320;
const MAX_CALENDAR_HEIGHT = 280;
const VIEW_HEIGHT = 336;
const DIGITAL_CLOCK_VIEW_HEIGHT = 232;
const MULTI_SECTION_CLOCK_SECTION_WIDTH = 48;
const PickerViewRoot = styled("div")({
overflow: "hidden",
width: DIALOG_WIDTH,
maxHeight: VIEW_HEIGHT,
display: "flex",
flexDirection: "column",
margin: "0 auto"
});
function getTimeClockUtilityClass(slot) {
return generateUtilityClass("MuiTimeClock", slot);
}
generateUtilityClasses("MuiTimeClock", [
"root",
"arrowSwitcher"
]);
const CLOCK_WIDTH = 220;
const CLOCK_HOUR_WIDTH = 36;
const clockCenter = {
x: CLOCK_WIDTH / 2,
y: CLOCK_WIDTH / 2
};
const baseClockPoint = {
x: clockCenter.x,
y: 0
};
const cx = baseClockPoint.x - clockCenter.x;
const cy = baseClockPoint.y - clockCenter.y;
const rad2deg = (rad) => rad * (180 / Math.PI);
const getAngleValue = (step, offsetX, offsetY) => {
const x = offsetX - clockCenter.x;
const y = offsetY - clockCenter.y;
const atan = Math.atan2(cx, cy) - Math.atan2(x, y);
let deg = rad2deg(atan);
deg = Math.round(deg / step) * step;
deg %= 360;
const value = Math.floor(deg / step) || 0;
const delta = x ** 2 + y ** 2;
const distance = Math.sqrt(delta);
return {
value,
distance
};
};
const getMinutes = (offsetX, offsetY, step = 1) => {
const angleStep = step * 6;
let { value } = getAngleValue(angleStep, offsetX, offsetY);
value = value * step % 60;
return value;
};
const getHours = (offsetX, offsetY, ampm) => {
const { value, distance } = getAngleValue(30, offsetX, offsetY);
let hour = value || 12;
if (!ampm) {
if (distance < CLOCK_WIDTH / 2 - CLOCK_HOUR_WIDTH) {
hour += 12;
hour %= 24;
}
} else {
hour %= 12;
}
return hour;
};
function getClockPointerUtilityClass(slot) {
return generateUtilityClass("MuiClockPointer", slot);
}
generateUtilityClasses("MuiClockPointer", [
"root",
"thumb"
]);
const _excluded$D = [
"className",
"hasSelected",
"isInner",
"type",
"viewValue"
];
const useUtilityClasses$u = (ownerState) => {
const { classes } = ownerState;
const slots = {
root: [
"root"
],
thumb: [
"thumb"
]
};
return composeClasses(slots, getClockPointerUtilityClass, classes);
};
const ClockPointerRoot = styled("div", {
name: "MuiClockPointer",
slot: "Root",
overridesResolver: (_, styles2) => styles2.root
})(({ theme }) => ({
width: 2,
backgroundColor: (theme.vars || theme).palette.primary.main,
position: "absolute",
left: "calc(50% - 1px)",
bottom: "50%",
transformOrigin: "center bottom 0px",
variants: [
{
props: {
shouldAnimate: true
},
style: {
transition: theme.transitions.create([
"transform",
"height"
])
}
}
]
}));
const ClockPointerThumb = styled("div", {
name: "MuiClockPointer",
slot: "Thumb",
overridesResolver: (_, styles2) => styles2.thumb
})(({ theme }) => ({
width: 4,
height: 4,
backgroundColor: (theme.vars || theme).palette.primary.contrastText,
borderRadius: "50%",
position: "absolute",
top: -21,
left: `calc(50% - ${CLOCK_HOUR_WIDTH / 2}px)`,
border: `${(CLOCK_HOUR_WIDTH - 4) / 2}px solid ${(theme.vars || theme).palette.primary.main}`,
boxSizing: "content-box",
variants: [
{
props: {
hasSelected: true
},
style: {
backgroundColor: (theme.vars || theme).palette.primary.main
}
}
]
}));
function ClockPointer(inProps) {
const props = useThemeProps({
props: inProps,
name: "MuiClockPointer"
});
const { className, isInner, type, viewValue } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$D);
const previousType = __mf_31(type);
__mf_24(() => {
previousType.current = type;
}, [
type
]);
const ownerState = _extends$1({}, props, {
shouldAnimate: previousType.current !== type
});
const classes = useUtilityClasses$u(ownerState);
const getAngleStyle = () => {
const max2 = type === "hours" ? 12 : 60;
let angle = 360 / max2 * viewValue;
if (type === "hours" && viewValue > 12) {
angle -= 360;
}
return {
height: Math.round((isInner ? 0.26 : 0.4) * CLOCK_WIDTH),
transform: `rotateZ(${angle}deg)`
};
};
return jsxRuntimeExports.jsx(ClockPointerRoot, _extends$1({
style: getAngleStyle(),
className: clsx(classes.root, className),
ownerState
}, other, {
children: jsxRuntimeExports.jsx(ClockPointerThumb, {
ownerState,
className: classes.thumb
})
}));
}
function getClockUtilityClass(slot) {
return generateUtilityClass("MuiClock", slot);
}
generateUtilityClasses("MuiClock", [
"root",
"clock",
"wrapper",
"squareMask",
"pin",
"amButton",
"pmButton",
"meridiemText",
"selected"
]);
const mergeDateAndTime = (utils, dateParam, timeParam) => {
let mergedDate = dateParam;
mergedDate = utils.setHours(mergedDate, utils.getHours(timeParam));
mergedDate = utils.setMinutes(mergedDate, utils.getMinutes(timeParam));
mergedDate = utils.setSeconds(mergedDate, utils.getSeconds(timeParam));
mergedDate = utils.setMilliseconds(mergedDate, utils.getMilliseconds(timeParam));
return mergedDate;
};
const findClosestEnabledDate = ({ date, disableFuture, disablePast, maxDate, minDate, isDateDisabled, utils, timezone }) => {
const today = mergeDateAndTime(utils, utils.date(void 0, timezone), date);
if (disablePast && utils.isBefore(minDate, today)) {
minDate = today;
}
if (disableFuture && utils.isAfter(maxDate, today)) {
maxDate = today;
}
let forward = date;
let backward = date;
if (utils.isBefore(date, minDate)) {
forward = minDate;
backward = null;
}
if (utils.isAfter(date, maxDate)) {
if (backward) {
backward = maxDate;
}
forward = null;
}
while (forward || backward) {
if (forward && utils.isAfter(forward, maxDate)) {
forward = null;
}
if (backward && utils.isBefore(backward, minDate)) {
backward = null;
}
if (forward) {
if (!isDateDisabled(forward)) {
return forward;
}
forward = utils.addDays(forward, 1);
}
if (backward) {
if (!isDateDisabled(backward)) {
return backward;
}
backward = utils.addDays(backward, -1);
}
}
return null;
};
const replaceInvalidDateByNull = (utils, value) => value == null || !utils.isValid(value) ? null : value;
const applyDefaultDate = (utils, value, defaultValue) => {
if (value == null || !utils.isValid(value)) {
return defaultValue;
}
return value;
};
const areDatesEqual = (utils, a, b) => {
if (!utils.isValid(a) && a != null && !utils.isValid(b) && b != null) {
return true;
}
return utils.isEqual(a, b);
};
const getMonthsInYear = (utils, year) => {
const firstMonth = utils.startOfYear(year);
const months2 = [
firstMonth
];
while (months2.length < 12) {
const prevMonth = months2[months2.length - 1];
months2.push(utils.addMonths(prevMonth, 1));
}
return months2;
};
const getTodayDate = (utils, timezone, valueType) => valueType === "date" ? utils.startOfDay(utils.date(void 0, timezone)) : utils.date(void 0, timezone);
const formatMeridiem = (utils, meridiem2) => {
const date = utils.setHours(utils.date(), meridiem2 === "am" ? 2 : 14);
return utils.format(date, "meridiem");
};
const dateViews = [
"year",
"month",
"day"
];
const isDatePickerView = (view) => dateViews.includes(view);
const resolveDateFormat = (utils, { format: format2, views }, isInToolbar) => {
if (format2 != null) {
return format2;
}
const formats = utils.formats;
if (areViewsEqual(views, [
"year"
])) {
return formats.year;
}
if (areViewsEqual(views, [
"month"
])) {
return formats.month;
}
if (areViewsEqual(views, [
"day"
])) {
return formats.dayOfMonth;
}
if (areViewsEqual(views, [
"month",
"year"
])) {
return `${formats.month} ${formats.year}`;
}
if (areViewsEqual(views, [
"day",
"month"
])) {
return `${formats.month} ${formats.dayOfMonth}`;
}
if (isInToolbar) {
return /en/.test(utils.getCurrentLocaleCode()) ? formats.normalDateWithWeekday : formats.normalDate;
}
return formats.keyboardDate;
};
const getWeekdays = (utils, date) => {
const start = utils.startOfWeek(date);
return [
0,
1,
2,
3,
4,
5,
6
].map((diff2) => utils.addDays(start, diff2));
};
const useUtilityClasses$t = (ownerState) => {
const { classes, meridiemMode } = ownerState;
const slots = {
root: [
"root"
],
clock: [
"clock"
],
wrapper: [
"wrapper"
],
squareMask: [
"squareMask"
],
pin: [
"pin"
],
amButton: [
"amButton",
meridiemMode === "am" && "selected"
],
pmButton: [
"pmButton",
meridiemMode === "pm" && "selected"
],
meridiemText: [
"meridiemText"
]
};
return composeClasses(slots, getClockUtilityClass, classes);
};
const ClockRoot = styled("div", {
name: "MuiClock",
slot: "Root",
overridesResolver: (_, styles2) => styles2.root
})(({ theme }) => ({
display: "flex",
justifyContent: "center",
alignItems: "center",
margin: theme.spacing(2)
}));
const ClockClock = styled("div", {
name: "MuiClock",
slot: "Clock",
overridesResolver: (_, styles2) => styles2.clock
})({
backgroundColor: "rgba(0,0,0,.07)",
borderRadius: "50%",
height: 220,
width: 220,
flexShrink: 0,
position: "relative",
pointerEvents: "none"
});
const ClockWrapper = styled("div", {
name: "MuiClock",
slot: "Wrapper",
overridesResolver: (_, styles2) => styles2.wrapper
})({
"&:focus": {
outline: "none"
}
});
const ClockSquareMask = styled("div", {
name: "MuiClock",
slot: "SquareMask",
overridesResolver: (_, styles2) => styles2.squareMask
})({
width: "100%",
height: "100%",
position: "absolute",
pointerEvents: "auto",
outline: 0,
touchAction: "none",
userSelect: "none",
variants: [
{
props: {
disabled: false
},
style: {
"@media (pointer: fine)": {
cursor: "pointer",
borderRadius: "50%"
},
"&:active": {
cursor: "move"
}
}
}
]
});
const ClockPin = styled("div", {
name: "MuiClock",
slot: "Pin",
overridesResolver: (_, styles2) => styles2.pin
})(({ theme }) => ({
width: 6,
height: 6,
borderRadius: "50%",
backgroundColor: (theme.vars || theme).palette.primary.main,
position: "absolute",
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)"
}));
const meridiemButtonCommonStyles = (theme, meridiemMode) => ({
zIndex: 1,
bottom: 8,
paddingLeft: 4,
paddingRight: 4,
width: CLOCK_HOUR_WIDTH,
variants: [
{
props: {
meridiemMode
},
style: {
backgroundColor: (theme.vars || theme).palette.primary.main,
color: (theme.vars || theme).palette.primary.contrastText,
"&:hover": {
backgroundColor: (theme.vars || theme).palette.primary.light
}
}
}
]
});
const ClockAmButton = styled(IconButton, {
name: "MuiClock",
slot: "AmButton",
overridesResolver: (_, styles2) => styles2.amButton
})(({ theme }) => _extends$1({}, meridiemButtonCommonStyles(theme, "am"), {
position: "absolute",
left: 8
}));
const ClockPmButton = styled(IconButton, {
name: "MuiClock",
slot: "PmButton",
overridesResolver: (_, styles2) => styles2.pmButton
})(({ theme }) => _extends$1({}, meridiemButtonCommonStyles(theme, "pm"), {
position: "absolute",
right: 8
}));
const ClockMeridiemText = styled(Typography, {
name: "MuiClock",
slot: "meridiemText",
overridesResolver: (_, styles2) => styles2.meridiemText
})({
overflow: "hidden",
whiteSpace: "nowrap",
textOverflow: "ellipsis"
});
function Clock(inProps) {
const props = useThemeProps({
props: inProps,
name: "MuiClock"
});
const { ampm, ampmInClock, autoFocus, children, value, handleMeridiemChange, isTimeDisabled, meridiemMode, minutesStep = 1, onChange, selectedId, type, viewValue, viewRange: [minViewValue, maxViewValue], disabled = false, readOnly, className } = props;
const ownerState = props;
const utils = useUtils();
const translations = usePickersTranslations();
const isMoving = __mf_31(false);
const classes = useUtilityClasses$t(ownerState);
const isSelectedTimeDisabled = isTimeDisabled(viewValue, type);
const isPointerInner = !ampm && type === "hours" && (viewValue < 1 || viewValue > 12);
const handleValueChange = (newValue, isFinish) => {
if (disabled || readOnly) {
return;
}
if (isTimeDisabled(newValue, type)) {
return;
}
onChange(newValue, isFinish);
};
const setTime = (event, isFinish) => {
let { offsetX, offsetY } = event;
if (offsetX === void 0) {
const rect = event.target.getBoundingClientRect();
offsetX = event.changedTouches[0].clientX - rect.left;
offsetY = event.changedTouches[0].clientY - rect.top;
}
const newSelectedValue = type === "seconds" || type === "minutes" ? getMinutes(offsetX, offsetY, minutesStep) : getHours(offsetX, offsetY, Boolean(ampm));
handleValueChange(newSelectedValue, isFinish);
};
const handleTouchSelection = (event) => {
isMoving.current = true;
setTime(event, "shallow");
};
const handleTouchEnd = (event) => {
if (isMoving.current) {
setTime(event, "finish");
isMoving.current = false;
}
event.preventDefault();
};
const handleMouseMove = (event) => {
if (event.buttons > 0) {
setTime(event.nativeEvent, "shallow");
}
};
const handleMouseUp = (event) => {
if (isMoving.current) {
isMoving.current = false;
}
setTime(event.nativeEvent, "finish");
};
const hasSelected = __mf_29(() => {
if (type === "hours") {
return true;
}
return viewValue % 5 === 0;
}, [
type,
viewValue
]);
const keyboardControlStep = type === "minutes" ? minutesStep : 1;
const listboxRef = __mf_31(null);
useEnhancedEffect(() => {
if (autoFocus) {
listboxRef.current.focus();
}
}, [
autoFocus
]);
const clampValue = (newValue) => Math.max(minViewValue, Math.min(maxViewValue, newValue));
const circleValue = (newValue) => (newValue + (maxViewValue + 1)) % (maxViewValue + 1);
const handleKeyDown = (event) => {
if (isMoving.current) {
return;
}
switch (event.key) {
case "Home":
handleValueChange(minViewValue, "partial");
event.preventDefault();
break;
case "End":
handleValueChange(maxViewValue, "partial");
event.preventDefault();
break;
case "ArrowUp":
handleValueChange(circleValue(viewValue + keyboardControlStep), "partial");
event.preventDefault();
break;
case "ArrowDown":
handleValueChange(circleValue(viewValue - keyboardControlStep), "partial");
event.preventDefault();
break;
case "PageUp":
handleValueChange(clampValue(viewValue + 5), "partial");
event.preventDefault();
break;
case "PageDown":
handleValueChange(clampValue(viewValue - 5), "partial");
event.preventDefault();
break;
case "Enter":
case " ":
handleValueChange(viewValue, "finish");
event.preventDefault();
break;
}
};
return jsxRuntimeExports.jsxs(ClockRoot, {
className: clsx(classes.root, className),
children: [
jsxRuntimeExports.jsxs(ClockClock, {
className: classes.clock,
children: [
jsxRuntimeExports.jsx(ClockSquareMask, {
onTouchMove: handleTouchSelection,
onTouchStart: handleTouchSelection,
onTouchEnd: handleTouchEnd,
onMouseUp: handleMouseUp,
onMouseMove: handleMouseMove,
ownerState: {
disabled
},
className: classes.squareMask
}),
!isSelectedTimeDisabled && jsxRuntimeExports.jsxs(__mf_2$1, {
children: [
jsxRuntimeExports.jsx(ClockPin, {
className: classes.pin
}),
value != null && jsxRuntimeExports.jsx(ClockPointer, {
type,
viewValue,
isInner: isPointerInner,
hasSelected
})
]
}),
jsxRuntimeExports.jsx(ClockWrapper, {
"aria-activedescendant": selectedId,
"aria-label": translations.clockLabelText(type, value, utils, value == null ? null : utils.format(value, "fullTime")),
ref: listboxRef,
role: "listbox",
onKeyDown: handleKeyDown,
tabIndex: 0,
className: classes.wrapper,
children
})
]
}),
ampm && ampmInClock && jsxRuntimeExports.jsxs(__mf_2$1, {
children: [
jsxRuntimeExports.jsx(ClockAmButton, {
onClick: readOnly ? void 0 : () => handleMeridiemChange("am"),
disabled: disabled || meridiemMode === null,
ownerState,
className: classes.amButton,
title: formatMeridiem(utils, "am"),
children: jsxRuntimeExports.jsx(ClockMeridiemText, {
variant: "caption",
className: classes.meridiemText,
children: formatMeridiem(utils, "am")
})
}),
jsxRuntimeExports.jsx(ClockPmButton, {
disabled: disabled || meridiemMode === null,
onClick: readOnly ? void 0 : () => handleMeridiemChange("pm"),
ownerState,
className: classes.pmButton,
title: formatMeridiem(utils, "pm"),
children: jsxRuntimeExports.jsx(ClockMeridiemText, {
variant: "caption",
className: classes.meridiemText,
children: formatMeridiem(utils, "pm")
})
})
]
})
]
});
}
function getClockNumberUtilityClass(slot) {
return generateUtilityClass("MuiClockNumber", slot);
}
const clockNumberClasses = generateUtilityClasses("MuiClockNumber", [
"root",
"selected",
"disabled"
]);
const _excluded$C = [
"className",
"disabled",
"index",
"inner",
"label",
"selected"
];
const useUtilityClasses$s = (ownerState) => {
const { classes, selected, disabled } = ownerState;
const slots = {
root: [
"root",
selected && "selected",
disabled && "disabled"
]
};
return composeClasses(slots, getClockNumberUtilityClass, classes);
};
const ClockNumberRoot = styled("span", {
name: "MuiClockNumber",
slot: "Root",
overridesResolver: (_, styles2) => [
styles2.root,
{
[`&.${clockNumberClasses.disabled}`]: styles2.disabled
},
{
[`&.${clockNumberClasses.selected}`]: styles2.selected
}
]
})(({ theme }) => ({
height: CLOCK_HOUR_WIDTH,
width: CLOCK_HOUR_WIDTH,
position: "absolute",
left: `calc((100% - ${CLOCK_HOUR_WIDTH}px) / 2)`,
display: "inline-flex",
justifyContent: "center",
alignItems: "center",
borderRadius: "50%",
color: (theme.vars || theme).palette.text.primary,
fontFamily: theme.typography.fontFamily,
"&:focused": {
backgroundColor: (theme.vars || theme).palette.background.paper
},
[`&.${clockNumberClasses.selected}`]: {
color: (theme.vars || theme).palette.primary.contrastText
},
[`&.${clockNumberClasses.disabled}`]: {
pointerEvents: "none",
color: (theme.vars || theme).palette.text.disabled
},
variants: [
{
props: {
inner: true
},
style: _extends$1({}, theme.typography.body2, {
color: (theme.vars || theme).palette.text.secondary
})
}
]
}));
function ClockNumber(inProps) {
const props = useThemeProps({
props: inProps,
name: "MuiClockNumber"
});
const { className, disabled, index, inner, label, selected } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$C);
const ownerState = props;
const classes = useUtilityClasses$s(ownerState);
const angle = index % 12 / 12 * Math.PI * 2 - Math.PI / 2;
const length = (CLOCK_WIDTH - CLOCK_HOUR_WIDTH - 2) / 2 * (inner ? 0.65 : 1);
const x = Math.round(Math.cos(angle) * length);
const y = Math.round(Math.sin(angle) * length);
return jsxRuntimeExports.jsx(ClockNumberRoot, _extends$1({
className: clsx(classes.root, className),
"aria-disabled": disabled ? true : void 0,
"aria-selected": selected ? true : void 0,
role: "option",
style: {
transform: `translate(${x}px, ${y + (CLOCK_WIDTH - CLOCK_HOUR_WIDTH) / 2}px`
},
ownerState
}, other, {
children: label
}));
}
const getHourNumbers = ({ ampm, value, getClockNumberText, isDisabled, selectedId, utils }) => {
const currentHours = value ? utils.getHours(value) : null;
const hourNumbers = [];
const startHour = ampm ? 1 : 0;
const endHour = ampm ? 12 : 23;
const isSelected = (hour) => {
if (currentHours === null) {
return false;
}
if (ampm) {
if (hour === 12) {
return currentHours === 12 || currentHours === 0;
}
return currentHours === hour || currentHours - 12 === hour;
}
return currentHours === hour;
};
for (let hour = startHour; hour <= endHour; hour += 1) {
let label = hour.toString();
if (hour === 0) {
label = "00";
}
const inner = !ampm && (hour === 0 || hour > 12);
label = utils.formatNumber(label);
const selected = isSelected(hour);
hourNumbers.push(jsxRuntimeExports.jsx(ClockNumber, {
id: selected ? selectedId : void 0,
index: hour,
inner,
selected,
disabled: isDisabled(hour),
label,
"aria-label": getClockNumberText(label)
}, hour));
}
return hourNumbers;
};
const getMinutesNumbers = ({ utils, value, isDisabled, getClockNumberText, selectedId }) => {
const f = utils.formatNumber;
return [
[
5,
f("05")
],
[
10,
f("10")
],
[
15,
f("15")
],
[
20,
f("20")
],
[
25,
f("25")
],
[
30,
f("30")
],
[
35,
f("35")
],
[
40,
f("40")
],
[
45,
f("45")
],
[
50,
f("50")
],
[
55,
f("55")
],
[
0,
f("00")
]
].map(([numberValue, label], index) => {
const selected = numberValue === value;
return jsxRuntimeExports.jsx(ClockNumber, {
label,
id: selected ? selectedId : void 0,
index: index + 1,
inner: false,
disabled: isDisabled(numberValue),
selected,
"aria-label": getClockNumberText(label)
}, numberValue);
});
};
const useValueWithTimezone = ({ timezone: timezoneProp, value: valueProp, defaultValue, referenceDate, onChange, valueManager }) => {
const utils = useUtils();
const firstDefaultValue = __mf_31(defaultValue);
const inputValue = valueProp ?? firstDefaultValue.current ?? valueManager.emptyValue;
const inputTimezone = __mf_29(() => valueManager.getTimezone(utils, inputValue), [
utils,
valueManager,
inputValue
]);
const setInputTimezone = useEventCallback((newValue) => {
if (inputTimezone == null) {
return newValue;
}
return valueManager.setTimezone(utils, inputTimezone, newValue);
});
let timezoneToRender;
if (timezoneProp) {
timezoneToRender = timezoneProp;
} else if (inputTimezone) {
timezoneToRender = inputTimezone;
} else if (referenceDate) {
timezoneToRender = utils.getTimezone(referenceDate);
} else {
timezoneToRender = "default";
}
const valueWithTimezoneToRender = __mf_29(() => valueManager.setTimezone(utils, timezoneToRender, inputValue), [
valueManager,
utils,
timezoneToRender,
inputValue
]);
const handleValueChange = useEventCallback((newValue, ...otherParams) => {
const newValueWithInputTimezone = setInputTimezone(newValue);
onChange == null ? void 0 : onChange(newValueWithInputTimezone, ...otherParams);
});
return {
value: valueWithTimezoneToRender,
handleValueChange,
timezone: timezoneToRender
};
};
const useControlledValueWithTimezone = ({ name, timezone: timezoneProp, value: valueProp, defaultValue, referenceDate, onChange: onChangeProp, valueManager }) => {
const [valueWithInputTimezone, setValue] = useControlled({
name,
state: "value",
controlled: valueProp,
default: defaultValue ?? valueManager.emptyValue
});
const onChange = useEventCallback((newValue, ...otherParams) => {
setValue(newValue);
onChangeProp == null ? void 0 : onChangeProp(newValue, ...otherParams);
});
return useValueWithTimezone({
timezone: timezoneProp,
value: valueWithInputTimezone,
defaultValue: void 0,
referenceDate,
onChange,
valueManager
});
};
const SECTION_TYPE_GRANULARITY = {
year: 1,
month: 2,
day: 3,
hours: 4,
minutes: 5,
seconds: 6,
milliseconds: 7
};
const getSectionTypeGranularity = (sections) => Math.max(...sections.map((section) => SECTION_TYPE_GRANULARITY[section.type] ?? 1));
const roundDate = (utils, granularity, date) => {
if (granularity === SECTION_TYPE_GRANULARITY.year) {
return utils.startOfYear(date);
}
if (granularity === SECTION_TYPE_GRANULARITY.month) {
return utils.startOfMonth(date);
}
if (granularity === SECTION_TYPE_GRANULARITY.day) {
return utils.startOfDay(date);
}
let roundedDate = date;
if (granularity < SECTION_TYPE_GRANULARITY.minutes) {
roundedDate = utils.setMinutes(roundedDate, 0);
}
if (granularity < SECTION_TYPE_GRANULARITY.seconds) {
roundedDate = utils.setSeconds(roundedDate, 0);
}
if (granularity < SECTION_TYPE_GRANULARITY.milliseconds) {
roundedDate = utils.setMilliseconds(roundedDate, 0);
}
return roundedDate;
};
const getDefaultReferenceDate = ({ props, utils, granularity, timezone, getTodayDate: inGetTodayDate }) => {
let referenceDate = inGetTodayDate ? inGetTodayDate() : roundDate(utils, granularity, getTodayDate(utils, timezone));
if (props.minDate != null && utils.isAfterDay(props.minDate, referenceDate)) {
referenceDate = roundDate(utils, granularity, props.minDate);
}
if (props.maxDate != null && utils.isBeforeDay(props.maxDate, referenceDate)) {
referenceDate = roundDate(utils, granularity, props.maxDate);
}
const isAfter2 = createIsAfterIgnoreDatePart(props.disableIgnoringDatePartForTimeValidation ?? false, utils);
if (props.minTime != null && isAfter2(props.minTime, referenceDate)) {
referenceDate = roundDate(utils, granularity, props.disableIgnoringDatePartForTimeValidation ? props.minTime : mergeDateAndTime(utils, referenceDate, props.minTime));
}
if (props.maxTime != null && isAfter2(referenceDate, props.maxTime)) {
referenceDate = roundDate(utils, granularity, props.disableIgnoringDatePartForTimeValidation ? props.maxTime : mergeDateAndTime(utils, referenceDate, props.maxTime));
}
return referenceDate;
};
const getDateSectionConfigFromFormatToken = (utils, formatToken) => {
const config = utils.formatTokenMap[formatToken];
if (config == null) {
throw new Error([
`MUI X: The token "${formatToken}" is not supported by the Date and Time Pickers.`,
"Please try using another token or open an issue on https://github.com/mui/mui-x/issues/new/choose if you think it should be supported."
].join("\n"));
}
if (typeof config === "string") {
return {
type: config,
contentType: config === "meridiem" ? "letter" : "digit",
maxLength: void 0
};
}
return {
type: config.sectionType,
contentType: config.contentType,
maxLength: config.maxLength
};
};
const getDeltaFromKeyCode = (keyCode) => {
switch (keyCode) {
case "ArrowUp":
return 1;
case "ArrowDown":
return -1;
case "PageUp":
return 5;
case "PageDown":
return -5;
default:
return 0;
}
};
const getDaysInWeekStr = (utils, format2) => {
const elements = [];
const now2 = utils.date(void 0, "default");
const startDate = utils.startOfWeek(now2);
const endDate = utils.endOfWeek(now2);
let current = startDate;
while (utils.isBefore(current, endDate)) {
elements.push(current);
current = utils.addDays(current, 1);
}
return elements.map((weekDay) => utils.formatByString(weekDay, format2));
};
const getLetterEditingOptions = (utils, timezone, sectionType, format2) => {
switch (sectionType) {
case "month": {
return getMonthsInYear(utils, utils.date(void 0, timezone)).map((month) => utils.formatByString(month, format2));
}
case "weekDay": {
return getDaysInWeekStr(utils, format2);
}
case "meridiem": {
const now2 = utils.date(void 0, timezone);
return [
utils.startOfDay(now2),
utils.endOfDay(now2)
].map((date) => utils.formatByString(date, format2));
}
default: {
return [];
}
}
};
const FORMAT_SECONDS_NO_LEADING_ZEROS = "s";
const NON_LOCALIZED_DIGITS = [
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
];
const getLocalizedDigits = (utils) => {
const today = utils.date(void 0);
const formattedZero = utils.formatByString(utils.setSeconds(today, 0), FORMAT_SECONDS_NO_LEADING_ZEROS);
if (formattedZero === "0") {
return NON_LOCALIZED_DIGITS;
}
return Array.from({
length: 10
}).map((_, index) => utils.formatByString(utils.setSeconds(today, index), FORMAT_SECONDS_NO_LEADING_ZEROS));
};
const removeLocalizedDigits = (valueStr, localizedDigits) => {
if (localizedDigits[0] === "0") {
return valueStr;
}
const digits = [];
let currentFormattedDigit = "";
for (let i = 0; i < valueStr.length; i += 1) {
currentFormattedDigit += valueStr[i];
const matchingDigitIndex = localizedDigits.indexOf(currentFormattedDigit);
if (matchingDigitIndex > -1) {
digits.push(matchingDigitIndex.toString());
currentFormattedDigit = "";
}
}
return digits.join("");
};
const applyLocalizedDigits = (valueStr, localizedDigits) => {
if (localizedDigits[0] === "0") {
return valueStr;
}
return valueStr.split("").map((char) => localizedDigits[Number(char)]).join("");
};
const isStringNumber = (valueStr, localizedDigits) => {
const nonLocalizedValueStr = removeLocalizedDigits(valueStr, localizedDigits);
return nonLocalizedValueStr !== " " && !Number.isNaN(Number(nonLocalizedValueStr));
};
const cleanLeadingZeros = (valueStr, size) => {
let cleanValueStr = valueStr;
cleanValueStr = Number(cleanValueStr).toString();
while (cleanValueStr.length < size) {
cleanValueStr = `0${cleanValueStr}`;
}
return cleanValueStr;
};
const cleanDigitSectionValue = (utils, value, sectionBoundaries, localizedDigits, section) => {
if (section.type === "day" && section.contentType === "digit-with-letter") {
const date = utils.setDate(sectionBoundaries.longestMonth, value);
return utils.formatByString(date, section.format);
}
let valueStr = value.toString();
if (section.hasLeadingZerosInInput) {
valueStr = cleanLeadingZeros(valueStr, section.maxLength);
}
return applyLocalizedDigits(valueStr, localizedDigits);
};
const adjustSectionValue = (utils, timezone, section, keyCode, sectionsValueBoundaries, localizedDigits, activeDate, stepsAttributes) => {
const delta = getDeltaFromKeyCode(keyCode);
const isStart = keyCode === "Home";
const isEnd = keyCode === "End";
const shouldSetAbsolute = section.value === "" || isStart || isEnd;
const adjustDigitSection = () => {
const sectionBoundaries = sectionsValueBoundaries[section.type]({
currentDate: activeDate,
format: section.format,
contentType: section.contentType
});
const getCleanValue = (value) => cleanDigitSectionValue(utils, value, sectionBoundaries, localizedDigits, section);
const step = section.type === "minutes" && (stepsAttributes == null ? void 0 : stepsAttributes.minutesStep) ? stepsAttributes.minutesStep : 1;
let newSectionValueNumber;
if (shouldSetAbsolute) {
if (section.type === "year" && !isEnd && !isStart) {
return utils.formatByString(utils.date(void 0, timezone), section.format);
}
if (delta > 0 || isStart) {
newSectionValueNumber = sectionBoundaries.minimum;
} else {
newSectionValueNumber = sectionBoundaries.maximum;
}
} else {
const currentSectionValue = parseInt(removeLocalizedDigits(section.value, localizedDigits), 10);
newSectionValueNumber = currentSectionValue + delta * step;
}
if (newSectionValueNumber % step !== 0) {
if (delta < 0 || isStart) {
newSectionValueNumber += step - (step + newSectionValueNumber) % step;
}
if (delta > 0 || isEnd) {
newSectionValueNumber -= newSectionValueNumber % step;
}
}
if (newSectionValueNumber > sectionBoundaries.maximum) {
return getCleanValue(sectionBoundaries.minimum + (newSectionValueNumber - sectionBoundaries.maximum - 1) % (sectionBoundaries.maximum - sectionBoundaries.minimum + 1));
}
if (newSectionValueNumber < sectionBoundaries.minimum) {
return getCleanValue(sectionBoundaries.maximum - (sectionBoundaries.minimum - newSectionValueNumber - 1) % (sectionBoundaries.maximum - sectionBoundaries.minimum + 1));
}
return getCleanValue(newSectionValueNumber);
};
const adjustLetterSection = () => {
const options = getLetterEditingOptions(utils, timezone, section.type, section.format);
if (options.length === 0) {
return section.value;
}
if (shouldSetAbsolute) {
if (delta > 0 || isStart) {
return options[0];
}
return options[options.length - 1];
}
const currentOptionIndex = options.indexOf(section.value);
const newOptionIndex = (currentOptionIndex + delta) % options.length;
const clampedIndex = (newOptionIndex + options.length) % options.length;
return options[clampedIndex];
};
if (section.contentType === "digit" || section.contentType === "digit-with-letter") {
return adjustDigitSection();
}
return adjustLetterSection();
};
const getSectionVisibleValue = (section, target, localizedDigits) => {
let value = section.value || section.placeholder;
const hasLeadingZeros = target === "non-input" ? section.hasLeadingZerosInFormat : section.hasLeadingZerosInInput;
if (target === "non-input" && section.hasLeadingZerosInInput && !section.hasLeadingZerosInFormat) {
value = Number(removeLocalizedDigits(value, localizedDigits)).toString();
}
const shouldAddInvisibleSpace = [
"input-rtl",
"input-ltr"
].includes(target) && section.contentType === "digit" && !hasLeadingZeros && value.length === 1;
if (shouldAddInvisibleSpace) {
value = `${value}\u200E`;
}
if (target === "input-rtl") {
value = `\u2068${value}\u2069`;
}
return value;
};
const changeSectionValueFormat = (utils, valueStr, currentFormat, newFormat) => {
return utils.formatByString(utils.parse(valueStr, currentFormat), newFormat);
};
const isFourDigitYearFormat = (utils, format2) => utils.formatByString(utils.date(void 0, "system"), format2).length === 4;
const doesSectionFormatHaveLeadingZeros = (utils, contentType, sectionType, format2) => {
if (contentType !== "digit") {
return false;
}
const now2 = utils.date(void 0, "default");
switch (sectionType) {
case "year": {
if (utils.lib === "dayjs" && format2 === "YY") {
return true;
}
return utils.formatByString(utils.setYear(now2, 1), format2).startsWith("0");
}
case "month": {
return utils.formatByString(utils.startOfYear(now2), format2).length > 1;
}
case "day": {
return utils.formatByString(utils.startOfMonth(now2), format2).length > 1;
}
case "weekDay": {
return utils.formatByString(utils.startOfWeek(now2), format2).length > 1;
}
case "hours": {
return utils.formatByString(utils.setHours(now2, 1), format2).length > 1;
}
case "minutes": {
return utils.formatByString(utils.setMinutes(now2, 1), format2).length > 1;
}
case "seconds": {
return utils.formatByString(utils.setSeconds(now2, 1), format2).length > 1;
}
default: {
throw new Error("Invalid section type");
}
}
};
const getDateFromDateSections = (utils, sections, localizedDigits) => {
const shouldSkipWeekDays = sections.some((section) => section.type === "day");
const sectionFormats = [];
const sectionValues = [];
for (let i = 0; i < sections.length; i += 1) {
const section = sections[i];
const shouldSkip = shouldSkipWeekDays && section.type === "weekDay";
if (!shouldSkip) {
sectionFormats.push(section.format);
sectionValues.push(getSectionVisibleValue(section, "non-input", localizedDigits));
}
}
const formatWithoutSeparator = sectionFormats.join(" ");
const dateWithoutSeparatorStr = sectionValues.join(" ");
return utils.parse(dateWithoutSeparatorStr, formatWithoutSeparator);
};
const createDateStrForV7HiddenInputFromSections = (sections) => sections.map((section) => {
return `${section.startSeparator}${section.value || section.placeholder}${section.endSeparator}`;
}).join("");
const createDateStrForV6InputFromSections = (sections, localizedDigits, isRtl) => {
const formattedSections = sections.map((section) => {
const dateValue = getSectionVisibleValue(section, isRtl ? "input-rtl" : "input-ltr", localizedDigits);
return `${section.startSeparator}${dateValue}${section.endSeparator}`;
});
const dateStr = formattedSections.join("");
if (!isRtl) {
return dateStr;
}
return `\u2066${dateStr}\u2069`;
};
const getSectionsBoundaries = (utils, localizedDigits, timezone) => {
const today = utils.date(void 0, timezone);
const endOfYear = utils.endOfYear(today);
const endOfDay = utils.endOfDay(today);
const { maxDaysInMonth, longestMonth } = getMonthsInYear(utils, today).reduce((acc, month) => {
const daysInMonth2 = utils.getDaysInMonth(month);
if (daysInMonth2 > acc.maxDaysInMonth) {
return {
maxDaysInMonth: daysInMonth2,
longestMonth: month
};
}
return acc;
}, {
maxDaysInMonth: 0,
longestMonth: null
});
return {
year: ({ format: format2 }) => ({
minimum: 0,
maximum: isFourDigitYearFormat(utils, format2) ? 9999 : 99
}),
month: () => ({
minimum: 1,
maximum: utils.getMonth(endOfYear) + 1
}),
day: ({ currentDate }) => ({
minimum: 1,
maximum: currentDate != null && utils.isValid(currentDate) ? utils.getDaysInMonth(currentDate) : maxDaysInMonth,
longestMonth
}),
weekDay: ({ format: format2, contentType }) => {
if (contentType === "digit") {
const daysInWeek = getDaysInWeekStr(utils, format2).map(Number);
return {
minimum: Math.min(...daysInWeek),
maximum: Math.max(...daysInWeek)
};
}
return {
minimum: 1,
maximum: 7
};
},
hours: ({ format: format2 }) => {
const lastHourInDay = utils.getHours(endOfDay);
const hasMeridiem = removeLocalizedDigits(utils.formatByString(utils.endOfDay(today), format2), localizedDigits) !== lastHourInDay.toString();
if (hasMeridiem) {
return {
minimum: 1,
maximum: Number(removeLocalizedDigits(utils.formatByString(utils.startOfDay(today), format2), localizedDigits))
};
}
return {
minimum: 0,
maximum: lastHourInDay
};
},
minutes: () => ({
minimum: 0,
maximum: utils.getMinutes(endOfDay)
}),
seconds: () => ({
minimum: 0,
maximum: utils.getSeconds(endOfDay)
}),
meridiem: () => ({
minimum: 0,
maximum: 1
}),
empty: () => ({
minimum: 0,
maximum: 0
})
};
};
const transferDateSectionValue = (utils, section, dateToTransferFrom, dateToTransferTo) => {
switch (section.type) {
case "year": {
return utils.setYear(dateToTransferTo, utils.getYear(dateToTransferFrom));
}
case "month": {
return utils.setMonth(dateToTransferTo, utils.getMonth(dateToTransferFrom));
}
case "weekDay": {
const formattedDaysInWeek = getDaysInWeekStr(utils, section.format);
const dayInWeekStrOfActiveDate = utils.formatByString(dateToTransferFrom, section.format);
const dayInWeekOfActiveDate = formattedDaysInWeek.indexOf(dayInWeekStrOfActiveDate);
const dayInWeekOfNewSectionValue = formattedDaysInWeek.indexOf(section.value);
const diff2 = dayInWeekOfNewSectionValue - dayInWeekOfActiveDate;
return utils.addDays(dateToTransferFrom, diff2);
}
case "day": {
return utils.setDate(dateToTransferTo, utils.getDate(dateToTransferFrom));
}
case "meridiem": {
const isAM = utils.getHours(dateToTransferFrom) < 12;
const mergedDateHours = utils.getHours(dateToTransferTo);
if (isAM && mergedDateHours >= 12) {
return utils.addHours(dateToTransferTo, -12);
}
if (!isAM && mergedDateHours < 12) {
return utils.addHours(dateToTransferTo, 12);
}
return dateToTransferTo;
}
case "hours": {
return utils.setHours(dateToTransferTo, utils.getHours(dateToTransferFrom));
}
case "minutes": {
return utils.setMinutes(dateToTransferTo, utils.getMinutes(dateToTransferFrom));
}
case "seconds": {
return utils.setSeconds(dateToTransferTo, utils.getSeconds(dateToTransferFrom));
}
default: {
return dateToTransferTo;
}
}
};
const reliableSectionModificationOrder = {
year: 1,
month: 2,
day: 3,
weekDay: 4,
hours: 5,
minutes: 6,
seconds: 7,
meridiem: 8,
empty: 9
};
const mergeDateIntoReferenceDate = (utils, dateToTransferFrom, sections, referenceDate, shouldLimitToEditedSections) => [
...sections
].sort((a, b) => reliableSectionModificationOrder[a.type] - reliableSectionModificationOrder[b.type]).reduce((mergedDate, section) => {
if (!shouldLimitToEditedSections || section.modified) {
return transferDateSectionValue(utils, section, dateToTransferFrom, mergedDate);
}
return mergedDate;
}, referenceDate);
const isAndroid = () => navigator.userAgent.toLowerCase().includes("android");
const getSectionOrder = (sections, shouldApplyRTL) => {
const neighbors = {};
if (!shouldApplyRTL) {
sections.forEach((_, index) => {
const leftIndex = index === 0 ? null : index - 1;
const rightIndex = index === sections.length - 1 ? null : index + 1;
neighbors[index] = {
leftIndex,
rightIndex
};
});
return {
neighbors,
startIndex: 0,
endIndex: sections.length - 1
};
}
const rtl2ltr = {};
const ltr2rtl = {};
let groupedSectionsStart = 0;
let groupedSectionsEnd = 0;
let RTLIndex = sections.length - 1;
while (RTLIndex >= 0) {
groupedSectionsEnd = sections.findIndex((section, index) => {
var _a;
return index >= groupedSectionsStart && ((_a = section.endSeparator) == null ? void 0 : _a.includes(" ")) && section.endSeparator !== " / ";
});
if (groupedSectionsEnd === -1) {
groupedSectionsEnd = sections.length - 1;
}
for (let i = groupedSectionsEnd; i >= groupedSectionsStart; i -= 1) {
ltr2rtl[i] = RTLIndex;
rtl2ltr[RTLIndex] = i;
RTLIndex -= 1;
}
groupedSectionsStart = groupedSectionsEnd + 1;
}
sections.forEach((_, index) => {
const rtlIndex = ltr2rtl[index];
const leftIndex = rtlIndex === 0 ? null : rtl2ltr[rtlIndex - 1];
const rightIndex = rtlIndex === sections.length - 1 ? null : rtl2ltr[rtlIndex + 1];
neighbors[index] = {
leftIndex,
rightIndex
};
});
return {
neighbors,
startIndex: rtl2ltr[0],
endIndex: rtl2ltr[sections.length - 1]
};
};
const parseSelectedSections = (selectedSections, sections) => {
if (selectedSections == null) {
return null;
}
if (selectedSections === "all") {
return "all";
}
if (typeof selectedSections === "string") {
const index = sections.findIndex((section) => section.type === selectedSections);
return index === -1 ? null : index;
}
return selectedSections;
};
const getSectionValueText = (section, utils) => {
if (!section.value) {
return void 0;
}
switch (section.type) {
case "month": {
if (section.contentType === "digit") {
return utils.format(utils.setMonth(utils.date(), Number(section.value) - 1), "month");
}
const parsedDate = utils.parse(section.value, section.format);
return parsedDate ? utils.format(parsedDate, "month") : void 0;
}
case "day":
return section.contentType === "digit" ? utils.format(utils.setDate(utils.startOfYear(utils.date()), Number(section.value)), "dayOfMonthFull") : section.value;
case "weekDay":
return void 0;
default:
return void 0;
}
};
const getSectionValueNow = (section, utils) => {
if (!section.value) {
return void 0;
}
switch (section.type) {
case "weekDay": {
if (section.contentType === "letter") {
return void 0;
}
return Number(section.value);
}
case "meridiem": {
const parsedDate = utils.parse(`01:00 ${section.value}`, `${utils.formats.hours12h}:${utils.formats.minutes} ${section.format}`);
if (parsedDate) {
return utils.getHours(parsedDate) >= 12 ? 1 : 0;
}
return void 0;
}
case "day":
return section.contentType === "digit-with-letter" ? parseInt(section.value, 10) : Number(section.value);
case "month": {
if (section.contentType === "digit") {
return Number(section.value);
}
const parsedDate = utils.parse(section.value, section.format);
return parsedDate ? utils.getMonth(parsedDate) + 1 : void 0;
}
default:
return section.contentType !== "letter" ? Number(section.value) : void 0;
}
};
const _excluded$B = [
"value",
"referenceDate"
];
const singleItemValueManager = {
emptyValue: null,
getTodayValue: getTodayDate,
getInitialReferenceValue: (_ref) => {
let { value, referenceDate } = _ref, params = _objectWithoutPropertiesLoose$1(_ref, _excluded$B);
if (value != null && params.utils.isValid(value)) {
return value;
}
if (referenceDate != null) {
return referenceDate;
}
return getDefaultReferenceDate(params);
},
cleanValue: replaceInvalidDateByNull,
areValuesEqual: areDatesEqual,
isSameError: (a, b) => a === b,
hasError: (error) => error != null,
defaultErrorState: null,
getTimezone: (utils, value) => value == null || !utils.isValid(value) ? null : utils.getTimezone(value),
setTimezone: (utils, timezone, value) => value == null ? null : utils.setTimezone(value, timezone)
};
const singleItemFieldValueManager = {
updateReferenceValue: (utils, value, prevReferenceValue) => value == null || !utils.isValid(value) ? prevReferenceValue : value,
getSectionsFromValue: (utils, date, prevSections, getSectionsFromDate) => {
const shouldReUsePrevDateSections = !utils.isValid(date) && !!prevSections;
if (shouldReUsePrevDateSections) {
return prevSections;
}
return getSectionsFromDate(date);
},
getV7HiddenInputValueFromSections: createDateStrForV7HiddenInputFromSections,
getV6InputValueFromSections: createDateStrForV6InputFromSections,
getActiveDateManager: (utils, state) => ({
date: state.value,
referenceDate: state.referenceValue,
getSections: (sections) => sections,
getNewValuesFromNewActiveDate: (newActiveDate) => ({
value: newActiveDate,
referenceValue: newActiveDate == null || !utils.isValid(newActiveDate) ? state.referenceValue : newActiveDate
})
}),
parseValueStr: (valueStr, referenceValue, parseDate) => parseDate(valueStr.trim(), referenceValue)
};
const useClockReferenceDate = ({ value, referenceDate: referenceDateProp, utils, props, timezone }) => {
const referenceDate = __mf_29(() => singleItemValueManager.getInitialReferenceValue({
value,
utils,
props,
referenceDate: referenceDateProp,
granularity: SECTION_TYPE_GRANULARITY.day,
timezone,
getTodayDate: () => getTodayDate(utils, timezone, "date")
}), []);
return value ?? referenceDate;
};
const _excluded$A = [
"ampm",
"ampmInClock",
"autoFocus",
"slots",
"slotProps",
"value",
"defaultValue",
"referenceDate",
"disableIgnoringDatePartForTimeValidation",
"maxTime",
"minTime",
"disableFuture",
"disablePast",
"minutesStep",
"shouldDisableTime",
"showViewSwitcher",
"onChange",
"view",
"views",
"openTo",
"onViewChange",
"focusedView",
"onFocusedViewChange",
"className",
"disabled",
"readOnly",
"timezone"
];
const useUtilityClasses$r = (ownerState) => {
const { classes } = ownerState;
const slots = {
root: [
"root"
],
arrowSwitcher: [
"arrowSwitcher"
]
};
return composeClasses(slots, getTimeClockUtilityClass, classes);
};
const TimeClockRoot = styled(PickerViewRoot, {
name: "MuiTimeClock",
slot: "Root",
overridesResolver: (props, styles2) => styles2.root
})({
display: "flex",
flexDirection: "column",
position: "relative"
});
const TimeClockArrowSwitcher = styled(PickersArrowSwitcher, {
name: "MuiTimeClock",
slot: "ArrowSwitcher",
overridesResolver: (props, styles2) => styles2.arrowSwitcher
})({
position: "absolute",
right: 12,
top: 15
});
const TIME_CLOCK_DEFAULT_VIEWS = [
"hours",
"minutes"
];
const TimeClock = __mf_14$1(function TimeClock2(inProps, ref) {
const utils = useUtils();
const props = useThemeProps({
props: inProps,
name: "MuiTimeClock"
});
const { ampm = utils.is12HourCycleInCurrentLocale(), ampmInClock = false, autoFocus, slots, slotProps, value: valueProp, defaultValue, referenceDate: referenceDateProp, disableIgnoringDatePartForTimeValidation = false, maxTime, minTime, disableFuture, disablePast, minutesStep = 1, shouldDisableTime, showViewSwitcher, onChange, view: inView, views = TIME_CLOCK_DEFAULT_VIEWS, openTo, onViewChange, focusedView, onFocusedViewChange, className, disabled, readOnly, timezone: timezoneProp } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$A);
const { value, handleValueChange, timezone } = useControlledValueWithTimezone({
name: "TimeClock",
timezone: timezoneProp,
value: valueProp,
defaultValue,
referenceDate: referenceDateProp,
onChange,
valueManager: singleItemValueManager
});
const valueOrReferenceDate = useClockReferenceDate({
value,
referenceDate: referenceDateProp,
utils,
props,
timezone
});
const translations = usePickersTranslations();
const now2 = useNow(timezone);
const { view, setView, previousView, nextView, setValueAndGoToNextView } = useViews({
view: inView,
views,
openTo,
onViewChange,
onChange: handleValueChange,
focusedView,
onFocusedViewChange
});
const { meridiemMode, handleMeridiemChange } = useMeridiemMode(valueOrReferenceDate, ampm, setValueAndGoToNextView);
const isTimeDisabled = __mf_20((rawValue, viewType) => {
const isAfter2 = createIsAfterIgnoreDatePart(disableIgnoringDatePartForTimeValidation, utils);
const shouldCheckPastEnd = viewType === "hours" || viewType === "minutes" && views.includes("seconds");
const containsValidTime = ({ start, end }) => {
if (minTime && isAfter2(minTime, end)) {
return false;
}
if (maxTime && isAfter2(start, maxTime)) {
return false;
}
if (disableFuture && isAfter2(start, now2)) {
return false;
}
if (disablePast && isAfter2(now2, shouldCheckPastEnd ? end : start)) {
return false;
}
return true;
};
const isValidValue = (timeValue, step = 1) => {
if (timeValue % step !== 0) {
return false;
}
if (shouldDisableTime) {
switch (viewType) {
case "hours":
return !shouldDisableTime(utils.setHours(valueOrReferenceDate, timeValue), "hours");
case "minutes":
return !shouldDisableTime(utils.setMinutes(valueOrReferenceDate, timeValue), "minutes");
case "seconds":
return !shouldDisableTime(utils.setSeconds(valueOrReferenceDate, timeValue), "seconds");
default:
return false;
}
}
return true;
};
switch (viewType) {
case "hours": {
const valueWithMeridiem = convertValueToMeridiem(rawValue, meridiemMode, ampm);
const dateWithNewHours = utils.setHours(valueOrReferenceDate, valueWithMeridiem);
if (utils.getHours(dateWithNewHours) !== valueWithMeridiem) {
return true;
}
const start = utils.setSeconds(utils.setMinutes(dateWithNewHours, 0), 0);
const end = utils.setSeconds(utils.setMinutes(dateWithNewHours, 59), 59);
return !containsValidTime({
start,
end
}) || !isValidValue(valueWithMeridiem);
}
case "minutes": {
const dateWithNewMinutes = utils.setMinutes(valueOrReferenceDate, rawValue);
const start = utils.setSeconds(dateWithNewMinutes, 0);
const end = utils.setSeconds(dateWithNewMinutes, 59);
return !containsValidTime({
start,
end
}) || !isValidValue(rawValue, minutesStep);
}
case "seconds": {
const dateWithNewSeconds = utils.setSeconds(valueOrReferenceDate, rawValue);
const start = dateWithNewSeconds;
const end = dateWithNewSeconds;
return !containsValidTime({
start,
end
}) || !isValidValue(rawValue);
}
default:
throw new Error("not supported");
}
}, [
ampm,
valueOrReferenceDate,
disableIgnoringDatePartForTimeValidation,
maxTime,
meridiemMode,
minTime,
minutesStep,
shouldDisableTime,
utils,
disableFuture,
disablePast,
now2,
views
]);
const selectedId = useId();
const viewProps = __mf_29(() => {
switch (view) {
case "hours": {
const handleHoursChange = (hourValue, isFinish) => {
const valueWithMeridiem = convertValueToMeridiem(hourValue, meridiemMode, ampm);
setValueAndGoToNextView(utils.setHours(valueOrReferenceDate, valueWithMeridiem), isFinish, "hours");
};
const viewValue = utils.getHours(valueOrReferenceDate);
let viewRange;
if (ampm) {
if (viewValue > 12) {
viewRange = [
12,
23
];
} else {
viewRange = [
0,
11
];
}
} else {
viewRange = [
0,
23
];
}
return {
onChange: handleHoursChange,
viewValue,
children: getHourNumbers({
value,
utils,
ampm,
getClockNumberText: translations.hoursClockNumberText,
isDisabled: (hourValue) => disabled || isTimeDisabled(hourValue, "hours"),
selectedId
}),
viewRange
};
}
case "minutes": {
const minutesValue = utils.getMinutes(valueOrReferenceDate);
const handleMinutesChange = (minuteValue, isFinish) => {
setValueAndGoToNextView(utils.setMinutes(valueOrReferenceDate, minuteValue), isFinish, "minutes");
};
return {
viewValue: minutesValue,
onChange: handleMinutesChange,
children: getMinutesNumbers({
utils,
value: minutesValue,
getClockNumberText: translations.minutesClockNumberText,
isDisabled: (minuteValue) => disabled || isTimeDisabled(minuteValue, "minutes"),
selectedId
}),
viewRange: [
0,
59
]
};
}
case "seconds": {
const secondsValue = utils.getSeconds(valueOrReferenceDate);
const handleSecondsChange = (secondValue, isFinish) => {
setValueAndGoToNextView(utils.setSeconds(valueOrReferenceDate, secondValue), isFinish, "seconds");
};
return {
viewValue: secondsValue,
onChange: handleSecondsChange,
children: getMinutesNumbers({
utils,
value: secondsValue,
getClockNumberText: translations.secondsClockNumberText,
isDisabled: (secondValue) => disabled || isTimeDisabled(secondValue, "seconds"),
selectedId
}),
viewRange: [
0,
59
]
};
}
default:
throw new Error("You must provide the type for ClockView");
}
}, [
view,
utils,
value,
ampm,
translations.hoursClockNumberText,
translations.minutesClockNumberText,
translations.secondsClockNumberText,
meridiemMode,
setValueAndGoToNextView,
valueOrReferenceDate,
isTimeDisabled,
selectedId,
disabled
]);
const ownerState = props;
const classes = useUtilityClasses$r(ownerState);
return jsxRuntimeExports.jsxs(TimeClockRoot, _extends$1({
ref,
className: clsx(classes.root, className),
ownerState
}, other, {
children: [
jsxRuntimeExports.jsx(Clock, _extends$1({
autoFocus: autoFocus ?? !!focusedView,
ampmInClock: ampmInClock && views.includes("hours"),
value,
type: view,
ampm,
minutesStep,
isTimeDisabled,
meridiemMode,
handleMeridiemChange,
selectedId,
disabled,
readOnly
}, viewProps)),
showViewSwitcher && jsxRuntimeExports.jsx(TimeClockArrowSwitcher, {
className: classes.arrowSwitcher,
slots,
slotProps,
onGoToPrevious: () => setView(previousView),
isPreviousDisabled: !previousView,
previousLabel: translations.openPreviousView,
onGoToNext: () => setView(nextView),
isNextDisabled: !nextView,
nextLabel: translations.openNextView,
ownerState
})
]
}));
});
function getDigitalClockUtilityClass(slot) {
return generateUtilityClass("MuiDigitalClock", slot);
}
generateUtilityClasses("MuiDigitalClock", [
"root",
"list",
"item"
]);
function arrayIncludes(array, itemOrItems) {
if (Array.isArray(itemOrItems)) {
return itemOrItems.every((item) => array.indexOf(item) !== -1);
}
return array.indexOf(itemOrItems) !== -1;
}
const onSpaceOrEnter = (innerFn, externalEvent) => (event) => {
if (event.key === "Enter" || event.key === " ") {
innerFn(event);
event.preventDefault();
event.stopPropagation();
}
};
const getActiveElement = (root = document) => {
const activeEl = root.activeElement;
if (!activeEl) {
return null;
}
if (activeEl.shadowRoot) {
return getActiveElement(activeEl.shadowRoot);
}
return activeEl;
};
const getFocusedListItemIndex = (listElement) => {
const children = Array.from(listElement.children);
return children.indexOf(getActiveElement(document));
};
const DEFAULT_DESKTOP_MODE_MEDIA_QUERY = "@media (pointer: fine)";
const _excluded$z = [
"ampm",
"timeStep",
"autoFocus",
"slots",
"slotProps",
"value",
"defaultValue",
"referenceDate",
"disableIgnoringDatePartForTimeValidation",
"maxTime",
"minTime",
"disableFuture",
"disablePast",
"minutesStep",
"shouldDisableTime",
"onChange",
"view",
"openTo",
"onViewChange",
"focusedView",
"onFocusedViewChange",
"className",
"disabled",
"readOnly",
"views",
"skipDisabled",
"timezone"
];
const useUtilityClasses$q = (ownerState) => {
const { classes } = ownerState;
const slots = {
root: [
"root"
],
list: [
"list"
],
item: [
"item"
]
};
return composeClasses(slots, getDigitalClockUtilityClass, classes);
};
const DigitalClockRoot = styled(PickerViewRoot, {
name: "MuiDigitalClock",
slot: "Root",
overridesResolver: (props, styles2) => styles2.root
})({
overflowY: "auto",
width: "100%",
"@media (prefers-reduced-motion: no-preference)": {
scrollBehavior: "auto"
},
maxHeight: DIGITAL_CLOCK_VIEW_HEIGHT,
variants: [
{
props: {
alreadyRendered: true
},
style: {
"@media (prefers-reduced-motion: no-preference)": {
scrollBehavior: "smooth"
}
}
}
]
});
const DigitalClockList = styled(MenuList, {
name: "MuiDigitalClock",
slot: "List",
overridesResolver: (props, styles2) => styles2.list
})({
padding: 0
});
const DigitalClockItem = styled(MenuItem, {
name: "MuiDigitalClock",
slot: "Item",
overridesResolver: (props, styles2) => styles2.item
})(({ theme }) => ({
padding: "8px 16px",
margin: "2px 4px",
"&:first-of-type": {
marginTop: 4
},
"&:hover": {
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : __mf_133(theme.palette.primary.main, theme.palette.action.hoverOpacity)
},
"&.Mui-selected": {
backgroundColor: (theme.vars || theme).palette.primary.main,
color: (theme.vars || theme).palette.primary.contrastText,
"&:focus-visible, &:hover": {
backgroundColor: (theme.vars || theme).palette.primary.dark
}
},
"&.Mui-focusVisible": {
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.focusOpacity})` : __mf_133(theme.palette.primary.main, theme.palette.action.focusOpacity)
}
}));
const DigitalClock = __mf_14$1(function DigitalClock2(inProps, ref) {
const utils = useUtils();
const containerRef = __mf_31(null);
const handleRef = useForkRef(ref, containerRef);
const listRef = __mf_31(null);
const props = useThemeProps({
props: inProps,
name: "MuiDigitalClock"
});
const { ampm = utils.is12HourCycleInCurrentLocale(), timeStep = 30, autoFocus, slots, slotProps, value: valueProp, defaultValue, referenceDate: referenceDateProp, disableIgnoringDatePartForTimeValidation = false, maxTime, minTime, disableFuture, disablePast, minutesStep = 1, shouldDisableTime, onChange, view: inView, openTo, onViewChange, focusedView, onFocusedViewChange, className, disabled, readOnly, views = [
"hours"
], skipDisabled = false, timezone: timezoneProp } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$z);
const { value, handleValueChange: handleRawValueChange, timezone } = useControlledValueWithTimezone({
name: "DigitalClock",
timezone: timezoneProp,
value: valueProp,
defaultValue,
referenceDate: referenceDateProp,
onChange,
valueManager: singleItemValueManager
});
const translations = usePickersTranslations();
const now2 = useNow(timezone);
const ownerState = __mf_29(() => _extends$1({}, props, {
alreadyRendered: !!containerRef.current
}), [
props
]);
const classes = useUtilityClasses$q(ownerState);
const ClockItem = (slots == null ? void 0 : slots.digitalClockItem) ?? DigitalClockItem;
const clockItemProps = useSlotProps({
elementType: ClockItem,
externalSlotProps: slotProps == null ? void 0 : slotProps.digitalClockItem,
ownerState: {},
className: classes.item
});
const valueOrReferenceDate = useClockReferenceDate({
value,
referenceDate: referenceDateProp,
utils,
props,
timezone
});
const handleValueChange = useEventCallback((newValue) => handleRawValueChange(newValue, "finish", "hours"));
const { setValueAndGoToNextView } = useViews({
view: inView,
views,
openTo,
onViewChange,
onChange: handleValueChange,
focusedView,
onFocusedViewChange
});
const handleItemSelect = useEventCallback((newValue) => {
setValueAndGoToNextView(newValue, "finish");
});
__mf_24(() => {
if (containerRef.current === null) {
return;
}
const activeItem = containerRef.current.querySelector('[role="listbox"] [role="option"][tabindex="0"], [role="listbox"] [role="option"][aria-selected="true"]');
if (!activeItem) {
return;
}
const offsetTop = activeItem.offsetTop;
if (autoFocus || !!focusedView) {
activeItem.focus();
}
containerRef.current.scrollTop = offsetTop - 4;
});
const isTimeDisabled = __mf_20((valueToCheck) => {
const isAfter2 = createIsAfterIgnoreDatePart(disableIgnoringDatePartForTimeValidation, utils);
const containsValidTime = () => {
if (minTime && isAfter2(minTime, valueToCheck)) {
return false;
}
if (maxTime && isAfter2(valueToCheck, maxTime)) {
return false;
}
if (disableFuture && isAfter2(valueToCheck, now2)) {
return false;
}
if (disablePast && isAfter2(now2, valueToCheck)) {
return false;
}
return true;
};
const isValidValue = () => {
if (utils.getMinutes(valueToCheck) % minutesStep !== 0) {
return false;
}
if (shouldDisableTime) {
return !shouldDisableTime(valueToCheck, "hours");
}
return true;
};
return !containsValidTime() || !isValidValue();
}, [
disableIgnoringDatePartForTimeValidation,
utils,
minTime,
maxTime,
disableFuture,
now2,
disablePast,
minutesStep,
shouldDisableTime
]);
const timeOptions = __mf_29(() => {
const result = [];
const startOfDay = utils.startOfDay(valueOrReferenceDate);
let nextTimeStepOption = startOfDay;
while (utils.isSameDay(valueOrReferenceDate, nextTimeStepOption)) {
result.push(nextTimeStepOption);
nextTimeStepOption = utils.addMinutes(nextTimeStepOption, timeStep);
}
return result;
}, [
valueOrReferenceDate,
timeStep,
utils
]);
const focusedOptionIndex = timeOptions.findIndex((option) => utils.isEqual(option, valueOrReferenceDate));
const handleKeyDown = (event) => {
switch (event.key) {
case "PageUp": {
const newIndex = getFocusedListItemIndex(listRef.current) - 5;
const children = listRef.current.children;
const newFocusedIndex = Math.max(0, newIndex);
const childToFocus = children[newFocusedIndex];
if (childToFocus) {
childToFocus.focus();
}
event.preventDefault();
break;
}
case "PageDown": {
const newIndex = getFocusedListItemIndex(listRef.current) + 5;
const children = listRef.current.children;
const newFocusedIndex = Math.min(children.length - 1, newIndex);
const childToFocus = children[newFocusedIndex];
if (childToFocus) {
childToFocus.focus();
}
event.preventDefault();
break;
}
}
};
return jsxRuntimeExports.jsx(DigitalClockRoot, _extends$1({
ref: handleRef,
className: clsx(classes.root, className),
ownerState
}, other, {
children: jsxRuntimeExports.jsx(DigitalClockList, {
ref: listRef,
role: "listbox",
"aria-label": translations.timePickerToolbarTitle,
className: classes.list,
onKeyDown: handleKeyDown,
children: timeOptions.map((option, index) => {
if (skipDisabled && isTimeDisabled(option)) {
return null;
}
const isSelected = utils.isEqual(option, value);
const formattedValue = utils.format(option, ampm ? "fullTime12h" : "fullTime24h");
const tabIndex = focusedOptionIndex === index || focusedOptionIndex === -1 && index === 0 ? 0 : -1;
return jsxRuntimeExports.jsx(ClockItem, _extends$1({
onClick: () => !readOnly && handleItemSelect(option),
selected: isSelected,
disabled: disabled || isTimeDisabled(option),
disableRipple: readOnly,
role: "option",
"aria-disabled": readOnly,
"aria-selected": isSelected,
tabIndex
}, clockItemProps, {
children: formattedValue
}), `${option.valueOf()}-${formattedValue}`);
})
})
}));
});
function getMultiSectionDigitalClockUtilityClass(slot) {
return generateUtilityClass("MuiMultiSectionDigitalClock", slot);
}
generateUtilityClasses("MuiMultiSectionDigitalClock", [
"root"
]);
function getMultiSectionDigitalClockSectionUtilityClass(slot) {
return generateUtilityClass("MuiMultiSectionDigitalClockSection", slot);
}
generateUtilityClasses("MuiMultiSectionDigitalClockSection", [
"root",
"item"
]);
const _excluded$y = [
"autoFocus",
"onChange",
"className",
"disabled",
"readOnly",
"items",
"active",
"slots",
"slotProps",
"skipDisabled"
];
const useUtilityClasses$p = (ownerState) => {
const { classes } = ownerState;
const slots = {
root: [
"root"
],
item: [
"item"
]
};
return composeClasses(slots, getMultiSectionDigitalClockSectionUtilityClass, classes);
};
const MultiSectionDigitalClockSectionRoot = styled(MenuList, {
name: "MuiMultiSectionDigitalClockSection",
slot: "Root",
overridesResolver: (_, styles2) => styles2.root
})(({ theme }) => ({
maxHeight: DIGITAL_CLOCK_VIEW_HEIGHT,
width: 56,
padding: 0,
overflow: "hidden",
"@media (prefers-reduced-motion: no-preference)": {
scrollBehavior: "auto"
},
"@media (pointer: fine)": {
"&:hover": {
overflowY: "auto"
}
},
"@media (pointer: none), (pointer: coarse)": {
overflowY: "auto"
},
"&:not(:first-of-type)": {
borderLeft: `1px solid ${(theme.vars || theme).palette.divider}`
},
"&::after": {
display: "block",
content: '""',
height: "calc(100% - 40px - 6px)"
},
variants: [
{
props: {
alreadyRendered: true
},
style: {
"@media (prefers-reduced-motion: no-preference)": {
scrollBehavior: "smooth"
}
}
}
]
}));
const MultiSectionDigitalClockSectionItem = styled(MenuItem, {
name: "MuiMultiSectionDigitalClockSection",
slot: "Item",
overridesResolver: (_, styles2) => styles2.item
})(({ theme }) => ({
padding: 8,
margin: "2px 4px",
width: MULTI_SECTION_CLOCK_SECTION_WIDTH,
justifyContent: "center",
"&:first-of-type": {
marginTop: 4
},
"&:hover": {
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : __mf_133(theme.palette.primary.main, theme.palette.action.hoverOpacity)
},
"&.Mui-selected": {
backgroundColor: (theme.vars || theme).palette.primary.main,
color: (theme.vars || theme).palette.primary.contrastText,
"&:focus-visible, &:hover": {
backgroundColor: (theme.vars || theme).palette.primary.dark
}
},
"&.Mui-focusVisible": {
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.focusOpacity})` : __mf_133(theme.palette.primary.main, theme.palette.action.focusOpacity)
}
}));
const MultiSectionDigitalClockSection = __mf_14$1(function MultiSectionDigitalClockSection2(inProps, ref) {
const containerRef = __mf_31(null);
const handleRef = useForkRef(ref, containerRef);
const previousActive = __mf_31(null);
const props = useThemeProps({
props: inProps,
name: "MuiMultiSectionDigitalClockSection"
});
const { autoFocus, onChange, className, disabled, readOnly, items, active, slots, slotProps, skipDisabled } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$y);
const ownerState = __mf_29(() => _extends$1({}, props, {
alreadyRendered: !!containerRef.current
}), [
props
]);
const classes = useUtilityClasses$p(ownerState);
const DigitalClockSectionItem = (slots == null ? void 0 : slots.digitalClockSectionItem) ?? MultiSectionDigitalClockSectionItem;
__mf_24(() => {
if (containerRef.current === null) {
return;
}
const activeItem = containerRef.current.querySelector('[role="option"][tabindex="0"], [role="option"][aria-selected="true"]');
if (active && autoFocus && activeItem) {
activeItem.focus();
}
if (!activeItem || previousActive.current === activeItem) {
return;
}
previousActive.current = activeItem;
const offsetTop = activeItem.offsetTop;
containerRef.current.scrollTop = offsetTop - 4;
});
const focusedOptionIndex = items.findIndex((item) => item.isFocused(item.value));
const handleKeyDown = (event) => {
switch (event.key) {
case "PageUp": {
const newIndex = getFocusedListItemIndex(containerRef.current) - 5;
const children = containerRef.current.children;
const newFocusedIndex = Math.max(0, newIndex);
const childToFocus = children[newFocusedIndex];
if (childToFocus) {
childToFocus.focus();
}
event.preventDefault();
break;
}
case "PageDown": {
const newIndex = getFocusedListItemIndex(containerRef.current) + 5;
const children = containerRef.current.children;
const newFocusedIndex = Math.min(children.length - 1, newIndex);
const childToFocus = children[newFocusedIndex];
if (childToFocus) {
childToFocus.focus();
}
event.preventDefault();
break;
}
}
};
return jsxRuntimeExports.jsx(MultiSectionDigitalClockSectionRoot, _extends$1({
ref: handleRef,
className: clsx(classes.root, className),
ownerState,
autoFocusItem: autoFocus && active,
role: "listbox",
onKeyDown: handleKeyDown
}, other, {
children: items.map((option, index) => {
var _a;
const isItemDisabled = (_a = option.isDisabled) == null ? void 0 : _a.call(option, option.value);
const isDisabled = disabled || isItemDisabled;
if (skipDisabled && isDisabled) {
return null;
}
const isSelected = option.isSelected(option.value);
const tabIndex = focusedOptionIndex === index || focusedOptionIndex === -1 && index === 0 ? 0 : -1;
return jsxRuntimeExports.jsx(DigitalClockSectionItem, _extends$1({
onClick: () => !readOnly && onChange(option.value),
selected: isSelected,
disabled: isDisabled,
disableRipple: readOnly,
role: "option",
"aria-disabled": readOnly || isDisabled || void 0,
"aria-label": option.ariaLabel,
"aria-selected": isSelected,
tabIndex,
className: classes.item
}, slotProps == null ? void 0 : slotProps.digitalClockSectionItem, {
children: option.label
}), option.label);
})
}));
});
const getHourSectionOptions = ({ now: now2, value, utils, ampm, isDisabled, resolveAriaLabel, timeStep, valueOrReferenceDate }) => {
const currentHours = value ? utils.getHours(value) : null;
const result = [];
const isSelected = (hour, overriddenCurrentHours) => {
const resolvedCurrentHours = overriddenCurrentHours ?? currentHours;
if (resolvedCurrentHours === null) {
return false;
}
if (ampm) {
if (hour === 12) {
return resolvedCurrentHours === 12 || resolvedCurrentHours === 0;
}
return resolvedCurrentHours === hour || resolvedCurrentHours - 12 === hour;
}
return resolvedCurrentHours === hour;
};
const isFocused = (hour) => {
return isSelected(hour, utils.getHours(valueOrReferenceDate));
};
const endHour = ampm ? 11 : 23;
for (let hour = 0; hour <= endHour; hour += timeStep) {
let label = utils.format(utils.setHours(now2, hour), ampm ? "hours12h" : "hours24h");
const ariaLabel = resolveAriaLabel(parseInt(label, 10).toString());
label = utils.formatNumber(label);
result.push({
value: hour,
label,
isSelected,
isDisabled,
isFocused,
ariaLabel
});
}
return result;
};
const getTimeSectionOptions = ({ value, utils, isDisabled, timeStep, resolveLabel, resolveAriaLabel, hasValue = true }) => {
const isSelected = (timeValue) => {
if (value === null) {
return false;
}
return hasValue && value === timeValue;
};
const isFocused = (timeValue) => {
return value === timeValue;
};
return [
...Array.from({
length: Math.ceil(60 / timeStep)
}, (_, index) => {
const timeValue = timeStep * index;
return {
value: timeValue,
label: utils.formatNumber(resolveLabel(timeValue)),
isDisabled,
isSelected,
isFocused,
ariaLabel: resolveAriaLabel(timeValue.toString())
};
})
];
};
const _excluded$x = [
"ampm",
"timeSteps",
"autoFocus",
"slots",
"slotProps",
"value",
"defaultValue",
"referenceDate",
"disableIgnoringDatePartForTimeValidation",
"maxTime",
"minTime",
"disableFuture",
"disablePast",
"minutesStep",
"shouldDisableTime",
"onChange",
"view",
"views",
"openTo",
"onViewChange",
"focusedView",
"onFocusedViewChange",
"className",
"disabled",
"readOnly",
"skipDisabled",
"timezone"
];
const useUtilityClasses$o = (ownerState) => {
const { classes } = ownerState;
const slots = {
root: [
"root"
]
};
return composeClasses(slots, getMultiSectionDigitalClockUtilityClass, classes);
};
const MultiSectionDigitalClockRoot = styled(PickerViewRoot, {
name: "MuiMultiSectionDigitalClock",
slot: "Root",
overridesResolver: (_, styles2) => styles2.root
})(({ theme }) => ({
display: "flex",
flexDirection: "row",
width: "100%",
borderBottom: `1px solid ${(theme.vars || theme).palette.divider}`
}));
const MultiSectionDigitalClock = __mf_14$1(function MultiSectionDigitalClock2(inProps, ref) {
const utils = useUtils();
const isRtl = useRtl();
const props = useThemeProps({
props: inProps,
name: "MuiMultiSectionDigitalClock"
});
const { ampm = utils.is12HourCycleInCurrentLocale(), timeSteps: inTimeSteps, autoFocus, slots, slotProps, value: valueProp, defaultValue, referenceDate: referenceDateProp, disableIgnoringDatePartForTimeValidation = false, maxTime, minTime, disableFuture, disablePast, minutesStep = 1, shouldDisableTime, onChange, view: inView, views: inViews = [
"hours",
"minutes"
], openTo, onViewChange, focusedView: inFocusedView, onFocusedViewChange, className, disabled, readOnly, skipDisabled = false, timezone: timezoneProp } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$x);
const { value, handleValueChange: handleRawValueChange, timezone } = useControlledValueWithTimezone({
name: "MultiSectionDigitalClock",
timezone: timezoneProp,
value: valueProp,
defaultValue,
referenceDate: referenceDateProp,
onChange,
valueManager: singleItemValueManager
});
const translations = usePickersTranslations();
const now2 = useNow(timezone);
const timeSteps = __mf_29(() => _extends$1({
hours: 1,
minutes: 5,
seconds: 5
}, inTimeSteps), [
inTimeSteps
]);
const valueOrReferenceDate = useClockReferenceDate({
value,
referenceDate: referenceDateProp,
utils,
props,
timezone
});
const handleValueChange = useEventCallback((newValue, selectionState, selectedView) => handleRawValueChange(newValue, selectionState, selectedView));
const views = __mf_29(() => {
if (!ampm || !inViews.includes("hours")) {
return inViews;
}
return inViews.includes("meridiem") ? inViews : [
...inViews,
"meridiem"
];
}, [
ampm,
inViews
]);
const { view, setValueAndGoToNextView, focusedView } = useViews({
view: inView,
views,
openTo,
onViewChange,
onChange: handleValueChange,
focusedView: inFocusedView,
onFocusedViewChange
});
const handleMeridiemValueChange = useEventCallback((newValue) => {
setValueAndGoToNextView(newValue, "finish", "meridiem");
});
const { meridiemMode, handleMeridiemChange } = useMeridiemMode(valueOrReferenceDate, ampm, handleMeridiemValueChange, "finish");
const isTimeDisabled = __mf_20((rawValue, viewType) => {
const isAfter2 = createIsAfterIgnoreDatePart(disableIgnoringDatePartForTimeValidation, utils);
const shouldCheckPastEnd = viewType === "hours" || viewType === "minutes" && views.includes("seconds");
const containsValidTime = ({ start, end }) => {
if (minTime && isAfter2(minTime, end)) {
return false;
}
if (maxTime && isAfter2(start, maxTime)) {
return false;
}
if (disableFuture && isAfter2(start, now2)) {
return false;
}
if (disablePast && isAfter2(now2, shouldCheckPastEnd ? end : start)) {
return false;
}
return true;
};
const isValidValue = (timeValue, step = 1) => {
if (timeValue % step !== 0) {
return false;
}
if (shouldDisableTime) {
switch (viewType) {
case "hours":
return !shouldDisableTime(utils.setHours(valueOrReferenceDate, timeValue), "hours");
case "minutes":
return !shouldDisableTime(utils.setMinutes(valueOrReferenceDate, timeValue), "minutes");
case "seconds":
return !shouldDisableTime(utils.setSeconds(valueOrReferenceDate, timeValue), "seconds");
default:
return false;
}
}
return true;
};
switch (viewType) {
case "hours": {
const valueWithMeridiem = convertValueToMeridiem(rawValue, meridiemMode, ampm);
const dateWithNewHours = utils.setHours(valueOrReferenceDate, valueWithMeridiem);
if (utils.getHours(dateWithNewHours) !== valueWithMeridiem) {
return true;
}
const start = utils.setSeconds(utils.setMinutes(dateWithNewHours, 0), 0);
const end = utils.setSeconds(utils.setMinutes(dateWithNewHours, 59), 59);
return !containsValidTime({
start,
end
}) || !isValidValue(valueWithMeridiem);
}
case "minutes": {
const dateWithNewMinutes = utils.setMinutes(valueOrReferenceDate, rawValue);
const start = utils.setSeconds(dateWithNewMinutes, 0);
const end = utils.setSeconds(dateWithNewMinutes, 59);
return !containsValidTime({
start,
end
}) || !isValidValue(rawValue, minutesStep);
}
case "seconds": {
const dateWithNewSeconds = utils.setSeconds(valueOrReferenceDate, rawValue);
const start = dateWithNewSeconds;
const end = dateWithNewSeconds;
return !containsValidTime({
start,
end
}) || !isValidValue(rawValue);
}
default:
throw new Error("not supported");
}
}, [
ampm,
valueOrReferenceDate,
disableIgnoringDatePartForTimeValidation,
maxTime,
meridiemMode,
minTime,
minutesStep,
shouldDisableTime,
utils,
disableFuture,
disablePast,
now2,
views
]);
const buildViewProps = __mf_20((viewToBuild) => {
switch (viewToBuild) {
case "hours": {
return {
onChange: (hours2) => {
const valueWithMeridiem = convertValueToMeridiem(hours2, meridiemMode, ampm);
setValueAndGoToNextView(utils.setHours(valueOrReferenceDate, valueWithMeridiem), "finish", "hours");
},
items: getHourSectionOptions({
now: now2,
value,
ampm,
utils,
isDisabled: (hours2) => isTimeDisabled(hours2, "hours"),
timeStep: timeSteps.hours,
resolveAriaLabel: translations.hoursClockNumberText,
valueOrReferenceDate
})
};
}
case "minutes": {
return {
onChange: (minutes2) => {
setValueAndGoToNextView(utils.setMinutes(valueOrReferenceDate, minutes2), "finish", "minutes");
},
items: getTimeSectionOptions({
value: utils.getMinutes(valueOrReferenceDate),
utils,
isDisabled: (minutes2) => isTimeDisabled(minutes2, "minutes"),
resolveLabel: (minutes2) => utils.format(utils.setMinutes(now2, minutes2), "minutes"),
timeStep: timeSteps.minutes,
hasValue: !!value,
resolveAriaLabel: translations.minutesClockNumberText
})
};
}
case "seconds": {
return {
onChange: (seconds2) => {
setValueAndGoToNextView(utils.setSeconds(valueOrReferenceDate, seconds2), "finish", "seconds");
},
items: getTimeSectionOptions({
value: utils.getSeconds(valueOrReferenceDate),
utils,
isDisabled: (seconds2) => isTimeDisabled(seconds2, "seconds"),
resolveLabel: (seconds2) => utils.format(utils.setSeconds(now2, seconds2), "seconds"),
timeStep: timeSteps.seconds,
hasValue: !!value,
resolveAriaLabel: translations.secondsClockNumberText
})
};
}
case "meridiem": {
const amLabel = formatMeridiem(utils, "am");
const pmLabel = formatMeridiem(utils, "pm");
return {
onChange: handleMeridiemChange,
items: [
{
value: "am",
label: amLabel,
isSelected: () => !!value && meridiemMode === "am",
isFocused: () => !!valueOrReferenceDate && meridiemMode === "am",
ariaLabel: amLabel
},
{
value: "pm",
label: pmLabel,
isSelected: () => !!value && meridiemMode === "pm",
isFocused: () => !!valueOrReferenceDate && meridiemMode === "pm",
ariaLabel: pmLabel
}
]
};
}
default:
throw new Error(`Unknown view: ${viewToBuild} found.`);
}
}, [
now2,
value,
ampm,
utils,
timeSteps.hours,
timeSteps.minutes,
timeSteps.seconds,
translations.hoursClockNumberText,
translations.minutesClockNumberText,
translations.secondsClockNumberText,
meridiemMode,
setValueAndGoToNextView,
valueOrReferenceDate,
isTimeDisabled,
handleMeridiemChange
]);
const viewsToRender = __mf_29(() => {
if (!isRtl) {
return views;
}
const digitViews = views.filter((v) => v !== "meridiem");
digitViews.reverse();
if (views.includes("meridiem")) {
digitViews.push("meridiem");
}
return digitViews;
}, [
isRtl,
views
]);
const viewTimeOptions = __mf_29(() => {
return views.reduce((result, currentView) => {
return _extends$1({}, result, {
[currentView]: buildViewProps(currentView)
});
}, {});
}, [
views,
buildViewProps
]);
const ownerState = props;
const classes = useUtilityClasses$o(ownerState);
return jsxRuntimeExports.jsx(MultiSectionDigitalClockRoot, _extends$1({
ref,
className: clsx(classes.root, className),
ownerState,
role: "group"
}, other, {
children: viewsToRender.map((timeView) => jsxRuntimeExports.jsx(MultiSectionDigitalClockSection, {
items: viewTimeOptions[timeView].items,
onChange: viewTimeOptions[timeView].onChange,
active: view === timeView,
autoFocus: autoFocus || focusedView === timeView,
disabled,
readOnly,
slots,
slotProps,
skipDisabled,
"aria-label": translations.selectViewText(timeView)
}, timeView))
}));
});
function getPickersDayUtilityClass(slot) {
return generateUtilityClass("MuiPickersDay", slot);
}
const pickersDayClasses = generateUtilityClasses("MuiPickersDay", [
"root",
"dayWithMargin",
"dayOutsideMonth",
"hiddenDaySpacingFiller",
"today",
"selected",
"disabled"
]);
const _excluded$w = [
"autoFocus",
"className",
"day",
"disabled",
"disableHighlightToday",
"disableMargin",
"hidden",
"isAnimating",
"onClick",
"onDaySelect",
"onFocus",
"onBlur",
"onKeyDown",
"onMouseDown",
"onMouseEnter",
"outsideCurrentMonth",
"selected",
"showDaysOutsideCurrentMonth",
"children",
"today",
"isFirstVisibleCell",
"isLastVisibleCell"
];
const useUtilityClasses$n = (ownerState) => {
const { selected, disableMargin, disableHighlightToday, today, disabled, outsideCurrentMonth, showDaysOutsideCurrentMonth, classes } = ownerState;
const isHiddenDaySpacingFiller = outsideCurrentMonth && !showDaysOutsideCurrentMonth;
const slots = {
root: [
"root",
selected && !isHiddenDaySpacingFiller && "selected",
disabled && "disabled",
!disableMargin && "dayWithMargin",
!disableHighlightToday && today && "today",
outsideCurrentMonth && showDaysOutsideCurrentMonth && "dayOutsideMonth",
isHiddenDaySpacingFiller && "hiddenDaySpacingFiller"
],
hiddenDaySpacingFiller: [
"hiddenDaySpacingFiller"
]
};
return composeClasses(slots, getPickersDayUtilityClass, classes);
};
const styleArg = ({ theme }) => _extends$1({}, theme.typography.caption, {
width: DAY_SIZE,
height: DAY_SIZE,
borderRadius: "50%",
padding: 0,
backgroundColor: "transparent",
transition: theme.transitions.create("background-color", {
duration: theme.transitions.duration.short
}),
color: (theme.vars || theme).palette.text.primary,
"@media (pointer: fine)": {
"&:hover": {
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : __mf_133(theme.palette.primary.main, theme.palette.action.hoverOpacity)
}
},
"&:focus": {
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.focusOpacity})` : __mf_133(theme.palette.primary.main, theme.palette.action.focusOpacity),
[`&.${pickersDayClasses.selected}`]: {
willChange: "background-color",
backgroundColor: (theme.vars || theme).palette.primary.dark
}
},
[`&.${pickersDayClasses.selected}`]: {
color: (theme.vars || theme).palette.primary.contrastText,
backgroundColor: (theme.vars || theme).palette.primary.main,
fontWeight: theme.typography.fontWeightMedium,
"&:hover": {
willChange: "background-color",
backgroundColor: (theme.vars || theme).palette.primary.dark
}
},
[`&.${pickersDayClasses.disabled}:not(.${pickersDayClasses.selected})`]: {
color: (theme.vars || theme).palette.text.disabled
},
[`&.${pickersDayClasses.disabled}&.${pickersDayClasses.selected}`]: {
opacity: 0.6
},
variants: [
{
props: {
disableMargin: false
},
style: {
margin: `0 ${DAY_MARGIN}px`
}
},
{
props: {
outsideCurrentMonth: true,
showDaysOutsideCurrentMonth: true
},
style: {
color: (theme.vars || theme).palette.text.secondary
}
},
{
props: {
disableHighlightToday: false,
today: true
},
style: {
[`&:not(.${pickersDayClasses.selected})`]: {
border: `1px solid ${(theme.vars || theme).palette.text.secondary}`
}
}
}
]
});
const overridesResolver = (props, styles2) => {
const { ownerState } = props;
return [
styles2.root,
!ownerState.disableMargin && styles2.dayWithMargin,
!ownerState.disableHighlightToday && ownerState.today && styles2.today,
!ownerState.outsideCurrentMonth && ownerState.showDaysOutsideCurrentMonth && styles2.dayOutsideMonth,
ownerState.outsideCurrentMonth && !ownerState.showDaysOutsideCurrentMonth && styles2.hiddenDaySpacingFiller
];
};
const PickersDayRoot = styled(ButtonBase, {
name: "MuiPickersDay",
slot: "Root",
overridesResolver
})(styleArg);
const PickersDayFiller = styled("div", {
name: "MuiPickersDay",
slot: "Root",
overridesResolver
})(({ theme }) => _extends$1({}, styleArg({
theme
}), {
opacity: 0,
pointerEvents: "none"
}));
const noop = () => {
};
const PickersDayRaw = __mf_14$1(function PickersDay2(inProps, forwardedRef) {
const props = useThemeProps({
props: inProps,
name: "MuiPickersDay"
});
const { autoFocus = false, className, day, disabled = false, disableHighlightToday = false, disableMargin = false, isAnimating, onClick, onDaySelect, onFocus = noop, onBlur = noop, onKeyDown = noop, onMouseDown = noop, onMouseEnter = noop, outsideCurrentMonth, selected = false, showDaysOutsideCurrentMonth = false, children, today: isToday = false } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$w);
const ownerState = _extends$1({}, props, {
autoFocus,
disabled,
disableHighlightToday,
disableMargin,
selected,
showDaysOutsideCurrentMonth,
today: isToday
});
const classes = useUtilityClasses$n(ownerState);
const utils = useUtils();
const ref = __mf_31(null);
const handleRef = useForkRef(ref, forwardedRef);
useEnhancedEffect(() => {
if (autoFocus && !disabled && !isAnimating && !outsideCurrentMonth) {
ref.current.focus();
}
}, [
autoFocus,
disabled,
isAnimating,
outsideCurrentMonth
]);
const handleMouseDown = (event) => {
onMouseDown(event);
if (outsideCurrentMonth) {
event.preventDefault();
}
};
const handleClick = (event) => {
if (!disabled) {
onDaySelect(day);
}
if (outsideCurrentMonth) {
event.currentTarget.focus();
}
if (onClick) {
onClick(event);
}
};
if (outsideCurrentMonth && !showDaysOutsideCurrentMonth) {
return jsxRuntimeExports.jsx(PickersDayFiller, {
className: clsx(classes.root, classes.hiddenDaySpacingFiller, className),
ownerState,
role: other.role
});
}
return jsxRuntimeExports.jsx(PickersDayRoot, _extends$1({
className: clsx(classes.root, className),
ref: handleRef,
centerRipple: true,
disabled,
tabIndex: selected ? 0 : -1,
onKeyDown: (event) => onKeyDown(event, day),
onFocus: (event) => onFocus(event, day),
onBlur: (event) => onBlur(event, day),
onMouseEnter: (event) => onMouseEnter(event, day),
onClick: handleClick,
onMouseDown: handleMouseDown
}, other, {
ownerState,
children: !children ? utils.format(day, "dayOfMonth") : children
}));
});
const PickersDay = __mf_17(PickersDayRaw);
const validateDate = ({ props, value, timezone, adapter }) => {
if (value === null) {
return null;
}
const { shouldDisableDate, shouldDisableMonth, shouldDisableYear, disablePast, disableFuture } = props;
const now2 = adapter.utils.date(void 0, timezone);
const minDate = applyDefaultDate(adapter.utils, props.minDate, adapter.defaultDates.minDate);
const maxDate = applyDefaultDate(adapter.utils, props.maxDate, adapter.defaultDates.maxDate);
switch (true) {
case !adapter.utils.isValid(value):
return "invalidDate";
case Boolean(shouldDisableDate && shouldDisableDate(value)):
return "shouldDisableDate";
case Boolean(shouldDisableMonth && shouldDisableMonth(value)):
return "shouldDisableMonth";
case Boolean(shouldDisableYear && shouldDisableYear(value)):
return "shouldDisableYear";
case Boolean(disableFuture && adapter.utils.isAfterDay(value, now2)):
return "disableFuture";
case Boolean(disablePast && adapter.utils.isBeforeDay(value, now2)):
return "disablePast";
case Boolean(minDate && adapter.utils.isBeforeDay(value, minDate)):
return "minDate";
case Boolean(maxDate && adapter.utils.isAfterDay(value, maxDate)):
return "maxDate";
default:
return null;
}
};
validateDate.valueManager = singleItemValueManager;
const validateTime = ({ adapter, value, timezone, props }) => {
if (value === null) {
return null;
}
const { minTime, maxTime, minutesStep, shouldDisableTime, disableIgnoringDatePartForTimeValidation = false, disablePast, disableFuture } = props;
const now2 = adapter.utils.date(void 0, timezone);
const isAfter2 = createIsAfterIgnoreDatePart(disableIgnoringDatePartForTimeValidation, adapter.utils);
switch (true) {
case !adapter.utils.isValid(value):
return "invalidDate";
case Boolean(minTime && isAfter2(minTime, value)):
return "minTime";
case Boolean(maxTime && isAfter2(value, maxTime)):
return "maxTime";
case Boolean(disableFuture && adapter.utils.isAfter(value, now2)):
return "disableFuture";
case Boolean(disablePast && adapter.utils.isBefore(value, now2)):
return "disablePast";
case Boolean(shouldDisableTime && shouldDisableTime(value, "hours")):
return "shouldDisableTime-hours";
case Boolean(shouldDisableTime && shouldDisableTime(value, "minutes")):
return "shouldDisableTime-minutes";
case Boolean(shouldDisableTime && shouldDisableTime(value, "seconds")):
return "shouldDisableTime-seconds";
case Boolean(minutesStep && adapter.utils.getMinutes(value) % minutesStep !== 0):
return "minutesStep";
default:
return null;
}
};
validateTime.valueManager = singleItemValueManager;
const DATE_VALIDATION_PROP_NAMES = [
"disablePast",
"disableFuture",
"minDate",
"maxDate",
"shouldDisableDate",
"shouldDisableMonth",
"shouldDisableYear"
];
const TIME_VALIDATION_PROP_NAMES = [
"disablePast",
"disableFuture",
"minTime",
"maxTime",
"shouldDisableTime",
"minutesStep",
"ampm",
"disableIgnoringDatePartForTimeValidation"
];
const DATE_TIME_VALIDATION_PROP_NAMES = [
"minDateTime",
"maxDateTime"
];
const VALIDATION_PROP_NAMES = [
...DATE_VALIDATION_PROP_NAMES,
...TIME_VALIDATION_PROP_NAMES,
...DATE_TIME_VALIDATION_PROP_NAMES
];
const extractValidationProps = (props) => VALIDATION_PROP_NAMES.reduce((extractedProps, propName) => {
if (props.hasOwnProperty(propName)) {
extractedProps[propName] = props[propName];
}
return extractedProps;
}, {});
function useValidation(options) {
const { props, validator, value, timezone, onError } = options;
const adapter = useLocalizationContext();
const previousValidationErrorRef = __mf_31(validator.valueManager.defaultErrorState);
const validationError = validator({
adapter,
value,
timezone,
props
});
const hasValidationError = validator.valueManager.hasError(validationError);
__mf_24(() => {
if (onError && !validator.valueManager.isSameError(validationError, previousValidationErrorRef.current)) {
onError(validationError, value);
}
previousValidationErrorRef.current = validationError;
}, [
validator,
onError,
validationError,
value
]);
const getValidationErrorForNewValue = useEventCallback((newValue) => {
return validator({
adapter,
value: newValue,
timezone,
props
});
});
return {
validationError,
hasValidationError,
getValidationErrorForNewValue
};
}
const expandFormat = ({ utils, format: format2 }) => {
let formatExpansionOverflow = 10;
let prevFormat = format2;
let nextFormat = utils.expandFormat(format2);
while (nextFormat !== prevFormat) {
prevFormat = nextFormat;
nextFormat = utils.expandFormat(prevFormat);
formatExpansionOverflow -= 1;
if (formatExpansionOverflow < 0) {
throw new Error("MUI X: The format expansion seems to be in an infinite loop. Please open an issue with the format passed to the picker component.");
}
}
return nextFormat;
};
const getEscapedPartsFromFormat = ({ utils, expandedFormat }) => {
const escapedParts = [];
const { start: startChar, end: endChar } = utils.escapedCharacters;
const regExp = new RegExp(`(\\${startChar}[^\\${endChar}]*\\${endChar})+`, "g");
let match = null;
while (match = regExp.exec(expandedFormat)) {
escapedParts.push({
start: match.index,
end: regExp.lastIndex - 1
});
}
return escapedParts;
};
const getSectionPlaceholder = (utils, localeText, sectionConfig, sectionFormat) => {
switch (sectionConfig.type) {
case "year": {
return localeText.fieldYearPlaceholder({
digitAmount: utils.formatByString(utils.date(void 0, "default"), sectionFormat).length,
format: sectionFormat
});
}
case "month": {
return localeText.fieldMonthPlaceholder({
contentType: sectionConfig.contentType,
format: sectionFormat
});
}
case "day": {
return localeText.fieldDayPlaceholder({
format: sectionFormat
});
}
case "weekDay": {
return localeText.fieldWeekDayPlaceholder({
contentType: sectionConfig.contentType,
format: sectionFormat
});
}
case "hours": {
return localeText.fieldHoursPlaceholder({
format: sectionFormat
});
}
case "minutes": {
return localeText.fieldMinutesPlaceholder({
format: sectionFormat
});
}
case "seconds": {
return localeText.fieldSecondsPlaceholder({
format: sectionFormat
});
}
case "meridiem": {
return localeText.fieldMeridiemPlaceholder({
format: sectionFormat
});
}
default: {
return sectionFormat;
}
}
};
const createSection = ({ utils, date, shouldRespectLeadingZeros, localeText, localizedDigits, now: now2, token: token2, startSeparator }) => {
if (token2 === "") {
throw new Error("MUI X: Should not call `commitToken` with an empty token");
}
const sectionConfig = getDateSectionConfigFromFormatToken(utils, token2);
const hasLeadingZerosInFormat = doesSectionFormatHaveLeadingZeros(utils, sectionConfig.contentType, sectionConfig.type, token2);
const hasLeadingZerosInInput = shouldRespectLeadingZeros ? hasLeadingZerosInFormat : sectionConfig.contentType === "digit";
const isValidDate = date != null && utils.isValid(date);
let sectionValue = isValidDate ? utils.formatByString(date, token2) : "";
let maxLength = null;
if (hasLeadingZerosInInput) {
if (hasLeadingZerosInFormat) {
maxLength = sectionValue === "" ? utils.formatByString(now2, token2).length : sectionValue.length;
} else {
if (sectionConfig.maxLength == null) {
throw new Error(`MUI X: The token ${token2} should have a 'maxDigitNumber' property on it's adapter`);
}
maxLength = sectionConfig.maxLength;
if (isValidDate) {
sectionValue = applyLocalizedDigits(cleanLeadingZeros(removeLocalizedDigits(sectionValue, localizedDigits), maxLength), localizedDigits);
}
}
}
return _extends$1({}, sectionConfig, {
format: token2,
maxLength,
value: sectionValue,
placeholder: getSectionPlaceholder(utils, localeText, sectionConfig, token2),
hasLeadingZerosInFormat,
hasLeadingZerosInInput,
startSeparator,
endSeparator: "",
modified: false
});
};
const buildSections = (params) => {
var _a;
const { utils, expandedFormat, escapedParts } = params;
const now2 = utils.date(void 0);
const sections = [];
let startSeparator = "";
const validTokens = Object.keys(utils.formatTokenMap).sort((a, b) => b.length - a.length);
const regExpFirstWordInFormat = /^([a-zA-Z]+)/;
const regExpWordOnlyComposedOfTokens = new RegExp(`^(${validTokens.join("|")})*$`);
const regExpFirstTokenInWord = new RegExp(`^(${validTokens.join("|")})`);
const getEscapedPartOfCurrentChar = (i2) => escapedParts.find((escapeIndex) => escapeIndex.start <= i2 && escapeIndex.end >= i2);
let i = 0;
while (i < expandedFormat.length) {
const escapedPartOfCurrentChar = getEscapedPartOfCurrentChar(i);
const isEscapedChar = escapedPartOfCurrentChar != null;
const firstWordInFormat = (_a = regExpFirstWordInFormat.exec(expandedFormat.slice(i))) == null ? void 0 : _a[1];
if (!isEscapedChar && firstWordInFormat != null && regExpWordOnlyComposedOfTokens.test(firstWordInFormat)) {
let word = firstWordInFormat;
while (word.length > 0) {
const firstWord = regExpFirstTokenInWord.exec(word)[1];
word = word.slice(firstWord.length);
sections.push(createSection(_extends$1({}, params, {
now: now2,
token: firstWord,
startSeparator
})));
startSeparator = "";
}
i += firstWordInFormat.length;
} else {
const char = expandedFormat[i];
const isEscapeBoundary = isEscapedChar && (escapedPartOfCurrentChar == null ? void 0 : escapedPartOfCurrentChar.start) === i || (escapedPartOfCurrentChar == null ? void 0 : escapedPartOfCurrentChar.end) === i;
if (!isEscapeBoundary) {
if (sections.length === 0) {
startSeparator += char;
} else {
sections[sections.length - 1].endSeparator += char;
}
}
i += 1;
}
}
if (sections.length === 0 && startSeparator.length > 0) {
sections.push({
type: "empty",
contentType: "letter",
maxLength: null,
format: "",
value: "",
placeholder: "",
hasLeadingZerosInFormat: false,
hasLeadingZerosInInput: false,
startSeparator,
endSeparator: "",
modified: false
});
}
return sections;
};
const postProcessSections = ({ isRtl, formatDensity, sections }) => {
return sections.map((section) => {
const cleanSeparator = (separator) => {
let cleanedSeparator = separator;
if (isRtl && cleanedSeparator !== null && cleanedSeparator.includes(" ")) {
cleanedSeparator = `\u2069${cleanedSeparator}\u2066`;
}
if (formatDensity === "spacious" && [
"/",
".",
"-"
].includes(cleanedSeparator)) {
cleanedSeparator = ` ${cleanedSeparator} `;
}
return cleanedSeparator;
};
section.startSeparator = cleanSeparator(section.startSeparator);
section.endSeparator = cleanSeparator(section.endSeparator);
return section;
});
};
const buildSectionsFromFormat = (params) => {
let expandedFormat = expandFormat(params);
if (params.isRtl && params.enableAccessibleFieldDOMStructure) {
expandedFormat = expandedFormat.split(" ").reverse().join(" ");
}
const escapedParts = getEscapedPartsFromFormat(_extends$1({}, params, {
expandedFormat
}));
const sections = buildSections(_extends$1({}, params, {
expandedFormat,
escapedParts
}));
return postProcessSections(_extends$1({}, params, {
sections
}));
};
const useFieldState = (params) => {
const utils = useUtils();
const translations = usePickersTranslations();
const adapter = useLocalizationContext();
const isRtl = useRtl();
const { valueManager, fieldValueManager, valueType, validator, internalProps, internalProps: { value: valueProp, defaultValue, referenceDate: referenceDateProp, onChange, format: format2, formatDensity = "dense", selectedSections: selectedSectionsProp, onSelectedSectionsChange, shouldRespectLeadingZeros = false, timezone: timezoneProp, enableAccessibleFieldDOMStructure = false } } = params;
const { timezone, value: valueFromTheOutside, handleValueChange } = useValueWithTimezone({
timezone: timezoneProp,
value: valueProp,
defaultValue,
referenceDate: referenceDateProp,
onChange,
valueManager
});
const localizedDigits = __mf_29(() => getLocalizedDigits(utils), [
utils
]);
const sectionsValueBoundaries = __mf_29(() => getSectionsBoundaries(utils, localizedDigits, timezone), [
utils,
localizedDigits,
timezone
]);
const getSectionsFromValue = __mf_20((value, fallbackSections = null) => fieldValueManager.getSectionsFromValue(utils, value, fallbackSections, (date) => buildSectionsFromFormat({
utils,
localeText: translations,
localizedDigits,
format: format2,
date,
formatDensity,
shouldRespectLeadingZeros,
enableAccessibleFieldDOMStructure,
isRtl
})), [
fieldValueManager,
format2,
translations,
localizedDigits,
isRtl,
shouldRespectLeadingZeros,
utils,
formatDensity,
enableAccessibleFieldDOMStructure
]);
const [state, setState] = __mf_32$1(() => {
const sections = getSectionsFromValue(valueFromTheOutside);
const stateWithoutReferenceDate = {
sections,
value: valueFromTheOutside,
referenceValue: valueManager.emptyValue,
tempValueStrAndroid: null
};
const granularity = getSectionTypeGranularity(sections);
const referenceValue = valueManager.getInitialReferenceValue({
referenceDate: referenceDateProp,
value: valueFromTheOutside,
utils,
props: internalProps,
granularity,
timezone
});
return _extends$1({}, stateWithoutReferenceDate, {
referenceValue
});
});
const [selectedSections, innerSetSelectedSections] = useControlled({
controlled: selectedSectionsProp,
default: null,
name: "useField",
state: "selectedSections"
});
const setSelectedSections = (newSelectedSections) => {
innerSetSelectedSections(newSelectedSections);
onSelectedSectionsChange == null ? void 0 : onSelectedSectionsChange(newSelectedSections);
};
const parsedSelectedSections = __mf_29(() => parseSelectedSections(selectedSections, state.sections), [
selectedSections,
state.sections
]);
const activeSectionIndex = parsedSelectedSections === "all" ? 0 : parsedSelectedSections;
const publishValue = ({ value, referenceValue, sections }) => {
setState((prevState) => _extends$1({}, prevState, {
sections,
value,
referenceValue,
tempValueStrAndroid: null
}));
if (valueManager.areValuesEqual(utils, state.value, value)) {
return;
}
const context = {
validationError: validator({
adapter,
value,
timezone,
props: internalProps
})
};
handleValueChange(value, context);
};
const setSectionValue = (sectionIndex, newSectionValue) => {
const newSections = [
...state.sections
];
newSections[sectionIndex] = _extends$1({}, newSections[sectionIndex], {
value: newSectionValue,
modified: true
});
return newSections;
};
const clearValue = () => {
publishValue({
value: valueManager.emptyValue,
referenceValue: state.referenceValue,
sections: getSectionsFromValue(valueManager.emptyValue)
});
};
const clearActiveSection = () => {
if (activeSectionIndex == null) {
return;
}
const activeSection = state.sections[activeSectionIndex];
const activeDateManager = fieldValueManager.getActiveDateManager(utils, state, activeSection);
const nonEmptySectionCountBefore = activeDateManager.getSections(state.sections).filter((section) => section.value !== "").length;
const hasNoOtherNonEmptySections = nonEmptySectionCountBefore === (activeSection.value === "" ? 0 : 1);
const newSections = setSectionValue(activeSectionIndex, "");
const newActiveDate = hasNoOtherNonEmptySections ? null : utils.getInvalidDate();
const newValues = activeDateManager.getNewValuesFromNewActiveDate(newActiveDate);
publishValue(_extends$1({}, newValues, {
sections: newSections
}));
};
const updateValueFromValueStr = (valueStr) => {
const parseDateStr = (dateStr, referenceDate) => {
const date = utils.parse(dateStr, format2);
if (date == null || !utils.isValid(date)) {
return null;
}
const sections = buildSectionsFromFormat({
utils,
localeText: translations,
localizedDigits,
format: format2,
date,
formatDensity,
shouldRespectLeadingZeros,
enableAccessibleFieldDOMStructure,
isRtl
});
return mergeDateIntoReferenceDate(utils, date, sections, referenceDate, false);
};
const newValue = fieldValueManager.parseValueStr(valueStr, state.referenceValue, parseDateStr);
const newReferenceValue = fieldValueManager.updateReferenceValue(utils, newValue, state.referenceValue);
publishValue({
value: newValue,
referenceValue: newReferenceValue,
sections: getSectionsFromValue(newValue, state.sections)
});
};
const updateSectionValue = ({ activeSection, newSectionValue, shouldGoToNextSection }) => {
if (shouldGoToNextSection && activeSectionIndex < state.sections.length - 1) {
setSelectedSections(activeSectionIndex + 1);
}
const activeDateManager = fieldValueManager.getActiveDateManager(utils, state, activeSection);
const newSections = setSectionValue(activeSectionIndex, newSectionValue);
const newActiveDateSections = activeDateManager.getSections(newSections);
const newActiveDate = getDateFromDateSections(utils, newActiveDateSections, localizedDigits);
let values;
let shouldPublish;
if (newActiveDate != null && utils.isValid(newActiveDate)) {
const mergedDate = mergeDateIntoReferenceDate(utils, newActiveDate, newActiveDateSections, activeDateManager.referenceDate, true);
values = activeDateManager.getNewValuesFromNewActiveDate(mergedDate);
shouldPublish = true;
} else {
values = activeDateManager.getNewValuesFromNewActiveDate(newActiveDate);
shouldPublish = (newActiveDate != null && !utils.isValid(newActiveDate)) !== (activeDateManager.date != null && !utils.isValid(activeDateManager.date));
}
if (shouldPublish) {
return publishValue(_extends$1({}, values, {
sections: newSections
}));
}
return setState((prevState) => _extends$1({}, prevState, values, {
sections: newSections,
tempValueStrAndroid: null
}));
};
const setTempAndroidValueStr = (tempValueStrAndroid) => setState((prev) => _extends$1({}, prev, {
tempValueStrAndroid
}));
__mf_24(() => {
const sections = getSectionsFromValue(state.value);
setState((prevState) => _extends$1({}, prevState, {
sections
}));
}, [
format2,
utils.locale,
isRtl
]);
__mf_24(() => {
let shouldUpdate;
if (!valueManager.areValuesEqual(utils, state.value, valueFromTheOutside)) {
shouldUpdate = true;
} else {
shouldUpdate = valueManager.getTimezone(utils, state.value) !== valueManager.getTimezone(utils, valueFromTheOutside);
}
if (shouldUpdate) {
setState((prevState) => _extends$1({}, prevState, {
value: valueFromTheOutside,
referenceValue: fieldValueManager.updateReferenceValue(utils, valueFromTheOutside, prevState.referenceValue),
sections: getSectionsFromValue(valueFromTheOutside)
}));
}
}, [
valueFromTheOutside
]);
return {
state,
activeSectionIndex,
parsedSelectedSections,
setSelectedSections,
clearValue,
clearActiveSection,
updateSectionValue,
updateValueFromValueStr,
setTempAndroidValueStr,
getSectionsFromValue,
sectionsValueBoundaries,
localizedDigits,
timezone
};
};
const QUERY_LIFE_DURATION_MS = 5e3;
const isQueryResponseWithoutValue = (response) => response.saveQuery != null;
const useFieldCharacterEditing = ({ sections, updateSectionValue, sectionsValueBoundaries, localizedDigits, setTempAndroidValueStr, timezone }) => {
const utils = useUtils();
const [query, setQuery] = __mf_32$1(null);
const resetQuery = useEventCallback(() => setQuery(null));
__mf_24(() => {
var _a;
if (query != null && ((_a = sections[query.sectionIndex]) == null ? void 0 : _a.type) !== query.sectionType) {
resetQuery();
}
}, [
sections,
query,
resetQuery
]);
__mf_24(() => {
if (query != null) {
const timeout = setTimeout(() => resetQuery(), QUERY_LIFE_DURATION_MS);
return () => {
clearTimeout(timeout);
};
}
return () => {
};
}, [
query,
resetQuery
]);
const applyQuery = ({ keyPressed, sectionIndex }, getFirstSectionValueMatchingWithQuery, isValidQueryValue) => {
const cleanKeyPressed = keyPressed.toLowerCase();
const activeSection = sections[sectionIndex];
if (query != null && (!isValidQueryValue || isValidQueryValue(query.value)) && query.sectionIndex === sectionIndex) {
const concatenatedQueryValue = `${query.value}${cleanKeyPressed}`;
const queryResponse2 = getFirstSectionValueMatchingWithQuery(concatenatedQueryValue, activeSection);
if (!isQueryResponseWithoutValue(queryResponse2)) {
setQuery({
sectionIndex,
value: concatenatedQueryValue,
sectionType: activeSection.type
});
return queryResponse2;
}
}
const queryResponse = getFirstSectionValueMatchingWithQuery(cleanKeyPressed, activeSection);
if (isQueryResponseWithoutValue(queryResponse) && !queryResponse.saveQuery) {
resetQuery();
return null;
}
setQuery({
sectionIndex,
value: cleanKeyPressed,
sectionType: activeSection.type
});
if (isQueryResponseWithoutValue(queryResponse)) {
return null;
}
return queryResponse;
};
const applyLetterEditing = (params) => {
const findMatchingOptions = (format2, options, queryValue) => {
const matchingValues = options.filter((option) => option.toLowerCase().startsWith(queryValue));
if (matchingValues.length === 0) {
return {
saveQuery: false
};
}
return {
sectionValue: matchingValues[0],
shouldGoToNextSection: matchingValues.length === 1
};
};
const testQueryOnFormatAndFallbackFormat = (queryValue, activeSection, fallbackFormat, formatFallbackValue) => {
const getOptions = (format2) => getLetterEditingOptions(utils, timezone, activeSection.type, format2);
if (activeSection.contentType === "letter") {
return findMatchingOptions(activeSection.format, getOptions(activeSection.format), queryValue);
}
if (fallbackFormat && formatFallbackValue != null && getDateSectionConfigFromFormatToken(utils, fallbackFormat).contentType === "letter") {
const fallbackOptions = getOptions(fallbackFormat);
const response = findMatchingOptions(fallbackFormat, fallbackOptions, queryValue);
if (isQueryResponseWithoutValue(response)) {
return {
saveQuery: false
};
}
return _extends$1({}, response, {
sectionValue: formatFallbackValue(response.sectionValue, fallbackOptions)
});
}
return {
saveQuery: false
};
};
const getFirstSectionValueMatchingWithQuery = (queryValue, activeSection) => {
switch (activeSection.type) {
case "month": {
const formatFallbackValue = (fallbackValue) => changeSectionValueFormat(utils, fallbackValue, utils.formats.month, activeSection.format);
return testQueryOnFormatAndFallbackFormat(queryValue, activeSection, utils.formats.month, formatFallbackValue);
}
case "weekDay": {
const formatFallbackValue = (fallbackValue, fallbackOptions) => fallbackOptions.indexOf(fallbackValue).toString();
return testQueryOnFormatAndFallbackFormat(queryValue, activeSection, utils.formats.weekday, formatFallbackValue);
}
case "meridiem": {
return testQueryOnFormatAndFallbackFormat(queryValue, activeSection);
}
default: {
return {
saveQuery: false
};
}
}
};
return applyQuery(params, getFirstSectionValueMatchingWithQuery);
};
const applyNumericEditing = (params) => {
const getNewSectionValue = (queryValue, section) => {
const cleanQueryValue = removeLocalizedDigits(queryValue, localizedDigits);
const queryValueNumber = Number(cleanQueryValue);
const sectionBoundaries = sectionsValueBoundaries[section.type]({
currentDate: null,
format: section.format,
contentType: section.contentType
});
if (queryValueNumber > sectionBoundaries.maximum) {
return {
saveQuery: false
};
}
if (queryValueNumber < sectionBoundaries.minimum) {
return {
saveQuery: true
};
}
const shouldGoToNextSection = queryValueNumber * 10 > sectionBoundaries.maximum || cleanQueryValue.length === sectionBoundaries.maximum.toString().length;
const newSectionValue = cleanDigitSectionValue(utils, queryValueNumber, sectionBoundaries, localizedDigits, section);
return {
sectionValue: newSectionValue,
shouldGoToNextSection
};
};
const getFirstSectionValueMatchingWithQuery = (queryValue, activeSection) => {
if (activeSection.contentType === "digit" || activeSection.contentType === "digit-with-letter") {
return getNewSectionValue(queryValue, activeSection);
}
if (activeSection.type === "month") {
doesSectionFormatHaveLeadingZeros(utils, "digit", "month", "MM");
const response = getNewSectionValue(queryValue, {
type: activeSection.type,
format: "MM",
hasLeadingZerosInInput: true,
contentType: "digit",
maxLength: 2
});
if (isQueryResponseWithoutValue(response)) {
return response;
}
const formattedValue = changeSectionValueFormat(utils, response.sectionValue, "MM", activeSection.format);
return _extends$1({}, response, {
sectionValue: formattedValue
});
}
if (activeSection.type === "weekDay") {
const response = getNewSectionValue(queryValue, activeSection);
if (isQueryResponseWithoutValue(response)) {
return response;
}
const formattedValue = getDaysInWeekStr(utils, activeSection.format)[Number(response.sectionValue) - 1];
return _extends$1({}, response, {
sectionValue: formattedValue
});
}
return {
saveQuery: false
};
};
return applyQuery(params, getFirstSectionValueMatchingWithQuery, (queryValue) => isStringNumber(queryValue, localizedDigits));
};
const applyCharacterEditing = useEventCallback((params) => {
const activeSection = sections[params.sectionIndex];
const isNumericEditing = isStringNumber(params.keyPressed, localizedDigits);
const response = isNumericEditing ? applyNumericEditing(_extends$1({}, params, {
keyPressed: applyLocalizedDigits(params.keyPressed, localizedDigits)
})) : applyLetterEditing(params);
if (response == null) {
setTempAndroidValueStr(null);
return;
}
updateSectionValue({
activeSection,
newSectionValue: response.sectionValue,
shouldGoToNextSection: response.shouldGoToNextSection
});
});
return {
applyCharacterEditing,
resetCharacterQuery: resetQuery
};
};
const useFieldV7TextField = (params) => {
const { internalProps: { disabled, readOnly = false }, forwardedProps: { sectionListRef: inSectionListRef, onBlur, onClick, onFocus, onInput, onPaste, focused: focusedProp, autoFocus = false }, fieldValueManager, applyCharacterEditing, resetCharacterQuery, setSelectedSections, parsedSelectedSections, state, clearActiveSection, clearValue, updateSectionValue, updateValueFromValueStr, sectionOrder, areAllSectionsEmpty, sectionsValueBoundaries } = params;
const sectionListRef = __mf_31(null);
const handleSectionListRef = useForkRef(inSectionListRef, sectionListRef);
const translations = usePickersTranslations();
const utils = useUtils();
const id = useId();
const [focused, setFocused] = __mf_32$1(false);
const interactions = __mf_29(() => ({
syncSelectionToDOM: () => {
if (!sectionListRef.current) {
return;
}
const selection = document.getSelection();
if (!selection) {
return;
}
if (parsedSelectedSections == null) {
if (selection.rangeCount > 0 && sectionListRef.current.getRoot().contains(selection.getRangeAt(0).startContainer)) {
selection.removeAllRanges();
}
if (focused) {
sectionListRef.current.getRoot().blur();
}
return;
}
if (!sectionListRef.current.getRoot().contains(getActiveElement(document))) {
return;
}
const range = new window.Range();
let target;
if (parsedSelectedSections === "all") {
target = sectionListRef.current.getRoot();
} else {
const section = state.sections[parsedSelectedSections];
if (section.type === "empty") {
target = sectionListRef.current.getSectionContainer(parsedSelectedSections);
} else {
target = sectionListRef.current.getSectionContent(parsedSelectedSections);
}
}
range.selectNodeContents(target);
target.focus();
selection.removeAllRanges();
selection.addRange(range);
},
getActiveSectionIndexFromDOM: () => {
const activeElement = getActiveElement(document);
if (!activeElement || !sectionListRef.current || !sectionListRef.current.getRoot().contains(activeElement)) {
return null;
}
return sectionListRef.current.getSectionIndexFromDOMElement(activeElement);
},
focusField: (newSelectedSections = 0) => {
if (!sectionListRef.current || interactions.getActiveSectionIndexFromDOM() != null) {
return;
}
const newParsedSelectedSections = parseSelectedSections(newSelectedSections, state.sections);
setFocused(true);
sectionListRef.current.getSectionContent(newParsedSelectedSections).focus();
},
setSelectedSections: (newSelectedSections) => {
if (!sectionListRef.current) {
return;
}
const newParsedSelectedSections = parseSelectedSections(newSelectedSections, state.sections);
const newActiveSectionIndex = newParsedSelectedSections === "all" ? 0 : newParsedSelectedSections;
setFocused(newActiveSectionIndex !== null);
setSelectedSections(newSelectedSections);
},
isFieldFocused: () => {
const activeElement = getActiveElement(document);
return !!sectionListRef.current && sectionListRef.current.getRoot().contains(activeElement);
}
}), [
parsedSelectedSections,
setSelectedSections,
state.sections,
focused
]);
const revertDOMSectionChange = useEventCallback((sectionIndex) => {
if (!sectionListRef.current) {
return;
}
const section = state.sections[sectionIndex];
sectionListRef.current.getSectionContent(sectionIndex).innerHTML = section.value || section.placeholder;
interactions.syncSelectionToDOM();
});
const handleContainerClick = useEventCallback((event, ...args) => {
if (event.isDefaultPrevented() || !sectionListRef.current) {
return;
}
setFocused(true);
onClick == null ? void 0 : onClick(event, ...args);
if (parsedSelectedSections === "all") {
setTimeout(() => {
const cursorPosition = document.getSelection().getRangeAt(0).startOffset;
if (cursorPosition === 0) {
setSelectedSections(sectionOrder.startIndex);
return;
}
let sectionIndex = 0;
let cursorOnStartOfSection = 0;
while (cursorOnStartOfSection < cursorPosition && sectionIndex < state.sections.length) {
const section = state.sections[sectionIndex];
sectionIndex += 1;
cursorOnStartOfSection += `${section.startSeparator}${section.value || section.placeholder}${section.endSeparator}`.length;
}
setSelectedSections(sectionIndex - 1);
});
} else if (!focused) {
setFocused(true);
setSelectedSections(sectionOrder.startIndex);
} else {
const hasClickedOnASection = sectionListRef.current.getRoot().contains(event.target);
if (!hasClickedOnASection) {
setSelectedSections(sectionOrder.startIndex);
}
}
});
const handleContainerInput = useEventCallback((event) => {
onInput == null ? void 0 : onInput(event);
if (!sectionListRef.current || parsedSelectedSections !== "all") {
return;
}
const target = event.target;
const keyPressed = target.textContent ?? "";
sectionListRef.current.getRoot().innerHTML = state.sections.map((section) => `${section.startSeparator}${section.value || section.placeholder}${section.endSeparator}`).join("");
interactions.syncSelectionToDOM();
if (keyPressed.length === 0 || keyPressed.charCodeAt(0) === 10) {
resetCharacterQuery();
clearValue();
setSelectedSections("all");
} else if (keyPressed.length > 1) {
updateValueFromValueStr(keyPressed);
} else {
if (parsedSelectedSections === "all") {
setSelectedSections(0);
}
applyCharacterEditing({
keyPressed,
sectionIndex: 0
});
}
});
const handleContainerPaste = useEventCallback((event) => {
onPaste == null ? void 0 : onPaste(event);
if (readOnly || parsedSelectedSections !== "all") {
event.preventDefault();
return;
}
const pastedValue = event.clipboardData.getData("text");
event.preventDefault();
resetCharacterQuery();
updateValueFromValueStr(pastedValue);
});
const handleContainerFocus = useEventCallback((...args) => {
onFocus == null ? void 0 : onFocus(...args);
if (focused || !sectionListRef.current) {
return;
}
setFocused(true);
const isFocusInsideASection = sectionListRef.current.getSectionIndexFromDOMElement(getActiveElement(document)) != null;
if (!isFocusInsideASection) {
setSelectedSections(sectionOrder.startIndex);
}
});
const handleContainerBlur = useEventCallback((...args) => {
onBlur == null ? void 0 : onBlur(...args);
setTimeout(() => {
if (!sectionListRef.current) {
return;
}
const activeElement = getActiveElement(document);
const shouldBlur = !sectionListRef.current.getRoot().contains(activeElement);
if (shouldBlur) {
setFocused(false);
setSelectedSections(null);
}
});
});
const getInputContainerClickHandler = useEventCallback((sectionIndex) => (event) => {
if (event.isDefaultPrevented()) {
return;
}
setSelectedSections(sectionIndex);
});
const handleInputContentMouseUp = useEventCallback((event) => {
event.preventDefault();
});
const getInputContentFocusHandler = useEventCallback((sectionIndex) => () => {
setSelectedSections(sectionIndex);
});
const handleInputContentPaste = useEventCallback((event) => {
event.preventDefault();
if (readOnly || disabled || typeof parsedSelectedSections !== "number") {
return;
}
const activeSection = state.sections[parsedSelectedSections];
const pastedValue = event.clipboardData.getData("text");
const lettersOnly = /^[a-zA-Z]+$/.test(pastedValue);
const digitsOnly = /^[0-9]+$/.test(pastedValue);
const digitsAndLetterOnly = /^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(pastedValue);
const isValidPastedValue = activeSection.contentType === "letter" && lettersOnly || activeSection.contentType === "digit" && digitsOnly || activeSection.contentType === "digit-with-letter" && digitsAndLetterOnly;
if (isValidPastedValue) {
resetCharacterQuery();
updateSectionValue({
activeSection,
newSectionValue: pastedValue,
shouldGoToNextSection: true
});
} else if (!lettersOnly && !digitsOnly) {
resetCharacterQuery();
updateValueFromValueStr(pastedValue);
}
});
const handleInputContentDragOver = useEventCallback((event) => {
event.preventDefault();
event.dataTransfer.dropEffect = "none";
});
const handleInputContentInput = useEventCallback((event) => {
if (!sectionListRef.current) {
return;
}
const target = event.target;
const keyPressed = target.textContent ?? "";
const sectionIndex = sectionListRef.current.getSectionIndexFromDOMElement(target);
const section = state.sections[sectionIndex];
if (readOnly || !sectionListRef.current) {
revertDOMSectionChange(sectionIndex);
return;
}
if (keyPressed.length === 0) {
if (section.value === "") {
revertDOMSectionChange(sectionIndex);
return;
}
const inputType = event.nativeEvent.inputType;
if (inputType === "insertParagraph" || inputType === "insertLineBreak") {
revertDOMSectionChange(sectionIndex);
return;
}
resetCharacterQuery();
clearActiveSection();
return;
}
applyCharacterEditing({
keyPressed,
sectionIndex
});
revertDOMSectionChange(sectionIndex);
});
useEnhancedEffect(() => {
if (!focused || !sectionListRef.current) {
return;
}
if (parsedSelectedSections === "all") {
sectionListRef.current.getRoot().focus();
} else if (typeof parsedSelectedSections === "number") {
const domElement = sectionListRef.current.getSectionContent(parsedSelectedSections);
if (domElement) {
domElement.focus();
}
}
}, [
parsedSelectedSections,
focused
]);
const sectionBoundaries = __mf_29(() => {
return state.sections.reduce((acc, next) => {
acc[next.type] = sectionsValueBoundaries[next.type]({
currentDate: null,
contentType: next.contentType,
format: next.format
});
return acc;
}, {});
}, [
sectionsValueBoundaries,
state.sections
]);
const isContainerEditable = parsedSelectedSections === "all";
const elements = __mf_29(() => {
return state.sections.map((section, index) => {
const isEditable = !isContainerEditable && !disabled && !readOnly;
return {
container: {
"data-sectionindex": index,
onClick: getInputContainerClickHandler(index)
},
content: {
tabIndex: isContainerEditable || index > 0 ? -1 : 0,
contentEditable: !isContainerEditable && !disabled && !readOnly,
role: "spinbutton",
id: `${id}-${section.type}`,
"aria-labelledby": `${id}-${section.type}`,
"aria-readonly": readOnly,
"aria-valuenow": getSectionValueNow(section, utils),
"aria-valuemin": sectionBoundaries[section.type].minimum,
"aria-valuemax": sectionBoundaries[section.type].maximum,
"aria-valuetext": section.value ? getSectionValueText(section, utils) : translations.empty,
"aria-label": translations[section.type],
"aria-disabled": disabled,
spellCheck: isEditable ? false : void 0,
autoCapitalize: isEditable ? "off" : void 0,
autoCorrect: isEditable ? "off" : void 0,
[parseInt(__mf_35, 10) >= 17 ? "enterKeyHint" : "enterkeyhint"]: isEditable ? "next" : void 0,
children: section.value || section.placeholder,
onInput: handleInputContentInput,
onPaste: handleInputContentPaste,
onFocus: getInputContentFocusHandler(index),
onDragOver: handleInputContentDragOver,
onMouseUp: handleInputContentMouseUp,
inputMode: section.contentType === "letter" ? "text" : "numeric"
},
before: {
children: section.startSeparator
},
after: {
children: section.endSeparator
}
};
});
}, [
state.sections,
getInputContentFocusHandler,
handleInputContentPaste,
handleInputContentDragOver,
handleInputContentInput,
getInputContainerClickHandler,
handleInputContentMouseUp,
disabled,
readOnly,
isContainerEditable,
translations,
utils,
sectionBoundaries,
id
]);
const handleValueStrChange = useEventCallback((event) => {
updateValueFromValueStr(event.target.value);
});
const valueStr = __mf_29(() => areAllSectionsEmpty ? "" : fieldValueManager.getV7HiddenInputValueFromSections(state.sections), [
areAllSectionsEmpty,
state.sections,
fieldValueManager
]);
__mf_24(() => {
if (sectionListRef.current == null) {
throw new Error([
"MUI X: The `sectionListRef` prop has not been initialized by `PickersSectionList`",
"You probably tried to pass a component to the `textField` slot that contains an `<input />` element instead of a `PickersSectionList`.",
"",
"If you want to keep using an `<input />` HTML element for the editing, please remove the `enableAccessibleFieldDOMStructure` prop from your picker or field component:",
"",
"<DatePicker slots={{ textField: MyCustomTextField }} />",
"",
"Learn more about the field accessible DOM structure on the MUI documentation: https://mui.com/x/react-date-pickers/fields/#fields-to-edit-a-single-element"
].join("\n"));
}
if (autoFocus && sectionListRef.current) {
sectionListRef.current.getSectionContent(sectionOrder.startIndex).focus();
}
}, []);
return {
interactions,
returnedValue: {
autoFocus,
readOnly,
focused: focusedProp ?? focused,
sectionListRef: handleSectionListRef,
onBlur: handleContainerBlur,
onClick: handleContainerClick,
onFocus: handleContainerFocus,
onInput: handleContainerInput,
onPaste: handleContainerPaste,
enableAccessibleFieldDOMStructure: true,
elements,
tabIndex: parsedSelectedSections === 0 ? -1 : 0,
contentEditable: isContainerEditable,
value: valueStr,
onChange: handleValueStrChange,
areAllSectionsEmpty
}
};
};
const cleanString = (dirtyString) => dirtyString.replace(/[\u2066\u2067\u2068\u2069]/g, "");
const addPositionPropertiesToSections = (sections, localizedDigits, isRtl) => {
let position = 0;
let positionInInput = isRtl ? 1 : 0;
const newSections = [];
for (let i = 0; i < sections.length; i += 1) {
const section = sections[i];
const renderedValue = getSectionVisibleValue(section, isRtl ? "input-rtl" : "input-ltr", localizedDigits);
const sectionStr = `${section.startSeparator}${renderedValue}${section.endSeparator}`;
const sectionLength = cleanString(sectionStr).length;
const sectionLengthInInput = sectionStr.length;
const cleanedValue = cleanString(renderedValue);
const startInInput = positionInInput + (cleanedValue === "" ? 0 : renderedValue.indexOf(cleanedValue[0])) + section.startSeparator.length;
const endInInput = startInInput + cleanedValue.length;
newSections.push(_extends$1({}, section, {
start: position,
end: position + sectionLength,
startInInput,
endInInput
}));
position += sectionLength;
positionInInput += sectionLengthInInput;
}
return newSections;
};
const useFieldV6TextField = (params) => {
const isRtl = useRtl();
const focusTimeoutRef = __mf_31(void 0);
const selectionSyncTimeoutRef = __mf_31(void 0);
const { forwardedProps: { onFocus, onClick, onPaste, onBlur, inputRef: inputRefProp, placeholder: inPlaceholder }, internalProps: { readOnly = false, disabled = false }, parsedSelectedSections, activeSectionIndex, state, fieldValueManager, valueManager, applyCharacterEditing, resetCharacterQuery, updateSectionValue, updateValueFromValueStr, clearActiveSection, clearValue, setTempAndroidValueStr, setSelectedSections, getSectionsFromValue, areAllSectionsEmpty, localizedDigits } = params;
const inputRef = __mf_31(null);
const handleRef = useForkRef(inputRefProp, inputRef);
const sections = __mf_29(() => addPositionPropertiesToSections(state.sections, localizedDigits, isRtl), [
state.sections,
localizedDigits,
isRtl
]);
const interactions = __mf_29(() => ({
syncSelectionToDOM: () => {
if (!inputRef.current) {
return;
}
if (parsedSelectedSections == null) {
if (inputRef.current.scrollLeft) {
inputRef.current.scrollLeft = 0;
}
return;
}
if (inputRef.current !== getActiveElement(document)) {
return;
}
const currentScrollTop = inputRef.current.scrollTop;
if (parsedSelectedSections === "all") {
inputRef.current.select();
} else {
const selectedSection = sections[parsedSelectedSections];
const selectionStart = selectedSection.type === "empty" ? selectedSection.startInInput - selectedSection.startSeparator.length : selectedSection.startInInput;
const selectionEnd = selectedSection.type === "empty" ? selectedSection.endInInput + selectedSection.endSeparator.length : selectedSection.endInInput;
if (selectionStart !== inputRef.current.selectionStart || selectionEnd !== inputRef.current.selectionEnd) {
if (inputRef.current === getActiveElement(document)) {
inputRef.current.setSelectionRange(selectionStart, selectionEnd);
}
}
clearTimeout(selectionSyncTimeoutRef.current);
selectionSyncTimeoutRef.current = setTimeout(() => {
if (inputRef.current && inputRef.current === getActiveElement(document) && inputRef.current.selectionStart === inputRef.current.selectionEnd && (inputRef.current.selectionStart !== selectionStart || inputRef.current.selectionEnd !== selectionEnd)) {
interactions.syncSelectionToDOM();
}
});
}
inputRef.current.scrollTop = currentScrollTop;
},
getActiveSectionIndexFromDOM: () => {
const browserStartIndex = inputRef.current.selectionStart ?? 0;
const browserEndIndex = inputRef.current.selectionEnd ?? 0;
if (browserStartIndex === 0 && browserEndIndex === 0) {
return null;
}
const nextSectionIndex = browserStartIndex <= sections[0].startInInput ? 1 : sections.findIndex((section) => section.startInInput - section.startSeparator.length > browserStartIndex);
return nextSectionIndex === -1 ? sections.length - 1 : nextSectionIndex - 1;
},
focusField: (newSelectedSection = 0) => {
var _a;
if (getActiveElement(document) === inputRef.current) {
return;
}
(_a = inputRef.current) == null ? void 0 : _a.focus();
setSelectedSections(newSelectedSection);
},
setSelectedSections: (newSelectedSections) => setSelectedSections(newSelectedSections),
isFieldFocused: () => inputRef.current === getActiveElement(document)
}), [
inputRef,
parsedSelectedSections,
sections,
setSelectedSections
]);
const syncSelectionFromDOM = () => {
const browserStartIndex = inputRef.current.selectionStart ?? 0;
let nextSectionIndex;
if (browserStartIndex <= sections[0].startInInput) {
nextSectionIndex = 1;
} else if (browserStartIndex >= sections[sections.length - 1].endInInput) {
nextSectionIndex = 1;
} else {
nextSectionIndex = sections.findIndex((section) => section.startInInput - section.startSeparator.length > browserStartIndex);
}
const sectionIndex = nextSectionIndex === -1 ? sections.length - 1 : nextSectionIndex - 1;
setSelectedSections(sectionIndex);
};
const handleInputFocus = useEventCallback((...args) => {
onFocus == null ? void 0 : onFocus(...args);
const input = inputRef.current;
clearTimeout(focusTimeoutRef.current);
focusTimeoutRef.current = setTimeout(() => {
if (!input || input !== inputRef.current) {
return;
}
if (activeSectionIndex != null) {
return;
}
if (input.value.length && Number(input.selectionEnd) - Number(input.selectionStart) === input.value.length) {
setSelectedSections("all");
} else {
syncSelectionFromDOM();
}
});
});
const handleInputClick = useEventCallback((event, ...args) => {
if (event.isDefaultPrevented()) {
return;
}
onClick == null ? void 0 : onClick(event, ...args);
syncSelectionFromDOM();
});
const handleInputPaste = useEventCallback((event) => {
onPaste == null ? void 0 : onPaste(event);
event.preventDefault();
if (readOnly || disabled) {
return;
}
const pastedValue = event.clipboardData.getData("text");
if (typeof parsedSelectedSections === "number") {
const activeSection = state.sections[parsedSelectedSections];
const lettersOnly = /^[a-zA-Z]+$/.test(pastedValue);
const digitsOnly = /^[0-9]+$/.test(pastedValue);
const digitsAndLetterOnly = /^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(pastedValue);
const isValidPastedValue = activeSection.contentType === "letter" && lettersOnly || activeSection.contentType === "digit" && digitsOnly || activeSection.contentType === "digit-with-letter" && digitsAndLetterOnly;
if (isValidPastedValue) {
resetCharacterQuery();
updateSectionValue({
activeSection,
newSectionValue: pastedValue,
shouldGoToNextSection: true
});
return;
}
if (lettersOnly || digitsOnly) {
return;
}
}
resetCharacterQuery();
updateValueFromValueStr(pastedValue);
});
const handleContainerBlur = useEventCallback((...args) => {
onBlur == null ? void 0 : onBlur(...args);
setSelectedSections(null);
});
const handleInputChange = useEventCallback((event) => {
if (readOnly) {
return;
}
const targetValue = event.target.value;
if (targetValue === "") {
resetCharacterQuery();
clearValue();
return;
}
const eventData = event.nativeEvent.data;
const shouldUseEventData = eventData && eventData.length > 1;
const valueStr2 = shouldUseEventData ? eventData : targetValue;
const cleanValueStr = cleanString(valueStr2);
if (parsedSelectedSections === "all") {
setSelectedSections(activeSectionIndex);
}
if (activeSectionIndex == null || shouldUseEventData) {
updateValueFromValueStr(shouldUseEventData ? eventData : cleanValueStr);
return;
}
let keyPressed;
if (parsedSelectedSections === "all" && cleanValueStr.length === 1) {
keyPressed = cleanValueStr;
} else {
const prevValueStr = cleanString(fieldValueManager.getV6InputValueFromSections(sections, localizedDigits, isRtl));
let startOfDiffIndex = -1;
let endOfDiffIndex = -1;
for (let i = 0; i < prevValueStr.length; i += 1) {
if (startOfDiffIndex === -1 && prevValueStr[i] !== cleanValueStr[i]) {
startOfDiffIndex = i;
}
if (endOfDiffIndex === -1 && prevValueStr[prevValueStr.length - i - 1] !== cleanValueStr[cleanValueStr.length - i - 1]) {
endOfDiffIndex = i;
}
}
const activeSection = sections[activeSectionIndex];
const hasDiffOutsideOfActiveSection = startOfDiffIndex < activeSection.start || prevValueStr.length - endOfDiffIndex - 1 > activeSection.end;
if (hasDiffOutsideOfActiveSection) {
return;
}
const activeSectionEndRelativeToNewValue = cleanValueStr.length - prevValueStr.length + activeSection.end - cleanString(activeSection.endSeparator || "").length;
keyPressed = cleanValueStr.slice(activeSection.start + cleanString(activeSection.startSeparator || "").length, activeSectionEndRelativeToNewValue);
}
if (keyPressed.length === 0) {
if (isAndroid()) {
setTempAndroidValueStr(valueStr2);
}
resetCharacterQuery();
clearActiveSection();
return;
}
applyCharacterEditing({
keyPressed,
sectionIndex: activeSectionIndex
});
});
const placeholder = __mf_29(() => {
if (inPlaceholder !== void 0) {
return inPlaceholder;
}
return fieldValueManager.getV6InputValueFromSections(getSectionsFromValue(valueManager.emptyValue), localizedDigits, isRtl);
}, [
inPlaceholder,
fieldValueManager,
getSectionsFromValue,
valueManager.emptyValue,
localizedDigits,
isRtl
]);
const valueStr = __mf_29(() => state.tempValueStrAndroid ?? fieldValueManager.getV6InputValueFromSections(state.sections, localizedDigits, isRtl), [
state.sections,
fieldValueManager,
state.tempValueStrAndroid,
localizedDigits,
isRtl
]);
__mf_24(() => {
if (inputRef.current && inputRef.current === getActiveElement(document)) {
setSelectedSections("all");
}
return () => {
clearTimeout(focusTimeoutRef.current);
clearTimeout(selectionSyncTimeoutRef.current);
};
}, []);
const inputMode = __mf_29(() => {
if (activeSectionIndex == null) {
return "text";
}
if (state.sections[activeSectionIndex].contentType === "letter") {
return "text";
}
return "numeric";
}, [
activeSectionIndex,
state.sections
]);
const inputHasFocus = inputRef.current && inputRef.current === getActiveElement(document);
const shouldShowPlaceholder = !inputHasFocus && areAllSectionsEmpty;
return {
interactions,
returnedValue: {
readOnly,
onBlur: handleContainerBlur,
onClick: handleInputClick,
onFocus: handleInputFocus,
onPaste: handleInputPaste,
inputRef: handleRef,
enableAccessibleFieldDOMStructure: false,
placeholder,
inputMode,
autoComplete: "off",
value: shouldShowPlaceholder ? "" : valueStr,
onChange: handleInputChange
}
};
};
const useField = (params) => {
const utils = useUtils();
const { internalProps, internalProps: { unstableFieldRef, minutesStep, enableAccessibleFieldDOMStructure = false, disabled = false, readOnly = false }, forwardedProps: { onKeyDown, error, clearable, onClear }, fieldValueManager, valueManager, validator } = params;
const isRtl = useRtl();
const stateResponse = useFieldState(params);
const { state, activeSectionIndex, parsedSelectedSections, setSelectedSections, clearValue, clearActiveSection, updateSectionValue, setTempAndroidValueStr, sectionsValueBoundaries, localizedDigits, timezone } = stateResponse;
const characterEditingResponse = useFieldCharacterEditing({
sections: state.sections,
updateSectionValue,
sectionsValueBoundaries,
localizedDigits,
setTempAndroidValueStr,
timezone
});
const { resetCharacterQuery } = characterEditingResponse;
const areAllSectionsEmpty = valueManager.areValuesEqual(utils, state.value, valueManager.emptyValue);
const useFieldTextField = enableAccessibleFieldDOMStructure ? useFieldV7TextField : useFieldV6TextField;
const sectionOrder = __mf_29(() => getSectionOrder(state.sections, isRtl && !enableAccessibleFieldDOMStructure), [
state.sections,
isRtl,
enableAccessibleFieldDOMStructure
]);
const { returnedValue, interactions } = useFieldTextField(_extends$1({}, params, stateResponse, characterEditingResponse, {
areAllSectionsEmpty,
sectionOrder
}));
const handleContainerKeyDown = useEventCallback((event) => {
onKeyDown == null ? void 0 : onKeyDown(event);
if (disabled) {
return;
}
switch (true) {
case ((event.ctrlKey || event.metaKey) && String.fromCharCode(event.keyCode) === "A" && !event.shiftKey && !event.altKey): {
event.preventDefault();
setSelectedSections("all");
break;
}
case event.key === "ArrowRight": {
event.preventDefault();
if (parsedSelectedSections == null) {
setSelectedSections(sectionOrder.startIndex);
} else if (parsedSelectedSections === "all") {
setSelectedSections(sectionOrder.endIndex);
} else {
const nextSectionIndex = sectionOrder.neighbors[parsedSelectedSections].rightIndex;
if (nextSectionIndex !== null) {
setSelectedSections(nextSectionIndex);
}
}
break;
}
case event.key === "ArrowLeft": {
event.preventDefault();
if (parsedSelectedSections == null) {
setSelectedSections(sectionOrder.endIndex);
} else if (parsedSelectedSections === "all") {
setSelectedSections(sectionOrder.startIndex);
} else {
const nextSectionIndex = sectionOrder.neighbors[parsedSelectedSections].leftIndex;
if (nextSectionIndex !== null) {
setSelectedSections(nextSectionIndex);
}
}
break;
}
case event.key === "Delete": {
event.preventDefault();
if (readOnly) {
break;
}
if (parsedSelectedSections == null || parsedSelectedSections === "all") {
clearValue();
} else {
clearActiveSection();
}
resetCharacterQuery();
break;
}
case [
"ArrowUp",
"ArrowDown",
"Home",
"End",
"PageUp",
"PageDown"
].includes(event.key): {
event.preventDefault();
if (readOnly || activeSectionIndex == null) {
break;
}
if (parsedSelectedSections === "all") {
setSelectedSections(activeSectionIndex);
}
const activeSection = state.sections[activeSectionIndex];
const activeDateManager = fieldValueManager.getActiveDateManager(utils, state, activeSection);
const newSectionValue = adjustSectionValue(utils, timezone, activeSection, event.key, sectionsValueBoundaries, localizedDigits, activeDateManager.date, {
minutesStep
});
updateSectionValue({
activeSection,
newSectionValue,
shouldGoToNextSection: false
});
break;
}
}
});
useEnhancedEffect(() => {
interactions.syncSelectionToDOM();
});
const { hasValidationError } = useValidation({
props: internalProps,
validator,
timezone,
value: state.value,
onError: internalProps.onError
});
const inputError = __mf_29(() => {
if (error !== void 0) {
return error;
}
return hasValidationError;
}, [
hasValidationError,
error
]);
__mf_24(() => {
if (!inputError && activeSectionIndex == null) {
resetCharacterQuery();
}
}, [
state.referenceValue,
activeSectionIndex,
inputError
]);
__mf_24(() => {
if (state.tempValueStrAndroid != null && activeSectionIndex != null) {
resetCharacterQuery();
clearActiveSection();
}
}, [
state.sections
]);
__mf_26(unstableFieldRef, () => ({
getSections: () => state.sections,
getActiveSectionIndex: interactions.getActiveSectionIndexFromDOM,
setSelectedSections: interactions.setSelectedSections,
focusField: interactions.focusField,
isFieldFocused: interactions.isFieldFocused
}));
const handleClearValue = useEventCallback((event, ...args) => {
event.preventDefault();
onClear == null ? void 0 : onClear(event, ...args);
clearValue();
if (!interactions.isFieldFocused()) {
interactions.focusField(0);
} else {
setSelectedSections(sectionOrder.startIndex);
}
});
const commonForwardedProps = {
onKeyDown: handleContainerKeyDown,
onClear: handleClearValue,
error: inputError,
clearable: Boolean(clearable && !areAllSectionsEmpty && !readOnly && !disabled)
};
const commonAdditionalProps = {
disabled,
readOnly
};
return _extends$1({}, params.forwardedProps, commonForwardedProps, commonAdditionalProps, returnedValue);
};
const _excluded$v = [
"clearable",
"onClear",
"InputProps",
"sx",
"slots",
"slotProps"
], _excluded2$5 = [
"ownerState"
];
const useClearableField = (props) => {
const translations = usePickersTranslations();
const { clearable, onClear, InputProps, sx, slots, slotProps } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$v);
const IconButton$1 = (slots == null ? void 0 : slots.clearButton) ?? IconButton;
const _useSlotProps = useSlotProps({
elementType: IconButton$1,
externalSlotProps: slotProps == null ? void 0 : slotProps.clearButton,
ownerState: {},
className: "clearButton",
additionalProps: {
title: translations.fieldClearLabel
}
}), iconButtonProps = _objectWithoutPropertiesLoose$1(_useSlotProps, _excluded2$5);
const EndClearIcon = (slots == null ? void 0 : slots.clearIcon) ?? ClearIcon;
const endClearIconProps = useSlotProps({
elementType: EndClearIcon,
externalSlotProps: slotProps == null ? void 0 : slotProps.clearIcon,
ownerState: {}
});
return _extends$1({}, other, {
InputProps: _extends$1({}, InputProps, {
endAdornment: jsxRuntimeExports.jsxs(__mf_2$1, {
children: [
clearable && jsxRuntimeExports.jsx(InputAdornment, {
position: "end",
sx: {
marginRight: (InputProps == null ? void 0 : InputProps.endAdornment) ? -1 : -1.5
},
children: jsxRuntimeExports.jsx(IconButton$1, _extends$1({}, iconButtonProps, {
onClick: onClear,
children: jsxRuntimeExports.jsx(EndClearIcon, _extends$1({
fontSize: "small"
}, endClearIconProps))
}))
}),
InputProps == null ? void 0 : InputProps.endAdornment
]
})
}),
sx: [
{
"& .clearButton": {
opacity: 1
},
"@media (pointer: fine)": {
"& .clearButton": {
opacity: 0
},
"&:hover, &:focus-within": {
".clearButton": {
opacity: 1
}
}
}
},
...Array.isArray(sx) ? sx : [
sx
]
]
});
};
const SHARED_FIELD_INTERNAL_PROP_NAMES = [
"value",
"defaultValue",
"referenceDate",
"format",
"formatDensity",
"onChange",
"timezone",
"onError",
"shouldRespectLeadingZeros",
"selectedSections",
"onSelectedSectionsChange",
"unstableFieldRef",
"enableAccessibleFieldDOMStructure",
"disabled",
"readOnly",
"dateSeparator"
];
const useSplitFieldProps = (props, valueType) => {
return __mf_29(() => {
const forwardedProps = _extends$1({}, props);
const internalProps = {};
const extractProp = (propName) => {
if (forwardedProps.hasOwnProperty(propName)) {
internalProps[propName] = forwardedProps[propName];
delete forwardedProps[propName];
}
};
SHARED_FIELD_INTERNAL_PROP_NAMES.forEach(extractProp);
if (valueType === "date") {
DATE_VALIDATION_PROP_NAMES.forEach(extractProp);
} else if (valueType === "time") {
TIME_VALIDATION_PROP_NAMES.forEach(extractProp);
} else if (valueType === "date-time") {
DATE_VALIDATION_PROP_NAMES.forEach(extractProp);
TIME_VALIDATION_PROP_NAMES.forEach(extractProp);
DATE_TIME_VALIDATION_PROP_NAMES.forEach(extractProp);
}
return {
forwardedProps,
internalProps
};
}, [
props,
valueType
]);
};
const PickersContext = __mf_10(null);
function PickersProvider(props) {
const { contextValue, localeText, children } = props;
return jsxRuntimeExports.jsx(PickersContext.Provider, {
value: contextValue,
children: jsxRuntimeExports.jsx(LocalizationProvider, {
localeText,
children
})
});
}
const useDefaultizedDateField = (props) => {
const utils = useUtils();
const defaultDates = useDefaultDates();
return _extends$1({}, props, {
disablePast: props.disablePast ?? false,
disableFuture: props.disableFuture ?? false,
format: props.format ?? utils.formats.keyboardDate,
minDate: applyDefaultDate(utils, props.minDate, defaultDates.minDate),
maxDate: applyDefaultDate(utils, props.maxDate, defaultDates.maxDate)
});
};
const useDefaultizedTimeField = (props) => {
const utils = useUtils();
const ampm = props.ampm ?? utils.is12HourCycleInCurrentLocale();
const defaultFormat = ampm ? utils.formats.fullTime12h : utils.formats.fullTime24h;
return _extends$1({}, props, {
disablePast: props.disablePast ?? false,
disableFuture: props.disableFuture ?? false,
format: props.format ?? defaultFormat
});
};
const useDateField = (inProps) => {
const props = useDefaultizedDateField(inProps);
const { forwardedProps, internalProps } = useSplitFieldProps(props, "date");
return useField({
forwardedProps,
internalProps,
valueManager: singleItemValueManager,
fieldValueManager: singleItemFieldValueManager,
validator: validateDate,
valueType: "date"
});
};
function getPickersTextFieldUtilityClass(slot) {
return generateUtilityClass("MuiPickersTextField", slot);
}
generateUtilityClasses("MuiPickersTextField", [
"root",
"focused",
"disabled",
"error",
"required"
]);
function getPickersInputBaseUtilityClass(slot) {
return generateUtilityClass("MuiPickersInputBase", slot);
}
const pickersInputBaseClasses = generateUtilityClasses("MuiPickersInputBase", [
"root",
"focused",
"disabled",
"error",
"notchedOutline",
"sectionContent",
"sectionBefore",
"sectionAfter",
"adornedStart",
"adornedEnd",
"input"
]);
function getPickersSectionListUtilityClass(slot) {
return generateUtilityClass("MuiPickersSectionList", slot);
}
const pickersSectionListClasses = generateUtilityClasses("MuiPickersSectionList", [
"root",
"section",
"sectionContent"
]);
const _excluded$u = [
"slots",
"slotProps",
"elements",
"sectionListRef"
];
const PickersSectionListRoot = styled("div", {
name: "MuiPickersSectionList",
slot: "Root",
overridesResolver: (props, styles2) => styles2.root
})({
direction: "ltr /*! @noflip */",
outline: "none"
});
const PickersSectionListSection = styled("span", {
name: "MuiPickersSectionList",
slot: "Section",
overridesResolver: (props, styles2) => styles2.section
})({});
const PickersSectionListSectionSeparator = styled("span", {
name: "MuiPickersSectionList",
slot: "SectionSeparator",
overridesResolver: (props, styles2) => styles2.sectionSeparator
})({
whiteSpace: "pre"
});
const PickersSectionListSectionContent = styled("span", {
name: "MuiPickersSectionList",
slot: "SectionContent",
overridesResolver: (props, styles2) => styles2.sectionContent
})({
outline: "none"
});
const useUtilityClasses$m = (ownerState) => {
const { classes } = ownerState;
const slots = {
root: [
"root"
],
section: [
"section"
],
sectionContent: [
"sectionContent"
]
};
return composeClasses(slots, getPickersSectionListUtilityClass, classes);
};
function PickersSection(props) {
const { slots, slotProps, element, classes } = props;
const Section = (slots == null ? void 0 : slots.section) ?? PickersSectionListSection;
const sectionProps = useSlotProps({
elementType: Section,
externalSlotProps: slotProps == null ? void 0 : slotProps.section,
externalForwardedProps: element.container,
className: classes.section,
ownerState: {}
});
const SectionContent = (slots == null ? void 0 : slots.sectionContent) ?? PickersSectionListSectionContent;
const sectionContentProps = useSlotProps({
elementType: SectionContent,
externalSlotProps: slotProps == null ? void 0 : slotProps.sectionContent,
externalForwardedProps: element.content,
additionalProps: {
suppressContentEditableWarning: true
},
className: classes.sectionContent,
ownerState: {}
});
const SectionSeparator = (slots == null ? void 0 : slots.sectionSeparator) ?? PickersSectionListSectionSeparator;
const sectionSeparatorBeforeProps = useSlotProps({
elementType: SectionSeparator,
externalSlotProps: slotProps == null ? void 0 : slotProps.sectionSeparator,
externalForwardedProps: element.before,
ownerState: {
position: "before"
}
});
const sectionSeparatorAfterProps = useSlotProps({
elementType: SectionSeparator,
externalSlotProps: slotProps == null ? void 0 : slotProps.sectionSeparator,
externalForwardedProps: element.after,
ownerState: {
position: "after"
}
});
return jsxRuntimeExports.jsxs(Section, _extends$1({}, sectionProps, {
children: [
jsxRuntimeExports.jsx(SectionSeparator, _extends$1({}, sectionSeparatorBeforeProps)),
jsxRuntimeExports.jsx(SectionContent, _extends$1({}, sectionContentProps)),
jsxRuntimeExports.jsx(SectionSeparator, _extends$1({}, sectionSeparatorAfterProps))
]
}));
}
const PickersSectionList = __mf_14$1(function PickersSectionList2(inProps, ref) {
const props = useThemeProps({
props: inProps,
name: "MuiPickersSectionList"
});
const { slots, slotProps, elements, sectionListRef } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$u);
const classes = useUtilityClasses$m(props);
const rootRef = __mf_31(null);
const handleRootRef = useForkRef(ref, rootRef);
const getRoot = (methodName) => {
if (!rootRef.current) {
throw new Error(`MUI X: Cannot call sectionListRef.${methodName} before the mount of the component.`);
}
return rootRef.current;
};
__mf_26(sectionListRef, () => ({
getRoot() {
return getRoot("getRoot");
},
getSectionContainer(index) {
const root = getRoot("getSectionContainer");
return root.querySelector(`.${pickersSectionListClasses.section}[data-sectionindex="${index}"]`);
},
getSectionContent(index) {
const root = getRoot("getSectionContent");
return root.querySelector(`.${pickersSectionListClasses.section}[data-sectionindex="${index}"] .${pickersSectionListClasses.sectionContent}`);
},
getSectionIndexFromDOMElement(element) {
const root = getRoot("getSectionIndexFromDOMElement");
if (element == null || !root.contains(element)) {
return null;
}
let sectionContainer = null;
if (element.classList.contains(pickersSectionListClasses.section)) {
sectionContainer = element;
} else if (element.classList.contains(pickersSectionListClasses.sectionContent)) {
sectionContainer = element.parentElement;
}
if (sectionContainer == null) {
return null;
}
return Number(sectionContainer.dataset.sectionindex);
}
}));
const Root = (slots == null ? void 0 : slots.root) ?? PickersSectionListRoot;
const rootProps = useSlotProps({
elementType: Root,
externalSlotProps: slotProps == null ? void 0 : slotProps.root,
externalForwardedProps: other,
additionalProps: {
ref: handleRootRef,
suppressContentEditableWarning: true
},
className: classes.root,
ownerState: {}
});
return jsxRuntimeExports.jsx(Root, _extends$1({}, rootProps, {
children: rootProps.contentEditable ? elements.map(({ content, before, after }) => `${before.children}${content.children}${after.children}`).join("") : jsxRuntimeExports.jsx(__mf_2$1, {
children: elements.map((element, elementIndex) => jsxRuntimeExports.jsx(PickersSection, {
slots,
slotProps,
element,
classes
}, elementIndex))
})
}));
});
const _excluded$t = [
"elements",
"areAllSectionsEmpty",
"defaultValue",
"label",
"value",
"onChange",
"id",
"autoFocus",
"endAdornment",
"startAdornment",
"renderSuffix",
"slots",
"slotProps",
"contentEditable",
"tabIndex",
"onInput",
"onPaste",
"onKeyDown",
"fullWidth",
"name",
"readOnly",
"inputProps",
"inputRef",
"sectionListRef"
];
const round = (value) => Math.round(value * 1e5) / 1e5;
const PickersInputBaseRoot = styled("div", {
name: "MuiPickersInputBase",
slot: "Root",
overridesResolver: (props, styles2) => styles2.root
})(({ theme }) => _extends$1({}, theme.typography.body1, {
color: (theme.vars || theme).palette.text.primary,
cursor: "text",
padding: 0,
display: "flex",
justifyContent: "flex-start",
alignItems: "center",
position: "relative",
boxSizing: "border-box",
letterSpacing: `${round(0.15 / 16)}em`,
variants: [
{
props: {
fullWidth: true
},
style: {
width: "100%"
}
}
]
}));
const PickersInputBaseSectionsContainer = styled(PickersSectionListRoot, {
name: "MuiPickersInputBase",
slot: "SectionsContainer",
overridesResolver: (props, styles2) => styles2.sectionsContainer
})(({ theme }) => ({
padding: "4px 0 5px",
fontFamily: theme.typography.fontFamily,
fontSize: "inherit",
lineHeight: "1.4375em",
flexGrow: 1,
outline: "none",
display: "flex",
flexWrap: "nowrap",
overflow: "hidden",
letterSpacing: "inherit",
width: "182px",
variants: [
{
props: {
isRtl: true
},
style: {
textAlign: "right /*! @noflip */"
}
},
{
props: {
size: "small"
},
style: {
paddingTop: 1
}
},
{
props: {
adornedStart: false,
focused: false,
filled: false
},
style: {
color: "currentColor",
opacity: 0
}
},
{
props: ({ adornedStart, focused, filled, label }) => !adornedStart && !focused && !filled && label == null,
style: theme.vars ? {
opacity: theme.vars.opacity.inputPlaceholder
} : {
opacity: theme.palette.mode === "light" ? 0.42 : 0.5
}
}
]
}));
const PickersInputBaseSection = styled(PickersSectionListSection, {
name: "MuiPickersInputBase",
slot: "Section",
overridesResolver: (props, styles2) => styles2.section
})(({ theme }) => ({
fontFamily: theme.typography.fontFamily,
fontSize: "inherit",
letterSpacing: "inherit",
lineHeight: "1.4375em",
display: "inline-block",
whiteSpace: "nowrap"
}));
const PickersInputBaseSectionContent = styled(PickersSectionListSectionContent, {
name: "MuiPickersInputBase",
slot: "SectionContent",
overridesResolver: (props, styles2) => styles2.content
})(({ theme }) => ({
fontFamily: theme.typography.fontFamily,
lineHeight: "1.4375em",
letterSpacing: "inherit",
width: "fit-content",
outline: "none"
}));
const PickersInputBaseSectionSeparator = styled(PickersSectionListSectionSeparator, {
name: "MuiPickersInputBase",
slot: "Separator",
overridesResolver: (props, styles2) => styles2.separator
})(() => ({
whiteSpace: "pre",
letterSpacing: "inherit"
}));
const PickersInputBaseInput = styled("input", {
name: "MuiPickersInputBase",
slot: "Input",
overridesResolver: (props, styles2) => styles2.hiddenInput
})(_extends$1({}, visuallyHidden));
const useUtilityClasses$l = (ownerState) => {
const { focused, disabled, error, classes, fullWidth, readOnly, color, size, endAdornment, startAdornment } = ownerState;
const slots = {
root: [
"root",
focused && !disabled && "focused",
disabled && "disabled",
readOnly && "readOnly",
error && "error",
fullWidth && "fullWidth",
`color${capitalize(color)}`,
size === "small" && "inputSizeSmall",
Boolean(startAdornment) && "adornedStart",
Boolean(endAdornment) && "adornedEnd"
],
notchedOutline: [
"notchedOutline"
],
input: [
"input"
],
sectionsContainer: [
"sectionsContainer"
],
sectionContent: [
"sectionContent"
],
sectionBefore: [
"sectionBefore"
],
sectionAfter: [
"sectionAfter"
]
};
return composeClasses(slots, getPickersInputBaseUtilityClass, classes);
};
const PickersInputBase = __mf_14$1(function PickersInputBase2(inProps, ref) {
const props = useThemeProps({
props: inProps,
name: "MuiPickersInputBase"
});
const { elements, areAllSectionsEmpty, value, onChange, id, endAdornment, startAdornment, renderSuffix, slots, slotProps, contentEditable, tabIndex, onInput, onPaste, onKeyDown, name, readOnly, inputProps, inputRef, sectionListRef } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$t);
const rootRef = __mf_31(null);
const handleRootRef = useForkRef(ref, rootRef);
const handleInputRef = useForkRef(inputProps == null ? void 0 : inputProps.ref, inputRef);
const isRtl = useRtl();
const muiFormControl = useFormControl();
if (!muiFormControl) {
throw new Error("MUI X: PickersInputBase should always be used inside a PickersTextField component");
}
const handleInputFocus = (event) => {
var _a;
if (muiFormControl.disabled) {
event.stopPropagation();
return;
}
(_a = muiFormControl.onFocus) == null ? void 0 : _a.call(muiFormControl, event);
};
__mf_24(() => {
if (muiFormControl) {
muiFormControl.setAdornedStart(Boolean(startAdornment));
}
}, [
muiFormControl,
startAdornment
]);
__mf_24(() => {
if (!muiFormControl) {
return;
}
if (areAllSectionsEmpty) {
muiFormControl.onEmpty();
} else {
muiFormControl.onFilled();
}
}, [
muiFormControl,
areAllSectionsEmpty
]);
const ownerState = _extends$1({}, props, muiFormControl, {
isRtl
});
const classes = useUtilityClasses$l(ownerState);
const InputRoot = (slots == null ? void 0 : slots.root) || PickersInputBaseRoot;
const inputRootProps = useSlotProps({
elementType: InputRoot,
externalSlotProps: slotProps == null ? void 0 : slotProps.root,
externalForwardedProps: other,
additionalProps: {
"aria-invalid": muiFormControl.error,
ref: handleRootRef
},
className: classes.root,
ownerState
});
const InputSectionsContainer = (slots == null ? void 0 : slots.input) || PickersInputBaseSectionsContainer;
return jsxRuntimeExports.jsxs(InputRoot, _extends$1({}, inputRootProps, {
children: [
startAdornment,
jsxRuntimeExports.jsx(PickersSectionList, {
sectionListRef,
elements,
contentEditable,
tabIndex,
className: classes.sectionsContainer,
onFocus: handleInputFocus,
onBlur: muiFormControl.onBlur,
onInput,
onPaste,
onKeyDown,
slots: {
root: InputSectionsContainer,
section: PickersInputBaseSection,
sectionContent: PickersInputBaseSectionContent,
sectionSeparator: PickersInputBaseSectionSeparator
},
slotProps: {
root: {
ownerState
},
sectionContent: {
className: pickersInputBaseClasses.sectionContent
},
sectionSeparator: ({ position }) => ({
className: position === "before" ? pickersInputBaseClasses.sectionBefore : pickersInputBaseClasses.sectionAfter
})
}
}),
endAdornment,
renderSuffix ? renderSuffix(_extends$1({}, muiFormControl)) : null,
jsxRuntimeExports.jsx(PickersInputBaseInput, _extends$1({
name,
className: classes.input,
value,
onChange,
id,
"aria-hidden": "true",
tabIndex: -1,
readOnly,
required: muiFormControl.required,
disabled: muiFormControl.disabled
}, inputProps, {
ref: handleInputRef
}))
]
}));
});
function getPickersOutlinedInputUtilityClass(slot) {
return generateUtilityClass("MuiPickersOutlinedInput", slot);
}
const pickersOutlinedInputClasses = _extends$1({}, pickersInputBaseClasses, generateUtilityClasses("MuiPickersOutlinedInput", [
"root",
"notchedOutline",
"input"
]));
const _excluded$s = [
"children",
"className",
"label",
"notched",
"shrink"
];
const OutlineRoot = styled("fieldset", {
name: "MuiPickersOutlinedInput",
slot: "NotchedOutline",
overridesResolver: (props, styles2) => styles2.notchedOutline
})(({ theme }) => {
const borderColor = theme.palette.mode === "light" ? "rgba(0, 0, 0, 0.23)" : "rgba(255, 255, 255, 0.23)";
return {
textAlign: "left",
position: "absolute",
bottom: 0,
right: 0,
top: -5,
left: 0,
margin: 0,
padding: "0 8px",
pointerEvents: "none",
borderRadius: "inherit",
borderStyle: "solid",
borderWidth: 1,
overflow: "hidden",
minWidth: "0%",
borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
};
});
const OutlineLabel = styled("span")(({ theme }) => ({
fontFamily: theme.typography.fontFamily,
fontSize: "inherit"
}));
const OutlineLegend = styled("legend")(({ theme }) => ({
float: "unset",
width: "auto",
overflow: "hidden",
variants: [
{
props: {
withLabel: false
},
style: {
padding: 0,
lineHeight: "11px",
transition: theme.transitions.create("width", {
duration: 150,
easing: theme.transitions.easing.easeOut
})
}
},
{
props: {
withLabel: true
},
style: {
display: "block",
padding: 0,
height: 11,
fontSize: "0.75em",
visibility: "hidden",
maxWidth: 0.01,
transition: theme.transitions.create("max-width", {
duration: 50,
easing: theme.transitions.easing.easeOut
}),
whiteSpace: "nowrap",
"& > span": {
paddingLeft: 5,
paddingRight: 5,
display: "inline-block",
opacity: 0,
visibility: "visible"
}
}
},
{
props: {
withLabel: true,
notched: true
},
style: {
maxWidth: "100%",
transition: theme.transitions.create("max-width", {
duration: 100,
easing: theme.transitions.easing.easeOut,
delay: 50
})
}
}
]
}));
function Outline(props) {
const { className, label } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$s);
const withLabel = label != null && label !== "";
const ownerState = _extends$1({}, props, {
withLabel
});
return jsxRuntimeExports.jsx(OutlineRoot, _extends$1({
"aria-hidden": true,
className
}, other, {
ownerState,
children: jsxRuntimeExports.jsx(OutlineLegend, {
ownerState,
children: withLabel ? jsxRuntimeExports.jsx(OutlineLabel, {
children: label
}) : jsxRuntimeExports.jsx(OutlineLabel, {
className: "notranslate",
children: "\u200B"
})
})
}));
}
const _excluded$r = [
"label",
"autoFocus",
"ownerState",
"notched"
];
const PickersOutlinedInputRoot = styled(PickersInputBaseRoot, {
name: "MuiPickersOutlinedInput",
slot: "Root",
overridesResolver: (props, styles2) => styles2.root
})(({ theme }) => {
const borderColor = theme.palette.mode === "light" ? "rgba(0, 0, 0, 0.23)" : "rgba(255, 255, 255, 0.23)";
return {
padding: "0 14px",
borderRadius: (theme.vars || theme).shape.borderRadius,
[`&:hover .${pickersOutlinedInputClasses.notchedOutline}`]: {
borderColor: (theme.vars || theme).palette.text.primary
},
"@media (hover: none)": {
[`&:hover .${pickersOutlinedInputClasses.notchedOutline}`]: {
borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
}
},
[`&.${pickersOutlinedInputClasses.focused} .${pickersOutlinedInputClasses.notchedOutline}`]: {
borderStyle: "solid",
borderWidth: 2
},
[`&.${pickersOutlinedInputClasses.disabled}`]: {
[`& .${pickersOutlinedInputClasses.notchedOutline}`]: {
borderColor: (theme.vars || theme).palette.action.disabled
},
"*": {
color: (theme.vars || theme).palette.action.disabled
}
},
[`&.${pickersOutlinedInputClasses.error} .${pickersOutlinedInputClasses.notchedOutline}`]: {
borderColor: (theme.vars || theme).palette.error.main
},
variants: Object.keys((theme.vars ?? theme).palette).filter((key) => {
var _a;
return ((_a = (theme.vars ?? theme).palette[key]) == null ? void 0 : _a.main) ?? false;
}).map((color) => ({
props: {
color
},
style: {
[`&.${pickersOutlinedInputClasses.focused}:not(.${pickersOutlinedInputClasses.error}) .${pickersOutlinedInputClasses.notchedOutline}`]: {
borderColor: (theme.vars || theme).palette[color].main
}
}
}))
};
});
const PickersOutlinedInputSectionsContainer = styled(PickersInputBaseSectionsContainer, {
name: "MuiPickersOutlinedInput",
slot: "SectionsContainer",
overridesResolver: (props, styles2) => styles2.sectionsContainer
})({
padding: "16.5px 0",
variants: [
{
props: {
size: "small"
},
style: {
padding: "8.5px 0"
}
}
]
});
const useUtilityClasses$k = (ownerState) => {
const { classes } = ownerState;
const slots = {
root: [
"root"
],
notchedOutline: [
"notchedOutline"
],
input: [
"input"
]
};
const composedClasses = composeClasses(slots, getPickersOutlinedInputUtilityClass, classes);
return _extends$1({}, classes, composedClasses);
};
const PickersOutlinedInput = __mf_14$1(function PickersOutlinedInput2(inProps, ref) {
const props = useThemeProps({
props: inProps,
name: "MuiPickersOutlinedInput"
});
const { label, ownerState: ownerStateProp, notched } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$r);
const muiFormControl = useFormControl();
const ownerState = _extends$1({}, props, ownerStateProp, muiFormControl, {
color: (muiFormControl == null ? void 0 : muiFormControl.color) || "primary"
});
const classes = useUtilityClasses$k(ownerState);
return jsxRuntimeExports.jsx(PickersInputBase, _extends$1({
slots: {
root: PickersOutlinedInputRoot,
input: PickersOutlinedInputSectionsContainer
},
renderSuffix: (state) => jsxRuntimeExports.jsx(Outline, {
shrink: Boolean(notched || state.adornedStart || state.focused || state.filled),
notched: Boolean(notched || state.adornedStart || state.focused || state.filled),
className: classes.notchedOutline,
label: label != null && label !== "" && (muiFormControl == null ? void 0 : muiFormControl.required) ? jsxRuntimeExports.jsxs(__mf_2$1, {
children: [
label,
"\u2009",
"*"
]
}) : label,
ownerState
})
}, other, {
label,
classes,
ref
}));
});
PickersOutlinedInput.muiName = "Input";
function getPickersFilledInputUtilityClass(slot) {
return generateUtilityClass("MuiPickersFilledInput", slot);
}
const pickersFilledInputClasses = _extends$1({}, pickersInputBaseClasses, generateUtilityClasses("MuiPickersFilledInput", [
"root",
"underline",
"input"
]));
const _excluded$q = [
"label",
"autoFocus",
"disableUnderline",
"ownerState"
];
const PickersFilledInputRoot = styled(PickersInputBaseRoot, {
name: "MuiPickersFilledInput",
slot: "Root",
overridesResolver: (props, styles2) => styles2.root,
shouldForwardProp: (prop) => __mf_131(prop) && prop !== "disableUnderline"
})(({ theme }) => {
const light = theme.palette.mode === "light";
const bottomLineColor = light ? "rgba(0, 0, 0, 0.42)" : "rgba(255, 255, 255, 0.7)";
const backgroundColor = light ? "rgba(0, 0, 0, 0.06)" : "rgba(255, 255, 255, 0.09)";
const hoverBackground = light ? "rgba(0, 0, 0, 0.09)" : "rgba(255, 255, 255, 0.13)";
const disabledBackground = light ? "rgba(0, 0, 0, 0.12)" : "rgba(255, 255, 255, 0.12)";
return {
backgroundColor: theme.vars ? theme.vars.palette.FilledInput.bg : backgroundColor,
borderTopLeftRadius: (theme.vars || theme).shape.borderRadius,
borderTopRightRadius: (theme.vars || theme).shape.borderRadius,
transition: theme.transitions.create("background-color", {
duration: theme.transitions.duration.shorter,
easing: theme.transitions.easing.easeOut
}),
"&:hover": {
backgroundColor: theme.vars ? theme.vars.palette.FilledInput.hoverBg : hoverBackground,
"@media (hover: none)": {
backgroundColor: theme.vars ? theme.vars.palette.FilledInput.bg : backgroundColor
}
},
[`&.${pickersFilledInputClasses.focused}`]: {
backgroundColor: theme.vars ? theme.vars.palette.FilledInput.bg : backgroundColor
},
[`&.${pickersFilledInputClasses.disabled}`]: {
backgroundColor: theme.vars ? theme.vars.palette.FilledInput.disabledBg : disabledBackground
},
variants: [
...Object.keys((theme.vars ?? theme).palette).filter((key) => (theme.vars ?? theme).palette[key].main).map((color) => {
var _a;
return {
props: {
color,
disableUnderline: false
},
style: {
"&::after": {
borderBottom: `2px solid ${(_a = (theme.vars || theme).palette[color]) == null ? void 0 : _a.main}`
}
}
};
}),
{
props: {
disableUnderline: false
},
style: {
"&::after": {
left: 0,
bottom: 0,
content: '""',
position: "absolute",
right: 0,
transform: "scaleX(0)",
transition: theme.transitions.create("transform", {
duration: theme.transitions.duration.shorter,
easing: theme.transitions.easing.easeOut
}),
pointerEvents: "none"
},
[`&.${pickersFilledInputClasses.focused}:after`]: {
transform: "scaleX(1) translateX(0)"
},
[`&.${pickersFilledInputClasses.error}`]: {
"&:before, &:after": {
borderBottomColor: (theme.vars || theme).palette.error.main
}
},
"&::before": {
borderBottom: `1px solid ${theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / ${theme.vars.opacity.inputUnderline})` : bottomLineColor}`,
left: 0,
bottom: 0,
content: '"\\00a0"',
position: "absolute",
right: 0,
transition: theme.transitions.create("border-bottom-color", {
duration: theme.transitions.duration.shorter
}),
pointerEvents: "none"
},
[`&:hover:not(.${pickersFilledInputClasses.disabled}, .${pickersFilledInputClasses.error}):before`]: {
borderBottom: `1px solid ${(theme.vars || theme).palette.text.primary}`
},
[`&.${pickersFilledInputClasses.disabled}:before`]: {
borderBottomStyle: "dotted"
}
}
},
{
props: ({ startAdornment }) => !!startAdornment,
style: {
paddingLeft: 12
}
},
{
props: ({ endAdornment }) => !!endAdornment,
style: {
paddingRight: 12
}
}
]
};
});
const PickersFilledSectionsContainer = styled(PickersInputBaseSectionsContainer, {
name: "MuiPickersFilledInput",
slot: "sectionsContainer",
overridesResolver: (props, styles2) => styles2.sectionsContainer
})({
paddingTop: 25,
paddingRight: 12,
paddingBottom: 8,
paddingLeft: 12,
variants: [
{
props: {
size: "small"
},
style: {
paddingTop: 21,
paddingBottom: 4
}
},
{
props: ({ startAdornment }) => !!startAdornment,
style: {
paddingLeft: 0
}
},
{
props: ({ endAdornment }) => !!endAdornment,
style: {
paddingRight: 0
}
},
{
props: {
hiddenLabel: true
},
style: {
paddingTop: 16,
paddingBottom: 17
}
},
{
props: {
hiddenLabel: true,
size: "small"
},
style: {
paddingTop: 8,
paddingBottom: 9
}
}
]
});
const useUtilityClasses$j = (ownerState) => {
const { classes, disableUnderline } = ownerState;
const slots = {
root: [
"root",
!disableUnderline && "underline"
],
input: [
"input"
]
};
const composedClasses = composeClasses(slots, getPickersFilledInputUtilityClass, classes);
return _extends$1({}, classes, composedClasses);
};
const PickersFilledInput = __mf_14$1(function PickersFilledInput2(inProps, ref) {
const props = useThemeProps({
props: inProps,
name: "MuiPickersFilledInput"
});
const { label, disableUnderline = false, ownerState: ownerStateProp } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$q);
const muiFormControl = useFormControl();
const ownerState = _extends$1({}, props, ownerStateProp, muiFormControl, {
color: (muiFormControl == null ? void 0 : muiFormControl.color) || "primary"
});
const classes = useUtilityClasses$j(ownerState);
return jsxRuntimeExports.jsx(PickersInputBase, _extends$1({
slots: {
root: PickersFilledInputRoot,
input: PickersFilledSectionsContainer
},
slotProps: {
root: {
disableUnderline
}
}
}, other, {
label,
classes,
ref
}));
});
PickersFilledInput.muiName = "Input";
function getPickersInputUtilityClass(slot) {
return generateUtilityClass("MuiPickersFilledInput", slot);
}
const pickersInputClasses = _extends$1({}, pickersInputBaseClasses, generateUtilityClasses("MuiPickersInput", [
"root",
"input"
]));
const _excluded$p = [
"label",
"autoFocus",
"disableUnderline",
"ownerState"
];
const PickersInputRoot = styled(PickersInputBaseRoot, {
name: "MuiPickersInput",
slot: "Root",
overridesResolver: (props, styles2) => styles2.root
})(({ theme }) => {
const light = theme.palette.mode === "light";
let bottomLineColor = light ? "rgba(0, 0, 0, 0.42)" : "rgba(255, 255, 255, 0.7)";
if (theme.vars) {
bottomLineColor = `rgba(${theme.vars.palette.common.onBackgroundChannel} / ${theme.vars.opacity.inputUnderline})`;
}
return {
"label + &": {
marginTop: 16
},
variants: [
...Object.keys((theme.vars ?? theme).palette).filter((key) => (theme.vars ?? theme).palette[key].main).map((color) => ({
props: {
color
},
style: {
"&::after": {
borderBottom: `2px solid ${(theme.vars || theme).palette[color].main}`
}
}
})),
{
props: {
disableUnderline: false
},
style: {
"&::after": {
background: "red",
left: 0,
bottom: 0,
content: '""',
position: "absolute",
right: 0,
transform: "scaleX(0)",
transition: theme.transitions.create("transform", {
duration: theme.transitions.duration.shorter,
easing: theme.transitions.easing.easeOut
}),
pointerEvents: "none"
},
[`&.${pickersInputClasses.focused}:after`]: {
transform: "scaleX(1) translateX(0)"
},
[`&.${pickersInputClasses.error}`]: {
"&:before, &:after": {
borderBottomColor: (theme.vars || theme).palette.error.main
}
},
"&::before": {
borderBottom: `1px solid ${bottomLineColor}`,
left: 0,
bottom: 0,
content: '"\\00a0"',
position: "absolute",
right: 0,
transition: theme.transitions.create("border-bottom-color", {
duration: theme.transitions.duration.shorter
}),
pointerEvents: "none"
},
[`&:hover:not(.${pickersInputClasses.disabled}, .${pickersInputClasses.error}):before`]: {
borderBottom: `2px solid ${(theme.vars || theme).palette.text.primary}`,
"@media (hover: none)": {
borderBottom: `1px solid ${bottomLineColor}`
}
},
[`&.${pickersInputClasses.disabled}:before`]: {
borderBottomStyle: "dotted"
}
}
}
]
};
});
const useUtilityClasses$i = (ownerState) => {
const { classes, disableUnderline } = ownerState;
const slots = {
root: [
"root",
!disableUnderline && "underline"
],
input: [
"input"
]
};
const composedClasses = composeClasses(slots, getPickersInputUtilityClass, classes);
return _extends$1({}, classes, composedClasses);
};
const PickersInput = __mf_14$1(function PickersInput2(inProps, ref) {
const props = useThemeProps({
props: inProps,
name: "MuiPickersInput"
});
const { label, disableUnderline = false, ownerState: ownerStateProp } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$p);
const muiFormControl = useFormControl();
const ownerState = _extends$1({}, props, ownerStateProp, muiFormControl, {
disableUnderline,
color: (muiFormControl == null ? void 0 : muiFormControl.color) || "primary"
});
const classes = useUtilityClasses$i(ownerState);
return jsxRuntimeExports.jsx(PickersInputBase, _extends$1({
slots: {
root: PickersInputRoot
}
}, other, {
label,
classes,
ref
}));
});
PickersInput.muiName = "Input";
const _excluded$o = [
"onFocus",
"onBlur",
"className",
"color",
"disabled",
"error",
"variant",
"required",
"InputProps",
"inputProps",
"inputRef",
"sectionListRef",
"elements",
"areAllSectionsEmpty",
"onClick",
"onKeyDown",
"onKeyUp",
"onPaste",
"onInput",
"endAdornment",
"startAdornment",
"tabIndex",
"contentEditable",
"focused",
"value",
"onChange",
"fullWidth",
"id",
"name",
"helperText",
"FormHelperTextProps",
"label",
"InputLabelProps"
];
const VARIANT_COMPONENT = {
standard: PickersInput,
filled: PickersFilledInput,
outlined: PickersOutlinedInput
};
const PickersTextFieldRoot = styled(FormControl, {
name: "MuiPickersTextField",
slot: "Root",
overridesResolver: (props, styles2) => styles2.root
})({
maxWidth: "100%"
});
const useUtilityClasses$h = (ownerState) => {
const { focused, disabled, classes, required } = ownerState;
const slots = {
root: [
"root",
focused && !disabled && "focused",
disabled && "disabled",
required && "required"
]
};
return composeClasses(slots, getPickersTextFieldUtilityClass, classes);
};
const PickersTextField = __mf_14$1(function PickersTextField2(inProps, ref) {
const props = useThemeProps({
props: inProps,
name: "MuiPickersTextField"
});
const { onFocus, onBlur, className, color = "primary", disabled = false, error = false, variant = "outlined", required = false, InputProps, inputProps, inputRef, sectionListRef, elements, areAllSectionsEmpty, onClick, onKeyDown, onKeyUp, onPaste, onInput, endAdornment, startAdornment, tabIndex, contentEditable, focused, value, onChange, fullWidth, id: idProp, name, helperText, FormHelperTextProps, label, InputLabelProps } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$o);
const rootRef = __mf_31(null);
const handleRootRef = useForkRef(ref, rootRef);
const id = useId(idProp);
const helperTextId = helperText && id ? `${id}-helper-text` : void 0;
const inputLabelId = label && id ? `${id}-label` : void 0;
const ownerState = _extends$1({}, props, {
color,
disabled,
error,
focused,
required,
variant
});
const classes = useUtilityClasses$h(ownerState);
const PickersInputComponent = VARIANT_COMPONENT[variant];
return jsxRuntimeExports.jsxs(PickersTextFieldRoot, _extends$1({
className: clsx(classes.root, className),
ref: handleRootRef,
focused,
onFocus,
onBlur,
disabled,
variant,
error,
color,
fullWidth,
required,
ownerState
}, other, {
children: [
jsxRuntimeExports.jsx(InputLabel, _extends$1({
htmlFor: id,
id: inputLabelId
}, InputLabelProps, {
children: label
})),
jsxRuntimeExports.jsx(PickersInputComponent, _extends$1({
elements,
areAllSectionsEmpty,
onClick,
onKeyDown,
onKeyUp,
onInput,
onPaste,
endAdornment,
startAdornment,
tabIndex,
contentEditable,
value,
onChange,
id,
fullWidth,
inputProps,
inputRef,
sectionListRef,
label,
name,
role: "group",
"aria-labelledby": inputLabelId,
"aria-describedby": helperTextId,
"aria-live": helperTextId ? "polite" : void 0
}, InputProps)),
helperText && jsxRuntimeExports.jsx(FormHelperText, _extends$1({
id: helperTextId
}, FormHelperTextProps, {
children: helperText
}))
]
}));
});
const _excluded$n = [
"enableAccessibleFieldDOMStructure"
], _excluded2$4 = [
"InputProps",
"readOnly"
], _excluded3$1 = [
"onPaste",
"onKeyDown",
"inputMode",
"readOnly",
"InputProps",
"inputProps",
"inputRef"
];
const convertFieldResponseIntoMuiTextFieldProps = (_ref) => {
let { enableAccessibleFieldDOMStructure } = _ref, fieldResponse = _objectWithoutPropertiesLoose$1(_ref, _excluded$n);
if (enableAccessibleFieldDOMStructure) {
const { InputProps: InputProps2, readOnly: readOnly2 } = fieldResponse, other2 = _objectWithoutPropertiesLoose$1(fieldResponse, _excluded2$4);
return _extends$1({}, other2, {
InputProps: _extends$1({}, InputProps2 ?? {}, {
readOnly: readOnly2
})
});
}
const { onPaste, onKeyDown, inputMode, readOnly, InputProps, inputProps, inputRef } = fieldResponse, other = _objectWithoutPropertiesLoose$1(fieldResponse, _excluded3$1);
return _extends$1({}, other, {
InputProps: _extends$1({}, InputProps ?? {}, {
readOnly
}),
inputProps: _extends$1({}, inputProps ?? {}, {
inputMode,
onPaste,
onKeyDown,
ref: inputRef
})
});
};
const _excluded$m = [
"slots",
"slotProps",
"InputProps",
"inputProps"
];
const DateField = __mf_14$1(function DateField2(inProps, inRef) {
const themeProps = useThemeProps({
props: inProps,
name: "MuiDateField"
});
const { slots, slotProps, InputProps, inputProps } = themeProps, other = _objectWithoutPropertiesLoose$1(themeProps, _excluded$m);
const ownerState = themeProps;
const TextField$1 = (slots == null ? void 0 : slots.textField) ?? (inProps.enableAccessibleFieldDOMStructure ? PickersTextField : TextField);
const textFieldProps = useSlotProps({
elementType: TextField$1,
externalSlotProps: slotProps == null ? void 0 : slotProps.textField,
externalForwardedProps: other,
additionalProps: {
ref: inRef
},
ownerState
});
textFieldProps.inputProps = _extends$1({}, inputProps, textFieldProps.inputProps);
textFieldProps.InputProps = _extends$1({}, InputProps, textFieldProps.InputProps);
const fieldResponse = useDateField(textFieldProps);
const convertedFieldResponse = convertFieldResponseIntoMuiTextFieldProps(fieldResponse);
const processedFieldProps = useClearableField(_extends$1({}, convertedFieldResponse, {
slots,
slotProps
}));
return jsxRuntimeExports.jsx(TextField$1, _extends$1({}, processedFieldProps));
});
const useTimeField = (inProps) => {
const props = useDefaultizedTimeField(inProps);
const { forwardedProps, internalProps } = useSplitFieldProps(props, "time");
return useField({
forwardedProps,
internalProps,
valueManager: singleItemValueManager,
fieldValueManager: singleItemFieldValueManager,
validator: validateTime,
valueType: "time"
});
};
const _excluded$l = [
"slots",
"slotProps",
"InputProps",
"inputProps"
];
const TimeField = __mf_14$1(function TimeField2(inProps, inRef) {
const themeProps = useThemeProps({
props: inProps,
name: "MuiTimeField"
});
const { slots, slotProps, InputProps, inputProps } = themeProps, other = _objectWithoutPropertiesLoose$1(themeProps, _excluded$l);
const ownerState = themeProps;
const TextField$1 = (slots == null ? void 0 : slots.textField) ?? (inProps.enableAccessibleFieldDOMStructure ? PickersTextField : TextField);
const textFieldProps = useSlotProps({
elementType: TextField$1,
externalSlotProps: slotProps == null ? void 0 : slotProps.textField,
externalForwardedProps: other,
ownerState,
additionalProps: {
ref: inRef
}
});
textFieldProps.inputProps = _extends$1({}, inputProps, textFieldProps.inputProps);
textFieldProps.InputProps = _extends$1({}, InputProps, textFieldProps.InputProps);
const fieldResponse = useTimeField(textFieldProps);
const convertedFieldResponse = convertFieldResponseIntoMuiTextFieldProps(fieldResponse);
const processedFieldProps = useClearableField(_extends$1({}, convertedFieldResponse, {
slots,
slotProps
}));
return jsxRuntimeExports.jsx(TextField$1, _extends$1({}, processedFieldProps));
});
const useIsDateDisabled = ({ shouldDisableDate, shouldDisableMonth, shouldDisableYear, minDate, maxDate, disableFuture, disablePast, timezone }) => {
const adapter = useLocalizationContext();
return __mf_20((day) => validateDate({
adapter,
value: day,
timezone,
props: {
shouldDisableDate,
shouldDisableMonth,
shouldDisableYear,
minDate,
maxDate,
disableFuture,
disablePast
}
}) !== null, [
adapter,
shouldDisableDate,
shouldDisableMonth,
shouldDisableYear,
minDate,
maxDate,
disableFuture,
disablePast,
timezone
]);
};
const createCalendarStateReducer = (reduceAnimations, disableSwitchToMonthOnDayFocus, utils) => (state, action) => {
switch (action.type) {
case "changeMonth":
return _extends$1({}, state, {
slideDirection: action.direction,
currentMonth: action.newMonth,
isMonthSwitchingAnimating: !reduceAnimations
});
case "changeMonthTimezone": {
const newTimezone = action.newTimezone;
if (utils.getTimezone(state.currentMonth) === newTimezone) {
return state;
}
let newCurrentMonth = utils.setTimezone(state.currentMonth, newTimezone);
if (utils.getMonth(newCurrentMonth) !== utils.getMonth(state.currentMonth)) {
newCurrentMonth = utils.setMonth(newCurrentMonth, utils.getMonth(state.currentMonth));
}
return _extends$1({}, state, {
currentMonth: newCurrentMonth
});
}
case "finishMonthSwitchingAnimation":
return _extends$1({}, state, {
isMonthSwitchingAnimating: false
});
case "changeFocusedDay": {
if (state.focusedDay != null && action.focusedDay != null && utils.isSameDay(action.focusedDay, state.focusedDay)) {
return state;
}
const needMonthSwitch = action.focusedDay != null && !disableSwitchToMonthOnDayFocus && !utils.isSameMonth(state.currentMonth, action.focusedDay);
return _extends$1({}, state, {
focusedDay: action.focusedDay,
isMonthSwitchingAnimating: needMonthSwitch && !reduceAnimations && !action.withoutMonthSwitchingAnimation,
currentMonth: needMonthSwitch ? utils.startOfMonth(action.focusedDay) : state.currentMonth,
slideDirection: action.focusedDay != null && utils.isAfterDay(action.focusedDay, state.currentMonth) ? "left" : "right"
});
}
default:
throw new Error("missing support");
}
};
const useCalendarState = (params) => {
const { value, referenceDate: referenceDateProp, disableFuture, disablePast, disableSwitchToMonthOnDayFocus = false, maxDate, minDate, onMonthChange, reduceAnimations, shouldDisableDate, timezone } = params;
const utils = useUtils();
const reducerFn = __mf_31(createCalendarStateReducer(Boolean(reduceAnimations), disableSwitchToMonthOnDayFocus, utils)).current;
const referenceDate = __mf_29(() => {
return singleItemValueManager.getInitialReferenceValue({
value,
utils,
timezone,
props: params,
referenceDate: referenceDateProp,
granularity: SECTION_TYPE_GRANULARITY.day
});
}, [
referenceDateProp,
timezone
]);
const [calendarState, dispatch] = __mf_30(reducerFn, {
isMonthSwitchingAnimating: false,
focusedDay: referenceDate,
currentMonth: utils.startOfMonth(referenceDate),
slideDirection: "left"
});
__mf_24(() => {
dispatch({
type: "changeMonthTimezone",
newTimezone: utils.getTimezone(referenceDate)
});
}, [
referenceDate,
utils
]);
const handleChangeMonth = __mf_20((payload) => {
dispatch(_extends$1({
type: "changeMonth"
}, payload));
if (onMonthChange) {
onMonthChange(payload.newMonth);
}
}, [
onMonthChange
]);
const changeMonth = __mf_20((newDate) => {
const newDateRequested = newDate;
if (utils.isSameMonth(newDateRequested, calendarState.currentMonth)) {
return;
}
handleChangeMonth({
newMonth: utils.startOfMonth(newDateRequested),
direction: utils.isAfterDay(newDateRequested, calendarState.currentMonth) ? "left" : "right"
});
}, [
calendarState.currentMonth,
handleChangeMonth,
utils
]);
const isDateDisabled = useIsDateDisabled({
shouldDisableDate,
minDate,
maxDate,
disableFuture,
disablePast,
timezone
});
const onMonthSwitchingAnimationEnd = __mf_20(() => {
dispatch({
type: "finishMonthSwitchingAnimation"
});
}, []);
const changeFocusedDay = useEventCallback((newFocusedDate, withoutMonthSwitchingAnimation) => {
if (!isDateDisabled(newFocusedDate)) {
dispatch({
type: "changeFocusedDay",
focusedDay: newFocusedDate,
withoutMonthSwitchingAnimation
});
}
});
return {
referenceDate,
calendarState,
changeMonth,
changeFocusedDay,
isDateDisabled,
onMonthSwitchingAnimationEnd,
handleChangeMonth
};
};
const getPickersFadeTransitionGroupUtilityClass = (slot) => generateUtilityClass("MuiPickersFadeTransitionGroup", slot);
generateUtilityClasses("MuiPickersFadeTransitionGroup", [
"root"
]);
const useUtilityClasses$g = (ownerState) => {
const { classes } = ownerState;
const slots = {
root: [
"root"
]
};
return composeClasses(slots, getPickersFadeTransitionGroupUtilityClass, classes);
};
const PickersFadeTransitionGroupRoot = styled(TransitionGroup, {
name: "MuiPickersFadeTransitionGroup",
slot: "Root",
overridesResolver: (_, styles2) => styles2.root
})({
display: "block",
position: "relative"
});
function PickersFadeTransitionGroup(inProps) {
const props = useThemeProps({
props: inProps,
name: "MuiPickersFadeTransitionGroup"
});
const { children, className, reduceAnimations, transKey } = props;
const classes = useUtilityClasses$g(props);
const theme = useTheme();
if (reduceAnimations) {
return children;
}
return jsxRuntimeExports.jsx(PickersFadeTransitionGroupRoot, {
className: clsx(classes.root, className),
children: jsxRuntimeExports.jsx(Fade, {
appear: false,
mountOnEnter: true,
unmountOnExit: true,
timeout: {
appear: theme.transitions.duration.enteringScreen,
enter: theme.transitions.duration.enteringScreen,
exit: 0
},
children
}, transKey)
});
}
const getPickersSlideTransitionUtilityClass = (slot) => generateUtilityClass("MuiPickersSlideTransition", slot);
const pickersSlideTransitionClasses = generateUtilityClasses("MuiPickersSlideTransition", [
"root",
"slideEnter-left",
"slideEnter-right",
"slideEnterActive",
"slideExit",
"slideExitActiveLeft-left",
"slideExitActiveLeft-right"
]);
const _excluded$k = [
"children",
"className",
"reduceAnimations",
"slideDirection",
"transKey",
"classes"
];
const useUtilityClasses$f = (ownerState) => {
const { classes, slideDirection } = ownerState;
const slots = {
root: [
"root"
],
exit: [
"slideExit"
],
enterActive: [
"slideEnterActive"
],
enter: [
`slideEnter-${slideDirection}`
],
exitActive: [
`slideExitActiveLeft-${slideDirection}`
]
};
return composeClasses(slots, getPickersSlideTransitionUtilityClass, classes);
};
const PickersSlideTransitionRoot = styled(TransitionGroup, {
name: "MuiPickersSlideTransition",
slot: "Root",
overridesResolver: (_, styles2) => [
styles2.root,
{
[`.${pickersSlideTransitionClasses["slideEnter-left"]}`]: styles2["slideEnter-left"]
},
{
[`.${pickersSlideTransitionClasses["slideEnter-right"]}`]: styles2["slideEnter-right"]
},
{
[`.${pickersSlideTransitionClasses.slideEnterActive}`]: styles2.slideEnterActive
},
{
[`.${pickersSlideTransitionClasses.slideExit}`]: styles2.slideExit
},
{
[`.${pickersSlideTransitionClasses["slideExitActiveLeft-left"]}`]: styles2["slideExitActiveLeft-left"]
},
{
[`.${pickersSlideTransitionClasses["slideExitActiveLeft-right"]}`]: styles2["slideExitActiveLeft-right"]
}
]
})(({ theme }) => {
const slideTransition = theme.transitions.create("transform", {
duration: theme.transitions.duration.complex,
easing: "cubic-bezier(0.35, 0.8, 0.4, 1)"
});
return {
display: "block",
position: "relative",
overflowX: "hidden",
"& > *": {
position: "absolute",
top: 0,
right: 0,
left: 0
},
[`& .${pickersSlideTransitionClasses["slideEnter-left"]}`]: {
willChange: "transform",
transform: "translate(100%)",
zIndex: 1
},
[`& .${pickersSlideTransitionClasses["slideEnter-right"]}`]: {
willChange: "transform",
transform: "translate(-100%)",
zIndex: 1
},
[`& .${pickersSlideTransitionClasses.slideEnterActive}`]: {
transform: "translate(0%)",
transition: slideTransition
},
[`& .${pickersSlideTransitionClasses.slideExit}`]: {
transform: "translate(0%)"
},
[`& .${pickersSlideTransitionClasses["slideExitActiveLeft-left"]}`]: {
willChange: "transform",
transform: "translate(-100%)",
transition: slideTransition,
zIndex: 0
},
[`& .${pickersSlideTransitionClasses["slideExitActiveLeft-right"]}`]: {
willChange: "transform",
transform: "translate(100%)",
transition: slideTransition,
zIndex: 0
}
};
});
function PickersSlideTransition(inProps) {
const props = useThemeProps({
props: inProps,
name: "MuiPickersSlideTransition"
});
const { children, className, reduceAnimations, transKey } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$k);
const classes = useUtilityClasses$f(props);
const theme = useTheme();
if (reduceAnimations) {
return jsxRuntimeExports.jsx("div", {
className: clsx(classes.root, className),
children
});
}
const transitionClasses = {
exit: classes.exit,
enterActive: classes.enterActive,
enter: classes.enter,
exitActive: classes.exitActive
};
return jsxRuntimeExports.jsx(PickersSlideTransitionRoot, {
className: clsx(classes.root, className),
childFactory: (element) => __mf_9(element, {
classNames: transitionClasses
}),
role: "presentation",
children: jsxRuntimeExports.jsx(CSSTransition, _extends$1({
mountOnEnter: true,
unmountOnExit: true,
timeout: theme.transitions.duration.complex,
classNames: transitionClasses
}, other, {
children
}), transKey)
});
}
const getDayCalendarUtilityClass = (slot) => generateUtilityClass("MuiDayCalendar", slot);
generateUtilityClasses("MuiDayCalendar", [
"root",
"header",
"weekDayLabel",
"loadingContainer",
"slideTransition",
"monthContainer",
"weekContainer",
"weekNumberLabel",
"weekNumber"
]);
const _excluded$j = [
"parentProps",
"day",
"focusableDay",
"selectedDays",
"isDateDisabled",
"currentMonthNumber",
"isViewFocused"
], _excluded2$3 = [
"ownerState"
];
const useUtilityClasses$e = (ownerState) => {
const { classes } = ownerState;
const slots = {
root: [
"root"
],
header: [
"header"
],
weekDayLabel: [
"weekDayLabel"
],
loadingContainer: [
"loadingContainer"
],
slideTransition: [
"slideTransition"
],
monthContainer: [
"monthContainer"
],
weekContainer: [
"weekContainer"
],
weekNumberLabel: [
"weekNumberLabel"
],
weekNumber: [
"weekNumber"
]
};
return composeClasses(slots, getDayCalendarUtilityClass, classes);
};
const weeksContainerHeight = (DAY_SIZE + DAY_MARGIN * 2) * 6;
const PickersCalendarDayRoot = styled("div", {
name: "MuiDayCalendar",
slot: "Root",
overridesResolver: (_, styles2) => styles2.root
})({});
const PickersCalendarDayHeader = styled("div", {
name: "MuiDayCalendar",
slot: "Header",
overridesResolver: (_, styles2) => styles2.header
})({
display: "flex",
justifyContent: "center",
alignItems: "center"
});
const PickersCalendarWeekDayLabel = styled(Typography, {
name: "MuiDayCalendar",
slot: "WeekDayLabel",
overridesResolver: (_, styles2) => styles2.weekDayLabel
})(({ theme }) => ({
width: 36,
height: 40,
margin: "0 2px",
textAlign: "center",
display: "flex",
justifyContent: "center",
alignItems: "center",
color: (theme.vars || theme).palette.text.secondary
}));
const PickersCalendarWeekNumberLabel = styled(Typography, {
name: "MuiDayCalendar",
slot: "WeekNumberLabel",
overridesResolver: (_, styles2) => styles2.weekNumberLabel
})(({ theme }) => ({
width: 36,
height: 40,
margin: "0 2px",
textAlign: "center",
display: "flex",
justifyContent: "center",
alignItems: "center",
color: theme.palette.text.disabled
}));
const PickersCalendarWeekNumber = styled(Typography, {
name: "MuiDayCalendar",
slot: "WeekNumber",
overridesResolver: (_, styles2) => styles2.weekNumber
})(({ theme }) => _extends$1({}, theme.typography.caption, {
width: DAY_SIZE,
height: DAY_SIZE,
padding: 0,
margin: `0 ${DAY_MARGIN}px`,
color: theme.palette.text.disabled,
fontSize: "0.75rem",
alignItems: "center",
justifyContent: "center",
display: "inline-flex"
}));
const PickersCalendarLoadingContainer = styled("div", {
name: "MuiDayCalendar",
slot: "LoadingContainer",
overridesResolver: (_, styles2) => styles2.loadingContainer
})({
display: "flex",
justifyContent: "center",
alignItems: "center",
minHeight: weeksContainerHeight
});
const PickersCalendarSlideTransition = styled(PickersSlideTransition, {
name: "MuiDayCalendar",
slot: "SlideTransition",
overridesResolver: (_, styles2) => styles2.slideTransition
})({
minHeight: weeksContainerHeight
});
const PickersCalendarWeekContainer = styled("div", {
name: "MuiDayCalendar",
slot: "MonthContainer",
overridesResolver: (_, styles2) => styles2.monthContainer
})({
overflow: "hidden"
});
const PickersCalendarWeek = styled("div", {
name: "MuiDayCalendar",
slot: "WeekContainer",
overridesResolver: (_, styles2) => styles2.weekContainer
})({
margin: `${DAY_MARGIN}px 0`,
display: "flex",
justifyContent: "center"
});
function WrappedDay(_ref) {
let { parentProps, day, focusableDay, selectedDays, isDateDisabled, currentMonthNumber, isViewFocused } = _ref, other = _objectWithoutPropertiesLoose$1(_ref, _excluded$j);
const { disabled, disableHighlightToday, isMonthSwitchingAnimating, showDaysOutsideCurrentMonth, slots, slotProps, timezone } = parentProps;
const utils = useUtils();
const now2 = useNow(timezone);
const isFocusableDay = focusableDay !== null && utils.isSameDay(day, focusableDay);
const isSelected = selectedDays.some((selectedDay) => utils.isSameDay(selectedDay, day));
const isToday = utils.isSameDay(day, now2);
const Day = (slots == null ? void 0 : slots.day) ?? PickersDay;
const _useSlotProps = useSlotProps({
elementType: Day,
externalSlotProps: slotProps == null ? void 0 : slotProps.day,
additionalProps: _extends$1({
disableHighlightToday,
showDaysOutsideCurrentMonth,
role: "gridcell",
isAnimating: isMonthSwitchingAnimating,
"data-timestamp": utils.toJsDate(day).valueOf()
}, other),
ownerState: _extends$1({}, parentProps, {
day,
selected: isSelected
})
}), dayProps = _objectWithoutPropertiesLoose$1(_useSlotProps, _excluded2$3);
const isDisabled = __mf_29(() => disabled || isDateDisabled(day), [
disabled,
isDateDisabled,
day
]);
const outsideCurrentMonth = __mf_29(() => utils.getMonth(day) !== currentMonthNumber, [
utils,
day,
currentMonthNumber
]);
const isFirstVisibleCell = __mf_29(() => {
const startOfMonth = utils.startOfMonth(utils.setMonth(day, currentMonthNumber));
if (!showDaysOutsideCurrentMonth) {
return utils.isSameDay(day, startOfMonth);
}
return utils.isSameDay(day, utils.startOfWeek(startOfMonth));
}, [
currentMonthNumber,
day,
showDaysOutsideCurrentMonth,
utils
]);
const isLastVisibleCell = __mf_29(() => {
const endOfMonth = utils.endOfMonth(utils.setMonth(day, currentMonthNumber));
if (!showDaysOutsideCurrentMonth) {
return utils.isSameDay(day, endOfMonth);
}
return utils.isSameDay(day, utils.endOfWeek(endOfMonth));
}, [
currentMonthNumber,
day,
showDaysOutsideCurrentMonth,
utils
]);
return jsxRuntimeExports.jsx(Day, _extends$1({}, dayProps, {
day,
disabled: isDisabled,
autoFocus: isViewFocused && isFocusableDay,
today: isToday,
outsideCurrentMonth,
isFirstVisibleCell,
isLastVisibleCell,
selected: isSelected,
tabIndex: isFocusableDay ? 0 : -1,
"aria-selected": isSelected,
"aria-current": isToday ? "date" : void 0
}));
}
function DayCalendar(inProps) {
const props = useThemeProps({
props: inProps,
name: "MuiDayCalendar"
});
const utils = useUtils();
const { onFocusedDayChange, className, currentMonth, selectedDays, focusedDay, loading, onSelectedDaysChange, onMonthSwitchingAnimationEnd, readOnly, reduceAnimations, renderLoading = () => jsxRuntimeExports.jsx("span", {
children: "..."
}), slideDirection, TransitionProps, disablePast, disableFuture, minDate, maxDate, shouldDisableDate, shouldDisableMonth, shouldDisableYear, dayOfWeekFormatter = (date) => utils.format(date, "weekdayShort").charAt(0).toUpperCase(), hasFocus, onFocusedViewChange, gridLabelId, displayWeekNumber, fixedWeekNumber, autoFocus, timezone } = props;
const now2 = useNow(timezone);
const classes = useUtilityClasses$e(props);
const isRtl = useRtl();
const isDateDisabled = useIsDateDisabled({
shouldDisableDate,
shouldDisableMonth,
shouldDisableYear,
minDate,
maxDate,
disablePast,
disableFuture,
timezone
});
const translations = usePickersTranslations();
const [internalHasFocus, setInternalHasFocus] = useControlled({
name: "DayCalendar",
state: "hasFocus",
controlled: hasFocus,
default: autoFocus ?? false
});
const [internalFocusedDay, setInternalFocusedDay] = __mf_32$1(() => focusedDay || now2);
const handleDaySelect = useEventCallback((day) => {
if (readOnly) {
return;
}
onSelectedDaysChange(day);
});
const focusDay = (day) => {
if (!isDateDisabled(day)) {
onFocusedDayChange(day);
setInternalFocusedDay(day);
onFocusedViewChange == null ? void 0 : onFocusedViewChange(true);
setInternalHasFocus(true);
}
};
const handleKeyDown = useEventCallback((event, day) => {
switch (event.key) {
case "ArrowUp":
focusDay(utils.addDays(day, -7));
event.preventDefault();
break;
case "ArrowDown":
focusDay(utils.addDays(day, 7));
event.preventDefault();
break;
case "ArrowLeft": {
const newFocusedDayDefault = utils.addDays(day, isRtl ? 1 : -1);
const nextAvailableMonth = utils.addMonths(day, isRtl ? 1 : -1);
const closestDayToFocus = findClosestEnabledDate({
utils,
date: newFocusedDayDefault,
minDate: isRtl ? newFocusedDayDefault : utils.startOfMonth(nextAvailableMonth),
maxDate: isRtl ? utils.endOfMonth(nextAvailableMonth) : newFocusedDayDefault,
isDateDisabled,
timezone
});
focusDay(closestDayToFocus || newFocusedDayDefault);
event.preventDefault();
break;
}
case "ArrowRight": {
const newFocusedDayDefault = utils.addDays(day, isRtl ? -1 : 1);
const nextAvailableMonth = utils.addMonths(day, isRtl ? -1 : 1);
const closestDayToFocus = findClosestEnabledDate({
utils,
date: newFocusedDayDefault,
minDate: isRtl ? utils.startOfMonth(nextAvailableMonth) : newFocusedDayDefault,
maxDate: isRtl ? newFocusedDayDefault : utils.endOfMonth(nextAvailableMonth),
isDateDisabled,
timezone
});
focusDay(closestDayToFocus || newFocusedDayDefault);
event.preventDefault();
break;
}
case "Home":
focusDay(utils.startOfWeek(day));
event.preventDefault();
break;
case "End":
focusDay(utils.endOfWeek(day));
event.preventDefault();
break;
case "PageUp":
focusDay(utils.addMonths(day, 1));
event.preventDefault();
break;
case "PageDown":
focusDay(utils.addMonths(day, -1));
event.preventDefault();
break;
}
});
const handleFocus = useEventCallback((event, day) => focusDay(day));
const handleBlur = useEventCallback((event, day) => {
if (internalHasFocus && utils.isSameDay(internalFocusedDay, day)) {
onFocusedViewChange == null ? void 0 : onFocusedViewChange(false);
}
});
const currentMonthNumber = utils.getMonth(currentMonth);
const currentYearNumber = utils.getYear(currentMonth);
const validSelectedDays = __mf_29(() => selectedDays.filter((day) => !!day).map((day) => utils.startOfDay(day)), [
utils,
selectedDays
]);
const transitionKey = `${currentYearNumber}-${currentMonthNumber}`;
const slideNodeRef = __mf_29(() => __mf_13(), [
transitionKey
]);
const focusableDay = __mf_29(() => {
const startOfMonth = utils.startOfMonth(currentMonth);
const endOfMonth = utils.endOfMonth(currentMonth);
if (isDateDisabled(internalFocusedDay) || utils.isAfterDay(internalFocusedDay, endOfMonth) || utils.isBeforeDay(internalFocusedDay, startOfMonth)) {
return findClosestEnabledDate({
utils,
date: internalFocusedDay,
minDate: startOfMonth,
maxDate: endOfMonth,
disablePast,
disableFuture,
isDateDisabled,
timezone
});
}
return internalFocusedDay;
}, [
currentMonth,
disableFuture,
disablePast,
internalFocusedDay,
isDateDisabled,
utils,
timezone
]);
const weeksToDisplay = __mf_29(() => {
const toDisplay = utils.getWeekArray(currentMonth);
let nextMonth = utils.addMonths(currentMonth, 1);
while (fixedWeekNumber && toDisplay.length < fixedWeekNumber) {
const additionalWeeks = utils.getWeekArray(nextMonth);
const hasCommonWeek = utils.isSameDay(toDisplay[toDisplay.length - 1][0], additionalWeeks[0][0]);
additionalWeeks.slice(hasCommonWeek ? 1 : 0).forEach((week) => {
if (toDisplay.length < fixedWeekNumber) {
toDisplay.push(week);
}
});
nextMonth = utils.addMonths(nextMonth, 1);
}
return toDisplay;
}, [
currentMonth,
fixedWeekNumber,
utils
]);
return jsxRuntimeExports.jsxs(PickersCalendarDayRoot, {
role: "grid",
"aria-labelledby": gridLabelId,
className: classes.root,
children: [
jsxRuntimeExports.jsxs(PickersCalendarDayHeader, {
role: "row",
className: classes.header,
children: [
displayWeekNumber && jsxRuntimeExports.jsx(PickersCalendarWeekNumberLabel, {
variant: "caption",
role: "columnheader",
"aria-label": translations.calendarWeekNumberHeaderLabel,
className: classes.weekNumberLabel,
children: translations.calendarWeekNumberHeaderText
}),
getWeekdays(utils, now2).map((weekday, i) => jsxRuntimeExports.jsx(PickersCalendarWeekDayLabel, {
variant: "caption",
role: "columnheader",
"aria-label": utils.format(weekday, "weekday"),
className: classes.weekDayLabel,
children: dayOfWeekFormatter(weekday)
}, i.toString()))
]
}),
loading ? jsxRuntimeExports.jsx(PickersCalendarLoadingContainer, {
className: classes.loadingContainer,
children: renderLoading()
}) : jsxRuntimeExports.jsx(PickersCalendarSlideTransition, _extends$1({
transKey: transitionKey,
onExited: onMonthSwitchingAnimationEnd,
reduceAnimations,
slideDirection,
className: clsx(className, classes.slideTransition)
}, TransitionProps, {
nodeRef: slideNodeRef,
children: jsxRuntimeExports.jsx(PickersCalendarWeekContainer, {
ref: slideNodeRef,
role: "rowgroup",
className: classes.monthContainer,
children: weeksToDisplay.map((week, index) => jsxRuntimeExports.jsxs(PickersCalendarWeek, {
role: "row",
className: classes.weekContainer,
"aria-rowindex": index + 1,
children: [
displayWeekNumber && jsxRuntimeExports.jsx(PickersCalendarWeekNumber, {
className: classes.weekNumber,
role: "rowheader",
"aria-label": translations.calendarWeekNumberAriaLabelText(utils.getWeekNumber(week[0])),
children: translations.calendarWeekNumberText(utils.getWeekNumber(week[0]))
}),
week.map((day, dayIndex) => jsxRuntimeExports.jsx(WrappedDay, {
parentProps: props,
day,
selectedDays: validSelectedDays,
focusableDay,
onKeyDown: handleKeyDown,
onFocus: handleFocus,
onBlur: handleBlur,
onDaySelect: handleDaySelect,
isDateDisabled,
currentMonthNumber,
isViewFocused: internalHasFocus,
"aria-colindex": dayIndex + 1
}, day.toString()))
]
}, `week-${week[0]}`))
})
}))
]
});
}
function getPickersMonthUtilityClass(slot) {
return generateUtilityClass("MuiPickersMonth", slot);
}
const pickersMonthClasses = generateUtilityClasses("MuiPickersMonth", [
"root",
"monthButton",
"disabled",
"selected"
]);
const _excluded$i = [
"autoFocus",
"className",
"children",
"disabled",
"selected",
"value",
"tabIndex",
"onClick",
"onKeyDown",
"onFocus",
"onBlur",
"aria-current",
"aria-label",
"monthsPerRow",
"slots",
"slotProps"
];
const useUtilityClasses$d = (ownerState) => {
const { disabled, selected, classes } = ownerState;
const slots = {
root: [
"root"
],
monthButton: [
"monthButton",
disabled && "disabled",
selected && "selected"
]
};
return composeClasses(slots, getPickersMonthUtilityClass, classes);
};
const PickersMonthRoot = styled("div", {
name: "MuiPickersMonth",
slot: "Root",
overridesResolver: (_, styles2) => [
styles2.root
]
})({
display: "flex",
alignItems: "center",
justifyContent: "center",
flexBasis: "33.3%",
variants: [
{
props: {
monthsPerRow: 4
},
style: {
flexBasis: "25%"
}
}
]
});
const MonthCalendarButton = styled("button", {
name: "MuiPickersMonth",
slot: "MonthButton",
overridesResolver: (_, styles2) => [
styles2.monthButton,
{
[`&.${pickersMonthClasses.disabled}`]: styles2.disabled
},
{
[`&.${pickersMonthClasses.selected}`]: styles2.selected
}
]
})(({ theme }) => _extends$1({
color: "unset",
backgroundColor: "transparent",
border: 0,
outline: 0
}, theme.typography.subtitle1, {
margin: "8px 0",
height: 36,
width: 72,
borderRadius: 18,
cursor: "pointer",
"&:focus": {
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.action.activeChannel} / ${theme.vars.palette.action.hoverOpacity})` : __mf_133(theme.palette.action.active, theme.palette.action.hoverOpacity)
},
"&:hover": {
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.action.activeChannel} / ${theme.vars.palette.action.hoverOpacity})` : __mf_133(theme.palette.action.active, theme.palette.action.hoverOpacity)
},
"&:disabled": {
cursor: "auto",
pointerEvents: "none"
},
[`&.${pickersMonthClasses.disabled}`]: {
color: (theme.vars || theme).palette.text.secondary
},
[`&.${pickersMonthClasses.selected}`]: {
color: (theme.vars || theme).palette.primary.contrastText,
backgroundColor: (theme.vars || theme).palette.primary.main,
"&:focus, &:hover": {
backgroundColor: (theme.vars || theme).palette.primary.dark
}
}
}));
const PickersMonth = __mf_17(function PickersMonth2(inProps) {
const props = useThemeProps({
props: inProps,
name: "MuiPickersMonth"
});
const { autoFocus, className, children, disabled, selected, value, tabIndex, onClick, onKeyDown, onFocus, onBlur, "aria-current": ariaCurrent, "aria-label": ariaLabel, slots, slotProps } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$i);
const ref = __mf_31(null);
const classes = useUtilityClasses$d(props);
useEnhancedEffect(() => {
var _a;
if (autoFocus) {
(_a = ref.current) == null ? void 0 : _a.focus();
}
}, [
autoFocus
]);
const MonthButton = (slots == null ? void 0 : slots.monthButton) ?? MonthCalendarButton;
const monthButtonProps = useSlotProps({
elementType: MonthButton,
externalSlotProps: slotProps == null ? void 0 : slotProps.monthButton,
additionalProps: {
children,
disabled,
tabIndex,
ref,
type: "button",
role: "radio",
"aria-current": ariaCurrent,
"aria-checked": selected,
"aria-label": ariaLabel,
onClick: (event) => onClick(event, value),
onKeyDown: (event) => onKeyDown(event, value),
onFocus: (event) => onFocus(event, value),
onBlur: (event) => onBlur(event, value)
},
ownerState: props,
className: classes.monthButton
});
return jsxRuntimeExports.jsx(PickersMonthRoot, _extends$1({
className: clsx(classes.root, className),
ownerState: props
}, other, {
children: jsxRuntimeExports.jsx(MonthButton, _extends$1({}, monthButtonProps))
}));
});
function getMonthCalendarUtilityClass(slot) {
return generateUtilityClass("MuiMonthCalendar", slot);
}
generateUtilityClasses("MuiMonthCalendar", [
"root"
]);
const _excluded$h = [
"className",
"value",
"defaultValue",
"referenceDate",
"disabled",
"disableFuture",
"disablePast",
"maxDate",
"minDate",
"onChange",
"shouldDisableMonth",
"readOnly",
"disableHighlightToday",
"autoFocus",
"onMonthFocus",
"hasFocus",
"onFocusedViewChange",
"monthsPerRow",
"timezone",
"gridLabelId",
"slots",
"slotProps"
];
const useUtilityClasses$c = (ownerState) => {
const { classes } = ownerState;
const slots = {
root: [
"root"
]
};
return composeClasses(slots, getMonthCalendarUtilityClass, classes);
};
function useMonthCalendarDefaultizedProps(props, name) {
const utils = useUtils();
const defaultDates = useDefaultDates();
const themeProps = useThemeProps({
props,
name
});
return _extends$1({
disableFuture: false,
disablePast: false
}, themeProps, {
minDate: applyDefaultDate(utils, themeProps.minDate, defaultDates.minDate),
maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate)
});
}
const MonthCalendarRoot = styled("div", {
name: "MuiMonthCalendar",
slot: "Root",
overridesResolver: (props, styles2) => styles2.root
})({
display: "flex",
flexWrap: "wrap",
alignContent: "stretch",
padding: "0 4px",
width: DIALOG_WIDTH,
boxSizing: "border-box"
});
const MonthCalendar = __mf_14$1(function MonthCalendar2(inProps, ref) {
const props = useMonthCalendarDefaultizedProps(inProps, "MuiMonthCalendar");
const { className, value: valueProp, defaultValue, referenceDate: referenceDateProp, disabled, disableFuture, disablePast, maxDate, minDate, onChange, shouldDisableMonth, readOnly, autoFocus = false, onMonthFocus, hasFocus, onFocusedViewChange, monthsPerRow = 3, timezone: timezoneProp, gridLabelId, slots, slotProps } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$h);
const { value, handleValueChange, timezone } = useControlledValueWithTimezone({
name: "MonthCalendar",
timezone: timezoneProp,
value: valueProp,
defaultValue,
referenceDate: referenceDateProp,
onChange,
valueManager: singleItemValueManager
});
const now2 = useNow(timezone);
const isRtl = useRtl();
const utils = useUtils();
const referenceDate = __mf_29(() => singleItemValueManager.getInitialReferenceValue({
value,
utils,
props,
timezone,
referenceDate: referenceDateProp,
granularity: SECTION_TYPE_GRANULARITY.month
}), []);
const ownerState = props;
const classes = useUtilityClasses$c(ownerState);
const todayMonth = __mf_29(() => utils.getMonth(now2), [
utils,
now2
]);
const selectedMonth = __mf_29(() => {
if (value != null) {
return utils.getMonth(value);
}
return null;
}, [
value,
utils
]);
const [focusedMonth, setFocusedMonth] = __mf_32$1(() => selectedMonth || utils.getMonth(referenceDate));
const [internalHasFocus, setInternalHasFocus] = useControlled({
name: "MonthCalendar",
state: "hasFocus",
controlled: hasFocus,
default: autoFocus ?? false
});
const changeHasFocus = useEventCallback((newHasFocus) => {
setInternalHasFocus(newHasFocus);
if (onFocusedViewChange) {
onFocusedViewChange(newHasFocus);
}
});
const isMonthDisabled = __mf_20((dateToValidate) => {
const firstEnabledMonth = utils.startOfMonth(disablePast && utils.isAfter(now2, minDate) ? now2 : minDate);
const lastEnabledMonth = utils.startOfMonth(disableFuture && utils.isBefore(now2, maxDate) ? now2 : maxDate);
const monthToValidate = utils.startOfMonth(dateToValidate);
if (utils.isBefore(monthToValidate, firstEnabledMonth)) {
return true;
}
if (utils.isAfter(monthToValidate, lastEnabledMonth)) {
return true;
}
if (!shouldDisableMonth) {
return false;
}
return shouldDisableMonth(monthToValidate);
}, [
disableFuture,
disablePast,
maxDate,
minDate,
now2,
shouldDisableMonth,
utils
]);
const handleMonthSelection = useEventCallback((event, month) => {
if (readOnly) {
return;
}
const newDate = utils.setMonth(value ?? referenceDate, month);
handleValueChange(newDate);
});
const focusMonth = useEventCallback((month) => {
if (!isMonthDisabled(utils.setMonth(value ?? referenceDate, month))) {
setFocusedMonth(month);
changeHasFocus(true);
if (onMonthFocus) {
onMonthFocus(month);
}
}
});
__mf_24(() => {
setFocusedMonth((prevFocusedMonth) => selectedMonth !== null && prevFocusedMonth !== selectedMonth ? selectedMonth : prevFocusedMonth);
}, [
selectedMonth
]);
const handleKeyDown = useEventCallback((event, month) => {
const monthsInYear = 12;
const monthsInRow = 3;
switch (event.key) {
case "ArrowUp":
focusMonth((monthsInYear + month - monthsInRow) % monthsInYear);
event.preventDefault();
break;
case "ArrowDown":
focusMonth((monthsInYear + month + monthsInRow) % monthsInYear);
event.preventDefault();
break;
case "ArrowLeft":
focusMonth((monthsInYear + month + (isRtl ? 1 : -1)) % monthsInYear);
event.preventDefault();
break;
case "ArrowRight":
focusMonth((monthsInYear + month + (isRtl ? -1 : 1)) % monthsInYear);
event.preventDefault();
break;
}
});
const handleMonthFocus = useEventCallback((event, month) => {
focusMonth(month);
});
const handleMonthBlur = useEventCallback((event, month) => {
if (focusedMonth === month) {
changeHasFocus(false);
}
});
return jsxRuntimeExports.jsx(MonthCalendarRoot, _extends$1({
ref,
className: clsx(classes.root, className),
ownerState,
role: "radiogroup",
"aria-labelledby": gridLabelId
}, other, {
children: getMonthsInYear(utils, value ?? referenceDate).map((month) => {
const monthNumber = utils.getMonth(month);
const monthText = utils.format(month, "monthShort");
const monthLabel = utils.format(month, "month");
const isSelected = monthNumber === selectedMonth;
const isDisabled = disabled || isMonthDisabled(month);
return jsxRuntimeExports.jsx(PickersMonth, {
selected: isSelected,
value: monthNumber,
onClick: handleMonthSelection,
onKeyDown: handleKeyDown,
autoFocus: internalHasFocus && monthNumber === focusedMonth,
disabled: isDisabled,
tabIndex: monthNumber === focusedMonth && !isDisabled ? 0 : -1,
onFocus: handleMonthFocus,
onBlur: handleMonthBlur,
"aria-current": todayMonth === monthNumber ? "date" : void 0,
"aria-label": monthLabel,
monthsPerRow,
slots,
slotProps,
children: monthText
}, monthText);
})
}));
});
function getPickersYearUtilityClass(slot) {
return generateUtilityClass("MuiPickersYear", slot);
}
const pickersYearClasses = generateUtilityClasses("MuiPickersYear", [
"root",
"yearButton",
"selected",
"disabled"
]);
const _excluded$g = [
"autoFocus",
"className",
"children",
"disabled",
"selected",
"value",
"tabIndex",
"onClick",
"onKeyDown",
"onFocus",
"onBlur",
"aria-current",
"yearsPerRow",
"slots",
"slotProps"
];
const useUtilityClasses$b = (ownerState) => {
const { disabled, selected, classes } = ownerState;
const slots = {
root: [
"root"
],
yearButton: [
"yearButton",
disabled && "disabled",
selected && "selected"
]
};
return composeClasses(slots, getPickersYearUtilityClass, classes);
};
const PickersYearRoot = styled("div", {
name: "MuiPickersYear",
slot: "Root",
overridesResolver: (_, styles2) => [
styles2.root
]
})({
display: "flex",
alignItems: "center",
justifyContent: "center",
flexBasis: "33.3%",
variants: [
{
props: {
yearsPerRow: 4
},
style: {
flexBasis: "25%"
}
}
]
});
const YearCalendarButton = styled("button", {
name: "MuiPickersYear",
slot: "YearButton",
overridesResolver: (_, styles2) => [
styles2.yearButton,
{
[`&.${pickersYearClasses.disabled}`]: styles2.disabled
},
{
[`&.${pickersYearClasses.selected}`]: styles2.selected
}
]
})(({ theme }) => _extends$1({
color: "unset",
backgroundColor: "transparent",
border: 0,
outline: 0
}, theme.typography.subtitle1, {
margin: "6px 0",
height: 36,
width: 72,
borderRadius: 18,
cursor: "pointer",
"&:focus": {
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.action.activeChannel} / ${theme.vars.palette.action.focusOpacity})` : __mf_133(theme.palette.action.active, theme.palette.action.focusOpacity)
},
"&:hover": {
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.action.activeChannel} / ${theme.vars.palette.action.hoverOpacity})` : __mf_133(theme.palette.action.active, theme.palette.action.hoverOpacity)
},
"&:disabled": {
cursor: "auto",
pointerEvents: "none"
},
[`&.${pickersYearClasses.disabled}`]: {
color: (theme.vars || theme).palette.text.secondary
},
[`&.${pickersYearClasses.selected}`]: {
color: (theme.vars || theme).palette.primary.contrastText,
backgroundColor: (theme.vars || theme).palette.primary.main,
"&:focus, &:hover": {
backgroundColor: (theme.vars || theme).palette.primary.dark
}
}
}));
const PickersYear = __mf_17(function PickersYear2(inProps) {
const props = useThemeProps({
props: inProps,
name: "MuiPickersYear"
});
const { autoFocus, className, children, disabled, selected, value, tabIndex, onClick, onKeyDown, onFocus, onBlur, "aria-current": ariaCurrent, slots, slotProps } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$g);
const ref = __mf_31(null);
const classes = useUtilityClasses$b(props);
useEnhancedEffect(() => {
var _a;
if (autoFocus) {
(_a = ref.current) == null ? void 0 : _a.focus();
}
}, [
autoFocus
]);
const YearButton = (slots == null ? void 0 : slots.yearButton) ?? YearCalendarButton;
const yearButtonProps = useSlotProps({
elementType: YearButton,
externalSlotProps: slotProps == null ? void 0 : slotProps.yearButton,
additionalProps: {
children,
disabled,
tabIndex,
ref,
type: "button",
role: "radio",
"aria-current": ariaCurrent,
"aria-checked": selected,
onClick: (event) => onClick(event, value),
onKeyDown: (event) => onKeyDown(event, value),
onFocus: (event) => onFocus(event, value),
onBlur: (event) => onBlur(event, value)
},
ownerState: props,
className: classes.yearButton
});
return jsxRuntimeExports.jsx(PickersYearRoot, _extends$1({
className: clsx(classes.root, className),
ownerState: props
}, other, {
children: jsxRuntimeExports.jsx(YearButton, _extends$1({}, yearButtonProps))
}));
});
function getYearCalendarUtilityClass(slot) {
return generateUtilityClass("MuiYearCalendar", slot);
}
generateUtilityClasses("MuiYearCalendar", [
"root"
]);
const _excluded$f = [
"autoFocus",
"className",
"value",
"defaultValue",
"referenceDate",
"disabled",
"disableFuture",
"disablePast",
"maxDate",
"minDate",
"onChange",
"readOnly",
"shouldDisableYear",
"disableHighlightToday",
"onYearFocus",
"hasFocus",
"onFocusedViewChange",
"yearsOrder",
"yearsPerRow",
"timezone",
"gridLabelId",
"slots",
"slotProps"
];
const useUtilityClasses$a = (ownerState) => {
const { classes } = ownerState;
const slots = {
root: [
"root"
]
};
return composeClasses(slots, getYearCalendarUtilityClass, classes);
};
function useYearCalendarDefaultizedProps(props, name) {
const utils = useUtils();
const defaultDates = useDefaultDates();
const themeProps = useThemeProps({
props,
name
});
return _extends$1({
disablePast: false,
disableFuture: false
}, themeProps, {
yearsPerRow: themeProps.yearsPerRow ?? 3,
minDate: applyDefaultDate(utils, themeProps.minDate, defaultDates.minDate),
maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate)
});
}
const YearCalendarRoot = styled("div", {
name: "MuiYearCalendar",
slot: "Root",
overridesResolver: (props, styles2) => styles2.root
})({
display: "flex",
flexDirection: "row",
flexWrap: "wrap",
overflowY: "auto",
height: "100%",
padding: "0 4px",
width: DIALOG_WIDTH,
maxHeight: MAX_CALENDAR_HEIGHT,
boxSizing: "border-box",
position: "relative"
});
const YearCalendar = __mf_14$1(function YearCalendar2(inProps, ref) {
const props = useYearCalendarDefaultizedProps(inProps, "MuiYearCalendar");
const { autoFocus, className, value: valueProp, defaultValue, referenceDate: referenceDateProp, disabled, disableFuture, disablePast, maxDate, minDate, onChange, readOnly, shouldDisableYear, onYearFocus, hasFocus, onFocusedViewChange, yearsOrder = "asc", yearsPerRow, timezone: timezoneProp, gridLabelId, slots, slotProps } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$f);
const { value, handleValueChange, timezone } = useControlledValueWithTimezone({
name: "YearCalendar",
timezone: timezoneProp,
value: valueProp,
defaultValue,
referenceDate: referenceDateProp,
onChange,
valueManager: singleItemValueManager
});
const now2 = useNow(timezone);
const isRtl = useRtl();
const utils = useUtils();
const referenceDate = __mf_29(() => singleItemValueManager.getInitialReferenceValue({
value,
utils,
props,
timezone,
referenceDate: referenceDateProp,
granularity: SECTION_TYPE_GRANULARITY.year
}), []);
const ownerState = props;
const classes = useUtilityClasses$a(ownerState);
const todayYear = __mf_29(() => utils.getYear(now2), [
utils,
now2
]);
const selectedYear = __mf_29(() => {
if (value != null) {
return utils.getYear(value);
}
return null;
}, [
value,
utils
]);
const [focusedYear, setFocusedYear] = __mf_32$1(() => selectedYear || utils.getYear(referenceDate));
const [internalHasFocus, setInternalHasFocus] = useControlled({
name: "YearCalendar",
state: "hasFocus",
controlled: hasFocus,
default: autoFocus ?? false
});
const changeHasFocus = useEventCallback((newHasFocus) => {
setInternalHasFocus(newHasFocus);
if (onFocusedViewChange) {
onFocusedViewChange(newHasFocus);
}
});
const isYearDisabled = __mf_20((dateToValidate) => {
if (disablePast && utils.isBeforeYear(dateToValidate, now2)) {
return true;
}
if (disableFuture && utils.isAfterYear(dateToValidate, now2)) {
return true;
}
if (minDate && utils.isBeforeYear(dateToValidate, minDate)) {
return true;
}
if (maxDate && utils.isAfterYear(dateToValidate, maxDate)) {
return true;
}
if (!shouldDisableYear) {
return false;
}
const yearToValidate = utils.startOfYear(dateToValidate);
return shouldDisableYear(yearToValidate);
}, [
disableFuture,
disablePast,
maxDate,
minDate,
now2,
shouldDisableYear,
utils
]);
const handleYearSelection = useEventCallback((event, year) => {
if (readOnly) {
return;
}
const newDate = utils.setYear(value ?? referenceDate, year);
handleValueChange(newDate);
});
const focusYear = useEventCallback((year) => {
if (!isYearDisabled(utils.setYear(value ?? referenceDate, year))) {
setFocusedYear(year);
changeHasFocus(true);
onYearFocus == null ? void 0 : onYearFocus(year);
}
});
__mf_24(() => {
setFocusedYear((prevFocusedYear) => selectedYear !== null && prevFocusedYear !== selectedYear ? selectedYear : prevFocusedYear);
}, [
selectedYear
]);
const verticalDirection = yearsOrder !== "desc" ? yearsPerRow * 1 : yearsPerRow * -1;
const horizontalDirection = isRtl && yearsOrder === "asc" || !isRtl && yearsOrder === "desc" ? -1 : 1;
const handleKeyDown = useEventCallback((event, year) => {
switch (event.key) {
case "ArrowUp":
focusYear(year - verticalDirection);
event.preventDefault();
break;
case "ArrowDown":
focusYear(year + verticalDirection);
event.preventDefault();
break;
case "ArrowLeft":
focusYear(year - horizontalDirection);
event.preventDefault();
break;
case "ArrowRight":
focusYear(year + horizontalDirection);
event.preventDefault();
break;
}
});
const handleYearFocus = useEventCallback((event, year) => {
focusYear(year);
});
const handleYearBlur = useEventCallback((event, year) => {
if (focusedYear === year) {
changeHasFocus(false);
}
});
const scrollerRef = __mf_31(null);
const handleRef = useForkRef(ref, scrollerRef);
__mf_24(() => {
if (autoFocus || scrollerRef.current === null) {
return;
}
const tabbableButton = scrollerRef.current.querySelector('[tabindex="0"]');
if (!tabbableButton) {
return;
}
const offsetHeight = tabbableButton.offsetHeight;
const offsetTop = tabbableButton.offsetTop;
const clientHeight = scrollerRef.current.clientHeight;
const scrollTop = scrollerRef.current.scrollTop;
const elementBottom = offsetTop + offsetHeight;
if (offsetHeight > clientHeight || offsetTop < scrollTop) {
return;
}
scrollerRef.current.scrollTop = elementBottom - clientHeight / 2 - offsetHeight / 2;
}, [
autoFocus
]);
const yearRange = utils.getYearRange([
minDate,
maxDate
]);
if (yearsOrder === "desc") {
yearRange.reverse();
}
return jsxRuntimeExports.jsx(YearCalendarRoot, _extends$1({
ref: handleRef,
className: clsx(classes.root, className),
ownerState,
role: "radiogroup",
"aria-labelledby": gridLabelId
}, other, {
children: yearRange.map((year) => {
const yearNumber = utils.getYear(year);
const isSelected = yearNumber === selectedYear;
const isDisabled = disabled || isYearDisabled(year);
return jsxRuntimeExports.jsx(PickersYear, {
selected: isSelected,
value: yearNumber,
onClick: handleYearSelection,
onKeyDown: handleKeyDown,
autoFocus: internalHasFocus && yearNumber === focusedYear,
disabled: isDisabled,
tabIndex: yearNumber === focusedYear && !isDisabled ? 0 : -1,
onFocus: handleYearFocus,
onBlur: handleYearBlur,
"aria-current": todayYear === yearNumber ? "date" : void 0,
yearsPerRow,
slots,
slotProps,
children: utils.format(year, "year")
}, utils.format(year, "year"));
})
}));
});
const getPickersCalendarHeaderUtilityClass = (slot) => generateUtilityClass("MuiPickersCalendarHeader", slot);
const pickersCalendarHeaderClasses = generateUtilityClasses("MuiPickersCalendarHeader", [
"root",
"labelContainer",
"label",
"switchViewButton",
"switchViewIcon"
]);
const _excluded$e = [
"slots",
"slotProps",
"currentMonth",
"disabled",
"disableFuture",
"disablePast",
"maxDate",
"minDate",
"onMonthChange",
"onViewChange",
"view",
"reduceAnimations",
"views",
"labelId",
"className",
"timezone",
"format"
], _excluded2$2 = [
"ownerState"
];
const useUtilityClasses$9 = (ownerState) => {
const { classes } = ownerState;
const slots = {
root: [
"root"
],
labelContainer: [
"labelContainer"
],
label: [
"label"
],
switchViewButton: [
"switchViewButton"
],
switchViewIcon: [
"switchViewIcon"
]
};
return composeClasses(slots, getPickersCalendarHeaderUtilityClass, classes);
};
const PickersCalendarHeaderRoot = styled("div", {
name: "MuiPickersCalendarHeader",
slot: "Root",
overridesResolver: (_, styles2) => styles2.root
})({
display: "flex",
alignItems: "center",
marginTop: 12,
marginBottom: 4,
paddingLeft: 24,
paddingRight: 12,
maxHeight: 40,
minHeight: 40
});
const PickersCalendarHeaderLabelContainer = styled("div", {
name: "MuiPickersCalendarHeader",
slot: "LabelContainer",
overridesResolver: (_, styles2) => styles2.labelContainer
})(({ theme }) => _extends$1({
display: "flex",
overflow: "hidden",
alignItems: "center",
cursor: "pointer",
marginRight: "auto"
}, theme.typography.body1, {
fontWeight: theme.typography.fontWeightMedium
}));
const PickersCalendarHeaderLabel = styled("div", {
name: "MuiPickersCalendarHeader",
slot: "Label",
overridesResolver: (_, styles2) => styles2.label
})({
marginRight: 6
});
const PickersCalendarHeaderSwitchViewButton = styled(IconButton, {
name: "MuiPickersCalendarHeader",
slot: "SwitchViewButton",
overridesResolver: (_, styles2) => styles2.switchViewButton
})({
marginRight: "auto",
variants: [
{
props: {
view: "year"
},
style: {
[`.${pickersCalendarHeaderClasses.switchViewIcon}`]: {
transform: "rotate(180deg)"
}
}
}
]
});
const PickersCalendarHeaderSwitchViewIcon = styled(ArrowDropDownIcon, {
name: "MuiPickersCalendarHeader",
slot: "SwitchViewIcon",
overridesResolver: (_, styles2) => styles2.switchViewIcon
})(({ theme }) => ({
willChange: "transform",
transition: theme.transitions.create("transform"),
transform: "rotate(0deg)"
}));
const PickersCalendarHeader = __mf_14$1(function PickersCalendarHeader2(inProps, ref) {
const translations = usePickersTranslations();
const utils = useUtils();
const props = useThemeProps({
props: inProps,
name: "MuiPickersCalendarHeader"
});
const { slots, slotProps, currentMonth: month, disabled, disableFuture, disablePast, maxDate, minDate, onMonthChange, onViewChange, view, reduceAnimations, views, labelId, className, timezone, format: format2 = `${utils.formats.month} ${utils.formats.year}` } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$e);
const ownerState = props;
const classes = useUtilityClasses$9(props);
const SwitchViewButton = (slots == null ? void 0 : slots.switchViewButton) ?? PickersCalendarHeaderSwitchViewButton;
const switchViewButtonProps = useSlotProps({
elementType: SwitchViewButton,
externalSlotProps: slotProps == null ? void 0 : slotProps.switchViewButton,
additionalProps: {
size: "small",
"aria-label": translations.calendarViewSwitchingButtonAriaLabel(view)
},
ownerState,
className: classes.switchViewButton
});
const SwitchViewIcon = (slots == null ? void 0 : slots.switchViewIcon) ?? PickersCalendarHeaderSwitchViewIcon;
const _useSlotProps = useSlotProps({
elementType: SwitchViewIcon,
externalSlotProps: slotProps == null ? void 0 : slotProps.switchViewIcon,
ownerState,
className: classes.switchViewIcon
}), switchViewIconProps = _objectWithoutPropertiesLoose$1(_useSlotProps, _excluded2$2);
const selectNextMonth = () => onMonthChange(utils.addMonths(month, 1), "left");
const selectPreviousMonth = () => onMonthChange(utils.addMonths(month, -1), "right");
const isNextMonthDisabled = useNextMonthDisabled(month, {
disableFuture,
maxDate,
timezone
});
const isPreviousMonthDisabled = usePreviousMonthDisabled(month, {
disablePast,
minDate,
timezone
});
const handleToggleView = () => {
if (views.length === 1 || !onViewChange || disabled) {
return;
}
if (views.length === 2) {
onViewChange(views.find((el) => el !== view) || views[0]);
} else {
const nextIndexToOpen = views.indexOf(view) !== 0 ? 0 : 1;
onViewChange(views[nextIndexToOpen]);
}
};
if (views.length === 1 && views[0] === "year") {
return null;
}
const label = utils.formatByString(month, format2);
return jsxRuntimeExports.jsxs(PickersCalendarHeaderRoot, _extends$1({}, other, {
ownerState,
className: clsx(classes.root, className),
ref,
children: [
jsxRuntimeExports.jsxs(PickersCalendarHeaderLabelContainer, {
role: "presentation",
onClick: handleToggleView,
ownerState,
"aria-live": "polite",
className: classes.labelContainer,
children: [
jsxRuntimeExports.jsx(PickersFadeTransitionGroup, {
reduceAnimations,
transKey: label,
children: jsxRuntimeExports.jsx(PickersCalendarHeaderLabel, {
id: labelId,
ownerState,
className: classes.label,
children: label
})
}),
views.length > 1 && !disabled && jsxRuntimeExports.jsx(SwitchViewButton, _extends$1({}, switchViewButtonProps, {
children: jsxRuntimeExports.jsx(SwitchViewIcon, _extends$1({}, switchViewIconProps))
}))
]
}),
jsxRuntimeExports.jsx(Fade, {
in: view === "day",
appear: !reduceAnimations,
enter: !reduceAnimations,
children: jsxRuntimeExports.jsx(PickersArrowSwitcher, {
slots,
slotProps,
onGoToPrevious: selectPreviousMonth,
isPreviousDisabled: isPreviousMonthDisabled,
previousLabel: translations.previousMonth,
onGoToNext: selectNextMonth,
isNextDisabled: isNextMonthDisabled,
nextLabel: translations.nextMonth
})
})
]
}));
});
const PREFERS_REDUCED_MOTION = "@media (prefers-reduced-motion: reduce)";
const mobileVersionMatches = typeof navigator !== "undefined" && navigator.userAgent.match(/android\s(\d+)|OS\s(\d+)/i);
const androidVersion = mobileVersionMatches && mobileVersionMatches[1] ? parseInt(mobileVersionMatches[1], 10) : null;
const iOSVersion = mobileVersionMatches && mobileVersionMatches[2] ? parseInt(mobileVersionMatches[2], 10) : null;
const slowAnimationDevices = androidVersion && androidVersion < 10 || iOSVersion && iOSVersion < 13 || false;
const useDefaultReduceAnimations = () => {
const prefersReduced = useMediaQuery(PREFERS_REDUCED_MOTION, {
defaultMatches: false
});
return prefersReduced || slowAnimationDevices;
};
const getDateCalendarUtilityClass = (slot) => generateUtilityClass("MuiDateCalendar", slot);
generateUtilityClasses("MuiDateCalendar", [
"root",
"viewTransitionContainer"
]);
const _excluded$d = [
"autoFocus",
"onViewChange",
"value",
"defaultValue",
"referenceDate",
"disableFuture",
"disablePast",
"onChange",
"onYearChange",
"onMonthChange",
"reduceAnimations",
"shouldDisableDate",
"shouldDisableMonth",
"shouldDisableYear",
"view",
"views",
"openTo",
"className",
"disabled",
"readOnly",
"minDate",
"maxDate",
"disableHighlightToday",
"focusedView",
"onFocusedViewChange",
"showDaysOutsideCurrentMonth",
"fixedWeekNumber",
"dayOfWeekFormatter",
"slots",
"slotProps",
"loading",
"renderLoading",
"displayWeekNumber",
"yearsOrder",
"yearsPerRow",
"monthsPerRow",
"timezone"
];
const useUtilityClasses$8 = (ownerState) => {
const { classes } = ownerState;
const slots = {
root: [
"root"
],
viewTransitionContainer: [
"viewTransitionContainer"
]
};
return composeClasses(slots, getDateCalendarUtilityClass, classes);
};
function useDateCalendarDefaultizedProps(props, name) {
const utils = useUtils();
const defaultDates = useDefaultDates();
const defaultReduceAnimations = useDefaultReduceAnimations();
const themeProps = useThemeProps({
props,
name
});
return _extends$1({}, themeProps, {
loading: themeProps.loading ?? false,
disablePast: themeProps.disablePast ?? false,
disableFuture: themeProps.disableFuture ?? false,
openTo: themeProps.openTo ?? "day",
views: themeProps.views ?? [
"year",
"day"
],
reduceAnimations: themeProps.reduceAnimations ?? defaultReduceAnimations,
renderLoading: themeProps.renderLoading ?? (() => jsxRuntimeExports.jsx("span", {
children: "..."
})),
minDate: applyDefaultDate(utils, themeProps.minDate, defaultDates.minDate),
maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate)
});
}
const DateCalendarRoot = styled(PickerViewRoot, {
name: "MuiDateCalendar",
slot: "Root",
overridesResolver: (props, styles2) => styles2.root
})({
display: "flex",
flexDirection: "column",
height: VIEW_HEIGHT
});
const DateCalendarViewTransitionContainer = styled(PickersFadeTransitionGroup, {
name: "MuiDateCalendar",
slot: "ViewTransitionContainer",
overridesResolver: (props, styles2) => styles2.viewTransitionContainer
})({});
const DateCalendar = __mf_14$1(function DateCalendar2(inProps, ref) {
const utils = useUtils();
const id = useId();
const props = useDateCalendarDefaultizedProps(inProps, "MuiDateCalendar");
const { autoFocus, onViewChange, value: valueProp, defaultValue, referenceDate: referenceDateProp, disableFuture, disablePast, onChange, onYearChange, onMonthChange, reduceAnimations, shouldDisableDate, shouldDisableMonth, shouldDisableYear, view: inView, views, openTo, className, disabled, readOnly, minDate, maxDate, disableHighlightToday, focusedView: inFocusedView, onFocusedViewChange, showDaysOutsideCurrentMonth, fixedWeekNumber, dayOfWeekFormatter, slots, slotProps, loading, renderLoading, displayWeekNumber, yearsOrder, yearsPerRow, monthsPerRow, timezone: timezoneProp } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$d);
const { value, handleValueChange, timezone } = useControlledValueWithTimezone({
name: "DateCalendar",
timezone: timezoneProp,
value: valueProp,
defaultValue,
referenceDate: referenceDateProp,
onChange,
valueManager: singleItemValueManager
});
const { view, setView, focusedView, setFocusedView, goToNextView, setValueAndGoToNextView } = useViews({
view: inView,
views,
openTo,
onChange: handleValueChange,
onViewChange,
autoFocus,
focusedView: inFocusedView,
onFocusedViewChange
});
const { referenceDate, calendarState, changeFocusedDay, changeMonth, handleChangeMonth, isDateDisabled, onMonthSwitchingAnimationEnd } = useCalendarState({
value,
referenceDate: referenceDateProp,
reduceAnimations,
onMonthChange,
minDate,
maxDate,
shouldDisableDate,
disablePast,
disableFuture,
timezone
});
const minDateWithDisabled = disabled && value || minDate;
const maxDateWithDisabled = disabled && value || maxDate;
const gridLabelId = `${id}-grid-label`;
const hasFocus = focusedView !== null;
const CalendarHeader = (slots == null ? void 0 : slots.calendarHeader) ?? PickersCalendarHeader;
const calendarHeaderProps = useSlotProps({
elementType: CalendarHeader,
externalSlotProps: slotProps == null ? void 0 : slotProps.calendarHeader,
additionalProps: {
views,
view,
currentMonth: calendarState.currentMonth,
onViewChange: setView,
onMonthChange: (newMonth, direction) => handleChangeMonth({
newMonth,
direction
}),
minDate: minDateWithDisabled,
maxDate: maxDateWithDisabled,
disabled,
disablePast,
disableFuture,
reduceAnimations,
timezone,
labelId: gridLabelId
},
ownerState: props
});
const handleDateMonthChange = useEventCallback((newDate) => {
const startOfMonth = utils.startOfMonth(newDate);
const endOfMonth = utils.endOfMonth(newDate);
const closestEnabledDate = isDateDisabled(newDate) ? findClosestEnabledDate({
utils,
date: newDate,
minDate: utils.isBefore(minDate, startOfMonth) ? startOfMonth : minDate,
maxDate: utils.isAfter(maxDate, endOfMonth) ? endOfMonth : maxDate,
disablePast,
disableFuture,
isDateDisabled,
timezone
}) : newDate;
if (closestEnabledDate) {
setValueAndGoToNextView(closestEnabledDate, "finish");
onMonthChange == null ? void 0 : onMonthChange(startOfMonth);
} else {
goToNextView();
changeMonth(startOfMonth);
}
changeFocusedDay(closestEnabledDate, true);
});
const handleDateYearChange = useEventCallback((newDate) => {
const startOfYear = utils.startOfYear(newDate);
const endOfYear = utils.endOfYear(newDate);
const closestEnabledDate = isDateDisabled(newDate) ? findClosestEnabledDate({
utils,
date: newDate,
minDate: utils.isBefore(minDate, startOfYear) ? startOfYear : minDate,
maxDate: utils.isAfter(maxDate, endOfYear) ? endOfYear : maxDate,
disablePast,
disableFuture,
isDateDisabled,
timezone
}) : newDate;
if (closestEnabledDate) {
setValueAndGoToNextView(closestEnabledDate, "finish");
onYearChange == null ? void 0 : onYearChange(closestEnabledDate);
} else {
goToNextView();
changeMonth(startOfYear);
}
changeFocusedDay(closestEnabledDate, true);
});
const handleSelectedDayChange = useEventCallback((day) => {
if (day) {
return handleValueChange(mergeDateAndTime(utils, day, value ?? referenceDate), "finish", view);
}
return handleValueChange(day, "finish", view);
});
__mf_24(() => {
if (value != null && utils.isValid(value)) {
changeMonth(value);
}
}, [
value
]);
const ownerState = props;
const classes = useUtilityClasses$8(ownerState);
const baseDateValidationProps = {
disablePast,
disableFuture,
maxDate,
minDate
};
const commonViewProps = {
disableHighlightToday,
readOnly,
disabled,
timezone,
gridLabelId,
slots,
slotProps
};
const prevOpenViewRef = __mf_31(view);
__mf_24(() => {
if (prevOpenViewRef.current === view) {
return;
}
if (focusedView === prevOpenViewRef.current) {
setFocusedView(view, true);
}
prevOpenViewRef.current = view;
}, [
focusedView,
setFocusedView,
view
]);
const selectedDays = __mf_29(() => [
value
], [
value
]);
return jsxRuntimeExports.jsxs(DateCalendarRoot, _extends$1({
ref,
className: clsx(classes.root, className),
ownerState
}, other, {
children: [
jsxRuntimeExports.jsx(CalendarHeader, _extends$1({}, calendarHeaderProps, {
slots,
slotProps
})),
jsxRuntimeExports.jsx(DateCalendarViewTransitionContainer, {
reduceAnimations,
className: classes.viewTransitionContainer,
transKey: view,
ownerState,
children: jsxRuntimeExports.jsxs("div", {
children: [
view === "year" && jsxRuntimeExports.jsx(YearCalendar, _extends$1({}, baseDateValidationProps, commonViewProps, {
value,
onChange: handleDateYearChange,
shouldDisableYear,
hasFocus,
onFocusedViewChange: (isViewFocused) => setFocusedView("year", isViewFocused),
yearsOrder,
yearsPerRow,
referenceDate
})),
view === "month" && jsxRuntimeExports.jsx(MonthCalendar, _extends$1({}, baseDateValidationProps, commonViewProps, {
hasFocus,
className,
value,
onChange: handleDateMonthChange,
shouldDisableMonth,
onFocusedViewChange: (isViewFocused) => setFocusedView("month", isViewFocused),
monthsPerRow,
referenceDate
})),
view === "day" && jsxRuntimeExports.jsx(DayCalendar, _extends$1({}, calendarState, baseDateValidationProps, commonViewProps, {
onMonthSwitchingAnimationEnd,
onFocusedDayChange: changeFocusedDay,
reduceAnimations,
selectedDays,
onSelectedDaysChange: handleSelectedDayChange,
shouldDisableDate,
shouldDisableMonth,
shouldDisableYear,
hasFocus,
onFocusedViewChange: (isViewFocused) => setFocusedView("day", isViewFocused),
showDaysOutsideCurrentMonth,
fixedWeekNumber,
dayOfWeekFormatter,
displayWeekNumber,
loading,
renderLoading
}))
]
})
})
]
}));
});
function getPickersToolbarUtilityClass(slot) {
return generateUtilityClass("MuiPickersToolbar", slot);
}
generateUtilityClasses("MuiPickersToolbar", [
"root",
"content"
]);
const _excluded$c = [
"children",
"className",
"toolbarTitle",
"hidden",
"titleId",
"isLandscape",
"classes",
"landscapeDirection"
];
const useUtilityClasses$7 = (ownerState) => {
const { classes } = ownerState;
const slots = {
root: [
"root"
],
content: [
"content"
]
};
return composeClasses(slots, getPickersToolbarUtilityClass, classes);
};
const PickersToolbarRoot = styled("div", {
name: "MuiPickersToolbar",
slot: "Root",
overridesResolver: (props, styles2) => styles2.root
})(({ theme }) => ({
display: "flex",
flexDirection: "column",
alignItems: "flex-start",
justifyContent: "space-between",
padding: theme.spacing(2, 3),
variants: [
{
props: {
isLandscape: true
},
style: {
height: "auto",
maxWidth: 160,
padding: 16,
justifyContent: "flex-start",
flexWrap: "wrap"
}
}
]
}));
const PickersToolbarContent = styled("div", {
name: "MuiPickersToolbar",
slot: "Content",
overridesResolver: (props, styles2) => styles2.content
})({
display: "flex",
flexWrap: "wrap",
width: "100%",
flex: 1,
justifyContent: "space-between",
alignItems: "center",
flexDirection: "row",
variants: [
{
props: {
isLandscape: true
},
style: {
justifyContent: "flex-start",
alignItems: "flex-start",
flexDirection: "column"
}
},
{
props: {
isLandscape: true,
landscapeDirection: "row"
},
style: {
flexDirection: "row"
}
}
]
});
const PickersToolbar = __mf_14$1(function PickersToolbar2(inProps, ref) {
const props = useThemeProps({
props: inProps,
name: "MuiPickersToolbar"
});
const { children, className, toolbarTitle, hidden, titleId } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$c);
const ownerState = props;
const classes = useUtilityClasses$7(ownerState);
if (hidden) {
return null;
}
return jsxRuntimeExports.jsxs(PickersToolbarRoot, _extends$1({
ref,
className: clsx(classes.root, className),
ownerState
}, other, {
children: [
jsxRuntimeExports.jsx(Typography, {
color: "text.secondary",
variant: "overline",
id: titleId,
children: toolbarTitle
}),
jsxRuntimeExports.jsx(PickersToolbarContent, {
className: classes.content,
ownerState,
children
})
]
}));
});
function getDatePickerToolbarUtilityClass(slot) {
return generateUtilityClass("MuiDatePickerToolbar", slot);
}
generateUtilityClasses("MuiDatePickerToolbar", [
"root",
"title"
]);
const _excluded$b = [
"value",
"isLandscape",
"onChange",
"toolbarFormat",
"toolbarPlaceholder",
"views",
"className",
"onViewChange",
"view"
];
const useUtilityClasses$6 = (ownerState) => {
const { classes } = ownerState;
const slots = {
root: [
"root"
],
title: [
"title"
]
};
return composeClasses(slots, getDatePickerToolbarUtilityClass, classes);
};
const DatePickerToolbarRoot = styled(PickersToolbar, {
name: "MuiDatePickerToolbar",
slot: "Root",
overridesResolver: (_, styles2) => styles2.root
})({});
const DatePickerToolbarTitle = styled(Typography, {
name: "MuiDatePickerToolbar",
slot: "Title",
overridesResolver: (_, styles2) => styles2.title
})({
variants: [
{
props: {
isLandscape: true
},
style: {
margin: "auto 16px auto auto"
}
}
]
});
const DatePickerToolbar = __mf_14$1(function DatePickerToolbar2(inProps, ref) {
const props = useThemeProps({
props: inProps,
name: "MuiDatePickerToolbar"
});
const { value, isLandscape, toolbarFormat, toolbarPlaceholder = "\u2013\u2013", views, className } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$b);
const utils = useUtils();
const translations = usePickersTranslations();
const classes = useUtilityClasses$6(props);
const dateText = __mf_29(() => {
if (!value) {
return toolbarPlaceholder;
}
const formatFromViews = resolveDateFormat(utils, {
format: toolbarFormat,
views
}, true);
return utils.formatByString(value, formatFromViews);
}, [
value,
toolbarFormat,
toolbarPlaceholder,
utils,
views
]);
const ownerState = props;
return jsxRuntimeExports.jsx(DatePickerToolbarRoot, _extends$1({
ref,
toolbarTitle: translations.datePickerToolbarTitle,
isLandscape,
className: clsx(classes.root, className)
}, other, {
children: jsxRuntimeExports.jsx(DatePickerToolbarTitle, {
variant: "h4",
align: isLandscape ? "left" : "center",
ownerState,
className: classes.title,
children: dateText
})
}));
});
function useDatePickerDefaultizedProps(props, name) {
const utils = useUtils();
const defaultDates = useDefaultDates();
const themeProps = useThemeProps({
props,
name
});
const localeText = __mf_29(() => {
var _a;
if (((_a = themeProps.localeText) == null ? void 0 : _a.toolbarTitle) == null) {
return themeProps.localeText;
}
return _extends$1({}, themeProps.localeText, {
datePickerToolbarTitle: themeProps.localeText.toolbarTitle
});
}, [
themeProps.localeText
]);
return _extends$1({}, themeProps, {
localeText
}, applyDefaultViewProps({
views: themeProps.views,
openTo: themeProps.openTo,
defaultViews: [
"year",
"day"
],
defaultOpenTo: "day"
}), {
disableFuture: themeProps.disableFuture ?? false,
disablePast: themeProps.disablePast ?? false,
minDate: applyDefaultDate(utils, themeProps.minDate, defaultDates.minDate),
maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate),
slots: _extends$1({
toolbar: DatePickerToolbar
}, themeProps.slots)
});
}
function getPickersPopperUtilityClass(slot) {
return generateUtilityClass("MuiPickersPopper", slot);
}
generateUtilityClasses("MuiPickersPopper", [
"root",
"paper"
]);
const _excluded$a = [
"PaperComponent",
"popperPlacement",
"ownerState",
"children",
"paperSlotProps",
"paperClasses",
"onPaperClick",
"onPaperTouchStart"
];
const useUtilityClasses$5 = (ownerState) => {
const { classes } = ownerState;
const slots = {
root: [
"root"
],
paper: [
"paper"
]
};
return composeClasses(slots, getPickersPopperUtilityClass, classes);
};
const PickersPopperRoot = styled(Popper, {
name: "MuiPickersPopper",
slot: "Root",
overridesResolver: (_, styles2) => styles2.root
})(({ theme }) => ({
zIndex: theme.zIndex.modal
}));
const PickersPopperPaper = styled(Paper, {
name: "MuiPickersPopper",
slot: "Paper",
overridesResolver: (_, styles2) => styles2.paper
})({
outline: 0,
transformOrigin: "top center",
variants: [
{
props: ({ placement }) => [
"top",
"top-start",
"top-end"
].includes(placement),
style: {
transformOrigin: "bottom center"
}
}
]
});
function clickedRootScrollbar(event, doc) {
return doc.documentElement.clientWidth < event.clientX || doc.documentElement.clientHeight < event.clientY;
}
function useClickAwayListener(active, onClickAway) {
const movedRef = __mf_31(false);
const syntheticEventRef = __mf_31(false);
const nodeRef = __mf_31(null);
const activatedRef = __mf_31(false);
__mf_24(() => {
if (!active) {
return void 0;
}
function armClickAwayListener() {
activatedRef.current = true;
}
document.addEventListener("mousedown", armClickAwayListener, true);
document.addEventListener("touchstart", armClickAwayListener, true);
return () => {
document.removeEventListener("mousedown", armClickAwayListener, true);
document.removeEventListener("touchstart", armClickAwayListener, true);
activatedRef.current = false;
};
}, [
active
]);
const handleClickAway = useEventCallback((event) => {
if (!activatedRef.current) {
return;
}
const insideReactTree = syntheticEventRef.current;
syntheticEventRef.current = false;
const doc = ownerDocument(nodeRef.current);
if (!nodeRef.current || "clientX" in event && clickedRootScrollbar(event, doc)) {
return;
}
if (movedRef.current) {
movedRef.current = false;
return;
}
let insideDOM;
if (event.composedPath) {
insideDOM = event.composedPath().indexOf(nodeRef.current) > -1;
} else {
insideDOM = !doc.documentElement.contains(event.target) || nodeRef.current.contains(event.target);
}
if (!insideDOM && !insideReactTree) {
onClickAway(event);
}
});
const handleSynthetic = () => {
syntheticEventRef.current = true;
};
__mf_24(() => {
if (active) {
const doc = ownerDocument(nodeRef.current);
const handleTouchMove = () => {
movedRef.current = true;
};
doc.addEventListener("touchstart", handleClickAway);
doc.addEventListener("touchmove", handleTouchMove);
return () => {
doc.removeEventListener("touchstart", handleClickAway);
doc.removeEventListener("touchmove", handleTouchMove);
};
}
return void 0;
}, [
active,
handleClickAway
]);
__mf_24(() => {
if (active) {
const doc = ownerDocument(nodeRef.current);
doc.addEventListener("click", handleClickAway);
return () => {
doc.removeEventListener("click", handleClickAway);
syntheticEventRef.current = false;
};
}
return void 0;
}, [
active,
handleClickAway
]);
return [
nodeRef,
handleSynthetic,
handleSynthetic
];
}
const PickersPopperPaperWrapper = __mf_14$1((props, ref) => {
const { PaperComponent, popperPlacement, ownerState: inOwnerState, children, paperSlotProps, paperClasses, onPaperClick, onPaperTouchStart } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$a);
const ownerState = _extends$1({}, inOwnerState, {
placement: popperPlacement
});
const paperProps = useSlotProps({
elementType: PaperComponent,
externalSlotProps: paperSlotProps,
additionalProps: {
tabIndex: -1,
elevation: 8,
ref
},
className: paperClasses,
ownerState
});
return jsxRuntimeExports.jsx(PaperComponent, _extends$1({}, other, paperProps, {
onClick: (event) => {
var _a;
onPaperClick(event);
(_a = paperProps.onClick) == null ? void 0 : _a.call(paperProps, event);
},
onTouchStart: (event) => {
var _a;
onPaperTouchStart(event);
(_a = paperProps.onTouchStart) == null ? void 0 : _a.call(paperProps, event);
},
ownerState,
children
}));
});
function PickersPopper(inProps) {
const props = useThemeProps({
props: inProps,
name: "MuiPickersPopper"
});
const { anchorEl, children, containerRef = null, shouldRestoreFocus, onBlur, onDismiss, open, role, placement, slots, slotProps, reduceAnimations: inReduceAnimations } = props;
__mf_24(() => {
function handleKeyDown2(nativeEvent) {
if (open && nativeEvent.key === "Escape") {
onDismiss();
}
}
document.addEventListener("keydown", handleKeyDown2);
return () => {
document.removeEventListener("keydown", handleKeyDown2);
};
}, [
onDismiss,
open
]);
const lastFocusedElementRef = __mf_31(null);
__mf_24(() => {
if (role === "tooltip" || shouldRestoreFocus && !shouldRestoreFocus()) {
return;
}
if (open) {
lastFocusedElementRef.current = getActiveElement(document);
} else if (lastFocusedElementRef.current && lastFocusedElementRef.current instanceof HTMLElement) {
setTimeout(() => {
if (lastFocusedElementRef.current instanceof HTMLElement) {
lastFocusedElementRef.current.focus();
}
});
}
}, [
open,
role,
shouldRestoreFocus
]);
const [clickAwayRef, onPaperClick, onPaperTouchStart] = useClickAwayListener(open, onBlur ?? onDismiss);
const paperRef = __mf_31(null);
const handleRef = useForkRef(paperRef, containerRef);
const handlePaperRef = useForkRef(handleRef, clickAwayRef);
const ownerState = props;
const classes = useUtilityClasses$5(ownerState);
const defaultReduceAnimations = useDefaultReduceAnimations();
const reduceAnimations = inReduceAnimations ?? defaultReduceAnimations;
const handleKeyDown = (event) => {
if (event.key === "Escape") {
event.stopPropagation();
onDismiss();
}
};
const Transition2 = (slots == null ? void 0 : slots.desktopTransition) ?? reduceAnimations ? Fade : Grow;
const FocusTrap$1 = (slots == null ? void 0 : slots.desktopTrapFocus) ?? FocusTrap;
const Paper2 = (slots == null ? void 0 : slots.desktopPaper) ?? PickersPopperPaper;
const Popper2 = (slots == null ? void 0 : slots.popper) ?? PickersPopperRoot;
const popperProps = useSlotProps({
elementType: Popper2,
externalSlotProps: slotProps == null ? void 0 : slotProps.popper,
additionalProps: {
transition: true,
role,
open,
anchorEl,
placement,
onKeyDown: handleKeyDown
},
className: classes.root,
ownerState: props
});
return jsxRuntimeExports.jsx(Popper2, _extends$1({}, popperProps, {
children: ({ TransitionProps, placement: popperPlacement }) => jsxRuntimeExports.jsx(FocusTrap$1, _extends$1({
open,
disableAutoFocus: true,
disableRestoreFocus: true,
disableEnforceFocus: role === "tooltip",
isEnabled: () => true
}, slotProps == null ? void 0 : slotProps.desktopTrapFocus, {
children: jsxRuntimeExports.jsx(Transition2, _extends$1({}, TransitionProps, slotProps == null ? void 0 : slotProps.desktopTransition, {
children: jsxRuntimeExports.jsx(PickersPopperPaperWrapper, {
PaperComponent: Paper2,
ownerState,
popperPlacement,
ref: handlePaperRef,
onPaperClick,
onPaperTouchStart,
paperClasses: classes.paper,
paperSlotProps: slotProps == null ? void 0 : slotProps.desktopPaper,
children
})
}))
}))
}));
}
const useOpenState = ({ open, onOpen, onClose }) => {
const isControllingOpenProp = __mf_31(typeof open === "boolean").current;
const [openState, setIsOpenState] = __mf_32$1(false);
__mf_24(() => {
if (isControllingOpenProp) {
if (typeof open !== "boolean") {
throw new Error("You must not mix controlling and uncontrolled mode for `open` prop");
}
setIsOpenState(open);
}
}, [
isControllingOpenProp,
open
]);
const setIsOpen = __mf_20((newIsOpen) => {
if (!isControllingOpenProp) {
setIsOpenState(newIsOpen);
}
if (newIsOpen && onOpen) {
onOpen();
}
if (!newIsOpen && onClose) {
onClose();
}
}, [
isControllingOpenProp,
onOpen,
onClose
]);
return {
isOpen: openState,
setIsOpen
};
};
const shouldPublishValue = (params) => {
const { action, hasChanged, dateState, isControlled } = params;
const isCurrentValueTheDefaultValue = !isControlled && !dateState.hasBeenModifiedSinceMount;
if (action.name === "setValueFromField") {
return true;
}
if (action.name === "setValueFromAction") {
if (isCurrentValueTheDefaultValue && [
"accept",
"today",
"clear"
].includes(action.pickerAction)) {
return true;
}
return hasChanged(dateState.lastPublishedValue);
}
if (action.name === "setValueFromView" && action.selectionState !== "shallow") {
if (isCurrentValueTheDefaultValue) {
return true;
}
return hasChanged(dateState.lastPublishedValue);
}
if (action.name === "setValueFromShortcut") {
if (isCurrentValueTheDefaultValue) {
return true;
}
return hasChanged(dateState.lastPublishedValue);
}
return false;
};
const shouldCommitValue = (params) => {
const { action, hasChanged, dateState, isControlled, closeOnSelect } = params;
const isCurrentValueTheDefaultValue = !isControlled && !dateState.hasBeenModifiedSinceMount;
if (action.name === "setValueFromAction") {
if (isCurrentValueTheDefaultValue && [
"accept",
"today",
"clear"
].includes(action.pickerAction)) {
return true;
}
return hasChanged(dateState.lastCommittedValue);
}
if (action.name === "setValueFromView" && action.selectionState === "finish" && closeOnSelect) {
if (isCurrentValueTheDefaultValue) {
return true;
}
return hasChanged(dateState.lastCommittedValue);
}
if (action.name === "setValueFromShortcut") {
return action.changeImportance === "accept" && hasChanged(dateState.lastCommittedValue);
}
return false;
};
const shouldClosePicker = (params) => {
const { action, closeOnSelect } = params;
if (action.name === "setValueFromAction") {
return true;
}
if (action.name === "setValueFromView") {
return action.selectionState === "finish" && closeOnSelect;
}
if (action.name === "setValueFromShortcut") {
return action.changeImportance === "accept";
}
return false;
};
const usePickerValue = ({ props, valueManager, valueType, wrapperVariant, validator }) => {
const { onAccept, onChange, value: inValueWithoutRenderTimezone, defaultValue: inDefaultValue, closeOnSelect = wrapperVariant === "desktop", timezone: timezoneProp, referenceDate } = props;
const { current: defaultValue } = __mf_31(inDefaultValue);
const { current: isControlled } = __mf_31(inValueWithoutRenderTimezone !== void 0);
const [previousTimezoneProp, setPreviousTimezoneProp] = __mf_32$1(timezoneProp);
const utils = useUtils();
const adapter = useLocalizationContext();
const { isOpen, setIsOpen } = useOpenState(props);
const { timezone, value: inValueWithTimezoneToRender, handleValueChange } = useValueWithTimezone({
timezone: timezoneProp,
value: inValueWithoutRenderTimezone,
defaultValue,
referenceDate,
onChange,
valueManager
});
const [dateState, setDateState] = __mf_32$1(() => {
let initialValue;
if (inValueWithTimezoneToRender !== void 0) {
initialValue = inValueWithTimezoneToRender;
} else if (defaultValue !== void 0) {
initialValue = defaultValue;
} else {
initialValue = valueManager.emptyValue;
}
return {
draft: initialValue,
lastPublishedValue: initialValue,
lastCommittedValue: initialValue,
lastControlledValue: inValueWithoutRenderTimezone,
hasBeenModifiedSinceMount: false
};
});
const timezoneFromDraftValue = valueManager.getTimezone(utils, dateState.draft);
if (previousTimezoneProp !== timezoneProp) {
setPreviousTimezoneProp(timezoneProp);
if (timezoneProp && timezoneFromDraftValue && timezoneProp !== timezoneFromDraftValue) {
setDateState((prev) => _extends$1({}, prev, {
draft: valueManager.setTimezone(utils, timezoneProp, prev.draft)
}));
}
}
const { getValidationErrorForNewValue } = useValidation({
props,
validator,
timezone,
value: dateState.draft,
onError: props.onError
});
const updateDate = useEventCallback((action) => {
const updaterParams = {
action,
dateState,
hasChanged: (comparison) => !valueManager.areValuesEqual(utils, action.value, comparison),
isControlled,
closeOnSelect
};
const shouldPublish = shouldPublishValue(updaterParams);
const shouldCommit = shouldCommitValue(updaterParams);
const shouldClose = shouldClosePicker(updaterParams);
setDateState((prev) => _extends$1({}, prev, {
draft: action.value,
lastPublishedValue: shouldPublish ? action.value : prev.lastPublishedValue,
lastCommittedValue: shouldCommit ? action.value : prev.lastCommittedValue,
hasBeenModifiedSinceMount: true
}));
let cachedContext = null;
const getContext = () => {
if (!cachedContext) {
const validationError = action.name === "setValueFromField" ? action.context.validationError : getValidationErrorForNewValue(action.value);
cachedContext = {
validationError
};
if (action.name === "setValueFromShortcut") {
cachedContext.shortcut = action.shortcut;
}
}
return cachedContext;
};
if (shouldPublish) {
handleValueChange(action.value, getContext());
}
if (shouldCommit && onAccept) {
onAccept(action.value, getContext());
}
if (shouldClose) {
setIsOpen(false);
}
});
if (dateState.lastControlledValue !== inValueWithoutRenderTimezone) {
const isUpdateComingFromPicker = valueManager.areValuesEqual(utils, dateState.draft, inValueWithTimezoneToRender);
setDateState((prev) => _extends$1({}, prev, {
lastControlledValue: inValueWithoutRenderTimezone
}, isUpdateComingFromPicker ? {} : {
lastCommittedValue: inValueWithTimezoneToRender,
lastPublishedValue: inValueWithTimezoneToRender,
draft: inValueWithTimezoneToRender,
hasBeenModifiedSinceMount: true
}));
}
const handleClear = useEventCallback(() => {
updateDate({
value: valueManager.emptyValue,
name: "setValueFromAction",
pickerAction: "clear"
});
});
const handleAccept = useEventCallback(() => {
updateDate({
value: dateState.lastPublishedValue,
name: "setValueFromAction",
pickerAction: "accept"
});
});
const handleDismiss = useEventCallback(() => {
updateDate({
value: dateState.lastPublishedValue,
name: "setValueFromAction",
pickerAction: "dismiss"
});
});
const handleCancel = useEventCallback(() => {
updateDate({
value: dateState.lastCommittedValue,
name: "setValueFromAction",
pickerAction: "cancel"
});
});
const handleSetToday = useEventCallback(() => {
updateDate({
value: valueManager.getTodayValue(utils, timezone, valueType),
name: "setValueFromAction",
pickerAction: "today"
});
});
const handleOpen = useEventCallback((event) => {
event.preventDefault();
setIsOpen(true);
});
const handleClose = useEventCallback((event) => {
event == null ? void 0 : event.preventDefault();
setIsOpen(false);
});
const handleChange = useEventCallback((newValue, selectionState = "partial") => updateDate({
name: "setValueFromView",
value: newValue,
selectionState
}));
const handleSelectShortcut = useEventCallback((newValue, changeImportance, shortcut) => updateDate({
name: "setValueFromShortcut",
value: newValue,
changeImportance,
shortcut
}));
const handleChangeFromField = useEventCallback((newValue, context) => updateDate({
name: "setValueFromField",
value: newValue,
context
}));
const actions = {
onClear: handleClear,
onAccept: handleAccept,
onDismiss: handleDismiss,
onCancel: handleCancel,
onSetToday: handleSetToday,
onOpen: handleOpen,
onClose: handleClose
};
const fieldResponse = {
value: dateState.draft,
onChange: handleChangeFromField
};
const viewValue = __mf_29(() => valueManager.cleanValue(utils, dateState.draft), [
utils,
valueManager,
dateState.draft
]);
const viewResponse = {
value: viewValue,
onChange: handleChange,
onClose: handleClose,
open: isOpen
};
const isValid2 = (testedValue) => {
const error = validator({
adapter,
value: testedValue,
timezone,
props
});
return !valueManager.hasError(error);
};
const layoutResponse = _extends$1({}, actions, {
value: viewValue,
onChange: handleChange,
onSelectShortcut: handleSelectShortcut,
isValid: isValid2
});
const contextValue = __mf_29(() => ({
onOpen: handleOpen,
onClose: handleClose,
open: isOpen
}), [
isOpen,
handleClose,
handleOpen
]);
return {
open: isOpen,
fieldProps: fieldResponse,
viewProps: viewResponse,
layoutProps: layoutResponse,
actions,
contextValue
};
};
const _excluded$9 = [
"className",
"sx"
];
const usePickerViews = ({ props, propsFromPickerValue, additionalViewProps, autoFocusView, rendererInterceptor, fieldRef }) => {
const { onChange, open, onClose } = propsFromPickerValue;
const { view: inView, views, openTo, onViewChange, viewRenderers, timezone } = props;
const propsToForwardToView = _objectWithoutPropertiesLoose$1(props, _excluded$9);
const { view, setView, defaultView, focusedView, setFocusedView, setValueAndGoToNextView } = useViews({
view: inView,
views,
openTo,
onChange,
onViewChange,
autoFocus: autoFocusView
});
const { hasUIView, viewModeLookup } = __mf_29(() => views.reduce((acc, viewForReduce) => {
let viewMode;
if (viewRenderers[viewForReduce] != null) {
viewMode = "UI";
} else {
viewMode = "field";
}
acc.viewModeLookup[viewForReduce] = viewMode;
if (viewMode === "UI") {
acc.hasUIView = true;
}
return acc;
}, {
hasUIView: false,
viewModeLookup: {}
}), [
viewRenderers,
views
]);
const timeViewsCount = __mf_29(() => views.reduce((acc, viewForReduce) => {
if (viewRenderers[viewForReduce] != null && isTimeView(viewForReduce)) {
return acc + 1;
}
return acc;
}, 0), [
viewRenderers,
views
]);
const currentViewMode = viewModeLookup[view];
const shouldRestoreFocus = useEventCallback(() => currentViewMode === "UI");
const [popperView, setPopperView] = __mf_32$1(currentViewMode === "UI" ? view : null);
if (popperView !== view && viewModeLookup[view] === "UI") {
setPopperView(view);
}
useEnhancedEffect(() => {
if (currentViewMode === "field" && open) {
onClose();
setTimeout(() => {
var _a, _b;
(_a = fieldRef == null ? void 0 : fieldRef.current) == null ? void 0 : _a.setSelectedSections(view);
(_b = fieldRef == null ? void 0 : fieldRef.current) == null ? void 0 : _b.focusField(view);
});
}
}, [
view
]);
useEnhancedEffect(() => {
if (!open) {
return;
}
let newView = view;
if (currentViewMode === "field" && popperView != null) {
newView = popperView;
}
if (newView !== defaultView && viewModeLookup[newView] === "UI" && viewModeLookup[defaultView] === "UI") {
newView = defaultView;
}
if (newView !== view) {
setView(newView);
}
setFocusedView(newView, true);
}, [
open
]);
const layoutProps = {
views,
view: popperView,
onViewChange: setView
};
return {
hasUIView,
shouldRestoreFocus,
layoutProps,
renderCurrentView: () => {
if (popperView == null) {
return null;
}
const renderer = viewRenderers[popperView];
if (renderer == null) {
return null;
}
const rendererProps = _extends$1({}, propsToForwardToView, additionalViewProps, propsFromPickerValue, {
views,
timezone,
onChange: setValueAndGoToNextView,
view: popperView,
onViewChange: setView,
focusedView,
onFocusedViewChange: setFocusedView,
showViewSwitcher: timeViewsCount > 1,
timeViewsCount
});
if (rendererInterceptor) {
return rendererInterceptor(viewRenderers, popperView, rendererProps);
}
return renderer(rendererProps);
}
};
};
function getOrientation() {
if (typeof window === "undefined") {
return "portrait";
}
if (window.screen && window.screen.orientation && window.screen.orientation.angle) {
return Math.abs(window.screen.orientation.angle) === 90 ? "landscape" : "portrait";
}
if (window.orientation) {
return Math.abs(Number(window.orientation)) === 90 ? "landscape" : "portrait";
}
return "portrait";
}
const useIsLandscape = (views, customOrientation) => {
const [orientation, setOrientation] = __mf_32$1(getOrientation);
useEnhancedEffect(() => {
const eventHandler = () => {
setOrientation(getOrientation());
};
window.addEventListener("orientationchange", eventHandler);
return () => {
window.removeEventListener("orientationchange", eventHandler);
};
}, []);
if (arrayIncludes(views, [
"hours",
"minutes",
"seconds"
])) {
return false;
}
const orientationToUse = customOrientation || orientation;
return orientationToUse === "landscape";
};
const usePickerLayoutProps = ({ props, propsFromPickerValue, propsFromPickerViews, wrapperVariant }) => {
const { orientation } = props;
const isLandscape = useIsLandscape(propsFromPickerViews.views, orientation);
const isRtl = useRtl();
const layoutProps = _extends$1({}, propsFromPickerViews, propsFromPickerValue, {
isLandscape,
isRtl,
wrapperVariant,
disabled: props.disabled,
readOnly: props.readOnly
});
return {
layoutProps
};
};
function usePickerOwnerState(parameters) {
const { props, pickerValueResponse } = parameters;
return __mf_29(() => ({
value: pickerValueResponse.viewProps.value,
open: pickerValueResponse.open,
disabled: props.disabled ?? false,
readOnly: props.readOnly ?? false
}), [
pickerValueResponse.viewProps.value,
pickerValueResponse.open,
props.disabled,
props.readOnly
]);
}
const usePicker = ({ props, valueManager, valueType, wrapperVariant, additionalViewProps, validator, autoFocusView, rendererInterceptor, fieldRef }) => {
const pickerValueResponse = usePickerValue({
props,
valueManager,
valueType,
wrapperVariant,
validator
});
const pickerViewsResponse = usePickerViews({
props,
additionalViewProps,
autoFocusView,
fieldRef,
propsFromPickerValue: pickerValueResponse.viewProps,
rendererInterceptor
});
const pickerLayoutResponse = usePickerLayoutProps({
props,
wrapperVariant,
propsFromPickerValue: pickerValueResponse.layoutProps,
propsFromPickerViews: pickerViewsResponse.layoutProps
});
const pickerOwnerState = usePickerOwnerState({
props,
pickerValueResponse
});
return {
open: pickerValueResponse.open,
actions: pickerValueResponse.actions,
fieldProps: pickerValueResponse.fieldProps,
renderCurrentView: pickerViewsResponse.renderCurrentView,
hasUIView: pickerViewsResponse.hasUIView,
shouldRestoreFocus: pickerViewsResponse.shouldRestoreFocus,
layoutProps: pickerLayoutResponse.layoutProps,
contextValue: pickerValueResponse.contextValue,
ownerState: pickerOwnerState
};
};
function getPickersLayoutUtilityClass(slot) {
return generateUtilityClass("MuiPickersLayout", slot);
}
const pickersLayoutClasses = generateUtilityClasses("MuiPickersLayout", [
"root",
"landscape",
"contentWrapper",
"toolbar",
"actionBar",
"tabs",
"shortcuts"
]);
const _excluded$8 = [
"onAccept",
"onClear",
"onCancel",
"onSetToday",
"actions"
];
function PickersActionBar(props) {
const { onAccept, onClear, onCancel, onSetToday, actions } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$8);
const translations = usePickersTranslations();
if (actions == null || actions.length === 0) {
return null;
}
const buttons = actions == null ? void 0 : actions.map((actionType) => {
switch (actionType) {
case "clear":
return jsxRuntimeExports.jsx(Button, {
onClick: onClear,
children: translations.clearButtonLabel
}, actionType);
case "cancel":
return jsxRuntimeExports.jsx(Button, {
onClick: onCancel,
children: translations.cancelButtonLabel
}, actionType);
case "accept":
return jsxRuntimeExports.jsx(Button, {
onClick: onAccept,
children: translations.okButtonLabel
}, actionType);
case "today":
return jsxRuntimeExports.jsx(Button, {
onClick: onSetToday,
children: translations.todayButtonLabel
}, actionType);
default:
return null;
}
});
return jsxRuntimeExports.jsx(DialogActions, _extends$1({}, other, {
children: buttons
}));
}
const _excluded$7 = [
"items",
"changeImportance",
"isLandscape",
"onChange",
"isValid"
], _excluded2$1 = [
"getValue"
];
function PickersShortcuts(props) {
const { items, changeImportance = "accept", onChange, isValid: isValid2 } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$7);
if (items == null || items.length === 0) {
return null;
}
const resolvedItems = items.map((_ref) => {
let { getValue } = _ref, item = _objectWithoutPropertiesLoose$1(_ref, _excluded2$1);
const newValue = getValue({
isValid: isValid2
});
return _extends$1({}, item, {
label: item.label,
onClick: () => {
onChange(newValue, changeImportance, item);
},
disabled: !isValid2(newValue)
});
});
return jsxRuntimeExports.jsx(List, _extends$1({
dense: true,
sx: [
{
maxHeight: VIEW_HEIGHT,
maxWidth: 200,
overflow: "auto"
},
...Array.isArray(other.sx) ? other.sx : [
other.sx
]
]
}, other, {
children: resolvedItems.map((item) => {
return jsxRuntimeExports.jsx(ListItem, {
children: jsxRuntimeExports.jsx(Chip, _extends$1({}, item))
}, item.id ?? item.label);
})
}));
}
function toolbarHasView(toolbarProps) {
return toolbarProps.view !== null;
}
const useUtilityClasses$4 = (ownerState) => {
const { classes, isLandscape } = ownerState;
const slots = {
root: [
"root",
isLandscape && "landscape"
],
contentWrapper: [
"contentWrapper"
],
toolbar: [
"toolbar"
],
actionBar: [
"actionBar"
],
tabs: [
"tabs"
],
landscape: [
"landscape"
],
shortcuts: [
"shortcuts"
]
};
return composeClasses(slots, getPickersLayoutUtilityClass, classes);
};
const usePickerLayout = (props) => {
const { wrapperVariant, onAccept, onClear, onCancel, onSetToday, view, views, onViewChange, value, onChange, onSelectShortcut, isValid: isValid2, isLandscape, disabled, readOnly, children, slots, slotProps } = props;
const classes = useUtilityClasses$4(props);
const ActionBar = (slots == null ? void 0 : slots.actionBar) ?? PickersActionBar;
const actionBarProps = useSlotProps({
elementType: ActionBar,
externalSlotProps: slotProps == null ? void 0 : slotProps.actionBar,
additionalProps: {
onAccept,
onClear,
onCancel,
onSetToday,
actions: wrapperVariant === "desktop" ? [] : [
"cancel",
"accept"
]
},
className: classes.actionBar,
ownerState: _extends$1({}, props, {
wrapperVariant
})
});
const actionBar = jsxRuntimeExports.jsx(ActionBar, _extends$1({}, actionBarProps));
const Toolbar = slots == null ? void 0 : slots.toolbar;
const toolbarProps = useSlotProps({
elementType: Toolbar,
externalSlotProps: slotProps == null ? void 0 : slotProps.toolbar,
additionalProps: {
isLandscape,
onChange,
value,
view,
onViewChange,
views,
disabled,
readOnly
},
className: classes.toolbar,
ownerState: _extends$1({}, props, {
wrapperVariant
})
});
const toolbar = toolbarHasView(toolbarProps) && !!Toolbar ? jsxRuntimeExports.jsx(Toolbar, _extends$1({}, toolbarProps)) : null;
const content = children;
const Tabs = slots == null ? void 0 : slots.tabs;
const tabs = view && Tabs ? jsxRuntimeExports.jsx(Tabs, _extends$1({
view,
onViewChange,
className: classes.tabs
}, slotProps == null ? void 0 : slotProps.tabs)) : null;
const Shortcuts = (slots == null ? void 0 : slots.shortcuts) ?? PickersShortcuts;
const shortcutsProps = useSlotProps({
elementType: Shortcuts,
externalSlotProps: slotProps == null ? void 0 : slotProps.shortcuts,
additionalProps: {
isValid: isValid2,
isLandscape,
onChange: onSelectShortcut
},
className: classes.shortcuts,
ownerState: {
isValid: isValid2,
isLandscape,
onChange: onSelectShortcut,
wrapperVariant
}
});
const shortcuts = view && !!Shortcuts ? jsxRuntimeExports.jsx(Shortcuts, _extends$1({}, shortcutsProps)) : null;
return {
toolbar,
content,
tabs,
actionBar,
shortcuts
};
};
const useUtilityClasses$3 = (ownerState) => {
const { isLandscape, classes } = ownerState;
const slots = {
root: [
"root",
isLandscape && "landscape"
],
contentWrapper: [
"contentWrapper"
]
};
return composeClasses(slots, getPickersLayoutUtilityClass, classes);
};
const PickersLayoutRoot = styled("div", {
name: "MuiPickersLayout",
slot: "Root",
overridesResolver: (props, styles2) => styles2.root
})({
display: "grid",
gridAutoColumns: "max-content auto max-content",
gridAutoRows: "max-content auto max-content",
[`& .${pickersLayoutClasses.actionBar}`]: {
gridColumn: "1 / 4",
gridRow: 3
},
variants: [
{
props: {
isLandscape: true
},
style: {
[`& .${pickersLayoutClasses.toolbar}`]: {
gridColumn: 1,
gridRow: "2 / 3"
},
[`.${pickersLayoutClasses.shortcuts}`]: {
gridColumn: "2 / 4",
gridRow: 1
}
}
},
{
props: {
isLandscape: true,
isRtl: true
},
style: {
[`& .${pickersLayoutClasses.toolbar}`]: {
gridColumn: 3
}
}
},
{
props: {
isLandscape: false
},
style: {
[`& .${pickersLayoutClasses.toolbar}`]: {
gridColumn: "2 / 4",
gridRow: 1
},
[`& .${pickersLayoutClasses.shortcuts}`]: {
gridColumn: 1,
gridRow: "2 / 3"
}
}
},
{
props: {
isLandscape: false,
isRtl: true
},
style: {
[`& .${pickersLayoutClasses.shortcuts}`]: {
gridColumn: 3
}
}
}
]
});
const PickersLayoutContentWrapper = styled("div", {
name: "MuiPickersLayout",
slot: "ContentWrapper",
overridesResolver: (props, styles2) => styles2.contentWrapper
})({
gridColumn: 2,
gridRow: 2,
display: "flex",
flexDirection: "column"
});
const PickersLayout = __mf_14$1(function PickersLayout2(inProps, ref) {
const props = useThemeProps({
props: inProps,
name: "MuiPickersLayout"
});
const { toolbar, content, tabs, actionBar, shortcuts } = usePickerLayout(props);
const { sx, className, isLandscape, wrapperVariant } = props;
const classes = useUtilityClasses$3(props);
return jsxRuntimeExports.jsxs(PickersLayoutRoot, {
ref,
sx,
className: clsx(classes.root, className),
ownerState: props,
children: [
isLandscape ? shortcuts : toolbar,
isLandscape ? toolbar : shortcuts,
jsxRuntimeExports.jsx(PickersLayoutContentWrapper, {
className: classes.contentWrapper,
children: wrapperVariant === "desktop" ? jsxRuntimeExports.jsxs(__mf_2$1, {
children: [
content,
tabs
]
}) : jsxRuntimeExports.jsxs(__mf_2$1, {
children: [
tabs,
content
]
})
}),
actionBar
]
});
});
const _excluded$6 = [
"props",
"getOpenDialogAriaText"
], _excluded2 = [
"ownerState"
], _excluded3 = [
"ownerState"
];
const useDesktopPicker = (_ref) => {
var _a;
let { props, getOpenDialogAriaText } = _ref, pickerParams = _objectWithoutPropertiesLoose$1(_ref, _excluded$6);
const { slots, slotProps: innerSlotProps, className, sx, format: format2, formatDensity, enableAccessibleFieldDOMStructure, selectedSections, onSelectedSectionsChange, timezone, name, label, inputRef, readOnly, disabled, autoFocus, localeText, reduceAnimations } = props;
const containerRef = __mf_31(null);
const fieldRef = __mf_31(null);
const labelId = useId();
const isToolbarHidden = ((_a = innerSlotProps == null ? void 0 : innerSlotProps.toolbar) == null ? void 0 : _a.hidden) ?? false;
const { open, actions, hasUIView, layoutProps, renderCurrentView, shouldRestoreFocus, fieldProps: pickerFieldProps, contextValue, ownerState } = usePicker(_extends$1({}, pickerParams, {
props,
fieldRef,
autoFocusView: true,
additionalViewProps: {},
wrapperVariant: "desktop"
}));
const InputAdornment$1 = slots.inputAdornment ?? InputAdornment;
const _useSlotProps = useSlotProps({
elementType: InputAdornment$1,
externalSlotProps: innerSlotProps == null ? void 0 : innerSlotProps.inputAdornment,
additionalProps: {
position: "end"
},
ownerState: props
}), inputAdornmentProps = _objectWithoutPropertiesLoose$1(_useSlotProps, _excluded2);
const OpenPickerButton = slots.openPickerButton ?? IconButton;
const _useSlotProps2 = useSlotProps({
elementType: OpenPickerButton,
externalSlotProps: innerSlotProps == null ? void 0 : innerSlotProps.openPickerButton,
additionalProps: {
disabled: disabled || readOnly,
onClick: open ? actions.onClose : actions.onOpen,
"aria-label": getOpenDialogAriaText(pickerFieldProps.value),
edge: inputAdornmentProps.position
},
ownerState: props
}), openPickerButtonProps = _objectWithoutPropertiesLoose$1(_useSlotProps2, _excluded3);
const OpenPickerIcon = slots.openPickerIcon;
const openPickerIconProps = useSlotProps({
elementType: OpenPickerIcon,
externalSlotProps: innerSlotProps == null ? void 0 : innerSlotProps.openPickerIcon,
ownerState
});
const Field = slots.field;
const fieldProps = useSlotProps({
elementType: Field,
externalSlotProps: innerSlotProps == null ? void 0 : innerSlotProps.field,
additionalProps: _extends$1({}, pickerFieldProps, isToolbarHidden && {
id: labelId
}, {
readOnly,
disabled,
className,
sx,
format: format2,
formatDensity,
enableAccessibleFieldDOMStructure,
selectedSections,
onSelectedSectionsChange,
timezone,
label,
name,
autoFocus: autoFocus && !props.open,
focused: open ? true : void 0
}, inputRef ? {
inputRef
} : {}),
ownerState: props
});
if (hasUIView) {
fieldProps.InputProps = _extends$1({}, fieldProps.InputProps, {
ref: containerRef
}, !props.disableOpenPicker && {
[`${inputAdornmentProps.position}Adornment`]: jsxRuntimeExports.jsx(InputAdornment$1, _extends$1({}, inputAdornmentProps, {
children: jsxRuntimeExports.jsx(OpenPickerButton, _extends$1({}, openPickerButtonProps, {
children: jsxRuntimeExports.jsx(OpenPickerIcon, _extends$1({}, openPickerIconProps))
}))
}))
});
}
const slotsForField = _extends$1({
textField: slots.textField,
clearIcon: slots.clearIcon,
clearButton: slots.clearButton
}, fieldProps.slots);
const Layout = slots.layout ?? PickersLayout;
let labelledById = labelId;
if (isToolbarHidden) {
if (label) {
labelledById = `${labelId}-label`;
} else {
labelledById = void 0;
}
}
const slotProps = _extends$1({}, innerSlotProps, {
toolbar: _extends$1({}, innerSlotProps == null ? void 0 : innerSlotProps.toolbar, {
titleId: labelId
}),
popper: _extends$1({
"aria-labelledby": labelledById
}, innerSlotProps == null ? void 0 : innerSlotProps.popper)
});
const handleFieldRef = useForkRef(fieldRef, fieldProps.unstableFieldRef);
const renderPicker = () => jsxRuntimeExports.jsxs(PickersProvider, {
contextValue,
localeText,
children: [
jsxRuntimeExports.jsx(Field, _extends$1({}, fieldProps, {
slots: slotsForField,
slotProps,
unstableFieldRef: handleFieldRef
})),
jsxRuntimeExports.jsx(PickersPopper, _extends$1({
role: "dialog",
placement: "bottom-start",
anchorEl: containerRef.current
}, actions, {
open,
slots,
slotProps,
shouldRestoreFocus,
reduceAnimations,
children: jsxRuntimeExports.jsx(Layout, _extends$1({}, layoutProps, slotProps == null ? void 0 : slotProps.layout, {
slots,
slotProps,
children: renderCurrentView()
}))
}))
]
});
return {
renderPicker
};
};
const renderDateViewCalendar = ({ view, onViewChange, views, focusedView, onFocusedViewChange, value, defaultValue, referenceDate, onChange, className, classes, disableFuture, disablePast, minDate, maxDate, shouldDisableDate, shouldDisableMonth, shouldDisableYear, reduceAnimations, onMonthChange, monthsPerRow, onYearChange, yearsOrder, yearsPerRow, slots, slotProps, loading, renderLoading, disableHighlightToday, readOnly, disabled, showDaysOutsideCurrentMonth, dayOfWeekFormatter, sx, autoFocus, fixedWeekNumber, displayWeekNumber, timezone }) => jsxRuntimeExports.jsx(DateCalendar, {
view,
onViewChange,
views: views.filter(isDatePickerView),
focusedView: focusedView && isDatePickerView(focusedView) ? focusedView : null,
onFocusedViewChange,
value,
defaultValue,
referenceDate,
onChange,
className,
classes,
disableFuture,
disablePast,
minDate,
maxDate,
shouldDisableDate,
shouldDisableMonth,
shouldDisableYear,
reduceAnimations,
onMonthChange,
monthsPerRow,
onYearChange,
yearsOrder,
yearsPerRow,
slots,
slotProps,
loading,
renderLoading,
disableHighlightToday,
readOnly,
disabled,
showDaysOutsideCurrentMonth,
dayOfWeekFormatter,
sx,
autoFocus,
fixedWeekNumber,
displayWeekNumber,
timezone
});
const DesktopDatePicker = __mf_14$1(function DesktopDatePicker2(inProps, ref) {
var _a, _b;
const translations = usePickersTranslations();
const utils = useUtils();
const defaultizedProps = useDatePickerDefaultizedProps(inProps, "MuiDesktopDatePicker");
const viewRenderers = _extends$1({
day: renderDateViewCalendar,
month: renderDateViewCalendar,
year: renderDateViewCalendar
}, defaultizedProps.viewRenderers);
const props = _extends$1({}, defaultizedProps, {
viewRenderers,
format: resolveDateFormat(utils, defaultizedProps, false),
yearsPerRow: defaultizedProps.yearsPerRow ?? 4,
slots: _extends$1({
openPickerIcon: CalendarIcon,
field: DateField
}, defaultizedProps.slots),
slotProps: _extends$1({}, defaultizedProps.slotProps, {
field: (ownerState) => {
var _a2;
return _extends$1({}, resolveComponentProps((_a2 = defaultizedProps.slotProps) == null ? void 0 : _a2.field, ownerState), extractValidationProps(defaultizedProps), {
ref
});
},
toolbar: _extends$1({
hidden: true
}, (_a = defaultizedProps.slotProps) == null ? void 0 : _a.toolbar)
})
});
const { renderPicker } = useDesktopPicker({
props,
valueManager: singleItemValueManager,
valueType: "date",
getOpenDialogAriaText: buildGetOpenDialogAriaText({
utils,
formatKey: "fullDate",
contextTranslation: translations.openDatePickerDialogue,
propsTranslation: (_b = props.localeText) == null ? void 0 : _b.openDatePickerDialogue
}),
validator: validateDate
});
return renderPicker();
});
DesktopDatePicker.propTypes = {
autoFocus: PropTypes.bool,
className: PropTypes.string,
closeOnSelect: PropTypes.bool,
dayOfWeekFormatter: PropTypes.func,
defaultValue: PropTypes.object,
disabled: PropTypes.bool,
disableFuture: PropTypes.bool,
disableHighlightToday: PropTypes.bool,
disableOpenPicker: PropTypes.bool,
disablePast: PropTypes.bool,
displayWeekNumber: PropTypes.bool,
enableAccessibleFieldDOMStructure: PropTypes.any,
fixedWeekNumber: PropTypes.number,
format: PropTypes.string,
formatDensity: PropTypes.oneOf([
"dense",
"spacious"
]),
inputRef: refType,
label: PropTypes.node,
loading: PropTypes.bool,
localeText: PropTypes.object,
maxDate: PropTypes.object,
minDate: PropTypes.object,
monthsPerRow: PropTypes.oneOf([
3,
4
]),
name: PropTypes.string,
onAccept: PropTypes.func,
onChange: PropTypes.func,
onClose: PropTypes.func,
onError: PropTypes.func,
onMonthChange: PropTypes.func,
onOpen: PropTypes.func,
onSelectedSectionsChange: PropTypes.func,
onViewChange: PropTypes.func,
onYearChange: PropTypes.func,
open: PropTypes.bool,
openTo: PropTypes.oneOf([
"day",
"month",
"year"
]),
orientation: PropTypes.oneOf([
"landscape",
"portrait"
]),
readOnly: PropTypes.bool,
reduceAnimations: PropTypes.bool,
referenceDate: PropTypes.object,
renderLoading: PropTypes.func,
selectedSections: PropTypes.oneOfType([
PropTypes.oneOf([
"all",
"day",
"empty",
"hours",
"meridiem",
"minutes",
"month",
"seconds",
"weekDay",
"year"
]),
PropTypes.number
]),
shouldDisableDate: PropTypes.func,
shouldDisableMonth: PropTypes.func,
shouldDisableYear: PropTypes.func,
showDaysOutsideCurrentMonth: PropTypes.bool,
slotProps: PropTypes.object,
slots: PropTypes.object,
sx: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.oneOfType([
PropTypes.func,
PropTypes.object,
PropTypes.bool
])),
PropTypes.func,
PropTypes.object
]),
timezone: PropTypes.string,
value: PropTypes.object,
view: PropTypes.oneOf([
"day",
"month",
"year"
]),
viewRenderers: PropTypes.shape({
day: PropTypes.func,
month: PropTypes.func,
year: PropTypes.func
}),
views: PropTypes.arrayOf(PropTypes.oneOf([
"day",
"month",
"year"
]).isRequired),
yearsOrder: PropTypes.oneOf([
"asc",
"desc"
]),
yearsPerRow: PropTypes.oneOf([
3,
4
])
};
const PickersModalDialogRoot = styled(Dialog)({
[`& .${dialogClasses.container}`]: {
outline: 0
},
[`& .${dialogClasses.paper}`]: {
outline: 0,
minWidth: DIALOG_WIDTH
}
});
const PickersModalDialogContent = styled(DialogContent)({
"&:first-of-type": {
padding: 0
}
});
function PickersModalDialog(props) {
const { children, onDismiss, open, slots, slotProps } = props;
const Dialog2 = (slots == null ? void 0 : slots.dialog) ?? PickersModalDialogRoot;
const Transition2 = (slots == null ? void 0 : slots.mobileTransition) ?? Fade;
return jsxRuntimeExports.jsx(Dialog2, _extends$1({
open,
onClose: onDismiss
}, slotProps == null ? void 0 : slotProps.dialog, {
TransitionComponent: Transition2,
TransitionProps: slotProps == null ? void 0 : slotProps.mobileTransition,
PaperComponent: slots == null ? void 0 : slots.mobilePaper,
PaperProps: slotProps == null ? void 0 : slotProps.mobilePaper,
children: jsxRuntimeExports.jsx(PickersModalDialogContent, {
children
})
}));
}
const _excluded$5 = [
"props",
"getOpenDialogAriaText"
];
const useMobilePicker = (_ref) => {
var _a;
let { props, getOpenDialogAriaText } = _ref, pickerParams = _objectWithoutPropertiesLoose$1(_ref, _excluded$5);
const { slots, slotProps: innerSlotProps, className, sx, format: format2, formatDensity, enableAccessibleFieldDOMStructure, selectedSections, onSelectedSectionsChange, timezone, name, label, inputRef, readOnly, disabled, localeText } = props;
const fieldRef = __mf_31(null);
const labelId = useId();
const isToolbarHidden = ((_a = innerSlotProps == null ? void 0 : innerSlotProps.toolbar) == null ? void 0 : _a.hidden) ?? false;
const { open, actions, layoutProps, renderCurrentView, fieldProps: pickerFieldProps, contextValue } = usePicker(_extends$1({}, pickerParams, {
props,
fieldRef,
autoFocusView: true,
additionalViewProps: {},
wrapperVariant: "mobile"
}));
const Field = slots.field;
const fieldProps = useSlotProps({
elementType: Field,
externalSlotProps: innerSlotProps == null ? void 0 : innerSlotProps.field,
additionalProps: _extends$1({}, pickerFieldProps, isToolbarHidden && {
id: labelId
}, !(disabled || readOnly) && {
onClick: actions.onOpen,
onKeyDown: onSpaceOrEnter(actions.onOpen)
}, {
readOnly: readOnly ?? true,
disabled,
className,
sx,
format: format2,
formatDensity,
enableAccessibleFieldDOMStructure,
selectedSections,
onSelectedSectionsChange,
timezone,
label,
name
}, inputRef ? {
inputRef
} : {}),
ownerState: props
});
fieldProps.inputProps = _extends$1({}, fieldProps.inputProps, {
"aria-label": getOpenDialogAriaText(pickerFieldProps.value)
});
const slotsForField = _extends$1({
textField: slots.textField
}, fieldProps.slots);
const Layout = slots.layout ?? PickersLayout;
let labelledById = labelId;
if (isToolbarHidden) {
if (label) {
labelledById = `${labelId}-label`;
} else {
labelledById = void 0;
}
}
const slotProps = _extends$1({}, innerSlotProps, {
toolbar: _extends$1({}, innerSlotProps == null ? void 0 : innerSlotProps.toolbar, {
titleId: labelId
}),
mobilePaper: _extends$1({
"aria-labelledby": labelledById
}, innerSlotProps == null ? void 0 : innerSlotProps.mobilePaper)
});
const handleFieldRef = useForkRef(fieldRef, fieldProps.unstableFieldRef);
const renderPicker = () => jsxRuntimeExports.jsxs(PickersProvider, {
contextValue,
localeText,
children: [
jsxRuntimeExports.jsx(Field, _extends$1({}, fieldProps, {
slots: slotsForField,
slotProps,
unstableFieldRef: handleFieldRef
})),
jsxRuntimeExports.jsx(PickersModalDialog, _extends$1({}, actions, {
open,
slots,
slotProps,
children: jsxRuntimeExports.jsx(Layout, _extends$1({}, layoutProps, slotProps == null ? void 0 : slotProps.layout, {
slots,
slotProps,
children: renderCurrentView()
}))
}))
]
});
return {
renderPicker
};
};
const MobileDatePicker = __mf_14$1(function MobileDatePicker2(inProps, ref) {
var _a, _b;
const translations = usePickersTranslations();
const utils = useUtils();
const defaultizedProps = useDatePickerDefaultizedProps(inProps, "MuiMobileDatePicker");
const viewRenderers = _extends$1({
day: renderDateViewCalendar,
month: renderDateViewCalendar,
year: renderDateViewCalendar
}, defaultizedProps.viewRenderers);
const props = _extends$1({}, defaultizedProps, {
viewRenderers,
format: resolveDateFormat(utils, defaultizedProps, false),
slots: _extends$1({
field: DateField
}, defaultizedProps.slots),
slotProps: _extends$1({}, defaultizedProps.slotProps, {
field: (ownerState) => {
var _a2;
return _extends$1({}, resolveComponentProps((_a2 = defaultizedProps.slotProps) == null ? void 0 : _a2.field, ownerState), extractValidationProps(defaultizedProps), {
ref
});
},
toolbar: _extends$1({
hidden: false
}, (_a = defaultizedProps.slotProps) == null ? void 0 : _a.toolbar)
})
});
const { renderPicker } = useMobilePicker({
props,
valueManager: singleItemValueManager,
valueType: "date",
getOpenDialogAriaText: buildGetOpenDialogAriaText({
utils,
formatKey: "fullDate",
contextTranslation: translations.openDatePickerDialogue,
propsTranslation: (_b = props.localeText) == null ? void 0 : _b.openDatePickerDialogue
}),
validator: validateDate
});
return renderPicker();
});
MobileDatePicker.propTypes = {
autoFocus: PropTypes.bool,
className: PropTypes.string,
closeOnSelect: PropTypes.bool,
dayOfWeekFormatter: PropTypes.func,
defaultValue: PropTypes.object,
disabled: PropTypes.bool,
disableFuture: PropTypes.bool,
disableHighlightToday: PropTypes.bool,
disableOpenPicker: PropTypes.bool,
disablePast: PropTypes.bool,
displayWeekNumber: PropTypes.bool,
enableAccessibleFieldDOMStructure: PropTypes.any,
fixedWeekNumber: PropTypes.number,
format: PropTypes.string,
formatDensity: PropTypes.oneOf([
"dense",
"spacious"
]),
inputRef: refType,
label: PropTypes.node,
loading: PropTypes.bool,
localeText: PropTypes.object,
maxDate: PropTypes.object,
minDate: PropTypes.object,
monthsPerRow: PropTypes.oneOf([
3,
4
]),
name: PropTypes.string,
onAccept: PropTypes.func,
onChange: PropTypes.func,
onClose: PropTypes.func,
onError: PropTypes.func,
onMonthChange: PropTypes.func,
onOpen: PropTypes.func,
onSelectedSectionsChange: PropTypes.func,
onViewChange: PropTypes.func,
onYearChange: PropTypes.func,
open: PropTypes.bool,
openTo: PropTypes.oneOf([
"day",
"month",
"year"
]),
orientation: PropTypes.oneOf([
"landscape",
"portrait"
]),
readOnly: PropTypes.bool,
reduceAnimations: PropTypes.bool,
referenceDate: PropTypes.object,
renderLoading: PropTypes.func,
selectedSections: PropTypes.oneOfType([
PropTypes.oneOf([
"all",
"day",
"empty",
"hours",
"meridiem",
"minutes",
"month",
"seconds",
"weekDay",
"year"
]),
PropTypes.number
]),
shouldDisableDate: PropTypes.func,
shouldDisableMonth: PropTypes.func,
shouldDisableYear: PropTypes.func,
showDaysOutsideCurrentMonth: PropTypes.bool,
slotProps: PropTypes.object,
slots: PropTypes.object,
sx: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.oneOfType([
PropTypes.func,
PropTypes.object,
PropTypes.bool
])),
PropTypes.func,
PropTypes.object
]),
timezone: PropTypes.string,
value: PropTypes.object,
view: PropTypes.oneOf([
"day",
"month",
"year"
]),
viewRenderers: PropTypes.shape({
day: PropTypes.func,
month: PropTypes.func,
year: PropTypes.func
}),
views: PropTypes.arrayOf(PropTypes.oneOf([
"day",
"month",
"year"
]).isRequired),
yearsOrder: PropTypes.oneOf([
"asc",
"desc"
]),
yearsPerRow: PropTypes.oneOf([
3,
4
])
};
const _excluded$4 = [
"desktopModeMediaQuery"
];
const DatePicker = __mf_14$1(function DatePicker2(inProps, ref) {
const props = useThemeProps({
props: inProps,
name: "MuiDatePicker"
});
const { desktopModeMediaQuery = DEFAULT_DESKTOP_MODE_MEDIA_QUERY } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$4);
const isDesktop = useMediaQuery(desktopModeMediaQuery, {
defaultMatches: true
});
if (isDesktop) {
return jsxRuntimeExports.jsx(DesktopDatePicker, _extends$1({
ref
}, other));
}
return jsxRuntimeExports.jsx(MobileDatePicker, _extends$1({
ref
}, other));
});
function getPickersToolbarTextUtilityClass(slot) {
return generateUtilityClass("MuiPickersToolbarText", slot);
}
const pickersToolbarTextClasses = generateUtilityClasses("MuiPickersToolbarText", [
"root",
"selected"
]);
const _excluded$3 = [
"className",
"selected",
"value"
];
const useUtilityClasses$2 = (ownerState) => {
const { classes, selected } = ownerState;
const slots = {
root: [
"root",
selected && "selected"
]
};
return composeClasses(slots, getPickersToolbarTextUtilityClass, classes);
};
const PickersToolbarTextRoot = styled(Typography, {
name: "MuiPickersToolbarText",
slot: "Root",
overridesResolver: (_, styles2) => [
styles2.root,
{
[`&.${pickersToolbarTextClasses.selected}`]: styles2.selected
}
]
})(({ theme }) => ({
transition: theme.transitions.create("color"),
color: (theme.vars || theme).palette.text.secondary,
[`&.${pickersToolbarTextClasses.selected}`]: {
color: (theme.vars || theme).palette.text.primary
}
}));
const PickersToolbarText = __mf_14$1(function PickersToolbarText2(inProps, ref) {
const props = useThemeProps({
props: inProps,
name: "MuiPickersToolbarText"
});
const { className, value } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$3);
const classes = useUtilityClasses$2(props);
return jsxRuntimeExports.jsx(PickersToolbarTextRoot, _extends$1({
ref,
className: clsx(classes.root, className),
component: "span"
}, other, {
children: value
}));
});
const _excluded$2 = [
"align",
"className",
"selected",
"typographyClassName",
"value",
"variant",
"width"
];
const useUtilityClasses$1 = (ownerState) => {
const { classes } = ownerState;
const slots = {
root: [
"root"
]
};
return composeClasses(slots, getPickersToolbarUtilityClass, classes);
};
const PickersToolbarButtonRoot = styled(Button, {
name: "MuiPickersToolbarButton",
slot: "Root",
overridesResolver: (_, styles2) => styles2.root
})({
padding: 0,
minWidth: 16,
textTransform: "none"
});
const PickersToolbarButton = __mf_14$1(function PickersToolbarButton2(inProps, ref) {
const props = useThemeProps({
props: inProps,
name: "MuiPickersToolbarButton"
});
const { align, className, selected, typographyClassName, value, variant, width } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$2);
const classes = useUtilityClasses$1(props);
return jsxRuntimeExports.jsx(PickersToolbarButtonRoot, _extends$1({
variant: "text",
ref,
className: clsx(classes.root, className)
}, width ? {
sx: {
width
}
} : {}, other, {
children: jsxRuntimeExports.jsx(PickersToolbarText, {
align,
className: typographyClassName,
variant,
value,
selected
})
}));
});
function getTimePickerToolbarUtilityClass(slot) {
return generateUtilityClass("MuiTimePickerToolbar", slot);
}
const timePickerToolbarClasses = generateUtilityClasses("MuiTimePickerToolbar", [
"root",
"separator",
"hourMinuteLabel",
"hourMinuteLabelLandscape",
"hourMinuteLabelReverse",
"ampmSelection",
"ampmLandscape",
"ampmLabel"
]);
const _excluded$1 = [
"ampm",
"ampmInClock",
"value",
"isLandscape",
"onChange",
"view",
"onViewChange",
"views",
"disabled",
"readOnly",
"className"
];
const useUtilityClasses = (ownerState) => {
const { isLandscape, classes, isRtl } = ownerState;
const slots = {
root: [
"root"
],
separator: [
"separator"
],
hourMinuteLabel: [
"hourMinuteLabel",
isLandscape && "hourMinuteLabelLandscape",
isRtl && "hourMinuteLabelReverse"
],
ampmSelection: [
"ampmSelection",
isLandscape && "ampmLandscape"
],
ampmLabel: [
"ampmLabel"
]
};
return composeClasses(slots, getTimePickerToolbarUtilityClass, classes);
};
const TimePickerToolbarRoot = styled(PickersToolbar, {
name: "MuiTimePickerToolbar",
slot: "Root",
overridesResolver: (props, styles2) => styles2.root
})({});
const TimePickerToolbarSeparator = styled(PickersToolbarText, {
name: "MuiTimePickerToolbar",
slot: "Separator",
overridesResolver: (props, styles2) => styles2.separator
})({
outline: 0,
margin: "0 4px 0 2px",
cursor: "default"
});
const TimePickerToolbarHourMinuteLabel = styled("div", {
name: "MuiTimePickerToolbar",
slot: "HourMinuteLabel",
overridesResolver: (props, styles2) => [
{
[`&.${timePickerToolbarClasses.hourMinuteLabelLandscape}`]: styles2.hourMinuteLabelLandscape,
[`&.${timePickerToolbarClasses.hourMinuteLabelReverse}`]: styles2.hourMinuteLabelReverse
},
styles2.hourMinuteLabel
]
})({
display: "flex",
justifyContent: "flex-end",
alignItems: "flex-end",
variants: [
{
props: {
isRtl: true
},
style: {
flexDirection: "row-reverse"
}
},
{
props: {
isLandscape: true
},
style: {
marginTop: "auto"
}
}
]
});
const TimePickerToolbarAmPmSelection = styled("div", {
name: "MuiTimePickerToolbar",
slot: "AmPmSelection",
overridesResolver: (props, styles2) => [
{
[`.${timePickerToolbarClasses.ampmLabel}`]: styles2.ampmLabel
},
{
[`&.${timePickerToolbarClasses.ampmLandscape}`]: styles2.ampmLandscape
},
styles2.ampmSelection
]
})({
display: "flex",
flexDirection: "column",
marginRight: "auto",
marginLeft: 12,
[`& .${timePickerToolbarClasses.ampmLabel}`]: {
fontSize: 17
},
variants: [
{
props: {
isLandscape: true
},
style: {
margin: "4px 0 auto",
flexDirection: "row",
justifyContent: "space-around",
flexBasis: "100%"
}
}
]
});
function TimePickerToolbar(inProps) {
const props = useThemeProps({
props: inProps,
name: "MuiTimePickerToolbar"
});
const { ampm, ampmInClock, value, isLandscape, onChange, view, onViewChange, views, disabled, readOnly, className } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded$1);
const utils = useUtils();
const translations = usePickersTranslations();
const isRtl = useRtl();
const showAmPmControl = Boolean(ampm && !ampmInClock && views.includes("hours"));
const { meridiemMode, handleMeridiemChange } = useMeridiemMode(value, ampm, onChange);
const formatHours = (time) => ampm ? utils.format(time, "hours12h") : utils.format(time, "hours24h");
const ownerState = _extends$1({}, props, {
isRtl
});
const classes = useUtilityClasses(ownerState);
const separator = jsxRuntimeExports.jsx(TimePickerToolbarSeparator, {
tabIndex: -1,
value: ":",
variant: "h3",
selected: false,
className: classes.separator
});
return jsxRuntimeExports.jsxs(TimePickerToolbarRoot, _extends$1({
landscapeDirection: "row",
toolbarTitle: translations.timePickerToolbarTitle,
isLandscape,
ownerState,
className: clsx(classes.root, className)
}, other, {
children: [
jsxRuntimeExports.jsxs(TimePickerToolbarHourMinuteLabel, {
className: classes.hourMinuteLabel,
ownerState,
children: [
arrayIncludes(views, "hours") && jsxRuntimeExports.jsx(PickersToolbarButton, {
tabIndex: -1,
variant: "h3",
onClick: () => onViewChange("hours"),
selected: view === "hours",
value: value ? formatHours(value) : "--"
}),
arrayIncludes(views, [
"hours",
"minutes"
]) && separator,
arrayIncludes(views, "minutes") && jsxRuntimeExports.jsx(PickersToolbarButton, {
tabIndex: -1,
variant: "h3",
onClick: () => onViewChange("minutes"),
selected: view === "minutes",
value: value ? utils.format(value, "minutes") : "--"
}),
arrayIncludes(views, [
"minutes",
"seconds"
]) && separator,
arrayIncludes(views, "seconds") && jsxRuntimeExports.jsx(PickersToolbarButton, {
variant: "h3",
onClick: () => onViewChange("seconds"),
selected: view === "seconds",
value: value ? utils.format(value, "seconds") : "--"
})
]
}),
showAmPmControl && jsxRuntimeExports.jsxs(TimePickerToolbarAmPmSelection, {
className: classes.ampmSelection,
ownerState,
children: [
jsxRuntimeExports.jsx(PickersToolbarButton, {
disableRipple: true,
variant: "subtitle2",
selected: meridiemMode === "am",
typographyClassName: classes.ampmLabel,
value: formatMeridiem(utils, "am"),
onClick: readOnly ? void 0 : () => handleMeridiemChange("am"),
disabled
}),
jsxRuntimeExports.jsx(PickersToolbarButton, {
disableRipple: true,
variant: "subtitle2",
selected: meridiemMode === "pm",
typographyClassName: classes.ampmLabel,
value: formatMeridiem(utils, "pm"),
onClick: readOnly ? void 0 : () => handleMeridiemChange("pm"),
disabled
})
]
})
]
}));
}
function useTimePickerDefaultizedProps(props, name) {
var _a;
const utils = useUtils();
const themeProps = useThemeProps({
props,
name
});
const ampm = themeProps.ampm ?? utils.is12HourCycleInCurrentLocale();
const localeText = __mf_29(() => {
var _a2;
if (((_a2 = themeProps.localeText) == null ? void 0 : _a2.toolbarTitle) == null) {
return themeProps.localeText;
}
return _extends$1({}, themeProps.localeText, {
timePickerToolbarTitle: themeProps.localeText.toolbarTitle
});
}, [
themeProps.localeText
]);
return _extends$1({}, themeProps, {
ampm,
localeText
}, applyDefaultViewProps({
views: themeProps.views,
openTo: themeProps.openTo,
defaultViews: [
"hours",
"minutes"
],
defaultOpenTo: "hours"
}), {
disableFuture: themeProps.disableFuture ?? false,
disablePast: themeProps.disablePast ?? false,
slots: _extends$1({
toolbar: TimePickerToolbar
}, themeProps.slots),
slotProps: _extends$1({}, themeProps.slotProps, {
toolbar: _extends$1({
ampm,
ampmInClock: themeProps.ampmInClock
}, (_a = themeProps.slotProps) == null ? void 0 : _a.toolbar)
})
});
}
const renderTimeViewClock = ({ view, onViewChange, focusedView, onFocusedViewChange, views, value, defaultValue, referenceDate, onChange, className, classes, disableFuture, disablePast, minTime, maxTime, shouldDisableTime, minutesStep, ampm, ampmInClock, slots, slotProps, readOnly, disabled, sx, autoFocus, showViewSwitcher, disableIgnoringDatePartForTimeValidation, timezone }) => jsxRuntimeExports.jsx(TimeClock, {
view,
onViewChange,
focusedView: focusedView && isTimeView(focusedView) ? focusedView : null,
onFocusedViewChange,
views: views.filter(isTimeView),
value,
defaultValue,
referenceDate,
onChange,
className,
classes,
disableFuture,
disablePast,
minTime,
maxTime,
shouldDisableTime,
minutesStep,
ampm,
ampmInClock,
slots,
slotProps,
readOnly,
disabled,
sx,
autoFocus,
showViewSwitcher,
disableIgnoringDatePartForTimeValidation,
timezone
});
const renderDigitalClockTimeView = ({ view, onViewChange, focusedView, onFocusedViewChange, views, value, defaultValue, referenceDate, onChange, className, classes, disableFuture, disablePast, minTime, maxTime, shouldDisableTime, minutesStep, ampm, slots, slotProps, readOnly, disabled, sx, autoFocus, disableIgnoringDatePartForTimeValidation, timeSteps, skipDisabled, timezone }) => jsxRuntimeExports.jsx(DigitalClock, {
view,
onViewChange,
focusedView,
onFocusedViewChange,
views: views.filter(isTimeView),
value,
defaultValue,
referenceDate,
onChange,
className,
classes,
disableFuture,
disablePast,
minTime,
maxTime,
shouldDisableTime,
minutesStep,
ampm,
slots,
slotProps,
readOnly,
disabled,
sx,
autoFocus,
disableIgnoringDatePartForTimeValidation,
timeStep: timeSteps == null ? void 0 : timeSteps.minutes,
skipDisabled,
timezone
});
const renderMultiSectionDigitalClockTimeView = ({ view, onViewChange, focusedView, onFocusedViewChange, views, value, defaultValue, referenceDate, onChange, className, classes, disableFuture, disablePast, minTime, maxTime, shouldDisableTime, minutesStep, ampm, slots, slotProps, readOnly, disabled, sx, autoFocus, disableIgnoringDatePartForTimeValidation, timeSteps, skipDisabled, timezone }) => jsxRuntimeExports.jsx(MultiSectionDigitalClock, {
view,
onViewChange,
focusedView,
onFocusedViewChange,
views: views.filter(isTimeView),
value,
defaultValue,
referenceDate,
onChange,
className,
classes,
disableFuture,
disablePast,
minTime,
maxTime,
shouldDisableTime,
minutesStep,
ampm,
slots,
slotProps,
readOnly,
disabled,
sx,
autoFocus,
disableIgnoringDatePartForTimeValidation,
timeSteps,
skipDisabled,
timezone
});
const resolveViews = (ampm, views, shouldUseSingleColumn) => {
if (shouldUseSingleColumn) {
return views.filter((view) => !isInternalTimeView(view) || view === "hours");
}
return ampm ? [
...views,
"meridiem"
] : views;
};
const resolveShouldRenderTimeInASingleColumn = (timeSteps, threshold) => 24 * 60 / ((timeSteps.hours ?? 1) * (timeSteps.minutes ?? 5)) <= threshold;
function resolveTimeViewsResponse({ thresholdToRenderTimeInASingleColumn: inThreshold, ampm, timeSteps: inTimeSteps, views }) {
const thresholdToRenderTimeInASingleColumn = inThreshold ?? 24;
const timeSteps = _extends$1({
hours: 1,
minutes: 5,
seconds: 5
}, inTimeSteps);
const shouldRenderTimeInASingleColumn = resolveShouldRenderTimeInASingleColumn(timeSteps, thresholdToRenderTimeInASingleColumn);
return {
thresholdToRenderTimeInASingleColumn,
timeSteps,
shouldRenderTimeInASingleColumn,
views: resolveViews(ampm, views, shouldRenderTimeInASingleColumn)
};
}
const DesktopTimePicker = __mf_14$1(function DesktopTimePicker2(inProps, ref) {
var _a, _b, _c, _d;
const translations = usePickersTranslations();
const utils = useUtils();
const defaultizedProps = useTimePickerDefaultizedProps(inProps, "MuiDesktopTimePicker");
const { shouldRenderTimeInASingleColumn, views: resolvedViews, timeSteps } = resolveTimeViewsResponse(defaultizedProps);
const renderTimeView = shouldRenderTimeInASingleColumn ? renderDigitalClockTimeView : renderMultiSectionDigitalClockTimeView;
const viewRenderers = _extends$1({
hours: renderTimeView,
minutes: renderTimeView,
seconds: renderTimeView,
meridiem: renderTimeView
}, defaultizedProps.viewRenderers);
const ampmInClock = defaultizedProps.ampmInClock ?? true;
const actionBarActions = shouldRenderTimeInASingleColumn ? [] : [
"accept"
];
const shouldHoursRendererContainMeridiemView = ((_a = viewRenderers.hours) == null ? void 0 : _a.name) === renderMultiSectionDigitalClockTimeView.name;
const views = !shouldHoursRendererContainMeridiemView ? resolvedViews.filter((view) => view !== "meridiem") : resolvedViews;
const props = _extends$1({}, defaultizedProps, {
ampmInClock,
timeSteps,
viewRenderers,
format: resolveTimeFormat(utils, defaultizedProps),
views: shouldRenderTimeInASingleColumn ? [
"hours"
] : views,
slots: _extends$1({
field: TimeField,
openPickerIcon: ClockIcon
}, defaultizedProps.slots),
slotProps: _extends$1({}, defaultizedProps.slotProps, {
field: (ownerState) => {
var _a2;
return _extends$1({}, resolveComponentProps((_a2 = defaultizedProps.slotProps) == null ? void 0 : _a2.field, ownerState), extractValidationProps(defaultizedProps), {
ref
});
},
toolbar: _extends$1({
hidden: true,
ampmInClock
}, (_b = defaultizedProps.slotProps) == null ? void 0 : _b.toolbar),
actionBar: _extends$1({
actions: actionBarActions
}, (_c = defaultizedProps.slotProps) == null ? void 0 : _c.actionBar)
})
});
const { renderPicker } = useDesktopPicker({
props,
valueManager: singleItemValueManager,
valueType: "time",
getOpenDialogAriaText: buildGetOpenDialogAriaText({
utils,
formatKey: "fullTime",
contextTranslation: translations.openTimePickerDialogue,
propsTranslation: (_d = props.localeText) == null ? void 0 : _d.openTimePickerDialogue
}),
validator: validateTime
});
return renderPicker();
});
DesktopTimePicker.propTypes = {
ampm: PropTypes.bool,
ampmInClock: PropTypes.bool,
autoFocus: PropTypes.bool,
className: PropTypes.string,
closeOnSelect: PropTypes.bool,
defaultValue: PropTypes.object,
disabled: PropTypes.bool,
disableFuture: PropTypes.bool,
disableIgnoringDatePartForTimeValidation: PropTypes.bool,
disableOpenPicker: PropTypes.bool,
disablePast: PropTypes.bool,
enableAccessibleFieldDOMStructure: PropTypes.any,
format: PropTypes.string,
formatDensity: PropTypes.oneOf([
"dense",
"spacious"
]),
inputRef: refType,
label: PropTypes.node,
localeText: PropTypes.object,
maxTime: PropTypes.object,
minTime: PropTypes.object,
minutesStep: PropTypes.number,
name: PropTypes.string,
onAccept: PropTypes.func,
onChange: PropTypes.func,
onClose: PropTypes.func,
onError: PropTypes.func,
onOpen: PropTypes.func,
onSelectedSectionsChange: PropTypes.func,
onViewChange: PropTypes.func,
open: PropTypes.bool,
openTo: PropTypes.oneOf([
"hours",
"meridiem",
"minutes",
"seconds"
]),
orientation: PropTypes.oneOf([
"landscape",
"portrait"
]),
readOnly: PropTypes.bool,
reduceAnimations: PropTypes.bool,
referenceDate: PropTypes.object,
selectedSections: PropTypes.oneOfType([
PropTypes.oneOf([
"all",
"day",
"empty",
"hours",
"meridiem",
"minutes",
"month",
"seconds",
"weekDay",
"year"
]),
PropTypes.number
]),
shouldDisableTime: PropTypes.func,
skipDisabled: PropTypes.bool,
slotProps: PropTypes.object,
slots: PropTypes.object,
sx: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.oneOfType([
PropTypes.func,
PropTypes.object,
PropTypes.bool
])),
PropTypes.func,
PropTypes.object
]),
thresholdToRenderTimeInASingleColumn: PropTypes.number,
timeSteps: PropTypes.shape({
hours: PropTypes.number,
minutes: PropTypes.number,
seconds: PropTypes.number
}),
timezone: PropTypes.string,
value: PropTypes.object,
view: PropTypes.oneOf([
"hours",
"meridiem",
"minutes",
"seconds"
]),
viewRenderers: PropTypes.shape({
hours: PropTypes.func,
meridiem: PropTypes.func,
minutes: PropTypes.func,
seconds: PropTypes.func
}),
views: PropTypes.arrayOf(PropTypes.oneOf([
"hours",
"minutes",
"seconds"
]).isRequired)
};
const MobileTimePicker = __mf_14$1(function MobileTimePicker2(inProps, ref) {
var _a, _b;
const translations = usePickersTranslations();
const utils = useUtils();
const defaultizedProps = useTimePickerDefaultizedProps(inProps, "MuiMobileTimePicker");
const viewRenderers = _extends$1({
hours: renderTimeViewClock,
minutes: renderTimeViewClock,
seconds: renderTimeViewClock
}, defaultizedProps.viewRenderers);
const ampmInClock = defaultizedProps.ampmInClock ?? false;
const props = _extends$1({}, defaultizedProps, {
ampmInClock,
viewRenderers,
format: resolveTimeFormat(utils, defaultizedProps),
slots: _extends$1({
field: TimeField
}, defaultizedProps.slots),
slotProps: _extends$1({}, defaultizedProps.slotProps, {
field: (ownerState) => {
var _a2;
return _extends$1({}, resolveComponentProps((_a2 = defaultizedProps.slotProps) == null ? void 0 : _a2.field, ownerState), extractValidationProps(defaultizedProps), {
ref
});
},
toolbar: _extends$1({
hidden: false,
ampmInClock
}, (_a = defaultizedProps.slotProps) == null ? void 0 : _a.toolbar)
})
});
const { renderPicker } = useMobilePicker({
props,
valueManager: singleItemValueManager,
valueType: "time",
getOpenDialogAriaText: buildGetOpenDialogAriaText({
utils,
formatKey: "fullTime",
contextTranslation: translations.openTimePickerDialogue,
propsTranslation: (_b = props.localeText) == null ? void 0 : _b.openTimePickerDialogue
}),
validator: validateTime
});
return renderPicker();
});
MobileTimePicker.propTypes = {
ampm: PropTypes.bool,
ampmInClock: PropTypes.bool,
autoFocus: PropTypes.bool,
className: PropTypes.string,
closeOnSelect: PropTypes.bool,
defaultValue: PropTypes.object,
disabled: PropTypes.bool,
disableFuture: PropTypes.bool,
disableIgnoringDatePartForTimeValidation: PropTypes.bool,
disableOpenPicker: PropTypes.bool,
disablePast: PropTypes.bool,
enableAccessibleFieldDOMStructure: PropTypes.any,
format: PropTypes.string,
formatDensity: PropTypes.oneOf([
"dense",
"spacious"
]),
inputRef: refType,
label: PropTypes.node,
localeText: PropTypes.object,
maxTime: PropTypes.object,
minTime: PropTypes.object,
minutesStep: PropTypes.number,
name: PropTypes.string,
onAccept: PropTypes.func,
onChange: PropTypes.func,
onClose: PropTypes.func,
onError: PropTypes.func,
onOpen: PropTypes.func,
onSelectedSectionsChange: PropTypes.func,
onViewChange: PropTypes.func,
open: PropTypes.bool,
openTo: PropTypes.oneOf([
"hours",
"minutes",
"seconds"
]),
orientation: PropTypes.oneOf([
"landscape",
"portrait"
]),
readOnly: PropTypes.bool,
reduceAnimations: PropTypes.bool,
referenceDate: PropTypes.object,
selectedSections: PropTypes.oneOfType([
PropTypes.oneOf([
"all",
"day",
"empty",
"hours",
"meridiem",
"minutes",
"month",
"seconds",
"weekDay",
"year"
]),
PropTypes.number
]),
shouldDisableTime: PropTypes.func,
slotProps: PropTypes.object,
slots: PropTypes.object,
sx: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.oneOfType([
PropTypes.func,
PropTypes.object,
PropTypes.bool
])),
PropTypes.func,
PropTypes.object
]),
timezone: PropTypes.string,
value: PropTypes.object,
view: PropTypes.oneOf([
"hours",
"minutes",
"seconds"
]),
viewRenderers: PropTypes.shape({
hours: PropTypes.func,
minutes: PropTypes.func,
seconds: PropTypes.func
}),
views: PropTypes.arrayOf(PropTypes.oneOf([
"hours",
"minutes",
"seconds"
]).isRequired)
};
const _excluded = [
"desktopModeMediaQuery"
];
const TimePicker = __mf_14$1(function TimePicker2(inProps, ref) {
const props = useThemeProps({
props: inProps,
name: "MuiTimePicker"
});
const { desktopModeMediaQuery = DEFAULT_DESKTOP_MODE_MEDIA_QUERY } = props, other = _objectWithoutPropertiesLoose$1(props, _excluded);
const isDesktop = useMediaQuery(desktopModeMediaQuery, {
defaultMatches: true
});
if (isDesktop) {
return jsxRuntimeExports.jsx(DesktopTimePicker, _extends$1({
ref
}, other));
}
return jsxRuntimeExports.jsx(MobileTimePicker, _extends$1({
ref
}, other));
});
var weekOfYear$1 = {
exports: {}
};
var weekOfYear = weekOfYear$1.exports;
(function(module2, exports$1) {
!(function(e, t) {
module2.exports = t();
})(weekOfYear, (function() {
var e = "week", t = "year";
return function(i, n, r) {
var f = n.prototype;
f.week = function(i2) {
if (void 0 === i2 && (i2 = null), null !== i2) return this.add(7 * (i2 - this.week()), "day");
var n2 = this.$locale().yearStart || 1;
if (11 === this.month() && this.date() > 25) {
var f2 = r(this).startOf(t).add(1, t).date(n2), s = r(this).endOf(e);
if (f2.isBefore(s)) return 1;
}
var a = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o = this.diff(a, e, true);
return o < 0 ? r(this).startOf("week").week() : Math.ceil(o);
}, f.weeks = function(e2) {
return void 0 === e2 && (e2 = null), this.week(e2);
};
};
}));
})(weekOfYear$1);
var weekOfYearExports = weekOfYear$1.exports;
const weekOfYearPlugin = getDefaultExportFromCjs(weekOfYearExports);
var customParseFormat$1 = {
exports: {}
};
var customParseFormat = customParseFormat$1.exports;
(function(module2, exports$1) {
!(function(e, t) {
module2.exports = t();
})(customParseFormat, (function() {
var e = {
LTS: "h:mm:ss A",
LT: "h:mm A",
L: "MM/DD/YYYY",
LL: "MMMM D, YYYY",
LLL: "MMMM D, YYYY h:mm A",
LLLL: "dddd, MMMM D, YYYY h:mm A"
}, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d/, r = /\d\d/, i = /\d\d?/, o = /\d*[^-_:/,()\s\d]+/, s = {}, a = function(e2) {
return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
};
var f = function(e2) {
return function(t2) {
this[e2] = +t2;
};
}, h = [
/[+-]\d\d:?(\d\d)?|Z/,
function(e2) {
(this.zone || (this.zone = {})).offset = (function(e3) {
if (!e3) return 0;
if ("Z" === e3) return 0;
var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
return 0 === n2 ? 0 : "+" === t2[0] ? -n2 : n2;
})(e2);
}
], u = function(e2) {
var t2 = s[e2];
return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
}, d = function(e2, t2) {
var n2, r2 = s.meridiem;
if (r2) {
for (var i2 = 1; i2 <= 24; i2 += 1) if (e2.indexOf(r2(i2, 0, t2)) > -1) {
n2 = i2 > 12;
break;
}
} else n2 = e2 === (t2 ? "pm" : "PM");
return n2;
}, c = {
A: [
o,
function(e2) {
this.afternoon = d(e2, false);
}
],
a: [
o,
function(e2) {
this.afternoon = d(e2, true);
}
],
Q: [
n,
function(e2) {
this.month = 3 * (e2 - 1) + 1;
}
],
S: [
n,
function(e2) {
this.milliseconds = 100 * +e2;
}
],
SS: [
r,
function(e2) {
this.milliseconds = 10 * +e2;
}
],
SSS: [
/\d{3}/,
function(e2) {
this.milliseconds = +e2;
}
],
s: [
i,
f("seconds")
],
ss: [
i,
f("seconds")
],
m: [
i,
f("minutes")
],
mm: [
i,
f("minutes")
],
H: [
i,
f("hours")
],
h: [
i,
f("hours")
],
HH: [
i,
f("hours")
],
hh: [
i,
f("hours")
],
D: [
i,
f("day")
],
DD: [
r,
f("day")
],
Do: [
o,
function(e2) {
var t2 = s.ordinal, n2 = e2.match(/\d+/);
if (this.day = n2[0], t2) for (var r2 = 1; r2 <= 31; r2 += 1) t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
}
],
w: [
i,
f("week")
],
ww: [
r,
f("week")
],
M: [
i,
f("month")
],
MM: [
r,
f("month")
],
MMM: [
o,
function(e2) {
var t2 = u("months"), n2 = (u("monthsShort") || t2.map((function(e3) {
return e3.slice(0, 3);
}))).indexOf(e2) + 1;
if (n2 < 1) throw new Error();
this.month = n2 % 12 || n2;
}
],
MMMM: [
o,
function(e2) {
var t2 = u("months").indexOf(e2) + 1;
if (t2 < 1) throw new Error();
this.month = t2 % 12 || t2;
}
],
Y: [
/[+-]?\d+/,
f("year")
],
YY: [
r,
function(e2) {
this.year = a(e2);
}
],
YYYY: [
/\d{4}/,
f("year")
],
Z: h,
ZZ: h
};
function l(n2) {
var r2, i2;
r2 = n2, i2 = s && s.formats;
for (var o2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(t2, n3, r3) {
var o3 = r3 && r3.toUpperCase();
return n3 || i2[r3] || e[r3] || i2[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(e2, t3, n4) {
return t3 || n4.slice(1);
}));
}))).match(t), a2 = o2.length, f2 = 0; f2 < a2; f2 += 1) {
var h2 = o2[f2], u2 = c[h2], d2 = u2 && u2[0], l2 = u2 && u2[1];
o2[f2] = l2 ? {
regex: d2,
parser: l2
} : h2.replace(/^\[|\]$/g, "");
}
return function(e2) {
for (var t2 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) {
var i3 = o2[n3];
if ("string" == typeof i3) r3 += i3.length;
else {
var s2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = s2.exec(h3)[0];
f3.call(t2, u3), e2 = e2.replace(u3, "");
}
}
return (function(e3) {
var t3 = e3.afternoon;
if (void 0 !== t3) {
var n4 = e3.hours;
t3 ? n4 < 12 && (e3.hours += 12) : 12 === n4 && (e3.hours = 0), delete e3.afternoon;
}
})(t2), t2;
};
}
return function(e2, t2, n2) {
n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (a = e2.parseTwoDigitYear);
var r2 = t2.prototype, i2 = r2.parse;
r2.parse = function(e3) {
var t3 = e3.date, r3 = e3.utc, o2 = e3.args;
this.$u = r3;
var a2 = o2[1];
if ("string" == typeof a2) {
var f2 = true === o2[2], h2 = true === o2[3], u2 = f2 || h2, d2 = o2[2];
h2 && (d2 = o2[2]), s = this.$locale(), !f2 && d2 && (s = n2.Ls[d2]), this.$d = (function(e4, t4, n3, r4) {
try {
if ([
"x",
"X"
].indexOf(t4) > -1) return new Date(("X" === t4 ? 1e3 : 1) * e4);
var i3 = l(t4)(e4), o3 = i3.year, s2 = i3.month, a3 = i3.day, f3 = i3.hours, h3 = i3.minutes, u3 = i3.seconds, d3 = i3.milliseconds, c3 = i3.zone, m2 = i3.week, M2 = /* @__PURE__ */ new Date(), Y = a3 || (o3 || s2 ? 1 : M2.getDate()), p = o3 || M2.getFullYear(), v = 0;
o3 && !s2 || (v = s2 > 0 ? s2 - 1 : M2.getMonth());
var D, w = f3 || 0, g = h3 || 0, y = u3 || 0, L = d3 || 0;
return c3 ? new Date(Date.UTC(p, v, Y, w, g, y, L + 60 * c3.offset * 1e3)) : n3 ? new Date(Date.UTC(p, v, Y, w, g, y, L)) : (D = new Date(p, v, Y, w, g, y, L), m2 && (D = r4(D).week(m2).toDate()), D);
} catch (e5) {
return /* @__PURE__ */ new Date("");
}
})(t3, a2, r3, n2), this.init(), d2 && true !== d2 && (this.$L = this.locale(d2).$L), u2 && t3 != this.format(a2) && (this.$d = /* @__PURE__ */ new Date("")), s = {};
} else if (a2 instanceof Array) for (var c2 = a2.length, m = 1; m <= c2; m += 1) {
o2[1] = a2[m - 1];
var M = n2.apply(this, o2);
if (M.isValid()) {
this.$d = M.$d, this.$L = M.$L, this.init();
break;
}
m === c2 && (this.$d = /* @__PURE__ */ new Date(""));
}
else i2.call(this, e3);
};
};
}));
})(customParseFormat$1);
var customParseFormatExports = customParseFormat$1.exports;
const customParseFormatPlugin = getDefaultExportFromCjs(customParseFormatExports);
var localizedFormat$1 = {
exports: {}
};
var localizedFormat = localizedFormat$1.exports;
(function(module2, exports$1) {
!(function(e, t) {
module2.exports = t();
})(localizedFormat, (function() {
var e = {
LTS: "h:mm:ss A",
LT: "h:mm A",
L: "MM/DD/YYYY",
LL: "MMMM D, YYYY",
LLL: "MMMM D, YYYY h:mm A",
LLLL: "dddd, MMMM D, YYYY h:mm A"
};
return function(t, o, n) {
var r = o.prototype, i = r.format;
n.en.formats = e, r.format = function(t2) {
void 0 === t2 && (t2 = "YYYY-MM-DDTHH:mm:ssZ");
var o2 = this.$locale().formats, n2 = (function(t3, o3) {
return t3.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(t4, n3, r2) {
var i2 = r2 && r2.toUpperCase();
return n3 || o3[r2] || e[r2] || o3[i2].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(e2, t5, o4) {
return t5 || o4.slice(1);
}));
}));
})(t2, void 0 === o2 ? {} : o2);
return i.call(this, n2);
};
};
}));
})(localizedFormat$1);
var localizedFormatExports = localizedFormat$1.exports;
const localizedFormatPlugin = getDefaultExportFromCjs(localizedFormatExports);
var isBetween$1 = {
exports: {}
};
var isBetween = isBetween$1.exports;
(function(module2, exports$1) {
!(function(e, i) {
module2.exports = i();
})(isBetween, (function() {
return function(e, i, t) {
i.prototype.isBetween = function(e2, i2, s, f) {
var n = t(e2), o = t(i2), r = "(" === (f = f || "()")[0], u = ")" === f[1];
return (r ? this.isAfter(n, s) : !this.isBefore(n, s)) && (u ? this.isBefore(o, s) : !this.isAfter(o, s)) || (r ? this.isBefore(n, s) : !this.isAfter(n, s)) && (u ? this.isAfter(o, s) : !this.isBefore(o, s));
};
};
}));
})(isBetween$1);
var isBetweenExports = isBetween$1.exports;
const isBetweenPlugin = getDefaultExportFromCjs(isBetweenExports);
var advancedFormat$1 = {
exports: {}
};
var advancedFormat = advancedFormat$1.exports;
(function(module2, exports$1) {
!(function(e, t) {
module2.exports = t();
})(advancedFormat, (function() {
return function(e, t) {
var r = t.prototype, n = r.format;
r.format = function(e2) {
var t2 = this, r2 = this.$locale();
if (!this.isValid()) return n.bind(this)(e2);
var s = this.$utils(), a = (e2 || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, (function(e3) {
switch (e3) {
case "Q":
return Math.ceil((t2.$M + 1) / 3);
case "Do":
return r2.ordinal(t2.$D);
case "gggg":
return t2.weekYear();
case "GGGG":
return t2.isoWeekYear();
case "wo":
return r2.ordinal(t2.week(), "W");
case "w":
case "ww":
return s.s(t2.week(), "w" === e3 ? 1 : 2, "0");
case "W":
case "WW":
return s.s(t2.isoWeek(), "W" === e3 ? 1 : 2, "0");
case "k":
case "kk":
return s.s(String(0 === t2.$H ? 24 : t2.$H), "k" === e3 ? 1 : 2, "0");
case "X":
return Math.floor(t2.$d.getTime() / 1e3);
case "x":
return t2.$d.getTime();
case "z":
return "[" + t2.offsetName() + "]";
case "zzz":
return "[" + t2.offsetName("long") + "]";
default:
return e3;
}
}));
return n.bind(this)(a);
};
};
}));
})(advancedFormat$1);
var advancedFormatExports = advancedFormat$1.exports;
const advancedFormatPlugin = getDefaultExportFromCjs(advancedFormatExports);
dayjs.extend(localizedFormatPlugin);
dayjs.extend(weekOfYearPlugin);
dayjs.extend(isBetweenPlugin);
dayjs.extend(advancedFormatPlugin);
const formatTokenMap = {
YY: "year",
YYYY: {
sectionType: "year",
contentType: "digit",
maxLength: 4
},
M: {
sectionType: "month",
contentType: "digit",
maxLength: 2
},
MM: "month",
MMM: {
sectionType: "month",
contentType: "letter"
},
MMMM: {
sectionType: "month",
contentType: "letter"
},
D: {
sectionType: "day",
contentType: "digit",
maxLength: 2
},
DD: "day",
Do: {
sectionType: "day",
contentType: "digit-with-letter"
},
d: {
sectionType: "weekDay",
contentType: "digit",
maxLength: 2
},
dd: {
sectionType: "weekDay",
contentType: "letter"
},
ddd: {
sectionType: "weekDay",
contentType: "letter"
},
dddd: {
sectionType: "weekDay",
contentType: "letter"
},
A: "meridiem",
a: "meridiem",
H: {
sectionType: "hours",
contentType: "digit",
maxLength: 2
},
HH: "hours",
h: {
sectionType: "hours",
contentType: "digit",
maxLength: 2
},
hh: "hours",
m: {
sectionType: "minutes",
contentType: "digit",
maxLength: 2
},
mm: "minutes",
s: {
sectionType: "seconds",
contentType: "digit",
maxLength: 2
},
ss: "seconds"
};
const defaultFormats = {
year: "YYYY",
month: "MMMM",
monthShort: "MMM",
dayOfMonth: "D",
dayOfMonthFull: "Do",
weekday: "dddd",
weekdayShort: "dd",
hours24h: "HH",
hours12h: "hh",
meridiem: "A",
minutes: "mm",
seconds: "ss",
fullDate: "ll",
keyboardDate: "L",
shortDate: "MMM D",
normalDate: "D MMMM",
normalDateWithWeekday: "ddd, MMM D",
fullTime: "LT",
fullTime12h: "hh:mm A",
fullTime24h: "HH:mm",
keyboardDateTime: "L LT",
keyboardDateTime12h: "L hh:mm A",
keyboardDateTime24h: "L HH:mm"
};
const MISSING_UTC_PLUGIN = [
"Missing UTC plugin",
"To be able to use UTC or timezones, you have to enable the `utc` plugin",
"Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-utc"
].join("\n");
const MISSING_TIMEZONE_PLUGIN = [
"Missing timezone plugin",
"To be able to use timezones, you have to enable both the `utc` and the `timezone` plugin",
"Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-timezone"
].join("\n");
const withLocale = (dayjs2, locale2) => !locale2 ? dayjs2 : (...args) => dayjs2(...args).locale(locale2);
class AdapterDayjs {
constructor({ locale: _locale, formats } = {}) {
this.isMUIAdapter = true;
this.isTimezoneCompatible = true;
this.lib = "dayjs";
this.dayjs = void 0;
this.locale = void 0;
this.formats = void 0;
this.escapedCharacters = {
start: "[",
end: "]"
};
this.formatTokenMap = formatTokenMap;
this.setLocaleToValue = (value) => {
const expectedLocale = this.getCurrentLocaleCode();
if (expectedLocale === value.locale()) {
return value;
}
return value.locale(expectedLocale);
};
this.hasUTCPlugin = () => typeof dayjs.utc !== "undefined";
this.hasTimezonePlugin = () => typeof dayjs.tz !== "undefined";
this.isSame = (value, comparing, comparisonTemplate) => {
const comparingInValueTimezone = this.setTimezone(comparing, this.getTimezone(value));
return value.format(comparisonTemplate) === comparingInValueTimezone.format(comparisonTemplate);
};
this.cleanTimezone = (timezone) => {
switch (timezone) {
case "default": {
return void 0;
}
case "system": {
return dayjs.tz.guess();
}
default: {
return timezone;
}
}
};
this.createSystemDate = (value) => {
if (this.hasUTCPlugin() && this.hasTimezonePlugin()) {
const timezone = dayjs.tz.guess();
if (timezone !== "UTC") {
return dayjs.tz(value, timezone);
}
return dayjs(value);
}
return dayjs(value);
};
this.createUTCDate = (value) => {
if (!this.hasUTCPlugin()) {
throw new Error(MISSING_UTC_PLUGIN);
}
return dayjs.utc(value);
};
this.createTZDate = (value, timezone) => {
if (!this.hasUTCPlugin()) {
throw new Error(MISSING_UTC_PLUGIN);
}
if (!this.hasTimezonePlugin()) {
throw new Error(MISSING_TIMEZONE_PLUGIN);
}
const keepLocalTime = value !== void 0 && !value.endsWith("Z");
return dayjs(value).tz(this.cleanTimezone(timezone), keepLocalTime);
};
this.getLocaleFormats = () => {
const locales2 = dayjs.Ls;
const locale2 = this.locale || "en";
let localeObject = locales2[locale2];
if (localeObject === void 0) {
localeObject = locales2.en;
}
return localeObject.formats;
};
this.adjustOffset = (value) => {
if (!this.hasTimezonePlugin()) {
return value;
}
const timezone = this.getTimezone(value);
if (timezone !== "UTC") {
const fixedValue = value.tz(this.cleanTimezone(timezone), true);
if (fixedValue.$offset === (value.$offset ?? 0)) {
return value;
}
value.$offset = fixedValue.$offset;
}
return value;
};
this.date = (value, timezone = "default") => {
if (value === null) {
return null;
}
let parsedValue;
if (timezone === "UTC") {
parsedValue = this.createUTCDate(value);
} else if (timezone === "system" || timezone === "default" && !this.hasTimezonePlugin()) {
parsedValue = this.createSystemDate(value);
} else {
parsedValue = this.createTZDate(value, timezone);
}
if (this.locale === void 0) {
return parsedValue;
}
return parsedValue.locale(this.locale);
};
this.getInvalidDate = () => dayjs(/* @__PURE__ */ new Date("Invalid date"));
this.getTimezone = (value) => {
var _a;
if (this.hasTimezonePlugin()) {
const zone = (_a = value.$x) == null ? void 0 : _a.$timezone;
if (zone) {
return zone;
}
}
if (this.hasUTCPlugin() && value.isUTC()) {
return "UTC";
}
return "system";
};
this.setTimezone = (value, timezone) => {
if (this.getTimezone(value) === timezone) {
return value;
}
if (timezone === "UTC") {
if (!this.hasUTCPlugin()) {
throw new Error(MISSING_UTC_PLUGIN);
}
return value.utc();
}
if (timezone === "system") {
return value.local();
}
if (!this.hasTimezonePlugin()) {
if (timezone === "default") {
return value;
}
throw new Error(MISSING_TIMEZONE_PLUGIN);
}
return dayjs.tz(value, this.cleanTimezone(timezone));
};
this.toJsDate = (value) => {
return value.toDate();
};
this.parse = (value, format2) => {
if (value === "") {
return null;
}
return this.dayjs(value, format2, this.locale, true);
};
this.getCurrentLocaleCode = () => {
return this.locale || "en";
};
this.is12HourCycleInCurrentLocale = () => {
return /A|a/.test(this.getLocaleFormats().LT || "");
};
this.expandFormat = (format2) => {
const localeFormats = this.getLocaleFormats();
const t = (formatBis) => formatBis.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1));
return format2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (_, a, b) => {
const B = b && b.toUpperCase();
return a || localeFormats[b] || t(localeFormats[B]);
});
};
this.isValid = (value) => {
if (value == null) {
return false;
}
return value.isValid();
};
this.format = (value, formatKey) => {
return this.formatByString(value, this.formats[formatKey]);
};
this.formatByString = (value, formatString) => {
return this.dayjs(value).format(formatString);
};
this.formatNumber = (numberToFormat) => {
return numberToFormat;
};
this.isEqual = (value, comparing) => {
if (value === null && comparing === null) {
return true;
}
if (value === null || comparing === null) {
return false;
}
return value.toDate().getTime() === comparing.toDate().getTime();
};
this.isSameYear = (value, comparing) => {
return this.isSame(value, comparing, "YYYY");
};
this.isSameMonth = (value, comparing) => {
return this.isSame(value, comparing, "YYYY-MM");
};
this.isSameDay = (value, comparing) => {
return this.isSame(value, comparing, "YYYY-MM-DD");
};
this.isSameHour = (value, comparing) => {
return value.isSame(comparing, "hour");
};
this.isAfter = (value, comparing) => {
return value > comparing;
};
this.isAfterYear = (value, comparing) => {
if (!this.hasUTCPlugin()) {
return value.isAfter(comparing, "year");
}
return !this.isSameYear(value, comparing) && value.utc() > comparing.utc();
};
this.isAfterDay = (value, comparing) => {
if (!this.hasUTCPlugin()) {
return value.isAfter(comparing, "day");
}
return !this.isSameDay(value, comparing) && value.utc() > comparing.utc();
};
this.isBefore = (value, comparing) => {
return value < comparing;
};
this.isBeforeYear = (value, comparing) => {
if (!this.hasUTCPlugin()) {
return value.isBefore(comparing, "year");
}
return !this.isSameYear(value, comparing) && value.utc() < comparing.utc();
};
this.isBeforeDay = (value, comparing) => {
if (!this.hasUTCPlugin()) {
return value.isBefore(comparing, "day");
}
return !this.isSameDay(value, comparing) && value.utc() < comparing.utc();
};
this.isWithinRange = (value, [start, end]) => {
return value >= start && value <= end;
};
this.startOfYear = (value) => {
return this.adjustOffset(value.startOf("year"));
};
this.startOfMonth = (value) => {
return this.adjustOffset(value.startOf("month"));
};
this.startOfWeek = (value) => {
return this.adjustOffset(this.setLocaleToValue(value).startOf("week"));
};
this.startOfDay = (value) => {
return this.adjustOffset(value.startOf("day"));
};
this.endOfYear = (value) => {
return this.adjustOffset(value.endOf("year"));
};
this.endOfMonth = (value) => {
return this.adjustOffset(value.endOf("month"));
};
this.endOfWeek = (value) => {
return this.adjustOffset(this.setLocaleToValue(value).endOf("week"));
};
this.endOfDay = (value) => {
return this.adjustOffset(value.endOf("day"));
};
this.addYears = (value, amount) => {
return this.adjustOffset(amount < 0 ? value.subtract(Math.abs(amount), "year") : value.add(amount, "year"));
};
this.addMonths = (value, amount) => {
return this.adjustOffset(amount < 0 ? value.subtract(Math.abs(amount), "month") : value.add(amount, "month"));
};
this.addWeeks = (value, amount) => {
return this.adjustOffset(amount < 0 ? value.subtract(Math.abs(amount), "week") : value.add(amount, "week"));
};
this.addDays = (value, amount) => {
return this.adjustOffset(amount < 0 ? value.subtract(Math.abs(amount), "day") : value.add(amount, "day"));
};
this.addHours = (value, amount) => {
return this.adjustOffset(amount < 0 ? value.subtract(Math.abs(amount), "hour") : value.add(amount, "hour"));
};
this.addMinutes = (value, amount) => {
return this.adjustOffset(amount < 0 ? value.subtract(Math.abs(amount), "minute") : value.add(amount, "minute"));
};
this.addSeconds = (value, amount) => {
return this.adjustOffset(amount < 0 ? value.subtract(Math.abs(amount), "second") : value.add(amount, "second"));
};
this.getYear = (value) => {
return value.year();
};
this.getMonth = (value) => {
return value.month();
};
this.getDate = (value) => {
return value.date();
};
this.getHours = (value) => {
return value.hour();
};
this.getMinutes = (value) => {
return value.minute();
};
this.getSeconds = (value) => {
return value.second();
};
this.getMilliseconds = (value) => {
return value.millisecond();
};
this.setYear = (value, year) => {
return this.adjustOffset(value.set("year", year));
};
this.setMonth = (value, month) => {
return this.adjustOffset(value.set("month", month));
};
this.setDate = (value, date) => {
return this.adjustOffset(value.set("date", date));
};
this.setHours = (value, hours2) => {
return this.adjustOffset(value.set("hour", hours2));
};
this.setMinutes = (value, minutes2) => {
return this.adjustOffset(value.set("minute", minutes2));
};
this.setSeconds = (value, seconds2) => {
return this.adjustOffset(value.set("second", seconds2));
};
this.setMilliseconds = (value, milliseconds2) => {
return this.adjustOffset(value.set("millisecond", milliseconds2));
};
this.getDaysInMonth = (value) => {
return value.daysInMonth();
};
this.getWeekArray = (value) => {
const start = this.startOfWeek(this.startOfMonth(value));
const end = this.endOfWeek(this.endOfMonth(value));
let count = 0;
let current = start;
const nestedWeeks = [];
while (current < end) {
const weekNumber = Math.floor(count / 7);
nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
nestedWeeks[weekNumber].push(current);
current = this.addDays(current, 1);
count += 1;
}
return nestedWeeks;
};
this.getWeekNumber = (value) => {
return value.week();
};
this.getYearRange = ([start, end]) => {
const startDate = this.startOfYear(start);
const endDate = this.endOfYear(end);
const years2 = [];
let current = startDate;
while (this.isBefore(current, endDate)) {
years2.push(current);
current = this.addYears(current, 1);
}
return years2;
};
this.dayjs = withLocale(dayjs, _locale);
this.locale = _locale;
this.formats = _extends$1({}, defaultFormats, formats);
dayjs.extend(customParseFormatPlugin);
}
getDayOfWeek(value) {
return value.day() + 1;
}
}
var de$1 = {
exports: {}
};
var de = de$1.exports;
(function(module2, exports$1) {
!(function(e, n) {
module2.exports = n(requireDayjs_min());
})(de, (function(e) {
function n(e2) {
return e2 && "object" == typeof e2 && "default" in e2 ? e2 : {
default: e2
};
}
var t = n(e), a = {
s: "ein paar Sekunden",
m: [
"eine Minute",
"einer Minute"
],
mm: "%d Minuten",
h: [
"eine Stunde",
"einer Stunde"
],
hh: "%d Stunden",
d: [
"ein Tag",
"einem Tag"
],
dd: [
"%d Tage",
"%d Tagen"
],
M: [
"ein Monat",
"einem Monat"
],
MM: [
"%d Monate",
"%d Monaten"
],
y: [
"ein Jahr",
"einem Jahr"
],
yy: [
"%d Jahre",
"%d Jahren"
]
};
function i(e2, n2, t2) {
var i2 = a[t2];
return Array.isArray(i2) && (i2 = i2[n2 ? 0 : 1]), i2.replace("%d", e2);
}
var r = {
name: "de",
weekdays: "Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),
weekdaysShort: "So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),
weekdaysMin: "So_Mo_Di_Mi_Do_Fr_Sa".split("_"),
months: "Januar_Februar_M\xE4rz_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),
monthsShort: "Jan._Feb._M\xE4rz_Apr._Mai_Juni_Juli_Aug._Sept._Okt._Nov._Dez.".split("_"),
ordinal: function(e2) {
return e2 + ".";
},
weekStart: 1,
yearStart: 4,
formats: {
LTS: "HH:mm:ss",
LT: "HH:mm",
L: "DD.MM.YYYY",
LL: "D. MMMM YYYY",
LLL: "D. MMMM YYYY HH:mm",
LLLL: "dddd, D. MMMM YYYY HH:mm"
},
relativeTime: {
future: "in %s",
past: "vor %s",
s: i,
m: i,
mm: i,
h: i,
hh: i,
d: i,
dd: i,
M: i,
MM: i,
y: i,
yy: i
}
};
return t.default.locale(r, null, true), r;
}));
})(de$1);
var en$1 = {
exports: {}
};
var en = en$1.exports;
(function(module2, exports$1) {
!(function(e, n) {
module2.exports = n();
})(en, (function() {
return {
name: "en",
weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
ordinal: function(e) {
var n = [
"th",
"st",
"nd",
"rd"
], t = e % 100;
return "[" + e + (n[(t - 20) % 10] || n[t] || n[0]) + "]";
}
};
}));
})(en$1);
var ru$1 = {
exports: {}
};
var ru = ru$1.exports;
(function(module2, exports$1) {
!(function(_, t) {
module2.exports = t(requireDayjs_min());
})(ru, (function(_) {
function t(_2) {
return _2 && "object" == typeof _2 && "default" in _2 ? _2 : {
default: _2
};
}
var e = t(_), n = "\u044F\u043D\u0432\u0430\u0440\u044F_\u0444\u0435\u0432\u0440\u0430\u043B\u044F_\u043C\u0430\u0440\u0442\u0430_\u0430\u043F\u0440\u0435\u043B\u044F_\u043C\u0430\u044F_\u0438\u044E\u043D\u044F_\u0438\u044E\u043B\u044F_\u0430\u0432\u0433\u0443\u0441\u0442\u0430_\u0441\u0435\u043D\u0442\u044F\u0431\u0440\u044F_\u043E\u043A\u0442\u044F\u0431\u0440\u044F_\u043D\u043E\u044F\u0431\u0440\u044F_\u0434\u0435\u043A\u0430\u0431\u0440\u044F".split("_"), s = "\u044F\u043D\u0432\u0430\u0440\u044C_\u0444\u0435\u0432\u0440\u0430\u043B\u044C_\u043C\u0430\u0440\u0442_\u0430\u043F\u0440\u0435\u043B\u044C_\u043C\u0430\u0439_\u0438\u044E\u043D\u044C_\u0438\u044E\u043B\u044C_\u0430\u0432\u0433\u0443\u0441\u0442_\u0441\u0435\u043D\u0442\u044F\u0431\u0440\u044C_\u043E\u043A\u0442\u044F\u0431\u0440\u044C_\u043D\u043E\u044F\u0431\u0440\u044C_\u0434\u0435\u043A\u0430\u0431\u0440\u044C".split("_"), r = "\u044F\u043D\u0432._\u0444\u0435\u0432\u0440._\u043C\u0430\u0440._\u0430\u043F\u0440._\u043C\u0430\u044F_\u0438\u044E\u043D\u044F_\u0438\u044E\u043B\u044F_\u0430\u0432\u0433._\u0441\u0435\u043D\u0442._\u043E\u043A\u0442._\u043D\u043E\u044F\u0431._\u0434\u0435\u043A.".split("_"), o = "\u044F\u043D\u0432._\u0444\u0435\u0432\u0440._\u043C\u0430\u0440\u0442_\u0430\u043F\u0440._\u043C\u0430\u0439_\u0438\u044E\u043D\u044C_\u0438\u044E\u043B\u044C_\u0430\u0432\u0433._\u0441\u0435\u043D\u0442._\u043E\u043A\u0442._\u043D\u043E\u044F\u0431._\u0434\u0435\u043A.".split("_"), i = /D[oD]?(\[[^[\]]*\]|\s)+MMMM?/;
function d(_2, t2, e2) {
var n2, s2;
return "m" === e2 ? t2 ? "\u043C\u0438\u043D\u0443\u0442\u0430" : "\u043C\u0438\u043D\u0443\u0442\u0443" : _2 + " " + (n2 = +_2, s2 = {
mm: t2 ? "\u043C\u0438\u043D\u0443\u0442\u0430_\u043C\u0438\u043D\u0443\u0442\u044B_\u043C\u0438\u043D\u0443\u0442" : "\u043C\u0438\u043D\u0443\u0442\u0443_\u043C\u0438\u043D\u0443\u0442\u044B_\u043C\u0438\u043D\u0443\u0442",
hh: "\u0447\u0430\u0441_\u0447\u0430\u0441\u0430_\u0447\u0430\u0441\u043E\u0432",
dd: "\u0434\u0435\u043D\u044C_\u0434\u043D\u044F_\u0434\u043D\u0435\u0439",
MM: "\u043C\u0435\u0441\u044F\u0446_\u043C\u0435\u0441\u044F\u0446\u0430_\u043C\u0435\u0441\u044F\u0446\u0435\u0432",
yy: "\u0433\u043E\u0434_\u0433\u043E\u0434\u0430_\u043B\u0435\u0442"
}[e2].split("_"), n2 % 10 == 1 && n2 % 100 != 11 ? s2[0] : n2 % 10 >= 2 && n2 % 10 <= 4 && (n2 % 100 < 10 || n2 % 100 >= 20) ? s2[1] : s2[2]);
}
var u = function(_2, t2) {
return i.test(t2) ? n[_2.month()] : s[_2.month()];
};
u.s = s, u.f = n;
var a = function(_2, t2) {
return i.test(t2) ? r[_2.month()] : o[_2.month()];
};
a.s = o, a.f = r;
var m = {
name: "ru",
weekdays: "\u0432\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u0435_\u043F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A_\u0432\u0442\u043E\u0440\u043D\u0438\u043A_\u0441\u0440\u0435\u0434\u0430_\u0447\u0435\u0442\u0432\u0435\u0440\u0433_\u043F\u044F\u0442\u043D\u0438\u0446\u0430_\u0441\u0443\u0431\u0431\u043E\u0442\u0430".split("_"),
weekdaysShort: "\u0432\u0441\u043A_\u043F\u043D\u0434_\u0432\u0442\u0440_\u0441\u0440\u0434_\u0447\u0442\u0432_\u043F\u0442\u043D_\u0441\u0431\u0442".split("_"),
weekdaysMin: "\u0432\u0441_\u043F\u043D_\u0432\u0442_\u0441\u0440_\u0447\u0442_\u043F\u0442_\u0441\u0431".split("_"),
months: u,
monthsShort: a,
weekStart: 1,
yearStart: 4,
formats: {
LT: "H:mm",
LTS: "H:mm:ss",
L: "DD.MM.YYYY",
LL: "D MMMM YYYY \u0433.",
LLL: "D MMMM YYYY \u0433., H:mm",
LLLL: "dddd, D MMMM YYYY \u0433., H:mm"
},
relativeTime: {
future: "\u0447\u0435\u0440\u0435\u0437 %s",
past: "%s \u043D\u0430\u0437\u0430\u0434",
s: "\u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0441\u0435\u043A\u0443\u043D\u0434",
m: d,
mm: d,
h: "\u0447\u0430\u0441",
hh: d,
d: "\u0434\u0435\u043D\u044C",
dd: d,
M: "\u043C\u0435\u0441\u044F\u0446",
MM: d,
y: "\u0433\u043E\u0434",
yy: d
},
ordinal: function(_2) {
return _2;
},
meridiem: function(_2) {
return _2 < 4 ? "\u043D\u043E\u0447\u0438" : _2 < 12 ? "\u0443\u0442\u0440\u0430" : _2 < 17 ? "\u0434\u043D\u044F" : "\u0432\u0435\u0447\u0435\u0440\u0430";
}
};
return e.default.locale(m, null, true), m;
}));
})(ru$1);
var zhCn$1 = {
exports: {}
};
var zhCn = zhCn$1.exports;
(function(module2, exports$1) {
!(function(e, _) {
module2.exports = _(requireDayjs_min());
})(zhCn, (function(e) {
function _(e2) {
return e2 && "object" == typeof e2 && "default" in e2 ? e2 : {
default: e2
};
}
var t = _(e), d = {
name: "zh-cn",
weekdays: "\u661F\u671F\u65E5_\u661F\u671F\u4E00_\u661F\u671F\u4E8C_\u661F\u671F\u4E09_\u661F\u671F\u56DB_\u661F\u671F\u4E94_\u661F\u671F\u516D".split("_"),
weekdaysShort: "\u5468\u65E5_\u5468\u4E00_\u5468\u4E8C_\u5468\u4E09_\u5468\u56DB_\u5468\u4E94_\u5468\u516D".split("_"),
weekdaysMin: "\u65E5_\u4E00_\u4E8C_\u4E09_\u56DB_\u4E94_\u516D".split("_"),
months: "\u4E00\u6708_\u4E8C\u6708_\u4E09\u6708_\u56DB\u6708_\u4E94\u6708_\u516D\u6708_\u4E03\u6708_\u516B\u6708_\u4E5D\u6708_\u5341\u6708_\u5341\u4E00\u6708_\u5341\u4E8C\u6708".split("_"),
monthsShort: "1\u6708_2\u6708_3\u6708_4\u6708_5\u6708_6\u6708_7\u6708_8\u6708_9\u6708_10\u6708_11\u6708_12\u6708".split("_"),
ordinal: function(e2, _2) {
return "W" === _2 ? e2 + "\u5468" : e2 + "\u65E5";
},
weekStart: 1,
yearStart: 4,
formats: {
LT: "HH:mm",
LTS: "HH:mm:ss",
L: "YYYY/MM/DD",
LL: "YYYY\u5E74M\u6708D\u65E5",
LLL: "YYYY\u5E74M\u6708D\u65E5Ah\u70B9mm\u5206",
LLLL: "YYYY\u5E74M\u6708D\u65E5ddddAh\u70B9mm\u5206",
l: "YYYY/M/D",
ll: "YYYY\u5E74M\u6708D\u65E5",
lll: "YYYY\u5E74M\u6708D\u65E5 HH:mm",
llll: "YYYY\u5E74M\u6708D\u65E5dddd HH:mm"
},
relativeTime: {
future: "%s\u5185",
past: "%s\u524D",
s: "\u51E0\u79D2",
m: "1 \u5206\u949F",
mm: "%d \u5206\u949F",
h: "1 \u5C0F\u65F6",
hh: "%d \u5C0F\u65F6",
d: "1 \u5929",
dd: "%d \u5929",
M: "1 \u4E2A\u6708",
MM: "%d \u4E2A\u6708",
y: "1 \u5E74",
yy: "%d \u5E74"
},
meridiem: function(e2, _2) {
var t2 = 100 * e2 + _2;
return t2 < 600 ? "\u51CC\u6668" : t2 < 900 ? "\u65E9\u4E0A" : t2 < 1100 ? "\u4E0A\u5348" : t2 < 1300 ? "\u4E2D\u5348" : t2 < 1800 ? "\u4E0B\u5348" : "\u665A\u4E0A";
}
};
return t.default.locale(d, null, true), d;
}));
})(zhCn$1);
var uk$1 = {
exports: {}
};
var uk = uk$1.exports;
(function(module2, exports$1) {
!(function(_, e) {
module2.exports = e(requireDayjs_min());
})(uk, (function(_) {
function e(_2) {
return _2 && "object" == typeof _2 && "default" in _2 ? _2 : {
default: _2
};
}
var t = e(_), s = "\u0441\u0456\u0447\u043D\u044F_\u043B\u044E\u0442\u043E\u0433\u043E_\u0431\u0435\u0440\u0435\u0437\u043D\u044F_\u043A\u0432\u0456\u0442\u043D\u044F_\u0442\u0440\u0430\u0432\u043D\u044F_\u0447\u0435\u0440\u0432\u043D\u044F_\u043B\u0438\u043F\u043D\u044F_\u0441\u0435\u0440\u043F\u043D\u044F_\u0432\u0435\u0440\u0435\u0441\u043D\u044F_\u0436\u043E\u0432\u0442\u043D\u044F_\u043B\u0438\u0441\u0442\u043E\u043F\u0430\u0434\u0430_\u0433\u0440\u0443\u0434\u043D\u044F".split("_"), n = "\u0441\u0456\u0447\u0435\u043D\u044C_\u043B\u044E\u0442\u0438\u0439_\u0431\u0435\u0440\u0435\u0437\u0435\u043D\u044C_\u043A\u0432\u0456\u0442\u0435\u043D\u044C_\u0442\u0440\u0430\u0432\u0435\u043D\u044C_\u0447\u0435\u0440\u0432\u0435\u043D\u044C_\u043B\u0438\u043F\u0435\u043D\u044C_\u0441\u0435\u0440\u043F\u0435\u043D\u044C_\u0432\u0435\u0440\u0435\u0441\u0435\u043D\u044C_\u0436\u043E\u0432\u0442\u0435\u043D\u044C_\u043B\u0438\u0441\u0442\u043E\u043F\u0430\u0434_\u0433\u0440\u0443\u0434\u0435\u043D\u044C".split("_"), o = /D[oD]?(\[[^[\]]*\]|\s)+MMMM?/;
function d(_2, e2, t2) {
var s2, n2;
return "m" === t2 ? e2 ? "\u0445\u0432\u0438\u043B\u0438\u043D\u0430" : "\u0445\u0432\u0438\u043B\u0438\u043D\u0443" : "h" === t2 ? e2 ? "\u0433\u043E\u0434\u0438\u043D\u0430" : "\u0433\u043E\u0434\u0438\u043D\u0443" : _2 + " " + (s2 = +_2, n2 = {
ss: e2 ? "\u0441\u0435\u043A\u0443\u043D\u0434\u0430_\u0441\u0435\u043A\u0443\u043D\u0434\u0438_\u0441\u0435\u043A\u0443\u043D\u0434" : "\u0441\u0435\u043A\u0443\u043D\u0434\u0443_\u0441\u0435\u043A\u0443\u043D\u0434\u0438_\u0441\u0435\u043A\u0443\u043D\u0434",
mm: e2 ? "\u0445\u0432\u0438\u043B\u0438\u043D\u0430_\u0445\u0432\u0438\u043B\u0438\u043D\u0438_\u0445\u0432\u0438\u043B\u0438\u043D" : "\u0445\u0432\u0438\u043B\u0438\u043D\u0443_\u0445\u0432\u0438\u043B\u0438\u043D\u0438_\u0445\u0432\u0438\u043B\u0438\u043D",
hh: e2 ? "\u0433\u043E\u0434\u0438\u043D\u0430_\u0433\u043E\u0434\u0438\u043D\u0438_\u0433\u043E\u0434\u0438\u043D" : "\u0433\u043E\u0434\u0438\u043D\u0443_\u0433\u043E\u0434\u0438\u043D\u0438_\u0433\u043E\u0434\u0438\u043D",
dd: "\u0434\u0435\u043D\u044C_\u0434\u043D\u0456_\u0434\u043D\u0456\u0432",
MM: "\u043C\u0456\u0441\u044F\u0446\u044C_\u043C\u0456\u0441\u044F\u0446\u0456_\u043C\u0456\u0441\u044F\u0446\u0456\u0432",
yy: "\u0440\u0456\u043A_\u0440\u043E\u043A\u0438_\u0440\u043E\u043A\u0456\u0432"
}[t2].split("_"), s2 % 10 == 1 && s2 % 100 != 11 ? n2[0] : s2 % 10 >= 2 && s2 % 10 <= 4 && (s2 % 100 < 10 || s2 % 100 >= 20) ? n2[1] : n2[2]);
}
var i = function(_2, e2) {
return o.test(e2) ? s[_2.month()] : n[_2.month()];
};
i.s = n, i.f = s;
var r = {
name: "uk",
weekdays: "\u043D\u0435\u0434\u0456\u043B\u044F_\u043F\u043E\u043D\u0435\u0434\u0456\u043B\u043E\u043A_\u0432\u0456\u0432\u0442\u043E\u0440\u043E\u043A_\u0441\u0435\u0440\u0435\u0434\u0430_\u0447\u0435\u0442\u0432\u0435\u0440_\u043F\u2019\u044F\u0442\u043D\u0438\u0446\u044F_\u0441\u0443\u0431\u043E\u0442\u0430".split("_"),
weekdaysShort: "\u043D\u0434\u043B_\u043F\u043D\u0434_\u0432\u0442\u0440_\u0441\u0440\u0434_\u0447\u0442\u0432_\u043F\u0442\u043D_\u0441\u0431\u0442".split("_"),
weekdaysMin: "\u043D\u0434_\u043F\u043D_\u0432\u0442_\u0441\u0440_\u0447\u0442_\u043F\u0442_\u0441\u0431".split("_"),
months: i,
monthsShort: "\u0441\u0456\u0447_\u043B\u044E\u0442_\u0431\u0435\u0440_\u043A\u0432\u0456\u0442_\u0442\u0440\u0430\u0432_\u0447\u0435\u0440\u0432_\u043B\u0438\u043F_\u0441\u0435\u0440\u043F_\u0432\u0435\u0440_\u0436\u043E\u0432\u0442_\u043B\u0438\u0441\u0442_\u0433\u0440\u0443\u0434".split("_"),
weekStart: 1,
relativeTime: {
future: "\u0437\u0430 %s",
past: "%s \u0442\u043E\u043C\u0443",
s: "\u0434\u0435\u043A\u0456\u043B\u044C\u043A\u0430 \u0441\u0435\u043A\u0443\u043D\u0434",
m: d,
mm: d,
h: d,
hh: d,
d: "\u0434\u0435\u043D\u044C",
dd: d,
M: "\u043C\u0456\u0441\u044F\u0446\u044C",
MM: d,
y: "\u0440\u0456\u043A",
yy: d
},
ordinal: function(_2) {
return _2;
},
formats: {
LT: "HH:mm",
LTS: "HH:mm:ss",
L: "DD.MM.YYYY",
LL: "D MMMM YYYY \u0440.",
LLL: "D MMMM YYYY \u0440., HH:mm",
LLLL: "dddd, D MMMM YYYY \u0440., HH:mm"
}
};
return t.default.locale(r, null, true), r;
}));
})(uk$1);
var it$1 = {
exports: {}
};
var it = it$1.exports;
(function(module2, exports$1) {
!(function(e, o) {
module2.exports = o(requireDayjs_min());
})(it, (function(e) {
function o(e2) {
return e2 && "object" == typeof e2 && "default" in e2 ? e2 : {
default: e2
};
}
var t = o(e), n = {
name: "it",
weekdays: "domenica_luned\xEC_marted\xEC_mercoled\xEC_gioved\xEC_venerd\xEC_sabato".split("_"),
weekdaysShort: "dom_lun_mar_mer_gio_ven_sab".split("_"),
weekdaysMin: "do_lu_ma_me_gi_ve_sa".split("_"),
months: "gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),
weekStart: 1,
monthsShort: "gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),
formats: {
LT: "HH:mm",
LTS: "HH:mm:ss",
L: "DD/MM/YYYY",
LL: "D MMMM YYYY",
LLL: "D MMMM YYYY HH:mm",
LLLL: "dddd D MMMM YYYY HH:mm"
},
relativeTime: {
future: "tra %s",
past: "%s fa",
s: "qualche secondo",
m: "un minuto",
mm: "%d minuti",
h: "un'ora",
hh: "%d ore",
d: "un giorno",
dd: "%d giorni",
M: "un mese",
MM: "%d mesi",
y: "un anno",
yy: "%d anni"
},
ordinal: function(e2) {
return e2 + "\xBA";
}
};
return t.default.locale(n, null, true), n;
}));
})(it$1);
var fr$1 = {
exports: {}
};
var fr = fr$1.exports;
(function(module2, exports$1) {
!(function(e, n) {
module2.exports = n(requireDayjs_min());
})(fr, (function(e) {
function n(e2) {
return e2 && "object" == typeof e2 && "default" in e2 ? e2 : {
default: e2
};
}
var t = n(e), i = {
name: "fr",
weekdays: "dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),
weekdaysShort: "dim._lun._mar._mer._jeu._ven._sam.".split("_"),
weekdaysMin: "di_lu_ma_me_je_ve_sa".split("_"),
months: "janvier_f\xE9vrier_mars_avril_mai_juin_juillet_ao\xFBt_septembre_octobre_novembre_d\xE9cembre".split("_"),
monthsShort: "janv._f\xE9vr._mars_avr._mai_juin_juil._ao\xFBt_sept._oct._nov._d\xE9c.".split("_"),
weekStart: 1,
yearStart: 4,
formats: {
LT: "HH:mm",
LTS: "HH:mm:ss",
L: "DD/MM/YYYY",
LL: "D MMMM YYYY",
LLL: "D MMMM YYYY HH:mm",
LLLL: "dddd D MMMM YYYY HH:mm"
},
relativeTime: {
future: "dans %s",
past: "il y a %s",
s: "quelques secondes",
m: "une minute",
mm: "%d minutes",
h: "une heure",
hh: "%d heures",
d: "un jour",
dd: "%d jours",
M: "un mois",
MM: "%d mois",
y: "un an",
yy: "%d ans"
},
ordinal: function(e2) {
return "" + e2 + (1 === e2 ? "er" : "");
}
};
return t.default.locale(i, null, true), i;
}));
})(fr$1);
var es$1 = {
exports: {}
};
var es = es$1.exports;
(function(module2, exports$1) {
!(function(e, o) {
module2.exports = o(requireDayjs_min());
})(es, (function(e) {
function o(e2) {
return e2 && "object" == typeof e2 && "default" in e2 ? e2 : {
default: e2
};
}
var s = o(e), d = {
name: "es",
monthsShort: "ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),
weekdays: "domingo_lunes_martes_mi\xE9rcoles_jueves_viernes_s\xE1bado".split("_"),
weekdaysShort: "dom._lun._mar._mi\xE9._jue._vie._s\xE1b.".split("_"),
weekdaysMin: "do_lu_ma_mi_ju_vi_s\xE1".split("_"),
months: "enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),
weekStart: 1,
formats: {
LT: "H:mm",
LTS: "H:mm:ss",
L: "DD/MM/YYYY",
LL: "D [de] MMMM [de] YYYY",
LLL: "D [de] MMMM [de] YYYY H:mm",
LLLL: "dddd, D [de] MMMM [de] YYYY H:mm"
},
relativeTime: {
future: "en %s",
past: "hace %s",
s: "unos segundos",
m: "un minuto",
mm: "%d minutos",
h: "una hora",
hh: "%d horas",
d: "un d\xEDa",
dd: "%d d\xEDas",
M: "un mes",
MM: "%d meses",
y: "un a\xF1o",
yy: "%d a\xF1os"
},
ordinal: function(e2) {
return e2 + "\xBA";
}
};
return s.default.locale(d, null, true), d;
}));
})(es$1);
var pl$1 = {
exports: {}
};
var pl = pl$1.exports;
(function(module2, exports$1) {
!(function(e, t) {
module2.exports = t(requireDayjs_min());
})(pl, (function(e) {
function t(e2) {
return e2 && "object" == typeof e2 && "default" in e2 ? e2 : {
default: e2
};
}
var i = t(e);
function a(e2) {
return e2 % 10 < 5 && e2 % 10 > 1 && ~~(e2 / 10) % 10 != 1;
}
function n(e2, t2, i2) {
var n2 = e2 + " ";
switch (i2) {
case "m":
return t2 ? "minuta" : "minut\u0119";
case "mm":
return n2 + (a(e2) ? "minuty" : "minut");
case "h":
return t2 ? "godzina" : "godzin\u0119";
case "hh":
return n2 + (a(e2) ? "godziny" : "godzin");
case "MM":
return n2 + (a(e2) ? "miesi\u0105ce" : "miesi\u0119cy");
case "yy":
return n2 + (a(e2) ? "lata" : "lat");
}
}
var r = "stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_wrze\u015Bnia_pa\u017Adziernika_listopada_grudnia".split("_"), _ = "stycze\u0144_luty_marzec_kwiecie\u0144_maj_czerwiec_lipiec_sierpie\u0144_wrzesie\u0144_pa\u017Adziernik_listopad_grudzie\u0144".split("_"), s = /D MMMM/, d = function(e2, t2) {
return s.test(t2) ? r[e2.month()] : _[e2.month()];
};
d.s = _, d.f = r;
var o = {
name: "pl",
weekdays: "niedziela_poniedzia\u0142ek_wtorek_\u015Broda_czwartek_pi\u0105tek_sobota".split("_"),
weekdaysShort: "ndz_pon_wt_\u015Br_czw_pt_sob".split("_"),
weekdaysMin: "Nd_Pn_Wt_\u015Ar_Cz_Pt_So".split("_"),
months: d,
monthsShort: "sty_lut_mar_kwi_maj_cze_lip_sie_wrz_pa\u017A_lis_gru".split("_"),
ordinal: function(e2) {
return e2 + ".";
},
weekStart: 1,
yearStart: 4,
relativeTime: {
future: "za %s",
past: "%s temu",
s: "kilka sekund",
m: n,
mm: n,
h: n,
hh: n,
d: "1 dzie\u0144",
dd: "%d dni",
M: "miesi\u0105c",
MM: n,
y: "rok",
yy: n
},
formats: {
LT: "HH:mm",
LTS: "HH:mm:ss",
L: "DD.MM.YYYY",
LL: "D MMMM YYYY",
LLL: "D MMMM YYYY HH:mm",
LLLL: "dddd, D MMMM YYYY HH:mm"
}
};
return i.default.locale(o, null, true), o;
}));
})(pl$1);
var pt$1 = {
exports: {}
};
var pt = pt$1.exports;
(function(module2, exports$1) {
!(function(e, a) {
module2.exports = a(requireDayjs_min());
})(pt, (function(e) {
function a(e2) {
return e2 && "object" == typeof e2 && "default" in e2 ? e2 : {
default: e2
};
}
var o = a(e), t = {
name: "pt",
weekdays: "domingo_segunda-feira_ter\xE7a-feira_quarta-feira_quinta-feira_sexta-feira_s\xE1bado".split("_"),
weekdaysShort: "dom_seg_ter_qua_qui_sex_sab".split("_"),
weekdaysMin: "Do_2\xAA_3\xAA_4\xAA_5\xAA_6\xAA_Sa".split("_"),
months: "janeiro_fevereiro_mar\xE7o_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),
monthsShort: "jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),
ordinal: function(e2) {
return e2 + "\xBA";
},
weekStart: 1,
yearStart: 4,
formats: {
LT: "HH:mm",
LTS: "HH:mm:ss",
L: "DD/MM/YYYY",
LL: "D [de] MMMM [de] YYYY",
LLL: "D [de] MMMM [de] YYYY [\xE0s] HH:mm",
LLLL: "dddd, D [de] MMMM [de] YYYY [\xE0s] HH:mm"
},
relativeTime: {
future: "em %s",
past: "h\xE1 %s",
s: "alguns segundos",
m: "um minuto",
mm: "%d minutos",
h: "uma hora",
hh: "%d horas",
d: "um dia",
dd: "%d dias",
M: "um m\xEAs",
MM: "%d meses",
y: "um ano",
yy: "%d anos"
}
};
return o.default.locale(t, null, true), t;
}));
})(pt$1);
var nl$1 = {
exports: {}
};
var nl = nl$1.exports;
(function(module2, exports$1) {
!(function(e, a) {
module2.exports = a(requireDayjs_min());
})(nl, (function(e) {
function a(e2) {
return e2 && "object" == typeof e2 && "default" in e2 ? e2 : {
default: e2
};
}
var d = a(e), n = {
name: "nl",
weekdays: "zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),
weekdaysShort: "zo._ma._di._wo._do._vr._za.".split("_"),
weekdaysMin: "zo_ma_di_wo_do_vr_za".split("_"),
months: "januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),
monthsShort: "jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),
ordinal: function(e2) {
return "[" + e2 + (1 === e2 || 8 === e2 || e2 >= 20 ? "ste" : "de") + "]";
},
weekStart: 1,
yearStart: 4,
formats: {
LT: "HH:mm",
LTS: "HH:mm:ss",
L: "DD-MM-YYYY",
LL: "D MMMM YYYY",
LLL: "D MMMM YYYY HH:mm",
LLLL: "dddd D MMMM YYYY HH:mm"
},
relativeTime: {
future: "over %s",
past: "%s geleden",
s: "een paar seconden",
m: "een minuut",
mm: "%d minuten",
h: "een uur",
hh: "%d uur",
d: "een dag",
dd: "%d dagen",
M: "een maand",
MM: "%d maanden",
y: "een jaar",
yy: "%d jaar"
}
};
return d.default.locale(n, null, true), n;
}));
})(nl$1);
const styles$2 = {
textRoot: {
"& .MuiInputBase-root": {
width: "100%",
height: "100%"
}
}
};
class JQuiInputDate extends VisRxWidget {
EASY_DATE_FORMAT = "DD.MM.YYYY";
static getWidgetInfo() {
return {
id: "tplJquiInputDate",
visSet: "jqui",
visName: "Input Date",
visWidgetLabel: "jqui_input_date",
visPrev: "widgets/jqui/img/Prev_InputDate.png",
visOrder: 30,
visAttrs: [
{
name: "common",
fields: [
{
name: "oid",
type: "id"
},
{
name: "variant",
label: "jqui_variant",
type: "select",
options: [
{
label: "standard",
value: "standard"
},
{
label: "outlined",
value: "outlined"
},
{
label: "filled",
value: "filled"
}
],
default: "standard"
},
{
name: "autoFocus",
type: "checkbox"
},
{
name: "clearable",
label: "jqui_clearable",
type: "checkbox"
},
{
name: "widgetTitle",
label: "jqui_widgetTitle",
type: "text"
},
{
name: "disableFuture",
label: "jqui_disableFuture",
type: "checkbox",
hidden: "!!data.disablePast"
},
{
name: "disablePast",
label: "jqui_disablePast",
type: "checkbox",
hidden: "!!data.disableFuture"
},
{
name: "asFullDate",
label: "jqui_asFullDate",
type: "checkbox"
},
{
name: "displayWeekNumber",
label: "jqui_displayWeekNumber",
type: "checkbox"
},
{
name: "wideFormat",
label: "jqui_wideFormat",
type: "checkbox"
}
]
}
],
visDefaultStyle: {
width: 250,
height: 56
}
};
}
getWidgetInfo() {
return JQuiInputDate.getWidgetInfo();
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
props.style.overflow = "visible";
return jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
children: jsxRuntimeExports.jsx(LocalizationProvider, {
dateAdapter: AdapterDayjs,
adapterLocale: this.props.context.lang,
children: jsxRuntimeExports.jsx(DatePicker, {
value: this.state.rxData.asFullDate ? dayjs(this.state.values[`${this.state.rxData.oid}.val`]) || "" : dayjs(this.state.values[`${this.state.rxData.oid}.val`], this.EASY_DATE_FORMAT),
label: this.state.rxData.widgetTitle || null,
autoFocus: this.state.rxData.autoFocus || false,
onChange: (newValue) => {
if (!newValue) {
return;
}
const val = this.state.rxData.asFullDate ? newValue.toDate().toString() : newValue.format(this.EASY_DATE_FORMAT);
this.props.context.setValue(this.state.rxData.oid, val);
},
formatDensity: this.state.rxData.wideFormat ? "spacious" : "dense",
slotProps: {
textField: {
variant: this.state.rxData.variant || "standard",
style: {
width: "100%",
height: "100%"
},
sx: styles$2.textRoot
},
field: {
clearable: this.state.rxData.clearable,
onClear: () => this.props.context.setValue(this.state.rxData.oid, "")
}
},
disableFuture: this.state.rxData.disableFuture || false,
disablePast: this.state.rxData.disablePast || false,
displayWeekNumber: this.state.rxData.displayWeekNumber || false
})
})
});
}
}
const styles$1 = {
textRoot: {
"& .MuiInputBase-root": {
width: "100%",
height: "100%"
}
}
};
class JQuiInputDateTime extends VisRxWidget {
static getWidgetInfo() {
return {
id: "tplJquiInputDatetime",
visSet: "jqui",
visName: "Input Time",
visWidgetLabel: "jqui_input_time",
visPrev: "widgets/jqui/img/Prev_InputDateTime.png",
visOrder: 31,
visAttrs: [
{
name: "common",
fields: [
{
name: "oid",
type: "id"
},
{
name: "variant",
label: "jqui_variant",
type: "select",
options: [
{
label: "standard",
value: "standard"
},
{
label: "outlined",
value: "outlined"
},
{
label: "filled",
value: "filled"
}
],
default: "standard"
},
{
name: "autoFocus",
type: "checkbox"
},
{
name: "clearable",
label: "jqui_clearable",
type: "checkbox"
},
{
name: "widgetTitle",
label: "jqui_widgetTitle",
type: "text"
},
{
name: "ampm",
label: "jqui_ampm",
type: "checkbox"
},
{
name: "asDate",
label: "jqui_asDate",
type: "checkbox"
},
{
name: "stepMinute",
label: "jqui_stepMinute",
type: "select",
options: [
{
label: "1 minute",
value: 1
},
{
label: "2 minutes",
value: 2
},
{
label: "3 minutes",
value: 3
},
{
label: "4 minutes",
value: 4
},
{
label: "5 minutes",
value: 5
},
{
label: "10 minutes",
value: 10
},
{
label: "15 minutes",
value: 15
},
{
label: "20 minutes",
value: 20
},
{
label: "30 minutes",
value: 30
},
{
label: "60 minutes",
value: 60
}
]
}
]
}
],
visDefaultStyle: {
width: 250,
height: 56
}
};
}
getWidgetInfo() {
return JQuiInputDateTime.getWidgetInfo();
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
const val = this.state.values[`${this.state.rxData.oid}.val`];
const asDate = this.state.rxData.asDate;
props.style.overflow = "visible";
return jsxRuntimeExports.jsx("div", {
className: "vis-widget-body",
children: jsxRuntimeExports.jsx(LocalizationProvider, {
dateAdapter: AdapterDayjs,
adapterLocale: this.props.context.lang,
children: jsxRuntimeExports.jsx(TimePicker, {
value: val && !asDate ? dayjs(val, "HH:mm") : dayjs(val),
ampm: this.state.rxData.ampm || false,
minutesStep: parseInt(this.state.rxData.stepMinute, 10) || 1,
label: this.state.rxData.widgetTitle || null,
formatDensity: "dense",
format: "HH:mm",
autoFocus: this.state.rxData.autoFocus || false,
onChange: (value) => {
if (!value) {
return;
}
const res = !asDate ? value.format("HH:mm") : value.second(0).millisecond(0).toDate().toString();
this.props.context.setValue(this.state.rxData.oid, res);
},
slotProps: {
textField: {
variant: this.state.rxData.variant || "standard",
style: {
width: "100%",
height: "100%"
},
sx: styles$1.textRoot
},
field: {
clearable: this.state.rxData.clearable,
onClear: () => this.props.context.setValue(this.state.rxData.oid, "")
}
}
})
})
});
}
}
class JQuiToggle extends JQuiBinaryState {
static getWidgetInfo() {
const widgetInfo = JQuiBinaryState.getWidgetInfo();
const newWidgetInfo = {
id: "tplJquiToogle",
visSet: "jqui",
visName: "Icon Toggle",
visWidgetLabel: "jqui_icon_toggle",
visPrev: "widgets/jqui/img/Prev_IconToggle.png",
visOrder: 32,
visAttrs: widgetInfo.visAttrs,
visDefaultStyle: {
width: 92,
height: 36
}
};
newWidgetInfo.visAttrs[0].fields.unshift({
name: "_note",
type: "help",
text: "jqui_button_binary_control_note"
});
const iconFalse = JQuiBinaryState.findField(newWidgetInfo, "icon_false");
if (iconFalse) {
iconFalse.default = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBmaWxsPSJjdXJyZW50Q29sb3IiIGQ9Ik0xMyAzaC0ydjEwaDJWM3ptNC44MyAyLjE3bC0xLjQyIDEuNDJBNi45MiA2LjkyIDAgMCAxIDE5IDEyYzAgMy44Ny0zLjEzIDctNyA3QTYuOTk1IDYuOTk1IDAgMCAxIDcuNTggNi41OEw2LjE3IDUuMTdBOC45MzIgOC45MzIgMCAwIDAgMyAxMmE5IDkgMCAwIDAgMTggMGMwLTIuNzQtMS4yMy01LjE4LTMuMTctNi44M3oiLz48L3N2Zz4=";
}
const colorTrue = JQuiBinaryState.findField(newWidgetInfo, "color_true");
if (colorTrue) {
colorTrue.default = "#93ff93";
}
return newWidgetInfo;
}
getWidgetInfo() {
return JQuiToggle.getWidgetInfo();
}
}
class TabsSliderTabs extends VisRxWidget {
static getWidgetInfo() {
return {
id: "tplSTab",
visSet: "tabs",
visName: "SliderTabs",
visSetLabel: "Tabs",
visPrev: "widgets/tabs/img/Prev_SliderTabs.png",
visWidgetLabel: "vis_2_widgets_widgets_tabs_label",
visSetIcon: "widgets/tabs/img/Prev_SliderTabs.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "show_tabs",
type: "slider",
min: 1,
max: 20,
label: "vis_2_widgets_widgets_tabs_show_tabs",
default: 2
},
{
name: "vertical",
type: "checkbox",
label: "vis_2_widgets_widgets_tabs_vertical"
},
{
name: "variant",
type: "select",
label: "vis_2_widgets_widgets_tabs_variant",
hidden: "!!data.vertical",
options: [
{
value: "",
label: "vis_2_widgets_widgets_tabs_variant_default"
},
{
value: "centered",
label: "vis_2_widgets_widgets_tabs_variant_centered"
},
{
value: "fullWidth",
label: "vis_2_widgets_widgets_tabs_variant_full_width"
}
]
},
{
name: "color",
type: "color",
label: "vis_2_widgets_widgets_tabs_color"
}
]
},
{
name: "node",
label: "vis_2_widgets_widgets_tabs_group_tab",
indexFrom: 1,
indexTo: "show_tabs",
fields: [
{
name: "title_tab_",
label: "vis_2_widgets_widgets_tabs_tab_title"
},
{
name: "contains_view_",
multiple: false,
type: "select-views",
label: "vis_2_widgets_widgets_tabs_tab_view"
},
{
name: "icon_tab_",
type: "icon64",
label: "vis_2_widgets_widgets_tabs_tab_icon",
hidden: '!!data["image_tab_" + index"]'
},
{
name: "image_tab_",
type: "image",
label: "vis_2_widgets_widgets_tabs_tab_image",
hidden: '!!data["icon_tab_" + index"]'
},
{
name: "icon_size_",
type: "slider",
min: 0,
max: 100,
label: "vis_2_widgets_widgets_tabs_tab_icon_size",
hidden: '!data["icon_tab_" + index"] && !data["image_tab_" + index"]'
},
{
name: "icon_color_",
type: "color",
label: "vis_2_widgets_widgets_tabs_tab_icon_color",
hidden: '!data["icon_tab_" + index"]'
},
{
name: "overflow_x_",
label: "vis_2_widgets_widgets_tabs_tab_overflow_x",
type: "select",
noTranslation: true,
options: [
"",
"visible",
"hidden",
"scroll",
"auto",
"initial",
"inherit"
]
},
{
name: "overflow_y_",
label: "vis_2_widgets_widgets_tabs_tab_overflow_y",
type: "select",
noTranslation: true,
options: [
"",
"visible",
"hidden",
"scroll",
"auto",
"initial",
"inherit"
]
}
]
}
],
visDefaultStyle: {
width: 250,
height: 250
}
};
}
componentDidMount() {
super.componentDidMount();
const tabIndexStr = window.localStorage.getItem(`${this.props.id}-tabIndex`);
let tabIndex = 0;
if (tabIndexStr) {
tabIndex = parseInt(tabIndexStr, 10) || 0;
}
this.setState({
tabIndex
});
}
getWidgetInfo() {
return TabsSliderTabs.getWidgetInfo();
}
getWidgetView() {
const view = this.state.rxData[`contains_view_${this.state.tabIndex + 1}`];
const style = {
flex: 1,
position: "relative"
};
const overflowX = this.state.rxData[`overflow_x_${this.state.tabIndex + 1}`];
const overflowY = this.state.rxData[`overflow_y_${this.state.tabIndex + 1}`];
if (overflowX && overflowY) {
if (overflowY === overflowX) {
style.overflow = overflowX;
} else {
style.overflowX = overflowX;
style.overflowY = overflowY;
}
} else if (overflowX) {
style.overflowX = overflowX;
} else if (overflowY) {
style.overflowY = overflowY;
} else {
style.overflow = "hidden";
}
return jsxRuntimeExports.jsxs("div", {
className: "vis-widget-body",
style,
children: [
this.state.editMode ? jsxRuntimeExports.jsx("div", {
className: "vis-editmode-helper"
}) : null,
view ? super.getWidgetView(view) : null
]
});
}
renderWidgetBody(props) {
super.renderWidgetBody(props);
if (props.style.width === void 0) {
props.style.width = 250;
}
if (props.style.height === void 0) {
props.style.height = 250;
}
const tabs = [];
for (let t = 0; t < parseInt(this.state.rxData.show_tabs, 10); t++) {
const color = this.state.rxData[`icon_color_${t + 1}`];
const icon = this.state.rxData[`icon_tab_${t + 1}`];
let image = this.state.rxData[`image_tab_${t + 1}`];
const size = this.state.rxData[`icon_size_${t + 1}`];
const title = this.state.rxData[`title_tab_${t + 1}`];
if (image && image.startsWith("_PRJ_NAME/")) {
image = image.replace("_PRJ_NAME/", `../${this.props.context.adapterName}.${this.props.context.instance}/${this.props.context.projectName}/`);
}
tabs.push(jsxRuntimeExports.jsx(__mf_109, {
label: title || (icon || image ? "" : `Tab ${t + 1}`),
icon: icon ? jsxRuntimeExports.jsx(__mf_15, {
src: icon,
style: {
color,
width: size,
height: size
}
}) : image ? jsxRuntimeExports.jsx(__mf_15, {
src: image,
style: {
width: size,
height: size
}
}) : null,
iconPosition: "start",
value: t,
style: {
color: this.state.rxData.color,
textTransform: "none"
},
wrapped: true
}, t.toString()));
}
return jsxRuntimeExports.jsxs("div", {
className: "vis-widget-body",
style: {
display: "flex",
flexDirection: this.state.rxData.vertical ? "row" : "column"
},
children: [
jsxRuntimeExports.jsx("div", {
style: {
width: "100%",
overflow: "hidden"
},
children: jsxRuntimeExports.jsx(__mf_120, {
TabIndicatorProps: {
style: {
backgroundColor: this.state.rxData.color
}
},
value: this.state.tabIndex || 0,
onChange: (_e, tabIndex) => {
window.localStorage.setItem(`${this.props.id}-tabIndex`, tabIndex.toString());
this.setState({
tabIndex
});
},
scrollButtons: "auto",
centered: this.state.rxData.variant === "centered",
variant: this.state.rxData.variant === "fullWidth" ? "fullWidth" : this.state.rxData.variant === "centered" ? void 0 : "scrollable",
orientation: this.state.rxData.vertical ? "vertical" : void 0,
children: tabs
})
}),
this.getWidgetView()
]
});
}
}
class InstallSwipe {
el;
locked = false;
x0 = null;
onSwipeLeft = null;
onSwipeRight = null;
hideIndication = false;
indicationLeft = "";
indicationRight = "";
swipeThreshold = 30;
indicatorNode = null;
constructor(options) {
this.onSwipeRight = options.onSwipeRight;
this.onSwipeLeft = options.onSwipeLeft;
}
install(el, options) {
if (el) {
this.el = el;
}
if (options) {
if (options.hideIndication !== void 0) {
this.hideIndication = options.hideIndication;
}
if (options.indicationLeft !== void 0) {
this.indicationLeft = options.indicationLeft;
}
if (options.indicationRight !== void 0) {
this.indicationRight = options.indicationRight;
}
if (options.swipeThreshold !== void 0) {
this.swipeThreshold = Math.abs(options.swipeThreshold) || 30;
}
}
this.init();
}
destroy() {
var _a;
if ((_a = this.el) == null ? void 0 : _a._swipe) {
this.el.removeEventListener("mousedown", this.moveStart, false);
this.el.removeEventListener("touchstart", this.moveStart, false);
delete this.el._swipe;
this.removeIndicator();
}
}
static unify(e) {
return e.changedTouches ? e.changedTouches[0] : e;
}
move = (e) => {
e.preventDefault();
if (this.locked) {
const dx = InstallSwipe.unify(e).clientX - this.x0;
if (dx > 0 && this.onSwipeRight && this.indicationRight) {
this.el.style.transform = `translateX(${dx}px)`;
} else if (dx < 0 && this.onSwipeLeft && this.indicationLeft) {
this.el.style.transform = `translateX(${dx}px)`;
}
if (Math.abs(dx) > this.swipeThreshold) {
this.showIndication(dx);
} else if (this.indicatorNode) {
this.indicatorNode.style.display = "none";
}
}
};
removeIndicator() {
if (this.indicatorNode) {
this.indicatorNode.remove();
this.indicatorNode = null;
}
if (this.locked) {
if (this.el) {
this.el.style.transform = "";
this.el.removeEventListener("mousemove", this.move, false);
this.el.removeEventListener("touchmove", this.move, false);
this.el.removeEventListener("mouseup", this.moveEnd, false);
this.el.removeEventListener("touchend", this.moveEnd, false);
}
this.x0 = null;
this.locked = false;
}
}
moveEnd = (e) => {
if (this.locked) {
const dx = InstallSwipe.unify(e).clientX - this.x0;
this.removeIndicator();
if (dx > this.swipeThreshold && this.onSwipeRight) {
this.onSwipeRight();
} else if (dx < -1 * this.swipeThreshold && this.onSwipeLeft) {
this.onSwipeLeft();
}
}
};
moveStart = (e) => {
if (!this.locked) {
this.locked = true;
this.x0 = InstallSwipe.unify(e).clientX;
this.el.addEventListener("mousemove", this.move, false);
this.el.addEventListener("touchmove", this.move, false);
this.el.addEventListener("mouseup", this.moveEnd, false);
this.el.addEventListener("touchend", this.moveEnd, false);
}
};
init() {
if (!this.el._swipe) {
this.el.addEventListener("mousedown", this.moveStart, false);
this.el.addEventListener("touchstart", this.moveStart, false);
this.el._swipe = true;
}
}
showIndication(dx) {
if (this.hideIndication) {
return;
}
if (!this.indicatorNode) {
this.indicatorNode = document.createElement("div");
this.indicatorNode.style.position = "absolute";
this.indicatorNode.setAttribute("id", "vis-2-swipe-indicator");
this.indicatorNode.style.top = "calc(50% - 16px)";
this.indicatorNode.style.zIndex = "2000";
this.indicatorNode.style.fontSize = "32px";
this.el.parentNode.appendChild(this.indicatorNode);
}
if (dx > this.swipeThreshold) {
this.indicatorNode.innerHTML = `\u2190 ${this.indicationRight}`;
this.indicatorNode.style.left = "5%";
this.indicatorNode.style.right = "";
this.indicatorNode.style.display = "block";
} else if (dx < -1 * this.swipeThreshold) {
this.indicatorNode.innerHTML = `${this.indicationLeft} \u2192`;
this.indicatorNode.style.right = "5%";
this.indicatorNode.style.left = "";
this.indicatorNode.style.display = "block";
} else {
this.indicatorNode.style.display = "none";
}
}
}
class Swipe extends VisRxWidget {
swipeable = null;
static getWidgetInfo() {
return {
id: "tplSwipe",
visSet: "swipe",
visName: "Swipe Navigation",
visSetLabel: "vis_2_widgets_widgets_swipe_label",
visPrev: "widgets/swipe/img/Prev_Swipe.png",
visWidgetLabel: "vis_2_widgets_widgets_swipe_label",
visSetIcon: "widgets/swipe/img/Prev_Swipe.png",
visAttrs: [
{
name: "common",
fields: [
{
name: "left_nav_view",
type: "select-views",
multiple: false
},
{
name: "right_nav_view",
type: "select-views",
multiple: false
},
{
name: "hideIndication",
label: "vis_2_widgets_swipe_hide_indication_label",
type: "checkbox"
},
{
name: "threshold",
label: "vis_2_widgets_swipe_threshold_label",
type: "number",
default: 30
}
]
}
],
visDefaultStyle: {
width: 160,
height: 82
}
};
}
componentDidMount() {
super.componentDidMount();
this.swipeable = this.swipeable || new InstallSwipe({
onSwipeLeft: () => {
if (this.state.rxData.left_nav_view) {
this.props.context.changeView(this.state.rxData.left_nav_view);
}
},
onSwipeRight: () => {
if (this.state.rxData.right_nav_view) {
this.props.context.changeView(this.state.rxData.right_nav_view);
}
}
});
}
getWidgetInfo() {
return Swipe.getWidgetInfo();
}
renderWidgetBody(props) {
var _a, _b, _c, _d;
super.renderWidgetBody(props);
if (this.props.editMode) {
(_a = this.swipeable) == null ? void 0 : _a.destroy();
return jsxRuntimeExports.jsxs("div", {
className: "vis-widget-body",
children: [
jsxRuntimeExports.jsx("div", {
style: {
fontWeight: "bold"
},
children: __mf_2.t("Swipe Navigation")
}),
jsxRuntimeExports.jsx("table", {
children: jsxRuntimeExports.jsxs("tbody", {
children: [
jsxRuntimeExports.jsxs("tr", {
children: [
jsxRuntimeExports.jsx("td", {
style: {
width: 40
},
children: __mf_2.t("left")
}),
jsxRuntimeExports.jsx("td", {
style: {
width: 20
},
children: ">"
}),
jsxRuntimeExports.jsx("td", {
children: this.state.rxData.left_nav_view
})
]
}),
jsxRuntimeExports.jsxs("tr", {
children: [
jsxRuntimeExports.jsx("td", {
style: {
width: 40
},
children: __mf_2.t("right")
}),
jsxRuntimeExports.jsx("td", {
style: {
width: 20
},
children: "<"
}),
jsxRuntimeExports.jsx("td", {
children: this.state.rxData.right_nav_view
})
]
})
]
})
})
]
});
}
const viewEl = (_b = this.props.refParent) == null ? void 0 : _b.current;
if (this.swipeable && viewEl) {
this.swipeable.install(viewEl, {
hideIndication: this.state.rxData.hideIndication,
indicationRight: this.state.rxData.right_nav_view ? ((_c = this.props.context.views[this.state.rxData.right_nav_view]) == null ? void 0 : _c.name) || this.state.rxData.right_nav_view : "",
indicationLeft: this.state.rxData.left_nav_view ? ((_d = this.props.context.views[this.state.rxData.left_nav_view]) == null ? void 0 : _d.name) || this.state.rxData.left_nav_view : "",
swipeThreshold: this.state.rxData.threshold || 30
});
}
return null;
}
}
const WIDGETS = [
BasicBar,
BasicBulb,
BasicHtml,
BasicHtmlNav,
BasicFilterDropdown,
BasicLink,
BasicValueString,
BasicValueInput,
BasicViewInWidget,
BasicViewInWidget8,
BasicGroup,
BasicSvgBool,
BasicRedNumber,
BasicSvgShape,
BasicScreenResolution,
BasicSpeechToText,
BasicIFrame,
BasicIFrame8,
BasicImage,
BasicImage8,
BasicFrame,
BasicNote,
BasicLogout,
JQuiButton,
JQuiButtonBlank,
JQuiIconLink,
JQuiIconInc,
JQuiIconHttpGet,
JQuiDialog,
JQuiIconDialog,
JQuiContainerDialog,
JQuiButtonNavigation,
JQuiIconNavigation,
JQuiButtonPasswordNavigation,
JQuiDialogExternal,
JQuiContainerButtonDialog,
JQuiContainerIconDialog,
JQuiButtonDialogClose,
JQuiInput,
JQuiInputSet,
JQuiBinaryState,
JQuiRadio,
JQuiState,
JQuiRadioList,
JQuiSelectList,
JQuiRadioSteps,
JQuiWriteState,
JQuiSlider,
JQuiSliderVertical,
JQuiIconStatePushButton,
JQuiIconStateBool,
JQuiInputDate,
JQuiInputDateTime,
JQuiToggle,
TabsSliderTabs,
Swipe
];
const DEFAULT_SET_COLORS = {
basic: "#f1f1f1",
bars: "#f6594e",
dwd: "#cb8928",
echarts: "#98B1C0",
eventlist: "#c52699",
hqwidgets: "#005067",
jqplot: "#00e753",
jqui: "#008be0",
metro: "#9f8ad8",
swipe: "#858585",
tabs: "#00d5a3",
"spotify-premium": "#00ae03"
};
const getWidgetTypes = (usedWidgetSets) => {
if (!window.visWidgetTypes) {
window.visSets = {};
VisWidgetsCatalog.allWidgetsList = [];
if (!VisWidgetsCatalog.rxWidgets) {
return [];
}
window.visWidgetTypes = Array.from(document.querySelectorAll('script[type="text/ejs"]')).map((script) => {
var _a, _b, _c;
const name = script.getAttribute("id");
if (!name || !VisWidgetsCatalog.rxWidgets) {
return null;
}
let info;
if ((_a = VisWidgetsCatalog.rxWidgets[name]) == null ? void 0 : _a.getWidgetInfo) {
info = VisWidgetsCatalog.rxWidgets[name].getWidgetInfo();
if ((info == null ? void 0 : info.visAttrs) && typeof info.visAttrs !== "string") {
return null;
}
}
const widgetSet = script.getAttribute("data-vis-set") || "basic";
if (usedWidgetSets && !usedWidgetSets.includes(widgetSet)) {
console.log(`Ignored ${widgetSet}/${name} because not used in project`);
return null;
}
const color = script.getAttribute("data-vis-color");
(_b = window.visSets)[widgetSet] || (_b[widgetSet] = {});
if (color) {
window.visSets[widgetSet].color = color;
} else if (!window.visSets[widgetSet].color && DEFAULT_SET_COLORS[widgetSet]) {
window.visSets[widgetSet].color = DEFAULT_SET_COLORS[widgetSet];
}
const widgetObj = {
name,
title: (info == null ? void 0 : info.visName) || script.getAttribute("data-vis-name") || void 0,
label: (info == null ? void 0 : info.visWidgetLabel) || (info == null ? void 0 : info.visWidgetLabel) === "" ? info.visWidgetLabel : void 0,
preview: (info == null ? void 0 : info.visPrev) || script.getAttribute("data-vis-prev") || void 0,
help: script.getAttribute("data-vis-help") || void 0,
set: (info == null ? void 0 : info.visSet) || widgetSet,
imageHTML: script.getAttribute("data-vis-prev") || "",
init: script.getAttribute("data-vis-init") || void 0,
color: (info == null ? void 0 : info.visWidgetColor) || void 0,
params: (info == null ? void 0 : info.visAttrs) || Object.values(script.attributes).filter((attribute) => attribute.name.startsWith("data-vis-attrs")).map((attribute) => attribute.value).join(""),
setLabel: (info == null ? void 0 : info.visSetLabel) || void 0,
setColor: (info == null ? void 0 : info.visSetColor) || void 0,
order: (info == null ? void 0 : info.visOrder) === void 0 || (info == null ? void 0 : info.visOrder) === null ? 1e3 : typeof info.visOrder === "string" ? parseInt(info.visOrder, 10) : info.visOrder,
hidden: script.getAttribute("data-vis-no-palette") === "true"
};
(_c = VisWidgetsCatalog.allWidgetsList) == null ? void 0 : _c.push(widgetObj.name);
return widgetObj;
}).filter((w) => w);
const widgets = Object.values(VisWidgetsCatalog.rxWidgets);
widgets.forEach((widget) => {
var _a;
const widgetInfo = widget.getWidgetInfo();
const i18nPrefix = widget.i18nPrefix || "";
const widgetObj = {
name: widgetInfo.id,
preview: widgetInfo.visPrev,
title: widgetInfo.visName,
params: widgetInfo.visAttrs,
set: widgetInfo.visSet,
style: widgetInfo.visDefaultStyle,
label: widgetInfo.visWidgetLabel ? i18nPrefix + widgetInfo.visWidgetLabel : widgetInfo.visWidgetLabel === "" ? "" : void 0,
setLabel: widgetInfo.visSetLabel ? i18nPrefix + widgetInfo.visSetLabel : void 0,
setColor: widgetInfo.visSetColor,
setIcon: widgetInfo.visSetIcon || (widget.setIcon && widget.adapter && widget.setIcon ? `../adapter/${widget.adapter}/${widget.setIcon}` : void 0),
color: widgetInfo.visWidgetColor,
resizable: widgetInfo.visResizable,
resizeLocked: widgetInfo.visResizeLocked,
draggable: widgetInfo.visDraggable,
adapter: widget.adapter || void 0,
version: widget.version || void 0,
hidden: widget.visHidden,
order: widgetInfo.visOrder === void 0 ? 1e3 : widgetInfo.visOrder,
customPalette: widgetInfo.customPalette,
rx: true,
developerMode: (_a = widget.url) == null ? void 0 : _a.startsWith("http://"),
i18nPrefix
};
if (VisWidgetsCatalog.allWidgetsList && !VisWidgetsCatalog.allWidgetsList.includes(widgetObj.name)) {
VisWidgetsCatalog.allWidgetsList.push(widgetObj.name);
}
const index = window.visWidgetTypes.findIndex((item) => item.name === widgetObj.name);
if (index > -1) {
window.visWidgetTypes[index] = widgetObj;
} else {
window.visWidgetTypes.push(widgetObj);
}
if (i18nPrefix && typeof widgetInfo.visAttrs === "object") {
widgetInfo.visAttrs.forEach((group) => {
if (group.label && !group.label.startsWith(i18nPrefix)) {
group.label = i18nPrefix + group.label;
}
if (group.fields) {
group.fields.forEach((field) => {
const _field = field;
if (_field.label && !_field.label.startsWith(i18nPrefix)) {
_field.label = i18nPrefix + _field.label;
}
if (_field.tooltip && !_field.tooltip.startsWith(i18nPrefix)) {
_field.tooltip = i18nPrefix + _field.tooltip;
}
if (_field.options && !_field.noTranslation && Array.isArray(_field.options)) {
_field.options.forEach((option) => {
if (typeof option === "object") {
if (option.label && !option.label.startsWith(i18nPrefix)) {
option.label = i18nPrefix + option.label;
}
}
});
}
});
}
});
}
});
}
return window.visWidgetTypes;
};
class VisWidgetsCatalog {
static rxWidgets = null;
static allWidgetsList = null;
static additionalSets = null;
static getUsedWidgetSets(project) {
let anyWithoutSet = false;
const widgetSets = [];
const views = Object.keys(project);
for (let v = 0; v < views.length; v++) {
if (views[v] === "___settings") {
continue;
}
const widgets = project[views[v]].widgets;
const keys2 = Object.keys(widgets);
for (let w = 0; w < keys2.length; w++) {
const widgetSet = widgets[keys2[w]].widgetSet;
if (!widgetSet || widgets[keys2[w]].wSet || widgets[keys2[w]].set) {
anyWithoutSet = true;
break;
}
if (!widgetSets.includes(widgetSet)) {
widgetSets.push(widgetSet);
}
}
if (anyWithoutSet) {
console.warn("Found widgets without widget set. Will load all widget sets");
break;
}
}
!anyWithoutSet && widgetSets.sort();
return anyWithoutSet ? false : widgetSets;
}
static setUsedWidgetSets(project) {
let views;
const widgetTypes = window.visWidgetTypes;
const viewKeys = Object.keys(project);
for (let v = 0; v < viewKeys.length; v++) {
if (viewKeys[v] === "___settings") {
continue;
}
const widgets = project[viewKeys[v]].widgets;
const keys2 = Object.keys(widgets);
for (let w = 0; w < keys2.length; w++) {
if (widgets[keys2[w]].set) {
views || (views = JSON.parse(JSON.stringify(project)));
delete views[viewKeys[v]].widgets[keys2[w]].set;
}
if (widgets[keys2[w]].wSet) {
views || (views = JSON.parse(JSON.stringify(project)));
delete views[viewKeys[v]].widgets[keys2[w]].wSet;
}
if (widgets[keys2[w]].widgetSet) {
continue;
}
const tpl = widgets[keys2[w]].tpl;
if (tpl === "_tplGroup") {
views || (views = JSON.parse(JSON.stringify(project)));
views[viewKeys[v]].widgets[keys2[w]].widgetSet = "basic";
} else {
const tplWidget = widgetTypes.find((item) => item.name === tpl);
if (tplWidget) {
views || (views = JSON.parse(JSON.stringify(project)));
views[viewKeys[v]].widgets[keys2[w]].widgetSet = tplWidget.set;
}
}
}
}
return views;
}
static collectRxInformation(socket, project, changeProject) {
if (!VisWidgetsCatalog.rxWidgets) {
VisWidgetsCatalog.rxWidgets = {};
let usedWidgetSets = null;
if (project) {
usedWidgetSets = VisWidgetsCatalog.getUsedWidgetSets(project);
}
return new Promise((resolve) => {
setTimeout(() => getRemoteWidgets(socket, !changeProject && usedWidgetSets ? usedWidgetSets : false).then((result) => {
const collectedWidgets = [
...WIDGETS,
...(result == null ? void 0 : result.widgetSets) || []
];
VisWidgetsCatalog.additionalSets = (result == null ? void 0 : result.additionalSets) || {};
collectedWidgets.forEach((WidgetEl) => {
if (!(WidgetEl == null ? void 0 : WidgetEl.getWidgetInfo)) {
console.error(`Invalid widget without getWidgetInfo: ${WidgetEl.constructor.name}`);
} else {
const info = WidgetEl.getWidgetInfo();
if (!info.visSet) {
console.error(`No visSet in info for "${WidgetEl.constructor.name}"`);
}
if (!info.id) {
console.error(`No id in info for "${WidgetEl.constructor.name}"`);
} else if (VisWidgetsCatalog.rxWidgets) {
VisWidgetsCatalog.rxWidgets[info.id] = WidgetEl;
}
}
});
if (changeProject) {
getWidgetTypes();
} else if (usedWidgetSets) {
getWidgetTypes(usedWidgetSets);
} else {
getWidgetTypes();
}
if (usedWidgetSets === false && changeProject) {
const newProject = VisWidgetsCatalog.setUsedWidgetSets(project);
if (newProject) {
console.warn("Found widgets without widget set. Project updated");
changeProject(newProject);
}
}
resolve(VisWidgetsCatalog.rxWidgets);
}), 0);
});
}
return Promise.resolve(VisWidgetsCatalog.rxWidgets);
}
}
const MAX_COLUMNS = 8;
class VisView extends React.Component {
static Z_INDEXES = {
VIEW_SELECT_RECTANGLE: 1201,
WIDGET_SERVICE_DIV: 1200
};
calculateRelativeWidgetPosition = null;
static themeCache = {};
promiseToCollect;
refView;
refRelativeView;
refRelativeColumnsView;
widgetsRefs;
selectDiv;
movement;
theme;
ignoreMouseEvents;
oldFilter;
registerDone = false;
lastClick = 0;
nextClickIsSteal = null;
loadingTheme = false;
moveTimer = null;
keysHandlerInstalled = false;
constructor(props) {
super(props);
this.promiseToCollect = VisWidgetsCatalog.collectRxInformation(props.context.socket, store.getState().visProject, props.context.changeProject);
this.state = {
mounted: false,
rulers: [],
loadedjQueryTheme: "",
themeCode: "",
width: 0,
menuWidth: window.localStorage.getItem("vis.menuWidth") || "full"
};
this.refView = React.createRef();
this.refRelativeView = React.createRef();
this.refRelativeColumnsView = new Array(MAX_COLUMNS);
for (let r = 0; r < MAX_COLUMNS; r++) {
this.refRelativeColumnsView[r] = React.createRef();
}
this.widgetsRefs = {};
this.selectDiv = null;
this.movement = null;
this.theme = {};
this.ignoreMouseEvents = false;
this.oldFilter = JSON.stringify(props.viewsActiveFilter && props.viewsActiveFilter[this.props.view] || []);
}
async componentDidMount() {
this.updateViewWidth();
await this.promiseToCollect;
this.props.context.linkContext.registerViewRef(this.props.view, this.refView, this.onCommand);
await this.loadJqueryTheme(this.getJQueryThemeName());
this.setState({
mounted: true
}, () => this.registerEditorHandlers());
}
componentWillUnmount() {
var _a;
this.props.context.linkContext.unregisterViewRef(this.props.view, this.refView);
if ((_a = this.refView.current) == null ? void 0 : _a._originalParent) {
this.refView.current._originalParent.appendChild(this.refView.current);
this.refView.current._originalParent = null;
}
if (this.selectDiv) {
this.selectDiv.remove();
this.selectDiv = null;
}
this.widgetsRefs = {};
this.registerEditorHandlers(true);
this.uninstallKeyHandlers();
}
onCommand = (command, options) => {
var _a;
if (command === "updateContainers") {
Object.keys(this.widgetsRefs).forEach((wid) => {
var _a2;
if ((_a2 = this.widgetsRefs[wid]) == null ? void 0 : _a2.onCommand) {
this.widgetsRefs[wid].onCommand("updateContainers");
}
});
return null;
}
if (command === "changeFilter") {
this.changeFilter(options);
return null;
}
if (command === "closeDialog" || command === "openDialog") {
if ((_a = this.widgetsRefs[options]) == null ? void 0 : _a.onCommand) {
this.widgetsRefs[options].onCommand(command);
}
return null;
}
if (command === "collectFilters") {
const widgets = store.getState().visProject[this.props.view].widgets;
const filterList = [];
Object.keys(widgets).forEach((wid) => {
var _a2, _b, _c, _d;
let filterValues;
if ((_a2 = this.widgetsRefs[wid]) == null ? void 0 : _a2.onCommand) {
filterValues = (_b = this.widgetsRefs[wid]) == null ? void 0 : _b.onCommand("collectFilters");
} else {
filterValues = (_d = (_c = widgets[wid]) == null ? void 0 : _c.data) == null ? void 0 : _d.filterkey;
}
if (filterValues) {
if (filterValues && typeof filterValues === "string") {
filterValues = filterValues.split(",").map((f) => f.trim()).filter((f) => f);
}
filterValues.forEach((f) => !filterList.includes(f) && filterList.push(f));
}
});
return filterList;
}
return null;
};
changeFilter(options) {
options = {
filter: [],
...options
};
if (options.filter) {
this.props.viewsActiveFilter[this.props.view] = options.filter;
Object.keys(this.widgetsRefs).forEach((wid) => {
var _a;
if ((_a = this.widgetsRefs[wid]) == null ? void 0 : _a.onCommand) {
this.widgetsRefs[wid].onCommand("changeFilter");
}
});
if (window.vis.binds.bars && window.vis.binds.bars.filterChanged) {
try {
window.vis.binds.bars.filterChanged(this.props.view, options.filter.join(","));
} catch (error) {
console.error(`Cannot change filter: ${error}`);
}
}
}
return null;
}
askView = (command, props) => {
const widgetsRefs = this.widgetsRefs;
if (command === "register") {
if (props) {
const id = props.id;
widgetsRefs[id] = props;
}
} else if (command === "unregister") {
if (props && widgetsRefs[props.id] && widgetsRefs[props.id].uuid === props.uuid) {
delete widgetsRefs[props.id];
}
} else if (command === "update") {
if (props && widgetsRefs[props.id] && widgetsRefs[props.id].uuid === props.uuid) {
Object.assign(widgetsRefs[props.id], props);
}
} else if (command === "getRef") {
if (props) {
return widgetsRefs[props.id];
}
} else if (command === "getViewClass") {
return this;
}
return null;
};
onMouseWindowDown = (e) => {
var _a;
if (!((_a = this.refView.current) == null ? void 0 : _a.contains(e.target))) {
this.cancelStealMode(null);
}
};
onStealStyle = (attr, cb) => {
if (!attr) {
this.cancelStealMode(null);
return;
}
this.nextClickIsSteal = {
attr,
cb
};
Object.keys(this.widgetsRefs).forEach((wid) => {
var _a;
if ((_a = this.widgetsRefs[wid]) == null ? void 0 : _a.onCommand) {
this.widgetsRefs[wid].onCommand("startStealMode");
}
});
window.document.addEventListener("mousedown", this.onMouseWindowDown);
};
cancelStealMode(result) {
if (this.nextClickIsSteal) {
window.document.removeEventListener("mousedown", this.onMouseWindowDown);
this.nextClickIsSteal.cb(result);
Object.keys(this.widgetsRefs).forEach((wid) => {
var _a;
const onCommand = (_a = this.widgetsRefs[wid]) == null ? void 0 : _a.onCommand;
if (onCommand) {
onCommand("cancelStealMode");
}
});
this.nextClickIsSteal = null;
}
}
mouseDownLocal = this.props.context.runtime ? null : (e) => {
var _a;
if (this.ignoreMouseEvents) {
return;
}
if (e.button === 2) {
return;
}
if (this.nextClickIsSteal) {
this.cancelStealMode(null);
return;
}
this.props.context.setSelectedWidgets([]);
this.onMouseViewMove && window.document.addEventListener("mousemove", this.onMouseViewMove);
this.onMouseViewUp && window.document.addEventListener("mouseup", this.onMouseViewUp);
const rect = (_a = this.refView.current) == null ? void 0 : _a.getBoundingClientRect();
if (!rect) {
return;
}
this.movement = {
moved: false,
x: e.clientX - rect.left,
y: e.clientY - rect.top,
startX: e.pageX,
startY: e.pageY,
w: 0,
h: 0,
selectedWidgetsWithRectangle: [],
simpleMode: e.shiftKey || e.ctrlKey
};
};
doubleClickOnView = () => {
var _a;
if (this.props.editMode && ((_a = this.props.selectedWidgets) == null ? void 0 : _a.length) === 1 && store.getState().visProject[this.props.view].widgets[this.props.selectedWidgets[0]].tpl === "_tplGroup") {
this.props.context.setSelectedGroup(this.props.selectedWidgets[0]);
}
};
getWidgetsInRect(rect, simpleMode) {
const widgets = Object.keys(this.widgetsRefs).filter((id) => {
var _a;
if (!store.getState().visProject[this.props.view].widgets[id]) {
id !== "fakeId" && console.warn(`Orphaned widget ${id} found!`);
return null;
}
if (store.getState().visProject[this.props.view].widgets[id].groupid && !this.props.selectedGroup) {
return null;
}
const widDiv = this.widgetsRefs[id].widDiv || ((_a = this.widgetsRefs[id].refService) == null ? void 0 : _a.current);
if (widDiv) {
const wRect = widDiv.getBoundingClientRect();
if (simpleMode) {
if (wRect.top >= rect.top && wRect.top <= rect.bottom && wRect.left >= rect.left && wRect.left <= rect.right) {
return true;
}
if (wRect.bottom >= rect.top && wRect.bottom <= rect.bottom && wRect.right >= rect.left && wRect.right <= rect.right) {
return true;
}
if (wRect.top >= rect.top && wRect.top <= rect.bottom && wRect.right >= rect.left && wRect.right <= rect.right) {
return true;
}
if (wRect.bottom >= rect.top && wRect.bottom <= rect.bottom && wRect.left >= rect.left && wRect.left <= rect.right) {
return true;
}
} else if (wRect.top >= rect.top && wRect.top <= rect.bottom && wRect.left >= rect.left && wRect.left <= rect.right && wRect.bottom >= rect.top && wRect.bottom <= rect.bottom && wRect.right >= rect.left && wRect.right <= rect.right) {
return true;
}
}
return false;
});
widgets.sort();
return widgets;
}
onMouseViewMove = !this.props.context.runtime ? (e) => {
if (this.ignoreMouseEvents || !this.movement) {
return;
}
if (!this.selectDiv && this.refView.current) {
this.selectDiv = window.document.createElement("div");
this.selectDiv.style.position = "absolute";
this.selectDiv.style.zIndex = VisView.Z_INDEXES.VIEW_SELECT_RECTANGLE.toString();
this.selectDiv.className = "vis-editmode-select-rect";
this.refView.current.appendChild(this.selectDiv);
}
this.movement.moved = true;
this.movement.w = e.pageX - (this.movement.startX || 0);
this.movement.h = e.pageY - (this.movement.startY || 0);
if (this.selectDiv) {
if (this.movement.w >= 0) {
this.selectDiv.style.left = `${this.movement.x}px`;
this.selectDiv.style.width = `${this.movement.w}px`;
} else {
this.selectDiv.style.left = `${this.movement.x + this.movement.w}px`;
this.selectDiv.style.width = `${-this.movement.w}px`;
}
if (this.movement.h >= 0) {
this.selectDiv.style.top = `${this.movement.y}px`;
this.selectDiv.style.height = `${this.movement.h}px`;
} else {
this.selectDiv.style.top = `${this.movement.y + this.movement.h}px`;
this.selectDiv.style.height = `${-this.movement.h}px`;
}
const widgets = this.getWidgetsInRect(this.selectDiv.getBoundingClientRect(), this.movement.simpleMode || false);
if (this.movement.selectedWidgetsWithRectangle && JSON.stringify(widgets) !== JSON.stringify(this.movement.selectedWidgetsWithRectangle)) {
widgets.forEach((id) => {
var _a, _b, _c;
if (!((_b = (_a = this.movement) == null ? void 0 : _a.selectedWidgetsWithRectangle) == null ? void 0 : _b.includes(id)) && this.widgetsRefs[id] && !store.getState().visProject[this.props.view].widgets[id].data.locked && this.props.selectedGroup !== id) {
if ((_c = this.widgetsRefs[id]) == null ? void 0 : _c.onTempSelect) {
this.widgetsRefs[id].onTempSelect(true);
}
}
});
this.movement.selectedWidgetsWithRectangle.forEach((id) => {
var _a;
if (!widgets.includes(id) && ((_a = this.widgetsRefs[id]) == null ? void 0 : _a.onTempSelect)) {
this.widgetsRefs[id].onTempSelect(false);
}
});
this.movement.selectedWidgetsWithRectangle = widgets.filter((widget) => !store.getState().visProject[this.props.view].widgets[widget].data.locked);
}
}
} : null;
onMouseViewUp = !this.props.context.runtime ? (e) => {
var _a;
if (this.ignoreMouseEvents) {
return;
}
e && e.stopPropagation();
this.onMouseViewMove && window.document.removeEventListener("mousemove", this.onMouseViewMove);
this.onMouseViewUp && window.document.removeEventListener("mouseup", this.onMouseViewUp);
if (this.selectDiv) {
this.selectDiv.remove();
this.selectDiv = null;
}
((_a = this.movement) == null ? void 0 : _a.selectedWidgetsWithRectangle) && this.props.context.setSelectedWidgets(this.movement.selectedWidgetsWithRectangle);
this.movement = null;
} : null;
mouseDownOnView = this.props.context.runtime ? null : (e, wid, _isRelative, isResize, isDoubleClick) => {
var _a, _b;
if (this.ignoreMouseEvents) {
return;
}
if (this.nextClickIsSteal) {
if (this.widgetsRefs[wid]) {
const ref = this.widgetsRefs[wid].widDiv || ((_a = this.widgetsRefs[wid].refService) == null ? void 0 : _a.current);
this.cancelStealMode(ref ? ref.style[this.nextClickIsSteal.attr] : null);
} else {
this.cancelStealMode(null);
}
return;
}
if (this.props.context.disableInteraction || this.props.context.lockDragging || this.props.selectedWidgets.map((selectedWidget) => store.getState().visProject[this.props.view].widgets[selectedWidget]).find((widget) => widget.data.locked)) {
return;
}
if (this.lastClick && Date.now() - this.lastClick < 250 || isDoubleClick) {
this.lastClick = Date.now();
if (this.props.selectedWidgets.length === 1 && store.getState().visProject[this.props.view].widgets[this.props.selectedWidgets[0]].tpl === "_tplGroup") {
this.props.context.setSelectedGroup(this.props.selectedWidgets[0]);
}
return;
}
this.lastClick = Date.now();
if (this.props.selectedWidgets.includes(this.props.selectedGroup) && !isResize) {
return;
}
this.onMouseWidgetMove && ((_b = this.refView.current) == null ? void 0 : _b.addEventListener("mousemove", this.onMouseWidgetMove));
this.onMouseWidgetUp && window.document.addEventListener("mouseup", this.onMouseWidgetUp);
this.movement = {
moved: false,
startX: e.pageX,
startY: e.pageY,
isResize,
x: 0,
y: 0
};
const widgetsRefs = this.widgetsRefs;
this.props.selectedWidgets.forEach((selectedWidget) => {
var _a2, _b2, _c, _d;
const widgetRect = (_b2 = (_a2 = widgetsRefs[selectedWidget].refService) == null ? void 0 : _a2.current) == null ? void 0 : _b2.getBoundingClientRect();
if (this.movement && widgetRect && e.pageX <= widgetRect.right && e.pageX >= widgetRect.left && e.pageY <= widgetRect.bottom && e.pageY >= widgetRect.top) {
this.movement.startWidget = (_d = (_c = widgetsRefs[selectedWidget].refService) == null ? void 0 : _c.current) == null ? void 0 : _d.getBoundingClientRect();
}
});
this.props.selectedWidgets.forEach((_wid) => {
var _a2;
if ((_a2 = widgetsRefs[_wid]) == null ? void 0 : _a2.onMove) {
widgetsRefs[_wid].onMove();
}
});
Object.keys(widgetsRefs).forEach((_wid) => {
var _a2;
if ((_a2 = widgetsRefs[_wid]) == null ? void 0 : _a2.onCommand) {
widgetsRefs[_wid].onCommand("startMove");
}
});
};
onIgnoreMouseEvents = (ignore) => {
var _a;
if (this.props.editMode) {
this.ignoreMouseEvents = ignore;
this.props.context.onIgnoreMouseEvents(ignore);
if (ignore && this.movement) {
this.onMouseWidgetMove && ((_a = this.refView.current) == null ? void 0 : _a.removeEventListener("mousemove", this.onMouseWidgetMove));
this.onMouseWidgetUp && window.document.removeEventListener("mouseup", this.onMouseWidgetUp);
this.movement = null;
}
}
};
onMouseWidgetMove = !this.props.context.runtime ? (e) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
if (!this.movement || !this.refView.current || this.props.selectedWidgets.includes(this.props.selectedGroup) && !this.movement.isResize) {
return;
}
const widgetsRefs = this.widgetsRefs;
this.movement.moved = true;
this.movement.x = e.pageX - (this.movement.startX || 0);
this.movement.y = e.pageY - (this.movement.startY || 0);
const viewRect = this.refView.current.getBoundingClientRect();
if (!this.movement.isResize && ((_a = store.getState().visProject[this.props.view].settings) == null ? void 0 : _a.snapType) === 2) {
const gridSize = parseInt(((_b = store.getState().visProject[this.props.view].settings) == null ? void 0 : _b.gridSize) || 0, 10) || 10;
this.movement.x -= Math.ceil(((((_c = this.movement.startWidget) == null ? void 0 : _c.left) || 0) - viewRect.left + this.movement.x) % gridSize);
this.movement.y -= Math.ceil(((((_d = this.movement.startWidget) == null ? void 0 : _d.top) || 0) - viewRect.top + this.movement.y) % gridSize);
}
if (!this.movement.isResize && ((_e = store.getState().visProject[this.props.view].settings) == null ? void 0 : _e.snapType) === 1) {
const left = (((_f = this.movement.startWidget) == null ? void 0 : _f.left) || 0) + this.movement.x;
const right = (((_g = this.movement.startWidget) == null ? void 0 : _g.right) || 0) + this.movement.x;
const top = (((_h = this.movement.startWidget) == null ? void 0 : _h.top) || 0) + this.movement.y;
const bottom = (((_i = this.movement.startWidget) == null ? void 0 : _i.bottom) || 0) + this.movement.y;
for (const wid in widgetsRefs) {
const widgetId = wid;
if (this.props.selectedWidgets.includes(widgetId)) {
continue;
}
const widgetRect = (_k = (_j = widgetsRefs[widgetId].refService) == null ? void 0 : _j.current) == null ? void 0 : _k.getBoundingClientRect();
if (widgetRect) {
if (Math.abs(widgetRect.top - bottom) <= 10 && left <= widgetRect.right && right >= widgetRect.left) {
this.movement.y += Math.round(widgetRect.top - bottom);
break;
}
if (Math.abs(widgetRect.bottom - top) <= 10 && left <= widgetRect.right && right >= widgetRect.left) {
this.movement.y += Math.round(widgetRect.bottom - top);
break;
}
if (Math.abs(widgetRect.left - right) <= 10 && top <= widgetRect.bottom && bottom >= widgetRect.top) {
this.movement.x += Math.round(widgetRect.left - right);
break;
}
if (Math.abs(widgetRect.right - left) <= 10 && top <= widgetRect.bottom && bottom >= widgetRect.top) {
this.movement.x += Math.round(widgetRect.right - left);
break;
}
}
}
}
this.showRulers();
this.props.selectedWidgets.forEach((wid) => {
var _a2;
const onMove = (_a2 = widgetsRefs[wid]) == null ? void 0 : _a2.onMove;
if (onMove && this.movement) {
onMove(this.movement.x, this.movement.y, false, this.calculateRelativeWidgetPosition);
}
const oWidget = store.getState().visProject[this.props.view].widgets[wid];
const attrs = Object.keys(oWidget.data);
attrs.forEach((attr) => {
var _a3;
if (attr.startsWith("widget") && oWidget.data[attr]) {
const onCommand = (_a3 = widgetsRefs[oWidget.data[attr]]) == null ? void 0 : _a3.onCommand;
if (onCommand) {
onCommand("updatePosition");
}
}
});
});
if (this.props.selectedWidgets.length === 1 && ((_m = (_l = widgetsRefs[this.props.selectedWidgets[0]]) == null ? void 0 : _l.refService) == null ? void 0 : _m.current)) {
let found = false;
for (const wid in widgetsRefs) {
const widgetId = wid;
if (this.props.selectedWidgets.includes(widgetId) || !widgetsRefs[widgetId] || !widgetsRefs[widgetId].canHaveWidgets || widgetsRefs[widgetId].doNotWantIncludeWidgets || !widgetsRefs[widgetId].onCommand || !((_n = widgetsRefs[widgetId].refService) == null ? void 0 : _n.current)) {
continue;
}
const baseRect = (_p = (_o = widgetsRefs[this.props.selectedWidgets[0]].refService) == null ? void 0 : _o.current) == null ? void 0 : _p.getBoundingClientRect();
const rect = (_r = (_q = widgetsRefs[widgetId].refService) == null ? void 0 : _q.current) == null ? void 0 : _r.getBoundingClientRect();
const onCommand = (_s = widgetsRefs[widgetId]) == null ? void 0 : _s.onCommand;
if (!found && baseRect && rect && baseRect.top >= rect.top && baseRect.left >= rect.left && baseRect.right <= rect.right && baseRect.bottom <= rect.bottom) {
found = true;
if (onCommand) {
onCommand("includePossible");
}
} else if (onCommand) {
onCommand("includePossibleNOT");
}
}
}
} : null;
showRulers = (hide) => {
var _a, _b, _c, _d, _e, _f;
const rulers = [];
if (hide) {
this.setState({
rulers
});
return;
}
const verticals = [];
const horizontals = [];
const viewRect = (_a = this.refView.current) == null ? void 0 : _a.getBoundingClientRect();
if (!viewRect) {
return;
}
for (const wid of Object.keys(this.widgetsRefs)) {
const widgetId = wid;
const { widgets } = selectView(store.getState(), this.props.view);
if (!this.props.selectedWidgets.includes(widgetId) && widgets[widgetId] && (this.props.selectedGroup && widgets[this.props.selectedGroup].data.members.includes(widgetId) || !this.props.selectedGroup) && (!widgets[widgetId].grouped || this.props.selectedGroup)) {
if (!((_b = this.widgetsRefs[widgetId].refService) == null ? void 0 : _b.current)) {
console.error(`CHECK WHY!!! ${widgetId} has no refService.current`);
} else {
const boundingRect = (_d = (_c = this.widgetsRefs[widgetId].refService) == null ? void 0 : _c.current) == null ? void 0 : _d.getBoundingClientRect();
if (boundingRect) {
horizontals.push(Math.round(boundingRect.top));
horizontals.push(Math.round(boundingRect.bottom));
verticals.push(Math.round(boundingRect.left));
verticals.push(Math.round(boundingRect.right));
}
}
}
}
const selectedHorizontals = [];
const selectedVerticals = [];
for (const wid of this.props.selectedWidgets) {
const { widgets } = selectView(store.getState(), this.props.view);
if (widgets[wid] && (!widgets[wid].grouped || this.props.selectedGroup)) {
const boundingRect = (_f = (_e = this.widgetsRefs[wid].refService) == null ? void 0 : _e.current) == null ? void 0 : _f.getBoundingClientRect();
if (boundingRect) {
selectedHorizontals.push(Math.round(boundingRect.top));
selectedHorizontals.push(Math.round(boundingRect.bottom));
selectedVerticals.push(Math.round(boundingRect.left));
selectedVerticals.push(Math.round(boundingRect.right));
}
}
}
horizontals.forEach((horizontal) => selectedHorizontals.forEach((selectedHorizontal) => {
if (Math.abs(horizontal - selectedHorizontal) <= 0.3) {
rulers.push({
type: "horizontal",
value: horizontal - viewRect.top
});
}
}));
verticals.forEach((vertical) => selectedVerticals.forEach((selectedVertical) => {
if (Math.abs(vertical - selectedVertical) <= 0.3) {
rulers.push({
type: "vertical",
value: vertical - viewRect.left
});
}
}));
this.setState({
rulers
});
};
onMouseWidgetUp = !this.props.context.runtime ? (e) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
const widgetsRefs = this.widgetsRefs;
e && e.stopPropagation();
this.onMouseWidgetMove && ((_a = this.refView.current) == null ? void 0 : _a.removeEventListener("mousemove", this.onMouseWidgetMove));
this.onMouseWidgetUp && window.document.removeEventListener("mouseup", this.onMouseWidgetUp);
if ((_b = this.movement) == null ? void 0 : _b.moved) {
this.props.selectedWidgets.forEach((wid) => {
var _a2;
const onMove = (_a2 = widgetsRefs[wid]) == null ? void 0 : _a2.onMove;
if (onMove && this.movement) {
onMove(this.movement.x, this.movement.y, true);
}
});
store.dispatch(recalculateFields(true));
}
Object.keys(widgetsRefs).forEach((_wid) => {
var _a2;
const onCommand = (_a2 = widgetsRefs[_wid]) == null ? void 0 : _a2.onCommand;
if (onCommand) {
onCommand("stopMove");
}
});
if (this.props.selectedWidgets.length === 1 && ((_d = (_c = widgetsRefs[this.props.selectedWidgets[0]]) == null ? void 0 : _c.refService) == null ? void 0 : _d.current)) {
for (const wid in widgetsRefs) {
const widgetId = wid;
if (this.props.selectedWidgets.includes(widgetId) || !widgetsRefs[widgetId] || !widgetsRefs[widgetId].canHaveWidgets || widgetsRefs[widgetId].doNotWantIncludeWidgets || !widgetsRefs[widgetId].onCommand || !((_e = widgetsRefs[widgetId].refService) == null ? void 0 : _e.current)) {
continue;
}
const baseRect = (_g = (_f = widgetsRefs[this.props.selectedWidgets[0]].refService) == null ? void 0 : _f.current) == null ? void 0 : _g.getBoundingClientRect();
const rect = (_i = (_h = widgetsRefs[widgetId].refService) == null ? void 0 : _h.current) == null ? void 0 : _i.getBoundingClientRect();
if (rect && baseRect && baseRect.top >= rect.top && baseRect.left >= rect.left && baseRect.right <= rect.right && baseRect.bottom <= rect.bottom) {
this.props.context.askAboutInclude(this.props.selectedWidgets[0], widgetId, (_wid, toWid) => {
var _a2;
const onCommand = (_a2 = widgetsRefs[toWid]) == null ? void 0 : _a2.onCommand;
if (onCommand) {
onCommand("include", _wid);
}
});
}
}
}
this.showRulers(true);
} : null;
editWidgetsRect(widget) {
var _a;
if (!this.refView.current) {
return null;
}
const viewLeft = this.refView.current.offsetLeft;
const viewTop = this.refView.current.offsetTop;
const ref = this.widgetsRefs[widget].widDiv || ((_a = this.widgetsRefs[widget].refService) == null ? void 0 : _a.current);
if (!ref) {
return null;
}
let top = ref.offsetTop - viewTop;
let left = ref.offsetLeft - viewLeft;
if (!left && !top) {
const style = store.getState().visProject[this.props.view].widgets[widget].style;
left = parseInt((style == null ? void 0 : style.left) || "0", 10) + parseInt(ref.offsetLeft, 10);
top = parseInt((style == null ? void 0 : style.top) || "0", 10) + parseInt(ref.offsetTop, 10);
left = left || 0;
top = top || 0;
}
return {
top,
left,
width: ref.clientWidth,
height: ref.clientHeight
};
}
pxToPercent = (oldStyle, newStyle) => {
if (!this.refView.current) {
return null;
}
const pRect = {
left: this.refView.current.clientLeft,
top: this.refView.current.clientTop,
height: this.refView.current.clientHeight,
width: this.refView.current.clientWidth
};
if (oldStyle.position === "relative") {
delete newStyle.top;
delete newStyle.left;
if (oldStyle.width === "100%") {
delete newStyle.width;
}
if (oldStyle.height === "100%") {
delete newStyle.height;
}
}
const resultStyle = {
...newStyle
};
if (newStyle.top && parseDimension(oldStyle.top).dimension === "%" && parseDimension(newStyle.top).dimension !== "%") {
resultStyle.top = parseDimension(newStyle.top).value * 100 / pRect.height;
resultStyle.top = `${Math.round(resultStyle.top * 100) / 100}%`;
}
if (newStyle.left && parseDimension(oldStyle.left).dimension === "%" && parseDimension(newStyle.left).dimension !== "%") {
resultStyle.left = parseDimension(newStyle.left).value * 100 / pRect.width;
resultStyle.left = `${Math.round(resultStyle.left * 100) / 100}%`;
}
if (newStyle.width && parseDimension(oldStyle.width).dimension === "%" && parseDimension(newStyle.width).dimension !== "%") {
resultStyle.width = parseDimension(newStyle.width).value / pRect.width * 100;
resultStyle.width = `${Math.round(resultStyle.width * 100) / 100}%`;
}
if (newStyle.height && parseDimension(oldStyle.height).dimension === "%" && parseDimension(newStyle.height).dimension !== "%") {
resultStyle.height = parseDimension(newStyle.height).value / pRect.height * 100;
resultStyle.height = `${Math.round(resultStyle.height * 100) / 100}%`;
}
return {
...oldStyle,
...resultStyle
};
};
onPxToPercent = (wids, attr, cb) => {
if (!this.refView.current) {
return [];
}
const pRect = {
height: this.refView.current.clientHeight,
width: this.refView.current.clientWidth
};
const results = wids.map((wid) => {
const wRect = this.editWidgetsRect(wid);
if (!wRect) {
return null;
}
let value;
if (attr === "top") {
value = wRect.top * 100 / pRect.height;
} else if (attr === "left") {
value = wRect.left * 100 / pRect.width;
} else if (attr === "width") {
value = wRect.width / pRect.width * 100;
} else {
value = wRect.height / pRect.height * 100;
}
return `${Math.round(value * 100) / 100}%`;
});
cb && cb(results);
return results;
};
onPercentToPx = (wids, attr, cb) => {
const results = wids.map((wid) => {
const wRect = this.editWidgetsRect(wid);
if (!wRect) {
return null;
}
return `${Math.round(wRect[attr])}px`;
});
cb && cb(results);
return results;
};
registerEditorHandlers(unregister2) {
if (this.props.context.registerEditorCallback) {
if (!unregister2 && this.props.activeView === this.props.view) {
if (!this.registerDone) {
this.registerDone = true;
this.props.context.registerEditorCallback("onStealStyle", this.props.view, this.onStealStyle);
this.props.context.registerEditorCallback("onPxToPercent", this.props.view, this.onPxToPercent);
this.props.context.registerEditorCallback("pxToPercent", this.props.view, this.pxToPercent);
this.props.context.registerEditorCallback("onPercentToPx", this.props.view, this.onPercentToPx);
}
} else {
this.registerDone = false;
this.props.context.registerEditorCallback("onStealStyle", this.props.view);
this.props.context.registerEditorCallback("onPxToPercent", this.props.view);
this.props.context.registerEditorCallback("pxToPercent", this.props.view);
this.props.context.registerEditorCallback("onPercentToPx", this.props.view);
}
}
}
updateViewWidth() {
if (this.refRelativeView.current) {
if (this.refRelativeView.current.offsetWidth !== this.state.width) {
this.setState({
width: this.refRelativeView.current.offsetWidth
});
}
}
}
componentDidUpdate() {
this.registerEditorHandlers();
this.updateViewWidth();
if (!this.props.editMode) {
const newFilter = JSON.stringify(this.props.viewsActiveFilter && this.props.viewsActiveFilter[this.props.view] || []);
if (this.oldFilter !== newFilter) {
this.oldFilter = newFilter;
this.changeFilter({
filter: JSON.parse(newFilter)
});
}
}
}
static renderGitter(step, color) {
color = color || "#D0D0D0";
step = step || 10;
const bigWidth = step * 5;
const smallWidth = step;
const gitterPattern = btoa(`<svg width="${bigWidth}" height="${bigWidth}" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="grid" width="${bigWidth}" height="${bigWidth}" patternUnits="userSpaceOnUse">
<path d="M 0 ${smallWidth} L ${bigWidth} ${smallWidth} M ${smallWidth} 0 L ${smallWidth} ${bigWidth} M 0 ${2 * smallWidth} L ${bigWidth} ${2 * smallWidth} M ${2 * smallWidth} 0 L ${2 * smallWidth} ${bigWidth} M 0 ${3 * smallWidth} L ${bigWidth} ${3 * smallWidth} M ${3 * smallWidth} 0 L ${3 * smallWidth} ${bigWidth} M 0 ${4 * smallWidth} L ${bigWidth} ${4 * smallWidth} M ${4 * smallWidth} 0 L ${4 * smallWidth} ${bigWidth}" fill="none" stroke="${color}" opacity="0.2" stroke-width="1"/>
<path d="M ${bigWidth} 0 L 0 0 0 ${bigWidth}" fill="none" stroke="${color}" stroke-width="1"/>
</pattern>
</defs>
<rect width="100%" height="100%" fill="url(#grid)"/>
</svg>`);
const backgroundImage = `url(data:image/svg+xml;base64,${gitterPattern})`;
return jsxRuntimeExports.jsx("div", {
style: {
opacity: 0.2,
zIndex: -1,
userSelect: "none",
pointerEvents: "none",
width: "100%",
height: "100%",
backgroundImage,
backgroundPosition: "-1px -1px"
}
});
}
static getOneWidget(index, widget, options) {
var _a;
if (!VisWidgetsCatalog.rxWidgets) {
return null;
}
const WidgetEl = VisWidgetsCatalog.rxWidgets[widget.tpl] || (((_a = VisWidgetsCatalog.allWidgetsList) == null ? void 0 : _a.includes(widget.tpl)) ? VisCanWidget : VisBaseWidget);
return jsxRuntimeExports.jsx(WidgetEl, {
tpl: widget.tpl,
...options
}, `${index}_${options.id}`);
}
async loadJqueryTheme(jQueryTheme) {
if (VisView.themeCache[jQueryTheme] && this.props.view) {
let data = VisView.themeCache[jQueryTheme];
const _view = `visview_${this.props.view.replace(/\s/g, "_")}`;
data = data.replace(".ui-helper-hidden", `
#${_view} .ui-helper-hidden`);
data = data.replace(/(}.)/g, `}
#${_view} .`);
data = data.replace(/,\./g, `,#${_view} .`);
data = data.replace(/images/g, `../../lib/css/themes/jquery-ui/${jQueryTheme}/images`);
this.setState({
loadedjQueryTheme: jQueryTheme,
themeCode: data
});
} else {
try {
const resp = await fetch(`../../lib/css/themes/jquery-ui/${jQueryTheme}/jquery-ui.min.css`);
let data = await resp.text();
VisView.themeCache[jQueryTheme] = data;
const _view = `visview_${this.props.view.replace(/\s/g, "_")}`;
data = data.replace(".ui-helper-hidden", `
#${_view} .ui-helper-hidden`);
data = data.replace(/(}.)/g, `}
#${_view} .`);
data = data.replace(/,\./g, `,#${_view} .`);
data = data.replace(/images/g, `../../lib/css/themes/jquery-ui/${jQueryTheme}/images`);
this.setState({
loadedjQueryTheme: jQueryTheme,
themeCode: data
});
} catch (e) {
console.warn(`Cannot load jQueryUI theme "${jQueryTheme}": ${e.stack}`);
}
}
this.loadingTheme = false;
}
getJQueryThemeName() {
var _a;
const settings = this.props.view && ((_a = store.getState().visProject[this.props.view]) == null ? void 0 : _a.settings);
return (settings == null ? void 0 : settings.theme) || "redmond";
}
installKeyHandlers() {
if (!this.keysHandlerInstalled) {
this.keysHandlerInstalled = true;
window.addEventListener("keydown", this.onKeyDown, false);
}
}
uninstallKeyHandlers() {
if (this.keysHandlerInstalled) {
this.keysHandlerInstalled = false;
window.removeEventListener("keydown", this.onKeyDown, false);
}
}
moveWidgets = (leftShift, topShift) => {
if (!this.moveTimer) {
this.movement = {
x: 0,
y: 0
};
this.props.selectedWidgets.forEach((_wid) => {
var _a;
const onMove = (_a = this.widgetsRefs[_wid]) == null ? void 0 : _a.onMove;
if (onMove) {
onMove();
}
});
Object.keys(this.widgetsRefs).forEach((_wid) => {
var _a;
const onCommand = (_a = this.widgetsRefs[_wid]) == null ? void 0 : _a.onCommand;
if (onCommand) {
onCommand("startMove");
}
});
}
if (!this.movement) {
return;
}
this.movement.x += leftShift;
this.movement.y += topShift;
this.props.selectedWidgets.forEach((wid) => {
var _a;
const widgetsRefs = this.widgetsRefs;
const onMove = (_a = widgetsRefs[wid]) == null ? void 0 : _a.onMove;
if (onMove && this.movement) {
onMove(this.movement.x, this.movement.y, false, this.calculateRelativeWidgetPosition);
}
});
this.showRulers();
this.moveTimer && clearTimeout(this.moveTimer);
this.moveTimer = setTimeout(() => {
this.moveTimer = null;
this.showRulers(true);
store.dispatch(recalculateFields(true));
this.props.selectedWidgets.forEach((wid) => {
var _a;
const onMove = (_a = this.widgetsRefs[wid]) == null ? void 0 : _a.onMove;
if (onMove && this.movement) {
onMove(this.movement.x, this.movement.y, true, this.calculateRelativeWidgetPosition);
}
});
this.movement = null;
Object.keys(this.widgetsRefs).forEach((_wid) => {
var _a;
const onCommand = (_a = this.widgetsRefs[_wid]) == null ? void 0 : _a.onCommand;
if (onCommand) {
onCommand("stopMove");
}
});
}, 800);
};
resizeWidgets = (widthShift, heightShift) => {
if (!this.moveTimer) {
this.movement = {
x: 0,
y: 0,
isResize: true
};
Object.keys(this.widgetsRefs).forEach((_wid) => {
var _a;
const onCommand = (_a = this.widgetsRefs[_wid]) == null ? void 0 : _a.onCommand;
if (onCommand) {
onCommand("startResize");
}
});
this.props.selectedWidgets.forEach((_wid) => {
var _a;
const onMove = (_a = this.widgetsRefs[_wid]) == null ? void 0 : _a.onMove;
if (onMove) {
onMove();
}
});
}
if (!this.movement) {
return;
}
this.movement.x += widthShift;
this.movement.y += heightShift;
this.props.selectedWidgets.forEach((wid) => {
var _a;
const widgetsRefs = this.widgetsRefs;
const onMove = (_a = widgetsRefs[wid]) == null ? void 0 : _a.onMove;
if (onMove && this.movement) {
onMove(this.movement.x, this.movement.y, false, this.calculateRelativeWidgetPosition);
}
});
this.showRulers();
this.moveTimer && clearTimeout(this.moveTimer);
this.moveTimer = setTimeout(() => {
this.moveTimer = null;
this.showRulers(true);
this.props.selectedWidgets.forEach((wid) => {
var _a;
const onMove = (_a = this.widgetsRefs[wid]) == null ? void 0 : _a.onMove;
if (onMove && this.movement) {
onMove(this.movement.x, this.movement.y, true, this.calculateRelativeWidgetPosition);
}
});
Object.keys(this.widgetsRefs).forEach((_wid) => {
var _a;
const onCommand = (_a = this.widgetsRefs[_wid]) == null ? void 0 : _a.onCommand;
if (onCommand) {
onCommand("stopResize");
}
});
this.movement = null;
}, 800);
};
onKeyDown = (e) => {
var _a;
if (!this.props.editMode) {
return;
}
if (((_a = document.activeElement) == null ? void 0 : _a.tagName) === "BODY") {
if (this.props.selectedWidgets.length) {
if (e.key === "ArrowLeft") {
e.preventDefault();
this[e.shiftKey ? "resizeWidgets" : "moveWidgets"](e.ctrlKey ? -10 : -1, 0);
}
if (e.key === "ArrowRight") {
e.preventDefault();
this[e.shiftKey ? "resizeWidgets" : "moveWidgets"](e.ctrlKey ? 10 : 1, 0);
}
if (e.key === "ArrowUp") {
e.preventDefault();
this[e.shiftKey ? "resizeWidgets" : "moveWidgets"](0, e.ctrlKey ? -10 : -1);
}
if (e.key === "ArrowDown") {
e.preventDefault();
this[e.shiftKey ? "resizeWidgets" : "moveWidgets"](0, e.ctrlKey ? 10 : 1);
}
}
}
};
renderScreenSize() {
var _a, _b;
const ww = parseInt(((_a = store.getState().visProject[this.props.view].settings) == null ? void 0 : _a.sizex) || 0, 10);
const hh = parseInt(((_b = store.getState().visProject[this.props.view].settings) == null ? void 0 : _b.sizey) || 0, 10);
if (!this.props.editMode || !this.props.view || !ww || !hh) {
return null;
}
return [
jsxRuntimeExports.jsx("div", {
style: {
top: 0,
left: 0,
width: `${ww}px`,
height: `${hh}px`,
position: "absolute",
borderTopWidth: 0,
borderLeftWidth: 0,
borderRightWidth: 1,
borderBottomWidth: 1,
boxSizing: "content-box",
borderStyle: "dashed",
borderColor: "black",
zIndex: 1e3,
pointerEvents: "none",
userSelect: "none",
opacity: 0.7
}
}, "black"),
jsxRuntimeExports.jsx("div", {
style: {
top: 0,
left: 0,
width: `${ww + 1}px`,
height: `${hh + 1}px`,
position: "absolute",
borderTopWidth: 0,
borderLeftWidth: 0,
borderRightWidth: 1,
borderBottomWidth: 1,
boxSizing: "content-box",
borderStyle: "dashed",
borderColor: "white",
zIndex: 1e3,
pointerEvents: "none",
userSelect: "none",
opacity: 0.7
}
}, "white")
];
}
getRelativeStyle(settings, groupId, limitScreenSize) {
var _a;
const relativeStyle = {};
if (groupId) {
const groupWidgetStyle = store.getState().visProject[this.props.view].widgets[groupId].style;
relativeStyle.width = (groupWidgetStyle == null ? void 0 : groupWidgetStyle.width) || "100%";
relativeStyle.height = (groupWidgetStyle == null ? void 0 : groupWidgetStyle.height) || "100%";
} else {
if (settings.sizex && !limitScreenSize) {
let ww = settings.sizex;
let hh = settings.sizey || 0;
if (isVarFinite(ww)) {
ww = parseFloat(ww);
}
if (isVarFinite(hh)) {
hh = parseFloat(hh);
}
if (typeof ww === "number" || ww.match(/\d$/)) {
ww = `${ww.toString()}px`;
}
if (typeof hh === "number" || hh.match(/\d$/)) {
hh = `${hh.toString()}px`;
}
relativeStyle.width = ww;
relativeStyle.height = hh;
} else {
relativeStyle.width = "100%";
relativeStyle.height = "100%";
}
relativeStyle.display = ((_a = settings.style) == null ? void 0 : _a.display) || "flex";
if (relativeStyle.display === "flex") {
relativeStyle.flexWrap = "wrap";
relativeStyle.columnGap = 8;
if (isVarFinite(settings.columnGap)) {
relativeStyle.columnGap = parseInt(settings.columnGap, 10);
}
}
}
relativeStyle.position = "absolute";
relativeStyle.top = 0;
relativeStyle.left = 0;
return relativeStyle;
}
getCountOfRelativeColumns(settings, relativeWidgetsCount) {
const width = this.state.width;
if (width) {
if (settings.columnWidth && isVarFinite(settings.columnWidth)) {
return Math.floor(this.state.width / settings.columnWidth) + 1;
}
let columns;
if (width < 600) {
columns = 1;
} else if (width < 900) {
columns = 2;
} else if (width < 1200) {
columns = 3;
} else if (width < 2064) {
columns = 4;
} else {
columns = Math.floor(width / 500) + 1;
}
if (columns > relativeWidgetsCount) {
columns = relativeWidgetsCount;
}
if (columns > MAX_COLUMNS) {
columns = MAX_COLUMNS;
}
return columns;
}
return 1;
}
renderNavigation(content) {
return jsxRuntimeExports.jsx(VisNavigation, {
context: this.props.context,
activeView: this.props.activeView,
view: this.props.view,
editMode: this.props.editMode,
menuWidth: this.state.menuWidth,
theme: this.props.context.theme,
setMenuWidth: (menuWidth) => {
window.localStorage.setItem("vis.menuWidth", menuWidth);
this.setState({
menuWidth
});
return new Promise((resolve) => {
setTimeout(() => {
this.updateViewWidth();
resolve(null);
}, 400);
});
},
children: content
});
}
render() {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
let rxAbsoluteWidgets = [];
let rxRelativeWidgets = [];
let rxGroupWidget;
const contextView = store.getState().visProject[this.props.view];
if (!this.props.view || !contextView) {
return null;
}
const settings = contextView.settings;
if (this.props.view === this.props.activeView && this.props.editMode && !this.keysHandlerInstalled) {
this.installKeyHandlers();
} else if ((this.props.view !== this.props.activeView || !this.props.editMode) && this.keysHandlerInstalled) {
this.uninstallKeyHandlers();
}
if (this.state.mounted && this.state.themeCode && this.refView.current) {
if (!((_a = this.props.viewsActiveFilter) == null ? void 0 : _a[this.props.view])) {
this.props.viewsActiveFilter[this.props.view] = (((_b = contextView.settings) == null ? void 0 : _b.filterkey) || "").split(",").map((f) => f.trim()).filter((f) => f);
}
const widgets = contextView.widgets;
let moveAllowed = true;
if (widgets) {
let relativeWidgetOrder = [];
if (this.props.selectedGroup) {
relativeWidgetOrder = [
...((_d = (_c = widgets[this.props.selectedGroup]) == null ? void 0 : _c.data) == null ? void 0 : _d.members) ?? []
];
} else if ((_e = contextView.settings) == null ? void 0 : _e.order) {
relativeWidgetOrder = [
...contextView.settings.order
];
}
if (this.props.selectedGroup) {
relativeWidgetOrder.sort((a, b) => {
const widgetA = widgets[a];
const widgetB = widgets[b];
const isRelativeA = widgetA.style && (widgetA.style.position === "relative" || widgetA.style.position === "static" || widgetA.style.position === "sticky");
const isRelativeB = widgetB.style && (widgetB.style.position === "relative" || widgetB.style.position === "static" || widgetB.style.position === "sticky");
if (isRelativeA && isRelativeB) {
return 0;
}
if (isRelativeA) {
return -1;
}
return 1;
});
}
const relativeWidgets = [];
const absoluteWidgets = [];
const unknownWidgets = [];
if (this.props.editMode && ((_f = this.props.selectedWidgets) == null ? void 0 : _f.length)) {
this.props.selectedWidgets.forEach((id) => {
const widget = contextView.widgets[id];
if (!widget || widget.groupid && !this.props.selectedGroup) {
return;
}
if (widget.style) {
if (widget.style.position === "relative") {
relativeWidgets.push(id);
} else if (!widget.style.position || widget.style.position === "absolute") {
absoluteWidgets.push(id);
} else {
unknownWidgets.push(id);
}
} else {
absoluteWidgets.push(id);
}
});
if (unknownWidgets.length) {
moveAllowed = false;
} else if (relativeWidgets.length && absoluteWidgets.length) {
moveAllowed = false;
}
}
const listRelativeWidgetsOrder = [];
const listAbsoluteWidgetsOrder = [];
const filterWidgets = contextView.filterWidgets;
const filterInvert = contextView.filterInvert;
Object.keys(widgets).forEach((id) => {
var _a2;
if (id === this.props.selectedGroup) {
return;
}
const widget = contextView.widgets[id];
if (!widget || widget.grouped && !this.props.selectedGroup) {
return;
}
if (!this.props.selectedGroup && widget.usedInWidget) {
return;
}
if (!hasWidgetAccess({
view: this.props.view,
editMode: this.props.editMode,
project: store.getState().visProject,
user: store.getState().activeUser,
wid: id
})) {
return;
}
if (this.props.selectedGroup && id !== this.props.selectedGroup && widget.groupid !== this.props.selectedGroup) {
return;
}
if (this.props.editMode && (filterWidgets == null ? void 0 : filterWidgets.length)) {
if ((_a2 = widget.data) == null ? void 0 : _a2.filterkey) {
let filterValues = widget.data.filterkey;
if (filterValues && typeof filterValues === "string") {
filterValues = filterValues.split(",").map((f) => f.trim()).filter((f) => f);
}
if (filterInvert) {
if (!filterWidgets.find((f) => filterValues.includes(f))) {
return;
}
} else if (filterWidgets.find((f) => filterValues.includes(f))) {
return;
}
} else if (filterInvert) {
return;
}
}
const isRelative = widget.style && (widget.style.position === "relative" || widget.style.position === "static" || widget.style.position === "sticky");
if (isRelative && id !== this.props.selectedGroup) {
if (!listRelativeWidgetsOrder.includes(id)) {
listRelativeWidgetsOrder.push(id);
}
} else {
const pos = listRelativeWidgetsOrder.indexOf(id);
pos !== -1 && listRelativeWidgetsOrder.splice(pos, 1);
if (!listAbsoluteWidgetsOrder.includes(id)) {
listAbsoluteWidgetsOrder.push(id);
}
}
});
if (!this.props.selectedGroup) {
for (let t = relativeWidgetOrder.length - 1; t >= 0; t--) {
if (!contextView.widgets[relativeWidgetOrder[t]]) {
relativeWidgetOrder.splice(t, 1);
}
}
}
listRelativeWidgetsOrder.sort((a, b) => {
const posA = relativeWidgetOrder.indexOf(a);
const posB = relativeWidgetOrder.indexOf(b);
if (posA === -1 && posB === -1) {
return 0;
}
if (posA === -1) {
return 1;
}
if (posB === -1) {
return -1;
}
return posA - posB;
});
const columns = this.props.selectedGroup || !settings ? 1 : this.getCountOfRelativeColumns(settings, listRelativeWidgetsOrder.length);
const wColumns = new Array(columns);
for (let w = 0; w < wColumns.length; w++) {
wColumns[w] = [];
}
const view = this.props.view;
rxAbsoluteWidgets = listAbsoluteWidgetsOrder.map((id, index) => {
var _a2;
return VisView.getOneWidget(index, contextView.widgets[id], {
context: this.props.context,
editMode: this.props.editMode,
id,
isRelative: false,
mouseDownOnView: this.mouseDownOnView,
moveAllowed,
ignoreMouseEvents: this.ignoreMouseEvents,
onIgnoreMouseEvents: this.onIgnoreMouseEvents,
refParent: this.props.selectedGroup ? this.refRelativeView : this.refView,
askView: this.askView,
relativeWidgetOrder,
selectedGroup: this.props.selectedGroup,
selectedWidgets: ((_a2 = this.movement) == null ? void 0 : _a2.selectedWidgetsWithRectangle) || this.props.selectedWidgets,
view,
viewsActiveFilter: this.props.viewsActiveFilter,
customSettings: this.props.customSettings
});
});
if (listRelativeWidgetsOrder.length) {
let columnIndex = 0;
listRelativeWidgetsOrder.forEach((id, index) => {
var _a2;
const widget = store.getState().visProject[view].widgets[id];
if (widget.style.newLine) {
columnIndex = 0;
}
const w = VisView.getOneWidget(index, widget, {
context: this.props.context,
editMode: this.props.editMode,
id,
isRelative: true,
mouseDownOnView: this.mouseDownOnView,
moveAllowed,
ignoreMouseEvents: this.ignoreMouseEvents,
onIgnoreMouseEvents: this.onIgnoreMouseEvents,
refParent: this.props.selectedGroup ? this.refRelativeView : this.refRelativeColumnsView[columnIndex],
askView: this.askView,
relativeWidgetOrder: this.props.selectedGroup ? relativeWidgetOrder : listRelativeWidgetsOrder,
selectedWidgets: ((_a2 = this.movement) == null ? void 0 : _a2.selectedWidgetsWithRectangle) || this.props.selectedWidgets,
selectedGroup: this.props.selectedGroup,
view,
customSettings: this.props.customSettings,
viewsActiveFilter: this.props.viewsActiveFilter
});
wColumns[columnIndex].push(w);
columnIndex++;
if (columnIndex >= columns) {
columnIndex = 0;
}
});
if (this.props.selectedGroup) {
rxRelativeWidgets = wColumns[0];
} else {
const style2 = {};
if ((settings == null ? void 0 : settings.columnWidth) && isVarFinite(settings.columnWidth)) {
style2.maxWidth = parseFloat(settings.columnWidth);
}
rxRelativeWidgets = wColumns.map((column, i) => jsxRuntimeExports.jsx("div", {
ref: this.refRelativeColumnsView[i],
style: style2,
className: __mf_70.clsx("vis-view-column", this.props.editMode && "vis-view-column-edit"),
children: column
}, i));
}
} else {
rxRelativeWidgets = null;
}
if (this.props.selectedGroup) {
rxGroupWidget = VisView.getOneWidget(0, contextView.widgets[this.props.selectedGroup], {
context: this.props.context,
editMode: this.props.editMode,
id: this.props.selectedGroup,
isRelative: false,
mouseDownOnView: this.mouseDownOnView,
moveAllowed,
ignoreMouseEvents: this.ignoreMouseEvents,
onIgnoreMouseEvents: this.onIgnoreMouseEvents,
refParent: this.refView,
askView: this.askView,
relativeWidgetOrder,
selectedGroup: this.props.selectedGroup,
selectedWidgets: ((_g = this.movement) == null ? void 0 : _g.selectedWidgetsWithRectangle) || this.props.selectedWidgets,
view,
viewsActiveFilter: this.props.viewsActiveFilter,
customSettings: this.props.customSettings
});
}
}
}
let className = "vis-view";
const style = {
width: "100%",
height: "100%"
};
if (this.state.loadedjQueryTheme !== this.getJQueryThemeName() && this.props.view) {
if (!this.loadingTheme) {
this.loadingTheme = true;
setTimeout(() => this.loadJqueryTheme(this.getJQueryThemeName()), this.state.loadedjQueryTheme ? 50 : 0);
}
}
const backgroundStyle = {};
const backgroundClass = ((_h = settings == null ? void 0 : settings.style) == null ? void 0 : _h.background_class) || "";
(settings == null ? void 0 : settings.style) && Object.keys(settings.style).forEach((attr) => {
var _a2;
if (attr === "background_class") {
className = addClass$1(className, (_a2 = settings.style) == null ? void 0 : _a2.background_class);
} else {
const isBg = attr.startsWith("background");
if (!settings["bg-image"] || !isBg) {
const value = settings.style[attr];
attr = attr.replace(/(-\w)/g, (text) => text[1].toUpperCase());
style[attr] = value;
if (isBg) {
backgroundStyle[attr] = value;
}
}
}
});
let theme = this.props.context.theme;
const customThemeType = (_i = this.props.customSettings) == null ? void 0 : _i.themeType;
if ((_k = (_j = this.props.customSettings) == null ? void 0 : _j.viewStyle) == null ? void 0 : _k.overrides) {
theme = createTheme(customThemeType || this.props.context.theme.palette.mode, this.props.customSettings.viewStyle.overrides);
} else if (customThemeType && customThemeType !== theme.palette.mode) {
if (!this.theme[customThemeType]) {
this.theme[customThemeType] = createTheme(customThemeType);
}
theme = this.theme[customThemeType];
}
if (!style.backgroundColor && !style.background) {
if ((_m = (_l = this.props.customSettings) == null ? void 0 : _l.viewStyle) == null ? void 0 : _m.backgroundColor) {
backgroundStyle.backgroundColor = this.props.customSettings.viewStyle.backgroundColor;
} else if (((_n = this.props.customSettings) == null ? void 0 : _n.themeType) === "dark") {
backgroundStyle.backgroundColor = "#000";
} else {
backgroundStyle.backgroundColor = theme.palette.mode === "dark" ? "#000" : "#fff";
}
}
if (!style.color) {
if ((_p = (_o = this.props.customSettings) == null ? void 0 : _o.viewStyle) == null ? void 0 : _p.color) {
style.color = this.props.customSettings.viewStyle.color;
} else {
style.color = theme.palette.mode === "dark" ? "#fff" : "#000";
}
}
if (!style.fontFamily && ((_r = (_q = this.props.customSettings) == null ? void 0 : _q.viewStyle) == null ? void 0 : _r.fontFamily)) {
style.fontFamily = this.props.customSettings.viewStyle.fontFamily;
}
if (this.props.view !== this.props.activeView) {
style.display = "none";
}
if (this.props.context.container) {
style.overflow = "hidden";
}
let gridDiv = null;
if (((_s = store.getState().visProject[this.props.view].settings) == null ? void 0 : _s.snapType) === 2 && this.props.editMode) {
gridDiv = VisView.renderGitter((_t = contextView.settings) == null ? void 0 : _t.gridSize, (_u = contextView.settings) == null ? void 0 : _u.snapColor);
}
if (this.props.style) {
Object.assign(style, this.props.style);
}
if (settings && settings["bg-image"]) {
backgroundStyle.backgroundImage = `url("../${this.props.context.adapterName}.${this.props.context.instance}/${this.props.context.projectName}${settings["bg-image"].substring(9)}")`;
backgroundStyle.backgroundRepeat = "no-repeat";
backgroundStyle.backgroundPosition = "top left";
if (settings["bg-color"]) {
backgroundStyle.backgroundColor = settings["bg-color"];
}
if (settings["bg-position-x"]) {
backgroundStyle.backgroundPositionX = isVarFinite(settings["bg-position-x"]) ? `${settings["bg-position-x"]}px` : settings["bg-position-x"];
}
if (settings["bg-position-y"]) {
backgroundStyle.backgroundPositionY = isVarFinite(settings["bg-position-y"]) ? `${settings["bg-position-y"]}px` : settings["bg-position-y"];
}
if (settings["bg-width"] && settings["bg-height"]) {
const w = isVarFinite(settings["bg-width"]) ? `${settings["bg-width"]}px` : settings["bg-width"];
const h = isVarFinite(settings["bg-height"]) ? `${settings["bg-height"]}px` : settings["bg-height"];
backgroundStyle.backgroundSize = `${w} ${h}`;
} else if (settings["bg-width"]) {
backgroundStyle.backgroundSize = `${isVarFinite(settings["bg-width"]) ? `${settings["bg-width"]}px` : settings["bg-width"]} auto`;
} else if (settings["bg-height"]) {
const w = isVarFinite(settings["bg-height"]) ? `${settings["bg-height"]}px` : settings["bg-height"];
backgroundStyle.backgroundSize = `auto ${w}`;
}
}
Object.assign(style, backgroundStyle);
let renderedWidgets;
let limitScreenStyle = null;
if ((settings == null ? void 0 : settings.limitScreen) && (window.screen.width >= 800 && window.screen.height >= 800 || !settings.limitScreenDesktop)) {
let ignore = false;
if (settings.limitForInstances) {
const visInstance = window.localStorage.getItem("visInstance");
if (visInstance) {
const instances = settings.limitForInstances.split(",").map((i) => i.trim()).filter((i) => i);
if (instances.length && !instances.includes(visInstance)) {
ignore = true;
}
} else {
ignore = true;
}
}
if (!ignore) {
const ww = isVarFinite(settings.sizex) ? parseFloat(settings.sizex) : 0;
const hh = isVarFinite(settings.sizey) ? parseFloat(settings.sizey) : 0;
if (ww && hh) {
const borderWidth = parseFloat(settings.limitScreenBorderWidth) || 0;
const borderColor = settings.limitScreenBorderColor || "#333";
const borderStyle = settings.limitScreenBorderStyle || "dotted";
const bgColor = settings.limitScreenBackgroundColor || null;
limitScreenStyle = {
...backgroundStyle,
width: ww + borderWidth * 2,
height: hh + borderWidth * 2,
minWidth: ww + borderWidth * 2,
minHeight: hh + borderWidth * 2,
overflow: "auto",
position: "relative",
boxSizing: "border-box",
borderWidth,
borderColor,
borderStyle
};
style.display = "flex";
style.justifyContent = "center";
style.alignItems = "center";
style.backgroundColor = bgColor;
}
}
}
if (this.props.selectedGroup) {
renderedWidgets = rxGroupWidget;
} else if (settings) {
renderedWidgets = jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
children: [
rxRelativeWidgets ? jsxRuntimeExports.jsx("div", {
ref: this.refRelativeView,
style: this.getRelativeStyle(settings, this.props.selectedGroup, !!limitScreenStyle),
className: "vis-relative-view",
children: rxRelativeWidgets
}) : null,
rxAbsoluteWidgets
]
});
}
if (limitScreenStyle) {
renderedWidgets = jsxRuntimeExports.jsx("div", {
style: limitScreenStyle,
className: "vis-limit-screen",
children: renderedWidgets
});
}
let renderedView = jsxRuntimeExports.jsxs("div", {
className: `${className} visview_${this.props.view.replace(/\s/g, "_")}`,
ref: this.refView,
id: `visview_${this.props.view.replace(/\s/g, "_")}`,
onMouseDown: !this.props.context.runtime ? (e) => this.props.editMode && this.mouseDownLocal && this.mouseDownLocal(e) : void 0,
onDoubleClick: this.props.context.runtime ? () => this.props.editMode && this.doubleClickOnView && this.doubleClickOnView() : void 0,
style,
children: [
jsxRuntimeExports.jsx("style", {
children: this.state.themeCode
}),
gridDiv,
limitScreenStyle ? null : this.renderScreenSize(),
this.state.rulers.map((ruler, key) => jsxRuntimeExports.jsx("div", {
style: {
pointerEvents: "none",
userSelect: "none",
position: "absolute",
width: ruler.type === "horizontal" ? "100%" : 10,
height: ruler.type === "horizontal" ? 10 : "100%",
borderStyle: "solid",
borderColor: "red",
borderWidth: 0,
borderLeftWidth: ruler.type === "horizontal" ? 0 : 1,
borderTopWidth: ruler.type === "horizontal" ? 1 : 0,
left: ruler.type === "horizontal" ? 0 : ruler.value,
top: ruler.type === "horizontal" ? ruler.value : 0,
zIndex: 1e3
}
}, key)),
renderedWidgets
]
});
if (settings && (settings.navigation || settings.navigationBar) && this.props.view === this.props.activeView) {
renderedView = this.renderNavigation(renderedView);
}
if (!this.props.visInWidget && this.props.activeView === this.props.view) {
const bgStyle = JSON.stringify(backgroundStyle);
if (!window._lastAppliedStyle || window._lastAppliedStyle !== bgStyle) {
window._lastAppliedStyle = bgStyle;
window.document.documentElement.removeAttribute("style");
Object.keys(backgroundStyle).forEach((attr) => window.document.documentElement.style[attr] = backgroundStyle[attr]);
}
window.document.documentElement.className = backgroundClass;
}
return jsxRuntimeExports.jsx(__mf_6, {
injectFirst: true,
children: jsxRuntimeExports.jsx(ThemeProvider, {
theme,
children: renderedView
})
});
}
}
class VisFormatUtils {
vis;
bindingsCache;
constructor(props) {
this.vis = props.vis;
this.bindingsCache = {};
}
static getObjPropValue(obj, propPath) {
if (!obj) {
return void 0;
}
const parts = propPath.split(".");
let _obj = obj;
for (const part of parts) {
_obj = _obj[part];
if (!_obj) {
return void 0;
}
}
return _obj;
}
getSpecialValues(name, view, wid, widgetData) {
switch (name) {
case "username.val":
return this.vis.user;
case "login.val":
return this.vis.loginRequired;
case "instance.val":
return this.vis.instance;
case "language.val":
return this.vis.language;
case "wid.val":
return wid;
case "wname.val":
return (widgetData == null ? void 0 : widgetData.name) || wid;
case "view.val":
return view;
default:
return void 0;
}
}
static formatValue(value, decimals, _format) {
if (typeof decimals !== "number") {
decimals = 2;
_format = decimals;
}
const format2 = _format === void 0 || _format === null ? ".," : _format;
if (typeof value !== "number") {
value = parseFloat(value);
}
return Number.isNaN(value) ? "" : value.toFixed(decimals || 0).replace(format2[0], format2[1]).replace(/\B(?=(\d{3})+(?!\d))/g, format2[0]);
}
formatMomentDate(dateObj, _format, useTodayOrYesterday, moment2) {
useTodayOrYesterday = typeof useTodayOrYesterday !== "undefined" ? useTodayOrYesterday : false;
if (!dateObj) {
return "";
}
let momentObject;
const type = typeof dateObj;
if (type === "string") {
momentObject = moment2(dateObj);
} else if (type !== "object") {
const j = parseInt(dateObj, 10);
if (j === dateObj) {
if (j < 946681200) {
momentObject = moment2(dateObj);
} else {
momentObject = j < 9466812e5 ? moment2(j * 1e3) : moment2(j);
}
} else {
momentObject = moment2(dateObj);
}
}
const format2 = _format || this.vis.dateFormat || "DD.MM.YYYY";
let result;
if (useTodayOrYesterday && momentObject && moment2) {
if (momentObject.isSame(moment2(), "day")) {
const todayStr = this.vis._("Today");
result = moment2(momentObject).format(format2.replace("dddd", todayStr).replace("ddd", todayStr).replace("dd", todayStr)) || "";
}
if (momentObject.isSame(moment2().subtract(1, "day"), "day")) {
const yesterdayStr = this.vis._("Yesterday");
result = moment2(momentObject).format(format2.replace("dddd", yesterdayStr).replace("ddd", yesterdayStr).replace("dd", yesterdayStr)) || "";
}
} else {
result = moment2(momentObject).format(format2) || "";
}
return result;
}
static _put(token2, dateObj, result) {
let v = "";
switch (token2) {
case "YYYY":
case "JJJJ":
case "\u0413\u0413\u0413\u0413":
case "YY":
case "JJ":
case "\u0413\u0413":
v = dateObj.getFullYear();
if (token2.length === 2) {
v %= 100;
}
break;
case "MM":
case "M":
case "\u041C\u041C":
case "\u041C":
v = dateObj.getMonth() + 1;
if (v < 10 && token2.length === 2) {
v = `0${v}`;
}
break;
case "DD":
case "TT":
case "D":
case "T":
case "\u0414\u0414":
case "\u0414":
v = dateObj.getDate();
if (v < 10 && token2.length === 2) {
v = `0${v}`;
}
break;
case "hh":
case "SS":
case "h":
case "S":
case "\u0447\u0447":
case "\u0447":
v = dateObj.getHours();
if (v < 10 && token2.length === 2) {
v = `0${v}`;
}
break;
case "mm":
case "m":
case "\u043C\u043C":
case "\u043C":
v = dateObj.getMinutes();
if (v < 10 && token2.length === 2) {
v = `0${v}`;
}
break;
case "ss":
case "s":
case "cc":
case "c":
v = dateObj.getSeconds();
if (v < 10 && token2.length === 2) {
v = `0${v}`;
}
v = v.toString();
break;
case "sss":
case "\u0441\u0441\u0441":
v = dateObj.getMilliseconds();
if (v < 10) {
v = `00${v}`;
} else if (v < 100) {
v = `0${v}`;
}
v = v.toString();
break;
}
result += v;
return result;
}
formatDate(dateObj, isDuration2, _format) {
if (typeof isDuration2 === "string" && isDuration2.toLowerCase() === "duration" || isDuration2 === true) {
isDuration2 = true;
}
if (typeof isDuration2 !== "boolean") {
_format = isDuration2;
isDuration2 = false;
}
if (!dateObj) {
return "";
}
let realDateObj;
const type = typeof dateObj;
if (type === "string") {
realDateObj = new Date(dateObj);
} else if (type !== "object") {
const j = parseInt(dateObj, 10);
if (j === dateObj) {
if (j < 946681200) {
isDuration2 = true;
realDateObj = new Date(dateObj);
} else {
realDateObj = j < 9466812e5 ? new Date(j * 1e3) : new Date(j);
}
} else {
realDateObj = new Date(dateObj);
}
}
let result = "";
if (realDateObj) {
const format2 = _format || this.vis.dateFormat || "DD.MM.YYYY";
isDuration2 && realDateObj.setMilliseconds(realDateObj.getMilliseconds() + realDateObj.getTimezoneOffset() * 60 * 1e3);
const validFormatChars = "YJ\u0413M\u041CDT\u0414hS\u0447m\u043Cs\u0441";
let s = "";
for (let i = 0; i < format2.length; i++) {
if (validFormatChars.includes(format2[i])) {
s += format2[i];
} else {
result = VisFormatUtils._put(s, realDateObj, result);
s = "";
result += format2[i];
}
}
result = VisFormatUtils._put(s, realDateObj, result);
}
return result;
}
extractBinding(format2) {
if (!format2) {
return null;
}
if (!this.vis.editMode && this.bindingsCache[format2]) {
return deepClone(this.bindingsCache[format2]);
}
const result = extractBinding(format2);
if (result && this.bindingsCache && !this.vis.editMode) {
this.bindingsCache[format2] = deepClone(result);
}
return result;
}
formatBinding(options) {
const { view, wid, widget, widgetData, moment: moment2 } = options;
let { format: format2 } = options;
const _values = options.values || this.vis.states;
const oids = this.extractBinding(options.format);
for (const oid of oids) {
let value;
if (oid.visOid) {
value = this.getSpecialValues(oid.visOid, view, wid, widgetData);
if (value === void 0 || value === null) {
value = _values[oid.visOid];
}
}
if (oid.operations) {
for (const operation of oid.operations) {
if (operation.op === "eval") {
let string = "";
const evalArgs = operation.arg;
for (let a = 0; a < evalArgs.length; a++) {
if (!evalArgs[a].name) {
continue;
}
value = this.getSpecialValues(evalArgs[a].visOid, view, wid, widgetData);
if (value === void 0 || value === null) {
value = evalArgs[a].visOid.startsWith("widgetOid.") ? _values[evalArgs[a].visOid.replace(/^widgetOid\./g, `${widget.data.oid}.`)] : _values[evalArgs[a].visOid];
}
if (value === null) {
string += `const ${evalArgs[a].name} = null;`;
} else if (value === void 0) {
string += `const ${evalArgs[a].name} = undefined;`;
} else {
const type = typeof value;
if (type === "string") {
try {
value = JSON.parse(value);
if (typeof value === "object") {
string += `const ${evalArgs[a].name} = JSON.parse("${JSON.stringify(value).replace(/\x22/g, '\\"')}");`;
} else {
string += `const ${evalArgs[a].name} = "${value}";`;
}
} catch {
string += `const ${evalArgs[a].name} = "${value}";`;
}
} else if (type === "object") {
string += `const ${evalArgs[a].name} = ${JSON.stringify(value)};`;
} else {
string += `const ${evalArgs[a].name} = ${value.toString()};`;
}
}
}
const { formula } = operation;
if (formula && formula.includes("widget.")) {
const w = deepClone(widget);
w.data = widgetData;
string += `const widget = ${JSON.stringify(w)};`;
}
string += `return ${operation.formula};`;
if (string.includes('\\"')) {
string = string.replace(/\\"/g, '"');
}
try {
value = new Function(string)();
if (value && typeof value === "object") {
value = JSON.stringify(value);
}
} catch (e) {
console.error(`Error in eval[value]: ${format2}`);
console.error(`Error in eval[script]: ${string}`);
console.error(`Error in eval[error]: ${e}`);
value = 0;
}
} else {
const operationArg = operation.arg;
switch (operation.op) {
case "*":
if (operationArg !== void 0 && operationArg !== null) {
value = parseFloat(value) * operationArg;
}
break;
case "/":
if (operationArg !== void 0 && operationArg !== null) {
value = parseFloat(value) / operationArg;
}
break;
case "+":
if (operationArg !== void 0 && operationArg !== null) {
value = parseFloat(value) + operationArg;
}
break;
case "-":
if (operationArg !== void 0 && operationArg !== null) {
value = parseFloat(value) - operationArg;
}
break;
case "%":
if (operationArg !== void 0 && operationArg !== null) {
value = parseFloat(value) % operationArg;
}
break;
case "round":
if (operationArg === void 0) {
value = Math.round(parseFloat(value));
} else {
value = parseFloat(value).toFixed(operationArg);
}
break;
case "pow":
if (operationArg === void 0) {
value = parseFloat(value) * parseFloat(value);
} else {
value = parseFloat(value) ** operationArg;
}
break;
case "sqrt":
value = Math.sqrt(parseFloat(value));
break;
case "hex":
value = Math.round(parseFloat(value)).toString(16);
break;
case "hex2":
value = Math.round(parseFloat(value)).toString(16);
if (value.length < 2) {
value = `0${value}`;
}
break;
case "HEX":
value = Math.round(parseFloat(value)).toString(16).toUpperCase();
break;
case "HEX2":
value = Math.round(parseFloat(value)).toString(16).toUpperCase();
if (value.length < 2) {
value = `0${value}`;
}
break;
case "value":
value = VisFormatUtils.formatValue(value, parseInt(operationArg, 10));
break;
case "array":
value = operationArg[parseInt(value, 10)];
break;
case "date":
value = this.formatDate(value, operationArg);
break;
case "momentDate":
if (operationArg !== void 0 && operationArg !== null && typeof operationArg === "string") {
const params = operationArg.split(",");
if (params.length === 1) {
value = this.formatMomentDate(value, params[0], false, moment2);
} else if (params.length === 2) {
value = this.formatMomentDate(value, params[0], !!params[1], moment2);
} else {
value = "error";
}
}
break;
case "min":
value = parseFloat(value);
value = value < operationArg ? operationArg : value;
break;
case "max":
value = parseFloat(value);
value = value > operationArg ? operationArg : value;
break;
case "random":
if (operationArg === void 0) {
value = Math.random();
} else {
value = Math.random() * operationArg;
}
break;
case "floor":
value = Math.floor(parseFloat(value));
break;
case "ceil":
value = Math.ceil(parseFloat(value));
break;
case "json":
if (value && typeof value === "string") {
try {
value = JSON.parse(value);
} catch {
console.warn(`Cannot parse JSON string: ${value}`);
}
}
if (value && typeof value === "object") {
value = VisFormatUtils.getObjPropValue(value, operationArg);
}
break;
default:
console.warn(`Unknown operator: ${format2}`);
break;
}
}
}
}
format2 = format2.replace(oid.token, value);
}
format2 = format2.replace(/{{/g, "{").replace(/}}/g, "}");
return format2;
}
}
function _translateWord(text, lang2, dictionary) {
if (!text) {
return "";
}
lang2 || (lang2 = window.systemLang);
dictionary || (dictionary = window.systemDictionary);
if (dictionary[text]) {
let newText = dictionary[text][lang2];
if (newText) {
return newText;
}
if (lang2 !== "en") {
newText = dictionary[text].en;
if (newText) {
return newText;
}
}
} else if (typeof text === "string" && !text.match(/_tooltip$/)) ;
else if (typeof text !== "string") {
console.warn(`Trying to translate non-text: ${text}`);
}
return text;
}
function translate(text, arg1, arg2, arg3) {
text = _translateWord(text);
if (!text.includes("%s")) {
return text;
}
text = text.replace("%s", arg1);
if (!text.includes("%s")) {
return text;
}
text = text.replace("%s", arg2);
if (!text.includes("%s")) {
return text;
}
return text.replace("%s", arg3);
}
class VisEngine extends React.Component {
isTouch;
debounceInterval;
fontNames;
ID_CONTROL_INSTANCE;
ID_CONTROL_DATA;
ID_CONTROL_COMMAND;
formatUtils;
userName;
visCommonCssLoaded;
oldTime;
systemConfig;
_cmdData;
_cmdInstance;
wakeUpDetectorInterval;
lastChangedView;
allWidgets;
subscribes;
scripts;
visUserCssLoaded;
linkContext;
statesDebounce;
statesDebounceTime;
vis;
instance;
refSound;
lastChange;
_authInfo;
_authRunning;
conn;
visContext;
widgetChangeHandlers;
canStates;
viewsActiveFilter;
defaultMode;
can;
refViews;
onChangeCallbacks;
wakeUpCallbacks;
fontTimer;
preloadImagesCacheImgs;
preloadImagesCacheSrcs;
constructor(props) {
var _a, _b;
super(props);
window.jQuery = window.$;
window.$ = window.jQuery;
window.systemLang = props.lang || window.systemLang || "en";
this.state = {
ready: false,
legacyRequestedViews: [],
timeInterval: JSON.parse(window.localStorage.getItem("timeInterval")) || "week",
timeStart: JSON.parse(window.localStorage.getItem("timeStart")) || null
};
hooks.locale(window.systemLang);
this.can = window.can;
this.scripts = null;
this.isTouch = "ontouchstart" in document.documentElement;
this.debounceInterval = 700;
this.subscribes = {};
this.allWidgets = {};
this.wakeUpCallbacks = [];
this.widgetChangeHandlers = {};
this.refViews = {};
this.fontNames = [
"Verdana, Geneva, sans-serif",
'Georgia, "Times New Roman", Times, serif',
'"Courier New", Courier, monospace',
"Arial, Helvetica, sans-serif",
"Tahoma, Geneva, sans-serif",
'"Trebuchet MS", Arial, Helvetica, sans-serif',
'"Arial Black", Gadget, sans-serif',
'"Times New Roman", Times, serif',
'"Palatino Linotype", "Book Antiqua", Palatino, serif',
'"Lucida Sans Unicode", "Lucida Grande", sans-serif',
'"MS Serif", "New York", serif',
'"Comic Sans MS", cursive'
];
this.viewsActiveFilter = {};
this.statesDebounce = {};
this.onChangeCallbacks = [];
this.ID_CONTROL_INSTANCE = `${this.props.adapterName}.${this.props.instance}.control.instance`;
this.ID_CONTROL_DATA = `${this.props.adapterName}.${this.props.instance}.control.data`;
this.ID_CONTROL_COMMAND = `${this.props.adapterName}.${this.props.instance}.control.command`;
this.linkContext = {
IDs: [],
visibility: {},
signals: {},
lastChanges: {},
bindings: {},
unregisterChangeHandler: this.unregisterChangeHandler,
registerChangeHandler: this.registerChangeHandler,
subscribe: this.subscribe,
unsubscribe: this.unsubscribe,
getViewRef: this.getViewRef,
registerViewRef: this.registerViewRef,
unregisterViewRef: this.unregisterViewRef
};
this.refSound = /^((?!chrome|android).)*safari/i.test(window.navigator.userAgent) ? React.createRef() : null;
this.conn = this.createConnection();
this.canStates = this.initCanObjects();
this.vis = this.createLegacyVisObject();
window._ = this.vis._;
window.vis = this.vis;
window.translateWord = _translateWord;
window._setTimeout = (func, timeout, arg1, arg2, arg3, arg4, arg5, arg6) => setTimeout(() => func(arg1, arg2, arg3, arg4, arg5, arg6), timeout);
window._setInterval = (func, interval, arg1, arg2, arg3, arg4, arg5, arg6) => setInterval(() => func(arg1, arg2, arg3, arg4, arg5, arg6), interval);
this.formatUtils = new VisFormatUtils({
vis: this.vis
});
void this.loadLegacyObjects().then(() => this.loadEditWords()).then(() => {
this.userName = this.props.currentUser._id.replace("system.user.", "");
this.vis.user = this.userName;
this.vis.loginRequired = this.props.socket.isSecure;
return this.props.socket.getSystemConfig();
}).then((systemConfig) => {
var _a2, _b2;
this.vis.dateFormat = systemConfig.common.dateFormat;
this.vis.isFloatComma = systemConfig.common.isFloatComma;
this.vis.language = systemConfig.common.language || "en";
this.systemConfig = systemConfig;
void this.props.socket.subscribeState(this.ID_CONTROL_INSTANCE, this.onStateChange);
void this.props.socket.subscribeState(this.ID_CONTROL_DATA, this.onStateChange);
void this.props.socket.subscribeState(this.ID_CONTROL_COMMAND, this.onStateChange);
(_b2 = (_a2 = this.props).setLoadingText) == null ? void 0 : _b2.call(_a2, "Load widgets...");
return this.loadWidgets();
}).then(() => {
var _a2, _b2;
(_b2 = (_a2 = this.props).setLoadingText) == null ? void 0 : _b2.call(_a2, null);
this.setState({
ready: true
});
});
(_b = (_a = this.props).onFontsUpdate) == null ? void 0 : _b.call(_a, this.fontNames);
}
static getCurrentPath() {
const path = window.location.hash.replace(/^#/, "").split("/").map((p) => decodeURIComponent(p));
return {
view: path.shift(),
path
};
}
static buildPath(view, path) {
if (path && typeof path === "string") {
if (path.includes("/")) {
path = path.split("/");
} else {
path = [
path
];
}
}
if (Array.isArray(path) && path.length) {
return `#${encodeURIComponent(view)}/${path.map((p) => encodeURIComponent(p)).join("/")}`;
}
return `#${encodeURIComponent(view)}`;
}
setTimeInterval = (timeInterval) => {
this.setState({
timeInterval
});
window.localStorage.setItem("timeInterval", JSON.stringify(timeInterval));
};
setTimeStart = (timeStart) => {
this.setState({
timeStart
});
window.localStorage.setItem("timeStart", JSON.stringify(timeStart));
};
detectWakeUp() {
this.oldTime = Date.now();
this.wakeUpDetectorInterval = this.wakeUpDetectorInterval || setInterval(() => {
const currentTime = Date.now();
if (currentTime > this.oldTime + 1e4) {
this.oldTime = currentTime;
this.wakeUpCallbacks.forEach((item) => {
if (typeof item.cb === "function") {
try {
item.cb(item.wid);
} catch (error) {
console.error(`Cannot wakeup ${item.wid}: ${error}`);
}
}
});
} else {
this.oldTime = currentTime;
}
}, 2500);
}
componentDidMount() {
window.$.ui.dialog.prototype._appendTo = function() {
const wid = this.options.wid;
const views = store.getState().visProject;
const view = Object.keys(views).find((v) => {
var _a;
return (_a = views[v].widgets) == null ? void 0 : _a[wid];
});
!view && console.warn(`Cannot find view for widget "${wid}"!`);
return this.document.find(view ? `#visview_${view.replace(/\s/g, "_")}` : "body").eq(0);
};
if (!window.localStorage.getItem("visInstance")) {
this.vis.generateInstance();
}
this.detectWakeUp();
}
componentWillUnmount() {
if (this.wakeUpDetectorInterval) {
clearInterval(this.wakeUpDetectorInterval);
this.wakeUpDetectorInterval = null;
}
Object.keys(this.subscribes).forEach((id) => this.props.socket.unsubscribeState(id, this.onStateChange));
this.props.socket.unsubscribeState(this.ID_CONTROL_INSTANCE, this.onStateChange);
this.props.socket.unsubscribeState(this.ID_CONTROL_DATA, this.onStateChange);
this.props.socket.unsubscribeState(this.ID_CONTROL_COMMAND, this.onStateChange);
let userScript = window.document.getElementById("#vis_user_scripts");
if (userScript) {
userScript.remove();
userScript = null;
}
let userCommonCss = window.document.getElementById("#vis_common_user");
if (userCommonCss) {
userCommonCss.remove();
userCommonCss = null;
}
let userUserCss = window.document.getElementById("#vis_user");
if (userUserCss) {
userUserCss.remove();
userUserCss = null;
}
this.subscribes = {};
}
loadLegacyObjects() {
var _a, _b;
if (this.props.runtime) {
return Promise.resolve();
}
(_b = (_a = this.props).setLoadingText) == null ? void 0 : _b.call(_a, "Loading objects...");
return this.conn.getObjects().then((objects) => {
this.vis.objects = objects;
});
}
buildLegacyStructures = () => {
var _a, _b;
this.buildLegacySubscribing();
if (((_b = (_a = this.vis.binds.materialdesign) == null ? void 0 : _a.helper) == null ? void 0 : _b.subscribeStatesAtRuntime) && !this.vis.binds.materialdesign.helper.subscribeStatesAtRuntime.__inited) {
this.vis.binds.materialdesign.helper.subscribeStatesAtRuntime = (wid, widgetName, callback, debug) => {
if (debug) {
console.log(`[subscribeStatesAtRuntime] ${widgetName} (${wid}) subscribe states at runtime`);
}
callback == null ? void 0 : callback();
};
this.vis.binds.materialdesign.helper.subscribeStatesAtRuntime.__inited = true;
}
};
buildLegacySubscribing() {
this.vis.subscribing = {
activeViews: [],
byViews: {},
active: [],
IDs: []
};
Object.keys(store.getState().visProject).forEach((viewId) => {
if (viewId !== "___settings") {
this.vis.subscribing.byViews[viewId] = [];
this.vis.subscribing.activeViews.push(viewId);
}
});
}
createLegacyVisObject() {
if (this.props.showLegacyFileSelector) {
window.jQuery.fm = (options, onChange) => {
this.props.showLegacyFileSelector((data, userArg) => onChange(data, userArg), options);
};
}
return {
version: 2,
states: this.canStates,
objects: {},
isTouch: this.isTouch,
activeWidgets: [],
navChangeCallbacks: [],
editMode: !!this.props.editMode,
binds: {
basic: null,
table: null,
jqplot: null,
jqueryui: null,
swipe: null
},
views: store.getState().visProject,
activeView: this.props.selectedView,
language: this.props.lang,
user: "",
projectPrefix: this.props.projectName,
_: translate,
dateFormat: "",
instance: (window.localStorage.getItem("visInstance") || "").replace(/^"/, "").replace(/"$/, ""),
loginRequired: false,
viewsActiveFilter: this.viewsActiveFilter,
onChangeCallbacks: this.onChangeCallbacks,
subscribing: {
activeViews: [],
byViews: {},
active: [],
IDs: []
},
conn: this.conn,
lastChangedView: null,
updateContainers: () => {
const refViews = this.refViews;
Object.keys(refViews).forEach((view) => refViews[view].onCommand("updateContainers"));
},
renderView: (viewDiv, view, hidden, cb) => {
if (typeof view === "boolean") {
cb = hidden;
hidden = void 0;
view = viewDiv;
}
console.warn("renderView not implemented: ", viewDiv, view, hidden);
if (!this.state.legacyRequestedViews.includes(viewDiv)) {
const legacyRequestedViews = [
...this.state.legacyRequestedViews
];
legacyRequestedViews.push(viewDiv);
this.setState({
legacyRequestedViews
}, () => setTimeout(() => cb == null ? void 0 : cb(viewDiv, view), 100));
} else {
cb == null ? void 0 : cb(viewDiv, view);
}
},
updateFilter: (view) => {
var _a;
view || (view = this.props.activeView);
if (this.refViews[view]) {
if ((_a = this.refViews[view]) == null ? void 0 : _a.onCommand) {
return this.refViews[view].onCommand("collectFilters");
}
}
return [];
},
destroyUnusedViews: () => {
console.warn("destroyUnusedViews not implemented");
},
changeFilter: (view, filter, showEffect, showDuration, hideEffect, hideDuration) => this.changeFilter(view, filter, showEffect, showDuration, hideEffect, hideDuration),
detectBounce: (el, isUp) => {
var _a;
if (!this.isTouch) {
return false;
}
const now2 = Date.now();
if (this.lastChange && now2 - this.lastChange < this.debounceInterval) {
return true;
}
let tag = (_a = el.tagName) == null ? void 0 : _a.toLowerCase();
while (tag && tag !== "div") {
el = el.parentNode;
tag = el.tagName.toLowerCase();
}
const lastClick = el[`__vis_${isUp ? "lcu" : "lc"}`];
if (lastClick && now2 - lastClick < this.debounceInterval) {
console.log("click: filtered out");
return true;
}
el[`__vis_${isUp ? "lcu" : "lc"}`] = now2;
return false;
},
setValue: this.setValue,
subscribe: this.subscribe,
unsubscribe: this.unsubscribe,
changeView: (viewDiv, view, hideOptions, showOptions, sync, cb) => {
if (typeof view === "object") {
cb = sync;
sync = showOptions;
hideOptions = showOptions;
view = viewDiv;
}
if (!view && viewDiv) {
view = viewDiv;
}
if (typeof hideOptions === "function") {
cb = hideOptions;
}
if (typeof showOptions === "function") {
cb = showOptions;
}
if (typeof sync === "function") {
cb = sync;
}
this.changeView(view);
cb == null ? void 0 : cb(viewDiv, view);
},
getCurrentPath() {
return VisEngine.getCurrentPath();
},
navigateInView(path) {
const currentPath = VisEngine.getCurrentPath();
const newHash = VisEngine.buildPath(currentPath.view, path);
if (window.location.hash !== newHash) {
window.location.hash = newHash;
}
},
onWakeUp: (cb, wid) => {
if (typeof cb === "string" && wid === void 0) {
wid = cb;
cb = null;
}
if (!wid) {
console.warn("No widget ID for onWakeUp callback! Please fix");
}
console.warn("onWakeUp not implemented");
if (!cb) {
this.wakeUpCallbacks = this.wakeUpCallbacks.filter((item) => item.wid !== wid);
} else {
this.wakeUpCallbacks.push({
cb,
wid
});
}
},
inspectWidgets: (viewDiv, view, addWidget, delWidget, onlyUpdate) => {
console.warn("inspectWidgets not implemented: ", viewDiv, view, addWidget, delWidget, onlyUpdate);
},
showMessage: (message, title, icon, width, callback) => this.showMessage(message, title, icon, width, callback),
showWidgetHelper: (viewDiv, view, wid, isShow) => {
console.warn("showWidgetHelper not implemented: ", viewDiv, view, wid, isShow);
},
findNearestResolution: (resultRequiredOrX, height) => VisEngine.findNearestResolution(resultRequiredOrX, height),
addFont: (fontName) => {
if (!this.fontNames.includes(fontName)) {
this.fontNames.push(fontName);
if (this.props.onFontsUpdate) {
if (this.fontTimer) {
clearTimeout(this.fontTimer);
}
this.fontTimer = setTimeout(() => {
this.fontTimer = null;
this.props.onFontsUpdate(this.fontNames);
});
}
}
},
registerOnChange: (callback, arg, wid) => {
if (!wid) {
console.warn("No widget ID for registerOnChange callback! Please fix");
}
if (!this.onChangeCallbacks.find((item) => item.callback === callback && item.arg === arg && (!wid || item.wid === wid))) {
this.onChangeCallbacks.push({
callback,
arg,
wid
});
}
},
unregisterOnChange: (callback, arg, wid) => {
if (!wid) {
console.warn("No widget ID for unregisterOnChange callback! Please fix");
}
const index = this.onChangeCallbacks.findIndex((item) => item.callback === callback && (arg === void 0 || arg === null || item.arg === arg) && (!wid || item.wid === wid));
if (index >= 0) {
this.onChangeCallbacks.splice(index, 1);
}
},
generateInstance: () => {
let instance = (Math.random() * 4294967296).toString(16);
instance = `0000000${instance}`;
instance = instance.substring(instance.length - 8);
window.vis.instance = instance;
window.localStorage.setItem("visInstance", instance);
return this.instance;
},
findByRoles: (stateId, roles) => {
if (typeof roles !== "object") {
roles = [
roles
];
} else {
roles = deepClone(roles);
}
const result = {};
const parts = stateId.split(".");
parts.pop();
const channel = parts.join(".");
const reg = new RegExp(`^${channel.replace(/\./g, "\\.")}\\.`);
for (const id in this.vis.objects) {
if (reg.test(id) && this.vis.objects[id].common && this.vis.objects[id].type === "state") {
for (let r = 0; r < roles.length; r++) {
if (this.vis.objects[id].common.role === roles[r]) {
result[roles[r]] = id;
roles.splice(r, 1);
break;
} else if (!roles.length) {
break;
}
}
}
}
if (roles.length) {
parts.pop();
const device = parts.join(".");
const _reg = new RegExp(`^${device.replace(/\./g, "\\.")}\\.`);
for (const id in this.vis.objects) {
if (_reg.test(id) && this.vis.objects[id].common && this.vis.objects[id].type === "state") {
for (let r = 0; r < roles.length; r++) {
if (this.vis.objects[id].common.role === roles[r]) {
result[roles[r]] = id;
roles.splice(r, 1);
break;
}
}
if (!roles.length) {
break;
}
}
}
}
return result;
},
findByName: (stateId, objName) => {
const parts = stateId.split(".");
parts.pop();
const channel = parts.join(".");
const id = `${channel}.${objName}`;
if (id in this.vis.objects && this.vis.objects[id].common && this.vis.objects[id].type === "state") {
return id;
}
parts.pop();
const device = parts.join(".");
const reg = new RegExp(`^${device.replace(/\./g, "\\.")}\\..*\\.${objName}`);
for (const _id in this.vis.objects) {
if (reg.test(_id) && this.vis.objects[_id].common && this.vis.objects[_id].type === "state") {
return _id;
}
}
return false;
},
hideShowAttr: (widAttr) => console.warn("hideShowAttr is deprecated: ", widAttr),
bindingsCache: {},
extractBinding: (format2, doNotIgnoreEditMode) => {
if (!doNotIgnoreEditMode && !!this.props.editMode || !format2) {
return null;
}
if (this.vis.bindingsCache[format2]) {
return JSON.parse(JSON.stringify(this.vis.bindingsCache[format2]));
}
const result = extractBinding(format2);
if (result) {
this.vis.bindingsCache[format2] = JSON.parse(JSON.stringify(result));
}
return result;
},
formatBinding: (format2, view, wid, widget, widgetData, values) => this.formatUtils.formatBinding({
format: format2,
view,
wid,
widget,
widgetData,
values,
moment: hooks
}),
getViewOfWidget: (id) => {
var _a, _b;
const views = store.getState().visProject;
for (const v in views) {
if (v === "___settings") {
continue;
}
if ((_b = (_a = views[v]) == null ? void 0 : _a.widgets) == null ? void 0 : _b[id]) {
return v;
}
}
return null;
},
confirmMessage: (message, title, icon, width, callback) => this.props.onConfirmDialog(message, title, icon, width, callback),
config: {},
showCode: (code, title, mode) => this.props.onShowCode(code, title, mode),
findCommonAttributes: () => {
},
bindWidgetClick: () => {
},
preloadImages: (srcs) => {
this.preloadImagesCacheImgs || (this.preloadImagesCacheImgs = []);
this.preloadImagesCacheSrcs || (this.preloadImagesCacheSrcs = []);
if (!Array.isArray(srcs)) {
srcs = [
srcs
];
}
for (let i = 0; i < srcs.length; i++) {
if (!this.preloadImagesCacheSrcs.includes(srcs[i])) {
const img = new Image();
img.src = srcs[i];
this.preloadImagesCacheImgs.push(img);
this.preloadImagesCacheSrcs.push(srcs[i]);
}
}
},
updateStates: (data) => {
if (data) {
Object.keys(data).forEach((id) => {
let state = data[id];
if (isLocalStateId(id)) {
state = {
val: getUrlParameter(id),
ts: Date.now(),
lc: Date.now(),
ack: false,
from: `system.adapter.${this.props.adapterName}.${this.props.instance}`,
user: this.props.currentUser ? this.props.currentUser._id : "system.user.admin",
q: 0
};
this.onStateChange(id, state);
return;
}
if (!state) {
return;
}
this.setValue(id, state.val);
});
}
},
getHistory: (id, options, cb) => {
options || (options = {});
options.timeout || (options.timeout = 2e3);
let timeout = setTimeout(() => {
timeout = null;
cb("timeout");
}, options.timeout);
this.props.socket.getHistory(id, options).then((result) => {
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
cb(null, result);
}).catch((error) => {
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
cb(error);
});
},
getHttp: (url, callback) => this.props.socket.getRawSocket().emit("httpGet", url, (data) => callback == null ? void 0 : callback(data)),
formatDate: (dateObj, isDuration2, _format) => this.formatUtils.formatDate(dateObj, isDuration2, _format),
widgets: this.allWidgets,
editSelect: this.props.runtime ? null : (widAttr, values, notTranslate, init, onchange) => {
console.log("DEPRECATED!!!!! please remove vis.editSelect");
if (typeof notTranslate === "function") {
onchange = init;
init = notTranslate;
notTranslate = false;
}
const line = {
input: `<select type="text" id="inspect_${widAttr}">`
};
if (onchange) {
line.onchange = onchange;
}
if (init) {
line.init = init;
}
if (values.length && values[0] !== void 0) {
for (let t = 0; t < values.length; t++) {
line.input += `<option value="${values[t]}">${notTranslate ? values[t] : window.vis._(values[t])}</option>`;
}
} else {
for (const name in values) {
line.input += `<option value="${values[name]}">${name}</option>`;
}
}
line.input += "</select>";
return line;
},
isWidgetHidden: (view, widget, val, widgetData) => {
widgetData || (widgetData = store.getState().visProject[view].widgets[widget].data);
const oid = widgetData["visibility-oid"];
const condition = widgetData["visibility-cond"];
if (oid) {
if (val === void 0 || val === null) {
val = this.canStates.attr(`${oid}.val`);
}
if (val === void 0 || val === null) {
return condition === "not exist";
}
let value = widgetData["visibility-val"];
if (!condition || value === void 0 || value === null) {
return condition === "not exist";
}
if (val === "null" && condition !== "exist" && condition !== "not exist") {
return false;
}
const t = typeof val;
if (t === "boolean" || val === "false" || val === "true") {
value = value === "true" || value === true || value === 1 || value === "1";
} else if (t === "number") {
value = parseFloat(value);
} else if (t === "object") {
val = JSON.stringify(val);
}
switch (condition) {
case "==":
value = value.toString();
val = val.toString();
if (val === "1") {
val = "true";
}
if (value === "1") {
value = "true";
}
if (val === "0") {
val = "false";
}
if (value === "0") {
value = "false";
}
return value !== val;
case "!=":
value = value.toString();
val = val.toString();
if (val === "1") {
val = "true";
}
if (value === "1") {
value = "true";
}
if (val === "0") {
val = "false";
}
if (value === "0") {
value = "false";
}
return value === val;
case ">=":
return val < value;
case "<=":
return val > value;
case ">":
return val <= value;
case "<":
return val >= value;
case "consist":
value = value.toString();
val = val.toString();
return !val.toString().includes(value);
case "not consist":
value = value.toString();
val = val.toString();
return val.toString().includes(value);
case "exist":
return val === "null";
case "not exist":
return val !== "null";
default:
console.log(`Unknown visibility condition for ${widget}: ${condition}`);
return false;
}
} else {
return condition === "not exist";
}
},
getUserGroups: () => this.props.userGroups
};
}
changeFilter(view, filter, showEffect, showDuration, hideEffect, hideDuration) {
var _a, _b;
view || (view = this.props.activeView);
(_b = (_a = this.refViews[view]) == null ? void 0 : _a.onCommand) == null ? void 0 : _b.call(_a, "changeFilter", {
filter,
showEffect,
showDuration,
hideEffect,
hideDuration
});
}
onCommand = (view, command, data) => {
var _a, _b;
(_b = (_a = this.refViews[view]) == null ? void 0 : _a.onCommand) == null ? void 0 : _b.call(_a, command, data);
};
showMessage(message, title, icon, width, callback) {
if (typeof icon === "number") {
callback = width;
width = icon;
icon = null;
}
if (typeof title === "function") {
callback = title;
title = null;
} else if (typeof icon === "function") {
callback = icon;
icon = null;
} else if (typeof width === "function") {
callback = width;
width = null;
}
this.setState({
showMessage: {
message,
title,
icon,
width,
callback
}
});
}
renderMessageDialog() {
if (!this.state.showMessage) {
return null;
}
return jsxRuntimeExports.jsxs(__mf_32, {
open: true,
onClose: () => {
const callback = this.state.showMessage.callback;
if (typeof callback === "function") {
callback(false);
}
this.setState({
showMessage: null
});
},
maxWidth: "md",
children: [
jsxRuntimeExports.jsx(__mf_36, {
children: this.state.showMessage.title || __mf_2.t("Message")
}),
jsxRuntimeExports.jsxs(__mf_34, {
children: [
this.state.showMessage.icon === "alert" ? jsxRuntimeExports.jsx(__mf_10269, {}) : null,
this.state.showMessage.message
]
}),
jsxRuntimeExports.jsxs(__mf_33, {
children: [
jsxRuntimeExports.jsx(__mf_16, {
variant: "contained",
onClick: () => {
const callback = this.state.showMessage.callback;
if (typeof callback === "function") {
callback(true);
}
this.setState({
showMessage: null
});
},
color: "primary",
startIcon: jsxRuntimeExports.jsx(__mf_1671, {}),
children: __mf_2.t("Ok")
}),
this.state.showMessage.callback ? jsxRuntimeExports.jsx(__mf_16, {
variant: "contained",
color: "grey",
onClick: () => {
const callback = this.state.showMessage.callback;
if (typeof callback === "function") {
callback(false);
}
this.setState({
showMessage: null
});
},
startIcon: jsxRuntimeExports.jsx(__mf_1776, {}),
children: __mf_2.t("Cancel")
}) : null
]
})
]
}, "__messageDialog");
}
createConnection() {
return {
namespace: this.props.adapterId,
logError: (errorText) => {
console.error(`Error: ${errorText}`);
this.props.socket.log(errorText, "error");
},
getIsConnected: () => this.props.socket.isConnected(),
getGroups: (groupName, useCache, cb) => {
if (typeof groupName === "function") {
cb = groupName;
groupName = null;
useCache = false;
}
if (typeof groupName === "boolean") {
cb = useCache;
useCache = groupName;
groupName = null;
}
if (typeof useCache === "function") {
cb = useCache;
useCache = false;
}
groupName || (groupName = "");
return this.readGroups(groupName, !useCache).then((groups) => cb(groups)).catch((error) => cb(error));
},
getConfig: (useCache, cb) => {
if (typeof useCache === "function") {
cb = useCache;
useCache = false;
}
return this.props.socket.getSystemConfig(!useCache).then((systemConfig) => cb(null, systemConfig.common)).catch((error) => cb(error));
},
getObjects: async (useCache) => {
const promises = [];
promises.push(new Promise((resolve, reject) => this.props.socket.getRawSocket().emit("getObjects", (err, objects) => {
if (err) {
reject(err);
return;
}
resolve(objects);
})));
promises.push(this.props.socket.getEnums(void 0, !useCache));
let getObjectViewSystem = this.props.socket.getObjectViewSystem.bind(this.props.socket);
if (this.props.socket.getObjectViewSystemCached) {
getObjectViewSystem = this.props.socket.getObjectViewSystemCached.bind(this.props.socket);
}
promises.push(getObjectViewSystem("instance", "system.adapter.", "system.adapter.\u9999"));
promises.push(getObjectViewSystem("chart", "", "\u9999"));
promises.push(getObjectViewSystem("channel", "", "\u9999"));
promises.push(getObjectViewSystem("device", "", "\u9999"));
return Promise.all(promises).then((result) => {
var _a, _b;
const objects = result[0] || {};
for (let i = 1; i < result.length; i++) {
if (result[i]) {
Object.assign(objects, result[i]);
}
}
const instance = `system.adapter.${this.props.adapterName}.${this.props.instance}`;
if ((_b = (_a = objects[instance]) == null ? void 0 : _a.native) == null ? void 0 : _b.defaultFileMode) {
this.defaultMode = objects[instance].native.defaultFileMode;
}
return objects;
});
},
getLoggedUser: (cb) => this.props.socket.getCurrentUser().then((user) => cb(this.props.socket.isSecure, user)),
subscribe: (IDs, cb) => {
this.subscribe(IDs);
cb == null ? void 0 : cb();
},
unsubscribe: (IDs, cb) => {
this.unsubscribe(IDs);
cb == null ? void 0 : cb();
},
authenticate: (user, password, salt) => {
this._authRunning = true;
if (user !== void 0) {
this._authInfo = {
user,
hash: password + salt,
salt
};
}
},
getStates: (ids, cb) => {
if (!(ids == null ? void 0 : ids.length)) {
cb == null ? void 0 : cb(null, {});
return;
}
this.props.socket.getForeignStates(ids).then((data) => cb(null, data)).catch((error) => cb(error || "Authentication required"));
},
setState: (id, val, cb) => {
if (!id) {
cb == null ? void 0 : cb(new Error("No id"));
return;
}
this.props.socket.setState(id, val).then(() => cb == null ? void 0 : cb()).catch((error) => cb == null ? void 0 : cb(error));
},
sendTo: (instance, command, data, cb) => {
this.props.socket.sendTo(instance, command, data).then((result) => cb == null ? void 0 : cb(result)).catch((error) => cb == null ? void 0 : cb(error));
},
setReloadTimeout: () => {
},
setReconnectInterval: () => {
},
getUser: () => this.userName,
sendCommand: (instance, command, data, ack) => this.props.socket.setState(this.ID_CONTROL_INSTANCE, {
val: instance || "notdefined",
ack: true
}).then(() => this.props.socket.setState(this.ID_CONTROL_DATA, {
val: data,
ack: true
})).then(() => this.props.socket.setState(this.ID_CONTROL_COMMAND, {
val: command,
ack: ack === void 0 ? true : ack
})).catch((e) => console.error(`Cannot set state: ${e}`)),
readFile: (filename, cb) => {
let adapter = this.conn.namespace;
if (filename[0] === "/") {
const p = filename.split("/");
adapter = p[1];
p.splice(0, 2);
filename = p.join("/");
}
return readFile(this.props.socket, adapter, filename, true).then((data) => {
setTimeout(() => cb(null, data.file, filename, data.mimeType), 0);
}).catch((error) => cb(error));
},
getHistory: (id, options, cb) => {
options || (options = {});
options.timeout || (options.timeout = 2e3);
let timeout = setTimeout(() => {
timeout = null;
cb(new Error("timeout"));
}, options.timeout);
void this.props.socket.getHistory(id, options).then((result) => {
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
cb(null, result);
}).catch((error) => {
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
cb(error);
});
},
getHttp: (url, callback) => this.props.socket.getRawSocket().emit("httpGet", url, (data) => callback == null ? void 0 : callback(data)),
_socket: {
emit: (cmd, data, cb) => {
let promise;
if (cmd === "getObject") {
promise = this.props.socket.getObject(data);
} else if (cmd === "getState") {
promise = this.props.socket.getState(data);
} else if (cmd === "getStates") {
promise = this.props.socket.getStates(data);
}
if (promise instanceof Promise) {
promise.then((obj) => cb == null ? void 0 : cb(null, obj)).catch((error) => cb == null ? void 0 : cb(error));
} else {
console.warn(`Unknown command in _socket.emit: ${cmd}`);
}
}
}
};
}
registerViewRef = (view, ref, onCommand) => {
if (this.refViews[view] && this.refViews[view].ref === ref) {
console.error(`Someone tries to register same ref for view ${view}`);
} else {
if (this.refViews[view]) {
console.error(`Someone tries to register new ref for view ${view}`);
}
this.refViews[view] = {
ref,
onCommand
};
}
};
unregisterViewRef = (view, ref) => {
if (this.refViews[view] && this.refViews[view].ref === ref) {
delete this.refViews[view];
} else if (this.refViews[view]) {
this.refViews[view] && console.error(`Someone tries to unregister new ref for view ${view}`);
delete this.refViews[view];
}
};
getViewRef = (view) => {
var _a;
return (_a = this.refViews[view]) == null ? void 0 : _a.ref;
};
static findNearestResolution(resultRequiredOrX, height) {
let w;
let h;
if (height !== void 0 && height !== null) {
w = resultRequiredOrX;
h = height;
resultRequiredOrX = false;
} else {
w = window.document.body.clientWidth;
h = window.document.body.clientHeight;
}
let result = null;
const views = [];
let difference = 1e4;
const { visProject } = store.getState();
Object.keys(visProject).forEach((view) => {
if (view !== "___settings" && visProject[view].settings && visProject[view].settings.useAsDefault) {
const ww = parseInt(visProject[view].settings.sizex, 10);
if (Math.abs(ww - w) / ww < 0.2) {
views.push(view);
}
}
});
views.forEach((view) => {
if (view !== "___settings" && visProject[view].settings) {
const hh = parseInt(visProject[view].settings.sizey, 10);
if (Math.abs(hh - h) < difference) {
result = view;
difference = Math.abs(hh - h);
}
}
});
if (!result) {
const ratio = w / h;
difference = 1e4;
Object.keys(visProject).forEach((view) => {
var _a;
if (view !== "___settings" && ((_a = visProject[view].settings) == null ? void 0 : _a.useAsDefault)) {
const ww = parseInt(visProject[view].settings.sizex, 10);
const hh = parseInt(visProject[view].settings.sizey, 10);
if (hh && Math.abs(ratio - ww / hh) < difference) {
result = view;
difference = Math.abs(ratio - ww / hh);
}
}
});
}
if (!result && resultRequiredOrX) {
result = Object.keys(visProject).find((view) => {
var _a;
return view !== "___settings" && ((_a = visProject[view].settings) == null ? void 0 : _a.useAsDefault);
});
result || (result = Object.keys(visProject).find((view) => view !== "___settings"));
}
return result;
}
async readGroups(groupName, useCache) {
const groups = await this.props.socket.getGroups(!useCache);
const result = {};
if (groupName) {
const gg = `system.group.${groupName}`;
groups.filter((group) => group._id.startsWith(`${gg}.`) || group._id === gg).forEach((group) => result[group._id] = group);
} else {
groups.forEach((group) => result[group._id] = group);
}
return result;
}
initCanObjects() {
return new this.can.Map({
"nothing_selected.val": null
});
}
_setValue(id, val) {
const oldVal = this.canStates.attr(`${id}.val`);
this.onStateChange(id, {
val,
ack: false
});
if (isLocalStateId(id)) {
return;
}
this.props.socket.setState(id, {
val,
ack: false
}).catch((error) => {
console.error(`Cannot set ${id} with "${val}: ${error}`);
if (oldVal === void 0) {
this.canStates.removeAttr(`${id}.val`);
this.canStates.removeAttr(`${id}.q`);
this.canStates.removeAttr(`${id}.from`);
this.canStates.removeAttr(`${id}.ts`);
this.canStates.removeAttr(`${id}.lc`);
this.canStates.removeAttr(`${id}.ack`);
} else {
this.canStates.attr(`${id}.val`, oldVal);
}
});
}
setValue = (id, val) => {
if (!id) {
console.log(`ID is null for val=${JSON.stringify(val)}`);
return;
}
if (!this.statesDebounce[id]) {
this._setValue(id, val);
this.statesDebounce[id] = {
timeout: setTimeout(() => {
if (this.statesDebounce[id]) {
if (this.statesDebounce[id].state !== null && this.statesDebounce[id].state !== void 0) {
this._setValue(id, this.statesDebounce[id].state);
}
delete this.statesDebounce[id];
}
}, this.statesDebounceTime, id),
state: null
};
} else {
this.statesDebounce[id].state = val;
}
};
static async loadScriptsOfOneWidgetSet(widgetSet) {
for (const { oldScript, newScript } of widgetSet) {
try {
newScript.appendChild(document.createTextNode(oldScript.innerHTML));
oldScript.parentNode.replaceChild(newScript, oldScript);
await new Promise((resolve, reject) => {
newScript.onerror = reject;
newScript.onload = resolve;
});
} catch (e) {
console.error(`Cannot load script "${newScript.src}": ${JSON.stringify(e)}`);
}
}
}
static loadedSources = [];
static async setInnerHTML(elm, html, usedWidgetSets) {
var _a, _b, _c;
elm.innerHTML = html;
const scripts = Array.from(elm.querySelectorAll("script"));
const groups = {};
for (let s = 0; s < scripts.length; s++) {
const oldScript = scripts[s];
const src = oldScript.getAttribute("src");
if (src && VisEngine.loadedSources.includes(src)) {
continue;
}
VisEngine.loadedSources.push(src);
const newScript = document.createElement("script");
let widgetSet = "default";
Array.from(oldScript.attributes).forEach((attr) => {
try {
if (attr.name === "data-widgetset") {
widgetSet = attr.value;
} else {
newScript.setAttribute(attr.name, attr.value);
}
} catch (error) {
console.error(`WTF?? in ${attr.ownerElement.id}: ${error}`);
}
});
if (!usedWidgetSets || widgetSet === "default" || usedWidgetSets.includes(widgetSet)) {
if (src) {
groups[widgetSet] || (groups[widgetSet] = []);
groups[widgetSet].push({
newScript,
oldScript
});
} else {
let loadTimer = setTimeout((tpl) => {
console.error(`Cannot load ${tpl}`);
}, 500, ((_a = oldScript.attributes.id) == null ? void 0 : _a.value) || ((_b = oldScript.attributes["data-widgetset"]) == null ? void 0 : _b.value));
try {
newScript.appendChild(document.createTextNode(oldScript.innerHTML));
oldScript.parentNode.replaceChild(newScript, oldScript);
clearTimeout(loadTimer);
loadTimer = null;
} catch (error) {
console.error(`Cannot set inner HTML of ${(_c = oldScript.text) == null ? void 0 : _c.substring(0, 500)}: ${error}`);
}
}
} else {
console.log(`Skip script "${widgetSet}" ${src || "inline"}`);
}
}
await Promise.all(Object.keys(groups).map((widgetSet) => VisEngine.loadScriptsOfOneWidgetSet(groups[widgetSet])));
}
loadEditWords() {
if (!this.props.runtime) {
return new Promise((resolve) => {
const newScript = document.createElement("script");
newScript.setAttribute("src", "lib/js/visEditWords.js");
newScript.onload = resolve;
window.document.head.appendChild(newScript);
});
}
return Promise.resolve();
}
async loadWidgets() {
var _a, _b;
try {
const data = await fetch("widgets.html");
const text = await data.text();
const div = document.createElement("div");
document.body.appendChild(div);
await VisEngine.setInnerHTML(div, text, this.props.runtime && VisWidgetsCatalog.getUsedWidgetSets(store.getState().visProject));
(_b = (_a = this.props).onLoaded) == null ? void 0 : _b.call(_a);
} catch (error) {
console.error(`Cannot load widgets: ${error}`);
console.error(`Cannot load widgets: ${JSON.stringify(error.stack)}`);
}
}
updateWidget(_view, wid, type, item, stateId, state) {
if (this.widgetChangeHandlers[wid]) {
this.widgetChangeHandlers[wid](type, item, stateId, state);
}
}
registerChangeHandler = (wid, cb) => {
if (this.props.editMode && this.widgetChangeHandlers[wid]) {
console.error("Someone installs handler without to remove it!");
}
this.widgetChangeHandlers[wid] = cb;
};
unregisterChangeHandler = (wid, cb) => {
if (this.widgetChangeHandlers[wid] === cb) {
delete this.widgetChangeHandlers[wid];
}
};
onUserCommand(instance, command, data) {
var _a, _b;
const currentInstance = (window.localStorage.getItem("visInstance") || "").replace(/^"/, "").replace(/"$/, "");
if (instance === null || instance === void 0) {
instance = "";
} else {
instance = instance.toString();
}
if (instance && typeof instance === "string") {
instance = instance.replace(/^"/, "").replace(/"$/, "");
}
if (!instance || instance !== currentInstance && instance !== "FFFFFFFF" && !instance.includes("*")) {
return false;
}
if (this.props.editMode && command !== "tts" && command !== "playSound") {
if (command !== "changedView") {
window.alert(__mf_2.t("Received user command: %s", JSON.stringify({
instance,
command,
data
})));
}
return true;
}
switch (command) {
case "alert": {
const [message, title, icon] = data.split(";");
this.showMessage(message, title, icon);
break;
}
case "changedView":
return false;
case "changeView": {
const parts = data.split("/");
if (!store.getState().visProject[parts[0]] && parts[1]) {
const projectName = parts.shift();
if (projectName !== this.props.projectName) {
const viewName2 = parts.join("/");
if (window.location.search.includes("runtime=")) {
document.location.href = `./?${projectName}&runtime=true#${viewName2}`;
} else {
document.location.href = `./?${projectName}#${viewName2}`;
}
return true;
}
const viewName = parts.shift();
this.changeView(viewName, parts.join("/"));
} else {
const viewName = parts.shift();
this.changeView(viewName, parts.join("/"));
}
break;
}
case "refresh":
case "reload":
setTimeout(() => window.location.reload(), 1);
break;
case "dialog":
case "dialogOpen": {
const { visProject } = store.getState();
const el = window.document.getElementById(data) || window.document.querySelector(`[data-dialog-name="${data}"]`);
const viewName = Object.keys(visProject).find((view) => {
var _a2;
return (_a2 = visProject[view].widgets) == null ? void 0 : _a2[data];
});
if (viewName && ((_a = this.refViews[viewName]) == null ? void 0 : _a.onCommand)) {
this.refViews[viewName].onCommand("openDialog", data);
}
if (el == null ? void 0 : el._showDialog) {
el._showDialog(true);
} else {
window.jQuery(`#${data}_dialog`).dialog("open");
}
break;
}
case "dialogClose": {
const { visProject } = store.getState();
const el = window.document.getElementById(data) || window.document.querySelector(`[data-dialog-name="${data}"]`);
const viewName = Object.keys(visProject).find((view) => {
var _a2;
return (_a2 = visProject[view].widgets) == null ? void 0 : _a2[data];
});
if (viewName && ((_b = this.refViews[viewName]) == null ? void 0 : _b.onCommand)) {
this.refViews[viewName].onCommand("closeDialog", data);
}
if (el == null ? void 0 : el._showDialog) {
el._showDialog(false);
} else {
window.jQuery(`#${data}_dialog`).dialog("close");
}
break;
}
case "popup":
window.open(data);
break;
case "playSound":
setTimeout(() => {
var _a2;
let href;
if (data == null ? void 0 : data.match(/^http(s)?:\/\//)) {
href = data;
} else {
href = `${window.location.protocol}//${window.location.hostname}:${window.location.port}${data}`;
}
href += `?${Date.now()}`;
if ((_a2 = this.refSound) == null ? void 0 : _a2.current) {
this.refSound.current.setAttribute("src", href);
this.refSound.current.setAttribute("muted", false);
void this.refSound.current.play();
} else if (typeof Audio !== "undefined") {
const snd = new Audio(href);
snd.play().catch((e) => console.error(`Cannot play sound: ${e}`));
} else {
let sound = window.document.getElementById("external_sound");
if (!sound) {
sound = document.createElement("audio");
sound.setAttribute("id", "external_sound");
window.document.body.appendChild(sound);
}
sound.setAttribute("src", href);
void sound.play();
}
}, 1);
break;
case "tts":
if (typeof window.app !== "undefined") {
window.app.tts(data);
}
break;
default:
this.conn.logError(`unknown external command ${command}`);
}
return false;
}
onStateChange = (id, state) => {
var _a, _b, _c, _d;
if (!id || state === null || typeof state !== "object") {
return;
}
if (id === this.ID_CONTROL_COMMAND) {
if (state.ack) {
return;
}
if (state.ts && Date.now() - state.ts > 5e3) {
return;
}
let command;
if (state.val && typeof state.val === "string" && state.val[0] === "{" && state.val[state.val.length - 1] === "}") {
try {
command = JSON.parse(state.val);
} catch {
console.warn(`Command seems to be an object, but cannot parse it: ${state.val}`);
}
} else if (typeof state.val === "object") {
command = state.val;
}
if (command == null ? void 0 : command.instance) {
if (this.onUserCommand(command.instance, command.command, command.data)) {
this.props.socket.setState(id, {
val: "",
ack: true
}).catch((error) => console.error(`Cannot reset ${id}: ${error}`));
}
} else if (this.onUserCommand(this._cmdInstance, state.val, this._cmdData)) {
this.props.socket.setState(id, {
val: "",
ack: true
}).catch((error) => console.error(`Cannot reset ${id}: ${error}`));
}
return;
}
if (id === this.ID_CONTROL_DATA) {
if (state.ack) {
return;
}
if (this._cmdData !== void 0 && state.ts && Date.now() - state.ts > 5e3) {
return;
}
this._cmdData = state.val;
return;
}
if (id === this.ID_CONTROL_INSTANCE) {
if (state.ack) {
return;
}
if (this._cmdInstance !== void 0 && state.ts && Date.now() - state.ts > 5e3) {
return;
}
this._cmdInstance = state.val;
return;
}
const o = {};
o[`${id}.val`] = state.val;
if (state.ts !== void 0) {
o[`${id}.ts`] = state.ts;
}
if (state.ack !== void 0) {
o[`${id}.ack`] = state.ack;
}
if (state.lc !== void 0) {
o[`${id}.lc`] = state.lc;
}
if (state.q !== void 0 && state.q !== null) {
o[`${id}.q`] = state.q;
}
try {
this.canStates.attr(o);
} catch (e) {
this.props.socket.log(`Error: can't create states object for ${id}(${e}): ${JSON.stringify(e.stack)}`, "error");
}
(_a = this.linkContext.visibility[id]) == null ? void 0 : _a.forEach((item) => this.updateWidget(item.view, item.widget, "visibility", item));
(_b = this.linkContext.signals[id]) == null ? void 0 : _b.forEach((item) => this.updateWidget(item.view, item.widget, "signal", item, id));
(_c = this.linkContext.lastChanges[id]) == null ? void 0 : _c.forEach((item) => this.updateWidget(item.view, item.widget, "lastChange", item, id));
(_d = this.linkContext.bindings[id]) == null ? void 0 : _d.forEach((item) => this.updateWidget(item.view, item.widget, "binding", item, id));
this.onChangeCallbacks.forEach((item) => {
try {
item.callback(item.arg, id, state.val, state.ack, state.ts);
} catch (e) {
this.props.socket.log(`Error: can't update states object for ${id}(${e}): ${JSON.stringify(e.stack)}`, "error");
}
});
};
subscribe = (IDs) => {
if (!Array.isArray(IDs)) {
IDs = [
IDs
];
}
IDs.forEach((id) => {
if (this.subscribes[id]) {
this.subscribes[id]++;
} else {
this.subscribes[id] = 1;
console.log(`[${(/* @__PURE__ */ new Date()).toISOString()}] +SUBSCRIBE: ${id}`);
this.createCanState(id);
if (!isLocalStateId(id)) {
void this.props.socket.subscribeState(id, this.onStateChange);
}
}
});
};
createCanState(id) {
const _val = `${id}.val`;
if (this.canStates[_val] === void 0 || this.canStates[_val] === null) {
const now2 = Date.now();
const o = {};
if (isLocalStateId(id)) {
o[_val] = getUrlParameter(id);
} else {
o[_val] = "null";
o[`${id}.ts`] = now2;
o[`${id}.ack`] = false;
o[`${id}.lc`] = now2;
o[`${id}.q`] = 0;
}
try {
this.canStates.attr(o);
} catch (e) {
this.props.socket.log(`Error: can't create states object for ${id}(${e}): ${JSON.stringify(e.stack)}`, "error");
}
}
}
unsubscribe = (IDs) => {
if (!Array.isArray(IDs)) {
IDs = [
IDs
];
}
IDs.forEach((id) => {
if (this.subscribes[id]) {
this.subscribes[id]--;
if (!this.subscribes[id]) {
console.log(`[${(/* @__PURE__ */ new Date()).toISOString()}] -UNSUBSCRIBE: ${id}`);
if (!isLocalStateId(id)) {
this.props.socket.unsubscribeState(id, this.onStateChange);
}
delete this.subscribes[id];
}
}
});
};
updateCustomScripts() {
const { visProject } = store.getState();
if (visProject) {
if (!this.props.editMode) {
if (visProject.___settings) {
if (this.scripts !== (visProject.___settings.scripts || "")) {
this.scripts = visProject.___settings.scripts || "";
let userScript = window.document.getElementById("#vis_user_scripts");
if (!userScript) {
userScript = window.document.createElement("script");
userScript.setAttribute("id", "vis_user_scripts");
userScript.innerHTML = `try {
${this.scripts}
} catch (error) {
console.error('Cannot execute user script: ' + error);
}`;
try {
window.document.head.appendChild(userScript);
} catch (error) {
console.error(`Cannot execute user script: ${error}`);
}
} else {
userScript.innerHTML = this.scripts;
}
}
}
} else if (this.scripts) {
this.scripts = null;
let userScript = window.document.getElementById("#vis_user_scripts");
if (userScript) {
userScript.remove();
userScript = null;
}
}
}
}
static applyUserStyles(id, styles2) {
let styleEl = window.document.getElementById(id);
if (styleEl) {
styleEl.innerHTML = styles2;
} else {
styleEl = window.document.createElement("style");
styleEl.setAttribute("id", id);
styleEl.innerHTML = styles2;
if (id === "vis_common_user") {
const styleUserEl = window.document.getElementById("vis_user");
if (styleUserEl) {
window.document.body.insertBefore(styleEl, styleUserEl);
} else {
window.document.body.appendChild(styleEl);
}
} else if (id === "vis_user") {
window.document.body.appendChild(styleEl);
}
}
}
updateCommonCss() {
if (!this.visCommonCssLoaded || this.props.visCommonCss && this.visCommonCssLoaded !== this.props.visCommonCss) {
this.visCommonCssLoaded = this.props.visCommonCss || true;
if (this.props.visCommonCss) {
VisEngine.applyUserStyles("vis_common_user", this.visCommonCssLoaded || "");
} else {
readFile(this.props.socket, this.props.adapterId, "vis-common-user.css").then((file) => {
this.visCommonCssLoaded = file || true;
VisEngine.applyUserStyles("vis_common_user", file || "");
}).catch((e) => console.warn(`Common user CSS not found: ${e}`));
}
}
}
updateUserCss() {
if (!this.visUserCssLoaded || this.props.visUserCss && this.visUserCssLoaded !== this.props.visUserCss) {
this.visUserCssLoaded = this.props.visUserCss || true;
if (this.props.visUserCss) {
VisEngine.applyUserStyles("vis_user", this.visUserCssLoaded || "");
} else {
readFile(this.props.socket, `${this.props.adapterName}.${this.props.instance}`, `${this.props.projectName}/vis-user.css`).then((file) => {
this.visUserCssLoaded = file || true;
VisEngine.applyUserStyles("vis_user", file || "");
}).catch((e) => console.warn(`User CSS "${this.props.projectName}/vis-user.css" not found: ${e}`));
}
}
}
changeView = (view, subView) => {
if (this.props.editMode) {
window.alert(__mf_2.t("Ignored in edit mode"));
} else {
window.location.hash = VisEngine.buildPath(view, subView);
}
};
render() {
var _a;
if (!this.state.ready || this.props.widgetsLoaded < 2) {
if (this.props.renderAlertDialog && this.props.runtime) {
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
children: [
jsxRuntimeExports.jsx(__mf_61, {}),
this.props.renderAlertDialog()
]
});
}
return jsxRuntimeExports.jsx(__mf_61, {});
}
const { visProject } = store.getState();
this.vis.editMode = this.props.editMode;
this.vis.activeView = this.props.activeView;
this.vis.views = visProject;
this.updateCustomScripts();
this.updateCommonCss();
this.updateUserCss();
if (this.lastChangedView !== this.props.activeView && !this.props.editMode) {
this.lastChangedView = this.props.activeView;
void window.vis.conn.sendCommand(window.vis.instance, "changedView", this.props.projectName ? `${this.props.projectName}/${this.props.activeView}` : this.props.activeView);
(_a = window.jQuery) == null ? void 0 : _a.call(window, window).trigger("viewChanged", this.props.activeView);
}
this.visContext = {
$$: window.$$,
VisView,
activeView: this.props.activeView,
adapterName: this.props.adapterName,
additionalSets: VisWidgetsCatalog.additionalSets || {},
allWidgets: this.allWidgets,
askAboutInclude: this.props.askAboutInclude,
buildLegacyStructures: this.buildLegacyStructures,
can: this.can,
canStates: this.canStates,
changeProject: this.props.changeProject,
changeView: this.changeView,
dateFormat: this.vis.dateFormat,
disableInteraction: this.props.disableInteraction,
editModeComponentStyle: this.props.editModeComponentStyle,
formatUtils: this.formatUtils,
instance: this.props.instance,
jQuery: window.jQuery,
lang: this.props.lang,
linkContext: this.linkContext,
lockDragging: this.props.lockDragging,
moment: hooks,
onCommand: this.onCommand,
onIgnoreMouseEvents: this.props.runtime ? null : this.props.onIgnoreMouseEvents,
onWidgetsChanged: this.props.runtime ? null : this.props.onWidgetsChanged,
projectName: this.props.projectName,
registerEditorCallback: this.props.runtime ? null : this.props.registerEditorCallback,
runtime: this.props.runtime,
setSelectedGroup: this.props.runtime ? null : this.props.setSelectedGroup,
setSelectedWidgets: this.props.runtime ? null : this.props.setSelectedWidgets,
setTimeInterval: this.setTimeInterval,
setTimeStart: this.setTimeStart,
setValue: this.setValue,
showWidgetNames: this.props.showWidgetNames,
socket: this.props.socket,
systemConfig: this.systemConfig,
theme: this.props.theme,
themeName: this.props.themeName,
themeType: this.props.themeType,
timeInterval: this.state.timeInterval,
timeStart: this.state.timeStart,
toggleTheme: this.props.toggleTheme,
user: this.userName,
userGroups: this.props.userGroups,
views: visProject,
widgetHint: this.props.widgetHint
};
const views = Object.keys(visProject).map((view) => {
var _a2;
if (view !== "___settings" && (view === this.props.activeView || ((_a2 = visProject[view].settings) == null ? void 0 : _a2.alwaysRender) && !this.props.selectedGroup || !this.props.editMode && this.state.legacyRequestedViews.includes(view))) {
return jsxRuntimeExports.jsx(VisView, {
theme: this.props.theme,
context: this.visContext,
activeView: this.props.activeView,
editMode: this.props.editMode,
viewsActiveFilter: this.viewsActiveFilter,
selectedGroup: this.props.runtime ? null : this.props.selectedGroup,
selectedWidgets: this.props.runtime ? null : this.props.selectedWidgets,
view
}, view);
}
return null;
});
if (this.refSound) {
views.push(jsxRuntimeExports.jsx("audio", {
ref: this.refSound,
id: "external_sound",
autoPlay: true,
muted: true
}, "__audio_145"));
}
if (this.props.renderAlertDialog && this.props.runtime) {
views.push(this.props.renderAlertDialog());
}
views.push(this.renderMessageDialog());
return views;
}
}
const Message$a = "Message";
const Ok$a = "Ok";
const Cancel$a = "Cancel";
const vis_2_widgets_basic_contains_view$a = "Use view";
const vis_2_widgets_basic_cannot_recursive$a = "Cannot use recursive views";
const vis_2_widgets_basic_view_not_defined$a = "View not defined";
const vis_2_widgets_basic_view_in_widget$a = "View in widget";
const welcome_message$a = "No one project yet exists.";
const enLang = {
'Unknown widget type "%s"': 'Unknown widget type "%s"',
Message: Message$a,
Ok: Ok$a,
Cancel: Cancel$a,
"Received user command: %s": "Received user command: %s",
vis_2_widgets_basic_contains_view: vis_2_widgets_basic_contains_view$a,
vis_2_widgets_basic_cannot_recursive: vis_2_widgets_basic_cannot_recursive$a,
vis_2_widgets_basic_view_not_defined: vis_2_widgets_basic_view_not_defined$a,
vis_2_widgets_basic_view_in_widget: vis_2_widgets_basic_view_in_widget$a,
"Create new project": "Create new project",
"Project name": "Project name",
'Project "%s" does not exist': 'Project "%s" does not exist',
welcome_message: welcome_message$a,
"Select vis-2 project": 'Select "vis-2" project',
'Create or import new "vis-2" project': 'Create or import new "vis-2" project',
"Load project file...": "Loading project file...",
"Load widgets...": "Loading widgets...",
"Loading objects...": "Loading objects..."
};
const Cancel$9 = "Stornieren";
const Message$9 = "Nachricht";
const Ok$9 = "OK";
const vis_2_widgets_basic_cannot_recursive$9 = "Rekursive Ansichten k\xF6nnen nicht verwendet werden";
const vis_2_widgets_basic_contains_view$9 = "Ansicht verwenden";
const vis_2_widgets_basic_view_in_widget$9 = "Im Widget anzeigen";
const vis_2_widgets_basic_view_not_defined$9 = "Ansicht nicht definiert";
const welcome_message$9 = "Es existiert noch kein Projekt.";
const deLang = {
"Create new project": "Neues Projekt erstellen",
Cancel: Cancel$9,
Message: Message$9,
Ok: Ok$9,
"Received user command: %s": "Benutzerbefehl erhalten: %s",
'Unknown widget type "%s"': "Unbekannter Widget-Typ \u201E%s\u201C",
vis_2_widgets_basic_cannot_recursive: vis_2_widgets_basic_cannot_recursive$9,
vis_2_widgets_basic_contains_view: vis_2_widgets_basic_contains_view$9,
vis_2_widgets_basic_view_in_widget: vis_2_widgets_basic_view_in_widget$9,
vis_2_widgets_basic_view_not_defined: vis_2_widgets_basic_view_not_defined$9,
"Project name": "Projektname",
'Project "%s" does not exist': "Projekt \u201E%s\u201C existiert nicht",
welcome_message: welcome_message$9,
"Select vis-2 project": "Das Projekt \u201Evis-2\u201C ausw\xE4hlen",
'Create or import new "vis-2" project': "Neues \u201Evis-2\u201C-Projekt erstellen oder importieren",
"Load project file...": "Projektdatei wird geladen...",
"Load widgets...": "Widgets werden geladen...",
"Loading objects...": "Objekte werden geladen..."
};
const Cancel$8 = "\u041E\u0442\u043C\u0435\u043D\u0430";
const Message$8 = "\u0421\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435";
const Ok$8 = "\u0425\u043E\u0440\u043E\u0448\u043E";
const vis_2_widgets_basic_cannot_recursive$8 = "\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0440\u0435\u043A\u0443\u0440\u0441\u0438\u0432\u043D\u044B\u0435 \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0438\u044F";
const vis_2_widgets_basic_contains_view$8 = "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432\u0438\u0434";
const vis_2_widgets_basic_view_in_widget$8 = "\u041F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u0432 \u0432\u0438\u0434\u0436\u0435\u0442\u0435";
const vis_2_widgets_basic_view_not_defined$8 = "\u0412\u0438\u0434 \u043D\u0435 \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D";
const welcome_message$8 = "\u041D\u0438 \u043E\u0434\u043D\u043E\u0433\u043E \u043F\u0440\u043E\u0435\u043A\u0442\u0430 \u043F\u043E\u043A\u0430 \u043D\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.";
const ruLang = {
"Create new project": "\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u043D\u043E\u0432\u044B\u0439 \u043F\u0440\u043E\u0435\u043A\u0442",
Cancel: Cancel$8,
Message: Message$8,
Ok: Ok$8,
"Received user command: %s": "\u041F\u043E\u043B\u0443\u0447\u0435\u043D\u043D\u0430\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0430\u044F \u043A\u043E\u043C\u0430\u043D\u0434\u0430: %s",
'Unknown widget type "%s"': '\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u044B\u0439 \u0442\u0438\u043F \u0432\u0438\u0434\u0436\u0435\u0442\u0430 "%s"',
vis_2_widgets_basic_cannot_recursive: vis_2_widgets_basic_cannot_recursive$8,
vis_2_widgets_basic_contains_view: vis_2_widgets_basic_contains_view$8,
vis_2_widgets_basic_view_in_widget: vis_2_widgets_basic_view_in_widget$8,
vis_2_widgets_basic_view_not_defined: vis_2_widgets_basic_view_not_defined$8,
"Project name": "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u043F\u0440\u043E\u0435\u043A\u0442\u0430",
'Project "%s" does not exist': '\u041F\u0440\u043E\u0435\u043A\u0442 "%s" \u043D\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442',
welcome_message: welcome_message$8,
"Select vis-2 project": '\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u043F\u0440\u043E\u0435\u043A\u0442 "vis-2"',
'Create or import new "vis-2" project': '\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u0438\u043B\u0438 \u0438\u043C\u043F\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043D\u043E\u0432\u044B\u0439 \u043F\u0440\u043E\u0435\u043A\u0442 "vis-2"',
"Load project file...": "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0444\u0430\u0439\u043B\u0430 \u043F\u0440\u043E\u0435\u043A\u0442\u0430...",
"Load widgets...": "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0432\u0438\u0434\u0436\u0435\u0442\u043E\u0432...",
"Loading objects...": "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u043E\u0431\u044A\u0435\u043A\u0442\u043E\u0432..."
};
const Cancel$7 = "Cancelar";
const Message$7 = "Mensagem";
const Ok$7 = "OK";
const vis_2_widgets_basic_cannot_recursive$7 = "N\xE3o \xE9 poss\xEDvel usar exibi\xE7\xF5es recursivas";
const vis_2_widgets_basic_contains_view$7 = "Usar visualiza\xE7\xE3o";
const vis_2_widgets_basic_view_in_widget$7 = "Ver no widget";
const vis_2_widgets_basic_view_not_defined$7 = "Visualiza\xE7\xE3o n\xE3o definida";
const welcome_message$7 = "Nenhum projeto ainda existe.";
const ptLang = {
"Create new project": "Criar novo projeto",
Cancel: Cancel$7,
Message: Message$7,
Ok: Ok$7,
"Received user command: %s": "Comando de usu\xE1rio recebido: %s",
'Unknown widget type "%s"': 'Tipo de widget desconhecido "%s"',
vis_2_widgets_basic_cannot_recursive: vis_2_widgets_basic_cannot_recursive$7,
vis_2_widgets_basic_contains_view: vis_2_widgets_basic_contains_view$7,
vis_2_widgets_basic_view_in_widget: vis_2_widgets_basic_view_in_widget$7,
vis_2_widgets_basic_view_not_defined: vis_2_widgets_basic_view_not_defined$7,
"Project name": "Nome do Projeto",
'Project "%s" does not exist': 'O projeto "%s" n\xE3o existe',
welcome_message: welcome_message$7,
"Select vis-2 project": 'Selecione o projeto "vis-2"',
'Create or import new "vis-2" project': 'Crie ou importe um novo projeto "vis-2"',
"Load project file...": "Carregando arquivo do projeto...",
"Load widgets...": "Carregando widgets...",
"Loading objects...": "Carregando objetos..."
};
const Cancel$6 = "Annuleren";
const Message$6 = "Bericht";
const Ok$6 = "OK";
const vis_2_widgets_basic_cannot_recursive$6 = "Kan geen recursieve weergaven gebruiken";
const vis_2_widgets_basic_contains_view$6 = "Gebruik weergave";
const vis_2_widgets_basic_view_in_widget$6 = "Bekijk in widget";
const vis_2_widgets_basic_view_not_defined$6 = "Uitzicht niet gedefinieerd";
const welcome_message$6 = "Er is nog geen enkel project.";
const nlLang = {
"Create new project": "Maak een nieuw project aan",
Cancel: Cancel$6,
Message: Message$6,
Ok: Ok$6,
"Received user command: %s": "Gebruikersopdracht ontvangen: %s",
'Unknown widget type "%s"': 'Onbekend widgettype "%s"',
vis_2_widgets_basic_cannot_recursive: vis_2_widgets_basic_cannot_recursive$6,
vis_2_widgets_basic_contains_view: vis_2_widgets_basic_contains_view$6,
vis_2_widgets_basic_view_in_widget: vis_2_widgets_basic_view_in_widget$6,
vis_2_widgets_basic_view_not_defined: vis_2_widgets_basic_view_not_defined$6,
"Project name": "Naam van het project",
'Project "%s" does not exist': 'Project "%s" bestaat niet',
welcome_message: welcome_message$6,
"Select vis-2 project": 'Selecteer het "vis-2"-project',
'Create or import new "vis-2" project': 'Cre\xEBer of importeer een nieuw "vis-2" project',
"Load project file...": "Projectbestand laden...",
"Load widgets...": "Widgets laden...",
"Loading objects...": "Objecten laden..."
};
const Cancel$5 = "Annuler";
const Message$5 = "Message";
const Ok$5 = "D'accord";
const vis_2_widgets_basic_cannot_recursive$5 = "Impossible d'utiliser les vues r\xE9cursives";
const vis_2_widgets_basic_contains_view$5 = "Utiliser la vue";
const vis_2_widgets_basic_view_in_widget$5 = "Afficher dans le widget";
const vis_2_widgets_basic_view_not_defined$5 = "Vue non d\xE9finie";
const welcome_message$5 = "Aucun projet n'existe encore.";
const frLang = {
"Create new project": "Cr\xE9er un nouveau projet",
Cancel: Cancel$5,
Message: Message$5,
Ok: Ok$5,
"Received user command: %s": "Commande utilisateur re\xE7ue\xA0: %s",
'Unknown widget type "%s"': 'Type de widget inconnu "%s"',
vis_2_widgets_basic_cannot_recursive: vis_2_widgets_basic_cannot_recursive$5,
vis_2_widgets_basic_contains_view: vis_2_widgets_basic_contains_view$5,
vis_2_widgets_basic_view_in_widget: vis_2_widgets_basic_view_in_widget$5,
vis_2_widgets_basic_view_not_defined: vis_2_widgets_basic_view_not_defined$5,
"Project name": "Nom du projet",
'Project "%s" does not exist': `Le projet "%s" n'existe pas`,
welcome_message: welcome_message$5,
"Select vis-2 project": 'S\xE9lectionnez le projet "vis-2"',
'Create or import new "vis-2" project': 'Cr\xE9er ou importer un nouveau projet "vis-2"',
"Load project file...": "Chargement du fichier de projet...",
"Load widgets...": "Chargement des widgets...",
"Loading objects...": "Chargement d'objets..."
};
const Cancel$4 = "Annulla";
const Message$4 = "Messaggio";
const Ok$4 = "OK";
const vis_2_widgets_basic_cannot_recursive$4 = "Impossibile utilizzare viste ricorsive";
const vis_2_widgets_basic_contains_view$4 = "Usa vista";
const vis_2_widgets_basic_view_in_widget$4 = "Visualizza nel widget";
const vis_2_widgets_basic_view_not_defined$4 = "Vista non definita";
const welcome_message$4 = "Non esiste ancora un progetto.";
const itLang = {
"Create new project": "Crea nuovo progetto",
Cancel: Cancel$4,
Message: Message$4,
Ok: Ok$4,
"Received user command: %s": "Comando utente ricevuto: %s",
'Unknown widget type "%s"': 'Tipo di widget sconosciuto "%s"',
vis_2_widgets_basic_cannot_recursive: vis_2_widgets_basic_cannot_recursive$4,
vis_2_widgets_basic_contains_view: vis_2_widgets_basic_contains_view$4,
vis_2_widgets_basic_view_in_widget: vis_2_widgets_basic_view_in_widget$4,
vis_2_widgets_basic_view_not_defined: vis_2_widgets_basic_view_not_defined$4,
"Project name": "Nome del progetto",
'Project "%s" does not exist': 'Il progetto "%s" non esiste',
welcome_message: welcome_message$4,
"Select vis-2 project": 'Seleziona il progetto "vis-2".',
'Create or import new "vis-2" project': 'Crea o importa un nuovo progetto "vis-2".',
"Load project file...": "Caricamento file di progetto...",
"Load widgets...": "Caricamento widget...",
"Loading objects...": "Caricamento oggetti..."
};
const Cancel$3 = "Cancelar";
const Message$3 = "Mensaje";
const Ok$3 = "De acuerdo";
const vis_2_widgets_basic_cannot_recursive$3 = "No se pueden usar vistas recursivas";
const vis_2_widgets_basic_contains_view$3 = "Usar vista";
const vis_2_widgets_basic_view_in_widget$3 = "Ver en widget";
const vis_2_widgets_basic_view_not_defined$3 = "Vista no definida";
const welcome_message$3 = "A\xFAn no existe ning\xFAn proyecto.";
const esLang = {
"Create new project": "Crear nuevo proyecto",
Cancel: Cancel$3,
Message: Message$3,
Ok: Ok$3,
"Received user command: %s": "Comando de usuario recibido: %s",
'Unknown widget type "%s"': 'Tipo de widget desconocido "%s"',
vis_2_widgets_basic_cannot_recursive: vis_2_widgets_basic_cannot_recursive$3,
vis_2_widgets_basic_contains_view: vis_2_widgets_basic_contains_view$3,
vis_2_widgets_basic_view_in_widget: vis_2_widgets_basic_view_in_widget$3,
vis_2_widgets_basic_view_not_defined: vis_2_widgets_basic_view_not_defined$3,
"Project name": "Nombre del proyecto",
'Project "%s" does not exist': 'El proyecto "%s" no existe',
welcome_message: welcome_message$3,
"Select vis-2 project": 'Seleccione el proyecto "vis-2"',
'Create or import new "vis-2" project': 'Crear o importar un nuevo proyecto "vis-2"',
"Load project file...": "Cargando archivo de proyecto...",
"Load widgets...": "Cargando widgets...",
"Loading objects...": "Cargando objetos..."
};
const Cancel$2 = "Anulowa\u0107";
const Message$2 = "Wiadomo\u015B\u0107";
const Ok$2 = "OK";
const vis_2_widgets_basic_cannot_recursive$2 = "Nie mo\u017Cna u\u017Cywa\u0107 widok\xF3w rekurencyjnych";
const vis_2_widgets_basic_contains_view$2 = "U\u017Cyj widoku";
const vis_2_widgets_basic_view_in_widget$2 = "Zobacz w widgecie";
const vis_2_widgets_basic_view_not_defined$2 = "Widok niezdefiniowany";
const welcome_message$2 = "\u017Baden projekt jeszcze nie istnieje.";
const plLang = {
"Create new project": "Utw\xF3rz nowy projekt",
Cancel: Cancel$2,
Message: Message$2,
Ok: Ok$2,
"Received user command: %s": "Otrzymano polecenie u\u017Cytkownika: %s",
'Unknown widget type "%s"': "Nieznany typ wid\u017Cetu \u201E%s\u201D",
vis_2_widgets_basic_cannot_recursive: vis_2_widgets_basic_cannot_recursive$2,
vis_2_widgets_basic_contains_view: vis_2_widgets_basic_contains_view$2,
vis_2_widgets_basic_view_in_widget: vis_2_widgets_basic_view_in_widget$2,
vis_2_widgets_basic_view_not_defined: vis_2_widgets_basic_view_not_defined$2,
"Project name": "Nazwa Projektu",
'Project "%s" does not exist': 'Projekt "%s" nie istnieje',
welcome_message: welcome_message$2,
"Select vis-2 project": "Wybierz projekt \u201Evis-2\u201D.",
'Create or import new "vis-2" project': "Utw\xF3rz lub zaimportuj nowy projekt \u201Evis-2\u201D.",
"Load project file...": "\u0141adowanie pliku projektu...",
"Load widgets...": "\u0141adowanie wid\u017Cet\xF3w...",
"Loading objects...": "\u0141adowanie obiekt\xF3w..."
};
const Cancel$1 = "\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438";
const Message$1 = "\u043F\u043E\u0432\u0456\u0434\u043E\u043C\u043B\u0435\u043D\u043D\u044F";
const Ok$1 = "\u0412 \u043F\u043E\u0440\u044F\u0434\u043A\u0443";
const vis_2_widgets_basic_cannot_recursive$1 = "\u041D\u0435 \u043C\u043E\u0436\u043D\u0430 \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u043E\u0432\u0443\u0432\u0430\u0442\u0438 \u0440\u0435\u043A\u0443\u0440\u0441\u0438\u0432\u043D\u0456 \u043F\u0435\u0440\u0435\u0433\u043B\u044F\u0434\u0438";
const vis_2_widgets_basic_contains_view$1 = "\u0412\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u043E\u0432\u0443\u0439\u0442\u0435 \u043F\u0435\u0440\u0435\u0433\u043B\u044F\u0434";
const vis_2_widgets_basic_view_in_widget$1 = "\u041F\u0435\u0440\u0435\u0433\u043B\u044F\u043D\u0443\u0442\u0438 \u0443 \u0432\u0456\u0434\u0436\u0435\u0442\u0456";
const vis_2_widgets_basic_view_not_defined$1 = "\u041F\u0435\u0440\u0435\u0433\u043B\u044F\u0434 \u043D\u0435 \u0432\u0438\u0437\u043D\u0430\u0447\u0435\u043D\u043E";
const welcome_message$1 = "\u0416\u043E\u0434\u043D\u043E\u0433\u043E \u043F\u0440\u043E\u0435\u043A\u0442\u0443 \u0449\u0435 \u043D\u0435\u043C\u0430\u0454.";
const ukLang = {
"Create new project": "\u0421\u0442\u0432\u043E\u0440\u0438\u0442\u0438 \u043D\u043E\u0432\u0438\u0439 \u043F\u0440\u043E\u0435\u043A\u0442",
Cancel: Cancel$1,
Message: Message$1,
Ok: Ok$1,
"Received user command: %s": "\u041E\u0442\u0440\u0438\u043C\u0430\u043D\u043E \u043A\u043E\u043C\u0430\u043D\u0434\u0443 \u043A\u043E\u0440\u0438\u0441\u0442\u0443\u0432\u0430\u0447\u0430: %s",
'Unknown widget type "%s"': '\u041D\u0435\u0432\u0456\u0434\u043E\u043C\u0438\u0439 \u0442\u0438\u043F \u0432\u0456\u0434\u0436\u0435\u0442\u0430 "%s"',
vis_2_widgets_basic_cannot_recursive: vis_2_widgets_basic_cannot_recursive$1,
vis_2_widgets_basic_contains_view: vis_2_widgets_basic_contains_view$1,
vis_2_widgets_basic_view_in_widget: vis_2_widgets_basic_view_in_widget$1,
vis_2_widgets_basic_view_not_defined: vis_2_widgets_basic_view_not_defined$1,
"Project name": "\u041D\u0430\u0437\u0432\u0430 \u043F\u0440\u043E\u0435\u043A\u0442\u0443",
'Project "%s" does not exist': '\u041F\u0440\u043E\u0435\u043A\u0442 "%s" \u043D\u0435 \u0456\u0441\u043D\u0443\u0454',
welcome_message: welcome_message$1,
"Select vis-2 project": "\u0412\u0438\u0431\u0435\u0440\u0456\u0442\u044C \u043F\u0440\u043E\u0435\u043A\u0442 \xABvis-2\xBB.",
'Create or import new "vis-2" project': '\u0421\u0442\u0432\u043E\u0440\u0456\u0442\u044C \u0430\u0431\u043E \u0456\u043C\u043F\u043E\u0440\u0442\u0443\u0439\u0442\u0435 \u043D\u043E\u0432\u0438\u0439 \u043F\u0440\u043E\u0435\u043A\u0442 "vis-2".',
"Load project file...": "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F \u0444\u0430\u0439\u043B\u0443 \u043F\u0440\u043E\u0435\u043A\u0442\u0443...",
"Load widgets...": "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F \u0432\u0456\u0434\u0436\u0435\u0442\u0456\u0432...",
"Loading objects...": "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F \u043E\u0431'\u0454\u043A\u0442\u0456\u0432..."
};
const Cancel = "\u53D6\u6D88";
const Message = "\u4FE1\u606F";
const Ok = "\u597D\u7684";
const vis_2_widgets_basic_cannot_recursive = "\u4E0D\u80FD\u4F7F\u7528\u9012\u5F52\u89C6\u56FE";
const vis_2_widgets_basic_contains_view = "\u4F7F\u7528\u89C6\u56FE";
const vis_2_widgets_basic_view_in_widget = "\u5728\u5C0F\u90E8\u4EF6\u4E2D\u67E5\u770B";
const vis_2_widgets_basic_view_not_defined = "\u67E5\u770B\u672A\u5B9A\u4E49";
const welcome_message = "\u76EE\u524D\u8FD8\u6CA1\u6709\u4E00\u4E2A\u9879\u76EE\u5B58\u5728\u3002";
const zhLang = {
"Create new project": "\u521B\u5EFA\u65B0\u9879\u76EE",
Cancel,
Message,
Ok,
"Received user command: %s": "\u6536\u5230\u7528\u6237\u547D\u4EE4\uFF1A%s",
'Unknown widget type "%s"': "\u672A\u77E5\u7684\u5C0F\u90E8\u4EF6\u7C7B\u578B\u201C%s\u201D",
vis_2_widgets_basic_cannot_recursive,
vis_2_widgets_basic_contains_view,
vis_2_widgets_basic_view_in_widget,
vis_2_widgets_basic_view_not_defined,
"Project name": "\u9879\u76EE\u540D",
'Project "%s" does not exist': "\u9879\u76EE\u201C%s\u201D\u4E0D\u5B58\u5728",
welcome_message,
"Select vis-2 project": "\u9009\u62E9\u201Cvis-2\u201D\u9879\u76EE",
'Create or import new "vis-2" project': "\u521B\u5EFA\u6216\u5BFC\u5165\u65B0\u7684\u201Cvis-2\u201D\u9879\u76EE",
"Load project file...": "\u6B63\u5728\u52A0\u8F7D\u9879\u76EE\u6587\u4EF6...",
"Load widgets...": "\u6B63\u5728\u52A0\u8F7D\u5C0F\u90E8\u4EF6...",
"Loading objects...": "\u6B63\u5728\u52A0\u8F7D\u5BF9\u8C61..."
};
const styles = {
editModeComponentStyle: {
zIndex: 1002
}
};
class Runtime extends __mf_1 {
static WIDGETS_LOADING_STEP_NOT_STARTED = 0;
static WIDGETS_LOADING_STEP_HTML_LOADED = 1;
static WIDGETS_LOADING_STEP_ALL_LOADED = 2;
alert;
adapterId;
checkTimeout;
resolutionTimer;
lastProjectJSONfile;
subscribedProject;
changeTimer;
needRestart;
lastUploadedState;
checkForUpdates;
getNewWidgetId;
getNewGroupId;
changeProject;
setSelectedWidgets;
setSelectedGroup;
onWidgetsChanged;
registerCallback;
onIgnoreMouseEvents;
askAboutInclude;
showLegacyFileSelector;
initState;
setLoadingText;
constructor(props) {
const extendedProps = {
...props
};
extendedProps.translations = {
en: enLang,
de: deLang,
ru: ruLang,
pt: ptLang,
nl: nlLang,
fr: frLang,
it: itLang,
es: esLang,
pl: plLang,
uk: ukLang,
"zh-cn": zhLang
};
extendedProps.Connection = __mf_121$1;
if (!window.disableDataReporting) {
extendedProps.sentryDSN = window.sentryDSN;
}
if (window.location.port === "3000") {
extendedProps.socket = {
port: "8082"
};
}
if (window.socketUrl && window.socketUrl.startsWith(":")) {
window.socketUrl = `${window.location.protocol}//${window.location.hostname}${window.socketUrl}`;
}
extendedProps.instance = window.visAdapterInstance;
super(props, extendedProps);
this.socket.setStateToIgnore("nothing_selected");
this.alert = window.alert;
window.alert = (message) => {
if (message == null ? void 0 : message.toString().toLowerCase().includes("error")) {
console.error(message);
this.showAlert(message.toString(), "error");
} else {
console.log(message);
this.showAlert(message.toString(), "info");
}
};
this.adapterId = `${this.adapterName}.0`;
registerWidgetsLoadIndicator(this.setWidgetsLoadingProgress);
}
createTheme(name) {
return createTheme(__mf_70.getThemeName(name));
}
setWidgetsLoadingProgress;
setStateAsync(newState) {
return new Promise((resolve) => {
this.setState(newState, () => resolve());
});
}
componentDidMount() {
super.componentDidMount();
const newState = {
alert: false,
alertType: "info",
alertMessage: "",
runtime: true,
projectName: "main",
selectedWidgets: [],
editMode: false,
widgetsLoaded: Runtime.WIDGETS_LOADING_STEP_NOT_STARTED,
fonts: [],
visCommonCss: null,
visUserCss: null,
showProjectsDialog: false,
showNewProjectDialog: false,
showImportDialogDialog: false,
newProjectName: "",
projects: null,
projectDoesNotExist: false
};
if (this.initState) {
this.initState(newState);
}
this.setState(newState);
window.addEventListener("hashchange", this.onHashChange, false);
if (newState.runtime) {
window.addEventListener("orientationchange", this.orientationChange, false);
window.addEventListener("resize", this.orientationChange, false);
}
}
componentWillUnmount() {
super.componentWillUnmount();
window.removeEventListener("hashchange", this.onHashChange, false);
if (this.checkTimeout) {
clearTimeout(this.checkTimeout);
this.checkTimeout = null;
}
if (this.resolutionTimer) {
clearTimeout(this.resolutionTimer);
this.resolutionTimer = null;
}
if (this.state.runtime) {
window.removeEventListener("orientationchange", this.orientationChange, false);
window.removeEventListener("resize", this.orientationChange, false);
}
window.alert = this.alert;
}
onHashChange = () => {
const currentPath = VisEngine.getCurrentPath();
this.changeView(currentPath.view).catch((e) => console.error(`Cannot change view: ${e}`));
};
onProjectChange = (_id, fileName) => {
if (fileName.endsWith(".json")) {
if (this.checkTimeout) {
clearTimeout(this.checkTimeout);
}
if (this.state.runtime) {
this.checkTimeout = setTimeout(() => {
this.checkTimeout = null;
void this.loadProject(this.state.projectName);
}, 500);
} else if (fileName.endsWith(`${this.state.projectName}/vis-views.json`)) {
this.checkTimeout = setTimeout(() => {
this.checkTimeout = null;
void readFile(this.socket, this.adapterId, fileName).then((file) => {
try {
const ts = JSON.parse(file.file || file).___settings.ts;
if (ts === store.getState().visProject.___settings.ts) {
return;
}
const tsInt = parseInt(ts.split(".")[0], 10);
if (tsInt < parseInt(store.getState().visProject.___settings.ts.split(".")[0], 10)) {
return;
}
} catch (e) {
console.warn(`Cannot parse project file "${fileName}": ${e}`);
}
this.setState({
showProjectUpdateDialog: true
});
});
}, 500);
}
}
};
fixProject(project) {
var _a, _b;
project.___settings || (project.___settings = {});
(_a = project.___settings).folders || (_a.folders = []);
(_b = project.___settings).openedViews || (_b.openedViews = []);
Object.keys(project).forEach((view) => {
var _a2, _b2, _c, _d;
if (view === "___settings") {
(_a2 = project.___settings.marketplace) == null ? void 0 : _a2.forEach((group) => {
var _a3;
(_a3 = group.widget) == null ? void 0 : _a3.forEach((widget) => {
if (widget.set) {
widget.widgetSet = widget.set;
delete widget.set;
}
});
});
return;
}
if (!project[view]) {
delete project[view];
return;
}
(_b2 = project[view]).settings || (_b2.settings = {});
(_c = project[view].settings).style || (_c.style = {});
(_d = project[view]).widgets || (_d.widgets = {});
if (project[view].widgets) {
Object.keys(project[view].widgets).forEach((wid) => {
var _a3;
const widget = project[view].widgets[wid];
if (!widget) {
delete project[view].widgets[wid];
return;
}
widget.data || (widget.data = {});
widget.style || (widget.style = {});
if (widget.data.members && !Array.isArray(widget.data.members)) {
widget.data.members = [];
}
delete widget.style["box-sizing"];
if (!widget.data.bindings && !Array.isArray(widget.data.bindings)) {
widget.data.bindings = [];
Object.keys(widget.data).forEach((attr) => {
if (attr === "bindings" || !widget.data[attr] || attr.startsWith("g_") || typeof widget.data[attr] !== "string") {
return;
}
const OIDs = extractBinding(widget.data[attr]);
if (OIDs) {
widget.data.bindings.push(attr);
}
});
}
if (!widget.style.bindings && !Array.isArray(widget.style.bindings)) {
widget.style.bindings = [];
Object.keys(widget.style).forEach((attr) => {
if (attr === "bindings" || !widget.style[attr] || attr.startsWith("g_") || typeof widget.data[attr] !== "string") {
return;
}
const OIDs = extractBinding(widget.style[attr].toString());
if (OIDs) {
widget.style.bindings.push(attr);
}
});
}
if (widget.data.members) {
widget.data.members.forEach((_wid, i) => widget.data.members[i] = _wid.replace(/\s/g, "_"));
}
if (wid.includes(" ")) {
const newWid = wid.replace(/\s/g, "_");
delete project[view].widgets[wid];
project[view].widgets[newWid] = widget;
}
if (!this.state.runtime && this.getNewWidgetId) {
if (Object.keys(project).find((v) => v !== view && project[v].widgets && project[v].widgets[wid])) {
const _newWid = wid[0] === "g" ? this.getNewGroupId(project) : this.getNewWidgetId(project);
console.log(`Rename widget ${wid} to ${_newWid}`);
delete project[view].widgets[wid];
project[view].widgets[_newWid] = widget;
}
}
if (widget.tpl === "_tplGroup" && widget.data.attrCount !== void 0) {
(_a3 = widget.data).members || (_a3.members = []);
for (let i = 1; i <= widget.data.attrCount; i++) {
const attrName = widget.data[`attrName${i}`];
const attrType = widget.data[`attrType${i}`];
widget.data[`attrName_groupAttr${i}`] = attrName || `groupAttr${i}`;
widget.data[`attrType_groupAttr${i}`] = attrType || "";
delete widget.data[`attrName${i}`];
delete widget.data[`attrType${i}`];
}
delete widget.data.attrCount;
}
});
}
});
}
static syncMultipleWidgets(project) {
project || (project = store.getState().visProject);
Object.keys(project).forEach((view) => {
if (view === "___settings") {
return;
}
const oView = project[view];
const widgetIDs = Object.keys(oView.widgets);
widgetIDs.forEach((widgetId) => {
const oWidget = oView.widgets[widgetId];
if (oWidget.data && oWidget.data["multi-views"]) {
const views = oWidget.data["multi-views"].split(",");
views.forEach((viewId) => {
var _a;
if (viewId !== view && project[viewId]) {
project[viewId].widgets[`${view}_${widgetId}`] = JSON.parse(JSON.stringify(oWidget));
delete project[viewId].widgets[`${view}_${widgetId}`].data["multi-views"];
if (oWidget.tpl === "_tplGroup" && ((_a = oWidget.data.members) == null ? void 0 : _a.length)) {
const newWidget = project[viewId].widgets[`${view}_${widgetId}`];
newWidget.data.members.forEach((memberId, i) => {
const newId = `${view}_${memberId}`;
project[viewId].widgets[newId] = JSON.parse(JSON.stringify(oView.widgets[memberId]));
delete project[viewId].widgets[newId].data["multi-views"];
newWidget.data.members[i] = newId;
if (project[viewId].widgets[newId].data.members) {
project[viewId].widgets[newId].data.members = [];
}
});
}
}
});
}
if (findWidgetUsages(project, view, widgetId).length) {
oWidget.usedInWidget = true;
} else if (oWidget.usedInWidget) {
delete oWidget.usedInWidget;
}
});
});
}
static findViewWithNearestResolution(project, resultRequired) {
const w = window.innerWidth;
const h = window.innerHeight;
let result = null;
const views = [];
let difference = 1e4;
if (project) {
Object.keys(project).forEach((view) => {
var _a;
if (view === "___settings") {
return;
}
if (((_a = project[view].settings) == null ? void 0 : _a.useAsDefault) && Math.abs(project[view].settings.sizex - w) / project[view].settings.sizex < 0.2) {
views.push(view);
}
});
}
for (let i = 0; i < views.length; i++) {
if (Math.abs(project[views[i]].settings.sizey - h) < difference) {
result = views[i];
difference = Math.abs(parseInt(project[views[i]].settings.sizey.toString(), 10) - h);
}
}
if (!result) {
const ratio = w / h;
difference = 1e4;
if (project) {
Object.keys(project).forEach((view) => {
var _a, _b, _c, _d, _e;
if (view === "___settings") {
return;
}
const sizeX = parseInt(((_b = (_a = project[view].settings) == null ? void 0 : _a.sizex) == null ? void 0 : _b.toString()) || "0", 10);
const sizeY = parseInt(((_d = (_c = project[view].settings) == null ? void 0 : _c.sizey) == null ? void 0 : _d.toString()) || "0", 10);
if (((_e = project[view].settings) == null ? void 0 : _e.useAsDefault) && sizeY && Math.abs(ratio - sizeX / sizeY) < difference) {
result = view;
difference = Math.abs(ratio - sizeX / sizeY);
}
});
}
}
if (!result && resultRequired && project) {
result = Object.keys(project).find((view) => {
var _a;
return !view.startsWith("__") && ((_a = project[view].settings) == null ? void 0 : _a.useAsDefault);
});
}
if (!result && resultRequired) {
return project && Object.keys(project).find((view) => !view.startsWith("__")) || "";
}
return result;
}
loadProject = async (projectName) => {
var _a, _b, _c;
let fileStr;
(_a = this.setLoadingText) == null ? void 0 : _a.call(this, "Load project file...");
try {
const file = await readFile(this.socket, this.adapterId, `${projectName}/vis-views.json`);
if (typeof file === "object") {
fileStr = file.file;
} else {
fileStr = file;
}
} catch (err) {
console.warn(`Cannot read project file "${projectName}/vis-views.json": ${err}`);
fileStr = "{}";
}
(_b = this.setLoadingText) == null ? void 0 : _b.call(this, null);
if (!fileStr || fileStr === "{}") {
const obj = await this.socket.getObject(`system.adapter.${this.adapterName}.${this.instance}`);
if (this.state.runtime && obj.native.doNotShowProjectDialog) {
this.setState({
projectDoesNotExist: true
});
} else {
if (!this.state.projects) {
await this.refreshProjects();
}
this.setState({
showProjectsDialog: true
});
}
return;
}
fileStr = fileStr.toString();
if (!this.state.runtime) {
this.lastProjectJSONfile = fileStr;
}
let project;
try {
project = JSON.parse(fileStr);
} catch {
window.alert("Cannot parse project file!");
project = {
"Cannot parse project file!": {
widgets: {}
}
};
}
this.fixProject(project);
const currentPath = VisEngine.getCurrentPath();
let selectedView = currentPath.view;
if (!selectedView || !project[selectedView]) {
if (this.state.runtime) {
selectedView = Runtime.findViewWithNearestResolution(project, true);
} else {
if (Object.keys(project).includes(window.localStorage.getItem("selectedView"))) {
selectedView = window.localStorage.getItem("selectedView");
}
if (!selectedView || !project[selectedView]) {
selectedView = Object.keys(project).find((view) => !view.startsWith("__")) || "";
}
}
}
const len = project.___settings.openedViews.length;
for (let i = len - 1; i >= 0; i--) {
if (!project[project.___settings.openedViews[i]]) {
project.___settings.openedViews.splice(i, 1);
}
}
if (!project.___settings.openedViews.length) {
const view = Object.keys(project).find((_view) => _view !== "___settings");
if (view) {
project.___settings.openedViews[0] = view;
}
}
if (!project[selectedView]) {
selectedView = project.___settings.openedViews[0] || "";
window.localStorage.setItem("selectedView", selectedView);
} else if (project.___settings.openedViews && !project.___settings.openedViews.includes(selectedView) && !this.state.runtime) {
selectedView = project.___settings.openedViews[0];
window.localStorage.setItem("selectedView", selectedView);
}
applyTitleAndIcon(project.___settings.title, project.___settings.favicon, {
projectName,
instance: this.instance,
adapterName: this.adapterName,
themeType: this.state.themeType
});
window.localStorage.setItem("projectName", projectName);
if (this.subscribedProject && (this.subscribedProject !== projectName || project.___settings.reloadOnEdit === false)) {
this.subscribedProject = null;
this.socket.unsubscribeFiles(this.adapterId, `${this.subscribedProject}/*`, this.onProjectChange);
}
Runtime.syncMultipleWidgets(project);
if (this.state.runtime) {
if (project.___settings.reloadOnEdit !== false) {
this.subscribedProject = projectName;
await this.socket.subscribeFiles(this.adapterId, `${projectName}/*`, this.onProjectChange);
}
window.document.body.style.overflow = ((_c = project.___settings) == null ? void 0 : _c.bodyOverflow) || "auto";
} else {
this.subscribedProject = projectName;
await this.socket.subscribeFiles(this.adapterId, `${projectName}/*`, this.onProjectChange);
}
store.dispatch(updateProject(project));
await this.setStateAsync({
visCommonCss: null,
visUserCss: null,
history: [
project
],
historyCursor: 0,
projectName
});
await this.changeView(selectedView);
if (!this.state.runtime && this.checkForUpdates) {
await this.checkForUpdates();
}
};
orientationChange = () => {
if (this.resolutionTimer) {
clearTimeout(this.resolutionTimer);
this.resolutionTimer = null;
}
if (!this.state.editMode) {
this.resolutionTimer = setTimeout(async () => {
this.resolutionTimer = null;
const view = Runtime.findViewWithNearestResolution(store.getState().visProject);
if (view && view !== this.state.selectedView) {
await this.changeView(view);
}
}, 200);
}
};
refreshProjects = async (reloadCurrentProject) => {
let projects;
try {
projects = await this.socket.readDir(this.adapterId, "");
} catch {
projects = [];
}
await this.setStateAsync({
projects: projects.filter((dir) => dir.isDir).map((dir) => dir.file),
createFirstProjectDialog: !projects.length
});
if (reloadCurrentProject) {
await this.loadProject(this.state.projectName);
}
};
onVisChanged() {
this.setState({
messageDialog: {
text: __mf_2.t("Detected new version of vis files. Reloading in 2 seconds..."),
title: __mf_2.t("Reloading"),
ok: __mf_2.t("Reload now"),
callback: () => {
if (!this.state.runtime && this.changeTimer) {
this.needRestart = true;
} else {
setTimeout(() => window.location.reload(), 2e3);
}
}
}
});
if (!this.state.runtime && this.changeTimer) {
this.needRestart = true;
} else {
setTimeout(() => window.location.reload(), 2e3);
}
}
onWidgetSetsChanged = (id, state) => {
if (state && this.lastUploadedState && state.val !== this.lastUploadedState) {
this.lastUploadedState = state.val;
this.onVisChanged();
}
};
async onConnectionReady() {
if (this.state.widgetsLoaded === Runtime.WIDGETS_LOADING_STEP_HTML_LOADED) {
await VisWidgetsCatalog.collectRxInformation(this.socket, store.getState().visProject, this.changeProject);
await this.setStateAsync({
widgetsLoaded: Runtime.WIDGETS_LOADING_STEP_ALL_LOADED
});
}
const userName = await this.socket.getCurrentUser();
const currentUser = await this.socket.getObject(`system.user.${userName || "admin"}`);
const name = typeof currentUser.common.name === "object" ? currentUser.common.name[__mf_2.getLanguage()] || currentUser.common.name.en : currentUser.common.name;
store.dispatch(updateActiveUser(name));
const groups = await this.socket.getGroups();
const userGroups = {};
groups.forEach((group) => userGroups[group._id] = group);
await this.setStateAsync({
currentUser,
userGroups,
selectedView: "",
splitSizes: window.localStorage.getItem("Vis.splitSizes") ? JSON.parse(window.localStorage.getItem("Vis.splitSizes")) : [
20,
60,
20
]
});
await this.socket.subscribeState(`${this.adapterName}.${this.instance}.info.uploaded`, this.onWidgetSetsChanged);
const uploadedState = await this.socket.getState(`${this.adapterName}.${this.instance}.info.uploaded`);
if (uploadedState && uploadedState.val !== this.lastUploadedState) {
if (this.lastUploadedState) {
this.onVisChanged();
} else {
this.lastUploadedState = uploadedState.val;
}
}
let projectName = window.location.search.replace("?", "");
if (projectName) {
projectName = decodeURIComponent(projectName.split("&")[0]).split("/")[0];
if (projectName.includes("=")) {
projectName = "";
}
}
projectName || (projectName = window.localStorage.getItem("projectName") || "main");
let projects = this.state.projects;
if (!this.state.runtime) {
await this.refreshProjects();
projects = null;
}
if (!projects || projects.includes(projectName)) {
await this.loadProject(projectName);
} else {
const obj = this.state.runtime && await this.socket.getObject(`system.adapter.${this.adapterName}.${this.instance}`);
if (this.state.runtime && obj.native.doNotShowProjectDialog) {
this.setState({
projectDoesNotExist: true
});
} else {
if (!projects) {
await this.refreshProjects();
}
this.setState({
showProjectsDialog: true
});
}
}
}
changeView = async (selectedView) => {
var _a, _b, _c, _d;
if (selectedView === this.state.selectedView) {
if (this.state.runtime || !this.state.editMode) {
const currentPath2 = VisEngine.getCurrentPath();
const newHash = VisEngine.buildPath(currentPath2.view, currentPath2.path);
window.vis.lastChangedView = this.state.projectName ? `${this.state.projectName}/${newHash.replace(/^#/, "")}` : newHash.replace(/^#/, "");
void window.vis.conn.sendCommand(window.vis.instance, "changedView", window.vis.lastChangedView);
}
return;
}
const newState = {
selectedView
};
let selectedWidgets = JSON.parse(window.localStorage.getItem(`${this.state.projectName}.${selectedView}.widgets`) || "[]") || [];
for (let i = selectedWidgets.length - 1; i >= 0; i--) {
if (!((_b = (_a = store.getState().visProject[selectedView]) == null ? void 0 : _a.widgets) == null ? void 0 : _b[selectedWidgets[i]])) {
selectedWidgets = selectedWidgets.splice(i, 1);
}
}
if (JSON.stringify(newState.selectedWidgets) !== JSON.stringify(selectedWidgets)) {
newState.selectedWidgets = selectedWidgets;
}
if (newState.alignType !== null) {
newState.alignType = null;
}
if (newState.alignIndex !== 0) {
newState.alignIndex = 0;
}
if (((_c = newState.alignValues) == null ? void 0 : _c.length) > 0) {
newState.alignValues = [];
}
if (!this.state.runtime && !store.getState().visProject.___settings.openedViews.includes(selectedView)) {
const project = JSON.parse(JSON.stringify(store.getState().visProject));
project.___settings.openedViews.push(selectedView);
await this.changeProject(project, true);
}
if ((this.state.runtime || !this.state.editMode) && window.vis) {
const currentPath2 = VisEngine.getCurrentPath();
const newHash = VisEngine.buildPath(currentPath2.view, currentPath2.path);
window.vis.lastChangedView = this.state.projectName ? `${this.state.projectName}/${newHash.replace(/^#/, "")}` : newHash.replace(/^#/, "");
void window.vis.conn.sendCommand(window.vis.instance, "changedView", window.vis.lastChangedView);
(_d = window.jQuery) == null ? void 0 : _d.call(window, window).trigger("viewChanged", selectedView);
}
if (this.state.selectedGroup) {
newState.selectedGroup = null;
}
window.localStorage.setItem("selectedView", selectedView);
const currentPath = VisEngine.getCurrentPath();
const newPath = VisEngine.buildPath(selectedView, currentPath.path);
if (window.location.hash !== newPath) {
window.location.hash = newPath;
}
await this.setStateAsync(newState);
};
showAlert(message, type) {
if (type !== "error" && type !== "warning" && type !== "info" && type !== "success") {
type = "info";
}
this.setState({
alert: true,
alertType: type,
alertMessage: message
});
}
renderAlertDialog = () => jsxRuntimeExports.jsx(__mf_93, {
style: this.state.alertType === "error" ? {
backgroundColor: "#f44336"
} : this.state.alertType === "success" ? {
backgroundColor: "#4caf50"
} : void 0,
open: this.state.alert,
autoHideDuration: 6e3,
onClick: () => this.setState({
alert: false
}),
onClose: (e, reason) => {
if (reason === "clickaway") {
return;
}
this.setState({
alert: false
});
},
message: this.state.alertMessage
}, "__snackbar_134__");
async onWidgetsLoaded() {
let widgetsLoaded = Runtime.WIDGETS_LOADING_STEP_HTML_LOADED;
if (this.socket.isConnected()) {
await VisWidgetsCatalog.collectRxInformation(this.socket, store.getState().visProject, this.changeProject);
widgetsLoaded = Runtime.WIDGETS_LOADING_STEP_ALL_LOADED;
}
this.setState({
widgetsLoaded
});
}
addProject = async (projectName, doNotLoad) => {
try {
const project = {
___settings: {
folders: [],
openedViews: []
},
default: {
name: "Default",
settings: {
style: {}
},
widgets: {},
activeWidgets: {}
}
};
await this.socket.writeFile64(this.adapterId, `${projectName}/vis-views.json`, JSON.stringify(project));
await this.socket.writeFile64(this.adapterId, `${projectName}/vis-user.css`, "");
if (!doNotLoad) {
await this.refreshProjects();
await this.loadProject(projectName);
this.setState({
projectsDialog: false
});
}
} catch (e) {
window.alert(`Cannot create project: ${e.toString()}`);
}
};
showCreateNewProjectDialog() {
if (!this.state.showNewProjectDialog) {
return null;
}
return jsxRuntimeExports.jsxs(__mf_32, {
open: true,
onClose: () => this.setState({
showNewProjectDialog: false
}),
children: [
jsxRuntimeExports.jsx(__mf_36, {
children: __mf_2.t("Create new project")
}),
jsxRuntimeExports.jsx(__mf_34, {
children: jsxRuntimeExports.jsx(__mf_121, {
variant: "standard",
label: __mf_2.t("Project name"),
autoFocus: true,
fullWidth: true,
onKeyDown: async (e) => {
if (e.key === "Enter" && this.state.newProjectName && !this.state.projects.includes(this.state.newProjectName)) {
await this.addProject(this.state.newProjectName);
window.location.href = `edit.html?${this.state.newProjectName}`;
}
},
value: this.state.newProjectName,
onChange: (e) => this.setState({
newProjectName: e.target.value
}),
margin: "dense"
})
}),
jsxRuntimeExports.jsxs(__mf_33, {
children: [
jsxRuntimeExports.jsx(__mf_16, {
id: "create_new_project_ok_buton",
variant: "contained",
color: "primary",
disabled: !this.state.newProjectName || this.state.projects.includes(this.state.newProjectName),
onClick: async () => {
await this.addProject(this.state.newProjectName, true);
window.location.href = `edit.html?${this.state.newProjectName}`;
},
startIcon: jsxRuntimeExports.jsx(__mf_85$2, {}),
children: __mf_2.t("Create")
}),
jsxRuntimeExports.jsx(__mf_16, {
variant: "contained",
color: "grey",
onClick: () => this.setState({
showNewProjectDialog: false
}),
startIcon: jsxRuntimeExports.jsx(__mf_1776, {}),
children: __mf_2.t("Cancel")
})
]
})
]
});
}
showSmallProjectsDialog() {
return jsxRuntimeExports.jsxs(__mf_32, {
open: true,
maxWidth: "sm",
onClose: () => {
},
children: [
jsxRuntimeExports.jsxs(__mf_36, {
children: [
jsxRuntimeExports.jsx("img", {
src: this.props.runtime ? "./favicon.ico" : "./faviconEdit.ico",
alt: "vis-2",
style: {
width: 24,
marginRight: 10,
marginTop: 4
}
}),
!this.state.projects.length ? __mf_2.t('Create or import new "vis-2" project') : __mf_2.t("Select vis-2 project")
]
}),
jsxRuntimeExports.jsx(__mf_34, {
children: !this.state.projects ? jsxRuntimeExports.jsx(__mf_61, {}) : jsxRuntimeExports.jsxs(__mf_81, {
children: [
!this.state.projects.length ? jsxRuntimeExports.jsx("div", {
style: {
width: "100%",
fontSize: 20,
padding: 10
},
children: __mf_2.t("welcome_message")
}) : null,
jsxRuntimeExports.jsxs(__mf_73, {
children: [
this.state.projects.map((project) => jsxRuntimeExports.jsxs(__mf_66, {
onClick: () => window.location.href = `?${project}`,
children: [
jsxRuntimeExports.jsx(__mf_67, {
children: jsxRuntimeExports.jsx(__mf_3386, {})
}),
jsxRuntimeExports.jsx(__mf_69, {
children: project
})
]
}, project)),
jsxRuntimeExports.jsxs(__mf_66, {
id: "create_new_project",
onClick: () => this.setState({
showNewProjectDialog: true,
newProjectName: this.state.projects.length ? "" : "main"
}),
style: {
backgroundColor: "#112233",
color: "#ffffff"
},
children: [
jsxRuntimeExports.jsx(__mf_67, {
children: jsxRuntimeExports.jsx(__mf_85$2, {})
}),
jsxRuntimeExports.jsx(__mf_69, {
children: __mf_2.t("Create new project")
})
]
}),
this.renderImportProjectDialog ? jsxRuntimeExports.jsxs(__mf_66, {
onClick: () => this.setState({
showImportDialog: true
}),
style: {
backgroundColor: "#112233",
color: "#4b9ed3"
},
children: [
jsxRuntimeExports.jsx(__mf_67, {
children: jsxRuntimeExports.jsx(BiImport, {
fontSize: "small"
})
}),
jsxRuntimeExports.jsx(__mf_69, {
children: __mf_2.t("Import project")
})
]
}) : null
]
})
]
})
}),
this.showCreateNewProjectDialog(),
this.renderImportProjectDialog ? this.renderImportProjectDialog() : null,
this.renderAlertDialog()
]
});
}
renderProjectDoesNotExist() {
return jsxRuntimeExports.jsx("div", {
style: {
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
display: "flex",
alignItems: "center",
justifyContent: "center",
fontSize: 36,
color: "#982828"
},
children: __mf_2.t('Project "%s" does not exist', this.state.projectName)
});
}
getVisEngine() {
if (!this.state.runtime && this.state.projectDoesNotExist) {
return this.renderProjectDoesNotExist();
}
if (!this.state.runtime && this.state.showProjectsDialog) {
return this.showSmallProjectsDialog();
}
const { visProject, activeUser } = store.getState();
if (!hasProjectAccess({
editMode: this.state.editMode,
project: visProject,
user: activeUser
}) || !hasViewAccess({
editMode: this.state.editMode,
project: visProject,
user: activeUser,
view: this.state.selectedView
})) {
console.warn(`User "${activeUser}" has no permissions for ${this.state.editMode ? "edit mode" : "runtime"} of project "${this.state.projectName}" with view "${this.state.selectedView}"`);
if (this.state.projects) {
return this.showSmallProjectsDialog();
}
void this.refreshProjects().then(() => {
this.setState({
showProjectsDialog: true
});
});
return null;
}
return jsxRuntimeExports.jsx(VisEngine, {
widgetsLoaded: this.state.widgetsLoaded,
activeView: this.state.selectedView || "",
editMode: !this.state.runtime && this.state.editMode,
runtime: this.state.runtime,
socket: this.socket,
visCommonCss: this.state.visCommonCss,
visUserCss: this.state.visUserCss,
lang: this.socket.systemLang,
adapterName: this.adapterName,
instance: this.instance,
selectedWidgets: this.state.selectedWidgets,
setSelectedWidgets: this.setSelectedWidgets,
onLoaded: () => this.onWidgetsLoaded(),
selectedGroup: this.state.selectedGroup,
setSelectedGroup: this.setSelectedGroup,
onWidgetsChanged: this.onWidgetsChanged,
projectName: this.state.projectName,
lockDragging: this.state.lockDragging,
disableInteraction: this.state.disableInteraction,
widgetHint: this.state.widgetHint,
onFontsUpdate: this.state.runtime ? null : (fonts) => this.onFontsUpdate(fonts),
registerEditorCallback: this.state.runtime ? null : this.registerCallback,
themeType: this.state.themeType,
themeName: this.state.themeName,
theme: this.state.theme,
adapterId: this.adapterId,
editModeComponentStyle: styles.editModeComponentStyle,
onIgnoreMouseEvents: this.onIgnoreMouseEvents,
setLoadingText: this.setLoadingText,
onConfirmDialog: (message, title, icon, width, callback) => {
var _a;
return (_a = this.showConfirmDialog) == null ? void 0 : _a.call(this, {
message,
title,
icon,
width,
callback
});
},
onShowCode: (code, title, mode) => {
var _a;
return (_a = this.showCodeDialog) == null ? void 0 : _a.call(this, {
code,
title,
mode
});
},
currentUser: this.state.currentUser,
userGroups: this.state.userGroups,
renderAlertDialog: this.renderAlertDialog,
showLegacyFileSelector: this.showLegacyFileSelector,
toggleTheme: (newThemeName) => this.toggleTheme(newThemeName),
askAboutInclude: this.askAboutInclude,
changeProject: this.changeProject
}, this.state.projectName);
}
renderLoader() {
if (window.loadingHideLogo === "true") {
return null;
}
if (window.vendorPrefix === "MV") {
return jsxRuntimeExports.jsx(__mf_77, {
themeType: this.state.themeType,
backgroundColor: window.loadingBackgroundColor,
backgroundImage: window.loadingBackgroundImage
});
}
if (window.vendorPrefix === "PT") {
return jsxRuntimeExports.jsx(__mf_76, {
themeType: this.state.themeType,
backgroundColor: window.loadingBackgroundColor,
backgroundImage: window.loadingBackgroundImage
});
}
if (window.vendorPrefix && window.vendorPrefix !== "@@vendorPrefix@@") {
return jsxRuntimeExports.jsx(__mf_75, {
themeType: this.state.themeType,
backgroundColor: window.loadingBackgroundColor,
backgroundImage: window.loadingBackgroundImage
});
}
return jsxRuntimeExports.jsx(__mf_50, {
themeType: this.state.themeType,
backgroundColor: window.loadingBackgroundColor,
backgroundImage: window.loadingBackgroundImage
});
}
render() {
return jsxRuntimeExports.jsx(__mf_6, {
injectFirst: true,
children: jsxRuntimeExports.jsxs(ThemeProvider, {
theme: this.state.theme,
children: [
!this.state.loaded || !store.getState().visProject.___settings ? this.renderLoader() : this.getVisEngine(),
this.state.projectDoesNotExist ? this.renderProjectDoesNotExist() : null,
this.state.showProjectsDialog ? this.showSmallProjectsDialog() : null
]
})
});
}
}
Boolean(window.location.hostname === "localhost" || window.location.hostname === "[::1]" || window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));
function unregister() {
if ("serviceWorker" in navigator) {
navigator.serviceWorker.ready.then((registration) => {
return registration.unregister();
});
}
}
const version = "2.13.17";
const packageJson = {
version
};
window.adapterName = "vis-2";
console.log(`iobroker.${window.adapterName}@${packageJson.version}`);
void __vitePreload(() => import("./visRxWidget-404DmCpH.js").then(async (m) => {
await m.__tla;
return m;
}).then((n) => n.w), true ? __vite__mapDeps([0,1,2,3,4,5,6,7]) : void 0, import.meta.url).then((_VisRxWidget) => window.visRxWidget = _VisRxWidget.default);
function modifyClasses(className, addClass2, removeClass2) {
const classes = (className || "").split(" ").map((c) => c.trim()).filter((c) => c);
const pos = classes.indexOf(removeClass2);
if (pos !== -1) {
classes.splice(pos, 1);
}
!classes.includes(addClass2) && classes.push(addClass2);
return classes.join(" ");
}
function inIframe() {
try {
return window.self !== window.top;
} catch {
return true;
}
}
function setBackground() {
if (!inIframe()) {
if (__mf_70.getThemeType() === "dark") {
window.document.body.className = modifyClasses(window.document.body.className, "body-dark", "body-light");
} else {
window.document.body.className = modifyClasses(window.document.body.className, "body-light", "body-dark");
}
} else {
window.document.body.className = "";
}
}
setBackground();
function build() {
const container = document.getElementById("root");
if (container) {
const root = __mf_0$1(container);
root.render(jsxRuntimeExports.jsx(Runtime, {
setBackground: () => setBackground(),
version: packageJson.version
}));
}
}
void window.visConfigLoaded.then(() => {
if (!window.disableDataReporting) {
window.sentryDSN = "https://db8b6e837c71447a876069559a00a742@sentry.iobroker.net/232";
}
build();
});
unregister();
});