antd3-esm 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/LICENSE +21 -0
  2. package/dist/Checkbox.js +164 -0
  3. package/dist/CommonMixin.js +816 -0
  4. package/dist/Divider.js +646 -0
  5. package/dist/Notification.js +279 -0
  6. package/dist/Pagination.js +1106 -0
  7. package/dist/PortalWrapper.js +347 -0
  8. package/dist/RowContext.js +5 -0
  9. package/dist/Sider.js +533 -0
  10. package/dist/TextArea.js +432 -0
  11. package/dist/_arrayMap.js +68 -0
  12. package/dist/_assignValue.js +95 -0
  13. package/dist/_copyArray.js +31 -0
  14. package/dist/_hasPath.js +53 -0
  15. package/dist/_overArg.js +437 -0
  16. package/dist/_stringToArray.js +136 -0
  17. package/dist/antd/es/affix.js +12 -0
  18. package/dist/antd/es/alert.js +5 -0
  19. package/dist/antd/es/anchor.js +466 -0
  20. package/dist/antd/es/auto-complete.js +5 -0
  21. package/dist/antd/es/avatar.js +5 -0
  22. package/dist/antd/es/back-top.js +5 -0
  23. package/dist/antd/es/badge.js +5 -0
  24. package/dist/antd/es/breadcrumb.js +18 -0
  25. package/dist/antd/es/button.js +12 -0
  26. package/dist/antd/es/calendar.js +953 -0
  27. package/dist/antd/es/card.js +5 -0
  28. package/dist/antd/es/carousel.js +5 -0
  29. package/dist/antd/es/cascader.js +1275 -0
  30. package/dist/antd/es/checkbox.js +11 -0
  31. package/dist/antd/es/col.js +4 -0
  32. package/dist/antd/es/collapse.js +688 -0
  33. package/dist/antd/es/comment.js +5 -0
  34. package/dist/antd/es/config-provider.js +2 -0
  35. package/dist/antd/es/date-picker.js +4322 -0
  36. package/dist/antd/es/descriptions.js +342 -0
  37. package/dist/antd/es/divider.js +53 -0
  38. package/dist/antd/es/drawer.js +1115 -0
  39. package/dist/antd/es/dropdown.js +14 -0
  40. package/dist/antd/es/empty.js +6 -0
  41. package/dist/antd/es/form.js +5008 -0
  42. package/dist/antd/es/grid.js +13 -0
  43. package/dist/antd/es/icon.js +6 -0
  44. package/dist/antd/es/input-number.js +5 -0
  45. package/dist/antd/es/input.js +16 -0
  46. package/dist/antd/es/layout.js +14 -0
  47. package/dist/antd/es/list.js +5 -0
  48. package/dist/antd/es/locale/ar_EG.js +102 -0
  49. package/dist/antd/es/locale/bg_BG.js +98 -0
  50. package/dist/antd/es/locale/ca_ES.js +96 -0
  51. package/dist/antd/es/locale/cs_CZ.js +96 -0
  52. package/dist/antd/es/locale/da_DK.js +98 -0
  53. package/dist/antd/es/locale/de_DE.js +98 -0
  54. package/dist/antd/es/locale/default.js +2 -0
  55. package/dist/antd/es/locale/el_GR.js +98 -0
  56. package/dist/antd/es/locale/en_GB.js +98 -0
  57. package/dist/antd/es/locale/en_US.js +2 -0
  58. package/dist/antd/es/locale/es_ES.js +114 -0
  59. package/dist/antd/es/locale/et_EE.js +98 -0
  60. package/dist/antd/es/locale/fa_IR.js +98 -0
  61. package/dist/antd/es/locale/fi_FI.js +99 -0
  62. package/dist/antd/es/locale/fr_BE.js +102 -0
  63. package/dist/antd/es/locale/fr_FR.js +102 -0
  64. package/dist/antd/es/locale/ga_IE.js +99 -0
  65. package/dist/antd/es/locale/he_IL.js +99 -0
  66. package/dist/antd/es/locale/hi_IN.js +107 -0
  67. package/dist/antd/es/locale/hr_HR.js +113 -0
  68. package/dist/antd/es/locale/hu_HU.js +99 -0
  69. package/dist/antd/es/locale/hy_AM.js +109 -0
  70. package/dist/antd/es/locale/id_ID.js +101 -0
  71. package/dist/antd/es/locale/is_IS.js +98 -0
  72. package/dist/antd/es/locale/it_IT.js +111 -0
  73. package/dist/antd/es/locale/ja_JP.js +96 -0
  74. package/dist/antd/es/locale/kn_IN.js +107 -0
  75. package/dist/antd/es/locale/ko_KR.js +98 -0
  76. package/dist/antd/es/locale/ku_IQ.js +98 -0
  77. package/dist/antd/es/locale/lv_LV.js +98 -0
  78. package/dist/antd/es/locale/mk_MK.js +113 -0
  79. package/dist/antd/es/locale/mn_MN.js +99 -0
  80. package/dist/antd/es/locale/ms_MY.js +118 -0
  81. package/dist/antd/es/locale/nb_NO.js +97 -0
  82. package/dist/antd/es/locale/ne_NP.js +44 -0
  83. package/dist/antd/es/locale/nl_BE.js +98 -0
  84. package/dist/antd/es/locale/nl_NL.js +117 -0
  85. package/dist/antd/es/locale/pl_PL.js +98 -0
  86. package/dist/antd/es/locale/pt_BR.js +104 -0
  87. package/dist/antd/es/locale/pt_PT.js +127 -0
  88. package/dist/antd/es/locale/ro_RO.js +118 -0
  89. package/dist/antd/es/locale/ru_RU.js +110 -0
  90. package/dist/antd/es/locale/sk_SK.js +118 -0
  91. package/dist/antd/es/locale/sl_SI.js +96 -0
  92. package/dist/antd/es/locale/sr_RS.js +97 -0
  93. package/dist/antd/es/locale/sv_SE.js +101 -0
  94. package/dist/antd/es/locale/ta_IN.js +119 -0
  95. package/dist/antd/es/locale/th_TH.js +117 -0
  96. package/dist/antd/es/locale/tr_TR.js +112 -0
  97. package/dist/antd/es/locale/uk_UA.js +97 -0
  98. package/dist/antd/es/locale/vi_VN.js +99 -0
  99. package/dist/antd/es/locale/zh_CN.js +104 -0
  100. package/dist/antd/es/locale/zh_TW.js +100 -0
  101. package/dist/antd/es/locale-provider.js +6 -0
  102. package/dist/antd/es/mention.js +23215 -0
  103. package/dist/antd/es/mentions.js +961 -0
  104. package/dist/antd/es/menu.js +5 -0
  105. package/dist/antd/es/message.js +161 -0
  106. package/dist/antd/es/modal.js +885 -0
  107. package/dist/antd/es/notification.js +216 -0
  108. package/dist/antd/es/page-header.js +350 -0
  109. package/dist/antd/es/pagination.js +15 -0
  110. package/dist/antd/es/popconfirm.js +215 -0
  111. package/dist/antd/es/popover.js +5 -0
  112. package/dist/antd/es/progress.js +10 -0
  113. package/dist/antd/es/radio.js +10 -0
  114. package/dist/antd/es/rate.js +5 -0
  115. package/dist/antd/es/result.js +828 -0
  116. package/dist/antd/es/row.js +9 -0
  117. package/dist/antd/es/select.js +5 -0
  118. package/dist/antd/es/skeleton.js +370 -0
  119. package/dist/antd/es/slider.js +5 -0
  120. package/dist/antd/es/spin.js +11 -0
  121. package/dist/antd/es/statistic.js +650 -0
  122. package/dist/antd/es/steps.js +5 -0
  123. package/dist/antd/es/style.js +5 -0
  124. package/dist/antd/es/switch.js +5 -0
  125. package/dist/antd/es/table.js +7057 -0
  126. package/dist/antd/es/tabs.js +5 -0
  127. package/dist/antd/es/tag.js +12 -0
  128. package/dist/antd/es/time-picker.js +10 -0
  129. package/dist/antd/es/timeline.js +206 -0
  130. package/dist/antd/es/tooltip.js +9 -0
  131. package/dist/antd/es/transfer.js +2508 -0
  132. package/dist/antd/es/tree-select.js +5 -0
  133. package/dist/antd/es/tree.js +10 -0
  134. package/dist/antd/es/typography.js +1246 -0
  135. package/dist/antd/es/upload.js +3418 -0
  136. package/dist/antd/es/version.js +7 -0
  137. package/dist/col.js +142 -0
  138. package/dist/config-provider.js +6949 -0
  139. package/dist/dropdown.js +442 -0
  140. package/dist/get.js +1043 -0
  141. package/dist/icon.js +6138 -0
  142. package/dist/identity.js +230 -0
  143. package/dist/index.js +462 -0
  144. package/dist/index10.js +478 -0
  145. package/dist/index11.js +232 -0
  146. package/dist/index12.js +2766 -0
  147. package/dist/index13.js +422 -0
  148. package/dist/index14.js +283 -0
  149. package/dist/index15.js +1755 -0
  150. package/dist/index2.js +374 -0
  151. package/dist/index3.js +407 -0
  152. package/dist/index4.js +522 -0
  153. package/dist/index5.js +601 -0
  154. package/dist/index6.js +601 -0
  155. package/dist/index7.js +364 -0
  156. package/dist/index8.js +436 -0
  157. package/dist/index9.js +130 -0
  158. package/dist/input.js +475 -0
  159. package/dist/isLength.js +402 -0
  160. package/dist/keys.js +292 -0
  161. package/dist/menu.js +8138 -0
  162. package/dist/progress.js +852 -0
  163. package/dist/raf.js +34 -0
  164. package/dist/responsiveObserve.js +444 -0
  165. package/dist/row.js +173 -0
  166. package/dist/scrollTo.js +66 -0
  167. package/dist/toInteger.js +123 -0
  168. package/dist/toString.js +84 -0
  169. package/dist/transButton.js +121 -0
  170. package/dist/tree.js +3017 -0
  171. package/dist/warning.js +55 -0
  172. package/dist/wave.js +230 -0
  173. package/dist/zh_CN.js +17 -0
  174. package/package.json +160 -0
@@ -0,0 +1,3418 @@
1
+ import { n, c as classNames, P as PropTypes, g as getDefaultExportFromCjs, C as ConfigConsumer, L as LocaleReceiver, i as defaultLocale } from '../../config-provider.js';
2
+ import * as React from 'react';
3
+ import React__default, { Component } from 'react';
4
+ import { A as Animate, p as polyfill } from '../../menu.js';
5
+ import { _ as _inherits$3, a as _classCallCheck$3, b as _possibleConstructorReturn$3, c as _createClass$3, d as _defineProperty$2, e as _extends$4, I as Icon } from '../../icon.js';
6
+ import ReactDOM__default from 'react-dom';
7
+ import { w as warning, r as require_Symbol, i as requireIsObjectLike, h as requireIsObject } from '../../tree.js';
8
+ import { r as require_Uint8Array, a as require_Stack, b as requireIdentity } from '../../identity.js';
9
+ import { d as require_MapCache, b as requireEq, e as requireGet, f as require_isKey, a as require_toKey, g as require_baseGet } from '../../get.js';
10
+ import { r as require_setToArray, a as require_mapToArray, b as requireKeys, c as require_getTag, d as require_Set } from '../../keys.js';
11
+ import { r as requireIsArray } from '../../_arrayMap.js';
12
+ import { d as requireIsBuffer, e as requireIsTypedArray } from '../../_overArg.js';
13
+ import { r as require_hasPath } from '../../_hasPath.js';
14
+ import { r as require_baseProperty, a as requireToInteger } from '../../toInteger.js';
15
+ import { T as Tooltip } from '../../index6.js';
16
+ import { P as Progress } from '../../progress.js';
17
+ import '../../input.js';
18
+ import '../../isLength.js';
19
+ import '../../toString.js';
20
+
21
+ var css = "/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */\n/* stylelint-disable no-duplicate-selectors */\n/* stylelint-disable */\n/* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */\n.ant-upload {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n color: rgba(0, 0, 0, 0.65);\n font-size: 14px;\n font-variant: tabular-nums;\n line-height: 1.5;\n list-style: none;\n font-feature-settings: 'tnum';\n outline: 0;\n}\n.ant-upload p {\n margin: 0;\n}\n.ant-upload-btn {\n display: block;\n width: 100%;\n outline: none;\n}\n.ant-upload input[type='file'] {\n cursor: pointer;\n}\n.ant-upload.ant-upload-select {\n display: inline-block;\n}\n.ant-upload.ant-upload-disabled {\n cursor: not-allowed;\n}\n.ant-upload.ant-upload-select-picture-card {\n display: table;\n float: left;\n width: 104px;\n height: 104px;\n margin-right: 8px;\n margin-bottom: 8px;\n text-align: center;\n vertical-align: top;\n background-color: #fafafa;\n border: 1px dashed #d9d9d9;\n border-radius: 4px;\n cursor: pointer;\n transition: border-color 0.3s ease;\n}\n.ant-upload.ant-upload-select-picture-card > .ant-upload {\n display: table-cell;\n width: 100%;\n height: 100%;\n padding: 8px;\n text-align: center;\n vertical-align: middle;\n}\n.ant-upload.ant-upload-select-picture-card:hover {\n border-color: #1890ff;\n}\n.ant-upload.ant-upload-drag {\n position: relative;\n width: 100%;\n height: 100%;\n text-align: center;\n background: #fafafa;\n border: 1px dashed #d9d9d9;\n border-radius: 4px;\n cursor: pointer;\n transition: border-color 0.3s;\n}\n.ant-upload.ant-upload-drag .ant-upload {\n padding: 16px 0;\n}\n.ant-upload.ant-upload-drag.ant-upload-drag-hover:not(.ant-upload-disabled) {\n border-color: #096dd9;\n}\n.ant-upload.ant-upload-drag.ant-upload-disabled {\n cursor: not-allowed;\n}\n.ant-upload.ant-upload-drag .ant-upload-btn {\n display: table;\n height: 100%;\n}\n.ant-upload.ant-upload-drag .ant-upload-drag-container {\n display: table-cell;\n vertical-align: middle;\n}\n.ant-upload.ant-upload-drag:not(.ant-upload-disabled):hover {\n border-color: #40a9ff;\n}\n.ant-upload.ant-upload-drag p.ant-upload-drag-icon {\n margin-bottom: 20px;\n}\n.ant-upload.ant-upload-drag p.ant-upload-drag-icon .anticon {\n color: #40a9ff;\n font-size: 48px;\n}\n.ant-upload.ant-upload-drag p.ant-upload-text {\n margin: 0 0 4px;\n color: rgba(0, 0, 0, 0.85);\n font-size: 16px;\n}\n.ant-upload.ant-upload-drag p.ant-upload-hint {\n color: rgba(0, 0, 0, 0.45);\n font-size: 14px;\n}\n.ant-upload.ant-upload-drag .anticon-plus {\n color: rgba(0, 0, 0, 0.25);\n font-size: 30px;\n transition: all 0.3s;\n}\n.ant-upload.ant-upload-drag .anticon-plus:hover {\n color: rgba(0, 0, 0, 0.45);\n}\n.ant-upload.ant-upload-drag:hover .anticon-plus {\n color: rgba(0, 0, 0, 0.45);\n}\n.ant-upload-picture-card-wrapper {\n zoom: 1;\n display: inline-block;\n width: 100%;\n}\n.ant-upload-picture-card-wrapper::before,\n.ant-upload-picture-card-wrapper::after {\n display: table;\n content: '';\n}\n.ant-upload-picture-card-wrapper::after {\n clear: both;\n}\n.ant-upload-list {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n color: rgba(0, 0, 0, 0.65);\n font-size: 14px;\n font-variant: tabular-nums;\n line-height: 1.5;\n list-style: none;\n font-feature-settings: 'tnum';\n zoom: 1;\n}\n.ant-upload-list::before,\n.ant-upload-list::after {\n display: table;\n content: '';\n}\n.ant-upload-list::after {\n clear: both;\n}\n.ant-upload-list-item-list-type-text:hover .ant-upload-list-item-name-icon-count-1 {\n padding-right: 14px;\n}\n.ant-upload-list-item-list-type-text:hover .ant-upload-list-item-name-icon-count-2 {\n padding-right: 28px;\n}\n.ant-upload-list-item {\n position: relative;\n height: 22px;\n margin-top: 8px;\n font-size: 14px;\n}\n.ant-upload-list-item-name {\n display: inline-block;\n width: 100%;\n padding-left: 22px;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n.ant-upload-list-item-name-icon-count-1 {\n padding-right: 14px;\n}\n.ant-upload-list-item-card-actions {\n position: absolute;\n right: 0;\n opacity: 0;\n}\n.ant-upload-list-item-card-actions.picture {\n top: 25px;\n line-height: 1;\n opacity: 1;\n}\n.ant-upload-list-item-card-actions .anticon {\n padding-right: 6px;\n color: rgba(0, 0, 0, 0.45);\n}\n.ant-upload-list-item-info {\n height: 100%;\n padding: 0 12px 0 4px;\n transition: background-color 0.3s;\n}\n.ant-upload-list-item-info > span {\n display: block;\n width: 100%;\n height: 100%;\n}\n.ant-upload-list-item-info .anticon-loading,\n.ant-upload-list-item-info .anticon-paper-clip {\n position: absolute;\n top: 5px;\n color: rgba(0, 0, 0, 0.45);\n font-size: 14px;\n}\n.ant-upload-list-item .anticon-close {\n display: inline-block;\n font-size: 12px;\n font-size: 10px \\9;\n transform: scale(0.83333333) rotate(0deg);\n position: absolute;\n top: 6px;\n right: 4px;\n color: rgba(0, 0, 0, 0.45);\n line-height: 0;\n cursor: pointer;\n opacity: 0;\n transition: all 0.3s;\n}\n:root .ant-upload-list-item .anticon-close {\n font-size: 12px;\n}\n.ant-upload-list-item .anticon-close:hover {\n color: rgba(0, 0, 0, 0.65);\n}\n.ant-upload-list-item:hover .ant-upload-list-item-info {\n background-color: #e6f7ff;\n}\n.ant-upload-list-item:hover .anticon-close {\n opacity: 1;\n}\n.ant-upload-list-item:hover .ant-upload-list-item-card-actions {\n opacity: 1;\n}\n.ant-upload-list-item-error,\n.ant-upload-list-item-error .anticon-paper-clip,\n.ant-upload-list-item-error .ant-upload-list-item-name {\n color: #f5222d;\n}\n.ant-upload-list-item-error .ant-upload-list-item-card-actions {\n opacity: 1;\n}\n.ant-upload-list-item-error .ant-upload-list-item-card-actions .anticon {\n color: #f5222d;\n}\n.ant-upload-list-item-progress {\n position: absolute;\n bottom: -12px;\n width: 100%;\n padding-left: 26px;\n font-size: 14px;\n line-height: 0;\n}\n.ant-upload-list-picture .ant-upload-list-item,\n.ant-upload-list-picture-card .ant-upload-list-item {\n position: relative;\n height: 66px;\n padding: 8px;\n border: 1px solid #d9d9d9;\n border-radius: 4px;\n}\n.ant-upload-list-picture .ant-upload-list-item:hover,\n.ant-upload-list-picture-card .ant-upload-list-item:hover {\n background: transparent;\n}\n.ant-upload-list-picture .ant-upload-list-item-error,\n.ant-upload-list-picture-card .ant-upload-list-item-error {\n border-color: #f5222d;\n}\n.ant-upload-list-picture .ant-upload-list-item-info,\n.ant-upload-list-picture-card .ant-upload-list-item-info {\n padding: 0;\n}\n.ant-upload-list-picture .ant-upload-list-item:hover .ant-upload-list-item-info,\n.ant-upload-list-picture-card .ant-upload-list-item:hover .ant-upload-list-item-info {\n background: transparent;\n}\n.ant-upload-list-picture .ant-upload-list-item-uploading,\n.ant-upload-list-picture-card .ant-upload-list-item-uploading {\n border-style: dashed;\n}\n.ant-upload-list-picture .ant-upload-list-item-thumbnail,\n.ant-upload-list-picture-card .ant-upload-list-item-thumbnail {\n position: absolute;\n top: 8px;\n left: 8px;\n width: 48px;\n height: 48px;\n font-size: 26px;\n line-height: 54px;\n text-align: center;\n opacity: 0.8;\n}\n.ant-upload-list-picture .ant-upload-list-item-icon,\n.ant-upload-list-picture-card .ant-upload-list-item-icon {\n position: absolute;\n top: 50%;\n left: 50%;\n font-size: 26px;\n transform: translate(-50%, -50%);\n}\n.ant-upload-list-picture .ant-upload-list-item-image,\n.ant-upload-list-picture-card .ant-upload-list-item-image {\n max-width: 100%;\n}\n.ant-upload-list-picture .ant-upload-list-item-thumbnail img,\n.ant-upload-list-picture-card .ant-upload-list-item-thumbnail img {\n display: block;\n width: 48px;\n height: 48px;\n overflow: hidden;\n}\n.ant-upload-list-picture .ant-upload-list-item-name,\n.ant-upload-list-picture-card .ant-upload-list-item-name {\n display: inline-block;\n box-sizing: border-box;\n max-width: 100%;\n margin: 0 0 0 8px;\n padding-right: 8px;\n padding-left: 48px;\n overflow: hidden;\n line-height: 44px;\n white-space: nowrap;\n text-overflow: ellipsis;\n transition: all 0.3s;\n}\n.ant-upload-list-picture .ant-upload-list-item-name-icon-count-1,\n.ant-upload-list-picture-card .ant-upload-list-item-name-icon-count-1 {\n padding-right: 18px;\n}\n.ant-upload-list-picture .ant-upload-list-item-name-icon-count-2,\n.ant-upload-list-picture-card .ant-upload-list-item-name-icon-count-2 {\n padding-right: 36px;\n}\n.ant-upload-list-picture .ant-upload-list-item-uploading .ant-upload-list-item-name,\n.ant-upload-list-picture-card .ant-upload-list-item-uploading .ant-upload-list-item-name {\n line-height: 28px;\n}\n.ant-upload-list-picture .ant-upload-list-item-progress,\n.ant-upload-list-picture-card .ant-upload-list-item-progress {\n bottom: 14px;\n width: calc(100% - 24px);\n margin-top: 0;\n padding-left: 56px;\n}\n.ant-upload-list-picture .anticon-close,\n.ant-upload-list-picture-card .anticon-close {\n position: absolute;\n top: 8px;\n right: 8px;\n line-height: 1;\n opacity: 1;\n}\n.ant-upload-list-picture-card.ant-upload-list::after {\n display: none;\n}\n.ant-upload-list-picture-card-container {\n float: left;\n width: 104px;\n height: 104px;\n margin: 0 8px 8px 0;\n}\n.ant-upload-list-picture-card .ant-upload-list-item {\n float: left;\n width: 104px;\n height: 104px;\n margin: 0 8px 8px 0;\n}\n.ant-upload-list-picture-card .ant-upload-list-item-info {\n position: relative;\n height: 100%;\n overflow: hidden;\n}\n.ant-upload-list-picture-card .ant-upload-list-item-info::before {\n position: absolute;\n z-index: 1;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n opacity: 0;\n transition: all 0.3s;\n content: ' ';\n}\n.ant-upload-list-picture-card .ant-upload-list-item:hover .ant-upload-list-item-info::before {\n opacity: 1;\n}\n.ant-upload-list-picture-card .ant-upload-list-item-actions {\n position: absolute;\n top: 50%;\n left: 50%;\n z-index: 10;\n white-space: nowrap;\n transform: translate(-50%, -50%);\n opacity: 0;\n transition: all 0.3s;\n}\n.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-eye-o,\n.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-download,\n.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-delete {\n z-index: 10;\n width: 16px;\n margin: 0 4px;\n color: rgba(255, 255, 255, 0.85);\n font-size: 16px;\n cursor: pointer;\n transition: all 0.3s;\n}\n.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-eye-o:hover,\n.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-download:hover,\n.ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-delete:hover {\n color: #fff;\n}\n.ant-upload-list-picture-card .ant-upload-list-item-info:hover + .ant-upload-list-item-actions,\n.ant-upload-list-picture-card .ant-upload-list-item-actions:hover {\n opacity: 1;\n}\n.ant-upload-list-picture-card .ant-upload-list-item-thumbnail,\n.ant-upload-list-picture-card .ant-upload-list-item-thumbnail img {\n position: static;\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n.ant-upload-list-picture-card .ant-upload-list-item-name {\n display: none;\n margin: 8px 0 0;\n padding: 0;\n line-height: 1.5;\n text-align: center;\n}\n.ant-upload-list-picture-card .anticon-picture + .ant-upload-list-item-name {\n position: absolute;\n bottom: 10px;\n display: block;\n}\n.ant-upload-list-picture-card .ant-upload-list-item-uploading.ant-upload-list-item {\n background-color: #fafafa;\n}\n.ant-upload-list-picture-card .ant-upload-list-item-uploading .ant-upload-list-item-info {\n height: auto;\n}\n.ant-upload-list-picture-card .ant-upload-list-item-uploading .ant-upload-list-item-info::before,\n.ant-upload-list-picture-card .ant-upload-list-item-uploading .ant-upload-list-item-info .anticon-eye-o,\n.ant-upload-list-picture-card .ant-upload-list-item-uploading .ant-upload-list-item-info .anticon-delete {\n display: none;\n}\n.ant-upload-list-picture-card .ant-upload-list-item-uploading-text {\n margin-top: 18px;\n color: rgba(0, 0, 0, 0.45);\n}\n.ant-upload-list-picture-card .ant-upload-list-item-progress {\n bottom: 32px;\n padding-left: 0;\n}\n.ant-upload-list .ant-upload-success-icon {\n color: #52c41a;\n font-weight: bold;\n}\n.ant-upload-list .ant-upload-animate-enter,\n.ant-upload-list .ant-upload-animate-leave,\n.ant-upload-list .ant-upload-animate-inline-enter,\n.ant-upload-list .ant-upload-animate-inline-leave {\n animation-duration: 0.3s;\n animation-fill-mode: cubic-bezier(0.78, 0.14, 0.15, 0.86);\n}\n.ant-upload-list .ant-upload-animate-enter {\n animation-name: uploadAnimateIn;\n}\n.ant-upload-list .ant-upload-animate-leave {\n animation-name: uploadAnimateOut;\n}\n.ant-upload-list .ant-upload-animate-inline-enter {\n animation-name: uploadAnimateInlineIn;\n}\n.ant-upload-list .ant-upload-animate-inline-leave {\n animation-name: uploadAnimateInlineOut;\n}\n@keyframes uploadAnimateIn {\n from {\n height: 0;\n margin: 0;\n padding: 0;\n opacity: 0;\n }\n}\n@keyframes uploadAnimateOut {\n to {\n height: 0;\n margin: 0;\n padding: 0;\n opacity: 0;\n }\n}\n@keyframes uploadAnimateInlineIn {\n from {\n width: 0;\n height: 0;\n margin: 0;\n padding: 0;\n opacity: 0;\n }\n}\n@keyframes uploadAnimateInlineOut {\n to {\n width: 0;\n height: 0;\n margin: 0;\n padding: 0;\n opacity: 0;\n }\n}\n/*# sourceMappingURL=index.css.map */";
22
+ n(css,{"prepend":true});
23
+
24
+ function getError(option, xhr) {
25
+ var msg = 'cannot ' + option.method + ' ' + option.action + ' ' + xhr.status + '\'';
26
+ var err = new Error(msg);
27
+ err.status = xhr.status;
28
+ err.method = option.method;
29
+ err.url = option.action;
30
+ return err;
31
+ }
32
+
33
+ function getBody(xhr) {
34
+ var text = xhr.responseText || xhr.response;
35
+ if (!text) {
36
+ return text;
37
+ }
38
+
39
+ try {
40
+ return JSON.parse(text);
41
+ } catch (e) {
42
+ return text;
43
+ }
44
+ }
45
+
46
+ // option {
47
+ // onProgress: (event: { percent: number }): void,
48
+ // onError: (event: Error, body?: Object): void,
49
+ // onSuccess: (body: Object): void,
50
+ // data: Object,
51
+ // filename: String,
52
+ // file: File,
53
+ // withCredentials: Boolean,
54
+ // action: String,
55
+ // headers: Object,
56
+ // }
57
+ function upload(option) {
58
+ var xhr = new XMLHttpRequest();
59
+
60
+ if (option.onProgress && xhr.upload) {
61
+ xhr.upload.onprogress = function progress(e) {
62
+ if (e.total > 0) {
63
+ e.percent = e.loaded / e.total * 100;
64
+ }
65
+ option.onProgress(e);
66
+ };
67
+ }
68
+
69
+ var formData = new FormData();
70
+
71
+ if (option.data) {
72
+ Object.keys(option.data).forEach(function (key) {
73
+ var value = option.data[key];
74
+ // support key-value array data
75
+ if (Array.isArray(value)) {
76
+ value.forEach(function (item) {
77
+ // { list: [ 11, 22 ] }
78
+ // formData.append('list[]', 11);
79
+ formData.append(key + '[]', item);
80
+ });
81
+ return;
82
+ }
83
+
84
+ formData.append(key, option.data[key]);
85
+ });
86
+ }
87
+
88
+ formData.append(option.filename, option.file);
89
+
90
+ xhr.onerror = function error(e) {
91
+ option.onError(e);
92
+ };
93
+
94
+ xhr.onload = function onload() {
95
+ // allow success when 2xx status
96
+ // see https://github.com/react-component/upload/issues/34
97
+ if (xhr.status < 200 || xhr.status >= 300) {
98
+ return option.onError(getError(option, xhr), getBody(xhr));
99
+ }
100
+
101
+ option.onSuccess(getBody(xhr), xhr);
102
+ };
103
+
104
+ xhr.open(option.method, option.action, true);
105
+
106
+ // Has to be after `.open()`. See https://github.com/enyo/dropzone/issues/179
107
+ if (option.withCredentials && 'withCredentials' in xhr) {
108
+ xhr.withCredentials = true;
109
+ }
110
+
111
+ var headers = option.headers || {};
112
+
113
+ // when set headers['X-Requested-With'] = null , can close default XHR header
114
+ // see https://github.com/react-component/upload/issues/33
115
+ if (headers['X-Requested-With'] !== null) {
116
+ xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
117
+ }
118
+
119
+ for (var h in headers) {
120
+ if (headers.hasOwnProperty(h) && headers[h] !== null) {
121
+ xhr.setRequestHeader(h, headers[h]);
122
+ }
123
+ }
124
+ xhr.send(formData);
125
+
126
+ return {
127
+ abort: function abort() {
128
+ xhr.abort();
129
+ }
130
+ };
131
+ }
132
+
133
+ var now = +new Date();
134
+ var index = 0;
135
+
136
+ function uid() {
137
+ return "rc-upload-" + now + "-" + ++index;
138
+ }
139
+
140
+ function endsWith(str, suffix) {
141
+ return str.indexOf(suffix, str.length - suffix.length) !== -1;
142
+ }
143
+
144
+ var attrAccept = (function (file, acceptedFiles) {
145
+ if (file && acceptedFiles) {
146
+ var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');
147
+ var fileName = file.name || '';
148
+ var mimeType = file.type || '';
149
+ var baseMimeType = mimeType.replace(/\/.*$/, '');
150
+
151
+ return acceptedFilesArray.some(function (type) {
152
+ var validType = type.trim();
153
+ if (validType.charAt(0) === '.') {
154
+ return endsWith(fileName.toLowerCase(), validType.toLowerCase());
155
+ } else if (/\/\*$/.test(validType)) {
156
+ // This is something like a image/* mime type
157
+ return baseMimeType === validType.replace(/\/.*$/, '');
158
+ }
159
+ return mimeType === validType;
160
+ });
161
+ }
162
+ return true;
163
+ });
164
+
165
+ function loopFiles(item, callback) {
166
+ var dirReader = item.createReader();
167
+ var fileList = [];
168
+
169
+ function sequence() {
170
+ dirReader.readEntries(function (entries) {
171
+ var entryList = Array.prototype.slice.apply(entries);
172
+ fileList = fileList.concat(entryList);
173
+
174
+ // Check if all the file has been viewed
175
+ var isFinished = !entryList.length;
176
+
177
+ if (isFinished) {
178
+ callback(fileList);
179
+ } else {
180
+ sequence();
181
+ }
182
+ });
183
+ }
184
+
185
+ sequence();
186
+ }
187
+
188
+ var traverseFileTree = function traverseFileTree(files, callback, isAccepted) {
189
+ var _traverseFileTree = function _traverseFileTree(item, path) {
190
+ if (item.isFile) {
191
+ item.file(function (file) {
192
+ if (isAccepted(file)) {
193
+ // https://github.com/ant-design/ant-design/issues/16426
194
+ if (item.fullPath && !file.webkitRelativePath) {
195
+ Object.defineProperties(file, {
196
+ webkitRelativePath: {
197
+ writable: true
198
+ }
199
+ });
200
+ file.webkitRelativePath = item.fullPath.replace(/^\//, '');
201
+ Object.defineProperties(file, {
202
+ webkitRelativePath: {
203
+ writable: false
204
+ }
205
+ });
206
+ }
207
+ callback([file]);
208
+ }
209
+ });
210
+ } else if (item.isDirectory) {
211
+ loopFiles(item, function (entries) {
212
+ entries.forEach(function (entryItem) {
213
+ _traverseFileTree(entryItem);
214
+ });
215
+ });
216
+ }
217
+ };
218
+ var _iteratorNormalCompletion = true;
219
+ var _didIteratorError = false;
220
+ var _iteratorError = undefined;
221
+
222
+ try {
223
+ for (var _iterator = files[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
224
+ var file = _step.value;
225
+
226
+ _traverseFileTree(file.webkitGetAsEntry());
227
+ }
228
+ } catch (err) {
229
+ _didIteratorError = true;
230
+ _iteratorError = err;
231
+ } finally {
232
+ try {
233
+ if (!_iteratorNormalCompletion && _iterator['return']) {
234
+ _iterator['return']();
235
+ }
236
+ } finally {
237
+ if (_didIteratorError) {
238
+ throw _iteratorError;
239
+ }
240
+ }
241
+ }
242
+ };
243
+
244
+ var AjaxUploader = function (_Component) {
245
+ _inherits$3(AjaxUploader, _Component);
246
+
247
+ function AjaxUploader() {
248
+ var _ref;
249
+
250
+ var _temp, _this, _ret;
251
+
252
+ _classCallCheck$3(this, AjaxUploader);
253
+
254
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
255
+ args[_key] = arguments[_key];
256
+ }
257
+
258
+ return _ret = (_temp = (_this = _possibleConstructorReturn$3(this, (_ref = AjaxUploader.__proto__ || Object.getPrototypeOf(AjaxUploader)).call.apply(_ref, [this].concat(args))), _this), _this.state = { uid: uid() }, _this.reqs = {}, _this.onChange = function (e) {
259
+ var files = e.target.files;
260
+ _this.uploadFiles(files);
261
+ _this.reset();
262
+ }, _this.onClick = function () {
263
+ var el = _this.fileInput;
264
+ if (!el) {
265
+ return;
266
+ }
267
+ el.click();
268
+ }, _this.onKeyDown = function (e) {
269
+ if (e.key === 'Enter') {
270
+ _this.onClick();
271
+ }
272
+ }, _this.onFileDrop = function (e) {
273
+ var multiple = _this.props.multiple;
274
+
275
+
276
+ e.preventDefault();
277
+
278
+ if (e.type === 'dragover') {
279
+ return;
280
+ }
281
+
282
+ if (_this.props.directory) {
283
+ traverseFileTree(e.dataTransfer.items, _this.uploadFiles, function (_file) {
284
+ return attrAccept(_file, _this.props.accept);
285
+ });
286
+ } else {
287
+ var files = Array.prototype.slice.call(e.dataTransfer.files).filter(function (file) {
288
+ return attrAccept(file, _this.props.accept);
289
+ });
290
+
291
+ if (multiple === false) {
292
+ files = files.slice(0, 1);
293
+ }
294
+
295
+ _this.uploadFiles(files);
296
+ }
297
+ }, _this.uploadFiles = function (files) {
298
+ var postFiles = Array.prototype.slice.call(files);
299
+ postFiles.map(function (file) {
300
+ file.uid = uid();
301
+ return file;
302
+ }).forEach(function (file) {
303
+ _this.upload(file, postFiles);
304
+ });
305
+ }, _this.saveFileInput = function (node) {
306
+ _this.fileInput = node;
307
+ }, _temp), _possibleConstructorReturn$3(_this, _ret);
308
+ }
309
+
310
+ _createClass$3(AjaxUploader, [{
311
+ key: 'componentDidMount',
312
+ value: function componentDidMount() {
313
+ this._isMounted = true;
314
+ }
315
+ }, {
316
+ key: 'componentWillUnmount',
317
+ value: function componentWillUnmount() {
318
+ this._isMounted = false;
319
+ this.abort();
320
+ }
321
+ }, {
322
+ key: 'upload',
323
+ value: function upload(file, fileList) {
324
+ var _this2 = this;
325
+
326
+ var props = this.props;
327
+
328
+ if (!props.beforeUpload) {
329
+ // always async in case use react state to keep fileList
330
+ return setTimeout(function () {
331
+ return _this2.post(file);
332
+ }, 0);
333
+ }
334
+
335
+ var before = props.beforeUpload(file, fileList);
336
+ if (before && before.then) {
337
+ before.then(function (processedFile) {
338
+ var processedFileType = Object.prototype.toString.call(processedFile);
339
+ if (processedFileType === '[object File]' || processedFileType === '[object Blob]') {
340
+ return _this2.post(processedFile);
341
+ }
342
+ return _this2.post(file);
343
+ })['catch'](function (e) {
344
+ console && console.log(e); // eslint-disable-line
345
+ });
346
+ } else if (before !== false) {
347
+ setTimeout(function () {
348
+ return _this2.post(file);
349
+ }, 0);
350
+ }
351
+ }
352
+ }, {
353
+ key: 'post',
354
+ value: function post(file) {
355
+ var _this3 = this;
356
+
357
+ if (!this._isMounted) {
358
+ return;
359
+ }
360
+ var props = this.props;
361
+ var data = props.data;
362
+ var onStart = props.onStart,
363
+ onProgress = props.onProgress,
364
+ _props$transformFile = props.transformFile,
365
+ transformFile = _props$transformFile === undefined ? function (originFile) {
366
+ return originFile;
367
+ } : _props$transformFile;
368
+
369
+
370
+ new Promise(function (resolve) {
371
+ var action = props.action;
372
+
373
+ if (typeof action === 'function') {
374
+ return resolve(action(file));
375
+ }
376
+ resolve(action);
377
+ }).then(function (action) {
378
+ var uid = file.uid;
379
+
380
+ var request = props.customRequest || upload;
381
+ var transform = Promise.resolve(transformFile(file))['catch'](function (e) {
382
+ console.error(e); // eslint-disable-line no-console
383
+ });
384
+
385
+ transform.then(function (transformedFile) {
386
+ if (typeof data === 'function') {
387
+ data = data(file);
388
+ }
389
+
390
+ var requestOption = {
391
+ action: action,
392
+ filename: props.name,
393
+ data: data,
394
+ file: transformedFile,
395
+ headers: props.headers,
396
+ withCredentials: props.withCredentials,
397
+ method: props.method || 'post',
398
+ onProgress: onProgress ? function (e) {
399
+ onProgress(e, file);
400
+ } : null,
401
+ onSuccess: function onSuccess(ret, xhr) {
402
+ delete _this3.reqs[uid];
403
+ props.onSuccess(ret, file, xhr);
404
+ },
405
+ onError: function onError(err, ret) {
406
+ delete _this3.reqs[uid];
407
+ props.onError(err, ret, file);
408
+ }
409
+ };
410
+ _this3.reqs[uid] = request(requestOption);
411
+ onStart(file);
412
+ });
413
+ });
414
+ }
415
+ }, {
416
+ key: 'reset',
417
+ value: function reset() {
418
+ this.setState({
419
+ uid: uid()
420
+ });
421
+ }
422
+ }, {
423
+ key: 'abort',
424
+ value: function abort(file) {
425
+ var reqs = this.reqs;
426
+
427
+ if (file) {
428
+ var uid = file;
429
+ if (file && file.uid) {
430
+ uid = file.uid;
431
+ }
432
+ if (reqs[uid] && reqs[uid].abort) {
433
+ reqs[uid].abort();
434
+ }
435
+ delete reqs[uid];
436
+ } else {
437
+ Object.keys(reqs).forEach(function (uid) {
438
+ if (reqs[uid] && reqs[uid].abort) {
439
+ reqs[uid].abort();
440
+ }
441
+ delete reqs[uid];
442
+ });
443
+ }
444
+ }
445
+ }, {
446
+ key: 'render',
447
+ value: function render() {
448
+ var _classNames;
449
+
450
+ var _props = this.props,
451
+ Tag = _props.component,
452
+ prefixCls = _props.prefixCls,
453
+ className = _props.className,
454
+ disabled = _props.disabled,
455
+ id = _props.id,
456
+ style = _props.style,
457
+ multiple = _props.multiple,
458
+ accept = _props.accept,
459
+ children = _props.children,
460
+ directory = _props.directory,
461
+ openFileDialogOnClick = _props.openFileDialogOnClick;
462
+
463
+ var cls = classNames((_classNames = {}, _defineProperty$2(_classNames, prefixCls, true), _defineProperty$2(_classNames, prefixCls + '-disabled', disabled), _defineProperty$2(_classNames, className, className), _classNames));
464
+ var events = disabled ? {} : {
465
+ onClick: openFileDialogOnClick ? this.onClick : function () {},
466
+ onKeyDown: openFileDialogOnClick ? this.onKeyDown : function () {},
467
+ onDrop: this.onFileDrop,
468
+ onDragOver: this.onFileDrop,
469
+ tabIndex: '0'
470
+ };
471
+ return React__default.createElement(
472
+ Tag,
473
+ _extends$4({}, events, {
474
+ className: cls,
475
+ role: 'button',
476
+ style: style
477
+ }),
478
+ React__default.createElement('input', {
479
+ id: id,
480
+ type: 'file',
481
+ ref: this.saveFileInput,
482
+ onClick: function onClick(e) {
483
+ return e.stopPropagation();
484
+ } // https://github.com/ant-design/ant-design/issues/19948
485
+ , key: this.state.uid,
486
+ style: { display: 'none' },
487
+ accept: accept,
488
+ directory: directory ? 'directory' : null,
489
+ webkitdirectory: directory ? 'webkitdirectory' : null,
490
+ multiple: multiple,
491
+ onChange: this.onChange
492
+ }),
493
+ children
494
+ );
495
+ }
496
+ }]);
497
+
498
+ return AjaxUploader;
499
+ }(Component);
500
+
501
+ AjaxUploader.propTypes = {
502
+ id: PropTypes.string,
503
+ component: PropTypes.string,
504
+ style: PropTypes.object,
505
+ prefixCls: PropTypes.string,
506
+ className: PropTypes.string,
507
+ multiple: PropTypes.bool,
508
+ directory: PropTypes.bool,
509
+ disabled: PropTypes.bool,
510
+ accept: PropTypes.string,
511
+ children: PropTypes.any,
512
+ onStart: PropTypes.func,
513
+ data: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
514
+ action: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
515
+ headers: PropTypes.object,
516
+ beforeUpload: PropTypes.func,
517
+ customRequest: PropTypes.func,
518
+ onProgress: PropTypes.func,
519
+ withCredentials: PropTypes.bool,
520
+ openFileDialogOnClick: PropTypes.bool,
521
+ transformFile: PropTypes.func
522
+ };
523
+
524
+ var IFRAME_STYLE = {
525
+ position: 'absolute',
526
+ top: 0,
527
+ opacity: 0,
528
+ filter: 'alpha(opacity=0)',
529
+ left: 0,
530
+ zIndex: 9999
531
+ };
532
+
533
+ // diferent from AjaxUpload, can only upload on at one time, serial seriously
534
+
535
+ var IframeUploader = function (_Component) {
536
+ _inherits$3(IframeUploader, _Component);
537
+
538
+ function IframeUploader() {
539
+ var _ref;
540
+
541
+ var _temp, _this, _ret;
542
+
543
+ _classCallCheck$3(this, IframeUploader);
544
+
545
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
546
+ args[_key] = arguments[_key];
547
+ }
548
+
549
+ return _ret = (_temp = (_this = _possibleConstructorReturn$3(this, (_ref = IframeUploader.__proto__ || Object.getPrototypeOf(IframeUploader)).call.apply(_ref, [this].concat(args))), _this), _this.state = { uploading: false }, _this.file = {}, _this.onLoad = function () {
550
+ if (!_this.state.uploading) {
551
+ return;
552
+ }
553
+ var _this2 = _this,
554
+ props = _this2.props,
555
+ file = _this2.file;
556
+
557
+ var response = void 0;
558
+ try {
559
+ var doc = _this.getIframeDocument();
560
+ var script = doc.getElementsByTagName('script')[0];
561
+ if (script && script.parentNode === doc.body) {
562
+ doc.body.removeChild(script);
563
+ }
564
+ response = doc.body.innerHTML;
565
+ props.onSuccess(response, file);
566
+ } catch (err) {
567
+ warning(false, 'cross domain error for Upload. Maybe server should return document.domain script. see Note from https://github.com/react-component/upload');
568
+ response = 'cross-domain';
569
+ props.onError(err, null, file);
570
+ }
571
+ _this.endUpload();
572
+ }, _this.onChange = function () {
573
+ var target = _this.getFormInputNode();
574
+ // ie8/9 don't support FileList Object
575
+ // http://stackoverflow.com/questions/12830058/ie8-input-type-file-get-files
576
+ var file = _this.file = {
577
+ uid: uid(),
578
+ name: target.value && target.value.substring(target.value.lastIndexOf('\\') + 1, target.value.length)
579
+ };
580
+ _this.startUpload();
581
+ var _this3 = _this,
582
+ props = _this3.props;
583
+
584
+ if (!props.beforeUpload) {
585
+ return _this.post(file);
586
+ }
587
+ var before = props.beforeUpload(file);
588
+ if (before && before.then) {
589
+ before.then(function () {
590
+ _this.post(file);
591
+ }, function () {
592
+ _this.endUpload();
593
+ });
594
+ } else if (before !== false) {
595
+ _this.post(file);
596
+ } else {
597
+ _this.endUpload();
598
+ }
599
+ }, _this.saveIframe = function (node) {
600
+ _this.iframe = node;
601
+ }, _temp), _possibleConstructorReturn$3(_this, _ret);
602
+ }
603
+
604
+ _createClass$3(IframeUploader, [{
605
+ key: 'componentDidMount',
606
+ value: function componentDidMount() {
607
+ this.updateIframeWH();
608
+ this.initIframe();
609
+ }
610
+ }, {
611
+ key: 'componentDidUpdate',
612
+ value: function componentDidUpdate() {
613
+ this.updateIframeWH();
614
+ }
615
+ }, {
616
+ key: 'getIframeNode',
617
+ value: function getIframeNode() {
618
+ return this.iframe;
619
+ }
620
+ }, {
621
+ key: 'getIframeDocument',
622
+ value: function getIframeDocument() {
623
+ return this.getIframeNode().contentDocument;
624
+ }
625
+ }, {
626
+ key: 'getFormNode',
627
+ value: function getFormNode() {
628
+ return this.getIframeDocument().getElementById('form');
629
+ }
630
+ }, {
631
+ key: 'getFormInputNode',
632
+ value: function getFormInputNode() {
633
+ return this.getIframeDocument().getElementById('input');
634
+ }
635
+ }, {
636
+ key: 'getFormDataNode',
637
+ value: function getFormDataNode() {
638
+ return this.getIframeDocument().getElementById('data');
639
+ }
640
+ }, {
641
+ key: 'getFileForMultiple',
642
+ value: function getFileForMultiple(file) {
643
+ return this.props.multiple ? [file] : file;
644
+ }
645
+ }, {
646
+ key: 'getIframeHTML',
647
+ value: function getIframeHTML(domain) {
648
+ var domainScript = '';
649
+ var domainInput = '';
650
+ if (domain) {
651
+ var script = 'script';
652
+ domainScript = '<' + script + '>document.domain="' + domain + '";</' + script + '>';
653
+ domainInput = '<input name="_documentDomain" value="' + domain + '" />';
654
+ }
655
+ return '\n <!DOCTYPE html>\n <html>\n <head>\n <meta http-equiv="X-UA-Compatible" content="IE=edge" />\n <style>\n body,html {padding:0;margin:0;border:0;overflow:hidden;}\n </style>\n ' + domainScript + '\n </head>\n <body>\n <form method="post"\n encType="multipart/form-data"\n action="" id="form"\n style="display:block;height:9999px;position:relative;overflow:hidden;">\n <input id="input" type="file"\n name="' + this.props.name + '"\n style="position:absolute;top:0;right:0;height:9999px;font-size:9999px;cursor:pointer;"/>\n ' + domainInput + '\n <span id="data"></span>\n </form>\n </body>\n </html>\n ';
656
+ }
657
+ }, {
658
+ key: 'initIframeSrc',
659
+ value: function initIframeSrc() {
660
+ if (this.domain) {
661
+ this.getIframeNode().src = 'javascript:void((function(){\n var d = document;\n d.open();\n d.domain=\'' + this.domain + '\';\n d.write(\'\');\n d.close();\n })())';
662
+ }
663
+ }
664
+ }, {
665
+ key: 'initIframe',
666
+ value: function initIframe() {
667
+ var iframeNode = this.getIframeNode();
668
+ var win = iframeNode.contentWindow;
669
+ var doc = void 0;
670
+ this.domain = this.domain || '';
671
+ this.initIframeSrc();
672
+ try {
673
+ doc = win.document;
674
+ } catch (e) {
675
+ this.domain = document.domain;
676
+ this.initIframeSrc();
677
+ win = iframeNode.contentWindow;
678
+ doc = win.document;
679
+ }
680
+ doc.open('text/html', 'replace');
681
+ doc.write(this.getIframeHTML(this.domain));
682
+ doc.close();
683
+ this.getFormInputNode().onchange = this.onChange;
684
+ }
685
+ }, {
686
+ key: 'endUpload',
687
+ value: function endUpload() {
688
+ if (this.state.uploading) {
689
+ this.file = {};
690
+ // hack avoid batch
691
+ this.state.uploading = false;
692
+ this.setState({
693
+ uploading: false
694
+ });
695
+ this.initIframe();
696
+ }
697
+ }
698
+ }, {
699
+ key: 'startUpload',
700
+ value: function startUpload() {
701
+ if (!this.state.uploading) {
702
+ this.state.uploading = true;
703
+ this.setState({
704
+ uploading: true
705
+ });
706
+ }
707
+ }
708
+ }, {
709
+ key: 'updateIframeWH',
710
+ value: function updateIframeWH() {
711
+ var rootNode = ReactDOM__default.findDOMNode(this);
712
+ var iframeNode = this.getIframeNode();
713
+ iframeNode.style.height = rootNode.offsetHeight + 'px';
714
+ iframeNode.style.width = rootNode.offsetWidth + 'px';
715
+ }
716
+ }, {
717
+ key: 'abort',
718
+ value: function abort(file) {
719
+ if (file) {
720
+ var uid = file;
721
+ if (file && file.uid) {
722
+ uid = file.uid;
723
+ }
724
+ if (uid === this.file.uid) {
725
+ this.endUpload();
726
+ }
727
+ } else {
728
+ this.endUpload();
729
+ }
730
+ }
731
+ }, {
732
+ key: 'post',
733
+ value: function post(file) {
734
+ var _this4 = this;
735
+
736
+ var formNode = this.getFormNode();
737
+ var dataSpan = this.getFormDataNode();
738
+ var data = this.props.data;
739
+ var onStart = this.props.onStart;
740
+
741
+ if (typeof data === 'function') {
742
+ data = data(file);
743
+ }
744
+ var inputs = document.createDocumentFragment();
745
+ for (var key in data) {
746
+ if (data.hasOwnProperty(key)) {
747
+ var input = document.createElement('input');
748
+ input.setAttribute('name', key);
749
+ input.value = data[key];
750
+ inputs.appendChild(input);
751
+ }
752
+ }
753
+ dataSpan.appendChild(inputs);
754
+ new Promise(function (resolve) {
755
+ var action = _this4.props.action;
756
+
757
+ if (typeof action === 'function') {
758
+ return resolve(action(file));
759
+ }
760
+ resolve(action);
761
+ }).then(function (action) {
762
+ formNode.setAttribute('action', action);
763
+ formNode.submit();
764
+ dataSpan.innerHTML = '';
765
+ onStart(file);
766
+ });
767
+ }
768
+ }, {
769
+ key: 'render',
770
+ value: function render() {
771
+ var _classNames;
772
+
773
+ var _props = this.props,
774
+ Tag = _props.component,
775
+ disabled = _props.disabled,
776
+ className = _props.className,
777
+ prefixCls = _props.prefixCls,
778
+ children = _props.children,
779
+ style = _props.style;
780
+
781
+ var iframeStyle = _extends$4({}, IFRAME_STYLE, {
782
+ display: this.state.uploading || disabled ? 'none' : ''
783
+ });
784
+ var cls = classNames((_classNames = {}, _defineProperty$2(_classNames, prefixCls, true), _defineProperty$2(_classNames, prefixCls + '-disabled', disabled), _defineProperty$2(_classNames, className, className), _classNames));
785
+ return React__default.createElement(
786
+ Tag,
787
+ {
788
+ className: cls,
789
+ style: _extends$4({ position: 'relative', zIndex: 0 }, style)
790
+ },
791
+ React__default.createElement('iframe', {
792
+ ref: this.saveIframe,
793
+ onLoad: this.onLoad,
794
+ style: iframeStyle
795
+ }),
796
+ children
797
+ );
798
+ }
799
+ }]);
800
+
801
+ return IframeUploader;
802
+ }(Component);
803
+
804
+ IframeUploader.propTypes = {
805
+ component: PropTypes.string,
806
+ style: PropTypes.object,
807
+ disabled: PropTypes.bool,
808
+ prefixCls: PropTypes.string,
809
+ className: PropTypes.string,
810
+ accept: PropTypes.string,
811
+ onStart: PropTypes.func,
812
+ multiple: PropTypes.bool,
813
+ children: PropTypes.any,
814
+ data: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
815
+ action: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
816
+ name: PropTypes.string
817
+ };
818
+
819
+ function empty() {}
820
+
821
+ var Upload$1 = function (_Component) {
822
+ _inherits$3(Upload, _Component);
823
+
824
+ function Upload() {
825
+ var _ref;
826
+
827
+ var _temp, _this, _ret;
828
+
829
+ _classCallCheck$3(this, Upload);
830
+
831
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
832
+ args[_key] = arguments[_key];
833
+ }
834
+
835
+ return _ret = (_temp = (_this = _possibleConstructorReturn$3(this, (_ref = Upload.__proto__ || Object.getPrototypeOf(Upload)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
836
+ Component: null
837
+ }, _this.saveUploader = function (node) {
838
+ _this.uploader = node;
839
+ }, _temp), _possibleConstructorReturn$3(_this, _ret);
840
+ }
841
+
842
+ _createClass$3(Upload, [{
843
+ key: 'componentDidMount',
844
+ value: function componentDidMount() {
845
+ if (this.props.supportServerRender) {
846
+ /* eslint react/no-did-mount-set-state:0 */
847
+ this.setState({
848
+ Component: this.getComponent()
849
+ }, this.props.onReady);
850
+ }
851
+ }
852
+ }, {
853
+ key: 'getComponent',
854
+ value: function getComponent() {
855
+ return typeof File !== 'undefined' ? AjaxUploader : IframeUploader;
856
+ }
857
+ }, {
858
+ key: 'abort',
859
+ value: function abort(file) {
860
+ this.uploader.abort(file);
861
+ }
862
+ }, {
863
+ key: 'render',
864
+ value: function render() {
865
+ if (this.props.supportServerRender) {
866
+ var _ComponentUploader = this.state.Component;
867
+ if (_ComponentUploader) {
868
+ return React__default.createElement(_ComponentUploader, _extends$4({}, this.props, { ref: this.saveUploader }));
869
+ }
870
+ return null;
871
+ }
872
+ var ComponentUploader = this.getComponent();
873
+ return React__default.createElement(ComponentUploader, _extends$4({}, this.props, { ref: this.saveUploader }));
874
+ }
875
+ }]);
876
+
877
+ return Upload;
878
+ }(Component);
879
+
880
+ Upload$1.propTypes = {
881
+ component: PropTypes.string,
882
+ style: PropTypes.object,
883
+ prefixCls: PropTypes.string,
884
+ action: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
885
+ name: PropTypes.string,
886
+ multipart: PropTypes.bool,
887
+ directory: PropTypes.bool,
888
+ onError: PropTypes.func,
889
+ onSuccess: PropTypes.func,
890
+ onProgress: PropTypes.func,
891
+ onStart: PropTypes.func,
892
+ data: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
893
+ headers: PropTypes.object,
894
+ accept: PropTypes.string,
895
+ multiple: PropTypes.bool,
896
+ disabled: PropTypes.bool,
897
+ beforeUpload: PropTypes.func,
898
+ customRequest: PropTypes.func,
899
+ onReady: PropTypes.func,
900
+ withCredentials: PropTypes.bool,
901
+ supportServerRender: PropTypes.bool,
902
+ openFileDialogOnClick: PropTypes.bool
903
+ };
904
+ Upload$1.defaultProps = {
905
+ component: 'span',
906
+ prefixCls: 'rc-upload',
907
+ data: {},
908
+ headers: {},
909
+ name: 'file',
910
+ multipart: false,
911
+ onReady: empty,
912
+ onStart: empty,
913
+ onError: empty,
914
+ onSuccess: empty,
915
+ supportServerRender: false,
916
+ multiple: false,
917
+ beforeUpload: null,
918
+ customRequest: null,
919
+ withCredentials: false,
920
+ openFileDialogOnClick: true
921
+ };
922
+
923
+ /** Used to stand-in for `undefined` hash values. */
924
+
925
+ var _setCacheAdd;
926
+ var hasRequired_setCacheAdd;
927
+
928
+ function require_setCacheAdd () {
929
+ if (hasRequired_setCacheAdd) return _setCacheAdd;
930
+ hasRequired_setCacheAdd = 1;
931
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
932
+
933
+ /**
934
+ * Adds `value` to the array cache.
935
+ *
936
+ * @private
937
+ * @name add
938
+ * @memberOf SetCache
939
+ * @alias push
940
+ * @param {*} value The value to cache.
941
+ * @returns {Object} Returns the cache instance.
942
+ */
943
+ function setCacheAdd(value) {
944
+ this.__data__.set(value, HASH_UNDEFINED);
945
+ return this;
946
+ }
947
+
948
+ _setCacheAdd = setCacheAdd;
949
+ return _setCacheAdd;
950
+ }
951
+
952
+ /**
953
+ * Checks if `value` is in the array cache.
954
+ *
955
+ * @private
956
+ * @name has
957
+ * @memberOf SetCache
958
+ * @param {*} value The value to search for.
959
+ * @returns {boolean} Returns `true` if `value` is found, else `false`.
960
+ */
961
+
962
+ var _setCacheHas;
963
+ var hasRequired_setCacheHas;
964
+
965
+ function require_setCacheHas () {
966
+ if (hasRequired_setCacheHas) return _setCacheHas;
967
+ hasRequired_setCacheHas = 1;
968
+ function setCacheHas(value) {
969
+ return this.__data__.has(value);
970
+ }
971
+
972
+ _setCacheHas = setCacheHas;
973
+ return _setCacheHas;
974
+ }
975
+
976
+ var _SetCache;
977
+ var hasRequired_SetCache;
978
+
979
+ function require_SetCache () {
980
+ if (hasRequired_SetCache) return _SetCache;
981
+ hasRequired_SetCache = 1;
982
+ var MapCache = require_MapCache(),
983
+ setCacheAdd = require_setCacheAdd(),
984
+ setCacheHas = require_setCacheHas();
985
+
986
+ /**
987
+ *
988
+ * Creates an array cache object to store unique values.
989
+ *
990
+ * @private
991
+ * @constructor
992
+ * @param {Array} [values] The values to cache.
993
+ */
994
+ function SetCache(values) {
995
+ var index = -1,
996
+ length = values == null ? 0 : values.length;
997
+
998
+ this.__data__ = new MapCache;
999
+ while (++index < length) {
1000
+ this.add(values[index]);
1001
+ }
1002
+ }
1003
+
1004
+ // Add methods to `SetCache`.
1005
+ SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
1006
+ SetCache.prototype.has = setCacheHas;
1007
+
1008
+ _SetCache = SetCache;
1009
+ return _SetCache;
1010
+ }
1011
+
1012
+ /**
1013
+ * A specialized version of `_.some` for arrays without support for iteratee
1014
+ * shorthands.
1015
+ *
1016
+ * @private
1017
+ * @param {Array} [array] The array to iterate over.
1018
+ * @param {Function} predicate The function invoked per iteration.
1019
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
1020
+ * else `false`.
1021
+ */
1022
+
1023
+ var _arraySome;
1024
+ var hasRequired_arraySome;
1025
+
1026
+ function require_arraySome () {
1027
+ if (hasRequired_arraySome) return _arraySome;
1028
+ hasRequired_arraySome = 1;
1029
+ function arraySome(array, predicate) {
1030
+ var index = -1,
1031
+ length = array == null ? 0 : array.length;
1032
+
1033
+ while (++index < length) {
1034
+ if (predicate(array[index], index, array)) {
1035
+ return true;
1036
+ }
1037
+ }
1038
+ return false;
1039
+ }
1040
+
1041
+ _arraySome = arraySome;
1042
+ return _arraySome;
1043
+ }
1044
+
1045
+ /**
1046
+ * Checks if a `cache` value for `key` exists.
1047
+ *
1048
+ * @private
1049
+ * @param {Object} cache The cache to query.
1050
+ * @param {string} key The key of the entry to check.
1051
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1052
+ */
1053
+
1054
+ var _cacheHas;
1055
+ var hasRequired_cacheHas;
1056
+
1057
+ function require_cacheHas () {
1058
+ if (hasRequired_cacheHas) return _cacheHas;
1059
+ hasRequired_cacheHas = 1;
1060
+ function cacheHas(cache, key) {
1061
+ return cache.has(key);
1062
+ }
1063
+
1064
+ _cacheHas = cacheHas;
1065
+ return _cacheHas;
1066
+ }
1067
+
1068
+ var _equalArrays;
1069
+ var hasRequired_equalArrays;
1070
+
1071
+ function require_equalArrays () {
1072
+ if (hasRequired_equalArrays) return _equalArrays;
1073
+ hasRequired_equalArrays = 1;
1074
+ var SetCache = require_SetCache(),
1075
+ arraySome = require_arraySome(),
1076
+ cacheHas = require_cacheHas();
1077
+
1078
+ /** Used to compose bitmasks for value comparisons. */
1079
+ var COMPARE_PARTIAL_FLAG = 1,
1080
+ COMPARE_UNORDERED_FLAG = 2;
1081
+
1082
+ /**
1083
+ * A specialized version of `baseIsEqualDeep` for arrays with support for
1084
+ * partial deep comparisons.
1085
+ *
1086
+ * @private
1087
+ * @param {Array} array The array to compare.
1088
+ * @param {Array} other The other array to compare.
1089
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1090
+ * @param {Function} customizer The function to customize comparisons.
1091
+ * @param {Function} equalFunc The function to determine equivalents of values.
1092
+ * @param {Object} stack Tracks traversed `array` and `other` objects.
1093
+ * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
1094
+ */
1095
+ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
1096
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
1097
+ arrLength = array.length,
1098
+ othLength = other.length;
1099
+
1100
+ if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
1101
+ return false;
1102
+ }
1103
+ // Check that cyclic values are equal.
1104
+ var arrStacked = stack.get(array);
1105
+ var othStacked = stack.get(other);
1106
+ if (arrStacked && othStacked) {
1107
+ return arrStacked == other && othStacked == array;
1108
+ }
1109
+ var index = -1,
1110
+ result = true,
1111
+ seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
1112
+
1113
+ stack.set(array, other);
1114
+ stack.set(other, array);
1115
+
1116
+ // Ignore non-index properties.
1117
+ while (++index < arrLength) {
1118
+ var arrValue = array[index],
1119
+ othValue = other[index];
1120
+
1121
+ if (customizer) {
1122
+ var compared = isPartial
1123
+ ? customizer(othValue, arrValue, index, other, array, stack)
1124
+ : customizer(arrValue, othValue, index, array, other, stack);
1125
+ }
1126
+ if (compared !== undefined) {
1127
+ if (compared) {
1128
+ continue;
1129
+ }
1130
+ result = false;
1131
+ break;
1132
+ }
1133
+ // Recursively compare arrays (susceptible to call stack limits).
1134
+ if (seen) {
1135
+ if (!arraySome(other, function(othValue, othIndex) {
1136
+ if (!cacheHas(seen, othIndex) &&
1137
+ (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
1138
+ return seen.push(othIndex);
1139
+ }
1140
+ })) {
1141
+ result = false;
1142
+ break;
1143
+ }
1144
+ } else if (!(
1145
+ arrValue === othValue ||
1146
+ equalFunc(arrValue, othValue, bitmask, customizer, stack)
1147
+ )) {
1148
+ result = false;
1149
+ break;
1150
+ }
1151
+ }
1152
+ stack['delete'](array);
1153
+ stack['delete'](other);
1154
+ return result;
1155
+ }
1156
+
1157
+ _equalArrays = equalArrays;
1158
+ return _equalArrays;
1159
+ }
1160
+
1161
+ var _equalByTag;
1162
+ var hasRequired_equalByTag;
1163
+
1164
+ function require_equalByTag () {
1165
+ if (hasRequired_equalByTag) return _equalByTag;
1166
+ hasRequired_equalByTag = 1;
1167
+ var Symbol = require_Symbol(),
1168
+ Uint8Array = require_Uint8Array(),
1169
+ eq = requireEq(),
1170
+ equalArrays = require_equalArrays(),
1171
+ mapToArray = require_mapToArray(),
1172
+ setToArray = require_setToArray();
1173
+
1174
+ /** Used to compose bitmasks for value comparisons. */
1175
+ var COMPARE_PARTIAL_FLAG = 1,
1176
+ COMPARE_UNORDERED_FLAG = 2;
1177
+
1178
+ /** `Object#toString` result references. */
1179
+ var boolTag = '[object Boolean]',
1180
+ dateTag = '[object Date]',
1181
+ errorTag = '[object Error]',
1182
+ mapTag = '[object Map]',
1183
+ numberTag = '[object Number]',
1184
+ regexpTag = '[object RegExp]',
1185
+ setTag = '[object Set]',
1186
+ stringTag = '[object String]',
1187
+ symbolTag = '[object Symbol]';
1188
+
1189
+ var arrayBufferTag = '[object ArrayBuffer]',
1190
+ dataViewTag = '[object DataView]';
1191
+
1192
+ /** Used to convert symbols to primitives and strings. */
1193
+ var symbolProto = Symbol ? Symbol.prototype : undefined,
1194
+ symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
1195
+
1196
+ /**
1197
+ * A specialized version of `baseIsEqualDeep` for comparing objects of
1198
+ * the same `toStringTag`.
1199
+ *
1200
+ * **Note:** This function only supports comparing values with tags of
1201
+ * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
1202
+ *
1203
+ * @private
1204
+ * @param {Object} object The object to compare.
1205
+ * @param {Object} other The other object to compare.
1206
+ * @param {string} tag The `toStringTag` of the objects to compare.
1207
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1208
+ * @param {Function} customizer The function to customize comparisons.
1209
+ * @param {Function} equalFunc The function to determine equivalents of values.
1210
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
1211
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1212
+ */
1213
+ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
1214
+ switch (tag) {
1215
+ case dataViewTag:
1216
+ if ((object.byteLength != other.byteLength) ||
1217
+ (object.byteOffset != other.byteOffset)) {
1218
+ return false;
1219
+ }
1220
+ object = object.buffer;
1221
+ other = other.buffer;
1222
+
1223
+ case arrayBufferTag:
1224
+ if ((object.byteLength != other.byteLength) ||
1225
+ !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
1226
+ return false;
1227
+ }
1228
+ return true;
1229
+
1230
+ case boolTag:
1231
+ case dateTag:
1232
+ case numberTag:
1233
+ // Coerce booleans to `1` or `0` and dates to milliseconds.
1234
+ // Invalid dates are coerced to `NaN`.
1235
+ return eq(+object, +other);
1236
+
1237
+ case errorTag:
1238
+ return object.name == other.name && object.message == other.message;
1239
+
1240
+ case regexpTag:
1241
+ case stringTag:
1242
+ // Coerce regexes to strings and treat strings, primitives and objects,
1243
+ // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
1244
+ // for more details.
1245
+ return object == (other + '');
1246
+
1247
+ case mapTag:
1248
+ var convert = mapToArray;
1249
+
1250
+ case setTag:
1251
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
1252
+ convert || (convert = setToArray);
1253
+
1254
+ if (object.size != other.size && !isPartial) {
1255
+ return false;
1256
+ }
1257
+ // Assume cyclic values are equal.
1258
+ var stacked = stack.get(object);
1259
+ if (stacked) {
1260
+ return stacked == other;
1261
+ }
1262
+ bitmask |= COMPARE_UNORDERED_FLAG;
1263
+
1264
+ // Recursively compare objects (susceptible to call stack limits).
1265
+ stack.set(object, other);
1266
+ var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
1267
+ stack['delete'](object);
1268
+ return result;
1269
+
1270
+ case symbolTag:
1271
+ if (symbolValueOf) {
1272
+ return symbolValueOf.call(object) == symbolValueOf.call(other);
1273
+ }
1274
+ }
1275
+ return false;
1276
+ }
1277
+
1278
+ _equalByTag = equalByTag;
1279
+ return _equalByTag;
1280
+ }
1281
+
1282
+ /**
1283
+ * Appends the elements of `values` to `array`.
1284
+ *
1285
+ * @private
1286
+ * @param {Array} array The array to modify.
1287
+ * @param {Array} values The values to append.
1288
+ * @returns {Array} Returns `array`.
1289
+ */
1290
+
1291
+ var _arrayPush;
1292
+ var hasRequired_arrayPush;
1293
+
1294
+ function require_arrayPush () {
1295
+ if (hasRequired_arrayPush) return _arrayPush;
1296
+ hasRequired_arrayPush = 1;
1297
+ function arrayPush(array, values) {
1298
+ var index = -1,
1299
+ length = values.length,
1300
+ offset = array.length;
1301
+
1302
+ while (++index < length) {
1303
+ array[offset + index] = values[index];
1304
+ }
1305
+ return array;
1306
+ }
1307
+
1308
+ _arrayPush = arrayPush;
1309
+ return _arrayPush;
1310
+ }
1311
+
1312
+ var _baseGetAllKeys;
1313
+ var hasRequired_baseGetAllKeys;
1314
+
1315
+ function require_baseGetAllKeys () {
1316
+ if (hasRequired_baseGetAllKeys) return _baseGetAllKeys;
1317
+ hasRequired_baseGetAllKeys = 1;
1318
+ var arrayPush = require_arrayPush(),
1319
+ isArray = requireIsArray();
1320
+
1321
+ /**
1322
+ * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
1323
+ * `keysFunc` and `symbolsFunc` to get the enumerable property names and
1324
+ * symbols of `object`.
1325
+ *
1326
+ * @private
1327
+ * @param {Object} object The object to query.
1328
+ * @param {Function} keysFunc The function to get the keys of `object`.
1329
+ * @param {Function} symbolsFunc The function to get the symbols of `object`.
1330
+ * @returns {Array} Returns the array of property names and symbols.
1331
+ */
1332
+ function baseGetAllKeys(object, keysFunc, symbolsFunc) {
1333
+ var result = keysFunc(object);
1334
+ return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
1335
+ }
1336
+
1337
+ _baseGetAllKeys = baseGetAllKeys;
1338
+ return _baseGetAllKeys;
1339
+ }
1340
+
1341
+ /**
1342
+ * A specialized version of `_.filter` for arrays without support for
1343
+ * iteratee shorthands.
1344
+ *
1345
+ * @private
1346
+ * @param {Array} [array] The array to iterate over.
1347
+ * @param {Function} predicate The function invoked per iteration.
1348
+ * @returns {Array} Returns the new filtered array.
1349
+ */
1350
+
1351
+ var _arrayFilter;
1352
+ var hasRequired_arrayFilter;
1353
+
1354
+ function require_arrayFilter () {
1355
+ if (hasRequired_arrayFilter) return _arrayFilter;
1356
+ hasRequired_arrayFilter = 1;
1357
+ function arrayFilter(array, predicate) {
1358
+ var index = -1,
1359
+ length = array == null ? 0 : array.length,
1360
+ resIndex = 0,
1361
+ result = [];
1362
+
1363
+ while (++index < length) {
1364
+ var value = array[index];
1365
+ if (predicate(value, index, array)) {
1366
+ result[resIndex++] = value;
1367
+ }
1368
+ }
1369
+ return result;
1370
+ }
1371
+
1372
+ _arrayFilter = arrayFilter;
1373
+ return _arrayFilter;
1374
+ }
1375
+
1376
+ /**
1377
+ * This method returns a new empty array.
1378
+ *
1379
+ * @static
1380
+ * @memberOf _
1381
+ * @since 4.13.0
1382
+ * @category Util
1383
+ * @returns {Array} Returns the new empty array.
1384
+ * @example
1385
+ *
1386
+ * var arrays = _.times(2, _.stubArray);
1387
+ *
1388
+ * console.log(arrays);
1389
+ * // => [[], []]
1390
+ *
1391
+ * console.log(arrays[0] === arrays[1]);
1392
+ * // => false
1393
+ */
1394
+
1395
+ var stubArray_1;
1396
+ var hasRequiredStubArray;
1397
+
1398
+ function requireStubArray () {
1399
+ if (hasRequiredStubArray) return stubArray_1;
1400
+ hasRequiredStubArray = 1;
1401
+ function stubArray() {
1402
+ return [];
1403
+ }
1404
+
1405
+ stubArray_1 = stubArray;
1406
+ return stubArray_1;
1407
+ }
1408
+
1409
+ var _getSymbols;
1410
+ var hasRequired_getSymbols;
1411
+
1412
+ function require_getSymbols () {
1413
+ if (hasRequired_getSymbols) return _getSymbols;
1414
+ hasRequired_getSymbols = 1;
1415
+ var arrayFilter = require_arrayFilter(),
1416
+ stubArray = requireStubArray();
1417
+
1418
+ /** Used for built-in method references. */
1419
+ var objectProto = Object.prototype;
1420
+
1421
+ /** Built-in value references. */
1422
+ var propertyIsEnumerable = objectProto.propertyIsEnumerable;
1423
+
1424
+ /* Built-in method references for those with the same name as other `lodash` methods. */
1425
+ var nativeGetSymbols = Object.getOwnPropertySymbols;
1426
+
1427
+ /**
1428
+ * Creates an array of the own enumerable symbols of `object`.
1429
+ *
1430
+ * @private
1431
+ * @param {Object} object The object to query.
1432
+ * @returns {Array} Returns the array of symbols.
1433
+ */
1434
+ var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
1435
+ if (object == null) {
1436
+ return [];
1437
+ }
1438
+ object = Object(object);
1439
+ return arrayFilter(nativeGetSymbols(object), function(symbol) {
1440
+ return propertyIsEnumerable.call(object, symbol);
1441
+ });
1442
+ };
1443
+
1444
+ _getSymbols = getSymbols;
1445
+ return _getSymbols;
1446
+ }
1447
+
1448
+ var _getAllKeys;
1449
+ var hasRequired_getAllKeys;
1450
+
1451
+ function require_getAllKeys () {
1452
+ if (hasRequired_getAllKeys) return _getAllKeys;
1453
+ hasRequired_getAllKeys = 1;
1454
+ var baseGetAllKeys = require_baseGetAllKeys(),
1455
+ getSymbols = require_getSymbols(),
1456
+ keys = requireKeys();
1457
+
1458
+ /**
1459
+ * Creates an array of own enumerable property names and symbols of `object`.
1460
+ *
1461
+ * @private
1462
+ * @param {Object} object The object to query.
1463
+ * @returns {Array} Returns the array of property names and symbols.
1464
+ */
1465
+ function getAllKeys(object) {
1466
+ return baseGetAllKeys(object, keys, getSymbols);
1467
+ }
1468
+
1469
+ _getAllKeys = getAllKeys;
1470
+ return _getAllKeys;
1471
+ }
1472
+
1473
+ var _equalObjects;
1474
+ var hasRequired_equalObjects;
1475
+
1476
+ function require_equalObjects () {
1477
+ if (hasRequired_equalObjects) return _equalObjects;
1478
+ hasRequired_equalObjects = 1;
1479
+ var getAllKeys = require_getAllKeys();
1480
+
1481
+ /** Used to compose bitmasks for value comparisons. */
1482
+ var COMPARE_PARTIAL_FLAG = 1;
1483
+
1484
+ /** Used for built-in method references. */
1485
+ var objectProto = Object.prototype;
1486
+
1487
+ /** Used to check objects for own properties. */
1488
+ var hasOwnProperty = objectProto.hasOwnProperty;
1489
+
1490
+ /**
1491
+ * A specialized version of `baseIsEqualDeep` for objects with support for
1492
+ * partial deep comparisons.
1493
+ *
1494
+ * @private
1495
+ * @param {Object} object The object to compare.
1496
+ * @param {Object} other The other object to compare.
1497
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1498
+ * @param {Function} customizer The function to customize comparisons.
1499
+ * @param {Function} equalFunc The function to determine equivalents of values.
1500
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
1501
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1502
+ */
1503
+ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
1504
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
1505
+ objProps = getAllKeys(object),
1506
+ objLength = objProps.length,
1507
+ othProps = getAllKeys(other),
1508
+ othLength = othProps.length;
1509
+
1510
+ if (objLength != othLength && !isPartial) {
1511
+ return false;
1512
+ }
1513
+ var index = objLength;
1514
+ while (index--) {
1515
+ var key = objProps[index];
1516
+ if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
1517
+ return false;
1518
+ }
1519
+ }
1520
+ // Check that cyclic values are equal.
1521
+ var objStacked = stack.get(object);
1522
+ var othStacked = stack.get(other);
1523
+ if (objStacked && othStacked) {
1524
+ return objStacked == other && othStacked == object;
1525
+ }
1526
+ var result = true;
1527
+ stack.set(object, other);
1528
+ stack.set(other, object);
1529
+
1530
+ var skipCtor = isPartial;
1531
+ while (++index < objLength) {
1532
+ key = objProps[index];
1533
+ var objValue = object[key],
1534
+ othValue = other[key];
1535
+
1536
+ if (customizer) {
1537
+ var compared = isPartial
1538
+ ? customizer(othValue, objValue, key, other, object, stack)
1539
+ : customizer(objValue, othValue, key, object, other, stack);
1540
+ }
1541
+ // Recursively compare objects (susceptible to call stack limits).
1542
+ if (!(compared === undefined
1543
+ ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
1544
+ : compared
1545
+ )) {
1546
+ result = false;
1547
+ break;
1548
+ }
1549
+ skipCtor || (skipCtor = key == 'constructor');
1550
+ }
1551
+ if (result && !skipCtor) {
1552
+ var objCtor = object.constructor,
1553
+ othCtor = other.constructor;
1554
+
1555
+ // Non `Object` object instances with different constructors are not equal.
1556
+ if (objCtor != othCtor &&
1557
+ ('constructor' in object && 'constructor' in other) &&
1558
+ !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
1559
+ typeof othCtor == 'function' && othCtor instanceof othCtor)) {
1560
+ result = false;
1561
+ }
1562
+ }
1563
+ stack['delete'](object);
1564
+ stack['delete'](other);
1565
+ return result;
1566
+ }
1567
+
1568
+ _equalObjects = equalObjects;
1569
+ return _equalObjects;
1570
+ }
1571
+
1572
+ var _baseIsEqualDeep;
1573
+ var hasRequired_baseIsEqualDeep;
1574
+
1575
+ function require_baseIsEqualDeep () {
1576
+ if (hasRequired_baseIsEqualDeep) return _baseIsEqualDeep;
1577
+ hasRequired_baseIsEqualDeep = 1;
1578
+ var Stack = require_Stack(),
1579
+ equalArrays = require_equalArrays(),
1580
+ equalByTag = require_equalByTag(),
1581
+ equalObjects = require_equalObjects(),
1582
+ getTag = require_getTag(),
1583
+ isArray = requireIsArray(),
1584
+ isBuffer = requireIsBuffer(),
1585
+ isTypedArray = requireIsTypedArray();
1586
+
1587
+ /** Used to compose bitmasks for value comparisons. */
1588
+ var COMPARE_PARTIAL_FLAG = 1;
1589
+
1590
+ /** `Object#toString` result references. */
1591
+ var argsTag = '[object Arguments]',
1592
+ arrayTag = '[object Array]',
1593
+ objectTag = '[object Object]';
1594
+
1595
+ /** Used for built-in method references. */
1596
+ var objectProto = Object.prototype;
1597
+
1598
+ /** Used to check objects for own properties. */
1599
+ var hasOwnProperty = objectProto.hasOwnProperty;
1600
+
1601
+ /**
1602
+ * A specialized version of `baseIsEqual` for arrays and objects which performs
1603
+ * deep comparisons and tracks traversed objects enabling objects with circular
1604
+ * references to be compared.
1605
+ *
1606
+ * @private
1607
+ * @param {Object} object The object to compare.
1608
+ * @param {Object} other The other object to compare.
1609
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1610
+ * @param {Function} customizer The function to customize comparisons.
1611
+ * @param {Function} equalFunc The function to determine equivalents of values.
1612
+ * @param {Object} [stack] Tracks traversed `object` and `other` objects.
1613
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1614
+ */
1615
+ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
1616
+ var objIsArr = isArray(object),
1617
+ othIsArr = isArray(other),
1618
+ objTag = objIsArr ? arrayTag : getTag(object),
1619
+ othTag = othIsArr ? arrayTag : getTag(other);
1620
+
1621
+ objTag = objTag == argsTag ? objectTag : objTag;
1622
+ othTag = othTag == argsTag ? objectTag : othTag;
1623
+
1624
+ var objIsObj = objTag == objectTag,
1625
+ othIsObj = othTag == objectTag,
1626
+ isSameTag = objTag == othTag;
1627
+
1628
+ if (isSameTag && isBuffer(object)) {
1629
+ if (!isBuffer(other)) {
1630
+ return false;
1631
+ }
1632
+ objIsArr = true;
1633
+ objIsObj = false;
1634
+ }
1635
+ if (isSameTag && !objIsObj) {
1636
+ stack || (stack = new Stack);
1637
+ return (objIsArr || isTypedArray(object))
1638
+ ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
1639
+ : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
1640
+ }
1641
+ if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
1642
+ var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
1643
+ othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
1644
+
1645
+ if (objIsWrapped || othIsWrapped) {
1646
+ var objUnwrapped = objIsWrapped ? object.value() : object,
1647
+ othUnwrapped = othIsWrapped ? other.value() : other;
1648
+
1649
+ stack || (stack = new Stack);
1650
+ return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
1651
+ }
1652
+ }
1653
+ if (!isSameTag) {
1654
+ return false;
1655
+ }
1656
+ stack || (stack = new Stack);
1657
+ return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
1658
+ }
1659
+
1660
+ _baseIsEqualDeep = baseIsEqualDeep;
1661
+ return _baseIsEqualDeep;
1662
+ }
1663
+
1664
+ var _baseIsEqual;
1665
+ var hasRequired_baseIsEqual;
1666
+
1667
+ function require_baseIsEqual () {
1668
+ if (hasRequired_baseIsEqual) return _baseIsEqual;
1669
+ hasRequired_baseIsEqual = 1;
1670
+ var baseIsEqualDeep = require_baseIsEqualDeep(),
1671
+ isObjectLike = requireIsObjectLike();
1672
+
1673
+ /**
1674
+ * The base implementation of `_.isEqual` which supports partial comparisons
1675
+ * and tracks traversed objects.
1676
+ *
1677
+ * @private
1678
+ * @param {*} value The value to compare.
1679
+ * @param {*} other The other value to compare.
1680
+ * @param {boolean} bitmask The bitmask flags.
1681
+ * 1 - Unordered comparison
1682
+ * 2 - Partial comparison
1683
+ * @param {Function} [customizer] The function to customize comparisons.
1684
+ * @param {Object} [stack] Tracks traversed `value` and `other` objects.
1685
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1686
+ */
1687
+ function baseIsEqual(value, other, bitmask, customizer, stack) {
1688
+ if (value === other) {
1689
+ return true;
1690
+ }
1691
+ if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
1692
+ return value !== value && other !== other;
1693
+ }
1694
+ return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
1695
+ }
1696
+
1697
+ _baseIsEqual = baseIsEqual;
1698
+ return _baseIsEqual;
1699
+ }
1700
+
1701
+ var _baseIsMatch;
1702
+ var hasRequired_baseIsMatch;
1703
+
1704
+ function require_baseIsMatch () {
1705
+ if (hasRequired_baseIsMatch) return _baseIsMatch;
1706
+ hasRequired_baseIsMatch = 1;
1707
+ var Stack = require_Stack(),
1708
+ baseIsEqual = require_baseIsEqual();
1709
+
1710
+ /** Used to compose bitmasks for value comparisons. */
1711
+ var COMPARE_PARTIAL_FLAG = 1,
1712
+ COMPARE_UNORDERED_FLAG = 2;
1713
+
1714
+ /**
1715
+ * The base implementation of `_.isMatch` without support for iteratee shorthands.
1716
+ *
1717
+ * @private
1718
+ * @param {Object} object The object to inspect.
1719
+ * @param {Object} source The object of property values to match.
1720
+ * @param {Array} matchData The property names, values, and compare flags to match.
1721
+ * @param {Function} [customizer] The function to customize comparisons.
1722
+ * @returns {boolean} Returns `true` if `object` is a match, else `false`.
1723
+ */
1724
+ function baseIsMatch(object, source, matchData, customizer) {
1725
+ var index = matchData.length,
1726
+ length = index,
1727
+ noCustomizer = !customizer;
1728
+
1729
+ if (object == null) {
1730
+ return !length;
1731
+ }
1732
+ object = Object(object);
1733
+ while (index--) {
1734
+ var data = matchData[index];
1735
+ if ((noCustomizer && data[2])
1736
+ ? data[1] !== object[data[0]]
1737
+ : !(data[0] in object)
1738
+ ) {
1739
+ return false;
1740
+ }
1741
+ }
1742
+ while (++index < length) {
1743
+ data = matchData[index];
1744
+ var key = data[0],
1745
+ objValue = object[key],
1746
+ srcValue = data[1];
1747
+
1748
+ if (noCustomizer && data[2]) {
1749
+ if (objValue === undefined && !(key in object)) {
1750
+ return false;
1751
+ }
1752
+ } else {
1753
+ var stack = new Stack;
1754
+ if (customizer) {
1755
+ var result = customizer(objValue, srcValue, key, object, source, stack);
1756
+ }
1757
+ if (!(result === undefined
1758
+ ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
1759
+ : result
1760
+ )) {
1761
+ return false;
1762
+ }
1763
+ }
1764
+ }
1765
+ return true;
1766
+ }
1767
+
1768
+ _baseIsMatch = baseIsMatch;
1769
+ return _baseIsMatch;
1770
+ }
1771
+
1772
+ var _isStrictComparable;
1773
+ var hasRequired_isStrictComparable;
1774
+
1775
+ function require_isStrictComparable () {
1776
+ if (hasRequired_isStrictComparable) return _isStrictComparable;
1777
+ hasRequired_isStrictComparable = 1;
1778
+ var isObject = requireIsObject();
1779
+
1780
+ /**
1781
+ * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
1782
+ *
1783
+ * @private
1784
+ * @param {*} value The value to check.
1785
+ * @returns {boolean} Returns `true` if `value` if suitable for strict
1786
+ * equality comparisons, else `false`.
1787
+ */
1788
+ function isStrictComparable(value) {
1789
+ return value === value && !isObject(value);
1790
+ }
1791
+
1792
+ _isStrictComparable = isStrictComparable;
1793
+ return _isStrictComparable;
1794
+ }
1795
+
1796
+ var _getMatchData;
1797
+ var hasRequired_getMatchData;
1798
+
1799
+ function require_getMatchData () {
1800
+ if (hasRequired_getMatchData) return _getMatchData;
1801
+ hasRequired_getMatchData = 1;
1802
+ var isStrictComparable = require_isStrictComparable(),
1803
+ keys = requireKeys();
1804
+
1805
+ /**
1806
+ * Gets the property names, values, and compare flags of `object`.
1807
+ *
1808
+ * @private
1809
+ * @param {Object} object The object to query.
1810
+ * @returns {Array} Returns the match data of `object`.
1811
+ */
1812
+ function getMatchData(object) {
1813
+ var result = keys(object),
1814
+ length = result.length;
1815
+
1816
+ while (length--) {
1817
+ var key = result[length],
1818
+ value = object[key];
1819
+
1820
+ result[length] = [key, value, isStrictComparable(value)];
1821
+ }
1822
+ return result;
1823
+ }
1824
+
1825
+ _getMatchData = getMatchData;
1826
+ return _getMatchData;
1827
+ }
1828
+
1829
+ /**
1830
+ * A specialized version of `matchesProperty` for source values suitable
1831
+ * for strict equality comparisons, i.e. `===`.
1832
+ *
1833
+ * @private
1834
+ * @param {string} key The key of the property to get.
1835
+ * @param {*} srcValue The value to match.
1836
+ * @returns {Function} Returns the new spec function.
1837
+ */
1838
+
1839
+ var _matchesStrictComparable;
1840
+ var hasRequired_matchesStrictComparable;
1841
+
1842
+ function require_matchesStrictComparable () {
1843
+ if (hasRequired_matchesStrictComparable) return _matchesStrictComparable;
1844
+ hasRequired_matchesStrictComparable = 1;
1845
+ function matchesStrictComparable(key, srcValue) {
1846
+ return function(object) {
1847
+ if (object == null) {
1848
+ return false;
1849
+ }
1850
+ return object[key] === srcValue &&
1851
+ (srcValue !== undefined || (key in Object(object)));
1852
+ };
1853
+ }
1854
+
1855
+ _matchesStrictComparable = matchesStrictComparable;
1856
+ return _matchesStrictComparable;
1857
+ }
1858
+
1859
+ var _baseMatches;
1860
+ var hasRequired_baseMatches;
1861
+
1862
+ function require_baseMatches () {
1863
+ if (hasRequired_baseMatches) return _baseMatches;
1864
+ hasRequired_baseMatches = 1;
1865
+ var baseIsMatch = require_baseIsMatch(),
1866
+ getMatchData = require_getMatchData(),
1867
+ matchesStrictComparable = require_matchesStrictComparable();
1868
+
1869
+ /**
1870
+ * The base implementation of `_.matches` which doesn't clone `source`.
1871
+ *
1872
+ * @private
1873
+ * @param {Object} source The object of property values to match.
1874
+ * @returns {Function} Returns the new spec function.
1875
+ */
1876
+ function baseMatches(source) {
1877
+ var matchData = getMatchData(source);
1878
+ if (matchData.length == 1 && matchData[0][2]) {
1879
+ return matchesStrictComparable(matchData[0][0], matchData[0][1]);
1880
+ }
1881
+ return function(object) {
1882
+ return object === source || baseIsMatch(object, source, matchData);
1883
+ };
1884
+ }
1885
+
1886
+ _baseMatches = baseMatches;
1887
+ return _baseMatches;
1888
+ }
1889
+
1890
+ /**
1891
+ * The base implementation of `_.hasIn` without support for deep paths.
1892
+ *
1893
+ * @private
1894
+ * @param {Object} [object] The object to query.
1895
+ * @param {Array|string} key The key to check.
1896
+ * @returns {boolean} Returns `true` if `key` exists, else `false`.
1897
+ */
1898
+
1899
+ var _baseHasIn;
1900
+ var hasRequired_baseHasIn;
1901
+
1902
+ function require_baseHasIn () {
1903
+ if (hasRequired_baseHasIn) return _baseHasIn;
1904
+ hasRequired_baseHasIn = 1;
1905
+ function baseHasIn(object, key) {
1906
+ return object != null && key in Object(object);
1907
+ }
1908
+
1909
+ _baseHasIn = baseHasIn;
1910
+ return _baseHasIn;
1911
+ }
1912
+
1913
+ var hasIn_1;
1914
+ var hasRequiredHasIn;
1915
+
1916
+ function requireHasIn () {
1917
+ if (hasRequiredHasIn) return hasIn_1;
1918
+ hasRequiredHasIn = 1;
1919
+ var baseHasIn = require_baseHasIn(),
1920
+ hasPath = require_hasPath();
1921
+
1922
+ /**
1923
+ * Checks if `path` is a direct or inherited property of `object`.
1924
+ *
1925
+ * @static
1926
+ * @memberOf _
1927
+ * @since 4.0.0
1928
+ * @category Object
1929
+ * @param {Object} object The object to query.
1930
+ * @param {Array|string} path The path to check.
1931
+ * @returns {boolean} Returns `true` if `path` exists, else `false`.
1932
+ * @example
1933
+ *
1934
+ * var object = _.create({ 'a': _.create({ 'b': 2 }) });
1935
+ *
1936
+ * _.hasIn(object, 'a');
1937
+ * // => true
1938
+ *
1939
+ * _.hasIn(object, 'a.b');
1940
+ * // => true
1941
+ *
1942
+ * _.hasIn(object, ['a', 'b']);
1943
+ * // => true
1944
+ *
1945
+ * _.hasIn(object, 'b');
1946
+ * // => false
1947
+ */
1948
+ function hasIn(object, path) {
1949
+ return object != null && hasPath(object, path, baseHasIn);
1950
+ }
1951
+
1952
+ hasIn_1 = hasIn;
1953
+ return hasIn_1;
1954
+ }
1955
+
1956
+ var _baseMatchesProperty;
1957
+ var hasRequired_baseMatchesProperty;
1958
+
1959
+ function require_baseMatchesProperty () {
1960
+ if (hasRequired_baseMatchesProperty) return _baseMatchesProperty;
1961
+ hasRequired_baseMatchesProperty = 1;
1962
+ var baseIsEqual = require_baseIsEqual(),
1963
+ get = requireGet(),
1964
+ hasIn = requireHasIn(),
1965
+ isKey = require_isKey(),
1966
+ isStrictComparable = require_isStrictComparable(),
1967
+ matchesStrictComparable = require_matchesStrictComparable(),
1968
+ toKey = require_toKey();
1969
+
1970
+ /** Used to compose bitmasks for value comparisons. */
1971
+ var COMPARE_PARTIAL_FLAG = 1,
1972
+ COMPARE_UNORDERED_FLAG = 2;
1973
+
1974
+ /**
1975
+ * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
1976
+ *
1977
+ * @private
1978
+ * @param {string} path The path of the property to get.
1979
+ * @param {*} srcValue The value to match.
1980
+ * @returns {Function} Returns the new spec function.
1981
+ */
1982
+ function baseMatchesProperty(path, srcValue) {
1983
+ if (isKey(path) && isStrictComparable(srcValue)) {
1984
+ return matchesStrictComparable(toKey(path), srcValue);
1985
+ }
1986
+ return function(object) {
1987
+ var objValue = get(object, path);
1988
+ return (objValue === undefined && objValue === srcValue)
1989
+ ? hasIn(object, path)
1990
+ : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
1991
+ };
1992
+ }
1993
+
1994
+ _baseMatchesProperty = baseMatchesProperty;
1995
+ return _baseMatchesProperty;
1996
+ }
1997
+
1998
+ var _basePropertyDeep;
1999
+ var hasRequired_basePropertyDeep;
2000
+
2001
+ function require_basePropertyDeep () {
2002
+ if (hasRequired_basePropertyDeep) return _basePropertyDeep;
2003
+ hasRequired_basePropertyDeep = 1;
2004
+ var baseGet = require_baseGet();
2005
+
2006
+ /**
2007
+ * A specialized version of `baseProperty` which supports deep paths.
2008
+ *
2009
+ * @private
2010
+ * @param {Array|string} path The path of the property to get.
2011
+ * @returns {Function} Returns the new accessor function.
2012
+ */
2013
+ function basePropertyDeep(path) {
2014
+ return function(object) {
2015
+ return baseGet(object, path);
2016
+ };
2017
+ }
2018
+
2019
+ _basePropertyDeep = basePropertyDeep;
2020
+ return _basePropertyDeep;
2021
+ }
2022
+
2023
+ var property_1;
2024
+ var hasRequiredProperty;
2025
+
2026
+ function requireProperty () {
2027
+ if (hasRequiredProperty) return property_1;
2028
+ hasRequiredProperty = 1;
2029
+ var baseProperty = require_baseProperty(),
2030
+ basePropertyDeep = require_basePropertyDeep(),
2031
+ isKey = require_isKey(),
2032
+ toKey = require_toKey();
2033
+
2034
+ /**
2035
+ * Creates a function that returns the value at `path` of a given object.
2036
+ *
2037
+ * @static
2038
+ * @memberOf _
2039
+ * @since 2.4.0
2040
+ * @category Util
2041
+ * @param {Array|string} path The path of the property to get.
2042
+ * @returns {Function} Returns the new accessor function.
2043
+ * @example
2044
+ *
2045
+ * var objects = [
2046
+ * { 'a': { 'b': 2 } },
2047
+ * { 'a': { 'b': 1 } }
2048
+ * ];
2049
+ *
2050
+ * _.map(objects, _.property('a.b'));
2051
+ * // => [2, 1]
2052
+ *
2053
+ * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
2054
+ * // => [1, 2]
2055
+ */
2056
+ function property(path) {
2057
+ return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
2058
+ }
2059
+
2060
+ property_1 = property;
2061
+ return property_1;
2062
+ }
2063
+
2064
+ var _baseIteratee;
2065
+ var hasRequired_baseIteratee;
2066
+
2067
+ function require_baseIteratee () {
2068
+ if (hasRequired_baseIteratee) return _baseIteratee;
2069
+ hasRequired_baseIteratee = 1;
2070
+ var baseMatches = require_baseMatches(),
2071
+ baseMatchesProperty = require_baseMatchesProperty(),
2072
+ identity = requireIdentity(),
2073
+ isArray = requireIsArray(),
2074
+ property = requireProperty();
2075
+
2076
+ /**
2077
+ * The base implementation of `_.iteratee`.
2078
+ *
2079
+ * @private
2080
+ * @param {*} [value=_.identity] The value to convert to an iteratee.
2081
+ * @returns {Function} Returns the iteratee.
2082
+ */
2083
+ function baseIteratee(value) {
2084
+ // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
2085
+ // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
2086
+ if (typeof value == 'function') {
2087
+ return value;
2088
+ }
2089
+ if (value == null) {
2090
+ return identity;
2091
+ }
2092
+ if (typeof value == 'object') {
2093
+ return isArray(value)
2094
+ ? baseMatchesProperty(value[0], value[1])
2095
+ : baseMatches(value);
2096
+ }
2097
+ return property(value);
2098
+ }
2099
+
2100
+ _baseIteratee = baseIteratee;
2101
+ return _baseIteratee;
2102
+ }
2103
+
2104
+ /**
2105
+ * The base implementation of `_.findIndex` and `_.findLastIndex` without
2106
+ * support for iteratee shorthands.
2107
+ *
2108
+ * @private
2109
+ * @param {Array} array The array to inspect.
2110
+ * @param {Function} predicate The function invoked per iteration.
2111
+ * @param {number} fromIndex The index to search from.
2112
+ * @param {boolean} [fromRight] Specify iterating from right to left.
2113
+ * @returns {number} Returns the index of the matched value, else `-1`.
2114
+ */
2115
+
2116
+ var _baseFindIndex;
2117
+ var hasRequired_baseFindIndex;
2118
+
2119
+ function require_baseFindIndex () {
2120
+ if (hasRequired_baseFindIndex) return _baseFindIndex;
2121
+ hasRequired_baseFindIndex = 1;
2122
+ function baseFindIndex(array, predicate, fromIndex, fromRight) {
2123
+ var length = array.length,
2124
+ index = fromIndex + (fromRight ? 1 : -1);
2125
+
2126
+ while ((fromRight ? index-- : ++index < length)) {
2127
+ if (predicate(array[index], index, array)) {
2128
+ return index;
2129
+ }
2130
+ }
2131
+ return -1;
2132
+ }
2133
+
2134
+ _baseFindIndex = baseFindIndex;
2135
+ return _baseFindIndex;
2136
+ }
2137
+
2138
+ /**
2139
+ * The base implementation of `_.isNaN` without support for number objects.
2140
+ *
2141
+ * @private
2142
+ * @param {*} value The value to check.
2143
+ * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
2144
+ */
2145
+
2146
+ var _baseIsNaN;
2147
+ var hasRequired_baseIsNaN;
2148
+
2149
+ function require_baseIsNaN () {
2150
+ if (hasRequired_baseIsNaN) return _baseIsNaN;
2151
+ hasRequired_baseIsNaN = 1;
2152
+ function baseIsNaN(value) {
2153
+ return value !== value;
2154
+ }
2155
+
2156
+ _baseIsNaN = baseIsNaN;
2157
+ return _baseIsNaN;
2158
+ }
2159
+
2160
+ /**
2161
+ * A specialized version of `_.indexOf` which performs strict equality
2162
+ * comparisons of values, i.e. `===`.
2163
+ *
2164
+ * @private
2165
+ * @param {Array} array The array to inspect.
2166
+ * @param {*} value The value to search for.
2167
+ * @param {number} fromIndex The index to search from.
2168
+ * @returns {number} Returns the index of the matched value, else `-1`.
2169
+ */
2170
+
2171
+ var _strictIndexOf;
2172
+ var hasRequired_strictIndexOf;
2173
+
2174
+ function require_strictIndexOf () {
2175
+ if (hasRequired_strictIndexOf) return _strictIndexOf;
2176
+ hasRequired_strictIndexOf = 1;
2177
+ function strictIndexOf(array, value, fromIndex) {
2178
+ var index = fromIndex - 1,
2179
+ length = array.length;
2180
+
2181
+ while (++index < length) {
2182
+ if (array[index] === value) {
2183
+ return index;
2184
+ }
2185
+ }
2186
+ return -1;
2187
+ }
2188
+
2189
+ _strictIndexOf = strictIndexOf;
2190
+ return _strictIndexOf;
2191
+ }
2192
+
2193
+ var _baseIndexOf;
2194
+ var hasRequired_baseIndexOf;
2195
+
2196
+ function require_baseIndexOf () {
2197
+ if (hasRequired_baseIndexOf) return _baseIndexOf;
2198
+ hasRequired_baseIndexOf = 1;
2199
+ var baseFindIndex = require_baseFindIndex(),
2200
+ baseIsNaN = require_baseIsNaN(),
2201
+ strictIndexOf = require_strictIndexOf();
2202
+
2203
+ /**
2204
+ * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
2205
+ *
2206
+ * @private
2207
+ * @param {Array} array The array to inspect.
2208
+ * @param {*} value The value to search for.
2209
+ * @param {number} fromIndex The index to search from.
2210
+ * @returns {number} Returns the index of the matched value, else `-1`.
2211
+ */
2212
+ function baseIndexOf(array, value, fromIndex) {
2213
+ return value === value
2214
+ ? strictIndexOf(array, value, fromIndex)
2215
+ : baseFindIndex(array, baseIsNaN, fromIndex);
2216
+ }
2217
+
2218
+ _baseIndexOf = baseIndexOf;
2219
+ return _baseIndexOf;
2220
+ }
2221
+
2222
+ var _arrayIncludes;
2223
+ var hasRequired_arrayIncludes;
2224
+
2225
+ function require_arrayIncludes () {
2226
+ if (hasRequired_arrayIncludes) return _arrayIncludes;
2227
+ hasRequired_arrayIncludes = 1;
2228
+ var baseIndexOf = require_baseIndexOf();
2229
+
2230
+ /**
2231
+ * A specialized version of `_.includes` for arrays without support for
2232
+ * specifying an index to search from.
2233
+ *
2234
+ * @private
2235
+ * @param {Array} [array] The array to inspect.
2236
+ * @param {*} target The value to search for.
2237
+ * @returns {boolean} Returns `true` if `target` is found, else `false`.
2238
+ */
2239
+ function arrayIncludes(array, value) {
2240
+ var length = array == null ? 0 : array.length;
2241
+ return !!length && baseIndexOf(array, value, 0) > -1;
2242
+ }
2243
+
2244
+ _arrayIncludes = arrayIncludes;
2245
+ return _arrayIncludes;
2246
+ }
2247
+
2248
+ /**
2249
+ * This function is like `arrayIncludes` except that it accepts a comparator.
2250
+ *
2251
+ * @private
2252
+ * @param {Array} [array] The array to inspect.
2253
+ * @param {*} target The value to search for.
2254
+ * @param {Function} comparator The comparator invoked per element.
2255
+ * @returns {boolean} Returns `true` if `target` is found, else `false`.
2256
+ */
2257
+
2258
+ var _arrayIncludesWith;
2259
+ var hasRequired_arrayIncludesWith;
2260
+
2261
+ function require_arrayIncludesWith () {
2262
+ if (hasRequired_arrayIncludesWith) return _arrayIncludesWith;
2263
+ hasRequired_arrayIncludesWith = 1;
2264
+ function arrayIncludesWith(array, value, comparator) {
2265
+ var index = -1,
2266
+ length = array == null ? 0 : array.length;
2267
+
2268
+ while (++index < length) {
2269
+ if (comparator(value, array[index])) {
2270
+ return true;
2271
+ }
2272
+ }
2273
+ return false;
2274
+ }
2275
+
2276
+ _arrayIncludesWith = arrayIncludesWith;
2277
+ return _arrayIncludesWith;
2278
+ }
2279
+
2280
+ /**
2281
+ * This method returns `undefined`.
2282
+ *
2283
+ * @static
2284
+ * @memberOf _
2285
+ * @since 2.3.0
2286
+ * @category Util
2287
+ * @example
2288
+ *
2289
+ * _.times(2, _.noop);
2290
+ * // => [undefined, undefined]
2291
+ */
2292
+
2293
+ var noop_1;
2294
+ var hasRequiredNoop;
2295
+
2296
+ function requireNoop () {
2297
+ if (hasRequiredNoop) return noop_1;
2298
+ hasRequiredNoop = 1;
2299
+ function noop() {
2300
+ // No operation performed.
2301
+ }
2302
+
2303
+ noop_1 = noop;
2304
+ return noop_1;
2305
+ }
2306
+
2307
+ var _createSet;
2308
+ var hasRequired_createSet;
2309
+
2310
+ function require_createSet () {
2311
+ if (hasRequired_createSet) return _createSet;
2312
+ hasRequired_createSet = 1;
2313
+ var Set = require_Set(),
2314
+ noop = requireNoop(),
2315
+ setToArray = require_setToArray();
2316
+
2317
+ /** Used as references for various `Number` constants. */
2318
+ var INFINITY = 1 / 0;
2319
+
2320
+ /**
2321
+ * Creates a set object of `values`.
2322
+ *
2323
+ * @private
2324
+ * @param {Array} values The values to add to the set.
2325
+ * @returns {Object} Returns the new set.
2326
+ */
2327
+ var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
2328
+ return new Set(values);
2329
+ };
2330
+
2331
+ _createSet = createSet;
2332
+ return _createSet;
2333
+ }
2334
+
2335
+ var _baseUniq;
2336
+ var hasRequired_baseUniq;
2337
+
2338
+ function require_baseUniq () {
2339
+ if (hasRequired_baseUniq) return _baseUniq;
2340
+ hasRequired_baseUniq = 1;
2341
+ var SetCache = require_SetCache(),
2342
+ arrayIncludes = require_arrayIncludes(),
2343
+ arrayIncludesWith = require_arrayIncludesWith(),
2344
+ cacheHas = require_cacheHas(),
2345
+ createSet = require_createSet(),
2346
+ setToArray = require_setToArray();
2347
+
2348
+ /** Used as the size to enable large array optimizations. */
2349
+ var LARGE_ARRAY_SIZE = 200;
2350
+
2351
+ /**
2352
+ * The base implementation of `_.uniqBy` without support for iteratee shorthands.
2353
+ *
2354
+ * @private
2355
+ * @param {Array} array The array to inspect.
2356
+ * @param {Function} [iteratee] The iteratee invoked per element.
2357
+ * @param {Function} [comparator] The comparator invoked per element.
2358
+ * @returns {Array} Returns the new duplicate free array.
2359
+ */
2360
+ function baseUniq(array, iteratee, comparator) {
2361
+ var index = -1,
2362
+ includes = arrayIncludes,
2363
+ length = array.length,
2364
+ isCommon = true,
2365
+ result = [],
2366
+ seen = result;
2367
+
2368
+ if (comparator) {
2369
+ isCommon = false;
2370
+ includes = arrayIncludesWith;
2371
+ }
2372
+ else if (length >= LARGE_ARRAY_SIZE) {
2373
+ var set = iteratee ? null : createSet(array);
2374
+ if (set) {
2375
+ return setToArray(set);
2376
+ }
2377
+ isCommon = false;
2378
+ includes = cacheHas;
2379
+ seen = new SetCache;
2380
+ }
2381
+ else {
2382
+ seen = iteratee ? [] : result;
2383
+ }
2384
+ outer:
2385
+ while (++index < length) {
2386
+ var value = array[index],
2387
+ computed = iteratee ? iteratee(value) : value;
2388
+
2389
+ value = (comparator || value !== 0) ? value : 0;
2390
+ if (isCommon && computed === computed) {
2391
+ var seenIndex = seen.length;
2392
+ while (seenIndex--) {
2393
+ if (seen[seenIndex] === computed) {
2394
+ continue outer;
2395
+ }
2396
+ }
2397
+ if (iteratee) {
2398
+ seen.push(computed);
2399
+ }
2400
+ result.push(value);
2401
+ }
2402
+ else if (!includes(seen, computed, comparator)) {
2403
+ if (seen !== result) {
2404
+ seen.push(computed);
2405
+ }
2406
+ result.push(value);
2407
+ }
2408
+ }
2409
+ return result;
2410
+ }
2411
+
2412
+ _baseUniq = baseUniq;
2413
+ return _baseUniq;
2414
+ }
2415
+
2416
+ var uniqBy_1;
2417
+ var hasRequiredUniqBy;
2418
+
2419
+ function requireUniqBy () {
2420
+ if (hasRequiredUniqBy) return uniqBy_1;
2421
+ hasRequiredUniqBy = 1;
2422
+ var baseIteratee = require_baseIteratee(),
2423
+ baseUniq = require_baseUniq();
2424
+
2425
+ /**
2426
+ * This method is like `_.uniq` except that it accepts `iteratee` which is
2427
+ * invoked for each element in `array` to generate the criterion by which
2428
+ * uniqueness is computed. The order of result values is determined by the
2429
+ * order they occur in the array. The iteratee is invoked with one argument:
2430
+ * (value).
2431
+ *
2432
+ * @static
2433
+ * @memberOf _
2434
+ * @since 4.0.0
2435
+ * @category Array
2436
+ * @param {Array} array The array to inspect.
2437
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
2438
+ * @returns {Array} Returns the new duplicate free array.
2439
+ * @example
2440
+ *
2441
+ * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
2442
+ * // => [2.1, 1.2]
2443
+ *
2444
+ * // The `_.property` iteratee shorthand.
2445
+ * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
2446
+ * // => [{ 'x': 1 }, { 'x': 2 }]
2447
+ */
2448
+ function uniqBy(array, iteratee) {
2449
+ return (array && array.length) ? baseUniq(array, baseIteratee(iteratee, 2)) : [];
2450
+ }
2451
+
2452
+ uniqBy_1 = uniqBy;
2453
+ return uniqBy_1;
2454
+ }
2455
+
2456
+ var uniqByExports = requireUniqBy();
2457
+ var uniqBy = /*@__PURE__*/getDefaultExportFromCjs(uniqByExports);
2458
+
2459
+ var findIndex_1;
2460
+ var hasRequiredFindIndex;
2461
+
2462
+ function requireFindIndex () {
2463
+ if (hasRequiredFindIndex) return findIndex_1;
2464
+ hasRequiredFindIndex = 1;
2465
+ var baseFindIndex = require_baseFindIndex(),
2466
+ baseIteratee = require_baseIteratee(),
2467
+ toInteger = requireToInteger();
2468
+
2469
+ /* Built-in method references for those with the same name as other `lodash` methods. */
2470
+ var nativeMax = Math.max;
2471
+
2472
+ /**
2473
+ * This method is like `_.find` except that it returns the index of the first
2474
+ * element `predicate` returns truthy for instead of the element itself.
2475
+ *
2476
+ * @static
2477
+ * @memberOf _
2478
+ * @since 1.1.0
2479
+ * @category Array
2480
+ * @param {Array} array The array to inspect.
2481
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
2482
+ * @param {number} [fromIndex=0] The index to search from.
2483
+ * @returns {number} Returns the index of the found element, else `-1`.
2484
+ * @example
2485
+ *
2486
+ * var users = [
2487
+ * { 'user': 'barney', 'active': false },
2488
+ * { 'user': 'fred', 'active': false },
2489
+ * { 'user': 'pebbles', 'active': true }
2490
+ * ];
2491
+ *
2492
+ * _.findIndex(users, function(o) { return o.user == 'barney'; });
2493
+ * // => 0
2494
+ *
2495
+ * // The `_.matches` iteratee shorthand.
2496
+ * _.findIndex(users, { 'user': 'fred', 'active': false });
2497
+ * // => 1
2498
+ *
2499
+ * // The `_.matchesProperty` iteratee shorthand.
2500
+ * _.findIndex(users, ['active', false]);
2501
+ * // => 0
2502
+ *
2503
+ * // The `_.property` iteratee shorthand.
2504
+ * _.findIndex(users, 'active');
2505
+ * // => 2
2506
+ */
2507
+ function findIndex(array, predicate, fromIndex) {
2508
+ var length = array == null ? 0 : array.length;
2509
+ if (!length) {
2510
+ return -1;
2511
+ }
2512
+ var index = fromIndex == null ? 0 : toInteger(fromIndex);
2513
+ if (index < 0) {
2514
+ index = nativeMax(length + index, 0);
2515
+ }
2516
+ return baseFindIndex(array, baseIteratee(predicate, 3), index);
2517
+ }
2518
+
2519
+ findIndex_1 = findIndex;
2520
+ return findIndex_1;
2521
+ }
2522
+
2523
+ var findIndexExports = requireFindIndex();
2524
+ var findIndex = /*@__PURE__*/getDefaultExportFromCjs(findIndexExports);
2525
+
2526
+ function _extends$3() { _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
2527
+
2528
+ function T() {
2529
+ return true;
2530
+ } // Fix IE file.status problem
2531
+ // via coping a new Object
2532
+
2533
+ function fileToObject(file) {
2534
+ return _extends$3(_extends$3({}, file), {
2535
+ lastModified: file.lastModified,
2536
+ lastModifiedDate: file.lastModifiedDate,
2537
+ name: file.name,
2538
+ size: file.size,
2539
+ type: file.type,
2540
+ uid: file.uid,
2541
+ percent: 0,
2542
+ originFileObj: file
2543
+ });
2544
+ }
2545
+ /**
2546
+ * 生成Progress percent: 0.1 -> 0.98
2547
+ * - for ie
2548
+ */
2549
+
2550
+ function genPercentAdd() {
2551
+ var k = 0.1;
2552
+ var i = 0.01;
2553
+ var end = 0.98;
2554
+ return function (s) {
2555
+ var start = s;
2556
+
2557
+ if (start >= end) {
2558
+ return start;
2559
+ }
2560
+
2561
+ start += k;
2562
+ k -= i;
2563
+
2564
+ if (k < 0.001) {
2565
+ k = 0.001;
2566
+ }
2567
+
2568
+ return start;
2569
+ };
2570
+ }
2571
+ function getFileItem(file, fileList) {
2572
+ var matchKey = file.uid !== undefined ? 'uid' : 'name';
2573
+ return fileList.filter(function (item) {
2574
+ return item[matchKey] === file[matchKey];
2575
+ })[0];
2576
+ }
2577
+ function removeFileItem(file, fileList) {
2578
+ var matchKey = file.uid !== undefined ? 'uid' : 'name';
2579
+ var removed = fileList.filter(function (item) {
2580
+ return item[matchKey] !== file[matchKey];
2581
+ });
2582
+
2583
+ if (removed.length === fileList.length) {
2584
+ return null;
2585
+ }
2586
+
2587
+ return removed;
2588
+ } // ==================== Default Image Preview ====================
2589
+
2590
+ var extname = function extname() {
2591
+ var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
2592
+ var temp = url.split('/');
2593
+ var filename = temp[temp.length - 1];
2594
+ var filenameWithoutSuffix = filename.split(/#|\?/)[0];
2595
+ return (/\.[^./\\]*$/.exec(filenameWithoutSuffix) || [''])[0];
2596
+ };
2597
+
2598
+ var isImageFileType = function isImageFileType(type) {
2599
+ return !!type && type.indexOf('image/') === 0;
2600
+ };
2601
+
2602
+ var isImageUrl = function isImageUrl(file) {
2603
+ if (isImageFileType(file.type)) {
2604
+ return true;
2605
+ }
2606
+
2607
+ var url = file.thumbUrl || file.url;
2608
+ var extension = extname(url);
2609
+
2610
+ if (/^data:image\//.test(url) || /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i.test(extension)) {
2611
+ return true;
2612
+ }
2613
+
2614
+ if (/^data:/.test(url)) {
2615
+ // other file types of base64
2616
+ return false;
2617
+ }
2618
+
2619
+ if (extension) {
2620
+ // other file types which have extension
2621
+ return false;
2622
+ }
2623
+
2624
+ return true;
2625
+ };
2626
+ var MEASURE_SIZE = 200;
2627
+ function previewImage(file) {
2628
+ return new Promise(function (resolve) {
2629
+ if (!isImageFileType(file.type)) {
2630
+ resolve('');
2631
+ return;
2632
+ }
2633
+
2634
+ var canvas = document.createElement('canvas');
2635
+ canvas.width = MEASURE_SIZE;
2636
+ canvas.height = MEASURE_SIZE;
2637
+ canvas.style.cssText = "position: fixed; left: 0; top: 0; width: ".concat(MEASURE_SIZE, "px; height: ").concat(MEASURE_SIZE, "px; z-index: 9999; display: none;");
2638
+ document.body.appendChild(canvas);
2639
+ var ctx = canvas.getContext('2d');
2640
+ var img = new Image();
2641
+
2642
+ img.onload = function () {
2643
+ var width = img.width,
2644
+ height = img.height;
2645
+ var drawWidth = MEASURE_SIZE;
2646
+ var drawHeight = MEASURE_SIZE;
2647
+ var offsetX = 0;
2648
+ var offsetY = 0;
2649
+
2650
+ if (width < height) {
2651
+ drawHeight = height * (MEASURE_SIZE / width);
2652
+ offsetY = -(drawHeight - drawWidth) / 2;
2653
+ } else {
2654
+ drawWidth = width * (MEASURE_SIZE / height);
2655
+ offsetX = -(drawWidth - drawHeight) / 2;
2656
+ }
2657
+
2658
+ ctx.drawImage(img, offsetX, offsetY, drawWidth, drawHeight);
2659
+ var dataURL = canvas.toDataURL();
2660
+ document.body.removeChild(canvas);
2661
+ resolve(dataURL);
2662
+ };
2663
+
2664
+ img.src = window.URL.createObjectURL(file);
2665
+ });
2666
+ }
2667
+
2668
+ function _typeof$2(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$2 = function _typeof(obj) { return typeof obj; }; } else { _typeof$2 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$2(obj); }
2669
+
2670
+ function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2671
+
2672
+ function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
2673
+
2674
+ function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2675
+
2676
+ function _defineProperties$2(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
2677
+
2678
+ function _createClass$2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); return Constructor; }
2679
+
2680
+ function _inherits$2(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf$2(subClass, superClass); }
2681
+
2682
+ function _setPrototypeOf$2(o, p) { _setPrototypeOf$2 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$2(o, p); }
2683
+
2684
+ function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf$2(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$2(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$2(this, result); }; }
2685
+
2686
+ function _possibleConstructorReturn$2(self, call) { if (call && (_typeof$2(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$2(self); }
2687
+
2688
+ function _assertThisInitialized$2(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
2689
+
2690
+ function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
2691
+
2692
+ function _getPrototypeOf$2(o) { _getPrototypeOf$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$2(o); }
2693
+
2694
+ var UploadList = /*#__PURE__*/function (_React$Component) {
2695
+ _inherits$2(UploadList, _React$Component);
2696
+
2697
+ var _super = _createSuper$2(UploadList);
2698
+
2699
+ function UploadList() {
2700
+ var _this;
2701
+
2702
+ _classCallCheck$2(this, UploadList);
2703
+
2704
+ _this = _super.apply(this, arguments);
2705
+
2706
+ _this.handlePreview = function (file, e) {
2707
+ var onPreview = _this.props.onPreview;
2708
+
2709
+ if (!onPreview) {
2710
+ return;
2711
+ }
2712
+
2713
+ e.preventDefault();
2714
+ return onPreview(file);
2715
+ };
2716
+
2717
+ _this.handleDownload = function (file) {
2718
+ var onDownload = _this.props.onDownload;
2719
+
2720
+ if (typeof onDownload === 'function') {
2721
+ onDownload(file);
2722
+ } else if (file.url) {
2723
+ window.open(file.url);
2724
+ }
2725
+ };
2726
+
2727
+ _this.handleClose = function (file) {
2728
+ var onRemove = _this.props.onRemove;
2729
+
2730
+ if (onRemove) {
2731
+ onRemove(file);
2732
+ }
2733
+ };
2734
+
2735
+ _this.renderUploadList = function (_ref) {
2736
+ var _classNames4;
2737
+
2738
+ var getPrefixCls = _ref.getPrefixCls;
2739
+ var _this$props = _this.props,
2740
+ customizePrefixCls = _this$props.prefixCls,
2741
+ _this$props$items = _this$props.items,
2742
+ items = _this$props$items === void 0 ? [] : _this$props$items,
2743
+ listType = _this$props.listType,
2744
+ showPreviewIcon = _this$props.showPreviewIcon,
2745
+ showRemoveIcon = _this$props.showRemoveIcon,
2746
+ showDownloadIcon = _this$props.showDownloadIcon,
2747
+ locale = _this$props.locale,
2748
+ progressAttr = _this$props.progressAttr;
2749
+ var prefixCls = getPrefixCls('upload', customizePrefixCls);
2750
+ var list = items.map(function (file) {
2751
+ var _classNames, _classNames2;
2752
+
2753
+ var progress;
2754
+ var icon = /*#__PURE__*/React.createElement(Icon, {
2755
+ type: file.status === 'uploading' ? 'loading' : 'paper-clip'
2756
+ });
2757
+
2758
+ if (listType === 'picture' || listType === 'picture-card') {
2759
+ if (listType === 'picture-card' && file.status === 'uploading') {
2760
+ icon = /*#__PURE__*/React.createElement("div", {
2761
+ className: "".concat(prefixCls, "-list-item-uploading-text")
2762
+ }, locale.uploading);
2763
+ } else if (!file.thumbUrl && !file.url) {
2764
+ icon = /*#__PURE__*/React.createElement(Icon, {
2765
+ className: "".concat(prefixCls, "-list-item-thumbnail"),
2766
+ type: "picture",
2767
+ theme: "twoTone"
2768
+ });
2769
+ } else {
2770
+ var thumbnail = isImageUrl(file) ? /*#__PURE__*/React.createElement("img", {
2771
+ src: file.thumbUrl || file.url,
2772
+ alt: file.name,
2773
+ className: "".concat(prefixCls, "-list-item-image")
2774
+ }) : /*#__PURE__*/React.createElement(Icon, {
2775
+ type: "file",
2776
+ className: "".concat(prefixCls, "-list-item-icon"),
2777
+ theme: "twoTone"
2778
+ });
2779
+ icon = /*#__PURE__*/React.createElement("a", {
2780
+ className: "".concat(prefixCls, "-list-item-thumbnail"),
2781
+ onClick: function onClick(e) {
2782
+ return _this.handlePreview(file, e);
2783
+ },
2784
+ href: file.url || file.thumbUrl,
2785
+ target: "_blank",
2786
+ rel: "noopener noreferrer"
2787
+ }, thumbnail);
2788
+ }
2789
+ }
2790
+
2791
+ if (file.status === 'uploading') {
2792
+ // show loading icon if upload progress listener is disabled
2793
+ var loadingProgress = 'percent' in file ? /*#__PURE__*/React.createElement(Progress, _extends$2({
2794
+ type: "line"
2795
+ }, progressAttr, {
2796
+ percent: file.percent
2797
+ })) : null;
2798
+ progress = /*#__PURE__*/React.createElement("div", {
2799
+ className: "".concat(prefixCls, "-list-item-progress"),
2800
+ key: "progress"
2801
+ }, loadingProgress);
2802
+ }
2803
+
2804
+ var infoUploadingClass = classNames((_classNames = {}, _defineProperty$1(_classNames, "".concat(prefixCls, "-list-item"), true), _defineProperty$1(_classNames, "".concat(prefixCls, "-list-item-").concat(file.status), true), _defineProperty$1(_classNames, "".concat(prefixCls, "-list-item-list-type-").concat(listType), true), _classNames));
2805
+ var linkProps = typeof file.linkProps === 'string' ? JSON.parse(file.linkProps) : file.linkProps;
2806
+ var removeIcon = showRemoveIcon ? /*#__PURE__*/React.createElement(Icon, {
2807
+ type: "delete",
2808
+ title: locale.removeFile,
2809
+ onClick: function onClick() {
2810
+ return _this.handleClose(file);
2811
+ }
2812
+ }) : null;
2813
+ var downloadIcon = showDownloadIcon && file.status === 'done' ? /*#__PURE__*/React.createElement(Icon, {
2814
+ type: "download",
2815
+ title: locale.downloadFile,
2816
+ onClick: function onClick() {
2817
+ return _this.handleDownload(file);
2818
+ }
2819
+ }) : null;
2820
+ var downloadOrDelete = listType !== 'picture-card' && /*#__PURE__*/React.createElement("span", {
2821
+ key: "download-delete",
2822
+ className: "".concat(prefixCls, "-list-item-card-actions ").concat(listType === 'picture' ? 'picture' : '')
2823
+ }, downloadIcon && /*#__PURE__*/React.createElement("a", {
2824
+ title: locale.downloadFile
2825
+ }, downloadIcon), removeIcon && /*#__PURE__*/React.createElement("a", {
2826
+ title: locale.removeFile
2827
+ }, removeIcon));
2828
+ var listItemNameClass = classNames((_classNames2 = {}, _defineProperty$1(_classNames2, "".concat(prefixCls, "-list-item-name"), true), _defineProperty$1(_classNames2, "".concat(prefixCls, "-list-item-name-icon-count-").concat([downloadIcon, removeIcon].filter(function (x) {
2829
+ return x;
2830
+ }).length), true), _classNames2));
2831
+ var preview = file.url ? [/*#__PURE__*/React.createElement("a", _extends$2({
2832
+ key: "view",
2833
+ target: "_blank",
2834
+ rel: "noopener noreferrer",
2835
+ className: listItemNameClass,
2836
+ title: file.name
2837
+ }, linkProps, {
2838
+ href: file.url,
2839
+ onClick: function onClick(e) {
2840
+ return _this.handlePreview(file, e);
2841
+ }
2842
+ }), file.name), downloadOrDelete] : [/*#__PURE__*/React.createElement("span", {
2843
+ key: "view",
2844
+ className: listItemNameClass,
2845
+ onClick: function onClick(e) {
2846
+ return _this.handlePreview(file, e);
2847
+ },
2848
+ title: file.name
2849
+ }, file.name), downloadOrDelete];
2850
+ var style = {
2851
+ pointerEvents: 'none',
2852
+ opacity: 0.5
2853
+ };
2854
+ var previewIcon = showPreviewIcon ? /*#__PURE__*/React.createElement("a", {
2855
+ href: file.url || file.thumbUrl,
2856
+ target: "_blank",
2857
+ rel: "noopener noreferrer",
2858
+ style: file.url || file.thumbUrl ? undefined : style,
2859
+ onClick: function onClick(e) {
2860
+ return _this.handlePreview(file, e);
2861
+ },
2862
+ title: locale.previewFile
2863
+ }, /*#__PURE__*/React.createElement(Icon, {
2864
+ type: "eye-o"
2865
+ })) : null;
2866
+ var actions = listType === 'picture-card' && file.status !== 'uploading' && /*#__PURE__*/React.createElement("span", {
2867
+ className: "".concat(prefixCls, "-list-item-actions")
2868
+ }, previewIcon, file.status === 'done' && downloadIcon, removeIcon);
2869
+ var message;
2870
+
2871
+ if (file.response && typeof file.response === 'string') {
2872
+ message = file.response;
2873
+ } else {
2874
+ message = file.error && file.error.statusText || locale.uploadError;
2875
+ }
2876
+
2877
+ var iconAndPreview = /*#__PURE__*/React.createElement("span", null, icon, preview);
2878
+ var dom = /*#__PURE__*/React.createElement("div", {
2879
+ className: infoUploadingClass
2880
+ }, /*#__PURE__*/React.createElement("div", {
2881
+ className: "".concat(prefixCls, "-list-item-info")
2882
+ }, iconAndPreview), actions, /*#__PURE__*/React.createElement(Animate, {
2883
+ transitionName: "fade",
2884
+ component: ""
2885
+ }, progress));
2886
+ var listContainerNameClass = classNames(_defineProperty$1({}, "".concat(prefixCls, "-list-picture-card-container"), listType === 'picture-card'));
2887
+ return /*#__PURE__*/React.createElement("div", {
2888
+ key: file.uid,
2889
+ className: listContainerNameClass
2890
+ }, file.status === 'error' ? /*#__PURE__*/React.createElement(Tooltip, {
2891
+ title: message
2892
+ }, dom) : /*#__PURE__*/React.createElement("span", null, dom));
2893
+ });
2894
+ var listClassNames = classNames((_classNames4 = {}, _defineProperty$1(_classNames4, "".concat(prefixCls, "-list"), true), _defineProperty$1(_classNames4, "".concat(prefixCls, "-list-").concat(listType), true), _classNames4));
2895
+ var animationDirection = listType === 'picture-card' ? 'animate-inline' : 'animate';
2896
+ return /*#__PURE__*/React.createElement(Animate, {
2897
+ transitionName: "".concat(prefixCls, "-").concat(animationDirection),
2898
+ component: "div",
2899
+ className: listClassNames
2900
+ }, list);
2901
+ };
2902
+
2903
+ return _this;
2904
+ }
2905
+
2906
+ _createClass$2(UploadList, [{
2907
+ key: "componentDidUpdate",
2908
+ value: function componentDidUpdate() {
2909
+ var _this2 = this;
2910
+
2911
+ var _this$props2 = this.props,
2912
+ listType = _this$props2.listType,
2913
+ items = _this$props2.items,
2914
+ previewFile = _this$props2.previewFile;
2915
+
2916
+ if (listType !== 'picture' && listType !== 'picture-card') {
2917
+ return;
2918
+ }
2919
+
2920
+ (items || []).forEach(function (file) {
2921
+ if (typeof document === 'undefined' || typeof window === 'undefined' || !window.FileReader || !window.File || !(file.originFileObj instanceof File || file.originFileObj instanceof Blob) || file.thumbUrl !== undefined) {
2922
+ return;
2923
+ }
2924
+
2925
+ file.thumbUrl = '';
2926
+
2927
+ if (previewFile) {
2928
+ previewFile(file.originFileObj).then(function (previewDataUrl) {
2929
+ // Need append '' to avoid dead loop
2930
+ file.thumbUrl = previewDataUrl || '';
2931
+
2932
+ _this2.forceUpdate();
2933
+ });
2934
+ }
2935
+ });
2936
+ }
2937
+ }, {
2938
+ key: "render",
2939
+ value: function render() {
2940
+ return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderUploadList);
2941
+ }
2942
+ }]);
2943
+
2944
+ return UploadList;
2945
+ }(React.Component);
2946
+ UploadList.defaultProps = {
2947
+ listType: 'text',
2948
+ progressAttr: {
2949
+ strokeWidth: 2,
2950
+ showInfo: false
2951
+ },
2952
+ showRemoveIcon: true,
2953
+ showDownloadIcon: false,
2954
+ showPreviewIcon: true,
2955
+ previewFile: previewImage
2956
+ };
2957
+
2958
+ function _typeof$1(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); }
2959
+
2960
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2961
+
2962
+ function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
2963
+
2964
+ function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2965
+
2966
+ function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
2967
+
2968
+ function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
2969
+
2970
+ function _inherits$1(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf$1(subClass, superClass); }
2971
+
2972
+ function _setPrototypeOf$1(o, p) { _setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$1(o, p); }
2973
+
2974
+ function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf$1(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$1(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$1(this, result); }; }
2975
+
2976
+ function _possibleConstructorReturn$1(self, call) { if (call && (_typeof$1(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$1(self); }
2977
+
2978
+ function _assertThisInitialized$1(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
2979
+
2980
+ function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
2981
+
2982
+ function _getPrototypeOf$1(o) { _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$1(o); }
2983
+
2984
+ var Upload = /*#__PURE__*/function (_React$Component) {
2985
+ _inherits$1(Upload, _React$Component);
2986
+
2987
+ var _super = _createSuper$1(Upload);
2988
+
2989
+ function Upload(props) {
2990
+ var _this;
2991
+
2992
+ _classCallCheck$1(this, Upload);
2993
+
2994
+ _this = _super.call(this, props);
2995
+
2996
+ _this.saveUpload = function (node) {
2997
+ _this.upload = node;
2998
+ };
2999
+
3000
+ _this.onStart = function (file) {
3001
+ var fileList = _this.state.fileList;
3002
+ var targetItem = fileToObject(file);
3003
+ targetItem.status = 'uploading';
3004
+ var nextFileList = fileList.concat();
3005
+ var fileIndex = findIndex(nextFileList, function (_ref) {
3006
+ var uid = _ref.uid;
3007
+ return uid === targetItem.uid;
3008
+ });
3009
+
3010
+ if (fileIndex === -1) {
3011
+ nextFileList.push(targetItem);
3012
+ } else {
3013
+ nextFileList[fileIndex] = targetItem;
3014
+ }
3015
+
3016
+ _this.onChange({
3017
+ file: targetItem,
3018
+ fileList: nextFileList
3019
+ }); // fix ie progress
3020
+
3021
+
3022
+ {
3023
+ _this.autoUpdateProgress(0, targetItem);
3024
+ }
3025
+ };
3026
+
3027
+ _this.onSuccess = function (response, file, xhr) {
3028
+ _this.clearProgressTimer();
3029
+
3030
+ try {
3031
+ if (typeof response === 'string') {
3032
+ response = JSON.parse(response);
3033
+ }
3034
+ } catch (e) {
3035
+ /* do nothing */
3036
+ }
3037
+
3038
+ var fileList = _this.state.fileList;
3039
+ var targetItem = getFileItem(file, fileList); // removed
3040
+
3041
+ if (!targetItem) {
3042
+ return;
3043
+ }
3044
+
3045
+ targetItem.status = 'done';
3046
+ targetItem.response = response;
3047
+ targetItem.xhr = xhr;
3048
+
3049
+ _this.onChange({
3050
+ file: _extends$1({}, targetItem),
3051
+ fileList: fileList
3052
+ });
3053
+ };
3054
+
3055
+ _this.onProgress = function (e, file) {
3056
+ var fileList = _this.state.fileList;
3057
+ var targetItem = getFileItem(file, fileList); // removed
3058
+
3059
+ if (!targetItem) {
3060
+ return;
3061
+ }
3062
+
3063
+ targetItem.percent = e.percent;
3064
+
3065
+ _this.onChange({
3066
+ event: e,
3067
+ file: _extends$1({}, targetItem),
3068
+ fileList: fileList
3069
+ });
3070
+ };
3071
+
3072
+ _this.onError = function (error, response, file) {
3073
+ _this.clearProgressTimer();
3074
+
3075
+ var fileList = _this.state.fileList;
3076
+ var targetItem = getFileItem(file, fileList); // removed
3077
+
3078
+ if (!targetItem) {
3079
+ return;
3080
+ }
3081
+
3082
+ targetItem.error = error;
3083
+ targetItem.response = response;
3084
+ targetItem.status = 'error';
3085
+
3086
+ _this.onChange({
3087
+ file: _extends$1({}, targetItem),
3088
+ fileList: fileList
3089
+ });
3090
+ };
3091
+
3092
+ _this.handleRemove = function (file) {
3093
+ var onRemove = _this.props.onRemove;
3094
+ var fileList = _this.state.fileList;
3095
+ Promise.resolve(typeof onRemove === 'function' ? onRemove(file) : onRemove).then(function (ret) {
3096
+ // Prevent removing file
3097
+ if (ret === false) {
3098
+ return;
3099
+ }
3100
+
3101
+ var removedFileList = removeFileItem(file, fileList);
3102
+
3103
+ if (removedFileList) {
3104
+ file.status = 'removed'; // eslint-disable-line
3105
+
3106
+ if (_this.upload) {
3107
+ _this.upload.abort(file);
3108
+ }
3109
+
3110
+ _this.onChange({
3111
+ file: file,
3112
+ fileList: removedFileList
3113
+ });
3114
+ }
3115
+ });
3116
+ };
3117
+
3118
+ _this.onChange = function (info) {
3119
+ if (!('fileList' in _this.props)) {
3120
+ _this.setState({
3121
+ fileList: info.fileList
3122
+ });
3123
+ }
3124
+
3125
+ var onChange = _this.props.onChange;
3126
+
3127
+ if (onChange) {
3128
+ onChange(info);
3129
+ }
3130
+ };
3131
+
3132
+ _this.onFileDrop = function (e) {
3133
+ _this.setState({
3134
+ dragState: e.type
3135
+ });
3136
+ };
3137
+
3138
+ _this.beforeUpload = function (file, fileList) {
3139
+ var beforeUpload = _this.props.beforeUpload;
3140
+ var stateFileList = _this.state.fileList;
3141
+
3142
+ if (!beforeUpload) {
3143
+ return true;
3144
+ }
3145
+
3146
+ var result = beforeUpload(file, fileList);
3147
+
3148
+ if (result === false) {
3149
+ _this.onChange({
3150
+ file: file,
3151
+ fileList: uniqBy(stateFileList.concat(fileList.map(fileToObject)), function (item) {
3152
+ return item.uid;
3153
+ })
3154
+ });
3155
+
3156
+ return false;
3157
+ }
3158
+
3159
+ if (result && result.then) {
3160
+ return result;
3161
+ }
3162
+
3163
+ return true;
3164
+ };
3165
+
3166
+ _this.renderUploadList = function (locale) {
3167
+ var _this$props = _this.props,
3168
+ showUploadList = _this$props.showUploadList,
3169
+ listType = _this$props.listType,
3170
+ onPreview = _this$props.onPreview,
3171
+ onDownload = _this$props.onDownload,
3172
+ previewFile = _this$props.previewFile,
3173
+ disabled = _this$props.disabled,
3174
+ propLocale = _this$props.locale;
3175
+ var showRemoveIcon = showUploadList.showRemoveIcon,
3176
+ showPreviewIcon = showUploadList.showPreviewIcon,
3177
+ showDownloadIcon = showUploadList.showDownloadIcon;
3178
+ var fileList = _this.state.fileList;
3179
+ return /*#__PURE__*/React.createElement(UploadList, {
3180
+ listType: listType,
3181
+ items: fileList,
3182
+ previewFile: previewFile,
3183
+ onPreview: onPreview,
3184
+ onDownload: onDownload,
3185
+ onRemove: _this.handleRemove,
3186
+ showRemoveIcon: !disabled && showRemoveIcon,
3187
+ showPreviewIcon: showPreviewIcon,
3188
+ showDownloadIcon: showDownloadIcon,
3189
+ locale: _extends$1(_extends$1({}, locale), propLocale)
3190
+ });
3191
+ };
3192
+
3193
+ _this.renderUpload = function (_ref2) {
3194
+ var _classNames2;
3195
+
3196
+ var getPrefixCls = _ref2.getPrefixCls;
3197
+ var _this$props2 = _this.props,
3198
+ customizePrefixCls = _this$props2.prefixCls,
3199
+ className = _this$props2.className,
3200
+ showUploadList = _this$props2.showUploadList,
3201
+ listType = _this$props2.listType,
3202
+ type = _this$props2.type,
3203
+ disabled = _this$props2.disabled,
3204
+ children = _this$props2.children,
3205
+ style = _this$props2.style;
3206
+ var _this$state = _this.state,
3207
+ fileList = _this$state.fileList,
3208
+ dragState = _this$state.dragState;
3209
+ var prefixCls = getPrefixCls('upload', customizePrefixCls);
3210
+
3211
+ var rcUploadProps = _extends$1(_extends$1({
3212
+ onStart: _this.onStart,
3213
+ onError: _this.onError,
3214
+ onProgress: _this.onProgress,
3215
+ onSuccess: _this.onSuccess
3216
+ }, _this.props), {
3217
+ prefixCls: prefixCls,
3218
+ beforeUpload: _this.beforeUpload
3219
+ });
3220
+
3221
+ delete rcUploadProps.className;
3222
+ delete rcUploadProps.style; // Remove id to avoid open by label when trigger is hidden
3223
+ // !children: https://github.com/ant-design/ant-design/issues/14298
3224
+ // disabled: https://github.com/ant-design/ant-design/issues/16478
3225
+ // https://github.com/ant-design/ant-design/issues/24197
3226
+
3227
+ if (!children || disabled) {
3228
+ delete rcUploadProps.id;
3229
+ }
3230
+
3231
+ var uploadList = showUploadList ? /*#__PURE__*/React.createElement(LocaleReceiver, {
3232
+ componentName: "Upload",
3233
+ defaultLocale: defaultLocale.Upload
3234
+ }, _this.renderUploadList) : null;
3235
+
3236
+ if (type === 'drag') {
3237
+ var _classNames;
3238
+
3239
+ var dragCls = classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-drag"), true), _defineProperty(_classNames, "".concat(prefixCls, "-drag-uploading"), fileList.some(function (file) {
3240
+ return file.status === 'uploading';
3241
+ })), _defineProperty(_classNames, "".concat(prefixCls, "-drag-hover"), dragState === 'dragover'), _defineProperty(_classNames, "".concat(prefixCls, "-disabled"), disabled), _classNames), className);
3242
+ return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("div", {
3243
+ className: dragCls,
3244
+ onDrop: _this.onFileDrop,
3245
+ onDragOver: _this.onFileDrop,
3246
+ onDragLeave: _this.onFileDrop,
3247
+ style: style
3248
+ }, /*#__PURE__*/React.createElement(Upload$1, _extends$1({}, rcUploadProps, {
3249
+ ref: _this.saveUpload,
3250
+ className: "".concat(prefixCls, "-btn")
3251
+ }), /*#__PURE__*/React.createElement("div", {
3252
+ className: "".concat(prefixCls, "-drag-container")
3253
+ }, children))), uploadList);
3254
+ }
3255
+
3256
+ var uploadButtonCls = classNames(prefixCls, (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-select"), true), _defineProperty(_classNames2, "".concat(prefixCls, "-select-").concat(listType), true), _defineProperty(_classNames2, "".concat(prefixCls, "-disabled"), disabled), _classNames2));
3257
+ var uploadButton = /*#__PURE__*/React.createElement("div", {
3258
+ className: uploadButtonCls,
3259
+ style: children ? undefined : {
3260
+ display: 'none'
3261
+ }
3262
+ }, /*#__PURE__*/React.createElement(Upload$1, _extends$1({}, rcUploadProps, {
3263
+ ref: _this.saveUpload
3264
+ })));
3265
+
3266
+ if (listType === 'picture-card') {
3267
+ return /*#__PURE__*/React.createElement("span", {
3268
+ className: classNames(className, "".concat(prefixCls, "-picture-card-wrapper"))
3269
+ }, uploadList, uploadButton);
3270
+ }
3271
+
3272
+ return /*#__PURE__*/React.createElement("span", {
3273
+ className: className
3274
+ }, uploadButton, uploadList);
3275
+ };
3276
+
3277
+ _this.state = {
3278
+ fileList: props.fileList || props.defaultFileList || [],
3279
+ dragState: 'drop'
3280
+ };
3281
+ return _this;
3282
+ }
3283
+
3284
+ _createClass$1(Upload, [{
3285
+ key: "componentWillUnmount",
3286
+ value: function componentWillUnmount() {
3287
+ this.clearProgressTimer();
3288
+ }
3289
+ }, {
3290
+ key: "clearProgressTimer",
3291
+ value: function clearProgressTimer() {
3292
+ clearInterval(this.progressTimer);
3293
+ }
3294
+ }, {
3295
+ key: "autoUpdateProgress",
3296
+ value: function autoUpdateProgress(_, file) {
3297
+ var _this2 = this;
3298
+
3299
+ var getPercent = genPercentAdd();
3300
+ var curPercent = 0;
3301
+ this.clearProgressTimer();
3302
+ this.progressTimer = setInterval(function () {
3303
+ curPercent = getPercent(curPercent);
3304
+
3305
+ _this2.onProgress({
3306
+ percent: curPercent * 100
3307
+ }, file);
3308
+ }, 200);
3309
+ }
3310
+ }, {
3311
+ key: "render",
3312
+ value: function render() {
3313
+ return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderUpload);
3314
+ }
3315
+ }], [{
3316
+ key: "getDerivedStateFromProps",
3317
+ value: function getDerivedStateFromProps(nextProps) {
3318
+ if ('fileList' in nextProps) {
3319
+ return {
3320
+ fileList: nextProps.fileList || []
3321
+ };
3322
+ }
3323
+
3324
+ return null;
3325
+ }
3326
+ }]);
3327
+
3328
+ return Upload;
3329
+ }(React.Component);
3330
+
3331
+ Upload.defaultProps = {
3332
+ type: 'select',
3333
+ multiple: false,
3334
+ action: '',
3335
+ data: {},
3336
+ accept: '',
3337
+ beforeUpload: T,
3338
+ showUploadList: true,
3339
+ listType: 'text',
3340
+ className: '',
3341
+ disabled: false,
3342
+ supportServerRender: true
3343
+ };
3344
+ polyfill(Upload);
3345
+
3346
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3347
+
3348
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3349
+
3350
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3351
+
3352
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
3353
+
3354
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); return Constructor; }
3355
+
3356
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
3357
+
3358
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
3359
+
3360
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
3361
+
3362
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
3363
+
3364
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
3365
+
3366
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
3367
+
3368
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
3369
+
3370
+ var __rest = undefined && undefined.__rest || function (s, e) {
3371
+ var t = {};
3372
+
3373
+ for (var p in s) {
3374
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
3375
+ }
3376
+
3377
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
3378
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
3379
+ }
3380
+ return t;
3381
+ };
3382
+ // https://github.com/ant-design/ant-design/issues/18707
3383
+ // eslint-disable-next-line react/prefer-stateless-function
3384
+
3385
+ var Dragger = /*#__PURE__*/function (_React$Component) {
3386
+ _inherits(Dragger, _React$Component);
3387
+
3388
+ var _super = _createSuper(Dragger);
3389
+
3390
+ function Dragger() {
3391
+ _classCallCheck(this, Dragger);
3392
+
3393
+ return _super.apply(this, arguments);
3394
+ }
3395
+
3396
+ _createClass(Dragger, [{
3397
+ key: "render",
3398
+ value: function render() {
3399
+ var _a = this.props,
3400
+ style = _a.style,
3401
+ height = _a.height,
3402
+ restProps = __rest(_a, ["style", "height"]);
3403
+
3404
+ return /*#__PURE__*/React.createElement(Upload, _extends({}, restProps, {
3405
+ type: "drag",
3406
+ style: _extends(_extends({}, style), {
3407
+ height: height
3408
+ })
3409
+ }));
3410
+ }
3411
+ }]);
3412
+
3413
+ return Dragger;
3414
+ }(React.Component);
3415
+
3416
+ Upload.Dragger = Dragger;
3417
+
3418
+ export { Upload as default };