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WA,UACXC,SAAUA,SACVC,WAAYA,aAIhB,OADA9E,KAAKqB,OAASrB,KAAKkB,gBACZ,EAAInF,OAAO6F,eAAemB,QAASiC,UAAWD,gBAIlDnF,aArQU,CAsQjB7D,OAAOsJ,WAET1F,gBAAgBC,aAAc,YAAa,CACzCkD,mBAAoBtG,YAAqB,WAAE8I,OAC3CvC,QAASvG,YAAqB,WAAE8I,OAChCzC,KAAMrG,YAAqB,WAAE+I,UAAU,CAAC/I,YAAqB,WAAEgJ,OAAQhJ,YAAqB,WAAEiJ,OAC9FvE,aAAc1E,YAAqB,WAAEkJ,KACrCzE,YAAazE,YAAqB,WAAEkJ,KACpC3E,UAAWvE,YAAqB,WAAEkJ,KAClCpD,KAAM9F,YAAqB,WAAE8I,OAC7BtC,YAAaxG,YAAqB,WAAEmJ,KACpC1C,kBAAmBzG,YAAqB,WAAEmJ,KAC1CzC,aAAc1G,YAAqB,WAAE8I,OACrCnC,kBAAmB3G,YAAqB,WAAEgJ,SAG5C7F,gBAAgBC,aAAc,eAAgB,CAC5CmD,QAAS,MACTF,KAAM,EACNP,KAAM,GACNU,YAAa,OACbE,aAAc,IACdC,kBAAmB,KAGrBrH,QAAQM,WAAUwD,aAElBgG,OAAO9J,QAAUA,QAAQM,aAnc2B","sources":["webpack://giveeasy.cloud/./node_modules/react-text-truncate/lib/index.js"],"sourcesContent":["\"use strict\";\n\n(function (global, factory) {\n if (typeof define === \"function\" && define.amd) {\n define([\"exports\", \"react\", \"prop-types\"], factory);\n } else if (typeof exports !== \"undefined\") {\n factory(exports, require(\"react\"), require(\"prop-types\"));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod.exports, global.React, global.propTypes);\n global.undefined = mod.exports;\n }\n})(void 0, function (exports, _react, _propTypes) {\n \"use strict\";\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n exports.default = undefined;\n\n var _react2 = _interopRequireDefault(_react);\n\n var _propTypes2 = _interopRequireDefault(_propTypes);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n function _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n }\n\n function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n }\n\n function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n }\n\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n }\n\n function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return _assertThisInitialized(self);\n }\n\n function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n }\n\n function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n }\n\n function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n }\n\n function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n }\n\n function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n }\n\n var TextTruncate = function (_Component) {\n _inherits(TextTruncate, _Component);\n\n function TextTruncate() {\n var _getPrototypeOf2;\n\n var _this;\n\n _classCallCheck(this, TextTruncate);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(TextTruncate)).call.apply(_getPrototypeOf2, [this].concat(args)));\n\n _defineProperty(_assertThisInitialized(_this), \"onResize\", function () {\n if (_this.rafId) {\n window.cancelAnimationFrame(_this.rafId);\n }\n\n _this.rafId = window.requestAnimationFrame(_this.update.bind(_assertThisInitialized(_this)));\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onToggled\", function (truncated) {\n typeof _this.props.onToggled === 'function' && setTimeout(function () {\n return _this.props.onToggled(truncated);\n }, 0);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onTruncated\", function () {\n typeof _this.props.onTruncated === 'function' && setTimeout(function () {\n return _this.props.onTruncated();\n }, 0);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onCalculated\", function () {\n typeof _this.props.onCalculated === 'function' && setTimeout(function () {\n return _this.props.onCalculated();\n }, 0);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"update\", function () {\n var style = window.getComputedStyle(_this.scope);\n var font = [style['font-weight'], style['font-style'], style['font-size'], style['font-family'], style['letter-spacing']].join(' ');\n _this.canvas.font = font;\n\n _this.forceUpdate();\n });\n\n return _this;\n }\n\n _createClass(TextTruncate, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var canvas = document.createElement('canvas');\n var docFragment = document.createDocumentFragment();\n var style = window.getComputedStyle(this.scope);\n var font = [style['font-weight'], style['font-style'], style['font-size'], style['font-family']].join(' ');\n docFragment.appendChild(canvas);\n this.canvas = canvas.getContext('2d');\n this.canvas.font = font;\n this.forceUpdate();\n window.addEventListener('resize', this.onResize);\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n window.removeEventListener('resize', this.onResize);\n\n if (this.rafId) {\n window.cancelAnimationFrame(this.rafId);\n }\n }\n }, {\n key: \"measureWidth\",\n value: function measureWidth(text) {\n return Math.ceil(this.canvas.measureText(text).width);\n }\n }, {\n key: \"getRenderText\",\n value: function getRenderText() {\n var _this$props = this.props,\n containerClassName = _this$props.containerClassName,\n element = _this$props.element,\n line = _this$props.line,\n onCalculated = _this$props.onCalculated,\n onTruncated = _this$props.onTruncated,\n onToggled = _this$props.onToggled,\n text = _this$props.text,\n textElement = _this$props.textElement,\n textTruncateChild = _this$props.textTruncateChild,\n truncateText = _this$props.truncateText,\n maxCalculateTimes = _this$props.maxCalculateTimes,\n props = _objectWithoutProperties(_this$props, [\"containerClassName\", \"element\", \"line\", \"onCalculated\", \"onTruncated\", \"onToggled\", \"text\", \"textElement\", \"textTruncateChild\", \"truncateText\", \"maxCalculateTimes\"]);\n\n var scopeWidth = this.scope.getBoundingClientRect().width; // return if display:none\n\n if (scopeWidth === 0) {\n return null;\n } // return if all of text can be displayed\n\n\n if (scopeWidth >= this.measureWidth(text)) {\n this.onToggled(false);\n return (0, _react.createElement)(textElement, props, text);\n }\n\n var childText = '';\n\n if (textTruncateChild && typeof textTruncateChild.type === 'string') {\n var type = textTruncateChild.type;\n\n if (type.indexOf('span') >= 0 || type.indexOf('a') >= 0) {\n childText = textTruncateChild.props.children;\n }\n }\n\n var currentPos = 1;\n var maxTextLength = text.length;\n var truncatedText = '';\n var splitPos = 0;\n var startPos = 0;\n var displayLine = line;\n var width = 0;\n var lastIsEng = false;\n var isPrevLineWithoutSpace = false;\n var lastPos = 0;\n var lastSpaceIndex = -1;\n var ext = '';\n var loopCnt = 0;\n\n while (displayLine-- > 0) {\n ext = displayLine ? '' : truncateText + (childText ? ' ' + childText : '');\n\n while (currentPos <= maxTextLength) {\n truncatedText = text.substr(startPos, currentPos);\n width = this.measureWidth(truncatedText + ext);\n\n if (width < scopeWidth) {\n splitPos = text.indexOf(' ', currentPos + 1);\n\n if (splitPos === -1) {\n currentPos += 1;\n lastIsEng = false;\n } else {\n lastIsEng = true;\n currentPos = splitPos;\n }\n } else {\n do {\n if (loopCnt++ >= maxCalculateTimes) {\n break;\n }\n\n truncatedText = text.substr(startPos, currentPos);\n\n if (!displayLine) {\n currentPos--;\n }\n\n if (truncatedText[truncatedText.length - 1] === ' ') {\n truncatedText = text.substr(startPos, currentPos - 1);\n }\n\n if (lastIsEng) {\n lastSpaceIndex = truncatedText.lastIndexOf(' ');\n\n if (lastSpaceIndex > -1) {\n currentPos = lastSpaceIndex;\n\n if (displayLine) {\n currentPos++;\n }\n\n truncatedText = text.substr(startPos, currentPos);\n } else {\n currentPos--;\n truncatedText = text.substr(startPos, currentPos);\n }\n } else {\n currentPos--;\n truncatedText = text.substr(startPos, currentPos);\n }\n\n width = this.measureWidth(truncatedText + ext);\n } while (width >= scopeWidth && truncatedText.length > 0);\n\n startPos += currentPos;\n break;\n }\n }\n\n if (currentPos >= maxTextLength) {\n startPos = maxTextLength;\n break;\n }\n\n if (lastIsEng && !isPrevLineWithoutSpace && text.substr(lastPos, currentPos).indexOf(' ') === -1) {\n isPrevLineWithoutSpace = text.substr(lastPos, currentPos).indexOf(' ') === -1;\n displayLine--;\n }\n\n lastPos = currentPos + 1;\n }\n\n if (startPos === maxTextLength) {\n this.onToggled(false);\n return (0, _react.createElement)(textElement, props, text);\n }\n\n this.onTruncated();\n this.onToggled(true);\n return _react2[\"default\"].createElement(\"span\", props, (0, _react.createElement)(textElement, props, text.substr(0, startPos) + truncateText + ' '), textTruncateChild);\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this2 = this;\n\n var _this$props2 = this.props,\n element = _this$props2.element,\n text = _this$props2.text,\n _this$props2$style = _this$props2.style,\n style = _this$props2$style === void 0 ? {} : _this$props2$style,\n containerClassName = _this$props2.containerClassName,\n line = _this$props2.line,\n onCalculated = _this$props2.onCalculated,\n onTruncated = _this$props2.onTruncated,\n onToggled = _this$props2.onToggled,\n textElement = _this$props2.textElement,\n textTruncateChild = _this$props2.textTruncateChild,\n truncateText = _this$props2.truncateText,\n maxCalculateTimes = _this$props2.maxCalculateTimes,\n props = _objectWithoutProperties(_this$props2, [\"element\", \"text\", \"style\", \"containerClassName\", \"line\", \"onCalculated\", \"onTruncated\", \"onToggled\", \"textElement\", \"textTruncateChild\", \"truncateText\", \"maxCalculateTimes\"]);\n\n var fontWeight = style.fontWeight,\n fontStyle = style.fontStyle,\n fontSize = style.fontSize,\n fontFamily = style.fontFamily;\n var renderText = this.scope && line ? this.getRenderText() : (0, _react.createElement)(textElement, props, text);\n ;\n var rootProps = {\n ref: function ref(el) {\n _this2.scope = el;\n },\n className: containerClassName,\n style: {\n overflow: 'hidden',\n fontWeight: fontWeight,\n fontStyle: fontStyle,\n fontSize: fontSize,\n fontFamily: fontFamily\n }\n };\n this.scope && this.onCalculated();\n return (0, _react.createElement)(element, rootProps, renderText);\n }\n }]);\n\n return TextTruncate;\n }(_react.Component);\n\n _defineProperty(TextTruncate, \"propTypes\", {\n containerClassName: _propTypes2[\"default\"].string,\n element: _propTypes2[\"default\"].string,\n line: _propTypes2[\"default\"].oneOfType([_propTypes2[\"default\"].number, _propTypes2[\"default\"].bool]),\n onCalculated: _propTypes2[\"default\"].func,\n onTruncated: _propTypes2[\"default\"].func,\n onToggled: _propTypes2[\"default\"].func,\n text: _propTypes2[\"default\"].string,\n textElement: _propTypes2[\"default\"].node,\n textTruncateChild: _propTypes2[\"default\"].node,\n truncateText: _propTypes2[\"default\"].string,\n maxCalculateTimes: _propTypes2[\"default\"].number\n });\n\n _defineProperty(TextTruncate, \"defaultProps\", {\n element: 'div',\n line: 1,\n text: '',\n textElement: 'span',\n truncateText: '…',\n maxCalculateTimes: 10\n });\n\n exports.default = TextTruncate;\n ;\n module.exports = exports.default;\n});\n"],"names":["exports","_react","_propTypes","Object","defineProperty","value","default","undefined","_react2","_interopRequireDefault","_propTypes2","obj","__esModule","_typeof","Symbol","iterator","constructor","prototype","_objectWithoutProperties","source","excluded","key","i","target","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","length","indexOf","propertyIsEnumerable","call","sourceKeys","keys","_classCallCheck","instance","Constructor","TypeError","_defineProperties","props","descriptor","enumerable","configurable","writable","_createClass","protoProps","staticProps","_possibleConstructorReturn","self","_assertThisInitialized","_getPrototypeOf","o","setPrototypeOf","getPrototypeOf","__proto__","ReferenceError","_inherits","subClass","superClass","create","_setPrototypeOf","p","_defineProperty","TextTruncate","_Component","_getPrototypeOf2","_this","this","_len","arguments","args","Array","_key","apply","concat","rafId","window","cancelAnimationFrame","requestAnimationFrame","update","bind","truncated","onToggled","setTimeout","onTruncated","onCalculated","style","getComputedStyle","scope","font","join","canvas","forceUpdate","componentDidMount","document","createElement","docFragment","createDocumentFragment","appendChild","getContext","addEventListener","onResize","componentWillUnmount","removeEventListener","measureWidth","text","Math","ceil","measureText","width","getRenderText","_this$props","line","containerClassName","element","textElement","textTruncateChild","truncateText","maxCalculateTimes","scopeWidth","getBoundingClientRect","childText","type","children","currentPos","maxTextLength","truncatedText","splitPos","startPos","displayLine","lastIsEng","isPrevLineWithoutSpace","lastPos","lastSpaceIndex","ext","loopCnt","substr","lastIndexOf","render","_this2","_this$props2","_this$props2$style","fontWeight","fontStyle","fontSize","fontFamily","renderText","rootProps","ref","el","className","overflow","Component","string","oneOfType","number","bool","func","node","module"],"sourceRoot":""}