@ant-design/x
Version:
Craft AI-driven interfaces effortlessly
1,613 lines (1,448 loc) • 382 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("React"), require("ReactDOM"), require("antd"), require("antdCssinjs"));
else if(typeof define === 'function' && define.amd)
define(["React", "ReactDOM", "antd", "antdCssinjs"], factory);
else if(typeof exports === 'object')
exports["antdx"] = factory(require("React"), require("ReactDOM"), require("antd"), require("antdCssinjs"));
else
root["antdx"] = factory(root["React"], root["ReactDOM"], root["antd"], root["antdCssinjs"]);
})(self, function(__WEBPACK_EXTERNAL_MODULE__24__, __WEBPACK_EXTERNAL_MODULE__314__, __WEBPACK_EXTERNAL_MODULE__721__, __WEBPACK_EXTERNAL_MODULE__781__) {
return /******/ (function() { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 601:
/***/ (function(__unused_webpack_module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = canUseDom;
function canUseDom() {
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
}
/***/ }),
/***/ 800:
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = (__webpack_require__(748)["default"]);
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = useEvent;
var React = _interopRequireWildcard(__webpack_require__(24));
function useEvent(callback) {
var fnRef = React.useRef();
fnRef.current = callback;
var memoFn = React.useCallback(function () {
var _fnRef$current;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return (_fnRef$current = fnRef.current) === null || _fnRef$current === void 0 ? void 0 : _fnRef$current.call.apply(_fnRef$current, [fnRef].concat(args));
}, []);
return memoFn;
}
/***/ }),
/***/ 208:
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
"use strict";
var _interopRequireDefault = (__webpack_require__(366)["default"]);
var _interopRequireWildcard = (__webpack_require__(748)["default"]);
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.useLayoutUpdateEffect = exports["default"] = void 0;
var React = _interopRequireWildcard(__webpack_require__(24));
var _canUseDom = _interopRequireDefault(__webpack_require__(601));
/**
* Wrap `React.useLayoutEffect` which will not throw warning message in test env
*/
var useInternalLayoutEffect = true && (0, _canUseDom.default)() ? React.useLayoutEffect : React.useEffect;
var useLayoutEffect = function useLayoutEffect(callback, deps) {
var firstMountRef = React.useRef(true);
useInternalLayoutEffect(function () {
return callback(firstMountRef.current);
}, deps);
// We tell react that first mount has passed
useInternalLayoutEffect(function () {
firstMountRef.current = false;
return function () {
firstMountRef.current = true;
};
}, []);
};
var useLayoutUpdateEffect = exports.useLayoutUpdateEffect = function useLayoutUpdateEffect(callback, deps) {
useLayoutEffect(function (firstMount) {
if (!firstMount) {
return callback();
}
}, deps);
};
var _default = exports["default"] = useLayoutEffect;
/***/ }),
/***/ 905:
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
"use strict";
var __webpack_unused_export__;
var _interopRequireDefault = (__webpack_require__(366)["default"]);
__webpack_unused_export__ = ({
value: true
});
exports.Z = useMergedState;
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(361));
var _useEvent = _interopRequireDefault(__webpack_require__(800));
var _useLayoutEffect = __webpack_require__(208);
var _useState5 = _interopRequireDefault(__webpack_require__(386));
/** We only think `undefined` is empty */
function hasValue(value) {
return value !== undefined;
}
/**
* Similar to `useState` but will use props value if provided.
* Note that internal use rc-util `useState` hook.
*/
function useMergedState(defaultStateValue, option) {
var _ref = option || {},
defaultValue = _ref.defaultValue,
value = _ref.value,
onChange = _ref.onChange,
postState = _ref.postState;
// ======================= Init =======================
var _useState = (0, _useState5.default)(function () {
if (hasValue(value)) {
return value;
} else if (hasValue(defaultValue)) {
return typeof defaultValue === 'function' ? defaultValue() : defaultValue;
} else {
return typeof defaultStateValue === 'function' ? defaultStateValue() : defaultStateValue;
}
}),
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
innerValue = _useState2[0],
setInnerValue = _useState2[1];
var mergedValue = value !== undefined ? value : innerValue;
var postMergedValue = postState ? postState(mergedValue) : mergedValue;
// ====================== Change ======================
var onChangeFn = (0, _useEvent.default)(onChange);
var _useState3 = (0, _useState5.default)([mergedValue]),
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
prevValue = _useState4[0],
setPrevValue = _useState4[1];
(0, _useLayoutEffect.useLayoutUpdateEffect)(function () {
var prev = prevValue[0];
if (innerValue !== prev) {
onChangeFn(innerValue, prev);
}
}, [prevValue]);
// Sync value back to `undefined` when it from control to un-control
(0, _useLayoutEffect.useLayoutUpdateEffect)(function () {
if (!hasValue(value)) {
setInnerValue(value);
}
}, [value]);
// ====================== Update ======================
var triggerChange = (0, _useEvent.default)(function (updater, ignoreDestroy) {
setInnerValue(updater, ignoreDestroy);
setPrevValue([mergedValue], ignoreDestroy);
});
return [postMergedValue, triggerChange];
}
/***/ }),
/***/ 386:
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = (__webpack_require__(748)["default"]);
var _interopRequireDefault = (__webpack_require__(366)["default"]);
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = useSafeState;
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(361));
var React = _interopRequireWildcard(__webpack_require__(24));
/**
* Same as React.useState but `setState` accept `ignoreDestroy` param to not to setState after destroyed.
* We do not make this auto is to avoid real memory leak.
* Developer should confirm it's safe to ignore themselves.
*/
function useSafeState(defaultValue) {
var destroyRef = React.useRef(false);
var _React$useState = React.useState(defaultValue),
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
value = _React$useState2[0],
setValue = _React$useState2[1];
React.useEffect(function () {
destroyRef.current = false;
return function () {
destroyRef.current = true;
};
}, []);
function safeSetState(updater, ignoreDestroy) {
if (ignoreDestroy && destroyRef.current) {
return;
}
setValue(updater);
}
return [value, safeSetState];
}
/***/ }),
/***/ 918:
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
"use strict";
var __webpack_unused_export__;
var _interopRequireDefault = (__webpack_require__(366)["default"]);
__webpack_unused_export__ = ({
value: true
});
exports.Z = pickAttrs;
var _objectSpread2 = _interopRequireDefault(__webpack_require__(760));
var attributes = "accept acceptCharset accessKey action allowFullScreen allowTransparency\n alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge\n charSet checked classID className colSpan cols content contentEditable contextMenu\n controls coords crossOrigin data dateTime default defer dir disabled download draggable\n encType form formAction formEncType formMethod formNoValidate formTarget frameBorder\n headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity\n is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media\n mediaGroup method min minLength multiple muted name noValidate nonce open\n optimum pattern placeholder poster preload radioGroup readOnly rel required\n reversed role rowSpan rows sandbox scope scoped scrolling seamless selected\n shape size sizes span spellCheck src srcDoc srcLang srcSet start step style\n summary tabIndex target title type useMap value width wmode wrap";
var eventsName = "onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown\n onKeyPress onKeyUp onFocus onBlur onChange onInput onSubmit onClick onContextMenu onDoubleClick\n onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown\n onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel\n onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough\n onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata\n onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError";
var propList = "".concat(attributes, " ").concat(eventsName).split(/[\s\n]+/);
/* eslint-enable max-len */
var ariaPrefix = 'aria-';
var dataPrefix = 'data-';
function match(key, prefix) {
return key.indexOf(prefix) === 0;
}
/**
* Picker props from exist props with filter
* @param props Passed props
* @param ariaOnly boolean | { aria?: boolean; data?: boolean; attr?: boolean; } filter config
*/
function pickAttrs(props) {
var ariaOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var mergedConfig;
if (ariaOnly === false) {
mergedConfig = {
aria: true,
data: true,
attr: true
};
} else if (ariaOnly === true) {
mergedConfig = {
aria: true
};
} else {
mergedConfig = (0, _objectSpread2.default)({}, ariaOnly);
}
var attrs = {};
Object.keys(props).forEach(function (key) {
if (
// Aria
mergedConfig.aria && (key === 'role' || match(key, ariaPrefix)) ||
// Data
mergedConfig.data && match(key, dataPrefix) ||
// Attr
mergedConfig.attr && propList.includes(key)) {
attrs[key] = props[key];
}
});
return attrs;
}
/***/ }),
/***/ 372:
/***/ (function(__unused_webpack_module, exports) {
"use strict";
var __webpack_unused_export__;
__webpack_unused_export__ = ({
value: true
});
exports.Z = get;
function get(entity, path) {
var current = entity;
for (var i = 0; i < path.length; i += 1) {
if (current === null || current === undefined) {
return undefined;
}
current = current[path[i]];
}
return current;
}
/***/ }),
/***/ 948:
/***/ (function(__unused_webpack_module, exports) {
"use strict";
var __webpack_unused_export__;
/**
* @license React
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var b = Symbol.for("react.element"),
c = Symbol.for("react.portal"),
d = Symbol.for("react.fragment"),
e = Symbol.for("react.strict_mode"),
f = Symbol.for("react.profiler"),
g = Symbol.for("react.provider"),
h = Symbol.for("react.context"),
k = Symbol.for("react.server_context"),
l = Symbol.for("react.forward_ref"),
m = Symbol.for("react.suspense"),
n = Symbol.for("react.suspense_list"),
p = Symbol.for("react.memo"),
q = Symbol.for("react.lazy"),
t = Symbol.for("react.offscreen"),
u;
u = Symbol.for("react.module.reference");
function v(a) {
if ("object" === typeof a && null !== a) {
var r = a.$$typeof;
switch (r) {
case b:
switch (a = a.type, a) {
case d:
case f:
case e:
case m:
case n:
return a;
default:
switch (a = a && a.$$typeof, a) {
case k:
case h:
case l:
case q:
case p:
case g:
return a;
default:
return r;
}
}
case c:
return r;
}
}
}
__webpack_unused_export__ = h;
__webpack_unused_export__ = g;
__webpack_unused_export__ = b;
exports.ForwardRef = l;
__webpack_unused_export__ = d;
__webpack_unused_export__ = q;
__webpack_unused_export__ = p;
__webpack_unused_export__ = c;
__webpack_unused_export__ = f;
__webpack_unused_export__ = e;
__webpack_unused_export__ = m;
__webpack_unused_export__ = n;
__webpack_unused_export__ = function () {
return !1;
};
__webpack_unused_export__ = function () {
return !1;
};
__webpack_unused_export__ = function (a) {
return v(a) === h;
};
__webpack_unused_export__ = function (a) {
return v(a) === g;
};
__webpack_unused_export__ = function (a) {
return "object" === typeof a && null !== a && a.$$typeof === b;
};
__webpack_unused_export__ = function (a) {
return v(a) === l;
};
__webpack_unused_export__ = function (a) {
return v(a) === d;
};
__webpack_unused_export__ = function (a) {
return v(a) === q;
};
exports.isMemo = function (a) {
return v(a) === p;
};
__webpack_unused_export__ = function (a) {
return v(a) === c;
};
__webpack_unused_export__ = function (a) {
return v(a) === f;
};
__webpack_unused_export__ = function (a) {
return v(a) === e;
};
__webpack_unused_export__ = function (a) {
return v(a) === m;
};
__webpack_unused_export__ = function (a) {
return v(a) === n;
};
__webpack_unused_export__ = function (a) {
return "string" === typeof a || "function" === typeof a || a === d || a === f || a === e || a === m || a === n || a === t || "object" === typeof a && null !== a && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g || a.$$typeof === h || a.$$typeof === l || a.$$typeof === u || void 0 !== a.getModuleId) ? !0 : !1;
};
__webpack_unused_export__ = v;
/***/ }),
/***/ 336:
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
"use strict";
if (true) {
module.exports = __webpack_require__(948);
} else {}
/***/ }),
/***/ 24:
/***/ (function(module) {
"use strict";
module.exports = __WEBPACK_EXTERNAL_MODULE__24__;
/***/ }),
/***/ 314:
/***/ (function(module) {
"use strict";
module.exports = __WEBPACK_EXTERNAL_MODULE__314__;
/***/ }),
/***/ 721:
/***/ (function(module) {
"use strict";
module.exports = __WEBPACK_EXTERNAL_MODULE__721__;
/***/ }),
/***/ 781:
/***/ (function(module) {
"use strict";
module.exports = __WEBPACK_EXTERNAL_MODULE__781__;
/***/ }),
/***/ 732:
/***/ (function(module) {
function _arrayLikeToArray(r, a) {
(null == a || a > r.length) && (a = r.length);
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
return n;
}
module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 500:
/***/ (function(module) {
function _arrayWithHoles(r) {
if (Array.isArray(r)) return r;
}
module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 60:
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var toPropertyKey = __webpack_require__(326);
function _defineProperty(e, r, t) {
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
value: t,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[r] = t, e;
}
module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 596:
/***/ (function(module) {
function _extends() {
return module.exports = _extends = Object.assign ? Object.assign.bind() : function (n) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e];
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
}
return n;
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _extends.apply(null, arguments);
}
module.exports = _extends, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 366:
/***/ (function(module) {
function _interopRequireDefault(e) {
return e && e.__esModule ? e : {
"default": e
};
}
module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 748:
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var _typeof = (__webpack_require__(933)["default"]);
function _interopRequireWildcard(e, t) {
if ("function" == typeof WeakMap) var r = new WeakMap(),
n = new WeakMap();
return (module.exports = _interopRequireWildcard = function _interopRequireWildcard(e, t) {
if (!t && e && e.__esModule) return e;
var o,
i,
f = {
__proto__: null,
"default": e
};
if (null === e || "object" != _typeof(e) && "function" != typeof e) return f;
if (o = t ? n : r) {
if (o.has(e)) return o.get(e);
o.set(e, f);
}
for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]);
return f;
}, module.exports.__esModule = true, module.exports["default"] = module.exports)(e, t);
}
module.exports = _interopRequireWildcard, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 574:
/***/ (function(module) {
function _iterableToArrayLimit(r, l) {
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (null != t) {
var e,
n,
i,
u,
a = [],
f = !0,
o = !1;
try {
if (i = (t = t.call(r)).next, 0 === l) {
if (Object(t) !== t) return;
f = !1;
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
} catch (r) {
o = !0, n = r;
} finally {
try {
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
} finally {
if (o) throw n;
}
}
return a;
}
}
module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 739:
/***/ (function(module) {
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 760:
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var defineProperty = __webpack_require__(60);
function ownKeys(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function (r) {
return Object.getOwnPropertyDescriptor(e, r).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread2(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
defineProperty(e, r, t[r]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
});
}
return e;
}
module.exports = _objectSpread2, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 361:
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var arrayWithHoles = __webpack_require__(500);
var iterableToArrayLimit = __webpack_require__(574);
var unsupportedIterableToArray = __webpack_require__(937);
var nonIterableRest = __webpack_require__(739);
function _slicedToArray(r, e) {
return arrayWithHoles(r) || iterableToArrayLimit(r, e) || unsupportedIterableToArray(r, e) || nonIterableRest();
}
module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 946:
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var _typeof = (__webpack_require__(933)["default"]);
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 || "default");
if ("object" != _typeof(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 326:
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var _typeof = (__webpack_require__(933)["default"]);
var toPrimitive = __webpack_require__(946);
function toPropertyKey(t) {
var i = toPrimitive(t, "string");
return "symbol" == _typeof(i) ? i : i + "";
}
module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 933:
/***/ (function(module) {
function _typeof(o) {
"@babel/helpers - typeof";
return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
}
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 937:
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var arrayLikeToArray = __webpack_require__(732);
function _unsupportedIterableToArray(r, a) {
if (r) {
if ("string" == typeof r) return arrayLikeToArray(r, a);
var t = {}.toString.call(r).slice(8, -1);
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? arrayLikeToArray(r, a) : void 0;
}
}
module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 35:
/***/ (function(module, exports) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
function classNames() {
var classes = '';
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (arg) {
classes = appendClass(classes, parseValue(arg));
}
}
return classes;
}
function parseValue(arg) {
if (typeof arg === 'string' || typeof arg === 'number') {
return arg;
}
if (typeof arg !== 'object') {
return '';
}
if (Array.isArray(arg)) {
return classNames.apply(null, arg);
}
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
return arg.toString();
}
var classes = '';
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes = appendClass(classes, key);
}
}
return classes;
}
function appendClass(value, newClass) {
if (!newClass) {
return value;
}
if (value) {
return value + ' ' + newClass;
}
return value + newClass;
}
if ( true && module.exports) {
classNames.default = classNames;
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return classNames;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
})();
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ !function() {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function() { return module['default']; } :
/******/ function() { return module; };
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ !function() {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = function(exports, definition) {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ !function() {
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ }();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ !function() {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ }();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
!function() {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Actions: function() { return /* reexport */ actions; },
Attachments: function() { return /* reexport */ attachments; },
Bubble: function() { return /* reexport */ bubble; },
Conversations: function() { return /* reexport */ conversations; },
Prompts: function() { return /* reexport */ prompts; },
Sender: function() { return /* reexport */ sender; },
Suggestion: function() { return /* reexport */ suggestion; },
ThoughtChain: function() { return /* reexport */ thought_chain; },
Welcome: function() { return /* reexport */ welcome; },
XProvider: function() { return /* reexport */ x_provider; },
XRequest: function() { return /* reexport */ x_request; },
XStream: function() { return /* reexport */ x_stream; },
useXAgent: function() { return /* reexport */ useXAgent; },
useXChat: function() { return /* reexport */ useXChat; },
version: function() { return /* reexport */ components_version; }
});
;// CONCATENATED MODULE: ./components/version/version.ts
/* harmony default export */ var version_version = ('1.6.0');
;// CONCATENATED MODULE: ./components/version/index.ts
// @ts-ignore
/* harmony default export */ var components_version = (version_version);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.28.2@@babel/runtime/helpers/extends.js
var helpers_extends = __webpack_require__(596);
var extends_default = /*#__PURE__*/__webpack_require__.n(helpers_extends);
// EXTERNAL MODULE: external "antd"
var external_antd_ = __webpack_require__(721);
// EXTERNAL MODULE: ./node_modules/_classnames@2.5.1@classnames/index.js
var _classnames_2_5_1_classnames = __webpack_require__(35);
var _classnames_2_5_1_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_5_1_classnames);
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/lib/pickAttrs.js
var pickAttrs = __webpack_require__(918);
// EXTERNAL MODULE: external "React"
var external_React_ = __webpack_require__(24);
var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_);
;// CONCATENATED MODULE: ./components/x-provider/context.ts
const XProviderContext = /*#__PURE__*/external_React_default().createContext({});
/* harmony default export */ var context = (XProviderContext);
;// CONCATENATED MODULE: ./components/_util/hooks/use-x-component-config.ts
const defaultXComponentStyleConfig = {
classNames: {},
styles: {},
className: '',
style: {}
};
const useXComponentConfig = component => {
const xProviderContext = external_React_default().useContext(context);
return external_React_default().useMemo(() => ({
...defaultXComponentStyleConfig,
...xProviderContext[component]
}), [xProviderContext[component]]);
};
/* harmony default export */ var use_x_component_config = (useXComponentConfig);
;// CONCATENATED MODULE: ./components/x-provider/hooks/use-x-provider-context.ts
const defaultPrefixCls = 'ant';
function useXProviderContext() {
const {
getPrefixCls,
direction,
csp,
iconPrefixCls,
theme
} = external_React_default().useContext(external_antd_.ConfigProvider.ConfigContext);
return {
theme,
getPrefixCls,
direction,
csp,
iconPrefixCls
};
}
/* harmony default export */ var use_x_provider_context = (useXProviderContext);
;// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.28.2@@babel/runtime/helpers/esm/extends.js
function _extends() {
return _extends = Object.assign ? Object.assign.bind() : function (n) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e];
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
}
return n;
}, _extends.apply(null, arguments);
}
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.4.2@@ant-design/icons-svg/es/asn/EllipsisOutlined.js
// This icon file is generated automatically.
var EllipsisOutlined = {
"icon": {
"tag": "svg",
"attrs": {
"viewBox": "64 64 896 896",
"focusable": "false"
},
"children": [{
"tag": "path",
"attrs": {
"d": "M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"
}
}]
},
"name": "ellipsis",
"theme": "outlined"
};
/* harmony default export */ var asn_EllipsisOutlined = (EllipsisOutlined);
;// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.28.2@@babel/runtime/helpers/esm/arrayWithHoles.js
function _arrayWithHoles(r) {
if (Array.isArray(r)) return r;
}
;// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.28.2@@babel/runtime/helpers/esm/iterableToArrayLimit.js
function _iterableToArrayLimit(r, l) {
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (null != t) {
var e,
n,
i,
u,
a = [],
f = !0,
o = !1;
try {
if (i = (t = t.call(r)).next, 0 === l) {
if (Object(t) !== t) return;
f = !1;
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
} catch (r) {
o = !0, n = r;
} finally {
try {
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
} finally {
if (o) throw n;
}
}
return a;
}
}
;// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.28.2@@babel/runtime/helpers/esm/arrayLikeToArray.js
function _arrayLikeToArray(r, a) {
(null == a || a > r.length) && (a = r.length);
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
return n;
}
;// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.28.2@@babel/runtime/helpers/esm/unsupportedIterableToArray.js
function _unsupportedIterableToArray(r, a) {
if (r) {
if ("string" == typeof r) return _arrayLikeToArray(r, a);
var t = {}.toString.call(r).slice(8, -1);
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
}
}
;// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.28.2@@babel/runtime/helpers/esm/nonIterableRest.js
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
;// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.28.2@@babel/runtime/helpers/esm/slicedToArray.js
function _slicedToArray(r, e) {
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
}
;// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.28.2@@babel/runtime/helpers/esm/typeof.js
function typeof_typeof(o) {
"@babel/helpers - typeof";
return typeof_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, typeof_typeof(o);
}
;// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.28.2@@babel/runtime/helpers/esm/toPrimitive.js
function toPrimitive(t, r) {
if ("object" != typeof_typeof(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != typeof_typeof(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
;// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.28.2@@babel/runtime/helpers/esm/toPropertyKey.js
function toPropertyKey(t) {
var i = toPrimitive(t, "string");
return "symbol" == typeof_typeof(i) ? i : i + "";
}
;// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.28.2@@babel/runtime/helpers/esm/defineProperty.js
function _defineProperty(e, r, t) {
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
value: t,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[r] = t, e;
}
;// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.28.2@@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
function _objectWithoutPropertiesLoose(r, e) {
if (null == r) return {};
var t = {};
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
if (-1 !== e.indexOf(n)) continue;
t[n] = r[n];
}
return t;
}
;// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.28.2@@babel/runtime/helpers/esm/objectWithoutProperties.js
function objectWithoutProperties_objectWithoutProperties(e, t) {
if (null == e) return {};
var o,
r,
i = _objectWithoutPropertiesLoose(e, t);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(e);
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
}
return i;
}
;// CONCATENATED MODULE: ./node_modules/_@ant-design_fast-color@2.0.6@@ant-design/fast-color/es/FastColor.js
const round = Math.round;
/**
* Support format, alpha unit will check the % mark:
* - rgba(102, 204, 255, .5) -> [102, 204, 255, 0.5]
* - rgb(102 204 255 / .5) -> [102, 204, 255, 0.5]
* - rgb(100%, 50%, 0% / 50%) -> [255, 128, 0, 0.5]
* - hsl(270, 60, 40, .5) -> [270, 60, 40, 0.5]
* - hsl(270deg 60% 40% / 50%) -> [270, 60, 40, 0.5]
*
* When `base` is provided, the percentage value will be divided by `base`.
*/
function splitColorStr(str, parseNum) {
const match = str
// Remove str before `(`
.replace(/^[^(]*\((.*)/, '$1')
// Remove str after `)`
.replace(/\).*/, '').match(/\d*\.?\d+%?/g) || [];
const numList = match.map(item => parseFloat(item));
for (let i = 0; i < 3; i += 1) {
numList[i] = parseNum(numList[i] || 0, match[i] || '', i);
}
// For alpha. 50% should be 0.5
if (match[3]) {
numList[3] = match[3].includes('%') ? numList[3] / 100 : numList[3];
} else {
// By default, alpha is 1
numList[3] = 1;
}
return numList;
}
const parseHSVorHSL = (num, _, index) => index === 0 ? num : num / 100;
/** round and limit number to integer between 0-255 */
function limitRange(value, max) {
const mergedMax = max || 255;
if (value > mergedMax) {
return mergedMax;
}
if (value < 0) {
return 0;
}
return value;
}
class FastColor {
constructor(input) {
/**
* All FastColor objects are valid. So isValid is always true. This property is kept to be compatible with TinyColor.
*/
_defineProperty(this, "isValid", true);
/**
* Red, R in RGB
*/
_defineProperty(this, "r", 0);
/**
* Green, G in RGB
*/
_defineProperty(this, "g", 0);
/**
* Blue, B in RGB
*/
_defineProperty(this, "b", 0);
/**
* Alpha/Opacity, A in RGBA/HSLA
*/
_defineProperty(this, "a", 1);
// HSV privates
_defineProperty(this, "_h", void 0);
_defineProperty(this, "_s", void 0);
_defineProperty(this, "_l", void 0);
_defineProperty(this, "_v", void 0);
// intermediate variables to calculate HSL/HSV
_defineProperty(this, "_max", void 0);
_defineProperty(this, "_min", void 0);
_defineProperty(this, "_brightness", void 0);
/**
* Always check 3 char in the object to determine the format.
* We not use function in check to save bundle size.
* e.g. 'rgb' -> { r: 0, g: 0, b: 0 }.
*/
function matchFormat(str) {
return str[0] in input && str[1] in input && str[2] in input;
}
if (!input) {
// Do nothing since already initialized
} else if (typeof input === 'string') {
const trimStr = input.trim();
function matchPrefix(prefix) {
return trimStr.startsWith(prefix);
}
if (/^#?[A-F\d]{3,8}$/i.test(trimStr)) {
this.fromHexString(trimStr);
} else if (matchPrefix('rgb')) {
this.fromRgbString(trimStr);
} else if (matchPrefix('hsl')) {
this.fromHslString(trimStr);
} else if (matchPrefix('hsv') || matchPrefix('hsb')) {
this.fromHsvString(trimStr);
}
} else if (input instanceof FastColor) {
this.r = input.r;
this.g = input.g;
this.b = input.b;
this.a = input.a;
this._h = input._h;
this._s = input._s;
this._l = input._l;
this._v = input._v;
} else if (matchFormat('rgb')) {
this.r = limitRange(input.r);
this.g = limitRange(input.g);
this.b = limitRange(input.b);
this.a = typeof input.a === 'number' ? limitRange(input.a, 1) : 1;
} else if (matchFormat('hsl')) {
this.fromHsl(input);
} else if (matchFormat('hsv')) {
this.fromHsv(input);
} else {
throw new Error('@ant-design/fast-color: unsupported input ' + JSON.stringify(input));
}
}
// ======================= Setter =======================
setR(value) {
return this._sc('r', value);
}
setG(value) {
return this._sc('g', value);
}
setB(value) {
return this._sc('b', value);
}
setA(value) {
return this._sc('a', value, 1);
}
setHue(value) {
const hsv = this.toHsv();
hsv.h = value;
return this._c(hsv);
}
// ======================= Getter =======================
/**
* Returns the perceived luminance of a color, from 0-1.
* @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
*/
getLuminance() {
function adjustGamma(raw) {
const val = raw / 255;
return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
}
const R = adjustGamma(this.r);
const G = adjustGamma(this.g);
const B = adjustGamma(this.b);
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
}
getHue() {
if (typeof this._h === 'undefined') {
const delta = this.getMax() - this.getMin();
if (delta === 0) {
this._h = 0;
} else {
this._h = round(60 * (this.r === this.getMax() ? (this.g - this.b) / delta + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / delta + 2 : (this.r - this.g) / delta + 4));
}
}
return this._h;
}
getSaturation() {
if (typeof this._s === 'undefined') {
const delta = this.getMax() - this.getMin();
if (delta === 0) {
this._s = 0;
} else {
this._s = delta / this.getMax();
}
}
return this._s;
}
getLightness() {
if (typeof this._l === 'undefined') {
this._l = (this.getMax() + this.getMin()) / 510;
}
return this._l;
}
getValue() {
if (typeof this._v === 'undefined') {
this._v = this.getMax() / 255;
}
return this._v;
}
/**
* Returns the perceived brightness of the color, from 0-255.
* Note: this is not the b of HSB
* @see http://www.w3.org/TR/AERT#color-contrast
*/
getBrightness() {
if (typeof this._brightness === 'undefined') {
this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1000;
}
return this._brightness;
}
// ======================== Func ========================
darken(amount = 10) {
const h = this.getHue();
const s = this.getSaturation();
let l = this.getLightness() - amount / 100;
if (l < 0) {
l = 0;
}
return this._c({
h,
s,
l,
a: this.a
});
}
lighten(amount = 10) {
const h = this.getHue();
const s = this.getSaturation();
let l = this.getLightness() + amount / 100;
if (l > 1) {
l = 1;
}
return this._c({
h,
s,
l,
a: this.a
});
}
/**
* Mix the current color a given amount with another color, from 0 to 100.
* 0 means no mixing (return current color).
*/
mix(input, amount = 50) {
const color = this._c(input);
const p = amount / 100;
const calc = key => (color[key] - this[key]) * p + this[key];
const rgba = {
r: round(calc('r')),
g: round(calc('g')),
b: round(calc('b')),
a: round(calc('a') * 100) / 100
};
return this._c(rgba);
}
/**
* Mix the color with pure white, from 0 to 100.
* Providing 0 will do nothing, providing 100 will always return white.
*/
tint(amount = 10) {
return this.mix({
r: 255,
g: 255,
b: 255,
a: 1
}, amount);
}
/**
* Mix the color with pure black, from 0 to 100.
* Providing 0 will do nothing, providing 100 will always return black.
*/
shade(amount = 10) {
return this.mix({
r: 0,
g: 0,
b: 0,
a: 1
}, amount);
}
onBackground(background) {
const bg = this._c(background);
const alpha = this.a + bg.a * (1 - this.a);
const calc = key => {
return round((this[key] * this.a + bg[key] * bg.a * (1 - this.a)) / alpha);
};
return this._c({
r: calc('r'),
g: calc('g'),
b: calc('b'),
a: alpha
});
}
// ======================= Status =======================
isDark() {
return this.getBrightness() < 128;
}
isLight() {
return this.getBrightness() >= 128;
}
// ======================== MISC ========================
equals(other) {
return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
}
clone() {
return this._c(this);
}
// ======================= Format =======================
toHexString() {
let hex = '#';
const rHex = (this.r || 0).toString(16);
hex += rHex.length === 2 ? rHex : '0' + rHex;
const gHex = (this.g || 0).toString(16);
hex += gHex.length === 2 ? gHex : '0' + gHex;
const bHex = (this.b || 0).toString(16);
hex += bHex.length === 2 ? bHex : '0' + bHex;
if (typeof this.a === 'number' && this.a >= 0 && this.a < 1) {
const aHex = round(this.a * 255).toString(16);
hex += aHex.length === 2 ? aHex : '0' + aHex;
}
return hex;
}
/** CSS support color pattern */
toHsl() {
return {
h: this.getHue(),
s: this.getSaturation(),
l: this.getLightness(),
a: this.a
};
}
/** CSS support color pattern */
toHslString() {
const h = this.getHue();
const s = round(this.getSaturation() * 100);
const l = round(this.getLightness() * 100);
return this.a !== 1 ? `hsla(${h},${s}%,${l}%,${this.a})` : `hsl(${h},${s}%,${l}%)`;
}
/** Same as toHsb */
toHsv() {
return {
h: this.getHue(),
s: this.getSaturation(),
v: this.getValue(),
a: this.a
};
}
toRgb() {
return {
r: this.r,
g: this.g,
b: this.b,
a: this.a
};
}
toRgbString() {
return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`;
}
toString() {
return this.toRgbString();
}
// ====================== Privates ======================
/** Return a new FastColor object with one channel changed */
_sc(rgb, value, max) {
const clone = this.clone();
clone[rgb] = limitRange(value, max);
return clone;
}
_c(input) {
return new this.constructor(input);
}
getMax() {
if (typeof this._max === 'undefined') {
this._max = Math.max(this.r, this.g, this.b);
}
return this._max;
}
getMin() {
if (typeof this._min === 'undefined') {
this._min = Math.min(this.r, this.g, this.b);
}
return this._min;
}
fromHexString(trimStr) {
const withoutPrefix = trimStr.replace('#', '');
function connectNum(index1, index2) {
return parseInt(withoutPrefix[index1] + withoutPrefix[index2 || index1], 16);
}
if (withoutPrefix.length < 6) {
// #rgb or #rgba
this.r = connectNum(0);
this.g = connectNum(1);
this.b = connectNum(2);
this.a = withoutPrefix[3] ? connectNum(3) / 255 : 1;
} else {
// #rrggbb or #rrggbbaa
this.r = connectNum(0, 1);
this.g = connectNum(2, 3);
this.b = connectNum(4, 5);
this.a = withoutPrefix[6] ? connectNum(6, 7) / 255 : 1;
}
}
fromHsl({
h,
s,
l,
a
}) {
this._h = h % 360;
this._s = s;
this._l = l;
this.a = typeof a === 'number' ? a : 1;
if (s <= 0) {
const rgb = round(l * 255);
this.r = rgb;
this.g = rgb;
this.b = rgb;
}
let r = 0,
g = 0,
b = 0;
const huePrime = h / 60;
const chroma = (1 - Math.abs(2 * l - 1)) * s;
const secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
if (huePrime >= 0 && huePrime < 1) {
r = chroma;
g = secondComponent;
} else if (huePrime >= 1 && huePrime < 2) {
r = secondComponent;
g = chroma;
} else if (huePrime >= 2 && huePrime < 3) {
g = chroma;
b = secondComponent;
} else if (huePrime >= 3 && huePrime < 4) {
g = secondComponent;
b = chroma;
} else if (huePrime >= 4 && huePrime < 5) {
r = secondComponent;
b = chroma;
} else if (huePrime >= 5 && huePrime < 6) {
r = chroma;
b = secondComponent;
}
const lightnessModification = l - chroma / 2;
this.r = round((r + lightnessModification) * 255);
this.g = round((g + lightnessModification) * 255);
this.b = round((b + lightnessModification) * 255);
}
fromHsv({
h,
s,
v,
a
}) {
this._h = h % 360;
this._s = s;
this._v = v;
this.a = typeof a === 'number' ? a : 1;
const vv = round(v * 255);
this.r = vv;
this.g = vv;
this.b = vv;
if (s <= 0) {
return;
}
const hh = h / 60;
const i = Math.floor(hh);
const ff = hh - i;
const p = round(v * (1.0 - s) * 255);
const q = round(v * (1.0 - s * ff) * 255);
const t = round(v * (1.0 - s * (1.0 - ff)) * 255);
switch (i) {
case 0:
this.g = t;
this.b = p;
break;
case 1:
this.r = q;
this.b = p;
break;
case 2:
this.r = p;
this.b = t;
break;
case 3:
this.r = p;
this.g = q;
break;
case 4:
this.r = t;
this.g = p;
break;
case 5:
default:
this.g = p;
this.b = q;
break;
}
}
fromHsvString(trimStr) {
const cells = splitColorStr(trimStr, parseHSVorHSL);
this.fromHsv({
h: cells[0],
s: cells[1],
v: cells[2]