cleavejs-rails 1.3.7

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 (258) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +16 -0
  3. data/lib/cleavejs-rails.rb +7 -0
  4. data/vendor/assets/javascripts/addons/cleave-phone.ac.js +51 -0
  5. data/vendor/assets/javascripts/addons/cleave-phone.ad.js +51 -0
  6. data/vendor/assets/javascripts/addons/cleave-phone.ae.js +51 -0
  7. data/vendor/assets/javascripts/addons/cleave-phone.af.js +51 -0
  8. data/vendor/assets/javascripts/addons/cleave-phone.ag.js +51 -0
  9. data/vendor/assets/javascripts/addons/cleave-phone.ai.js +51 -0
  10. data/vendor/assets/javascripts/addons/cleave-phone.al.js +51 -0
  11. data/vendor/assets/javascripts/addons/cleave-phone.am.js +51 -0
  12. data/vendor/assets/javascripts/addons/cleave-phone.ao.js +51 -0
  13. data/vendor/assets/javascripts/addons/cleave-phone.ar.js +51 -0
  14. data/vendor/assets/javascripts/addons/cleave-phone.as.js +51 -0
  15. data/vendor/assets/javascripts/addons/cleave-phone.at.js +51 -0
  16. data/vendor/assets/javascripts/addons/cleave-phone.au-cn.js +85 -0
  17. data/vendor/assets/javascripts/addons/cleave-phone.au.js +51 -0
  18. data/vendor/assets/javascripts/addons/cleave-phone.aw.js +51 -0
  19. data/vendor/assets/javascripts/addons/cleave-phone.ax.js +51 -0
  20. data/vendor/assets/javascripts/addons/cleave-phone.az.js +51 -0
  21. data/vendor/assets/javascripts/addons/cleave-phone.ba.js +51 -0
  22. data/vendor/assets/javascripts/addons/cleave-phone.bb.js +51 -0
  23. data/vendor/assets/javascripts/addons/cleave-phone.bd.js +51 -0
  24. data/vendor/assets/javascripts/addons/cleave-phone.be.js +51 -0
  25. data/vendor/assets/javascripts/addons/cleave-phone.bf.js +51 -0
  26. data/vendor/assets/javascripts/addons/cleave-phone.bg.js +51 -0
  27. data/vendor/assets/javascripts/addons/cleave-phone.bh.js +51 -0
  28. data/vendor/assets/javascripts/addons/cleave-phone.bi.js +51 -0
  29. data/vendor/assets/javascripts/addons/cleave-phone.bj.js +51 -0
  30. data/vendor/assets/javascripts/addons/cleave-phone.bl.js +51 -0
  31. data/vendor/assets/javascripts/addons/cleave-phone.bm.js +51 -0
  32. data/vendor/assets/javascripts/addons/cleave-phone.bn.js +51 -0
  33. data/vendor/assets/javascripts/addons/cleave-phone.bo.js +51 -0
  34. data/vendor/assets/javascripts/addons/cleave-phone.bq.js +51 -0
  35. data/vendor/assets/javascripts/addons/cleave-phone.br.js +51 -0
  36. data/vendor/assets/javascripts/addons/cleave-phone.bs.js +51 -0
  37. data/vendor/assets/javascripts/addons/cleave-phone.bt.js +51 -0
  38. data/vendor/assets/javascripts/addons/cleave-phone.bw.js +51 -0
  39. data/vendor/assets/javascripts/addons/cleave-phone.by.js +51 -0
  40. data/vendor/assets/javascripts/addons/cleave-phone.bz.js +51 -0
  41. data/vendor/assets/javascripts/addons/cleave-phone.ca.js +111 -0
  42. data/vendor/assets/javascripts/addons/cleave-phone.cc.js +51 -0
  43. data/vendor/assets/javascripts/addons/cleave-phone.cd.js +51 -0
  44. data/vendor/assets/javascripts/addons/cleave-phone.cf.js +51 -0
  45. data/vendor/assets/javascripts/addons/cleave-phone.cg.js +51 -0
  46. data/vendor/assets/javascripts/addons/cleave-phone.ch.js +51 -0
  47. data/vendor/assets/javascripts/addons/cleave-phone.ci.js +51 -0
  48. data/vendor/assets/javascripts/addons/cleave-phone.ck.js +51 -0
  49. data/vendor/assets/javascripts/addons/cleave-phone.cl.js +51 -0
  50. data/vendor/assets/javascripts/addons/cleave-phone.cm.js +51 -0
  51. data/vendor/assets/javascripts/addons/cleave-phone.cn.js +51 -0
  52. data/vendor/assets/javascripts/addons/cleave-phone.co.js +51 -0
  53. data/vendor/assets/javascripts/addons/cleave-phone.cr.js +51 -0
  54. data/vendor/assets/javascripts/addons/cleave-phone.cu.js +51 -0
  55. data/vendor/assets/javascripts/addons/cleave-phone.cv.js +51 -0
  56. data/vendor/assets/javascripts/addons/cleave-phone.cw.js +51 -0
  57. data/vendor/assets/javascripts/addons/cleave-phone.cx.js +51 -0
  58. data/vendor/assets/javascripts/addons/cleave-phone.cy.js +51 -0
  59. data/vendor/assets/javascripts/addons/cleave-phone.cz.js +51 -0
  60. data/vendor/assets/javascripts/addons/cleave-phone.de.js +51 -0
  61. data/vendor/assets/javascripts/addons/cleave-phone.dj.js +51 -0
  62. data/vendor/assets/javascripts/addons/cleave-phone.dk.js +51 -0
  63. data/vendor/assets/javascripts/addons/cleave-phone.dm.js +51 -0
  64. data/vendor/assets/javascripts/addons/cleave-phone.do.js +51 -0
  65. data/vendor/assets/javascripts/addons/cleave-phone.dz.js +51 -0
  66. data/vendor/assets/javascripts/addons/cleave-phone.ec.js +51 -0
  67. data/vendor/assets/javascripts/addons/cleave-phone.ee.js +51 -0
  68. data/vendor/assets/javascripts/addons/cleave-phone.eg.js +51 -0
  69. data/vendor/assets/javascripts/addons/cleave-phone.eh.js +51 -0
  70. data/vendor/assets/javascripts/addons/cleave-phone.er.js +51 -0
  71. data/vendor/assets/javascripts/addons/cleave-phone.es.js +51 -0
  72. data/vendor/assets/javascripts/addons/cleave-phone.et.js +51 -0
  73. data/vendor/assets/javascripts/addons/cleave-phone.fi.js +51 -0
  74. data/vendor/assets/javascripts/addons/cleave-phone.fj.js +51 -0
  75. data/vendor/assets/javascripts/addons/cleave-phone.fk.js +51 -0
  76. data/vendor/assets/javascripts/addons/cleave-phone.fm.js +51 -0
  77. data/vendor/assets/javascripts/addons/cleave-phone.fo.js +51 -0
  78. data/vendor/assets/javascripts/addons/cleave-phone.fr.js +51 -0
  79. data/vendor/assets/javascripts/addons/cleave-phone.ga.js +51 -0
  80. data/vendor/assets/javascripts/addons/cleave-phone.gb.js +51 -0
  81. data/vendor/assets/javascripts/addons/cleave-phone.gd.js +51 -0
  82. data/vendor/assets/javascripts/addons/cleave-phone.ge.js +51 -0
  83. data/vendor/assets/javascripts/addons/cleave-phone.gf.js +51 -0
  84. data/vendor/assets/javascripts/addons/cleave-phone.gg.js +51 -0
  85. data/vendor/assets/javascripts/addons/cleave-phone.gh.js +51 -0
  86. data/vendor/assets/javascripts/addons/cleave-phone.gi.js +51 -0
  87. data/vendor/assets/javascripts/addons/cleave-phone.gl.js +51 -0
  88. data/vendor/assets/javascripts/addons/cleave-phone.gm.js +51 -0
  89. data/vendor/assets/javascripts/addons/cleave-phone.gn.js +51 -0
  90. data/vendor/assets/javascripts/addons/cleave-phone.gp.js +51 -0
  91. data/vendor/assets/javascripts/addons/cleave-phone.gq.js +51 -0
  92. data/vendor/assets/javascripts/addons/cleave-phone.gr.js +51 -0
  93. data/vendor/assets/javascripts/addons/cleave-phone.gt.js +51 -0
  94. data/vendor/assets/javascripts/addons/cleave-phone.gu.js +51 -0
  95. data/vendor/assets/javascripts/addons/cleave-phone.gw.js +51 -0
  96. data/vendor/assets/javascripts/addons/cleave-phone.gy.js +51 -0
  97. data/vendor/assets/javascripts/addons/cleave-phone.hk.js +51 -0
  98. data/vendor/assets/javascripts/addons/cleave-phone.hn.js +51 -0
  99. data/vendor/assets/javascripts/addons/cleave-phone.hr.js +51 -0
  100. data/vendor/assets/javascripts/addons/cleave-phone.ht.js +51 -0
  101. data/vendor/assets/javascripts/addons/cleave-phone.hu.js +51 -0
  102. data/vendor/assets/javascripts/addons/cleave-phone.i18n.js +58 -0
  103. data/vendor/assets/javascripts/addons/cleave-phone.id.js +51 -0
  104. data/vendor/assets/javascripts/addons/cleave-phone.ie.js +51 -0
  105. data/vendor/assets/javascripts/addons/cleave-phone.il.js +51 -0
  106. data/vendor/assets/javascripts/addons/cleave-phone.im.js +51 -0
  107. data/vendor/assets/javascripts/addons/cleave-phone.in.js +51 -0
  108. data/vendor/assets/javascripts/addons/cleave-phone.io.js +51 -0
  109. data/vendor/assets/javascripts/addons/cleave-phone.iq.js +51 -0
  110. data/vendor/assets/javascripts/addons/cleave-phone.ir.js +51 -0
  111. data/vendor/assets/javascripts/addons/cleave-phone.is.js +51 -0
  112. data/vendor/assets/javascripts/addons/cleave-phone.it.js +51 -0
  113. data/vendor/assets/javascripts/addons/cleave-phone.je.js +51 -0
  114. data/vendor/assets/javascripts/addons/cleave-phone.jm.js +51 -0
  115. data/vendor/assets/javascripts/addons/cleave-phone.jo.js +51 -0
  116. data/vendor/assets/javascripts/addons/cleave-phone.jp.js +51 -0
  117. data/vendor/assets/javascripts/addons/cleave-phone.ke.js +51 -0
  118. data/vendor/assets/javascripts/addons/cleave-phone.kg.js +51 -0
  119. data/vendor/assets/javascripts/addons/cleave-phone.kh.js +51 -0
  120. data/vendor/assets/javascripts/addons/cleave-phone.ki.js +51 -0
  121. data/vendor/assets/javascripts/addons/cleave-phone.km.js +51 -0
  122. data/vendor/assets/javascripts/addons/cleave-phone.kn.js +51 -0
  123. data/vendor/assets/javascripts/addons/cleave-phone.kp.js +51 -0
  124. data/vendor/assets/javascripts/addons/cleave-phone.kr.js +51 -0
  125. data/vendor/assets/javascripts/addons/cleave-phone.kw.js +51 -0
  126. data/vendor/assets/javascripts/addons/cleave-phone.ky.js +51 -0
  127. data/vendor/assets/javascripts/addons/cleave-phone.kz.js +51 -0
  128. data/vendor/assets/javascripts/addons/cleave-phone.la.js +51 -0
  129. data/vendor/assets/javascripts/addons/cleave-phone.lb.js +51 -0
  130. data/vendor/assets/javascripts/addons/cleave-phone.lc.js +51 -0
  131. data/vendor/assets/javascripts/addons/cleave-phone.li.js +51 -0
  132. data/vendor/assets/javascripts/addons/cleave-phone.lk.js +51 -0
  133. data/vendor/assets/javascripts/addons/cleave-phone.lr.js +51 -0
  134. data/vendor/assets/javascripts/addons/cleave-phone.ls.js +51 -0
  135. data/vendor/assets/javascripts/addons/cleave-phone.lt.js +51 -0
  136. data/vendor/assets/javascripts/addons/cleave-phone.lu.js +51 -0
  137. data/vendor/assets/javascripts/addons/cleave-phone.lv.js +51 -0
  138. data/vendor/assets/javascripts/addons/cleave-phone.ly.js +51 -0
  139. data/vendor/assets/javascripts/addons/cleave-phone.ma.js +51 -0
  140. data/vendor/assets/javascripts/addons/cleave-phone.mc.js +51 -0
  141. data/vendor/assets/javascripts/addons/cleave-phone.md.js +51 -0
  142. data/vendor/assets/javascripts/addons/cleave-phone.me.js +51 -0
  143. data/vendor/assets/javascripts/addons/cleave-phone.mf.js +51 -0
  144. data/vendor/assets/javascripts/addons/cleave-phone.mg.js +51 -0
  145. data/vendor/assets/javascripts/addons/cleave-phone.mh.js +51 -0
  146. data/vendor/assets/javascripts/addons/cleave-phone.mk.js +51 -0
  147. data/vendor/assets/javascripts/addons/cleave-phone.ml.js +51 -0
  148. data/vendor/assets/javascripts/addons/cleave-phone.mm.js +51 -0
  149. data/vendor/assets/javascripts/addons/cleave-phone.mn.js +51 -0
  150. data/vendor/assets/javascripts/addons/cleave-phone.mo.js +51 -0
  151. data/vendor/assets/javascripts/addons/cleave-phone.mp.js +51 -0
  152. data/vendor/assets/javascripts/addons/cleave-phone.mq.js +51 -0
  153. data/vendor/assets/javascripts/addons/cleave-phone.mr.js +51 -0
  154. data/vendor/assets/javascripts/addons/cleave-phone.ms.js +51 -0
  155. data/vendor/assets/javascripts/addons/cleave-phone.mt.js +51 -0
  156. data/vendor/assets/javascripts/addons/cleave-phone.mu.js +51 -0
  157. data/vendor/assets/javascripts/addons/cleave-phone.mv.js +51 -0
  158. data/vendor/assets/javascripts/addons/cleave-phone.mw.js +51 -0
  159. data/vendor/assets/javascripts/addons/cleave-phone.mx.js +51 -0
  160. data/vendor/assets/javascripts/addons/cleave-phone.my.js +51 -0
  161. data/vendor/assets/javascripts/addons/cleave-phone.mz.js +51 -0
  162. data/vendor/assets/javascripts/addons/cleave-phone.na.js +51 -0
  163. data/vendor/assets/javascripts/addons/cleave-phone.nc.js +51 -0
  164. data/vendor/assets/javascripts/addons/cleave-phone.ne.js +51 -0
  165. data/vendor/assets/javascripts/addons/cleave-phone.nf.js +51 -0
  166. data/vendor/assets/javascripts/addons/cleave-phone.ng.js +51 -0
  167. data/vendor/assets/javascripts/addons/cleave-phone.ni.js +51 -0
  168. data/vendor/assets/javascripts/addons/cleave-phone.nl.js +51 -0
  169. data/vendor/assets/javascripts/addons/cleave-phone.no.js +51 -0
  170. data/vendor/assets/javascripts/addons/cleave-phone.np.js +51 -0
  171. data/vendor/assets/javascripts/addons/cleave-phone.nr.js +51 -0
  172. data/vendor/assets/javascripts/addons/cleave-phone.nu.js +51 -0
  173. data/vendor/assets/javascripts/addons/cleave-phone.nz.js +51 -0
  174. data/vendor/assets/javascripts/addons/cleave-phone.om.js +51 -0
  175. data/vendor/assets/javascripts/addons/cleave-phone.pa.js +51 -0
  176. data/vendor/assets/javascripts/addons/cleave-phone.pe.js +51 -0
  177. data/vendor/assets/javascripts/addons/cleave-phone.pf.js +51 -0
  178. data/vendor/assets/javascripts/addons/cleave-phone.pg.js +51 -0
  179. data/vendor/assets/javascripts/addons/cleave-phone.ph.js +51 -0
  180. data/vendor/assets/javascripts/addons/cleave-phone.pk.js +51 -0
  181. data/vendor/assets/javascripts/addons/cleave-phone.pl.js +51 -0
  182. data/vendor/assets/javascripts/addons/cleave-phone.pm.js +51 -0
  183. data/vendor/assets/javascripts/addons/cleave-phone.pr.js +51 -0
  184. data/vendor/assets/javascripts/addons/cleave-phone.ps.js +51 -0
  185. data/vendor/assets/javascripts/addons/cleave-phone.pt.js +51 -0
  186. data/vendor/assets/javascripts/addons/cleave-phone.pw.js +51 -0
  187. data/vendor/assets/javascripts/addons/cleave-phone.py.js +51 -0
  188. data/vendor/assets/javascripts/addons/cleave-phone.qa.js +51 -0
  189. data/vendor/assets/javascripts/addons/cleave-phone.re.js +51 -0
  190. data/vendor/assets/javascripts/addons/cleave-phone.ro.js +51 -0
  191. data/vendor/assets/javascripts/addons/cleave-phone.rs.js +51 -0
  192. data/vendor/assets/javascripts/addons/cleave-phone.ru.js +51 -0
  193. data/vendor/assets/javascripts/addons/cleave-phone.rw.js +51 -0
  194. data/vendor/assets/javascripts/addons/cleave-phone.sa.js +51 -0
  195. data/vendor/assets/javascripts/addons/cleave-phone.sb.js +51 -0
  196. data/vendor/assets/javascripts/addons/cleave-phone.sc.js +51 -0
  197. data/vendor/assets/javascripts/addons/cleave-phone.sd.js +51 -0
  198. data/vendor/assets/javascripts/addons/cleave-phone.se.js +51 -0
  199. data/vendor/assets/javascripts/addons/cleave-phone.sg.js +51 -0
  200. data/vendor/assets/javascripts/addons/cleave-phone.sh.js +51 -0
  201. data/vendor/assets/javascripts/addons/cleave-phone.si.js +51 -0
  202. data/vendor/assets/javascripts/addons/cleave-phone.sj.js +51 -0
  203. data/vendor/assets/javascripts/addons/cleave-phone.sk.js +51 -0
  204. data/vendor/assets/javascripts/addons/cleave-phone.sl.js +51 -0
  205. data/vendor/assets/javascripts/addons/cleave-phone.sm.js +51 -0
  206. data/vendor/assets/javascripts/addons/cleave-phone.sn.js +51 -0
  207. data/vendor/assets/javascripts/addons/cleave-phone.so.js +51 -0
  208. data/vendor/assets/javascripts/addons/cleave-phone.sr.js +51 -0
  209. data/vendor/assets/javascripts/addons/cleave-phone.ss.js +51 -0
  210. data/vendor/assets/javascripts/addons/cleave-phone.st.js +51 -0
  211. data/vendor/assets/javascripts/addons/cleave-phone.sv.js +51 -0
  212. data/vendor/assets/javascripts/addons/cleave-phone.sx.js +51 -0
  213. data/vendor/assets/javascripts/addons/cleave-phone.sy.js +51 -0
  214. data/vendor/assets/javascripts/addons/cleave-phone.sz.js +51 -0
  215. data/vendor/assets/javascripts/addons/cleave-phone.ta.js +51 -0
  216. data/vendor/assets/javascripts/addons/cleave-phone.tc.js +51 -0
  217. data/vendor/assets/javascripts/addons/cleave-phone.td.js +51 -0
  218. data/vendor/assets/javascripts/addons/cleave-phone.tg.js +51 -0
  219. data/vendor/assets/javascripts/addons/cleave-phone.th.js +51 -0
  220. data/vendor/assets/javascripts/addons/cleave-phone.tj.js +51 -0
  221. data/vendor/assets/javascripts/addons/cleave-phone.tk.js +51 -0
  222. data/vendor/assets/javascripts/addons/cleave-phone.tl.js +51 -0
  223. data/vendor/assets/javascripts/addons/cleave-phone.tm.js +51 -0
  224. data/vendor/assets/javascripts/addons/cleave-phone.tn.js +51 -0
  225. data/vendor/assets/javascripts/addons/cleave-phone.to.js +51 -0
  226. data/vendor/assets/javascripts/addons/cleave-phone.tr.js +51 -0
  227. data/vendor/assets/javascripts/addons/cleave-phone.tt.js +51 -0
  228. data/vendor/assets/javascripts/addons/cleave-phone.tv.js +51 -0
  229. data/vendor/assets/javascripts/addons/cleave-phone.tw.js +51 -0
  230. data/vendor/assets/javascripts/addons/cleave-phone.tz.js +51 -0
  231. data/vendor/assets/javascripts/addons/cleave-phone.ua.js +51 -0
  232. data/vendor/assets/javascripts/addons/cleave-phone.ug.js +51 -0
  233. data/vendor/assets/javascripts/addons/cleave-phone.us.js +51 -0
  234. data/vendor/assets/javascripts/addons/cleave-phone.uy.js +51 -0
  235. data/vendor/assets/javascripts/addons/cleave-phone.uz.js +51 -0
  236. data/vendor/assets/javascripts/addons/cleave-phone.va.js +51 -0
  237. data/vendor/assets/javascripts/addons/cleave-phone.vc.js +51 -0
  238. data/vendor/assets/javascripts/addons/cleave-phone.ve.js +51 -0
  239. data/vendor/assets/javascripts/addons/cleave-phone.vg.js +51 -0
  240. data/vendor/assets/javascripts/addons/cleave-phone.vi.js +51 -0
  241. data/vendor/assets/javascripts/addons/cleave-phone.vn.js +51 -0
  242. data/vendor/assets/javascripts/addons/cleave-phone.vu.js +51 -0
  243. data/vendor/assets/javascripts/addons/cleave-phone.wf.js +51 -0
  244. data/vendor/assets/javascripts/addons/cleave-phone.ws.js +51 -0
  245. data/vendor/assets/javascripts/addons/cleave-phone.ye.js +51 -0
  246. data/vendor/assets/javascripts/addons/cleave-phone.yt.js +51 -0
  247. data/vendor/assets/javascripts/addons/cleave-phone.za.js +51 -0
  248. data/vendor/assets/javascripts/addons/cleave-phone.zm.js +51 -0
  249. data/vendor/assets/javascripts/addons/cleave-phone.zw.js +51 -0
  250. data/vendor/assets/javascripts/cleave-angular.js +1292 -0
  251. data/vendor/assets/javascripts/cleave-angular.min.js +8 -0
  252. data/vendor/assets/javascripts/cleave-react-node.js +2443 -0
  253. data/vendor/assets/javascripts/cleave-react-node.min.js +8 -0
  254. data/vendor/assets/javascripts/cleave-react.js +2638 -0
  255. data/vendor/assets/javascripts/cleave-react.min.js +8 -0
  256. data/vendor/assets/javascripts/cleave.js +1235 -0
  257. data/vendor/assets/javascripts/cleave.min.js +8 -0
  258. metadata +343 -0
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * cleave.js - 1.3.7
3
+ * https://github.com/nosir/cleave.js
4
+ * Apache License Version 2.0
5
+ *
6
+ * Copyright (C) 2012-2018 Max Huang https://github.com/nosir/
7
+ */
8
+ !function(root,factory){"object"==typeof exports&&"object"==typeof module?module.exports=factory():"function"==typeof define&&define.amd?define([],factory):"object"==typeof exports?exports.Cleave=factory():root.Cleave=factory()}(this,function(){return function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:!1};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.p="",__webpack_require__(0)}([function(module,exports,__webpack_require__){(function(global){"use strict";var Cleave=function(element,opts){var owner=this;if("string"==typeof element?owner.element=document.querySelector(element):owner.element="undefined"!=typeof element.length&&element.length>0?element[0]:element,!owner.element)throw new Error("[cleave.js] Please check the element");opts.initValue=owner.element.value,owner.properties=Cleave.DefaultProperties.assign({},opts),owner.init()};Cleave.prototype={init:function(){var owner=this,pps=owner.properties;return pps.numeral||pps.phone||pps.creditCard||pps.date||0!==pps.blocksLength||pps.prefix?(pps.maxLength=Cleave.Util.getMaxLength(pps.blocks),owner.isAndroid=Cleave.Util.isAndroid(),owner.lastInputValue="",owner.onChangeListener=owner.onChange.bind(owner),owner.onKeyDownListener=owner.onKeyDown.bind(owner),owner.onFocusListener=owner.onFocus.bind(owner),owner.onCutListener=owner.onCut.bind(owner),owner.onCopyListener=owner.onCopy.bind(owner),owner.element.addEventListener("input",owner.onChangeListener),owner.element.addEventListener("keydown",owner.onKeyDownListener),owner.element.addEventListener("focus",owner.onFocusListener),owner.element.addEventListener("cut",owner.onCutListener),owner.element.addEventListener("copy",owner.onCopyListener),owner.initPhoneFormatter(),owner.initDateFormatter(),owner.initNumeralFormatter(),void((pps.initValue||pps.prefix&&!pps.noImmediatePrefix)&&owner.onInput(pps.initValue))):void owner.onInput(pps.initValue)},initNumeralFormatter:function(){var owner=this,pps=owner.properties;pps.numeral&&(pps.numeralFormatter=new Cleave.NumeralFormatter(pps.numeralDecimalMark,pps.numeralIntegerScale,pps.numeralDecimalScale,pps.numeralThousandsGroupStyle,pps.numeralPositiveOnly,pps.stripLeadingZeroes,pps.delimiter))},initDateFormatter:function(){var owner=this,pps=owner.properties;pps.date&&(pps.dateFormatter=new Cleave.DateFormatter(pps.datePattern),pps.blocks=pps.dateFormatter.getBlocks(),pps.blocksLength=pps.blocks.length,pps.maxLength=Cleave.Util.getMaxLength(pps.blocks))},initPhoneFormatter:function(){var owner=this,pps=owner.properties;if(pps.phone)try{pps.phoneFormatter=new Cleave.PhoneFormatter(new pps.root.Cleave.AsYouTypeFormatter(pps.phoneRegionCode),pps.delimiter)}catch(ex){throw new Error("[cleave.js] Please include phone-type-formatter.{country}.js lib")}},onKeyDown:function(event){var owner=this,pps=owner.properties,charCode=event.which||event.keyCode,Util=Cleave.Util,currentValue=owner.element.value;return Util.isAndroidBackspaceKeydown(owner.lastInputValue,currentValue)&&(charCode=8),owner.lastInputValue=currentValue,8===charCode&&Util.isDelimiter(currentValue.slice(-pps.delimiterLength),pps.delimiter,pps.delimiters)?void(pps.backspace=!0):void(pps.backspace=!1)},onChange:function(){this.onInput(this.element.value)},onFocus:function(){var owner=this,pps=owner.properties;Cleave.Util.fixPrefixCursor(owner.element,pps.prefix,pps.delimiter,pps.delimiters)},onCut:function(e){this.copyClipboardData(e),this.onInput("")},onCopy:function(e){this.copyClipboardData(e)},copyClipboardData:function(e){var owner=this,pps=owner.properties,Util=Cleave.Util,inputValue=owner.element.value,textToCopy="";textToCopy=pps.copyDelimiter?inputValue:Util.stripDelimiters(inputValue,pps.delimiter,pps.delimiters);try{e.clipboardData?e.clipboardData.setData("Text",textToCopy):window.clipboardData.setData("Text",textToCopy),e.preventDefault()}catch(ex){}},onInput:function(value){var owner=this,pps=owner.properties,Util=Cleave.Util;return pps.numeral||!pps.backspace||Util.isDelimiter(value.slice(-pps.delimiterLength),pps.delimiter,pps.delimiters)||(value=Util.headStr(value,value.length-pps.delimiterLength)),pps.phone?(!pps.prefix||pps.noImmediatePrefix&&!value.length?pps.result=pps.phoneFormatter.format(value):pps.result=pps.prefix+pps.phoneFormatter.format(value).slice(pps.prefix.length),void owner.updateValueState()):pps.numeral?(!pps.prefix||pps.noImmediatePrefix&&!value.length?pps.result=pps.numeralFormatter.format(value):pps.result=pps.prefix+pps.numeralFormatter.format(value),void owner.updateValueState()):(pps.date&&(value=pps.dateFormatter.getValidatedDate(value)),value=Util.stripDelimiters(value,pps.delimiter,pps.delimiters),value=Util.getPrefixStrippedValue(value,pps.prefix,pps.prefixLength,pps.result),value=pps.numericOnly?Util.strip(value,/[^\d]/g):value,value=pps.uppercase?value.toUpperCase():value,value=pps.lowercase?value.toLowerCase():value,!pps.prefix||pps.noImmediatePrefix&&!value.length||(value=pps.prefix+value,0!==pps.blocksLength)?(pps.creditCard&&owner.updateCreditCardPropsByValue(value),value=Util.headStr(value,pps.maxLength),pps.result=Util.getFormattedValue(value,pps.blocks,pps.blocksLength,pps.delimiter,pps.delimiters,pps.delimiterLazyShow),void owner.updateValueState()):(pps.result=value,void owner.updateValueState()))},updateCreditCardPropsByValue:function(value){var creditCardInfo,owner=this,pps=owner.properties,Util=Cleave.Util;Util.headStr(pps.result,4)!==Util.headStr(value,4)&&(creditCardInfo=Cleave.CreditCardDetector.getInfo(value,pps.creditCardStrictMode),pps.blocks=creditCardInfo.blocks,pps.blocksLength=pps.blocks.length,pps.maxLength=Util.getMaxLength(pps.blocks),pps.creditCardType!==creditCardInfo.type&&(pps.creditCardType=creditCardInfo.type,pps.onCreditCardTypeChanged.call(owner,pps.creditCardType)))},updateValueState:function(){var owner=this,Util=Cleave.Util,pps=owner.properties;if(owner.element){var endPos=owner.element.selectionEnd,oldValue=owner.element.value,newValue=pps.result;if(endPos=Util.getNextCursorPosition(endPos,oldValue,newValue,pps.delimiter,pps.delimiters),owner.isAndroid)return void window.setTimeout(function(){owner.element.value=newValue,Util.setSelection(owner.element,endPos,pps.document,!1),owner.callOnValueChanged()},1);owner.element.value=newValue,Util.setSelection(owner.element,endPos,pps.document,!1),owner.callOnValueChanged()}},callOnValueChanged:function(){var owner=this,pps=owner.properties;pps.onValueChanged.call(owner,{target:{value:pps.result,rawValue:owner.getRawValue()}})},setPhoneRegionCode:function(phoneRegionCode){var owner=this,pps=owner.properties;pps.phoneRegionCode=phoneRegionCode,owner.initPhoneFormatter(),owner.onChange()},setRawValue:function(value){var owner=this,pps=owner.properties;value=void 0!==value&&null!==value?value.toString():"",pps.numeral&&(value=value.replace(".",pps.numeralDecimalMark)),pps.backspace=!1,owner.element.value=value,owner.onInput(value)},getRawValue:function(){var owner=this,pps=owner.properties,Util=Cleave.Util,rawValue=owner.element.value;return pps.rawValueTrimPrefix&&(rawValue=Util.getPrefixStrippedValue(rawValue,pps.prefix,pps.prefixLength,pps.result)),rawValue=pps.numeral?pps.numeralFormatter.getRawValue(rawValue):Util.stripDelimiters(rawValue,pps.delimiter,pps.delimiters)},getISOFormatDate:function(){var owner=this,pps=owner.properties;return pps.date?pps.dateFormatter.getISOFormatDate():""},getFormattedValue:function(){return this.element.value},destroy:function(){var owner=this;owner.element.removeEventListener("input",owner.onChangeListener),owner.element.removeEventListener("keydown",owner.onKeyDownListener),owner.element.removeEventListener("focus",owner.onFocusListener),owner.element.removeEventListener("cut",owner.onCutListener),owner.element.removeEventListener("copy",owner.onCopyListener)},toString:function(){return"[Cleave Object]"}},Cleave.NumeralFormatter=__webpack_require__(1),Cleave.DateFormatter=__webpack_require__(2),Cleave.PhoneFormatter=__webpack_require__(3),Cleave.CreditCardDetector=__webpack_require__(4),Cleave.Util=__webpack_require__(5),Cleave.DefaultProperties=__webpack_require__(6),("object"==typeof global&&global?global:window).Cleave=Cleave,module.exports=Cleave,angular.module("cleave.js",[]).directive("cleave",function(){return{restrict:"A",require:"ngModel",scope:{cleave:"&",onInit:"&?",onValueChange:"&?"},compile:function(){return{pre:function($scope,$element,attrs,ngModelCtrl){$scope.instance=new Cleave($element[0],$scope.cleave()),$scope.onInit&&$scope.onInit()($scope.instance),ngModelCtrl.$formatters.push(function(val){return $scope.instance.setRawValue(val),$scope.instance.getFormattedValue()}),ngModelCtrl.$parsers.push(function(newFormattedValue){return $scope.onValueChange&&$scope.onValueChange()(newFormattedValue),$scope.instance.getRawValue()}),$scope.$watch(function(){return $scope.cleave()},function(newOptions,oldOptions){$scope.instance.destroy(),$scope.instance=new Cleave($element[0],newOptions)},!0),$scope.$on("$destroy",function(){$scope.instance.destroy(),$scope.instance=null})}}}}})}).call(exports,function(){return this}())},function(module,exports){"use strict";var NumeralFormatter=function(numeralDecimalMark,numeralIntegerScale,numeralDecimalScale,numeralThousandsGroupStyle,numeralPositiveOnly,stripLeadingZeroes,delimiter){var owner=this;owner.numeralDecimalMark=numeralDecimalMark||".",owner.numeralIntegerScale=numeralIntegerScale>0?numeralIntegerScale:0,owner.numeralDecimalScale=numeralDecimalScale>=0?numeralDecimalScale:2,owner.numeralThousandsGroupStyle=numeralThousandsGroupStyle||NumeralFormatter.groupStyle.thousand,owner.numeralPositiveOnly=!!numeralPositiveOnly,owner.stripLeadingZeroes=stripLeadingZeroes!==!1,owner.delimiter=delimiter||""===delimiter?delimiter:",",owner.delimiterRE=delimiter?new RegExp("\\"+delimiter,"g"):""};NumeralFormatter.groupStyle={thousand:"thousand",lakh:"lakh",wan:"wan",none:"none"},NumeralFormatter.prototype={getRawValue:function(value){return value.replace(this.delimiterRE,"").replace(this.numeralDecimalMark,".")},format:function(value){var parts,partInteger,owner=this,partDecimal="";switch(value=value.replace(/[A-Za-z]/g,"").replace(owner.numeralDecimalMark,"M").replace(/[^\dM-]/g,"").replace(/^\-/,"N").replace(/\-/g,"").replace("N",owner.numeralPositiveOnly?"":"-").replace("M",owner.numeralDecimalMark),owner.stripLeadingZeroes&&(value=value.replace(/^(-)?0+(?=\d)/,"$1")),partInteger=value,value.indexOf(owner.numeralDecimalMark)>=0&&(parts=value.split(owner.numeralDecimalMark),partInteger=parts[0],partDecimal=owner.numeralDecimalMark+parts[1].slice(0,owner.numeralDecimalScale)),owner.numeralIntegerScale>0&&(partInteger=partInteger.slice(0,owner.numeralIntegerScale+("-"===value.slice(0,1)?1:0))),owner.numeralThousandsGroupStyle){case NumeralFormatter.groupStyle.lakh:partInteger=partInteger.replace(/(\d)(?=(\d\d)+\d$)/g,"$1"+owner.delimiter);break;case NumeralFormatter.groupStyle.wan:partInteger=partInteger.replace(/(\d)(?=(\d{4})+$)/g,"$1"+owner.delimiter);break;case NumeralFormatter.groupStyle.thousand:partInteger=partInteger.replace(/(\d)(?=(\d{3})+$)/g,"$1"+owner.delimiter)}return partInteger.toString()+(owner.numeralDecimalScale>0?partDecimal.toString():"")}},module.exports=NumeralFormatter},function(module,exports){"use strict";var DateFormatter=function(datePattern){var owner=this;owner.date=[],owner.blocks=[],owner.datePattern=datePattern,owner.initBlocks()};DateFormatter.prototype={initBlocks:function(){var owner=this;owner.datePattern.forEach(function(value){"Y"===value?owner.blocks.push(4):owner.blocks.push(2)})},getISOFormatDate:function(){var owner=this,date=owner.date;return date[2]?date[2]+"-"+owner.addLeadingZero(date[1])+"-"+owner.addLeadingZero(date[0]):""},getBlocks:function(){return this.blocks},getValidatedDate:function(value){var owner=this,result="";return value=value.replace(/[^\d]/g,""),owner.blocks.forEach(function(length,index){if(value.length>0){var sub=value.slice(0,length),sub0=sub.slice(0,1),rest=value.slice(length);switch(owner.datePattern[index]){case"d":"00"===sub?sub="01":parseInt(sub0,10)>3?sub="0"+sub0:parseInt(sub,10)>31&&(sub="31");break;case"m":"00"===sub?sub="01":parseInt(sub0,10)>1?sub="0"+sub0:parseInt(sub,10)>12&&(sub="12")}result+=sub,value=rest}}),this.getFixedDateString(result)},getFixedDateString:function(value){var day,month,year,owner=this,datePattern=owner.datePattern,date=[],dayIndex=0,monthIndex=0,yearIndex=0,dayStartIndex=0,monthStartIndex=0,yearStartIndex=0,fullYearDone=!1;return 4===value.length&&"y"!==datePattern[0].toLowerCase()&&"y"!==datePattern[1].toLowerCase()&&(dayStartIndex="d"===datePattern[0]?0:2,monthStartIndex=2-dayStartIndex,day=parseInt(value.slice(dayStartIndex,dayStartIndex+2),10),month=parseInt(value.slice(monthStartIndex,monthStartIndex+2),10),date=this.getFixedDate(day,month,0)),8===value.length&&(datePattern.forEach(function(type,index){switch(type){case"d":dayIndex=index;break;case"m":monthIndex=index;break;default:yearIndex=index}}),yearStartIndex=2*yearIndex,dayStartIndex=dayIndex<=yearIndex?2*dayIndex:2*dayIndex+2,monthStartIndex=monthIndex<=yearIndex?2*monthIndex:2*monthIndex+2,day=parseInt(value.slice(dayStartIndex,dayStartIndex+2),10),month=parseInt(value.slice(monthStartIndex,monthStartIndex+2),10),year=parseInt(value.slice(yearStartIndex,yearStartIndex+4),10),fullYearDone=4===value.slice(yearStartIndex,yearStartIndex+4).length,date=this.getFixedDate(day,month,year)),owner.date=date,0===date.length?value:datePattern.reduce(function(previous,current){switch(current){case"d":return previous+owner.addLeadingZero(date[0]);case"m":return previous+owner.addLeadingZero(date[1]);default:return previous+(fullYearDone?owner.addLeadingZeroForYear(date[2]):"")}},"")},getFixedDate:function(day,month,year){return day=Math.min(day,31),month=Math.min(month,12),year=parseInt(year||0,10),(month<7&&month%2===0||month>8&&month%2===1)&&(day=Math.min(day,2===month?this.isLeapYear(year)?29:28:30)),[day,month,year]},isLeapYear:function(year){return year%4===0&&year%100!==0||year%400===0},addLeadingZero:function(number){return(number<10?"0":"")+number},addLeadingZeroForYear:function(number){return(number<10?"000":number<100?"00":number<1e3?"0":"")+number}},module.exports=DateFormatter},function(module,exports){"use strict";var PhoneFormatter=function(formatter,delimiter){var owner=this;owner.delimiter=delimiter||""===delimiter?delimiter:" ",owner.delimiterRE=delimiter?new RegExp("\\"+delimiter,"g"):"",owner.formatter=formatter};PhoneFormatter.prototype={setFormatter:function(formatter){this.formatter=formatter},format:function(phoneNumber){var owner=this;owner.formatter.clear(),phoneNumber=phoneNumber.replace(/[^\d+]/g,""),phoneNumber=phoneNumber.replace(owner.delimiterRE,"");for(var current,result="",validated=!1,i=0,iMax=phoneNumber.length;i<iMax;i++)current=owner.formatter.inputDigit(phoneNumber.charAt(i)),/[\s()-]/g.test(current)?(result=current,validated=!0):validated||(result=current);return result=result.replace(/[()]/g,""),result=result.replace(/[\s-]/g,owner.delimiter)}},module.exports=PhoneFormatter},function(module,exports){"use strict";var CreditCardDetector={blocks:{uatp:[4,5,6],amex:[4,6,5],diners:[4,6,4],discover:[4,4,4,4],mastercard:[4,4,4,4],dankort:[4,4,4,4],instapayment:[4,4,4,4],jcb15:[4,6,5],jcb:[4,4,4,4],maestro:[4,4,4,4],visa:[4,4,4,4],mir:[4,4,4,4],unionPay:[4,4,4,4],general:[4,4,4,4],generalStrict:[4,4,4,7]},re:{uatp:/^(?!1800)1\d{0,14}/,amex:/^3[47]\d{0,13}/,discover:/^(?:6011|65\d{0,2}|64[4-9]\d?)\d{0,12}/,diners:/^3(?:0([0-5]|9)|[689]\d?)\d{0,11}/,mastercard:/^(5[1-5]\d{0,2}|22[2-9]\d{0,1}|2[3-7]\d{0,2})\d{0,12}/,dankort:/^(5019|4175|4571)\d{0,12}/,instapayment:/^63[7-9]\d{0,13}/,jcb15:/^(?:2131|1800)\d{0,11}/,jcb:/^(?:35\d{0,2})\d{0,12}/,maestro:/^(?:5[0678]\d{0,2}|6304|67\d{0,2})\d{0,12}/,mir:/^220[0-4]\d{0,12}/,visa:/^4\d{0,15}/,unionPay:/^62\d{0,14}/},getInfo:function(value,strictMode){var blocks=CreditCardDetector.blocks,re=CreditCardDetector.re;strictMode=!!strictMode;for(var key in re)if(re[key].test(value)){var block;return block=strictMode?blocks.generalStrict:blocks[key],{type:key,blocks:block}}return{type:"unknown",blocks:strictMode?blocks.generalStrict:blocks.general}}};module.exports=CreditCardDetector},function(module,exports){"use strict";var Util={noop:function(){},strip:function(value,re){return value.replace(re,"")},isDelimiter:function(letter,delimiter,delimiters){return 0===delimiters.length?letter===delimiter:delimiters.some(function(current){if(letter===current)return!0})},getDelimiterREByDelimiter:function(delimiter){return new RegExp(delimiter.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g")},getNextCursorPosition:function(prevPos,oldValue,newValue,delimiter,delimiters){return oldValue.length===prevPos?newValue.length:prevPos+this.getPositionOffset(prevPos,oldValue,newValue,delimiter,delimiters)},getPositionOffset:function(prevPos,oldValue,newValue,delimiter,delimiters){var oldRawValue,newRawValue,lengthOffset;return oldRawValue=this.stripDelimiters(oldValue.slice(0,prevPos),delimiter,delimiters),newRawValue=this.stripDelimiters(newValue.slice(0,prevPos),delimiter,delimiters),lengthOffset=oldRawValue.length-newRawValue.length,0!==lengthOffset?lengthOffset/Math.abs(lengthOffset):0},stripDelimiters:function(value,delimiter,delimiters){var owner=this;if(0===delimiters.length){var delimiterRE=delimiter?owner.getDelimiterREByDelimiter(delimiter):"";return value.replace(delimiterRE,"")}return delimiters.forEach(function(current){value=value.replace(owner.getDelimiterREByDelimiter(current),"")}),value},headStr:function(str,length){return str.slice(0,length)},getMaxLength:function(blocks){return blocks.reduce(function(previous,current){return previous+current},0)},getPrefixStrippedValue:function(value,prefix,prefixLength,prevValue){if(value.slice(0,prefixLength)!==prefix)if(value.length<prevValue.length)value=value.length>prefixLength?prevValue:prefix;else{var diffIndex=this.getFirstDiffIndex(prefix,value.slice(0,prefixLength));value=prefix+value.slice(diffIndex,diffIndex+1)+value.slice(prefixLength+1)}return value.slice(prefixLength)},getFirstDiffIndex:function(prev,current){for(var index=0;prev.charAt(index)===current.charAt(index);)if(""===prev.charAt(index++))return-1;return index},getFormattedValue:function(value,blocks,blocksLength,delimiter,delimiters,delimiterLazyShow){var currentDelimiter,result="",multipleDelimiters=delimiters.length>0;return 0===blocksLength?value:(blocks.forEach(function(length,index){if(value.length>0){var sub=value.slice(0,length),rest=value.slice(length);currentDelimiter=multipleDelimiters?delimiters[delimiterLazyShow?index-1:index]||currentDelimiter:delimiter,delimiterLazyShow?(index>0&&(result+=currentDelimiter),result+=sub):(result+=sub,sub.length===length&&index<blocksLength-1&&(result+=currentDelimiter)),value=rest}}),result)},fixPrefixCursor:function(el,prefix,delimiter,delimiters){if(el){var val=el.value,appendix=delimiter||delimiters[0]||" ";if(el.setSelectionRange&&prefix&&!(prefix.length+appendix.length<val.length)){var len=2*val.length;setTimeout(function(){el.setSelectionRange(len,len)},1)}}},setSelection:function(element,position,doc){if(element===doc.activeElement&&!(element&&element.value.length<=position))if(element.createTextRange){var range=element.createTextRange();range.move("character",position),range.select()}else try{element.setSelectionRange(position,position)}catch(e){console.warn("The input element type does not support selection")}},isAndroid:function(){return navigator&&/android/i.test(navigator.userAgent)},isAndroidBackspaceKeydown:function(lastInputValue,currentInputValue){return!!(this.isAndroid()&&lastInputValue&&currentInputValue)&&currentInputValue===lastInputValue.slice(0,-1)}};module.exports=Util},function(module,exports){(function(global){"use strict";var DefaultProperties={assign:function(target,opts){return target=target||{},opts=opts||{},target.creditCard=!!opts.creditCard,target.creditCardStrictMode=!!opts.creditCardStrictMode,target.creditCardType="",target.onCreditCardTypeChanged=opts.onCreditCardTypeChanged||function(){},target.phone=!!opts.phone,target.phoneRegionCode=opts.phoneRegionCode||"AU",target.phoneFormatter={},target.date=!!opts.date,target.datePattern=opts.datePattern||["d","m","Y"],target.dateFormatter={},target.numeral=!!opts.numeral,target.numeralIntegerScale=opts.numeralIntegerScale>0?opts.numeralIntegerScale:0,target.numeralDecimalScale=opts.numeralDecimalScale>=0?opts.numeralDecimalScale:2,target.numeralDecimalMark=opts.numeralDecimalMark||".",target.numeralThousandsGroupStyle=opts.numeralThousandsGroupStyle||"thousand",target.numeralPositiveOnly=!!opts.numeralPositiveOnly,target.stripLeadingZeroes=opts.stripLeadingZeroes!==!1,target.numericOnly=target.creditCard||target.date||!!opts.numericOnly,target.uppercase=!!opts.uppercase,target.lowercase=!!opts.lowercase,target.prefix=target.creditCard||target.date?"":opts.prefix||"",target.noImmediatePrefix=!!opts.noImmediatePrefix,target.prefixLength=target.prefix.length,target.rawValueTrimPrefix=!!opts.rawValueTrimPrefix,target.copyDelimiter=!!opts.copyDelimiter,target.initValue=void 0!==opts.initValue&&null!==opts.initValue?opts.initValue.toString():"",target.delimiter=opts.delimiter||""===opts.delimiter?opts.delimiter:opts.date?"/":opts.numeral?",":(opts.phone," "),target.delimiterLength=target.delimiter.length,target.delimiterLazyShow=!!opts.delimiterLazyShow,target.delimiters=opts.delimiters||[],target.blocks=opts.blocks||[],target.blocksLength=target.blocks.length,target.document=opts.document||document,target.root="object"==typeof global&&global?global:window,target.maxLength=0,target.backspace=!1,target.result="",target.onValueChanged=opts.onValueChanged||function(){},target}};module.exports=DefaultProperties}).call(exports,function(){return this}())}])});
@@ -0,0 +1,2443 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("react"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define(["react"], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["Cleave"] = factory(require("react"));
8
+ else
9
+ root["Cleave"] = factory(root["React"]);
10
+ })(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {
11
+ return /******/ (function(modules) { // webpackBootstrap
12
+ /******/ // The module cache
13
+ /******/ var installedModules = {};
14
+
15
+ /******/ // The require function
16
+ /******/ function __webpack_require__(moduleId) {
17
+
18
+ /******/ // Check if module is in cache
19
+ /******/ if(installedModules[moduleId])
20
+ /******/ return installedModules[moduleId].exports;
21
+
22
+ /******/ // Create a new module (and put it into the cache)
23
+ /******/ var module = installedModules[moduleId] = {
24
+ /******/ exports: {},
25
+ /******/ id: moduleId,
26
+ /******/ loaded: false
27
+ /******/ };
28
+
29
+ /******/ // Execute the module function
30
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31
+
32
+ /******/ // Flag the module as loaded
33
+ /******/ module.loaded = true;
34
+
35
+ /******/ // Return the exports of the module
36
+ /******/ return module.exports;
37
+ /******/ }
38
+
39
+
40
+ /******/ // expose the modules object (__webpack_modules__)
41
+ /******/ __webpack_require__.m = modules;
42
+
43
+ /******/ // expose the module cache
44
+ /******/ __webpack_require__.c = installedModules;
45
+
46
+ /******/ // __webpack_public_path__
47
+ /******/ __webpack_require__.p = "";
48
+
49
+ /******/ // Load entry module and return exports
50
+ /******/ return __webpack_require__(0);
51
+ /******/ })
52
+ /************************************************************************/
53
+ /******/ ([
54
+ /* 0 */
55
+ /***/ (function(module, exports, __webpack_require__) {
56
+
57
+ 'use strict';
58
+
59
+ var _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; };
60
+
61
+ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
62
+
63
+ var React = __webpack_require__(1); // eslint-disable-line no-unused-vars
64
+ var CreateReactClass = __webpack_require__(2);
65
+
66
+ var NumeralFormatter = __webpack_require__(9);
67
+ var DateFormatter = __webpack_require__(10);
68
+ var PhoneFormatter = __webpack_require__(11);
69
+ var CreditCardDetector = __webpack_require__(12);
70
+ var Util = __webpack_require__(13);
71
+ var DefaultProperties = __webpack_require__(14);
72
+
73
+ var cleaveReactClass = CreateReactClass({
74
+ componentDidMount: function componentDidMount() {
75
+ this.init();
76
+ },
77
+
78
+ componentDidUpdate: function componentDidUpdate() {
79
+ var owner = this,
80
+ pps = owner.properties;
81
+
82
+ Util.setSelection(owner.element, owner.state.cursorPosition, pps.document);
83
+ },
84
+
85
+ componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
86
+ var owner = this,
87
+ phoneRegionCode = (nextProps.options || {}).phoneRegionCode,
88
+ newValue = nextProps.value;
89
+
90
+ if (newValue !== undefined) {
91
+ newValue = newValue.toString();
92
+
93
+ if (newValue !== owner.properties.initValue && newValue !== owner.properties.result) {
94
+ owner.properties.initValue = newValue;
95
+ owner.onInput(newValue, true);
96
+ }
97
+ }
98
+
99
+ // update phone region code
100
+ if (phoneRegionCode && phoneRegionCode !== owner.properties.phoneRegionCode) {
101
+ owner.properties.phoneRegionCode = phoneRegionCode;
102
+ owner.initPhoneFormatter();
103
+ owner.onInput(owner.properties.result);
104
+ }
105
+ },
106
+
107
+ getInitialState: function getInitialState() {
108
+ var owner = this,
109
+ _owner$props = owner.props,
110
+ value = _owner$props.value,
111
+ options = _owner$props.options,
112
+ onKeyDown = _owner$props.onKeyDown,
113
+ onChange = _owner$props.onChange,
114
+ onFocus = _owner$props.onFocus,
115
+ onBlur = _owner$props.onBlur,
116
+ onInit = _owner$props.onInit;
117
+
118
+
119
+ owner.registeredEvents = {
120
+ onInit: onInit || Util.noop,
121
+ onChange: onChange || Util.noop,
122
+ onFocus: onFocus || Util.noop,
123
+ onBlur: onBlur || Util.noop,
124
+ onKeyDown: onKeyDown || Util.noop
125
+ };
126
+
127
+ if (!options) {
128
+ options = {};
129
+ }
130
+
131
+ options.initValue = value;
132
+
133
+ owner.properties = DefaultProperties.assign({}, options);
134
+
135
+ return {
136
+ value: owner.properties.result,
137
+ cursorPosition: 0
138
+ };
139
+ },
140
+
141
+ init: function init() {
142
+ var owner = this,
143
+ pps = owner.properties;
144
+
145
+ // so no need for this lib at all
146
+ if (!pps.numeral && !pps.phone && !pps.creditCard && !pps.date && pps.blocksLength === 0 && !pps.prefix) {
147
+ owner.onInput(pps.initValue);
148
+ owner.registeredEvents.onInit(owner);
149
+
150
+ return;
151
+ }
152
+
153
+ pps.maxLength = Util.getMaxLength(pps.blocks);
154
+
155
+ owner.isAndroid = Util.isAndroid();
156
+
157
+ owner.initPhoneFormatter();
158
+ owner.initDateFormatter();
159
+ owner.initNumeralFormatter();
160
+
161
+ // avoid touch input field if value is null
162
+ // otherwise Firefox will add red box-shadow for <input required />
163
+ if (pps.initValue || pps.prefix && !pps.noImmediatePrefix) {
164
+ owner.onInput(pps.initValue);
165
+ }
166
+
167
+ owner.registeredEvents.onInit(owner);
168
+ },
169
+
170
+ initNumeralFormatter: function initNumeralFormatter() {
171
+ var owner = this,
172
+ pps = owner.properties;
173
+
174
+ if (!pps.numeral) {
175
+ return;
176
+ }
177
+
178
+ pps.numeralFormatter = new NumeralFormatter(pps.numeralDecimalMark, pps.numeralIntegerScale, pps.numeralDecimalScale, pps.numeralThousandsGroupStyle, pps.numeralPositiveOnly, pps.stripLeadingZeroes, pps.delimiter);
179
+ },
180
+
181
+ initDateFormatter: function initDateFormatter() {
182
+ var owner = this,
183
+ pps = owner.properties;
184
+
185
+ if (!pps.date) {
186
+ return;
187
+ }
188
+
189
+ pps.dateFormatter = new DateFormatter(pps.datePattern);
190
+ pps.blocks = pps.dateFormatter.getBlocks();
191
+ pps.blocksLength = pps.blocks.length;
192
+ pps.maxLength = Util.getMaxLength(pps.blocks);
193
+ },
194
+
195
+ initPhoneFormatter: function initPhoneFormatter() {
196
+ var owner = this,
197
+ pps = owner.properties;
198
+
199
+ if (!pps.phone) {
200
+ return;
201
+ }
202
+
203
+ // Cleave.AsYouTypeFormatter should be provided by
204
+ // external google closure lib
205
+ try {
206
+ pps.phoneFormatter = new PhoneFormatter(new pps.root.Cleave.AsYouTypeFormatter(pps.phoneRegionCode), pps.delimiter);
207
+ } catch (ex) {
208
+ throw new Error('Please include phone-type-formatter.{country}.js lib');
209
+ }
210
+ },
211
+
212
+ setRawValue: function setRawValue(value) {
213
+ var owner = this,
214
+ pps = owner.properties;
215
+
216
+ value = value !== undefined && value !== null ? value.toString() : '';
217
+
218
+ if (pps.numeral) {
219
+ value = value.replace('.', pps.numeralDecimalMark);
220
+ }
221
+
222
+ pps.backspace = false;
223
+
224
+ owner.onChange({
225
+ target: { value: value },
226
+
227
+ // Methods to better resemble a SyntheticEvent
228
+ stopPropagation: Util.noop,
229
+ preventDefault: Util.noop,
230
+ persist: Util.noop
231
+ });
232
+ },
233
+
234
+ getRawValue: function getRawValue() {
235
+ var owner = this,
236
+ pps = owner.properties,
237
+ rawValue = pps.result;
238
+
239
+ if (pps.rawValueTrimPrefix) {
240
+ rawValue = Util.getPrefixStrippedValue(rawValue, pps.prefix, pps.prefixLength, pps.result);
241
+ }
242
+
243
+ if (pps.numeral) {
244
+ rawValue = pps.numeralFormatter ? pps.numeralFormatter.getRawValue(rawValue) : '';
245
+ } else {
246
+ rawValue = Util.stripDelimiters(rawValue, pps.delimiter, pps.delimiters);
247
+ }
248
+
249
+ return rawValue;
250
+ },
251
+
252
+ getISOFormatDate: function getISOFormatDate() {
253
+ var owner = this,
254
+ pps = owner.properties;
255
+
256
+ return pps.date ? pps.dateFormatter.getISOFormatDate() : '';
257
+ },
258
+
259
+ onInit: function onInit(owner) {
260
+ return owner;
261
+ },
262
+
263
+ onKeyDown: function onKeyDown(event) {
264
+ var owner = this,
265
+ pps = owner.properties,
266
+ charCode = event.which || event.keyCode;
267
+
268
+ // hit backspace when last character is delimiter
269
+ if (charCode === 8 && Util.isDelimiter(pps.result.slice(-pps.delimiterLength), pps.delimiter, pps.delimiters)) {
270
+ pps.backspace = true;
271
+ } else {
272
+ pps.backspace = false;
273
+ }
274
+
275
+ owner.registeredEvents.onKeyDown(event);
276
+ },
277
+
278
+ onFocus: function onFocus(event) {
279
+ var owner = this,
280
+ pps = owner.properties;
281
+
282
+ event.target.rawValue = owner.getRawValue();
283
+ event.target.value = pps.result;
284
+
285
+ owner.registeredEvents.onFocus(event);
286
+
287
+ Util.fixPrefixCursor(owner.element, pps.prefix, pps.delimiter, pps.delimiters);
288
+ },
289
+
290
+ onBlur: function onBlur(event) {
291
+ var owner = this,
292
+ pps = owner.properties;
293
+
294
+ event.target.rawValue = owner.getRawValue();
295
+ event.target.value = pps.result;
296
+
297
+ owner.registeredEvents.onBlur(event);
298
+ },
299
+
300
+ onChange: function onChange(event) {
301
+ var owner = this,
302
+ pps = owner.properties;
303
+
304
+ owner.onInput(event.target.value);
305
+
306
+ event.target.rawValue = owner.getRawValue();
307
+ event.target.value = pps.result;
308
+
309
+ owner.registeredEvents.onChange(event);
310
+ },
311
+
312
+ onInput: function onInput(value, fromProps) {
313
+ var owner = this,
314
+ pps = owner.properties;
315
+
316
+ if (Util.isAndroidBackspaceKeydown(owner.lastInputValue, owner.element.value) && Util.isDelimiter(pps.result.slice(-pps.delimiterLength), pps.delimiter, pps.delimiters)) {
317
+ pps.backspace = true;
318
+ }
319
+
320
+ // case 1: delete one more character "4"
321
+ // 1234*| -> hit backspace -> 123|
322
+ // case 2: last character is not delimiter which is:
323
+ // 12|34* -> hit backspace -> 1|34*
324
+
325
+ if (!fromProps && !pps.numeral && pps.backspace && !Util.isDelimiter(value.slice(-pps.delimiterLength), pps.delimiter, pps.delimiters)) {
326
+ value = Util.headStr(value, value.length - pps.delimiterLength);
327
+ }
328
+
329
+ // phone formatter
330
+ if (pps.phone) {
331
+ pps.result = pps.phoneFormatter.format(value);
332
+ owner.updateValueState();
333
+
334
+ return;
335
+ }
336
+
337
+ // numeral formatter
338
+ if (pps.numeral) {
339
+ if (pps.prefix && (!pps.noImmediatePrefix || value.length)) {
340
+ pps.result = pps.prefix + pps.numeralFormatter.format(value);
341
+ } else {
342
+ pps.result = pps.numeralFormatter.format(value);
343
+ }
344
+ owner.updateValueState();
345
+
346
+ return;
347
+ }
348
+
349
+ // date
350
+ if (pps.date) {
351
+ value = pps.dateFormatter.getValidatedDate(value);
352
+ }
353
+
354
+ // strip delimiters
355
+ value = Util.stripDelimiters(value, pps.delimiter, pps.delimiters);
356
+
357
+ // strip prefix
358
+ value = Util.getPrefixStrippedValue(value, pps.prefix, pps.prefixLength, pps.result);
359
+
360
+ // strip non-numeric characters
361
+ value = pps.numericOnly ? Util.strip(value, /[^\d]/g) : value;
362
+
363
+ // convert case
364
+ value = pps.uppercase ? value.toUpperCase() : value;
365
+ value = pps.lowercase ? value.toLowerCase() : value;
366
+
367
+ // prefix
368
+ if (pps.prefix && (!pps.noImmediatePrefix || value.length)) {
369
+ value = pps.prefix + value;
370
+
371
+ // no blocks specified, no need to do formatting
372
+ if (pps.blocksLength === 0) {
373
+ pps.result = value;
374
+ owner.updateValueState();
375
+
376
+ return;
377
+ }
378
+ }
379
+
380
+ // update credit card props
381
+ if (pps.creditCard) {
382
+ owner.updateCreditCardPropsByValue(value);
383
+ }
384
+
385
+ // strip over length characters
386
+ value = pps.maxLength > 0 ? Util.headStr(value, pps.maxLength) : value;
387
+
388
+ // apply blocks
389
+ pps.result = Util.getFormattedValue(value, pps.blocks, pps.blocksLength, pps.delimiter, pps.delimiters, pps.delimiterLazyShow);
390
+
391
+ owner.updateValueState();
392
+ },
393
+
394
+ updateCreditCardPropsByValue: function updateCreditCardPropsByValue(value) {
395
+ var owner = this,
396
+ pps = owner.properties,
397
+ creditCardInfo;
398
+
399
+ // At least one of the first 4 characters has changed
400
+ if (Util.headStr(pps.result, 4) === Util.headStr(value, 4)) {
401
+ return;
402
+ }
403
+
404
+ creditCardInfo = CreditCardDetector.getInfo(value, pps.creditCardStrictMode);
405
+
406
+ pps.blocks = creditCardInfo.blocks;
407
+ pps.blocksLength = pps.blocks.length;
408
+ pps.maxLength = Util.getMaxLength(pps.blocks);
409
+
410
+ // credit card type changed
411
+ if (pps.creditCardType !== creditCardInfo.type) {
412
+ pps.creditCardType = creditCardInfo.type;
413
+
414
+ pps.onCreditCardTypeChanged.call(owner, pps.creditCardType);
415
+ }
416
+ },
417
+
418
+ updateValueState: function updateValueState() {
419
+ var owner = this,
420
+ pps = owner.properties;
421
+
422
+ if (!owner.element) {
423
+ owner.setState({ value: pps.result });
424
+ }
425
+
426
+ var endPos = owner.element.selectionEnd;
427
+ var oldValue = owner.element.value;
428
+ var newValue = pps.result;
429
+
430
+ owner.lastInputValue = newValue;
431
+
432
+ endPos = Util.getNextCursorPosition(endPos, oldValue, newValue, pps.delimiter, pps.delimiters);
433
+
434
+ if (owner.isAndroid) {
435
+ window.setTimeout(function () {
436
+ owner.setState({ value: newValue, cursorPosition: endPos });
437
+ }, 1);
438
+
439
+ return;
440
+ }
441
+
442
+ owner.setState({ value: newValue, cursorPosition: endPos });
443
+ },
444
+
445
+ render: function render() {
446
+ var owner = this;
447
+ // eslint-disable-next-line
448
+
449
+ var _owner$props2 = owner.props,
450
+ value = _owner$props2.value,
451
+ options = _owner$props2.options,
452
+ onKeyDown = _owner$props2.onKeyDown,
453
+ onFocus = _owner$props2.onFocus,
454
+ onBlur = _owner$props2.onBlur,
455
+ onChange = _owner$props2.onChange,
456
+ onInit = _owner$props2.onInit,
457
+ htmlRef = _owner$props2.htmlRef,
458
+ propsToTransfer = _objectWithoutProperties(_owner$props2, ['value', 'options', 'onKeyDown', 'onFocus', 'onBlur', 'onChange', 'onInit', 'htmlRef']);
459
+
460
+ return React.createElement('input', _extends({
461
+ type: 'text',
462
+ ref: function ref(_ref) {
463
+ owner.element = _ref;
464
+
465
+ if (!htmlRef) {
466
+ return;
467
+ }
468
+
469
+ htmlRef.apply(this, arguments);
470
+ },
471
+ value: owner.state.value,
472
+ onKeyDown: owner.onKeyDown,
473
+ onChange: owner.onChange,
474
+ onFocus: owner.onFocus,
475
+ onBlur: owner.onBlur
476
+ }, propsToTransfer));
477
+ }
478
+ });
479
+
480
+ module.exports = cleaveReactClass;
481
+
482
+ /***/ }),
483
+ /* 1 */
484
+ /***/ (function(module, exports) {
485
+
486
+ module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
487
+
488
+ /***/ }),
489
+ /* 2 */
490
+ /***/ (function(module, exports, __webpack_require__) {
491
+
492
+ /**
493
+ * Copyright 2013-present, Facebook, Inc.
494
+ * All rights reserved.
495
+ *
496
+ * This source code is licensed under the BSD-style license found in the
497
+ * LICENSE file in the root directory of this source tree. An additional grant
498
+ * of patent rights can be found in the PATENTS file in the same directory.
499
+ *
500
+ */
501
+
502
+ 'use strict';
503
+
504
+ var React = __webpack_require__(1);
505
+ var factory = __webpack_require__(3);
506
+
507
+ if (typeof React === 'undefined') {
508
+ throw Error(
509
+ 'create-react-class could not find the React object. If you are using script tags, ' +
510
+ 'make sure that React is being loaded before create-react-class.'
511
+ );
512
+ }
513
+
514
+ // Hack to grab NoopUpdateQueue from isomorphic React
515
+ var ReactNoopUpdateQueue = new React.Component().updater;
516
+
517
+ module.exports = factory(
518
+ React.Component,
519
+ React.isValidElement,
520
+ ReactNoopUpdateQueue
521
+ );
522
+
523
+
524
+ /***/ }),
525
+ /* 3 */
526
+ /***/ (function(module, exports, __webpack_require__) {
527
+
528
+ /**
529
+ * Copyright 2013-present, Facebook, Inc.
530
+ * All rights reserved.
531
+ *
532
+ * This source code is licensed under the BSD-style license found in the
533
+ * LICENSE file in the root directory of this source tree. An additional grant
534
+ * of patent rights can be found in the PATENTS file in the same directory.
535
+ *
536
+ */
537
+
538
+ 'use strict';
539
+
540
+ var _assign = __webpack_require__(4);
541
+
542
+ var emptyObject = __webpack_require__(5);
543
+ var _invariant = __webpack_require__(6);
544
+
545
+ if (process.env.NODE_ENV !== 'production') {
546
+ var warning = __webpack_require__(7);
547
+ }
548
+
549
+ var MIXINS_KEY = 'mixins';
550
+
551
+ // Helper function to allow the creation of anonymous functions which do not
552
+ // have .name set to the name of the variable being assigned to.
553
+ function identity(fn) {
554
+ return fn;
555
+ }
556
+
557
+ var ReactPropTypeLocationNames;
558
+ if (process.env.NODE_ENV !== 'production') {
559
+ ReactPropTypeLocationNames = {
560
+ prop: 'prop',
561
+ context: 'context',
562
+ childContext: 'child context'
563
+ };
564
+ } else {
565
+ ReactPropTypeLocationNames = {};
566
+ }
567
+
568
+ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
569
+ /**
570
+ * Policies that describe methods in `ReactClassInterface`.
571
+ */
572
+
573
+ var injectedMixins = [];
574
+
575
+ /**
576
+ * Composite components are higher-level components that compose other composite
577
+ * or host components.
578
+ *
579
+ * To create a new type of `ReactClass`, pass a specification of
580
+ * your new class to `React.createClass`. The only requirement of your class
581
+ * specification is that you implement a `render` method.
582
+ *
583
+ * var MyComponent = React.createClass({
584
+ * render: function() {
585
+ * return <div>Hello World</div>;
586
+ * }
587
+ * });
588
+ *
589
+ * The class specification supports a specific protocol of methods that have
590
+ * special meaning (e.g. `render`). See `ReactClassInterface` for
591
+ * more the comprehensive protocol. Any other properties and methods in the
592
+ * class specification will be available on the prototype.
593
+ *
594
+ * @interface ReactClassInterface
595
+ * @internal
596
+ */
597
+ var ReactClassInterface = {
598
+ /**
599
+ * An array of Mixin objects to include when defining your component.
600
+ *
601
+ * @type {array}
602
+ * @optional
603
+ */
604
+ mixins: 'DEFINE_MANY',
605
+
606
+ /**
607
+ * An object containing properties and methods that should be defined on
608
+ * the component's constructor instead of its prototype (static methods).
609
+ *
610
+ * @type {object}
611
+ * @optional
612
+ */
613
+ statics: 'DEFINE_MANY',
614
+
615
+ /**
616
+ * Definition of prop types for this component.
617
+ *
618
+ * @type {object}
619
+ * @optional
620
+ */
621
+ propTypes: 'DEFINE_MANY',
622
+
623
+ /**
624
+ * Definition of context types for this component.
625
+ *
626
+ * @type {object}
627
+ * @optional
628
+ */
629
+ contextTypes: 'DEFINE_MANY',
630
+
631
+ /**
632
+ * Definition of context types this component sets for its children.
633
+ *
634
+ * @type {object}
635
+ * @optional
636
+ */
637
+ childContextTypes: 'DEFINE_MANY',
638
+
639
+ // ==== Definition methods ====
640
+
641
+ /**
642
+ * Invoked when the component is mounted. Values in the mapping will be set on
643
+ * `this.props` if that prop is not specified (i.e. using an `in` check).
644
+ *
645
+ * This method is invoked before `getInitialState` and therefore cannot rely
646
+ * on `this.state` or use `this.setState`.
647
+ *
648
+ * @return {object}
649
+ * @optional
650
+ */
651
+ getDefaultProps: 'DEFINE_MANY_MERGED',
652
+
653
+ /**
654
+ * Invoked once before the component is mounted. The return value will be used
655
+ * as the initial value of `this.state`.
656
+ *
657
+ * getInitialState: function() {
658
+ * return {
659
+ * isOn: false,
660
+ * fooBaz: new BazFoo()
661
+ * }
662
+ * }
663
+ *
664
+ * @return {object}
665
+ * @optional
666
+ */
667
+ getInitialState: 'DEFINE_MANY_MERGED',
668
+
669
+ /**
670
+ * @return {object}
671
+ * @optional
672
+ */
673
+ getChildContext: 'DEFINE_MANY_MERGED',
674
+
675
+ /**
676
+ * Uses props from `this.props` and state from `this.state` to render the
677
+ * structure of the component.
678
+ *
679
+ * No guarantees are made about when or how often this method is invoked, so
680
+ * it must not have side effects.
681
+ *
682
+ * render: function() {
683
+ * var name = this.props.name;
684
+ * return <div>Hello, {name}!</div>;
685
+ * }
686
+ *
687
+ * @return {ReactComponent}
688
+ * @required
689
+ */
690
+ render: 'DEFINE_ONCE',
691
+
692
+ // ==== Delegate methods ====
693
+
694
+ /**
695
+ * Invoked when the component is initially created and about to be mounted.
696
+ * This may have side effects, but any external subscriptions or data created
697
+ * by this method must be cleaned up in `componentWillUnmount`.
698
+ *
699
+ * @optional
700
+ */
701
+ componentWillMount: 'DEFINE_MANY',
702
+
703
+ /**
704
+ * Invoked when the component has been mounted and has a DOM representation.
705
+ * However, there is no guarantee that the DOM node is in the document.
706
+ *
707
+ * Use this as an opportunity to operate on the DOM when the component has
708
+ * been mounted (initialized and rendered) for the first time.
709
+ *
710
+ * @param {DOMElement} rootNode DOM element representing the component.
711
+ * @optional
712
+ */
713
+ componentDidMount: 'DEFINE_MANY',
714
+
715
+ /**
716
+ * Invoked before the component receives new props.
717
+ *
718
+ * Use this as an opportunity to react to a prop transition by updating the
719
+ * state using `this.setState`. Current props are accessed via `this.props`.
720
+ *
721
+ * componentWillReceiveProps: function(nextProps, nextContext) {
722
+ * this.setState({
723
+ * likesIncreasing: nextProps.likeCount > this.props.likeCount
724
+ * });
725
+ * }
726
+ *
727
+ * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
728
+ * transition may cause a state change, but the opposite is not true. If you
729
+ * need it, you are probably looking for `componentWillUpdate`.
730
+ *
731
+ * @param {object} nextProps
732
+ * @optional
733
+ */
734
+ componentWillReceiveProps: 'DEFINE_MANY',
735
+
736
+ /**
737
+ * Invoked while deciding if the component should be updated as a result of
738
+ * receiving new props, state and/or context.
739
+ *
740
+ * Use this as an opportunity to `return false` when you're certain that the
741
+ * transition to the new props/state/context will not require a component
742
+ * update.
743
+ *
744
+ * shouldComponentUpdate: function(nextProps, nextState, nextContext) {
745
+ * return !equal(nextProps, this.props) ||
746
+ * !equal(nextState, this.state) ||
747
+ * !equal(nextContext, this.context);
748
+ * }
749
+ *
750
+ * @param {object} nextProps
751
+ * @param {?object} nextState
752
+ * @param {?object} nextContext
753
+ * @return {boolean} True if the component should update.
754
+ * @optional
755
+ */
756
+ shouldComponentUpdate: 'DEFINE_ONCE',
757
+
758
+ /**
759
+ * Invoked when the component is about to update due to a transition from
760
+ * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
761
+ * and `nextContext`.
762
+ *
763
+ * Use this as an opportunity to perform preparation before an update occurs.
764
+ *
765
+ * NOTE: You **cannot** use `this.setState()` in this method.
766
+ *
767
+ * @param {object} nextProps
768
+ * @param {?object} nextState
769
+ * @param {?object} nextContext
770
+ * @param {ReactReconcileTransaction} transaction
771
+ * @optional
772
+ */
773
+ componentWillUpdate: 'DEFINE_MANY',
774
+
775
+ /**
776
+ * Invoked when the component's DOM representation has been updated.
777
+ *
778
+ * Use this as an opportunity to operate on the DOM when the component has
779
+ * been updated.
780
+ *
781
+ * @param {object} prevProps
782
+ * @param {?object} prevState
783
+ * @param {?object} prevContext
784
+ * @param {DOMElement} rootNode DOM element representing the component.
785
+ * @optional
786
+ */
787
+ componentDidUpdate: 'DEFINE_MANY',
788
+
789
+ /**
790
+ * Invoked when the component is about to be removed from its parent and have
791
+ * its DOM representation destroyed.
792
+ *
793
+ * Use this as an opportunity to deallocate any external resources.
794
+ *
795
+ * NOTE: There is no `componentDidUnmount` since your component will have been
796
+ * destroyed by that point.
797
+ *
798
+ * @optional
799
+ */
800
+ componentWillUnmount: 'DEFINE_MANY',
801
+
802
+ // ==== Advanced methods ====
803
+
804
+ /**
805
+ * Updates the component's currently mounted DOM representation.
806
+ *
807
+ * By default, this implements React's rendering and reconciliation algorithm.
808
+ * Sophisticated clients may wish to override this.
809
+ *
810
+ * @param {ReactReconcileTransaction} transaction
811
+ * @internal
812
+ * @overridable
813
+ */
814
+ updateComponent: 'OVERRIDE_BASE'
815
+ };
816
+
817
+ /**
818
+ * Mapping from class specification keys to special processing functions.
819
+ *
820
+ * Although these are declared like instance properties in the specification
821
+ * when defining classes using `React.createClass`, they are actually static
822
+ * and are accessible on the constructor instead of the prototype. Despite
823
+ * being static, they must be defined outside of the "statics" key under
824
+ * which all other static methods are defined.
825
+ */
826
+ var RESERVED_SPEC_KEYS = {
827
+ displayName: function(Constructor, displayName) {
828
+ Constructor.displayName = displayName;
829
+ },
830
+ mixins: function(Constructor, mixins) {
831
+ if (mixins) {
832
+ for (var i = 0; i < mixins.length; i++) {
833
+ mixSpecIntoComponent(Constructor, mixins[i]);
834
+ }
835
+ }
836
+ },
837
+ childContextTypes: function(Constructor, childContextTypes) {
838
+ if (process.env.NODE_ENV !== 'production') {
839
+ validateTypeDef(Constructor, childContextTypes, 'childContext');
840
+ }
841
+ Constructor.childContextTypes = _assign(
842
+ {},
843
+ Constructor.childContextTypes,
844
+ childContextTypes
845
+ );
846
+ },
847
+ contextTypes: function(Constructor, contextTypes) {
848
+ if (process.env.NODE_ENV !== 'production') {
849
+ validateTypeDef(Constructor, contextTypes, 'context');
850
+ }
851
+ Constructor.contextTypes = _assign(
852
+ {},
853
+ Constructor.contextTypes,
854
+ contextTypes
855
+ );
856
+ },
857
+ /**
858
+ * Special case getDefaultProps which should move into statics but requires
859
+ * automatic merging.
860
+ */
861
+ getDefaultProps: function(Constructor, getDefaultProps) {
862
+ if (Constructor.getDefaultProps) {
863
+ Constructor.getDefaultProps = createMergedResultFunction(
864
+ Constructor.getDefaultProps,
865
+ getDefaultProps
866
+ );
867
+ } else {
868
+ Constructor.getDefaultProps = getDefaultProps;
869
+ }
870
+ },
871
+ propTypes: function(Constructor, propTypes) {
872
+ if (process.env.NODE_ENV !== 'production') {
873
+ validateTypeDef(Constructor, propTypes, 'prop');
874
+ }
875
+ Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
876
+ },
877
+ statics: function(Constructor, statics) {
878
+ mixStaticSpecIntoComponent(Constructor, statics);
879
+ },
880
+ autobind: function() {}
881
+ };
882
+
883
+ function validateTypeDef(Constructor, typeDef, location) {
884
+ for (var propName in typeDef) {
885
+ if (typeDef.hasOwnProperty(propName)) {
886
+ // use a warning instead of an _invariant so components
887
+ // don't show up in prod but only in __DEV__
888
+ if (process.env.NODE_ENV !== 'production') {
889
+ warning(
890
+ typeof typeDef[propName] === 'function',
891
+ '%s: %s type `%s` is invalid; it must be a function, usually from ' +
892
+ 'React.PropTypes.',
893
+ Constructor.displayName || 'ReactClass',
894
+ ReactPropTypeLocationNames[location],
895
+ propName
896
+ );
897
+ }
898
+ }
899
+ }
900
+ }
901
+
902
+ function validateMethodOverride(isAlreadyDefined, name) {
903
+ var specPolicy = ReactClassInterface.hasOwnProperty(name)
904
+ ? ReactClassInterface[name]
905
+ : null;
906
+
907
+ // Disallow overriding of base class methods unless explicitly allowed.
908
+ if (ReactClassMixin.hasOwnProperty(name)) {
909
+ _invariant(
910
+ specPolicy === 'OVERRIDE_BASE',
911
+ 'ReactClassInterface: You are attempting to override ' +
912
+ '`%s` from your class specification. Ensure that your method names ' +
913
+ 'do not overlap with React methods.',
914
+ name
915
+ );
916
+ }
917
+
918
+ // Disallow defining methods more than once unless explicitly allowed.
919
+ if (isAlreadyDefined) {
920
+ _invariant(
921
+ specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED',
922
+ 'ReactClassInterface: You are attempting to define ' +
923
+ '`%s` on your component more than once. This conflict may be due ' +
924
+ 'to a mixin.',
925
+ name
926
+ );
927
+ }
928
+ }
929
+
930
+ /**
931
+ * Mixin helper which handles policy validation and reserved
932
+ * specification keys when building React classes.
933
+ */
934
+ function mixSpecIntoComponent(Constructor, spec) {
935
+ if (!spec) {
936
+ if (process.env.NODE_ENV !== 'production') {
937
+ var typeofSpec = typeof spec;
938
+ var isMixinValid = typeofSpec === 'object' && spec !== null;
939
+
940
+ if (process.env.NODE_ENV !== 'production') {
941
+ warning(
942
+ isMixinValid,
943
+ "%s: You're attempting to include a mixin that is either null " +
944
+ 'or not an object. Check the mixins included by the component, ' +
945
+ 'as well as any mixins they include themselves. ' +
946
+ 'Expected object but got %s.',
947
+ Constructor.displayName || 'ReactClass',
948
+ spec === null ? null : typeofSpec
949
+ );
950
+ }
951
+ }
952
+
953
+ return;
954
+ }
955
+
956
+ _invariant(
957
+ typeof spec !== 'function',
958
+ "ReactClass: You're attempting to " +
959
+ 'use a component class or function as a mixin. Instead, just use a ' +
960
+ 'regular object.'
961
+ );
962
+ _invariant(
963
+ !isValidElement(spec),
964
+ "ReactClass: You're attempting to " +
965
+ 'use a component as a mixin. Instead, just use a regular object.'
966
+ );
967
+
968
+ var proto = Constructor.prototype;
969
+ var autoBindPairs = proto.__reactAutoBindPairs;
970
+
971
+ // By handling mixins before any other properties, we ensure the same
972
+ // chaining order is applied to methods with DEFINE_MANY policy, whether
973
+ // mixins are listed before or after these methods in the spec.
974
+ if (spec.hasOwnProperty(MIXINS_KEY)) {
975
+ RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
976
+ }
977
+
978
+ for (var name in spec) {
979
+ if (!spec.hasOwnProperty(name)) {
980
+ continue;
981
+ }
982
+
983
+ if (name === MIXINS_KEY) {
984
+ // We have already handled mixins in a special case above.
985
+ continue;
986
+ }
987
+
988
+ var property = spec[name];
989
+ var isAlreadyDefined = proto.hasOwnProperty(name);
990
+ validateMethodOverride(isAlreadyDefined, name);
991
+
992
+ if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
993
+ RESERVED_SPEC_KEYS[name](Constructor, property);
994
+ } else {
995
+ // Setup methods on prototype:
996
+ // The following member methods should not be automatically bound:
997
+ // 1. Expected ReactClass methods (in the "interface").
998
+ // 2. Overridden methods (that were mixed in).
999
+ var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
1000
+ var isFunction = typeof property === 'function';
1001
+ var shouldAutoBind =
1002
+ isFunction &&
1003
+ !isReactClassMethod &&
1004
+ !isAlreadyDefined &&
1005
+ spec.autobind !== false;
1006
+
1007
+ if (shouldAutoBind) {
1008
+ autoBindPairs.push(name, property);
1009
+ proto[name] = property;
1010
+ } else {
1011
+ if (isAlreadyDefined) {
1012
+ var specPolicy = ReactClassInterface[name];
1013
+
1014
+ // These cases should already be caught by validateMethodOverride.
1015
+ _invariant(
1016
+ isReactClassMethod &&
1017
+ (specPolicy === 'DEFINE_MANY_MERGED' ||
1018
+ specPolicy === 'DEFINE_MANY'),
1019
+ 'ReactClass: Unexpected spec policy %s for key %s ' +
1020
+ 'when mixing in component specs.',
1021
+ specPolicy,
1022
+ name
1023
+ );
1024
+
1025
+ // For methods which are defined more than once, call the existing
1026
+ // methods before calling the new property, merging if appropriate.
1027
+ if (specPolicy === 'DEFINE_MANY_MERGED') {
1028
+ proto[name] = createMergedResultFunction(proto[name], property);
1029
+ } else if (specPolicy === 'DEFINE_MANY') {
1030
+ proto[name] = createChainedFunction(proto[name], property);
1031
+ }
1032
+ } else {
1033
+ proto[name] = property;
1034
+ if (process.env.NODE_ENV !== 'production') {
1035
+ // Add verbose displayName to the function, which helps when looking
1036
+ // at profiling tools.
1037
+ if (typeof property === 'function' && spec.displayName) {
1038
+ proto[name].displayName = spec.displayName + '_' + name;
1039
+ }
1040
+ }
1041
+ }
1042
+ }
1043
+ }
1044
+ }
1045
+ }
1046
+
1047
+ function mixStaticSpecIntoComponent(Constructor, statics) {
1048
+ if (!statics) {
1049
+ return;
1050
+ }
1051
+ for (var name in statics) {
1052
+ var property = statics[name];
1053
+ if (!statics.hasOwnProperty(name)) {
1054
+ continue;
1055
+ }
1056
+
1057
+ var isReserved = name in RESERVED_SPEC_KEYS;
1058
+ _invariant(
1059
+ !isReserved,
1060
+ 'ReactClass: You are attempting to define a reserved ' +
1061
+ 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' +
1062
+ 'as an instance property instead; it will still be accessible on the ' +
1063
+ 'constructor.',
1064
+ name
1065
+ );
1066
+
1067
+ var isInherited = name in Constructor;
1068
+ _invariant(
1069
+ !isInherited,
1070
+ 'ReactClass: You are attempting to define ' +
1071
+ '`%s` on your component more than once. This conflict may be ' +
1072
+ 'due to a mixin.',
1073
+ name
1074
+ );
1075
+ Constructor[name] = property;
1076
+ }
1077
+ }
1078
+
1079
+ /**
1080
+ * Merge two objects, but throw if both contain the same key.
1081
+ *
1082
+ * @param {object} one The first object, which is mutated.
1083
+ * @param {object} two The second object
1084
+ * @return {object} one after it has been mutated to contain everything in two.
1085
+ */
1086
+ function mergeIntoWithNoDuplicateKeys(one, two) {
1087
+ _invariant(
1088
+ one && two && typeof one === 'object' && typeof two === 'object',
1089
+ 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'
1090
+ );
1091
+
1092
+ for (var key in two) {
1093
+ if (two.hasOwnProperty(key)) {
1094
+ _invariant(
1095
+ one[key] === undefined,
1096
+ 'mergeIntoWithNoDuplicateKeys(): ' +
1097
+ 'Tried to merge two objects with the same key: `%s`. This conflict ' +
1098
+ 'may be due to a mixin; in particular, this may be caused by two ' +
1099
+ 'getInitialState() or getDefaultProps() methods returning objects ' +
1100
+ 'with clashing keys.',
1101
+ key
1102
+ );
1103
+ one[key] = two[key];
1104
+ }
1105
+ }
1106
+ return one;
1107
+ }
1108
+
1109
+ /**
1110
+ * Creates a function that invokes two functions and merges their return values.
1111
+ *
1112
+ * @param {function} one Function to invoke first.
1113
+ * @param {function} two Function to invoke second.
1114
+ * @return {function} Function that invokes the two argument functions.
1115
+ * @private
1116
+ */
1117
+ function createMergedResultFunction(one, two) {
1118
+ return function mergedResult() {
1119
+ var a = one.apply(this, arguments);
1120
+ var b = two.apply(this, arguments);
1121
+ if (a == null) {
1122
+ return b;
1123
+ } else if (b == null) {
1124
+ return a;
1125
+ }
1126
+ var c = {};
1127
+ mergeIntoWithNoDuplicateKeys(c, a);
1128
+ mergeIntoWithNoDuplicateKeys(c, b);
1129
+ return c;
1130
+ };
1131
+ }
1132
+
1133
+ /**
1134
+ * Creates a function that invokes two functions and ignores their return vales.
1135
+ *
1136
+ * @param {function} one Function to invoke first.
1137
+ * @param {function} two Function to invoke second.
1138
+ * @return {function} Function that invokes the two argument functions.
1139
+ * @private
1140
+ */
1141
+ function createChainedFunction(one, two) {
1142
+ return function chainedFunction() {
1143
+ one.apply(this, arguments);
1144
+ two.apply(this, arguments);
1145
+ };
1146
+ }
1147
+
1148
+ /**
1149
+ * Binds a method to the component.
1150
+ *
1151
+ * @param {object} component Component whose method is going to be bound.
1152
+ * @param {function} method Method to be bound.
1153
+ * @return {function} The bound method.
1154
+ */
1155
+ function bindAutoBindMethod(component, method) {
1156
+ var boundMethod = method.bind(component);
1157
+ if (process.env.NODE_ENV !== 'production') {
1158
+ boundMethod.__reactBoundContext = component;
1159
+ boundMethod.__reactBoundMethod = method;
1160
+ boundMethod.__reactBoundArguments = null;
1161
+ var componentName = component.constructor.displayName;
1162
+ var _bind = boundMethod.bind;
1163
+ boundMethod.bind = function(newThis) {
1164
+ for (
1165
+ var _len = arguments.length,
1166
+ args = Array(_len > 1 ? _len - 1 : 0),
1167
+ _key = 1;
1168
+ _key < _len;
1169
+ _key++
1170
+ ) {
1171
+ args[_key - 1] = arguments[_key];
1172
+ }
1173
+
1174
+ // User is trying to bind() an autobound method; we effectively will
1175
+ // ignore the value of "this" that the user is trying to use, so
1176
+ // let's warn.
1177
+ if (newThis !== component && newThis !== null) {
1178
+ if (process.env.NODE_ENV !== 'production') {
1179
+ warning(
1180
+ false,
1181
+ 'bind(): React component methods may only be bound to the ' +
1182
+ 'component instance. See %s',
1183
+ componentName
1184
+ );
1185
+ }
1186
+ } else if (!args.length) {
1187
+ if (process.env.NODE_ENV !== 'production') {
1188
+ warning(
1189
+ false,
1190
+ 'bind(): You are binding a component method to the component. ' +
1191
+ 'React does this for you automatically in a high-performance ' +
1192
+ 'way, so you can safely remove this call. See %s',
1193
+ componentName
1194
+ );
1195
+ }
1196
+ return boundMethod;
1197
+ }
1198
+ var reboundMethod = _bind.apply(boundMethod, arguments);
1199
+ reboundMethod.__reactBoundContext = component;
1200
+ reboundMethod.__reactBoundMethod = method;
1201
+ reboundMethod.__reactBoundArguments = args;
1202
+ return reboundMethod;
1203
+ };
1204
+ }
1205
+ return boundMethod;
1206
+ }
1207
+
1208
+ /**
1209
+ * Binds all auto-bound methods in a component.
1210
+ *
1211
+ * @param {object} component Component whose method is going to be bound.
1212
+ */
1213
+ function bindAutoBindMethods(component) {
1214
+ var pairs = component.__reactAutoBindPairs;
1215
+ for (var i = 0; i < pairs.length; i += 2) {
1216
+ var autoBindKey = pairs[i];
1217
+ var method = pairs[i + 1];
1218
+ component[autoBindKey] = bindAutoBindMethod(component, method);
1219
+ }
1220
+ }
1221
+
1222
+ var IsMountedPreMixin = {
1223
+ componentDidMount: function() {
1224
+ this.__isMounted = true;
1225
+ }
1226
+ };
1227
+
1228
+ var IsMountedPostMixin = {
1229
+ componentWillUnmount: function() {
1230
+ this.__isMounted = false;
1231
+ }
1232
+ };
1233
+
1234
+ /**
1235
+ * Add more to the ReactClass base class. These are all legacy features and
1236
+ * therefore not already part of the modern ReactComponent.
1237
+ */
1238
+ var ReactClassMixin = {
1239
+ /**
1240
+ * TODO: This will be deprecated because state should always keep a consistent
1241
+ * type signature and the only use case for this, is to avoid that.
1242
+ */
1243
+ replaceState: function(newState, callback) {
1244
+ this.updater.enqueueReplaceState(this, newState, callback);
1245
+ },
1246
+
1247
+ /**
1248
+ * Checks whether or not this composite component is mounted.
1249
+ * @return {boolean} True if mounted, false otherwise.
1250
+ * @protected
1251
+ * @final
1252
+ */
1253
+ isMounted: function() {
1254
+ if (process.env.NODE_ENV !== 'production') {
1255
+ warning(
1256
+ this.__didWarnIsMounted,
1257
+ '%s: isMounted is deprecated. Instead, make sure to clean up ' +
1258
+ 'subscriptions and pending requests in componentWillUnmount to ' +
1259
+ 'prevent memory leaks.',
1260
+ (this.constructor && this.constructor.displayName) ||
1261
+ this.name ||
1262
+ 'Component'
1263
+ );
1264
+ this.__didWarnIsMounted = true;
1265
+ }
1266
+ return !!this.__isMounted;
1267
+ }
1268
+ };
1269
+
1270
+ var ReactClassComponent = function() {};
1271
+ _assign(
1272
+ ReactClassComponent.prototype,
1273
+ ReactComponent.prototype,
1274
+ ReactClassMixin
1275
+ );
1276
+
1277
+ /**
1278
+ * Creates a composite component class given a class specification.
1279
+ * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass
1280
+ *
1281
+ * @param {object} spec Class specification (which must define `render`).
1282
+ * @return {function} Component constructor function.
1283
+ * @public
1284
+ */
1285
+ function createClass(spec) {
1286
+ // To keep our warnings more understandable, we'll use a little hack here to
1287
+ // ensure that Constructor.name !== 'Constructor'. This makes sure we don't
1288
+ // unnecessarily identify a class without displayName as 'Constructor'.
1289
+ var Constructor = identity(function(props, context, updater) {
1290
+ // This constructor gets overridden by mocks. The argument is used
1291
+ // by mocks to assert on what gets mounted.
1292
+
1293
+ if (process.env.NODE_ENV !== 'production') {
1294
+ warning(
1295
+ this instanceof Constructor,
1296
+ 'Something is calling a React component directly. Use a factory or ' +
1297
+ 'JSX instead. See: https://fb.me/react-legacyfactory'
1298
+ );
1299
+ }
1300
+
1301
+ // Wire up auto-binding
1302
+ if (this.__reactAutoBindPairs.length) {
1303
+ bindAutoBindMethods(this);
1304
+ }
1305
+
1306
+ this.props = props;
1307
+ this.context = context;
1308
+ this.refs = emptyObject;
1309
+ this.updater = updater || ReactNoopUpdateQueue;
1310
+
1311
+ this.state = null;
1312
+
1313
+ // ReactClasses doesn't have constructors. Instead, they use the
1314
+ // getInitialState and componentWillMount methods for initialization.
1315
+
1316
+ var initialState = this.getInitialState ? this.getInitialState() : null;
1317
+ if (process.env.NODE_ENV !== 'production') {
1318
+ // We allow auto-mocks to proceed as if they're returning null.
1319
+ if (
1320
+ initialState === undefined &&
1321
+ this.getInitialState._isMockFunction
1322
+ ) {
1323
+ // This is probably bad practice. Consider warning here and
1324
+ // deprecating this convenience.
1325
+ initialState = null;
1326
+ }
1327
+ }
1328
+ _invariant(
1329
+ typeof initialState === 'object' && !Array.isArray(initialState),
1330
+ '%s.getInitialState(): must return an object or null',
1331
+ Constructor.displayName || 'ReactCompositeComponent'
1332
+ );
1333
+
1334
+ this.state = initialState;
1335
+ });
1336
+ Constructor.prototype = new ReactClassComponent();
1337
+ Constructor.prototype.constructor = Constructor;
1338
+ Constructor.prototype.__reactAutoBindPairs = [];
1339
+
1340
+ injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
1341
+
1342
+ mixSpecIntoComponent(Constructor, IsMountedPreMixin);
1343
+ mixSpecIntoComponent(Constructor, spec);
1344
+ mixSpecIntoComponent(Constructor, IsMountedPostMixin);
1345
+
1346
+ // Initialize the defaultProps property after all mixins have been merged.
1347
+ if (Constructor.getDefaultProps) {
1348
+ Constructor.defaultProps = Constructor.getDefaultProps();
1349
+ }
1350
+
1351
+ if (process.env.NODE_ENV !== 'production') {
1352
+ // This is a tag to indicate that the use of these method names is ok,
1353
+ // since it's used with createClass. If it's not, then it's likely a
1354
+ // mistake so we'll warn you to use the static property, property
1355
+ // initializer or constructor respectively.
1356
+ if (Constructor.getDefaultProps) {
1357
+ Constructor.getDefaultProps.isReactClassApproved = {};
1358
+ }
1359
+ if (Constructor.prototype.getInitialState) {
1360
+ Constructor.prototype.getInitialState.isReactClassApproved = {};
1361
+ }
1362
+ }
1363
+
1364
+ _invariant(
1365
+ Constructor.prototype.render,
1366
+ 'createClass(...): Class specification must implement a `render` method.'
1367
+ );
1368
+
1369
+ if (process.env.NODE_ENV !== 'production') {
1370
+ warning(
1371
+ !Constructor.prototype.componentShouldUpdate,
1372
+ '%s has a method called ' +
1373
+ 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
1374
+ 'The name is phrased as a question because the function is ' +
1375
+ 'expected to return a value.',
1376
+ spec.displayName || 'A component'
1377
+ );
1378
+ warning(
1379
+ !Constructor.prototype.componentWillRecieveProps,
1380
+ '%s has a method called ' +
1381
+ 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?',
1382
+ spec.displayName || 'A component'
1383
+ );
1384
+ }
1385
+
1386
+ // Reduce time spent doing lookups by setting these on the prototype.
1387
+ for (var methodName in ReactClassInterface) {
1388
+ if (!Constructor.prototype[methodName]) {
1389
+ Constructor.prototype[methodName] = null;
1390
+ }
1391
+ }
1392
+
1393
+ return Constructor;
1394
+ }
1395
+
1396
+ return createClass;
1397
+ }
1398
+
1399
+ module.exports = factory;
1400
+
1401
+
1402
+ /***/ }),
1403
+ /* 4 */
1404
+ /***/ (function(module, exports) {
1405
+
1406
+ /*
1407
+ object-assign
1408
+ (c) Sindre Sorhus
1409
+ @license MIT
1410
+ */
1411
+
1412
+ 'use strict';
1413
+ /* eslint-disable no-unused-vars */
1414
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
1415
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
1416
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
1417
+
1418
+ function toObject(val) {
1419
+ if (val === null || val === undefined) {
1420
+ throw new TypeError('Object.assign cannot be called with null or undefined');
1421
+ }
1422
+
1423
+ return Object(val);
1424
+ }
1425
+
1426
+ function shouldUseNative() {
1427
+ try {
1428
+ if (!Object.assign) {
1429
+ return false;
1430
+ }
1431
+
1432
+ // Detect buggy property enumeration order in older V8 versions.
1433
+
1434
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
1435
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
1436
+ test1[5] = 'de';
1437
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
1438
+ return false;
1439
+ }
1440
+
1441
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
1442
+ var test2 = {};
1443
+ for (var i = 0; i < 10; i++) {
1444
+ test2['_' + String.fromCharCode(i)] = i;
1445
+ }
1446
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
1447
+ return test2[n];
1448
+ });
1449
+ if (order2.join('') !== '0123456789') {
1450
+ return false;
1451
+ }
1452
+
1453
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
1454
+ var test3 = {};
1455
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
1456
+ test3[letter] = letter;
1457
+ });
1458
+ if (Object.keys(Object.assign({}, test3)).join('') !==
1459
+ 'abcdefghijklmnopqrst') {
1460
+ return false;
1461
+ }
1462
+
1463
+ return true;
1464
+ } catch (err) {
1465
+ // We don't expect any of the above to throw, but better to be safe.
1466
+ return false;
1467
+ }
1468
+ }
1469
+
1470
+ module.exports = shouldUseNative() ? Object.assign : function (target, source) {
1471
+ var from;
1472
+ var to = toObject(target);
1473
+ var symbols;
1474
+
1475
+ for (var s = 1; s < arguments.length; s++) {
1476
+ from = Object(arguments[s]);
1477
+
1478
+ for (var key in from) {
1479
+ if (hasOwnProperty.call(from, key)) {
1480
+ to[key] = from[key];
1481
+ }
1482
+ }
1483
+
1484
+ if (getOwnPropertySymbols) {
1485
+ symbols = getOwnPropertySymbols(from);
1486
+ for (var i = 0; i < symbols.length; i++) {
1487
+ if (propIsEnumerable.call(from, symbols[i])) {
1488
+ to[symbols[i]] = from[symbols[i]];
1489
+ }
1490
+ }
1491
+ }
1492
+ }
1493
+
1494
+ return to;
1495
+ };
1496
+
1497
+
1498
+ /***/ }),
1499
+ /* 5 */
1500
+ /***/ (function(module, exports) {
1501
+
1502
+ /**
1503
+ * Copyright (c) 2013-present, Facebook, Inc.
1504
+ * All rights reserved.
1505
+ *
1506
+ * This source code is licensed under the BSD-style license found in the
1507
+ * LICENSE file in the root directory of this source tree. An additional grant
1508
+ * of patent rights can be found in the PATENTS file in the same directory.
1509
+ *
1510
+ */
1511
+
1512
+ 'use strict';
1513
+
1514
+ var emptyObject = {};
1515
+
1516
+ if (process.env.NODE_ENV !== 'production') {
1517
+ Object.freeze(emptyObject);
1518
+ }
1519
+
1520
+ module.exports = emptyObject;
1521
+
1522
+ /***/ }),
1523
+ /* 6 */
1524
+ /***/ (function(module, exports) {
1525
+
1526
+ /**
1527
+ * Copyright (c) 2013-present, Facebook, Inc.
1528
+ * All rights reserved.
1529
+ *
1530
+ * This source code is licensed under the BSD-style license found in the
1531
+ * LICENSE file in the root directory of this source tree. An additional grant
1532
+ * of patent rights can be found in the PATENTS file in the same directory.
1533
+ *
1534
+ */
1535
+
1536
+ 'use strict';
1537
+
1538
+ /**
1539
+ * Use invariant() to assert state which your program assumes to be true.
1540
+ *
1541
+ * Provide sprintf-style format (only %s is supported) and arguments
1542
+ * to provide information about what broke and what you were
1543
+ * expecting.
1544
+ *
1545
+ * The invariant message will be stripped in production, but the invariant
1546
+ * will remain to ensure logic does not differ in production.
1547
+ */
1548
+
1549
+ var validateFormat = function validateFormat(format) {};
1550
+
1551
+ if (process.env.NODE_ENV !== 'production') {
1552
+ validateFormat = function validateFormat(format) {
1553
+ if (format === undefined) {
1554
+ throw new Error('invariant requires an error message argument');
1555
+ }
1556
+ };
1557
+ }
1558
+
1559
+ function invariant(condition, format, a, b, c, d, e, f) {
1560
+ validateFormat(format);
1561
+
1562
+ if (!condition) {
1563
+ var error;
1564
+ if (format === undefined) {
1565
+ error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
1566
+ } else {
1567
+ var args = [a, b, c, d, e, f];
1568
+ var argIndex = 0;
1569
+ error = new Error(format.replace(/%s/g, function () {
1570
+ return args[argIndex++];
1571
+ }));
1572
+ error.name = 'Invariant Violation';
1573
+ }
1574
+
1575
+ error.framesToPop = 1; // we don't care about invariant's own frame
1576
+ throw error;
1577
+ }
1578
+ }
1579
+
1580
+ module.exports = invariant;
1581
+
1582
+ /***/ }),
1583
+ /* 7 */
1584
+ /***/ (function(module, exports, __webpack_require__) {
1585
+
1586
+ /**
1587
+ * Copyright 2014-2015, Facebook, Inc.
1588
+ * All rights reserved.
1589
+ *
1590
+ * This source code is licensed under the BSD-style license found in the
1591
+ * LICENSE file in the root directory of this source tree. An additional grant
1592
+ * of patent rights can be found in the PATENTS file in the same directory.
1593
+ *
1594
+ */
1595
+
1596
+ 'use strict';
1597
+
1598
+ var emptyFunction = __webpack_require__(8);
1599
+
1600
+ /**
1601
+ * Similar to invariant but only logs a warning if the condition is not met.
1602
+ * This can be used to log issues in development environments in critical
1603
+ * paths. Removing the logging code for production environments will keep the
1604
+ * same logic and follow the same code paths.
1605
+ */
1606
+
1607
+ var warning = emptyFunction;
1608
+
1609
+ if (process.env.NODE_ENV !== 'production') {
1610
+ var printWarning = function printWarning(format) {
1611
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1612
+ args[_key - 1] = arguments[_key];
1613
+ }
1614
+
1615
+ var argIndex = 0;
1616
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
1617
+ return args[argIndex++];
1618
+ });
1619
+ if (typeof console !== 'undefined') {
1620
+ console.error(message);
1621
+ }
1622
+ try {
1623
+ // --- Welcome to debugging React ---
1624
+ // This error was thrown as a convenience so that you can use this stack
1625
+ // to find the callsite that caused this warning to fire.
1626
+ throw new Error(message);
1627
+ } catch (x) {}
1628
+ };
1629
+
1630
+ warning = function warning(condition, format) {
1631
+ if (format === undefined) {
1632
+ throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
1633
+ }
1634
+
1635
+ if (format.indexOf('Failed Composite propType: ') === 0) {
1636
+ return; // Ignore CompositeComponent proptype check.
1637
+ }
1638
+
1639
+ if (!condition) {
1640
+ for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
1641
+ args[_key2 - 2] = arguments[_key2];
1642
+ }
1643
+
1644
+ printWarning.apply(undefined, [format].concat(args));
1645
+ }
1646
+ };
1647
+ }
1648
+
1649
+ module.exports = warning;
1650
+
1651
+ /***/ }),
1652
+ /* 8 */
1653
+ /***/ (function(module, exports) {
1654
+
1655
+ "use strict";
1656
+
1657
+ /**
1658
+ * Copyright (c) 2013-present, Facebook, Inc.
1659
+ * All rights reserved.
1660
+ *
1661
+ * This source code is licensed under the BSD-style license found in the
1662
+ * LICENSE file in the root directory of this source tree. An additional grant
1663
+ * of patent rights can be found in the PATENTS file in the same directory.
1664
+ *
1665
+ *
1666
+ */
1667
+
1668
+ function makeEmptyFunction(arg) {
1669
+ return function () {
1670
+ return arg;
1671
+ };
1672
+ }
1673
+
1674
+ /**
1675
+ * This function accepts and discards inputs; it has no side effects. This is
1676
+ * primarily useful idiomatically for overridable function endpoints which
1677
+ * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
1678
+ */
1679
+ var emptyFunction = function emptyFunction() {};
1680
+
1681
+ emptyFunction.thatReturns = makeEmptyFunction;
1682
+ emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
1683
+ emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
1684
+ emptyFunction.thatReturnsNull = makeEmptyFunction(null);
1685
+ emptyFunction.thatReturnsThis = function () {
1686
+ return this;
1687
+ };
1688
+ emptyFunction.thatReturnsArgument = function (arg) {
1689
+ return arg;
1690
+ };
1691
+
1692
+ module.exports = emptyFunction;
1693
+
1694
+ /***/ }),
1695
+ /* 9 */
1696
+ /***/ (function(module, exports) {
1697
+
1698
+ 'use strict';
1699
+
1700
+ var NumeralFormatter = function NumeralFormatter(numeralDecimalMark, numeralIntegerScale, numeralDecimalScale, numeralThousandsGroupStyle, numeralPositiveOnly, stripLeadingZeroes, delimiter) {
1701
+ var owner = this;
1702
+
1703
+ owner.numeralDecimalMark = numeralDecimalMark || '.';
1704
+ owner.numeralIntegerScale = numeralIntegerScale > 0 ? numeralIntegerScale : 0;
1705
+ owner.numeralDecimalScale = numeralDecimalScale >= 0 ? numeralDecimalScale : 2;
1706
+ owner.numeralThousandsGroupStyle = numeralThousandsGroupStyle || NumeralFormatter.groupStyle.thousand;
1707
+ owner.numeralPositiveOnly = !!numeralPositiveOnly;
1708
+ owner.stripLeadingZeroes = stripLeadingZeroes !== false;
1709
+ owner.delimiter = delimiter || delimiter === '' ? delimiter : ',';
1710
+ owner.delimiterRE = delimiter ? new RegExp('\\' + delimiter, 'g') : '';
1711
+ };
1712
+
1713
+ NumeralFormatter.groupStyle = {
1714
+ thousand: 'thousand',
1715
+ lakh: 'lakh',
1716
+ wan: 'wan',
1717
+ none: 'none'
1718
+ };
1719
+
1720
+ NumeralFormatter.prototype = {
1721
+ getRawValue: function getRawValue(value) {
1722
+ return value.replace(this.delimiterRE, '').replace(this.numeralDecimalMark, '.');
1723
+ },
1724
+
1725
+ format: function format(value) {
1726
+ var owner = this,
1727
+ parts,
1728
+ partInteger,
1729
+ partDecimal = '';
1730
+
1731
+ // strip alphabet letters
1732
+ value = value.replace(/[A-Za-z]/g, '')
1733
+ // replace the first decimal mark with reserved placeholder
1734
+ .replace(owner.numeralDecimalMark, 'M')
1735
+
1736
+ // strip non numeric letters except minus and "M"
1737
+ // this is to ensure prefix has been stripped
1738
+ .replace(/[^\dM-]/g, '')
1739
+
1740
+ // replace the leading minus with reserved placeholder
1741
+ .replace(/^\-/, 'N')
1742
+
1743
+ // strip the other minus sign (if present)
1744
+ .replace(/\-/g, '')
1745
+
1746
+ // replace the minus sign (if present)
1747
+ .replace('N', owner.numeralPositiveOnly ? '' : '-')
1748
+
1749
+ // replace decimal mark
1750
+ .replace('M', owner.numeralDecimalMark);
1751
+
1752
+ // strip any leading zeros
1753
+ if (owner.stripLeadingZeroes) {
1754
+ value = value.replace(/^(-)?0+(?=\d)/, '$1');
1755
+ }
1756
+
1757
+ partInteger = value;
1758
+
1759
+ if (value.indexOf(owner.numeralDecimalMark) >= 0) {
1760
+ parts = value.split(owner.numeralDecimalMark);
1761
+ partInteger = parts[0];
1762
+ partDecimal = owner.numeralDecimalMark + parts[1].slice(0, owner.numeralDecimalScale);
1763
+ }
1764
+
1765
+ if (owner.numeralIntegerScale > 0) {
1766
+ partInteger = partInteger.slice(0, owner.numeralIntegerScale + (value.slice(0, 1) === '-' ? 1 : 0));
1767
+ }
1768
+
1769
+ switch (owner.numeralThousandsGroupStyle) {
1770
+ case NumeralFormatter.groupStyle.lakh:
1771
+ partInteger = partInteger.replace(/(\d)(?=(\d\d)+\d$)/g, '$1' + owner.delimiter);
1772
+
1773
+ break;
1774
+
1775
+ case NumeralFormatter.groupStyle.wan:
1776
+ partInteger = partInteger.replace(/(\d)(?=(\d{4})+$)/g, '$1' + owner.delimiter);
1777
+
1778
+ break;
1779
+
1780
+ case NumeralFormatter.groupStyle.thousand:
1781
+ partInteger = partInteger.replace(/(\d)(?=(\d{3})+$)/g, '$1' + owner.delimiter);
1782
+
1783
+ break;
1784
+ }
1785
+
1786
+ return partInteger.toString() + (owner.numeralDecimalScale > 0 ? partDecimal.toString() : '');
1787
+ }
1788
+ };
1789
+
1790
+ module.exports = NumeralFormatter;
1791
+
1792
+ /***/ }),
1793
+ /* 10 */
1794
+ /***/ (function(module, exports) {
1795
+
1796
+ 'use strict';
1797
+
1798
+ var DateFormatter = function DateFormatter(datePattern) {
1799
+ var owner = this;
1800
+
1801
+ owner.date = [];
1802
+ owner.blocks = [];
1803
+ owner.datePattern = datePattern;
1804
+ owner.initBlocks();
1805
+ };
1806
+
1807
+ DateFormatter.prototype = {
1808
+ initBlocks: function initBlocks() {
1809
+ var owner = this;
1810
+ owner.datePattern.forEach(function (value) {
1811
+ if (value === 'Y') {
1812
+ owner.blocks.push(4);
1813
+ } else {
1814
+ owner.blocks.push(2);
1815
+ }
1816
+ });
1817
+ },
1818
+
1819
+ getISOFormatDate: function getISOFormatDate() {
1820
+ var owner = this,
1821
+ date = owner.date;
1822
+
1823
+ return date[2] ? date[2] + '-' + owner.addLeadingZero(date[1]) + '-' + owner.addLeadingZero(date[0]) : '';
1824
+ },
1825
+
1826
+ getBlocks: function getBlocks() {
1827
+ return this.blocks;
1828
+ },
1829
+
1830
+ getValidatedDate: function getValidatedDate(value) {
1831
+ var owner = this,
1832
+ result = '';
1833
+
1834
+ value = value.replace(/[^\d]/g, '');
1835
+
1836
+ owner.blocks.forEach(function (length, index) {
1837
+ if (value.length > 0) {
1838
+ var sub = value.slice(0, length),
1839
+ sub0 = sub.slice(0, 1),
1840
+ rest = value.slice(length);
1841
+
1842
+ switch (owner.datePattern[index]) {
1843
+ case 'd':
1844
+ if (sub === '00') {
1845
+ sub = '01';
1846
+ } else if (parseInt(sub0, 10) > 3) {
1847
+ sub = '0' + sub0;
1848
+ } else if (parseInt(sub, 10) > 31) {
1849
+ sub = '31';
1850
+ }
1851
+
1852
+ break;
1853
+
1854
+ case 'm':
1855
+ if (sub === '00') {
1856
+ sub = '01';
1857
+ } else if (parseInt(sub0, 10) > 1) {
1858
+ sub = '0' + sub0;
1859
+ } else if (parseInt(sub, 10) > 12) {
1860
+ sub = '12';
1861
+ }
1862
+
1863
+ break;
1864
+ }
1865
+
1866
+ result += sub;
1867
+
1868
+ // update remaining string
1869
+ value = rest;
1870
+ }
1871
+ });
1872
+
1873
+ return this.getFixedDateString(result);
1874
+ },
1875
+
1876
+ getFixedDateString: function getFixedDateString(value) {
1877
+ var owner = this,
1878
+ datePattern = owner.datePattern,
1879
+ date = [],
1880
+ dayIndex = 0,
1881
+ monthIndex = 0,
1882
+ yearIndex = 0,
1883
+ dayStartIndex = 0,
1884
+ monthStartIndex = 0,
1885
+ yearStartIndex = 0,
1886
+ day,
1887
+ month,
1888
+ year,
1889
+ fullYearDone = false;
1890
+
1891
+ // mm-dd || dd-mm
1892
+ if (value.length === 4 && datePattern[0].toLowerCase() !== 'y' && datePattern[1].toLowerCase() !== 'y') {
1893
+ dayStartIndex = datePattern[0] === 'd' ? 0 : 2;
1894
+ monthStartIndex = 2 - dayStartIndex;
1895
+ day = parseInt(value.slice(dayStartIndex, dayStartIndex + 2), 10);
1896
+ month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10);
1897
+
1898
+ date = this.getFixedDate(day, month, 0);
1899
+ }
1900
+
1901
+ // yyyy-mm-dd || yyyy-dd-mm || mm-dd-yyyy || dd-mm-yyyy || dd-yyyy-mm || mm-yyyy-dd
1902
+ if (value.length === 8) {
1903
+ datePattern.forEach(function (type, index) {
1904
+ switch (type) {
1905
+ case 'd':
1906
+ dayIndex = index;
1907
+ break;
1908
+ case 'm':
1909
+ monthIndex = index;
1910
+ break;
1911
+ default:
1912
+ yearIndex = index;
1913
+ break;
1914
+ }
1915
+ });
1916
+
1917
+ yearStartIndex = yearIndex * 2;
1918
+ dayStartIndex = dayIndex <= yearIndex ? dayIndex * 2 : dayIndex * 2 + 2;
1919
+ monthStartIndex = monthIndex <= yearIndex ? monthIndex * 2 : monthIndex * 2 + 2;
1920
+
1921
+ day = parseInt(value.slice(dayStartIndex, dayStartIndex + 2), 10);
1922
+ month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10);
1923
+ year = parseInt(value.slice(yearStartIndex, yearStartIndex + 4), 10);
1924
+
1925
+ fullYearDone = value.slice(yearStartIndex, yearStartIndex + 4).length === 4;
1926
+
1927
+ date = this.getFixedDate(day, month, year);
1928
+ }
1929
+
1930
+ owner.date = date;
1931
+
1932
+ return date.length === 0 ? value : datePattern.reduce(function (previous, current) {
1933
+ switch (current) {
1934
+ case 'd':
1935
+ return previous + owner.addLeadingZero(date[0]);
1936
+ case 'm':
1937
+ return previous + owner.addLeadingZero(date[1]);
1938
+ default:
1939
+ return previous + (fullYearDone ? owner.addLeadingZeroForYear(date[2]) : '');
1940
+ }
1941
+ }, '');
1942
+ },
1943
+
1944
+ getFixedDate: function getFixedDate(day, month, year) {
1945
+ day = Math.min(day, 31);
1946
+ month = Math.min(month, 12);
1947
+ year = parseInt(year || 0, 10);
1948
+
1949
+ if (month < 7 && month % 2 === 0 || month > 8 && month % 2 === 1) {
1950
+ day = Math.min(day, month === 2 ? this.isLeapYear(year) ? 29 : 28 : 30);
1951
+ }
1952
+
1953
+ return [day, month, year];
1954
+ },
1955
+
1956
+ isLeapYear: function isLeapYear(year) {
1957
+ return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
1958
+ },
1959
+
1960
+ addLeadingZero: function addLeadingZero(number) {
1961
+ return (number < 10 ? '0' : '') + number;
1962
+ },
1963
+
1964
+ addLeadingZeroForYear: function addLeadingZeroForYear(number) {
1965
+ return (number < 10 ? '000' : number < 100 ? '00' : number < 1000 ? '0' : '') + number;
1966
+ }
1967
+ };
1968
+
1969
+ module.exports = DateFormatter;
1970
+
1971
+ /***/ }),
1972
+ /* 11 */
1973
+ /***/ (function(module, exports) {
1974
+
1975
+ 'use strict';
1976
+
1977
+ var PhoneFormatter = function PhoneFormatter(formatter, delimiter) {
1978
+ var owner = this;
1979
+
1980
+ owner.delimiter = delimiter || delimiter === '' ? delimiter : ' ';
1981
+ owner.delimiterRE = delimiter ? new RegExp('\\' + delimiter, 'g') : '';
1982
+
1983
+ owner.formatter = formatter;
1984
+ };
1985
+
1986
+ PhoneFormatter.prototype = {
1987
+ setFormatter: function setFormatter(formatter) {
1988
+ this.formatter = formatter;
1989
+ },
1990
+
1991
+ format: function format(phoneNumber) {
1992
+ var owner = this;
1993
+
1994
+ owner.formatter.clear();
1995
+
1996
+ // only keep number and +
1997
+ phoneNumber = phoneNumber.replace(/[^\d+]/g, '');
1998
+
1999
+ // strip delimiter
2000
+ phoneNumber = phoneNumber.replace(owner.delimiterRE, '');
2001
+
2002
+ var result = '',
2003
+ current,
2004
+ validated = false;
2005
+
2006
+ for (var i = 0, iMax = phoneNumber.length; i < iMax; i++) {
2007
+ current = owner.formatter.inputDigit(phoneNumber.charAt(i));
2008
+
2009
+ // has ()- or space inside
2010
+ if (/[\s()-]/g.test(current)) {
2011
+ result = current;
2012
+
2013
+ validated = true;
2014
+ } else {
2015
+ if (!validated) {
2016
+ result = current;
2017
+ }
2018
+ // else: over length input
2019
+ // it turns to invalid number again
2020
+ }
2021
+ }
2022
+
2023
+ // strip ()
2024
+ // e.g. US: 7161234567 returns (716) 123-4567
2025
+ result = result.replace(/[()]/g, '');
2026
+ // replace library delimiter with user customized delimiter
2027
+ result = result.replace(/[\s-]/g, owner.delimiter);
2028
+
2029
+ return result;
2030
+ }
2031
+ };
2032
+
2033
+ module.exports = PhoneFormatter;
2034
+
2035
+ /***/ }),
2036
+ /* 12 */
2037
+ /***/ (function(module, exports) {
2038
+
2039
+ 'use strict';
2040
+
2041
+ var CreditCardDetector = {
2042
+ blocks: {
2043
+ uatp: [4, 5, 6],
2044
+ amex: [4, 6, 5],
2045
+ diners: [4, 6, 4],
2046
+ discover: [4, 4, 4, 4],
2047
+ mastercard: [4, 4, 4, 4],
2048
+ dankort: [4, 4, 4, 4],
2049
+ instapayment: [4, 4, 4, 4],
2050
+ jcb15: [4, 6, 5],
2051
+ jcb: [4, 4, 4, 4],
2052
+ maestro: [4, 4, 4, 4],
2053
+ visa: [4, 4, 4, 4],
2054
+ mir: [4, 4, 4, 4],
2055
+ unionPay: [4, 4, 4, 4],
2056
+ general: [4, 4, 4, 4],
2057
+ generalStrict: [4, 4, 4, 7]
2058
+ },
2059
+
2060
+ re: {
2061
+ // starts with 1; 15 digits, not starts with 1800 (jcb card)
2062
+ uatp: /^(?!1800)1\d{0,14}/,
2063
+
2064
+ // starts with 34/37; 15 digits
2065
+ amex: /^3[47]\d{0,13}/,
2066
+
2067
+ // starts with 6011/65/644-649; 16 digits
2068
+ discover: /^(?:6011|65\d{0,2}|64[4-9]\d?)\d{0,12}/,
2069
+
2070
+ // starts with 300-305/309 or 36/38/39; 14 digits
2071
+ diners: /^3(?:0([0-5]|9)|[689]\d?)\d{0,11}/,
2072
+
2073
+ // starts with 51-55/2221–2720; 16 digits
2074
+ mastercard: /^(5[1-5]\d{0,2}|22[2-9]\d{0,1}|2[3-7]\d{0,2})\d{0,12}/,
2075
+
2076
+ // starts with 5019/4175/4571; 16 digits
2077
+ dankort: /^(5019|4175|4571)\d{0,12}/,
2078
+
2079
+ // starts with 637-639; 16 digits
2080
+ instapayment: /^63[7-9]\d{0,13}/,
2081
+
2082
+ // starts with 2131/1800; 15 digits
2083
+ jcb15: /^(?:2131|1800)\d{0,11}/,
2084
+
2085
+ // starts with 2131/1800/35; 16 digits
2086
+ jcb: /^(?:35\d{0,2})\d{0,12}/,
2087
+
2088
+ // starts with 50/56-58/6304/67; 16 digits
2089
+ maestro: /^(?:5[0678]\d{0,2}|6304|67\d{0,2})\d{0,12}/,
2090
+
2091
+ // starts with 22; 16 digits
2092
+ mir: /^220[0-4]\d{0,12}/,
2093
+
2094
+ // starts with 4; 16 digits
2095
+ visa: /^4\d{0,15}/,
2096
+
2097
+ // starts with 62; 16 digits
2098
+ unionPay: /^62\d{0,14}/
2099
+ },
2100
+
2101
+ getInfo: function getInfo(value, strictMode) {
2102
+ var blocks = CreditCardDetector.blocks,
2103
+ re = CreditCardDetector.re;
2104
+
2105
+ // Some credit card can have up to 19 digits number.
2106
+ // Set strictMode to true will remove the 16 max-length restrain,
2107
+ // however, I never found any website validate card number like
2108
+ // this, hence probably you don't want to enable this option.
2109
+ strictMode = !!strictMode;
2110
+
2111
+ for (var key in re) {
2112
+ if (re[key].test(value)) {
2113
+ var block;
2114
+
2115
+ if (strictMode) {
2116
+ block = blocks.generalStrict;
2117
+ } else {
2118
+ block = blocks[key];
2119
+ }
2120
+
2121
+ return {
2122
+ type: key,
2123
+ blocks: block
2124
+ };
2125
+ }
2126
+ }
2127
+
2128
+ return {
2129
+ type: 'unknown',
2130
+ blocks: strictMode ? blocks.generalStrict : blocks.general
2131
+ };
2132
+ }
2133
+ };
2134
+
2135
+ module.exports = CreditCardDetector;
2136
+
2137
+ /***/ }),
2138
+ /* 13 */
2139
+ /***/ (function(module, exports) {
2140
+
2141
+ 'use strict';
2142
+
2143
+ var Util = {
2144
+ noop: function noop() {},
2145
+
2146
+ strip: function strip(value, re) {
2147
+ return value.replace(re, '');
2148
+ },
2149
+
2150
+ isDelimiter: function isDelimiter(letter, delimiter, delimiters) {
2151
+ // single delimiter
2152
+ if (delimiters.length === 0) {
2153
+ return letter === delimiter;
2154
+ }
2155
+
2156
+ // multiple delimiters
2157
+ return delimiters.some(function (current) {
2158
+ if (letter === current) {
2159
+ return true;
2160
+ }
2161
+ });
2162
+ },
2163
+
2164
+ getDelimiterREByDelimiter: function getDelimiterREByDelimiter(delimiter) {
2165
+ return new RegExp(delimiter.replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1'), 'g');
2166
+ },
2167
+
2168
+ getNextCursorPosition: function getNextCursorPosition(prevPos, oldValue, newValue, delimiter, delimiters) {
2169
+ // If cursor was at the end of value, just place it back.
2170
+ // Because new value could contain additional chars.
2171
+ if (oldValue.length === prevPos) {
2172
+ return newValue.length;
2173
+ }
2174
+
2175
+ return prevPos + this.getPositionOffset(prevPos, oldValue, newValue, delimiter, delimiters);
2176
+ },
2177
+
2178
+ getPositionOffset: function getPositionOffset(prevPos, oldValue, newValue, delimiter, delimiters) {
2179
+ var oldRawValue, newRawValue, lengthOffset;
2180
+
2181
+ oldRawValue = this.stripDelimiters(oldValue.slice(0, prevPos), delimiter, delimiters);
2182
+ newRawValue = this.stripDelimiters(newValue.slice(0, prevPos), delimiter, delimiters);
2183
+ lengthOffset = oldRawValue.length - newRawValue.length;
2184
+
2185
+ return lengthOffset !== 0 ? lengthOffset / Math.abs(lengthOffset) : 0;
2186
+ },
2187
+
2188
+ stripDelimiters: function stripDelimiters(value, delimiter, delimiters) {
2189
+ var owner = this;
2190
+
2191
+ // single delimiter
2192
+ if (delimiters.length === 0) {
2193
+ var delimiterRE = delimiter ? owner.getDelimiterREByDelimiter(delimiter) : '';
2194
+
2195
+ return value.replace(delimiterRE, '');
2196
+ }
2197
+
2198
+ // multiple delimiters
2199
+ delimiters.forEach(function (current) {
2200
+ value = value.replace(owner.getDelimiterREByDelimiter(current), '');
2201
+ });
2202
+
2203
+ return value;
2204
+ },
2205
+
2206
+ headStr: function headStr(str, length) {
2207
+ return str.slice(0, length);
2208
+ },
2209
+
2210
+ getMaxLength: function getMaxLength(blocks) {
2211
+ return blocks.reduce(function (previous, current) {
2212
+ return previous + current;
2213
+ }, 0);
2214
+ },
2215
+
2216
+ // strip value by prefix length
2217
+ // for prefix: PRE
2218
+ // (PRE123, 3) -> 123
2219
+ // (PR123, 3) -> 23 this happens when user hits backspace in front of "PRE"
2220
+ getPrefixStrippedValue: function getPrefixStrippedValue(value, prefix, prefixLength, prevValue) {
2221
+ if (value.slice(0, prefixLength) !== prefix) {
2222
+
2223
+ // Check whether if it is a deletion
2224
+ if (value.length < prevValue.length) {
2225
+ value = value.length > prefixLength ? prevValue : prefix;
2226
+ } else {
2227
+ var diffIndex = this.getFirstDiffIndex(prefix, value.slice(0, prefixLength));
2228
+ value = prefix + value.slice(diffIndex, diffIndex + 1) + value.slice(prefixLength + 1);
2229
+ }
2230
+ }
2231
+
2232
+ return value.slice(prefixLength);
2233
+ },
2234
+
2235
+ getFirstDiffIndex: function getFirstDiffIndex(prev, current) {
2236
+ var index = 0;
2237
+
2238
+ while (prev.charAt(index) === current.charAt(index)) {
2239
+ if (prev.charAt(index++) === '') {
2240
+ return -1;
2241
+ }
2242
+ }
2243
+
2244
+ return index;
2245
+ },
2246
+
2247
+ getFormattedValue: function getFormattedValue(value, blocks, blocksLength, delimiter, delimiters, delimiterLazyShow) {
2248
+ var result = '',
2249
+ multipleDelimiters = delimiters.length > 0,
2250
+ currentDelimiter;
2251
+
2252
+ // no options, normal input
2253
+ if (blocksLength === 0) {
2254
+ return value;
2255
+ }
2256
+
2257
+ blocks.forEach(function (length, index) {
2258
+ if (value.length > 0) {
2259
+ var sub = value.slice(0, length),
2260
+ rest = value.slice(length);
2261
+
2262
+ if (multipleDelimiters) {
2263
+ currentDelimiter = delimiters[delimiterLazyShow ? index - 1 : index] || currentDelimiter;
2264
+ } else {
2265
+ currentDelimiter = delimiter;
2266
+ }
2267
+
2268
+ if (delimiterLazyShow) {
2269
+ if (index > 0) {
2270
+ result += currentDelimiter;
2271
+ }
2272
+
2273
+ result += sub;
2274
+ } else {
2275
+ result += sub;
2276
+
2277
+ if (sub.length === length && index < blocksLength - 1) {
2278
+ result += currentDelimiter;
2279
+ }
2280
+ }
2281
+
2282
+ // update remaining string
2283
+ value = rest;
2284
+ }
2285
+ });
2286
+
2287
+ return result;
2288
+ },
2289
+
2290
+ // move cursor to the end
2291
+ // the first time user focuses on an input with prefix
2292
+ fixPrefixCursor: function fixPrefixCursor(el, prefix, delimiter, delimiters) {
2293
+ if (!el) {
2294
+ return;
2295
+ }
2296
+
2297
+ var val = el.value,
2298
+ appendix = delimiter || delimiters[0] || ' ';
2299
+
2300
+ if (!el.setSelectionRange || !prefix || prefix.length + appendix.length < val.length) {
2301
+ return;
2302
+ }
2303
+
2304
+ var len = val.length * 2;
2305
+
2306
+ // set timeout to avoid blink
2307
+ setTimeout(function () {
2308
+ el.setSelectionRange(len, len);
2309
+ }, 1);
2310
+ },
2311
+
2312
+ setSelection: function setSelection(element, position, doc) {
2313
+ if (element !== doc.activeElement) {
2314
+ return;
2315
+ }
2316
+
2317
+ // cursor is already in the end
2318
+ if (element && element.value.length <= position) {
2319
+ return;
2320
+ }
2321
+
2322
+ if (element.createTextRange) {
2323
+ var range = element.createTextRange();
2324
+
2325
+ range.move('character', position);
2326
+ range.select();
2327
+ } else {
2328
+ try {
2329
+ element.setSelectionRange(position, position);
2330
+ } catch (e) {
2331
+ // eslint-disable-next-line
2332
+ console.warn('The input element type does not support selection');
2333
+ }
2334
+ }
2335
+ },
2336
+
2337
+ isAndroid: function isAndroid() {
2338
+ return navigator && /android/i.test(navigator.userAgent);
2339
+ },
2340
+
2341
+ // On Android chrome, the keyup and keydown events
2342
+ // always return key code 229 as a composition that
2343
+ // buffers the user’s keystrokes
2344
+ // see https://github.com/nosir/cleave.js/issues/147
2345
+ isAndroidBackspaceKeydown: function isAndroidBackspaceKeydown(lastInputValue, currentInputValue) {
2346
+ if (!this.isAndroid() || !lastInputValue || !currentInputValue) {
2347
+ return false;
2348
+ }
2349
+
2350
+ return currentInputValue === lastInputValue.slice(0, -1);
2351
+ }
2352
+ };
2353
+
2354
+ module.exports = Util;
2355
+
2356
+ /***/ }),
2357
+ /* 14 */
2358
+ /***/ (function(module, exports) {
2359
+
2360
+ 'use strict';
2361
+
2362
+ /**
2363
+ * Props Assignment
2364
+ *
2365
+ * Separate this, so react module can share the usage
2366
+ */
2367
+
2368
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
2369
+
2370
+ var DefaultProperties = {
2371
+ // Maybe change to object-assign
2372
+ // for now just keep it as simple
2373
+ assign: function assign(target, opts) {
2374
+ target = target || {};
2375
+ opts = opts || {};
2376
+
2377
+ // credit card
2378
+ target.creditCard = !!opts.creditCard;
2379
+ target.creditCardStrictMode = !!opts.creditCardStrictMode;
2380
+ target.creditCardType = '';
2381
+ target.onCreditCardTypeChanged = opts.onCreditCardTypeChanged || function () {};
2382
+
2383
+ // phone
2384
+ target.phone = !!opts.phone;
2385
+ target.phoneRegionCode = opts.phoneRegionCode || 'AU';
2386
+ target.phoneFormatter = {};
2387
+
2388
+ // date
2389
+ target.date = !!opts.date;
2390
+ target.datePattern = opts.datePattern || ['d', 'm', 'Y'];
2391
+ target.dateFormatter = {};
2392
+
2393
+ // numeral
2394
+ target.numeral = !!opts.numeral;
2395
+ target.numeralIntegerScale = opts.numeralIntegerScale > 0 ? opts.numeralIntegerScale : 0;
2396
+ target.numeralDecimalScale = opts.numeralDecimalScale >= 0 ? opts.numeralDecimalScale : 2;
2397
+ target.numeralDecimalMark = opts.numeralDecimalMark || '.';
2398
+ target.numeralThousandsGroupStyle = opts.numeralThousandsGroupStyle || 'thousand';
2399
+ target.numeralPositiveOnly = !!opts.numeralPositiveOnly;
2400
+ target.stripLeadingZeroes = opts.stripLeadingZeroes !== false;
2401
+
2402
+ // others
2403
+ target.numericOnly = target.creditCard || target.date || !!opts.numericOnly;
2404
+
2405
+ target.uppercase = !!opts.uppercase;
2406
+ target.lowercase = !!opts.lowercase;
2407
+
2408
+ target.prefix = target.creditCard || target.date ? '' : opts.prefix || '';
2409
+ target.noImmediatePrefix = !!opts.noImmediatePrefix;
2410
+ target.prefixLength = target.prefix.length;
2411
+ target.rawValueTrimPrefix = !!opts.rawValueTrimPrefix;
2412
+ target.copyDelimiter = !!opts.copyDelimiter;
2413
+
2414
+ target.initValue = opts.initValue !== undefined && opts.initValue !== null ? opts.initValue.toString() : '';
2415
+
2416
+ target.delimiter = opts.delimiter || opts.delimiter === '' ? opts.delimiter : opts.date ? '/' : opts.numeral ? ',' : opts.phone ? ' ' : ' ';
2417
+ target.delimiterLength = target.delimiter.length;
2418
+ target.delimiterLazyShow = !!opts.delimiterLazyShow;
2419
+ target.delimiters = opts.delimiters || [];
2420
+
2421
+ target.blocks = opts.blocks || [];
2422
+ target.blocksLength = target.blocks.length;
2423
+
2424
+ target.document = opts.document || document;
2425
+ target.root = (typeof global === 'undefined' ? 'undefined' : _typeof(global)) === 'object' && global ? global : window;
2426
+
2427
+ target.maxLength = 0;
2428
+
2429
+ target.backspace = false;
2430
+ target.result = '';
2431
+
2432
+ target.onValueChanged = opts.onValueChanged || function () {};
2433
+
2434
+ return target;
2435
+ }
2436
+ };
2437
+
2438
+ module.exports = DefaultProperties;
2439
+
2440
+ /***/ })
2441
+ /******/ ])
2442
+ });
2443
+ ;