@tabler/core 1.0.0-beta20 → 1.0.0-beta21

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 (378) hide show
  1. package/README.md +7 -6
  2. package/dist/css/demo.css +8 -8
  3. package/dist/css/demo.min.css +5 -5
  4. package/dist/css/demo.rtl.css +8 -8
  5. package/dist/css/demo.rtl.min.css +5 -5
  6. package/dist/css/tabler-flags.css +10 -10
  7. package/dist/css/tabler-flags.min.css +5 -5
  8. package/dist/css/tabler-flags.rtl.css +10 -10
  9. package/dist/css/tabler-flags.rtl.min.css +5 -5
  10. package/dist/css/tabler-payments.css +4 -4
  11. package/dist/css/tabler-payments.min.css +4 -4
  12. package/dist/css/tabler-payments.rtl.css +4 -4
  13. package/dist/css/tabler-payments.rtl.min.css +4 -4
  14. package/dist/css/tabler-social.css +4 -4
  15. package/dist/css/tabler-social.min.css +4 -4
  16. package/dist/css/tabler-social.rtl.css +4 -4
  17. package/dist/css/tabler-social.rtl.min.css +4 -4
  18. package/dist/css/tabler-vendors.css +246 -253
  19. package/dist/css/tabler-vendors.min.css +5 -5
  20. package/dist/css/tabler-vendors.rtl.css +246 -253
  21. package/dist/css/tabler-vendors.rtl.min.css +5 -5
  22. package/dist/css/tabler.css +643 -426
  23. package/dist/css/tabler.min.css +8 -8
  24. package/dist/css/tabler.rtl.css +667 -441
  25. package/dist/css/tabler.rtl.min.css +8 -8
  26. package/dist/js/demo-theme.js +4 -4
  27. package/dist/js/demo-theme.min.js +4 -4
  28. package/dist/js/demo.js +41 -42
  29. package/dist/js/demo.min.js +5 -5
  30. package/dist/js/tabler.esm.js +1949 -1248
  31. package/dist/js/tabler.esm.min.js +8 -8
  32. package/dist/js/tabler.js +1949 -1248
  33. package/dist/js/tabler.min.js +8 -8
  34. package/dist/libs/apexcharts/dist/apexcharts.amd.js +1 -1
  35. package/dist/libs/apexcharts/dist/apexcharts.common.js +5 -5
  36. package/dist/libs/apexcharts/dist/apexcharts.css +166 -65
  37. package/dist/libs/apexcharts/dist/apexcharts.esm.js +5 -5
  38. package/dist/libs/apexcharts/dist/apexcharts.js +7964 -8527
  39. package/dist/libs/apexcharts/dist/apexcharts.min.js +5 -5
  40. package/dist/libs/apexcharts/dist/locales/be-cyrl.json +55 -0
  41. package/dist/libs/apexcharts/dist/locales/be-latn.json +55 -0
  42. package/dist/libs/apexcharts/dist/locales/da.json +55 -0
  43. package/dist/libs/apexcharts/dist/locales/ms.json +63 -0
  44. package/dist/libs/apexcharts/dist/locales/pt.json +3 -3
  45. package/dist/libs/apexcharts/dist/locales/vi.json +63 -0
  46. package/dist/libs/apexcharts/dist/locales/zh-tw.json +1 -1
  47. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.js +8 -8
  48. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.js.map +1 -1
  49. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.min.js +3 -3
  50. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.min.js.map +1 -1
  51. package/dist/libs/bootstrap/dist/js/bootstrap.esm.js +8 -8
  52. package/dist/libs/bootstrap/dist/js/bootstrap.esm.js.map +1 -1
  53. package/dist/libs/bootstrap/dist/js/bootstrap.esm.min.js +3 -3
  54. package/dist/libs/bootstrap/dist/js/bootstrap.esm.min.js.map +1 -1
  55. package/dist/libs/bootstrap/dist/js/bootstrap.js +8 -8
  56. package/dist/libs/bootstrap/dist/js/bootstrap.js.map +1 -1
  57. package/dist/libs/bootstrap/dist/js/bootstrap.min.js +3 -3
  58. package/dist/libs/bootstrap/dist/js/bootstrap.min.js.map +1 -1
  59. package/dist/libs/countup.js/dist/countUp.d.ts +1 -0
  60. package/dist/libs/countup.js/dist/countUp.js +4 -1
  61. package/dist/libs/countup.js/dist/countUp.min.js +1 -1
  62. package/dist/libs/countup.js/dist/countUp.umd.js +1 -1
  63. package/dist/libs/jsvectormap/dist/jsvectormap.cjs +2279 -0
  64. package/dist/libs/jsvectormap/dist/jsvectormap.css +121 -0
  65. package/dist/libs/jsvectormap/dist/jsvectormap.esm.js +2277 -0
  66. package/dist/libs/jsvectormap/dist/jsvectormap.js +2285 -0
  67. package/dist/libs/jsvectormap/dist/jsvectormap.min.css +1 -0
  68. package/dist/libs/jsvectormap/dist/jsvectormap.min.js +1 -0
  69. package/dist/libs/jsvectormap/dist/maps/world-merc.js +1 -1
  70. package/dist/libs/jsvectormap/dist/maps/world.js +1 -1
  71. package/dist/libs/nouislider/dist/nouislider.d.ts +8 -10
  72. package/dist/libs/nouislider/dist/nouislider.js +64 -5
  73. package/dist/libs/nouislider/dist/nouislider.min.js +1 -1
  74. package/dist/libs/nouislider/dist/nouislider.min.mjs +1 -1
  75. package/dist/libs/nouislider/dist/nouislider.mjs +64 -5
  76. package/dist/libs/star-rating.js/dist/star-rating.cjs.js +5 -2
  77. package/dist/libs/star-rating.js/dist/star-rating.css +23 -20
  78. package/dist/libs/star-rating.js/dist/star-rating.esm.js +5 -2
  79. package/dist/libs/star-rating.js/dist/star-rating.js +5 -9
  80. package/dist/libs/star-rating.js/dist/star-rating.min.css +1 -8
  81. package/dist/libs/star-rating.js/dist/star-rating.min.js +1 -8
  82. package/dist/libs/tinymce/CHANGELOG.md +471 -12
  83. package/dist/libs/tinymce/README.md +16 -10
  84. package/dist/libs/tinymce/bower.json +1 -1
  85. package/dist/libs/tinymce/composer.json +2 -2
  86. package/dist/libs/tinymce/icons/default/icons.js +13 -2
  87. package/dist/libs/tinymce/icons/default/icons.min.js +1 -1
  88. package/dist/libs/tinymce/license.md +6 -0
  89. package/dist/libs/tinymce/models/dom/model.js +237 -213
  90. package/dist/libs/tinymce/models/dom/model.min.js +2 -2
  91. package/dist/libs/tinymce/package.json +2 -2
  92. package/dist/libs/tinymce/plugins/accordion/index.js +7 -0
  93. package/dist/libs/tinymce/plugins/accordion/plugin.js +1055 -0
  94. package/dist/libs/tinymce/plugins/accordion/plugin.min.js +4 -0
  95. package/dist/libs/tinymce/plugins/advlist/plugin.js +4 -4
  96. package/dist/libs/tinymce/plugins/advlist/plugin.min.js +2 -2
  97. package/dist/libs/tinymce/plugins/anchor/plugin.js +21 -3
  98. package/dist/libs/tinymce/plugins/anchor/plugin.min.js +2 -2
  99. package/dist/libs/tinymce/plugins/autolink/plugin.js +1 -1
  100. package/dist/libs/tinymce/plugins/autolink/plugin.min.js +2 -2
  101. package/dist/libs/tinymce/plugins/autoresize/plugin.js +20 -33
  102. package/dist/libs/tinymce/plugins/autoresize/plugin.min.js +2 -2
  103. package/dist/libs/tinymce/plugins/autosave/plugin.js +1 -1
  104. package/dist/libs/tinymce/plugins/autosave/plugin.min.js +1 -1
  105. package/dist/libs/tinymce/plugins/charmap/plugin.js +15 -3
  106. package/dist/libs/tinymce/plugins/charmap/plugin.min.js +2 -2
  107. package/dist/libs/tinymce/plugins/code/plugin.js +1 -1
  108. package/dist/libs/tinymce/plugins/code/plugin.min.js +1 -1
  109. package/dist/libs/tinymce/plugins/codesample/plugin.js +27 -13
  110. package/dist/libs/tinymce/plugins/codesample/plugin.min.js +2 -2
  111. package/dist/libs/tinymce/plugins/directionality/plugin.js +33 -27
  112. package/dist/libs/tinymce/plugins/directionality/plugin.min.js +2 -2
  113. package/dist/libs/tinymce/plugins/emoticons/plugin.js +17 -4
  114. package/dist/libs/tinymce/plugins/emoticons/plugin.min.js +2 -2
  115. package/dist/libs/tinymce/plugins/fullscreen/plugin.js +168 -105
  116. package/dist/libs/tinymce/plugins/fullscreen/plugin.min.js +2 -2
  117. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/ar.js +93 -0
  118. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/bg_BG.js +93 -0
  119. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/ca.js +93 -0
  120. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/cs.js +93 -0
  121. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/da.js +93 -0
  122. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/de.js +93 -0
  123. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/el.js +93 -0
  124. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/en.js +93 -0
  125. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/es.js +93 -0
  126. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/eu.js +93 -0
  127. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/fa.js +93 -0
  128. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/fi.js +93 -0
  129. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/fr_FR.js +93 -0
  130. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/he_IL.js +93 -0
  131. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/hi.js +93 -0
  132. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/hr.js +93 -0
  133. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/hu_HU.js +93 -0
  134. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/id.js +93 -0
  135. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/it.js +93 -0
  136. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/ja.js +93 -0
  137. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/kk.js +93 -0
  138. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/ko_KR.js +93 -0
  139. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/ms.js +93 -0
  140. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/nb_NO.js +93 -0
  141. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/nl.js +93 -0
  142. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/pl.js +93 -0
  143. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/pt_BR.js +93 -0
  144. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/pt_PT.js +93 -0
  145. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/ro.js +93 -0
  146. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/ru.js +93 -0
  147. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/sk.js +93 -0
  148. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/sl_SI.js +93 -0
  149. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/sv_SE.js +93 -0
  150. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/th_TH.js +93 -0
  151. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/tr.js +93 -0
  152. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/uk.js +93 -0
  153. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/vi.js +93 -0
  154. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/zh_CN.js +87 -0
  155. package/dist/libs/tinymce/plugins/help/js/i18n/keynav/zh_TW.js +93 -0
  156. package/dist/libs/tinymce/plugins/help/plugin.js +115 -135
  157. package/dist/libs/tinymce/plugins/help/plugin.min.js +2 -2
  158. package/dist/libs/tinymce/plugins/image/plugin.js +23 -5
  159. package/dist/libs/tinymce/plugins/image/plugin.min.js +2 -2
  160. package/dist/libs/tinymce/plugins/importcss/plugin.js +4 -3
  161. package/dist/libs/tinymce/plugins/importcss/plugin.min.js +2 -2
  162. package/dist/libs/tinymce/plugins/insertdatetime/plugin.js +15 -3
  163. package/dist/libs/tinymce/plugins/insertdatetime/plugin.min.js +2 -2
  164. package/dist/libs/tinymce/plugins/link/plugin.js +193 -114
  165. package/dist/libs/tinymce/plugins/link/plugin.min.js +2 -2
  166. package/dist/libs/tinymce/plugins/lists/plugin.js +290 -66
  167. package/dist/libs/tinymce/plugins/lists/plugin.min.js +2 -2
  168. package/dist/libs/tinymce/plugins/media/plugin.js +80 -33
  169. package/dist/libs/tinymce/plugins/media/plugin.min.js +2 -2
  170. package/dist/libs/tinymce/plugins/nonbreaking/plugin.js +15 -3
  171. package/dist/libs/tinymce/plugins/nonbreaking/plugin.min.js +2 -2
  172. package/dist/libs/tinymce/plugins/pagebreak/plugin.js +15 -3
  173. package/dist/libs/tinymce/plugins/pagebreak/plugin.min.js +2 -2
  174. package/dist/libs/tinymce/plugins/preview/plugin.js +1 -1
  175. package/dist/libs/tinymce/plugins/preview/plugin.min.js +1 -1
  176. package/dist/libs/tinymce/plugins/quickbars/plugin.js +19 -7
  177. package/dist/libs/tinymce/plugins/quickbars/plugin.min.js +2 -2
  178. package/dist/libs/tinymce/plugins/save/plugin.js +3 -2
  179. package/dist/libs/tinymce/plugins/save/plugin.min.js +2 -2
  180. package/dist/libs/tinymce/plugins/searchreplace/plugin.js +42 -36
  181. package/dist/libs/tinymce/plugins/searchreplace/plugin.min.js +2 -2
  182. package/dist/libs/tinymce/plugins/table/plugin.js +121 -76
  183. package/dist/libs/tinymce/plugins/table/plugin.min.js +2 -2
  184. package/dist/libs/tinymce/plugins/visualblocks/plugin.js +1 -1
  185. package/dist/libs/tinymce/plugins/visualblocks/plugin.min.js +1 -1
  186. package/dist/libs/tinymce/plugins/visualchars/plugin.js +1 -1
  187. package/dist/libs/tinymce/plugins/visualchars/plugin.min.js +1 -1
  188. package/dist/libs/tinymce/plugins/wordcount/plugin.js +27 -19
  189. package/dist/libs/tinymce/plugins/wordcount/plugin.min.js +2 -2
  190. package/dist/libs/tinymce/skins/content/dark/content.js +1 -0
  191. package/dist/libs/tinymce/skins/content/default/content.js +1 -0
  192. package/dist/libs/tinymce/skins/content/document/content.js +1 -0
  193. package/dist/libs/tinymce/skins/content/tinymce-5/content.js +1 -0
  194. package/dist/libs/tinymce/skins/content/tinymce-5-dark/content.js +1 -0
  195. package/dist/libs/tinymce/skins/content/writer/content.js +1 -0
  196. package/dist/libs/tinymce/skins/ui/oxide/content.css +32 -29
  197. package/dist/libs/tinymce/skins/ui/oxide/content.inline.css +32 -29
  198. package/dist/libs/tinymce/skins/ui/oxide/content.inline.js +1 -0
  199. package/dist/libs/tinymce/skins/ui/oxide/content.inline.min.css +1 -1
  200. package/dist/libs/tinymce/skins/ui/oxide/content.js +1 -0
  201. package/dist/libs/tinymce/skins/ui/oxide/content.min.css +1 -1
  202. package/dist/libs/tinymce/skins/ui/oxide/skin.css +1003 -105
  203. package/dist/libs/tinymce/skins/ui/oxide/skin.js +1 -0
  204. package/dist/libs/tinymce/skins/ui/oxide/skin.min.css +1 -1
  205. package/dist/libs/tinymce/skins/ui/oxide/skin.shadowdom.js +1 -0
  206. package/dist/libs/tinymce/skins/ui/oxide-dark/content.css +32 -22
  207. package/dist/libs/tinymce/skins/ui/oxide-dark/content.inline.css +32 -29
  208. package/dist/libs/tinymce/skins/ui/oxide-dark/content.inline.js +1 -0
  209. package/dist/libs/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -1
  210. package/dist/libs/tinymce/skins/ui/oxide-dark/content.js +1 -0
  211. package/dist/libs/tinymce/skins/ui/oxide-dark/content.min.css +1 -1
  212. package/dist/libs/tinymce/skins/ui/oxide-dark/skin.css +1008 -110
  213. package/dist/libs/tinymce/skins/ui/oxide-dark/skin.js +1 -0
  214. package/dist/libs/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
  215. package/dist/libs/tinymce/skins/ui/oxide-dark/skin.shadowdom.js +1 -0
  216. package/dist/libs/tinymce/skins/ui/tinymce-5/content.css +32 -29
  217. package/dist/libs/tinymce/skins/ui/tinymce-5/content.inline.css +32 -29
  218. package/dist/libs/tinymce/skins/ui/tinymce-5/content.inline.js +1 -0
  219. package/dist/libs/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -1
  220. package/dist/libs/tinymce/skins/ui/tinymce-5/content.js +1 -0
  221. package/dist/libs/tinymce/skins/ui/tinymce-5/content.min.css +1 -1
  222. package/dist/libs/tinymce/skins/ui/tinymce-5/skin.css +1003 -86
  223. package/dist/libs/tinymce/skins/ui/tinymce-5/skin.js +1 -0
  224. package/dist/libs/tinymce/skins/ui/tinymce-5/skin.min.css +1 -1
  225. package/dist/libs/tinymce/skins/ui/tinymce-5/skin.shadowdom.js +1 -0
  226. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.css +32 -22
  227. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.inline.css +32 -29
  228. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.inline.js +1 -0
  229. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -1
  230. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.js +1 -0
  231. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -1
  232. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.css +1009 -92
  233. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.js +1 -0
  234. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -1
  235. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.js +1 -0
  236. package/dist/libs/tinymce/themes/silver/theme.js +26361 -24936
  237. package/dist/libs/tinymce/themes/silver/theme.min.js +2 -2
  238. package/dist/libs/tinymce/tinymce.d.ts +205 -136
  239. package/dist/libs/tinymce/tinymce.js +4400 -2838
  240. package/dist/libs/tinymce/tinymce.min.js +2 -2
  241. package/dist/libs/tom-select/dist/js/plugins/caret_position.js +11 -16
  242. package/dist/libs/tom-select/dist/js/plugins/caret_position.js.map +1 -1
  243. package/dist/libs/tom-select/dist/js/plugins/change_listener.js +3 -2
  244. package/dist/libs/tom-select/dist/js/plugins/change_listener.js.map +1 -1
  245. package/dist/libs/tom-select/dist/js/plugins/checkbox_options.js +47 -34
  246. package/dist/libs/tom-select/dist/js/plugins/checkbox_options.js.map +1 -1
  247. package/dist/libs/tom-select/dist/js/plugins/clear_button.js +3 -13
  248. package/dist/libs/tom-select/dist/js/plugins/clear_button.js.map +1 -1
  249. package/dist/libs/tom-select/dist/js/plugins/drag_drop.js +249 -29
  250. package/dist/libs/tom-select/dist/js/plugins/drag_drop.js.map +1 -1
  251. package/dist/libs/tom-select/dist/js/plugins/dropdown_header.js +3 -11
  252. package/dist/libs/tom-select/dist/js/plugins/dropdown_header.js.map +1 -1
  253. package/dist/libs/tom-select/dist/js/plugins/dropdown_input.js +15 -24
  254. package/dist/libs/tom-select/dist/js/plugins/dropdown_input.js.map +1 -1
  255. package/dist/libs/tom-select/dist/js/plugins/input_autogrow.js +4 -6
  256. package/dist/libs/tom-select/dist/js/plugins/input_autogrow.js.map +1 -1
  257. package/dist/libs/tom-select/dist/js/plugins/no_active_items.js +2 -1
  258. package/dist/libs/tom-select/dist/js/plugins/no_active_items.js.map +1 -1
  259. package/dist/libs/tom-select/dist/js/plugins/no_backspace_delete.js +2 -2
  260. package/dist/libs/tom-select/dist/js/plugins/no_backspace_delete.js.map +1 -1
  261. package/dist/libs/tom-select/dist/js/plugins/optgroup_columns.js +3 -15
  262. package/dist/libs/tom-select/dist/js/plugins/optgroup_columns.js.map +1 -1
  263. package/dist/libs/tom-select/dist/js/plugins/remove_button.js +11 -15
  264. package/dist/libs/tom-select/dist/js/plugins/remove_button.js.map +1 -1
  265. package/dist/libs/tom-select/dist/js/plugins/restore_on_backspace.js +2 -3
  266. package/dist/libs/tom-select/dist/js/plugins/restore_on_backspace.js.map +1 -1
  267. package/dist/libs/tom-select/dist/js/plugins/virtual_scroll.js +41 -50
  268. package/dist/libs/tom-select/dist/js/plugins/virtual_scroll.js.map +1 -1
  269. package/dist/libs/tom-select/dist/js/tom-select.base.js +411 -685
  270. package/dist/libs/tom-select/dist/js/tom-select.base.js.map +1 -1
  271. package/dist/libs/tom-select/dist/js/tom-select.base.min.js +87 -78
  272. package/dist/libs/tom-select/dist/js/tom-select.base.min.js.map +1 -1
  273. package/dist/libs/tom-select/dist/js/tom-select.complete.js +614 -820
  274. package/dist/libs/tom-select/dist/js/tom-select.complete.js.map +1 -1
  275. package/dist/libs/tom-select/dist/js/tom-select.complete.min.js +195 -176
  276. package/dist/libs/tom-select/dist/js/tom-select.complete.min.js.map +1 -1
  277. package/dist/libs/tom-select/dist/js/tom-select.popular.js +436 -705
  278. package/dist/libs/tom-select/dist/js/tom-select.popular.js.map +1 -1
  279. package/dist/libs/tom-select/dist/js/tom-select.popular.min.js +87 -78
  280. package/dist/libs/tom-select/dist/js/tom-select.popular.min.js.map +1 -1
  281. package/docs/base/colors.mdx +25 -0
  282. package/docs/base/typography.mdx +296 -0
  283. package/docs/components/alerts.mdx +430 -0
  284. package/docs/components/autosize.mdx +16 -0
  285. package/docs/components/avatars.mdx +172 -0
  286. package/docs/components/badges.mdx +127 -0
  287. package/docs/components/breadcrumb.mdx +107 -0
  288. package/docs/components/buttons.mdx +863 -0
  289. package/docs/components/cards.mdx +343 -0
  290. package/docs/components/carousel.mdx +235 -0
  291. package/docs/components/charts.mdx +526 -0
  292. package/docs/components/countup.mdx +136 -0
  293. package/docs/components/datagrid.mdx +90 -0
  294. package/docs/components/divider.mdx +63 -0
  295. package/docs/components/dropdowns.mdx +245 -0
  296. package/docs/components/dropzone.mdx +63 -0
  297. package/docs/components/empty.mdx +103 -0
  298. package/docs/components/icons.mdx +120 -0
  299. package/docs/components/inline-player.mdx +31 -0
  300. package/docs/components/modals.mdx +222 -0
  301. package/docs/components/placeholder.mdx +270 -0
  302. package/docs/components/popover.mdx +55 -0
  303. package/docs/components/progress.mdx +92 -0
  304. package/docs/components/progressbg.mdx +16 -0
  305. package/docs/components/range-slider.mdx +17 -0
  306. package/docs/components/ribbons.mdx +151 -0
  307. package/docs/components/spinners.mdx +119 -0
  308. package/docs/components/statuses.mdx +285 -0
  309. package/docs/components/steps.mdx +111 -0
  310. package/docs/components/switch-icon.mdx +155 -0
  311. package/docs/components/tables.mdx +410 -0
  312. package/docs/components/tabs.mdx +243 -0
  313. package/docs/components/timelines.mdx +506 -0
  314. package/docs/components/tinymce.mdx +44 -0
  315. package/docs/components/toasts.mdx +73 -0
  316. package/docs/components/tooltips.mdx +34 -0
  317. package/docs/components/tracking.mdx +162 -0
  318. package/docs/forms/form-color-check.mdx +179 -0
  319. package/docs/forms/form-elements.mdx +498 -0
  320. package/docs/forms/form-fieldset.mdx +44 -0
  321. package/docs/forms/form-helpers.mdx +12 -0
  322. package/docs/forms/form-image-check.mdx +162 -0
  323. package/docs/forms/form-input-mask.mdx +18 -0
  324. package/docs/forms/form-selectboxes.mdx +205 -0
  325. package/docs/forms/form-validation.mdx +25 -0
  326. package/docs/getting-started/browser-support.mdx +20 -0
  327. package/docs/getting-started/customize.mdx +24 -0
  328. package/docs/getting-started/download.mdx +42 -0
  329. package/docs/getting-started/faq.mdx +28 -0
  330. package/docs/getting-started/index.mdx +40 -0
  331. package/docs/icons/eps.mdx +13 -0
  332. package/docs/icons/figma.mdx +7 -0
  333. package/docs/icons/index.mdx +103 -0
  334. package/docs/icons/pdf.mdx +13 -0
  335. package/docs/icons/png.mdx +19 -0
  336. package/docs/icons/preact.mdx +40 -0
  337. package/docs/icons/react.mdx +40 -0
  338. package/docs/icons/solidjs.mdx +39 -0
  339. package/docs/icons/svelte.mdx +40 -0
  340. package/docs/icons/svg.mdx +74 -0
  341. package/docs/icons/vue.mdx +45 -0
  342. package/docs/icons/webfont.mdx +52 -0
  343. package/docs/layout/page-headers.mdx +226 -0
  344. package/docs/layout/page-layouts.mdx +204 -0
  345. package/docs/menu.json +317 -0
  346. package/docs/plugins/flags.mdx +52 -0
  347. package/docs/plugins/payments.mdx +43 -0
  348. package/docs/utilities/borders.mdx +114 -0
  349. package/docs/utilities/cursors.mdx +92 -0
  350. package/docs/utilities/interactions.mdx +23 -0
  351. package/package.json +37 -37
  352. package/src/js/src/toast.js +9 -1
  353. package/src/scss/_variables-dark.scss +3 -3
  354. package/src/scss/_variables.scss +38 -33
  355. package/src/scss/layout/_dark.scss +10 -2
  356. package/src/scss/layout/_navbar.scss +22 -13
  357. package/src/scss/layout/_page.scss +4 -4
  358. package/src/scss/layout/_root.scss +1 -1
  359. package/src/scss/mixins/_mixins.scss +4 -4
  360. package/src/scss/ui/_alerts.scss +2 -2
  361. package/src/scss/ui/_buttons.scss +4 -4
  362. package/src/scss/ui/_dropdowns.scss +1 -0
  363. package/src/scss/ui/_empty.scss +0 -5
  364. package/src/scss/ui/_flags.scss +2 -2
  365. package/src/scss/ui/_forms.scss +5 -4
  366. package/src/scss/ui/_modals.scss +3 -3
  367. package/src/scss/ui/_ribbons.scss +1 -0
  368. package/src/scss/ui/_toasts.scss +0 -1
  369. package/src/scss/ui/_type.scss +4 -2
  370. package/src/scss/vendor/_apexcharts.scss +2 -2
  371. package/src/scss/vendor/_jsvectormap.scss +1 -1
  372. package/src/scss/vendor/_litepicker.scss +1 -1
  373. package/dist/libs/jsvectormap/dist/js/jsvectormap.js +0 -2318
  374. package/dist/libs/jsvectormap/dist/js/jsvectormap.min.js +0 -1
  375. package/dist/libs/tinymce/license.txt +0 -21
  376. package/dist/libs/tinymce/plugins/template/index.js +0 -7
  377. package/dist/libs/tinymce/plugins/template/plugin.js +0 -554
  378. package/dist/libs/tinymce/plugins/template/plugin.min.js +0 -4
@@ -0,0 +1,2285 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
+ typeof define === 'function' && define.amd ? define(factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.jsVectorMap = factory());
5
+ })(this, (function () { 'use strict';
6
+
7
+ /**
8
+ * By https://github.com/TehShrike/deepmerge
9
+ */
10
+
11
+ var isMergeableObject = function isMergeableObject(value) {
12
+ return isNonNullObject(value) && !isSpecial(value);
13
+ };
14
+ function isNonNullObject(value) {
15
+ return !!value && typeof value === 'object';
16
+ }
17
+ function isSpecial(value) {
18
+ var stringValue = Object.prototype.toString.call(value);
19
+ return stringValue === '[object RegExp]' || stringValue === '[object Date]' || isNode(value) || isReactElement(value);
20
+ }
21
+
22
+ // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
23
+ var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
24
+ var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
25
+ function isReactElement(value) {
26
+ return value.$$typeof === REACT_ELEMENT_TYPE;
27
+ }
28
+ function isNode(value) {
29
+ return value instanceof Node;
30
+ }
31
+ function emptyTarget(val) {
32
+ return Array.isArray(val) ? [] : {};
33
+ }
34
+ function cloneUnlessOtherwiseSpecified(value, options) {
35
+ return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
36
+ }
37
+ function defaultArrayMerge(target, source, options) {
38
+ return target.concat(source).map(function (element) {
39
+ return cloneUnlessOtherwiseSpecified(element, options);
40
+ });
41
+ }
42
+ function getMergeFunction(key, options) {
43
+ if (!options.customMerge) {
44
+ return deepmerge;
45
+ }
46
+ var customMerge = options.customMerge(key);
47
+ return typeof customMerge === 'function' ? customMerge : deepmerge;
48
+ }
49
+ function getEnumerableOwnPropertySymbols(target) {
50
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function (symbol) {
51
+ return target.propertyIsEnumerable(symbol);
52
+ }) : [];
53
+ }
54
+ function getKeys(target) {
55
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
56
+ }
57
+ function propertyIsOnObject(object, property) {
58
+ try {
59
+ return property in object;
60
+ } catch (_) {
61
+ return false;
62
+ }
63
+ }
64
+
65
+ // Protects from prototype poisoning and unexpected merging up the prototype chain.
66
+ function propertyIsUnsafe(target, key) {
67
+ return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
68
+ && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
69
+ && Object.propertyIsEnumerable.call(target, key)); // and also unsafe if they're nonenumerable.
70
+ }
71
+ function mergeObject(target, source, options) {
72
+ var destination = {};
73
+ if (options.isMergeableObject(target)) {
74
+ getKeys(target).forEach(function (key) {
75
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
76
+ });
77
+ }
78
+ getKeys(source).forEach(function (key) {
79
+ if (propertyIsUnsafe(target, key)) {
80
+ return;
81
+ }
82
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
83
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
84
+ } else {
85
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
86
+ }
87
+ });
88
+ return destination;
89
+ }
90
+ var deepmerge = function deepmerge(target, source, options) {
91
+ options = options || {};
92
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
93
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
94
+ // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
95
+ // implementations can use it. The caller may not replace it.
96
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
97
+ var sourceIsArray = Array.isArray(source);
98
+ var targetIsArray = Array.isArray(target);
99
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
100
+ if (!sourceAndTargetTypesMatch) {
101
+ return cloneUnlessOtherwiseSpecified(source, options);
102
+ } else if (sourceIsArray) {
103
+ return options.arrayMerge(target, source, options);
104
+ } else {
105
+ return mergeObject(target, source, options);
106
+ }
107
+ };
108
+
109
+ /**
110
+ * --------------------------------------------------------------------------
111
+ * Public Util Api
112
+ * --------------------------------------------------------------------------
113
+ */
114
+ var getElement = function getElement(selector) {
115
+ if (typeof selector === 'object' && typeof selector.nodeType !== 'undefined') {
116
+ return selector;
117
+ }
118
+ if (typeof selector === 'string') {
119
+ return document.querySelector(selector);
120
+ }
121
+ return null;
122
+ };
123
+ var createElement = function createElement(type, classes, content, html) {
124
+ if (html === void 0) {
125
+ html = false;
126
+ }
127
+ var el = document.createElement(type);
128
+ if (content) {
129
+ el[!html ? 'textContent' : 'innerHTML'] = content;
130
+ }
131
+ if (classes) {
132
+ el.className = classes;
133
+ }
134
+ return el;
135
+ };
136
+ var findElement = function findElement(parentElement, selector) {
137
+ return Element.prototype.querySelector.call(parentElement, selector);
138
+ };
139
+ var removeElement = function removeElement(target) {
140
+ target.parentNode.removeChild(target);
141
+ };
142
+ var isImageUrl = function isImageUrl(url) {
143
+ return /\.(jpg|gif|png)$/.test(url);
144
+ };
145
+ var hyphenate = function hyphenate(string) {
146
+ return string.replace(/[\w]([A-Z])/g, function (m) {
147
+ return m[0] + "-" + m[1];
148
+ }).toLowerCase();
149
+ };
150
+ var merge = function merge(target, source, deep) {
151
+ if (deep === void 0) {
152
+ deep = false;
153
+ }
154
+ if (deep) {
155
+ return deepmerge(target, source);
156
+ }
157
+ return Object.assign(target, source);
158
+ };
159
+ var getLineUid = function getLineUid(from, to) {
160
+ return from.toLowerCase() + ":to:" + to.toLowerCase();
161
+ };
162
+ var inherit = function inherit(target, source) {
163
+ Object.assign(target.prototype, source);
164
+ };
165
+
166
+ var eventRegistry = {};
167
+ var eventUid = 1;
168
+
169
+ /**
170
+ * ------------------------------------------------------------------------
171
+ * Event Handler
172
+ * ------------------------------------------------------------------------
173
+ */
174
+ var EventHandler = {
175
+ on: function on(element, event, handler, options) {
176
+ if (options === void 0) {
177
+ options = {};
178
+ }
179
+ var uid = "jvm:" + event + "::" + eventUid++;
180
+ eventRegistry[uid] = {
181
+ selector: element,
182
+ handler: handler
183
+ };
184
+ handler._uid = uid;
185
+ element.addEventListener(event, handler, options);
186
+ },
187
+ delegate: function delegate(element, event, selector, handler) {
188
+ event = event.split(' ');
189
+ event.forEach(function (eventName) {
190
+ EventHandler.on(element, eventName, function (e) {
191
+ var target = e.target;
192
+ if (target.matches(selector)) {
193
+ handler.call(target, e);
194
+ }
195
+ });
196
+ });
197
+ },
198
+ off: function off(element, event, handler) {
199
+ var eventType = event.split(':')[1];
200
+ element.removeEventListener(eventType, handler);
201
+ delete eventRegistry[handler._uid];
202
+ },
203
+ flush: function flush() {
204
+ Object.keys(eventRegistry).forEach(function (event) {
205
+ EventHandler.off(eventRegistry[event].selector, event, eventRegistry[event].handler);
206
+ });
207
+ },
208
+ getEventRegistry: function getEventRegistry() {
209
+ return eventRegistry;
210
+ }
211
+ };
212
+
213
+ function setupContainerEvents() {
214
+ var _this = this;
215
+ var map = this;
216
+ var mouseDown = false;
217
+ var oldPageX;
218
+ var oldPageY;
219
+ if (this.params.draggable) {
220
+ EventHandler.on(this.container, 'mousemove', function (e) {
221
+ if (!mouseDown) {
222
+ return false;
223
+ }
224
+ map.transX -= (oldPageX - e.pageX) / map.scale;
225
+ map.transY -= (oldPageY - e.pageY) / map.scale;
226
+ map._applyTransform();
227
+ oldPageX = e.pageX;
228
+ oldPageY = e.pageY;
229
+ });
230
+ EventHandler.on(this.container, 'mousedown', function (e) {
231
+ mouseDown = true;
232
+ oldPageX = e.pageX;
233
+ oldPageY = e.pageY;
234
+ return false;
235
+ });
236
+ EventHandler.on(document.body, 'mouseup', function () {
237
+ mouseDown = false;
238
+ });
239
+ }
240
+ if (this.params.zoomOnScroll) {
241
+ EventHandler.on(this.container, 'wheel', function (event) {
242
+ var deltaY = ((event.deltaY || -event.wheelDelta || event.detail) >> 10 || 1) * 75;
243
+ var rect = _this.container.getBoundingClientRect();
244
+ var offsetX = event.pageX - rect.left - window.pageXOffset;
245
+ var offsetY = event.pageY - rect.top - window.pageYOffset;
246
+ var zoomStep = Math.pow(1 + map.params.zoomOnScrollSpeed / 1000, -1.5 * deltaY);
247
+ if (map.tooltip) {
248
+ map._tooltip.hide();
249
+ }
250
+ map._setScale(map.scale * zoomStep, offsetX, offsetY);
251
+ event.preventDefault();
252
+ });
253
+ }
254
+ }
255
+
256
+ var Events = {
257
+ onLoaded: 'map:loaded',
258
+ onViewportChange: 'viewport:changed',
259
+ onRegionClick: 'region:clicked',
260
+ onMarkerClick: 'marker:clicked',
261
+ onRegionSelected: 'region:selected',
262
+ onMarkerSelected: 'marker:selected',
263
+ onRegionTooltipShow: 'region.tooltip:show',
264
+ onMarkerTooltipShow: 'marker.tooltip:show',
265
+ onDestroyed: 'map:destroyed'
266
+ };
267
+
268
+ var parseEvent = function parseEvent(map, selector, isTooltip) {
269
+ var element = getElement(selector);
270
+ var type = element.getAttribute('class').indexOf('jvm-region') === -1 ? 'marker' : 'region';
271
+ var isRegion = type === 'region';
272
+ var code = isRegion ? element.getAttribute('data-code') : element.getAttribute('data-index');
273
+ var event = isRegion ? Events.onRegionSelected : Events.onMarkerSelected;
274
+
275
+ // Init tooltip event
276
+ if (isTooltip) {
277
+ event = isRegion ? Events.onRegionTooltipShow : Events.onMarkerTooltipShow;
278
+ }
279
+ return {
280
+ type: type,
281
+ code: code,
282
+ event: event,
283
+ element: isRegion ? map.regions[code].element : map._markers[code].element,
284
+ tooltipText: isRegion ? map._mapData.paths[code].name || '' : map._markers[code].config.name || ''
285
+ };
286
+ };
287
+ function setupElementEvents() {
288
+ var map = this;
289
+ var container = this.container;
290
+ var pageX, pageY, mouseMoved;
291
+ EventHandler.on(container, 'mousemove', function (event) {
292
+ if (Math.abs(pageX - event.pageX) + Math.abs(pageY - event.pageY) > 2) {
293
+ mouseMoved = true;
294
+ }
295
+ });
296
+
297
+ // When the mouse is pressed
298
+ EventHandler.delegate(container, 'mousedown', '.jvm-element', function (event) {
299
+ pageX = event.pageX;
300
+ pageY = event.pageY;
301
+ mouseMoved = false;
302
+ });
303
+
304
+ // When the mouse is over the region/marker | When the mouse is out the region/marker
305
+ EventHandler.delegate(container, 'mouseover mouseout', '.jvm-element', function (event) {
306
+ var data = parseEvent(map, this, true);
307
+ var showTooltip = map.params.showTooltip;
308
+ if (event.type === 'mouseover') {
309
+ data.element.hover(true);
310
+ if (showTooltip) {
311
+ map._tooltip.text(data.tooltipText);
312
+ map._tooltip.show();
313
+ map._emit(data.event, [event, map._tooltip, data.code]);
314
+ }
315
+ } else {
316
+ data.element.hover(false);
317
+ if (showTooltip) {
318
+ map._tooltip.hide();
319
+ }
320
+ }
321
+ });
322
+
323
+ // When the click is released
324
+ EventHandler.delegate(container, 'mouseup', '.jvm-element', function (event) {
325
+ var data = parseEvent(map, this);
326
+ if (mouseMoved) {
327
+ return;
328
+ }
329
+ if (data.type === 'region' && map.params.regionsSelectable || data.type === 'marker' && map.params.markersSelectable) {
330
+ var element = data.element;
331
+
332
+ // We're checking if regions/markers|SelectableOne option is presented
333
+ if (map.params[data.type + "sSelectableOne"]) {
334
+ map._clearSelected(data.type + "s");
335
+ }
336
+ if (data.element.isSelected) {
337
+ element.select(false);
338
+ } else {
339
+ element.select(true);
340
+ }
341
+ map._emit(data.event, [data.code, element.isSelected, map._getSelected(data.type + "s")]);
342
+ }
343
+ });
344
+
345
+ // When region/marker is clicked
346
+ EventHandler.delegate(container, 'click', '.jvm-element', function (event) {
347
+ var _parseEvent = parseEvent(map, this),
348
+ type = _parseEvent.type,
349
+ code = _parseEvent.code;
350
+ map._emit(type === 'region' ? Events.onRegionClick : Events.onMarkerClick, [event, code]);
351
+ });
352
+ }
353
+
354
+ function setupZoomButtons() {
355
+ var _this = this;
356
+ var zoomin = createElement('div', 'jvm-zoom-btn jvm-zoomin', '+', true);
357
+ var zoomout = createElement('div', 'jvm-zoom-btn jvm-zoomout', '&#x2212', true);
358
+ this.container.appendChild(zoomin);
359
+ this.container.appendChild(zoomout);
360
+ var handler = function handler(zoomin) {
361
+ if (zoomin === void 0) {
362
+ zoomin = true;
363
+ }
364
+ return function () {
365
+ return _this._setScale(zoomin ? _this.scale * _this.params.zoomStep : _this.scale / _this.params.zoomStep, _this._width / 2, _this._height / 2, false, _this.params.zoomAnimate);
366
+ };
367
+ };
368
+ EventHandler.on(zoomin, 'click', handler());
369
+ EventHandler.on(zoomout, 'click', handler(false));
370
+ }
371
+
372
+ function setupContainerTouchEvents() {
373
+ var map = this,
374
+ touchStartScale,
375
+ touchStartDistance,
376
+ touchX,
377
+ touchY,
378
+ centerTouchX,
379
+ centerTouchY,
380
+ lastTouchesLength;
381
+ var handleTouchEvent = function handleTouchEvent(e) {
382
+ var touches = e.touches;
383
+ var offset, scale, transXOld, transYOld;
384
+ if (e.type == 'touchstart') {
385
+ lastTouchesLength = 0;
386
+ }
387
+ if (touches.length == 1) {
388
+ if (lastTouchesLength == 1) {
389
+ transXOld = map.transX;
390
+ transYOld = map.transY;
391
+ map.transX -= (touchX - touches[0].pageX) / map.scale;
392
+ map.transY -= (touchY - touches[0].pageY) / map.scale;
393
+ map._tooltip.hide();
394
+ map._applyTransform();
395
+ if (transXOld != map.transX || transYOld != map.transY) {
396
+ e.preventDefault();
397
+ }
398
+ }
399
+ touchX = touches[0].pageX;
400
+ touchY = touches[0].pageY;
401
+ } else if (touches.length == 2) {
402
+ if (lastTouchesLength == 2) {
403
+ scale = Math.sqrt(Math.pow(touches[0].pageX - touches[1].pageX, 2) + Math.pow(touches[0].pageY - touches[1].pageY, 2)) / touchStartDistance;
404
+ map._setScale(touchStartScale * scale, centerTouchX, centerTouchY);
405
+ map._tooltip.hide();
406
+ e.preventDefault();
407
+ } else {
408
+ var rect = map.container.getBoundingClientRect();
409
+ offset = {
410
+ top: rect.top + window.scrollY,
411
+ left: rect.left + window.scrollX
412
+ };
413
+ if (touches[0].pageX > touches[1].pageX) {
414
+ centerTouchX = touches[1].pageX + (touches[0].pageX - touches[1].pageX) / 2;
415
+ } else {
416
+ centerTouchX = touches[0].pageX + (touches[1].pageX - touches[0].pageX) / 2;
417
+ }
418
+ if (touches[0].pageY > touches[1].pageY) {
419
+ centerTouchY = touches[1].pageY + (touches[0].pageY - touches[1].pageY) / 2;
420
+ } else {
421
+ centerTouchY = touches[0].pageY + (touches[1].pageY - touches[0].pageY) / 2;
422
+ }
423
+ centerTouchX -= offset.left;
424
+ centerTouchY -= offset.top;
425
+ touchStartScale = map.scale;
426
+ touchStartDistance = Math.sqrt(Math.pow(touches[0].pageX - touches[1].pageX, 2) + Math.pow(touches[0].pageY - touches[1].pageY, 2));
427
+ }
428
+ }
429
+ lastTouchesLength = touches.length;
430
+ };
431
+ EventHandler.on(map.container, 'touchstart', handleTouchEvent);
432
+ EventHandler.on(map.container, 'touchmove', handleTouchEvent);
433
+ }
434
+
435
+ function _arrayLikeToArray(r, a) {
436
+ (null == a || a > r.length) && (a = r.length);
437
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
438
+ return n;
439
+ }
440
+ function _assertThisInitialized(e) {
441
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
442
+ return e;
443
+ }
444
+ function _createForOfIteratorHelperLoose(r, e) {
445
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
446
+ if (t) return (t = t.call(r)).next.bind(t);
447
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
448
+ t && (r = t);
449
+ var o = 0;
450
+ return function () {
451
+ return o >= r.length ? {
452
+ done: !0
453
+ } : {
454
+ done: !1,
455
+ value: r[o++]
456
+ };
457
+ };
458
+ }
459
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
460
+ }
461
+ function _extends() {
462
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
463
+ for (var e = 1; e < arguments.length; e++) {
464
+ var t = arguments[e];
465
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
466
+ }
467
+ return n;
468
+ }, _extends.apply(null, arguments);
469
+ }
470
+ function _inheritsLoose(t, o) {
471
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
472
+ }
473
+ function _setPrototypeOf(t, e) {
474
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
475
+ return t.__proto__ = e, t;
476
+ }, _setPrototypeOf(t, e);
477
+ }
478
+ function _unsupportedIterableToArray(r, a) {
479
+ if (r) {
480
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
481
+ var t = {}.toString.call(r).slice(8, -1);
482
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
483
+ }
484
+ }
485
+
486
+ /**
487
+ * ------------------------------------------------------------------------
488
+ * Class Definition
489
+ * ------------------------------------------------------------------------
490
+ */
491
+ var BaseComponent = /*#__PURE__*/function () {
492
+ function BaseComponent() {}
493
+ var _proto = BaseComponent.prototype;
494
+ _proto.dispose = function dispose() {
495
+ if (this._tooltip) {
496
+ removeElement(this._tooltip);
497
+ } else {
498
+ // @todo: move shape in base component in v2
499
+ this.shape.remove();
500
+ }
501
+ for (var _iterator = _createForOfIteratorHelperLoose(Object.getOwnPropertyNames(this)), _step; !(_step = _iterator()).done;) {
502
+ var propertyName = _step.value;
503
+ this[propertyName] = null;
504
+ }
505
+ };
506
+ return BaseComponent;
507
+ }();
508
+
509
+ /**
510
+ * ------------------------------------------------------------------------
511
+ * Interactable
512
+ * ------------------------------------------------------------------------
513
+ */
514
+ var Interactable = {
515
+ getLabelText: function getLabelText(key, label) {
516
+ if (!label) {
517
+ return;
518
+ }
519
+ if (typeof label.render === 'function') {
520
+ var params = [];
521
+
522
+ // Pass additional paramater (Marker config object) in case it's a Marker.
523
+ if (this.config && this.config.marker) {
524
+ params.push(this.config.marker);
525
+ }
526
+
527
+ // Becuase we need to add the key always at the end
528
+ params.push(key);
529
+ return label.render.apply(this, params);
530
+ }
531
+ return key;
532
+ },
533
+ getLabelOffsets: function getLabelOffsets(key, label) {
534
+ if (typeof label.offsets === 'function') {
535
+ return label.offsets(key);
536
+ }
537
+
538
+ // If offsets are an array of offsets e.g offsets: [ [0, 25], [10, 15] ]
539
+ if (Array.isArray(label.offsets)) {
540
+ return label.offsets[key];
541
+ }
542
+ return [0, 0];
543
+ },
544
+ setStyle: function setStyle(property, value) {
545
+ this.shape.setStyle(property, value);
546
+ },
547
+ remove: function remove() {
548
+ this.shape.remove();
549
+ if (this.label) this.label.remove();
550
+ },
551
+ hover: function hover(state) {
552
+ this._setStatus('isHovered', state);
553
+ },
554
+ select: function select(state) {
555
+ this._setStatus('isSelected', state);
556
+ },
557
+ // Private
558
+ _setStatus: function _setStatus(property, state) {
559
+ this.shape[property] = state;
560
+ this.shape.updateStyle();
561
+ this[property] = state;
562
+ if (this.label) {
563
+ this.label[property] = state;
564
+ this.label.updateStyle();
565
+ }
566
+ }
567
+ };
568
+
569
+ /**
570
+ * ------------------------------------------------------------------------
571
+ * Class Definition
572
+ * ------------------------------------------------------------------------
573
+ */
574
+ var Region = /*#__PURE__*/function (_BaseComponent) {
575
+ function Region(_ref) {
576
+ var _this;
577
+ var map = _ref.map,
578
+ code = _ref.code,
579
+ path = _ref.path,
580
+ style = _ref.style,
581
+ label = _ref.label,
582
+ labelStyle = _ref.labelStyle,
583
+ labelsGroup = _ref.labelsGroup;
584
+ _this = _BaseComponent.call(this) || this;
585
+ _this._map = map;
586
+ _this.shape = _this._createRegion(path, code, style);
587
+ var text = _this.getLabelText(code, label);
588
+
589
+ // If label is passed and render function returns something
590
+ if (label && text) {
591
+ var bbox = _this.shape.getBBox();
592
+ var offsets = _this.getLabelOffsets(code, label);
593
+ _this.labelX = bbox.x + bbox.width / 2 + offsets[0];
594
+ _this.labelY = bbox.y + bbox.height / 2 + offsets[1];
595
+ _this.label = _this._map.canvas.createText({
596
+ text: text,
597
+ textAnchor: 'middle',
598
+ alignmentBaseline: 'central',
599
+ dataCode: code,
600
+ x: _this.labelX,
601
+ y: _this.labelY
602
+ }, labelStyle, labelsGroup);
603
+ _this.label.addClass('jvm-region jvm-element');
604
+ }
605
+ return _this;
606
+ }
607
+ _inheritsLoose(Region, _BaseComponent);
608
+ var _proto = Region.prototype;
609
+ _proto._createRegion = function _createRegion(path, code, style) {
610
+ path = this._map.canvas.createPath({
611
+ d: path,
612
+ dataCode: code
613
+ }, style);
614
+ path.addClass('jvm-region jvm-element');
615
+ return path;
616
+ };
617
+ _proto.updateLabelPosition = function updateLabelPosition() {
618
+ if (this.label) {
619
+ this.label.set({
620
+ x: this.labelX * this._map.scale + this._map.transX * this._map.scale,
621
+ y: this.labelY * this._map.scale + this._map.transY * this._map.scale
622
+ });
623
+ }
624
+ };
625
+ return Region;
626
+ }(BaseComponent);
627
+ inherit(Region, Interactable);
628
+
629
+ function createRegions() {
630
+ this._regionLabelsGroup = this._regionLabelsGroup || this.canvas.createGroup('jvm-regions-labels-group');
631
+ for (var code in this._mapData.paths) {
632
+ var region = new Region({
633
+ map: this,
634
+ code: code,
635
+ path: this._mapData.paths[code].path,
636
+ style: merge({}, this.params.regionStyle),
637
+ labelStyle: this.params.regionLabelStyle,
638
+ labelsGroup: this._regionLabelsGroup,
639
+ label: this.params.labels && this.params.labels.regions
640
+ });
641
+ this.regions[code] = {
642
+ config: this._mapData.paths[code],
643
+ element: region
644
+ };
645
+ }
646
+ }
647
+
648
+ /**
649
+ * ------------------------------------------------------------------------
650
+ * Class Definition
651
+ * ------------------------------------------------------------------------
652
+ */
653
+ var Line = /*#__PURE__*/function (_BaseComponent) {
654
+ function Line(_ref) {
655
+ var _this;
656
+ var index = _ref.index,
657
+ map = _ref.map,
658
+ style = _ref.style,
659
+ x1 = _ref.x1,
660
+ y1 = _ref.y1,
661
+ x2 = _ref.x2,
662
+ y2 = _ref.y2,
663
+ group = _ref.group,
664
+ config = _ref.config;
665
+ _this = _BaseComponent.call(this) || this;
666
+ _this.config = config;
667
+ _this.shape = map.canvas.createLine({
668
+ x1: x1,
669
+ y1: y1,
670
+ x2: x2,
671
+ y2: y2,
672
+ dataIndex: index
673
+ }, style, group);
674
+ _this.shape.addClass('jvm-line');
675
+ return _this;
676
+ }
677
+ _inheritsLoose(Line, _BaseComponent);
678
+ var _proto = Line.prototype;
679
+ _proto.setStyle = function setStyle(property, value) {
680
+ this.shape.setStyle(property, value);
681
+ };
682
+ return Line;
683
+ }(BaseComponent);
684
+
685
+ function createLines(lines, markers, isRecentlyCreated) {
686
+ if (isRecentlyCreated === void 0) {
687
+ isRecentlyCreated = false;
688
+ }
689
+ var point1 = false,
690
+ point2 = false;
691
+
692
+ // Create group for holding lines
693
+ // we're checking if `linesGroup` exists or not becuase we may add lines
694
+ // after the map has loaded so we will append the futured lines to this group as well.
695
+ this.linesGroup = this.linesGroup || this.canvas.createGroup('jvm-lines-group');
696
+ for (var index in lines) {
697
+ var config = lines[index];
698
+ for (var mindex in markers) {
699
+ var markerConfig = isRecentlyCreated ? markers[mindex].config : markers[mindex];
700
+ if (markerConfig.name === config.from) {
701
+ point1 = this.getMarkerPosition(markerConfig);
702
+ }
703
+ if (markerConfig.name === config.to) {
704
+ point2 = this.getMarkerPosition(markerConfig);
705
+ }
706
+ }
707
+ if (point1 !== false && point2 !== false) {
708
+ // Register lines with unique keys
709
+ this._lines[getLineUid(config.from, config.to)] = new Line({
710
+ index: index,
711
+ map: this,
712
+ // Merge the default `lineStyle` object with the custom `line` config style
713
+ style: merge({
714
+ initial: this.params.lineStyle
715
+ }, {
716
+ initial: config.style || {}
717
+ }, true),
718
+ x1: point1.x,
719
+ y1: point1.y,
720
+ x2: point2.x,
721
+ y2: point2.y,
722
+ group: this.linesGroup,
723
+ config: config
724
+ });
725
+ }
726
+ }
727
+ }
728
+
729
+ /**
730
+ * ------------------------------------------------------------------------
731
+ * Class Definition
732
+ * ------------------------------------------------------------------------
733
+ */
734
+ var Marker = /*#__PURE__*/function (_BaseComponent) {
735
+ function Marker(_ref) {
736
+ var _this;
737
+ var index = _ref.index,
738
+ style = _ref.style,
739
+ label = _ref.label,
740
+ cx = _ref.cx,
741
+ cy = _ref.cy,
742
+ map = _ref.map,
743
+ group = _ref.group;
744
+ _this = _BaseComponent.call(this) || this;
745
+
746
+ // Private
747
+ _this._map = map;
748
+ _this._isImage = !!style.initial.image;
749
+
750
+ // Protected
751
+ _this.config = arguments[0];
752
+ _this.shape = map.canvas[_this._isImage ? 'createImage' : 'createCircle']({
753
+ dataIndex: index,
754
+ cx: cx,
755
+ cy: cy
756
+ }, style, group);
757
+ _this.shape.addClass('jvm-marker jvm-element');
758
+ if (_this._isImage) {
759
+ _this.updateLabelPosition();
760
+ }
761
+ if (label) {
762
+ _this._createLabel(_this.config);
763
+ }
764
+ return _this;
765
+ }
766
+ _inheritsLoose(Marker, _BaseComponent);
767
+ var _proto = Marker.prototype;
768
+ _proto.updateLabelPosition = function updateLabelPosition() {
769
+ if (this.label) {
770
+ this.label.set({
771
+ x: this._labelX * this._map.scale + this._offsets[0] + this._map.transX * this._map.scale + 5 + (this._isImage ? (this.shape.width || 0) / 2 : this.shape.node.r.baseVal.value),
772
+ y: this._labelY * this._map.scale + this._map.transY * this._map.scale + this._offsets[1]
773
+ });
774
+ }
775
+ };
776
+ _proto._createLabel = function _createLabel(_ref2) {
777
+ var index = _ref2.index,
778
+ map = _ref2.map,
779
+ label = _ref2.label,
780
+ labelsGroup = _ref2.labelsGroup,
781
+ cx = _ref2.cx,
782
+ cy = _ref2.cy,
783
+ marker = _ref2.marker,
784
+ isRecentlyCreated = _ref2.isRecentlyCreated;
785
+ var labelText = this.getLabelText(index, label);
786
+ this._labelX = cx / map.scale - map.transX;
787
+ this._labelY = cy / map.scale - map.transY;
788
+ this._offsets = isRecentlyCreated && marker.offsets ? marker.offsets : this.getLabelOffsets(index, label);
789
+ this.label = map.canvas.createText({
790
+ text: labelText,
791
+ dataIndex: index,
792
+ x: this._labelX,
793
+ y: this._labelY,
794
+ dy: '0.6ex'
795
+ }, map.params.markerLabelStyle, labelsGroup);
796
+ this.label.addClass('jvm-marker jvm-element');
797
+ if (isRecentlyCreated) {
798
+ this.updateLabelPosition();
799
+ }
800
+ };
801
+ return Marker;
802
+ }(BaseComponent);
803
+ inherit(Marker, Interactable);
804
+
805
+ function createMarkers(markers, isRecentlyCreated) {
806
+ var _this = this;
807
+ if (markers === void 0) {
808
+ markers = {};
809
+ }
810
+ if (isRecentlyCreated === void 0) {
811
+ isRecentlyCreated = false;
812
+ }
813
+ // Create groups for holding markers and markers labels
814
+ // We're checking if `markersGroup` exists or not becuase we may add markers after the map has loaded
815
+ // So we will append the futured markers to this group as well.
816
+ this._markersGroup = this._markersGroup || this.canvas.createGroup('jvm-markers-group');
817
+ this._markerLabelsGroup = this._markerLabelsGroup || this.canvas.createGroup('jvm-markers-labels-group');
818
+ var _loop = function _loop() {
819
+ var config = markers[index];
820
+ var point = _this.getMarkerPosition(config);
821
+ var uid = config.coords.join(':');
822
+ if (!point) {
823
+ return 0; // continue
824
+ }
825
+
826
+ // We're checking if recently created marker does already exist
827
+ // If it does we don't need to create it again, so we'll continue
828
+ // Becuase we may have more than one marker submitted via `addMarkers` method.
829
+ if (isRecentlyCreated) {
830
+ if (Object.keys(_this._markers).filter(function (i) {
831
+ return _this._markers[i]._uid === uid;
832
+ }).length) {
833
+ return 0; // continue
834
+ }
835
+ index = Object.keys(_this._markers).length;
836
+ }
837
+ var marker = new Marker({
838
+ index: index,
839
+ map: _this,
840
+ // Merge the `markerStyle` object with the marker config `style` if presented.
841
+ style: merge(_this.params.markerStyle, _extends({}, config.style || {}), true),
842
+ label: _this.params.labels && _this.params.labels.markers,
843
+ labelsGroup: _this._markerLabelsGroup,
844
+ cx: point.x,
845
+ cy: point.y,
846
+ group: _this._markersGroup,
847
+ marker: config,
848
+ isRecentlyCreated: isRecentlyCreated
849
+ });
850
+
851
+ // Check for marker duplication
852
+ // this is useful when for example: a user clicks a button for creating marker two times
853
+ // so it will remove the old one and the new one will take its place.
854
+ if (_this._markers[index]) {
855
+ _this.removeMarkers([index]);
856
+ }
857
+ _this._markers[index] = {
858
+ _uid: uid,
859
+ config: config,
860
+ element: marker
861
+ };
862
+ },
863
+ _ret;
864
+ for (var index in markers) {
865
+ _ret = _loop();
866
+ if (_ret === 0) continue;
867
+ }
868
+ }
869
+
870
+ /**
871
+ * ------------------------------------------------------------------------
872
+ * Class Definition
873
+ * ------------------------------------------------------------------------
874
+ */
875
+ var Legend = /*#__PURE__*/function () {
876
+ function Legend(options) {
877
+ if (options === void 0) {
878
+ options = {};
879
+ }
880
+ this._options = options;
881
+ this._map = this._options.map;
882
+ this._series = this._options.series;
883
+ this._body = createElement('div', 'jvm-legend');
884
+ if (this._options.cssClass) {
885
+ this._body.setAttribute('class', this._options.cssClass);
886
+ }
887
+ if (options.vertical) {
888
+ this._map.legendVertical.appendChild(this._body);
889
+ } else {
890
+ this._map.legendHorizontal.appendChild(this._body);
891
+ }
892
+ this.render();
893
+ }
894
+ var _proto = Legend.prototype;
895
+ _proto.render = function render() {
896
+ var ticks = this._series.scale.getTicks();
897
+ var inner = createElement('div', 'jvm-legend-inner');
898
+ this._body.innderHTML = '';
899
+ if (this._options.title) {
900
+ var legendTitle = createElement('div', 'jvm-legend-title', this._options.title);
901
+ this._body.appendChild(legendTitle);
902
+ }
903
+ this._body.appendChild(inner);
904
+ for (var i = 0; i < ticks.length; i++) {
905
+ var tick = createElement('div', 'jvm-legend-tick');
906
+ var sample = createElement('div', 'jvm-legend-tick-sample');
907
+ switch (this._series.config.attribute) {
908
+ case 'fill':
909
+ if (isImageUrl(ticks[i].value)) {
910
+ sample.style.background = "url(" + ticks[i].value + ")";
911
+ } else {
912
+ sample.style.background = ticks[i].value;
913
+ }
914
+ break;
915
+ case 'stroke':
916
+ sample.style.background = ticks[i].value;
917
+ break;
918
+ case 'image':
919
+ sample.style.background = "url(" + (typeof ticks[i].value === 'object' ? ticks[i].value.url : ticks[i].value) + ") no-repeat center center";
920
+ sample.style.backgroundSize = 'cover';
921
+ break;
922
+ }
923
+ tick.appendChild(sample);
924
+ var label = ticks[i].label;
925
+ if (this._options.labelRender) {
926
+ label = this._options.labelRender(label);
927
+ }
928
+ var tickText = createElement('div', 'jvm-legend-tick-text', label);
929
+ tick.appendChild(tickText);
930
+ inner.appendChild(tick);
931
+ }
932
+ };
933
+ return Legend;
934
+ }();
935
+
936
+ /**
937
+ * ------------------------------------------------------------------------
938
+ * Class Definition
939
+ * ------------------------------------------------------------------------
940
+ */
941
+ var OrdinalScale = /*#__PURE__*/function () {
942
+ function OrdinalScale(scale) {
943
+ this._scale = scale;
944
+ }
945
+ var _proto = OrdinalScale.prototype;
946
+ _proto.getValue = function getValue(value) {
947
+ return this._scale[value];
948
+ };
949
+ _proto.getTicks = function getTicks() {
950
+ var ticks = [];
951
+ for (var key in this._scale) {
952
+ ticks.push({
953
+ label: key,
954
+ value: this._scale[key]
955
+ });
956
+ }
957
+ return ticks;
958
+ };
959
+ return OrdinalScale;
960
+ }();
961
+
962
+ /**
963
+ * ------------------------------------------------------------------------
964
+ * Class Definition
965
+ * ------------------------------------------------------------------------
966
+ */
967
+ var Series = /*#__PURE__*/function () {
968
+ function Series(config, elements, map) {
969
+ if (config === void 0) {
970
+ config = {};
971
+ }
972
+ // Private
973
+ this._map = map;
974
+ this._elements = elements; // Could be markers or regions
975
+ this._values = config.values || {};
976
+
977
+ // Protected
978
+ this.config = config;
979
+ this.config.attribute = config.attribute || 'fill';
980
+
981
+ // Set initial attributes
982
+ if (config.attributes) {
983
+ this.setAttributes(config.attributes);
984
+ }
985
+ if (typeof config.scale === 'object') {
986
+ this.scale = new OrdinalScale(config.scale);
987
+ }
988
+ if (this.config.legend) {
989
+ this.legend = new Legend(merge({
990
+ map: this._map,
991
+ series: this
992
+ }, this.config.legend));
993
+ }
994
+ this.setValues(this._values);
995
+ }
996
+ var _proto = Series.prototype;
997
+ _proto.setValues = function setValues(values) {
998
+ var attrs = {};
999
+ for (var key in values) {
1000
+ if (values[key]) {
1001
+ attrs[key] = this.scale.getValue(values[key]);
1002
+ }
1003
+ }
1004
+ this.setAttributes(attrs);
1005
+ };
1006
+ _proto.setAttributes = function setAttributes(attrs) {
1007
+ for (var code in attrs) {
1008
+ if (this._elements[code]) {
1009
+ this._elements[code].element.setStyle(this.config.attribute, attrs[code]);
1010
+ }
1011
+ }
1012
+ };
1013
+ _proto.clear = function clear() {
1014
+ var key,
1015
+ attrs = {};
1016
+ for (key in this._values) {
1017
+ if (this._elements[key]) {
1018
+ attrs[key] = this._elements[key].element.shape.style.initial[this.config.attribute];
1019
+ }
1020
+ }
1021
+ this.setAttributes(attrs);
1022
+ this._values = {};
1023
+ };
1024
+ return Series;
1025
+ }();
1026
+
1027
+ function createSeries() {
1028
+ this.series = {
1029
+ markers: [],
1030
+ regions: []
1031
+ };
1032
+ for (var key in this.params.series) {
1033
+ for (var i = 0; i < this.params.series[key].length; i++) {
1034
+ this.series[key][i] = new Series(this.params.series[key][i], key === 'markers' ? this._markers : this.regions, this);
1035
+ }
1036
+ }
1037
+ }
1038
+
1039
+ function applyTransform() {
1040
+ var maxTransX, maxTransY, minTransX, minTransY;
1041
+ if (this._defaultWidth * this.scale <= this._width) {
1042
+ maxTransX = (this._width - this._defaultWidth * this.scale) / (2 * this.scale);
1043
+ minTransX = (this._width - this._defaultWidth * this.scale) / (2 * this.scale);
1044
+ } else {
1045
+ maxTransX = 0;
1046
+ minTransX = (this._width - this._defaultWidth * this.scale) / this.scale;
1047
+ }
1048
+ if (this._defaultHeight * this.scale <= this._height) {
1049
+ maxTransY = (this._height - this._defaultHeight * this.scale) / (2 * this.scale);
1050
+ minTransY = (this._height - this._defaultHeight * this.scale) / (2 * this.scale);
1051
+ } else {
1052
+ maxTransY = 0;
1053
+ minTransY = (this._height - this._defaultHeight * this.scale) / this.scale;
1054
+ }
1055
+ if (this.transY > maxTransY) {
1056
+ this.transY = maxTransY;
1057
+ } else if (this.transY < minTransY) {
1058
+ this.transY = minTransY;
1059
+ }
1060
+ if (this.transX > maxTransX) {
1061
+ this.transX = maxTransX;
1062
+ } else if (this.transX < minTransX) {
1063
+ this.transX = minTransX;
1064
+ }
1065
+ this.canvas.applyTransformParams(this.scale, this.transX, this.transY);
1066
+ if (this._markers) {
1067
+ this._repositionMarkers();
1068
+ }
1069
+ if (this._lines) {
1070
+ this._repositionLines();
1071
+ }
1072
+ this._repositionLabels();
1073
+ }
1074
+
1075
+ function resize() {
1076
+ var curBaseScale = this._baseScale;
1077
+ if (this._width / this._height > this._defaultWidth / this._defaultHeight) {
1078
+ this._baseScale = this._height / this._defaultHeight;
1079
+ this._baseTransX = Math.abs(this._width - this._defaultWidth * this._baseScale) / (2 * this._baseScale);
1080
+ } else {
1081
+ this._baseScale = this._width / this._defaultWidth;
1082
+ this._baseTransY = Math.abs(this._height - this._defaultHeight * this._baseScale) / (2 * this._baseScale);
1083
+ }
1084
+ this.scale *= this._baseScale / curBaseScale;
1085
+ this.transX *= this._baseScale / curBaseScale;
1086
+ this.transY *= this._baseScale / curBaseScale;
1087
+ }
1088
+
1089
+ function setScale(scale, anchorX, anchorY, isCentered, animate) {
1090
+ var _this = this;
1091
+ var zoomStep,
1092
+ interval,
1093
+ i = 0,
1094
+ count = Math.abs(Math.round((scale - this.scale) * 60 / Math.max(scale, this.scale))),
1095
+ scaleStart,
1096
+ scaleDiff,
1097
+ transXStart,
1098
+ transXDiff,
1099
+ transYStart,
1100
+ transYDiff,
1101
+ transX,
1102
+ transY;
1103
+ if (scale > this.params.zoomMax * this._baseScale) {
1104
+ scale = this.params.zoomMax * this._baseScale;
1105
+ } else if (scale < this.params.zoomMin * this._baseScale) {
1106
+ scale = this.params.zoomMin * this._baseScale;
1107
+ }
1108
+ if (typeof anchorX != 'undefined' && typeof anchorY != 'undefined') {
1109
+ zoomStep = scale / this.scale;
1110
+ if (isCentered) {
1111
+ transX = anchorX + this._defaultWidth * (this._width / (this._defaultWidth * scale)) / 2;
1112
+ transY = anchorY + this._defaultHeight * (this._height / (this._defaultHeight * scale)) / 2;
1113
+ } else {
1114
+ transX = this.transX - (zoomStep - 1) / scale * anchorX;
1115
+ transY = this.transY - (zoomStep - 1) / scale * anchorY;
1116
+ }
1117
+ }
1118
+ if (animate && count > 0) {
1119
+ scaleStart = this.scale;
1120
+ scaleDiff = (scale - scaleStart) / count;
1121
+ transXStart = this.transX * this.scale;
1122
+ transYStart = this.transY * this.scale;
1123
+ transXDiff = (transX * scale - transXStart) / count;
1124
+ transYDiff = (transY * scale - transYStart) / count;
1125
+ interval = setInterval(function () {
1126
+ i += 1;
1127
+ _this.scale = scaleStart + scaleDiff * i;
1128
+ _this.transX = (transXStart + transXDiff * i) / _this.scale;
1129
+ _this.transY = (transYStart + transYDiff * i) / _this.scale;
1130
+ _this._applyTransform();
1131
+ if (i == count) {
1132
+ clearInterval(interval);
1133
+ _this._emit(Events.onViewportChange, [_this.scale, _this.transX, _this.transY]);
1134
+ }
1135
+ }, 10);
1136
+ } else {
1137
+ this.transX = transX;
1138
+ this.transY = transY;
1139
+ this.scale = scale;
1140
+ this._applyTransform();
1141
+ this._emit(Events.onViewportChange, [this.scale, this.transX, this.transY]);
1142
+ }
1143
+ }
1144
+
1145
+ function setFocus(config) {
1146
+ var _this = this;
1147
+ if (config === void 0) {
1148
+ config = {};
1149
+ }
1150
+ var bbox,
1151
+ codes = [];
1152
+ if (config.region) {
1153
+ codes.push(config.region);
1154
+ } else if (config.regions) {
1155
+ codes = config.regions;
1156
+ }
1157
+ if (codes.length) {
1158
+ codes.forEach(function (code) {
1159
+ if (_this.regions[code]) {
1160
+ var itemBbox = _this.regions[code].element.shape.getBBox();
1161
+ if (itemBbox) {
1162
+ // Handle the first loop
1163
+ if (typeof bbox == 'undefined') {
1164
+ bbox = itemBbox;
1165
+ } else {
1166
+ // get the old bbox properties plus the current
1167
+ // this kinda incrementing the old values and the new values
1168
+ bbox = {
1169
+ x: Math.min(bbox.x, itemBbox.x),
1170
+ y: Math.min(bbox.y, itemBbox.y),
1171
+ width: Math.max(bbox.x + bbox.width, itemBbox.x + itemBbox.width) - Math.min(bbox.x, itemBbox.x),
1172
+ height: Math.max(bbox.y + bbox.height, itemBbox.y + itemBbox.height) - Math.min(bbox.y, itemBbox.y)
1173
+ };
1174
+ }
1175
+ }
1176
+ }
1177
+ });
1178
+ return this._setScale(Math.min(this._width / bbox.width, this._height / bbox.height), -(bbox.x + bbox.width / 2), -(bbox.y + bbox.height / 2), true, config.animate);
1179
+ } else if (config.coords) {
1180
+ var point = this.coordsToPoint(config.coords[0], config.coords[1]);
1181
+ var x = this.transX - point.x / this.scale;
1182
+ var y = this.transY - point.y / this.scale;
1183
+ return this._setScale(config.scale * this._baseScale, x, y, true, config.animate);
1184
+ }
1185
+ }
1186
+
1187
+ function updateSize() {
1188
+ this._width = this.container.offsetWidth;
1189
+ this._height = this.container.offsetHeight;
1190
+ this._resize();
1191
+ this.canvas.setSize(this._width, this._height);
1192
+ this._applyTransform();
1193
+ }
1194
+
1195
+ /**
1196
+ * ------------------------------------------------------------------------
1197
+ * Object
1198
+ * ------------------------------------------------------------------------
1199
+ */
1200
+ var Proj = {
1201
+ /* sgn(n){
1202
+ if (n > 0) {
1203
+ return 1;
1204
+ } else if (n < 0) {
1205
+ return -1;
1206
+ } else {
1207
+ return n;
1208
+ }
1209
+ }, */
1210
+ mill: function mill(lat, lng, c) {
1211
+ return {
1212
+ x: this.radius * (lng - c) * this.radDeg,
1213
+ y: -this.radius * Math.log(Math.tan((45 + 0.4 * lat) * this.radDeg)) / 0.8
1214
+ };
1215
+ },
1216
+ /* mill_inv(x, y, c) {
1217
+ return {
1218
+ lat: (2.5 * Math.atan(Math.exp(0.8 * y / this.radius)) - 5 * Math.PI / 8) * this.degRad,
1219
+ lng: (c * this.radDeg + x / this.radius) * this.degRad
1220
+ };
1221
+ }, */
1222
+ merc: function merc(lat, lng, c) {
1223
+ return {
1224
+ x: this.radius * (lng - c) * this.radDeg,
1225
+ y: -this.radius * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360))
1226
+ };
1227
+ },
1228
+ /* merc_inv(x, y, c) {
1229
+ return {
1230
+ lat: (2 * Math.atan(Math.exp(y / this.radius)) - Math.PI / 2) * this.degRad,
1231
+ lng: (c * this.radDeg + x / this.radius) * this.degRad
1232
+ };
1233
+ }, */
1234
+ aea: function aea(lat, lng, c) {
1235
+ var fi0 = 0,
1236
+ lambda0 = c * this.radDeg,
1237
+ fi1 = 29.5 * this.radDeg,
1238
+ fi2 = 45.5 * this.radDeg,
1239
+ fi = lat * this.radDeg,
1240
+ lambda = lng * this.radDeg,
1241
+ n = (Math.sin(fi1) + Math.sin(fi2)) / 2,
1242
+ C = Math.cos(fi1) * Math.cos(fi1) + 2 * n * Math.sin(fi1),
1243
+ theta = n * (lambda - lambda0),
1244
+ ro = Math.sqrt(C - 2 * n * Math.sin(fi)) / n,
1245
+ ro0 = Math.sqrt(C - 2 * n * Math.sin(fi0)) / n;
1246
+ return {
1247
+ x: ro * Math.sin(theta) * this.radius,
1248
+ y: -(ro0 - ro * Math.cos(theta)) * this.radius
1249
+ };
1250
+ },
1251
+ /* aea_inv(xCoord, yCoord, c) {
1252
+ var x = xCoord / this.radius,
1253
+ y = yCoord / this.radius,
1254
+ fi0 = 0,
1255
+ lambda0 = c * this.radDeg,
1256
+ fi1 = 29.5 * this.radDeg,
1257
+ fi2 = 45.5 * this.radDeg,
1258
+ n = (Math.sin(fi1)+Math.sin(fi2)) / 2,
1259
+ C = Math.cos(fi1)*Math.cos(fi1)+2*n*Math.sin(fi1),
1260
+ ro0 = Math.sqrt(C-2*n*Math.sin(fi0))/n,
1261
+ ro = Math.sqrt(x*x+(ro0-y)*(ro0-y)),
1262
+ theta = Math.atan( x / (ro0 - y) );
1263
+ return {
1264
+ lat: (Math.asin((C - ro * ro * n * n) / (2 * n))) * this.degRad,
1265
+ lng: (lambda0 + theta / n) * this.degRad
1266
+ };
1267
+ }, */
1268
+ lcc: function lcc(lat, lng, c) {
1269
+ var fi0 = 0,
1270
+ lambda0 = c * this.radDeg,
1271
+ lambda = lng * this.radDeg,
1272
+ fi1 = 33 * this.radDeg,
1273
+ fi2 = 45 * this.radDeg,
1274
+ fi = lat * this.radDeg,
1275
+ n = Math.log(Math.cos(fi1) * (1 / Math.cos(fi2))) / Math.log(Math.tan(Math.PI / 4 + fi2 / 2) * (1 / Math.tan(Math.PI / 4 + fi1 / 2))),
1276
+ F = Math.cos(fi1) * Math.pow(Math.tan(Math.PI / 4 + fi1 / 2), n) / n,
1277
+ ro = F * Math.pow(1 / Math.tan(Math.PI / 4 + fi / 2), n),
1278
+ ro0 = F * Math.pow(1 / Math.tan(Math.PI / 4 + fi0 / 2), n);
1279
+ return {
1280
+ x: ro * Math.sin(n * (lambda - lambda0)) * this.radius,
1281
+ y: -(ro0 - ro * Math.cos(n * (lambda - lambda0))) * this.radius
1282
+ };
1283
+ }
1284
+ /* lcc_inv(xCoord, yCoord, c) {
1285
+ var x = xCoord / this.radius,
1286
+ y = yCoord / this.radius,
1287
+ fi0 = 0,
1288
+ lambda0 = c * this.radDeg,
1289
+ fi1 = 33 * this.radDeg,
1290
+ fi2 = 45 * this.radDeg,
1291
+ n = Math.log( Math.cos(fi1) * (1 / Math.cos(fi2)) ) / Math.log( Math.tan( Math.PI / 4 + fi2 / 2) * (1 / Math.tan( Math.PI / 4 + fi1 / 2) ) ),
1292
+ F = ( Math.cos(fi1) * Math.pow( Math.tan( Math.PI / 4 + fi1 / 2 ), n ) ) / n,
1293
+ ro0 = F * Math.pow( 1 / Math.tan( Math.PI / 4 + fi0 / 2 ), n ),
1294
+ ro = this.sgn(n) * Math.sqrt(x*x+(ro0-y)*(ro0-y)),
1295
+ theta = Math.atan( x / (ro0 - y) );
1296
+ return {
1297
+ lat: (2 * Math.atan(Math.pow(F/ro, 1/n)) - Math.PI / 2) * this.degRad,
1298
+ lng: (lambda0 + theta / n) * this.degRad
1299
+ };
1300
+ } */
1301
+ };
1302
+ Proj.degRad = 180 / Math.PI;
1303
+ Proj.radDeg = Math.PI / 180;
1304
+ Proj.radius = 6381372;
1305
+
1306
+ function coordsToPoint(lat, lng) {
1307
+ var projection = Map.maps[this.params.map].projection;
1308
+ var _Proj$projection$type = Proj[projection.type](lat, lng, projection.centralMeridian),
1309
+ x = _Proj$projection$type.x,
1310
+ y = _Proj$projection$type.y;
1311
+ var inset = this.getInsetForPoint(x, y);
1312
+ if (!inset) {
1313
+ return false;
1314
+ }
1315
+ var bbox = inset.bbox;
1316
+ x = (x - bbox[0].x) / (bbox[1].x - bbox[0].x) * inset.width * this.scale;
1317
+ y = (y - bbox[0].y) / (bbox[1].y - bbox[0].y) * inset.height * this.scale;
1318
+ return {
1319
+ x: x + this.transX * this.scale + inset.left * this.scale,
1320
+ y: y + this.transY * this.scale + inset.top * this.scale
1321
+ };
1322
+ }
1323
+
1324
+ function getInsetForPoint(x, y) {
1325
+ var insets = Map.maps[this.params.map].insets;
1326
+ for (var index = 0; index < insets.length; index++) {
1327
+ var _insets$index$bbox = insets[index].bbox,
1328
+ start = _insets$index$bbox[0],
1329
+ end = _insets$index$bbox[1];
1330
+ if (x > start.x && x < end.x && y > start.y && y < end.y) {
1331
+ return insets[index];
1332
+ }
1333
+ }
1334
+ }
1335
+
1336
+ function getMarkerPosition(_ref) {
1337
+ var coords = _ref.coords;
1338
+ if (Map.maps[this.params.map].projection) {
1339
+ return this.coordsToPoint.apply(this, coords);
1340
+ }
1341
+ return {
1342
+ x: coords[0] * this.scale + this.transX * this.scale,
1343
+ y: coords[1] * this.scale + this.transY * this.scale
1344
+ };
1345
+ }
1346
+
1347
+ function repositionLines() {
1348
+ var point1 = false,
1349
+ point2 = false;
1350
+ for (var index in this._lines) {
1351
+ for (var mindex in this._markers) {
1352
+ var marker = this._markers[mindex];
1353
+ if (marker.config.name === this._lines[index].config.from) {
1354
+ point1 = this.getMarkerPosition(marker.config);
1355
+ }
1356
+ if (marker.config.name === this._lines[index].config.to) {
1357
+ point2 = this.getMarkerPosition(marker.config);
1358
+ }
1359
+ }
1360
+ if (point1 !== false && point2 !== false) {
1361
+ this._lines[index].setStyle({
1362
+ x1: point1.x,
1363
+ y1: point1.y,
1364
+ x2: point2.x,
1365
+ y2: point2.y
1366
+ });
1367
+ }
1368
+ }
1369
+ }
1370
+
1371
+ function repositionMarkers() {
1372
+ for (var index in this._markers) {
1373
+ var point = this.getMarkerPosition(this._markers[index].config);
1374
+ if (point !== false) {
1375
+ this._markers[index].element.setStyle({
1376
+ cx: point.x,
1377
+ cy: point.y
1378
+ });
1379
+ }
1380
+ }
1381
+ }
1382
+
1383
+ function repositionLabels() {
1384
+ var labels = this.params.labels;
1385
+ if (!labels) {
1386
+ return;
1387
+ }
1388
+
1389
+ // Regions labels
1390
+ if (labels.regions) {
1391
+ for (var key in this.regions) {
1392
+ this.regions[key].element.updateLabelPosition();
1393
+ }
1394
+ }
1395
+
1396
+ // Markers labels
1397
+ if (labels.markers) {
1398
+ for (var _key in this._markers) {
1399
+ this._markers[_key].element.updateLabelPosition();
1400
+ }
1401
+ }
1402
+ }
1403
+
1404
+ var core = {
1405
+ _setupContainerEvents: setupContainerEvents,
1406
+ _setupElementEvents: setupElementEvents,
1407
+ _setupZoomButtons: setupZoomButtons,
1408
+ _setupContainerTouchEvents: setupContainerTouchEvents,
1409
+ _createRegions: createRegions,
1410
+ _createLines: createLines,
1411
+ _createMarkers: createMarkers,
1412
+ _createSeries: createSeries,
1413
+ _applyTransform: applyTransform,
1414
+ _resize: resize,
1415
+ _setScale: setScale,
1416
+ setFocus: setFocus,
1417
+ updateSize: updateSize,
1418
+ coordsToPoint: coordsToPoint,
1419
+ getInsetForPoint: getInsetForPoint,
1420
+ getMarkerPosition: getMarkerPosition,
1421
+ _repositionLines: repositionLines,
1422
+ _repositionMarkers: repositionMarkers,
1423
+ _repositionLabels: repositionLabels
1424
+ };
1425
+
1426
+ var Defaults = {
1427
+ map: 'world',
1428
+ backgroundColor: 'transparent',
1429
+ draggable: true,
1430
+ zoomButtons: true,
1431
+ zoomOnScroll: true,
1432
+ zoomOnScrollSpeed: 3,
1433
+ zoomMax: 12,
1434
+ zoomMin: 1,
1435
+ zoomAnimate: true,
1436
+ showTooltip: true,
1437
+ zoomStep: 1.5,
1438
+ bindTouchEvents: true,
1439
+ // Line options
1440
+ lineStyle: {
1441
+ stroke: '#808080',
1442
+ strokeWidth: 1,
1443
+ strokeLinecap: 'round'
1444
+ },
1445
+ // Marker options
1446
+ markersSelectable: false,
1447
+ markersSelectableOne: false,
1448
+ markerStyle: {
1449
+ initial: {
1450
+ r: 7,
1451
+ fill: '#374151',
1452
+ fillOpacity: 1,
1453
+ stroke: '#FFF',
1454
+ strokeWidth: 5,
1455
+ strokeOpacity: .5
1456
+ },
1457
+ hover: {
1458
+ fill: '#3cc0ff',
1459
+ cursor: 'pointer'
1460
+ },
1461
+ selected: {
1462
+ fill: 'blue'
1463
+ },
1464
+ selectedHover: {}
1465
+ },
1466
+ markerLabelStyle: {
1467
+ initial: {
1468
+ fontFamily: 'Verdana',
1469
+ fontSize: 12,
1470
+ fontWeight: 500,
1471
+ cursor: 'default',
1472
+ fill: '#374151'
1473
+ },
1474
+ hover: {
1475
+ cursor: 'pointer'
1476
+ },
1477
+ selected: {},
1478
+ selectedHover: {}
1479
+ },
1480
+ // Region options
1481
+ regionsSelectable: false,
1482
+ regionsSelectableOne: false,
1483
+ regionStyle: {
1484
+ initial: {
1485
+ fill: '#dee2e8',
1486
+ fillOpacity: 1,
1487
+ stroke: 'none',
1488
+ strokeWidth: 0
1489
+ },
1490
+ hover: {
1491
+ fillOpacity: .7,
1492
+ cursor: 'pointer'
1493
+ },
1494
+ selected: {
1495
+ fill: '#9ca3af'
1496
+ },
1497
+ selectedHover: {}
1498
+ },
1499
+ regionLabelStyle: {
1500
+ initial: {
1501
+ fontFamily: 'Verdana',
1502
+ fontSize: '12',
1503
+ fontWeight: 'bold',
1504
+ cursor: 'default',
1505
+ fill: '#35373e'
1506
+ },
1507
+ hover: {
1508
+ cursor: 'pointer'
1509
+ }
1510
+ }
1511
+ };
1512
+
1513
+ /**
1514
+ * ------------------------------------------------------------------------
1515
+ * Class Definition
1516
+ * ------------------------------------------------------------------------
1517
+ */
1518
+ var SVGElement = /*#__PURE__*/function () {
1519
+ function SVGElement(name, config) {
1520
+ this.node = this._createElement(name);
1521
+ if (config) {
1522
+ this.set(config);
1523
+ }
1524
+ }
1525
+
1526
+ // Create new SVG element `svg`, `g`, `path`, `line`, `circle`, `image`, etc.
1527
+ // https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS#important_namespace_uris
1528
+ var _proto = SVGElement.prototype;
1529
+ _proto._createElement = function _createElement(tagName) {
1530
+ return document.createElementNS('http://www.w3.org/2000/svg', tagName);
1531
+ };
1532
+ _proto.addClass = function addClass(className) {
1533
+ this.node.setAttribute('class', className);
1534
+ };
1535
+ _proto.getBBox = function getBBox() {
1536
+ return this.node.getBBox();
1537
+ }
1538
+
1539
+ // Apply attributes on the current node element
1540
+ ;
1541
+ _proto.set = function set(property, value) {
1542
+ if (typeof property === 'object') {
1543
+ for (var attr in property) {
1544
+ this.applyAttr(attr, property[attr]);
1545
+ }
1546
+ } else {
1547
+ this.applyAttr(property, value);
1548
+ }
1549
+ };
1550
+ _proto.get = function get(property) {
1551
+ return this.style.initial[property];
1552
+ };
1553
+ _proto.applyAttr = function applyAttr(property, value) {
1554
+ this.node.setAttribute(hyphenate(property), value);
1555
+ };
1556
+ _proto.remove = function remove() {
1557
+ removeElement(this.node);
1558
+ };
1559
+ return SVGElement;
1560
+ }();
1561
+
1562
+ /**
1563
+ * ------------------------------------------------------------------------
1564
+ * Class Definition
1565
+ * ------------------------------------------------------------------------
1566
+ */
1567
+ var SVGShapeElement = /*#__PURE__*/function (_SVGElement) {
1568
+ function SVGShapeElement(name, config, style) {
1569
+ var _this;
1570
+ if (style === void 0) {
1571
+ style = {};
1572
+ }
1573
+ _this = _SVGElement.call(this, name, config) || this;
1574
+ _this.isHovered = false;
1575
+ _this.isSelected = false;
1576
+ _this.style = style;
1577
+ _this.style.current = {};
1578
+ _this.updateStyle();
1579
+ return _this;
1580
+ }
1581
+ _inheritsLoose(SVGShapeElement, _SVGElement);
1582
+ var _proto = SVGShapeElement.prototype;
1583
+ _proto.setStyle = function setStyle(property, value) {
1584
+ if (typeof property === 'object') {
1585
+ merge(this.style.current, property);
1586
+ } else {
1587
+ var _merge;
1588
+ merge(this.style.current, (_merge = {}, _merge[property] = value, _merge));
1589
+ }
1590
+ this.updateStyle();
1591
+ };
1592
+ _proto.updateStyle = function updateStyle() {
1593
+ var attrs = {};
1594
+ merge(attrs, this.style.initial);
1595
+ merge(attrs, this.style.current);
1596
+ if (this.isHovered) {
1597
+ merge(attrs, this.style.hover);
1598
+ }
1599
+ if (this.isSelected) {
1600
+ merge(attrs, this.style.selected);
1601
+ if (this.isHovered) {
1602
+ merge(attrs, this.style.selectedHover);
1603
+ }
1604
+ }
1605
+ this.set(attrs);
1606
+ };
1607
+ return SVGShapeElement;
1608
+ }(SVGElement);
1609
+
1610
+ /**
1611
+ * ------------------------------------------------------------------------
1612
+ * Class Definition
1613
+ * ------------------------------------------------------------------------
1614
+ */
1615
+ var SVGTextElement = /*#__PURE__*/function (_SVGShapeElement) {
1616
+ function SVGTextElement(config, style) {
1617
+ return _SVGShapeElement.call(this, 'text', config, style) || this;
1618
+ }
1619
+ _inheritsLoose(SVGTextElement, _SVGShapeElement);
1620
+ var _proto = SVGTextElement.prototype;
1621
+ _proto.applyAttr = function applyAttr(attr, value) {
1622
+ attr === 'text' ? this.node.textContent = value : _SVGShapeElement.prototype.applyAttr.call(this, attr, value);
1623
+ };
1624
+ return SVGTextElement;
1625
+ }(SVGShapeElement);
1626
+
1627
+ /**
1628
+ * ------------------------------------------------------------------------
1629
+ * Class Definition
1630
+ * ------------------------------------------------------------------------
1631
+ */
1632
+ var SVGImageElement = /*#__PURE__*/function (_SVGShapeElement) {
1633
+ function SVGImageElement(config, style) {
1634
+ return _SVGShapeElement.call(this, 'image', config, style) || this;
1635
+ }
1636
+ _inheritsLoose(SVGImageElement, _SVGShapeElement);
1637
+ var _proto = SVGImageElement.prototype;
1638
+ _proto.applyAttr = function applyAttr(attr, value) {
1639
+ var imageUrl;
1640
+ if (attr === 'image') {
1641
+ // This get executed when we have url in series.markers[0].scale.someScale.url
1642
+ if (typeof value === 'object') {
1643
+ imageUrl = value.url;
1644
+ this.offset = value.offset || [0, 0];
1645
+ } else {
1646
+ imageUrl = value;
1647
+ this.offset = [0, 0];
1648
+ }
1649
+ this.node.setAttributeNS('http://www.w3.org/1999/xlink', 'href', imageUrl);
1650
+
1651
+ // Set width and height then call this `applyAttr` again
1652
+ this.width = 23;
1653
+ this.height = 23;
1654
+ this.applyAttr('width', this.width);
1655
+ this.applyAttr('height', this.height);
1656
+ this.applyAttr('x', this.cx - this.width / 2 + this.offset[0]);
1657
+ this.applyAttr('y', this.cy - this.height / 2 + this.offset[1]);
1658
+ } else if (attr == 'cx') {
1659
+ this.cx = value;
1660
+ if (this.width) {
1661
+ this.applyAttr('x', value - this.width / 2 + this.offset[0]);
1662
+ }
1663
+ } else if (attr == 'cy') {
1664
+ this.cy = value;
1665
+ if (this.height) {
1666
+ this.applyAttr('y', value - this.height / 2 + this.offset[1]);
1667
+ }
1668
+ } else {
1669
+ // This time Call SVGElement
1670
+ _SVGShapeElement.prototype.applyAttr.apply(this, arguments);
1671
+ }
1672
+ };
1673
+ return SVGImageElement;
1674
+ }(SVGShapeElement);
1675
+
1676
+ /**
1677
+ * ------------------------------------------------------------------------
1678
+ * Class Definition
1679
+ * ------------------------------------------------------------------------
1680
+ */
1681
+ var SVGCanvasElement = /*#__PURE__*/function (_SVGElement) {
1682
+ function SVGCanvasElement(container) {
1683
+ var _this;
1684
+ _this = _SVGElement.call(this, 'svg') || this; // Create svg element for holding the whole map
1685
+
1686
+ _this._container = container;
1687
+
1688
+ // Create the defs element
1689
+ _this._defsElement = new SVGElement('defs');
1690
+
1691
+ // Create group element which will hold the paths (regions)
1692
+ _this._rootElement = new SVGElement('g', {
1693
+ id: 'jvm-regions-group'
1694
+ });
1695
+
1696
+ // Append the defs element to the this.node (SVG tag)
1697
+ _this.node.appendChild(_this._defsElement.node);
1698
+
1699
+ // Append the group to this.node (SVG tag)
1700
+ _this.node.appendChild(_this._rootElement.node);
1701
+
1702
+ // Append this.node (SVG tag) to the container
1703
+ _this._container.appendChild(_this.node);
1704
+ return _this;
1705
+ }
1706
+ _inheritsLoose(SVGCanvasElement, _SVGElement);
1707
+ var _proto = SVGCanvasElement.prototype;
1708
+ _proto.setSize = function setSize(width, height) {
1709
+ this.node.setAttribute('width', width);
1710
+ this.node.setAttribute('height', height);
1711
+ };
1712
+ _proto.applyTransformParams = function applyTransformParams(scale, transX, transY) {
1713
+ this._rootElement.node.setAttribute('transform', "scale(" + scale + ") translate(" + transX + ", " + transY + ")");
1714
+ }
1715
+
1716
+ // Create `path` element
1717
+ ;
1718
+ _proto.createPath = function createPath(config, style) {
1719
+ var path = new SVGShapeElement('path', config, style);
1720
+ path.node.setAttribute('fill-rule', 'evenodd');
1721
+ return this._add(path);
1722
+ }
1723
+
1724
+ // Create `circle` element
1725
+ ;
1726
+ _proto.createCircle = function createCircle(config, style, group) {
1727
+ var circle = new SVGShapeElement('circle', config, style);
1728
+ return this._add(circle, group);
1729
+ }
1730
+
1731
+ // Create `line` element
1732
+ ;
1733
+ _proto.createLine = function createLine(config, style, group) {
1734
+ var line = new SVGShapeElement('line', config, style);
1735
+ return this._add(line, group);
1736
+ }
1737
+
1738
+ // Create `text` element
1739
+ ;
1740
+ _proto.createText = function createText(config, style, group) {
1741
+ var text = new SVGTextElement(config, style);
1742
+ return this._add(text, group);
1743
+ }
1744
+
1745
+ // Create `image` element
1746
+ ;
1747
+ _proto.createImage = function createImage(config, style, group) {
1748
+ var image = new SVGImageElement(config, style);
1749
+ return this._add(image, group);
1750
+ }
1751
+
1752
+ // Create `g` element
1753
+ ;
1754
+ _proto.createGroup = function createGroup(id) {
1755
+ var group = new SVGElement('g');
1756
+ this.node.appendChild(group.node);
1757
+ if (id) {
1758
+ group.node.id = id;
1759
+ }
1760
+ group.canvas = this;
1761
+ return group;
1762
+ }
1763
+
1764
+ // Add some element to a spcific group or the root element if the group isn't given
1765
+ ;
1766
+ _proto._add = function _add(element, group) {
1767
+ group = group || this._rootElement;
1768
+ group.node.appendChild(element.node);
1769
+ return element;
1770
+ };
1771
+ return SVGCanvasElement;
1772
+ }(SVGElement);
1773
+
1774
+ /**
1775
+ * ------------------------------------------------------------------------
1776
+ * Class Definition
1777
+ * ------------------------------------------------------------------------
1778
+ */
1779
+ var Tooltip = /*#__PURE__*/function (_BaseComponent) {
1780
+ function Tooltip(map) {
1781
+ var _this;
1782
+ _this = _BaseComponent.call(this) || this;
1783
+ var tooltip = createElement('div', 'jvm-tooltip');
1784
+ _this._map = map;
1785
+ _this._tooltip = document.body.appendChild(tooltip);
1786
+ _this._bindEventListeners();
1787
+ return _this || _assertThisInitialized(_this);
1788
+ }
1789
+ _inheritsLoose(Tooltip, _BaseComponent);
1790
+ var _proto = Tooltip.prototype;
1791
+ _proto._bindEventListeners = function _bindEventListeners() {
1792
+ var _this2 = this;
1793
+ EventHandler.on(this._map.container, 'mousemove', function (event) {
1794
+ if (!_this2._tooltip.classList.contains('active')) {
1795
+ return;
1796
+ }
1797
+ var container = findElement(_this2._map.container, '#jvm-regions-group').getBoundingClientRect();
1798
+ var space = 5; // Space between the cursor and tooltip element
1799
+
1800
+ // Tooltip
1801
+ var _this2$_tooltip$getBo = _this2._tooltip.getBoundingClientRect(),
1802
+ height = _this2$_tooltip$getBo.height,
1803
+ width = _this2$_tooltip$getBo.width;
1804
+ var topIsPassed = event.clientY <= container.top + height + space;
1805
+ var top = event.pageY - height - space;
1806
+ var left = event.pageX - width - space;
1807
+
1808
+ // Ensure the tooltip will never cross outside the canvas area(map)
1809
+ if (topIsPassed) {
1810
+ // Top:
1811
+ top += height + space;
1812
+
1813
+ // The cursor is a bit larger from left side
1814
+ left -= space * 2;
1815
+ }
1816
+ if (event.clientX < container.left + width + space) {
1817
+ // Left:
1818
+ left = event.pageX + space + 2;
1819
+ if (topIsPassed) {
1820
+ left += space * 2;
1821
+ }
1822
+ }
1823
+ _this2.css({
1824
+ top: top + "px",
1825
+ left: left + "px"
1826
+ });
1827
+ });
1828
+ };
1829
+ _proto.getElement = function getElement() {
1830
+ return this._tooltip;
1831
+ };
1832
+ _proto.show = function show() {
1833
+ this._tooltip.classList.add('active');
1834
+ };
1835
+ _proto.hide = function hide() {
1836
+ this._tooltip.classList.remove('active');
1837
+ };
1838
+ _proto.text = function text(string, html) {
1839
+ if (html === void 0) {
1840
+ html = false;
1841
+ }
1842
+ var property = html ? 'innerHTML' : 'textContent';
1843
+ if (!string) {
1844
+ return this._tooltip[property];
1845
+ }
1846
+ this._tooltip[property] = string;
1847
+ };
1848
+ _proto.css = function css(_css) {
1849
+ for (var style in _css) {
1850
+ this._tooltip.style[style] = _css[style];
1851
+ }
1852
+ return this;
1853
+ };
1854
+ return Tooltip;
1855
+ }(BaseComponent);
1856
+
1857
+ var DataVisualization = /*#__PURE__*/function () {
1858
+ function DataVisualization(_ref, map) {
1859
+ var scale = _ref.scale,
1860
+ values = _ref.values;
1861
+ this._scale = scale;
1862
+ this._values = values;
1863
+ this._fromColor = this.hexToRgb(scale[0]);
1864
+ this._toColor = this.hexToRgb(scale[1]);
1865
+ this._map = map;
1866
+ this.setMinMaxValues(values);
1867
+ this.visualize();
1868
+ }
1869
+ var _proto = DataVisualization.prototype;
1870
+ _proto.setMinMaxValues = function setMinMaxValues(values) {
1871
+ this.min = Number.MAX_VALUE;
1872
+ this.max = 0;
1873
+ for (var value in values) {
1874
+ value = parseFloat(values[value]);
1875
+ if (value > this.max) {
1876
+ this.max = value;
1877
+ }
1878
+ if (value < this.min) {
1879
+ this.min = value;
1880
+ }
1881
+ }
1882
+ };
1883
+ _proto.visualize = function visualize() {
1884
+ var attrs = {},
1885
+ value;
1886
+ for (var regionCode in this._values) {
1887
+ value = parseFloat(this._values[regionCode]);
1888
+ if (!isNaN(value)) {
1889
+ attrs[regionCode] = this.getValue(value);
1890
+ }
1891
+ }
1892
+ this.setAttributes(attrs);
1893
+ };
1894
+ _proto.setAttributes = function setAttributes(attrs) {
1895
+ for (var code in attrs) {
1896
+ if (this._map.regions[code]) {
1897
+ this._map.regions[code].element.setStyle('fill', attrs[code]);
1898
+ }
1899
+ }
1900
+ };
1901
+ _proto.getValue = function getValue(value) {
1902
+ if (this.min === this.max) {
1903
+ return "#" + this._toColor.join('');
1904
+ }
1905
+ var hex,
1906
+ color = '#';
1907
+ for (var i = 0; i < 3; i++) {
1908
+ hex = Math.round(this._fromColor[i] + (this._toColor[i] - this._fromColor[i]) * ((value - this.min) / (this.max - this.min))).toString(16);
1909
+ color += (hex.length === 1 ? '0' : '') + hex;
1910
+ }
1911
+ return color;
1912
+ };
1913
+ _proto.hexToRgb = function hexToRgb(h) {
1914
+ var r = 0,
1915
+ g = 0,
1916
+ b = 0;
1917
+ if (h.length == 4) {
1918
+ r = '0x' + h[1] + h[1];
1919
+ g = '0x' + h[2] + h[2];
1920
+ b = '0x' + h[3] + h[3];
1921
+ } else if (h.length == 7) {
1922
+ r = '0x' + h[1] + h[2];
1923
+ g = '0x' + h[3] + h[4];
1924
+ b = '0x' + h[5] + h[6];
1925
+ }
1926
+ return [parseInt(r), parseInt(g), parseInt(b)];
1927
+ };
1928
+ return DataVisualization;
1929
+ }();
1930
+
1931
+ /**
1932
+ * ------------------------------------------------------------------------
1933
+ * Class Definition
1934
+ * ------------------------------------------------------------------------
1935
+ */
1936
+ var Map = /*#__PURE__*/function () {
1937
+ function Map(options) {
1938
+ var _this = this;
1939
+ if (options === void 0) {
1940
+ options = {};
1941
+ }
1942
+ // Merge the given options with the default options
1943
+ this.params = merge(Map.defaults, options, true);
1944
+
1945
+ // Throw an error if the given map name doesn't match
1946
+ // the map that was set in map file
1947
+ if (!Map.maps[this.params.map]) {
1948
+ throw new Error("Attempt to use map which was not loaded: " + options.map);
1949
+ }
1950
+ this.regions = {};
1951
+ this.scale = 1;
1952
+ this.transX = 0;
1953
+ this.transY = 0;
1954
+ this._mapData = Map.maps[this.params.map];
1955
+ this._markers = {};
1956
+ this._lines = {};
1957
+ this._defaultWidth = this._mapData.width;
1958
+ this._defaultHeight = this._mapData.height;
1959
+ this._height = 0;
1960
+ this._width = 0;
1961
+ this._baseScale = 1;
1962
+ this._baseTransX = 0;
1963
+ this._baseTransY = 0;
1964
+
1965
+ // `document` is already ready, just initialise now
1966
+ if (document.readyState !== 'loading') {
1967
+ this._init();
1968
+ } else {
1969
+ // Wait until `document` is ready
1970
+ window.addEventListener('DOMContentLoaded', function () {
1971
+ return _this._init();
1972
+ });
1973
+ }
1974
+ }
1975
+ var _proto = Map.prototype;
1976
+ _proto._init = function _init() {
1977
+ var options = this.params;
1978
+ this.container = getElement(options.selector);
1979
+ this.container.classList.add('jvm-container');
1980
+
1981
+ // The map canvas element
1982
+ this.canvas = new SVGCanvasElement(this.container);
1983
+
1984
+ // Set the map's background color
1985
+ this.setBackgroundColor(options.backgroundColor);
1986
+
1987
+ // Create regions
1988
+ this._createRegions();
1989
+
1990
+ // Update size
1991
+ this.updateSize();
1992
+
1993
+ // Create lines
1994
+ this._createLines(options.lines || {}, options.markers || {});
1995
+
1996
+ // Create markers
1997
+ this._createMarkers(options.markers);
1998
+
1999
+ // Position labels
2000
+ this._repositionLabels();
2001
+
2002
+ // Setup the container events
2003
+ this._setupContainerEvents();
2004
+
2005
+ // Setup regions/markers events
2006
+ this._setupElementEvents();
2007
+
2008
+ // Create zoom buttons if `zoomButtons` is presented
2009
+ if (options.zoomButtons) {
2010
+ this._setupZoomButtons();
2011
+ }
2012
+
2013
+ // Create toolip
2014
+ if (options.showTooltip) {
2015
+ this._tooltip = new Tooltip(this);
2016
+ }
2017
+
2018
+ // Set selected regions if any
2019
+ if (options.selectedRegions) {
2020
+ this._setSelected('regions', options.selectedRegions);
2021
+ }
2022
+
2023
+ // Set selected regions if any
2024
+ if (options.selectedMarkers) {
2025
+ this._setSelected('_markers', options.selectedMarkers);
2026
+ }
2027
+
2028
+ // Set focus on a spcific region
2029
+ if (options.focusOn) {
2030
+ this.setFocus(options.focusOn);
2031
+ }
2032
+
2033
+ // Data visualization
2034
+ if (options.visualizeData) {
2035
+ this.dataVisualization = new DataVisualization(options.visualizeData, this);
2036
+ }
2037
+
2038
+ // Bind touch events if true
2039
+ if (options.bindTouchEvents) {
2040
+ if ('ontouchstart' in window || window.DocumentTouch && document instanceof DocumentTouch) {
2041
+ this._setupContainerTouchEvents();
2042
+ }
2043
+ }
2044
+
2045
+ // Create series if any
2046
+ if (options.series) {
2047
+ this.container.appendChild(this.legendHorizontal = createElement('div', 'jvm-series-container jvm-series-h'));
2048
+ this.container.appendChild(this.legendVertical = createElement('div', 'jvm-series-container jvm-series-v'));
2049
+ this._createSeries();
2050
+ }
2051
+
2052
+ // Fire loaded event
2053
+ this._emit(Events.onLoaded, [this]);
2054
+ }
2055
+
2056
+ // Public
2057
+ ;
2058
+ _proto.setBackgroundColor = function setBackgroundColor(color) {
2059
+ this.container.style.backgroundColor = color;
2060
+ }
2061
+
2062
+ // Region methods
2063
+ ;
2064
+ _proto.getSelectedRegions = function getSelectedRegions() {
2065
+ return this._getSelected('regions');
2066
+ };
2067
+ _proto.clearSelectedRegions = function clearSelectedRegions(regions) {
2068
+ var _this2 = this;
2069
+ if (regions === void 0) {
2070
+ regions = undefined;
2071
+ }
2072
+ regions = this._normalizeRegions(regions) || this._getSelected('regions');
2073
+ regions.forEach(function (key) {
2074
+ _this2.regions[key].element.select(false);
2075
+ });
2076
+ };
2077
+ _proto.setSelectedRegions = function setSelectedRegions(regions) {
2078
+ this.clearSelectedRegions();
2079
+ this._setSelected('regions', this._normalizeRegions(regions));
2080
+ }
2081
+
2082
+ // Markers methods
2083
+ ;
2084
+ _proto.getSelectedMarkers = function getSelectedMarkers() {
2085
+ return this._getSelected('_markers');
2086
+ };
2087
+ _proto.clearSelectedMarkers = function clearSelectedMarkers() {
2088
+ this._clearSelected('_markers');
2089
+ };
2090
+ _proto.addMarkers = function addMarkers(config) {
2091
+ config = Array.isArray(config) ? config : [config];
2092
+ this._createMarkers(config, true);
2093
+ };
2094
+ _proto.removeMarkers = function removeMarkers(markers) {
2095
+ var _this3 = this;
2096
+ if (!markers) {
2097
+ markers = Object.keys(this._markers);
2098
+ }
2099
+ markers.forEach(function (index) {
2100
+ // Remove the element from the DOM
2101
+ _this3._markers[index].element.remove();
2102
+ // Remove the element from markers object
2103
+ delete _this3._markers[index];
2104
+ });
2105
+ };
2106
+ _proto.addLine = function addLine(from, to, style) {
2107
+ if (style === void 0) {
2108
+ style = {};
2109
+ }
2110
+ console.warn('`addLine` method is deprecated, please use `addLines` instead.');
2111
+ this._createLines([{
2112
+ from: from,
2113
+ to: to,
2114
+ style: style
2115
+ }], this._markers, true);
2116
+ };
2117
+ _proto.addLines = function addLines(config) {
2118
+ var uids = this._getLinesAsUids();
2119
+ if (!Array.isArray(config)) {
2120
+ config = [config];
2121
+ }
2122
+ this._createLines(config.filter(function (line) {
2123
+ return !(uids.indexOf(getLineUid(line.from, line.to)) > -1);
2124
+ }), this._markers, true);
2125
+ };
2126
+ _proto.removeLines = function removeLines(lines) {
2127
+ var _this4 = this;
2128
+ if (Array.isArray(lines)) {
2129
+ lines = lines.map(function (line) {
2130
+ return getLineUid(line.from, line.to);
2131
+ });
2132
+ } else {
2133
+ lines = this._getLinesAsUids();
2134
+ }
2135
+ lines.forEach(function (uid) {
2136
+ _this4._lines[uid].dispose();
2137
+ delete _this4._lines[uid];
2138
+ });
2139
+ };
2140
+ _proto.removeLine = function removeLine(from, to) {
2141
+ console.warn('`removeLine` method is deprecated, please use `removeLines` instead.');
2142
+ var uid = getLineUid(from, to);
2143
+ if (this._lines.hasOwnProperty(uid)) {
2144
+ this._lines[uid].element.remove();
2145
+ delete this._lines[uid];
2146
+ }
2147
+ }
2148
+
2149
+ // Reset map
2150
+ ;
2151
+ _proto.reset = function reset() {
2152
+ for (var key in this.series) {
2153
+ for (var i = 0; i < this.series[key].length; i++) {
2154
+ this.series[key][i].clear();
2155
+ }
2156
+ }
2157
+ if (this.legendHorizontal) {
2158
+ removeElement(this.legendHorizontal);
2159
+ this.legendHorizontal = null;
2160
+ }
2161
+ if (this.legendVertical) {
2162
+ removeElement(this.legendVertical);
2163
+ this.legendVertical = null;
2164
+ }
2165
+ this.scale = this._baseScale;
2166
+ this.transX = this._baseTransX;
2167
+ this.transY = this._baseTransY;
2168
+ this._applyTransform();
2169
+ this.clearSelectedMarkers();
2170
+ this.clearSelectedRegions();
2171
+ this.removeMarkers();
2172
+ }
2173
+
2174
+ // Destroy the map
2175
+ ;
2176
+ _proto.destroy = function destroy(destroyInstance) {
2177
+ var _this5 = this;
2178
+ if (destroyInstance === void 0) {
2179
+ destroyInstance = true;
2180
+ }
2181
+ // Remove event registry
2182
+ EventHandler.flush();
2183
+
2184
+ // Remove tooltip from DOM and memory
2185
+ this._tooltip.dispose();
2186
+
2187
+ // Fire destroyed event
2188
+ this._emit(Events.onDestroyed);
2189
+
2190
+ // Remove references
2191
+ if (destroyInstance) {
2192
+ Object.keys(this).forEach(function (key) {
2193
+ try {
2194
+ delete _this5[key];
2195
+ } catch (e) {}
2196
+ });
2197
+ }
2198
+ };
2199
+ _proto.extend = function extend(name, callback) {
2200
+ if (typeof this[name] === 'function') {
2201
+ throw new Error("The method [" + name + "] does already exist, please use another name.");
2202
+ }
2203
+ Map.prototype[name] = callback;
2204
+ }
2205
+
2206
+ // Private
2207
+ ;
2208
+ _proto._emit = function _emit(eventName, args) {
2209
+ for (var event in Events) {
2210
+ if (Events[event] === eventName && typeof this.params[event] === 'function') {
2211
+ this.params[event].apply(this, args);
2212
+ }
2213
+ }
2214
+ }
2215
+
2216
+ // Get selected markers/regions
2217
+ ;
2218
+ _proto._getSelected = function _getSelected(type) {
2219
+ var selected = [];
2220
+ for (var key in this[type]) {
2221
+ if (this[type][key].element.isSelected) {
2222
+ selected.push(key);
2223
+ }
2224
+ }
2225
+ return selected;
2226
+ };
2227
+ _proto._setSelected = function _setSelected(type, keys) {
2228
+ var _this6 = this;
2229
+ keys.forEach(function (key) {
2230
+ if (_this6[type][key]) {
2231
+ _this6[type][key].element.select(true);
2232
+ }
2233
+ });
2234
+ };
2235
+ _proto._clearSelected = function _clearSelected(type) {
2236
+ var _this7 = this;
2237
+ this._getSelected(type).forEach(function (key) {
2238
+ _this7[type][key].element.select(false);
2239
+ });
2240
+ };
2241
+ _proto._getLinesAsUids = function _getLinesAsUids() {
2242
+ return Object.keys(this._lines);
2243
+ };
2244
+ _proto._normalizeRegions = function _normalizeRegions(regions) {
2245
+ return typeof regions === 'string' ? [regions] : regions;
2246
+ };
2247
+ return Map;
2248
+ }();
2249
+ Map.maps = {};
2250
+ Map.defaults = Defaults;
2251
+ Object.assign(Map.prototype, core);
2252
+
2253
+ /**
2254
+ * jsVectorMap
2255
+ * Copyrights (c) Mustafa Omar https://github.com/themustafaomar
2256
+ * Released under the MIT License.
2257
+ */
2258
+
2259
+ /**
2260
+ * ------------------------------------------------------------------------
2261
+ * Class Definition
2262
+ * ------------------------------------------------------------------------
2263
+ */
2264
+ var jsVectorMap = /*#__PURE__*/function () {
2265
+ function jsVectorMap(options) {
2266
+ if (options === void 0) {
2267
+ options = {};
2268
+ }
2269
+ if (!options.selector) {
2270
+ throw new Error('Selector is not given.');
2271
+ }
2272
+ return new Map(options);
2273
+ }
2274
+
2275
+ // Public
2276
+ jsVectorMap.addMap = function addMap(name, map) {
2277
+ Map.maps[name] = map;
2278
+ };
2279
+ return jsVectorMap;
2280
+ }();
2281
+ var index = window.jsVectorMap = jsVectorMap;
2282
+
2283
+ return index;
2284
+
2285
+ }));