diff --git a/.gitignore b/.gitignore index 23a4bc9..25eed1c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,6 @@ # Dist node_modules -dist/ doc_build/ # IDE diff --git a/rstack-doc-ui/.gitignore b/rstack-doc-ui/.gitignore index bacc061..bc17319 100644 --- a/rstack-doc-ui/.gitignore +++ b/rstack-doc-ui/.gitignore @@ -15,7 +15,6 @@ node_modules/ .eslintcache .changeset/pre.json -dist/ coverage/ release/ output/ diff --git a/rstack-doc-ui/dist/announcement/close.d.ts b/rstack-doc-ui/dist/announcement/close.d.ts new file mode 100644 index 0000000..a8ca5d4 --- /dev/null +++ b/rstack-doc-ui/dist/announcement/close.d.ts @@ -0,0 +1,3 @@ +import type { SVGProps } from 'react'; +declare function IconClose(props: SVGProps): import("react/jsx-runtime").JSX.Element; +export default IconClose; diff --git a/rstack-doc-ui/dist/announcement/index.css b/rstack-doc-ui/dist/announcement/index.css new file mode 100644 index 0000000..28be76e --- /dev/null +++ b/rstack-doc-ui/dist/announcement/index.css @@ -0,0 +1,39 @@ +.bar-qLU0v0 { + color: #fff; + background-image: linear-gradient(279deg, #ff8b00 35.21%, #fb6d5b 63.34%); + justify-content: center; + align-items: center; + height: 36px; + display: flex; + position: relative; +} + +.link-O5NRCk { + color: #fff; + font-weight: bold; + text-decoration: none; +} + +.link-O5NRCk:hover { + opacity: .9; + text-decoration: underline; +} + +.link-O5NRCk:active { + opacity: .7; +} + +.close-UqNfF6 { + cursor: pointer; + box-sizing: border-box; + border-radius: 4px; + padding: 5px; + font-size: 28px; + position: absolute; + right: 1.5rem; +} + +.close-UqNfF6:hover { + background-color: rgba(255, 255, 255, .3); +} + diff --git a/rstack-doc-ui/dist/announcement/index.d.ts b/rstack-doc-ui/dist/announcement/index.d.ts new file mode 100644 index 0000000..fdf36c8 --- /dev/null +++ b/rstack-doc-ui/dist/announcement/index.d.ts @@ -0,0 +1,7 @@ +export declare function Announcement({ href, message, localStorageKey, display, barClassName, }: { + href: string; + message: string | React.ReactNode; + localStorageKey: string; + display?: boolean; + barClassName?: string; +}): import("react/jsx-runtime").JSX.Element | null; diff --git a/rstack-doc-ui/dist/announcement/index.js b/rstack-doc-ui/dist/announcement/index.js new file mode 100644 index 0000000..3bb043e --- /dev/null +++ b/rstack-doc-ui/dist/announcement/index.js @@ -0,0 +1,50 @@ +import './index.css'; +import { jsx, jsxs } from "react/jsx-runtime"; +import { useState } from "react"; +function IconClose(props) { + return /*#__PURE__*/ jsxs("svg", { + viewBox: "0 0 1024 1024", + fill: "currentColor", + height: "1em", + width: "1em", + ...props, + children: [ + /*#__PURE__*/ jsx("title", { + children: "IconClose" + }), + /*#__PURE__*/ jsx("path", { + d: "M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 00203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z" + }) + ] + }); +} +const announcement_close = IconClose; +const index_module = { + bar: "bar-qLU0v0", + link: "link-O5NRCk", + close: "close-UqNfF6" +}; +function Announcement({ href, message, localStorageKey, display = true, barClassName }) { + if (!display) return null; + var _window_localStorage_getItem; + const [disable, setDisable] = useState(null != (_window_localStorage_getItem = window.localStorage.getItem(localStorageKey)) ? _window_localStorage_getItem : false); + if (disable) return null; + return /*#__PURE__*/ jsxs("div", { + className: `${index_module.bar} ${barClassName}`, + children: [ + /*#__PURE__*/ jsx("a", { + href: href, + className: index_module.link, + children: message + }), + /*#__PURE__*/ jsx(announcement_close, { + onClick: ()=>{ + setDisable(true); + window.localStorage.setItem(localStorageKey, 'true'); + }, + className: index_module.close + }) + ] + }); +} +export { Announcement }; diff --git a/rstack-doc-ui/dist/antd/index.d.ts b/rstack-doc-ui/dist/antd/index.d.ts new file mode 100644 index 0000000..e9235c4 --- /dev/null +++ b/rstack-doc-ui/dist/antd/index.d.ts @@ -0,0 +1,4 @@ +import Collapse from 'antd/es/collapse/Collapse'; +import ConfigProvider from 'antd/es/config-provider'; +import Tag from 'antd/es/tag'; +export { Collapse, ConfigProvider, Tag }; diff --git a/rstack-doc-ui/dist/antd/index.js b/rstack-doc-ui/dist/antd/index.js new file mode 100644 index 0000000..054e76c --- /dev/null +++ b/rstack-doc-ui/dist/antd/index.js @@ -0,0 +1,7856 @@ +/*! For license information please see index.js.LICENSE.txt */ +import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react"; +import * as __WEBPACK_EXTERNAL_MODULE_react_dom_7136dc57__ from "react-dom"; +var __webpack_modules__ = { + "./node_modules/.pnpm/@ant-design+cssinjs@1.23.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@ant-design/cssinjs/es/hooks/useHMR.js": function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.d(__webpack_exports__, { + Z: ()=>__WEBPACK_DEFAULT_EXPORT__ + }); + module = __webpack_require__.hmd(module); + function useProdHMR() { + return false; + } + var webpackHMR = false; + function useDevHMR() { + return webpackHMR; + } + const __WEBPACK_DEFAULT_EXPORT__ = 'production' === process.env.NODE_ENV ? useProdHMR : useDevHMR; + if ('production' !== process.env.NODE_ENV && true && module && module.hot && 'undefined' != typeof window) { + var win = 'undefined' != typeof globalThis ? globalThis : 'undefined' != typeof window ? window : null; + if (win && 'function' == typeof win.webpackHotUpdate) { + var originWebpackHotUpdate = win.webpackHotUpdate; + win.webpackHotUpdate = function() { + webpackHMR = true; + setTimeout(function() { + webpackHMR = false; + }, 0); + return originWebpackHotUpdate.apply(void 0, arguments); + }; + } + } + }, + "./node_modules/.pnpm/react-is@18.2.0/node_modules/react-is/cjs/react-is.development.js": function(__unused_webpack_module, exports) { + /** + * @license React + * react-is.development.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. + */ if ("production" !== process.env.NODE_ENV) (function() { + 'use strict'; + var REACT_ELEMENT_TYPE = Symbol.for('react.element'); + var REACT_PORTAL_TYPE = Symbol.for('react.portal'); + var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); + var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); + var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); + var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); + var REACT_CONTEXT_TYPE = Symbol.for('react.context'); + var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context'); + var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); + var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); + var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); + var REACT_MEMO_TYPE = Symbol.for('react.memo'); + var REACT_LAZY_TYPE = Symbol.for('react.lazy'); + Symbol.for('react.offscreen'); + Symbol.for('react.module.reference'); + function typeOf(object) { + if ('object' == typeof object && null !== object) { + var $$typeof = object.$$typeof; + switch($$typeof){ + case REACT_ELEMENT_TYPE: + var type = object.type; + switch(type){ + case REACT_FRAGMENT_TYPE: + case REACT_PROFILER_TYPE: + case REACT_STRICT_MODE_TYPE: + case REACT_SUSPENSE_TYPE: + case REACT_SUSPENSE_LIST_TYPE: + return type; + default: + var $$typeofType = type && type.$$typeof; + switch($$typeofType){ + case REACT_SERVER_CONTEXT_TYPE: + case REACT_CONTEXT_TYPE: + case REACT_FORWARD_REF_TYPE: + case REACT_LAZY_TYPE: + case REACT_MEMO_TYPE: + case REACT_PROVIDER_TYPE: + return $$typeofType; + default: + return $$typeof; + } + } + case REACT_PORTAL_TYPE: + return $$typeof; + } + } + } + var ForwardRef = REACT_FORWARD_REF_TYPE; + function isMemo(object) { + return typeOf(object) === REACT_MEMO_TYPE; + } + exports.ForwardRef = ForwardRef; + exports.isMemo = isMemo; + })(); + }, + "./node_modules/.pnpm/react-is@18.2.0/node_modules/react-is/cjs/react-is.production.min.js": function(__unused_webpack_module, exports) { + /** + * @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"); + Symbol.for("react.offscreen"); + 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){ + case d: + case f: + case e: + case m: + case n: + return a; + default: + switch(a = a && a.$$typeof){ + case k: + case h: + case l: + case q: + case p: + case g: + return a; + default: + return r; + } + } + case c: + return r; + } + } + } + exports.ForwardRef = l; + exports.isMemo = function(a) { + return v(a) === p; + }; + }, + "./node_modules/.pnpm/react-is@18.2.0/node_modules/react-is/index.js": function(module, __unused_webpack_exports, __webpack_require__) { + if ('production' === process.env.NODE_ENV) module.exports = __webpack_require__("./node_modules/.pnpm/react-is@18.2.0/node_modules/react-is/cjs/react-is.production.min.js"); + else module.exports = __webpack_require__("./node_modules/.pnpm/react-is@18.2.0/node_modules/react-is/cjs/react-is.development.js"); + }, + "./node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js": function(module) { + /*! + Copyright (c) 2018 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/ (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 ('string' == typeof arg || 'number' == typeof arg) return arg; + if ('object' != typeof arg) 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 (module.exports) { + classNames.default = classNames; + module.exports = classNames; + } else if ('function' == typeof define && 'object' == typeof define.amd && define.amd) define('classnames', [], function() { + return classNames; + }); + else window.classNames = classNames; + })(); + } +}; +var __webpack_module_cache__ = {}; +function __webpack_require__(moduleId) { + var cachedModule = __webpack_module_cache__[moduleId]; + if (void 0 !== cachedModule) return cachedModule.exports; + var module = __webpack_module_cache__[moduleId] = { + id: moduleId, + loaded: false, + exports: {} + }; + __webpack_modules__[moduleId](module, module.exports, __webpack_require__); + module.loaded = true; + return module.exports; +} +(()=>{ + __webpack_require__.n = (module)=>{ + var getter = module && module.__esModule ? ()=>module['default'] : ()=>module; + __webpack_require__.d(getter, { + a: getter + }); + return getter; + }; +})(); +(()=>{ + __webpack_require__.d = (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_require__.hmd = (module)=>{ + module = Object.create(module); + if (!module.children) module.children = []; + Object.defineProperty(module, 'exports', { + enumerable: true, + set: ()=>{ + throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id); + } + }); + return module; + }; +})(); +(()=>{ + __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop); +})(); +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); +} +var RightOutlined_RightOutlined = { + icon: { + tag: "svg", + attrs: { + viewBox: "64 64 896 896", + focusable: "false" + }, + children: [ + { + tag: "path", + attrs: { + d: "M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z" + } + } + ] + }, + name: "right", + theme: "outlined" +}; +const asn_RightOutlined = RightOutlined_RightOutlined; +function _arrayWithHoles(r) { + if (Array.isArray(r)) return r; +} +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; + } +} +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; +} +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; + } +} +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."); +} +function slicedToArray_slicedToArray(r, e) { + return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); +} +function typeof_typeof(o) { + 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); +} +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); +} +function toPropertyKey(t) { + var i = toPrimitive(t, "string"); + return "symbol" == typeof_typeof(i) ? i : i + ""; +} +function defineProperty_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; +} +function _objectWithoutPropertiesLoose(r, e) { + if (null == r) return {}; + var t = {}; + for(var n in r)if (({}).hasOwnProperty.call(r, n)) { + if (e.includes(n)) continue; + t[n] = r[n]; + } + return t; +} +function objectWithoutProperties_objectWithoutProperties(e, t) { + if (null == e) return {}; + var o, r, i = _objectWithoutPropertiesLoose(e, t); + if (Object.getOwnPropertySymbols) { + var s = Object.getOwnPropertySymbols(e); + for(r = 0; r < s.length; r++)o = s[r], t.includes(o) || ({}).propertyIsEnumerable.call(e, o) && (i[o] = e[o]); + } + return i; +} +var classnames = __webpack_require__("./node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js"); +var classnames_default = /*#__PURE__*/ __webpack_require__.n(classnames); +const round = Math.round; +function splitColorStr(str, parseNum) { + const match = str.replace(/^[^(]*\((.*)/, '$1').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); + if (match[3]) numList[3] = match[3].includes('%') ? numList[3] / 100 : numList[3]; + else numList[3] = 1; + return numList; +} +const parseHSVorHSL = (num, _, index)=>0 === index ? num : num / 100; +function limitRange(value, max) { + const mergedMax = max || 255; + if (value > mergedMax) return mergedMax; + if (value < 0) return 0; + return value; +} +class FastColor { + constructor(input){ + defineProperty_defineProperty(this, "isValid", true); + defineProperty_defineProperty(this, "r", 0); + defineProperty_defineProperty(this, "g", 0); + defineProperty_defineProperty(this, "b", 0); + defineProperty_defineProperty(this, "a", 1); + defineProperty_defineProperty(this, "_h", void 0); + defineProperty_defineProperty(this, "_s", void 0); + defineProperty_defineProperty(this, "_l", void 0); + defineProperty_defineProperty(this, "_v", void 0); + defineProperty_defineProperty(this, "_max", void 0); + defineProperty_defineProperty(this, "_min", void 0); + defineProperty_defineProperty(this, "_brightness", void 0); + function matchFormat(str) { + return str[0] in input && str[1] in input && str[2] in input; + } + if (input) if ('string' == typeof input) { + 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 = 'number' == typeof input.a ? 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)); + } + 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); + } + 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 (void 0 === this._h) { + const delta = this.getMax() - this.getMin(); + if (0 === delta) 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 (void 0 === this._s) { + const delta = this.getMax() - this.getMin(); + if (0 === delta) this._s = 0; + else this._s = delta / this.getMax(); + } + return this._s; + } + getLightness() { + if (void 0 === this._l) this._l = (this.getMax() + this.getMin()) / 510; + return this._l; + } + getValue() { + if (void 0 === this._v) this._v = this.getMax() / 255; + return this._v; + } + getBrightness() { + if (void 0 === this._brightness) this._brightness = (299 * this.r + 587 * this.g + 114 * this.b) / 1000; + return this._brightness; + } + 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(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(100 * calc('a')) / 100 + }; + return this._c(rgba); + } + tint(amount = 10) { + return this.mix({ + r: 255, + g: 255, + b: 255, + a: 1 + }, amount); + } + 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)=>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 + }); + } + isDark() { + return this.getBrightness() < 128; + } + isLight() { + return this.getBrightness() >= 128; + } + equals(other) { + return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a; + } + clone() { + return this._c(this); + } + toHexString() { + let hex = '#'; + const rHex = (this.r || 0).toString(16); + hex += 2 === rHex.length ? rHex : '0' + rHex; + const gHex = (this.g || 0).toString(16); + hex += 2 === gHex.length ? gHex : '0' + gHex; + const bHex = (this.b || 0).toString(16); + hex += 2 === bHex.length ? bHex : '0' + bHex; + if ('number' == typeof this.a && this.a >= 0 && this.a < 1) { + const aHex = round(255 * this.a).toString(16); + hex += 2 === aHex.length ? aHex : '0' + aHex; + } + return hex; + } + toHsl() { + return { + h: this.getHue(), + s: this.getSaturation(), + l: this.getLightness(), + a: this.a + }; + } + toHslString() { + const h = this.getHue(); + const s = round(100 * this.getSaturation()); + const l = round(100 * this.getLightness()); + return 1 !== this.a ? `hsla(${h},${s}%,${l}%,${this.a})` : `hsl(${h},${s}%,${l}%)`; + } + 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 1 !== this.a ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`; + } + toString() { + return this.toRgbString(); + } + _sc(rgb, value, max) { + const clone = this.clone(); + clone[rgb] = limitRange(value, max); + return clone; + } + _c(input) { + return new this.constructor(input); + } + getMax() { + if (void 0 === this._max) this._max = Math.max(this.r, this.g, this.b); + return this._max; + } + getMin() { + if (void 0 === this._min) 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) { + this.r = connectNum(0); + this.g = connectNum(1); + this.b = connectNum(2); + this.a = withoutPrefix[3] ? connectNum(3) / 255 : 1; + } else { + 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 = 'number' == typeof a ? a : 1; + if (s <= 0) { + const rgb = round(255 * l); + 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 = 'number' == typeof a ? a : 1; + const vv = round(255 * v); + 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], + a: cells[3] + }); + } + fromHslString(trimStr) { + const cells = splitColorStr(trimStr, parseHSVorHSL); + this.fromHsl({ + h: cells[0], + s: cells[1], + l: cells[2], + a: cells[3] + }); + } + fromRgbString(trimStr) { + const cells = splitColorStr(trimStr, (num, txt)=>txt.includes('%') ? round(num / 100 * 255) : num); + this.r = cells[0]; + this.g = cells[1]; + this.b = cells[2]; + this.a = cells[3]; + } +} +var hueStep = 2; +var saturationStep = 0.16; +var saturationStep2 = 0.05; +var brightnessStep1 = 0.05; +var brightnessStep2 = 0.15; +var lightColorCount = 5; +var darkColorCount = 4; +var darkColorMap = [ + { + index: 7, + amount: 15 + }, + { + index: 6, + amount: 25 + }, + { + index: 5, + amount: 30 + }, + { + index: 5, + amount: 45 + }, + { + index: 5, + amount: 65 + }, + { + index: 5, + amount: 85 + }, + { + index: 4, + amount: 90 + }, + { + index: 3, + amount: 95 + }, + { + index: 2, + amount: 97 + }, + { + index: 1, + amount: 98 + } +]; +function getHue(hsv, i, light) { + var hue; + hue = Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240 ? light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i : light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i; + if (hue < 0) hue += 360; + else if (hue >= 360) hue -= 360; + return hue; +} +function getSaturation(hsv, i, light) { + if (0 === hsv.h && 0 === hsv.s) return hsv.s; + var saturation; + saturation = light ? hsv.s - saturationStep * i : i === darkColorCount ? hsv.s + saturationStep : hsv.s + saturationStep2 * i; + if (saturation > 1) saturation = 1; + if (light && i === lightColorCount && saturation > 0.1) saturation = 0.1; + if (saturation < 0.06) saturation = 0.06; + return Math.round(100 * saturation) / 100; +} +function generate_getValue(hsv, i, light) { + var value; + value = light ? hsv.v + brightnessStep1 * i : hsv.v - brightnessStep2 * i; + value = Math.max(0, Math.min(1, value)); + return Math.round(100 * value) / 100; +} +function generate(color) { + var opts = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + var patterns = []; + var pColor = new FastColor(color); + var hsv = pColor.toHsv(); + for(var i = lightColorCount; i > 0; i -= 1){ + var c = new FastColor({ + h: getHue(hsv, i, true), + s: getSaturation(hsv, i, true), + v: generate_getValue(hsv, i, true) + }); + patterns.push(c); + } + patterns.push(pColor); + for(var _i = 1; _i <= darkColorCount; _i += 1){ + var _c = new FastColor({ + h: getHue(hsv, _i), + s: getSaturation(hsv, _i), + v: generate_getValue(hsv, _i) + }); + patterns.push(_c); + } + if ('dark' === opts.theme) return darkColorMap.map(function(_ref) { + var index = _ref.index, amount = _ref.amount; + return new FastColor(opts.backgroundColor || '#141414').mix(patterns[index], amount).toHexString(); + }); + return patterns.map(function(c) { + return c.toHexString(); + }); +} +var presetPrimaryColors = { + red: "#F5222D", + volcano: "#FA541C", + orange: "#FA8C16", + gold: "#FAAD14", + yellow: "#FADB14", + lime: "#A0D911", + green: "#52C41A", + cyan: "#13C2C2", + blue: "#1677FF", + geekblue: "#2F54EB", + purple: "#722ED1", + magenta: "#EB2F96", + grey: "#666666" +}; +var red = [ + "#fff1f0", + "#ffccc7", + "#ffa39e", + "#ff7875", + "#ff4d4f", + "#f5222d", + "#cf1322", + "#a8071a", + "#820014", + "#5c0011" +]; +red.primary = red[5]; +var volcano = [ + "#fff2e8", + "#ffd8bf", + "#ffbb96", + "#ff9c6e", + "#ff7a45", + "#fa541c", + "#d4380d", + "#ad2102", + "#871400", + "#610b00" +]; +volcano.primary = volcano[5]; +var orange = [ + "#fff7e6", + "#ffe7ba", + "#ffd591", + "#ffc069", + "#ffa940", + "#fa8c16", + "#d46b08", + "#ad4e00", + "#873800", + "#612500" +]; +orange.primary = orange[5]; +var gold = [ + "#fffbe6", + "#fff1b8", + "#ffe58f", + "#ffd666", + "#ffc53d", + "#faad14", + "#d48806", + "#ad6800", + "#874d00", + "#613400" +]; +gold.primary = gold[5]; +var yellow = [ + "#feffe6", + "#ffffb8", + "#fffb8f", + "#fff566", + "#ffec3d", + "#fadb14", + "#d4b106", + "#ad8b00", + "#876800", + "#614700" +]; +yellow.primary = yellow[5]; +var lime = [ + "#fcffe6", + "#f4ffb8", + "#eaff8f", + "#d3f261", + "#bae637", + "#a0d911", + "#7cb305", + "#5b8c00", + "#3f6600", + "#254000" +]; +lime.primary = lime[5]; +var green = [ + "#f6ffed", + "#d9f7be", + "#b7eb8f", + "#95de64", + "#73d13d", + "#52c41a", + "#389e0d", + "#237804", + "#135200", + "#092b00" +]; +green.primary = green[5]; +var cyan = [ + "#e6fffb", + "#b5f5ec", + "#87e8de", + "#5cdbd3", + "#36cfc9", + "#13c2c2", + "#08979c", + "#006d75", + "#00474f", + "#002329" +]; +cyan.primary = cyan[5]; +var blue = [ + "#e6f4ff", + "#bae0ff", + "#91caff", + "#69b1ff", + "#4096ff", + "#1677ff", + "#0958d9", + "#003eb3", + "#002c8c", + "#001d66" +]; +blue.primary = blue[5]; +var geekblue = [ + "#f0f5ff", + "#d6e4ff", + "#adc6ff", + "#85a5ff", + "#597ef7", + "#2f54eb", + "#1d39c4", + "#10239e", + "#061178", + "#030852" +]; +geekblue.primary = geekblue[5]; +var purple = [ + "#f9f0ff", + "#efdbff", + "#d3adf7", + "#b37feb", + "#9254de", + "#722ed1", + "#531dab", + "#391085", + "#22075e", + "#120338" +]; +purple.primary = purple[5]; +var magenta = [ + "#fff0f6", + "#ffd6e7", + "#ffadd2", + "#ff85c0", + "#f759ab", + "#eb2f96", + "#c41d7f", + "#9e1068", + "#780650", + "#520339" +]; +magenta.primary = magenta[5]; +var grey = [ + "#a6a6a6", + "#999999", + "#8c8c8c", + "#808080", + "#737373", + "#666666", + "#404040", + "#1a1a1a", + "#000000", + "#000000" +]; +grey.primary = grey[5]; +var presetPalettes = { + red: red, + volcano: volcano, + orange: orange, + gold: gold, + yellow: yellow, + lime: lime, + green: green, + cyan: cyan, + blue: blue, + geekblue: geekblue, + purple: purple, + magenta: magenta, + grey: grey +}; +var redDark = [ + "#2a1215", + "#431418", + "#58181c", + "#791a1f", + "#a61d24", + "#d32029", + "#e84749", + "#f37370", + "#f89f9a", + "#fac8c3" +]; +redDark.primary = redDark[5]; +var volcanoDark = [ + "#2b1611", + "#441d12", + "#592716", + "#7c3118", + "#aa3e19", + "#d84a1b", + "#e87040", + "#f3956a", + "#f8b692", + "#fad4bc" +]; +volcanoDark.primary = volcanoDark[5]; +var orangeDark = [ + "#2b1d11", + "#442a11", + "#593815", + "#7c4a15", + "#aa6215", + "#d87a16", + "#e89a3c", + "#f3b765", + "#f8cf8d", + "#fae3b7" +]; +orangeDark.primary = orangeDark[5]; +var goldDark = [ + "#2b2111", + "#443111", + "#594214", + "#7c5914", + "#aa7714", + "#d89614", + "#e8b339", + "#f3cc62", + "#f8df8b", + "#faedb5" +]; +goldDark.primary = goldDark[5]; +var yellowDark = [ + "#2b2611", + "#443b11", + "#595014", + "#7c6e14", + "#aa9514", + "#d8bd14", + "#e8d639", + "#f3ea62", + "#f8f48b", + "#fafab5" +]; +yellowDark.primary = yellowDark[5]; +var limeDark = [ + "#1f2611", + "#2e3c10", + "#3e4f13", + "#536d13", + "#6f9412", + "#8bbb11", + "#a9d134", + "#c9e75d", + "#e4f88b", + "#f0fab5" +]; +limeDark.primary = limeDark[5]; +var greenDark = [ + "#162312", + "#1d3712", + "#274916", + "#306317", + "#3c8618", + "#49aa19", + "#6abe39", + "#8fd460", + "#b2e58b", + "#d5f2bb" +]; +greenDark.primary = greenDark[5]; +var cyanDark = [ + "#112123", + "#113536", + "#144848", + "#146262", + "#138585", + "#13a8a8", + "#33bcb7", + "#58d1c9", + "#84e2d8", + "#b2f1e8" +]; +cyanDark.primary = cyanDark[5]; +var blueDark = [ + "#111a2c", + "#112545", + "#15325b", + "#15417e", + "#1554ad", + "#1668dc", + "#3c89e8", + "#65a9f3", + "#8dc5f8", + "#b7dcfa" +]; +blueDark.primary = blueDark[5]; +var geekblueDark = [ + "#131629", + "#161d40", + "#1c2755", + "#203175", + "#263ea0", + "#2b4acb", + "#5273e0", + "#7f9ef3", + "#a8c1f8", + "#d2e0fa" +]; +geekblueDark.primary = geekblueDark[5]; +var purpleDark = [ + "#1a1325", + "#24163a", + "#301c4d", + "#3e2069", + "#51258f", + "#642ab5", + "#854eca", + "#ab7ae0", + "#cda8f0", + "#ebd7fa" +]; +purpleDark.primary = purpleDark[5]; +var magentaDark = [ + "#291321", + "#40162f", + "#551c3b", + "#75204f", + "#a02669", + "#cb2b83", + "#e0529c", + "#f37fb7", + "#f8a8cc", + "#fad2e3" +]; +magentaDark.primary = magentaDark[5]; +var greyDark = [ + "#151515", + "#1f1f1f", + "#2d2d2d", + "#393939", + "#494949", + "#5a5a5a", + "#6a6a6a", + "#7b7b7b", + "#888888", + "#969696" +]; +greyDark.primary = greyDark[5]; +var IconContext = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.createContext)({}); +const components_Context = IconContext; +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_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_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; +} +function canUseDom_canUseDom() { + return !!('undefined' != typeof window && window.document && window.document.createElement); +} +function contains(root, n) { + if (!root) return false; + if (root.contains) return root.contains(n); + var node = n; + while(node){ + if (node === root) return true; + node = node.parentNode; + } + return false; +} +var APPEND_ORDER = 'data-rc-order'; +var APPEND_PRIORITY = 'data-rc-priority'; +var MARK_KEY = "rc-util-key"; +var containerCache = new Map(); +function getMark() { + var _ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, mark = _ref.mark; + if (mark) return mark.startsWith('data-') ? mark : "data-".concat(mark); + return MARK_KEY; +} +function getContainer(option) { + if (option.attachTo) return option.attachTo; + var head = document.querySelector('head'); + return head || document.body; +} +function getOrder(prepend) { + if ('queue' === prepend) return 'prependQueue'; + return prepend ? 'prepend' : 'append'; +} +function findStyles(container) { + return Array.from((containerCache.get(container) || container).children).filter(function(node) { + return 'STYLE' === node.tagName; + }); +} +function injectCSS(css) { + var option = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + if (!canUseDom_canUseDom()) return null; + var csp = option.csp, prepend = option.prepend, _option$priority = option.priority, priority = void 0 === _option$priority ? 0 : _option$priority; + var mergedOrder = getOrder(prepend); + var isPrependQueue = 'prependQueue' === mergedOrder; + var styleNode = document.createElement('style'); + styleNode.setAttribute(APPEND_ORDER, mergedOrder); + if (isPrependQueue && priority) styleNode.setAttribute(APPEND_PRIORITY, "".concat(priority)); + if (null != csp && csp.nonce) styleNode.nonce = null == csp ? void 0 : csp.nonce; + styleNode.innerHTML = css; + var container = getContainer(option); + var firstChild = container.firstChild; + if (prepend) { + if (isPrependQueue) { + var existStyle = (option.styles || findStyles(container)).filter(function(node) { + if (![ + 'prepend', + 'prependQueue' + ].includes(node.getAttribute(APPEND_ORDER))) return false; + var nodePriority = Number(node.getAttribute(APPEND_PRIORITY) || 0); + return priority >= nodePriority; + }); + if (existStyle.length) { + container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling); + return styleNode; + } + } + container.insertBefore(styleNode, firstChild); + } else container.appendChild(styleNode); + return styleNode; +} +function findExistNode(key) { + var option = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + var container = getContainer(option); + return (option.styles || findStyles(container)).find(function(node) { + return node.getAttribute(getMark(option)) === key; + }); +} +function dynamicCSS_removeCSS(key) { + var option = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + var existNode = findExistNode(key, option); + if (existNode) { + var container = getContainer(option); + container.removeChild(existNode); + } +} +function syncRealContainer(container, option) { + var cachedRealContainer = containerCache.get(container); + if (!cachedRealContainer || !contains(document, cachedRealContainer)) { + var placeholderStyle = injectCSS('', option); + var parentNode = placeholderStyle.parentNode; + containerCache.set(container, parentNode); + container.removeChild(placeholderStyle); + } +} +function dynamicCSS_updateCSS(css, key) { + var originOption = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}; + var container = getContainer(originOption); + var styles = findStyles(container); + var option = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, originOption), {}, { + styles: styles + }); + syncRealContainer(container, option); + var existNode = findExistNode(key, option); + if (existNode) { + var _option$csp, _option$csp2; + if (null != (_option$csp = option.csp) && _option$csp.nonce && existNode.nonce !== (null == (_option$csp2 = option.csp) ? void 0 : _option$csp2.nonce)) { + var _option$csp3; + existNode.nonce = null == (_option$csp3 = option.csp) ? void 0 : _option$csp3.nonce; + } + if (existNode.innerHTML !== css) existNode.innerHTML = css; + return existNode; + } + var newNode = injectCSS(css, option); + newNode.setAttribute(getMark(option), key); + return newNode; +} +function getRoot(ele) { + var _ele$getRootNode; + return null == ele || null == (_ele$getRootNode = ele.getRootNode) ? void 0 : _ele$getRootNode.call(ele); +} +function inShadow(ele) { + return getRoot(ele) instanceof ShadowRoot; +} +function getShadowRoot(ele) { + return inShadow(ele) ? getRoot(ele) : null; +} +var warned = {}; +var preWarningFns = []; +var warning_preMessage = function(fn) { + preWarningFns.push(fn); +}; +function warning_warning(valid, message) { + if ('production' !== process.env.NODE_ENV && !valid && void 0 !== console) { + var finalMessage = preWarningFns.reduce(function(msg, preMessageFn) { + return preMessageFn(null != msg ? msg : '', 'warning'); + }, message); + if (finalMessage) console.error("Warning: ".concat(finalMessage)); + } +} +function note(valid, message) { + if ('production' !== process.env.NODE_ENV && !valid && void 0 !== console) { + var finalMessage = preWarningFns.reduce(function(msg, preMessageFn) { + return preMessageFn(null != msg ? msg : '', 'note'); + }, message); + if (finalMessage) console.warn("Note: ".concat(finalMessage)); + } +} +function resetWarned() { + warned = {}; +} +function call(method, valid, message) { + if (!valid && !warned[message]) { + method(false, message); + warned[message] = true; + } +} +function warningOnce(valid, message) { + call(warning_warning, valid, message); +} +function noteOnce(valid, message) { + call(note, valid, message); +} +warningOnce.preMessage = warning_preMessage; +warningOnce.resetWarned = resetWarned; +warningOnce.noteOnce = noteOnce; +const es_warning = warningOnce; +function camelCase(input) { + return input.replace(/-(.)/g, function(match, g) { + return g.toUpperCase(); + }); +} +function utils_warning(valid, message) { + es_warning(valid, "[@ant-design/icons] ".concat(message)); +} +function isIconDefinition(target) { + return 'object' === typeof_typeof(target) && 'string' == typeof target.name && 'string' == typeof target.theme && ('object' === typeof_typeof(target.icon) || 'function' == typeof target.icon); +} +function normalizeAttrs() { + var attrs = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + return Object.keys(attrs).reduce(function(acc, key) { + var val = attrs[key]; + switch(key){ + case 'class': + acc.className = val; + delete acc.class; + break; + default: + delete acc[key]; + acc[camelCase(key)] = val; + } + return acc; + }, {}); +} +function utils_generate(node, key, rootProps) { + if (!rootProps) return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement(node.tag, objectSpread2_objectSpread2({ + key: key + }, normalizeAttrs(node.attrs)), (node.children || []).map(function(child, index) { + return utils_generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index)); + })); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement(node.tag, objectSpread2_objectSpread2(objectSpread2_objectSpread2({ + key: key + }, normalizeAttrs(node.attrs)), rootProps), (node.children || []).map(function(child, index) { + return utils_generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index)); + })); +} +function getSecondaryColor(primaryColor) { + return generate(primaryColor)[0]; +} +function normalizeTwoToneColors(twoToneColor) { + if (!twoToneColor) return []; + return Array.isArray(twoToneColor) ? twoToneColor : [ + twoToneColor + ]; +} +var iconStyles = "\n.anticon {\n display: inline-flex;\n align-items: center;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n"; +var utils_useInsertStyles = function(eleRef) { + var _useContext = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(components_Context), csp = _useContext.csp, prefixCls = _useContext.prefixCls, layer = _useContext.layer; + var mergedStyleStr = iconStyles; + if (prefixCls) mergedStyleStr = mergedStyleStr.replace(/anticon/g, prefixCls); + if (layer) mergedStyleStr = "@layer ".concat(layer, " {\n").concat(mergedStyleStr, "\n}"); + (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(function() { + var ele = eleRef.current; + var shadowRoot = getShadowRoot(ele); + dynamicCSS_updateCSS(mergedStyleStr, '@ant-design-icons', { + prepend: !layer, + csp: csp, + attachTo: shadowRoot + }); + }, []); +}; +var _excluded = [ + "icon", + "className", + "onClick", + "style", + "primaryColor", + "secondaryColor" +]; +var twoToneColorPalette = { + primaryColor: '#333', + secondaryColor: '#E6E6E6', + calculated: false +}; +function setTwoToneColors(_ref) { + var primaryColor = _ref.primaryColor, secondaryColor = _ref.secondaryColor; + twoToneColorPalette.primaryColor = primaryColor; + twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor); + twoToneColorPalette.calculated = !!secondaryColor; +} +function getTwoToneColors() { + return objectSpread2_objectSpread2({}, twoToneColorPalette); +} +var IconBase_IconBase = function(props) { + var icon = props.icon, className = props.className, onClick = props.onClick, style = props.style, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, restProps = objectWithoutProperties_objectWithoutProperties(props, _excluded); + var svgRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(); + var colors = twoToneColorPalette; + if (primaryColor) colors = { + primaryColor: primaryColor, + secondaryColor: secondaryColor || getSecondaryColor(primaryColor) + }; + utils_useInsertStyles(svgRef); + utils_warning(isIconDefinition(icon), "icon should be icon definiton, but got ".concat(icon)); + if (!isIconDefinition(icon)) return null; + var target = icon; + if (target && 'function' == typeof target.icon) target = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, target), {}, { + icon: target.icon(colors.primaryColor, colors.secondaryColor) + }); + return utils_generate(target.icon, "svg-".concat(target.name), objectSpread2_objectSpread2(objectSpread2_objectSpread2({ + className: className, + onClick: onClick, + style: style, + 'data-icon': target.name, + width: '1em', + height: '1em', + fill: 'currentColor', + 'aria-hidden': 'true' + }, restProps), {}, { + ref: svgRef + })); +}; +IconBase_IconBase.displayName = 'IconReact'; +IconBase_IconBase.getTwoToneColors = getTwoToneColors; +IconBase_IconBase.setTwoToneColors = setTwoToneColors; +const components_IconBase = IconBase_IconBase; +function setTwoToneColor(twoToneColor) { + var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor), _normalizeTwoToneColo2 = slicedToArray_slicedToArray(_normalizeTwoToneColo, 2), primaryColor = _normalizeTwoToneColo2[0], secondaryColor = _normalizeTwoToneColo2[1]; + return components_IconBase.setTwoToneColors({ + primaryColor: primaryColor, + secondaryColor: secondaryColor + }); +} +function getTwoToneColor() { + var colors = components_IconBase.getTwoToneColors(); + if (!colors.calculated) return colors.primaryColor; + return [ + colors.primaryColor, + colors.secondaryColor + ]; +} +'use client'; +var AntdIcon_excluded = [ + "className", + "icon", + "spin", + "rotate", + "tabIndex", + "onClick", + "twoToneColor" +]; +setTwoToneColor(blue.primary); +var Icon = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef(function(props, ref) { + var className = props.className, icon = props.icon, spin = props.spin, rotate = props.rotate, tabIndex = props.tabIndex, onClick = props.onClick, twoToneColor = props.twoToneColor, restProps = objectWithoutProperties_objectWithoutProperties(props, AntdIcon_excluded); + var _React$useContext = __WEBPACK_EXTERNAL_MODULE_react__.useContext(components_Context), _React$useContext$pre = _React$useContext.prefixCls, prefixCls = void 0 === _React$useContext$pre ? 'anticon' : _React$useContext$pre, rootClassName = _React$useContext.rootClassName; + var classString = classnames_default()(rootClassName, prefixCls, defineProperty_defineProperty(defineProperty_defineProperty({}, "".concat(prefixCls, "-").concat(icon.name), !!icon.name), "".concat(prefixCls, "-spin"), !!spin || 'loading' === icon.name), className); + var iconTabIndex = tabIndex; + if (void 0 === iconTabIndex && onClick) iconTabIndex = -1; + var svgStyle = rotate ? { + msTransform: "rotate(".concat(rotate, "deg)"), + transform: "rotate(".concat(rotate, "deg)") + } : void 0; + var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor), _normalizeTwoToneColo2 = slicedToArray_slicedToArray(_normalizeTwoToneColo, 2), primaryColor = _normalizeTwoToneColo2[0], secondaryColor = _normalizeTwoToneColo2[1]; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("span", _extends({ + role: "img", + "aria-label": icon.name + }, restProps, { + ref: ref, + tabIndex: iconTabIndex, + onClick: onClick, + className: classString + }), /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(components_IconBase, { + icon: icon, + primaryColor: primaryColor, + secondaryColor: secondaryColor, + style: svgStyle + })); +}); +Icon.displayName = 'AntdIcon'; +Icon.getTwoToneColor = getTwoToneColor; +Icon.setTwoToneColor = setTwoToneColor; +const AntdIcon = Icon; +var icons_RightOutlined_RightOutlined = function(props, ref) { + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(AntdIcon, _extends({}, props, { + ref: ref, + icon: asn_RightOutlined + })); +}; +var RefIcon = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef(icons_RightOutlined_RightOutlined); +if ('production' !== process.env.NODE_ENV) RefIcon.displayName = 'RightOutlined'; +const icons_RightOutlined = RefIcon; +function _arrayWithoutHoles(r) { + if (Array.isArray(r)) return _arrayLikeToArray(r); +} +function _iterableToArray(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +function _toConsumableArray(r) { + return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); +} +function useEvent(callback) { + var fnRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(); + fnRef.current = callback; + var memoFn = __WEBPACK_EXTERNAL_MODULE_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 null == (_fnRef$current = fnRef.current) ? void 0 : _fnRef$current.call.apply(_fnRef$current, [ + fnRef + ].concat(args)); + }, []); + return memoFn; +} +var useInternalLayoutEffect = 'test' !== process.env.NODE_ENV && canUseDom_canUseDom() ? __WEBPACK_EXTERNAL_MODULE_react__.useLayoutEffect : __WEBPACK_EXTERNAL_MODULE_react__.useEffect; +var useLayoutEffect_useLayoutEffect = function(callback, deps) { + var firstMountRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(true); + useInternalLayoutEffect(function() { + return callback(firstMountRef.current); + }, deps); + useInternalLayoutEffect(function() { + firstMountRef.current = false; + return function() { + firstMountRef.current = true; + }; + }, []); +}; +var useLayoutEffect_useLayoutUpdateEffect = function(callback, deps) { + useLayoutEffect_useLayoutEffect(function(firstMount) { + if (!firstMount) return callback(); + }, deps); +}; +const hooks_useLayoutEffect = useLayoutEffect_useLayoutEffect; +function useSafeState(defaultValue) { + var destroyRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(false); + var _React$useState = __WEBPACK_EXTERNAL_MODULE_react__.useState(defaultValue), _React$useState2 = slicedToArray_slicedToArray(_React$useState, 2), value = _React$useState2[0], setValue = _React$useState2[1]; + __WEBPACK_EXTERNAL_MODULE_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 + ]; +} +function hasValue(value) { + return void 0 !== value; +} +function useMergedState(defaultStateValue, option) { + var _ref = option || {}, defaultValue = _ref.defaultValue, value = _ref.value, onChange = _ref.onChange, postState = _ref.postState; + var _useState = useSafeState(function() { + if (hasValue(value)) return value; + if (hasValue(defaultValue)) return 'function' == typeof defaultValue ? defaultValue() : defaultValue; + return 'function' == typeof defaultStateValue ? defaultStateValue() : defaultStateValue; + }), _useState2 = slicedToArray_slicedToArray(_useState, 2), innerValue = _useState2[0], setInnerValue = _useState2[1]; + var mergedValue = void 0 !== value ? value : innerValue; + var postMergedValue = postState ? postState(mergedValue) : mergedValue; + var onChangeFn = useEvent(onChange); + var _useState3 = useSafeState([ + mergedValue + ]), _useState4 = slicedToArray_slicedToArray(_useState3, 2), prevValue = _useState4[0], setPrevValue = _useState4[1]; + useLayoutEffect_useLayoutUpdateEffect(function() { + var prev = prevValue[0]; + if (innerValue !== prev) onChangeFn(innerValue, prev); + }, [ + prevValue + ]); + useLayoutEffect_useLayoutUpdateEffect(function() { + if (!hasValue(value)) setInnerValue(value); + }, [ + value + ]); + var triggerChange = useEvent(function(updater, ignoreDestroy) { + setInnerValue(updater, ignoreDestroy); + setPrevValue([ + mergedValue + ], ignoreDestroy); + }); + return [ + postMergedValue, + triggerChange + ]; +} +var REACT_ELEMENT_TYPE_18 = Symbol.for('react.element'); +var REACT_ELEMENT_TYPE_19 = Symbol.for('react.transitional.element'); +var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); +function isFragment(object) { + return object && 'object' === typeof_typeof(object) && (object.$$typeof === REACT_ELEMENT_TYPE_18 || object.$$typeof === REACT_ELEMENT_TYPE_19) && object.type === REACT_FRAGMENT_TYPE; +} +function toArray(children) { + var option = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + var ret = []; + __WEBPACK_EXTERNAL_MODULE_react__["default"].Children.forEach(children, function(child) { + if (null == child && !option.keepEmpty) return; + if (Array.isArray(child)) ret = ret.concat(toArray(child)); + else if (isFragment(child) && child.props) ret = ret.concat(toArray(child.props.children, option)); + else ret.push(child); + }); + return ret; +} +function isDOM(node) { + return node instanceof HTMLElement || node instanceof SVGElement; +} +function getDOM(node) { + if (node && 'object' === typeof_typeof(node) && isDOM(node.nativeElement)) return node.nativeElement; + if (isDOM(node)) return node; + return null; +} +function findDOMNode(node) { + var domNode = getDOM(node); + if (domNode) return domNode; + if (node instanceof __WEBPACK_EXTERNAL_MODULE_react__["default"].Component) { + var _ReactDOM$findDOMNode; + return null == (_ReactDOM$findDOMNode = __WEBPACK_EXTERNAL_MODULE_react_dom_7136dc57__["default"].findDOMNode) ? void 0 : _ReactDOM$findDOMNode.call(__WEBPACK_EXTERNAL_MODULE_react_dom_7136dc57__["default"], node); + } + return null; +} +var react_is = __webpack_require__("./node_modules/.pnpm/react-is@18.2.0/node_modules/react-is/index.js"); +function useMemo_useMemo(getValue, condition, shouldUpdate) { + var cacheRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef({}); + if (!('value' in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) { + cacheRef.current.value = getValue(); + cacheRef.current.condition = condition; + } + return cacheRef.current.value; +} +var ReactMajorVersion = Number(__WEBPACK_EXTERNAL_MODULE_react__.version.split('.')[0]); +var ref_fillRef = function(ref, node) { + if ('function' == typeof ref) ref(node); + else if ('object' === typeof_typeof(ref) && ref && 'current' in ref) ref.current = node; +}; +var ref_composeRef = function() { + for(var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++)refs[_key] = arguments[_key]; + var refList = refs.filter(Boolean); + if (refList.length <= 1) return refList[0]; + return function(node) { + refs.forEach(function(ref) { + ref_fillRef(ref, node); + }); + }; +}; +var ref_supportRef = function(nodeOrComponent) { + var _type$prototype, _nodeOrComponent$prot; + if (!nodeOrComponent) return false; + if (isReactElement(nodeOrComponent) && ReactMajorVersion >= 19) return true; + var type = (0, react_is.isMemo)(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type; + if ('function' == typeof type && !(null != (_type$prototype = type.prototype) && _type$prototype.render) && type.$$typeof !== react_is.ForwardRef) return false; + if ('function' == typeof nodeOrComponent && !(null != (_nodeOrComponent$prot = nodeOrComponent.prototype) && _nodeOrComponent$prot.render) && nodeOrComponent.$$typeof !== react_is.ForwardRef) return false; + return true; +}; +function isReactElement(node) { + return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.isValidElement)(node) && !isFragment(node); +} +var ref_getNodeRef = function(node) { + if (node && isReactElement(node)) { + var ele = node; + return ele.props.propertyIsEnumerable('ref') ? ele.props.ref : ele.ref; + } + return null; +}; +var context_excluded = [ + "children" +]; +var context_Context = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext({}); +function MotionProvider(_ref) { + var children = _ref.children, props = objectWithoutProperties_objectWithoutProperties(_ref, context_excluded); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(context_Context.Provider, { + value: props + }, children); +} +function classCallCheck_classCallCheck(a, n) { + if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); +} +function _defineProperties(e, r) { + for(var t = 0; t < r.length; t++){ + var o = r[t]; + o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o); + } +} +function createClass_createClass(e, r, t) { + return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { + writable: !1 + }), e; +} +function _setPrototypeOf(t, e) { + return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) { + return t.__proto__ = e, t; + }, _setPrototypeOf(t, e); +} +function inherits_inherits(t, e) { + if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); + t.prototype = Object.create(e && e.prototype, { + constructor: { + value: t, + writable: !0, + configurable: !0 + } + }), Object.defineProperty(t, "prototype", { + writable: !1 + }), e && _setPrototypeOf(t, e); +} +function _getPrototypeOf(t) { + return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) { + return t.__proto__ || Object.getPrototypeOf(t); + }, _getPrototypeOf(t); +} +function isNativeReflectConstruct_isNativeReflectConstruct() { + try { + var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); + } catch (t) {} + return (isNativeReflectConstruct_isNativeReflectConstruct = function() { + return !!t; + })(); +} +function assertThisInitialized_assertThisInitialized(e) { + if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return e; +} +function _possibleConstructorReturn(t, e) { + if (e && ("object" == typeof_typeof(e) || "function" == typeof e)) return e; + if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); + return assertThisInitialized_assertThisInitialized(t); +} +function createSuper_createSuper(t) { + var r = isNativeReflectConstruct_isNativeReflectConstruct(); + return function() { + var e, o = _getPrototypeOf(t); + if (r) { + var s = _getPrototypeOf(this).constructor; + e = Reflect.construct(o, arguments, s); + } else e = o.apply(this, arguments); + return _possibleConstructorReturn(this, e); + }; +} +var DomWrapper_DomWrapper = /*#__PURE__*/ function(_React$Component) { + inherits_inherits(DomWrapper, _React$Component); + var _super = createSuper_createSuper(DomWrapper); + function DomWrapper() { + classCallCheck_classCallCheck(this, DomWrapper); + return _super.apply(this, arguments); + } + createClass_createClass(DomWrapper, [ + { + key: "render", + value: function() { + return this.props.children; + } + } + ]); + return DomWrapper; +}(__WEBPACK_EXTERNAL_MODULE_react__.Component); +const es_DomWrapper = DomWrapper_DomWrapper; +function get_get(entity, path) { + var current = entity; + for(var i = 0; i < path.length; i += 1){ + if (null == current) return; + current = current[path[i]]; + } + return current; +} +function _toArray(r) { + return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); +} +function internalSet(entity, paths, value, removeIfUndefined) { + if (!paths.length) return value; + var _paths = _toArray(paths), path = _paths[0], restPath = _paths.slice(1); + var clone; + clone = entity || 'number' != typeof path ? Array.isArray(entity) ? _toConsumableArray(entity) : objectSpread2_objectSpread2({}, entity) : []; + if (removeIfUndefined && void 0 === value && 1 === restPath.length) delete clone[path][restPath[0]]; + else clone[path] = internalSet(clone[path], restPath, value, removeIfUndefined); + return clone; +} +function set_set(entity, paths, value) { + var removeIfUndefined = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : false; + if (paths.length && removeIfUndefined && void 0 === value && !get_get(entity, paths.slice(0, -1))) return entity; + return internalSet(entity, paths, value, removeIfUndefined); +} +function isObject(obj) { + return 'object' === typeof_typeof(obj) && null !== obj && Object.getPrototypeOf(obj) === Object.prototype; +} +function createEmpty(source) { + return Array.isArray(source) ? [] : {}; +} +var set_keys = 'undefined' == typeof Reflect ? Object.keys : Reflect.ownKeys; +function merge() { + for(var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++)sources[_key] = arguments[_key]; + var clone = createEmpty(sources[0]); + sources.forEach(function(src) { + function internalMerge(path, parentLoopSet) { + var loopSet = new Set(parentLoopSet); + var value = get_get(src, path); + var isArr = Array.isArray(value); + if (isArr || isObject(value)) { + if (!loopSet.has(value)) { + loopSet.add(value); + var originValue = get_get(clone, path); + if (isArr) clone = set_set(clone, path, []); + else if (!originValue || 'object' !== typeof_typeof(originValue)) clone = set_set(clone, path, createEmpty(value)); + set_keys(value).forEach(function(key) { + internalMerge([].concat(_toConsumableArray(path), [ + key + ]), loopSet); + }); + } + } else clone = set_set(clone, path, value); + } + internalMerge([]); + }); + return clone; +} +function useSyncState(defaultValue) { + var _React$useReducer = __WEBPACK_EXTERNAL_MODULE_react__.useReducer(function(x) { + return x + 1; + }, 0), _React$useReducer2 = slicedToArray_slicedToArray(_React$useReducer, 2), forceUpdate = _React$useReducer2[1]; + var currentValueRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(defaultValue); + var getValue = useEvent(function() { + return currentValueRef.current; + }); + var setValue = useEvent(function(updater) { + currentValueRef.current = 'function' == typeof updater ? updater(currentValueRef.current) : updater; + forceUpdate(); + }); + return [ + getValue, + setValue + ]; +} +var STATUS_NONE = 'none'; +var STATUS_APPEAR = 'appear'; +var STATUS_ENTER = 'enter'; +var STATUS_LEAVE = 'leave'; +var STEP_NONE = 'none'; +var STEP_PREPARE = 'prepare'; +var STEP_START = 'start'; +var STEP_ACTIVE = 'active'; +var STEP_ACTIVATED = 'end'; +var STEP_PREPARED = 'prepared'; +function makePrefixMap(styleProp, eventName) { + var prefixes = {}; + prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); + prefixes["Webkit".concat(styleProp)] = "webkit".concat(eventName); + prefixes["Moz".concat(styleProp)] = "moz".concat(eventName); + prefixes["ms".concat(styleProp)] = "MS".concat(eventName); + prefixes["O".concat(styleProp)] = "o".concat(eventName.toLowerCase()); + return prefixes; +} +function getVendorPrefixes(domSupport, win) { + var prefixes = { + animationend: makePrefixMap('Animation', 'AnimationEnd'), + transitionend: makePrefixMap('Transition', 'TransitionEnd') + }; + if (domSupport) { + if (!('AnimationEvent' in win)) delete prefixes.animationend.animation; + if (!('TransitionEvent' in win)) delete prefixes.transitionend.transition; + } + return prefixes; +} +var vendorPrefixes = getVendorPrefixes(canUseDom_canUseDom(), 'undefined' != typeof window ? window : {}); +var motion_style = {}; +if (canUseDom_canUseDom()) { + var _document$createEleme = document.createElement('div'); + motion_style = _document$createEleme.style; +} +var prefixedEventNames = {}; +function getVendorPrefixedEventName(eventName) { + if (prefixedEventNames[eventName]) return prefixedEventNames[eventName]; + var prefixMap = vendorPrefixes[eventName]; + if (prefixMap) { + var stylePropList = Object.keys(prefixMap); + var len = stylePropList.length; + for(var i = 0; i < len; i += 1){ + var styleProp = stylePropList[i]; + if (Object.prototype.hasOwnProperty.call(prefixMap, styleProp) && styleProp in motion_style) { + prefixedEventNames[eventName] = prefixMap[styleProp]; + return prefixedEventNames[eventName]; + } + } + } + return ''; +} +var internalAnimationEndName = getVendorPrefixedEventName('animationend'); +var internalTransitionEndName = getVendorPrefixedEventName('transitionend'); +var supportTransition = !!(internalAnimationEndName && internalTransitionEndName); +var animationEndName = internalAnimationEndName || 'animationend'; +var transitionEndName = internalTransitionEndName || 'transitionend'; +function getTransitionName(transitionName, transitionType) { + if (!transitionName) return null; + if ('object' === typeof_typeof(transitionName)) { + var type = transitionType.replace(/-\w/g, function(match) { + return match[1].toUpperCase(); + }); + return transitionName[type]; + } + return "".concat(transitionName, "-").concat(transitionType); +} +const useDomMotionEvents = function(onInternalMotionEnd) { + var cacheElementRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(); + function removeMotionEvents(element) { + if (element) { + element.removeEventListener(transitionEndName, onInternalMotionEnd); + element.removeEventListener(animationEndName, onInternalMotionEnd); + } + } + function patchMotionEvents(element) { + if (cacheElementRef.current && cacheElementRef.current !== element) removeMotionEvents(cacheElementRef.current); + if (element && element !== cacheElementRef.current) { + element.addEventListener(transitionEndName, onInternalMotionEnd); + element.addEventListener(animationEndName, onInternalMotionEnd); + cacheElementRef.current = element; + } + } + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(function() { + return function() { + removeMotionEvents(cacheElementRef.current); + }; + }, []); + return [ + patchMotionEvents, + removeMotionEvents + ]; +}; +var useIsomorphicLayoutEffect_useIsomorphicLayoutEffect = canUseDom_canUseDom() ? __WEBPACK_EXTERNAL_MODULE_react__.useLayoutEffect : __WEBPACK_EXTERNAL_MODULE_react__.useEffect; +const useIsomorphicLayoutEffect = useIsomorphicLayoutEffect_useIsomorphicLayoutEffect; +var raf_raf = function(callback) { + return +setTimeout(callback, 16); +}; +var raf_caf = function(num) { + return clearTimeout(num); +}; +if ('undefined' != typeof window && 'requestAnimationFrame' in window) { + raf_raf = function(callback) { + return window.requestAnimationFrame(callback); + }; + raf_caf = function(handle) { + return window.cancelAnimationFrame(handle); + }; +} +var rafUUID = 0; +var rafIds = new Map(); +function cleanup(id) { + rafIds.delete(id); +} +var raf_wrapperRaf = function(callback) { + var times = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1; + rafUUID += 1; + var id = rafUUID; + function callRef(leftTimes) { + if (0 === leftTimes) { + cleanup(id); + callback(); + } else { + var realId = raf_raf(function() { + callRef(leftTimes - 1); + }); + rafIds.set(id, realId); + } + } + callRef(times); + return id; +}; +raf_wrapperRaf.cancel = function(id) { + var realId = rafIds.get(id); + cleanup(id); + return raf_caf(realId); +}; +if ('production' !== process.env.NODE_ENV) raf_wrapperRaf.ids = function() { + return rafIds; +}; +const es_raf = raf_wrapperRaf; +const useNextFrame = function() { + var nextFrameRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(null); + function cancelNextFrame() { + es_raf.cancel(nextFrameRef.current); + } + function nextFrame(callback) { + var delay = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2; + cancelNextFrame(); + var nextFrameId = es_raf(function() { + if (delay <= 1) callback({ + isCanceled: function() { + return nextFrameId !== nextFrameRef.current; + } + }); + else nextFrame(callback, delay - 1); + }); + nextFrameRef.current = nextFrameId; + } + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(function() { + return function() { + cancelNextFrame(); + }; + }, []); + return [ + nextFrame, + cancelNextFrame + ]; +}; +var FULL_STEP_QUEUE = [ + STEP_PREPARE, + STEP_START, + STEP_ACTIVE, + STEP_ACTIVATED +]; +var SIMPLE_STEP_QUEUE = [ + STEP_PREPARE, + STEP_PREPARED +]; +var SkipStep = false; +var DoStep = true; +function useStepQueue_isActive(step) { + return step === STEP_ACTIVE || step === STEP_ACTIVATED; +} +const useStepQueue = function(status, prepareOnly, callback) { + var _useState = useSafeState(STEP_NONE), _useState2 = slicedToArray_slicedToArray(_useState, 2), step = _useState2[0], setStep = _useState2[1]; + var _useNextFrame = useNextFrame(), _useNextFrame2 = slicedToArray_slicedToArray(_useNextFrame, 2), nextFrame = _useNextFrame2[0], cancelNextFrame = _useNextFrame2[1]; + function startQueue() { + setStep(STEP_PREPARE, true); + } + var STEP_QUEUE = prepareOnly ? SIMPLE_STEP_QUEUE : FULL_STEP_QUEUE; + useIsomorphicLayoutEffect(function() { + if (step !== STEP_NONE && step !== STEP_ACTIVATED) { + var index = STEP_QUEUE.indexOf(step); + var nextStep = STEP_QUEUE[index + 1]; + var result = callback(step); + if (result === SkipStep) setStep(nextStep, true); + else if (nextStep) nextFrame(function(info) { + function doNext() { + if (info.isCanceled()) return; + setStep(nextStep, true); + } + if (true === result) doNext(); + else Promise.resolve(result).then(doNext); + }); + } + }, [ + status, + step + ]); + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(function() { + return function() { + cancelNextFrame(); + }; + }, []); + return [ + startQueue, + step + ]; +}; +function useStatus(supportMotion, visible, getElement, _ref) { + var _ref$motionEnter = _ref.motionEnter, motionEnter = void 0 === _ref$motionEnter ? true : _ref$motionEnter, _ref$motionAppear = _ref.motionAppear, motionAppear = void 0 === _ref$motionAppear ? true : _ref$motionAppear, _ref$motionLeave = _ref.motionLeave, motionLeave = void 0 === _ref$motionLeave ? true : _ref$motionLeave, motionDeadline = _ref.motionDeadline, motionLeaveImmediately = _ref.motionLeaveImmediately, onAppearPrepare = _ref.onAppearPrepare, onEnterPrepare = _ref.onEnterPrepare, onLeavePrepare = _ref.onLeavePrepare, onAppearStart = _ref.onAppearStart, onEnterStart = _ref.onEnterStart, onLeaveStart = _ref.onLeaveStart, onAppearActive = _ref.onAppearActive, onEnterActive = _ref.onEnterActive, onLeaveActive = _ref.onLeaveActive, onAppearEnd = _ref.onAppearEnd, onEnterEnd = _ref.onEnterEnd, onLeaveEnd = _ref.onLeaveEnd, onVisibleChanged = _ref.onVisibleChanged; + var _useState = useSafeState(), _useState2 = slicedToArray_slicedToArray(_useState, 2), asyncVisible = _useState2[0], setAsyncVisible = _useState2[1]; + var _useSyncState = useSyncState(STATUS_NONE), _useSyncState2 = slicedToArray_slicedToArray(_useSyncState, 2), getStatus = _useSyncState2[0], setStatus = _useSyncState2[1]; + var _useState3 = useSafeState(null), _useState4 = slicedToArray_slicedToArray(_useState3, 2), style = _useState4[0], setStyle = _useState4[1]; + var currentStatus = getStatus(); + var mountedRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(false); + var deadlineRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null); + function getDomElement() { + return getElement(); + } + var activeRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(false); + function updateMotionEndStatus() { + setStatus(STATUS_NONE); + setStyle(null, true); + } + var onInternalMotionEnd = useEvent(function(event) { + var status = getStatus(); + if (status === STATUS_NONE) return; + var element = getDomElement(); + if (event && !event.deadline && event.target !== element) return; + var currentActive = activeRef.current; + var canEnd; + if (status === STATUS_APPEAR && currentActive) canEnd = null == onAppearEnd ? void 0 : onAppearEnd(element, event); + else if (status === STATUS_ENTER && currentActive) canEnd = null == onEnterEnd ? void 0 : onEnterEnd(element, event); + else if (status === STATUS_LEAVE && currentActive) canEnd = null == onLeaveEnd ? void 0 : onLeaveEnd(element, event); + if (currentActive && false !== canEnd) updateMotionEndStatus(); + }); + var _useDomMotionEvents = useDomMotionEvents(onInternalMotionEnd), _useDomMotionEvents2 = slicedToArray_slicedToArray(_useDomMotionEvents, 1), patchMotionEvents = _useDomMotionEvents2[0]; + var getEventHandlers = function(targetStatus) { + switch(targetStatus){ + case STATUS_APPEAR: + return defineProperty_defineProperty(defineProperty_defineProperty(defineProperty_defineProperty({}, STEP_PREPARE, onAppearPrepare), STEP_START, onAppearStart), STEP_ACTIVE, onAppearActive); + case STATUS_ENTER: + return defineProperty_defineProperty(defineProperty_defineProperty(defineProperty_defineProperty({}, STEP_PREPARE, onEnterPrepare), STEP_START, onEnterStart), STEP_ACTIVE, onEnterActive); + case STATUS_LEAVE: + return defineProperty_defineProperty(defineProperty_defineProperty(defineProperty_defineProperty({}, STEP_PREPARE, onLeavePrepare), STEP_START, onLeaveStart), STEP_ACTIVE, onLeaveActive); + default: + return {}; + } + }; + var eventHandlers = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(function() { + return getEventHandlers(currentStatus); + }, [ + currentStatus + ]); + var _useStepQueue = useStepQueue(currentStatus, !supportMotion, function(newStep) { + if (newStep === STEP_PREPARE) { + var onPrepare = eventHandlers[STEP_PREPARE]; + if (!onPrepare) return SkipStep; + return onPrepare(getDomElement()); + } + if (step in eventHandlers) { + var _eventHandlers$step; + setStyle((null == (_eventHandlers$step = eventHandlers[step]) ? void 0 : _eventHandlers$step.call(eventHandlers, getDomElement(), null)) || null); + } + if (step === STEP_ACTIVE && currentStatus !== STATUS_NONE) { + patchMotionEvents(getDomElement()); + if (motionDeadline > 0) { + clearTimeout(deadlineRef.current); + deadlineRef.current = setTimeout(function() { + onInternalMotionEnd({ + deadline: true + }); + }, motionDeadline); + } + } + if (step === STEP_PREPARED) updateMotionEndStatus(); + return DoStep; + }), _useStepQueue2 = slicedToArray_slicedToArray(_useStepQueue, 2), startStep = _useStepQueue2[0], step = _useStepQueue2[1]; + var active = useStepQueue_isActive(step); + activeRef.current = active; + var visibleRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null); + useIsomorphicLayoutEffect(function() { + if (mountedRef.current && visibleRef.current === visible) return; + setAsyncVisible(visible); + var isMounted = mountedRef.current; + mountedRef.current = true; + var nextStatus; + if (!isMounted && visible && motionAppear) nextStatus = STATUS_APPEAR; + if (isMounted && visible && motionEnter) nextStatus = STATUS_ENTER; + if (isMounted && !visible && motionLeave || !isMounted && motionLeaveImmediately && !visible && motionLeave) nextStatus = STATUS_LEAVE; + var nextEventHandlers = getEventHandlers(nextStatus); + if (nextStatus && (supportMotion || nextEventHandlers[STEP_PREPARE])) { + setStatus(nextStatus); + startStep(); + } else setStatus(STATUS_NONE); + visibleRef.current = visible; + }, [ + visible + ]); + (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(function() { + if (currentStatus === STATUS_APPEAR && !motionAppear || currentStatus === STATUS_ENTER && !motionEnter || currentStatus === STATUS_LEAVE && !motionLeave) setStatus(STATUS_NONE); + }, [ + motionAppear, + motionEnter, + motionLeave + ]); + (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(function() { + return function() { + mountedRef.current = false; + clearTimeout(deadlineRef.current); + }; + }, []); + var firstMountChangeRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(false); + (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(function() { + if (asyncVisible) firstMountChangeRef.current = true; + if (void 0 !== asyncVisible && currentStatus === STATUS_NONE) { + if (firstMountChangeRef.current || asyncVisible) null == onVisibleChanged || onVisibleChanged(asyncVisible); + firstMountChangeRef.current = true; + } + }, [ + asyncVisible, + currentStatus + ]); + var mergedStyle = style; + if (eventHandlers[STEP_PREPARE] && step === STEP_START) mergedStyle = objectSpread2_objectSpread2({ + transition: 'none' + }, mergedStyle); + return [ + currentStatus, + step, + mergedStyle, + null != asyncVisible ? asyncVisible : visible + ]; +} +function genCSSMotion(config) { + var transitionSupport = config; + if ('object' === typeof_typeof(config)) transitionSupport = config.transitionSupport; + function isSupportTransition(props, contextMotion) { + return !!(props.motionName && transitionSupport && false !== contextMotion); + } + var CSSMotion = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef(function(props, ref) { + var _props$visible = props.visible, visible = void 0 === _props$visible ? true : _props$visible, _props$removeOnLeave = props.removeOnLeave, removeOnLeave = void 0 === _props$removeOnLeave ? true : _props$removeOnLeave, forceRender = props.forceRender, children = props.children, motionName = props.motionName, leavedClassName = props.leavedClassName, eventProps = props.eventProps; + var _React$useContext = __WEBPACK_EXTERNAL_MODULE_react__.useContext(context_Context), contextMotion = _React$useContext.motion; + var supportMotion = isSupportTransition(props, contextMotion); + var nodeRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(); + var wrapperNodeRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(); + function getDomElement() { + try { + return nodeRef.current instanceof HTMLElement ? nodeRef.current : findDOMNode(wrapperNodeRef.current); + } catch (e) { + return null; + } + } + var _useStatus = useStatus(supportMotion, visible, getDomElement, props), _useStatus2 = slicedToArray_slicedToArray(_useStatus, 4), status = _useStatus2[0], statusStep = _useStatus2[1], statusStyle = _useStatus2[2], mergedVisible = _useStatus2[3]; + var renderedRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(mergedVisible); + if (mergedVisible) renderedRef.current = true; + var setNodeRef = __WEBPACK_EXTERNAL_MODULE_react__.useCallback(function(node) { + nodeRef.current = node; + ref_fillRef(ref, node); + }, [ + ref + ]); + var motionChildren; + var mergedProps = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, eventProps), {}, { + visible: visible + }); + if (children) if (status === STATUS_NONE) motionChildren = mergedVisible ? children(objectSpread2_objectSpread2({}, mergedProps), setNodeRef) : !removeOnLeave && renderedRef.current && leavedClassName ? children(objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, mergedProps), {}, { + className: leavedClassName + }), setNodeRef) : !forceRender && (removeOnLeave || leavedClassName) ? null : children(objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, mergedProps), {}, { + style: { + display: 'none' + } + }), setNodeRef); + else { + var statusSuffix; + if (statusStep === STEP_PREPARE) statusSuffix = 'prepare'; + else if (useStepQueue_isActive(statusStep)) statusSuffix = 'active'; + else if (statusStep === STEP_START) statusSuffix = 'start'; + var motionCls = getTransitionName(motionName, "".concat(status, "-").concat(statusSuffix)); + motionChildren = children(objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, mergedProps), {}, { + className: classnames_default()(getTransitionName(motionName, status), defineProperty_defineProperty(defineProperty_defineProperty({}, motionCls, motionCls && statusSuffix), motionName, 'string' == typeof motionName)), + style: statusStyle + }), setNodeRef); + } + else motionChildren = null; + if (/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.isValidElement(motionChildren) && ref_supportRef(motionChildren)) { + var originNodeRef = ref_getNodeRef(motionChildren); + if (!originNodeRef) motionChildren = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.cloneElement(motionChildren, { + ref: setNodeRef + }); + } + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(es_DomWrapper, { + ref: wrapperNodeRef + }, motionChildren); + }); + CSSMotion.displayName = 'CSSMotion'; + return CSSMotion; +} +const es_CSSMotion = genCSSMotion(supportTransition); +var STATUS_ADD = 'add'; +var STATUS_KEEP = 'keep'; +var STATUS_REMOVE = 'remove'; +var STATUS_REMOVED = 'removed'; +function wrapKeyToObject(key) { + var keyObj; + keyObj = key && 'object' === typeof_typeof(key) && 'key' in key ? key : { + key: key + }; + return objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, keyObj), {}, { + key: String(keyObj.key) + }); +} +function parseKeys() { + var keys = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + return keys.map(wrapKeyToObject); +} +function diffKeys() { + var prevKeys = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + var currentKeys = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : []; + var list = []; + var currentIndex = 0; + var currentLen = currentKeys.length; + var prevKeyObjects = parseKeys(prevKeys); + var currentKeyObjects = parseKeys(currentKeys); + prevKeyObjects.forEach(function(keyObj) { + var hit = false; + for(var i = currentIndex; i < currentLen; i += 1){ + var currentKeyObj = currentKeyObjects[i]; + if (currentKeyObj.key === keyObj.key) { + if (currentIndex < i) { + list = list.concat(currentKeyObjects.slice(currentIndex, i).map(function(obj) { + return objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, obj), {}, { + status: STATUS_ADD + }); + })); + currentIndex = i; + } + list.push(objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, currentKeyObj), {}, { + status: STATUS_KEEP + })); + currentIndex += 1; + hit = true; + break; + } + } + if (!hit) list.push(objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, keyObj), {}, { + status: STATUS_REMOVE + })); + }); + if (currentIndex < currentLen) list = list.concat(currentKeyObjects.slice(currentIndex).map(function(obj) { + return objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, obj), {}, { + status: STATUS_ADD + }); + })); + var keys = {}; + list.forEach(function(_ref) { + var key = _ref.key; + keys[key] = (keys[key] || 0) + 1; + }); + var duplicatedKeys = Object.keys(keys).filter(function(key) { + return keys[key] > 1; + }); + duplicatedKeys.forEach(function(matchKey) { + list = list.filter(function(_ref2) { + var key = _ref2.key, status = _ref2.status; + return key !== matchKey || status !== STATUS_REMOVE; + }); + list.forEach(function(node) { + if (node.key === matchKey) node.status = STATUS_KEEP; + }); + }); + return list; +} +var CSSMotionList_excluded = [ + "component", + "children", + "onVisibleChanged", + "onAllRemoved" +], _excluded2 = [ + "status" +]; +var MOTION_PROP_NAMES = [ + 'eventProps', + 'visible', + 'children', + 'motionName', + 'motionAppear', + 'motionEnter', + 'motionLeave', + 'motionLeaveImmediately', + 'motionDeadline', + 'removeOnLeave', + 'leavedClassName', + 'onAppearPrepare', + 'onAppearStart', + 'onAppearActive', + 'onAppearEnd', + 'onEnterStart', + 'onEnterActive', + 'onEnterEnd', + 'onLeaveStart', + 'onLeaveActive', + 'onLeaveEnd' +]; +function genCSSMotionList(transitionSupport) { + var CSSMotion = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : es_CSSMotion; + var CSSMotionList = /*#__PURE__*/ function(_React$Component) { + inherits_inherits(CSSMotionList, _React$Component); + var _super = createSuper_createSuper(CSSMotionList); + function CSSMotionList() { + var _this; + classCallCheck_classCallCheck(this, CSSMotionList); + for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + _this = _super.call.apply(_super, [ + this + ].concat(args)); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "state", { + keyEntities: [] + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "removeKey", function(removeKey) { + _this.setState(function(prevState) { + var nextKeyEntities = prevState.keyEntities.map(function(entity) { + if (entity.key !== removeKey) return entity; + return objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, entity), {}, { + status: STATUS_REMOVED + }); + }); + return { + keyEntities: nextKeyEntities + }; + }, function() { + var keyEntities = _this.state.keyEntities; + var restKeysCount = keyEntities.filter(function(_ref) { + var status = _ref.status; + return status !== STATUS_REMOVED; + }).length; + if (0 === restKeysCount && _this.props.onAllRemoved) _this.props.onAllRemoved(); + }); + }); + return _this; + } + createClass_createClass(CSSMotionList, [ + { + key: "render", + value: function() { + var _this2 = this; + var keyEntities = this.state.keyEntities; + var _this$props = this.props, component = _this$props.component, children = _this$props.children, _onVisibleChanged = _this$props.onVisibleChanged, restProps = (_this$props.onAllRemoved, objectWithoutProperties_objectWithoutProperties(_this$props, CSSMotionList_excluded)); + var Component = component || __WEBPACK_EXTERNAL_MODULE_react__.Fragment; + var motionProps = {}; + MOTION_PROP_NAMES.forEach(function(prop) { + motionProps[prop] = restProps[prop]; + delete restProps[prop]; + }); + delete restProps.keys; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(Component, restProps, keyEntities.map(function(_ref2, index) { + var status = _ref2.status, eventProps = objectWithoutProperties_objectWithoutProperties(_ref2, _excluded2); + var visible = status === STATUS_ADD || status === STATUS_KEEP; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(CSSMotion, _extends({}, motionProps, { + key: eventProps.key, + visible: visible, + eventProps: eventProps, + onVisibleChanged: function(changedVisible) { + null == _onVisibleChanged || _onVisibleChanged(changedVisible, { + key: eventProps.key + }); + if (!changedVisible) _this2.removeKey(eventProps.key); + } + }), function(props, ref) { + return children(objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, props), {}, { + index: index + }), ref); + }); + })); + } + } + ], [ + { + key: "getDerivedStateFromProps", + value: function(_ref3, _ref4) { + var keys = _ref3.keys; + var keyEntities = _ref4.keyEntities; + var parsedKeyObjects = parseKeys(keys); + var mixedKeyEntities = diffKeys(keyEntities, parsedKeyObjects); + return { + keyEntities: mixedKeyEntities.filter(function(entity) { + var prevEntity = keyEntities.find(function(_ref5) { + var key = _ref5.key; + return entity.key === key; + }); + if (prevEntity && prevEntity.status === STATUS_REMOVED && entity.status === STATUS_REMOVE) return false; + return true; + }) + }; + } + } + ]); + return CSSMotionList; + }(__WEBPACK_EXTERNAL_MODULE_react__.Component); + defineProperty_defineProperty(CSSMotionList, "defaultProps", { + component: 'div' + }); + return CSSMotionList; +} +genCSSMotionList(supportTransition); +const es = es_CSSMotion; +var KeyCode = { + MAC_ENTER: 3, + BACKSPACE: 8, + TAB: 9, + NUM_CENTER: 12, + ENTER: 13, + SHIFT: 16, + CTRL: 17, + ALT: 18, + PAUSE: 19, + CAPS_LOCK: 20, + ESC: 27, + SPACE: 32, + PAGE_UP: 33, + PAGE_DOWN: 34, + END: 35, + HOME: 36, + LEFT: 37, + UP: 38, + RIGHT: 39, + DOWN: 40, + PRINT_SCREEN: 44, + INSERT: 45, + DELETE: 46, + ZERO: 48, + ONE: 49, + TWO: 50, + THREE: 51, + FOUR: 52, + FIVE: 53, + SIX: 54, + SEVEN: 55, + EIGHT: 56, + NINE: 57, + QUESTION_MARK: 63, + A: 65, + B: 66, + C: 67, + D: 68, + E: 69, + F: 70, + G: 71, + H: 72, + I: 73, + J: 74, + K: 75, + L: 76, + M: 77, + N: 78, + O: 79, + P: 80, + Q: 81, + R: 82, + S: 83, + T: 84, + U: 85, + V: 86, + W: 87, + X: 88, + Y: 89, + Z: 90, + META: 91, + WIN_KEY_RIGHT: 92, + CONTEXT_MENU: 93, + NUM_ZERO: 96, + NUM_ONE: 97, + NUM_TWO: 98, + NUM_THREE: 99, + NUM_FOUR: 100, + NUM_FIVE: 101, + NUM_SIX: 102, + NUM_SEVEN: 103, + NUM_EIGHT: 104, + NUM_NINE: 105, + NUM_MULTIPLY: 106, + NUM_PLUS: 107, + NUM_MINUS: 109, + NUM_PERIOD: 110, + NUM_DIVISION: 111, + F1: 112, + F2: 113, + F3: 114, + F4: 115, + F5: 116, + F6: 117, + F7: 118, + F8: 119, + F9: 120, + F10: 121, + F11: 122, + F12: 123, + NUMLOCK: 144, + SEMICOLON: 186, + DASH: 189, + EQUALS: 187, + COMMA: 188, + PERIOD: 190, + SLASH: 191, + APOSTROPHE: 192, + SINGLE_QUOTE: 222, + OPEN_SQUARE_BRACKET: 219, + BACKSLASH: 220, + CLOSE_SQUARE_BRACKET: 221, + WIN_KEY: 224, + MAC_FF_META: 224, + WIN_IME: 229, + isTextModifyingKeyEvent: function(e) { + var keyCode = e.keyCode; + if (e.altKey && !e.ctrlKey || e.metaKey || keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) return false; + switch(keyCode){ + case KeyCode.ALT: + case KeyCode.CAPS_LOCK: + case KeyCode.CONTEXT_MENU: + case KeyCode.CTRL: + case KeyCode.DOWN: + case KeyCode.END: + case KeyCode.ESC: + case KeyCode.HOME: + case KeyCode.INSERT: + case KeyCode.LEFT: + case KeyCode.MAC_FF_META: + case KeyCode.META: + case KeyCode.NUMLOCK: + case KeyCode.NUM_CENTER: + case KeyCode.PAGE_DOWN: + case KeyCode.PAGE_UP: + case KeyCode.PAUSE: + case KeyCode.PRINT_SCREEN: + case KeyCode.RIGHT: + case KeyCode.SHIFT: + case KeyCode.UP: + case KeyCode.WIN_KEY: + case KeyCode.WIN_KEY_RIGHT: + return false; + default: + return true; + } + }, + isCharacterKey: function(keyCode) { + if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) return true; + if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) return true; + if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) return true; + if (-1 !== window.navigator.userAgent.indexOf('WebKit') && 0 === keyCode) return true; + switch(keyCode){ + case KeyCode.SPACE: + case KeyCode.QUESTION_MARK: + case KeyCode.NUM_PLUS: + case KeyCode.NUM_MINUS: + case KeyCode.NUM_PERIOD: + case KeyCode.NUM_DIVISION: + case KeyCode.SEMICOLON: + case KeyCode.DASH: + case KeyCode.EQUALS: + case KeyCode.COMMA: + case KeyCode.PERIOD: + case KeyCode.SLASH: + case KeyCode.APOSTROPHE: + case KeyCode.SINGLE_QUOTE: + case KeyCode.OPEN_SQUARE_BRACKET: + case KeyCode.BACKSLASH: + case KeyCode.CLOSE_SQUARE_BRACKET: + return true; + default: + return false; + } + } +}; +const es_KeyCode = KeyCode; +var PanelContent = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].forwardRef(function(props, ref) { + var prefixCls = props.prefixCls, forceRender = props.forceRender, className = props.className, style = props.style, children = props.children, isActive = props.isActive, role = props.role, customizeClassNames = props.classNames, styles = props.styles; + var _React$useState = __WEBPACK_EXTERNAL_MODULE_react__["default"].useState(isActive || forceRender), _React$useState2 = slicedToArray_slicedToArray(_React$useState, 2), rendered = _React$useState2[0], setRendered = _React$useState2[1]; + __WEBPACK_EXTERNAL_MODULE_react__["default"].useEffect(function() { + if (forceRender || isActive) setRendered(true); + }, [ + forceRender, + isActive + ]); + if (!rendered) return null; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement("div", { + ref: ref, + className: classnames_default()("".concat(prefixCls, "-content"), defineProperty_defineProperty(defineProperty_defineProperty({}, "".concat(prefixCls, "-content-active"), isActive), "".concat(prefixCls, "-content-inactive"), !isActive), className), + style: style, + role: role + }, /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement("div", { + className: classnames_default()("".concat(prefixCls, "-content-box"), null == customizeClassNames ? void 0 : customizeClassNames.body), + style: null == styles ? void 0 : styles.body + }, children)); +}); +PanelContent.displayName = 'PanelContent'; +const es_PanelContent = PanelContent; +var Panel_excluded = [ + "showArrow", + "headerClass", + "isActive", + "onItemClick", + "forceRender", + "className", + "classNames", + "styles", + "prefixCls", + "collapsible", + "accordion", + "panelKey", + "extra", + "header", + "expandIcon", + "openMotion", + "destroyInactivePanel", + "children" +]; +var CollapsePanel = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].forwardRef(function(props, ref) { + var _props$showArrow = props.showArrow, showArrow = void 0 === _props$showArrow ? true : _props$showArrow, headerClass = props.headerClass, isActive = props.isActive, onItemClick = props.onItemClick, forceRender = props.forceRender, className = props.className, _props$classNames = props.classNames, customizeClassNames = void 0 === _props$classNames ? {} : _props$classNames, _props$styles = props.styles, styles = void 0 === _props$styles ? {} : _props$styles, prefixCls = props.prefixCls, collapsible = props.collapsible, accordion = props.accordion, panelKey = props.panelKey, extra = props.extra, header = props.header, expandIcon = props.expandIcon, openMotion = props.openMotion, destroyInactivePanel = props.destroyInactivePanel, children = props.children, resetProps = objectWithoutProperties_objectWithoutProperties(props, Panel_excluded); + var disabled = 'disabled' === collapsible; + var ifExtraExist = null != extra && 'boolean' != typeof extra; + var collapsibleProps = defineProperty_defineProperty(defineProperty_defineProperty(defineProperty_defineProperty({ + onClick: function() { + null == onItemClick || onItemClick(panelKey); + }, + onKeyDown: function(e) { + if ('Enter' === e.key || e.keyCode === es_KeyCode.ENTER || e.which === es_KeyCode.ENTER) null == onItemClick || onItemClick(panelKey); + }, + role: accordion ? 'tab' : 'button' + }, 'aria-expanded', isActive), 'aria-disabled', disabled), "tabIndex", disabled ? -1 : 0); + var iconNodeInner = 'function' == typeof expandIcon ? expandIcon(props) : /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement("i", { + className: "arrow" + }); + var iconNode = iconNodeInner && /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement("div", _extends({ + className: "".concat(prefixCls, "-expand-icon") + }, [ + 'header', + 'icon' + ].includes(collapsible) ? collapsibleProps : {}), iconNodeInner); + var collapsePanelClassNames = classnames_default()("".concat(prefixCls, "-item"), defineProperty_defineProperty(defineProperty_defineProperty({}, "".concat(prefixCls, "-item-active"), isActive), "".concat(prefixCls, "-item-disabled"), disabled), className); + var headerClassName = classnames_default()(headerClass, "".concat(prefixCls, "-header"), defineProperty_defineProperty({}, "".concat(prefixCls, "-collapsible-").concat(collapsible), !!collapsible), customizeClassNames.header); + var headerProps = objectSpread2_objectSpread2({ + className: headerClassName, + style: styles.header + }, [ + 'header', + 'icon' + ].includes(collapsible) ? {} : collapsibleProps); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement("div", _extends({}, resetProps, { + ref: ref, + className: collapsePanelClassNames + }), /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement("div", headerProps, showArrow && iconNode, /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement("span", _extends({ + className: "".concat(prefixCls, "-header-text") + }, 'header' === collapsible ? collapsibleProps : {}), header), ifExtraExist && /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement("div", { + className: "".concat(prefixCls, "-extra") + }, extra)), /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement(es, _extends({ + visible: isActive, + leavedClassName: "".concat(prefixCls, "-content-hidden") + }, openMotion, { + forceRender: forceRender, + removeOnLeave: destroyInactivePanel + }), function(_ref, motionRef) { + var motionClassName = _ref.className, motionStyle = _ref.style; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement(es_PanelContent, { + ref: motionRef, + prefixCls: prefixCls, + className: motionClassName, + classNames: customizeClassNames, + style: motionStyle, + styles: styles, + isActive: isActive, + forceRender: forceRender, + role: accordion ? 'tabpanel' : void 0 + }, children); + })); +}); +const Panel = CollapsePanel; +var useItems_excluded = [ + "children", + "label", + "key", + "collapsible", + "onItemClick", + "destroyInactivePanel" +]; +var useItems_convertItemsToNodes = function(items, props) { + var prefixCls = props.prefixCls, accordion = props.accordion, collapsible = props.collapsible, destroyInactivePanel = props.destroyInactivePanel, onItemClick = props.onItemClick, activeKey = props.activeKey, openMotion = props.openMotion, expandIcon = props.expandIcon; + return items.map(function(item, index) { + var children = item.children, label = item.label, rawKey = item.key, rawCollapsible = item.collapsible, rawOnItemClick = item.onItemClick, rawDestroyInactivePanel = item.destroyInactivePanel, restProps = objectWithoutProperties_objectWithoutProperties(item, useItems_excluded); + var key = String(null != rawKey ? rawKey : index); + var mergeCollapsible = null != rawCollapsible ? rawCollapsible : collapsible; + var mergeDestroyInactivePanel = null != rawDestroyInactivePanel ? rawDestroyInactivePanel : destroyInactivePanel; + var handleItemClick = function(value) { + if ('disabled' === mergeCollapsible) return; + onItemClick(value); + null == rawOnItemClick || rawOnItemClick(value); + }; + var isActive = false; + isActive = accordion ? activeKey[0] === key : activeKey.indexOf(key) > -1; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement(Panel, _extends({}, restProps, { + prefixCls: prefixCls, + key: key, + panelKey: key, + isActive: isActive, + accordion: accordion, + openMotion: openMotion, + expandIcon: expandIcon, + header: label, + collapsible: mergeCollapsible, + onItemClick: handleItemClick, + destroyInactivePanel: mergeDestroyInactivePanel + }), children); + }); +}; +var useItems_getNewChild = function(child, index, props) { + if (!child) return null; + var prefixCls = props.prefixCls, accordion = props.accordion, collapsible = props.collapsible, destroyInactivePanel = props.destroyInactivePanel, onItemClick = props.onItemClick, activeKey = props.activeKey, openMotion = props.openMotion, expandIcon = props.expandIcon; + var key = child.key || String(index); + var _child$props = child.props, header = _child$props.header, headerClass = _child$props.headerClass, childDestroyInactivePanel = _child$props.destroyInactivePanel, childCollapsible = _child$props.collapsible, childOnItemClick = _child$props.onItemClick; + var isActive = false; + isActive = accordion ? activeKey[0] === key : activeKey.indexOf(key) > -1; + var mergeCollapsible = null != childCollapsible ? childCollapsible : collapsible; + var handleItemClick = function(value) { + if ('disabled' === mergeCollapsible) return; + onItemClick(value); + null == childOnItemClick || childOnItemClick(value); + }; + var childProps = { + key: key, + panelKey: key, + header: header, + headerClass: headerClass, + isActive: isActive, + prefixCls: prefixCls, + destroyInactivePanel: null != childDestroyInactivePanel ? childDestroyInactivePanel : destroyInactivePanel, + openMotion: openMotion, + accordion: accordion, + children: child.props.children, + onItemClick: handleItemClick, + expandIcon: expandIcon, + collapsible: mergeCollapsible + }; + if ('string' == typeof child.type) return child; + Object.keys(childProps).forEach(function(propName) { + if (void 0 === childProps[propName]) delete childProps[propName]; + }); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].cloneElement(child, childProps); +}; +function useItems_useItems(items, rawChildren, props) { + if (Array.isArray(items)) return useItems_convertItemsToNodes(items, props); + return toArray(rawChildren).map(function(child, index) { + return useItems_getNewChild(child, index, props); + }); +} +const useItems = useItems_useItems; +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]+/); +var ariaPrefix = 'aria-'; +var dataPrefix = 'data-'; +function pickAttrs_match(key, prefix) { + return 0 === key.indexOf(prefix); +} +function pickAttrs(props) { + var ariaOnly = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : false; + var mergedConfig; + mergedConfig = false === ariaOnly ? { + aria: true, + data: true, + attr: true + } : true === ariaOnly ? { + aria: true + } : objectSpread2_objectSpread2({}, ariaOnly); + var attrs = {}; + Object.keys(props).forEach(function(key) { + if (mergedConfig.aria && ('role' === key || pickAttrs_match(key, ariaPrefix)) || mergedConfig.data && pickAttrs_match(key, dataPrefix) || mergedConfig.attr && propList.includes(key)) attrs[key] = props[key]; + }); + return attrs; +} +function getActiveKeysArray(activeKey) { + var currentActiveKey = activeKey; + if (!Array.isArray(currentActiveKey)) { + var activeKeyType = typeof_typeof(currentActiveKey); + currentActiveKey = 'number' === activeKeyType || 'string' === activeKeyType ? [ + currentActiveKey + ] : []; + } + return currentActiveKey.map(function(key) { + return String(key); + }); +} +var Collapse_Collapse = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].forwardRef(function(props, ref) { + var _props$prefixCls = props.prefixCls, prefixCls = void 0 === _props$prefixCls ? 'rc-collapse' : _props$prefixCls, _props$destroyInactiv = props.destroyInactivePanel, destroyInactivePanel = void 0 === _props$destroyInactiv ? false : _props$destroyInactiv, style = props.style, accordion = props.accordion, className = props.className, children = props.children, collapsible = props.collapsible, openMotion = props.openMotion, expandIcon = props.expandIcon, rawActiveKey = props.activeKey, defaultActiveKey = props.defaultActiveKey, _onChange = props.onChange, items = props.items; + var collapseClassName = classnames_default()(prefixCls, className); + var _useMergedState = useMergedState([], { + value: rawActiveKey, + onChange: function(v) { + return null == _onChange ? void 0 : _onChange(v); + }, + defaultValue: defaultActiveKey, + postState: getActiveKeysArray + }), _useMergedState2 = slicedToArray_slicedToArray(_useMergedState, 2), activeKey = _useMergedState2[0], setActiveKey = _useMergedState2[1]; + var onItemClick = function(key) { + return setActiveKey(function() { + if (accordion) return activeKey[0] === key ? [] : [ + key + ]; + var index = activeKey.indexOf(key); + var isActive = index > -1; + if (isActive) return activeKey.filter(function(item) { + return item !== key; + }); + return [].concat(_toConsumableArray(activeKey), [ + key + ]); + }); + }; + es_warning(!children, '[rc-collapse] `children` will be removed in next major version. Please use `items` instead.'); + var mergedChildren = useItems(items, children, { + prefixCls: prefixCls, + accordion: accordion, + openMotion: openMotion, + expandIcon: expandIcon, + collapsible: collapsible, + destroyInactivePanel: destroyInactivePanel, + onItemClick: onItemClick, + activeKey: activeKey + }); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement("div", _extends({ + ref: ref, + className: collapseClassName, + style: style, + role: accordion ? 'tablist' : void 0 + }, pickAttrs(props, { + aria: true, + data: true + })), mergedChildren); +}); +const Collapse = Object.assign(Collapse_Collapse, { + Panel: Panel +}); +const rc_collapse_es = Collapse; +Collapse.Panel; +function omit(obj, fields) { + var clone = Object.assign({}, obj); + if (Array.isArray(fields)) fields.forEach(function(key) { + delete clone[key]; + }); + return clone; +} +const defaultPrefixCls = 'ant'; +const context_defaultIconPrefixCls = 'anticon'; +const defaultGetPrefixCls = (suffixCls, customizePrefixCls)=>{ + if (customizePrefixCls) return customizePrefixCls; + return suffixCls ? `${defaultPrefixCls}-${suffixCls}` : defaultPrefixCls; +}; +const ConfigContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext({ + getPrefixCls: defaultGetPrefixCls, + iconPrefixCls: context_defaultIconPrefixCls +}); +const { Consumer: ConfigConsumer } = ConfigContext; +const EMPTY_OBJECT = {}; +function useComponentConfig(propName) { + const context = __WEBPACK_EXTERNAL_MODULE_react__.useContext(ConfigContext); + const { getPrefixCls, direction, getPopupContainer } = context; + const propValue = context[propName]; + return Object.assign(Object.assign({ + classNames: EMPTY_OBJECT, + styles: EMPTY_OBJECT + }, propValue), { + getPrefixCls, + direction, + getPopupContainer + }); +} +const getCollapsedHeight = ()=>({ + height: 0, + opacity: 0 + }); +const getRealHeight = (node)=>{ + const { scrollHeight } = node; + return { + height: scrollHeight, + opacity: 1 + }; +}; +const getCurrentHeight = (node)=>({ + height: node ? node.offsetHeight : 0 + }); +const skipOpacityTransition = (_, event)=>(null == event ? void 0 : event.deadline) === true || 'height' === event.propertyName; +const initCollapseMotion = (rootCls = defaultPrefixCls)=>({ + motionName: `${rootCls}-motion-collapse`, + onAppearStart: getCollapsedHeight, + onEnterStart: getCollapsedHeight, + onAppearActive: getRealHeight, + onEnterActive: getRealHeight, + onLeaveStart: getCurrentHeight, + onLeaveActive: getCollapsedHeight, + onAppearEnd: skipOpacityTransition, + onEnterEnd: skipOpacityTransition, + onLeaveEnd: skipOpacityTransition, + motionDeadline: 500 + }); +const _util_motion = initCollapseMotion; +const replaceElement = (element, replacement, props)=>{ + if (!/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].isValidElement(element)) return replacement; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].cloneElement(element, 'function' == typeof props ? props(element.props || {}) : props); +}; +function cloneElement(element, props) { + return replaceElement(element, element, props); +} +function noop() {} +let deprecatedWarnList = null; +function warning_resetWarned() { + deprecatedWarnList = null; + resetWarned(); +} +let _warning = noop; +if ('production' !== process.env.NODE_ENV) _warning = (valid, component, message)=>{ + es_warning(valid, `[antd: ${component}] ${message}`); + if ('test' === process.env.NODE_ENV) warning_resetWarned(); +}; +const _util_warning_warning = _warning; +const WarningContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext({}); +const devUseWarning = 'production' !== process.env.NODE_ENV ? (component)=>{ + const { strict } = __WEBPACK_EXTERNAL_MODULE_react__.useContext(WarningContext); + const typeWarning = (valid, type, message)=>{ + if (!valid) if (false === strict && 'deprecated' === type) { + const existWarning = deprecatedWarnList; + if (!deprecatedWarnList) deprecatedWarnList = {}; + deprecatedWarnList[component] = deprecatedWarnList[component] || []; + if (!deprecatedWarnList[component].includes(message || '')) deprecatedWarnList[component].push(message || ''); + if (!existWarning) console.warn('[antd] There exists deprecated usage in your code:', deprecatedWarnList); + } else "production" !== process.env.NODE_ENV && _util_warning_warning(valid, component, message); + }; + typeWarning.deprecated = (valid, oldProp, newProp, message)=>{ + typeWarning(valid, 'deprecated', `\`${oldProp}\` is deprecated. Please use \`${newProp}\` instead.${message ? ` ${message}` : ''}`); + }; + return typeWarning; +} : ()=>{ + const noopWarning = ()=>{}; + noopWarning.deprecated = noop; + return noopWarning; +}; +const _util_warning = _util_warning_warning; +"use client"; +const SizeContext_SizeContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext(void 0); +const SizeContextProvider = ({ children, size })=>{ + const originSize = __WEBPACK_EXTERNAL_MODULE_react__.useContext(SizeContext_SizeContext); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(SizeContext_SizeContext.Provider, { + value: size || originSize + }, children); +}; +const SizeContext = SizeContext_SizeContext; +const useSize = (customSize)=>{ + const size = __WEBPACK_EXTERNAL_MODULE_react__["default"].useContext(SizeContext); + const mergedSize = __WEBPACK_EXTERNAL_MODULE_react__["default"].useMemo(()=>{ + if (!customSize) return size; + if ('string' == typeof customSize) return null != customSize ? customSize : size; + if ('function' == typeof customSize) return customSize(size); + return size; + }, [ + customSize, + size + ]); + return mergedSize; +}; +const hooks_useSize = useSize; +"use client"; +const CollapsePanel_CollapsePanel = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef((props, ref)=>{ + if ('production' !== process.env.NODE_ENV) { + const warning = devUseWarning('Collapse.Panel'); + warning.deprecated(!('disabled' in props), 'disabled', 'collapsible="disabled"'); + } + const { getPrefixCls } = __WEBPACK_EXTERNAL_MODULE_react__.useContext(ConfigContext); + const { prefixCls: customizePrefixCls, className, showArrow = true } = props; + const prefixCls = getPrefixCls('collapse', customizePrefixCls); + const collapsePanelClassName = classnames_default()({ + [`${prefixCls}-no-arrow`]: !showArrow + }, className); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(rc_collapse_es.Panel, Object.assign({ + ref: ref + }, props, { + prefixCls: prefixCls, + className: collapsePanelClassName + })); +}); +const collapse_CollapsePanel = CollapsePanel_CollapsePanel; +function murmur2(str) { + var h = 0; + var k, i = 0, len = str.length; + for(; len >= 4; ++i, len -= 4){ + k = 0xff & str.charCodeAt(i) | (0xff & str.charCodeAt(++i)) << 8 | (0xff & str.charCodeAt(++i)) << 16 | (0xff & str.charCodeAt(++i)) << 24; + k = (0xffff & k) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16); + k ^= k >>> 24; + h = (0xffff & k) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^ (0xffff & h) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); + } + switch(len){ + case 3: + h ^= (0xff & str.charCodeAt(i + 2)) << 16; + case 2: + h ^= (0xff & str.charCodeAt(i + 1)) << 8; + case 1: + h ^= 0xff & str.charCodeAt(i); + h = (0xffff & h) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); + } + h ^= h >>> 13; + h = (0xffff & h) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); + return ((h ^ h >>> 15) >>> 0).toString(36); +} +const hash_browser_esm = murmur2; +function isEqual_isEqual(obj1, obj2) { + var shallow = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : false; + var refSet = new Set(); + function deepEqual(a, b) { + var level = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1; + var circular = refSet.has(a); + es_warning(!circular, 'Warning: There may be circular references'); + if (circular) return false; + if (a === b) return true; + if (shallow && level > 1) return false; + refSet.add(a); + var newLevel = level + 1; + if (Array.isArray(a)) { + if (!Array.isArray(b) || a.length !== b.length) return false; + for(var i = 0; i < a.length; i++)if (!deepEqual(a[i], b[i], newLevel)) return false; + return true; + } + if (a && b && 'object' === typeof_typeof(a) && 'object' === typeof_typeof(b)) { + var keys = Object.keys(a); + if (keys.length !== Object.keys(b).length) return false; + return keys.every(function(key) { + return deepEqual(a[key], b[key], newLevel); + }); + } + return false; + } + return deepEqual(obj1, obj2); +} +const es_isEqual = isEqual_isEqual; +var SPLIT = '%'; +function pathKey(keys) { + return keys.join(SPLIT); +} +var Cache_Entity = /*#__PURE__*/ function() { + function Entity(instanceId) { + classCallCheck_classCallCheck(this, Entity); + defineProperty_defineProperty(this, "instanceId", void 0); + defineProperty_defineProperty(this, "cache", new Map()); + this.instanceId = instanceId; + } + createClass_createClass(Entity, [ + { + key: "get", + value: function(keys) { + return this.opGet(pathKey(keys)); + } + }, + { + key: "opGet", + value: function(keyPathStr) { + return this.cache.get(keyPathStr) || null; + } + }, + { + key: "update", + value: function(keys, valueFn) { + return this.opUpdate(pathKey(keys), valueFn); + } + }, + { + key: "opUpdate", + value: function(keyPathStr, valueFn) { + var prevValue = this.cache.get(keyPathStr); + var nextValue = valueFn(prevValue); + if (null === nextValue) this.cache.delete(keyPathStr); + else this.cache.set(keyPathStr, nextValue); + } + } + ]); + return Entity; +}(); +const Cache = Cache_Entity; +var ATTR_TOKEN = 'data-token-hash'; +var ATTR_MARK = 'data-css-hash'; +var ATTR_CACHE_PATH = 'data-cache-path'; +var CSS_IN_JS_INSTANCE = '__cssinjs_instance__'; +function createCache() { + var cssinjsInstanceId = Math.random().toString(12).slice(2); + if ('undefined' != typeof document && document.head && document.body) { + var styles = document.body.querySelectorAll("style[".concat(ATTR_MARK, "]")) || []; + var firstChild = document.head.firstChild; + Array.from(styles).forEach(function(style) { + style[CSS_IN_JS_INSTANCE] = style[CSS_IN_JS_INSTANCE] || cssinjsInstanceId; + if (style[CSS_IN_JS_INSTANCE] === cssinjsInstanceId) document.head.insertBefore(style, firstChild); + }); + var styleHash = {}; + Array.from(document.querySelectorAll("style[".concat(ATTR_MARK, "]"))).forEach(function(style) { + var hash = style.getAttribute(ATTR_MARK); + if (styleHash[hash]) { + if (style[CSS_IN_JS_INSTANCE] === cssinjsInstanceId) { + var _style$parentNode; + null == (_style$parentNode = style.parentNode) || _style$parentNode.removeChild(style); + } + } else styleHash[hash] = true; + }); + } + return new Cache(cssinjsInstanceId); +} +var StyleContext_StyleContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext({ + hashPriority: 'low', + cache: createCache(), + defaultCache: true +}); +const StyleContext = StyleContext_StyleContext; +var CALC_UNIT = 'CALC_UNIT'; +new RegExp(CALC_UNIT, 'g'); +function sameDerivativeOption(left, right) { + if (left.length !== right.length) return false; + for(var i = 0; i < left.length; i++)if (left[i] !== right[i]) return false; + return true; +} +var ThemeCache_ThemeCache = /*#__PURE__*/ function() { + function ThemeCache() { + classCallCheck_classCallCheck(this, ThemeCache); + defineProperty_defineProperty(this, "cache", void 0); + defineProperty_defineProperty(this, "keys", void 0); + defineProperty_defineProperty(this, "cacheCallTimes", void 0); + this.cache = new Map(); + this.keys = []; + this.cacheCallTimes = 0; + } + createClass_createClass(ThemeCache, [ + { + key: "size", + value: function() { + return this.keys.length; + } + }, + { + key: "internalGet", + value: function(derivativeOption) { + var _cache2, _cache3; + var updateCallTimes = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : false; + var cache = { + map: this.cache + }; + derivativeOption.forEach(function(derivative) { + if (cache) { + var _cache; + cache = null == (_cache = cache) || null == (_cache = _cache.map) ? void 0 : _cache.get(derivative); + } else cache = void 0; + }); + if (null != (_cache2 = cache) && _cache2.value && updateCallTimes) cache.value[1] = this.cacheCallTimes++; + return null == (_cache3 = cache) ? void 0 : _cache3.value; + } + }, + { + key: "get", + value: function(derivativeOption) { + var _this$internalGet; + return null == (_this$internalGet = this.internalGet(derivativeOption, true)) ? void 0 : _this$internalGet[0]; + } + }, + { + key: "has", + value: function(derivativeOption) { + return !!this.internalGet(derivativeOption); + } + }, + { + key: "set", + value: function(derivativeOption, value) { + var _this = this; + if (!this.has(derivativeOption)) { + if (this.size() + 1 > ThemeCache.MAX_CACHE_SIZE + ThemeCache.MAX_CACHE_OFFSET) { + var _this$keys$reduce = this.keys.reduce(function(result, key) { + var _result = slicedToArray_slicedToArray(result, 2), callTimes = _result[1]; + if (_this.internalGet(key)[1] < callTimes) return [ + key, + _this.internalGet(key)[1] + ]; + return result; + }, [ + this.keys[0], + this.cacheCallTimes + ]), _this$keys$reduce2 = slicedToArray_slicedToArray(_this$keys$reduce, 1), targetKey = _this$keys$reduce2[0]; + this.delete(targetKey); + } + this.keys.push(derivativeOption); + } + var cache = this.cache; + derivativeOption.forEach(function(derivative, index) { + if (index === derivativeOption.length - 1) cache.set(derivative, { + value: [ + value, + _this.cacheCallTimes++ + ] + }); + else { + var cacheValue = cache.get(derivative); + if (cacheValue) { + if (!cacheValue.map) cacheValue.map = new Map(); + } else cache.set(derivative, { + map: new Map() + }); + cache = cache.get(derivative).map; + } + }); + } + }, + { + key: "deleteByPath", + value: function(currentCache, derivatives) { + var cache = currentCache.get(derivatives[0]); + if (1 === derivatives.length) { + var _cache$value; + if (cache.map) currentCache.set(derivatives[0], { + map: cache.map + }); + else currentCache.delete(derivatives[0]); + return null == (_cache$value = cache.value) ? void 0 : _cache$value[0]; + } + var result = this.deleteByPath(cache.map, derivatives.slice(1)); + if ((!cache.map || 0 === cache.map.size) && !cache.value) currentCache.delete(derivatives[0]); + return result; + } + }, + { + key: "delete", + value: function(derivativeOption) { + if (this.has(derivativeOption)) { + this.keys = this.keys.filter(function(item) { + return !sameDerivativeOption(item, derivativeOption); + }); + return this.deleteByPath(this.cache, derivativeOption); + } + } + } + ]); + return ThemeCache; +}(); +defineProperty_defineProperty(ThemeCache_ThemeCache, "MAX_CACHE_SIZE", 20); +defineProperty_defineProperty(ThemeCache_ThemeCache, "MAX_CACHE_OFFSET", 5); +var uuid = 0; +var Theme_Theme = /*#__PURE__*/ function() { + function Theme(derivatives) { + classCallCheck_classCallCheck(this, Theme); + defineProperty_defineProperty(this, "derivatives", void 0); + defineProperty_defineProperty(this, "id", void 0); + this.derivatives = Array.isArray(derivatives) ? derivatives : [ + derivatives + ]; + this.id = uuid; + if (0 === derivatives.length) warning_warning(derivatives.length > 0, '[Ant Design CSS-in-JS] Theme should have at least one derivative function.'); + uuid += 1; + } + createClass_createClass(Theme, [ + { + key: "getDerivativeToken", + value: function(token) { + return this.derivatives.reduce(function(result, derivative) { + return derivative(token, result); + }, void 0); + } + } + ]); + return Theme; +}(); +var cacheThemes = new ThemeCache_ThemeCache(); +function createTheme(derivatives) { + var derivativeArr = Array.isArray(derivatives) ? derivatives : [ + derivatives + ]; + if (!cacheThemes.has(derivativeArr)) cacheThemes.set(derivativeArr, new Theme_Theme(derivativeArr)); + return cacheThemes.get(derivativeArr); +} +var resultCache = new WeakMap(); +var RESULT_VALUE = {}; +function memoResult(callback, deps) { + var current = resultCache; + for(var i = 0; i < deps.length; i += 1){ + var dep = deps[i]; + if (!current.has(dep)) current.set(dep, new WeakMap()); + current = current.get(dep); + } + if (!current.has(RESULT_VALUE)) current.set(RESULT_VALUE, callback()); + return current.get(RESULT_VALUE); +} +var flattenTokenCache = new WeakMap(); +function flattenToken(token) { + var str = flattenTokenCache.get(token) || ''; + if (!str) { + Object.keys(token).forEach(function(key) { + var value = token[key]; + str += key; + if (value instanceof Theme_Theme) str += value.id; + else if (value && 'object' === typeof_typeof(value)) str += flattenToken(value); + else str += value; + }); + str = hash_browser_esm(str); + flattenTokenCache.set(token, str); + } + return str; +} +function token2key(token, salt) { + return hash_browser_esm("".concat(salt, "_").concat(flattenToken(token))); +} +"random-".concat(Date.now(), "-").concat(Math.random()).replace(/\./g, ''); +var isClientSide = canUseDom_canUseDom(); +function util_unit(num) { + if ('number' == typeof num) return "".concat(num, "px"); + return num; +} +function util_toStyleStr(style, tokenKey, styleId) { + var _objectSpread2; + var customizeAttrs = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {}; + var plain = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : false; + if (plain) return style; + var attrs = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, customizeAttrs), {}, (_objectSpread2 = {}, defineProperty_defineProperty(_objectSpread2, ATTR_TOKEN, tokenKey), defineProperty_defineProperty(_objectSpread2, ATTR_MARK, styleId), _objectSpread2)); + var attrStr = Object.keys(attrs).map(function(attr) { + var val = attrs[attr]; + return val ? "".concat(attr, "=\"").concat(val, "\"") : null; + }).filter(function(v) { + return v; + }).join(' '); + return ""); +} +var css_variables_token2CSSVar = function(token) { + var prefix = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : ''; + return "--".concat(prefix ? "".concat(prefix, "-") : '').concat(token).replace(/([a-z0-9])([A-Z])/g, '$1-$2').replace(/([A-Z]+)([A-Z][a-z0-9]+)/g, '$1-$2').replace(/([a-z])([A-Z0-9])/g, '$1-$2').toLowerCase(); +}; +var css_variables_serializeCSSVar = function(cssVars, hashId, options) { + if (!Object.keys(cssVars).length) return ''; + return ".".concat(hashId).concat(null != options && options.scope ? ".".concat(options.scope) : '', "{").concat(Object.entries(cssVars).map(function(_ref) { + var _ref2 = slicedToArray_slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1]; + return "".concat(key, ":").concat(value, ";"); + }).join(''), "}"); +}; +var css_variables_transformToken = function(token, themeKey, config) { + var cssVars = {}; + var result = {}; + Object.entries(token).forEach(function(_ref3) { + var _config$preserve, _config$ignore; + var _ref4 = slicedToArray_slicedToArray(_ref3, 2), key = _ref4[0], value = _ref4[1]; + if (null != config && null != (_config$preserve = config.preserve) && _config$preserve[key]) result[key] = value; + else if (('string' == typeof value || 'number' == typeof value) && !(null != config && null != (_config$ignore = config.ignore) && _config$ignore[key])) { + var _config$unitless; + var cssVar = css_variables_token2CSSVar(key, null == config ? void 0 : config.prefix); + cssVars[cssVar] = 'number' != typeof value || null != config && null != (_config$unitless = config.unitless) && _config$unitless[key] ? String(value) : "".concat(value, "px"); + result[key] = "var(".concat(cssVar, ")"); + } + }); + return [ + result, + css_variables_serializeCSSVar(cssVars, themeKey, { + scope: null == config ? void 0 : config.scope + }) + ]; +}; +var fullClone = objectSpread2_objectSpread2({}, __WEBPACK_EXTERNAL_MODULE_react__); +var useInsertionEffect = fullClone.useInsertionEffect; +var useCompatibleInsertionEffect_useInsertionEffectPolyfill = function(renderEffect, effect, deps) { + __WEBPACK_EXTERNAL_MODULE_react__.useMemo(renderEffect, deps); + hooks_useLayoutEffect(function() { + return effect(true); + }, deps); +}; +var useCompatibleInsertionEffect = useInsertionEffect ? function(renderEffect, effect, deps) { + return useInsertionEffect(function() { + renderEffect(); + return effect(); + }, deps); +} : useCompatibleInsertionEffect_useInsertionEffectPolyfill; +const hooks_useCompatibleInsertionEffect = useCompatibleInsertionEffect; +var useEffectCleanupRegister_fullClone = objectSpread2_objectSpread2({}, __WEBPACK_EXTERNAL_MODULE_react__); +var useEffectCleanupRegister_useInsertionEffect = useEffectCleanupRegister_fullClone.useInsertionEffect; +var useEffectCleanupRegister_useCleanupRegister = function(deps) { + var effectCleanups = []; + var cleanupFlag = false; + function register(fn) { + if (cleanupFlag) { + if ('production' !== process.env.NODE_ENV) warning_warning(false, '[Ant Design CSS-in-JS] You are registering a cleanup function after unmount, which will not have any effect.'); + return; + } + effectCleanups.push(fn); + } + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(function() { + cleanupFlag = false; + return function() { + cleanupFlag = true; + if (effectCleanups.length) effectCleanups.forEach(function(fn) { + return fn(); + }); + }; + }, deps); + return register; +}; +var useEffectCleanupRegister_useRun = function() { + return function(fn) { + fn(); + }; +}; +var useEffectCleanupRegister_useEffectCleanupRegister = void 0 !== useEffectCleanupRegister_useInsertionEffect ? useEffectCleanupRegister_useCleanupRegister : useEffectCleanupRegister_useRun; +const useEffectCleanupRegister = useEffectCleanupRegister_useEffectCleanupRegister; +var useHMR = __webpack_require__("./node_modules/.pnpm/@ant-design+cssinjs@1.23.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@ant-design/cssinjs/es/hooks/useHMR.js"); +function useGlobalCache(prefix, keyPath, cacheFn, onCacheRemove, onCacheEffect) { + var _React$useContext = __WEBPACK_EXTERNAL_MODULE_react__.useContext(StyleContext), globalCache = _React$useContext.cache; + var fullPath = [ + prefix + ].concat(_toConsumableArray(keyPath)); + var fullPathStr = pathKey(fullPath); + var register = useEffectCleanupRegister([ + fullPathStr + ]); + var HMRUpdate = (0, useHMR.Z)(); + var buildCache = function(updater) { + globalCache.opUpdate(fullPathStr, function(prevCache) { + var _ref = prevCache || [ + void 0, + void 0 + ], _ref2 = slicedToArray_slicedToArray(_ref, 2), _ref2$ = _ref2[0], times = void 0 === _ref2$ ? 0 : _ref2$, cache = _ref2[1]; + var tmpCache = cache; + if ('production' !== process.env.NODE_ENV && cache && HMRUpdate) { + null == onCacheRemove || onCacheRemove(tmpCache, HMRUpdate); + tmpCache = null; + } + var mergedCache = tmpCache || cacheFn(); + var data = [ + times, + mergedCache + ]; + return updater ? updater(data) : data; + }); + }; + __WEBPACK_EXTERNAL_MODULE_react__.useMemo(function() { + buildCache(); + }, [ + fullPathStr + ]); + var cacheEntity = globalCache.opGet(fullPathStr); + if ('production' !== process.env.NODE_ENV && !cacheEntity) { + buildCache(); + cacheEntity = globalCache.opGet(fullPathStr); + } + var cacheContent = cacheEntity[1]; + hooks_useCompatibleInsertionEffect(function() { + null == onCacheEffect || onCacheEffect(cacheContent); + }, function(polyfill) { + buildCache(function(_ref3) { + var _ref4 = slicedToArray_slicedToArray(_ref3, 2), times = _ref4[0], cache = _ref4[1]; + if (polyfill && 0 === times) null == onCacheEffect || onCacheEffect(cacheContent); + return [ + times + 1, + cache + ]; + }); + return function() { + globalCache.opUpdate(fullPathStr, function(prevCache) { + var _ref5 = prevCache || [], _ref6 = slicedToArray_slicedToArray(_ref5, 2), _ref6$ = _ref6[0], times = void 0 === _ref6$ ? 0 : _ref6$, cache = _ref6[1]; + var nextCount = times - 1; + if (0 === nextCount) { + register(function() { + if (polyfill || !globalCache.opGet(fullPathStr)) null == onCacheRemove || onCacheRemove(cache, false); + }); + return null; + } + return [ + times - 1, + cache + ]; + }); + }; + }, [ + fullPathStr + ]); + return cacheContent; +} +var EMPTY_OVERRIDE = {}; +var hashPrefix = 'production' !== process.env.NODE_ENV ? 'css-dev-only-do-not-override' : 'css'; +var useCacheToken_tokenKeys = new Map(); +function recordCleanToken(tokenKey) { + useCacheToken_tokenKeys.set(tokenKey, (useCacheToken_tokenKeys.get(tokenKey) || 0) + 1); +} +function removeStyleTags(key, instanceId) { + if ('undefined' != typeof document) { + var styles = document.querySelectorAll("style[".concat(ATTR_TOKEN, "=\"").concat(key, "\"]")); + styles.forEach(function(style) { + if (style[CSS_IN_JS_INSTANCE] === instanceId) { + var _style$parentNode; + null == (_style$parentNode = style.parentNode) || _style$parentNode.removeChild(style); + } + }); + } +} +var TOKEN_THRESHOLD = 0; +function cleanTokenStyle(tokenKey, instanceId) { + useCacheToken_tokenKeys.set(tokenKey, (useCacheToken_tokenKeys.get(tokenKey) || 0) - 1); + var tokenKeyList = Array.from(useCacheToken_tokenKeys.keys()); + var cleanableKeyList = tokenKeyList.filter(function(key) { + var count = useCacheToken_tokenKeys.get(key) || 0; + return count <= 0; + }); + if (tokenKeyList.length - cleanableKeyList.length > TOKEN_THRESHOLD) cleanableKeyList.forEach(function(key) { + removeStyleTags(key, instanceId); + useCacheToken_tokenKeys.delete(key); + }); +} +var useCacheToken_getComputedToken = function(originToken, overrideToken, theme, format) { + var derivativeToken = theme.getDerivativeToken(originToken); + var mergedDerivativeToken = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, derivativeToken), overrideToken); + if (format) mergedDerivativeToken = format(mergedDerivativeToken); + return mergedDerivativeToken; +}; +var TOKEN_PREFIX = 'token'; +function useCacheToken(theme, tokens) { + var option = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}; + var _useContext = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(StyleContext), instanceId = _useContext.cache.instanceId, container = _useContext.container; + var _option$salt = option.salt, salt = void 0 === _option$salt ? '' : _option$salt, _option$override = option.override, override = void 0 === _option$override ? EMPTY_OVERRIDE : _option$override, formatToken = option.formatToken, compute = option.getComputedToken, cssVar = option.cssVar; + var mergedToken = memoResult(function() { + return Object.assign.apply(Object, [ + {} + ].concat(_toConsumableArray(tokens))); + }, tokens); + var tokenStr = flattenToken(mergedToken); + var overrideTokenStr = flattenToken(override); + var cssVarStr = cssVar ? flattenToken(cssVar) : ''; + var cachedToken = useGlobalCache(TOKEN_PREFIX, [ + salt, + theme.id, + tokenStr, + overrideTokenStr, + cssVarStr + ], function() { + var _cssVar$key; + var mergedDerivativeToken = compute ? compute(mergedToken, override, theme) : useCacheToken_getComputedToken(mergedToken, override, theme, formatToken); + var actualToken = objectSpread2_objectSpread2({}, mergedDerivativeToken); + var cssVarsStr = ''; + if (!!cssVar) { + var _transformToken = css_variables_transformToken(mergedDerivativeToken, cssVar.key, { + prefix: cssVar.prefix, + ignore: cssVar.ignore, + unitless: cssVar.unitless, + preserve: cssVar.preserve + }); + var _transformToken2 = slicedToArray_slicedToArray(_transformToken, 2); + mergedDerivativeToken = _transformToken2[0]; + cssVarsStr = _transformToken2[1]; + } + var tokenKey = token2key(mergedDerivativeToken, salt); + mergedDerivativeToken._tokenKey = tokenKey; + actualToken._tokenKey = token2key(actualToken, salt); + var themeKey = null != (_cssVar$key = null == cssVar ? void 0 : cssVar.key) ? _cssVar$key : tokenKey; + mergedDerivativeToken._themeKey = themeKey; + recordCleanToken(themeKey); + var hashId = "".concat(hashPrefix, "-").concat(hash_browser_esm(tokenKey)); + mergedDerivativeToken._hashId = hashId; + return [ + mergedDerivativeToken, + hashId, + actualToken, + cssVarsStr, + (null == cssVar ? void 0 : cssVar.key) || '' + ]; + }, function(cache) { + cleanTokenStyle(cache[0]._themeKey, instanceId); + }, function(_ref) { + var _ref2 = slicedToArray_slicedToArray(_ref, 4), token = _ref2[0], cssVarsStr = _ref2[3]; + if (cssVar && cssVarsStr) { + var style = dynamicCSS_updateCSS(cssVarsStr, hash_browser_esm("css-variables-".concat(token._themeKey)), { + mark: ATTR_MARK, + prepend: 'queue', + attachTo: container, + priority: -999 + }); + style[CSS_IN_JS_INSTANCE] = instanceId; + style.setAttribute(ATTR_TOKEN, token._themeKey); + } + }); + return cachedToken; +} +var useCacheToken_extract = function(cache, effectStyles, options) { + var _cache = slicedToArray_slicedToArray(cache, 5), realToken = _cache[2], styleStr = _cache[3], cssVarKey = _cache[4]; + var _ref3 = options || {}, plain = _ref3.plain; + if (!styleStr) return null; + var styleId = realToken._tokenKey; + var order = -999; + var sharedAttrs = { + 'data-rc-order': 'prependQueue', + 'data-rc-priority': "".concat(order) + }; + var styleText = util_toStyleStr(styleStr, cssVarKey, styleId, sharedAttrs, plain); + return [ + order, + styleId, + styleText + ]; +}; +var unitlessKeys = { + animationIterationCount: 1, + borderImageOutset: 1, + borderImageSlice: 1, + borderImageWidth: 1, + boxFlex: 1, + boxFlexGroup: 1, + boxOrdinalGroup: 1, + columnCount: 1, + columns: 1, + flex: 1, + flexGrow: 1, + flexPositive: 1, + flexShrink: 1, + flexNegative: 1, + flexOrder: 1, + gridRow: 1, + gridRowEnd: 1, + gridRowSpan: 1, + gridRowStart: 1, + gridColumn: 1, + gridColumnEnd: 1, + gridColumnSpan: 1, + gridColumnStart: 1, + msGridRow: 1, + msGridRowSpan: 1, + msGridColumn: 1, + msGridColumnSpan: 1, + fontWeight: 1, + lineHeight: 1, + opacity: 1, + order: 1, + orphans: 1, + tabSize: 1, + widows: 1, + zIndex: 1, + zoom: 1, + WebkitLineClamp: 1, + fillOpacity: 1, + floodOpacity: 1, + stopOpacity: 1, + strokeDasharray: 1, + strokeDashoffset: 1, + strokeMiterlimit: 1, + strokeOpacity: 1, + strokeWidth: 1 +}; +const unitless_browser_esm = unitlessKeys; +var COMMENT = 'comm'; +var RULESET = 'rule'; +var DECLARATION = 'decl'; +var IMPORT = '@import'; +var KEYFRAMES = '@keyframes'; +var LAYER = '@layer'; +var abs = Math.abs; +var Utility_from = String.fromCharCode; +function trim(value) { + return value.trim(); +} +function replace(value, pattern, replacement) { + return value.replace(pattern, replacement); +} +function indexof(value, search, position) { + return value.indexOf(search, position); +} +function charat(value, index) { + return 0 | value.charCodeAt(index); +} +function substr(value, begin, end) { + return value.slice(begin, end); +} +function strlen(value) { + return value.length; +} +function sizeof(value) { + return value.length; +} +function Utility_append(value, array) { + return array.push(value), value; +} +function serialize(children, callback) { + var output = ''; + for(var i = 0; i < children.length; i++)output += callback(children[i], i, children, callback) || ''; + return output; +} +function stringify(element, index, children, callback) { + switch(element.type){ + case LAYER: + if (element.children.length) break; + case IMPORT: + case DECLARATION: + return element.return = element.return || element.value; + case COMMENT: + return ''; + case KEYFRAMES: + return element.return = element.value + '{' + serialize(element.children, callback) + '}'; + case RULESET: + if (!strlen(element.value = element.props.join(','))) return ''; + } + return strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''; +} +var line = 1; +var column = 1; +var Tokenizer_length = 0; +var Tokenizer_position = 0; +var Tokenizer_character = 0; +var Tokenizer_characters = ''; +function Tokenizer_node(value, root, parent, type, props, children, length, siblings) { + return { + value: value, + root: root, + parent: parent, + type: type, + props: props, + children: children, + line: line, + column: column, + length: length, + return: '', + siblings: siblings + }; +} +function Tokenizer_char() { + return Tokenizer_character; +} +function Tokenizer_prev() { + Tokenizer_character = Tokenizer_position > 0 ? charat(Tokenizer_characters, --Tokenizer_position) : 0; + if (column--, 10 === Tokenizer_character) column = 1, line--; + return Tokenizer_character; +} +function Tokenizer_next() { + Tokenizer_character = Tokenizer_position < Tokenizer_length ? charat(Tokenizer_characters, Tokenizer_position++) : 0; + if (column++, 10 === Tokenizer_character) column = 1, line++; + return Tokenizer_character; +} +function peek() { + return charat(Tokenizer_characters, Tokenizer_position); +} +function caret() { + return Tokenizer_position; +} +function slice(begin, end) { + return substr(Tokenizer_characters, begin, end); +} +function Tokenizer_token(type) { + switch(type){ + case 0: + case 9: + case 10: + case 13: + case 32: + return 5; + case 33: + case 43: + case 44: + case 47: + case 62: + case 64: + case 126: + case 59: + case 123: + case 125: + return 4; + case 58: + return 3; + case 34: + case 39: + case 40: + case 91: + return 2; + case 41: + case 93: + return 1; + } + return 0; +} +function alloc(value) { + return line = column = 1, Tokenizer_length = strlen(Tokenizer_characters = value), Tokenizer_position = 0, []; +} +function dealloc(value) { + return Tokenizer_characters = '', value; +} +function delimit(type) { + return trim(slice(Tokenizer_position - 1, delimiter(91 === type ? type + 2 : 40 === type ? type + 1 : type))); +} +function whitespace(type) { + while(Tokenizer_character = peek())if (Tokenizer_character < 33) Tokenizer_next(); + else break; + return Tokenizer_token(type) > 2 || Tokenizer_token(Tokenizer_character) > 3 ? '' : ' '; +} +function escaping(index, count) { + while(--count && Tokenizer_next())if (Tokenizer_character < 48 || Tokenizer_character > 102 || Tokenizer_character > 57 && Tokenizer_character < 65 || Tokenizer_character > 70 && Tokenizer_character < 97) break; + return slice(index, caret() + (count < 6 && 32 == peek() && 32 == Tokenizer_next())); +} +function delimiter(type) { + while(Tokenizer_next())switch(Tokenizer_character){ + case type: + return Tokenizer_position; + case 34: + case 39: + if (34 !== type && 39 !== type) delimiter(Tokenizer_character); + break; + case 40: + if (41 === type) delimiter(type); + break; + case 92: + Tokenizer_next(); + break; + } + return Tokenizer_position; +} +function commenter(type, index) { + while(Tokenizer_next())if (type + Tokenizer_character === 57) break; + else if (type + Tokenizer_character === 84 && 47 === peek()) break; + return '/*' + slice(index, Tokenizer_position - 1) + '*' + Utility_from(47 === type ? type : Tokenizer_next()); +} +function identifier(index) { + while(!Tokenizer_token(peek()))Tokenizer_next(); + return slice(index, Tokenizer_position); +} +function compile(value) { + return dealloc(parse('', null, null, null, [ + '' + ], value = alloc(value), 0, [ + 0 + ], value)); +} +function parse(value, root, parent, rule, rules, rulesets, pseudo, points, declarations) { + var index = 0; + var offset = 0; + var length = pseudo; + var atrule = 0; + var property = 0; + var previous = 0; + var variable = 1; + var scanning = 1; + var ampersand = 1; + var character = 0; + var type = ''; + var props = rules; + var children = rulesets; + var reference = rule; + var characters = type; + while(scanning)switch(previous = character, character = Tokenizer_next()){ + case 40: + if (108 != previous && 58 == charat(characters, length - 1)) { + if (-1 != indexof(characters += replace(delimit(character), '&', '&\f'), '&\f', abs(index ? points[index - 1] : 0))) ampersand = -1; + break; + } + case 34: + case 39: + case 91: + characters += delimit(character); + break; + case 9: + case 10: + case 13: + case 32: + characters += whitespace(previous); + break; + case 92: + characters += escaping(caret() - 1, 7); + continue; + case 47: + switch(peek()){ + case 42: + case 47: + Utility_append(comment(commenter(Tokenizer_next(), caret()), root, parent, declarations), declarations); + if ((5 == Tokenizer_token(previous || 1) || 5 == Tokenizer_token(peek() || 1)) && strlen(characters) && ' ' !== substr(characters, -1, void 0)) characters += ' '; + break; + default: + characters += '/'; + } + break; + case 123 * variable: + points[index++] = strlen(characters) * ampersand; + case 125 * variable: + case 59: + case 0: + switch(character){ + case 0: + case 125: + scanning = 0; + case 59 + offset: + if (-1 == ampersand) characters = replace(characters, /\f/g, ''); + if (property > 0 && (strlen(characters) - length || 0 === variable && 47 === previous)) Utility_append(property > 32 ? declaration(characters + ';', rule, parent, length - 1, declarations) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2, declarations), declarations); + break; + case 59: + characters += ';'; + default: + Utility_append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length, rulesets), rulesets); + if (123 === character) if (0 === offset) parse(characters, root, reference, reference, props, rulesets, length, points, children); + else switch(99 === atrule && 110 === charat(characters, 3) ? 100 : atrule){ + case 100: + case 108: + case 109: + case 115: + parse(value, reference, reference, rule && Utility_append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length, children), children), rules, children, length, points, rule ? props : children); + break; + default: + parse(characters, reference, reference, reference, [ + '' + ], children, 0, points, children); + } + } + index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo; + break; + case 58: + length = 1 + strlen(characters), property = previous; + default: + if (variable < 1) { + if (123 == character) --variable; + else if (125 == character && 0 == variable++ && 125 == Tokenizer_prev()) continue; + } + switch(characters += Utility_from(character), character * variable){ + case 38: + ampersand = offset > 0 ? 1 : (characters += '\f', -1); + break; + case 44: + points[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1; + break; + case 64: + if (45 === peek()) characters += delimit(Tokenizer_next()); + atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++; + break; + case 45: + if (45 === previous && 2 == strlen(characters)) variable = 0; + } + } + return rulesets; +} +function ruleset(value, root, parent, index, offset, rules, points, type, props, children, length, siblings) { + var post = offset - 1; + var rule = 0 === offset ? rules : [ + '' + ]; + var size = sizeof(rule); + for(var i = 0, j = 0, k = 0; i < index; ++i)for(var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)if (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\f/g, rule[x]))) props[k++] = z; + return Tokenizer_node(value, root, parent, 0 === offset ? RULESET : type, props, children, length, siblings); +} +function comment(value, root, parent, siblings) { + return Tokenizer_node(value, root, parent, COMMENT, Utility_from(Tokenizer_char()), substr(value, 2, -2), 0, siblings); +} +function declaration(value, root, parent, length, siblings) { + return Tokenizer_node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length, siblings); +} +function utils_lintWarning(message, info) { + var path = info.path, parentSelectors = info.parentSelectors; + es_warning(false, "[Ant Design CSS-in-JS] ".concat(path ? "Error in ".concat(path, ": ") : '').concat(message).concat(parentSelectors.length ? " Selector: ".concat(parentSelectors.join(' | ')) : '')); +} +var contentQuotesLinter_linter = function(key, value, info) { + if ('content' === key) { + var contentValuePattern = /(attr|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/; + var contentValues = [ + 'normal', + 'none', + 'initial', + 'inherit', + 'unset' + ]; + if ('string' != typeof value || -1 === contentValues.indexOf(value) && !contentValuePattern.test(value) && (value.charAt(0) !== value.charAt(value.length - 1) || '"' !== value.charAt(0) && "'" !== value.charAt(0))) utils_lintWarning("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"".concat(value, "\"'`."), info); + } +}; +const contentQuotesLinter = contentQuotesLinter_linter; +var hashedAnimationLinter_linter = function(key, value, info) { + if ('animation' === key) { + if (info.hashId && 'none' !== value) utils_lintWarning("You seem to be using hashed animation '".concat(value, "', in which case 'animationName' with Keyframe as value is recommended."), info); + } +}; +const hashedAnimationLinter = hashedAnimationLinter_linter; +var cacheMapUtil_ATTR_CACHE_MAP = 'data-ant-cssinjs-cache-path'; +var CSS_FILE_STYLE = '_FILE_STYLE__'; +var cacheMapUtil_cachePathMap; +var fromCSSFile = true; +function prepare() { + if (!cacheMapUtil_cachePathMap) { + cacheMapUtil_cachePathMap = {}; + if (canUseDom_canUseDom()) { + var div = document.createElement('div'); + div.className = cacheMapUtil_ATTR_CACHE_MAP; + div.style.position = 'fixed'; + div.style.visibility = 'hidden'; + div.style.top = '-9999px'; + document.body.appendChild(div); + var content = getComputedStyle(div).content || ''; + content = content.replace(/^"/, '').replace(/"$/, ''); + content.split(';').forEach(function(item) { + var _item$split = item.split(':'), _item$split2 = slicedToArray_slicedToArray(_item$split, 2), path = _item$split2[0], hash = _item$split2[1]; + cacheMapUtil_cachePathMap[path] = hash; + }); + var inlineMapStyle = document.querySelector("style[".concat(cacheMapUtil_ATTR_CACHE_MAP, "]")); + if (inlineMapStyle) { + var _inlineMapStyle$paren; + fromCSSFile = false; + null == (_inlineMapStyle$paren = inlineMapStyle.parentNode) || _inlineMapStyle$paren.removeChild(inlineMapStyle); + } + document.body.removeChild(div); + } + } +} +function existPath(path) { + prepare(); + return !!cacheMapUtil_cachePathMap[path]; +} +function getStyleAndHash(path) { + var hash = cacheMapUtil_cachePathMap[path]; + var styleStr = null; + if (hash && canUseDom_canUseDom()) if (fromCSSFile) styleStr = CSS_FILE_STYLE; + else { + var _style = document.querySelector("style[".concat(ATTR_MARK, "=\"").concat(cacheMapUtil_cachePathMap[path], "\"]")); + if (_style) styleStr = _style.innerHTML; + else delete cacheMapUtil_cachePathMap[path]; + } + return [ + styleStr, + hash + ]; +} +var SKIP_CHECK = '_skip_check_'; +var MULTI_VALUE = '_multi_value_'; +function normalizeStyle(styleStr) { + var serialized = serialize(compile(styleStr), stringify); + return serialized.replace(/\{%%%\:[^;];}/g, ';'); +} +function isCompoundCSSProperty(value) { + return 'object' === typeof_typeof(value) && value && (SKIP_CHECK in value || MULTI_VALUE in value); +} +function injectSelectorHash(key, hashId, hashPriority) { + if (!hashId) return key; + var hashClassName = ".".concat(hashId); + var hashSelector = 'low' === hashPriority ? ":where(".concat(hashClassName, ")") : hashClassName; + var keys = key.split(',').map(function(k) { + var _firstPath$match; + var fullPath = k.trim().split(/\s+/); + var firstPath = fullPath[0] || ''; + var htmlElement = (null == (_firstPath$match = firstPath.match(/^\w+/)) ? void 0 : _firstPath$match[0]) || ''; + firstPath = "".concat(htmlElement).concat(hashSelector).concat(firstPath.slice(htmlElement.length)); + return [ + firstPath + ].concat(_toConsumableArray(fullPath.slice(1))).join(' '); + }); + return keys.join(','); +} +var useStyleRegister_parseStyle = function parseStyle(interpolation) { + var config = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + var _ref = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : { + root: true, + parentSelectors: [] + }, root = _ref.root, injectHash = _ref.injectHash, parentSelectors = _ref.parentSelectors; + var hashId = config.hashId, layer = config.layer, path = config.path, hashPriority = config.hashPriority, _config$transformers = config.transformers, transformers = void 0 === _config$transformers ? [] : _config$transformers, _config$linters = config.linters, linters = void 0 === _config$linters ? [] : _config$linters; + var styleStr = ''; + var effectStyle = {}; + function parseKeyframes(keyframes) { + var animationName = keyframes.getName(hashId); + if (!effectStyle[animationName]) { + var _parseStyle = parseStyle(keyframes.style, config, { + root: false, + parentSelectors: parentSelectors + }), _parseStyle2 = slicedToArray_slicedToArray(_parseStyle, 1), _parsedStr = _parseStyle2[0]; + effectStyle[animationName] = "@keyframes ".concat(keyframes.getName(hashId)).concat(_parsedStr); + } + } + function flattenList(list) { + var fullList = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : []; + list.forEach(function(item) { + if (Array.isArray(item)) flattenList(item, fullList); + else if (item) fullList.push(item); + }); + return fullList; + } + var flattenStyleList = flattenList(Array.isArray(interpolation) ? interpolation : [ + interpolation + ]); + flattenStyleList.forEach(function(originStyle) { + var style = 'string' != typeof originStyle || root ? originStyle : {}; + if ('string' == typeof style) styleStr += "".concat(style, "\n"); + else if (style._keyframe) parseKeyframes(style); + else { + var mergedStyle = transformers.reduce(function(prev, trans) { + var _trans$visit; + return (null == trans || null == (_trans$visit = trans.visit) ? void 0 : _trans$visit.call(trans, prev)) || prev; + }, style); + Object.keys(mergedStyle).forEach(function(key) { + var value = mergedStyle[key]; + if ('object' !== typeof_typeof(value) || !value || 'animationName' === key && value._keyframe || isCompoundCSSProperty(value)) { + var _value; + function appendStyle(cssKey, cssValue) { + if ('production' !== process.env.NODE_ENV && ('object' !== typeof_typeof(value) || !(null != value && value[SKIP_CHECK]))) [ + contentQuotesLinter, + hashedAnimationLinter + ].concat(_toConsumableArray(linters)).forEach(function(linter) { + return linter(cssKey, cssValue, { + path: path, + hashId: hashId, + parentSelectors: parentSelectors + }); + }); + var styleName = cssKey.replace(/[A-Z]/g, function(match) { + return "-".concat(match.toLowerCase()); + }); + var formatValue = cssValue; + if (!unitless_browser_esm[cssKey] && 'number' == typeof formatValue && 0 !== formatValue) formatValue = "".concat(formatValue, "px"); + if ('animationName' === cssKey && null != cssValue && cssValue._keyframe) { + parseKeyframes(cssValue); + formatValue = cssValue.getName(hashId); + } + styleStr += "".concat(styleName, ":").concat(formatValue, ";"); + } + var actualValue = null != (_value = null == value ? void 0 : value.value) ? _value : value; + if ('object' === typeof_typeof(value) && null != value && value[MULTI_VALUE] && Array.isArray(actualValue)) actualValue.forEach(function(item) { + appendStyle(key, item); + }); + else appendStyle(key, actualValue); + } else { + var subInjectHash = false; + var mergedKey = key.trim(); + var nextRoot = false; + if ((root || injectHash) && hashId) if (mergedKey.startsWith('@')) subInjectHash = true; + else mergedKey = '&' === mergedKey ? injectSelectorHash('', hashId, hashPriority) : injectSelectorHash(key, hashId, hashPriority); + else if (root && !hashId && ('&' === mergedKey || '' === mergedKey)) { + mergedKey = ''; + nextRoot = true; + } + var _parseStyle3 = parseStyle(value, config, { + root: nextRoot, + injectHash: subInjectHash, + parentSelectors: [].concat(_toConsumableArray(parentSelectors), [ + mergedKey + ]) + }), _parseStyle4 = slicedToArray_slicedToArray(_parseStyle3, 2), _parsedStr2 = _parseStyle4[0], childEffectStyle = _parseStyle4[1]; + effectStyle = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, effectStyle), childEffectStyle); + styleStr += "".concat(mergedKey).concat(_parsedStr2); + } + }); + } + }); + if (root) { + if (layer) { + if (styleStr) styleStr = "@layer ".concat(layer.name, " {").concat(styleStr, "}"); + if (layer.dependencies) effectStyle["@layer ".concat(layer.name)] = layer.dependencies.map(function(deps) { + return "@layer ".concat(deps, ", ").concat(layer.name, ";"); + }).join('\n'); + } + } else styleStr = "{".concat(styleStr, "}"); + return [ + styleStr, + effectStyle + ]; +}; +function uniqueHash(path, styleStr) { + return hash_browser_esm("".concat(path.join('%')).concat(styleStr)); +} +function Empty() { + return null; +} +var STYLE_PREFIX = 'style'; +function useStyleRegister(info, styleFn) { + var token = info.token, path = info.path, hashId = info.hashId, layer = info.layer, nonce = info.nonce, clientOnly = info.clientOnly, _info$order = info.order, order = void 0 === _info$order ? 0 : _info$order; + var _React$useContext = __WEBPACK_EXTERNAL_MODULE_react__.useContext(StyleContext), autoClear = _React$useContext.autoClear, mock = _React$useContext.mock, defaultCache = _React$useContext.defaultCache, hashPriority = _React$useContext.hashPriority, container = _React$useContext.container, ssrInline = _React$useContext.ssrInline, transformers = _React$useContext.transformers, linters = _React$useContext.linters, cache = _React$useContext.cache, enableLayer = _React$useContext.layer; + var tokenKey = token._tokenKey; + var fullPath = [ + tokenKey + ]; + if (enableLayer) fullPath.push('layer'); + fullPath.push.apply(fullPath, _toConsumableArray(path)); + var isMergedClientSide = isClientSide; + if ('production' !== process.env.NODE_ENV && void 0 !== mock) isMergedClientSide = 'client' === mock; + var _useGlobalCache = useGlobalCache(STYLE_PREFIX, fullPath, function() { + var cachePath = fullPath.join('|'); + if (existPath(cachePath)) { + var _getStyleAndHash = getStyleAndHash(cachePath), _getStyleAndHash2 = slicedToArray_slicedToArray(_getStyleAndHash, 2), inlineCacheStyleStr = _getStyleAndHash2[0], styleHash = _getStyleAndHash2[1]; + if (inlineCacheStyleStr) return [ + inlineCacheStyleStr, + tokenKey, + styleHash, + {}, + clientOnly, + order + ]; + } + var styleObj = styleFn(); + var _parseStyle5 = useStyleRegister_parseStyle(styleObj, { + hashId: hashId, + hashPriority: hashPriority, + layer: enableLayer ? layer : void 0, + path: path.join('-'), + transformers: transformers, + linters: linters + }), _parseStyle6 = slicedToArray_slicedToArray(_parseStyle5, 2), parsedStyle = _parseStyle6[0], effectStyle = _parseStyle6[1]; + var styleStr = normalizeStyle(parsedStyle); + var styleId = uniqueHash(fullPath, styleStr); + return [ + styleStr, + tokenKey, + styleId, + effectStyle, + clientOnly, + order + ]; + }, function(_ref2, fromHMR) { + var _ref3 = slicedToArray_slicedToArray(_ref2, 3), styleId = _ref3[2]; + if ((fromHMR || autoClear) && isClientSide) dynamicCSS_removeCSS(styleId, { + mark: ATTR_MARK + }); + }, function(_ref4) { + var _ref5 = slicedToArray_slicedToArray(_ref4, 4), styleStr = _ref5[0], styleId = (_ref5[1], _ref5[2]), effectStyle = _ref5[3]; + if (isMergedClientSide && styleStr !== CSS_FILE_STYLE) { + var mergedCSSConfig = { + mark: ATTR_MARK, + prepend: enableLayer ? false : 'queue', + attachTo: container, + priority: order + }; + var nonceStr = 'function' == typeof nonce ? nonce() : nonce; + if (nonceStr) mergedCSSConfig.csp = { + nonce: nonceStr + }; + var effectLayerKeys = []; + var effectRestKeys = []; + Object.keys(effectStyle).forEach(function(key) { + if (key.startsWith('@layer')) effectLayerKeys.push(key); + else effectRestKeys.push(key); + }); + effectLayerKeys.forEach(function(effectKey) { + dynamicCSS_updateCSS(normalizeStyle(effectStyle[effectKey]), "_layer-".concat(effectKey), objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, mergedCSSConfig), {}, { + prepend: true + })); + }); + var style = dynamicCSS_updateCSS(styleStr, styleId, mergedCSSConfig); + style[CSS_IN_JS_INSTANCE] = cache.instanceId; + style.setAttribute(ATTR_TOKEN, tokenKey); + if ('production' !== process.env.NODE_ENV) style.setAttribute(ATTR_CACHE_PATH, fullPath.join('|')); + effectRestKeys.forEach(function(effectKey) { + dynamicCSS_updateCSS(normalizeStyle(effectStyle[effectKey]), "_effect-".concat(effectKey), mergedCSSConfig); + }); + } + }), _useGlobalCache2 = slicedToArray_slicedToArray(_useGlobalCache, 3), cachedStyleStr = _useGlobalCache2[0], cachedTokenKey = _useGlobalCache2[1], cachedStyleId = _useGlobalCache2[2]; + return function(node) { + var styleNode; + if (ssrInline && !isMergedClientSide && defaultCache) { + var _ref6; + styleNode = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("style", _extends({}, (_ref6 = {}, defineProperty_defineProperty(_ref6, ATTR_TOKEN, cachedTokenKey), defineProperty_defineProperty(_ref6, ATTR_MARK, cachedStyleId), _ref6), { + dangerouslySetInnerHTML: { + __html: cachedStyleStr + } + })); + } else styleNode = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(Empty, null); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(__WEBPACK_EXTERNAL_MODULE_react__.Fragment, null, styleNode, node); + }; +} +var useStyleRegister_extract = function(cache, effectStyles, options) { + var _cache = slicedToArray_slicedToArray(cache, 6), styleStr = _cache[0], tokenKey = _cache[1], styleId = _cache[2], effectStyle = _cache[3], clientOnly = _cache[4], order = _cache[5]; + var _ref7 = options || {}, plain = _ref7.plain; + if (clientOnly) return null; + var keyStyleText = styleStr; + var sharedAttrs = { + 'data-rc-order': 'prependQueue', + 'data-rc-priority': "".concat(order) + }; + keyStyleText = util_toStyleStr(styleStr, tokenKey, styleId, sharedAttrs, plain); + if (effectStyle) Object.keys(effectStyle).forEach(function(effectKey) { + if (!effectStyles[effectKey]) { + effectStyles[effectKey] = true; + var effectStyleStr = normalizeStyle(effectStyle[effectKey]); + var effectStyleHTML = util_toStyleStr(effectStyleStr, tokenKey, "_effect-".concat(effectKey), sharedAttrs, plain); + if (effectKey.startsWith('@layer')) keyStyleText = effectStyleHTML + keyStyleText; + else keyStyleText += effectStyleHTML; + } + }); + return [ + order, + styleId, + keyStyleText + ]; +}; +var CSS_VAR_PREFIX = 'cssVar'; +var useCSSVarRegister_useCSSVarRegister = function(config, fn) { + var key = config.key, prefix = config.prefix, unitless = config.unitless, ignore = config.ignore, token = config.token, _config$scope = config.scope, scope = void 0 === _config$scope ? '' : _config$scope; + var _useContext = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(StyleContext), instanceId = _useContext.cache.instanceId, container = _useContext.container; + var tokenKey = token._tokenKey; + var stylePath = [].concat(_toConsumableArray(config.path), [ + key, + scope, + tokenKey + ]); + var cache = useGlobalCache(CSS_VAR_PREFIX, stylePath, function() { + var originToken = fn(); + var _transformToken = css_variables_transformToken(originToken, key, { + prefix: prefix, + unitless: unitless, + ignore: ignore, + scope: scope + }), _transformToken2 = slicedToArray_slicedToArray(_transformToken, 2), mergedToken = _transformToken2[0], cssVarsStr = _transformToken2[1]; + var styleId = uniqueHash(stylePath, cssVarsStr); + return [ + mergedToken, + cssVarsStr, + styleId, + key + ]; + }, function(_ref) { + var _ref2 = slicedToArray_slicedToArray(_ref, 3), styleId = _ref2[2]; + if (isClientSide) dynamicCSS_removeCSS(styleId, { + mark: ATTR_MARK + }); + }, function(_ref3) { + var _ref4 = slicedToArray_slicedToArray(_ref3, 3), cssVarsStr = _ref4[1], styleId = _ref4[2]; + if (!cssVarsStr) return; + var style = dynamicCSS_updateCSS(cssVarsStr, styleId, { + mark: ATTR_MARK, + prepend: 'queue', + attachTo: container, + priority: -999 + }); + style[CSS_IN_JS_INSTANCE] = instanceId; + style.setAttribute(ATTR_TOKEN, key); + }); + return cache; +}; +var useCSSVarRegister_extract = function(cache, effectStyles, options) { + var _cache = slicedToArray_slicedToArray(cache, 4), styleStr = _cache[1], styleId = _cache[2], cssVarKey = _cache[3]; + var _ref5 = options || {}, plain = _ref5.plain; + if (!styleStr) return null; + var order = -999; + var sharedAttrs = { + 'data-rc-order': 'prependQueue', + 'data-rc-priority': "".concat(order) + }; + var styleText = util_toStyleStr(styleStr, cssVarKey, styleId, sharedAttrs, plain); + return [ + order, + styleId, + styleText + ]; +}; +const hooks_useCSSVarRegister = useCSSVarRegister_useCSSVarRegister; +var _ExtractStyleFns; +_ExtractStyleFns = {}, defineProperty_defineProperty(_ExtractStyleFns, STYLE_PREFIX, useStyleRegister_extract), defineProperty_defineProperty(_ExtractStyleFns, TOKEN_PREFIX, useCacheToken_extract), defineProperty_defineProperty(_ExtractStyleFns, CSS_VAR_PREFIX, useCSSVarRegister_extract); +function noSplit(list) { + list.notSplit = true; + return list; +} +noSplit([ + 'borderTop', + 'borderBottom' +]), noSplit([ + 'borderTop' +]), noSplit([ + 'borderBottom' +]), noSplit([ + 'borderLeft', + 'borderRight' +]), noSplit([ + 'borderLeft' +]), noSplit([ + 'borderRight' +]); +"use client"; +const resetComponent = (token, needInheritFontFamily = false)=>({ + boxSizing: 'border-box', + margin: 0, + padding: 0, + color: token.colorText, + fontSize: token.fontSize, + lineHeight: token.lineHeight, + listStyle: 'none', + fontFamily: needInheritFontFamily ? 'inherit' : token.fontFamily + }); +const resetIcon = ()=>({ + display: 'inline-flex', + alignItems: 'center', + color: 'inherit', + fontStyle: 'normal', + lineHeight: 0, + textAlign: 'center', + textTransform: 'none', + verticalAlign: '-0.125em', + textRendering: 'optimizeLegibility', + '-webkit-font-smoothing': 'antialiased', + '-moz-osx-font-smoothing': 'grayscale', + '> *': { + lineHeight: 1 + }, + svg: { + display: 'inline-block' + } + }); +const genLinkStyle = (token)=>({ + a: { + color: token.colorLink, + textDecoration: token.linkDecoration, + backgroundColor: 'transparent', + outline: 'none', + cursor: 'pointer', + transition: `color ${token.motionDurationSlow}`, + '-webkit-text-decoration-skip': 'objects', + '&:hover': { + color: token.colorLinkHover + }, + '&:active': { + color: token.colorLinkActive + }, + '&:active, &:hover': { + textDecoration: token.linkHoverDecoration, + outline: 0 + }, + '&:focus': { + textDecoration: token.linkFocusDecoration, + outline: 0 + }, + '&[disabled]': { + color: token.colorTextDisabled, + cursor: 'not-allowed' + } + } + }); +const genCommonStyle = (token, componentPrefixCls, rootCls, resetFont)=>{ + const prefixSelector = `[class^="${componentPrefixCls}"], [class*=" ${componentPrefixCls}"]`; + const rootPrefixSelector = rootCls ? `.${rootCls}` : prefixSelector; + const resetStyle = { + boxSizing: 'border-box', + '&::before, &::after': { + boxSizing: 'border-box' + } + }; + let resetFontStyle = {}; + if (false !== resetFont) resetFontStyle = { + fontFamily: token.fontFamily, + fontSize: token.fontSize + }; + return { + [rootPrefixSelector]: Object.assign(Object.assign(Object.assign({}, resetFontStyle), resetStyle), { + [prefixSelector]: resetStyle + }) + }; +}; +const genFocusOutline = (token, offset)=>({ + outline: `${util_unit(token.lineWidthFocus)} solid ${token.colorPrimaryBorder}`, + outlineOffset: null != offset ? offset : 1, + transition: 'outline-offset 0s, outline 0s' + }); +const genFocusStyle = (token, offset)=>({ + '&:focus-visible': Object.assign({}, genFocusOutline(token, offset)) + }); +const genIconStyle = (iconPrefixCls)=>({ + [`.${iconPrefixCls}`]: Object.assign(Object.assign({}, resetIcon()), { + [`.${iconPrefixCls} .${iconPrefixCls}-icon`]: { + display: 'block' + } + }) + }); +const genCollapseMotion = (token)=>({ + [token.componentCls]: { + [`${token.antCls}-motion-collapse-legacy`]: { + overflow: 'hidden', + '&-active': { + transition: `height ${token.motionDurationMid} ${token.motionEaseInOut}, + opacity ${token.motionDurationMid} ${token.motionEaseInOut} !important` + } + }, + [`${token.antCls}-motion-collapse`]: { + overflow: 'hidden', + transition: `height ${token.motionDurationMid} ${token.motionEaseInOut}, + opacity ${token.motionDurationMid} ${token.motionEaseInOut} !important` + } + } + }); +const motion_collapse = genCollapseMotion; +var calc_calculator_AbstractCalculator = /*#__PURE__*/ createClass_createClass(function AbstractCalculator() { + classCallCheck_classCallCheck(this, AbstractCalculator); +}); +const calc_calculator = calc_calculator_AbstractCalculator; +var CSSCalculator_CALC_UNIT = 'CALC_UNIT'; +var CSSCalculator_regexp = new RegExp(CSSCalculator_CALC_UNIT, 'g'); +function CSSCalculator_unit(value) { + if ('number' == typeof value) return "".concat(value).concat(CSSCalculator_CALC_UNIT); + return value; +} +var calc_CSSCalculator_CSSCalculator = /*#__PURE__*/ function(_AbstractCalculator) { + inherits_inherits(CSSCalculator, _AbstractCalculator); + var _super = createSuper_createSuper(CSSCalculator); + function CSSCalculator(num, unitlessCssVar) { + var _this; + classCallCheck_classCallCheck(this, CSSCalculator); + _this = _super.call(this); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "result", ''); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "unitlessCssVar", void 0); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "lowPriority", void 0); + var numType = typeof_typeof(num); + _this.unitlessCssVar = unitlessCssVar; + if (num instanceof CSSCalculator) _this.result = "(".concat(num.result, ")"); + else if ('number' === numType) _this.result = CSSCalculator_unit(num); + else if ('string' === numType) _this.result = num; + return _this; + } + createClass_createClass(CSSCalculator, [ + { + key: "add", + value: function(num) { + if (num instanceof CSSCalculator) this.result = "".concat(this.result, " + ").concat(num.getResult()); + else if ('number' == typeof num || 'string' == typeof num) this.result = "".concat(this.result, " + ").concat(CSSCalculator_unit(num)); + this.lowPriority = true; + return this; + } + }, + { + key: "sub", + value: function(num) { + if (num instanceof CSSCalculator) this.result = "".concat(this.result, " - ").concat(num.getResult()); + else if ('number' == typeof num || 'string' == typeof num) this.result = "".concat(this.result, " - ").concat(CSSCalculator_unit(num)); + this.lowPriority = true; + return this; + } + }, + { + key: "mul", + value: function(num) { + if (this.lowPriority) this.result = "(".concat(this.result, ")"); + if (num instanceof CSSCalculator) this.result = "".concat(this.result, " * ").concat(num.getResult(true)); + else if ('number' == typeof num || 'string' == typeof num) this.result = "".concat(this.result, " * ").concat(num); + this.lowPriority = false; + return this; + } + }, + { + key: "div", + value: function(num) { + if (this.lowPriority) this.result = "(".concat(this.result, ")"); + if (num instanceof CSSCalculator) this.result = "".concat(this.result, " / ").concat(num.getResult(true)); + else if ('number' == typeof num || 'string' == typeof num) this.result = "".concat(this.result, " / ").concat(num); + this.lowPriority = false; + return this; + } + }, + { + key: "getResult", + value: function(force) { + return this.lowPriority || force ? "(".concat(this.result, ")") : this.result; + } + }, + { + key: "equal", + value: function(options) { + var _this2 = this; + var _ref = options || {}, cssUnit = _ref.unit; + var mergedUnit = true; + if ('boolean' == typeof cssUnit) mergedUnit = cssUnit; + else if (Array.from(this.unitlessCssVar).some(function(cssVar) { + return _this2.result.includes(cssVar); + })) mergedUnit = false; + this.result = this.result.replace(CSSCalculator_regexp, mergedUnit ? 'px' : ''); + if (void 0 !== this.lowPriority) return "calc(".concat(this.result, ")"); + return this.result; + } + } + ]); + return CSSCalculator; +}(calc_calculator); +var calc_NumCalculator_NumCalculator = /*#__PURE__*/ function(_AbstractCalculator) { + inherits_inherits(NumCalculator, _AbstractCalculator); + var _super = createSuper_createSuper(NumCalculator); + function NumCalculator(num) { + var _this; + classCallCheck_classCallCheck(this, NumCalculator); + _this = _super.call(this); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "result", 0); + if (num instanceof NumCalculator) _this.result = num.result; + else if ('number' == typeof num) _this.result = num; + return _this; + } + createClass_createClass(NumCalculator, [ + { + key: "add", + value: function(num) { + if (num instanceof NumCalculator) this.result += num.result; + else if ('number' == typeof num) this.result += num; + return this; + } + }, + { + key: "sub", + value: function(num) { + if (num instanceof NumCalculator) this.result -= num.result; + else if ('number' == typeof num) this.result -= num; + return this; + } + }, + { + key: "mul", + value: function(num) { + if (num instanceof NumCalculator) this.result *= num.result; + else if ('number' == typeof num) this.result *= num; + return this; + } + }, + { + key: "div", + value: function(num) { + if (num instanceof NumCalculator) this.result /= num.result; + else if ('number' == typeof num) this.result /= num; + return this; + } + }, + { + key: "equal", + value: function() { + return this.result; + } + } + ]); + return NumCalculator; +}(calc_calculator); +const calc_NumCalculator = calc_NumCalculator_NumCalculator; +var util_calc_genCalc = function(type, unitlessCssVar) { + var Calculator = 'css' === type ? calc_CSSCalculator_CSSCalculator : calc_NumCalculator; + return function(num) { + return new Calculator(num, unitlessCssVar); + }; +}; +const util_calc = util_calc_genCalc; +var getCompVarPrefix_getCompVarPrefix = function(component, prefix) { + return "".concat([ + prefix, + component.replace(/([A-Z]+)([A-Z][a-z]+)/g, '$1-$2').replace(/([a-z])([A-Z])/g, '$1-$2') + ].filter(Boolean).join('-')); +}; +const util_getCompVarPrefix = getCompVarPrefix_getCompVarPrefix; +function getComponentToken_getComponentToken(component, token, defaultToken, options) { + var customToken = objectSpread2_objectSpread2({}, token[component]); + if (null != options && options.deprecatedTokens) { + var deprecatedTokens = options.deprecatedTokens; + deprecatedTokens.forEach(function(_ref) { + var _ref2 = slicedToArray_slicedToArray(_ref, 2), oldTokenKey = _ref2[0], newTokenKey = _ref2[1]; + if ('production' !== process.env.NODE_ENV) es_warning(!(null != customToken && customToken[oldTokenKey]), "Component Token `".concat(String(oldTokenKey), "` of ").concat(String(component), " is deprecated. Please use `").concat(String(newTokenKey), "` instead.")); + if (null != customToken && customToken[oldTokenKey] || null != customToken && customToken[newTokenKey]) null != customToken[newTokenKey] || (customToken[newTokenKey] = null == customToken ? void 0 : customToken[oldTokenKey]); + }); + } + var mergedToken = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, defaultToken), customToken); + Object.keys(mergedToken).forEach(function(key) { + if (mergedToken[key] === token[key]) delete mergedToken[key]; + }); + return mergedToken; +} +const getComponentToken = getComponentToken_getComponentToken; +var enableStatistic = 'production' !== process.env.NODE_ENV || 'undefined' != typeof CSSINJS_STATISTIC; +var recording = true; +function statistic_merge() { + for(var _len = arguments.length, objs = new Array(_len), _key = 0; _key < _len; _key++)objs[_key] = arguments[_key]; + if (!enableStatistic) return Object.assign.apply(Object, [ + {} + ].concat(objs)); + recording = false; + var ret = {}; + objs.forEach(function(obj) { + if ('object' !== typeof_typeof(obj)) return; + var keys = Object.keys(obj); + keys.forEach(function(key) { + Object.defineProperty(ret, key, { + configurable: true, + enumerable: true, + get: function() { + return obj[key]; + } + }); + }); + }); + recording = true; + return ret; +} +var statistic_statistic = {}; +function statistic_noop() {} +var statistic_statisticToken = function(token) { + var tokenKeys; + var proxy = token; + var flush = statistic_noop; + if (enableStatistic && 'undefined' != typeof Proxy) { + tokenKeys = new Set(); + proxy = new Proxy(token, { + get: function(obj, prop) { + if (recording) { + var _tokenKeys; + null == (_tokenKeys = tokenKeys) || _tokenKeys.add(prop); + } + return obj[prop]; + } + }); + flush = function(componentName, componentToken) { + var _statistic$componentN; + statistic_statistic[componentName] = { + global: Array.from(tokenKeys), + component: objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, null == (_statistic$componentN = statistic_statistic[componentName]) ? void 0 : _statistic$componentN.component), componentToken) + }; + }; + } + return { + token: proxy, + keys: tokenKeys, + flush: flush + }; +}; +const util_statistic = statistic_statisticToken; +function getDefaultComponentToken(component, token, getDefaultToken) { + if ('function' == typeof getDefaultToken) { + var _token$component; + return getDefaultToken(statistic_merge(token, null != (_token$component = token[component]) ? _token$component : {})); + } + return null != getDefaultToken ? getDefaultToken : {}; +} +const util_getDefaultComponentToken = getDefaultComponentToken; +function genMaxMin(type) { + if ('js' === type) return { + max: Math.max, + min: Math.min + }; + return { + max: function() { + for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + return "max(".concat(args.map(function(value) { + return util_unit(value); + }).join(','), ")"); + }, + min: function() { + for(var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++)args[_key2] = arguments[_key2]; + return "min(".concat(args.map(function(value) { + return util_unit(value); + }).join(','), ")"); + } + }; +} +const maxmin = genMaxMin; +var BEAT_LIMIT = 600000; +var useUniqueMemo_ArrayKeyMap = /*#__PURE__*/ function() { + function ArrayKeyMap() { + classCallCheck_classCallCheck(this, ArrayKeyMap); + defineProperty_defineProperty(this, "map", new Map()); + defineProperty_defineProperty(this, "objectIDMap", new WeakMap()); + defineProperty_defineProperty(this, "nextID", 0); + defineProperty_defineProperty(this, "lastAccessBeat", new Map()); + defineProperty_defineProperty(this, "accessBeat", 0); + } + createClass_createClass(ArrayKeyMap, [ + { + key: "set", + value: function(keys, value) { + this.clear(); + var compositeKey = this.getCompositeKey(keys); + this.map.set(compositeKey, value); + this.lastAccessBeat.set(compositeKey, Date.now()); + } + }, + { + key: "get", + value: function(keys) { + var compositeKey = this.getCompositeKey(keys); + var cache = this.map.get(compositeKey); + this.lastAccessBeat.set(compositeKey, Date.now()); + this.accessBeat += 1; + return cache; + } + }, + { + key: "getCompositeKey", + value: function(keys) { + var _this = this; + var ids = keys.map(function(key) { + if (key && 'object' === typeof_typeof(key)) return "obj_".concat(_this.getObjectID(key)); + return "".concat(typeof_typeof(key), "_").concat(key); + }); + return ids.join('|'); + } + }, + { + key: "getObjectID", + value: function(obj) { + if (this.objectIDMap.has(obj)) return this.objectIDMap.get(obj); + var id = this.nextID; + this.objectIDMap.set(obj, id); + this.nextID += 1; + return id; + } + }, + { + key: "clear", + value: function() { + var _this2 = this; + if (this.accessBeat > 10000) { + var now = Date.now(); + this.lastAccessBeat.forEach(function(beat, key) { + if (now - beat > BEAT_LIMIT) { + _this2.map.delete(key); + _this2.lastAccessBeat.delete(key); + } + }); + this.accessBeat = 0; + } + } + } + ]); + return ArrayKeyMap; +}(); +var uniqueMap = new useUniqueMemo_ArrayKeyMap(); +function useUniqueMemo(memoFn, deps) { + return __WEBPACK_EXTERNAL_MODULE_react__["default"].useMemo(function() { + var cachedValue = uniqueMap.get(deps); + if (cachedValue) return cachedValue; + var newValue = memoFn(); + uniqueMap.set(deps, newValue); + return newValue; + }, deps); +} +const hooks_useUniqueMemo = useUniqueMemo; +var useCSP_useDefaultCSP = function() { + return {}; +}; +const hooks_useCSP = useCSP_useDefaultCSP; +function genStyleUtils_genStyleUtils(config) { + var _config$useCSP = config.useCSP, useCSP = void 0 === _config$useCSP ? hooks_useCSP : _config$useCSP, useToken = config.useToken, usePrefix = config.usePrefix, getResetStyles = config.getResetStyles, getCommonStyle = config.getCommonStyle, getCompUnitless = config.getCompUnitless; + function genStyleHooks(component, styleFn, getDefaultToken, options) { + var componentName = Array.isArray(component) ? component[0] : component; + function prefixToken(key) { + return "".concat(String(componentName)).concat(key.slice(0, 1).toUpperCase()).concat(key.slice(1)); + } + var originUnitless = (null == options ? void 0 : options.unitless) || {}; + var originCompUnitless = 'function' == typeof getCompUnitless ? getCompUnitless(component) : {}; + var compUnitless = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, originCompUnitless), {}, defineProperty_defineProperty({}, prefixToken('zIndexPopup'), true)); + Object.keys(originUnitless).forEach(function(key) { + compUnitless[prefixToken(key)] = originUnitless[key]; + }); + var mergedOptions = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, options), {}, { + unitless: compUnitless, + prefixToken: prefixToken + }); + var useStyle = genComponentStyleHook(component, styleFn, getDefaultToken, mergedOptions); + var useCSSVar = genCSSVarRegister(componentName, getDefaultToken, mergedOptions); + return function(prefixCls) { + var rootCls = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : prefixCls; + var _useStyle = useStyle(prefixCls, rootCls), _useStyle2 = slicedToArray_slicedToArray(_useStyle, 2), hashId = _useStyle2[1]; + var _useCSSVar = useCSSVar(rootCls), _useCSSVar2 = slicedToArray_slicedToArray(_useCSSVar, 2), wrapCSSVar = _useCSSVar2[0], cssVarCls = _useCSSVar2[1]; + return [ + wrapCSSVar, + hashId, + cssVarCls + ]; + }; + } + function genCSSVarRegister(component, getDefaultToken, options) { + var compUnitless = options.unitless, _options$injectStyle = options.injectStyle, injectStyle = void 0 === _options$injectStyle ? true : _options$injectStyle, prefixToken = options.prefixToken, ignore = options.ignore; + var CSSVarRegister = function(_ref) { + var rootCls = _ref.rootCls, _ref$cssVar = _ref.cssVar, cssVar = void 0 === _ref$cssVar ? {} : _ref$cssVar; + var _useToken = useToken(), realToken = _useToken.realToken; + hooks_useCSSVarRegister({ + path: [ + component + ], + prefix: cssVar.prefix, + key: cssVar.key, + unitless: compUnitless, + ignore: ignore, + token: realToken, + scope: rootCls + }, function() { + var defaultToken = util_getDefaultComponentToken(component, realToken, getDefaultToken); + var componentToken = getComponentToken(component, realToken, defaultToken, { + deprecatedTokens: null == options ? void 0 : options.deprecatedTokens + }); + Object.keys(defaultToken).forEach(function(key) { + componentToken[prefixToken(key)] = componentToken[key]; + delete componentToken[key]; + }); + return componentToken; + }); + return null; + }; + var useCSSVar = function(rootCls) { + var _useToken2 = useToken(), cssVar = _useToken2.cssVar; + return [ + function(node) { + return injectStyle && cssVar ? /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement(__WEBPACK_EXTERNAL_MODULE_react__["default"].Fragment, null, /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement(CSSVarRegister, { + rootCls: rootCls, + cssVar: cssVar, + component: component + }), node) : node; + }, + null == cssVar ? void 0 : cssVar.key + ]; + }; + return useCSSVar; + } + function genComponentStyleHook(componentName, styleFn, getDefaultToken) { + var options = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {}; + var cells = Array.isArray(componentName) ? componentName : [ + componentName, + componentName + ]; + var _cells = slicedToArray_slicedToArray(cells, 1), component = _cells[0]; + var concatComponent = cells.join('-'); + var mergedLayer = config.layer || { + name: 'antd' + }; + return function(prefixCls) { + var rootCls = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : prefixCls; + var _useToken3 = useToken(), theme = _useToken3.theme, realToken = _useToken3.realToken, hashId = _useToken3.hashId, token = _useToken3.token, cssVar = _useToken3.cssVar; + var _usePrefix = usePrefix(), rootPrefixCls = _usePrefix.rootPrefixCls, iconPrefixCls = _usePrefix.iconPrefixCls; + var csp = useCSP(); + var type = cssVar ? 'css' : 'js'; + var calc = hooks_useUniqueMemo(function() { + var unitlessCssVar = new Set(); + if (cssVar) Object.keys(options.unitless || {}).forEach(function(key) { + unitlessCssVar.add(css_variables_token2CSSVar(key, cssVar.prefix)); + unitlessCssVar.add(css_variables_token2CSSVar(key, util_getCompVarPrefix(component, cssVar.prefix))); + }); + return util_calc(type, unitlessCssVar); + }, [ + type, + component, + null == cssVar ? void 0 : cssVar.prefix + ]); + var _genMaxMin = maxmin(type), max = _genMaxMin.max, min = _genMaxMin.min; + var sharedConfig = { + theme: theme, + token: token, + hashId: hashId, + nonce: function() { + return csp.nonce; + }, + clientOnly: options.clientOnly, + layer: mergedLayer, + order: options.order || -999 + }; + if ('function' == typeof getResetStyles) useStyleRegister(objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, sharedConfig), {}, { + clientOnly: false, + path: [ + 'Shared', + rootPrefixCls + ] + }), function() { + return getResetStyles(token, { + prefix: { + rootPrefixCls: rootPrefixCls, + iconPrefixCls: iconPrefixCls + }, + csp: csp + }); + }); + var wrapSSR = useStyleRegister(objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, sharedConfig), {}, { + path: [ + concatComponent, + prefixCls, + iconPrefixCls + ] + }), function() { + if (false === options.injectStyle) return []; + var _statisticToken = util_statistic(token), proxyToken = _statisticToken.token, flush = _statisticToken.flush; + var defaultComponentToken = util_getDefaultComponentToken(component, realToken, getDefaultToken); + var componentCls = ".".concat(prefixCls); + var componentToken = getComponentToken(component, realToken, defaultComponentToken, { + deprecatedTokens: options.deprecatedTokens + }); + if (cssVar && defaultComponentToken && 'object' === typeof_typeof(defaultComponentToken)) Object.keys(defaultComponentToken).forEach(function(key) { + defaultComponentToken[key] = "var(".concat(css_variables_token2CSSVar(key, util_getCompVarPrefix(component, cssVar.prefix)), ")"); + }); + var mergedToken = statistic_merge(proxyToken, { + componentCls: componentCls, + prefixCls: prefixCls, + iconCls: ".".concat(iconPrefixCls), + antCls: ".".concat(rootPrefixCls), + calc: calc, + max: max, + min: min + }, cssVar ? defaultComponentToken : componentToken); + var styleInterpolation = styleFn(mergedToken, { + hashId: hashId, + prefixCls: prefixCls, + rootPrefixCls: rootPrefixCls, + iconPrefixCls: iconPrefixCls + }); + flush(component, componentToken); + var commonStyle = 'function' == typeof getCommonStyle ? getCommonStyle(mergedToken, prefixCls, rootCls, options.resetFont) : null; + return [ + false === options.resetStyle ? null : commonStyle, + styleInterpolation + ]; + }); + return [ + wrapSSR, + hashId + ]; + }; + } + function genSubStyleComponent(componentName, styleFn, getDefaultToken) { + var options = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {}; + var useStyle = genComponentStyleHook(componentName, styleFn, getDefaultToken, objectSpread2_objectSpread2({ + resetStyle: false, + order: -998 + }, options)); + var StyledComponent = function(_ref2) { + var prefixCls = _ref2.prefixCls, _ref2$rootCls = _ref2.rootCls, rootCls = void 0 === _ref2$rootCls ? prefixCls : _ref2$rootCls; + useStyle(prefixCls, rootCls); + return null; + }; + if ('production' !== process.env.NODE_ENV) StyledComponent.displayName = "SubStyle_".concat(String(Array.isArray(componentName) ? componentName.join('.') : componentName)); + return StyledComponent; + } + return { + genStyleHooks: genStyleHooks, + genSubStyleComponent: genSubStyleComponent, + genComponentStyleHook: genComponentStyleHook + }; +} +const genStyleUtils = genStyleUtils_genStyleUtils; +const version = '5.26.3'; +"use client"; +const es_version = version; +const defaultPresetColors = { + blue: '#1677FF', + purple: '#722ED1', + cyan: '#13C2C2', + green: '#52C41A', + magenta: '#EB2F96', + pink: '#EB2F96', + red: '#F5222D', + orange: '#FA8C16', + yellow: '#FADB14', + volcano: '#FA541C', + geekblue: '#2F54EB', + gold: '#FAAD14', + lime: '#A0D911' +}; +const seedToken = Object.assign(Object.assign({}, defaultPresetColors), { + colorPrimary: '#1677ff', + colorSuccess: '#52c41a', + colorWarning: '#faad14', + colorError: '#ff4d4f', + colorInfo: '#1677ff', + colorLink: '', + colorTextBase: '', + colorBgBase: '', + fontFamily: `-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, +'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', +'Noto Color Emoji'`, + fontFamilyCode: "'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace", + fontSize: 14, + lineWidth: 1, + lineType: 'solid', + motionUnit: 0.1, + motionBase: 0, + motionEaseOutCirc: 'cubic-bezier(0.08, 0.82, 0.17, 1)', + motionEaseInOutCirc: 'cubic-bezier(0.78, 0.14, 0.15, 0.86)', + motionEaseOut: 'cubic-bezier(0.215, 0.61, 0.355, 1)', + motionEaseInOut: 'cubic-bezier(0.645, 0.045, 0.355, 1)', + motionEaseOutBack: 'cubic-bezier(0.12, 0.4, 0.29, 1.46)', + motionEaseInBack: 'cubic-bezier(0.71, -0.46, 0.88, 0.6)', + motionEaseInQuint: 'cubic-bezier(0.755, 0.05, 0.855, 0.06)', + motionEaseOutQuint: 'cubic-bezier(0.23, 1, 0.32, 1)', + borderRadius: 6, + sizeUnit: 4, + sizeStep: 4, + sizePopupArrow: 16, + controlHeight: 32, + zIndexBase: 0, + zIndexPopupBase: 1000, + opacityImage: 1, + wireframe: false, + motion: true +}); +const themes_seed = seedToken; +const defaultConfig = { + token: themes_seed, + override: { + override: themes_seed + }, + hashed: true +}; +const DesignTokenContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createContext(defaultConfig); +function genColorMapToken(seed, { generateColorPalettes, generateNeutralColorPalettes }) { + const { colorSuccess: colorSuccessBase, colorWarning: colorWarningBase, colorError: colorErrorBase, colorInfo: colorInfoBase, colorPrimary: colorPrimaryBase, colorBgBase, colorTextBase } = seed; + const primaryColors = generateColorPalettes(colorPrimaryBase); + const successColors = generateColorPalettes(colorSuccessBase); + const warningColors = generateColorPalettes(colorWarningBase); + const errorColors = generateColorPalettes(colorErrorBase); + const infoColors = generateColorPalettes(colorInfoBase); + const neutralColors = generateNeutralColorPalettes(colorBgBase, colorTextBase); + const colorLink = seed.colorLink || seed.colorInfo; + const linkColors = generateColorPalettes(colorLink); + const colorErrorBgFilledHover = new FastColor(errorColors[1]).mix(new FastColor(errorColors[3]), 50).toHexString(); + return Object.assign(Object.assign({}, neutralColors), { + colorPrimaryBg: primaryColors[1], + colorPrimaryBgHover: primaryColors[2], + colorPrimaryBorder: primaryColors[3], + colorPrimaryBorderHover: primaryColors[4], + colorPrimaryHover: primaryColors[5], + colorPrimary: primaryColors[6], + colorPrimaryActive: primaryColors[7], + colorPrimaryTextHover: primaryColors[8], + colorPrimaryText: primaryColors[9], + colorPrimaryTextActive: primaryColors[10], + colorSuccessBg: successColors[1], + colorSuccessBgHover: successColors[2], + colorSuccessBorder: successColors[3], + colorSuccessBorderHover: successColors[4], + colorSuccessHover: successColors[4], + colorSuccess: successColors[6], + colorSuccessActive: successColors[7], + colorSuccessTextHover: successColors[8], + colorSuccessText: successColors[9], + colorSuccessTextActive: successColors[10], + colorErrorBg: errorColors[1], + colorErrorBgHover: errorColors[2], + colorErrorBgFilledHover, + colorErrorBgActive: errorColors[3], + colorErrorBorder: errorColors[3], + colorErrorBorderHover: errorColors[4], + colorErrorHover: errorColors[5], + colorError: errorColors[6], + colorErrorActive: errorColors[7], + colorErrorTextHover: errorColors[8], + colorErrorText: errorColors[9], + colorErrorTextActive: errorColors[10], + colorWarningBg: warningColors[1], + colorWarningBgHover: warningColors[2], + colorWarningBorder: warningColors[3], + colorWarningBorderHover: warningColors[4], + colorWarningHover: warningColors[4], + colorWarning: warningColors[6], + colorWarningActive: warningColors[7], + colorWarningTextHover: warningColors[8], + colorWarningText: warningColors[9], + colorWarningTextActive: warningColors[10], + colorInfoBg: infoColors[1], + colorInfoBgHover: infoColors[2], + colorInfoBorder: infoColors[3], + colorInfoBorderHover: infoColors[4], + colorInfoHover: infoColors[4], + colorInfo: infoColors[6], + colorInfoActive: infoColors[7], + colorInfoTextHover: infoColors[8], + colorInfoText: infoColors[9], + colorInfoTextActive: infoColors[10], + colorLinkHover: linkColors[4], + colorLink: linkColors[6], + colorLinkActive: linkColors[7], + colorBgMask: new FastColor('#000').setA(0.45).toRgbString(), + colorWhite: '#fff' + }); +} +const genRadius = (radiusBase)=>{ + let radiusLG = radiusBase; + let radiusSM = radiusBase; + let radiusXS = radiusBase; + let radiusOuter = radiusBase; + if (radiusBase < 6 && radiusBase >= 5) radiusLG = radiusBase + 1; + else if (radiusBase < 16 && radiusBase >= 6) radiusLG = radiusBase + 2; + else if (radiusBase >= 16) radiusLG = 16; + if (radiusBase < 7 && radiusBase >= 5) radiusSM = 4; + else if (radiusBase < 8 && radiusBase >= 7) radiusSM = 5; + else if (radiusBase < 14 && radiusBase >= 8) radiusSM = 6; + else if (radiusBase < 16 && radiusBase >= 14) radiusSM = 7; + else if (radiusBase >= 16) radiusSM = 8; + if (radiusBase < 6 && radiusBase >= 2) radiusXS = 1; + else if (radiusBase >= 6) radiusXS = 2; + if (radiusBase > 4 && radiusBase < 8) radiusOuter = 4; + else if (radiusBase >= 8) radiusOuter = 6; + return { + borderRadius: radiusBase, + borderRadiusXS: radiusXS, + borderRadiusSM: radiusSM, + borderRadiusLG: radiusLG, + borderRadiusOuter: radiusOuter + }; +}; +const shared_genRadius = genRadius; +function genCommonMapToken(token) { + const { motionUnit, motionBase, borderRadius, lineWidth } = token; + return Object.assign({ + motionDurationFast: `${(motionBase + motionUnit).toFixed(1)}s`, + motionDurationMid: `${(motionBase + 2 * motionUnit).toFixed(1)}s`, + motionDurationSlow: `${(motionBase + 3 * motionUnit).toFixed(1)}s`, + lineWidthBold: lineWidth + 1 + }, shared_genRadius(borderRadius)); +} +const genControlHeight = (token)=>{ + const { controlHeight } = token; + return { + controlHeightSM: 0.75 * controlHeight, + controlHeightXS: 0.5 * controlHeight, + controlHeightLG: 1.25 * controlHeight + }; +}; +const shared_genControlHeight = genControlHeight; +function getLineHeight(fontSize) { + return (fontSize + 8) / fontSize; +} +function getFontSizes(base) { + const fontSizes = Array.from({ + length: 10 + }).map((_, index)=>{ + const i = index - 1; + const baseSize = base * Math.pow(Math.E, i / 5); + const intSize = index > 1 ? Math.floor(baseSize) : Math.ceil(baseSize); + return 2 * Math.floor(intSize / 2); + }); + fontSizes[1] = base; + return fontSizes.map((size)=>({ + size, + lineHeight: getLineHeight(size) + })); +} +const genFontMapToken = (fontSize)=>{ + const fontSizePairs = getFontSizes(fontSize); + const fontSizes = fontSizePairs.map((pair)=>pair.size); + const lineHeights = fontSizePairs.map((pair)=>pair.lineHeight); + const fontSizeMD = fontSizes[1]; + const fontSizeSM = fontSizes[0]; + const fontSizeLG = fontSizes[2]; + const lineHeight = lineHeights[1]; + const lineHeightSM = lineHeights[0]; + const lineHeightLG = lineHeights[2]; + return { + fontSizeSM, + fontSize: fontSizeMD, + fontSizeLG, + fontSizeXL: fontSizes[3], + fontSizeHeading1: fontSizes[6], + fontSizeHeading2: fontSizes[5], + fontSizeHeading3: fontSizes[4], + fontSizeHeading4: fontSizes[3], + fontSizeHeading5: fontSizes[2], + lineHeight, + lineHeightLG, + lineHeightSM, + fontHeight: Math.round(lineHeight * fontSizeMD), + fontHeightLG: Math.round(lineHeightLG * fontSizeLG), + fontHeightSM: Math.round(lineHeightSM * fontSizeSM), + lineHeightHeading1: lineHeights[6], + lineHeightHeading2: lineHeights[5], + lineHeightHeading3: lineHeights[4], + lineHeightHeading4: lineHeights[3], + lineHeightHeading5: lineHeights[2] + }; +}; +const shared_genFontMapToken = genFontMapToken; +function genSizeMapToken(token) { + const { sizeUnit, sizeStep } = token; + return { + sizeXXL: sizeUnit * (sizeStep + 8), + sizeXL: sizeUnit * (sizeStep + 4), + sizeLG: sizeUnit * (sizeStep + 2), + sizeMD: sizeUnit * (sizeStep + 1), + sizeMS: sizeUnit * sizeStep, + size: sizeUnit * sizeStep, + sizeSM: sizeUnit * (sizeStep - 1), + sizeXS: sizeUnit * (sizeStep - 2), + sizeXXS: sizeUnit * (sizeStep - 3) + }; +} +const getAlphaColor = (baseColor, alpha)=>new FastColor(baseColor).setA(alpha).toRgbString(); +const getSolidColor = (baseColor, brightness)=>{ + const instance = new FastColor(baseColor); + return instance.darken(brightness).toHexString(); +}; +const colors_generateColorPalettes = (baseColor)=>{ + const colors = generate(baseColor); + return { + 1: colors[0], + 2: colors[1], + 3: colors[2], + 4: colors[3], + 5: colors[4], + 6: colors[5], + 7: colors[6], + 8: colors[4], + 9: colors[5], + 10: colors[6] + }; +}; +const colors_generateNeutralColorPalettes = (bgBaseColor, textBaseColor)=>{ + const colorBgBase = bgBaseColor || '#fff'; + const colorTextBase = textBaseColor || '#000'; + return { + colorBgBase, + colorTextBase, + colorText: getAlphaColor(colorTextBase, 0.88), + colorTextSecondary: getAlphaColor(colorTextBase, 0.65), + colorTextTertiary: getAlphaColor(colorTextBase, 0.45), + colorTextQuaternary: getAlphaColor(colorTextBase, 0.25), + colorFill: getAlphaColor(colorTextBase, 0.15), + colorFillSecondary: getAlphaColor(colorTextBase, 0.06), + colorFillTertiary: getAlphaColor(colorTextBase, 0.04), + colorFillQuaternary: getAlphaColor(colorTextBase, 0.02), + colorBgSolid: getAlphaColor(colorTextBase, 1), + colorBgSolidHover: getAlphaColor(colorTextBase, 0.75), + colorBgSolidActive: getAlphaColor(colorTextBase, 0.95), + colorBgLayout: getSolidColor(colorBgBase, 4), + colorBgContainer: getSolidColor(colorBgBase, 0), + colorBgElevated: getSolidColor(colorBgBase, 0), + colorBgSpotlight: getAlphaColor(colorTextBase, 0.85), + colorBgBlur: 'transparent', + colorBorder: getSolidColor(colorBgBase, 15), + colorBorderSecondary: getSolidColor(colorBgBase, 6) + }; +}; +function default_derivative(token) { + presetPrimaryColors.pink = presetPrimaryColors.magenta; + presetPalettes.pink = presetPalettes.magenta; + const colorPalettes = Object.keys(defaultPresetColors).map((colorKey)=>{ + const colors = token[colorKey] === presetPrimaryColors[colorKey] ? presetPalettes[colorKey] : generate(token[colorKey]); + return Array.from({ + length: 10 + }, ()=>1).reduce((prev, _, i)=>{ + prev[`${colorKey}-${i + 1}`] = colors[i]; + prev[`${colorKey}${i + 1}`] = colors[i]; + return prev; + }, {}); + }).reduce((prev, cur)=>{ + prev = Object.assign(Object.assign({}, prev), cur); + return prev; + }, {}); + return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, token), colorPalettes), genColorMapToken(token, { + generateColorPalettes: colors_generateColorPalettes, + generateNeutralColorPalettes: colors_generateNeutralColorPalettes + })), shared_genFontMapToken(token.fontSize)), genSizeMapToken(token)), shared_genControlHeight(token)), genCommonMapToken(token)); +} +const defaultTheme = createTheme(default_derivative); +const default_theme = defaultTheme; +function isStableColor(color) { + return color >= 0 && color <= 255; +} +function getAlphaColor_getAlphaColor(frontColor, backgroundColor) { + const { r: fR, g: fG, b: fB, a: originAlpha } = new FastColor(frontColor).toRgb(); + if (originAlpha < 1) return frontColor; + const { r: bR, g: bG, b: bB } = new FastColor(backgroundColor).toRgb(); + for(let fA = 0.01; fA <= 1; fA += 0.01){ + const r = Math.round((fR - bR * (1 - fA)) / fA); + const g = Math.round((fG - bG * (1 - fA)) / fA); + const b = Math.round((fB - bB * (1 - fA)) / fA); + if (isStableColor(r) && isStableColor(g) && isStableColor(b)) return new FastColor({ + r, + g, + b, + a: Math.round(100 * fA) / 100 + }).toRgbString(); + } + return new FastColor({ + r: fR, + g: fG, + b: fB, + a: 1 + }).toRgbString(); +} +const util_getAlphaColor = getAlphaColor_getAlphaColor; +var __rest = function(s, e) { + var t = {}; + for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; + if (null != s && "function" == typeof Object.getOwnPropertySymbols) { + for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; + } + return t; +}; +function alias_formatToken(derivativeToken) { + const { override } = derivativeToken, restToken = __rest(derivativeToken, [ + "override" + ]); + const overrideTokens = Object.assign({}, override); + Object.keys(themes_seed).forEach((token)=>{ + delete overrideTokens[token]; + }); + const mergedToken = Object.assign(Object.assign({}, restToken), overrideTokens); + const screenXS = 480; + const screenSM = 576; + const screenMD = 768; + const screenLG = 992; + const screenXL = 1200; + const screenXXL = 1600; + if (false === mergedToken.motion) { + const fastDuration = '0s'; + mergedToken.motionDurationFast = fastDuration; + mergedToken.motionDurationMid = fastDuration; + mergedToken.motionDurationSlow = fastDuration; + } + const aliasToken = Object.assign(Object.assign(Object.assign({}, mergedToken), { + colorFillContent: mergedToken.colorFillSecondary, + colorFillContentHover: mergedToken.colorFill, + colorFillAlter: mergedToken.colorFillQuaternary, + colorBgContainerDisabled: mergedToken.colorFillTertiary, + colorBorderBg: mergedToken.colorBgContainer, + colorSplit: util_getAlphaColor(mergedToken.colorBorderSecondary, mergedToken.colorBgContainer), + colorTextPlaceholder: mergedToken.colorTextQuaternary, + colorTextDisabled: mergedToken.colorTextQuaternary, + colorTextHeading: mergedToken.colorText, + colorTextLabel: mergedToken.colorTextSecondary, + colorTextDescription: mergedToken.colorTextTertiary, + colorTextLightSolid: mergedToken.colorWhite, + colorHighlight: mergedToken.colorError, + colorBgTextHover: mergedToken.colorFillSecondary, + colorBgTextActive: mergedToken.colorFill, + colorIcon: mergedToken.colorTextTertiary, + colorIconHover: mergedToken.colorText, + colorErrorOutline: util_getAlphaColor(mergedToken.colorErrorBg, mergedToken.colorBgContainer), + colorWarningOutline: util_getAlphaColor(mergedToken.colorWarningBg, mergedToken.colorBgContainer), + fontSizeIcon: mergedToken.fontSizeSM, + lineWidthFocus: 3 * mergedToken.lineWidth, + lineWidth: mergedToken.lineWidth, + controlOutlineWidth: 2 * mergedToken.lineWidth, + controlInteractiveSize: mergedToken.controlHeight / 2, + controlItemBgHover: mergedToken.colorFillTertiary, + controlItemBgActive: mergedToken.colorPrimaryBg, + controlItemBgActiveHover: mergedToken.colorPrimaryBgHover, + controlItemBgActiveDisabled: mergedToken.colorFill, + controlTmpOutline: mergedToken.colorFillQuaternary, + controlOutline: util_getAlphaColor(mergedToken.colorPrimaryBg, mergedToken.colorBgContainer), + lineType: mergedToken.lineType, + borderRadius: mergedToken.borderRadius, + borderRadiusXS: mergedToken.borderRadiusXS, + borderRadiusSM: mergedToken.borderRadiusSM, + borderRadiusLG: mergedToken.borderRadiusLG, + fontWeightStrong: 600, + opacityLoading: 0.65, + linkDecoration: 'none', + linkHoverDecoration: 'none', + linkFocusDecoration: 'none', + controlPaddingHorizontal: 12, + controlPaddingHorizontalSM: 8, + paddingXXS: mergedToken.sizeXXS, + paddingXS: mergedToken.sizeXS, + paddingSM: mergedToken.sizeSM, + padding: mergedToken.size, + paddingMD: mergedToken.sizeMD, + paddingLG: mergedToken.sizeLG, + paddingXL: mergedToken.sizeXL, + paddingContentHorizontalLG: mergedToken.sizeLG, + paddingContentVerticalLG: mergedToken.sizeMS, + paddingContentHorizontal: mergedToken.sizeMS, + paddingContentVertical: mergedToken.sizeSM, + paddingContentHorizontalSM: mergedToken.size, + paddingContentVerticalSM: mergedToken.sizeXS, + marginXXS: mergedToken.sizeXXS, + marginXS: mergedToken.sizeXS, + marginSM: mergedToken.sizeSM, + margin: mergedToken.size, + marginMD: mergedToken.sizeMD, + marginLG: mergedToken.sizeLG, + marginXL: mergedToken.sizeXL, + marginXXL: mergedToken.sizeXXL, + boxShadow: ` + 0 6px 16px 0 rgba(0, 0, 0, 0.08), + 0 3px 6px -4px rgba(0, 0, 0, 0.12), + 0 9px 28px 8px rgba(0, 0, 0, 0.05) + `, + boxShadowSecondary: ` + 0 6px 16px 0 rgba(0, 0, 0, 0.08), + 0 3px 6px -4px rgba(0, 0, 0, 0.12), + 0 9px 28px 8px rgba(0, 0, 0, 0.05) + `, + boxShadowTertiary: ` + 0 1px 2px 0 rgba(0, 0, 0, 0.03), + 0 1px 6px -1px rgba(0, 0, 0, 0.02), + 0 2px 4px 0 rgba(0, 0, 0, 0.02) + `, + screenXS, + screenXSMin: screenXS, + screenXSMax: screenSM - 1, + screenSM, + screenSMMin: screenSM, + screenSMMax: screenMD - 1, + screenMD, + screenMDMin: screenMD, + screenMDMax: screenLG - 1, + screenLG, + screenLGMin: screenLG, + screenLGMax: screenXL - 1, + screenXL, + screenXLMin: screenXL, + screenXLMax: screenXXL - 1, + screenXXL, + screenXXLMin: screenXXL, + boxShadowPopoverArrow: '2px 2px 5px rgba(0, 0, 0, 0.05)', + boxShadowCard: ` + 0 1px 2px -2px ${new FastColor('rgba(0, 0, 0, 0.16)').toRgbString()}, + 0 3px 6px 0 ${new FastColor('rgba(0, 0, 0, 0.12)').toRgbString()}, + 0 5px 12px 4px ${new FastColor('rgba(0, 0, 0, 0.09)').toRgbString()} + `, + boxShadowDrawerRight: ` + -6px 0 16px 0 rgba(0, 0, 0, 0.08), + -3px 0 6px -4px rgba(0, 0, 0, 0.12), + -9px 0 28px 8px rgba(0, 0, 0, 0.05) + `, + boxShadowDrawerLeft: ` + 6px 0 16px 0 rgba(0, 0, 0, 0.08), + 3px 0 6px -4px rgba(0, 0, 0, 0.12), + 9px 0 28px 8px rgba(0, 0, 0, 0.05) + `, + boxShadowDrawerUp: ` + 0 6px 16px 0 rgba(0, 0, 0, 0.08), + 0 3px 6px -4px rgba(0, 0, 0, 0.12), + 0 9px 28px 8px rgba(0, 0, 0, 0.05) + `, + boxShadowDrawerDown: ` + 0 -6px 16px 0 rgba(0, 0, 0, 0.08), + 0 -3px 6px -4px rgba(0, 0, 0, 0.12), + 0 -9px 28px 8px rgba(0, 0, 0, 0.05) + `, + boxShadowTabsOverflowLeft: 'inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)', + boxShadowTabsOverflowRight: 'inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)', + boxShadowTabsOverflowTop: 'inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)', + boxShadowTabsOverflowBottom: 'inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)' + }), overrideTokens); + return aliasToken; +} +var useToken_rest = function(s, e) { + var t = {}; + for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; + if (null != s && "function" == typeof Object.getOwnPropertySymbols) { + for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; + } + return t; +}; +const useToken_unitless = { + lineHeight: true, + lineHeightSM: true, + lineHeightLG: true, + lineHeightHeading1: true, + lineHeightHeading2: true, + lineHeightHeading3: true, + lineHeightHeading4: true, + lineHeightHeading5: true, + opacityLoading: true, + fontWeightStrong: true, + zIndexPopupBase: true, + zIndexBase: true, + opacityImage: true +}; +const useToken_ignore = { + size: true, + sizeSM: true, + sizeLG: true, + sizeMD: true, + sizeXS: true, + sizeXXS: true, + sizeMS: true, + sizeXL: true, + sizeXXL: true, + sizeUnit: true, + sizeStep: true, + motionBase: true, + motionUnit: true +}; +const preserve = { + screenXS: true, + screenXSMin: true, + screenXSMax: true, + screenSM: true, + screenSMMin: true, + screenSMMax: true, + screenMD: true, + screenMDMin: true, + screenMDMax: true, + screenLG: true, + screenLGMin: true, + screenLGMax: true, + screenXL: true, + screenXLMin: true, + screenXLMax: true, + screenXXL: true, + screenXXLMin: true +}; +const useToken_getComputedToken = (originToken, overrideToken, theme)=>{ + const derivativeToken = theme.getDerivativeToken(originToken); + const { override } = overrideToken, components = useToken_rest(overrideToken, [ + "override" + ]); + let mergedDerivativeToken = Object.assign(Object.assign({}, derivativeToken), { + override + }); + mergedDerivativeToken = alias_formatToken(mergedDerivativeToken); + if (components) Object.entries(components).forEach(([key, value])=>{ + const { theme: componentTheme } = value, componentTokens = useToken_rest(value, [ + "theme" + ]); + let mergedComponentToken = componentTokens; + if (componentTheme) mergedComponentToken = useToken_getComputedToken(Object.assign(Object.assign({}, mergedDerivativeToken), componentTokens), { + override: componentTokens + }, componentTheme); + mergedDerivativeToken[key] = mergedComponentToken; + }); + return mergedDerivativeToken; +}; +function useToken_useToken() { + const { token: rootDesignToken, hashed, theme, override, cssVar } = __WEBPACK_EXTERNAL_MODULE_react__["default"].useContext(DesignTokenContext); + const salt = `${es_version}-${hashed || ''}`; + const mergedTheme = theme || default_theme; + const [token, hashId, realToken] = useCacheToken(mergedTheme, [ + themes_seed, + rootDesignToken + ], { + salt, + override, + getComputedToken: useToken_getComputedToken, + formatToken: alias_formatToken, + cssVar: cssVar && { + prefix: cssVar.prefix, + key: cssVar.key, + unitless: useToken_unitless, + ignore: useToken_ignore, + preserve + } + }); + return [ + mergedTheme, + realToken, + hashed ? hashId : '', + token, + cssVar + ]; +} +const { genStyleHooks: genStyleUtils_genStyleHooks, genComponentStyleHook: genStyleUtils_genComponentStyleHook, genSubStyleComponent: genStyleUtils_genSubStyleComponent } = genStyleUtils({ + usePrefix: ()=>{ + const { getPrefixCls, iconPrefixCls } = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(ConfigContext); + const rootPrefixCls = getPrefixCls(); + return { + rootPrefixCls, + iconPrefixCls + }; + }, + useToken: ()=>{ + const [theme, realToken, hashId, token, cssVar] = useToken_useToken(); + return { + theme, + realToken, + hashId, + token, + cssVar + }; + }, + useCSP: ()=>{ + const { csp } = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(ConfigContext); + return null != csp ? csp : {}; + }, + getResetStyles: (token, config)=>{ + var _a; + const linkStyle = genLinkStyle(token); + return [ + linkStyle, + { + '&': linkStyle + }, + genIconStyle(null != (_a = null == config ? void 0 : config.prefix.iconPrefixCls) ? _a : context_defaultIconPrefixCls) + ]; + }, + getCommonStyle: genCommonStyle, + getCompUnitless: ()=>useToken_unitless +}); +const genBaseStyle = (token)=>{ + const { componentCls, contentBg, padding, headerBg, headerPadding, collapseHeaderPaddingSM, collapseHeaderPaddingLG, collapsePanelBorderRadius, lineWidth, lineType, colorBorder, colorText, colorTextHeading, colorTextDisabled, fontSizeLG, lineHeight, lineHeightLG, marginSM, paddingSM, paddingLG, paddingXS, motionDurationSlow, fontSizeIcon, contentPadding, fontHeight, fontHeightLG } = token; + const borderBase = `${util_unit(lineWidth)} ${lineType} ${colorBorder}`; + return { + [componentCls]: Object.assign(Object.assign({}, resetComponent(token)), { + backgroundColor: headerBg, + border: borderBase, + borderRadius: collapsePanelBorderRadius, + '&-rtl': { + direction: 'rtl' + }, + [`& > ${componentCls}-item`]: { + borderBottom: borderBase, + '&:first-child': { + [` + &, + & > ${componentCls}-header`]: { + borderRadius: `${util_unit(collapsePanelBorderRadius)} ${util_unit(collapsePanelBorderRadius)} 0 0` + } + }, + '&:last-child': { + [` + &, + & > ${componentCls}-header`]: { + borderRadius: `0 0 ${util_unit(collapsePanelBorderRadius)} ${util_unit(collapsePanelBorderRadius)}` + } + }, + [`> ${componentCls}-header`]: Object.assign(Object.assign({ + position: 'relative', + display: 'flex', + flexWrap: 'nowrap', + alignItems: 'flex-start', + padding: headerPadding, + color: colorTextHeading, + lineHeight, + cursor: 'pointer', + transition: `all ${motionDurationSlow}, visibility 0s` + }, genFocusStyle(token)), { + [`> ${componentCls}-header-text`]: { + flex: 'auto' + }, + [`${componentCls}-expand-icon`]: { + height: fontHeight, + display: 'flex', + alignItems: 'center', + paddingInlineEnd: marginSM + }, + [`${componentCls}-arrow`]: Object.assign(Object.assign({}, resetIcon()), { + fontSize: fontSizeIcon, + transition: `transform ${motionDurationSlow}`, + svg: { + transition: `transform ${motionDurationSlow}` + } + }), + [`${componentCls}-header-text`]: { + marginInlineEnd: 'auto' + } + }), + [`${componentCls}-collapsible-header`]: { + cursor: 'default', + [`${componentCls}-header-text`]: { + flex: 'none', + cursor: 'pointer' + } + }, + [`${componentCls}-collapsible-icon`]: { + cursor: 'unset', + [`${componentCls}-expand-icon`]: { + cursor: 'pointer' + } + } + }, + [`${componentCls}-content`]: { + color: colorText, + backgroundColor: contentBg, + borderTop: borderBase, + [`& > ${componentCls}-content-box`]: { + padding: contentPadding + }, + '&-hidden': { + display: 'none' + } + }, + '&-small': { + [`> ${componentCls}-item`]: { + [`> ${componentCls}-header`]: { + padding: collapseHeaderPaddingSM, + paddingInlineStart: paddingXS, + [`> ${componentCls}-expand-icon`]: { + marginInlineStart: token.calc(paddingSM).sub(paddingXS).equal() + } + }, + [`> ${componentCls}-content > ${componentCls}-content-box`]: { + padding: paddingSM + } + } + }, + '&-large': { + [`> ${componentCls}-item`]: { + fontSize: fontSizeLG, + lineHeight: lineHeightLG, + [`> ${componentCls}-header`]: { + padding: collapseHeaderPaddingLG, + paddingInlineStart: padding, + [`> ${componentCls}-expand-icon`]: { + height: fontHeightLG, + marginInlineStart: token.calc(paddingLG).sub(padding).equal() + } + }, + [`> ${componentCls}-content > ${componentCls}-content-box`]: { + padding: paddingLG + } + } + }, + [`${componentCls}-item:last-child`]: { + borderBottom: 0, + [`> ${componentCls}-content`]: { + borderRadius: `0 0 ${util_unit(collapsePanelBorderRadius)} ${util_unit(collapsePanelBorderRadius)}` + } + }, + [`& ${componentCls}-item-disabled > ${componentCls}-header`]: { + [` + &, + & > .arrow + `]: { + color: colorTextDisabled, + cursor: 'not-allowed' + } + }, + [`&${componentCls}-icon-position-end`]: { + [`& > ${componentCls}-item`]: { + [`> ${componentCls}-header`]: { + [`${componentCls}-expand-icon`]: { + order: 1, + paddingInlineEnd: 0, + paddingInlineStart: marginSM + } + } + } + } + }) + }; +}; +const genArrowStyle = (token)=>{ + const { componentCls } = token; + const fixedSelector = `> ${componentCls}-item > ${componentCls}-header ${componentCls}-arrow`; + return { + [`${componentCls}-rtl`]: { + [fixedSelector]: { + transform: "rotate(180deg)" + } + } + }; +}; +const genBorderlessStyle = (token)=>{ + const { componentCls, headerBg, borderlessContentPadding, borderlessContentBg, colorBorder } = token; + return { + [`${componentCls}-borderless`]: { + backgroundColor: headerBg, + border: 0, + [`> ${componentCls}-item`]: { + borderBottom: `1px solid ${colorBorder}` + }, + [` + > ${componentCls}-item:last-child, + > ${componentCls}-item:last-child ${componentCls}-header + `]: { + borderRadius: 0 + }, + [`> ${componentCls}-item:last-child`]: { + borderBottom: 0 + }, + [`> ${componentCls}-item > ${componentCls}-content`]: { + backgroundColor: borderlessContentBg, + borderTop: 0 + }, + [`> ${componentCls}-item > ${componentCls}-content > ${componentCls}-content-box`]: { + padding: borderlessContentPadding + } + } + }; +}; +const genGhostStyle = (token)=>{ + const { componentCls, paddingSM } = token; + return { + [`${componentCls}-ghost`]: { + backgroundColor: 'transparent', + border: 0, + [`> ${componentCls}-item`]: { + borderBottom: 0, + [`> ${componentCls}-content`]: { + backgroundColor: 'transparent', + border: 0, + [`> ${componentCls}-content-box`]: { + paddingBlock: paddingSM + } + } + } + } + }; +}; +const prepareComponentToken = (token)=>({ + headerPadding: `${token.paddingSM}px ${token.padding}px`, + headerBg: token.colorFillAlter, + contentPadding: `${token.padding}px 16px`, + contentBg: token.colorBgContainer, + borderlessContentPadding: `${token.paddingXXS}px 16px ${token.padding}px`, + borderlessContentBg: 'transparent' + }); +const collapse_style = genStyleUtils_genStyleHooks('Collapse', (token)=>{ + const collapseToken = statistic_merge(token, { + collapseHeaderPaddingSM: `${util_unit(token.paddingXS)} ${util_unit(token.paddingSM)}`, + collapseHeaderPaddingLG: `${util_unit(token.padding)} ${util_unit(token.paddingLG)}`, + collapsePanelBorderRadius: token.borderRadiusLG + }); + return [ + genBaseStyle(collapseToken), + genBorderlessStyle(collapseToken), + genGhostStyle(collapseToken), + genArrowStyle(collapseToken), + motion_collapse(collapseToken) + ]; +}, prepareComponentToken); +"use client"; +const collapse_Collapse_Collapse = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef((props, ref)=>{ + const { getPrefixCls, direction, expandIcon: contextExpandIcon, className: contextClassName, style: contextStyle } = useComponentConfig('collapse'); + const { prefixCls: customizePrefixCls, className, rootClassName, style, bordered = true, ghost, size: customizeSize, expandIconPosition = 'start', children, destroyInactivePanel, destroyOnHidden, expandIcon } = props; + const mergedSize = hooks_useSize((ctx)=>{ + var _a; + return null != (_a = null != customizeSize ? customizeSize : ctx) ? _a : 'middle'; + }); + const prefixCls = getPrefixCls('collapse', customizePrefixCls); + const rootPrefixCls = getPrefixCls(); + const [wrapCSSVar, hashId, cssVarCls] = collapse_style(prefixCls); + if ('production' !== process.env.NODE_ENV) { + const warning = devUseWarning('Collapse'); + "production" !== process.env.NODE_ENV && warning('left' !== expandIconPosition && 'right' !== expandIconPosition, 'deprecated', '`expandIconPosition` with `left` or `right` is deprecated. Please use `start` or `end` instead.'); + warning.deprecated(!('destroyInactivePanel' in props), 'destroyInactivePanel', 'destroyOnHidden'); + } + const mergedExpandIconPosition = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(()=>{ + if ('left' === expandIconPosition) return 'start'; + return 'right' === expandIconPosition ? 'end' : expandIconPosition; + }, [ + expandIconPosition + ]); + const mergedExpandIcon = null != expandIcon ? expandIcon : contextExpandIcon; + const renderExpandIcon = __WEBPACK_EXTERNAL_MODULE_react__.useCallback((panelProps = {})=>{ + const icon = 'function' == typeof mergedExpandIcon ? mergedExpandIcon(panelProps) : /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(icons_RightOutlined, { + rotate: panelProps.isActive ? 'rtl' === direction ? -90 : 90 : void 0, + "aria-label": panelProps.isActive ? 'expanded' : 'collapsed' + }); + return cloneElement(icon, ()=>{ + var _a; + return { + className: classnames_default()(null == (_a = null == icon ? void 0 : icon.props) ? void 0 : _a.className, `${prefixCls}-arrow`) + }; + }); + }, [ + mergedExpandIcon, + prefixCls + ]); + const collapseClassName = classnames_default()(`${prefixCls}-icon-position-${mergedExpandIconPosition}`, { + [`${prefixCls}-borderless`]: !bordered, + [`${prefixCls}-rtl`]: 'rtl' === direction, + [`${prefixCls}-ghost`]: !!ghost, + [`${prefixCls}-${mergedSize}`]: 'middle' !== mergedSize + }, contextClassName, className, rootClassName, hashId, cssVarCls); + const openMotion = Object.assign(Object.assign({}, _util_motion(rootPrefixCls)), { + motionAppear: false, + leavedClassName: `${prefixCls}-content-hidden` + }); + const items = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(()=>{ + if (children) return toArray(children).map((child, index)=>{ + var _a, _b; + const childProps = child.props; + if (null == childProps ? void 0 : childProps.disabled) { + const key = null != (_a = child.key) ? _a : String(index); + const mergedChildProps = Object.assign(Object.assign({}, omit(child.props, [ + 'disabled' + ])), { + key, + collapsible: null != (_b = childProps.collapsible) ? _b : 'disabled' + }); + return cloneElement(child, mergedChildProps); + } + return child; + }); + return null; + }, [ + children + ]); + return wrapCSSVar(/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(rc_collapse_es, Object.assign({ + ref: ref, + openMotion: openMotion + }, omit(props, [ + 'rootClassName' + ]), { + expandIcon: renderExpandIcon, + prefixCls: prefixCls, + className: collapseClassName, + style: Object.assign(Object.assign({}, contextStyle), style), + destroyInactivePanel: null != destroyOnHidden ? destroyOnHidden : destroyInactivePanel + }), items)); +}); +if ('production' !== process.env.NODE_ENV) collapse_Collapse_Collapse.displayName = 'Collapse'; +const collapse_Collapse = Object.assign(collapse_Collapse_Collapse, { + Panel: collapse_CollapsePanel +}); +"use client"; +const validateMessagesContext = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.createContext)(void 0); +var en_US_locale = { + items_per_page: '/ page', + jump_to: 'Go to', + jump_to_confirm: 'confirm', + page: 'Page', + prev_page: 'Previous Page', + next_page: 'Next Page', + prev_5: 'Previous 5 Pages', + next_5: 'Next 5 Pages', + prev_3: 'Previous 3 Pages', + next_3: 'Next 3 Pages', + page_size: 'Page Size' +}; +const en_US = en_US_locale; +var commonLocale = { + yearFormat: 'YYYY', + dayFormat: 'D', + cellMeridiemFormat: 'A', + monthBeforeYear: true +}; +var locale_en_US_locale = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, commonLocale), {}, { + locale: 'en_US', + today: 'Today', + now: 'Now', + backToToday: 'Back to today', + ok: 'OK', + clear: 'Clear', + week: 'Week', + month: 'Month', + year: 'Year', + timeSelect: 'select time', + dateSelect: 'select date', + weekSelect: 'Choose a week', + monthSelect: 'Choose a month', + yearSelect: 'Choose a year', + decadeSelect: 'Choose a decade', + dateFormat: 'M/D/YYYY', + dateTimeFormat: 'M/D/YYYY HH:mm:ss', + previousMonth: 'Previous month (PageUp)', + nextMonth: 'Next month (PageDown)', + previousYear: 'Last year (Control + left)', + nextYear: 'Next year (Control + right)', + previousDecade: 'Last decade', + nextDecade: 'Next decade', + previousCentury: 'Last century', + nextCentury: 'Next century' +}); +const locale_en_US = locale_en_US_locale; +const time_picker_locale_en_US_locale = { + placeholder: 'Select time', + rangePlaceholder: [ + 'Start time', + 'End time' + ] +}; +const time_picker_locale_en_US = time_picker_locale_en_US_locale; +const date_picker_locale_en_US_locale = { + lang: Object.assign({ + placeholder: 'Select date', + yearPlaceholder: 'Select year', + quarterPlaceholder: 'Select quarter', + monthPlaceholder: 'Select month', + weekPlaceholder: 'Select week', + rangePlaceholder: [ + 'Start date', + 'End date' + ], + rangeYearPlaceholder: [ + 'Start year', + 'End year' + ], + rangeQuarterPlaceholder: [ + 'Start quarter', + 'End quarter' + ], + rangeMonthPlaceholder: [ + 'Start month', + 'End month' + ], + rangeWeekPlaceholder: [ + 'Start week', + 'End week' + ] + }, locale_en_US), + timePickerLocale: Object.assign({}, time_picker_locale_en_US) +}; +const date_picker_locale_en_US = date_picker_locale_en_US_locale; +const calendar_locale_en_US = date_picker_locale_en_US; +const typeTemplate = '${label} is not a valid ${type}'; +const localeValues = { + locale: 'en', + Pagination: en_US, + DatePicker: date_picker_locale_en_US, + TimePicker: time_picker_locale_en_US, + Calendar: calendar_locale_en_US, + global: { + placeholder: 'Please select', + close: 'Close' + }, + Table: { + filterTitle: 'Filter menu', + filterConfirm: 'OK', + filterReset: 'Reset', + filterEmptyText: 'No filters', + filterCheckAll: 'Select all items', + filterSearchPlaceholder: 'Search in filters', + emptyText: 'No data', + selectAll: 'Select current page', + selectInvert: 'Invert current page', + selectNone: 'Clear all data', + selectionAll: 'Select all data', + sortTitle: 'Sort', + expand: 'Expand row', + collapse: 'Collapse row', + triggerDesc: 'Click to sort descending', + triggerAsc: 'Click to sort ascending', + cancelSort: 'Click to cancel sorting' + }, + Tour: { + Next: 'Next', + Previous: 'Previous', + Finish: 'Finish' + }, + Modal: { + okText: 'OK', + cancelText: 'Cancel', + justOkText: 'OK' + }, + Popconfirm: { + okText: 'OK', + cancelText: 'Cancel' + }, + Transfer: { + titles: [ + '', + '' + ], + searchPlaceholder: 'Search here', + itemUnit: 'item', + itemsUnit: 'items', + remove: 'Remove', + selectCurrent: 'Select current page', + removeCurrent: 'Remove current page', + selectAll: 'Select all data', + deselectAll: 'Deselect all data', + removeAll: 'Remove all data', + selectInvert: 'Invert current page' + }, + Upload: { + uploading: 'Uploading...', + removeFile: 'Remove file', + uploadError: 'Upload error', + previewFile: 'Preview file', + downloadFile: 'Download file' + }, + Empty: { + description: 'No data' + }, + Icon: { + icon: 'icon' + }, + Text: { + edit: 'Edit', + copy: 'Copy', + copied: 'Copied', + expand: 'Expand', + collapse: 'Collapse' + }, + Form: { + optional: '(optional)', + defaultValidateMessages: { + default: 'Field validation error for ${label}', + required: 'Please enter ${label}', + enum: '${label} must be one of [${enum}]', + whitespace: '${label} cannot be a blank character', + date: { + format: '${label} date format is invalid', + parse: '${label} cannot be converted to a date', + invalid: '${label} is an invalid date' + }, + types: { + string: typeTemplate, + method: typeTemplate, + array: typeTemplate, + object: typeTemplate, + number: typeTemplate, + date: typeTemplate, + boolean: typeTemplate, + integer: typeTemplate, + float: typeTemplate, + regexp: typeTemplate, + email: typeTemplate, + url: typeTemplate, + hex: typeTemplate + }, + string: { + len: '${label} must be ${len} characters', + min: '${label} must be at least ${min} characters', + max: '${label} must be up to ${max} characters', + range: '${label} must be between ${min}-${max} characters' + }, + number: { + len: '${label} must be equal to ${len}', + min: '${label} must be minimum ${min}', + max: '${label} must be maximum ${max}', + range: '${label} must be between ${min}-${max}' + }, + array: { + len: 'Must be ${len} ${label}', + min: 'At least ${min} ${label}', + max: 'At most ${max} ${label}', + range: 'The amount of ${label} must be between ${min}-${max}' + }, + pattern: { + mismatch: '${label} does not match the pattern ${pattern}' + } + } + }, + Image: { + preview: 'Preview' + }, + QRCode: { + expired: 'QR code expired', + refresh: 'Refresh', + scanned: 'Scanned' + }, + ColorPicker: { + presetEmpty: 'Empty', + transparent: 'Transparent', + singleColor: 'Single', + gradientColor: 'Gradient' + } +}; +const es_locale_en_US = localeValues; +Object.assign({}, es_locale_en_US.Modal); +let localeList = []; +const generateLocale = ()=>localeList.reduce((merged, locale)=>Object.assign(Object.assign({}, merged), locale), es_locale_en_US.Modal); +function changeConfirmLocale(newLocale) { + if (newLocale) { + const cloneLocale = Object.assign({}, newLocale); + localeList.push(cloneLocale); + generateLocale(); + return ()=>{ + localeList = localeList.filter((locale)=>locale !== cloneLocale); + generateLocale(); + }; + } + Object.assign({}, es_locale_en_US.Modal); +} +const LocaleContext = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.createContext)(void 0); +const locale_context = LocaleContext; +"use client"; +const ANT_MARK = 'internalMark'; +const LocaleProvider = (props)=>{ + const { locale = {}, children, _ANT_MARK__ } = props; + if ('production' !== process.env.NODE_ENV) { + const warning = devUseWarning('LocaleProvider'); + "production" !== process.env.NODE_ENV && warning(_ANT_MARK__ === ANT_MARK, 'deprecated', '`LocaleProvider` is deprecated. Please use `locale` with `ConfigProvider` instead: http://u.ant.design/locale'); + } + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(()=>{ + const clearLocale = changeConfirmLocale(null == locale ? void 0 : locale.Modal); + return clearLocale; + }, [ + locale + ]); + const getMemoizedContextValue = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(()=>Object.assign(Object.assign({}, locale), { + exist: true + }), [ + locale + ]); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(locale_context.Provider, { + value: getMemoizedContextValue + }, children); +}; +if ('production' !== process.env.NODE_ENV) LocaleProvider.displayName = 'LocaleProvider'; +const es_locale = LocaleProvider; +const dynamicStyleMark = `-ant-${Date.now()}-${Math.random()}`; +function getStyle(globalPrefixCls, theme) { + const variables = {}; + const formatColor = (color, updater)=>{ + let clone = color.clone(); + clone = (null == updater ? void 0 : updater(clone)) || clone; + return clone.toRgbString(); + }; + const fillColor = (colorVal, type)=>{ + const baseColor = new FastColor(colorVal); + const colorPalettes = generate(baseColor.toRgbString()); + variables[`${type}-color`] = formatColor(baseColor); + variables[`${type}-color-disabled`] = colorPalettes[1]; + variables[`${type}-color-hover`] = colorPalettes[4]; + variables[`${type}-color-active`] = colorPalettes[6]; + variables[`${type}-color-outline`] = baseColor.clone().setA(0.2).toRgbString(); + variables[`${type}-color-deprecated-bg`] = colorPalettes[0]; + variables[`${type}-color-deprecated-border`] = colorPalettes[2]; + }; + if (theme.primaryColor) { + fillColor(theme.primaryColor, 'primary'); + const primaryColor = new FastColor(theme.primaryColor); + const primaryColors = generate(primaryColor.toRgbString()); + primaryColors.forEach((color, index)=>{ + variables[`primary-${index + 1}`] = color; + }); + variables['primary-color-deprecated-l-35'] = formatColor(primaryColor, (c)=>c.lighten(35)); + variables['primary-color-deprecated-l-20'] = formatColor(primaryColor, (c)=>c.lighten(20)); + variables['primary-color-deprecated-t-20'] = formatColor(primaryColor, (c)=>c.tint(20)); + variables['primary-color-deprecated-t-50'] = formatColor(primaryColor, (c)=>c.tint(50)); + variables['primary-color-deprecated-f-12'] = formatColor(primaryColor, (c)=>c.setA(0.12 * c.a)); + const primaryActiveColor = new FastColor(primaryColors[0]); + variables['primary-color-active-deprecated-f-30'] = formatColor(primaryActiveColor, (c)=>c.setA(0.3 * c.a)); + variables['primary-color-active-deprecated-d-02'] = formatColor(primaryActiveColor, (c)=>c.darken(2)); + } + if (theme.successColor) fillColor(theme.successColor, 'success'); + if (theme.warningColor) fillColor(theme.warningColor, 'warning'); + if (theme.errorColor) fillColor(theme.errorColor, 'error'); + if (theme.infoColor) fillColor(theme.infoColor, 'info'); + const cssList = Object.keys(variables).map((key)=>`--${globalPrefixCls}-${key}: ${variables[key]};`); + return ` + :root { + ${cssList.join('\n')} + } + `.trim(); +} +function registerTheme(globalPrefixCls, theme) { + const style = getStyle(globalPrefixCls, theme); + if (canUseDom_canUseDom()) dynamicCSS_updateCSS(style, `${dynamicStyleMark}-dynamic-theme`); + else "production" !== process.env.NODE_ENV && _util_warning(false, 'ConfigProvider', 'SSR do not support dynamic theme with css variables.'); +} +"use client"; +const DisabledContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext(false); +const DisabledContextProvider = ({ children, disabled })=>{ + const originDisabled = __WEBPACK_EXTERNAL_MODULE_react__.useContext(DisabledContext); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(DisabledContext.Provider, { + value: null != disabled ? disabled : originDisabled + }, children); +}; +const config_provider_DisabledContext = DisabledContext; +function useConfig() { + const componentDisabled = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(config_provider_DisabledContext); + const componentSize = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(SizeContext); + return { + componentDisabled, + componentSize + }; +} +const hooks_useConfig = useConfig; +const useThemeKey_fullClone = Object.assign({}, __WEBPACK_EXTERNAL_MODULE_react__); +const { useId } = useThemeKey_fullClone; +const useEmptyId = ()=>''; +const useThemeKey_useThemeKey = void 0 === useId ? useEmptyId : useId; +const useThemeKey = useThemeKey_useThemeKey; +function useTheme(theme, parentTheme, config) { + var _a, _b; + const warning = devUseWarning('ConfigProvider'); + const themeConfig = theme || {}; + const parentThemeConfig = false !== themeConfig.inherit && parentTheme ? parentTheme : Object.assign(Object.assign({}, defaultConfig), { + hashed: null != (_a = null == parentTheme ? void 0 : parentTheme.hashed) ? _a : defaultConfig.hashed, + cssVar: null == parentTheme ? void 0 : parentTheme.cssVar + }); + const themeKey = useThemeKey(); + if ('production' !== process.env.NODE_ENV) { + const cssVarEnabled = themeConfig.cssVar || parentThemeConfig.cssVar; + const validKey = !!('object' == typeof themeConfig.cssVar && (null == (_b = themeConfig.cssVar) ? void 0 : _b.key) || themeKey); + "production" !== process.env.NODE_ENV && warning(!cssVarEnabled || validKey, 'breaking', 'Missing key in `cssVar` config. Please upgrade to React 18 or set `cssVar.key` manually in each ConfigProvider inside `cssVar` enabled ConfigProvider.'); + } + return useMemo_useMemo(()=>{ + var _a, _b; + if (!theme) return parentTheme; + const mergedComponents = Object.assign({}, parentThemeConfig.components); + Object.keys(theme.components || {}).forEach((componentName)=>{ + mergedComponents[componentName] = Object.assign(Object.assign({}, mergedComponents[componentName]), theme.components[componentName]); + }); + const cssVarKey = `css-var-${themeKey.replace(/:/g, '')}`; + const mergedCssVar = (null != (_a = themeConfig.cssVar) ? _a : parentThemeConfig.cssVar) && Object.assign(Object.assign(Object.assign({ + prefix: null == config ? void 0 : config.prefixCls + }, 'object' == typeof parentThemeConfig.cssVar ? parentThemeConfig.cssVar : {}), 'object' == typeof themeConfig.cssVar ? themeConfig.cssVar : {}), { + key: 'object' == typeof themeConfig.cssVar && (null == (_b = themeConfig.cssVar) ? void 0 : _b.key) || cssVarKey + }); + return Object.assign(Object.assign(Object.assign({}, parentThemeConfig), themeConfig), { + token: Object.assign(Object.assign({}, parentThemeConfig.token), themeConfig.token), + components: mergedComponents, + cssVar: mergedCssVar + }); + }, [ + themeConfig, + parentThemeConfig + ], (prev, next)=>prev.some((prevTheme, index)=>{ + const nextTheme = next[index]; + return !es_isEqual(prevTheme, nextTheme, true); + })); +} +"use client"; +const MotionCacheContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext(true); +if ('production' !== process.env.NODE_ENV) MotionCacheContext.displayName = 'MotionCacheContext'; +function MotionWrapper(props) { + const parentMotion = __WEBPACK_EXTERNAL_MODULE_react__.useContext(MotionCacheContext); + const { children } = props; + const [, token] = useToken_useToken(); + const { motion } = token; + const needWrapMotionProviderRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(false); + needWrapMotionProviderRef.current || (needWrapMotionProviderRef.current = parentMotion !== motion); + if (needWrapMotionProviderRef.current) return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(MotionCacheContext.Provider, { + value: motion + }, /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(MotionProvider, { + motion: motion + }, children)); + return children; +} +"use client"; +const PropWarning_PropWarning = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.memo(({ dropdownMatchSelectWidth })=>{ + const warning = devUseWarning('ConfigProvider'); + warning.deprecated(void 0 === dropdownMatchSelectWidth, 'dropdownMatchSelectWidth', 'popupMatchSelectWidth'); + return null; +}); +if ('production' !== process.env.NODE_ENV) PropWarning_PropWarning.displayName = 'PropWarning'; +const PropWarning = 'production' !== process.env.NODE_ENV ? PropWarning_PropWarning : ()=>null; +const useResetIconStyle = (iconPrefixCls, csp)=>{ + const [theme, token] = useToken_useToken(); + return useStyleRegister({ + theme, + token, + hashId: '', + path: [ + 'ant-design-icons', + iconPrefixCls + ], + nonce: ()=>null == csp ? void 0 : csp.nonce, + layer: { + name: 'antd' + } + }, ()=>[ + genIconStyle(iconPrefixCls) + ]); +}; +const util_useResetIconStyle = useResetIconStyle; +"use client"; +var config_provider_rest = function(s, e) { + var t = {}; + for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; + if (null != s && "function" == typeof Object.getOwnPropertySymbols) { + for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; + } + return t; +}; +let existThemeConfig = false; +process.env.NODE_ENV; +const PASSED_PROPS = [ + 'getTargetContainer', + 'getPopupContainer', + 'renderEmpty', + 'input', + 'pagination', + 'form', + 'select', + 'button' +]; +let config_provider_globalPrefixCls; +function getGlobalPrefixCls() { + return config_provider_globalPrefixCls || defaultPrefixCls; +} +function isLegacyTheme(theme) { + return Object.keys(theme).some((key)=>key.endsWith('Color')); +} +const setGlobalConfig = (props)=>{ + const { prefixCls, iconPrefixCls, theme, holderRender } = props; + if (void 0 !== prefixCls) config_provider_globalPrefixCls = prefixCls; + if (theme) { + if (isLegacyTheme(theme)) { + "production" !== process.env.NODE_ENV && _util_warning(false, 'ConfigProvider', '`config` of css variable theme is not work in v5. Please use new `theme` config instead.'); + registerTheme(getGlobalPrefixCls(), theme); + } + } +}; +const ProviderChildren = (props)=>{ + const { children, csp: customCsp, autoInsertSpaceInButton, alert, anchor, form, locale, componentSize, direction, space, splitter, virtual, dropdownMatchSelectWidth, popupMatchSelectWidth, popupOverflow, legacyLocale, parentContext, iconPrefixCls: customIconPrefixCls, theme, componentDisabled, segmented, statistic, spin, calendar, carousel, cascader, collapse, typography, checkbox, descriptions, divider, drawer, skeleton, steps, image, layout, list, mentions, modal, progress, result, slider, breadcrumb, menu, pagination, input, textArea, empty, badge, radio, rate, switch: SWITCH, transfer, avatar, message, tag, table, card, tabs, timeline, timePicker, upload, notification, tree, colorPicker, datePicker, rangePicker, flex, wave, dropdown, warning: warningConfig, tour, tooltip, popover, popconfirm, floatButtonGroup, variant, inputNumber, treeSelect } = props; + const getPrefixCls = __WEBPACK_EXTERNAL_MODULE_react__.useCallback((suffixCls, customizePrefixCls)=>{ + const { prefixCls } = props; + if (customizePrefixCls) return customizePrefixCls; + const mergedPrefixCls = prefixCls || parentContext.getPrefixCls(''); + return suffixCls ? `${mergedPrefixCls}-${suffixCls}` : mergedPrefixCls; + }, [ + parentContext.getPrefixCls, + props.prefixCls + ]); + const iconPrefixCls = customIconPrefixCls || parentContext.iconPrefixCls || context_defaultIconPrefixCls; + const csp = customCsp || parentContext.csp; + util_useResetIconStyle(iconPrefixCls, csp); + const mergedTheme = useTheme(theme, parentContext.theme, { + prefixCls: getPrefixCls('') + }); + if ('production' !== process.env.NODE_ENV) existThemeConfig = existThemeConfig || !!mergedTheme; + const baseConfig = { + csp, + autoInsertSpaceInButton, + alert, + anchor, + locale: locale || legacyLocale, + direction, + space, + splitter, + virtual, + popupMatchSelectWidth: null != popupMatchSelectWidth ? popupMatchSelectWidth : dropdownMatchSelectWidth, + popupOverflow, + getPrefixCls, + iconPrefixCls, + theme: mergedTheme, + segmented, + statistic, + spin, + calendar, + carousel, + cascader, + collapse, + typography, + checkbox, + descriptions, + divider, + drawer, + skeleton, + steps, + image, + input, + textArea, + layout, + list, + mentions, + modal, + progress, + result, + slider, + breadcrumb, + menu, + pagination, + empty, + badge, + radio, + rate, + switch: SWITCH, + transfer, + avatar, + message, + tag, + table, + card, + tabs, + timeline, + timePicker, + upload, + notification, + tree, + colorPicker, + datePicker, + rangePicker, + flex, + wave, + dropdown, + warning: warningConfig, + tour, + tooltip, + popover, + popconfirm, + floatButtonGroup, + variant, + inputNumber, + treeSelect + }; + if ('production' !== process.env.NODE_ENV) { + const warningFn = devUseWarning('ConfigProvider'); + warningFn(!('autoInsertSpaceInButton' in props), 'deprecated', '`autoInsertSpaceInButton` is deprecated. Please use `{ button: { autoInsertSpace: boolean }}` instead.'); + } + const config = Object.assign({}, parentContext); + Object.keys(baseConfig).forEach((key)=>{ + if (void 0 !== baseConfig[key]) config[key] = baseConfig[key]; + }); + PASSED_PROPS.forEach((propName)=>{ + const propValue = props[propName]; + if (propValue) config[propName] = propValue; + }); + if (void 0 !== autoInsertSpaceInButton) config.button = Object.assign({ + autoInsertSpace: autoInsertSpaceInButton + }, config.button); + const memoedConfig = useMemo_useMemo(()=>config, config, (prevConfig, currentConfig)=>{ + const prevKeys = Object.keys(prevConfig); + const currentKeys = Object.keys(currentConfig); + return prevKeys.length !== currentKeys.length || prevKeys.some((key)=>prevConfig[key] !== currentConfig[key]); + }); + const { layer } = __WEBPACK_EXTERNAL_MODULE_react__.useContext(StyleContext); + const memoIconContextValue = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(()=>({ + prefixCls: iconPrefixCls, + csp, + layer: layer ? 'antd' : void 0 + }), [ + iconPrefixCls, + csp, + layer + ]); + let childNode = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(__WEBPACK_EXTERNAL_MODULE_react__.Fragment, null, /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(PropWarning, { + dropdownMatchSelectWidth: dropdownMatchSelectWidth + }), children); + const validateMessages = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(()=>{ + var _a, _b, _c, _d; + return merge((null == (_a = es_locale_en_US.Form) ? void 0 : _a.defaultValidateMessages) || {}, (null == (_c = null == (_b = memoedConfig.locale) ? void 0 : _b.Form) ? void 0 : _c.defaultValidateMessages) || {}, (null == (_d = memoedConfig.form) ? void 0 : _d.validateMessages) || {}, (null == form ? void 0 : form.validateMessages) || {}); + }, [ + memoedConfig, + null == form ? void 0 : form.validateMessages + ]); + if (Object.keys(validateMessages).length > 0) childNode = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(validateMessagesContext.Provider, { + value: validateMessages + }, childNode); + if (locale) childNode = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(es_locale, { + locale: locale, + _ANT_MARK__: ANT_MARK + }, childNode); + if (iconPrefixCls || csp) childNode = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(components_Context.Provider, { + value: memoIconContextValue + }, childNode); + if (componentSize) childNode = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(SizeContextProvider, { + size: componentSize + }, childNode); + childNode = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(MotionWrapper, null, childNode); + const memoTheme = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(()=>{ + const _a = mergedTheme || {}, { algorithm, token, components, cssVar } = _a, rest = config_provider_rest(_a, [ + "algorithm", + "token", + "components", + "cssVar" + ]); + const themeObj = algorithm && (!Array.isArray(algorithm) || algorithm.length > 0) ? createTheme(algorithm) : default_theme; + const parsedComponents = {}; + Object.entries(components || {}).forEach(([componentName, componentToken])=>{ + const parsedToken = Object.assign({}, componentToken); + if ('algorithm' in parsedToken) { + if (true === parsedToken.algorithm) parsedToken.theme = themeObj; + else if (Array.isArray(parsedToken.algorithm) || 'function' == typeof parsedToken.algorithm) parsedToken.theme = createTheme(parsedToken.algorithm); + delete parsedToken.algorithm; + } + parsedComponents[componentName] = parsedToken; + }); + const mergedToken = Object.assign(Object.assign({}, themes_seed), token); + return Object.assign(Object.assign({}, rest), { + theme: themeObj, + token: mergedToken, + components: parsedComponents, + override: Object.assign({ + override: mergedToken + }, parsedComponents), + cssVar: cssVar + }); + }, [ + mergedTheme + ]); + if (theme) childNode = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(DesignTokenContext.Provider, { + value: memoTheme + }, childNode); + if (memoedConfig.warning) childNode = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(WarningContext.Provider, { + value: memoedConfig.warning + }, childNode); + if (void 0 !== componentDisabled) childNode = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(DisabledContextProvider, { + disabled: componentDisabled + }, childNode); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(ConfigContext.Provider, { + value: memoedConfig + }, childNode); +}; +const ConfigProvider = (props)=>{ + const context = __WEBPACK_EXTERNAL_MODULE_react__.useContext(ConfigContext); + const antLocale = __WEBPACK_EXTERNAL_MODULE_react__.useContext(locale_context); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(ProviderChildren, Object.assign({ + parentContext: context, + legacyLocale: antLocale + }, props)); +}; +ConfigProvider.ConfigContext = ConfigContext; +ConfigProvider.SizeContext = SizeContext; +ConfigProvider.config = setGlobalConfig; +ConfigProvider.useConfig = hooks_useConfig; +Object.defineProperty(ConfigProvider, 'SizeContext', { + get: ()=>{ + "production" !== process.env.NODE_ENV && _util_warning(false, 'ConfigProvider', 'ConfigProvider.SizeContext is deprecated. Please use `ConfigProvider.useConfig().componentSize` instead.'); + return SizeContext; + } +}); +if ('production' !== process.env.NODE_ENV) ConfigProvider.displayName = 'ConfigProvider'; +const config_provider = ConfigProvider; +const PresetColors = [ + 'blue', + 'purple', + 'cyan', + 'green', + 'magenta', + 'pink', + 'red', + 'orange', + 'yellow', + 'volcano', + 'geekblue', + 'lime', + 'gold' +]; +const inverseColors = PresetColors.map((color)=>`${color}-inverse`); +const PresetStatusColorTypes = [ + 'success', + 'processing', + 'error', + 'default', + 'warning' +]; +function isPresetColor(color, includeInverse = true) { + if (includeInverse) return [].concat(_toConsumableArray(inverseColors), _toConsumableArray(PresetColors)).includes(color); + return PresetColors.includes(color); +} +function isPresetStatusColor(color) { + return PresetStatusColorTypes.includes(color); +} +var CloseOutlined_CloseOutlined = { + icon: { + tag: "svg", + attrs: { + "fill-rule": "evenodd", + viewBox: "64 64 896 896", + focusable: "false" + }, + children: [ + { + tag: "path", + attrs: { + d: "M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z" + } + } + ] + }, + name: "close", + theme: "outlined" +}; +const asn_CloseOutlined = CloseOutlined_CloseOutlined; +var icons_CloseOutlined_CloseOutlined = function(props, ref) { + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(AntdIcon, _extends({}, props, { + ref: ref, + icon: asn_CloseOutlined + })); +}; +var CloseOutlined_RefIcon = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef(icons_CloseOutlined_CloseOutlined); +if ('production' !== process.env.NODE_ENV) CloseOutlined_RefIcon.displayName = 'CloseOutlined'; +const icons_CloseOutlined = CloseOutlined_RefIcon; +const useLocale = (componentName, defaultLocale)=>{ + const fullLocale = __WEBPACK_EXTERNAL_MODULE_react__.useContext(locale_context); + const getLocale = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(()=>{ + var _a; + const locale = defaultLocale || es_locale_en_US[componentName]; + const localeFromContext = null != (_a = null == fullLocale ? void 0 : fullLocale[componentName]) ? _a : {}; + return Object.assign(Object.assign({}, 'function' == typeof locale ? locale() : locale), localeFromContext || {}); + }, [ + componentName, + defaultLocale, + fullLocale + ]); + const getLocaleCode = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(()=>{ + const localeCode = null == fullLocale ? void 0 : fullLocale.locale; + if ((null == fullLocale ? void 0 : fullLocale.exist) && !localeCode) return es_locale_en_US.locale; + return localeCode; + }, [ + fullLocale + ]); + return [ + getLocale, + getLocaleCode + ]; +}; +const locale_useLocale = useLocale; +function mergeProps(...items) { + const ret = {}; + items.forEach((item)=>{ + if (item) Object.keys(item).forEach((key)=>{ + if (void 0 !== item[key]) ret[key] = item[key]; + }); + }); + return ret; +} +const extendsObject = mergeProps; +"use client"; +function pickClosable(context) { + if (!context) return; + return { + closable: context.closable, + closeIcon: context.closeIcon + }; +} +function useClosableConfig(closableCollection) { + const { closable, closeIcon } = closableCollection || {}; + return __WEBPACK_EXTERNAL_MODULE_react__["default"].useMemo(()=>{ + if (!closable && (false === closable || false === closeIcon || null === closeIcon)) return false; + if (void 0 === closable && void 0 === closeIcon) return null; + let closableConfig = { + closeIcon: 'boolean' != typeof closeIcon && null !== closeIcon ? closeIcon : void 0 + }; + if (closable && 'object' == typeof closable) closableConfig = Object.assign(Object.assign({}, closableConfig), closable); + return closableConfig; + }, [ + closable, + closeIcon + ]); +} +const EmptyFallbackCloseCollection = {}; +function useClosable(propCloseCollection, contextCloseCollection, fallbackCloseCollection = EmptyFallbackCloseCollection) { + const propCloseConfig = useClosableConfig(propCloseCollection); + const contextCloseConfig = useClosableConfig(contextCloseCollection); + const [contextLocale] = locale_useLocale('global', es_locale_en_US.global); + const closeBtnIsDisabled = 'boolean' != typeof propCloseConfig ? !!(null == propCloseConfig ? void 0 : propCloseConfig.disabled) : false; + const mergedFallbackCloseCollection = __WEBPACK_EXTERNAL_MODULE_react__["default"].useMemo(()=>Object.assign({ + closeIcon: /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement(icons_CloseOutlined, null) + }, fallbackCloseCollection), [ + fallbackCloseCollection + ]); + const mergedClosableConfig = __WEBPACK_EXTERNAL_MODULE_react__["default"].useMemo(()=>{ + if (false === propCloseConfig) return false; + if (propCloseConfig) return extendsObject(mergedFallbackCloseCollection, contextCloseConfig, propCloseConfig); + if (false === contextCloseConfig) return false; + if (contextCloseConfig) return extendsObject(mergedFallbackCloseCollection, contextCloseConfig); + return mergedFallbackCloseCollection.closable ? mergedFallbackCloseCollection : false; + }, [ + propCloseConfig, + contextCloseConfig, + mergedFallbackCloseCollection + ]); + return __WEBPACK_EXTERNAL_MODULE_react__["default"].useMemo(()=>{ + if (false === mergedClosableConfig) return [ + false, + null, + closeBtnIsDisabled, + {} + ]; + const { closeIconRender } = mergedFallbackCloseCollection; + const { closeIcon } = mergedClosableConfig; + let mergedCloseIcon = closeIcon; + const ariaOrDataProps = pickAttrs(mergedClosableConfig, true); + if (null != mergedCloseIcon) { + if (closeIconRender) mergedCloseIcon = closeIconRender(closeIcon); + mergedCloseIcon = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].isValidElement(mergedCloseIcon) ? /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].cloneElement(mergedCloseIcon, Object.assign({ + 'aria-label': contextLocale.close + }, ariaOrDataProps)) : /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement("span", Object.assign({ + "aria-label": contextLocale.close + }, ariaOrDataProps), mergedCloseIcon); + } + return [ + true, + mergedCloseIcon, + closeBtnIsDisabled, + ariaOrDataProps + ]; + }, [ + mergedClosableConfig, + mergedFallbackCloseCollection + ]); +} +const isVisible = function(element) { + if (!element) return false; + if (element instanceof Element) { + if (element.offsetParent) return true; + if (element.getBBox) { + var _getBBox = element.getBBox(), width = _getBBox.width, height = _getBBox.height; + if (width || height) return true; + } + if (element.getBoundingClientRect) { + var _element$getBoundingC = element.getBoundingClientRect(), _width = _element$getBoundingC.width, _height = _element$getBoundingC.height; + if (_width || _height) return true; + } + } + return false; +}; +const genWaveStyle = (token)=>{ + const { componentCls, colorPrimary } = token; + return { + [componentCls]: { + position: 'absolute', + background: 'transparent', + pointerEvents: 'none', + boxSizing: 'border-box', + color: `var(--wave-color, ${colorPrimary})`, + boxShadow: "0 0 0 0 currentcolor", + opacity: 0.2, + '&.wave-motion-appear': { + transition: [ + `box-shadow 0.4s ${token.motionEaseOutCirc}`, + `opacity 2s ${token.motionEaseOutCirc}` + ].join(','), + '&-active': { + boxShadow: "0 0 0 6px currentcolor", + opacity: 0 + }, + '&.wave-quick': { + transition: [ + `box-shadow ${token.motionDurationSlow} ${token.motionEaseInOut}`, + `opacity ${token.motionDurationSlow} ${token.motionEaseInOut}` + ].join(',') + } + } + } + }; +}; +const wave_style = genStyleUtils_genComponentStyleHook('Wave', (token)=>[ + genWaveStyle(token) + ]); +const TARGET_CLS = `${defaultPrefixCls}-wave-target`; +function regeneratorRuntime_regeneratorRuntime() { + "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ + regeneratorRuntime_regeneratorRuntime = function() { + return e; + }; + var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function(t, e, r) { + t[e] = r.value; + }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; + function define1(t, e, r) { + return Object.defineProperty(t, e, { + value: r, + enumerable: !0, + configurable: !0, + writable: !0 + }), t[e]; + } + try { + define1({}, ""); + } catch (t) { + define1 = function(t, e, r) { + return t[e] = r; + }; + } + function wrap(t, e, r, n) { + var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); + return o(a, "_invoke", { + value: makeInvokeMethod(t, r, c) + }), a; + } + function tryCatch(t, e, r) { + try { + return { + type: "normal", + arg: t.call(e, r) + }; + } catch (t) { + return { + type: "throw", + arg: t + }; + } + } + e.wrap = wrap; + var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + var p = {}; + define1(p, a, function() { + return this; + }); + var d = Object.getPrototypeOf, v = d && d(d(values([]))); + v && v !== r && n.call(v, a) && (p = v); + var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); + function defineIteratorMethods(t) { + [ + "next", + "throw", + "return" + ].forEach(function(e) { + define1(t, e, function(t) { + return this._invoke(e, t); + }); + }); + } + function AsyncIterator(t, e) { + function invoke(r, o, i, a) { + var c = tryCatch(t[r], t, o); + if ("throw" !== c.type) { + var u = c.arg, h = u.value; + return h && "object" == typeof_typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function(t) { + invoke("next", t, i, a); + }, function(t) { + invoke("throw", t, i, a); + }) : e.resolve(h).then(function(t) { + u.value = t, i(u); + }, function(t) { + return invoke("throw", t, i, a); + }); + } + a(c.arg); + } + var r; + o(this, "_invoke", { + value: function(t, n) { + function callInvokeWithMethodAndArg() { + return new e(function(e, r) { + invoke(t, n, e, r); + }); + } + return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } + }); + } + function makeInvokeMethod(e, r, n) { + var o = h; + return function(i, a) { + if (o === f) throw Error("Generator is already running"); + if (o === s) { + if ("throw" === i) throw a; + return { + value: t, + done: !0 + }; + } + for(n.method = i, n.arg = a;;){ + var c = n.delegate; + if (c) { + var u = maybeInvokeDelegate(c, n); + if (u) { + if (u === y) continue; + return u; + } + } + if ("next" === n.method) n.sent = n._sent = n.arg; + else if ("throw" === n.method) { + if (o === h) throw o = s, n.arg; + n.dispatchException(n.arg); + } else "return" === n.method && n.abrupt("return", n.arg); + o = f; + var p = tryCatch(e, r, n); + if ("normal" === p.type) { + if (o = n.done ? s : l, p.arg === y) continue; + return { + value: p.arg, + done: n.done + }; + } + "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); + } + }; + } + function maybeInvokeDelegate(e, r) { + var n = r.method, o = e.iterator[n]; + if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; + var i = tryCatch(o, e.iterator, r.arg); + if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; + var a = i.arg; + return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); + } + function pushTryEntry(t) { + var e = { + tryLoc: t[0] + }; + 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); + } + function resetTryEntry(t) { + var e = t.completion || {}; + e.type = "normal", delete e.arg, t.completion = e; + } + function Context(t) { + this.tryEntries = [ + { + tryLoc: "root" + } + ], t.forEach(pushTryEntry, this), this.reset(!0); + } + function values(e) { + if (e || "" === e) { + var r = e[a]; + if (r) return r.call(e); + if ("function" == typeof e.next) return e; + if (!isNaN(e.length)) { + var o = -1, i = function next() { + for(; ++o < e.length;)if (n.call(e, o)) return next.value = e[o], next.done = !1, next; + return next.value = t, next.done = !0, next; + }; + return i.next = i; + } + } + throw new TypeError(typeof_typeof(e) + " is not iterable"); + } + return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { + value: GeneratorFunctionPrototype, + configurable: !0 + }), o(GeneratorFunctionPrototype, "constructor", { + value: GeneratorFunction, + configurable: !0 + }), GeneratorFunction.displayName = define1(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function(t) { + var e = "function" == typeof t && t.constructor; + return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); + }, e.mark = function(t) { + return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define1(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; + }, e.awrap = function(t) { + return { + __await: t + }; + }, defineIteratorMethods(AsyncIterator.prototype), define1(AsyncIterator.prototype, c, function() { + return this; + }), e.AsyncIterator = AsyncIterator, e.async = function(t, r, n, o, i) { + void 0 === i && (i = Promise); + var a = new AsyncIterator(wrap(t, r, n, o), i); + return e.isGeneratorFunction(r) ? a : a.next().then(function(t) { + return t.done ? t.value : a.next(); + }); + }, defineIteratorMethods(g), define1(g, u, "Generator"), define1(g, a, function() { + return this; + }), define1(g, "toString", function() { + return "[object Generator]"; + }), e.keys = function(t) { + var e = Object(t), r = []; + for(var n in e)r.push(n); + return r.reverse(), function next() { + for(; r.length;){ + var t = r.pop(); + if (t in e) return next.value = t, next.done = !1, next; + } + return next.done = !0, next; + }; + }, e.values = values, Context.prototype = { + constructor: Context, + reset: function(e) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for(var r in this)"t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); + }, + stop: function() { + this.done = !0; + var t = this.tryEntries[0].completion; + if ("throw" === t.type) throw t.arg; + return this.rval; + }, + dispatchException: function(e) { + if (this.done) throw e; + var r = this; + function handle(n, o) { + return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; + } + for(var o = this.tryEntries.length - 1; o >= 0; --o){ + var i = this.tryEntries[o], a = i.completion; + if ("root" === i.tryLoc) return handle("end"); + if (i.tryLoc <= this.prev) { + var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); + if (c && u) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } else if (c) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + } else { + if (!u) throw Error("try statement without catch or finally"); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } + } + } + }, + abrupt: function(t, e) { + for(var r = this.tryEntries.length - 1; r >= 0; --r){ + var o = this.tryEntries[r]; + if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { + var i = o; + break; + } + } + i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); + var a = i ? i.completion : {}; + return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); + }, + complete: function(t, e) { + if ("throw" === t.type) throw t.arg; + return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; + }, + finish: function(t) { + for(var e = this.tryEntries.length - 1; e >= 0; --e){ + var r = this.tryEntries[e]; + if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; + } + }, + catch: function(t) { + for(var e = this.tryEntries.length - 1; e >= 0; --e){ + var r = this.tryEntries[e]; + if (r.tryLoc === t) { + var n = r.completion; + if ("throw" === n.type) { + var o = n.arg; + resetTryEntry(r); + } + return o; + } + } + throw Error("illegal catch attempt"); + }, + delegateYield: function(e, r, n) { + return this.delegate = { + iterator: values(e), + resultName: r, + nextLoc: n + }, "next" === this.method && (this.arg = t), y; + } + }, e; +} +function asyncGeneratorStep(n, t, e, r, o, a, c) { + try { + var i = n[a](c), u = i.value; + } catch (n) { + return void e(n); + } + i.done ? t(u) : Promise.resolve(u).then(r, o); +} +function _asyncToGenerator(n) { + return function() { + var t = this, e = arguments; + return new Promise(function(r, o) { + var a = n.apply(t, e); + function _next(n) { + asyncGeneratorStep(a, r, o, _next, _throw, "next", n); + } + function _throw(n) { + asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); + } + _next(void 0); + }); + }; +} +var render_fullClone = objectSpread2_objectSpread2({}, __WEBPACK_EXTERNAL_MODULE_react_dom_7136dc57__); +var render_version = render_fullClone.version, render_reactRender = render_fullClone.render, unmountComponentAtNode = render_fullClone.unmountComponentAtNode; +var createRoot; +try { + var mainVersion = Number((render_version || '').split('.')[0]); + if (mainVersion >= 18) createRoot = render_fullClone.createRoot; +} catch (e) {} +function toggleWarning(skip) { + var __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = render_fullClone.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + if (__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED && 'object' === typeof_typeof(__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)) __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint = skip; +} +var MARK = '__rc_react_root__'; +function modernRender(node, container) { + toggleWarning(true); + var root = container[MARK] || createRoot(container); + toggleWarning(false); + root.render(node); + container[MARK] = root; +} +function legacyRender(node, container) { + null == render_reactRender || render_reactRender(node, container); +} +function render_render(node, container) { + if (createRoot) return void modernRender(node, container); + legacyRender(node, container); +} +function modernUnmount(_x) { + return _modernUnmount.apply(this, arguments); +} +function _modernUnmount() { + _modernUnmount = _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime_regeneratorRuntime().mark(function _callee(container) { + return regeneratorRuntime_regeneratorRuntime().wrap(function(_context) { + while(1)switch(_context.prev = _context.next){ + case 0: + return _context.abrupt("return", Promise.resolve().then(function() { + var _container$MARK; + null == (_container$MARK = container[MARK]) || _container$MARK.unmount(); + delete container[MARK]; + })); + case 1: + case "end": + return _context.stop(); + } + }, _callee); + })); + return _modernUnmount.apply(this, arguments); +} +function legacyUnmount(container) { + unmountComponentAtNode(container); +} +function unmount(_x2) { + return _unmount.apply(this, arguments); +} +function _unmount() { + _unmount = _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime_regeneratorRuntime().mark(function _callee2(container) { + return regeneratorRuntime_regeneratorRuntime().wrap(function(_context2) { + while(1)switch(_context2.prev = _context2.next){ + case 0: + if (!(void 0 !== createRoot)) { + _context2.next = 2; + break; + } + return _context2.abrupt("return", modernUnmount(container)); + case 2: + legacyUnmount(container); + case 3: + case "end": + return _context2.stop(); + } + }, _callee2); + })); + return _unmount.apply(this, arguments); +} +"use client"; +const defaultReactRender = (node, container)=>{ + if ('production' !== process.env.NODE_ENV) { + const majorVersion = parseInt(__WEBPACK_EXTERNAL_MODULE_react__.version.split('.')[0], 10); + const fullKeys = Object.keys(__WEBPACK_EXTERNAL_MODULE_react_dom_7136dc57__); + "production" !== process.env.NODE_ENV && _util_warning(majorVersion < 19 || fullKeys.includes('createRoot'), 'compatible', 'antd v5 support React is 16 ~ 18. see https://u.ant.design/v5-for-19 for compatible.'); + } + render_render(node, container); + return ()=>unmount(container); +}; +let unstableRender = defaultReactRender; +function unstableSetRender(render) { + if (render) unstableRender = render; + return unstableRender; +} +function isValidWaveColor(color) { + return color && '#fff' !== color && '#ffffff' !== color && 'rgb(255, 255, 255)' !== color && 'rgba(255, 255, 255, 1)' !== color && !/rgba\((?:\d*, ){3}0\)/.test(color) && 'transparent' !== color; +} +function getTargetWaveColor(node) { + const { borderTopColor, borderColor, backgroundColor } = getComputedStyle(node); + if (isValidWaveColor(borderTopColor)) return borderTopColor; + if (isValidWaveColor(borderColor)) return borderColor; + if (isValidWaveColor(backgroundColor)) return backgroundColor; + return null; +} +"use client"; +function validateNum(value) { + return Number.isNaN(value) ? 0 : value; +} +const WaveEffect = (props)=>{ + const { className, target, component, registerUnmount } = props; + const divRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(null); + const unmountRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(null); + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(()=>{ + unmountRef.current = registerUnmount(); + }, []); + const [color, setWaveColor] = __WEBPACK_EXTERNAL_MODULE_react__.useState(null); + const [borderRadius, setBorderRadius] = __WEBPACK_EXTERNAL_MODULE_react__.useState([]); + const [left, setLeft] = __WEBPACK_EXTERNAL_MODULE_react__.useState(0); + const [top, setTop] = __WEBPACK_EXTERNAL_MODULE_react__.useState(0); + const [width, setWidth] = __WEBPACK_EXTERNAL_MODULE_react__.useState(0); + const [height, setHeight] = __WEBPACK_EXTERNAL_MODULE_react__.useState(0); + const [enabled, setEnabled] = __WEBPACK_EXTERNAL_MODULE_react__.useState(false); + const waveStyle = { + left, + top, + width, + height, + borderRadius: borderRadius.map((radius)=>`${radius}px`).join(' ') + }; + if (color) waveStyle['--wave-color'] = color; + function syncPos() { + const nodeStyle = getComputedStyle(target); + setWaveColor(getTargetWaveColor(target)); + const isStatic = 'static' === nodeStyle.position; + const { borderLeftWidth, borderTopWidth } = nodeStyle; + setLeft(isStatic ? target.offsetLeft : validateNum(-parseFloat(borderLeftWidth))); + setTop(isStatic ? target.offsetTop : validateNum(-parseFloat(borderTopWidth))); + setWidth(target.offsetWidth); + setHeight(target.offsetHeight); + const { borderTopLeftRadius, borderTopRightRadius, borderBottomLeftRadius, borderBottomRightRadius } = nodeStyle; + setBorderRadius([ + borderTopLeftRadius, + borderTopRightRadius, + borderBottomRightRadius, + borderBottomLeftRadius + ].map((radius)=>validateNum(parseFloat(radius)))); + } + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(()=>{ + if (target) { + const id = es_raf(()=>{ + syncPos(); + setEnabled(true); + }); + let resizeObserver; + if ('undefined' != typeof ResizeObserver) { + resizeObserver = new ResizeObserver(syncPos); + resizeObserver.observe(target); + } + return ()=>{ + es_raf.cancel(id); + null == resizeObserver || resizeObserver.disconnect(); + }; + } + }, []); + if (!enabled) return null; + const isSmallComponent = ('Checkbox' === component || 'Radio' === component) && (null == target ? void 0 : target.classList.contains(TARGET_CLS)); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(es, { + visible: true, + motionAppear: true, + motionName: "wave-motion", + motionDeadline: 5000, + onAppearEnd: (_, event)=>{ + var _a, _b; + if (event.deadline || 'opacity' === event.propertyName) { + const holder = null == (_a = divRef.current) ? void 0 : _a.parentElement; + null == (_b = unmountRef.current) || _b.call(unmountRef).then(()=>{ + null == holder || holder.remove(); + }); + } + return false; + } + }, ({ className: motionClassName }, ref)=>/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("div", { + ref: ref_composeRef(divRef, ref), + className: classnames_default()(className, motionClassName, { + 'wave-quick': isSmallComponent + }), + style: waveStyle + })); +}; +const showWaveEffect = (target, info)=>{ + var _a; + const { component } = info; + if ('Checkbox' === component && !(null == (_a = target.querySelector('input')) ? void 0 : _a.checked)) return; + const holder = document.createElement('div'); + holder.style.position = 'absolute'; + holder.style.left = '0px'; + holder.style.top = '0px'; + null == target || target.insertBefore(holder, null == target ? void 0 : target.firstChild); + const reactRender = unstableSetRender(); + let unmountCallback = null; + function registerUnmount() { + return unmountCallback; + } + unmountCallback = reactRender(/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(WaveEffect, Object.assign({}, info, { + target: target, + registerUnmount: registerUnmount + })), holder); +}; +const wave_WaveEffect = showWaveEffect; +const useWave = (nodeRef, className, component)=>{ + const { wave } = __WEBPACK_EXTERNAL_MODULE_react__.useContext(ConfigContext); + const [, token, hashId] = useToken_useToken(); + const showWave = useEvent((event)=>{ + const node = nodeRef.current; + if ((null == wave ? void 0 : wave.disabled) || !node) return; + const targetNode = node.querySelector(`.${TARGET_CLS}`) || node; + const { showEffect } = wave || {}; + (showEffect || wave_WaveEffect)(targetNode, { + className, + token, + component, + event, + hashId + }); + }); + const rafId = __WEBPACK_EXTERNAL_MODULE_react__.useRef(null); + const showDebounceWave = (event)=>{ + es_raf.cancel(rafId.current); + rafId.current = es_raf(()=>{ + showWave(event); + }); + }; + return showDebounceWave; +}; +const wave_useWave = useWave; +const Wave = (props)=>{ + const { children, disabled, component } = props; + const { getPrefixCls } = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(ConfigContext); + const containerRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null); + const prefixCls = getPrefixCls('wave'); + const [, hashId] = wave_style(prefixCls); + const showWave = wave_useWave(containerRef, classnames_default()(prefixCls, hashId), component); + __WEBPACK_EXTERNAL_MODULE_react__["default"].useEffect(()=>{ + const node = containerRef.current; + if (!node || 1 !== node.nodeType || disabled) return; + const onClick = (e)=>{ + if (!isVisible(e.target) || !node.getAttribute || node.getAttribute('disabled') || node.disabled || node.className.includes('disabled') || node.className.includes('-leave')) return; + showWave(e); + }; + node.addEventListener('click', onClick, true); + return ()=>{ + node.removeEventListener('click', onClick, true); + }; + }, [ + disabled + ]); + if (!/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].isValidElement(children)) return null != children ? children : null; + const ref = ref_supportRef(children) ? ref_composeRef(ref_getNodeRef(children), containerRef) : containerRef; + return cloneElement(children, { + ref + }); +}; +if ('production' !== process.env.NODE_ENV) Wave.displayName = 'Wave'; +const _util_wave = Wave; +const style_genBaseStyle = (token)=>{ + const { paddingXXS, lineWidth, tagPaddingHorizontal, componentCls, calc } = token; + const paddingInline = calc(tagPaddingHorizontal).sub(lineWidth).equal(); + const iconMarginInline = calc(paddingXXS).sub(lineWidth).equal(); + return { + [componentCls]: Object.assign(Object.assign({}, resetComponent(token)), { + display: 'inline-block', + height: 'auto', + marginInlineEnd: token.marginXS, + paddingInline, + fontSize: token.tagFontSize, + lineHeight: token.tagLineHeight, + whiteSpace: 'nowrap', + background: token.defaultBg, + border: `${util_unit(token.lineWidth)} ${token.lineType} ${token.colorBorder}`, + borderRadius: token.borderRadiusSM, + opacity: 1, + transition: `all ${token.motionDurationMid}`, + textAlign: 'start', + position: 'relative', + [`&${componentCls}-rtl`]: { + direction: 'rtl' + }, + '&, a, a:hover': { + color: token.defaultColor + }, + [`${componentCls}-close-icon`]: { + marginInlineStart: iconMarginInline, + fontSize: token.tagIconSize, + color: token.colorIcon, + cursor: 'pointer', + transition: `all ${token.motionDurationMid}`, + '&:hover': { + color: token.colorTextHeading + } + }, + [`&${componentCls}-has-color`]: { + borderColor: 'transparent', + [`&, a, a:hover, ${token.iconCls}-close, ${token.iconCls}-close:hover`]: { + color: token.colorTextLightSolid + } + }, + '&-checkable': { + backgroundColor: 'transparent', + borderColor: 'transparent', + cursor: 'pointer', + [`&:not(${componentCls}-checkable-checked):hover`]: { + color: token.colorPrimary, + backgroundColor: token.colorFillSecondary + }, + '&:active, &-checked': { + color: token.colorTextLightSolid + }, + '&-checked': { + backgroundColor: token.colorPrimary, + '&:hover': { + backgroundColor: token.colorPrimaryHover + } + }, + '&:active': { + backgroundColor: token.colorPrimaryActive + } + }, + '&-hidden': { + display: 'none' + }, + [`> ${token.iconCls} + span, > span + ${token.iconCls}`]: { + marginInlineStart: paddingInline + } + }), + [`${componentCls}-borderless`]: { + borderColor: 'transparent', + background: token.tagBorderlessBg + } + }; +}; +const prepareToken = (token)=>{ + const { lineWidth, fontSizeIcon, calc } = token; + const tagFontSize = token.fontSizeSM; + const tagToken = statistic_merge(token, { + tagFontSize, + tagLineHeight: util_unit(calc(token.lineHeightSM).mul(tagFontSize).equal()), + tagIconSize: calc(fontSizeIcon).sub(calc(lineWidth).mul(2)).equal(), + tagPaddingHorizontal: 8, + tagBorderlessBg: token.defaultBg + }); + return tagToken; +}; +const style_prepareComponentToken = (token)=>({ + defaultBg: new FastColor(token.colorFillQuaternary).onBackground(token.colorBgContainer).toHexString(), + defaultColor: token.colorText + }); +const tag_style = genStyleUtils_genStyleHooks('Tag', (token)=>{ + const tagToken = prepareToken(token); + return style_genBaseStyle(tagToken); +}, style_prepareComponentToken); +"use client"; +var CheckableTag_rest = function(s, e) { + var t = {}; + for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; + if (null != s && "function" == typeof Object.getOwnPropertySymbols) { + for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; + } + return t; +}; +const CheckableTag_CheckableTag = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef((props, ref)=>{ + const { prefixCls: customizePrefixCls, style, className, checked, onChange, onClick } = props, restProps = CheckableTag_rest(props, [ + "prefixCls", + "style", + "className", + "checked", + "onChange", + "onClick" + ]); + const { getPrefixCls, tag } = __WEBPACK_EXTERNAL_MODULE_react__.useContext(ConfigContext); + const handleClick = (e)=>{ + null == onChange || onChange(!checked); + null == onClick || onClick(e); + }; + const prefixCls = getPrefixCls('tag', customizePrefixCls); + const [wrapCSSVar, hashId, cssVarCls] = tag_style(prefixCls); + const cls = classnames_default()(prefixCls, `${prefixCls}-checkable`, { + [`${prefixCls}-checkable-checked`]: checked + }, null == tag ? void 0 : tag.className, className, hashId, cssVarCls); + return wrapCSSVar(/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("span", Object.assign({}, restProps, { + ref: ref, + style: Object.assign(Object.assign({}, style), null == tag ? void 0 : tag.style), + className: cls, + onClick: handleClick + }))); +}); +const CheckableTag = CheckableTag_CheckableTag; +function genPresetColor(token, genCss) { + return PresetColors.reduce((prev, colorKey)=>{ + const lightColor = token[`${colorKey}1`]; + const lightBorderColor = token[`${colorKey}3`]; + const darkColor = token[`${colorKey}6`]; + const textColor = token[`${colorKey}7`]; + return Object.assign(Object.assign({}, prev), genCss(colorKey, { + lightColor, + lightBorderColor, + darkColor, + textColor + })); + }, {}); +} +const genPresetStyle = (token)=>genPresetColor(token, (colorKey, { textColor, lightBorderColor, lightColor, darkColor })=>({ + [`${token.componentCls}${token.componentCls}-${colorKey}`]: { + color: textColor, + background: lightColor, + borderColor: lightBorderColor, + '&-inverse': { + color: token.colorTextLightSolid, + background: darkColor, + borderColor: darkColor + }, + [`&${token.componentCls}-borderless`]: { + borderColor: 'transparent' + } + } + })); +const presetCmp = genStyleUtils_genSubStyleComponent([ + 'Tag', + 'preset' +], (token)=>{ + const tagToken = prepareToken(token); + return genPresetStyle(tagToken); +}, style_prepareComponentToken); +function capitalize(str) { + if ('string' != typeof str) return str; + const ret = str.charAt(0).toUpperCase() + str.slice(1); + return ret; +} +const genTagStatusStyle = (token, status, cssVariableType)=>{ + const capitalizedCssVariableType = capitalize(cssVariableType); + return { + [`${token.componentCls}${token.componentCls}-${status}`]: { + color: token[`color${cssVariableType}`], + background: token[`color${capitalizedCssVariableType}Bg`], + borderColor: token[`color${capitalizedCssVariableType}Border`], + [`&${token.componentCls}-borderless`]: { + borderColor: 'transparent' + } + } + }; +}; +const statusCmp = genStyleUtils_genSubStyleComponent([ + 'Tag', + 'status' +], (token)=>{ + const tagToken = prepareToken(token); + return [ + genTagStatusStyle(tagToken, 'success', 'Success'), + genTagStatusStyle(tagToken, 'processing', 'Info'), + genTagStatusStyle(tagToken, 'error', 'Error'), + genTagStatusStyle(tagToken, 'warning', 'Warning') + ]; +}, style_prepareComponentToken); +"use client"; +var tag_rest = function(s, e) { + var t = {}; + for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; + if (null != s && "function" == typeof Object.getOwnPropertySymbols) { + for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; + } + return t; +}; +const InternalTag = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef((tagProps, ref)=>{ + const { prefixCls: customizePrefixCls, className, rootClassName, style, children, icon, color, onClose, bordered = true, visible: deprecatedVisible } = tagProps, props = tag_rest(tagProps, [ + "prefixCls", + "className", + "rootClassName", + "style", + "children", + "icon", + "color", + "onClose", + "bordered", + "visible" + ]); + const { getPrefixCls, direction, tag: tagContext } = __WEBPACK_EXTERNAL_MODULE_react__.useContext(ConfigContext); + const [visible, setVisible] = __WEBPACK_EXTERNAL_MODULE_react__.useState(true); + const domProps = omit(props, [ + 'closeIcon', + 'closable' + ]); + if ('production' !== process.env.NODE_ENV) { + const warning = devUseWarning('Tag'); + warning.deprecated(!('visible' in tagProps), 'visible', 'visible && '); + } + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(()=>{ + if (void 0 !== deprecatedVisible) setVisible(deprecatedVisible); + }, [ + deprecatedVisible + ]); + const isPreset = isPresetColor(color); + const isStatus = isPresetStatusColor(color); + const isInternalColor = isPreset || isStatus; + const tagStyle = Object.assign(Object.assign({ + backgroundColor: color && !isInternalColor ? color : void 0 + }, null == tagContext ? void 0 : tagContext.style), style); + const prefixCls = getPrefixCls('tag', customizePrefixCls); + const [wrapCSSVar, hashId, cssVarCls] = tag_style(prefixCls); + const tagClassName = classnames_default()(prefixCls, null == tagContext ? void 0 : tagContext.className, { + [`${prefixCls}-${color}`]: isInternalColor, + [`${prefixCls}-has-color`]: color && !isInternalColor, + [`${prefixCls}-hidden`]: !visible, + [`${prefixCls}-rtl`]: 'rtl' === direction, + [`${prefixCls}-borderless`]: !bordered + }, className, rootClassName, hashId, cssVarCls); + const handleCloseClick = (e)=>{ + e.stopPropagation(); + null == onClose || onClose(e); + if (e.defaultPrevented) return; + setVisible(false); + }; + const [, mergedCloseIcon] = useClosable(pickClosable(tagProps), pickClosable(tagContext), { + closable: false, + closeIconRender: (iconNode)=>{ + const replacement = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("span", { + className: `${prefixCls}-close-icon`, + onClick: handleCloseClick + }, iconNode); + return replaceElement(iconNode, replacement, (originProps)=>({ + onClick: (e)=>{ + var _a; + null == (_a = null == originProps ? void 0 : originProps.onClick) || _a.call(originProps, e); + handleCloseClick(e); + }, + className: classnames_default()(null == originProps ? void 0 : originProps.className, `${prefixCls}-close-icon`) + })); + } + }); + const isNeedWave = 'function' == typeof props.onClick || children && 'a' === children.type; + const iconNode = icon || null; + const kids = iconNode ? /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(__WEBPACK_EXTERNAL_MODULE_react__.Fragment, null, iconNode, children && /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("span", null, children)) : children; + const tagNode = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("span", Object.assign({}, domProps, { + ref: ref, + className: tagClassName, + style: tagStyle + }), kids, mergedCloseIcon, isPreset && /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(presetCmp, { + key: "preset", + prefixCls: prefixCls + }), isStatus && /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(statusCmp, { + key: "status", + prefixCls: prefixCls + })); + return wrapCSSVar(isNeedWave ? /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(_util_wave, { + component: "Tag" + }, tagNode) : tagNode); +}); +const Tag = InternalTag; +if ('production' !== process.env.NODE_ENV) Tag.displayName = 'Tag'; +Tag.CheckableTag = CheckableTag; +const es_tag = Tag; +export { collapse_Collapse as Collapse, config_provider as ConfigProvider, es_tag as Tag }; diff --git a/rstack-doc-ui/dist/antd/index.js.LICENSE.txt b/rstack-doc-ui/dist/antd/index.js.LICENSE.txt new file mode 100644 index 0000000..be084a4 --- /dev/null +++ b/rstack-doc-ui/dist/antd/index.js.LICENSE.txt @@ -0,0 +1,31 @@ +/*! + Copyright (c) 2018 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/ + +/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ + +/** + * @license React + * react-is.development.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. + */ + +/** + * @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. + */ + +/**![close](data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNjYWNhY2EiIGZpbGwtcnVsZT0iZXZlbm9kZCIgdmlld0JveD0iNjQgNjQgODk2IDg5NiIgZm9jdXNhYmxlPSJmYWxzZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNNzk5Ljg2IDE2Ni4zMWMuMDIgMCAuMDQuMDIuMDguMDZsNTcuNjkgNTcuN2MuMDQuMDMuMDUuMDUuMDYuMDhhLjEyLjEyIDAgMDEwIC4wNmMwIC4wMy0uMDIuMDUtLjA2LjA5TDU2OS45MyA1MTJsMjg3LjcgMjg3LjdjLjA0LjA0LjA1LjA2LjA2LjA5YS4xMi4xMiAwIDAxMCAuMDdjMCAuMDItLjAyLjA0LS4wNi4wOGwtNTcuNyA1Ny42OWMtLjAzLjA0LS4wNS4wNS0uMDcuMDZhLjEyLjEyIDAgMDEtLjA3IDBjLS4wMyAwLS4wNS0uMDItLjA5LS4wNkw1MTIgNTY5LjkzbC0yODcuNyAyODcuN2MtLjA0LjA0LS4wNi4wNS0uMDkuMDZhLjEyLjEyIDAgMDEtLjA3IDBjLS4wMiAwLS4wNC0uMDItLjA4LS4wNmwtNTcuNjktNTcuN2MtLjA0LS4wMy0uMDUtLjA1LS4wNi0uMDdhLjEyLjEyIDAgMDEwLS4wN2MwLS4wMy4wMi0uMDUuMDYtLjA5TDQ1NC4wNyA1MTJsLTI4Ny43LTI4Ny43Yy0uMDQtLjA0LS4wNS0uMDYtLjA2LS4wOWEuMTIuMTIgMCAwMTAtLjA3YzAtLjAyLjAyLS4wNC4wNi0uMDhsNTcuNy01Ny42OWMuMDMtLjA0LjA1LS4wNS4wNy0uMDZhLjEyLjEyIDAgMDEuMDcgMGMuMDMgMCAuMDUuMDIuMDkuMDZMNTEyIDQ1NC4wN2wyODcuNy0yODcuN2MuMDQtLjA0LjA2LS4wNS4wOS0uMDZhLjEyLjEyIDAgMDEuMDcgMHoiIC8+PC9zdmc+) */ + +/**![right](data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNjYWNhY2EiIHZpZXdCb3g9IjY0IDY0IDg5NiA4OTYiIGZvY3VzYWJsZT0iZmFsc2UiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTc2NS43IDQ4Ni44TDMxNC45IDEzNC43QTcuOTcgNy45NyAwIDAwMzAyIDE0MXY3Ny4zYzAgNC45IDIuMyA5LjYgNi4xIDEyLjZsMzYwIDI4MS4xLTM2MCAyODEuMWMtMy45IDMtNi4xIDcuNy02LjEgMTIuNlY4ODNjMCA2LjcgNy43IDEwLjQgMTIuOSA2LjNsNDUwLjgtMzUyLjFhMzEuOTYgMzEuOTYgMCAwMDAtNTAuNHoiIC8+PC9zdmc+) */ \ No newline at end of file diff --git a/rstack-doc-ui/dist/background-image/index.css b/rstack-doc-ui/dist/background-image/index.css new file mode 100644 index 0000000..09d80d6 --- /dev/null +++ b/rstack-doc-ui/dist/background-image/index.css @@ -0,0 +1,12 @@ +.background-k7Kx8T { + width: 100%; + top: calc(-1 * var(--rp-nav-height)); + z-index: -1; + filter: blur(2px); + pointer-events: none; + -webkit-user-select: none; + user-select: none; + position: absolute; + left: 0; +} + diff --git a/rstack-doc-ui/dist/background-image/index.d.ts b/rstack-doc-ui/dist/background-image/index.d.ts new file mode 100644 index 0000000..9c50d5d --- /dev/null +++ b/rstack-doc-ui/dist/background-image/index.d.ts @@ -0,0 +1,5 @@ +import { type FC } from 'react'; +export type BackgroundProps = { + navBarTopArrived?: boolean; +}; +export declare const BackgroundImage: FC; diff --git a/rstack-doc-ui/dist/background-image/index.js b/rstack-doc-ui/dist/background-image/index.js new file mode 100644 index 0000000..1ce4ce1 --- /dev/null +++ b/rstack-doc-ui/dist/background-image/index.js @@ -0,0 +1,49 @@ +import './index.css'; +import { Fragment, jsx, jsxs } from "react/jsx-runtime"; +import { useEffect, useState } from "react"; +const index_module = { + background: "background-k7Kx8T" +}; +const useTopArrived = ()=>{ + const [scrollY, setScrollY] = useState(0); + const topArrived = scrollY < 100; + useEffect(()=>{ + const handleScroll = ()=>{ + setScrollY(window.scrollY); + }; + window.addEventListener('scroll', handleScroll, { + capture: false, + passive: true + }); + return ()=>{ + window.removeEventListener('scroll', handleScroll); + }; + }, []); + return { + topArrived + }; +}; +const BackgroundImage = ({ navBarTopArrived = true })=>{ + const { topArrived } = useTopArrived(); + useEffect(()=>{ + if (!navBarTopArrived) return; + if (topArrived) document.body.classList.remove('notTopArrived'); + else document.body.classList.add('notTopArrived'); + }, [ + topArrived, + navBarTopArrived + ]); + return /*#__PURE__*/ jsxs(Fragment, { + children: [ + /*#__PURE__*/ jsx("style", { + children: ':root {--rp-c-bg: #0b0c0e;}:root:not(.dark) {--rp-c-bg: #fff;}.rspress-nav {transition: background 0.4s;}body:not(.notTopArrived) .rspress-nav {background: transparent !important;}' + }), + /*#__PURE__*/ jsx("img", { + className: index_module.background, + src: "https://assets.rspack.rs/rspack/assets/landingpage-background-compressed.png", + alt: "background" + }) + ] + }); +}; +export { BackgroundImage }; diff --git a/rstack-doc-ui/dist/benchmark/ProgressBar.d.ts b/rstack-doc-ui/dist/benchmark/ProgressBar.d.ts new file mode 100644 index 0000000..9ae31b2 --- /dev/null +++ b/rstack-doc-ui/dist/benchmark/ProgressBar.d.ts @@ -0,0 +1,7 @@ +export declare function formatTime(time: number, totalTime: number): string; +export declare function ProgressBar({ value, max, desc, inView, }: { + value: number; + max: number; + desc: string; + inView: boolean; +}): import("react/jsx-runtime").JSX.Element; diff --git a/rstack-doc-ui/dist/benchmark/index.css b/rstack-doc-ui/dist/benchmark/index.css new file mode 100644 index 0000000..b083d6d --- /dev/null +++ b/rstack-doc-ui/dist/benchmark/index.css @@ -0,0 +1,122 @@ +.container-FuNiZu { + box-sizing: content-box; + border-radius: 10px; + justify-content: space-between; + align-self: stretch; + align-items: center; + width: 100%; + height: 18px; + display: flex; +} + +@media screen and (max-width: 1060px) { + .container-FuNiZu { + width: 85vw; + } +} + +.innerContainer-Fc0J9Z { + background: var(--rp-c-gray-light-5); + border-radius: 5px; + justify-content: space-between; + width: 100%; + height: 8px; + display: flex; +} + +.dark .innerContainer-Fc0J9Z { + background: var(--rp-c-bg-soft); +} + +.bar-WHFMsk { + background: var(--rs-benchmark-bar-background, linear-gradient(279deg, #ff8b00 35.21%, #f93920 63.34%)); + border-radius: 5px; + height: 100%; +} + +.desc-lTD7cf { + min-width: 100px; + color: var(--rp-c-text-2); + width: 100px; + margin-left: 16px; + font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace; + font-size: 12px; +} + +.time-JXJR1M { + text-align: left; + width: 38px; + display: inline-block; +} + +.root-Ollge_ { + flex-direction: column; + justify-content: center; + align-self: stretch; + align-items: center; + margin-top: 1rem; + margin-bottom: 1rem; + display: flex; +} + +.title-JepjCS { + color: var(--rp-c-text-1); +} + +.desc-npKeId { + color: var(--rp-c-text-2); +} + +.bottomLink-pzbjuT { + color: var(--rp-c-text-2); + margin-top: 16px; + font-size: 16px; + display: block; +} + +.bottomLink-pzbjuT:hover { + color: var(--rp-c-link); +} + +.progressName-Ke8hc2 { + color: var(--rp-c-text-1); + min-width: 170px; + font-size: 17px; + font-weight: 600; +} + +.item-sOpi_3 { + justify-content: center; + align-self: stretch; + align-items: center; + width: 100%; + padding: 1.25rem; + display: flex; +} + +.metricItem-YxRN9U { + flex-direction: column; + flex: 1 0; + justify-content: center; + align-items: center; + display: flex; +} + +@media screen and (min-width: 1060px) { + .item-sOpi_3 { + flex-direction: row; + } +} + +@media screen and (max-width: 1060px) { + .item-sOpi_3 { + flex-direction: column; + align-items: flex-start; + } + + .progressName-Ke8hc2 { + width: 180px; + margin-bottom: 8px; + } +} + diff --git a/rstack-doc-ui/dist/benchmark/index.d.ts b/rstack-doc-ui/dist/benchmark/index.d.ts new file mode 100644 index 0000000..0f7df71 --- /dev/null +++ b/rstack-doc-ui/dist/benchmark/index.d.ts @@ -0,0 +1,11 @@ +export type BenchmarkData = Record; +}>; +export interface BenchmarkProps { + data: BenchmarkData; +} +export declare function Benchmark({ data }: BenchmarkProps): import("react/jsx-runtime").JSX.Element; diff --git a/rstack-doc-ui/dist/benchmark/index.js b/rstack-doc-ui/dist/benchmark/index.js new file mode 100644 index 0000000..51f34da --- /dev/null +++ b/rstack-doc-ui/dist/benchmark/index.js @@ -0,0 +1,240 @@ +import './index.css'; +import { jsx, jsxs } from "react/jsx-runtime"; +import { useEffect, useRef, useState } from "react"; +import { motion } from "framer-motion"; +"use client"; +var observerMap = /* @__PURE__ */ new Map(); +var RootIds = /* @__PURE__ */ new WeakMap(); +var rootId = 0; +var unsupportedValue = void 0; +function getRootId(root) { + if (!root) return "0"; + if (RootIds.has(root)) return RootIds.get(root); + rootId += 1; + RootIds.set(root, rootId.toString()); + return RootIds.get(root); +} +function optionsToId(options) { + return Object.keys(options).sort().filter((key)=>void 0 !== options[key]).map((key)=>`${key}_${"root" === key ? getRootId(options.root) : options[key]}`).toString(); +} +function createObserver(options) { + const id = optionsToId(options); + let instance = observerMap.get(id); + if (!instance) { + const elements = /* @__PURE__ */ new Map(); + let thresholds; + const observer = new IntersectionObserver((entries)=>{ + entries.forEach((entry)=>{ + var _a; + const inView = entry.isIntersecting && thresholds.some((threshold)=>entry.intersectionRatio >= threshold); + if (options.trackVisibility && void 0 === entry.isVisible) entry.isVisible = inView; + null == (_a = elements.get(entry.target)) || _a.forEach((callback)=>{ + callback(inView, entry); + }); + }); + }, options); + thresholds = observer.thresholds || (Array.isArray(options.threshold) ? options.threshold : [ + options.threshold || 0 + ]); + instance = { + id, + observer, + elements + }; + observerMap.set(id, instance); + } + return instance; +} +function observe(element, callback, options = {}, fallbackInView = unsupportedValue) { + if (void 0 === window.IntersectionObserver && void 0 !== fallbackInView) { + const bounds = element.getBoundingClientRect(); + callback(fallbackInView, { + isIntersecting: fallbackInView, + target: element, + intersectionRatio: "number" == typeof options.threshold ? options.threshold : 0, + time: 0, + boundingClientRect: bounds, + intersectionRect: bounds, + rootBounds: bounds + }); + return ()=>{}; + } + const { id, observer, elements } = createObserver(options); + const callbacks = elements.get(element) || []; + if (!elements.has(element)) elements.set(element, callbacks); + callbacks.push(callback); + observer.observe(element); + return function() { + callbacks.splice(callbacks.indexOf(callback), 1); + if (0 === callbacks.length) { + elements.delete(element); + observer.unobserve(element); + } + if (0 === elements.size) { + observer.disconnect(); + observerMap.delete(id); + } + }; +} +function useInView({ threshold, delay, trackVisibility, rootMargin, root, triggerOnce, skip, initialInView, fallbackInView, onChange } = {}) { + var _a; + const [ref, setRef] = useState(null); + const callback = useRef(onChange); + const [state, setState] = useState({ + inView: !!initialInView, + entry: void 0 + }); + callback.current = onChange; + useEffect(()=>{ + if (skip || !ref) return; + let unobserve; + unobserve = observe(ref, (inView, entry)=>{ + setState({ + inView, + entry + }); + if (callback.current) callback.current(inView, entry); + if (entry.isIntersecting && triggerOnce && unobserve) { + unobserve(); + unobserve = void 0; + } + }, { + root, + rootMargin, + threshold, + trackVisibility, + delay + }, fallbackInView); + return ()=>{ + if (unobserve) unobserve(); + }; + }, [ + Array.isArray(threshold) ? threshold.toString() : threshold, + ref, + root, + rootMargin, + triggerOnce, + skip, + trackVisibility, + fallbackInView, + delay + ]); + const entryTarget = null == (_a = state.entry) ? void 0 : _a.target; + const previousEntryTarget = useRef(void 0); + if (!ref && entryTarget && !triggerOnce && !skip && previousEntryTarget.current !== entryTarget) { + previousEntryTarget.current = entryTarget; + setState({ + inView: !!initialInView, + entry: void 0 + }); + } + const result = [ + setRef, + state.inView, + state.entry + ]; + result.ref = result[0]; + result.inView = result[1]; + result.entry = result[2]; + return result; +} +const ProgressBar_module = { + container: "container-FuNiZu", + innerContainer: "innerContainer-Fc0J9Z", + bar: "bar-WHFMsk", + desc: "desc-lTD7cf", + time: "time-JXJR1M" +}; +function formatTime(time, totalTime) { + if (totalTime < 1000) return `${time.toFixed(0)}ms`; + return `${(time / 1000).toFixed(2)}s`; +} +function ProgressBar({ value, max, desc, inView }) { + const [elapsedTime, setElapsedTime] = useState(0); + const TOTAL_TIME = 1000 * value; + const variants = { + initial: { + width: 0 + }, + animate: { + width: `${value / max * 100}%` + } + }; + const formattedTime = formatTime(elapsedTime, TOTAL_TIME); + return /*#__PURE__*/ jsxs("div", { + className: ProgressBar_module.container, + children: [ + /*#__PURE__*/ jsx("div", { + className: ProgressBar_module.innerContainer, + children: inView ? /*#__PURE__*/ jsx(motion.div, { + className: ProgressBar_module.bar, + initial: "initial", + animate: "animate", + variants: variants, + onUpdate: (latest)=>{ + const width = Number.parseFloat(latest.width); + setElapsedTime(width * max * 10); + }, + transition: { + duration: value, + ease: 'linear' + } + }) : null + }), + /*#__PURE__*/ jsxs("div", { + className: ProgressBar_module.desc, + children: [ + /*#__PURE__*/ jsx("span", { + className: ProgressBar_module.time, + children: formattedTime + }), + " ", + desc + ] + }) + ] + }); +} +const index_module = { + root: "root-Ollge_", + title: "title-JepjCS", + desc: "desc-npKeId", + bottomLink: "bottomLink-pzbjuT", + progressName: "progressName-Ke8hc2", + item: "item-sOpi_3", + metricItem: "metricItem-YxRN9U" +}; +const findMaxTime = (data)=>{ + let max = 0; + for (const item of Object.values(data))for (const metric of item.metrics)if (metric.time > max) max = metric.time; + return max; +}; +function Benchmark({ data }) { + const maxTime = findMaxTime(data); + const { ref, inView } = useInView({ + triggerOnce: true + }); + return /*#__PURE__*/ jsx("div", { + className: index_module.root, + ref: ref, + children: Object.values(data).map((item)=>/*#__PURE__*/ jsxs("div", { + className: index_module.item, + children: [ + /*#__PURE__*/ jsx("p", { + className: index_module.progressName, + children: item.label + }), + /*#__PURE__*/ jsx("div", { + className: index_module.metricItem, + children: item.metrics.map((metric)=>/*#__PURE__*/ jsx(ProgressBar, { + value: metric.time, + max: maxTime, + desc: metric.desc, + inView: inView + }, metric.desc)) + }) + ] + }, item.label)) + }); +} +export { Benchmark }; diff --git a/rstack-doc-ui/dist/built-with-rspack/index.css b/rstack-doc-ui/dist/built-with-rspack/index.css new file mode 100644 index 0000000..8150177 --- /dev/null +++ b/rstack-doc-ui/dist/built-with-rspack/index.css @@ -0,0 +1,129 @@ +@media screen and (min-width: 601px) and (max-width: 1050px) { + .title-yh_kQ7 { + font-size: 40px !important; + line-height: 48px !important; + } + + .innerContainer-z6bHq_ { + background-size: 100% 100% !important; + } + + .logo-vQfE2V { + transform: scale(.8); + flex: 1 0 !important; + min-width: 180px !important; + } +} + +@media screen and (max-width: 600px) { + .title-yh_kQ7 { + font-size: 30px !important; + line-height: 48px !important; + } + + .innerContainer-z6bHq_ { + background-size: 100% 100% !important; + padding: 48px 0 0 !important; + } + + .innerContainer-z6bHq_:before, .innerContainer-z6bHq_:after { + width: 300px !important; + height: 300px !important; + } + + .logo-vQfE2V { + transform: scale(.8); + flex: 1 0 50% !important; + max-width: 50% !important; + } +} + +.innerContainer-z6bHq_ { + box-sizing: border-box; + background-size: 100% 100%; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 24px; + width: 100%; + padding: 64px 48px; + display: flex; + position: relative; +} + +.innerContainer-z6bHq_:before { + content: ""; + -webkit-user-select: none; + user-select: none; + z-index: -1; + background: url("https://assets.rspack.rs/rspack/assets/landingpage-who-is-using-left-border.png") 0 0 / 100% 100% no-repeat; + width: 400px; + height: 400px; + position: absolute; + top: 0; + left: 0; +} + +.innerContainer-z6bHq_:after { + content: ""; + -webkit-user-select: none; + user-select: none; + z-index: -1; + background: url("https://assets.rspack.rs/rspack/assets/landingpage-who-is-using-right-border.png") 0 0 / 100% 100% no-repeat; + width: 400px; + height: 400px; + position: absolute; + bottom: 0; + right: 0; +} + +.title-yh_kQ7 { + text-align: center; + -webkit-text-fill-color: rgba(0, 0, 0, 0); + background: linear-gradient(279deg, #ff8b00 27.12%, #f93920 72.56%); + -webkit-background-clip: text; + background-clip: text; + font-size: 48px; + font-style: normal; + font-weight: 700; + line-height: normal; +} + +.logos-razs4s { + filter: var(--rs-built-with-rspack-invert-filter, none); + flex-wrap: wrap; + align-self: stretch; + align-items: flex-start; + display: flex; +} + +.logos-razs4s .logo-vQfE2V { + flex: 250px; + justify-content: center; + align-self: stretch; + align-items: center; + gap: 8px; + min-height: 100px; + padding-left: 8px; + padding-right: 8px; + text-decoration: none; + display: flex; +} + +.logos-razs4s .logoText-ZwEAa5 { + color: #0b0c0e; + text-align: center; + font-size: 24px; + font-style: normal; + font-weight: 700; + line-height: 28px; +} + +html:not(.dark) { + --rs-built-with-rspack-invert-filter: none; +} + +html.dark { + --rs-built-with-rspack-invert-filter: invert(1); +} + diff --git a/rstack-doc-ui/dist/built-with-rspack/index.d.ts b/rstack-doc-ui/dist/built-with-rspack/index.d.ts new file mode 100644 index 0000000..46673da --- /dev/null +++ b/rstack-doc-ui/dist/built-with-rspack/index.d.ts @@ -0,0 +1,14 @@ +import { type LinkComp } from '../shared'; +export type Company = { + name: string; + logo: string; + url: string; + text?: string; + width?: string | number; +}; +export type BuiltWithRspackProps = { + title: string; + LinkComp?: LinkComp; + companyList: Company[]; +}; +export declare const BuiltWithRspack: React.FC; diff --git a/rstack-doc-ui/dist/built-with-rspack/index.js b/rstack-doc-ui/dist/built-with-rspack/index.js new file mode 100644 index 0000000..61daaf4 --- /dev/null +++ b/rstack-doc-ui/dist/built-with-rspack/index.js @@ -0,0 +1,57 @@ +import './index.css'; +import { Fragment, jsx, jsxs } from "react/jsx-runtime"; +const ALink = ({ className, href, children, style })=>/*#__PURE__*/ jsx("a", { + href: href, + className: className, + style: style, + children: children + }); +const index_module = { + title: "title-yh_kQ7", + innerContainer: "innerContainer-z6bHq_", + logo: "logo-vQfE2V", + logos: "logos-razs4s", + logoText: "logoText-ZwEAa5" +}; +const CompanyItem = ({ item, LinkComp })=>{ + const { logo, name, url, text, width } = item; + const Link = LinkComp; + return /*#__PURE__*/ jsxs(Link, { + className: index_module.logo, + href: url, + children: [ + /*#__PURE__*/ jsx("img", { + src: logo, + alt: name, + style: { + width + }, + loading: "lazy" + }), + void 0 !== text ? /*#__PURE__*/ jsx("span", { + className: index_module.logoText, + children: text + }) : /*#__PURE__*/ jsx(Fragment, {}) + ] + }); +}; +const BuiltWithRspack = ({ title, LinkComp, companyList })=>{ + const Link = null != LinkComp ? LinkComp : ALink; + return /*#__PURE__*/ jsxs("div", { + className: index_module.innerContainer, + children: [ + /*#__PURE__*/ jsx("h2", { + className: index_module.title, + children: title + }), + /*#__PURE__*/ jsx("div", { + className: index_module.logos, + children: companyList.map((i)=>/*#__PURE__*/ jsx(CompanyItem, { + item: i, + LinkComp: Link + }, i.name)) + }) + ] + }); +}; +export { BuiltWithRspack }; diff --git a/rstack-doc-ui/dist/fully-featured/index.css b/rstack-doc-ui/dist/fully-featured/index.css new file mode 100644 index 0000000..e28f11d --- /dev/null +++ b/rstack-doc-ui/dist/fully-featured/index.css @@ -0,0 +1,121 @@ +@media screen and (min-width: 601px) and (max-width: 1000px) { + .features-oTi3lz { + flex-wrap: wrap !important; + gap: 32px 16px !important; + } + + .featureCard-bEvKlm { + flex: 1 0 45% !important; + max-width: 50% !important; + } + + .main-tfEqLf { + gap: 32px !important; + } +} + +@media screen and (max-width: 600px) { + .features-oTi3lz { + flex-wrap: wrap; + } + + .featureCard-bEvKlm { + flex-direction: column !important; + flex: 1 0 40% !important; + justify-content: center !important; + align-items: center !important; + max-width: 50% !important; + } + + .featureCard-bEvKlm .featureTitle-uGAlGf { + text-align: center !important; + } + + .featureCard-bEvKlm .featureDescription-gXsRi0 { + display: none !important; + } + + .main-tfEqLf { + gap: 16px !important; + } +} + +.main-tfEqLf { + flex-direction: column; + align-items: center; + gap: 32px; + display: flex; +} + +.features-oTi3lz { + justify-content: center; + align-items: flex-start; + gap: 16px; + width: 100%; + display: flex; +} + +.features-oTi3lz .featureCard-bEvKlm { + flex: 25%; + align-items: flex-start; + gap: 16px; + min-height: 110px; + text-decoration: none; + display: flex; +} + +.features-oTi3lz .featureCard-bEvKlm h2, .features-oTi3lz .featureCard-bEvKlm p { + margin: 0; +} + +.features-oTi3lz .featureCard-bEvKlm:hover { + opacity: .8; + transition: all .2s ease-out; + transform: scale(1.04); +} + +.features-oTi3lz .featureCard-bEvKlm .icon-BFb1eH { + filter: var(--rs-fully-featured-invert-filter, none); + justify-content: center; + align-items: center; + width: 32px; + height: 32px; + display: flex; +} + +.features-oTi3lz .featureCard-bEvKlm .featureContent-Uhsfzs { + text-align: left; + flex-direction: column; + align-items: flex-start; + gap: 8px; + display: flex; +} + +.features-oTi3lz .featureCard-bEvKlm .featureContent-Uhsfzs .featureTitle-uGAlGf { + color: var(--rs-fully-featured-title-color, #0b0c0e); + font-size: 18px; + font-style: normal; + font-weight: 700; + line-height: 150%; +} + +.features-oTi3lz .featureCard-bEvKlm .featureContent-Uhsfzs .featureDescription-gXsRi0 { + color: var(--rs-fully-featured-desc-color, #6b7075); + font-size: 14px; + font-style: normal; + font-weight: 400; + line-height: 23.8px; +} + +html:not(.dark) { + --rs-fully-featured-title-color: #0b0c0e; + --rs-fully-featured-desc-color: #6b7075; + --rs-fully-featured-invert-filter: none; +} + +html.dark { + --rs-fully-featured-title-color: white; + --rs-fully-featured-desc-color: #c6cacd; + --rs-fully-featured-invert-filter: invert(1); +} + diff --git a/rstack-doc-ui/dist/fully-featured/index.d.ts b/rstack-doc-ui/dist/fully-featured/index.d.ts new file mode 100644 index 0000000..3cebe50 --- /dev/null +++ b/rstack-doc-ui/dist/fully-featured/index.d.ts @@ -0,0 +1,16 @@ +import type { FC } from 'react'; +import { type LinkComp } from '../shared'; +export type Feature = { + icon: string; + title: string; + description: string; + link: string; +}; +export type FullyFeaturedProps = { + LinkComp?: LinkComp; + /** + * 8 or 12 or 16 + */ + featureRows: Feature[][]; +}; +export declare const FullyFeatured: FC; diff --git a/rstack-doc-ui/dist/fully-featured/index.js b/rstack-doc-ui/dist/fully-featured/index.js new file mode 100644 index 0000000..1a82c29 --- /dev/null +++ b/rstack-doc-ui/dist/fully-featured/index.js @@ -0,0 +1,52 @@ +import './index.css'; +import { jsx, jsxs } from "react/jsx-runtime"; +const ALink = ({ className, href, children, style })=>/*#__PURE__*/ jsx("a", { + href: href, + className: className, + style: style, + children: children + }); +const index_module = { + features: "features-oTi3lz", + featureCard: "featureCard-bEvKlm", + main: "main-tfEqLf", + featureTitle: "featureTitle-uGAlGf", + featureDescription: "featureDescription-gXsRi0", + icon: "icon-BFb1eH", + featureContent: "featureContent-Uhsfzs" +}; +const FullyFeatured = ({ LinkComp, featureRows })=>{ + const Link = null != LinkComp ? LinkComp : ALink; + return /*#__PURE__*/ jsx("div", { + className: index_module.main, + children: featureRows.map((row, index)=>/*#__PURE__*/ jsx("div", { + className: index_module.features, + children: row.map(({ icon, description, link, title }, index)=>/*#__PURE__*/ jsxs(Link, { + className: index_module.featureCard, + href: link, + children: [ + /*#__PURE__*/ jsx("img", { + src: icon, + alt: index.toString(), + className: index_module.icon, + loading: "lazy" + }), + /*#__PURE__*/ jsxs("div", { + className: index_module.featureContent, + children: [ + /*#__PURE__*/ jsx("h2", { + className: index_module.featureTitle, + children: title + }), + /*#__PURE__*/ jsx("p", { + className: index_module.featureDescription, + children: description + }) + ] + }) + ] + }, index)) + }, index)) + }); +}; +export { FullyFeatured }; diff --git a/rstack-doc-ui/dist/hero/BackgroundStar.d.ts b/rstack-doc-ui/dist/hero/BackgroundStar.d.ts new file mode 100644 index 0000000..6d46c14 --- /dev/null +++ b/rstack-doc-ui/dist/hero/BackgroundStar.d.ts @@ -0,0 +1,8 @@ +declare const BackgroundStar: ({ top, left, pageX, pageY, size, }: { + top: number | string; + left: number | string; + pageX: number | null; + pageY: number | null; + size: number; +}) => import("react/jsx-runtime").JSX.Element; +export default BackgroundStar; diff --git a/rstack-doc-ui/dist/hero/index.css b/rstack-doc-ui/dist/hero/index.css new file mode 100644 index 0000000..e60c81d --- /dev/null +++ b/rstack-doc-ui/dist/hero/index.css @@ -0,0 +1,204 @@ +@media screen and (max-width: 600px) { + .logoImg-jmnjG_ { + height: 100px !important; + } + + .buttonGroup-n4F2Ri { + flex-direction: column; + align-self: stretch; + align-items: center; + gap: 16px; + padding-top: 16px; + display: flex; + } + + .button-J07D5g { + width: 100% !important; + } + + .innerHero-WcJ046 { + height: auto !important; + padding: 24px !important; + } + + .title-ba4Gs7 { + font-size: 32px !important; + line-height: normal !important; + } + + .subtitle-R5khYQ { + font-size: 20px !important; + line-height: normal !important; + } + + .description-lQO4Vm { + line-height: 20px; + font-size: 16px !important; + } + + .backgroundStarContainer-d5mYjB { + display: none !important; + } +} + +html:not(.dark) { + --rs-hero-title-color: #0b0c0e; + --rstack-hero-desc-color: #6b7075; +} + +html.dark { + --rs-hero-title-color: white; + --rstack-hero-desc-color: #c6cacd; +} + +.hero-xzxNT7 { + background-size: cover; + justify-content: center; + align-items: center; + display: flex; + position: relative; +} + +.hero-xzxNT7 p, .hero-xzxNT7 h1 { + margin: 0; +} + +.innerHero-WcJ046 { + flex-direction: column; + justify-content: center; + align-items: center; + gap: 16px; + width: 100%; + height: 646px; + padding: 64px 0; + display: flex; + position: relative; +} + +.logo-kdns6B { + -webkit-user-select: none; + user-select: none; + position: relative; +} + +.logo-kdns6B .logoImg-jmnjG_ { + height: 180px; +} + +.logo-kdns6B .ovalBg-uD285_ { + z-index: -1; + background: var(--rs-hero-oval-background, #dfc228); + width: 80%; + height: 80%; + filter: var(--rs-hero-oval-filter, blur(40px)); + background-position: center; + background-repeat: no-repeat; + background-size: 100% 100%; + border-radius: 50%; + position: absolute; + top: calc(50% + 5px); + left: calc(50% + 5px); + transform: translate(-50%, -50%); +} + +.title-ba4Gs7 { + text-align: center; + background: var(--rs-hero-title-gradient, linear-gradient(279deg, #ff8b00 35.21%, #f93920 63.34%)); + -webkit-text-fill-color: rgba(0, 0, 0, 0); + -webkit-background-clip: text; + background-clip: text; + font-size: 72px; + font-style: normal; + font-weight: 700; + line-height: 93.6px; +} + +.subtitle-R5khYQ { + color: var(--rs-hero-title-color, #0b0c0e); + text-align: center; + font-size: 50px; + font-style: normal; + font-weight: 700; + line-height: 72px; +} + +.description-lQO4Vm { + color: var(--rstack-hero-desc-color, #6b7075); + text-align: center; + font-size: 24px; + font-style: normal; + font-weight: 400; +} + +.buttonGroup-n4F2Ri { + justify-content: center; + gap: 10px; + margin-top: 20px; + display: flex; +} + +.button-J07D5g { + text-align: center; + text-transform: capitalize; + cursor: pointer; + box-sizing: border-box; + border-radius: 25px; + justify-content: center; + align-items: center; + min-width: 120px; + padding: 12px 28px; + font-size: 16px; + font-style: normal; + font-weight: 700; + line-height: 150%; + text-decoration: none; + transition: all .2s ease-in-out; + display: flex; +} + +.button-J07D5g:hover { + opacity: .75; + transform: translate3d(0, -2px, 0); +} + +.button-J07D5g:active { + opacity: .5; +} + +.buttonPrimary-EUkFUR { + background: var(--rs-hero-button-gradient, linear-gradient(279deg, #ff8b00 35.21%, #f93920 63.34%)); + color: #fff; + border: none; +} + +.githubIcon-mAtLrO { + color: currentColor; + width: 22px; + height: 22px; + margin-right: 8px; +} + +.buttonSecondary-OEOpVR { + border: 1.5px solid var(--rs-hero-button-border, #ff8b00); + color: var(--rs-hero-title-color, #0b0c0e); + background: none; +} + +.backgroundStarContainer-d5mYjB { + z-index: -1; + -webkit-user-select: none; + user-select: none; + pointer-events: none; + position: absolute; + top: 0; + left: 0; +} + +.backgroundStarContainer-d5mYjB .backgroundStar-t65ruH { + filter: blur(2px); + -webkit-user-select: none; + user-select: none; + pointer-events: none; + transition: all .2s; +} + diff --git a/rstack-doc-ui/dist/hero/index.d.ts b/rstack-doc-ui/dist/hero/index.d.ts new file mode 100644 index 0000000..f6a8140 --- /dev/null +++ b/rstack-doc-ui/dist/hero/index.d.ts @@ -0,0 +1,16 @@ +import type { FC } from 'react'; +type HeroProps = { + onClickGetStarted: () => void; + onClickLearnMore?: () => void; + showStars?: boolean; + showOvalBg?: boolean; + logoUrl?: string; + title?: string; + subTitle?: string; + description?: string; + getStartedButtonText?: string; + learnMoreButtonText?: string; + githubURL?: string; +}; +export declare const Hero: FC; +export {}; diff --git a/rstack-doc-ui/dist/hero/index.js b/rstack-doc-ui/dist/hero/index.js new file mode 100644 index 0000000..688258a --- /dev/null +++ b/rstack-doc-ui/dist/hero/index.js @@ -0,0 +1,349 @@ +import './index.css'; +import { jsx, jsxs } from "react/jsx-runtime"; +import { useEffect, useRef, useState } from "react"; +const index_module = { + logoImg: "logoImg-jmnjG_", + buttonGroup: "buttonGroup-n4F2Ri", + button: "button-J07D5g", + innerHero: "innerHero-WcJ046", + title: "title-ba4Gs7", + subtitle: "subtitle-R5khYQ", + description: "description-lQO4Vm", + backgroundStarContainer: "backgroundStarContainer-d5mYjB", + hero: "hero-xzxNT7", + logo: "logo-kdns6B", + ovalBg: "ovalBg-uD285_", + buttonPrimary: "buttonPrimary-EUkFUR", + githubIcon: "githubIcon-mAtLrO", + buttonSecondary: "buttonSecondary-OEOpVR", + backgroundStar: "backgroundStar-t65ruH" +}; +const BackgroundStar_BackgroundStar = ({ top, left, pageX, pageY, size })=>{ + const ref = useRef(); + const [transformX, setTransformX] = useState(0); + const [transformY, setTransformY] = useState(0); + useEffect(()=>{ + if (ref.current) { + const { x, y } = ref.current.getBoundingClientRect(); + if (pageX && pageY) { + const distanceX = pageX - x; + const distanceY = pageY - y; + if (Math.abs(distanceX) < 100 && Math.abs(distanceY) < 100) { + setTransformX(distanceX); + setTransformY(distanceY); + } else { + setTransformX(0); + setTransformY(0); + } + } + } + }, [ + pageX, + pageY + ]); + return /*#__PURE__*/ jsx("div", { + className: index_module.backgroundStarContainer, + ref: ref, + style: { + top, + left + }, + children: /*#__PURE__*/ jsxs("svg", { + className: index_module.backgroundStar, + style: { + width: size, + height: size, + transform: `translate(${transformX}px, ${transformY}px)` + }, + xmlns: "http://www.w3.org/2000/svg", + width: "8", + height: "9", + viewBox: "0 0 8 9", + fill: "none", + role: "img", + "aria-label": "star", + children: [ + /*#__PURE__*/ jsx("title", {}), + /*#__PURE__*/ jsx("circle", { + cx: "4", + cy: "4.5", + r: "4", + fill: "url(#paint0_radial_2202_5618)" + }), + /*#__PURE__*/ jsx("defs", { + children: /*#__PURE__*/ jsxs("radialGradient", { + id: "paint0_radial_2202_5618", + cx: "0", + cy: "0", + r: "1", + gradientUnits: "userSpaceOnUse", + gradientTransform: "translate(4 4.49998) scale(3.77871 4.29149)", + children: [ + /*#__PURE__*/ jsx("stop", { + stopColor: "#FF8B00" + }), + /*#__PURE__*/ jsx("stop", { + offset: "0.38", + stopColor: "#F2A65A" + }), + /*#__PURE__*/ jsx("stop", { + offset: "0.59", + stopColor: "#FFB966" + }), + /*#__PURE__*/ jsx("stop", { + offset: "0.92", + stopColor: "#FF8B00" + }) + ] + }) + }) + ] + }) + }); +}; +const BackgroundStar = BackgroundStar_BackgroundStar; +const positions = [ + [ + 91.4, + 22.9 + ], + [ + 36, + 67.6 + ], + [ + 94.1, + 47.7 + ], + [ + 33.8, + 32.5 + ], + [ + 43.1, + 77.6 + ], + [ + 9.8, + 73.4 + ], + [ + 16.1, + 17.1 + ], + [ + 1, + 10 + ], + [ + 88.3, + 44.9 + ], + [ + 19.3, + 79 + ], + [ + 28.5, + 11.8 + ], + [ + 94.6, + 44.9 + ], + [ + 53.8, + 3.4 + ], + [ + 41.7, + 20 + ], + [ + 56.9, + 80.6 + ], + [ + 16.4, + 83.4 + ], + [ + 39.4, + 66.8 + ], + [ + 19, + 18.4 + ], + [ + 25.1, + 28.1 + ], + [ + 18.9, + 35.6 + ], + [ + 32.9, + 12.3 + ], + [ + 21.2, + 72.8 + ], + [ + 83.3, + 79.8 + ], + [ + 71.4, + 36.8 + ], + [ + 62.2, + 50.4 + ], + [ + 45.4, + 13.7 + ], + [ + 61.1, + 28.5 + ], + [ + 18.2, + 64.1 + ], + [ + 40.7, + 34.7 + ], + [ + 87.6, + 20.7 + ], + [ + 78.3, + 30.8 + ], + [ + 84.4, + 58.2 + ], + [ + 74.2, + 74.5 + ], + [ + 12.4, + 66.4 + ], + [ + 68.2, + 41.6 + ] +]; +const useMouseMove = ()=>{ + const ref = useRef(); + const [pageX, setPageX] = useState(null); + const [pageY, setPageY] = useState(null); + const handleMove = ({ pageX, pageY })=>{ + setPageX(pageX); + setPageY(pageY); + }; + return { + ref, + pageX, + pageY, + onMouseMove: handleMove + }; +}; +const Hero = ({ onClickGetStarted, onClickLearnMore, showStars = false, showOvalBg = true, logoUrl = 'https://assets.rspack.rs/rspack/rspack-logo.svg', title = 'Rspack', subTitle = 'The fast Rust-based web bundler', description = 'Seamlessly replace webpack with compatible API', getStartedButtonText = 'Get Started', learnMoreButtonText = 'Learn More', githubURL })=>{ + const { pageX, pageY, ref, onMouseMove } = useMouseMove(); + return /*#__PURE__*/ jsx("section", { + className: index_module.hero, + ref: ref, + onMouseMove: onMouseMove, + children: /*#__PURE__*/ jsxs("div", { + className: index_module.innerHero, + children: [ + showStars ? positions.map(([top, left], i)=>/*#__PURE__*/ jsx(BackgroundStar, { + top: `${top}%`, + left: `${left}%`, + size: i / 20 + 3, + pageX: pageX, + pageY: pageY + }, i)) : null, + /*#__PURE__*/ jsxs("div", { + className: index_module.logo, + children: [ + /*#__PURE__*/ jsx("img", { + src: logoUrl, + className: `${index_module.logoImg} rs-logo`, + alt: "logo" + }), + showOvalBg ? /*#__PURE__*/ jsx("div", { + className: `${index_module.ovalBg} rs-oval` + }) : null + ] + }), + /*#__PURE__*/ jsx("h1", { + className: index_module.title, + children: /*#__PURE__*/ jsx("span", { + children: title + }) + }), + /*#__PURE__*/ jsx("p", { + className: index_module.subtitle, + children: subTitle + }), + /*#__PURE__*/ jsx("p", { + className: index_module.description, + children: description + }), + /*#__PURE__*/ jsxs("div", { + className: index_module.buttonGroup, + children: [ + /*#__PURE__*/ jsx("button", { + className: `${index_module.button} ${index_module.buttonPrimary}`, + type: "button", + onClick: onClickGetStarted, + children: getStartedButtonText + }), + githubURL ? /*#__PURE__*/ jsxs("a", { + href: githubURL, + target: "_blank", + rel: "noopener noreferrer", + className: `${index_module.button} ${index_module.buttonSecondary}`, + children: [ + /*#__PURE__*/ jsxs("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "100%", + viewBox: "0 0 24 24", + className: index_module.githubIcon, + children: [ + /*#__PURE__*/ jsx("title", { + children: "GitHub" + }), + /*#__PURE__*/ jsx("path", { + fill: "currentColor", + d: "M12 .297c-6.63 0-12 5.373-12 12c0 5.303 3.438 9.8 8.205 11.385c.6.113.82-.258.82-.577c0-.285-.01-1.04-.015-2.04c-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729c1.205.084 1.838 1.236 1.838 1.236c1.07 1.835 2.809 1.305 3.495.998c.108-.776.417-1.305.76-1.605c-2.665-.3-5.466-1.332-5.466-5.93c0-1.31.465-2.38 1.235-3.22c-.135-.303-.54-1.523.105-3.176c0 0 1.005-.322 3.3 1.23c.96-.267 1.98-.399 3-.405c1.02.006 2.04.138 3 .405c2.28-1.552 3.285-1.23 3.285-1.23c.645 1.653.24 2.873.12 3.176c.765.84 1.23 1.91 1.23 3.22c0 4.61-2.805 5.625-5.475 5.92c.42.36.81 1.096.81 2.22c0 1.606-.015 2.896-.015 3.286c0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" + }) + ] + }), + "GitHub" + ] + }) : /*#__PURE__*/ jsx("button", { + className: `${index_module.button} ${index_module.buttonSecondary}`, + type: "button", + onClick: onClickLearnMore, + children: learnMoreButtonText + }) + ] + }) + ] + }) + }); +}; +export { Hero }; diff --git a/rstack-doc-ui/dist/nav-icon/components/Link.d.ts b/rstack-doc-ui/dist/nav-icon/components/Link.d.ts new file mode 100644 index 0000000..394581c --- /dev/null +++ b/rstack-doc-ui/dist/nav-icon/components/Link.d.ts @@ -0,0 +1,14 @@ +import type { Lang } from '../utils'; +export type LinkInfo = { + name: string; + desc: string; + descEn?: string; + url: string; + urlEn?: string; + logo: string; + logoScale?: number; +}; +export type LinkProps = LinkInfo & { + lang: Lang; +}; +export declare const Link: (props: LinkProps) => import("react/jsx-runtime").JSX.Element; diff --git a/rstack-doc-ui/dist/nav-icon/components/LinkGroup.d.ts b/rstack-doc-ui/dist/nav-icon/components/LinkGroup.d.ts new file mode 100644 index 0000000..ec5039d --- /dev/null +++ b/rstack-doc-ui/dist/nav-icon/components/LinkGroup.d.ts @@ -0,0 +1,8 @@ +import type { Lang } from '../utils'; +import { type LinkInfo } from './Link'; +export declare const LinkGroup: (props: { + title: string; + titleEn: string; + lang: Lang; + links: LinkInfo[]; +}) => import("react/jsx-runtime").JSX.Element; diff --git a/rstack-doc-ui/dist/nav-icon/components/PopoverContent.d.ts b/rstack-doc-ui/dist/nav-icon/components/PopoverContent.d.ts new file mode 100644 index 0000000..e25bb02 --- /dev/null +++ b/rstack-doc-ui/dist/nav-icon/components/PopoverContent.d.ts @@ -0,0 +1,5 @@ +import type { Lang, NavConfig } from '../utils'; +export declare const PopoverContent: ({ lang, config, }: { + config: NavConfig; + lang: Lang; +}) => import("react/jsx-runtime").JSX.Element; diff --git a/rstack-doc-ui/dist/nav-icon/index.css b/rstack-doc-ui/dist/nav-icon/index.css new file mode 100644 index 0000000..8441f11 --- /dev/null +++ b/rstack-doc-ui/dist/nav-icon/index.css @@ -0,0 +1,123 @@ +.root-M0JNBp { + box-sizing: border-box; + border-radius: 12px; + align-items: center; + width: 240px; + margin-bottom: 12px; + padding: 8px 0 8px 8px; + text-decoration: none; + transition: background-color .2s ease-in-out; + display: inline-flex; +} + +.root-M0JNBp:nth-child(odd) { + margin-right: 16px; +} + +.root-M0JNBp:hover { + background-color: var(--rp-c-bg-mute); +} + +.name-EwJVMq { + color: var(--rp-c-text-1); + font-size: 15px; + font-weight: 500; +} + +.desc-xLJBeI { + color: rgba(60, 60, 60, .5); + margin-top: 4px; + font-size: 12px; + line-height: 16px; +} + +.dark .desc-xLJBeI { + color: rgba(255, 255, 255, .6); +} + +.logo-rzjMA6 { + object-fit: contain; + width: 52px; + height: 52px; + margin-right: 20px; +} + +.dark .logo-rzjMA6 { + opacity: .9; +} + +.root-PRenbw:not(:last-child) { + margin-bottom: 12px; +} + +@media (min-width: 1600px) { + .root-PRenbw:not(:last-child) { + margin-bottom: 16px; + } +} + +.title-z0QBpw { + color: var(--rp-c-text-1); + margin: 0 0 8px 6px; + font-size: 15px; + font-weight: 500; +} + +.root-nhoLZk { + margin-right: 20px; + padding-right: 20px; + display: inline-block; + position: relative; +} + +.root-nhoLZk:after { + content: " "; + background-color: var(--rp-c-divider-light); + width: 1px; + height: 24px; + display: block; + position: absolute; + top: 50%; + right: 0; + transform: translateY(-50%); +} + +.popover-fmVcBt { + z-index: 999; +} + +.popover-fmVcBt .ant-popover-inner { + box-sizing: border-box; + background-color: var(--rp-c-bg); + border-radius: 24px; + width: 552px; + padding: 24px 28px 14px; + font-family: Open Sans, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; + overflow: hidden; +} + +.dark .popover-fmVcBt .ant-popover-inner { + background-color: var(--rp-c-bg-soft); +} + +@media (max-width: 600px) { + .popover-fmVcBt .ant-popover-inner { + width: 80vw; + } +} + +.wrapper-u2FzAf { + cursor: pointer; + border-radius: 99px; + justify-content: center; + align-items: center; + width: 36px; + height: 36px; + transition: background-color .2s ease-in-out; + display: flex; +} + +.wrapper-u2FzAf:hover { + background-color: var(--rp-c-bg-mute); +} + diff --git a/rstack-doc-ui/dist/nav-icon/index.d.ts b/rstack-doc-ui/dist/nav-icon/index.d.ts new file mode 100644 index 0000000..47a72f7 --- /dev/null +++ b/rstack-doc-ui/dist/nav-icon/index.d.ts @@ -0,0 +1,6 @@ +import { type Lang } from './utils'; +export interface NavIconProps { + lang?: Lang; + trigger?: 'hover' | 'focus' | 'click'; +} +export declare const NavIcon: (props?: NavIconProps) => import("react/jsx-runtime").JSX.Element; diff --git a/rstack-doc-ui/dist/nav-icon/index.js b/rstack-doc-ui/dist/nav-icon/index.js new file mode 100644 index 0000000..db66827 --- /dev/null +++ b/rstack-doc-ui/dist/nav-icon/index.js @@ -0,0 +1,12073 @@ +import './index.css'; +/*! For license information please see index.js.LICENSE.txt */ +import { jsx, jsxs } from "react/jsx-runtime"; +import react_dom, { createPortal } from "react-dom"; +import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react"; +var __webpack_modules__ = { + "./node_modules/.pnpm/@ant-design+cssinjs@1.23.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@ant-design/cssinjs/es/hooks/useHMR.js": function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.d(__webpack_exports__, { + Z: ()=>__WEBPACK_DEFAULT_EXPORT__ + }); + module = __webpack_require__.hmd(module); + function useProdHMR() { + return false; + } + var webpackHMR = false; + function useDevHMR() { + return webpackHMR; + } + const __WEBPACK_DEFAULT_EXPORT__ = 'production' === process.env.NODE_ENV ? useProdHMR : useDevHMR; + if ('production' !== process.env.NODE_ENV && true && module && module.hot && 'undefined' != typeof window) { + var win = 'undefined' != typeof globalThis ? globalThis : 'undefined' != typeof window ? window : null; + if (win && 'function' == typeof win.webpackHotUpdate) { + var originWebpackHotUpdate = win.webpackHotUpdate; + win.webpackHotUpdate = function() { + webpackHMR = true; + setTimeout(function() { + webpackHMR = false; + }, 0); + return originWebpackHotUpdate.apply(void 0, arguments); + }; + } + } + }, + "./node_modules/.pnpm/react-is@18.2.0/node_modules/react-is/cjs/react-is.development.js": function(__unused_webpack_module, exports) { + /** + * @license React + * react-is.development.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. + */ if ("production" !== process.env.NODE_ENV) (function() { + 'use strict'; + var REACT_ELEMENT_TYPE = Symbol.for('react.element'); + var REACT_PORTAL_TYPE = Symbol.for('react.portal'); + var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); + var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); + var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); + var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); + var REACT_CONTEXT_TYPE = Symbol.for('react.context'); + var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context'); + var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); + var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); + var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); + var REACT_MEMO_TYPE = Symbol.for('react.memo'); + var REACT_LAZY_TYPE = Symbol.for('react.lazy'); + Symbol.for('react.offscreen'); + Symbol.for('react.module.reference'); + function typeOf(object) { + if ('object' == typeof object && null !== object) { + var $$typeof = object.$$typeof; + switch($$typeof){ + case REACT_ELEMENT_TYPE: + var type = object.type; + switch(type){ + case REACT_FRAGMENT_TYPE: + case REACT_PROFILER_TYPE: + case REACT_STRICT_MODE_TYPE: + case REACT_SUSPENSE_TYPE: + case REACT_SUSPENSE_LIST_TYPE: + return type; + default: + var $$typeofType = type && type.$$typeof; + switch($$typeofType){ + case REACT_SERVER_CONTEXT_TYPE: + case REACT_CONTEXT_TYPE: + case REACT_FORWARD_REF_TYPE: + case REACT_LAZY_TYPE: + case REACT_MEMO_TYPE: + case REACT_PROVIDER_TYPE: + return $$typeofType; + default: + return $$typeof; + } + } + case REACT_PORTAL_TYPE: + return $$typeof; + } + } + } + var ForwardRef = REACT_FORWARD_REF_TYPE; + function isMemo(object) { + return typeOf(object) === REACT_MEMO_TYPE; + } + exports.ForwardRef = ForwardRef; + exports.isMemo = isMemo; + })(); + }, + "./node_modules/.pnpm/react-is@18.2.0/node_modules/react-is/cjs/react-is.production.min.js": function(__unused_webpack_module, exports) { + /** + * @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"); + Symbol.for("react.offscreen"); + 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){ + case d: + case f: + case e: + case m: + case n: + return a; + default: + switch(a = a && a.$$typeof){ + case k: + case h: + case l: + case q: + case p: + case g: + return a; + default: + return r; + } + } + case c: + return r; + } + } + } + exports.ForwardRef = l; + exports.isMemo = function(a) { + return v(a) === p; + }; + }, + "./node_modules/.pnpm/react-is@18.2.0/node_modules/react-is/index.js": function(module, __unused_webpack_exports, __webpack_require__) { + if ('production' === process.env.NODE_ENV) module.exports = __webpack_require__("./node_modules/.pnpm/react-is@18.2.0/node_modules/react-is/cjs/react-is.production.min.js"); + else module.exports = __webpack_require__("./node_modules/.pnpm/react-is@18.2.0/node_modules/react-is/cjs/react-is.development.js"); + }, + "./node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js": function(module) { + /*! + Copyright (c) 2018 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/ (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 ('string' == typeof arg || 'number' == typeof arg) return arg; + if ('object' != typeof arg) 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 (module.exports) { + classNames.default = classNames; + module.exports = classNames; + } else if ('function' == typeof define && 'object' == typeof define.amd && define.amd) define('classnames', [], function() { + return classNames; + }); + else window.classNames = classNames; + })(); + } +}; +var __webpack_module_cache__ = {}; +function __webpack_require__(moduleId) { + var cachedModule = __webpack_module_cache__[moduleId]; + if (void 0 !== cachedModule) return cachedModule.exports; + var module = __webpack_module_cache__[moduleId] = { + id: moduleId, + loaded: false, + exports: {} + }; + __webpack_modules__[moduleId](module, module.exports, __webpack_require__); + module.loaded = true; + return module.exports; +} +(()=>{ + __webpack_require__.n = (module)=>{ + var getter = module && module.__esModule ? ()=>module['default'] : ()=>module; + __webpack_require__.d(getter, { + a: getter + }); + return getter; + }; +})(); +(()=>{ + __webpack_require__.d = (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_require__.hmd = (module)=>{ + module = Object.create(module); + if (!module.children) module.children = []; + Object.defineProperty(module, 'exports', { + enumerable: true, + set: ()=>{ + throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id); + } + }); + return module; + }; +})(); +(()=>{ + __webpack_require__.g = (()=>{ + if ('object' == typeof globalThis) return globalThis; + try { + return this || new Function('return this')(); + } catch (e) { + if ('object' == typeof window) return window; + } + })(); +})(); +(()=>{ + __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop); +})(); +var classnames = __webpack_require__("./node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js"); +var classnames_default = /*#__PURE__*/ __webpack_require__.n(classnames); +function _arrayWithHoles(r) { + if (Array.isArray(r)) return r; +} +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; + } +} +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; +} +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; + } +} +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."); +} +function slicedToArray_slicedToArray(r, e) { + return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); +} +function useEvent(callback) { + var fnRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(); + fnRef.current = callback; + var memoFn = __WEBPACK_EXTERNAL_MODULE_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 null == (_fnRef$current = fnRef.current) ? void 0 : _fnRef$current.call.apply(_fnRef$current, [ + fnRef + ].concat(args)); + }, []); + return memoFn; +} +function canUseDom_canUseDom() { + return !!('undefined' != typeof window && window.document && window.document.createElement); +} +var useInternalLayoutEffect = 'test' !== process.env.NODE_ENV && canUseDom_canUseDom() ? __WEBPACK_EXTERNAL_MODULE_react__.useLayoutEffect : __WEBPACK_EXTERNAL_MODULE_react__.useEffect; +var useLayoutEffect_useLayoutEffect = function(callback, deps) { + var firstMountRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(true); + useInternalLayoutEffect(function() { + return callback(firstMountRef.current); + }, deps); + useInternalLayoutEffect(function() { + firstMountRef.current = false; + return function() { + firstMountRef.current = true; + }; + }, []); +}; +var useLayoutEffect_useLayoutUpdateEffect = function(callback, deps) { + useLayoutEffect_useLayoutEffect(function(firstMount) { + if (!firstMount) return callback(); + }, deps); +}; +const hooks_useLayoutEffect = useLayoutEffect_useLayoutEffect; +function useSafeState(defaultValue) { + var destroyRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(false); + var _React$useState = __WEBPACK_EXTERNAL_MODULE_react__.useState(defaultValue), _React$useState2 = slicedToArray_slicedToArray(_React$useState, 2), value = _React$useState2[0], setValue = _React$useState2[1]; + __WEBPACK_EXTERNAL_MODULE_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 + ]; +} +function hasValue(value) { + return void 0 !== value; +} +function useMergedState(defaultStateValue, option) { + var _ref = option || {}, defaultValue = _ref.defaultValue, value = _ref.value, onChange = _ref.onChange, postState = _ref.postState; + var _useState = useSafeState(function() { + if (hasValue(value)) return value; + if (hasValue(defaultValue)) return 'function' == typeof defaultValue ? defaultValue() : defaultValue; + return 'function' == typeof defaultStateValue ? defaultStateValue() : defaultStateValue; + }), _useState2 = slicedToArray_slicedToArray(_useState, 2), innerValue = _useState2[0], setInnerValue = _useState2[1]; + var mergedValue = void 0 !== value ? value : innerValue; + var postMergedValue = postState ? postState(mergedValue) : mergedValue; + var onChangeFn = useEvent(onChange); + var _useState3 = useSafeState([ + mergedValue + ]), _useState4 = slicedToArray_slicedToArray(_useState3, 2), prevValue = _useState4[0], setPrevValue = _useState4[1]; + useLayoutEffect_useLayoutUpdateEffect(function() { + var prev = prevValue[0]; + if (innerValue !== prev) onChangeFn(innerValue, prev); + }, [ + prevValue + ]); + useLayoutEffect_useLayoutUpdateEffect(function() { + if (!hasValue(value)) setInnerValue(value); + }, [ + value + ]); + var triggerChange = useEvent(function(updater, ignoreDestroy) { + setInnerValue(updater, ignoreDestroy); + setPrevValue([ + mergedValue + ], ignoreDestroy); + }); + return [ + postMergedValue, + triggerChange + ]; +} +var KeyCode = { + MAC_ENTER: 3, + BACKSPACE: 8, + TAB: 9, + NUM_CENTER: 12, + ENTER: 13, + SHIFT: 16, + CTRL: 17, + ALT: 18, + PAUSE: 19, + CAPS_LOCK: 20, + ESC: 27, + SPACE: 32, + PAGE_UP: 33, + PAGE_DOWN: 34, + END: 35, + HOME: 36, + LEFT: 37, + UP: 38, + RIGHT: 39, + DOWN: 40, + PRINT_SCREEN: 44, + INSERT: 45, + DELETE: 46, + ZERO: 48, + ONE: 49, + TWO: 50, + THREE: 51, + FOUR: 52, + FIVE: 53, + SIX: 54, + SEVEN: 55, + EIGHT: 56, + NINE: 57, + QUESTION_MARK: 63, + A: 65, + B: 66, + C: 67, + D: 68, + E: 69, + F: 70, + G: 71, + H: 72, + I: 73, + J: 74, + K: 75, + L: 76, + M: 77, + N: 78, + O: 79, + P: 80, + Q: 81, + R: 82, + S: 83, + T: 84, + U: 85, + V: 86, + W: 87, + X: 88, + Y: 89, + Z: 90, + META: 91, + WIN_KEY_RIGHT: 92, + CONTEXT_MENU: 93, + NUM_ZERO: 96, + NUM_ONE: 97, + NUM_TWO: 98, + NUM_THREE: 99, + NUM_FOUR: 100, + NUM_FIVE: 101, + NUM_SIX: 102, + NUM_SEVEN: 103, + NUM_EIGHT: 104, + NUM_NINE: 105, + NUM_MULTIPLY: 106, + NUM_PLUS: 107, + NUM_MINUS: 109, + NUM_PERIOD: 110, + NUM_DIVISION: 111, + F1: 112, + F2: 113, + F3: 114, + F4: 115, + F5: 116, + F6: 117, + F7: 118, + F8: 119, + F9: 120, + F10: 121, + F11: 122, + F12: 123, + NUMLOCK: 144, + SEMICOLON: 186, + DASH: 189, + EQUALS: 187, + COMMA: 188, + PERIOD: 190, + SLASH: 191, + APOSTROPHE: 192, + SINGLE_QUOTE: 222, + OPEN_SQUARE_BRACKET: 219, + BACKSLASH: 220, + CLOSE_SQUARE_BRACKET: 221, + WIN_KEY: 224, + MAC_FF_META: 224, + WIN_IME: 229, + isTextModifyingKeyEvent: function(e) { + var keyCode = e.keyCode; + if (e.altKey && !e.ctrlKey || e.metaKey || keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) return false; + switch(keyCode){ + case KeyCode.ALT: + case KeyCode.CAPS_LOCK: + case KeyCode.CONTEXT_MENU: + case KeyCode.CTRL: + case KeyCode.DOWN: + case KeyCode.END: + case KeyCode.ESC: + case KeyCode.HOME: + case KeyCode.INSERT: + case KeyCode.LEFT: + case KeyCode.MAC_FF_META: + case KeyCode.META: + case KeyCode.NUMLOCK: + case KeyCode.NUM_CENTER: + case KeyCode.PAGE_DOWN: + case KeyCode.PAGE_UP: + case KeyCode.PAUSE: + case KeyCode.PRINT_SCREEN: + case KeyCode.RIGHT: + case KeyCode.SHIFT: + case KeyCode.UP: + case KeyCode.WIN_KEY: + case KeyCode.WIN_KEY_RIGHT: + return false; + default: + return true; + } + }, + isCharacterKey: function(keyCode) { + if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) return true; + if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) return true; + if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) return true; + if (-1 !== window.navigator.userAgent.indexOf('WebKit') && 0 === keyCode) return true; + switch(keyCode){ + case KeyCode.SPACE: + case KeyCode.QUESTION_MARK: + case KeyCode.NUM_PLUS: + case KeyCode.NUM_MINUS: + case KeyCode.NUM_PERIOD: + case KeyCode.NUM_DIVISION: + case KeyCode.SEMICOLON: + case KeyCode.DASH: + case KeyCode.EQUALS: + case KeyCode.COMMA: + case KeyCode.PERIOD: + case KeyCode.SLASH: + case KeyCode.APOSTROPHE: + case KeyCode.SINGLE_QUOTE: + case KeyCode.OPEN_SQUARE_BRACKET: + case KeyCode.BACKSLASH: + case KeyCode.CLOSE_SQUARE_BRACKET: + return true; + default: + return false; + } + } +}; +const es_KeyCode = KeyCode; +const getRenderPropValue = (propValue)=>{ + if (!propValue) return null; + return 'function' == typeof propValue ? propValue() : propValue; +}; +const getTransitionName = (rootPrefixCls, motion, transitionName)=>{ + if (void 0 !== transitionName) return transitionName; + return `${rootPrefixCls}-${motion}`; +}; +function isFragment(child) { + return child && /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].isValidElement(child) && child.type === __WEBPACK_EXTERNAL_MODULE_react__["default"].Fragment; +} +const replaceElement = (element, replacement, props)=>{ + if (!/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].isValidElement(element)) return replacement; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].cloneElement(element, 'function' == typeof props ? props(element.props || {}) : props); +}; +function cloneElement(element, props) { + return replaceElement(element, element, props); +} +const context_defaultPrefixCls = 'ant'; +const defaultIconPrefixCls = 'anticon'; +const defaultGetPrefixCls = (suffixCls, customizePrefixCls)=>{ + if (customizePrefixCls) return customizePrefixCls; + return suffixCls ? `${context_defaultPrefixCls}-${suffixCls}` : context_defaultPrefixCls; +}; +const context_ConfigContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext({ + getPrefixCls: defaultGetPrefixCls, + iconPrefixCls: defaultIconPrefixCls +}); +const { Consumer: ConfigConsumer } = context_ConfigContext; +const EMPTY_OBJECT = {}; +function useComponentConfig(propName) { + const context = __WEBPACK_EXTERNAL_MODULE_react__.useContext(context_ConfigContext); + const { getPrefixCls, direction, getPopupContainer } = context; + const propValue = context[propName]; + return Object.assign(Object.assign({ + classNames: EMPTY_OBJECT, + styles: EMPTY_OBJECT + }, propValue), { + getPrefixCls, + direction, + getPopupContainer + }); +} +function Popup(props) { + var children = props.children, prefixCls = props.prefixCls, id = props.id, innerStyle = props.overlayInnerStyle, bodyClassName = props.bodyClassName, className = props.className, style = props.style; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("div", { + className: classnames_default()("".concat(prefixCls, "-content"), className), + style: style + }, /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("div", { + className: classnames_default()("".concat(prefixCls, "-inner"), bodyClassName), + id: id, + role: "tooltip", + style: innerStyle + }, 'function' == typeof children ? children() : children)); +} +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); +} +function typeof_typeof(o) { + 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); +} +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); +} +function toPropertyKey(t) { + var i = toPrimitive(t, "string"); + return "symbol" == typeof_typeof(i) ? i : i + ""; +} +function defineProperty_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; +} +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_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_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; +} +function _objectWithoutPropertiesLoose(r, e) { + if (null == r) return {}; + var t = {}; + for(var n in r)if (({}).hasOwnProperty.call(r, n)) { + if (e.includes(n)) continue; + t[n] = r[n]; + } + return t; +} +function objectWithoutProperties_objectWithoutProperties(e, t) { + if (null == e) return {}; + var o, r, i = _objectWithoutPropertiesLoose(e, t); + if (Object.getOwnPropertySymbols) { + var s = Object.getOwnPropertySymbols(e); + for(r = 0; r < s.length; r++)o = s[r], t.includes(o) || ({}).propertyIsEnumerable.call(e, o) && (i[o] = e[o]); + } + return i; +} +var warned = {}; +var preWarningFns = []; +var warning_preMessage = function(fn) { + preWarningFns.push(fn); +}; +function warning_warning(valid, message) { + if ('production' !== process.env.NODE_ENV && !valid && void 0 !== console) { + var finalMessage = preWarningFns.reduce(function(msg, preMessageFn) { + return preMessageFn(null != msg ? msg : '', 'warning'); + }, message); + if (finalMessage) console.error("Warning: ".concat(finalMessage)); + } +} +function note(valid, message) { + if ('production' !== process.env.NODE_ENV && !valid && void 0 !== console) { + var finalMessage = preWarningFns.reduce(function(msg, preMessageFn) { + return preMessageFn(null != msg ? msg : '', 'note'); + }, message); + if (finalMessage) console.warn("Note: ".concat(finalMessage)); + } +} +function resetWarned() { + warned = {}; +} +function call(method, valid, message) { + if (!valid && !warned[message]) { + method(false, message); + warned[message] = true; + } +} +function warningOnce(valid, message) { + call(warning_warning, valid, message); +} +function noteOnce(valid, message) { + call(note, valid, message); +} +warningOnce.preMessage = warning_preMessage; +warningOnce.resetWarned = resetWarned; +warningOnce.noteOnce = noteOnce; +const es_warning = warningOnce; +var react_is = __webpack_require__("./node_modules/.pnpm/react-is@18.2.0/node_modules/react-is/index.js"); +function useMemo_useMemo(getValue, condition, shouldUpdate) { + var cacheRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef({}); + if (!('value' in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) { + cacheRef.current.value = getValue(); + cacheRef.current.condition = condition; + } + return cacheRef.current.value; +} +var REACT_ELEMENT_TYPE_18 = Symbol.for('react.element'); +var REACT_ELEMENT_TYPE_19 = Symbol.for('react.transitional.element'); +var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); +function isFragment_isFragment(object) { + return object && 'object' === typeof_typeof(object) && (object.$$typeof === REACT_ELEMENT_TYPE_18 || object.$$typeof === REACT_ELEMENT_TYPE_19) && object.type === REACT_FRAGMENT_TYPE; +} +var ReactMajorVersion = Number(__WEBPACK_EXTERNAL_MODULE_react__.version.split('.')[0]); +var ref_fillRef = function(ref, node) { + if ('function' == typeof ref) ref(node); + else if ('object' === typeof_typeof(ref) && ref && 'current' in ref) ref.current = node; +}; +var ref_composeRef = function() { + for(var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++)refs[_key] = arguments[_key]; + var refList = refs.filter(Boolean); + if (refList.length <= 1) return refList[0]; + return function(node) { + refs.forEach(function(ref) { + ref_fillRef(ref, node); + }); + }; +}; +var ref_useComposeRef = function() { + for(var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++)refs[_key2] = arguments[_key2]; + return useMemo_useMemo(function() { + return ref_composeRef.apply(void 0, refs); + }, refs, function(prev, next) { + return prev.length !== next.length || prev.every(function(ref, i) { + return ref !== next[i]; + }); + }); +}; +var ref_supportRef = function(nodeOrComponent) { + var _type$prototype, _nodeOrComponent$prot; + if (!nodeOrComponent) return false; + if (isReactElement(nodeOrComponent) && ReactMajorVersion >= 19) return true; + var type = (0, react_is.isMemo)(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type; + if ('function' == typeof type && !(null != (_type$prototype = type.prototype) && _type$prototype.render) && type.$$typeof !== react_is.ForwardRef) return false; + if ('function' == typeof nodeOrComponent && !(null != (_nodeOrComponent$prot = nodeOrComponent.prototype) && _nodeOrComponent$prot.render) && nodeOrComponent.$$typeof !== react_is.ForwardRef) return false; + return true; +}; +function isReactElement(node) { + return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.isValidElement)(node) && !isFragment_isFragment(node); +} +var ref_getNodeRef = function(node) { + if (node && isReactElement(node)) { + var ele = node; + return ele.props.propertyIsEnumerable('ref') ? ele.props.ref : ele.ref; + } + return null; +}; +var OrderContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext(null); +const es_Context = OrderContext; +function _arrayWithoutHoles(r) { + if (Array.isArray(r)) return _arrayLikeToArray(r); +} +function _iterableToArray(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +function _toConsumableArray(r) { + return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); +} +var EMPTY_LIST = []; +function useDom(render, debug) { + var _React$useState = __WEBPACK_EXTERNAL_MODULE_react__.useState(function() { + if (!canUseDom_canUseDom()) return null; + var defaultEle = document.createElement('div'); + if ('production' !== process.env.NODE_ENV && debug) defaultEle.setAttribute('data-debug', debug); + return defaultEle; + }), _React$useState2 = slicedToArray_slicedToArray(_React$useState, 1), ele = _React$useState2[0]; + var appendedRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(false); + var queueCreate = __WEBPACK_EXTERNAL_MODULE_react__.useContext(es_Context); + var _React$useState3 = __WEBPACK_EXTERNAL_MODULE_react__.useState(EMPTY_LIST), _React$useState4 = slicedToArray_slicedToArray(_React$useState3, 2), queue = _React$useState4[0], setQueue = _React$useState4[1]; + var mergedQueueCreate = queueCreate || (appendedRef.current ? void 0 : function(appendFn) { + setQueue(function(origin) { + var newQueue = [ + appendFn + ].concat(_toConsumableArray(origin)); + return newQueue; + }); + }); + function append() { + if (!ele.parentElement) document.body.appendChild(ele); + appendedRef.current = true; + } + function cleanup() { + var _ele$parentElement; + null == (_ele$parentElement = ele.parentElement) || _ele$parentElement.removeChild(ele); + appendedRef.current = false; + } + hooks_useLayoutEffect(function() { + if (render) if (queueCreate) queueCreate(append); + else append(); + else cleanup(); + return cleanup; + }, [ + render + ]); + hooks_useLayoutEffect(function() { + if (queue.length) { + queue.forEach(function(appendFn) { + return appendFn(); + }); + setQueue(EMPTY_LIST); + } + }, [ + queue + ]); + return [ + ele, + mergedQueueCreate + ]; +} +function contains(root, n) { + if (!root) return false; + if (root.contains) return root.contains(n); + var node = n; + while(node){ + if (node === root) return true; + node = node.parentNode; + } + return false; +} +var APPEND_ORDER = 'data-rc-order'; +var APPEND_PRIORITY = 'data-rc-priority'; +var MARK_KEY = "rc-util-key"; +var containerCache = new Map(); +function getMark() { + var _ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, mark = _ref.mark; + if (mark) return mark.startsWith('data-') ? mark : "data-".concat(mark); + return MARK_KEY; +} +function dynamicCSS_getContainer(option) { + if (option.attachTo) return option.attachTo; + var head = document.querySelector('head'); + return head || document.body; +} +function getOrder(prepend) { + if ('queue' === prepend) return 'prependQueue'; + return prepend ? 'prepend' : 'append'; +} +function findStyles(container) { + return Array.from((containerCache.get(container) || container).children).filter(function(node) { + return 'STYLE' === node.tagName; + }); +} +function injectCSS(css) { + var option = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + if (!canUseDom_canUseDom()) return null; + var csp = option.csp, prepend = option.prepend, _option$priority = option.priority, priority = void 0 === _option$priority ? 0 : _option$priority; + var mergedOrder = getOrder(prepend); + var isPrependQueue = 'prependQueue' === mergedOrder; + var styleNode = document.createElement('style'); + styleNode.setAttribute(APPEND_ORDER, mergedOrder); + if (isPrependQueue && priority) styleNode.setAttribute(APPEND_PRIORITY, "".concat(priority)); + if (null != csp && csp.nonce) styleNode.nonce = null == csp ? void 0 : csp.nonce; + styleNode.innerHTML = css; + var container = dynamicCSS_getContainer(option); + var firstChild = container.firstChild; + if (prepend) { + if (isPrependQueue) { + var existStyle = (option.styles || findStyles(container)).filter(function(node) { + if (![ + 'prepend', + 'prependQueue' + ].includes(node.getAttribute(APPEND_ORDER))) return false; + var nodePriority = Number(node.getAttribute(APPEND_PRIORITY) || 0); + return priority >= nodePriority; + }); + if (existStyle.length) { + container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling); + return styleNode; + } + } + container.insertBefore(styleNode, firstChild); + } else container.appendChild(styleNode); + return styleNode; +} +function findExistNode(key) { + var option = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + var container = dynamicCSS_getContainer(option); + return (option.styles || findStyles(container)).find(function(node) { + return node.getAttribute(getMark(option)) === key; + }); +} +function dynamicCSS_removeCSS(key) { + var option = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + var existNode = findExistNode(key, option); + if (existNode) { + var container = dynamicCSS_getContainer(option); + container.removeChild(existNode); + } +} +function syncRealContainer(container, option) { + var cachedRealContainer = containerCache.get(container); + if (!cachedRealContainer || !contains(document, cachedRealContainer)) { + var placeholderStyle = injectCSS('', option); + var parentNode = placeholderStyle.parentNode; + containerCache.set(container, parentNode); + container.removeChild(placeholderStyle); + } +} +function dynamicCSS_updateCSS(css, key) { + var originOption = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}; + var container = dynamicCSS_getContainer(originOption); + var styles = findStyles(container); + var option = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, originOption), {}, { + styles: styles + }); + syncRealContainer(container, option); + var existNode = findExistNode(key, option); + if (existNode) { + var _option$csp, _option$csp2; + if (null != (_option$csp = option.csp) && _option$csp.nonce && existNode.nonce !== (null == (_option$csp2 = option.csp) ? void 0 : _option$csp2.nonce)) { + var _option$csp3; + existNode.nonce = null == (_option$csp3 = option.csp) ? void 0 : _option$csp3.nonce; + } + if (existNode.innerHTML !== css) existNode.innerHTML = css; + return existNode; + } + var newNode = injectCSS(css, option); + newNode.setAttribute(getMark(option), key); + return newNode; +} +function measureScrollbarSize(ele) { + var randomId = "rc-scrollbar-measure-".concat(Math.random().toString(36).substring(7)); + var measureEle = document.createElement('div'); + measureEle.id = randomId; + var measureStyle = measureEle.style; + measureStyle.position = 'absolute'; + measureStyle.left = '0'; + measureStyle.top = '0'; + measureStyle.width = '100px'; + measureStyle.height = '100px'; + measureStyle.overflow = 'scroll'; + var fallbackWidth; + var fallbackHeight; + if (ele) { + var targetStyle = getComputedStyle(ele); + measureStyle.scrollbarColor = targetStyle.scrollbarColor; + measureStyle.scrollbarWidth = targetStyle.scrollbarWidth; + var webkitScrollbarStyle = getComputedStyle(ele, '::-webkit-scrollbar'); + var width = parseInt(webkitScrollbarStyle.width, 10); + var height = parseInt(webkitScrollbarStyle.height, 10); + try { + var widthStyle = width ? "width: ".concat(webkitScrollbarStyle.width, ";") : ''; + var heightStyle = height ? "height: ".concat(webkitScrollbarStyle.height, ";") : ''; + dynamicCSS_updateCSS("\n#".concat(randomId, "::-webkit-scrollbar {\n").concat(widthStyle, "\n").concat(heightStyle, "\n}"), randomId); + } catch (e) { + console.error(e); + fallbackWidth = width; + fallbackHeight = height; + } + } + document.body.appendChild(measureEle); + var scrollWidth = ele && fallbackWidth && !isNaN(fallbackWidth) ? fallbackWidth : measureEle.offsetWidth - measureEle.clientWidth; + var scrollHeight = ele && fallbackHeight && !isNaN(fallbackHeight) ? fallbackHeight : measureEle.offsetHeight - measureEle.clientHeight; + document.body.removeChild(measureEle); + dynamicCSS_removeCSS(randomId); + return { + width: scrollWidth, + height: scrollHeight + }; +} +function getTargetScrollBarSize(target) { + if ('undefined' == typeof document || !target || !(target instanceof Element)) return { + width: 0, + height: 0 + }; + return measureScrollbarSize(target); +} +function isBodyOverflowing() { + return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth; +} +var UNIQUE_ID = "rc-util-locker-".concat(Date.now()); +var uuid = 0; +function useScrollLocker(lock) { + var mergedLock = !!lock; + var _React$useState = __WEBPACK_EXTERNAL_MODULE_react__.useState(function() { + uuid += 1; + return "".concat(UNIQUE_ID, "_").concat(uuid); + }), _React$useState2 = slicedToArray_slicedToArray(_React$useState, 1), id = _React$useState2[0]; + hooks_useLayoutEffect(function() { + if (mergedLock) { + var scrollbarSize = getTargetScrollBarSize(document.body).width; + var isOverflow = isBodyOverflowing(); + dynamicCSS_updateCSS("\nhtml body {\n overflow-y: hidden;\n ".concat(isOverflow ? "width: calc(100% - ".concat(scrollbarSize, "px);") : '', "\n}"), id); + } else dynamicCSS_removeCSS(id); + return function() { + dynamicCSS_removeCSS(id); + }; + }, [ + mergedLock, + id + ]); +} +var inline = false; +function inlineMock(nextInline) { + if ('boolean' == typeof nextInline) inline = nextInline; + return inline; +} +var Portal_getPortalContainer = function(getContainer) { + if (false === getContainer) return false; + if (!canUseDom_canUseDom() || !getContainer) return null; + if ('string' == typeof getContainer) return document.querySelector(getContainer); + if ('function' == typeof getContainer) return getContainer(); + return getContainer; +}; +var Portal_Portal = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef(function(props, ref) { + var open = props.open, autoLock = props.autoLock, getContainer = props.getContainer, debug = props.debug, _props$autoDestroy = props.autoDestroy, autoDestroy = void 0 === _props$autoDestroy ? true : _props$autoDestroy, children = props.children; + var _React$useState = __WEBPACK_EXTERNAL_MODULE_react__.useState(open), _React$useState2 = slicedToArray_slicedToArray(_React$useState, 2), shouldRender = _React$useState2[0], setShouldRender = _React$useState2[1]; + var mergedRender = shouldRender || open; + if ('production' !== process.env.NODE_ENV) es_warning(canUseDom_canUseDom() || !open, "Portal only work in client side. Please call 'useEffect' to show Portal instead default render in SSR."); + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(function() { + if (autoDestroy || open) setShouldRender(open); + }, [ + open, + autoDestroy + ]); + var _React$useState3 = __WEBPACK_EXTERNAL_MODULE_react__.useState(function() { + return Portal_getPortalContainer(getContainer); + }), _React$useState4 = slicedToArray_slicedToArray(_React$useState3, 2), innerContainer = _React$useState4[0], setInnerContainer = _React$useState4[1]; + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(function() { + var customizeContainer = Portal_getPortalContainer(getContainer); + setInnerContainer(null != customizeContainer ? customizeContainer : null); + }); + var _useDom = useDom(mergedRender && !innerContainer, debug), _useDom2 = slicedToArray_slicedToArray(_useDom, 2), defaultContainer = _useDom2[0], queueCreate = _useDom2[1]; + var mergedContainer = null != innerContainer ? innerContainer : defaultContainer; + useScrollLocker(autoLock && open && canUseDom_canUseDom() && (mergedContainer === defaultContainer || mergedContainer === document.body)); + var childRef = null; + if (children && ref_supportRef(children) && ref) { + var _ref = children; + childRef = _ref.ref; + } + var mergedRef = ref_useComposeRef(childRef, ref); + if (!mergedRender || !canUseDom_canUseDom() || void 0 === innerContainer) return null; + var renderInline = false === mergedContainer || inlineMock(); + var reffedChildren = children; + if (ref) reffedChildren = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.cloneElement(children, { + ref: mergedRef + }); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(es_Context.Provider, { + value: queueCreate + }, renderInline ? reffedChildren : /*#__PURE__*/ createPortal(reffedChildren, mergedContainer)); +}); +if ('production' !== process.env.NODE_ENV) Portal_Portal.displayName = 'Portal'; +const es_Portal = Portal_Portal; +const es = es_Portal; +function toArray_toArray(children) { + var option = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + var ret = []; + __WEBPACK_EXTERNAL_MODULE_react__["default"].Children.forEach(children, function(child) { + if (null == child && !option.keepEmpty) return; + if (Array.isArray(child)) ret = ret.concat(toArray_toArray(child)); + else if (isFragment_isFragment(child) && child.props) ret = ret.concat(toArray_toArray(child.props.children, option)); + else ret.push(child); + }); + return ret; +} +function isDOM(node) { + return node instanceof HTMLElement || node instanceof SVGElement; +} +function getDOM(node) { + if (node && 'object' === typeof_typeof(node) && isDOM(node.nativeElement)) return node.nativeElement; + if (isDOM(node)) return node; + return null; +} +function findDOMNode(node) { + var domNode = getDOM(node); + if (domNode) return domNode; + if (node instanceof __WEBPACK_EXTERNAL_MODULE_react__["default"].Component) { + var _ReactDOM$findDOMNode; + return null == (_ReactDOM$findDOMNode = react_dom.findDOMNode) ? void 0 : _ReactDOM$findDOMNode.call(react_dom, node); + } + return null; +} +var CollectionContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext(null); +function Collection(_ref) { + var children = _ref.children, onBatchResize = _ref.onBatchResize; + var resizeIdRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(0); + var resizeInfosRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef([]); + var onCollectionResize = __WEBPACK_EXTERNAL_MODULE_react__.useContext(CollectionContext); + var onResize = __WEBPACK_EXTERNAL_MODULE_react__.useCallback(function(size, element, data) { + resizeIdRef.current += 1; + var currentId = resizeIdRef.current; + resizeInfosRef.current.push({ + size: size, + element: element, + data: data + }); + Promise.resolve().then(function() { + if (currentId === resizeIdRef.current) { + null == onBatchResize || onBatchResize(resizeInfosRef.current); + resizeInfosRef.current = []; + } + }); + null == onCollectionResize || onCollectionResize(size, element, data); + }, [ + onBatchResize, + onCollectionResize + ]); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(CollectionContext.Provider, { + value: onResize + }, children); +} +var MapShim = function() { + if ('undefined' != typeof Map) return Map; + function getIndex(arr, key) { + var result = -1; + arr.some(function(entry, index) { + if (entry[0] === key) { + result = index; + return true; + } + return false; + }); + return result; + } + return function() { + function class_1() { + this.__entries__ = []; + } + Object.defineProperty(class_1.prototype, "size", { + get: function() { + return this.__entries__.length; + }, + enumerable: true, + configurable: true + }); + class_1.prototype.get = function(key) { + var index = getIndex(this.__entries__, key); + var entry = this.__entries__[index]; + return entry && entry[1]; + }; + class_1.prototype.set = function(key, value) { + var index = getIndex(this.__entries__, key); + if (~index) this.__entries__[index][1] = value; + else this.__entries__.push([ + key, + value + ]); + }; + class_1.prototype.delete = function(key) { + var entries = this.__entries__; + var index = getIndex(entries, key); + if (~index) entries.splice(index, 1); + }; + class_1.prototype.has = function(key) { + return !!~getIndex(this.__entries__, key); + }; + class_1.prototype.clear = function() { + this.__entries__.splice(0); + }; + class_1.prototype.forEach = function(callback, ctx) { + if (void 0 === ctx) ctx = null; + for(var _i = 0, _a = this.__entries__; _i < _a.length; _i++){ + var entry = _a[_i]; + callback.call(ctx, entry[1], entry[0]); + } + }; + return class_1; + }(); +}(); +var isBrowser = 'undefined' != typeof window && 'undefined' != typeof document && window.document === document; +var global$1 = function() { + if (void 0 !== __webpack_require__.g && __webpack_require__.g.Math === Math) return __webpack_require__.g; + if ('undefined' != typeof self && self.Math === Math) return self; + if ('undefined' != typeof window && window.Math === Math) return window; + return Function('return this')(); +}(); +var requestAnimationFrame$1 = function() { + if ('function' == typeof requestAnimationFrame) return requestAnimationFrame.bind(global$1); + return function(callback) { + return setTimeout(function() { + return callback(Date.now()); + }, 1000 / 60); + }; +}(); +var trailingTimeout = 2; +function throttle(callback, delay) { + var leadingCall = false, trailingCall = false, lastCallTime = 0; + function resolvePending() { + if (leadingCall) { + leadingCall = false; + callback(); + } + if (trailingCall) proxy(); + } + function timeoutCallback() { + requestAnimationFrame$1(resolvePending); + } + function proxy() { + var timeStamp = Date.now(); + if (leadingCall) { + if (timeStamp - lastCallTime < trailingTimeout) return; + trailingCall = true; + } else { + leadingCall = true; + trailingCall = false; + setTimeout(timeoutCallback, delay); + } + lastCallTime = timeStamp; + } + return proxy; +} +var REFRESH_DELAY = 20; +var transitionKeys = [ + 'top', + 'right', + 'bottom', + 'left', + 'width', + 'height', + 'size', + 'weight' +]; +var mutationObserverSupported = 'undefined' != typeof MutationObserver; +var ResizeObserver_es_ResizeObserverController = function() { + function ResizeObserverController() { + this.connected_ = false; + this.mutationEventsAdded_ = false; + this.mutationsObserver_ = null; + this.observers_ = []; + this.onTransitionEnd_ = this.onTransitionEnd_.bind(this); + this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY); + } + ResizeObserverController.prototype.addObserver = function(observer) { + if (!~this.observers_.indexOf(observer)) this.observers_.push(observer); + if (!this.connected_) this.connect_(); + }; + ResizeObserverController.prototype.removeObserver = function(observer) { + var observers = this.observers_; + var index = observers.indexOf(observer); + if (~index) observers.splice(index, 1); + if (!observers.length && this.connected_) this.disconnect_(); + }; + ResizeObserverController.prototype.refresh = function() { + var changesDetected = this.updateObservers_(); + if (changesDetected) this.refresh(); + }; + ResizeObserverController.prototype.updateObservers_ = function() { + var activeObservers = this.observers_.filter(function(observer) { + return observer.gatherActive(), observer.hasActive(); + }); + activeObservers.forEach(function(observer) { + return observer.broadcastActive(); + }); + return activeObservers.length > 0; + }; + ResizeObserverController.prototype.connect_ = function() { + if (!isBrowser || this.connected_) return; + document.addEventListener('transitionend', this.onTransitionEnd_); + window.addEventListener('resize', this.refresh); + if (mutationObserverSupported) { + this.mutationsObserver_ = new MutationObserver(this.refresh); + this.mutationsObserver_.observe(document, { + attributes: true, + childList: true, + characterData: true, + subtree: true + }); + } else { + document.addEventListener('DOMSubtreeModified', this.refresh); + this.mutationEventsAdded_ = true; + } + this.connected_ = true; + }; + ResizeObserverController.prototype.disconnect_ = function() { + if (!isBrowser || !this.connected_) return; + document.removeEventListener('transitionend', this.onTransitionEnd_); + window.removeEventListener('resize', this.refresh); + if (this.mutationsObserver_) this.mutationsObserver_.disconnect(); + if (this.mutationEventsAdded_) document.removeEventListener('DOMSubtreeModified', this.refresh); + this.mutationsObserver_ = null; + this.mutationEventsAdded_ = false; + this.connected_ = false; + }; + ResizeObserverController.prototype.onTransitionEnd_ = function(_a) { + var _b = _a.propertyName, propertyName = void 0 === _b ? '' : _b; + var isReflowProperty = transitionKeys.some(function(key) { + return !!~propertyName.indexOf(key); + }); + if (isReflowProperty) this.refresh(); + }; + ResizeObserverController.getInstance = function() { + if (!this.instance_) this.instance_ = new ResizeObserverController(); + return this.instance_; + }; + ResizeObserverController.instance_ = null; + return ResizeObserverController; +}(); +var defineConfigurable = function(target, props) { + for(var _i = 0, _a = Object.keys(props); _i < _a.length; _i++){ + var key = _a[_i]; + Object.defineProperty(target, key, { + value: props[key], + enumerable: false, + writable: false, + configurable: true + }); + } + return target; +}; +var getWindowOf = function(target) { + var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView; + return ownerGlobal || global$1; +}; +var emptyRect = createRectInit(0, 0, 0, 0); +function toFloat(value) { + return parseFloat(value) || 0; +} +function getBordersSize(styles) { + var positions = []; + for(var _i = 1; _i < arguments.length; _i++)positions[_i - 1] = arguments[_i]; + return positions.reduce(function(size, position) { + var value = styles['border-' + position + '-width']; + return size + toFloat(value); + }, 0); +} +function getPaddings(styles) { + var positions = [ + 'top', + 'right', + 'bottom', + 'left' + ]; + var paddings = {}; + for(var _i = 0, positions_1 = positions; _i < positions_1.length; _i++){ + var position = positions_1[_i]; + var value = styles['padding-' + position]; + paddings[position] = toFloat(value); + } + return paddings; +} +function getSVGContentRect(target) { + var bbox = target.getBBox(); + return createRectInit(0, 0, bbox.width, bbox.height); +} +function getHTMLElementContentRect(target) { + var clientWidth = target.clientWidth, clientHeight = target.clientHeight; + if (!clientWidth && !clientHeight) return emptyRect; + var styles = getWindowOf(target).getComputedStyle(target); + var paddings = getPaddings(styles); + var horizPad = paddings.left + paddings.right; + var vertPad = paddings.top + paddings.bottom; + var width = toFloat(styles.width), height = toFloat(styles.height); + if ('border-box' === styles.boxSizing) { + if (Math.round(width + horizPad) !== clientWidth) width -= getBordersSize(styles, 'left', 'right') + horizPad; + if (Math.round(height + vertPad) !== clientHeight) height -= getBordersSize(styles, 'top', 'bottom') + vertPad; + } + if (!isDocumentElement(target)) { + var vertScrollbar = Math.round(width + horizPad) - clientWidth; + var horizScrollbar = Math.round(height + vertPad) - clientHeight; + if (1 !== Math.abs(vertScrollbar)) width -= vertScrollbar; + if (1 !== Math.abs(horizScrollbar)) height -= horizScrollbar; + } + return createRectInit(paddings.left, paddings.top, width, height); +} +var isSVGGraphicsElement = function() { + if ('undefined' != typeof SVGGraphicsElement) return function(target) { + return target instanceof getWindowOf(target).SVGGraphicsElement; + }; + return function(target) { + return target instanceof getWindowOf(target).SVGElement && 'function' == typeof target.getBBox; + }; +}(); +function isDocumentElement(target) { + return target === getWindowOf(target).document.documentElement; +} +function getContentRect(target) { + if (!isBrowser) return emptyRect; + if (isSVGGraphicsElement(target)) return getSVGContentRect(target); + return getHTMLElementContentRect(target); +} +function createReadOnlyRect(_a) { + var x = _a.x, y = _a.y, width = _a.width, height = _a.height; + var Constr = 'undefined' != typeof DOMRectReadOnly ? DOMRectReadOnly : Object; + var rect = Object.create(Constr.prototype); + defineConfigurable(rect, { + x: x, + y: y, + width: width, + height: height, + top: y, + right: x + width, + bottom: height + y, + left: x + }); + return rect; +} +function createRectInit(x, y, width, height) { + return { + x: x, + y: y, + width: width, + height: height + }; +} +var ResizeObserver_es_ResizeObservation = function() { + function ResizeObservation(target) { + this.broadcastWidth = 0; + this.broadcastHeight = 0; + this.contentRect_ = createRectInit(0, 0, 0, 0); + this.target = target; + } + ResizeObservation.prototype.isActive = function() { + var rect = getContentRect(this.target); + this.contentRect_ = rect; + return rect.width !== this.broadcastWidth || rect.height !== this.broadcastHeight; + }; + ResizeObservation.prototype.broadcastRect = function() { + var rect = this.contentRect_; + this.broadcastWidth = rect.width; + this.broadcastHeight = rect.height; + return rect; + }; + return ResizeObservation; +}(); +var ResizeObserver_es_ResizeObserverEntry = function() { + function ResizeObserverEntry(target, rectInit) { + var contentRect = createReadOnlyRect(rectInit); + defineConfigurable(this, { + target: target, + contentRect: contentRect + }); + } + return ResizeObserverEntry; +}(); +var ResizeObserver_es_ResizeObserverSPI = function() { + function ResizeObserverSPI(callback, controller, callbackCtx) { + this.activeObservations_ = []; + this.observations_ = new MapShim(); + if ('function' != typeof callback) throw new TypeError('The callback provided as parameter 1 is not a function.'); + this.callback_ = callback; + this.controller_ = controller; + this.callbackCtx_ = callbackCtx; + } + ResizeObserverSPI.prototype.observe = function(target) { + if (!arguments.length) throw new TypeError('1 argument required, but only 0 present.'); + if ('undefined' == typeof Element || !(Element instanceof Object)) return; + if (!(target instanceof getWindowOf(target).Element)) throw new TypeError('parameter 1 is not of type "Element".'); + var observations = this.observations_; + if (observations.has(target)) return; + observations.set(target, new ResizeObserver_es_ResizeObservation(target)); + this.controller_.addObserver(this); + this.controller_.refresh(); + }; + ResizeObserverSPI.prototype.unobserve = function(target) { + if (!arguments.length) throw new TypeError('1 argument required, but only 0 present.'); + if ('undefined' == typeof Element || !(Element instanceof Object)) return; + if (!(target instanceof getWindowOf(target).Element)) throw new TypeError('parameter 1 is not of type "Element".'); + var observations = this.observations_; + if (!observations.has(target)) return; + observations.delete(target); + if (!observations.size) this.controller_.removeObserver(this); + }; + ResizeObserverSPI.prototype.disconnect = function() { + this.clearActive(); + this.observations_.clear(); + this.controller_.removeObserver(this); + }; + ResizeObserverSPI.prototype.gatherActive = function() { + var _this = this; + this.clearActive(); + this.observations_.forEach(function(observation) { + if (observation.isActive()) _this.activeObservations_.push(observation); + }); + }; + ResizeObserverSPI.prototype.broadcastActive = function() { + if (!this.hasActive()) return; + var ctx = this.callbackCtx_; + var entries = this.activeObservations_.map(function(observation) { + return new ResizeObserver_es_ResizeObserverEntry(observation.target, observation.broadcastRect()); + }); + this.callback_.call(ctx, entries, ctx); + this.clearActive(); + }; + ResizeObserverSPI.prototype.clearActive = function() { + this.activeObservations_.splice(0); + }; + ResizeObserverSPI.prototype.hasActive = function() { + return this.activeObservations_.length > 0; + }; + return ResizeObserverSPI; +}(); +var ResizeObserver_es_observers = 'undefined' != typeof WeakMap ? new WeakMap() : new MapShim(); +var ResizeObserver_es_ResizeObserver = function() { + function ResizeObserver(callback) { + if (!(this instanceof ResizeObserver)) throw new TypeError('Cannot call a class as a function.'); + if (!arguments.length) throw new TypeError('1 argument required, but only 0 present.'); + var controller = ResizeObserver_es_ResizeObserverController.getInstance(); + var observer = new ResizeObserver_es_ResizeObserverSPI(callback, controller, this); + ResizeObserver_es_observers.set(this, observer); + } + return ResizeObserver; +}(); +[ + 'observe', + 'unobserve', + 'disconnect' +].forEach(function(method) { + ResizeObserver_es_ResizeObserver.prototype[method] = function() { + var _a; + return (_a = ResizeObserver_es_observers.get(this))[method].apply(_a, arguments); + }; +}); +var ResizeObserver_es_index = function() { + if (void 0 !== global$1.ResizeObserver) return global$1.ResizeObserver; + return ResizeObserver_es_ResizeObserver; +}(); +const ResizeObserver_es = ResizeObserver_es_index; +var elementListeners = new Map(); +function observerUtil_onResize(entities) { + entities.forEach(function(entity) { + var _elementListeners$get; + var target = entity.target; + null == (_elementListeners$get = elementListeners.get(target)) || _elementListeners$get.forEach(function(listener) { + return listener(target); + }); + }); +} +var resizeObserver = new ResizeObserver_es(observerUtil_onResize); +process.env.NODE_ENV; +process.env.NODE_ENV; +function observe(element, callback) { + if (!elementListeners.has(element)) { + elementListeners.set(element, new Set()); + resizeObserver.observe(element); + } + elementListeners.get(element).add(callback); +} +function unobserve(element, callback) { + if (elementListeners.has(element)) { + elementListeners.get(element).delete(callback); + if (!elementListeners.get(element).size) { + resizeObserver.unobserve(element); + elementListeners.delete(element); + } + } +} +function classCallCheck_classCallCheck(a, n) { + if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); +} +function _defineProperties(e, r) { + for(var t = 0; t < r.length; t++){ + var o = r[t]; + o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o); + } +} +function createClass_createClass(e, r, t) { + return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { + writable: !1 + }), e; +} +function _setPrototypeOf(t, e) { + return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) { + return t.__proto__ = e, t; + }, _setPrototypeOf(t, e); +} +function inherits_inherits(t, e) { + if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); + t.prototype = Object.create(e && e.prototype, { + constructor: { + value: t, + writable: !0, + configurable: !0 + } + }), Object.defineProperty(t, "prototype", { + writable: !1 + }), e && _setPrototypeOf(t, e); +} +function _getPrototypeOf(t) { + return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) { + return t.__proto__ || Object.getPrototypeOf(t); + }, _getPrototypeOf(t); +} +function isNativeReflectConstruct_isNativeReflectConstruct() { + try { + var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); + } catch (t) {} + return (isNativeReflectConstruct_isNativeReflectConstruct = function() { + return !!t; + })(); +} +function assertThisInitialized_assertThisInitialized(e) { + if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return e; +} +function _possibleConstructorReturn(t, e) { + if (e && ("object" == typeof_typeof(e) || "function" == typeof e)) return e; + if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); + return assertThisInitialized_assertThisInitialized(t); +} +function createSuper_createSuper(t) { + var r = isNativeReflectConstruct_isNativeReflectConstruct(); + return function() { + var e, o = _getPrototypeOf(t); + if (r) { + var s = _getPrototypeOf(this).constructor; + e = Reflect.construct(o, arguments, s); + } else e = o.apply(this, arguments); + return _possibleConstructorReturn(this, e); + }; +} +var DomWrapper_DomWrapper = /*#__PURE__*/ function(_React$Component) { + inherits_inherits(DomWrapper, _React$Component); + var _super = createSuper_createSuper(DomWrapper); + function DomWrapper() { + classCallCheck_classCallCheck(this, DomWrapper); + return _super.apply(this, arguments); + } + createClass_createClass(DomWrapper, [ + { + key: "render", + value: function() { + return this.props.children; + } + } + ]); + return DomWrapper; +}(__WEBPACK_EXTERNAL_MODULE_react__.Component); +function SingleObserver(props, ref) { + var children = props.children, disabled = props.disabled; + var elementRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(null); + var wrapperRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(null); + var onCollectionResize = __WEBPACK_EXTERNAL_MODULE_react__.useContext(CollectionContext); + var isRenderProps = 'function' == typeof children; + var mergedChildren = isRenderProps ? children(elementRef) : children; + var sizeRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef({ + width: -1, + height: -1, + offsetWidth: -1, + offsetHeight: -1 + }); + var canRef = !isRenderProps && /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.isValidElement(mergedChildren) && ref_supportRef(mergedChildren); + var originRef = canRef ? ref_getNodeRef(mergedChildren) : null; + var mergedRef = ref_useComposeRef(originRef, elementRef); + var getDom = function() { + var _elementRef$current; + return findDOMNode(elementRef.current) || (elementRef.current && 'object' === typeof_typeof(elementRef.current) ? findDOMNode(null == (_elementRef$current = elementRef.current) ? void 0 : _elementRef$current.nativeElement) : null) || findDOMNode(wrapperRef.current); + }; + __WEBPACK_EXTERNAL_MODULE_react__.useImperativeHandle(ref, function() { + return getDom(); + }); + var propsRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(props); + propsRef.current = props; + var onInternalResize = __WEBPACK_EXTERNAL_MODULE_react__.useCallback(function(target) { + var _propsRef$current = propsRef.current, onResize = _propsRef$current.onResize, data = _propsRef$current.data; + var _target$getBoundingCl = target.getBoundingClientRect(), width = _target$getBoundingCl.width, height = _target$getBoundingCl.height; + var offsetWidth = target.offsetWidth, offsetHeight = target.offsetHeight; + var fixedWidth = Math.floor(width); + var fixedHeight = Math.floor(height); + if (sizeRef.current.width !== fixedWidth || sizeRef.current.height !== fixedHeight || sizeRef.current.offsetWidth !== offsetWidth || sizeRef.current.offsetHeight !== offsetHeight) { + var size = { + width: fixedWidth, + height: fixedHeight, + offsetWidth: offsetWidth, + offsetHeight: offsetHeight + }; + sizeRef.current = size; + var mergedOffsetWidth = offsetWidth === Math.round(width) ? width : offsetWidth; + var mergedOffsetHeight = offsetHeight === Math.round(height) ? height : offsetHeight; + var sizeInfo = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, size), {}, { + offsetWidth: mergedOffsetWidth, + offsetHeight: mergedOffsetHeight + }); + null == onCollectionResize || onCollectionResize(sizeInfo, target, data); + if (onResize) Promise.resolve().then(function() { + onResize(sizeInfo, target); + }); + } + }, []); + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(function() { + var currentElement = getDom(); + if (currentElement && !disabled) observe(currentElement, onInternalResize); + return function() { + return unobserve(currentElement, onInternalResize); + }; + }, [ + elementRef.current, + disabled + ]); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(DomWrapper_DomWrapper, { + ref: wrapperRef + }, canRef ? /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.cloneElement(mergedChildren, { + ref: mergedRef + }) : mergedChildren); +} +var RefSingleObserver = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef(SingleObserver); +if ('production' !== process.env.NODE_ENV) RefSingleObserver.displayName = 'SingleObserver'; +const es_SingleObserver = RefSingleObserver; +var INTERNAL_PREFIX_KEY = 'rc-observer-key'; +function es_ResizeObserver(props, ref) { + var children = props.children; + var childNodes = 'function' == typeof children ? [ + children + ] : toArray_toArray(children); + if ('production' !== process.env.NODE_ENV) { + if (childNodes.length > 1) warning_warning(false, 'Find more than one child node with `children` in ResizeObserver. Please use ResizeObserver.Collection instead.'); + else if (0 === childNodes.length) warning_warning(false, '`children` of ResizeObserver is empty. Nothing is in observe.'); + } + return childNodes.map(function(child, index) { + var key = (null == child ? void 0 : child.key) || "".concat(INTERNAL_PREFIX_KEY, "-").concat(index); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(es_SingleObserver, _extends({}, props, { + key: key, + ref: 0 === index ? ref : void 0 + }), child); + }); +} +var RefResizeObserver = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef(es_ResizeObserver); +if ('production' !== process.env.NODE_ENV) RefResizeObserver.displayName = 'ResizeObserver'; +RefResizeObserver.Collection = Collection; +const rc_resize_observer_es = RefResizeObserver; +function getRoot(ele) { + var _ele$getRootNode; + return null == ele || null == (_ele$getRootNode = ele.getRootNode) ? void 0 : _ele$getRootNode.call(ele); +} +function inShadow(ele) { + return getRoot(ele) instanceof ShadowRoot; +} +function getShadowRoot(ele) { + return inShadow(ele) ? getRoot(ele) : null; +} +function getUseId() { + var fullClone = objectSpread2_objectSpread2({}, __WEBPACK_EXTERNAL_MODULE_react__); + return fullClone.useId; +} +var useId_uuid = 0; +var useOriginId = getUseId(); +const hooks_useId = useOriginId ? function(id) { + var reactId = useOriginId(); + if (id) return id; + if ('test' === process.env.NODE_ENV) return 'test-id'; + return reactId; +} : function(id) { + var _React$useState = __WEBPACK_EXTERNAL_MODULE_react__.useState('ssr-id'), _React$useState2 = slicedToArray_slicedToArray(_React$useState, 2), innerId = _React$useState2[0], setInnerId = _React$useState2[1]; + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(function() { + var nextId = useId_uuid; + useId_uuid += 1; + setInnerId("rc_unique_".concat(nextId)); + }, []); + if (id) return id; + if ('test' === process.env.NODE_ENV) return 'test-id'; + return innerId; +}; +const isMobile = function() { + if ('undefined' == typeof navigator || 'undefined' == typeof window) return false; + var agent = navigator.userAgent || navigator.vendor || window.opera; + return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(agent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(null == agent ? void 0 : agent.substr(0, 4)); +}; +var context_Context = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext({}); +var es_DomWrapper_DomWrapper = /*#__PURE__*/ function(_React$Component) { + inherits_inherits(DomWrapper, _React$Component); + var _super = createSuper_createSuper(DomWrapper); + function DomWrapper() { + classCallCheck_classCallCheck(this, DomWrapper); + return _super.apply(this, arguments); + } + createClass_createClass(DomWrapper, [ + { + key: "render", + value: function() { + return this.props.children; + } + } + ]); + return DomWrapper; +}(__WEBPACK_EXTERNAL_MODULE_react__.Component); +const es_DomWrapper = es_DomWrapper_DomWrapper; +function get_get(entity, path) { + var current = entity; + for(var i = 0; i < path.length; i += 1){ + if (null == current) return; + current = current[path[i]]; + } + return current; +} +function _toArray(r) { + return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); +} +function internalSet(entity, paths, value, removeIfUndefined) { + if (!paths.length) return value; + var _paths = _toArray(paths), path = _paths[0], restPath = _paths.slice(1); + var clone; + clone = entity || 'number' != typeof path ? Array.isArray(entity) ? _toConsumableArray(entity) : objectSpread2_objectSpread2({}, entity) : []; + if (removeIfUndefined && void 0 === value && 1 === restPath.length) delete clone[path][restPath[0]]; + else clone[path] = internalSet(clone[path], restPath, value, removeIfUndefined); + return clone; +} +function set_set(entity, paths, value) { + var removeIfUndefined = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : false; + if (paths.length && removeIfUndefined && void 0 === value && !get_get(entity, paths.slice(0, -1))) return entity; + return internalSet(entity, paths, value, removeIfUndefined); +} +function isObject(obj) { + return 'object' === typeof_typeof(obj) && null !== obj && Object.getPrototypeOf(obj) === Object.prototype; +} +function createEmpty(source) { + return Array.isArray(source) ? [] : {}; +} +var set_keys = 'undefined' == typeof Reflect ? Object.keys : Reflect.ownKeys; +function merge() { + for(var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++)sources[_key] = arguments[_key]; + var clone = createEmpty(sources[0]); + sources.forEach(function(src) { + function internalMerge(path, parentLoopSet) { + var loopSet = new Set(parentLoopSet); + var value = get_get(src, path); + var isArr = Array.isArray(value); + if (isArr || isObject(value)) { + if (!loopSet.has(value)) { + loopSet.add(value); + var originValue = get_get(clone, path); + if (isArr) clone = set_set(clone, path, []); + else if (!originValue || 'object' !== typeof_typeof(originValue)) clone = set_set(clone, path, createEmpty(value)); + set_keys(value).forEach(function(key) { + internalMerge([].concat(_toConsumableArray(path), [ + key + ]), loopSet); + }); + } + } else clone = set_set(clone, path, value); + } + internalMerge([]); + }); + return clone; +} +function useSyncState(defaultValue) { + var _React$useReducer = __WEBPACK_EXTERNAL_MODULE_react__.useReducer(function(x) { + return x + 1; + }, 0), _React$useReducer2 = slicedToArray_slicedToArray(_React$useReducer, 2), forceUpdate = _React$useReducer2[1]; + var currentValueRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(defaultValue); + var getValue = useEvent(function() { + return currentValueRef.current; + }); + var setValue = useEvent(function(updater) { + currentValueRef.current = 'function' == typeof updater ? updater(currentValueRef.current) : updater; + forceUpdate(); + }); + return [ + getValue, + setValue + ]; +} +var STATUS_NONE = 'none'; +var STATUS_APPEAR = 'appear'; +var STATUS_ENTER = 'enter'; +var STATUS_LEAVE = 'leave'; +var STEP_NONE = 'none'; +var STEP_PREPARE = 'prepare'; +var STEP_START = 'start'; +var STEP_ACTIVE = 'active'; +var STEP_ACTIVATED = 'end'; +var STEP_PREPARED = 'prepared'; +function makePrefixMap(styleProp, eventName) { + var prefixes = {}; + prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); + prefixes["Webkit".concat(styleProp)] = "webkit".concat(eventName); + prefixes["Moz".concat(styleProp)] = "moz".concat(eventName); + prefixes["ms".concat(styleProp)] = "MS".concat(eventName); + prefixes["O".concat(styleProp)] = "o".concat(eventName.toLowerCase()); + return prefixes; +} +function getVendorPrefixes(domSupport, win) { + var prefixes = { + animationend: makePrefixMap('Animation', 'AnimationEnd'), + transitionend: makePrefixMap('Transition', 'TransitionEnd') + }; + if (domSupport) { + if (!('AnimationEvent' in win)) delete prefixes.animationend.animation; + if (!('TransitionEvent' in win)) delete prefixes.transitionend.transition; + } + return prefixes; +} +var vendorPrefixes = getVendorPrefixes(canUseDom_canUseDom(), 'undefined' != typeof window ? window : {}); +var motion_style = {}; +if (canUseDom_canUseDom()) { + var _document$createEleme = document.createElement('div'); + motion_style = _document$createEleme.style; +} +var prefixedEventNames = {}; +function getVendorPrefixedEventName(eventName) { + if (prefixedEventNames[eventName]) return prefixedEventNames[eventName]; + var prefixMap = vendorPrefixes[eventName]; + if (prefixMap) { + var stylePropList = Object.keys(prefixMap); + var len = stylePropList.length; + for(var i = 0; i < len; i += 1){ + var styleProp = stylePropList[i]; + if (Object.prototype.hasOwnProperty.call(prefixMap, styleProp) && styleProp in motion_style) { + prefixedEventNames[eventName] = prefixMap[styleProp]; + return prefixedEventNames[eventName]; + } + } + } + return ''; +} +var internalAnimationEndName = getVendorPrefixedEventName('animationend'); +var internalTransitionEndName = getVendorPrefixedEventName('transitionend'); +var supportTransition = !!(internalAnimationEndName && internalTransitionEndName); +var animationEndName = internalAnimationEndName || 'animationend'; +var transitionEndName = internalTransitionEndName || 'transitionend'; +function motion_getTransitionName(transitionName, transitionType) { + if (!transitionName) return null; + if ('object' === typeof_typeof(transitionName)) { + var type = transitionType.replace(/-\w/g, function(match) { + return match[1].toUpperCase(); + }); + return transitionName[type]; + } + return "".concat(transitionName, "-").concat(transitionType); +} +const useDomMotionEvents = function(onInternalMotionEnd) { + var cacheElementRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(); + function removeMotionEvents(element) { + if (element) { + element.removeEventListener(transitionEndName, onInternalMotionEnd); + element.removeEventListener(animationEndName, onInternalMotionEnd); + } + } + function patchMotionEvents(element) { + if (cacheElementRef.current && cacheElementRef.current !== element) removeMotionEvents(cacheElementRef.current); + if (element && element !== cacheElementRef.current) { + element.addEventListener(transitionEndName, onInternalMotionEnd); + element.addEventListener(animationEndName, onInternalMotionEnd); + cacheElementRef.current = element; + } + } + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(function() { + return function() { + removeMotionEvents(cacheElementRef.current); + }; + }, []); + return [ + patchMotionEvents, + removeMotionEvents + ]; +}; +var useIsomorphicLayoutEffect = canUseDom_canUseDom() ? __WEBPACK_EXTERNAL_MODULE_react__.useLayoutEffect : __WEBPACK_EXTERNAL_MODULE_react__.useEffect; +const hooks_useIsomorphicLayoutEffect = useIsomorphicLayoutEffect; +var raf_raf = function(callback) { + return +setTimeout(callback, 16); +}; +var raf_caf = function(num) { + return clearTimeout(num); +}; +if ('undefined' != typeof window && 'requestAnimationFrame' in window) { + raf_raf = function(callback) { + return window.requestAnimationFrame(callback); + }; + raf_caf = function(handle) { + return window.cancelAnimationFrame(handle); + }; +} +var rafUUID = 0; +var rafIds = new Map(); +function raf_cleanup(id) { + rafIds.delete(id); +} +var raf_wrapperRaf = function(callback) { + var times = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1; + rafUUID += 1; + var id = rafUUID; + function callRef(leftTimes) { + if (0 === leftTimes) { + raf_cleanup(id); + callback(); + } else { + var realId = raf_raf(function() { + callRef(leftTimes - 1); + }); + rafIds.set(id, realId); + } + } + callRef(times); + return id; +}; +raf_wrapperRaf.cancel = function(id) { + var realId = rafIds.get(id); + raf_cleanup(id); + return raf_caf(realId); +}; +if ('production' !== process.env.NODE_ENV) raf_wrapperRaf.ids = function() { + return rafIds; +}; +const es_raf = raf_wrapperRaf; +const useNextFrame = function() { + var nextFrameRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(null); + function cancelNextFrame() { + es_raf.cancel(nextFrameRef.current); + } + function nextFrame(callback) { + var delay = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2; + cancelNextFrame(); + var nextFrameId = es_raf(function() { + if (delay <= 1) callback({ + isCanceled: function() { + return nextFrameId !== nextFrameRef.current; + } + }); + else nextFrame(callback, delay - 1); + }); + nextFrameRef.current = nextFrameId; + } + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(function() { + return function() { + cancelNextFrame(); + }; + }, []); + return [ + nextFrame, + cancelNextFrame + ]; +}; +var FULL_STEP_QUEUE = [ + STEP_PREPARE, + STEP_START, + STEP_ACTIVE, + STEP_ACTIVATED +]; +var SIMPLE_STEP_QUEUE = [ + STEP_PREPARE, + STEP_PREPARED +]; +var SkipStep = false; +var DoStep = true; +function isActive(step) { + return step === STEP_ACTIVE || step === STEP_ACTIVATED; +} +const useStepQueue = function(status, prepareOnly, callback) { + var _useState = useSafeState(STEP_NONE), _useState2 = slicedToArray_slicedToArray(_useState, 2), step = _useState2[0], setStep = _useState2[1]; + var _useNextFrame = useNextFrame(), _useNextFrame2 = slicedToArray_slicedToArray(_useNextFrame, 2), nextFrame = _useNextFrame2[0], cancelNextFrame = _useNextFrame2[1]; + function startQueue() { + setStep(STEP_PREPARE, true); + } + var STEP_QUEUE = prepareOnly ? SIMPLE_STEP_QUEUE : FULL_STEP_QUEUE; + hooks_useIsomorphicLayoutEffect(function() { + if (step !== STEP_NONE && step !== STEP_ACTIVATED) { + var index = STEP_QUEUE.indexOf(step); + var nextStep = STEP_QUEUE[index + 1]; + var result = callback(step); + if (result === SkipStep) setStep(nextStep, true); + else if (nextStep) nextFrame(function(info) { + function doNext() { + if (info.isCanceled()) return; + setStep(nextStep, true); + } + if (true === result) doNext(); + else Promise.resolve(result).then(doNext); + }); + } + }, [ + status, + step + ]); + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(function() { + return function() { + cancelNextFrame(); + }; + }, []); + return [ + startQueue, + step + ]; +}; +function useStatus(supportMotion, visible, getElement, _ref) { + var _ref$motionEnter = _ref.motionEnter, motionEnter = void 0 === _ref$motionEnter ? true : _ref$motionEnter, _ref$motionAppear = _ref.motionAppear, motionAppear = void 0 === _ref$motionAppear ? true : _ref$motionAppear, _ref$motionLeave = _ref.motionLeave, motionLeave = void 0 === _ref$motionLeave ? true : _ref$motionLeave, motionDeadline = _ref.motionDeadline, motionLeaveImmediately = _ref.motionLeaveImmediately, onAppearPrepare = _ref.onAppearPrepare, onEnterPrepare = _ref.onEnterPrepare, onLeavePrepare = _ref.onLeavePrepare, onAppearStart = _ref.onAppearStart, onEnterStart = _ref.onEnterStart, onLeaveStart = _ref.onLeaveStart, onAppearActive = _ref.onAppearActive, onEnterActive = _ref.onEnterActive, onLeaveActive = _ref.onLeaveActive, onAppearEnd = _ref.onAppearEnd, onEnterEnd = _ref.onEnterEnd, onLeaveEnd = _ref.onLeaveEnd, onVisibleChanged = _ref.onVisibleChanged; + var _useState = useSafeState(), _useState2 = slicedToArray_slicedToArray(_useState, 2), asyncVisible = _useState2[0], setAsyncVisible = _useState2[1]; + var _useSyncState = useSyncState(STATUS_NONE), _useSyncState2 = slicedToArray_slicedToArray(_useSyncState, 2), getStatus = _useSyncState2[0], setStatus = _useSyncState2[1]; + var _useState3 = useSafeState(null), _useState4 = slicedToArray_slicedToArray(_useState3, 2), style = _useState4[0], setStyle = _useState4[1]; + var currentStatus = getStatus(); + var mountedRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(false); + var deadlineRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null); + function getDomElement() { + return getElement(); + } + var activeRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(false); + function updateMotionEndStatus() { + setStatus(STATUS_NONE); + setStyle(null, true); + } + var onInternalMotionEnd = useEvent(function(event) { + var status = getStatus(); + if (status === STATUS_NONE) return; + var element = getDomElement(); + if (event && !event.deadline && event.target !== element) return; + var currentActive = activeRef.current; + var canEnd; + if (status === STATUS_APPEAR && currentActive) canEnd = null == onAppearEnd ? void 0 : onAppearEnd(element, event); + else if (status === STATUS_ENTER && currentActive) canEnd = null == onEnterEnd ? void 0 : onEnterEnd(element, event); + else if (status === STATUS_LEAVE && currentActive) canEnd = null == onLeaveEnd ? void 0 : onLeaveEnd(element, event); + if (currentActive && false !== canEnd) updateMotionEndStatus(); + }); + var _useDomMotionEvents = useDomMotionEvents(onInternalMotionEnd), _useDomMotionEvents2 = slicedToArray_slicedToArray(_useDomMotionEvents, 1), patchMotionEvents = _useDomMotionEvents2[0]; + var getEventHandlers = function(targetStatus) { + switch(targetStatus){ + case STATUS_APPEAR: + return defineProperty_defineProperty(defineProperty_defineProperty(defineProperty_defineProperty({}, STEP_PREPARE, onAppearPrepare), STEP_START, onAppearStart), STEP_ACTIVE, onAppearActive); + case STATUS_ENTER: + return defineProperty_defineProperty(defineProperty_defineProperty(defineProperty_defineProperty({}, STEP_PREPARE, onEnterPrepare), STEP_START, onEnterStart), STEP_ACTIVE, onEnterActive); + case STATUS_LEAVE: + return defineProperty_defineProperty(defineProperty_defineProperty(defineProperty_defineProperty({}, STEP_PREPARE, onLeavePrepare), STEP_START, onLeaveStart), STEP_ACTIVE, onLeaveActive); + default: + return {}; + } + }; + var eventHandlers = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(function() { + return getEventHandlers(currentStatus); + }, [ + currentStatus + ]); + var _useStepQueue = useStepQueue(currentStatus, !supportMotion, function(newStep) { + if (newStep === STEP_PREPARE) { + var onPrepare = eventHandlers[STEP_PREPARE]; + if (!onPrepare) return SkipStep; + return onPrepare(getDomElement()); + } + if (step in eventHandlers) { + var _eventHandlers$step; + setStyle((null == (_eventHandlers$step = eventHandlers[step]) ? void 0 : _eventHandlers$step.call(eventHandlers, getDomElement(), null)) || null); + } + if (step === STEP_ACTIVE && currentStatus !== STATUS_NONE) { + patchMotionEvents(getDomElement()); + if (motionDeadline > 0) { + clearTimeout(deadlineRef.current); + deadlineRef.current = setTimeout(function() { + onInternalMotionEnd({ + deadline: true + }); + }, motionDeadline); + } + } + if (step === STEP_PREPARED) updateMotionEndStatus(); + return DoStep; + }), _useStepQueue2 = slicedToArray_slicedToArray(_useStepQueue, 2), startStep = _useStepQueue2[0], step = _useStepQueue2[1]; + var active = isActive(step); + activeRef.current = active; + var visibleRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null); + hooks_useIsomorphicLayoutEffect(function() { + if (mountedRef.current && visibleRef.current === visible) return; + setAsyncVisible(visible); + var isMounted = mountedRef.current; + mountedRef.current = true; + var nextStatus; + if (!isMounted && visible && motionAppear) nextStatus = STATUS_APPEAR; + if (isMounted && visible && motionEnter) nextStatus = STATUS_ENTER; + if (isMounted && !visible && motionLeave || !isMounted && motionLeaveImmediately && !visible && motionLeave) nextStatus = STATUS_LEAVE; + var nextEventHandlers = getEventHandlers(nextStatus); + if (nextStatus && (supportMotion || nextEventHandlers[STEP_PREPARE])) { + setStatus(nextStatus); + startStep(); + } else setStatus(STATUS_NONE); + visibleRef.current = visible; + }, [ + visible + ]); + (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(function() { + if (currentStatus === STATUS_APPEAR && !motionAppear || currentStatus === STATUS_ENTER && !motionEnter || currentStatus === STATUS_LEAVE && !motionLeave) setStatus(STATUS_NONE); + }, [ + motionAppear, + motionEnter, + motionLeave + ]); + (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(function() { + return function() { + mountedRef.current = false; + clearTimeout(deadlineRef.current); + }; + }, []); + var firstMountChangeRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(false); + (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(function() { + if (asyncVisible) firstMountChangeRef.current = true; + if (void 0 !== asyncVisible && currentStatus === STATUS_NONE) { + if (firstMountChangeRef.current || asyncVisible) null == onVisibleChanged || onVisibleChanged(asyncVisible); + firstMountChangeRef.current = true; + } + }, [ + asyncVisible, + currentStatus + ]); + var mergedStyle = style; + if (eventHandlers[STEP_PREPARE] && step === STEP_START) mergedStyle = objectSpread2_objectSpread2({ + transition: 'none' + }, mergedStyle); + return [ + currentStatus, + step, + mergedStyle, + null != asyncVisible ? asyncVisible : visible + ]; +} +function genCSSMotion(config) { + var transitionSupport = config; + if ('object' === typeof_typeof(config)) transitionSupport = config.transitionSupport; + function isSupportTransition(props, contextMotion) { + return !!(props.motionName && transitionSupport && false !== contextMotion); + } + var CSSMotion = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef(function(props, ref) { + var _props$visible = props.visible, visible = void 0 === _props$visible ? true : _props$visible, _props$removeOnLeave = props.removeOnLeave, removeOnLeave = void 0 === _props$removeOnLeave ? true : _props$removeOnLeave, forceRender = props.forceRender, children = props.children, motionName = props.motionName, leavedClassName = props.leavedClassName, eventProps = props.eventProps; + var _React$useContext = __WEBPACK_EXTERNAL_MODULE_react__.useContext(context_Context), contextMotion = _React$useContext.motion; + var supportMotion = isSupportTransition(props, contextMotion); + var nodeRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(); + var wrapperNodeRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(); + function getDomElement() { + try { + return nodeRef.current instanceof HTMLElement ? nodeRef.current : findDOMNode(wrapperNodeRef.current); + } catch (e) { + return null; + } + } + var _useStatus = useStatus(supportMotion, visible, getDomElement, props), _useStatus2 = slicedToArray_slicedToArray(_useStatus, 4), status = _useStatus2[0], statusStep = _useStatus2[1], statusStyle = _useStatus2[2], mergedVisible = _useStatus2[3]; + var renderedRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(mergedVisible); + if (mergedVisible) renderedRef.current = true; + var setNodeRef = __WEBPACK_EXTERNAL_MODULE_react__.useCallback(function(node) { + nodeRef.current = node; + ref_fillRef(ref, node); + }, [ + ref + ]); + var motionChildren; + var mergedProps = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, eventProps), {}, { + visible: visible + }); + if (children) if (status === STATUS_NONE) motionChildren = mergedVisible ? children(objectSpread2_objectSpread2({}, mergedProps), setNodeRef) : !removeOnLeave && renderedRef.current && leavedClassName ? children(objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, mergedProps), {}, { + className: leavedClassName + }), setNodeRef) : !forceRender && (removeOnLeave || leavedClassName) ? null : children(objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, mergedProps), {}, { + style: { + display: 'none' + } + }), setNodeRef); + else { + var statusSuffix; + if (statusStep === STEP_PREPARE) statusSuffix = 'prepare'; + else if (isActive(statusStep)) statusSuffix = 'active'; + else if (statusStep === STEP_START) statusSuffix = 'start'; + var motionCls = motion_getTransitionName(motionName, "".concat(status, "-").concat(statusSuffix)); + motionChildren = children(objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, mergedProps), {}, { + className: classnames_default()(motion_getTransitionName(motionName, status), defineProperty_defineProperty(defineProperty_defineProperty({}, motionCls, motionCls && statusSuffix), motionName, 'string' == typeof motionName)), + style: statusStyle + }), setNodeRef); + } + else motionChildren = null; + if (/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.isValidElement(motionChildren) && ref_supportRef(motionChildren)) { + var originNodeRef = ref_getNodeRef(motionChildren); + if (!originNodeRef) motionChildren = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.cloneElement(motionChildren, { + ref: setNodeRef + }); + } + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(es_DomWrapper, { + ref: wrapperNodeRef + }, motionChildren); + }); + CSSMotion.displayName = 'CSSMotion'; + return CSSMotion; +} +const es_CSSMotion = genCSSMotion(supportTransition); +var STATUS_ADD = 'add'; +var STATUS_KEEP = 'keep'; +var STATUS_REMOVE = 'remove'; +var STATUS_REMOVED = 'removed'; +function wrapKeyToObject(key) { + var keyObj; + keyObj = key && 'object' === typeof_typeof(key) && 'key' in key ? key : { + key: key + }; + return objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, keyObj), {}, { + key: String(keyObj.key) + }); +} +function parseKeys() { + var keys = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + return keys.map(wrapKeyToObject); +} +function diffKeys() { + var prevKeys = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + var currentKeys = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : []; + var list = []; + var currentIndex = 0; + var currentLen = currentKeys.length; + var prevKeyObjects = parseKeys(prevKeys); + var currentKeyObjects = parseKeys(currentKeys); + prevKeyObjects.forEach(function(keyObj) { + var hit = false; + for(var i = currentIndex; i < currentLen; i += 1){ + var currentKeyObj = currentKeyObjects[i]; + if (currentKeyObj.key === keyObj.key) { + if (currentIndex < i) { + list = list.concat(currentKeyObjects.slice(currentIndex, i).map(function(obj) { + return objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, obj), {}, { + status: STATUS_ADD + }); + })); + currentIndex = i; + } + list.push(objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, currentKeyObj), {}, { + status: STATUS_KEEP + })); + currentIndex += 1; + hit = true; + break; + } + } + if (!hit) list.push(objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, keyObj), {}, { + status: STATUS_REMOVE + })); + }); + if (currentIndex < currentLen) list = list.concat(currentKeyObjects.slice(currentIndex).map(function(obj) { + return objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, obj), {}, { + status: STATUS_ADD + }); + })); + var keys = {}; + list.forEach(function(_ref) { + var key = _ref.key; + keys[key] = (keys[key] || 0) + 1; + }); + var duplicatedKeys = Object.keys(keys).filter(function(key) { + return keys[key] > 1; + }); + duplicatedKeys.forEach(function(matchKey) { + list = list.filter(function(_ref2) { + var key = _ref2.key, status = _ref2.status; + return key !== matchKey || status !== STATUS_REMOVE; + }); + list.forEach(function(node) { + if (node.key === matchKey) node.status = STATUS_KEEP; + }); + }); + return list; +} +var CSSMotionList_excluded = [ + "component", + "children", + "onVisibleChanged", + "onAllRemoved" +], _excluded2 = [ + "status" +]; +var MOTION_PROP_NAMES = [ + 'eventProps', + 'visible', + 'children', + 'motionName', + 'motionAppear', + 'motionEnter', + 'motionLeave', + 'motionLeaveImmediately', + 'motionDeadline', + 'removeOnLeave', + 'leavedClassName', + 'onAppearPrepare', + 'onAppearStart', + 'onAppearActive', + 'onAppearEnd', + 'onEnterStart', + 'onEnterActive', + 'onEnterEnd', + 'onLeaveStart', + 'onLeaveActive', + 'onLeaveEnd' +]; +function genCSSMotionList(transitionSupport) { + var CSSMotion = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : es_CSSMotion; + var CSSMotionList = /*#__PURE__*/ function(_React$Component) { + inherits_inherits(CSSMotionList, _React$Component); + var _super = createSuper_createSuper(CSSMotionList); + function CSSMotionList() { + var _this; + classCallCheck_classCallCheck(this, CSSMotionList); + for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + _this = _super.call.apply(_super, [ + this + ].concat(args)); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "state", { + keyEntities: [] + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "removeKey", function(removeKey) { + _this.setState(function(prevState) { + var nextKeyEntities = prevState.keyEntities.map(function(entity) { + if (entity.key !== removeKey) return entity; + return objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, entity), {}, { + status: STATUS_REMOVED + }); + }); + return { + keyEntities: nextKeyEntities + }; + }, function() { + var keyEntities = _this.state.keyEntities; + var restKeysCount = keyEntities.filter(function(_ref) { + var status = _ref.status; + return status !== STATUS_REMOVED; + }).length; + if (0 === restKeysCount && _this.props.onAllRemoved) _this.props.onAllRemoved(); + }); + }); + return _this; + } + createClass_createClass(CSSMotionList, [ + { + key: "render", + value: function() { + var _this2 = this; + var keyEntities = this.state.keyEntities; + var _this$props = this.props, component = _this$props.component, children = _this$props.children, _onVisibleChanged = _this$props.onVisibleChanged, restProps = (_this$props.onAllRemoved, objectWithoutProperties_objectWithoutProperties(_this$props, CSSMotionList_excluded)); + var Component = component || __WEBPACK_EXTERNAL_MODULE_react__.Fragment; + var motionProps = {}; + MOTION_PROP_NAMES.forEach(function(prop) { + motionProps[prop] = restProps[prop]; + delete restProps[prop]; + }); + delete restProps.keys; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(Component, restProps, keyEntities.map(function(_ref2, index) { + var status = _ref2.status, eventProps = objectWithoutProperties_objectWithoutProperties(_ref2, _excluded2); + var visible = status === STATUS_ADD || status === STATUS_KEEP; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(CSSMotion, _extends({}, motionProps, { + key: eventProps.key, + visible: visible, + eventProps: eventProps, + onVisibleChanged: function(changedVisible) { + null == _onVisibleChanged || _onVisibleChanged(changedVisible, { + key: eventProps.key + }); + if (!changedVisible) _this2.removeKey(eventProps.key); + } + }), function(props, ref) { + return children(objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, props), {}, { + index: index + }), ref); + }); + })); + } + } + ], [ + { + key: "getDerivedStateFromProps", + value: function(_ref3, _ref4) { + var keys = _ref3.keys; + var keyEntities = _ref4.keyEntities; + var parsedKeyObjects = parseKeys(keys); + var mixedKeyEntities = diffKeys(keyEntities, parsedKeyObjects); + return { + keyEntities: mixedKeyEntities.filter(function(entity) { + var prevEntity = keyEntities.find(function(_ref5) { + var key = _ref5.key; + return entity.key === key; + }); + if (prevEntity && prevEntity.status === STATUS_REMOVED && entity.status === STATUS_REMOVE) return false; + return true; + }) + }; + } + } + ]); + return CSSMotionList; + }(__WEBPACK_EXTERNAL_MODULE_react__.Component); + defineProperty_defineProperty(CSSMotionList, "defaultProps", { + component: 'div' + }); + return CSSMotionList; +} +genCSSMotionList(supportTransition); +const rc_motion_es = es_CSSMotion; +function Arrow(props) { + var prefixCls = props.prefixCls, align = props.align, arrow = props.arrow, arrowPos = props.arrowPos; + var _ref = arrow || {}, className = _ref.className, content = _ref.content; + var _arrowPos$x = arrowPos.x, x = void 0 === _arrowPos$x ? 0 : _arrowPos$x, _arrowPos$y = arrowPos.y, y = void 0 === _arrowPos$y ? 0 : _arrowPos$y; + var arrowRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(); + if (!align || !align.points) return null; + var alignStyle = { + position: 'absolute' + }; + if (false !== align.autoArrow) { + var popupPoints = align.points[0]; + var targetPoints = align.points[1]; + var popupTB = popupPoints[0]; + var popupLR = popupPoints[1]; + var targetTB = targetPoints[0]; + var targetLR = targetPoints[1]; + if (popupTB !== targetTB && [ + 't', + 'b' + ].includes(popupTB)) if ('t' === popupTB) alignStyle.top = 0; + else alignStyle.bottom = 0; + else alignStyle.top = y; + if (popupLR !== targetLR && [ + 'l', + 'r' + ].includes(popupLR)) if ('l' === popupLR) alignStyle.left = 0; + else alignStyle.right = 0; + else alignStyle.left = x; + } + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("div", { + ref: arrowRef, + className: classnames_default()("".concat(prefixCls, "-arrow"), className), + style: alignStyle + }, content); +} +function Mask(props) { + var prefixCls = props.prefixCls, open = props.open, zIndex = props.zIndex, mask = props.mask, motion = props.motion; + if (!mask) return null; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(rc_motion_es, _extends({}, motion, { + motionAppear: true, + visible: open, + removeOnLeave: true + }), function(_ref) { + var className = _ref.className; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("div", { + style: { + zIndex: zIndex + }, + className: classnames_default()("".concat(prefixCls, "-mask"), className) + }); + }); +} +var PopupContent = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.memo(function(_ref) { + var children = _ref.children; + return children; +}, function(_, next) { + return next.cache; +}); +if ('production' !== process.env.NODE_ENV) PopupContent.displayName = 'PopupContent'; +const Popup_PopupContent = PopupContent; +var Popup_Popup = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef(function(props, ref) { + var popup = props.popup, className = props.className, prefixCls = props.prefixCls, style = props.style, target = props.target, _onVisibleChanged = props.onVisibleChanged, open = props.open, keepDom = props.keepDom, fresh = props.fresh, onClick = props.onClick, mask = props.mask, arrow = props.arrow, arrowPos = props.arrowPos, align = props.align, motion = props.motion, maskMotion = props.maskMotion, forceRender = props.forceRender, getPopupContainer = props.getPopupContainer, autoDestroy = props.autoDestroy, Portal = props.portal, zIndex = props.zIndex, onMouseEnter = props.onMouseEnter, onMouseLeave = props.onMouseLeave, onPointerEnter = props.onPointerEnter, onPointerDownCapture = props.onPointerDownCapture, ready = props.ready, offsetX = props.offsetX, offsetY = props.offsetY, offsetR = props.offsetR, offsetB = props.offsetB, onAlign = props.onAlign, onPrepare = props.onPrepare, stretch = props.stretch, targetWidth = props.targetWidth, targetHeight = props.targetHeight; + var childNode = 'function' == typeof popup ? popup() : popup; + var isNodeVisible = open || keepDom; + var getPopupContainerNeedParams = (null == getPopupContainer ? void 0 : getPopupContainer.length) > 0; + var _React$useState = __WEBPACK_EXTERNAL_MODULE_react__.useState(!getPopupContainer || !getPopupContainerNeedParams), _React$useState2 = slicedToArray_slicedToArray(_React$useState, 2), show = _React$useState2[0], setShow = _React$useState2[1]; + hooks_useLayoutEffect(function() { + if (!show && getPopupContainerNeedParams && target) setShow(true); + }, [ + show, + getPopupContainerNeedParams, + target + ]); + if (!show) return null; + var AUTO = 'auto'; + var offsetStyle = { + left: '-1000vw', + top: '-1000vh', + right: AUTO, + bottom: AUTO + }; + if (ready || !open) { + var _experimental; + var points = align.points; + var dynamicInset = align.dynamicInset || (null == (_experimental = align._experimental) ? void 0 : _experimental.dynamicInset); + var alignRight = dynamicInset && 'r' === points[0][1]; + var alignBottom = dynamicInset && 'b' === points[0][0]; + if (alignRight) { + offsetStyle.right = offsetR; + offsetStyle.left = AUTO; + } else { + offsetStyle.left = offsetX; + offsetStyle.right = AUTO; + } + if (alignBottom) { + offsetStyle.bottom = offsetB; + offsetStyle.top = AUTO; + } else { + offsetStyle.top = offsetY; + offsetStyle.bottom = AUTO; + } + } + var miscStyle = {}; + if (stretch) { + if (stretch.includes('height') && targetHeight) miscStyle.height = targetHeight; + else if (stretch.includes('minHeight') && targetHeight) miscStyle.minHeight = targetHeight; + if (stretch.includes('width') && targetWidth) miscStyle.width = targetWidth; + else if (stretch.includes('minWidth') && targetWidth) miscStyle.minWidth = targetWidth; + } + if (!open) miscStyle.pointerEvents = 'none'; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(Portal, { + open: forceRender || isNodeVisible, + getContainer: getPopupContainer && function() { + return getPopupContainer(target); + }, + autoDestroy: autoDestroy + }, /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(Mask, { + prefixCls: prefixCls, + open: open, + zIndex: zIndex, + mask: mask, + motion: maskMotion + }), /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(rc_resize_observer_es, { + onResize: onAlign, + disabled: !open + }, function(resizeObserverRef) { + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(rc_motion_es, _extends({ + motionAppear: true, + motionEnter: true, + motionLeave: true, + removeOnLeave: false, + forceRender: forceRender, + leavedClassName: "".concat(prefixCls, "-hidden") + }, motion, { + onAppearPrepare: onPrepare, + onEnterPrepare: onPrepare, + visible: open, + onVisibleChanged: function(nextVisible) { + var _motion$onVisibleChan; + null == motion || null == (_motion$onVisibleChan = motion.onVisibleChanged) || _motion$onVisibleChan.call(motion, nextVisible); + _onVisibleChanged(nextVisible); + } + }), function(_ref, motionRef) { + var motionClassName = _ref.className, motionStyle = _ref.style; + var cls = classnames_default()(prefixCls, motionClassName, className); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("div", { + ref: ref_composeRef(resizeObserverRef, ref, motionRef), + className: cls, + style: objectSpread2_objectSpread2(objectSpread2_objectSpread2(objectSpread2_objectSpread2(objectSpread2_objectSpread2({ + '--arrow-x': "".concat(arrowPos.x || 0, "px"), + '--arrow-y': "".concat(arrowPos.y || 0, "px") + }, offsetStyle), miscStyle), motionStyle), {}, { + boxSizing: 'border-box', + zIndex: zIndex + }, style), + onMouseEnter: onMouseEnter, + onMouseLeave: onMouseLeave, + onPointerEnter: onPointerEnter, + onClick: onClick, + onPointerDownCapture: onPointerDownCapture + }, arrow && /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(Arrow, { + prefixCls: prefixCls, + arrow: arrow, + arrowPos: arrowPos, + align: align + }), /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(Popup_PopupContent, { + cache: !open && !fresh + }, childNode)); + }); + })); +}); +if ('production' !== process.env.NODE_ENV) Popup_Popup.displayName = 'Popup'; +const es_Popup = Popup_Popup; +var TriggerWrapper = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef(function(props, ref) { + var children = props.children, getTriggerDOMNode = props.getTriggerDOMNode; + var canUseRef = ref_supportRef(children); + var setRef = __WEBPACK_EXTERNAL_MODULE_react__.useCallback(function(node) { + ref_fillRef(ref, getTriggerDOMNode ? getTriggerDOMNode(node) : node); + }, [ + getTriggerDOMNode + ]); + var mergedRef = ref_useComposeRef(setRef, ref_getNodeRef(children)); + return canUseRef ? /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.cloneElement(children, { + ref: mergedRef + }) : children; +}); +if ('production' !== process.env.NODE_ENV) TriggerWrapper.displayName = 'TriggerWrapper'; +const es_TriggerWrapper = TriggerWrapper; +var TriggerContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext(null); +const es_context = TriggerContext; +function useAction_toArray(val) { + return val ? Array.isArray(val) ? val : [ + val + ] : []; +} +function useAction(mobile, action, showAction, hideAction) { + return __WEBPACK_EXTERNAL_MODULE_react__.useMemo(function() { + var mergedShowAction = useAction_toArray(null != showAction ? showAction : action); + var mergedHideAction = useAction_toArray(null != hideAction ? hideAction : action); + var showActionSet = new Set(mergedShowAction); + var hideActionSet = new Set(mergedHideAction); + if (mobile) { + if (showActionSet.has('hover')) { + showActionSet.delete('hover'); + showActionSet.add('click'); + } + if (hideActionSet.has('hover')) { + hideActionSet.delete('hover'); + hideActionSet.add('click'); + } + } + return [ + showActionSet, + hideActionSet + ]; + }, [ + mobile, + action, + showAction, + hideAction + ]); +} +const isVisible = function(element) { + if (!element) return false; + if (element instanceof Element) { + if (element.offsetParent) return true; + if (element.getBBox) { + var _getBBox = element.getBBox(), width = _getBBox.width, height = _getBBox.height; + if (width || height) return true; + } + if (element.getBoundingClientRect) { + var _element$getBoundingC = element.getBoundingClientRect(), _width = _element$getBoundingC.width, _height = _element$getBoundingC.height; + if (_width || _height) return true; + } + } + return false; +}; +function isPointsEq() { + var a1 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + var a2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : []; + var isAlignPoint = arguments.length > 2 ? arguments[2] : void 0; + if (isAlignPoint) return a1[0] === a2[0]; + return a1[0] === a2[0] && a1[1] === a2[1]; +} +function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) { + var points = align.points; + var placements = Object.keys(builtinPlacements); + for(var i = 0; i < placements.length; i += 1){ + var _builtinPlacements$pl; + var placement = placements[i]; + if (isPointsEq(null == (_builtinPlacements$pl = builtinPlacements[placement]) ? void 0 : _builtinPlacements$pl.points, points, isAlignPoint)) return "".concat(prefixCls, "-placement-").concat(placement); + } + return ''; +} +function getMotion(prefixCls, motion, animation, transitionName) { + if (motion) return motion; + if (animation) return { + motionName: "".concat(prefixCls, "-").concat(animation) + }; + if (transitionName) return { + motionName: transitionName + }; + return null; +} +function getWin(ele) { + return ele.ownerDocument.defaultView; +} +function collectScroller(ele) { + var scrollerList = []; + var current = null == ele ? void 0 : ele.parentElement; + var scrollStyle = [ + 'hidden', + 'scroll', + 'clip', + 'auto' + ]; + while(current){ + var _getWin$getComputedSt = getWin(current).getComputedStyle(current), overflowX = _getWin$getComputedSt.overflowX, overflowY = _getWin$getComputedSt.overflowY, overflow = _getWin$getComputedSt.overflow; + if ([ + overflowX, + overflowY, + overflow + ].some(function(o) { + return scrollStyle.includes(o); + })) scrollerList.push(current); + current = current.parentElement; + } + return scrollerList; +} +function toNum(num) { + var defaultValue = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1; + return Number.isNaN(num) ? defaultValue : num; +} +function getPxValue(val) { + return toNum(parseFloat(val), 0); +} +function getVisibleArea(initArea, scrollerList) { + var visibleArea = objectSpread2_objectSpread2({}, initArea); + (scrollerList || []).forEach(function(ele) { + if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) return; + var _getWin$getComputedSt2 = getWin(ele).getComputedStyle(ele), overflow = _getWin$getComputedSt2.overflow, overflowClipMargin = _getWin$getComputedSt2.overflowClipMargin, borderTopWidth = _getWin$getComputedSt2.borderTopWidth, borderBottomWidth = _getWin$getComputedSt2.borderBottomWidth, borderLeftWidth = _getWin$getComputedSt2.borderLeftWidth, borderRightWidth = _getWin$getComputedSt2.borderRightWidth; + var eleRect = ele.getBoundingClientRect(); + var eleOutHeight = ele.offsetHeight, eleInnerHeight = ele.clientHeight, eleOutWidth = ele.offsetWidth, eleInnerWidth = ele.clientWidth; + var borderTopNum = getPxValue(borderTopWidth); + var borderBottomNum = getPxValue(borderBottomWidth); + var borderLeftNum = getPxValue(borderLeftWidth); + var borderRightNum = getPxValue(borderRightWidth); + var scaleX = toNum(Math.round(eleRect.width / eleOutWidth * 1000) / 1000); + var scaleY = toNum(Math.round(eleRect.height / eleOutHeight * 1000) / 1000); + var eleScrollWidth = (eleOutWidth - eleInnerWidth - borderLeftNum - borderRightNum) * scaleX; + var eleScrollHeight = (eleOutHeight - eleInnerHeight - borderTopNum - borderBottomNum) * scaleY; + var scaledBorderTopWidth = borderTopNum * scaleY; + var scaledBorderBottomWidth = borderBottomNum * scaleY; + var scaledBorderLeftWidth = borderLeftNum * scaleX; + var scaledBorderRightWidth = borderRightNum * scaleX; + var clipMarginWidth = 0; + var clipMarginHeight = 0; + if ('clip' === overflow) { + var clipNum = getPxValue(overflowClipMargin); + clipMarginWidth = clipNum * scaleX; + clipMarginHeight = clipNum * scaleY; + } + var eleLeft = eleRect.x + scaledBorderLeftWidth - clipMarginWidth; + var eleTop = eleRect.y + scaledBorderTopWidth - clipMarginHeight; + var eleRight = eleLeft + eleRect.width + 2 * clipMarginWidth - scaledBorderLeftWidth - scaledBorderRightWidth - eleScrollWidth; + var eleBottom = eleTop + eleRect.height + 2 * clipMarginHeight - scaledBorderTopWidth - scaledBorderBottomWidth - eleScrollHeight; + visibleArea.left = Math.max(visibleArea.left, eleLeft); + visibleArea.top = Math.max(visibleArea.top, eleTop); + visibleArea.right = Math.min(visibleArea.right, eleRight); + visibleArea.bottom = Math.min(visibleArea.bottom, eleBottom); + }); + return visibleArea; +} +function getUnitOffset(size) { + var offset = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0; + var offsetStr = "".concat(offset); + var cells = offsetStr.match(/^(.*)\%$/); + if (cells) return size * (parseFloat(cells[1]) / 100); + return parseFloat(offsetStr); +} +function getNumberOffset(rect, offset) { + var _ref = offset || [], _ref2 = slicedToArray_slicedToArray(_ref, 2), offsetX = _ref2[0], offsetY = _ref2[1]; + return [ + getUnitOffset(rect.width, offsetX), + getUnitOffset(rect.height, offsetY) + ]; +} +function splitPoints() { + var points = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : ''; + return [ + points[0], + points[1] + ]; +} +function getAlignPoint(rect, points) { + var topBottom = points[0]; + var leftRight = points[1]; + var x; + var y; + y = 't' === topBottom ? rect.y : 'b' === topBottom ? rect.y + rect.height : rect.y + rect.height / 2; + x = 'l' === leftRight ? rect.x : 'r' === leftRight ? rect.x + rect.width : rect.x + rect.width / 2; + return { + x: x, + y: y + }; +} +function reversePoints(points, index) { + var reverseMap = { + t: 'b', + b: 't', + l: 'r', + r: 'l' + }; + return points.map(function(point, i) { + if (i === index) return reverseMap[point] || 'c'; + return point; + }).join(''); +} +function useAlign(open, popupEle, target, placement, builtinPlacements, popupAlign, onPopupAlign) { + var _React$useState = __WEBPACK_EXTERNAL_MODULE_react__.useState({ + ready: false, + offsetX: 0, + offsetY: 0, + offsetR: 0, + offsetB: 0, + arrowX: 0, + arrowY: 0, + scaleX: 1, + scaleY: 1, + align: builtinPlacements[placement] || {} + }), _React$useState2 = slicedToArray_slicedToArray(_React$useState, 2), offsetInfo = _React$useState2[0], setOffsetInfo = _React$useState2[1]; + var alignCountRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(0); + var scrollerList = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(function() { + if (!popupEle) return []; + return collectScroller(popupEle); + }, [ + popupEle + ]); + var prevFlipRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef({}); + var resetFlipCache = function() { + prevFlipRef.current = {}; + }; + if (!open) resetFlipCache(); + var onAlign = useEvent(function() { + if (popupEle && target && open) { + var _popupElement$parentE, _popupRect$x, _popupRect$y, _popupElement$parentE2; + var popupElement = popupEle; + var doc = popupElement.ownerDocument; + var win = getWin(popupElement); + var _win$getComputedStyle = win.getComputedStyle(popupElement), popupPosition = _win$getComputedStyle.position; + var originLeft = popupElement.style.left; + var originTop = popupElement.style.top; + var originRight = popupElement.style.right; + var originBottom = popupElement.style.bottom; + var originOverflow = popupElement.style.overflow; + var placementInfo = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, builtinPlacements[placement]), popupAlign); + var placeholderElement = doc.createElement('div'); + null == (_popupElement$parentE = popupElement.parentElement) || _popupElement$parentE.appendChild(placeholderElement); + placeholderElement.style.left = "".concat(popupElement.offsetLeft, "px"); + placeholderElement.style.top = "".concat(popupElement.offsetTop, "px"); + placeholderElement.style.position = popupPosition; + placeholderElement.style.height = "".concat(popupElement.offsetHeight, "px"); + placeholderElement.style.width = "".concat(popupElement.offsetWidth, "px"); + popupElement.style.left = '0'; + popupElement.style.top = '0'; + popupElement.style.right = 'auto'; + popupElement.style.bottom = 'auto'; + popupElement.style.overflow = 'hidden'; + var targetRect; + if (Array.isArray(target)) targetRect = { + x: target[0], + y: target[1], + width: 0, + height: 0 + }; + else { + var _rect$x, _rect$y; + var rect = target.getBoundingClientRect(); + rect.x = null != (_rect$x = rect.x) ? _rect$x : rect.left; + rect.y = null != (_rect$y = rect.y) ? _rect$y : rect.top; + targetRect = { + x: rect.x, + y: rect.y, + width: rect.width, + height: rect.height + }; + } + var popupRect = popupElement.getBoundingClientRect(); + var _win$getComputedStyle2 = win.getComputedStyle(popupElement), height = _win$getComputedStyle2.height, width = _win$getComputedStyle2.width; + popupRect.x = null != (_popupRect$x = popupRect.x) ? _popupRect$x : popupRect.left; + popupRect.y = null != (_popupRect$y = popupRect.y) ? _popupRect$y : popupRect.top; + var _doc$documentElement = doc.documentElement, clientWidth = _doc$documentElement.clientWidth, clientHeight = _doc$documentElement.clientHeight, scrollWidth = _doc$documentElement.scrollWidth, scrollHeight = _doc$documentElement.scrollHeight, scrollTop = _doc$documentElement.scrollTop, scrollLeft = _doc$documentElement.scrollLeft; + var popupHeight = popupRect.height; + var popupWidth = popupRect.width; + var targetHeight = targetRect.height; + var targetWidth = targetRect.width; + var visibleRegion = { + left: 0, + top: 0, + right: clientWidth, + bottom: clientHeight + }; + var scrollRegion = { + left: -scrollLeft, + top: -scrollTop, + right: scrollWidth - scrollLeft, + bottom: scrollHeight - scrollTop + }; + var htmlRegion = placementInfo.htmlRegion; + var VISIBLE = 'visible'; + var VISIBLE_FIRST = 'visibleFirst'; + if ('scroll' !== htmlRegion && htmlRegion !== VISIBLE_FIRST) htmlRegion = VISIBLE; + var isVisibleFirst = htmlRegion === VISIBLE_FIRST; + var scrollRegionArea = getVisibleArea(scrollRegion, scrollerList); + var visibleRegionArea = getVisibleArea(visibleRegion, scrollerList); + var visibleArea = htmlRegion === VISIBLE ? visibleRegionArea : scrollRegionArea; + var adjustCheckVisibleArea = isVisibleFirst ? visibleRegionArea : visibleArea; + popupElement.style.left = 'auto'; + popupElement.style.top = 'auto'; + popupElement.style.right = '0'; + popupElement.style.bottom = '0'; + var popupMirrorRect = popupElement.getBoundingClientRect(); + popupElement.style.left = originLeft; + popupElement.style.top = originTop; + popupElement.style.right = originRight; + popupElement.style.bottom = originBottom; + popupElement.style.overflow = originOverflow; + null == (_popupElement$parentE2 = popupElement.parentElement) || _popupElement$parentE2.removeChild(placeholderElement); + var _scaleX = toNum(Math.round(popupWidth / parseFloat(width) * 1000) / 1000); + var _scaleY = toNum(Math.round(popupHeight / parseFloat(height) * 1000) / 1000); + if (0 === _scaleX || 0 === _scaleY || isDOM(target) && !isVisible(target)) return; + var offset = placementInfo.offset, targetOffset = placementInfo.targetOffset; + var _getNumberOffset = getNumberOffset(popupRect, offset), _getNumberOffset2 = slicedToArray_slicedToArray(_getNumberOffset, 2), popupOffsetX = _getNumberOffset2[0], popupOffsetY = _getNumberOffset2[1]; + var _getNumberOffset3 = getNumberOffset(targetRect, targetOffset), _getNumberOffset4 = slicedToArray_slicedToArray(_getNumberOffset3, 2), targetOffsetX = _getNumberOffset4[0], targetOffsetY = _getNumberOffset4[1]; + targetRect.x -= targetOffsetX; + targetRect.y -= targetOffsetY; + var _ref3 = placementInfo.points || [], _ref4 = slicedToArray_slicedToArray(_ref3, 2), popupPoint = _ref4[0], targetPoint = _ref4[1]; + var targetPoints = splitPoints(targetPoint); + var popupPoints = splitPoints(popupPoint); + var targetAlignPoint = getAlignPoint(targetRect, targetPoints); + var popupAlignPoint = getAlignPoint(popupRect, popupPoints); + var nextAlignInfo = objectSpread2_objectSpread2({}, placementInfo); + var nextOffsetX = targetAlignPoint.x - popupAlignPoint.x + popupOffsetX; + var nextOffsetY = targetAlignPoint.y - popupAlignPoint.y + popupOffsetY; + function getIntersectionVisibleArea(offsetX, offsetY) { + var area = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : visibleArea; + var l = popupRect.x + offsetX; + var t = popupRect.y + offsetY; + var r = l + popupWidth; + var b = t + popupHeight; + var visibleL = Math.max(l, area.left); + var visibleT = Math.max(t, area.top); + var visibleR = Math.min(r, area.right); + var visibleB = Math.min(b, area.bottom); + return Math.max(0, (visibleR - visibleL) * (visibleB - visibleT)); + } + var originIntersectionVisibleArea = getIntersectionVisibleArea(nextOffsetX, nextOffsetY); + var originIntersectionRecommendArea = getIntersectionVisibleArea(nextOffsetX, nextOffsetY, visibleRegionArea); + var targetAlignPointTL = getAlignPoint(targetRect, [ + 't', + 'l' + ]); + var popupAlignPointTL = getAlignPoint(popupRect, [ + 't', + 'l' + ]); + var targetAlignPointBR = getAlignPoint(targetRect, [ + 'b', + 'r' + ]); + var popupAlignPointBR = getAlignPoint(popupRect, [ + 'b', + 'r' + ]); + var overflow = placementInfo.overflow || {}; + var adjustX = overflow.adjustX, adjustY = overflow.adjustY, shiftX = overflow.shiftX, shiftY = overflow.shiftY; + var supportAdjust = function(val) { + if ('boolean' == typeof val) return val; + return val >= 0; + }; + var nextPopupY; + var nextPopupBottom; + var nextPopupX; + var nextPopupRight; + function syncNextPopupPosition() { + nextPopupY = popupRect.y + nextOffsetY; + nextPopupBottom = nextPopupY + popupHeight; + nextPopupX = popupRect.x + nextOffsetX; + nextPopupRight = nextPopupX + popupWidth; + } + syncNextPopupPosition(); + var needAdjustY = supportAdjust(adjustY); + var sameTB = popupPoints[0] === targetPoints[0]; + if (needAdjustY && 't' === popupPoints[0] && (nextPopupBottom > adjustCheckVisibleArea.bottom || prevFlipRef.current.bt)) { + var tmpNextOffsetY = nextOffsetY; + if (sameTB) tmpNextOffsetY -= popupHeight - targetHeight; + else tmpNextOffsetY = targetAlignPointTL.y - popupAlignPointBR.y - popupOffsetY; + var newVisibleArea = getIntersectionVisibleArea(nextOffsetX, tmpNextOffsetY); + var newVisibleRecommendArea = getIntersectionVisibleArea(nextOffsetX, tmpNextOffsetY, visibleRegionArea); + if (newVisibleArea > originIntersectionVisibleArea || newVisibleArea === originIntersectionVisibleArea && (!isVisibleFirst || newVisibleRecommendArea >= originIntersectionRecommendArea)) { + prevFlipRef.current.bt = true; + nextOffsetY = tmpNextOffsetY; + popupOffsetY = -popupOffsetY; + nextAlignInfo.points = [ + reversePoints(popupPoints, 0), + reversePoints(targetPoints, 0) + ]; + } else prevFlipRef.current.bt = false; + } + if (needAdjustY && 'b' === popupPoints[0] && (nextPopupY < adjustCheckVisibleArea.top || prevFlipRef.current.tb)) { + var _tmpNextOffsetY = nextOffsetY; + if (sameTB) _tmpNextOffsetY += popupHeight - targetHeight; + else _tmpNextOffsetY = targetAlignPointBR.y - popupAlignPointTL.y - popupOffsetY; + var _newVisibleArea = getIntersectionVisibleArea(nextOffsetX, _tmpNextOffsetY); + var _newVisibleRecommendArea = getIntersectionVisibleArea(nextOffsetX, _tmpNextOffsetY, visibleRegionArea); + if (_newVisibleArea > originIntersectionVisibleArea || _newVisibleArea === originIntersectionVisibleArea && (!isVisibleFirst || _newVisibleRecommendArea >= originIntersectionRecommendArea)) { + prevFlipRef.current.tb = true; + nextOffsetY = _tmpNextOffsetY; + popupOffsetY = -popupOffsetY; + nextAlignInfo.points = [ + reversePoints(popupPoints, 0), + reversePoints(targetPoints, 0) + ]; + } else prevFlipRef.current.tb = false; + } + var needAdjustX = supportAdjust(adjustX); + var sameLR = popupPoints[1] === targetPoints[1]; + if (needAdjustX && 'l' === popupPoints[1] && (nextPopupRight > adjustCheckVisibleArea.right || prevFlipRef.current.rl)) { + var tmpNextOffsetX = nextOffsetX; + if (sameLR) tmpNextOffsetX -= popupWidth - targetWidth; + else tmpNextOffsetX = targetAlignPointTL.x - popupAlignPointBR.x - popupOffsetX; + var _newVisibleArea2 = getIntersectionVisibleArea(tmpNextOffsetX, nextOffsetY); + var _newVisibleRecommendArea2 = getIntersectionVisibleArea(tmpNextOffsetX, nextOffsetY, visibleRegionArea); + if (_newVisibleArea2 > originIntersectionVisibleArea || _newVisibleArea2 === originIntersectionVisibleArea && (!isVisibleFirst || _newVisibleRecommendArea2 >= originIntersectionRecommendArea)) { + prevFlipRef.current.rl = true; + nextOffsetX = tmpNextOffsetX; + popupOffsetX = -popupOffsetX; + nextAlignInfo.points = [ + reversePoints(popupPoints, 1), + reversePoints(targetPoints, 1) + ]; + } else prevFlipRef.current.rl = false; + } + if (needAdjustX && 'r' === popupPoints[1] && (nextPopupX < adjustCheckVisibleArea.left || prevFlipRef.current.lr)) { + var _tmpNextOffsetX = nextOffsetX; + if (sameLR) _tmpNextOffsetX += popupWidth - targetWidth; + else _tmpNextOffsetX = targetAlignPointBR.x - popupAlignPointTL.x - popupOffsetX; + var _newVisibleArea3 = getIntersectionVisibleArea(_tmpNextOffsetX, nextOffsetY); + var _newVisibleRecommendArea3 = getIntersectionVisibleArea(_tmpNextOffsetX, nextOffsetY, visibleRegionArea); + if (_newVisibleArea3 > originIntersectionVisibleArea || _newVisibleArea3 === originIntersectionVisibleArea && (!isVisibleFirst || _newVisibleRecommendArea3 >= originIntersectionRecommendArea)) { + prevFlipRef.current.lr = true; + nextOffsetX = _tmpNextOffsetX; + popupOffsetX = -popupOffsetX; + nextAlignInfo.points = [ + reversePoints(popupPoints, 1), + reversePoints(targetPoints, 1) + ]; + } else prevFlipRef.current.lr = false; + } + syncNextPopupPosition(); + var numShiftX = true === shiftX ? 0 : shiftX; + if ('number' == typeof numShiftX) { + if (nextPopupX < visibleRegionArea.left) { + nextOffsetX -= nextPopupX - visibleRegionArea.left - popupOffsetX; + if (targetRect.x + targetWidth < visibleRegionArea.left + numShiftX) nextOffsetX += targetRect.x - visibleRegionArea.left + targetWidth - numShiftX; + } + if (nextPopupRight > visibleRegionArea.right) { + nextOffsetX -= nextPopupRight - visibleRegionArea.right - popupOffsetX; + if (targetRect.x > visibleRegionArea.right - numShiftX) nextOffsetX += targetRect.x - visibleRegionArea.right + numShiftX; + } + } + var numShiftY = true === shiftY ? 0 : shiftY; + if ('number' == typeof numShiftY) { + if (nextPopupY < visibleRegionArea.top) { + nextOffsetY -= nextPopupY - visibleRegionArea.top - popupOffsetY; + if (targetRect.y + targetHeight < visibleRegionArea.top + numShiftY) nextOffsetY += targetRect.y - visibleRegionArea.top + targetHeight - numShiftY; + } + if (nextPopupBottom > visibleRegionArea.bottom) { + nextOffsetY -= nextPopupBottom - visibleRegionArea.bottom - popupOffsetY; + if (targetRect.y > visibleRegionArea.bottom - numShiftY) nextOffsetY += targetRect.y - visibleRegionArea.bottom + numShiftY; + } + } + var popupLeft = popupRect.x + nextOffsetX; + var popupRight = popupLeft + popupWidth; + var popupTop = popupRect.y + nextOffsetY; + var popupBottom = popupTop + popupHeight; + var targetLeft = targetRect.x; + var targetRight = targetLeft + targetWidth; + var targetTop = targetRect.y; + var targetBottom = targetTop + targetHeight; + var maxLeft = Math.max(popupLeft, targetLeft); + var minRight = Math.min(popupRight, targetRight); + var xCenter = (maxLeft + minRight) / 2; + var nextArrowX = xCenter - popupLeft; + var maxTop = Math.max(popupTop, targetTop); + var minBottom = Math.min(popupBottom, targetBottom); + var yCenter = (maxTop + minBottom) / 2; + var nextArrowY = yCenter - popupTop; + null == onPopupAlign || onPopupAlign(popupEle, nextAlignInfo); + var offsetX4Right = popupMirrorRect.right - popupRect.x - (nextOffsetX + popupRect.width); + var offsetY4Bottom = popupMirrorRect.bottom - popupRect.y - (nextOffsetY + popupRect.height); + if (1 === _scaleX) { + nextOffsetX = Math.round(nextOffsetX); + offsetX4Right = Math.round(offsetX4Right); + } + if (1 === _scaleY) { + nextOffsetY = Math.round(nextOffsetY); + offsetY4Bottom = Math.round(offsetY4Bottom); + } + var nextOffsetInfo = { + ready: true, + offsetX: nextOffsetX / _scaleX, + offsetY: nextOffsetY / _scaleY, + offsetR: offsetX4Right / _scaleX, + offsetB: offsetY4Bottom / _scaleY, + arrowX: nextArrowX / _scaleX, + arrowY: nextArrowY / _scaleY, + scaleX: _scaleX, + scaleY: _scaleY, + align: nextAlignInfo + }; + setOffsetInfo(nextOffsetInfo); + } + }); + var triggerAlign = function() { + alignCountRef.current += 1; + var id = alignCountRef.current; + Promise.resolve().then(function() { + if (alignCountRef.current === id) onAlign(); + }); + }; + var resetReady = function() { + setOffsetInfo(function(ori) { + return objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, ori), {}, { + ready: false + }); + }); + }; + hooks_useLayoutEffect(resetReady, [ + placement + ]); + hooks_useLayoutEffect(function() { + if (!open) resetReady(); + }, [ + open + ]); + return [ + offsetInfo.ready, + offsetInfo.offsetX, + offsetInfo.offsetY, + offsetInfo.offsetR, + offsetInfo.offsetB, + offsetInfo.arrowX, + offsetInfo.arrowY, + offsetInfo.scaleX, + offsetInfo.scaleY, + offsetInfo.align, + triggerAlign + ]; +} +function useWatch(open, target, popup, onAlign, onScroll) { + hooks_useLayoutEffect(function() { + if (open && target && popup) { + var targetElement = target; + var popupElement = popup; + var targetScrollList = collectScroller(targetElement); + var popupScrollList = collectScroller(popupElement); + var win = getWin(popupElement); + var mergedList = new Set([ + win + ].concat(_toConsumableArray(targetScrollList), _toConsumableArray(popupScrollList))); + function notifyScroll() { + onAlign(); + onScroll(); + } + mergedList.forEach(function(scroller) { + scroller.addEventListener('scroll', notifyScroll, { + passive: true + }); + }); + win.addEventListener('resize', notifyScroll, { + passive: true + }); + onAlign(); + return function() { + mergedList.forEach(function(scroller) { + scroller.removeEventListener('scroll', notifyScroll); + win.removeEventListener('resize', notifyScroll); + }); + }; + } + }, [ + open, + target, + popup + ]); +} +function useWinClick(open, clickToHide, targetEle, popupEle, mask, maskClosable, inPopupOrChild, triggerOpen) { + var openRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(open); + openRef.current = open; + var popupPointerDownRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(false); + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(function() { + if (clickToHide && popupEle && (!mask || maskClosable)) { + var onPointerDown = function() { + popupPointerDownRef.current = false; + }; + var onTriggerClose = function(e) { + var _e$composedPath; + if (openRef.current && !inPopupOrChild((null == (_e$composedPath = e.composedPath) || null == (_e$composedPath = _e$composedPath.call(e)) ? void 0 : _e$composedPath[0]) || e.target) && !popupPointerDownRef.current) triggerOpen(false); + }; + var win = getWin(popupEle); + win.addEventListener('pointerdown', onPointerDown, true); + win.addEventListener('mousedown', onTriggerClose, true); + win.addEventListener('contextmenu', onTriggerClose, true); + var targetShadowRoot = getShadowRoot(targetEle); + if (targetShadowRoot) { + targetShadowRoot.addEventListener('mousedown', onTriggerClose, true); + targetShadowRoot.addEventListener('contextmenu', onTriggerClose, true); + } + if ('production' !== process.env.NODE_ENV) { + var _targetEle$getRootNod, _popupEle$getRootNode; + var targetRoot = null == targetEle || null == (_targetEle$getRootNod = targetEle.getRootNode) ? void 0 : _targetEle$getRootNod.call(targetEle); + var popupRoot = null == (_popupEle$getRootNode = popupEle.getRootNode) ? void 0 : _popupEle$getRootNode.call(popupEle); + warning_warning(targetRoot === popupRoot, "trigger element and popup element should in same shadow root."); + } + return function() { + win.removeEventListener('pointerdown', onPointerDown, true); + win.removeEventListener('mousedown', onTriggerClose, true); + win.removeEventListener('contextmenu', onTriggerClose, true); + if (targetShadowRoot) { + targetShadowRoot.removeEventListener('mousedown', onTriggerClose, true); + targetShadowRoot.removeEventListener('contextmenu', onTriggerClose, true); + } + }; + } + }, [ + clickToHide, + targetEle, + popupEle, + mask, + maskClosable + ]); + function onPopupPointerDown() { + popupPointerDownRef.current = true; + } + return onPopupPointerDown; +} +var es_excluded = [ + "prefixCls", + "children", + "action", + "showAction", + "hideAction", + "popupVisible", + "defaultPopupVisible", + "onPopupVisibleChange", + "afterPopupVisibleChange", + "mouseEnterDelay", + "mouseLeaveDelay", + "focusDelay", + "blurDelay", + "mask", + "maskClosable", + "getPopupContainer", + "forceRender", + "autoDestroy", + "destroyPopupOnHide", + "popup", + "popupClassName", + "popupStyle", + "popupPlacement", + "builtinPlacements", + "popupAlign", + "zIndex", + "stretch", + "getPopupClassNameFromAlign", + "fresh", + "alignPoint", + "onPopupClick", + "onPopupAlign", + "arrow", + "popupMotion", + "maskMotion", + "popupTransitionName", + "popupAnimation", + "maskTransitionName", + "maskAnimation", + "className", + "getTriggerDOMNode" +]; +function generateTrigger() { + var PortalComponent = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : es; + var Trigger = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef(function(props, ref) { + var _props$prefixCls = props.prefixCls, prefixCls = void 0 === _props$prefixCls ? 'rc-trigger-popup' : _props$prefixCls, children = props.children, _props$action = props.action, action = void 0 === _props$action ? 'hover' : _props$action, showAction = props.showAction, hideAction = props.hideAction, popupVisible = props.popupVisible, defaultPopupVisible = props.defaultPopupVisible, onPopupVisibleChange = props.onPopupVisibleChange, afterPopupVisibleChange = props.afterPopupVisibleChange, mouseEnterDelay = props.mouseEnterDelay, _props$mouseLeaveDela = props.mouseLeaveDelay, mouseLeaveDelay = void 0 === _props$mouseLeaveDela ? 0.1 : _props$mouseLeaveDela, focusDelay = props.focusDelay, blurDelay = props.blurDelay, mask = props.mask, _props$maskClosable = props.maskClosable, maskClosable = void 0 === _props$maskClosable ? true : _props$maskClosable, getPopupContainer = props.getPopupContainer, forceRender = props.forceRender, autoDestroy = props.autoDestroy, destroyPopupOnHide = props.destroyPopupOnHide, popup = props.popup, popupClassName = props.popupClassName, popupStyle = props.popupStyle, popupPlacement = props.popupPlacement, _props$builtinPlaceme = props.builtinPlacements, builtinPlacements = void 0 === _props$builtinPlaceme ? {} : _props$builtinPlaceme, popupAlign = props.popupAlign, zIndex = props.zIndex, stretch = props.stretch, getPopupClassNameFromAlign = props.getPopupClassNameFromAlign, fresh = props.fresh, alignPoint = props.alignPoint, onPopupClick = props.onPopupClick, onPopupAlign = props.onPopupAlign, arrow = props.arrow, popupMotion = props.popupMotion, maskMotion = props.maskMotion, popupTransitionName = props.popupTransitionName, popupAnimation = props.popupAnimation, maskTransitionName = props.maskTransitionName, maskAnimation = props.maskAnimation, className = props.className, getTriggerDOMNode = props.getTriggerDOMNode, restProps = objectWithoutProperties_objectWithoutProperties(props, es_excluded); + var mergedAutoDestroy = autoDestroy || destroyPopupOnHide || false; + var _React$useState = __WEBPACK_EXTERNAL_MODULE_react__.useState(false), _React$useState2 = slicedToArray_slicedToArray(_React$useState, 2), mobile = _React$useState2[0], setMobile = _React$useState2[1]; + hooks_useLayoutEffect(function() { + setMobile(isMobile()); + }, []); + var subPopupElements = __WEBPACK_EXTERNAL_MODULE_react__.useRef({}); + var parentContext = __WEBPACK_EXTERNAL_MODULE_react__.useContext(es_context); + var context = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(function() { + return { + registerSubPopup: function(id, subPopupEle) { + subPopupElements.current[id] = subPopupEle; + null == parentContext || parentContext.registerSubPopup(id, subPopupEle); + } + }; + }, [ + parentContext + ]); + var id = hooks_useId(); + var _React$useState3 = __WEBPACK_EXTERNAL_MODULE_react__.useState(null), _React$useState4 = slicedToArray_slicedToArray(_React$useState3, 2), popupEle = _React$useState4[0], setPopupEle = _React$useState4[1]; + var externalPopupRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(null); + var setPopupRef = useEvent(function(node) { + externalPopupRef.current = node; + if (isDOM(node) && popupEle !== node) setPopupEle(node); + null == parentContext || parentContext.registerSubPopup(id, node); + }); + var _React$useState5 = __WEBPACK_EXTERNAL_MODULE_react__.useState(null), _React$useState6 = slicedToArray_slicedToArray(_React$useState5, 2), targetEle = _React$useState6[0], setTargetEle = _React$useState6[1]; + var externalForwardRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(null); + var setTargetRef = useEvent(function(node) { + if (isDOM(node) && targetEle !== node) { + setTargetEle(node); + externalForwardRef.current = node; + } + }); + var child = __WEBPACK_EXTERNAL_MODULE_react__.Children.only(children); + var originChildProps = (null == child ? void 0 : child.props) || {}; + var cloneProps = {}; + var inPopupOrChild = useEvent(function(ele) { + var _getShadowRoot, _getShadowRoot2; + var childDOM = targetEle; + return (null == childDOM ? void 0 : childDOM.contains(ele)) || (null == (_getShadowRoot = getShadowRoot(childDOM)) ? void 0 : _getShadowRoot.host) === ele || ele === childDOM || (null == popupEle ? void 0 : popupEle.contains(ele)) || (null == (_getShadowRoot2 = getShadowRoot(popupEle)) ? void 0 : _getShadowRoot2.host) === ele || ele === popupEle || Object.values(subPopupElements.current).some(function(subPopupEle) { + return (null == subPopupEle ? void 0 : subPopupEle.contains(ele)) || ele === subPopupEle; + }); + }); + var mergePopupMotion = getMotion(prefixCls, popupMotion, popupAnimation, popupTransitionName); + var mergeMaskMotion = getMotion(prefixCls, maskMotion, maskAnimation, maskTransitionName); + var _React$useState7 = __WEBPACK_EXTERNAL_MODULE_react__.useState(defaultPopupVisible || false), _React$useState8 = slicedToArray_slicedToArray(_React$useState7, 2), internalOpen = _React$useState8[0], setInternalOpen = _React$useState8[1]; + var mergedOpen = null != popupVisible ? popupVisible : internalOpen; + var setMergedOpen = useEvent(function(nextOpen) { + if (void 0 === popupVisible) setInternalOpen(nextOpen); + }); + hooks_useLayoutEffect(function() { + setInternalOpen(popupVisible || false); + }, [ + popupVisible + ]); + var openRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(mergedOpen); + openRef.current = mergedOpen; + var lastTriggerRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef([]); + lastTriggerRef.current = []; + var internalTriggerOpen = useEvent(function(nextOpen) { + var _lastTriggerRef$curre; + setMergedOpen(nextOpen); + if ((null != (_lastTriggerRef$curre = lastTriggerRef.current[lastTriggerRef.current.length - 1]) ? _lastTriggerRef$curre : mergedOpen) !== nextOpen) { + lastTriggerRef.current.push(nextOpen); + null == onPopupVisibleChange || onPopupVisibleChange(nextOpen); + } + }); + var delayRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(); + var clearDelay = function() { + clearTimeout(delayRef.current); + }; + var triggerOpen = function(nextOpen) { + var delay = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0; + clearDelay(); + if (0 === delay) internalTriggerOpen(nextOpen); + else delayRef.current = setTimeout(function() { + internalTriggerOpen(nextOpen); + }, 1000 * delay); + }; + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(function() { + return clearDelay; + }, []); + var _React$useState9 = __WEBPACK_EXTERNAL_MODULE_react__.useState(false), _React$useState10 = slicedToArray_slicedToArray(_React$useState9, 2), inMotion = _React$useState10[0], setInMotion = _React$useState10[1]; + hooks_useLayoutEffect(function(firstMount) { + if (!firstMount || mergedOpen) setInMotion(true); + }, [ + mergedOpen + ]); + var _React$useState11 = __WEBPACK_EXTERNAL_MODULE_react__.useState(null), _React$useState12 = slicedToArray_slicedToArray(_React$useState11, 2), motionPrepareResolve = _React$useState12[0], setMotionPrepareResolve = _React$useState12[1]; + var _React$useState13 = __WEBPACK_EXTERNAL_MODULE_react__.useState(null), _React$useState14 = slicedToArray_slicedToArray(_React$useState13, 2), mousePos = _React$useState14[0], setMousePos = _React$useState14[1]; + var setMousePosByEvent = function(event) { + setMousePos([ + event.clientX, + event.clientY + ]); + }; + var _useAlign = useAlign(mergedOpen, popupEle, alignPoint && null !== mousePos ? mousePos : targetEle, popupPlacement, builtinPlacements, popupAlign, onPopupAlign), _useAlign2 = slicedToArray_slicedToArray(_useAlign, 11), ready = _useAlign2[0], offsetX = _useAlign2[1], offsetY = _useAlign2[2], offsetR = _useAlign2[3], offsetB = _useAlign2[4], arrowX = _useAlign2[5], arrowY = _useAlign2[6], scaleX = _useAlign2[7], scaleY = _useAlign2[8], alignInfo = _useAlign2[9], onAlign = _useAlign2[10]; + var _useAction = useAction(mobile, action, showAction, hideAction), _useAction2 = slicedToArray_slicedToArray(_useAction, 2), showActions = _useAction2[0], hideActions = _useAction2[1]; + var clickToShow = showActions.has('click'); + var clickToHide = hideActions.has('click') || hideActions.has('contextMenu'); + var triggerAlign = useEvent(function() { + if (!inMotion) onAlign(); + }); + var onScroll = function() { + if (openRef.current && alignPoint && clickToHide) triggerOpen(false); + }; + useWatch(mergedOpen, targetEle, popupEle, triggerAlign, onScroll); + hooks_useLayoutEffect(function() { + triggerAlign(); + }, [ + mousePos, + popupPlacement + ]); + hooks_useLayoutEffect(function() { + if (mergedOpen && !(null != builtinPlacements && builtinPlacements[popupPlacement])) triggerAlign(); + }, [ + JSON.stringify(popupAlign) + ]); + var alignedClassName = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(function() { + var baseClassName = getAlignPopupClassName(builtinPlacements, prefixCls, alignInfo, alignPoint); + return classnames_default()(baseClassName, null == getPopupClassNameFromAlign ? void 0 : getPopupClassNameFromAlign(alignInfo)); + }, [ + alignInfo, + getPopupClassNameFromAlign, + builtinPlacements, + prefixCls, + alignPoint + ]); + __WEBPACK_EXTERNAL_MODULE_react__.useImperativeHandle(ref, function() { + return { + nativeElement: externalForwardRef.current, + popupElement: externalPopupRef.current, + forceAlign: triggerAlign + }; + }); + var _React$useState15 = __WEBPACK_EXTERNAL_MODULE_react__.useState(0), _React$useState16 = slicedToArray_slicedToArray(_React$useState15, 2), targetWidth = _React$useState16[0], setTargetWidth = _React$useState16[1]; + var _React$useState17 = __WEBPACK_EXTERNAL_MODULE_react__.useState(0), _React$useState18 = slicedToArray_slicedToArray(_React$useState17, 2), targetHeight = _React$useState18[0], setTargetHeight = _React$useState18[1]; + var syncTargetSize = function() { + if (stretch && targetEle) { + var rect = targetEle.getBoundingClientRect(); + setTargetWidth(rect.width); + setTargetHeight(rect.height); + } + }; + var onTargetResize = function() { + syncTargetSize(); + triggerAlign(); + }; + var onVisibleChanged = function(visible) { + setInMotion(false); + onAlign(); + null == afterPopupVisibleChange || afterPopupVisibleChange(visible); + }; + var onPrepare = function() { + return new Promise(function(resolve) { + syncTargetSize(); + setMotionPrepareResolve(function() { + return resolve; + }); + }); + }; + hooks_useLayoutEffect(function() { + if (motionPrepareResolve) { + onAlign(); + motionPrepareResolve(); + setMotionPrepareResolve(null); + } + }, [ + motionPrepareResolve + ]); + function wrapperAction(eventName, nextOpen, delay, preEvent) { + cloneProps[eventName] = function(event) { + var _originChildProps$eve; + null == preEvent || preEvent(event); + triggerOpen(nextOpen, delay); + for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)args[_key - 1] = arguments[_key]; + null == (_originChildProps$eve = originChildProps[eventName]) || _originChildProps$eve.call.apply(_originChildProps$eve, [ + originChildProps, + event + ].concat(args)); + }; + } + if (clickToShow || clickToHide) cloneProps.onClick = function(event) { + var _originChildProps$onC; + if (openRef.current && clickToHide) triggerOpen(false); + else if (!openRef.current && clickToShow) { + setMousePosByEvent(event); + triggerOpen(true); + } + for(var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++)args[_key2 - 1] = arguments[_key2]; + null == (_originChildProps$onC = originChildProps.onClick) || _originChildProps$onC.call.apply(_originChildProps$onC, [ + originChildProps, + event + ].concat(args)); + }; + var onPopupPointerDown = useWinClick(mergedOpen, clickToHide, targetEle, popupEle, mask, maskClosable, inPopupOrChild, triggerOpen); + var hoverToShow = showActions.has('hover'); + var hoverToHide = hideActions.has('hover'); + var onPopupMouseEnter; + var onPopupMouseLeave; + if (hoverToShow) { + wrapperAction('onMouseEnter', true, mouseEnterDelay, function(event) { + setMousePosByEvent(event); + }); + wrapperAction('onPointerEnter', true, mouseEnterDelay, function(event) { + setMousePosByEvent(event); + }); + onPopupMouseEnter = function(event) { + if ((mergedOpen || inMotion) && null != popupEle && popupEle.contains(event.target)) triggerOpen(true, mouseEnterDelay); + }; + if (alignPoint) cloneProps.onMouseMove = function(event) { + var _originChildProps$onM; + null == (_originChildProps$onM = originChildProps.onMouseMove) || _originChildProps$onM.call(originChildProps, event); + }; + } + if (hoverToHide) { + wrapperAction('onMouseLeave', false, mouseLeaveDelay); + wrapperAction('onPointerLeave', false, mouseLeaveDelay); + onPopupMouseLeave = function() { + triggerOpen(false, mouseLeaveDelay); + }; + } + if (showActions.has('focus')) wrapperAction('onFocus', true, focusDelay); + if (hideActions.has('focus')) wrapperAction('onBlur', false, blurDelay); + if (showActions.has('contextMenu')) cloneProps.onContextMenu = function(event) { + var _originChildProps$onC2; + if (openRef.current && hideActions.has('contextMenu')) triggerOpen(false); + else { + setMousePosByEvent(event); + triggerOpen(true); + } + event.preventDefault(); + for(var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++)args[_key3 - 1] = arguments[_key3]; + null == (_originChildProps$onC2 = originChildProps.onContextMenu) || _originChildProps$onC2.call.apply(_originChildProps$onC2, [ + originChildProps, + event + ].concat(args)); + }; + if (className) cloneProps.className = classnames_default()(originChildProps.className, className); + var mergedChildrenProps = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, originChildProps), cloneProps); + var passedProps = {}; + var passedEventList = [ + 'onContextMenu', + 'onClick', + 'onMouseDown', + 'onTouchStart', + 'onMouseEnter', + 'onMouseLeave', + 'onFocus', + 'onBlur' + ]; + passedEventList.forEach(function(eventName) { + if (restProps[eventName]) passedProps[eventName] = function() { + var _mergedChildrenProps$; + for(var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++)args[_key4] = arguments[_key4]; + null == (_mergedChildrenProps$ = mergedChildrenProps[eventName]) || _mergedChildrenProps$.call.apply(_mergedChildrenProps$, [ + mergedChildrenProps + ].concat(args)); + restProps[eventName].apply(restProps, args); + }; + }); + var triggerNode = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.cloneElement(child, objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, mergedChildrenProps), passedProps)); + var arrowPos = { + x: arrowX, + y: arrowY + }; + var innerArrow = arrow ? objectSpread2_objectSpread2({}, true !== arrow ? arrow : {}) : null; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(__WEBPACK_EXTERNAL_MODULE_react__.Fragment, null, /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(rc_resize_observer_es, { + disabled: !mergedOpen, + ref: setTargetRef, + onResize: onTargetResize + }, /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(es_TriggerWrapper, { + getTriggerDOMNode: getTriggerDOMNode + }, triggerNode)), /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(es_context.Provider, { + value: context + }, /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(es_Popup, { + portal: PortalComponent, + ref: setPopupRef, + prefixCls: prefixCls, + popup: popup, + className: classnames_default()(popupClassName, alignedClassName), + style: popupStyle, + target: targetEle, + onMouseEnter: onPopupMouseEnter, + onMouseLeave: onPopupMouseLeave, + onPointerEnter: onPopupMouseEnter, + zIndex: zIndex, + open: mergedOpen, + keepDom: inMotion, + fresh: fresh, + onClick: onPopupClick, + onPointerDownCapture: onPopupPointerDown, + mask: mask, + motion: mergePopupMotion, + maskMotion: mergeMaskMotion, + onVisibleChanged: onVisibleChanged, + onPrepare: onPrepare, + forceRender: forceRender, + autoDestroy: mergedAutoDestroy, + getPopupContainer: getPopupContainer, + align: alignInfo, + arrow: innerArrow, + arrowPos: arrowPos, + ready: ready, + offsetX: offsetX, + offsetY: offsetY, + offsetR: offsetR, + offsetB: offsetB, + onAlign: triggerAlign, + stretch: stretch, + targetWidth: targetWidth / scaleX, + targetHeight: targetHeight / scaleY + }))); + }); + if ('production' !== process.env.NODE_ENV) Trigger.displayName = 'Trigger'; + return Trigger; +} +const trigger_es = generateTrigger(es); +var autoAdjustOverflowTopBottom = { + shiftX: 64, + adjustY: 1 +}; +var autoAdjustOverflowLeftRight = { + adjustX: 1, + shiftY: true +}; +var placements_targetOffset = [ + 0, + 0 +]; +var placements_placements = { + left: { + points: [ + 'cr', + 'cl' + ], + overflow: autoAdjustOverflowLeftRight, + offset: [ + -4, + 0 + ], + targetOffset: placements_targetOffset + }, + right: { + points: [ + 'cl', + 'cr' + ], + overflow: autoAdjustOverflowLeftRight, + offset: [ + 4, + 0 + ], + targetOffset: placements_targetOffset + }, + top: { + points: [ + 'bc', + 'tc' + ], + overflow: autoAdjustOverflowTopBottom, + offset: [ + 0, + -4 + ], + targetOffset: placements_targetOffset + }, + bottom: { + points: [ + 'tc', + 'bc' + ], + overflow: autoAdjustOverflowTopBottom, + offset: [ + 0, + 4 + ], + targetOffset: placements_targetOffset + }, + topLeft: { + points: [ + 'bl', + 'tl' + ], + overflow: autoAdjustOverflowTopBottom, + offset: [ + 0, + -4 + ], + targetOffset: placements_targetOffset + }, + leftTop: { + points: [ + 'tr', + 'tl' + ], + overflow: autoAdjustOverflowLeftRight, + offset: [ + -4, + 0 + ], + targetOffset: placements_targetOffset + }, + topRight: { + points: [ + 'br', + 'tr' + ], + overflow: autoAdjustOverflowTopBottom, + offset: [ + 0, + -4 + ], + targetOffset: placements_targetOffset + }, + rightTop: { + points: [ + 'tl', + 'tr' + ], + overflow: autoAdjustOverflowLeftRight, + offset: [ + 4, + 0 + ], + targetOffset: placements_targetOffset + }, + bottomRight: { + points: [ + 'tr', + 'br' + ], + overflow: autoAdjustOverflowTopBottom, + offset: [ + 0, + 4 + ], + targetOffset: placements_targetOffset + }, + rightBottom: { + points: [ + 'bl', + 'br' + ], + overflow: autoAdjustOverflowLeftRight, + offset: [ + 4, + 0 + ], + targetOffset: placements_targetOffset + }, + bottomLeft: { + points: [ + 'tl', + 'bl' + ], + overflow: autoAdjustOverflowTopBottom, + offset: [ + 0, + 4 + ], + targetOffset: placements_targetOffset + }, + leftBottom: { + points: [ + 'br', + 'bl' + ], + overflow: autoAdjustOverflowLeftRight, + offset: [ + -4, + 0 + ], + targetOffset: placements_targetOffset + } +}; +var Tooltip_excluded = [ + "overlayClassName", + "trigger", + "mouseEnterDelay", + "mouseLeaveDelay", + "overlayStyle", + "prefixCls", + "children", + "onVisibleChange", + "afterVisibleChange", + "transitionName", + "animation", + "motion", + "placement", + "align", + "destroyTooltipOnHide", + "defaultVisible", + "getTooltipContainer", + "overlayInnerStyle", + "arrowContent", + "overlay", + "id", + "showArrow", + "classNames", + "styles" +]; +var Tooltip_Tooltip = function(props, ref) { + var overlayClassName = props.overlayClassName, _props$trigger = props.trigger, trigger = void 0 === _props$trigger ? [ + 'hover' + ] : _props$trigger, _props$mouseEnterDela = props.mouseEnterDelay, mouseEnterDelay = void 0 === _props$mouseEnterDela ? 0 : _props$mouseEnterDela, _props$mouseLeaveDela = props.mouseLeaveDelay, mouseLeaveDelay = void 0 === _props$mouseLeaveDela ? 0.1 : _props$mouseLeaveDela, overlayStyle = props.overlayStyle, _props$prefixCls = props.prefixCls, prefixCls = void 0 === _props$prefixCls ? 'rc-tooltip' : _props$prefixCls, children = props.children, onVisibleChange = props.onVisibleChange, afterVisibleChange = props.afterVisibleChange, transitionName = props.transitionName, animation = props.animation, motion = props.motion, _props$placement = props.placement, placement = void 0 === _props$placement ? 'right' : _props$placement, _props$align = props.align, align = void 0 === _props$align ? {} : _props$align, _props$destroyTooltip = props.destroyTooltipOnHide, destroyTooltipOnHide = void 0 === _props$destroyTooltip ? false : _props$destroyTooltip, defaultVisible = props.defaultVisible, getTooltipContainer = props.getTooltipContainer, overlayInnerStyle = props.overlayInnerStyle, overlay = (props.arrowContent, props.overlay), id = props.id, _props$showArrow = props.showArrow, showArrow = void 0 === _props$showArrow ? true : _props$showArrow, tooltipClassNames = props.classNames, tooltipStyles = props.styles, restProps = objectWithoutProperties_objectWithoutProperties(props, Tooltip_excluded); + var mergedId = hooks_useId(id); + var triggerRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null); + (0, __WEBPACK_EXTERNAL_MODULE_react__.useImperativeHandle)(ref, function() { + return triggerRef.current; + }); + var extraProps = objectSpread2_objectSpread2({}, restProps); + if ('visible' in props) extraProps.popupVisible = props.visible; + var getPopupElement = function() { + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(Popup, { + key: "content", + prefixCls: prefixCls, + id: mergedId, + bodyClassName: null == tooltipClassNames ? void 0 : tooltipClassNames.body, + overlayInnerStyle: objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, overlayInnerStyle), null == tooltipStyles ? void 0 : tooltipStyles.body) + }, overlay); + }; + var getChildren = function() { + var child = __WEBPACK_EXTERNAL_MODULE_react__.Children.only(children); + var originalProps = (null == child ? void 0 : child.props) || {}; + var childProps = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, originalProps), {}, { + 'aria-describedby': overlay ? mergedId : null + }); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.cloneElement(children, childProps); + }; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(trigger_es, _extends({ + popupClassName: classnames_default()(overlayClassName, null == tooltipClassNames ? void 0 : tooltipClassNames.root), + prefixCls: prefixCls, + popup: getPopupElement, + action: trigger, + builtinPlacements: placements_placements, + popupPlacement: placement, + ref: triggerRef, + popupAlign: align, + getPopupContainer: getTooltipContainer, + onPopupVisibleChange: onVisibleChange, + afterPopupVisibleChange: afterVisibleChange, + popupTransitionName: transitionName, + popupAnimation: animation, + popupMotion: motion, + defaultPopupVisible: defaultVisible, + autoDestroy: destroyTooltipOnHide, + mouseLeaveDelay: mouseLeaveDelay, + popupStyle: objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, overlayStyle), null == tooltipStyles ? void 0 : tooltipStyles.root), + mouseEnterDelay: mouseEnterDelay, + arrow: showArrow + }, extraProps), getChildren()); +}; +const es_Tooltip = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRef)(Tooltip_Tooltip); +const rc_tooltip_es = es_Tooltip; +function regeneratorRuntime_regeneratorRuntime() { + "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ + regeneratorRuntime_regeneratorRuntime = function() { + return e; + }; + var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function(t, e, r) { + t[e] = r.value; + }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; + function define1(t, e, r) { + return Object.defineProperty(t, e, { + value: r, + enumerable: !0, + configurable: !0, + writable: !0 + }), t[e]; + } + try { + define1({}, ""); + } catch (t) { + define1 = function(t, e, r) { + return t[e] = r; + }; + } + function wrap(t, e, r, n) { + var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); + return o(a, "_invoke", { + value: makeInvokeMethod(t, r, c) + }), a; + } + function tryCatch(t, e, r) { + try { + return { + type: "normal", + arg: t.call(e, r) + }; + } catch (t) { + return { + type: "throw", + arg: t + }; + } + } + e.wrap = wrap; + var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + var p = {}; + define1(p, a, function() { + return this; + }); + var d = Object.getPrototypeOf, v = d && d(d(values([]))); + v && v !== r && n.call(v, a) && (p = v); + var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); + function defineIteratorMethods(t) { + [ + "next", + "throw", + "return" + ].forEach(function(e) { + define1(t, e, function(t) { + return this._invoke(e, t); + }); + }); + } + function AsyncIterator(t, e) { + function invoke(r, o, i, a) { + var c = tryCatch(t[r], t, o); + if ("throw" !== c.type) { + var u = c.arg, h = u.value; + return h && "object" == typeof_typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function(t) { + invoke("next", t, i, a); + }, function(t) { + invoke("throw", t, i, a); + }) : e.resolve(h).then(function(t) { + u.value = t, i(u); + }, function(t) { + return invoke("throw", t, i, a); + }); + } + a(c.arg); + } + var r; + o(this, "_invoke", { + value: function(t, n) { + function callInvokeWithMethodAndArg() { + return new e(function(e, r) { + invoke(t, n, e, r); + }); + } + return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } + }); + } + function makeInvokeMethod(e, r, n) { + var o = h; + return function(i, a) { + if (o === f) throw Error("Generator is already running"); + if (o === s) { + if ("throw" === i) throw a; + return { + value: t, + done: !0 + }; + } + for(n.method = i, n.arg = a;;){ + var c = n.delegate; + if (c) { + var u = maybeInvokeDelegate(c, n); + if (u) { + if (u === y) continue; + return u; + } + } + if ("next" === n.method) n.sent = n._sent = n.arg; + else if ("throw" === n.method) { + if (o === h) throw o = s, n.arg; + n.dispatchException(n.arg); + } else "return" === n.method && n.abrupt("return", n.arg); + o = f; + var p = tryCatch(e, r, n); + if ("normal" === p.type) { + if (o = n.done ? s : l, p.arg === y) continue; + return { + value: p.arg, + done: n.done + }; + } + "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); + } + }; + } + function maybeInvokeDelegate(e, r) { + var n = r.method, o = e.iterator[n]; + if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; + var i = tryCatch(o, e.iterator, r.arg); + if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; + var a = i.arg; + return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); + } + function pushTryEntry(t) { + var e = { + tryLoc: t[0] + }; + 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); + } + function resetTryEntry(t) { + var e = t.completion || {}; + e.type = "normal", delete e.arg, t.completion = e; + } + function Context(t) { + this.tryEntries = [ + { + tryLoc: "root" + } + ], t.forEach(pushTryEntry, this), this.reset(!0); + } + function values(e) { + if (e || "" === e) { + var r = e[a]; + if (r) return r.call(e); + if ("function" == typeof e.next) return e; + if (!isNaN(e.length)) { + var o = -1, i = function next() { + for(; ++o < e.length;)if (n.call(e, o)) return next.value = e[o], next.done = !1, next; + return next.value = t, next.done = !0, next; + }; + return i.next = i; + } + } + throw new TypeError(typeof_typeof(e) + " is not iterable"); + } + return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { + value: GeneratorFunctionPrototype, + configurable: !0 + }), o(GeneratorFunctionPrototype, "constructor", { + value: GeneratorFunction, + configurable: !0 + }), GeneratorFunction.displayName = define1(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function(t) { + var e = "function" == typeof t && t.constructor; + return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); + }, e.mark = function(t) { + return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define1(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; + }, e.awrap = function(t) { + return { + __await: t + }; + }, defineIteratorMethods(AsyncIterator.prototype), define1(AsyncIterator.prototype, c, function() { + return this; + }), e.AsyncIterator = AsyncIterator, e.async = function(t, r, n, o, i) { + void 0 === i && (i = Promise); + var a = new AsyncIterator(wrap(t, r, n, o), i); + return e.isGeneratorFunction(r) ? a : a.next().then(function(t) { + return t.done ? t.value : a.next(); + }); + }, defineIteratorMethods(g), define1(g, u, "Generator"), define1(g, a, function() { + return this; + }), define1(g, "toString", function() { + return "[object Generator]"; + }), e.keys = function(t) { + var e = Object(t), r = []; + for(var n in e)r.push(n); + return r.reverse(), function next() { + for(; r.length;){ + var t = r.pop(); + if (t in e) return next.value = t, next.done = !1, next; + } + return next.done = !0, next; + }; + }, e.values = values, Context.prototype = { + constructor: Context, + reset: function(e) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for(var r in this)"t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); + }, + stop: function() { + this.done = !0; + var t = this.tryEntries[0].completion; + if ("throw" === t.type) throw t.arg; + return this.rval; + }, + dispatchException: function(e) { + if (this.done) throw e; + var r = this; + function handle(n, o) { + return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; + } + for(var o = this.tryEntries.length - 1; o >= 0; --o){ + var i = this.tryEntries[o], a = i.completion; + if ("root" === i.tryLoc) return handle("end"); + if (i.tryLoc <= this.prev) { + var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); + if (c && u) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } else if (c) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + } else { + if (!u) throw Error("try statement without catch or finally"); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } + } + } + }, + abrupt: function(t, e) { + for(var r = this.tryEntries.length - 1; r >= 0; --r){ + var o = this.tryEntries[r]; + if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { + var i = o; + break; + } + } + i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); + var a = i ? i.completion : {}; + return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); + }, + complete: function(t, e) { + if ("throw" === t.type) throw t.arg; + return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; + }, + finish: function(t) { + for(var e = this.tryEntries.length - 1; e >= 0; --e){ + var r = this.tryEntries[e]; + if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; + } + }, + catch: function(t) { + for(var e = this.tryEntries.length - 1; e >= 0; --e){ + var r = this.tryEntries[e]; + if (r.tryLoc === t) { + var n = r.completion; + if ("throw" === n.type) { + var o = n.arg; + resetTryEntry(r); + } + return o; + } + } + throw Error("illegal catch attempt"); + }, + delegateYield: function(e, r, n) { + return this.delegate = { + iterator: values(e), + resultName: r, + nextLoc: n + }, "next" === this.method && (this.arg = t), y; + } + }, e; +} +function asyncGeneratorStep(n, t, e, r, o, a, c) { + try { + var i = n[a](c), u = i.value; + } catch (n) { + return void e(n); + } + i.done ? t(u) : Promise.resolve(u).then(r, o); +} +function _asyncToGenerator(n) { + return function() { + var t = this, e = arguments; + return new Promise(function(r, o) { + var a = n.apply(t, e); + function _next(n) { + asyncGeneratorStep(a, r, o, _next, _throw, "next", n); + } + function _throw(n) { + asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); + } + _next(void 0); + }); + }; +} +function isEqual_isEqual(obj1, obj2) { + var shallow = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : false; + var refSet = new Set(); + function deepEqual(a, b) { + var level = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1; + var circular = refSet.has(a); + es_warning(!circular, 'Warning: There may be circular references'); + if (circular) return false; + if (a === b) return true; + if (shallow && level > 1) return false; + refSet.add(a); + var newLevel = level + 1; + if (Array.isArray(a)) { + if (!Array.isArray(b) || a.length !== b.length) return false; + for(var i = 0; i < a.length; i++)if (!deepEqual(a[i], b[i], newLevel)) return false; + return true; + } + if (a && b && 'object' === typeof_typeof(a) && 'object' === typeof_typeof(b)) { + var keys = Object.keys(a); + if (keys.length !== Object.keys(b).length) return false; + return keys.every(function(key) { + return deepEqual(a[key], b[key], newLevel); + }); + } + return false; + } + return deepEqual(obj1, obj2); +} +const es_isEqual = isEqual_isEqual; +var HOOK_MARK = 'RC_FORM_INTERNAL_HOOKS'; +var FieldContext_warningFunc = function() { + es_warning(false, 'Can not find FormContext. Please make sure you wrap Field under Form.'); +}; +var FieldContext_Context = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext({ + getFieldValue: FieldContext_warningFunc, + getFieldsValue: FieldContext_warningFunc, + getFieldError: FieldContext_warningFunc, + getFieldWarning: FieldContext_warningFunc, + getFieldsError: FieldContext_warningFunc, + isFieldsTouched: FieldContext_warningFunc, + isFieldTouched: FieldContext_warningFunc, + isFieldValidating: FieldContext_warningFunc, + isFieldsValidating: FieldContext_warningFunc, + resetFields: FieldContext_warningFunc, + setFields: FieldContext_warningFunc, + setFieldValue: FieldContext_warningFunc, + setFieldsValue: FieldContext_warningFunc, + validateFields: FieldContext_warningFunc, + submit: FieldContext_warningFunc, + getInternalHooks: function() { + FieldContext_warningFunc(); + return { + dispatch: FieldContext_warningFunc, + initEntityValue: FieldContext_warningFunc, + registerField: FieldContext_warningFunc, + useSubscribe: FieldContext_warningFunc, + setInitialValues: FieldContext_warningFunc, + destroyForm: FieldContext_warningFunc, + setCallbacks: FieldContext_warningFunc, + registerWatch: FieldContext_warningFunc, + getFields: FieldContext_warningFunc, + setValidateMessages: FieldContext_warningFunc, + setPreserve: FieldContext_warningFunc, + getInitialValue: FieldContext_warningFunc + }; + } +}); +const FieldContext = FieldContext_Context; +var ListContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext(null); +const es_ListContext = ListContext; +function typeUtil_toArray(value) { + if (null == value) return []; + return Array.isArray(value) ? value : [ + value + ]; +} +function isFormInstance(form) { + return form && !!form._init; +} +function newMessages() { + return { + default: 'Validation error on field %s', + required: '%s is required', + enum: '%s must be one of %s', + whitespace: '%s cannot be empty', + date: { + format: '%s date %s is invalid for format %s', + parse: '%s date could not be parsed, %s is invalid ', + invalid: '%s date %s is invalid' + }, + types: { + string: '%s is not a %s', + method: '%s is not a %s (function)', + array: '%s is not an %s', + object: '%s is not an %s', + number: '%s is not a %s', + date: '%s is not a %s', + boolean: '%s is not a %s', + integer: '%s is not an %s', + float: '%s is not a %s', + regexp: '%s is not a valid %s', + email: '%s is not a valid %s', + url: '%s is not a valid %s', + hex: '%s is not a valid %s' + }, + string: { + len: '%s must be exactly %s characters', + min: '%s must be at least %s characters', + max: '%s cannot be longer than %s characters', + range: '%s must be between %s and %s characters' + }, + number: { + len: '%s must equal %s', + min: '%s cannot be less than %s', + max: '%s cannot be greater than %s', + range: '%s must be between %s and %s' + }, + array: { + len: '%s must be exactly %s in length', + min: '%s cannot be less than %s in length', + max: '%s cannot be greater than %s in length', + range: '%s must be between %s and %s in length' + }, + pattern: { + mismatch: '%s value %s does not match pattern %s' + }, + clone: function() { + var cloned = JSON.parse(JSON.stringify(this)); + cloned.clone = this.clone; + return cloned; + } + }; +} +var messages_messages = newMessages(); +function _isNativeFunction(t) { + try { + return -1 !== Function.toString.call(t).indexOf("[native code]"); + } catch (n) { + return "function" == typeof t; + } +} +function _construct(t, e, r) { + if (isNativeReflectConstruct_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); + var o = [ + null + ]; + o.push.apply(o, e); + var p = new (t.bind.apply(t, o))(); + return r && _setPrototypeOf(p, r.prototype), p; +} +function wrapNativeSuper_wrapNativeSuper(t) { + var r = "function" == typeof Map ? new Map() : void 0; + return wrapNativeSuper_wrapNativeSuper = function(t) { + if (null === t || !_isNativeFunction(t)) return t; + if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); + if (void 0 !== r) { + if (r.has(t)) return r.get(t); + r.set(t, Wrapper); + } + function Wrapper() { + return _construct(t, arguments, _getPrototypeOf(this).constructor); + } + return Wrapper.prototype = Object.create(t.prototype, { + constructor: { + value: Wrapper, + enumerable: !1, + writable: !0, + configurable: !0 + } + }), _setPrototypeOf(Wrapper, t); + }, wrapNativeSuper_wrapNativeSuper(t); +} +var formatRegExp = /%[sdj%]/g; +var util_warning = function() {}; +if ('undefined' != typeof process && process.env && 'production' !== process.env.NODE_ENV && 'undefined' != typeof window && 'undefined' != typeof document) util_warning = function(type, errors) { + if ('undefined' != typeof console && console.warn && 'undefined' == typeof ASYNC_VALIDATOR_NO_WARNING) { + if (errors.every(function(e) { + return 'string' == typeof e; + })) console.warn(type, errors); + } +}; +function convertFieldsError(errors) { + if (!errors || !errors.length) return null; + var fields = {}; + errors.forEach(function(error) { + var field = error.field; + fields[field] = fields[field] || []; + fields[field].push(error); + }); + return fields; +} +function util_format(template) { + for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)args[_key - 1] = arguments[_key]; + var i = 0; + var len = args.length; + if ('function' == typeof template) return template.apply(null, args); + if ('string' == typeof template) { + var str = template.replace(formatRegExp, function(x) { + if ('%%' === x) return '%'; + if (i >= len) return x; + switch(x){ + case '%s': + return String(args[i++]); + case '%d': + return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; + } + }); + return str; + } + return template; +} +function isNativeStringType(type) { + return 'string' === type || 'url' === type || 'hex' === type || 'email' === type || 'date' === type || 'pattern' === type; +} +function isEmptyValue(value, type) { + if (null == value) return true; + if ('array' === type && Array.isArray(value) && !value.length) return true; + if (isNativeStringType(type) && 'string' == typeof value && !value) return true; + return false; +} +function asyncParallelArray(arr, func, callback) { + var results = []; + var total = 0; + var arrLength = arr.length; + function count(errors) { + results.push.apply(results, _toConsumableArray(errors || [])); + total++; + if (total === arrLength) callback(results); + } + arr.forEach(function(a) { + func(a, count); + }); +} +function asyncSerialArray(arr, func, callback) { + var index = 0; + var arrLength = arr.length; + function next(errors) { + if (errors && errors.length) return void callback(errors); + var original = index; + index += 1; + if (original < arrLength) func(arr[original], next); + else callback([]); + } + next([]); +} +function flattenObjArr(objArr) { + var ret = []; + Object.keys(objArr).forEach(function(k) { + ret.push.apply(ret, _toConsumableArray(objArr[k] || [])); + }); + return ret; +} +var util_AsyncValidationError = /*#__PURE__*/ function(_Error) { + inherits_inherits(AsyncValidationError, _Error); + var _super = createSuper_createSuper(AsyncValidationError); + function AsyncValidationError(errors, fields) { + var _this; + classCallCheck_classCallCheck(this, AsyncValidationError); + _this = _super.call(this, 'Async Validation Error'); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "errors", void 0); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "fields", void 0); + _this.errors = errors; + _this.fields = fields; + return _this; + } + return createClass_createClass(AsyncValidationError); +}(/*#__PURE__*/ wrapNativeSuper_wrapNativeSuper(Error)); +function asyncMap(objArr, option, func, callback, source) { + if (option.first) { + var _pending = new Promise(function(resolve, reject) { + var next = function(errors) { + callback(errors); + return errors.length ? reject(new util_AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source); + }; + var flattenArr = flattenObjArr(objArr); + asyncSerialArray(flattenArr, func, next); + }); + _pending.catch(function(e) { + return e; + }); + return _pending; + } + var firstFields = true === option.firstFields ? Object.keys(objArr) : option.firstFields || []; + var objArrKeys = Object.keys(objArr); + var objArrLength = objArrKeys.length; + var total = 0; + var results = []; + var pending = new Promise(function(resolve, reject) { + var next = function(errors) { + results.push.apply(results, errors); + total++; + if (total === objArrLength) { + callback(results); + return results.length ? reject(new util_AsyncValidationError(results, convertFieldsError(results))) : resolve(source); + } + }; + if (!objArrKeys.length) { + callback(results); + resolve(source); + } + objArrKeys.forEach(function(key) { + var arr = objArr[key]; + if (-1 !== firstFields.indexOf(key)) asyncSerialArray(arr, func, next); + else asyncParallelArray(arr, func, next); + }); + }); + pending.catch(function(e) { + return e; + }); + return pending; +} +function isErrorObj(obj) { + return !!(obj && void 0 !== obj.message); +} +function util_getValue(value, path) { + var v = value; + for(var i = 0; i < path.length; i++){ + if (void 0 == v) break; + v = v[path[i]]; + } + return v; +} +function complementError(rule, source) { + return function(oe) { + var fieldValue; + fieldValue = rule.fullFields ? util_getValue(source, rule.fullFields) : source[oe.field || rule.fullField]; + if (isErrorObj(oe)) { + oe.field = oe.field || rule.fullField; + oe.fieldValue = fieldValue; + return oe; + } + return { + message: 'function' == typeof oe ? oe() : oe, + fieldValue: fieldValue, + field: oe.field || rule.fullField + }; + }; +} +function deepMerge(target, source) { + if (source) { + for(var s in source)if (source.hasOwnProperty(s)) { + var value = source[s]; + if ('object' === typeof_typeof(value) && 'object' === typeof_typeof(target[s])) target[s] = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, target[s]), value); + else target[s] = value; + } + } + return target; +} +var ENUM = 'enum'; +var enum_enumerable = function(rule, value, source, errors, options) { + rule[ENUM] = Array.isArray(rule[ENUM]) ? rule[ENUM] : []; + if (-1 === rule[ENUM].indexOf(value)) errors.push(util_format(options.messages[ENUM], rule.fullField, rule[ENUM].join(', '))); +}; +const rule_enum = enum_enumerable; +var pattern_pattern = function(rule, value, source, errors, options) { + if (rule.pattern) { + if (rule.pattern instanceof RegExp) { + rule.pattern.lastIndex = 0; + if (!rule.pattern.test(value)) errors.push(util_format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern)); + } else if ('string' == typeof rule.pattern) { + var _pattern = new RegExp(rule.pattern); + if (!_pattern.test(value)) errors.push(util_format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern)); + } + } +}; +const rule_pattern = pattern_pattern; +var range_range = function(rule, value, source, errors, options) { + var len = 'number' == typeof rule.len; + var min = 'number' == typeof rule.min; + var max = 'number' == typeof rule.max; + var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; + var val = value; + var key = null; + var num = 'number' == typeof value; + var str = 'string' == typeof value; + var arr = Array.isArray(value); + if (num) key = 'number'; + else if (str) key = 'string'; + else if (arr) key = 'array'; + if (!key) return false; + if (arr) val = value.length; + if (str) val = value.replace(spRegexp, '_').length; + if (len) { + if (val !== rule.len) errors.push(util_format(options.messages[key].len, rule.fullField, rule.len)); + } else if (min && !max && val < rule.min) errors.push(util_format(options.messages[key].min, rule.fullField, rule.min)); + else if (max && !min && val > rule.max) errors.push(util_format(options.messages[key].max, rule.fullField, rule.max)); + else if (min && max && (val < rule.min || val > rule.max)) errors.push(util_format(options.messages[key].range, rule.fullField, rule.min, rule.max)); +}; +const rule_range = range_range; +var required_required = function(rule, value, source, errors, options, type) { + if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type || rule.type))) errors.push(util_format(options.messages.required, rule.fullField)); +}; +const rule_required = required_required; +var urlReg; +const rule_url = function() { + if (urlReg) return urlReg; + var word = '[a-fA-F\\d:]'; + var b = function(options) { + return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=".concat(word, ")|(?<=").concat(word, ")(?=\\s|$))") : ''; + }; + var v4 = '(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}'; + var v6seg = '[a-fA-F\\d]{1,4}'; + var v6List = [ + "(?:".concat(v6seg, ":){7}(?:").concat(v6seg, "|:)"), + "(?:".concat(v6seg, ":){6}(?:").concat(v4, "|:").concat(v6seg, "|:)"), + "(?:".concat(v6seg, ":){5}(?::").concat(v4, "|(?::").concat(v6seg, "){1,2}|:)"), + "(?:".concat(v6seg, ":){4}(?:(?::").concat(v6seg, "){0,1}:").concat(v4, "|(?::").concat(v6seg, "){1,3}|:)"), + "(?:".concat(v6seg, ":){3}(?:(?::").concat(v6seg, "){0,2}:").concat(v4, "|(?::").concat(v6seg, "){1,4}|:)"), + "(?:".concat(v6seg, ":){2}(?:(?::").concat(v6seg, "){0,3}:").concat(v4, "|(?::").concat(v6seg, "){1,5}|:)"), + "(?:".concat(v6seg, ":){1}(?:(?::").concat(v6seg, "){0,4}:").concat(v4, "|(?::").concat(v6seg, "){1,6}|:)"), + "(?::(?:(?::".concat(v6seg, "){0,5}:").concat(v4, "|(?::").concat(v6seg, "){1,7}|:))") + ]; + var v6Eth0 = "(?:%[0-9a-zA-Z]{1,})?"; + var v6 = "(?:".concat(v6List.join('|'), ")").concat(v6Eth0); + var v46Exact = new RegExp("(?:^".concat(v4, "$)|(?:^").concat(v6, "$)")); + var v4exact = new RegExp("^".concat(v4, "$")); + var v6exact = new RegExp("^".concat(v6, "$")); + var ip = function(options) { + return options && options.exact ? v46Exact : new RegExp("(?:".concat(b(options)).concat(v4).concat(b(options), ")|(?:").concat(b(options)).concat(v6).concat(b(options), ")"), 'g'); + }; + ip.v4 = function(options) { + return options && options.exact ? v4exact : new RegExp("".concat(b(options)).concat(v4).concat(b(options)), 'g'); + }; + ip.v6 = function(options) { + return options && options.exact ? v6exact : new RegExp("".concat(b(options)).concat(v6).concat(b(options)), 'g'); + }; + var protocol = "(?:(?:[a-z]+:)?//)"; + var auth = '(?:\\S+(?::\\S*)?@)?'; + var ipv4 = ip.v4().source; + var ipv6 = ip.v6().source; + var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)"; + var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*"; + var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))"; + var port = '(?::\\d{2,5})?'; + var path = '(?:[/?#][^\\s"]*)?'; + var regex = "(?:".concat(protocol, "|www\\.)").concat(auth, "(?:localhost|").concat(ipv4, "|").concat(ipv6, "|").concat(host).concat(domain).concat(tld, ")").concat(port).concat(path); + urlReg = new RegExp("(?:^".concat(regex, "$)"), 'i'); + return urlReg; +}; +var type_pattern = { + email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/, + hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i +}; +var type_types = { + integer: function(value) { + return type_types.number(value) && parseInt(value, 10) === value; + }, + float: function(value) { + return type_types.number(value) && !type_types.integer(value); + }, + array: function(value) { + return Array.isArray(value); + }, + regexp: function(value) { + if (value instanceof RegExp) return true; + try { + return new RegExp(value), true; + } catch (e) { + return false; + } + }, + date: function(value) { + return 'function' == typeof value.getTime && 'function' == typeof value.getMonth && 'function' == typeof value.getYear && !isNaN(value.getTime()); + }, + number: function(value) { + if (isNaN(value)) return false; + return 'number' == typeof value; + }, + object: function(value) { + return 'object' === typeof_typeof(value) && !type_types.array(value); + }, + method: function(value) { + return 'function' == typeof value; + }, + email: function(value) { + return 'string' == typeof value && value.length <= 320 && !!value.match(type_pattern.email); + }, + url: function(value) { + return 'string' == typeof value && value.length <= 2048 && !!value.match(rule_url()); + }, + hex: function(value) { + return 'string' == typeof value && !!value.match(type_pattern.hex); + } +}; +var type_type = function(rule, value, source, errors, options) { + if (rule.required && void 0 === value) return void rule_required(rule, value, source, errors, options); + var custom = [ + 'integer', + 'float', + 'array', + 'regexp', + 'object', + 'method', + 'email', + 'number', + 'date', + 'url', + 'hex' + ]; + var ruleType = rule.type; + if (custom.indexOf(ruleType) > -1) { + if (!type_types[ruleType](value)) errors.push(util_format(options.messages.types[ruleType], rule.fullField, rule.type)); + } else if (ruleType && typeof_typeof(value) !== rule.type) errors.push(util_format(options.messages.types[ruleType], rule.fullField, rule.type)); +}; +const rule_type = type_type; +var whitespace_whitespace = function(rule, value, source, errors, options) { + if (/^\s+$/.test(value) || '' === value) errors.push(util_format(options.messages.whitespace, rule.fullField)); +}; +const rule_whitespace = whitespace_whitespace; +const es_rule = { + required: rule_required, + whitespace: rule_whitespace, + type: rule_type, + range: rule_range, + enum: rule_enum, + pattern: rule_pattern +}; +var any_any = function(rule, value, callback, source, options) { + var errors = []; + var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); + if (validate) { + if (isEmptyValue(value) && !rule.required) return callback(); + es_rule.required(rule, value, source, errors, options); + } + callback(errors); +}; +const validator_any = any_any; +var array_array = function(rule, value, callback, source, options) { + var errors = []; + var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); + if (validate) { + if (null == value && !rule.required) return callback(); + es_rule.required(rule, value, source, errors, options, 'array'); + if (null != value) { + es_rule.type(rule, value, source, errors, options); + es_rule.range(rule, value, source, errors, options); + } + } + callback(errors); +}; +const validator_array = array_array; +var boolean_boolean = function(rule, value, callback, source, options) { + var errors = []; + var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); + if (validate) { + if (isEmptyValue(value) && !rule.required) return callback(); + es_rule.required(rule, value, source, errors, options); + if (void 0 !== value) es_rule.type(rule, value, source, errors, options); + } + callback(errors); +}; +const validator_boolean = boolean_boolean; +var date_date = function(rule, value, callback, source, options) { + var errors = []; + var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); + if (validate) { + if (isEmptyValue(value, 'date') && !rule.required) return callback(); + es_rule.required(rule, value, source, errors, options); + if (!isEmptyValue(value, 'date')) { + var dateObject; + dateObject = value instanceof Date ? value : new Date(value); + es_rule.type(rule, dateObject, source, errors, options); + if (dateObject) es_rule.range(rule, dateObject.getTime(), source, errors, options); + } + } + callback(errors); +}; +const validator_date = date_date; +var enum_ENUM = 'enum'; +var validator_enum_enumerable = function(rule, value, callback, source, options) { + var errors = []; + var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); + if (validate) { + if (isEmptyValue(value) && !rule.required) return callback(); + es_rule.required(rule, value, source, errors, options); + if (void 0 !== value) es_rule[enum_ENUM](rule, value, source, errors, options); + } + callback(errors); +}; +const validator_enum = validator_enum_enumerable; +var float_floatFn = function(rule, value, callback, source, options) { + var errors = []; + var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); + if (validate) { + if (isEmptyValue(value) && !rule.required) return callback(); + es_rule.required(rule, value, source, errors, options); + if (void 0 !== value) { + es_rule.type(rule, value, source, errors, options); + es_rule.range(rule, value, source, errors, options); + } + } + callback(errors); +}; +const validator_float = float_floatFn; +var integer_integer = function(rule, value, callback, source, options) { + var errors = []; + var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); + if (validate) { + if (isEmptyValue(value) && !rule.required) return callback(); + es_rule.required(rule, value, source, errors, options); + if (void 0 !== value) { + es_rule.type(rule, value, source, errors, options); + es_rule.range(rule, value, source, errors, options); + } + } + callback(errors); +}; +const validator_integer = integer_integer; +var method_method = function(rule, value, callback, source, options) { + var errors = []; + var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); + if (validate) { + if (isEmptyValue(value) && !rule.required) return callback(); + es_rule.required(rule, value, source, errors, options); + if (void 0 !== value) es_rule.type(rule, value, source, errors, options); + } + callback(errors); +}; +const validator_method = method_method; +var number_number = function(rule, value, callback, source, options) { + var errors = []; + var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); + if (validate) { + if ('' === value) value = void 0; + if (isEmptyValue(value) && !rule.required) return callback(); + es_rule.required(rule, value, source, errors, options); + if (void 0 !== value) { + es_rule.type(rule, value, source, errors, options); + es_rule.range(rule, value, source, errors, options); + } + } + callback(errors); +}; +const validator_number = number_number; +var object_object = function(rule, value, callback, source, options) { + var errors = []; + var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); + if (validate) { + if (isEmptyValue(value) && !rule.required) return callback(); + es_rule.required(rule, value, source, errors, options); + if (void 0 !== value) es_rule.type(rule, value, source, errors, options); + } + callback(errors); +}; +const validator_object = object_object; +var validator_pattern_pattern = function(rule, value, callback, source, options) { + var errors = []; + var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); + if (validate) { + if (isEmptyValue(value, 'string') && !rule.required) return callback(); + es_rule.required(rule, value, source, errors, options); + if (!isEmptyValue(value, 'string')) es_rule.pattern(rule, value, source, errors, options); + } + callback(errors); +}; +const validator_pattern = validator_pattern_pattern; +var regexp_regexp = function(rule, value, callback, source, options) { + var errors = []; + var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); + if (validate) { + if (isEmptyValue(value) && !rule.required) return callback(); + es_rule.required(rule, value, source, errors, options); + if (!isEmptyValue(value)) es_rule.type(rule, value, source, errors, options); + } + callback(errors); +}; +const validator_regexp = regexp_regexp; +var validator_required_required = function(rule, value, callback, source, options) { + var errors = []; + var type = Array.isArray(value) ? 'array' : typeof_typeof(value); + es_rule.required(rule, value, source, errors, options, type); + callback(errors); +}; +const validator_required = validator_required_required; +var string_string = function(rule, value, callback, source, options) { + var errors = []; + var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); + if (validate) { + if (isEmptyValue(value, 'string') && !rule.required) return callback(); + es_rule.required(rule, value, source, errors, options, 'string'); + if (!isEmptyValue(value, 'string')) { + es_rule.type(rule, value, source, errors, options); + es_rule.range(rule, value, source, errors, options); + es_rule.pattern(rule, value, source, errors, options); + if (true === rule.whitespace) es_rule.whitespace(rule, value, source, errors, options); + } + } + callback(errors); +}; +const validator_string = string_string; +var validator_type_type = function(rule, value, callback, source, options) { + var ruleType = rule.type; + var errors = []; + var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); + if (validate) { + if (isEmptyValue(value, ruleType) && !rule.required) return callback(); + es_rule.required(rule, value, source, errors, options, ruleType); + if (!isEmptyValue(value, ruleType)) es_rule.type(rule, value, source, errors, options); + } + callback(errors); +}; +const validator_type = validator_type_type; +const es_validator = { + string: validator_string, + method: validator_method, + number: validator_number, + boolean: validator_boolean, + regexp: validator_regexp, + integer: validator_integer, + float: validator_float, + array: validator_array, + object: validator_object, + enum: validator_enum, + pattern: validator_pattern, + date: validator_date, + url: validator_type, + hex: validator_type, + email: validator_type, + required: validator_required, + any: validator_any +}; +var es_Schema = /*#__PURE__*/ function() { + function Schema(descriptor) { + classCallCheck_classCallCheck(this, Schema); + defineProperty_defineProperty(this, "rules", null); + defineProperty_defineProperty(this, "_messages", messages_messages); + this.define(descriptor); + } + createClass_createClass(Schema, [ + { + key: "define", + value: function(rules) { + var _this = this; + if (!rules) throw new Error('Cannot configure a schema with no rules'); + if ('object' !== typeof_typeof(rules) || Array.isArray(rules)) throw new Error('Rules must be an object'); + this.rules = {}; + Object.keys(rules).forEach(function(name) { + var item = rules[name]; + _this.rules[name] = Array.isArray(item) ? item : [ + item + ]; + }); + } + }, + { + key: "messages", + value: function(_messages) { + if (_messages) this._messages = deepMerge(newMessages(), _messages); + return this._messages; + } + }, + { + key: "validate", + value: function(source_) { + var _this2 = this; + var o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + var oc = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : function() {}; + var source = source_; + var options = o; + var callback = oc; + if ('function' == typeof options) { + callback = options; + options = {}; + } + if (!this.rules || 0 === Object.keys(this.rules).length) { + if (callback) callback(null, source); + return Promise.resolve(source); + } + function complete(results) { + var errors = []; + var fields = {}; + function add(e) { + if (Array.isArray(e)) { + var _errors; + errors = (_errors = errors).concat.apply(_errors, _toConsumableArray(e)); + } else errors.push(e); + } + for(var i = 0; i < results.length; i++)add(results[i]); + if (errors.length) { + fields = convertFieldsError(errors); + callback(errors, fields); + } else callback(null, source); + } + if (options.messages) { + var messages = this.messages(); + if (messages === messages_messages) messages = newMessages(); + deepMerge(messages, options.messages); + options.messages = messages; + } else options.messages = this.messages(); + var series = {}; + var keys = options.keys || Object.keys(this.rules); + keys.forEach(function(z) { + var arr = _this2.rules[z]; + var value = source[z]; + arr.forEach(function(r) { + var rule = r; + if ('function' == typeof rule.transform) { + if (source === source_) source = objectSpread2_objectSpread2({}, source); + value = source[z] = rule.transform(value); + if (null != value) rule.type = rule.type || (Array.isArray(value) ? 'array' : typeof_typeof(value)); + } + rule = 'function' == typeof rule ? { + validator: rule + } : objectSpread2_objectSpread2({}, rule); + rule.validator = _this2.getValidationMethod(rule); + if (!rule.validator) return; + rule.field = z; + rule.fullField = rule.fullField || z; + rule.type = _this2.getType(rule); + series[z] = series[z] || []; + series[z].push({ + rule: rule, + value: value, + source: source, + field: z + }); + }); + }); + var errorFields = {}; + return asyncMap(series, options, function(data, doIt) { + var rule = data.rule; + var deep = ('object' === rule.type || 'array' === rule.type) && ('object' === typeof_typeof(rule.fields) || 'object' === typeof_typeof(rule.defaultField)); + deep = deep && (rule.required || !rule.required && data.value); + rule.field = data.field; + function addFullField(key, schema) { + return objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, schema), {}, { + fullField: "".concat(rule.fullField, ".").concat(key), + fullFields: rule.fullFields ? [].concat(_toConsumableArray(rule.fullFields), [ + key + ]) : [ + key + ] + }); + } + function cb() { + var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + var errorList = Array.isArray(e) ? e : [ + e + ]; + if (!options.suppressWarning && errorList.length) Schema.warning('async-validator:', errorList); + if (errorList.length && void 0 !== rule.message) errorList = [].concat(rule.message); + var filledErrors = errorList.map(complementError(rule, source)); + if (options.first && filledErrors.length) { + errorFields[rule.field] = 1; + return doIt(filledErrors); + } + if (deep) { + if (rule.required && !data.value) { + if (void 0 !== rule.message) filledErrors = [].concat(rule.message).map(complementError(rule, source)); + else if (options.error) filledErrors = [ + options.error(rule, util_format(options.messages.required, rule.field)) + ]; + return doIt(filledErrors); + } + var fieldsSchema = {}; + if (rule.defaultField) Object.keys(data.value).map(function(key) { + fieldsSchema[key] = rule.defaultField; + }); + fieldsSchema = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, fieldsSchema), data.rule.fields); + var paredFieldsSchema = {}; + Object.keys(fieldsSchema).forEach(function(field) { + var fieldSchema = fieldsSchema[field]; + var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [ + fieldSchema + ]; + paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field)); + }); + var schema = new Schema(paredFieldsSchema); + schema.messages(options.messages); + if (data.rule.options) { + data.rule.options.messages = options.messages; + data.rule.options.error = options.error; + } + schema.validate(data.value, data.rule.options || options, function(errs) { + var finalErrors = []; + if (filledErrors && filledErrors.length) finalErrors.push.apply(finalErrors, _toConsumableArray(filledErrors)); + if (errs && errs.length) finalErrors.push.apply(finalErrors, _toConsumableArray(errs)); + doIt(finalErrors.length ? finalErrors : null); + }); + } else doIt(filledErrors); + } + var res; + if (rule.asyncValidator) res = rule.asyncValidator(rule, data.value, cb, data.source, options); + else if (rule.validator) { + try { + res = rule.validator(rule, data.value, cb, data.source, options); + } catch (error) { + var _console$error, _console; + null == (_console$error = (_console = console).error) || _console$error.call(_console, error); + if (!options.suppressValidatorError) setTimeout(function() { + throw error; + }, 0); + cb(error.message); + } + if (true === res) cb(); + else if (false === res) cb('function' == typeof rule.message ? rule.message(rule.fullField || rule.field) : rule.message || "".concat(rule.fullField || rule.field, " fails")); + else if (res instanceof Array) cb(res); + else if (res instanceof Error) cb(res.message); + } + if (res && res.then) res.then(function() { + return cb(); + }, function(e) { + return cb(e); + }); + }, function(results) { + complete(results); + }, source); + } + }, + { + key: "getType", + value: function(rule) { + if (void 0 === rule.type && rule.pattern instanceof RegExp) rule.type = 'pattern'; + if ('function' != typeof rule.validator && rule.type && !es_validator.hasOwnProperty(rule.type)) throw new Error(util_format('Unknown rule type %s', rule.type)); + return rule.type || 'string'; + } + }, + { + key: "getValidationMethod", + value: function(rule) { + if ('function' == typeof rule.validator) return rule.validator; + var keys = Object.keys(rule); + var messageIndex = keys.indexOf('message'); + if (-1 !== messageIndex) keys.splice(messageIndex, 1); + if (1 === keys.length && 'required' === keys[0]) return es_validator.required; + return es_validator[this.getType(rule)] || void 0; + } + } + ]); + return Schema; +}(); +defineProperty_defineProperty(es_Schema, "register", function(type, validator) { + if ('function' != typeof validator) throw new Error('Cannot register a validator by type, validator is not a function'); + es_validator[type] = validator; +}); +defineProperty_defineProperty(es_Schema, "warning", util_warning); +defineProperty_defineProperty(es_Schema, "messages", messages_messages); +defineProperty_defineProperty(es_Schema, "validators", es_validator); +const async_validator_es = es_Schema; +var typeTemplate = "'${name}' is not a valid ${type}"; +var defaultValidateMessages = { + default: "Validation error on field '${name}'", + required: "'${name}' is required", + enum: "'${name}' must be one of [${enum}]", + whitespace: "'${name}' cannot be empty", + date: { + format: "'${name}' is invalid for format date", + parse: "'${name}' could not be parsed as date", + invalid: "'${name}' is invalid date" + }, + types: { + string: typeTemplate, + method: typeTemplate, + array: typeTemplate, + object: typeTemplate, + number: typeTemplate, + date: typeTemplate, + boolean: typeTemplate, + integer: typeTemplate, + float: typeTemplate, + regexp: typeTemplate, + email: typeTemplate, + url: typeTemplate, + hex: typeTemplate + }, + string: { + len: "'${name}' must be exactly ${len} characters", + min: "'${name}' must be at least ${min} characters", + max: "'${name}' cannot be longer than ${max} characters", + range: "'${name}' must be between ${min} and ${max} characters" + }, + number: { + len: "'${name}' must equal ${len}", + min: "'${name}' cannot be less than ${min}", + max: "'${name}' cannot be greater than ${max}", + range: "'${name}' must be between ${min} and ${max}" + }, + array: { + len: "'${name}' must be exactly ${len} in length", + min: "'${name}' cannot be less than ${min} in length", + max: "'${name}' cannot be greater than ${max} in length", + range: "'${name}' must be between ${min} and ${max} in length" + }, + pattern: { + mismatch: "'${name}' does not match pattern ${pattern}" + } +}; +var AsyncValidator = async_validator_es; +function replaceMessage(template, kv) { + return template.replace(/\\?\$\{\w+\}/g, function(str) { + if (str.startsWith('\\')) return str.slice(1); + var key = str.slice(2, -1); + return kv[key]; + }); +} +var CODE_LOGIC_ERROR = 'CODE_LOGIC_ERROR'; +function validateRule(_x, _x2, _x3, _x4, _x5) { + return _validateRule.apply(this, arguments); +} +function _validateRule() { + _validateRule = _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime_regeneratorRuntime().mark(function _callee2(name, value, rule, options, messageVariables) { + var cloneRule, originValidator, subRuleField, validator, messages, result, subResults, kv, fillVariableResult; + return regeneratorRuntime_regeneratorRuntime().wrap(function(_context2) { + while(1)switch(_context2.prev = _context2.next){ + case 0: + cloneRule = objectSpread2_objectSpread2({}, rule); + delete cloneRule.ruleIndex; + AsyncValidator.warning = function() {}; + if (cloneRule.validator) { + originValidator = cloneRule.validator; + cloneRule.validator = function() { + try { + return originValidator.apply(void 0, arguments); + } catch (error) { + console.error(error); + return Promise.reject(CODE_LOGIC_ERROR); + } + }; + } + subRuleField = null; + if (cloneRule && 'array' === cloneRule.type && cloneRule.defaultField) { + subRuleField = cloneRule.defaultField; + delete cloneRule.defaultField; + } + validator = new AsyncValidator(defineProperty_defineProperty({}, name, [ + cloneRule + ])); + messages = merge(defaultValidateMessages, options.validateMessages); + validator.messages(messages); + result = []; + _context2.prev = 10; + _context2.next = 13; + return Promise.resolve(validator.validate(defineProperty_defineProperty({}, name, value), objectSpread2_objectSpread2({}, options))); + case 13: + _context2.next = 18; + break; + case 15: + _context2.prev = 15; + _context2.t0 = _context2["catch"](10); + if (_context2.t0.errors) result = _context2.t0.errors.map(function(_ref4, index) { + var message = _ref4.message; + var mergedMessage = message === CODE_LOGIC_ERROR ? messages.default : message; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.isValidElement(mergedMessage) ? /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.cloneElement(mergedMessage, { + key: "error_".concat(index) + }) : mergedMessage; + }); + case 18: + if (!(!result.length && subRuleField)) { + _context2.next = 23; + break; + } + _context2.next = 21; + return Promise.all(value.map(function(subValue, i) { + return validateRule("".concat(name, ".").concat(i), subValue, subRuleField, options, messageVariables); + })); + case 21: + subResults = _context2.sent; + return _context2.abrupt("return", subResults.reduce(function(prev, errors) { + return [].concat(_toConsumableArray(prev), _toConsumableArray(errors)); + }, [])); + case 23: + kv = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, rule), {}, { + name: name, + enum: (rule.enum || []).join(', ') + }, messageVariables); + fillVariableResult = result.map(function(error) { + if ('string' == typeof error) return replaceMessage(error, kv); + return error; + }); + return _context2.abrupt("return", fillVariableResult); + case 26: + case "end": + return _context2.stop(); + } + }, _callee2, null, [ + [ + 10, + 15 + ] + ]); + })); + return _validateRule.apply(this, arguments); +} +function validateRules(namePath, value, rules, options, validateFirst, messageVariables) { + var name = namePath.join('.'); + var filledRules = rules.map(function(currentRule, ruleIndex) { + var originValidatorFunc = currentRule.validator; + var cloneRule = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, currentRule), {}, { + ruleIndex: ruleIndex + }); + if (originValidatorFunc) cloneRule.validator = function(rule, val, callback) { + var hasPromise = false; + var wrappedCallback = function() { + for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + Promise.resolve().then(function() { + es_warning(!hasPromise, 'Your validator function has already return a promise. `callback` will be ignored.'); + if (!hasPromise) callback.apply(void 0, args); + }); + }; + var promise = originValidatorFunc(rule, val, wrappedCallback); + hasPromise = promise && 'function' == typeof promise.then && 'function' == typeof promise.catch; + es_warning(hasPromise, '`callback` is deprecated. Please return a promise instead.'); + if (hasPromise) promise.then(function() { + callback(); + }).catch(function(err) { + callback(err || ' '); + }); + }; + return cloneRule; + }).sort(function(_ref, _ref2) { + var w1 = _ref.warningOnly, i1 = _ref.ruleIndex; + var w2 = _ref2.warningOnly, i2 = _ref2.ruleIndex; + if (!!w1 === !!w2) return i1 - i2; + if (w1) return 1; + return -1; + }); + var summaryPromise; + if (true === validateFirst) summaryPromise = new Promise(/*#__PURE__*/ function() { + var _ref3 = _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime_regeneratorRuntime().mark(function _callee(resolve, reject) { + var i, rule, errors; + return regeneratorRuntime_regeneratorRuntime().wrap(function(_context) { + while(1)switch(_context.prev = _context.next){ + case 0: + i = 0; + case 1: + if (!(i < filledRules.length)) { + _context.next = 12; + break; + } + rule = filledRules[i]; + _context.next = 5; + return validateRule(name, value, rule, options, messageVariables); + case 5: + errors = _context.sent; + if (!errors.length) { + _context.next = 9; + break; + } + reject([ + { + errors: errors, + rule: rule + } + ]); + return _context.abrupt("return"); + case 9: + i += 1; + _context.next = 1; + break; + case 12: + resolve([]); + case 13: + case "end": + return _context.stop(); + } + }, _callee); + })); + return function(_x6, _x7) { + return _ref3.apply(this, arguments); + }; + }()); + else { + var rulePromises = filledRules.map(function(rule) { + return validateRule(name, value, rule, options, messageVariables).then(function(errors) { + return { + errors: errors, + rule: rule + }; + }); + }); + summaryPromise = (validateFirst ? finishOnFirstFailed(rulePromises) : finishOnAllFailed(rulePromises)).then(function(errors) { + return Promise.reject(errors); + }); + } + summaryPromise.catch(function(e) { + return e; + }); + return summaryPromise; +} +function finishOnAllFailed(_x8) { + return _finishOnAllFailed.apply(this, arguments); +} +function _finishOnAllFailed() { + _finishOnAllFailed = _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime_regeneratorRuntime().mark(function _callee3(rulePromises) { + return regeneratorRuntime_regeneratorRuntime().wrap(function(_context3) { + while(1)switch(_context3.prev = _context3.next){ + case 0: + return _context3.abrupt("return", Promise.all(rulePromises).then(function(errorsList) { + var _ref5; + var errors = (_ref5 = []).concat.apply(_ref5, _toConsumableArray(errorsList)); + return errors; + })); + case 1: + case "end": + return _context3.stop(); + } + }, _callee3); + })); + return _finishOnAllFailed.apply(this, arguments); +} +function finishOnFirstFailed(_x9) { + return _finishOnFirstFailed.apply(this, arguments); +} +function _finishOnFirstFailed() { + _finishOnFirstFailed = _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime_regeneratorRuntime().mark(function _callee4(rulePromises) { + var count; + return regeneratorRuntime_regeneratorRuntime().wrap(function(_context4) { + while(1)switch(_context4.prev = _context4.next){ + case 0: + count = 0; + return _context4.abrupt("return", new Promise(function(resolve) { + rulePromises.forEach(function(promise) { + promise.then(function(ruleError) { + if (ruleError.errors.length) resolve([ + ruleError + ]); + count += 1; + if (count === rulePromises.length) resolve([]); + }); + }); + })); + case 2: + case "end": + return _context4.stop(); + } + }, _callee4); + })); + return _finishOnFirstFailed.apply(this, arguments); +} +function getNamePath(path) { + return typeUtil_toArray(path); +} +function cloneByNamePathList(store, namePathList) { + var newStore = {}; + namePathList.forEach(function(namePath) { + var value = get_get(store, namePath); + newStore = set_set(newStore, namePath, value); + }); + return newStore; +} +function containsNamePath(namePathList, namePath) { + var partialMatch = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : false; + return namePathList && namePathList.some(function(path) { + return matchNamePath(namePath, path, partialMatch); + }); +} +function matchNamePath(namePath, subNamePath) { + var partialMatch = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : false; + if (!namePath || !subNamePath) return false; + if (!partialMatch && namePath.length !== subNamePath.length) return false; + return subNamePath.every(function(nameUnit, i) { + return namePath[i] === nameUnit; + }); +} +function isSimilar(source, target) { + if (source === target) return true; + if (!source && target || source && !target) return false; + if (!source || !target || 'object' !== typeof_typeof(source) || 'object' !== typeof_typeof(target)) return false; + var sourceKeys = Object.keys(source); + var targetKeys = Object.keys(target); + var keys = new Set([].concat(sourceKeys, targetKeys)); + return _toConsumableArray(keys).every(function(key) { + var sourceValue = source[key]; + var targetValue = target[key]; + if ('function' == typeof sourceValue && 'function' == typeof targetValue) return true; + return sourceValue === targetValue; + }); +} +function defaultGetValueFromEvent(valuePropName) { + var event = arguments.length <= 1 ? void 0 : arguments[1]; + if (event && event.target && 'object' === typeof_typeof(event.target) && valuePropName in event.target) return event.target[valuePropName]; + return event; +} +function valueUtil_move(array, moveIndex, toIndex) { + var length = array.length; + if (moveIndex < 0 || moveIndex >= length || toIndex < 0 || toIndex >= length) return array; + var item = array[moveIndex]; + var diff = moveIndex - toIndex; + if (diff > 0) return [].concat(_toConsumableArray(array.slice(0, toIndex)), [ + item + ], _toConsumableArray(array.slice(toIndex, moveIndex)), _toConsumableArray(array.slice(moveIndex + 1, length))); + if (diff < 0) return [].concat(_toConsumableArray(array.slice(0, moveIndex)), _toConsumableArray(array.slice(moveIndex + 1, toIndex + 1)), [ + item + ], _toConsumableArray(array.slice(toIndex + 1, length))); + return array; +} +var Field_excluded = [ + "name" +]; +var EMPTY_ERRORS = []; +function requireUpdate(shouldUpdate, prev, next, prevValue, nextValue, info) { + if ('function' == typeof shouldUpdate) return shouldUpdate(prev, next, 'source' in info ? { + source: info.source + } : {}); + return prevValue !== nextValue; +} +var Field_Field = /*#__PURE__*/ function(_React$Component) { + inherits_inherits(Field, _React$Component); + var _super = createSuper_createSuper(Field); + function Field(props) { + var _this; + classCallCheck_classCallCheck(this, Field); + _this = _super.call(this, props); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "state", { + resetCount: 0 + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "cancelRegisterFunc", null); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "mounted", false); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "touched", false); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "dirty", false); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "validatePromise", void 0); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "prevValidating", void 0); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "errors", EMPTY_ERRORS); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "warnings", EMPTY_ERRORS); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "cancelRegister", function() { + var _this$props = _this.props, preserve = _this$props.preserve, isListField = _this$props.isListField, name = _this$props.name; + if (_this.cancelRegisterFunc) _this.cancelRegisterFunc(isListField, preserve, getNamePath(name)); + _this.cancelRegisterFunc = null; + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "getNamePath", function() { + var _this$props2 = _this.props, name = _this$props2.name, fieldContext = _this$props2.fieldContext; + var _fieldContext$prefixN = fieldContext.prefixName, prefixName = void 0 === _fieldContext$prefixN ? [] : _fieldContext$prefixN; + return void 0 !== name ? [].concat(_toConsumableArray(prefixName), _toConsumableArray(name)) : []; + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "getRules", function() { + var _this$props3 = _this.props, _this$props3$rules = _this$props3.rules, rules = void 0 === _this$props3$rules ? [] : _this$props3$rules, fieldContext = _this$props3.fieldContext; + return rules.map(function(rule) { + if ('function' == typeof rule) return rule(fieldContext); + return rule; + }); + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "refresh", function() { + if (!_this.mounted) return; + _this.setState(function(_ref) { + var resetCount = _ref.resetCount; + return { + resetCount: resetCount + 1 + }; + }); + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "metaCache", null); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "triggerMetaEvent", function(destroy) { + var onMetaChange = _this.props.onMetaChange; + if (onMetaChange) { + var _meta = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, _this.getMeta()), {}, { + destroy: destroy + }); + if (!es_isEqual(_this.metaCache, _meta)) onMetaChange(_meta); + _this.metaCache = _meta; + } else _this.metaCache = null; + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "onStoreChange", function(prevStore, namePathList, info) { + var _this$props4 = _this.props, shouldUpdate = _this$props4.shouldUpdate, _this$props4$dependen = _this$props4.dependencies, dependencies = void 0 === _this$props4$dependen ? [] : _this$props4$dependen, onReset = _this$props4.onReset; + var store = info.store; + var namePath = _this.getNamePath(); + var prevValue = _this.getValue(prevStore); + var curValue = _this.getValue(store); + var namePathMatch = namePathList && containsNamePath(namePathList, namePath); + if ('valueUpdate' === info.type && 'external' === info.source && !es_isEqual(prevValue, curValue)) { + _this.touched = true; + _this.dirty = true; + _this.validatePromise = null; + _this.errors = EMPTY_ERRORS; + _this.warnings = EMPTY_ERRORS; + _this.triggerMetaEvent(); + } + switch(info.type){ + case 'reset': + if (!namePathList || namePathMatch) { + _this.touched = false; + _this.dirty = false; + _this.validatePromise = void 0; + _this.errors = EMPTY_ERRORS; + _this.warnings = EMPTY_ERRORS; + _this.triggerMetaEvent(); + null == onReset || onReset(); + _this.refresh(); + return; + } + break; + case 'remove': + if (shouldUpdate && requireUpdate(shouldUpdate, prevStore, store, prevValue, curValue, info)) return void _this.reRender(); + break; + case 'setField': + var data = info.data; + if (namePathMatch) { + if ('touched' in data) _this.touched = data.touched; + if ('validating' in data && !('originRCField' in data)) _this.validatePromise = data.validating ? Promise.resolve([]) : null; + if ('errors' in data) _this.errors = data.errors || EMPTY_ERRORS; + if ('warnings' in data) _this.warnings = data.warnings || EMPTY_ERRORS; + _this.dirty = true; + _this.triggerMetaEvent(); + _this.reRender(); + return; + } + if ('value' in data && containsNamePath(namePathList, namePath, true)) return void _this.reRender(); + if (shouldUpdate && !namePath.length && requireUpdate(shouldUpdate, prevStore, store, prevValue, curValue, info)) return void _this.reRender(); + break; + case 'dependenciesUpdate': + var dependencyList = dependencies.map(getNamePath); + if (dependencyList.some(function(dependency) { + return containsNamePath(info.relatedFields, dependency); + })) return void _this.reRender(); + break; + default: + if (namePathMatch || (!dependencies.length || namePath.length || shouldUpdate) && requireUpdate(shouldUpdate, prevStore, store, prevValue, curValue, info)) return void _this.reRender(); + break; + } + if (true === shouldUpdate) _this.reRender(); + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "validateRules", function(options) { + var namePath = _this.getNamePath(); + var currentValue = _this.getValue(); + var _ref2 = options || {}, triggerName = _ref2.triggerName, _ref2$validateOnly = _ref2.validateOnly, validateOnly = void 0 === _ref2$validateOnly ? false : _ref2$validateOnly; + var rootPromise = Promise.resolve().then(/*#__PURE__*/ _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime_regeneratorRuntime().mark(function _callee() { + var _this$props5, _this$props5$validate, validateFirst, messageVariables, validateDebounce, filteredRules, promise; + return regeneratorRuntime_regeneratorRuntime().wrap(function(_context) { + while(1)switch(_context.prev = _context.next){ + case 0: + if (_this.mounted) { + _context.next = 2; + break; + } + return _context.abrupt("return", []); + case 2: + _this$props5 = _this.props, _this$props5$validate = _this$props5.validateFirst, validateFirst = void 0 === _this$props5$validate ? false : _this$props5$validate, messageVariables = _this$props5.messageVariables, validateDebounce = _this$props5.validateDebounce; + filteredRules = _this.getRules(); + if (triggerName) filteredRules = filteredRules.filter(function(rule) { + return rule; + }).filter(function(rule) { + var validateTrigger = rule.validateTrigger; + if (!validateTrigger) return true; + var triggerList = typeUtil_toArray(validateTrigger); + return triggerList.includes(triggerName); + }); + if (!(validateDebounce && triggerName)) { + _context.next = 10; + break; + } + _context.next = 8; + return new Promise(function(resolve) { + setTimeout(resolve, validateDebounce); + }); + case 8: + if (!(_this.validatePromise !== rootPromise)) { + _context.next = 10; + break; + } + return _context.abrupt("return", []); + case 10: + promise = validateRules(namePath, currentValue, filteredRules, options, validateFirst, messageVariables); + promise.catch(function(e) { + return e; + }).then(function() { + var ruleErrors = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : EMPTY_ERRORS; + if (_this.validatePromise === rootPromise) { + var _ruleErrors$forEach; + _this.validatePromise = null; + var nextErrors = []; + var nextWarnings = []; + null == (_ruleErrors$forEach = ruleErrors.forEach) || _ruleErrors$forEach.call(ruleErrors, function(_ref4) { + var warningOnly = _ref4.rule.warningOnly, _ref4$errors = _ref4.errors, errors = void 0 === _ref4$errors ? EMPTY_ERRORS : _ref4$errors; + if (warningOnly) nextWarnings.push.apply(nextWarnings, _toConsumableArray(errors)); + else nextErrors.push.apply(nextErrors, _toConsumableArray(errors)); + }); + _this.errors = nextErrors; + _this.warnings = nextWarnings; + _this.triggerMetaEvent(); + _this.reRender(); + } + }); + return _context.abrupt("return", promise); + case 13: + case "end": + return _context.stop(); + } + }, _callee); + }))); + if (validateOnly) return rootPromise; + _this.validatePromise = rootPromise; + _this.dirty = true; + _this.errors = EMPTY_ERRORS; + _this.warnings = EMPTY_ERRORS; + _this.triggerMetaEvent(); + _this.reRender(); + return rootPromise; + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "isFieldValidating", function() { + return !!_this.validatePromise; + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "isFieldTouched", function() { + return _this.touched; + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "isFieldDirty", function() { + if (_this.dirty || void 0 !== _this.props.initialValue) return true; + var fieldContext = _this.props.fieldContext; + var _fieldContext$getInte = fieldContext.getInternalHooks(HOOK_MARK), getInitialValue = _fieldContext$getInte.getInitialValue; + if (void 0 !== getInitialValue(_this.getNamePath())) return true; + return false; + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "getErrors", function() { + return _this.errors; + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "getWarnings", function() { + return _this.warnings; + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "isListField", function() { + return _this.props.isListField; + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "isList", function() { + return _this.props.isList; + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "isPreserve", function() { + return _this.props.preserve; + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "getMeta", function() { + _this.prevValidating = _this.isFieldValidating(); + var meta = { + touched: _this.isFieldTouched(), + validating: _this.prevValidating, + errors: _this.errors, + warnings: _this.warnings, + name: _this.getNamePath(), + validated: null === _this.validatePromise + }; + return meta; + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "getOnlyChild", function(children) { + if ('function' == typeof children) { + var _meta2 = _this.getMeta(); + return objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, _this.getOnlyChild(children(_this.getControlled(), _meta2, _this.props.fieldContext))), {}, { + isFunction: true + }); + } + var childList = toArray_toArray(children); + if (1 !== childList.length || !/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.isValidElement(childList[0])) return { + child: childList, + isFunction: false + }; + return { + child: childList[0], + isFunction: false + }; + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "getValue", function(store) { + var getFieldsValue = _this.props.fieldContext.getFieldsValue; + var namePath = _this.getNamePath(); + return get_get(store || getFieldsValue(true), namePath); + }); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "getControlled", function() { + var childProps = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + var _this$props6 = _this.props, name = _this$props6.name, trigger = _this$props6.trigger, validateTrigger = _this$props6.validateTrigger, getValueFromEvent = _this$props6.getValueFromEvent, normalize = _this$props6.normalize, valuePropName = _this$props6.valuePropName, getValueProps = _this$props6.getValueProps, fieldContext = _this$props6.fieldContext; + var mergedValidateTrigger = void 0 !== validateTrigger ? validateTrigger : fieldContext.validateTrigger; + var namePath = _this.getNamePath(); + var getInternalHooks = fieldContext.getInternalHooks, getFieldsValue = fieldContext.getFieldsValue; + var _getInternalHooks = getInternalHooks(HOOK_MARK), dispatch = _getInternalHooks.dispatch; + var value = _this.getValue(); + var mergedGetValueProps = getValueProps || function(val) { + return defineProperty_defineProperty({}, valuePropName, val); + }; + var originTriggerFunc = childProps[trigger]; + var valueProps = void 0 !== name ? mergedGetValueProps(value) : {}; + if ('production' !== process.env.NODE_ENV && valueProps) Object.keys(valueProps).forEach(function(key) { + es_warning('function' != typeof valueProps[key], "It's not recommended to generate dynamic function prop by `getValueProps`. Please pass it to child component directly (prop: ".concat(key, ")")); + }); + var control = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, childProps), valueProps); + control[trigger] = function() { + _this.touched = true; + _this.dirty = true; + _this.triggerMetaEvent(); + var newValue; + for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + newValue = getValueFromEvent ? getValueFromEvent.apply(void 0, args) : defaultGetValueFromEvent.apply(void 0, [ + valuePropName + ].concat(args)); + if (normalize) newValue = normalize(newValue, value, getFieldsValue(true)); + if (newValue !== value) dispatch({ + type: 'updateValue', + namePath: namePath, + value: newValue + }); + if (originTriggerFunc) originTriggerFunc.apply(void 0, args); + }; + var validateTriggerList = typeUtil_toArray(mergedValidateTrigger || []); + validateTriggerList.forEach(function(triggerName) { + var originTrigger = control[triggerName]; + control[triggerName] = function() { + if (originTrigger) originTrigger.apply(void 0, arguments); + var rules = _this.props.rules; + if (rules && rules.length) dispatch({ + type: 'validateField', + namePath: namePath, + triggerName: triggerName + }); + }; + }); + return control; + }); + if (props.fieldContext) { + var getInternalHooks = props.fieldContext.getInternalHooks; + var _getInternalHooks2 = getInternalHooks(HOOK_MARK), initEntityValue = _getInternalHooks2.initEntityValue; + initEntityValue(assertThisInitialized_assertThisInitialized(_this)); + } + return _this; + } + createClass_createClass(Field, [ + { + key: "componentDidMount", + value: function() { + var _this$props7 = this.props, shouldUpdate = _this$props7.shouldUpdate, fieldContext = _this$props7.fieldContext; + this.mounted = true; + if (fieldContext) { + var getInternalHooks = fieldContext.getInternalHooks; + var _getInternalHooks3 = getInternalHooks(HOOK_MARK), registerField = _getInternalHooks3.registerField; + this.cancelRegisterFunc = registerField(this); + } + if (true === shouldUpdate) this.reRender(); + } + }, + { + key: "componentWillUnmount", + value: function() { + this.cancelRegister(); + this.triggerMetaEvent(true); + this.mounted = false; + } + }, + { + key: "reRender", + value: function() { + if (!this.mounted) return; + this.forceUpdate(); + } + }, + { + key: "render", + value: function() { + var resetCount = this.state.resetCount; + var children = this.props.children; + var _this$getOnlyChild = this.getOnlyChild(children), child = _this$getOnlyChild.child, isFunction = _this$getOnlyChild.isFunction; + var returnChildNode; + if (isFunction) returnChildNode = child; + else if (/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.isValidElement(child)) returnChildNode = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.cloneElement(child, this.getControlled(child.props)); + else { + es_warning(!child, '`children` of Field is not validate ReactElement.'); + returnChildNode = child; + } + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(__WEBPACK_EXTERNAL_MODULE_react__.Fragment, { + key: resetCount + }, returnChildNode); + } + } + ]); + return Field; +}(__WEBPACK_EXTERNAL_MODULE_react__.Component); +defineProperty_defineProperty(Field_Field, "contextType", FieldContext); +defineProperty_defineProperty(Field_Field, "defaultProps", { + trigger: 'onChange', + valuePropName: 'value' +}); +function WrapperField(_ref6) { + var _restProps$isListFiel; + var name = _ref6.name, restProps = objectWithoutProperties_objectWithoutProperties(_ref6, Field_excluded); + var fieldContext = __WEBPACK_EXTERNAL_MODULE_react__.useContext(FieldContext); + var listContext = __WEBPACK_EXTERNAL_MODULE_react__.useContext(es_ListContext); + var namePath = void 0 !== name ? getNamePath(name) : void 0; + var isMergedListField = null != (_restProps$isListFiel = restProps.isListField) ? _restProps$isListFiel : !!listContext; + var key = 'keep'; + if (!isMergedListField) key = "_".concat((namePath || []).join('_')); + if ('production' !== process.env.NODE_ENV && false === restProps.preserve && isMergedListField && namePath.length <= 1) es_warning(false, '`preserve` should not apply on Form.List fields.'); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(Field_Field, _extends({ + key: key, + name: namePath, + isListField: isMergedListField + }, restProps, { + fieldContext: fieldContext + })); +} +const es_Field = WrapperField; +function List_List(_ref) { + var name = _ref.name, initialValue = _ref.initialValue, children = _ref.children, rules = _ref.rules, validateTrigger = _ref.validateTrigger, isListField = _ref.isListField; + var context = __WEBPACK_EXTERNAL_MODULE_react__.useContext(FieldContext); + var wrapperListContext = __WEBPACK_EXTERNAL_MODULE_react__.useContext(es_ListContext); + var keyRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef({ + keys: [], + id: 0 + }); + var keyManager = keyRef.current; + var prefixName = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(function() { + var parentPrefixName = getNamePath(context.prefixName) || []; + return [].concat(_toConsumableArray(parentPrefixName), _toConsumableArray(getNamePath(name))); + }, [ + context.prefixName, + name + ]); + var fieldContext = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(function() { + return objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, context), {}, { + prefixName: prefixName + }); + }, [ + context, + prefixName + ]); + var listContext = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(function() { + return { + getKey: function(namePath) { + var len = prefixName.length; + var pathName = namePath[len]; + return [ + keyManager.keys[pathName], + namePath.slice(len + 1) + ]; + } + }; + }, [ + prefixName + ]); + if ('function' != typeof children) { + es_warning(false, 'Form.List only accepts function as children.'); + return null; + } + var shouldUpdate = function(prevValue, nextValue, _ref2) { + var source = _ref2.source; + if ('internal' === source) return false; + return prevValue !== nextValue; + }; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(es_ListContext.Provider, { + value: listContext + }, /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(FieldContext.Provider, { + value: fieldContext + }, /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(es_Field, { + name: [], + shouldUpdate: shouldUpdate, + rules: rules, + validateTrigger: validateTrigger, + initialValue: initialValue, + isList: true, + isListField: null != isListField ? isListField : !!wrapperListContext + }, function(_ref3, meta) { + var _ref3$value = _ref3.value, value = void 0 === _ref3$value ? [] : _ref3$value, onChange = _ref3.onChange; + var getFieldValue = context.getFieldValue; + var getNewValue = function() { + var values = getFieldValue(prefixName || []); + return values || []; + }; + var operations = { + add: function(defaultValue, index) { + var newValue = getNewValue(); + if (index >= 0 && index <= newValue.length) { + keyManager.keys = [].concat(_toConsumableArray(keyManager.keys.slice(0, index)), [ + keyManager.id + ], _toConsumableArray(keyManager.keys.slice(index))); + onChange([].concat(_toConsumableArray(newValue.slice(0, index)), [ + defaultValue + ], _toConsumableArray(newValue.slice(index)))); + } else { + if ('production' !== process.env.NODE_ENV && (index < 0 || index > newValue.length)) es_warning(false, 'The second parameter of the add function should be a valid positive number.'); + keyManager.keys = [].concat(_toConsumableArray(keyManager.keys), [ + keyManager.id + ]); + onChange([].concat(_toConsumableArray(newValue), [ + defaultValue + ])); + } + keyManager.id += 1; + }, + remove: function(index) { + var newValue = getNewValue(); + var indexSet = new Set(Array.isArray(index) ? index : [ + index + ]); + if (indexSet.size <= 0) return; + keyManager.keys = keyManager.keys.filter(function(_, keysIndex) { + return !indexSet.has(keysIndex); + }); + onChange(newValue.filter(function(_, valueIndex) { + return !indexSet.has(valueIndex); + })); + }, + move: function(from, to) { + if (from === to) return; + var newValue = getNewValue(); + if (from < 0 || from >= newValue.length || to < 0 || to >= newValue.length) return; + keyManager.keys = valueUtil_move(keyManager.keys, from, to); + onChange(valueUtil_move(newValue, from, to)); + } + }; + var listValue = value || []; + if (!Array.isArray(listValue)) { + listValue = []; + if ('production' !== process.env.NODE_ENV) es_warning(false, "Current value of '".concat(prefixName.join(' > '), "' is not an array type.")); + } + return children(listValue.map(function(__, index) { + var key = keyManager.keys[index]; + if (void 0 === key) { + keyManager.keys[index] = keyManager.id; + key = keyManager.keys[index]; + keyManager.id += 1; + } + return { + name: index, + key: key, + isListField: true + }; + }), operations, meta); + }))); +} +const List = List_List; +function allPromiseFinish(promiseList) { + var hasError = false; + var count = promiseList.length; + var results = []; + if (!promiseList.length) return Promise.resolve([]); + return new Promise(function(resolve, reject) { + promiseList.forEach(function(promise, index) { + promise.catch(function(e) { + hasError = true; + return e; + }).then(function(result) { + count -= 1; + results[index] = result; + if (count > 0) return; + if (hasError) reject(results); + resolve(results); + }); + }); + }); +} +var SPLIT = '__@field_split__'; +function NameMap_normalize(namePath) { + return namePath.map(function(cell) { + return "".concat(typeof_typeof(cell), ":").concat(cell); + }).join(SPLIT); +} +var NameMap_NameMap = /*#__PURE__*/ function() { + function NameMap() { + classCallCheck_classCallCheck(this, NameMap); + defineProperty_defineProperty(this, "kvs", new Map()); + } + createClass_createClass(NameMap, [ + { + key: "set", + value: function(key, value) { + this.kvs.set(NameMap_normalize(key), value); + } + }, + { + key: "get", + value: function(key) { + return this.kvs.get(NameMap_normalize(key)); + } + }, + { + key: "update", + value: function(key, updater) { + var origin = this.get(key); + var next = updater(origin); + if (next) this.set(key, next); + else this.delete(key); + } + }, + { + key: "delete", + value: function(key) { + this.kvs.delete(NameMap_normalize(key)); + } + }, + { + key: "map", + value: function(callback) { + return _toConsumableArray(this.kvs.entries()).map(function(_ref) { + var _ref2 = slicedToArray_slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1]; + var cells = key.split(SPLIT); + return callback({ + key: cells.map(function(cell) { + var _cell$match = cell.match(/^([^:]*):(.*)$/), _cell$match2 = slicedToArray_slicedToArray(_cell$match, 3), type = _cell$match2[1], unit = _cell$match2[2]; + return 'number' === type ? Number(unit) : unit; + }), + value: value + }); + }); + } + }, + { + key: "toJSON", + value: function() { + var json = {}; + this.map(function(_ref3) { + var key = _ref3.key, value = _ref3.value; + json[key.join('.')] = value; + return null; + }); + return json; + } + } + ]); + return NameMap; +}(); +const utils_NameMap = NameMap_NameMap; +var useForm_excluded = [ + "name" +]; +var useForm_FormStore = /*#__PURE__*/ createClass_createClass(function FormStore(forceRootUpdate) { + var _this = this; + classCallCheck_classCallCheck(this, FormStore); + defineProperty_defineProperty(this, "formHooked", false); + defineProperty_defineProperty(this, "forceRootUpdate", void 0); + defineProperty_defineProperty(this, "subscribable", true); + defineProperty_defineProperty(this, "store", {}); + defineProperty_defineProperty(this, "fieldEntities", []); + defineProperty_defineProperty(this, "initialValues", {}); + defineProperty_defineProperty(this, "callbacks", {}); + defineProperty_defineProperty(this, "validateMessages", null); + defineProperty_defineProperty(this, "preserve", null); + defineProperty_defineProperty(this, "lastValidatePromise", null); + defineProperty_defineProperty(this, "getForm", function() { + return { + getFieldValue: _this.getFieldValue, + getFieldsValue: _this.getFieldsValue, + getFieldError: _this.getFieldError, + getFieldWarning: _this.getFieldWarning, + getFieldsError: _this.getFieldsError, + isFieldsTouched: _this.isFieldsTouched, + isFieldTouched: _this.isFieldTouched, + isFieldValidating: _this.isFieldValidating, + isFieldsValidating: _this.isFieldsValidating, + resetFields: _this.resetFields, + setFields: _this.setFields, + setFieldValue: _this.setFieldValue, + setFieldsValue: _this.setFieldsValue, + validateFields: _this.validateFields, + submit: _this.submit, + _init: true, + getInternalHooks: _this.getInternalHooks + }; + }); + defineProperty_defineProperty(this, "getInternalHooks", function(key) { + if (key === HOOK_MARK) { + _this.formHooked = true; + return { + dispatch: _this.dispatch, + initEntityValue: _this.initEntityValue, + registerField: _this.registerField, + useSubscribe: _this.useSubscribe, + setInitialValues: _this.setInitialValues, + destroyForm: _this.destroyForm, + setCallbacks: _this.setCallbacks, + setValidateMessages: _this.setValidateMessages, + getFields: _this.getFields, + setPreserve: _this.setPreserve, + getInitialValue: _this.getInitialValue, + registerWatch: _this.registerWatch + }; + } + es_warning(false, '`getInternalHooks` is internal usage. Should not call directly.'); + return null; + }); + defineProperty_defineProperty(this, "useSubscribe", function(subscribable) { + _this.subscribable = subscribable; + }); + defineProperty_defineProperty(this, "prevWithoutPreserves", null); + defineProperty_defineProperty(this, "setInitialValues", function(initialValues, init) { + _this.initialValues = initialValues || {}; + if (init) { + var _this$prevWithoutPres; + var nextStore = merge(initialValues, _this.store); + null == (_this$prevWithoutPres = _this.prevWithoutPreserves) || _this$prevWithoutPres.map(function(_ref) { + var namePath = _ref.key; + nextStore = set_set(nextStore, namePath, get_get(initialValues, namePath)); + }); + _this.prevWithoutPreserves = null; + _this.updateStore(nextStore); + } + }); + defineProperty_defineProperty(this, "destroyForm", function(clearOnDestroy) { + if (clearOnDestroy) _this.updateStore({}); + else { + var prevWithoutPreserves = new utils_NameMap(); + _this.getFieldEntities(true).forEach(function(entity) { + if (!_this.isMergedPreserve(entity.isPreserve())) prevWithoutPreserves.set(entity.getNamePath(), true); + }); + _this.prevWithoutPreserves = prevWithoutPreserves; + } + }); + defineProperty_defineProperty(this, "getInitialValue", function(namePath) { + var initValue = get_get(_this.initialValues, namePath); + return namePath.length ? merge(initValue) : initValue; + }); + defineProperty_defineProperty(this, "setCallbacks", function(callbacks) { + _this.callbacks = callbacks; + }); + defineProperty_defineProperty(this, "setValidateMessages", function(validateMessages) { + _this.validateMessages = validateMessages; + }); + defineProperty_defineProperty(this, "setPreserve", function(preserve) { + _this.preserve = preserve; + }); + defineProperty_defineProperty(this, "watchList", []); + defineProperty_defineProperty(this, "registerWatch", function(callback) { + _this.watchList.push(callback); + return function() { + _this.watchList = _this.watchList.filter(function(fn) { + return fn !== callback; + }); + }; + }); + defineProperty_defineProperty(this, "notifyWatch", function() { + var namePath = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + if (_this.watchList.length) { + var values = _this.getFieldsValue(); + var allValues = _this.getFieldsValue(true); + _this.watchList.forEach(function(callback) { + callback(values, allValues, namePath); + }); + } + }); + defineProperty_defineProperty(this, "timeoutId", null); + defineProperty_defineProperty(this, "warningUnhooked", function() { + if ('production' !== process.env.NODE_ENV && !_this.timeoutId && 'undefined' != typeof window) _this.timeoutId = setTimeout(function() { + _this.timeoutId = null; + if (!_this.formHooked) es_warning(false, 'Instance created by `useForm` is not connected to any Form element. Forget to pass `form` prop?'); + }); + }); + defineProperty_defineProperty(this, "updateStore", function(nextStore) { + _this.store = nextStore; + }); + defineProperty_defineProperty(this, "getFieldEntities", function() { + var pure = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : false; + if (!pure) return _this.fieldEntities; + return _this.fieldEntities.filter(function(field) { + return field.getNamePath().length; + }); + }); + defineProperty_defineProperty(this, "getFieldsMap", function() { + var pure = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : false; + var cache = new utils_NameMap(); + _this.getFieldEntities(pure).forEach(function(field) { + var namePath = field.getNamePath(); + cache.set(namePath, field); + }); + return cache; + }); + defineProperty_defineProperty(this, "getFieldEntitiesForNamePathList", function(nameList) { + if (!nameList) return _this.getFieldEntities(true); + var cache = _this.getFieldsMap(true); + return nameList.map(function(name) { + var namePath = getNamePath(name); + return cache.get(namePath) || { + INVALIDATE_NAME_PATH: getNamePath(name) + }; + }); + }); + defineProperty_defineProperty(this, "getFieldsValue", function(nameList, filterFunc) { + _this.warningUnhooked(); + var mergedNameList; + var mergedFilterFunc; + var mergedStrict; + if (true === nameList || Array.isArray(nameList)) { + mergedNameList = nameList; + mergedFilterFunc = filterFunc; + } else if (nameList && 'object' === typeof_typeof(nameList)) { + mergedStrict = nameList.strict; + mergedFilterFunc = nameList.filter; + } + if (true === mergedNameList && !mergedFilterFunc) return _this.store; + var fieldEntities = _this.getFieldEntitiesForNamePathList(Array.isArray(mergedNameList) ? mergedNameList : null); + var filteredNameList = []; + fieldEntities.forEach(function(entity) { + var _isListField, _ref3; + var namePath = 'INVALIDATE_NAME_PATH' in entity ? entity.INVALIDATE_NAME_PATH : entity.getNamePath(); + if (mergedStrict) { + var _isList, _ref2; + if (null != (_isList = (_ref2 = entity).isList) && _isList.call(_ref2)) return; + } else if (!mergedNameList && null != (_isListField = (_ref3 = entity).isListField) && _isListField.call(_ref3)) return; + if (mergedFilterFunc) { + var meta = 'getMeta' in entity ? entity.getMeta() : null; + if (mergedFilterFunc(meta)) filteredNameList.push(namePath); + } else filteredNameList.push(namePath); + }); + return cloneByNamePathList(_this.store, filteredNameList.map(getNamePath)); + }); + defineProperty_defineProperty(this, "getFieldValue", function(name) { + _this.warningUnhooked(); + var namePath = getNamePath(name); + return get_get(_this.store, namePath); + }); + defineProperty_defineProperty(this, "getFieldsError", function(nameList) { + _this.warningUnhooked(); + var fieldEntities = _this.getFieldEntitiesForNamePathList(nameList); + return fieldEntities.map(function(entity, index) { + if (entity && !('INVALIDATE_NAME_PATH' in entity)) return { + name: entity.getNamePath(), + errors: entity.getErrors(), + warnings: entity.getWarnings() + }; + return { + name: getNamePath(nameList[index]), + errors: [], + warnings: [] + }; + }); + }); + defineProperty_defineProperty(this, "getFieldError", function(name) { + _this.warningUnhooked(); + var namePath = getNamePath(name); + var fieldError = _this.getFieldsError([ + namePath + ])[0]; + return fieldError.errors; + }); + defineProperty_defineProperty(this, "getFieldWarning", function(name) { + _this.warningUnhooked(); + var namePath = getNamePath(name); + var fieldError = _this.getFieldsError([ + namePath + ])[0]; + return fieldError.warnings; + }); + defineProperty_defineProperty(this, "isFieldsTouched", function() { + _this.warningUnhooked(); + for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + var arg0 = args[0], arg1 = args[1]; + var namePathList; + var isAllFieldsTouched = false; + if (0 === args.length) namePathList = null; + else if (1 === args.length) if (Array.isArray(arg0)) { + namePathList = arg0.map(getNamePath); + isAllFieldsTouched = false; + } else { + namePathList = null; + isAllFieldsTouched = arg0; + } + else { + namePathList = arg0.map(getNamePath); + isAllFieldsTouched = arg1; + } + var fieldEntities = _this.getFieldEntities(true); + var isFieldTouched = function(field) { + return field.isFieldTouched(); + }; + if (!namePathList) return isAllFieldsTouched ? fieldEntities.every(function(entity) { + return isFieldTouched(entity) || entity.isList(); + }) : fieldEntities.some(isFieldTouched); + var map = new utils_NameMap(); + namePathList.forEach(function(shortNamePath) { + map.set(shortNamePath, []); + }); + fieldEntities.forEach(function(field) { + var fieldNamePath = field.getNamePath(); + namePathList.forEach(function(shortNamePath) { + if (shortNamePath.every(function(nameUnit, i) { + return fieldNamePath[i] === nameUnit; + })) map.update(shortNamePath, function(list) { + return [].concat(_toConsumableArray(list), [ + field + ]); + }); + }); + }); + var isNamePathListTouched = function(entities) { + return entities.some(isFieldTouched); + }; + var namePathListEntities = map.map(function(_ref4) { + var value = _ref4.value; + return value; + }); + return isAllFieldsTouched ? namePathListEntities.every(isNamePathListTouched) : namePathListEntities.some(isNamePathListTouched); + }); + defineProperty_defineProperty(this, "isFieldTouched", function(name) { + _this.warningUnhooked(); + return _this.isFieldsTouched([ + name + ]); + }); + defineProperty_defineProperty(this, "isFieldsValidating", function(nameList) { + _this.warningUnhooked(); + var fieldEntities = _this.getFieldEntities(); + if (!nameList) return fieldEntities.some(function(testField) { + return testField.isFieldValidating(); + }); + var namePathList = nameList.map(getNamePath); + return fieldEntities.some(function(testField) { + var fieldNamePath = testField.getNamePath(); + return containsNamePath(namePathList, fieldNamePath) && testField.isFieldValidating(); + }); + }); + defineProperty_defineProperty(this, "isFieldValidating", function(name) { + _this.warningUnhooked(); + return _this.isFieldsValidating([ + name + ]); + }); + defineProperty_defineProperty(this, "resetWithFieldInitialValue", function() { + var info = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + var cache = new utils_NameMap(); + var fieldEntities = _this.getFieldEntities(true); + fieldEntities.forEach(function(field) { + var initialValue = field.props.initialValue; + var namePath = field.getNamePath(); + if (void 0 !== initialValue) { + var records = cache.get(namePath) || new Set(); + records.add({ + entity: field, + value: initialValue + }); + cache.set(namePath, records); + } + }); + var resetWithFields = function(entities) { + entities.forEach(function(field) { + var initialValue = field.props.initialValue; + if (void 0 !== initialValue) { + var namePath = field.getNamePath(); + var formInitialValue = _this.getInitialValue(namePath); + if (void 0 !== formInitialValue) es_warning(false, "Form already set 'initialValues' with path '".concat(namePath.join('.'), "'. Field can not overwrite it.")); + else { + var records = cache.get(namePath); + if (records && records.size > 1) es_warning(false, "Multiple Field with path '".concat(namePath.join('.'), "' set 'initialValue'. Can not decide which one to pick.")); + else if (records) { + var originValue = _this.getFieldValue(namePath); + var isListField = field.isListField(); + if (!isListField && (!info.skipExist || void 0 === originValue)) _this.updateStore(set_set(_this.store, namePath, _toConsumableArray(records)[0].value)); + } + } + } + }); + }; + var requiredFieldEntities; + if (info.entities) requiredFieldEntities = info.entities; + else if (info.namePathList) { + requiredFieldEntities = []; + info.namePathList.forEach(function(namePath) { + var records = cache.get(namePath); + if (records) { + var _requiredFieldEntitie; + (_requiredFieldEntitie = requiredFieldEntities).push.apply(_requiredFieldEntitie, _toConsumableArray(_toConsumableArray(records).map(function(r) { + return r.entity; + }))); + } + }); + } else requiredFieldEntities = fieldEntities; + resetWithFields(requiredFieldEntities); + }); + defineProperty_defineProperty(this, "resetFields", function(nameList) { + _this.warningUnhooked(); + var prevStore = _this.store; + if (!nameList) { + _this.updateStore(merge(_this.initialValues)); + _this.resetWithFieldInitialValue(); + _this.notifyObservers(prevStore, null, { + type: 'reset' + }); + _this.notifyWatch(); + return; + } + var namePathList = nameList.map(getNamePath); + namePathList.forEach(function(namePath) { + var initialValue = _this.getInitialValue(namePath); + _this.updateStore(set_set(_this.store, namePath, initialValue)); + }); + _this.resetWithFieldInitialValue({ + namePathList: namePathList + }); + _this.notifyObservers(prevStore, namePathList, { + type: 'reset' + }); + _this.notifyWatch(namePathList); + }); + defineProperty_defineProperty(this, "setFields", function(fields) { + _this.warningUnhooked(); + var prevStore = _this.store; + var namePathList = []; + fields.forEach(function(fieldData) { + var name = fieldData.name, data = objectWithoutProperties_objectWithoutProperties(fieldData, useForm_excluded); + var namePath = getNamePath(name); + namePathList.push(namePath); + if ('value' in data) _this.updateStore(set_set(_this.store, namePath, data.value)); + _this.notifyObservers(prevStore, [ + namePath + ], { + type: 'setField', + data: fieldData + }); + }); + _this.notifyWatch(namePathList); + }); + defineProperty_defineProperty(this, "getFields", function() { + var entities = _this.getFieldEntities(true); + var fields = entities.map(function(field) { + var namePath = field.getNamePath(); + var meta = field.getMeta(); + var fieldData = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, meta), {}, { + name: namePath, + value: _this.getFieldValue(namePath) + }); + Object.defineProperty(fieldData, 'originRCField', { + value: true + }); + return fieldData; + }); + return fields; + }); + defineProperty_defineProperty(this, "initEntityValue", function(entity) { + var initialValue = entity.props.initialValue; + if (void 0 !== initialValue) { + var namePath = entity.getNamePath(); + var prevValue = get_get(_this.store, namePath); + if (void 0 === prevValue) _this.updateStore(set_set(_this.store, namePath, initialValue)); + } + }); + defineProperty_defineProperty(this, "isMergedPreserve", function(fieldPreserve) { + var mergedPreserve = void 0 !== fieldPreserve ? fieldPreserve : _this.preserve; + return null != mergedPreserve ? mergedPreserve : true; + }); + defineProperty_defineProperty(this, "registerField", function(entity) { + _this.fieldEntities.push(entity); + var namePath = entity.getNamePath(); + _this.notifyWatch([ + namePath + ]); + if (void 0 !== entity.props.initialValue) { + var prevStore = _this.store; + _this.resetWithFieldInitialValue({ + entities: [ + entity + ], + skipExist: true + }); + _this.notifyObservers(prevStore, [ + entity.getNamePath() + ], { + type: 'valueUpdate', + source: 'internal' + }); + } + return function(isListField, preserve) { + var subNamePath = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : []; + _this.fieldEntities = _this.fieldEntities.filter(function(item) { + return item !== entity; + }); + if (!_this.isMergedPreserve(preserve) && (!isListField || subNamePath.length > 1)) { + var defaultValue = isListField ? void 0 : _this.getInitialValue(namePath); + if (namePath.length && _this.getFieldValue(namePath) !== defaultValue && _this.fieldEntities.every(function(field) { + return !matchNamePath(field.getNamePath(), namePath); + })) { + var _prevStore = _this.store; + _this.updateStore(set_set(_prevStore, namePath, defaultValue, true)); + _this.notifyObservers(_prevStore, [ + namePath + ], { + type: 'remove' + }); + _this.triggerDependenciesUpdate(_prevStore, namePath); + } + } + _this.notifyWatch([ + namePath + ]); + }; + }); + defineProperty_defineProperty(this, "dispatch", function(action) { + switch(action.type){ + case 'updateValue': + var namePath = action.namePath, value = action.value; + _this.updateValue(namePath, value); + break; + case 'validateField': + var _namePath = action.namePath, triggerName = action.triggerName; + _this.validateFields([ + _namePath + ], { + triggerName: triggerName + }); + break; + default: + } + }); + defineProperty_defineProperty(this, "notifyObservers", function(prevStore, namePathList, info) { + if (_this.subscribable) { + var mergedInfo = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, info), {}, { + store: _this.getFieldsValue(true) + }); + _this.getFieldEntities().forEach(function(_ref5) { + var onStoreChange = _ref5.onStoreChange; + onStoreChange(prevStore, namePathList, mergedInfo); + }); + } else _this.forceRootUpdate(); + }); + defineProperty_defineProperty(this, "triggerDependenciesUpdate", function(prevStore, namePath) { + var childrenFields = _this.getDependencyChildrenFields(namePath); + if (childrenFields.length) _this.validateFields(childrenFields); + _this.notifyObservers(prevStore, childrenFields, { + type: 'dependenciesUpdate', + relatedFields: [ + namePath + ].concat(_toConsumableArray(childrenFields)) + }); + return childrenFields; + }); + defineProperty_defineProperty(this, "updateValue", function(name, value) { + var namePath = getNamePath(name); + var prevStore = _this.store; + _this.updateStore(set_set(_this.store, namePath, value)); + _this.notifyObservers(prevStore, [ + namePath + ], { + type: 'valueUpdate', + source: 'internal' + }); + _this.notifyWatch([ + namePath + ]); + var childrenFields = _this.triggerDependenciesUpdate(prevStore, namePath); + var onValuesChange = _this.callbacks.onValuesChange; + if (onValuesChange) { + var changedValues = cloneByNamePathList(_this.store, [ + namePath + ]); + onValuesChange(changedValues, _this.getFieldsValue()); + } + _this.triggerOnFieldsChange([ + namePath + ].concat(_toConsumableArray(childrenFields))); + }); + defineProperty_defineProperty(this, "setFieldsValue", function(store) { + _this.warningUnhooked(); + var prevStore = _this.store; + if (store) { + var nextStore = merge(_this.store, store); + _this.updateStore(nextStore); + } + _this.notifyObservers(prevStore, null, { + type: 'valueUpdate', + source: 'external' + }); + _this.notifyWatch(); + }); + defineProperty_defineProperty(this, "setFieldValue", function(name, value) { + _this.setFields([ + { + name: name, + value: value, + errors: [], + warnings: [] + } + ]); + }); + defineProperty_defineProperty(this, "getDependencyChildrenFields", function(rootNamePath) { + var children = new Set(); + var childrenFields = []; + var dependencies2fields = new utils_NameMap(); + _this.getFieldEntities().forEach(function(field) { + var dependencies = field.props.dependencies; + (dependencies || []).forEach(function(dependency) { + var dependencyNamePath = getNamePath(dependency); + dependencies2fields.update(dependencyNamePath, function() { + var fields = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : new Set(); + fields.add(field); + return fields; + }); + }); + }); + var fillChildren = function fillChildren(namePath) { + var fields = dependencies2fields.get(namePath) || new Set(); + fields.forEach(function(field) { + if (!children.has(field)) { + children.add(field); + var fieldNamePath = field.getNamePath(); + if (field.isFieldDirty() && fieldNamePath.length) { + childrenFields.push(fieldNamePath); + fillChildren(fieldNamePath); + } + } + }); + }; + fillChildren(rootNamePath); + return childrenFields; + }); + defineProperty_defineProperty(this, "triggerOnFieldsChange", function(namePathList, filedErrors) { + var onFieldsChange = _this.callbacks.onFieldsChange; + if (onFieldsChange) { + var fields = _this.getFields(); + if (filedErrors) { + var cache = new utils_NameMap(); + filedErrors.forEach(function(_ref6) { + var name = _ref6.name, errors = _ref6.errors; + cache.set(name, errors); + }); + fields.forEach(function(field) { + field.errors = cache.get(field.name) || field.errors; + }); + } + var changedFields = fields.filter(function(_ref7) { + var fieldName = _ref7.name; + return containsNamePath(namePathList, fieldName); + }); + if (changedFields.length) onFieldsChange(changedFields, fields); + } + }); + defineProperty_defineProperty(this, "validateFields", function(arg1, arg2) { + _this.warningUnhooked(); + var nameList; + var options; + if (Array.isArray(arg1) || 'string' == typeof arg1 || 'string' == typeof arg2) { + nameList = arg1; + options = arg2; + } else options = arg1; + var provideNameList = !!nameList; + var namePathList = provideNameList ? nameList.map(getNamePath) : []; + var promiseList = []; + var TMP_SPLIT = String(Date.now()); + var validateNamePathList = new Set(); + var _ref8 = options || {}, recursive = _ref8.recursive, dirty = _ref8.dirty; + _this.getFieldEntities(true).forEach(function(field) { + if (!provideNameList) namePathList.push(field.getNamePath()); + if (!field.props.rules || !field.props.rules.length) return; + if (dirty && !field.isFieldDirty()) return; + var fieldNamePath = field.getNamePath(); + validateNamePathList.add(fieldNamePath.join(TMP_SPLIT)); + if (!provideNameList || containsNamePath(namePathList, fieldNamePath, recursive)) { + var promise = field.validateRules(objectSpread2_objectSpread2({ + validateMessages: objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, defaultValidateMessages), _this.validateMessages) + }, options)); + promiseList.push(promise.then(function() { + return { + name: fieldNamePath, + errors: [], + warnings: [] + }; + }).catch(function(ruleErrors) { + var _ruleErrors$forEach; + var mergedErrors = []; + var mergedWarnings = []; + null == (_ruleErrors$forEach = ruleErrors.forEach) || _ruleErrors$forEach.call(ruleErrors, function(_ref9) { + var warningOnly = _ref9.rule.warningOnly, errors = _ref9.errors; + if (warningOnly) mergedWarnings.push.apply(mergedWarnings, _toConsumableArray(errors)); + else mergedErrors.push.apply(mergedErrors, _toConsumableArray(errors)); + }); + if (mergedErrors.length) return Promise.reject({ + name: fieldNamePath, + errors: mergedErrors, + warnings: mergedWarnings + }); + return { + name: fieldNamePath, + errors: mergedErrors, + warnings: mergedWarnings + }; + })); + } + }); + var summaryPromise = allPromiseFinish(promiseList); + _this.lastValidatePromise = summaryPromise; + summaryPromise.catch(function(results) { + return results; + }).then(function(results) { + var resultNamePathList = results.map(function(_ref10) { + var name = _ref10.name; + return name; + }); + _this.notifyObservers(_this.store, resultNamePathList, { + type: 'validateFinish' + }); + _this.triggerOnFieldsChange(resultNamePathList, results); + }); + var returnPromise = summaryPromise.then(function() { + if (_this.lastValidatePromise === summaryPromise) return Promise.resolve(_this.getFieldsValue(namePathList)); + return Promise.reject([]); + }).catch(function(results) { + var errorList = results.filter(function(result) { + return result && result.errors.length; + }); + return Promise.reject({ + values: _this.getFieldsValue(namePathList), + errorFields: errorList, + outOfDate: _this.lastValidatePromise !== summaryPromise + }); + }); + returnPromise.catch(function(e) { + return e; + }); + var triggerNamePathList = namePathList.filter(function(namePath) { + return validateNamePathList.has(namePath.join(TMP_SPLIT)); + }); + _this.triggerOnFieldsChange(triggerNamePathList); + return returnPromise; + }); + defineProperty_defineProperty(this, "submit", function() { + _this.warningUnhooked(); + _this.validateFields().then(function(values) { + var onFinish = _this.callbacks.onFinish; + if (onFinish) try { + onFinish(values); + } catch (err) { + console.error(err); + } + }).catch(function(e) { + var onFinishFailed = _this.callbacks.onFinishFailed; + if (onFinishFailed) onFinishFailed(e); + }); + }); + this.forceRootUpdate = forceRootUpdate; +}); +function useForm_useForm(form) { + var formRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(); + var _React$useState = __WEBPACK_EXTERNAL_MODULE_react__.useState({}), _React$useState2 = slicedToArray_slicedToArray(_React$useState, 2), forceUpdate = _React$useState2[1]; + if (!formRef.current) if (form) formRef.current = form; + else { + var forceReRender = function() { + forceUpdate({}); + }; + var formStore = new useForm_FormStore(forceReRender); + formRef.current = formStore.getForm(); + } + return [ + formRef.current + ]; +} +const useForm = useForm_useForm; +var FormContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext({ + triggerFormChange: function() {}, + triggerFormFinish: function() {}, + registerForm: function() {}, + unregisterForm: function() {} +}); +var FormContext_FormProvider = function(_ref) { + var validateMessages = _ref.validateMessages, onFormChange = _ref.onFormChange, onFormFinish = _ref.onFormFinish, children = _ref.children; + var formContext = __WEBPACK_EXTERNAL_MODULE_react__.useContext(FormContext); + var formsRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef({}); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(FormContext.Provider, { + value: objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, formContext), {}, { + validateMessages: objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, formContext.validateMessages), validateMessages), + triggerFormChange: function(name, changedFields) { + if (onFormChange) onFormChange(name, { + changedFields: changedFields, + forms: formsRef.current + }); + formContext.triggerFormChange(name, changedFields); + }, + triggerFormFinish: function(name, values) { + if (onFormFinish) onFormFinish(name, { + values: values, + forms: formsRef.current + }); + formContext.triggerFormFinish(name, values); + }, + registerForm: function(name, form) { + if (name) formsRef.current = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, formsRef.current), {}, defineProperty_defineProperty({}, name, form)); + formContext.registerForm(name, form); + }, + unregisterForm: function(name) { + var newForms = objectSpread2_objectSpread2({}, formsRef.current); + delete newForms[name]; + formsRef.current = newForms; + formContext.unregisterForm(name); + } + }) + }, children); +}; +const es_FormContext = FormContext; +var Form_excluded = [ + "name", + "initialValues", + "fields", + "form", + "preserve", + "children", + "component", + "validateMessages", + "validateTrigger", + "onValuesChange", + "onFieldsChange", + "onFinish", + "onFinishFailed", + "clearOnDestroy" +]; +var Form_Form = function(_ref, ref) { + var name = _ref.name, initialValues = _ref.initialValues, fields = _ref.fields, form = _ref.form, preserve = _ref.preserve, children = _ref.children, _ref$component = _ref.component, Component = void 0 === _ref$component ? 'form' : _ref$component, validateMessages = _ref.validateMessages, _ref$validateTrigger = _ref.validateTrigger, validateTrigger = void 0 === _ref$validateTrigger ? 'onChange' : _ref$validateTrigger, onValuesChange = _ref.onValuesChange, _onFieldsChange = _ref.onFieldsChange, _onFinish = _ref.onFinish, onFinishFailed = _ref.onFinishFailed, clearOnDestroy = _ref.clearOnDestroy, restProps = objectWithoutProperties_objectWithoutProperties(_ref, Form_excluded); + var nativeElementRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(null); + var formContext = __WEBPACK_EXTERNAL_MODULE_react__.useContext(es_FormContext); + var _useForm = useForm(form), _useForm2 = slicedToArray_slicedToArray(_useForm, 1), formInstance = _useForm2[0]; + var _getInternalHooks = formInstance.getInternalHooks(HOOK_MARK), useSubscribe = _getInternalHooks.useSubscribe, setInitialValues = _getInternalHooks.setInitialValues, setCallbacks = _getInternalHooks.setCallbacks, setValidateMessages = _getInternalHooks.setValidateMessages, setPreserve = _getInternalHooks.setPreserve, destroyForm = _getInternalHooks.destroyForm; + __WEBPACK_EXTERNAL_MODULE_react__.useImperativeHandle(ref, function() { + return objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, formInstance), {}, { + nativeElement: nativeElementRef.current + }); + }); + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(function() { + formContext.registerForm(name, formInstance); + return function() { + formContext.unregisterForm(name); + }; + }, [ + formContext, + formInstance, + name + ]); + setValidateMessages(objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, formContext.validateMessages), validateMessages)); + setCallbacks({ + onValuesChange: onValuesChange, + onFieldsChange: function(changedFields) { + formContext.triggerFormChange(name, changedFields); + if (_onFieldsChange) { + for(var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)rest[_key - 1] = arguments[_key]; + _onFieldsChange.apply(void 0, [ + changedFields + ].concat(rest)); + } + }, + onFinish: function(values) { + formContext.triggerFormFinish(name, values); + if (_onFinish) _onFinish(values); + }, + onFinishFailed: onFinishFailed + }); + setPreserve(preserve); + var mountRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(null); + setInitialValues(initialValues, !mountRef.current); + if (!mountRef.current) mountRef.current = true; + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(function() { + return function() { + return destroyForm(clearOnDestroy); + }; + }, []); + var childrenNode; + var childrenRenderProps = 'function' == typeof children; + if (childrenRenderProps) { + var _values = formInstance.getFieldsValue(true); + childrenNode = children(_values, formInstance); + } else childrenNode = children; + useSubscribe(!childrenRenderProps); + var prevFieldsRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(); + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(function() { + if (!isSimilar(prevFieldsRef.current || [], fields || [])) formInstance.setFields(fields || []); + prevFieldsRef.current = fields; + }, [ + fields, + formInstance + ]); + var formContextValue = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(function() { + return objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, formInstance), {}, { + validateTrigger: validateTrigger + }); + }, [ + formInstance, + validateTrigger + ]); + var wrapperNode = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(es_ListContext.Provider, { + value: null + }, /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(FieldContext.Provider, { + value: formContextValue + }, childrenNode)); + if (false === Component) return wrapperNode; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(Component, _extends({}, restProps, { + ref: nativeElementRef, + onSubmit: function(event) { + event.preventDefault(); + event.stopPropagation(); + formInstance.submit(); + }, + onReset: function(event) { + var _restProps$onReset; + event.preventDefault(); + formInstance.resetFields(); + null == (_restProps$onReset = restProps.onReset) || _restProps$onReset.call(restProps, event); + } + }), wrapperNode); +}; +const es_Form = Form_Form; +function stringify(value) { + try { + return JSON.stringify(value); + } catch (err) { + return Math.random(); + } +} +var useWatchWarning = 'production' !== process.env.NODE_ENV ? function(namePath) { + var fullyStr = namePath.join('__RC_FIELD_FORM_SPLIT__'); + var nameStrRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(fullyStr); + es_warning(nameStrRef.current === fullyStr, '`useWatch` is not support dynamic `namePath`. Please provide static instead.'); +} : function() {}; +function useWatch_useWatch() { + for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + var dependencies = args[0], _args$ = args[1], _form = void 0 === _args$ ? {} : _args$; + var options = isFormInstance(_form) ? { + form: _form + } : _form; + var form = options.form; + var _useState = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(), _useState2 = slicedToArray_slicedToArray(_useState, 2), value = _useState2[0], setValue = _useState2[1]; + var valueStr = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(function() { + return stringify(value); + }, [ + value + ]); + var valueStrRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(valueStr); + valueStrRef.current = valueStr; + var fieldContext = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(FieldContext); + var formInstance = form || fieldContext; + var isValidForm = formInstance && formInstance._init; + if ('production' !== process.env.NODE_ENV) es_warning(2 === args.length ? form ? isValidForm : true : isValidForm, 'useWatch requires a form instance since it can not auto detect from context.'); + var namePath = getNamePath(dependencies); + var namePathRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(namePath); + namePathRef.current = namePath; + useWatchWarning(namePath); + (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(function() { + if (!isValidForm) return; + var getFieldsValue = formInstance.getFieldsValue, getInternalHooks = formInstance.getInternalHooks; + var _getInternalHooks = getInternalHooks(HOOK_MARK), registerWatch = _getInternalHooks.registerWatch; + var getWatchValue = function(values, allValues) { + var watchValue = options.preserve ? allValues : values; + return 'function' == typeof dependencies ? dependencies(watchValue) : get_get(watchValue, namePathRef.current); + }; + var cancelRegister = registerWatch(function(values, allValues) { + var newValue = getWatchValue(values, allValues); + var nextValueStr = stringify(newValue); + if (valueStrRef.current !== nextValueStr) { + valueStrRef.current = nextValueStr; + setValue(newValue); + } + }); + var initialValue = getWatchValue(getFieldsValue(), getFieldsValue(true)); + if (value !== initialValue) setValue(initialValue); + return cancelRegister; + }, [ + isValidForm + ]); + return value; +} +const es_useWatch = useWatch_useWatch; +var InternalForm = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef(es_Form); +var RefForm = InternalForm; +RefForm.FormProvider = FormContext_FormProvider; +RefForm.Field = es_Field; +RefForm.List = List; +RefForm.useForm = useForm; +RefForm.useWatch = es_useWatch; +"use client"; +const FormItemInputContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext({}); +if ('production' !== process.env.NODE_ENV) FormItemInputContext.displayName = 'FormItemInputContext'; +const NoFormStyle = ({ children, status, override })=>{ + const formItemInputContext = __WEBPACK_EXTERNAL_MODULE_react__.useContext(FormItemInputContext); + const newFormItemInputContext = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(()=>{ + const newContext = Object.assign({}, formItemInputContext); + if (override) delete newContext.isFormItemInput; + if (status) { + delete newContext.status; + delete newContext.hasFeedback; + delete newContext.feedbackIcon; + } + return newContext; + }, [ + status, + override, + formItemInputContext + ]); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(FormItemInputContext.Provider, { + value: newFormItemInputContext + }, children); +}; +"use client"; +const SpaceCompactItemContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext(null); +const NoCompactStyle = (props)=>{ + const { children } = props; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(SpaceCompactItemContext.Provider, { + value: null + }, children); +}; +"use client"; +const ContextIsolator = (props)=>{ + const { space, form, children } = props; + if (null == children) return null; + let result = children; + if (form) result = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement(NoFormStyle, { + override: true, + status: true + }, result); + if (space) result = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement(NoCompactStyle, null, result); + return result; +}; +const _util_ContextIsolator = ContextIsolator; +function murmur2(str) { + var h = 0; + var k, i = 0, len = str.length; + for(; len >= 4; ++i, len -= 4){ + k = 0xff & str.charCodeAt(i) | (0xff & str.charCodeAt(++i)) << 8 | (0xff & str.charCodeAt(++i)) << 16 | (0xff & str.charCodeAt(++i)) << 24; + k = (0xffff & k) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16); + k ^= k >>> 24; + h = (0xffff & k) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^ (0xffff & h) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); + } + switch(len){ + case 3: + h ^= (0xff & str.charCodeAt(i + 2)) << 16; + case 2: + h ^= (0xff & str.charCodeAt(i + 1)) << 8; + case 1: + h ^= 0xff & str.charCodeAt(i); + h = (0xffff & h) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); + } + h ^= h >>> 13; + h = (0xffff & h) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); + return ((h ^ h >>> 15) >>> 0).toString(36); +} +const hash_browser_esm = murmur2; +var Cache_SPLIT = '%'; +function pathKey(keys) { + return keys.join(Cache_SPLIT); +} +var Cache_Entity = /*#__PURE__*/ function() { + function Entity(instanceId) { + classCallCheck_classCallCheck(this, Entity); + defineProperty_defineProperty(this, "instanceId", void 0); + defineProperty_defineProperty(this, "cache", new Map()); + this.instanceId = instanceId; + } + createClass_createClass(Entity, [ + { + key: "get", + value: function(keys) { + return this.opGet(pathKey(keys)); + } + }, + { + key: "opGet", + value: function(keyPathStr) { + return this.cache.get(keyPathStr) || null; + } + }, + { + key: "update", + value: function(keys, valueFn) { + return this.opUpdate(pathKey(keys), valueFn); + } + }, + { + key: "opUpdate", + value: function(keyPathStr, valueFn) { + var prevValue = this.cache.get(keyPathStr); + var nextValue = valueFn(prevValue); + if (null === nextValue) this.cache.delete(keyPathStr); + else this.cache.set(keyPathStr, nextValue); + } + } + ]); + return Entity; +}(); +const Cache = Cache_Entity; +var ATTR_TOKEN = 'data-token-hash'; +var ATTR_MARK = 'data-css-hash'; +var ATTR_CACHE_PATH = 'data-cache-path'; +var CSS_IN_JS_INSTANCE = '__cssinjs_instance__'; +function createCache() { + var cssinjsInstanceId = Math.random().toString(12).slice(2); + if ('undefined' != typeof document && document.head && document.body) { + var styles = document.body.querySelectorAll("style[".concat(ATTR_MARK, "]")) || []; + var firstChild = document.head.firstChild; + Array.from(styles).forEach(function(style) { + style[CSS_IN_JS_INSTANCE] = style[CSS_IN_JS_INSTANCE] || cssinjsInstanceId; + if (style[CSS_IN_JS_INSTANCE] === cssinjsInstanceId) document.head.insertBefore(style, firstChild); + }); + var styleHash = {}; + Array.from(document.querySelectorAll("style[".concat(ATTR_MARK, "]"))).forEach(function(style) { + var hash = style.getAttribute(ATTR_MARK); + if (styleHash[hash]) { + if (style[CSS_IN_JS_INSTANCE] === cssinjsInstanceId) { + var _style$parentNode; + null == (_style$parentNode = style.parentNode) || _style$parentNode.removeChild(style); + } + } else styleHash[hash] = true; + }); + } + return new Cache(cssinjsInstanceId); +} +var StyleContext_StyleContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext({ + hashPriority: 'low', + cache: createCache(), + defaultCache: true +}); +const StyleContext = StyleContext_StyleContext; +var CALC_UNIT = 'CALC_UNIT'; +new RegExp(CALC_UNIT, 'g'); +function sameDerivativeOption(left, right) { + if (left.length !== right.length) return false; + for(var i = 0; i < left.length; i++)if (left[i] !== right[i]) return false; + return true; +} +var ThemeCache_ThemeCache = /*#__PURE__*/ function() { + function ThemeCache() { + classCallCheck_classCallCheck(this, ThemeCache); + defineProperty_defineProperty(this, "cache", void 0); + defineProperty_defineProperty(this, "keys", void 0); + defineProperty_defineProperty(this, "cacheCallTimes", void 0); + this.cache = new Map(); + this.keys = []; + this.cacheCallTimes = 0; + } + createClass_createClass(ThemeCache, [ + { + key: "size", + value: function() { + return this.keys.length; + } + }, + { + key: "internalGet", + value: function(derivativeOption) { + var _cache2, _cache3; + var updateCallTimes = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : false; + var cache = { + map: this.cache + }; + derivativeOption.forEach(function(derivative) { + if (cache) { + var _cache; + cache = null == (_cache = cache) || null == (_cache = _cache.map) ? void 0 : _cache.get(derivative); + } else cache = void 0; + }); + if (null != (_cache2 = cache) && _cache2.value && updateCallTimes) cache.value[1] = this.cacheCallTimes++; + return null == (_cache3 = cache) ? void 0 : _cache3.value; + } + }, + { + key: "get", + value: function(derivativeOption) { + var _this$internalGet; + return null == (_this$internalGet = this.internalGet(derivativeOption, true)) ? void 0 : _this$internalGet[0]; + } + }, + { + key: "has", + value: function(derivativeOption) { + return !!this.internalGet(derivativeOption); + } + }, + { + key: "set", + value: function(derivativeOption, value) { + var _this = this; + if (!this.has(derivativeOption)) { + if (this.size() + 1 > ThemeCache.MAX_CACHE_SIZE + ThemeCache.MAX_CACHE_OFFSET) { + var _this$keys$reduce = this.keys.reduce(function(result, key) { + var _result = slicedToArray_slicedToArray(result, 2), callTimes = _result[1]; + if (_this.internalGet(key)[1] < callTimes) return [ + key, + _this.internalGet(key)[1] + ]; + return result; + }, [ + this.keys[0], + this.cacheCallTimes + ]), _this$keys$reduce2 = slicedToArray_slicedToArray(_this$keys$reduce, 1), targetKey = _this$keys$reduce2[0]; + this.delete(targetKey); + } + this.keys.push(derivativeOption); + } + var cache = this.cache; + derivativeOption.forEach(function(derivative, index) { + if (index === derivativeOption.length - 1) cache.set(derivative, { + value: [ + value, + _this.cacheCallTimes++ + ] + }); + else { + var cacheValue = cache.get(derivative); + if (cacheValue) { + if (!cacheValue.map) cacheValue.map = new Map(); + } else cache.set(derivative, { + map: new Map() + }); + cache = cache.get(derivative).map; + } + }); + } + }, + { + key: "deleteByPath", + value: function(currentCache, derivatives) { + var cache = currentCache.get(derivatives[0]); + if (1 === derivatives.length) { + var _cache$value; + if (cache.map) currentCache.set(derivatives[0], { + map: cache.map + }); + else currentCache.delete(derivatives[0]); + return null == (_cache$value = cache.value) ? void 0 : _cache$value[0]; + } + var result = this.deleteByPath(cache.map, derivatives.slice(1)); + if ((!cache.map || 0 === cache.map.size) && !cache.value) currentCache.delete(derivatives[0]); + return result; + } + }, + { + key: "delete", + value: function(derivativeOption) { + if (this.has(derivativeOption)) { + this.keys = this.keys.filter(function(item) { + return !sameDerivativeOption(item, derivativeOption); + }); + return this.deleteByPath(this.cache, derivativeOption); + } + } + } + ]); + return ThemeCache; +}(); +defineProperty_defineProperty(ThemeCache_ThemeCache, "MAX_CACHE_SIZE", 20); +defineProperty_defineProperty(ThemeCache_ThemeCache, "MAX_CACHE_OFFSET", 5); +var Theme_uuid = 0; +var Theme_Theme = /*#__PURE__*/ function() { + function Theme(derivatives) { + classCallCheck_classCallCheck(this, Theme); + defineProperty_defineProperty(this, "derivatives", void 0); + defineProperty_defineProperty(this, "id", void 0); + this.derivatives = Array.isArray(derivatives) ? derivatives : [ + derivatives + ]; + this.id = Theme_uuid; + if (0 === derivatives.length) warning_warning(derivatives.length > 0, '[Ant Design CSS-in-JS] Theme should have at least one derivative function.'); + Theme_uuid += 1; + } + createClass_createClass(Theme, [ + { + key: "getDerivativeToken", + value: function(token) { + return this.derivatives.reduce(function(result, derivative) { + return derivative(token, result); + }, void 0); + } + } + ]); + return Theme; +}(); +var cacheThemes = new ThemeCache_ThemeCache(); +function createTheme(derivatives) { + var derivativeArr = Array.isArray(derivatives) ? derivatives : [ + derivatives + ]; + if (!cacheThemes.has(derivativeArr)) cacheThemes.set(derivativeArr, new Theme_Theme(derivativeArr)); + return cacheThemes.get(derivativeArr); +} +var resultCache = new WeakMap(); +var RESULT_VALUE = {}; +function memoResult(callback, deps) { + var current = resultCache; + for(var i = 0; i < deps.length; i += 1){ + var dep = deps[i]; + if (!current.has(dep)) current.set(dep, new WeakMap()); + current = current.get(dep); + } + if (!current.has(RESULT_VALUE)) current.set(RESULT_VALUE, callback()); + return current.get(RESULT_VALUE); +} +var flattenTokenCache = new WeakMap(); +function flattenToken(token) { + var str = flattenTokenCache.get(token) || ''; + if (!str) { + Object.keys(token).forEach(function(key) { + var value = token[key]; + str += key; + if (value instanceof Theme_Theme) str += value.id; + else if (value && 'object' === typeof_typeof(value)) str += flattenToken(value); + else str += value; + }); + str = hash_browser_esm(str); + flattenTokenCache.set(token, str); + } + return str; +} +function token2key(token, salt) { + return hash_browser_esm("".concat(salt, "_").concat(flattenToken(token))); +} +"random-".concat(Date.now(), "-").concat(Math.random()).replace(/\./g, ''); +var isClientSide = canUseDom_canUseDom(); +function util_unit(num) { + if ('number' == typeof num) return "".concat(num, "px"); + return num; +} +function util_toStyleStr(style, tokenKey, styleId) { + var _objectSpread2; + var customizeAttrs = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {}; + var plain = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : false; + if (plain) return style; + var attrs = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, customizeAttrs), {}, (_objectSpread2 = {}, defineProperty_defineProperty(_objectSpread2, ATTR_TOKEN, tokenKey), defineProperty_defineProperty(_objectSpread2, ATTR_MARK, styleId), _objectSpread2)); + var attrStr = Object.keys(attrs).map(function(attr) { + var val = attrs[attr]; + return val ? "".concat(attr, "=\"").concat(val, "\"") : null; + }).filter(function(v) { + return v; + }).join(' '); + return ""); +} +var css_variables_token2CSSVar = function(token) { + var prefix = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : ''; + return "--".concat(prefix ? "".concat(prefix, "-") : '').concat(token).replace(/([a-z0-9])([A-Z])/g, '$1-$2').replace(/([A-Z]+)([A-Z][a-z0-9]+)/g, '$1-$2').replace(/([a-z])([A-Z0-9])/g, '$1-$2').toLowerCase(); +}; +var css_variables_serializeCSSVar = function(cssVars, hashId, options) { + if (!Object.keys(cssVars).length) return ''; + return ".".concat(hashId).concat(null != options && options.scope ? ".".concat(options.scope) : '', "{").concat(Object.entries(cssVars).map(function(_ref) { + var _ref2 = slicedToArray_slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1]; + return "".concat(key, ":").concat(value, ";"); + }).join(''), "}"); +}; +var css_variables_transformToken = function(token, themeKey, config) { + var cssVars = {}; + var result = {}; + Object.entries(token).forEach(function(_ref3) { + var _config$preserve, _config$ignore; + var _ref4 = slicedToArray_slicedToArray(_ref3, 2), key = _ref4[0], value = _ref4[1]; + if (null != config && null != (_config$preserve = config.preserve) && _config$preserve[key]) result[key] = value; + else if (('string' == typeof value || 'number' == typeof value) && !(null != config && null != (_config$ignore = config.ignore) && _config$ignore[key])) { + var _config$unitless; + var cssVar = css_variables_token2CSSVar(key, null == config ? void 0 : config.prefix); + cssVars[cssVar] = 'number' != typeof value || null != config && null != (_config$unitless = config.unitless) && _config$unitless[key] ? String(value) : "".concat(value, "px"); + result[key] = "var(".concat(cssVar, ")"); + } + }); + return [ + result, + css_variables_serializeCSSVar(cssVars, themeKey, { + scope: null == config ? void 0 : config.scope + }) + ]; +}; +var useCompatibleInsertionEffect_fullClone = objectSpread2_objectSpread2({}, __WEBPACK_EXTERNAL_MODULE_react__); +var useInsertionEffect = useCompatibleInsertionEffect_fullClone.useInsertionEffect; +var useCompatibleInsertionEffect_useInsertionEffectPolyfill = function(renderEffect, effect, deps) { + __WEBPACK_EXTERNAL_MODULE_react__.useMemo(renderEffect, deps); + hooks_useLayoutEffect(function() { + return effect(true); + }, deps); +}; +var useCompatibleInsertionEffect = useInsertionEffect ? function(renderEffect, effect, deps) { + return useInsertionEffect(function() { + renderEffect(); + return effect(); + }, deps); +} : useCompatibleInsertionEffect_useInsertionEffectPolyfill; +const hooks_useCompatibleInsertionEffect = useCompatibleInsertionEffect; +var useEffectCleanupRegister_fullClone = objectSpread2_objectSpread2({}, __WEBPACK_EXTERNAL_MODULE_react__); +var useEffectCleanupRegister_useInsertionEffect = useEffectCleanupRegister_fullClone.useInsertionEffect; +var useEffectCleanupRegister_useCleanupRegister = function(deps) { + var effectCleanups = []; + var cleanupFlag = false; + function register(fn) { + if (cleanupFlag) { + if ('production' !== process.env.NODE_ENV) warning_warning(false, '[Ant Design CSS-in-JS] You are registering a cleanup function after unmount, which will not have any effect.'); + return; + } + effectCleanups.push(fn); + } + __WEBPACK_EXTERNAL_MODULE_react__.useEffect(function() { + cleanupFlag = false; + return function() { + cleanupFlag = true; + if (effectCleanups.length) effectCleanups.forEach(function(fn) { + return fn(); + }); + }; + }, deps); + return register; +}; +var useEffectCleanupRegister_useRun = function() { + return function(fn) { + fn(); + }; +}; +var useEffectCleanupRegister_useEffectCleanupRegister = void 0 !== useEffectCleanupRegister_useInsertionEffect ? useEffectCleanupRegister_useCleanupRegister : useEffectCleanupRegister_useRun; +const useEffectCleanupRegister = useEffectCleanupRegister_useEffectCleanupRegister; +var useHMR = __webpack_require__("./node_modules/.pnpm/@ant-design+cssinjs@1.23.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@ant-design/cssinjs/es/hooks/useHMR.js"); +function useGlobalCache(prefix, keyPath, cacheFn, onCacheRemove, onCacheEffect) { + var _React$useContext = __WEBPACK_EXTERNAL_MODULE_react__.useContext(StyleContext), globalCache = _React$useContext.cache; + var fullPath = [ + prefix + ].concat(_toConsumableArray(keyPath)); + var fullPathStr = pathKey(fullPath); + var register = useEffectCleanupRegister([ + fullPathStr + ]); + var HMRUpdate = (0, useHMR.Z)(); + var buildCache = function(updater) { + globalCache.opUpdate(fullPathStr, function(prevCache) { + var _ref = prevCache || [ + void 0, + void 0 + ], _ref2 = slicedToArray_slicedToArray(_ref, 2), _ref2$ = _ref2[0], times = void 0 === _ref2$ ? 0 : _ref2$, cache = _ref2[1]; + var tmpCache = cache; + if ('production' !== process.env.NODE_ENV && cache && HMRUpdate) { + null == onCacheRemove || onCacheRemove(tmpCache, HMRUpdate); + tmpCache = null; + } + var mergedCache = tmpCache || cacheFn(); + var data = [ + times, + mergedCache + ]; + return updater ? updater(data) : data; + }); + }; + __WEBPACK_EXTERNAL_MODULE_react__.useMemo(function() { + buildCache(); + }, [ + fullPathStr + ]); + var cacheEntity = globalCache.opGet(fullPathStr); + if ('production' !== process.env.NODE_ENV && !cacheEntity) { + buildCache(); + cacheEntity = globalCache.opGet(fullPathStr); + } + var cacheContent = cacheEntity[1]; + hooks_useCompatibleInsertionEffect(function() { + null == onCacheEffect || onCacheEffect(cacheContent); + }, function(polyfill) { + buildCache(function(_ref3) { + var _ref4 = slicedToArray_slicedToArray(_ref3, 2), times = _ref4[0], cache = _ref4[1]; + if (polyfill && 0 === times) null == onCacheEffect || onCacheEffect(cacheContent); + return [ + times + 1, + cache + ]; + }); + return function() { + globalCache.opUpdate(fullPathStr, function(prevCache) { + var _ref5 = prevCache || [], _ref6 = slicedToArray_slicedToArray(_ref5, 2), _ref6$ = _ref6[0], times = void 0 === _ref6$ ? 0 : _ref6$, cache = _ref6[1]; + var nextCount = times - 1; + if (0 === nextCount) { + register(function() { + if (polyfill || !globalCache.opGet(fullPathStr)) null == onCacheRemove || onCacheRemove(cache, false); + }); + return null; + } + return [ + times - 1, + cache + ]; + }); + }; + }, [ + fullPathStr + ]); + return cacheContent; +} +var EMPTY_OVERRIDE = {}; +var hashPrefix = 'production' !== process.env.NODE_ENV ? 'css-dev-only-do-not-override' : 'css'; +var useCacheToken_tokenKeys = new Map(); +function recordCleanToken(tokenKey) { + useCacheToken_tokenKeys.set(tokenKey, (useCacheToken_tokenKeys.get(tokenKey) || 0) + 1); +} +function removeStyleTags(key, instanceId) { + if ('undefined' != typeof document) { + var styles = document.querySelectorAll("style[".concat(ATTR_TOKEN, "=\"").concat(key, "\"]")); + styles.forEach(function(style) { + if (style[CSS_IN_JS_INSTANCE] === instanceId) { + var _style$parentNode; + null == (_style$parentNode = style.parentNode) || _style$parentNode.removeChild(style); + } + }); + } +} +var TOKEN_THRESHOLD = 0; +function cleanTokenStyle(tokenKey, instanceId) { + useCacheToken_tokenKeys.set(tokenKey, (useCacheToken_tokenKeys.get(tokenKey) || 0) - 1); + var tokenKeyList = Array.from(useCacheToken_tokenKeys.keys()); + var cleanableKeyList = tokenKeyList.filter(function(key) { + var count = useCacheToken_tokenKeys.get(key) || 0; + return count <= 0; + }); + if (tokenKeyList.length - cleanableKeyList.length > TOKEN_THRESHOLD) cleanableKeyList.forEach(function(key) { + removeStyleTags(key, instanceId); + useCacheToken_tokenKeys.delete(key); + }); +} +var useCacheToken_getComputedToken = function(originToken, overrideToken, theme, format) { + var derivativeToken = theme.getDerivativeToken(originToken); + var mergedDerivativeToken = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, derivativeToken), overrideToken); + if (format) mergedDerivativeToken = format(mergedDerivativeToken); + return mergedDerivativeToken; +}; +var TOKEN_PREFIX = 'token'; +function useCacheToken(theme, tokens) { + var option = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}; + var _useContext = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(StyleContext), instanceId = _useContext.cache.instanceId, container = _useContext.container; + var _option$salt = option.salt, salt = void 0 === _option$salt ? '' : _option$salt, _option$override = option.override, override = void 0 === _option$override ? EMPTY_OVERRIDE : _option$override, formatToken = option.formatToken, compute = option.getComputedToken, cssVar = option.cssVar; + var mergedToken = memoResult(function() { + return Object.assign.apply(Object, [ + {} + ].concat(_toConsumableArray(tokens))); + }, tokens); + var tokenStr = flattenToken(mergedToken); + var overrideTokenStr = flattenToken(override); + var cssVarStr = cssVar ? flattenToken(cssVar) : ''; + var cachedToken = useGlobalCache(TOKEN_PREFIX, [ + salt, + theme.id, + tokenStr, + overrideTokenStr, + cssVarStr + ], function() { + var _cssVar$key; + var mergedDerivativeToken = compute ? compute(mergedToken, override, theme) : useCacheToken_getComputedToken(mergedToken, override, theme, formatToken); + var actualToken = objectSpread2_objectSpread2({}, mergedDerivativeToken); + var cssVarsStr = ''; + if (!!cssVar) { + var _transformToken = css_variables_transformToken(mergedDerivativeToken, cssVar.key, { + prefix: cssVar.prefix, + ignore: cssVar.ignore, + unitless: cssVar.unitless, + preserve: cssVar.preserve + }); + var _transformToken2 = slicedToArray_slicedToArray(_transformToken, 2); + mergedDerivativeToken = _transformToken2[0]; + cssVarsStr = _transformToken2[1]; + } + var tokenKey = token2key(mergedDerivativeToken, salt); + mergedDerivativeToken._tokenKey = tokenKey; + actualToken._tokenKey = token2key(actualToken, salt); + var themeKey = null != (_cssVar$key = null == cssVar ? void 0 : cssVar.key) ? _cssVar$key : tokenKey; + mergedDerivativeToken._themeKey = themeKey; + recordCleanToken(themeKey); + var hashId = "".concat(hashPrefix, "-").concat(hash_browser_esm(tokenKey)); + mergedDerivativeToken._hashId = hashId; + return [ + mergedDerivativeToken, + hashId, + actualToken, + cssVarsStr, + (null == cssVar ? void 0 : cssVar.key) || '' + ]; + }, function(cache) { + cleanTokenStyle(cache[0]._themeKey, instanceId); + }, function(_ref) { + var _ref2 = slicedToArray_slicedToArray(_ref, 4), token = _ref2[0], cssVarsStr = _ref2[3]; + if (cssVar && cssVarsStr) { + var style = dynamicCSS_updateCSS(cssVarsStr, hash_browser_esm("css-variables-".concat(token._themeKey)), { + mark: ATTR_MARK, + prepend: 'queue', + attachTo: container, + priority: -999 + }); + style[CSS_IN_JS_INSTANCE] = instanceId; + style.setAttribute(ATTR_TOKEN, token._themeKey); + } + }); + return cachedToken; +} +var useCacheToken_extract = function(cache, effectStyles, options) { + var _cache = slicedToArray_slicedToArray(cache, 5), realToken = _cache[2], styleStr = _cache[3], cssVarKey = _cache[4]; + var _ref3 = options || {}, plain = _ref3.plain; + if (!styleStr) return null; + var styleId = realToken._tokenKey; + var order = -999; + var sharedAttrs = { + 'data-rc-order': 'prependQueue', + 'data-rc-priority': "".concat(order) + }; + var styleText = util_toStyleStr(styleStr, cssVarKey, styleId, sharedAttrs, plain); + return [ + order, + styleId, + styleText + ]; +}; +var unitlessKeys = { + animationIterationCount: 1, + borderImageOutset: 1, + borderImageSlice: 1, + borderImageWidth: 1, + boxFlex: 1, + boxFlexGroup: 1, + boxOrdinalGroup: 1, + columnCount: 1, + columns: 1, + flex: 1, + flexGrow: 1, + flexPositive: 1, + flexShrink: 1, + flexNegative: 1, + flexOrder: 1, + gridRow: 1, + gridRowEnd: 1, + gridRowSpan: 1, + gridRowStart: 1, + gridColumn: 1, + gridColumnEnd: 1, + gridColumnSpan: 1, + gridColumnStart: 1, + msGridRow: 1, + msGridRowSpan: 1, + msGridColumn: 1, + msGridColumnSpan: 1, + fontWeight: 1, + lineHeight: 1, + opacity: 1, + order: 1, + orphans: 1, + tabSize: 1, + widows: 1, + zIndex: 1, + zoom: 1, + WebkitLineClamp: 1, + fillOpacity: 1, + floodOpacity: 1, + stopOpacity: 1, + strokeDasharray: 1, + strokeDashoffset: 1, + strokeMiterlimit: 1, + strokeOpacity: 1, + strokeWidth: 1 +}; +const unitless_browser_esm = unitlessKeys; +var COMMENT = 'comm'; +var RULESET = 'rule'; +var DECLARATION = 'decl'; +var IMPORT = '@import'; +var KEYFRAMES = '@keyframes'; +var LAYER = '@layer'; +var abs = Math.abs; +var Utility_from = String.fromCharCode; +function trim(value) { + return value.trim(); +} +function replace(value, pattern, replacement) { + return value.replace(pattern, replacement); +} +function indexof(value, search, position) { + return value.indexOf(search, position); +} +function charat(value, index) { + return 0 | value.charCodeAt(index); +} +function substr(value, begin, end) { + return value.slice(begin, end); +} +function strlen(value) { + return value.length; +} +function sizeof(value) { + return value.length; +} +function Utility_append(value, array) { + return array.push(value), value; +} +function serialize(children, callback) { + var output = ''; + for(var i = 0; i < children.length; i++)output += callback(children[i], i, children, callback) || ''; + return output; +} +function Serializer_stringify(element, index, children, callback) { + switch(element.type){ + case LAYER: + if (element.children.length) break; + case IMPORT: + case DECLARATION: + return element.return = element.return || element.value; + case COMMENT: + return ''; + case KEYFRAMES: + return element.return = element.value + '{' + serialize(element.children, callback) + '}'; + case RULESET: + if (!strlen(element.value = element.props.join(','))) return ''; + } + return strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''; +} +var line = 1; +var column = 1; +var Tokenizer_length = 0; +var Tokenizer_position = 0; +var Tokenizer_character = 0; +var Tokenizer_characters = ''; +function Tokenizer_node(value, root, parent, type, props, children, length, siblings) { + return { + value: value, + root: root, + parent: parent, + type: type, + props: props, + children: children, + line: line, + column: column, + length: length, + return: '', + siblings: siblings + }; +} +function Tokenizer_char() { + return Tokenizer_character; +} +function Tokenizer_prev() { + Tokenizer_character = Tokenizer_position > 0 ? charat(Tokenizer_characters, --Tokenizer_position) : 0; + if (column--, 10 === Tokenizer_character) column = 1, line--; + return Tokenizer_character; +} +function Tokenizer_next() { + Tokenizer_character = Tokenizer_position < Tokenizer_length ? charat(Tokenizer_characters, Tokenizer_position++) : 0; + if (column++, 10 === Tokenizer_character) column = 1, line++; + return Tokenizer_character; +} +function peek() { + return charat(Tokenizer_characters, Tokenizer_position); +} +function caret() { + return Tokenizer_position; +} +function slice(begin, end) { + return substr(Tokenizer_characters, begin, end); +} +function Tokenizer_token(type) { + switch(type){ + case 0: + case 9: + case 10: + case 13: + case 32: + return 5; + case 33: + case 43: + case 44: + case 47: + case 62: + case 64: + case 126: + case 59: + case 123: + case 125: + return 4; + case 58: + return 3; + case 34: + case 39: + case 40: + case 91: + return 2; + case 41: + case 93: + return 1; + } + return 0; +} +function alloc(value) { + return line = column = 1, Tokenizer_length = strlen(Tokenizer_characters = value), Tokenizer_position = 0, []; +} +function dealloc(value) { + return Tokenizer_characters = '', value; +} +function delimit(type) { + return trim(slice(Tokenizer_position - 1, delimiter(91 === type ? type + 2 : 40 === type ? type + 1 : type))); +} +function Tokenizer_whitespace(type) { + while(Tokenizer_character = peek())if (Tokenizer_character < 33) Tokenizer_next(); + else break; + return Tokenizer_token(type) > 2 || Tokenizer_token(Tokenizer_character) > 3 ? '' : ' '; +} +function escaping(index, count) { + while(--count && Tokenizer_next())if (Tokenizer_character < 48 || Tokenizer_character > 102 || Tokenizer_character > 57 && Tokenizer_character < 65 || Tokenizer_character > 70 && Tokenizer_character < 97) break; + return slice(index, caret() + (count < 6 && 32 == peek() && 32 == Tokenizer_next())); +} +function delimiter(type) { + while(Tokenizer_next())switch(Tokenizer_character){ + case type: + return Tokenizer_position; + case 34: + case 39: + if (34 !== type && 39 !== type) delimiter(Tokenizer_character); + break; + case 40: + if (41 === type) delimiter(type); + break; + case 92: + Tokenizer_next(); + break; + } + return Tokenizer_position; +} +function commenter(type, index) { + while(Tokenizer_next())if (type + Tokenizer_character === 57) break; + else if (type + Tokenizer_character === 84 && 47 === peek()) break; + return '/*' + slice(index, Tokenizer_position - 1) + '*' + Utility_from(47 === type ? type : Tokenizer_next()); +} +function identifier(index) { + while(!Tokenizer_token(peek()))Tokenizer_next(); + return slice(index, Tokenizer_position); +} +function compile(value) { + return dealloc(parse('', null, null, null, [ + '' + ], value = alloc(value), 0, [ + 0 + ], value)); +} +function parse(value, root, parent, rule, rules, rulesets, pseudo, points, declarations) { + var index = 0; + var offset = 0; + var length = pseudo; + var atrule = 0; + var property = 0; + var previous = 0; + var variable = 1; + var scanning = 1; + var ampersand = 1; + var character = 0; + var type = ''; + var props = rules; + var children = rulesets; + var reference = rule; + var characters = type; + while(scanning)switch(previous = character, character = Tokenizer_next()){ + case 40: + if (108 != previous && 58 == charat(characters, length - 1)) { + if (-1 != indexof(characters += replace(delimit(character), '&', '&\f'), '&\f', abs(index ? points[index - 1] : 0))) ampersand = -1; + break; + } + case 34: + case 39: + case 91: + characters += delimit(character); + break; + case 9: + case 10: + case 13: + case 32: + characters += Tokenizer_whitespace(previous); + break; + case 92: + characters += escaping(caret() - 1, 7); + continue; + case 47: + switch(peek()){ + case 42: + case 47: + Utility_append(comment(commenter(Tokenizer_next(), caret()), root, parent, declarations), declarations); + if ((5 == Tokenizer_token(previous || 1) || 5 == Tokenizer_token(peek() || 1)) && strlen(characters) && ' ' !== substr(characters, -1, void 0)) characters += ' '; + break; + default: + characters += '/'; + } + break; + case 123 * variable: + points[index++] = strlen(characters) * ampersand; + case 125 * variable: + case 59: + case 0: + switch(character){ + case 0: + case 125: + scanning = 0; + case 59 + offset: + if (-1 == ampersand) characters = replace(characters, /\f/g, ''); + if (property > 0 && (strlen(characters) - length || 0 === variable && 47 === previous)) Utility_append(property > 32 ? declaration(characters + ';', rule, parent, length - 1, declarations) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2, declarations), declarations); + break; + case 59: + characters += ';'; + default: + Utility_append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length, rulesets), rulesets); + if (123 === character) if (0 === offset) parse(characters, root, reference, reference, props, rulesets, length, points, children); + else switch(99 === atrule && 110 === charat(characters, 3) ? 100 : atrule){ + case 100: + case 108: + case 109: + case 115: + parse(value, reference, reference, rule && Utility_append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length, children), children), rules, children, length, points, rule ? props : children); + break; + default: + parse(characters, reference, reference, reference, [ + '' + ], children, 0, points, children); + } + } + index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo; + break; + case 58: + length = 1 + strlen(characters), property = previous; + default: + if (variable < 1) { + if (123 == character) --variable; + else if (125 == character && 0 == variable++ && 125 == Tokenizer_prev()) continue; + } + switch(characters += Utility_from(character), character * variable){ + case 38: + ampersand = offset > 0 ? 1 : (characters += '\f', -1); + break; + case 44: + points[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1; + break; + case 64: + if (45 === peek()) characters += delimit(Tokenizer_next()); + atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++; + break; + case 45: + if (45 === previous && 2 == strlen(characters)) variable = 0; + } + } + return rulesets; +} +function ruleset(value, root, parent, index, offset, rules, points, type, props, children, length, siblings) { + var post = offset - 1; + var rule = 0 === offset ? rules : [ + '' + ]; + var size = sizeof(rule); + for(var i = 0, j = 0, k = 0; i < index; ++i)for(var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)if (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\f/g, rule[x]))) props[k++] = z; + return Tokenizer_node(value, root, parent, 0 === offset ? RULESET : type, props, children, length, siblings); +} +function comment(value, root, parent, siblings) { + return Tokenizer_node(value, root, parent, COMMENT, Utility_from(Tokenizer_char()), substr(value, 2, -2), 0, siblings); +} +function declaration(value, root, parent, length, siblings) { + return Tokenizer_node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length, siblings); +} +function utils_lintWarning(message, info) { + var path = info.path, parentSelectors = info.parentSelectors; + es_warning(false, "[Ant Design CSS-in-JS] ".concat(path ? "Error in ".concat(path, ": ") : '').concat(message).concat(parentSelectors.length ? " Selector: ".concat(parentSelectors.join(' | ')) : '')); +} +var contentQuotesLinter_linter = function(key, value, info) { + if ('content' === key) { + var contentValuePattern = /(attr|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/; + var contentValues = [ + 'normal', + 'none', + 'initial', + 'inherit', + 'unset' + ]; + if ('string' != typeof value || -1 === contentValues.indexOf(value) && !contentValuePattern.test(value) && (value.charAt(0) !== value.charAt(value.length - 1) || '"' !== value.charAt(0) && "'" !== value.charAt(0))) utils_lintWarning("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"".concat(value, "\"'`."), info); + } +}; +const contentQuotesLinter = contentQuotesLinter_linter; +var hashedAnimationLinter_linter = function(key, value, info) { + if ('animation' === key) { + if (info.hashId && 'none' !== value) utils_lintWarning("You seem to be using hashed animation '".concat(value, "', in which case 'animationName' with Keyframe as value is recommended."), info); + } +}; +const hashedAnimationLinter = hashedAnimationLinter_linter; +var cacheMapUtil_ATTR_CACHE_MAP = 'data-ant-cssinjs-cache-path'; +var CSS_FILE_STYLE = '_FILE_STYLE__'; +var cacheMapUtil_cachePathMap; +var fromCSSFile = true; +function prepare() { + if (!cacheMapUtil_cachePathMap) { + cacheMapUtil_cachePathMap = {}; + if (canUseDom_canUseDom()) { + var div = document.createElement('div'); + div.className = cacheMapUtil_ATTR_CACHE_MAP; + div.style.position = 'fixed'; + div.style.visibility = 'hidden'; + div.style.top = '-9999px'; + document.body.appendChild(div); + var content = getComputedStyle(div).content || ''; + content = content.replace(/^"/, '').replace(/"$/, ''); + content.split(';').forEach(function(item) { + var _item$split = item.split(':'), _item$split2 = slicedToArray_slicedToArray(_item$split, 2), path = _item$split2[0], hash = _item$split2[1]; + cacheMapUtil_cachePathMap[path] = hash; + }); + var inlineMapStyle = document.querySelector("style[".concat(cacheMapUtil_ATTR_CACHE_MAP, "]")); + if (inlineMapStyle) { + var _inlineMapStyle$paren; + fromCSSFile = false; + null == (_inlineMapStyle$paren = inlineMapStyle.parentNode) || _inlineMapStyle$paren.removeChild(inlineMapStyle); + } + document.body.removeChild(div); + } + } +} +function existPath(path) { + prepare(); + return !!cacheMapUtil_cachePathMap[path]; +} +function getStyleAndHash(path) { + var hash = cacheMapUtil_cachePathMap[path]; + var styleStr = null; + if (hash && canUseDom_canUseDom()) if (fromCSSFile) styleStr = CSS_FILE_STYLE; + else { + var _style = document.querySelector("style[".concat(ATTR_MARK, "=\"").concat(cacheMapUtil_cachePathMap[path], "\"]")); + if (_style) styleStr = _style.innerHTML; + else delete cacheMapUtil_cachePathMap[path]; + } + return [ + styleStr, + hash + ]; +} +var SKIP_CHECK = '_skip_check_'; +var MULTI_VALUE = '_multi_value_'; +function normalizeStyle(styleStr) { + var serialized = serialize(compile(styleStr), Serializer_stringify); + return serialized.replace(/\{%%%\:[^;];}/g, ';'); +} +function isCompoundCSSProperty(value) { + return 'object' === typeof_typeof(value) && value && (SKIP_CHECK in value || MULTI_VALUE in value); +} +function injectSelectorHash(key, hashId, hashPriority) { + if (!hashId) return key; + var hashClassName = ".".concat(hashId); + var hashSelector = 'low' === hashPriority ? ":where(".concat(hashClassName, ")") : hashClassName; + var keys = key.split(',').map(function(k) { + var _firstPath$match; + var fullPath = k.trim().split(/\s+/); + var firstPath = fullPath[0] || ''; + var htmlElement = (null == (_firstPath$match = firstPath.match(/^\w+/)) ? void 0 : _firstPath$match[0]) || ''; + firstPath = "".concat(htmlElement).concat(hashSelector).concat(firstPath.slice(htmlElement.length)); + return [ + firstPath + ].concat(_toConsumableArray(fullPath.slice(1))).join(' '); + }); + return keys.join(','); +} +var useStyleRegister_parseStyle = function parseStyle(interpolation) { + var config = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + var _ref = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : { + root: true, + parentSelectors: [] + }, root = _ref.root, injectHash = _ref.injectHash, parentSelectors = _ref.parentSelectors; + var hashId = config.hashId, layer = config.layer, path = config.path, hashPriority = config.hashPriority, _config$transformers = config.transformers, transformers = void 0 === _config$transformers ? [] : _config$transformers, _config$linters = config.linters, linters = void 0 === _config$linters ? [] : _config$linters; + var styleStr = ''; + var effectStyle = {}; + function parseKeyframes(keyframes) { + var animationName = keyframes.getName(hashId); + if (!effectStyle[animationName]) { + var _parseStyle = parseStyle(keyframes.style, config, { + root: false, + parentSelectors: parentSelectors + }), _parseStyle2 = slicedToArray_slicedToArray(_parseStyle, 1), _parsedStr = _parseStyle2[0]; + effectStyle[animationName] = "@keyframes ".concat(keyframes.getName(hashId)).concat(_parsedStr); + } + } + function flattenList(list) { + var fullList = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : []; + list.forEach(function(item) { + if (Array.isArray(item)) flattenList(item, fullList); + else if (item) fullList.push(item); + }); + return fullList; + } + var flattenStyleList = flattenList(Array.isArray(interpolation) ? interpolation : [ + interpolation + ]); + flattenStyleList.forEach(function(originStyle) { + var style = 'string' != typeof originStyle || root ? originStyle : {}; + if ('string' == typeof style) styleStr += "".concat(style, "\n"); + else if (style._keyframe) parseKeyframes(style); + else { + var mergedStyle = transformers.reduce(function(prev, trans) { + var _trans$visit; + return (null == trans || null == (_trans$visit = trans.visit) ? void 0 : _trans$visit.call(trans, prev)) || prev; + }, style); + Object.keys(mergedStyle).forEach(function(key) { + var value = mergedStyle[key]; + if ('object' !== typeof_typeof(value) || !value || 'animationName' === key && value._keyframe || isCompoundCSSProperty(value)) { + var _value; + function appendStyle(cssKey, cssValue) { + if ('production' !== process.env.NODE_ENV && ('object' !== typeof_typeof(value) || !(null != value && value[SKIP_CHECK]))) [ + contentQuotesLinter, + hashedAnimationLinter + ].concat(_toConsumableArray(linters)).forEach(function(linter) { + return linter(cssKey, cssValue, { + path: path, + hashId: hashId, + parentSelectors: parentSelectors + }); + }); + var styleName = cssKey.replace(/[A-Z]/g, function(match) { + return "-".concat(match.toLowerCase()); + }); + var formatValue = cssValue; + if (!unitless_browser_esm[cssKey] && 'number' == typeof formatValue && 0 !== formatValue) formatValue = "".concat(formatValue, "px"); + if ('animationName' === cssKey && null != cssValue && cssValue._keyframe) { + parseKeyframes(cssValue); + formatValue = cssValue.getName(hashId); + } + styleStr += "".concat(styleName, ":").concat(formatValue, ";"); + } + var actualValue = null != (_value = null == value ? void 0 : value.value) ? _value : value; + if ('object' === typeof_typeof(value) && null != value && value[MULTI_VALUE] && Array.isArray(actualValue)) actualValue.forEach(function(item) { + appendStyle(key, item); + }); + else appendStyle(key, actualValue); + } else { + var subInjectHash = false; + var mergedKey = key.trim(); + var nextRoot = false; + if ((root || injectHash) && hashId) if (mergedKey.startsWith('@')) subInjectHash = true; + else mergedKey = '&' === mergedKey ? injectSelectorHash('', hashId, hashPriority) : injectSelectorHash(key, hashId, hashPriority); + else if (root && !hashId && ('&' === mergedKey || '' === mergedKey)) { + mergedKey = ''; + nextRoot = true; + } + var _parseStyle3 = parseStyle(value, config, { + root: nextRoot, + injectHash: subInjectHash, + parentSelectors: [].concat(_toConsumableArray(parentSelectors), [ + mergedKey + ]) + }), _parseStyle4 = slicedToArray_slicedToArray(_parseStyle3, 2), _parsedStr2 = _parseStyle4[0], childEffectStyle = _parseStyle4[1]; + effectStyle = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, effectStyle), childEffectStyle); + styleStr += "".concat(mergedKey).concat(_parsedStr2); + } + }); + } + }); + if (root) { + if (layer) { + if (styleStr) styleStr = "@layer ".concat(layer.name, " {").concat(styleStr, "}"); + if (layer.dependencies) effectStyle["@layer ".concat(layer.name)] = layer.dependencies.map(function(deps) { + return "@layer ".concat(deps, ", ").concat(layer.name, ";"); + }).join('\n'); + } + } else styleStr = "{".concat(styleStr, "}"); + return [ + styleStr, + effectStyle + ]; +}; +function uniqueHash(path, styleStr) { + return hash_browser_esm("".concat(path.join('%')).concat(styleStr)); +} +function Empty() { + return null; +} +var STYLE_PREFIX = 'style'; +function useStyleRegister(info, styleFn) { + var token = info.token, path = info.path, hashId = info.hashId, layer = info.layer, nonce = info.nonce, clientOnly = info.clientOnly, _info$order = info.order, order = void 0 === _info$order ? 0 : _info$order; + var _React$useContext = __WEBPACK_EXTERNAL_MODULE_react__.useContext(StyleContext), autoClear = _React$useContext.autoClear, mock = _React$useContext.mock, defaultCache = _React$useContext.defaultCache, hashPriority = _React$useContext.hashPriority, container = _React$useContext.container, ssrInline = _React$useContext.ssrInline, transformers = _React$useContext.transformers, linters = _React$useContext.linters, cache = _React$useContext.cache, enableLayer = _React$useContext.layer; + var tokenKey = token._tokenKey; + var fullPath = [ + tokenKey + ]; + if (enableLayer) fullPath.push('layer'); + fullPath.push.apply(fullPath, _toConsumableArray(path)); + var isMergedClientSide = isClientSide; + if ('production' !== process.env.NODE_ENV && void 0 !== mock) isMergedClientSide = 'client' === mock; + var _useGlobalCache = useGlobalCache(STYLE_PREFIX, fullPath, function() { + var cachePath = fullPath.join('|'); + if (existPath(cachePath)) { + var _getStyleAndHash = getStyleAndHash(cachePath), _getStyleAndHash2 = slicedToArray_slicedToArray(_getStyleAndHash, 2), inlineCacheStyleStr = _getStyleAndHash2[0], styleHash = _getStyleAndHash2[1]; + if (inlineCacheStyleStr) return [ + inlineCacheStyleStr, + tokenKey, + styleHash, + {}, + clientOnly, + order + ]; + } + var styleObj = styleFn(); + var _parseStyle5 = useStyleRegister_parseStyle(styleObj, { + hashId: hashId, + hashPriority: hashPriority, + layer: enableLayer ? layer : void 0, + path: path.join('-'), + transformers: transformers, + linters: linters + }), _parseStyle6 = slicedToArray_slicedToArray(_parseStyle5, 2), parsedStyle = _parseStyle6[0], effectStyle = _parseStyle6[1]; + var styleStr = normalizeStyle(parsedStyle); + var styleId = uniqueHash(fullPath, styleStr); + return [ + styleStr, + tokenKey, + styleId, + effectStyle, + clientOnly, + order + ]; + }, function(_ref2, fromHMR) { + var _ref3 = slicedToArray_slicedToArray(_ref2, 3), styleId = _ref3[2]; + if ((fromHMR || autoClear) && isClientSide) dynamicCSS_removeCSS(styleId, { + mark: ATTR_MARK + }); + }, function(_ref4) { + var _ref5 = slicedToArray_slicedToArray(_ref4, 4), styleStr = _ref5[0], styleId = (_ref5[1], _ref5[2]), effectStyle = _ref5[3]; + if (isMergedClientSide && styleStr !== CSS_FILE_STYLE) { + var mergedCSSConfig = { + mark: ATTR_MARK, + prepend: enableLayer ? false : 'queue', + attachTo: container, + priority: order + }; + var nonceStr = 'function' == typeof nonce ? nonce() : nonce; + if (nonceStr) mergedCSSConfig.csp = { + nonce: nonceStr + }; + var effectLayerKeys = []; + var effectRestKeys = []; + Object.keys(effectStyle).forEach(function(key) { + if (key.startsWith('@layer')) effectLayerKeys.push(key); + else effectRestKeys.push(key); + }); + effectLayerKeys.forEach(function(effectKey) { + dynamicCSS_updateCSS(normalizeStyle(effectStyle[effectKey]), "_layer-".concat(effectKey), objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, mergedCSSConfig), {}, { + prepend: true + })); + }); + var style = dynamicCSS_updateCSS(styleStr, styleId, mergedCSSConfig); + style[CSS_IN_JS_INSTANCE] = cache.instanceId; + style.setAttribute(ATTR_TOKEN, tokenKey); + if ('production' !== process.env.NODE_ENV) style.setAttribute(ATTR_CACHE_PATH, fullPath.join('|')); + effectRestKeys.forEach(function(effectKey) { + dynamicCSS_updateCSS(normalizeStyle(effectStyle[effectKey]), "_effect-".concat(effectKey), mergedCSSConfig); + }); + } + }), _useGlobalCache2 = slicedToArray_slicedToArray(_useGlobalCache, 3), cachedStyleStr = _useGlobalCache2[0], cachedTokenKey = _useGlobalCache2[1], cachedStyleId = _useGlobalCache2[2]; + return function(node) { + var styleNode; + if (ssrInline && !isMergedClientSide && defaultCache) { + var _ref6; + styleNode = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("style", _extends({}, (_ref6 = {}, defineProperty_defineProperty(_ref6, ATTR_TOKEN, cachedTokenKey), defineProperty_defineProperty(_ref6, ATTR_MARK, cachedStyleId), _ref6), { + dangerouslySetInnerHTML: { + __html: cachedStyleStr + } + })); + } else styleNode = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(Empty, null); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(__WEBPACK_EXTERNAL_MODULE_react__.Fragment, null, styleNode, node); + }; +} +var useStyleRegister_extract = function(cache, effectStyles, options) { + var _cache = slicedToArray_slicedToArray(cache, 6), styleStr = _cache[0], tokenKey = _cache[1], styleId = _cache[2], effectStyle = _cache[3], clientOnly = _cache[4], order = _cache[5]; + var _ref7 = options || {}, plain = _ref7.plain; + if (clientOnly) return null; + var keyStyleText = styleStr; + var sharedAttrs = { + 'data-rc-order': 'prependQueue', + 'data-rc-priority': "".concat(order) + }; + keyStyleText = util_toStyleStr(styleStr, tokenKey, styleId, sharedAttrs, plain); + if (effectStyle) Object.keys(effectStyle).forEach(function(effectKey) { + if (!effectStyles[effectKey]) { + effectStyles[effectKey] = true; + var effectStyleStr = normalizeStyle(effectStyle[effectKey]); + var effectStyleHTML = util_toStyleStr(effectStyleStr, tokenKey, "_effect-".concat(effectKey), sharedAttrs, plain); + if (effectKey.startsWith('@layer')) keyStyleText = effectStyleHTML + keyStyleText; + else keyStyleText += effectStyleHTML; + } + }); + return [ + order, + styleId, + keyStyleText + ]; +}; +var CSS_VAR_PREFIX = 'cssVar'; +var useCSSVarRegister_useCSSVarRegister = function(config, fn) { + var key = config.key, prefix = config.prefix, unitless = config.unitless, ignore = config.ignore, token = config.token, _config$scope = config.scope, scope = void 0 === _config$scope ? '' : _config$scope; + var _useContext = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(StyleContext), instanceId = _useContext.cache.instanceId, container = _useContext.container; + var tokenKey = token._tokenKey; + var stylePath = [].concat(_toConsumableArray(config.path), [ + key, + scope, + tokenKey + ]); + var cache = useGlobalCache(CSS_VAR_PREFIX, stylePath, function() { + var originToken = fn(); + var _transformToken = css_variables_transformToken(originToken, key, { + prefix: prefix, + unitless: unitless, + ignore: ignore, + scope: scope + }), _transformToken2 = slicedToArray_slicedToArray(_transformToken, 2), mergedToken = _transformToken2[0], cssVarsStr = _transformToken2[1]; + var styleId = uniqueHash(stylePath, cssVarsStr); + return [ + mergedToken, + cssVarsStr, + styleId, + key + ]; + }, function(_ref) { + var _ref2 = slicedToArray_slicedToArray(_ref, 3), styleId = _ref2[2]; + if (isClientSide) dynamicCSS_removeCSS(styleId, { + mark: ATTR_MARK + }); + }, function(_ref3) { + var _ref4 = slicedToArray_slicedToArray(_ref3, 3), cssVarsStr = _ref4[1], styleId = _ref4[2]; + if (!cssVarsStr) return; + var style = dynamicCSS_updateCSS(cssVarsStr, styleId, { + mark: ATTR_MARK, + prepend: 'queue', + attachTo: container, + priority: -999 + }); + style[CSS_IN_JS_INSTANCE] = instanceId; + style.setAttribute(ATTR_TOKEN, key); + }); + return cache; +}; +var useCSSVarRegister_extract = function(cache, effectStyles, options) { + var _cache = slicedToArray_slicedToArray(cache, 4), styleStr = _cache[1], styleId = _cache[2], cssVarKey = _cache[3]; + var _ref5 = options || {}, plain = _ref5.plain; + if (!styleStr) return null; + var order = -999; + var sharedAttrs = { + 'data-rc-order': 'prependQueue', + 'data-rc-priority': "".concat(order) + }; + var styleText = util_toStyleStr(styleStr, cssVarKey, styleId, sharedAttrs, plain); + return [ + order, + styleId, + styleText + ]; +}; +const hooks_useCSSVarRegister = useCSSVarRegister_useCSSVarRegister; +var _ExtractStyleFns; +_ExtractStyleFns = {}, defineProperty_defineProperty(_ExtractStyleFns, STYLE_PREFIX, useStyleRegister_extract), defineProperty_defineProperty(_ExtractStyleFns, TOKEN_PREFIX, useCacheToken_extract), defineProperty_defineProperty(_ExtractStyleFns, CSS_VAR_PREFIX, useCSSVarRegister_extract); +var Keyframes_Keyframe = /*#__PURE__*/ function() { + function Keyframe(name, style) { + classCallCheck_classCallCheck(this, Keyframe); + defineProperty_defineProperty(this, "name", void 0); + defineProperty_defineProperty(this, "style", void 0); + defineProperty_defineProperty(this, "_keyframe", true); + this.name = name; + this.style = style; + } + createClass_createClass(Keyframe, [ + { + key: "getName", + value: function() { + var hashId = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : ''; + return hashId ? "".concat(hashId, "-").concat(this.name) : this.name; + } + } + ]); + return Keyframe; +}(); +const Keyframes = Keyframes_Keyframe; +function noSplit(list) { + list.notSplit = true; + return list; +} +noSplit([ + 'borderTop', + 'borderBottom' +]), noSplit([ + 'borderTop' +]), noSplit([ + 'borderBottom' +]), noSplit([ + 'borderLeft', + 'borderRight' +]), noSplit([ + 'borderLeft' +]), noSplit([ + 'borderRight' +]); +const version = '5.26.3'; +"use client"; +const es_version = version; +const defaultPresetColors = { + blue: '#1677FF', + purple: '#722ED1', + cyan: '#13C2C2', + green: '#52C41A', + magenta: '#EB2F96', + pink: '#EB2F96', + red: '#F5222D', + orange: '#FA8C16', + yellow: '#FADB14', + volcano: '#FA541C', + geekblue: '#2F54EB', + gold: '#FAAD14', + lime: '#A0D911' +}; +const seedToken = Object.assign(Object.assign({}, defaultPresetColors), { + colorPrimary: '#1677ff', + colorSuccess: '#52c41a', + colorWarning: '#faad14', + colorError: '#ff4d4f', + colorInfo: '#1677ff', + colorLink: '', + colorTextBase: '', + colorBgBase: '', + fontFamily: `-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, +'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', +'Noto Color Emoji'`, + fontFamilyCode: "'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace", + fontSize: 14, + lineWidth: 1, + lineType: 'solid', + motionUnit: 0.1, + motionBase: 0, + motionEaseOutCirc: 'cubic-bezier(0.08, 0.82, 0.17, 1)', + motionEaseInOutCirc: 'cubic-bezier(0.78, 0.14, 0.15, 0.86)', + motionEaseOut: 'cubic-bezier(0.215, 0.61, 0.355, 1)', + motionEaseInOut: 'cubic-bezier(0.645, 0.045, 0.355, 1)', + motionEaseOutBack: 'cubic-bezier(0.12, 0.4, 0.29, 1.46)', + motionEaseInBack: 'cubic-bezier(0.71, -0.46, 0.88, 0.6)', + motionEaseInQuint: 'cubic-bezier(0.755, 0.05, 0.855, 0.06)', + motionEaseOutQuint: 'cubic-bezier(0.23, 1, 0.32, 1)', + borderRadius: 6, + sizeUnit: 4, + sizeStep: 4, + sizePopupArrow: 16, + controlHeight: 32, + zIndexBase: 0, + zIndexPopupBase: 1000, + opacityImage: 1, + wireframe: false, + motion: true +}); +const themes_seed = seedToken; +const defaultConfig = { + token: themes_seed, + override: { + override: themes_seed + }, + hashed: true +}; +const DesignTokenContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createContext(defaultConfig); +const round = Math.round; +function splitColorStr(str, parseNum) { + const match = str.replace(/^[^(]*\((.*)/, '$1').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); + if (match[3]) numList[3] = match[3].includes('%') ? numList[3] / 100 : numList[3]; + else numList[3] = 1; + return numList; +} +const parseHSVorHSL = (num, _, index)=>0 === index ? num : num / 100; +function limitRange(value, max) { + const mergedMax = max || 255; + if (value > mergedMax) return mergedMax; + if (value < 0) return 0; + return value; +} +class FastColor { + constructor(input){ + defineProperty_defineProperty(this, "isValid", true); + defineProperty_defineProperty(this, "r", 0); + defineProperty_defineProperty(this, "g", 0); + defineProperty_defineProperty(this, "b", 0); + defineProperty_defineProperty(this, "a", 1); + defineProperty_defineProperty(this, "_h", void 0); + defineProperty_defineProperty(this, "_s", void 0); + defineProperty_defineProperty(this, "_l", void 0); + defineProperty_defineProperty(this, "_v", void 0); + defineProperty_defineProperty(this, "_max", void 0); + defineProperty_defineProperty(this, "_min", void 0); + defineProperty_defineProperty(this, "_brightness", void 0); + function matchFormat(str) { + return str[0] in input && str[1] in input && str[2] in input; + } + if (input) if ('string' == typeof input) { + 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 = 'number' == typeof input.a ? 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)); + } + 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); + } + 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 (void 0 === this._h) { + const delta = this.getMax() - this.getMin(); + if (0 === delta) 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 (void 0 === this._s) { + const delta = this.getMax() - this.getMin(); + if (0 === delta) this._s = 0; + else this._s = delta / this.getMax(); + } + return this._s; + } + getLightness() { + if (void 0 === this._l) this._l = (this.getMax() + this.getMin()) / 510; + return this._l; + } + getValue() { + if (void 0 === this._v) this._v = this.getMax() / 255; + return this._v; + } + getBrightness() { + if (void 0 === this._brightness) this._brightness = (299 * this.r + 587 * this.g + 114 * this.b) / 1000; + return this._brightness; + } + 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(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(100 * calc('a')) / 100 + }; + return this._c(rgba); + } + tint(amount = 10) { + return this.mix({ + r: 255, + g: 255, + b: 255, + a: 1 + }, amount); + } + 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)=>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 + }); + } + isDark() { + return this.getBrightness() < 128; + } + isLight() { + return this.getBrightness() >= 128; + } + equals(other) { + return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a; + } + clone() { + return this._c(this); + } + toHexString() { + let hex = '#'; + const rHex = (this.r || 0).toString(16); + hex += 2 === rHex.length ? rHex : '0' + rHex; + const gHex = (this.g || 0).toString(16); + hex += 2 === gHex.length ? gHex : '0' + gHex; + const bHex = (this.b || 0).toString(16); + hex += 2 === bHex.length ? bHex : '0' + bHex; + if ('number' == typeof this.a && this.a >= 0 && this.a < 1) { + const aHex = round(255 * this.a).toString(16); + hex += 2 === aHex.length ? aHex : '0' + aHex; + } + return hex; + } + toHsl() { + return { + h: this.getHue(), + s: this.getSaturation(), + l: this.getLightness(), + a: this.a + }; + } + toHslString() { + const h = this.getHue(); + const s = round(100 * this.getSaturation()); + const l = round(100 * this.getLightness()); + return 1 !== this.a ? `hsla(${h},${s}%,${l}%,${this.a})` : `hsl(${h},${s}%,${l}%)`; + } + 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 1 !== this.a ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`; + } + toString() { + return this.toRgbString(); + } + _sc(rgb, value, max) { + const clone = this.clone(); + clone[rgb] = limitRange(value, max); + return clone; + } + _c(input) { + return new this.constructor(input); + } + getMax() { + if (void 0 === this._max) this._max = Math.max(this.r, this.g, this.b); + return this._max; + } + getMin() { + if (void 0 === this._min) 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) { + this.r = connectNum(0); + this.g = connectNum(1); + this.b = connectNum(2); + this.a = withoutPrefix[3] ? connectNum(3) / 255 : 1; + } else { + 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 = 'number' == typeof a ? a : 1; + if (s <= 0) { + const rgb = round(255 * l); + 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 = 'number' == typeof a ? a : 1; + const vv = round(255 * v); + 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], + a: cells[3] + }); + } + fromHslString(trimStr) { + const cells = splitColorStr(trimStr, parseHSVorHSL); + this.fromHsl({ + h: cells[0], + s: cells[1], + l: cells[2], + a: cells[3] + }); + } + fromRgbString(trimStr) { + const cells = splitColorStr(trimStr, (num, txt)=>txt.includes('%') ? round(num / 100 * 255) : num); + this.r = cells[0]; + this.g = cells[1]; + this.b = cells[2]; + this.a = cells[3]; + } +} +var hueStep = 2; +var saturationStep = 0.16; +var saturationStep2 = 0.05; +var brightnessStep1 = 0.05; +var brightnessStep2 = 0.15; +var lightColorCount = 5; +var darkColorCount = 4; +var darkColorMap = [ + { + index: 7, + amount: 15 + }, + { + index: 6, + amount: 25 + }, + { + index: 5, + amount: 30 + }, + { + index: 5, + amount: 45 + }, + { + index: 5, + amount: 65 + }, + { + index: 5, + amount: 85 + }, + { + index: 4, + amount: 90 + }, + { + index: 3, + amount: 95 + }, + { + index: 2, + amount: 97 + }, + { + index: 1, + amount: 98 + } +]; +function getHue(hsv, i, light) { + var hue; + hue = Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240 ? light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i : light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i; + if (hue < 0) hue += 360; + else if (hue >= 360) hue -= 360; + return hue; +} +function getSaturation(hsv, i, light) { + if (0 === hsv.h && 0 === hsv.s) return hsv.s; + var saturation; + saturation = light ? hsv.s - saturationStep * i : i === darkColorCount ? hsv.s + saturationStep : hsv.s + saturationStep2 * i; + if (saturation > 1) saturation = 1; + if (light && i === lightColorCount && saturation > 0.1) saturation = 0.1; + if (saturation < 0.06) saturation = 0.06; + return Math.round(100 * saturation) / 100; +} +function generate_getValue(hsv, i, light) { + var value; + value = light ? hsv.v + brightnessStep1 * i : hsv.v - brightnessStep2 * i; + value = Math.max(0, Math.min(1, value)); + return Math.round(100 * value) / 100; +} +function generate(color) { + var opts = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + var patterns = []; + var pColor = new FastColor(color); + var hsv = pColor.toHsv(); + for(var i = lightColorCount; i > 0; i -= 1){ + var c = new FastColor({ + h: getHue(hsv, i, true), + s: getSaturation(hsv, i, true), + v: generate_getValue(hsv, i, true) + }); + patterns.push(c); + } + patterns.push(pColor); + for(var _i = 1; _i <= darkColorCount; _i += 1){ + var _c = new FastColor({ + h: getHue(hsv, _i), + s: getSaturation(hsv, _i), + v: generate_getValue(hsv, _i) + }); + patterns.push(_c); + } + if ('dark' === opts.theme) return darkColorMap.map(function(_ref) { + var index = _ref.index, amount = _ref.amount; + return new FastColor(opts.backgroundColor || '#141414').mix(patterns[index], amount).toHexString(); + }); + return patterns.map(function(c) { + return c.toHexString(); + }); +} +var presetPrimaryColors = { + red: "#F5222D", + volcano: "#FA541C", + orange: "#FA8C16", + gold: "#FAAD14", + yellow: "#FADB14", + lime: "#A0D911", + green: "#52C41A", + cyan: "#13C2C2", + blue: "#1677FF", + geekblue: "#2F54EB", + purple: "#722ED1", + magenta: "#EB2F96", + grey: "#666666" +}; +var red = [ + "#fff1f0", + "#ffccc7", + "#ffa39e", + "#ff7875", + "#ff4d4f", + "#f5222d", + "#cf1322", + "#a8071a", + "#820014", + "#5c0011" +]; +red.primary = red[5]; +var volcano = [ + "#fff2e8", + "#ffd8bf", + "#ffbb96", + "#ff9c6e", + "#ff7a45", + "#fa541c", + "#d4380d", + "#ad2102", + "#871400", + "#610b00" +]; +volcano.primary = volcano[5]; +var orange = [ + "#fff7e6", + "#ffe7ba", + "#ffd591", + "#ffc069", + "#ffa940", + "#fa8c16", + "#d46b08", + "#ad4e00", + "#873800", + "#612500" +]; +orange.primary = orange[5]; +var gold = [ + "#fffbe6", + "#fff1b8", + "#ffe58f", + "#ffd666", + "#ffc53d", + "#faad14", + "#d48806", + "#ad6800", + "#874d00", + "#613400" +]; +gold.primary = gold[5]; +var yellow = [ + "#feffe6", + "#ffffb8", + "#fffb8f", + "#fff566", + "#ffec3d", + "#fadb14", + "#d4b106", + "#ad8b00", + "#876800", + "#614700" +]; +yellow.primary = yellow[5]; +var lime = [ + "#fcffe6", + "#f4ffb8", + "#eaff8f", + "#d3f261", + "#bae637", + "#a0d911", + "#7cb305", + "#5b8c00", + "#3f6600", + "#254000" +]; +lime.primary = lime[5]; +var green = [ + "#f6ffed", + "#d9f7be", + "#b7eb8f", + "#95de64", + "#73d13d", + "#52c41a", + "#389e0d", + "#237804", + "#135200", + "#092b00" +]; +green.primary = green[5]; +var cyan = [ + "#e6fffb", + "#b5f5ec", + "#87e8de", + "#5cdbd3", + "#36cfc9", + "#13c2c2", + "#08979c", + "#006d75", + "#00474f", + "#002329" +]; +cyan.primary = cyan[5]; +var blue = [ + "#e6f4ff", + "#bae0ff", + "#91caff", + "#69b1ff", + "#4096ff", + "#1677ff", + "#0958d9", + "#003eb3", + "#002c8c", + "#001d66" +]; +blue.primary = blue[5]; +var geekblue = [ + "#f0f5ff", + "#d6e4ff", + "#adc6ff", + "#85a5ff", + "#597ef7", + "#2f54eb", + "#1d39c4", + "#10239e", + "#061178", + "#030852" +]; +geekblue.primary = geekblue[5]; +var purple = [ + "#f9f0ff", + "#efdbff", + "#d3adf7", + "#b37feb", + "#9254de", + "#722ed1", + "#531dab", + "#391085", + "#22075e", + "#120338" +]; +purple.primary = purple[5]; +var magenta = [ + "#fff0f6", + "#ffd6e7", + "#ffadd2", + "#ff85c0", + "#f759ab", + "#eb2f96", + "#c41d7f", + "#9e1068", + "#780650", + "#520339" +]; +magenta.primary = magenta[5]; +var grey = [ + "#a6a6a6", + "#999999", + "#8c8c8c", + "#808080", + "#737373", + "#666666", + "#404040", + "#1a1a1a", + "#000000", + "#000000" +]; +grey.primary = grey[5]; +var presetPalettes = { + red: red, + volcano: volcano, + orange: orange, + gold: gold, + yellow: yellow, + lime: lime, + green: green, + cyan: cyan, + blue: blue, + geekblue: geekblue, + purple: purple, + magenta: magenta, + grey: grey +}; +var redDark = [ + "#2a1215", + "#431418", + "#58181c", + "#791a1f", + "#a61d24", + "#d32029", + "#e84749", + "#f37370", + "#f89f9a", + "#fac8c3" +]; +redDark.primary = redDark[5]; +var volcanoDark = [ + "#2b1611", + "#441d12", + "#592716", + "#7c3118", + "#aa3e19", + "#d84a1b", + "#e87040", + "#f3956a", + "#f8b692", + "#fad4bc" +]; +volcanoDark.primary = volcanoDark[5]; +var orangeDark = [ + "#2b1d11", + "#442a11", + "#593815", + "#7c4a15", + "#aa6215", + "#d87a16", + "#e89a3c", + "#f3b765", + "#f8cf8d", + "#fae3b7" +]; +orangeDark.primary = orangeDark[5]; +var goldDark = [ + "#2b2111", + "#443111", + "#594214", + "#7c5914", + "#aa7714", + "#d89614", + "#e8b339", + "#f3cc62", + "#f8df8b", + "#faedb5" +]; +goldDark.primary = goldDark[5]; +var yellowDark = [ + "#2b2611", + "#443b11", + "#595014", + "#7c6e14", + "#aa9514", + "#d8bd14", + "#e8d639", + "#f3ea62", + "#f8f48b", + "#fafab5" +]; +yellowDark.primary = yellowDark[5]; +var limeDark = [ + "#1f2611", + "#2e3c10", + "#3e4f13", + "#536d13", + "#6f9412", + "#8bbb11", + "#a9d134", + "#c9e75d", + "#e4f88b", + "#f0fab5" +]; +limeDark.primary = limeDark[5]; +var greenDark = [ + "#162312", + "#1d3712", + "#274916", + "#306317", + "#3c8618", + "#49aa19", + "#6abe39", + "#8fd460", + "#b2e58b", + "#d5f2bb" +]; +greenDark.primary = greenDark[5]; +var cyanDark = [ + "#112123", + "#113536", + "#144848", + "#146262", + "#138585", + "#13a8a8", + "#33bcb7", + "#58d1c9", + "#84e2d8", + "#b2f1e8" +]; +cyanDark.primary = cyanDark[5]; +var blueDark = [ + "#111a2c", + "#112545", + "#15325b", + "#15417e", + "#1554ad", + "#1668dc", + "#3c89e8", + "#65a9f3", + "#8dc5f8", + "#b7dcfa" +]; +blueDark.primary = blueDark[5]; +var geekblueDark = [ + "#131629", + "#161d40", + "#1c2755", + "#203175", + "#263ea0", + "#2b4acb", + "#5273e0", + "#7f9ef3", + "#a8c1f8", + "#d2e0fa" +]; +geekblueDark.primary = geekblueDark[5]; +var purpleDark = [ + "#1a1325", + "#24163a", + "#301c4d", + "#3e2069", + "#51258f", + "#642ab5", + "#854eca", + "#ab7ae0", + "#cda8f0", + "#ebd7fa" +]; +purpleDark.primary = purpleDark[5]; +var magentaDark = [ + "#291321", + "#40162f", + "#551c3b", + "#75204f", + "#a02669", + "#cb2b83", + "#e0529c", + "#f37fb7", + "#f8a8cc", + "#fad2e3" +]; +magentaDark.primary = magentaDark[5]; +var greyDark = [ + "#151515", + "#1f1f1f", + "#2d2d2d", + "#393939", + "#494949", + "#5a5a5a", + "#6a6a6a", + "#7b7b7b", + "#888888", + "#969696" +]; +greyDark.primary = greyDark[5]; +function genColorMapToken(seed, { generateColorPalettes, generateNeutralColorPalettes }) { + const { colorSuccess: colorSuccessBase, colorWarning: colorWarningBase, colorError: colorErrorBase, colorInfo: colorInfoBase, colorPrimary: colorPrimaryBase, colorBgBase, colorTextBase } = seed; + const primaryColors = generateColorPalettes(colorPrimaryBase); + const successColors = generateColorPalettes(colorSuccessBase); + const warningColors = generateColorPalettes(colorWarningBase); + const errorColors = generateColorPalettes(colorErrorBase); + const infoColors = generateColorPalettes(colorInfoBase); + const neutralColors = generateNeutralColorPalettes(colorBgBase, colorTextBase); + const colorLink = seed.colorLink || seed.colorInfo; + const linkColors = generateColorPalettes(colorLink); + const colorErrorBgFilledHover = new FastColor(errorColors[1]).mix(new FastColor(errorColors[3]), 50).toHexString(); + return Object.assign(Object.assign({}, neutralColors), { + colorPrimaryBg: primaryColors[1], + colorPrimaryBgHover: primaryColors[2], + colorPrimaryBorder: primaryColors[3], + colorPrimaryBorderHover: primaryColors[4], + colorPrimaryHover: primaryColors[5], + colorPrimary: primaryColors[6], + colorPrimaryActive: primaryColors[7], + colorPrimaryTextHover: primaryColors[8], + colorPrimaryText: primaryColors[9], + colorPrimaryTextActive: primaryColors[10], + colorSuccessBg: successColors[1], + colorSuccessBgHover: successColors[2], + colorSuccessBorder: successColors[3], + colorSuccessBorderHover: successColors[4], + colorSuccessHover: successColors[4], + colorSuccess: successColors[6], + colorSuccessActive: successColors[7], + colorSuccessTextHover: successColors[8], + colorSuccessText: successColors[9], + colorSuccessTextActive: successColors[10], + colorErrorBg: errorColors[1], + colorErrorBgHover: errorColors[2], + colorErrorBgFilledHover, + colorErrorBgActive: errorColors[3], + colorErrorBorder: errorColors[3], + colorErrorBorderHover: errorColors[4], + colorErrorHover: errorColors[5], + colorError: errorColors[6], + colorErrorActive: errorColors[7], + colorErrorTextHover: errorColors[8], + colorErrorText: errorColors[9], + colorErrorTextActive: errorColors[10], + colorWarningBg: warningColors[1], + colorWarningBgHover: warningColors[2], + colorWarningBorder: warningColors[3], + colorWarningBorderHover: warningColors[4], + colorWarningHover: warningColors[4], + colorWarning: warningColors[6], + colorWarningActive: warningColors[7], + colorWarningTextHover: warningColors[8], + colorWarningText: warningColors[9], + colorWarningTextActive: warningColors[10], + colorInfoBg: infoColors[1], + colorInfoBgHover: infoColors[2], + colorInfoBorder: infoColors[3], + colorInfoBorderHover: infoColors[4], + colorInfoHover: infoColors[4], + colorInfo: infoColors[6], + colorInfoActive: infoColors[7], + colorInfoTextHover: infoColors[8], + colorInfoText: infoColors[9], + colorInfoTextActive: infoColors[10], + colorLinkHover: linkColors[4], + colorLink: linkColors[6], + colorLinkActive: linkColors[7], + colorBgMask: new FastColor('#000').setA(0.45).toRgbString(), + colorWhite: '#fff' + }); +} +const genRadius = (radiusBase)=>{ + let radiusLG = radiusBase; + let radiusSM = radiusBase; + let radiusXS = radiusBase; + let radiusOuter = radiusBase; + if (radiusBase < 6 && radiusBase >= 5) radiusLG = radiusBase + 1; + else if (radiusBase < 16 && radiusBase >= 6) radiusLG = radiusBase + 2; + else if (radiusBase >= 16) radiusLG = 16; + if (radiusBase < 7 && radiusBase >= 5) radiusSM = 4; + else if (radiusBase < 8 && radiusBase >= 7) radiusSM = 5; + else if (radiusBase < 14 && radiusBase >= 8) radiusSM = 6; + else if (radiusBase < 16 && radiusBase >= 14) radiusSM = 7; + else if (radiusBase >= 16) radiusSM = 8; + if (radiusBase < 6 && radiusBase >= 2) radiusXS = 1; + else if (radiusBase >= 6) radiusXS = 2; + if (radiusBase > 4 && radiusBase < 8) radiusOuter = 4; + else if (radiusBase >= 8) radiusOuter = 6; + return { + borderRadius: radiusBase, + borderRadiusXS: radiusXS, + borderRadiusSM: radiusSM, + borderRadiusLG: radiusLG, + borderRadiusOuter: radiusOuter + }; +}; +const shared_genRadius = genRadius; +function genCommonMapToken(token) { + const { motionUnit, motionBase, borderRadius, lineWidth } = token; + return Object.assign({ + motionDurationFast: `${(motionBase + motionUnit).toFixed(1)}s`, + motionDurationMid: `${(motionBase + 2 * motionUnit).toFixed(1)}s`, + motionDurationSlow: `${(motionBase + 3 * motionUnit).toFixed(1)}s`, + lineWidthBold: lineWidth + 1 + }, shared_genRadius(borderRadius)); +} +const genControlHeight = (token)=>{ + const { controlHeight } = token; + return { + controlHeightSM: 0.75 * controlHeight, + controlHeightXS: 0.5 * controlHeight, + controlHeightLG: 1.25 * controlHeight + }; +}; +const shared_genControlHeight = genControlHeight; +function getLineHeight(fontSize) { + return (fontSize + 8) / fontSize; +} +function getFontSizes(base) { + const fontSizes = Array.from({ + length: 10 + }).map((_, index)=>{ + const i = index - 1; + const baseSize = base * Math.pow(Math.E, i / 5); + const intSize = index > 1 ? Math.floor(baseSize) : Math.ceil(baseSize); + return 2 * Math.floor(intSize / 2); + }); + fontSizes[1] = base; + return fontSizes.map((size)=>({ + size, + lineHeight: getLineHeight(size) + })); +} +const genFontMapToken = (fontSize)=>{ + const fontSizePairs = getFontSizes(fontSize); + const fontSizes = fontSizePairs.map((pair)=>pair.size); + const lineHeights = fontSizePairs.map((pair)=>pair.lineHeight); + const fontSizeMD = fontSizes[1]; + const fontSizeSM = fontSizes[0]; + const fontSizeLG = fontSizes[2]; + const lineHeight = lineHeights[1]; + const lineHeightSM = lineHeights[0]; + const lineHeightLG = lineHeights[2]; + return { + fontSizeSM, + fontSize: fontSizeMD, + fontSizeLG, + fontSizeXL: fontSizes[3], + fontSizeHeading1: fontSizes[6], + fontSizeHeading2: fontSizes[5], + fontSizeHeading3: fontSizes[4], + fontSizeHeading4: fontSizes[3], + fontSizeHeading5: fontSizes[2], + lineHeight, + lineHeightLG, + lineHeightSM, + fontHeight: Math.round(lineHeight * fontSizeMD), + fontHeightLG: Math.round(lineHeightLG * fontSizeLG), + fontHeightSM: Math.round(lineHeightSM * fontSizeSM), + lineHeightHeading1: lineHeights[6], + lineHeightHeading2: lineHeights[5], + lineHeightHeading3: lineHeights[4], + lineHeightHeading4: lineHeights[3], + lineHeightHeading5: lineHeights[2] + }; +}; +const shared_genFontMapToken = genFontMapToken; +function genSizeMapToken(token) { + const { sizeUnit, sizeStep } = token; + return { + sizeXXL: sizeUnit * (sizeStep + 8), + sizeXL: sizeUnit * (sizeStep + 4), + sizeLG: sizeUnit * (sizeStep + 2), + sizeMD: sizeUnit * (sizeStep + 1), + sizeMS: sizeUnit * sizeStep, + size: sizeUnit * sizeStep, + sizeSM: sizeUnit * (sizeStep - 1), + sizeXS: sizeUnit * (sizeStep - 2), + sizeXXS: sizeUnit * (sizeStep - 3) + }; +} +const getAlphaColor = (baseColor, alpha)=>new FastColor(baseColor).setA(alpha).toRgbString(); +const getSolidColor = (baseColor, brightness)=>{ + const instance = new FastColor(baseColor); + return instance.darken(brightness).toHexString(); +}; +const colors_generateColorPalettes = (baseColor)=>{ + const colors = generate(baseColor); + return { + 1: colors[0], + 2: colors[1], + 3: colors[2], + 4: colors[3], + 5: colors[4], + 6: colors[5], + 7: colors[6], + 8: colors[4], + 9: colors[5], + 10: colors[6] + }; +}; +const colors_generateNeutralColorPalettes = (bgBaseColor, textBaseColor)=>{ + const colorBgBase = bgBaseColor || '#fff'; + const colorTextBase = textBaseColor || '#000'; + return { + colorBgBase, + colorTextBase, + colorText: getAlphaColor(colorTextBase, 0.88), + colorTextSecondary: getAlphaColor(colorTextBase, 0.65), + colorTextTertiary: getAlphaColor(colorTextBase, 0.45), + colorTextQuaternary: getAlphaColor(colorTextBase, 0.25), + colorFill: getAlphaColor(colorTextBase, 0.15), + colorFillSecondary: getAlphaColor(colorTextBase, 0.06), + colorFillTertiary: getAlphaColor(colorTextBase, 0.04), + colorFillQuaternary: getAlphaColor(colorTextBase, 0.02), + colorBgSolid: getAlphaColor(colorTextBase, 1), + colorBgSolidHover: getAlphaColor(colorTextBase, 0.75), + colorBgSolidActive: getAlphaColor(colorTextBase, 0.95), + colorBgLayout: getSolidColor(colorBgBase, 4), + colorBgContainer: getSolidColor(colorBgBase, 0), + colorBgElevated: getSolidColor(colorBgBase, 0), + colorBgSpotlight: getAlphaColor(colorTextBase, 0.85), + colorBgBlur: 'transparent', + colorBorder: getSolidColor(colorBgBase, 15), + colorBorderSecondary: getSolidColor(colorBgBase, 6) + }; +}; +function default_derivative(token) { + presetPrimaryColors.pink = presetPrimaryColors.magenta; + presetPalettes.pink = presetPalettes.magenta; + const colorPalettes = Object.keys(defaultPresetColors).map((colorKey)=>{ + const colors = token[colorKey] === presetPrimaryColors[colorKey] ? presetPalettes[colorKey] : generate(token[colorKey]); + return Array.from({ + length: 10 + }, ()=>1).reduce((prev, _, i)=>{ + prev[`${colorKey}-${i + 1}`] = colors[i]; + prev[`${colorKey}${i + 1}`] = colors[i]; + return prev; + }, {}); + }).reduce((prev, cur)=>{ + prev = Object.assign(Object.assign({}, prev), cur); + return prev; + }, {}); + return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, token), colorPalettes), genColorMapToken(token, { + generateColorPalettes: colors_generateColorPalettes, + generateNeutralColorPalettes: colors_generateNeutralColorPalettes + })), shared_genFontMapToken(token.fontSize)), genSizeMapToken(token)), shared_genControlHeight(token)), genCommonMapToken(token)); +} +const defaultTheme = createTheme(default_derivative); +const default_theme = defaultTheme; +function isStableColor(color) { + return color >= 0 && color <= 255; +} +function getAlphaColor_getAlphaColor(frontColor, backgroundColor) { + const { r: fR, g: fG, b: fB, a: originAlpha } = new FastColor(frontColor).toRgb(); + if (originAlpha < 1) return frontColor; + const { r: bR, g: bG, b: bB } = new FastColor(backgroundColor).toRgb(); + for(let fA = 0.01; fA <= 1; fA += 0.01){ + const r = Math.round((fR - bR * (1 - fA)) / fA); + const g = Math.round((fG - bG * (1 - fA)) / fA); + const b = Math.round((fB - bB * (1 - fA)) / fA); + if (isStableColor(r) && isStableColor(g) && isStableColor(b)) return new FastColor({ + r, + g, + b, + a: Math.round(100 * fA) / 100 + }).toRgbString(); + } + return new FastColor({ + r: fR, + g: fG, + b: fB, + a: 1 + }).toRgbString(); +} +const util_getAlphaColor = getAlphaColor_getAlphaColor; +var alias_rest = function(s, e) { + var t = {}; + for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; + if (null != s && "function" == typeof Object.getOwnPropertySymbols) { + for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; + } + return t; +}; +function alias_formatToken(derivativeToken) { + const { override } = derivativeToken, restToken = alias_rest(derivativeToken, [ + "override" + ]); + const overrideTokens = Object.assign({}, override); + Object.keys(themes_seed).forEach((token)=>{ + delete overrideTokens[token]; + }); + const mergedToken = Object.assign(Object.assign({}, restToken), overrideTokens); + const screenXS = 480; + const screenSM = 576; + const screenMD = 768; + const screenLG = 992; + const screenXL = 1200; + const screenXXL = 1600; + if (false === mergedToken.motion) { + const fastDuration = '0s'; + mergedToken.motionDurationFast = fastDuration; + mergedToken.motionDurationMid = fastDuration; + mergedToken.motionDurationSlow = fastDuration; + } + const aliasToken = Object.assign(Object.assign(Object.assign({}, mergedToken), { + colorFillContent: mergedToken.colorFillSecondary, + colorFillContentHover: mergedToken.colorFill, + colorFillAlter: mergedToken.colorFillQuaternary, + colorBgContainerDisabled: mergedToken.colorFillTertiary, + colorBorderBg: mergedToken.colorBgContainer, + colorSplit: util_getAlphaColor(mergedToken.colorBorderSecondary, mergedToken.colorBgContainer), + colorTextPlaceholder: mergedToken.colorTextQuaternary, + colorTextDisabled: mergedToken.colorTextQuaternary, + colorTextHeading: mergedToken.colorText, + colorTextLabel: mergedToken.colorTextSecondary, + colorTextDescription: mergedToken.colorTextTertiary, + colorTextLightSolid: mergedToken.colorWhite, + colorHighlight: mergedToken.colorError, + colorBgTextHover: mergedToken.colorFillSecondary, + colorBgTextActive: mergedToken.colorFill, + colorIcon: mergedToken.colorTextTertiary, + colorIconHover: mergedToken.colorText, + colorErrorOutline: util_getAlphaColor(mergedToken.colorErrorBg, mergedToken.colorBgContainer), + colorWarningOutline: util_getAlphaColor(mergedToken.colorWarningBg, mergedToken.colorBgContainer), + fontSizeIcon: mergedToken.fontSizeSM, + lineWidthFocus: 3 * mergedToken.lineWidth, + lineWidth: mergedToken.lineWidth, + controlOutlineWidth: 2 * mergedToken.lineWidth, + controlInteractiveSize: mergedToken.controlHeight / 2, + controlItemBgHover: mergedToken.colorFillTertiary, + controlItemBgActive: mergedToken.colorPrimaryBg, + controlItemBgActiveHover: mergedToken.colorPrimaryBgHover, + controlItemBgActiveDisabled: mergedToken.colorFill, + controlTmpOutline: mergedToken.colorFillQuaternary, + controlOutline: util_getAlphaColor(mergedToken.colorPrimaryBg, mergedToken.colorBgContainer), + lineType: mergedToken.lineType, + borderRadius: mergedToken.borderRadius, + borderRadiusXS: mergedToken.borderRadiusXS, + borderRadiusSM: mergedToken.borderRadiusSM, + borderRadiusLG: mergedToken.borderRadiusLG, + fontWeightStrong: 600, + opacityLoading: 0.65, + linkDecoration: 'none', + linkHoverDecoration: 'none', + linkFocusDecoration: 'none', + controlPaddingHorizontal: 12, + controlPaddingHorizontalSM: 8, + paddingXXS: mergedToken.sizeXXS, + paddingXS: mergedToken.sizeXS, + paddingSM: mergedToken.sizeSM, + padding: mergedToken.size, + paddingMD: mergedToken.sizeMD, + paddingLG: mergedToken.sizeLG, + paddingXL: mergedToken.sizeXL, + paddingContentHorizontalLG: mergedToken.sizeLG, + paddingContentVerticalLG: mergedToken.sizeMS, + paddingContentHorizontal: mergedToken.sizeMS, + paddingContentVertical: mergedToken.sizeSM, + paddingContentHorizontalSM: mergedToken.size, + paddingContentVerticalSM: mergedToken.sizeXS, + marginXXS: mergedToken.sizeXXS, + marginXS: mergedToken.sizeXS, + marginSM: mergedToken.sizeSM, + margin: mergedToken.size, + marginMD: mergedToken.sizeMD, + marginLG: mergedToken.sizeLG, + marginXL: mergedToken.sizeXL, + marginXXL: mergedToken.sizeXXL, + boxShadow: ` + 0 6px 16px 0 rgba(0, 0, 0, 0.08), + 0 3px 6px -4px rgba(0, 0, 0, 0.12), + 0 9px 28px 8px rgba(0, 0, 0, 0.05) + `, + boxShadowSecondary: ` + 0 6px 16px 0 rgba(0, 0, 0, 0.08), + 0 3px 6px -4px rgba(0, 0, 0, 0.12), + 0 9px 28px 8px rgba(0, 0, 0, 0.05) + `, + boxShadowTertiary: ` + 0 1px 2px 0 rgba(0, 0, 0, 0.03), + 0 1px 6px -1px rgba(0, 0, 0, 0.02), + 0 2px 4px 0 rgba(0, 0, 0, 0.02) + `, + screenXS, + screenXSMin: screenXS, + screenXSMax: screenSM - 1, + screenSM, + screenSMMin: screenSM, + screenSMMax: screenMD - 1, + screenMD, + screenMDMin: screenMD, + screenMDMax: screenLG - 1, + screenLG, + screenLGMin: screenLG, + screenLGMax: screenXL - 1, + screenXL, + screenXLMin: screenXL, + screenXLMax: screenXXL - 1, + screenXXL, + screenXXLMin: screenXXL, + boxShadowPopoverArrow: '2px 2px 5px rgba(0, 0, 0, 0.05)', + boxShadowCard: ` + 0 1px 2px -2px ${new FastColor('rgba(0, 0, 0, 0.16)').toRgbString()}, + 0 3px 6px 0 ${new FastColor('rgba(0, 0, 0, 0.12)').toRgbString()}, + 0 5px 12px 4px ${new FastColor('rgba(0, 0, 0, 0.09)').toRgbString()} + `, + boxShadowDrawerRight: ` + -6px 0 16px 0 rgba(0, 0, 0, 0.08), + -3px 0 6px -4px rgba(0, 0, 0, 0.12), + -9px 0 28px 8px rgba(0, 0, 0, 0.05) + `, + boxShadowDrawerLeft: ` + 6px 0 16px 0 rgba(0, 0, 0, 0.08), + 3px 0 6px -4px rgba(0, 0, 0, 0.12), + 9px 0 28px 8px rgba(0, 0, 0, 0.05) + `, + boxShadowDrawerUp: ` + 0 6px 16px 0 rgba(0, 0, 0, 0.08), + 0 3px 6px -4px rgba(0, 0, 0, 0.12), + 0 9px 28px 8px rgba(0, 0, 0, 0.05) + `, + boxShadowDrawerDown: ` + 0 -6px 16px 0 rgba(0, 0, 0, 0.08), + 0 -3px 6px -4px rgba(0, 0, 0, 0.12), + 0 -9px 28px 8px rgba(0, 0, 0, 0.05) + `, + boxShadowTabsOverflowLeft: 'inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)', + boxShadowTabsOverflowRight: 'inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)', + boxShadowTabsOverflowTop: 'inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)', + boxShadowTabsOverflowBottom: 'inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)' + }), overrideTokens); + return aliasToken; +} +var useToken_rest = function(s, e) { + var t = {}; + for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; + if (null != s && "function" == typeof Object.getOwnPropertySymbols) { + for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; + } + return t; +}; +const useToken_unitless = { + lineHeight: true, + lineHeightSM: true, + lineHeightLG: true, + lineHeightHeading1: true, + lineHeightHeading2: true, + lineHeightHeading3: true, + lineHeightHeading4: true, + lineHeightHeading5: true, + opacityLoading: true, + fontWeightStrong: true, + zIndexPopupBase: true, + zIndexBase: true, + opacityImage: true +}; +const useToken_ignore = { + size: true, + sizeSM: true, + sizeLG: true, + sizeMD: true, + sizeXS: true, + sizeXXS: true, + sizeMS: true, + sizeXL: true, + sizeXXL: true, + sizeUnit: true, + sizeStep: true, + motionBase: true, + motionUnit: true +}; +const useToken_preserve = { + screenXS: true, + screenXSMin: true, + screenXSMax: true, + screenSM: true, + screenSMMin: true, + screenSMMax: true, + screenMD: true, + screenMDMin: true, + screenMDMax: true, + screenLG: true, + screenLGMin: true, + screenLGMax: true, + screenXL: true, + screenXLMin: true, + screenXLMax: true, + screenXXL: true, + screenXXLMin: true +}; +const useToken_getComputedToken = (originToken, overrideToken, theme)=>{ + const derivativeToken = theme.getDerivativeToken(originToken); + const { override } = overrideToken, components = useToken_rest(overrideToken, [ + "override" + ]); + let mergedDerivativeToken = Object.assign(Object.assign({}, derivativeToken), { + override + }); + mergedDerivativeToken = alias_formatToken(mergedDerivativeToken); + if (components) Object.entries(components).forEach(([key, value])=>{ + const { theme: componentTheme } = value, componentTokens = useToken_rest(value, [ + "theme" + ]); + let mergedComponentToken = componentTokens; + if (componentTheme) mergedComponentToken = useToken_getComputedToken(Object.assign(Object.assign({}, mergedDerivativeToken), componentTokens), { + override: componentTokens + }, componentTheme); + mergedDerivativeToken[key] = mergedComponentToken; + }); + return mergedDerivativeToken; +}; +function useToken_useToken() { + const { token: rootDesignToken, hashed, theme, override, cssVar } = __WEBPACK_EXTERNAL_MODULE_react__["default"].useContext(DesignTokenContext); + const salt = `${es_version}-${hashed || ''}`; + const mergedTheme = theme || default_theme; + const [token, hashId, realToken] = useCacheToken(mergedTheme, [ + themes_seed, + rootDesignToken + ], { + salt, + override, + getComputedToken: useToken_getComputedToken, + formatToken: alias_formatToken, + cssVar: cssVar && { + prefix: cssVar.prefix, + key: cssVar.key, + unitless: useToken_unitless, + ignore: useToken_ignore, + preserve: useToken_preserve + } + }); + return [ + mergedTheme, + realToken, + hashed ? hashId : '', + token, + cssVar + ]; +} +function noop() {} +let deprecatedWarnList = null; +function warning_resetWarned() { + deprecatedWarnList = null; + resetWarned(); +} +let _warning = noop; +if ('production' !== process.env.NODE_ENV) _warning = (valid, component, message)=>{ + es_warning(valid, `[antd: ${component}] ${message}`); + if ('test' === process.env.NODE_ENV) warning_resetWarned(); +}; +const _util_warning_warning = _warning; +const WarningContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext({}); +const devUseWarning = 'production' !== process.env.NODE_ENV ? (component)=>{ + const { strict } = __WEBPACK_EXTERNAL_MODULE_react__.useContext(WarningContext); + const typeWarning = (valid, type, message)=>{ + if (!valid) if (false === strict && 'deprecated' === type) { + const existWarning = deprecatedWarnList; + if (!deprecatedWarnList) deprecatedWarnList = {}; + deprecatedWarnList[component] = deprecatedWarnList[component] || []; + if (!deprecatedWarnList[component].includes(message || '')) deprecatedWarnList[component].push(message || ''); + if (!existWarning) console.warn('[antd] There exists deprecated usage in your code:', deprecatedWarnList); + } else "production" !== process.env.NODE_ENV && _util_warning_warning(valid, component, message); + }; + typeWarning.deprecated = (valid, oldProp, newProp, message)=>{ + typeWarning(valid, 'deprecated', `\`${oldProp}\` is deprecated. Please use \`${newProp}\` instead.${message ? ` ${message}` : ''}`); + }; + return typeWarning; +} : ()=>{ + const noopWarning = ()=>{}; + noopWarning.deprecated = noop; + return noopWarning; +}; +const zIndexContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createContext(void 0); +if ('production' !== process.env.NODE_ENV) zIndexContext.displayName = 'zIndexContext'; +const zindexContext = zIndexContext; +const CONTAINER_OFFSET = 100; +const CONTAINER_OFFSET_MAX_COUNT = 10; +const CONTAINER_MAX_OFFSET = CONTAINER_OFFSET * CONTAINER_OFFSET_MAX_COUNT; +const CONTAINER_MAX_OFFSET_WITH_CHILDREN = CONTAINER_MAX_OFFSET + CONTAINER_OFFSET; +const containerBaseZIndexOffset = { + Modal: CONTAINER_OFFSET, + Drawer: CONTAINER_OFFSET, + Popover: CONTAINER_OFFSET, + Popconfirm: CONTAINER_OFFSET, + Tooltip: CONTAINER_OFFSET, + Tour: CONTAINER_OFFSET, + FloatButton: CONTAINER_OFFSET +}; +const consumerBaseZIndexOffset = { + SelectLike: 50, + Dropdown: 50, + DatePicker: 50, + Menu: 50, + ImagePreview: 1 +}; +function isContainerType(type) { + return type in containerBaseZIndexOffset; +} +const useZIndex = (componentType, customZIndex)=>{ + const [, token] = useToken_useToken(); + const parentZIndex = __WEBPACK_EXTERNAL_MODULE_react__["default"].useContext(zindexContext); + const isContainer = isContainerType(componentType); + let result; + if (void 0 !== customZIndex) result = [ + customZIndex, + customZIndex + ]; + else { + let zIndex = null != parentZIndex ? parentZIndex : 0; + if (isContainer) zIndex += (parentZIndex ? 0 : token.zIndexPopupBase) + containerBaseZIndexOffset[componentType]; + else zIndex += consumerBaseZIndexOffset[componentType]; + result = [ + void 0 === parentZIndex ? customZIndex : zIndex, + zIndex + ]; + } + if ('production' !== process.env.NODE_ENV) { + const warning = devUseWarning(componentType); + const maxZIndex = token.zIndexPopupBase + CONTAINER_MAX_OFFSET_WITH_CHILDREN; + const currentZIndex = result[0] || 0; + "production" !== process.env.NODE_ENV && warning(void 0 !== customZIndex || currentZIndex <= maxZIndex, 'usage', '`zIndex` is over design token `zIndexPopupBase` too much. It may cause unexpected override.'); + } + return result; +}; +function getArrowToken(token) { + const { sizePopupArrow, borderRadiusXS, borderRadiusOuter } = token; + const unitWidth = sizePopupArrow / 2; + const ax = 0; + const ay = unitWidth; + const bx = borderRadiusOuter / Math.sqrt(2); + const by = unitWidth - borderRadiusOuter * (1 - 1 / Math.sqrt(2)); + const cx = unitWidth - 1 / Math.sqrt(2) * borderRadiusXS; + const cy = borderRadiusOuter * (Math.sqrt(2) - 1) + 1 / Math.sqrt(2) * borderRadiusXS; + const dx = 2 * unitWidth - cx; + const dy = cy; + const ex = 2 * unitWidth - bx; + const ey = by; + const fx = 2 * unitWidth - ax; + const fy = ay; + const shadowWidth = unitWidth * Math.sqrt(2) + borderRadiusOuter * (Math.sqrt(2) - 2); + const polygonOffset = borderRadiusOuter * (Math.sqrt(2) - 1); + const arrowPolygon = `polygon(${polygonOffset}px 100%, 50% ${polygonOffset}px, ${2 * unitWidth - polygonOffset}px 100%, ${polygonOffset}px 100%)`; + const arrowPath = `path('M ${ax} ${ay} A ${borderRadiusOuter} ${borderRadiusOuter} 0 0 0 ${bx} ${by} L ${cx} ${cy} A ${borderRadiusXS} ${borderRadiusXS} 0 0 1 ${dx} ${dy} L ${ex} ${ey} A ${borderRadiusOuter} ${borderRadiusOuter} 0 0 0 ${fx} ${fy} Z')`; + return { + arrowShadowWidth: shadowWidth, + arrowPath, + arrowPolygon + }; +} +const genRoundedArrow = (token, bgColor, boxShadow)=>{ + const { sizePopupArrow, arrowPolygon, arrowPath, arrowShadowWidth, borderRadiusXS, calc } = token; + return { + pointerEvents: 'none', + width: sizePopupArrow, + height: sizePopupArrow, + overflow: 'hidden', + '&::before': { + position: 'absolute', + bottom: 0, + insetInlineStart: 0, + width: sizePopupArrow, + height: calc(sizePopupArrow).div(2).equal(), + background: bgColor, + clipPath: { + _multi_value_: true, + value: [ + arrowPolygon, + arrowPath + ] + }, + content: '""' + }, + '&::after': { + content: '""', + position: 'absolute', + width: arrowShadowWidth, + height: arrowShadowWidth, + bottom: 0, + insetInline: 0, + margin: 'auto', + borderRadius: { + _skip_check_: true, + value: `0 0 ${util_unit(borderRadiusXS)} 0` + }, + transform: 'translateY(50%) rotate(-135deg)', + boxShadow, + zIndex: 0, + background: 'transparent' + } + }; +}; +const MAX_VERTICAL_CONTENT_RADIUS = 8; +function getArrowOffsetToken(options) { + const { contentRadius, limitVerticalRadius } = options; + const arrowOffset = contentRadius > 12 ? contentRadius + 2 : 12; + const arrowOffsetVertical = limitVerticalRadius ? MAX_VERTICAL_CONTENT_RADIUS : arrowOffset; + return { + arrowOffsetHorizontal: arrowOffset, + arrowOffsetVertical + }; +} +function isInject(valid, code) { + if (!valid) return {}; + return code; +} +function getArrowStyle(token, colorBg, options) { + const { componentCls, boxShadowPopoverArrow, arrowOffsetVertical, arrowOffsetHorizontal } = token; + const { arrowDistance = 0, arrowPlacement = { + left: true, + right: true, + top: true, + bottom: true + } } = options || {}; + return { + [componentCls]: Object.assign(Object.assign(Object.assign(Object.assign({ + [`${componentCls}-arrow`]: [ + Object.assign(Object.assign({ + position: 'absolute', + zIndex: 1, + display: 'block' + }, genRoundedArrow(token, colorBg, boxShadowPopoverArrow)), { + '&:before': { + background: colorBg + } + }) + ] + }, isInject(!!arrowPlacement.top, { + [[ + `&-placement-top > ${componentCls}-arrow`, + `&-placement-topLeft > ${componentCls}-arrow`, + `&-placement-topRight > ${componentCls}-arrow` + ].join(',')]: { + bottom: arrowDistance, + transform: 'translateY(100%) rotate(180deg)' + }, + [`&-placement-top > ${componentCls}-arrow`]: { + left: { + _skip_check_: true, + value: '50%' + }, + transform: 'translateX(-50%) translateY(100%) rotate(180deg)' + }, + '&-placement-topLeft': { + '--arrow-offset-horizontal': arrowOffsetHorizontal, + [`> ${componentCls}-arrow`]: { + left: { + _skip_check_: true, + value: arrowOffsetHorizontal + } + } + }, + '&-placement-topRight': { + '--arrow-offset-horizontal': `calc(100% - ${util_unit(arrowOffsetHorizontal)})`, + [`> ${componentCls}-arrow`]: { + right: { + _skip_check_: true, + value: arrowOffsetHorizontal + } + } + } + })), isInject(!!arrowPlacement.bottom, { + [[ + `&-placement-bottom > ${componentCls}-arrow`, + `&-placement-bottomLeft > ${componentCls}-arrow`, + `&-placement-bottomRight > ${componentCls}-arrow` + ].join(',')]: { + top: arrowDistance, + transform: "translateY(-100%)" + }, + [`&-placement-bottom > ${componentCls}-arrow`]: { + left: { + _skip_check_: true, + value: '50%' + }, + transform: "translateX(-50%) translateY(-100%)" + }, + '&-placement-bottomLeft': { + '--arrow-offset-horizontal': arrowOffsetHorizontal, + [`> ${componentCls}-arrow`]: { + left: { + _skip_check_: true, + value: arrowOffsetHorizontal + } + } + }, + '&-placement-bottomRight': { + '--arrow-offset-horizontal': `calc(100% - ${util_unit(arrowOffsetHorizontal)})`, + [`> ${componentCls}-arrow`]: { + right: { + _skip_check_: true, + value: arrowOffsetHorizontal + } + } + } + })), isInject(!!arrowPlacement.left, { + [[ + `&-placement-left > ${componentCls}-arrow`, + `&-placement-leftTop > ${componentCls}-arrow`, + `&-placement-leftBottom > ${componentCls}-arrow` + ].join(',')]: { + right: { + _skip_check_: true, + value: arrowDistance + }, + transform: 'translateX(100%) rotate(90deg)' + }, + [`&-placement-left > ${componentCls}-arrow`]: { + top: { + _skip_check_: true, + value: '50%' + }, + transform: 'translateY(-50%) translateX(100%) rotate(90deg)' + }, + [`&-placement-leftTop > ${componentCls}-arrow`]: { + top: arrowOffsetVertical + }, + [`&-placement-leftBottom > ${componentCls}-arrow`]: { + bottom: arrowOffsetVertical + } + })), isInject(!!arrowPlacement.right, { + [[ + `&-placement-right > ${componentCls}-arrow`, + `&-placement-rightTop > ${componentCls}-arrow`, + `&-placement-rightBottom > ${componentCls}-arrow` + ].join(',')]: { + left: { + _skip_check_: true, + value: arrowDistance + }, + transform: 'translateX(-100%) rotate(-90deg)' + }, + [`&-placement-right > ${componentCls}-arrow`]: { + top: { + _skip_check_: true, + value: '50%' + }, + transform: 'translateY(-50%) translateX(-100%) rotate(-90deg)' + }, + [`&-placement-rightTop > ${componentCls}-arrow`]: { + top: arrowOffsetVertical + }, + [`&-placement-rightBottom > ${componentCls}-arrow`]: { + bottom: arrowOffsetVertical + } + })) + }; +} +function getOverflowOptions(placement, arrowOffset, arrowWidth, autoAdjustOverflow) { + if (false === autoAdjustOverflow) return { + adjustX: false, + adjustY: false + }; + const overflow = autoAdjustOverflow && 'object' == typeof autoAdjustOverflow ? autoAdjustOverflow : {}; + const baseOverflow = {}; + switch(placement){ + case 'top': + case 'bottom': + baseOverflow.shiftX = 2 * arrowOffset.arrowOffsetHorizontal + arrowWidth; + baseOverflow.shiftY = true; + baseOverflow.adjustY = true; + break; + case 'left': + case 'right': + baseOverflow.shiftY = 2 * arrowOffset.arrowOffsetVertical + arrowWidth; + baseOverflow.shiftX = true; + baseOverflow.adjustX = true; + break; + } + const mergedOverflow = Object.assign(Object.assign({}, baseOverflow), overflow); + if (!mergedOverflow.shiftX) mergedOverflow.adjustX = true; + if (!mergedOverflow.shiftY) mergedOverflow.adjustY = true; + return mergedOverflow; +} +const PlacementAlignMap = { + left: { + points: [ + 'cr', + 'cl' + ] + }, + right: { + points: [ + 'cl', + 'cr' + ] + }, + top: { + points: [ + 'bc', + 'tc' + ] + }, + bottom: { + points: [ + 'tc', + 'bc' + ] + }, + topLeft: { + points: [ + 'bl', + 'tl' + ] + }, + leftTop: { + points: [ + 'tr', + 'tl' + ] + }, + topRight: { + points: [ + 'br', + 'tr' + ] + }, + rightTop: { + points: [ + 'tl', + 'tr' + ] + }, + bottomRight: { + points: [ + 'tr', + 'br' + ] + }, + rightBottom: { + points: [ + 'bl', + 'br' + ] + }, + bottomLeft: { + points: [ + 'tl', + 'bl' + ] + }, + leftBottom: { + points: [ + 'br', + 'bl' + ] + } +}; +const ArrowCenterPlacementAlignMap = { + topLeft: { + points: [ + 'bl', + 'tc' + ] + }, + leftTop: { + points: [ + 'tr', + 'cl' + ] + }, + topRight: { + points: [ + 'br', + 'tc' + ] + }, + rightTop: { + points: [ + 'tl', + 'cr' + ] + }, + bottomRight: { + points: [ + 'tr', + 'bc' + ] + }, + rightBottom: { + points: [ + 'bl', + 'cr' + ] + }, + bottomLeft: { + points: [ + 'tl', + 'bc' + ] + }, + leftBottom: { + points: [ + 'br', + 'cl' + ] + } +}; +const DisableAutoArrowList = new Set([ + 'topLeft', + 'topRight', + 'bottomLeft', + 'bottomRight', + 'leftTop', + 'leftBottom', + 'rightTop', + 'rightBottom' +]); +function getPlacements(config) { + const { arrowWidth, autoAdjustOverflow, arrowPointAtCenter, offset, borderRadius, visibleFirst } = config; + const halfArrowWidth = arrowWidth / 2; + const placementMap = {}; + Object.keys(PlacementAlignMap).forEach((key)=>{ + const template = arrowPointAtCenter && ArrowCenterPlacementAlignMap[key] || PlacementAlignMap[key]; + const placementInfo = Object.assign(Object.assign({}, template), { + offset: [ + 0, + 0 + ], + dynamicInset: true + }); + placementMap[key] = placementInfo; + if (DisableAutoArrowList.has(key)) placementInfo.autoArrow = false; + switch(key){ + case 'top': + case 'topLeft': + case 'topRight': + placementInfo.offset[1] = -halfArrowWidth - offset; + break; + case 'bottom': + case 'bottomLeft': + case 'bottomRight': + placementInfo.offset[1] = halfArrowWidth + offset; + break; + case 'left': + case 'leftTop': + case 'leftBottom': + placementInfo.offset[0] = -halfArrowWidth - offset; + break; + case 'right': + case 'rightTop': + case 'rightBottom': + placementInfo.offset[0] = halfArrowWidth + offset; + break; + } + const arrowOffset = getArrowOffsetToken({ + contentRadius: borderRadius, + limitVerticalRadius: true + }); + if (arrowPointAtCenter) switch(key){ + case 'topLeft': + case 'bottomLeft': + placementInfo.offset[0] = -arrowOffset.arrowOffsetHorizontal - halfArrowWidth; + break; + case 'topRight': + case 'bottomRight': + placementInfo.offset[0] = arrowOffset.arrowOffsetHorizontal + halfArrowWidth; + break; + case 'leftTop': + case 'rightTop': + placementInfo.offset[1] = 2 * -arrowOffset.arrowOffsetHorizontal + halfArrowWidth; + break; + case 'leftBottom': + case 'rightBottom': + placementInfo.offset[1] = 2 * arrowOffset.arrowOffsetHorizontal - halfArrowWidth; + break; + } + placementInfo.overflow = getOverflowOptions(key, arrowOffset, arrowWidth, autoAdjustOverflow); + if (visibleFirst) placementInfo.htmlRegion = 'visibleFirst'; + }); + return placementMap; +} +"use client"; +const resetComponent = (token, needInheritFontFamily = false)=>({ + boxSizing: 'border-box', + margin: 0, + padding: 0, + color: token.colorText, + fontSize: token.fontSize, + lineHeight: token.lineHeight, + listStyle: 'none', + fontFamily: needInheritFontFamily ? 'inherit' : token.fontFamily + }); +const resetIcon = ()=>({ + display: 'inline-flex', + alignItems: 'center', + color: 'inherit', + fontStyle: 'normal', + lineHeight: 0, + textAlign: 'center', + textTransform: 'none', + verticalAlign: '-0.125em', + textRendering: 'optimizeLegibility', + '-webkit-font-smoothing': 'antialiased', + '-moz-osx-font-smoothing': 'grayscale', + '> *': { + lineHeight: 1 + }, + svg: { + display: 'inline-block' + } + }); +const genLinkStyle = (token)=>({ + a: { + color: token.colorLink, + textDecoration: token.linkDecoration, + backgroundColor: 'transparent', + outline: 'none', + cursor: 'pointer', + transition: `color ${token.motionDurationSlow}`, + '-webkit-text-decoration-skip': 'objects', + '&:hover': { + color: token.colorLinkHover + }, + '&:active': { + color: token.colorLinkActive + }, + '&:active, &:hover': { + textDecoration: token.linkHoverDecoration, + outline: 0 + }, + '&:focus': { + textDecoration: token.linkFocusDecoration, + outline: 0 + }, + '&[disabled]': { + color: token.colorTextDisabled, + cursor: 'not-allowed' + } + } + }); +const genCommonStyle = (token, componentPrefixCls, rootCls, resetFont)=>{ + const prefixSelector = `[class^="${componentPrefixCls}"], [class*=" ${componentPrefixCls}"]`; + const rootPrefixSelector = rootCls ? `.${rootCls}` : prefixSelector; + const resetStyle = { + boxSizing: 'border-box', + '&::before, &::after': { + boxSizing: 'border-box' + } + }; + let resetFontStyle = {}; + if (false !== resetFont) resetFontStyle = { + fontFamily: token.fontFamily, + fontSize: token.fontSize + }; + return { + [rootPrefixSelector]: Object.assign(Object.assign(Object.assign({}, resetFontStyle), resetStyle), { + [prefixSelector]: resetStyle + }) + }; +}; +const genIconStyle = (iconPrefixCls)=>({ + [`.${iconPrefixCls}`]: Object.assign(Object.assign({}, resetIcon()), { + [`.${iconPrefixCls} .${iconPrefixCls}-icon`]: { + display: 'block' + } + }) + }); +const initMotionCommon = (duration)=>({ + animationDuration: duration, + animationFillMode: 'both' + }); +const initMotionCommonLeave = (duration)=>({ + animationDuration: duration, + animationFillMode: 'both' + }); +const initMotion = (motionCls, inKeyframes, outKeyframes, duration, sameLevel = false)=>{ + const sameLevelPrefix = sameLevel ? '&' : ''; + return { + [` + ${sameLevelPrefix}${motionCls}-enter, + ${sameLevelPrefix}${motionCls}-appear + `]: Object.assign(Object.assign({}, initMotionCommon(duration)), { + animationPlayState: 'paused' + }), + [`${sameLevelPrefix}${motionCls}-leave`]: Object.assign(Object.assign({}, initMotionCommonLeave(duration)), { + animationPlayState: 'paused' + }), + [` + ${sameLevelPrefix}${motionCls}-enter${motionCls}-enter-active, + ${sameLevelPrefix}${motionCls}-appear${motionCls}-appear-active + `]: { + animationName: inKeyframes, + animationPlayState: 'running' + }, + [`${sameLevelPrefix}${motionCls}-leave${motionCls}-leave-active`]: { + animationName: outKeyframes, + animationPlayState: 'running', + pointerEvents: 'none' + } + }; +}; +const zoomIn = new Keyframes('antZoomIn', { + '0%': { + transform: 'scale(0.2)', + opacity: 0 + }, + '100%': { + transform: 'scale(1)', + opacity: 1 + } +}); +const zoomOut = new Keyframes('antZoomOut', { + '0%': { + transform: 'scale(1)' + }, + '100%': { + transform: 'scale(0.2)', + opacity: 0 + } +}); +const zoomBigIn = new Keyframes('antZoomBigIn', { + '0%': { + transform: 'scale(0.8)', + opacity: 0 + }, + '100%': { + transform: 'scale(1)', + opacity: 1 + } +}); +const zoomBigOut = new Keyframes('antZoomBigOut', { + '0%': { + transform: 'scale(1)' + }, + '100%': { + transform: 'scale(0.8)', + opacity: 0 + } +}); +const zoomUpIn = new Keyframes('antZoomUpIn', { + '0%': { + transform: 'scale(0.8)', + transformOrigin: '50% 0%', + opacity: 0 + }, + '100%': { + transform: 'scale(1)', + transformOrigin: '50% 0%' + } +}); +const zoomUpOut = new Keyframes('antZoomUpOut', { + '0%': { + transform: 'scale(1)', + transformOrigin: '50% 0%' + }, + '100%': { + transform: 'scale(0.8)', + transformOrigin: '50% 0%', + opacity: 0 + } +}); +const zoomLeftIn = new Keyframes('antZoomLeftIn', { + '0%': { + transform: 'scale(0.8)', + transformOrigin: '0% 50%', + opacity: 0 + }, + '100%': { + transform: 'scale(1)', + transformOrigin: '0% 50%' + } +}); +const zoomLeftOut = new Keyframes('antZoomLeftOut', { + '0%': { + transform: 'scale(1)', + transformOrigin: '0% 50%' + }, + '100%': { + transform: 'scale(0.8)', + transformOrigin: '0% 50%', + opacity: 0 + } +}); +const zoomRightIn = new Keyframes('antZoomRightIn', { + '0%': { + transform: 'scale(0.8)', + transformOrigin: '100% 50%', + opacity: 0 + }, + '100%': { + transform: 'scale(1)', + transformOrigin: '100% 50%' + } +}); +const zoomRightOut = new Keyframes('antZoomRightOut', { + '0%': { + transform: 'scale(1)', + transformOrigin: '100% 50%' + }, + '100%': { + transform: 'scale(0.8)', + transformOrigin: '100% 50%', + opacity: 0 + } +}); +const zoomDownIn = new Keyframes('antZoomDownIn', { + '0%': { + transform: 'scale(0.8)', + transformOrigin: '50% 100%', + opacity: 0 + }, + '100%': { + transform: 'scale(1)', + transformOrigin: '50% 100%' + } +}); +const zoomDownOut = new Keyframes('antZoomDownOut', { + '0%': { + transform: 'scale(1)', + transformOrigin: '50% 100%' + }, + '100%': { + transform: 'scale(0.8)', + transformOrigin: '50% 100%', + opacity: 0 + } +}); +const zoomMotion = { + zoom: { + inKeyframes: zoomIn, + outKeyframes: zoomOut + }, + 'zoom-big': { + inKeyframes: zoomBigIn, + outKeyframes: zoomBigOut + }, + 'zoom-big-fast': { + inKeyframes: zoomBigIn, + outKeyframes: zoomBigOut + }, + 'zoom-left': { + inKeyframes: zoomLeftIn, + outKeyframes: zoomLeftOut + }, + 'zoom-right': { + inKeyframes: zoomRightIn, + outKeyframes: zoomRightOut + }, + 'zoom-up': { + inKeyframes: zoomUpIn, + outKeyframes: zoomUpOut + }, + 'zoom-down': { + inKeyframes: zoomDownIn, + outKeyframes: zoomDownOut + } +}; +const initZoomMotion = (token, motionName)=>{ + const { antCls } = token; + const motionCls = `${antCls}-${motionName}`; + const { inKeyframes, outKeyframes } = zoomMotion[motionName]; + return [ + initMotion(motionCls, inKeyframes, outKeyframes, 'zoom-big-fast' === motionName ? token.motionDurationFast : token.motionDurationMid), + { + [` + ${motionCls}-enter, + ${motionCls}-appear + `]: { + transform: 'scale(0)', + opacity: 0, + animationTimingFunction: token.motionEaseOutCirc, + '&-prepare': { + transform: 'none' + } + }, + [`${motionCls}-leave`]: { + animationTimingFunction: token.motionEaseInOutCirc + } + } + ]; +}; +const PresetColors = [ + 'blue', + 'purple', + 'cyan', + 'green', + 'magenta', + 'pink', + 'red', + 'orange', + 'yellow', + 'volcano', + 'geekblue', + 'lime', + 'gold' +]; +function genPresetColor(token, genCss) { + return PresetColors.reduce((prev, colorKey)=>{ + const lightColor = token[`${colorKey}1`]; + const lightBorderColor = token[`${colorKey}3`]; + const darkColor = token[`${colorKey}6`]; + const textColor = token[`${colorKey}7`]; + return Object.assign(Object.assign({}, prev), genCss(colorKey, { + lightColor, + lightBorderColor, + darkColor, + textColor + })); + }, {}); +} +var calc_calculator_AbstractCalculator = /*#__PURE__*/ createClass_createClass(function AbstractCalculator() { + classCallCheck_classCallCheck(this, AbstractCalculator); +}); +const calc_calculator = calc_calculator_AbstractCalculator; +var CSSCalculator_CALC_UNIT = 'CALC_UNIT'; +var calc_CSSCalculator_regexp = new RegExp(CSSCalculator_CALC_UNIT, 'g'); +function calc_CSSCalculator_unit(value) { + if ('number' == typeof value) return "".concat(value).concat(CSSCalculator_CALC_UNIT); + return value; +} +var calc_CSSCalculator_CSSCalculator = /*#__PURE__*/ function(_AbstractCalculator) { + inherits_inherits(CSSCalculator, _AbstractCalculator); + var _super = createSuper_createSuper(CSSCalculator); + function CSSCalculator(num, unitlessCssVar) { + var _this; + classCallCheck_classCallCheck(this, CSSCalculator); + _this = _super.call(this); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "result", ''); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "unitlessCssVar", void 0); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "lowPriority", void 0); + var numType = typeof_typeof(num); + _this.unitlessCssVar = unitlessCssVar; + if (num instanceof CSSCalculator) _this.result = "(".concat(num.result, ")"); + else if ('number' === numType) _this.result = calc_CSSCalculator_unit(num); + else if ('string' === numType) _this.result = num; + return _this; + } + createClass_createClass(CSSCalculator, [ + { + key: "add", + value: function(num) { + if (num instanceof CSSCalculator) this.result = "".concat(this.result, " + ").concat(num.getResult()); + else if ('number' == typeof num || 'string' == typeof num) this.result = "".concat(this.result, " + ").concat(calc_CSSCalculator_unit(num)); + this.lowPriority = true; + return this; + } + }, + { + key: "sub", + value: function(num) { + if (num instanceof CSSCalculator) this.result = "".concat(this.result, " - ").concat(num.getResult()); + else if ('number' == typeof num || 'string' == typeof num) this.result = "".concat(this.result, " - ").concat(calc_CSSCalculator_unit(num)); + this.lowPriority = true; + return this; + } + }, + { + key: "mul", + value: function(num) { + if (this.lowPriority) this.result = "(".concat(this.result, ")"); + if (num instanceof CSSCalculator) this.result = "".concat(this.result, " * ").concat(num.getResult(true)); + else if ('number' == typeof num || 'string' == typeof num) this.result = "".concat(this.result, " * ").concat(num); + this.lowPriority = false; + return this; + } + }, + { + key: "div", + value: function(num) { + if (this.lowPriority) this.result = "(".concat(this.result, ")"); + if (num instanceof CSSCalculator) this.result = "".concat(this.result, " / ").concat(num.getResult(true)); + else if ('number' == typeof num || 'string' == typeof num) this.result = "".concat(this.result, " / ").concat(num); + this.lowPriority = false; + return this; + } + }, + { + key: "getResult", + value: function(force) { + return this.lowPriority || force ? "(".concat(this.result, ")") : this.result; + } + }, + { + key: "equal", + value: function(options) { + var _this2 = this; + var _ref = options || {}, cssUnit = _ref.unit; + var mergedUnit = true; + if ('boolean' == typeof cssUnit) mergedUnit = cssUnit; + else if (Array.from(this.unitlessCssVar).some(function(cssVar) { + return _this2.result.includes(cssVar); + })) mergedUnit = false; + this.result = this.result.replace(calc_CSSCalculator_regexp, mergedUnit ? 'px' : ''); + if (void 0 !== this.lowPriority) return "calc(".concat(this.result, ")"); + return this.result; + } + } + ]); + return CSSCalculator; +}(calc_calculator); +var calc_NumCalculator_NumCalculator = /*#__PURE__*/ function(_AbstractCalculator) { + inherits_inherits(NumCalculator, _AbstractCalculator); + var _super = createSuper_createSuper(NumCalculator); + function NumCalculator(num) { + var _this; + classCallCheck_classCallCheck(this, NumCalculator); + _this = _super.call(this); + defineProperty_defineProperty(assertThisInitialized_assertThisInitialized(_this), "result", 0); + if (num instanceof NumCalculator) _this.result = num.result; + else if ('number' == typeof num) _this.result = num; + return _this; + } + createClass_createClass(NumCalculator, [ + { + key: "add", + value: function(num) { + if (num instanceof NumCalculator) this.result += num.result; + else if ('number' == typeof num) this.result += num; + return this; + } + }, + { + key: "sub", + value: function(num) { + if (num instanceof NumCalculator) this.result -= num.result; + else if ('number' == typeof num) this.result -= num; + return this; + } + }, + { + key: "mul", + value: function(num) { + if (num instanceof NumCalculator) this.result *= num.result; + else if ('number' == typeof num) this.result *= num; + return this; + } + }, + { + key: "div", + value: function(num) { + if (num instanceof NumCalculator) this.result /= num.result; + else if ('number' == typeof num) this.result /= num; + return this; + } + }, + { + key: "equal", + value: function() { + return this.result; + } + } + ]); + return NumCalculator; +}(calc_calculator); +const calc_NumCalculator = calc_NumCalculator_NumCalculator; +var util_calc_genCalc = function(type, unitlessCssVar) { + var Calculator = 'css' === type ? calc_CSSCalculator_CSSCalculator : calc_NumCalculator; + return function(num) { + return new Calculator(num, unitlessCssVar); + }; +}; +const util_calc = util_calc_genCalc; +var getCompVarPrefix_getCompVarPrefix = function(component, prefix) { + return "".concat([ + prefix, + component.replace(/([A-Z]+)([A-Z][a-z]+)/g, '$1-$2').replace(/([a-z])([A-Z])/g, '$1-$2') + ].filter(Boolean).join('-')); +}; +const util_getCompVarPrefix = getCompVarPrefix_getCompVarPrefix; +function getComponentToken_getComponentToken(component, token, defaultToken, options) { + var customToken = objectSpread2_objectSpread2({}, token[component]); + if (null != options && options.deprecatedTokens) { + var deprecatedTokens = options.deprecatedTokens; + deprecatedTokens.forEach(function(_ref) { + var _ref2 = slicedToArray_slicedToArray(_ref, 2), oldTokenKey = _ref2[0], newTokenKey = _ref2[1]; + if ('production' !== process.env.NODE_ENV) es_warning(!(null != customToken && customToken[oldTokenKey]), "Component Token `".concat(String(oldTokenKey), "` of ").concat(String(component), " is deprecated. Please use `").concat(String(newTokenKey), "` instead.")); + if (null != customToken && customToken[oldTokenKey] || null != customToken && customToken[newTokenKey]) null != customToken[newTokenKey] || (customToken[newTokenKey] = null == customToken ? void 0 : customToken[oldTokenKey]); + }); + } + var mergedToken = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, defaultToken), customToken); + Object.keys(mergedToken).forEach(function(key) { + if (mergedToken[key] === token[key]) delete mergedToken[key]; + }); + return mergedToken; +} +const getComponentToken = getComponentToken_getComponentToken; +var enableStatistic = 'production' !== process.env.NODE_ENV || 'undefined' != typeof CSSINJS_STATISTIC; +var recording = true; +function statistic_merge() { + for(var _len = arguments.length, objs = new Array(_len), _key = 0; _key < _len; _key++)objs[_key] = arguments[_key]; + if (!enableStatistic) return Object.assign.apply(Object, [ + {} + ].concat(objs)); + recording = false; + var ret = {}; + objs.forEach(function(obj) { + if ('object' !== typeof_typeof(obj)) return; + var keys = Object.keys(obj); + keys.forEach(function(key) { + Object.defineProperty(ret, key, { + configurable: true, + enumerable: true, + get: function() { + return obj[key]; + } + }); + }); + }); + recording = true; + return ret; +} +var statistic = {}; +function statistic_noop() {} +var statistic_statisticToken = function(token) { + var tokenKeys; + var proxy = token; + var flush = statistic_noop; + if (enableStatistic && 'undefined' != typeof Proxy) { + tokenKeys = new Set(); + proxy = new Proxy(token, { + get: function(obj, prop) { + if (recording) { + var _tokenKeys; + null == (_tokenKeys = tokenKeys) || _tokenKeys.add(prop); + } + return obj[prop]; + } + }); + flush = function(componentName, componentToken) { + var _statistic$componentN; + statistic[componentName] = { + global: Array.from(tokenKeys), + component: objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, null == (_statistic$componentN = statistic[componentName]) ? void 0 : _statistic$componentN.component), componentToken) + }; + }; + } + return { + token: proxy, + keys: tokenKeys, + flush: flush + }; +}; +const util_statistic = statistic_statisticToken; +function getDefaultComponentToken(component, token, getDefaultToken) { + if ('function' == typeof getDefaultToken) { + var _token$component; + return getDefaultToken(statistic_merge(token, null != (_token$component = token[component]) ? _token$component : {})); + } + return null != getDefaultToken ? getDefaultToken : {}; +} +const util_getDefaultComponentToken = getDefaultComponentToken; +function genMaxMin(type) { + if ('js' === type) return { + max: Math.max, + min: Math.min + }; + return { + max: function() { + for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + return "max(".concat(args.map(function(value) { + return util_unit(value); + }).join(','), ")"); + }, + min: function() { + for(var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++)args[_key2] = arguments[_key2]; + return "min(".concat(args.map(function(value) { + return util_unit(value); + }).join(','), ")"); + } + }; +} +const maxmin = genMaxMin; +var BEAT_LIMIT = 600000; +var useUniqueMemo_ArrayKeyMap = /*#__PURE__*/ function() { + function ArrayKeyMap() { + classCallCheck_classCallCheck(this, ArrayKeyMap); + defineProperty_defineProperty(this, "map", new Map()); + defineProperty_defineProperty(this, "objectIDMap", new WeakMap()); + defineProperty_defineProperty(this, "nextID", 0); + defineProperty_defineProperty(this, "lastAccessBeat", new Map()); + defineProperty_defineProperty(this, "accessBeat", 0); + } + createClass_createClass(ArrayKeyMap, [ + { + key: "set", + value: function(keys, value) { + this.clear(); + var compositeKey = this.getCompositeKey(keys); + this.map.set(compositeKey, value); + this.lastAccessBeat.set(compositeKey, Date.now()); + } + }, + { + key: "get", + value: function(keys) { + var compositeKey = this.getCompositeKey(keys); + var cache = this.map.get(compositeKey); + this.lastAccessBeat.set(compositeKey, Date.now()); + this.accessBeat += 1; + return cache; + } + }, + { + key: "getCompositeKey", + value: function(keys) { + var _this = this; + var ids = keys.map(function(key) { + if (key && 'object' === typeof_typeof(key)) return "obj_".concat(_this.getObjectID(key)); + return "".concat(typeof_typeof(key), "_").concat(key); + }); + return ids.join('|'); + } + }, + { + key: "getObjectID", + value: function(obj) { + if (this.objectIDMap.has(obj)) return this.objectIDMap.get(obj); + var id = this.nextID; + this.objectIDMap.set(obj, id); + this.nextID += 1; + return id; + } + }, + { + key: "clear", + value: function() { + var _this2 = this; + if (this.accessBeat > 10000) { + var now = Date.now(); + this.lastAccessBeat.forEach(function(beat, key) { + if (now - beat > BEAT_LIMIT) { + _this2.map.delete(key); + _this2.lastAccessBeat.delete(key); + } + }); + this.accessBeat = 0; + } + } + } + ]); + return ArrayKeyMap; +}(); +var uniqueMap = new useUniqueMemo_ArrayKeyMap(); +function useUniqueMemo(memoFn, deps) { + return __WEBPACK_EXTERNAL_MODULE_react__["default"].useMemo(function() { + var cachedValue = uniqueMap.get(deps); + if (cachedValue) return cachedValue; + var newValue = memoFn(); + uniqueMap.set(deps, newValue); + return newValue; + }, deps); +} +const hooks_useUniqueMemo = useUniqueMemo; +var useCSP_useDefaultCSP = function() { + return {}; +}; +const hooks_useCSP = useCSP_useDefaultCSP; +function genStyleUtils_genStyleUtils(config) { + var _config$useCSP = config.useCSP, useCSP = void 0 === _config$useCSP ? hooks_useCSP : _config$useCSP, useToken = config.useToken, usePrefix = config.usePrefix, getResetStyles = config.getResetStyles, getCommonStyle = config.getCommonStyle, getCompUnitless = config.getCompUnitless; + function genStyleHooks(component, styleFn, getDefaultToken, options) { + var componentName = Array.isArray(component) ? component[0] : component; + function prefixToken(key) { + return "".concat(String(componentName)).concat(key.slice(0, 1).toUpperCase()).concat(key.slice(1)); + } + var originUnitless = (null == options ? void 0 : options.unitless) || {}; + var originCompUnitless = 'function' == typeof getCompUnitless ? getCompUnitless(component) : {}; + var compUnitless = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, originCompUnitless), {}, defineProperty_defineProperty({}, prefixToken('zIndexPopup'), true)); + Object.keys(originUnitless).forEach(function(key) { + compUnitless[prefixToken(key)] = originUnitless[key]; + }); + var mergedOptions = objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, options), {}, { + unitless: compUnitless, + prefixToken: prefixToken + }); + var useStyle = genComponentStyleHook(component, styleFn, getDefaultToken, mergedOptions); + var useCSSVar = genCSSVarRegister(componentName, getDefaultToken, mergedOptions); + return function(prefixCls) { + var rootCls = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : prefixCls; + var _useStyle = useStyle(prefixCls, rootCls), _useStyle2 = slicedToArray_slicedToArray(_useStyle, 2), hashId = _useStyle2[1]; + var _useCSSVar = useCSSVar(rootCls), _useCSSVar2 = slicedToArray_slicedToArray(_useCSSVar, 2), wrapCSSVar = _useCSSVar2[0], cssVarCls = _useCSSVar2[1]; + return [ + wrapCSSVar, + hashId, + cssVarCls + ]; + }; + } + function genCSSVarRegister(component, getDefaultToken, options) { + var compUnitless = options.unitless, _options$injectStyle = options.injectStyle, injectStyle = void 0 === _options$injectStyle ? true : _options$injectStyle, prefixToken = options.prefixToken, ignore = options.ignore; + var CSSVarRegister = function(_ref) { + var rootCls = _ref.rootCls, _ref$cssVar = _ref.cssVar, cssVar = void 0 === _ref$cssVar ? {} : _ref$cssVar; + var _useToken = useToken(), realToken = _useToken.realToken; + hooks_useCSSVarRegister({ + path: [ + component + ], + prefix: cssVar.prefix, + key: cssVar.key, + unitless: compUnitless, + ignore: ignore, + token: realToken, + scope: rootCls + }, function() { + var defaultToken = util_getDefaultComponentToken(component, realToken, getDefaultToken); + var componentToken = getComponentToken(component, realToken, defaultToken, { + deprecatedTokens: null == options ? void 0 : options.deprecatedTokens + }); + Object.keys(defaultToken).forEach(function(key) { + componentToken[prefixToken(key)] = componentToken[key]; + delete componentToken[key]; + }); + return componentToken; + }); + return null; + }; + var useCSSVar = function(rootCls) { + var _useToken2 = useToken(), cssVar = _useToken2.cssVar; + return [ + function(node) { + return injectStyle && cssVar ? /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement(__WEBPACK_EXTERNAL_MODULE_react__["default"].Fragment, null, /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement(CSSVarRegister, { + rootCls: rootCls, + cssVar: cssVar, + component: component + }), node) : node; + }, + null == cssVar ? void 0 : cssVar.key + ]; + }; + return useCSSVar; + } + function genComponentStyleHook(componentName, styleFn, getDefaultToken) { + var options = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {}; + var cells = Array.isArray(componentName) ? componentName : [ + componentName, + componentName + ]; + var _cells = slicedToArray_slicedToArray(cells, 1), component = _cells[0]; + var concatComponent = cells.join('-'); + var mergedLayer = config.layer || { + name: 'antd' + }; + return function(prefixCls) { + var rootCls = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : prefixCls; + var _useToken3 = useToken(), theme = _useToken3.theme, realToken = _useToken3.realToken, hashId = _useToken3.hashId, token = _useToken3.token, cssVar = _useToken3.cssVar; + var _usePrefix = usePrefix(), rootPrefixCls = _usePrefix.rootPrefixCls, iconPrefixCls = _usePrefix.iconPrefixCls; + var csp = useCSP(); + var type = cssVar ? 'css' : 'js'; + var calc = hooks_useUniqueMemo(function() { + var unitlessCssVar = new Set(); + if (cssVar) Object.keys(options.unitless || {}).forEach(function(key) { + unitlessCssVar.add(css_variables_token2CSSVar(key, cssVar.prefix)); + unitlessCssVar.add(css_variables_token2CSSVar(key, util_getCompVarPrefix(component, cssVar.prefix))); + }); + return util_calc(type, unitlessCssVar); + }, [ + type, + component, + null == cssVar ? void 0 : cssVar.prefix + ]); + var _genMaxMin = maxmin(type), max = _genMaxMin.max, min = _genMaxMin.min; + var sharedConfig = { + theme: theme, + token: token, + hashId: hashId, + nonce: function() { + return csp.nonce; + }, + clientOnly: options.clientOnly, + layer: mergedLayer, + order: options.order || -999 + }; + if ('function' == typeof getResetStyles) useStyleRegister(objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, sharedConfig), {}, { + clientOnly: false, + path: [ + 'Shared', + rootPrefixCls + ] + }), function() { + return getResetStyles(token, { + prefix: { + rootPrefixCls: rootPrefixCls, + iconPrefixCls: iconPrefixCls + }, + csp: csp + }); + }); + var wrapSSR = useStyleRegister(objectSpread2_objectSpread2(objectSpread2_objectSpread2({}, sharedConfig), {}, { + path: [ + concatComponent, + prefixCls, + iconPrefixCls + ] + }), function() { + if (false === options.injectStyle) return []; + var _statisticToken = util_statistic(token), proxyToken = _statisticToken.token, flush = _statisticToken.flush; + var defaultComponentToken = util_getDefaultComponentToken(component, realToken, getDefaultToken); + var componentCls = ".".concat(prefixCls); + var componentToken = getComponentToken(component, realToken, defaultComponentToken, { + deprecatedTokens: options.deprecatedTokens + }); + if (cssVar && defaultComponentToken && 'object' === typeof_typeof(defaultComponentToken)) Object.keys(defaultComponentToken).forEach(function(key) { + defaultComponentToken[key] = "var(".concat(css_variables_token2CSSVar(key, util_getCompVarPrefix(component, cssVar.prefix)), ")"); + }); + var mergedToken = statistic_merge(proxyToken, { + componentCls: componentCls, + prefixCls: prefixCls, + iconCls: ".".concat(iconPrefixCls), + antCls: ".".concat(rootPrefixCls), + calc: calc, + max: max, + min: min + }, cssVar ? defaultComponentToken : componentToken); + var styleInterpolation = styleFn(mergedToken, { + hashId: hashId, + prefixCls: prefixCls, + rootPrefixCls: rootPrefixCls, + iconPrefixCls: iconPrefixCls + }); + flush(component, componentToken); + var commonStyle = 'function' == typeof getCommonStyle ? getCommonStyle(mergedToken, prefixCls, rootCls, options.resetFont) : null; + return [ + false === options.resetStyle ? null : commonStyle, + styleInterpolation + ]; + }); + return [ + wrapSSR, + hashId + ]; + }; + } + function genSubStyleComponent(componentName, styleFn, getDefaultToken) { + var options = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {}; + var useStyle = genComponentStyleHook(componentName, styleFn, getDefaultToken, objectSpread2_objectSpread2({ + resetStyle: false, + order: -998 + }, options)); + var StyledComponent = function(_ref2) { + var prefixCls = _ref2.prefixCls, _ref2$rootCls = _ref2.rootCls, rootCls = void 0 === _ref2$rootCls ? prefixCls : _ref2$rootCls; + useStyle(prefixCls, rootCls); + return null; + }; + if ('production' !== process.env.NODE_ENV) StyledComponent.displayName = "SubStyle_".concat(String(Array.isArray(componentName) ? componentName.join('.') : componentName)); + return StyledComponent; + } + return { + genStyleHooks: genStyleHooks, + genSubStyleComponent: genSubStyleComponent, + genComponentStyleHook: genComponentStyleHook + }; +} +const genStyleUtils = genStyleUtils_genStyleUtils; +const { genStyleHooks: genStyleUtils_genStyleHooks, genComponentStyleHook: genStyleUtils_genComponentStyleHook, genSubStyleComponent: genStyleUtils_genSubStyleComponent } = genStyleUtils({ + usePrefix: ()=>{ + const { getPrefixCls, iconPrefixCls } = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(context_ConfigContext); + const rootPrefixCls = getPrefixCls(); + return { + rootPrefixCls, + iconPrefixCls + }; + }, + useToken: ()=>{ + const [theme, realToken, hashId, token, cssVar] = useToken_useToken(); + return { + theme, + realToken, + hashId, + token, + cssVar + }; + }, + useCSP: ()=>{ + const { csp } = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(context_ConfigContext); + return null != csp ? csp : {}; + }, + getResetStyles: (token, config)=>{ + var _a; + const linkStyle = genLinkStyle(token); + return [ + linkStyle, + { + '&': linkStyle + }, + genIconStyle(null != (_a = null == config ? void 0 : config.prefix.iconPrefixCls) ? _a : defaultIconPrefixCls) + ]; + }, + getCommonStyle: genCommonStyle, + getCompUnitless: ()=>useToken_unitless +}); +const genTooltipStyle = (token)=>{ + const { calc, componentCls, tooltipMaxWidth, tooltipColor, tooltipBg, tooltipBorderRadius, zIndexPopup, controlHeight, boxShadowSecondary, paddingSM, paddingXS, arrowOffsetHorizontal, sizePopupArrow } = token; + const edgeAlignMinWidth = calc(tooltipBorderRadius).add(sizePopupArrow).add(arrowOffsetHorizontal).equal(); + const centerAlignMinWidth = calc(tooltipBorderRadius).mul(2).add(sizePopupArrow).equal(); + return [ + { + [componentCls]: Object.assign(Object.assign(Object.assign(Object.assign({}, resetComponent(token)), { + position: 'absolute', + zIndex: zIndexPopup, + display: 'block', + width: 'max-content', + maxWidth: tooltipMaxWidth, + visibility: 'visible', + '--valid-offset-x': 'var(--arrow-offset-horizontal, var(--arrow-x))', + transformOrigin: "var(--valid-offset-x, 50%) var(--arrow-y, 50%)", + '&-hidden': { + display: 'none' + }, + '--antd-arrow-background-color': tooltipBg, + [`${componentCls}-inner`]: { + minWidth: centerAlignMinWidth, + minHeight: controlHeight, + padding: `${util_unit(token.calc(paddingSM).div(2).equal())} ${util_unit(paddingXS)}`, + color: tooltipColor, + textAlign: 'start', + textDecoration: 'none', + wordWrap: 'break-word', + backgroundColor: tooltipBg, + borderRadius: tooltipBorderRadius, + boxShadow: boxShadowSecondary, + boxSizing: 'border-box' + }, + ["&-placement-topLeft,&-placement-topRight,&-placement-bottomLeft,&-placement-bottomRight"]: { + minWidth: edgeAlignMinWidth + }, + ["&-placement-left,&-placement-leftTop,&-placement-leftBottom,&-placement-right,&-placement-rightTop,&-placement-rightBottom"]: { + [`${componentCls}-inner`]: { + borderRadius: token.min(tooltipBorderRadius, MAX_VERTICAL_CONTENT_RADIUS) + } + }, + [`${componentCls}-content`]: { + position: 'relative' + } + }), genPresetColor(token, (colorKey, { darkColor })=>({ + [`&${componentCls}-${colorKey}`]: { + [`${componentCls}-inner`]: { + backgroundColor: darkColor + }, + [`${componentCls}-arrow`]: { + '--antd-arrow-background-color': darkColor + } + } + }))), { + '&-rtl': { + direction: 'rtl' + } + }) + }, + getArrowStyle(token, 'var(--antd-arrow-background-color)'), + { + [`${componentCls}-pure`]: { + position: 'relative', + maxWidth: 'none', + margin: token.sizePopupArrow + } + } + ]; +}; +const prepareComponentToken = (token)=>Object.assign(Object.assign({ + zIndexPopup: token.zIndexPopupBase + 70 + }, getArrowOffsetToken({ + contentRadius: token.borderRadius, + limitVerticalRadius: true + })), getArrowToken(statistic_merge(token, { + borderRadiusOuter: Math.min(token.borderRadiusOuter, 4) + }))); +const tooltip_style = (prefixCls, injectStyle = true)=>{ + const useStyle = genStyleUtils_genStyleHooks('Tooltip', (token)=>{ + const { borderRadius, colorTextLightSolid, colorBgSpotlight } = token; + const TooltipToken = statistic_merge(token, { + tooltipMaxWidth: 250, + tooltipColor: colorTextLightSolid, + tooltipBorderRadius: borderRadius, + tooltipBg: colorBgSpotlight + }); + return [ + genTooltipStyle(TooltipToken), + initZoomMotion(token, 'zoom-big-fast') + ]; + }, prepareComponentToken, { + resetStyle: false, + injectStyle + }); + return useStyle(prefixCls); +}; +const inverseColors = PresetColors.map((color)=>`${color}-inverse`); +function isPresetColor(color, includeInverse = true) { + if (includeInverse) return [].concat(_toConsumableArray(inverseColors), _toConsumableArray(PresetColors)).includes(color); + return PresetColors.includes(color); +} +function parseColor(prefixCls, color) { + const isInternalColor = isPresetColor(color); + const className = classnames_default()({ + [`${prefixCls}-${color}`]: color && isInternalColor + }); + const overlayStyle = {}; + const arrowStyle = {}; + if (color && !isInternalColor) { + overlayStyle.background = color; + arrowStyle['--antd-arrow-background-color'] = color; + } + return { + className, + overlayStyle, + arrowStyle + }; +} +"use client"; +const PurePanel_PurePanel = (props)=>{ + const { prefixCls: customizePrefixCls, className, placement = 'top', title, color, overlayInnerStyle } = props; + const { getPrefixCls } = __WEBPACK_EXTERNAL_MODULE_react__.useContext(context_ConfigContext); + const prefixCls = getPrefixCls('tooltip', customizePrefixCls); + const [wrapCSSVar, hashId, cssVarCls] = tooltip_style(prefixCls); + const colorInfo = parseColor(prefixCls, color); + const arrowContentStyle = colorInfo.arrowStyle; + const formattedOverlayInnerStyle = Object.assign(Object.assign({}, overlayInnerStyle), colorInfo.overlayStyle); + const cls = classnames_default()(hashId, cssVarCls, prefixCls, `${prefixCls}-pure`, `${prefixCls}-placement-${placement}`, className, colorInfo.className); + return wrapCSSVar(/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("div", { + className: cls, + style: arrowContentStyle + }, /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("div", { + className: `${prefixCls}-arrow` + }), /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(Popup, Object.assign({}, props, { + className: hashId, + prefixCls: prefixCls, + overlayInnerStyle: formattedOverlayInnerStyle + }), title))); +}; +const PurePanel = PurePanel_PurePanel; +"use client"; +var tooltip_rest = function(s, e) { + var t = {}; + for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; + if (null != s && "function" == typeof Object.getOwnPropertySymbols) { + for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; + } + return t; +}; +const InternalTooltip = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef((props, ref)=>{ + var _a, _b; + const { prefixCls: customizePrefixCls, openClassName, getTooltipContainer, color, overlayInnerStyle, children, afterOpenChange, afterVisibleChange, destroyTooltipOnHide, destroyOnHidden, arrow = true, title, overlay, builtinPlacements, arrowPointAtCenter = false, autoAdjustOverflow = true, motion, getPopupContainer, placement = 'top', mouseEnterDelay = 0.1, mouseLeaveDelay = 0.1, overlayStyle, rootClassName, overlayClassName, styles, classNames: tooltipClassNames } = props, restProps = tooltip_rest(props, [ + "prefixCls", + "openClassName", + "getTooltipContainer", + "color", + "overlayInnerStyle", + "children", + "afterOpenChange", + "afterVisibleChange", + "destroyTooltipOnHide", + "destroyOnHidden", + "arrow", + "title", + "overlay", + "builtinPlacements", + "arrowPointAtCenter", + "autoAdjustOverflow", + "motion", + "getPopupContainer", + "placement", + "mouseEnterDelay", + "mouseLeaveDelay", + "overlayStyle", + "rootClassName", + "overlayClassName", + "styles", + "classNames" + ]); + const mergedShowArrow = !!arrow; + const [, token] = useToken_useToken(); + const { getPopupContainer: getContextPopupContainer, getPrefixCls, direction, className: contextClassName, style: contextStyle, classNames: contextClassNames, styles: contextStyles } = useComponentConfig('tooltip'); + const warning = devUseWarning('Tooltip'); + const tooltipRef = __WEBPACK_EXTERNAL_MODULE_react__.useRef(null); + const forceAlign = ()=>{ + var _a; + null == (_a = tooltipRef.current) || _a.forceAlign(); + }; + __WEBPACK_EXTERNAL_MODULE_react__.useImperativeHandle(ref, ()=>{ + var _a, _b; + return { + forceAlign, + forcePopupAlign: ()=>{ + warning.deprecated(false, 'forcePopupAlign', 'forceAlign'); + forceAlign(); + }, + nativeElement: null == (_a = tooltipRef.current) ? void 0 : _a.nativeElement, + popupElement: null == (_b = tooltipRef.current) ? void 0 : _b.popupElement + }; + }); + if ('production' !== process.env.NODE_ENV) { + [ + [ + 'visible', + 'open' + ], + [ + 'defaultVisible', + 'defaultOpen' + ], + [ + 'onVisibleChange', + 'onOpenChange' + ], + [ + 'afterVisibleChange', + 'afterOpenChange' + ], + [ + 'destroyTooltipOnHide', + 'destroyOnHidden' + ], + [ + 'arrowPointAtCenter', + 'arrow={{ pointAtCenter: true }}' + ], + [ + 'overlayStyle', + 'styles={{ root: {} }}' + ], + [ + 'overlayInnerStyle', + 'styles={{ body: {} }}' + ], + [ + 'overlayClassName', + 'classNames={{ root: "" }}' + ] + ].forEach(([deprecatedName, newName])=>{ + warning.deprecated(!(deprecatedName in props), deprecatedName, newName); + }); + "production" !== process.env.NODE_ENV && warning(!destroyTooltipOnHide || 'boolean' == typeof destroyTooltipOnHide, 'usage', '`destroyTooltipOnHide` no need config `keepParent` anymore. Please use `boolean` value directly.'); + "production" !== process.env.NODE_ENV && warning(!arrow || 'boolean' == typeof arrow || !('arrowPointAtCenter' in arrow), 'deprecated', '`arrowPointAtCenter` in `arrow` is deprecated. Please use `pointAtCenter` instead.'); + } + const [open, setOpen] = useMergedState(false, { + value: null != (_a = props.open) ? _a : props.visible, + defaultValue: null != (_b = props.defaultOpen) ? _b : props.defaultVisible + }); + const noTitle = !title && !overlay && 0 !== title; + const onOpenChange = (vis)=>{ + var _a, _b; + setOpen(noTitle ? false : vis); + if (!noTitle) { + null == (_a = props.onOpenChange) || _a.call(props, vis); + null == (_b = props.onVisibleChange) || _b.call(props, vis); + } + }; + const tooltipPlacements = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(()=>{ + var _a, _b; + let mergedArrowPointAtCenter = arrowPointAtCenter; + if ('object' == typeof arrow) mergedArrowPointAtCenter = null != (_b = null != (_a = arrow.pointAtCenter) ? _a : arrow.arrowPointAtCenter) ? _b : arrowPointAtCenter; + return builtinPlacements || getPlacements({ + arrowPointAtCenter: mergedArrowPointAtCenter, + autoAdjustOverflow, + arrowWidth: mergedShowArrow ? token.sizePopupArrow : 0, + borderRadius: token.borderRadius, + offset: token.marginXXS, + visibleFirst: true + }); + }, [ + arrowPointAtCenter, + arrow, + builtinPlacements, + token + ]); + const memoOverlay = __WEBPACK_EXTERNAL_MODULE_react__.useMemo(()=>{ + if (0 === title) return title; + return overlay || title || ''; + }, [ + overlay, + title + ]); + const memoOverlayWrapper = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(_util_ContextIsolator, { + space: true + }, 'function' == typeof memoOverlay ? memoOverlay() : memoOverlay); + const prefixCls = getPrefixCls('tooltip', customizePrefixCls); + const rootPrefixCls = getPrefixCls(); + const injectFromPopover = props['data-popover-inject']; + let tempOpen = open; + if (!('open' in props) && !('visible' in props) && noTitle) tempOpen = false; + const child = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.isValidElement(children) && !isFragment(children) ? children : /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("span", null, children); + const childProps = child.props; + const childCls = childProps.className && 'string' != typeof childProps.className ? childProps.className : classnames_default()(childProps.className, openClassName || `${prefixCls}-open`); + const [wrapCSSVar, hashId, cssVarCls] = tooltip_style(prefixCls, !injectFromPopover); + const colorInfo = parseColor(prefixCls, color); + const arrowContentStyle = colorInfo.arrowStyle; + const rootClassNames = classnames_default()(overlayClassName, { + [`${prefixCls}-rtl`]: 'rtl' === direction + }, colorInfo.className, rootClassName, hashId, cssVarCls, contextClassName, contextClassNames.root, null == tooltipClassNames ? void 0 : tooltipClassNames.root); + const bodyClassNames = classnames_default()(contextClassNames.body, null == tooltipClassNames ? void 0 : tooltipClassNames.body); + const [zIndex, contextZIndex] = useZIndex('Tooltip', restProps.zIndex); + const content = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(rc_tooltip_es, Object.assign({}, restProps, { + zIndex: zIndex, + showArrow: mergedShowArrow, + placement: placement, + mouseEnterDelay: mouseEnterDelay, + mouseLeaveDelay: mouseLeaveDelay, + prefixCls: prefixCls, + classNames: { + root: rootClassNames, + body: bodyClassNames + }, + styles: { + root: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, arrowContentStyle), contextStyles.root), contextStyle), overlayStyle), null == styles ? void 0 : styles.root), + body: Object.assign(Object.assign(Object.assign(Object.assign({}, contextStyles.body), overlayInnerStyle), null == styles ? void 0 : styles.body), colorInfo.overlayStyle) + }, + getTooltipContainer: getPopupContainer || getTooltipContainer || getContextPopupContainer, + ref: tooltipRef, + builtinPlacements: tooltipPlacements, + overlay: memoOverlayWrapper, + visible: tempOpen, + onVisibleChange: onOpenChange, + afterVisibleChange: null != afterOpenChange ? afterOpenChange : afterVisibleChange, + arrowContent: /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("span", { + className: `${prefixCls}-arrow-content` + }), + motion: { + motionName: getTransitionName(rootPrefixCls, 'zoom-big-fast', props.transitionName), + motionDeadline: 1000 + }, + destroyTooltipOnHide: null != destroyOnHidden ? destroyOnHidden : !!destroyTooltipOnHide + }), tempOpen ? cloneElement(child, { + className: childCls + }) : child); + return wrapCSSVar(/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(zindexContext.Provider, { + value: contextZIndex + }, content)); +}); +const tooltip_Tooltip = InternalTooltip; +if ('production' !== process.env.NODE_ENV) tooltip_Tooltip.displayName = 'Tooltip'; +tooltip_Tooltip._InternalPanelDoNotUseOrYouWillBeFired = PurePanel; +const tooltip = tooltip_Tooltip; +const genBaseStyle = (token)=>{ + const { componentCls, popoverColor, titleMinWidth, fontWeightStrong, innerPadding, boxShadowSecondary, colorTextHeading, borderRadiusLG, zIndexPopup, titleMarginBottom, colorBgElevated, popoverBg, titleBorderBottom, innerContentPadding, titlePadding } = token; + return [ + { + [componentCls]: Object.assign(Object.assign({}, resetComponent(token)), { + position: 'absolute', + top: 0, + left: { + _skip_check_: true, + value: 0 + }, + zIndex: zIndexPopup, + fontWeight: 'normal', + whiteSpace: 'normal', + textAlign: 'start', + cursor: 'auto', + userSelect: 'text', + '--valid-offset-x': 'var(--arrow-offset-horizontal, var(--arrow-x))', + transformOrigin: "var(--valid-offset-x, 50%) var(--arrow-y, 50%)", + '--antd-arrow-background-color': colorBgElevated, + width: 'max-content', + maxWidth: '100vw', + '&-rtl': { + direction: 'rtl' + }, + '&-hidden': { + display: 'none' + }, + [`${componentCls}-content`]: { + position: 'relative' + }, + [`${componentCls}-inner`]: { + backgroundColor: popoverBg, + backgroundClip: 'padding-box', + borderRadius: borderRadiusLG, + boxShadow: boxShadowSecondary, + padding: innerPadding + }, + [`${componentCls}-title`]: { + minWidth: titleMinWidth, + marginBottom: titleMarginBottom, + color: colorTextHeading, + fontWeight: fontWeightStrong, + borderBottom: titleBorderBottom, + padding: titlePadding + }, + [`${componentCls}-inner-content`]: { + color: popoverColor, + padding: innerContentPadding + } + }) + }, + getArrowStyle(token, 'var(--antd-arrow-background-color)'), + { + [`${componentCls}-pure`]: { + position: 'relative', + maxWidth: 'none', + margin: token.sizePopupArrow, + display: 'inline-block', + [`${componentCls}-content`]: { + display: 'inline-block' + } + } + } + ]; +}; +const genColorStyle = (token)=>{ + const { componentCls } = token; + return { + [componentCls]: PresetColors.map((colorKey)=>{ + const lightColor = token[`${colorKey}6`]; + return { + [`&${componentCls}-${colorKey}`]: { + '--antd-arrow-background-color': lightColor, + [`${componentCls}-inner`]: { + backgroundColor: lightColor + }, + [`${componentCls}-arrow`]: { + background: 'transparent' + } + } + }; + }) + }; +}; +const style_prepareComponentToken = (token)=>{ + const { lineWidth, controlHeight, fontHeight, padding, wireframe, zIndexPopupBase, borderRadiusLG, marginXS, lineType, colorSplit, paddingSM } = token; + const titlePaddingBlockDist = controlHeight - fontHeight; + const popoverTitlePaddingBlockTop = titlePaddingBlockDist / 2; + const popoverTitlePaddingBlockBottom = titlePaddingBlockDist / 2 - lineWidth; + const popoverPaddingHorizontal = padding; + return Object.assign(Object.assign(Object.assign({ + titleMinWidth: 177, + zIndexPopup: zIndexPopupBase + 30 + }, getArrowToken(token)), getArrowOffsetToken({ + contentRadius: borderRadiusLG, + limitVerticalRadius: true + })), { + innerPadding: wireframe ? 0 : 12, + titleMarginBottom: wireframe ? 0 : marginXS, + titlePadding: wireframe ? `${popoverTitlePaddingBlockTop}px ${popoverPaddingHorizontal}px ${popoverTitlePaddingBlockBottom}px` : 0, + titleBorderBottom: wireframe ? `${lineWidth}px ${lineType} ${colorSplit}` : 'none', + innerContentPadding: wireframe ? `${paddingSM}px ${popoverPaddingHorizontal}px` : 0 + }); +}; +const popover_style = genStyleUtils_genStyleHooks('Popover', (token)=>{ + const { colorBgElevated, colorText } = token; + const popoverToken = statistic_merge(token, { + popoverBg: colorBgElevated, + popoverColor: colorText + }); + return [ + genBaseStyle(popoverToken), + genColorStyle(popoverToken), + initZoomMotion(popoverToken, 'zoom-big') + ]; +}, style_prepareComponentToken, { + resetStyle: false, + deprecatedTokens: [ + [ + 'width', + 'titleMinWidth' + ], + [ + 'minWidth', + 'titleMinWidth' + ] + ] +}); +"use client"; +var PurePanel_rest = function(s, e) { + var t = {}; + for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; + if (null != s && "function" == typeof Object.getOwnPropertySymbols) { + for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; + } + return t; +}; +const Overlay = ({ title, content, prefixCls })=>{ + if (!title && !content) return null; + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(__WEBPACK_EXTERNAL_MODULE_react__.Fragment, null, title && /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("div", { + className: `${prefixCls}-title` + }, title), content && /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("div", { + className: `${prefixCls}-inner-content` + }, content)); +}; +const RawPurePanel = (props)=>{ + const { hashId, prefixCls, className, style, placement = 'top', title, content, children } = props; + const titleNode = getRenderPropValue(title); + const contentNode = getRenderPropValue(content); + const cls = classnames_default()(hashId, prefixCls, `${prefixCls}-pure`, `${prefixCls}-placement-${placement}`, className); + return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("div", { + className: cls, + style: style + }, /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement("div", { + className: `${prefixCls}-arrow` + }), /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(Popup, Object.assign({}, props, { + className: hashId, + prefixCls: prefixCls + }), children || /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(Overlay, { + prefixCls: prefixCls, + title: titleNode, + content: contentNode + }))); +}; +const popover_PurePanel_PurePanel = (props)=>{ + const { prefixCls: customizePrefixCls, className } = props, restProps = PurePanel_rest(props, [ + "prefixCls", + "className" + ]); + const { getPrefixCls } = __WEBPACK_EXTERNAL_MODULE_react__.useContext(context_ConfigContext); + const prefixCls = getPrefixCls('popover', customizePrefixCls); + const [wrapCSSVar, hashId, cssVarCls] = popover_style(prefixCls); + return wrapCSSVar(/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(RawPurePanel, Object.assign({}, restProps, { + prefixCls: prefixCls, + hashId: hashId, + className: classnames_default()(className, cssVarCls) + }))); +}; +const popover_PurePanel = popover_PurePanel_PurePanel; +"use client"; +var popover_rest = function(s, e) { + var t = {}; + for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; + if (null != s && "function" == typeof Object.getOwnPropertySymbols) { + for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; + } + return t; +}; +const InternalPopover = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.forwardRef((props, ref)=>{ + var _a, _b; + const { prefixCls: customizePrefixCls, title, content, overlayClassName, placement = 'top', trigger = 'hover', children, mouseEnterDelay = 0.1, mouseLeaveDelay = 0.1, onOpenChange, overlayStyle = {}, styles, classNames: popoverClassNames } = props, otherProps = popover_rest(props, [ + "prefixCls", + "title", + "content", + "overlayClassName", + "placement", + "trigger", + "children", + "mouseEnterDelay", + "mouseLeaveDelay", + "onOpenChange", + "overlayStyle", + "styles", + "classNames" + ]); + const { getPrefixCls, className: contextClassName, style: contextStyle, classNames: contextClassNames, styles: contextStyles } = useComponentConfig('popover'); + const prefixCls = getPrefixCls('popover', customizePrefixCls); + const [wrapCSSVar, hashId, cssVarCls] = popover_style(prefixCls); + const rootPrefixCls = getPrefixCls(); + const rootClassNames = classnames_default()(overlayClassName, hashId, cssVarCls, contextClassName, contextClassNames.root, null == popoverClassNames ? void 0 : popoverClassNames.root); + const bodyClassNames = classnames_default()(contextClassNames.body, null == popoverClassNames ? void 0 : popoverClassNames.body); + const [open, setOpen] = useMergedState(false, { + value: null != (_a = props.open) ? _a : props.visible, + defaultValue: null != (_b = props.defaultOpen) ? _b : props.defaultVisible + }); + const settingOpen = (value, e)=>{ + setOpen(value, true); + null == onOpenChange || onOpenChange(value, e); + }; + const onKeyDown = (e)=>{ + if (e.keyCode === es_KeyCode.ESC) settingOpen(false, e); + }; + const onInternalOpenChange = (value)=>{ + settingOpen(value); + }; + const titleNode = getRenderPropValue(title); + const contentNode = getRenderPropValue(content); + return wrapCSSVar(/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(tooltip, Object.assign({ + placement: placement, + trigger: trigger, + mouseEnterDelay: mouseEnterDelay, + mouseLeaveDelay: mouseLeaveDelay + }, otherProps, { + prefixCls: prefixCls, + classNames: { + root: rootClassNames, + body: bodyClassNames + }, + styles: { + root: Object.assign(Object.assign(Object.assign(Object.assign({}, contextStyles.root), contextStyle), overlayStyle), null == styles ? void 0 : styles.root), + body: Object.assign(Object.assign({}, contextStyles.body), null == styles ? void 0 : styles.body) + }, + ref: ref, + open: open, + onOpenChange: onInternalOpenChange, + overlay: titleNode || contentNode ? /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createElement(Overlay, { + prefixCls: prefixCls, + title: titleNode, + content: contentNode + }) : null, + transitionName: getTransitionName(rootPrefixCls, 'zoom-big', otherProps.transitionName), + "data-popover-inject": true + }), cloneElement(children, { + onKeyDown: (e)=>{ + var _a, _b; + if (/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.isValidElement)(children)) null == (_b = null == children ? void 0 : (_a = children.props).onKeyDown) || _b.call(_a, e); + onKeyDown(e); + } + }))); +}); +const Popover = InternalPopover; +Popover._InternalPanelDoNotUseOrYouWillBeFired = popover_PurePanel; +if ('production' !== process.env.NODE_ENV) Popover.displayName = 'Popover'; +const popover = Popover; +const Link_module = { + root: "root-M0JNBp", + name: "name-EwJVMq", + desc: "desc-xLJBeI", + logo: "logo-rzjMA6" +}; +const IMAGE_PLACEHOLDER = 'data:image/gif;base64,R0lGODlhAQABAAAAACwAAAAAAQABAAA='; +const Link = (props)=>{ + const desc = 'en' === props.lang && props.descEn ? props.descEn : props.desc; + const url = 'en' === props.lang && props.urlEn ? props.urlEn : props.url; + return /*#__PURE__*/ jsxs("a", { + className: Link_module.root, + href: url, + target: "_blank", + rel: "noreferrer", + children: [ + /*#__PURE__*/ jsx("img", { + className: Link_module.logo, + src: props.logo || IMAGE_PLACEHOLDER, + alt: props.name, + style: { + transform: props.logoScale ? `scale(${props.logoScale})` : '' + } + }), + /*#__PURE__*/ jsxs("div", { + className: Link_module.content, + children: [ + /*#__PURE__*/ jsx("div", { + className: Link_module.name, + children: props.name + }), + /*#__PURE__*/ jsx("div", { + className: Link_module.desc, + children: desc + }) + ] + }) + ] + }); +}; +const LinkGroup_module = { + root: "root-PRenbw", + title: "title-z0QBpw" +}; +const LinkGroup = (props)=>{ + const Links = props.links.map((link)=>/*#__PURE__*/ jsx(Link, { + ...link, + lang: props.lang + }, link.name)); + return /*#__PURE__*/ jsx("div", { + className: LinkGroup_module.root, + children: /*#__PURE__*/ jsx("div", { + className: LinkGroup_module.links, + children: Links + }) + }); +}; +const PopoverContent = ({ lang, config })=>/*#__PURE__*/ jsx("div", { + children: config.map((item)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.createElement)(LinkGroup, { + ...item, + lang: lang, + key: item.title + })) + }); +const index_module = { + root: "root-nhoLZk", + popover: "popover-fmVcBt", + wrapper: "wrapper-u2FzAf" +}; +var nav_config_namespaceObject = JSON.parse('[{"title":"","titleEn":"","links":[{"name":"dora-rs","desc":"AI时代机器人框架","descEn":"AI时代机器人框架","logo":"https://g.hgcdn.cn/doracc/dora.svg","url":"https://dora-rs.ai"},{"name":"Github","desc":"dora-rs Github仓库","descEn":"dora-rs Github仓库","logo":"https://g.hgcdn.cn/static/github-480.png","url":"https://github.com/dora-rs/dora"},{"name":"doracc.com","desc":"中文社区仓库","descEn":"中文社区仓库","logo":"https://g.hgcdn.cn/static/github-480.png","url":"https://github.com/DoraCN/doracc.com"},{"name":"李扬","desc":"我的技术笔记","descEn":"我的技术笔记","logo":"https://g.hgcdn.cn/echoli/avatar256.png","url":"https://echoli.cn"}]}]'); +const removeTrailingSlash = (path)=>path.endsWith('/') ? path.slice(0, -1) : path; +function getLang() { + if ('undefined' == typeof window) return 'en'; + const { location } = window; + const langPrefix = '/' === location.pathname ? '' : removeTrailingSlash(location.pathname); + return langPrefix.includes('zh') ? 'zh' : 'en'; +} +const NavIcon = (props = {})=>{ + const lang = props.lang || getLang(); + return /*#__PURE__*/ jsx("div", { + className: index_module.root, + children: /*#__PURE__*/ jsx(popover, { + arrow: false, + trigger: props.trigger, + placement: "bottomLeft", + content: /*#__PURE__*/ jsx(PopoverContent, { + lang: lang, + config: nav_config_namespaceObject + }), + overlayClassName: index_module.popover, + children: /*#__PURE__*/ jsx("div", { + className: index_module.wrapper, + children: /*#__PURE__*/ jsxs("svg", { + width: "20", + height: "20", + fill: "none", + children: [ + /*#__PURE__*/ jsx("title", { + children: "close" + }), + /*#__PURE__*/ jsx("path", { + d: "M2.5 5H5V2.5H2.5V5zM5 11.25H2.5v-2.5H5v2.5zm12.5 0H15v-2.5h2.5v2.5zm-8.75 0h2.5v-2.5h-2.5v2.5zM5 17.5H2.5V15H5v2.5zm10 0h2.5V15H15v2.5zm-3.75 0h-2.5V15h2.5v2.5zM17.5 5H15V2.5h2.5V5zM8.75 5h2.5V2.5h-2.5V5z", + fill: "currentColor" + }) + ] + }) + }) + }) + }); +}; +export { NavIcon }; diff --git a/rstack-doc-ui/dist/nav-icon/index.js.LICENSE.txt b/rstack-doc-ui/dist/nav-icon/index.js.LICENSE.txt new file mode 100644 index 0000000..3637306 --- /dev/null +++ b/rstack-doc-ui/dist/nav-icon/index.js.LICENSE.txt @@ -0,0 +1,27 @@ +/*! + Copyright (c) 2018 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/ + +/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ + +/** + * @license React + * react-is.development.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. + */ + +/** + * @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. + */ \ No newline at end of file diff --git a/rstack-doc-ui/dist/nav-icon/utils.d.ts b/rstack-doc-ui/dist/nav-icon/utils.d.ts new file mode 100644 index 0000000..570787f --- /dev/null +++ b/rstack-doc-ui/dist/nav-icon/utils.d.ts @@ -0,0 +1,8 @@ +import type { LinkInfo } from './components/Link'; +export type Lang = 'zh' | 'en'; +export declare function getLang(): Lang; +export type NavConfig = Array<{ + title: string; + titleEn: string; + links: LinkInfo[]; +}>; diff --git a/rstack-doc-ui/dist/section-style/index.css b/rstack-doc-ui/dist/section-style/index.css new file mode 100644 index 0000000..644bd8f --- /dev/null +++ b/rstack-doc-ui/dist/section-style/index.css @@ -0,0 +1,121 @@ +@media screen and (min-width: 1281px) { + .container-cRbIB3 { + padding: 96px 144px !important; + } + + .titleAndDesc-ubxR_3 { + padding: 0 144px 28px !important; + } +} + +@media screen and (min-width: 835px) and (max-width: 1280px) { + .container-cRbIB3 { + padding: 80px !important; + } + + .titleAndDesc-ubxR_3 { + padding: 0 16px 28px !important; + } +} + +@media screen and (min-width: 601px) and (max-width: 834px) { + .container-cRbIB3 { + padding: 64px 32px !important; + } + + .container-cRbIB3 .innerContainer-d_raLU { + gap: 16px !important; + } + + .titleAndDesc-ubxR_3 { + gap: 16px !important; + padding: 0 16px 28px !important; + } + + .titleAndDesc-ubxR_3 .title-DiGDhG { + font-size: 32px !important; + } + + .titleAndDesc-ubxR_3 .desc-jYXnyt { + font-size: 16px !important; + } +} + +@media screen and (max-width: 600px) { + .container-cRbIB3 { + padding: 64px 24px 24px !important; + } + + .container-cRbIB3 .innerContainer-d_raLU { + gap: 16px !important; + } + + .titleAndDesc-ubxR_3 { + gap: 16px !important; + padding: 0 16px !important; + } + + .titleAndDesc-ubxR_3 .title-DiGDhG { + font-size: 24px !important; + } + + .titleAndDesc-ubxR_3 .desc-jYXnyt { + font-size: 15px !important; + } +} + +.container-cRbIB3 { + flex-direction: column; + justify-content: center; + align-items: center; + padding: 32px; + display: flex; +} + +.container-cRbIB3 .innerContainer-d_raLU { + flex-direction: column; + gap: 32px; + width: 100%; + max-width: 1296px; + display: flex; +} + +.titleAndDesc-ubxR_3 { + flex-direction: column; + align-self: stretch; + align-items: center; + gap: 24px; + padding: 0 144px 32px; + display: flex; +} + +.titleAndDesc-ubxR_3 .title-DiGDhG { + color: var(--landingpage-title-color, #0b0c0e); + text-align: center; + margin: 0; + font-size: 48px; + font-style: normal; + font-weight: 700; +} + +.titleAndDesc-ubxR_3 .desc-jYXnyt { + color: var(--landingpage-desc-color, #6b7075); + text-align: center; + max-width: 760px; + margin: 0; + font-size: 20px; + font-style: normal; + font-weight: 400; + line-height: 32px; +} + +html:not(.dark) { + --landingpage-title-color: #0b0c0e; + --landingpage-desc-color: #6b7075; +} + +html.dark { + --landingpage-title-color: white; + --landingpage-desc-color: #c6cacd; +} + diff --git a/rstack-doc-ui/dist/section-style/index.d.ts b/rstack-doc-ui/dist/section-style/index.d.ts new file mode 100644 index 0000000..970b90e --- /dev/null +++ b/rstack-doc-ui/dist/section-style/index.d.ts @@ -0,0 +1,6 @@ +declare const containerStyle: string; +declare const innerContainerStyle: string; +declare const titleAndDescStyle: string; +declare const titleStyle: string; +declare const descStyle: string; +export { containerStyle, innerContainerStyle, titleAndDescStyle, titleStyle, descStyle, }; diff --git a/rstack-doc-ui/dist/section-style/index.js b/rstack-doc-ui/dist/section-style/index.js new file mode 100644 index 0000000..6c848f7 --- /dev/null +++ b/rstack-doc-ui/dist/section-style/index.js @@ -0,0 +1,14 @@ +import './index.css'; +const shared_module = { + container: "container-cRbIB3", + titleAndDesc: "titleAndDesc-ubxR_3", + innerContainer: "innerContainer-d_raLU", + title: "title-DiGDhG", + desc: "desc-jYXnyt" +}; +const containerStyle = shared_module.container; +const innerContainerStyle = shared_module.innerContainer; +const titleAndDescStyle = shared_module.titleAndDesc; +const titleStyle = shared_module.title; +const descStyle = shared_module.desc; +export { containerStyle, descStyle, innerContainerStyle, titleAndDescStyle, titleStyle }; diff --git a/rstack-doc-ui/dist/shared.d.ts b/rstack-doc-ui/dist/shared.d.ts new file mode 100644 index 0000000..eb5c311 --- /dev/null +++ b/rstack-doc-ui/dist/shared.d.ts @@ -0,0 +1,13 @@ +import type { CSSProperties, ReactNode } from 'react'; +type LinkProps = { + className: string; + href: string; + children: ReactNode; + style?: CSSProperties; +}; +export type LinkComp = (props: LinkProps) => JSX.Element; +/** + * A backup link component, import { Link } from 'rspress/theme' to replace it + */ +export declare const ALink: LinkComp; +export {}; diff --git a/rstack-doc-ui/dist/tool-stack/index.css b/rstack-doc-ui/dist/tool-stack/index.css new file mode 100644 index 0000000..eb3fa99 --- /dev/null +++ b/rstack-doc-ui/dist/tool-stack/index.css @@ -0,0 +1,247 @@ +@media screen and (min-width: 1281px) { + .container-cRbIB3 { + padding: 96px 144px !important; + } + + .titleAndDesc-ubxR_3 { + padding: 0 144px 28px !important; + } +} + +@media screen and (min-width: 835px) and (max-width: 1280px) { + .container-cRbIB3 { + padding: 80px !important; + } + + .titleAndDesc-ubxR_3 { + padding: 0 16px 28px !important; + } +} + +@media screen and (min-width: 601px) and (max-width: 834px) { + .container-cRbIB3 { + padding: 64px 32px !important; + } + + .container-cRbIB3 .innerContainer-d_raLU { + gap: 16px !important; + } + + .titleAndDesc-ubxR_3 { + gap: 16px !important; + padding: 0 16px 28px !important; + } + + .titleAndDesc-ubxR_3 .title-DiGDhG { + font-size: 32px !important; + } + + .titleAndDesc-ubxR_3 .desc-jYXnyt { + font-size: 16px !important; + } +} + +@media screen and (max-width: 600px) { + .container-cRbIB3 { + padding: 64px 24px 24px !important; + } + + .container-cRbIB3 .innerContainer-d_raLU { + gap: 16px !important; + } + + .titleAndDesc-ubxR_3 { + gap: 16px !important; + padding: 0 16px !important; + } + + .titleAndDesc-ubxR_3 .title-DiGDhG { + font-size: 24px !important; + } + + .titleAndDesc-ubxR_3 .desc-jYXnyt { + font-size: 15px !important; + } +} + +.container-cRbIB3 { + flex-direction: column; + justify-content: center; + align-items: center; + padding: 32px; + display: flex; +} + +.container-cRbIB3 .innerContainer-d_raLU { + flex-direction: column; + gap: 32px; + width: 100%; + max-width: 1296px; + display: flex; +} + +.titleAndDesc-ubxR_3 { + flex-direction: column; + align-self: stretch; + align-items: center; + gap: 24px; + padding: 0 144px 32px; + display: flex; +} + +.titleAndDesc-ubxR_3 .title-DiGDhG { + color: var(--landingpage-title-color, #0b0c0e); + text-align: center; + margin: 0; + font-size: 48px; + font-style: normal; + font-weight: 700; +} + +.titleAndDesc-ubxR_3 .desc-jYXnyt { + color: var(--landingpage-desc-color, #6b7075); + text-align: center; + max-width: 760px; + margin: 0; + font-size: 20px; + font-style: normal; + font-weight: 400; + line-height: 32px; +} + +html:not(.dark) { + --landingpage-title-color: #0b0c0e; + --landingpage-desc-color: #6b7075; +} + +html.dark { + --landingpage-title-color: white; + --landingpage-desc-color: #c6cacd; +} + +@media screen and (min-width: 1101px) { + .tools-DsyWdq .tool-_seSD7 { + flex: 0 0 calc(33.33% - 21.33px); + min-width: calc(33.33% - 21.33px); + max-width: calc(33.33% - 21.33px); + } +} + +@media screen and (min-width: 601px) and (max-width: 1100px) { + .tools-DsyWdq .tool-_seSD7 { + flex: 0 0 calc(50% - 16px); + min-width: calc(50% - 16px); + max-width: calc(50% - 16px); + } +} + +@media screen and (max-width: 600px) { + .tools-DsyWdq { + flex-direction: column; + } + + .tools-DsyWdq .tool-_seSD7 { + width: 100%; + } +} + +html:not(.dark) { + --rs-tool-stack-shadow-color: #f9f9f9; + --rs-tool-stack-title-color: #0b0c0e; + --rs-tool-stack-desc-color: #8fa1b9; + --rs-tool-stack-card-stroke: rgba(143, 161, 185, .3); + --rs-tool-stack-card-gradient: linear-gradient(135deg, #fff, rgba(249, 249, 249, .5)); + --rs-tools-stack-url-color: #f93920; +} + +html.dark { + --rs-tool-stack-shadow-color: #23272f; + --rs-tool-stack-title-color: white; + --rs-tool-stack-desc-color: #8fa1b9; + --rs-tool-stack-card-stroke: #23272f; + --rs-tool-stack-card-gradient: linear-gradient(135deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .03)); + --rs-tools-stack-url-color: #ff704d; +} + +.tools-DsyWdq { + flex-wrap: wrap; + justify-content: center; + align-items: center; + gap: 32px; + display: flex; +} + +.tool-_seSD7 { + cursor: pointer; + box-sizing: border-box; + border: 1px solid var(--rs-tool-stack-card-stroke); + background: var(--rs-tool-stack-card-gradient); + border-radius: 10px; + flex-direction: column; + flex: 1 1 0; + align-self: stretch; + align-items: start; + gap: 8px; + padding: 24px; + text-decoration: none; + transition: all .2s ease-out; + display: flex; +} + +.tool-_seSD7:hover { + transform: scale3d(1.03, 1.03, 1.03); +} + +.tool-_seSD7 .logo-axzrU9 { + object-fit: contain; + flex-shrink: 0; + width: 52px; + height: 52px; +} + +.tool-_seSD7 .toolContent-c31Vj4 { + flex-direction: column; + align-items: flex-start; + gap: 8px; + display: flex; +} + +.tool-_seSD7 .toolTitle-Q9zuUy { + color: var(--rs-tool-stack-title-color); + text-align: center; + margin-top: 4px; + font-size: 19px; + font-style: normal; + font-weight: 600; + line-height: 24px; +} + +.tool-_seSD7 .toolDescription-taMfup { + color: var(--rs-tool-stack-desc-color); + text-align: left; + height: 48px; + margin: 0; + font-size: 14px; + font-style: normal; + font-weight: 400; + line-height: 24px; +} + +.tool-_seSD7 .toolUrl-GuRrnE { + color: var(--rs-tools-stack-url-color); + text-align: left; + width: 100%; + font-size: 15px; + font-style: normal; + font-weight: 400; + line-height: 24px; + text-decoration: none; + display: block; +} + +@keyframes rotate-Z9EF9r { + 100% { + transform: rotate(1turn); + } +} + diff --git a/rstack-doc-ui/dist/tool-stack/index.d.ts b/rstack-doc-ui/dist/tool-stack/index.d.ts new file mode 100644 index 0000000..b2017d0 --- /dev/null +++ b/rstack-doc-ui/dist/tool-stack/index.d.ts @@ -0,0 +1,4 @@ +import type React from 'react'; +export declare const ToolStack: React.FC<{ + lang: string; +}>; diff --git a/rstack-doc-ui/dist/tool-stack/index.js b/rstack-doc-ui/dist/tool-stack/index.js new file mode 100644 index 0000000..637676d --- /dev/null +++ b/rstack-doc-ui/dist/tool-stack/index.js @@ -0,0 +1,123 @@ +import './index.css'; +import { jsx, jsxs } from "react/jsx-runtime"; +import { memo } from "react"; +const shared_module = { + container: "container-cRbIB3", + titleAndDesc: "titleAndDesc-ubxR_3", + innerContainer: "innerContainer-d_raLU", + title: "title-DiGDhG", + desc: "desc-jYXnyt" +}; +shared_module.container; +const innerContainerStyle = shared_module.innerContainer; +const titleAndDescStyle = shared_module.titleAndDesc; +const titleStyle = shared_module.title; +const descStyle = shared_module.desc; +const index_module = { + tools: "tools-DsyWdq", + tool: "tool-_seSD7", + logo: "logo-axzrU9", + toolContent: "toolContent-c31Vj4", + toolTitle: "toolTitle-Q9zuUy", + toolDescription: "toolDescription-taMfup", + toolUrl: "toolUrl-GuRrnE", + rotate: "rotate-Z9EF9r" +}; +const ToolStack = /*#__PURE__*/ memo(({ lang })=>{ + const isEn = 'en' === lang; + const tools = [ + { + name: 'Rspack', + desc: isEn ? 'A high performance JavaScript bundler written in Rust, with webpack-compatible API' : "\u57FA\u4E8E Rust \u7F16\u5199\u7684\u9AD8\u6027\u80FD JavaScript \u6253\u5305\u5DE5\u5177\uFF0C\u5177\u5907\u4E0E webpack \u517C\u5BB9\u7684 API", + logo: 'https://assets.rspack.rs/rspack/rspack-logo.svg', + url: 'https://rspack.rs', + urlText: 'rspack.rs' + }, + { + name: 'Rsbuild', + desc: isEn ? 'An Rspack-based build tool that provides out-of-the-box setup' : "\u57FA\u4E8E Rspack \u7684\u6784\u5EFA\u5DE5\u5177\uFF0C\u5305\u542B\u5F00\u7BB1\u5373\u7528\u7684\u9884\u8BBE\u914D\u7F6E\uFF0C\u5E26\u6765\u6109\u60A6\u7684\u5F00\u53D1\u4F53\u9A8C", + logo: 'https://assets.rspack.rs/rsbuild/rsbuild-logo.svg', + url: 'https://rsbuild.rs', + urlText: 'rsbuild.rs' + }, + { + name: 'Rslib', + desc: isEn ? 'A Rsbuild-based library development tool for creating libraries and UI components' : "\u57FA\u4E8E Rsbuild \u7684\u5E93\u5F00\u53D1\u5DE5\u5177\uFF0C\u4EE5\u7B80\u5355\u7684\u65B9\u5F0F\u521B\u5EFA JavaScript \u5E93\u548C UI \u7EC4\u4EF6\u5E93", + logo: 'https://assets.rspack.rs/rslib/rslib-logo.svg', + url: 'https://rslib.rs', + urlText: 'rslib.rs' + }, + { + name: 'Rspress', + desc: isEn ? 'An Rsbuild-based static site generator for creating documentation sites' : "\u57FA\u4E8E Rsbuild \u7684\u9759\u6001\u7AD9\u70B9\u751F\u6210\u5668\uFF0C\u7528\u4E8E\u521B\u5EFA\u4F18\u96C5\u7684\u6587\u6863\u7AD9\u70B9", + logo: 'https://assets.rspack.rs/rspress/rspress-logo-480x480.png', + url: 'https://rspress.rs', + urlText: 'rspress.rs' + }, + { + name: 'Rsdoctor', + desc: isEn ? 'A one-stop build analyzer that makes the build process transparent' : "\u4E00\u7AD9\u5F0F\u7684\u6784\u5EFA\u5206\u6790\u5DE5\u5177\uFF0C\u4F7F\u6784\u5EFA\u6D41\u7A0B\u53D8\u5F97\u900F\u660E\u3001\u53EF\u9884\u6D4B\u548C\u53EF\u4F18\u5316", + logo: 'https://assets.rspack.rs/rsdoctor/rsdoctor-logo-480x480.png', + url: 'https://rsdoctor.rs', + urlText: 'rsdoctor.rs' + }, + { + name: 'Rstest', + desc: isEn ? 'An testing framework that provides first-class support for Rspack ecosystem' : "\u57FA\u4E8E Rspack \u7684\u6D4B\u8BD5\u6846\u67B6\uFF0C\u4E3A Rspack \u751F\u6001\u63D0\u4F9B\u5168\u9762\u3001\u4E00\u6D41\u7684\u652F\u6301", + logo: 'https://assets.rspack.rs/rstest/rstest-logo.svg', + url: 'https://rstest.rs/', + urlText: 'rstest.rs' + } + ]; + return /*#__PURE__*/ jsxs("div", { + className: innerContainerStyle, + children: [ + /*#__PURE__*/ jsxs("div", { + className: titleAndDescStyle, + children: [ + /*#__PURE__*/ jsx("h1", { + className: titleStyle, + children: "Rstack" + }), + /*#__PURE__*/ jsx("p", { + className: descStyle, + children: isEn ? 'A unified JavaScript toolchain built around Rspack, with high performance and consistent architecture' : "\u56F4\u7ED5 Rspack \u6253\u9020\u7684 JavaScript \u7EDF\u4E00\u5DE5\u5177\u94FE\uFF0C\u5177\u6709\u4F18\u79C0\u7684\u6027\u80FD\u548C\u4E00\u81F4\u7684\u67B6\u6784" + }) + ] + }), + /*#__PURE__*/ jsx("div", { + className: index_module.tools, + children: tools.map(({ name, desc, logo, url, urlText })=>/*#__PURE__*/ jsxs("a", { + target: "_blank", + rel: "noreferrer", + className: [ + index_module.tool, + index_module.rainbow + ].join(' '), + href: url, + children: [ + /*#__PURE__*/ jsx("img", { + src: logo, + alt: name, + className: index_module.logo, + loading: "lazy" + }), + /*#__PURE__*/ jsx("div", { + className: index_module.toolTitle, + children: name + }), + /*#__PURE__*/ jsx("p", { + className: index_module.toolDescription, + children: desc + }), + /*#__PURE__*/ jsx("div", { + className: index_module.toolUrl, + children: urlText + }) + ] + }, name)) + }) + ] + }); +}); +export { ToolStack }; diff --git a/rstack-doc-ui/dist/why-rspack/index.css b/rstack-doc-ui/dist/why-rspack/index.css new file mode 100644 index 0000000..ce9b39e --- /dev/null +++ b/rstack-doc-ui/dist/why-rspack/index.css @@ -0,0 +1,173 @@ +@media screen and (min-width: 1281px) { + .featureCard-pszTrm { + flex: 1 0 20% !important; + } +} + +@media screen and (min-width: 835px) and (max-width: 1280px) { + .featureCard-pszTrm { + min-width: 40% !important; + max-width: 50% !important; + } +} + +@media screen and (min-width: 601px) and (max-width: 834px) { + .whyRspack-A_WTpz { + padding: 16px !important; + } + + .whyRspack-A_WTpz .whyRspackTitle-tp0mrZ { + letter-spacing: -1.28px !important; + font-size: 32px !important; + font-weight: 700 !important; + line-height: normal !important; + } + + .whyRspack-A_WTpz .whyRspackDescription-j70toO { + font-size: 19px !important; + font-style: normal !important; + font-weight: 400 !important; + line-height: normal !important; + } + + .featureCard-pszTrm { + min-width: 45% !important; + max-width: 50% !important; + } + + .featureCard-pszTrm .featureCardInner-X8DiWy { + padding: 16px !important; + } + + .featureCard-pszTrm .featureDescription-yPv0tv { + font-size: 14px !important; + } +} + +@media screen and (max-width: 600px) { + .whyRspack-A_WTpz { + min-width: 100% !important; + padding: 16px !important; + } + + .whyRspack-A_WTpz .whyRspackTitle-tp0mrZ { + letter-spacing: -.96px !important; + font-size: 24px !important; + font-style: normal !important; + font-weight: 700 !important; + line-height: normal !important; + } + + .whyRspack-A_WTpz .whyRspackDescription-j70toO { + font-size: 16px !important; + font-style: normal !important; + font-weight: 400 !important; + line-height: normal !important; + } + + .featureCard-pszTrm { + min-width: 100% !important; + } + + .featureCard-pszTrm .featureCardInner-X8DiWy { + padding: 16px !important; + } + + .featureCard-pszTrm .featureDescription-yPv0tv { + font-size: 14px !important; + } + + .whyRspackBg-DglQGL { + max-width: 50% !important; + max-height: 50% !important; + } +} + +html:not(.dark) { + --rs-why-rspack-shadow-color: #f9f9f9; + --rs-why-rspack-title-color: #0b0c0e; + --rs-why-rspack-desc-color: #6b7075; + --rs-why-rspack-card-stroke: rgba(226, 232, 240, .5); + --rs-why-rspack-card-gradient: linear-gradient(135deg, #fff, rgba(249, 249, 249, .5)); + --rs-why-rspack-description-bg: linear-gradient(90deg, #0b0c0e 0%, rgba(11, 12, 14, .4) 100%); +} + +html.dark { + --rs-why-rspack-shadow-color: #23272f; + --rs-why-rspack-title-color: white; + --rs-why-rspack-desc-color: #c6cacd; + --rs-why-rspack-card-stroke: #23272f; + --rs-why-rspack-card-gradient: linear-gradient(135deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .03)); + --rs-why-rspack-description-bg: linear-gradient(87deg, #fff -2.53%, rgba(255, 255, 255, .4) 103.84%); +} + +.features-VP6Ici { + flex-wrap: wrap; + justify-content: flex-start; + align-items: center; + gap: 16px; + width: 100%; + padding: 0; + display: flex; +} + +.features-VP6Ici .featureCard-pszTrm { + flex: 1 0 30%; + align-self: stretch; + display: flex; +} + +.features-VP6Ici .featureCard-pszTrm .featureCardInner-X8DiWy { + border: 1px solid var(--rs-why-rspack-card-stroke); + background: var(--rs-why-rspack-card-gradient); + border-radius: 20px; + flex-direction: column; + flex: 1; + align-items: center; + gap: 16px; + padding: 28px; + text-decoration: none; + display: flex; +} + +.features-VP6Ici .featureCard-pszTrm .featureCardInner-X8DiWy .featureIcon-_1CaCl { + -webkit-user-select: none; + user-select: none; + justify-content: center; + align-items: center; + width: 100%; + display: flex; +} + +.features-VP6Ici .featureCard-pszTrm .featureCardInner-X8DiWy .featureIcon-_1CaCl .featureIconImg-XGmAIS { + width: 150px; + height: 110px; +} + +.features-VP6Ici .featureCard-pszTrm .featureCardInner-X8DiWy .featureContent-DPzQJp { + flex-direction: column; + justify-content: center; + align-items: flex-start; + gap: 8px; + width: 100%; + display: flex; +} + +.features-VP6Ici .featureCard-pszTrm .featureCardInner-X8DiWy .featureContent-DPzQJp .featureTitle-WlHG0x { + color: var(--rs-why-rspack-title-color); + margin: 0; + font-size: 17px; + font-style: normal; + font-weight: 700; + line-height: 1.5; +} + +.features-VP6Ici .featureCard-pszTrm .featureCardInner-X8DiWy .featureContent-DPzQJp .featureDescription-yPv0tv { + color: var(--rs-why-rspack-desc-color); + margin: 0; + font-size: 14px; + font-style: normal; + font-weight: 400; + line-height: 24px; +} + diff --git a/rstack-doc-ui/dist/why-rspack/index.d.ts b/rstack-doc-ui/dist/why-rspack/index.d.ts new file mode 100644 index 0000000..c51441e --- /dev/null +++ b/rstack-doc-ui/dist/why-rspack/index.d.ts @@ -0,0 +1,15 @@ +import { type FC } from 'react'; +import { type LinkComp } from '../shared'; +export type Feature = { + img: string; + url: string; + title: string; + description: string; + lottieJsonData?: any; +}; +export type FeatureListProps = { + features: Feature[]; + LinkComp?: LinkComp; +}; +export type WhyRspackProps = FeatureListProps; +export declare const WhyRspack: FC; diff --git a/rstack-doc-ui/dist/why-rspack/index.js b/rstack-doc-ui/dist/why-rspack/index.js new file mode 100644 index 0000000..5bed1d0 --- /dev/null +++ b/rstack-doc-ui/dist/why-rspack/index.js @@ -0,0 +1,14931 @@ +import './index.css'; +/*! For license information please see index.js.LICENSE.txt */ +import { Fragment, jsx, jsxs } from "react/jsx-runtime"; +import { memo, useEffect, useRef, useState } from "react"; +var __webpack_modules__ = { + "./node_modules/.pnpm/lottie-web@5.13.0/node_modules/lottie-web/build/player/lottie.js": function(module, exports) { + "undefined" != typeof document && "undefined" != typeof navigator && function(global, factory) { + module.exports = factory(); + }(0, function() { + 'use strict'; + var svgNS = 'http://www.w3.org/2000/svg'; + var locationHref = ''; + var _useWebWorker = false; + var initialDefaultFrame = -999999; + var setWebWorker = function(flag) { + _useWebWorker = !!flag; + }; + var getWebWorker = function() { + return _useWebWorker; + }; + var setLocationHref = function(value) { + locationHref = value; + }; + var getLocationHref = function() { + return locationHref; + }; + function createTag(type) { + return document.createElement(type); + } + function extendPrototype(sources, destination) { + var i; + var len = sources.length; + var sourcePrototype; + for(i = 0; i < len; i += 1){ + sourcePrototype = sources[i].prototype; + for(var attr in sourcePrototype)if (Object.prototype.hasOwnProperty.call(sourcePrototype, attr)) destination.prototype[attr] = sourcePrototype[attr]; + } + } + function getDescriptor(object, prop) { + return Object.getOwnPropertyDescriptor(object, prop); + } + function createProxyFunction(prototype) { + function ProxyFunction() {} + ProxyFunction.prototype = prototype; + return ProxyFunction; + } + var audioControllerFactory = function() { + function AudioController(audioFactory) { + this.audios = []; + this.audioFactory = audioFactory; + this._volume = 1; + this._isMuted = false; + } + AudioController.prototype = { + addAudio: function(audio) { + this.audios.push(audio); + }, + pause: function() { + var i; + var len = this.audios.length; + for(i = 0; i < len; i += 1)this.audios[i].pause(); + }, + resume: function() { + var i; + var len = this.audios.length; + for(i = 0; i < len; i += 1)this.audios[i].resume(); + }, + setRate: function(rateValue) { + var i; + var len = this.audios.length; + for(i = 0; i < len; i += 1)this.audios[i].setRate(rateValue); + }, + createAudio: function(assetPath) { + if (this.audioFactory) return this.audioFactory(assetPath); + if (window.Howl) return new window.Howl({ + src: [ + assetPath + ] + }); + return { + isPlaying: false, + play: function() { + this.isPlaying = true; + }, + seek: function() { + this.isPlaying = false; + }, + playing: function() {}, + rate: function() {}, + setVolume: function() {} + }; + }, + setAudioFactory: function(audioFactory) { + this.audioFactory = audioFactory; + }, + setVolume: function(value) { + this._volume = value; + this._updateVolume(); + }, + mute: function() { + this._isMuted = true; + this._updateVolume(); + }, + unmute: function() { + this._isMuted = false; + this._updateVolume(); + }, + getVolume: function() { + return this._volume; + }, + _updateVolume: function() { + var i; + var len = this.audios.length; + for(i = 0; i < len; i += 1)this.audios[i].volume(this._volume * (this._isMuted ? 0 : 1)); + } + }; + return function() { + return new AudioController(); + }; + }(); + var createTypedArray = function() { + function createRegularArray(type, len) { + var i = 0; + var arr = []; + var value; + switch(type){ + case 'int16': + case 'uint8c': + value = 1; + break; + default: + value = 1.1; + break; + } + for(i = 0; i < len; i += 1)arr.push(value); + return arr; + } + function createTypedArrayFactory(type, len) { + if ('float32' === type) return new Float32Array(len); + if ('int16' === type) return new Int16Array(len); + if ('uint8c' === type) return new Uint8ClampedArray(len); + return createRegularArray(type, len); + } + if ('function' == typeof Uint8ClampedArray && 'function' == typeof Float32Array) return createTypedArrayFactory; + return createRegularArray; + }(); + function createSizedArray(len) { + return Array.apply(null, { + length: len + }); + } + function _typeof$6(o) { + return _typeof$6 = "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$6(o); + } + var subframeEnabled = true; + var expressionsPlugin = null; + var expressionsInterfaces = null; + var idPrefix$1 = ''; + var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + var _shouldRoundValues = false; + var bmPow = Math.pow; + var bmSqrt = Math.sqrt; + var bmFloor = Math.floor; + var bmMax = Math.max; + var bmMin = Math.min; + var BMMath = {}; + (function() { + var propertyNames = [ + 'abs', + 'acos', + 'acosh', + 'asin', + 'asinh', + 'atan', + 'atanh', + 'atan2', + 'ceil', + 'cbrt', + 'expm1', + 'clz32', + 'cos', + 'cosh', + 'exp', + 'floor', + 'fround', + 'hypot', + 'imul', + 'log', + 'log1p', + 'log2', + 'log10', + 'max', + 'min', + 'pow', + 'random', + 'round', + 'sign', + 'sin', + 'sinh', + 'sqrt', + 'tan', + 'tanh', + 'trunc', + 'E', + 'LN10', + 'LN2', + 'LOG10E', + 'LOG2E', + 'PI', + 'SQRT1_2', + 'SQRT2' + ]; + var i; + var len = propertyNames.length; + for(i = 0; i < len; i += 1)BMMath[propertyNames[i]] = Math[propertyNames[i]]; + })(); + function ProjectInterface$1() { + return {}; + } + BMMath.random = Math.random; + BMMath.abs = function(val) { + var tOfVal = _typeof$6(val); + if ('object' === tOfVal && val.length) { + var absArr = createSizedArray(val.length); + var i; + var len = val.length; + for(i = 0; i < len; i += 1)absArr[i] = Math.abs(val[i]); + return absArr; + } + return Math.abs(val); + }; + var defaultCurveSegments = 150; + var degToRads = Math.PI / 180; + var roundCorner = 0.5519; + function roundValues(flag) { + _shouldRoundValues = !!flag; + } + function bmRnd(value) { + if (_shouldRoundValues) return Math.round(value); + return value; + } + function styleDiv(element) { + element.style.position = 'absolute'; + element.style.top = 0; + element.style.left = 0; + element.style.display = 'block'; + element.style.transformOrigin = '0 0'; + element.style.webkitTransformOrigin = '0 0'; + element.style.backfaceVisibility = 'visible'; + element.style.webkitBackfaceVisibility = 'visible'; + element.style.transformStyle = 'preserve-3d'; + element.style.webkitTransformStyle = 'preserve-3d'; + element.style.mozTransformStyle = 'preserve-3d'; + } + function BMEnterFrameEvent(type, currentTime, totalTime, frameMultiplier) { + this.type = type; + this.currentTime = currentTime; + this.totalTime = totalTime; + this.direction = frameMultiplier < 0 ? -1 : 1; + } + function BMCompleteEvent(type, frameMultiplier) { + this.type = type; + this.direction = frameMultiplier < 0 ? -1 : 1; + } + function BMCompleteLoopEvent(type, totalLoops, currentLoop, frameMultiplier) { + this.type = type; + this.currentLoop = currentLoop; + this.totalLoops = totalLoops; + this.direction = frameMultiplier < 0 ? -1 : 1; + } + function BMSegmentStartEvent(type, firstFrame, totalFrames) { + this.type = type; + this.firstFrame = firstFrame; + this.totalFrames = totalFrames; + } + function BMDestroyEvent(type, target) { + this.type = type; + this.target = target; + } + function BMRenderFrameErrorEvent(nativeError, currentTime) { + this.type = 'renderFrameError'; + this.nativeError = nativeError; + this.currentTime = currentTime; + } + function BMConfigErrorEvent(nativeError) { + this.type = 'configError'; + this.nativeError = nativeError; + } + function BMAnimationConfigErrorEvent(type, nativeError) { + this.type = type; + this.nativeError = nativeError; + } + var createElementID = function() { + var _count = 0; + return function() { + _count += 1; + return idPrefix$1 + '__lottie_element_' + _count; + }; + }(); + function HSVtoRGB(h, s, v) { + var r; + var g; + var b; + var i; + var f; + var p; + var q; + var t; + i = Math.floor(6 * h); + f = 6 * h - i; + p = v * (1 - s); + q = v * (1 - f * s); + t = v * (1 - (1 - f) * s); + switch(i % 6){ + case 0: + r = v; + g = t; + b = p; + break; + case 1: + r = q; + g = v; + b = p; + break; + case 2: + r = p; + g = v; + b = t; + break; + case 3: + r = p; + g = q; + b = v; + break; + case 4: + r = t; + g = p; + b = v; + break; + case 5: + r = v; + g = p; + b = q; + break; + default: + break; + } + return [ + r, + g, + b + ]; + } + function RGBtoHSV(r, g, b) { + var max = Math.max(r, g, b); + var min = Math.min(r, g, b); + var d = max - min; + var h; + var s = 0 === max ? 0 : d / max; + var v = max / 255; + switch(max){ + case min: + h = 0; + break; + case r: + h = g - b + d * (g < b ? 6 : 0); + h /= 6 * d; + break; + case g: + h = b - r + 2 * d; + h /= 6 * d; + break; + case b: + h = r - g + 4 * d; + h /= 6 * d; + break; + default: + break; + } + return [ + h, + s, + v + ]; + } + function addSaturationToRGB(color, offset) { + var hsv = RGBtoHSV(255 * color[0], 255 * color[1], 255 * color[2]); + hsv[1] += offset; + if (hsv[1] > 1) hsv[1] = 1; + else if (hsv[1] <= 0) hsv[1] = 0; + return HSVtoRGB(hsv[0], hsv[1], hsv[2]); + } + function addBrightnessToRGB(color, offset) { + var hsv = RGBtoHSV(255 * color[0], 255 * color[1], 255 * color[2]); + hsv[2] += offset; + if (hsv[2] > 1) hsv[2] = 1; + else if (hsv[2] < 0) hsv[2] = 0; + return HSVtoRGB(hsv[0], hsv[1], hsv[2]); + } + function addHueToRGB(color, offset) { + var hsv = RGBtoHSV(255 * color[0], 255 * color[1], 255 * color[2]); + hsv[0] += offset / 360; + if (hsv[0] > 1) hsv[0] -= 1; + else if (hsv[0] < 0) hsv[0] += 1; + return HSVtoRGB(hsv[0], hsv[1], hsv[2]); + } + var rgbToHex = function() { + var colorMap = []; + var i; + var hex; + for(i = 0; i < 256; i += 1){ + hex = i.toString(16); + colorMap[i] = 1 === hex.length ? '0' + hex : hex; + } + return function(r, g, b) { + if (r < 0) r = 0; + if (g < 0) g = 0; + if (b < 0) b = 0; + return '#' + colorMap[r] + colorMap[g] + colorMap[b]; + }; + }(); + var setSubframeEnabled = function(flag) { + subframeEnabled = !!flag; + }; + var getSubframeEnabled = function() { + return subframeEnabled; + }; + var setExpressionsPlugin = function(value) { + expressionsPlugin = value; + }; + var getExpressionsPlugin = function() { + return expressionsPlugin; + }; + var setExpressionInterfaces = function(value) { + expressionsInterfaces = value; + }; + var getExpressionInterfaces = function() { + return expressionsInterfaces; + }; + var setDefaultCurveSegments = function(value) { + defaultCurveSegments = value; + }; + var getDefaultCurveSegments = function() { + return defaultCurveSegments; + }; + var setIdPrefix = function(value) { + idPrefix$1 = value; + }; + var getIdPrefix = function() { + return idPrefix$1; + }; + function createNS(type) { + return document.createElementNS(svgNS, type); + } + function _typeof$5(o) { + return _typeof$5 = "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$5(o); + } + var dataManager = function() { + var _counterId = 1; + var processes = []; + var workerFn; + var workerInstance; + var workerProxy = { + onmessage: function() {}, + postMessage: function(path) { + workerFn({ + data: path + }); + } + }; + var _workerSelf = { + postMessage: function(data) { + workerProxy.onmessage({ + data: data + }); + } + }; + function createWorker(fn) { + if (window.Worker && window.Blob && getWebWorker()) { + var blob = new Blob([ + 'var _workerSelf = self; self.onmessage = ', + fn.toString() + ], { + type: "text/javascript" + }); + var url = URL.createObjectURL(blob); + return new Worker(url); + } + workerFn = fn; + return workerProxy; + } + function setupWorker() { + if (!workerInstance) { + workerInstance = createWorker(function(e) { + function dataFunctionManager() { + function completeLayers(layers, comps) { + var layerData; + var i; + var len = layers.length; + var j; + var jLen; + var k; + var kLen; + for(i = 0; i < len; i += 1){ + layerData = layers[i]; + if ('ks' in layerData && !layerData.completed) { + layerData.completed = true; + if (layerData.hasMask) { + var maskProps = layerData.masksProperties; + jLen = maskProps.length; + for(j = 0; j < jLen; j += 1)if (maskProps[j].pt.k.i) convertPathsToAbsoluteValues(maskProps[j].pt.k); + else { + kLen = maskProps[j].pt.k.length; + for(k = 0; k < kLen; k += 1){ + if (maskProps[j].pt.k[k].s) convertPathsToAbsoluteValues(maskProps[j].pt.k[k].s[0]); + if (maskProps[j].pt.k[k].e) convertPathsToAbsoluteValues(maskProps[j].pt.k[k].e[0]); + } + } + } + if (0 === layerData.ty) { + layerData.layers = findCompLayers(layerData.refId, comps); + completeLayers(layerData.layers, comps); + } else if (4 === layerData.ty) completeShapes(layerData.shapes); + else if (5 === layerData.ty) completeText(layerData); + } + } + } + function completeChars(chars, assets) { + if (chars) { + var i = 0; + var len = chars.length; + for(i = 0; i < len; i += 1)if (1 === chars[i].t) { + chars[i].data.layers = findCompLayers(chars[i].data.refId, assets); + completeLayers(chars[i].data.layers, assets); + } + } + } + function findComp(id, comps) { + var i = 0; + var len = comps.length; + while(i < len){ + if (comps[i].id === id) return comps[i]; + i += 1; + } + return null; + } + function findCompLayers(id, comps) { + var comp = findComp(id, comps); + if (comp) { + if (!comp.layers.__used) { + comp.layers.__used = true; + return comp.layers; + } + return JSON.parse(JSON.stringify(comp.layers)); + } + return null; + } + function completeShapes(arr) { + var i; + var len = arr.length; + var j; + var jLen; + for(i = len - 1; i >= 0; i -= 1)if ('sh' === arr[i].ty) if (arr[i].ks.k.i) convertPathsToAbsoluteValues(arr[i].ks.k); + else { + jLen = arr[i].ks.k.length; + for(j = 0; j < jLen; j += 1){ + if (arr[i].ks.k[j].s) convertPathsToAbsoluteValues(arr[i].ks.k[j].s[0]); + if (arr[i].ks.k[j].e) convertPathsToAbsoluteValues(arr[i].ks.k[j].e[0]); + } + } + else if ('gr' === arr[i].ty) completeShapes(arr[i].it); + } + function convertPathsToAbsoluteValues(path) { + var i; + var len = path.i.length; + for(i = 0; i < len; i += 1){ + path.i[i][0] += path.v[i][0]; + path.i[i][1] += path.v[i][1]; + path.o[i][0] += path.v[i][0]; + path.o[i][1] += path.v[i][1]; + } + } + function checkVersion(minimum, animVersionString) { + var animVersion = animVersionString ? animVersionString.split('.') : [ + 100, + 100, + 100 + ]; + if (minimum[0] > animVersion[0]) return true; + if (animVersion[0] > minimum[0]) return false; + if (minimum[1] > animVersion[1]) return true; + if (animVersion[1] > minimum[1]) return false; + if (minimum[2] > animVersion[2]) return true; + if (animVersion[2] > minimum[2]) return false; + return null; + } + var checkText = function() { + var minimumVersion = [ + 4, + 4, + 14 + ]; + function updateTextLayer(textLayer) { + var documentData = textLayer.t.d; + textLayer.t.d = { + k: [ + { + s: documentData, + t: 0 + } + ] + }; + } + function iterateLayers(layers) { + var i; + var len = layers.length; + for(i = 0; i < len; i += 1)if (5 === layers[i].ty) updateTextLayer(layers[i]); + } + return function(animationData) { + if (checkVersion(minimumVersion, animationData.v)) { + iterateLayers(animationData.layers); + if (animationData.assets) { + var i; + var len = animationData.assets.length; + for(i = 0; i < len; i += 1)if (animationData.assets[i].layers) iterateLayers(animationData.assets[i].layers); + } + } + }; + }(); + var checkChars = function() { + var minimumVersion = [ + 4, + 7, + 99 + ]; + return function(animationData) { + if (animationData.chars && !checkVersion(minimumVersion, animationData.v)) { + var i; + var len = animationData.chars.length; + for(i = 0; i < len; i += 1){ + var charData = animationData.chars[i]; + if (charData.data && charData.data.shapes) { + completeShapes(charData.data.shapes); + charData.data.ip = 0; + charData.data.op = 99999; + charData.data.st = 0; + charData.data.sr = 1; + charData.data.ks = { + p: { + k: [ + 0, + 0 + ], + a: 0 + }, + s: { + k: [ + 100, + 100 + ], + a: 0 + }, + a: { + k: [ + 0, + 0 + ], + a: 0 + }, + r: { + k: 0, + a: 0 + }, + o: { + k: 100, + a: 0 + } + }; + if (!animationData.chars[i].t) { + charData.data.shapes.push({ + ty: 'no' + }); + charData.data.shapes[0].it.push({ + p: { + k: [ + 0, + 0 + ], + a: 0 + }, + s: { + k: [ + 100, + 100 + ], + a: 0 + }, + a: { + k: [ + 0, + 0 + ], + a: 0 + }, + r: { + k: 0, + a: 0 + }, + o: { + k: 100, + a: 0 + }, + sk: { + k: 0, + a: 0 + }, + sa: { + k: 0, + a: 0 + }, + ty: 'tr' + }); + } + } + } + } + }; + }(); + var checkPathProperties = function() { + var minimumVersion = [ + 5, + 7, + 15 + ]; + function updateTextLayer(textLayer) { + var pathData = textLayer.t.p; + if ('number' == typeof pathData.a) pathData.a = { + a: 0, + k: pathData.a + }; + if ('number' == typeof pathData.p) pathData.p = { + a: 0, + k: pathData.p + }; + if ('number' == typeof pathData.r) pathData.r = { + a: 0, + k: pathData.r + }; + } + function iterateLayers(layers) { + var i; + var len = layers.length; + for(i = 0; i < len; i += 1)if (5 === layers[i].ty) updateTextLayer(layers[i]); + } + return function(animationData) { + if (checkVersion(minimumVersion, animationData.v)) { + iterateLayers(animationData.layers); + if (animationData.assets) { + var i; + var len = animationData.assets.length; + for(i = 0; i < len; i += 1)if (animationData.assets[i].layers) iterateLayers(animationData.assets[i].layers); + } + } + }; + }(); + var checkColors = function() { + var minimumVersion = [ + 4, + 1, + 9 + ]; + function iterateShapes(shapes) { + var i; + var len = shapes.length; + var j; + var jLen; + for(i = 0; i < len; i += 1)if ('gr' === shapes[i].ty) iterateShapes(shapes[i].it); + else if ('fl' === shapes[i].ty || 'st' === shapes[i].ty) if (shapes[i].c.k && shapes[i].c.k[0].i) { + jLen = shapes[i].c.k.length; + for(j = 0; j < jLen; j += 1){ + if (shapes[i].c.k[j].s) { + shapes[i].c.k[j].s[0] /= 255; + shapes[i].c.k[j].s[1] /= 255; + shapes[i].c.k[j].s[2] /= 255; + shapes[i].c.k[j].s[3] /= 255; + } + if (shapes[i].c.k[j].e) { + shapes[i].c.k[j].e[0] /= 255; + shapes[i].c.k[j].e[1] /= 255; + shapes[i].c.k[j].e[2] /= 255; + shapes[i].c.k[j].e[3] /= 255; + } + } + } else { + shapes[i].c.k[0] /= 255; + shapes[i].c.k[1] /= 255; + shapes[i].c.k[2] /= 255; + shapes[i].c.k[3] /= 255; + } + } + function iterateLayers(layers) { + var i; + var len = layers.length; + for(i = 0; i < len; i += 1)if (4 === layers[i].ty) iterateShapes(layers[i].shapes); + } + return function(animationData) { + if (checkVersion(minimumVersion, animationData.v)) { + iterateLayers(animationData.layers); + if (animationData.assets) { + var i; + var len = animationData.assets.length; + for(i = 0; i < len; i += 1)if (animationData.assets[i].layers) iterateLayers(animationData.assets[i].layers); + } + } + }; + }(); + var checkShapes = function() { + var minimumVersion = [ + 4, + 4, + 18 + ]; + function completeClosingShapes(arr) { + var i; + var len = arr.length; + var j; + var jLen; + for(i = len - 1; i >= 0; i -= 1)if ('sh' === arr[i].ty) if (arr[i].ks.k.i) arr[i].ks.k.c = arr[i].closed; + else { + jLen = arr[i].ks.k.length; + for(j = 0; j < jLen; j += 1){ + if (arr[i].ks.k[j].s) arr[i].ks.k[j].s[0].c = arr[i].closed; + if (arr[i].ks.k[j].e) arr[i].ks.k[j].e[0].c = arr[i].closed; + } + } + else if ('gr' === arr[i].ty) completeClosingShapes(arr[i].it); + } + function iterateLayers(layers) { + var layerData; + var i; + var len = layers.length; + var j; + var jLen; + var k; + var kLen; + for(i = 0; i < len; i += 1){ + layerData = layers[i]; + if (layerData.hasMask) { + var maskProps = layerData.masksProperties; + jLen = maskProps.length; + for(j = 0; j < jLen; j += 1)if (maskProps[j].pt.k.i) maskProps[j].pt.k.c = maskProps[j].cl; + else { + kLen = maskProps[j].pt.k.length; + for(k = 0; k < kLen; k += 1){ + if (maskProps[j].pt.k[k].s) maskProps[j].pt.k[k].s[0].c = maskProps[j].cl; + if (maskProps[j].pt.k[k].e) maskProps[j].pt.k[k].e[0].c = maskProps[j].cl; + } + } + } + if (4 === layerData.ty) completeClosingShapes(layerData.shapes); + } + } + return function(animationData) { + if (checkVersion(minimumVersion, animationData.v)) { + iterateLayers(animationData.layers); + if (animationData.assets) { + var i; + var len = animationData.assets.length; + for(i = 0; i < len; i += 1)if (animationData.assets[i].layers) iterateLayers(animationData.assets[i].layers); + } + } + }; + }(); + function completeData(animationData) { + if (animationData.__complete) return; + checkColors(animationData); + checkText(animationData); + checkChars(animationData); + checkPathProperties(animationData); + checkShapes(animationData); + completeLayers(animationData.layers, animationData.assets); + completeChars(animationData.chars, animationData.assets); + animationData.__complete = true; + } + function completeText(data) { + 0 === data.t.a.length && data.t.p; + } + var moduleOb = {}; + moduleOb.completeData = completeData; + moduleOb.checkColors = checkColors; + moduleOb.checkChars = checkChars; + moduleOb.checkPathProperties = checkPathProperties; + moduleOb.checkShapes = checkShapes; + moduleOb.completeLayers = completeLayers; + return moduleOb; + } + if (!_workerSelf.dataManager) _workerSelf.dataManager = dataFunctionManager(); + if (!_workerSelf.assetLoader) _workerSelf.assetLoader = function() { + function formatResponse(xhr) { + var contentTypeHeader = xhr.getResponseHeader('content-type'); + if (contentTypeHeader && 'json' === xhr.responseType && -1 !== contentTypeHeader.indexOf('json')) return xhr.response; + if (xhr.response && 'object' === _typeof$5(xhr.response)) return xhr.response; + if (xhr.response && 'string' == typeof xhr.response) return JSON.parse(xhr.response); + if (xhr.responseText) return JSON.parse(xhr.responseText); + return null; + } + function loadAsset(path, fullPath, callback, errorCallback) { + var response; + var xhr = new XMLHttpRequest(); + try { + xhr.responseType = 'json'; + } catch (err) {} + xhr.onreadystatechange = function() { + if (4 === xhr.readyState) if (200 === xhr.status) { + response = formatResponse(xhr); + callback(response); + } else try { + response = formatResponse(xhr); + callback(response); + } catch (err) { + if (errorCallback) errorCallback(err); + } + }; + try { + xhr.open("GET", path, true); + } catch (error) { + xhr.open("GET", fullPath + '/' + path, true); + } + xhr.send(); + } + return { + load: loadAsset + }; + }(); + if ('loadAnimation' === e.data.type) _workerSelf.assetLoader.load(e.data.path, e.data.fullPath, function(data) { + _workerSelf.dataManager.completeData(data); + _workerSelf.postMessage({ + id: e.data.id, + payload: data, + status: 'success' + }); + }, function() { + _workerSelf.postMessage({ + id: e.data.id, + status: 'error' + }); + }); + else if ('complete' === e.data.type) { + var animation = e.data.animation; + _workerSelf.dataManager.completeData(animation); + _workerSelf.postMessage({ + id: e.data.id, + payload: animation, + status: 'success' + }); + } else if ('loadData' === e.data.type) _workerSelf.assetLoader.load(e.data.path, e.data.fullPath, function(data) { + _workerSelf.postMessage({ + id: e.data.id, + payload: data, + status: 'success' + }); + }, function() { + _workerSelf.postMessage({ + id: e.data.id, + status: 'error' + }); + }); + }); + workerInstance.onmessage = function(event) { + var data = event.data; + var id = data.id; + var process = processes[id]; + processes[id] = null; + if ('success' === data.status) process.onComplete(data.payload); + else if (process.onError) process.onError(); + }; + } + } + function createProcess(onComplete, onError) { + _counterId += 1; + var id = 'processId_' + _counterId; + processes[id] = { + onComplete: onComplete, + onError: onError + }; + return id; + } + function loadAnimation(path, onComplete, onError) { + setupWorker(); + var processId = createProcess(onComplete, onError); + workerInstance.postMessage({ + type: 'loadAnimation', + path: path, + fullPath: window.location.origin + window.location.pathname, + id: processId + }); + } + function loadData(path, onComplete, onError) { + setupWorker(); + var processId = createProcess(onComplete, onError); + workerInstance.postMessage({ + type: 'loadData', + path: path, + fullPath: window.location.origin + window.location.pathname, + id: processId + }); + } + function completeAnimation(anim, onComplete, onError) { + setupWorker(); + var processId = createProcess(onComplete, onError); + workerInstance.postMessage({ + type: 'complete', + animation: anim, + id: processId + }); + } + return { + loadAnimation: loadAnimation, + loadData: loadData, + completeAnimation: completeAnimation + }; + }(); + var ImagePreloader = function() { + var proxyImage = function() { + var canvas = createTag('canvas'); + canvas.width = 1; + canvas.height = 1; + var ctx = canvas.getContext('2d'); + ctx.fillStyle = 'rgba(0,0,0,0)'; + ctx.fillRect(0, 0, 1, 1); + return canvas; + }(); + function imageLoaded() { + this.loadedAssets += 1; + if (this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages) { + if (this.imagesLoadedCb) this.imagesLoadedCb(null); + } + } + function footageLoaded() { + this.loadedFootagesCount += 1; + if (this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages) { + if (this.imagesLoadedCb) this.imagesLoadedCb(null); + } + } + function getAssetsPath(assetData, assetsPath, originalPath) { + var path = ''; + if (assetData.e) path = assetData.p; + else if (assetsPath) { + var imagePath = assetData.p; + if (-1 !== imagePath.indexOf('images/')) imagePath = imagePath.split('/')[1]; + path = assetsPath + imagePath; + } else { + path = originalPath; + path += assetData.u ? assetData.u : ''; + path += assetData.p; + } + return path; + } + function testImageLoaded(img) { + var _count = 0; + var intervalId = setInterval((function() { + var box = img.getBBox(); + if (box.width || _count > 500) { + this._imageLoaded(); + clearInterval(intervalId); + } + _count += 1; + }).bind(this), 50); + } + function createImageData(assetData) { + var path = getAssetsPath(assetData, this.assetsPath, this.path); + var img = createNS('image'); + if (isSafari) this.testImageLoaded(img); + else img.addEventListener('load', this._imageLoaded, false); + img.addEventListener('error', (function() { + ob.img = proxyImage; + this._imageLoaded(); + }).bind(this), false); + img.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path); + if (this._elementHelper.append) this._elementHelper.append(img); + else this._elementHelper.appendChild(img); + var ob = { + img: img, + assetData: assetData + }; + return ob; + } + function createImgData(assetData) { + var path = getAssetsPath(assetData, this.assetsPath, this.path); + var img = createTag('img'); + img.crossOrigin = 'anonymous'; + img.addEventListener('load', this._imageLoaded, false); + img.addEventListener('error', (function() { + ob.img = proxyImage; + this._imageLoaded(); + }).bind(this), false); + img.src = path; + var ob = { + img: img, + assetData: assetData + }; + return ob; + } + function createFootageData(data) { + var ob = { + assetData: data + }; + var path = getAssetsPath(data, this.assetsPath, this.path); + dataManager.loadData(path, (function(footageData) { + ob.img = footageData; + this._footageLoaded(); + }).bind(this), (function() { + ob.img = {}; + this._footageLoaded(); + }).bind(this)); + return ob; + } + function loadAssets(assets, cb) { + this.imagesLoadedCb = cb; + var i; + var len = assets.length; + for(i = 0; i < len; i += 1)if (!assets[i].layers) if (assets[i].t && 'seq' !== assets[i].t) { + if (3 === assets[i].t) { + this.totalFootages += 1; + this.images.push(this.createFootageData(assets[i])); + } + } else { + this.totalImages += 1; + this.images.push(this._createImageData(assets[i])); + } + } + function setPath(path) { + this.path = path || ''; + } + function setAssetsPath(path) { + this.assetsPath = path || ''; + } + function getAsset(assetData) { + var i = 0; + var len = this.images.length; + while(i < len){ + if (this.images[i].assetData === assetData) return this.images[i].img; + i += 1; + } + return null; + } + function destroy() { + this.imagesLoadedCb = null; + this.images.length = 0; + } + function loadedImages() { + return this.totalImages === this.loadedAssets; + } + function loadedFootages() { + return this.totalFootages === this.loadedFootagesCount; + } + function setCacheType(type, elementHelper) { + if ('svg' === type) { + this._elementHelper = elementHelper; + this._createImageData = this.createImageData.bind(this); + } else this._createImageData = this.createImgData.bind(this); + } + function ImagePreloaderFactory() { + this._imageLoaded = imageLoaded.bind(this); + this._footageLoaded = footageLoaded.bind(this); + this.testImageLoaded = testImageLoaded.bind(this); + this.createFootageData = createFootageData.bind(this); + this.assetsPath = ''; + this.path = ''; + this.totalImages = 0; + this.totalFootages = 0; + this.loadedAssets = 0; + this.loadedFootagesCount = 0; + this.imagesLoadedCb = null; + this.images = []; + } + ImagePreloaderFactory.prototype = { + loadAssets: loadAssets, + setAssetsPath: setAssetsPath, + setPath: setPath, + loadedImages: loadedImages, + loadedFootages: loadedFootages, + destroy: destroy, + getAsset: getAsset, + createImgData: createImgData, + createImageData: createImageData, + imageLoaded: imageLoaded, + footageLoaded: footageLoaded, + setCacheType: setCacheType + }; + return ImagePreloaderFactory; + }(); + function BaseEvent() {} + BaseEvent.prototype = { + triggerEvent: function(eventName, args) { + if (this._cbs[eventName]) { + var callbacks = this._cbs[eventName]; + for(var i = 0; i < callbacks.length; i += 1)callbacks[i](args); + } + }, + addEventListener: function(eventName, callback) { + if (!this._cbs[eventName]) this._cbs[eventName] = []; + this._cbs[eventName].push(callback); + return (function() { + this.removeEventListener(eventName, callback); + }).bind(this); + }, + removeEventListener: function(eventName, callback) { + if (callback) { + if (this._cbs[eventName]) { + var i = 0; + var len = this._cbs[eventName].length; + while(i < len){ + if (this._cbs[eventName][i] === callback) { + this._cbs[eventName].splice(i, 1); + i -= 1; + len -= 1; + } + i += 1; + } + if (!this._cbs[eventName].length) this._cbs[eventName] = null; + } + } else this._cbs[eventName] = null; + } + }; + var markerParser = function() { + function parsePayloadLines(payload) { + var lines = payload.split('\r\n'); + var keys = {}; + var line; + var keysCount = 0; + for(var i = 0; i < lines.length; i += 1){ + line = lines[i].split(':'); + if (2 === line.length) { + keys[line[0]] = line[1].trim(); + keysCount += 1; + } + } + if (0 === keysCount) throw new Error(); + return keys; + } + return function(_markers) { + var markers = []; + for(var i = 0; i < _markers.length; i += 1){ + var _marker = _markers[i]; + var markerData = { + time: _marker.tm, + duration: _marker.dr + }; + try { + markerData.payload = JSON.parse(_markers[i].cm); + } catch (_) { + try { + markerData.payload = parsePayloadLines(_markers[i].cm); + } catch (__) { + markerData.payload = { + name: _markers[i].cm + }; + } + } + markers.push(markerData); + } + return markers; + }; + }(); + var ProjectInterface = function() { + function registerComposition(comp) { + this.compositions.push(comp); + } + return function() { + function _thisProjectFunction(name) { + var i = 0; + var len = this.compositions.length; + while(i < len){ + if (this.compositions[i].data && this.compositions[i].data.nm === name) { + if (this.compositions[i].prepareFrame && this.compositions[i].data.xt) this.compositions[i].prepareFrame(this.currentFrame); + return this.compositions[i].compInterface; + } + i += 1; + } + return null; + } + _thisProjectFunction.compositions = []; + _thisProjectFunction.currentFrame = 0; + _thisProjectFunction.registerComposition = registerComposition; + return _thisProjectFunction; + }; + }(); + var renderers = {}; + var registerRenderer = function(key, value) { + renderers[key] = value; + }; + function getRenderer(key) { + return renderers[key]; + } + function getRegisteredRenderer() { + if (renderers.canvas) return 'canvas'; + for(var key in renderers)if (renderers[key]) return key; + return ''; + } + function _typeof$4(o) { + return _typeof$4 = "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$4(o); + } + var AnimationItem = function() { + this._cbs = []; + this.name = ''; + this.path = ''; + this.isLoaded = false; + this.currentFrame = 0; + this.currentRawFrame = 0; + this.firstFrame = 0; + this.totalFrames = 0; + this.frameRate = 0; + this.frameMult = 0; + this.playSpeed = 1; + this.playDirection = 1; + this.playCount = 0; + this.animationData = {}; + this.assets = []; + this.isPaused = true; + this.autoplay = false; + this.loop = true; + this.renderer = null; + this.animationID = createElementID(); + this.assetsPath = ''; + this.timeCompleted = 0; + this.segmentPos = 0; + this.isSubframeEnabled = getSubframeEnabled(); + this.segments = []; + this._idle = true; + this._completedLoop = false; + this.projectInterface = ProjectInterface(); + this.imagePreloader = new ImagePreloader(); + this.audioController = audioControllerFactory(); + this.markers = []; + this.configAnimation = this.configAnimation.bind(this); + this.onSetupError = this.onSetupError.bind(this); + this.onSegmentComplete = this.onSegmentComplete.bind(this); + this.drawnFrameEvent = new BMEnterFrameEvent('drawnFrame', 0, 0, 0); + this.expressionsPlugin = getExpressionsPlugin(); + }; + extendPrototype([ + BaseEvent + ], AnimationItem); + AnimationItem.prototype.setParams = function(params) { + if (params.wrapper || params.container) this.wrapper = params.wrapper || params.container; + var animType = 'svg'; + if (params.animType) animType = params.animType; + else if (params.renderer) animType = params.renderer; + var RendererClass = getRenderer(animType); + this.renderer = new RendererClass(this, params.rendererSettings); + this.imagePreloader.setCacheType(animType, this.renderer.globalData.defs); + this.renderer.setProjectInterface(this.projectInterface); + this.animType = animType; + if ('' === params.loop || null === params.loop || void 0 === params.loop || true === params.loop) this.loop = true; + else if (false === params.loop) this.loop = false; + else this.loop = parseInt(params.loop, 10); + this.autoplay = 'autoplay' in params ? params.autoplay : true; + this.name = params.name ? params.name : ''; + this.autoloadSegments = Object.prototype.hasOwnProperty.call(params, 'autoloadSegments') ? params.autoloadSegments : true; + this.assetsPath = params.assetsPath; + this.initialSegment = params.initialSegment; + if (params.audioFactory) this.audioController.setAudioFactory(params.audioFactory); + if (params.animationData) this.setupAnimation(params.animationData); + else if (params.path) { + if (-1 !== params.path.lastIndexOf('\\')) this.path = params.path.substr(0, params.path.lastIndexOf('\\') + 1); + else this.path = params.path.substr(0, params.path.lastIndexOf('/') + 1); + this.fileName = params.path.substr(params.path.lastIndexOf('/') + 1); + this.fileName = this.fileName.substr(0, this.fileName.lastIndexOf('.json')); + dataManager.loadAnimation(params.path, this.configAnimation, this.onSetupError); + } + }; + AnimationItem.prototype.onSetupError = function() { + this.trigger('data_failed'); + }; + AnimationItem.prototype.setupAnimation = function(data) { + dataManager.completeAnimation(data, this.configAnimation); + }; + AnimationItem.prototype.setData = function(wrapper, animationData) { + if (animationData) { + if ('object' !== _typeof$4(animationData)) animationData = JSON.parse(animationData); + } + var params = { + wrapper: wrapper, + animationData: animationData + }; + var wrapperAttributes = wrapper.attributes; + params.path = wrapperAttributes.getNamedItem('data-animation-path') ? wrapperAttributes.getNamedItem('data-animation-path').value : wrapperAttributes.getNamedItem('data-bm-path') ? wrapperAttributes.getNamedItem('data-bm-path').value : wrapperAttributes.getNamedItem('bm-path') ? wrapperAttributes.getNamedItem('bm-path').value : ''; + params.animType = wrapperAttributes.getNamedItem('data-anim-type') ? wrapperAttributes.getNamedItem('data-anim-type').value : wrapperAttributes.getNamedItem('data-bm-type') ? wrapperAttributes.getNamedItem('data-bm-type').value : wrapperAttributes.getNamedItem('bm-type') ? wrapperAttributes.getNamedItem('bm-type').value : wrapperAttributes.getNamedItem('data-bm-renderer') ? wrapperAttributes.getNamedItem('data-bm-renderer').value : wrapperAttributes.getNamedItem('bm-renderer') ? wrapperAttributes.getNamedItem('bm-renderer').value : getRegisteredRenderer() || 'canvas'; + var loop = wrapperAttributes.getNamedItem('data-anim-loop') ? wrapperAttributes.getNamedItem('data-anim-loop').value : wrapperAttributes.getNamedItem('data-bm-loop') ? wrapperAttributes.getNamedItem('data-bm-loop').value : wrapperAttributes.getNamedItem('bm-loop') ? wrapperAttributes.getNamedItem('bm-loop').value : ''; + if ('false' === loop) params.loop = false; + else if ('true' === loop) params.loop = true; + else if ('' !== loop) params.loop = parseInt(loop, 10); + var autoplay = wrapperAttributes.getNamedItem('data-anim-autoplay') ? wrapperAttributes.getNamedItem('data-anim-autoplay').value : wrapperAttributes.getNamedItem('data-bm-autoplay') ? wrapperAttributes.getNamedItem('data-bm-autoplay').value : wrapperAttributes.getNamedItem('bm-autoplay') ? wrapperAttributes.getNamedItem('bm-autoplay').value : true; + params.autoplay = 'false' !== autoplay; + params.name = wrapperAttributes.getNamedItem('data-name') ? wrapperAttributes.getNamedItem('data-name').value : wrapperAttributes.getNamedItem('data-bm-name') ? wrapperAttributes.getNamedItem('data-bm-name').value : wrapperAttributes.getNamedItem('bm-name') ? wrapperAttributes.getNamedItem('bm-name').value : ''; + var prerender = wrapperAttributes.getNamedItem('data-anim-prerender') ? wrapperAttributes.getNamedItem('data-anim-prerender').value : wrapperAttributes.getNamedItem('data-bm-prerender') ? wrapperAttributes.getNamedItem('data-bm-prerender').value : wrapperAttributes.getNamedItem('bm-prerender') ? wrapperAttributes.getNamedItem('bm-prerender').value : ''; + if ('false' === prerender) params.prerender = false; + if (params.path) this.setParams(params); + else this.trigger('destroy'); + }; + AnimationItem.prototype.includeLayers = function(data) { + if (data.op > this.animationData.op) { + this.animationData.op = data.op; + this.totalFrames = Math.floor(data.op - this.animationData.ip); + } + var layers = this.animationData.layers; + var i; + var len = layers.length; + var newLayers = data.layers; + var j; + var jLen = newLayers.length; + for(j = 0; j < jLen; j += 1){ + i = 0; + while(i < len){ + if (layers[i].id === newLayers[j].id) { + layers[i] = newLayers[j]; + break; + } + i += 1; + } + } + if (data.chars || data.fonts) { + this.renderer.globalData.fontManager.addChars(data.chars); + this.renderer.globalData.fontManager.addFonts(data.fonts, this.renderer.globalData.defs); + } + if (data.assets) { + len = data.assets.length; + for(i = 0; i < len; i += 1)this.animationData.assets.push(data.assets[i]); + } + this.animationData.__complete = false; + dataManager.completeAnimation(this.animationData, this.onSegmentComplete); + }; + AnimationItem.prototype.onSegmentComplete = function(data) { + this.animationData = data; + var expressionsPlugin = getExpressionsPlugin(); + if (expressionsPlugin) expressionsPlugin.initExpressions(this); + this.loadNextSegment(); + }; + AnimationItem.prototype.loadNextSegment = function() { + var segments = this.animationData.segments; + if (!segments || 0 === segments.length || !this.autoloadSegments) { + this.trigger('data_ready'); + this.timeCompleted = this.totalFrames; + return; + } + var segment = segments.shift(); + this.timeCompleted = segment.time * this.frameRate; + var segmentPath = this.path + this.fileName + '_' + this.segmentPos + '.json'; + this.segmentPos += 1; + dataManager.loadData(segmentPath, this.includeLayers.bind(this), (function() { + this.trigger('data_failed'); + }).bind(this)); + }; + AnimationItem.prototype.loadSegments = function() { + var segments = this.animationData.segments; + if (!segments) this.timeCompleted = this.totalFrames; + this.loadNextSegment(); + }; + AnimationItem.prototype.imagesLoaded = function() { + this.trigger('loaded_images'); + this.checkLoaded(); + }; + AnimationItem.prototype.preloadImages = function() { + this.imagePreloader.setAssetsPath(this.assetsPath); + this.imagePreloader.setPath(this.path); + this.imagePreloader.loadAssets(this.animationData.assets, this.imagesLoaded.bind(this)); + }; + AnimationItem.prototype.configAnimation = function(animData) { + if (!this.renderer) return; + try { + this.animationData = animData; + if (this.initialSegment) { + this.totalFrames = Math.floor(this.initialSegment[1] - this.initialSegment[0]); + this.firstFrame = Math.round(this.initialSegment[0]); + } else { + this.totalFrames = Math.floor(this.animationData.op - this.animationData.ip); + this.firstFrame = Math.round(this.animationData.ip); + } + this.renderer.configAnimation(animData); + if (!animData.assets) animData.assets = []; + this.assets = this.animationData.assets; + this.frameRate = this.animationData.fr; + this.frameMult = this.animationData.fr / 1000; + this.renderer.searchExtraCompositions(animData.assets); + this.markers = markerParser(animData.markers || []); + this.trigger('config_ready'); + this.preloadImages(); + this.loadSegments(); + this.updaFrameModifier(); + this.waitForFontsLoaded(); + if (this.isPaused) this.audioController.pause(); + } catch (error) { + this.triggerConfigError(error); + } + }; + AnimationItem.prototype.waitForFontsLoaded = function() { + if (!this.renderer) return; + if (this.renderer.globalData.fontManager.isLoaded) this.checkLoaded(); + else setTimeout(this.waitForFontsLoaded.bind(this), 20); + }; + AnimationItem.prototype.checkLoaded = function() { + if (!this.isLoaded && this.renderer.globalData.fontManager.isLoaded && (this.imagePreloader.loadedImages() || 'canvas' !== this.renderer.rendererType) && this.imagePreloader.loadedFootages()) { + this.isLoaded = true; + var expressionsPlugin = getExpressionsPlugin(); + if (expressionsPlugin) expressionsPlugin.initExpressions(this); + this.renderer.initItems(); + setTimeout((function() { + this.trigger('DOMLoaded'); + }).bind(this), 0); + this.gotoFrame(); + if (this.autoplay) this.play(); + } + }; + AnimationItem.prototype.resize = function(width, height) { + var _width = 'number' == typeof width ? width : void 0; + var _height = 'number' == typeof height ? height : void 0; + this.renderer.updateContainerSize(_width, _height); + }; + AnimationItem.prototype.setSubframe = function(flag) { + this.isSubframeEnabled = !!flag; + }; + AnimationItem.prototype.gotoFrame = function() { + this.currentFrame = this.isSubframeEnabled ? this.currentRawFrame : ~~this.currentRawFrame; + if (this.timeCompleted !== this.totalFrames && this.currentFrame > this.timeCompleted) this.currentFrame = this.timeCompleted; + this.trigger('enterFrame'); + this.renderFrame(); + this.trigger('drawnFrame'); + }; + AnimationItem.prototype.renderFrame = function() { + if (false === this.isLoaded || !this.renderer) return; + try { + if (this.expressionsPlugin) this.expressionsPlugin.resetFrame(); + this.renderer.renderFrame(this.currentFrame + this.firstFrame); + } catch (error) { + this.triggerRenderFrameError(error); + } + }; + AnimationItem.prototype.play = function(name) { + if (name && this.name !== name) return; + if (true === this.isPaused) { + this.isPaused = false; + this.trigger('_play'); + this.audioController.resume(); + if (this._idle) { + this._idle = false; + this.trigger('_active'); + } + } + }; + AnimationItem.prototype.pause = function(name) { + if (name && this.name !== name) return; + if (false === this.isPaused) { + this.isPaused = true; + this.trigger('_pause'); + this._idle = true; + this.trigger('_idle'); + this.audioController.pause(); + } + }; + AnimationItem.prototype.togglePause = function(name) { + if (name && this.name !== name) return; + if (true === this.isPaused) this.play(); + else this.pause(); + }; + AnimationItem.prototype.stop = function(name) { + if (name && this.name !== name) return; + this.pause(); + this.playCount = 0; + this._completedLoop = false; + this.setCurrentRawFrameValue(0); + }; + AnimationItem.prototype.getMarkerData = function(markerName) { + var marker; + for(var i = 0; i < this.markers.length; i += 1){ + marker = this.markers[i]; + if (marker.payload && marker.payload.name === markerName) return marker; + } + return null; + }; + AnimationItem.prototype.goToAndStop = function(value, isFrame, name) { + if (name && this.name !== name) return; + var numValue = Number(value); + if (isNaN(numValue)) { + var marker = this.getMarkerData(value); + if (marker) this.goToAndStop(marker.time, true); + } else if (isFrame) this.setCurrentRawFrameValue(value); + else this.setCurrentRawFrameValue(value * this.frameModifier); + this.pause(); + }; + AnimationItem.prototype.goToAndPlay = function(value, isFrame, name) { + if (name && this.name !== name) return; + var numValue = Number(value); + if (isNaN(numValue)) { + var marker = this.getMarkerData(value); + if (marker) if (marker.duration) this.playSegments([ + marker.time, + marker.time + marker.duration + ], true); + else this.goToAndStop(marker.time, true); + } else this.goToAndStop(numValue, isFrame, name); + this.play(); + }; + AnimationItem.prototype.advanceTime = function(value) { + if (true === this.isPaused || false === this.isLoaded) return; + var nextValue = this.currentRawFrame + value * this.frameModifier; + var _isComplete = false; + if (nextValue >= this.totalFrames - 1 && this.frameModifier > 0) { + if (this.loop && this.playCount !== this.loop) if (nextValue >= this.totalFrames) { + this.playCount += 1; + if (!this.checkSegments(nextValue % this.totalFrames)) { + this.setCurrentRawFrameValue(nextValue % this.totalFrames); + this._completedLoop = true; + this.trigger('loopComplete'); + } + } else this.setCurrentRawFrameValue(nextValue); + else if (!this.checkSegments(nextValue > this.totalFrames ? nextValue % this.totalFrames : 0)) { + _isComplete = true; + nextValue = this.totalFrames - 1; + } + } else if (nextValue < 0) { + if (!this.checkSegments(nextValue % this.totalFrames)) if (this.loop && !(this.playCount-- <= 0 && true !== this.loop)) { + this.setCurrentRawFrameValue(this.totalFrames + nextValue % this.totalFrames); + if (this._completedLoop) this.trigger('loopComplete'); + else this._completedLoop = true; + } else { + _isComplete = true; + nextValue = 0; + } + } else this.setCurrentRawFrameValue(nextValue); + if (_isComplete) { + this.setCurrentRawFrameValue(nextValue); + this.pause(); + this.trigger('complete'); + } + }; + AnimationItem.prototype.adjustSegment = function(arr, offset) { + this.playCount = 0; + if (arr[1] < arr[0]) { + if (this.frameModifier > 0) if (this.playSpeed < 0) this.setSpeed(-this.playSpeed); + else this.setDirection(-1); + this.totalFrames = arr[0] - arr[1]; + this.timeCompleted = this.totalFrames; + this.firstFrame = arr[1]; + this.setCurrentRawFrameValue(this.totalFrames - 0.001 - offset); + } else if (arr[1] > arr[0]) { + if (this.frameModifier < 0) if (this.playSpeed < 0) this.setSpeed(-this.playSpeed); + else this.setDirection(1); + this.totalFrames = arr[1] - arr[0]; + this.timeCompleted = this.totalFrames; + this.firstFrame = arr[0]; + this.setCurrentRawFrameValue(0.001 + offset); + } + this.trigger('segmentStart'); + }; + AnimationItem.prototype.setSegment = function(init, end) { + var pendingFrame = -1; + if (this.isPaused) { + if (this.currentRawFrame + this.firstFrame < init) pendingFrame = init; + else if (this.currentRawFrame + this.firstFrame > end) pendingFrame = end - init; + } + this.firstFrame = init; + this.totalFrames = end - init; + this.timeCompleted = this.totalFrames; + if (-1 !== pendingFrame) this.goToAndStop(pendingFrame, true); + }; + AnimationItem.prototype.playSegments = function(arr, forceFlag) { + if (forceFlag) this.segments.length = 0; + if ('object' === _typeof$4(arr[0])) { + var i; + var len = arr.length; + for(i = 0; i < len; i += 1)this.segments.push(arr[i]); + } else this.segments.push(arr); + if (this.segments.length && forceFlag) this.adjustSegment(this.segments.shift(), 0); + if (this.isPaused) this.play(); + }; + AnimationItem.prototype.resetSegments = function(forceFlag) { + this.segments.length = 0; + this.segments.push([ + this.animationData.ip, + this.animationData.op + ]); + if (forceFlag) this.checkSegments(0); + }; + AnimationItem.prototype.checkSegments = function(offset) { + if (this.segments.length) { + this.adjustSegment(this.segments.shift(), offset); + return true; + } + return false; + }; + AnimationItem.prototype.destroy = function(name) { + if (name && this.name !== name || !this.renderer) return; + this.renderer.destroy(); + this.imagePreloader.destroy(); + this.trigger('destroy'); + this._cbs = null; + this.onEnterFrame = null; + this.onLoopComplete = null; + this.onComplete = null; + this.onSegmentStart = null; + this.onDestroy = null; + this.renderer = null; + this.expressionsPlugin = null; + this.imagePreloader = null; + this.projectInterface = null; + }; + AnimationItem.prototype.setCurrentRawFrameValue = function(value) { + this.currentRawFrame = value; + this.gotoFrame(); + }; + AnimationItem.prototype.setSpeed = function(val) { + this.playSpeed = val; + this.updaFrameModifier(); + }; + AnimationItem.prototype.setDirection = function(val) { + this.playDirection = val < 0 ? -1 : 1; + this.updaFrameModifier(); + }; + AnimationItem.prototype.setLoop = function(isLooping) { + this.loop = isLooping; + }; + AnimationItem.prototype.setVolume = function(val, name) { + if (name && this.name !== name) return; + this.audioController.setVolume(val); + }; + AnimationItem.prototype.getVolume = function() { + return this.audioController.getVolume(); + }; + AnimationItem.prototype.mute = function(name) { + if (name && this.name !== name) return; + this.audioController.mute(); + }; + AnimationItem.prototype.unmute = function(name) { + if (name && this.name !== name) return; + this.audioController.unmute(); + }; + AnimationItem.prototype.updaFrameModifier = function() { + this.frameModifier = this.frameMult * this.playSpeed * this.playDirection; + this.audioController.setRate(this.playSpeed * this.playDirection); + }; + AnimationItem.prototype.getPath = function() { + return this.path; + }; + AnimationItem.prototype.getAssetsPath = function(assetData) { + var path = ''; + if (assetData.e) path = assetData.p; + else if (this.assetsPath) { + var imagePath = assetData.p; + if (-1 !== imagePath.indexOf('images/')) imagePath = imagePath.split('/')[1]; + path = this.assetsPath + imagePath; + } else { + path = this.path; + path += assetData.u ? assetData.u : ''; + path += assetData.p; + } + return path; + }; + AnimationItem.prototype.getAssetData = function(id) { + var i = 0; + var len = this.assets.length; + while(i < len){ + if (id === this.assets[i].id) return this.assets[i]; + i += 1; + } + return null; + }; + AnimationItem.prototype.hide = function() { + this.renderer.hide(); + }; + AnimationItem.prototype.show = function() { + this.renderer.show(); + }; + AnimationItem.prototype.getDuration = function(isFrame) { + return isFrame ? this.totalFrames : this.totalFrames / this.frameRate; + }; + AnimationItem.prototype.updateDocumentData = function(path, documentData, index) { + try { + var element = this.renderer.getElementByPath(path); + element.updateDocumentData(documentData, index); + } catch (error) {} + }; + AnimationItem.prototype.trigger = function(name) { + if (this._cbs && this._cbs[name]) switch(name){ + case 'enterFrame': + this.triggerEvent(name, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameModifier)); + break; + case 'drawnFrame': + this.drawnFrameEvent.currentTime = this.currentFrame; + this.drawnFrameEvent.totalTime = this.totalFrames; + this.drawnFrameEvent.direction = this.frameModifier; + this.triggerEvent(name, this.drawnFrameEvent); + break; + case 'loopComplete': + this.triggerEvent(name, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult)); + break; + case 'complete': + this.triggerEvent(name, new BMCompleteEvent(name, this.frameMult)); + break; + case 'segmentStart': + this.triggerEvent(name, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames)); + break; + case 'destroy': + this.triggerEvent(name, new BMDestroyEvent(name, this)); + break; + default: + this.triggerEvent(name); + } + if ('enterFrame' === name && this.onEnterFrame) this.onEnterFrame.call(this, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameMult)); + if ('loopComplete' === name && this.onLoopComplete) this.onLoopComplete.call(this, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult)); + if ('complete' === name && this.onComplete) this.onComplete.call(this, new BMCompleteEvent(name, this.frameMult)); + if ('segmentStart' === name && this.onSegmentStart) this.onSegmentStart.call(this, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames)); + if ('destroy' === name && this.onDestroy) this.onDestroy.call(this, new BMDestroyEvent(name, this)); + }; + AnimationItem.prototype.triggerRenderFrameError = function(nativeError) { + var error = new BMRenderFrameErrorEvent(nativeError, this.currentFrame); + this.triggerEvent('error', error); + if (this.onError) this.onError.call(this, error); + }; + AnimationItem.prototype.triggerConfigError = function(nativeError) { + var error = new BMConfigErrorEvent(nativeError, this.currentFrame); + this.triggerEvent('error', error); + if (this.onError) this.onError.call(this, error); + }; + var animationManager = function() { + var moduleOb = {}; + var registeredAnimations = []; + var initTime = 0; + var len = 0; + var playingAnimationsNum = 0; + var _stopped = true; + var _isFrozen = false; + function removeElement(ev) { + var i = 0; + var animItem = ev.target; + while(i < len){ + if (registeredAnimations[i].animation === animItem) { + registeredAnimations.splice(i, 1); + i -= 1; + len -= 1; + if (!animItem.isPaused) subtractPlayingCount(); + } + i += 1; + } + } + function registerAnimation(element, animationData) { + if (!element) return null; + var i = 0; + while(i < len){ + if (registeredAnimations[i].elem === element && null !== registeredAnimations[i].elem) return registeredAnimations[i].animation; + i += 1; + } + var animItem = new AnimationItem(); + setupAnimation(animItem, element); + animItem.setData(element, animationData); + return animItem; + } + function getRegisteredAnimations() { + var i; + var lenAnims = registeredAnimations.length; + var animations = []; + for(i = 0; i < lenAnims; i += 1)animations.push(registeredAnimations[i].animation); + return animations; + } + function addPlayingCount() { + playingAnimationsNum += 1; + activate(); + } + function subtractPlayingCount() { + playingAnimationsNum -= 1; + } + function setupAnimation(animItem, element) { + animItem.addEventListener('destroy', removeElement); + animItem.addEventListener('_active', addPlayingCount); + animItem.addEventListener('_idle', subtractPlayingCount); + registeredAnimations.push({ + elem: element, + animation: animItem + }); + len += 1; + } + function loadAnimation(params) { + var animItem = new AnimationItem(); + setupAnimation(animItem, null); + animItem.setParams(params); + return animItem; + } + function setSpeed(val, animation) { + var i; + for(i = 0; i < len; i += 1)registeredAnimations[i].animation.setSpeed(val, animation); + } + function setDirection(val, animation) { + var i; + for(i = 0; i < len; i += 1)registeredAnimations[i].animation.setDirection(val, animation); + } + function play(animation) { + var i; + for(i = 0; i < len; i += 1)registeredAnimations[i].animation.play(animation); + } + function resume(nowTime) { + var elapsedTime = nowTime - initTime; + var i; + for(i = 0; i < len; i += 1)registeredAnimations[i].animation.advanceTime(elapsedTime); + initTime = nowTime; + if (playingAnimationsNum && !_isFrozen) window.requestAnimationFrame(resume); + else _stopped = true; + } + function first(nowTime) { + initTime = nowTime; + window.requestAnimationFrame(resume); + } + function pause(animation) { + var i; + for(i = 0; i < len; i += 1)registeredAnimations[i].animation.pause(animation); + } + function goToAndStop(value, isFrame, animation) { + var i; + for(i = 0; i < len; i += 1)registeredAnimations[i].animation.goToAndStop(value, isFrame, animation); + } + function stop(animation) { + var i; + for(i = 0; i < len; i += 1)registeredAnimations[i].animation.stop(animation); + } + function togglePause(animation) { + var i; + for(i = 0; i < len; i += 1)registeredAnimations[i].animation.togglePause(animation); + } + function destroy(animation) { + var i; + for(i = len - 1; i >= 0; i -= 1)registeredAnimations[i].animation.destroy(animation); + } + function searchAnimations(animationData, standalone, renderer) { + var animElements = [].concat([].slice.call(document.getElementsByClassName('lottie')), [].slice.call(document.getElementsByClassName('bodymovin'))); + var i; + var lenAnims = animElements.length; + for(i = 0; i < lenAnims; i += 1){ + if (renderer) animElements[i].setAttribute('data-bm-type', renderer); + registerAnimation(animElements[i], animationData); + } + if (standalone && 0 === lenAnims) { + if (!renderer) renderer = 'svg'; + var body = document.getElementsByTagName('body')[0]; + body.innerText = ''; + var div = createTag('div'); + div.style.width = '100%'; + div.style.height = '100%'; + div.setAttribute('data-bm-type', renderer); + body.appendChild(div); + registerAnimation(div, animationData); + } + } + function resize() { + var i; + for(i = 0; i < len; i += 1)registeredAnimations[i].animation.resize(); + } + function activate() { + if (!_isFrozen && playingAnimationsNum) { + if (_stopped) { + window.requestAnimationFrame(first); + _stopped = false; + } + } + } + function freeze() { + _isFrozen = true; + } + function unfreeze() { + _isFrozen = false; + activate(); + } + function setVolume(val, animation) { + var i; + for(i = 0; i < len; i += 1)registeredAnimations[i].animation.setVolume(val, animation); + } + function mute(animation) { + var i; + for(i = 0; i < len; i += 1)registeredAnimations[i].animation.mute(animation); + } + function unmute(animation) { + var i; + for(i = 0; i < len; i += 1)registeredAnimations[i].animation.unmute(animation); + } + moduleOb.registerAnimation = registerAnimation; + moduleOb.loadAnimation = loadAnimation; + moduleOb.setSpeed = setSpeed; + moduleOb.setDirection = setDirection; + moduleOb.play = play; + moduleOb.pause = pause; + moduleOb.stop = stop; + moduleOb.togglePause = togglePause; + moduleOb.searchAnimations = searchAnimations; + moduleOb.resize = resize; + moduleOb.goToAndStop = goToAndStop; + moduleOb.destroy = destroy; + moduleOb.freeze = freeze; + moduleOb.unfreeze = unfreeze; + moduleOb.setVolume = setVolume; + moduleOb.mute = mute; + moduleOb.unmute = unmute; + moduleOb.getRegisteredAnimations = getRegisteredAnimations; + return moduleOb; + }(); + var BezierFactory = function() { + var ob = {}; + ob.getBezierEasing = getBezierEasing; + var beziers = {}; + function getBezierEasing(a, b, c, d, nm) { + var str = nm || ('bez_' + a + '_' + b + '_' + c + '_' + d).replace(/\./g, 'p'); + if (beziers[str]) return beziers[str]; + var bezEasing = new BezierEasing([ + a, + b, + c, + d + ]); + beziers[str] = bezEasing; + return bezEasing; + } + var NEWTON_ITERATIONS = 4; + var NEWTON_MIN_SLOPE = 0.001; + var SUBDIVISION_PRECISION = 0.0000001; + var SUBDIVISION_MAX_ITERATIONS = 10; + var kSplineTableSize = 11; + var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0); + var float32ArraySupported = 'function' == typeof Float32Array; + function A(aA1, aA2) { + return 1.0 - 3.0 * aA2 + 3.0 * aA1; + } + function B(aA1, aA2) { + return 3.0 * aA2 - 6.0 * aA1; + } + function C(aA1) { + return 3.0 * aA1; + } + function calcBezier(aT, aA1, aA2) { + return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT; + } + function getSlope(aT, aA1, aA2) { + return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1); + } + function binarySubdivide(aX, aA, aB, mX1, mX2) { + var currentX, currentT, i = 0; + do { + currentT = aA + (aB - aA) / 2.0; + currentX = calcBezier(currentT, mX1, mX2) - aX; + if (currentX > 0.0) aB = currentT; + else aA = currentT; + }while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS); + return currentT; + } + function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) { + for(var i = 0; i < NEWTON_ITERATIONS; ++i){ + var currentSlope = getSlope(aGuessT, mX1, mX2); + if (0.0 === currentSlope) break; + var currentX = calcBezier(aGuessT, mX1, mX2) - aX; + aGuessT -= currentX / currentSlope; + } + return aGuessT; + } + function BezierEasing(points) { + this._p = points; + this._mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize); + this._precomputed = false; + this.get = this.get.bind(this); + } + BezierEasing.prototype = { + get: function(x) { + var mX1 = this._p[0], mY1 = this._p[1], mX2 = this._p[2], mY2 = this._p[3]; + if (!this._precomputed) this._precompute(); + if (mX1 === mY1 && mX2 === mY2) return x; + if (0 === x) return 0; + if (1 === x) return 1; + return calcBezier(this._getTForX(x), mY1, mY2); + }, + _precompute: function() { + var mX1 = this._p[0], mY1 = this._p[1], mX2 = this._p[2], mY2 = this._p[3]; + this._precomputed = true; + if (mX1 !== mY1 || mX2 !== mY2) this._calcSampleValues(); + }, + _calcSampleValues: function() { + var mX1 = this._p[0], mX2 = this._p[2]; + for(var i = 0; i < kSplineTableSize; ++i)this._mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2); + }, + _getTForX: function(aX) { + var mX1 = this._p[0], mX2 = this._p[2], mSampleValues = this._mSampleValues; + var intervalStart = 0.0; + var currentSample = 1; + var lastSample = kSplineTableSize - 1; + for(; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample)intervalStart += kSampleStepSize; + --currentSample; + var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]); + var guessForT = intervalStart + dist * kSampleStepSize; + var initialSlope = getSlope(guessForT, mX1, mX2); + if (initialSlope >= NEWTON_MIN_SLOPE) return newtonRaphsonIterate(aX, guessForT, mX1, mX2); + if (0.0 === initialSlope) return guessForT; + return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2); + } + }; + return ob; + }(); + var pooling = function() { + function _double(arr) { + return arr.concat(createSizedArray(arr.length)); + } + return { + double: _double + }; + }(); + var poolFactory = function() { + return function(initialLength, _create, _release) { + var _length = 0; + var _maxLength = initialLength; + var pool = createSizedArray(_maxLength); + var ob = { + newElement: newElement, + release: release + }; + function newElement() { + var element; + if (_length) { + _length -= 1; + element = pool[_length]; + } else element = _create(); + return element; + } + function release(element) { + if (_length === _maxLength) { + pool = pooling["double"](pool); + _maxLength *= 2; + } + if (_release) _release(element); + pool[_length] = element; + _length += 1; + } + return ob; + }; + }(); + var bezierLengthPool = function() { + function create() { + return { + addedLength: 0, + percents: createTypedArray('float32', getDefaultCurveSegments()), + lengths: createTypedArray('float32', getDefaultCurveSegments()) + }; + } + return poolFactory(8, create); + }(); + var segmentsLengthPool = function() { + function create() { + return { + lengths: [], + totalLength: 0 + }; + } + function release(element) { + var i; + var len = element.lengths.length; + for(i = 0; i < len; i += 1)bezierLengthPool.release(element.lengths[i]); + element.lengths.length = 0; + } + return poolFactory(8, create, release); + }(); + function bezFunction() { + var math = Math; + function pointOnLine2D(x1, y1, x2, y2, x3, y3) { + var det1 = x1 * y2 + y1 * x3 + x2 * y3 - x3 * y2 - y3 * x1 - x2 * y1; + return det1 > -0.001 && det1 < 0.001; + } + function pointOnLine3D(x1, y1, z1, x2, y2, z2, x3, y3, z3) { + if (0 === z1 && 0 === z2 && 0 === z3) return pointOnLine2D(x1, y1, x2, y2, x3, y3); + var dist1 = math.sqrt(math.pow(x2 - x1, 2) + math.pow(y2 - y1, 2) + math.pow(z2 - z1, 2)); + var dist2 = math.sqrt(math.pow(x3 - x1, 2) + math.pow(y3 - y1, 2) + math.pow(z3 - z1, 2)); + var dist3 = math.sqrt(math.pow(x3 - x2, 2) + math.pow(y3 - y2, 2) + math.pow(z3 - z2, 2)); + var diffDist; + diffDist = dist1 > dist2 ? dist1 > dist3 ? dist1 - dist2 - dist3 : dist3 - dist2 - dist1 : dist3 > dist2 ? dist3 - dist2 - dist1 : dist2 - dist1 - dist3; + return diffDist > -0.0001 && diffDist < 0.0001; + } + var getBezierLength = function() { + return function(pt1, pt2, pt3, pt4) { + var curveSegments = getDefaultCurveSegments(); + var k; + var i; + var len; + var ptCoord; + var perc; + var addedLength = 0; + var ptDistance; + var point = []; + var lastPoint = []; + var lengthData = bezierLengthPool.newElement(); + len = pt3.length; + for(k = 0; k < curveSegments; k += 1){ + perc = k / (curveSegments - 1); + ptDistance = 0; + for(i = 0; i < len; i += 1){ + ptCoord = bmPow(1 - perc, 3) * pt1[i] + 3 * bmPow(1 - perc, 2) * perc * pt3[i] + 3 * (1 - perc) * bmPow(perc, 2) * pt4[i] + bmPow(perc, 3) * pt2[i]; + point[i] = ptCoord; + if (null !== lastPoint[i]) ptDistance += bmPow(point[i] - lastPoint[i], 2); + lastPoint[i] = point[i]; + } + if (ptDistance) { + ptDistance = bmSqrt(ptDistance); + addedLength += ptDistance; + } + lengthData.percents[k] = perc; + lengthData.lengths[k] = addedLength; + } + lengthData.addedLength = addedLength; + return lengthData; + }; + }(); + function getSegmentsLength(shapeData) { + var segmentsLength = segmentsLengthPool.newElement(); + var closed = shapeData.c; + var pathV = shapeData.v; + var pathO = shapeData.o; + var pathI = shapeData.i; + var i; + var len = shapeData._length; + var lengths = segmentsLength.lengths; + var totalLength = 0; + for(i = 0; i < len - 1; i += 1){ + lengths[i] = getBezierLength(pathV[i], pathV[i + 1], pathO[i], pathI[i + 1]); + totalLength += lengths[i].addedLength; + } + if (closed && len) { + lengths[i] = getBezierLength(pathV[i], pathV[0], pathO[i], pathI[0]); + totalLength += lengths[i].addedLength; + } + segmentsLength.totalLength = totalLength; + return segmentsLength; + } + function BezierData(length) { + this.segmentLength = 0; + this.points = new Array(length); + } + function PointData(partial, point) { + this.partialLength = partial; + this.point = point; + } + var buildBezierData = function() { + var storedData = {}; + return function(pt1, pt2, pt3, pt4) { + var bezierName = (pt1[0] + '_' + pt1[1] + '_' + pt2[0] + '_' + pt2[1] + '_' + pt3[0] + '_' + pt3[1] + '_' + pt4[0] + '_' + pt4[1]).replace(/\./g, 'p'); + if (!storedData[bezierName]) { + var curveSegments = getDefaultCurveSegments(); + var k; + var i; + var len; + var ptCoord; + var perc; + var addedLength = 0; + var ptDistance; + var point; + var lastPoint = null; + if (2 === pt1.length && (pt1[0] !== pt2[0] || pt1[1] !== pt2[1]) && pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt1[0] + pt3[0], pt1[1] + pt3[1]) && pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt2[0] + pt4[0], pt2[1] + pt4[1])) curveSegments = 2; + var bezierData = new BezierData(curveSegments); + len = pt3.length; + for(k = 0; k < curveSegments; k += 1){ + point = createSizedArray(len); + perc = k / (curveSegments - 1); + ptDistance = 0; + for(i = 0; i < len; i += 1){ + ptCoord = bmPow(1 - perc, 3) * pt1[i] + 3 * bmPow(1 - perc, 2) * perc * (pt1[i] + pt3[i]) + 3 * (1 - perc) * bmPow(perc, 2) * (pt2[i] + pt4[i]) + bmPow(perc, 3) * pt2[i]; + point[i] = ptCoord; + if (null !== lastPoint) ptDistance += bmPow(point[i] - lastPoint[i], 2); + } + ptDistance = bmSqrt(ptDistance); + addedLength += ptDistance; + bezierData.points[k] = new PointData(ptDistance, point); + lastPoint = point; + } + bezierData.segmentLength = addedLength; + storedData[bezierName] = bezierData; + } + return storedData[bezierName]; + }; + }(); + function getDistancePerc(perc, bezierData) { + var percents = bezierData.percents; + var lengths = bezierData.lengths; + var len = percents.length; + var initPos = bmFloor((len - 1) * perc); + var lengthPos = perc * bezierData.addedLength; + var lPerc = 0; + if (initPos === len - 1 || 0 === initPos || lengthPos === lengths[initPos]) return percents[initPos]; + var dir = lengths[initPos] > lengthPos ? -1 : 1; + var flag = true; + while(flag){ + if (lengths[initPos] <= lengthPos && lengths[initPos + 1] > lengthPos) { + lPerc = (lengthPos - lengths[initPos]) / (lengths[initPos + 1] - lengths[initPos]); + flag = false; + } else initPos += dir; + if (initPos < 0 || initPos >= len - 1) { + if (initPos === len - 1) return percents[initPos]; + flag = false; + } + } + return percents[initPos] + (percents[initPos + 1] - percents[initPos]) * lPerc; + } + function getPointInSegment(pt1, pt2, pt3, pt4, percent, bezierData) { + var t1 = getDistancePerc(percent, bezierData); + var u1 = 1 - t1; + var ptX = math.round((u1 * u1 * u1 * pt1[0] + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[0] + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[0] + t1 * t1 * t1 * pt2[0]) * 1000) / 1000; + var ptY = math.round((u1 * u1 * u1 * pt1[1] + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[1] + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[1] + t1 * t1 * t1 * pt2[1]) * 1000) / 1000; + return [ + ptX, + ptY + ]; + } + var bezierSegmentPoints = createTypedArray('float32', 8); + function getNewSegment(pt1, pt2, pt3, pt4, startPerc, endPerc, bezierData) { + if (startPerc < 0) startPerc = 0; + else if (startPerc > 1) startPerc = 1; + var t0 = getDistancePerc(startPerc, bezierData); + endPerc = endPerc > 1 ? 1 : endPerc; + var t1 = getDistancePerc(endPerc, bezierData); + var i; + var len = pt1.length; + var u0 = 1 - t0; + var u1 = 1 - t1; + var u0u0u0 = u0 * u0 * u0; + var t0u0u0_3 = t0 * u0 * u0 * 3; + var t0t0u0_3 = t0 * t0 * u0 * 3; + var t0t0t0 = t0 * t0 * t0; + var u0u0u1 = u0 * u0 * u1; + var t0u0u1_3 = t0 * u0 * u1 + u0 * t0 * u1 + u0 * u0 * t1; + var t0t0u1_3 = t0 * t0 * u1 + u0 * t0 * t1 + t0 * u0 * t1; + var t0t0t1 = t0 * t0 * t1; + var u0u1u1 = u0 * u1 * u1; + var t0u1u1_3 = t0 * u1 * u1 + u0 * t1 * u1 + u0 * u1 * t1; + var t0t1u1_3 = t0 * t1 * u1 + u0 * t1 * t1 + t0 * u1 * t1; + var t0t1t1 = t0 * t1 * t1; + var u1u1u1 = u1 * u1 * u1; + var t1u1u1_3 = t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1; + var t1t1u1_3 = t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1; + var t1t1t1 = t1 * t1 * t1; + for(i = 0; i < len; i += 1){ + bezierSegmentPoints[4 * i] = math.round((u0u0u0 * pt1[i] + t0u0u0_3 * pt3[i] + t0t0u0_3 * pt4[i] + t0t0t0 * pt2[i]) * 1000) / 1000; + bezierSegmentPoints[4 * i + 1] = math.round((u0u0u1 * pt1[i] + t0u0u1_3 * pt3[i] + t0t0u1_3 * pt4[i] + t0t0t1 * pt2[i]) * 1000) / 1000; + bezierSegmentPoints[4 * i + 2] = math.round((u0u1u1 * pt1[i] + t0u1u1_3 * pt3[i] + t0t1u1_3 * pt4[i] + t0t1t1 * pt2[i]) * 1000) / 1000; + bezierSegmentPoints[4 * i + 3] = math.round((u1u1u1 * pt1[i] + t1u1u1_3 * pt3[i] + t1t1u1_3 * pt4[i] + t1t1t1 * pt2[i]) * 1000) / 1000; + } + return bezierSegmentPoints; + } + return { + getSegmentsLength: getSegmentsLength, + getNewSegment: getNewSegment, + getPointInSegment: getPointInSegment, + buildBezierData: buildBezierData, + pointOnLine2D: pointOnLine2D, + pointOnLine3D: pointOnLine3D + }; + } + var bez = bezFunction(); + var initFrame = initialDefaultFrame; + var mathAbs = Math.abs; + function interpolateValue(frameNum, caching) { + var offsetTime = this.offsetTime; + var newValue; + if ('multidimensional' === this.propType) newValue = createTypedArray('float32', this.pv.length); + var iterationIndex = caching.lastIndex; + var i = iterationIndex; + var len = this.keyframes.length - 1; + var flag = true; + var keyData; + var nextKeyData; + var keyframeMetadata; + while(flag){ + keyData = this.keyframes[i]; + nextKeyData = this.keyframes[i + 1]; + if (i === len - 1 && frameNum >= nextKeyData.t - offsetTime) { + if (keyData.h) keyData = nextKeyData; + iterationIndex = 0; + break; + } + if (nextKeyData.t - offsetTime > frameNum) { + iterationIndex = i; + break; + } + if (i < len - 1) i += 1; + else { + iterationIndex = 0; + flag = false; + } + } + keyframeMetadata = this.keyframesMetadata[i] || {}; + var k; + var kLen; + var perc; + var jLen; + var j; + var fnc; + var nextKeyTime = nextKeyData.t - offsetTime; + var keyTime = keyData.t - offsetTime; + var endValue; + if (keyData.to) { + if (!keyframeMetadata.bezierData) keyframeMetadata.bezierData = bez.buildBezierData(keyData.s, nextKeyData.s || keyData.e, keyData.to, keyData.ti); + var bezierData = keyframeMetadata.bezierData; + if (frameNum >= nextKeyTime || frameNum < keyTime) { + var ind = frameNum >= nextKeyTime ? bezierData.points.length - 1 : 0; + kLen = bezierData.points[ind].point.length; + for(k = 0; k < kLen; k += 1)newValue[k] = bezierData.points[ind].point[k]; + } else { + if (keyframeMetadata.__fnct) fnc = keyframeMetadata.__fnct; + else { + fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y, keyData.n).get; + keyframeMetadata.__fnct = fnc; + } + perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime)); + var distanceInLine = bezierData.segmentLength * perc; + var segmentPerc; + var addedLength = caching.lastFrame < frameNum && caching._lastKeyframeIndex === i ? caching._lastAddedLength : 0; + j = caching.lastFrame < frameNum && caching._lastKeyframeIndex === i ? caching._lastPoint : 0; + flag = true; + jLen = bezierData.points.length; + while(flag){ + addedLength += bezierData.points[j].partialLength; + if (0 === distanceInLine || 0 === perc || j === bezierData.points.length - 1) { + kLen = bezierData.points[j].point.length; + for(k = 0; k < kLen; k += 1)newValue[k] = bezierData.points[j].point[k]; + break; + } + if (distanceInLine >= addedLength && distanceInLine < addedLength + bezierData.points[j + 1].partialLength) { + segmentPerc = (distanceInLine - addedLength) / bezierData.points[j + 1].partialLength; + kLen = bezierData.points[j].point.length; + for(k = 0; k < kLen; k += 1)newValue[k] = bezierData.points[j].point[k] + (bezierData.points[j + 1].point[k] - bezierData.points[j].point[k]) * segmentPerc; + break; + } + if (j < jLen - 1) j += 1; + else flag = false; + } + caching._lastPoint = j; + caching._lastAddedLength = addedLength - bezierData.points[j].partialLength; + caching._lastKeyframeIndex = i; + } + } else { + var outX; + var outY; + var inX; + var inY; + var keyValue; + len = keyData.s.length; + endValue = nextKeyData.s || keyData.e; + if (this.sh && 1 !== keyData.h) if (frameNum >= nextKeyTime) { + newValue[0] = endValue[0]; + newValue[1] = endValue[1]; + newValue[2] = endValue[2]; + } else if (frameNum <= keyTime) { + newValue[0] = keyData.s[0]; + newValue[1] = keyData.s[1]; + newValue[2] = keyData.s[2]; + } else { + var quatStart = createQuaternion(keyData.s); + var quatEnd = createQuaternion(endValue); + var time = (frameNum - keyTime) / (nextKeyTime - keyTime); + quaternionToEuler(newValue, slerp(quatStart, quatEnd, time)); + } + else for(i = 0; i < len; i += 1){ + if (1 !== keyData.h) if (frameNum >= nextKeyTime) perc = 1; + else if (frameNum < keyTime) perc = 0; + else { + if (keyData.o.x.constructor === Array) { + if (!keyframeMetadata.__fnct) keyframeMetadata.__fnct = []; + if (keyframeMetadata.__fnct[i]) fnc = keyframeMetadata.__fnct[i]; + else { + outX = void 0 === keyData.o.x[i] ? keyData.o.x[0] : keyData.o.x[i]; + outY = void 0 === keyData.o.y[i] ? keyData.o.y[0] : keyData.o.y[i]; + inX = void 0 === keyData.i.x[i] ? keyData.i.x[0] : keyData.i.x[i]; + inY = void 0 === keyData.i.y[i] ? keyData.i.y[0] : keyData.i.y[i]; + fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get; + keyframeMetadata.__fnct[i] = fnc; + } + } else if (keyframeMetadata.__fnct) fnc = keyframeMetadata.__fnct; + else { + outX = keyData.o.x; + outY = keyData.o.y; + inX = keyData.i.x; + inY = keyData.i.y; + fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get; + keyData.keyframeMetadata = fnc; + } + perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime)); + } + endValue = nextKeyData.s || keyData.e; + keyValue = 1 === keyData.h ? keyData.s[i] : keyData.s[i] + (endValue[i] - keyData.s[i]) * perc; + if ('multidimensional' === this.propType) newValue[i] = keyValue; + else newValue = keyValue; + } + } + caching.lastIndex = iterationIndex; + return newValue; + } + function slerp(a, b, t) { + var out = []; + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var aw = a[3]; + var bx = b[0]; + var by = b[1]; + var bz = b[2]; + var bw = b[3]; + var omega; + var cosom; + var sinom; + var scale0; + var scale1; + cosom = ax * bx + ay * by + az * bz + aw * bw; + if (cosom < 0.0) { + cosom = -cosom; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } + if (1.0 - cosom > 0.000001) { + omega = Math.acos(cosom); + sinom = Math.sin(omega); + scale0 = Math.sin((1.0 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; + } else { + scale0 = 1.0 - t; + scale1 = t; + } + out[0] = scale0 * ax + scale1 * bx; + out[1] = scale0 * ay + scale1 * by; + out[2] = scale0 * az + scale1 * bz; + out[3] = scale0 * aw + scale1 * bw; + return out; + } + function quaternionToEuler(out, quat) { + var qx = quat[0]; + var qy = quat[1]; + var qz = quat[2]; + var qw = quat[3]; + var heading = Math.atan2(2 * qy * qw - 2 * qx * qz, 1 - 2 * qy * qy - 2 * qz * qz); + var attitude = Math.asin(2 * qx * qy + 2 * qz * qw); + var bank = Math.atan2(2 * qx * qw - 2 * qy * qz, 1 - 2 * qx * qx - 2 * qz * qz); + out[0] = heading / degToRads; + out[1] = attitude / degToRads; + out[2] = bank / degToRads; + } + function createQuaternion(values) { + var heading = values[0] * degToRads; + var attitude = values[1] * degToRads; + var bank = values[2] * degToRads; + var c1 = Math.cos(heading / 2); + var c2 = Math.cos(attitude / 2); + var c3 = Math.cos(bank / 2); + var s1 = Math.sin(heading / 2); + var s2 = Math.sin(attitude / 2); + var s3 = Math.sin(bank / 2); + var w = c1 * c2 * c3 - s1 * s2 * s3; + var x = s1 * s2 * c3 + c1 * c2 * s3; + var y = s1 * c2 * c3 + c1 * s2 * s3; + var z = c1 * s2 * c3 - s1 * c2 * s3; + return [ + x, + y, + z, + w + ]; + } + function getValueAtCurrentTime() { + var frameNum = this.comp.renderedFrame - this.offsetTime; + var initTime = this.keyframes[0].t - this.offsetTime; + var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime; + if (!(frameNum === this._caching.lastFrame || this._caching.lastFrame !== initFrame && (this._caching.lastFrame >= endTime && frameNum >= endTime || this._caching.lastFrame < initTime && frameNum < initTime))) { + if (this._caching.lastFrame >= frameNum) { + this._caching._lastKeyframeIndex = -1; + this._caching.lastIndex = 0; + } + var renderResult = this.interpolateValue(frameNum, this._caching); + this.pv = renderResult; + } + this._caching.lastFrame = frameNum; + return this.pv; + } + function setVValue(val) { + var multipliedValue; + if ('unidimensional' === this.propType) { + multipliedValue = val * this.mult; + if (mathAbs(this.v - multipliedValue) > 0.00001) { + this.v = multipliedValue; + this._mdf = true; + } + } else { + var i = 0; + var len = this.v.length; + while(i < len){ + multipliedValue = val[i] * this.mult; + if (mathAbs(this.v[i] - multipliedValue) > 0.00001) { + this.v[i] = multipliedValue; + this._mdf = true; + } + i += 1; + } + } + } + function processEffectsSequence() { + if (this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) return; + if (this.lock) return void this.setVValue(this.pv); + this.lock = true; + this._mdf = this._isFirstFrame; + var i; + var len = this.effectsSequence.length; + var finalValue = this.kf ? this.pv : this.data.k; + for(i = 0; i < len; i += 1)finalValue = this.effectsSequence[i](finalValue); + this.setVValue(finalValue); + this._isFirstFrame = false; + this.lock = false; + this.frameId = this.elem.globalData.frameId; + } + function addEffect(effectFunction) { + this.effectsSequence.push(effectFunction); + this.container.addDynamicProperty(this); + } + function ValueProperty(elem, data, mult, container) { + this.propType = 'unidimensional'; + this.mult = mult || 1; + this.data = data; + this.v = mult ? data.k * mult : data.k; + this.pv = data.k; + this._mdf = false; + this.elem = elem; + this.container = container; + this.comp = elem.comp; + this.k = false; + this.kf = false; + this.vel = 0; + this.effectsSequence = []; + this._isFirstFrame = true; + this.getValue = processEffectsSequence; + this.setVValue = setVValue; + this.addEffect = addEffect; + } + function MultiDimensionalProperty(elem, data, mult, container) { + this.propType = 'multidimensional'; + this.mult = mult || 1; + this.data = data; + this._mdf = false; + this.elem = elem; + this.container = container; + this.comp = elem.comp; + this.k = false; + this.kf = false; + this.frameId = -1; + var i; + var len = data.k.length; + this.v = createTypedArray('float32', len); + this.pv = createTypedArray('float32', len); + this.vel = createTypedArray('float32', len); + for(i = 0; i < len; i += 1){ + this.v[i] = data.k[i] * this.mult; + this.pv[i] = data.k[i]; + } + this._isFirstFrame = true; + this.effectsSequence = []; + this.getValue = processEffectsSequence; + this.setVValue = setVValue; + this.addEffect = addEffect; + } + function KeyframedValueProperty(elem, data, mult, container) { + this.propType = 'unidimensional'; + this.keyframes = data.k; + this.keyframesMetadata = []; + this.offsetTime = elem.data.st; + this.frameId = -1; + this._caching = { + lastFrame: initFrame, + lastIndex: 0, + value: 0, + _lastKeyframeIndex: -1 + }; + this.k = true; + this.kf = true; + this.data = data; + this.mult = mult || 1; + this.elem = elem; + this.container = container; + this.comp = elem.comp; + this.v = initFrame; + this.pv = initFrame; + this._isFirstFrame = true; + this.getValue = processEffectsSequence; + this.setVValue = setVValue; + this.interpolateValue = interpolateValue; + this.effectsSequence = [ + getValueAtCurrentTime.bind(this) + ]; + this.addEffect = addEffect; + } + function KeyframedMultidimensionalProperty(elem, data, mult, container) { + this.propType = 'multidimensional'; + var i; + var len = data.k.length; + var s; + var e; + var to; + var ti; + for(i = 0; i < len - 1; i += 1)if (data.k[i].to && data.k[i].s && data.k[i + 1] && data.k[i + 1].s) { + s = data.k[i].s; + e = data.k[i + 1].s; + to = data.k[i].to; + ti = data.k[i].ti; + if (2 === s.length && !(s[0] === e[0] && s[1] === e[1]) && bez.pointOnLine2D(s[0], s[1], e[0], e[1], s[0] + to[0], s[1] + to[1]) && bez.pointOnLine2D(s[0], s[1], e[0], e[1], e[0] + ti[0], e[1] + ti[1]) || 3 === s.length && !(s[0] === e[0] && s[1] === e[1] && s[2] === e[2]) && bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], s[0] + to[0], s[1] + to[1], s[2] + to[2]) && bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], e[0] + ti[0], e[1] + ti[1], e[2] + ti[2])) { + data.k[i].to = null; + data.k[i].ti = null; + } + if (s[0] === e[0] && s[1] === e[1] && 0 === to[0] && 0 === to[1] && 0 === ti[0] && 0 === ti[1]) { + if (2 === s.length || s[2] === e[2] && 0 === to[2] && 0 === ti[2]) { + data.k[i].to = null; + data.k[i].ti = null; + } + } + } + this.effectsSequence = [ + getValueAtCurrentTime.bind(this) + ]; + this.data = data; + this.keyframes = data.k; + this.keyframesMetadata = []; + this.offsetTime = elem.data.st; + this.k = true; + this.kf = true; + this._isFirstFrame = true; + this.mult = mult || 1; + this.elem = elem; + this.container = container; + this.comp = elem.comp; + this.getValue = processEffectsSequence; + this.setVValue = setVValue; + this.interpolateValue = interpolateValue; + this.frameId = -1; + var arrLen = data.k[0].s.length; + this.v = createTypedArray('float32', arrLen); + this.pv = createTypedArray('float32', arrLen); + for(i = 0; i < arrLen; i += 1){ + this.v[i] = initFrame; + this.pv[i] = initFrame; + } + this._caching = { + lastFrame: initFrame, + lastIndex: 0, + value: createTypedArray('float32', arrLen) + }; + this.addEffect = addEffect; + } + var PropertyFactory = function() { + function getProp(elem, data, type, mult, container) { + if (data.sid) data = elem.globalData.slotManager.getProp(data); + var p; + if (data.k.length) if ('number' == typeof data.k[0]) p = new MultiDimensionalProperty(elem, data, mult, container); + else switch(type){ + case 0: + p = new KeyframedValueProperty(elem, data, mult, container); + break; + case 1: + p = new KeyframedMultidimensionalProperty(elem, data, mult, container); + break; + default: + break; + } + else p = new ValueProperty(elem, data, mult, container); + if (p.effectsSequence.length) container.addDynamicProperty(p); + return p; + } + var ob = { + getProp: getProp + }; + return ob; + }(); + function DynamicPropertyContainer() {} + DynamicPropertyContainer.prototype = { + addDynamicProperty: function(prop) { + if (-1 === this.dynamicProperties.indexOf(prop)) { + this.dynamicProperties.push(prop); + this.container.addDynamicProperty(this); + this._isAnimated = true; + } + }, + iterateDynamicProperties: function() { + this._mdf = false; + var i; + var len = this.dynamicProperties.length; + for(i = 0; i < len; i += 1){ + this.dynamicProperties[i].getValue(); + if (this.dynamicProperties[i]._mdf) this._mdf = true; + } + }, + initDynamicPropertyContainer: function(container) { + this.container = container; + this.dynamicProperties = []; + this._mdf = false; + this._isAnimated = false; + } + }; + var pointPool = function() { + function create() { + return createTypedArray('float32', 2); + } + return poolFactory(8, create); + }(); + function ShapePath() { + this.c = false; + this._length = 0; + this._maxLength = 8; + this.v = createSizedArray(this._maxLength); + this.o = createSizedArray(this._maxLength); + this.i = createSizedArray(this._maxLength); + } + ShapePath.prototype.setPathData = function(closed, len) { + this.c = closed; + this.setLength(len); + var i = 0; + while(i < len){ + this.v[i] = pointPool.newElement(); + this.o[i] = pointPool.newElement(); + this.i[i] = pointPool.newElement(); + i += 1; + } + }; + ShapePath.prototype.setLength = function(len) { + while(this._maxLength < len)this.doubleArrayLength(); + this._length = len; + }; + ShapePath.prototype.doubleArrayLength = function() { + this.v = this.v.concat(createSizedArray(this._maxLength)); + this.i = this.i.concat(createSizedArray(this._maxLength)); + this.o = this.o.concat(createSizedArray(this._maxLength)); + this._maxLength *= 2; + }; + ShapePath.prototype.setXYAt = function(x, y, type, pos, replace) { + var arr; + this._length = Math.max(this._length, pos + 1); + if (this._length >= this._maxLength) this.doubleArrayLength(); + switch(type){ + case 'v': + arr = this.v; + break; + case 'i': + arr = this.i; + break; + case 'o': + arr = this.o; + break; + default: + arr = []; + break; + } + if (!arr[pos] || arr[pos] && !replace) arr[pos] = pointPool.newElement(); + arr[pos][0] = x; + arr[pos][1] = y; + }; + ShapePath.prototype.setTripleAt = function(vX, vY, oX, oY, iX, iY, pos, replace) { + this.setXYAt(vX, vY, 'v', pos, replace); + this.setXYAt(oX, oY, 'o', pos, replace); + this.setXYAt(iX, iY, 'i', pos, replace); + }; + ShapePath.prototype.reverse = function() { + var newPath = new ShapePath(); + newPath.setPathData(this.c, this._length); + var vertices = this.v; + var outPoints = this.o; + var inPoints = this.i; + var init = 0; + if (this.c) { + newPath.setTripleAt(vertices[0][0], vertices[0][1], inPoints[0][0], inPoints[0][1], outPoints[0][0], outPoints[0][1], 0, false); + init = 1; + } + var cnt = this._length - 1; + var len = this._length; + var i; + for(i = init; i < len; i += 1){ + newPath.setTripleAt(vertices[cnt][0], vertices[cnt][1], inPoints[cnt][0], inPoints[cnt][1], outPoints[cnt][0], outPoints[cnt][1], i, false); + cnt -= 1; + } + return newPath; + }; + ShapePath.prototype.length = function() { + return this._length; + }; + var shapePool = function() { + function create() { + return new ShapePath(); + } + function release(shapePath) { + var len = shapePath._length; + var i; + for(i = 0; i < len; i += 1){ + pointPool.release(shapePath.v[i]); + pointPool.release(shapePath.i[i]); + pointPool.release(shapePath.o[i]); + shapePath.v[i] = null; + shapePath.i[i] = null; + shapePath.o[i] = null; + } + shapePath._length = 0; + shapePath.c = false; + } + function clone(shape) { + var cloned = factory.newElement(); + var i; + var len = void 0 === shape._length ? shape.v.length : shape._length; + cloned.setLength(len); + cloned.c = shape.c; + for(i = 0; i < len; i += 1)cloned.setTripleAt(shape.v[i][0], shape.v[i][1], shape.o[i][0], shape.o[i][1], shape.i[i][0], shape.i[i][1], i); + return cloned; + } + var factory = poolFactory(4, create, release); + factory.clone = clone; + return factory; + }(); + function ShapeCollection() { + this._length = 0; + this._maxLength = 4; + this.shapes = createSizedArray(this._maxLength); + } + ShapeCollection.prototype.addShape = function(shapeData) { + if (this._length === this._maxLength) { + this.shapes = this.shapes.concat(createSizedArray(this._maxLength)); + this._maxLength *= 2; + } + this.shapes[this._length] = shapeData; + this._length += 1; + }; + ShapeCollection.prototype.releaseShapes = function() { + var i; + for(i = 0; i < this._length; i += 1)shapePool.release(this.shapes[i]); + this._length = 0; + }; + var shapeCollectionPool = function() { + var ob = { + newShapeCollection: newShapeCollection, + release: release + }; + var _length = 0; + var _maxLength = 4; + var pool = createSizedArray(_maxLength); + function newShapeCollection() { + var shapeCollection; + if (_length) { + _length -= 1; + shapeCollection = pool[_length]; + } else shapeCollection = new ShapeCollection(); + return shapeCollection; + } + function release(shapeCollection) { + var i; + var len = shapeCollection._length; + for(i = 0; i < len; i += 1)shapePool.release(shapeCollection.shapes[i]); + shapeCollection._length = 0; + if (_length === _maxLength) { + pool = pooling["double"](pool); + _maxLength *= 2; + } + pool[_length] = shapeCollection; + _length += 1; + } + return ob; + }(); + var ShapePropertyFactory = function() { + var initFrame = -999999; + function interpolateShape(frameNum, previousValue, caching) { + var iterationIndex = caching.lastIndex; + var keyPropS; + var keyPropE; + var isHold; + var j; + var k; + var jLen; + var kLen; + var perc; + var vertexValue; + var kf = this.keyframes; + if (frameNum < kf[0].t - this.offsetTime) { + keyPropS = kf[0].s[0]; + isHold = true; + iterationIndex = 0; + } else if (frameNum >= kf[kf.length - 1].t - this.offsetTime) { + keyPropS = kf[kf.length - 1].s ? kf[kf.length - 1].s[0] : kf[kf.length - 2].e[0]; + isHold = true; + } else { + var i = iterationIndex; + var len = kf.length - 1; + var flag = true; + var keyData; + var nextKeyData; + var keyframeMetadata; + while(flag){ + keyData = kf[i]; + nextKeyData = kf[i + 1]; + if (nextKeyData.t - this.offsetTime > frameNum) break; + if (i < len - 1) i += 1; + else flag = false; + } + keyframeMetadata = this.keyframesMetadata[i] || {}; + isHold = 1 === keyData.h; + iterationIndex = i; + if (!isHold) { + if (frameNum >= nextKeyData.t - this.offsetTime) perc = 1; + else if (frameNum < keyData.t - this.offsetTime) perc = 0; + else { + var fnc; + if (keyframeMetadata.__fnct) fnc = keyframeMetadata.__fnct; + else { + fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y).get; + keyframeMetadata.__fnct = fnc; + } + perc = fnc((frameNum - (keyData.t - this.offsetTime)) / (nextKeyData.t - this.offsetTime - (keyData.t - this.offsetTime))); + } + keyPropE = nextKeyData.s ? nextKeyData.s[0] : keyData.e[0]; + } + keyPropS = keyData.s[0]; + } + jLen = previousValue._length; + kLen = keyPropS.i[0].length; + caching.lastIndex = iterationIndex; + for(j = 0; j < jLen; j += 1)for(k = 0; k < kLen; k += 1){ + vertexValue = isHold ? keyPropS.i[j][k] : keyPropS.i[j][k] + (keyPropE.i[j][k] - keyPropS.i[j][k]) * perc; + previousValue.i[j][k] = vertexValue; + vertexValue = isHold ? keyPropS.o[j][k] : keyPropS.o[j][k] + (keyPropE.o[j][k] - keyPropS.o[j][k]) * perc; + previousValue.o[j][k] = vertexValue; + vertexValue = isHold ? keyPropS.v[j][k] : keyPropS.v[j][k] + (keyPropE.v[j][k] - keyPropS.v[j][k]) * perc; + previousValue.v[j][k] = vertexValue; + } + } + function interpolateShapeCurrentTime() { + var frameNum = this.comp.renderedFrame - this.offsetTime; + var initTime = this.keyframes[0].t - this.offsetTime; + var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime; + var lastFrame = this._caching.lastFrame; + if (!(lastFrame !== initFrame && (lastFrame < initTime && frameNum < initTime || lastFrame > endTime && frameNum > endTime))) { + this._caching.lastIndex = lastFrame < frameNum ? this._caching.lastIndex : 0; + this.interpolateShape(frameNum, this.pv, this._caching); + } + this._caching.lastFrame = frameNum; + return this.pv; + } + function resetShape() { + this.paths = this.localShapeCollection; + } + function shapesEqual(shape1, shape2) { + if (shape1._length !== shape2._length || shape1.c !== shape2.c) return false; + var i; + var len = shape1._length; + for(i = 0; i < len; i += 1)if (shape1.v[i][0] !== shape2.v[i][0] || shape1.v[i][1] !== shape2.v[i][1] || shape1.o[i][0] !== shape2.o[i][0] || shape1.o[i][1] !== shape2.o[i][1] || shape1.i[i][0] !== shape2.i[i][0] || shape1.i[i][1] !== shape2.i[i][1]) return false; + return true; + } + function setVValue(newPath) { + if (!shapesEqual(this.v, newPath)) { + this.v = shapePool.clone(newPath); + this.localShapeCollection.releaseShapes(); + this.localShapeCollection.addShape(this.v); + this._mdf = true; + this.paths = this.localShapeCollection; + } + } + function processEffectsSequence() { + if (this.elem.globalData.frameId === this.frameId) return; + if (!this.effectsSequence.length) { + this._mdf = false; + return; + } + if (this.lock) return void this.setVValue(this.pv); + this.lock = true; + this._mdf = false; + var finalValue; + finalValue = this.kf ? this.pv : this.data.ks ? this.data.ks.k : this.data.pt.k; + var i; + var len = this.effectsSequence.length; + for(i = 0; i < len; i += 1)finalValue = this.effectsSequence[i](finalValue); + this.setVValue(finalValue); + this.lock = false; + this.frameId = this.elem.globalData.frameId; + } + function ShapeProperty(elem, data, type) { + this.propType = 'shape'; + this.comp = elem.comp; + this.container = elem; + this.elem = elem; + this.data = data; + this.k = false; + this.kf = false; + this._mdf = false; + var pathData = 3 === type ? data.pt.k : data.ks.k; + this.v = shapePool.clone(pathData); + this.pv = shapePool.clone(this.v); + this.localShapeCollection = shapeCollectionPool.newShapeCollection(); + this.paths = this.localShapeCollection; + this.paths.addShape(this.v); + this.reset = resetShape; + this.effectsSequence = []; + } + function addEffect(effectFunction) { + this.effectsSequence.push(effectFunction); + this.container.addDynamicProperty(this); + } + ShapeProperty.prototype.interpolateShape = interpolateShape; + ShapeProperty.prototype.getValue = processEffectsSequence; + ShapeProperty.prototype.setVValue = setVValue; + ShapeProperty.prototype.addEffect = addEffect; + function KeyframedShapeProperty(elem, data, type) { + this.propType = 'shape'; + this.comp = elem.comp; + this.elem = elem; + this.container = elem; + this.offsetTime = elem.data.st; + this.keyframes = 3 === type ? data.pt.k : data.ks.k; + this.keyframesMetadata = []; + this.k = true; + this.kf = true; + var len = this.keyframes[0].s[0].i.length; + this.v = shapePool.newElement(); + this.v.setPathData(this.keyframes[0].s[0].c, len); + this.pv = shapePool.clone(this.v); + this.localShapeCollection = shapeCollectionPool.newShapeCollection(); + this.paths = this.localShapeCollection; + this.paths.addShape(this.v); + this.lastFrame = initFrame; + this.reset = resetShape; + this._caching = { + lastFrame: initFrame, + lastIndex: 0 + }; + this.effectsSequence = [ + interpolateShapeCurrentTime.bind(this) + ]; + } + KeyframedShapeProperty.prototype.getValue = processEffectsSequence; + KeyframedShapeProperty.prototype.interpolateShape = interpolateShape; + KeyframedShapeProperty.prototype.setVValue = setVValue; + KeyframedShapeProperty.prototype.addEffect = addEffect; + var EllShapeProperty = function() { + var cPoint = roundCorner; + function EllShapePropertyFactory(elem, data) { + this.v = shapePool.newElement(); + this.v.setPathData(true, 4); + this.localShapeCollection = shapeCollectionPool.newShapeCollection(); + this.paths = this.localShapeCollection; + this.localShapeCollection.addShape(this.v); + this.d = data.d; + this.elem = elem; + this.comp = elem.comp; + this.frameId = -1; + this.initDynamicPropertyContainer(elem); + this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this); + this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this); + if (this.dynamicProperties.length) this.k = true; + else { + this.k = false; + this.convertEllToPath(); + } + } + EllShapePropertyFactory.prototype = { + reset: resetShape, + getValue: function() { + if (this.elem.globalData.frameId === this.frameId) return; + this.frameId = this.elem.globalData.frameId; + this.iterateDynamicProperties(); + if (this._mdf) this.convertEllToPath(); + }, + convertEllToPath: function() { + var p0 = this.p.v[0]; + var p1 = this.p.v[1]; + var s0 = this.s.v[0] / 2; + var s1 = this.s.v[1] / 2; + var _cw = 3 !== this.d; + var _v = this.v; + _v.v[0][0] = p0; + _v.v[0][1] = p1 - s1; + _v.v[1][0] = _cw ? p0 + s0 : p0 - s0; + _v.v[1][1] = p1; + _v.v[2][0] = p0; + _v.v[2][1] = p1 + s1; + _v.v[3][0] = _cw ? p0 - s0 : p0 + s0; + _v.v[3][1] = p1; + _v.i[0][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint; + _v.i[0][1] = p1 - s1; + _v.i[1][0] = _cw ? p0 + s0 : p0 - s0; + _v.i[1][1] = p1 - s1 * cPoint; + _v.i[2][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint; + _v.i[2][1] = p1 + s1; + _v.i[3][0] = _cw ? p0 - s0 : p0 + s0; + _v.i[3][1] = p1 + s1 * cPoint; + _v.o[0][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint; + _v.o[0][1] = p1 - s1; + _v.o[1][0] = _cw ? p0 + s0 : p0 - s0; + _v.o[1][1] = p1 + s1 * cPoint; + _v.o[2][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint; + _v.o[2][1] = p1 + s1; + _v.o[3][0] = _cw ? p0 - s0 : p0 + s0; + _v.o[3][1] = p1 - s1 * cPoint; + } + }; + extendPrototype([ + DynamicPropertyContainer + ], EllShapePropertyFactory); + return EllShapePropertyFactory; + }(); + var StarShapeProperty = function() { + function StarShapePropertyFactory(elem, data) { + this.v = shapePool.newElement(); + this.v.setPathData(true, 0); + this.elem = elem; + this.comp = elem.comp; + this.data = data; + this.frameId = -1; + this.d = data.d; + this.initDynamicPropertyContainer(elem); + if (1 === data.sy) { + this.ir = PropertyFactory.getProp(elem, data.ir, 0, 0, this); + this.is = PropertyFactory.getProp(elem, data.is, 0, 0.01, this); + this.convertToPath = this.convertStarToPath; + } else this.convertToPath = this.convertPolygonToPath; + this.pt = PropertyFactory.getProp(elem, data.pt, 0, 0, this); + this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this); + this.r = PropertyFactory.getProp(elem, data.r, 0, degToRads, this); + this.or = PropertyFactory.getProp(elem, data.or, 0, 0, this); + this.os = PropertyFactory.getProp(elem, data.os, 0, 0.01, this); + this.localShapeCollection = shapeCollectionPool.newShapeCollection(); + this.localShapeCollection.addShape(this.v); + this.paths = this.localShapeCollection; + if (this.dynamicProperties.length) this.k = true; + else { + this.k = false; + this.convertToPath(); + } + } + StarShapePropertyFactory.prototype = { + reset: resetShape, + getValue: function() { + if (this.elem.globalData.frameId === this.frameId) return; + this.frameId = this.elem.globalData.frameId; + this.iterateDynamicProperties(); + if (this._mdf) this.convertToPath(); + }, + convertStarToPath: function() { + var numPts = 2 * Math.floor(this.pt.v); + var angle = 2 * Math.PI / numPts; + var longFlag = true; + var longRad = this.or.v; + var shortRad = this.ir.v; + var longRound = this.os.v; + var shortRound = this.is.v; + var longPerimSegment = 2 * Math.PI * longRad / (2 * numPts); + var shortPerimSegment = 2 * Math.PI * shortRad / (2 * numPts); + var i; + var rad; + var roundness; + var perimSegment; + var currentAng = -Math.PI / 2; + currentAng += this.r.v; + var dir = 3 === this.data.d ? -1 : 1; + this.v._length = 0; + for(i = 0; i < numPts; i += 1){ + rad = longFlag ? longRad : shortRad; + roundness = longFlag ? longRound : shortRound; + perimSegment = longFlag ? longPerimSegment : shortPerimSegment; + var x = rad * Math.cos(currentAng); + var y = rad * Math.sin(currentAng); + var ox = 0 === x && 0 === y ? 0 : y / Math.sqrt(x * x + y * y); + var oy = 0 === x && 0 === y ? 0 : -x / Math.sqrt(x * x + y * y); + x += +this.p.v[0]; + y += +this.p.v[1]; + this.v.setTripleAt(x, y, x - ox * perimSegment * roundness * dir, y - oy * perimSegment * roundness * dir, x + ox * perimSegment * roundness * dir, y + oy * perimSegment * roundness * dir, i, true); + longFlag = !longFlag; + currentAng += angle * dir; + } + }, + convertPolygonToPath: function() { + var numPts = Math.floor(this.pt.v); + var angle = 2 * Math.PI / numPts; + var rad = this.or.v; + var roundness = this.os.v; + var perimSegment = 2 * Math.PI * rad / (4 * numPts); + var i; + var currentAng = 0.5 * -Math.PI; + var dir = 3 === this.data.d ? -1 : 1; + currentAng += this.r.v; + this.v._length = 0; + for(i = 0; i < numPts; i += 1){ + var x = rad * Math.cos(currentAng); + var y = rad * Math.sin(currentAng); + var ox = 0 === x && 0 === y ? 0 : y / Math.sqrt(x * x + y * y); + var oy = 0 === x && 0 === y ? 0 : -x / Math.sqrt(x * x + y * y); + x += +this.p.v[0]; + y += +this.p.v[1]; + this.v.setTripleAt(x, y, x - ox * perimSegment * roundness * dir, y - oy * perimSegment * roundness * dir, x + ox * perimSegment * roundness * dir, y + oy * perimSegment * roundness * dir, i, true); + currentAng += angle * dir; + } + this.paths.length = 0; + this.paths[0] = this.v; + } + }; + extendPrototype([ + DynamicPropertyContainer + ], StarShapePropertyFactory); + return StarShapePropertyFactory; + }(); + var RectShapeProperty = function() { + function RectShapePropertyFactory(elem, data) { + this.v = shapePool.newElement(); + this.v.c = true; + this.localShapeCollection = shapeCollectionPool.newShapeCollection(); + this.localShapeCollection.addShape(this.v); + this.paths = this.localShapeCollection; + this.elem = elem; + this.comp = elem.comp; + this.frameId = -1; + this.d = data.d; + this.initDynamicPropertyContainer(elem); + this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this); + this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this); + this.r = PropertyFactory.getProp(elem, data.r, 0, 0, this); + if (this.dynamicProperties.length) this.k = true; + else { + this.k = false; + this.convertRectToPath(); + } + } + RectShapePropertyFactory.prototype = { + convertRectToPath: function() { + var p0 = this.p.v[0]; + var p1 = this.p.v[1]; + var v0 = this.s.v[0] / 2; + var v1 = this.s.v[1] / 2; + var round = bmMin(v0, v1, this.r.v); + var cPoint = round * (1 - roundCorner); + this.v._length = 0; + if (2 === this.d || 1 === this.d) { + this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, 0, true); + this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, p0 + v0, p1 + v1 - round, 1, true); + if (0 !== round) { + this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, 2, true); + this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0 + round, p1 + v1, 3, true); + this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, 4, true); + this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1 + round, 5, true); + this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, 6, true); + this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, p0 + v0 - round, p1 - v1, 7, true); + } else { + this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0, p1 + v1, 2); + this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1, 3); + } + } else { + this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, p0 + v0, p1 - v1 + round, 0, true); + if (0 !== round) { + this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, 1, true); + this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0 + round, p1 - v1, 2, true); + this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, 3, true); + this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1 - round, 4, true); + this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, 5, true); + this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0 - round, p1 + v1, 6, true); + this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, 7, true); + } else { + this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0, p1 - v1, 1, true); + this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1, 2, true); + this.v.setTripleAt(p0 + v0, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0, p1 + v1, 3, true); + } + } + }, + getValue: function() { + if (this.elem.globalData.frameId === this.frameId) return; + this.frameId = this.elem.globalData.frameId; + this.iterateDynamicProperties(); + if (this._mdf) this.convertRectToPath(); + }, + reset: resetShape + }; + extendPrototype([ + DynamicPropertyContainer + ], RectShapePropertyFactory); + return RectShapePropertyFactory; + }(); + function getShapeProp(elem, data, type) { + var prop; + if (3 === type || 4 === type) { + var dataProp = 3 === type ? data.pt : data.ks; + var keys = dataProp.k; + prop = keys.length ? new KeyframedShapeProperty(elem, data, type) : new ShapeProperty(elem, data, type); + } else if (5 === type) prop = new RectShapeProperty(elem, data); + else if (6 === type) prop = new EllShapeProperty(elem, data); + else if (7 === type) prop = new StarShapeProperty(elem, data); + if (prop.k) elem.addDynamicProperty(prop); + return prop; + } + function getConstructorFunction() { + return ShapeProperty; + } + function getKeyframedConstructorFunction() { + return KeyframedShapeProperty; + } + var ob = {}; + ob.getShapeProp = getShapeProp; + ob.getConstructorFunction = getConstructorFunction; + ob.getKeyframedConstructorFunction = getKeyframedConstructorFunction; + return ob; + }(); + /*! + Transformation Matrix v2.0 + (c) Epistemex 2014-2015 + www.epistemex.com + By Ken Fyrstenberg + Contributions by leeoniya. + License: MIT, header required. + */ var Matrix = function() { + var _cos = Math.cos; + var _sin = Math.sin; + var _tan = Math.tan; + var _rnd = Math.round; + function reset() { + this.props[0] = 1; + this.props[1] = 0; + this.props[2] = 0; + this.props[3] = 0; + this.props[4] = 0; + this.props[5] = 1; + this.props[6] = 0; + this.props[7] = 0; + this.props[8] = 0; + this.props[9] = 0; + this.props[10] = 1; + this.props[11] = 0; + this.props[12] = 0; + this.props[13] = 0; + this.props[14] = 0; + this.props[15] = 1; + return this; + } + function rotate(angle) { + if (0 === angle) return this; + var mCos = _cos(angle); + var mSin = _sin(angle); + return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); + } + function rotateX(angle) { + if (0 === angle) return this; + var mCos = _cos(angle); + var mSin = _sin(angle); + return this._t(1, 0, 0, 0, 0, mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1); + } + function rotateY(angle) { + if (0 === angle) return this; + var mCos = _cos(angle); + var mSin = _sin(angle); + return this._t(mCos, 0, mSin, 0, 0, 1, 0, 0, -mSin, 0, mCos, 0, 0, 0, 0, 1); + } + function rotateZ(angle) { + if (0 === angle) return this; + var mCos = _cos(angle); + var mSin = _sin(angle); + return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); + } + function shear(sx, sy) { + return this._t(1, sy, sx, 1, 0, 0); + } + function skew(ax, ay) { + return this.shear(_tan(ax), _tan(ay)); + } + function skewFromAxis(ax, angle) { + var mCos = _cos(angle); + var mSin = _sin(angle); + return this._t(mCos, mSin, 0, 0, -mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)._t(1, 0, 0, 0, _tan(ax), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); + } + function scale(sx, sy, sz) { + if (!sz && 0 !== sz) sz = 1; + if (1 === sx && 1 === sy && 1 === sz) return this; + return this._t(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, 0, 0, 0, 1); + } + function setTransform(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) { + this.props[0] = a; + this.props[1] = b; + this.props[2] = c; + this.props[3] = d; + this.props[4] = e; + this.props[5] = f; + this.props[6] = g; + this.props[7] = h; + this.props[8] = i; + this.props[9] = j; + this.props[10] = k; + this.props[11] = l; + this.props[12] = m; + this.props[13] = n; + this.props[14] = o; + this.props[15] = p; + return this; + } + function translate(tx, ty, tz) { + tz = tz || 0; + if (0 !== tx || 0 !== ty || 0 !== tz) return this._t(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, tx, ty, tz, 1); + return this; + } + function transform(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2) { + var _p = this.props; + if (1 === a2 && 0 === b2 && 0 === c2 && 0 === d2 && 0 === e2 && 1 === f2 && 0 === g2 && 0 === h2 && 0 === i2 && 0 === j2 && 1 === k2 && 0 === l2) { + _p[12] = _p[12] * a2 + _p[15] * m2; + _p[13] = _p[13] * f2 + _p[15] * n2; + _p[14] = _p[14] * k2 + _p[15] * o2; + _p[15] *= p2; + this._identityCalculated = false; + return this; + } + var a1 = _p[0]; + var b1 = _p[1]; + var c1 = _p[2]; + var d1 = _p[3]; + var e1 = _p[4]; + var f1 = _p[5]; + var g1 = _p[6]; + var h1 = _p[7]; + var i1 = _p[8]; + var j1 = _p[9]; + var k1 = _p[10]; + var l1 = _p[11]; + var m1 = _p[12]; + var n1 = _p[13]; + var o1 = _p[14]; + var p1 = _p[15]; + _p[0] = a1 * a2 + b1 * e2 + c1 * i2 + d1 * m2; + _p[1] = a1 * b2 + b1 * f2 + c1 * j2 + d1 * n2; + _p[2] = a1 * c2 + b1 * g2 + c1 * k2 + d1 * o2; + _p[3] = a1 * d2 + b1 * h2 + c1 * l2 + d1 * p2; + _p[4] = e1 * a2 + f1 * e2 + g1 * i2 + h1 * m2; + _p[5] = e1 * b2 + f1 * f2 + g1 * j2 + h1 * n2; + _p[6] = e1 * c2 + f1 * g2 + g1 * k2 + h1 * o2; + _p[7] = e1 * d2 + f1 * h2 + g1 * l2 + h1 * p2; + _p[8] = i1 * a2 + j1 * e2 + k1 * i2 + l1 * m2; + _p[9] = i1 * b2 + j1 * f2 + k1 * j2 + l1 * n2; + _p[10] = i1 * c2 + j1 * g2 + k1 * k2 + l1 * o2; + _p[11] = i1 * d2 + j1 * h2 + k1 * l2 + l1 * p2; + _p[12] = m1 * a2 + n1 * e2 + o1 * i2 + p1 * m2; + _p[13] = m1 * b2 + n1 * f2 + o1 * j2 + p1 * n2; + _p[14] = m1 * c2 + n1 * g2 + o1 * k2 + p1 * o2; + _p[15] = m1 * d2 + n1 * h2 + o1 * l2 + p1 * p2; + this._identityCalculated = false; + return this; + } + function multiply(matrix) { + var matrixProps = matrix.props; + return this.transform(matrixProps[0], matrixProps[1], matrixProps[2], matrixProps[3], matrixProps[4], matrixProps[5], matrixProps[6], matrixProps[7], matrixProps[8], matrixProps[9], matrixProps[10], matrixProps[11], matrixProps[12], matrixProps[13], matrixProps[14], matrixProps[15]); + } + function isIdentity() { + if (!this._identityCalculated) { + this._identity = !(1 !== this.props[0] || 0 !== this.props[1] || 0 !== this.props[2] || 0 !== this.props[3] || 0 !== this.props[4] || 1 !== this.props[5] || 0 !== this.props[6] || 0 !== this.props[7] || 0 !== this.props[8] || 0 !== this.props[9] || 1 !== this.props[10] || 0 !== this.props[11] || 0 !== this.props[12] || 0 !== this.props[13] || 0 !== this.props[14] || 1 !== this.props[15]); + this._identityCalculated = true; + } + return this._identity; + } + function equals(matr) { + var i = 0; + while(i < 16){ + if (matr.props[i] !== this.props[i]) return false; + i += 1; + } + return true; + } + function clone(matr) { + var i; + for(i = 0; i < 16; i += 1)matr.props[i] = this.props[i]; + return matr; + } + function cloneFromProps(props) { + var i; + for(i = 0; i < 16; i += 1)this.props[i] = props[i]; + } + function applyToPoint(x, y, z) { + return { + x: x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12], + y: x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13], + z: x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14] + }; + } + function applyToX(x, y, z) { + return x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12]; + } + function applyToY(x, y, z) { + return x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13]; + } + function applyToZ(x, y, z) { + return x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]; + } + function getInverseMatrix() { + var determinant = this.props[0] * this.props[5] - this.props[1] * this.props[4]; + var a = this.props[5] / determinant; + var b = -this.props[1] / determinant; + var c = -this.props[4] / determinant; + var d = this.props[0] / determinant; + var e = (this.props[4] * this.props[13] - this.props[5] * this.props[12]) / determinant; + var f = -(this.props[0] * this.props[13] - this.props[1] * this.props[12]) / determinant; + var inverseMatrix = new Matrix(); + inverseMatrix.props[0] = a; + inverseMatrix.props[1] = b; + inverseMatrix.props[4] = c; + inverseMatrix.props[5] = d; + inverseMatrix.props[12] = e; + inverseMatrix.props[13] = f; + return inverseMatrix; + } + function inversePoint(pt) { + var inverseMatrix = this.getInverseMatrix(); + return inverseMatrix.applyToPointArray(pt[0], pt[1], pt[2] || 0); + } + function inversePoints(pts) { + var i; + var len = pts.length; + var retPts = []; + for(i = 0; i < len; i += 1)retPts[i] = inversePoint(pts[i]); + return retPts; + } + function applyToTriplePoints(pt1, pt2, pt3) { + var arr = createTypedArray('float32', 6); + if (this.isIdentity()) { + arr[0] = pt1[0]; + arr[1] = pt1[1]; + arr[2] = pt2[0]; + arr[3] = pt2[1]; + arr[4] = pt3[0]; + arr[5] = pt3[1]; + } else { + var p0 = this.props[0]; + var p1 = this.props[1]; + var p4 = this.props[4]; + var p5 = this.props[5]; + var p12 = this.props[12]; + var p13 = this.props[13]; + arr[0] = pt1[0] * p0 + pt1[1] * p4 + p12; + arr[1] = pt1[0] * p1 + pt1[1] * p5 + p13; + arr[2] = pt2[0] * p0 + pt2[1] * p4 + p12; + arr[3] = pt2[0] * p1 + pt2[1] * p5 + p13; + arr[4] = pt3[0] * p0 + pt3[1] * p4 + p12; + arr[5] = pt3[0] * p1 + pt3[1] * p5 + p13; + } + return arr; + } + function applyToPointArray(x, y, z) { + var arr; + arr = this.isIdentity() ? [ + x, + y, + z + ] : [ + x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12], + x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13], + x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14] + ]; + return arr; + } + function applyToPointStringified(x, y) { + if (this.isIdentity()) return x + ',' + y; + var _p = this.props; + return Math.round((x * _p[0] + y * _p[4] + _p[12]) * 100) / 100 + ',' + Math.round((x * _p[1] + y * _p[5] + _p[13]) * 100) / 100; + } + function toCSS() { + var i = 0; + var props = this.props; + var cssValue = 'matrix3d('; + var v = 10000; + while(i < 16){ + cssValue += _rnd(props[i] * v) / v; + cssValue += 15 === i ? ')' : ','; + i += 1; + } + return cssValue; + } + function roundMatrixProperty(val) { + var v = 10000; + if (val < 0.000001 && val > 0 || val > -0.000001 && val < 0) return _rnd(val * v) / v; + return val; + } + function to2dCSS() { + var props = this.props; + var _a = roundMatrixProperty(props[0]); + var _b = roundMatrixProperty(props[1]); + var _c = roundMatrixProperty(props[4]); + var _d = roundMatrixProperty(props[5]); + var _e = roundMatrixProperty(props[12]); + var _f = roundMatrixProperty(props[13]); + return 'matrix(' + _a + ',' + _b + ',' + _c + ',' + _d + ',' + _e + ',' + _f + ')'; + } + return function() { + this.reset = reset; + this.rotate = rotate; + this.rotateX = rotateX; + this.rotateY = rotateY; + this.rotateZ = rotateZ; + this.skew = skew; + this.skewFromAxis = skewFromAxis; + this.shear = shear; + this.scale = scale; + this.setTransform = setTransform; + this.translate = translate; + this.transform = transform; + this.multiply = multiply; + this.applyToPoint = applyToPoint; + this.applyToX = applyToX; + this.applyToY = applyToY; + this.applyToZ = applyToZ; + this.applyToPointArray = applyToPointArray; + this.applyToTriplePoints = applyToTriplePoints; + this.applyToPointStringified = applyToPointStringified; + this.toCSS = toCSS; + this.to2dCSS = to2dCSS; + this.clone = clone; + this.cloneFromProps = cloneFromProps; + this.equals = equals; + this.inversePoints = inversePoints; + this.inversePoint = inversePoint; + this.getInverseMatrix = getInverseMatrix; + this._t = this.transform; + this.isIdentity = isIdentity; + this._identity = true; + this._identityCalculated = false; + this.props = createTypedArray('float32', 16); + this.reset(); + }; + }(); + function _typeof$3(o) { + return _typeof$3 = "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$3(o); + } + var lottie = {}; + var standalone = '__[STANDALONE]__'; + var animationData = '__[ANIMATIONDATA]__'; + var renderer = ''; + function setLocation(href) { + setLocationHref(href); + } + function searchAnimations() { + if (true === standalone) animationManager.searchAnimations(animationData, standalone, renderer); + else animationManager.searchAnimations(); + } + function setSubframeRendering(flag) { + setSubframeEnabled(flag); + } + function setPrefix(prefix) { + setIdPrefix(prefix); + } + function loadAnimation(params) { + if (true === standalone) params.animationData = JSON.parse(animationData); + return animationManager.loadAnimation(params); + } + function setQuality(value) { + if ('string' == typeof value) switch(value){ + case 'high': + setDefaultCurveSegments(200); + break; + default: + case 'medium': + setDefaultCurveSegments(50); + break; + case 'low': + setDefaultCurveSegments(10); + break; + } + else if (!isNaN(value) && value > 1) setDefaultCurveSegments(value); + getDefaultCurveSegments() >= 50 ? roundValues(false) : roundValues(true); + } + function inBrowser() { + return 'undefined' != typeof navigator; + } + function installPlugin(type, plugin) { + if ('expressions' === type) setExpressionsPlugin(plugin); + } + function getFactory(name) { + switch(name){ + case 'propertyFactory': + return PropertyFactory; + case 'shapePropertyFactory': + return ShapePropertyFactory; + case 'matrix': + return Matrix; + default: + return null; + } + } + lottie.play = animationManager.play; + lottie.pause = animationManager.pause; + lottie.setLocationHref = setLocation; + lottie.togglePause = animationManager.togglePause; + lottie.setSpeed = animationManager.setSpeed; + lottie.setDirection = animationManager.setDirection; + lottie.stop = animationManager.stop; + lottie.searchAnimations = searchAnimations; + lottie.registerAnimation = animationManager.registerAnimation; + lottie.loadAnimation = loadAnimation; + lottie.setSubframeRendering = setSubframeRendering; + lottie.resize = animationManager.resize; + lottie.goToAndStop = animationManager.goToAndStop; + lottie.destroy = animationManager.destroy; + lottie.setQuality = setQuality; + lottie.inBrowser = inBrowser; + lottie.installPlugin = installPlugin; + lottie.freeze = animationManager.freeze; + lottie.unfreeze = animationManager.unfreeze; + lottie.setVolume = animationManager.setVolume; + lottie.mute = animationManager.mute; + lottie.unmute = animationManager.unmute; + lottie.getRegisteredAnimations = animationManager.getRegisteredAnimations; + lottie.useWebWorker = setWebWorker; + lottie.setIDPrefix = setPrefix; + lottie.__getFactory = getFactory; + lottie.version = '5.13.0'; + function checkReady() { + if ('complete' === document.readyState) { + clearInterval(readyStateCheckInterval); + searchAnimations(); + } + } + function getQueryVariable(variable) { + var vars = queryString.split('&'); + for(var i = 0; i < vars.length; i += 1){ + var pair = vars[i].split('='); + if (decodeURIComponent(pair[0]) == variable) return decodeURIComponent(pair[1]); + } + return null; + } + var queryString = ''; + if (standalone) { + var scripts = document.getElementsByTagName("script"); + var index = scripts.length - 1; + var myScript = scripts[index] || { + src: '' + }; + queryString = myScript.src ? myScript.src.replace(/^[^\?]+\??/, '') : ''; + renderer = getQueryVariable('renderer'); + } + var readyStateCheckInterval = setInterval(checkReady, 100); + try { + if (!('object' === _typeof$3(exports) && true) && !('function' == typeof define && define.amd)) window.bodymovin = lottie; + } catch (err) {} + var ShapeModifiers = function() { + var ob = {}; + var modifiers = {}; + ob.registerModifier = registerModifier; + ob.getModifier = getModifier; + function registerModifier(nm, factory) { + if (!modifiers[nm]) modifiers[nm] = factory; + } + function getModifier(nm, elem, data) { + return new modifiers[nm](elem, data); + } + return ob; + }(); + function ShapeModifier() {} + ShapeModifier.prototype.initModifierProperties = function() {}; + ShapeModifier.prototype.addShapeToModifier = function() {}; + ShapeModifier.prototype.addShape = function(data) { + if (!this.closed) { + data.sh.container.addDynamicProperty(data.sh); + var shapeData = { + shape: data.sh, + data: data, + localShapeCollection: shapeCollectionPool.newShapeCollection() + }; + this.shapes.push(shapeData); + this.addShapeToModifier(shapeData); + if (this._isAnimated) data.setAsAnimated(); + } + }; + ShapeModifier.prototype.init = function(elem, data) { + this.shapes = []; + this.elem = elem; + this.initDynamicPropertyContainer(elem); + this.initModifierProperties(elem, data); + this.frameId = initialDefaultFrame; + this.closed = false; + this.k = false; + if (this.dynamicProperties.length) this.k = true; + else this.getValue(true); + }; + ShapeModifier.prototype.processKeys = function() { + if (this.elem.globalData.frameId === this.frameId) return; + this.frameId = this.elem.globalData.frameId; + this.iterateDynamicProperties(); + }; + extendPrototype([ + DynamicPropertyContainer + ], ShapeModifier); + function TrimModifier() {} + extendPrototype([ + ShapeModifier + ], TrimModifier); + TrimModifier.prototype.initModifierProperties = function(elem, data) { + this.s = PropertyFactory.getProp(elem, data.s, 0, 0.01, this); + this.e = PropertyFactory.getProp(elem, data.e, 0, 0.01, this); + this.o = PropertyFactory.getProp(elem, data.o, 0, 0, this); + this.sValue = 0; + this.eValue = 0; + this.getValue = this.processKeys; + this.m = data.m; + this._isAnimated = !!this.s.effectsSequence.length || !!this.e.effectsSequence.length || !!this.o.effectsSequence.length; + }; + TrimModifier.prototype.addShapeToModifier = function(shapeData) { + shapeData.pathsData = []; + }; + TrimModifier.prototype.calculateShapeEdges = function(s, e, shapeLength, addedLength, totalModifierLength) { + var segments = []; + if (e <= 1) segments.push({ + s: s, + e: e + }); + else if (s >= 1) segments.push({ + s: s - 1, + e: e - 1 + }); + else { + segments.push({ + s: s, + e: 1 + }); + segments.push({ + s: 0, + e: e - 1 + }); + } + var shapeSegments = []; + var i; + var len = segments.length; + var segmentOb; + for(i = 0; i < len; i += 1){ + segmentOb = segments[i]; + if (!(segmentOb.e * totalModifierLength < addedLength || segmentOb.s * totalModifierLength > addedLength + shapeLength)) { + var shapeS; + var shapeE; + shapeS = segmentOb.s * totalModifierLength <= addedLength ? 0 : (segmentOb.s * totalModifierLength - addedLength) / shapeLength; + shapeE = segmentOb.e * totalModifierLength >= addedLength + shapeLength ? 1 : (segmentOb.e * totalModifierLength - addedLength) / shapeLength; + shapeSegments.push([ + shapeS, + shapeE + ]); + } + } + if (!shapeSegments.length) shapeSegments.push([ + 0, + 0 + ]); + return shapeSegments; + }; + TrimModifier.prototype.releasePathsData = function(pathsData) { + var i; + var len = pathsData.length; + for(i = 0; i < len; i += 1)segmentsLengthPool.release(pathsData[i]); + pathsData.length = 0; + return pathsData; + }; + TrimModifier.prototype.processShapes = function(_isFirstFrame) { + var s; + var e; + if (this._mdf || _isFirstFrame) { + var o = this.o.v % 360 / 360; + if (o < 0) o += 1; + s = this.s.v > 1 ? 1 + o : this.s.v < 0 ? 0 + o : this.s.v + o; + e = this.e.v > 1 ? 1 + o : this.e.v < 0 ? 0 + o : this.e.v + o; + if (s > e) { + var _s = s; + s = e; + e = _s; + } + s = 0.0001 * Math.round(10000 * s); + e = 0.0001 * Math.round(10000 * e); + this.sValue = s; + this.eValue = e; + } else { + s = this.sValue; + e = this.eValue; + } + var shapePaths; + var i; + var len = this.shapes.length; + var j; + var jLen; + var pathsData; + var pathData; + var totalShapeLength; + var totalModifierLength = 0; + if (e === s) for(i = 0; i < len; i += 1){ + this.shapes[i].localShapeCollection.releaseShapes(); + this.shapes[i].shape._mdf = true; + this.shapes[i].shape.paths = this.shapes[i].localShapeCollection; + if (this._mdf) this.shapes[i].pathsData.length = 0; + } + else if (1 === e && 0 === s || 0 === e && 1 === s) { + if (this._mdf) for(i = 0; i < len; i += 1){ + this.shapes[i].pathsData.length = 0; + this.shapes[i].shape._mdf = true; + } + } else { + var segments = []; + var shapeData; + var localShapeCollection; + for(i = 0; i < len; i += 1){ + shapeData = this.shapes[i]; + if (shapeData.shape._mdf || this._mdf || _isFirstFrame || 2 === this.m) { + shapePaths = shapeData.shape.paths; + jLen = shapePaths._length; + totalShapeLength = 0; + if (!shapeData.shape._mdf && shapeData.pathsData.length) totalShapeLength = shapeData.totalShapeLength; + else { + pathsData = this.releasePathsData(shapeData.pathsData); + for(j = 0; j < jLen; j += 1){ + pathData = bez.getSegmentsLength(shapePaths.shapes[j]); + pathsData.push(pathData); + totalShapeLength += pathData.totalLength; + } + shapeData.totalShapeLength = totalShapeLength; + shapeData.pathsData = pathsData; + } + totalModifierLength += totalShapeLength; + shapeData.shape._mdf = true; + } else shapeData.shape.paths = shapeData.localShapeCollection; + } + var shapeS = s; + var shapeE = e; + var addedLength = 0; + var edges; + for(i = len - 1; i >= 0; i -= 1){ + shapeData = this.shapes[i]; + if (shapeData.shape._mdf) { + localShapeCollection = shapeData.localShapeCollection; + localShapeCollection.releaseShapes(); + if (2 === this.m && len > 1) { + edges = this.calculateShapeEdges(s, e, shapeData.totalShapeLength, addedLength, totalModifierLength); + addedLength += shapeData.totalShapeLength; + } else edges = [ + [ + shapeS, + shapeE + ] + ]; + jLen = edges.length; + for(j = 0; j < jLen; j += 1){ + shapeS = edges[j][0]; + shapeE = edges[j][1]; + segments.length = 0; + if (shapeE <= 1) segments.push({ + s: shapeData.totalShapeLength * shapeS, + e: shapeData.totalShapeLength * shapeE + }); + else if (shapeS >= 1) segments.push({ + s: shapeData.totalShapeLength * (shapeS - 1), + e: shapeData.totalShapeLength * (shapeE - 1) + }); + else { + segments.push({ + s: shapeData.totalShapeLength * shapeS, + e: shapeData.totalShapeLength + }); + segments.push({ + s: 0, + e: shapeData.totalShapeLength * (shapeE - 1) + }); + } + var newShapesData = this.addShapes(shapeData, segments[0]); + if (segments[0].s !== segments[0].e) { + if (segments.length > 1) { + var lastShapeInCollection = shapeData.shape.paths.shapes[shapeData.shape.paths._length - 1]; + if (lastShapeInCollection.c) { + var lastShape = newShapesData.pop(); + this.addPaths(newShapesData, localShapeCollection); + newShapesData = this.addShapes(shapeData, segments[1], lastShape); + } else { + this.addPaths(newShapesData, localShapeCollection); + newShapesData = this.addShapes(shapeData, segments[1]); + } + } + this.addPaths(newShapesData, localShapeCollection); + } + } + shapeData.shape.paths = localShapeCollection; + } + } + } + }; + TrimModifier.prototype.addPaths = function(newPaths, localShapeCollection) { + var i; + var len = newPaths.length; + for(i = 0; i < len; i += 1)localShapeCollection.addShape(newPaths[i]); + }; + TrimModifier.prototype.addSegment = function(pt1, pt2, pt3, pt4, shapePath, pos, newShape) { + shapePath.setXYAt(pt2[0], pt2[1], 'o', pos); + shapePath.setXYAt(pt3[0], pt3[1], 'i', pos + 1); + if (newShape) shapePath.setXYAt(pt1[0], pt1[1], 'v', pos); + shapePath.setXYAt(pt4[0], pt4[1], 'v', pos + 1); + }; + TrimModifier.prototype.addSegmentFromArray = function(points, shapePath, pos, newShape) { + shapePath.setXYAt(points[1], points[5], 'o', pos); + shapePath.setXYAt(points[2], points[6], 'i', pos + 1); + if (newShape) shapePath.setXYAt(points[0], points[4], 'v', pos); + shapePath.setXYAt(points[3], points[7], 'v', pos + 1); + }; + TrimModifier.prototype.addShapes = function(shapeData, shapeSegment, shapePath) { + var pathsData = shapeData.pathsData; + var shapePaths = shapeData.shape.paths.shapes; + var i; + var len = shapeData.shape.paths._length; + var j; + var jLen; + var addedLength = 0; + var currentLengthData; + var segmentCount; + var lengths; + var segment; + var shapes = []; + var initPos; + var newShape = true; + if (shapePath) { + segmentCount = shapePath._length; + initPos = shapePath._length; + } else { + shapePath = shapePool.newElement(); + segmentCount = 0; + initPos = 0; + } + shapes.push(shapePath); + for(i = 0; i < len; i += 1){ + lengths = pathsData[i].lengths; + shapePath.c = shapePaths[i].c; + jLen = shapePaths[i].c ? lengths.length : lengths.length + 1; + for(j = 1; j < jLen; j += 1){ + currentLengthData = lengths[j - 1]; + if (addedLength + currentLengthData.addedLength < shapeSegment.s) { + addedLength += currentLengthData.addedLength; + shapePath.c = false; + } else if (addedLength > shapeSegment.e) { + shapePath.c = false; + break; + } else { + if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + currentLengthData.addedLength) { + this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[j], shapePaths[i].v[j], shapePath, segmentCount, newShape); + newShape = false; + } else { + segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[j], shapePaths[i].o[j - 1], shapePaths[i].i[j], (shapeSegment.s - addedLength) / currentLengthData.addedLength, (shapeSegment.e - addedLength) / currentLengthData.addedLength, lengths[j - 1]); + this.addSegmentFromArray(segment, shapePath, segmentCount, newShape); + newShape = false; + shapePath.c = false; + } + addedLength += currentLengthData.addedLength; + segmentCount += 1; + } + } + if (shapePaths[i].c && lengths.length) { + currentLengthData = lengths[j - 1]; + if (addedLength <= shapeSegment.e) { + var segmentLength = lengths[j - 1].addedLength; + if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + segmentLength) { + this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[0], shapePaths[i].v[0], shapePath, segmentCount, newShape); + newShape = false; + } else { + segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[0], shapePaths[i].o[j - 1], shapePaths[i].i[0], (shapeSegment.s - addedLength) / segmentLength, (shapeSegment.e - addedLength) / segmentLength, lengths[j - 1]); + this.addSegmentFromArray(segment, shapePath, segmentCount, newShape); + newShape = false; + shapePath.c = false; + } + } else shapePath.c = false; + addedLength += currentLengthData.addedLength; + segmentCount += 1; + } + if (shapePath._length) { + shapePath.setXYAt(shapePath.v[initPos][0], shapePath.v[initPos][1], 'i', initPos); + shapePath.setXYAt(shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1], 'o', shapePath._length - 1); + } + if (addedLength > shapeSegment.e) break; + if (i < len - 1) { + shapePath = shapePool.newElement(); + newShape = true; + shapes.push(shapePath); + segmentCount = 0; + } + } + return shapes; + }; + function PuckerAndBloatModifier() {} + extendPrototype([ + ShapeModifier + ], PuckerAndBloatModifier); + PuckerAndBloatModifier.prototype.initModifierProperties = function(elem, data) { + this.getValue = this.processKeys; + this.amount = PropertyFactory.getProp(elem, data.a, 0, null, this); + this._isAnimated = !!this.amount.effectsSequence.length; + }; + PuckerAndBloatModifier.prototype.processPath = function(path, amount) { + var percent = amount / 100; + var centerPoint = [ + 0, + 0 + ]; + var pathLength = path._length; + var i = 0; + for(i = 0; i < pathLength; i += 1){ + centerPoint[0] += path.v[i][0]; + centerPoint[1] += path.v[i][1]; + } + centerPoint[0] /= pathLength; + centerPoint[1] /= pathLength; + var clonedPath = shapePool.newElement(); + clonedPath.c = path.c; + var vX; + var vY; + var oX; + var oY; + var iX; + var iY; + for(i = 0; i < pathLength; i += 1){ + vX = path.v[i][0] + (centerPoint[0] - path.v[i][0]) * percent; + vY = path.v[i][1] + (centerPoint[1] - path.v[i][1]) * percent; + oX = path.o[i][0] + (centerPoint[0] - path.o[i][0]) * -percent; + oY = path.o[i][1] + (centerPoint[1] - path.o[i][1]) * -percent; + iX = path.i[i][0] + (centerPoint[0] - path.i[i][0]) * -percent; + iY = path.i[i][1] + (centerPoint[1] - path.i[i][1]) * -percent; + clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, i); + } + return clonedPath; + }; + PuckerAndBloatModifier.prototype.processShapes = function(_isFirstFrame) { + var shapePaths; + var i; + var len = this.shapes.length; + var j; + var jLen; + var amount = this.amount.v; + if (0 !== amount) { + var shapeData; + var localShapeCollection; + for(i = 0; i < len; i += 1){ + shapeData = this.shapes[i]; + localShapeCollection = shapeData.localShapeCollection; + if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) { + localShapeCollection.releaseShapes(); + shapeData.shape._mdf = true; + shapePaths = shapeData.shape.paths.shapes; + jLen = shapeData.shape.paths._length; + for(j = 0; j < jLen; j += 1)localShapeCollection.addShape(this.processPath(shapePaths[j], amount)); + } + shapeData.shape.paths = shapeData.localShapeCollection; + } + } + if (!this.dynamicProperties.length) this._mdf = false; + }; + var TransformPropertyFactory = function() { + var defaultVector = [ + 0, + 0 + ]; + function applyToMatrix(mat) { + var _mdf = this._mdf; + this.iterateDynamicProperties(); + this._mdf = this._mdf || _mdf; + if (this.a) mat.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]); + if (this.s) mat.scale(this.s.v[0], this.s.v[1], this.s.v[2]); + if (this.sk) mat.skewFromAxis(-this.sk.v, this.sa.v); + if (this.r) mat.rotate(-this.r.v); + else mat.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]); + if (this.data.p.s) if (this.data.p.z) mat.translate(this.px.v, this.py.v, -this.pz.v); + else mat.translate(this.px.v, this.py.v, 0); + else mat.translate(this.p.v[0], this.p.v[1], -this.p.v[2]); + } + function processKeys(forceRender) { + if (this.elem.globalData.frameId === this.frameId) return; + if (this._isDirty) { + this.precalculateMatrix(); + this._isDirty = false; + } + this.iterateDynamicProperties(); + if (this._mdf || forceRender) { + var frameRate; + this.v.cloneFromProps(this.pre.props); + if (this.appliedTransformations < 1) this.v.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]); + if (this.appliedTransformations < 2) this.v.scale(this.s.v[0], this.s.v[1], this.s.v[2]); + if (this.sk && this.appliedTransformations < 3) this.v.skewFromAxis(-this.sk.v, this.sa.v); + if (this.r && this.appliedTransformations < 4) this.v.rotate(-this.r.v); + else if (!this.r && this.appliedTransformations < 4) this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]); + if (this.autoOriented) { + var v1; + var v2; + frameRate = this.elem.globalData.frameRate; + if (this.p && this.p.keyframes && this.p.getValueAtTime) if (this.p._caching.lastFrame + this.p.offsetTime <= this.p.keyframes[0].t) { + v1 = this.p.getValueAtTime((this.p.keyframes[0].t + 0.01) / frameRate, 0); + v2 = this.p.getValueAtTime(this.p.keyframes[0].t / frameRate, 0); + } else if (this.p._caching.lastFrame + this.p.offsetTime >= this.p.keyframes[this.p.keyframes.length - 1].t) { + v1 = this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length - 1].t / frameRate, 0); + v2 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t - 0.05) / frameRate, 0); + } else { + v1 = this.p.pv; + v2 = this.p.getValueAtTime((this.p._caching.lastFrame + this.p.offsetTime - 0.01) / frameRate, this.p.offsetTime); + } + else if (this.px && this.px.keyframes && this.py.keyframes && this.px.getValueAtTime && this.py.getValueAtTime) { + v1 = []; + v2 = []; + var px = this.px; + var py = this.py; + if (px._caching.lastFrame + px.offsetTime <= px.keyframes[0].t) { + v1[0] = px.getValueAtTime((px.keyframes[0].t + 0.01) / frameRate, 0); + v1[1] = py.getValueAtTime((py.keyframes[0].t + 0.01) / frameRate, 0); + v2[0] = px.getValueAtTime(px.keyframes[0].t / frameRate, 0); + v2[1] = py.getValueAtTime(py.keyframes[0].t / frameRate, 0); + } else if (px._caching.lastFrame + px.offsetTime >= px.keyframes[px.keyframes.length - 1].t) { + v1[0] = px.getValueAtTime(px.keyframes[px.keyframes.length - 1].t / frameRate, 0); + v1[1] = py.getValueAtTime(py.keyframes[py.keyframes.length - 1].t / frameRate, 0); + v2[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t - 0.01) / frameRate, 0); + v2[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t - 0.01) / frameRate, 0); + } else { + v1 = [ + px.pv, + py.pv + ]; + v2[0] = px.getValueAtTime((px._caching.lastFrame + px.offsetTime - 0.01) / frameRate, px.offsetTime); + v2[1] = py.getValueAtTime((py._caching.lastFrame + py.offsetTime - 0.01) / frameRate, py.offsetTime); + } + } else { + v2 = defaultVector; + v1 = v2; + } + this.v.rotate(-Math.atan2(v1[1] - v2[1], v1[0] - v2[0])); + } + if (this.data.p && this.data.p.s) if (this.data.p.z) this.v.translate(this.px.v, this.py.v, -this.pz.v); + else this.v.translate(this.px.v, this.py.v, 0); + else this.v.translate(this.p.v[0], this.p.v[1], -this.p.v[2]); + } + this.frameId = this.elem.globalData.frameId; + } + function precalculateMatrix() { + this.appliedTransformations = 0; + this.pre.reset(); + if (this.a.effectsSequence.length) return; + this.pre.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]); + this.appliedTransformations = 1; + if (this.s.effectsSequence.length) return; + this.pre.scale(this.s.v[0], this.s.v[1], this.s.v[2]); + this.appliedTransformations = 2; + if (this.sk) if (this.sk.effectsSequence.length || this.sa.effectsSequence.length) return; + else { + this.pre.skewFromAxis(-this.sk.v, this.sa.v); + this.appliedTransformations = 3; + } + if (this.r) { + if (!this.r.effectsSequence.length) { + this.pre.rotate(-this.r.v); + this.appliedTransformations = 4; + } + } else if (!this.rz.effectsSequence.length && !this.ry.effectsSequence.length && !this.rx.effectsSequence.length && !this.or.effectsSequence.length) { + this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]); + this.appliedTransformations = 4; + } + } + function autoOrient() {} + function addDynamicProperty(prop) { + this._addDynamicProperty(prop); + this.elem.addDynamicProperty(prop); + this._isDirty = true; + } + function TransformProperty(elem, data, container) { + this.elem = elem; + this.frameId = -1; + this.propType = 'transform'; + this.data = data; + this.v = new Matrix(); + this.pre = new Matrix(); + this.appliedTransformations = 0; + this.initDynamicPropertyContainer(container || elem); + if (data.p && data.p.s) { + this.px = PropertyFactory.getProp(elem, data.p.x, 0, 0, this); + this.py = PropertyFactory.getProp(elem, data.p.y, 0, 0, this); + if (data.p.z) this.pz = PropertyFactory.getProp(elem, data.p.z, 0, 0, this); + } else this.p = PropertyFactory.getProp(elem, data.p || { + k: [ + 0, + 0, + 0 + ] + }, 1, 0, this); + if (data.rx) { + this.rx = PropertyFactory.getProp(elem, data.rx, 0, degToRads, this); + this.ry = PropertyFactory.getProp(elem, data.ry, 0, degToRads, this); + this.rz = PropertyFactory.getProp(elem, data.rz, 0, degToRads, this); + if (data.or.k[0].ti) { + var i; + var len = data.or.k.length; + for(i = 0; i < len; i += 1){ + data.or.k[i].to = null; + data.or.k[i].ti = null; + } + } + this.or = PropertyFactory.getProp(elem, data.or, 1, degToRads, this); + this.or.sh = true; + } else this.r = PropertyFactory.getProp(elem, data.r || { + k: 0 + }, 0, degToRads, this); + if (data.sk) { + this.sk = PropertyFactory.getProp(elem, data.sk, 0, degToRads, this); + this.sa = PropertyFactory.getProp(elem, data.sa, 0, degToRads, this); + } + this.a = PropertyFactory.getProp(elem, data.a || { + k: [ + 0, + 0, + 0 + ] + }, 1, 0, this); + this.s = PropertyFactory.getProp(elem, data.s || { + k: [ + 100, + 100, + 100 + ] + }, 1, 0.01, this); + if (data.o) this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, elem); + else this.o = { + _mdf: false, + v: 1 + }; + this._isDirty = true; + if (!this.dynamicProperties.length) this.getValue(true); + } + TransformProperty.prototype = { + applyToMatrix: applyToMatrix, + getValue: processKeys, + precalculateMatrix: precalculateMatrix, + autoOrient: autoOrient + }; + extendPrototype([ + DynamicPropertyContainer + ], TransformProperty); + TransformProperty.prototype.addDynamicProperty = addDynamicProperty; + TransformProperty.prototype._addDynamicProperty = DynamicPropertyContainer.prototype.addDynamicProperty; + function getTransformProperty(elem, data, container) { + return new TransformProperty(elem, data, container); + } + return { + getTransformProperty: getTransformProperty + }; + }(); + function RepeaterModifier() {} + extendPrototype([ + ShapeModifier + ], RepeaterModifier); + RepeaterModifier.prototype.initModifierProperties = function(elem, data) { + this.getValue = this.processKeys; + this.c = PropertyFactory.getProp(elem, data.c, 0, null, this); + this.o = PropertyFactory.getProp(elem, data.o, 0, null, this); + this.tr = TransformPropertyFactory.getTransformProperty(elem, data.tr, this); + this.so = PropertyFactory.getProp(elem, data.tr.so, 0, 0.01, this); + this.eo = PropertyFactory.getProp(elem, data.tr.eo, 0, 0.01, this); + this.data = data; + if (!this.dynamicProperties.length) this.getValue(true); + this._isAnimated = !!this.dynamicProperties.length; + this.pMatrix = new Matrix(); + this.rMatrix = new Matrix(); + this.sMatrix = new Matrix(); + this.tMatrix = new Matrix(); + this.matrix = new Matrix(); + }; + RepeaterModifier.prototype.applyTransforms = function(pMatrix, rMatrix, sMatrix, transform, perc, inv) { + var dir = inv ? -1 : 1; + var scaleX = transform.s.v[0] + (1 - transform.s.v[0]) * (1 - perc); + var scaleY = transform.s.v[1] + (1 - transform.s.v[1]) * (1 - perc); + pMatrix.translate(transform.p.v[0] * dir * perc, transform.p.v[1] * dir * perc, transform.p.v[2]); + rMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]); + rMatrix.rotate(-transform.r.v * dir * perc); + rMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]); + sMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]); + sMatrix.scale(inv ? 1 / scaleX : scaleX, inv ? 1 / scaleY : scaleY); + sMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]); + }; + RepeaterModifier.prototype.init = function(elem, arr, pos, elemsData) { + this.elem = elem; + this.arr = arr; + this.pos = pos; + this.elemsData = elemsData; + this._currentCopies = 0; + this._elements = []; + this._groups = []; + this.frameId = -1; + this.initDynamicPropertyContainer(elem); + this.initModifierProperties(elem, arr[pos]); + while(pos > 0){ + pos -= 1; + this._elements.unshift(arr[pos]); + } + if (this.dynamicProperties.length) this.k = true; + else this.getValue(true); + }; + RepeaterModifier.prototype.resetElements = function(elements) { + var i; + var len = elements.length; + for(i = 0; i < len; i += 1){ + elements[i]._processed = false; + if ('gr' === elements[i].ty) this.resetElements(elements[i].it); + } + }; + RepeaterModifier.prototype.cloneElements = function(elements) { + var newElements = JSON.parse(JSON.stringify(elements)); + this.resetElements(newElements); + return newElements; + }; + RepeaterModifier.prototype.changeGroupRender = function(elements, renderFlag) { + var i; + var len = elements.length; + for(i = 0; i < len; i += 1){ + elements[i]._render = renderFlag; + if ('gr' === elements[i].ty) this.changeGroupRender(elements[i].it, renderFlag); + } + }; + RepeaterModifier.prototype.processShapes = function(_isFirstFrame) { + var items; + var itemsTransform; + var i; + var dir; + var cont; + var hasReloaded = false; + if (this._mdf || _isFirstFrame) { + var copies = Math.ceil(this.c.v); + if (this._groups.length < copies) { + while(this._groups.length < copies){ + var group = { + it: this.cloneElements(this._elements), + ty: 'gr' + }; + group.it.push({ + a: { + a: 0, + ix: 1, + k: [ + 0, + 0 + ] + }, + nm: 'Transform', + o: { + a: 0, + ix: 7, + k: 100 + }, + p: { + a: 0, + ix: 2, + k: [ + 0, + 0 + ] + }, + r: { + a: 1, + ix: 6, + k: [ + { + s: 0, + e: 0, + t: 0 + }, + { + s: 0, + e: 0, + t: 1 + } + ] + }, + s: { + a: 0, + ix: 3, + k: [ + 100, + 100 + ] + }, + sa: { + a: 0, + ix: 5, + k: 0 + }, + sk: { + a: 0, + ix: 4, + k: 0 + }, + ty: 'tr' + }); + this.arr.splice(0, 0, group); + this._groups.splice(0, 0, group); + this._currentCopies += 1; + } + this.elem.reloadShapes(); + hasReloaded = true; + } + cont = 0; + var renderFlag; + for(i = 0; i <= this._groups.length - 1; i += 1){ + renderFlag = cont < copies; + this._groups[i]._render = renderFlag; + this.changeGroupRender(this._groups[i].it, renderFlag); + if (!renderFlag) { + var elems = this.elemsData[i].it; + var transformData = elems[elems.length - 1]; + if (0 !== transformData.transform.op.v) { + transformData.transform.op._mdf = true; + transformData.transform.op.v = 0; + } else transformData.transform.op._mdf = false; + } + cont += 1; + } + this._currentCopies = copies; + var offset = this.o.v; + var offsetModulo = offset % 1; + var roundOffset = offset > 0 ? Math.floor(offset) : Math.ceil(offset); + var pProps = this.pMatrix.props; + var rProps = this.rMatrix.props; + var sProps = this.sMatrix.props; + this.pMatrix.reset(); + this.rMatrix.reset(); + this.sMatrix.reset(); + this.tMatrix.reset(); + this.matrix.reset(); + var iteration = 0; + if (offset > 0) { + while(iteration < roundOffset){ + this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false); + iteration += 1; + } + if (offsetModulo) { + this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, offsetModulo, false); + iteration += offsetModulo; + } + } else if (offset < 0) { + while(iteration > roundOffset){ + this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, true); + iteration -= 1; + } + if (offsetModulo) { + this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, -offsetModulo, true); + iteration -= offsetModulo; + } + } + i = 1 === this.data.m ? 0 : this._currentCopies - 1; + dir = 1 === this.data.m ? 1 : -1; + cont = this._currentCopies; + var j; + var jLen; + while(cont){ + items = this.elemsData[i].it; + itemsTransform = items[items.length - 1].transform.mProps.v.props; + jLen = itemsTransform.length; + items[items.length - 1].transform.mProps._mdf = true; + items[items.length - 1].transform.op._mdf = true; + items[items.length - 1].transform.op.v = 1 === this._currentCopies ? this.so.v : this.so.v + (this.eo.v - this.so.v) * (i / (this._currentCopies - 1)); + if (0 !== iteration) { + if (0 !== i && 1 === dir || i !== this._currentCopies - 1 && -1 === dir) this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false); + this.matrix.transform(rProps[0], rProps[1], rProps[2], rProps[3], rProps[4], rProps[5], rProps[6], rProps[7], rProps[8], rProps[9], rProps[10], rProps[11], rProps[12], rProps[13], rProps[14], rProps[15]); + this.matrix.transform(sProps[0], sProps[1], sProps[2], sProps[3], sProps[4], sProps[5], sProps[6], sProps[7], sProps[8], sProps[9], sProps[10], sProps[11], sProps[12], sProps[13], sProps[14], sProps[15]); + this.matrix.transform(pProps[0], pProps[1], pProps[2], pProps[3], pProps[4], pProps[5], pProps[6], pProps[7], pProps[8], pProps[9], pProps[10], pProps[11], pProps[12], pProps[13], pProps[14], pProps[15]); + for(j = 0; j < jLen; j += 1)itemsTransform[j] = this.matrix.props[j]; + this.matrix.reset(); + } else { + this.matrix.reset(); + for(j = 0; j < jLen; j += 1)itemsTransform[j] = this.matrix.props[j]; + } + iteration += 1; + cont -= 1; + i += dir; + } + } else { + cont = this._currentCopies; + i = 0; + dir = 1; + while(cont){ + items = this.elemsData[i].it; + itemsTransform = items[items.length - 1].transform.mProps.v.props; + items[items.length - 1].transform.mProps._mdf = false; + items[items.length - 1].transform.op._mdf = false; + cont -= 1; + i += dir; + } + } + return hasReloaded; + }; + RepeaterModifier.prototype.addShape = function() {}; + function RoundCornersModifier() {} + extendPrototype([ + ShapeModifier + ], RoundCornersModifier); + RoundCornersModifier.prototype.initModifierProperties = function(elem, data) { + this.getValue = this.processKeys; + this.rd = PropertyFactory.getProp(elem, data.r, 0, null, this); + this._isAnimated = !!this.rd.effectsSequence.length; + }; + RoundCornersModifier.prototype.processPath = function(path, round) { + var clonedPath = shapePool.newElement(); + clonedPath.c = path.c; + var i; + var len = path._length; + var currentV; + var currentI; + var currentO; + var closerV; + var distance; + var newPosPerc; + var index = 0; + var vX; + var vY; + var oX; + var oY; + var iX; + var iY; + for(i = 0; i < len; i += 1){ + currentV = path.v[i]; + currentO = path.o[i]; + currentI = path.i[i]; + if (currentV[0] === currentO[0] && currentV[1] === currentO[1] && currentV[0] === currentI[0] && currentV[1] === currentI[1]) if (0 !== i && i !== len - 1 || path.c) { + closerV = 0 === i ? path.v[len - 1] : path.v[i - 1]; + distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2)); + newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0; + iX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc; + vX = iX; + iY = currentV[1] - (currentV[1] - closerV[1]) * newPosPerc; + vY = iY; + oX = vX - (vX - currentV[0]) * roundCorner; + oY = vY - (vY - currentV[1]) * roundCorner; + clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, index); + index += 1; + closerV = i === len - 1 ? path.v[0] : path.v[i + 1]; + distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2)); + newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0; + oX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc; + vX = oX; + oY = currentV[1] + (closerV[1] - currentV[1]) * newPosPerc; + vY = oY; + iX = vX - (vX - currentV[0]) * roundCorner; + iY = vY - (vY - currentV[1]) * roundCorner; + clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, index); + index += 1; + } else { + clonedPath.setTripleAt(currentV[0], currentV[1], currentO[0], currentO[1], currentI[0], currentI[1], index); + index += 1; + } + else { + clonedPath.setTripleAt(path.v[i][0], path.v[i][1], path.o[i][0], path.o[i][1], path.i[i][0], path.i[i][1], index); + index += 1; + } + } + return clonedPath; + }; + RoundCornersModifier.prototype.processShapes = function(_isFirstFrame) { + var shapePaths; + var i; + var len = this.shapes.length; + var j; + var jLen; + var rd = this.rd.v; + if (0 !== rd) { + var shapeData; + var localShapeCollection; + for(i = 0; i < len; i += 1){ + shapeData = this.shapes[i]; + localShapeCollection = shapeData.localShapeCollection; + if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) { + localShapeCollection.releaseShapes(); + shapeData.shape._mdf = true; + shapePaths = shapeData.shape.paths.shapes; + jLen = shapeData.shape.paths._length; + for(j = 0; j < jLen; j += 1)localShapeCollection.addShape(this.processPath(shapePaths[j], rd)); + } + shapeData.shape.paths = shapeData.localShapeCollection; + } + } + if (!this.dynamicProperties.length) this._mdf = false; + }; + function floatEqual(a, b) { + return 100000 * Math.abs(a - b) <= Math.min(Math.abs(a), Math.abs(b)); + } + function floatZero(f) { + return Math.abs(f) <= 0.00001; + } + function lerp(p0, p1, amount) { + return p0 * (1 - amount) + p1 * amount; + } + function lerpPoint(p0, p1, amount) { + return [ + lerp(p0[0], p1[0], amount), + lerp(p0[1], p1[1], amount) + ]; + } + function quadRoots(a, b, c) { + if (0 === a) return []; + var s = b * b - 4 * a * c; + if (s < 0) return []; + var singleRoot = -b / (2 * a); + if (0 === s) return [ + singleRoot + ]; + var delta = Math.sqrt(s) / (2 * a); + return [ + singleRoot - delta, + singleRoot + delta + ]; + } + function polynomialCoefficients(p0, p1, p2, p3) { + return [ + -p0 + 3 * p1 - 3 * p2 + p3, + 3 * p0 - 6 * p1 + 3 * p2, + -3 * p0 + 3 * p1, + p0 + ]; + } + function singlePoint(p) { + return new PolynomialBezier(p, p, p, p, false); + } + function PolynomialBezier(p0, p1, p2, p3, linearize) { + if (linearize && pointEqual(p0, p1)) p1 = lerpPoint(p0, p3, 1 / 3); + if (linearize && pointEqual(p2, p3)) p2 = lerpPoint(p0, p3, 2 / 3); + var coeffx = polynomialCoefficients(p0[0], p1[0], p2[0], p3[0]); + var coeffy = polynomialCoefficients(p0[1], p1[1], p2[1], p3[1]); + this.a = [ + coeffx[0], + coeffy[0] + ]; + this.b = [ + coeffx[1], + coeffy[1] + ]; + this.c = [ + coeffx[2], + coeffy[2] + ]; + this.d = [ + coeffx[3], + coeffy[3] + ]; + this.points = [ + p0, + p1, + p2, + p3 + ]; + } + PolynomialBezier.prototype.point = function(t) { + return [ + ((this.a[0] * t + this.b[0]) * t + this.c[0]) * t + this.d[0], + ((this.a[1] * t + this.b[1]) * t + this.c[1]) * t + this.d[1] + ]; + }; + PolynomialBezier.prototype.derivative = function(t) { + return [ + (3 * t * this.a[0] + 2 * this.b[0]) * t + this.c[0], + (3 * t * this.a[1] + 2 * this.b[1]) * t + this.c[1] + ]; + }; + PolynomialBezier.prototype.tangentAngle = function(t) { + var p = this.derivative(t); + return Math.atan2(p[1], p[0]); + }; + PolynomialBezier.prototype.normalAngle = function(t) { + var p = this.derivative(t); + return Math.atan2(p[0], p[1]); + }; + PolynomialBezier.prototype.inflectionPoints = function() { + var denom = this.a[1] * this.b[0] - this.a[0] * this.b[1]; + if (floatZero(denom)) return []; + var tcusp = -0.5 * (this.a[1] * this.c[0] - this.a[0] * this.c[1]) / denom; + var square = tcusp * tcusp - 1 / 3 * (this.b[1] * this.c[0] - this.b[0] * this.c[1]) / denom; + if (square < 0) return []; + var root = Math.sqrt(square); + if (floatZero(root)) { + if (root > 0 && root < 1) return [ + tcusp + ]; + return []; + } + return [ + tcusp - root, + tcusp + root + ].filter(function(r) { + return r > 0 && r < 1; + }); + }; + PolynomialBezier.prototype.split = function(t) { + if (t <= 0) return [ + singlePoint(this.points[0]), + this + ]; + if (t >= 1) return [ + this, + singlePoint(this.points[this.points.length - 1]) + ]; + var p10 = lerpPoint(this.points[0], this.points[1], t); + var p11 = lerpPoint(this.points[1], this.points[2], t); + var p12 = lerpPoint(this.points[2], this.points[3], t); + var p20 = lerpPoint(p10, p11, t); + var p21 = lerpPoint(p11, p12, t); + var p3 = lerpPoint(p20, p21, t); + return [ + new PolynomialBezier(this.points[0], p10, p20, p3, true), + new PolynomialBezier(p3, p21, p12, this.points[3], true) + ]; + }; + function extrema(bez, comp) { + var min = bez.points[0][comp]; + var max = bez.points[bez.points.length - 1][comp]; + if (min > max) { + var e = max; + max = min; + min = e; + } + var f = quadRoots(3 * bez.a[comp], 2 * bez.b[comp], bez.c[comp]); + for(var i = 0; i < f.length; i += 1)if (f[i] > 0 && f[i] < 1) { + var val = bez.point(f[i])[comp]; + if (val < min) min = val; + else if (val > max) max = val; + } + return { + min: min, + max: max + }; + } + PolynomialBezier.prototype.bounds = function() { + return { + x: extrema(this, 0), + y: extrema(this, 1) + }; + }; + PolynomialBezier.prototype.boundingBox = function() { + var bounds = this.bounds(); + return { + left: bounds.x.min, + right: bounds.x.max, + top: bounds.y.min, + bottom: bounds.y.max, + width: bounds.x.max - bounds.x.min, + height: bounds.y.max - bounds.y.min, + cx: (bounds.x.max + bounds.x.min) / 2, + cy: (bounds.y.max + bounds.y.min) / 2 + }; + }; + function intersectData(bez, t1, t2) { + var box = bez.boundingBox(); + return { + cx: box.cx, + cy: box.cy, + width: box.width, + height: box.height, + bez: bez, + t: (t1 + t2) / 2, + t1: t1, + t2: t2 + }; + } + function splitData(data) { + var split = data.bez.split(0.5); + return [ + intersectData(split[0], data.t1, data.t), + intersectData(split[1], data.t, data.t2) + ]; + } + function boxIntersect(b1, b2) { + return 2 * Math.abs(b1.cx - b2.cx) < b1.width + b2.width && 2 * Math.abs(b1.cy - b2.cy) < b1.height + b2.height; + } + function intersectsImpl(d1, d2, depth, tolerance, intersections, maxRecursion) { + if (!boxIntersect(d1, d2)) return; + if (depth >= maxRecursion || d1.width <= tolerance && d1.height <= tolerance && d2.width <= tolerance && d2.height <= tolerance) return void intersections.push([ + d1.t, + d2.t + ]); + var d1s = splitData(d1); + var d2s = splitData(d2); + intersectsImpl(d1s[0], d2s[0], depth + 1, tolerance, intersections, maxRecursion); + intersectsImpl(d1s[0], d2s[1], depth + 1, tolerance, intersections, maxRecursion); + intersectsImpl(d1s[1], d2s[0], depth + 1, tolerance, intersections, maxRecursion); + intersectsImpl(d1s[1], d2s[1], depth + 1, tolerance, intersections, maxRecursion); + } + PolynomialBezier.prototype.intersections = function(other, tolerance, maxRecursion) { + if (void 0 === tolerance) tolerance = 2; + if (void 0 === maxRecursion) maxRecursion = 7; + var intersections = []; + intersectsImpl(intersectData(this, 0, 1), intersectData(other, 0, 1), 0, tolerance, intersections, maxRecursion); + return intersections; + }; + PolynomialBezier.shapeSegment = function(shapePath, index) { + var nextIndex = (index + 1) % shapePath.length(); + return new PolynomialBezier(shapePath.v[index], shapePath.o[index], shapePath.i[nextIndex], shapePath.v[nextIndex], true); + }; + PolynomialBezier.shapeSegmentInverted = function(shapePath, index) { + var nextIndex = (index + 1) % shapePath.length(); + return new PolynomialBezier(shapePath.v[nextIndex], shapePath.i[nextIndex], shapePath.o[index], shapePath.v[index], true); + }; + function crossProduct(a, b) { + return [ + a[1] * b[2] - a[2] * b[1], + a[2] * b[0] - a[0] * b[2], + a[0] * b[1] - a[1] * b[0] + ]; + } + function lineIntersection(start1, end1, start2, end2) { + var v1 = [ + start1[0], + start1[1], + 1 + ]; + var v2 = [ + end1[0], + end1[1], + 1 + ]; + var v3 = [ + start2[0], + start2[1], + 1 + ]; + var v4 = [ + end2[0], + end2[1], + 1 + ]; + var r = crossProduct(crossProduct(v1, v2), crossProduct(v3, v4)); + if (floatZero(r[2])) return null; + return [ + r[0] / r[2], + r[1] / r[2] + ]; + } + function polarOffset(p, angle, length) { + return [ + p[0] + Math.cos(angle) * length, + p[1] - Math.sin(angle) * length + ]; + } + function pointDistance(p1, p2) { + return Math.hypot(p1[0] - p2[0], p1[1] - p2[1]); + } + function pointEqual(p1, p2) { + return floatEqual(p1[0], p2[0]) && floatEqual(p1[1], p2[1]); + } + function ZigZagModifier() {} + extendPrototype([ + ShapeModifier + ], ZigZagModifier); + ZigZagModifier.prototype.initModifierProperties = function(elem, data) { + this.getValue = this.processKeys; + this.amplitude = PropertyFactory.getProp(elem, data.s, 0, null, this); + this.frequency = PropertyFactory.getProp(elem, data.r, 0, null, this); + this.pointsType = PropertyFactory.getProp(elem, data.pt, 0, null, this); + this._isAnimated = 0 !== this.amplitude.effectsSequence.length || 0 !== this.frequency.effectsSequence.length || 0 !== this.pointsType.effectsSequence.length; + }; + function setPoint(outputBezier, point, angle, direction, amplitude, outAmplitude, inAmplitude) { + var angO = angle - Math.PI / 2; + var angI = angle + Math.PI / 2; + var px = point[0] + Math.cos(angle) * direction * amplitude; + var py = point[1] - Math.sin(angle) * direction * amplitude; + outputBezier.setTripleAt(px, py, px + Math.cos(angO) * outAmplitude, py - Math.sin(angO) * outAmplitude, px + Math.cos(angI) * inAmplitude, py - Math.sin(angI) * inAmplitude, outputBezier.length()); + } + function getPerpendicularVector(pt1, pt2) { + var vector = [ + pt2[0] - pt1[0], + pt2[1] - pt1[1] + ]; + var rot = 0.5 * -Math.PI; + var rotatedVector = [ + Math.cos(rot) * vector[0] - Math.sin(rot) * vector[1], + Math.sin(rot) * vector[0] + Math.cos(rot) * vector[1] + ]; + return rotatedVector; + } + function getProjectingAngle(path, cur) { + var prevIndex = 0 === cur ? path.length() - 1 : cur - 1; + var nextIndex = (cur + 1) % path.length(); + var prevPoint = path.v[prevIndex]; + var nextPoint = path.v[nextIndex]; + var pVector = getPerpendicularVector(prevPoint, nextPoint); + return Math.atan2(0, 1) - Math.atan2(pVector[1], pVector[0]); + } + function zigZagCorner(outputBezier, path, cur, amplitude, frequency, pointType, direction) { + var angle = getProjectingAngle(path, cur); + var point = path.v[cur % path._length]; + var prevPoint = path.v[0 === cur ? path._length - 1 : cur - 1]; + var nextPoint = path.v[(cur + 1) % path._length]; + var prevDist = 2 === pointType ? Math.sqrt(Math.pow(point[0] - prevPoint[0], 2) + Math.pow(point[1] - prevPoint[1], 2)) : 0; + var nextDist = 2 === pointType ? Math.sqrt(Math.pow(point[0] - nextPoint[0], 2) + Math.pow(point[1] - nextPoint[1], 2)) : 0; + setPoint(outputBezier, path.v[cur % path._length], angle, direction, amplitude, nextDist / ((frequency + 1) * 2), prevDist / ((frequency + 1) * 2), pointType); + } + function zigZagSegment(outputBezier, segment, amplitude, frequency, pointType, direction) { + for(var i = 0; i < frequency; i += 1){ + var t = (i + 1) / (frequency + 1); + var dist = 2 === pointType ? Math.sqrt(Math.pow(segment.points[3][0] - segment.points[0][0], 2) + Math.pow(segment.points[3][1] - segment.points[0][1], 2)) : 0; + var angle = segment.normalAngle(t); + var point = segment.point(t); + setPoint(outputBezier, point, angle, direction, amplitude, dist / ((frequency + 1) * 2), dist / ((frequency + 1) * 2), pointType); + direction = -direction; + } + return direction; + } + ZigZagModifier.prototype.processPath = function(path, amplitude, frequency, pointType) { + var count = path._length; + var clonedPath = shapePool.newElement(); + clonedPath.c = path.c; + if (!path.c) count -= 1; + if (0 === count) return clonedPath; + var direction = -1; + var segment = PolynomialBezier.shapeSegment(path, 0); + zigZagCorner(clonedPath, path, 0, amplitude, frequency, pointType, direction); + for(var i = 0; i < count; i += 1){ + direction = zigZagSegment(clonedPath, segment, amplitude, frequency, pointType, -direction); + segment = i !== count - 1 || path.c ? PolynomialBezier.shapeSegment(path, (i + 1) % count) : null; + zigZagCorner(clonedPath, path, i + 1, amplitude, frequency, pointType, direction); + } + return clonedPath; + }; + ZigZagModifier.prototype.processShapes = function(_isFirstFrame) { + var shapePaths; + var i; + var len = this.shapes.length; + var j; + var jLen; + var amplitude = this.amplitude.v; + var frequency = Math.max(0, Math.round(this.frequency.v)); + var pointType = this.pointsType.v; + if (0 !== amplitude) { + var shapeData; + var localShapeCollection; + for(i = 0; i < len; i += 1){ + shapeData = this.shapes[i]; + localShapeCollection = shapeData.localShapeCollection; + if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) { + localShapeCollection.releaseShapes(); + shapeData.shape._mdf = true; + shapePaths = shapeData.shape.paths.shapes; + jLen = shapeData.shape.paths._length; + for(j = 0; j < jLen; j += 1)localShapeCollection.addShape(this.processPath(shapePaths[j], amplitude, frequency, pointType)); + } + shapeData.shape.paths = shapeData.localShapeCollection; + } + } + if (!this.dynamicProperties.length) this._mdf = false; + }; + function linearOffset(p1, p2, amount) { + var angle = Math.atan2(p2[0] - p1[0], p2[1] - p1[1]); + return [ + polarOffset(p1, angle, amount), + polarOffset(p2, angle, amount) + ]; + } + function offsetSegment(segment, amount) { + var p0; + var p1a; + var p1b; + var p2b; + var p2a; + var p3; + var e; + e = linearOffset(segment.points[0], segment.points[1], amount); + p0 = e[0]; + p1a = e[1]; + e = linearOffset(segment.points[1], segment.points[2], amount); + p1b = e[0]; + p2b = e[1]; + e = linearOffset(segment.points[2], segment.points[3], amount); + p2a = e[0]; + p3 = e[1]; + var p1 = lineIntersection(p0, p1a, p1b, p2b); + if (null === p1) p1 = p1a; + var p2 = lineIntersection(p2a, p3, p1b, p2b); + if (null === p2) p2 = p2a; + return new PolynomialBezier(p0, p1, p2, p3); + } + function joinLines(outputBezier, seg1, seg2, lineJoin, miterLimit) { + var p0 = seg1.points[3]; + var p1 = seg2.points[0]; + if (3 === lineJoin) return p0; + if (pointEqual(p0, p1)) return p0; + if (2 === lineJoin) { + var angleOut = -seg1.tangentAngle(1); + var angleIn = -seg2.tangentAngle(0) + Math.PI; + var center = lineIntersection(p0, polarOffset(p0, angleOut + Math.PI / 2, 100), p1, polarOffset(p1, angleOut + Math.PI / 2, 100)); + var radius = center ? pointDistance(center, p0) : pointDistance(p0, p1) / 2; + var tan = polarOffset(p0, angleOut, 2 * radius * roundCorner); + outputBezier.setXYAt(tan[0], tan[1], 'o', outputBezier.length() - 1); + tan = polarOffset(p1, angleIn, 2 * radius * roundCorner); + outputBezier.setTripleAt(p1[0], p1[1], p1[0], p1[1], tan[0], tan[1], outputBezier.length()); + return p1; + } + var t0 = pointEqual(p0, seg1.points[2]) ? seg1.points[0] : seg1.points[2]; + var t1 = pointEqual(p1, seg2.points[1]) ? seg2.points[3] : seg2.points[1]; + var intersection = lineIntersection(t0, p0, p1, t1); + if (intersection && pointDistance(intersection, p0) < miterLimit) { + outputBezier.setTripleAt(intersection[0], intersection[1], intersection[0], intersection[1], intersection[0], intersection[1], outputBezier.length()); + return intersection; + } + return p0; + } + function getIntersection(a, b) { + var intersect = a.intersections(b); + if (intersect.length && floatEqual(intersect[0][0], 1)) intersect.shift(); + if (intersect.length) return intersect[0]; + return null; + } + function pruneSegmentIntersection(a, b) { + var outa = a.slice(); + var outb = b.slice(); + var intersect = getIntersection(a[a.length - 1], b[0]); + if (intersect) { + outa[a.length - 1] = a[a.length - 1].split(intersect[0])[0]; + outb[0] = b[0].split(intersect[1])[1]; + } + if (a.length > 1 && b.length > 1) { + intersect = getIntersection(a[0], b[b.length - 1]); + if (intersect) return [ + [ + a[0].split(intersect[0])[0] + ], + [ + b[b.length - 1].split(intersect[1])[1] + ] + ]; + } + return [ + outa, + outb + ]; + } + function pruneIntersections(segments) { + var e; + for(var i = 1; i < segments.length; i += 1){ + e = pruneSegmentIntersection(segments[i - 1], segments[i]); + segments[i - 1] = e[0]; + segments[i] = e[1]; + } + if (segments.length > 1) { + e = pruneSegmentIntersection(segments[segments.length - 1], segments[0]); + segments[segments.length - 1] = e[0]; + segments[0] = e[1]; + } + return segments; + } + function offsetSegmentSplit(segment, amount) { + var flex = segment.inflectionPoints(); + var left; + var right; + var split; + var mid; + if (0 === flex.length) return [ + offsetSegment(segment, amount) + ]; + if (1 === flex.length || floatEqual(flex[1], 1)) { + split = segment.split(flex[0]); + left = split[0]; + right = split[1]; + return [ + offsetSegment(left, amount), + offsetSegment(right, amount) + ]; + } + split = segment.split(flex[0]); + left = split[0]; + var t = (flex[1] - flex[0]) / (1 - flex[0]); + split = split[1].split(t); + mid = split[0]; + right = split[1]; + return [ + offsetSegment(left, amount), + offsetSegment(mid, amount), + offsetSegment(right, amount) + ]; + } + function OffsetPathModifier() {} + extendPrototype([ + ShapeModifier + ], OffsetPathModifier); + OffsetPathModifier.prototype.initModifierProperties = function(elem, data) { + this.getValue = this.processKeys; + this.amount = PropertyFactory.getProp(elem, data.a, 0, null, this); + this.miterLimit = PropertyFactory.getProp(elem, data.ml, 0, null, this); + this.lineJoin = data.lj; + this._isAnimated = 0 !== this.amount.effectsSequence.length; + }; + OffsetPathModifier.prototype.processPath = function(inputBezier, amount, lineJoin, miterLimit) { + var outputBezier = shapePool.newElement(); + outputBezier.c = inputBezier.c; + var count = inputBezier.length(); + if (!inputBezier.c) count -= 1; + var i; + var j; + var segment; + var multiSegments = []; + for(i = 0; i < count; i += 1){ + segment = PolynomialBezier.shapeSegment(inputBezier, i); + multiSegments.push(offsetSegmentSplit(segment, amount)); + } + if (!inputBezier.c) for(i = count - 1; i >= 0; i -= 1){ + segment = PolynomialBezier.shapeSegmentInverted(inputBezier, i); + multiSegments.push(offsetSegmentSplit(segment, amount)); + } + multiSegments = pruneIntersections(multiSegments); + var lastPoint = null; + var lastSeg = null; + for(i = 0; i < multiSegments.length; i += 1){ + var multiSegment = multiSegments[i]; + if (lastSeg) lastPoint = joinLines(outputBezier, lastSeg, multiSegment[0], lineJoin, miterLimit); + lastSeg = multiSegment[multiSegment.length - 1]; + for(j = 0; j < multiSegment.length; j += 1){ + segment = multiSegment[j]; + if (lastPoint && pointEqual(segment.points[0], lastPoint)) outputBezier.setXYAt(segment.points[1][0], segment.points[1][1], 'o', outputBezier.length() - 1); + else outputBezier.setTripleAt(segment.points[0][0], segment.points[0][1], segment.points[1][0], segment.points[1][1], segment.points[0][0], segment.points[0][1], outputBezier.length()); + outputBezier.setTripleAt(segment.points[3][0], segment.points[3][1], segment.points[3][0], segment.points[3][1], segment.points[2][0], segment.points[2][1], outputBezier.length()); + lastPoint = segment.points[3]; + } + } + if (multiSegments.length) joinLines(outputBezier, lastSeg, multiSegments[0][0], lineJoin, miterLimit); + return outputBezier; + }; + OffsetPathModifier.prototype.processShapes = function(_isFirstFrame) { + var shapePaths; + var i; + var len = this.shapes.length; + var j; + var jLen; + var amount = this.amount.v; + var miterLimit = this.miterLimit.v; + var lineJoin = this.lineJoin; + if (0 !== amount) { + var shapeData; + var localShapeCollection; + for(i = 0; i < len; i += 1){ + shapeData = this.shapes[i]; + localShapeCollection = shapeData.localShapeCollection; + if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) { + localShapeCollection.releaseShapes(); + shapeData.shape._mdf = true; + shapePaths = shapeData.shape.paths.shapes; + jLen = shapeData.shape.paths._length; + for(j = 0; j < jLen; j += 1)localShapeCollection.addShape(this.processPath(shapePaths[j], amount, lineJoin, miterLimit)); + } + shapeData.shape.paths = shapeData.localShapeCollection; + } + } + if (!this.dynamicProperties.length) this._mdf = false; + }; + function getFontProperties(fontData) { + var styles = fontData.fStyle ? fontData.fStyle.split(' ') : []; + var fWeight = 'normal'; + var fStyle = 'normal'; + var len = styles.length; + var styleName; + for(var i = 0; i < len; i += 1){ + styleName = styles[i].toLowerCase(); + switch(styleName){ + case 'italic': + fStyle = 'italic'; + break; + case 'bold': + fWeight = '700'; + break; + case 'black': + fWeight = '900'; + break; + case 'medium': + fWeight = '500'; + break; + case 'regular': + case 'normal': + fWeight = '400'; + break; + case 'light': + case 'thin': + fWeight = '200'; + break; + default: + break; + } + } + return { + style: fStyle, + weight: fontData.fWeight || fWeight + }; + } + var FontManager = function() { + var maxWaitingTime = 5000; + var emptyChar = { + w: 0, + size: 0, + shapes: [], + data: { + shapes: [] + } + }; + var combinedCharacters = []; + combinedCharacters = combinedCharacters.concat([ + 2304, + 2305, + 2306, + 2307, + 2362, + 2363, + 2364, + 2364, + 2366, + 2367, + 2368, + 2369, + 2370, + 2371, + 2372, + 2373, + 2374, + 2375, + 2376, + 2377, + 2378, + 2379, + 2380, + 2381, + 2382, + 2383, + 2387, + 2388, + 2389, + 2390, + 2391, + 2402, + 2403 + ]); + var BLACK_FLAG_CODE_POINT = 127988; + var CANCEL_TAG_CODE_POINT = 917631; + var A_TAG_CODE_POINT = 917601; + var Z_TAG_CODE_POINT = 917626; + var VARIATION_SELECTOR_16_CODE_POINT = 65039; + var ZERO_WIDTH_JOINER_CODE_POINT = 8205; + var REGIONAL_CHARACTER_A_CODE_POINT = 127462; + var REGIONAL_CHARACTER_Z_CODE_POINT = 127487; + var surrogateModifiers = [ + 'd83cdffb', + 'd83cdffc', + 'd83cdffd', + 'd83cdffe', + 'd83cdfff' + ]; + function trimFontOptions(font) { + var familyArray = font.split(','); + var i; + var len = familyArray.length; + var enabledFamilies = []; + for(i = 0; i < len; i += 1)if ('sans-serif' !== familyArray[i] && 'monospace' !== familyArray[i]) enabledFamilies.push(familyArray[i]); + return enabledFamilies.join(','); + } + function setUpNode(font, family) { + var parentNode = createTag('span'); + parentNode.setAttribute('aria-hidden', true); + parentNode.style.fontFamily = family; + var node = createTag('span'); + node.innerText = 'giItT1WQy@!-/#'; + parentNode.style.position = 'absolute'; + parentNode.style.left = '-10000px'; + parentNode.style.top = '-10000px'; + parentNode.style.fontSize = '300px'; + parentNode.style.fontVariant = 'normal'; + parentNode.style.fontStyle = 'normal'; + parentNode.style.fontWeight = 'normal'; + parentNode.style.letterSpacing = '0'; + parentNode.appendChild(node); + document.body.appendChild(parentNode); + var width = node.offsetWidth; + node.style.fontFamily = trimFontOptions(font) + ', ' + family; + return { + node: node, + w: width, + parent: parentNode + }; + } + function checkLoadedFonts() { + var i; + var len = this.fonts.length; + var node; + var w; + var loadedCount = len; + for(i = 0; i < len; i += 1)if (this.fonts[i].loaded) loadedCount -= 1; + else if ('n' === this.fonts[i].fOrigin || 0 === this.fonts[i].origin) this.fonts[i].loaded = true; + else { + node = this.fonts[i].monoCase.node; + w = this.fonts[i].monoCase.w; + if (node.offsetWidth !== w) { + loadedCount -= 1; + this.fonts[i].loaded = true; + } else { + node = this.fonts[i].sansCase.node; + w = this.fonts[i].sansCase.w; + if (node.offsetWidth !== w) { + loadedCount -= 1; + this.fonts[i].loaded = true; + } + } + if (this.fonts[i].loaded) { + this.fonts[i].sansCase.parent.parentNode.removeChild(this.fonts[i].sansCase.parent); + this.fonts[i].monoCase.parent.parentNode.removeChild(this.fonts[i].monoCase.parent); + } + } + 0 !== loadedCount && Date.now() - this.initTime < maxWaitingTime ? setTimeout(this.checkLoadedFontsBinded, 20) : setTimeout(this.setIsLoadedBinded, 10); + } + function createHelper(fontData, def) { + var engine = document.body && def ? 'svg' : 'canvas'; + var helper; + var fontProps = getFontProperties(fontData); + if ('svg' === engine) { + var tHelper = createNS('text'); + tHelper.style.fontSize = '100px'; + tHelper.setAttribute('font-family', fontData.fFamily); + tHelper.setAttribute('font-style', fontProps.style); + tHelper.setAttribute('font-weight', fontProps.weight); + tHelper.textContent = '1'; + if (fontData.fClass) { + tHelper.style.fontFamily = 'inherit'; + tHelper.setAttribute('class', fontData.fClass); + } else tHelper.style.fontFamily = fontData.fFamily; + def.appendChild(tHelper); + helper = tHelper; + } else { + var tCanvasHelper = new OffscreenCanvas(500, 500).getContext('2d'); + tCanvasHelper.font = fontProps.style + ' ' + fontProps.weight + ' 100px ' + fontData.fFamily; + helper = tCanvasHelper; + } + function measure(text) { + if ('svg' === engine) { + helper.textContent = text; + return helper.getComputedTextLength(); + } + return helper.measureText(text).width; + } + return { + measureText: measure + }; + } + function addFonts(fontData, defs) { + if (!fontData) { + this.isLoaded = true; + return; + } + if (this.chars) { + this.isLoaded = true; + this.fonts = fontData.list; + return; + } + if (!document.body) { + this.isLoaded = true; + fontData.list.forEach(function(data) { + data.helper = createHelper(data); + data.cache = {}; + }); + this.fonts = fontData.list; + return; + } + var fontArr = fontData.list; + var i; + var len = fontArr.length; + var _pendingFonts = len; + for(i = 0; i < len; i += 1){ + var shouldLoadFont = true; + var loadedSelector; + var j; + fontArr[i].loaded = false; + fontArr[i].monoCase = setUpNode(fontArr[i].fFamily, 'monospace'); + fontArr[i].sansCase = setUpNode(fontArr[i].fFamily, 'sans-serif'); + if (fontArr[i].fPath) { + if ('p' === fontArr[i].fOrigin || 3 === fontArr[i].origin) { + loadedSelector = document.querySelectorAll('style[f-forigin="p"][f-family="' + fontArr[i].fFamily + '"], style[f-origin="3"][f-family="' + fontArr[i].fFamily + '"]'); + if (loadedSelector.length > 0) shouldLoadFont = false; + if (shouldLoadFont) { + var s = createTag('style'); + s.setAttribute('f-forigin', fontArr[i].fOrigin); + s.setAttribute('f-origin', fontArr[i].origin); + s.setAttribute('f-family', fontArr[i].fFamily); + s.type = 'text/css'; + s.innerText = '@font-face {font-family: ' + fontArr[i].fFamily + "; font-style: normal; src: url('" + fontArr[i].fPath + "');}"; + defs.appendChild(s); + } + } else if ('g' === fontArr[i].fOrigin || 1 === fontArr[i].origin) { + loadedSelector = document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'); + for(j = 0; j < loadedSelector.length; j += 1)if (-1 !== loadedSelector[j].href.indexOf(fontArr[i].fPath)) shouldLoadFont = false; + if (shouldLoadFont) { + var l = createTag('link'); + l.setAttribute('f-forigin', fontArr[i].fOrigin); + l.setAttribute('f-origin', fontArr[i].origin); + l.type = 'text/css'; + l.rel = 'stylesheet'; + l.href = fontArr[i].fPath; + document.body.appendChild(l); + } + } else if ('t' === fontArr[i].fOrigin || 2 === fontArr[i].origin) { + loadedSelector = document.querySelectorAll('script[f-forigin="t"], script[f-origin="2"]'); + for(j = 0; j < loadedSelector.length; j += 1)if (fontArr[i].fPath === loadedSelector[j].src) shouldLoadFont = false; + if (shouldLoadFont) { + var sc = createTag('link'); + sc.setAttribute('f-forigin', fontArr[i].fOrigin); + sc.setAttribute('f-origin', fontArr[i].origin); + sc.setAttribute('rel', 'stylesheet'); + sc.setAttribute('href', fontArr[i].fPath); + defs.appendChild(sc); + } + } + } else { + fontArr[i].loaded = true; + _pendingFonts -= 1; + } + fontArr[i].helper = createHelper(fontArr[i], defs); + fontArr[i].cache = {}; + this.fonts.push(fontArr[i]); + } + if (0 === _pendingFonts) this.isLoaded = true; + else setTimeout(this.checkLoadedFonts.bind(this), 100); + } + function addChars(chars) { + if (!chars) return; + if (!this.chars) this.chars = []; + var i; + var len = chars.length; + var j; + var jLen = this.chars.length; + var found; + for(i = 0; i < len; i += 1){ + j = 0; + found = false; + while(j < jLen){ + if (this.chars[j].style === chars[i].style && this.chars[j].fFamily === chars[i].fFamily && this.chars[j].ch === chars[i].ch) found = true; + j += 1; + } + if (!found) { + this.chars.push(chars[i]); + jLen += 1; + } + } + } + function getCharData(_char, style, font) { + var i = 0; + var len = this.chars.length; + while(i < len){ + if (this.chars[i].ch === _char && this.chars[i].style === style && this.chars[i].fFamily === font) return this.chars[i]; + i += 1; + } + if (('string' == typeof _char && 13 !== _char.charCodeAt(0) || !_char) && console && console.warn && !this._warned) { + this._warned = true; + console.warn('Missing character from exported characters list: ', _char, style, font); + } + return emptyChar; + } + function measureText(_char2, fontName, size) { + var fontData = this.getFontByName(fontName); + var index = _char2; + if (!fontData.cache[index]) { + var tHelper = fontData.helper; + if (' ' === _char2) { + var doubleSize = tHelper.measureText('|' + _char2 + '|'); + var singleSize = tHelper.measureText('||'); + fontData.cache[index] = (doubleSize - singleSize) / 100; + } else fontData.cache[index] = tHelper.measureText(_char2) / 100; + } + return fontData.cache[index] * size; + } + function getFontByName(name) { + var i = 0; + var len = this.fonts.length; + while(i < len){ + if (this.fonts[i].fName === name) return this.fonts[i]; + i += 1; + } + return this.fonts[0]; + } + function getCodePoint(string) { + var codePoint = 0; + var first = string.charCodeAt(0); + if (first >= 0xD800 && first <= 0xDBFF) { + var second = string.charCodeAt(1); + if (second >= 0xDC00 && second <= 0xDFFF) codePoint = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + } + return codePoint; + } + function isModifier(firstCharCode, secondCharCode) { + var sum = firstCharCode.toString(16) + secondCharCode.toString(16); + return -1 !== surrogateModifiers.indexOf(sum); + } + function isZeroWidthJoiner(charCode) { + return charCode === ZERO_WIDTH_JOINER_CODE_POINT; + } + function isVariationSelector(charCode) { + return charCode === VARIATION_SELECTOR_16_CODE_POINT; + } + function isRegionalCode(string) { + var codePoint = getCodePoint(string); + if (codePoint >= REGIONAL_CHARACTER_A_CODE_POINT && codePoint <= REGIONAL_CHARACTER_Z_CODE_POINT) return true; + return false; + } + function isFlagEmoji(string) { + return isRegionalCode(string.substr(0, 2)) && isRegionalCode(string.substr(2, 2)); + } + function isCombinedCharacter(_char3) { + return -1 !== combinedCharacters.indexOf(_char3); + } + function isRegionalFlag(text, index) { + var codePoint = getCodePoint(text.substr(index, 2)); + if (codePoint !== BLACK_FLAG_CODE_POINT) return false; + var count = 0; + index += 2; + while(count < 5){ + codePoint = getCodePoint(text.substr(index, 2)); + if (codePoint < A_TAG_CODE_POINT || codePoint > Z_TAG_CODE_POINT) return false; + count += 1; + index += 2; + } + return getCodePoint(text.substr(index, 2)) === CANCEL_TAG_CODE_POINT; + } + function setIsLoaded() { + this.isLoaded = true; + } + var Font = function() { + this.fonts = []; + this.chars = null; + this.typekitLoaded = 0; + this.isLoaded = false; + this._warned = false; + this.initTime = Date.now(); + this.setIsLoadedBinded = this.setIsLoaded.bind(this); + this.checkLoadedFontsBinded = this.checkLoadedFonts.bind(this); + }; + Font.isModifier = isModifier; + Font.isZeroWidthJoiner = isZeroWidthJoiner; + Font.isFlagEmoji = isFlagEmoji; + Font.isRegionalCode = isRegionalCode; + Font.isCombinedCharacter = isCombinedCharacter; + Font.isRegionalFlag = isRegionalFlag; + Font.isVariationSelector = isVariationSelector; + Font.BLACK_FLAG_CODE_POINT = BLACK_FLAG_CODE_POINT; + var fontPrototype = { + addChars: addChars, + addFonts: addFonts, + getCharData: getCharData, + getFontByName: getFontByName, + measureText: measureText, + checkLoadedFonts: checkLoadedFonts, + setIsLoaded: setIsLoaded + }; + Font.prototype = fontPrototype; + return Font; + }(); + function SlotManager(animationData) { + this.animationData = animationData; + } + SlotManager.prototype.getProp = function(data) { + if (this.animationData.slots && this.animationData.slots[data.sid]) return Object.assign(data, this.animationData.slots[data.sid].p); + return data; + }; + function slotFactory(animationData) { + return new SlotManager(animationData); + } + function RenderableElement() {} + RenderableElement.prototype = { + initRenderable: function() { + this.isInRange = false; + this.hidden = false; + this.isTransparent = false; + this.renderableComponents = []; + }, + addRenderableComponent: function(component) { + if (-1 === this.renderableComponents.indexOf(component)) this.renderableComponents.push(component); + }, + removeRenderableComponent: function(component) { + if (-1 !== this.renderableComponents.indexOf(component)) this.renderableComponents.splice(this.renderableComponents.indexOf(component), 1); + }, + prepareRenderableFrame: function(num) { + this.checkLayerLimits(num); + }, + checkTransparency: function() { + if (this.finalTransform.mProp.o.v <= 0) { + if (!this.isTransparent && this.globalData.renderConfig.hideOnTransparent) { + this.isTransparent = true; + this.hide(); + } + } else if (this.isTransparent) { + this.isTransparent = false; + this.show(); + } + }, + checkLayerLimits: function(num) { + if (this.data.ip - this.data.st <= num && this.data.op - this.data.st > num) { + if (true !== this.isInRange) { + this.globalData._mdf = true; + this._mdf = true; + this.isInRange = true; + this.show(); + } + } else if (false !== this.isInRange) { + this.globalData._mdf = true; + this.isInRange = false; + this.hide(); + } + }, + renderRenderable: function() { + var i; + var len = this.renderableComponents.length; + for(i = 0; i < len; i += 1)this.renderableComponents[i].renderFrame(this._isFirstFrame); + }, + sourceRectAtTime: function() { + return { + top: 0, + left: 0, + width: 100, + height: 100 + }; + }, + getLayerSize: function() { + if (5 === this.data.ty) return { + w: this.data.textData.width, + h: this.data.textData.height + }; + return { + w: this.data.width, + h: this.data.height + }; + } + }; + var getBlendMode = function() { + var blendModeEnums = { + 0: 'source-over', + 1: 'multiply', + 2: 'screen', + 3: 'overlay', + 4: 'darken', + 5: 'lighten', + 6: 'color-dodge', + 7: 'color-burn', + 8: 'hard-light', + 9: 'soft-light', + 10: 'difference', + 11: 'exclusion', + 12: 'hue', + 13: 'saturation', + 14: 'color', + 15: 'luminosity' + }; + return function(mode) { + return blendModeEnums[mode] || ''; + }; + }(); + function SliderEffect(data, elem, container) { + this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container); + } + function AngleEffect(data, elem, container) { + this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container); + } + function ColorEffect(data, elem, container) { + this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container); + } + function PointEffect(data, elem, container) { + this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container); + } + function LayerIndexEffect(data, elem, container) { + this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container); + } + function MaskIndexEffect(data, elem, container) { + this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container); + } + function CheckboxEffect(data, elem, container) { + this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container); + } + function NoValueEffect() { + this.p = {}; + } + function EffectsManager(data, element) { + var effects = data.ef || []; + this.effectElements = []; + var i; + var len = effects.length; + var effectItem; + for(i = 0; i < len; i += 1){ + effectItem = new GroupEffect(effects[i], element); + this.effectElements.push(effectItem); + } + } + function GroupEffect(data, element) { + this.init(data, element); + } + extendPrototype([ + DynamicPropertyContainer + ], GroupEffect); + GroupEffect.prototype.getValue = GroupEffect.prototype.iterateDynamicProperties; + GroupEffect.prototype.init = function(data, element) { + this.data = data; + this.effectElements = []; + this.initDynamicPropertyContainer(element); + var i; + var len = this.data.ef.length; + var eff; + var effects = this.data.ef; + for(i = 0; i < len; i += 1){ + eff = null; + switch(effects[i].ty){ + case 0: + eff = new SliderEffect(effects[i], element, this); + break; + case 1: + eff = new AngleEffect(effects[i], element, this); + break; + case 2: + eff = new ColorEffect(effects[i], element, this); + break; + case 3: + eff = new PointEffect(effects[i], element, this); + break; + case 4: + case 7: + eff = new CheckboxEffect(effects[i], element, this); + break; + case 10: + eff = new LayerIndexEffect(effects[i], element, this); + break; + case 11: + eff = new MaskIndexEffect(effects[i], element, this); + break; + case 5: + eff = new EffectsManager(effects[i], element, this); + break; + default: + eff = new NoValueEffect(effects[i], element, this); + break; + } + if (eff) this.effectElements.push(eff); + } + }; + function BaseElement() {} + BaseElement.prototype = { + checkMasks: function() { + if (!this.data.hasMask) return false; + var i = 0; + var len = this.data.masksProperties.length; + while(i < len){ + if ('n' !== this.data.masksProperties[i].mode && false !== this.data.masksProperties[i].cl) return true; + i += 1; + } + return false; + }, + initExpressions: function() { + var expressionsInterfaces = getExpressionInterfaces(); + if (!expressionsInterfaces) return; + var LayerExpressionInterface = expressionsInterfaces('layer'); + var EffectsExpressionInterface = expressionsInterfaces('effects'); + var ShapeExpressionInterface = expressionsInterfaces('shape'); + var TextExpressionInterface = expressionsInterfaces('text'); + var CompExpressionInterface = expressionsInterfaces('comp'); + this.layerInterface = LayerExpressionInterface(this); + if (this.data.hasMask && this.maskManager) this.layerInterface.registerMaskInterface(this.maskManager); + var effectsInterface = EffectsExpressionInterface.createEffectsInterface(this, this.layerInterface); + this.layerInterface.registerEffectsInterface(effectsInterface); + if (0 === this.data.ty || this.data.xt) this.compInterface = CompExpressionInterface(this); + else if (4 === this.data.ty) { + this.layerInterface.shapeInterface = ShapeExpressionInterface(this.shapesData, this.itemsData, this.layerInterface); + this.layerInterface.content = this.layerInterface.shapeInterface; + } else if (5 === this.data.ty) { + this.layerInterface.textInterface = TextExpressionInterface(this); + this.layerInterface.text = this.layerInterface.textInterface; + } + }, + setBlendMode: function() { + var blendModeValue = getBlendMode(this.data.bm); + var elem = this.baseElement || this.layerElement; + elem.style['mix-blend-mode'] = blendModeValue; + }, + initBaseData: function(data, globalData, comp) { + this.globalData = globalData; + this.comp = comp; + this.data = data; + this.layerId = createElementID(); + if (!this.data.sr) this.data.sr = 1; + this.effectsManager = new EffectsManager(this.data, this, this.dynamicProperties); + }, + getType: function() { + return this.type; + }, + sourceRectAtTime: function() {} + }; + function FrameElement() {} + FrameElement.prototype = { + initFrame: function() { + this._isFirstFrame = false; + this.dynamicProperties = []; + this._mdf = false; + }, + prepareProperties: function(num, isVisible) { + var i; + var len = this.dynamicProperties.length; + for(i = 0; i < len; i += 1)if (isVisible || this._isParent && 'transform' === this.dynamicProperties[i].propType) { + this.dynamicProperties[i].getValue(); + if (this.dynamicProperties[i]._mdf) { + this.globalData._mdf = true; + this._mdf = true; + } + } + }, + addDynamicProperty: function(prop) { + if (-1 === this.dynamicProperties.indexOf(prop)) this.dynamicProperties.push(prop); + } + }; + function FootageElement(data, globalData, comp) { + this.initFrame(); + this.initRenderable(); + this.assetData = globalData.getAssetData(data.refId); + this.footageData = globalData.imageLoader.getAsset(this.assetData); + this.initBaseData(data, globalData, comp); + } + FootageElement.prototype.prepareFrame = function() {}; + extendPrototype([ + RenderableElement, + BaseElement, + FrameElement + ], FootageElement); + FootageElement.prototype.getBaseElement = function() { + return null; + }; + FootageElement.prototype.renderFrame = function() {}; + FootageElement.prototype.destroy = function() {}; + FootageElement.prototype.initExpressions = function() { + var expressionsInterfaces = getExpressionInterfaces(); + if (!expressionsInterfaces) return; + var FootageInterface = expressionsInterfaces('footage'); + this.layerInterface = FootageInterface(this); + }; + FootageElement.prototype.getFootageData = function() { + return this.footageData; + }; + function AudioElement(data, globalData, comp) { + this.initFrame(); + this.initRenderable(); + this.assetData = globalData.getAssetData(data.refId); + this.initBaseData(data, globalData, comp); + this._isPlaying = false; + this._canPlay = false; + var assetPath = this.globalData.getAssetsPath(this.assetData); + this.audio = this.globalData.audioController.createAudio(assetPath); + this._currentTime = 0; + this.globalData.audioController.addAudio(this); + this._volumeMultiplier = 1; + this._volume = 1; + this._previousVolume = null; + this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { + _placeholder: true + }; + this.lv = PropertyFactory.getProp(this, data.au && data.au.lv ? data.au.lv : { + k: [ + 100 + ] + }, 1, 0.01, this); + } + AudioElement.prototype.prepareFrame = function(num) { + this.prepareRenderableFrame(num, true); + this.prepareProperties(num, true); + if (this.tm._placeholder) this._currentTime = num / this.data.sr; + else { + var timeRemapped = this.tm.v; + this._currentTime = timeRemapped; + } + this._volume = this.lv.v[0]; + var totalVolume = this._volume * this._volumeMultiplier; + if (this._previousVolume !== totalVolume) { + this._previousVolume = totalVolume; + this.audio.volume(totalVolume); + } + }; + extendPrototype([ + RenderableElement, + BaseElement, + FrameElement + ], AudioElement); + AudioElement.prototype.renderFrame = function() { + if (this.isInRange && this._canPlay) if (this._isPlaying) { + if (!this.audio.playing() || Math.abs(this._currentTime / this.globalData.frameRate - this.audio.seek()) > 0.1) this.audio.seek(this._currentTime / this.globalData.frameRate); + } else { + this.audio.play(); + this.audio.seek(this._currentTime / this.globalData.frameRate); + this._isPlaying = true; + } + }; + AudioElement.prototype.show = function() {}; + AudioElement.prototype.hide = function() { + this.audio.pause(); + this._isPlaying = false; + }; + AudioElement.prototype.pause = function() { + this.audio.pause(); + this._isPlaying = false; + this._canPlay = false; + }; + AudioElement.prototype.resume = function() { + this._canPlay = true; + }; + AudioElement.prototype.setRate = function(rateValue) { + this.audio.rate(rateValue); + }; + AudioElement.prototype.volume = function(volumeValue) { + this._volumeMultiplier = volumeValue; + this._previousVolume = volumeValue * this._volume; + this.audio.volume(this._previousVolume); + }; + AudioElement.prototype.getBaseElement = function() { + return null; + }; + AudioElement.prototype.destroy = function() {}; + AudioElement.prototype.sourceRectAtTime = function() {}; + AudioElement.prototype.initExpressions = function() {}; + function BaseRenderer() {} + BaseRenderer.prototype.checkLayers = function(num) { + var i; + var len = this.layers.length; + var data; + this.completeLayers = true; + for(i = len - 1; i >= 0; i -= 1){ + if (!this.elements[i]) { + data = this.layers[i]; + if (data.ip - data.st <= num - this.layers[i].st && data.op - data.st > num - this.layers[i].st) this.buildItem(i); + } + this.completeLayers = this.elements[i] ? this.completeLayers : false; + } + this.checkPendingElements(); + }; + BaseRenderer.prototype.createItem = function(layer) { + switch(layer.ty){ + case 2: + return this.createImage(layer); + case 0: + return this.createComp(layer); + case 1: + return this.createSolid(layer); + case 3: + return this.createNull(layer); + case 4: + return this.createShape(layer); + case 5: + return this.createText(layer); + case 6: + return this.createAudio(layer); + case 13: + return this.createCamera(layer); + case 15: + return this.createFootage(layer); + default: + return this.createNull(layer); + } + }; + BaseRenderer.prototype.createCamera = function() { + throw new Error('You\'re using a 3d camera. Try the html renderer.'); + }; + BaseRenderer.prototype.createAudio = function(data) { + return new AudioElement(data, this.globalData, this); + }; + BaseRenderer.prototype.createFootage = function(data) { + return new FootageElement(data, this.globalData, this); + }; + BaseRenderer.prototype.buildAllItems = function() { + var i; + var len = this.layers.length; + for(i = 0; i < len; i += 1)this.buildItem(i); + this.checkPendingElements(); + }; + BaseRenderer.prototype.includeLayers = function(newLayers) { + this.completeLayers = false; + var i; + var len = newLayers.length; + var j; + var jLen = this.layers.length; + for(i = 0; i < len; i += 1){ + j = 0; + while(j < jLen){ + if (this.layers[j].id === newLayers[i].id) { + this.layers[j] = newLayers[i]; + break; + } + j += 1; + } + } + }; + BaseRenderer.prototype.setProjectInterface = function(pInterface) { + this.globalData.projectInterface = pInterface; + }; + BaseRenderer.prototype.initItems = function() { + if (!this.globalData.progressiveLoad) this.buildAllItems(); + }; + BaseRenderer.prototype.buildElementParenting = function(element, parentName, hierarchy) { + var elements = this.elements; + var layers = this.layers; + var i = 0; + var len = layers.length; + while(i < len){ + if (layers[i].ind == parentName) if (elements[i] && true !== elements[i]) { + hierarchy.push(elements[i]); + elements[i].setAsParent(); + if (void 0 !== layers[i].parent) this.buildElementParenting(element, layers[i].parent, hierarchy); + else element.setHierarchy(hierarchy); + } else { + this.buildItem(i); + this.addPendingElement(element); + } + i += 1; + } + }; + BaseRenderer.prototype.addPendingElement = function(element) { + this.pendingElements.push(element); + }; + BaseRenderer.prototype.searchExtraCompositions = function(assets) { + var i; + var len = assets.length; + for(i = 0; i < len; i += 1)if (assets[i].xt) { + var comp = this.createComp(assets[i]); + comp.initExpressions(); + this.globalData.projectInterface.registerComposition(comp); + } + }; + BaseRenderer.prototype.getElementById = function(ind) { + var i; + var len = this.elements.length; + for(i = 0; i < len; i += 1)if (this.elements[i].data.ind === ind) return this.elements[i]; + return null; + }; + BaseRenderer.prototype.getElementByPath = function(path) { + var pathValue = path.shift(); + var element; + if ('number' == typeof pathValue) element = this.elements[pathValue]; + else { + var i; + var len = this.elements.length; + for(i = 0; i < len; i += 1)if (this.elements[i].data.nm === pathValue) { + element = this.elements[i]; + break; + } + } + if (0 === path.length) return element; + return element.getElementByPath(path); + }; + BaseRenderer.prototype.setupGlobalData = function(animData, fontsContainer) { + this.globalData.fontManager = new FontManager(); + this.globalData.slotManager = slotFactory(animData); + this.globalData.fontManager.addChars(animData.chars); + this.globalData.fontManager.addFonts(animData.fonts, fontsContainer); + this.globalData.getAssetData = this.animationItem.getAssetData.bind(this.animationItem); + this.globalData.getAssetsPath = this.animationItem.getAssetsPath.bind(this.animationItem); + this.globalData.imageLoader = this.animationItem.imagePreloader; + this.globalData.audioController = this.animationItem.audioController; + this.globalData.frameId = 0; + this.globalData.frameRate = animData.fr; + this.globalData.nm = animData.nm; + this.globalData.compSize = { + w: animData.w, + h: animData.h + }; + }; + var effectTypes = { + TRANSFORM_EFFECT: 'transformEFfect' + }; + function TransformElement() {} + TransformElement.prototype = { + initTransform: function() { + var mat = new Matrix(); + this.finalTransform = { + mProp: this.data.ks ? TransformPropertyFactory.getTransformProperty(this, this.data.ks, this) : { + o: 0 + }, + _matMdf: false, + _localMatMdf: false, + _opMdf: false, + mat: mat, + localMat: mat, + localOpacity: 1 + }; + if (this.data.ao) this.finalTransform.mProp.autoOriented = true; + this.data.ty; + }, + renderTransform: function() { + this.finalTransform._opMdf = this.finalTransform.mProp.o._mdf || this._isFirstFrame; + this.finalTransform._matMdf = this.finalTransform.mProp._mdf || this._isFirstFrame; + if (this.hierarchy) { + var mat; + var finalMat = this.finalTransform.mat; + var i = 0; + var len = this.hierarchy.length; + if (!this.finalTransform._matMdf) while(i < len){ + if (this.hierarchy[i].finalTransform.mProp._mdf) { + this.finalTransform._matMdf = true; + break; + } + i += 1; + } + if (this.finalTransform._matMdf) { + mat = this.finalTransform.mProp.v.props; + finalMat.cloneFromProps(mat); + for(i = 0; i < len; i += 1)finalMat.multiply(this.hierarchy[i].finalTransform.mProp.v); + } + } + if (!this.localTransforms || this.finalTransform._matMdf) this.finalTransform._localMatMdf = this.finalTransform._matMdf; + if (this.finalTransform._opMdf) this.finalTransform.localOpacity = this.finalTransform.mProp.o.v; + }, + renderLocalTransform: function() { + if (this.localTransforms) { + var i = 0; + var len = this.localTransforms.length; + this.finalTransform._localMatMdf = this.finalTransform._matMdf; + if (!this.finalTransform._localMatMdf || !this.finalTransform._opMdf) while(i < len){ + if (this.localTransforms[i]._mdf) this.finalTransform._localMatMdf = true; + if (this.localTransforms[i]._opMdf && !this.finalTransform._opMdf) { + this.finalTransform.localOpacity = this.finalTransform.mProp.o.v; + this.finalTransform._opMdf = true; + } + i += 1; + } + if (this.finalTransform._localMatMdf) { + var localMat = this.finalTransform.localMat; + this.localTransforms[0].matrix.clone(localMat); + for(i = 1; i < len; i += 1){ + var lmat = this.localTransforms[i].matrix; + localMat.multiply(lmat); + } + localMat.multiply(this.finalTransform.mat); + } + if (this.finalTransform._opMdf) { + var localOp = this.finalTransform.localOpacity; + for(i = 0; i < len; i += 1)localOp *= 0.01 * this.localTransforms[i].opacity; + this.finalTransform.localOpacity = localOp; + } + } + }, + searchEffectTransforms: function() { + if (this.renderableEffectsManager) { + var transformEffects = this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT); + if (transformEffects.length) { + this.localTransforms = []; + this.finalTransform.localMat = new Matrix(); + var i = 0; + var len = transformEffects.length; + for(i = 0; i < len; i += 1)this.localTransforms.push(transformEffects[i]); + } + } + }, + globalToLocal: function(pt) { + var transforms = []; + transforms.push(this.finalTransform); + var flag = true; + var comp = this.comp; + while(flag)if (comp.finalTransform) { + if (comp.data.hasMask) transforms.splice(0, 0, comp.finalTransform); + comp = comp.comp; + } else flag = false; + var i; + var len = transforms.length; + var ptNew; + for(i = 0; i < len; i += 1){ + ptNew = transforms[i].mat.applyToPointArray(0, 0, 0); + pt = [ + pt[0] - ptNew[0], + pt[1] - ptNew[1], + 0 + ]; + } + return pt; + }, + mHelper: new Matrix() + }; + function MaskElement(data, element, globalData) { + this.data = data; + this.element = element; + this.globalData = globalData; + this.storedData = []; + this.masksProperties = this.data.masksProperties || []; + this.maskElement = null; + var defs = this.globalData.defs; + var i; + var len = this.masksProperties ? this.masksProperties.length : 0; + this.viewData = createSizedArray(len); + this.solidPath = ''; + var path; + var properties = this.masksProperties; + var count = 0; + var currentMasks = []; + var j; + var jLen; + var layerId = createElementID(); + var rect; + var expansor; + var feMorph; + var x; + var maskType = 'clipPath'; + var maskRef = 'clip-path'; + for(i = 0; i < len; i += 1){ + if ('a' !== properties[i].mode && 'n' !== properties[i].mode || properties[i].inv || 100 !== properties[i].o.k || properties[i].o.x) { + maskType = 'mask'; + maskRef = 'mask'; + } + if (('s' === properties[i].mode || 'i' === properties[i].mode) && 0 === count) { + rect = createNS('rect'); + rect.setAttribute('fill', '#ffffff'); + rect.setAttribute('width', this.element.comp.data.w || 0); + rect.setAttribute('height', this.element.comp.data.h || 0); + currentMasks.push(rect); + } else rect = null; + path = createNS('path'); + if ('n' === properties[i].mode) { + this.viewData[i] = { + op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element), + prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3), + elem: path, + lastPath: '' + }; + defs.appendChild(path); + } else { + count += 1; + path.setAttribute('fill', 's' === properties[i].mode ? '#000000' : '#ffffff'); + path.setAttribute('clip-rule', 'nonzero'); + var filterID; + if (0 !== properties[i].x.k) { + maskType = 'mask'; + maskRef = 'mask'; + x = PropertyFactory.getProp(this.element, properties[i].x, 0, null, this.element); + filterID = createElementID(); + expansor = createNS('filter'); + expansor.setAttribute('id', filterID); + feMorph = createNS('feMorphology'); + feMorph.setAttribute('operator', 'erode'); + feMorph.setAttribute('in', 'SourceGraphic'); + feMorph.setAttribute('radius', '0'); + expansor.appendChild(feMorph); + defs.appendChild(expansor); + path.setAttribute('stroke', 's' === properties[i].mode ? '#000000' : '#ffffff'); + } else { + feMorph = null; + x = null; + } + this.storedData[i] = { + elem: path, + x: x, + expan: feMorph, + lastPath: '', + lastOperator: '', + filterId: filterID, + lastRadius: 0 + }; + if ('i' === properties[i].mode) { + jLen = currentMasks.length; + var g = createNS('g'); + for(j = 0; j < jLen; j += 1)g.appendChild(currentMasks[j]); + var mask = createNS('mask'); + mask.setAttribute('mask-type', 'alpha'); + mask.setAttribute('id', layerId + '_' + count); + mask.appendChild(path); + defs.appendChild(mask); + g.setAttribute('mask', 'url(' + getLocationHref() + '#' + layerId + '_' + count + ')'); + currentMasks.length = 0; + currentMasks.push(g); + } else currentMasks.push(path); + if (properties[i].inv && !this.solidPath) this.solidPath = this.createLayerSolidPath(); + this.viewData[i] = { + elem: path, + lastPath: '', + op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element), + prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3), + invRect: rect + }; + if (!this.viewData[i].prop.k) this.drawPath(properties[i], this.viewData[i].prop.v, this.viewData[i]); + } + } + this.maskElement = createNS(maskType); + len = currentMasks.length; + for(i = 0; i < len; i += 1)this.maskElement.appendChild(currentMasks[i]); + if (count > 0) { + this.maskElement.setAttribute('id', layerId); + this.element.maskedElement.setAttribute(maskRef, 'url(' + getLocationHref() + '#' + layerId + ')'); + defs.appendChild(this.maskElement); + } + if (this.viewData.length) this.element.addRenderableComponent(this); + } + MaskElement.prototype.getMaskProperty = function(pos) { + return this.viewData[pos].prop; + }; + MaskElement.prototype.renderFrame = function(isFirstFrame) { + var finalMat = this.element.finalTransform.mat; + var i; + var len = this.masksProperties.length; + for(i = 0; i < len; i += 1){ + if (this.viewData[i].prop._mdf || isFirstFrame) this.drawPath(this.masksProperties[i], this.viewData[i].prop.v, this.viewData[i]); + if (this.viewData[i].op._mdf || isFirstFrame) this.viewData[i].elem.setAttribute('fill-opacity', this.viewData[i].op.v); + if ('n' !== this.masksProperties[i].mode) { + if (this.viewData[i].invRect && (this.element.finalTransform.mProp._mdf || isFirstFrame)) this.viewData[i].invRect.setAttribute('transform', finalMat.getInverseMatrix().to2dCSS()); + if (this.storedData[i].x && (this.storedData[i].x._mdf || isFirstFrame)) { + var feMorph = this.storedData[i].expan; + if (this.storedData[i].x.v < 0) { + if ('erode' !== this.storedData[i].lastOperator) { + this.storedData[i].lastOperator = 'erode'; + this.storedData[i].elem.setAttribute('filter', 'url(' + getLocationHref() + '#' + this.storedData[i].filterId + ')'); + } + feMorph.setAttribute('radius', -this.storedData[i].x.v); + } else { + if ('dilate' !== this.storedData[i].lastOperator) { + this.storedData[i].lastOperator = 'dilate'; + this.storedData[i].elem.setAttribute('filter', null); + } + this.storedData[i].elem.setAttribute('stroke-width', 2 * this.storedData[i].x.v); + } + } + } + } + }; + MaskElement.prototype.getMaskelement = function() { + return this.maskElement; + }; + MaskElement.prototype.createLayerSolidPath = function() { + var path = 'M0,0 '; + path += ' h' + this.globalData.compSize.w; + path += ' v' + this.globalData.compSize.h; + path += ' h-' + this.globalData.compSize.w; + path += ' v-' + this.globalData.compSize.h + ' '; + return path; + }; + MaskElement.prototype.drawPath = function(pathData, pathNodes, viewData) { + var pathString = ' M' + pathNodes.v[0][0] + ',' + pathNodes.v[0][1]; + var i; + var len; + len = pathNodes._length; + for(i = 1; i < len; i += 1)pathString += ' C' + pathNodes.o[i - 1][0] + ',' + pathNodes.o[i - 1][1] + ' ' + pathNodes.i[i][0] + ',' + pathNodes.i[i][1] + ' ' + pathNodes.v[i][0] + ',' + pathNodes.v[i][1]; + if (pathNodes.c && len > 1) pathString += ' C' + pathNodes.o[i - 1][0] + ',' + pathNodes.o[i - 1][1] + ' ' + pathNodes.i[0][0] + ',' + pathNodes.i[0][1] + ' ' + pathNodes.v[0][0] + ',' + pathNodes.v[0][1]; + if (viewData.lastPath !== pathString) { + var pathShapeValue = ''; + if (viewData.elem) { + if (pathNodes.c) pathShapeValue = pathData.inv ? this.solidPath + pathString : pathString; + viewData.elem.setAttribute('d', pathShapeValue); + } + viewData.lastPath = pathString; + } + }; + MaskElement.prototype.destroy = function() { + this.element = null; + this.globalData = null; + this.maskElement = null; + this.data = null; + this.masksProperties = null; + }; + var filtersFactory = function() { + var ob = {}; + ob.createFilter = createFilter; + ob.createAlphaToLuminanceFilter = createAlphaToLuminanceFilter; + function createFilter(filId, skipCoordinates) { + var fil = createNS('filter'); + fil.setAttribute('id', filId); + if (true !== skipCoordinates) { + fil.setAttribute('filterUnits', 'objectBoundingBox'); + fil.setAttribute('x', '0%'); + fil.setAttribute('y', '0%'); + fil.setAttribute('width', '100%'); + fil.setAttribute('height', '100%'); + } + return fil; + } + function createAlphaToLuminanceFilter() { + var feColorMatrix = createNS('feColorMatrix'); + feColorMatrix.setAttribute('type', 'matrix'); + feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB'); + feColorMatrix.setAttribute('values', '0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1'); + return feColorMatrix; + } + return ob; + }(); + var featureSupport = function() { + var ob = { + maskType: true, + svgLumaHidden: true, + offscreenCanvas: 'undefined' != typeof OffscreenCanvas + }; + if (/MSIE 10/i.test(navigator.userAgent) || /MSIE 9/i.test(navigator.userAgent) || /rv:11.0/i.test(navigator.userAgent) || /Edge\/\d./i.test(navigator.userAgent)) ob.maskType = false; + if (/firefox/i.test(navigator.userAgent)) ob.svgLumaHidden = false; + return ob; + }(); + var registeredEffects$1 = {}; + var idPrefix = 'filter_result_'; + function SVGEffects(elem) { + var i; + var source = 'SourceGraphic'; + var len = elem.data.ef ? elem.data.ef.length : 0; + var filId = createElementID(); + var fil = filtersFactory.createFilter(filId, true); + var count = 0; + this.filters = []; + var filterManager; + for(i = 0; i < len; i += 1){ + filterManager = null; + var type = elem.data.ef[i].ty; + if (registeredEffects$1[type]) { + var Effect = registeredEffects$1[type].effect; + filterManager = new Effect(fil, elem.effectsManager.effectElements[i], elem, idPrefix + count, source); + source = idPrefix + count; + if (registeredEffects$1[type].countsAsEffect) count += 1; + } + if (filterManager) this.filters.push(filterManager); + } + if (count) { + elem.globalData.defs.appendChild(fil); + elem.layerElement.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')'); + } + if (this.filters.length) elem.addRenderableComponent(this); + } + SVGEffects.prototype.renderFrame = function(_isFirstFrame) { + var i; + var len = this.filters.length; + for(i = 0; i < len; i += 1)this.filters[i].renderFrame(_isFirstFrame); + }; + SVGEffects.prototype.getEffects = function(type) { + var i; + var len = this.filters.length; + var effects = []; + for(i = 0; i < len; i += 1)if (this.filters[i].type === type) effects.push(this.filters[i]); + return effects; + }; + function registerEffect$1(id, effect, countsAsEffect) { + registeredEffects$1[id] = { + effect: effect, + countsAsEffect: countsAsEffect + }; + } + function SVGBaseElement() {} + SVGBaseElement.prototype = { + initRendererElement: function() { + this.layerElement = createNS('g'); + }, + createContainerElements: function() { + this.matteElement = createNS('g'); + this.transformedElement = this.layerElement; + this.maskedElement = this.layerElement; + this._sizeChanged = false; + var layerElementParent = null; + if (this.data.td) { + this.matteMasks = {}; + var gg = createNS('g'); + gg.setAttribute('id', this.layerId); + gg.appendChild(this.layerElement); + layerElementParent = gg; + this.globalData.defs.appendChild(gg); + } else if (this.data.tt) { + this.matteElement.appendChild(this.layerElement); + layerElementParent = this.matteElement; + this.baseElement = this.matteElement; + } else this.baseElement = this.layerElement; + if (this.data.ln) this.layerElement.setAttribute('id', this.data.ln); + if (this.data.cl) this.layerElement.setAttribute('class', this.data.cl); + if (0 === this.data.ty && !this.data.hd) { + var cp = createNS('clipPath'); + var pt = createNS('path'); + pt.setAttribute('d', 'M0,0 L' + this.data.w + ',0 L' + this.data.w + ',' + this.data.h + ' L0,' + this.data.h + 'z'); + var clipId = createElementID(); + cp.setAttribute('id', clipId); + cp.appendChild(pt); + this.globalData.defs.appendChild(cp); + if (this.checkMasks()) { + var cpGroup = createNS('g'); + cpGroup.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + clipId + ')'); + cpGroup.appendChild(this.layerElement); + this.transformedElement = cpGroup; + if (layerElementParent) layerElementParent.appendChild(this.transformedElement); + else this.baseElement = this.transformedElement; + } else this.layerElement.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + clipId + ')'); + } + if (0 !== this.data.bm) this.setBlendMode(); + }, + renderElement: function() { + if (this.finalTransform._localMatMdf) this.transformedElement.setAttribute('transform', this.finalTransform.localMat.to2dCSS()); + if (this.finalTransform._opMdf) this.transformedElement.setAttribute('opacity', this.finalTransform.localOpacity); + }, + destroyBaseElement: function() { + this.layerElement = null; + this.matteElement = null; + this.maskManager.destroy(); + }, + getBaseElement: function() { + if (this.data.hd) return null; + return this.baseElement; + }, + createRenderableComponents: function() { + this.maskManager = new MaskElement(this.data, this, this.globalData); + this.renderableEffectsManager = new SVGEffects(this); + this.searchEffectTransforms(); + }, + getMatte: function(matteType) { + if (!this.matteMasks) this.matteMasks = {}; + if (!this.matteMasks[matteType]) { + var id = this.layerId + '_' + matteType; + var filId; + var fil; + var useElement; + var gg; + if (1 === matteType || 3 === matteType) { + var masker = createNS('mask'); + masker.setAttribute('id', id); + masker.setAttribute('mask-type', 3 === matteType ? 'luminance' : 'alpha'); + useElement = createNS('use'); + useElement.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '#' + this.layerId); + masker.appendChild(useElement); + this.globalData.defs.appendChild(masker); + if (!featureSupport.maskType && 1 === matteType) { + masker.setAttribute('mask-type', 'luminance'); + filId = createElementID(); + fil = filtersFactory.createFilter(filId); + this.globalData.defs.appendChild(fil); + fil.appendChild(filtersFactory.createAlphaToLuminanceFilter()); + gg = createNS('g'); + gg.appendChild(useElement); + masker.appendChild(gg); + gg.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')'); + } + } else if (2 === matteType) { + var maskGroup = createNS('mask'); + maskGroup.setAttribute('id', id); + maskGroup.setAttribute('mask-type', 'alpha'); + var maskGrouper = createNS('g'); + maskGroup.appendChild(maskGrouper); + filId = createElementID(); + fil = filtersFactory.createFilter(filId); + var feCTr = createNS('feComponentTransfer'); + feCTr.setAttribute('in', 'SourceGraphic'); + fil.appendChild(feCTr); + var feFunc = createNS('feFuncA'); + feFunc.setAttribute('type', 'table'); + feFunc.setAttribute('tableValues', '1.0 0.0'); + feCTr.appendChild(feFunc); + this.globalData.defs.appendChild(fil); + var alphaRect = createNS('rect'); + alphaRect.setAttribute('width', this.comp.data.w); + alphaRect.setAttribute('height', this.comp.data.h); + alphaRect.setAttribute('x', '0'); + alphaRect.setAttribute('y', '0'); + alphaRect.setAttribute('fill', '#ffffff'); + alphaRect.setAttribute('opacity', '0'); + maskGrouper.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')'); + maskGrouper.appendChild(alphaRect); + useElement = createNS('use'); + useElement.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '#' + this.layerId); + maskGrouper.appendChild(useElement); + if (!featureSupport.maskType) { + maskGroup.setAttribute('mask-type', 'luminance'); + fil.appendChild(filtersFactory.createAlphaToLuminanceFilter()); + gg = createNS('g'); + maskGrouper.appendChild(alphaRect); + gg.appendChild(this.layerElement); + maskGrouper.appendChild(gg); + } + this.globalData.defs.appendChild(maskGroup); + } + this.matteMasks[matteType] = id; + } + return this.matteMasks[matteType]; + }, + setMatte: function(id) { + if (!this.matteElement) return; + this.matteElement.setAttribute('mask', 'url(' + getLocationHref() + '#' + id + ')'); + } + }; + function HierarchyElement() {} + HierarchyElement.prototype = { + initHierarchy: function() { + this.hierarchy = []; + this._isParent = false; + this.checkParenting(); + }, + setHierarchy: function(hierarchy) { + this.hierarchy = hierarchy; + }, + setAsParent: function() { + this._isParent = true; + }, + checkParenting: function() { + if (void 0 !== this.data.parent) this.comp.buildElementParenting(this, this.data.parent, []); + } + }; + function RenderableDOMElement() {} + (function() { + var _prototype = { + initElement: function(data, globalData, comp) { + this.initFrame(); + this.initBaseData(data, globalData, comp); + this.initTransform(data, globalData, comp); + this.initHierarchy(); + this.initRenderable(); + this.initRendererElement(); + this.createContainerElements(); + this.createRenderableComponents(); + this.createContent(); + this.hide(); + }, + hide: function() { + if (!this.hidden && (!this.isInRange || this.isTransparent)) { + var elem = this.baseElement || this.layerElement; + elem.style.display = 'none'; + this.hidden = true; + } + }, + show: function() { + if (this.isInRange && !this.isTransparent) { + if (!this.data.hd) { + var elem = this.baseElement || this.layerElement; + elem.style.display = 'block'; + } + this.hidden = false; + this._isFirstFrame = true; + } + }, + renderFrame: function() { + if (this.data.hd || this.hidden) return; + this.renderTransform(); + this.renderRenderable(); + this.renderLocalTransform(); + this.renderElement(); + this.renderInnerContent(); + if (this._isFirstFrame) this._isFirstFrame = false; + }, + renderInnerContent: function() {}, + prepareFrame: function(num) { + this._mdf = false; + this.prepareRenderableFrame(num); + this.prepareProperties(num, this.isInRange); + this.checkTransparency(); + }, + destroy: function() { + this.innerElem = null; + this.destroyBaseElement(); + } + }; + extendPrototype([ + RenderableElement, + createProxyFunction(_prototype) + ], RenderableDOMElement); + })(); + function IImageElement(data, globalData, comp) { + this.assetData = globalData.getAssetData(data.refId); + if (this.assetData && this.assetData.sid) this.assetData = globalData.slotManager.getProp(this.assetData); + this.initElement(data, globalData, comp); + this.sourceRect = { + top: 0, + left: 0, + width: this.assetData.w, + height: this.assetData.h + }; + } + extendPrototype([ + BaseElement, + TransformElement, + SVGBaseElement, + HierarchyElement, + FrameElement, + RenderableDOMElement + ], IImageElement); + IImageElement.prototype.createContent = function() { + var assetPath = this.globalData.getAssetsPath(this.assetData); + this.innerElem = createNS('image'); + this.innerElem.setAttribute('width', this.assetData.w + 'px'); + this.innerElem.setAttribute('height', this.assetData.h + 'px'); + this.innerElem.setAttribute('preserveAspectRatio', this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio); + this.innerElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath); + this.layerElement.appendChild(this.innerElem); + }; + IImageElement.prototype.sourceRectAtTime = function() { + return this.sourceRect; + }; + function ProcessedElement(element, position) { + this.elem = element; + this.pos = position; + } + function IShapeElement() {} + IShapeElement.prototype = { + addShapeToModifiers: function(data) { + var i; + var len = this.shapeModifiers.length; + for(i = 0; i < len; i += 1)this.shapeModifiers[i].addShape(data); + }, + isShapeInAnimatedModifiers: function(data) { + var i = 0; + var len = this.shapeModifiers.length; + while(i < len)if (this.shapeModifiers[i].isAnimatedWithShape(data)) return true; + return false; + }, + renderModifiers: function() { + if (!this.shapeModifiers.length) return; + var i; + var len = this.shapes.length; + for(i = 0; i < len; i += 1)this.shapes[i].sh.reset(); + len = this.shapeModifiers.length; + var shouldBreakProcess; + for(i = len - 1; i >= 0; i -= 1){ + shouldBreakProcess = this.shapeModifiers[i].processShapes(this._isFirstFrame); + if (shouldBreakProcess) break; + } + }, + searchProcessedElement: function(elem) { + var elements = this.processedElements; + var i = 0; + var len = elements.length; + while(i < len){ + if (elements[i].elem === elem) return elements[i].pos; + i += 1; + } + return 0; + }, + addProcessedElement: function(elem, pos) { + var elements = this.processedElements; + var i = elements.length; + while(i){ + i -= 1; + if (elements[i].elem === elem) { + elements[i].pos = pos; + return; + } + } + elements.push(new ProcessedElement(elem, pos)); + }, + prepareFrame: function(num) { + this.prepareRenderableFrame(num); + this.prepareProperties(num, this.isInRange); + } + }; + var lineCapEnum = { + 1: 'butt', + 2: 'round', + 3: 'square' + }; + var lineJoinEnum = { + 1: 'miter', + 2: 'round', + 3: 'bevel' + }; + function SVGShapeData(transformers, level, shape) { + this.caches = []; + this.styles = []; + this.transformers = transformers; + this.lStr = ''; + this.sh = shape; + this.lvl = level; + this._isAnimated = !!shape.k; + var i = 0; + var len = transformers.length; + while(i < len){ + if (transformers[i].mProps.dynamicProperties.length) { + this._isAnimated = true; + break; + } + i += 1; + } + } + SVGShapeData.prototype.setAsAnimated = function() { + this._isAnimated = true; + }; + function SVGStyleData(data, level) { + this.data = data; + this.type = data.ty; + this.d = ''; + this.lvl = level; + this._mdf = false; + this.closed = true === data.hd; + this.pElem = createNS('path'); + this.msElem = null; + } + SVGStyleData.prototype.reset = function() { + this.d = ''; + this._mdf = false; + }; + function DashProperty(elem, data, renderer, container) { + this.elem = elem; + this.frameId = -1; + this.dataProps = createSizedArray(data.length); + this.renderer = renderer; + this.k = false; + this.dashStr = ''; + this.dashArray = createTypedArray('float32', data.length ? data.length - 1 : 0); + this.dashoffset = createTypedArray('float32', 1); + this.initDynamicPropertyContainer(container); + var i; + var len = data.length || 0; + var prop; + for(i = 0; i < len; i += 1){ + prop = PropertyFactory.getProp(elem, data[i].v, 0, 0, this); + this.k = prop.k || this.k; + this.dataProps[i] = { + n: data[i].n, + p: prop + }; + } + if (!this.k) this.getValue(true); + this._isAnimated = this.k; + } + DashProperty.prototype.getValue = function(forceRender) { + if (this.elem.globalData.frameId === this.frameId && !forceRender) return; + this.frameId = this.elem.globalData.frameId; + this.iterateDynamicProperties(); + this._mdf = this._mdf || forceRender; + if (this._mdf) { + var i = 0; + var len = this.dataProps.length; + if ('svg' === this.renderer) this.dashStr = ''; + for(i = 0; i < len; i += 1)if ('o' !== this.dataProps[i].n) if ('svg' === this.renderer) this.dashStr += ' ' + this.dataProps[i].p.v; + else this.dashArray[i] = this.dataProps[i].p.v; + else this.dashoffset[0] = this.dataProps[i].p.v; + } + }; + extendPrototype([ + DynamicPropertyContainer + ], DashProperty); + function SVGStrokeStyleData(elem, data, styleOb) { + this.initDynamicPropertyContainer(elem); + this.getValue = this.iterateDynamicProperties; + this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this); + this.w = PropertyFactory.getProp(elem, data.w, 0, null, this); + this.d = new DashProperty(elem, data.d || {}, 'svg', this); + this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this); + this.style = styleOb; + this._isAnimated = !!this._isAnimated; + } + extendPrototype([ + DynamicPropertyContainer + ], SVGStrokeStyleData); + function SVGFillStyleData(elem, data, styleOb) { + this.initDynamicPropertyContainer(elem); + this.getValue = this.iterateDynamicProperties; + this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this); + this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this); + this.style = styleOb; + } + extendPrototype([ + DynamicPropertyContainer + ], SVGFillStyleData); + function SVGNoStyleData(elem, data, styleOb) { + this.initDynamicPropertyContainer(elem); + this.getValue = this.iterateDynamicProperties; + this.style = styleOb; + } + extendPrototype([ + DynamicPropertyContainer + ], SVGNoStyleData); + function GradientProperty(elem, data, container) { + this.data = data; + this.c = createTypedArray('uint8c', 4 * data.p); + var cLength = data.k.k[0].s ? data.k.k[0].s.length - 4 * data.p : data.k.k.length - 4 * data.p; + this.o = createTypedArray('float32', cLength); + this._cmdf = false; + this._omdf = false; + this._collapsable = this.checkCollapsable(); + this._hasOpacity = cLength; + this.initDynamicPropertyContainer(container); + this.prop = PropertyFactory.getProp(elem, data.k, 1, null, this); + this.k = this.prop.k; + this.getValue(true); + } + GradientProperty.prototype.comparePoints = function(values, points) { + var i = 0; + var len = this.o.length / 2; + var diff; + while(i < len){ + diff = Math.abs(values[4 * i] - values[4 * points + 2 * i]); + if (diff > 0.01) return false; + i += 1; + } + return true; + }; + GradientProperty.prototype.checkCollapsable = function() { + if (this.o.length / 2 !== this.c.length / 4) return false; + if (this.data.k.k[0].s) { + var i = 0; + var len = this.data.k.k.length; + while(i < len){ + if (!this.comparePoints(this.data.k.k[i].s, this.data.p)) return false; + i += 1; + } + } else if (!this.comparePoints(this.data.k.k, this.data.p)) return false; + return true; + }; + GradientProperty.prototype.getValue = function(forceRender) { + this.prop.getValue(); + this._mdf = false; + this._cmdf = false; + this._omdf = false; + if (this.prop._mdf || forceRender) { + var i; + var len = 4 * this.data.p; + var mult; + var val; + for(i = 0; i < len; i += 1){ + mult = i % 4 === 0 ? 100 : 255; + val = Math.round(this.prop.v[i] * mult); + if (this.c[i] !== val) { + this.c[i] = val; + this._cmdf = !forceRender; + } + } + if (this.o.length) { + len = this.prop.v.length; + for(i = 4 * this.data.p; i < len; i += 1){ + mult = i % 2 === 0 ? 100 : 1; + val = i % 2 === 0 ? Math.round(100 * this.prop.v[i]) : this.prop.v[i]; + if (this.o[i - 4 * this.data.p] !== val) { + this.o[i - 4 * this.data.p] = val; + this._omdf = !forceRender; + } + } + } + this._mdf = !forceRender; + } + }; + extendPrototype([ + DynamicPropertyContainer + ], GradientProperty); + function SVGGradientFillStyleData(elem, data, styleOb) { + this.initDynamicPropertyContainer(elem); + this.getValue = this.iterateDynamicProperties; + this.initGradientData(elem, data, styleOb); + } + SVGGradientFillStyleData.prototype.initGradientData = function(elem, data, styleOb) { + this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this); + this.s = PropertyFactory.getProp(elem, data.s, 1, null, this); + this.e = PropertyFactory.getProp(elem, data.e, 1, null, this); + this.h = PropertyFactory.getProp(elem, data.h || { + k: 0 + }, 0, 0.01, this); + this.a = PropertyFactory.getProp(elem, data.a || { + k: 0 + }, 0, degToRads, this); + this.g = new GradientProperty(elem, data.g, this); + this.style = styleOb; + this.stops = []; + this.setGradientData(styleOb.pElem, data); + this.setGradientOpacity(data, styleOb); + this._isAnimated = !!this._isAnimated; + }; + SVGGradientFillStyleData.prototype.setGradientData = function(pathElement, data) { + var gradientId = createElementID(); + var gfill = createNS(1 === data.t ? 'linearGradient' : 'radialGradient'); + gfill.setAttribute('id', gradientId); + gfill.setAttribute('spreadMethod', 'pad'); + gfill.setAttribute('gradientUnits', 'userSpaceOnUse'); + var stops = []; + var stop; + var j; + var jLen; + jLen = 4 * data.g.p; + for(j = 0; j < jLen; j += 4){ + stop = createNS('stop'); + gfill.appendChild(stop); + stops.push(stop); + } + pathElement.setAttribute('gf' === data.ty ? 'fill' : 'stroke', 'url(' + getLocationHref() + '#' + gradientId + ')'); + this.gf = gfill; + this.cst = stops; + }; + SVGGradientFillStyleData.prototype.setGradientOpacity = function(data, styleOb) { + if (this.g._hasOpacity && !this.g._collapsable) { + var stop; + var j; + var jLen; + var mask = createNS('mask'); + var maskElement = createNS('path'); + mask.appendChild(maskElement); + var opacityId = createElementID(); + var maskId = createElementID(); + mask.setAttribute('id', maskId); + var opFill = createNS(1 === data.t ? 'linearGradient' : 'radialGradient'); + opFill.setAttribute('id', opacityId); + opFill.setAttribute('spreadMethod', 'pad'); + opFill.setAttribute('gradientUnits', 'userSpaceOnUse'); + jLen = data.g.k.k[0].s ? data.g.k.k[0].s.length : data.g.k.k.length; + var stops = this.stops; + for(j = 4 * data.g.p; j < jLen; j += 2){ + stop = createNS('stop'); + stop.setAttribute('stop-color', 'rgb(255,255,255)'); + opFill.appendChild(stop); + stops.push(stop); + } + maskElement.setAttribute('gf' === data.ty ? 'fill' : 'stroke', 'url(' + getLocationHref() + '#' + opacityId + ')'); + if ('gs' === data.ty) { + maskElement.setAttribute('stroke-linecap', lineCapEnum[data.lc || 2]); + maskElement.setAttribute('stroke-linejoin', lineJoinEnum[data.lj || 2]); + if (1 === data.lj) maskElement.setAttribute('stroke-miterlimit', data.ml); + } + this.of = opFill; + this.ms = mask; + this.ost = stops; + this.maskId = maskId; + styleOb.msElem = maskElement; + } + }; + extendPrototype([ + DynamicPropertyContainer + ], SVGGradientFillStyleData); + function SVGGradientStrokeStyleData(elem, data, styleOb) { + this.initDynamicPropertyContainer(elem); + this.getValue = this.iterateDynamicProperties; + this.w = PropertyFactory.getProp(elem, data.w, 0, null, this); + this.d = new DashProperty(elem, data.d || {}, 'svg', this); + this.initGradientData(elem, data, styleOb); + this._isAnimated = !!this._isAnimated; + } + extendPrototype([ + SVGGradientFillStyleData, + DynamicPropertyContainer + ], SVGGradientStrokeStyleData); + function ShapeGroupData() { + this.it = []; + this.prevViewData = []; + this.gr = createNS('g'); + } + function SVGTransformData(mProps, op, container) { + this.transform = { + mProps: mProps, + op: op, + container: container + }; + this.elements = []; + this._isAnimated = this.transform.mProps.dynamicProperties.length || this.transform.op.effectsSequence.length; + } + var buildShapeString = function(pathNodes, length, closed, mat) { + if (0 === length) return ''; + var _o = pathNodes.o; + var _i = pathNodes.i; + var _v = pathNodes.v; + var i; + var shapeString = ' M' + mat.applyToPointStringified(_v[0][0], _v[0][1]); + for(i = 1; i < length; i += 1)shapeString += ' C' + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + ' ' + mat.applyToPointStringified(_i[i][0], _i[i][1]) + ' ' + mat.applyToPointStringified(_v[i][0], _v[i][1]); + if (closed && length) { + shapeString += ' C' + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + ' ' + mat.applyToPointStringified(_i[0][0], _i[0][1]) + ' ' + mat.applyToPointStringified(_v[0][0], _v[0][1]); + shapeString += 'z'; + } + return shapeString; + }; + var SVGElementsRenderer = function() { + var _identityMatrix = new Matrix(); + var _matrixHelper = new Matrix(); + var ob = { + createRenderFunction: createRenderFunction + }; + function createRenderFunction(data) { + switch(data.ty){ + case 'fl': + return renderFill; + case 'gf': + return renderGradient; + case 'gs': + return renderGradientStroke; + case 'st': + return renderStroke; + case 'sh': + case 'el': + case 'rc': + case 'sr': + return renderPath; + case 'tr': + return renderContentTransform; + case 'no': + return renderNoop; + default: + return null; + } + } + function renderContentTransform(styleData, itemData, isFirstFrame) { + if (isFirstFrame || itemData.transform.op._mdf) itemData.transform.container.setAttribute('opacity', itemData.transform.op.v); + if (isFirstFrame || itemData.transform.mProps._mdf) itemData.transform.container.setAttribute('transform', itemData.transform.mProps.v.to2dCSS()); + } + function renderNoop() {} + function renderPath(styleData, itemData, isFirstFrame) { + var j; + var jLen; + var pathStringTransformed; + var redraw; + var pathNodes; + var l; + var lLen = itemData.styles.length; + var lvl = itemData.lvl; + var paths; + var mat; + var iterations; + var k; + for(l = 0; l < lLen; l += 1){ + redraw = itemData.sh._mdf || isFirstFrame; + if (itemData.styles[l].lvl < lvl) { + mat = _matrixHelper.reset(); + iterations = lvl - itemData.styles[l].lvl; + k = itemData.transformers.length - 1; + while(!redraw && iterations > 0){ + redraw = itemData.transformers[k].mProps._mdf || redraw; + iterations -= 1; + k -= 1; + } + if (redraw) { + iterations = lvl - itemData.styles[l].lvl; + k = itemData.transformers.length - 1; + while(iterations > 0){ + mat.multiply(itemData.transformers[k].mProps.v); + iterations -= 1; + k -= 1; + } + } + } else mat = _identityMatrix; + paths = itemData.sh.paths; + jLen = paths._length; + if (redraw) { + pathStringTransformed = ''; + for(j = 0; j < jLen; j += 1){ + pathNodes = paths.shapes[j]; + if (pathNodes && pathNodes._length) pathStringTransformed += buildShapeString(pathNodes, pathNodes._length, pathNodes.c, mat); + } + itemData.caches[l] = pathStringTransformed; + } else pathStringTransformed = itemData.caches[l]; + itemData.styles[l].d += true === styleData.hd ? '' : pathStringTransformed; + itemData.styles[l]._mdf = redraw || itemData.styles[l]._mdf; + } + } + function renderFill(styleData, itemData, isFirstFrame) { + var styleElem = itemData.style; + if (itemData.c._mdf || isFirstFrame) styleElem.pElem.setAttribute('fill', 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')'); + if (itemData.o._mdf || isFirstFrame) styleElem.pElem.setAttribute('fill-opacity', itemData.o.v); + } + function renderGradientStroke(styleData, itemData, isFirstFrame) { + renderGradient(styleData, itemData, isFirstFrame); + renderStroke(styleData, itemData, isFirstFrame); + } + function renderGradient(styleData, itemData, isFirstFrame) { + var gfill = itemData.gf; + var hasOpacity = itemData.g._hasOpacity; + var pt1 = itemData.s.v; + var pt2 = itemData.e.v; + if (itemData.o._mdf || isFirstFrame) { + var attr = 'gf' === styleData.ty ? 'fill-opacity' : 'stroke-opacity'; + itemData.style.pElem.setAttribute(attr, itemData.o.v); + } + if (itemData.s._mdf || isFirstFrame) { + var attr1 = 1 === styleData.t ? 'x1' : 'cx'; + var attr2 = 'x1' === attr1 ? 'y1' : 'cy'; + gfill.setAttribute(attr1, pt1[0]); + gfill.setAttribute(attr2, pt1[1]); + if (hasOpacity && !itemData.g._collapsable) { + itemData.of.setAttribute(attr1, pt1[0]); + itemData.of.setAttribute(attr2, pt1[1]); + } + } + var stops; + var i; + var len; + var stop; + if (itemData.g._cmdf || isFirstFrame) { + stops = itemData.cst; + var cValues = itemData.g.c; + len = stops.length; + for(i = 0; i < len; i += 1){ + stop = stops[i]; + stop.setAttribute('offset', cValues[4 * i] + '%'); + stop.setAttribute('stop-color', 'rgb(' + cValues[4 * i + 1] + ',' + cValues[4 * i + 2] + ',' + cValues[4 * i + 3] + ')'); + } + } + if (hasOpacity && (itemData.g._omdf || isFirstFrame)) { + var oValues = itemData.g.o; + stops = itemData.g._collapsable ? itemData.cst : itemData.ost; + len = stops.length; + for(i = 0; i < len; i += 1){ + stop = stops[i]; + if (!itemData.g._collapsable) stop.setAttribute('offset', oValues[2 * i] + '%'); + stop.setAttribute('stop-opacity', oValues[2 * i + 1]); + } + } + if (1 === styleData.t) { + if (itemData.e._mdf || isFirstFrame) { + gfill.setAttribute('x2', pt2[0]); + gfill.setAttribute('y2', pt2[1]); + if (hasOpacity && !itemData.g._collapsable) { + itemData.of.setAttribute('x2', pt2[0]); + itemData.of.setAttribute('y2', pt2[1]); + } + } + } else { + var rad; + if (itemData.s._mdf || itemData.e._mdf || isFirstFrame) { + rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2)); + gfill.setAttribute('r', rad); + if (hasOpacity && !itemData.g._collapsable) itemData.of.setAttribute('r', rad); + } + if (itemData.s._mdf || itemData.e._mdf || itemData.h._mdf || itemData.a._mdf || isFirstFrame) { + if (!rad) rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2)); + var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]); + var percent = itemData.h.v; + if (percent >= 1) percent = 0.99; + else if (percent <= -1) percent = -0.99; + var dist = rad * percent; + var x = Math.cos(ang + itemData.a.v) * dist + pt1[0]; + var y = Math.sin(ang + itemData.a.v) * dist + pt1[1]; + gfill.setAttribute('fx', x); + gfill.setAttribute('fy', y); + if (hasOpacity && !itemData.g._collapsable) { + itemData.of.setAttribute('fx', x); + itemData.of.setAttribute('fy', y); + } + } + } + } + function renderStroke(styleData, itemData, isFirstFrame) { + var styleElem = itemData.style; + var d = itemData.d; + if (d && (d._mdf || isFirstFrame) && d.dashStr) { + styleElem.pElem.setAttribute('stroke-dasharray', d.dashStr); + styleElem.pElem.setAttribute('stroke-dashoffset', d.dashoffset[0]); + } + if (itemData.c && (itemData.c._mdf || isFirstFrame)) styleElem.pElem.setAttribute('stroke', 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')'); + if (itemData.o._mdf || isFirstFrame) styleElem.pElem.setAttribute('stroke-opacity', itemData.o.v); + if (itemData.w._mdf || isFirstFrame) { + styleElem.pElem.setAttribute('stroke-width', itemData.w.v); + if (styleElem.msElem) styleElem.msElem.setAttribute('stroke-width', itemData.w.v); + } + } + return ob; + }(); + function SVGShapeElement(data, globalData, comp) { + this.shapes = []; + this.shapesData = data.shapes; + this.stylesList = []; + this.shapeModifiers = []; + this.itemsData = []; + this.processedElements = []; + this.animatedContents = []; + this.initElement(data, globalData, comp); + this.prevViewData = []; + } + extendPrototype([ + BaseElement, + TransformElement, + SVGBaseElement, + IShapeElement, + HierarchyElement, + FrameElement, + RenderableDOMElement + ], SVGShapeElement); + SVGShapeElement.prototype.initSecondaryElement = function() {}; + SVGShapeElement.prototype.identityMatrix = new Matrix(); + SVGShapeElement.prototype.buildExpressionInterface = function() {}; + SVGShapeElement.prototype.createContent = function() { + this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true); + this.filterUniqueShapes(); + }; + SVGShapeElement.prototype.filterUniqueShapes = function() { + var i; + var len = this.shapes.length; + var shape; + var j; + var jLen = this.stylesList.length; + var style; + var tempShapes = []; + var areAnimated = false; + for(j = 0; j < jLen; j += 1){ + style = this.stylesList[j]; + areAnimated = false; + tempShapes.length = 0; + for(i = 0; i < len; i += 1){ + shape = this.shapes[i]; + if (-1 !== shape.styles.indexOf(style)) { + tempShapes.push(shape); + areAnimated = shape._isAnimated || areAnimated; + } + } + if (tempShapes.length > 1 && areAnimated) this.setShapesAsAnimated(tempShapes); + } + }; + SVGShapeElement.prototype.setShapesAsAnimated = function(shapes) { + var i; + var len = shapes.length; + for(i = 0; i < len; i += 1)shapes[i].setAsAnimated(); + }; + SVGShapeElement.prototype.createStyleElement = function(data, level) { + var elementData; + var styleOb = new SVGStyleData(data, level); + var pathElement = styleOb.pElem; + if ('st' === data.ty) elementData = new SVGStrokeStyleData(this, data, styleOb); + else if ('fl' === data.ty) elementData = new SVGFillStyleData(this, data, styleOb); + else if ('gf' === data.ty || 'gs' === data.ty) { + var GradientConstructor = 'gf' === data.ty ? SVGGradientFillStyleData : SVGGradientStrokeStyleData; + elementData = new GradientConstructor(this, data, styleOb); + this.globalData.defs.appendChild(elementData.gf); + if (elementData.maskId) { + this.globalData.defs.appendChild(elementData.ms); + this.globalData.defs.appendChild(elementData.of); + pathElement.setAttribute('mask', 'url(' + getLocationHref() + '#' + elementData.maskId + ')'); + } + } else if ('no' === data.ty) elementData = new SVGNoStyleData(this, data, styleOb); + if ('st' === data.ty || 'gs' === data.ty) { + pathElement.setAttribute('stroke-linecap', lineCapEnum[data.lc || 2]); + pathElement.setAttribute('stroke-linejoin', lineJoinEnum[data.lj || 2]); + pathElement.setAttribute('fill-opacity', '0'); + if (1 === data.lj) pathElement.setAttribute('stroke-miterlimit', data.ml); + } + if (2 === data.r) pathElement.setAttribute('fill-rule', 'evenodd'); + if (data.ln) pathElement.setAttribute('id', data.ln); + if (data.cl) pathElement.setAttribute('class', data.cl); + if (data.bm) pathElement.style['mix-blend-mode'] = getBlendMode(data.bm); + this.stylesList.push(styleOb); + this.addToAnimatedContents(data, elementData); + return elementData; + }; + SVGShapeElement.prototype.createGroupElement = function(data) { + var elementData = new ShapeGroupData(); + if (data.ln) elementData.gr.setAttribute('id', data.ln); + if (data.cl) elementData.gr.setAttribute('class', data.cl); + if (data.bm) elementData.gr.style['mix-blend-mode'] = getBlendMode(data.bm); + return elementData; + }; + SVGShapeElement.prototype.createTransformElement = function(data, container) { + var transformProperty = TransformPropertyFactory.getTransformProperty(this, data, this); + var elementData = new SVGTransformData(transformProperty, transformProperty.o, container); + this.addToAnimatedContents(data, elementData); + return elementData; + }; + SVGShapeElement.prototype.createShapeElement = function(data, ownTransformers, level) { + var ty = 4; + if ('rc' === data.ty) ty = 5; + else if ('el' === data.ty) ty = 6; + else if ('sr' === data.ty) ty = 7; + var shapeProperty = ShapePropertyFactory.getShapeProp(this, data, ty, this); + var elementData = new SVGShapeData(ownTransformers, level, shapeProperty); + this.shapes.push(elementData); + this.addShapeToModifiers(elementData); + this.addToAnimatedContents(data, elementData); + return elementData; + }; + SVGShapeElement.prototype.addToAnimatedContents = function(data, element) { + var i = 0; + var len = this.animatedContents.length; + while(i < len){ + if (this.animatedContents[i].element === element) return; + i += 1; + } + this.animatedContents.push({ + fn: SVGElementsRenderer.createRenderFunction(data), + element: element, + data: data + }); + }; + SVGShapeElement.prototype.setElementStyles = function(elementData) { + var arr = elementData.styles; + var j; + var jLen = this.stylesList.length; + for(j = 0; j < jLen; j += 1)if (-1 === arr.indexOf(this.stylesList[j]) && !this.stylesList[j].closed) arr.push(this.stylesList[j]); + }; + SVGShapeElement.prototype.reloadShapes = function() { + this._isFirstFrame = true; + var i; + var len = this.itemsData.length; + for(i = 0; i < len; i += 1)this.prevViewData[i] = this.itemsData[i]; + this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true); + this.filterUniqueShapes(); + len = this.dynamicProperties.length; + for(i = 0; i < len; i += 1)this.dynamicProperties[i].getValue(); + this.renderModifiers(); + }; + SVGShapeElement.prototype.searchShapes = function(arr, itemsData, prevViewData, container, level, transformers, render) { + var ownTransformers = [].concat(transformers); + var i; + var len = arr.length - 1; + var j; + var jLen; + var ownStyles = []; + var ownModifiers = []; + var currentTransform; + var modifier; + var processedPos; + for(i = len; i >= 0; i -= 1){ + processedPos = this.searchProcessedElement(arr[i]); + if (processedPos) itemsData[i] = prevViewData[processedPos - 1]; + else arr[i]._render = render; + if ('fl' === arr[i].ty || 'st' === arr[i].ty || 'gf' === arr[i].ty || 'gs' === arr[i].ty || 'no' === arr[i].ty) { + if (processedPos) itemsData[i].style.closed = arr[i].hd; + else itemsData[i] = this.createStyleElement(arr[i], level); + if (arr[i]._render) { + if (itemsData[i].style.pElem.parentNode !== container) container.appendChild(itemsData[i].style.pElem); + } + ownStyles.push(itemsData[i].style); + } else if ('gr' === arr[i].ty) { + if (processedPos) { + jLen = itemsData[i].it.length; + for(j = 0; j < jLen; j += 1)itemsData[i].prevViewData[j] = itemsData[i].it[j]; + } else itemsData[i] = this.createGroupElement(arr[i]); + this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, itemsData[i].gr, level + 1, ownTransformers, render); + if (arr[i]._render) { + if (itemsData[i].gr.parentNode !== container) container.appendChild(itemsData[i].gr); + } + } else if ('tr' === arr[i].ty) { + if (!processedPos) itemsData[i] = this.createTransformElement(arr[i], container); + currentTransform = itemsData[i].transform; + ownTransformers.push(currentTransform); + } else if ('sh' === arr[i].ty || 'rc' === arr[i].ty || 'el' === arr[i].ty || 'sr' === arr[i].ty) { + if (!processedPos) itemsData[i] = this.createShapeElement(arr[i], ownTransformers, level); + this.setElementStyles(itemsData[i]); + } else if ('tm' === arr[i].ty || 'rd' === arr[i].ty || 'ms' === arr[i].ty || 'pb' === arr[i].ty || 'zz' === arr[i].ty || 'op' === arr[i].ty) { + if (processedPos) { + modifier = itemsData[i]; + modifier.closed = false; + } else { + modifier = ShapeModifiers.getModifier(arr[i].ty); + modifier.init(this, arr[i]); + itemsData[i] = modifier; + this.shapeModifiers.push(modifier); + } + ownModifiers.push(modifier); + } else if ('rp' === arr[i].ty) { + if (processedPos) { + modifier = itemsData[i]; + modifier.closed = true; + } else { + modifier = ShapeModifiers.getModifier(arr[i].ty); + itemsData[i] = modifier; + modifier.init(this, arr, i, itemsData); + this.shapeModifiers.push(modifier); + render = false; + } + ownModifiers.push(modifier); + } + this.addProcessedElement(arr[i], i + 1); + } + len = ownStyles.length; + for(i = 0; i < len; i += 1)ownStyles[i].closed = true; + len = ownModifiers.length; + for(i = 0; i < len; i += 1)ownModifiers[i].closed = true; + }; + SVGShapeElement.prototype.renderInnerContent = function() { + this.renderModifiers(); + var i; + var len = this.stylesList.length; + for(i = 0; i < len; i += 1)this.stylesList[i].reset(); + this.renderShape(); + for(i = 0; i < len; i += 1)if (this.stylesList[i]._mdf || this._isFirstFrame) { + if (this.stylesList[i].msElem) { + this.stylesList[i].msElem.setAttribute('d', this.stylesList[i].d); + this.stylesList[i].d = 'M0 0' + this.stylesList[i].d; + } + this.stylesList[i].pElem.setAttribute('d', this.stylesList[i].d || 'M0 0'); + } + }; + SVGShapeElement.prototype.renderShape = function() { + var i; + var len = this.animatedContents.length; + var animatedContent; + for(i = 0; i < len; i += 1){ + animatedContent = this.animatedContents[i]; + if ((this._isFirstFrame || animatedContent.element._isAnimated) && true !== animatedContent.data) animatedContent.fn(animatedContent.data, animatedContent.element, this._isFirstFrame); + } + }; + SVGShapeElement.prototype.destroy = function() { + this.destroyBaseElement(); + this.shapesData = null; + this.itemsData = null; + }; + function LetterProps(o, sw, sc, fc, m, p) { + this.o = o; + this.sw = sw; + this.sc = sc; + this.fc = fc; + this.m = m; + this.p = p; + this._mdf = { + o: true, + sw: !!sw, + sc: !!sc, + fc: !!fc, + m: true, + p: true + }; + } + LetterProps.prototype.update = function(o, sw, sc, fc, m, p) { + this._mdf.o = false; + this._mdf.sw = false; + this._mdf.sc = false; + this._mdf.fc = false; + this._mdf.m = false; + this._mdf.p = false; + var updated = false; + if (this.o !== o) { + this.o = o; + this._mdf.o = true; + updated = true; + } + if (this.sw !== sw) { + this.sw = sw; + this._mdf.sw = true; + updated = true; + } + if (this.sc !== sc) { + this.sc = sc; + this._mdf.sc = true; + updated = true; + } + if (this.fc !== fc) { + this.fc = fc; + this._mdf.fc = true; + updated = true; + } + if (this.m !== m) { + this.m = m; + this._mdf.m = true; + updated = true; + } + if (p.length && (this.p[0] !== p[0] || this.p[1] !== p[1] || this.p[4] !== p[4] || this.p[5] !== p[5] || this.p[12] !== p[12] || this.p[13] !== p[13])) { + this.p = p; + this._mdf.p = true; + updated = true; + } + return updated; + }; + function TextProperty(elem, data) { + this._frameId = initialDefaultFrame; + this.pv = ''; + this.v = ''; + this.kf = false; + this._isFirstFrame = true; + this._mdf = false; + if (data.d && data.d.sid) data.d = elem.globalData.slotManager.getProp(data.d); + this.data = data; + this.elem = elem; + this.comp = this.elem.comp; + this.keysIndex = 0; + this.canResize = false; + this.minimumFontSize = 1; + this.effectsSequence = []; + this.currentData = { + ascent: 0, + boxWidth: this.defaultBoxWidth, + f: '', + fStyle: '', + fWeight: '', + fc: '', + j: '', + justifyOffset: '', + l: [], + lh: 0, + lineWidths: [], + ls: '', + of: '', + s: '', + sc: '', + sw: 0, + t: 0, + tr: 0, + sz: 0, + ps: null, + fillColorAnim: false, + strokeColorAnim: false, + strokeWidthAnim: false, + yOffset: 0, + finalSize: 0, + finalText: [], + finalLineHeight: 0, + __complete: false + }; + this.copyData(this.currentData, this.data.d.k[0].s); + if (!this.searchProperty()) this.completeTextData(this.currentData); + } + TextProperty.prototype.defaultBoxWidth = [ + 0, + 0 + ]; + TextProperty.prototype.copyData = function(obj, data) { + for(var s in data)if (Object.prototype.hasOwnProperty.call(data, s)) obj[s] = data[s]; + return obj; + }; + TextProperty.prototype.setCurrentData = function(data) { + if (!data.__complete) this.completeTextData(data); + this.currentData = data; + this.currentData.boxWidth = this.currentData.boxWidth || this.defaultBoxWidth; + this._mdf = true; + }; + TextProperty.prototype.searchProperty = function() { + return this.searchKeyframes(); + }; + TextProperty.prototype.searchKeyframes = function() { + this.kf = this.data.d.k.length > 1; + if (this.kf) this.addEffect(this.getKeyframeValue.bind(this)); + return this.kf; + }; + TextProperty.prototype.addEffect = function(effectFunction) { + this.effectsSequence.push(effectFunction); + this.elem.addDynamicProperty(this); + }; + TextProperty.prototype.getValue = function(_finalValue) { + if ((this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) && !_finalValue) return; + this.currentData.t = this.data.d.k[this.keysIndex].s.t; + var currentValue = this.currentData; + var currentIndex = this.keysIndex; + if (this.lock) return void this.setCurrentData(this.currentData); + this.lock = true; + this._mdf = false; + var i; + var len = this.effectsSequence.length; + var finalValue = _finalValue || this.data.d.k[this.keysIndex].s; + for(i = 0; i < len; i += 1)finalValue = currentIndex !== this.keysIndex ? this.effectsSequence[i](finalValue, finalValue.t) : this.effectsSequence[i](this.currentData, finalValue.t); + if (currentValue !== finalValue) this.setCurrentData(finalValue); + this.v = this.currentData; + this.pv = this.v; + this.lock = false; + this.frameId = this.elem.globalData.frameId; + }; + TextProperty.prototype.getKeyframeValue = function() { + var textKeys = this.data.d.k; + var frameNum = this.elem.comp.renderedFrame; + var i = 0; + var len = textKeys.length; + while(i <= len - 1){ + if (i === len - 1 || textKeys[i + 1].t > frameNum) break; + i += 1; + } + if (this.keysIndex !== i) this.keysIndex = i; + return this.data.d.k[this.keysIndex].s; + }; + TextProperty.prototype.buildFinalText = function(text) { + var charactersArray = []; + var i = 0; + var len = text.length; + var charCode; + var secondCharCode; + var shouldCombine = false; + var shouldCombineNext = false; + var currentChars = ''; + while(i < len){ + shouldCombine = shouldCombineNext; + shouldCombineNext = false; + charCode = text.charCodeAt(i); + currentChars = text.charAt(i); + if (FontManager.isCombinedCharacter(charCode)) shouldCombine = true; + else if (charCode >= 0xD800 && charCode <= 0xDBFF) if (FontManager.isRegionalFlag(text, i)) currentChars = text.substr(i, 14); + else { + secondCharCode = text.charCodeAt(i + 1); + if (secondCharCode >= 0xDC00 && secondCharCode <= 0xDFFF) if (FontManager.isModifier(charCode, secondCharCode)) { + currentChars = text.substr(i, 2); + shouldCombine = true; + } else currentChars = FontManager.isFlagEmoji(text.substr(i, 4)) ? text.substr(i, 4) : text.substr(i, 2); + } + else if (charCode > 0xDBFF) { + secondCharCode = text.charCodeAt(i + 1); + if (FontManager.isVariationSelector(charCode)) shouldCombine = true; + } else if (FontManager.isZeroWidthJoiner(charCode)) { + shouldCombine = true; + shouldCombineNext = true; + } + if (shouldCombine) { + charactersArray[charactersArray.length - 1] += currentChars; + shouldCombine = false; + } else charactersArray.push(currentChars); + i += currentChars.length; + } + return charactersArray; + }; + TextProperty.prototype.completeTextData = function(documentData) { + documentData.__complete = true; + var fontManager = this.elem.globalData.fontManager; + var data = this.data; + var letters = []; + var i; + var len; + var newLineFlag; + var index = 0; + var val; + var anchorGrouping = data.m.g; + var currentSize = 0; + var currentPos = 0; + var currentLine = 0; + var lineWidths = []; + var lineWidth = 0; + var maxLineWidth = 0; + var j; + var jLen; + var fontData = fontManager.getFontByName(documentData.f); + var charData; + var cLength = 0; + var fontProps = getFontProperties(fontData); + documentData.fWeight = fontProps.weight; + documentData.fStyle = fontProps.style; + documentData.finalSize = documentData.s; + documentData.finalText = this.buildFinalText(documentData.t); + len = documentData.finalText.length; + documentData.finalLineHeight = documentData.lh; + var trackingOffset = documentData.tr / 1000 * documentData.finalSize; + var charCode; + if (documentData.sz) { + var flag = true; + var boxWidth = documentData.sz[0]; + var boxHeight = documentData.sz[1]; + var currentHeight; + var finalText; + while(flag){ + finalText = this.buildFinalText(documentData.t); + currentHeight = 0; + lineWidth = 0; + len = finalText.length; + trackingOffset = documentData.tr / 1000 * documentData.finalSize; + var lastSpaceIndex = -1; + for(i = 0; i < len; i += 1){ + charCode = finalText[i].charCodeAt(0); + newLineFlag = false; + if (' ' === finalText[i]) lastSpaceIndex = i; + else if (13 === charCode || 3 === charCode) { + lineWidth = 0; + newLineFlag = true; + currentHeight += documentData.finalLineHeight || 1.2 * documentData.finalSize; + } + if (fontManager.chars) { + charData = fontManager.getCharData(finalText[i], fontData.fStyle, fontData.fFamily); + cLength = newLineFlag ? 0 : charData.w * documentData.finalSize / 100; + } else cLength = fontManager.measureText(finalText[i], documentData.f, documentData.finalSize); + if (lineWidth + cLength > boxWidth && ' ' !== finalText[i]) { + if (-1 === lastSpaceIndex) len += 1; + else i = lastSpaceIndex; + currentHeight += documentData.finalLineHeight || 1.2 * documentData.finalSize; + finalText.splice(i, lastSpaceIndex === i ? 1 : 0, '\r'); + lastSpaceIndex = -1; + lineWidth = 0; + } else { + lineWidth += cLength; + lineWidth += trackingOffset; + } + } + currentHeight += fontData.ascent * documentData.finalSize / 100; + if (this.canResize && documentData.finalSize > this.minimumFontSize && boxHeight < currentHeight) { + documentData.finalSize -= 1; + documentData.finalLineHeight = documentData.finalSize * documentData.lh / documentData.s; + } else { + documentData.finalText = finalText; + len = documentData.finalText.length; + flag = false; + } + } + } + lineWidth = -trackingOffset; + cLength = 0; + var uncollapsedSpaces = 0; + var currentChar; + for(i = 0; i < len; i += 1){ + newLineFlag = false; + currentChar = documentData.finalText[i]; + charCode = currentChar.charCodeAt(0); + if (13 === charCode || 3 === charCode) { + uncollapsedSpaces = 0; + lineWidths.push(lineWidth); + maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth; + lineWidth = -2 * trackingOffset; + val = ''; + newLineFlag = true; + currentLine += 1; + } else val = currentChar; + if (fontManager.chars) { + charData = fontManager.getCharData(currentChar, fontData.fStyle, fontManager.getFontByName(documentData.f).fFamily); + cLength = newLineFlag ? 0 : charData.w * documentData.finalSize / 100; + } else cLength = fontManager.measureText(val, documentData.f, documentData.finalSize); + if (' ' === currentChar) uncollapsedSpaces += cLength + trackingOffset; + else { + lineWidth += cLength + trackingOffset + uncollapsedSpaces; + uncollapsedSpaces = 0; + } + letters.push({ + l: cLength, + an: cLength, + add: currentSize, + n: newLineFlag, + anIndexes: [], + val: val, + line: currentLine, + animatorJustifyOffset: 0 + }); + if (2 == anchorGrouping) { + currentSize += cLength; + if ('' === val || ' ' === val || i === len - 1) { + if ('' === val || ' ' === val) currentSize -= cLength; + while(currentPos <= i){ + letters[currentPos].an = currentSize; + letters[currentPos].ind = index; + letters[currentPos].extra = cLength; + currentPos += 1; + } + index += 1; + currentSize = 0; + } + } else if (3 == anchorGrouping) { + currentSize += cLength; + if ('' === val || i === len - 1) { + if ('' === val) currentSize -= cLength; + while(currentPos <= i){ + letters[currentPos].an = currentSize; + letters[currentPos].ind = index; + letters[currentPos].extra = cLength; + currentPos += 1; + } + currentSize = 0; + index += 1; + } + } else { + letters[index].ind = index; + letters[index].extra = 0; + index += 1; + } + } + documentData.l = letters; + maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth; + lineWidths.push(lineWidth); + if (documentData.sz) { + documentData.boxWidth = documentData.sz[0]; + documentData.justifyOffset = 0; + } else { + documentData.boxWidth = maxLineWidth; + switch(documentData.j){ + case 1: + documentData.justifyOffset = -documentData.boxWidth; + break; + case 2: + documentData.justifyOffset = -documentData.boxWidth / 2; + break; + default: + documentData.justifyOffset = 0; + } + } + documentData.lineWidths = lineWidths; + var animators = data.a; + var animatorData; + var letterData; + jLen = animators.length; + var based; + var ind; + var indexes = []; + for(j = 0; j < jLen; j += 1){ + animatorData = animators[j]; + if (animatorData.a.sc) documentData.strokeColorAnim = true; + if (animatorData.a.sw) documentData.strokeWidthAnim = true; + if (animatorData.a.fc || animatorData.a.fh || animatorData.a.fs || animatorData.a.fb) documentData.fillColorAnim = true; + ind = 0; + based = animatorData.s.b; + for(i = 0; i < len; i += 1){ + letterData = letters[i]; + letterData.anIndexes[j] = ind; + if (1 == based && '' !== letterData.val || 2 == based && '' !== letterData.val && ' ' !== letterData.val || 3 == based && (letterData.n || ' ' == letterData.val || i == len - 1) || 4 == based && (letterData.n || i == len - 1)) { + if (1 === animatorData.s.rn) indexes.push(ind); + ind += 1; + } + } + data.a[j].s.totalChars = ind; + var currentInd = -1; + var newInd; + if (1 === animatorData.s.rn) for(i = 0; i < len; i += 1){ + letterData = letters[i]; + if (currentInd != letterData.anIndexes[j]) { + currentInd = letterData.anIndexes[j]; + newInd = indexes.splice(Math.floor(Math.random() * indexes.length), 1)[0]; + } + letterData.anIndexes[j] = newInd; + } + } + documentData.yOffset = documentData.finalLineHeight || 1.2 * documentData.finalSize; + documentData.ls = documentData.ls || 0; + documentData.ascent = fontData.ascent * documentData.finalSize / 100; + }; + TextProperty.prototype.updateDocumentData = function(newData, index) { + index = void 0 === index ? this.keysIndex : index; + var dData = this.copyData({}, this.data.d.k[index].s); + dData = this.copyData(dData, newData); + this.data.d.k[index].s = dData; + this.recalculate(index); + this.setCurrentData(dData); + this.elem.addDynamicProperty(this); + }; + TextProperty.prototype.recalculate = function(index) { + var dData = this.data.d.k[index].s; + dData.__complete = false; + this.keysIndex = 0; + this._isFirstFrame = true; + this.getValue(dData); + }; + TextProperty.prototype.canResizeFont = function(_canResize) { + this.canResize = _canResize; + this.recalculate(this.keysIndex); + this.elem.addDynamicProperty(this); + }; + TextProperty.prototype.setMinimumFontSize = function(_fontValue) { + this.minimumFontSize = Math.floor(_fontValue) || 1; + this.recalculate(this.keysIndex); + this.elem.addDynamicProperty(this); + }; + var TextSelectorProp = function() { + var max = Math.max; + var min = Math.min; + var floor = Math.floor; + function TextSelectorPropFactory(elem, data) { + this._currentTextLength = -1; + this.k = false; + this.data = data; + this.elem = elem; + this.comp = elem.comp; + this.finalS = 0; + this.finalE = 0; + this.initDynamicPropertyContainer(elem); + this.s = PropertyFactory.getProp(elem, data.s || { + k: 0 + }, 0, 0, this); + if ('e' in data) this.e = PropertyFactory.getProp(elem, data.e, 0, 0, this); + else this.e = { + v: 100 + }; + this.o = PropertyFactory.getProp(elem, data.o || { + k: 0 + }, 0, 0, this); + this.xe = PropertyFactory.getProp(elem, data.xe || { + k: 0 + }, 0, 0, this); + this.ne = PropertyFactory.getProp(elem, data.ne || { + k: 0 + }, 0, 0, this); + this.sm = PropertyFactory.getProp(elem, data.sm || { + k: 100 + }, 0, 0, this); + this.a = PropertyFactory.getProp(elem, data.a, 0, 0.01, this); + if (!this.dynamicProperties.length) this.getValue(); + } + TextSelectorPropFactory.prototype = { + getMult: function(ind) { + if (this._currentTextLength !== this.elem.textProperty.currentData.l.length) this.getValue(); + var x1 = 0; + var y1 = 0; + var x2 = 1; + var y2 = 1; + if (this.ne.v > 0) x1 = this.ne.v / 100.0; + else y1 = -this.ne.v / 100.0; + if (this.xe.v > 0) x2 = 1.0 - this.xe.v / 100.0; + else y2 = 1.0 + this.xe.v / 100.0; + var easer = BezierFactory.getBezierEasing(x1, y1, x2, y2).get; + var mult = 0; + var s = this.finalS; + var e = this.finalE; + var type = this.data.sh; + if (2 === type) { + mult = e === s ? ind >= e ? 1 : 0 : max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1)); + mult = easer(mult); + } else if (3 === type) { + mult = e === s ? ind >= e ? 0 : 1 : 1 - max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1)); + mult = easer(mult); + } else if (4 === type) { + if (e === s) mult = 0; + else { + mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1)); + if (mult < 0.5) mult *= 2; + else mult = 1 - 2 * (mult - 0.5); + } + mult = easer(mult); + } else if (5 === type) { + if (e === s) mult = 0; + else { + var tot = e - s; + ind = min(max(0, ind + 0.5 - s), e - s); + var x = -tot / 2 + ind; + var a = tot / 2; + mult = Math.sqrt(1 - x * x / (a * a)); + } + mult = easer(mult); + } else if (6 === type) { + if (e === s) mult = 0; + else { + ind = min(max(0, ind + 0.5 - s), e - s); + mult = (1 + Math.cos(Math.PI + 2 * Math.PI * ind / (e - s))) / 2; + } + mult = easer(mult); + } else { + if (ind >= floor(s)) mult = ind - s < 0 ? max(0, min(min(e, 1) - (s - ind), 1)) : max(0, min(e - ind, 1)); + mult = easer(mult); + } + if (100 !== this.sm.v) { + var smoothness = 0.01 * this.sm.v; + if (0 === smoothness) smoothness = 0.00000001; + var threshold = 0.5 - 0.5 * smoothness; + if (mult < threshold) mult = 0; + else { + mult = (mult - threshold) / smoothness; + if (mult > 1) mult = 1; + } + } + return mult * this.a.v; + }, + getValue: function(newCharsFlag) { + this.iterateDynamicProperties(); + this._mdf = newCharsFlag || this._mdf; + this._currentTextLength = this.elem.textProperty.currentData.l.length || 0; + if (newCharsFlag && 2 === this.data.r) this.e.v = this._currentTextLength; + var divisor = 2 === this.data.r ? 1 : 100 / this.data.totalChars; + var o = this.o.v / divisor; + var s = this.s.v / divisor + o; + var e = this.e.v / divisor + o; + if (s > e) { + var _s = s; + s = e; + e = _s; + } + this.finalS = s; + this.finalE = e; + } + }; + extendPrototype([ + DynamicPropertyContainer + ], TextSelectorPropFactory); + function getTextSelectorProp(elem, data, arr) { + return new TextSelectorPropFactory(elem, data, arr); + } + return { + getTextSelectorProp: getTextSelectorProp + }; + }(); + function TextAnimatorDataProperty(elem, animatorProps, container) { + var defaultData = { + propType: false + }; + var getProp = PropertyFactory.getProp; + var textAnimatorAnimatables = animatorProps.a; + this.a = { + r: textAnimatorAnimatables.r ? getProp(elem, textAnimatorAnimatables.r, 0, degToRads, container) : defaultData, + rx: textAnimatorAnimatables.rx ? getProp(elem, textAnimatorAnimatables.rx, 0, degToRads, container) : defaultData, + ry: textAnimatorAnimatables.ry ? getProp(elem, textAnimatorAnimatables.ry, 0, degToRads, container) : defaultData, + sk: textAnimatorAnimatables.sk ? getProp(elem, textAnimatorAnimatables.sk, 0, degToRads, container) : defaultData, + sa: textAnimatorAnimatables.sa ? getProp(elem, textAnimatorAnimatables.sa, 0, degToRads, container) : defaultData, + s: textAnimatorAnimatables.s ? getProp(elem, textAnimatorAnimatables.s, 1, 0.01, container) : defaultData, + a: textAnimatorAnimatables.a ? getProp(elem, textAnimatorAnimatables.a, 1, 0, container) : defaultData, + o: textAnimatorAnimatables.o ? getProp(elem, textAnimatorAnimatables.o, 0, 0.01, container) : defaultData, + p: textAnimatorAnimatables.p ? getProp(elem, textAnimatorAnimatables.p, 1, 0, container) : defaultData, + sw: textAnimatorAnimatables.sw ? getProp(elem, textAnimatorAnimatables.sw, 0, 0, container) : defaultData, + sc: textAnimatorAnimatables.sc ? getProp(elem, textAnimatorAnimatables.sc, 1, 0, container) : defaultData, + fc: textAnimatorAnimatables.fc ? getProp(elem, textAnimatorAnimatables.fc, 1, 0, container) : defaultData, + fh: textAnimatorAnimatables.fh ? getProp(elem, textAnimatorAnimatables.fh, 0, 0, container) : defaultData, + fs: textAnimatorAnimatables.fs ? getProp(elem, textAnimatorAnimatables.fs, 0, 0.01, container) : defaultData, + fb: textAnimatorAnimatables.fb ? getProp(elem, textAnimatorAnimatables.fb, 0, 0.01, container) : defaultData, + t: textAnimatorAnimatables.t ? getProp(elem, textAnimatorAnimatables.t, 0, 0, container) : defaultData + }; + this.s = TextSelectorProp.getTextSelectorProp(elem, animatorProps.s, container); + this.s.t = animatorProps.s.t; + } + function TextAnimatorProperty(textData, renderType, elem) { + this._isFirstFrame = true; + this._hasMaskedPath = false; + this._frameId = -1; + this._textData = textData; + this._renderType = renderType; + this._elem = elem; + this._animatorsData = createSizedArray(this._textData.a.length); + this._pathData = {}; + this._moreOptions = { + alignment: {} + }; + this.renderedLetters = []; + this.lettersChangedFlag = false; + this.initDynamicPropertyContainer(elem); + } + TextAnimatorProperty.prototype.searchProperties = function() { + var i; + var len = this._textData.a.length; + var animatorProps; + var getProp = PropertyFactory.getProp; + for(i = 0; i < len; i += 1){ + animatorProps = this._textData.a[i]; + this._animatorsData[i] = new TextAnimatorDataProperty(this._elem, animatorProps, this); + } + if (this._textData.p && 'm' in this._textData.p) { + this._pathData = { + a: getProp(this._elem, this._textData.p.a, 0, 0, this), + f: getProp(this._elem, this._textData.p.f, 0, 0, this), + l: getProp(this._elem, this._textData.p.l, 0, 0, this), + r: getProp(this._elem, this._textData.p.r, 0, 0, this), + p: getProp(this._elem, this._textData.p.p, 0, 0, this), + m: this._elem.maskManager.getMaskProperty(this._textData.p.m) + }; + this._hasMaskedPath = true; + } else this._hasMaskedPath = false; + this._moreOptions.alignment = getProp(this._elem, this._textData.m.a, 1, 0, this); + }; + TextAnimatorProperty.prototype.getMeasures = function(documentData, lettersChangedFlag) { + this.lettersChangedFlag = lettersChangedFlag; + if (!this._mdf && !this._isFirstFrame && !lettersChangedFlag && (!this._hasMaskedPath || !this._pathData.m._mdf)) return; + this._isFirstFrame = false; + var alignment = this._moreOptions.alignment.v; + var animators = this._animatorsData; + var textData = this._textData; + var matrixHelper = this.mHelper; + var renderType = this._renderType; + var renderedLettersCount = this.renderedLetters.length; + var xPos; + var yPos; + var i; + var len; + var letters = documentData.l; + var pathInfo; + var currentLength; + var currentPoint; + var segmentLength; + var flag; + var pointInd; + var segmentInd; + var prevPoint; + var points; + var segments; + var partialLength; + var totalLength; + var perc; + var tanAngle; + var mask; + if (this._hasMaskedPath) { + mask = this._pathData.m; + if (!this._pathData.n || this._pathData._mdf) { + var paths = mask.v; + if (this._pathData.r.v) paths = paths.reverse(); + pathInfo = { + tLength: 0, + segments: [] + }; + len = paths._length - 1; + var bezierData; + totalLength = 0; + for(i = 0; i < len; i += 1){ + bezierData = bez.buildBezierData(paths.v[i], paths.v[i + 1], [ + paths.o[i][0] - paths.v[i][0], + paths.o[i][1] - paths.v[i][1] + ], [ + paths.i[i + 1][0] - paths.v[i + 1][0], + paths.i[i + 1][1] - paths.v[i + 1][1] + ]); + pathInfo.tLength += bezierData.segmentLength; + pathInfo.segments.push(bezierData); + totalLength += bezierData.segmentLength; + } + i = len; + if (mask.v.c) { + bezierData = bez.buildBezierData(paths.v[i], paths.v[0], [ + paths.o[i][0] - paths.v[i][0], + paths.o[i][1] - paths.v[i][1] + ], [ + paths.i[0][0] - paths.v[0][0], + paths.i[0][1] - paths.v[0][1] + ]); + pathInfo.tLength += bezierData.segmentLength; + pathInfo.segments.push(bezierData); + totalLength += bezierData.segmentLength; + } + this._pathData.pi = pathInfo; + } + pathInfo = this._pathData.pi; + currentLength = this._pathData.f.v; + segmentInd = 0; + pointInd = 1; + segmentLength = 0; + flag = true; + segments = pathInfo.segments; + if (currentLength < 0 && mask.v.c) { + if (pathInfo.tLength < Math.abs(currentLength)) currentLength = -Math.abs(currentLength) % pathInfo.tLength; + segmentInd = segments.length - 1; + points = segments[segmentInd].points; + pointInd = points.length - 1; + while(currentLength < 0){ + currentLength += points[pointInd].partialLength; + pointInd -= 1; + if (pointInd < 0) { + segmentInd -= 1; + points = segments[segmentInd].points; + pointInd = points.length - 1; + } + } + } + points = segments[segmentInd].points; + prevPoint = points[pointInd - 1]; + currentPoint = points[pointInd]; + partialLength = currentPoint.partialLength; + } + len = letters.length; + xPos = 0; + yPos = 0; + var yOff = 1.2 * documentData.finalSize * 0.714; + var firstLine = true; + var animatorProps; + var animatorSelector; + var j; + var jLen; + var letterValue; + jLen = animators.length; + var mult; + var ind = -1; + var offf; + var xPathPos; + var yPathPos; + var initPathPos = currentLength; + var initSegmentInd = segmentInd; + var initPointInd = pointInd; + var currentLine = -1; + var elemOpacity; + var sc; + var sw; + var fc; + var k; + var letterSw; + var letterSc; + var letterFc; + var letterM = ''; + var letterP = this.defaultPropsArray; + var letterO; + if (2 === documentData.j || 1 === documentData.j) { + var animatorJustifyOffset = 0; + var animatorFirstCharOffset = 0; + var justifyOffsetMult = 2 === documentData.j ? -0.5 : -1; + var lastIndex = 0; + var isNewLine = true; + for(i = 0; i < len; i += 1)if (letters[i].n) { + if (animatorJustifyOffset) animatorJustifyOffset += animatorFirstCharOffset; + while(lastIndex < i){ + letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset; + lastIndex += 1; + } + animatorJustifyOffset = 0; + isNewLine = true; + } else { + for(j = 0; j < jLen; j += 1){ + animatorProps = animators[j].a; + if (animatorProps.t.propType) { + if (isNewLine && 2 === documentData.j) animatorFirstCharOffset += animatorProps.t.v * justifyOffsetMult; + animatorSelector = animators[j].s; + mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars); + if (mult.length) animatorJustifyOffset += animatorProps.t.v * mult[0] * justifyOffsetMult; + else animatorJustifyOffset += animatorProps.t.v * mult * justifyOffsetMult; + } + } + isNewLine = false; + } + if (animatorJustifyOffset) animatorJustifyOffset += animatorFirstCharOffset; + while(lastIndex < i){ + letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset; + lastIndex += 1; + } + } + for(i = 0; i < len; i += 1){ + matrixHelper.reset(); + elemOpacity = 1; + if (letters[i].n) { + xPos = 0; + yPos += documentData.yOffset; + yPos += firstLine ? 1 : 0; + currentLength = initPathPos; + firstLine = false; + if (this._hasMaskedPath) { + segmentInd = initSegmentInd; + pointInd = initPointInd; + points = segments[segmentInd].points; + prevPoint = points[pointInd - 1]; + currentPoint = points[pointInd]; + partialLength = currentPoint.partialLength; + segmentLength = 0; + } + letterM = ''; + letterFc = ''; + letterSw = ''; + letterO = ''; + letterP = this.defaultPropsArray; + } else { + if (this._hasMaskedPath) { + if (currentLine !== letters[i].line) { + switch(documentData.j){ + case 1: + currentLength += totalLength - documentData.lineWidths[letters[i].line]; + break; + case 2: + currentLength += (totalLength - documentData.lineWidths[letters[i].line]) / 2; + break; + default: + break; + } + currentLine = letters[i].line; + } + if (ind !== letters[i].ind) { + if (letters[ind]) currentLength += letters[ind].extra; + currentLength += letters[i].an / 2; + ind = letters[i].ind; + } + currentLength += alignment[0] * letters[i].an * 0.005; + var animatorOffset = 0; + for(j = 0; j < jLen; j += 1){ + animatorProps = animators[j].a; + if (animatorProps.p.propType) { + animatorSelector = animators[j].s; + mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars); + if (mult.length) animatorOffset += animatorProps.p.v[0] * mult[0]; + else animatorOffset += animatorProps.p.v[0] * mult; + } + if (animatorProps.a.propType) { + animatorSelector = animators[j].s; + mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars); + if (mult.length) animatorOffset += animatorProps.a.v[0] * mult[0]; + else animatorOffset += animatorProps.a.v[0] * mult; + } + } + flag = true; + if (this._pathData.a.v) { + currentLength = 0.5 * letters[0].an + (totalLength - this._pathData.f.v - 0.5 * letters[0].an - 0.5 * letters[letters.length - 1].an) * ind / (len - 1); + currentLength += this._pathData.f.v; + } + while(flag)if (segmentLength + partialLength >= currentLength + animatorOffset || !points) { + perc = (currentLength + animatorOffset - segmentLength) / currentPoint.partialLength; + xPathPos = prevPoint.point[0] + (currentPoint.point[0] - prevPoint.point[0]) * perc; + yPathPos = prevPoint.point[1] + (currentPoint.point[1] - prevPoint.point[1]) * perc; + matrixHelper.translate(-alignment[0] * letters[i].an * 0.005, 0.01 * -(alignment[1] * yOff)); + flag = false; + } else if (points) { + segmentLength += currentPoint.partialLength; + pointInd += 1; + if (pointInd >= points.length) { + pointInd = 0; + segmentInd += 1; + if (segments[segmentInd]) points = segments[segmentInd].points; + else if (mask.v.c) { + pointInd = 0; + segmentInd = 0; + points = segments[segmentInd].points; + } else { + segmentLength -= currentPoint.partialLength; + points = null; + } + } + if (points) { + prevPoint = currentPoint; + currentPoint = points[pointInd]; + partialLength = currentPoint.partialLength; + } + } + offf = letters[i].an / 2 - letters[i].add; + matrixHelper.translate(-offf, 0, 0); + } else { + offf = letters[i].an / 2 - letters[i].add; + matrixHelper.translate(-offf, 0, 0); + matrixHelper.translate(-alignment[0] * letters[i].an * 0.005, -alignment[1] * yOff * 0.01, 0); + } + for(j = 0; j < jLen; j += 1){ + animatorProps = animators[j].a; + if (animatorProps.t.propType) { + animatorSelector = animators[j].s; + mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars); + if (0 !== xPos || 0 !== documentData.j) if (this._hasMaskedPath) if (mult.length) currentLength += animatorProps.t.v * mult[0]; + else currentLength += animatorProps.t.v * mult; + else if (mult.length) xPos += animatorProps.t.v * mult[0]; + else xPos += animatorProps.t.v * mult; + } + } + if (documentData.strokeWidthAnim) sw = documentData.sw || 0; + if (documentData.strokeColorAnim) sc = documentData.sc ? [ + documentData.sc[0], + documentData.sc[1], + documentData.sc[2] + ] : [ + 0, + 0, + 0 + ]; + if (documentData.fillColorAnim && documentData.fc) fc = [ + documentData.fc[0], + documentData.fc[1], + documentData.fc[2] + ]; + for(j = 0; j < jLen; j += 1){ + animatorProps = animators[j].a; + if (animatorProps.a.propType) { + animatorSelector = animators[j].s; + mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars); + if (mult.length) matrixHelper.translate(-animatorProps.a.v[0] * mult[0], -animatorProps.a.v[1] * mult[1], animatorProps.a.v[2] * mult[2]); + else matrixHelper.translate(-animatorProps.a.v[0] * mult, -animatorProps.a.v[1] * mult, animatorProps.a.v[2] * mult); + } + } + for(j = 0; j < jLen; j += 1){ + animatorProps = animators[j].a; + if (animatorProps.s.propType) { + animatorSelector = animators[j].s; + mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars); + if (mult.length) matrixHelper.scale(1 + (animatorProps.s.v[0] - 1) * mult[0], 1 + (animatorProps.s.v[1] - 1) * mult[1], 1); + else matrixHelper.scale(1 + (animatorProps.s.v[0] - 1) * mult, 1 + (animatorProps.s.v[1] - 1) * mult, 1); + } + } + for(j = 0; j < jLen; j += 1){ + animatorProps = animators[j].a; + animatorSelector = animators[j].s; + mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars); + if (animatorProps.sk.propType) if (mult.length) matrixHelper.skewFromAxis(-animatorProps.sk.v * mult[0], animatorProps.sa.v * mult[1]); + else matrixHelper.skewFromAxis(-animatorProps.sk.v * mult, animatorProps.sa.v * mult); + if (animatorProps.r.propType) if (mult.length) matrixHelper.rotateZ(-animatorProps.r.v * mult[2]); + else matrixHelper.rotateZ(-animatorProps.r.v * mult); + if (animatorProps.ry.propType) if (mult.length) matrixHelper.rotateY(animatorProps.ry.v * mult[1]); + else matrixHelper.rotateY(animatorProps.ry.v * mult); + if (animatorProps.rx.propType) if (mult.length) matrixHelper.rotateX(animatorProps.rx.v * mult[0]); + else matrixHelper.rotateX(animatorProps.rx.v * mult); + if (animatorProps.o.propType) if (mult.length) elemOpacity += (animatorProps.o.v * mult[0] - elemOpacity) * mult[0]; + else elemOpacity += (animatorProps.o.v * mult - elemOpacity) * mult; + if (documentData.strokeWidthAnim && animatorProps.sw.propType) if (mult.length) sw += animatorProps.sw.v * mult[0]; + else sw += animatorProps.sw.v * mult; + if (documentData.strokeColorAnim && animatorProps.sc.propType) for(k = 0; k < 3; k += 1)if (mult.length) sc[k] += (animatorProps.sc.v[k] - sc[k]) * mult[0]; + else sc[k] += (animatorProps.sc.v[k] - sc[k]) * mult; + if (documentData.fillColorAnim && documentData.fc) { + if (animatorProps.fc.propType) for(k = 0; k < 3; k += 1)if (mult.length) fc[k] += (animatorProps.fc.v[k] - fc[k]) * mult[0]; + else fc[k] += (animatorProps.fc.v[k] - fc[k]) * mult; + if (animatorProps.fh.propType) fc = mult.length ? addHueToRGB(fc, animatorProps.fh.v * mult[0]) : addHueToRGB(fc, animatorProps.fh.v * mult); + if (animatorProps.fs.propType) fc = mult.length ? addSaturationToRGB(fc, animatorProps.fs.v * mult[0]) : addSaturationToRGB(fc, animatorProps.fs.v * mult); + if (animatorProps.fb.propType) fc = mult.length ? addBrightnessToRGB(fc, animatorProps.fb.v * mult[0]) : addBrightnessToRGB(fc, animatorProps.fb.v * mult); + } + } + for(j = 0; j < jLen; j += 1){ + animatorProps = animators[j].a; + if (animatorProps.p.propType) { + animatorSelector = animators[j].s; + mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars); + if (this._hasMaskedPath) if (mult.length) matrixHelper.translate(0, animatorProps.p.v[1] * mult[0], -animatorProps.p.v[2] * mult[1]); + else matrixHelper.translate(0, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult); + else if (mult.length) matrixHelper.translate(animatorProps.p.v[0] * mult[0], animatorProps.p.v[1] * mult[1], -animatorProps.p.v[2] * mult[2]); + else matrixHelper.translate(animatorProps.p.v[0] * mult, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult); + } + } + if (documentData.strokeWidthAnim) letterSw = sw < 0 ? 0 : sw; + if (documentData.strokeColorAnim) letterSc = 'rgb(' + Math.round(255 * sc[0]) + ',' + Math.round(255 * sc[1]) + ',' + Math.round(255 * sc[2]) + ')'; + if (documentData.fillColorAnim && documentData.fc) letterFc = 'rgb(' + Math.round(255 * fc[0]) + ',' + Math.round(255 * fc[1]) + ',' + Math.round(255 * fc[2]) + ')'; + if (this._hasMaskedPath) { + matrixHelper.translate(0, -documentData.ls); + matrixHelper.translate(0, alignment[1] * yOff * 0.01 + yPos, 0); + if (this._pathData.p.v) { + tanAngle = (currentPoint.point[1] - prevPoint.point[1]) / (currentPoint.point[0] - prevPoint.point[0]); + var rot = 180 * Math.atan(tanAngle) / Math.PI; + if (currentPoint.point[0] < prevPoint.point[0]) rot += 180; + matrixHelper.rotate(-rot * Math.PI / 180); + } + matrixHelper.translate(xPathPos, yPathPos, 0); + currentLength -= alignment[0] * letters[i].an * 0.005; + if (letters[i + 1] && ind !== letters[i + 1].ind) { + currentLength += letters[i].an / 2; + currentLength += 0.001 * documentData.tr * documentData.finalSize; + } + } else { + matrixHelper.translate(xPos, yPos, 0); + if (documentData.ps) matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0); + switch(documentData.j){ + case 1: + matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]), 0, 0); + break; + case 2: + matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]) / 2, 0, 0); + break; + default: + break; + } + matrixHelper.translate(0, -documentData.ls); + matrixHelper.translate(offf, 0, 0); + matrixHelper.translate(alignment[0] * letters[i].an * 0.005, alignment[1] * yOff * 0.01, 0); + xPos += letters[i].l + 0.001 * documentData.tr * documentData.finalSize; + } + if ('html' === renderType) letterM = matrixHelper.toCSS(); + else if ('svg' === renderType) letterM = matrixHelper.to2dCSS(); + else letterP = [ + matrixHelper.props[0], + matrixHelper.props[1], + matrixHelper.props[2], + matrixHelper.props[3], + matrixHelper.props[4], + matrixHelper.props[5], + matrixHelper.props[6], + matrixHelper.props[7], + matrixHelper.props[8], + matrixHelper.props[9], + matrixHelper.props[10], + matrixHelper.props[11], + matrixHelper.props[12], + matrixHelper.props[13], + matrixHelper.props[14], + matrixHelper.props[15] + ]; + letterO = elemOpacity; + } + if (renderedLettersCount <= i) { + letterValue = new LetterProps(letterO, letterSw, letterSc, letterFc, letterM, letterP); + this.renderedLetters.push(letterValue); + renderedLettersCount += 1; + this.lettersChangedFlag = true; + } else { + letterValue = this.renderedLetters[i]; + this.lettersChangedFlag = letterValue.update(letterO, letterSw, letterSc, letterFc, letterM, letterP) || this.lettersChangedFlag; + } + } + }; + TextAnimatorProperty.prototype.getValue = function() { + if (this._elem.globalData.frameId === this._frameId) return; + this._frameId = this._elem.globalData.frameId; + this.iterateDynamicProperties(); + }; + TextAnimatorProperty.prototype.mHelper = new Matrix(); + TextAnimatorProperty.prototype.defaultPropsArray = []; + extendPrototype([ + DynamicPropertyContainer + ], TextAnimatorProperty); + function ITextElement() {} + ITextElement.prototype.initElement = function(data, globalData, comp) { + this.lettersChangedFlag = true; + this.initFrame(); + this.initBaseData(data, globalData, comp); + this.textProperty = new TextProperty(this, data.t, this.dynamicProperties); + this.textAnimator = new TextAnimatorProperty(data.t, this.renderType, this); + this.initTransform(data, globalData, comp); + this.initHierarchy(); + this.initRenderable(); + this.initRendererElement(); + this.createContainerElements(); + this.createRenderableComponents(); + this.createContent(); + this.hide(); + this.textAnimator.searchProperties(this.dynamicProperties); + }; + ITextElement.prototype.prepareFrame = function(num) { + this._mdf = false; + this.prepareRenderableFrame(num); + this.prepareProperties(num, this.isInRange); + }; + ITextElement.prototype.createPathShape = function(matrixHelper, shapes) { + var j; + var jLen = shapes.length; + var pathNodes; + var shapeStr = ''; + for(j = 0; j < jLen; j += 1)if ('sh' === shapes[j].ty) { + pathNodes = shapes[j].ks.k; + shapeStr += buildShapeString(pathNodes, pathNodes.i.length, true, matrixHelper); + } + return shapeStr; + }; + ITextElement.prototype.updateDocumentData = function(newData, index) { + this.textProperty.updateDocumentData(newData, index); + }; + ITextElement.prototype.canResizeFont = function(_canResize) { + this.textProperty.canResizeFont(_canResize); + }; + ITextElement.prototype.setMinimumFontSize = function(_fontSize) { + this.textProperty.setMinimumFontSize(_fontSize); + }; + ITextElement.prototype.applyTextPropertiesToMatrix = function(documentData, matrixHelper, lineNumber, xPos, yPos) { + if (documentData.ps) matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0); + matrixHelper.translate(0, -documentData.ls, 0); + switch(documentData.j){ + case 1: + matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]), 0, 0); + break; + case 2: + matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]) / 2, 0, 0); + break; + default: + break; + } + matrixHelper.translate(xPos, yPos, 0); + }; + ITextElement.prototype.buildColor = function(colorData) { + return 'rgb(' + Math.round(255 * colorData[0]) + ',' + Math.round(255 * colorData[1]) + ',' + Math.round(255 * colorData[2]) + ')'; + }; + ITextElement.prototype.emptyProp = new LetterProps(); + ITextElement.prototype.destroy = function() {}; + ITextElement.prototype.validateText = function() { + if (this.textProperty._mdf || this.textProperty._isFirstFrame) { + this.buildNewText(); + this.textProperty._isFirstFrame = false; + this.textProperty._mdf = false; + } + }; + var emptyShapeData = { + shapes: [] + }; + function SVGTextLottieElement(data, globalData, comp) { + this.textSpans = []; + this.renderType = 'svg'; + this.initElement(data, globalData, comp); + } + extendPrototype([ + BaseElement, + TransformElement, + SVGBaseElement, + HierarchyElement, + FrameElement, + RenderableDOMElement, + ITextElement + ], SVGTextLottieElement); + SVGTextLottieElement.prototype.createContent = function() { + if (this.data.singleShape && !this.globalData.fontManager.chars) this.textContainer = createNS('text'); + }; + SVGTextLottieElement.prototype.buildTextContents = function(textArray) { + var i = 0; + var len = textArray.length; + var textContents = []; + var currentTextContent = ''; + while(i < len){ + if (textArray[i] === String.fromCharCode(13) || textArray[i] === String.fromCharCode(3)) { + textContents.push(currentTextContent); + currentTextContent = ''; + } else currentTextContent += textArray[i]; + i += 1; + } + textContents.push(currentTextContent); + return textContents; + }; + SVGTextLottieElement.prototype.buildShapeData = function(data, scale) { + if (data.shapes && data.shapes.length) { + var shape = data.shapes[0]; + if (shape.it) { + var shapeItem = shape.it[shape.it.length - 1]; + if (shapeItem.s) { + shapeItem.s.k[0] = scale; + shapeItem.s.k[1] = scale; + } + } + } + return data; + }; + SVGTextLottieElement.prototype.buildNewText = function() { + this.addDynamicProperty(this); + var i; + var len; + var documentData = this.textProperty.currentData; + this.renderedLetters = createSizedArray(documentData ? documentData.l.length : 0); + if (documentData.fc) this.layerElement.setAttribute('fill', this.buildColor(documentData.fc)); + else this.layerElement.setAttribute('fill', 'rgba(0,0,0,0)'); + if (documentData.sc) { + this.layerElement.setAttribute('stroke', this.buildColor(documentData.sc)); + this.layerElement.setAttribute('stroke-width', documentData.sw); + } + this.layerElement.setAttribute('font-size', documentData.finalSize); + var fontData = this.globalData.fontManager.getFontByName(documentData.f); + if (fontData.fClass) this.layerElement.setAttribute('class', fontData.fClass); + else { + this.layerElement.setAttribute('font-family', fontData.fFamily); + var fWeight = documentData.fWeight; + var fStyle = documentData.fStyle; + this.layerElement.setAttribute('font-style', fStyle); + this.layerElement.setAttribute('font-weight', fWeight); + } + this.layerElement.setAttribute('aria-label', documentData.t); + var letters = documentData.l || []; + var usesGlyphs = !!this.globalData.fontManager.chars; + len = letters.length; + var tSpan; + var matrixHelper = this.mHelper; + var shapeStr = ''; + var singleShape = this.data.singleShape; + var xPos = 0; + var yPos = 0; + var firstLine = true; + var trackingOffset = 0.001 * documentData.tr * documentData.finalSize; + if (!singleShape || usesGlyphs || documentData.sz) { + var cachedSpansLength = this.textSpans.length; + var charData; + for(i = 0; i < len; i += 1){ + if (!this.textSpans[i]) this.textSpans[i] = { + span: null, + childSpan: null, + glyph: null + }; + if (!usesGlyphs || !singleShape || 0 === i) { + tSpan = cachedSpansLength > i ? this.textSpans[i].span : createNS(usesGlyphs ? 'g' : 'text'); + if (cachedSpansLength <= i) { + tSpan.setAttribute('stroke-linecap', 'butt'); + tSpan.setAttribute('stroke-linejoin', 'round'); + tSpan.setAttribute('stroke-miterlimit', '4'); + this.textSpans[i].span = tSpan; + if (usesGlyphs) { + var childSpan = createNS('g'); + tSpan.appendChild(childSpan); + this.textSpans[i].childSpan = childSpan; + } + this.textSpans[i].span = tSpan; + this.layerElement.appendChild(tSpan); + } + tSpan.style.display = 'inherit'; + } + matrixHelper.reset(); + if (singleShape) { + if (letters[i].n) { + xPos = -trackingOffset; + yPos += documentData.yOffset; + yPos += firstLine ? 1 : 0; + firstLine = false; + } + this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos); + xPos += letters[i].l || 0; + xPos += trackingOffset; + } + if (usesGlyphs) { + charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily); + var glyphElement; + if (1 === charData.t) glyphElement = new SVGCompElement(charData.data, this.globalData, this); + else { + var data = emptyShapeData; + if (charData.data && charData.data.shapes) data = this.buildShapeData(charData.data, documentData.finalSize); + glyphElement = new SVGShapeElement(data, this.globalData, this); + } + if (this.textSpans[i].glyph) { + var glyph = this.textSpans[i].glyph; + this.textSpans[i].childSpan.removeChild(glyph.layerElement); + glyph.destroy(); + } + this.textSpans[i].glyph = glyphElement; + glyphElement._debug = true; + glyphElement.prepareFrame(0); + glyphElement.renderFrame(); + this.textSpans[i].childSpan.appendChild(glyphElement.layerElement); + if (1 === charData.t) this.textSpans[i].childSpan.setAttribute('transform', 'scale(' + documentData.finalSize / 100 + ',' + documentData.finalSize / 100 + ')'); + } else { + if (singleShape) tSpan.setAttribute('transform', 'translate(' + matrixHelper.props[12] + ',' + matrixHelper.props[13] + ')'); + tSpan.textContent = letters[i].val; + tSpan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve'); + } + } + if (singleShape && tSpan) tSpan.setAttribute('d', shapeStr); + } else { + var tElement = this.textContainer; + var justify = 'start'; + switch(documentData.j){ + case 1: + justify = 'end'; + break; + case 2: + justify = 'middle'; + break; + default: + justify = 'start'; + break; + } + tElement.setAttribute('text-anchor', justify); + tElement.setAttribute('letter-spacing', trackingOffset); + var textContent = this.buildTextContents(documentData.finalText); + len = textContent.length; + yPos = documentData.ps ? documentData.ps[1] + documentData.ascent : 0; + for(i = 0; i < len; i += 1){ + tSpan = this.textSpans[i].span || createNS('tspan'); + tSpan.textContent = textContent[i]; + tSpan.setAttribute('x', 0); + tSpan.setAttribute('y', yPos); + tSpan.style.display = 'inherit'; + tElement.appendChild(tSpan); + if (!this.textSpans[i]) this.textSpans[i] = { + span: null, + glyph: null + }; + this.textSpans[i].span = tSpan; + yPos += documentData.finalLineHeight; + } + this.layerElement.appendChild(tElement); + } + while(i < this.textSpans.length){ + this.textSpans[i].span.style.display = 'none'; + i += 1; + } + this._sizeChanged = true; + }; + SVGTextLottieElement.prototype.sourceRectAtTime = function() { + this.prepareFrame(this.comp.renderedFrame - this.data.st); + this.renderInnerContent(); + if (this._sizeChanged) { + this._sizeChanged = false; + var textBox = this.layerElement.getBBox(); + this.bbox = { + top: textBox.y, + left: textBox.x, + width: textBox.width, + height: textBox.height + }; + } + return this.bbox; + }; + SVGTextLottieElement.prototype.getValue = function() { + var i; + var len = this.textSpans.length; + var glyphElement; + this.renderedFrame = this.comp.renderedFrame; + for(i = 0; i < len; i += 1){ + glyphElement = this.textSpans[i].glyph; + if (glyphElement) { + glyphElement.prepareFrame(this.comp.renderedFrame - this.data.st); + if (glyphElement._mdf) this._mdf = true; + } + } + }; + SVGTextLottieElement.prototype.renderInnerContent = function() { + this.validateText(); + if (!this.data.singleShape || this._mdf) { + this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag); + if (this.lettersChangedFlag || this.textAnimator.lettersChangedFlag) { + this._sizeChanged = true; + var i; + var len; + var renderedLetters = this.textAnimator.renderedLetters; + var letters = this.textProperty.currentData.l; + len = letters.length; + var renderedLetter; + var textSpan; + var glyphElement; + for(i = 0; i < len; i += 1)if (!letters[i].n) { + renderedLetter = renderedLetters[i]; + textSpan = this.textSpans[i].span; + glyphElement = this.textSpans[i].glyph; + if (glyphElement) glyphElement.renderFrame(); + if (renderedLetter._mdf.m) textSpan.setAttribute('transform', renderedLetter.m); + if (renderedLetter._mdf.o) textSpan.setAttribute('opacity', renderedLetter.o); + if (renderedLetter._mdf.sw) textSpan.setAttribute('stroke-width', renderedLetter.sw); + if (renderedLetter._mdf.sc) textSpan.setAttribute('stroke', renderedLetter.sc); + if (renderedLetter._mdf.fc) textSpan.setAttribute('fill', renderedLetter.fc); + } + } + } + }; + function ISolidElement(data, globalData, comp) { + this.initElement(data, globalData, comp); + } + extendPrototype([ + IImageElement + ], ISolidElement); + ISolidElement.prototype.createContent = function() { + var rect = createNS('rect'); + rect.setAttribute('width', this.data.sw); + rect.setAttribute('height', this.data.sh); + rect.setAttribute('fill', this.data.sc); + this.layerElement.appendChild(rect); + }; + function NullElement(data, globalData, comp) { + this.initFrame(); + this.initBaseData(data, globalData, comp); + this.initFrame(); + this.initTransform(data, globalData, comp); + this.initHierarchy(); + } + NullElement.prototype.prepareFrame = function(num) { + this.prepareProperties(num, true); + }; + NullElement.prototype.renderFrame = function() {}; + NullElement.prototype.getBaseElement = function() { + return null; + }; + NullElement.prototype.destroy = function() {}; + NullElement.prototype.sourceRectAtTime = function() {}; + NullElement.prototype.hide = function() {}; + extendPrototype([ + BaseElement, + TransformElement, + HierarchyElement, + FrameElement + ], NullElement); + function SVGRendererBase() {} + extendPrototype([ + BaseRenderer + ], SVGRendererBase); + SVGRendererBase.prototype.createNull = function(data) { + return new NullElement(data, this.globalData, this); + }; + SVGRendererBase.prototype.createShape = function(data) { + return new SVGShapeElement(data, this.globalData, this); + }; + SVGRendererBase.prototype.createText = function(data) { + return new SVGTextLottieElement(data, this.globalData, this); + }; + SVGRendererBase.prototype.createImage = function(data) { + return new IImageElement(data, this.globalData, this); + }; + SVGRendererBase.prototype.createSolid = function(data) { + return new ISolidElement(data, this.globalData, this); + }; + SVGRendererBase.prototype.configAnimation = function(animData) { + this.svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg'); + this.svgElement.setAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink'); + if (this.renderConfig.viewBoxSize) this.svgElement.setAttribute('viewBox', this.renderConfig.viewBoxSize); + else this.svgElement.setAttribute('viewBox', '0 0 ' + animData.w + ' ' + animData.h); + if (!this.renderConfig.viewBoxOnly) { + this.svgElement.setAttribute('width', animData.w); + this.svgElement.setAttribute('height', animData.h); + this.svgElement.style.width = '100%'; + this.svgElement.style.height = '100%'; + this.svgElement.style.transform = 'translate3d(0,0,0)'; + this.svgElement.style.contentVisibility = this.renderConfig.contentVisibility; + } + if (this.renderConfig.width) this.svgElement.setAttribute('width', this.renderConfig.width); + if (this.renderConfig.height) this.svgElement.setAttribute('height', this.renderConfig.height); + if (this.renderConfig.className) this.svgElement.setAttribute('class', this.renderConfig.className); + if (this.renderConfig.id) this.svgElement.setAttribute('id', this.renderConfig.id); + if (void 0 !== this.renderConfig.focusable) this.svgElement.setAttribute('focusable', this.renderConfig.focusable); + this.svgElement.setAttribute('preserveAspectRatio', this.renderConfig.preserveAspectRatio); + this.animationItem.wrapper.appendChild(this.svgElement); + var defs = this.globalData.defs; + this.setupGlobalData(animData, defs); + this.globalData.progressiveLoad = this.renderConfig.progressiveLoad; + this.data = animData; + var maskElement = createNS('clipPath'); + var rect = createNS('rect'); + rect.setAttribute('width', animData.w); + rect.setAttribute('height', animData.h); + rect.setAttribute('x', 0); + rect.setAttribute('y', 0); + var maskId = createElementID(); + maskElement.setAttribute('id', maskId); + maskElement.appendChild(rect); + this.layerElement.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + maskId + ')'); + defs.appendChild(maskElement); + this.layers = animData.layers; + this.elements = createSizedArray(animData.layers.length); + }; + SVGRendererBase.prototype.destroy = function() { + if (this.animationItem.wrapper) this.animationItem.wrapper.innerText = ''; + this.layerElement = null; + this.globalData.defs = null; + var i; + var len = this.layers ? this.layers.length : 0; + for(i = 0; i < len; i += 1)if (this.elements[i] && this.elements[i].destroy) this.elements[i].destroy(); + this.elements.length = 0; + this.destroyed = true; + this.animationItem = null; + }; + SVGRendererBase.prototype.updateContainerSize = function() {}; + SVGRendererBase.prototype.findIndexByInd = function(ind) { + var i = 0; + var len = this.layers.length; + for(i = 0; i < len; i += 1)if (this.layers[i].ind === ind) return i; + return -1; + }; + SVGRendererBase.prototype.buildItem = function(pos) { + var elements = this.elements; + if (elements[pos] || 99 === this.layers[pos].ty) return; + elements[pos] = true; + var element = this.createItem(this.layers[pos]); + elements[pos] = element; + if (getExpressionsPlugin()) { + if (0 === this.layers[pos].ty) this.globalData.projectInterface.registerComposition(element); + element.initExpressions(); + } + this.appendElementInPos(element, pos); + if (this.layers[pos].tt) { + var elementIndex = 'tp' in this.layers[pos] ? this.findIndexByInd(this.layers[pos].tp) : pos - 1; + if (-1 === elementIndex) return; + if (this.elements[elementIndex] && true !== this.elements[elementIndex]) { + var matteElement = elements[elementIndex]; + var matteMask = matteElement.getMatte(this.layers[pos].tt); + element.setMatte(matteMask); + } else { + this.buildItem(elementIndex); + this.addPendingElement(element); + } + } + }; + SVGRendererBase.prototype.checkPendingElements = function() { + while(this.pendingElements.length){ + var element = this.pendingElements.pop(); + element.checkParenting(); + if (element.data.tt) { + var i = 0; + var len = this.elements.length; + while(i < len){ + if (this.elements[i] === element) { + var elementIndex = 'tp' in element.data ? this.findIndexByInd(element.data.tp) : i - 1; + var matteElement = this.elements[elementIndex]; + var matteMask = matteElement.getMatte(this.layers[i].tt); + element.setMatte(matteMask); + break; + } + i += 1; + } + } + } + }; + SVGRendererBase.prototype.renderFrame = function(num) { + if (this.renderedFrame === num || this.destroyed) return; + if (null === num) num = this.renderedFrame; + else this.renderedFrame = num; + this.globalData.frameNum = num; + this.globalData.frameId += 1; + this.globalData.projectInterface.currentFrame = num; + this.globalData._mdf = false; + var i; + var len = this.layers.length; + if (!this.completeLayers) this.checkLayers(num); + for(i = len - 1; i >= 0; i -= 1)if (this.completeLayers || this.elements[i]) this.elements[i].prepareFrame(num - this.layers[i].st); + if (this.globalData._mdf) { + for(i = 0; i < len; i += 1)if (this.completeLayers || this.elements[i]) this.elements[i].renderFrame(); + } + }; + SVGRendererBase.prototype.appendElementInPos = function(element, pos) { + var newElement = element.getBaseElement(); + if (!newElement) return; + var i = 0; + var nextElement; + while(i < pos){ + if (this.elements[i] && true !== this.elements[i] && this.elements[i].getBaseElement()) nextElement = this.elements[i].getBaseElement(); + i += 1; + } + if (nextElement) this.layerElement.insertBefore(newElement, nextElement); + else this.layerElement.appendChild(newElement); + }; + SVGRendererBase.prototype.hide = function() { + this.layerElement.style.display = 'none'; + }; + SVGRendererBase.prototype.show = function() { + this.layerElement.style.display = 'block'; + }; + function ICompElement() {} + extendPrototype([ + BaseElement, + TransformElement, + HierarchyElement, + FrameElement, + RenderableDOMElement + ], ICompElement); + ICompElement.prototype.initElement = function(data, globalData, comp) { + this.initFrame(); + this.initBaseData(data, globalData, comp); + this.initTransform(data, globalData, comp); + this.initRenderable(); + this.initHierarchy(); + this.initRendererElement(); + this.createContainerElements(); + this.createRenderableComponents(); + if (this.data.xt || !globalData.progressiveLoad) this.buildAllItems(); + this.hide(); + }; + ICompElement.prototype.prepareFrame = function(num) { + this._mdf = false; + this.prepareRenderableFrame(num); + this.prepareProperties(num, this.isInRange); + if (!this.isInRange && !this.data.xt) return; + if (this.tm._placeholder) this.renderedFrame = num / this.data.sr; + else { + var timeRemapped = this.tm.v; + if (timeRemapped === this.data.op) timeRemapped = this.data.op - 1; + this.renderedFrame = timeRemapped; + } + var i; + var len = this.elements.length; + if (!this.completeLayers) this.checkLayers(this.renderedFrame); + for(i = len - 1; i >= 0; i -= 1)if (this.completeLayers || this.elements[i]) { + this.elements[i].prepareFrame(this.renderedFrame - this.layers[i].st); + if (this.elements[i]._mdf) this._mdf = true; + } + }; + ICompElement.prototype.renderInnerContent = function() { + var i; + var len = this.layers.length; + for(i = 0; i < len; i += 1)if (this.completeLayers || this.elements[i]) this.elements[i].renderFrame(); + }; + ICompElement.prototype.setElements = function(elems) { + this.elements = elems; + }; + ICompElement.prototype.getElements = function() { + return this.elements; + }; + ICompElement.prototype.destroyElements = function() { + var i; + var len = this.layers.length; + for(i = 0; i < len; i += 1)if (this.elements[i]) this.elements[i].destroy(); + }; + ICompElement.prototype.destroy = function() { + this.destroyElements(); + this.destroyBaseElement(); + }; + function SVGCompElement(data, globalData, comp) { + this.layers = data.layers; + this.supports3d = true; + this.completeLayers = false; + this.pendingElements = []; + this.elements = this.layers ? createSizedArray(this.layers.length) : []; + this.initElement(data, globalData, comp); + this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { + _placeholder: true + }; + } + extendPrototype([ + SVGRendererBase, + ICompElement, + SVGBaseElement + ], SVGCompElement); + SVGCompElement.prototype.createComp = function(data) { + return new SVGCompElement(data, this.globalData, this); + }; + function SVGRenderer(animationItem, config) { + this.animationItem = animationItem; + this.layers = null; + this.renderedFrame = -1; + this.svgElement = createNS('svg'); + var ariaLabel = ''; + if (config && config.title) { + var titleElement = createNS('title'); + var titleId = createElementID(); + titleElement.setAttribute('id', titleId); + titleElement.textContent = config.title; + this.svgElement.appendChild(titleElement); + ariaLabel += titleId; + } + if (config && config.description) { + var descElement = createNS('desc'); + var descId = createElementID(); + descElement.setAttribute('id', descId); + descElement.textContent = config.description; + this.svgElement.appendChild(descElement); + ariaLabel += ' ' + descId; + } + if (ariaLabel) this.svgElement.setAttribute('aria-labelledby', ariaLabel); + var defs = createNS('defs'); + this.svgElement.appendChild(defs); + var maskElement = createNS('g'); + this.svgElement.appendChild(maskElement); + this.layerElement = maskElement; + this.renderConfig = { + preserveAspectRatio: config && config.preserveAspectRatio || 'xMidYMid meet', + imagePreserveAspectRatio: config && config.imagePreserveAspectRatio || 'xMidYMid slice', + contentVisibility: config && config.contentVisibility || 'visible', + progressiveLoad: config && config.progressiveLoad || false, + hideOnTransparent: !(config && false === config.hideOnTransparent), + viewBoxOnly: config && config.viewBoxOnly || false, + viewBoxSize: config && config.viewBoxSize || false, + className: config && config.className || '', + id: config && config.id || '', + focusable: config && config.focusable, + filterSize: { + width: config && config.filterSize && config.filterSize.width || '100%', + height: config && config.filterSize && config.filterSize.height || '100%', + x: config && config.filterSize && config.filterSize.x || '0%', + y: config && config.filterSize && config.filterSize.y || '0%' + }, + width: config && config.width, + height: config && config.height, + runExpressions: !config || void 0 === config.runExpressions || config.runExpressions + }; + this.globalData = { + _mdf: false, + frameNum: -1, + defs: defs, + renderConfig: this.renderConfig + }; + this.elements = []; + this.pendingElements = []; + this.destroyed = false; + this.rendererType = 'svg'; + } + extendPrototype([ + SVGRendererBase + ], SVGRenderer); + SVGRenderer.prototype.createComp = function(data) { + return new SVGCompElement(data, this.globalData, this); + }; + function ShapeTransformManager() { + this.sequences = {}; + this.sequenceList = []; + this.transform_key_count = 0; + } + ShapeTransformManager.prototype = { + addTransformSequence: function(transforms) { + var i; + var len = transforms.length; + var key = '_'; + for(i = 0; i < len; i += 1)key += transforms[i].transform.key + '_'; + var sequence = this.sequences[key]; + if (!sequence) { + sequence = { + transforms: [].concat(transforms), + finalTransform: new Matrix(), + _mdf: false + }; + this.sequences[key] = sequence; + this.sequenceList.push(sequence); + } + return sequence; + }, + processSequence: function(sequence, isFirstFrame) { + var i = 0; + var len = sequence.transforms.length; + var _mdf = isFirstFrame; + while(i < len && !isFirstFrame){ + if (sequence.transforms[i].transform.mProps._mdf) { + _mdf = true; + break; + } + i += 1; + } + if (_mdf) { + sequence.finalTransform.reset(); + for(i = len - 1; i >= 0; i -= 1)sequence.finalTransform.multiply(sequence.transforms[i].transform.mProps.v); + } + sequence._mdf = _mdf; + }, + processSequences: function(isFirstFrame) { + var i; + var len = this.sequenceList.length; + for(i = 0; i < len; i += 1)this.processSequence(this.sequenceList[i], isFirstFrame); + }, + getNewKey: function() { + this.transform_key_count += 1; + return '_' + this.transform_key_count; + } + }; + var lumaLoader = function() { + var id = '__lottie_element_luma_buffer'; + var lumaBuffer = null; + var lumaBufferCtx = null; + var svg = null; + function createLumaSvgFilter() { + var _svg = createNS('svg'); + var fil = createNS('filter'); + var matrix = createNS('feColorMatrix'); + fil.setAttribute('id', id); + matrix.setAttribute('type', 'matrix'); + matrix.setAttribute('color-interpolation-filters', 'sRGB'); + matrix.setAttribute('values', '0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0'); + fil.appendChild(matrix); + _svg.appendChild(fil); + _svg.setAttribute('id', id + '_svg'); + if (featureSupport.svgLumaHidden) _svg.style.display = 'none'; + return _svg; + } + function loadLuma() { + if (!lumaBuffer) { + svg = createLumaSvgFilter(); + document.body.appendChild(svg); + lumaBuffer = createTag('canvas'); + lumaBufferCtx = lumaBuffer.getContext('2d'); + lumaBufferCtx.filter = 'url(#' + id + ')'; + lumaBufferCtx.fillStyle = 'rgba(0,0,0,0)'; + lumaBufferCtx.fillRect(0, 0, 1, 1); + } + } + function getLuma(canvas) { + if (!lumaBuffer) loadLuma(); + lumaBuffer.width = canvas.width; + lumaBuffer.height = canvas.height; + lumaBufferCtx.filter = 'url(#' + id + ')'; + return lumaBuffer; + } + return { + load: loadLuma, + get: getLuma + }; + }; + function createCanvas(width, height) { + if (featureSupport.offscreenCanvas) return new OffscreenCanvas(width, height); + var canvas = createTag('canvas'); + canvas.width = width; + canvas.height = height; + return canvas; + } + var assetLoader = function() { + return { + loadLumaCanvas: lumaLoader.load, + getLumaCanvas: lumaLoader.get, + createCanvas: createCanvas + }; + }(); + var registeredEffects = {}; + function CVEffects(elem) { + var i; + var len = elem.data.ef ? elem.data.ef.length : 0; + this.filters = []; + var filterManager; + for(i = 0; i < len; i += 1){ + filterManager = null; + var type = elem.data.ef[i].ty; + if (registeredEffects[type]) { + var Effect = registeredEffects[type].effect; + filterManager = new Effect(elem.effectsManager.effectElements[i], elem); + } + if (filterManager) this.filters.push(filterManager); + } + if (this.filters.length) elem.addRenderableComponent(this); + } + CVEffects.prototype.renderFrame = function(_isFirstFrame) { + var i; + var len = this.filters.length; + for(i = 0; i < len; i += 1)this.filters[i].renderFrame(_isFirstFrame); + }; + CVEffects.prototype.getEffects = function(type) { + var i; + var len = this.filters.length; + var effects = []; + for(i = 0; i < len; i += 1)if (this.filters[i].type === type) effects.push(this.filters[i]); + return effects; + }; + function registerEffect(id, effect) { + registeredEffects[id] = { + effect: effect + }; + } + function CVMaskElement(data, element) { + this.data = data; + this.element = element; + this.masksProperties = this.data.masksProperties || []; + this.viewData = createSizedArray(this.masksProperties.length); + var i; + var len = this.masksProperties.length; + var hasMasks = false; + for(i = 0; i < len; i += 1){ + if ('n' !== this.masksProperties[i].mode) hasMasks = true; + this.viewData[i] = ShapePropertyFactory.getShapeProp(this.element, this.masksProperties[i], 3); + } + this.hasMasks = hasMasks; + if (hasMasks) this.element.addRenderableComponent(this); + } + CVMaskElement.prototype.renderFrame = function() { + if (!this.hasMasks) return; + var transform = this.element.finalTransform.mat; + var ctx = this.element.canvasContext; + var i; + var len = this.masksProperties.length; + var pt; + var pts; + var data; + ctx.beginPath(); + for(i = 0; i < len; i += 1)if ('n' !== this.masksProperties[i].mode) { + if (this.masksProperties[i].inv) { + ctx.moveTo(0, 0); + ctx.lineTo(this.element.globalData.compSize.w, 0); + ctx.lineTo(this.element.globalData.compSize.w, this.element.globalData.compSize.h); + ctx.lineTo(0, this.element.globalData.compSize.h); + ctx.lineTo(0, 0); + } + data = this.viewData[i].v; + pt = transform.applyToPointArray(data.v[0][0], data.v[0][1], 0); + ctx.moveTo(pt[0], pt[1]); + var j; + var jLen = data._length; + for(j = 1; j < jLen; j += 1){ + pts = transform.applyToTriplePoints(data.o[j - 1], data.i[j], data.v[j]); + ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]); + } + pts = transform.applyToTriplePoints(data.o[j - 1], data.i[0], data.v[0]); + ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]); + } + this.element.globalData.renderer.save(true); + ctx.clip(); + }; + CVMaskElement.prototype.getMaskProperty = MaskElement.prototype.getMaskProperty; + CVMaskElement.prototype.destroy = function() { + this.element = null; + }; + function CVBaseElement() {} + var operationsMap = { + 1: 'source-in', + 2: 'source-out', + 3: 'source-in', + 4: 'source-out' + }; + CVBaseElement.prototype = { + createElements: function() {}, + initRendererElement: function() {}, + createContainerElements: function() { + if (this.data.tt >= 1) { + this.buffers = []; + var canvasContext = this.globalData.canvasContext; + var bufferCanvas = assetLoader.createCanvas(canvasContext.canvas.width, canvasContext.canvas.height); + this.buffers.push(bufferCanvas); + var bufferCanvas2 = assetLoader.createCanvas(canvasContext.canvas.width, canvasContext.canvas.height); + this.buffers.push(bufferCanvas2); + if (this.data.tt >= 3 && !document._isProxy) assetLoader.loadLumaCanvas(); + } + this.canvasContext = this.globalData.canvasContext; + this.transformCanvas = this.globalData.transformCanvas; + this.renderableEffectsManager = new CVEffects(this); + this.searchEffectTransforms(); + }, + createContent: function() {}, + setBlendMode: function() { + var globalData = this.globalData; + if (globalData.blendMode !== this.data.bm) { + globalData.blendMode = this.data.bm; + var blendModeValue = getBlendMode(this.data.bm); + globalData.canvasContext.globalCompositeOperation = blendModeValue; + } + }, + createRenderableComponents: function() { + this.maskManager = new CVMaskElement(this.data, this); + this.transformEffects = this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT); + }, + hideElement: function() { + if (!this.hidden && (!this.isInRange || this.isTransparent)) this.hidden = true; + }, + showElement: function() { + if (this.isInRange && !this.isTransparent) { + this.hidden = false; + this._isFirstFrame = true; + this.maskManager._isFirstFrame = true; + } + }, + clearCanvas: function(canvasContext) { + canvasContext.clearRect(this.transformCanvas.tx, this.transformCanvas.ty, this.transformCanvas.w * this.transformCanvas.sx, this.transformCanvas.h * this.transformCanvas.sy); + }, + prepareLayer: function() { + if (this.data.tt >= 1) { + var buffer = this.buffers[0]; + var bufferCtx = buffer.getContext('2d'); + this.clearCanvas(bufferCtx); + bufferCtx.drawImage(this.canvasContext.canvas, 0, 0); + this.currentTransform = this.canvasContext.getTransform(); + this.canvasContext.setTransform(1, 0, 0, 1, 0, 0); + this.clearCanvas(this.canvasContext); + this.canvasContext.setTransform(this.currentTransform); + } + }, + exitLayer: function() { + if (this.data.tt >= 1) { + var buffer = this.buffers[1]; + var bufferCtx = buffer.getContext('2d'); + this.clearCanvas(bufferCtx); + bufferCtx.drawImage(this.canvasContext.canvas, 0, 0); + this.canvasContext.setTransform(1, 0, 0, 1, 0, 0); + this.clearCanvas(this.canvasContext); + this.canvasContext.setTransform(this.currentTransform); + var mask = this.comp.getElementById('tp' in this.data ? this.data.tp : this.data.ind - 1); + mask.renderFrame(true); + this.canvasContext.setTransform(1, 0, 0, 1, 0, 0); + if (this.data.tt >= 3 && !document._isProxy) { + var lumaBuffer = assetLoader.getLumaCanvas(this.canvasContext.canvas); + var lumaBufferCtx = lumaBuffer.getContext('2d'); + lumaBufferCtx.drawImage(this.canvasContext.canvas, 0, 0); + this.clearCanvas(this.canvasContext); + this.canvasContext.drawImage(lumaBuffer, 0, 0); + } + this.canvasContext.globalCompositeOperation = operationsMap[this.data.tt]; + this.canvasContext.drawImage(buffer, 0, 0); + this.canvasContext.globalCompositeOperation = 'destination-over'; + this.canvasContext.drawImage(this.buffers[0], 0, 0); + this.canvasContext.setTransform(this.currentTransform); + this.canvasContext.globalCompositeOperation = 'source-over'; + } + }, + renderFrame: function(forceRender) { + if (this.hidden || this.data.hd) return; + if (1 === this.data.td && !forceRender) return; + this.renderTransform(); + this.renderRenderable(); + this.renderLocalTransform(); + this.setBlendMode(); + var forceRealStack = 0 === this.data.ty; + this.prepareLayer(); + this.globalData.renderer.save(forceRealStack); + this.globalData.renderer.ctxTransform(this.finalTransform.localMat.props); + this.globalData.renderer.ctxOpacity(this.finalTransform.localOpacity); + this.renderInnerContent(); + this.globalData.renderer.restore(forceRealStack); + this.exitLayer(); + if (this.maskManager.hasMasks) this.globalData.renderer.restore(true); + if (this._isFirstFrame) this._isFirstFrame = false; + }, + destroy: function() { + this.canvasContext = null; + this.data = null; + this.globalData = null; + this.maskManager.destroy(); + }, + mHelper: new Matrix() + }; + CVBaseElement.prototype.hide = CVBaseElement.prototype.hideElement; + CVBaseElement.prototype.show = CVBaseElement.prototype.showElement; + function CVShapeData(element, data, styles, transformsManager) { + this.styledShapes = []; + this.tr = [ + 0, + 0, + 0, + 0, + 0, + 0 + ]; + var ty = 4; + if ('rc' === data.ty) ty = 5; + else if ('el' === data.ty) ty = 6; + else if ('sr' === data.ty) ty = 7; + this.sh = ShapePropertyFactory.getShapeProp(element, data, ty, element); + var i; + var len = styles.length; + var styledShape; + for(i = 0; i < len; i += 1)if (!styles[i].closed) { + styledShape = { + transforms: transformsManager.addTransformSequence(styles[i].transforms), + trNodes: [] + }; + this.styledShapes.push(styledShape); + styles[i].elements.push(styledShape); + } + } + CVShapeData.prototype.setAsAnimated = SVGShapeData.prototype.setAsAnimated; + function CVShapeElement(data, globalData, comp) { + this.shapes = []; + this.shapesData = data.shapes; + this.stylesList = []; + this.itemsData = []; + this.prevViewData = []; + this.shapeModifiers = []; + this.processedElements = []; + this.transformsManager = new ShapeTransformManager(); + this.initElement(data, globalData, comp); + } + extendPrototype([ + BaseElement, + TransformElement, + CVBaseElement, + IShapeElement, + HierarchyElement, + FrameElement, + RenderableElement + ], CVShapeElement); + CVShapeElement.prototype.initElement = RenderableDOMElement.prototype.initElement; + CVShapeElement.prototype.transformHelper = { + opacity: 1, + _opMdf: false + }; + CVShapeElement.prototype.dashResetter = []; + CVShapeElement.prototype.createContent = function() { + this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, []); + }; + CVShapeElement.prototype.createStyleElement = function(data, transforms) { + var styleElem = { + data: data, + type: data.ty, + preTransforms: this.transformsManager.addTransformSequence(transforms), + transforms: [], + elements: [], + closed: true === data.hd + }; + var elementData = {}; + if ('fl' === data.ty || 'st' === data.ty) { + elementData.c = PropertyFactory.getProp(this, data.c, 1, 255, this); + if (!elementData.c.k) styleElem.co = 'rgb(' + bmFloor(elementData.c.v[0]) + ',' + bmFloor(elementData.c.v[1]) + ',' + bmFloor(elementData.c.v[2]) + ')'; + } else if ('gf' === data.ty || 'gs' === data.ty) { + elementData.s = PropertyFactory.getProp(this, data.s, 1, null, this); + elementData.e = PropertyFactory.getProp(this, data.e, 1, null, this); + elementData.h = PropertyFactory.getProp(this, data.h || { + k: 0 + }, 0, 0.01, this); + elementData.a = PropertyFactory.getProp(this, data.a || { + k: 0 + }, 0, degToRads, this); + elementData.g = new GradientProperty(this, data.g, this); + } + elementData.o = PropertyFactory.getProp(this, data.o, 0, 0.01, this); + if ('st' === data.ty || 'gs' === data.ty) { + styleElem.lc = lineCapEnum[data.lc || 2]; + styleElem.lj = lineJoinEnum[data.lj || 2]; + if (1 == data.lj) styleElem.ml = data.ml; + elementData.w = PropertyFactory.getProp(this, data.w, 0, null, this); + if (!elementData.w.k) styleElem.wi = elementData.w.v; + if (data.d) { + var d = new DashProperty(this, data.d, 'canvas', this); + elementData.d = d; + if (!elementData.d.k) { + styleElem.da = elementData.d.dashArray; + styleElem["do"] = elementData.d.dashoffset[0]; + } + } + } else styleElem.r = 2 === data.r ? 'evenodd' : 'nonzero'; + this.stylesList.push(styleElem); + elementData.style = styleElem; + return elementData; + }; + CVShapeElement.prototype.createGroupElement = function() { + var elementData = { + it: [], + prevViewData: [] + }; + return elementData; + }; + CVShapeElement.prototype.createTransformElement = function(data) { + var elementData = { + transform: { + opacity: 1, + _opMdf: false, + key: this.transformsManager.getNewKey(), + op: PropertyFactory.getProp(this, data.o, 0, 0.01, this), + mProps: TransformPropertyFactory.getTransformProperty(this, data, this) + } + }; + return elementData; + }; + CVShapeElement.prototype.createShapeElement = function(data) { + var elementData = new CVShapeData(this, data, this.stylesList, this.transformsManager); + this.shapes.push(elementData); + this.addShapeToModifiers(elementData); + return elementData; + }; + CVShapeElement.prototype.reloadShapes = function() { + this._isFirstFrame = true; + var i; + var len = this.itemsData.length; + for(i = 0; i < len; i += 1)this.prevViewData[i] = this.itemsData[i]; + this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, []); + len = this.dynamicProperties.length; + for(i = 0; i < len; i += 1)this.dynamicProperties[i].getValue(); + this.renderModifiers(); + this.transformsManager.processSequences(this._isFirstFrame); + }; + CVShapeElement.prototype.addTransformToStyleList = function(transform) { + var i; + var len = this.stylesList.length; + for(i = 0; i < len; i += 1)if (!this.stylesList[i].closed) this.stylesList[i].transforms.push(transform); + }; + CVShapeElement.prototype.removeTransformFromStyleList = function() { + var i; + var len = this.stylesList.length; + for(i = 0; i < len; i += 1)if (!this.stylesList[i].closed) this.stylesList[i].transforms.pop(); + }; + CVShapeElement.prototype.closeStyles = function(styles) { + var i; + var len = styles.length; + for(i = 0; i < len; i += 1)styles[i].closed = true; + }; + CVShapeElement.prototype.searchShapes = function(arr, itemsData, prevViewData, shouldRender, transforms) { + var i; + var len = arr.length - 1; + var j; + var jLen; + var ownStyles = []; + var ownModifiers = []; + var processedPos; + var modifier; + var currentTransform; + var ownTransforms = [].concat(transforms); + for(i = len; i >= 0; i -= 1){ + processedPos = this.searchProcessedElement(arr[i]); + if (processedPos) itemsData[i] = prevViewData[processedPos - 1]; + else arr[i]._shouldRender = shouldRender; + if ('fl' === arr[i].ty || 'st' === arr[i].ty || 'gf' === arr[i].ty || 'gs' === arr[i].ty) { + if (processedPos) itemsData[i].style.closed = false; + else itemsData[i] = this.createStyleElement(arr[i], ownTransforms); + ownStyles.push(itemsData[i].style); + } else if ('gr' === arr[i].ty) { + if (processedPos) { + jLen = itemsData[i].it.length; + for(j = 0; j < jLen; j += 1)itemsData[i].prevViewData[j] = itemsData[i].it[j]; + } else itemsData[i] = this.createGroupElement(arr[i]); + this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, shouldRender, ownTransforms); + } else if ('tr' === arr[i].ty) { + if (!processedPos) { + currentTransform = this.createTransformElement(arr[i]); + itemsData[i] = currentTransform; + } + ownTransforms.push(itemsData[i]); + this.addTransformToStyleList(itemsData[i]); + } else if ('sh' === arr[i].ty || 'rc' === arr[i].ty || 'el' === arr[i].ty || 'sr' === arr[i].ty) { + if (!processedPos) itemsData[i] = this.createShapeElement(arr[i]); + } else if ('tm' === arr[i].ty || 'rd' === arr[i].ty || 'pb' === arr[i].ty || 'zz' === arr[i].ty || 'op' === arr[i].ty) { + if (processedPos) { + modifier = itemsData[i]; + modifier.closed = false; + } else { + modifier = ShapeModifiers.getModifier(arr[i].ty); + modifier.init(this, arr[i]); + itemsData[i] = modifier; + this.shapeModifiers.push(modifier); + } + ownModifiers.push(modifier); + } else if ('rp' === arr[i].ty) { + if (processedPos) { + modifier = itemsData[i]; + modifier.closed = true; + } else { + modifier = ShapeModifiers.getModifier(arr[i].ty); + itemsData[i] = modifier; + modifier.init(this, arr, i, itemsData); + this.shapeModifiers.push(modifier); + shouldRender = false; + } + ownModifiers.push(modifier); + } + this.addProcessedElement(arr[i], i + 1); + } + this.removeTransformFromStyleList(); + this.closeStyles(ownStyles); + len = ownModifiers.length; + for(i = 0; i < len; i += 1)ownModifiers[i].closed = true; + }; + CVShapeElement.prototype.renderInnerContent = function() { + this.transformHelper.opacity = 1; + this.transformHelper._opMdf = false; + this.renderModifiers(); + this.transformsManager.processSequences(this._isFirstFrame); + this.renderShape(this.transformHelper, this.shapesData, this.itemsData, true); + }; + CVShapeElement.prototype.renderShapeTransform = function(parentTransform, groupTransform) { + if (parentTransform._opMdf || groupTransform.op._mdf || this._isFirstFrame) { + groupTransform.opacity = parentTransform.opacity; + groupTransform.opacity *= groupTransform.op.v; + groupTransform._opMdf = true; + } + }; + CVShapeElement.prototype.drawLayer = function() { + var i; + var len = this.stylesList.length; + var j; + var jLen; + var k; + var kLen; + var elems; + var nodes; + var renderer = this.globalData.renderer; + var ctx = this.globalData.canvasContext; + var type; + var currentStyle; + for(i = 0; i < len; i += 1){ + currentStyle = this.stylesList[i]; + type = currentStyle.type; + if (!(('st' === type || 'gs' === type) && 0 === currentStyle.wi || !currentStyle.data._shouldRender || 0 === currentStyle.coOp || 0 === this.globalData.currentGlobalAlpha)) { + renderer.save(); + elems = currentStyle.elements; + if ('st' === type || 'gs' === type) { + renderer.ctxStrokeStyle('st' === type ? currentStyle.co : currentStyle.grd); + renderer.ctxLineWidth(currentStyle.wi); + renderer.ctxLineCap(currentStyle.lc); + renderer.ctxLineJoin(currentStyle.lj); + renderer.ctxMiterLimit(currentStyle.ml || 0); + } else renderer.ctxFillStyle('fl' === type ? currentStyle.co : currentStyle.grd); + renderer.ctxOpacity(currentStyle.coOp); + if ('st' !== type && 'gs' !== type) ctx.beginPath(); + renderer.ctxTransform(currentStyle.preTransforms.finalTransform.props); + jLen = elems.length; + for(j = 0; j < jLen; j += 1){ + if ('st' === type || 'gs' === type) { + ctx.beginPath(); + if (currentStyle.da) { + ctx.setLineDash(currentStyle.da); + ctx.lineDashOffset = currentStyle["do"]; + } + } + nodes = elems[j].trNodes; + kLen = nodes.length; + for(k = 0; k < kLen; k += 1)if ('m' === nodes[k].t) ctx.moveTo(nodes[k].p[0], nodes[k].p[1]); + else if ('c' === nodes[k].t) ctx.bezierCurveTo(nodes[k].pts[0], nodes[k].pts[1], nodes[k].pts[2], nodes[k].pts[3], nodes[k].pts[4], nodes[k].pts[5]); + else ctx.closePath(); + if ('st' === type || 'gs' === type) { + renderer.ctxStroke(); + if (currentStyle.da) ctx.setLineDash(this.dashResetter); + } + } + if ('st' !== type && 'gs' !== type) this.globalData.renderer.ctxFill(currentStyle.r); + renderer.restore(); + } + } + }; + CVShapeElement.prototype.renderShape = function(parentTransform, items, data, isMain) { + var i; + var len = items.length - 1; + var groupTransform; + groupTransform = parentTransform; + for(i = len; i >= 0; i -= 1)if ('tr' === items[i].ty) { + groupTransform = data[i].transform; + this.renderShapeTransform(parentTransform, groupTransform); + } else if ('sh' === items[i].ty || 'el' === items[i].ty || 'rc' === items[i].ty || 'sr' === items[i].ty) this.renderPath(items[i], data[i]); + else if ('fl' === items[i].ty) this.renderFill(items[i], data[i], groupTransform); + else if ('st' === items[i].ty) this.renderStroke(items[i], data[i], groupTransform); + else if ('gf' === items[i].ty || 'gs' === items[i].ty) this.renderGradientFill(items[i], data[i], groupTransform); + else if ('gr' === items[i].ty) this.renderShape(groupTransform, items[i].it, data[i].it); + else items[i].ty; + if (isMain) this.drawLayer(); + }; + CVShapeElement.prototype.renderStyledShape = function(styledShape, shape) { + if (this._isFirstFrame || shape._mdf || styledShape.transforms._mdf) { + var shapeNodes = styledShape.trNodes; + var paths = shape.paths; + var i; + var len; + var j; + var jLen = paths._length; + shapeNodes.length = 0; + var groupTransformMat = styledShape.transforms.finalTransform; + for(j = 0; j < jLen; j += 1){ + var pathNodes = paths.shapes[j]; + if (pathNodes && pathNodes.v) { + len = pathNodes._length; + for(i = 1; i < len; i += 1){ + if (1 === i) shapeNodes.push({ + t: 'm', + p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0) + }); + shapeNodes.push({ + t: 'c', + pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[i], pathNodes.v[i]) + }); + } + if (1 === len) shapeNodes.push({ + t: 'm', + p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0) + }); + if (pathNodes.c && len) { + shapeNodes.push({ + t: 'c', + pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[0], pathNodes.v[0]) + }); + shapeNodes.push({ + t: 'z' + }); + } + } + } + styledShape.trNodes = shapeNodes; + } + }; + CVShapeElement.prototype.renderPath = function(pathData, itemData) { + if (true !== pathData.hd && pathData._shouldRender) { + var i; + var len = itemData.styledShapes.length; + for(i = 0; i < len; i += 1)this.renderStyledShape(itemData.styledShapes[i], itemData.sh); + } + }; + CVShapeElement.prototype.renderFill = function(styleData, itemData, groupTransform) { + var styleElem = itemData.style; + if (itemData.c._mdf || this._isFirstFrame) styleElem.co = 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')'; + if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) styleElem.coOp = itemData.o.v * groupTransform.opacity; + }; + CVShapeElement.prototype.renderGradientFill = function(styleData, itemData, groupTransform) { + var styleElem = itemData.style; + var grd; + if (!styleElem.grd || itemData.g._mdf || itemData.s._mdf || itemData.e._mdf || 1 !== styleData.t && (itemData.h._mdf || itemData.a._mdf)) { + var ctx = this.globalData.canvasContext; + var pt1 = itemData.s.v; + var pt2 = itemData.e.v; + if (1 === styleData.t) grd = ctx.createLinearGradient(pt1[0], pt1[1], pt2[0], pt2[1]); + else { + var rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2)); + var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]); + var percent = itemData.h.v; + if (percent >= 1) percent = 0.99; + else if (percent <= -1) percent = -0.99; + var dist = rad * percent; + var x = Math.cos(ang + itemData.a.v) * dist + pt1[0]; + var y = Math.sin(ang + itemData.a.v) * dist + pt1[1]; + grd = ctx.createRadialGradient(x, y, 0, pt1[0], pt1[1], rad); + } + var i; + var len = styleData.g.p; + var cValues = itemData.g.c; + var opacity = 1; + for(i = 0; i < len; i += 1){ + if (itemData.g._hasOpacity && itemData.g._collapsable) opacity = itemData.g.o[2 * i + 1]; + grd.addColorStop(cValues[4 * i] / 100, 'rgba(' + cValues[4 * i + 1] + ',' + cValues[4 * i + 2] + ',' + cValues[4 * i + 3] + ',' + opacity + ')'); + } + styleElem.grd = grd; + } + styleElem.coOp = itemData.o.v * groupTransform.opacity; + }; + CVShapeElement.prototype.renderStroke = function(styleData, itemData, groupTransform) { + var styleElem = itemData.style; + var d = itemData.d; + if (d && (d._mdf || this._isFirstFrame)) { + styleElem.da = d.dashArray; + styleElem["do"] = d.dashoffset[0]; + } + if (itemData.c._mdf || this._isFirstFrame) styleElem.co = 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')'; + if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) styleElem.coOp = itemData.o.v * groupTransform.opacity; + if (itemData.w._mdf || this._isFirstFrame) styleElem.wi = itemData.w.v; + }; + CVShapeElement.prototype.destroy = function() { + this.shapesData = null; + this.globalData = null; + this.canvasContext = null; + this.stylesList.length = 0; + this.itemsData.length = 0; + }; + function CVTextElement(data, globalData, comp) { + this.textSpans = []; + this.yOffset = 0; + this.fillColorAnim = false; + this.strokeColorAnim = false; + this.strokeWidthAnim = false; + this.stroke = false; + this.fill = false; + this.justifyOffset = 0; + this.currentRender = null; + this.renderType = 'canvas'; + this.values = { + fill: 'rgba(0,0,0,0)', + stroke: 'rgba(0,0,0,0)', + sWidth: 0, + fValue: '' + }; + this.initElement(data, globalData, comp); + } + extendPrototype([ + BaseElement, + TransformElement, + CVBaseElement, + HierarchyElement, + FrameElement, + RenderableElement, + ITextElement + ], CVTextElement); + CVTextElement.prototype.tHelper = createTag('canvas').getContext('2d'); + CVTextElement.prototype.buildNewText = function() { + var documentData = this.textProperty.currentData; + this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0); + var hasFill = false; + if (documentData.fc) { + hasFill = true; + this.values.fill = this.buildColor(documentData.fc); + } else this.values.fill = 'rgba(0,0,0,0)'; + this.fill = hasFill; + var hasStroke = false; + if (documentData.sc) { + hasStroke = true; + this.values.stroke = this.buildColor(documentData.sc); + this.values.sWidth = documentData.sw; + } + var fontData = this.globalData.fontManager.getFontByName(documentData.f); + var i; + var len; + var letters = documentData.l; + var matrixHelper = this.mHelper; + this.stroke = hasStroke; + this.values.fValue = documentData.finalSize + 'px ' + this.globalData.fontManager.getFontByName(documentData.f).fFamily; + len = documentData.finalText.length; + var charData; + var shapeData; + var k; + var kLen; + var shapes; + var j; + var jLen; + var pathNodes; + var commands; + var pathArr; + var singleShape = this.data.singleShape; + var trackingOffset = 0.001 * documentData.tr * documentData.finalSize; + var xPos = 0; + var yPos = 0; + var firstLine = true; + var cnt = 0; + for(i = 0; i < len; i += 1){ + charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily); + shapeData = charData && charData.data || {}; + matrixHelper.reset(); + if (singleShape && letters[i].n) { + xPos = -trackingOffset; + yPos += documentData.yOffset; + yPos += firstLine ? 1 : 0; + firstLine = false; + } + shapes = shapeData.shapes ? shapeData.shapes[0].it : []; + jLen = shapes.length; + matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100); + if (singleShape) this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos); + commands = createSizedArray(jLen - 1); + var commandsCounter = 0; + for(j = 0; j < jLen; j += 1)if ('sh' === shapes[j].ty) { + kLen = shapes[j].ks.k.i.length; + pathNodes = shapes[j].ks.k; + pathArr = []; + for(k = 1; k < kLen; k += 1){ + if (1 === k) pathArr.push(matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0), matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0)); + pathArr.push(matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToX(pathNodes.i[k][0], pathNodes.i[k][1], 0), matrixHelper.applyToY(pathNodes.i[k][0], pathNodes.i[k][1], 0), matrixHelper.applyToX(pathNodes.v[k][0], pathNodes.v[k][1], 0), matrixHelper.applyToY(pathNodes.v[k][0], pathNodes.v[k][1], 0)); + } + pathArr.push(matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToX(pathNodes.i[0][0], pathNodes.i[0][1], 0), matrixHelper.applyToY(pathNodes.i[0][0], pathNodes.i[0][1], 0), matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0), matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0)); + commands[commandsCounter] = pathArr; + commandsCounter += 1; + } + if (singleShape) { + xPos += letters[i].l; + xPos += trackingOffset; + } + if (this.textSpans[cnt]) this.textSpans[cnt].elem = commands; + else this.textSpans[cnt] = { + elem: commands + }; + cnt += 1; + } + }; + CVTextElement.prototype.renderInnerContent = function() { + this.validateText(); + var ctx = this.canvasContext; + ctx.font = this.values.fValue; + this.globalData.renderer.ctxLineCap('butt'); + this.globalData.renderer.ctxLineJoin('miter'); + this.globalData.renderer.ctxMiterLimit(4); + if (!this.data.singleShape) this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag); + var i; + var len; + var j; + var jLen; + var k; + var kLen; + var renderedLetters = this.textAnimator.renderedLetters; + var letters = this.textProperty.currentData.l; + len = letters.length; + var renderedLetter; + var lastFill = null; + var lastStroke = null; + var lastStrokeW = null; + var commands; + var pathArr; + var renderer = this.globalData.renderer; + for(i = 0; i < len; i += 1)if (!letters[i].n) { + renderedLetter = renderedLetters[i]; + if (renderedLetter) { + renderer.save(); + renderer.ctxTransform(renderedLetter.p); + renderer.ctxOpacity(renderedLetter.o); + } + if (this.fill) { + if (renderedLetter && renderedLetter.fc) { + if (lastFill !== renderedLetter.fc) { + renderer.ctxFillStyle(renderedLetter.fc); + lastFill = renderedLetter.fc; + } + } else if (lastFill !== this.values.fill) { + lastFill = this.values.fill; + renderer.ctxFillStyle(this.values.fill); + } + commands = this.textSpans[i].elem; + jLen = commands.length; + this.globalData.canvasContext.beginPath(); + for(j = 0; j < jLen; j += 1){ + pathArr = commands[j]; + kLen = pathArr.length; + this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]); + for(k = 2; k < kLen; k += 6)this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]); + } + this.globalData.canvasContext.closePath(); + renderer.ctxFill(); + } + if (this.stroke) { + if (renderedLetter && renderedLetter.sw) { + if (lastStrokeW !== renderedLetter.sw) { + lastStrokeW = renderedLetter.sw; + renderer.ctxLineWidth(renderedLetter.sw); + } + } else if (lastStrokeW !== this.values.sWidth) { + lastStrokeW = this.values.sWidth; + renderer.ctxLineWidth(this.values.sWidth); + } + if (renderedLetter && renderedLetter.sc) { + if (lastStroke !== renderedLetter.sc) { + lastStroke = renderedLetter.sc; + renderer.ctxStrokeStyle(renderedLetter.sc); + } + } else if (lastStroke !== this.values.stroke) { + lastStroke = this.values.stroke; + renderer.ctxStrokeStyle(this.values.stroke); + } + commands = this.textSpans[i].elem; + jLen = commands.length; + this.globalData.canvasContext.beginPath(); + for(j = 0; j < jLen; j += 1){ + pathArr = commands[j]; + kLen = pathArr.length; + this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]); + for(k = 2; k < kLen; k += 6)this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]); + } + this.globalData.canvasContext.closePath(); + renderer.ctxStroke(); + } + if (renderedLetter) this.globalData.renderer.restore(); + } + }; + function CVImageElement(data, globalData, comp) { + this.assetData = globalData.getAssetData(data.refId); + this.img = globalData.imageLoader.getAsset(this.assetData); + this.initElement(data, globalData, comp); + } + extendPrototype([ + BaseElement, + TransformElement, + CVBaseElement, + HierarchyElement, + FrameElement, + RenderableElement + ], CVImageElement); + CVImageElement.prototype.initElement = SVGShapeElement.prototype.initElement; + CVImageElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame; + CVImageElement.prototype.createContent = function() { + if (this.img.width && (this.assetData.w !== this.img.width || this.assetData.h !== this.img.height)) { + var canvas = createTag('canvas'); + canvas.width = this.assetData.w; + canvas.height = this.assetData.h; + var ctx = canvas.getContext('2d'); + var imgW = this.img.width; + var imgH = this.img.height; + var imgRel = imgW / imgH; + var canvasRel = this.assetData.w / this.assetData.h; + var widthCrop; + var heightCrop; + var par = this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio; + if (imgRel > canvasRel && 'xMidYMid slice' === par || imgRel < canvasRel && 'xMidYMid slice' !== par) { + heightCrop = imgH; + widthCrop = heightCrop * canvasRel; + } else { + widthCrop = imgW; + heightCrop = widthCrop / canvasRel; + } + ctx.drawImage(this.img, (imgW - widthCrop) / 2, (imgH - heightCrop) / 2, widthCrop, heightCrop, 0, 0, this.assetData.w, this.assetData.h); + this.img = canvas; + } + }; + CVImageElement.prototype.renderInnerContent = function() { + this.canvasContext.drawImage(this.img, 0, 0); + }; + CVImageElement.prototype.destroy = function() { + this.img = null; + }; + function CVSolidElement(data, globalData, comp) { + this.initElement(data, globalData, comp); + } + extendPrototype([ + BaseElement, + TransformElement, + CVBaseElement, + HierarchyElement, + FrameElement, + RenderableElement + ], CVSolidElement); + CVSolidElement.prototype.initElement = SVGShapeElement.prototype.initElement; + CVSolidElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame; + CVSolidElement.prototype.renderInnerContent = function() { + this.globalData.renderer.ctxFillStyle(this.data.sc); + this.globalData.renderer.ctxFillRect(0, 0, this.data.sw, this.data.sh); + }; + function CanvasRendererBase() {} + extendPrototype([ + BaseRenderer + ], CanvasRendererBase); + CanvasRendererBase.prototype.createShape = function(data) { + return new CVShapeElement(data, this.globalData, this); + }; + CanvasRendererBase.prototype.createText = function(data) { + return new CVTextElement(data, this.globalData, this); + }; + CanvasRendererBase.prototype.createImage = function(data) { + return new CVImageElement(data, this.globalData, this); + }; + CanvasRendererBase.prototype.createSolid = function(data) { + return new CVSolidElement(data, this.globalData, this); + }; + CanvasRendererBase.prototype.createNull = SVGRenderer.prototype.createNull; + CanvasRendererBase.prototype.ctxTransform = function(props) { + if (1 === props[0] && 0 === props[1] && 0 === props[4] && 1 === props[5] && 0 === props[12] && 0 === props[13]) return; + this.canvasContext.transform(props[0], props[1], props[4], props[5], props[12], props[13]); + }; + CanvasRendererBase.prototype.ctxOpacity = function(op) { + this.canvasContext.globalAlpha *= op < 0 ? 0 : op; + }; + CanvasRendererBase.prototype.ctxFillStyle = function(value) { + this.canvasContext.fillStyle = value; + }; + CanvasRendererBase.prototype.ctxStrokeStyle = function(value) { + this.canvasContext.strokeStyle = value; + }; + CanvasRendererBase.prototype.ctxLineWidth = function(value) { + this.canvasContext.lineWidth = value; + }; + CanvasRendererBase.prototype.ctxLineCap = function(value) { + this.canvasContext.lineCap = value; + }; + CanvasRendererBase.prototype.ctxLineJoin = function(value) { + this.canvasContext.lineJoin = value; + }; + CanvasRendererBase.prototype.ctxMiterLimit = function(value) { + this.canvasContext.miterLimit = value; + }; + CanvasRendererBase.prototype.ctxFill = function(rule) { + this.canvasContext.fill(rule); + }; + CanvasRendererBase.prototype.ctxFillRect = function(x, y, w, h) { + this.canvasContext.fillRect(x, y, w, h); + }; + CanvasRendererBase.prototype.ctxStroke = function() { + this.canvasContext.stroke(); + }; + CanvasRendererBase.prototype.reset = function() { + if (!this.renderConfig.clearCanvas) return void this.canvasContext.restore(); + this.contextData.reset(); + }; + CanvasRendererBase.prototype.save = function() { + this.canvasContext.save(); + }; + CanvasRendererBase.prototype.restore = function(actionFlag) { + if (!this.renderConfig.clearCanvas) return void this.canvasContext.restore(); + if (actionFlag) this.globalData.blendMode = 'source-over'; + this.contextData.restore(actionFlag); + }; + CanvasRendererBase.prototype.configAnimation = function(animData) { + if (this.animationItem.wrapper) { + this.animationItem.container = createTag('canvas'); + var containerStyle = this.animationItem.container.style; + containerStyle.width = '100%'; + containerStyle.height = '100%'; + var origin = '0px 0px 0px'; + containerStyle.transformOrigin = origin; + containerStyle.mozTransformOrigin = origin; + containerStyle.webkitTransformOrigin = origin; + containerStyle['-webkit-transform'] = origin; + containerStyle.contentVisibility = this.renderConfig.contentVisibility; + this.animationItem.wrapper.appendChild(this.animationItem.container); + this.canvasContext = this.animationItem.container.getContext('2d'); + if (this.renderConfig.className) this.animationItem.container.setAttribute('class', this.renderConfig.className); + if (this.renderConfig.id) this.animationItem.container.setAttribute('id', this.renderConfig.id); + } else this.canvasContext = this.renderConfig.context; + this.contextData.setContext(this.canvasContext); + this.data = animData; + this.layers = animData.layers; + this.transformCanvas = { + w: animData.w, + h: animData.h, + sx: 0, + sy: 0, + tx: 0, + ty: 0 + }; + this.setupGlobalData(animData, document.body); + this.globalData.canvasContext = this.canvasContext; + this.globalData.renderer = this; + this.globalData.isDashed = false; + this.globalData.progressiveLoad = this.renderConfig.progressiveLoad; + this.globalData.transformCanvas = this.transformCanvas; + this.elements = createSizedArray(animData.layers.length); + this.updateContainerSize(); + }; + CanvasRendererBase.prototype.updateContainerSize = function(width, height) { + this.reset(); + var elementWidth; + var elementHeight; + if (width) { + elementWidth = width; + elementHeight = height; + this.canvasContext.canvas.width = elementWidth; + this.canvasContext.canvas.height = elementHeight; + } else { + if (this.animationItem.wrapper && this.animationItem.container) { + elementWidth = this.animationItem.wrapper.offsetWidth; + elementHeight = this.animationItem.wrapper.offsetHeight; + } else { + elementWidth = this.canvasContext.canvas.width; + elementHeight = this.canvasContext.canvas.height; + } + this.canvasContext.canvas.width = elementWidth * this.renderConfig.dpr; + this.canvasContext.canvas.height = elementHeight * this.renderConfig.dpr; + } + var elementRel; + var animationRel; + if (-1 !== this.renderConfig.preserveAspectRatio.indexOf('meet') || -1 !== this.renderConfig.preserveAspectRatio.indexOf('slice')) { + var par = this.renderConfig.preserveAspectRatio.split(' '); + var fillType = par[1] || 'meet'; + var pos = par[0] || 'xMidYMid'; + var xPos = pos.substr(0, 4); + var yPos = pos.substr(4); + elementRel = elementWidth / elementHeight; + animationRel = this.transformCanvas.w / this.transformCanvas.h; + if (animationRel > elementRel && 'meet' === fillType || animationRel < elementRel && 'slice' === fillType) { + this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr); + this.transformCanvas.sy = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr); + } else { + this.transformCanvas.sx = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr); + this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr); + } + if ('xMid' === xPos && (animationRel < elementRel && 'meet' === fillType || animationRel > elementRel && 'slice' === fillType)) this.transformCanvas.tx = (elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) / 2 * this.renderConfig.dpr; + else if ('xMax' === xPos && (animationRel < elementRel && 'meet' === fillType || animationRel > elementRel && 'slice' === fillType)) this.transformCanvas.tx = (elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) * this.renderConfig.dpr; + else this.transformCanvas.tx = 0; + if ('YMid' === yPos && (animationRel > elementRel && 'meet' === fillType || animationRel < elementRel && 'slice' === fillType)) this.transformCanvas.ty = (elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w)) / 2 * this.renderConfig.dpr; + else if ('YMax' === yPos && (animationRel > elementRel && 'meet' === fillType || animationRel < elementRel && 'slice' === fillType)) this.transformCanvas.ty = (elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w)) * this.renderConfig.dpr; + else this.transformCanvas.ty = 0; + } else if ('none' === this.renderConfig.preserveAspectRatio) { + this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr); + this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr); + this.transformCanvas.tx = 0; + this.transformCanvas.ty = 0; + } else { + this.transformCanvas.sx = this.renderConfig.dpr; + this.transformCanvas.sy = this.renderConfig.dpr; + this.transformCanvas.tx = 0; + this.transformCanvas.ty = 0; + } + this.transformCanvas.props = [ + this.transformCanvas.sx, + 0, + 0, + 0, + 0, + this.transformCanvas.sy, + 0, + 0, + 0, + 0, + 1, + 0, + this.transformCanvas.tx, + this.transformCanvas.ty, + 0, + 1 + ]; + this.ctxTransform(this.transformCanvas.props); + this.canvasContext.beginPath(); + this.canvasContext.rect(0, 0, this.transformCanvas.w, this.transformCanvas.h); + this.canvasContext.closePath(); + this.canvasContext.clip(); + this.renderFrame(this.renderedFrame, true); + }; + CanvasRendererBase.prototype.destroy = function() { + if (this.renderConfig.clearCanvas && this.animationItem.wrapper) this.animationItem.wrapper.innerText = ''; + var i; + var len = this.layers ? this.layers.length : 0; + for(i = len - 1; i >= 0; i -= 1)if (this.elements[i] && this.elements[i].destroy) this.elements[i].destroy(); + this.elements.length = 0; + this.globalData.canvasContext = null; + this.animationItem.container = null; + this.destroyed = true; + }; + CanvasRendererBase.prototype.renderFrame = function(num, forceRender) { + if (this.renderedFrame === num && true === this.renderConfig.clearCanvas && !forceRender || this.destroyed || -1 === num) return; + this.renderedFrame = num; + this.globalData.frameNum = num - this.animationItem._isFirstFrame; + this.globalData.frameId += 1; + this.globalData._mdf = !this.renderConfig.clearCanvas || forceRender; + this.globalData.projectInterface.currentFrame = num; + var i; + var len = this.layers.length; + if (!this.completeLayers) this.checkLayers(num); + for(i = len - 1; i >= 0; i -= 1)if (this.completeLayers || this.elements[i]) this.elements[i].prepareFrame(num - this.layers[i].st); + if (this.globalData._mdf) { + if (true === this.renderConfig.clearCanvas) this.canvasContext.clearRect(0, 0, this.transformCanvas.w, this.transformCanvas.h); + else this.save(); + for(i = len - 1; i >= 0; i -= 1)if (this.completeLayers || this.elements[i]) this.elements[i].renderFrame(); + if (true !== this.renderConfig.clearCanvas) this.restore(); + } + }; + CanvasRendererBase.prototype.buildItem = function(pos) { + var elements = this.elements; + if (elements[pos] || 99 === this.layers[pos].ty) return; + var element = this.createItem(this.layers[pos], this, this.globalData); + elements[pos] = element; + element.initExpressions(); + }; + CanvasRendererBase.prototype.checkPendingElements = function() { + while(this.pendingElements.length){ + var element = this.pendingElements.pop(); + element.checkParenting(); + } + }; + CanvasRendererBase.prototype.hide = function() { + this.animationItem.container.style.display = 'none'; + }; + CanvasRendererBase.prototype.show = function() { + this.animationItem.container.style.display = 'block'; + }; + function CanvasContext() { + this.opacity = -1; + this.transform = createTypedArray('float32', 16); + this.fillStyle = ''; + this.strokeStyle = ''; + this.lineWidth = ''; + this.lineCap = ''; + this.lineJoin = ''; + this.miterLimit = ''; + this.id = Math.random(); + } + function CVContextData() { + this.stack = []; + this.cArrPos = 0; + this.cTr = new Matrix(); + var i; + var len = 15; + for(i = 0; i < len; i += 1){ + var canvasContext = new CanvasContext(); + this.stack[i] = canvasContext; + } + this._length = len; + this.nativeContext = null; + this.transformMat = new Matrix(); + this.currentOpacity = 1; + this.currentFillStyle = ''; + this.appliedFillStyle = ''; + this.currentStrokeStyle = ''; + this.appliedStrokeStyle = ''; + this.currentLineWidth = ''; + this.appliedLineWidth = ''; + this.currentLineCap = ''; + this.appliedLineCap = ''; + this.currentLineJoin = ''; + this.appliedLineJoin = ''; + this.appliedMiterLimit = ''; + this.currentMiterLimit = ''; + } + CVContextData.prototype.duplicate = function() { + var newLength = 2 * this._length; + var i = 0; + for(i = this._length; i < newLength; i += 1)this.stack[i] = new CanvasContext(); + this._length = newLength; + }; + CVContextData.prototype.reset = function() { + this.cArrPos = 0; + this.cTr.reset(); + this.stack[this.cArrPos].opacity = 1; + }; + CVContextData.prototype.restore = function(forceRestore) { + this.cArrPos -= 1; + var currentContext = this.stack[this.cArrPos]; + var transform = currentContext.transform; + var i; + var arr = this.cTr.props; + for(i = 0; i < 16; i += 1)arr[i] = transform[i]; + if (forceRestore) { + this.nativeContext.restore(); + var prevStack = this.stack[this.cArrPos + 1]; + this.appliedFillStyle = prevStack.fillStyle; + this.appliedStrokeStyle = prevStack.strokeStyle; + this.appliedLineWidth = prevStack.lineWidth; + this.appliedLineCap = prevStack.lineCap; + this.appliedLineJoin = prevStack.lineJoin; + this.appliedMiterLimit = prevStack.miterLimit; + } + this.nativeContext.setTransform(transform[0], transform[1], transform[4], transform[5], transform[12], transform[13]); + if (forceRestore || -1 !== currentContext.opacity && this.currentOpacity !== currentContext.opacity) { + this.nativeContext.globalAlpha = currentContext.opacity; + this.currentOpacity = currentContext.opacity; + } + this.currentFillStyle = currentContext.fillStyle; + this.currentStrokeStyle = currentContext.strokeStyle; + this.currentLineWidth = currentContext.lineWidth; + this.currentLineCap = currentContext.lineCap; + this.currentLineJoin = currentContext.lineJoin; + this.currentMiterLimit = currentContext.miterLimit; + }; + CVContextData.prototype.save = function(saveOnNativeFlag) { + if (saveOnNativeFlag) this.nativeContext.save(); + var props = this.cTr.props; + if (this._length <= this.cArrPos) this.duplicate(); + var currentStack = this.stack[this.cArrPos]; + var i; + for(i = 0; i < 16; i += 1)currentStack.transform[i] = props[i]; + this.cArrPos += 1; + var newStack = this.stack[this.cArrPos]; + newStack.opacity = currentStack.opacity; + newStack.fillStyle = currentStack.fillStyle; + newStack.strokeStyle = currentStack.strokeStyle; + newStack.lineWidth = currentStack.lineWidth; + newStack.lineCap = currentStack.lineCap; + newStack.lineJoin = currentStack.lineJoin; + newStack.miterLimit = currentStack.miterLimit; + }; + CVContextData.prototype.setOpacity = function(value) { + this.stack[this.cArrPos].opacity = value; + }; + CVContextData.prototype.setContext = function(value) { + this.nativeContext = value; + }; + CVContextData.prototype.fillStyle = function(value) { + if (this.stack[this.cArrPos].fillStyle !== value) { + this.currentFillStyle = value; + this.stack[this.cArrPos].fillStyle = value; + } + }; + CVContextData.prototype.strokeStyle = function(value) { + if (this.stack[this.cArrPos].strokeStyle !== value) { + this.currentStrokeStyle = value; + this.stack[this.cArrPos].strokeStyle = value; + } + }; + CVContextData.prototype.lineWidth = function(value) { + if (this.stack[this.cArrPos].lineWidth !== value) { + this.currentLineWidth = value; + this.stack[this.cArrPos].lineWidth = value; + } + }; + CVContextData.prototype.lineCap = function(value) { + if (this.stack[this.cArrPos].lineCap !== value) { + this.currentLineCap = value; + this.stack[this.cArrPos].lineCap = value; + } + }; + CVContextData.prototype.lineJoin = function(value) { + if (this.stack[this.cArrPos].lineJoin !== value) { + this.currentLineJoin = value; + this.stack[this.cArrPos].lineJoin = value; + } + }; + CVContextData.prototype.miterLimit = function(value) { + if (this.stack[this.cArrPos].miterLimit !== value) { + this.currentMiterLimit = value; + this.stack[this.cArrPos].miterLimit = value; + } + }; + CVContextData.prototype.transform = function(props) { + this.transformMat.cloneFromProps(props); + var currentTransform = this.cTr; + this.transformMat.multiply(currentTransform); + currentTransform.cloneFromProps(this.transformMat.props); + var trProps = currentTransform.props; + this.nativeContext.setTransform(trProps[0], trProps[1], trProps[4], trProps[5], trProps[12], trProps[13]); + }; + CVContextData.prototype.opacity = function(op) { + var currentOpacity = this.stack[this.cArrPos].opacity; + currentOpacity *= op < 0 ? 0 : op; + if (this.stack[this.cArrPos].opacity !== currentOpacity) { + if (this.currentOpacity !== op) { + this.nativeContext.globalAlpha = op; + this.currentOpacity = op; + } + this.stack[this.cArrPos].opacity = currentOpacity; + } + }; + CVContextData.prototype.fill = function(rule) { + if (this.appliedFillStyle !== this.currentFillStyle) { + this.appliedFillStyle = this.currentFillStyle; + this.nativeContext.fillStyle = this.appliedFillStyle; + } + this.nativeContext.fill(rule); + }; + CVContextData.prototype.fillRect = function(x, y, w, h) { + if (this.appliedFillStyle !== this.currentFillStyle) { + this.appliedFillStyle = this.currentFillStyle; + this.nativeContext.fillStyle = this.appliedFillStyle; + } + this.nativeContext.fillRect(x, y, w, h); + }; + CVContextData.prototype.stroke = function() { + if (this.appliedStrokeStyle !== this.currentStrokeStyle) { + this.appliedStrokeStyle = this.currentStrokeStyle; + this.nativeContext.strokeStyle = this.appliedStrokeStyle; + } + if (this.appliedLineWidth !== this.currentLineWidth) { + this.appliedLineWidth = this.currentLineWidth; + this.nativeContext.lineWidth = this.appliedLineWidth; + } + if (this.appliedLineCap !== this.currentLineCap) { + this.appliedLineCap = this.currentLineCap; + this.nativeContext.lineCap = this.appliedLineCap; + } + if (this.appliedLineJoin !== this.currentLineJoin) { + this.appliedLineJoin = this.currentLineJoin; + this.nativeContext.lineJoin = this.appliedLineJoin; + } + if (this.appliedMiterLimit !== this.currentMiterLimit) { + this.appliedMiterLimit = this.currentMiterLimit; + this.nativeContext.miterLimit = this.appliedMiterLimit; + } + this.nativeContext.stroke(); + }; + function CVCompElement(data, globalData, comp) { + this.completeLayers = false; + this.layers = data.layers; + this.pendingElements = []; + this.elements = createSizedArray(this.layers.length); + this.initElement(data, globalData, comp); + this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { + _placeholder: true + }; + } + extendPrototype([ + CanvasRendererBase, + ICompElement, + CVBaseElement + ], CVCompElement); + CVCompElement.prototype.renderInnerContent = function() { + var ctx = this.canvasContext; + ctx.beginPath(); + ctx.moveTo(0, 0); + ctx.lineTo(this.data.w, 0); + ctx.lineTo(this.data.w, this.data.h); + ctx.lineTo(0, this.data.h); + ctx.lineTo(0, 0); + ctx.clip(); + var i; + var len = this.layers.length; + for(i = len - 1; i >= 0; i -= 1)if (this.completeLayers || this.elements[i]) this.elements[i].renderFrame(); + }; + CVCompElement.prototype.destroy = function() { + var i; + var len = this.layers.length; + for(i = len - 1; i >= 0; i -= 1)if (this.elements[i]) this.elements[i].destroy(); + this.layers = null; + this.elements = null; + }; + CVCompElement.prototype.createComp = function(data) { + return new CVCompElement(data, this.globalData, this); + }; + function CanvasRenderer(animationItem, config) { + this.animationItem = animationItem; + this.renderConfig = { + clearCanvas: config && void 0 !== config.clearCanvas ? config.clearCanvas : true, + context: config && config.context || null, + progressiveLoad: config && config.progressiveLoad || false, + preserveAspectRatio: config && config.preserveAspectRatio || 'xMidYMid meet', + imagePreserveAspectRatio: config && config.imagePreserveAspectRatio || 'xMidYMid slice', + contentVisibility: config && config.contentVisibility || 'visible', + className: config && config.className || '', + id: config && config.id || '', + runExpressions: !config || void 0 === config.runExpressions || config.runExpressions + }; + this.renderConfig.dpr = config && config.dpr || 1; + if (this.animationItem.wrapper) this.renderConfig.dpr = config && config.dpr || window.devicePixelRatio || 1; + this.renderedFrame = -1; + this.globalData = { + frameNum: -1, + _mdf: false, + renderConfig: this.renderConfig, + currentGlobalAlpha: -1 + }; + this.contextData = new CVContextData(); + this.elements = []; + this.pendingElements = []; + this.transformMat = new Matrix(); + this.completeLayers = false; + this.rendererType = 'canvas'; + if (this.renderConfig.clearCanvas) { + this.ctxTransform = this.contextData.transform.bind(this.contextData); + this.ctxOpacity = this.contextData.opacity.bind(this.contextData); + this.ctxFillStyle = this.contextData.fillStyle.bind(this.contextData); + this.ctxStrokeStyle = this.contextData.strokeStyle.bind(this.contextData); + this.ctxLineWidth = this.contextData.lineWidth.bind(this.contextData); + this.ctxLineCap = this.contextData.lineCap.bind(this.contextData); + this.ctxLineJoin = this.contextData.lineJoin.bind(this.contextData); + this.ctxMiterLimit = this.contextData.miterLimit.bind(this.contextData); + this.ctxFill = this.contextData.fill.bind(this.contextData); + this.ctxFillRect = this.contextData.fillRect.bind(this.contextData); + this.ctxStroke = this.contextData.stroke.bind(this.contextData); + this.save = this.contextData.save.bind(this.contextData); + } + } + extendPrototype([ + CanvasRendererBase + ], CanvasRenderer); + CanvasRenderer.prototype.createComp = function(data) { + return new CVCompElement(data, this.globalData, this); + }; + function HBaseElement() {} + HBaseElement.prototype = { + checkBlendMode: function() {}, + initRendererElement: function() { + this.baseElement = createTag(this.data.tg || 'div'); + if (this.data.hasMask) { + this.svgElement = createNS('svg'); + this.layerElement = createNS('g'); + this.maskedElement = this.layerElement; + this.svgElement.appendChild(this.layerElement); + this.baseElement.appendChild(this.svgElement); + } else this.layerElement = this.baseElement; + styleDiv(this.baseElement); + }, + createContainerElements: function() { + this.renderableEffectsManager = new CVEffects(this); + this.transformedElement = this.baseElement; + this.maskedElement = this.layerElement; + if (this.data.ln) this.layerElement.setAttribute('id', this.data.ln); + if (this.data.cl) this.layerElement.setAttribute('class', this.data.cl); + if (0 !== this.data.bm) this.setBlendMode(); + }, + renderElement: function() { + var transformedElementStyle = this.transformedElement ? this.transformedElement.style : {}; + if (this.finalTransform._matMdf) { + var matrixValue = this.finalTransform.mat.toCSS(); + transformedElementStyle.transform = matrixValue; + transformedElementStyle.webkitTransform = matrixValue; + } + if (this.finalTransform._opMdf) transformedElementStyle.opacity = this.finalTransform.mProp.o.v; + }, + renderFrame: function() { + if (this.data.hd || this.hidden) return; + this.renderTransform(); + this.renderRenderable(); + this.renderElement(); + this.renderInnerContent(); + if (this._isFirstFrame) this._isFirstFrame = false; + }, + destroy: function() { + this.layerElement = null; + this.transformedElement = null; + if (this.matteElement) this.matteElement = null; + if (this.maskManager) { + this.maskManager.destroy(); + this.maskManager = null; + } + }, + createRenderableComponents: function() { + this.maskManager = new MaskElement(this.data, this, this.globalData); + }, + addEffects: function() {}, + setMatte: function() {} + }; + HBaseElement.prototype.getBaseElement = SVGBaseElement.prototype.getBaseElement; + HBaseElement.prototype.destroyBaseElement = HBaseElement.prototype.destroy; + HBaseElement.prototype.buildElementParenting = BaseRenderer.prototype.buildElementParenting; + function HSolidElement(data, globalData, comp) { + this.initElement(data, globalData, comp); + } + extendPrototype([ + BaseElement, + TransformElement, + HBaseElement, + HierarchyElement, + FrameElement, + RenderableDOMElement + ], HSolidElement); + HSolidElement.prototype.createContent = function() { + var rect; + if (this.data.hasMask) { + rect = createNS('rect'); + rect.setAttribute('width', this.data.sw); + rect.setAttribute('height', this.data.sh); + rect.setAttribute('fill', this.data.sc); + this.svgElement.setAttribute('width', this.data.sw); + this.svgElement.setAttribute('height', this.data.sh); + } else { + rect = createTag('div'); + rect.style.width = this.data.sw + 'px'; + rect.style.height = this.data.sh + 'px'; + rect.style.backgroundColor = this.data.sc; + } + this.layerElement.appendChild(rect); + }; + function HShapeElement(data, globalData, comp) { + this.shapes = []; + this.shapesData = data.shapes; + this.stylesList = []; + this.shapeModifiers = []; + this.itemsData = []; + this.processedElements = []; + this.animatedContents = []; + this.shapesContainer = createNS('g'); + this.initElement(data, globalData, comp); + this.prevViewData = []; + this.currentBBox = { + x: 999999, + y: -999999, + h: 0, + w: 0 + }; + } + extendPrototype([ + BaseElement, + TransformElement, + HSolidElement, + SVGShapeElement, + HBaseElement, + HierarchyElement, + FrameElement, + RenderableElement + ], HShapeElement); + HShapeElement.prototype._renderShapeFrame = HShapeElement.prototype.renderInnerContent; + HShapeElement.prototype.createContent = function() { + var cont; + this.baseElement.style.fontSize = 0; + if (this.data.hasMask) { + this.layerElement.appendChild(this.shapesContainer); + cont = this.svgElement; + } else { + cont = createNS('svg'); + var size = this.comp.data ? this.comp.data : this.globalData.compSize; + cont.setAttribute('width', size.w); + cont.setAttribute('height', size.h); + cont.appendChild(this.shapesContainer); + this.layerElement.appendChild(cont); + } + this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.shapesContainer, 0, [], true); + this.filterUniqueShapes(); + this.shapeCont = cont; + }; + HShapeElement.prototype.getTransformedPoint = function(transformers, point) { + var i; + var len = transformers.length; + for(i = 0; i < len; i += 1)point = transformers[i].mProps.v.applyToPointArray(point[0], point[1], 0); + return point; + }; + HShapeElement.prototype.calculateShapeBoundingBox = function(item, boundingBox) { + var shape = item.sh.v; + var transformers = item.transformers; + var i; + var len = shape._length; + var vPoint; + var oPoint; + var nextIPoint; + var nextVPoint; + if (len <= 1) return; + for(i = 0; i < len - 1; i += 1){ + vPoint = this.getTransformedPoint(transformers, shape.v[i]); + oPoint = this.getTransformedPoint(transformers, shape.o[i]); + nextIPoint = this.getTransformedPoint(transformers, shape.i[i + 1]); + nextVPoint = this.getTransformedPoint(transformers, shape.v[i + 1]); + this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox); + } + if (shape.c) { + vPoint = this.getTransformedPoint(transformers, shape.v[i]); + oPoint = this.getTransformedPoint(transformers, shape.o[i]); + nextIPoint = this.getTransformedPoint(transformers, shape.i[0]); + nextVPoint = this.getTransformedPoint(transformers, shape.v[0]); + this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox); + } + }; + HShapeElement.prototype.checkBounds = function(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox) { + this.getBoundsOfCurve(vPoint, oPoint, nextIPoint, nextVPoint); + var bounds = this.shapeBoundingBox; + boundingBox.x = bmMin(bounds.left, boundingBox.x); + boundingBox.xMax = bmMax(bounds.right, boundingBox.xMax); + boundingBox.y = bmMin(bounds.top, boundingBox.y); + boundingBox.yMax = bmMax(bounds.bottom, boundingBox.yMax); + }; + HShapeElement.prototype.shapeBoundingBox = { + left: 0, + right: 0, + top: 0, + bottom: 0 + }; + HShapeElement.prototype.tempBoundingBox = { + x: 0, + xMax: 0, + y: 0, + yMax: 0, + width: 0, + height: 0 + }; + HShapeElement.prototype.getBoundsOfCurve = function(p0, p1, p2, p3) { + var bounds = [ + [ + p0[0], + p3[0] + ], + [ + p0[1], + p3[1] + ] + ]; + for(var a, b, c, t, b2ac, t1, t2, i = 0; i < 2; ++i){ + b = 6 * p0[i] - 12 * p1[i] + 6 * p2[i]; + a = -3 * p0[i] + 9 * p1[i] - 9 * p2[i] + 3 * p3[i]; + c = 3 * p1[i] - 3 * p0[i]; + b |= 0; + a |= 0; + c |= 0; + if (0 === a && 0 === b) ; + else if (0 === a) { + t = -c / b; + if (t > 0 && t < 1) bounds[i].push(this.calculateF(t, p0, p1, p2, p3, i)); + } else { + b2ac = b * b - 4 * c * a; + if (b2ac >= 0) { + t1 = (-b + bmSqrt(b2ac)) / (2 * a); + if (t1 > 0 && t1 < 1) bounds[i].push(this.calculateF(t1, p0, p1, p2, p3, i)); + t2 = (-b - bmSqrt(b2ac)) / (2 * a); + if (t2 > 0 && t2 < 1) bounds[i].push(this.calculateF(t2, p0, p1, p2, p3, i)); + } + } + } + this.shapeBoundingBox.left = bmMin.apply(null, bounds[0]); + this.shapeBoundingBox.top = bmMin.apply(null, bounds[1]); + this.shapeBoundingBox.right = bmMax.apply(null, bounds[0]); + this.shapeBoundingBox.bottom = bmMax.apply(null, bounds[1]); + }; + HShapeElement.prototype.calculateF = function(t, p0, p1, p2, p3, i) { + return bmPow(1 - t, 3) * p0[i] + 3 * bmPow(1 - t, 2) * t * p1[i] + 3 * (1 - t) * bmPow(t, 2) * p2[i] + bmPow(t, 3) * p3[i]; + }; + HShapeElement.prototype.calculateBoundingBox = function(itemsData, boundingBox) { + var i; + var len = itemsData.length; + for(i = 0; i < len; i += 1)if (itemsData[i] && itemsData[i].sh) this.calculateShapeBoundingBox(itemsData[i], boundingBox); + else if (itemsData[i] && itemsData[i].it) this.calculateBoundingBox(itemsData[i].it, boundingBox); + else if (itemsData[i] && itemsData[i].style && itemsData[i].w) this.expandStrokeBoundingBox(itemsData[i].w, boundingBox); + }; + HShapeElement.prototype.expandStrokeBoundingBox = function(widthProperty, boundingBox) { + var width = 0; + if (widthProperty.keyframes) { + for(var i = 0; i < widthProperty.keyframes.length; i += 1){ + var kfw = widthProperty.keyframes[i].s; + if (kfw > width) width = kfw; + } + width *= widthProperty.mult; + } else width = widthProperty.v * widthProperty.mult; + boundingBox.x -= width; + boundingBox.xMax += width; + boundingBox.y -= width; + boundingBox.yMax += width; + }; + HShapeElement.prototype.currentBoxContains = function(box) { + return this.currentBBox.x <= box.x && this.currentBBox.y <= box.y && this.currentBBox.width + this.currentBBox.x >= box.x + box.width && this.currentBBox.height + this.currentBBox.y >= box.y + box.height; + }; + HShapeElement.prototype.renderInnerContent = function() { + this._renderShapeFrame(); + if (!this.hidden && (this._isFirstFrame || this._mdf)) { + var tempBoundingBox = this.tempBoundingBox; + var max = 999999; + tempBoundingBox.x = max; + tempBoundingBox.xMax = -max; + tempBoundingBox.y = max; + tempBoundingBox.yMax = -max; + this.calculateBoundingBox(this.itemsData, tempBoundingBox); + tempBoundingBox.width = tempBoundingBox.xMax < tempBoundingBox.x ? 0 : tempBoundingBox.xMax - tempBoundingBox.x; + tempBoundingBox.height = tempBoundingBox.yMax < tempBoundingBox.y ? 0 : tempBoundingBox.yMax - tempBoundingBox.y; + if (this.currentBoxContains(tempBoundingBox)) return; + var changed = false; + if (this.currentBBox.w !== tempBoundingBox.width) { + this.currentBBox.w = tempBoundingBox.width; + this.shapeCont.setAttribute('width', tempBoundingBox.width); + changed = true; + } + if (this.currentBBox.h !== tempBoundingBox.height) { + this.currentBBox.h = tempBoundingBox.height; + this.shapeCont.setAttribute('height', tempBoundingBox.height); + changed = true; + } + if (changed || this.currentBBox.x !== tempBoundingBox.x || this.currentBBox.y !== tempBoundingBox.y) { + this.currentBBox.w = tempBoundingBox.width; + this.currentBBox.h = tempBoundingBox.height; + this.currentBBox.x = tempBoundingBox.x; + this.currentBBox.y = tempBoundingBox.y; + this.shapeCont.setAttribute('viewBox', this.currentBBox.x + ' ' + this.currentBBox.y + ' ' + this.currentBBox.w + ' ' + this.currentBBox.h); + var shapeStyle = this.shapeCont.style; + var shapeTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)'; + shapeStyle.transform = shapeTransform; + shapeStyle.webkitTransform = shapeTransform; + } + } + }; + function HTextElement(data, globalData, comp) { + this.textSpans = []; + this.textPaths = []; + this.currentBBox = { + x: 999999, + y: -999999, + h: 0, + w: 0 + }; + this.renderType = 'svg'; + this.isMasked = false; + this.initElement(data, globalData, comp); + } + extendPrototype([ + BaseElement, + TransformElement, + HBaseElement, + HierarchyElement, + FrameElement, + RenderableDOMElement, + ITextElement + ], HTextElement); + HTextElement.prototype.createContent = function() { + this.isMasked = this.checkMasks(); + if (this.isMasked) { + this.renderType = 'svg'; + this.compW = this.comp.data.w; + this.compH = this.comp.data.h; + this.svgElement.setAttribute('width', this.compW); + this.svgElement.setAttribute('height', this.compH); + var g = createNS('g'); + this.maskedElement.appendChild(g); + this.innerElem = g; + } else { + this.renderType = 'html'; + this.innerElem = this.layerElement; + } + this.checkParenting(); + }; + HTextElement.prototype.buildNewText = function() { + var documentData = this.textProperty.currentData; + this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0); + var innerElemStyle = this.innerElem.style; + var textColor = documentData.fc ? this.buildColor(documentData.fc) : 'rgba(0,0,0,0)'; + innerElemStyle.fill = textColor; + innerElemStyle.color = textColor; + if (documentData.sc) { + innerElemStyle.stroke = this.buildColor(documentData.sc); + innerElemStyle.strokeWidth = documentData.sw + 'px'; + } + var fontData = this.globalData.fontManager.getFontByName(documentData.f); + if (!this.globalData.fontManager.chars) { + innerElemStyle.fontSize = documentData.finalSize + 'px'; + innerElemStyle.lineHeight = documentData.finalSize + 'px'; + if (fontData.fClass) this.innerElem.className = fontData.fClass; + else { + innerElemStyle.fontFamily = fontData.fFamily; + var fWeight = documentData.fWeight; + var fStyle = documentData.fStyle; + innerElemStyle.fontStyle = fStyle; + innerElemStyle.fontWeight = fWeight; + } + } + var i; + var len; + var letters = documentData.l; + len = letters.length; + var tSpan; + var tParent; + var tCont; + var matrixHelper = this.mHelper; + var shapes; + var shapeStr = ''; + var cnt = 0; + for(i = 0; i < len; i += 1){ + if (this.globalData.fontManager.chars) { + if (this.textPaths[cnt]) tSpan = this.textPaths[cnt]; + else { + tSpan = createNS('path'); + tSpan.setAttribute('stroke-linecap', lineCapEnum[1]); + tSpan.setAttribute('stroke-linejoin', lineJoinEnum[2]); + tSpan.setAttribute('stroke-miterlimit', '4'); + } + if (!this.isMasked) if (this.textSpans[cnt]) { + tParent = this.textSpans[cnt]; + tCont = tParent.children[0]; + } else { + tParent = createTag('div'); + tParent.style.lineHeight = 0; + tCont = createNS('svg'); + tCont.appendChild(tSpan); + styleDiv(tParent); + } + } else if (this.isMasked) tSpan = this.textPaths[cnt] ? this.textPaths[cnt] : createNS('text'); + else if (this.textSpans[cnt]) { + tParent = this.textSpans[cnt]; + tSpan = this.textPaths[cnt]; + } else { + tParent = createTag('span'); + styleDiv(tParent); + tSpan = createTag('span'); + styleDiv(tSpan); + tParent.appendChild(tSpan); + } + if (this.globalData.fontManager.chars) { + var charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily); + var shapeData; + shapeData = charData ? charData.data : null; + matrixHelper.reset(); + if (shapeData && shapeData.shapes && shapeData.shapes.length) { + shapes = shapeData.shapes[0].it; + matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100); + shapeStr = this.createPathShape(matrixHelper, shapes); + tSpan.setAttribute('d', shapeStr); + } + if (this.isMasked) this.innerElem.appendChild(tSpan); + else { + this.innerElem.appendChild(tParent); + if (shapeData && shapeData.shapes) { + document.body.appendChild(tCont); + var boundingBox = tCont.getBBox(); + tCont.setAttribute('width', boundingBox.width + 2); + tCont.setAttribute('height', boundingBox.height + 2); + tCont.setAttribute('viewBox', boundingBox.x - 1 + ' ' + (boundingBox.y - 1) + ' ' + (boundingBox.width + 2) + ' ' + (boundingBox.height + 2)); + var tContStyle = tCont.style; + var tContTranslation = 'translate(' + (boundingBox.x - 1) + 'px,' + (boundingBox.y - 1) + 'px)'; + tContStyle.transform = tContTranslation; + tContStyle.webkitTransform = tContTranslation; + letters[i].yOffset = boundingBox.y - 1; + } else { + tCont.setAttribute('width', 1); + tCont.setAttribute('height', 1); + } + tParent.appendChild(tCont); + } + } else { + tSpan.textContent = letters[i].val; + tSpan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve'); + if (this.isMasked) this.innerElem.appendChild(tSpan); + else { + this.innerElem.appendChild(tParent); + var tStyle = tSpan.style; + var tSpanTranslation = 'translate3d(0,' + -documentData.finalSize / 1.2 + 'px,0)'; + tStyle.transform = tSpanTranslation; + tStyle.webkitTransform = tSpanTranslation; + } + } + if (this.isMasked) this.textSpans[cnt] = tSpan; + else this.textSpans[cnt] = tParent; + this.textSpans[cnt].style.display = 'block'; + this.textPaths[cnt] = tSpan; + cnt += 1; + } + while(cnt < this.textSpans.length){ + this.textSpans[cnt].style.display = 'none'; + cnt += 1; + } + }; + HTextElement.prototype.renderInnerContent = function() { + this.validateText(); + var svgStyle; + if (this.data.singleShape) { + if (!this._isFirstFrame && !this.lettersChangedFlag) return; + if (this.isMasked && this.finalTransform._matMdf) { + this.svgElement.setAttribute('viewBox', -this.finalTransform.mProp.p.v[0] + ' ' + -this.finalTransform.mProp.p.v[1] + ' ' + this.compW + ' ' + this.compH); + svgStyle = this.svgElement.style; + var translation = 'translate(' + -this.finalTransform.mProp.p.v[0] + 'px,' + -this.finalTransform.mProp.p.v[1] + 'px)'; + svgStyle.transform = translation; + svgStyle.webkitTransform = translation; + } + } + this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag); + if (!this.lettersChangedFlag && !this.textAnimator.lettersChangedFlag) return; + var i; + var len; + var count = 0; + var renderedLetters = this.textAnimator.renderedLetters; + var letters = this.textProperty.currentData.l; + len = letters.length; + var renderedLetter; + var textSpan; + var textPath; + for(i = 0; i < len; i += 1)if (letters[i].n) count += 1; + else { + textSpan = this.textSpans[i]; + textPath = this.textPaths[i]; + renderedLetter = renderedLetters[count]; + count += 1; + if (renderedLetter._mdf.m) if (this.isMasked) textSpan.setAttribute('transform', renderedLetter.m); + else { + textSpan.style.webkitTransform = renderedLetter.m; + textSpan.style.transform = renderedLetter.m; + } + textSpan.style.opacity = renderedLetter.o; + if (renderedLetter.sw && renderedLetter._mdf.sw) textPath.setAttribute('stroke-width', renderedLetter.sw); + if (renderedLetter.sc && renderedLetter._mdf.sc) textPath.setAttribute('stroke', renderedLetter.sc); + if (renderedLetter.fc && renderedLetter._mdf.fc) { + textPath.setAttribute('fill', renderedLetter.fc); + textPath.style.color = renderedLetter.fc; + } + } + if (this.innerElem.getBBox && !this.hidden && (this._isFirstFrame || this._mdf)) { + var boundingBox = this.innerElem.getBBox(); + if (this.currentBBox.w !== boundingBox.width) { + this.currentBBox.w = boundingBox.width; + this.svgElement.setAttribute('width', boundingBox.width); + } + if (this.currentBBox.h !== boundingBox.height) { + this.currentBBox.h = boundingBox.height; + this.svgElement.setAttribute('height', boundingBox.height); + } + var margin = 1; + if (this.currentBBox.w !== boundingBox.width + 2 * margin || this.currentBBox.h !== boundingBox.height + 2 * margin || this.currentBBox.x !== boundingBox.x - margin || this.currentBBox.y !== boundingBox.y - margin) { + this.currentBBox.w = boundingBox.width + 2 * margin; + this.currentBBox.h = boundingBox.height + 2 * margin; + this.currentBBox.x = boundingBox.x - margin; + this.currentBBox.y = boundingBox.y - margin; + this.svgElement.setAttribute('viewBox', this.currentBBox.x + ' ' + this.currentBBox.y + ' ' + this.currentBBox.w + ' ' + this.currentBBox.h); + svgStyle = this.svgElement.style; + var svgTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)'; + svgStyle.transform = svgTransform; + svgStyle.webkitTransform = svgTransform; + } + } + }; + function HCameraElement(data, globalData, comp) { + this.initFrame(); + this.initBaseData(data, globalData, comp); + this.initHierarchy(); + var getProp = PropertyFactory.getProp; + this.pe = getProp(this, data.pe, 0, 0, this); + if (data.ks.p.s) { + this.px = getProp(this, data.ks.p.x, 1, 0, this); + this.py = getProp(this, data.ks.p.y, 1, 0, this); + this.pz = getProp(this, data.ks.p.z, 1, 0, this); + } else this.p = getProp(this, data.ks.p, 1, 0, this); + if (data.ks.a) this.a = getProp(this, data.ks.a, 1, 0, this); + if (data.ks.or.k.length && data.ks.or.k[0].to) { + var i; + var len = data.ks.or.k.length; + for(i = 0; i < len; i += 1){ + data.ks.or.k[i].to = null; + data.ks.or.k[i].ti = null; + } + } + this.or = getProp(this, data.ks.or, 1, degToRads, this); + this.or.sh = true; + this.rx = getProp(this, data.ks.rx, 0, degToRads, this); + this.ry = getProp(this, data.ks.ry, 0, degToRads, this); + this.rz = getProp(this, data.ks.rz, 0, degToRads, this); + this.mat = new Matrix(); + this._prevMat = new Matrix(); + this._isFirstFrame = true; + this.finalTransform = { + mProp: this + }; + } + extendPrototype([ + BaseElement, + FrameElement, + HierarchyElement + ], HCameraElement); + HCameraElement.prototype.setup = function() { + var i; + var len = this.comp.threeDElements.length; + var comp; + var perspectiveStyle; + var containerStyle; + for(i = 0; i < len; i += 1){ + comp = this.comp.threeDElements[i]; + if ('3d' === comp.type) { + perspectiveStyle = comp.perspectiveElem.style; + containerStyle = comp.container.style; + var perspective = this.pe.v + 'px'; + var origin = '0px 0px 0px'; + var matrix = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)'; + perspectiveStyle.perspective = perspective; + perspectiveStyle.webkitPerspective = perspective; + containerStyle.transformOrigin = origin; + containerStyle.mozTransformOrigin = origin; + containerStyle.webkitTransformOrigin = origin; + perspectiveStyle.transform = matrix; + perspectiveStyle.webkitTransform = matrix; + } + } + }; + HCameraElement.prototype.createElements = function() {}; + HCameraElement.prototype.hide = function() {}; + HCameraElement.prototype.renderFrame = function() { + var _mdf = this._isFirstFrame; + var i; + var len; + if (this.hierarchy) { + len = this.hierarchy.length; + for(i = 0; i < len; i += 1)_mdf = this.hierarchy[i].finalTransform.mProp._mdf || _mdf; + } + if (_mdf || this.pe._mdf || this.p && this.p._mdf || this.px && (this.px._mdf || this.py._mdf || this.pz._mdf) || this.rx._mdf || this.ry._mdf || this.rz._mdf || this.or._mdf || this.a && this.a._mdf) { + this.mat.reset(); + if (this.hierarchy) { + len = this.hierarchy.length - 1; + for(i = len; i >= 0; i -= 1){ + var mTransf = this.hierarchy[i].finalTransform.mProp; + this.mat.translate(-mTransf.p.v[0], -mTransf.p.v[1], mTransf.p.v[2]); + this.mat.rotateX(-mTransf.or.v[0]).rotateY(-mTransf.or.v[1]).rotateZ(mTransf.or.v[2]); + this.mat.rotateX(-mTransf.rx.v).rotateY(-mTransf.ry.v).rotateZ(mTransf.rz.v); + this.mat.scale(1 / mTransf.s.v[0], 1 / mTransf.s.v[1], 1 / mTransf.s.v[2]); + this.mat.translate(mTransf.a.v[0], mTransf.a.v[1], mTransf.a.v[2]); + } + } + if (this.p) this.mat.translate(-this.p.v[0], -this.p.v[1], this.p.v[2]); + else this.mat.translate(-this.px.v, -this.py.v, this.pz.v); + if (this.a) { + var diffVector; + diffVector = this.p ? [ + this.p.v[0] - this.a.v[0], + this.p.v[1] - this.a.v[1], + this.p.v[2] - this.a.v[2] + ] : [ + this.px.v - this.a.v[0], + this.py.v - this.a.v[1], + this.pz.v - this.a.v[2] + ]; + var mag = Math.sqrt(Math.pow(diffVector[0], 2) + Math.pow(diffVector[1], 2) + Math.pow(diffVector[2], 2)); + var lookDir = [ + diffVector[0] / mag, + diffVector[1] / mag, + diffVector[2] / mag + ]; + var lookLengthOnXZ = Math.sqrt(lookDir[2] * lookDir[2] + lookDir[0] * lookDir[0]); + var mRotationX = Math.atan2(lookDir[1], lookLengthOnXZ); + var mRotationY = Math.atan2(lookDir[0], -lookDir[2]); + this.mat.rotateY(mRotationY).rotateX(-mRotationX); + } + this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v); + this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]); + this.mat.translate(this.globalData.compSize.w / 2, this.globalData.compSize.h / 2, 0); + this.mat.translate(0, 0, this.pe.v); + var hasMatrixChanged = !this._prevMat.equals(this.mat); + if ((hasMatrixChanged || this.pe._mdf) && this.comp.threeDElements) { + len = this.comp.threeDElements.length; + var comp; + var perspectiveStyle; + var containerStyle; + for(i = 0; i < len; i += 1){ + comp = this.comp.threeDElements[i]; + if ('3d' === comp.type) { + if (hasMatrixChanged) { + var matValue = this.mat.toCSS(); + containerStyle = comp.container.style; + containerStyle.transform = matValue; + containerStyle.webkitTransform = matValue; + } + if (this.pe._mdf) { + perspectiveStyle = comp.perspectiveElem.style; + perspectiveStyle.perspective = this.pe.v + 'px'; + perspectiveStyle.webkitPerspective = this.pe.v + 'px'; + } + } + } + this.mat.clone(this._prevMat); + } + } + this._isFirstFrame = false; + }; + HCameraElement.prototype.prepareFrame = function(num) { + this.prepareProperties(num, true); + }; + HCameraElement.prototype.destroy = function() {}; + HCameraElement.prototype.getBaseElement = function() { + return null; + }; + function HImageElement(data, globalData, comp) { + this.assetData = globalData.getAssetData(data.refId); + this.initElement(data, globalData, comp); + } + extendPrototype([ + BaseElement, + TransformElement, + HBaseElement, + HSolidElement, + HierarchyElement, + FrameElement, + RenderableElement + ], HImageElement); + HImageElement.prototype.createContent = function() { + var assetPath = this.globalData.getAssetsPath(this.assetData); + var img = new Image(); + if (this.data.hasMask) { + this.imageElem = createNS('image'); + this.imageElem.setAttribute('width', this.assetData.w + 'px'); + this.imageElem.setAttribute('height', this.assetData.h + 'px'); + this.imageElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath); + this.layerElement.appendChild(this.imageElem); + this.baseElement.setAttribute('width', this.assetData.w); + this.baseElement.setAttribute('height', this.assetData.h); + } else this.layerElement.appendChild(img); + img.crossOrigin = 'anonymous'; + img.src = assetPath; + if (this.data.ln) this.baseElement.setAttribute('id', this.data.ln); + }; + function HybridRendererBase(animationItem, config) { + this.animationItem = animationItem; + this.layers = null; + this.renderedFrame = -1; + this.renderConfig = { + className: config && config.className || '', + imagePreserveAspectRatio: config && config.imagePreserveAspectRatio || 'xMidYMid slice', + hideOnTransparent: !(config && false === config.hideOnTransparent), + filterSize: { + width: config && config.filterSize && config.filterSize.width || '400%', + height: config && config.filterSize && config.filterSize.height || '400%', + x: config && config.filterSize && config.filterSize.x || '-100%', + y: config && config.filterSize && config.filterSize.y || '-100%' + } + }; + this.globalData = { + _mdf: false, + frameNum: -1, + renderConfig: this.renderConfig + }; + this.pendingElements = []; + this.elements = []; + this.threeDElements = []; + this.destroyed = false; + this.camera = null; + this.supports3d = true; + this.rendererType = 'html'; + } + extendPrototype([ + BaseRenderer + ], HybridRendererBase); + HybridRendererBase.prototype.buildItem = SVGRenderer.prototype.buildItem; + HybridRendererBase.prototype.checkPendingElements = function() { + while(this.pendingElements.length){ + var element = this.pendingElements.pop(); + element.checkParenting(); + } + }; + HybridRendererBase.prototype.appendElementInPos = function(element, pos) { + var newDOMElement = element.getBaseElement(); + if (!newDOMElement) return; + var layer = this.layers[pos]; + if (layer.ddd && this.supports3d) this.addTo3dContainer(newDOMElement, pos); + else if (this.threeDElements) this.addTo3dContainer(newDOMElement, pos); + else { + var i = 0; + var nextDOMElement; + var nextLayer; + var tmpDOMElement; + while(i < pos){ + if (this.elements[i] && true !== this.elements[i] && this.elements[i].getBaseElement) { + nextLayer = this.elements[i]; + tmpDOMElement = this.layers[i].ddd ? this.getThreeDContainerByPos(i) : nextLayer.getBaseElement(); + nextDOMElement = tmpDOMElement || nextDOMElement; + } + i += 1; + } + if (nextDOMElement) { + if (!layer.ddd || !this.supports3d) this.layerElement.insertBefore(newDOMElement, nextDOMElement); + } else if (!layer.ddd || !this.supports3d) this.layerElement.appendChild(newDOMElement); + } + }; + HybridRendererBase.prototype.createShape = function(data) { + if (!this.supports3d) return new SVGShapeElement(data, this.globalData, this); + return new HShapeElement(data, this.globalData, this); + }; + HybridRendererBase.prototype.createText = function(data) { + if (!this.supports3d) return new SVGTextLottieElement(data, this.globalData, this); + return new HTextElement(data, this.globalData, this); + }; + HybridRendererBase.prototype.createCamera = function(data) { + this.camera = new HCameraElement(data, this.globalData, this); + return this.camera; + }; + HybridRendererBase.prototype.createImage = function(data) { + if (!this.supports3d) return new IImageElement(data, this.globalData, this); + return new HImageElement(data, this.globalData, this); + }; + HybridRendererBase.prototype.createSolid = function(data) { + if (!this.supports3d) return new ISolidElement(data, this.globalData, this); + return new HSolidElement(data, this.globalData, this); + }; + HybridRendererBase.prototype.createNull = SVGRenderer.prototype.createNull; + HybridRendererBase.prototype.getThreeDContainerByPos = function(pos) { + var i = 0; + var len = this.threeDElements.length; + while(i < len){ + if (this.threeDElements[i].startPos <= pos && this.threeDElements[i].endPos >= pos) return this.threeDElements[i].perspectiveElem; + i += 1; + } + return null; + }; + HybridRendererBase.prototype.createThreeDContainer = function(pos, type) { + var perspectiveElem = createTag('div'); + var style; + var containerStyle; + styleDiv(perspectiveElem); + var container = createTag('div'); + styleDiv(container); + if ('3d' === type) { + style = perspectiveElem.style; + style.width = this.globalData.compSize.w + 'px'; + style.height = this.globalData.compSize.h + 'px'; + var center = '50% 50%'; + style.webkitTransformOrigin = center; + style.mozTransformOrigin = center; + style.transformOrigin = center; + containerStyle = container.style; + var matrix = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)'; + containerStyle.transform = matrix; + containerStyle.webkitTransform = matrix; + } + perspectiveElem.appendChild(container); + var threeDContainerData = { + container: container, + perspectiveElem: perspectiveElem, + startPos: pos, + endPos: pos, + type: type + }; + this.threeDElements.push(threeDContainerData); + return threeDContainerData; + }; + HybridRendererBase.prototype.build3dContainers = function() { + var i; + var len = this.layers.length; + var lastThreeDContainerData; + var currentContainer = ''; + for(i = 0; i < len; i += 1)if (this.layers[i].ddd && 3 !== this.layers[i].ty) { + if ('3d' !== currentContainer) { + currentContainer = '3d'; + lastThreeDContainerData = this.createThreeDContainer(i, '3d'); + } + lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos, i); + } else { + if ('2d' !== currentContainer) { + currentContainer = '2d'; + lastThreeDContainerData = this.createThreeDContainer(i, '2d'); + } + lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos, i); + } + len = this.threeDElements.length; + for(i = len - 1; i >= 0; i -= 1)this.resizerElem.appendChild(this.threeDElements[i].perspectiveElem); + }; + HybridRendererBase.prototype.addTo3dContainer = function(elem, pos) { + var i = 0; + var len = this.threeDElements.length; + while(i < len){ + if (pos <= this.threeDElements[i].endPos) { + var j = this.threeDElements[i].startPos; + var nextElement; + while(j < pos){ + if (this.elements[j] && this.elements[j].getBaseElement) nextElement = this.elements[j].getBaseElement(); + j += 1; + } + if (nextElement) this.threeDElements[i].container.insertBefore(elem, nextElement); + else this.threeDElements[i].container.appendChild(elem); + break; + } + i += 1; + } + }; + HybridRendererBase.prototype.configAnimation = function(animData) { + var resizerElem = createTag('div'); + var wrapper = this.animationItem.wrapper; + var style = resizerElem.style; + style.width = animData.w + 'px'; + style.height = animData.h + 'px'; + this.resizerElem = resizerElem; + styleDiv(resizerElem); + style.transformStyle = 'flat'; + style.mozTransformStyle = 'flat'; + style.webkitTransformStyle = 'flat'; + if (this.renderConfig.className) resizerElem.setAttribute('class', this.renderConfig.className); + wrapper.appendChild(resizerElem); + style.overflow = 'hidden'; + var svg = createNS('svg'); + svg.setAttribute('width', '1'); + svg.setAttribute('height', '1'); + styleDiv(svg); + this.resizerElem.appendChild(svg); + var defs = createNS('defs'); + svg.appendChild(defs); + this.data = animData; + this.setupGlobalData(animData, svg); + this.globalData.defs = defs; + this.layers = animData.layers; + this.layerElement = this.resizerElem; + this.build3dContainers(); + this.updateContainerSize(); + }; + HybridRendererBase.prototype.destroy = function() { + if (this.animationItem.wrapper) this.animationItem.wrapper.innerText = ''; + this.animationItem.container = null; + this.globalData.defs = null; + var i; + var len = this.layers ? this.layers.length : 0; + for(i = 0; i < len; i += 1)if (this.elements[i] && this.elements[i].destroy) this.elements[i].destroy(); + this.elements.length = 0; + this.destroyed = true; + this.animationItem = null; + }; + HybridRendererBase.prototype.updateContainerSize = function() { + var elementWidth = this.animationItem.wrapper.offsetWidth; + var elementHeight = this.animationItem.wrapper.offsetHeight; + var elementRel = elementWidth / elementHeight; + var animationRel = this.globalData.compSize.w / this.globalData.compSize.h; + var sx; + var sy; + var tx; + var ty; + if (animationRel > elementRel) { + sx = elementWidth / this.globalData.compSize.w; + sy = elementWidth / this.globalData.compSize.w; + tx = 0; + ty = (elementHeight - this.globalData.compSize.h * (elementWidth / this.globalData.compSize.w)) / 2; + } else { + sx = elementHeight / this.globalData.compSize.h; + sy = elementHeight / this.globalData.compSize.h; + tx = (elementWidth - this.globalData.compSize.w * (elementHeight / this.globalData.compSize.h)) / 2; + ty = 0; + } + var style = this.resizerElem.style; + style.webkitTransform = 'matrix3d(' + sx + ',0,0,0,0,' + sy + ',0,0,0,0,1,0,' + tx + ',' + ty + ',0,1)'; + style.transform = style.webkitTransform; + }; + HybridRendererBase.prototype.renderFrame = SVGRenderer.prototype.renderFrame; + HybridRendererBase.prototype.hide = function() { + this.resizerElem.style.display = 'none'; + }; + HybridRendererBase.prototype.show = function() { + this.resizerElem.style.display = 'block'; + }; + HybridRendererBase.prototype.initItems = function() { + this.buildAllItems(); + if (this.camera) this.camera.setup(); + else { + var cWidth = this.globalData.compSize.w; + var cHeight = this.globalData.compSize.h; + var i; + var len = this.threeDElements.length; + for(i = 0; i < len; i += 1){ + var style = this.threeDElements[i].perspectiveElem.style; + style.webkitPerspective = Math.sqrt(Math.pow(cWidth, 2) + Math.pow(cHeight, 2)) + 'px'; + style.perspective = style.webkitPerspective; + } + } + }; + HybridRendererBase.prototype.searchExtraCompositions = function(assets) { + var i; + var len = assets.length; + var floatingContainer = createTag('div'); + for(i = 0; i < len; i += 1)if (assets[i].xt) { + var comp = this.createComp(assets[i], floatingContainer, this.globalData.comp, null); + comp.initExpressions(); + this.globalData.projectInterface.registerComposition(comp); + } + }; + function HCompElement(data, globalData, comp) { + this.layers = data.layers; + this.supports3d = !data.hasMask; + this.completeLayers = false; + this.pendingElements = []; + this.elements = this.layers ? createSizedArray(this.layers.length) : []; + this.initElement(data, globalData, comp); + this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { + _placeholder: true + }; + } + extendPrototype([ + HybridRendererBase, + ICompElement, + HBaseElement + ], HCompElement); + HCompElement.prototype._createBaseContainerElements = HCompElement.prototype.createContainerElements; + HCompElement.prototype.createContainerElements = function() { + this._createBaseContainerElements(); + if (this.data.hasMask) { + this.svgElement.setAttribute('width', this.data.w); + this.svgElement.setAttribute('height', this.data.h); + this.transformedElement = this.baseElement; + } else this.transformedElement = this.layerElement; + }; + HCompElement.prototype.addTo3dContainer = function(elem, pos) { + var j = 0; + var nextElement; + while(j < pos){ + if (this.elements[j] && this.elements[j].getBaseElement) nextElement = this.elements[j].getBaseElement(); + j += 1; + } + if (nextElement) this.layerElement.insertBefore(elem, nextElement); + else this.layerElement.appendChild(elem); + }; + HCompElement.prototype.createComp = function(data) { + if (!this.supports3d) return new SVGCompElement(data, this.globalData, this); + return new HCompElement(data, this.globalData, this); + }; + function HybridRenderer(animationItem, config) { + this.animationItem = animationItem; + this.layers = null; + this.renderedFrame = -1; + this.renderConfig = { + className: config && config.className || '', + imagePreserveAspectRatio: config && config.imagePreserveAspectRatio || 'xMidYMid slice', + hideOnTransparent: !(config && false === config.hideOnTransparent), + filterSize: { + width: config && config.filterSize && config.filterSize.width || '400%', + height: config && config.filterSize && config.filterSize.height || '400%', + x: config && config.filterSize && config.filterSize.x || '-100%', + y: config && config.filterSize && config.filterSize.y || '-100%' + }, + runExpressions: !config || void 0 === config.runExpressions || config.runExpressions + }; + this.globalData = { + _mdf: false, + frameNum: -1, + renderConfig: this.renderConfig + }; + this.pendingElements = []; + this.elements = []; + this.threeDElements = []; + this.destroyed = false; + this.camera = null; + this.supports3d = true; + this.rendererType = 'html'; + } + extendPrototype([ + HybridRendererBase + ], HybridRenderer); + HybridRenderer.prototype.createComp = function(data) { + if (!this.supports3d) return new SVGCompElement(data, this.globalData, this); + return new HCompElement(data, this.globalData, this); + }; + var CompExpressionInterface = function() { + return function(comp) { + function _thisLayerFunction(name) { + var i = 0; + var len = comp.layers.length; + while(i < len){ + if (comp.layers[i].nm === name || comp.layers[i].ind === name) return comp.elements[i].layerInterface; + i += 1; + } + return null; + } + Object.defineProperty(_thisLayerFunction, '_name', { + value: comp.data.nm + }); + _thisLayerFunction.layer = _thisLayerFunction; + _thisLayerFunction.pixelAspect = 1; + _thisLayerFunction.height = comp.data.h || comp.globalData.compSize.h; + _thisLayerFunction.width = comp.data.w || comp.globalData.compSize.w; + _thisLayerFunction.pixelAspect = 1; + _thisLayerFunction.frameDuration = 1 / comp.globalData.frameRate; + _thisLayerFunction.displayStartTime = 0; + _thisLayerFunction.numLayers = comp.layers.length; + return _thisLayerFunction; + }; + }(); + function _typeof$2(o) { + return _typeof$2 = "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$2(o); + } + function seedRandom(pool, math) { + var global = this, width = 256, chunks = 6, digits = 52, rngname = 'random', startdenom = math.pow(width, chunks), significance = math.pow(2, digits), overflow = 2 * significance, mask = width - 1, nodecrypto; + function seedrandom(seed, options, callback) { + var key = []; + options = true === options ? { + entropy: true + } : options || {}; + var shortseed = mixkey(flatten(options.entropy ? [ + seed, + tostring(pool) + ] : null === seed ? autoseed() : seed, 3), key); + var arc4 = new ARC4(key); + var prng = function() { + var n = arc4.g(chunks), d = startdenom, x = 0; + while(n < significance){ + n = (n + x) * width; + d *= width; + x = arc4.g(1); + } + while(n >= overflow){ + n /= 2; + d /= 2; + x >>>= 1; + } + return (n + x) / d; + }; + prng.int32 = function() { + return 0 | arc4.g(4); + }; + prng.quick = function() { + return arc4.g(4) / 0x100000000; + }; + prng["double"] = prng; + mixkey(tostring(arc4.S), pool); + return (options.pass || callback || function(prng, seed, is_math_call, state) { + if (state) { + if (state.S) copy(state, arc4); + prng.state = function() { + return copy(arc4, {}); + }; + } + if (!is_math_call) return prng; + math[rngname] = prng; + return seed; + })(prng, shortseed, 'global' in options ? options.global : this == math, options.state); + } + math['seed' + rngname] = seedrandom; + function ARC4(key) { + var t, keylen = key.length, me = this, i = 0, j = me.i = me.j = 0, s = me.S = []; + if (!keylen) key = [ + keylen++ + ]; + while(i < width)s[i] = i++; + for(i = 0; i < width; i++){ + s[i] = s[j = mask & j + key[i % keylen] + (t = s[i])]; + s[j] = t; + } + me.g = function(count) { + var t, r = 0, i = me.i, j = me.j, s = me.S; + while(count--){ + t = s[i = mask & i + 1]; + r = r * width + s[mask & (s[i] = s[j = mask & j + t]) + (s[j] = t)]; + } + me.i = i; + me.j = j; + return r; + }; + } + function copy(f, t) { + t.i = f.i; + t.j = f.j; + t.S = f.S.slice(); + return t; + } + function flatten(obj, depth) { + var result = [], typ = _typeof$2(obj), prop; + if (depth && 'object' == typ) for(prop in obj)try { + result.push(flatten(obj[prop], depth - 1)); + } catch (e) {} + return result.length ? result : 'string' == typ ? obj : obj + '\0'; + } + function mixkey(seed, key) { + var stringseed = seed + '', smear, j = 0; + while(j < stringseed.length)key[mask & j] = mask & (smear ^= 19 * key[mask & j]) + stringseed.charCodeAt(j++); + return tostring(key); + } + function autoseed() { + try { + if (nodecrypto) return tostring(nodecrypto.randomBytes(width)); + var out = new Uint8Array(width); + (global.crypto || global.msCrypto).getRandomValues(out); + return tostring(out); + } catch (e) { + var browser = global.navigator, plugins = browser && browser.plugins; + return [ + +new Date(), + global, + plugins, + global.screen, + tostring(pool) + ]; + } + } + function tostring(a) { + return String.fromCharCode.apply(0, a); + } + mixkey(math.random(), pool); + } + function initialize$2(BMMath) { + seedRandom([], BMMath); + } + var propTypes = { + SHAPE: 'shape' + }; + function _typeof$1(o) { + return _typeof$1 = "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$1(o); + } + var ExpressionManager = function() { + 'use strict'; + var ob = {}; + var Math1 = BMMath; + var window1 = null; + var document1 = null; + var XMLHttpRequest1 = null; + var fetch = null; + var frames = null; + var _lottieGlobal = {}; + initialize$2(BMMath); + function resetFrame() { + _lottieGlobal = {}; + } + function $bm_isInstanceOfArray(arr) { + return arr.constructor === Array || arr.constructor === Float32Array; + } + function isNumerable(tOfV, v) { + return 'number' === tOfV || v instanceof Number || 'boolean' === tOfV || 'string' === tOfV; + } + function $bm_neg(a) { + var tOfA = _typeof$1(a); + if ('number' === tOfA || a instanceof Number || 'boolean' === tOfA) return -a; + if ($bm_isInstanceOfArray(a)) { + var i; + var lenA = a.length; + var retArr = []; + for(i = 0; i < lenA; i += 1)retArr[i] = -a[i]; + return retArr; + } + if (a.propType) return a.v; + return -a; + } + var easeInBez = BezierFactory.getBezierEasing(0.333, 0, 0.833, 0.833, 'easeIn').get; + var easeOutBez = BezierFactory.getBezierEasing(0.167, 0.167, 0.667, 1, 'easeOut').get; + var easeInOutBez = BezierFactory.getBezierEasing(0.33, 0, 0.667, 1, 'easeInOut').get; + function sum(a, b) { + var tOfA = _typeof$1(a); + var tOfB = _typeof$1(b); + if (isNumerable(tOfA, a) && isNumerable(tOfB, b) || 'string' === tOfA || 'string' === tOfB) return a + b; + if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) { + a = a.slice(0); + a[0] += b; + return a; + } + if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) { + b = b.slice(0); + b[0] = a + b[0]; + return b; + } + if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) { + var i = 0; + var lenA = a.length; + var lenB = b.length; + var retArr = []; + while(i < lenA || i < lenB){ + if (('number' == typeof a[i] || a[i] instanceof Number) && ('number' == typeof b[i] || b[i] instanceof Number)) retArr[i] = a[i] + b[i]; + else retArr[i] = void 0 === b[i] ? a[i] : a[i] || b[i]; + i += 1; + } + return retArr; + } + return 0; + } + var add = sum; + function sub(a, b) { + var tOfA = _typeof$1(a); + var tOfB = _typeof$1(b); + if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) { + if ('string' === tOfA) a = parseInt(a, 10); + if ('string' === tOfB) b = parseInt(b, 10); + return a - b; + } + if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) { + a = a.slice(0); + a[0] -= b; + return a; + } + if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) { + b = b.slice(0); + b[0] = a - b[0]; + return b; + } + if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) { + var i = 0; + var lenA = a.length; + var lenB = b.length; + var retArr = []; + while(i < lenA || i < lenB){ + if (('number' == typeof a[i] || a[i] instanceof Number) && ('number' == typeof b[i] || b[i] instanceof Number)) retArr[i] = a[i] - b[i]; + else retArr[i] = void 0 === b[i] ? a[i] : a[i] || b[i]; + i += 1; + } + return retArr; + } + return 0; + } + function mul(a, b) { + var tOfA = _typeof$1(a); + var tOfB = _typeof$1(b); + var arr; + if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) return a * b; + var i; + var len; + if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) { + len = a.length; + arr = createTypedArray('float32', len); + for(i = 0; i < len; i += 1)arr[i] = a[i] * b; + return arr; + } + if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) { + len = b.length; + arr = createTypedArray('float32', len); + for(i = 0; i < len; i += 1)arr[i] = a * b[i]; + return arr; + } + return 0; + } + function div(a, b) { + var tOfA = _typeof$1(a); + var tOfB = _typeof$1(b); + var arr; + if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) return a / b; + var i; + var len; + if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) { + len = a.length; + arr = createTypedArray('float32', len); + for(i = 0; i < len; i += 1)arr[i] = a[i] / b; + return arr; + } + if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) { + len = b.length; + arr = createTypedArray('float32', len); + for(i = 0; i < len; i += 1)arr[i] = a / b[i]; + return arr; + } + return 0; + } + function mod(a, b) { + if ('string' == typeof a) a = parseInt(a, 10); + if ('string' == typeof b) b = parseInt(b, 10); + return a % b; + } + var $bm_sum = sum; + var $bm_sub = sub; + var $bm_mul = mul; + var $bm_div = div; + var $bm_mod = mod; + function clamp(num, min, max) { + if (min > max) { + var mm = max; + max = min; + min = mm; + } + return Math1.min(Math1.max(num, min), max); + } + function radiansToDegrees(val) { + return val / degToRads; + } + var radians_to_degrees = radiansToDegrees; + function degreesToRadians(val) { + return val * degToRads; + } + var degrees_to_radians = radiansToDegrees; + var helperLengthArray = [ + 0, + 0, + 0, + 0, + 0, + 0 + ]; + function length(arr1, arr2) { + if ('number' == typeof arr1 || arr1 instanceof Number) { + arr2 = arr2 || 0; + return Math1.abs(arr1 - arr2); + } + if (!arr2) arr2 = helperLengthArray; + var i; + var len = Math1.min(arr1.length, arr2.length); + var addedLength = 0; + for(i = 0; i < len; i += 1)addedLength += Math1.pow(arr2[i] - arr1[i], 2); + return Math1.sqrt(addedLength); + } + function normalize(vec) { + return div(vec, length(vec)); + } + function rgbToHsl(val) { + var r = val[0]; + var g = val[1]; + var b = val[2]; + var max = Math1.max(r, g, b); + var min = Math1.min(r, g, b); + var h; + var s; + var l = (max + min) / 2; + if (max === min) { + h = 0; + s = 0; + } else { + var d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + switch(max){ + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + default: + break; + } + h /= 6; + } + return [ + h, + s, + l, + val[3] + ]; + } + function hue2rgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t; + if (t < 0.5) return q; + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; + return p; + } + function hslToRgb(val) { + var h = val[0]; + var s = val[1]; + var l = val[2]; + var r; + var g; + var b; + if (0 === s) { + r = l; + b = l; + g = l; + } else { + var q = l < 0.5 ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + r = hue2rgb(p, q, h + 1 / 3); + g = hue2rgb(p, q, h); + b = hue2rgb(p, q, h - 1 / 3); + } + return [ + r, + g, + b, + val[3] + ]; + } + function linear(t, tMin, tMax, value1, value2) { + if (void 0 === value1 || void 0 === value2) { + value1 = tMin; + value2 = tMax; + tMin = 0; + tMax = 1; + } + if (tMax < tMin) { + var _tMin = tMax; + tMax = tMin; + tMin = _tMin; + } + if (t <= tMin) return value1; + if (t >= tMax) return value2; + var perc = tMax === tMin ? 0 : (t - tMin) / (tMax - tMin); + if (!value1.length) return value1 + (value2 - value1) * perc; + var i; + var len = value1.length; + var arr = createTypedArray('float32', len); + for(i = 0; i < len; i += 1)arr[i] = value1[i] + (value2[i] - value1[i]) * perc; + return arr; + } + function random(min, max) { + if (void 0 === max) if (void 0 === min) { + min = 0; + max = 1; + } else { + max = min; + min = void 0; + } + if (max.length) { + var i; + var len = max.length; + if (!min) min = createTypedArray('float32', len); + var arr = createTypedArray('float32', len); + var rnd = BMMath.random(); + for(i = 0; i < len; i += 1)arr[i] = min[i] + rnd * (max[i] - min[i]); + return arr; + } + if (void 0 === min) min = 0; + var rndm = BMMath.random(); + return min + rndm * (max - min); + } + function createPath(points, inTangents, outTangents, closed) { + var i; + var len = points.length; + var path = shapePool.newElement(); + path.setPathData(!!closed, len); + var arrPlaceholder = [ + 0, + 0 + ]; + var inVertexPoint; + var outVertexPoint; + for(i = 0; i < len; i += 1){ + inVertexPoint = inTangents && inTangents[i] ? inTangents[i] : arrPlaceholder; + outVertexPoint = outTangents && outTangents[i] ? outTangents[i] : arrPlaceholder; + path.setTripleAt(points[i][0], points[i][1], outVertexPoint[0] + points[i][0], outVertexPoint[1] + points[i][1], inVertexPoint[0] + points[i][0], inVertexPoint[1] + points[i][1], i, true); + } + return path; + } + function initiateExpression(elem, data, property) { + function noOp(_value) { + return _value; + } + if (!elem.globalData.renderConfig.runExpressions) return noOp; + var val = data.x; + var needsVelocity = /velocity(?![\w\d])/.test(val); + var _needsRandom = -1 !== val.indexOf('random'); + var elemType = elem.data.ty; + var transform; + var $bm_transform; + var content; + var effect; + var thisProperty = property; + thisProperty._name = elem.data.nm; + thisProperty.valueAtTime = thisProperty.getValueAtTime; + Object.defineProperty(thisProperty, 'value', { + get: function() { + return thisProperty.v; + } + }); + elem.comp.frameDuration = 1 / elem.comp.globalData.frameRate; + elem.comp.displayStartTime = 0; + var inPoint = elem.data.ip / elem.comp.globalData.frameRate; + var outPoint = elem.data.op / elem.comp.globalData.frameRate; + var width = elem.data.sw ? elem.data.sw : 0; + var height = elem.data.sh ? elem.data.sh : 0; + var name = elem.data.nm; + var loopIn; + var loop_in; + var loopOut; + var loop_out; + var smooth; + var toWorld; + var fromWorld; + var fromComp; + var toComp; + var fromCompToSurface; + var position; + var rotation; + var anchorPoint; + var scale; + var thisLayer; + var thisComp; + var mask; + var valueAtTime; + var velocityAtTime; + var scoped_bm_rt; + var expression_function = eval('[function _expression_function(){' + val + ';scoped_bm_rt=$bm_rt}]')[0]; + var numKeys = property.kf ? data.k.length : 0; + var active = !this.data || true !== this.data.hd; + var wiggle = (function(freq, amp) { + var iWiggle; + var j; + var lenWiggle = this.pv.length ? this.pv.length : 1; + var addedAmps = createTypedArray('float32', lenWiggle); + freq = 5; + var iterations = Math1.floor(time * freq); + iWiggle = 0; + j = 0; + while(iWiggle < iterations){ + for(j = 0; j < lenWiggle; j += 1)addedAmps[j] += -amp + 2 * amp * BMMath.random(); + iWiggle += 1; + } + var periods = time * freq; + var perc = periods - Math1.floor(periods); + var arr = createTypedArray('float32', lenWiggle); + if (lenWiggle > 1) { + for(j = 0; j < lenWiggle; j += 1)arr[j] = this.pv[j] + addedAmps[j] + (-amp + 2 * amp * BMMath.random()) * perc; + return arr; + } + return this.pv + addedAmps[0] + (-amp + 2 * amp * BMMath.random()) * perc; + }).bind(this); + if (thisProperty.loopIn) { + loopIn = thisProperty.loopIn.bind(thisProperty); + loop_in = loopIn; + } + if (thisProperty.loopOut) { + loopOut = thisProperty.loopOut.bind(thisProperty); + loop_out = loopOut; + } + if (thisProperty.smooth) smooth = thisProperty.smooth.bind(thisProperty); + function loopInDuration(type, duration) { + return loopIn(type, duration, true); + } + function loopOutDuration(type, duration) { + return loopOut(type, duration, true); + } + if (this.getValueAtTime) valueAtTime = this.getValueAtTime.bind(this); + if (this.getVelocityAtTime) velocityAtTime = this.getVelocityAtTime.bind(this); + var comp = elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface); + function lookAt(elem1, elem2) { + var fVec = [ + elem2[0] - elem1[0], + elem2[1] - elem1[1], + elem2[2] - elem1[2] + ]; + var pitch = Math1.atan2(fVec[0], Math1.sqrt(fVec[1] * fVec[1] + fVec[2] * fVec[2])) / degToRads; + var yaw = -Math1.atan2(fVec[1], fVec[2]) / degToRads; + return [ + yaw, + pitch, + 0 + ]; + } + function easeOut(t, tMin, tMax, val1, val2) { + return applyEase(easeOutBez, t, tMin, tMax, val1, val2); + } + function easeIn(t, tMin, tMax, val1, val2) { + return applyEase(easeInBez, t, tMin, tMax, val1, val2); + } + function ease(t, tMin, tMax, val1, val2) { + return applyEase(easeInOutBez, t, tMin, tMax, val1, val2); + } + function applyEase(fn, t, tMin, tMax, val1, val2) { + if (void 0 === val1) { + val1 = tMin; + val2 = tMax; + } else t = (t - tMin) / (tMax - tMin); + if (t > 1) t = 1; + else if (t < 0) t = 0; + var mult = fn(t); + if ($bm_isInstanceOfArray(val1)) { + var iKey; + var lenKey = val1.length; + var arr = createTypedArray('float32', lenKey); + for(iKey = 0; iKey < lenKey; iKey += 1)arr[iKey] = (val2[iKey] - val1[iKey]) * mult + val1[iKey]; + return arr; + } + return (val2 - val1) * mult + val1; + } + function nearestKey(time) { + var iKey; + var lenKey = data.k.length; + var index; + var keyTime; + if (data.k.length && 'number' != typeof data.k[0]) { + index = -1; + time *= elem.comp.globalData.frameRate; + if (time < data.k[0].t) { + index = 1; + keyTime = data.k[0].t; + } else { + for(iKey = 0; iKey < lenKey - 1; iKey += 1)if (time === data.k[iKey].t) { + index = iKey + 1; + keyTime = data.k[iKey].t; + break; + } else if (time > data.k[iKey].t && time < data.k[iKey + 1].t) { + if (time - data.k[iKey].t > data.k[iKey + 1].t - time) { + index = iKey + 2; + keyTime = data.k[iKey + 1].t; + } else { + index = iKey + 1; + keyTime = data.k[iKey].t; + } + break; + } + if (-1 === index) { + index = iKey + 1; + keyTime = data.k[iKey].t; + } + } + } else { + index = 0; + keyTime = 0; + } + var obKey = {}; + obKey.index = index; + obKey.time = keyTime / elem.comp.globalData.frameRate; + return obKey; + } + function key(ind) { + var obKey; + var iKey; + var lenKey; + if (!data.k.length || 'number' == typeof data.k[0]) throw new Error('The property has no keyframe at index ' + ind); + ind -= 1; + obKey = { + time: data.k[ind].t / elem.comp.globalData.frameRate, + value: [] + }; + var arr = Object.prototype.hasOwnProperty.call(data.k[ind], 's') ? data.k[ind].s : data.k[ind - 1].e; + lenKey = arr.length; + for(iKey = 0; iKey < lenKey; iKey += 1){ + obKey[iKey] = arr[iKey]; + obKey.value[iKey] = arr[iKey]; + } + return obKey; + } + function framesToTime(fr, fps) { + if (!fps) fps = elem.comp.globalData.frameRate; + return fr / fps; + } + function timeToFrames(t, fps) { + if (!t && 0 !== t) t = time; + if (!fps) fps = elem.comp.globalData.frameRate; + return t * fps; + } + function seedRandom(seed) { + BMMath.seedrandom(randSeed + seed); + } + function sourceRectAtTime() { + return elem.sourceRectAtTime(); + } + function substring(init, end) { + if ('string' == typeof value) { + if (void 0 === end) return value.substring(init); + return value.substring(init, end); + } + return ''; + } + function substr(init, end) { + if ('string' == typeof value) { + if (void 0 === end) return value.substr(init); + return value.substr(init, end); + } + return ''; + } + function posterizeTime(framesPerSecond) { + time = 0 === framesPerSecond ? 0 : Math1.floor(time * framesPerSecond) / framesPerSecond; + value = valueAtTime(time); + } + var time; + var velocity; + var value; + var text; + var textIndex; + var textTotal; + var selectorValue; + var index = elem.data.ind; + var hasParent = !!(elem.hierarchy && elem.hierarchy.length); + var parent; + var randSeed = Math1.floor(1000000 * Math1.random()); + var globalData = elem.globalData; + function executeExpression(_value) { + value = _value; + if (this.frameExpressionId === elem.globalData.frameId && 'textSelector' !== this.propType) return value; + if ('textSelector' === this.propType) { + textIndex = this.textIndex; + textTotal = this.textTotal; + selectorValue = this.selectorValue; + } + if (!thisLayer) { + text = elem.layerInterface.text; + thisLayer = elem.layerInterface; + thisComp = elem.comp.compInterface; + toWorld = thisLayer.toWorld.bind(thisLayer); + fromWorld = thisLayer.fromWorld.bind(thisLayer); + fromComp = thisLayer.fromComp.bind(thisLayer); + toComp = thisLayer.toComp.bind(thisLayer); + mask = thisLayer.mask ? thisLayer.mask.bind(thisLayer) : null; + fromCompToSurface = fromComp; + } + if (!transform) { + transform = elem.layerInterface('ADBE Transform Group'); + $bm_transform = transform; + if (transform) anchorPoint = transform.anchorPoint; + } + if (4 === elemType && !content) content = thisLayer('ADBE Root Vectors Group'); + if (!effect) effect = thisLayer(4); + hasParent = !!(elem.hierarchy && elem.hierarchy.length); + if (hasParent && !parent) parent = elem.hierarchy[0].layerInterface; + time = this.comp.renderedFrame / this.comp.globalData.frameRate; + if (_needsRandom) seedRandom(randSeed + time); + if (needsVelocity) velocity = velocityAtTime(time); + expression_function(); + this.frameExpressionId = elem.globalData.frameId; + scoped_bm_rt = scoped_bm_rt.propType === propTypes.SHAPE ? scoped_bm_rt.v : scoped_bm_rt; + return scoped_bm_rt; + } + executeExpression.__preventDeadCodeRemoval = [ + $bm_transform, + anchorPoint, + time, + velocity, + inPoint, + outPoint, + width, + height, + name, + loop_in, + loop_out, + smooth, + toComp, + fromCompToSurface, + toWorld, + fromWorld, + mask, + position, + rotation, + scale, + thisComp, + numKeys, + active, + wiggle, + loopInDuration, + loopOutDuration, + comp, + lookAt, + easeOut, + easeIn, + ease, + nearestKey, + key, + text, + textIndex, + textTotal, + selectorValue, + framesToTime, + timeToFrames, + sourceRectAtTime, + substring, + substr, + posterizeTime, + index, + globalData + ]; + return executeExpression; + } + ob.initiateExpression = initiateExpression; + ob.__preventDeadCodeRemoval = [ + window1, + document1, + XMLHttpRequest1, + fetch, + frames, + $bm_neg, + add, + $bm_sum, + $bm_sub, + $bm_mul, + $bm_div, + $bm_mod, + clamp, + radians_to_degrees, + degreesToRadians, + degrees_to_radians, + normalize, + rgbToHsl, + hslToRgb, + linear, + random, + createPath, + _lottieGlobal + ]; + ob.resetFrame = resetFrame; + return ob; + }(); + var Expressions = function() { + var ob = {}; + ob.initExpressions = initExpressions; + ob.resetFrame = ExpressionManager.resetFrame; + function initExpressions(animation) { + var stackCount = 0; + var registers = []; + function pushExpression() { + stackCount += 1; + } + function popExpression() { + stackCount -= 1; + if (0 === stackCount) releaseInstances(); + } + function registerExpressionProperty(expression) { + if (-1 === registers.indexOf(expression)) registers.push(expression); + } + function releaseInstances() { + var i; + var len = registers.length; + for(i = 0; i < len; i += 1)registers[i].release(); + registers.length = 0; + } + animation.renderer.compInterface = CompExpressionInterface(animation.renderer); + animation.renderer.globalData.projectInterface.registerComposition(animation.renderer); + animation.renderer.globalData.pushExpression = pushExpression; + animation.renderer.globalData.popExpression = popExpression; + animation.renderer.globalData.registerExpressionProperty = registerExpressionProperty; + } + return ob; + }(); + var MaskManagerInterface = function() { + function MaskInterface(mask, data) { + this._mask = mask; + this._data = data; + } + Object.defineProperty(MaskInterface.prototype, 'maskPath', { + get: function() { + if (this._mask.prop.k) this._mask.prop.getValue(); + return this._mask.prop; + } + }); + Object.defineProperty(MaskInterface.prototype, 'maskOpacity', { + get: function() { + if (this._mask.op.k) this._mask.op.getValue(); + return 100 * this._mask.op.v; + } + }); + var MaskManager = function(maskManager) { + var _masksInterfaces = createSizedArray(maskManager.viewData.length); + var i; + var len = maskManager.viewData.length; + for(i = 0; i < len; i += 1)_masksInterfaces[i] = new MaskInterface(maskManager.viewData[i], maskManager.masksProperties[i]); + var maskFunction = function(name) { + i = 0; + while(i < len){ + if (maskManager.masksProperties[i].nm === name) return _masksInterfaces[i]; + i += 1; + } + return null; + }; + return maskFunction; + }; + return MaskManager; + }(); + var ExpressionPropertyInterface = function() { + var defaultUnidimensionalValue = { + pv: 0, + v: 0, + mult: 1 + }; + var defaultMultidimensionalValue = { + pv: [ + 0, + 0, + 0 + ], + v: [ + 0, + 0, + 0 + ], + mult: 1 + }; + function completeProperty(expressionValue, property, type) { + Object.defineProperty(expressionValue, 'velocity', { + get: function() { + return property.getVelocityAtTime(property.comp.currentFrame); + } + }); + expressionValue.numKeys = property.keyframes ? property.keyframes.length : 0; + expressionValue.key = function(pos) { + if (!expressionValue.numKeys) return 0; + var value = ''; + value = 's' in property.keyframes[pos - 1] ? property.keyframes[pos - 1].s : 'e' in property.keyframes[pos - 2] ? property.keyframes[pos - 2].e : property.keyframes[pos - 2].s; + var valueProp = 'unidimensional' === type ? new Number(value) : Object.assign({}, value); + valueProp.time = property.keyframes[pos - 1].t / property.elem.comp.globalData.frameRate; + valueProp.value = 'unidimensional' === type ? value[0] : value; + return valueProp; + }; + expressionValue.valueAtTime = property.getValueAtTime; + expressionValue.speedAtTime = property.getSpeedAtTime; + expressionValue.velocityAtTime = property.getVelocityAtTime; + expressionValue.propertyGroup = property.propertyGroup; + } + function UnidimensionalPropertyInterface(property) { + if (!property || !('pv' in property)) property = defaultUnidimensionalValue; + var mult = 1 / property.mult; + var val = property.pv * mult; + var expressionValue = new Number(val); + expressionValue.value = val; + completeProperty(expressionValue, property, 'unidimensional'); + return function() { + if (property.k) property.getValue(); + val = property.v * mult; + if (expressionValue.value !== val) { + expressionValue = new Number(val); + expressionValue.value = val; + expressionValue[0] = val; + completeProperty(expressionValue, property, 'unidimensional'); + } + return expressionValue; + }; + } + function MultidimensionalPropertyInterface(property) { + if (!property || !('pv' in property)) property = defaultMultidimensionalValue; + var mult = 1 / property.mult; + var len = property.data && property.data.l || property.pv.length; + var expressionValue = createTypedArray('float32', len); + var arrValue = createTypedArray('float32', len); + expressionValue.value = arrValue; + completeProperty(expressionValue, property, 'multidimensional'); + return function() { + if (property.k) property.getValue(); + for(var i = 0; i < len; i += 1){ + arrValue[i] = property.v[i] * mult; + expressionValue[i] = arrValue[i]; + } + return expressionValue; + }; + } + function defaultGetter() { + return defaultUnidimensionalValue; + } + return function(property) { + if (!property) return defaultGetter; + if ('unidimensional' === property.propType) return UnidimensionalPropertyInterface(property); + return MultidimensionalPropertyInterface(property); + }; + }(); + var TransformExpressionInterface = function() { + return function(transform) { + function _thisFunction(name) { + switch(name){ + case 'scale': + case 'Scale': + case 'ADBE Scale': + case 6: + return _thisFunction.scale; + case 'rotation': + case 'Rotation': + case 'ADBE Rotation': + case 'ADBE Rotate Z': + case 10: + return _thisFunction.rotation; + case 'ADBE Rotate X': + return _thisFunction.xRotation; + case 'ADBE Rotate Y': + return _thisFunction.yRotation; + case 'position': + case 'Position': + case 'ADBE Position': + case 2: + return _thisFunction.position; + case 'ADBE Position_0': + return _thisFunction.xPosition; + case 'ADBE Position_1': + return _thisFunction.yPosition; + case 'ADBE Position_2': + return _thisFunction.zPosition; + case 'anchorPoint': + case 'AnchorPoint': + case 'Anchor Point': + case 'ADBE AnchorPoint': + case 1: + return _thisFunction.anchorPoint; + case 'opacity': + case 'Opacity': + case 11: + return _thisFunction.opacity; + default: + return null; + } + } + Object.defineProperty(_thisFunction, 'rotation', { + get: ExpressionPropertyInterface(transform.r || transform.rz) + }); + Object.defineProperty(_thisFunction, 'zRotation', { + get: ExpressionPropertyInterface(transform.rz || transform.r) + }); + Object.defineProperty(_thisFunction, 'xRotation', { + get: ExpressionPropertyInterface(transform.rx) + }); + Object.defineProperty(_thisFunction, 'yRotation', { + get: ExpressionPropertyInterface(transform.ry) + }); + Object.defineProperty(_thisFunction, 'scale', { + get: ExpressionPropertyInterface(transform.s) + }); + var _px; + var _py; + var _pz; + var _transformFactory; + if (transform.p) _transformFactory = ExpressionPropertyInterface(transform.p); + else { + _px = ExpressionPropertyInterface(transform.px); + _py = ExpressionPropertyInterface(transform.py); + if (transform.pz) _pz = ExpressionPropertyInterface(transform.pz); + } + Object.defineProperty(_thisFunction, 'position', { + get: function() { + if (transform.p) return _transformFactory(); + return [ + _px(), + _py(), + _pz ? _pz() : 0 + ]; + } + }); + Object.defineProperty(_thisFunction, 'xPosition', { + get: ExpressionPropertyInterface(transform.px) + }); + Object.defineProperty(_thisFunction, 'yPosition', { + get: ExpressionPropertyInterface(transform.py) + }); + Object.defineProperty(_thisFunction, 'zPosition', { + get: ExpressionPropertyInterface(transform.pz) + }); + Object.defineProperty(_thisFunction, 'anchorPoint', { + get: ExpressionPropertyInterface(transform.a) + }); + Object.defineProperty(_thisFunction, 'opacity', { + get: ExpressionPropertyInterface(transform.o) + }); + Object.defineProperty(_thisFunction, 'skew', { + get: ExpressionPropertyInterface(transform.sk) + }); + Object.defineProperty(_thisFunction, 'skewAxis', { + get: ExpressionPropertyInterface(transform.sa) + }); + Object.defineProperty(_thisFunction, 'orientation', { + get: ExpressionPropertyInterface(transform.or) + }); + return _thisFunction; + }; + }(); + var LayerExpressionInterface = function() { + function getMatrix(time) { + var toWorldMat = new Matrix(); + if (void 0 !== time) { + var propMatrix = this._elem.finalTransform.mProp.getValueAtTime(time); + propMatrix.clone(toWorldMat); + } else { + var transformMat = this._elem.finalTransform.mProp; + transformMat.applyToMatrix(toWorldMat); + } + return toWorldMat; + } + function toWorldVec(arr, time) { + var toWorldMat = this.getMatrix(time); + toWorldMat.props[12] = 0; + toWorldMat.props[13] = 0; + toWorldMat.props[14] = 0; + return this.applyPoint(toWorldMat, arr); + } + function toWorld(arr, time) { + var toWorldMat = this.getMatrix(time); + return this.applyPoint(toWorldMat, arr); + } + function fromWorldVec(arr, time) { + var toWorldMat = this.getMatrix(time); + toWorldMat.props[12] = 0; + toWorldMat.props[13] = 0; + toWorldMat.props[14] = 0; + return this.invertPoint(toWorldMat, arr); + } + function fromWorld(arr, time) { + var toWorldMat = this.getMatrix(time); + return this.invertPoint(toWorldMat, arr); + } + function applyPoint(matrix, arr) { + if (this._elem.hierarchy && this._elem.hierarchy.length) { + var i; + var len = this._elem.hierarchy.length; + for(i = 0; i < len; i += 1)this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(matrix); + } + return matrix.applyToPointArray(arr[0], arr[1], arr[2] || 0); + } + function invertPoint(matrix, arr) { + if (this._elem.hierarchy && this._elem.hierarchy.length) { + var i; + var len = this._elem.hierarchy.length; + for(i = 0; i < len; i += 1)this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(matrix); + } + return matrix.inversePoint(arr); + } + function fromComp(arr) { + var toWorldMat = new Matrix(); + toWorldMat.reset(); + this._elem.finalTransform.mProp.applyToMatrix(toWorldMat); + if (this._elem.hierarchy && this._elem.hierarchy.length) { + var i; + var len = this._elem.hierarchy.length; + for(i = 0; i < len; i += 1)this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat); + } + return toWorldMat.inversePoint(arr); + } + function sampleImage() { + return [ + 1, + 1, + 1, + 1 + ]; + } + return function(elem) { + var transformInterface; + function _registerMaskInterface(maskManager) { + _thisLayerFunction.mask = new MaskManagerInterface(maskManager, elem); + } + function _registerEffectsInterface(effects) { + _thisLayerFunction.effect = effects; + } + function _thisLayerFunction(name) { + switch(name){ + case 'ADBE Root Vectors Group': + case 'Contents': + case 2: + return _thisLayerFunction.shapeInterface; + case 1: + case 6: + case 'Transform': + case 'transform': + case 'ADBE Transform Group': + return transformInterface; + case 4: + case 'ADBE Effect Parade': + case 'effects': + case 'Effects': + return _thisLayerFunction.effect; + case 'ADBE Text Properties': + return _thisLayerFunction.textInterface; + default: + return null; + } + } + _thisLayerFunction.getMatrix = getMatrix; + _thisLayerFunction.invertPoint = invertPoint; + _thisLayerFunction.applyPoint = applyPoint; + _thisLayerFunction.toWorld = toWorld; + _thisLayerFunction.toWorldVec = toWorldVec; + _thisLayerFunction.fromWorld = fromWorld; + _thisLayerFunction.fromWorldVec = fromWorldVec; + _thisLayerFunction.toComp = toWorld; + _thisLayerFunction.fromComp = fromComp; + _thisLayerFunction.sampleImage = sampleImage; + _thisLayerFunction.sourceRectAtTime = elem.sourceRectAtTime.bind(elem); + _thisLayerFunction._elem = elem; + transformInterface = TransformExpressionInterface(elem.finalTransform.mProp); + var anchorPointDescriptor = getDescriptor(transformInterface, 'anchorPoint'); + Object.defineProperties(_thisLayerFunction, { + hasParent: { + get: function() { + return elem.hierarchy.length; + } + }, + parent: { + get: function() { + return elem.hierarchy[0].layerInterface; + } + }, + rotation: getDescriptor(transformInterface, 'rotation'), + scale: getDescriptor(transformInterface, 'scale'), + position: getDescriptor(transformInterface, 'position'), + opacity: getDescriptor(transformInterface, 'opacity'), + anchorPoint: anchorPointDescriptor, + anchor_point: anchorPointDescriptor, + transform: { + get: function() { + return transformInterface; + } + }, + active: { + get: function() { + return elem.isInRange; + } + } + }); + _thisLayerFunction.startTime = elem.data.st; + _thisLayerFunction.index = elem.data.ind; + _thisLayerFunction.source = elem.data.refId; + _thisLayerFunction.height = 0 === elem.data.ty ? elem.data.h : 100; + _thisLayerFunction.width = 0 === elem.data.ty ? elem.data.w : 100; + _thisLayerFunction.inPoint = elem.data.ip / elem.comp.globalData.frameRate; + _thisLayerFunction.outPoint = elem.data.op / elem.comp.globalData.frameRate; + _thisLayerFunction._name = elem.data.nm; + _thisLayerFunction.registerMaskInterface = _registerMaskInterface; + _thisLayerFunction.registerEffectsInterface = _registerEffectsInterface; + return _thisLayerFunction; + }; + }(); + var propertyGroupFactory = function() { + return function(interfaceFunction, parentPropertyGroup) { + return function(val) { + val = void 0 === val ? 1 : val; + if (val <= 0) return interfaceFunction; + return parentPropertyGroup(val - 1); + }; + }; + }(); + var PropertyInterface = function() { + return function(propertyName, propertyGroup) { + var interfaceFunction = { + _name: propertyName + }; + function _propertyGroup(val) { + val = void 0 === val ? 1 : val; + if (val <= 0) return interfaceFunction; + return propertyGroup(val - 1); + } + return _propertyGroup; + }; + }(); + var EffectsExpressionInterface = function() { + var ob = { + createEffectsInterface: createEffectsInterface + }; + function createEffectsInterface(elem, propertyGroup) { + if (elem.effectsManager) { + var effectElements = []; + var effectsData = elem.data.ef; + var i; + var len = elem.effectsManager.effectElements.length; + for(i = 0; i < len; i += 1)effectElements.push(createGroupInterface(effectsData[i], elem.effectsManager.effectElements[i], propertyGroup, elem)); + var effects = elem.data.ef || []; + var groupInterface = function(name) { + i = 0; + len = effects.length; + while(i < len){ + if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) return effectElements[i]; + i += 1; + } + return null; + }; + Object.defineProperty(groupInterface, 'numProperties', { + get: function() { + return effects.length; + } + }); + return groupInterface; + } + return null; + } + function createGroupInterface(data, elements, propertyGroup, elem) { + function groupInterface(name) { + var effects = data.ef; + var i = 0; + var len = effects.length; + while(i < len){ + if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) { + if (5 === effects[i].ty) return effectElements[i]; + return effectElements[i](); + } + i += 1; + } + throw new Error(); + } + var _propertyGroup = propertyGroupFactory(groupInterface, propertyGroup); + var effectElements = []; + var i; + var len = data.ef.length; + for(i = 0; i < len; i += 1)if (5 === data.ef[i].ty) effectElements.push(createGroupInterface(data.ef[i], elements.effectElements[i], elements.effectElements[i].propertyGroup, elem)); + else effectElements.push(createValueInterface(elements.effectElements[i], data.ef[i].ty, elem, _propertyGroup)); + if ('ADBE Color Control' === data.mn) Object.defineProperty(groupInterface, 'color', { + get: function() { + return effectElements[0](); + } + }); + Object.defineProperties(groupInterface, { + numProperties: { + get: function() { + return data.np; + } + }, + _name: { + value: data.nm + }, + propertyGroup: { + value: _propertyGroup + } + }); + groupInterface.enabled = 0 !== data.en; + groupInterface.active = groupInterface.enabled; + return groupInterface; + } + function createValueInterface(element, type, elem, propertyGroup) { + var expressionProperty = ExpressionPropertyInterface(element.p); + function interfaceFunction() { + if (10 === type) return elem.comp.compInterface(element.p.v); + return expressionProperty(); + } + if (element.p.setGroupProperty) element.p.setGroupProperty(PropertyInterface('', propertyGroup)); + return interfaceFunction; + } + return ob; + }(); + var ShapePathInterface = function() { + return function(shape, view, propertyGroup) { + var prop = view.sh; + function interfaceFunction(val) { + if ('Shape' === val || 'shape' === val || 'Path' === val || 'path' === val || 'ADBE Vector Shape' === val || 2 === val) return interfaceFunction.path; + return null; + } + var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); + prop.setGroupProperty(PropertyInterface('Path', _propertyGroup)); + Object.defineProperties(interfaceFunction, { + path: { + get: function() { + if (prop.k) prop.getValue(); + return prop; + } + }, + shape: { + get: function() { + if (prop.k) prop.getValue(); + return prop; + } + }, + _name: { + value: shape.nm + }, + ix: { + value: shape.ix + }, + propertyIndex: { + value: shape.ix + }, + mn: { + value: shape.mn + }, + propertyGroup: { + value: propertyGroup + } + }); + return interfaceFunction; + }; + }(); + var ShapeExpressionInterface = function() { + function iterateElements(shapes, view, propertyGroup) { + var arr = []; + var i; + var len = shapes ? shapes.length : 0; + for(i = 0; i < len; i += 1)if ('gr' === shapes[i].ty) arr.push(groupInterfaceFactory(shapes[i], view[i], propertyGroup)); + else if ('fl' === shapes[i].ty) arr.push(fillInterfaceFactory(shapes[i], view[i], propertyGroup)); + else if ('st' === shapes[i].ty) arr.push(strokeInterfaceFactory(shapes[i], view[i], propertyGroup)); + else if ('tm' === shapes[i].ty) arr.push(trimInterfaceFactory(shapes[i], view[i], propertyGroup)); + else if ('tr' === shapes[i].ty) ; + else if ('el' === shapes[i].ty) arr.push(ellipseInterfaceFactory(shapes[i], view[i], propertyGroup)); + else if ('sr' === shapes[i].ty) arr.push(starInterfaceFactory(shapes[i], view[i], propertyGroup)); + else if ('sh' === shapes[i].ty) arr.push(ShapePathInterface(shapes[i], view[i], propertyGroup)); + else if ('rc' === shapes[i].ty) arr.push(rectInterfaceFactory(shapes[i], view[i], propertyGroup)); + else if ('rd' === shapes[i].ty) arr.push(roundedInterfaceFactory(shapes[i], view[i], propertyGroup)); + else if ('rp' === shapes[i].ty) arr.push(repeaterInterfaceFactory(shapes[i], view[i], propertyGroup)); + else if ('gf' === shapes[i].ty) arr.push(gradientFillInterfaceFactory(shapes[i], view[i], propertyGroup)); + else arr.push(defaultInterfaceFactory(shapes[i], view[i], propertyGroup)); + return arr; + } + function contentsInterfaceFactory(shape, view, propertyGroup) { + var interfaces; + var interfaceFunction = function(value) { + var i = 0; + var len = interfaces.length; + while(i < len){ + if (interfaces[i]._name === value || interfaces[i].mn === value || interfaces[i].propertyIndex === value || interfaces[i].ix === value || interfaces[i].ind === value) return interfaces[i]; + i += 1; + } + if ('number' == typeof value) return interfaces[value - 1]; + return null; + }; + interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); + interfaces = iterateElements(shape.it, view.it, interfaceFunction.propertyGroup); + interfaceFunction.numProperties = interfaces.length; + var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1], view.it[view.it.length - 1], interfaceFunction.propertyGroup); + interfaceFunction.transform = transformInterface; + interfaceFunction.propertyIndex = shape.cix; + interfaceFunction._name = shape.nm; + return interfaceFunction; + } + function groupInterfaceFactory(shape, view, propertyGroup) { + var interfaceFunction = function(value) { + switch(value){ + case 'ADBE Vectors Group': + case 'Contents': + case 2: + return interfaceFunction.content; + default: + return interfaceFunction.transform; + } + }; + interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); + var content = contentsInterfaceFactory(shape, view, interfaceFunction.propertyGroup); + var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1], view.it[view.it.length - 1], interfaceFunction.propertyGroup); + interfaceFunction.content = content; + interfaceFunction.transform = transformInterface; + Object.defineProperty(interfaceFunction, '_name', { + get: function() { + return shape.nm; + } + }); + interfaceFunction.numProperties = shape.np; + interfaceFunction.propertyIndex = shape.ix; + interfaceFunction.nm = shape.nm; + interfaceFunction.mn = shape.mn; + return interfaceFunction; + } + function fillInterfaceFactory(shape, view, propertyGroup) { + function interfaceFunction(val) { + if ('Color' === val || 'color' === val) return interfaceFunction.color; + if ('Opacity' === val || 'opacity' === val) return interfaceFunction.opacity; + return null; + } + Object.defineProperties(interfaceFunction, { + color: { + get: ExpressionPropertyInterface(view.c) + }, + opacity: { + get: ExpressionPropertyInterface(view.o) + }, + _name: { + value: shape.nm + }, + mn: { + value: shape.mn + } + }); + view.c.setGroupProperty(PropertyInterface('Color', propertyGroup)); + view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup)); + return interfaceFunction; + } + function gradientFillInterfaceFactory(shape, view, propertyGroup) { + function interfaceFunction(val) { + if ('Start Point' === val || 'start point' === val) return interfaceFunction.startPoint; + if ('End Point' === val || 'end point' === val) return interfaceFunction.endPoint; + if ('Opacity' === val || 'opacity' === val) return interfaceFunction.opacity; + return null; + } + Object.defineProperties(interfaceFunction, { + startPoint: { + get: ExpressionPropertyInterface(view.s) + }, + endPoint: { + get: ExpressionPropertyInterface(view.e) + }, + opacity: { + get: ExpressionPropertyInterface(view.o) + }, + type: { + get: function() { + return 'a'; + } + }, + _name: { + value: shape.nm + }, + mn: { + value: shape.mn + } + }); + view.s.setGroupProperty(PropertyInterface('Start Point', propertyGroup)); + view.e.setGroupProperty(PropertyInterface('End Point', propertyGroup)); + view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup)); + return interfaceFunction; + } + function defaultInterfaceFactory() { + function interfaceFunction() { + return null; + } + return interfaceFunction; + } + function strokeInterfaceFactory(shape, view, propertyGroup) { + var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); + var _dashPropertyGroup = propertyGroupFactory(dashOb, _propertyGroup); + function addPropertyToDashOb(i) { + Object.defineProperty(dashOb, shape.d[i].nm, { + get: ExpressionPropertyInterface(view.d.dataProps[i].p) + }); + } + var i; + var len = shape.d ? shape.d.length : 0; + var dashOb = {}; + for(i = 0; i < len; i += 1){ + addPropertyToDashOb(i); + view.d.dataProps[i].p.setGroupProperty(_dashPropertyGroup); + } + function interfaceFunction(val) { + if ('Color' === val || 'color' === val) return interfaceFunction.color; + if ('Opacity' === val || 'opacity' === val) return interfaceFunction.opacity; + if ('Stroke Width' === val || 'stroke width' === val) return interfaceFunction.strokeWidth; + return null; + } + Object.defineProperties(interfaceFunction, { + color: { + get: ExpressionPropertyInterface(view.c) + }, + opacity: { + get: ExpressionPropertyInterface(view.o) + }, + strokeWidth: { + get: ExpressionPropertyInterface(view.w) + }, + dash: { + get: function() { + return dashOb; + } + }, + _name: { + value: shape.nm + }, + mn: { + value: shape.mn + } + }); + view.c.setGroupProperty(PropertyInterface('Color', _propertyGroup)); + view.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup)); + view.w.setGroupProperty(PropertyInterface('Stroke Width', _propertyGroup)); + return interfaceFunction; + } + function trimInterfaceFactory(shape, view, propertyGroup) { + function interfaceFunction(val) { + if (val === shape.e.ix || 'End' === val || 'end' === val) return interfaceFunction.end; + if (val === shape.s.ix) return interfaceFunction.start; + if (val === shape.o.ix) return interfaceFunction.offset; + return null; + } + var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); + interfaceFunction.propertyIndex = shape.ix; + view.s.setGroupProperty(PropertyInterface('Start', _propertyGroup)); + view.e.setGroupProperty(PropertyInterface('End', _propertyGroup)); + view.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup)); + interfaceFunction.propertyIndex = shape.ix; + interfaceFunction.propertyGroup = propertyGroup; + Object.defineProperties(interfaceFunction, { + start: { + get: ExpressionPropertyInterface(view.s) + }, + end: { + get: ExpressionPropertyInterface(view.e) + }, + offset: { + get: ExpressionPropertyInterface(view.o) + }, + _name: { + value: shape.nm + } + }); + interfaceFunction.mn = shape.mn; + return interfaceFunction; + } + function transformInterfaceFactory(shape, view, propertyGroup) { + function interfaceFunction(value) { + if (shape.a.ix === value || 'Anchor Point' === value) return interfaceFunction.anchorPoint; + if (shape.o.ix === value || 'Opacity' === value) return interfaceFunction.opacity; + if (shape.p.ix === value || 'Position' === value) return interfaceFunction.position; + if (shape.r.ix === value || 'Rotation' === value || 'ADBE Vector Rotation' === value) return interfaceFunction.rotation; + if (shape.s.ix === value || 'Scale' === value) return interfaceFunction.scale; + if (shape.sk && shape.sk.ix === value || 'Skew' === value) return interfaceFunction.skew; + if (shape.sa && shape.sa.ix === value || 'Skew Axis' === value) return interfaceFunction.skewAxis; + return null; + } + var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); + view.transform.mProps.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup)); + view.transform.mProps.p.setGroupProperty(PropertyInterface('Position', _propertyGroup)); + view.transform.mProps.a.setGroupProperty(PropertyInterface('Anchor Point', _propertyGroup)); + view.transform.mProps.s.setGroupProperty(PropertyInterface('Scale', _propertyGroup)); + view.transform.mProps.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup)); + if (view.transform.mProps.sk) { + view.transform.mProps.sk.setGroupProperty(PropertyInterface('Skew', _propertyGroup)); + view.transform.mProps.sa.setGroupProperty(PropertyInterface('Skew Angle', _propertyGroup)); + } + view.transform.op.setGroupProperty(PropertyInterface('Opacity', _propertyGroup)); + Object.defineProperties(interfaceFunction, { + opacity: { + get: ExpressionPropertyInterface(view.transform.mProps.o) + }, + position: { + get: ExpressionPropertyInterface(view.transform.mProps.p) + }, + anchorPoint: { + get: ExpressionPropertyInterface(view.transform.mProps.a) + }, + scale: { + get: ExpressionPropertyInterface(view.transform.mProps.s) + }, + rotation: { + get: ExpressionPropertyInterface(view.transform.mProps.r) + }, + skew: { + get: ExpressionPropertyInterface(view.transform.mProps.sk) + }, + skewAxis: { + get: ExpressionPropertyInterface(view.transform.mProps.sa) + }, + _name: { + value: shape.nm + } + }); + interfaceFunction.ty = 'tr'; + interfaceFunction.mn = shape.mn; + interfaceFunction.propertyGroup = propertyGroup; + return interfaceFunction; + } + function ellipseInterfaceFactory(shape, view, propertyGroup) { + function interfaceFunction(value) { + if (shape.p.ix === value) return interfaceFunction.position; + if (shape.s.ix === value) return interfaceFunction.size; + return null; + } + var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); + interfaceFunction.propertyIndex = shape.ix; + var prop = 'tm' === view.sh.ty ? view.sh.prop : view.sh; + prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup)); + prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup)); + Object.defineProperties(interfaceFunction, { + size: { + get: ExpressionPropertyInterface(prop.s) + }, + position: { + get: ExpressionPropertyInterface(prop.p) + }, + _name: { + value: shape.nm + } + }); + interfaceFunction.mn = shape.mn; + return interfaceFunction; + } + function starInterfaceFactory(shape, view, propertyGroup) { + function interfaceFunction(value) { + if (shape.p.ix === value) return interfaceFunction.position; + if (shape.r.ix === value) return interfaceFunction.rotation; + if (shape.pt.ix === value) return interfaceFunction.points; + if (shape.or.ix === value || 'ADBE Vector Star Outer Radius' === value) return interfaceFunction.outerRadius; + if (shape.os.ix === value) return interfaceFunction.outerRoundness; + if (shape.ir && (shape.ir.ix === value || 'ADBE Vector Star Inner Radius' === value)) return interfaceFunction.innerRadius; + if (shape.is && shape.is.ix === value) return interfaceFunction.innerRoundness; + return null; + } + var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); + var prop = 'tm' === view.sh.ty ? view.sh.prop : view.sh; + interfaceFunction.propertyIndex = shape.ix; + prop.or.setGroupProperty(PropertyInterface('Outer Radius', _propertyGroup)); + prop.os.setGroupProperty(PropertyInterface('Outer Roundness', _propertyGroup)); + prop.pt.setGroupProperty(PropertyInterface('Points', _propertyGroup)); + prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup)); + prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup)); + if (shape.ir) { + prop.ir.setGroupProperty(PropertyInterface('Inner Radius', _propertyGroup)); + prop.is.setGroupProperty(PropertyInterface('Inner Roundness', _propertyGroup)); + } + Object.defineProperties(interfaceFunction, { + position: { + get: ExpressionPropertyInterface(prop.p) + }, + rotation: { + get: ExpressionPropertyInterface(prop.r) + }, + points: { + get: ExpressionPropertyInterface(prop.pt) + }, + outerRadius: { + get: ExpressionPropertyInterface(prop.or) + }, + outerRoundness: { + get: ExpressionPropertyInterface(prop.os) + }, + innerRadius: { + get: ExpressionPropertyInterface(prop.ir) + }, + innerRoundness: { + get: ExpressionPropertyInterface(prop.is) + }, + _name: { + value: shape.nm + } + }); + interfaceFunction.mn = shape.mn; + return interfaceFunction; + } + function rectInterfaceFactory(shape, view, propertyGroup) { + function interfaceFunction(value) { + if (shape.p.ix === value) return interfaceFunction.position; + if (shape.r.ix === value) return interfaceFunction.roundness; + if (shape.s.ix === value || 'Size' === value || 'ADBE Vector Rect Size' === value) return interfaceFunction.size; + return null; + } + var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); + var prop = 'tm' === view.sh.ty ? view.sh.prop : view.sh; + interfaceFunction.propertyIndex = shape.ix; + prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup)); + prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup)); + prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup)); + Object.defineProperties(interfaceFunction, { + position: { + get: ExpressionPropertyInterface(prop.p) + }, + roundness: { + get: ExpressionPropertyInterface(prop.r) + }, + size: { + get: ExpressionPropertyInterface(prop.s) + }, + _name: { + value: shape.nm + } + }); + interfaceFunction.mn = shape.mn; + return interfaceFunction; + } + function roundedInterfaceFactory(shape, view, propertyGroup) { + function interfaceFunction(value) { + if (shape.r.ix === value || 'Round Corners 1' === value) return interfaceFunction.radius; + return null; + } + var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); + var prop = view; + interfaceFunction.propertyIndex = shape.ix; + prop.rd.setGroupProperty(PropertyInterface('Radius', _propertyGroup)); + Object.defineProperties(interfaceFunction, { + radius: { + get: ExpressionPropertyInterface(prop.rd) + }, + _name: { + value: shape.nm + } + }); + interfaceFunction.mn = shape.mn; + return interfaceFunction; + } + function repeaterInterfaceFactory(shape, view, propertyGroup) { + function interfaceFunction(value) { + if (shape.c.ix === value || 'Copies' === value) return interfaceFunction.copies; + if (shape.o.ix === value || 'Offset' === value) return interfaceFunction.offset; + return null; + } + var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); + var prop = view; + interfaceFunction.propertyIndex = shape.ix; + prop.c.setGroupProperty(PropertyInterface('Copies', _propertyGroup)); + prop.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup)); + Object.defineProperties(interfaceFunction, { + copies: { + get: ExpressionPropertyInterface(prop.c) + }, + offset: { + get: ExpressionPropertyInterface(prop.o) + }, + _name: { + value: shape.nm + } + }); + interfaceFunction.mn = shape.mn; + return interfaceFunction; + } + return function(shapes, view, propertyGroup) { + var interfaces; + function _interfaceFunction(value) { + if ('number' == typeof value) { + value = void 0 === value ? 1 : value; + if (0 === value) return propertyGroup; + return interfaces[value - 1]; + } + var i = 0; + var len = interfaces.length; + while(i < len){ + if (interfaces[i]._name === value) return interfaces[i]; + i += 1; + } + return null; + } + function parentGroupWrapper() { + return propertyGroup; + } + _interfaceFunction.propertyGroup = propertyGroupFactory(_interfaceFunction, parentGroupWrapper); + interfaces = iterateElements(shapes, view, _interfaceFunction.propertyGroup); + _interfaceFunction.numProperties = interfaces.length; + _interfaceFunction._name = 'Contents'; + return _interfaceFunction; + }; + }(); + var TextExpressionInterface = function() { + return function(elem) { + var _sourceText; + function _thisLayerFunction(name) { + switch(name){ + case 'ADBE Text Document': + return _thisLayerFunction.sourceText; + default: + return null; + } + } + Object.defineProperty(_thisLayerFunction, 'sourceText', { + get: function() { + elem.textProperty.getValue(); + var stringValue = elem.textProperty.currentData.t; + if (!_sourceText || stringValue !== _sourceText.value) { + _sourceText = new String(stringValue); + _sourceText.value = stringValue || new String(stringValue); + Object.defineProperty(_sourceText, 'style', { + get: function() { + return { + fillColor: elem.textProperty.currentData.fc + }; + } + }); + } + return _sourceText; + } + }); + return _thisLayerFunction; + }; + }(); + function _typeof(o) { + return _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(o); + } + var FootageInterface = function() { + var outlineInterfaceFactory = function(elem) { + var currentPropertyName = ''; + var currentProperty = elem.getFootageData(); + function init() { + currentPropertyName = ''; + currentProperty = elem.getFootageData(); + return searchProperty; + } + function searchProperty(value) { + if (currentProperty[value]) { + currentPropertyName = value; + currentProperty = currentProperty[value]; + if ('object' === _typeof(currentProperty)) return searchProperty; + return currentProperty; + } + var propertyNameIndex = value.indexOf(currentPropertyName); + if (-1 !== propertyNameIndex) { + var index = parseInt(value.substr(propertyNameIndex + currentPropertyName.length), 10); + currentProperty = currentProperty[index]; + if ('object' === _typeof(currentProperty)) return searchProperty; + return currentProperty; + } + return ''; + } + return init; + }; + var dataInterfaceFactory = function(elem) { + function interfaceFunction(value) { + if ('Outline' === value) return interfaceFunction.outlineInterface(); + return null; + } + interfaceFunction._name = 'Outline'; + interfaceFunction.outlineInterface = outlineInterfaceFactory(elem); + return interfaceFunction; + }; + return function(elem) { + function _interfaceFunction(value) { + if ('Data' === value) return _interfaceFunction.dataInterface; + return null; + } + _interfaceFunction._name = 'Data'; + _interfaceFunction.dataInterface = dataInterfaceFactory(elem); + return _interfaceFunction; + }; + }(); + var interfaces = { + layer: LayerExpressionInterface, + effects: EffectsExpressionInterface, + comp: CompExpressionInterface, + shape: ShapeExpressionInterface, + text: TextExpressionInterface, + footage: FootageInterface + }; + function getInterface(type) { + return interfaces[type] || null; + } + var expressionHelpers = function() { + function searchExpressions(elem, data, prop) { + if (data.x) { + prop.k = true; + prop.x = true; + prop.initiateExpression = ExpressionManager.initiateExpression; + prop.effectsSequence.push(prop.initiateExpression(elem, data, prop).bind(prop)); + } + } + function getValueAtTime(frameNum) { + frameNum *= this.elem.globalData.frameRate; + frameNum -= this.offsetTime; + if (frameNum !== this._cachingAtTime.lastFrame) { + this._cachingAtTime.lastIndex = this._cachingAtTime.lastFrame < frameNum ? this._cachingAtTime.lastIndex : 0; + this._cachingAtTime.value = this.interpolateValue(frameNum, this._cachingAtTime); + this._cachingAtTime.lastFrame = frameNum; + } + return this._cachingAtTime.value; + } + function getSpeedAtTime(frameNum) { + var delta = -0.01; + var v1 = this.getValueAtTime(frameNum); + var v2 = this.getValueAtTime(frameNum + delta); + var speed = 0; + if (v1.length) { + var i; + for(i = 0; i < v1.length; i += 1)speed += Math.pow(v2[i] - v1[i], 2); + speed = 100 * Math.sqrt(speed); + } else speed = 0; + return speed; + } + function getVelocityAtTime(frameNum) { + if (void 0 !== this.vel) return this.vel; + var delta = -0.001; + var v1 = this.getValueAtTime(frameNum); + var v2 = this.getValueAtTime(frameNum + delta); + var velocity; + if (v1.length) { + velocity = createTypedArray('float32', v1.length); + var i; + for(i = 0; i < v1.length; i += 1)velocity[i] = (v2[i] - v1[i]) / delta; + } else velocity = (v2 - v1) / delta; + return velocity; + } + function getStaticValueAtTime() { + return this.pv; + } + function setGroupProperty(propertyGroup) { + this.propertyGroup = propertyGroup; + } + return { + searchExpressions: searchExpressions, + getSpeedAtTime: getSpeedAtTime, + getVelocityAtTime: getVelocityAtTime, + getValueAtTime: getValueAtTime, + getStaticValueAtTime: getStaticValueAtTime, + setGroupProperty: setGroupProperty + }; + }(); + function addPropertyDecorator() { + function loopOut(type, duration, durationFlag) { + if (!this.k || !this.keyframes) return this.pv; + type = type ? type.toLowerCase() : ''; + var currentFrame = this.comp.renderedFrame; + var keyframes = this.keyframes; + var lastKeyFrame = keyframes[keyframes.length - 1].t; + if (currentFrame <= lastKeyFrame) return this.pv; + var cycleDuration; + var firstKeyFrame; + if (durationFlag) { + cycleDuration = duration ? Math.abs(lastKeyFrame - this.elem.comp.globalData.frameRate * duration) : Math.max(0, lastKeyFrame - this.elem.data.ip); + firstKeyFrame = lastKeyFrame - cycleDuration; + } else { + if (!duration || duration > keyframes.length - 1) duration = keyframes.length - 1; + firstKeyFrame = keyframes[keyframes.length - 1 - duration].t; + cycleDuration = lastKeyFrame - firstKeyFrame; + } + var i; + var len; + var ret; + if ('pingpong' === type) { + var iterations = Math.floor((currentFrame - firstKeyFrame) / cycleDuration); + if (iterations % 2 !== 0) return this.getValueAtTime((cycleDuration - (currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); + } else if ('offset' === type) { + var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0); + var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0); + var current = this.getValueAtTime(((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); + var repeats = Math.floor((currentFrame - firstKeyFrame) / cycleDuration); + if (this.pv.length) { + ret = new Array(initV.length); + len = ret.length; + for(i = 0; i < len; i += 1)ret[i] = (endV[i] - initV[i]) * repeats + current[i]; + return ret; + } + return (endV - initV) * repeats + current; + } else if ('continue' === type) { + var lastValue = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0); + var nextLastValue = this.getValueAtTime((lastKeyFrame - 0.001) / this.comp.globalData.frameRate, 0); + if (this.pv.length) { + ret = new Array(lastValue.length); + len = ret.length; + for(i = 0; i < len; i += 1)ret[i] = lastValue[i] + (lastValue[i] - nextLastValue[i]) * ((currentFrame - lastKeyFrame) / this.comp.globalData.frameRate) / 0.0005; + return ret; + } + return lastValue + (currentFrame - lastKeyFrame) / 0.001 * (lastValue - nextLastValue); + } + return this.getValueAtTime(((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); + } + function loopIn(type, duration, durationFlag) { + if (!this.k) return this.pv; + type = type ? type.toLowerCase() : ''; + var currentFrame = this.comp.renderedFrame; + var keyframes = this.keyframes; + var firstKeyFrame = keyframes[0].t; + if (currentFrame >= firstKeyFrame) return this.pv; + var cycleDuration; + var lastKeyFrame; + if (durationFlag) { + cycleDuration = duration ? Math.abs(this.elem.comp.globalData.frameRate * duration) : Math.max(0, this.elem.data.op - firstKeyFrame); + lastKeyFrame = firstKeyFrame + cycleDuration; + } else { + if (!duration || duration > keyframes.length - 1) duration = keyframes.length - 1; + lastKeyFrame = keyframes[duration].t; + cycleDuration = lastKeyFrame - firstKeyFrame; + } + var i; + var len; + var ret; + if ('pingpong' === type) { + var iterations = Math.floor((firstKeyFrame - currentFrame) / cycleDuration); + if (iterations % 2 === 0) return this.getValueAtTime(((firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); + } else if ('offset' === type) { + var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0); + var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0); + var current = this.getValueAtTime((cycleDuration - (firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); + var repeats = Math.floor((firstKeyFrame - currentFrame) / cycleDuration) + 1; + if (this.pv.length) { + ret = new Array(initV.length); + len = ret.length; + for(i = 0; i < len; i += 1)ret[i] = current[i] - (endV[i] - initV[i]) * repeats; + return ret; + } + return current - (endV - initV) * repeats; + } else if ('continue' === type) { + var firstValue = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0); + var nextFirstValue = this.getValueAtTime((firstKeyFrame + 0.001) / this.comp.globalData.frameRate, 0); + if (this.pv.length) { + ret = new Array(firstValue.length); + len = ret.length; + for(i = 0; i < len; i += 1)ret[i] = firstValue[i] + (firstValue[i] - nextFirstValue[i]) * (firstKeyFrame - currentFrame) / 0.001; + return ret; + } + return firstValue + (firstValue - nextFirstValue) * (firstKeyFrame - currentFrame) / 0.001; + } + return this.getValueAtTime((cycleDuration - ((firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0); + } + function smooth(width, samples) { + if (!this.k) return this.pv; + width = 0.5 * (width || 0.4); + samples = Math.floor(samples || 5); + if (samples <= 1) return this.pv; + var currentTime = this.comp.renderedFrame / this.comp.globalData.frameRate; + var initFrame = currentTime - width; + var endFrame = currentTime + width; + var sampleFrequency = samples > 1 ? (endFrame - initFrame) / (samples - 1) : 1; + var i = 0; + var j = 0; + var value; + value = this.pv.length ? createTypedArray('float32', this.pv.length) : 0; + var sampleValue; + while(i < samples){ + sampleValue = this.getValueAtTime(initFrame + i * sampleFrequency); + if (this.pv.length) for(j = 0; j < this.pv.length; j += 1)value[j] += sampleValue[j]; + else value += sampleValue; + i += 1; + } + if (this.pv.length) for(j = 0; j < this.pv.length; j += 1)value[j] /= samples; + else value /= samples; + return value; + } + function getTransformValueAtTime(time) { + if (!this._transformCachingAtTime) this._transformCachingAtTime = { + v: new Matrix() + }; + var matrix = this._transformCachingAtTime.v; + matrix.cloneFromProps(this.pre.props); + if (this.appliedTransformations < 1) { + var anchor = this.a.getValueAtTime(time); + matrix.translate(-anchor[0] * this.a.mult, -anchor[1] * this.a.mult, anchor[2] * this.a.mult); + } + if (this.appliedTransformations < 2) { + var scale = this.s.getValueAtTime(time); + matrix.scale(scale[0] * this.s.mult, scale[1] * this.s.mult, scale[2] * this.s.mult); + } + if (this.sk && this.appliedTransformations < 3) { + var skew = this.sk.getValueAtTime(time); + var skewAxis = this.sa.getValueAtTime(time); + matrix.skewFromAxis(-skew * this.sk.mult, skewAxis * this.sa.mult); + } + if (this.r && this.appliedTransformations < 4) { + var rotation = this.r.getValueAtTime(time); + matrix.rotate(-rotation * this.r.mult); + } else if (!this.r && this.appliedTransformations < 4) { + var rotationZ = this.rz.getValueAtTime(time); + var rotationY = this.ry.getValueAtTime(time); + var rotationX = this.rx.getValueAtTime(time); + var orientation = this.or.getValueAtTime(time); + matrix.rotateZ(-rotationZ * this.rz.mult).rotateY(rotationY * this.ry.mult).rotateX(rotationX * this.rx.mult).rotateZ(-orientation[2] * this.or.mult).rotateY(orientation[1] * this.or.mult).rotateX(orientation[0] * this.or.mult); + } + if (this.data.p && this.data.p.s) { + var positionX = this.px.getValueAtTime(time); + var positionY = this.py.getValueAtTime(time); + if (this.data.p.z) { + var positionZ = this.pz.getValueAtTime(time); + matrix.translate(positionX * this.px.mult, positionY * this.py.mult, -positionZ * this.pz.mult); + } else matrix.translate(positionX * this.px.mult, positionY * this.py.mult, 0); + } else { + var position = this.p.getValueAtTime(time); + matrix.translate(position[0] * this.p.mult, position[1] * this.p.mult, -position[2] * this.p.mult); + } + return matrix; + } + function getTransformStaticValueAtTime() { + return this.v.clone(new Matrix()); + } + var getTransformProperty = TransformPropertyFactory.getTransformProperty; + TransformPropertyFactory.getTransformProperty = function(elem, data, container) { + var prop = getTransformProperty(elem, data, container); + if (prop.dynamicProperties.length) prop.getValueAtTime = getTransformValueAtTime.bind(prop); + else prop.getValueAtTime = getTransformStaticValueAtTime.bind(prop); + prop.setGroupProperty = expressionHelpers.setGroupProperty; + return prop; + }; + var propertyGetProp = PropertyFactory.getProp; + PropertyFactory.getProp = function(elem, data, type, mult, container) { + var prop = propertyGetProp(elem, data, type, mult, container); + if (prop.kf) prop.getValueAtTime = expressionHelpers.getValueAtTime.bind(prop); + else prop.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(prop); + prop.setGroupProperty = expressionHelpers.setGroupProperty; + prop.loopOut = loopOut; + prop.loopIn = loopIn; + prop.smooth = smooth; + prop.getVelocityAtTime = expressionHelpers.getVelocityAtTime.bind(prop); + prop.getSpeedAtTime = expressionHelpers.getSpeedAtTime.bind(prop); + prop.numKeys = 1 === data.a ? data.k.length : 0; + prop.propertyIndex = data.ix; + var value = 0; + if (0 !== type) value = createTypedArray('float32', 1 === data.a ? data.k[0].s.length : data.k.length); + prop._cachingAtTime = { + lastFrame: initialDefaultFrame, + lastIndex: 0, + value: value + }; + expressionHelpers.searchExpressions(elem, data, prop); + if (prop.k) container.addDynamicProperty(prop); + return prop; + }; + function getShapeValueAtTime(frameNum) { + if (!this._cachingAtTime) this._cachingAtTime = { + shapeValue: shapePool.clone(this.pv), + lastIndex: 0, + lastTime: initialDefaultFrame + }; + frameNum *= this.elem.globalData.frameRate; + frameNum -= this.offsetTime; + if (frameNum !== this._cachingAtTime.lastTime) { + this._cachingAtTime.lastIndex = this._cachingAtTime.lastTime < frameNum ? this._caching.lastIndex : 0; + this._cachingAtTime.lastTime = frameNum; + this.interpolateShape(frameNum, this._cachingAtTime.shapeValue, this._cachingAtTime); + } + return this._cachingAtTime.shapeValue; + } + var ShapePropertyConstructorFunction = ShapePropertyFactory.getConstructorFunction(); + var KeyframedShapePropertyConstructorFunction = ShapePropertyFactory.getKeyframedConstructorFunction(); + function ShapeExpressions() {} + ShapeExpressions.prototype = { + vertices: function(prop, time) { + if (this.k) this.getValue(); + var shapePath = this.v; + if (void 0 !== time) shapePath = this.getValueAtTime(time, 0); + var i; + var len = shapePath._length; + var vertices = shapePath[prop]; + var points = shapePath.v; + var arr = createSizedArray(len); + for(i = 0; i < len; i += 1)if ('i' === prop || 'o' === prop) arr[i] = [ + vertices[i][0] - points[i][0], + vertices[i][1] - points[i][1] + ]; + else arr[i] = [ + vertices[i][0], + vertices[i][1] + ]; + return arr; + }, + points: function(time) { + return this.vertices('v', time); + }, + inTangents: function(time) { + return this.vertices('i', time); + }, + outTangents: function(time) { + return this.vertices('o', time); + }, + isClosed: function() { + return this.v.c; + }, + pointOnPath: function(perc, time) { + var shapePath = this.v; + if (void 0 !== time) shapePath = this.getValueAtTime(time, 0); + if (!this._segmentsLength) this._segmentsLength = bez.getSegmentsLength(shapePath); + var segmentsLength = this._segmentsLength; + var lengths = segmentsLength.lengths; + var lengthPos = segmentsLength.totalLength * perc; + var i = 0; + var len = lengths.length; + var accumulatedLength = 0; + var pt; + while(i < len){ + if (accumulatedLength + lengths[i].addedLength > lengthPos) { + var initIndex = i; + var endIndex = shapePath.c && i === len - 1 ? 0 : i + 1; + var segmentPerc = (lengthPos - accumulatedLength) / lengths[i].addedLength; + pt = bez.getPointInSegment(shapePath.v[initIndex], shapePath.v[endIndex], shapePath.o[initIndex], shapePath.i[endIndex], segmentPerc, lengths[i]); + break; + } + accumulatedLength += lengths[i].addedLength; + i += 1; + } + if (!pt) pt = shapePath.c ? [ + shapePath.v[0][0], + shapePath.v[0][1] + ] : [ + shapePath.v[shapePath._length - 1][0], + shapePath.v[shapePath._length - 1][1] + ]; + return pt; + }, + vectorOnPath: function(perc, time, vectorType) { + if (1 == perc) perc = this.v.c; + else if (0 == perc) perc = 0.999; + var pt1 = this.pointOnPath(perc, time); + var pt2 = this.pointOnPath(perc + 0.001, time); + var xLength = pt2[0] - pt1[0]; + var yLength = pt2[1] - pt1[1]; + var magnitude = Math.sqrt(Math.pow(xLength, 2) + Math.pow(yLength, 2)); + if (0 === magnitude) return [ + 0, + 0 + ]; + var unitVector = 'tangent' === vectorType ? [ + xLength / magnitude, + yLength / magnitude + ] : [ + -yLength / magnitude, + xLength / magnitude + ]; + return unitVector; + }, + tangentOnPath: function(perc, time) { + return this.vectorOnPath(perc, time, 'tangent'); + }, + normalOnPath: function(perc, time) { + return this.vectorOnPath(perc, time, 'normal'); + }, + setGroupProperty: expressionHelpers.setGroupProperty, + getValueAtTime: expressionHelpers.getStaticValueAtTime + }; + extendPrototype([ + ShapeExpressions + ], ShapePropertyConstructorFunction); + extendPrototype([ + ShapeExpressions + ], KeyframedShapePropertyConstructorFunction); + KeyframedShapePropertyConstructorFunction.prototype.getValueAtTime = getShapeValueAtTime; + KeyframedShapePropertyConstructorFunction.prototype.initiateExpression = ExpressionManager.initiateExpression; + var propertyGetShapeProp = ShapePropertyFactory.getShapeProp; + ShapePropertyFactory.getShapeProp = function(elem, data, type, arr, trims) { + var prop = propertyGetShapeProp(elem, data, type, arr, trims); + prop.propertyIndex = data.ix; + prop.lock = false; + if (3 === type) expressionHelpers.searchExpressions(elem, data.pt, prop); + else if (4 === type) expressionHelpers.searchExpressions(elem, data.ks, prop); + if (prop.k) elem.addDynamicProperty(prop); + return prop; + }; + } + function initialize$1() { + addPropertyDecorator(); + } + function addDecorator() { + function searchExpressions() { + if (this.data.d.x) { + this.calculateExpression = ExpressionManager.initiateExpression.bind(this)(this.elem, this.data.d, this); + this.addEffect(this.getExpressionValue.bind(this)); + return true; + } + return null; + } + TextProperty.prototype.getExpressionValue = function(currentValue, text) { + var newValue = this.calculateExpression(text); + if (currentValue.t !== newValue) { + var newData = {}; + this.copyData(newData, currentValue); + newData.t = newValue.toString(); + newData.__complete = false; + return newData; + } + return currentValue; + }; + TextProperty.prototype.searchProperty = function() { + var isKeyframed = this.searchKeyframes(); + var hasExpressions = this.searchExpressions(); + this.kf = isKeyframed || hasExpressions; + return this.kf; + }; + TextProperty.prototype.searchExpressions = searchExpressions; + } + function initialize() { + addDecorator(); + } + function SVGComposableEffect() {} + SVGComposableEffect.prototype = { + createMergeNode: function(resultId, ins) { + var feMerge = createNS('feMerge'); + feMerge.setAttribute('result', resultId); + var feMergeNode; + var i; + for(i = 0; i < ins.length; i += 1){ + feMergeNode = createNS('feMergeNode'); + feMergeNode.setAttribute('in', ins[i]); + feMerge.appendChild(feMergeNode); + feMerge.appendChild(feMergeNode); + } + return feMerge; + } + }; + var linearFilterValue = '0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0'; + function SVGTintFilter(filter, filterManager, elem, id, source) { + this.filterManager = filterManager; + var feColorMatrix = createNS('feColorMatrix'); + feColorMatrix.setAttribute('type', 'matrix'); + feColorMatrix.setAttribute('color-interpolation-filters', 'linearRGB'); + feColorMatrix.setAttribute('values', linearFilterValue + ' 1 0'); + this.linearFilter = feColorMatrix; + feColorMatrix.setAttribute('result', id + '_tint_1'); + filter.appendChild(feColorMatrix); + feColorMatrix = createNS('feColorMatrix'); + feColorMatrix.setAttribute('type', 'matrix'); + feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB'); + feColorMatrix.setAttribute('values', '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0'); + feColorMatrix.setAttribute('result', id + '_tint_2'); + filter.appendChild(feColorMatrix); + this.matrixFilter = feColorMatrix; + var feMerge = this.createMergeNode(id, [ + source, + id + '_tint_1', + id + '_tint_2' + ]); + filter.appendChild(feMerge); + } + extendPrototype([ + SVGComposableEffect + ], SVGTintFilter); + SVGTintFilter.prototype.renderFrame = function(forceRender) { + if (forceRender || this.filterManager._mdf) { + var colorBlack = this.filterManager.effectElements[0].p.v; + var colorWhite = this.filterManager.effectElements[1].p.v; + var opacity = this.filterManager.effectElements[2].p.v / 100; + this.linearFilter.setAttribute('values', linearFilterValue + ' ' + opacity + ' 0'); + this.matrixFilter.setAttribute('values', colorWhite[0] - colorBlack[0] + ' 0 0 0 ' + colorBlack[0] + ' ' + (colorWhite[1] - colorBlack[1]) + ' 0 0 0 ' + colorBlack[1] + ' ' + (colorWhite[2] - colorBlack[2]) + ' 0 0 0 ' + colorBlack[2] + ' 0 0 0 1 0'); + } + }; + function SVGFillFilter(filter, filterManager, elem, id) { + this.filterManager = filterManager; + var feColorMatrix = createNS('feColorMatrix'); + feColorMatrix.setAttribute('type', 'matrix'); + feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB'); + feColorMatrix.setAttribute('values', '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0'); + feColorMatrix.setAttribute('result', id); + filter.appendChild(feColorMatrix); + this.matrixFilter = feColorMatrix; + } + SVGFillFilter.prototype.renderFrame = function(forceRender) { + if (forceRender || this.filterManager._mdf) { + var color = this.filterManager.effectElements[2].p.v; + var opacity = this.filterManager.effectElements[6].p.v; + this.matrixFilter.setAttribute('values', '0 0 0 0 ' + color[0] + ' 0 0 0 0 ' + color[1] + ' 0 0 0 0 ' + color[2] + ' 0 0 0 ' + opacity + ' 0'); + } + }; + function SVGStrokeEffect(fil, filterManager, elem) { + this.initialized = false; + this.filterManager = filterManager; + this.elem = elem; + this.paths = []; + } + SVGStrokeEffect.prototype.initialize = function() { + var elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes; + var path; + var groupPath; + var i; + var len; + if (1 === this.filterManager.effectElements[1].p.v) { + len = this.elem.maskManager.masksProperties.length; + i = 0; + } else { + i = this.filterManager.effectElements[0].p.v - 1; + len = i + 1; + } + groupPath = createNS('g'); + groupPath.setAttribute('fill', 'none'); + groupPath.setAttribute('stroke-linecap', 'round'); + groupPath.setAttribute('stroke-dashoffset', 1); + for(i; i < len; i += 1){ + path = createNS('path'); + groupPath.appendChild(path); + this.paths.push({ + p: path, + m: i + }); + } + if (3 === this.filterManager.effectElements[10].p.v) { + var mask = createNS('mask'); + var id = createElementID(); + mask.setAttribute('id', id); + mask.setAttribute('mask-type', 'alpha'); + mask.appendChild(groupPath); + this.elem.globalData.defs.appendChild(mask); + var g = createNS('g'); + g.setAttribute('mask', 'url(' + getLocationHref() + '#' + id + ')'); + while(elemChildren[0])g.appendChild(elemChildren[0]); + this.elem.layerElement.appendChild(g); + this.masker = mask; + groupPath.setAttribute('stroke', '#fff'); + } else if (1 === this.filterManager.effectElements[10].p.v || 2 === this.filterManager.effectElements[10].p.v) { + if (2 === this.filterManager.effectElements[10].p.v) { + elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes; + while(elemChildren.length)this.elem.layerElement.removeChild(elemChildren[0]); + } + this.elem.layerElement.appendChild(groupPath); + this.elem.layerElement.removeAttribute('mask'); + groupPath.setAttribute('stroke', '#fff'); + } + this.initialized = true; + this.pathMasker = groupPath; + }; + SVGStrokeEffect.prototype.renderFrame = function(forceRender) { + if (!this.initialized) this.initialize(); + var i; + var len = this.paths.length; + var mask; + var path; + for(i = 0; i < len; i += 1)if (-1 !== this.paths[i].m) { + mask = this.elem.maskManager.viewData[this.paths[i].m]; + path = this.paths[i].p; + if (forceRender || this.filterManager._mdf || mask.prop._mdf) path.setAttribute('d', mask.lastPath); + if (forceRender || this.filterManager.effectElements[9].p._mdf || this.filterManager.effectElements[4].p._mdf || this.filterManager.effectElements[7].p._mdf || this.filterManager.effectElements[8].p._mdf || mask.prop._mdf) { + var dasharrayValue; + if (0 !== this.filterManager.effectElements[7].p.v || 100 !== this.filterManager.effectElements[8].p.v) { + var s = 0.01 * Math.min(this.filterManager.effectElements[7].p.v, this.filterManager.effectElements[8].p.v); + var e = 0.01 * Math.max(this.filterManager.effectElements[7].p.v, this.filterManager.effectElements[8].p.v); + var l = path.getTotalLength(); + dasharrayValue = '0 0 0 ' + l * s + ' '; + var lineLength = l * (e - s); + var segment = 1 + 2 * this.filterManager.effectElements[4].p.v * this.filterManager.effectElements[9].p.v * 0.01; + var units = Math.floor(lineLength / segment); + var j; + for(j = 0; j < units; j += 1)dasharrayValue += '1 ' + 2 * this.filterManager.effectElements[4].p.v * this.filterManager.effectElements[9].p.v * 0.01 + ' '; + dasharrayValue += '0 ' + 10 * l + ' 0 0'; + } else dasharrayValue = '1 ' + 2 * this.filterManager.effectElements[4].p.v * this.filterManager.effectElements[9].p.v * 0.01; + path.setAttribute('stroke-dasharray', dasharrayValue); + } + } + if (forceRender || this.filterManager.effectElements[4].p._mdf) this.pathMasker.setAttribute('stroke-width', 2 * this.filterManager.effectElements[4].p.v); + if (forceRender || this.filterManager.effectElements[6].p._mdf) this.pathMasker.setAttribute('opacity', this.filterManager.effectElements[6].p.v); + if (1 === this.filterManager.effectElements[10].p.v || 2 === this.filterManager.effectElements[10].p.v) { + if (forceRender || this.filterManager.effectElements[3].p._mdf) { + var color = this.filterManager.effectElements[3].p.v; + this.pathMasker.setAttribute('stroke', 'rgb(' + bmFloor(255 * color[0]) + ',' + bmFloor(255 * color[1]) + ',' + bmFloor(255 * color[2]) + ')'); + } + } + }; + function SVGTritoneFilter(filter, filterManager, elem, id) { + this.filterManager = filterManager; + var feColorMatrix = createNS('feColorMatrix'); + feColorMatrix.setAttribute('type', 'matrix'); + feColorMatrix.setAttribute('color-interpolation-filters', 'linearRGB'); + feColorMatrix.setAttribute('values', '0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0'); + filter.appendChild(feColorMatrix); + var feComponentTransfer = createNS('feComponentTransfer'); + feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB'); + feComponentTransfer.setAttribute('result', id); + this.matrixFilter = feComponentTransfer; + var feFuncR = createNS('feFuncR'); + feFuncR.setAttribute('type', 'table'); + feComponentTransfer.appendChild(feFuncR); + this.feFuncR = feFuncR; + var feFuncG = createNS('feFuncG'); + feFuncG.setAttribute('type', 'table'); + feComponentTransfer.appendChild(feFuncG); + this.feFuncG = feFuncG; + var feFuncB = createNS('feFuncB'); + feFuncB.setAttribute('type', 'table'); + feComponentTransfer.appendChild(feFuncB); + this.feFuncB = feFuncB; + filter.appendChild(feComponentTransfer); + } + SVGTritoneFilter.prototype.renderFrame = function(forceRender) { + if (forceRender || this.filterManager._mdf) { + var color1 = this.filterManager.effectElements[0].p.v; + var color2 = this.filterManager.effectElements[1].p.v; + var color3 = this.filterManager.effectElements[2].p.v; + var tableR = color3[0] + ' ' + color2[0] + ' ' + color1[0]; + var tableG = color3[1] + ' ' + color2[1] + ' ' + color1[1]; + var tableB = color3[2] + ' ' + color2[2] + ' ' + color1[2]; + this.feFuncR.setAttribute('tableValues', tableR); + this.feFuncG.setAttribute('tableValues', tableG); + this.feFuncB.setAttribute('tableValues', tableB); + } + }; + function SVGProLevelsFilter(filter, filterManager, elem, id) { + this.filterManager = filterManager; + var effectElements = this.filterManager.effectElements; + var feComponentTransfer = createNS('feComponentTransfer'); + if (effectElements[10].p.k || 0 !== effectElements[10].p.v || effectElements[11].p.k || 1 !== effectElements[11].p.v || effectElements[12].p.k || 1 !== effectElements[12].p.v || effectElements[13].p.k || 0 !== effectElements[13].p.v || effectElements[14].p.k || 1 !== effectElements[14].p.v) this.feFuncR = this.createFeFunc('feFuncR', feComponentTransfer); + if (effectElements[17].p.k || 0 !== effectElements[17].p.v || effectElements[18].p.k || 1 !== effectElements[18].p.v || effectElements[19].p.k || 1 !== effectElements[19].p.v || effectElements[20].p.k || 0 !== effectElements[20].p.v || effectElements[21].p.k || 1 !== effectElements[21].p.v) this.feFuncG = this.createFeFunc('feFuncG', feComponentTransfer); + if (effectElements[24].p.k || 0 !== effectElements[24].p.v || effectElements[25].p.k || 1 !== effectElements[25].p.v || effectElements[26].p.k || 1 !== effectElements[26].p.v || effectElements[27].p.k || 0 !== effectElements[27].p.v || effectElements[28].p.k || 1 !== effectElements[28].p.v) this.feFuncB = this.createFeFunc('feFuncB', feComponentTransfer); + if (effectElements[31].p.k || 0 !== effectElements[31].p.v || effectElements[32].p.k || 1 !== effectElements[32].p.v || effectElements[33].p.k || 1 !== effectElements[33].p.v || effectElements[34].p.k || 0 !== effectElements[34].p.v || effectElements[35].p.k || 1 !== effectElements[35].p.v) this.feFuncA = this.createFeFunc('feFuncA', feComponentTransfer); + if (this.feFuncR || this.feFuncG || this.feFuncB || this.feFuncA) { + feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB'); + filter.appendChild(feComponentTransfer); + } + if (effectElements[3].p.k || 0 !== effectElements[3].p.v || effectElements[4].p.k || 1 !== effectElements[4].p.v || effectElements[5].p.k || 1 !== effectElements[5].p.v || effectElements[6].p.k || 0 !== effectElements[6].p.v || effectElements[7].p.k || 1 !== effectElements[7].p.v) { + feComponentTransfer = createNS('feComponentTransfer'); + feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB'); + feComponentTransfer.setAttribute('result', id); + filter.appendChild(feComponentTransfer); + this.feFuncRComposed = this.createFeFunc('feFuncR', feComponentTransfer); + this.feFuncGComposed = this.createFeFunc('feFuncG', feComponentTransfer); + this.feFuncBComposed = this.createFeFunc('feFuncB', feComponentTransfer); + } + } + SVGProLevelsFilter.prototype.createFeFunc = function(type, feComponentTransfer) { + var feFunc = createNS(type); + feFunc.setAttribute('type', 'table'); + feComponentTransfer.appendChild(feFunc); + return feFunc; + }; + SVGProLevelsFilter.prototype.getTableValue = function(inputBlack, inputWhite, gamma, outputBlack, outputWhite) { + var cnt = 0; + var segments = 256; + var perc; + var min = Math.min(inputBlack, inputWhite); + var max = Math.max(inputBlack, inputWhite); + var table = Array.call(null, { + length: segments + }); + var colorValue; + var pos = 0; + var outputDelta = outputWhite - outputBlack; + var inputDelta = inputWhite - inputBlack; + while(cnt <= 256){ + perc = cnt / 256; + colorValue = perc <= min ? inputDelta < 0 ? outputWhite : outputBlack : perc >= max ? inputDelta < 0 ? outputBlack : outputWhite : outputBlack + outputDelta * Math.pow((perc - inputBlack) / inputDelta, 1 / gamma); + table[pos] = colorValue; + pos += 1; + cnt += 256 / (segments - 1); + } + return table.join(' '); + }; + SVGProLevelsFilter.prototype.renderFrame = function(forceRender) { + if (forceRender || this.filterManager._mdf) { + var val; + var effectElements = this.filterManager.effectElements; + if (this.feFuncRComposed && (forceRender || effectElements[3].p._mdf || effectElements[4].p._mdf || effectElements[5].p._mdf || effectElements[6].p._mdf || effectElements[7].p._mdf)) { + val = this.getTableValue(effectElements[3].p.v, effectElements[4].p.v, effectElements[5].p.v, effectElements[6].p.v, effectElements[7].p.v); + this.feFuncRComposed.setAttribute('tableValues', val); + this.feFuncGComposed.setAttribute('tableValues', val); + this.feFuncBComposed.setAttribute('tableValues', val); + } + if (this.feFuncR && (forceRender || effectElements[10].p._mdf || effectElements[11].p._mdf || effectElements[12].p._mdf || effectElements[13].p._mdf || effectElements[14].p._mdf)) { + val = this.getTableValue(effectElements[10].p.v, effectElements[11].p.v, effectElements[12].p.v, effectElements[13].p.v, effectElements[14].p.v); + this.feFuncR.setAttribute('tableValues', val); + } + if (this.feFuncG && (forceRender || effectElements[17].p._mdf || effectElements[18].p._mdf || effectElements[19].p._mdf || effectElements[20].p._mdf || effectElements[21].p._mdf)) { + val = this.getTableValue(effectElements[17].p.v, effectElements[18].p.v, effectElements[19].p.v, effectElements[20].p.v, effectElements[21].p.v); + this.feFuncG.setAttribute('tableValues', val); + } + if (this.feFuncB && (forceRender || effectElements[24].p._mdf || effectElements[25].p._mdf || effectElements[26].p._mdf || effectElements[27].p._mdf || effectElements[28].p._mdf)) { + val = this.getTableValue(effectElements[24].p.v, effectElements[25].p.v, effectElements[26].p.v, effectElements[27].p.v, effectElements[28].p.v); + this.feFuncB.setAttribute('tableValues', val); + } + if (this.feFuncA && (forceRender || effectElements[31].p._mdf || effectElements[32].p._mdf || effectElements[33].p._mdf || effectElements[34].p._mdf || effectElements[35].p._mdf)) { + val = this.getTableValue(effectElements[31].p.v, effectElements[32].p.v, effectElements[33].p.v, effectElements[34].p.v, effectElements[35].p.v); + this.feFuncA.setAttribute('tableValues', val); + } + } + }; + function SVGDropShadowEffect(filter, filterManager, elem, id, source) { + var globalFilterSize = filterManager.container.globalData.renderConfig.filterSize; + var filterSize = filterManager.data.fs || globalFilterSize; + filter.setAttribute('x', filterSize.x || globalFilterSize.x); + filter.setAttribute('y', filterSize.y || globalFilterSize.y); + filter.setAttribute('width', filterSize.width || globalFilterSize.width); + filter.setAttribute('height', filterSize.height || globalFilterSize.height); + this.filterManager = filterManager; + var feGaussianBlur = createNS('feGaussianBlur'); + feGaussianBlur.setAttribute('in', 'SourceAlpha'); + feGaussianBlur.setAttribute('result', id + '_drop_shadow_1'); + feGaussianBlur.setAttribute('stdDeviation', '0'); + this.feGaussianBlur = feGaussianBlur; + filter.appendChild(feGaussianBlur); + var feOffset = createNS('feOffset'); + feOffset.setAttribute('dx', '25'); + feOffset.setAttribute('dy', '0'); + feOffset.setAttribute('in', id + '_drop_shadow_1'); + feOffset.setAttribute('result', id + '_drop_shadow_2'); + this.feOffset = feOffset; + filter.appendChild(feOffset); + var feFlood = createNS('feFlood'); + feFlood.setAttribute('flood-color', '#00ff00'); + feFlood.setAttribute('flood-opacity', '1'); + feFlood.setAttribute('result', id + '_drop_shadow_3'); + this.feFlood = feFlood; + filter.appendChild(feFlood); + var feComposite = createNS('feComposite'); + feComposite.setAttribute('in', id + '_drop_shadow_3'); + feComposite.setAttribute('in2', id + '_drop_shadow_2'); + feComposite.setAttribute('operator', 'in'); + feComposite.setAttribute('result', id + '_drop_shadow_4'); + filter.appendChild(feComposite); + var feMerge = this.createMergeNode(id, [ + id + '_drop_shadow_4', + source + ]); + filter.appendChild(feMerge); + } + extendPrototype([ + SVGComposableEffect + ], SVGDropShadowEffect); + SVGDropShadowEffect.prototype.renderFrame = function(forceRender) { + if (forceRender || this.filterManager._mdf) { + if (forceRender || this.filterManager.effectElements[4].p._mdf) this.feGaussianBlur.setAttribute('stdDeviation', this.filterManager.effectElements[4].p.v / 4); + if (forceRender || this.filterManager.effectElements[0].p._mdf) { + var col = this.filterManager.effectElements[0].p.v; + this.feFlood.setAttribute('flood-color', rgbToHex(Math.round(255 * col[0]), Math.round(255 * col[1]), Math.round(255 * col[2]))); + } + if (forceRender || this.filterManager.effectElements[1].p._mdf) this.feFlood.setAttribute('flood-opacity', this.filterManager.effectElements[1].p.v / 255); + if (forceRender || this.filterManager.effectElements[2].p._mdf || this.filterManager.effectElements[3].p._mdf) { + var distance = this.filterManager.effectElements[3].p.v; + var angle = (this.filterManager.effectElements[2].p.v - 90) * degToRads; + var x = distance * Math.cos(angle); + var y = distance * Math.sin(angle); + this.feOffset.setAttribute('dx', x); + this.feOffset.setAttribute('dy', y); + } + } + }; + var _svgMatteSymbols = []; + function SVGMatte3Effect(filterElem, filterManager, elem) { + this.initialized = false; + this.filterManager = filterManager; + this.filterElem = filterElem; + this.elem = elem; + elem.matteElement = createNS('g'); + elem.matteElement.appendChild(elem.layerElement); + elem.matteElement.appendChild(elem.transformedElement); + elem.baseElement = elem.matteElement; + } + SVGMatte3Effect.prototype.findSymbol = function(mask) { + var i = 0; + var len = _svgMatteSymbols.length; + while(i < len){ + if (_svgMatteSymbols[i] === mask) return _svgMatteSymbols[i]; + i += 1; + } + return null; + }; + SVGMatte3Effect.prototype.replaceInParent = function(mask, symbolId) { + var parentNode = mask.layerElement.parentNode; + if (!parentNode) return; + var children = parentNode.children; + var i = 0; + var len = children.length; + while(i < len){ + if (children[i] === mask.layerElement) break; + i += 1; + } + var nextChild; + if (i <= len - 2) nextChild = children[i + 1]; + var useElem = createNS('use'); + useElem.setAttribute('href', '#' + symbolId); + if (nextChild) parentNode.insertBefore(useElem, nextChild); + else parentNode.appendChild(useElem); + }; + SVGMatte3Effect.prototype.setElementAsMask = function(elem, mask) { + if (!this.findSymbol(mask)) { + var symbolId = createElementID(); + var masker = createNS('mask'); + masker.setAttribute('id', mask.layerId); + masker.setAttribute('mask-type', 'alpha'); + _svgMatteSymbols.push(mask); + var defs = elem.globalData.defs; + defs.appendChild(masker); + var symbol = createNS('symbol'); + symbol.setAttribute('id', symbolId); + this.replaceInParent(mask, symbolId); + symbol.appendChild(mask.layerElement); + defs.appendChild(symbol); + var useElem = createNS('use'); + useElem.setAttribute('href', '#' + symbolId); + masker.appendChild(useElem); + mask.data.hd = false; + mask.show(); + } + elem.setMatte(mask.layerId); + }; + SVGMatte3Effect.prototype.initialize = function() { + var ind = this.filterManager.effectElements[0].p.v; + var elements = this.elem.comp.elements; + var i = 0; + var len = elements.length; + while(i < len){ + if (elements[i] && elements[i].data.ind === ind) this.setElementAsMask(this.elem, elements[i]); + i += 1; + } + this.initialized = true; + }; + SVGMatte3Effect.prototype.renderFrame = function() { + if (!this.initialized) this.initialize(); + }; + function SVGGaussianBlurEffect(filter, filterManager, elem, id) { + filter.setAttribute('x', '-100%'); + filter.setAttribute('y', '-100%'); + filter.setAttribute('width', '300%'); + filter.setAttribute('height', '300%'); + this.filterManager = filterManager; + var feGaussianBlur = createNS('feGaussianBlur'); + feGaussianBlur.setAttribute('result', id); + filter.appendChild(feGaussianBlur); + this.feGaussianBlur = feGaussianBlur; + } + SVGGaussianBlurEffect.prototype.renderFrame = function(forceRender) { + if (forceRender || this.filterManager._mdf) { + var kBlurrinessToSigma = 0.3; + var sigma = this.filterManager.effectElements[0].p.v * kBlurrinessToSigma; + var dimensions = this.filterManager.effectElements[1].p.v; + var sigmaX = 3 == dimensions ? 0 : sigma; + var sigmaY = 2 == dimensions ? 0 : sigma; + this.feGaussianBlur.setAttribute('stdDeviation', sigmaX + ' ' + sigmaY); + var edgeMode = 1 == this.filterManager.effectElements[2].p.v ? 'wrap' : 'duplicate'; + this.feGaussianBlur.setAttribute('edgeMode', edgeMode); + } + }; + function TransformEffect() {} + TransformEffect.prototype.init = function(effectsManager) { + this.effectsManager = effectsManager; + this.type = effectTypes.TRANSFORM_EFFECT; + this.matrix = new Matrix(); + this.opacity = -1; + this._mdf = false; + this._opMdf = false; + }; + TransformEffect.prototype.renderFrame = function(forceFrame) { + this._opMdf = false; + this._mdf = false; + if (forceFrame || this.effectsManager._mdf) { + var effectElements = this.effectsManager.effectElements; + var anchor = effectElements[0].p.v; + var position = effectElements[1].p.v; + var isUniformScale = 1 === effectElements[2].p.v; + var scaleHeight = effectElements[3].p.v; + var scaleWidth = isUniformScale ? scaleHeight : effectElements[4].p.v; + var skew = effectElements[5].p.v; + var skewAxis = effectElements[6].p.v; + var rotation = effectElements[7].p.v; + this.matrix.reset(); + this.matrix.translate(-anchor[0], -anchor[1], anchor[2]); + this.matrix.scale(0.01 * scaleWidth, 0.01 * scaleHeight, 1); + this.matrix.rotate(-rotation * degToRads); + this.matrix.skewFromAxis(-skew * degToRads, (skewAxis + 90) * degToRads); + this.matrix.translate(position[0], position[1], 0); + this._mdf = true; + if (this.opacity !== effectElements[8].p.v) { + this.opacity = effectElements[8].p.v; + this._opMdf = true; + } + } + }; + function SVGTransformEffect(_, filterManager) { + this.init(filterManager); + } + extendPrototype([ + TransformEffect + ], SVGTransformEffect); + function CVTransformEffect(effectsManager) { + this.init(effectsManager); + } + extendPrototype([ + TransformEffect + ], CVTransformEffect); + registerRenderer('canvas', CanvasRenderer); + registerRenderer('html', HybridRenderer); + registerRenderer('svg', SVGRenderer); + ShapeModifiers.registerModifier('tm', TrimModifier); + ShapeModifiers.registerModifier('pb', PuckerAndBloatModifier); + ShapeModifiers.registerModifier('rp', RepeaterModifier); + ShapeModifiers.registerModifier('rd', RoundCornersModifier); + ShapeModifiers.registerModifier('zz', ZigZagModifier); + ShapeModifiers.registerModifier('op', OffsetPathModifier); + setExpressionsPlugin(Expressions); + setExpressionInterfaces(getInterface); + initialize$1(); + initialize(); + registerEffect$1(20, SVGTintFilter, true); + registerEffect$1(21, SVGFillFilter, true); + registerEffect$1(22, SVGStrokeEffect, false); + registerEffect$1(23, SVGTritoneFilter, true); + registerEffect$1(24, SVGProLevelsFilter, true); + registerEffect$1(25, SVGDropShadowEffect, true); + registerEffect$1(28, SVGMatte3Effect, false); + registerEffect$1(29, SVGGaussianBlurEffect, true); + registerEffect$1(35, SVGTransformEffect, false); + registerEffect(35, CVTransformEffect); + return lottie; + }); + } +}; +var __webpack_module_cache__ = {}; +function __webpack_require__(moduleId) { + var cachedModule = __webpack_module_cache__[moduleId]; + if (void 0 !== cachedModule) return cachedModule.exports; + var module = __webpack_module_cache__[moduleId] = { + exports: {} + }; + __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); + return module.exports; +} +(()=>{ + __webpack_require__.n = (module)=>{ + var getter = module && module.__esModule ? ()=>module['default'] : ()=>module; + __webpack_require__.d(getter, { + a: getter + }); + return getter; + }; +})(); +(()=>{ + __webpack_require__.d = (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_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop); +})(); +const ALink = ({ className, href, children, style })=>/*#__PURE__*/ jsx("a", { + href: href, + className: className, + style: style, + children: children + }); +const index_module = { + featureCard: "featureCard-pszTrm", + whyRspack: "whyRspack-A_WTpz", + whyRspackTitle: "whyRspackTitle-tp0mrZ", + whyRspackDescription: "whyRspackDescription-j70toO", + featureCardInner: "featureCardInner-X8DiWy", + featureDescription: "featureDescription-yPv0tv", + whyRspackBg: "whyRspackBg-DglQGL", + features: "features-VP6Ici", + featureIcon: "featureIcon-_1CaCl", + featureIconImg: "featureIconImg-XGmAIS", + featureContent: "featureContent-DPzQJp", + featureTitle: "featureTitle-WlHG0x" +}; +const useCardAnimation = ()=>{ + const [pageX, setPageX] = useState(null); + const [pageY, setPageY] = useState(null); + const [isHovering, setIsHovering] = useState(false); + const ref = useRef(); + const handleMove = ({ pageX, pageY })=>{ + setPageX(pageX); + setPageY(pageY); + }; + const handleTouchMove = (evt)=>{ + evt.preventDefault(); + const { pageX, pageY } = evt.touches[0]; + handleMove({ + pageX, + pageY + }); + }; + const handleEnter = ()=>{ + setIsHovering(true); + }; + const handleLeave = ()=>{ + setIsHovering(false); + }; + let shine; + let shineBg; + let container; + let outerContainer; + const ele = ref.current; + if (pageX && pageY && ele) { + const rootElemWidth = ele.clientWidth || ele.offsetWidth || ele.scrollWidth; + const rootElemHeight = ele.clientHeight || ele.offsetHeight || ele.scrollHeight; + const bodyScrollTop = document.body.scrollTop || document.getElementsByTagName('html')[0].scrollTop; + const bodyScrollLeft = document.body.scrollLeft; + const offsets = ele.getBoundingClientRect(); + const wMultiple = 320 / rootElemWidth; + const multiple = 0.05 * wMultiple; + const offsetX = 0.52 - (pageX - offsets.left - bodyScrollLeft) / rootElemWidth; + const offsetY = 0.52 - (pageY - offsets.top - bodyScrollTop) / rootElemHeight; + const dy = pageY - offsets.top - bodyScrollTop - rootElemHeight / 2; + const dx = pageX - offsets.left - bodyScrollLeft - rootElemWidth / 2; + const yRotate = (offsetX - dx) * multiple; + const xRotate = (dy - offsetY) * (Math.min(offsets.width / offsets.height, 1) * multiple); + const arad = Math.atan2(dy, dx); + const rawAngle = 180 * arad / Math.PI - 90; + const angle = rawAngle < 0 ? rawAngle + 360 : rawAngle; + shine = `translateX(${offsetX - 0.1}px) translateY(${offsetY - 0.1}px)`; + shineBg = `linear-gradient(${angle}deg, rgba(255, 255, 255, ${(pageY - offsets.top - bodyScrollTop) / rootElemHeight * 0.2}) 0%, rgba(255, 255, 255, 0) 50%)`; + container = `rotateX(${xRotate}deg) rotateY(${yRotate}deg) ${isHovering ? ' scale3d(1.01,1.01,1.01)' : ''}`; + outerContainer = `perspective(${2 * rootElemWidth}px`; + } else { + shine = ''; + shineBg = ''; + container = ''; + outerContainer = ''; + } + return { + ref, + isHovering, + shine: isHovering ? shine : '', + shineBg: isHovering ? shineBg : '', + container: isHovering ? container : '', + outerContainer: isHovering ? outerContainer : '', + onMouseEnter: handleEnter, + onMouseLeave: handleLeave, + onMouseMove: handleMove, + onTouchMove: handleTouchMove, + onTouchStart: handleEnter, + onTouchEnd: handleLeave + }; +}; +var lottie = __webpack_require__("./node_modules/.pnpm/lottie-web@5.13.0/node_modules/lottie-web/build/player/lottie.js"); +var lottie_default = /*#__PURE__*/ __webpack_require__.n(lottie); +const useLottieAnimation = (isHovering, lottieJsonData)=>{ + const ref = useRef(); + const animationRef = useRef(); + useEffect(()=>{ + if (!ref.current) return; + if (!lottieJsonData) return; + const animation = lottie_default().loadAnimation({ + container: ref.current, + animationData: lottieJsonData, + renderer: 'svg', + loop: false, + autoplay: false + }); + animation.setSpeed(3); + animationRef.current = animation; + }, [ + lottieJsonData + ]); + useEffect(()=>{ + if (!animationRef.current || !ref.current) return; + if (isHovering) animationRef.current.goToAndPlay(0, true); + else animationRef.current.goToAndStop(0, true); + }, [ + isHovering + ]); + return { + ref + }; +}; +const FeatureItem = /*#__PURE__*/ memo(({ feature, LinkComp })=>{ + const { description, img, title, url, lottieJsonData } = feature; + const { container, isHovering, onMouseEnter, onMouseLeave, onMouseMove, onTouchEnd, onTouchMove, onTouchStart, outerContainer, ref: cardAnimationContainerRef, shine, shineBg } = useCardAnimation(); + const hasLottieAnimation = void 0 !== lottieJsonData; + const { ref: lottieContainerRef } = useLottieAnimation(isHovering, lottieJsonData); + const Link = LinkComp; + return /*#__PURE__*/ jsx("div", { + style: { + position: 'relative', + transform: outerContainer, + cursor: 'pointer', + transformStyle: 'preserve-3d', + WebkitTapHighlightColor: 'rgba(#000, 0)' + }, + className: index_module.featureCard, + ref: cardAnimationContainerRef, + onMouseEnter: onMouseEnter, + onMouseLeave: onMouseLeave, + onMouseMove: onMouseMove, + onTouchMove: onTouchMove, + onTouchEnd: onTouchEnd, + onTouchStart: onTouchStart, + children: /*#__PURE__*/ jsxs(Link, { + href: url, + className: index_module.featureCardInner, + style: { + transform: container, + position: 'relative', + transition: 'all 0.2s ease-out' + }, + children: [ + /*#__PURE__*/ jsx("div", { + className: "shine", + style: { + position: 'absolute', + top: '0', + left: '0', + right: '0', + bottom: '0', + borderRadius: '20px', + zIndex: '8', + ...shine ? { + transform: shine + } : {}, + ...shineBg ? { + background: shineBg + } : {} + } + }), + /*#__PURE__*/ jsxs("div", { + className: index_module.featureIcon, + children: [ + /*#__PURE__*/ jsx("img", { + src: img, + alt: title, + className: index_module.featureIconImg, + style: hasLottieAnimation ? { + display: isHovering && hasLottieAnimation ? 'none' : 'flex' + } : {} + }), + hasLottieAnimation ? /*#__PURE__*/ jsx("div", { + ref: lottieContainerRef, + className: index_module.featureIconImg, + style: { + display: isHovering ? 'flex' : 'none' + } + }) : null + ] + }), + /*#__PURE__*/ jsxs("div", { + className: index_module.featureContent, + children: [ + /*#__PURE__*/ jsx("h3", { + className: index_module.featureTitle, + children: title + }), + /*#__PURE__*/ jsx("p", { + className: index_module.featureDescription, + children: description + }) + ] + }) + ] + }, title) + }); +}); +const FeatureList = /*#__PURE__*/ memo(({ LinkComp, features })=>/*#__PURE__*/ jsx(Fragment, { + children: features.map((feature)=>/*#__PURE__*/ jsx(FeatureItem, { + feature: feature, + LinkComp: null != LinkComp ? LinkComp : ALink + }, feature.title)) + })); +const WhyRspack = ({ features, LinkComp })=>/*#__PURE__*/ jsx("div", { + className: index_module.features, + children: /*#__PURE__*/ jsx(FeatureList, { + features: features, + LinkComp: LinkComp + }) + }); +export { WhyRspack }; diff --git a/rstack-doc-ui/dist/why-rspack/index.js.LICENSE.txt b/rstack-doc-ui/dist/why-rspack/index.js.LICENSE.txt new file mode 100644 index 0000000..427a6af --- /dev/null +++ b/rstack-doc-ui/dist/why-rspack/index.js.LICENSE.txt @@ -0,0 +1,8 @@ +/*! + Transformation Matrix v2.0 + (c) Epistemex 2014-2015 + www.epistemex.com + By Ken Fyrstenberg + Contributions by leeoniya. + License: MIT, header required. + */ \ No newline at end of file diff --git a/rstack-doc-ui/dist/why-rspack/useCardAnimation.d.ts b/rstack-doc-ui/dist/why-rspack/useCardAnimation.d.ts new file mode 100644 index 0000000..27b04db --- /dev/null +++ b/rstack-doc-ui/dist/why-rspack/useCardAnimation.d.ts @@ -0,0 +1,17 @@ +export declare const useCardAnimation: () => { + ref: import("react").MutableRefObject; + isHovering: boolean; + shine: string; + shineBg: string; + container: string; + outerContainer: string; + onMouseEnter: () => void; + onMouseLeave: () => void; + onMouseMove: ({ pageX, pageY }: { + pageX: number; + pageY: number; + }) => void; + onTouchMove: (evt: any) => void; + onTouchStart: () => void; + onTouchEnd: () => void; +}; diff --git a/rstack-doc-ui/dist/why-rspack/useLottieAnimation.d.ts b/rstack-doc-ui/dist/why-rspack/useLottieAnimation.d.ts new file mode 100644 index 0000000..a47c60f --- /dev/null +++ b/rstack-doc-ui/dist/why-rspack/useLottieAnimation.d.ts @@ -0,0 +1,3 @@ +export declare const useLottieAnimation: (isHovering: boolean, lottieJsonData?: string) => { + ref: import("react").MutableRefObject; +};