@nyaruka/temba-components 0.140.0 → 0.141.0

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 (284) hide show
  1. package/.lintstagedrc.js +10 -0
  2. package/CHANGELOG.md +15 -0
  3. package/dist/locales/es.js +5 -5
  4. package/dist/locales/es.js.map +1 -1
  5. package/dist/locales/fr.js +5 -5
  6. package/dist/locales/fr.js.map +1 -1
  7. package/dist/locales/locale-codes.js +11 -2
  8. package/dist/locales/locale-codes.js.map +1 -1
  9. package/dist/locales/pt.js +5 -5
  10. package/dist/locales/pt.js.map +1 -1
  11. package/dist/temba-components.js +189 -91
  12. package/dist/temba-components.js.map +1 -1
  13. package/out-tsc/src/display/FloatingTab.js +1 -1
  14. package/out-tsc/src/display/FloatingTab.js.map +1 -1
  15. package/out-tsc/src/flow/CanvasNode.js +1 -1
  16. package/out-tsc/src/flow/CanvasNode.js.map +1 -1
  17. package/out-tsc/src/flow/Editor.js +228 -42
  18. package/out-tsc/src/flow/Editor.js.map +1 -1
  19. package/out-tsc/src/flow/Plumber.js +61 -14
  20. package/out-tsc/src/flow/Plumber.js.map +1 -1
  21. package/out-tsc/src/flow/actions/add_contact_groups.js +4 -1
  22. package/out-tsc/src/flow/actions/add_contact_groups.js.map +1 -1
  23. package/out-tsc/src/flow/actions/add_input_labels.js +4 -1
  24. package/out-tsc/src/flow/actions/add_input_labels.js.map +1 -1
  25. package/out-tsc/src/flow/actions/remove_contact_groups.js +6 -1
  26. package/out-tsc/src/flow/actions/remove_contact_groups.js.map +1 -1
  27. package/out-tsc/src/flow/actions/send_broadcast.js +6 -2
  28. package/out-tsc/src/flow/actions/send_broadcast.js.map +1 -1
  29. package/out-tsc/src/flow/actions/set_contact_channel.js +13 -0
  30. package/out-tsc/src/flow/actions/set_contact_channel.js.map +1 -1
  31. package/out-tsc/src/flow/actions/set_contact_status.js +7 -5
  32. package/out-tsc/src/flow/actions/set_contact_status.js.map +1 -1
  33. package/out-tsc/src/flow/actions/start_session.js +10 -3
  34. package/out-tsc/src/flow/actions/start_session.js.map +1 -1
  35. package/out-tsc/src/flow/nodes/split_by_contact_field.js +18 -5
  36. package/out-tsc/src/flow/nodes/split_by_contact_field.js.map +1 -1
  37. package/out-tsc/src/flow/nodes/split_by_expression.js +1 -1
  38. package/out-tsc/src/flow/nodes/split_by_expression.js.map +1 -1
  39. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js +0 -1
  40. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js.map +1 -1
  41. package/out-tsc/src/flow/nodes/split_by_random.js +0 -1
  42. package/out-tsc/src/flow/nodes/split_by_random.js.map +1 -1
  43. package/out-tsc/src/flow/nodes/split_by_run_result.js +10 -4
  44. package/out-tsc/src/flow/nodes/split_by_run_result.js.map +1 -1
  45. package/out-tsc/src/flow/nodes/wait_for_digits.js +1 -1
  46. package/out-tsc/src/flow/nodes/wait_for_digits.js.map +1 -1
  47. package/out-tsc/src/flow/nodes/wait_for_response.js +1 -1
  48. package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
  49. package/out-tsc/src/form/FieldRenderer.js +7 -0
  50. package/out-tsc/src/form/FieldRenderer.js.map +1 -1
  51. package/out-tsc/src/layout/Dialog.js +0 -1
  52. package/out-tsc/src/layout/Dialog.js.map +1 -1
  53. package/out-tsc/src/layout/Modax.js +20 -2
  54. package/out-tsc/src/layout/Modax.js.map +1 -1
  55. package/out-tsc/src/list/ContentMenu.js +14 -1
  56. package/out-tsc/src/list/ContentMenu.js.map +1 -1
  57. package/out-tsc/src/live/TembaChart.js.map +1 -1
  58. package/out-tsc/src/locales/es.js +5 -5
  59. package/out-tsc/src/locales/es.js.map +1 -1
  60. package/out-tsc/src/locales/fr.js +5 -5
  61. package/out-tsc/src/locales/fr.js.map +1 -1
  62. package/out-tsc/src/locales/locale-codes.js +11 -2
  63. package/out-tsc/src/locales/locale-codes.js.map +1 -1
  64. package/out-tsc/src/locales/pt.js +5 -5
  65. package/out-tsc/src/locales/pt.js.map +1 -1
  66. package/out-tsc/src/simulator/Simulator.js +11 -0
  67. package/out-tsc/src/simulator/Simulator.js.map +1 -1
  68. package/out-tsc/src/store/AppState.js +13 -0
  69. package/out-tsc/src/store/AppState.js.map +1 -1
  70. package/out-tsc/test/actions/add_contact_groups.test.js +35 -0
  71. package/out-tsc/test/actions/add_contact_groups.test.js.map +1 -1
  72. package/out-tsc/test/actions/add_input_labels.test.js +53 -0
  73. package/out-tsc/test/actions/add_input_labels.test.js.map +1 -0
  74. package/out-tsc/test/actions/enter_flow.test.js +71 -0
  75. package/out-tsc/test/actions/enter_flow.test.js.map +1 -0
  76. package/out-tsc/test/actions/remove_contact_groups.test.js +24 -0
  77. package/out-tsc/test/actions/remove_contact_groups.test.js.map +1 -1
  78. package/out-tsc/test/actions/send_broadcast.test.js +41 -0
  79. package/out-tsc/test/actions/send_broadcast.test.js.map +1 -1
  80. package/out-tsc/test/actions/set_contact_channel.test.js +67 -0
  81. package/out-tsc/test/actions/set_contact_channel.test.js.map +1 -0
  82. package/out-tsc/test/actions/set_contact_field.test.js +52 -0
  83. package/out-tsc/test/actions/set_contact_field.test.js.map +1 -0
  84. package/out-tsc/test/actions/set_contact_language.test.js +39 -0
  85. package/out-tsc/test/actions/set_contact_language.test.js.map +1 -0
  86. package/out-tsc/test/actions/set_contact_name.test.js +28 -0
  87. package/out-tsc/test/actions/set_contact_name.test.js.map +1 -0
  88. package/out-tsc/test/actions/set_contact_status.test.js +44 -0
  89. package/out-tsc/test/actions/set_contact_status.test.js.map +1 -0
  90. package/out-tsc/test/actions/set_run_result.test.js +47 -0
  91. package/out-tsc/test/actions/set_run_result.test.js.map +1 -0
  92. package/out-tsc/test/actions/start_session.test.js +76 -0
  93. package/out-tsc/test/actions/start_session.test.js.map +1 -1
  94. package/out-tsc/test/nodes/split_by_contact_field.test.js +50 -0
  95. package/out-tsc/test/nodes/split_by_contact_field.test.js.map +1 -1
  96. package/out-tsc/test/nodes/split_by_run_result.test.js +82 -0
  97. package/out-tsc/test/nodes/split_by_run_result.test.js.map +1 -1
  98. package/out-tsc/test/nodes/split_by_ticket.test.js +139 -0
  99. package/out-tsc/test/nodes/split_by_ticket.test.js.map +1 -0
  100. package/out-tsc/test/nodes/split_by_webhook.test.js +111 -0
  101. package/out-tsc/test/nodes/split_by_webhook.test.js.map +1 -0
  102. package/out-tsc/test/temba-flow-editor.test.js +187 -0
  103. package/out-tsc/test/temba-flow-editor.test.js.map +1 -1
  104. package/out-tsc/test/temba-flow-plumber.test.js +19 -0
  105. package/out-tsc/test/temba-flow-plumber.test.js.map +1 -1
  106. package/out-tsc/test/temba-select.test.js +4 -1
  107. package/out-tsc/test/temba-select.test.js.map +1 -1
  108. package/out-tsc/test/utils.test.js +4 -2
  109. package/out-tsc/test/utils.test.js.map +1 -1
  110. package/package.json +3 -9
  111. package/screenshots/truth/actions/add_contact_groups/render/descriptive-group-names.png +0 -0
  112. package/screenshots/truth/actions/add_contact_groups/render/long-group-names.png +0 -0
  113. package/screenshots/truth/actions/add_contact_groups/render/many-groups.png +0 -0
  114. package/screenshots/truth/actions/add_contact_groups/render/multiple-groups.png +0 -0
  115. package/screenshots/truth/actions/add_contact_groups/render/single-group.png +0 -0
  116. package/screenshots/truth/actions/add_contact_urn/render/expression-facebook.png +0 -0
  117. package/screenshots/truth/actions/add_contact_urn/render/expression-phone.png +0 -0
  118. package/screenshots/truth/actions/add_contact_urn/render/facebook-id.png +0 -0
  119. package/screenshots/truth/actions/add_contact_urn/render/instagram-handle.png +0 -0
  120. package/screenshots/truth/actions/add_contact_urn/render/line-id.png +0 -0
  121. package/screenshots/truth/actions/add_contact_urn/render/phone-number.png +0 -0
  122. package/screenshots/truth/actions/add_contact_urn/render/telegram-id.png +0 -0
  123. package/screenshots/truth/actions/add_contact_urn/render/viber-id.png +0 -0
  124. package/screenshots/truth/actions/add_contact_urn/render/wechat-id.png +0 -0
  125. package/screenshots/truth/actions/add_contact_urn/render/whatsapp.png +0 -0
  126. package/screenshots/truth/actions/add_input_labels/editor/multiple-labels.png +0 -0
  127. package/screenshots/truth/actions/add_input_labels/editor/single-label.png +0 -0
  128. package/screenshots/truth/actions/add_input_labels/render/multiple-labels.png +0 -0
  129. package/screenshots/truth/actions/add_input_labels/render/single-label.png +0 -0
  130. package/screenshots/truth/actions/enter_flow/editor/basic-flow.png +0 -0
  131. package/screenshots/truth/actions/enter_flow/editor/long-flow-name.png +0 -0
  132. package/screenshots/truth/actions/enter_flow/render/basic-flow.png +0 -0
  133. package/screenshots/truth/actions/enter_flow/render/long-flow-name.png +0 -0
  134. package/screenshots/truth/actions/play_audio/render/expression-url.png +0 -0
  135. package/screenshots/truth/actions/play_audio/render/static-url.png +0 -0
  136. package/screenshots/truth/actions/remove_contact_groups/render/cleanup-groups.png +0 -0
  137. package/screenshots/truth/actions/remove_contact_groups/render/long-descriptive-group-names.png +0 -0
  138. package/screenshots/truth/actions/remove_contact_groups/render/many-groups.png +0 -0
  139. package/screenshots/truth/actions/remove_contact_groups/render/multiple-groups.png +0 -0
  140. package/screenshots/truth/actions/remove_contact_groups/render/remove-from-all-groups.png +0 -0
  141. package/screenshots/truth/actions/remove_contact_groups/render/single-group.png +0 -0
  142. package/screenshots/truth/actions/say_msg/render/multiline-text.png +0 -0
  143. package/screenshots/truth/actions/say_msg/render/simple-text.png +0 -0
  144. package/screenshots/truth/actions/say_msg/render/text-with-audio-url.png +0 -0
  145. package/screenshots/truth/actions/send_broadcast/render/contacts-only.png +0 -0
  146. package/screenshots/truth/actions/send_broadcast/render/groups-and-contacts.png +0 -0
  147. package/screenshots/truth/actions/send_broadcast/render/groups-only.png +0 -0
  148. package/screenshots/truth/actions/send_broadcast/render/many-groups.png +0 -0
  149. package/screenshots/truth/actions/send_broadcast/render/multiline-text.png +0 -0
  150. package/screenshots/truth/actions/send_email/render/complex-business-email.png +0 -0
  151. package/screenshots/truth/actions/send_email/render/empty-body.png +0 -0
  152. package/screenshots/truth/actions/send_email/render/empty-subject.png +0 -0
  153. package/screenshots/truth/actions/send_email/render/long-subject.png +0 -0
  154. package/screenshots/truth/actions/send_email/render/multiline-body.png +0 -0
  155. package/screenshots/truth/actions/send_email/render/multiple-recipients.png +0 -0
  156. package/screenshots/truth/actions/send_email/render/simple-email.png +0 -0
  157. package/screenshots/truth/actions/send_email/render/with-expressions.png +0 -0
  158. package/screenshots/truth/actions/send_msg/render/long-quick-replies.png +0 -0
  159. package/screenshots/truth/actions/send_msg/render/multiline-text-with-replies.png +0 -0
  160. package/screenshots/truth/actions/send_msg/render/simple-text.png +0 -0
  161. package/screenshots/truth/actions/send_msg/render/text-with-linebreaks.png +0 -0
  162. package/screenshots/truth/actions/send_msg/render/text-with-many-quick-replies.png +0 -0
  163. package/screenshots/truth/actions/send_msg/render/text-with-quick-replies.png +0 -0
  164. package/screenshots/truth/actions/send_msg/render/text-without-quick-replies.png +0 -0
  165. package/screenshots/truth/actions/set_contact_channel/editor/sms-channel.png +0 -0
  166. package/screenshots/truth/actions/set_contact_channel/editor/whatsapp-channel.png +0 -0
  167. package/screenshots/truth/actions/set_contact_channel/render/sms-channel.png +0 -0
  168. package/screenshots/truth/actions/set_contact_channel/render/whatsapp-channel.png +0 -0
  169. package/screenshots/truth/actions/set_contact_field/editor/clear-value.png +0 -0
  170. package/screenshots/truth/actions/set_contact_field/editor/set-value.png +0 -0
  171. package/screenshots/truth/actions/set_contact_field/render/clear-value.png +0 -0
  172. package/screenshots/truth/actions/set_contact_field/render/set-value.png +0 -0
  173. package/screenshots/truth/actions/set_contact_language/editor/english.png +0 -0
  174. package/screenshots/truth/actions/set_contact_language/editor/french.png +0 -0
  175. package/screenshots/truth/actions/set_contact_language/render/english.png +0 -0
  176. package/screenshots/truth/actions/set_contact_language/render/french.png +0 -0
  177. package/screenshots/truth/actions/set_contact_name/editor/expression-name.png +0 -0
  178. package/screenshots/truth/actions/set_contact_name/editor/static-name.png +0 -0
  179. package/screenshots/truth/actions/set_contact_name/render/expression-name.png +0 -0
  180. package/screenshots/truth/actions/set_contact_name/render/static-name.png +0 -0
  181. package/screenshots/truth/actions/set_contact_status/editor/active.png +0 -0
  182. package/screenshots/truth/actions/set_contact_status/editor/archived.png +0 -0
  183. package/screenshots/truth/actions/set_contact_status/editor/blocked.png +0 -0
  184. package/screenshots/truth/actions/set_contact_status/render/active.png +0 -0
  185. package/screenshots/truth/actions/set_contact_status/render/archived.png +0 -0
  186. package/screenshots/truth/actions/set_contact_status/render/blocked.png +0 -0
  187. package/screenshots/truth/actions/set_run_result/editor/expression-value.png +0 -0
  188. package/screenshots/truth/actions/set_run_result/editor/with-category.png +0 -0
  189. package/screenshots/truth/actions/set_run_result/render/expression-value.png +0 -0
  190. package/screenshots/truth/actions/set_run_result/render/with-category.png +0 -0
  191. package/screenshots/truth/actions/start_session/render/contact-query.png +0 -0
  192. package/screenshots/truth/actions/start_session/render/contacts-only.png +0 -0
  193. package/screenshots/truth/actions/start_session/render/create-contact.png +0 -0
  194. package/screenshots/truth/actions/start_session/render/groups-and-contacts.png +0 -0
  195. package/screenshots/truth/actions/start_session/render/groups-only.png +0 -0
  196. package/screenshots/truth/actions/start_session/render/many-recipients.png +0 -0
  197. package/screenshots/truth/editor/wait.png +0 -0
  198. package/screenshots/truth/nodes/split_by_llm/render/information-extraction.png +0 -0
  199. package/screenshots/truth/nodes/split_by_llm/render/sentiment-analysis.png +0 -0
  200. package/screenshots/truth/nodes/split_by_llm/render/summarization.png +0 -0
  201. package/screenshots/truth/nodes/split_by_llm/render/translation-task.png +0 -0
  202. package/screenshots/truth/nodes/split_by_llm_categorize/editor/basic-categorization.png +0 -0
  203. package/screenshots/truth/nodes/split_by_llm_categorize/editor/custom-input-and-result-name.png +0 -0
  204. package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
  205. package/screenshots/truth/nodes/split_by_llm_categorize/editor/many-categories.png +0 -0
  206. package/screenshots/truth/nodes/split_by_llm_categorize/editor/minimal-categories.png +0 -0
  207. package/screenshots/truth/nodes/split_by_llm_categorize/render/basic-categorization.png +0 -0
  208. package/screenshots/truth/nodes/split_by_llm_categorize/render/custom-input-and-result-name.png +0 -0
  209. package/screenshots/truth/nodes/split_by_llm_categorize/render/feedback-categorization.png +0 -0
  210. package/screenshots/truth/nodes/split_by_llm_categorize/render/many-categories.png +0 -0
  211. package/screenshots/truth/nodes/split_by_llm_categorize/render/minimal-categories.png +0 -0
  212. package/screenshots/truth/nodes/split_by_random/editor/ab-test-multiple-variants.png +0 -0
  213. package/screenshots/truth/nodes/split_by_random/editor/sampling-split.png +0 -0
  214. package/screenshots/truth/nodes/split_by_random/editor/three-way-split.png +0 -0
  215. package/screenshots/truth/nodes/split_by_random/editor/two-bucket-split.png +0 -0
  216. package/screenshots/truth/nodes/split_by_random/render/ab-test-multiple-variants.png +0 -0
  217. package/screenshots/truth/nodes/split_by_random/render/sampling-split.png +0 -0
  218. package/screenshots/truth/nodes/split_by_random/render/three-way-split.png +0 -0
  219. package/screenshots/truth/nodes/split_by_random/render/two-bucket-split.png +0 -0
  220. package/screenshots/truth/nodes/wait_for_audio/render/basic-audio-wait.png +0 -0
  221. package/screenshots/truth/nodes/wait_for_dial/render/basic-dial.png +0 -0
  222. package/screenshots/truth/nodes/wait_for_dial/render/dial-with-limits.png +0 -0
  223. package/screenshots/truth/nodes/wait_for_digits/editor/basic-digits-wait.png +0 -0
  224. package/screenshots/truth/nodes/wait_for_digits/editor/digits-with-rules.png +0 -0
  225. package/screenshots/truth/nodes/wait_for_digits/render/basic-digits-wait.png +0 -0
  226. package/screenshots/truth/nodes/wait_for_digits/render/digits-with-rules.png +0 -0
  227. package/screenshots/truth/nodes/wait_for_menu/render/menu-with-digits.png +0 -0
  228. package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
  229. package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
  230. package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
  231. package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
  232. package/screenshots/truth/nodes/wait_for_response/render/basic-wait.png +0 -0
  233. package/screenshots/truth/nodes/wait_for_response/render/custom-result-name.png +0 -0
  234. package/screenshots/truth/nodes/wait_for_response/render/no-timeout.png +0 -0
  235. package/screenshots/truth/nodes/wait_for_response/render/short-timeout.png +0 -0
  236. package/src/display/FloatingTab.ts +1 -1
  237. package/src/flow/CanvasNode.ts +1 -1
  238. package/src/flow/Editor.ts +285 -87
  239. package/src/flow/Plumber.ts +89 -14
  240. package/src/flow/actions/add_contact_groups.ts +4 -1
  241. package/src/flow/actions/add_input_labels.ts +4 -1
  242. package/src/flow/actions/remove_contact_groups.ts +6 -1
  243. package/src/flow/actions/send_broadcast.ts +6 -2
  244. package/src/flow/actions/set_contact_channel.ts +13 -1
  245. package/src/flow/actions/set_contact_status.ts +7 -5
  246. package/src/flow/actions/start_session.ts +10 -3
  247. package/src/flow/nodes/split_by_contact_field.ts +16 -5
  248. package/src/flow/nodes/split_by_expression.ts +1 -1
  249. package/src/flow/nodes/split_by_llm_categorize.ts +0 -1
  250. package/src/flow/nodes/split_by_random.ts +0 -1
  251. package/src/flow/nodes/split_by_run_result.ts +10 -4
  252. package/src/flow/nodes/wait_for_digits.ts +2 -1
  253. package/src/flow/nodes/wait_for_response.ts +1 -1
  254. package/src/form/FieldRenderer.ts +7 -0
  255. package/src/layout/Dialog.ts +0 -1
  256. package/src/layout/Modax.ts +19 -2
  257. package/src/list/ContentMenu.ts +15 -1
  258. package/src/live/TembaChart.ts +1 -1
  259. package/src/locales/es.ts +18 -13
  260. package/src/locales/fr.ts +18 -13
  261. package/src/locales/locale-codes.ts +11 -2
  262. package/src/locales/pt.ts +18 -13
  263. package/src/simulator/Simulator.ts +12 -0
  264. package/src/store/AppState.ts +15 -0
  265. package/test/actions/add_contact_groups.test.ts +38 -0
  266. package/test/actions/add_input_labels.test.ts +67 -0
  267. package/test/actions/enter_flow.test.ts +88 -0
  268. package/test/actions/remove_contact_groups.test.ts +29 -0
  269. package/test/actions/send_broadcast.test.ts +44 -0
  270. package/test/actions/set_contact_channel.test.ts +88 -0
  271. package/test/actions/set_contact_field.test.ts +68 -0
  272. package/test/actions/set_contact_language.test.ts +55 -0
  273. package/test/actions/set_contact_name.test.ts +39 -0
  274. package/test/actions/set_contact_status.test.ts +64 -0
  275. package/test/actions/set_run_result.test.ts +61 -0
  276. package/test/actions/start_session.test.ts +82 -0
  277. package/test/nodes/split_by_contact_field.test.ts +59 -0
  278. package/test/nodes/split_by_run_result.test.ts +100 -0
  279. package/test/nodes/split_by_ticket.test.ts +157 -0
  280. package/test/nodes/split_by_webhook.test.ts +131 -0
  281. package/test/temba-flow-editor.test.ts +240 -0
  282. package/test/temba-flow-plumber.test.ts +62 -0
  283. package/test/temba-select.test.ts +6 -1
  284. package/test/utils.test.ts +4 -2
@@ -9,7 +9,7 @@ const e=globalThis,i=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow
9
9
  * @license
10
10
  * Copyright 2017 Google LLC
11
11
  * SPDX-License-Identifier: BSD-3-Clause
12
- */,{is:d,defineProperty:c,getOwnPropertyDescriptor:h,getOwnPropertyNames:u,getOwnPropertySymbols:p,getPrototypeOf:m}=Object,g=globalThis,f=g.trustedTypes,v=f?f.emptyScript:"",b=g.reactiveElementPolyfillSupport,y=(t,e)=>t,x={toAttribute(t,e){switch(e){case Boolean:t=t?v:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},_=(t,e)=>!d(t,e),w={attribute:!0,type:String,converter:x,reflect:!1,hasChanged:_};Symbol.metadata??=Symbol("metadata"),g.litPropertyMetadata??=new WeakMap;class k extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=w){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),o=this.getPropertyDescriptor(t,i,e);void 0!==o&&c(this.prototype,t,o)}}static getPropertyDescriptor(t,e,i){const{get:o,set:n}=h(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return o?.call(this)},set(e){const s=o?.call(this);n.call(this,e),this.requestUpdate(t,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??w}static _$Ei(){if(this.hasOwnProperty(y("elementProperties")))return;const t=m(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(y("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(y("properties"))){const t=this.properties,e=[...u(t),...p(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,o)=>{if(i)t.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of o){const o=document.createElement("style"),n=e.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=i.cssText,t.appendChild(o)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EC(t,e){const i=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,i);if(void 0!==o&&!0===i.reflect){const n=(void 0!==i.converter?.toAttribute?i.converter:x).toAttribute(e,i.type);this._$Em=t,null==n?this.removeAttribute(o):this.setAttribute(o,n),this._$Em=null}}_$AK(t,e){const i=this.constructor,o=i._$Eh.get(t);if(void 0!==o&&this._$Em!==o){const t=i.getPropertyOptions(o),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:x;this._$Em=o,this[o]=n.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??_)(this[t],e))return;this.P(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(t,e,i){this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t)!0!==i.wrapped||this._$AL.has(e)||void 0===this[e]||this.P(e,this[e],i)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EU()}catch(e){throw t=!1,this._$EU(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU()}updated(t){}firstUpdated(t){}}k.elementStyles=[],k.shadowRootOptions={mode:"open"},k[y("elementProperties")]=new Map,k[y("finalized")]=new Map,b?.({ReactiveElement:k}),(g.reactiveElementVersions??=[]).push("2.0.4");
12
+ */,{is:d,defineProperty:c,getOwnPropertyDescriptor:h,getOwnPropertyNames:u,getOwnPropertySymbols:p,getPrototypeOf:m}=Object,g=globalThis,f=g.trustedTypes,v=f?f.emptyScript:"",y=g.reactiveElementPolyfillSupport,b=(t,e)=>t,x={toAttribute(t,e){switch(e){case Boolean:t=t?v:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},_=(t,e)=>!d(t,e),w={attribute:!0,type:String,converter:x,reflect:!1,hasChanged:_};Symbol.metadata??=Symbol("metadata"),g.litPropertyMetadata??=new WeakMap;class k extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=w){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),o=this.getPropertyDescriptor(t,i,e);void 0!==o&&c(this.prototype,t,o)}}static getPropertyDescriptor(t,e,i){const{get:o,set:n}=h(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return o?.call(this)},set(e){const s=o?.call(this);n.call(this,e),this.requestUpdate(t,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??w}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const t=m(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const t=this.properties,e=[...u(t),...p(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,o)=>{if(i)t.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of o){const o=document.createElement("style"),n=e.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=i.cssText,t.appendChild(o)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EC(t,e){const i=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,i);if(void 0!==o&&!0===i.reflect){const n=(void 0!==i.converter?.toAttribute?i.converter:x).toAttribute(e,i.type);this._$Em=t,null==n?this.removeAttribute(o):this.setAttribute(o,n),this._$Em=null}}_$AK(t,e){const i=this.constructor,o=i._$Eh.get(t);if(void 0!==o&&this._$Em!==o){const t=i.getPropertyOptions(o),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:x;this._$Em=o,this[o]=n.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??_)(this[t],e))return;this.P(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(t,e,i){this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t)!0!==i.wrapped||this._$AL.has(e)||void 0===this[e]||this.P(e,this[e],i)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EU()}catch(e){throw t=!1,this._$EU(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU()}updated(t){}firstUpdated(t){}}k.elementStyles=[],k.shadowRootOptions={mode:"open"},k[b("elementProperties")]=new Map,k[b("finalized")]=new Map,y?.({ReactiveElement:k}),(g.reactiveElementVersions??=[]).push("2.0.4");
13
13
  /**
14
14
  * @license
15
15
  * Copyright 2017 Google LLC
@@ -37,7 +37,7 @@ const ht=t=>(e,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(t,e)
37
37
  * @license
38
38
  * Copyright 2017 Google LLC
39
39
  * SPDX-License-Identifier: BSD-3-Clause
40
- */}function gt(t){return mt({...t,state:!0,attribute:!1})}var ft,vt,bt,yt,xt,_t,wt,kt,Ct,St,At,Et,$t,Tt,Dt,Mt,It,Ot,Lt=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},zt=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};const Pt=function(t){var e=0;t+="x";var i=Math.floor(65745979961613.07);for(let o=0;o<t.length;o++)e>i&&(e=Math.floor(e/137)),e=131*e+t.charCodeAt(o);return e},Rt="0123456789abcdef".split(""),Nt=[-2147483648,8388608,32768,128],Bt=[24,16,8,0],Ft=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],qt=[];class Ut{constructor(t=!1,e=!1){ft.set(this,void 0),vt.set(this,void 0),bt.set(this,void 0),yt.set(this,void 0),xt.set(this,void 0),_t.set(this,void 0),wt.set(this,void 0),kt.set(this,void 0),Ct.set(this,void 0),St.set(this,void 0),At.set(this,void 0),Et.set(this,void 0),$t.set(this,void 0),Tt.set(this,void 0),Dt.set(this,void 0),Mt.set(this,void 0),It.set(this,0),Ot.set(this,void 0),this.init(t,e)}init(t,e){e?(qt[0]=qt[16]=qt[1]=qt[2]=qt[3]=qt[4]=qt[5]=qt[6]=qt[7]=qt[8]=qt[9]=qt[10]=qt[11]=qt[12]=qt[13]=qt[14]=qt[15]=0,Lt(this,vt,qt)):Lt(this,vt,[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),t?(Lt(this,_t,3238371032),Lt(this,wt,914150663),Lt(this,kt,812702999),Lt(this,Ct,4144912697),Lt(this,St,4290775857),Lt(this,At,1750603025),Lt(this,Et,1694076839),Lt(this,$t,3204075428)):(Lt(this,_t,1779033703),Lt(this,wt,3144134277),Lt(this,kt,1013904242),Lt(this,Ct,2773480762),Lt(this,St,1359893119),Lt(this,At,2600822924),Lt(this,Et,528734635),Lt(this,$t,1541459225)),Lt(this,ft,Lt(this,Ot,Lt(this,bt,Lt(this,Dt,0)))),Lt(this,yt,Lt(this,Tt,!1)),Lt(this,xt,!0),Lt(this,Mt,t)}update(t){if(zt(this,yt))return this;let e;e=t instanceof ArrayBuffer?new Uint8Array(t):t;let i=0;const o=e.length,n=zt(this,vt);for(;i<o;){let t;if(zt(this,Tt)&&(Lt(this,Tt,!1),n[0]=zt(this,ft),n[16]=n[1]=n[2]=n[3]=n[4]=n[5]=n[6]=n[7]=n[8]=n[9]=n[10]=n[11]=n[12]=n[13]=n[14]=n[15]=0),"string"!=typeof e)for(t=zt(this,Ot);i<o&&t<64;++i)n[t>>2]|=e[i]<<Bt[3&t++];else for(t=zt(this,Ot);i<o&&t<64;++i){let o=e.charCodeAt(i);o<128?n[t>>2]|=o<<Bt[3&t++]:o<2048?(n[t>>2]|=(192|o>>6)<<Bt[3&t++],n[t>>2]|=(128|63&o)<<Bt[3&t++]):o<55296||o>=57344?(n[t>>2]|=(224|o>>12)<<Bt[3&t++],n[t>>2]|=(128|o>>6&63)<<Bt[3&t++],n[t>>2]|=(128|63&o)<<Bt[3&t++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++i)),n[t>>2]|=(240|o>>18)<<Bt[3&t++],n[t>>2]|=(128|o>>12&63)<<Bt[3&t++],n[t>>2]|=(128|o>>6&63)<<Bt[3&t++],n[t>>2]|=(128|63&o)<<Bt[3&t++])}Lt(this,It,t),Lt(this,bt,zt(this,bt)+(t-zt(this,Ot))),t>=64?(Lt(this,ft,n[16]),Lt(this,Ot,t-64),this.hash(),Lt(this,Tt,!0)):Lt(this,Ot,t)}return zt(this,bt)>4294967295&&(Lt(this,Dt,zt(this,Dt)+(zt(this,bt)/4294967296|0)),Lt(this,bt,zt(this,bt)%4294967296)),this}finalize(){if(zt(this,yt))return;Lt(this,yt,!0);const t=zt(this,vt),e=zt(this,It);t[16]=zt(this,ft),t[e>>2]|=Nt[3&e],Lt(this,ft,t[16]),e>=56&&(zt(this,Tt)||this.hash(),t[0]=zt(this,ft),t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=zt(this,Dt)<<3|zt(this,bt)>>>29,t[15]=zt(this,bt)<<3,this.hash()}hash(){let t=zt(this,_t),e=zt(this,wt),i=zt(this,kt),o=zt(this,Ct),n=zt(this,St),s=zt(this,At),r=zt(this,Et),a=zt(this,$t);const l=zt(this,vt);let d,c,h,u,p,m,g,f,v,b;for(let t=16;t<64;++t)u=l[t-15],d=(u>>>7|u<<25)^(u>>>18|u<<14)^u>>>3,u=l[t-2],c=(u>>>17|u<<15)^(u>>>19|u<<13)^u>>>10,l[t]=l[t-16]+d+l[t-7]+c|0;b=e&i;for(let y=0;y<64;y+=4)zt(this,xt)?(zt(this,Mt)?(g=300032,u=l[0]-1413257819,a=u-150054599|0,o=u+24177077|0):(g=704751109,u=l[0]-210244248,a=u-1521486534|0,o=u+143694565|0),Lt(this,xt,!1)):(d=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),c=(n>>>6|n<<26)^(n>>>11|n<<21)^(n>>>25|n<<7),g=t&e,h=g^t&i^b,m=n&s^~n&r,u=a+c+m+Ft[y]+l[y],p=d+h,a=o+u|0,o=u+p|0),d=(o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10),c=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),f=o&t,h=f^o&e^g,m=a&n^~a&s,u=r+c+m+Ft[y+1]+l[y+1],p=d+h,r=i+u|0,i=u+p|0,d=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10),c=(r>>>6|r<<26)^(r>>>11|r<<21)^(r>>>25|r<<7),v=i&o,h=v^i&t^f,m=r&a^~r&n,u=s+c+m+Ft[y+2]+l[y+2],p=d+h,s=e+u|0,e=u+p|0,d=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),c=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),b=e&i,h=b^e&o^v,m=s&r^~s&a,u=n+c+m+Ft[y+3]+l[y+3],p=d+h,n=t+u|0,t=u+p|0;Lt(this,_t,zt(this,_t)+t|0),Lt(this,wt,zt(this,wt)+e|0),Lt(this,kt,zt(this,kt)+i|0),Lt(this,Ct,zt(this,Ct)+o|0),Lt(this,St,zt(this,St)+n|0),Lt(this,At,zt(this,At)+s|0),Lt(this,Et,zt(this,Et)+r|0),Lt(this,$t,zt(this,$t)+a|0)}hex(){this.finalize();const t=zt(this,_t),e=zt(this,wt),i=zt(this,kt),o=zt(this,Ct),n=zt(this,St),s=zt(this,At),r=zt(this,Et),a=zt(this,$t);let l=Rt[t>>28&15]+Rt[t>>24&15]+Rt[t>>20&15]+Rt[t>>16&15]+Rt[t>>12&15]+Rt[t>>8&15]+Rt[t>>4&15]+Rt[15&t]+Rt[e>>28&15]+Rt[e>>24&15]+Rt[e>>20&15]+Rt[e>>16&15]+Rt[e>>12&15]+Rt[e>>8&15]+Rt[e>>4&15]+Rt[15&e]+Rt[i>>28&15]+Rt[i>>24&15]+Rt[i>>20&15]+Rt[i>>16&15]+Rt[i>>12&15]+Rt[i>>8&15]+Rt[i>>4&15]+Rt[15&i]+Rt[o>>28&15]+Rt[o>>24&15]+Rt[o>>20&15]+Rt[o>>16&15]+Rt[o>>12&15]+Rt[o>>8&15]+Rt[o>>4&15]+Rt[15&o]+Rt[n>>28&15]+Rt[n>>24&15]+Rt[n>>20&15]+Rt[n>>16&15]+Rt[n>>12&15]+Rt[n>>8&15]+Rt[n>>4&15]+Rt[15&n]+Rt[s>>28&15]+Rt[s>>24&15]+Rt[s>>20&15]+Rt[s>>16&15]+Rt[s>>12&15]+Rt[s>>8&15]+Rt[s>>4&15]+Rt[15&s]+Rt[r>>28&15]+Rt[r>>24&15]+Rt[r>>20&15]+Rt[r>>16&15]+Rt[r>>12&15]+Rt[r>>8&15]+Rt[r>>4&15]+Rt[15&r];return zt(this,Mt)||(l+=Rt[a>>28&15]+Rt[a>>24&15]+Rt[a>>20&15]+Rt[a>>16&15]+Rt[a>>12&15]+Rt[a>>8&15]+Rt[a>>4&15]+Rt[15&a]),l}toString(){return this.hex()}digest(){this.finalize();const t=zt(this,_t),e=zt(this,wt),i=zt(this,kt),o=zt(this,Ct),n=zt(this,St),s=zt(this,At),r=zt(this,Et),a=zt(this,$t),l=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,n>>24&255,n>>16&255,n>>8&255,255&n,s>>24&255,s>>16&255,s>>8&255,255&s,r>>24&255,r>>16&255,r>>8&255,255&r];return zt(this,Mt)||l.push(a>>24&255,a>>16&255,a>>8&255,255&a),l}array(){return this.digest()}arrayBuffer(){this.finalize();const t=new ArrayBuffer(zt(this,Mt)?28:32),e=new DataView(t);return e.setUint32(0,zt(this,_t)),e.setUint32(4,zt(this,wt)),e.setUint32(8,zt(this,kt)),e.setUint32(12,zt(this,Ct)),e.setUint32(16,zt(this,St)),e.setUint32(20,zt(this,At)),e.setUint32(24,zt(this,Et)),zt(this,Mt)||e.setUint32(28,zt(this,$t)),t}}function jt(t){const e=new Ut;return e.update(t),parseInt(e.hex().substring(0,8),16)}ft=new WeakMap,vt=new WeakMap,bt=new WeakMap,yt=new WeakMap,xt=new WeakMap,_t=new WeakMap,wt=new WeakMap,kt=new WeakMap,Ct=new WeakMap,St=new WeakMap,At=new WeakMap,Et=new WeakMap,$t=new WeakMap,Tt=new WeakMap,Dt=new WeakMap,Mt=new WeakMap,It=new WeakMap,Ot=new WeakMap;const Vt=function(t,e,i){var o=i<.5?i*(1+e):i+e-i*e,n=2*i-o;return[(t/=360)+1/3,t,t-1/3].map((function(t){return t<0&&t++,t>1&&t--,t=t<1/6?n+6*(o-n)*t:t<.5?o:t<2/3?n+6*(o-n)*(2/3-t):n,Math.round(255*t)}))};const Ht=[];for(let t=0;t<256;++t)Ht.push((t+256).toString(16).slice(1));function Wt(t,e=0){return(Ht[t[e+0]]+Ht[t[e+1]]+Ht[t[e+2]]+Ht[t[e+3]]+"-"+Ht[t[e+4]]+Ht[t[e+5]]+"-"+Ht[t[e+6]]+Ht[t[e+7]]+"-"+Ht[t[e+8]]+Ht[t[e+9]]+"-"+Ht[t[e+10]]+Ht[t[e+11]]+Ht[t[e+12]]+Ht[t[e+13]]+Ht[t[e+14]]+Ht[t[e+15]]).toLowerCase()}let Zt;const Yt=new Uint8Array(16);function Gt(){if(!Zt){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Zt=crypto.getRandomValues.bind(crypto)}return Zt(Yt)}var Kt={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Xt(t,e,i){if(Kt.randomUUID&&!e&&!t)return Kt.randomUUID();const o=(t=t||{}).random??t.rng?.()??Gt();if(o.length<16)throw new Error("Random bytes length must be >= 16");if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e){if((i=i||0)<0||i+16>e.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);for(let t=0;t<16;++t)e[i+t]=o[t];return e}return Wt(o)}const Qt={};function Jt(t,e,i){let o;if(t)o=te(t.random??t.rng?.()??Gt(),t.msecs,t.seq,e,i);else{const t=Date.now(),n=Gt();!function(t,e,i){t.msecs??=-1/0,t.seq??=0,e>t.msecs?(t.seq=i[6]<<23|i[7]<<16|i[8]<<8|i[9],t.msecs=e):(t.seq=t.seq+1|0,0===t.seq&&t.msecs++)}(Qt,t,n),o=te(n,Qt.msecs,Qt.seq,e,i)}return e??Wt(o)}function te(t,e,i,o,n=0){if(t.length<16)throw new Error("Random bytes length must be >= 16");if(o){if(n<0||n+16>o.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`)}else o=new Uint8Array(16),n=0;return e??=Date.now(),i??=127*t[6]<<24|t[7]<<16|t[8]<<8|t[9],o[n++]=e/1099511627776&255,o[n++]=e/4294967296&255,o[n++]=e/16777216&255,o[n++]=e/65536&255,o[n++]=e/256&255,o[n++]=255&e,o[n++]=112|i>>>28&15,o[n++]=i>>>20&255,o[n++]=128|i>>>14&63,o[n++]=i>>>6&255,o[n++]=i<<2&255|3&t[10],o[n++]=t[11],o[n++]=t[12],o[n++]=t[13],o[n++]=t[14],o[n++]=t[15],o}const ee="/api/v2/media.json",ie=new class{constructor(t={}){const[e,i]=[t.lightness,t.saturation].map((function(t){return t=void 0!==t?t:[.35,.5,.65],Array.isArray(t)?t.concat():[t]}));this.L=e,this.S=i,"number"==typeof t.hue&&(t.hue={min:t.hue,max:t.hue}),"object"!=typeof t.hue||Array.isArray(t.hue)||(t.hue=[t.hue]),void 0===t.hue&&(t.hue=[]),this.hueRanges=t.hue.map((function(t){return{min:void 0===t.min?0:t.min,max:void 0===t.max?360:t.max}})),this.hash=jt,"function"==typeof t.hash&&(this.hash=t.hash),"bkdr"===t.hash&&(this.hash=Pt)}hsl(t){var e,i,o=this.hash(t);if(this.hueRanges.length){const t=this.hueRanges[o%this.hueRanges.length];e=o/this.hueRanges.length%727*(t.max-t.min)/727+t.min}else e=o%359;return o=Math.ceil(o/360),i=this.S[o%this.S.length],o=Math.ceil(o/this.S.length),[e,i,this.L[o%this.L.length]]}rgb(t){var e=this.hsl(t);return Vt.apply(this,e)}hex(t){return function(t){var e="#";return t.forEach((function(t){t<16&&(e+=0),e+=t.toString(16)})),e}(this.rgb(t))}};var oe;!function(t){t.BLUE="color:#5078b5;",t.GREEN="color:#62bd6a;",t.RED="color:#e36049;",t.PURPLE="color:#a626a4;"}(oe||(oe={}));const ne=(t,e="",i=[])=>{""!==e?"object"!=typeof t?console.log("%c"+t,e,...i):console.log("%c"+JSON.stringify(t,null,2),e):console.log(t)},se=(t={})=>{var e;let i=(t=>{for(const e of document.cookie.split(";")){const i=e.indexOf("=");let o=e.substr(0,i),n=e.substr(i+1);if(o=o.trim(),n=n.trim(),o===t)return n}return null})("csrftoken");if(!i){const t=document.querySelector("[name=csrfmiddlewaretoken]");t&&(i=t.value)}const o=i?{"X-CSRFToken":i}:{},n=null===(e=window.workspace)||void 0===e?void 0:e.uuid;return n&&(o["X-Temba-Workspace"]=n),o["X-Requested-With"]="XMLHttpRequest",Object.keys(t).forEach((e=>{"X-Temba-Service-Org"===e&&delete o["X-Temba-Workspace"],o[e]=t[e]})),o},re=(t,e=null,i={})=>new Promise(((o,n)=>{const s={method:"GET",headers:se(i)};e&&(s.signal=e.signal),fetch(t,s).then((t=>{t.status<200||t.status>=300?n(t):t.text().then((i=>{let n={};try{n=JSON.parse(i)}catch(t){}o({controller:e,body:i,json:n,url:t.url,headers:t.headers,status:t.status})}))})).catch((t=>{n(t)}))})),ae=t=>{const e=[];Object.keys(t).forEach((i=>{t[i]&&e.push(i)}));let i=e.join(" ");return i.trim().length>0&&(i=" "+i),i.trim()},le=(t,e=null,i={})=>new Promise(((o,n)=>{re(t,e,i).then((t=>{o({results:t.json.results,next:t.json.next})})).catch((t=>n(t)))})),de=async(t,e={})=>{if(!t)return new Promise((t=>t([])));let i=[],o=t;for(;o;){const t=await le(o,null,e);t.results&&(i=i.concat(t.results)),o=t.next}return i},ce=t=>new Promise(((e,i)=>{re(t).then((t=>{t.status>=200&&t.status<300?e({assets:t.json.results,next:t.json.next}):i(t)})).catch((t=>i(t)))})),he=async t=>{if(!t)return new Promise((t=>t([])));let e=[],i=t;for(;i;){const t=await ce(i);t.assets?(e=e.concat(t.assets),i=t.next):i=null}return e},ue=(t,e,i={},o=null)=>{const n=se(i);o&&(n["Content-Type"]=o);const s={method:"POST",headers:n,body:e};return new Promise(((e,i)=>{fetch(t,s).then((async t=>{if(t.status>=500)return void i(t);const o=t.headers.get("X-Temba-Toasts");if(o){const t=document.querySelector("temba-toast");t&&t.addMessages(JSON.parse(o))}t.text().then((i=>{let o={};try{o=JSON.parse(i)}catch(t){}e({body:i,json:o,headers:t.headers,status:t.status,redirected:t.redirected,url:t.url})}))})).catch((t=>{i(t)}))}))},pe=(t,e)=>ue(t,JSON.stringify(e),!1,"application/json"),me=(t,e,i={})=>new Promise(((o,n)=>{ue(t,e,i).then((e=>{e.status>=200&&e.status<400?o(e):n(t===ee?e:"Server failure")})).catch((t=>{n(t)}))})),ge=t=>{const e=t.parentNode||t.host;if(e){const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY,i=t&&!(t.includes("hidden")||t.includes("visible"));return e?i&&e.scrollHeight>=e.clientHeight?e:ge(e):null}return null},fe=(t,e,i=!1)=>{let o;return function(...n){const s=this,r=i&&!o;clearTimeout(o),o=setTimeout((function(){o=null,i||t.apply(s,n)}),e),r&&t.apply(s,n)}},ve=(t,e)=>{let i=!0;return function(...o){i&&(i=!1,t.apply(this,o),setTimeout((()=>{i=!0}),e))}},be=(t,e,i="and")=>((t,e="and")=>{if(0===t.length)return"";if(1===t.length)return t[0];if(2===t.length)return"object"==typeof t[0]?H`${t[0]} ${e} ${t[1]}`:t.join(" "+e+" ");if("object"==typeof t[0])return t.map(((i,o)=>o<t.length-1?H`${i}, `:H`${e} ${i}`));const i=t.slice(0,-1),o=t[t.length-1];return i.join(", ")+", "+e+" "+o})(t.map(e),i),ye=(t,e,i=void 0)=>{if(!i){const t=document.location.pathname;i=t.substring(0,t.indexOf("/",1))}const o=new Date;o.setTime(o.getTime()+2592e6),document.cookie=`${t}=${e};expires=${o.toUTCString()};path=${i}`},xe=t=>{let e=null;if(document.cookie&&""!=document.cookie){const i=document.cookie.split(";");for(let o=0;o<i.length;o++){const n=i[o].trim();if(n.substring(0,t.length+1)==t+"="){e=decodeURIComponent(n.substring(t.length+1));break}}}return e};function _e(t,e){return(i,o)=>{mt()(i,o);const n="connectedCallback",s="updated",r=i[n],a=i[s];i[n]=function(){const i=xe(t);null!==i?this[o]="true"===i||"false"!==i&&i:void 0!==e&&(this[o]=e),r&&r.call(this)},i[s]=function(e){e.has(o)&&ye(t,this[o]),a&&a.call(this,e)}}}var we;!function(t){t.SETTINGS="settings",t.MENU_COLLAPSED="menu-collapsed",t.TICKET_SHOW_DETAILS="tickets.show-details"}(we||(we={}));const ke=([t,...e],i=navigator.language)=>void 0===t?"":t.toLocaleUpperCase(i)+e.join(""),Ce=t=>{let e=(t=t.trim()).match(/(([\p{L}\p{N}]+-[\p{L}\p{N}]+)|([\p{L}\p{N}]+))/gu)||[];if(1==e.length&&(e=t.match(/[\p{L}\p{N}]+/gu)),0==e.length)return"?";if(1==e.length)return e[0].substring(0,2).toUpperCase();const i=e.map((t=>t.substring(0,1))),o=i.filter(((t,e)=>t==t.toUpperCase()||0==e));return o.length>=2?(o[0]+o[1]).toUpperCase():(i[0]+i[1]).toUpperCase()},Se=(t,e,i)=>{i/=100;const o=e*Math.min(i,1-i)/100,n=e=>{const n=(e+t/30)%12,s=i-o*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*s).toString(16).padStart(2,"0")};return`#${n(0)}${n(8)}${n(4)}`},Ae=(t,e)=>{const i=t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([0-9.]+))?\)/);if(i){let[t,o,n,s]=i.slice(1).map(((t,e)=>e<3?parseInt(t):parseFloat(t)));return t=Math.max(0,Math.floor(t*(1-e))),o=Math.max(0,Math.floor(o*(1-e))),n=Math.max(0,Math.floor(n*(1-e))),void 0!==i[4]?`rgba(${t},${o},${n},${s})`:`rgb(${t},${o},${n})`}if(t.startsWith("#")){let i=t.replace("#","");3===i.length&&(i=i.split("").map((t=>t+t)).join(""));const o=parseInt(i,16);let n=o>>16&255,s=o>>8&255,r=255&o;return n=Math.max(0,Math.floor(n*(1-e))),s=Math.max(0,Math.floor(s*(1-e))),r=Math.max(0,Math.floor(r*(1-e))),`rgb(${n},${s},${r})`}return t},Ee=(t,e)=>t.left+t.width/2-e.width/2,$e=(t,e)=>t.top+t.height/2-e.height/2,Te=t=>{const{name:e,existingCategories:i,existingExits:o,existingCases:n,caseConfig:s}=t,r=i.find((t=>t.name===e)),a=r?o.find((t=>t.uuid===r.exit_uuid)):null,l=r&&n?n.find((t=>t.category_uuid===r.uuid)):null,d=(null==r?void 0:r.uuid)||Xt(),c=(null==a?void 0:a.uuid)||Xt(),h=(null==l?void 0:l.uuid)||Xt(),u={category:{uuid:d,name:e,exit_uuid:c},exit:{uuid:c,destination_uuid:(null==a?void 0:a.destination_uuid)||null}};return s&&(u.case={uuid:h,type:s.type,arguments:s.arguments,category_uuid:d}),u},De=(t,e,i=[],o=[],n=[])=>{const s=Te({name:"Success",existingCategories:i,existingExits:o,existingCases:n,caseConfig:e}),r=Te({name:"Failure",existingCategories:i,existingExits:o});return{router:{type:"switch",categories:[s.category,r.category],default_category_uuid:r.category.uuid,operand:t,cases:s.case?[s.case]:[]},exits:[s.exit,r.exit]}},Me=t=>["No Response","Other","All Responses","Timeout"].includes(t),Ie=(t,e)=>{const i=e.find((e=>e.uuid===t));return!!i&&Me(i.name)},Oe=(t,e,i,o)=>{const n=e(t);if(!n)return"";if(0===n.operands)return n.categoryName||"";const s=(i||"").trim(),r=(o||"").trim(),a=t=>t?t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():"";switch(t){case"has_any_word":case"has_all_words":case"has_phrase":case"has_only_phrase":case"has_beginning":default:return s?a(s):"";case"has_pattern":return s;case"has_number_eq":return s?`= ${s}`:"";case"has_number_lt":return s?`< ${s}`:"";case"has_number_lte":return s?`≤ ${s}`:"";case"has_number_gt":return s?`> ${s}`:"";case"has_number_gte":return s?`≥ ${s}`:"";case"has_number_between":return s&&r?`${s} - ${r}`:"";case"has_date_lt":case"has_date_lte":if(s){const t=s.match(/^(today)\s*([+-])\s*(\d+)$/i);if(t){const[,e,i,o]=t;return`Before ${e} ${i} ${o} ${"1"===o?"day":"days"}`}return`Before ${s}`}return"";case"has_date_gt":case"has_date_gte":if(s){const t=s.match(/^(today)\s*([+-])\s*(\d+)$/i);if(t){const[,e,i,o]=t;return`After ${e} ${i} ${o} ${"1"===o?"day":"days"}`}return`After ${s}`}return"";case"has_date_eq":if(s){const t=s.match(/^(today)\s*([+-])\s*(\d+)$/i);if(t){const[,e,i,o]=t;return`${e} ${i} ${o} ${"1"===o?"day":"days"}`}return s}return""}},Le=(t,e,i,o=[],n=[],s=[])=>{const r=[],a=[],l=[],d=o.filter((t=>!Me(t.name))),c=new Map;e.forEach(((t,e)=>{const h=t.category.trim().toLowerCase(),u=t.category.trim();let p=c.get(h);if(!p){let t=d.find((t=>t.name.toLowerCase()===h));const e=Array.from(c.keys()).length;if(!t&&e<d.length){const i=d[e];i&&!Ie(i.uuid,o)&&(t=i)}const i=t?n.find((e=>e.uuid===t.exit_uuid)):null;let s=(null==i?void 0:i.uuid)||Xt(),l=(null==t?void 0:t.uuid)||Xt();Ie(l,o)&&(l=Xt(),s=Xt()),p={uuid:l,name:u,exit_uuid:s},c.set(h,p),r.push({uuid:l,name:u,exit_uuid:s}),a.push({uuid:s,destination_uuid:(null==i?void 0:i.destination_uuid)||null})}let m=s[e];!m&&s.length>0&&(m=s.find((e=>{const i=o.find((t=>t.uuid===e.category_uuid));return e.type===t.operator&&(null==i?void 0:i.name.toLowerCase())===h})));const g=(null==m?void 0:m.uuid)||Xt(),f=i(t.operator);let v=[];v=f?0===f.operands?[]:2===f.operands?t.value.split(" ").filter((t=>t.trim())):t.value&&t.value.trim()?t.value.trim().split(/\s+/).filter((t=>t.length>0)):[]:t.value&&t.value.trim()?t.value.trim().split(/\s+/).filter((t=>t.length>0)):[],l.push({uuid:g,type:t.operator,arguments:v,category_uuid:p.uuid})}));const h=e.length>0?"Other":"All Responses";let u=o.find((t=>t.name===h));if(!u){const t=e.length>0?"All Responses":"Other";u=o.find((e=>e.name===t))}const p=u?n.find((t=>t.uuid===u.exit_uuid)):null,m=(null==p?void 0:p.uuid)||Xt(),g=(null==u?void 0:u.uuid)||Xt();r.push({uuid:g,name:h,exit_uuid:m}),a.push({uuid:m,destination_uuid:(null==p?void 0:p.destination_uuid)||null});const f=r.find((t=>"Other"===t.name||"All Responses"===t.name));return{router:{type:"switch",categories:r,default_category_uuid:null==f?void 0:f.uuid,operand:t,cases:l},exits:a}},ze=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),Pe=(t,e,i=!1)=>{if((t.DEBUG_UPDATES||t.DEBUG)&&e.size>0){const o={};for(const i of e.keys())o[i]=[e[i],t[i]];ne(t.tagName,oe.PURPLE,[i?"<first-updated>":"<updated>",o])}},Re=(t,e,i=void 0)=>{(t.DEBUG_EVENTS||t.DEBUG)&&ne(t.tagName,oe.GREEN,void 0!==i?[e,i]:[e])};class Ne extends dt{constructor(){super(...arguments),this.DEBUG=!1,this.DEBUG_UPDATES=!1,this.DEBUG_EVENTS=!1,this.eles={}}getEventHandlers(){return[]}connectedCallback(){super.connectedCallback();for(const t of this.getEventHandlers())t.isDocument?document.addEventListener(t.event,t.method.bind(this)):t.isWindow?window.addEventListener(t.event,t.method.bind(this)):this.addEventListener(t.event,t.method.bind(this))}disconnectedCallback(){for(const t of this.getEventHandlers())t.isDocument?document.removeEventListener(t.event,t.method):t.isWindow?window.removeEventListener(t.event,t.method):this.removeEventListener(t.event,t.method);super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),Pe(this,t,!0)}updated(t){super.updated(t),Pe(this,t,!1)}getHeaders(){return this.service?{"X-Temba-Service-Org":this.service}:{}}fireEvent(t){return Re(this,t),this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0}))}swallowEvent(t){t.stopPropagation(),t.preventDefault()}fireCustomEvent(t,e={}){this.DEBUG_EVENTS&&Re(this,t,e);const i=new CustomEvent(t,{detail:e,bubbles:!0,composed:!0});return this.dispatchEvent(i)}dispatchEvent(t){super.dispatchEvent(t);const e=t.target;if(e){const i=e["-"+t.type];if(i)return i(t);return new Function("event",`\n with(document) {\n with(this) {\n let handler = ${e.getAttribute("-"+t.type)};\n if(typeof handler === 'function') { \n handler(event);\n }\n }\n }\n `).call(e,t)}}closestElement(t,e=this){return function e(i){if(!i||i===document||i===window)return null;i.assignedSlot&&(i=i.assignedSlot);const o=i.closest(t);return o||e(i.getRootNode().host)}(e)}getDiv(t){let e=this.eles[t];return e||(e=this.shadowRoot.querySelector(t),e&&(this.eles[t]=e),e)}stopEvent(t){t&&(t.stopPropagation(),t.preventDefault())}isMobile(){const t=window;return!!t.isMobile&&t.isMobile()}}t([mt({type:String})],Ne.prototype,"service",void 0);
40
+ */}function gt(t){return mt({...t,state:!0,attribute:!1})}var ft,vt,yt,bt,xt,_t,wt,kt,Ct,St,At,Et,$t,Tt,Dt,Mt,It,Ot,Lt=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},zt=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};const Pt=function(t){var e=0;t+="x";var i=Math.floor(65745979961613.07);for(let o=0;o<t.length;o++)e>i&&(e=Math.floor(e/137)),e=131*e+t.charCodeAt(o);return e},Rt="0123456789abcdef".split(""),Nt=[-2147483648,8388608,32768,128],Bt=[24,16,8,0],Ft=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],qt=[];class Ut{constructor(t=!1,e=!1){ft.set(this,void 0),vt.set(this,void 0),yt.set(this,void 0),bt.set(this,void 0),xt.set(this,void 0),_t.set(this,void 0),wt.set(this,void 0),kt.set(this,void 0),Ct.set(this,void 0),St.set(this,void 0),At.set(this,void 0),Et.set(this,void 0),$t.set(this,void 0),Tt.set(this,void 0),Dt.set(this,void 0),Mt.set(this,void 0),It.set(this,0),Ot.set(this,void 0),this.init(t,e)}init(t,e){e?(qt[0]=qt[16]=qt[1]=qt[2]=qt[3]=qt[4]=qt[5]=qt[6]=qt[7]=qt[8]=qt[9]=qt[10]=qt[11]=qt[12]=qt[13]=qt[14]=qt[15]=0,Lt(this,vt,qt)):Lt(this,vt,[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),t?(Lt(this,_t,3238371032),Lt(this,wt,914150663),Lt(this,kt,812702999),Lt(this,Ct,4144912697),Lt(this,St,4290775857),Lt(this,At,1750603025),Lt(this,Et,1694076839),Lt(this,$t,3204075428)):(Lt(this,_t,1779033703),Lt(this,wt,3144134277),Lt(this,kt,1013904242),Lt(this,Ct,2773480762),Lt(this,St,1359893119),Lt(this,At,2600822924),Lt(this,Et,528734635),Lt(this,$t,1541459225)),Lt(this,ft,Lt(this,Ot,Lt(this,yt,Lt(this,Dt,0)))),Lt(this,bt,Lt(this,Tt,!1)),Lt(this,xt,!0),Lt(this,Mt,t)}update(t){if(zt(this,bt))return this;let e;e=t instanceof ArrayBuffer?new Uint8Array(t):t;let i=0;const o=e.length,n=zt(this,vt);for(;i<o;){let t;if(zt(this,Tt)&&(Lt(this,Tt,!1),n[0]=zt(this,ft),n[16]=n[1]=n[2]=n[3]=n[4]=n[5]=n[6]=n[7]=n[8]=n[9]=n[10]=n[11]=n[12]=n[13]=n[14]=n[15]=0),"string"!=typeof e)for(t=zt(this,Ot);i<o&&t<64;++i)n[t>>2]|=e[i]<<Bt[3&t++];else for(t=zt(this,Ot);i<o&&t<64;++i){let o=e.charCodeAt(i);o<128?n[t>>2]|=o<<Bt[3&t++]:o<2048?(n[t>>2]|=(192|o>>6)<<Bt[3&t++],n[t>>2]|=(128|63&o)<<Bt[3&t++]):o<55296||o>=57344?(n[t>>2]|=(224|o>>12)<<Bt[3&t++],n[t>>2]|=(128|o>>6&63)<<Bt[3&t++],n[t>>2]|=(128|63&o)<<Bt[3&t++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++i)),n[t>>2]|=(240|o>>18)<<Bt[3&t++],n[t>>2]|=(128|o>>12&63)<<Bt[3&t++],n[t>>2]|=(128|o>>6&63)<<Bt[3&t++],n[t>>2]|=(128|63&o)<<Bt[3&t++])}Lt(this,It,t),Lt(this,yt,zt(this,yt)+(t-zt(this,Ot))),t>=64?(Lt(this,ft,n[16]),Lt(this,Ot,t-64),this.hash(),Lt(this,Tt,!0)):Lt(this,Ot,t)}return zt(this,yt)>4294967295&&(Lt(this,Dt,zt(this,Dt)+(zt(this,yt)/4294967296|0)),Lt(this,yt,zt(this,yt)%4294967296)),this}finalize(){if(zt(this,bt))return;Lt(this,bt,!0);const t=zt(this,vt),e=zt(this,It);t[16]=zt(this,ft),t[e>>2]|=Nt[3&e],Lt(this,ft,t[16]),e>=56&&(zt(this,Tt)||this.hash(),t[0]=zt(this,ft),t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=zt(this,Dt)<<3|zt(this,yt)>>>29,t[15]=zt(this,yt)<<3,this.hash()}hash(){let t=zt(this,_t),e=zt(this,wt),i=zt(this,kt),o=zt(this,Ct),n=zt(this,St),s=zt(this,At),r=zt(this,Et),a=zt(this,$t);const l=zt(this,vt);let d,c,h,u,p,m,g,f,v,y;for(let t=16;t<64;++t)u=l[t-15],d=(u>>>7|u<<25)^(u>>>18|u<<14)^u>>>3,u=l[t-2],c=(u>>>17|u<<15)^(u>>>19|u<<13)^u>>>10,l[t]=l[t-16]+d+l[t-7]+c|0;y=e&i;for(let b=0;b<64;b+=4)zt(this,xt)?(zt(this,Mt)?(g=300032,u=l[0]-1413257819,a=u-150054599|0,o=u+24177077|0):(g=704751109,u=l[0]-210244248,a=u-1521486534|0,o=u+143694565|0),Lt(this,xt,!1)):(d=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),c=(n>>>6|n<<26)^(n>>>11|n<<21)^(n>>>25|n<<7),g=t&e,h=g^t&i^y,m=n&s^~n&r,u=a+c+m+Ft[b]+l[b],p=d+h,a=o+u|0,o=u+p|0),d=(o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10),c=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),f=o&t,h=f^o&e^g,m=a&n^~a&s,u=r+c+m+Ft[b+1]+l[b+1],p=d+h,r=i+u|0,i=u+p|0,d=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10),c=(r>>>6|r<<26)^(r>>>11|r<<21)^(r>>>25|r<<7),v=i&o,h=v^i&t^f,m=r&a^~r&n,u=s+c+m+Ft[b+2]+l[b+2],p=d+h,s=e+u|0,e=u+p|0,d=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),c=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),y=e&i,h=y^e&o^v,m=s&r^~s&a,u=n+c+m+Ft[b+3]+l[b+3],p=d+h,n=t+u|0,t=u+p|0;Lt(this,_t,zt(this,_t)+t|0),Lt(this,wt,zt(this,wt)+e|0),Lt(this,kt,zt(this,kt)+i|0),Lt(this,Ct,zt(this,Ct)+o|0),Lt(this,St,zt(this,St)+n|0),Lt(this,At,zt(this,At)+s|0),Lt(this,Et,zt(this,Et)+r|0),Lt(this,$t,zt(this,$t)+a|0)}hex(){this.finalize();const t=zt(this,_t),e=zt(this,wt),i=zt(this,kt),o=zt(this,Ct),n=zt(this,St),s=zt(this,At),r=zt(this,Et),a=zt(this,$t);let l=Rt[t>>28&15]+Rt[t>>24&15]+Rt[t>>20&15]+Rt[t>>16&15]+Rt[t>>12&15]+Rt[t>>8&15]+Rt[t>>4&15]+Rt[15&t]+Rt[e>>28&15]+Rt[e>>24&15]+Rt[e>>20&15]+Rt[e>>16&15]+Rt[e>>12&15]+Rt[e>>8&15]+Rt[e>>4&15]+Rt[15&e]+Rt[i>>28&15]+Rt[i>>24&15]+Rt[i>>20&15]+Rt[i>>16&15]+Rt[i>>12&15]+Rt[i>>8&15]+Rt[i>>4&15]+Rt[15&i]+Rt[o>>28&15]+Rt[o>>24&15]+Rt[o>>20&15]+Rt[o>>16&15]+Rt[o>>12&15]+Rt[o>>8&15]+Rt[o>>4&15]+Rt[15&o]+Rt[n>>28&15]+Rt[n>>24&15]+Rt[n>>20&15]+Rt[n>>16&15]+Rt[n>>12&15]+Rt[n>>8&15]+Rt[n>>4&15]+Rt[15&n]+Rt[s>>28&15]+Rt[s>>24&15]+Rt[s>>20&15]+Rt[s>>16&15]+Rt[s>>12&15]+Rt[s>>8&15]+Rt[s>>4&15]+Rt[15&s]+Rt[r>>28&15]+Rt[r>>24&15]+Rt[r>>20&15]+Rt[r>>16&15]+Rt[r>>12&15]+Rt[r>>8&15]+Rt[r>>4&15]+Rt[15&r];return zt(this,Mt)||(l+=Rt[a>>28&15]+Rt[a>>24&15]+Rt[a>>20&15]+Rt[a>>16&15]+Rt[a>>12&15]+Rt[a>>8&15]+Rt[a>>4&15]+Rt[15&a]),l}toString(){return this.hex()}digest(){this.finalize();const t=zt(this,_t),e=zt(this,wt),i=zt(this,kt),o=zt(this,Ct),n=zt(this,St),s=zt(this,At),r=zt(this,Et),a=zt(this,$t),l=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,n>>24&255,n>>16&255,n>>8&255,255&n,s>>24&255,s>>16&255,s>>8&255,255&s,r>>24&255,r>>16&255,r>>8&255,255&r];return zt(this,Mt)||l.push(a>>24&255,a>>16&255,a>>8&255,255&a),l}array(){return this.digest()}arrayBuffer(){this.finalize();const t=new ArrayBuffer(zt(this,Mt)?28:32),e=new DataView(t);return e.setUint32(0,zt(this,_t)),e.setUint32(4,zt(this,wt)),e.setUint32(8,zt(this,kt)),e.setUint32(12,zt(this,Ct)),e.setUint32(16,zt(this,St)),e.setUint32(20,zt(this,At)),e.setUint32(24,zt(this,Et)),zt(this,Mt)||e.setUint32(28,zt(this,$t)),t}}function jt(t){const e=new Ut;return e.update(t),parseInt(e.hex().substring(0,8),16)}ft=new WeakMap,vt=new WeakMap,yt=new WeakMap,bt=new WeakMap,xt=new WeakMap,_t=new WeakMap,wt=new WeakMap,kt=new WeakMap,Ct=new WeakMap,St=new WeakMap,At=new WeakMap,Et=new WeakMap,$t=new WeakMap,Tt=new WeakMap,Dt=new WeakMap,Mt=new WeakMap,It=new WeakMap,Ot=new WeakMap;const Vt=function(t,e,i){var o=i<.5?i*(1+e):i+e-i*e,n=2*i-o;return[(t/=360)+1/3,t,t-1/3].map((function(t){return t<0&&t++,t>1&&t--,t=t<1/6?n+6*(o-n)*t:t<.5?o:t<2/3?n+6*(o-n)*(2/3-t):n,Math.round(255*t)}))};const Ht=[];for(let t=0;t<256;++t)Ht.push((t+256).toString(16).slice(1));function Wt(t,e=0){return(Ht[t[e+0]]+Ht[t[e+1]]+Ht[t[e+2]]+Ht[t[e+3]]+"-"+Ht[t[e+4]]+Ht[t[e+5]]+"-"+Ht[t[e+6]]+Ht[t[e+7]]+"-"+Ht[t[e+8]]+Ht[t[e+9]]+"-"+Ht[t[e+10]]+Ht[t[e+11]]+Ht[t[e+12]]+Ht[t[e+13]]+Ht[t[e+14]]+Ht[t[e+15]]).toLowerCase()}let Zt;const Yt=new Uint8Array(16);function Gt(){if(!Zt){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Zt=crypto.getRandomValues.bind(crypto)}return Zt(Yt)}var Kt={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Xt(t,e,i){if(Kt.randomUUID&&!e&&!t)return Kt.randomUUID();const o=(t=t||{}).random??t.rng?.()??Gt();if(o.length<16)throw new Error("Random bytes length must be >= 16");if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e){if((i=i||0)<0||i+16>e.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);for(let t=0;t<16;++t)e[i+t]=o[t];return e}return Wt(o)}const Qt={};function Jt(t,e,i){let o;if(t)o=te(t.random??t.rng?.()??Gt(),t.msecs,t.seq,e,i);else{const t=Date.now(),n=Gt();!function(t,e,i){t.msecs??=-1/0,t.seq??=0,e>t.msecs?(t.seq=i[6]<<23|i[7]<<16|i[8]<<8|i[9],t.msecs=e):(t.seq=t.seq+1|0,0===t.seq&&t.msecs++)}(Qt,t,n),o=te(n,Qt.msecs,Qt.seq,e,i)}return e??Wt(o)}function te(t,e,i,o,n=0){if(t.length<16)throw new Error("Random bytes length must be >= 16");if(o){if(n<0||n+16>o.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`)}else o=new Uint8Array(16),n=0;return e??=Date.now(),i??=127*t[6]<<24|t[7]<<16|t[8]<<8|t[9],o[n++]=e/1099511627776&255,o[n++]=e/4294967296&255,o[n++]=e/16777216&255,o[n++]=e/65536&255,o[n++]=e/256&255,o[n++]=255&e,o[n++]=112|i>>>28&15,o[n++]=i>>>20&255,o[n++]=128|i>>>14&63,o[n++]=i>>>6&255,o[n++]=i<<2&255|3&t[10],o[n++]=t[11],o[n++]=t[12],o[n++]=t[13],o[n++]=t[14],o[n++]=t[15],o}const ee="/api/v2/media.json",ie=new class{constructor(t={}){const[e,i]=[t.lightness,t.saturation].map((function(t){return t=void 0!==t?t:[.35,.5,.65],Array.isArray(t)?t.concat():[t]}));this.L=e,this.S=i,"number"==typeof t.hue&&(t.hue={min:t.hue,max:t.hue}),"object"!=typeof t.hue||Array.isArray(t.hue)||(t.hue=[t.hue]),void 0===t.hue&&(t.hue=[]),this.hueRanges=t.hue.map((function(t){return{min:void 0===t.min?0:t.min,max:void 0===t.max?360:t.max}})),this.hash=jt,"function"==typeof t.hash&&(this.hash=t.hash),"bkdr"===t.hash&&(this.hash=Pt)}hsl(t){var e,i,o=this.hash(t);if(this.hueRanges.length){const t=this.hueRanges[o%this.hueRanges.length];e=o/this.hueRanges.length%727*(t.max-t.min)/727+t.min}else e=o%359;return o=Math.ceil(o/360),i=this.S[o%this.S.length],o=Math.ceil(o/this.S.length),[e,i,this.L[o%this.L.length]]}rgb(t){var e=this.hsl(t);return Vt.apply(this,e)}hex(t){return function(t){var e="#";return t.forEach((function(t){t<16&&(e+=0),e+=t.toString(16)})),e}(this.rgb(t))}};var oe;!function(t){t.BLUE="color:#5078b5;",t.GREEN="color:#62bd6a;",t.RED="color:#e36049;",t.PURPLE="color:#a626a4;"}(oe||(oe={}));const ne=(t,e="",i=[])=>{""!==e?"object"!=typeof t?console.log("%c"+t,e,...i):console.log("%c"+JSON.stringify(t,null,2),e):console.log(t)},se=(t={})=>{var e;let i=(t=>{for(const e of document.cookie.split(";")){const i=e.indexOf("=");let o=e.substr(0,i),n=e.substr(i+1);if(o=o.trim(),n=n.trim(),o===t)return n}return null})("csrftoken");if(!i){const t=document.querySelector("[name=csrfmiddlewaretoken]");t&&(i=t.value)}const o=i?{"X-CSRFToken":i}:{},n=null===(e=window.workspace)||void 0===e?void 0:e.uuid;return n&&(o["X-Temba-Workspace"]=n),o["X-Requested-With"]="XMLHttpRequest",Object.keys(t).forEach((e=>{"X-Temba-Service-Org"===e&&delete o["X-Temba-Workspace"],o[e]=t[e]})),o},re=(t,e=null,i={})=>new Promise(((o,n)=>{const s={method:"GET",headers:se(i)};e&&(s.signal=e.signal),fetch(t,s).then((t=>{t.status<200||t.status>=300?n(t):t.text().then((i=>{let n={};try{n=JSON.parse(i)}catch(t){}o({controller:e,body:i,json:n,url:t.url,headers:t.headers,status:t.status})}))})).catch((t=>{n(t)}))})),ae=t=>{const e=[];Object.keys(t).forEach((i=>{t[i]&&e.push(i)}));let i=e.join(" ");return i.trim().length>0&&(i=" "+i),i.trim()},le=(t,e=null,i={})=>new Promise(((o,n)=>{re(t,e,i).then((t=>{o({results:t.json.results,next:t.json.next})})).catch((t=>n(t)))})),de=async(t,e={})=>{if(!t)return new Promise((t=>t([])));let i=[],o=t;for(;o;){const t=await le(o,null,e);t.results&&(i=i.concat(t.results)),o=t.next}return i},ce=t=>new Promise(((e,i)=>{re(t).then((t=>{t.status>=200&&t.status<300?e({assets:t.json.results,next:t.json.next}):i(t)})).catch((t=>i(t)))})),he=async t=>{if(!t)return new Promise((t=>t([])));let e=[],i=t;for(;i;){const t=await ce(i);t.assets?(e=e.concat(t.assets),i=t.next):i=null}return e},ue=(t,e,i={},o=null)=>{const n=se(i);o&&(n["Content-Type"]=o);const s={method:"POST",headers:n,body:e};return new Promise(((e,i)=>{fetch(t,s).then((async t=>{if(t.status>=500)return void i(t);const o=t.headers.get("X-Temba-Toasts");if(o){const t=document.querySelector("temba-toast");t&&t.addMessages(JSON.parse(o))}t.text().then((i=>{let o={};try{o=JSON.parse(i)}catch(t){}e({body:i,json:o,headers:t.headers,status:t.status,redirected:t.redirected,url:t.url})}))})).catch((t=>{i(t)}))}))},pe=(t,e)=>ue(t,JSON.stringify(e),!1,"application/json"),me=(t,e,i={})=>new Promise(((o,n)=>{ue(t,e,i).then((e=>{e.status>=200&&e.status<400?o(e):n(t===ee?e:"Server failure")})).catch((t=>{n(t)}))})),ge=t=>{const e=t.parentNode||t.host;if(e){const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY,i=t&&!(t.includes("hidden")||t.includes("visible"));return e?i&&e.scrollHeight>=e.clientHeight?e:ge(e):null}return null},fe=(t,e,i=!1)=>{let o;return function(...n){const s=this,r=i&&!o;clearTimeout(o),o=setTimeout((function(){o=null,i||t.apply(s,n)}),e),r&&t.apply(s,n)}},ve=(t,e)=>{let i=!0;return function(...o){i&&(i=!1,t.apply(this,o),setTimeout((()=>{i=!0}),e))}},ye=(t,e,i="and")=>((t,e="and")=>{if(0===t.length)return"";if(1===t.length)return t[0];if(2===t.length)return"object"==typeof t[0]?H`${t[0]} ${e} ${t[1]}`:t.join(" "+e+" ");if("object"==typeof t[0])return t.map(((i,o)=>o<t.length-1?H`${i}, `:H`${e} ${i}`));const i=t.slice(0,-1),o=t[t.length-1];return i.join(", ")+", "+e+" "+o})(t.map(e),i),be=(t,e,i=void 0)=>{if(!i){const t=document.location.pathname;i=t.substring(0,t.indexOf("/",1))}const o=new Date;o.setTime(o.getTime()+2592e6),document.cookie=`${t}=${e};expires=${o.toUTCString()};path=${i}`},xe=t=>{let e=null;if(document.cookie&&""!=document.cookie){const i=document.cookie.split(";");for(let o=0;o<i.length;o++){const n=i[o].trim();if(n.substring(0,t.length+1)==t+"="){e=decodeURIComponent(n.substring(t.length+1));break}}}return e};function _e(t,e){return(i,o)=>{mt()(i,o);const n="connectedCallback",s="updated",r=i[n],a=i[s];i[n]=function(){const i=xe(t);null!==i?this[o]="true"===i||"false"!==i&&i:void 0!==e&&(this[o]=e),r&&r.call(this)},i[s]=function(e){e.has(o)&&be(t,this[o]),a&&a.call(this,e)}}}var we;!function(t){t.SETTINGS="settings",t.MENU_COLLAPSED="menu-collapsed",t.TICKET_SHOW_DETAILS="tickets.show-details"}(we||(we={}));const ke=([t,...e],i=navigator.language)=>void 0===t?"":t.toLocaleUpperCase(i)+e.join(""),Ce=t=>{let e=(t=t.trim()).match(/(([\p{L}\p{N}]+-[\p{L}\p{N}]+)|([\p{L}\p{N}]+))/gu)||[];if(1==e.length&&(e=t.match(/[\p{L}\p{N}]+/gu)),0==e.length)return"?";if(1==e.length)return e[0].substring(0,2).toUpperCase();const i=e.map((t=>t.substring(0,1))),o=i.filter(((t,e)=>t==t.toUpperCase()||0==e));return o.length>=2?(o[0]+o[1]).toUpperCase():(i[0]+i[1]).toUpperCase()},Se=(t,e,i)=>{i/=100;const o=e*Math.min(i,1-i)/100,n=e=>{const n=(e+t/30)%12,s=i-o*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*s).toString(16).padStart(2,"0")};return`#${n(0)}${n(8)}${n(4)}`},Ae=(t,e)=>{const i=t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([0-9.]+))?\)/);if(i){let[t,o,n,s]=i.slice(1).map(((t,e)=>e<3?parseInt(t):parseFloat(t)));return t=Math.max(0,Math.floor(t*(1-e))),o=Math.max(0,Math.floor(o*(1-e))),n=Math.max(0,Math.floor(n*(1-e))),void 0!==i[4]?`rgba(${t},${o},${n},${s})`:`rgb(${t},${o},${n})`}if(t.startsWith("#")){let i=t.replace("#","");3===i.length&&(i=i.split("").map((t=>t+t)).join(""));const o=parseInt(i,16);let n=o>>16&255,s=o>>8&255,r=255&o;return n=Math.max(0,Math.floor(n*(1-e))),s=Math.max(0,Math.floor(s*(1-e))),r=Math.max(0,Math.floor(r*(1-e))),`rgb(${n},${s},${r})`}return t},Ee=(t,e)=>t.left+t.width/2-e.width/2,$e=(t,e)=>t.top+t.height/2-e.height/2,Te=t=>{const{name:e,existingCategories:i,existingExits:o,existingCases:n,caseConfig:s}=t,r=i.find((t=>t.name===e)),a=r?o.find((t=>t.uuid===r.exit_uuid)):null,l=r&&n?n.find((t=>t.category_uuid===r.uuid)):null,d=(null==r?void 0:r.uuid)||Xt(),c=(null==a?void 0:a.uuid)||Xt(),h=(null==l?void 0:l.uuid)||Xt(),u={category:{uuid:d,name:e,exit_uuid:c},exit:{uuid:c,destination_uuid:(null==a?void 0:a.destination_uuid)||null}};return s&&(u.case={uuid:h,type:s.type,arguments:s.arguments,category_uuid:d}),u},De=(t,e,i=[],o=[],n=[])=>{const s=Te({name:"Success",existingCategories:i,existingExits:o,existingCases:n,caseConfig:e}),r=Te({name:"Failure",existingCategories:i,existingExits:o});return{router:{type:"switch",categories:[s.category,r.category],default_category_uuid:r.category.uuid,operand:t,cases:s.case?[s.case]:[]},exits:[s.exit,r.exit]}},Me=t=>["No Response","Other","All Responses","Timeout"].includes(t),Ie=(t,e)=>{const i=e.find((e=>e.uuid===t));return!!i&&Me(i.name)},Oe=(t,e,i,o)=>{const n=e(t);if(!n)return"";if(0===n.operands)return n.categoryName||"";const s=(i||"").trim(),r=(o||"").trim(),a=t=>t?t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():"";switch(t){case"has_any_word":case"has_all_words":case"has_phrase":case"has_only_phrase":case"has_beginning":default:return s?a(s):"";case"has_pattern":return s;case"has_number_eq":return s?`= ${s}`:"";case"has_number_lt":return s?`< ${s}`:"";case"has_number_lte":return s?`≤ ${s}`:"";case"has_number_gt":return s?`> ${s}`:"";case"has_number_gte":return s?`≥ ${s}`:"";case"has_number_between":return s&&r?`${s} - ${r}`:"";case"has_date_lt":case"has_date_lte":if(s){const t=s.match(/^(today)\s*([+-])\s*(\d+)$/i);if(t){const[,e,i,o]=t;return`Before ${e} ${i} ${o} ${"1"===o?"day":"days"}`}return`Before ${s}`}return"";case"has_date_gt":case"has_date_gte":if(s){const t=s.match(/^(today)\s*([+-])\s*(\d+)$/i);if(t){const[,e,i,o]=t;return`After ${e} ${i} ${o} ${"1"===o?"day":"days"}`}return`After ${s}`}return"";case"has_date_eq":if(s){const t=s.match(/^(today)\s*([+-])\s*(\d+)$/i);if(t){const[,e,i,o]=t;return`${e} ${i} ${o} ${"1"===o?"day":"days"}`}return s}return""}},Le=(t,e,i,o=[],n=[],s=[])=>{const r=[],a=[],l=[],d=o.filter((t=>!Me(t.name))),c=new Map;e.forEach(((t,e)=>{const h=t.category.trim().toLowerCase(),u=t.category.trim();let p=c.get(h);if(!p){let t=d.find((t=>t.name.toLowerCase()===h));const e=Array.from(c.keys()).length;if(!t&&e<d.length){const i=d[e];i&&!Ie(i.uuid,o)&&(t=i)}const i=t?n.find((e=>e.uuid===t.exit_uuid)):null;let s=(null==i?void 0:i.uuid)||Xt(),l=(null==t?void 0:t.uuid)||Xt();Ie(l,o)&&(l=Xt(),s=Xt()),p={uuid:l,name:u,exit_uuid:s},c.set(h,p),r.push({uuid:l,name:u,exit_uuid:s}),a.push({uuid:s,destination_uuid:(null==i?void 0:i.destination_uuid)||null})}let m=s[e];!m&&s.length>0&&(m=s.find((e=>{const i=o.find((t=>t.uuid===e.category_uuid));return e.type===t.operator&&(null==i?void 0:i.name.toLowerCase())===h})));const g=(null==m?void 0:m.uuid)||Xt(),f=i(t.operator);let v=[];v=f?0===f.operands?[]:2===f.operands?t.value.split(" ").filter((t=>t.trim())):t.value&&t.value.trim()?t.value.trim().split(/\s+/).filter((t=>t.length>0)):[]:t.value&&t.value.trim()?t.value.trim().split(/\s+/).filter((t=>t.length>0)):[],l.push({uuid:g,type:t.operator,arguments:v,category_uuid:p.uuid})}));const h=e.length>0?"Other":"All Responses";let u=o.find((t=>t.name===h));if(!u){const t=e.length>0?"All Responses":"Other";u=o.find((e=>e.name===t))}const p=u?n.find((t=>t.uuid===u.exit_uuid)):null,m=(null==p?void 0:p.uuid)||Xt(),g=(null==u?void 0:u.uuid)||Xt();r.push({uuid:g,name:h,exit_uuid:m}),a.push({uuid:m,destination_uuid:(null==p?void 0:p.destination_uuid)||null});const f=r.find((t=>"Other"===t.name||"All Responses"===t.name));return{router:{type:"switch",categories:r,default_category_uuid:null==f?void 0:f.uuid,operand:t,cases:l},exits:a}},ze=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),Pe=(t,e,i=!1)=>{if((t.DEBUG_UPDATES||t.DEBUG)&&e.size>0){const o={};for(const i of e.keys())o[i]=[e[i],t[i]];ne(t.tagName,oe.PURPLE,[i?"<first-updated>":"<updated>",o])}},Re=(t,e,i=void 0)=>{(t.DEBUG_EVENTS||t.DEBUG)&&ne(t.tagName,oe.GREEN,void 0!==i?[e,i]:[e])};class Ne extends dt{constructor(){super(...arguments),this.DEBUG=!1,this.DEBUG_UPDATES=!1,this.DEBUG_EVENTS=!1,this.eles={}}getEventHandlers(){return[]}connectedCallback(){super.connectedCallback();for(const t of this.getEventHandlers())t.isDocument?document.addEventListener(t.event,t.method.bind(this)):t.isWindow?window.addEventListener(t.event,t.method.bind(this)):this.addEventListener(t.event,t.method.bind(this))}disconnectedCallback(){for(const t of this.getEventHandlers())t.isDocument?document.removeEventListener(t.event,t.method):t.isWindow?window.removeEventListener(t.event,t.method):this.removeEventListener(t.event,t.method);super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),Pe(this,t,!0)}updated(t){super.updated(t),Pe(this,t,!1)}getHeaders(){return this.service?{"X-Temba-Service-Org":this.service}:{}}fireEvent(t){return Re(this,t),this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0}))}swallowEvent(t){t.stopPropagation(),t.preventDefault()}fireCustomEvent(t,e={}){this.DEBUG_EVENTS&&Re(this,t,e);const i=new CustomEvent(t,{detail:e,bubbles:!0,composed:!0});return this.dispatchEvent(i)}dispatchEvent(t){super.dispatchEvent(t);const e=t.target;if(e){const i=e["-"+t.type];if(i)return i(t);return new Function("event",`\n with(document) {\n with(this) {\n let handler = ${e.getAttribute("-"+t.type)};\n if(typeof handler === 'function') { \n handler(event);\n }\n }\n }\n `).call(e,t)}}closestElement(t,e=this){return function e(i){if(!i||i===document||i===window)return null;i.assignedSlot&&(i=i.assignedSlot);const o=i.closest(t);return o||e(i.getRootNode().host)}(e)}getDiv(t){let e=this.eles[t];return e||(e=this.shadowRoot.querySelector(t),e&&(this.eles[t]=e),e)}stopEvent(t){t&&(t.stopPropagation(),t.preventDefault())}isMobile(){const t=window;return!!t.isMobile&&t.isMobile()}}t([mt({type:String})],Ne.prototype,"service",void 0);
41
41
  /**
42
42
  * @license
43
43
  * Copyright 2017 Google LLC
@@ -48,7 +48,7 @@ const Be=1,Fe=2,qe=t=>(...e)=>({_$litDirective$:t,values:e});let Ue=class{constr
48
48
  * @license
49
49
  * Copyright 2017 Google LLC
50
50
  * SPDX-License-Identifier: BSD-3-Clause
51
- */class je extends Ue{constructor(t){if(super(t),this.it=Z,t.type!==Fe)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===Z||null==t)return this._t=void 0,this.it=t;if(t===W)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}je.directiveName="unsafeHTML",je.resultType=1;const Ve=qe(je);var He={Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",GT:">",Gt:"≫",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",LT:"<",Lt:"≪",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"},We=Object.prototype.hasOwnProperty;function Ze(t){return i=t,(e=He)&&We.call(e,i)?He[t]:t;var e,i}var Ye=Object.prototype.hasOwnProperty;function Ge(t){return[].slice.call(arguments,1).forEach((function(e){if(e){if("object"!=typeof e)throw new TypeError(e+"must be object");Object.keys(e).forEach((function(i){t[i]=e[i]}))}})),t}var Ke=/\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;function Xe(t){return t.indexOf("\\")<0?t:t.replace(Ke,"$1")}function Qe(t){return!(t>=55296&&t<=57343)&&(!(t>=64976&&t<=65007)&&(!!(65535&~t&&65534!=(65535&t))&&(!(t>=0&&t<=8)&&(11!==t&&(!(t>=14&&t<=31)&&(!(t>=127&&t<=159)&&!(t>1114111)))))))}function Je(t){if(t>65535){var e=55296+((t-=65536)>>10),i=56320+(1023&t);return String.fromCharCode(e,i)}return String.fromCharCode(t)}var ti=/&([a-z#][a-z0-9]{1,31});/gi,ei=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;function ii(t,e){var i=0,o=Ze(e);return e!==o?o:35===e.charCodeAt(0)&&ei.test(e)&&Qe(i="x"===e[1].toLowerCase()?parseInt(e.slice(2),16):parseInt(e.slice(1),10))?Je(i):t}function oi(t){return t.indexOf("&")<0?t:t.replace(ti,ii)}var ni=/[&<>"]/,si=/[&<>"]/g,ri={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function ai(t){return ri[t]}function li(t){return ni.test(t)?t.replace(si,ai):t}var di={};function ci(t,e){return++e>=t.length-2?e:"paragraph_open"===t[e].type&&t[e].tight&&"inline"===t[e+1].type&&0===t[e+1].content.length&&"paragraph_close"===t[e+2].type&&t[e+2].tight?ci(t,e+2):e}di.blockquote_open=function(){return"<blockquote>\n"},di.blockquote_close=function(t,e){return"</blockquote>"+hi(t,e)},di.code=function(t,e){return t[e].block?"<pre><code>"+li(t[e].content)+"</code></pre>"+hi(t,e):"<code>"+li(t[e].content)+"</code>"},di.fence=function(t,e,i,o,n){var s,r,a,l,d=t[e],c="",h=i.langPrefix;if(d.params){if(r=(s=d.params.split(/\s+/g)).join(" "),a=n.rules.fence_custom,l=s[0],a&&Ye.call(a,l))return n.rules.fence_custom[s[0]](t,e,i,o,n);c=' class="'+h+li(oi(Xe(r)))+'"'}return"<pre><code"+c+">"+(i.highlight&&i.highlight.apply(i.highlight,[d.content].concat(s))||li(d.content))+"</code></pre>"+hi(t,e)},di.fence_custom={},di.heading_open=function(t,e){return"<h"+t[e].hLevel+">"},di.heading_close=function(t,e){return"</h"+t[e].hLevel+">\n"},di.hr=function(t,e,i){return(i.xhtmlOut?"<hr />":"<hr>")+hi(t,e)},di.bullet_list_open=function(){return"<ul>\n"},di.bullet_list_close=function(t,e){return"</ul>"+hi(t,e)},di.list_item_open=function(){return"<li>"},di.list_item_close=function(){return"</li>\n"},di.ordered_list_open=function(t,e){var i=t[e];return"<ol"+(i.order>1?' start="'+i.order+'"':"")+">\n"},di.ordered_list_close=function(t,e){return"</ol>"+hi(t,e)},di.paragraph_open=function(t,e){return t[e].tight?"":"<p>"},di.paragraph_close=function(t,e){var i=!(t[e].tight&&e&&"inline"===t[e-1].type&&!t[e-1].content);return(t[e].tight?"":"</p>")+(i?hi(t,e):"")},di.link_open=function(t,e,i){var o=t[e].title?' title="'+li(oi(t[e].title))+'"':"",n=i.linkTarget?' target="'+i.linkTarget+'"':"";return'<a href="'+li(t[e].href)+'"'+o+n+">"},di.link_close=function(){return"</a>"},di.image=function(t,e,i){var o=' src="'+li(t[e].src)+'"',n=t[e].title?' title="'+li(oi(t[e].title))+'"':"";return"<img"+o+(' alt="'+(t[e].alt?li(oi(Xe(t[e].alt))):"")+'"')+n+(i.xhtmlOut?" /":"")+">"},di.table_open=function(){return"<table>\n"},di.table_close=function(){return"</table>\n"},di.thead_open=function(){return"<thead>\n"},di.thead_close=function(){return"</thead>\n"},di.tbody_open=function(){return"<tbody>\n"},di.tbody_close=function(){return"</tbody>\n"},di.tr_open=function(){return"<tr>"},di.tr_close=function(){return"</tr>\n"},di.th_open=function(t,e){var i=t[e];return"<th"+(i.align?' style="text-align:'+i.align+'"':"")+">"},di.th_close=function(){return"</th>"},di.td_open=function(t,e){var i=t[e];return"<td"+(i.align?' style="text-align:'+i.align+'"':"")+">"},di.td_close=function(){return"</td>"},di.strong_open=function(){return"<strong>"},di.strong_close=function(){return"</strong>"},di.em_open=function(){return"<em>"},di.em_close=function(){return"</em>"},di.del_open=function(){return"<del>"},di.del_close=function(){return"</del>"},di.ins_open=function(){return"<ins>"},di.ins_close=function(){return"</ins>"},di.mark_open=function(){return"<mark>"},di.mark_close=function(){return"</mark>"},di.sub=function(t,e){return"<sub>"+li(t[e].content)+"</sub>"},di.sup=function(t,e){return"<sup>"+li(t[e].content)+"</sup>"},di.hardbreak=function(t,e,i){return i.xhtmlOut?"<br />\n":"<br>\n"},di.softbreak=function(t,e,i){return i.breaks?i.xhtmlOut?"<br />\n":"<br>\n":"\n"},di.text=function(t,e){return li(t[e].content)},di.htmlblock=function(t,e){return t[e].content},di.htmltag=function(t,e){return t[e].content},di.abbr_open=function(t,e){return'<abbr title="'+li(oi(t[e].title))+'">'},di.abbr_close=function(){return"</abbr>"},di.footnote_ref=function(t,e){var i=Number(t[e].id+1).toString(),o="fnref"+i;return t[e].subId>0&&(o+=":"+t[e].subId),'<sup class="footnote-ref"><a href="#fn'+i+'" id="'+o+'">['+i+"]</a></sup>"},di.footnote_block_open=function(t,e,i){return(i.xhtmlOut?'<hr class="footnotes-sep" />\n':'<hr class="footnotes-sep">\n')+'<section class="footnotes">\n<ol class="footnotes-list">\n'},di.footnote_block_close=function(){return"</ol>\n</section>\n"},di.footnote_open=function(t,e){return'<li id="fn'+Number(t[e].id+1).toString()+'" class="footnote-item">'},di.footnote_close=function(){return"</li>\n"},di.footnote_anchor=function(t,e){var i="fnref"+Number(t[e].id+1).toString();return t[e].subId>0&&(i+=":"+t[e].subId),' <a href="#'+i+'" class="footnote-backref">↩</a>'},di.dl_open=function(){return"<dl>\n"},di.dt_open=function(){return"<dt>"},di.dd_open=function(){return"<dd>"},di.dl_close=function(){return"</dl>\n"},di.dt_close=function(){return"</dt>\n"},di.dd_close=function(){return"</dd>\n"};var hi=di.getBreak=function(t,e){return(e=ci(t,e))<t.length&&"list_item_close"===t[e].type?"":"\n"};function ui(){this.rules=Ge({},di),this.getBreak=di.getBreak}function pi(){this.__rules__=[],this.__cache__=null}function mi(t,e,i,o,n){this.src=t,this.env=o,this.options=i,this.parser=e,this.tokens=n,this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache=[],this.isInLabel=!1,this.linkLevel=0,this.linkContent="",this.labelUnmatchedScopes=0}function gi(t,e){var i,o,n,s=-1,r=t.posMax,a=t.pos,l=t.isInLabel;if(t.isInLabel)return-1;if(t.labelUnmatchedScopes)return t.labelUnmatchedScopes--,-1;for(t.pos=e+1,t.isInLabel=!0,i=1;t.pos<r;){if(91===(n=t.src.charCodeAt(t.pos)))i++;else if(93===n&&0===--i){o=!0;break}t.parser.skipToken(t)}return o?(s=t.pos,t.labelUnmatchedScopes=0):t.labelUnmatchedScopes=i-1,t.pos=a,t.isInLabel=l,s}function fi(t,e,i,o){var n,s,r,a,l,d;if(42!==t.charCodeAt(0))return-1;if(91!==t.charCodeAt(1))return-1;if(-1===t.indexOf("]:"))return-1;if((s=gi(n=new mi(t,e,i,o,[]),1))<0||58!==t.charCodeAt(s+1))return-1;for(a=n.posMax,r=s+2;r<a&&10!==n.src.charCodeAt(r);r++);return l=t.slice(2,s),0===(d=t.slice(s+2,r).trim()).length?-1:(o.abbreviations||(o.abbreviations={}),void 0===o.abbreviations[":"+l]&&(o.abbreviations[":"+l]=d),r)}function vi(t){var e=oi(t);try{e=decodeURI(e)}catch(t){}return encodeURI(e)}function bi(t,e){var i,o,n,s=e,r=t.posMax;if(60===t.src.charCodeAt(e)){for(e++;e<r;){if(10===(i=t.src.charCodeAt(e)))return!1;if(62===i)return n=vi(Xe(t.src.slice(s+1,e))),!!t.parser.validateLink(n)&&(t.pos=e+1,t.linkContent=n,!0);92===i&&e+1<r?e+=2:e++}return!1}for(o=0;e<r&&32!==(i=t.src.charCodeAt(e))&&!(i<32||127===i);)if(92===i&&e+1<r)e+=2;else{if(40===i&&++o>1)break;if(41===i&&--o<0)break;e++}return s!==e&&(n=Xe(t.src.slice(s,e)),!!t.parser.validateLink(n)&&(t.linkContent=n,t.pos=e,!0))}function yi(t,e){var i,o=e,n=t.posMax,s=t.src.charCodeAt(e);if(34!==s&&39!==s&&40!==s)return!1;for(e++,40===s&&(s=41);e<n;){if((i=t.src.charCodeAt(e))===s)return t.pos=e+1,t.linkContent=Xe(t.src.slice(o+1,e)),!0;92===i&&e+1<n?e+=2:e++}return!1}function xi(t){return t.trim().replace(/\s+/g," ").toUpperCase()}function _i(t,e,i,o){var n,s,r,a,l,d,c,h,u;if(91!==t.charCodeAt(0))return-1;if(-1===t.indexOf("]:"))return-1;if((s=gi(n=new mi(t,e,i,o,[]),0))<0||58!==t.charCodeAt(s+1))return-1;for(a=n.posMax,r=s+2;r<a&&(32===(l=n.src.charCodeAt(r))||10===l);r++);if(!bi(n,r))return-1;for(c=n.linkContent,d=r=n.pos,r+=1;r<a&&(32===(l=n.src.charCodeAt(r))||10===l);r++);for(r<a&&d!==r&&yi(n,r)?(h=n.linkContent,r=n.pos):(h="",r=d);r<a&&32===n.src.charCodeAt(r);)r++;return r<a&&10!==n.src.charCodeAt(r)?-1:(u=xi(t.slice(1,s)),void 0===o.references[u]&&(o.references[u]={title:h,href:c}),r)}ui.prototype.renderInline=function(t,e,i){for(var o=this.rules,n=t.length,s=0,r="";n--;)r+=o[t[s].type](t,s++,e,i,this);return r},ui.prototype.render=function(t,e,i){for(var o=this.rules,n=t.length,s=-1,r="";++s<n;)"inline"===t[s].type?r+=this.renderInline(t[s].children,e,i):r+=o[t[s].type](t,s,e,i,this);return r},pi.prototype.__find__=function(t){for(var e=this.__rules__.length,i=-1;e--;)if(this.__rules__[++i].name===t)return i;return-1},pi.prototype.__compile__=function(){var t=this,e=[""];t.__rules__.forEach((function(t){t.enabled&&t.alt.forEach((function(t){e.indexOf(t)<0&&e.push(t)}))})),t.__cache__={},e.forEach((function(e){t.__cache__[e]=[],t.__rules__.forEach((function(i){i.enabled&&(e&&i.alt.indexOf(e)<0||t.__cache__[e].push(i.fn))}))}))},pi.prototype.at=function(t,e,i){var o=this.__find__(t),n=i||{};if(-1===o)throw new Error("Parser rule not found: "+t);this.__rules__[o].fn=e,this.__rules__[o].alt=n.alt||[],this.__cache__=null},pi.prototype.before=function(t,e,i,o){var n=this.__find__(t),s=o||{};if(-1===n)throw new Error("Parser rule not found: "+t);this.__rules__.splice(n,0,{name:e,enabled:!0,fn:i,alt:s.alt||[]}),this.__cache__=null},pi.prototype.after=function(t,e,i,o){var n=this.__find__(t),s=o||{};if(-1===n)throw new Error("Parser rule not found: "+t);this.__rules__.splice(n+1,0,{name:e,enabled:!0,fn:i,alt:s.alt||[]}),this.__cache__=null},pi.prototype.push=function(t,e,i){var o=i||{};this.__rules__.push({name:t,enabled:!0,fn:e,alt:o.alt||[]}),this.__cache__=null},pi.prototype.enable=function(t,e){t=Array.isArray(t)?t:[t],e&&this.__rules__.forEach((function(t){t.enabled=!1})),t.forEach((function(t){var e=this.__find__(t);if(e<0)throw new Error("Rules manager: invalid rule name "+t);this.__rules__[e].enabled=!0}),this),this.__cache__=null},pi.prototype.disable=function(t){(t=Array.isArray(t)?t:[t]).forEach((function(t){var e=this.__find__(t);if(e<0)throw new Error("Rules manager: invalid rule name "+t);this.__rules__[e].enabled=!1}),this),this.__cache__=null},pi.prototype.getRules=function(t){return null===this.__cache__&&this.__compile__(),this.__cache__[t]||[]},mi.prototype.pushPending=function(){this.tokens.push({type:"text",content:this.pending,level:this.pendingLevel}),this.pending=""},mi.prototype.push=function(t){this.pending&&this.pushPending(),this.tokens.push(t),this.pendingLevel=this.level},mi.prototype.cacheSet=function(t,e){for(var i=this.cache.length;i<=t;i++)this.cache.push(0);this.cache[t]=e},mi.prototype.cacheGet=function(t){return t<this.cache.length?this.cache[t]:0};var wi=" \n()[]'\".,!?-";function ki(t){return t.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1")}var Ci=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,Si=/\((c|tm|r|p)\)/gi,Ai={c:"©",r:"®",p:"§",tm:"™"};var Ei=/['"]/,$i=/['"]/g,Ti=/[-\s()\[\]]/;function Di(t,e){return!(e<0||e>=t.length)&&!Ti.test(t[e])}function Mi(t,e,i){return t.substr(0,e)+i+t.substr(e+1)}var Ii=[["block",function(t){t.inlineMode?t.tokens.push({type:"inline",content:t.src.replace(/\n/g," ").trim(),level:0,lines:[0,1],children:[]}):t.block.parse(t.src,t.options,t.env,t.tokens)}],["abbr",function(t){var e,i,o,n,s=t.tokens;if(!t.inlineMode)for(e=1,i=s.length-1;e<i;e++)if("paragraph_open"===s[e-1].type&&"inline"===s[e].type&&"paragraph_close"===s[e+1].type){for(o=s[e].content;o.length&&!((n=fi(o,t.inline,t.options,t.env))<0);)o=o.slice(n).trim();s[e].content=o,o.length||(s[e-1].tight=!0,s[e+1].tight=!0)}}],["references",function(t){var e,i,o,n,s=t.tokens;if(t.env.references=t.env.references||{},!t.inlineMode)for(e=1,i=s.length-1;e<i;e++)if("inline"===s[e].type&&"paragraph_open"===s[e-1].type&&"paragraph_close"===s[e+1].type){for(o=s[e].content;o.length&&!((n=_i(o,t.inline,t.options,t.env))<0);)o=o.slice(n).trim();s[e].content=o,o.length||(s[e-1].tight=!0,s[e+1].tight=!0)}}],["inline",function(t){var e,i,o,n=t.tokens;for(i=0,o=n.length;i<o;i++)"inline"===(e=n[i]).type&&t.inline.parse(e.content,t.options,t.env,e.children)}],["footnote_tail",function(t){var e,i,o,n,s,r,a,l,d,c=0,h=!1,u={};if(t.env.footnotes&&(t.tokens=t.tokens.filter((function(t){return"footnote_reference_open"===t.type?(h=!0,l=[],d=t.label,!1):"footnote_reference_close"===t.type?(h=!1,u[":"+d]=l,!1):(h&&l.push(t),!h)})),t.env.footnotes.list)){for(r=t.env.footnotes.list,t.tokens.push({type:"footnote_block_open",level:c++}),e=0,i=r.length;e<i;e++){for(t.tokens.push({type:"footnote_open",id:e,level:c++}),r[e].tokens?((a=[]).push({type:"paragraph_open",tight:!1,level:c++}),a.push({type:"inline",content:"",level:c,children:r[e].tokens}),a.push({type:"paragraph_close",tight:!1,level:--c})):r[e].label&&(a=u[":"+r[e].label]),t.tokens=t.tokens.concat(a),s="paragraph_close"===t.tokens[t.tokens.length-1].type?t.tokens.pop():null,n=r[e].count>0?r[e].count:1,o=0;o<n;o++)t.tokens.push({type:"footnote_anchor",id:e,subId:o,level:c});s&&t.tokens.push(s),t.tokens.push({type:"footnote_close",level:--c})}t.tokens.push({type:"footnote_block_close",level:--c})}}],["abbr2",function(t){var e,i,o,n,s,r,a,l,d,c,h,u,p=t.tokens;if(t.env.abbreviations)for(t.env.abbrRegExp||(u="(^|["+wi.split("").map(ki).join("")+"])("+Object.keys(t.env.abbreviations).map((function(t){return t.substr(1)})).sort((function(t,e){return e.length-t.length})).map(ki).join("|")+")($|["+wi.split("").map(ki).join("")+"])",t.env.abbrRegExp=new RegExp(u,"g")),c=t.env.abbrRegExp,i=0,o=p.length;i<o;i++)if("inline"===p[i].type)for(e=(n=p[i].children).length-1;e>=0;e--)if("text"===(s=n[e]).type){for(l=0,r=s.content,c.lastIndex=0,d=s.level,a=[];h=c.exec(r);)c.lastIndex>l&&a.push({type:"text",content:r.slice(l,h.index+h[1].length),level:d}),a.push({type:"abbr_open",title:t.env.abbreviations[":"+h[2]],level:d++}),a.push({type:"text",content:h[2],level:d}),a.push({type:"abbr_close",level:--d}),l=c.lastIndex-h[3].length;a.length&&(l<r.length&&a.push({type:"text",content:r.slice(l),level:d}),p[i].children=n=[].concat(n.slice(0,e),a,n.slice(e+1)))}}],["replacements",function(t){var e,i,o,n,s,r;if(t.options.typographer)for(s=t.tokens.length-1;s>=0;s--)if("inline"===t.tokens[s].type)for(e=(n=t.tokens[s].children).length-1;e>=0;e--)"text"===(i=n[e]).type&&(o=i.content,o=(r=o).indexOf("(")<0?r:r.replace(Si,(function(t,e){return Ai[e.toLowerCase()]})),Ci.test(o)&&(o=o.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---([^-]|$)/gm,"$1—$2").replace(/(^|\s)--(\s|$)/gm,"$1–$2").replace(/(^|[^-\s])--([^-\s]|$)/gm,"$1–$2")),i.content=o)}],["smartquotes",function(t){var e,i,o,n,s,r,a,l,d,c,h,u,p,m,g,f,v;if(t.options.typographer)for(v=[],g=t.tokens.length-1;g>=0;g--)if("inline"===t.tokens[g].type)for(f=t.tokens[g].children,v.length=0,e=0;e<f.length;e++)if("text"===(i=f[e]).type&&!Ei.test(i.text)){for(a=f[e].level,p=v.length-1;p>=0&&!(v[p].level<=a);p--);v.length=p+1,s=0,r=(o=i.content).length;t:for(;s<r&&($i.lastIndex=s,n=$i.exec(o));)if(l=!Di(o,n.index-1),s=n.index+1,m="'"===n[0],(d=!Di(o,s))||l){if(h=!d,u=!l)for(p=v.length-1;p>=0&&(c=v[p],!(v[p].level<a));p--)if(c.single===m&&v[p].level===a){c=v[p],m?(f[c.token].content=Mi(f[c.token].content,c.pos,t.options.quotes[2]),i.content=Mi(i.content,n.index,t.options.quotes[3])):(f[c.token].content=Mi(f[c.token].content,c.pos,t.options.quotes[0]),i.content=Mi(i.content,n.index,t.options.quotes[1])),v.length=p;continue t}h?v.push({token:e,pos:n.index,single:m,level:a}):u&&m&&(i.content=Mi(i.content,n.index,"’"))}else m&&(i.content=Mi(i.content,n.index,"’"))}}]];function Oi(){this.options={},this.ruler=new pi;for(var t=0;t<Ii.length;t++)this.ruler.push(Ii[t][0],Ii[t][1])}function Li(t,e,i,o,n){var s,r,a,l,d,c,h;for(this.src=t,this.parser=e,this.options=i,this.env=o,this.tokens=n,this.bMarks=[],this.eMarks=[],this.tShift=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.parentType="root",this.ddIndent=-1,this.level=0,this.result="",c=0,h=!1,a=l=c=0,d=(r=this.src).length;l<d;l++){if(s=r.charCodeAt(l),!h){if(32===s){c++;continue}h=!0}10!==s&&l!==d-1||(10!==s&&l++,this.bMarks.push(a),this.eMarks.push(l),this.tShift.push(c),h=!1,c=0,a=l+1)}this.bMarks.push(r.length),this.eMarks.push(r.length),this.tShift.push(0),this.lineMax=this.bMarks.length-1}function zi(t,e){var i,o,n;return(o=t.bMarks[e]+t.tShift[e])>=(n=t.eMarks[e])||42!==(i=t.src.charCodeAt(o++))&&45!==i&&43!==i||o<n&&32!==t.src.charCodeAt(o)?-1:o}function Pi(t,e){var i,o=t.bMarks[e]+t.tShift[e],n=t.eMarks[e];if(o+1>=n)return-1;if((i=t.src.charCodeAt(o++))<48||i>57)return-1;for(;;){if(o>=n)return-1;if(!((i=t.src.charCodeAt(o++))>=48&&i<=57)){if(41===i||46===i)break;return-1}}return o<n&&32!==t.src.charCodeAt(o)?-1:o}Oi.prototype.process=function(t){var e,i,o;for(e=0,i=(o=this.ruler.getRules("")).length;e<i;e++)o[e](t)},Li.prototype.isEmpty=function(t){return this.bMarks[t]+this.tShift[t]>=this.eMarks[t]},Li.prototype.skipEmptyLines=function(t){for(var e=this.lineMax;t<e&&!(this.bMarks[t]+this.tShift[t]<this.eMarks[t]);t++);return t},Li.prototype.skipSpaces=function(t){for(var e=this.src.length;t<e&&32===this.src.charCodeAt(t);t++);return t},Li.prototype.skipChars=function(t,e){for(var i=this.src.length;t<i&&this.src.charCodeAt(t)===e;t++);return t},Li.prototype.skipCharsBack=function(t,e,i){if(t<=i)return t;for(;t>i;)if(e!==this.src.charCodeAt(--t))return t+1;return t},Li.prototype.getLines=function(t,e,i,o){var n,s,r,a,l,d=t;if(t>=e)return"";if(d+1===e)return s=this.bMarks[d]+Math.min(this.tShift[d],i),r=o?this.eMarks[d]+1:this.eMarks[d],this.src.slice(s,r);for(a=new Array(e-t),n=0;d<e;d++,n++)(l=this.tShift[d])>i&&(l=i),l<0&&(l=0),s=this.bMarks[d]+l,r=d+1<e||o?this.eMarks[d]+1:this.eMarks[d],a[n]=this.src.slice(s,r);return a.join("")};var Ri={};["article","aside","button","blockquote","body","canvas","caption","col","colgroup","dd","div","dl","dt","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","iframe","li","map","object","ol","output","p","pre","progress","script","section","style","table","tbody","td","textarea","tfoot","th","tr","thead","ul","video"].forEach((function(t){Ri[t]=!0}));var Ni=/^<([a-zA-Z]{1,15})[\s\/>]/,Bi=/^<\/([a-zA-Z]{1,15})[\s>]/;function Fi(t,e){var i=t.bMarks[e]+t.blkIndent,o=t.eMarks[e];return t.src.substr(i,o-i)}function qi(t,e){var i,o,n=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];return n>=s||126!==(o=t.src.charCodeAt(n++))&&58!==o||n===(i=t.skipSpaces(n))||i>=s?-1:i}var Ui=[["code",function(t,e,i){var o,n;if(t.tShift[e]-t.blkIndent<4)return!1;for(n=o=e+1;o<i;)if(t.isEmpty(o))o++;else{if(!(t.tShift[o]-t.blkIndent>=4))break;n=++o}return t.line=o,t.tokens.push({type:"code",content:t.getLines(e,n,4+t.blkIndent,!0),block:!0,lines:[e,t.line],level:t.level}),!0}],["fences",function(t,e,i,o){var n,s,r,a,l,d=!1,c=t.bMarks[e]+t.tShift[e],h=t.eMarks[e];if(c+3>h)return!1;if(126!==(n=t.src.charCodeAt(c))&&96!==n)return!1;if(l=c,(s=(c=t.skipChars(c,n))-l)<3)return!1;if((r=t.src.slice(c,h).trim()).indexOf("`")>=0)return!1;if(o)return!0;for(a=e;!(++a>=i)&&!((c=l=t.bMarks[a]+t.tShift[a])<(h=t.eMarks[a])&&t.tShift[a]<t.blkIndent);)if(t.src.charCodeAt(c)===n&&!(t.tShift[a]-t.blkIndent>=4||(c=t.skipChars(c,n))-l<s||(c=t.skipSpaces(c))<h)){d=!0;break}return s=t.tShift[e],t.line=a+(d?1:0),t.tokens.push({type:"fence",params:r,content:t.getLines(e+1,a,s,!0),lines:[e,t.line],level:t.level}),!0},["paragraph","blockquote","list"]],["blockquote",function(t,e,i,o){var n,s,r,a,l,d,c,h,u,p,m,g=t.bMarks[e]+t.tShift[e],f=t.eMarks[e];if(g>f)return!1;if(62!==t.src.charCodeAt(g++))return!1;if(t.level>=t.options.maxNesting)return!1;if(o)return!0;for(32===t.src.charCodeAt(g)&&g++,l=t.blkIndent,t.blkIndent=0,a=[t.bMarks[e]],t.bMarks[e]=g,s=(g=g<f?t.skipSpaces(g):g)>=f,r=[t.tShift[e]],t.tShift[e]=g-t.bMarks[e],h=t.parser.ruler.getRules("blockquote"),n=e+1;n<i&&!((g=t.bMarks[n]+t.tShift[n])>=(f=t.eMarks[n]));n++)if(62!==t.src.charCodeAt(g++)){if(s)break;for(m=!1,u=0,p=h.length;u<p;u++)if(h[u](t,n,i,!0)){m=!0;break}if(m)break;a.push(t.bMarks[n]),r.push(t.tShift[n]),t.tShift[n]=-1337}else 32===t.src.charCodeAt(g)&&g++,a.push(t.bMarks[n]),t.bMarks[n]=g,s=(g=g<f?t.skipSpaces(g):g)>=f,r.push(t.tShift[n]),t.tShift[n]=g-t.bMarks[n];for(d=t.parentType,t.parentType="blockquote",t.tokens.push({type:"blockquote_open",lines:c=[e,0],level:t.level++}),t.parser.tokenize(t,e,n),t.tokens.push({type:"blockquote_close",level:--t.level}),t.parentType=d,c[1]=t.line,u=0;u<r.length;u++)t.bMarks[u+e]=a[u],t.tShift[u+e]=r[u];return t.blkIndent=l,!0},["paragraph","blockquote","list"]],["hr",function(t,e,i,o){var n,s,r,a=t.bMarks[e],l=t.eMarks[e];if((a+=t.tShift[e])>l)return!1;if(42!==(n=t.src.charCodeAt(a++))&&45!==n&&95!==n)return!1;for(s=1;a<l;){if((r=t.src.charCodeAt(a++))!==n&&32!==r)return!1;r===n&&s++}return!(s<3)&&(o||(t.line=e+1,t.tokens.push({type:"hr",lines:[e,t.line],level:t.level})),!0)},["paragraph","blockquote","list"]],["list",function(t,e,i,o){var n,s,r,a,l,d,c,h,u,p,m,g,f,v,b,y,x,_,w,k,C,S=!0;if((h=Pi(t,e))>=0)g=!0;else{if(!((h=zi(t,e))>=0))return!1;g=!1}if(t.level>=t.options.maxNesting)return!1;if(m=t.src.charCodeAt(h-1),o)return!0;for(v=t.tokens.length,g?(c=t.bMarks[e]+t.tShift[e],p=Number(t.src.substr(c,h-c-1)),t.tokens.push({type:"ordered_list_open",order:p,lines:y=[e,0],level:t.level++})):t.tokens.push({type:"bullet_list_open",lines:y=[e,0],level:t.level++}),n=e,b=!1,_=t.parser.ruler.getRules("list");!(!(n<i)||((u=(f=t.skipSpaces(h))>=t.eMarks[n]?1:f-h)>4&&(u=1),u<1&&(u=1),s=h-t.bMarks[n]+u,t.tokens.push({type:"list_item_open",lines:x=[e,0],level:t.level++}),a=t.blkIndent,l=t.tight,r=t.tShift[e],d=t.parentType,t.tShift[e]=f-t.bMarks[e],t.blkIndent=s,t.tight=!0,t.parentType="list",t.parser.tokenize(t,e,i,!0),t.tight&&!b||(S=!1),b=t.line-e>1&&t.isEmpty(t.line-1),t.blkIndent=a,t.tShift[e]=r,t.tight=l,t.parentType=d,t.tokens.push({type:"list_item_close",level:--t.level}),n=e=t.line,x[1]=n,f=t.bMarks[e],n>=i)||t.isEmpty(n)||t.tShift[n]<t.blkIndent);){for(C=!1,w=0,k=_.length;w<k;w++)if(_[w](t,n,i,!0)){C=!0;break}if(C)break;if(g){if((h=Pi(t,n))<0)break}else if((h=zi(t,n))<0)break;if(m!==t.src.charCodeAt(h-1))break}return t.tokens.push({type:g?"ordered_list_close":"bullet_list_close",level:--t.level}),y[1]=n,t.line=n,S&&function(t,e){var i,o,n=t.level+2;for(i=e+2,o=t.tokens.length-2;i<o;i++)t.tokens[i].level===n&&"paragraph_open"===t.tokens[i].type&&(t.tokens[i+2].tight=!0,t.tokens[i].tight=!0,i+=2)}(t,v),!0},["paragraph","blockquote"]],["footnote",function(t,e,i,o){var n,s,r,a,l,d=t.bMarks[e]+t.tShift[e],c=t.eMarks[e];if(d+4>c)return!1;if(91!==t.src.charCodeAt(d))return!1;if(94!==t.src.charCodeAt(d+1))return!1;if(t.level>=t.options.maxNesting)return!1;for(a=d+2;a<c;a++){if(32===t.src.charCodeAt(a))return!1;if(93===t.src.charCodeAt(a))break}return a!==d+2&&(!(a+1>=c||58!==t.src.charCodeAt(++a))&&(o||(a++,t.env.footnotes||(t.env.footnotes={}),t.env.footnotes.refs||(t.env.footnotes.refs={}),l=t.src.slice(d+2,a-2),t.env.footnotes.refs[":"+l]=-1,t.tokens.push({type:"footnote_reference_open",label:l,level:t.level++}),n=t.bMarks[e],s=t.tShift[e],r=t.parentType,t.tShift[e]=t.skipSpaces(a)-a,t.bMarks[e]=a,t.blkIndent+=4,t.parentType="footnote",t.tShift[e]<t.blkIndent&&(t.tShift[e]+=t.blkIndent,t.bMarks[e]-=t.blkIndent),t.parser.tokenize(t,e,i,!0),t.parentType=r,t.blkIndent-=4,t.tShift[e]=s,t.bMarks[e]=n,t.tokens.push({type:"footnote_reference_close",level:--t.level})),!0))},["paragraph"]],["heading",function(t,e,i,o){var n,s,r,a=t.bMarks[e]+t.tShift[e],l=t.eMarks[e];if(a>=l)return!1;if(35!==(n=t.src.charCodeAt(a))||a>=l)return!1;for(s=1,n=t.src.charCodeAt(++a);35===n&&a<l&&s<=6;)s++,n=t.src.charCodeAt(++a);return!(s>6||a<l&&32!==n)&&(o||(l=t.skipCharsBack(l,32,a),(r=t.skipCharsBack(l,35,a))>a&&32===t.src.charCodeAt(r-1)&&(l=r),t.line=e+1,t.tokens.push({type:"heading_open",hLevel:s,lines:[e,t.line],level:t.level}),a<l&&t.tokens.push({type:"inline",content:t.src.slice(a,l).trim(),level:t.level+1,lines:[e,t.line],children:[]}),t.tokens.push({type:"heading_close",hLevel:s,level:t.level})),!0)},["paragraph","blockquote"]],["lheading",function(t,e,i){var o,n,s,r=e+1;return!(r>=i)&&(!(t.tShift[r]<t.blkIndent)&&(!(t.tShift[r]-t.blkIndent>3)&&(!((n=t.bMarks[r]+t.tShift[r])>=(s=t.eMarks[r]))&&((45===(o=t.src.charCodeAt(n))||61===o)&&(n=t.skipChars(n,o),!((n=t.skipSpaces(n))<s)&&(n=t.bMarks[e]+t.tShift[e],t.line=r+1,t.tokens.push({type:"heading_open",hLevel:61===o?1:2,lines:[e,t.line],level:t.level}),t.tokens.push({type:"inline",content:t.src.slice(n,t.eMarks[e]).trim(),level:t.level+1,lines:[e,t.line-1],children:[]}),t.tokens.push({type:"heading_close",hLevel:61===o?1:2,level:t.level}),!0))))))}],["htmlblock",function(t,e,i,o){var n,s,r,a=t.bMarks[e],l=t.eMarks[e],d=t.tShift[e];if(a+=d,!t.options.html)return!1;if(d>3||a+2>=l)return!1;if(60!==t.src.charCodeAt(a))return!1;if(33===(n=t.src.charCodeAt(a+1))||63===n){if(o)return!0}else{if(47!==n&&!function(t){var e=32|t;return e>=97&&e<=122}(n))return!1;if(47===n){if(!(s=t.src.slice(a,l).match(Bi)))return!1}else if(!(s=t.src.slice(a,l).match(Ni)))return!1;if(!0!==Ri[s[1].toLowerCase()])return!1;if(o)return!0}for(r=e+1;r<t.lineMax&&!t.isEmpty(r);)r++;return t.line=r,t.tokens.push({type:"htmlblock",level:t.level,lines:[e,t.line],content:t.getLines(e,r,0,!0)}),!0},["paragraph","blockquote"]],["table",function(t,e,i,o){var n,s,r,a,l,d,c,h,u,p,m;if(e+2>i)return!1;if(l=e+1,t.tShift[l]<t.blkIndent)return!1;if((r=t.bMarks[l]+t.tShift[l])>=t.eMarks[l])return!1;if(124!==(n=t.src.charCodeAt(r))&&45!==n&&58!==n)return!1;if(s=Fi(t,e+1),!/^[-:| ]+$/.test(s))return!1;if((d=s.split("|"))<=2)return!1;for(h=[],a=0;a<d.length;a++){if(!(u=d[a].trim())){if(0===a||a===d.length-1)continue;return!1}if(!/^:?-+:?$/.test(u))return!1;58===u.charCodeAt(u.length-1)?h.push(58===u.charCodeAt(0)?"center":"right"):58===u.charCodeAt(0)?h.push("left"):h.push("")}if(-1===(s=Fi(t,e).trim()).indexOf("|"))return!1;if(d=s.replace(/^\||\|$/g,"").split("|"),h.length!==d.length)return!1;if(o)return!0;for(t.tokens.push({type:"table_open",lines:p=[e,0],level:t.level++}),t.tokens.push({type:"thead_open",lines:[e,e+1],level:t.level++}),t.tokens.push({type:"tr_open",lines:[e,e+1],level:t.level++}),a=0;a<d.length;a++)t.tokens.push({type:"th_open",align:h[a],lines:[e,e+1],level:t.level++}),t.tokens.push({type:"inline",content:d[a].trim(),lines:[e,e+1],level:t.level,children:[]}),t.tokens.push({type:"th_close",level:--t.level});for(t.tokens.push({type:"tr_close",level:--t.level}),t.tokens.push({type:"thead_close",level:--t.level}),t.tokens.push({type:"tbody_open",lines:m=[e+2,0],level:t.level++}),l=e+2;l<i&&!(t.tShift[l]<t.blkIndent)&&-1!==(s=Fi(t,l).trim()).indexOf("|");l++){for(d=s.replace(/^\||\|$/g,"").split("|"),t.tokens.push({type:"tr_open",level:t.level++}),a=0;a<d.length;a++)t.tokens.push({type:"td_open",align:h[a],level:t.level++}),c=d[a].substring(124===d[a].charCodeAt(0)?1:0,124===d[a].charCodeAt(d[a].length-1)?d[a].length-1:d[a].length).trim(),t.tokens.push({type:"inline",content:c,level:t.level,children:[]}),t.tokens.push({type:"td_close",level:--t.level});t.tokens.push({type:"tr_close",level:--t.level})}return t.tokens.push({type:"tbody_close",level:--t.level}),t.tokens.push({type:"table_close",level:--t.level}),p[1]=m[1]=l,t.line=l,!0},["paragraph"]],["deflist",function(t,e,i,o){var n,s,r,a,l,d,c,h,u,p,m,g,f,v;if(o)return!(t.ddIndent<0)&&qi(t,e)>=0;if(c=e+1,t.isEmpty(c)&&++c>i)return!1;if(t.tShift[c]<t.blkIndent)return!1;if((n=qi(t,c))<0)return!1;if(t.level>=t.options.maxNesting)return!1;d=t.tokens.length,t.tokens.push({type:"dl_open",lines:l=[e,0],level:t.level++}),r=e,s=c;t:for(;;){for(v=!0,f=!1,t.tokens.push({type:"dt_open",lines:[r,r],level:t.level++}),t.tokens.push({type:"inline",content:t.getLines(r,r+1,t.blkIndent,!1).trim(),level:t.level+1,lines:[r,r],children:[]}),t.tokens.push({type:"dt_close",level:--t.level});;){if(t.tokens.push({type:"dd_open",lines:a=[c,0],level:t.level++}),g=t.tight,u=t.ddIndent,h=t.blkIndent,m=t.tShift[s],p=t.parentType,t.blkIndent=t.ddIndent=t.tShift[s]+2,t.tShift[s]=n-t.bMarks[s],t.tight=!0,t.parentType="deflist",t.parser.tokenize(t,s,i,!0),t.tight&&!f||(v=!1),f=t.line-s>1&&t.isEmpty(t.line-1),t.tShift[s]=m,t.tight=g,t.parentType=p,t.blkIndent=h,t.ddIndent=u,t.tokens.push({type:"dd_close",level:--t.level}),a[1]=c=t.line,c>=i)break t;if(t.tShift[c]<t.blkIndent)break t;if((n=qi(t,c))<0)break;s=c}if(c>=i)break;if(r=c,t.isEmpty(r))break;if(t.tShift[r]<t.blkIndent)break;if((s=r+1)>=i)break;if(t.isEmpty(s)&&s++,s>=i)break;if(t.tShift[s]<t.blkIndent)break;if((n=qi(t,s))<0)break}return t.tokens.push({type:"dl_close",level:--t.level}),l[1]=c,t.line=c,v&&function(t,e){var i,o,n=t.level+2;for(i=e+2,o=t.tokens.length-2;i<o;i++)t.tokens[i].level===n&&"paragraph_open"===t.tokens[i].type&&(t.tokens[i+2].tight=!0,t.tokens[i].tight=!0,i+=2)}(t,d),!0},["paragraph"]],["paragraph",function(t,e){var i,o,n,s,r,a,l=e+1;if(l<(i=t.lineMax)&&!t.isEmpty(l))for(a=t.parser.ruler.getRules("paragraph");l<i&&!t.isEmpty(l);l++)if(!(t.tShift[l]-t.blkIndent>3)){for(n=!1,s=0,r=a.length;s<r;s++)if(a[s](t,l,i,!0)){n=!0;break}if(n)break}return o=t.getLines(e,l,t.blkIndent,!1).trim(),t.line=l,o.length&&(t.tokens.push({type:"paragraph_open",tight:!1,lines:[e,t.line],level:t.level}),t.tokens.push({type:"inline",content:o,level:t.level+1,lines:[e,t.line],children:[]}),t.tokens.push({type:"paragraph_close",tight:!1,level:t.level})),!0}]];function ji(){this.ruler=new pi;for(var t=0;t<Ui.length;t++)this.ruler.push(Ui[t][0],Ui[t][1],{alt:(Ui[t][2]||[]).slice()})}ji.prototype.tokenize=function(t,e,i){for(var o,n=this.ruler.getRules(""),s=n.length,r=e,a=!1;r<i&&(t.line=r=t.skipEmptyLines(r),!(r>=i))&&!(t.tShift[r]<t.blkIndent);){for(o=0;o<s&&!n[o](t,r,i,!1);o++);if(t.tight=!a,t.isEmpty(t.line-1)&&(a=!0),(r=t.line)<i&&t.isEmpty(r)){if(a=!0,++r<i&&"list"===t.parentType&&t.isEmpty(r))break;t.line=r}}};var Vi=/[\n\t]/g,Hi=/\r[\n\u0085]|[\u2424\u2028\u0085]/g,Wi=/\u00a0/g;function Zi(t){switch(t){case 10:case 92:case 96:case 42:case 95:case 94:case 91:case 93:case 33:case 38:case 60:case 62:case 123:case 125:case 36:case 37:case 64:case 126:case 43:case 61:case 58:return!0;default:return!1}}ji.prototype.parse=function(t,e,i,o){var n,s=0,r=0;if(!t)return[];(t=(t=t.replace(Wi," ")).replace(Hi,"\n")).indexOf("\t")>=0&&(t=t.replace(Vi,(function(e,i){var o;return 10===t.charCodeAt(i)?(s=i+1,r=0,e):(o=" ".slice((i-s-r)%4),r=i-s+1,o)}))),n=new Li(t,this,e,i,o),this.tokenize(n,n.line,n.lineMax)};for(var Yi=[],Gi=0;Gi<256;Gi++)Yi.push(0);function Ki(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122}function Xi(t,e){var i,o,n,s=e,r=!0,a=!0,l=t.posMax,d=t.src.charCodeAt(e);for(i=e>0?t.src.charCodeAt(e-1):-1;s<l&&t.src.charCodeAt(s)===d;)s++;return s>=l&&(r=!1),(n=s-e)>=4?r=a=!1:(32!==(o=s<l?t.src.charCodeAt(s):-1)&&10!==o||(r=!1),32!==i&&10!==i||(a=!1),95===d&&(Ki(i)&&(r=!1),Ki(o)&&(a=!1))),{can_open:r,can_close:a,delims:n}}"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach((function(t){Yi[t.charCodeAt(0)]=1}));var Qi=/\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;var Ji=/\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;var to=["coap","doi","javascript","aaa","aaas","about","acap","cap","cid","crid","data","dav","dict","dns","file","ftp","geo","go","gopher","h323","http","https","iax","icap","im","imap","info","ipp","iris","iris.beep","iris.xpc","iris.xpcs","iris.lwz","ldap","mailto","mid","msrp","msrps","mtqp","mupdate","news","nfs","ni","nih","nntp","opaquelocktoken","pop","pres","rtsp","service","session","shttp","sieve","sip","sips","sms","snmp","soap.beep","soap.beeps","tag","tel","telnet","tftp","thismessage","tn3270","tip","tv","urn","vemmi","ws","wss","xcon","xcon-userid","xmlrpc.beep","xmlrpc.beeps","xmpp","z39.50r","z39.50s","adiumxtra","afp","afs","aim","apt","attachment","aw","beshare","bitcoin","bolo","callto","chrome","chrome-extension","com-eventbrite-attendee","content","cvs","dlna-playsingle","dlna-playcontainer","dtn","dvb","ed2k","facetime","feed","finger","fish","gg","git","gizmoproject","gtalk","hcp","icon","ipn","irc","irc6","ircs","itms","jar","jms","keyparc","lastfm","ldaps","magnet","maps","market","message","mms","ms-help","msnim","mumble","mvn","notes","oid","palm","paparazzi","platform","proxy","psyc","query","res","resource","rmi","rsync","rtmp","secondlife","sftp","sgn","skype","smb","soldat","spotify","ssh","steam","svn","teamspeak","things","udp","unreal","ut2004","ventrilo","view-source","webcal","wtai","wyciwyg","xfire","xri","ymsgr"],eo=/^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/,io=/^<([a-zA-Z.\-]{1,25}):([^<>\x00-\x20]*)>/;function oo(t,e){return t=t.source,e=e||"",function i(o,n){return o?(n=n.source||n,t=t.replace(o,n),i):new RegExp(t,e)}}var no=oo(/(?:unquoted|single_quoted|double_quoted)/)("unquoted",/[^"'=<>`\x00-\x20]+/)("single_quoted",/'[^']*'/)("double_quoted",/"[^"]*"/)(),so=oo(/(?:\s+attr_name(?:\s*=\s*attr_value)?)/)("attr_name",/[a-zA-Z_:][a-zA-Z0-9:._-]*/)("attr_value",no)(),ro=oo(/<[A-Za-z][A-Za-z0-9]*attribute*\s*\/?>/)("attribute",so)(),ao=oo(/^(?:open_tag|close_tag|comment|processing|declaration|cdata)/)("open_tag",ro)("close_tag",/<\/[A-Za-z][A-Za-z0-9]*\s*>/)("comment",/<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->/)("processing",/<[?].*?[?]>/)("declaration",/<![A-Z]+\s+[^>]*>/)("cdata",/<!\[CDATA\[[\s\S]*?\]\]>/)();var lo=/^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i,co=/^&([a-z][a-z0-9]{1,31});/i;var ho=[["text",function(t,e){for(var i=t.pos;i<t.posMax&&!Zi(t.src.charCodeAt(i));)i++;return i!==t.pos&&(e||(t.pending+=t.src.slice(t.pos,i)),t.pos=i,!0)}],["newline",function(t,e){var i,o,n=t.pos;if(10!==t.src.charCodeAt(n))return!1;if(i=t.pending.length-1,o=t.posMax,!e)if(i>=0&&32===t.pending.charCodeAt(i))if(i>=1&&32===t.pending.charCodeAt(i-1)){for(var s=i-2;s>=0;s--)if(32!==t.pending.charCodeAt(s)){t.pending=t.pending.substring(0,s+1);break}t.push({type:"hardbreak",level:t.level})}else t.pending=t.pending.slice(0,-1),t.push({type:"softbreak",level:t.level});else t.push({type:"softbreak",level:t.level});for(n++;n<o&&32===t.src.charCodeAt(n);)n++;return t.pos=n,!0}],["escape",function(t,e){var i,o=t.pos,n=t.posMax;if(92!==t.src.charCodeAt(o))return!1;if(++o<n){if((i=t.src.charCodeAt(o))<256&&0!==Yi[i])return e||(t.pending+=t.src[o]),t.pos+=2,!0;if(10===i){for(e||t.push({type:"hardbreak",level:t.level}),o++;o<n&&32===t.src.charCodeAt(o);)o++;return t.pos=o,!0}}return e||(t.pending+="\\"),t.pos++,!0}],["backticks",function(t,e){var i,o,n,s,r,a=t.pos;if(96!==t.src.charCodeAt(a))return!1;for(i=a,a++,o=t.posMax;a<o&&96===t.src.charCodeAt(a);)a++;for(n=t.src.slice(i,a),s=r=a;-1!==(s=t.src.indexOf("`",r));){for(r=s+1;r<o&&96===t.src.charCodeAt(r);)r++;if(r-s===n.length)return e||t.push({type:"code",content:t.src.slice(a,s).replace(/[ \n]+/g," ").trim(),block:!1,level:t.level}),t.pos=r,!0}return e||(t.pending+=n),t.pos+=n.length,!0}],["del",function(t,e){var i,o,n,s,r,a=t.posMax,l=t.pos;if(126!==t.src.charCodeAt(l))return!1;if(e)return!1;if(l+4>=a)return!1;if(126!==t.src.charCodeAt(l+1))return!1;if(t.level>=t.options.maxNesting)return!1;if(s=l>0?t.src.charCodeAt(l-1):-1,r=t.src.charCodeAt(l+2),126===s)return!1;if(126===r)return!1;if(32===r||10===r)return!1;for(o=l+2;o<a&&126===t.src.charCodeAt(o);)o++;if(o>l+3)return t.pos+=o-l,e||(t.pending+=t.src.slice(l,o)),!0;for(t.pos=l+2,n=1;t.pos+1<a;){if(126===t.src.charCodeAt(t.pos)&&126===t.src.charCodeAt(t.pos+1)&&(s=t.src.charCodeAt(t.pos-1),126!==(r=t.pos+2<a?t.src.charCodeAt(t.pos+2):-1)&&126!==s&&(32!==s&&10!==s?n--:32!==r&&10!==r&&n++,n<=0))){i=!0;break}t.parser.skipToken(t)}return i?(t.posMax=t.pos,t.pos=l+2,e||(t.push({type:"del_open",level:t.level++}),t.parser.tokenize(t),t.push({type:"del_close",level:--t.level})),t.pos=t.posMax+2,t.posMax=a,!0):(t.pos=l,!1)}],["ins",function(t,e){var i,o,n,s,r,a=t.posMax,l=t.pos;if(43!==t.src.charCodeAt(l))return!1;if(e)return!1;if(l+4>=a)return!1;if(43!==t.src.charCodeAt(l+1))return!1;if(t.level>=t.options.maxNesting)return!1;if(s=l>0?t.src.charCodeAt(l-1):-1,r=t.src.charCodeAt(l+2),43===s)return!1;if(43===r)return!1;if(32===r||10===r)return!1;for(o=l+2;o<a&&43===t.src.charCodeAt(o);)o++;if(o!==l+2)return t.pos+=o-l,e||(t.pending+=t.src.slice(l,o)),!0;for(t.pos=l+2,n=1;t.pos+1<a;){if(43===t.src.charCodeAt(t.pos)&&43===t.src.charCodeAt(t.pos+1)&&(s=t.src.charCodeAt(t.pos-1),43!==(r=t.pos+2<a?t.src.charCodeAt(t.pos+2):-1)&&43!==s&&(32!==s&&10!==s?n--:32!==r&&10!==r&&n++,n<=0))){i=!0;break}t.parser.skipToken(t)}return i?(t.posMax=t.pos,t.pos=l+2,e||(t.push({type:"ins_open",level:t.level++}),t.parser.tokenize(t),t.push({type:"ins_close",level:--t.level})),t.pos=t.posMax+2,t.posMax=a,!0):(t.pos=l,!1)}],["mark",function(t,e){var i,o,n,s,r,a=t.posMax,l=t.pos;if(61!==t.src.charCodeAt(l))return!1;if(e)return!1;if(l+4>=a)return!1;if(61!==t.src.charCodeAt(l+1))return!1;if(t.level>=t.options.maxNesting)return!1;if(s=l>0?t.src.charCodeAt(l-1):-1,r=t.src.charCodeAt(l+2),61===s)return!1;if(61===r)return!1;if(32===r||10===r)return!1;for(o=l+2;o<a&&61===t.src.charCodeAt(o);)o++;if(o!==l+2)return t.pos+=o-l,e||(t.pending+=t.src.slice(l,o)),!0;for(t.pos=l+2,n=1;t.pos+1<a;){if(61===t.src.charCodeAt(t.pos)&&61===t.src.charCodeAt(t.pos+1)&&(s=t.src.charCodeAt(t.pos-1),61!==(r=t.pos+2<a?t.src.charCodeAt(t.pos+2):-1)&&61!==s&&(32!==s&&10!==s?n--:32!==r&&10!==r&&n++,n<=0))){i=!0;break}t.parser.skipToken(t)}return i?(t.posMax=t.pos,t.pos=l+2,e||(t.push({type:"mark_open",level:t.level++}),t.parser.tokenize(t),t.push({type:"mark_close",level:--t.level})),t.pos=t.posMax+2,t.posMax=a,!0):(t.pos=l,!1)}],["emphasis",function(t,e){var i,o,n,s,r,a,l,d=t.posMax,c=t.pos,h=t.src.charCodeAt(c);if(95!==h&&42!==h)return!1;if(e)return!1;if(i=(l=Xi(t,c)).delims,!l.can_open)return t.pos+=i,e||(t.pending+=t.src.slice(c,t.pos)),!0;if(t.level>=t.options.maxNesting)return!1;for(t.pos=c+i,a=[i];t.pos<d;)if(t.src.charCodeAt(t.pos)!==h)t.parser.skipToken(t);else{if(o=(l=Xi(t,t.pos)).delims,l.can_close){for(s=a.pop(),r=o;s!==r;){if(r<s){a.push(s-r);break}if(r-=s,0===a.length)break;t.pos+=s,s=a.pop()}if(0===a.length){i=s,n=!0;break}t.pos+=o;continue}l.can_open&&a.push(o),t.pos+=o}return n?(t.posMax=t.pos,t.pos=c+i,e||(2!==i&&3!==i||t.push({type:"strong_open",level:t.level++}),1!==i&&3!==i||t.push({type:"em_open",level:t.level++}),t.parser.tokenize(t),1!==i&&3!==i||t.push({type:"em_close",level:--t.level}),2!==i&&3!==i||t.push({type:"strong_close",level:--t.level})),t.pos=t.posMax+i,t.posMax=d,!0):(t.pos=c,!1)}],["sub",function(t,e){var i,o,n=t.posMax,s=t.pos;if(126!==t.src.charCodeAt(s))return!1;if(e)return!1;if(s+2>=n)return!1;if(t.level>=t.options.maxNesting)return!1;for(t.pos=s+1;t.pos<n;){if(126===t.src.charCodeAt(t.pos)){i=!0;break}t.parser.skipToken(t)}return i&&s+1!==t.pos?(o=t.src.slice(s+1,t.pos)).match(/(^|[^\\])(\\\\)*\s/)?(t.pos=s,!1):(t.posMax=t.pos,t.pos=s+1,e||t.push({type:"sub",level:t.level,content:o.replace(Qi,"$1")}),t.pos=t.posMax+1,t.posMax=n,!0):(t.pos=s,!1)}],["sup",function(t,e){var i,o,n=t.posMax,s=t.pos;if(94!==t.src.charCodeAt(s))return!1;if(e)return!1;if(s+2>=n)return!1;if(t.level>=t.options.maxNesting)return!1;for(t.pos=s+1;t.pos<n;){if(94===t.src.charCodeAt(t.pos)){i=!0;break}t.parser.skipToken(t)}return i&&s+1!==t.pos?(o=t.src.slice(s+1,t.pos)).match(/(^|[^\\])(\\\\)*\s/)?(t.pos=s,!1):(t.posMax=t.pos,t.pos=s+1,e||t.push({type:"sup",level:t.level,content:o.replace(Ji,"$1")}),t.pos=t.posMax+1,t.posMax=n,!0):(t.pos=s,!1)}],["links",function(t,e){var i,o,n,s,r,a,l,d,c=!1,h=t.pos,u=t.posMax,p=t.pos,m=t.src.charCodeAt(p);if(33===m&&(c=!0,m=t.src.charCodeAt(++p)),91!==m)return!1;if(t.level>=t.options.maxNesting)return!1;if(i=p+1,(o=gi(t,p))<0)return!1;if((a=o+1)<u&&40===t.src.charCodeAt(a)){for(a++;a<u&&(32===(d=t.src.charCodeAt(a))||10===d);a++);if(a>=u)return!1;for(p=a,bi(t,a)?(s=t.linkContent,a=t.pos):s="",p=a;a<u&&(32===(d=t.src.charCodeAt(a))||10===d);a++);if(a<u&&p!==a&&yi(t,a))for(r=t.linkContent,a=t.pos;a<u&&(32===(d=t.src.charCodeAt(a))||10===d);a++);else r="";if(a>=u||41!==t.src.charCodeAt(a))return t.pos=h,!1;a++}else{if(t.linkLevel>0)return!1;for(;a<u&&(32===(d=t.src.charCodeAt(a))||10===d);a++);if(a<u&&91===t.src.charCodeAt(a)&&(p=a+1,(a=gi(t,a))>=0?n=t.src.slice(p,a++):a=p-1),n||(void 0===n&&(a=o+1),n=t.src.slice(i,o)),!(l=t.env.references[xi(n)]))return t.pos=h,!1;s=l.href,r=l.title}return e||(t.pos=i,t.posMax=o,c?t.push({type:"image",src:s,title:r,alt:t.src.substr(i,o-i),level:t.level}):(t.push({type:"link_open",href:s,title:r,level:t.level++}),t.linkLevel++,t.parser.tokenize(t),t.linkLevel--,t.push({type:"link_close",level:--t.level}))),t.pos=a,t.posMax=u,!0}],["footnote_inline",function(t,e){var i,o,n,s,r=t.posMax,a=t.pos;return!(a+2>=r)&&(94===t.src.charCodeAt(a)&&(91===t.src.charCodeAt(a+1)&&(!(t.level>=t.options.maxNesting)&&(i=a+2,!((o=gi(t,a+1))<0)&&(e||(t.env.footnotes||(t.env.footnotes={}),t.env.footnotes.list||(t.env.footnotes.list=[]),n=t.env.footnotes.list.length,t.pos=i,t.posMax=o,t.push({type:"footnote_ref",id:n,level:t.level}),t.linkLevel++,s=t.tokens.length,t.parser.tokenize(t),t.env.footnotes.list[n]={tokens:t.tokens.splice(s)},t.linkLevel--),t.pos=o+1,t.posMax=r,!0)))))}],["footnote_ref",function(t,e){var i,o,n,s,r=t.posMax,a=t.pos;if(a+3>r)return!1;if(!t.env.footnotes||!t.env.footnotes.refs)return!1;if(91!==t.src.charCodeAt(a))return!1;if(94!==t.src.charCodeAt(a+1))return!1;if(t.level>=t.options.maxNesting)return!1;for(o=a+2;o<r;o++){if(32===t.src.charCodeAt(o))return!1;if(10===t.src.charCodeAt(o))return!1;if(93===t.src.charCodeAt(o))break}return o!==a+2&&(!(o>=r)&&(o++,i=t.src.slice(a+2,o-1),void 0!==t.env.footnotes.refs[":"+i]&&(e||(t.env.footnotes.list||(t.env.footnotes.list=[]),t.env.footnotes.refs[":"+i]<0?(n=t.env.footnotes.list.length,t.env.footnotes.list[n]={label:i,count:0},t.env.footnotes.refs[":"+i]=n):n=t.env.footnotes.refs[":"+i],s=t.env.footnotes.list[n].count,t.env.footnotes.list[n].count++,t.push({type:"footnote_ref",id:n,subId:s,level:t.level})),t.pos=o,t.posMax=r,!0)))}],["autolink",function(t,e){var i,o,n,s,r,a=t.pos;return 60===t.src.charCodeAt(a)&&(!((i=t.src.slice(a)).indexOf(">")<0)&&((o=i.match(io))?!(to.indexOf(o[1].toLowerCase())<0)&&(r=vi(s=o[0].slice(1,-1)),!!t.parser.validateLink(s)&&(e||(t.push({type:"link_open",href:r,level:t.level}),t.push({type:"text",content:s,level:t.level+1}),t.push({type:"link_close",level:t.level})),t.pos+=o[0].length,!0)):!!(n=i.match(eo))&&(r=vi("mailto:"+(s=n[0].slice(1,-1))),!!t.parser.validateLink(r)&&(e||(t.push({type:"link_open",href:r,level:t.level}),t.push({type:"text",content:s,level:t.level+1}),t.push({type:"link_close",level:t.level})),t.pos+=n[0].length,!0))))}],["htmltag",function(t,e){var i,o,n,s=t.pos;return!!t.options.html&&(n=t.posMax,!(60!==t.src.charCodeAt(s)||s+2>=n)&&(!(33!==(i=t.src.charCodeAt(s+1))&&63!==i&&47!==i&&!function(t){var e=32|t;return e>=97&&e<=122}(i))&&(!!(o=t.src.slice(s).match(ao))&&(e||t.push({type:"htmltag",content:t.src.slice(s,s+o[0].length),level:t.level}),t.pos+=o[0].length,!0))))}],["entity",function(t,e){var i,o,n=t.pos,s=t.posMax;if(38!==t.src.charCodeAt(n))return!1;if(n+1<s)if(35===t.src.charCodeAt(n+1)){if(o=t.src.slice(n).match(lo))return e||(i="x"===o[1][0].toLowerCase()?parseInt(o[1].slice(1),16):parseInt(o[1],10),t.pending+=Qe(i)?Je(i):Je(65533)),t.pos+=o[0].length,!0}else if(o=t.src.slice(n).match(co)){var r=Ze(o[1]);if(o[1]!==r)return e||(t.pending+=r),t.pos+=o[0].length,!0}return e||(t.pending+="&"),t.pos++,!0}]];function uo(){this.ruler=new pi;for(var t=0;t<ho.length;t++)this.ruler.push(ho[t][0],ho[t][1]);this.validateLink=po}function po(t){var e=t.trim().toLowerCase();return-1===(e=oi(e)).indexOf(":")||-1===["vbscript","javascript","file","data"].indexOf(e.split(":")[0])}uo.prototype.skipToken=function(t){var e,i,o=this.ruler.getRules(""),n=o.length,s=t.pos;if((i=t.cacheGet(s))>0)t.pos=i;else{for(e=0;e<n;e++)if(o[e](t,!0))return void t.cacheSet(s,t.pos);t.pos++,t.cacheSet(s,t.pos)}},uo.prototype.tokenize=function(t){for(var e,i,o=this.ruler.getRules(""),n=o.length,s=t.posMax;t.pos<s;){for(i=0;i<n&&!(e=o[i](t,!1));i++);if(e){if(t.pos>=s)break}else t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()},uo.prototype.parse=function(t,e,i,o){var n=new mi(t,this,e,i,o);this.tokenize(n)};var mo={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkTarget:"",typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["block","inline","references","replacements","smartquotes","references","abbr2","footnote_tail"]},block:{rules:["blockquote","code","fences","footnote","heading","hr","htmlblock","lheading","list","paragraph","table"]},inline:{rules:["autolink","backticks","del","emphasis","entity","escape","footnote_ref","htmltag","links","newline","text"]}}},full:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkTarget:"",typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{},block:{},inline:{}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkTarget:"",typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["block","inline","references","abbr2"]},block:{rules:["blockquote","code","fences","heading","hr","htmlblock","lheading","list","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","htmltag","links","newline","text"]}}}};function go(t,e,i){this.src=e,this.env=i,this.options=t.options,this.tokens=[],this.inlineMode=!1,this.inline=t.inline,this.block=t.block,this.renderer=t.renderer,this.typographer=t.typographer}function fo(t,e){"string"!=typeof t&&(e=t,t="default"),e&&null!=e.linkify&&console.warn("linkify option is removed. Use linkify plugin instead:\n\nimport Remarkable from 'remarkable';\nimport linkify from 'remarkable/linkify';\nnew Remarkable().use(linkify)\n"),this.inline=new uo,this.block=new ji,this.core=new Oi,this.renderer=new ui,this.ruler=new pi,this.options={},this.configure(mo[t]),this.set(e||{})}fo.prototype.set=function(t){Ge(this.options,t)},fo.prototype.configure=function(t){var e=this;if(!t)throw new Error("Wrong `remarkable` preset, check name/content");t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach((function(i){t.components[i].rules&&e[i].ruler.enable(t.components[i].rules,!0)}))},fo.prototype.use=function(t,e){return t(this,e),this},fo.prototype.parse=function(t,e){var i=new go(this,t,e);return this.core.process(i),i.tokens},fo.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)},fo.prototype.parseInline=function(t,e){var i=new go(this,t,e);return i.inlineMode=!0,this.core.process(i),i.tokens},fo.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};const vo=new fo;class bo extends Ue{constructor(t){if(super(t),t.type!==Fe)throw new Error("markdown directives only support child expressions")}update(t,[e]){return this.render(e)}}const yo=qe(class extends bo{render(t){return H`${Ve(vo.renderInline(t))}`}});class xo extends Ne{get value(){return this._value}set value(t){this._value=t}constructor(){super(),this.name="",this._value="",this.inputRoot=this,this.disabled=!1,this.hideErrors=!1,this.internals=this.attachInternals()}static get styles(){return a`
51
+ */class je extends Ue{constructor(t){if(super(t),this.it=Z,t.type!==Fe)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===Z||null==t)return this._t=void 0,this.it=t;if(t===W)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}je.directiveName="unsafeHTML",je.resultType=1;const Ve=qe(je);var He={Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",GT:">",Gt:"≫",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",LT:"<",Lt:"≪",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"},We=Object.prototype.hasOwnProperty;function Ze(t){return i=t,(e=He)&&We.call(e,i)?He[t]:t;var e,i}var Ye=Object.prototype.hasOwnProperty;function Ge(t){return[].slice.call(arguments,1).forEach((function(e){if(e){if("object"!=typeof e)throw new TypeError(e+"must be object");Object.keys(e).forEach((function(i){t[i]=e[i]}))}})),t}var Ke=/\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;function Xe(t){return t.indexOf("\\")<0?t:t.replace(Ke,"$1")}function Qe(t){return!(t>=55296&&t<=57343)&&(!(t>=64976&&t<=65007)&&(!!(65535&~t&&65534!=(65535&t))&&(!(t>=0&&t<=8)&&(11!==t&&(!(t>=14&&t<=31)&&(!(t>=127&&t<=159)&&!(t>1114111)))))))}function Je(t){if(t>65535){var e=55296+((t-=65536)>>10),i=56320+(1023&t);return String.fromCharCode(e,i)}return String.fromCharCode(t)}var ti=/&([a-z#][a-z0-9]{1,31});/gi,ei=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;function ii(t,e){var i=0,o=Ze(e);return e!==o?o:35===e.charCodeAt(0)&&ei.test(e)&&Qe(i="x"===e[1].toLowerCase()?parseInt(e.slice(2),16):parseInt(e.slice(1),10))?Je(i):t}function oi(t){return t.indexOf("&")<0?t:t.replace(ti,ii)}var ni=/[&<>"]/,si=/[&<>"]/g,ri={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function ai(t){return ri[t]}function li(t){return ni.test(t)?t.replace(si,ai):t}var di={};function ci(t,e){return++e>=t.length-2?e:"paragraph_open"===t[e].type&&t[e].tight&&"inline"===t[e+1].type&&0===t[e+1].content.length&&"paragraph_close"===t[e+2].type&&t[e+2].tight?ci(t,e+2):e}di.blockquote_open=function(){return"<blockquote>\n"},di.blockquote_close=function(t,e){return"</blockquote>"+hi(t,e)},di.code=function(t,e){return t[e].block?"<pre><code>"+li(t[e].content)+"</code></pre>"+hi(t,e):"<code>"+li(t[e].content)+"</code>"},di.fence=function(t,e,i,o,n){var s,r,a,l,d=t[e],c="",h=i.langPrefix;if(d.params){if(r=(s=d.params.split(/\s+/g)).join(" "),a=n.rules.fence_custom,l=s[0],a&&Ye.call(a,l))return n.rules.fence_custom[s[0]](t,e,i,o,n);c=' class="'+h+li(oi(Xe(r)))+'"'}return"<pre><code"+c+">"+(i.highlight&&i.highlight.apply(i.highlight,[d.content].concat(s))||li(d.content))+"</code></pre>"+hi(t,e)},di.fence_custom={},di.heading_open=function(t,e){return"<h"+t[e].hLevel+">"},di.heading_close=function(t,e){return"</h"+t[e].hLevel+">\n"},di.hr=function(t,e,i){return(i.xhtmlOut?"<hr />":"<hr>")+hi(t,e)},di.bullet_list_open=function(){return"<ul>\n"},di.bullet_list_close=function(t,e){return"</ul>"+hi(t,e)},di.list_item_open=function(){return"<li>"},di.list_item_close=function(){return"</li>\n"},di.ordered_list_open=function(t,e){var i=t[e];return"<ol"+(i.order>1?' start="'+i.order+'"':"")+">\n"},di.ordered_list_close=function(t,e){return"</ol>"+hi(t,e)},di.paragraph_open=function(t,e){return t[e].tight?"":"<p>"},di.paragraph_close=function(t,e){var i=!(t[e].tight&&e&&"inline"===t[e-1].type&&!t[e-1].content);return(t[e].tight?"":"</p>")+(i?hi(t,e):"")},di.link_open=function(t,e,i){var o=t[e].title?' title="'+li(oi(t[e].title))+'"':"",n=i.linkTarget?' target="'+i.linkTarget+'"':"";return'<a href="'+li(t[e].href)+'"'+o+n+">"},di.link_close=function(){return"</a>"},di.image=function(t,e,i){var o=' src="'+li(t[e].src)+'"',n=t[e].title?' title="'+li(oi(t[e].title))+'"':"";return"<img"+o+(' alt="'+(t[e].alt?li(oi(Xe(t[e].alt))):"")+'"')+n+(i.xhtmlOut?" /":"")+">"},di.table_open=function(){return"<table>\n"},di.table_close=function(){return"</table>\n"},di.thead_open=function(){return"<thead>\n"},di.thead_close=function(){return"</thead>\n"},di.tbody_open=function(){return"<tbody>\n"},di.tbody_close=function(){return"</tbody>\n"},di.tr_open=function(){return"<tr>"},di.tr_close=function(){return"</tr>\n"},di.th_open=function(t,e){var i=t[e];return"<th"+(i.align?' style="text-align:'+i.align+'"':"")+">"},di.th_close=function(){return"</th>"},di.td_open=function(t,e){var i=t[e];return"<td"+(i.align?' style="text-align:'+i.align+'"':"")+">"},di.td_close=function(){return"</td>"},di.strong_open=function(){return"<strong>"},di.strong_close=function(){return"</strong>"},di.em_open=function(){return"<em>"},di.em_close=function(){return"</em>"},di.del_open=function(){return"<del>"},di.del_close=function(){return"</del>"},di.ins_open=function(){return"<ins>"},di.ins_close=function(){return"</ins>"},di.mark_open=function(){return"<mark>"},di.mark_close=function(){return"</mark>"},di.sub=function(t,e){return"<sub>"+li(t[e].content)+"</sub>"},di.sup=function(t,e){return"<sup>"+li(t[e].content)+"</sup>"},di.hardbreak=function(t,e,i){return i.xhtmlOut?"<br />\n":"<br>\n"},di.softbreak=function(t,e,i){return i.breaks?i.xhtmlOut?"<br />\n":"<br>\n":"\n"},di.text=function(t,e){return li(t[e].content)},di.htmlblock=function(t,e){return t[e].content},di.htmltag=function(t,e){return t[e].content},di.abbr_open=function(t,e){return'<abbr title="'+li(oi(t[e].title))+'">'},di.abbr_close=function(){return"</abbr>"},di.footnote_ref=function(t,e){var i=Number(t[e].id+1).toString(),o="fnref"+i;return t[e].subId>0&&(o+=":"+t[e].subId),'<sup class="footnote-ref"><a href="#fn'+i+'" id="'+o+'">['+i+"]</a></sup>"},di.footnote_block_open=function(t,e,i){return(i.xhtmlOut?'<hr class="footnotes-sep" />\n':'<hr class="footnotes-sep">\n')+'<section class="footnotes">\n<ol class="footnotes-list">\n'},di.footnote_block_close=function(){return"</ol>\n</section>\n"},di.footnote_open=function(t,e){return'<li id="fn'+Number(t[e].id+1).toString()+'" class="footnote-item">'},di.footnote_close=function(){return"</li>\n"},di.footnote_anchor=function(t,e){var i="fnref"+Number(t[e].id+1).toString();return t[e].subId>0&&(i+=":"+t[e].subId),' <a href="#'+i+'" class="footnote-backref">↩</a>'},di.dl_open=function(){return"<dl>\n"},di.dt_open=function(){return"<dt>"},di.dd_open=function(){return"<dd>"},di.dl_close=function(){return"</dl>\n"},di.dt_close=function(){return"</dt>\n"},di.dd_close=function(){return"</dd>\n"};var hi=di.getBreak=function(t,e){return(e=ci(t,e))<t.length&&"list_item_close"===t[e].type?"":"\n"};function ui(){this.rules=Ge({},di),this.getBreak=di.getBreak}function pi(){this.__rules__=[],this.__cache__=null}function mi(t,e,i,o,n){this.src=t,this.env=o,this.options=i,this.parser=e,this.tokens=n,this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache=[],this.isInLabel=!1,this.linkLevel=0,this.linkContent="",this.labelUnmatchedScopes=0}function gi(t,e){var i,o,n,s=-1,r=t.posMax,a=t.pos,l=t.isInLabel;if(t.isInLabel)return-1;if(t.labelUnmatchedScopes)return t.labelUnmatchedScopes--,-1;for(t.pos=e+1,t.isInLabel=!0,i=1;t.pos<r;){if(91===(n=t.src.charCodeAt(t.pos)))i++;else if(93===n&&0===--i){o=!0;break}t.parser.skipToken(t)}return o?(s=t.pos,t.labelUnmatchedScopes=0):t.labelUnmatchedScopes=i-1,t.pos=a,t.isInLabel=l,s}function fi(t,e,i,o){var n,s,r,a,l,d;if(42!==t.charCodeAt(0))return-1;if(91!==t.charCodeAt(1))return-1;if(-1===t.indexOf("]:"))return-1;if((s=gi(n=new mi(t,e,i,o,[]),1))<0||58!==t.charCodeAt(s+1))return-1;for(a=n.posMax,r=s+2;r<a&&10!==n.src.charCodeAt(r);r++);return l=t.slice(2,s),0===(d=t.slice(s+2,r).trim()).length?-1:(o.abbreviations||(o.abbreviations={}),void 0===o.abbreviations[":"+l]&&(o.abbreviations[":"+l]=d),r)}function vi(t){var e=oi(t);try{e=decodeURI(e)}catch(t){}return encodeURI(e)}function yi(t,e){var i,o,n,s=e,r=t.posMax;if(60===t.src.charCodeAt(e)){for(e++;e<r;){if(10===(i=t.src.charCodeAt(e)))return!1;if(62===i)return n=vi(Xe(t.src.slice(s+1,e))),!!t.parser.validateLink(n)&&(t.pos=e+1,t.linkContent=n,!0);92===i&&e+1<r?e+=2:e++}return!1}for(o=0;e<r&&32!==(i=t.src.charCodeAt(e))&&!(i<32||127===i);)if(92===i&&e+1<r)e+=2;else{if(40===i&&++o>1)break;if(41===i&&--o<0)break;e++}return s!==e&&(n=Xe(t.src.slice(s,e)),!!t.parser.validateLink(n)&&(t.linkContent=n,t.pos=e,!0))}function bi(t,e){var i,o=e,n=t.posMax,s=t.src.charCodeAt(e);if(34!==s&&39!==s&&40!==s)return!1;for(e++,40===s&&(s=41);e<n;){if((i=t.src.charCodeAt(e))===s)return t.pos=e+1,t.linkContent=Xe(t.src.slice(o+1,e)),!0;92===i&&e+1<n?e+=2:e++}return!1}function xi(t){return t.trim().replace(/\s+/g," ").toUpperCase()}function _i(t,e,i,o){var n,s,r,a,l,d,c,h,u;if(91!==t.charCodeAt(0))return-1;if(-1===t.indexOf("]:"))return-1;if((s=gi(n=new mi(t,e,i,o,[]),0))<0||58!==t.charCodeAt(s+1))return-1;for(a=n.posMax,r=s+2;r<a&&(32===(l=n.src.charCodeAt(r))||10===l);r++);if(!yi(n,r))return-1;for(c=n.linkContent,d=r=n.pos,r+=1;r<a&&(32===(l=n.src.charCodeAt(r))||10===l);r++);for(r<a&&d!==r&&bi(n,r)?(h=n.linkContent,r=n.pos):(h="",r=d);r<a&&32===n.src.charCodeAt(r);)r++;return r<a&&10!==n.src.charCodeAt(r)?-1:(u=xi(t.slice(1,s)),void 0===o.references[u]&&(o.references[u]={title:h,href:c}),r)}ui.prototype.renderInline=function(t,e,i){for(var o=this.rules,n=t.length,s=0,r="";n--;)r+=o[t[s].type](t,s++,e,i,this);return r},ui.prototype.render=function(t,e,i){for(var o=this.rules,n=t.length,s=-1,r="";++s<n;)"inline"===t[s].type?r+=this.renderInline(t[s].children,e,i):r+=o[t[s].type](t,s,e,i,this);return r},pi.prototype.__find__=function(t){for(var e=this.__rules__.length,i=-1;e--;)if(this.__rules__[++i].name===t)return i;return-1},pi.prototype.__compile__=function(){var t=this,e=[""];t.__rules__.forEach((function(t){t.enabled&&t.alt.forEach((function(t){e.indexOf(t)<0&&e.push(t)}))})),t.__cache__={},e.forEach((function(e){t.__cache__[e]=[],t.__rules__.forEach((function(i){i.enabled&&(e&&i.alt.indexOf(e)<0||t.__cache__[e].push(i.fn))}))}))},pi.prototype.at=function(t,e,i){var o=this.__find__(t),n=i||{};if(-1===o)throw new Error("Parser rule not found: "+t);this.__rules__[o].fn=e,this.__rules__[o].alt=n.alt||[],this.__cache__=null},pi.prototype.before=function(t,e,i,o){var n=this.__find__(t),s=o||{};if(-1===n)throw new Error("Parser rule not found: "+t);this.__rules__.splice(n,0,{name:e,enabled:!0,fn:i,alt:s.alt||[]}),this.__cache__=null},pi.prototype.after=function(t,e,i,o){var n=this.__find__(t),s=o||{};if(-1===n)throw new Error("Parser rule not found: "+t);this.__rules__.splice(n+1,0,{name:e,enabled:!0,fn:i,alt:s.alt||[]}),this.__cache__=null},pi.prototype.push=function(t,e,i){var o=i||{};this.__rules__.push({name:t,enabled:!0,fn:e,alt:o.alt||[]}),this.__cache__=null},pi.prototype.enable=function(t,e){t=Array.isArray(t)?t:[t],e&&this.__rules__.forEach((function(t){t.enabled=!1})),t.forEach((function(t){var e=this.__find__(t);if(e<0)throw new Error("Rules manager: invalid rule name "+t);this.__rules__[e].enabled=!0}),this),this.__cache__=null},pi.prototype.disable=function(t){(t=Array.isArray(t)?t:[t]).forEach((function(t){var e=this.__find__(t);if(e<0)throw new Error("Rules manager: invalid rule name "+t);this.__rules__[e].enabled=!1}),this),this.__cache__=null},pi.prototype.getRules=function(t){return null===this.__cache__&&this.__compile__(),this.__cache__[t]||[]},mi.prototype.pushPending=function(){this.tokens.push({type:"text",content:this.pending,level:this.pendingLevel}),this.pending=""},mi.prototype.push=function(t){this.pending&&this.pushPending(),this.tokens.push(t),this.pendingLevel=this.level},mi.prototype.cacheSet=function(t,e){for(var i=this.cache.length;i<=t;i++)this.cache.push(0);this.cache[t]=e},mi.prototype.cacheGet=function(t){return t<this.cache.length?this.cache[t]:0};var wi=" \n()[]'\".,!?-";function ki(t){return t.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1")}var Ci=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,Si=/\((c|tm|r|p)\)/gi,Ai={c:"©",r:"®",p:"§",tm:"™"};var Ei=/['"]/,$i=/['"]/g,Ti=/[-\s()\[\]]/;function Di(t,e){return!(e<0||e>=t.length)&&!Ti.test(t[e])}function Mi(t,e,i){return t.substr(0,e)+i+t.substr(e+1)}var Ii=[["block",function(t){t.inlineMode?t.tokens.push({type:"inline",content:t.src.replace(/\n/g," ").trim(),level:0,lines:[0,1],children:[]}):t.block.parse(t.src,t.options,t.env,t.tokens)}],["abbr",function(t){var e,i,o,n,s=t.tokens;if(!t.inlineMode)for(e=1,i=s.length-1;e<i;e++)if("paragraph_open"===s[e-1].type&&"inline"===s[e].type&&"paragraph_close"===s[e+1].type){for(o=s[e].content;o.length&&!((n=fi(o,t.inline,t.options,t.env))<0);)o=o.slice(n).trim();s[e].content=o,o.length||(s[e-1].tight=!0,s[e+1].tight=!0)}}],["references",function(t){var e,i,o,n,s=t.tokens;if(t.env.references=t.env.references||{},!t.inlineMode)for(e=1,i=s.length-1;e<i;e++)if("inline"===s[e].type&&"paragraph_open"===s[e-1].type&&"paragraph_close"===s[e+1].type){for(o=s[e].content;o.length&&!((n=_i(o,t.inline,t.options,t.env))<0);)o=o.slice(n).trim();s[e].content=o,o.length||(s[e-1].tight=!0,s[e+1].tight=!0)}}],["inline",function(t){var e,i,o,n=t.tokens;for(i=0,o=n.length;i<o;i++)"inline"===(e=n[i]).type&&t.inline.parse(e.content,t.options,t.env,e.children)}],["footnote_tail",function(t){var e,i,o,n,s,r,a,l,d,c=0,h=!1,u={};if(t.env.footnotes&&(t.tokens=t.tokens.filter((function(t){return"footnote_reference_open"===t.type?(h=!0,l=[],d=t.label,!1):"footnote_reference_close"===t.type?(h=!1,u[":"+d]=l,!1):(h&&l.push(t),!h)})),t.env.footnotes.list)){for(r=t.env.footnotes.list,t.tokens.push({type:"footnote_block_open",level:c++}),e=0,i=r.length;e<i;e++){for(t.tokens.push({type:"footnote_open",id:e,level:c++}),r[e].tokens?((a=[]).push({type:"paragraph_open",tight:!1,level:c++}),a.push({type:"inline",content:"",level:c,children:r[e].tokens}),a.push({type:"paragraph_close",tight:!1,level:--c})):r[e].label&&(a=u[":"+r[e].label]),t.tokens=t.tokens.concat(a),s="paragraph_close"===t.tokens[t.tokens.length-1].type?t.tokens.pop():null,n=r[e].count>0?r[e].count:1,o=0;o<n;o++)t.tokens.push({type:"footnote_anchor",id:e,subId:o,level:c});s&&t.tokens.push(s),t.tokens.push({type:"footnote_close",level:--c})}t.tokens.push({type:"footnote_block_close",level:--c})}}],["abbr2",function(t){var e,i,o,n,s,r,a,l,d,c,h,u,p=t.tokens;if(t.env.abbreviations)for(t.env.abbrRegExp||(u="(^|["+wi.split("").map(ki).join("")+"])("+Object.keys(t.env.abbreviations).map((function(t){return t.substr(1)})).sort((function(t,e){return e.length-t.length})).map(ki).join("|")+")($|["+wi.split("").map(ki).join("")+"])",t.env.abbrRegExp=new RegExp(u,"g")),c=t.env.abbrRegExp,i=0,o=p.length;i<o;i++)if("inline"===p[i].type)for(e=(n=p[i].children).length-1;e>=0;e--)if("text"===(s=n[e]).type){for(l=0,r=s.content,c.lastIndex=0,d=s.level,a=[];h=c.exec(r);)c.lastIndex>l&&a.push({type:"text",content:r.slice(l,h.index+h[1].length),level:d}),a.push({type:"abbr_open",title:t.env.abbreviations[":"+h[2]],level:d++}),a.push({type:"text",content:h[2],level:d}),a.push({type:"abbr_close",level:--d}),l=c.lastIndex-h[3].length;a.length&&(l<r.length&&a.push({type:"text",content:r.slice(l),level:d}),p[i].children=n=[].concat(n.slice(0,e),a,n.slice(e+1)))}}],["replacements",function(t){var e,i,o,n,s,r;if(t.options.typographer)for(s=t.tokens.length-1;s>=0;s--)if("inline"===t.tokens[s].type)for(e=(n=t.tokens[s].children).length-1;e>=0;e--)"text"===(i=n[e]).type&&(o=i.content,o=(r=o).indexOf("(")<0?r:r.replace(Si,(function(t,e){return Ai[e.toLowerCase()]})),Ci.test(o)&&(o=o.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---([^-]|$)/gm,"$1—$2").replace(/(^|\s)--(\s|$)/gm,"$1–$2").replace(/(^|[^-\s])--([^-\s]|$)/gm,"$1–$2")),i.content=o)}],["smartquotes",function(t){var e,i,o,n,s,r,a,l,d,c,h,u,p,m,g,f,v;if(t.options.typographer)for(v=[],g=t.tokens.length-1;g>=0;g--)if("inline"===t.tokens[g].type)for(f=t.tokens[g].children,v.length=0,e=0;e<f.length;e++)if("text"===(i=f[e]).type&&!Ei.test(i.text)){for(a=f[e].level,p=v.length-1;p>=0&&!(v[p].level<=a);p--);v.length=p+1,s=0,r=(o=i.content).length;t:for(;s<r&&($i.lastIndex=s,n=$i.exec(o));)if(l=!Di(o,n.index-1),s=n.index+1,m="'"===n[0],(d=!Di(o,s))||l){if(h=!d,u=!l)for(p=v.length-1;p>=0&&(c=v[p],!(v[p].level<a));p--)if(c.single===m&&v[p].level===a){c=v[p],m?(f[c.token].content=Mi(f[c.token].content,c.pos,t.options.quotes[2]),i.content=Mi(i.content,n.index,t.options.quotes[3])):(f[c.token].content=Mi(f[c.token].content,c.pos,t.options.quotes[0]),i.content=Mi(i.content,n.index,t.options.quotes[1])),v.length=p;continue t}h?v.push({token:e,pos:n.index,single:m,level:a}):u&&m&&(i.content=Mi(i.content,n.index,"’"))}else m&&(i.content=Mi(i.content,n.index,"’"))}}]];function Oi(){this.options={},this.ruler=new pi;for(var t=0;t<Ii.length;t++)this.ruler.push(Ii[t][0],Ii[t][1])}function Li(t,e,i,o,n){var s,r,a,l,d,c,h;for(this.src=t,this.parser=e,this.options=i,this.env=o,this.tokens=n,this.bMarks=[],this.eMarks=[],this.tShift=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.parentType="root",this.ddIndent=-1,this.level=0,this.result="",c=0,h=!1,a=l=c=0,d=(r=this.src).length;l<d;l++){if(s=r.charCodeAt(l),!h){if(32===s){c++;continue}h=!0}10!==s&&l!==d-1||(10!==s&&l++,this.bMarks.push(a),this.eMarks.push(l),this.tShift.push(c),h=!1,c=0,a=l+1)}this.bMarks.push(r.length),this.eMarks.push(r.length),this.tShift.push(0),this.lineMax=this.bMarks.length-1}function zi(t,e){var i,o,n;return(o=t.bMarks[e]+t.tShift[e])>=(n=t.eMarks[e])||42!==(i=t.src.charCodeAt(o++))&&45!==i&&43!==i||o<n&&32!==t.src.charCodeAt(o)?-1:o}function Pi(t,e){var i,o=t.bMarks[e]+t.tShift[e],n=t.eMarks[e];if(o+1>=n)return-1;if((i=t.src.charCodeAt(o++))<48||i>57)return-1;for(;;){if(o>=n)return-1;if(!((i=t.src.charCodeAt(o++))>=48&&i<=57)){if(41===i||46===i)break;return-1}}return o<n&&32!==t.src.charCodeAt(o)?-1:o}Oi.prototype.process=function(t){var e,i,o;for(e=0,i=(o=this.ruler.getRules("")).length;e<i;e++)o[e](t)},Li.prototype.isEmpty=function(t){return this.bMarks[t]+this.tShift[t]>=this.eMarks[t]},Li.prototype.skipEmptyLines=function(t){for(var e=this.lineMax;t<e&&!(this.bMarks[t]+this.tShift[t]<this.eMarks[t]);t++);return t},Li.prototype.skipSpaces=function(t){for(var e=this.src.length;t<e&&32===this.src.charCodeAt(t);t++);return t},Li.prototype.skipChars=function(t,e){for(var i=this.src.length;t<i&&this.src.charCodeAt(t)===e;t++);return t},Li.prototype.skipCharsBack=function(t,e,i){if(t<=i)return t;for(;t>i;)if(e!==this.src.charCodeAt(--t))return t+1;return t},Li.prototype.getLines=function(t,e,i,o){var n,s,r,a,l,d=t;if(t>=e)return"";if(d+1===e)return s=this.bMarks[d]+Math.min(this.tShift[d],i),r=o?this.eMarks[d]+1:this.eMarks[d],this.src.slice(s,r);for(a=new Array(e-t),n=0;d<e;d++,n++)(l=this.tShift[d])>i&&(l=i),l<0&&(l=0),s=this.bMarks[d]+l,r=d+1<e||o?this.eMarks[d]+1:this.eMarks[d],a[n]=this.src.slice(s,r);return a.join("")};var Ri={};["article","aside","button","blockquote","body","canvas","caption","col","colgroup","dd","div","dl","dt","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","iframe","li","map","object","ol","output","p","pre","progress","script","section","style","table","tbody","td","textarea","tfoot","th","tr","thead","ul","video"].forEach((function(t){Ri[t]=!0}));var Ni=/^<([a-zA-Z]{1,15})[\s\/>]/,Bi=/^<\/([a-zA-Z]{1,15})[\s>]/;function Fi(t,e){var i=t.bMarks[e]+t.blkIndent,o=t.eMarks[e];return t.src.substr(i,o-i)}function qi(t,e){var i,o,n=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];return n>=s||126!==(o=t.src.charCodeAt(n++))&&58!==o||n===(i=t.skipSpaces(n))||i>=s?-1:i}var Ui=[["code",function(t,e,i){var o,n;if(t.tShift[e]-t.blkIndent<4)return!1;for(n=o=e+1;o<i;)if(t.isEmpty(o))o++;else{if(!(t.tShift[o]-t.blkIndent>=4))break;n=++o}return t.line=o,t.tokens.push({type:"code",content:t.getLines(e,n,4+t.blkIndent,!0),block:!0,lines:[e,t.line],level:t.level}),!0}],["fences",function(t,e,i,o){var n,s,r,a,l,d=!1,c=t.bMarks[e]+t.tShift[e],h=t.eMarks[e];if(c+3>h)return!1;if(126!==(n=t.src.charCodeAt(c))&&96!==n)return!1;if(l=c,(s=(c=t.skipChars(c,n))-l)<3)return!1;if((r=t.src.slice(c,h).trim()).indexOf("`")>=0)return!1;if(o)return!0;for(a=e;!(++a>=i)&&!((c=l=t.bMarks[a]+t.tShift[a])<(h=t.eMarks[a])&&t.tShift[a]<t.blkIndent);)if(t.src.charCodeAt(c)===n&&!(t.tShift[a]-t.blkIndent>=4||(c=t.skipChars(c,n))-l<s||(c=t.skipSpaces(c))<h)){d=!0;break}return s=t.tShift[e],t.line=a+(d?1:0),t.tokens.push({type:"fence",params:r,content:t.getLines(e+1,a,s,!0),lines:[e,t.line],level:t.level}),!0},["paragraph","blockquote","list"]],["blockquote",function(t,e,i,o){var n,s,r,a,l,d,c,h,u,p,m,g=t.bMarks[e]+t.tShift[e],f=t.eMarks[e];if(g>f)return!1;if(62!==t.src.charCodeAt(g++))return!1;if(t.level>=t.options.maxNesting)return!1;if(o)return!0;for(32===t.src.charCodeAt(g)&&g++,l=t.blkIndent,t.blkIndent=0,a=[t.bMarks[e]],t.bMarks[e]=g,s=(g=g<f?t.skipSpaces(g):g)>=f,r=[t.tShift[e]],t.tShift[e]=g-t.bMarks[e],h=t.parser.ruler.getRules("blockquote"),n=e+1;n<i&&!((g=t.bMarks[n]+t.tShift[n])>=(f=t.eMarks[n]));n++)if(62!==t.src.charCodeAt(g++)){if(s)break;for(m=!1,u=0,p=h.length;u<p;u++)if(h[u](t,n,i,!0)){m=!0;break}if(m)break;a.push(t.bMarks[n]),r.push(t.tShift[n]),t.tShift[n]=-1337}else 32===t.src.charCodeAt(g)&&g++,a.push(t.bMarks[n]),t.bMarks[n]=g,s=(g=g<f?t.skipSpaces(g):g)>=f,r.push(t.tShift[n]),t.tShift[n]=g-t.bMarks[n];for(d=t.parentType,t.parentType="blockquote",t.tokens.push({type:"blockquote_open",lines:c=[e,0],level:t.level++}),t.parser.tokenize(t,e,n),t.tokens.push({type:"blockquote_close",level:--t.level}),t.parentType=d,c[1]=t.line,u=0;u<r.length;u++)t.bMarks[u+e]=a[u],t.tShift[u+e]=r[u];return t.blkIndent=l,!0},["paragraph","blockquote","list"]],["hr",function(t,e,i,o){var n,s,r,a=t.bMarks[e],l=t.eMarks[e];if((a+=t.tShift[e])>l)return!1;if(42!==(n=t.src.charCodeAt(a++))&&45!==n&&95!==n)return!1;for(s=1;a<l;){if((r=t.src.charCodeAt(a++))!==n&&32!==r)return!1;r===n&&s++}return!(s<3)&&(o||(t.line=e+1,t.tokens.push({type:"hr",lines:[e,t.line],level:t.level})),!0)},["paragraph","blockquote","list"]],["list",function(t,e,i,o){var n,s,r,a,l,d,c,h,u,p,m,g,f,v,y,b,x,_,w,k,C,S=!0;if((h=Pi(t,e))>=0)g=!0;else{if(!((h=zi(t,e))>=0))return!1;g=!1}if(t.level>=t.options.maxNesting)return!1;if(m=t.src.charCodeAt(h-1),o)return!0;for(v=t.tokens.length,g?(c=t.bMarks[e]+t.tShift[e],p=Number(t.src.substr(c,h-c-1)),t.tokens.push({type:"ordered_list_open",order:p,lines:b=[e,0],level:t.level++})):t.tokens.push({type:"bullet_list_open",lines:b=[e,0],level:t.level++}),n=e,y=!1,_=t.parser.ruler.getRules("list");!(!(n<i)||((u=(f=t.skipSpaces(h))>=t.eMarks[n]?1:f-h)>4&&(u=1),u<1&&(u=1),s=h-t.bMarks[n]+u,t.tokens.push({type:"list_item_open",lines:x=[e,0],level:t.level++}),a=t.blkIndent,l=t.tight,r=t.tShift[e],d=t.parentType,t.tShift[e]=f-t.bMarks[e],t.blkIndent=s,t.tight=!0,t.parentType="list",t.parser.tokenize(t,e,i,!0),t.tight&&!y||(S=!1),y=t.line-e>1&&t.isEmpty(t.line-1),t.blkIndent=a,t.tShift[e]=r,t.tight=l,t.parentType=d,t.tokens.push({type:"list_item_close",level:--t.level}),n=e=t.line,x[1]=n,f=t.bMarks[e],n>=i)||t.isEmpty(n)||t.tShift[n]<t.blkIndent);){for(C=!1,w=0,k=_.length;w<k;w++)if(_[w](t,n,i,!0)){C=!0;break}if(C)break;if(g){if((h=Pi(t,n))<0)break}else if((h=zi(t,n))<0)break;if(m!==t.src.charCodeAt(h-1))break}return t.tokens.push({type:g?"ordered_list_close":"bullet_list_close",level:--t.level}),b[1]=n,t.line=n,S&&function(t,e){var i,o,n=t.level+2;for(i=e+2,o=t.tokens.length-2;i<o;i++)t.tokens[i].level===n&&"paragraph_open"===t.tokens[i].type&&(t.tokens[i+2].tight=!0,t.tokens[i].tight=!0,i+=2)}(t,v),!0},["paragraph","blockquote"]],["footnote",function(t,e,i,o){var n,s,r,a,l,d=t.bMarks[e]+t.tShift[e],c=t.eMarks[e];if(d+4>c)return!1;if(91!==t.src.charCodeAt(d))return!1;if(94!==t.src.charCodeAt(d+1))return!1;if(t.level>=t.options.maxNesting)return!1;for(a=d+2;a<c;a++){if(32===t.src.charCodeAt(a))return!1;if(93===t.src.charCodeAt(a))break}return a!==d+2&&(!(a+1>=c||58!==t.src.charCodeAt(++a))&&(o||(a++,t.env.footnotes||(t.env.footnotes={}),t.env.footnotes.refs||(t.env.footnotes.refs={}),l=t.src.slice(d+2,a-2),t.env.footnotes.refs[":"+l]=-1,t.tokens.push({type:"footnote_reference_open",label:l,level:t.level++}),n=t.bMarks[e],s=t.tShift[e],r=t.parentType,t.tShift[e]=t.skipSpaces(a)-a,t.bMarks[e]=a,t.blkIndent+=4,t.parentType="footnote",t.tShift[e]<t.blkIndent&&(t.tShift[e]+=t.blkIndent,t.bMarks[e]-=t.blkIndent),t.parser.tokenize(t,e,i,!0),t.parentType=r,t.blkIndent-=4,t.tShift[e]=s,t.bMarks[e]=n,t.tokens.push({type:"footnote_reference_close",level:--t.level})),!0))},["paragraph"]],["heading",function(t,e,i,o){var n,s,r,a=t.bMarks[e]+t.tShift[e],l=t.eMarks[e];if(a>=l)return!1;if(35!==(n=t.src.charCodeAt(a))||a>=l)return!1;for(s=1,n=t.src.charCodeAt(++a);35===n&&a<l&&s<=6;)s++,n=t.src.charCodeAt(++a);return!(s>6||a<l&&32!==n)&&(o||(l=t.skipCharsBack(l,32,a),(r=t.skipCharsBack(l,35,a))>a&&32===t.src.charCodeAt(r-1)&&(l=r),t.line=e+1,t.tokens.push({type:"heading_open",hLevel:s,lines:[e,t.line],level:t.level}),a<l&&t.tokens.push({type:"inline",content:t.src.slice(a,l).trim(),level:t.level+1,lines:[e,t.line],children:[]}),t.tokens.push({type:"heading_close",hLevel:s,level:t.level})),!0)},["paragraph","blockquote"]],["lheading",function(t,e,i){var o,n,s,r=e+1;return!(r>=i)&&(!(t.tShift[r]<t.blkIndent)&&(!(t.tShift[r]-t.blkIndent>3)&&(!((n=t.bMarks[r]+t.tShift[r])>=(s=t.eMarks[r]))&&((45===(o=t.src.charCodeAt(n))||61===o)&&(n=t.skipChars(n,o),!((n=t.skipSpaces(n))<s)&&(n=t.bMarks[e]+t.tShift[e],t.line=r+1,t.tokens.push({type:"heading_open",hLevel:61===o?1:2,lines:[e,t.line],level:t.level}),t.tokens.push({type:"inline",content:t.src.slice(n,t.eMarks[e]).trim(),level:t.level+1,lines:[e,t.line-1],children:[]}),t.tokens.push({type:"heading_close",hLevel:61===o?1:2,level:t.level}),!0))))))}],["htmlblock",function(t,e,i,o){var n,s,r,a=t.bMarks[e],l=t.eMarks[e],d=t.tShift[e];if(a+=d,!t.options.html)return!1;if(d>3||a+2>=l)return!1;if(60!==t.src.charCodeAt(a))return!1;if(33===(n=t.src.charCodeAt(a+1))||63===n){if(o)return!0}else{if(47!==n&&!function(t){var e=32|t;return e>=97&&e<=122}(n))return!1;if(47===n){if(!(s=t.src.slice(a,l).match(Bi)))return!1}else if(!(s=t.src.slice(a,l).match(Ni)))return!1;if(!0!==Ri[s[1].toLowerCase()])return!1;if(o)return!0}for(r=e+1;r<t.lineMax&&!t.isEmpty(r);)r++;return t.line=r,t.tokens.push({type:"htmlblock",level:t.level,lines:[e,t.line],content:t.getLines(e,r,0,!0)}),!0},["paragraph","blockquote"]],["table",function(t,e,i,o){var n,s,r,a,l,d,c,h,u,p,m;if(e+2>i)return!1;if(l=e+1,t.tShift[l]<t.blkIndent)return!1;if((r=t.bMarks[l]+t.tShift[l])>=t.eMarks[l])return!1;if(124!==(n=t.src.charCodeAt(r))&&45!==n&&58!==n)return!1;if(s=Fi(t,e+1),!/^[-:| ]+$/.test(s))return!1;if((d=s.split("|"))<=2)return!1;for(h=[],a=0;a<d.length;a++){if(!(u=d[a].trim())){if(0===a||a===d.length-1)continue;return!1}if(!/^:?-+:?$/.test(u))return!1;58===u.charCodeAt(u.length-1)?h.push(58===u.charCodeAt(0)?"center":"right"):58===u.charCodeAt(0)?h.push("left"):h.push("")}if(-1===(s=Fi(t,e).trim()).indexOf("|"))return!1;if(d=s.replace(/^\||\|$/g,"").split("|"),h.length!==d.length)return!1;if(o)return!0;for(t.tokens.push({type:"table_open",lines:p=[e,0],level:t.level++}),t.tokens.push({type:"thead_open",lines:[e,e+1],level:t.level++}),t.tokens.push({type:"tr_open",lines:[e,e+1],level:t.level++}),a=0;a<d.length;a++)t.tokens.push({type:"th_open",align:h[a],lines:[e,e+1],level:t.level++}),t.tokens.push({type:"inline",content:d[a].trim(),lines:[e,e+1],level:t.level,children:[]}),t.tokens.push({type:"th_close",level:--t.level});for(t.tokens.push({type:"tr_close",level:--t.level}),t.tokens.push({type:"thead_close",level:--t.level}),t.tokens.push({type:"tbody_open",lines:m=[e+2,0],level:t.level++}),l=e+2;l<i&&!(t.tShift[l]<t.blkIndent)&&-1!==(s=Fi(t,l).trim()).indexOf("|");l++){for(d=s.replace(/^\||\|$/g,"").split("|"),t.tokens.push({type:"tr_open",level:t.level++}),a=0;a<d.length;a++)t.tokens.push({type:"td_open",align:h[a],level:t.level++}),c=d[a].substring(124===d[a].charCodeAt(0)?1:0,124===d[a].charCodeAt(d[a].length-1)?d[a].length-1:d[a].length).trim(),t.tokens.push({type:"inline",content:c,level:t.level,children:[]}),t.tokens.push({type:"td_close",level:--t.level});t.tokens.push({type:"tr_close",level:--t.level})}return t.tokens.push({type:"tbody_close",level:--t.level}),t.tokens.push({type:"table_close",level:--t.level}),p[1]=m[1]=l,t.line=l,!0},["paragraph"]],["deflist",function(t,e,i,o){var n,s,r,a,l,d,c,h,u,p,m,g,f,v;if(o)return!(t.ddIndent<0)&&qi(t,e)>=0;if(c=e+1,t.isEmpty(c)&&++c>i)return!1;if(t.tShift[c]<t.blkIndent)return!1;if((n=qi(t,c))<0)return!1;if(t.level>=t.options.maxNesting)return!1;d=t.tokens.length,t.tokens.push({type:"dl_open",lines:l=[e,0],level:t.level++}),r=e,s=c;t:for(;;){for(v=!0,f=!1,t.tokens.push({type:"dt_open",lines:[r,r],level:t.level++}),t.tokens.push({type:"inline",content:t.getLines(r,r+1,t.blkIndent,!1).trim(),level:t.level+1,lines:[r,r],children:[]}),t.tokens.push({type:"dt_close",level:--t.level});;){if(t.tokens.push({type:"dd_open",lines:a=[c,0],level:t.level++}),g=t.tight,u=t.ddIndent,h=t.blkIndent,m=t.tShift[s],p=t.parentType,t.blkIndent=t.ddIndent=t.tShift[s]+2,t.tShift[s]=n-t.bMarks[s],t.tight=!0,t.parentType="deflist",t.parser.tokenize(t,s,i,!0),t.tight&&!f||(v=!1),f=t.line-s>1&&t.isEmpty(t.line-1),t.tShift[s]=m,t.tight=g,t.parentType=p,t.blkIndent=h,t.ddIndent=u,t.tokens.push({type:"dd_close",level:--t.level}),a[1]=c=t.line,c>=i)break t;if(t.tShift[c]<t.blkIndent)break t;if((n=qi(t,c))<0)break;s=c}if(c>=i)break;if(r=c,t.isEmpty(r))break;if(t.tShift[r]<t.blkIndent)break;if((s=r+1)>=i)break;if(t.isEmpty(s)&&s++,s>=i)break;if(t.tShift[s]<t.blkIndent)break;if((n=qi(t,s))<0)break}return t.tokens.push({type:"dl_close",level:--t.level}),l[1]=c,t.line=c,v&&function(t,e){var i,o,n=t.level+2;for(i=e+2,o=t.tokens.length-2;i<o;i++)t.tokens[i].level===n&&"paragraph_open"===t.tokens[i].type&&(t.tokens[i+2].tight=!0,t.tokens[i].tight=!0,i+=2)}(t,d),!0},["paragraph"]],["paragraph",function(t,e){var i,o,n,s,r,a,l=e+1;if(l<(i=t.lineMax)&&!t.isEmpty(l))for(a=t.parser.ruler.getRules("paragraph");l<i&&!t.isEmpty(l);l++)if(!(t.tShift[l]-t.blkIndent>3)){for(n=!1,s=0,r=a.length;s<r;s++)if(a[s](t,l,i,!0)){n=!0;break}if(n)break}return o=t.getLines(e,l,t.blkIndent,!1).trim(),t.line=l,o.length&&(t.tokens.push({type:"paragraph_open",tight:!1,lines:[e,t.line],level:t.level}),t.tokens.push({type:"inline",content:o,level:t.level+1,lines:[e,t.line],children:[]}),t.tokens.push({type:"paragraph_close",tight:!1,level:t.level})),!0}]];function ji(){this.ruler=new pi;for(var t=0;t<Ui.length;t++)this.ruler.push(Ui[t][0],Ui[t][1],{alt:(Ui[t][2]||[]).slice()})}ji.prototype.tokenize=function(t,e,i){for(var o,n=this.ruler.getRules(""),s=n.length,r=e,a=!1;r<i&&(t.line=r=t.skipEmptyLines(r),!(r>=i))&&!(t.tShift[r]<t.blkIndent);){for(o=0;o<s&&!n[o](t,r,i,!1);o++);if(t.tight=!a,t.isEmpty(t.line-1)&&(a=!0),(r=t.line)<i&&t.isEmpty(r)){if(a=!0,++r<i&&"list"===t.parentType&&t.isEmpty(r))break;t.line=r}}};var Vi=/[\n\t]/g,Hi=/\r[\n\u0085]|[\u2424\u2028\u0085]/g,Wi=/\u00a0/g;function Zi(t){switch(t){case 10:case 92:case 96:case 42:case 95:case 94:case 91:case 93:case 33:case 38:case 60:case 62:case 123:case 125:case 36:case 37:case 64:case 126:case 43:case 61:case 58:return!0;default:return!1}}ji.prototype.parse=function(t,e,i,o){var n,s=0,r=0;if(!t)return[];(t=(t=t.replace(Wi," ")).replace(Hi,"\n")).indexOf("\t")>=0&&(t=t.replace(Vi,(function(e,i){var o;return 10===t.charCodeAt(i)?(s=i+1,r=0,e):(o=" ".slice((i-s-r)%4),r=i-s+1,o)}))),n=new Li(t,this,e,i,o),this.tokenize(n,n.line,n.lineMax)};for(var Yi=[],Gi=0;Gi<256;Gi++)Yi.push(0);function Ki(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122}function Xi(t,e){var i,o,n,s=e,r=!0,a=!0,l=t.posMax,d=t.src.charCodeAt(e);for(i=e>0?t.src.charCodeAt(e-1):-1;s<l&&t.src.charCodeAt(s)===d;)s++;return s>=l&&(r=!1),(n=s-e)>=4?r=a=!1:(32!==(o=s<l?t.src.charCodeAt(s):-1)&&10!==o||(r=!1),32!==i&&10!==i||(a=!1),95===d&&(Ki(i)&&(r=!1),Ki(o)&&(a=!1))),{can_open:r,can_close:a,delims:n}}"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach((function(t){Yi[t.charCodeAt(0)]=1}));var Qi=/\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;var Ji=/\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;var to=["coap","doi","javascript","aaa","aaas","about","acap","cap","cid","crid","data","dav","dict","dns","file","ftp","geo","go","gopher","h323","http","https","iax","icap","im","imap","info","ipp","iris","iris.beep","iris.xpc","iris.xpcs","iris.lwz","ldap","mailto","mid","msrp","msrps","mtqp","mupdate","news","nfs","ni","nih","nntp","opaquelocktoken","pop","pres","rtsp","service","session","shttp","sieve","sip","sips","sms","snmp","soap.beep","soap.beeps","tag","tel","telnet","tftp","thismessage","tn3270","tip","tv","urn","vemmi","ws","wss","xcon","xcon-userid","xmlrpc.beep","xmlrpc.beeps","xmpp","z39.50r","z39.50s","adiumxtra","afp","afs","aim","apt","attachment","aw","beshare","bitcoin","bolo","callto","chrome","chrome-extension","com-eventbrite-attendee","content","cvs","dlna-playsingle","dlna-playcontainer","dtn","dvb","ed2k","facetime","feed","finger","fish","gg","git","gizmoproject","gtalk","hcp","icon","ipn","irc","irc6","ircs","itms","jar","jms","keyparc","lastfm","ldaps","magnet","maps","market","message","mms","ms-help","msnim","mumble","mvn","notes","oid","palm","paparazzi","platform","proxy","psyc","query","res","resource","rmi","rsync","rtmp","secondlife","sftp","sgn","skype","smb","soldat","spotify","ssh","steam","svn","teamspeak","things","udp","unreal","ut2004","ventrilo","view-source","webcal","wtai","wyciwyg","xfire","xri","ymsgr"],eo=/^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/,io=/^<([a-zA-Z.\-]{1,25}):([^<>\x00-\x20]*)>/;function oo(t,e){return t=t.source,e=e||"",function i(o,n){return o?(n=n.source||n,t=t.replace(o,n),i):new RegExp(t,e)}}var no=oo(/(?:unquoted|single_quoted|double_quoted)/)("unquoted",/[^"'=<>`\x00-\x20]+/)("single_quoted",/'[^']*'/)("double_quoted",/"[^"]*"/)(),so=oo(/(?:\s+attr_name(?:\s*=\s*attr_value)?)/)("attr_name",/[a-zA-Z_:][a-zA-Z0-9:._-]*/)("attr_value",no)(),ro=oo(/<[A-Za-z][A-Za-z0-9]*attribute*\s*\/?>/)("attribute",so)(),ao=oo(/^(?:open_tag|close_tag|comment|processing|declaration|cdata)/)("open_tag",ro)("close_tag",/<\/[A-Za-z][A-Za-z0-9]*\s*>/)("comment",/<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->/)("processing",/<[?].*?[?]>/)("declaration",/<![A-Z]+\s+[^>]*>/)("cdata",/<!\[CDATA\[[\s\S]*?\]\]>/)();var lo=/^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i,co=/^&([a-z][a-z0-9]{1,31});/i;var ho=[["text",function(t,e){for(var i=t.pos;i<t.posMax&&!Zi(t.src.charCodeAt(i));)i++;return i!==t.pos&&(e||(t.pending+=t.src.slice(t.pos,i)),t.pos=i,!0)}],["newline",function(t,e){var i,o,n=t.pos;if(10!==t.src.charCodeAt(n))return!1;if(i=t.pending.length-1,o=t.posMax,!e)if(i>=0&&32===t.pending.charCodeAt(i))if(i>=1&&32===t.pending.charCodeAt(i-1)){for(var s=i-2;s>=0;s--)if(32!==t.pending.charCodeAt(s)){t.pending=t.pending.substring(0,s+1);break}t.push({type:"hardbreak",level:t.level})}else t.pending=t.pending.slice(0,-1),t.push({type:"softbreak",level:t.level});else t.push({type:"softbreak",level:t.level});for(n++;n<o&&32===t.src.charCodeAt(n);)n++;return t.pos=n,!0}],["escape",function(t,e){var i,o=t.pos,n=t.posMax;if(92!==t.src.charCodeAt(o))return!1;if(++o<n){if((i=t.src.charCodeAt(o))<256&&0!==Yi[i])return e||(t.pending+=t.src[o]),t.pos+=2,!0;if(10===i){for(e||t.push({type:"hardbreak",level:t.level}),o++;o<n&&32===t.src.charCodeAt(o);)o++;return t.pos=o,!0}}return e||(t.pending+="\\"),t.pos++,!0}],["backticks",function(t,e){var i,o,n,s,r,a=t.pos;if(96!==t.src.charCodeAt(a))return!1;for(i=a,a++,o=t.posMax;a<o&&96===t.src.charCodeAt(a);)a++;for(n=t.src.slice(i,a),s=r=a;-1!==(s=t.src.indexOf("`",r));){for(r=s+1;r<o&&96===t.src.charCodeAt(r);)r++;if(r-s===n.length)return e||t.push({type:"code",content:t.src.slice(a,s).replace(/[ \n]+/g," ").trim(),block:!1,level:t.level}),t.pos=r,!0}return e||(t.pending+=n),t.pos+=n.length,!0}],["del",function(t,e){var i,o,n,s,r,a=t.posMax,l=t.pos;if(126!==t.src.charCodeAt(l))return!1;if(e)return!1;if(l+4>=a)return!1;if(126!==t.src.charCodeAt(l+1))return!1;if(t.level>=t.options.maxNesting)return!1;if(s=l>0?t.src.charCodeAt(l-1):-1,r=t.src.charCodeAt(l+2),126===s)return!1;if(126===r)return!1;if(32===r||10===r)return!1;for(o=l+2;o<a&&126===t.src.charCodeAt(o);)o++;if(o>l+3)return t.pos+=o-l,e||(t.pending+=t.src.slice(l,o)),!0;for(t.pos=l+2,n=1;t.pos+1<a;){if(126===t.src.charCodeAt(t.pos)&&126===t.src.charCodeAt(t.pos+1)&&(s=t.src.charCodeAt(t.pos-1),126!==(r=t.pos+2<a?t.src.charCodeAt(t.pos+2):-1)&&126!==s&&(32!==s&&10!==s?n--:32!==r&&10!==r&&n++,n<=0))){i=!0;break}t.parser.skipToken(t)}return i?(t.posMax=t.pos,t.pos=l+2,e||(t.push({type:"del_open",level:t.level++}),t.parser.tokenize(t),t.push({type:"del_close",level:--t.level})),t.pos=t.posMax+2,t.posMax=a,!0):(t.pos=l,!1)}],["ins",function(t,e){var i,o,n,s,r,a=t.posMax,l=t.pos;if(43!==t.src.charCodeAt(l))return!1;if(e)return!1;if(l+4>=a)return!1;if(43!==t.src.charCodeAt(l+1))return!1;if(t.level>=t.options.maxNesting)return!1;if(s=l>0?t.src.charCodeAt(l-1):-1,r=t.src.charCodeAt(l+2),43===s)return!1;if(43===r)return!1;if(32===r||10===r)return!1;for(o=l+2;o<a&&43===t.src.charCodeAt(o);)o++;if(o!==l+2)return t.pos+=o-l,e||(t.pending+=t.src.slice(l,o)),!0;for(t.pos=l+2,n=1;t.pos+1<a;){if(43===t.src.charCodeAt(t.pos)&&43===t.src.charCodeAt(t.pos+1)&&(s=t.src.charCodeAt(t.pos-1),43!==(r=t.pos+2<a?t.src.charCodeAt(t.pos+2):-1)&&43!==s&&(32!==s&&10!==s?n--:32!==r&&10!==r&&n++,n<=0))){i=!0;break}t.parser.skipToken(t)}return i?(t.posMax=t.pos,t.pos=l+2,e||(t.push({type:"ins_open",level:t.level++}),t.parser.tokenize(t),t.push({type:"ins_close",level:--t.level})),t.pos=t.posMax+2,t.posMax=a,!0):(t.pos=l,!1)}],["mark",function(t,e){var i,o,n,s,r,a=t.posMax,l=t.pos;if(61!==t.src.charCodeAt(l))return!1;if(e)return!1;if(l+4>=a)return!1;if(61!==t.src.charCodeAt(l+1))return!1;if(t.level>=t.options.maxNesting)return!1;if(s=l>0?t.src.charCodeAt(l-1):-1,r=t.src.charCodeAt(l+2),61===s)return!1;if(61===r)return!1;if(32===r||10===r)return!1;for(o=l+2;o<a&&61===t.src.charCodeAt(o);)o++;if(o!==l+2)return t.pos+=o-l,e||(t.pending+=t.src.slice(l,o)),!0;for(t.pos=l+2,n=1;t.pos+1<a;){if(61===t.src.charCodeAt(t.pos)&&61===t.src.charCodeAt(t.pos+1)&&(s=t.src.charCodeAt(t.pos-1),61!==(r=t.pos+2<a?t.src.charCodeAt(t.pos+2):-1)&&61!==s&&(32!==s&&10!==s?n--:32!==r&&10!==r&&n++,n<=0))){i=!0;break}t.parser.skipToken(t)}return i?(t.posMax=t.pos,t.pos=l+2,e||(t.push({type:"mark_open",level:t.level++}),t.parser.tokenize(t),t.push({type:"mark_close",level:--t.level})),t.pos=t.posMax+2,t.posMax=a,!0):(t.pos=l,!1)}],["emphasis",function(t,e){var i,o,n,s,r,a,l,d=t.posMax,c=t.pos,h=t.src.charCodeAt(c);if(95!==h&&42!==h)return!1;if(e)return!1;if(i=(l=Xi(t,c)).delims,!l.can_open)return t.pos+=i,e||(t.pending+=t.src.slice(c,t.pos)),!0;if(t.level>=t.options.maxNesting)return!1;for(t.pos=c+i,a=[i];t.pos<d;)if(t.src.charCodeAt(t.pos)!==h)t.parser.skipToken(t);else{if(o=(l=Xi(t,t.pos)).delims,l.can_close){for(s=a.pop(),r=o;s!==r;){if(r<s){a.push(s-r);break}if(r-=s,0===a.length)break;t.pos+=s,s=a.pop()}if(0===a.length){i=s,n=!0;break}t.pos+=o;continue}l.can_open&&a.push(o),t.pos+=o}return n?(t.posMax=t.pos,t.pos=c+i,e||(2!==i&&3!==i||t.push({type:"strong_open",level:t.level++}),1!==i&&3!==i||t.push({type:"em_open",level:t.level++}),t.parser.tokenize(t),1!==i&&3!==i||t.push({type:"em_close",level:--t.level}),2!==i&&3!==i||t.push({type:"strong_close",level:--t.level})),t.pos=t.posMax+i,t.posMax=d,!0):(t.pos=c,!1)}],["sub",function(t,e){var i,o,n=t.posMax,s=t.pos;if(126!==t.src.charCodeAt(s))return!1;if(e)return!1;if(s+2>=n)return!1;if(t.level>=t.options.maxNesting)return!1;for(t.pos=s+1;t.pos<n;){if(126===t.src.charCodeAt(t.pos)){i=!0;break}t.parser.skipToken(t)}return i&&s+1!==t.pos?(o=t.src.slice(s+1,t.pos)).match(/(^|[^\\])(\\\\)*\s/)?(t.pos=s,!1):(t.posMax=t.pos,t.pos=s+1,e||t.push({type:"sub",level:t.level,content:o.replace(Qi,"$1")}),t.pos=t.posMax+1,t.posMax=n,!0):(t.pos=s,!1)}],["sup",function(t,e){var i,o,n=t.posMax,s=t.pos;if(94!==t.src.charCodeAt(s))return!1;if(e)return!1;if(s+2>=n)return!1;if(t.level>=t.options.maxNesting)return!1;for(t.pos=s+1;t.pos<n;){if(94===t.src.charCodeAt(t.pos)){i=!0;break}t.parser.skipToken(t)}return i&&s+1!==t.pos?(o=t.src.slice(s+1,t.pos)).match(/(^|[^\\])(\\\\)*\s/)?(t.pos=s,!1):(t.posMax=t.pos,t.pos=s+1,e||t.push({type:"sup",level:t.level,content:o.replace(Ji,"$1")}),t.pos=t.posMax+1,t.posMax=n,!0):(t.pos=s,!1)}],["links",function(t,e){var i,o,n,s,r,a,l,d,c=!1,h=t.pos,u=t.posMax,p=t.pos,m=t.src.charCodeAt(p);if(33===m&&(c=!0,m=t.src.charCodeAt(++p)),91!==m)return!1;if(t.level>=t.options.maxNesting)return!1;if(i=p+1,(o=gi(t,p))<0)return!1;if((a=o+1)<u&&40===t.src.charCodeAt(a)){for(a++;a<u&&(32===(d=t.src.charCodeAt(a))||10===d);a++);if(a>=u)return!1;for(p=a,yi(t,a)?(s=t.linkContent,a=t.pos):s="",p=a;a<u&&(32===(d=t.src.charCodeAt(a))||10===d);a++);if(a<u&&p!==a&&bi(t,a))for(r=t.linkContent,a=t.pos;a<u&&(32===(d=t.src.charCodeAt(a))||10===d);a++);else r="";if(a>=u||41!==t.src.charCodeAt(a))return t.pos=h,!1;a++}else{if(t.linkLevel>0)return!1;for(;a<u&&(32===(d=t.src.charCodeAt(a))||10===d);a++);if(a<u&&91===t.src.charCodeAt(a)&&(p=a+1,(a=gi(t,a))>=0?n=t.src.slice(p,a++):a=p-1),n||(void 0===n&&(a=o+1),n=t.src.slice(i,o)),!(l=t.env.references[xi(n)]))return t.pos=h,!1;s=l.href,r=l.title}return e||(t.pos=i,t.posMax=o,c?t.push({type:"image",src:s,title:r,alt:t.src.substr(i,o-i),level:t.level}):(t.push({type:"link_open",href:s,title:r,level:t.level++}),t.linkLevel++,t.parser.tokenize(t),t.linkLevel--,t.push({type:"link_close",level:--t.level}))),t.pos=a,t.posMax=u,!0}],["footnote_inline",function(t,e){var i,o,n,s,r=t.posMax,a=t.pos;return!(a+2>=r)&&(94===t.src.charCodeAt(a)&&(91===t.src.charCodeAt(a+1)&&(!(t.level>=t.options.maxNesting)&&(i=a+2,!((o=gi(t,a+1))<0)&&(e||(t.env.footnotes||(t.env.footnotes={}),t.env.footnotes.list||(t.env.footnotes.list=[]),n=t.env.footnotes.list.length,t.pos=i,t.posMax=o,t.push({type:"footnote_ref",id:n,level:t.level}),t.linkLevel++,s=t.tokens.length,t.parser.tokenize(t),t.env.footnotes.list[n]={tokens:t.tokens.splice(s)},t.linkLevel--),t.pos=o+1,t.posMax=r,!0)))))}],["footnote_ref",function(t,e){var i,o,n,s,r=t.posMax,a=t.pos;if(a+3>r)return!1;if(!t.env.footnotes||!t.env.footnotes.refs)return!1;if(91!==t.src.charCodeAt(a))return!1;if(94!==t.src.charCodeAt(a+1))return!1;if(t.level>=t.options.maxNesting)return!1;for(o=a+2;o<r;o++){if(32===t.src.charCodeAt(o))return!1;if(10===t.src.charCodeAt(o))return!1;if(93===t.src.charCodeAt(o))break}return o!==a+2&&(!(o>=r)&&(o++,i=t.src.slice(a+2,o-1),void 0!==t.env.footnotes.refs[":"+i]&&(e||(t.env.footnotes.list||(t.env.footnotes.list=[]),t.env.footnotes.refs[":"+i]<0?(n=t.env.footnotes.list.length,t.env.footnotes.list[n]={label:i,count:0},t.env.footnotes.refs[":"+i]=n):n=t.env.footnotes.refs[":"+i],s=t.env.footnotes.list[n].count,t.env.footnotes.list[n].count++,t.push({type:"footnote_ref",id:n,subId:s,level:t.level})),t.pos=o,t.posMax=r,!0)))}],["autolink",function(t,e){var i,o,n,s,r,a=t.pos;return 60===t.src.charCodeAt(a)&&(!((i=t.src.slice(a)).indexOf(">")<0)&&((o=i.match(io))?!(to.indexOf(o[1].toLowerCase())<0)&&(r=vi(s=o[0].slice(1,-1)),!!t.parser.validateLink(s)&&(e||(t.push({type:"link_open",href:r,level:t.level}),t.push({type:"text",content:s,level:t.level+1}),t.push({type:"link_close",level:t.level})),t.pos+=o[0].length,!0)):!!(n=i.match(eo))&&(r=vi("mailto:"+(s=n[0].slice(1,-1))),!!t.parser.validateLink(r)&&(e||(t.push({type:"link_open",href:r,level:t.level}),t.push({type:"text",content:s,level:t.level+1}),t.push({type:"link_close",level:t.level})),t.pos+=n[0].length,!0))))}],["htmltag",function(t,e){var i,o,n,s=t.pos;return!!t.options.html&&(n=t.posMax,!(60!==t.src.charCodeAt(s)||s+2>=n)&&(!(33!==(i=t.src.charCodeAt(s+1))&&63!==i&&47!==i&&!function(t){var e=32|t;return e>=97&&e<=122}(i))&&(!!(o=t.src.slice(s).match(ao))&&(e||t.push({type:"htmltag",content:t.src.slice(s,s+o[0].length),level:t.level}),t.pos+=o[0].length,!0))))}],["entity",function(t,e){var i,o,n=t.pos,s=t.posMax;if(38!==t.src.charCodeAt(n))return!1;if(n+1<s)if(35===t.src.charCodeAt(n+1)){if(o=t.src.slice(n).match(lo))return e||(i="x"===o[1][0].toLowerCase()?parseInt(o[1].slice(1),16):parseInt(o[1],10),t.pending+=Qe(i)?Je(i):Je(65533)),t.pos+=o[0].length,!0}else if(o=t.src.slice(n).match(co)){var r=Ze(o[1]);if(o[1]!==r)return e||(t.pending+=r),t.pos+=o[0].length,!0}return e||(t.pending+="&"),t.pos++,!0}]];function uo(){this.ruler=new pi;for(var t=0;t<ho.length;t++)this.ruler.push(ho[t][0],ho[t][1]);this.validateLink=po}function po(t){var e=t.trim().toLowerCase();return-1===(e=oi(e)).indexOf(":")||-1===["vbscript","javascript","file","data"].indexOf(e.split(":")[0])}uo.prototype.skipToken=function(t){var e,i,o=this.ruler.getRules(""),n=o.length,s=t.pos;if((i=t.cacheGet(s))>0)t.pos=i;else{for(e=0;e<n;e++)if(o[e](t,!0))return void t.cacheSet(s,t.pos);t.pos++,t.cacheSet(s,t.pos)}},uo.prototype.tokenize=function(t){for(var e,i,o=this.ruler.getRules(""),n=o.length,s=t.posMax;t.pos<s;){for(i=0;i<n&&!(e=o[i](t,!1));i++);if(e){if(t.pos>=s)break}else t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()},uo.prototype.parse=function(t,e,i,o){var n=new mi(t,this,e,i,o);this.tokenize(n)};var mo={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkTarget:"",typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["block","inline","references","replacements","smartquotes","references","abbr2","footnote_tail"]},block:{rules:["blockquote","code","fences","footnote","heading","hr","htmlblock","lheading","list","paragraph","table"]},inline:{rules:["autolink","backticks","del","emphasis","entity","escape","footnote_ref","htmltag","links","newline","text"]}}},full:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkTarget:"",typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{},block:{},inline:{}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkTarget:"",typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["block","inline","references","abbr2"]},block:{rules:["blockquote","code","fences","heading","hr","htmlblock","lheading","list","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","htmltag","links","newline","text"]}}}};function go(t,e,i){this.src=e,this.env=i,this.options=t.options,this.tokens=[],this.inlineMode=!1,this.inline=t.inline,this.block=t.block,this.renderer=t.renderer,this.typographer=t.typographer}function fo(t,e){"string"!=typeof t&&(e=t,t="default"),e&&null!=e.linkify&&console.warn("linkify option is removed. Use linkify plugin instead:\n\nimport Remarkable from 'remarkable';\nimport linkify from 'remarkable/linkify';\nnew Remarkable().use(linkify)\n"),this.inline=new uo,this.block=new ji,this.core=new Oi,this.renderer=new ui,this.ruler=new pi,this.options={},this.configure(mo[t]),this.set(e||{})}fo.prototype.set=function(t){Ge(this.options,t)},fo.prototype.configure=function(t){var e=this;if(!t)throw new Error("Wrong `remarkable` preset, check name/content");t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach((function(i){t.components[i].rules&&e[i].ruler.enable(t.components[i].rules,!0)}))},fo.prototype.use=function(t,e){return t(this,e),this},fo.prototype.parse=function(t,e){var i=new go(this,t,e);return this.core.process(i),i.tokens},fo.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)},fo.prototype.parseInline=function(t,e){var i=new go(this,t,e);return i.inlineMode=!0,this.core.process(i),i.tokens},fo.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};const vo=new fo;class yo extends Ue{constructor(t){if(super(t),t.type!==Fe)throw new Error("markdown directives only support child expressions")}update(t,[e]){return this.render(e)}}const bo=qe(class extends yo{render(t){return H`${Ve(vo.renderInline(t))}`}});class xo extends Ne{get value(){return this._value}set value(t){this._value=t}constructor(){super(),this.name="",this._value="",this.inputRoot=this,this.disabled=!1,this.hideErrors=!1,this.internals=this.attachInternals()}static get styles(){return a`
52
52
  :host {
53
53
  font-family: var(--font-family);
54
54
  }
@@ -176,7 +176,7 @@ const Be=1,Fe=2,qe=t=>(...e)=>({_$litDirective$:t,values:e});let Ue=class{constr
176
176
  pointer-events: none !important;
177
177
  }
178
178
  `}updated(t){if(super.updated(t),t.has("value")&&this.internals.setFormValue(this.value),t.has("errors")||t.has("hideErrors")){const t=!this.hideErrors&&this.errors&&this.errors.length>0;this.classList.toggle("has-error",t)}}get form(){return this.internals.form}setValue(t){this.value=this.serializeValue(t)}getDeserializedValue(){return this.value&&""!==this.value?JSON.parse(this.value):null}serializeValue(t){return JSON.stringify(t)}renderField(){const t=!this.hideErrors&&this.errors&&this.errors.length>0,e=t?this.errors.map((t=>H`
179
- <div class="alert-error">${yo(t)}</div>
179
+ <div class="alert-error">${bo(t)}</div>
180
180
  `)):[];return this.widgetOnly?H`
181
181
  <div class="${this.disabled?"disabled":""}">
182
182
  ${this.renderWidget()}
@@ -194,7 +194,7 @@ const Be=1,Fe=2,qe=t=>(...e)=>({_$litDirective$:t,values:e});let Ue=class{constr
194
194
  <div class="widget">${this.renderWidget()} ${e}</div>
195
195
  ${this.helpText&&"None"!==this.helpText?H`
196
196
  <div class="help-text">
197
- ${yo(this.helpText)}
197
+ ${bo(this.helpText)}
198
198
  </div>
199
199
  `:null}
200
200
  </div>
@@ -299,7 +299,7 @@ const Be=1,Fe=2,qe=t=>(...e)=>({_$litDirective$:t,values:e});let Ue=class{constr
299
299
  </div>
300
300
  </div>
301
301
  `}renderField(){const t=!this.hideErrors&&this.errors&&this.errors.length>0,e=t?this.errors.map((t=>H`
302
- <div class="alert-error">${yo(t)}</div>
302
+ <div class="alert-error">${bo(t)}</div>
303
303
  `)):[];return this.widgetOnly?H`
304
304
  <div class="${this.disabled?"disabled":""}">
305
305
  ${this.renderWidget()}
@@ -517,7 +517,7 @@ const ko=t=>t??Z
517
517
  * @license BSD-3-Clause
518
518
  * @version 11.2.5
519
519
  */
520
- class Oo{constructor(t=0,e=0,i=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=i,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){const e=this.items[t];delete this.items[t],this.size--,null!==e.prev&&(e.prev.next=e.next),null!==e.next&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){return t.map((t=>[t,this.get(t)]))}evict(t=!1){if(t||this.size>0){const t=this.first;delete this.items[t.key],0==--this.size?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){let e;if(this.has(t)){const i=this.items[t];this.ttl>0&&i.expiry<=Date.now()?this.delete(t):(e=i.value,this.set(t,e,!0))}return e}has(t){return t in this.items}keys(){const t=[];let e=this.first;for(;null!==e;)t.push(e.key),e=e.next;return t}set(t,e,i=!1,o=this.resetTtl){let n;if(i||this.has(t)){if(n=this.items[t],n.value=e,!1===i&&o&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==n){const t=this.last,e=n.next,i=n.prev;this.first===n&&(this.first=n.next),n.next=null,n.prev=this.last,t.next=n,null!==i&&(i.next=e),null!==e&&(e.prev=i)}}else this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},1==++this.size?this.first=n:this.last.next=n;return this.last=n,this}values(t=this.keys()){return t.map((t=>this.get(t)))}}function Lo(t=1e3,e=0,i=!1){if(isNaN(t)||t<0)throw new TypeError("Invalid max value");if(isNaN(e)||e<0)throw new TypeError("Invalid ttl value");if("boolean"!=typeof i)throw new TypeError("Invalid resetTtl value");return new Oo(t,e,i)}class zo extends Error{}class Po extends zo{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}}class Ro extends zo{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}}class No extends zo{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}}class Bo extends zo{}class Fo extends zo{constructor(t){super(`Invalid unit ${t}`)}}class qo extends zo{}class Uo extends zo{constructor(){super("Zone is an abstract class")}}const jo="numeric",Vo="short",Ho="long",Wo={year:jo,month:jo,day:jo},Zo={year:jo,month:Vo,day:jo},Yo={year:jo,month:Vo,day:jo,weekday:Vo},Go={year:jo,month:Ho,day:jo},Ko={year:jo,month:Ho,day:jo,weekday:Ho},Xo={hour:jo,minute:jo},Qo={hour:jo,minute:jo,second:jo},Jo={hour:jo,minute:jo,second:jo,timeZoneName:Vo},tn={hour:jo,minute:jo,second:jo,timeZoneName:Ho},en={hour:jo,minute:jo,hourCycle:"h23"},on={hour:jo,minute:jo,second:jo,hourCycle:"h23"},nn={hour:jo,minute:jo,second:jo,hourCycle:"h23",timeZoneName:Vo},sn={hour:jo,minute:jo,second:jo,hourCycle:"h23",timeZoneName:Ho},rn={year:jo,month:jo,day:jo,hour:jo,minute:jo},an={year:jo,month:jo,day:jo,hour:jo,minute:jo,second:jo},ln={year:jo,month:Vo,day:jo,hour:jo,minute:jo},dn={year:jo,month:Vo,day:jo,hour:jo,minute:jo,second:jo},cn={year:jo,month:Vo,day:jo,weekday:Vo,hour:jo,minute:jo},hn={year:jo,month:Ho,day:jo,hour:jo,minute:jo,timeZoneName:Vo},un={year:jo,month:Ho,day:jo,hour:jo,minute:jo,second:jo,timeZoneName:Vo},pn={year:jo,month:Ho,day:jo,weekday:Ho,hour:jo,minute:jo,timeZoneName:Ho},mn={year:jo,month:Ho,day:jo,weekday:Ho,hour:jo,minute:jo,second:jo,timeZoneName:Ho};class gn{get type(){throw new Uo}get name(){throw new Uo}get ianaName(){return this.name}get isUniversal(){throw new Uo}offsetName(t,e){throw new Uo}formatOffset(t,e){throw new Uo}offset(t){throw new Uo}equals(t){throw new Uo}get isValid(){throw new Uo}}let fn=null;class vn extends gn{static get instance(){return null===fn&&(fn=new vn),fn}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:e,locale:i}){return zs(t,e,i)}formatOffset(t,e){return Bs(this.offset(t),e)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return"system"===t.type}get isValid(){return!0}}let bn={};const yn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};let xn={};class _n extends gn{static create(t){return xn[t]||(xn[t]=new _n(t)),xn[t]}static resetCache(){xn={},bn={}}static isValidSpecifier(t){return this.isValidZone(t)}static isValidZone(t){if(!t)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:t}).format(),!0}catch(t){return!1}}constructor(t){super(),this.zoneName=t,this.valid=_n.isValidZone(t)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(t,{format:e,locale:i}){return zs(t,e,i,this.name)}formatOffset(t,e){return Bs(this.offset(t),e)}offset(t){const e=new Date(t);if(isNaN(e))return NaN;const i=(o=this.name,bn[o]||(bn[o]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:o,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),bn[o]);var o;let[n,s,r,a,l,d,c]=i.formatToParts?function(t,e){const i=t.formatToParts(e),o=[];for(let t=0;t<i.length;t++){const{type:e,value:n}=i[t],s=yn[e];"era"===e?o[s]=n:ms(s)||(o[s]=parseInt(n,10))}return o}(i,e):function(t,e){const i=t.format(e).replace(/\u200E/g,""),o=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(i),[,n,s,r,a,l,d,c]=o;return[r,n,s,a,l,d,c]}(i,e);"BC"===a&&(n=1-Math.abs(n));let h=+e;const u=h%1e3;return h-=u>=0?u:1e3+u,(Ms({year:n,month:s,day:r,hour:24===l?0:l,minute:d,second:c,millisecond:0})-h)/6e4}equals(t){return"iana"===t.type&&t.name===this.name}get isValid(){return this.valid}}let wn={};let kn={};function Cn(t,e={}){const i=JSON.stringify([t,e]);let o=kn[i];return o||(o=new Intl.DateTimeFormat(t,e),kn[i]=o),o}let Sn={};let An={};let En=null;let $n={};function Tn(t,e,i,o){const n=t.listingMode();return"error"===n?null:"en"===n?i(e):o(e)}class Dn{constructor(t,e,i){this.padTo=i.padTo||0,this.floor=i.floor||!1;const{padTo:o,floor:n,...s}=i;if(!e||Object.keys(s).length>0){const e={useGrouping:!1,...i};i.padTo>0&&(e.minimumIntegerDigits=i.padTo),this.inf=function(t,e={}){const i=JSON.stringify([t,e]);let o=Sn[i];return o||(o=new Intl.NumberFormat(t,e),Sn[i]=o),o}(t,e)}}format(t){if(this.inf){const e=this.floor?Math.floor(t):t;return this.inf.format(e)}return ks(this.floor?Math.floor(t):Es(t,3),this.padTo)}}class Mn{constructor(t,e,i){let o;if(this.opts=i,this.originalZone=void 0,this.opts.timeZone)this.dt=t;else if("fixed"===t.zone.type){const e=t.offset/60*-1,i=e>=0?`Etc/GMT+${e}`:`Etc/GMT${e}`;0!==t.offset&&_n.create(i).valid?(o=i,this.dt=t):(o="UTC",this.dt=0===t.offset?t:t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone)}else"system"===t.zone.type?this.dt=t:"iana"===t.zone.type?(this.dt=t,o=t.zone.name):(o="UTC",this.dt=t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone);const n={...this.opts};n.timeZone=n.timeZone||o,this.dtf=Cn(e,n)}format(){return this.originalZone?this.formatToParts().map((({value:t})=>t)).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const t=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?t.map((t=>{if("timeZoneName"===t.type){const e=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:e}}return t})):t}resolvedOptions(){return this.dtf.resolvedOptions()}}class In{constructor(t,e,i){this.opts={style:"long",...i},!e&&vs()&&(this.rtf=function(t,e={}){const{base:i,...o}=e,n=JSON.stringify([t,o]);let s=An[n];return s||(s=new Intl.RelativeTimeFormat(t,e),An[n]=s),s}(t,i))}format(t,e){return this.rtf?this.rtf.format(t,e):function(t,e,i="always",o=!1){const n={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=-1===["hours","minutes","seconds"].indexOf(t);if("auto"===i&&s){const i="days"===t;switch(e){case 1:return i?"tomorrow":`next ${n[t][0]}`;case-1:return i?"yesterday":`last ${n[t][0]}`;case 0:return i?"today":`this ${n[t][0]}`}}const r=Object.is(e,-0)||e<0,a=Math.abs(e),l=1===a,d=n[t],c=o?l?d[1]:d[2]||d[1]:l?n[t][0]:t;return r?`${a} ${c} ago`:`in ${a} ${c}`}(e,t,this.opts.numeric,"long"!==this.opts.style)}formatToParts(t,e){return this.rtf?this.rtf.formatToParts(t,e):[]}}const On={firstDay:1,minimalDays:4,weekend:[6,7]};class Ln{static fromOpts(t){return Ln.create(t.locale,t.numberingSystem,t.outputCalendar,t.weekSettings,t.defaultToEN)}static create(t,e,i,o,n=!1){const s=t||Qn.defaultLocale,r=s||(n?"en-US":En||(En=(new Intl.DateTimeFormat).resolvedOptions().locale,En)),a=e||Qn.defaultNumberingSystem,l=i||Qn.defaultOutputCalendar,d=_s(o)||Qn.defaultWeekSettings;return new Ln(r,a,l,d,s)}static resetCache(){En=null,kn={},Sn={},An={}}static fromObject({locale:t,numberingSystem:e,outputCalendar:i,weekSettings:o}={}){return Ln.create(t,e,i,o)}constructor(t,e,i,o,n){const[s,r,a]=function(t){const e=t.indexOf("-x-");-1!==e&&(t=t.substring(0,e));const i=t.indexOf("-u-");if(-1===i)return[t];{let e,o;try{e=Cn(t).resolvedOptions(),o=t}catch(n){const s=t.substring(0,i);e=Cn(s).resolvedOptions(),o=s}const{numberingSystem:n,calendar:s}=e;return[o,n,s]}}(t);this.locale=s,this.numberingSystem=e||r||null,this.outputCalendar=i||a||null,this.weekSettings=o,this.intl=function(t,e,i){return i||e?(t.includes("-u-")||(t+="-u"),i&&(t+=`-ca-${i}`),e&&(t+=`-nu-${e}`),t):t}(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=n,this.fastNumbersCached=null}get fastNumbers(){var t;return null==this.fastNumbersCached&&(this.fastNumbersCached=(!(t=this).numberingSystem||"latn"===t.numberingSystem)&&("latn"===t.numberingSystem||!t.locale||t.locale.startsWith("en")||"latn"===new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem)),this.fastNumbersCached}listingMode(){const t=this.isEnglish(),e=!(null!==this.numberingSystem&&"latn"!==this.numberingSystem||null!==this.outputCalendar&&"gregory"!==this.outputCalendar);return t&&e?"en":"intl"}clone(t){return t&&0!==Object.getOwnPropertyNames(t).length?Ln.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,_s(t.weekSettings)||this.weekSettings,t.defaultToEN||!1):this}redefaultToEN(t={}){return this.clone({...t,defaultToEN:!0})}redefaultToSystem(t={}){return this.clone({...t,defaultToEN:!1})}months(t,e=!1){return Tn(this,t,Vs,(()=>{const i=e?{month:t,day:"numeric"}:{month:t},o=e?"format":"standalone";return this.monthsCache[o][t]||(this.monthsCache[o][t]=function(t){const e=[];for(let i=1;i<=12;i++){const o=Za.utc(2009,i,1);e.push(t(o))}return e}((t=>this.extract(t,i,"month")))),this.monthsCache[o][t]}))}weekdays(t,e=!1){return Tn(this,t,Ys,(()=>{const i=e?{weekday:t,year:"numeric",month:"long",day:"numeric"}:{weekday:t},o=e?"format":"standalone";return this.weekdaysCache[o][t]||(this.weekdaysCache[o][t]=function(t){const e=[];for(let i=1;i<=7;i++){const o=Za.utc(2016,11,13+i);e.push(t(o))}return e}((t=>this.extract(t,i,"weekday")))),this.weekdaysCache[o][t]}))}meridiems(){return Tn(this,void 0,(()=>Gs),(()=>{if(!this.meridiemCache){const t={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Za.utc(2016,11,13,9),Za.utc(2016,11,13,19)].map((e=>this.extract(e,t,"dayperiod")))}return this.meridiemCache}))}eras(t){return Tn(this,t,Js,(()=>{const e={era:t};return this.eraCache[t]||(this.eraCache[t]=[Za.utc(-40,1,1),Za.utc(2017,1,1)].map((t=>this.extract(t,e,"era")))),this.eraCache[t]}))}extract(t,e,i){const o=this.dtFormatter(t,e).formatToParts().find((t=>t.type.toLowerCase()===i));return o?o.value:null}numberFormatter(t={}){return new Dn(this.intl,t.forceSimple||this.fastNumbers,t)}dtFormatter(t,e={}){return new Mn(t,this.intl,e)}relFormatter(t={}){return new In(this.intl,this.isEnglish(),t)}listFormatter(t={}){return function(t,e={}){const i=JSON.stringify([t,e]);let o=wn[i];return o||(o=new Intl.ListFormat(t,e),wn[i]=o),o}(this.intl,t)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:bs()?function(t){let e=$n[t];if(!e){const i=new Intl.Locale(t);e="getWeekInfo"in i?i.getWeekInfo():i.weekInfo,$n[t]=e}return e}(this.locale):On}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(t){return this.locale===t.locale&&this.numberingSystem===t.numberingSystem&&this.outputCalendar===t.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let zn=null;class Pn extends gn{static get utcInstance(){return null===zn&&(zn=new Pn(0)),zn}static instance(t){return 0===t?Pn.utcInstance:new Pn(t)}static parseSpecifier(t){if(t){const e=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(e)return new Pn(Ps(e[1],e[2]))}return null}constructor(t){super(),this.fixed=t}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${Bs(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${Bs(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(t,e){return Bs(this.fixed,e)}get isUniversal(){return!0}offset(){return this.fixed}equals(t){return"fixed"===t.type&&t.fixed===this.fixed}get isValid(){return!0}}class Rn extends gn{constructor(t){super(),this.zoneName=t}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function Nn(t,e){if(ms(t)||null===t)return e;if(t instanceof gn)return t;if(function(t){return"string"==typeof t}(t)){const i=t.toLowerCase();return"default"===i?e:"local"===i||"system"===i?vn.instance:"utc"===i||"gmt"===i?Pn.utcInstance:Pn.parseSpecifier(i)||_n.create(t)}return gs(t)?Pn.instance(t):"object"==typeof t&&"offset"in t&&"function"==typeof t.offset?t:new Rn(t)}const Bn={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Fn={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},qn=Bn.hanidec.replace(/[\[|\]]/g,"").split("");let Un={};function jn({numberingSystem:t},e=""){const i=t||"latn";return Un[i]||(Un[i]={}),Un[i][e]||(Un[i][e]=new RegExp(`${Bn[i]}${e}`)),Un[i][e]}let Vn,Hn=()=>Date.now(),Wn="system",Zn=null,Yn=null,Gn=null,Kn=60,Xn=null;class Qn{static get now(){return Hn}static set now(t){Hn=t}static set defaultZone(t){Wn=t}static get defaultZone(){return Nn(Wn,vn.instance)}static get defaultLocale(){return Zn}static set defaultLocale(t){Zn=t}static get defaultNumberingSystem(){return Yn}static set defaultNumberingSystem(t){Yn=t}static get defaultOutputCalendar(){return Gn}static set defaultOutputCalendar(t){Gn=t}static get defaultWeekSettings(){return Xn}static set defaultWeekSettings(t){Xn=_s(t)}static get twoDigitCutoffYear(){return Kn}static set twoDigitCutoffYear(t){Kn=t%100}static get throwOnInvalid(){return Vn}static set throwOnInvalid(t){Vn=t}static resetCaches(){Ln.resetCache(),_n.resetCache(),Za.resetCache(),Un={}}}class Jn{constructor(t,e){this.reason=t,this.explanation=e}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const ts=[0,31,59,90,120,151,181,212,243,273,304,334],es=[0,31,60,91,121,152,182,213,244,274,305,335];function is(t,e){return new Jn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function os(t,e,i){const o=new Date(Date.UTC(t,e-1,i));t<100&&t>=0&&o.setUTCFullYear(o.getUTCFullYear()-1900);const n=o.getUTCDay();return 0===n?7:n}function ns(t,e,i){return i+($s(t)?es:ts)[e-1]}function ss(t,e){const i=$s(t)?es:ts,o=i.findIndex((t=>t<e));return{month:o+1,day:e-i[o]}}function rs(t,e){return(t-e+7)%7+1}function as(t,e=4,i=1){const{year:o,month:n,day:s}=t,r=ns(o,n,s),a=rs(os(o,n,s),i);let l,d=Math.floor((r-a+14-e)/7);return d<1?(l=o-1,d=Os(l,e,i)):d>Os(o,e,i)?(l=o+1,d=1):l=o,{weekYear:l,weekNumber:d,weekday:a,...Fs(t)}}function ls(t,e=4,i=1){const{weekYear:o,weekNumber:n,weekday:s}=t,r=rs(os(o,1,e),i),a=Ts(o);let l,d=7*n+s-r-7+e;d<1?(l=o-1,d+=Ts(l)):d>a?(l=o+1,d-=Ts(o)):l=o;const{month:c,day:h}=ss(l,d);return{year:l,month:c,day:h,...Fs(t)}}function ds(t){const{year:e,month:i,day:o}=t;return{year:e,ordinal:ns(e,i,o),...Fs(t)}}function cs(t){const{year:e,ordinal:i}=t,{month:o,day:n}=ss(e,i);return{year:e,month:o,day:n,...Fs(t)}}function hs(t,e){if(!ms(t.localWeekday)||!ms(t.localWeekNumber)||!ms(t.localWeekYear)){if(!ms(t.weekday)||!ms(t.weekNumber)||!ms(t.weekYear))throw new Bo("Cannot mix locale-based week fields with ISO-based week fields");return ms(t.localWeekday)||(t.weekday=t.localWeekday),ms(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),ms(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}return{minDaysInFirstWeek:4,startOfWeek:1}}function us(t){const e=fs(t.year),i=ws(t.month,1,12),o=ws(t.day,1,Ds(t.year,t.month));return e?i?!o&&is("day",t.day):is("month",t.month):is("year",t.year)}function ps(t){const{hour:e,minute:i,second:o,millisecond:n}=t,s=ws(e,0,23)||24===e&&0===i&&0===o&&0===n,r=ws(i,0,59),a=ws(o,0,59),l=ws(n,0,999);return s?r?a?!l&&is("millisecond",n):is("second",o):is("minute",i):is("hour",e)}function ms(t){return void 0===t}function gs(t){return"number"==typeof t}function fs(t){return"number"==typeof t&&t%1==0}function vs(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(t){return!1}}function bs(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(t){return!1}}function ys(t,e,i){if(0!==t.length)return t.reduce(((t,o)=>{const n=[e(o),o];return t&&i(t[0],n[0])===t[0]?t:n}),null)[1]}function xs(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function _s(t){if(null==t)return null;if("object"!=typeof t)throw new qo("Week settings must be an object");if(!ws(t.firstDay,1,7)||!ws(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some((t=>!ws(t,1,7))))throw new qo("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function ws(t,e,i){return fs(t)&&t>=e&&t<=i}function ks(t,e=2){let i;return i=t<0?"-"+(""+-t).padStart(e,"0"):(""+t).padStart(e,"0"),i}function Cs(t){return ms(t)||null===t||""===t?void 0:parseInt(t,10)}function Ss(t){return ms(t)||null===t||""===t?void 0:parseFloat(t)}function As(t){if(!ms(t)&&null!==t&&""!==t){const e=1e3*parseFloat("0."+t);return Math.floor(e)}}function Es(t,e,i=!1){const o=10**e;return(i?Math.trunc:Math.round)(t*o)/o}function $s(t){return t%4==0&&(t%100!=0||t%400==0)}function Ts(t){return $s(t)?366:365}function Ds(t,e){const i=function(t,e){return t-e*Math.floor(t/e)}(e-1,12)+1;return 2===i?$s(t+(e-i)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][i-1]}function Ms(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function Is(t,e,i){return-rs(os(t,1,e),i)+e-1}function Os(t,e=4,i=1){const o=Is(t,e,i),n=Is(t+1,e,i);return(Ts(t)-o+n)/7}function Ls(t){return t>99?t:t>Qn.twoDigitCutoffYear?1900+t:2e3+t}function zs(t,e,i,o=null){const n=new Date(t),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};o&&(s.timeZone=o);const r={timeZoneName:e,...s},a=new Intl.DateTimeFormat(i,r).formatToParts(n).find((t=>"timezonename"===t.type.toLowerCase()));return a?a.value:null}function Ps(t,e){let i=parseInt(t,10);Number.isNaN(i)&&(i=0);const o=parseInt(e,10)||0;return 60*i+(i<0||Object.is(i,-0)?-o:o)}function Rs(t){const e=Number(t);if("boolean"==typeof t||""===t||Number.isNaN(e))throw new qo(`Invalid unit value ${t}`);return e}function Ns(t,e){const i={};for(const o in t)if(xs(t,o)){const n=t[o];if(null==n)continue;i[e(o)]=Rs(n)}return i}function Bs(t,e){const i=Math.trunc(Math.abs(t/60)),o=Math.trunc(Math.abs(t%60)),n=t>=0?"+":"-";switch(e){case"short":return`${n}${ks(i,2)}:${ks(o,2)}`;case"narrow":return`${n}${i}${o>0?`:${o}`:""}`;case"techie":return`${n}${ks(i,2)}${ks(o,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Fs(t){return function(t,e){return e.reduce(((e,i)=>(e[i]=t[i],e)),{})}(t,["hour","minute","second","millisecond"])}const qs=["January","February","March","April","May","June","July","August","September","October","November","December"],Us=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],js=["J","F","M","A","M","J","J","A","S","O","N","D"];function Vs(t){switch(t){case"narrow":return[...js];case"short":return[...Us];case"long":return[...qs];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Hs=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Ws=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Zs=["M","T","W","T","F","S","S"];function Ys(t){switch(t){case"narrow":return[...Zs];case"short":return[...Ws];case"long":return[...Hs];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Gs=["AM","PM"],Ks=["Before Christ","Anno Domini"],Xs=["BC","AD"],Qs=["B","A"];function Js(t){switch(t){case"narrow":return[...Qs];case"short":return[...Xs];case"long":return[...Ks];default:return null}}function tr(t,e){let i="";for(const o of t)o.literal?i+=o.val:i+=e(o.val);return i}const er={D:Wo,DD:Zo,DDD:Go,DDDD:Ko,t:Xo,tt:Qo,ttt:Jo,tttt:tn,T:en,TT:on,TTT:nn,TTTT:sn,f:rn,ff:ln,fff:hn,ffff:pn,F:an,FF:dn,FFF:un,FFFF:mn};class ir{static create(t,e={}){return new ir(t,e)}static parseFormat(t){let e=null,i="",o=!1;const n=[];for(let s=0;s<t.length;s++){const r=t.charAt(s);"'"===r?(i.length>0&&n.push({literal:o||/^\s+$/.test(i),val:i}),e=null,i="",o=!o):o||r===e?i+=r:(i.length>0&&n.push({literal:/^\s+$/.test(i),val:i}),i=r,e=r)}return i.length>0&&n.push({literal:o||/^\s+$/.test(i),val:i}),n}static macroTokenToFormatOpts(t){return er[t]}constructor(t,e){this.opts=e,this.loc=t,this.systemLoc=null}formatWithSystemDefault(t,e){null===this.systemLoc&&(this.systemLoc=this.loc.redefaultToSystem());return this.systemLoc.dtFormatter(t,{...this.opts,...e}).format()}dtFormatter(t,e={}){return this.loc.dtFormatter(t,{...this.opts,...e})}formatDateTime(t,e){return this.dtFormatter(t,e).format()}formatDateTimeParts(t,e){return this.dtFormatter(t,e).formatToParts()}formatInterval(t,e){return this.dtFormatter(t.start,e).dtf.formatRange(t.start.toJSDate(),t.end.toJSDate())}resolvedOptions(t,e){return this.dtFormatter(t,e).resolvedOptions()}num(t,e=0){if(this.opts.forceSimple)return ks(t,e);const i={...this.opts};return e>0&&(i.padTo=e),this.loc.numberFormatter(i).format(t)}formatDateTimeFromString(t,e){const i="en"===this.loc.listingMode(),o=this.loc.outputCalendar&&"gregory"!==this.loc.outputCalendar,n=(e,i)=>this.loc.extract(t,e,i),s=e=>t.isOffsetFixed&&0===t.offset&&e.allowZ?"Z":t.isValid?t.zone.formatOffset(t.ts,e.format):"",r=()=>i?function(t){return Gs[t.hour<12?0:1]}(t):n({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(e,o)=>i?function(t,e){return Vs(e)[t.month-1]}(t,e):n(o?{month:e}:{month:e,day:"numeric"},"month"),l=(e,o)=>i?function(t,e){return Ys(e)[t.weekday-1]}(t,e):n(o?{weekday:e}:{weekday:e,month:"long",day:"numeric"},"weekday"),d=e=>{const i=ir.macroTokenToFormatOpts(e);return i?this.formatWithSystemDefault(t,i):e},c=e=>i?function(t,e){return Js(e)[t.year<0?0:1]}(t,e):n({era:e},"era");return tr(ir.parseFormat(e),(e=>{switch(e){case"S":return this.num(t.millisecond);case"u":case"SSS":return this.num(t.millisecond,3);case"s":return this.num(t.second);case"ss":return this.num(t.second,2);case"uu":return this.num(Math.floor(t.millisecond/10),2);case"uuu":return this.num(Math.floor(t.millisecond/100));case"m":return this.num(t.minute);case"mm":return this.num(t.minute,2);case"h":return this.num(t.hour%12==0?12:t.hour%12);case"hh":return this.num(t.hour%12==0?12:t.hour%12,2);case"H":return this.num(t.hour);case"HH":return this.num(t.hour,2);case"Z":return s({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return s({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return s({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return t.zone.offsetName(t.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return t.zone.offsetName(t.ts,{format:"long",locale:this.loc.locale});case"z":return t.zoneName;case"a":return r();case"d":return o?n({day:"numeric"},"day"):this.num(t.day);case"dd":return o?n({day:"2-digit"},"day"):this.num(t.day,2);case"c":case"E":return this.num(t.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return o?n({month:"numeric",day:"numeric"},"month"):this.num(t.month);case"LL":return o?n({month:"2-digit",day:"numeric"},"month"):this.num(t.month,2);case"LLL":return a("short",!0);case"LLLL":return a("long",!0);case"LLLLL":return a("narrow",!0);case"M":return o?n({month:"numeric"},"month"):this.num(t.month);case"MM":return o?n({month:"2-digit"},"month"):this.num(t.month,2);case"MMM":return a("short",!1);case"MMMM":return a("long",!1);case"MMMMM":return a("narrow",!1);case"y":return o?n({year:"numeric"},"year"):this.num(t.year);case"yy":return o?n({year:"2-digit"},"year"):this.num(t.year.toString().slice(-2),2);case"yyyy":return o?n({year:"numeric"},"year"):this.num(t.year,4);case"yyyyyy":return o?n({year:"numeric"},"year"):this.num(t.year,6);case"G":return c("short");case"GG":return c("long");case"GGGGG":return c("narrow");case"kk":return this.num(t.weekYear.toString().slice(-2),2);case"kkkk":return this.num(t.weekYear,4);case"W":return this.num(t.weekNumber);case"WW":return this.num(t.weekNumber,2);case"n":return this.num(t.localWeekNumber);case"nn":return this.num(t.localWeekNumber,2);case"ii":return this.num(t.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(t.localWeekYear,4);case"o":return this.num(t.ordinal);case"ooo":return this.num(t.ordinal,3);case"q":return this.num(t.quarter);case"qq":return this.num(t.quarter,2);case"X":return this.num(Math.floor(t.ts/1e3));case"x":return this.num(t.ts);default:return d(e)}}))}formatDurationFromString(t,e){const i=t=>{switch(t[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},o=ir.parseFormat(e),n=o.reduce(((t,{literal:e,val:i})=>e?t:t.concat(i)),[]),s=t.shiftTo(...n.map(i).filter((t=>t)));return tr(o,(t=>e=>{const o=i(e);return o?this.num(t.get(o),e.length):e})(s))}}const or=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function nr(...t){const e=t.reduce(((t,e)=>t+e.source),"");return RegExp(`^${e}$`)}function sr(...t){return e=>t.reduce((([t,i,o],n)=>{const[s,r,a]=n(e,o);return[{...t,...s},r||i,a]}),[{},null,1]).slice(0,2)}function rr(t,...e){if(null==t)return[null,null];for(const[i,o]of e){const e=i.exec(t);if(e)return o(e)}return[null,null]}function ar(...t){return(e,i)=>{const o={};let n;for(n=0;n<t.length;n++)o[t[n]]=Cs(e[i+n]);return[o,null,i+n]}}const lr=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,dr=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,cr=RegExp(`${dr.source}${`(?:${lr.source}?(?:\\[(${or.source})\\])?)?`}`),hr=RegExp(`(?:T${cr.source})?`),ur=ar("weekYear","weekNumber","weekDay"),pr=ar("year","ordinal"),mr=RegExp(`${dr.source} ?(?:${lr.source}|(${or.source}))?`),gr=RegExp(`(?: ${mr.source})?`);function fr(t,e,i){const o=t[e];return ms(o)?i:Cs(o)}function vr(t,e){return[{hours:fr(t,e,0),minutes:fr(t,e+1,0),seconds:fr(t,e+2,0),milliseconds:As(t[e+3])},null,e+4]}function br(t,e){const i=!t[e]&&!t[e+1],o=Ps(t[e+1],t[e+2]);return[{},i?null:Pn.instance(o),e+3]}function yr(t,e){return[{},t[e]?_n.create(t[e]):null,e+1]}const xr=RegExp(`^T?${dr.source}$`),_r=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function wr(t){const[e,i,o,n,s,r,a,l,d]=t,c="-"===e[0],h=l&&"-"===l[0],u=(t,e=!1)=>void 0!==t&&(e||t&&c)?-t:t;return[{years:u(Ss(i)),months:u(Ss(o)),weeks:u(Ss(n)),days:u(Ss(s)),hours:u(Ss(r)),minutes:u(Ss(a)),seconds:u(Ss(l),"-0"===l),milliseconds:u(As(d),h)}]}const kr={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Cr(t,e,i,o,n,s,r){const a={year:2===e.length?Ls(Cs(e)):Cs(e),month:Us.indexOf(i)+1,day:Cs(o),hour:Cs(n),minute:Cs(s)};return r&&(a.second=Cs(r)),t&&(a.weekday=t.length>3?Hs.indexOf(t)+1:Ws.indexOf(t)+1),a}const Sr=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Ar(t){const[,e,i,o,n,s,r,a,l,d,c,h]=t,u=Cr(e,n,o,i,s,r,a);let p;return p=l?kr[l]:d?0:Ps(c,h),[u,new Pn(p)]}const Er=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,$r=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Tr=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function Dr(t){const[,e,i,o,n,s,r,a]=t;return[Cr(e,n,o,i,s,r,a),Pn.utcInstance]}function Mr(t){const[,e,i,o,n,s,r,a]=t;return[Cr(e,a,i,o,n,s,r),Pn.utcInstance]}const Ir=nr(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,hr),Or=nr(/(\d{4})-?W(\d\d)(?:-?(\d))?/,hr),Lr=nr(/(\d{4})-?(\d{3})/,hr),zr=nr(cr),Pr=sr((function(t,e){return[{year:fr(t,e),month:fr(t,e+1,1),day:fr(t,e+2,1)},null,e+3]}),vr,br,yr),Rr=sr(ur,vr,br,yr),Nr=sr(pr,vr,br,yr),Br=sr(vr,br,yr);const Fr=sr(vr);const qr=nr(/(\d{4})-(\d\d)-(\d\d)/,gr),Ur=nr(mr),jr=sr(vr,br,yr);const Vr="Invalid Duration",Hr={weeks:{days:7,hours:168,minutes:10080,seconds:604800,milliseconds:6048e5},days:{hours:24,minutes:1440,seconds:86400,milliseconds:864e5},hours:{minutes:60,seconds:3600,milliseconds:36e5},minutes:{seconds:60,milliseconds:6e4},seconds:{milliseconds:1e3}},Wr={years:{quarters:4,months:12,weeks:52,days:365,hours:8760,minutes:525600,seconds:31536e3,milliseconds:31536e6},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:131040,seconds:7862400,milliseconds:78624e5},months:{weeks:4,days:30,hours:720,minutes:43200,seconds:2592e3,milliseconds:2592e6},...Hr},Zr=365.2425,Yr=30.436875,Gr={years:{quarters:4,months:12,weeks:52.1775,days:Zr,hours:8765.82,minutes:525949.2,seconds:525949.2*60,milliseconds:525949.2*60*1e3},quarters:{months:3,weeks:13.044375,days:91.310625,hours:2191.455,minutes:131487.3,seconds:525949.2*60/4,milliseconds:7889237999.999999},months:{weeks:4.3481250000000005,days:Yr,hours:730.485,minutes:43829.1,seconds:2629746,milliseconds:2629746e3},...Hr},Kr=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Xr=Kr.slice(0).reverse();function Qr(t,e,i=!1){const o={values:i?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new ea(o)}function Jr(t,e){let i=e.milliseconds??0;for(const o of Xr.slice(1))e[o]&&(i+=e[o]*t[o].milliseconds);return i}function ta(t,e){const i=Jr(t,e)<0?-1:1;Kr.reduceRight(((o,n)=>{if(ms(e[n]))return o;if(o){const s=e[o]*i,r=t[n][o],a=Math.floor(s/r);e[n]+=a*i,e[o]-=a*r*i}return n}),null),Kr.reduce(((i,o)=>{if(ms(e[o]))return i;if(i){const n=e[i]%1;e[i]-=n,e[o]+=n*t[i][o]}return o}),null)}class ea{constructor(t){const e="longterm"===t.conversionAccuracy||!1;let i=e?Gr:Wr;t.matrix&&(i=t.matrix),this.values=t.values,this.loc=t.loc||Ln.create(),this.conversionAccuracy=e?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=i,this.isLuxonDuration=!0}static fromMillis(t,e){return ea.fromObject({milliseconds:t},e)}static fromObject(t,e={}){if(null==t||"object"!=typeof t)throw new qo("Duration.fromObject: argument expected to be an object, got "+(null===t?"null":typeof t));return new ea({values:Ns(t,ea.normalizeUnit),loc:Ln.fromObject(e),conversionAccuracy:e.conversionAccuracy,matrix:e.matrix})}static fromDurationLike(t){if(gs(t))return ea.fromMillis(t);if(ea.isDuration(t))return t;if("object"==typeof t)return ea.fromObject(t);throw new qo(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,e){const[i]=function(t){return rr(t,[_r,wr])}(t);return i?ea.fromObject(i,e):ea.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,e){const[i]=function(t){return rr(t,[xr,Fr])}(t);return i?ea.fromObject(i,e):ea.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,e=null){if(!t)throw new qo("need to specify a reason the Duration is invalid");const i=t instanceof Jn?t:new Jn(t,e);if(Qn.throwOnInvalid)throw new No(i);return new ea({invalid:i})}static normalizeUnit(t){const e={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[t?t.toLowerCase():t];if(!e)throw new Fo(t);return e}static isDuration(t){return t&&t.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(t,e={}){const i={...e,floor:!1!==e.round&&!1!==e.floor};return this.isValid?ir.create(this.loc,i).formatDurationFromString(this,t):Vr}toHuman(t={}){if(!this.isValid)return Vr;const e=Kr.map((e=>{const i=this.values[e];return ms(i)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...t,unit:e.slice(0,-1)}).format(i)})).filter((t=>t));return this.loc.listFormatter({type:"conjunction",style:t.listStyle||"narrow",...t}).format(e)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let t="P";return 0!==this.years&&(t+=this.years+"Y"),0===this.months&&0===this.quarters||(t+=this.months+3*this.quarters+"M"),0!==this.weeks&&(t+=this.weeks+"W"),0!==this.days&&(t+=this.days+"D"),0===this.hours&&0===this.minutes&&0===this.seconds&&0===this.milliseconds||(t+="T"),0!==this.hours&&(t+=this.hours+"H"),0!==this.minutes&&(t+=this.minutes+"M"),0===this.seconds&&0===this.milliseconds||(t+=Es(this.seconds+this.milliseconds/1e3,3)+"S"),"P"===t&&(t+="T0S"),t}toISOTime(t={}){if(!this.isValid)return null;const e=this.toMillis();if(e<0||e>=864e5)return null;t={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...t,includeOffset:!1};return Za.fromMillis(e,{zone:"UTC"}).toISOTime(t)}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Jr(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;const e=ea.fromDurationLike(t),i={};for(const t of Kr)(xs(e.values,t)||xs(this.values,t))&&(i[t]=e.get(t)+this.get(t));return Qr(this,{values:i},!0)}minus(t){if(!this.isValid)return this;const e=ea.fromDurationLike(t);return this.plus(e.negate())}mapUnits(t){if(!this.isValid)return this;const e={};for(const i of Object.keys(this.values))e[i]=Rs(t(this.values[i],i));return Qr(this,{values:e},!0)}get(t){return this[ea.normalizeUnit(t)]}set(t){if(!this.isValid)return this;return Qr(this,{values:{...this.values,...Ns(t,ea.normalizeUnit)}})}reconfigure({locale:t,numberingSystem:e,conversionAccuracy:i,matrix:o}={}){return Qr(this,{loc:this.loc.clone({locale:t,numberingSystem:e}),matrix:o,conversionAccuracy:i})}as(t){return this.isValid?this.shiftTo(t).get(t):NaN}normalize(){if(!this.isValid)return this;const t=this.toObject();return ta(this.matrix,t),Qr(this,{values:t},!0)}rescale(){if(!this.isValid)return this;return Qr(this,{values:function(t){const e={};for(const[i,o]of Object.entries(t))0!==o&&(e[i]=o);return e}(this.normalize().shiftToAll().toObject())},!0)}shiftTo(...t){if(!this.isValid)return this;if(0===t.length)return this;t=t.map((t=>ea.normalizeUnit(t)));const e={},i={},o=this.toObject();let n;for(const s of Kr)if(t.indexOf(s)>=0){n=s;let t=0;for(const e in i)t+=this.matrix[e][s]*i[e],i[e]=0;gs(o[s])&&(t+=o[s]);const r=Math.trunc(t);e[s]=r,i[s]=(1e3*t-1e3*r)/1e3}else gs(o[s])&&(i[s]=o[s]);for(const t in i)0!==i[t]&&(e[n]+=t===n?i[t]:i[t]/this.matrix[n][t]);return ta(this.matrix,e),Qr(this,{values:e},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const t={};for(const e of Object.keys(this.values))t[e]=0===this.values[e]?0:-this.values[e];return Qr(this,{values:t},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return null===this.invalid}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(t){if(!this.isValid||!t.isValid)return!1;if(!this.loc.equals(t.loc))return!1;for(const o of Kr)if(e=this.values[o],i=t.values[o],!(void 0===e||0===e?void 0===i||0===i:e===i))return!1;var e,i;return!0}}const ia="Invalid Interval";class oa{constructor(t){this.s=t.start,this.e=t.end,this.invalid=t.invalid||null,this.isLuxonInterval=!0}static invalid(t,e=null){if(!t)throw new qo("need to specify a reason the Interval is invalid");const i=t instanceof Jn?t:new Jn(t,e);if(Qn.throwOnInvalid)throw new Ro(i);return new oa({invalid:i})}static fromDateTimes(t,e){const i=Ya(t),o=Ya(e),n=function(t,e){return t&&t.isValid?e&&e.isValid?e<t?oa.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null:oa.invalid("missing or invalid end"):oa.invalid("missing or invalid start")}(i,o);return null==n?new oa({start:i,end:o}):n}static after(t,e){const i=ea.fromDurationLike(e),o=Ya(t);return oa.fromDateTimes(o,o.plus(i))}static before(t,e){const i=ea.fromDurationLike(e),o=Ya(t);return oa.fromDateTimes(o.minus(i),o)}static fromISO(t,e){const[i,o]=(t||"").split("/",2);if(i&&o){let t,n,s,r;try{t=Za.fromISO(i,e),n=t.isValid}catch(o){n=!1}try{s=Za.fromISO(o,e),r=s.isValid}catch(o){r=!1}if(n&&r)return oa.fromDateTimes(t,s);if(n){const i=ea.fromISO(o,e);if(i.isValid)return oa.after(t,i)}else if(r){const t=ea.fromISO(i,e);if(t.isValid)return oa.before(s,t)}}return oa.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static isInterval(t){return t&&t.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return null===this.invalidReason}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(t="milliseconds"){return this.isValid?this.toDuration(t).get(t):NaN}count(t="milliseconds",e){if(!this.isValid)return NaN;const i=this.start.startOf(t,e);let o;return o=e?.useLocaleWeeks?this.end.reconfigure({locale:i.locale}):this.end,o=o.startOf(t,e),Math.floor(o.diff(i,t).get(t))+(o.valueOf()!==this.end.valueOf())}hasSame(t){return!!this.isValid&&(this.isEmpty()||this.e.minus(1).hasSame(this.s,t))}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(t){return!!this.isValid&&this.s>t}isBefore(t){return!!this.isValid&&this.e<=t}contains(t){return!!this.isValid&&(this.s<=t&&this.e>t)}set({start:t,end:e}={}){return this.isValid?oa.fromDateTimes(t||this.s,e||this.e):this}splitAt(...t){if(!this.isValid)return[];const e=t.map(Ya).filter((t=>this.contains(t))).sort(((t,e)=>t.toMillis()-e.toMillis())),i=[];let{s:o}=this,n=0;for(;o<this.e;){const t=e[n]||this.e,s=+t>+this.e?this.e:t;i.push(oa.fromDateTimes(o,s)),o=s,n+=1}return i}splitBy(t){const e=ea.fromDurationLike(t);if(!this.isValid||!e.isValid||0===e.as("milliseconds"))return[];let i,{s:o}=this,n=1;const s=[];for(;o<this.e;){const t=this.start.plus(e.mapUnits((t=>t*n)));i=+t>+this.e?this.e:t,s.push(oa.fromDateTimes(o,i)),o=i,n+=1}return s}divideEqually(t){return this.isValid?this.splitBy(this.length()/t).slice(0,t):[]}overlaps(t){return this.e>t.s&&this.s<t.e}abutsStart(t){return!!this.isValid&&+this.e==+t.s}abutsEnd(t){return!!this.isValid&&+t.e==+this.s}engulfs(t){return!!this.isValid&&(this.s<=t.s&&this.e>=t.e)}equals(t){return!(!this.isValid||!t.isValid)&&(this.s.equals(t.s)&&this.e.equals(t.e))}intersection(t){if(!this.isValid)return this;const e=this.s>t.s?this.s:t.s,i=this.e<t.e?this.e:t.e;return e>=i?null:oa.fromDateTimes(e,i)}union(t){if(!this.isValid)return this;const e=this.s<t.s?this.s:t.s,i=this.e>t.e?this.e:t.e;return oa.fromDateTimes(e,i)}static merge(t){const[e,i]=t.sort(((t,e)=>t.s-e.s)).reduce((([t,e],i)=>e?e.overlaps(i)||e.abutsStart(i)?[t,e.union(i)]:[t.concat([e]),i]:[t,i]),[[],null]);return i&&e.push(i),e}static xor(t){let e=null,i=0;const o=[],n=t.map((t=>[{time:t.s,type:"s"},{time:t.e,type:"e"}])),s=Array.prototype.concat(...n).sort(((t,e)=>t.time-e.time));for(const t of s)i+="s"===t.type?1:-1,1===i?e=t.time:(e&&+e!=+t.time&&o.push(oa.fromDateTimes(e,t.time)),e=null);return oa.merge(o)}difference(...t){return oa.xor([this].concat(t)).map((t=>this.intersection(t))).filter((t=>t&&!t.isEmpty()))}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:ia}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(t=Wo,e={}){return this.isValid?ir.create(this.s.loc.clone(e),t).formatInterval(this):ia}toISO(t){return this.isValid?`${this.s.toISO(t)}/${this.e.toISO(t)}`:ia}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:ia}toISOTime(t){return this.isValid?`${this.s.toISOTime(t)}/${this.e.toISOTime(t)}`:ia}toFormat(t,{separator:e=" – "}={}){return this.isValid?`${this.s.toFormat(t)}${e}${this.e.toFormat(t)}`:ia}toDuration(t,e){return this.isValid?this.e.diff(this.s,t,e):ea.invalid(this.invalidReason)}mapEndpoints(t){return oa.fromDateTimes(t(this.s),t(this.e))}}class na{static hasDST(t=Qn.defaultZone){const e=Za.now().setZone(t).set({month:12});return!t.isUniversal&&e.offset!==e.set({month:6}).offset}static isValidIANAZone(t){return _n.isValidZone(t)}static normalizeZone(t){return Nn(t,Qn.defaultZone)}static getStartOfWeek({locale:t=null,locObj:e=null}={}){return(e||Ln.create(t)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:t=null,locObj:e=null}={}){return(e||Ln.create(t)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:t=null,locObj:e=null}={}){return(e||Ln.create(t)).getWeekendDays().slice()}static months(t="long",{locale:e=null,numberingSystem:i=null,locObj:o=null,outputCalendar:n="gregory"}={}){return(o||Ln.create(e,i,n)).months(t)}static monthsFormat(t="long",{locale:e=null,numberingSystem:i=null,locObj:o=null,outputCalendar:n="gregory"}={}){return(o||Ln.create(e,i,n)).months(t,!0)}static weekdays(t="long",{locale:e=null,numberingSystem:i=null,locObj:o=null}={}){return(o||Ln.create(e,i,null)).weekdays(t)}static weekdaysFormat(t="long",{locale:e=null,numberingSystem:i=null,locObj:o=null}={}){return(o||Ln.create(e,i,null)).weekdays(t,!0)}static meridiems({locale:t=null}={}){return Ln.create(t).meridiems()}static eras(t="short",{locale:e=null}={}){return Ln.create(e,null,"gregory").eras(t)}static features(){return{relative:vs(),localeWeek:bs()}}}function sa(t,e){const i=t=>t.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),o=i(e)-i(t);return Math.floor(ea.fromMillis(o).as("days"))}function ra(t,e,i,o){let[n,s,r,a]=function(t,e,i){const o=[["years",(t,e)=>e.year-t.year],["quarters",(t,e)=>e.quarter-t.quarter+4*(e.year-t.year)],["months",(t,e)=>e.month-t.month+12*(e.year-t.year)],["weeks",(t,e)=>{const i=sa(t,e);return(i-i%7)/7}],["days",sa]],n={},s=t;let r,a;for(const[l,d]of o)i.indexOf(l)>=0&&(r=l,n[l]=d(t,e),a=s.plus(n),a>e?(n[l]--,(t=s.plus(n))>e&&(a=t,n[l]--,t=s.plus(n))):t=a);return[t,n,a,r]}(t,e,i);const l=e-n,d=i.filter((t=>["hours","minutes","seconds","milliseconds"].indexOf(t)>=0));0===d.length&&(r<e&&(r=n.plus({[a]:1})),r!==n&&(s[a]=(s[a]||0)+l/(r-n)));const c=ea.fromObject(s,o);return d.length>0?ea.fromMillis(l,o).shiftTo(...d).plus(c):c}function aa(t,e=(t=>t)){return{regex:t,deser:([t])=>e(function(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let i=0;i<t.length;i++){const o=t.charCodeAt(i);if(-1!==t[i].search(Bn.hanidec))e+=qn.indexOf(t[i]);else for(const t in Fn){const[i,n]=Fn[t];o>=i&&o<=n&&(e+=o-i)}}return parseInt(e,10)}return e}(t))}}const la=`[ ${String.fromCharCode(160)}]`,da=new RegExp(la,"g");function ca(t){return t.replace(/\./g,"\\.?").replace(da,la)}function ha(t){return t.replace(/\./g,"").replace(da," ").toLowerCase()}function ua(t,e){return null===t?null:{regex:RegExp(t.map(ca).join("|")),deser:([i])=>t.findIndex((t=>ha(i)===ha(t)))+e}}function pa(t,e){return{regex:t,deser:([,t,e])=>Ps(t,e),groups:e}}function ma(t){return{regex:t,deser:([t])=>t}}const ga={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};let fa=null;function va(t,e){return Array.prototype.concat(...t.map((t=>function(t,e){if(t.literal)return t;const i=xa(ir.macroTokenToFormatOpts(t.val),e);return null==i||i.includes(void 0)?t:i}(t,e))))}class ba{constructor(t,e){if(this.locale=t,this.format=e,this.tokens=va(ir.parseFormat(e),t),this.units=this.tokens.map((e=>function(t,e){const i=jn(e),o=jn(e,"{2}"),n=jn(e,"{3}"),s=jn(e,"{4}"),r=jn(e,"{6}"),a=jn(e,"{1,2}"),l=jn(e,"{1,3}"),d=jn(e,"{1,6}"),c=jn(e,"{1,9}"),h=jn(e,"{2,4}"),u=jn(e,"{4,6}"),p=t=>{return{regex:RegExp((e=t.val,e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([t])=>t,literal:!0};var e},m=(m=>{if(t.literal)return p(m);switch(m.val){case"G":return ua(e.eras("short"),0);case"GG":return ua(e.eras("long"),0);case"y":return aa(d);case"yy":case"kk":return aa(h,Ls);case"yyyy":case"kkkk":return aa(s);case"yyyyy":return aa(u);case"yyyyyy":return aa(r);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return aa(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return aa(o);case"MMM":return ua(e.months("short",!0),1);case"MMMM":return ua(e.months("long",!0),1);case"LLL":return ua(e.months("short",!1),1);case"LLLL":return ua(e.months("long",!1),1);case"o":case"S":return aa(l);case"ooo":case"SSS":return aa(n);case"u":return ma(c);case"uu":return ma(a);case"uuu":case"E":case"c":return aa(i);case"a":return ua(e.meridiems(),0);case"EEE":return ua(e.weekdays("short",!1),1);case"EEEE":return ua(e.weekdays("long",!1),1);case"ccc":return ua(e.weekdays("short",!0),1);case"cccc":return ua(e.weekdays("long",!0),1);case"Z":case"ZZ":return pa(new RegExp(`([+-]${a.source})(?::(${o.source}))?`),2);case"ZZZ":return pa(new RegExp(`([+-]${a.source})(${o.source})?`),2);case"z":return ma(/[a-z_+-/]{1,256}?/i);case" ":return ma(/[^\S\n\r]/);default:return p(m)}})(t)||{invalidReason:"missing Intl.DateTimeFormat.formatToParts support"};return m.token=t,m}(e,t))),this.disqualifyingUnit=this.units.find((t=>t.invalidReason)),!this.disqualifyingUnit){const[t,e]=function(t){const e=t.map((t=>t.regex)).reduce(((t,e)=>`${t}(${e.source})`),"");return[`^${e}$`,t]}(this.units);this.regex=RegExp(t,"i"),this.handlers=e}}explainFromTokens(t){if(this.isValid){const[e,i]=function(t,e,i){const o=t.match(e);if(o){const t={};let e=1;for(const n in i)if(xs(i,n)){const s=i[n],r=s.groups?s.groups+1:1;!s.literal&&s.token&&(t[s.token.val[0]]=s.deser(o.slice(e,e+r))),e+=r}return[o,t]}return[o,{}]}(t,this.regex,this.handlers),[o,n,s]=i?function(t){let e,i=null;ms(t.z)||(i=_n.create(t.z)),ms(t.Z)||(i||(i=new Pn(t.Z)),e=t.Z),ms(t.q)||(t.M=3*(t.q-1)+1),ms(t.h)||(t.h<12&&1===t.a?t.h+=12:12===t.h&&0===t.a&&(t.h=0)),0===t.G&&t.y&&(t.y=-t.y),ms(t.u)||(t.S=As(t.u));const o=Object.keys(t).reduce(((e,i)=>{const o=(t=>{switch(t){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}})(i);return o&&(e[o]=t[i]),e}),{});return[o,i,e]}(i):[null,null,void 0];if(xs(i,"a")&&xs(i,"H"))throw new Bo("Can't include meridiem when specifying 24-hour format");return{input:t,tokens:this.tokens,regex:this.regex,rawMatches:e,matches:i,result:o,zone:n,specificOffset:s}}return{input:t,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function ya(t,e,i){return new ba(t,i).explainFromTokens(e)}function xa(t,e){if(!t)return null;const i=ir.create(e,t).dtFormatter((fa||(fa=Za.fromMillis(1555555555555)),fa)),o=i.formatToParts(),n=i.resolvedOptions();return o.map((e=>function(t,e,i){const{type:o,value:n}=t;if("literal"===o){const t=/^\s+$/.test(n);return{literal:!t,val:t?" ":n}}const s=e[o];let r=o;"hour"===o&&(r=null!=e.hour12?e.hour12?"hour12":"hour24":null!=e.hourCycle?"h11"===e.hourCycle||"h12"===e.hourCycle?"hour12":"hour24":i.hour12?"hour12":"hour24");let a=ga[r];if("object"==typeof a&&(a=a[s]),a)return{literal:!1,val:a}}(e,t,n)))}const _a="Invalid DateTime",wa=864e13;function ka(t){return new Jn("unsupported zone",`the zone "${t.name}" is not supported`)}function Ca(t){return null===t.weekData&&(t.weekData=as(t.c)),t.weekData}function Sa(t){return null===t.localWeekData&&(t.localWeekData=as(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function Aa(t,e){const i={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new Za({...i,...e,old:i})}function Ea(t,e,i){let o=t-60*e*1e3;const n=i.offset(o);if(e===n)return[o,e];o-=60*(n-e)*1e3;const s=i.offset(o);return n===s?[o,n]:[t-60*Math.min(n,s)*1e3,Math.max(n,s)]}function $a(t,e){const i=new Date(t+=60*e*1e3);return{year:i.getUTCFullYear(),month:i.getUTCMonth()+1,day:i.getUTCDate(),hour:i.getUTCHours(),minute:i.getUTCMinutes(),second:i.getUTCSeconds(),millisecond:i.getUTCMilliseconds()}}function Ta(t,e,i){return Ea(Ms(t),e,i)}function Da(t,e){const i=t.o,o=t.c.year+Math.trunc(e.years),n=t.c.month+Math.trunc(e.months)+3*Math.trunc(e.quarters),s={...t.c,year:o,month:n,day:Math.min(t.c.day,Ds(o,n))+Math.trunc(e.days)+7*Math.trunc(e.weeks)},r=ea.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=Ms(s);let[l,d]=Ea(a,i,t.zone);return 0!==r&&(l+=r,d=t.zone.offset(l)),{ts:l,o:d}}function Ma(t,e,i,o,n,s){const{setZone:r,zone:a}=i;if(t&&0!==Object.keys(t).length||e){const o=e||a,n=Za.fromObject(t,{...i,zone:o,specificOffset:s});return r?n:n.setZone(a)}return Za.invalid(new Jn("unparsable",`the input "${n}" can't be parsed as ${o}`))}function Ia(t,e,i=!0){return t.isValid?ir.create(Ln.create("en-US"),{allowZ:i,forceSimple:!0}).formatDateTimeFromString(t,e):null}function Oa(t,e){const i=t.c.year>9999||t.c.year<0;let o="";return i&&t.c.year>=0&&(o+="+"),o+=ks(t.c.year,i?6:4),e?(o+="-",o+=ks(t.c.month),o+="-",o+=ks(t.c.day)):(o+=ks(t.c.month),o+=ks(t.c.day)),o}function La(t,e,i,o,n,s){let r=ks(t.c.hour);return e?(r+=":",r+=ks(t.c.minute),0===t.c.millisecond&&0===t.c.second&&i||(r+=":")):r+=ks(t.c.minute),0===t.c.millisecond&&0===t.c.second&&i||(r+=ks(t.c.second),0===t.c.millisecond&&o||(r+=".",r+=ks(t.c.millisecond,3))),n&&(t.isOffsetFixed&&0===t.offset&&!s?r+="Z":t.o<0?(r+="-",r+=ks(Math.trunc(-t.o/60)),r+=":",r+=ks(Math.trunc(-t.o%60))):(r+="+",r+=ks(Math.trunc(t.o/60)),r+=":",r+=ks(Math.trunc(t.o%60)))),s&&(r+="["+t.zone.ianaName+"]"),r}const za={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Pa={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Ra={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Na=["year","month","day","hour","minute","second","millisecond"],Ba=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Fa=["year","ordinal","hour","minute","second","millisecond"];function qa(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return function(t){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new Fo(t);return e}(t)}}function Ua(t,e){const i=Nn(e.zone,Qn.defaultZone);if(!i.isValid)return Za.invalid(ka(i));const o=Ln.fromObject(e);let n,s;if(ms(t.year))n=Qn.now();else{for(const e of Na)ms(t[e])&&(t[e]=za[e]);const e=us(t)||ps(t);if(e)return Za.invalid(e);const o=function(t){return Wa[t]||(void 0===Ha&&(Ha=Qn.now()),Wa[t]=t.offset(Ha)),Wa[t]}(i);[n,s]=Ta(t,o,i)}return new Za({ts:n,zone:i,loc:o,o:s})}function ja(t,e,i){const o=!!ms(i.round)||i.round,n=(t,n)=>{t=Es(t,o||i.calendary?0:2,!0);return e.loc.clone(i).relFormatter(i).format(t,n)},s=o=>i.calendary?e.hasSame(t,o)?0:e.startOf(o).diff(t.startOf(o),o).get(o):e.diff(t,o).get(o);if(i.unit)return n(s(i.unit),i.unit);for(const t of i.units){const e=s(t);if(Math.abs(e)>=1)return n(e,t)}return n(t>e?-0:0,i.units[i.units.length-1])}function Va(t){let e,i={};return t.length>0&&"object"==typeof t[t.length-1]?(i=t[t.length-1],e=Array.from(t).slice(0,t.length-1)):e=Array.from(t),[i,e]}let Ha,Wa={};class Za{constructor(t){const e=t.zone||Qn.defaultZone;let i=t.invalid||(Number.isNaN(t.ts)?new Jn("invalid input"):null)||(e.isValid?null:ka(e));this.ts=ms(t.ts)?Qn.now():t.ts;let o=null,n=null;if(!i){if(t.old&&t.old.ts===this.ts&&t.old.zone.equals(e))[o,n]=[t.old.c,t.old.o];else{const s=gs(t.o)&&!t.old?t.o:e.offset(this.ts);o=$a(this.ts,s),i=Number.isNaN(o.year)?new Jn("invalid input"):null,o=i?null:o,n=i?null:s}}this._zone=e,this.loc=t.loc||Ln.create(),this.invalid=i,this.weekData=null,this.localWeekData=null,this.c=o,this.o=n,this.isLuxonDateTime=!0}static now(){return new Za({})}static local(){const[t,e]=Va(arguments),[i,o,n,s,r,a,l]=e;return Ua({year:i,month:o,day:n,hour:s,minute:r,second:a,millisecond:l},t)}static utc(){const[t,e]=Va(arguments),[i,o,n,s,r,a,l]=e;return t.zone=Pn.utcInstance,Ua({year:i,month:o,day:n,hour:s,minute:r,second:a,millisecond:l},t)}static fromJSDate(t,e={}){const i=function(t){return"[object Date]"===Object.prototype.toString.call(t)}(t)?t.valueOf():NaN;if(Number.isNaN(i))return Za.invalid("invalid input");const o=Nn(e.zone,Qn.defaultZone);return o.isValid?new Za({ts:i,zone:o,loc:Ln.fromObject(e)}):Za.invalid(ka(o))}static fromMillis(t,e={}){if(gs(t))return t<-wa||t>wa?Za.invalid("Timestamp out of range"):new Za({ts:t,zone:Nn(e.zone,Qn.defaultZone),loc:Ln.fromObject(e)});throw new qo(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`)}static fromSeconds(t,e={}){if(gs(t))return new Za({ts:1e3*t,zone:Nn(e.zone,Qn.defaultZone),loc:Ln.fromObject(e)});throw new qo("fromSeconds requires a numerical input")}static fromObject(t,e={}){t=t||{};const i=Nn(e.zone,Qn.defaultZone);if(!i.isValid)return Za.invalid(ka(i));const o=Ln.fromObject(e),n=Ns(t,qa),{minDaysInFirstWeek:s,startOfWeek:r}=hs(n,o),a=Qn.now(),l=ms(e.specificOffset)?i.offset(a):e.specificOffset,d=!ms(n.ordinal),c=!ms(n.year),h=!ms(n.month)||!ms(n.day),u=c||h,p=n.weekYear||n.weekNumber;if((u||d)&&p)throw new Bo("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(h&&d)throw new Bo("Can't mix ordinal dates with month/day");const m=p||n.weekday&&!u;let g,f,v=$a(a,l);m?(g=Ba,f=Pa,v=as(v,s,r)):d?(g=Fa,f=Ra,v=ds(v)):(g=Na,f=za);let b=!1;for(const t of g){ms(n[t])?n[t]=b?f[t]:v[t]:b=!0}const y=m?function(t,e=4,i=1){const o=fs(t.weekYear),n=ws(t.weekNumber,1,Os(t.weekYear,e,i)),s=ws(t.weekday,1,7);return o?n?!s&&is("weekday",t.weekday):is("week",t.weekNumber):is("weekYear",t.weekYear)}(n,s,r):d?function(t){const e=fs(t.year),i=ws(t.ordinal,1,Ts(t.year));return e?!i&&is("ordinal",t.ordinal):is("year",t.year)}(n):us(n),x=y||ps(n);if(x)return Za.invalid(x);const _=m?ls(n,s,r):d?cs(n):n,[w,k]=Ta(_,l,i),C=new Za({ts:w,zone:i,o:k,loc:o});return n.weekday&&u&&t.weekday!==C.weekday?Za.invalid("mismatched weekday",`you can't specify both a weekday of ${n.weekday} and a date of ${C.toISO()}`):C.isValid?C:Za.invalid(C.invalid)}static fromISO(t,e={}){const[i,o]=function(t){return rr(t,[Ir,Pr],[Or,Rr],[Lr,Nr],[zr,Br])}(t);return Ma(i,o,e,"ISO 8601",t)}static fromRFC2822(t,e={}){const[i,o]=function(t){return rr(function(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(t),[Sr,Ar])}(t);return Ma(i,o,e,"RFC 2822",t)}static fromHTTP(t,e={}){const[i,o]=function(t){return rr(t,[Er,Dr],[$r,Dr],[Tr,Mr])}(t);return Ma(i,o,e,"HTTP",e)}static fromFormat(t,e,i={}){if(ms(t)||ms(e))throw new qo("fromFormat requires an input string and a format");const{locale:o=null,numberingSystem:n=null}=i,s=Ln.fromOpts({locale:o,numberingSystem:n,defaultToEN:!0}),[r,a,l,d]=function(t,e,i){const{result:o,zone:n,specificOffset:s,invalidReason:r}=ya(t,e,i);return[o,n,s,r]}(s,t,e);return d?Za.invalid(d):Ma(r,a,i,`format ${e}`,t,l)}static fromString(t,e,i={}){return Za.fromFormat(t,e,i)}static fromSQL(t,e={}){const[i,o]=function(t){return rr(t,[qr,Pr],[Ur,jr])}(t);return Ma(i,o,e,"SQL",t)}static invalid(t,e=null){if(!t)throw new qo("need to specify a reason the DateTime is invalid");const i=t instanceof Jn?t:new Jn(t,e);if(Qn.throwOnInvalid)throw new Po(i);return new Za({invalid:i})}static isDateTime(t){return t&&t.isLuxonDateTime||!1}static parseFormatForOpts(t,e={}){const i=xa(t,Ln.fromObject(e));return i?i.map((t=>t?t.val:null)).join(""):null}static expandFormat(t,e={}){return va(ir.parseFormat(t),Ln.fromObject(e)).map((t=>t.val)).join("")}static resetCache(){Ha=void 0,Wa={}}get(t){return this[t]}get isValid(){return null===this.invalid}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Ca(this).weekYear:NaN}get weekNumber(){return this.isValid?Ca(this).weekNumber:NaN}get weekday(){return this.isValid?Ca(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Sa(this).weekday:NaN}get localWeekNumber(){return this.isValid?Sa(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Sa(this).weekYear:NaN}get ordinal(){return this.isValid?ds(this.c).ordinal:NaN}get monthShort(){return this.isValid?na.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?na.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?na.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?na.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return!this.isOffsetFixed&&(this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset)}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const t=864e5,e=6e4,i=Ms(this.c),o=this.zone.offset(i-t),n=this.zone.offset(i+t),s=this.zone.offset(i-o*e),r=this.zone.offset(i-n*e);if(s===r)return[this];const a=i-s*e,l=i-r*e,d=$a(a,s),c=$a(l,r);return d.hour===c.hour&&d.minute===c.minute&&d.second===c.second&&d.millisecond===c.millisecond?[Aa(this,{ts:a}),Aa(this,{ts:l})]:[this]}get isInLeapYear(){return $s(this.year)}get daysInMonth(){return Ds(this.year,this.month)}get daysInYear(){return this.isValid?Ts(this.year):NaN}get weeksInWeekYear(){return this.isValid?Os(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Os(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(t={}){const{locale:e,numberingSystem:i,calendar:o}=ir.create(this.loc.clone(t),t).resolvedOptions(this);return{locale:e,numberingSystem:i,outputCalendar:o}}toUTC(t=0,e={}){return this.setZone(Pn.instance(t),e)}toLocal(){return this.setZone(Qn.defaultZone)}setZone(t,{keepLocalTime:e=!1,keepCalendarTime:i=!1}={}){if((t=Nn(t,Qn.defaultZone)).equals(this.zone))return this;if(t.isValid){let o=this.ts;if(e||i){const e=t.offset(this.ts),i=this.toObject();[o]=Ta(i,e,t)}return Aa(this,{ts:o,zone:t})}return Za.invalid(ka(t))}reconfigure({locale:t,numberingSystem:e,outputCalendar:i}={}){return Aa(this,{loc:this.loc.clone({locale:t,numberingSystem:e,outputCalendar:i})})}setLocale(t){return this.reconfigure({locale:t})}set(t){if(!this.isValid)return this;const e=Ns(t,qa),{minDaysInFirstWeek:i,startOfWeek:o}=hs(e,this.loc),n=!ms(e.weekYear)||!ms(e.weekNumber)||!ms(e.weekday),s=!ms(e.ordinal),r=!ms(e.year),a=!ms(e.month)||!ms(e.day),l=r||a,d=e.weekYear||e.weekNumber;if((l||s)&&d)throw new Bo("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&s)throw new Bo("Can't mix ordinal dates with month/day");let c;n?c=ls({...as(this.c,i,o),...e},i,o):ms(e.ordinal)?(c={...this.toObject(),...e},ms(e.day)&&(c.day=Math.min(Ds(c.year,c.month),c.day))):c=cs({...ds(this.c),...e});const[h,u]=Ta(c,this.o,this.zone);return Aa(this,{ts:h,o:u})}plus(t){if(!this.isValid)return this;return Aa(this,Da(this,ea.fromDurationLike(t)))}minus(t){if(!this.isValid)return this;return Aa(this,Da(this,ea.fromDurationLike(t).negate()))}startOf(t,{useLocaleWeeks:e=!1}={}){if(!this.isValid)return this;const i={},o=ea.normalizeUnit(t);switch(o){case"years":i.month=1;case"quarters":case"months":i.day=1;case"weeks":case"days":i.hour=0;case"hours":i.minute=0;case"minutes":i.second=0;case"seconds":i.millisecond=0}if("weeks"===o)if(e){const t=this.loc.getStartOfWeek(),{weekday:e}=this;e<t&&(i.weekNumber=this.weekNumber-1),i.weekday=t}else i.weekday=1;if("quarters"===o){const t=Math.ceil(this.month/3);i.month=3*(t-1)+1}return this.set(i)}endOf(t,e){return this.isValid?this.plus({[t]:1}).startOf(t,e).minus(1):this}toFormat(t,e={}){return this.isValid?ir.create(this.loc.redefaultToEN(e)).formatDateTimeFromString(this,t):_a}toLocaleString(t=Wo,e={}){return this.isValid?ir.create(this.loc.clone(e),t).formatDateTime(this):_a}toLocaleParts(t={}){return this.isValid?ir.create(this.loc.clone(t),t).formatDateTimeParts(this):[]}toISO({format:t="extended",suppressSeconds:e=!1,suppressMilliseconds:i=!1,includeOffset:o=!0,extendedZone:n=!1}={}){if(!this.isValid)return null;const s="extended"===t;let r=Oa(this,s);return r+="T",r+=La(this,s,e,i,o,n),r}toISODate({format:t="extended"}={}){return this.isValid?Oa(this,"extended"===t):null}toISOWeekDate(){return Ia(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:t=!1,suppressSeconds:e=!1,includeOffset:i=!0,includePrefix:o=!1,extendedZone:n=!1,format:s="extended"}={}){if(!this.isValid)return null;return(o?"T":"")+La(this,"extended"===s,e,t,i,n)}toRFC2822(){return Ia(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Ia(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Oa(this,!0):null}toSQLTime({includeOffset:t=!0,includeZone:e=!1,includeOffsetSpace:i=!0}={}){let o="HH:mm:ss.SSS";return(e||t)&&(i&&(o+=" "),e?o+="z":t&&(o+="ZZ")),Ia(this,o,!0)}toSQL(t={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(t)}`:null}toString(){return this.isValid?this.toISO():_a}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(t={}){if(!this.isValid)return{};const e={...this.c};return t.includeConfig&&(e.outputCalendar=this.outputCalendar,e.numberingSystem=this.loc.numberingSystem,e.locale=this.loc.locale),e}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(t,e="milliseconds",i={}){if(!this.isValid||!t.isValid)return ea.invalid("created by diffing an invalid DateTime");const o={locale:this.locale,numberingSystem:this.numberingSystem,...i},n=(a=e,Array.isArray(a)?a:[a]).map(ea.normalizeUnit),s=t.valueOf()>this.valueOf(),r=ra(s?this:t,s?t:this,n,o);var a;return s?r.negate():r}diffNow(t="milliseconds",e={}){return this.diff(Za.now(),t,e)}until(t){return this.isValid?oa.fromDateTimes(this,t):this}hasSame(t,e,i){if(!this.isValid)return!1;const o=t.valueOf(),n=this.setZone(t.zone,{keepLocalTime:!0});return n.startOf(e,i)<=o&&o<=n.endOf(e,i)}equals(t){return this.isValid&&t.isValid&&this.valueOf()===t.valueOf()&&this.zone.equals(t.zone)&&this.loc.equals(t.loc)}toRelative(t={}){if(!this.isValid)return null;const e=t.base||Za.fromObject({},{zone:this.zone}),i=t.padding?this<e?-t.padding:t.padding:0;let o=["years","months","days","hours","minutes","seconds"],n=t.unit;return Array.isArray(t.unit)&&(o=t.unit,n=void 0),ja(e,this.plus(i),{...t,numeric:"always",units:o,unit:n})}toRelativeCalendar(t={}){return this.isValid?ja(t.base||Za.fromObject({},{zone:this.zone}),this,{...t,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...t){if(!t.every(Za.isDateTime))throw new qo("min requires all arguments be DateTimes");return ys(t,(t=>t.valueOf()),Math.min)}static max(...t){if(!t.every(Za.isDateTime))throw new qo("max requires all arguments be DateTimes");return ys(t,(t=>t.valueOf()),Math.max)}static fromFormatExplain(t,e,i={}){const{locale:o=null,numberingSystem:n=null}=i;return ya(Ln.fromOpts({locale:o,numberingSystem:n,defaultToEN:!0}),t,e)}static fromStringExplain(t,e,i={}){return Za.fromFormatExplain(t,e,i)}static buildFormatParser(t,e={}){const{locale:i=null,numberingSystem:o=null}=e,n=Ln.fromOpts({locale:i,numberingSystem:o,defaultToEN:!0});return new ba(n,t)}static fromFormatParser(t,e,i={}){if(ms(t)||ms(e))throw new qo("fromFormatParser requires an input string and a format parser");const{locale:o=null,numberingSystem:n=null}=i,s=Ln.fromOpts({locale:o,numberingSystem:n,defaultToEN:!0});if(!s.equals(e.locale))throw new qo(`fromFormatParser called with a locale of ${s}, but the format parser was created for ${e.locale}`);const{result:r,zone:a,specificOffset:l,invalidReason:d}=e.explainFromTokens(t);return d?Za.invalid(d):Ma(r,a,i,`format ${e.format}`,t,l)}static get DATE_SHORT(){return Wo}static get DATE_MED(){return Zo}static get DATE_MED_WITH_WEEKDAY(){return Yo}static get DATE_FULL(){return Go}static get DATE_HUGE(){return Ko}static get TIME_SIMPLE(){return Xo}static get TIME_WITH_SECONDS(){return Qo}static get TIME_WITH_SHORT_OFFSET(){return Jo}static get TIME_WITH_LONG_OFFSET(){return tn}static get TIME_24_SIMPLE(){return en}static get TIME_24_WITH_SECONDS(){return on}static get TIME_24_WITH_SHORT_OFFSET(){return nn}static get TIME_24_WITH_LONG_OFFSET(){return sn}static get DATETIME_SHORT(){return rn}static get DATETIME_SHORT_WITH_SECONDS(){return an}static get DATETIME_MED(){return ln}static get DATETIME_MED_WITH_SECONDS(){return dn}static get DATETIME_MED_WITH_WEEKDAY(){return cn}static get DATETIME_FULL(){return hn}static get DATETIME_FULL_WITH_SECONDS(){return un}static get DATETIME_HUGE(){return pn}static get DATETIME_HUGE_WITH_SECONDS(){return mn}}function Ya(t){if(Za.isDateTime(t))return t;if(t&&t.valueOf&&gs(t.valueOf()))return Za.fromJSDate(t);if(t&&"object"==typeof t)return Za.fromObject(t);throw new qo(`Unknown datetime argument: ${t}, of type ${typeof t}`)}
520
+ class Oo{constructor(t=0,e=0,i=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=i,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){const e=this.items[t];delete this.items[t],this.size--,null!==e.prev&&(e.prev.next=e.next),null!==e.next&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){return t.map((t=>[t,this.get(t)]))}evict(t=!1){if(t||this.size>0){const t=this.first;delete this.items[t.key],0==--this.size?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){let e;if(this.has(t)){const i=this.items[t];this.ttl>0&&i.expiry<=Date.now()?this.delete(t):(e=i.value,this.set(t,e,!0))}return e}has(t){return t in this.items}keys(){const t=[];let e=this.first;for(;null!==e;)t.push(e.key),e=e.next;return t}set(t,e,i=!1,o=this.resetTtl){let n;if(i||this.has(t)){if(n=this.items[t],n.value=e,!1===i&&o&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==n){const t=this.last,e=n.next,i=n.prev;this.first===n&&(this.first=n.next),n.next=null,n.prev=this.last,t.next=n,null!==i&&(i.next=e),null!==e&&(e.prev=i)}}else this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},1==++this.size?this.first=n:this.last.next=n;return this.last=n,this}values(t=this.keys()){return t.map((t=>this.get(t)))}}function Lo(t=1e3,e=0,i=!1){if(isNaN(t)||t<0)throw new TypeError("Invalid max value");if(isNaN(e)||e<0)throw new TypeError("Invalid ttl value");if("boolean"!=typeof i)throw new TypeError("Invalid resetTtl value");return new Oo(t,e,i)}class zo extends Error{}class Po extends zo{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}}class Ro extends zo{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}}class No extends zo{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}}class Bo extends zo{}class Fo extends zo{constructor(t){super(`Invalid unit ${t}`)}}class qo extends zo{}class Uo extends zo{constructor(){super("Zone is an abstract class")}}const jo="numeric",Vo="short",Ho="long",Wo={year:jo,month:jo,day:jo},Zo={year:jo,month:Vo,day:jo},Yo={year:jo,month:Vo,day:jo,weekday:Vo},Go={year:jo,month:Ho,day:jo},Ko={year:jo,month:Ho,day:jo,weekday:Ho},Xo={hour:jo,minute:jo},Qo={hour:jo,minute:jo,second:jo},Jo={hour:jo,minute:jo,second:jo,timeZoneName:Vo},tn={hour:jo,minute:jo,second:jo,timeZoneName:Ho},en={hour:jo,minute:jo,hourCycle:"h23"},on={hour:jo,minute:jo,second:jo,hourCycle:"h23"},nn={hour:jo,minute:jo,second:jo,hourCycle:"h23",timeZoneName:Vo},sn={hour:jo,minute:jo,second:jo,hourCycle:"h23",timeZoneName:Ho},rn={year:jo,month:jo,day:jo,hour:jo,minute:jo},an={year:jo,month:jo,day:jo,hour:jo,minute:jo,second:jo},ln={year:jo,month:Vo,day:jo,hour:jo,minute:jo},dn={year:jo,month:Vo,day:jo,hour:jo,minute:jo,second:jo},cn={year:jo,month:Vo,day:jo,weekday:Vo,hour:jo,minute:jo},hn={year:jo,month:Ho,day:jo,hour:jo,minute:jo,timeZoneName:Vo},un={year:jo,month:Ho,day:jo,hour:jo,minute:jo,second:jo,timeZoneName:Vo},pn={year:jo,month:Ho,day:jo,weekday:Ho,hour:jo,minute:jo,timeZoneName:Ho},mn={year:jo,month:Ho,day:jo,weekday:Ho,hour:jo,minute:jo,second:jo,timeZoneName:Ho};class gn{get type(){throw new Uo}get name(){throw new Uo}get ianaName(){return this.name}get isUniversal(){throw new Uo}offsetName(t,e){throw new Uo}formatOffset(t,e){throw new Uo}offset(t){throw new Uo}equals(t){throw new Uo}get isValid(){throw new Uo}}let fn=null;class vn extends gn{static get instance(){return null===fn&&(fn=new vn),fn}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:e,locale:i}){return zs(t,e,i)}formatOffset(t,e){return Bs(this.offset(t),e)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return"system"===t.type}get isValid(){return!0}}let yn={};const bn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};let xn={};class _n extends gn{static create(t){return xn[t]||(xn[t]=new _n(t)),xn[t]}static resetCache(){xn={},yn={}}static isValidSpecifier(t){return this.isValidZone(t)}static isValidZone(t){if(!t)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:t}).format(),!0}catch(t){return!1}}constructor(t){super(),this.zoneName=t,this.valid=_n.isValidZone(t)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(t,{format:e,locale:i}){return zs(t,e,i,this.name)}formatOffset(t,e){return Bs(this.offset(t),e)}offset(t){const e=new Date(t);if(isNaN(e))return NaN;const i=(o=this.name,yn[o]||(yn[o]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:o,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),yn[o]);var o;let[n,s,r,a,l,d,c]=i.formatToParts?function(t,e){const i=t.formatToParts(e),o=[];for(let t=0;t<i.length;t++){const{type:e,value:n}=i[t],s=bn[e];"era"===e?o[s]=n:ms(s)||(o[s]=parseInt(n,10))}return o}(i,e):function(t,e){const i=t.format(e).replace(/\u200E/g,""),o=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(i),[,n,s,r,a,l,d,c]=o;return[r,n,s,a,l,d,c]}(i,e);"BC"===a&&(n=1-Math.abs(n));let h=+e;const u=h%1e3;return h-=u>=0?u:1e3+u,(Ms({year:n,month:s,day:r,hour:24===l?0:l,minute:d,second:c,millisecond:0})-h)/6e4}equals(t){return"iana"===t.type&&t.name===this.name}get isValid(){return this.valid}}let wn={};let kn={};function Cn(t,e={}){const i=JSON.stringify([t,e]);let o=kn[i];return o||(o=new Intl.DateTimeFormat(t,e),kn[i]=o),o}let Sn={};let An={};let En=null;let $n={};function Tn(t,e,i,o){const n=t.listingMode();return"error"===n?null:"en"===n?i(e):o(e)}class Dn{constructor(t,e,i){this.padTo=i.padTo||0,this.floor=i.floor||!1;const{padTo:o,floor:n,...s}=i;if(!e||Object.keys(s).length>0){const e={useGrouping:!1,...i};i.padTo>0&&(e.minimumIntegerDigits=i.padTo),this.inf=function(t,e={}){const i=JSON.stringify([t,e]);let o=Sn[i];return o||(o=new Intl.NumberFormat(t,e),Sn[i]=o),o}(t,e)}}format(t){if(this.inf){const e=this.floor?Math.floor(t):t;return this.inf.format(e)}return ks(this.floor?Math.floor(t):Es(t,3),this.padTo)}}class Mn{constructor(t,e,i){let o;if(this.opts=i,this.originalZone=void 0,this.opts.timeZone)this.dt=t;else if("fixed"===t.zone.type){const e=t.offset/60*-1,i=e>=0?`Etc/GMT+${e}`:`Etc/GMT${e}`;0!==t.offset&&_n.create(i).valid?(o=i,this.dt=t):(o="UTC",this.dt=0===t.offset?t:t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone)}else"system"===t.zone.type?this.dt=t:"iana"===t.zone.type?(this.dt=t,o=t.zone.name):(o="UTC",this.dt=t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone);const n={...this.opts};n.timeZone=n.timeZone||o,this.dtf=Cn(e,n)}format(){return this.originalZone?this.formatToParts().map((({value:t})=>t)).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const t=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?t.map((t=>{if("timeZoneName"===t.type){const e=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:e}}return t})):t}resolvedOptions(){return this.dtf.resolvedOptions()}}class In{constructor(t,e,i){this.opts={style:"long",...i},!e&&vs()&&(this.rtf=function(t,e={}){const{base:i,...o}=e,n=JSON.stringify([t,o]);let s=An[n];return s||(s=new Intl.RelativeTimeFormat(t,e),An[n]=s),s}(t,i))}format(t,e){return this.rtf?this.rtf.format(t,e):function(t,e,i="always",o=!1){const n={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=-1===["hours","minutes","seconds"].indexOf(t);if("auto"===i&&s){const i="days"===t;switch(e){case 1:return i?"tomorrow":`next ${n[t][0]}`;case-1:return i?"yesterday":`last ${n[t][0]}`;case 0:return i?"today":`this ${n[t][0]}`}}const r=Object.is(e,-0)||e<0,a=Math.abs(e),l=1===a,d=n[t],c=o?l?d[1]:d[2]||d[1]:l?n[t][0]:t;return r?`${a} ${c} ago`:`in ${a} ${c}`}(e,t,this.opts.numeric,"long"!==this.opts.style)}formatToParts(t,e){return this.rtf?this.rtf.formatToParts(t,e):[]}}const On={firstDay:1,minimalDays:4,weekend:[6,7]};class Ln{static fromOpts(t){return Ln.create(t.locale,t.numberingSystem,t.outputCalendar,t.weekSettings,t.defaultToEN)}static create(t,e,i,o,n=!1){const s=t||Qn.defaultLocale,r=s||(n?"en-US":En||(En=(new Intl.DateTimeFormat).resolvedOptions().locale,En)),a=e||Qn.defaultNumberingSystem,l=i||Qn.defaultOutputCalendar,d=_s(o)||Qn.defaultWeekSettings;return new Ln(r,a,l,d,s)}static resetCache(){En=null,kn={},Sn={},An={}}static fromObject({locale:t,numberingSystem:e,outputCalendar:i,weekSettings:o}={}){return Ln.create(t,e,i,o)}constructor(t,e,i,o,n){const[s,r,a]=function(t){const e=t.indexOf("-x-");-1!==e&&(t=t.substring(0,e));const i=t.indexOf("-u-");if(-1===i)return[t];{let e,o;try{e=Cn(t).resolvedOptions(),o=t}catch(n){const s=t.substring(0,i);e=Cn(s).resolvedOptions(),o=s}const{numberingSystem:n,calendar:s}=e;return[o,n,s]}}(t);this.locale=s,this.numberingSystem=e||r||null,this.outputCalendar=i||a||null,this.weekSettings=o,this.intl=function(t,e,i){return i||e?(t.includes("-u-")||(t+="-u"),i&&(t+=`-ca-${i}`),e&&(t+=`-nu-${e}`),t):t}(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=n,this.fastNumbersCached=null}get fastNumbers(){var t;return null==this.fastNumbersCached&&(this.fastNumbersCached=(!(t=this).numberingSystem||"latn"===t.numberingSystem)&&("latn"===t.numberingSystem||!t.locale||t.locale.startsWith("en")||"latn"===new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem)),this.fastNumbersCached}listingMode(){const t=this.isEnglish(),e=!(null!==this.numberingSystem&&"latn"!==this.numberingSystem||null!==this.outputCalendar&&"gregory"!==this.outputCalendar);return t&&e?"en":"intl"}clone(t){return t&&0!==Object.getOwnPropertyNames(t).length?Ln.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,_s(t.weekSettings)||this.weekSettings,t.defaultToEN||!1):this}redefaultToEN(t={}){return this.clone({...t,defaultToEN:!0})}redefaultToSystem(t={}){return this.clone({...t,defaultToEN:!1})}months(t,e=!1){return Tn(this,t,Vs,(()=>{const i=e?{month:t,day:"numeric"}:{month:t},o=e?"format":"standalone";return this.monthsCache[o][t]||(this.monthsCache[o][t]=function(t){const e=[];for(let i=1;i<=12;i++){const o=Za.utc(2009,i,1);e.push(t(o))}return e}((t=>this.extract(t,i,"month")))),this.monthsCache[o][t]}))}weekdays(t,e=!1){return Tn(this,t,Ys,(()=>{const i=e?{weekday:t,year:"numeric",month:"long",day:"numeric"}:{weekday:t},o=e?"format":"standalone";return this.weekdaysCache[o][t]||(this.weekdaysCache[o][t]=function(t){const e=[];for(let i=1;i<=7;i++){const o=Za.utc(2016,11,13+i);e.push(t(o))}return e}((t=>this.extract(t,i,"weekday")))),this.weekdaysCache[o][t]}))}meridiems(){return Tn(this,void 0,(()=>Gs),(()=>{if(!this.meridiemCache){const t={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Za.utc(2016,11,13,9),Za.utc(2016,11,13,19)].map((e=>this.extract(e,t,"dayperiod")))}return this.meridiemCache}))}eras(t){return Tn(this,t,Js,(()=>{const e={era:t};return this.eraCache[t]||(this.eraCache[t]=[Za.utc(-40,1,1),Za.utc(2017,1,1)].map((t=>this.extract(t,e,"era")))),this.eraCache[t]}))}extract(t,e,i){const o=this.dtFormatter(t,e).formatToParts().find((t=>t.type.toLowerCase()===i));return o?o.value:null}numberFormatter(t={}){return new Dn(this.intl,t.forceSimple||this.fastNumbers,t)}dtFormatter(t,e={}){return new Mn(t,this.intl,e)}relFormatter(t={}){return new In(this.intl,this.isEnglish(),t)}listFormatter(t={}){return function(t,e={}){const i=JSON.stringify([t,e]);let o=wn[i];return o||(o=new Intl.ListFormat(t,e),wn[i]=o),o}(this.intl,t)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:ys()?function(t){let e=$n[t];if(!e){const i=new Intl.Locale(t);e="getWeekInfo"in i?i.getWeekInfo():i.weekInfo,$n[t]=e}return e}(this.locale):On}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(t){return this.locale===t.locale&&this.numberingSystem===t.numberingSystem&&this.outputCalendar===t.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let zn=null;class Pn extends gn{static get utcInstance(){return null===zn&&(zn=new Pn(0)),zn}static instance(t){return 0===t?Pn.utcInstance:new Pn(t)}static parseSpecifier(t){if(t){const e=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(e)return new Pn(Ps(e[1],e[2]))}return null}constructor(t){super(),this.fixed=t}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${Bs(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${Bs(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(t,e){return Bs(this.fixed,e)}get isUniversal(){return!0}offset(){return this.fixed}equals(t){return"fixed"===t.type&&t.fixed===this.fixed}get isValid(){return!0}}class Rn extends gn{constructor(t){super(),this.zoneName=t}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function Nn(t,e){if(ms(t)||null===t)return e;if(t instanceof gn)return t;if(function(t){return"string"==typeof t}(t)){const i=t.toLowerCase();return"default"===i?e:"local"===i||"system"===i?vn.instance:"utc"===i||"gmt"===i?Pn.utcInstance:Pn.parseSpecifier(i)||_n.create(t)}return gs(t)?Pn.instance(t):"object"==typeof t&&"offset"in t&&"function"==typeof t.offset?t:new Rn(t)}const Bn={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Fn={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},qn=Bn.hanidec.replace(/[\[|\]]/g,"").split("");let Un={};function jn({numberingSystem:t},e=""){const i=t||"latn";return Un[i]||(Un[i]={}),Un[i][e]||(Un[i][e]=new RegExp(`${Bn[i]}${e}`)),Un[i][e]}let Vn,Hn=()=>Date.now(),Wn="system",Zn=null,Yn=null,Gn=null,Kn=60,Xn=null;class Qn{static get now(){return Hn}static set now(t){Hn=t}static set defaultZone(t){Wn=t}static get defaultZone(){return Nn(Wn,vn.instance)}static get defaultLocale(){return Zn}static set defaultLocale(t){Zn=t}static get defaultNumberingSystem(){return Yn}static set defaultNumberingSystem(t){Yn=t}static get defaultOutputCalendar(){return Gn}static set defaultOutputCalendar(t){Gn=t}static get defaultWeekSettings(){return Xn}static set defaultWeekSettings(t){Xn=_s(t)}static get twoDigitCutoffYear(){return Kn}static set twoDigitCutoffYear(t){Kn=t%100}static get throwOnInvalid(){return Vn}static set throwOnInvalid(t){Vn=t}static resetCaches(){Ln.resetCache(),_n.resetCache(),Za.resetCache(),Un={}}}class Jn{constructor(t,e){this.reason=t,this.explanation=e}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const ts=[0,31,59,90,120,151,181,212,243,273,304,334],es=[0,31,60,91,121,152,182,213,244,274,305,335];function is(t,e){return new Jn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function os(t,e,i){const o=new Date(Date.UTC(t,e-1,i));t<100&&t>=0&&o.setUTCFullYear(o.getUTCFullYear()-1900);const n=o.getUTCDay();return 0===n?7:n}function ns(t,e,i){return i+($s(t)?es:ts)[e-1]}function ss(t,e){const i=$s(t)?es:ts,o=i.findIndex((t=>t<e));return{month:o+1,day:e-i[o]}}function rs(t,e){return(t-e+7)%7+1}function as(t,e=4,i=1){const{year:o,month:n,day:s}=t,r=ns(o,n,s),a=rs(os(o,n,s),i);let l,d=Math.floor((r-a+14-e)/7);return d<1?(l=o-1,d=Os(l,e,i)):d>Os(o,e,i)?(l=o+1,d=1):l=o,{weekYear:l,weekNumber:d,weekday:a,...Fs(t)}}function ls(t,e=4,i=1){const{weekYear:o,weekNumber:n,weekday:s}=t,r=rs(os(o,1,e),i),a=Ts(o);let l,d=7*n+s-r-7+e;d<1?(l=o-1,d+=Ts(l)):d>a?(l=o+1,d-=Ts(o)):l=o;const{month:c,day:h}=ss(l,d);return{year:l,month:c,day:h,...Fs(t)}}function ds(t){const{year:e,month:i,day:o}=t;return{year:e,ordinal:ns(e,i,o),...Fs(t)}}function cs(t){const{year:e,ordinal:i}=t,{month:o,day:n}=ss(e,i);return{year:e,month:o,day:n,...Fs(t)}}function hs(t,e){if(!ms(t.localWeekday)||!ms(t.localWeekNumber)||!ms(t.localWeekYear)){if(!ms(t.weekday)||!ms(t.weekNumber)||!ms(t.weekYear))throw new Bo("Cannot mix locale-based week fields with ISO-based week fields");return ms(t.localWeekday)||(t.weekday=t.localWeekday),ms(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),ms(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}return{minDaysInFirstWeek:4,startOfWeek:1}}function us(t){const e=fs(t.year),i=ws(t.month,1,12),o=ws(t.day,1,Ds(t.year,t.month));return e?i?!o&&is("day",t.day):is("month",t.month):is("year",t.year)}function ps(t){const{hour:e,minute:i,second:o,millisecond:n}=t,s=ws(e,0,23)||24===e&&0===i&&0===o&&0===n,r=ws(i,0,59),a=ws(o,0,59),l=ws(n,0,999);return s?r?a?!l&&is("millisecond",n):is("second",o):is("minute",i):is("hour",e)}function ms(t){return void 0===t}function gs(t){return"number"==typeof t}function fs(t){return"number"==typeof t&&t%1==0}function vs(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(t){return!1}}function ys(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(t){return!1}}function bs(t,e,i){if(0!==t.length)return t.reduce(((t,o)=>{const n=[e(o),o];return t&&i(t[0],n[0])===t[0]?t:n}),null)[1]}function xs(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function _s(t){if(null==t)return null;if("object"!=typeof t)throw new qo("Week settings must be an object");if(!ws(t.firstDay,1,7)||!ws(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some((t=>!ws(t,1,7))))throw new qo("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function ws(t,e,i){return fs(t)&&t>=e&&t<=i}function ks(t,e=2){let i;return i=t<0?"-"+(""+-t).padStart(e,"0"):(""+t).padStart(e,"0"),i}function Cs(t){return ms(t)||null===t||""===t?void 0:parseInt(t,10)}function Ss(t){return ms(t)||null===t||""===t?void 0:parseFloat(t)}function As(t){if(!ms(t)&&null!==t&&""!==t){const e=1e3*parseFloat("0."+t);return Math.floor(e)}}function Es(t,e,i=!1){const o=10**e;return(i?Math.trunc:Math.round)(t*o)/o}function $s(t){return t%4==0&&(t%100!=0||t%400==0)}function Ts(t){return $s(t)?366:365}function Ds(t,e){const i=function(t,e){return t-e*Math.floor(t/e)}(e-1,12)+1;return 2===i?$s(t+(e-i)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][i-1]}function Ms(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function Is(t,e,i){return-rs(os(t,1,e),i)+e-1}function Os(t,e=4,i=1){const o=Is(t,e,i),n=Is(t+1,e,i);return(Ts(t)-o+n)/7}function Ls(t){return t>99?t:t>Qn.twoDigitCutoffYear?1900+t:2e3+t}function zs(t,e,i,o=null){const n=new Date(t),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};o&&(s.timeZone=o);const r={timeZoneName:e,...s},a=new Intl.DateTimeFormat(i,r).formatToParts(n).find((t=>"timezonename"===t.type.toLowerCase()));return a?a.value:null}function Ps(t,e){let i=parseInt(t,10);Number.isNaN(i)&&(i=0);const o=parseInt(e,10)||0;return 60*i+(i<0||Object.is(i,-0)?-o:o)}function Rs(t){const e=Number(t);if("boolean"==typeof t||""===t||Number.isNaN(e))throw new qo(`Invalid unit value ${t}`);return e}function Ns(t,e){const i={};for(const o in t)if(xs(t,o)){const n=t[o];if(null==n)continue;i[e(o)]=Rs(n)}return i}function Bs(t,e){const i=Math.trunc(Math.abs(t/60)),o=Math.trunc(Math.abs(t%60)),n=t>=0?"+":"-";switch(e){case"short":return`${n}${ks(i,2)}:${ks(o,2)}`;case"narrow":return`${n}${i}${o>0?`:${o}`:""}`;case"techie":return`${n}${ks(i,2)}${ks(o,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Fs(t){return function(t,e){return e.reduce(((e,i)=>(e[i]=t[i],e)),{})}(t,["hour","minute","second","millisecond"])}const qs=["January","February","March","April","May","June","July","August","September","October","November","December"],Us=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],js=["J","F","M","A","M","J","J","A","S","O","N","D"];function Vs(t){switch(t){case"narrow":return[...js];case"short":return[...Us];case"long":return[...qs];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Hs=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Ws=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Zs=["M","T","W","T","F","S","S"];function Ys(t){switch(t){case"narrow":return[...Zs];case"short":return[...Ws];case"long":return[...Hs];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Gs=["AM","PM"],Ks=["Before Christ","Anno Domini"],Xs=["BC","AD"],Qs=["B","A"];function Js(t){switch(t){case"narrow":return[...Qs];case"short":return[...Xs];case"long":return[...Ks];default:return null}}function tr(t,e){let i="";for(const o of t)o.literal?i+=o.val:i+=e(o.val);return i}const er={D:Wo,DD:Zo,DDD:Go,DDDD:Ko,t:Xo,tt:Qo,ttt:Jo,tttt:tn,T:en,TT:on,TTT:nn,TTTT:sn,f:rn,ff:ln,fff:hn,ffff:pn,F:an,FF:dn,FFF:un,FFFF:mn};class ir{static create(t,e={}){return new ir(t,e)}static parseFormat(t){let e=null,i="",o=!1;const n=[];for(let s=0;s<t.length;s++){const r=t.charAt(s);"'"===r?(i.length>0&&n.push({literal:o||/^\s+$/.test(i),val:i}),e=null,i="",o=!o):o||r===e?i+=r:(i.length>0&&n.push({literal:/^\s+$/.test(i),val:i}),i=r,e=r)}return i.length>0&&n.push({literal:o||/^\s+$/.test(i),val:i}),n}static macroTokenToFormatOpts(t){return er[t]}constructor(t,e){this.opts=e,this.loc=t,this.systemLoc=null}formatWithSystemDefault(t,e){null===this.systemLoc&&(this.systemLoc=this.loc.redefaultToSystem());return this.systemLoc.dtFormatter(t,{...this.opts,...e}).format()}dtFormatter(t,e={}){return this.loc.dtFormatter(t,{...this.opts,...e})}formatDateTime(t,e){return this.dtFormatter(t,e).format()}formatDateTimeParts(t,e){return this.dtFormatter(t,e).formatToParts()}formatInterval(t,e){return this.dtFormatter(t.start,e).dtf.formatRange(t.start.toJSDate(),t.end.toJSDate())}resolvedOptions(t,e){return this.dtFormatter(t,e).resolvedOptions()}num(t,e=0){if(this.opts.forceSimple)return ks(t,e);const i={...this.opts};return e>0&&(i.padTo=e),this.loc.numberFormatter(i).format(t)}formatDateTimeFromString(t,e){const i="en"===this.loc.listingMode(),o=this.loc.outputCalendar&&"gregory"!==this.loc.outputCalendar,n=(e,i)=>this.loc.extract(t,e,i),s=e=>t.isOffsetFixed&&0===t.offset&&e.allowZ?"Z":t.isValid?t.zone.formatOffset(t.ts,e.format):"",r=()=>i?function(t){return Gs[t.hour<12?0:1]}(t):n({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(e,o)=>i?function(t,e){return Vs(e)[t.month-1]}(t,e):n(o?{month:e}:{month:e,day:"numeric"},"month"),l=(e,o)=>i?function(t,e){return Ys(e)[t.weekday-1]}(t,e):n(o?{weekday:e}:{weekday:e,month:"long",day:"numeric"},"weekday"),d=e=>{const i=ir.macroTokenToFormatOpts(e);return i?this.formatWithSystemDefault(t,i):e},c=e=>i?function(t,e){return Js(e)[t.year<0?0:1]}(t,e):n({era:e},"era");return tr(ir.parseFormat(e),(e=>{switch(e){case"S":return this.num(t.millisecond);case"u":case"SSS":return this.num(t.millisecond,3);case"s":return this.num(t.second);case"ss":return this.num(t.second,2);case"uu":return this.num(Math.floor(t.millisecond/10),2);case"uuu":return this.num(Math.floor(t.millisecond/100));case"m":return this.num(t.minute);case"mm":return this.num(t.minute,2);case"h":return this.num(t.hour%12==0?12:t.hour%12);case"hh":return this.num(t.hour%12==0?12:t.hour%12,2);case"H":return this.num(t.hour);case"HH":return this.num(t.hour,2);case"Z":return s({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return s({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return s({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return t.zone.offsetName(t.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return t.zone.offsetName(t.ts,{format:"long",locale:this.loc.locale});case"z":return t.zoneName;case"a":return r();case"d":return o?n({day:"numeric"},"day"):this.num(t.day);case"dd":return o?n({day:"2-digit"},"day"):this.num(t.day,2);case"c":case"E":return this.num(t.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return o?n({month:"numeric",day:"numeric"},"month"):this.num(t.month);case"LL":return o?n({month:"2-digit",day:"numeric"},"month"):this.num(t.month,2);case"LLL":return a("short",!0);case"LLLL":return a("long",!0);case"LLLLL":return a("narrow",!0);case"M":return o?n({month:"numeric"},"month"):this.num(t.month);case"MM":return o?n({month:"2-digit"},"month"):this.num(t.month,2);case"MMM":return a("short",!1);case"MMMM":return a("long",!1);case"MMMMM":return a("narrow",!1);case"y":return o?n({year:"numeric"},"year"):this.num(t.year);case"yy":return o?n({year:"2-digit"},"year"):this.num(t.year.toString().slice(-2),2);case"yyyy":return o?n({year:"numeric"},"year"):this.num(t.year,4);case"yyyyyy":return o?n({year:"numeric"},"year"):this.num(t.year,6);case"G":return c("short");case"GG":return c("long");case"GGGGG":return c("narrow");case"kk":return this.num(t.weekYear.toString().slice(-2),2);case"kkkk":return this.num(t.weekYear,4);case"W":return this.num(t.weekNumber);case"WW":return this.num(t.weekNumber,2);case"n":return this.num(t.localWeekNumber);case"nn":return this.num(t.localWeekNumber,2);case"ii":return this.num(t.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(t.localWeekYear,4);case"o":return this.num(t.ordinal);case"ooo":return this.num(t.ordinal,3);case"q":return this.num(t.quarter);case"qq":return this.num(t.quarter,2);case"X":return this.num(Math.floor(t.ts/1e3));case"x":return this.num(t.ts);default:return d(e)}}))}formatDurationFromString(t,e){const i=t=>{switch(t[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},o=ir.parseFormat(e),n=o.reduce(((t,{literal:e,val:i})=>e?t:t.concat(i)),[]),s=t.shiftTo(...n.map(i).filter((t=>t)));return tr(o,(t=>e=>{const o=i(e);return o?this.num(t.get(o),e.length):e})(s))}}const or=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function nr(...t){const e=t.reduce(((t,e)=>t+e.source),"");return RegExp(`^${e}$`)}function sr(...t){return e=>t.reduce((([t,i,o],n)=>{const[s,r,a]=n(e,o);return[{...t,...s},r||i,a]}),[{},null,1]).slice(0,2)}function rr(t,...e){if(null==t)return[null,null];for(const[i,o]of e){const e=i.exec(t);if(e)return o(e)}return[null,null]}function ar(...t){return(e,i)=>{const o={};let n;for(n=0;n<t.length;n++)o[t[n]]=Cs(e[i+n]);return[o,null,i+n]}}const lr=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,dr=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,cr=RegExp(`${dr.source}${`(?:${lr.source}?(?:\\[(${or.source})\\])?)?`}`),hr=RegExp(`(?:T${cr.source})?`),ur=ar("weekYear","weekNumber","weekDay"),pr=ar("year","ordinal"),mr=RegExp(`${dr.source} ?(?:${lr.source}|(${or.source}))?`),gr=RegExp(`(?: ${mr.source})?`);function fr(t,e,i){const o=t[e];return ms(o)?i:Cs(o)}function vr(t,e){return[{hours:fr(t,e,0),minutes:fr(t,e+1,0),seconds:fr(t,e+2,0),milliseconds:As(t[e+3])},null,e+4]}function yr(t,e){const i=!t[e]&&!t[e+1],o=Ps(t[e+1],t[e+2]);return[{},i?null:Pn.instance(o),e+3]}function br(t,e){return[{},t[e]?_n.create(t[e]):null,e+1]}const xr=RegExp(`^T?${dr.source}$`),_r=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function wr(t){const[e,i,o,n,s,r,a,l,d]=t,c="-"===e[0],h=l&&"-"===l[0],u=(t,e=!1)=>void 0!==t&&(e||t&&c)?-t:t;return[{years:u(Ss(i)),months:u(Ss(o)),weeks:u(Ss(n)),days:u(Ss(s)),hours:u(Ss(r)),minutes:u(Ss(a)),seconds:u(Ss(l),"-0"===l),milliseconds:u(As(d),h)}]}const kr={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Cr(t,e,i,o,n,s,r){const a={year:2===e.length?Ls(Cs(e)):Cs(e),month:Us.indexOf(i)+1,day:Cs(o),hour:Cs(n),minute:Cs(s)};return r&&(a.second=Cs(r)),t&&(a.weekday=t.length>3?Hs.indexOf(t)+1:Ws.indexOf(t)+1),a}const Sr=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Ar(t){const[,e,i,o,n,s,r,a,l,d,c,h]=t,u=Cr(e,n,o,i,s,r,a);let p;return p=l?kr[l]:d?0:Ps(c,h),[u,new Pn(p)]}const Er=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,$r=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Tr=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function Dr(t){const[,e,i,o,n,s,r,a]=t;return[Cr(e,n,o,i,s,r,a),Pn.utcInstance]}function Mr(t){const[,e,i,o,n,s,r,a]=t;return[Cr(e,a,i,o,n,s,r),Pn.utcInstance]}const Ir=nr(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,hr),Or=nr(/(\d{4})-?W(\d\d)(?:-?(\d))?/,hr),Lr=nr(/(\d{4})-?(\d{3})/,hr),zr=nr(cr),Pr=sr((function(t,e){return[{year:fr(t,e),month:fr(t,e+1,1),day:fr(t,e+2,1)},null,e+3]}),vr,yr,br),Rr=sr(ur,vr,yr,br),Nr=sr(pr,vr,yr,br),Br=sr(vr,yr,br);const Fr=sr(vr);const qr=nr(/(\d{4})-(\d\d)-(\d\d)/,gr),Ur=nr(mr),jr=sr(vr,yr,br);const Vr="Invalid Duration",Hr={weeks:{days:7,hours:168,minutes:10080,seconds:604800,milliseconds:6048e5},days:{hours:24,minutes:1440,seconds:86400,milliseconds:864e5},hours:{minutes:60,seconds:3600,milliseconds:36e5},minutes:{seconds:60,milliseconds:6e4},seconds:{milliseconds:1e3}},Wr={years:{quarters:4,months:12,weeks:52,days:365,hours:8760,minutes:525600,seconds:31536e3,milliseconds:31536e6},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:131040,seconds:7862400,milliseconds:78624e5},months:{weeks:4,days:30,hours:720,minutes:43200,seconds:2592e3,milliseconds:2592e6},...Hr},Zr=365.2425,Yr=30.436875,Gr={years:{quarters:4,months:12,weeks:52.1775,days:Zr,hours:8765.82,minutes:525949.2,seconds:525949.2*60,milliseconds:525949.2*60*1e3},quarters:{months:3,weeks:13.044375,days:91.310625,hours:2191.455,minutes:131487.3,seconds:525949.2*60/4,milliseconds:7889237999.999999},months:{weeks:4.3481250000000005,days:Yr,hours:730.485,minutes:43829.1,seconds:2629746,milliseconds:2629746e3},...Hr},Kr=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Xr=Kr.slice(0).reverse();function Qr(t,e,i=!1){const o={values:i?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new ea(o)}function Jr(t,e){let i=e.milliseconds??0;for(const o of Xr.slice(1))e[o]&&(i+=e[o]*t[o].milliseconds);return i}function ta(t,e){const i=Jr(t,e)<0?-1:1;Kr.reduceRight(((o,n)=>{if(ms(e[n]))return o;if(o){const s=e[o]*i,r=t[n][o],a=Math.floor(s/r);e[n]+=a*i,e[o]-=a*r*i}return n}),null),Kr.reduce(((i,o)=>{if(ms(e[o]))return i;if(i){const n=e[i]%1;e[i]-=n,e[o]+=n*t[i][o]}return o}),null)}class ea{constructor(t){const e="longterm"===t.conversionAccuracy||!1;let i=e?Gr:Wr;t.matrix&&(i=t.matrix),this.values=t.values,this.loc=t.loc||Ln.create(),this.conversionAccuracy=e?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=i,this.isLuxonDuration=!0}static fromMillis(t,e){return ea.fromObject({milliseconds:t},e)}static fromObject(t,e={}){if(null==t||"object"!=typeof t)throw new qo("Duration.fromObject: argument expected to be an object, got "+(null===t?"null":typeof t));return new ea({values:Ns(t,ea.normalizeUnit),loc:Ln.fromObject(e),conversionAccuracy:e.conversionAccuracy,matrix:e.matrix})}static fromDurationLike(t){if(gs(t))return ea.fromMillis(t);if(ea.isDuration(t))return t;if("object"==typeof t)return ea.fromObject(t);throw new qo(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,e){const[i]=function(t){return rr(t,[_r,wr])}(t);return i?ea.fromObject(i,e):ea.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,e){const[i]=function(t){return rr(t,[xr,Fr])}(t);return i?ea.fromObject(i,e):ea.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,e=null){if(!t)throw new qo("need to specify a reason the Duration is invalid");const i=t instanceof Jn?t:new Jn(t,e);if(Qn.throwOnInvalid)throw new No(i);return new ea({invalid:i})}static normalizeUnit(t){const e={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[t?t.toLowerCase():t];if(!e)throw new Fo(t);return e}static isDuration(t){return t&&t.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(t,e={}){const i={...e,floor:!1!==e.round&&!1!==e.floor};return this.isValid?ir.create(this.loc,i).formatDurationFromString(this,t):Vr}toHuman(t={}){if(!this.isValid)return Vr;const e=Kr.map((e=>{const i=this.values[e];return ms(i)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...t,unit:e.slice(0,-1)}).format(i)})).filter((t=>t));return this.loc.listFormatter({type:"conjunction",style:t.listStyle||"narrow",...t}).format(e)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let t="P";return 0!==this.years&&(t+=this.years+"Y"),0===this.months&&0===this.quarters||(t+=this.months+3*this.quarters+"M"),0!==this.weeks&&(t+=this.weeks+"W"),0!==this.days&&(t+=this.days+"D"),0===this.hours&&0===this.minutes&&0===this.seconds&&0===this.milliseconds||(t+="T"),0!==this.hours&&(t+=this.hours+"H"),0!==this.minutes&&(t+=this.minutes+"M"),0===this.seconds&&0===this.milliseconds||(t+=Es(this.seconds+this.milliseconds/1e3,3)+"S"),"P"===t&&(t+="T0S"),t}toISOTime(t={}){if(!this.isValid)return null;const e=this.toMillis();if(e<0||e>=864e5)return null;t={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...t,includeOffset:!1};return Za.fromMillis(e,{zone:"UTC"}).toISOTime(t)}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Jr(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;const e=ea.fromDurationLike(t),i={};for(const t of Kr)(xs(e.values,t)||xs(this.values,t))&&(i[t]=e.get(t)+this.get(t));return Qr(this,{values:i},!0)}minus(t){if(!this.isValid)return this;const e=ea.fromDurationLike(t);return this.plus(e.negate())}mapUnits(t){if(!this.isValid)return this;const e={};for(const i of Object.keys(this.values))e[i]=Rs(t(this.values[i],i));return Qr(this,{values:e},!0)}get(t){return this[ea.normalizeUnit(t)]}set(t){if(!this.isValid)return this;return Qr(this,{values:{...this.values,...Ns(t,ea.normalizeUnit)}})}reconfigure({locale:t,numberingSystem:e,conversionAccuracy:i,matrix:o}={}){return Qr(this,{loc:this.loc.clone({locale:t,numberingSystem:e}),matrix:o,conversionAccuracy:i})}as(t){return this.isValid?this.shiftTo(t).get(t):NaN}normalize(){if(!this.isValid)return this;const t=this.toObject();return ta(this.matrix,t),Qr(this,{values:t},!0)}rescale(){if(!this.isValid)return this;return Qr(this,{values:function(t){const e={};for(const[i,o]of Object.entries(t))0!==o&&(e[i]=o);return e}(this.normalize().shiftToAll().toObject())},!0)}shiftTo(...t){if(!this.isValid)return this;if(0===t.length)return this;t=t.map((t=>ea.normalizeUnit(t)));const e={},i={},o=this.toObject();let n;for(const s of Kr)if(t.indexOf(s)>=0){n=s;let t=0;for(const e in i)t+=this.matrix[e][s]*i[e],i[e]=0;gs(o[s])&&(t+=o[s]);const r=Math.trunc(t);e[s]=r,i[s]=(1e3*t-1e3*r)/1e3}else gs(o[s])&&(i[s]=o[s]);for(const t in i)0!==i[t]&&(e[n]+=t===n?i[t]:i[t]/this.matrix[n][t]);return ta(this.matrix,e),Qr(this,{values:e},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const t={};for(const e of Object.keys(this.values))t[e]=0===this.values[e]?0:-this.values[e];return Qr(this,{values:t},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return null===this.invalid}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(t){if(!this.isValid||!t.isValid)return!1;if(!this.loc.equals(t.loc))return!1;for(const o of Kr)if(e=this.values[o],i=t.values[o],!(void 0===e||0===e?void 0===i||0===i:e===i))return!1;var e,i;return!0}}const ia="Invalid Interval";class oa{constructor(t){this.s=t.start,this.e=t.end,this.invalid=t.invalid||null,this.isLuxonInterval=!0}static invalid(t,e=null){if(!t)throw new qo("need to specify a reason the Interval is invalid");const i=t instanceof Jn?t:new Jn(t,e);if(Qn.throwOnInvalid)throw new Ro(i);return new oa({invalid:i})}static fromDateTimes(t,e){const i=Ya(t),o=Ya(e),n=function(t,e){return t&&t.isValid?e&&e.isValid?e<t?oa.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null:oa.invalid("missing or invalid end"):oa.invalid("missing or invalid start")}(i,o);return null==n?new oa({start:i,end:o}):n}static after(t,e){const i=ea.fromDurationLike(e),o=Ya(t);return oa.fromDateTimes(o,o.plus(i))}static before(t,e){const i=ea.fromDurationLike(e),o=Ya(t);return oa.fromDateTimes(o.minus(i),o)}static fromISO(t,e){const[i,o]=(t||"").split("/",2);if(i&&o){let t,n,s,r;try{t=Za.fromISO(i,e),n=t.isValid}catch(o){n=!1}try{s=Za.fromISO(o,e),r=s.isValid}catch(o){r=!1}if(n&&r)return oa.fromDateTimes(t,s);if(n){const i=ea.fromISO(o,e);if(i.isValid)return oa.after(t,i)}else if(r){const t=ea.fromISO(i,e);if(t.isValid)return oa.before(s,t)}}return oa.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static isInterval(t){return t&&t.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return null===this.invalidReason}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(t="milliseconds"){return this.isValid?this.toDuration(t).get(t):NaN}count(t="milliseconds",e){if(!this.isValid)return NaN;const i=this.start.startOf(t,e);let o;return o=e?.useLocaleWeeks?this.end.reconfigure({locale:i.locale}):this.end,o=o.startOf(t,e),Math.floor(o.diff(i,t).get(t))+(o.valueOf()!==this.end.valueOf())}hasSame(t){return!!this.isValid&&(this.isEmpty()||this.e.minus(1).hasSame(this.s,t))}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(t){return!!this.isValid&&this.s>t}isBefore(t){return!!this.isValid&&this.e<=t}contains(t){return!!this.isValid&&(this.s<=t&&this.e>t)}set({start:t,end:e}={}){return this.isValid?oa.fromDateTimes(t||this.s,e||this.e):this}splitAt(...t){if(!this.isValid)return[];const e=t.map(Ya).filter((t=>this.contains(t))).sort(((t,e)=>t.toMillis()-e.toMillis())),i=[];let{s:o}=this,n=0;for(;o<this.e;){const t=e[n]||this.e,s=+t>+this.e?this.e:t;i.push(oa.fromDateTimes(o,s)),o=s,n+=1}return i}splitBy(t){const e=ea.fromDurationLike(t);if(!this.isValid||!e.isValid||0===e.as("milliseconds"))return[];let i,{s:o}=this,n=1;const s=[];for(;o<this.e;){const t=this.start.plus(e.mapUnits((t=>t*n)));i=+t>+this.e?this.e:t,s.push(oa.fromDateTimes(o,i)),o=i,n+=1}return s}divideEqually(t){return this.isValid?this.splitBy(this.length()/t).slice(0,t):[]}overlaps(t){return this.e>t.s&&this.s<t.e}abutsStart(t){return!!this.isValid&&+this.e==+t.s}abutsEnd(t){return!!this.isValid&&+t.e==+this.s}engulfs(t){return!!this.isValid&&(this.s<=t.s&&this.e>=t.e)}equals(t){return!(!this.isValid||!t.isValid)&&(this.s.equals(t.s)&&this.e.equals(t.e))}intersection(t){if(!this.isValid)return this;const e=this.s>t.s?this.s:t.s,i=this.e<t.e?this.e:t.e;return e>=i?null:oa.fromDateTimes(e,i)}union(t){if(!this.isValid)return this;const e=this.s<t.s?this.s:t.s,i=this.e>t.e?this.e:t.e;return oa.fromDateTimes(e,i)}static merge(t){const[e,i]=t.sort(((t,e)=>t.s-e.s)).reduce((([t,e],i)=>e?e.overlaps(i)||e.abutsStart(i)?[t,e.union(i)]:[t.concat([e]),i]:[t,i]),[[],null]);return i&&e.push(i),e}static xor(t){let e=null,i=0;const o=[],n=t.map((t=>[{time:t.s,type:"s"},{time:t.e,type:"e"}])),s=Array.prototype.concat(...n).sort(((t,e)=>t.time-e.time));for(const t of s)i+="s"===t.type?1:-1,1===i?e=t.time:(e&&+e!=+t.time&&o.push(oa.fromDateTimes(e,t.time)),e=null);return oa.merge(o)}difference(...t){return oa.xor([this].concat(t)).map((t=>this.intersection(t))).filter((t=>t&&!t.isEmpty()))}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:ia}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(t=Wo,e={}){return this.isValid?ir.create(this.s.loc.clone(e),t).formatInterval(this):ia}toISO(t){return this.isValid?`${this.s.toISO(t)}/${this.e.toISO(t)}`:ia}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:ia}toISOTime(t){return this.isValid?`${this.s.toISOTime(t)}/${this.e.toISOTime(t)}`:ia}toFormat(t,{separator:e=" – "}={}){return this.isValid?`${this.s.toFormat(t)}${e}${this.e.toFormat(t)}`:ia}toDuration(t,e){return this.isValid?this.e.diff(this.s,t,e):ea.invalid(this.invalidReason)}mapEndpoints(t){return oa.fromDateTimes(t(this.s),t(this.e))}}class na{static hasDST(t=Qn.defaultZone){const e=Za.now().setZone(t).set({month:12});return!t.isUniversal&&e.offset!==e.set({month:6}).offset}static isValidIANAZone(t){return _n.isValidZone(t)}static normalizeZone(t){return Nn(t,Qn.defaultZone)}static getStartOfWeek({locale:t=null,locObj:e=null}={}){return(e||Ln.create(t)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:t=null,locObj:e=null}={}){return(e||Ln.create(t)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:t=null,locObj:e=null}={}){return(e||Ln.create(t)).getWeekendDays().slice()}static months(t="long",{locale:e=null,numberingSystem:i=null,locObj:o=null,outputCalendar:n="gregory"}={}){return(o||Ln.create(e,i,n)).months(t)}static monthsFormat(t="long",{locale:e=null,numberingSystem:i=null,locObj:o=null,outputCalendar:n="gregory"}={}){return(o||Ln.create(e,i,n)).months(t,!0)}static weekdays(t="long",{locale:e=null,numberingSystem:i=null,locObj:o=null}={}){return(o||Ln.create(e,i,null)).weekdays(t)}static weekdaysFormat(t="long",{locale:e=null,numberingSystem:i=null,locObj:o=null}={}){return(o||Ln.create(e,i,null)).weekdays(t,!0)}static meridiems({locale:t=null}={}){return Ln.create(t).meridiems()}static eras(t="short",{locale:e=null}={}){return Ln.create(e,null,"gregory").eras(t)}static features(){return{relative:vs(),localeWeek:ys()}}}function sa(t,e){const i=t=>t.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),o=i(e)-i(t);return Math.floor(ea.fromMillis(o).as("days"))}function ra(t,e,i,o){let[n,s,r,a]=function(t,e,i){const o=[["years",(t,e)=>e.year-t.year],["quarters",(t,e)=>e.quarter-t.quarter+4*(e.year-t.year)],["months",(t,e)=>e.month-t.month+12*(e.year-t.year)],["weeks",(t,e)=>{const i=sa(t,e);return(i-i%7)/7}],["days",sa]],n={},s=t;let r,a;for(const[l,d]of o)i.indexOf(l)>=0&&(r=l,n[l]=d(t,e),a=s.plus(n),a>e?(n[l]--,(t=s.plus(n))>e&&(a=t,n[l]--,t=s.plus(n))):t=a);return[t,n,a,r]}(t,e,i);const l=e-n,d=i.filter((t=>["hours","minutes","seconds","milliseconds"].indexOf(t)>=0));0===d.length&&(r<e&&(r=n.plus({[a]:1})),r!==n&&(s[a]=(s[a]||0)+l/(r-n)));const c=ea.fromObject(s,o);return d.length>0?ea.fromMillis(l,o).shiftTo(...d).plus(c):c}function aa(t,e=(t=>t)){return{regex:t,deser:([t])=>e(function(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let i=0;i<t.length;i++){const o=t.charCodeAt(i);if(-1!==t[i].search(Bn.hanidec))e+=qn.indexOf(t[i]);else for(const t in Fn){const[i,n]=Fn[t];o>=i&&o<=n&&(e+=o-i)}}return parseInt(e,10)}return e}(t))}}const la=`[ ${String.fromCharCode(160)}]`,da=new RegExp(la,"g");function ca(t){return t.replace(/\./g,"\\.?").replace(da,la)}function ha(t){return t.replace(/\./g,"").replace(da," ").toLowerCase()}function ua(t,e){return null===t?null:{regex:RegExp(t.map(ca).join("|")),deser:([i])=>t.findIndex((t=>ha(i)===ha(t)))+e}}function pa(t,e){return{regex:t,deser:([,t,e])=>Ps(t,e),groups:e}}function ma(t){return{regex:t,deser:([t])=>t}}const ga={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};let fa=null;function va(t,e){return Array.prototype.concat(...t.map((t=>function(t,e){if(t.literal)return t;const i=xa(ir.macroTokenToFormatOpts(t.val),e);return null==i||i.includes(void 0)?t:i}(t,e))))}class ya{constructor(t,e){if(this.locale=t,this.format=e,this.tokens=va(ir.parseFormat(e),t),this.units=this.tokens.map((e=>function(t,e){const i=jn(e),o=jn(e,"{2}"),n=jn(e,"{3}"),s=jn(e,"{4}"),r=jn(e,"{6}"),a=jn(e,"{1,2}"),l=jn(e,"{1,3}"),d=jn(e,"{1,6}"),c=jn(e,"{1,9}"),h=jn(e,"{2,4}"),u=jn(e,"{4,6}"),p=t=>{return{regex:RegExp((e=t.val,e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([t])=>t,literal:!0};var e},m=(m=>{if(t.literal)return p(m);switch(m.val){case"G":return ua(e.eras("short"),0);case"GG":return ua(e.eras("long"),0);case"y":return aa(d);case"yy":case"kk":return aa(h,Ls);case"yyyy":case"kkkk":return aa(s);case"yyyyy":return aa(u);case"yyyyyy":return aa(r);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return aa(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return aa(o);case"MMM":return ua(e.months("short",!0),1);case"MMMM":return ua(e.months("long",!0),1);case"LLL":return ua(e.months("short",!1),1);case"LLLL":return ua(e.months("long",!1),1);case"o":case"S":return aa(l);case"ooo":case"SSS":return aa(n);case"u":return ma(c);case"uu":return ma(a);case"uuu":case"E":case"c":return aa(i);case"a":return ua(e.meridiems(),0);case"EEE":return ua(e.weekdays("short",!1),1);case"EEEE":return ua(e.weekdays("long",!1),1);case"ccc":return ua(e.weekdays("short",!0),1);case"cccc":return ua(e.weekdays("long",!0),1);case"Z":case"ZZ":return pa(new RegExp(`([+-]${a.source})(?::(${o.source}))?`),2);case"ZZZ":return pa(new RegExp(`([+-]${a.source})(${o.source})?`),2);case"z":return ma(/[a-z_+-/]{1,256}?/i);case" ":return ma(/[^\S\n\r]/);default:return p(m)}})(t)||{invalidReason:"missing Intl.DateTimeFormat.formatToParts support"};return m.token=t,m}(e,t))),this.disqualifyingUnit=this.units.find((t=>t.invalidReason)),!this.disqualifyingUnit){const[t,e]=function(t){const e=t.map((t=>t.regex)).reduce(((t,e)=>`${t}(${e.source})`),"");return[`^${e}$`,t]}(this.units);this.regex=RegExp(t,"i"),this.handlers=e}}explainFromTokens(t){if(this.isValid){const[e,i]=function(t,e,i){const o=t.match(e);if(o){const t={};let e=1;for(const n in i)if(xs(i,n)){const s=i[n],r=s.groups?s.groups+1:1;!s.literal&&s.token&&(t[s.token.val[0]]=s.deser(o.slice(e,e+r))),e+=r}return[o,t]}return[o,{}]}(t,this.regex,this.handlers),[o,n,s]=i?function(t){let e,i=null;ms(t.z)||(i=_n.create(t.z)),ms(t.Z)||(i||(i=new Pn(t.Z)),e=t.Z),ms(t.q)||(t.M=3*(t.q-1)+1),ms(t.h)||(t.h<12&&1===t.a?t.h+=12:12===t.h&&0===t.a&&(t.h=0)),0===t.G&&t.y&&(t.y=-t.y),ms(t.u)||(t.S=As(t.u));const o=Object.keys(t).reduce(((e,i)=>{const o=(t=>{switch(t){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}})(i);return o&&(e[o]=t[i]),e}),{});return[o,i,e]}(i):[null,null,void 0];if(xs(i,"a")&&xs(i,"H"))throw new Bo("Can't include meridiem when specifying 24-hour format");return{input:t,tokens:this.tokens,regex:this.regex,rawMatches:e,matches:i,result:o,zone:n,specificOffset:s}}return{input:t,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function ba(t,e,i){return new ya(t,i).explainFromTokens(e)}function xa(t,e){if(!t)return null;const i=ir.create(e,t).dtFormatter((fa||(fa=Za.fromMillis(1555555555555)),fa)),o=i.formatToParts(),n=i.resolvedOptions();return o.map((e=>function(t,e,i){const{type:o,value:n}=t;if("literal"===o){const t=/^\s+$/.test(n);return{literal:!t,val:t?" ":n}}const s=e[o];let r=o;"hour"===o&&(r=null!=e.hour12?e.hour12?"hour12":"hour24":null!=e.hourCycle?"h11"===e.hourCycle||"h12"===e.hourCycle?"hour12":"hour24":i.hour12?"hour12":"hour24");let a=ga[r];if("object"==typeof a&&(a=a[s]),a)return{literal:!1,val:a}}(e,t,n)))}const _a="Invalid DateTime",wa=864e13;function ka(t){return new Jn("unsupported zone",`the zone "${t.name}" is not supported`)}function Ca(t){return null===t.weekData&&(t.weekData=as(t.c)),t.weekData}function Sa(t){return null===t.localWeekData&&(t.localWeekData=as(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function Aa(t,e){const i={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new Za({...i,...e,old:i})}function Ea(t,e,i){let o=t-60*e*1e3;const n=i.offset(o);if(e===n)return[o,e];o-=60*(n-e)*1e3;const s=i.offset(o);return n===s?[o,n]:[t-60*Math.min(n,s)*1e3,Math.max(n,s)]}function $a(t,e){const i=new Date(t+=60*e*1e3);return{year:i.getUTCFullYear(),month:i.getUTCMonth()+1,day:i.getUTCDate(),hour:i.getUTCHours(),minute:i.getUTCMinutes(),second:i.getUTCSeconds(),millisecond:i.getUTCMilliseconds()}}function Ta(t,e,i){return Ea(Ms(t),e,i)}function Da(t,e){const i=t.o,o=t.c.year+Math.trunc(e.years),n=t.c.month+Math.trunc(e.months)+3*Math.trunc(e.quarters),s={...t.c,year:o,month:n,day:Math.min(t.c.day,Ds(o,n))+Math.trunc(e.days)+7*Math.trunc(e.weeks)},r=ea.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=Ms(s);let[l,d]=Ea(a,i,t.zone);return 0!==r&&(l+=r,d=t.zone.offset(l)),{ts:l,o:d}}function Ma(t,e,i,o,n,s){const{setZone:r,zone:a}=i;if(t&&0!==Object.keys(t).length||e){const o=e||a,n=Za.fromObject(t,{...i,zone:o,specificOffset:s});return r?n:n.setZone(a)}return Za.invalid(new Jn("unparsable",`the input "${n}" can't be parsed as ${o}`))}function Ia(t,e,i=!0){return t.isValid?ir.create(Ln.create("en-US"),{allowZ:i,forceSimple:!0}).formatDateTimeFromString(t,e):null}function Oa(t,e){const i=t.c.year>9999||t.c.year<0;let o="";return i&&t.c.year>=0&&(o+="+"),o+=ks(t.c.year,i?6:4),e?(o+="-",o+=ks(t.c.month),o+="-",o+=ks(t.c.day)):(o+=ks(t.c.month),o+=ks(t.c.day)),o}function La(t,e,i,o,n,s){let r=ks(t.c.hour);return e?(r+=":",r+=ks(t.c.minute),0===t.c.millisecond&&0===t.c.second&&i||(r+=":")):r+=ks(t.c.minute),0===t.c.millisecond&&0===t.c.second&&i||(r+=ks(t.c.second),0===t.c.millisecond&&o||(r+=".",r+=ks(t.c.millisecond,3))),n&&(t.isOffsetFixed&&0===t.offset&&!s?r+="Z":t.o<0?(r+="-",r+=ks(Math.trunc(-t.o/60)),r+=":",r+=ks(Math.trunc(-t.o%60))):(r+="+",r+=ks(Math.trunc(t.o/60)),r+=":",r+=ks(Math.trunc(t.o%60)))),s&&(r+="["+t.zone.ianaName+"]"),r}const za={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Pa={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Ra={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Na=["year","month","day","hour","minute","second","millisecond"],Ba=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Fa=["year","ordinal","hour","minute","second","millisecond"];function qa(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return function(t){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new Fo(t);return e}(t)}}function Ua(t,e){const i=Nn(e.zone,Qn.defaultZone);if(!i.isValid)return Za.invalid(ka(i));const o=Ln.fromObject(e);let n,s;if(ms(t.year))n=Qn.now();else{for(const e of Na)ms(t[e])&&(t[e]=za[e]);const e=us(t)||ps(t);if(e)return Za.invalid(e);const o=function(t){return Wa[t]||(void 0===Ha&&(Ha=Qn.now()),Wa[t]=t.offset(Ha)),Wa[t]}(i);[n,s]=Ta(t,o,i)}return new Za({ts:n,zone:i,loc:o,o:s})}function ja(t,e,i){const o=!!ms(i.round)||i.round,n=(t,n)=>{t=Es(t,o||i.calendary?0:2,!0);return e.loc.clone(i).relFormatter(i).format(t,n)},s=o=>i.calendary?e.hasSame(t,o)?0:e.startOf(o).diff(t.startOf(o),o).get(o):e.diff(t,o).get(o);if(i.unit)return n(s(i.unit),i.unit);for(const t of i.units){const e=s(t);if(Math.abs(e)>=1)return n(e,t)}return n(t>e?-0:0,i.units[i.units.length-1])}function Va(t){let e,i={};return t.length>0&&"object"==typeof t[t.length-1]?(i=t[t.length-1],e=Array.from(t).slice(0,t.length-1)):e=Array.from(t),[i,e]}let Ha,Wa={};class Za{constructor(t){const e=t.zone||Qn.defaultZone;let i=t.invalid||(Number.isNaN(t.ts)?new Jn("invalid input"):null)||(e.isValid?null:ka(e));this.ts=ms(t.ts)?Qn.now():t.ts;let o=null,n=null;if(!i){if(t.old&&t.old.ts===this.ts&&t.old.zone.equals(e))[o,n]=[t.old.c,t.old.o];else{const s=gs(t.o)&&!t.old?t.o:e.offset(this.ts);o=$a(this.ts,s),i=Number.isNaN(o.year)?new Jn("invalid input"):null,o=i?null:o,n=i?null:s}}this._zone=e,this.loc=t.loc||Ln.create(),this.invalid=i,this.weekData=null,this.localWeekData=null,this.c=o,this.o=n,this.isLuxonDateTime=!0}static now(){return new Za({})}static local(){const[t,e]=Va(arguments),[i,o,n,s,r,a,l]=e;return Ua({year:i,month:o,day:n,hour:s,minute:r,second:a,millisecond:l},t)}static utc(){const[t,e]=Va(arguments),[i,o,n,s,r,a,l]=e;return t.zone=Pn.utcInstance,Ua({year:i,month:o,day:n,hour:s,minute:r,second:a,millisecond:l},t)}static fromJSDate(t,e={}){const i=function(t){return"[object Date]"===Object.prototype.toString.call(t)}(t)?t.valueOf():NaN;if(Number.isNaN(i))return Za.invalid("invalid input");const o=Nn(e.zone,Qn.defaultZone);return o.isValid?new Za({ts:i,zone:o,loc:Ln.fromObject(e)}):Za.invalid(ka(o))}static fromMillis(t,e={}){if(gs(t))return t<-wa||t>wa?Za.invalid("Timestamp out of range"):new Za({ts:t,zone:Nn(e.zone,Qn.defaultZone),loc:Ln.fromObject(e)});throw new qo(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`)}static fromSeconds(t,e={}){if(gs(t))return new Za({ts:1e3*t,zone:Nn(e.zone,Qn.defaultZone),loc:Ln.fromObject(e)});throw new qo("fromSeconds requires a numerical input")}static fromObject(t,e={}){t=t||{};const i=Nn(e.zone,Qn.defaultZone);if(!i.isValid)return Za.invalid(ka(i));const o=Ln.fromObject(e),n=Ns(t,qa),{minDaysInFirstWeek:s,startOfWeek:r}=hs(n,o),a=Qn.now(),l=ms(e.specificOffset)?i.offset(a):e.specificOffset,d=!ms(n.ordinal),c=!ms(n.year),h=!ms(n.month)||!ms(n.day),u=c||h,p=n.weekYear||n.weekNumber;if((u||d)&&p)throw new Bo("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(h&&d)throw new Bo("Can't mix ordinal dates with month/day");const m=p||n.weekday&&!u;let g,f,v=$a(a,l);m?(g=Ba,f=Pa,v=as(v,s,r)):d?(g=Fa,f=Ra,v=ds(v)):(g=Na,f=za);let y=!1;for(const t of g){ms(n[t])?n[t]=y?f[t]:v[t]:y=!0}const b=m?function(t,e=4,i=1){const o=fs(t.weekYear),n=ws(t.weekNumber,1,Os(t.weekYear,e,i)),s=ws(t.weekday,1,7);return o?n?!s&&is("weekday",t.weekday):is("week",t.weekNumber):is("weekYear",t.weekYear)}(n,s,r):d?function(t){const e=fs(t.year),i=ws(t.ordinal,1,Ts(t.year));return e?!i&&is("ordinal",t.ordinal):is("year",t.year)}(n):us(n),x=b||ps(n);if(x)return Za.invalid(x);const _=m?ls(n,s,r):d?cs(n):n,[w,k]=Ta(_,l,i),C=new Za({ts:w,zone:i,o:k,loc:o});return n.weekday&&u&&t.weekday!==C.weekday?Za.invalid("mismatched weekday",`you can't specify both a weekday of ${n.weekday} and a date of ${C.toISO()}`):C.isValid?C:Za.invalid(C.invalid)}static fromISO(t,e={}){const[i,o]=function(t){return rr(t,[Ir,Pr],[Or,Rr],[Lr,Nr],[zr,Br])}(t);return Ma(i,o,e,"ISO 8601",t)}static fromRFC2822(t,e={}){const[i,o]=function(t){return rr(function(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(t),[Sr,Ar])}(t);return Ma(i,o,e,"RFC 2822",t)}static fromHTTP(t,e={}){const[i,o]=function(t){return rr(t,[Er,Dr],[$r,Dr],[Tr,Mr])}(t);return Ma(i,o,e,"HTTP",e)}static fromFormat(t,e,i={}){if(ms(t)||ms(e))throw new qo("fromFormat requires an input string and a format");const{locale:o=null,numberingSystem:n=null}=i,s=Ln.fromOpts({locale:o,numberingSystem:n,defaultToEN:!0}),[r,a,l,d]=function(t,e,i){const{result:o,zone:n,specificOffset:s,invalidReason:r}=ba(t,e,i);return[o,n,s,r]}(s,t,e);return d?Za.invalid(d):Ma(r,a,i,`format ${e}`,t,l)}static fromString(t,e,i={}){return Za.fromFormat(t,e,i)}static fromSQL(t,e={}){const[i,o]=function(t){return rr(t,[qr,Pr],[Ur,jr])}(t);return Ma(i,o,e,"SQL",t)}static invalid(t,e=null){if(!t)throw new qo("need to specify a reason the DateTime is invalid");const i=t instanceof Jn?t:new Jn(t,e);if(Qn.throwOnInvalid)throw new Po(i);return new Za({invalid:i})}static isDateTime(t){return t&&t.isLuxonDateTime||!1}static parseFormatForOpts(t,e={}){const i=xa(t,Ln.fromObject(e));return i?i.map((t=>t?t.val:null)).join(""):null}static expandFormat(t,e={}){return va(ir.parseFormat(t),Ln.fromObject(e)).map((t=>t.val)).join("")}static resetCache(){Ha=void 0,Wa={}}get(t){return this[t]}get isValid(){return null===this.invalid}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Ca(this).weekYear:NaN}get weekNumber(){return this.isValid?Ca(this).weekNumber:NaN}get weekday(){return this.isValid?Ca(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Sa(this).weekday:NaN}get localWeekNumber(){return this.isValid?Sa(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Sa(this).weekYear:NaN}get ordinal(){return this.isValid?ds(this.c).ordinal:NaN}get monthShort(){return this.isValid?na.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?na.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?na.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?na.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return!this.isOffsetFixed&&(this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset)}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const t=864e5,e=6e4,i=Ms(this.c),o=this.zone.offset(i-t),n=this.zone.offset(i+t),s=this.zone.offset(i-o*e),r=this.zone.offset(i-n*e);if(s===r)return[this];const a=i-s*e,l=i-r*e,d=$a(a,s),c=$a(l,r);return d.hour===c.hour&&d.minute===c.minute&&d.second===c.second&&d.millisecond===c.millisecond?[Aa(this,{ts:a}),Aa(this,{ts:l})]:[this]}get isInLeapYear(){return $s(this.year)}get daysInMonth(){return Ds(this.year,this.month)}get daysInYear(){return this.isValid?Ts(this.year):NaN}get weeksInWeekYear(){return this.isValid?Os(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Os(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(t={}){const{locale:e,numberingSystem:i,calendar:o}=ir.create(this.loc.clone(t),t).resolvedOptions(this);return{locale:e,numberingSystem:i,outputCalendar:o}}toUTC(t=0,e={}){return this.setZone(Pn.instance(t),e)}toLocal(){return this.setZone(Qn.defaultZone)}setZone(t,{keepLocalTime:e=!1,keepCalendarTime:i=!1}={}){if((t=Nn(t,Qn.defaultZone)).equals(this.zone))return this;if(t.isValid){let o=this.ts;if(e||i){const e=t.offset(this.ts),i=this.toObject();[o]=Ta(i,e,t)}return Aa(this,{ts:o,zone:t})}return Za.invalid(ka(t))}reconfigure({locale:t,numberingSystem:e,outputCalendar:i}={}){return Aa(this,{loc:this.loc.clone({locale:t,numberingSystem:e,outputCalendar:i})})}setLocale(t){return this.reconfigure({locale:t})}set(t){if(!this.isValid)return this;const e=Ns(t,qa),{minDaysInFirstWeek:i,startOfWeek:o}=hs(e,this.loc),n=!ms(e.weekYear)||!ms(e.weekNumber)||!ms(e.weekday),s=!ms(e.ordinal),r=!ms(e.year),a=!ms(e.month)||!ms(e.day),l=r||a,d=e.weekYear||e.weekNumber;if((l||s)&&d)throw new Bo("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&s)throw new Bo("Can't mix ordinal dates with month/day");let c;n?c=ls({...as(this.c,i,o),...e},i,o):ms(e.ordinal)?(c={...this.toObject(),...e},ms(e.day)&&(c.day=Math.min(Ds(c.year,c.month),c.day))):c=cs({...ds(this.c),...e});const[h,u]=Ta(c,this.o,this.zone);return Aa(this,{ts:h,o:u})}plus(t){if(!this.isValid)return this;return Aa(this,Da(this,ea.fromDurationLike(t)))}minus(t){if(!this.isValid)return this;return Aa(this,Da(this,ea.fromDurationLike(t).negate()))}startOf(t,{useLocaleWeeks:e=!1}={}){if(!this.isValid)return this;const i={},o=ea.normalizeUnit(t);switch(o){case"years":i.month=1;case"quarters":case"months":i.day=1;case"weeks":case"days":i.hour=0;case"hours":i.minute=0;case"minutes":i.second=0;case"seconds":i.millisecond=0}if("weeks"===o)if(e){const t=this.loc.getStartOfWeek(),{weekday:e}=this;e<t&&(i.weekNumber=this.weekNumber-1),i.weekday=t}else i.weekday=1;if("quarters"===o){const t=Math.ceil(this.month/3);i.month=3*(t-1)+1}return this.set(i)}endOf(t,e){return this.isValid?this.plus({[t]:1}).startOf(t,e).minus(1):this}toFormat(t,e={}){return this.isValid?ir.create(this.loc.redefaultToEN(e)).formatDateTimeFromString(this,t):_a}toLocaleString(t=Wo,e={}){return this.isValid?ir.create(this.loc.clone(e),t).formatDateTime(this):_a}toLocaleParts(t={}){return this.isValid?ir.create(this.loc.clone(t),t).formatDateTimeParts(this):[]}toISO({format:t="extended",suppressSeconds:e=!1,suppressMilliseconds:i=!1,includeOffset:o=!0,extendedZone:n=!1}={}){if(!this.isValid)return null;const s="extended"===t;let r=Oa(this,s);return r+="T",r+=La(this,s,e,i,o,n),r}toISODate({format:t="extended"}={}){return this.isValid?Oa(this,"extended"===t):null}toISOWeekDate(){return Ia(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:t=!1,suppressSeconds:e=!1,includeOffset:i=!0,includePrefix:o=!1,extendedZone:n=!1,format:s="extended"}={}){if(!this.isValid)return null;return(o?"T":"")+La(this,"extended"===s,e,t,i,n)}toRFC2822(){return Ia(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Ia(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Oa(this,!0):null}toSQLTime({includeOffset:t=!0,includeZone:e=!1,includeOffsetSpace:i=!0}={}){let o="HH:mm:ss.SSS";return(e||t)&&(i&&(o+=" "),e?o+="z":t&&(o+="ZZ")),Ia(this,o,!0)}toSQL(t={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(t)}`:null}toString(){return this.isValid?this.toISO():_a}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(t={}){if(!this.isValid)return{};const e={...this.c};return t.includeConfig&&(e.outputCalendar=this.outputCalendar,e.numberingSystem=this.loc.numberingSystem,e.locale=this.loc.locale),e}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(t,e="milliseconds",i={}){if(!this.isValid||!t.isValid)return ea.invalid("created by diffing an invalid DateTime");const o={locale:this.locale,numberingSystem:this.numberingSystem,...i},n=(a=e,Array.isArray(a)?a:[a]).map(ea.normalizeUnit),s=t.valueOf()>this.valueOf(),r=ra(s?this:t,s?t:this,n,o);var a;return s?r.negate():r}diffNow(t="milliseconds",e={}){return this.diff(Za.now(),t,e)}until(t){return this.isValid?oa.fromDateTimes(this,t):this}hasSame(t,e,i){if(!this.isValid)return!1;const o=t.valueOf(),n=this.setZone(t.zone,{keepLocalTime:!0});return n.startOf(e,i)<=o&&o<=n.endOf(e,i)}equals(t){return this.isValid&&t.isValid&&this.valueOf()===t.valueOf()&&this.zone.equals(t.zone)&&this.loc.equals(t.loc)}toRelative(t={}){if(!this.isValid)return null;const e=t.base||Za.fromObject({},{zone:this.zone}),i=t.padding?this<e?-t.padding:t.padding:0;let o=["years","months","days","hours","minutes","seconds"],n=t.unit;return Array.isArray(t.unit)&&(o=t.unit,n=void 0),ja(e,this.plus(i),{...t,numeric:"always",units:o,unit:n})}toRelativeCalendar(t={}){return this.isValid?ja(t.base||Za.fromObject({},{zone:this.zone}),this,{...t,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...t){if(!t.every(Za.isDateTime))throw new qo("min requires all arguments be DateTimes");return bs(t,(t=>t.valueOf()),Math.min)}static max(...t){if(!t.every(Za.isDateTime))throw new qo("max requires all arguments be DateTimes");return bs(t,(t=>t.valueOf()),Math.max)}static fromFormatExplain(t,e,i={}){const{locale:o=null,numberingSystem:n=null}=i;return ba(Ln.fromOpts({locale:o,numberingSystem:n,defaultToEN:!0}),t,e)}static fromStringExplain(t,e,i={}){return Za.fromFormatExplain(t,e,i)}static buildFormatParser(t,e={}){const{locale:i=null,numberingSystem:o=null}=e,n=Ln.fromOpts({locale:i,numberingSystem:o,defaultToEN:!0});return new ya(n,t)}static fromFormatParser(t,e,i={}){if(ms(t)||ms(e))throw new qo("fromFormatParser requires an input string and a format parser");const{locale:o=null,numberingSystem:n=null}=i,s=Ln.fromOpts({locale:o,numberingSystem:n,defaultToEN:!0});if(!s.equals(e.locale))throw new qo(`fromFormatParser called with a locale of ${s}, but the format parser was created for ${e.locale}`);const{result:r,zone:a,specificOffset:l,invalidReason:d}=e.explainFromTokens(t);return d?Za.invalid(d):Ma(r,a,i,`format ${e.format}`,t,l)}static get DATE_SHORT(){return Wo}static get DATE_MED(){return Zo}static get DATE_MED_WITH_WEEKDAY(){return Yo}static get DATE_FULL(){return Go}static get DATE_HUGE(){return Ko}static get TIME_SIMPLE(){return Xo}static get TIME_WITH_SECONDS(){return Qo}static get TIME_WITH_SHORT_OFFSET(){return Jo}static get TIME_WITH_LONG_OFFSET(){return tn}static get TIME_24_SIMPLE(){return en}static get TIME_24_WITH_SECONDS(){return on}static get TIME_24_WITH_SHORT_OFFSET(){return nn}static get TIME_24_WITH_LONG_OFFSET(){return sn}static get DATETIME_SHORT(){return rn}static get DATETIME_SHORT_WITH_SECONDS(){return an}static get DATETIME_MED(){return ln}static get DATETIME_MED_WITH_SECONDS(){return dn}static get DATETIME_MED_WITH_WEEKDAY(){return cn}static get DATETIME_FULL(){return hn}static get DATETIME_FULL_WITH_SECONDS(){return un}static get DATETIME_HUGE(){return pn}static get DATETIME_HUGE_WITH_SECONDS(){return mn}}function Ya(t){if(Za.isDateTime(t))return t;if(t&&t.valueOf&&gs(t.valueOf()))return Za.fromJSDate(t);if(t&&"object"==typeof t)return Za.fromObject(t);throw new qo(`Unknown datetime argument: ${t}, of type ${typeof t}`)}
521
521
  /**
522
522
  * @license
523
523
  * Copyright 2021 Google LLC
@@ -555,7 +555,7 @@ const Ja="",tl="h",el="s";function il(t,e){return(e?tl:el)+function(t){let e=0,
555
555
  * Copyright 2020 Google LLC
556
556
  * SPDX-License-Identifier: BSD-3-Clause
557
557
  */
558
- let vl=Ka,bl=!1;const yl=["es","fr","pt"],xl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAYAAADL1t+KAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACHDwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKL2lDQ1BJQ0MgUHJvZmlsZQAASMedlndUVNcWh8+9d3qhzTDSGXqTLjCA9C4gHQRRGGYGGMoAwwxNbIioQEQREQFFkKCAAaOhSKyIYiEoqGAPSBBQYjCKqKhkRtZKfHl57+Xl98e939pn73P32XuftS4AJE8fLi8FlgIgmSfgB3o401eFR9Cx/QAGeIABpgAwWempvkHuwUAkLzcXerrICfyL3gwBSPy+ZejpT6eD/0/SrFS+AADIX8TmbE46S8T5Ik7KFKSK7TMipsYkihlGiZkvSlDEcmKOW+Sln30W2VHM7GQeW8TinFPZyWwx94h4e4aQI2LER8QFGVxOpohvi1gzSZjMFfFbcWwyh5kOAIoktgs4rHgRm4iYxA8OdBHxcgBwpLgvOOYLFnCyBOJDuaSkZvO5cfECui5Lj25qbc2ge3IykzgCgaE/k5XI5LPpLinJqUxeNgCLZ/4sGXFt6aIiW5paW1oamhmZflGo/7r4NyXu7SK9CvjcM4jW94ftr/xS6gBgzIpqs+sPW8x+ADq2AiB3/w+b5iEAJEV9a7/xxXlo4nmJFwhSbYyNMzMzjbgclpG4oL/rfzr8DX3xPSPxdr+Xh+7KiWUKkwR0cd1YKUkpQj49PZXJ4tAN/zzE/zjwr/NYGsiJ5fA5PFFEqGjKuLw4Ubt5bK6Am8Kjc3n/qYn/MOxPWpxrkSj1nwA1yghI3aAC5Oc+gKIQARJ5UNz13/vmgw8F4psXpjqxOPefBf37rnCJ+JHOjfsc5xIYTGcJ+RmLa+JrCdCAACQBFcgDFaABdIEhMANWwBY4AjewAviBYBAO1gIWiAfJgA8yQS7YDApAEdgF9oJKUAPqQSNoASdABzgNLoDL4Dq4Ce6AB2AEjIPnYAa8AfMQBGEhMkSB5CFVSAsygMwgBmQPuUE+UCAUDkVDcRAPEkK50BaoCCqFKqFaqBH6FjoFXYCuQgPQPWgUmoJ+hd7DCEyCqbAyrA0bwwzYCfaGg+E1cBycBufA+fBOuAKug4/B7fAF+Dp8Bx6Bn8OzCECICA1RQwwRBuKC+CERSCzCRzYghUg5Uoe0IF1IL3ILGUGmkXcoDIqCoqMMUbYoT1QIioVKQ21AFaMqUUdR7age1C3UKGoG9QlNRiuhDdA2aC/0KnQcOhNdgC5HN6Db0JfQd9Dj6DcYDIaG0cFYYTwx4ZgEzDpMMeYAphVzHjOAGcPMYrFYeawB1g7rh2ViBdgC7H7sMew57CB2HPsWR8Sp4sxw7rgIHA+XhyvHNeHO4gZxE7h5vBReC2+D98Oz8dn4Enw9vgt/Az+OnydIE3QIdoRgQgJhM6GC0EK4RHhIeEUkEtWJ1sQAIpe4iVhBPE68QhwlviPJkPRJLqRIkpC0k3SEdJ50j/SKTCZrkx3JEWQBeSe5kXyR/Jj8VoIiYSThJcGW2ChRJdEuMSjxQhIvqSXpJLlWMkeyXPKk5A3JaSm8lLaUixRTaoNUldQpqWGpWWmKtKm0n3SydLF0k/RV6UkZrIy2jJsMWyZf5rDMRZkxCkLRoLhQWJQtlHrKJco4FUPVoXpRE6hF1G+o/dQZWRnZZbKhslmyVbJnZEdoCE2b5kVLopXQTtCGaO+XKC9xWsJZsmNJy5LBJXNyinKOchy5QrlWuTty7+Xp8m7yifK75TvkHymgFPQVAhQyFQ4qXFKYVqQq2iqyFAsVTyjeV4KV9JUCldYpHVbqU5pVVlH2UE5V3q98UXlahabiqJKgUqZyVmVKlaJqr8pVLVM9p/qMLkt3oifRK+g99Bk1JTVPNaFarVq/2ry6jnqIep56q/ojDYIGQyNWo0yjW2NGU1XTVzNXs1nzvhZei6EVr7VPq1drTltHO0x7m3aH9qSOnI6XTo5Os85DXbKug26abp3ubT2MHkMvUe+A3k19WN9CP16/Sv+GAWxgacA1OGAwsBS91Hopb2nd0mFDkqGTYYZhs+GoEc3IxyjPqMPohbGmcYTxbuNe408mFiZJJvUmD0xlTFeY5pl2mf5qpm/GMqsyu21ONnc332jeaf5ymcEyzrKDy+5aUCx8LbZZdFt8tLSy5Fu2WE5ZaVpFW1VbDTOoDH9GMeOKNdra2Xqj9WnrdzaWNgKbEza/2BraJto22U4u11nOWV6/fMxO3Y5pV2s3Yk+3j7Y/ZD/ioObAdKhzeOKo4ch2bHCccNJzSnA65vTC2cSZ79zmPOdi47Le5bwr4urhWuja7ybjFuJW6fbYXd09zr3ZfcbDwmOdx3lPtKe3527PYS9lL5ZXo9fMCqsV61f0eJO8g7wrvZ/46Pvwfbp8Yd8Vvnt8H67UWslb2eEH/Lz89vg98tfxT/P/PgAT4B9QFfA00DQwN7A3iBIUFdQU9CbYObgk+EGIbogwpDtUMjQytDF0Lsw1rDRsZJXxqvWrrocrhHPDOyOwEaERDRGzq91W7109HmkRWRA5tEZnTdaaq2sV1iatPRMlGcWMOhmNjg6Lbor+wPRj1jFnY7xiqmNmWC6sfaznbEd2GXuKY8cp5UzE2sWWxk7G2cXtiZuKd4gvj5/munAruS8TPBNqEuYS/RKPJC4khSW1JuOSo5NP8WR4ibyeFJWUrJSBVIPUgtSRNJu0vWkzfG9+QzqUvia9U0AV/Uz1CXWFW4WjGfYZVRlvM0MzT2ZJZ/Gy+rL1s3dkT+S453y9DrWOta47Vy13c+7oeqf1tRugDTEbujdqbMzfOL7JY9PRzYTNiZt/yDPJK817vSVsS1e+cv6m/LGtHlubCyQK+AXD22y31WxHbedu799hvmP/jk+F7MJrRSZF5UUfilnF174y/ariq4WdsTv7SyxLDu7C7OLtGtrtsPtoqXRpTunYHt897WX0ssKy13uj9l4tX1Zes4+wT7hvpMKnonO/5v5d+z9UxlfeqXKuaq1Wqt5RPXeAfWDwoOPBlhrlmqKa94e4h+7WetS212nXlR/GHM44/LQ+tL73a8bXjQ0KDUUNH4/wjowcDTza02jV2Nik1FTSDDcLm6eORR67+Y3rN50thi21rbTWouPguPD4s2+jvx064X2i+yTjZMt3Wt9Vt1HaCtuh9uz2mY74jpHO8M6BUytOdXfZdrV9b/T9kdNqp6vOyJ4pOUs4m3924VzOudnzqeenL8RdGOuO6n5wcdXF2z0BPf2XvC9duex++WKvU++5K3ZXTl+1uXrqGuNax3XL6+19Fn1tP1j80NZv2d9+w+pG503rm10DywfODjoMXrjleuvyba/b1++svDMwFDJ0dzhyeOQu++7kvaR7L+9n3J9/sOkh+mHhI6lH5Y+VHtf9qPdj64jlyJlR19G+J0FPHoyxxp7/lP7Th/H8p+Sn5ROqE42TZpOnp9ynbj5b/Wz8eerz+emCn6V/rn6h++K7Xxx/6ZtZNTP+kv9y4dfiV/Kvjrxe9rp71n/28ZvkN/NzhW/l3x59x3jX+z7s/cR85gfsh4qPeh+7Pnl/eriQvLDwG/eE8/s3BCkeAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAIXRFWHRDcmVhdGlvbiBUaW1lADIwMjI6MDg6MTEgMDE6MjY6MTB2N148AAAbLUlEQVR4Xu3dC7RddX3g8f8lLyCQlBAeAgJxWlbAKlMWrUCV1IoOaHFcUysya8YWZkpBIgW0dRzn6VotzlTBKWkt2EGWUx8I+EB5g0OqlqACgyhPTQLm/SIJeT/und//nJ14k9wk996cc+/Z//P5rPVb+5GFJhHzzX+fvffp6evrSwxsxqx5Y2NzYszrYk6OmRZzbMzUfjMpZny/GRfTEwPA3uX4bI3ZErOp2q6LWdFvlsTMi5kfMzfm5dkzp22LLQMQ9ErEe0ps3hRzeswbYn49ZnpMjjQAoy9H/7mYn8Q8HfNUzGMR+VWx7XpdG/QIeF5pnxfzlpg3x5waY2UNUC85Ys/GfC/muzEPReDzyr7rdE3QI+AHxeasmAtizo85IyafA6AcvTFPxNwXc2/MnAh8Ple8ooMeEc8r7nwZ/aKYP4g5PgaA7rEw5vaY22Ly5flio1dk0CPkJ8Tm0pg/isk3sgHAvJhbY26JsC9onClIMUGvLqnny+mXxbwzJt+hDgC7y3fK3xNzU8y9pazaax/0CPnBsflAzDUx+a50ABisfNf8DTFfiLDnx+dqq7ZBj5BPjM2VMdfGHJPPAcAwLY25PmZWhH1D40zN1C7o1Yo8X1b/WEx+9AwAWiU/8nZdzM11W7HXJugR8nzH+r+N+YuYfNMbALRLvmnu4zH/py6fsdci6BHz/Pz4Z2LyI2gAMFLmxFwdUX+sedi5OjroEfL8OtZPxeTHz7zFDYDRkEOZH3f7SIS9Y18z27FBj5i/LzZ/HeOGNwA6Qb5x7qqI+lebh52l44IeIc8Bvznm3Y0TANBZ7oq5LMKeA98xOiroEfP8QphbYqzKAehkOeaXRNTz++I7QkcEPUKeH0X7q5j8XLnPygGogxzQG2M+GmEf9UfcRj3oEfOTYnNHzJmNEwBQLz+KeW9E/aXm4egY1a8PjZi/IzaPx4g5AHWVG/Z41bRRM2pBj1/4h2OTX45/ZOMEANRXbtk9VdtGxYhfco9fbP4WtPw42hWNEwBQls/G5Mfb8re6jZgRDXrE/LDYfCXmXY0TAFCmu2PeH1Ff1zxsvxELesT8iNjk2/u9vhWAbpBfF3tBRP2V5mF7jUjQI+ZHx+aBmNMbJwCgOzwV846I+rLmYfu0PegR8+Nj81DM9MYJAOguz8WcF1Ff2Dxsj7YGvVqZz44RcwC6WY76jHau1Nv22Fr1mXm+zC7mAHS73MIHqja2RVuCHj/hfDd7vgHOZ+YA0JSbeG/VyJZredDjJzomNvnRNHezA8Cuchu/XLWypdqxQs8vqvecOQAM7Pdi8gvWWqqlQY+/ceRX3nkDHADs2werZrZMy+5yj5/Y22OTPzdv+WUEACjQ9pj84pkHm4cHpiVBj5ifHJv89XG+aAUABm9lzJkR9fnNw+E74EvuEfNDYnNnjJgDwNDkdt5ZtfSAtOIz9E/FnNHcBQCGKDf0r5q7w3dAl9zjbxT5Tr27YnoaJwCA4cgxvnD2zGn5W9qGZdhBj5gfG5v80vn8elcA4MDk18K+MaK+tHk4NAdyyf3mGDEHgNbITf1cc3fohhX0WJ2/PzYXNo8AgBa5sGrskA35knv8F+U78p6JsToHgNbLl95Pmz1zWn6kbdCGs0L/dIyYA0B75Mbm1g7JkFbosTo/Kzb/FOOudgBonxznc2KVPqd5uH+DDnrEPEc8/wf/VuMEANBOP4g5K6I+qFAP5ZL7v4kRcwAYGbm5ub2DMqgVeqzOD47NizEnNE4AACNhQcyvxSp9U/Nw7wa7Qv+TGDEHgJGV25sbvF/7XaHH6nxibH4ec0zjBAAwkvKb4/5ZrNLXNw8HNpgV+pUxYg4AoyM3OLd4n/a5Qq8+O58Xk9/bDgCMjiUx0/b1Wfr+Vuj57joxB4DRlVu8zzve97pCr547/2nMqY0TAMBoejbm9Xt7Ln1fK/R3xog5AHSG3OTc5gHtK+iXV1sAoDPstc0DXnKfMWtefu5tfsyYxgkAoBNsjzl59sxp+YUzu9jbCv3SGDEHgM6S23xJc3dXe6zQq5vh5sac3DgBAHSSfAX9dbvfHDfQCj1/RaqYA0Bnyo3Ord7FQEG/qNoCAJ3pfdV2p10uuc+YNS8H/uWY4xsnAIBOtDDmxNkzp/U2D/dcoZ8dI+YA0Nlyq3Ozd9o96BdUWwCgs+3SbEEHgHrapdk7P0OfMWtefvH7onyucQIA6GQ54MfNnjktfxPbLiv0t8eIOQDUQ252bndD/6C/udoCAPWws939g/7b1RYAqIed7W58hj5j1rwjYn9FzO43yQEAnSs/hz519sxpr+wIeH6FnJgDQL3kdjdeA7sj4qdXWwCgXhoN3xH0N1ZbAKBeGg0XdACot0bDe869ce742K6PGZtPAAC1sjXmsLxCPzFGzAGgnsbFnJiDPq1xCADU1ck56Cc39wGAmppmhQ4A9ddYoR/T3AcAaurYHPSpzX0AoKaOzEE/srkPANTUVCt0AKi/xgp9UnMfAKipSTno+U1xAEB9TchBn9DcBwBqarwVOgDUX2OFnt8BCwDU17gc9J7mPgBQUz056ABAzQk6ABRA0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUABBB4ACCDoAFEDQAaAAgg4ABRB0ACiAoANAAQQdAAog6ABQAEEHgAIIOgAUQNABoACCDgAFEHQAKICgA0ABBB0ACiDoAFAAQQeAAgg6ABRA0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUABBB4ACCDoAFEDQAaAAgg4ABRB0ACiAoANAAQQdAAog6ABQAEEHgAIIOgAUQNABoACCDgAFEHQAKICgA0ABBB0ACiDoAFAAQQeAAgg6ABRA0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUABBB4ACCDoAFEDQAaAAgg4ABRB0AChAz7k3zu2r9mGffuWQMemUoyek4yaNTYeMOygd1FP9AHSZ7b19ad2W3rRg9bb0/LLNaePW3upHYPQIOvs0YexB6YJTD4s5PE0/enx1Fthhe7T8iYUb07d/+mqa/fMNqa/PH6mMDkFnr952ymHpyt+eko6cOKY6A+zL3JVb0/WzV6SnF22qzsDIEXT2MG5MT/rIW6em86cfVp0BBqs3/kT9+zmvpC8+vro6AyPDTXHsIsf8k793rJjDMOV7Sy47+4j0obccWZ2BkSHo7OKjbzsqnfnag6sjYLjee/qkdNFvTK6OoP0EnZ3On354evspE6sj4ED9ydlT0ilHTaiOoL0EnYZDxx+UPvjmKdUR0Apj4k/Yq2e49M7IEHQaLnz94Wnywf51gFZ7/bET0hknHFIdQfv4E5yGd512eLUHtNo7/f+LESDopNdMGpdOOmJcdQS02lknHZJ6erxakfYSdNL0Y9y0A+10+ISD0vGTx1ZH0B6CTuPd7EB7HTfJVTDaS9BJE8f71wDa7dDxLrnTXv4kx7emwQgY4zN02kzQAaAAgg4ABRB0ACiAoANAAQQdAAog6ABQAEEHgAIIOgAUQNABoACCDgAFEHQAKICgA0ABes69cW5ftU+XuvycKeniMyZXR0A7fOL+5enhF9dVR790xgmHpD8++4jq6Jc2be1Ly9ZtS88u3Zwee2ljWrx2a/UjMDArdIBRNOngg9Jpx0zYY8444eB0/vTD0jUzjkxf+cAJ6Yb3vCa94biDq38K9iToADWQAz/rX70mXfs7U9P4Mb6KlT0JOkCN/MtfPzxdH6v1ieP98c2u/BsBUDNveM2E9JfvOiaNPchKnV8SdIAa+ufHH5wuedOeN9PRvQQdoKbe/xuT0/GTx1VHdDtBB6ipsfEnuEdO2UHQAWrsd3/tsDTWXe8EQQeosYnjexrPrYOgA9Tc644cX+3RzQQdoOamHDqm2qObCTpAzY3zGTpB0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUABBB4ACCDoAFEDQAaAAgg4ABRB0ACiAoANAAQQdAAog6ABQAEEHKNSxk8alOy45cY/56h++Nn3uouPTR946Nf3miYeknh5fv1oCQQcoVP6a9KMmjtljjjl8bDrlqPHpwtcfnj717mPT3190XDr1mAnVP0VdCTpAl/vVqePT3/z+cem8Uw6rzlBHgg5AGhM1+Pjbj0q/ddKh1RnqRtABaDioJ6WPvW1qmjheGurI/2oA7DTl0DHp90+fVB1RJ4IOwC7+xfTDqz3qRNAB2MUJk8emIyeOrY6oC0EHYA/50TbqRdAB2MP4/BA7tSLoAFAAQQeAAgg6ABRA0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUABBB4ACCDoAFEDQAaAAgg4ABRB0ACiAoANAAQQdAAog6ABQAEEHgAIIOgAUQNABoACCDgAFEHQAKICgA0ABBB0ACiDoAFAAQQeAAgg6ABRA0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUABBB4ACCDoAFEDQAaAAgg4ABRB0ACiAoANAAQQdAAog6ABQAEEHgAIIOgAUQNABoACCDgAFEHQAKICgA0ABBB0ACiDoAFAAQQeAAgg6ABRA0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUABBB4ACCDoAFEDQAaAAgg4ABRB0ACiAoANAAQQdAAog6ABQAEEHgAIIOgAUQNABoACCDgAFEHQAKICgA0ABBB0ACiDoAFAAQQeAAgg6ABRA0AGgAIIOAAUQdAAogKADQAEEHYA9bNneV+1RF4IOwB6WrN1a7VEXgg7ALhas2ZZWbdheHVEXgg7ALu5/7tVqjzoRdAB2emVjb7rzqbXVEXUi6AA09Pal9MmHl6f1W3qrM9SJoAOQtkfDr3toeZozf0N1hroRdIAu97MVW9KVdy5KDzy/rjpDHQk6QKHyo+T5bvXdZ8X67enFiPjdz6xLf/atpenf37YoPbt0c/VPUVc9594419sDutzl50xJF58xuToC2uET9y9PD7+45wr4d351Yvrv5x9dHQ3Pl55Yk276p1XVEd3KCh0ACiDoAFAAQQeAAgg6ABRA0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUABBB4ACCDoAFEDQAaAAgg4ABRB0gJrbmr/4nK4n6AA1t2rD9mqPbiboADU3d+WWao9uJugANbZ+S196Zunm6ohuJugANfadF9elbT5DJwg6QE1t603py0+sqY7odoIOUFNfenx1Wrhma3VEtxN0gBp6cuGmdOsPV1dHIOgAtfP04s3p43cvTdt7fXbOLwk6QI188yevpmu/sTit39JbnYEmQQeogScWbEozv7Y4Xf/IirTFXe0MQNABRtHaTb2N58h3nxzw+55bl26YvTK9/wsL0jWxKn960abqn4I99Zx741x/1etyl58zJV18xuTqCGiHT9y/PD384rrqCFrPCh0ACiDoAFAAQQeAAgg6ABRA0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUABBB4ACCDoAFEDQAUbA9j7fg0V7CTrACNiwRdBpL0EHGAGL1m6t9qA9BB2gzV7d3JsWrtlWHUF7CDpAm815aWPq8xk6bSboAG12zzOvVnvQPoIO0EY/XbI5PbFgY3UE7SPoAG2yvTelz8xeWR1Bewk6QJvc9Oiq9MLyzdURtJegA7TBHU+tTbc9uaY6gvYTdIAW6u1L6eZHX0k3fteldkaWoAO0yNyVW9NVX1+cvvj46uoMjBxBBzgA+ca3H/5iY/qv9y1Ll35lYXp60abqR2Bk9Zx741xvO+hyl58zJV18xuTqqJ4e+dn69MLyLdURtNf23r60bktvWrB6W3p+2ea0cWtUHUaZoFP7oN/6w9Xp1h+s9iYuoKu55E5t5Uudn3x4Rfr8Y6+IOdD1BJ1a2rC1L/35t5ake5/1Sk2ATNCpneXrt6eZdy5KP/qF12kC7CDo1Ep+LOiK2xeln69wAxxAf4JObTy+YFO6Mlbmy9f5XmmA3Qk6tXDfc+vSn9+1JG3Y4vEggIEIOh3vCz9a3bibfVt+pyYAAxJ0Otb26Pf//M6K9L/neCwNYH8EnY60cWtf+g/fXprufsZjaQCDIeh0nJXrt6cPfW1x+sFLG6ozAOyPoNNR5q/amq64Y1F6cfnm6gwAgyHodIwnFzYfS1v6qsfSAIZK0OkIDz6/Pn3kriVp3WaPpQEMh6Az6v7h8TXpLx5anrbl29oBGBZBZ9Tkfn/6kZXpc4+u8lgawAESdEZFfizt43cvTXf9ZG11BoADIeiMuFUbtqervr44PTrfY2kArSLojKiXXsmPpS1OLyzzWBpAKwk6I+apRZvSlRHzJWu3VmcAaBVBZ0R858X16cPfXJJe3by9OgNAKwk6bffFx9ekTzywPG31WBpA2wg6bZO/7fT6R1ammz2WBtB2gk5bbNrWl/7TPcvSNz2WBjAiBJ2WW72xN1399cXp+/PWV2cAaDdBp6V+sbr5bWnPLvVYGsBIEnRa5unFm9MH71icFq3xWBrASBN0WuKRn61P135jcVq7yWNpAKNB0DlgX3lyTfpv9y9PWzyWBjBqBJ1hy4+l/a9/XJk++32PpQGMNkFnWDZv60v/+d5l6Ws/9lgaQCcQdNJQ19ZrNvWmq7+xJH1vrsfSADqFoJPWRqAHa8GabemK2xelZ5Zsqs4A0AkEnfTEgo3V3r79dEl+LG1RWuixNICOI+ik55dtTv84d0N1NLD849d8Y0las9FjaQCdSNBp+MsHl6c5Lw28Uv/yE2vSf7l3Wdq8bfCX5gEYWT3n3jjX80bs9JsnHpLOPvnQdMQhY9KSV7elh19Yn362wmtcATqdoANAAVxyB4ACCDoAFEDQAaAAgg4ABRB0ACiAoANAAQQdAAog6ABQAEEHgAIIOgAUQNABoACCDgAFEHQAKICgA0ABBB0ACiDoAFAAQQeAAgg6ABRA0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUIAc9L7mLgBQU3056Fub+wBATW3NQd/S3AcAampzDvrm5j4AUFNbrNABoP4aK/S1zX0AoKbW5qCvaO4DADW1Mgd9ZXMfAKipFVboAFB/jRX60uY+AFBTS3LQ5zX3AYCamp+DPr+5DwDU1DwrdACov8YK/eWYbY1DAKBu8neyvHzQ7JnT8pvinm+cAgDq5oXc8rxCz35cbQGAemk0XNABoN52CfpT1RYAqJdGw3cEfU5Mb3MXAKiJ3O7c8GbQZ8+c9kpsns37AEBtPFs1fOcKPft+tQUA6mFnu/sH/XvVFgCoh53t7h/0B2P6mrsAQIfLzc7tbtgZ9Nkzpy2JzZPNIwCgwz1Ztbuh/wo9u7faAgCdbZdmCzoA1NM+g/5ozMLmLgDQoXKrc7N32iXos2dOyw+o39E8AgA61O1Vs3fafYWe3VZtAYDO9NVqu9NAQc+vkJvf3AUAOkxudON1r/3tEfRYwufn2j7fPAIAOswtVat3MdAKPbslZntzFwDoELnNAy66Bwx6lH9BbDzCBgCd5d6q0XvY2wo9+7tqCwB0hr22eV9BvyfGV6oCQGfITc5tHtBeg1594H598wgAGGXXD3Qz3A77WqFn/xCz88XvAMCoyC3OTd6rfQY9/iawKTY3NI8AgFFyQ9XkvdrfCj37m5ilzV0AYITlBucW79N+gx5/I1gfm+uaRwDACLuuavE+DWaFnt0UM+BzbwBA2+T25gbv16CCXl23/4/NIwBghHxsf5+d7zDYFXqW767b42XwAEBb5OZ+sbm7fz19fXt9pG0PM2bNe1Ns8heq9zROAADtkON8VqzOf9A83L+hrNDzpffHYnNr8wgAaJPPDyXm2ZCCXvlIjMfYAKA9cmP/rLk7eEMOevyNYVVs/rR5BAC02J9WrR2SIX2G3t+MWfPuis2FzSMAoAW+FTF/d7U/JMO55L7DZTHLmrsAwAHKTf3j5u7QDTvo8TeI/KL4fxczvCU+ALBDbuml0dZh36N2ICv0HPVvx+azzSMAYJj+Npp6d7U/LAcU9Eq+6/2J5i4AMES5oUO+q313w74prr8Zs+adHJsfxRzZOAEADMbKmDNjdT6/eTh8rVih50vv+Sdyccz2xgkAYH9yMy9uRcyzlgQ9i5/Qg7H5aPMIANiPj1btbImWXHLvb8aseX8bmyuaRwDAAPJNcFdW+y3RshV6Px+KOaA79QCgYPkJsauau63T8hV6Fqv0w2LzUEz+djYAoCl/ydl5sTpf1zxsnbYEPYuoHxGb/xtzeuMEAHS3p2LeGjF/pXnYWm0LehZRPzo2s2OmN04AQHd6LmZGxLxtr0xvx2foO1U/8fNi8i8EALpRbmC+zN7W7z9pa9Cz+AUsjM2MmHypAQC6SW5fXpnnFrZV24OeVX8reWtMvhkAALpBbl7+zLytK/MdRiToWfyC8k0A+fK7R9oAKF1uXb7M3pYb4AYyYkHP4heWb9N/T4xvaAOgVLlx76maN2Laepf7vsyYNe/DsfkfMWMaJwCg3vK72fPrXD/dPBxZoxb0LKL+jth8Kca3tAFQZ/lb0/51xPyB5uHIG9WgZxH1k2JzR8yZjRMAUC/568PfGzF/qXk4Okb0M/SBVL8Bb4mZFTO6f7sAgMHLzfrrmLeMdsyzUV+h9xer9XfG5paYYxonAKAzLY25JEJ+b/Nw9I36Cr2/+I25Jzb53e93NU4AQOfJjTq9k2KeddQKvb9Yrb8vNvlShtU6AJ0gr8qvipB/tXnYWTpqhd5f9Rt2WsznY3y2DsBoyQ3KLTqtU2OedewKvb9YrZ8Vm8/E+H51AEbSnJirI+Qd/+ryjl2h9xe/kfk39OyYP4xZkM8BQBvl1uTmnFOHmGe1WKH3F6v1g2NzWczHYo7N5wCgRZbEXBdzc4R8U+NMTdQu6DtE2CfG5sqYa2PcOAfAgcg3vF0fMytCvqFxpmZqG/QdqhX7B2KuiZmezwHAID0Xc0PMF+q2It9d7YO+Q4Q93w9wQUy+HJ9fUDM2BgB2ty0mv/fkpph7I+RFhLCYoPcXcT8hNpfG/FHMtHwOgK43L+bWmFsi4sXdYF1k0HeIsPfEJj/qdlHMH8QcHwNA91gYc3vMbTGPlbIaH0jRQe+vuiSfn2fPl+XPjzkjphaP7QEwaL0xT8TcF5NfzTonIp7PFa9rgr67CHx+5O28mPxNb2+OOTUmr+gBqI8csWdjvhfz3ZiHIuD50bOu07VB310Efkps8str8pfDvCHmjTGnxLi5DqAz5JvZXoj5cczTMf8vJq/AV8W26wn6PkTkJ8TmtTGvq+bEmPzM+9R+MylmfL8ZF2OlD7BvOT5bY7bE5MfF8nZdzIp+k58NfzlmbjW/iHhvji17SOn/A6bddTBuigQoAAAAAElFTkSuQmCC",_l=t=>t.name||[t.first_name,t.last_name].join(" ");class wl extends Ne{constructor(){super(...arguments),this.bgimage=null,this.bgcolor="#e6e6e6",this.initials=""}updated(t){super.updated(t),t.has("system")&&this.system&&(this.bgimage=`url('${xl}') center / contain no-repeat`),t.has("name")&&(this.name?(this.bgcolor=ie.hex(this.name),this.initials=Ce(this.name)):(this.bgcolor="#e6e6e6",this.initials="")),t.has("avatar")&&this.avatar&&(this.bgimage=`url('${this.avatar}') center / contain no-repeat`)}render(){return H`<div class="wrapper">
558
+ let vl=Ka,yl=!1;const bl=["es","fr","pt"],xl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAYAAADL1t+KAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACHDwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKL2lDQ1BJQ0MgUHJvZmlsZQAASMedlndUVNcWh8+9d3qhzTDSGXqTLjCA9C4gHQRRGGYGGMoAwwxNbIioQEQREQFFkKCAAaOhSKyIYiEoqGAPSBBQYjCKqKhkRtZKfHl57+Xl98e939pn73P32XuftS4AJE8fLi8FlgIgmSfgB3o401eFR9Cx/QAGeIABpgAwWempvkHuwUAkLzcXerrICfyL3gwBSPy+ZejpT6eD/0/SrFS+AADIX8TmbE46S8T5Ik7KFKSK7TMipsYkihlGiZkvSlDEcmKOW+Sln30W2VHM7GQeW8TinFPZyWwx94h4e4aQI2LER8QFGVxOpohvi1gzSZjMFfFbcWwyh5kOAIoktgs4rHgRm4iYxA8OdBHxcgBwpLgvOOYLFnCyBOJDuaSkZvO5cfECui5Lj25qbc2ge3IykzgCgaE/k5XI5LPpLinJqUxeNgCLZ/4sGXFt6aIiW5paW1oamhmZflGo/7r4NyXu7SK9CvjcM4jW94ftr/xS6gBgzIpqs+sPW8x+ADq2AiB3/w+b5iEAJEV9a7/xxXlo4nmJFwhSbYyNMzMzjbgclpG4oL/rfzr8DX3xPSPxdr+Xh+7KiWUKkwR0cd1YKUkpQj49PZXJ4tAN/zzE/zjwr/NYGsiJ5fA5PFFEqGjKuLw4Ubt5bK6Am8Kjc3n/qYn/MOxPWpxrkSj1nwA1yghI3aAC5Oc+gKIQARJ5UNz13/vmgw8F4psXpjqxOPefBf37rnCJ+JHOjfsc5xIYTGcJ+RmLa+JrCdCAACQBFcgDFaABdIEhMANWwBY4AjewAviBYBAO1gIWiAfJgA8yQS7YDApAEdgF9oJKUAPqQSNoASdABzgNLoDL4Dq4Ce6AB2AEjIPnYAa8AfMQBGEhMkSB5CFVSAsygMwgBmQPuUE+UCAUDkVDcRAPEkK50BaoCCqFKqFaqBH6FjoFXYCuQgPQPWgUmoJ+hd7DCEyCqbAyrA0bwwzYCfaGg+E1cBycBufA+fBOuAKug4/B7fAF+Dp8Bx6Bn8OzCECICA1RQwwRBuKC+CERSCzCRzYghUg5Uoe0IF1IL3ILGUGmkXcoDIqCoqMMUbYoT1QIioVKQ21AFaMqUUdR7age1C3UKGoG9QlNRiuhDdA2aC/0KnQcOhNdgC5HN6Db0JfQd9Dj6DcYDIaG0cFYYTwx4ZgEzDpMMeYAphVzHjOAGcPMYrFYeawB1g7rh2ViBdgC7H7sMew57CB2HPsWR8Sp4sxw7rgIHA+XhyvHNeHO4gZxE7h5vBReC2+D98Oz8dn4Enw9vgt/Az+OnydIE3QIdoRgQgJhM6GC0EK4RHhIeEUkEtWJ1sQAIpe4iVhBPE68QhwlviPJkPRJLqRIkpC0k3SEdJ50j/SKTCZrkx3JEWQBeSe5kXyR/Jj8VoIiYSThJcGW2ChRJdEuMSjxQhIvqSXpJLlWMkeyXPKk5A3JaSm8lLaUixRTaoNUldQpqWGpWWmKtKm0n3SydLF0k/RV6UkZrIy2jJsMWyZf5rDMRZkxCkLRoLhQWJQtlHrKJco4FUPVoXpRE6hF1G+o/dQZWRnZZbKhslmyVbJnZEdoCE2b5kVLopXQTtCGaO+XKC9xWsJZsmNJy5LBJXNyinKOchy5QrlWuTty7+Xp8m7yifK75TvkHymgFPQVAhQyFQ4qXFKYVqQq2iqyFAsVTyjeV4KV9JUCldYpHVbqU5pVVlH2UE5V3q98UXlahabiqJKgUqZyVmVKlaJqr8pVLVM9p/qMLkt3oifRK+g99Bk1JTVPNaFarVq/2ry6jnqIep56q/ojDYIGQyNWo0yjW2NGU1XTVzNXs1nzvhZei6EVr7VPq1drTltHO0x7m3aH9qSOnI6XTo5Os85DXbKug26abp3ubT2MHkMvUe+A3k19WN9CP16/Sv+GAWxgacA1OGAwsBS91Hopb2nd0mFDkqGTYYZhs+GoEc3IxyjPqMPohbGmcYTxbuNe408mFiZJJvUmD0xlTFeY5pl2mf5qpm/GMqsyu21ONnc332jeaf5ymcEyzrKDy+5aUCx8LbZZdFt8tLSy5Fu2WE5ZaVpFW1VbDTOoDH9GMeOKNdra2Xqj9WnrdzaWNgKbEza/2BraJto22U4u11nOWV6/fMxO3Y5pV2s3Yk+3j7Y/ZD/ioObAdKhzeOKo4ch2bHCccNJzSnA65vTC2cSZ79zmPOdi47Le5bwr4urhWuja7ybjFuJW6fbYXd09zr3ZfcbDwmOdx3lPtKe3527PYS9lL5ZXo9fMCqsV61f0eJO8g7wrvZ/46Pvwfbp8Yd8Vvnt8H67UWslb2eEH/Lz89vg98tfxT/P/PgAT4B9QFfA00DQwN7A3iBIUFdQU9CbYObgk+EGIbogwpDtUMjQytDF0Lsw1rDRsZJXxqvWrrocrhHPDOyOwEaERDRGzq91W7109HmkRWRA5tEZnTdaaq2sV1iatPRMlGcWMOhmNjg6Lbor+wPRj1jFnY7xiqmNmWC6sfaznbEd2GXuKY8cp5UzE2sWWxk7G2cXtiZuKd4gvj5/munAruS8TPBNqEuYS/RKPJC4khSW1JuOSo5NP8WR4ibyeFJWUrJSBVIPUgtSRNJu0vWkzfG9+QzqUvia9U0AV/Uz1CXWFW4WjGfYZVRlvM0MzT2ZJZ/Gy+rL1s3dkT+S453y9DrWOta47Vy13c+7oeqf1tRugDTEbujdqbMzfOL7JY9PRzYTNiZt/yDPJK817vSVsS1e+cv6m/LGtHlubCyQK+AXD22y31WxHbedu799hvmP/jk+F7MJrRSZF5UUfilnF174y/ariq4WdsTv7SyxLDu7C7OLtGtrtsPtoqXRpTunYHt897WX0ssKy13uj9l4tX1Zes4+wT7hvpMKnonO/5v5d+z9UxlfeqXKuaq1Wqt5RPXeAfWDwoOPBlhrlmqKa94e4h+7WetS212nXlR/GHM44/LQ+tL73a8bXjQ0KDUUNH4/wjowcDTza02jV2Nik1FTSDDcLm6eORR67+Y3rN50thi21rbTWouPguPD4s2+jvx064X2i+yTjZMt3Wt9Vt1HaCtuh9uz2mY74jpHO8M6BUytOdXfZdrV9b/T9kdNqp6vOyJ4pOUs4m3924VzOudnzqeenL8RdGOuO6n5wcdXF2z0BPf2XvC9duex++WKvU++5K3ZXTl+1uXrqGuNax3XL6+19Fn1tP1j80NZv2d9+w+pG503rm10DywfODjoMXrjleuvyba/b1++svDMwFDJ0dzhyeOQu++7kvaR7L+9n3J9/sOkh+mHhI6lH5Y+VHtf9qPdj64jlyJlR19G+J0FPHoyxxp7/lP7Th/H8p+Sn5ROqE42TZpOnp9ynbj5b/Wz8eerz+emCn6V/rn6h++K7Xxx/6ZtZNTP+kv9y4dfiV/Kvjrxe9rp71n/28ZvkN/NzhW/l3x59x3jX+z7s/cR85gfsh4qPeh+7Pnl/eriQvLDwG/eE8/s3BCkeAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAIXRFWHRDcmVhdGlvbiBUaW1lADIwMjI6MDg6MTEgMDE6MjY6MTB2N148AAAbLUlEQVR4Xu3dC7RddX3g8f8lLyCQlBAeAgJxWlbAKlMWrUCV1IoOaHFcUysya8YWZkpBIgW0dRzn6VotzlTBKWkt2EGWUx8I+EB5g0OqlqACgyhPTQLm/SIJeT/und//nJ14k9wk996cc+/Z//P5rPVb+5GFJhHzzX+fvffp6evrSwxsxqx5Y2NzYszrYk6OmRZzbMzUfjMpZny/GRfTEwPA3uX4bI3ZErOp2q6LWdFvlsTMi5kfMzfm5dkzp22LLQMQ9ErEe0ps3hRzeswbYn49ZnpMjjQAoy9H/7mYn8Q8HfNUzGMR+VWx7XpdG/QIeF5pnxfzlpg3x5waY2UNUC85Ys/GfC/muzEPReDzyr7rdE3QI+AHxeasmAtizo85IyafA6AcvTFPxNwXc2/MnAh8Ple8ooMeEc8r7nwZ/aKYP4g5PgaA7rEw5vaY22Ly5flio1dk0CPkJ8Tm0pg/isk3sgHAvJhbY26JsC9onClIMUGvLqnny+mXxbwzJt+hDgC7y3fK3xNzU8y9pazaax/0CPnBsflAzDUx+a50ABisfNf8DTFfiLDnx+dqq7ZBj5BPjM2VMdfGHJPPAcAwLY25PmZWhH1D40zN1C7o1Yo8X1b/WEx+9AwAWiU/8nZdzM11W7HXJugR8nzH+r+N+YuYfNMbALRLvmnu4zH/py6fsdci6BHz/Pz4Z2LyI2gAMFLmxFwdUX+sedi5OjroEfL8OtZPxeTHz7zFDYDRkEOZH3f7SIS9Y18z27FBj5i/LzZ/HeOGNwA6Qb5x7qqI+lebh52l44IeIc8Bvznm3Y0TANBZ7oq5LMKeA98xOiroEfP8QphbYqzKAehkOeaXRNTz++I7QkcEPUKeH0X7q5j8XLnPygGogxzQG2M+GmEf9UfcRj3oEfOTYnNHzJmNEwBQLz+KeW9E/aXm4egY1a8PjZi/IzaPx4g5AHWVG/Z41bRRM2pBj1/4h2OTX45/ZOMEANRXbtk9VdtGxYhfco9fbP4WtPw42hWNEwBQls/G5Mfb8re6jZgRDXrE/LDYfCXmXY0TAFCmu2PeH1Ff1zxsvxELesT8iNjk2/u9vhWAbpBfF3tBRP2V5mF7jUjQI+ZHx+aBmNMbJwCgOzwV846I+rLmYfu0PegR8+Nj81DM9MYJAOguz8WcF1Ff2Dxsj7YGvVqZz44RcwC6WY76jHau1Nv22Fr1mXm+zC7mAHS73MIHqja2RVuCHj/hfDd7vgHOZ+YA0JSbeG/VyJZredDjJzomNvnRNHezA8Cuchu/XLWypdqxQs8vqvecOQAM7Pdi8gvWWqqlQY+/ceRX3nkDHADs2werZrZMy+5yj5/Y22OTPzdv+WUEACjQ9pj84pkHm4cHpiVBj5ifHJv89XG+aAUABm9lzJkR9fnNw+E74EvuEfNDYnNnjJgDwNDkdt5ZtfSAtOIz9E/FnNHcBQCGKDf0r5q7w3dAl9zjbxT5Tr27YnoaJwCA4cgxvnD2zGn5W9qGZdhBj5gfG5v80vn8elcA4MDk18K+MaK+tHk4NAdyyf3mGDEHgNbITf1cc3fohhX0WJ2/PzYXNo8AgBa5sGrskA35knv8F+U78p6JsToHgNbLl95Pmz1zWn6kbdCGs0L/dIyYA0B75Mbm1g7JkFbosTo/Kzb/FOOudgBonxznc2KVPqd5uH+DDnrEPEc8/wf/VuMEANBOP4g5K6I+qFAP5ZL7v4kRcwAYGbm5ub2DMqgVeqzOD47NizEnNE4AACNhQcyvxSp9U/Nw7wa7Qv+TGDEHgJGV25sbvF/7XaHH6nxibH4ec0zjBAAwkvKb4/5ZrNLXNw8HNpgV+pUxYg4AoyM3OLd4n/a5Qq8+O58Xk9/bDgCMjiUx0/b1Wfr+Vuj57joxB4DRlVu8zzve97pCr547/2nMqY0TAMBoejbm9Xt7Ln1fK/R3xog5AHSG3OTc5gHtK+iXV1sAoDPstc0DXnKfMWtefu5tfsyYxgkAoBNsjzl59sxp+YUzu9jbCv3SGDEHgM6S23xJc3dXe6zQq5vh5sac3DgBAHSSfAX9dbvfHDfQCj1/RaqYA0Bnyo3Ord7FQEG/qNoCAJ3pfdV2p10uuc+YNS8H/uWY4xsnAIBOtDDmxNkzp/U2D/dcoZ8dI+YA0Nlyq3Ozd9o96BdUWwCgs+3SbEEHgHrapdk7P0OfMWtefvH7onyucQIA6GQ54MfNnjktfxPbLiv0t8eIOQDUQ252bndD/6C/udoCAPWws939g/7b1RYAqIed7W58hj5j1rwjYn9FzO43yQEAnSs/hz519sxpr+wIeH6FnJgDQL3kdjdeA7sj4qdXWwCgXhoN3xH0N1ZbAKBeGg0XdACot0bDe869ce742K6PGZtPAAC1sjXmsLxCPzFGzAGgnsbFnJiDPq1xCADU1ck56Cc39wGAmppmhQ4A9ddYoR/T3AcAaurYHPSpzX0AoKaOzEE/srkPANTUVCt0AKi/xgp9UnMfAKipSTno+U1xAEB9TchBn9DcBwBqarwVOgDUX2OFnt8BCwDU17gc9J7mPgBQUz056ABAzQk6ABRA0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUABBB4ACCDoAFEDQAaAAgg4ABRB0ACiAoANAAQQdAAog6ABQAEEHgAIIOgAUQNABoACCDgAFEHQAKICgA0ABBB0ACiDoAFAAQQeAAgg6ABRA0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUABBB4ACCDoAFEDQAaAAgg4ABRB0ACiAoANAAQQdAAog6ABQAEEHgAIIOgAUQNABoACCDgAFEHQAKICgA0ABBB0ACiDoAFAAQQeAAgg6ABRA0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUABBB4ACCDoAFEDQAaAAgg4ABRB0AChAz7k3zu2r9mGffuWQMemUoyek4yaNTYeMOygd1FP9AHSZ7b19ad2W3rRg9bb0/LLNaePW3upHYPQIOvs0YexB6YJTD4s5PE0/enx1Fthhe7T8iYUb07d/+mqa/fMNqa/PH6mMDkFnr952ymHpyt+eko6cOKY6A+zL3JVb0/WzV6SnF22qzsDIEXT2MG5MT/rIW6em86cfVp0BBqs3/kT9+zmvpC8+vro6AyPDTXHsIsf8k793rJjDMOV7Sy47+4j0obccWZ2BkSHo7OKjbzsqnfnag6sjYLjee/qkdNFvTK6OoP0EnZ3On354evspE6sj4ED9ydlT0ilHTaiOoL0EnYZDxx+UPvjmKdUR0Apj4k/Yq2e49M7IEHQaLnz94Wnywf51gFZ7/bET0hknHFIdQfv4E5yGd512eLUHtNo7/f+LESDopNdMGpdOOmJcdQS02lknHZJ6erxakfYSdNL0Y9y0A+10+ISD0vGTx1ZH0B6CTuPd7EB7HTfJVTDaS9BJE8f71wDa7dDxLrnTXv4kx7emwQgY4zN02kzQAaAAgg4ABRB0ACiAoANAAQQdAAog6ABQAEEHgAIIOgAUQNABoACCDgAFEHQAKICgA0ABes69cW5ftU+XuvycKeniMyZXR0A7fOL+5enhF9dVR790xgmHpD8++4jq6Jc2be1Ly9ZtS88u3Zwee2ljWrx2a/UjMDArdIBRNOngg9Jpx0zYY8444eB0/vTD0jUzjkxf+cAJ6Yb3vCa94biDq38K9iToADWQAz/rX70mXfs7U9P4Mb6KlT0JOkCN/MtfPzxdH6v1ieP98c2u/BsBUDNveM2E9JfvOiaNPchKnV8SdIAa+ufHH5wuedOeN9PRvQQdoKbe/xuT0/GTx1VHdDtBB6ipsfEnuEdO2UHQAWrsd3/tsDTWXe8EQQeosYnjexrPrYOgA9Tc644cX+3RzQQdoOamHDqm2qObCTpAzY3zGTpB0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUABBB4ACCDoAFEDQAaAAgg4ABRB0ACiAoANAAQQdAAog6ABQAEEHKNSxk8alOy45cY/56h++Nn3uouPTR946Nf3miYeknh5fv1oCQQcoVP6a9KMmjtljjjl8bDrlqPHpwtcfnj717mPT3190XDr1mAnVP0VdCTpAl/vVqePT3/z+cem8Uw6rzlBHgg5AGhM1+Pjbj0q/ddKh1RnqRtABaDioJ6WPvW1qmjheGurI/2oA7DTl0DHp90+fVB1RJ4IOwC7+xfTDqz3qRNAB2MUJk8emIyeOrY6oC0EHYA/50TbqRdAB2MP4/BA7tSLoAFAAQQeAAgg6ABRA0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUABBB4ACCDoAFEDQAaAAgg4ABRB0ACiAoANAAQQdAAog6ABQAEEHgAIIOgAUQNABoACCDgAFEHQAKICgA0ABBB0ACiDoAFAAQQeAAgg6ABRA0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUABBB4ACCDoAFEDQAaAAgg4ABRB0ACiAoANAAQQdAAog6ABQAEEHgAIIOgAUQNABoACCDgAFEHQAKICgA0ABBB0ACiDoAFAAQQeAAgg6ABRA0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUABBB4ACCDoAFEDQAaAAgg4ABRB0ACiAoANAAQQdAAog6ABQAEEHgAIIOgAUQNABoACCDgAFEHQAKICgA0ABBB0ACiDoAFAAQQeAAgg6ABRA0AGgAIIOAAUQdAAogKADQAEEHYA9bNneV+1RF4IOwB6WrN1a7VEXgg7ALhas2ZZWbdheHVEXgg7ALu5/7tVqjzoRdAB2emVjb7rzqbXVEXUi6AA09Pal9MmHl6f1W3qrM9SJoAOQtkfDr3toeZozf0N1hroRdIAu97MVW9KVdy5KDzy/rjpDHQk6QKHyo+T5bvXdZ8X67enFiPjdz6xLf/atpenf37YoPbt0c/VPUVc9594419sDutzl50xJF58xuToC2uET9y9PD7+45wr4d351Yvrv5x9dHQ3Pl55Yk276p1XVEd3KCh0ACiDoAFAAQQeAAgg6ABRA0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUABBB4ACCDoAFEDQAaAAgg4ABRB0gJrbmr/4nK4n6AA1t2rD9mqPbiboADU3d+WWao9uJugANbZ+S196Zunm6ohuJugANfadF9elbT5DJwg6QE1t603py0+sqY7odoIOUFNfenx1Wrhma3VEtxN0gBp6cuGmdOsPV1dHIOgAtfP04s3p43cvTdt7fXbOLwk6QI188yevpmu/sTit39JbnYEmQQeogScWbEozv7Y4Xf/IirTFXe0MQNABRtHaTb2N58h3nxzw+55bl26YvTK9/wsL0jWxKn960abqn4I99Zx741x/1etyl58zJV18xuTqCGiHT9y/PD384rrqCFrPCh0ACiDoAFAAQQeAAgg6ABRA0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUABBB4ACCDoAFEDQAUbA9j7fg0V7CTrACNiwRdBpL0EHGAGL1m6t9qA9BB2gzV7d3JsWrtlWHUF7CDpAm815aWPq8xk6bSboAG12zzOvVnvQPoIO0EY/XbI5PbFgY3UE7SPoAG2yvTelz8xeWR1Bewk6QJvc9Oiq9MLyzdURtJegA7TBHU+tTbc9uaY6gvYTdIAW6u1L6eZHX0k3fteldkaWoAO0yNyVW9NVX1+cvvj46uoMjBxBBzgA+ca3H/5iY/qv9y1Ll35lYXp60abqR2Bk9Zx741xvO+hyl58zJV18xuTqqJ4e+dn69MLyLdURtNf23r60bktvWrB6W3p+2ea0cWtUHUaZoFP7oN/6w9Xp1h+s9iYuoKu55E5t5Uudn3x4Rfr8Y6+IOdD1BJ1a2rC1L/35t5ake5/1Sk2ATNCpneXrt6eZdy5KP/qF12kC7CDo1Ep+LOiK2xeln69wAxxAf4JObTy+YFO6Mlbmy9f5XmmA3Qk6tXDfc+vSn9+1JG3Y4vEggIEIOh3vCz9a3bibfVt+pyYAAxJ0Otb26Pf//M6K9L/neCwNYH8EnY60cWtf+g/fXprufsZjaQCDIeh0nJXrt6cPfW1x+sFLG6ozAOyPoNNR5q/amq64Y1F6cfnm6gwAgyHodIwnFzYfS1v6qsfSAIZK0OkIDz6/Pn3kriVp3WaPpQEMh6Az6v7h8TXpLx5anrbl29oBGBZBZ9Tkfn/6kZXpc4+u8lgawAESdEZFfizt43cvTXf9ZG11BoADIeiMuFUbtqervr44PTrfY2kArSLojKiXXsmPpS1OLyzzWBpAKwk6I+apRZvSlRHzJWu3VmcAaBVBZ0R858X16cPfXJJe3by9OgNAKwk6bffFx9ekTzywPG31WBpA2wg6bZO/7fT6R1ammz2WBtB2gk5bbNrWl/7TPcvSNz2WBjAiBJ2WW72xN1399cXp+/PWV2cAaDdBp6V+sbr5bWnPLvVYGsBIEnRa5unFm9MH71icFq3xWBrASBN0WuKRn61P135jcVq7yWNpAKNB0DlgX3lyTfpv9y9PWzyWBjBqBJ1hy4+l/a9/XJk++32PpQGMNkFnWDZv60v/+d5l6Ws/9lgaQCcQdNJQ19ZrNvWmq7+xJH1vrsfSADqFoJPWRqAHa8GabemK2xelZ5Zsqs4A0AkEnfTEgo3V3r79dEl+LG1RWuixNICOI+ik55dtTv84d0N1NLD849d8Y0las9FjaQCdSNBp+MsHl6c5Lw28Uv/yE2vSf7l3Wdq8bfCX5gEYWT3n3jjX80bs9JsnHpLOPvnQdMQhY9KSV7elh19Yn362wmtcATqdoANAAVxyB4ACCDoAFEDQAaAAgg4ABRB0ACiAoANAAQQdAAog6ABQAEEHgAIIOgAUQNABoACCDgAFEHQAKICgA0ABBB0ACiDoAFAAQQeAAgg6ABRA0AGgAIIOAAUQdAAogKADQAEEHQAKIOgAUIAc9L7mLgBQU3056Fub+wBATW3NQd/S3AcAampzDvrm5j4AUFNbrNABoP4aK/S1zX0AoKbW5qCvaO4DADW1Mgd9ZXMfAKipFVboAFB/jRX60uY+AFBTS3LQ5zX3AYCamp+DPr+5DwDU1DwrdACov8YK/eWYbY1DAKBu8neyvHzQ7JnT8pvinm+cAgDq5oXc8rxCz35cbQGAemk0XNABoN52CfpT1RYAqJdGw3cEfU5Mb3MXAKiJ3O7c8GbQZ8+c9kpsns37AEBtPFs1fOcKPft+tQUA6mFnu/sH/XvVFgCoh53t7h/0B2P6mrsAQIfLzc7tbtgZ9Nkzpy2JzZPNIwCgwz1Ztbuh/wo9u7faAgCdbZdmCzoA1NM+g/5ozMLmLgDQoXKrc7N32iXos2dOyw+o39E8AgA61O1Vs3fafYWe3VZtAYDO9NVqu9NAQc+vkJvf3AUAOkxudON1r/3tEfRYwufn2j7fPAIAOswtVat3MdAKPbslZntzFwDoELnNAy66Bwx6lH9BbDzCBgCd5d6q0XvY2wo9+7tqCwB0hr22eV9BvyfGV6oCQGfITc5tHtBeg1594H598wgAGGXXD3Qz3A77WqFn/xCz88XvAMCoyC3OTd6rfQY9/iawKTY3NI8AgFFyQ9XkvdrfCj37m5ilzV0AYITlBucW79N+gx5/I1gfm+uaRwDACLuuavE+DWaFnt0UM+BzbwBA2+T25gbv16CCXl23/4/NIwBghHxsf5+d7zDYFXqW767b42XwAEBb5OZ+sbm7fz19fXt9pG0PM2bNe1Ns8heq9zROAADtkON8VqzOf9A83L+hrNDzpffHYnNr8wgAaJPPDyXm2ZCCXvlIjMfYAKA9cmP/rLk7eEMOevyNYVVs/rR5BAC02J9WrR2SIX2G3t+MWfPuis2FzSMAoAW+FTF/d7U/JMO55L7DZTHLmrsAwAHKTf3j5u7QDTvo8TeI/KL4fxczvCU+ALBDbuml0dZh36N2ICv0HPVvx+azzSMAYJj+Npp6d7U/LAcU9Eq+6/2J5i4AMES5oUO+q313w74prr8Zs+adHJsfxRzZOAEADMbKmDNjdT6/eTh8rVih50vv+Sdyccz2xgkAYH9yMy9uRcyzlgQ9i5/Qg7H5aPMIANiPj1btbImWXHLvb8aseX8bmyuaRwDAAPJNcFdW+y3RshV6Px+KOaA79QCgYPkJsauau63T8hV6Fqv0w2LzUEz+djYAoCl/ydl5sTpf1zxsnbYEPYuoHxGb/xtzeuMEAHS3p2LeGjF/pXnYWm0LehZRPzo2s2OmN04AQHd6LmZGxLxtr0xvx2foO1U/8fNi8i8EALpRbmC+zN7W7z9pa9Cz+AUsjM2MmHypAQC6SW5fXpnnFrZV24OeVX8reWtMvhkAALpBbl7+zLytK/MdRiToWfyC8k0A+fK7R9oAKF1uXb7M3pYb4AYyYkHP4heWb9N/T4xvaAOgVLlx76maN2Laepf7vsyYNe/DsfkfMWMaJwCg3vK72fPrXD/dPBxZoxb0LKL+jth8Kca3tAFQZ/lb0/51xPyB5uHIG9WgZxH1k2JzR8yZjRMAUC/568PfGzF/qXk4Okb0M/SBVL8Bb4mZFTO6f7sAgMHLzfrrmLeMdsyzUV+h9xer9XfG5paYYxonAKAzLY25JEJ+b/Nw9I36Cr2/+I25Jzb53e93NU4AQOfJjTq9k2KeddQKvb9Yrb8vNvlShtU6AJ0gr8qvipB/tXnYWTpqhd5f9Rt2WsznY3y2DsBoyQ3KLTqtU2OedewKvb9YrZ8Vm8/E+H51AEbSnJirI+Qd/+ryjl2h9xe/kfk39OyYP4xZkM8BQBvl1uTmnFOHmGe1WKH3F6v1g2NzWczHYo7N5wCgRZbEXBdzc4R8U+NMTdQu6DtE2CfG5sqYa2PcOAfAgcg3vF0fMytCvqFxpmZqG/QdqhX7B2KuiZmezwHAID0Xc0PMF+q2It9d7YO+Q4Q93w9wQUy+HJ9fUDM2BgB2ty0mv/fkpph7I+RFhLCYoPcXcT8hNpfG/FHMtHwOgK43L+bWmFsi4sXdYF1k0HeIsPfEJj/qdlHMH8QcHwNA91gYc3vMbTGPlbIaH0jRQe+vuiSfn2fPl+XPjzkjphaP7QEwaL0xT8TcF5NfzTonIp7PFa9rgr67CHx+5O28mPxNb2+OOTUmr+gBqI8csWdjvhfz3ZiHIuD50bOu07VB310Efkps8str8pfDvCHmjTGnxLi5DqAz5JvZXoj5cczTMf8vJq/AV8W26wn6PkTkJ8TmtTGvq+bEmPzM+9R+MylmfL8ZF2OlD7BvOT5bY7bE5MfF8nZdzIp+k58NfzlmbjW/iHhvji17SOn/A6bddTBuigQoAAAAAElFTkSuQmCC",_l=t=>t.name||[t.first_name,t.last_name].join(" ");class wl extends Ne{constructor(){super(...arguments),this.bgimage=null,this.bgcolor="#e6e6e6",this.initials=""}updated(t){super.updated(t),t.has("system")&&this.system&&(this.bgimage=`url('${xl}') center / contain no-repeat`),t.has("name")&&(this.name?(this.bgcolor=ie.hex(this.name),this.initials=Ce(this.name)):(this.bgcolor="#e6e6e6",this.initials="")),t.has("avatar")&&this.avatar&&(this.bgimage=`url('${this.avatar}') center / contain no-repeat`)}render(){return H`<div class="wrapper">
559
559
  <div
560
560
  class="avatar-circle"
561
561
  style="
@@ -607,7 +607,7 @@ let vl=Ka,bl=!1;const yl=["es","fr","pt"],xl="data:image/png;base64,iVBORw0KGgoA
607
607
  -webkit-box-orient: vertical;
608
608
  overflow: hidden;
609
609
  }
610
- `,t([mt({type:Number})],wl.prototype,"scale",void 0),t([mt({type:Boolean})],wl.prototype,"showName",void 0),t([mt({type:Boolean})],wl.prototype,"system",void 0),t([mt({type:String,attribute:!1})],wl.prototype,"bgimage",void 0),t([mt({type:String,attribute:!1})],wl.prototype,"bgcolor",void 0),t([mt({type:String,attribute:!1})],wl.prototype,"initials",void 0),t([mt({type:String})],wl.prototype,"name",void 0),t([mt({type:String})],wl.prototype,"email",void 0),t([mt({type:String})],wl.prototype,"uuid",void 0),t([mt({type:String})],wl.prototype,"avatar",void 0);const kl=t=>{let e;const i=new Set,o=(t,o)=>{const n="function"==typeof t?t(e):t;if(!Object.is(n,e)){const t=e;e=(null!=o?o:"object"!=typeof n||null===n)?n:Object.assign({},e,n),i.forEach((i=>i(e,t)))}},n=()=>e,s={setState:o,getState:n,getInitialState:()=>r,subscribe:t=>(i.add(t),()=>i.delete(t))},r=e=t(o,n,s);return s};var Cl=Symbol.for("immer-nothing"),Sl=Symbol.for("immer-draftable"),Al=Symbol.for("immer-state"),El=[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}];function $l(t,...e){{const i=El[t],o="function"==typeof i?i.apply(null,e):i;throw new Error(`[Immer] ${o}`)}}var Tl=Object.getPrototypeOf;function Dl(t){return!!t&&!!t[Al]}function Ml(t){return!!t&&(Ol(t)||Array.isArray(t)||!!t[Sl]||!!t.constructor?.[Sl]||Nl(t)||Bl(t))}var Il=Object.prototype.constructor.toString();function Ol(t){if(!t||"object"!=typeof t)return!1;const e=Tl(t);if(null===e)return!0;const i=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return i===Object||"function"==typeof i&&Function.toString.call(i)===Il}function Ll(t,e){0===zl(t)?Reflect.ownKeys(t).forEach((i=>{e(i,t[i],t)})):t.forEach(((i,o)=>e(o,i,t)))}function zl(t){const e=t[Al];return e?e.type_:Array.isArray(t)?1:Nl(t)?2:Bl(t)?3:0}function Pl(t,e){return 2===zl(t)?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Rl(t,e,i){const o=zl(t);2===o?t.set(e,i):3===o?t.add(i):t[e]=i}function Nl(t){return t instanceof Map}function Bl(t){return t instanceof Set}function Fl(t){return t.copy_||t.base_}function ql(t,e){if(Nl(t))return new Map(t);if(Bl(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const i=Ol(t);if(!0===e||"class_only"===e&&!i){const e=Object.getOwnPropertyDescriptors(t);delete e[Al];let i=Reflect.ownKeys(e);for(let o=0;o<i.length;o++){const n=i[o],s=e[n];!1===s.writable&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(e[n]={configurable:!0,writable:!0,enumerable:s.enumerable,value:t[n]})}return Object.create(Tl(t),e)}{const e=Tl(t);if(null!==e&&i)return{...t};const o=Object.create(e);return Object.assign(o,t)}}function Ul(t,e=!1){return Vl(t)||Dl(t)||!Ml(t)||(zl(t)>1&&(t.set=t.add=t.clear=t.delete=jl),Object.freeze(t),e&&Object.entries(t).forEach((([t,e])=>Ul(e,!0)))),t}function jl(){$l(2)}function Vl(t){return Object.isFrozen(t)}var Hl,Wl={};function Zl(t){const e=Wl[t];return e||$l(0,t),e}function Yl(){return Hl}function Gl(t,e){e&&(Zl("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function Kl(t){Xl(t),t.drafts_.forEach(Jl),t.drafts_=null}function Xl(t){t===Hl&&(Hl=t.parent_)}function Ql(t){return Hl={drafts_:[],parent_:Hl,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Jl(t){const e=t[Al];0===e.type_||1===e.type_?e.revoke_():e.revoked_=!0}function td(t,e){e.unfinalizedDrafts_=e.drafts_.length;const i=e.drafts_[0];return void 0!==t&&t!==i?(i[Al].modified_&&(Kl(e),$l(4)),Ml(t)&&(t=ed(e,t),e.parent_||od(e,t)),e.patches_&&Zl("Patches").generateReplacementPatches_(i[Al].base_,t,e.patches_,e.inversePatches_)):t=ed(e,i,[]),Kl(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Cl?t:void 0}function ed(t,e,i){if(Vl(e))return e;const o=e[Al];if(!o)return Ll(e,((n,s)=>id(t,o,e,n,s,i))),e;if(o.scope_!==t)return e;if(!o.modified_)return od(t,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const e=o.copy_;let n=e,s=!1;3===o.type_&&(n=new Set(e),e.clear(),s=!0),Ll(n,((n,r)=>id(t,o,e,n,r,i,s))),od(t,e,!1),i&&t.patches_&&Zl("Patches").generatePatches_(o,i,t.patches_,t.inversePatches_)}return o.copy_}function id(t,e,i,o,n,s,r){if(n===i&&$l(5),Dl(n)){const r=ed(t,n,s&&e&&3!==e.type_&&!Pl(e.assigned_,o)?s.concat(o):void 0);if(Rl(i,o,r),!Dl(r))return;t.canAutoFreeze_=!1}else r&&i.add(n);if(Ml(n)&&!Vl(n)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;ed(t,n),e&&e.scope_.parent_||"symbol"==typeof o||!Object.prototype.propertyIsEnumerable.call(i,o)||od(t,n)}}function od(t,e,i=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Ul(e,i)}var nd={get(t,e){if(e===Al)return t;const i=Fl(t);if(!Pl(i,e))return function(t,e,i){const o=ad(e,i);return o?"value"in o?o.value:o.get?.call(t.draft_):void 0}(t,i,e);const o=i[e];return t.finalized_||!Ml(o)?o:o===rd(t.base_,e)?(dd(t),t.copy_[e]=cd(o,t)):o},has:(t,e)=>e in Fl(t),ownKeys:t=>Reflect.ownKeys(Fl(t)),set(t,e,i){const o=ad(Fl(t),e);if(o?.set)return o.set.call(t.draft_,i),!0;if(!t.modified_){const o=rd(Fl(t),e),n=o?.[Al];if(n&&n.base_===i)return t.copy_[e]=i,t.assigned_[e]=!1,!0;if(function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}(i,o)&&(void 0!==i||Pl(t.base_,e)))return!0;dd(t),ld(t)}return t.copy_[e]===i&&(void 0!==i||e in t.copy_)||Number.isNaN(i)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=i,t.assigned_[e]=!0),!0},deleteProperty:(t,e)=>(void 0!==rd(t.base_,e)||e in t.base_?(t.assigned_[e]=!1,dd(t),ld(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0),getOwnPropertyDescriptor(t,e){const i=Fl(t),o=Reflect.getOwnPropertyDescriptor(i,e);return o?{writable:!0,configurable:1!==t.type_||"length"!==e,enumerable:o.enumerable,value:i[e]}:o},defineProperty(){$l(11)},getPrototypeOf:t=>Tl(t.base_),setPrototypeOf(){$l(12)}},sd={};function rd(t,e){const i=t[Al];return(i?Fl(i):t)[e]}function ad(t,e){if(!(e in t))return;let i=Tl(t);for(;i;){const t=Object.getOwnPropertyDescriptor(i,e);if(t)return t;i=Tl(i)}}function ld(t){t.modified_||(t.modified_=!0,t.parent_&&ld(t.parent_))}function dd(t){t.copy_||(t.copy_=ql(t.base_,t.scope_.immer_.useStrictShallowCopy_))}Ll(nd,((t,e)=>{sd[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}})),sd.deleteProperty=function(t,e){return isNaN(parseInt(e))&&$l(13),sd.set.call(this,t,e,void 0)},sd.set=function(t,e,i){return"length"!==e&&isNaN(parseInt(e))&&$l(14),nd.set.call(this,t[0],e,i,t[0])};function cd(t,e){const i=Nl(t)?Zl("MapSet").proxyMap_(t,e):Bl(t)?Zl("MapSet").proxySet_(t,e):function(t,e){const i=Array.isArray(t),o={type_:i?1:0,scope_:e?e.scope_:Yl(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let n=o,s=nd;i&&(n=[o],s=sd);const{revoke:r,proxy:a}=Proxy.revocable(n,s);return o.draft_=a,o.revoke_=r,a}(t,e);return(e?e.scope_:Yl()).drafts_.push(i),i}function hd(t){if(!Ml(t)||Vl(t))return t;const e=t[Al];let i;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,i=ql(t,e.scope_.immer_.useStrictShallowCopy_)}else i=ql(t,!0);return Ll(i,((t,e)=>{Rl(i,t,hd(e))})),e&&(e.finalized_=!1),i}var ud=new class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,e,i)=>{if("function"==typeof t&&"function"!=typeof e){const i=e;e=t;const o=this;return function(t=i,...n){return o.produce(t,(t=>e.call(this,t,...n)))}}let o;if("function"!=typeof e&&$l(6),void 0!==i&&"function"!=typeof i&&$l(7),Ml(t)){const n=Ql(this),s=cd(t,void 0);let r=!0;try{o=e(s),r=!1}finally{r?Kl(n):Xl(n)}return Gl(n,i),td(o,n)}if(!t||"object"!=typeof t){if(o=e(t),void 0===o&&(o=t),o===Cl&&(o=void 0),this.autoFreeze_&&Ul(o,!0),i){const e=[],n=[];Zl("Patches").generateReplacementPatches_(t,o,e,n),i(e,n)}return o}$l(1,t)},this.produceWithPatches=(t,e)=>{if("function"==typeof t)return(e,...i)=>this.produceWithPatches(e,(e=>t(e,...i)));let i,o;const n=this.produce(t,e,((t,e)=>{i=t,o=e}));return[n,i,o]},"boolean"==typeof t?.autoFreeze&&this.setAutoFreeze(t.autoFreeze),"boolean"==typeof t?.useStrictShallowCopy&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){Ml(t)||$l(8),Dl(t)&&(t=function(t){Dl(t)||$l(10,t);return hd(t)}(t));const e=Ql(this),i=cd(t,void 0);return i[Al].isManual_=!0,Xl(e),i}finishDraft(t,e){const i=t&&t[Al];i&&i.isManual_||$l(9);const{scope_:o}=i;return Gl(o,e),td(void 0,o)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let i;for(i=e.length-1;i>=0;i--){const o=e[i];if(0===o.path.length&&"replace"===o.op){t=o.value;break}}i>-1&&(e=e.slice(i+1));const o=Zl("Patches").applyPatches_;return Dl(t)?o(t,e):this.produce(t,(t=>o(t,e)))}},pd=ud.produce;ud.produceWithPatches.bind(ud),ud.setAutoFreeze.bind(ud),ud.setUseStrictShallowCopy.bind(ud),ud.applyPatches.bind(ud),ud.createDraft.bind(ud),ud.finishDraft.bind(ud);const md=t=>(e,i,o)=>(o.setState=(t,i,...o)=>{const n="function"==typeof t?pd(t):t;return e(n,i,...o)},t(o.setState,i,o)),gd=t=>(e,i,o)=>{const n=o.subscribe;o.subscribe=(t,e,i)=>{let s=t;if(e){const n=(null==i?void 0:i.equalityFn)||Object.is;let r=t(o.getState());s=i=>{const o=t(i);if(!n(r,o)){const t=r;e(r=o,t)}},(null==i?void 0:i.fireImmediately)&&e(r,r)}return n(s)};return t(e,i,o)},fd="14.3";function vd(t){var e,i;if((null==t?void 0:t.nodes)&&(null===(e=null==t?void 0:t._ui)||void 0===e?void 0:e.nodes))for(const e of t.nodes){const o=t._ui.nodes[e.uuid];if(!o)continue;const n=null===(i=e.actions)||void 0===i?void 0:i.some((t=>!0===t.terminal));"execute_actions"===o.type&&n?o.type="terminal":"terminal"!==o.type||n||(o.type="execute_actions")}}function bd(t){var e,i,o;if((null==t?void 0:t.nodes)&&(null===(e=null==t?void 0:t._ui)||void 0===e?void 0:e.nodes))for(const e of t.nodes){const n=t._ui.nodes[e.uuid];if(!n||"wait_for_response"!==n.type)continue;const s=null===(o=null===(i=e.router)||void 0===i?void 0:i.wait)||void 0===o?void 0:o.hint;s&&("digits"===s.type&&1===s.count?n.type="wait_for_menu":"digits"===s.type?n.type="wait_for_digits":"audio"===s.type&&(n.type="wait_for_audio"))}}function yd(t,e){t.sort(((t,i)=>{var o,n;const s=null===(o=e[t.uuid])||void 0===o?void 0:o.position,r=null===(n=e[i.uuid])||void 0===n?void 0:n.position;return s&&r?s.top!==r.top?s.top-r.top:s.left-r.left:0}))}function xd(t=[]){const e=new Map,i=new Map;for(const o of t)if(o.action_uuid){const t=i.get(o.action_uuid)||[];t.push(o),i.set(o.action_uuid,t)}else{const t=e.get(o.node_uuid)||[];t.push(o),e.set(o.node_uuid,t)}return{byNode:e,byAction:i}}const _d=(wd?kl(wd):kl)(gd(md(((t,e)=>({languageNames:{},canvasSize:{width:0,height:0},languageCode:"",workspace:null,flowDefinition:null,flowInfo:null,issuesByNode:new Map,issuesByAction:new Map,isTranslating:!1,viewingRevision:!1,dirtyDate:null,activity:null,simulatorActivity:null,activityEndpoint:null,simulatorActive:!1,setDirtyDate:e=>{t((t=>{t.dirtyDate=e}))},fetchRevision:async(e,i=null)=>{var o;const n=!!i&&"latest"!==i;i||(i="latest");const s=await fetch(`${e}/${i}/?version=${fd}`);if(!s.ok)throw new Error("Network response was not ok");const r=await s.json();vd(r.definition),bd(r.definition);const a=xd(null===(o=r.info)||void 0===o?void 0:o.issues);t({flowInfo:r.info,flowDefinition:r.definition,viewingRevision:n,issuesByNode:a.byNode,issuesByAction:a.byAction})},fetchWorkspace:async e=>{const i=await fetch(e);if(!i.ok)throw new Error("Network response was not ok");const o=await i.json();t({workspace:o})},fetchAllLanguages:async e=>{const i=(await de(e)).reduce((function(t,e){return t[e.value]=e.name,t}),{});t({languageNames:i})},setActivityEndpoint:e=>{t({activityEndpoint:e})},fetchActivity:async e=>{try{const i=await fetch(e);if(!i.ok)return;const o=await i.json();t({activity:o})}catch(t){console.error("Failed to fetch activity:",t)}},updateActivity:e=>{t({activity:e})},updateSimulatorActivity:e=>{t({simulatorActivity:e})},setSimulatorActive:e=>{t({simulatorActive:e})},getCurrentActivity:()=>{const t=e();return t.simulatorActive?t.simulatorActivity:t.activity},getFlowResults:()=>e().flowInfo.results,getResultByKey:t=>e().flowInfo.results.find((e=>e.key===t)),getLanguage:()=>{const t=e(),i=t.languageCode;return{name:t.languageNames[i],code:i}},setFlowContents:e=>{t((t=>{var i,o,n,s;const r=e.definition.language;t.flowDefinition={...e.definition,nodes:[...e.definition.nodes||[]]},t.flowInfo=e.info;const a=xd(null===(i=e.info)||void 0===i?void 0:i.issues);t.issuesByNode=a.byNode,t.issuesByAction=a.byAction,t.languageCode=r,t.isTranslating=!1,vd(t.flowDefinition),bd(t.flowDefinition),(null===(o=t.flowDefinition)||void 0===o?void 0:o.nodes)&&(null===(s=null===(n=t.flowDefinition)||void 0===n?void 0:n._ui)||void 0===s?void 0:s.nodes)&&yd(t.flowDefinition.nodes,t.flowDefinition._ui.nodes)}))},setFlowInfo:e=>{t((t=>{t.flowInfo=e;const i=xd(null==e?void 0:e.issues);t.issuesByNode=i.byNode,t.issuesByAction=i.byAction}))},setRevision:e=>{t((t=>{t.flowDefinition.revision=e}))},setLanguageCode:e=>{t((t=>{t.languageCode=e,t.isTranslating=t.flowDefinition.language!==e}))},expandCanvas:(e,i)=>{t((t=>{const o=Math.max(t.canvasSize.width,e+800),n=Math.max(t.canvasSize.height,i+800);t.canvasSize.width=o,t.canvasSize.height=n}))},updateCanvasPositions:e=>{t((t=>{for(const i in e)t.flowDefinition._ui.nodes[i]?t.flowDefinition._ui.nodes[i].position=e[i]:t.flowDefinition._ui.stickies[i]&&(t.flowDefinition._ui.stickies[i].position=e[i]);yd(t.flowDefinition.nodes,t.flowDefinition._ui.nodes),t.dirtyDate=new Date}))},removeNodes:e=>{t((t=>{for(const i of e)delete t.flowDefinition._ui.nodes[i];t.flowDefinition=pd(t.flowDefinition,(t=>{e.forEach((i=>{const o=t.nodes.find((t=>t.uuid===i));if(!o||!o.exits.length)return;const n=o.exits.map((t=>t.destination_uuid)).filter((t=>t));if(n.length===o.exits.length&&n.every((t=>t===n[0]))){const o=n[0];if(e.includes(o))return;t.nodes.forEach((t=>{t.exits.forEach((t=>{t.destination_uuid===i&&(t.destination_uuid=o)}))}))}})),t.nodes=t.nodes.filter((t=>!e.includes(t.uuid))),t.nodes.forEach((t=>{t.exits.forEach((t=>{e.includes(t.destination_uuid)&&(t.destination_uuid=null)}))})),yd(t.nodes,t._ui.nodes)})),t.dirtyDate=new Date}))},removeStickyNotes:e=>{t((t=>{var i;if(null===(i=t.flowDefinition._ui)||void 0===i?void 0:i.stickies)for(const i of e)delete t.flowDefinition._ui.stickies[i];t.dirtyDate=new Date}))},updateNode:(e,i)=>{t((t=>{var o;const n=null===(o=t.flowDefinition)||void 0===o?void 0:o.nodes.find((t=>t.uuid===e));n&&(n.actions=i.actions,n.uuid=i.uuid,n.exits=i.exits,n.router=i.router),t.dirtyDate=new Date}))},updateNodeUIConfig:(e,i)=>{t((t=>{if(t.flowDefinition._ui.nodes[e]){void 0!==i.type&&(t.flowDefinition._ui.nodes[e].type=i.type),t.flowDefinition._ui.nodes[e].config||(t.flowDefinition._ui.nodes[e].config={});const{type:o,...n}=i;Object.assign(t.flowDefinition._ui.nodes[e].config,n)}t.dirtyDate=new Date}))},updateConnection:(e,i,o)=>{t((t=>{const n=t.flowDefinition.nodes.find((t=>t.uuid===e)),s=null==n?void 0:n.exits.find((t=>t.uuid===i));s&&(s.destination_uuid=o,t.dirtyDate=new Date)}))},updateStickyNote:(e,i)=>{t((t=>{t.flowDefinition._ui.stickies||(t.flowDefinition._ui.stickies={}),t.flowDefinition._ui.stickies[e]=i,t.dirtyDate=new Date}))},createStickyNote:e=>{const i=Xt();return t((t=>{t.flowDefinition._ui.stickies||(t.flowDefinition._ui.stickies={});const o={position:e,title:"",body:"",color:"yellow"};t.flowDefinition._ui.stickies[i]=o,t.dirtyDate=new Date})),i},createNode:(e,i)=>{const o=Xt(),n=Xt();return t((t=>{const s={uuid:o,actions:[],exits:[{uuid:n,destination_uuid:null}]};t.flowDefinition.nodes.push(s),t.flowDefinition._ui.nodes||(t.flowDefinition._ui.nodes={}),t.flowDefinition._ui.nodes[o]={position:i,type:e,config:{}},yd(t.flowDefinition.nodes,t.flowDefinition._ui.nodes),t.dirtyDate=new Date})),o},addNode:(e,i)=>{t((t=>{t.flowDefinition.nodes.push(e),t.flowDefinition._ui.nodes||(t.flowDefinition._ui.nodes={}),t.flowDefinition._ui.nodes[e.uuid]=i,yd(t.flowDefinition.nodes,t.flowDefinition._ui.nodes),t.dirtyDate=new Date}))},updateLocalization:(e,i,o)=>{t((t=>{t.flowDefinition.localization||(t.flowDefinition.localization={}),t.flowDefinition.localization[e]||(t.flowDefinition.localization[e]={}),Object.keys(o).length>0?t.flowDefinition.localization[e][i]=o:delete t.flowDefinition.localization[e][i],0===Object.keys(t.flowDefinition.localization[e]).length&&delete t.flowDefinition.localization[e],0===Object.keys(t.flowDefinition.localization).length&&delete t.flowDefinition.localization,t.dirtyDate=new Date}))},setTranslationFilters:e=>{t((t=>{var i;if(!(null===(i=t.flowDefinition)||void 0===i?void 0:i._ui))return;const o=t.flowDefinition._ui.translation_filters||{categories:!1};t.flowDefinition._ui.translation_filters={...o,categories:!!e.categories},t.dirtyDate=new Date}))},markAutoTranslated:(e,i,o)=>{t((t=>{var n;if(!(null===(n=t.flowDefinition)||void 0===n?void 0:n._ui))return;t.flowDefinition._ui.auto_translations||(t.flowDefinition._ui.auto_translations={}),t.flowDefinition._ui.auto_translations[e]||(t.flowDefinition._ui.auto_translations[e]={});const s=t.flowDefinition._ui.auto_translations[e][i]||[],r=Array.from(new Set([...s,...o||[]]));t.flowDefinition._ui.auto_translations[e][i]=r,t.dirtyDate=new Date}))}})))));var wd;function kd(t,e){return(i,o)=>{mt()(i,o);const n="connectedCallback",s="disconnectedCallback",r=i[n],a=i[s];i[n]=function(){var i;null!==(i=this._zustandUnsubscribe)&&void 0!==i||(this._zustandUnsubscribe={}),this[o]=e(t.getState()),this._zustandUnsubscribe[o]=t.subscribe(e,(t=>{this[o]=t})),r&&r.call(this)},i[s]=function(){var t,e;null===(e=null===(t=this._zustandUnsubscribe)||void 0===t?void 0:t[o])||void 0===e||e.call(t),a&&a.call(this)}}}const{setLocale:Cd}=(t=>(function(t){if(bl)throw new Error("lit-localize can only be configured once");vl=t,bl=!0}(((t,e)=>sl(hl,t,e))),ul=ll=t.sourceLocale,dl=new Set(t.targetLocales),dl.add(t.sourceLocale),cl=t.loadLocale,{getLocale:gl,setLocale:fl}))({sourceLocale:"en",targetLocales:yl,loadLocale:t=>import(`./locales/${t}.js`)}),Sd=()=>document.querySelector("temba-store");class Ad extends Ne{constructor(){super(...arguments),this.settings={},this.ttl=6e4,this.max=20,this.ready=!1,this.loader=!1,this.keyedAssets={},this.locale=[...navigator.languages],this.fields={},this.groups={},this.shortcuts=[],this.languages={},this.featuredFields=[],this.dirtyElements=[],this.pendingResolves={},this.fetching={}}static get styles(){return a`
610
+ `,t([mt({type:Number})],wl.prototype,"scale",void 0),t([mt({type:Boolean})],wl.prototype,"showName",void 0),t([mt({type:Boolean})],wl.prototype,"system",void 0),t([mt({type:String,attribute:!1})],wl.prototype,"bgimage",void 0),t([mt({type:String,attribute:!1})],wl.prototype,"bgcolor",void 0),t([mt({type:String,attribute:!1})],wl.prototype,"initials",void 0),t([mt({type:String})],wl.prototype,"name",void 0),t([mt({type:String})],wl.prototype,"email",void 0),t([mt({type:String})],wl.prototype,"uuid",void 0),t([mt({type:String})],wl.prototype,"avatar",void 0);const kl=t=>{let e;const i=new Set,o=(t,o)=>{const n="function"==typeof t?t(e):t;if(!Object.is(n,e)){const t=e;e=(null!=o?o:"object"!=typeof n||null===n)?n:Object.assign({},e,n),i.forEach((i=>i(e,t)))}},n=()=>e,s={setState:o,getState:n,getInitialState:()=>r,subscribe:t=>(i.add(t),()=>i.delete(t))},r=e=t(o,n,s);return s};var Cl=Symbol.for("immer-nothing"),Sl=Symbol.for("immer-draftable"),Al=Symbol.for("immer-state"),El=[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}];function $l(t,...e){{const i=El[t],o="function"==typeof i?i.apply(null,e):i;throw new Error(`[Immer] ${o}`)}}var Tl=Object.getPrototypeOf;function Dl(t){return!!t&&!!t[Al]}function Ml(t){return!!t&&(Ol(t)||Array.isArray(t)||!!t[Sl]||!!t.constructor?.[Sl]||Nl(t)||Bl(t))}var Il=Object.prototype.constructor.toString();function Ol(t){if(!t||"object"!=typeof t)return!1;const e=Tl(t);if(null===e)return!0;const i=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return i===Object||"function"==typeof i&&Function.toString.call(i)===Il}function Ll(t,e){0===zl(t)?Reflect.ownKeys(t).forEach((i=>{e(i,t[i],t)})):t.forEach(((i,o)=>e(o,i,t)))}function zl(t){const e=t[Al];return e?e.type_:Array.isArray(t)?1:Nl(t)?2:Bl(t)?3:0}function Pl(t,e){return 2===zl(t)?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Rl(t,e,i){const o=zl(t);2===o?t.set(e,i):3===o?t.add(i):t[e]=i}function Nl(t){return t instanceof Map}function Bl(t){return t instanceof Set}function Fl(t){return t.copy_||t.base_}function ql(t,e){if(Nl(t))return new Map(t);if(Bl(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const i=Ol(t);if(!0===e||"class_only"===e&&!i){const e=Object.getOwnPropertyDescriptors(t);delete e[Al];let i=Reflect.ownKeys(e);for(let o=0;o<i.length;o++){const n=i[o],s=e[n];!1===s.writable&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(e[n]={configurable:!0,writable:!0,enumerable:s.enumerable,value:t[n]})}return Object.create(Tl(t),e)}{const e=Tl(t);if(null!==e&&i)return{...t};const o=Object.create(e);return Object.assign(o,t)}}function Ul(t,e=!1){return Vl(t)||Dl(t)||!Ml(t)||(zl(t)>1&&(t.set=t.add=t.clear=t.delete=jl),Object.freeze(t),e&&Object.entries(t).forEach((([t,e])=>Ul(e,!0)))),t}function jl(){$l(2)}function Vl(t){return Object.isFrozen(t)}var Hl,Wl={};function Zl(t){const e=Wl[t];return e||$l(0,t),e}function Yl(){return Hl}function Gl(t,e){e&&(Zl("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function Kl(t){Xl(t),t.drafts_.forEach(Jl),t.drafts_=null}function Xl(t){t===Hl&&(Hl=t.parent_)}function Ql(t){return Hl={drafts_:[],parent_:Hl,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Jl(t){const e=t[Al];0===e.type_||1===e.type_?e.revoke_():e.revoked_=!0}function td(t,e){e.unfinalizedDrafts_=e.drafts_.length;const i=e.drafts_[0];return void 0!==t&&t!==i?(i[Al].modified_&&(Kl(e),$l(4)),Ml(t)&&(t=ed(e,t),e.parent_||od(e,t)),e.patches_&&Zl("Patches").generateReplacementPatches_(i[Al].base_,t,e.patches_,e.inversePatches_)):t=ed(e,i,[]),Kl(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Cl?t:void 0}function ed(t,e,i){if(Vl(e))return e;const o=e[Al];if(!o)return Ll(e,((n,s)=>id(t,o,e,n,s,i))),e;if(o.scope_!==t)return e;if(!o.modified_)return od(t,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const e=o.copy_;let n=e,s=!1;3===o.type_&&(n=new Set(e),e.clear(),s=!0),Ll(n,((n,r)=>id(t,o,e,n,r,i,s))),od(t,e,!1),i&&t.patches_&&Zl("Patches").generatePatches_(o,i,t.patches_,t.inversePatches_)}return o.copy_}function id(t,e,i,o,n,s,r){if(n===i&&$l(5),Dl(n)){const r=ed(t,n,s&&e&&3!==e.type_&&!Pl(e.assigned_,o)?s.concat(o):void 0);if(Rl(i,o,r),!Dl(r))return;t.canAutoFreeze_=!1}else r&&i.add(n);if(Ml(n)&&!Vl(n)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;ed(t,n),e&&e.scope_.parent_||"symbol"==typeof o||!Object.prototype.propertyIsEnumerable.call(i,o)||od(t,n)}}function od(t,e,i=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Ul(e,i)}var nd={get(t,e){if(e===Al)return t;const i=Fl(t);if(!Pl(i,e))return function(t,e,i){const o=ad(e,i);return o?"value"in o?o.value:o.get?.call(t.draft_):void 0}(t,i,e);const o=i[e];return t.finalized_||!Ml(o)?o:o===rd(t.base_,e)?(dd(t),t.copy_[e]=cd(o,t)):o},has:(t,e)=>e in Fl(t),ownKeys:t=>Reflect.ownKeys(Fl(t)),set(t,e,i){const o=ad(Fl(t),e);if(o?.set)return o.set.call(t.draft_,i),!0;if(!t.modified_){const o=rd(Fl(t),e),n=o?.[Al];if(n&&n.base_===i)return t.copy_[e]=i,t.assigned_[e]=!1,!0;if(function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}(i,o)&&(void 0!==i||Pl(t.base_,e)))return!0;dd(t),ld(t)}return t.copy_[e]===i&&(void 0!==i||e in t.copy_)||Number.isNaN(i)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=i,t.assigned_[e]=!0),!0},deleteProperty:(t,e)=>(void 0!==rd(t.base_,e)||e in t.base_?(t.assigned_[e]=!1,dd(t),ld(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0),getOwnPropertyDescriptor(t,e){const i=Fl(t),o=Reflect.getOwnPropertyDescriptor(i,e);return o?{writable:!0,configurable:1!==t.type_||"length"!==e,enumerable:o.enumerable,value:i[e]}:o},defineProperty(){$l(11)},getPrototypeOf:t=>Tl(t.base_),setPrototypeOf(){$l(12)}},sd={};function rd(t,e){const i=t[Al];return(i?Fl(i):t)[e]}function ad(t,e){if(!(e in t))return;let i=Tl(t);for(;i;){const t=Object.getOwnPropertyDescriptor(i,e);if(t)return t;i=Tl(i)}}function ld(t){t.modified_||(t.modified_=!0,t.parent_&&ld(t.parent_))}function dd(t){t.copy_||(t.copy_=ql(t.base_,t.scope_.immer_.useStrictShallowCopy_))}Ll(nd,((t,e)=>{sd[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}})),sd.deleteProperty=function(t,e){return isNaN(parseInt(e))&&$l(13),sd.set.call(this,t,e,void 0)},sd.set=function(t,e,i){return"length"!==e&&isNaN(parseInt(e))&&$l(14),nd.set.call(this,t[0],e,i,t[0])};function cd(t,e){const i=Nl(t)?Zl("MapSet").proxyMap_(t,e):Bl(t)?Zl("MapSet").proxySet_(t,e):function(t,e){const i=Array.isArray(t),o={type_:i?1:0,scope_:e?e.scope_:Yl(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let n=o,s=nd;i&&(n=[o],s=sd);const{revoke:r,proxy:a}=Proxy.revocable(n,s);return o.draft_=a,o.revoke_=r,a}(t,e);return(e?e.scope_:Yl()).drafts_.push(i),i}function hd(t){if(!Ml(t)||Vl(t))return t;const e=t[Al];let i;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,i=ql(t,e.scope_.immer_.useStrictShallowCopy_)}else i=ql(t,!0);return Ll(i,((t,e)=>{Rl(i,t,hd(e))})),e&&(e.finalized_=!1),i}var ud=new class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,e,i)=>{if("function"==typeof t&&"function"!=typeof e){const i=e;e=t;const o=this;return function(t=i,...n){return o.produce(t,(t=>e.call(this,t,...n)))}}let o;if("function"!=typeof e&&$l(6),void 0!==i&&"function"!=typeof i&&$l(7),Ml(t)){const n=Ql(this),s=cd(t,void 0);let r=!0;try{o=e(s),r=!1}finally{r?Kl(n):Xl(n)}return Gl(n,i),td(o,n)}if(!t||"object"!=typeof t){if(o=e(t),void 0===o&&(o=t),o===Cl&&(o=void 0),this.autoFreeze_&&Ul(o,!0),i){const e=[],n=[];Zl("Patches").generateReplacementPatches_(t,o,e,n),i(e,n)}return o}$l(1,t)},this.produceWithPatches=(t,e)=>{if("function"==typeof t)return(e,...i)=>this.produceWithPatches(e,(e=>t(e,...i)));let i,o;const n=this.produce(t,e,((t,e)=>{i=t,o=e}));return[n,i,o]},"boolean"==typeof t?.autoFreeze&&this.setAutoFreeze(t.autoFreeze),"boolean"==typeof t?.useStrictShallowCopy&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){Ml(t)||$l(8),Dl(t)&&(t=function(t){Dl(t)||$l(10,t);return hd(t)}(t));const e=Ql(this),i=cd(t,void 0);return i[Al].isManual_=!0,Xl(e),i}finishDraft(t,e){const i=t&&t[Al];i&&i.isManual_||$l(9);const{scope_:o}=i;return Gl(o,e),td(void 0,o)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let i;for(i=e.length-1;i>=0;i--){const o=e[i];if(0===o.path.length&&"replace"===o.op){t=o.value;break}}i>-1&&(e=e.slice(i+1));const o=Zl("Patches").applyPatches_;return Dl(t)?o(t,e):this.produce(t,(t=>o(t,e)))}},pd=ud.produce;ud.produceWithPatches.bind(ud),ud.setAutoFreeze.bind(ud),ud.setUseStrictShallowCopy.bind(ud),ud.applyPatches.bind(ud),ud.createDraft.bind(ud),ud.finishDraft.bind(ud);const md=t=>(e,i,o)=>(o.setState=(t,i,...o)=>{const n="function"==typeof t?pd(t):t;return e(n,i,...o)},t(o.setState,i,o)),gd=t=>(e,i,o)=>{const n=o.subscribe;o.subscribe=(t,e,i)=>{let s=t;if(e){const n=(null==i?void 0:i.equalityFn)||Object.is;let r=t(o.getState());s=i=>{const o=t(i);if(!n(r,o)){const t=r;e(r=o,t)}},(null==i?void 0:i.fireImmediately)&&e(r,r)}return n(s)};return t(e,i,o)},fd="14.3";function vd(t){var e,i;if((null==t?void 0:t.nodes)&&(null===(e=null==t?void 0:t._ui)||void 0===e?void 0:e.nodes))for(const e of t.nodes){const o=t._ui.nodes[e.uuid];if(!o)continue;const n=null===(i=e.actions)||void 0===i?void 0:i.some((t=>!0===t.terminal));"execute_actions"===o.type&&n?o.type="terminal":"terminal"!==o.type||n||(o.type="execute_actions")}}function yd(t){var e,i,o;if((null==t?void 0:t.nodes)&&(null===(e=null==t?void 0:t._ui)||void 0===e?void 0:e.nodes))for(const e of t.nodes){const n=t._ui.nodes[e.uuid];if(!n||"wait_for_response"!==n.type)continue;const s=null===(o=null===(i=e.router)||void 0===i?void 0:i.wait)||void 0===o?void 0:o.hint;s&&("digits"===s.type&&1===s.count?n.type="wait_for_menu":"digits"===s.type?n.type="wait_for_digits":"audio"===s.type&&(n.type="wait_for_audio"))}}function bd(t,e){t.sort(((t,i)=>{var o,n;const s=null===(o=e[t.uuid])||void 0===o?void 0:o.position,r=null===(n=e[i.uuid])||void 0===n?void 0:n.position;return s&&r?s.top!==r.top?s.top-r.top:s.left-r.left:0}))}function xd(t=[]){const e=new Map,i=new Map;for(const o of t)if(o.action_uuid){const t=i.get(o.action_uuid)||[];t.push(o),i.set(o.action_uuid,t)}else{const t=e.get(o.node_uuid)||[];t.push(o),e.set(o.node_uuid,t)}return{byNode:e,byAction:i}}const _d=(wd?kl(wd):kl)(gd(md(((t,e)=>({languageNames:{},canvasSize:{width:0,height:0},languageCode:"",workspace:null,flowDefinition:null,flowInfo:null,issuesByNode:new Map,issuesByAction:new Map,isTranslating:!1,viewingRevision:!1,dirtyDate:null,activity:null,simulatorActivity:null,activityEndpoint:null,simulatorActive:!1,setDirtyDate:e=>{t((t=>{t.dirtyDate=e}))},fetchRevision:async(e,i=null)=>{var o;const n=!!i&&"latest"!==i;i||(i="latest");const s=await fetch(`${e}/${i}/?version=${fd}`);if(!s.ok)throw new Error("Network response was not ok");const r=await s.json();vd(r.definition),yd(r.definition);const a=xd(null===(o=r.info)||void 0===o?void 0:o.issues);t({flowInfo:r.info,flowDefinition:r.definition,viewingRevision:n,issuesByNode:a.byNode,issuesByAction:a.byAction})},fetchWorkspace:async e=>{const i=await fetch(e);if(!i.ok)throw new Error("Network response was not ok");const o=await i.json();t({workspace:o})},fetchAllLanguages:async e=>{const i=(await de(e)).reduce((function(t,e){return t[e.value]=e.name,t}),{});t({languageNames:i})},setActivityEndpoint:e=>{t({activityEndpoint:e})},fetchActivity:async e=>{try{const i=await fetch(e);if(!i.ok)return;const o=await i.json();t({activity:o})}catch(t){console.error("Failed to fetch activity:",t)}},updateActivity:e=>{t({activity:e})},updateSimulatorActivity:e=>{t({simulatorActivity:e})},setSimulatorActive:e=>{t({simulatorActive:e})},getCurrentActivity:()=>{const t=e();return t.simulatorActive?t.simulatorActivity:t.activity},getFlowResults:()=>e().flowInfo.results,getResultByKey:t=>e().flowInfo.results.find((e=>e.key===t)),getLanguage:()=>{const t=e(),i=t.languageCode;return{name:t.languageNames[i],code:i}},clearFlowData:()=>{t({flowDefinition:null,flowInfo:null,issuesByNode:new Map,issuesByAction:new Map,activity:null,simulatorActivity:null,simulatorActive:!1,dirtyDate:null,viewingRevision:!1})},setFlowContents:e=>{t((t=>{var i,o,n,s;const r=e.definition.language;t.flowDefinition={...e.definition,nodes:[...e.definition.nodes||[]]},t.flowInfo=e.info;const a=xd(null===(i=e.info)||void 0===i?void 0:i.issues);t.issuesByNode=a.byNode,t.issuesByAction=a.byAction,t.languageCode=r,t.isTranslating=!1,vd(t.flowDefinition),yd(t.flowDefinition),(null===(o=t.flowDefinition)||void 0===o?void 0:o.nodes)&&(null===(s=null===(n=t.flowDefinition)||void 0===n?void 0:n._ui)||void 0===s?void 0:s.nodes)&&bd(t.flowDefinition.nodes,t.flowDefinition._ui.nodes)}))},setFlowInfo:e=>{t((t=>{t.flowInfo=e;const i=xd(null==e?void 0:e.issues);t.issuesByNode=i.byNode,t.issuesByAction=i.byAction}))},setRevision:e=>{t((t=>{t.flowDefinition.revision=e}))},setLanguageCode:e=>{t((t=>{t.languageCode=e,t.isTranslating=t.flowDefinition.language!==e}))},expandCanvas:(e,i)=>{t((t=>{const o=Math.max(t.canvasSize.width,e+800),n=Math.max(t.canvasSize.height,i+800);t.canvasSize.width=o,t.canvasSize.height=n}))},updateCanvasPositions:e=>{t((t=>{for(const i in e)t.flowDefinition._ui.nodes[i]?t.flowDefinition._ui.nodes[i].position=e[i]:t.flowDefinition._ui.stickies[i]&&(t.flowDefinition._ui.stickies[i].position=e[i]);bd(t.flowDefinition.nodes,t.flowDefinition._ui.nodes),t.dirtyDate=new Date}))},removeNodes:e=>{t((t=>{for(const i of e)delete t.flowDefinition._ui.nodes[i];t.flowDefinition=pd(t.flowDefinition,(t=>{e.forEach((i=>{const o=t.nodes.find((t=>t.uuid===i));if(!o||!o.exits.length)return;const n=o.exits.map((t=>t.destination_uuid)).filter((t=>t));if(n.length===o.exits.length&&n.every((t=>t===n[0]))){const o=n[0];if(e.includes(o))return;t.nodes.forEach((t=>{t.exits.forEach((t=>{t.destination_uuid===i&&(t.destination_uuid=o)}))}))}})),t.nodes=t.nodes.filter((t=>!e.includes(t.uuid))),t.nodes.forEach((t=>{t.exits.forEach((t=>{e.includes(t.destination_uuid)&&(t.destination_uuid=null)}))})),bd(t.nodes,t._ui.nodes)})),t.dirtyDate=new Date}))},removeStickyNotes:e=>{t((t=>{var i;if(null===(i=t.flowDefinition._ui)||void 0===i?void 0:i.stickies)for(const i of e)delete t.flowDefinition._ui.stickies[i];t.dirtyDate=new Date}))},updateNode:(e,i)=>{t((t=>{var o;const n=null===(o=t.flowDefinition)||void 0===o?void 0:o.nodes.find((t=>t.uuid===e));n&&(n.actions=i.actions,n.uuid=i.uuid,n.exits=i.exits,n.router=i.router),t.dirtyDate=new Date}))},updateNodeUIConfig:(e,i)=>{t((t=>{if(t.flowDefinition._ui.nodes[e]){void 0!==i.type&&(t.flowDefinition._ui.nodes[e].type=i.type),t.flowDefinition._ui.nodes[e].config||(t.flowDefinition._ui.nodes[e].config={});const{type:o,...n}=i;Object.assign(t.flowDefinition._ui.nodes[e].config,n)}t.dirtyDate=new Date}))},updateConnection:(e,i,o)=>{t((t=>{const n=t.flowDefinition.nodes.find((t=>t.uuid===e)),s=null==n?void 0:n.exits.find((t=>t.uuid===i));s&&(s.destination_uuid=o,t.dirtyDate=new Date)}))},updateStickyNote:(e,i)=>{t((t=>{t.flowDefinition._ui.stickies||(t.flowDefinition._ui.stickies={}),t.flowDefinition._ui.stickies[e]=i,t.dirtyDate=new Date}))},createStickyNote:e=>{const i=Xt();return t((t=>{t.flowDefinition._ui.stickies||(t.flowDefinition._ui.stickies={});const o={position:e,title:"",body:"",color:"yellow"};t.flowDefinition._ui.stickies[i]=o,t.dirtyDate=new Date})),i},createNode:(e,i)=>{const o=Xt(),n=Xt();return t((t=>{const s={uuid:o,actions:[],exits:[{uuid:n,destination_uuid:null}]};t.flowDefinition.nodes.push(s),t.flowDefinition._ui.nodes||(t.flowDefinition._ui.nodes={}),t.flowDefinition._ui.nodes[o]={position:i,type:e,config:{}},bd(t.flowDefinition.nodes,t.flowDefinition._ui.nodes),t.dirtyDate=new Date})),o},addNode:(e,i)=>{t((t=>{t.flowDefinition.nodes.push(e),t.flowDefinition._ui.nodes||(t.flowDefinition._ui.nodes={}),t.flowDefinition._ui.nodes[e.uuid]=i,bd(t.flowDefinition.nodes,t.flowDefinition._ui.nodes),t.dirtyDate=new Date}))},updateLocalization:(e,i,o)=>{t((t=>{t.flowDefinition.localization||(t.flowDefinition.localization={}),t.flowDefinition.localization[e]||(t.flowDefinition.localization[e]={}),Object.keys(o).length>0?t.flowDefinition.localization[e][i]=o:delete t.flowDefinition.localization[e][i],0===Object.keys(t.flowDefinition.localization[e]).length&&delete t.flowDefinition.localization[e],0===Object.keys(t.flowDefinition.localization).length&&delete t.flowDefinition.localization,t.dirtyDate=new Date}))},setTranslationFilters:e=>{t((t=>{var i;if(!(null===(i=t.flowDefinition)||void 0===i?void 0:i._ui))return;const o=t.flowDefinition._ui.translation_filters||{categories:!1};t.flowDefinition._ui.translation_filters={...o,categories:!!e.categories},t.dirtyDate=new Date}))},markAutoTranslated:(e,i,o)=>{t((t=>{var n;if(!(null===(n=t.flowDefinition)||void 0===n?void 0:n._ui))return;t.flowDefinition._ui.auto_translations||(t.flowDefinition._ui.auto_translations={}),t.flowDefinition._ui.auto_translations[e]||(t.flowDefinition._ui.auto_translations[e]={});const s=t.flowDefinition._ui.auto_translations[e][i]||[],r=Array.from(new Set([...s,...o||[]]));t.flowDefinition._ui.auto_translations[e][i]=r,t.dirtyDate=new Date}))}})))));var wd;function kd(t,e){return(i,o)=>{mt()(i,o);const n="connectedCallback",s="disconnectedCallback",r=i[n],a=i[s];i[n]=function(){var i;null!==(i=this._zustandUnsubscribe)&&void 0!==i||(this._zustandUnsubscribe={}),this[o]=e(t.getState()),this._zustandUnsubscribe[o]=t.subscribe(e,(t=>{this[o]=t})),r&&r.call(this)},i[s]=function(){var t,e;null===(e=null===(t=this._zustandUnsubscribe)||void 0===t?void 0:t[o])||void 0===e||e.call(t),a&&a.call(this)}}}const{setLocale:Cd}=(t=>(function(t){if(yl)throw new Error("lit-localize can only be configured once");vl=t,yl=!0}(((t,e)=>sl(hl,t,e))),ul=ll=t.sourceLocale,dl=new Set(t.targetLocales),dl.add(t.sourceLocale),cl=t.loadLocale,{getLocale:gl,setLocale:fl}))({sourceLocale:"en",targetLocales:bl,loadLocale:t=>import(`./locales/${t}.js`)}),Sd=()=>document.querySelector("temba-store");class Ad extends Ne{constructor(){super(...arguments),this.settings={},this.ttl=6e4,this.max=20,this.ready=!1,this.loader=!1,this.keyedAssets={},this.locale=[...navigator.languages],this.fields={},this.groups={},this.shortcuts=[],this.languages={},this.featuredFields=[],this.dirtyElements=[],this.pendingResolves={},this.fetching={}}static get styles(){return a`
611
611
  :host {
612
612
  position: fixed;
613
613
  z-index: 1000;
@@ -618,7 +618,7 @@ let vl=Ka,bl=!1;const yl=["es","fr","pt"],xl="data:image/png;base64,iVBORw0KGgoA
618
618
  width: 100%;
619
619
  top: 0.5em;
620
620
  }
621
- `}markDirty(t){this.dirtyElements.includes(t)||this.dirtyElements.push(t)}cleanAll(){this.dirtyElements.forEach((t=>t.markClean())),this.dirtyElements=[]}markClean(t){this.dirtyElements=this.dirtyElements.filter((e=>e!==t))}getDirtyMessage(){if(this.dirtyElements.length>0)return this.dirtyElements[0].dirtyMessage||"You have unsaved changes, are you sure you want to continue?"}getLocale(){return this.locale[0]}clearCache(){this.cache=Lo(this.max,this.ttl)}reset(){const t=this.getState();this.ready=!1,this.clearCache(),this.settings=JSON.parse(xe("settings")||"{}");const e=[];this.completionEndpoint&&e.push(re(this.completionEndpoint).then((t=>{this.schema=t.json.context,this.fnOptions=t.json.functions}))),this.fieldsEndpoint&&e.push(this.refreshFields()),this.globalsEndpoint&&e.push(he(this.globalsEndpoint).then((t=>{this.keyedAssets.globals=t.map((t=>t.key))}))),this.languagesEndpoint&&(t.fetchAllLanguages(this.languagesEndpoint),e.push(he(this.languagesEndpoint).then((t=>{this.languages=t.reduce((function(t,e){return t[e.value]=e.name,t}),{})})))),this.groupsEndpoint&&e.push(he(this.groupsEndpoint).then((t=>{t.forEach((t=>{this.groups[t.uuid]=t}))}))),this.workspaceEndpoint&&(t.fetchWorkspace(this.workspaceEndpoint),e.push(re(this.workspaceEndpoint).then((t=>{this.workspace=t.json;const e=t.headers.get("content-language");e&&(this.locale=[e,...this.locale])})))),this.shortcutsEndpoint&&e.push(this.refreshShortcuts()),this.initialHttpComplete=Promise.all(e),this.initialHttpComplete.then((()=>{this.ready=!0}))}getShortcuts(){return this.shortcuts||[]}firstUpdated(){this.reset()}getLanguageCode(){return this.locale.length>0?this.locale[0].split("-")[0]:"en"}async refreshGlobals(){return he(this.globalsEndpoint).then((t=>{this.keyedAssets.globals=t.map((t=>t.key))}))}async refreshShortcuts(){return he(this.shortcutsEndpoint).then((t=>{this.shortcuts=t}))}async refreshFields(){return he(this.fieldsEndpoint).then((t=>{this.keyedAssets.fields=[],this.featuredFields=[],t.forEach((t=>{this.keyedAssets.fields.push(t.key),this.fields[t.key]=t,t.featured&&this.featuredFields.push(t)})),this.featuredFields.sort(((t,e)=>e.priority-t.priority)),this.keyedAssets.fields.sort(),this.fireCustomEvent(Mo.StoreUpdated,{url:this.fieldsEndpoint,data:this.keyedAssets.fields})}))}shiftAndRound(t,e,i){const o=Math.round(t.shiftTo(e).get(e));return 1==o?`1 ${i}`:`${o} ${e}`}getCountdown(t){const e=t.diff(Za.now()).rescale();return e.months>0?"> 1 month":e.days>1?`~ ${this.shiftAndRound(e,"days","day")}`:e.hours>0?`~ ${this.shiftAndRound(e,"hours","hour")}`:`~ ${this.shiftAndRound(e,"minutes","minute")}`}getShortDuration(t,e=null){const i=e||Za.now();return t.setLocale(this.locale[0]).toRelative({base:i,style:"long"})}getShortDurationFromIso(t,e=null){const i=Za.fromISO(t),o=e?Za.fromISO(e):Za.now();return this.getShortDuration(i,o)}setKeyedAssets(t,e){this.keyedAssets[t]=e}updated(t){if(super.updated(t),t.has("ready")&&this.ready){const t=this.getLanguageCode(),e=yl.find((e=>e===t));e&&Cd(e)}}getCompletionSchema(){return this.schema}getFunctions(){return this.fnOptions}getKeyedAssets(){return this.keyedAssets}getFieldKeys(){return this.keyedAssets.fields||[]}getContactField(t){return this.fields[t]}getFeaturedFields(){return this.featuredFields}getLanguageName(t){return this.languages[t]}isDynamicGroup(t){const e=this.groups[t];return!(e&&!e.query)}getWorkspace(){return this.workspace}formatDate(t){return Za.fromISO(t).setLocale(this.getLocale()).toLocaleString(Za.DATETIME_SHORT)}postJSON(t,e=""){return pe(t,e)}postForm(t,e,i={}){return((t,e,i={})=>{const o=new FormData;return Object.keys(e).forEach((t=>{o.append(t,e[t])})),me(t,o,i)})(t,e,i)}postUrl(t,e="",i={},o=null){return ue(t,e,i,o)}getUrl(t,e){return!(e=e||{}).force&&this.cache.has(t)?new Promise((e=>{e(this.cache.get(t))})):re(t,e.controller,e.headers||{}).then((i=>new Promise(((o,n)=>{i.status>=200&&i.status<=300?(e.skipCache||this.cache.set(t,i),o(i)):n("Status: "+i.status)}))))}getResults(t,e){e=e||{};const i="results_"+t,o=this.cache.get(i);return!e.force&&o?new Promise((t=>{t(o)})):new Promise((e=>{const o=this.pendingResolves[t]||[];o.push(e),this.pendingResolves[t]=o,o.length<=1&&de(t).then((e=>{this.cache.set(i,e);const o=this.pendingResolves[t]||[];for(;o.length>0;){o.pop()(e)}}))}))}updateCache(t,e){this.cache.set(t,e),this.fireCustomEvent(Mo.StoreUpdated,{url:t,data:e})}removeFromCache(t){this.cache.delete(t)}resolveUsers(t,e){return new Promise((i=>{const o=new Set;t.forEach((t=>{e.forEach((e=>{const i=e.split(".");let n=t;for(let t=0;t<i.length&&(n=n[i[t]],n);t++);n&&n.uuid&&o.add(n.uuid)}))}));const n=[];o.forEach((t=>{n.push(this.getUrl(`/api/v2/users.json?uuid=${encodeURIComponent(t)}`,{force:!0}))})),Promise.all(n).then((o=>{o.forEach((i=>{if(i&&i.json){const o=i.json.results;if(o&&1===o.length){const i=o[0];t.forEach((t=>{e.forEach((e=>{const o=e.split(".");let n=t,s=n;for(let t=0;t<o.length&&(s=n,n=n[o[t]],n);t++);if(n&&n.email===i.email){const t=s[o[o.length-1]];t.avatar=i.avatar,t.name=_l(i),t.uuid=i.uuid,s[o[o.length-1]].avatar=i.avatar}}))}))}}})),i()}))}))}makeRequest(t,e){const i=this.fetching[t],o=(new Date).getTime();if(i)return void setTimeout((()=>{this.makeRequest(t,e)}),500);let n=this.cache.get(t);n&&!e.force?(n=e.prepareData?e.prepareData(n):n,this.fireCustomEvent(Mo.StoreUpdated,{url:t,data:n})):(e=e||{},this.fetching[t]=o,de(t).then((i=>{i?(this.cache.set(t,i),delete this.fetching[t],i=e.prepareData?e.prepareData(i):i,this.fireCustomEvent(Mo.StoreUpdated,{url:t,data:i})):delete this.fetching[t]})))}get(t,e=null){return this.settings[t]||e}set(t,e){this.settings[t]=e}render(){if(!this.ready&&this.loader)return H`<temba-loading size="10" units="8"></temba-loading>`}getCompletions(t){const e=this.getState().flowInfo;return"results"===t?e.results.map((t=>t.key)):"locals"===t?e.locals:this.keyedAssets[t]||[]}getApp(){return _d}getState(){return _d.getState()}}t([mt({type:Number})],Ad.prototype,"ttl",void 0),t([mt({type:Number})],Ad.prototype,"max",void 0),t([mt({type:Boolean})],Ad.prototype,"ready",void 0),t([mt({type:Boolean})],Ad.prototype,"loader",void 0),t([mt({type:String,attribute:"completion"})],Ad.prototype,"completionEndpoint",void 0),t([mt({type:String,attribute:"fields"})],Ad.prototype,"fieldsEndpoint",void 0),t([mt({type:String,attribute:"groups"})],Ad.prototype,"groupsEndpoint",void 0),t([mt({type:String,attribute:"globals"})],Ad.prototype,"globalsEndpoint",void 0),t([mt({type:String,attribute:"languages"})],Ad.prototype,"languagesEndpoint",void 0),t([mt({type:String,attribute:"workspace"})],Ad.prototype,"workspaceEndpoint",void 0),t([mt({type:String,attribute:"shortcuts"})],Ad.prototype,"shortcutsEndpoint",void 0),t([mt({type:Object,attribute:!1})],Ad.prototype,"schema",void 0),t([mt({type:Object,attribute:!1})],Ad.prototype,"fnOptions",void 0),t([mt({type:Object,attribute:!1})],Ad.prototype,"keyedAssets",void 0);class Ed extends Ne{constructor(){super(...arguments),this.marginHorizontal=0,this.marginVertical=7,this.scrollPct=75,this.cursorIndex=-1,this.internalFocusDisabled=!1,this.nameKey="name",this.loading=!1,this.hideShadow=!1,this.getName=function(t){return t[this.nameKey||"name"]},this.renderInputOption=function(){return null},this.scrollHeight=0,this.triggerScroll=!1,this.showEmptyMessage=!1,this.scrollParent=null,this.setCursor=ve((function(t){this.internalFocusDisabled||t!==this.cursorIndex&&(this.cursorIndex=t)}),50)}static get styles(){return a`
621
+ `}markDirty(t){this.dirtyElements.includes(t)||this.dirtyElements.push(t)}cleanAll(){this.dirtyElements.forEach((t=>t.markClean())),this.dirtyElements=[]}markClean(t){this.dirtyElements=this.dirtyElements.filter((e=>e!==t))}getDirtyMessage(){if(this.dirtyElements.length>0)return this.dirtyElements[0].dirtyMessage||"You have unsaved changes, are you sure you want to continue?"}getLocale(){return this.locale[0]}clearCache(){this.cache=Lo(this.max,this.ttl)}reset(){const t=this.getState();this.ready=!1,this.clearCache(),this.settings=JSON.parse(xe("settings")||"{}");const e=[];this.completionEndpoint&&e.push(re(this.completionEndpoint).then((t=>{this.schema=t.json.context,this.fnOptions=t.json.functions}))),this.fieldsEndpoint&&e.push(this.refreshFields()),this.globalsEndpoint&&e.push(he(this.globalsEndpoint).then((t=>{this.keyedAssets.globals=t.map((t=>t.key))}))),this.languagesEndpoint&&(t.fetchAllLanguages(this.languagesEndpoint),e.push(he(this.languagesEndpoint).then((t=>{this.languages=t.reduce((function(t,e){return t[e.value]=e.name,t}),{})})))),this.groupsEndpoint&&e.push(he(this.groupsEndpoint).then((t=>{t.forEach((t=>{this.groups[t.uuid]=t}))}))),this.workspaceEndpoint&&(t.fetchWorkspace(this.workspaceEndpoint),e.push(re(this.workspaceEndpoint).then((t=>{this.workspace=t.json;const e=t.headers.get("content-language");e&&(this.locale=[e,...this.locale])})))),this.shortcutsEndpoint&&e.push(this.refreshShortcuts()),this.initialHttpComplete=Promise.all(e),this.initialHttpComplete.then((()=>{this.ready=!0}))}getShortcuts(){return this.shortcuts||[]}firstUpdated(){this.reset()}getLanguageCode(){return this.locale.length>0?this.locale[0].split("-")[0]:"en"}async refreshGlobals(){return he(this.globalsEndpoint).then((t=>{this.keyedAssets.globals=t.map((t=>t.key))}))}async refreshShortcuts(){return he(this.shortcutsEndpoint).then((t=>{this.shortcuts=t}))}async refreshFields(){return he(this.fieldsEndpoint).then((t=>{this.keyedAssets.fields=[],this.featuredFields=[],t.forEach((t=>{this.keyedAssets.fields.push(t.key),this.fields[t.key]=t,t.featured&&this.featuredFields.push(t)})),this.featuredFields.sort(((t,e)=>e.priority-t.priority)),this.keyedAssets.fields.sort(),this.fireCustomEvent(Mo.StoreUpdated,{url:this.fieldsEndpoint,data:this.keyedAssets.fields})}))}shiftAndRound(t,e,i){const o=Math.round(t.shiftTo(e).get(e));return 1==o?`1 ${i}`:`${o} ${e}`}getCountdown(t){const e=t.diff(Za.now()).rescale();return e.months>0?"> 1 month":e.days>1?`~ ${this.shiftAndRound(e,"days","day")}`:e.hours>0?`~ ${this.shiftAndRound(e,"hours","hour")}`:`~ ${this.shiftAndRound(e,"minutes","minute")}`}getShortDuration(t,e=null){const i=e||Za.now();return t.setLocale(this.locale[0]).toRelative({base:i,style:"long"})}getShortDurationFromIso(t,e=null){const i=Za.fromISO(t),o=e?Za.fromISO(e):Za.now();return this.getShortDuration(i,o)}setKeyedAssets(t,e){this.keyedAssets[t]=e}updated(t){if(super.updated(t),t.has("ready")&&this.ready){const t=this.getLanguageCode(),e=bl.find((e=>e===t));e&&Cd(e)}}getCompletionSchema(){return this.schema}getFunctions(){return this.fnOptions}getKeyedAssets(){return this.keyedAssets}getFieldKeys(){return this.keyedAssets.fields||[]}getContactField(t){return this.fields[t]}getFeaturedFields(){return this.featuredFields}getLanguageName(t){return this.languages[t]}isDynamicGroup(t){const e=this.groups[t];return!(e&&!e.query)}getWorkspace(){return this.workspace}formatDate(t){return Za.fromISO(t).setLocale(this.getLocale()).toLocaleString(Za.DATETIME_SHORT)}postJSON(t,e=""){return pe(t,e)}postForm(t,e,i={}){return((t,e,i={})=>{const o=new FormData;return Object.keys(e).forEach((t=>{o.append(t,e[t])})),me(t,o,i)})(t,e,i)}postUrl(t,e="",i={},o=null){return ue(t,e,i,o)}getUrl(t,e){return!(e=e||{}).force&&this.cache.has(t)?new Promise((e=>{e(this.cache.get(t))})):re(t,e.controller,e.headers||{}).then((i=>new Promise(((o,n)=>{i.status>=200&&i.status<=300?(e.skipCache||this.cache.set(t,i),o(i)):n("Status: "+i.status)}))))}getResults(t,e){e=e||{};const i="results_"+t,o=this.cache.get(i);return!e.force&&o?new Promise((t=>{t(o)})):new Promise((e=>{const o=this.pendingResolves[t]||[];o.push(e),this.pendingResolves[t]=o,o.length<=1&&de(t).then((e=>{this.cache.set(i,e);const o=this.pendingResolves[t]||[];for(;o.length>0;){o.pop()(e)}}))}))}updateCache(t,e){this.cache.set(t,e),this.fireCustomEvent(Mo.StoreUpdated,{url:t,data:e})}removeFromCache(t){this.cache.delete(t)}resolveUsers(t,e){return new Promise((i=>{const o=new Set;t.forEach((t=>{e.forEach((e=>{const i=e.split(".");let n=t;for(let t=0;t<i.length&&(n=n[i[t]],n);t++);n&&n.uuid&&o.add(n.uuid)}))}));const n=[];o.forEach((t=>{n.push(this.getUrl(`/api/v2/users.json?uuid=${encodeURIComponent(t)}`,{force:!0}))})),Promise.all(n).then((o=>{o.forEach((i=>{if(i&&i.json){const o=i.json.results;if(o&&1===o.length){const i=o[0];t.forEach((t=>{e.forEach((e=>{const o=e.split(".");let n=t,s=n;for(let t=0;t<o.length&&(s=n,n=n[o[t]],n);t++);if(n&&n.email===i.email){const t=s[o[o.length-1]];t.avatar=i.avatar,t.name=_l(i),t.uuid=i.uuid,s[o[o.length-1]].avatar=i.avatar}}))}))}}})),i()}))}))}makeRequest(t,e){const i=this.fetching[t],o=(new Date).getTime();if(i)return void setTimeout((()=>{this.makeRequest(t,e)}),500);let n=this.cache.get(t);n&&!e.force?(n=e.prepareData?e.prepareData(n):n,this.fireCustomEvent(Mo.StoreUpdated,{url:t,data:n})):(e=e||{},this.fetching[t]=o,de(t).then((i=>{i?(this.cache.set(t,i),delete this.fetching[t],i=e.prepareData?e.prepareData(i):i,this.fireCustomEvent(Mo.StoreUpdated,{url:t,data:i})):delete this.fetching[t]})))}get(t,e=null){return this.settings[t]||e}set(t,e){this.settings[t]=e}render(){if(!this.ready&&this.loader)return H`<temba-loading size="10" units="8"></temba-loading>`}getCompletions(t){const e=this.getState().flowInfo;return"results"===t?e.results.map((t=>t.key)):"locals"===t?e.locals:this.keyedAssets[t]||[]}getApp(){return _d}getState(){return _d.getState()}}t([mt({type:Number})],Ad.prototype,"ttl",void 0),t([mt({type:Number})],Ad.prototype,"max",void 0),t([mt({type:Boolean})],Ad.prototype,"ready",void 0),t([mt({type:Boolean})],Ad.prototype,"loader",void 0),t([mt({type:String,attribute:"completion"})],Ad.prototype,"completionEndpoint",void 0),t([mt({type:String,attribute:"fields"})],Ad.prototype,"fieldsEndpoint",void 0),t([mt({type:String,attribute:"groups"})],Ad.prototype,"groupsEndpoint",void 0),t([mt({type:String,attribute:"globals"})],Ad.prototype,"globalsEndpoint",void 0),t([mt({type:String,attribute:"languages"})],Ad.prototype,"languagesEndpoint",void 0),t([mt({type:String,attribute:"workspace"})],Ad.prototype,"workspaceEndpoint",void 0),t([mt({type:String,attribute:"shortcuts"})],Ad.prototype,"shortcutsEndpoint",void 0),t([mt({type:Object,attribute:!1})],Ad.prototype,"schema",void 0),t([mt({type:Object,attribute:!1})],Ad.prototype,"fnOptions",void 0),t([mt({type:Object,attribute:!1})],Ad.prototype,"keyedAssets",void 0);class Ed extends Ne{constructor(){super(...arguments),this.marginHorizontal=0,this.marginVertical=7,this.scrollPct=75,this.cursorIndex=-1,this.internalFocusDisabled=!1,this.nameKey="name",this.loading=!1,this.hideShadow=!1,this.getName=function(t){return t[this.nameKey||"name"]},this.renderInputOption=function(){return null},this.scrollHeight=0,this.triggerScroll=!1,this.showEmptyMessage=!1,this.scrollParent=null,this.setCursor=ve((function(t){this.internalFocusDisabled||t!==this.cursorIndex&&(this.cursorIndex=t)}),50)}static get styles(){return a`
622
622
  :host {
623
623
  --transition-speed: 0;
624
624
  }
@@ -886,7 +886,7 @@ let vl=Ka,bl=!1;const yl=["es","fr","pt"],xl="data:image/png;base64,iVBORw0KGgoA
886
886
  >
887
887
  ${n}
888
888
  </div>
889
- <div class="detail">${yo(t.summary)}</div>
889
+ <div class="detail">${bo(t.summary)}</div>
890
890
  `:null}
891
891
  </div>
892
892
  `}return H`
@@ -1583,7 +1583,6 @@ let vl=Ka,bl=!1;const yl=["es","fr","pt"],xl="data:image/png;base64,iVBORw0KGgoA
1583
1583
  }
1584
1584
 
1585
1585
  .dialog-mask .dialog-container {
1586
-
1587
1586
  position: relative;
1588
1587
  transition: transform var(--transition-speed) ease-in-out,
1589
1588
  opacity ease-in-out calc(var(--transition-speed) - 50ms);
@@ -1742,7 +1741,7 @@ let vl=Ka,bl=!1;const yl=["es","fr","pt"],xl="data:image/png;base64,iVBORw0KGgoA
1742
1741
  </div>
1743
1742
  </div>
1744
1743
  </div>
1745
- `}}t([mt({type:Boolean})],Hd.prototype,"open",void 0),t([mt()],Hd.prototype,"header",void 0),t([mt()],Hd.prototype,"body",void 0),t([mt({type:Boolean})],Hd.prototype,"submitting",void 0),t([mt({type:Boolean})],Hd.prototype,"destructive",void 0),t([mt({type:Boolean})],Hd.prototype,"disabled",void 0),t([mt({type:Boolean})],Hd.prototype,"loading",void 0),t([mt({type:Boolean})],Hd.prototype,"hideOnClick",void 0),t([mt({type:Boolean})],Hd.prototype,"noFocus",void 0),t([mt()],Hd.prototype,"size",void 0),t([mt({type:String})],Hd.prototype,"primaryButtonName",void 0),t([mt({type:String})],Hd.prototype,"cancelButtonName",void 0),t([mt({type:String})],Hd.prototype,"width",void 0),t([mt()],Hd.prototype,"submittingName",void 0),t([mt()],Hd.prototype,"animationEnd",void 0),t([mt()],Hd.prototype,"ready",void 0),t([mt({type:Array})],Hd.prototype,"buttons",void 0),t([mt({attribute:!1})],Hd.prototype,"onButtonClicked",void 0),t([mt({type:Number})],Hd.prototype,"originX",void 0),t([mt({type:Number})],Hd.prototype,"originY",void 0);class Wd extends Ne{constructor(){super(...arguments),this.header="",this.open=!1,this.fetching=!1,this.headers={},this.body=this.getLoading(),this.disabled=!1,this.buttons=[],this.wizardStep=0,this.wizardStepCount=0,this.suspendSubmit=!1}static get styles(){return a`
1744
+ `}}t([mt({type:Boolean})],Hd.prototype,"open",void 0),t([mt()],Hd.prototype,"header",void 0),t([mt()],Hd.prototype,"body",void 0),t([mt({type:Boolean})],Hd.prototype,"submitting",void 0),t([mt({type:Boolean})],Hd.prototype,"destructive",void 0),t([mt({type:Boolean})],Hd.prototype,"disabled",void 0),t([mt({type:Boolean})],Hd.prototype,"loading",void 0),t([mt({type:Boolean})],Hd.prototype,"hideOnClick",void 0),t([mt({type:Boolean})],Hd.prototype,"noFocus",void 0),t([mt()],Hd.prototype,"size",void 0),t([mt({type:String})],Hd.prototype,"primaryButtonName",void 0),t([mt({type:String})],Hd.prototype,"cancelButtonName",void 0),t([mt({type:String})],Hd.prototype,"width",void 0),t([mt()],Hd.prototype,"submittingName",void 0),t([mt()],Hd.prototype,"animationEnd",void 0),t([mt()],Hd.prototype,"ready",void 0),t([mt({type:Array})],Hd.prototype,"buttons",void 0),t([mt({attribute:!1})],Hd.prototype,"onButtonClicked",void 0),t([mt({type:Number})],Hd.prototype,"originX",void 0),t([mt({type:Number})],Hd.prototype,"originY",void 0);class Wd extends Ne{constructor(){super(...arguments),this.header="",this.open=!1,this.fetching=!1,this.headers={},this.body=this.getLoading(),this.disabled=!1,this.buttons=[],this.wizardStep=0,this.wizardStepCount=0,this.suspendSubmit=!1,this.originX=null,this.originY=null}static get styles(){return a`
1746
1745
  fieldset {
1747
1746
  border: none;
1748
1747
  margin: 0;
@@ -1831,7 +1830,7 @@ let vl=Ka,bl=!1;const yl=["es","fr","pt"],xl="data:image/png;base64,iVBORw0KGgoA
1831
1830
  flex-direction: row;
1832
1831
  margin-left: 0.6em;
1833
1832
  }
1834
- `}handleSlotClicked(){this.open=!0}updated(t){if(super.updated(t),t.has("open")&&(this.open?this.fetchForm():void 0!==t.get("open")&&(this.open?window.setTimeout((()=>{this.body=this.getLoading(),this.submitting=!1}),500):this.setBody(""))),t.has("body")&&this.open&&this.body&&!this.fetching){this.shadowRoot.querySelector("temba-dialog").focusFirstInput()}}getLoading(){return H`<temba-loading units="6" size="8"></temba-loading>`}updatePrimaryButton(){const t=this.shadowRoot.querySelector("#wizard-form");t&&(this.wizardStep=parseInt(t.dataset.step),this.wizardStepCount=parseInt(t.dataset.steps)),this.noSubmit||this.updateComplete.then((()=>{const t=this.shadowRoot.querySelector("input[type='submit'],button[type='submit']");this.buttons=t?[{type:Vd.SECONDARY,name:"Cancel",closes:!0},{type:Vd.PRIMARY,name:t.value}]:[{type:Vd.SECONDARY,name:"Ok",closes:!0}],this.submitting=!1}))}setBody(t){const e=this.shadowRoot.querySelector(".scripts");for(const t of e.children)t.remove();const i=this.ownerDocument.createElement("div");i.innerHTML=t;const o=i.getElementsByTagName("script"),n=[];for(let t=o.length-1;t>=0;t--){const e=this.ownerDocument.createElement("script"),i=o[t].innerText;o[t].src&&-1===o[t].src.indexOf("web-dev-server")?(e.src=o[t].src,e.type="text/javascript",e.async=!0,e.onload=function(){},n.push(e)):i&&(e.appendChild(this.ownerDocument.createTextNode(i)),n.push(e)),o[t].remove()}const s=!!i.querySelector(".success-script");return s||(this.body=Ve(i.innerHTML)),this.updateComplete.then((()=>{for(const t of n)e.appendChild(t)})),!s}getHeaders(){const t=this.headers;return t["X-PJAX"]=1,t}fetchForm(){this.fetching=!0,this.body=this.getLoading(),re(this.endpoint,null,this.getHeaders()).then((t=>{0==t.body.indexOf("<!DOCTYPE HTML>")?(this.open=!1,document.location=t.url):(this.setBody(t.body),this.fetching=!1,this.updateComplete.then((()=>{this.updatePrimaryButton(),this.fireCustomEvent(Mo.Loaded,{body:this.getBody()})})))})).catch((t=>{this.fetching=!1,this.open=!1,this.fireCustomEvent(Mo.Error,{error:t})}))}submit(t={}){this.submitting=!0;const e=this.shadowRoot.querySelector("form");let i=e?function(t){const e=[];for(let i=0;i<t.elements.length;i++){const o=t.elements[i];if(o.name&&!o.disabled&&"file"!==o.type&&"reset"!==o.type&&"submit"!==o.type&&"button"!==o.type)if("select-multiple"===o.type)for(let t=0;t<o.options.length;t++)o.options[t].selected&&o.options[t].value&&e.push(encodeURIComponent(o.name)+"="+encodeURIComponent(o.options[t].value));else if("checkbox"!==o.type&&"radio"!==o.type||o.checked){let t=o.value;!t&&o.checked&&(t="1"),t&&e.push(encodeURIComponent(o.name)+"="+encodeURIComponent(t))}}return e.join("&")}(e):"";t&&Object.keys(t).forEach((e=>{i+=(i.length>1?"&":"")+encodeURIComponent(e)+"="+encodeURIComponent(t[e])})),ue(this.endpoint,i,this.getHeaders(),"application/x-www-form-urlencoded").then((t=>{window.setTimeout((()=>{let e=t.headers.get("X-Temba-Success");if(!e&&t.url&&-1===t.url.indexOf(this.endpoint)&&(e=t.url),e)"hide"===e?this.updateComplete.then((()=>{this.open=!1,this.fireCustomEvent(Mo.Submitted)})):(this.fireCustomEvent(Mo.Redirected,{url:e}),this.open=!1);else{if(0==t.body.indexOf("<!DOCTYPE HTML>"))return this.open=!1,void(document.location=t.url);this.setBody(t.body)&&this.updateComplete.then((()=>{this.updatePrimaryButton()}))}}),1e3)})).catch((t=>{console.error(t)}))}handleDialogClick(t){const e=t.detail.button,i=t.detail.detail;e.disabled||e.submitting||(e.primary||e.destructive)&&(this.suspendSubmit||this.submit()),i.closes&&(this.open=!1,this.fetching=!1,this.cancelName=void 0)}handleDialogHidden(){this.open=!1,this.fetching=!1}isDestructive(){return this.endpoint&&(this.endpoint.indexOf("delete")>-1||this.endpoint.indexOf("interrupt")>-1)}handleGotoStep(t){const e=t.target.dataset.gotoStep;e&&this.submit({wizard_goto_step:e})}getBody(){return this.shadowRoot.querySelector(".modax-body")}render(){const t=[],e=this.shadowRoot.querySelector("#wizard-form");if(e){const i=(e.getAttribute("data-completed")||"").split(",").filter((t=>t.length>0));for(let e=0;e<this.wizardStepCount;e++)t.push(H`<div
1833
+ `}handleSlotClicked(t){const e=t.currentTarget;if(e){const t=e.getBoundingClientRect();this.originX=t.left+t.width/2,this.originY=t.top}this.open=!0}updated(t){if(super.updated(t),t.has("open")&&(this.open?this.fetchForm():void 0!==t.get("open")&&(this.open?window.setTimeout((()=>{this.body=this.getLoading(),this.submitting=!1}),500):(this.setBody(""),this.originX=null,this.originY=null))),t.has("body")&&this.open&&this.body&&!this.fetching){this.shadowRoot.querySelector("temba-dialog").focusFirstInput()}}getLoading(){return H`<temba-loading units="6" size="8"></temba-loading>`}updatePrimaryButton(){const t=this.shadowRoot.querySelector("#wizard-form");t&&(this.wizardStep=parseInt(t.dataset.step),this.wizardStepCount=parseInt(t.dataset.steps)),this.noSubmit||this.updateComplete.then((()=>{const t=this.shadowRoot.querySelector("input[type='submit'],button[type='submit']");this.buttons=t?[{type:Vd.SECONDARY,name:"Cancel",closes:!0},{type:Vd.PRIMARY,name:t.value}]:[{type:Vd.SECONDARY,name:"Ok",closes:!0}],this.submitting=!1}))}setBody(t){const e=this.shadowRoot.querySelector(".scripts");for(const t of e.children)t.remove();const i=this.ownerDocument.createElement("div");i.innerHTML=t;const o=i.getElementsByTagName("script"),n=[];for(let t=o.length-1;t>=0;t--){const e=this.ownerDocument.createElement("script"),i=o[t].innerText;o[t].src&&-1===o[t].src.indexOf("web-dev-server")?(e.src=o[t].src,e.type="text/javascript",e.async=!0,e.onload=function(){},n.push(e)):i&&(e.appendChild(this.ownerDocument.createTextNode(i)),n.push(e)),o[t].remove()}const s=!!i.querySelector(".success-script");return s||(this.body=Ve(i.innerHTML)),this.updateComplete.then((()=>{for(const t of n)e.appendChild(t)})),!s}getHeaders(){const t=this.headers;return t["X-PJAX"]=1,t}fetchForm(){this.fetching=!0,this.body=this.getLoading(),re(this.endpoint,null,this.getHeaders()).then((t=>{0==t.body.indexOf("<!DOCTYPE HTML>")?(this.open=!1,document.location=t.url):(this.setBody(t.body),this.fetching=!1,this.updateComplete.then((()=>{this.updatePrimaryButton(),this.fireCustomEvent(Mo.Loaded,{body:this.getBody()})})))})).catch((t=>{this.fetching=!1,this.open=!1,this.fireCustomEvent(Mo.Error,{error:t})}))}submit(t={}){this.submitting=!0;const e=this.shadowRoot.querySelector("form");let i=e?function(t){const e=[];for(let i=0;i<t.elements.length;i++){const o=t.elements[i];if(o.name&&!o.disabled&&"file"!==o.type&&"reset"!==o.type&&"submit"!==o.type&&"button"!==o.type)if("select-multiple"===o.type)for(let t=0;t<o.options.length;t++)o.options[t].selected&&o.options[t].value&&e.push(encodeURIComponent(o.name)+"="+encodeURIComponent(o.options[t].value));else if("checkbox"!==o.type&&"radio"!==o.type||o.checked){let t=o.value;!t&&o.checked&&(t="1"),t&&e.push(encodeURIComponent(o.name)+"="+encodeURIComponent(t))}}return e.join("&")}(e):"";t&&Object.keys(t).forEach((e=>{i+=(i.length>1?"&":"")+encodeURIComponent(e)+"="+encodeURIComponent(t[e])})),ue(this.endpoint,i,this.getHeaders(),"application/x-www-form-urlencoded").then((t=>{window.setTimeout((()=>{let e=t.headers.get("X-Temba-Success");if(!e&&t.url&&-1===t.url.indexOf(this.endpoint)&&(e=t.url),e)"hide"===e?this.updateComplete.then((()=>{this.open=!1,this.fireCustomEvent(Mo.Submitted)})):(this.fireCustomEvent(Mo.Redirected,{url:e}),this.open=!1);else{if(0==t.body.indexOf("<!DOCTYPE HTML>"))return this.open=!1,void(document.location=t.url);this.setBody(t.body)&&this.updateComplete.then((()=>{this.updatePrimaryButton()}))}}),1e3)})).catch((t=>{console.error(t)}))}handleDialogClick(t){const e=t.detail.button,i=t.detail.detail;e.disabled||e.submitting||(e.primary||e.destructive)&&(this.suspendSubmit||this.submit()),i.closes&&(this.open=!1,this.fetching=!1,this.cancelName=void 0)}handleDialogHidden(){this.open=!1,this.fetching=!1}isDestructive(){return this.endpoint&&(this.endpoint.indexOf("delete")>-1||this.endpoint.indexOf("interrupt")>-1)}handleGotoStep(t){const e=t.target.dataset.gotoStep;e&&this.submit({wizard_goto_step:e})}getBody(){return this.shadowRoot.querySelector(".modax-body")}render(){const t=[],e=this.shadowRoot.querySelector("#wizard-form");if(e){const i=(e.getAttribute("data-completed")||"").split(",").filter((t=>t.length>0));for(let e=0;e<this.wizardStepCount;e++)t.push(H`<div
1835
1834
  data-goto-step=${i[e]}
1836
1835
  @click=${this.handleGotoStep.bind(this)}
1837
1836
  class="${ae({"step-ball":!0,active:this.wizardStep-1===e,complete:e<i.length})}"
@@ -1840,11 +1839,13 @@ let vl=Ka,bl=!1;const yl=["es","fr","pt"],xl="data:image/png;base64,iVBORw0KGgoA
1840
1839
  .header=${this.header}
1841
1840
  .buttons=${this.buttons}
1842
1841
  ?open=${this.open}
1843
- ?loading=${this.fetching}
1842
+ ?loading=${this.fetching&&null==this.originX}
1844
1843
  ?submitting=${this.submitting}
1845
1844
  ?destructive=${this.isDestructive()}
1846
1845
  ?noFocus=${!0}
1847
1846
  ?disabled=${this.disabled}
1847
+ .originX=${this.originX}
1848
+ .originY=${this.originY}
1848
1849
  @temba-button-clicked=${this.handleDialogClick.bind(this)}
1849
1850
  @temba-dialog-hidden=${this.handleDialogHidden.bind(this)}
1850
1851
  >
@@ -1862,7 +1863,7 @@ let vl=Ka,bl=!1;const yl=["es","fr","pt"],xl="data:image/png;base64,iVBORw0KGgoA
1862
1863
  <div class="slot-wrapper" @click=${this.handleSlotClicked}>
1863
1864
  <slot></slot>
1864
1865
  </div>
1865
- `}}t([mt({type:String})],Wd.prototype,"header",void 0),t([mt({type:String})],Wd.prototype,"endpoint",void 0),t([mt({type:Boolean,reflect:!0})],Wd.prototype,"open",void 0),t([mt({type:Boolean})],Wd.prototype,"fetching",void 0),t([mt({type:Boolean})],Wd.prototype,"submitting",void 0),t([mt({type:String})],Wd.prototype,"primaryName",void 0),t([mt({type:String})],Wd.prototype,"cancelName",void 0),t([mt({type:String})],Wd.prototype,"onLoaded",void 0),t([mt({type:Boolean})],Wd.prototype,"noSubmit",void 0),t([mt({type:Object})],Wd.prototype,"headers",void 0),t([mt({type:String})],Wd.prototype,"body",void 0),t([mt({type:Boolean})],Wd.prototype,"disabled",void 0),t([mt({type:Array})],Wd.prototype,"buttons",void 0),t([mt({type:Number})],Wd.prototype,"wizardStep",void 0),t([mt({type:Number})],Wd.prototype,"wizardStepCount",void 0),t([mt({type:Boolean})],Wd.prototype,"suspendSubmit",void 0);class Zd extends dt{constructor(){super(...arguments),this.v=1}static get styles(){return a`
1866
+ `}}t([mt({type:String})],Wd.prototype,"header",void 0),t([mt({type:String})],Wd.prototype,"endpoint",void 0),t([mt({type:Boolean,reflect:!0})],Wd.prototype,"open",void 0),t([mt({type:Boolean})],Wd.prototype,"fetching",void 0),t([mt({type:Boolean})],Wd.prototype,"submitting",void 0),t([mt({type:String})],Wd.prototype,"primaryName",void 0),t([mt({type:String})],Wd.prototype,"cancelName",void 0),t([mt({type:String})],Wd.prototype,"onLoaded",void 0),t([mt({type:Boolean})],Wd.prototype,"noSubmit",void 0),t([mt({type:Object})],Wd.prototype,"headers",void 0),t([mt({type:String})],Wd.prototype,"body",void 0),t([mt({type:Boolean})],Wd.prototype,"disabled",void 0),t([mt({type:Array})],Wd.prototype,"buttons",void 0),t([mt({type:Number})],Wd.prototype,"wizardStep",void 0),t([mt({type:Number})],Wd.prototype,"wizardStepCount",void 0),t([mt({type:Boolean})],Wd.prototype,"suspendSubmit",void 0),t([mt({type:Number})],Wd.prototype,"originX",void 0),t([mt({type:Number})],Wd.prototype,"originY",void 0);class Zd extends dt{constructor(){super(...arguments),this.v=1}static get styles(){return a`
1866
1867
  :host {
1867
1868
  display: flex;
1868
1869
  align-self: stretch;
@@ -2227,7 +2228,7 @@ const{I:ac}=at,lc=()=>document.createComment(""),dc=(t,e,i)=>{const o=t._$AA.par
2227
2228
  * @license
2228
2229
  * Copyright 2017 Google LLC
2229
2230
  * SPDX-License-Identifier: BSD-3-Clause
2230
- */var fc;!function(t){t.Inline="inline",t.Error="error",t.Collapse="collapse",t.Note="note"}(fc||(fc={}));const vc={hour:"numeric",minute:"2-digit"},bc={weekday:void 0,year:void 0,month:"short",day:"numeric",hour:"numeric",minute:"2-digit"},yc={weekday:void 0,year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"};class xc extends Ne{constructor(){super(...arguments),this.messageGroups=[],this.fetching=!1,this.hideTopScroll=!0,this.hideBottomScroll=!0,this.defaultAvatar=xl,this.agent=!1,this.avatars=!1,this.endOfHistory=!1,this.oldestEventDate=null,this.showNewMessageNotification=!1,this.showMessageLogsAfter=null,this.hasFooter=!1,this.showTimestamps=!0,this.msgMap=new Map,this.metadataCache=new Map}static get styles(){return a`
2231
+ */var fc;!function(t){t.Inline="inline",t.Error="error",t.Collapse="collapse",t.Note="note"}(fc||(fc={}));const vc={hour:"numeric",minute:"2-digit"},yc={weekday:void 0,year:void 0,month:"short",day:"numeric",hour:"numeric",minute:"2-digit"},bc={weekday:void 0,year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"};class xc extends Ne{constructor(){super(...arguments),this.messageGroups=[],this.fetching=!1,this.hideTopScroll=!0,this.hideBottomScroll=!0,this.defaultAvatar=xl,this.agent=!1,this.avatars=!1,this.endOfHistory=!1,this.oldestEventDate=null,this.showNewMessageNotification=!1,this.showMessageLogsAfter=null,this.hasFooter=!1,this.showTimestamps=!0,this.msgMap=new Map,this.metadataCache=new Map}static get styles(){return a`
2231
2232
  :host {
2232
2233
  display: flex;
2233
2234
  flex-direction: column;
@@ -2786,7 +2787,7 @@ const{I:ac}=at,lc=()=>document.createComment(""),dc=(t,e,i)=>{const o=t._$AA.par
2786
2787
  box-shadow: rgba(0, 0, 0, 0.3) 0px 4px 10px 0px,
2787
2788
  rgba(0, 0, 0, 0.4) 0px 2px 4px 0px;
2788
2789
  }
2789
- `}firstUpdated(t){super.firstUpdated(t);const e=this.shadowRoot.querySelector(".scroll"),i=e.scrollHeight>e.clientHeight;this.hideBottomScroll=!0,this.hideTopScroll=!i}addMessages(t,e=null,i=!1){e||(e=new Date);const o=(new Date).getTime()-e.getTime();window.setTimeout((()=>{this.fetching=!1;const e=[];for(const i of t)if("msg_deleted"!==i.type&&"msg_status_changed"!==i.type)this.addMessage(i)&&e.push(i.uuid);else{const t=i.msg_uuid;t&&this.metadataCache.set(t,i)}if(0===e.length)return;const o=this.shadowRoot.querySelector(".scroll"),n=o.scrollTop,s=o.scrollHeight,r=o.scrollHeight-o.clientHeight>0&&Math.abs(o.scrollTop)>50,a=this.groupMessages(e);this.insertGroups(a,i),i&&r&&e.length>0&&(this.showNewMessageNotification=!0),window.setTimeout((()=>{if(i&&r){const t=o.scrollHeight-s;o.scrollTop=n-t}else o.scrollTop=n;this.fireCustomEvent(Mo.FetchComplete)}),100)}),0===this.messageGroups.length?0:Math.max(0,250-o))}addMessage(t){const e=!this.messageExists(t);return this.msgMap.set(t.uuid,t),e}messageExists(t){return this.msgMap.has(t.uuid)}isSameGroup(t,e,i){var o,n;if(!t||!e)return{same:!0};const s="msg_created"===t.type||"msg_received"===t.type||"ivr_created"===t.type,r="msg_created"===e.type||"msg_received"===e.type||"ivr_created"===e.type,a=s&&r?t.type===e.type:s===r,l=i||t.created_on;return Math.abs(e.created_on.getTime()-l.getTime())>=gc?{same:!1,reason:"time_elapsed"}:a?s&&r&&(null===(o=t._user)||void 0===o?void 0:o.name)!==(null===(n=e._user)||void 0===n?void 0:n.name)?{same:!1,reason:"new_author"}:{same:!0}:{same:!1,reason:"new_type"}}insertGroups(t,e=!1){e||t.reverse();for(const i of t){const t=this.messageGroups[e?0:this.messageGroups.length-1];if(t){const o=t.messages[t.messages.length-1],n=this.msgMap.get(o),s=this.msgMap.get(i.messages[0]);this.isSameGroup(n,s).same?t.messages.push(...i.messages):e?this.messageGroups.splice(0,0,i):this.messageGroups.push(i)}else e?this.messageGroups.splice(0,0,i):this.messageGroups.push(i)}this.requestUpdate("messageGroups")}groupMessages(t){const e=[];let i=null,o=null,n=null;for(const s of t){const t=this.msgMap.get(s),r=this.isSameGroup(t,o,n);r.same&&i||(i={messages:[],reason:r.reason||"initial"},e.push(i),"time_elapsed"===r.reason&&(n=t.created_on)),i.messages.push(s),o=t}return e}handleScroll(t){const e=t.target,i=e.scrollHeight-e.clientHeight;if(i<=0)return;const o=Math.abs(e.scrollTop),n=o>=i-200;this.hideTopScroll=o>=i-1,this.hideBottomScroll=o<=1,o<=10&&(this.showNewMessageNotification=!1),n&&this.fireCustomEvent(Mo.ScrollThreshold)}scrollToBottom(){const t=this.shadowRoot.querySelector(".scroll");t&&(t.scrollTop=0,this.hideBottomScroll=!0,this.showNewMessageNotification=!1)}handleNewMessageClick(){this.scrollToBottom()}getReasonLabel(t){switch(t){case"new_author":return"👤 Different author";case"new_type":return"🔄 Message type changed";default:return""}}renderMessageGroup(t,e,i){var o,n,s,r;const a=new Date,l=t.messages,d=l[l.length-1],c=this.msgMap.get(d),h=this.agent?"msg_received"!==c.type:"msg_received"===c.type,u=null===(o=c._user)||void 0===o?void 0:o.name,p="msg_received"===c.type||"msg_created"===c.type||"ivr_created"===c.type,m=this.avatars&&(p&&this.agent||!h),g=!(null===(n=c._user)||void 0===n?void 0:n.uuid);this.getReasonLabel(t.reason);const f=l[0],v=this.msgMap.get(f);let b=!1,y=i;if(e>0)if(i){b=Math.abs(v.created_on.getTime()-i.getTime())>=gc}else b="time_elapsed"===t.reason;let x=null;if(b){y=v.created_on;const t=a.getFullYear()!==v.created_on.getFullYear()?yc:a.getDate()!==v.created_on.getDate()?bc:vc;x=H`<div class="time time-elapsed">
2790
+ `}firstUpdated(t){super.firstUpdated(t);const e=this.shadowRoot.querySelector(".scroll"),i=e.scrollHeight>e.clientHeight;this.hideBottomScroll=!0,this.hideTopScroll=!i}addMessages(t,e=null,i=!1){e||(e=new Date);const o=(new Date).getTime()-e.getTime();window.setTimeout((()=>{this.fetching=!1;const e=[];for(const i of t)if("msg_deleted"!==i.type&&"msg_status_changed"!==i.type)this.addMessage(i)&&e.push(i.uuid);else{const t=i.msg_uuid;t&&this.metadataCache.set(t,i)}if(0===e.length)return;const o=this.shadowRoot.querySelector(".scroll"),n=o.scrollTop,s=o.scrollHeight,r=o.scrollHeight-o.clientHeight>0&&Math.abs(o.scrollTop)>50,a=this.groupMessages(e);this.insertGroups(a,i),i&&r&&e.length>0&&(this.showNewMessageNotification=!0),window.setTimeout((()=>{if(i&&r){const t=o.scrollHeight-s;o.scrollTop=n-t}else o.scrollTop=n;this.fireCustomEvent(Mo.FetchComplete)}),100)}),0===this.messageGroups.length?0:Math.max(0,250-o))}addMessage(t){const e=!this.messageExists(t);return this.msgMap.set(t.uuid,t),e}messageExists(t){return this.msgMap.has(t.uuid)}isSameGroup(t,e,i){var o,n;if(!t||!e)return{same:!0};const s="msg_created"===t.type||"msg_received"===t.type||"ivr_created"===t.type,r="msg_created"===e.type||"msg_received"===e.type||"ivr_created"===e.type,a=s&&r?t.type===e.type:s===r,l=i||t.created_on;return Math.abs(e.created_on.getTime()-l.getTime())>=gc?{same:!1,reason:"time_elapsed"}:a?s&&r&&(null===(o=t._user)||void 0===o?void 0:o.name)!==(null===(n=e._user)||void 0===n?void 0:n.name)?{same:!1,reason:"new_author"}:{same:!0}:{same:!1,reason:"new_type"}}insertGroups(t,e=!1){e||t.reverse();for(const i of t){const t=this.messageGroups[e?0:this.messageGroups.length-1];if(t){const o=t.messages[t.messages.length-1],n=this.msgMap.get(o),s=this.msgMap.get(i.messages[0]);this.isSameGroup(n,s).same?t.messages.push(...i.messages):e?this.messageGroups.splice(0,0,i):this.messageGroups.push(i)}else e?this.messageGroups.splice(0,0,i):this.messageGroups.push(i)}this.requestUpdate("messageGroups")}groupMessages(t){const e=[];let i=null,o=null,n=null;for(const s of t){const t=this.msgMap.get(s),r=this.isSameGroup(t,o,n);r.same&&i||(i={messages:[],reason:r.reason||"initial"},e.push(i),"time_elapsed"===r.reason&&(n=t.created_on)),i.messages.push(s),o=t}return e}handleScroll(t){const e=t.target,i=e.scrollHeight-e.clientHeight;if(i<=0)return;const o=Math.abs(e.scrollTop),n=o>=i-200;this.hideTopScroll=o>=i-1,this.hideBottomScroll=o<=1,o<=10&&(this.showNewMessageNotification=!1),n&&this.fireCustomEvent(Mo.ScrollThreshold)}scrollToBottom(){const t=this.shadowRoot.querySelector(".scroll");t&&(t.scrollTop=0,this.hideBottomScroll=!0,this.showNewMessageNotification=!1)}handleNewMessageClick(){this.scrollToBottom()}getReasonLabel(t){switch(t){case"new_author":return"👤 Different author";case"new_type":return"🔄 Message type changed";default:return""}}renderMessageGroup(t,e,i){var o,n,s,r;const a=new Date,l=t.messages,d=l[l.length-1],c=this.msgMap.get(d),h=this.agent?"msg_received"!==c.type:"msg_received"===c.type,u=null===(o=c._user)||void 0===o?void 0:o.name,p="msg_received"===c.type||"msg_created"===c.type||"ivr_created"===c.type,m=this.avatars&&(p&&this.agent||!h),g=!(null===(n=c._user)||void 0===n?void 0:n.uuid);this.getReasonLabel(t.reason);const f=l[0],v=this.msgMap.get(f);let y=!1,b=i;if(e>0)if(i){y=Math.abs(v.created_on.getTime()-i.getTime())>=gc}else y="time_elapsed"===t.reason;let x=null;if(y){b=v.created_on;const t=a.getFullYear()!==v.created_on.getFullYear()?bc:a.getDate()!==v.created_on.getDate()?yc:vc;x=H`<div class="time time-elapsed">
2790
2791
  ${v.created_on.toLocaleTimeString(void 0,t)}
2791
2792
  </div>`}const _=H`
2792
2793
  <div class="block ${h?"incoming":"outgoing"}">
@@ -2809,7 +2810,7 @@ const{I:ac}=at,lc=()=>document.createComment(""),dc=(t,e,i)=>{const o=t._$AA.par
2809
2810
  </div>
2810
2811
  ${null}
2811
2812
  ${x}
2812
- `;return{html:_,timestamp:y}}renderMessage(t,e=null){var i,o,n,s;if(t._rendered)return H`<div class="event">${t._rendered.html}</div>`;const r=t;if(!r.msg)return H``;const a=null===(i=r.msg)||void 0===i?void 0:i.unsendable_reason,l=null===(o=r._status)||void 0===o?void 0:o.reason,d=a?(t=>{switch(t){case"no_route":return"No channel available to send message";case"contact_blocked":return"Contact has been blocked";case"contact_stopped":return"Contact has been stopped";case"contact_archived":return"Contact is archived";case"org_suspended":return"Workspace is suspended";case"looping":return"Message loop detected";default:return"Unable to send message"}})(a):l?(t=>{switch(t){case"error_limit":return"Error limit reached";case"too_old":return"Message is too old to send";case"channel_removed":return"Channel was removed";default:return"Message failed to send"}})(l):null,c=this.showMessageLogsAfter&&r.created_on>=this.showMessageLogsAfter&&r.msg.channel?`/channels/channel/logs/${r.msg.channel.uuid}/msg/${t.uuid}/`:null,h=r._deleted,u=h?r._deleted.by_contact?"contact":(null===(n=r._deleted.user)||void 0===n?void 0:n.name)||"user":null,p=(null===(s=r.msg.attachments)||void 0===s?void 0:s.some((t=>t.startsWith("geo:"))))&&r.msg.text&&/^-?\d+\.?\d*\s*,\s*-?\d+\.?\d*$/.test(r.msg.text.trim());return H`
2813
+ `;return{html:_,timestamp:b}}renderMessage(t,e=null){var i,o,n,s;if(t._rendered)return H`<div class="event">${t._rendered.html}</div>`;const r=t;if(!r.msg)return H``;const a=null===(i=r.msg)||void 0===i?void 0:i.unsendable_reason,l=null===(o=r._status)||void 0===o?void 0:o.reason,d=a?(t=>{switch(t){case"no_route":return"No channel available to send message";case"contact_blocked":return"Contact has been blocked";case"contact_stopped":return"Contact has been stopped";case"contact_archived":return"Contact is archived";case"org_suspended":return"Workspace is suspended";case"looping":return"Message loop detected";default:return"Unable to send message"}})(a):l?(t=>{switch(t){case"error_limit":return"Error limit reached";case"too_old":return"Message is too old to send";case"channel_removed":return"Channel was removed";default:return"Message failed to send"}})(l):null,c=this.showMessageLogsAfter&&r.created_on>=this.showMessageLogsAfter&&r.msg.channel?`/channels/channel/logs/${r.msg.channel.uuid}/msg/${t.uuid}/`:null,h=r._deleted,u=h?r._deleted.by_contact?"contact":(null===(n=r._deleted.user)||void 0===n?void 0:n.name)||"user":null,p=(null===(s=r.msg.attachments)||void 0===s?void 0:s.some((t=>t.startsWith("geo:"))))&&r.msg.text&&/^-?\d+\.?\d*\s*,\s*-?\d+\.?\d*$/.test(r.msg.text.trim());return H`
2813
2814
  <div class="bubble-wrap">
2814
2815
  ${this.showTimestamps?H`<div class="popup" style="white-space: nowrap;">
2815
2816
  ${d?H`<div
@@ -2861,7 +2862,7 @@ const{I:ac}=at,lc=()=>document.createComment(""),dc=(t,e,i)=>{const o=t._$AA.par
2861
2862
  ></temba-loading>
2862
2863
 
2863
2864
  ${this.endOfHistory&&this.oldestEventDate?H`<div class="time first">
2864
- ${this.oldestEventDate.toLocaleTimeString(void 0,bc)}
2865
+ ${this.oldestEventDate.toLocaleTimeString(void 0,yc)}
2865
2866
  </div>`:null}
2866
2867
  </div>
2867
2868
  ${this.hasFooter?null:H`<div
@@ -2912,7 +2913,7 @@ const{I:ac}=at,lc=()=>document.createComment(""),dc=(t,e,i)=>{const o=t._$AA.par
2912
2913
  Updated <strong>name</strong> to <strong>${t.name}</strong>
2913
2914
  </div>`)(t);break;case _c.CONTACT_STATUS_CHANGED:i=(t=>H`<div>Status updated to <strong>${t.status}</strong></div>`)(t);break;case _c.CONTACT_URNS_CHANGED:i=(t=>H`<div>
2914
2915
  Updated <strong>URNs</strong> to
2915
- ${be(t.urns,(t=>H`<strong>${t.split(":")[1].split("?")[0]}</strong>`))}
2916
+ ${ye(t.urns,(t=>H`<strong>${t.split(":")[1].split("?")[0]}</strong>`))}
2916
2917
  </div>`)(t);break;case _c.INPUT_LABELS_ADDED:i=(t=>{const e=t.labels||[];if(e.length>0){const t=e.map((t=>t.name));if(1===t.length)return H`<div>
2917
2918
  Message labeled with <strong>${t[0]}</strong>
2918
2919
  </div>`;{const e=t.pop();return H`<div>
@@ -6525,7 +6526,7 @@ const{I:ac}=at,lc=()=>document.createComment(""),dc=(t,e,i)=>{const o=t._$AA.par
6525
6526
  .item:hover {
6526
6527
  color: var(--color-link-primary);
6527
6528
  }
6528
- `}fetchContentMenu(){const t=this.endpoint;if(t){const e=this.legacy,i=ch;e&&delete i["Temba-Spa"],re(t,null,i).then((t=>{const e=t.json.items;e?(this.buttons=e.filter((t=>t.as_button)),this.items=e.filter((t=>!t.as_button))):(this.buttons=[],this.items=[]),this.fireCustomEvent(Mo.Loaded,{buttons:this.buttons,items:this.items})})).catch((t=>{this.fireCustomEvent(Mo.Loaded,{buttons:this.buttons,items:this.items}),console.error(t)}))}}refresh(){this.fetchContentMenu()}updated(t){super.updated(t),(t.has("endpoint")||t.has("legacy"))&&this.fetchContentMenu()}handleItemClicked(t,e){this.fireCustomEvent(Mo.Selection,{item:t,event:e})}render(){return H`
6529
+ `}fetchContentMenu(){const t=this.endpoint;if(t){const e=this.legacy,i=ch;e&&delete i["Temba-Spa"],re(t,null,i).then((t=>{const e=t.json.items;e?(this.buttons=e.filter((t=>t.as_button)),this.items=e.filter((t=>!t.as_button))):(this.buttons=[],this.items=[]),this.fireCustomEvent(Mo.Loaded,{buttons:this.buttons,items:this.items})})).catch((t=>{this.fireCustomEvent(Mo.Loaded,{buttons:this.buttons,items:this.items}),console.error(t)}))}}refresh(){this.fetchContentMenu()}updated(t){super.updated(t),(t.has("endpoint")||t.has("legacy"))&&this.fetchContentMenu()}getTopCenter(t){const e=t.getBoundingClientRect();return{x:e.left+e.width/2,y:e.top}}handleItemClicked(t,e){const i=e.currentTarget,o=i?this.getTopCenter(i):{x:e.clientX,y:e.clientY};this.fireCustomEvent(Mo.Selection,{item:t,event:e,originX:o.x,originY:o.y})}render(){return H`
6529
6530
  <div class="container">
6530
6531
  ${this.buttons.map((t=>H`<temba-button
6531
6532
  class="${t.primary?"primary_button_item":"button_item"}"
@@ -7042,7 +7043,7 @@ const{I:ac}=at,lc=()=>document.createComment(""),dc=(t,e,i)=>{const o=t._$AA.par
7042
7043
  ></temba-textinput>
7043
7044
  </div>
7044
7045
  </div>
7045
- `}}t([mt({type:Boolean})],vh.prototype,"expanded",void 0),t([mt({type:String})],vh.prototype,"previewColor",void 0),t([mt({type:String})],vh.prototype,"labelColor",void 0),t([mt({type:Boolean})],vh.prototype,"selecting",void 0),t([mt({type:Number})],vh.prototype,"hue",void 0),t([mt({type:Number})],vh.prototype,"saturation",void 0),t([mt({type:Number})],vh.prototype,"lightness",void 0),t([mt({type:String})],vh.prototype,"hex",void 0);class bh extends jd{constructor(){super(),this.minWidth=200,this.maxWidth=2e3,this.resizing=!1,this.startResize=this.startResize.bind(this),this.resize=this.resize.bind(this),this.stopResize=this.stopResize.bind(this)}updated(t){super.updated(t),t.has("currentWidth")&&this.style.setProperty("--box-width",`${this.currentWidth}px`)}setWidth(t){const e=Math.min(Math.max(t,this.minWidth),this.maxWidth);this.currentWidth=e}startResize(t){this.initialX=t.x,this.boxWidth=this.offsetWidth,document.body.style.userSelect="none",this.resizing=!0,window.addEventListener("mousemove",this.resize),window.addEventListener("mouseup",this.stopResize),this.requestUpdate()}resize(t){const e=t.x-this.initialX;this.setWidth(this.boxWidth+e)}stopResize(){document.body.style.userSelect="initial",window.removeEventListener("mousemove",this.resize),window.removeEventListener("mouseup",this.stopResize),this.requestUpdate(),this.resizing=!1,this.fireCustomEvent(Mo.Resized,{width:this.currentWidth})}render(){return H`
7046
+ `}}t([mt({type:Boolean})],vh.prototype,"expanded",void 0),t([mt({type:String})],vh.prototype,"previewColor",void 0),t([mt({type:String})],vh.prototype,"labelColor",void 0),t([mt({type:Boolean})],vh.prototype,"selecting",void 0),t([mt({type:Number})],vh.prototype,"hue",void 0),t([mt({type:Number})],vh.prototype,"saturation",void 0),t([mt({type:Number})],vh.prototype,"lightness",void 0),t([mt({type:String})],vh.prototype,"hex",void 0);class yh extends jd{constructor(){super(),this.minWidth=200,this.maxWidth=2e3,this.resizing=!1,this.startResize=this.startResize.bind(this),this.resize=this.resize.bind(this),this.stopResize=this.stopResize.bind(this)}updated(t){super.updated(t),t.has("currentWidth")&&this.style.setProperty("--box-width",`${this.currentWidth}px`)}setWidth(t){const e=Math.min(Math.max(t,this.minWidth),this.maxWidth);this.currentWidth=e}startResize(t){this.initialX=t.x,this.boxWidth=this.offsetWidth,document.body.style.userSelect="none",this.resizing=!0,window.addEventListener("mousemove",this.resize),window.addEventListener("mouseup",this.stopResize),this.requestUpdate()}resize(t){const e=t.x-this.initialX;this.setWidth(this.boxWidth+e)}stopResize(){document.body.style.userSelect="initial",window.removeEventListener("mousemove",this.resize),window.removeEventListener("mouseup",this.stopResize),this.requestUpdate(),this.resizing=!1,this.fireCustomEvent(Mo.Resized,{width:this.currentWidth})}render(){return H`
7046
7047
  <div
7047
7048
  class=${ae({resizer:!0,resizing:this.resizing})}
7048
7049
  @mousedown="${this.startResize}"
@@ -7050,7 +7051,7 @@ const{I:ac}=at,lc=()=>document.createComment(""),dc=(t,e,i)=>{const o=t._$AA.par
7050
7051
  <div class=${ae({"resizer-handle":!0})}></div>
7051
7052
  </div>
7052
7053
  <slot></slot>
7053
- `}}var yh,xh;bh.styles=a`
7054
+ `}}var bh,xh;yh.styles=a`
7054
7055
  :host {
7055
7056
  display: block;
7056
7057
  position: relative;
@@ -7090,7 +7091,7 @@ const{I:ac}=at,lc=()=>document.createComment(""),dc=(t,e,i)=>{const o=t._$AA.par
7090
7091
  margin-right: var(--resizer-handle-size);
7091
7092
  background: red;
7092
7093
  }
7093
- `,t([mt({type:Number})],bh.prototype,"minWidth",void 0),t([mt({type:Number})],bh.prototype,"maxWidth",void 0),t([mt({type:Boolean})],bh.prototype,"resizing",void 0),t([mt({type:Number})],bh.prototype,"currentWidth",void 0),function(t){t.send="send-03",t.attachment="paperclip",t.attachment_audio="volume-min",t.attachment_document="file-06",t.attachment_image="image-01",t.attachment_location="marker-pin-01",t.attachment_video="video-recorder"}(yh||(yh={})),function(t){t.IMAGE="image",t.AUDIO="audio",t.VIDEO="video",t.DOCUMENT="document",t.LOCATION="location",t.OTHER="other"}(xh||(xh={}));const _h={[xh.IMAGE]:yh.attachment_image,[xh.AUDIO]:yh.attachment_audio,[xh.VIDEO]:yh.attachment_video,[xh.DOCUMENT]:yh.attachment_document,[xh.OTHER]:yh.attachment};class wh extends Ne{constructor(){super(...arguments),this.ratio=0,this.preview=!0,this.tileUrl="",this.audio=null,this.audioPlaying=!1,this.audioProgress=0,this.audioDuration=0}static get styles(){return a`
7094
+ `,t([mt({type:Number})],yh.prototype,"minWidth",void 0),t([mt({type:Number})],yh.prototype,"maxWidth",void 0),t([mt({type:Boolean})],yh.prototype,"resizing",void 0),t([mt({type:Number})],yh.prototype,"currentWidth",void 0),function(t){t.send="send-03",t.attachment="paperclip",t.attachment_audio="volume-min",t.attachment_document="file-06",t.attachment_image="image-01",t.attachment_location="marker-pin-01",t.attachment_video="video-recorder"}(bh||(bh={})),function(t){t.IMAGE="image",t.AUDIO="audio",t.VIDEO="video",t.DOCUMENT="document",t.LOCATION="location",t.OTHER="other"}(xh||(xh={}));const _h={[xh.IMAGE]:bh.attachment_image,[xh.AUDIO]:bh.attachment_audio,[xh.VIDEO]:bh.attachment_video,[xh.DOCUMENT]:bh.attachment_document,[xh.OTHER]:bh.attachment};class wh extends Ne{constructor(){super(...arguments),this.ratio=0,this.preview=!0,this.tileUrl="",this.audio=null,this.audioPlaying=!1,this.audioProgress=0,this.audioDuration=0}static get styles(){return a`
7094
7095
  :host {
7095
7096
  display: inline;
7096
7097
  }
@@ -7521,7 +7522,7 @@ const{I:ac}=at,lc=()=>document.createComment(""),dc=(t,e,i)=>{const o=t._$AA.par
7521
7522
  temba-loading.hidden {
7522
7523
  display: none;
7523
7524
  }
7524
- `}constructor(){super(),this.messageGroups=[],this.status=kh.DISCONNECTED,this.open=!1,this.hasPendingText=!1,this.blockHistoryFetching=!1,this.newMessageCount=0}firstUpdated(t){if(super.firstUpdated(t),this.chat=this.shadowRoot.querySelector("temba-chat"),!document.querySelector("temba-lightbox")){const t=document.createElement("temba-lightbox");document.querySelector("body").appendChild(t)}}handleReconnect(){this.openSocket()}sendSockMessage(t){console.log("out",t),this.sock.send(JSON.stringify(t))}openSocket(){if(this.status!==kh.DISCONNECTED)return;this.status=kh.CONNECTING;const t=this;let e=`wss://localhost.textit.com/wc/connect/${this.channel}/`;this.urn&&(e=`${e}?chat_id=${this.urn}`);const i=new WebSocket(e);this.sock=i,this.sock.onclose=function(){t.status=kh.DISCONNECTED},this.sock.onopen=function(){t.beforeTime=(new Date).toISOString(),t.status=kh.CONNECTED,t.urn=xe("temba-chat-urn");const e={type:"start_chat"};t.urn&&(e.chat_id=t.urn),t.sendSockMessage(e)},this.sock.onmessage=function(e){t.status=kh.CONNECTED;const i=JSON.parse(e.data);if(console.log("in",i),"chat_started"===i.type){const e=i;t.urn!==e.chat_id&&(t.messageGroups=[]),t.urn=e.chat_id,ye("temba-chat-urn",e.chat_id),t.requestUpdate("messageGroups")}else if("chat_resumed"===i.type){const e=i;t.urn=e.chat_id,t.fetchPreviousMessages()}else if("chat_out"===i.type){const e=i;t.chat.addMessages([Ch(e)],null,!0);const o={type:"ack_chat",msg_id:e.msg_out.id};t.sendSockMessage(o)}else"history"===i.type&&t.handleHistoryResponse(i)},this.sock.onerror=function(){t.status=kh.DISCONNECTED}}fetchPreviousMessages(){if(!this.blockHistoryFetching){this.fetchRequested=new Date,this.blockHistoryFetching=!0,this.chat.fetching=!0;const t={type:"get_history",before:this.beforeTime};this.fetchRequested=new Date,this.sendSockMessage(t)}}handleHistoryResponse(t){const e=t.history.reverse();if(e.length>0){const t=e[0];if(t.msg_in){const e=t.msg_in;this.beforeTime=e.time}else if(t.msg_out){const e=t.msg_out;this.beforeTime=e.time}}this.chat.addMessages(e.map(Ch),this.fetchRequested)}fetchComplete(){this.blockHistoryFetching=!1}focusInput(){const t=this.shadowRoot.querySelector(".input");t&&t.focus()}updated(t){super.updated(t),this.open&&t.has("open")&&void 0!==t.get("open")&&this.status===kh.DISCONNECTED&&this.openSocket(),t.has("status")&&this.status===kh.CONNECTED&&this.focusInput()}openChat(){this.open=!0}handleKeyUp(t){this.hasPendingText&&"Enter"===t.key&&this.sendPendingMessage(),this.hasPendingText=t.target.value.length>0}sendPendingMessage(){if(this.status===kh.CONNECTED){const t=this.shadowRoot.querySelector(".input"),e=t.value;t.value="";const i={type:"send_msg",text:e};this.sendSockMessage(i);const o=new Date;this.chat.addMessages([{uuid:Jt(),type:"msg_received",msg:{text:e},created_on:o}],o,!0),this.hasPendingText=t.value.length>0}}handleClickInputPanel(t){t.preventDefault(),t.stopPropagation();this.shadowRoot.querySelector(".input").focus()}toggleChat(){this.open=!this.open}render(){return H`
7525
+ `}constructor(){super(),this.messageGroups=[],this.status=kh.DISCONNECTED,this.open=!1,this.hasPendingText=!1,this.blockHistoryFetching=!1,this.newMessageCount=0}firstUpdated(t){if(super.firstUpdated(t),this.chat=this.shadowRoot.querySelector("temba-chat"),!document.querySelector("temba-lightbox")){const t=document.createElement("temba-lightbox");document.querySelector("body").appendChild(t)}}handleReconnect(){this.openSocket()}sendSockMessage(t){console.log("out",t),this.sock.send(JSON.stringify(t))}openSocket(){if(this.status!==kh.DISCONNECTED)return;this.status=kh.CONNECTING;const t=this;let e=`wss://localhost.textit.com/wc/connect/${this.channel}/`;this.urn&&(e=`${e}?chat_id=${this.urn}`);const i=new WebSocket(e);this.sock=i,this.sock.onclose=function(){t.status=kh.DISCONNECTED},this.sock.onopen=function(){t.beforeTime=(new Date).toISOString(),t.status=kh.CONNECTED,t.urn=xe("temba-chat-urn");const e={type:"start_chat"};t.urn&&(e.chat_id=t.urn),t.sendSockMessage(e)},this.sock.onmessage=function(e){t.status=kh.CONNECTED;const i=JSON.parse(e.data);if(console.log("in",i),"chat_started"===i.type){const e=i;t.urn!==e.chat_id&&(t.messageGroups=[]),t.urn=e.chat_id,be("temba-chat-urn",e.chat_id),t.requestUpdate("messageGroups")}else if("chat_resumed"===i.type){const e=i;t.urn=e.chat_id,t.fetchPreviousMessages()}else if("chat_out"===i.type){const e=i;t.chat.addMessages([Ch(e)],null,!0);const o={type:"ack_chat",msg_id:e.msg_out.id};t.sendSockMessage(o)}else"history"===i.type&&t.handleHistoryResponse(i)},this.sock.onerror=function(){t.status=kh.DISCONNECTED}}fetchPreviousMessages(){if(!this.blockHistoryFetching){this.fetchRequested=new Date,this.blockHistoryFetching=!0,this.chat.fetching=!0;const t={type:"get_history",before:this.beforeTime};this.fetchRequested=new Date,this.sendSockMessage(t)}}handleHistoryResponse(t){const e=t.history.reverse();if(e.length>0){const t=e[0];if(t.msg_in){const e=t.msg_in;this.beforeTime=e.time}else if(t.msg_out){const e=t.msg_out;this.beforeTime=e.time}}this.chat.addMessages(e.map(Ch),this.fetchRequested)}fetchComplete(){this.blockHistoryFetching=!1}focusInput(){const t=this.shadowRoot.querySelector(".input");t&&t.focus()}updated(t){super.updated(t),this.open&&t.has("open")&&void 0!==t.get("open")&&this.status===kh.DISCONNECTED&&this.openSocket(),t.has("status")&&this.status===kh.CONNECTED&&this.focusInput()}openChat(){this.open=!0}handleKeyUp(t){this.hasPendingText&&"Enter"===t.key&&this.sendPendingMessage(),this.hasPendingText=t.target.value.length>0}sendPendingMessage(){if(this.status===kh.CONNECTED){const t=this.shadowRoot.querySelector(".input"),e=t.value;t.value="";const i={type:"send_msg",text:e};this.sendSockMessage(i);const o=new Date;this.chat.addMessages([{uuid:Jt(),type:"msg_received",msg:{text:e},created_on:o}],o,!0),this.hasPendingText=t.value.length>0}}handleClickInputPanel(t){t.preventDefault(),t.stopPropagation();this.shadowRoot.querySelector(".input").focus()}toggleChat(){this.open=!this.open}render(){return H`
7525
7526
  <div class="chat ${this.status} ${this.open?"open":""}">
7526
7527
  <div class="header">
7527
7528
  <slot name="header">${this.urn?this.urn:"Chat"}</slot>
@@ -8409,16 +8410,16 @@ background: #ccc;
8409
8410
  >
8410
8411
  ${e?H`<div style="margin-right:0.4em; width: 1em;"></div>`:null}
8411
8412
  <div style="font-size:0.8em">+${o} more</div>
8412
- </div>`)}return i},Nh=[{scheme:"tel",name:"SMS",path:"Phone Number"},{scheme:"whatsapp",name:"WhatsApp",path:"WhatsApp Number"},{scheme:"facebook",name:"Facebook",path:"Facebook ID"},{scheme:"instagram",name:"Instagram",path:"Instagram ID"},{scheme:"twitterid",name:"Twitter",path:"Twitter ID",excludeFromSplit:!0},{scheme:"telegram",name:"Telegram",path:"Telegram ID"},{scheme:"viber",name:"Viber",path:"Viber ID"},{scheme:"line",name:"Line",path:"Line ID"},{scheme:"wechat",name:"WeChat",path:"WeChat ID"},{scheme:"fcm",name:"Firebase",path:"Firebase ID"},{scheme:"jiochat",name:"JioChat",path:"JioChat ID"},{scheme:"freshchat",name:"Freshchat",path:"Freshchat ID"},{scheme:"mailto",name:"Email",path:"Email Address",excludeFromSplit:!0},{scheme:"twitter",name:"Twitter",path:"Twitter Handle",excludeFromSplit:!0},{scheme:"vk",name:"VK",path:"VK ID"},{scheme:"discord",name:"Discord",path:"Discord ID"},{scheme:"webchat",name:"Webchat",path:"Webchat ID",excludeFromSplit:!0},{scheme:"rocketchat",name:"RocketChat",path:"RocketChat ID"},{scheme:"ext",name:"External",path:"External ID"}],Bh=(t,e,i)=>{const o=i||document.querySelector(`[id="${t}"]`);if(!o)return null;const n=o.getBoundingClientRect(),s=n.width,r=n.height;return{uuid:t,left:e.left,top:e.top,right:e.left+s,bottom:e.top+r,width:s,height:r}},Fh=(t,e)=>!(t.right<=e.left-10||t.left>=e.right+10||t.bottom<=e.top-10||t.top>=e.bottom+10),qh=["down","up","right","left"],Uh=(t,e,i)=>({...t,left:e,top:i,right:e+t.width,bottom:i+t.height}),jh=(t,e,i)=>{switch(i){case"down":{const i=Math.max(...e.map((t=>t.bottom))),o=Lh(i+30);return{left:t.left,top:o}}case"up":{const i=Math.min(...e.map((t=>t.top))),o=Lh(i-t.height-30);return o<0?{left:t.left,top:0}:{left:t.left,top:o}}case"right":{const i=Math.max(...e.map((t=>t.right)));return{left:Lh(i+30),top:t.top}}case"left":{const i=Math.min(...e.map((t=>t.left))),o=Lh(i-t.width-30);return o<0?{left:0,top:t.top}:{left:o,top:t.top}}}},Vh="message",Hh="voice",Wh="background",Zh="ai",Yh="airtime",Gh={send:"send",contacts:"contacts",save:"save",services:"services",broadcast:"broadcast",trigger:"trigger"},Kh={wait:"wait",split:"split"},Xh={[Gh.send]:{color:"#3498db",title:"Send",description:"Actions that send messages or content to contacts"},[Gh.contacts]:{color:"#01c1af",title:"Contact",description:"Actions that update contact information"},[Gh.save]:{color:"#1a777c",title:"Save",description:"Actions that save or store data"},[Gh.services]:{color:"#f79035ff",title:"Services",description:"Call external services and APIs"},[Gh.broadcast]:{color:"#8e5ea7",title:"Other People",description:"Actions that apply to others instead of the contact"},[Gh.trigger]:{color:"#df419f",title:"Trigger",description:"Actions that trigger other behavior"}},Qh={[Kh.wait]:{color:"#4d7dad",title:"Wait",description:"Wait for user and split on their response"},[Kh.split]:{color:"#aaaaaa",title:"Split",description:"Split the flow based on conditions"}},Jh={name:"Add Input Labels",group:Gh.save,flowTypes:[Hh,Vh,Wh],render:(t,e)=>H`<div>${Ph(e.labels,"label")}</div>`,toFormData:t=>({labels:t.labels||null,uuid:t.uuid}),form:{labels:{type:"select",label:"Labels",helpText:"Select labels to add to the input. Type a new label name to create it.",required:!0,options:[],multi:!0,searchable:!0,endpoint:"/api/v2/labels.json",valueKey:"uuid",nameKey:"name",placeholder:"Search for labels or type to create new ones...",allowCreate:!0,createArbitraryOption:(t,e)=>!e.find((e=>e.name.toLowerCase().trim()===t.toLowerCase().trim()))&&t.trim()?{name:t.trim(),arbitrary:!0}:null}},fromFormData:t=>({uuid:t.uuid,type:"add_input_labels",labels:t.labels||[]})},tu={name:"Add URN",group:Gh.contacts,flowTypes:[Hh,Vh,Wh],render:(t,e)=>{const i=Nh.find((t=>t.scheme===e.scheme)),o=(null==i?void 0:i.path)||e.scheme;return H`<div
8413
+ </div>`)}return i},Nh=[{scheme:"tel",name:"SMS",path:"Phone Number"},{scheme:"whatsapp",name:"WhatsApp",path:"WhatsApp Number"},{scheme:"facebook",name:"Facebook",path:"Facebook ID"},{scheme:"instagram",name:"Instagram",path:"Instagram ID"},{scheme:"twitterid",name:"Twitter",path:"Twitter ID",excludeFromSplit:!0},{scheme:"telegram",name:"Telegram",path:"Telegram ID"},{scheme:"viber",name:"Viber",path:"Viber ID"},{scheme:"line",name:"Line",path:"Line ID"},{scheme:"wechat",name:"WeChat",path:"WeChat ID"},{scheme:"fcm",name:"Firebase",path:"Firebase ID"},{scheme:"jiochat",name:"JioChat",path:"JioChat ID"},{scheme:"freshchat",name:"Freshchat",path:"Freshchat ID"},{scheme:"mailto",name:"Email",path:"Email Address",excludeFromSplit:!0},{scheme:"twitter",name:"Twitter",path:"Twitter Handle",excludeFromSplit:!0},{scheme:"vk",name:"VK",path:"VK ID"},{scheme:"discord",name:"Discord",path:"Discord ID"},{scheme:"webchat",name:"Webchat",path:"Webchat ID",excludeFromSplit:!0},{scheme:"rocketchat",name:"RocketChat",path:"RocketChat ID"},{scheme:"ext",name:"External",path:"External ID"}],Bh=(t,e,i)=>{const o=i||document.querySelector(`[id="${t}"]`);if(!o)return null;const n=o.getBoundingClientRect(),s=n.width,r=n.height;return{uuid:t,left:e.left,top:e.top,right:e.left+s,bottom:e.top+r,width:s,height:r}},Fh=(t,e)=>!(t.right<=e.left-10||t.left>=e.right+10||t.bottom<=e.top-10||t.top>=e.bottom+10),qh=["down","up","right","left"],Uh=(t,e,i)=>({...t,left:e,top:i,right:e+t.width,bottom:i+t.height}),jh=(t,e,i)=>{switch(i){case"down":{const i=Math.max(...e.map((t=>t.bottom))),o=Lh(i+30);return{left:t.left,top:o}}case"up":{const i=Math.min(...e.map((t=>t.top))),o=Lh(i-t.height-30);return o<0?{left:t.left,top:0}:{left:t.left,top:o}}case"right":{const i=Math.max(...e.map((t=>t.right)));return{left:Lh(i+30),top:t.top}}case"left":{const i=Math.min(...e.map((t=>t.left))),o=Lh(i-t.width-30);return o<0?{left:0,top:t.top}:{left:o,top:t.top}}}},Vh="message",Hh="voice",Wh="background",Zh="ai",Yh="airtime",Gh={send:"send",contacts:"contacts",save:"save",services:"services",broadcast:"broadcast",trigger:"trigger"},Kh={wait:"wait",split:"split"},Xh={[Gh.send]:{color:"#3498db",title:"Send",description:"Actions that send messages or content to contacts"},[Gh.contacts]:{color:"#01c1af",title:"Contact",description:"Actions that update contact information"},[Gh.save]:{color:"#1a777c",title:"Save",description:"Actions that save or store data"},[Gh.services]:{color:"#f79035ff",title:"Services",description:"Call external services and APIs"},[Gh.broadcast]:{color:"#8e5ea7",title:"Other People",description:"Actions that apply to others instead of the contact"},[Gh.trigger]:{color:"#df419f",title:"Trigger",description:"Actions that trigger other behavior"}},Qh={[Kh.wait]:{color:"#4d7dad",title:"Wait",description:"Wait for user and split on their response"},[Kh.split]:{color:"#aaaaaa",title:"Split",description:"Split the flow based on conditions"}},Jh={name:"Add Input Labels",group:Gh.save,flowTypes:[Hh,Vh,Wh],render:(t,e)=>H`<div>${Ph(e.labels,"label")}</div>`,toFormData:t=>({labels:t.labels||null,uuid:t.uuid}),form:{labels:{type:"select",label:"Labels",helpText:"Select labels to add to the input. Type a new label name to create it.",required:!0,options:[],multi:!0,searchable:!0,endpoint:"/api/v2/labels.json",valueKey:"uuid",nameKey:"name",placeholder:"Search for labels or type to create new ones...",allowCreate:!0,createArbitraryOption:(t,e)=>!e.find((e=>e.name.toLowerCase().trim()===t.toLowerCase().trim()))&&t.trim()?{name:t.trim(),arbitrary:!0}:null}},fromFormData:t=>({uuid:t.uuid,type:"add_input_labels",labels:(t.labels||[]).map((t=>({uuid:t.uuid,name:t.name})))})},tu={name:"Add URN",group:Gh.contacts,flowTypes:[Hh,Vh,Wh],render:(t,e)=>{const i=Nh.find((t=>t.scheme===e.scheme)),o=(null==i?void 0:i.path)||e.scheme;return H`<div
8413
8414
  style="word-wrap: break-word; overflow-wrap: break-word; hyphens: auto;"
8414
8415
  >
8415
8416
  Add ${o} <strong>${e.path}</strong>
8416
8417
  </div>`},toFormData:t=>{const e=Nh.find((e=>e.scheme===t.scheme));return{uuid:t.uuid,scheme:e?[{name:e.path,value:t.scheme}]:null,path:t.path||""}},fromFormData:t=>{const e=Array.isArray(t.scheme)&&t.scheme.length>0?t.scheme[0].value:"tel";return{uuid:t.uuid,type:"add_contact_urn",scheme:e,path:t.path||""}},form:{scheme:{type:"select",label:"URN Type",helpText:"Select the type of URN to add to the contact",required:!0,searchable:!1,multi:!1,options:Nh.map((t=>({name:t.path,value:t.scheme})))},path:{type:"text",label:"URN Value",helpText:"Enter the URN value (e.g., phone number, Facebook ID, etc.)",required:!0,placeholder:"Enter the URN value...",evaluated:!0}},validate:t=>{const e={};return t.scheme&&0!==t.scheme.length||(e.scheme="URN type is required"),t.path&&""!==t.path.trim()||(e.path="URN value is required"),{valid:0===Object.keys(e).length,errors:e}}},eu={name:"Update Field",group:Gh.contacts,flowTypes:[Hh,Vh,Wh],render:(t,e)=>e.value?H`<div>
8417
8418
  Set <strong>${e.field.name}</strong> to
8418
8419
  <strong>${e.value}</strong>
8419
- </div>`:H`<div>Clear <strong>${e.field.name}</strong></div>`,form:{field:{type:"select",label:"Field",required:!0,searchable:!0,clearable:!1,placeholder:"Search for contact fields...",nameKey:"name",valueKey:"key",endpoint:"/api/v2/fields.json",helpText:"Select the contact field to update",allowCreate:!0,createArbitraryOption:t=>({key:t,name:t,type:"text"})},value:{type:"text",label:"Value",placeholder:"Enter field value...",evaluated:!0,helpText:"The new value for the contact field. You can use expressions like @contact.name"}},toFormData:t=>({uuid:t.uuid,field:t.field?[t.field]:null,value:t.value}),fromFormData:t=>{const e=t.field[0];return{uuid:t.uuid,type:"set_contact_field",field:{name:e.name,key:e.key},value:t.value}},sanitize:t=>{t.value&&"string"==typeof t.value&&(t.value=t.value.trim())}},iu={name:"Update Channel",group:Gh.contacts,flowTypes:[Hh,Vh,Wh],render:(t,e)=>H`<div>Set to <strong>${e.channel.name}</strong></div>`,form:{channel:{type:"select",label:"Channel",required:!0,searchable:!0,clearable:!1,endpoint:"/api/v2/channels.json",valueKey:"uuid",nameKey:"name",helpText:"Select the channel to set for the contact"}},toFormData:t=>({uuid:t.uuid,channel:t.channel?[t.channel]:null})},ou={name:"Update Language",group:Gh.contacts,flowTypes:[Hh,Vh,Wh],render:(t,e)=>{const i=new Intl.DisplayNames(["en"],{type:"language"});return H`<div>
8420
+ </div>`:H`<div>Clear <strong>${e.field.name}</strong></div>`,form:{field:{type:"select",label:"Field",required:!0,searchable:!0,clearable:!1,placeholder:"Search for contact fields...",nameKey:"name",valueKey:"key",endpoint:"/api/v2/fields.json",helpText:"Select the contact field to update",allowCreate:!0,createArbitraryOption:t=>({key:t,name:t,type:"text"})},value:{type:"text",label:"Value",placeholder:"Enter field value...",evaluated:!0,helpText:"The new value for the contact field. You can use expressions like @contact.name"}},toFormData:t=>({uuid:t.uuid,field:t.field?[t.field]:null,value:t.value}),fromFormData:t=>{const e=t.field[0];return{uuid:t.uuid,type:"set_contact_field",field:{name:e.name,key:e.key},value:t.value}},sanitize:t=>{t.value&&"string"==typeof t.value&&(t.value=t.value.trim())}},iu={name:"Update Channel",group:Gh.contacts,flowTypes:[Hh,Vh,Wh],render:(t,e)=>H`<div>Set to <strong>${e.channel.name}</strong></div>`,form:{channel:{type:"select",label:"Channel",required:!0,searchable:!0,clearable:!1,endpoint:"/api/v2/channels.json",valueKey:"uuid",nameKey:"name",placeholder:"Select channel",helpText:"Select the channel to set for the contact"}},toFormData:t=>({uuid:t.uuid,channel:t.channel?[t.channel]:null}),fromFormData:t=>{var e;const i=null===(e=t.channel)||void 0===e?void 0:e[0];return{uuid:t.uuid,type:"set_contact_channel",channel:{uuid:i.uuid||i.value,name:i.name}}}},ou={name:"Update Language",group:Gh.contacts,flowTypes:[Hh,Vh,Wh],render:(t,e)=>{const i=new Intl.DisplayNames(["en"],{type:"language"});return H`<div>
8420
8421
  Set to <strong>${i.of(e.language)}</strong>
8421
- </div>`},form:{language:{type:"select",label:"Language",required:!0,searchable:!0,clearable:!1,valueKey:"value",nameKey:"name",helpText:"Select the language to set for the contact",getDynamicOptions:()=>{const t=Sd(),e=null==t?void 0:t.getState().workspace;if((null==e?void 0:e.languages)&&Array.isArray(e.languages)){const t=new Intl.DisplayNames(["en"],{type:"language"});return e.languages.map((e=>({value:e,name:t.of(e)||e})))}return[]}}},toFormData:t=>{if(t.language){const e=new Intl.DisplayNames(["en"],{type:"language"});return{language:[{value:t.language,name:e.of(t.language)||t.language}],uuid:t.uuid}}return{language:null,uuid:t.uuid}},fromFormData:t=>({uuid:t.uuid,type:"set_contact_language",language:t.language[0].value}),validate:t=>{const e={};return t.language||(e.language="Language is required"),{valid:0===Object.keys(e).length,errors:e}}},nu={name:"Update Status",group:Gh.contacts,flowTypes:[Hh,Vh,Wh],render:(t,e)=>H`<div>Set to <strong>${ze(e.status)}</strong></div>`,toFormData:t=>({...t,status:{name:ze(t.status||"active"),value:t.status||"active"}}),fromFormData:t=>({status:t.status[0].value,type:"set_contact_status",uuid:t.uuid}),form:{status:{type:"select",label:"Status",required:!0,searchable:!1,clearable:!1,options:[{value:"active",name:"Active"},{value:"archived",name:"Archived"},{value:"stopped",name:"Stopped"},{value:"blocked",name:"Blocked"}],helpText:"Select the status to set for the contact"}}},su={name:"Send Broadcast",group:Gh.broadcast,flowTypes:[Hh,Vh,Wh],render:(t,e)=>{const i=[...(e.contacts||[]).map((t=>t.name)),...(e.groups||[]).map((t=>t.name))];return H`<div>
8422
+ </div>`},form:{language:{type:"select",label:"Language",required:!0,searchable:!0,clearable:!1,valueKey:"value",nameKey:"name",helpText:"Select the language to set for the contact",getDynamicOptions:()=>{const t=Sd(),e=null==t?void 0:t.getState().workspace;if((null==e?void 0:e.languages)&&Array.isArray(e.languages)){const t=new Intl.DisplayNames(["en"],{type:"language"});return e.languages.map((e=>({value:e,name:t.of(e)||e})))}return[]}}},toFormData:t=>{if(t.language){const e=new Intl.DisplayNames(["en"],{type:"language"});return{language:[{value:t.language,name:e.of(t.language)||t.language}],uuid:t.uuid}}return{language:null,uuid:t.uuid}},fromFormData:t=>({uuid:t.uuid,type:"set_contact_language",language:t.language[0].value}),validate:t=>{const e={};return t.language||(e.language="Language is required"),{valid:0===Object.keys(e).length,errors:e}}},nu={name:"Update Status",group:Gh.contacts,flowTypes:[Hh,Vh,Wh],render:(t,e)=>H`<div>Set to <strong>${ze(e.status)}</strong></div>`,toFormData:t=>({uuid:t.uuid,status:[{name:ze(t.status||"active"),value:t.status||"active"}]}),fromFormData:t=>({status:t.status[0].value,type:"set_contact_status",uuid:t.uuid}),form:{status:{type:"select",label:"Status",required:!0,searchable:!1,clearable:!1,options:[{value:"active",name:"Active"},{value:"archived",name:"Archived"},{value:"stopped",name:"Stopped"},{value:"blocked",name:"Blocked"}],helpText:"Select the status to set for the contact"}}},su={name:"Send Broadcast",group:Gh.broadcast,flowTypes:[Hh,Vh,Wh],render:(t,e)=>{const i=[...(e.contacts||[]).map((t=>t.name)),...(e.groups||[]).map((t=>t.name))];return H`<div>
8422
8423
  <div>${Rh(i,_o.contacts)}</div>
8423
8424
  <div style="margin-top: 0.5em">
8424
8425
  <div
@@ -8427,7 +8428,7 @@ background: #ccc;
8427
8428
  ${e.text}
8428
8429
  </div>
8429
8430
  </div>
8430
- </div>`},form:{recipients:{type:"select",label:"Recipients",helpText:"Select the contacts or groups to receive the broadcast",options:[],multi:!0,searchable:!0,endpoint:"/api/v2/contacts.json",valueKey:"uuid",nameKey:"name",placeholder:"Search for contacts or groups...",required:!0},text:{type:"message-editor",label:"Message",helpText:"Enter the message to send with optional attachments. You can use expressions like @contact.name",required:!0,evaluated:!0,placeholder:"Type your message here...",maxAttachments:10,accept:"",endpoint:"/api/v2/media.json",counter:"temba-charcount",gsm:!0,autogrow:!0}},layout:["recipients","text"],toFormData:t=>({uuid:t.uuid,recipients:[...t.contacts||[],...t.groups||[]],text:t.text||"",attachments:t.attachments||[]}),fromFormData:t=>{const e=t.recipients||[],i=e.filter((t=>!t.group)),o=e.filter((t=>t.group)),n={uuid:t.uuid,type:"send_broadcast",text:t.text||"",contacts:i,groups:o,attachments:t.attachments||[]};return 0===n.attachments.length&&delete n.attachments,n},sanitize:t=>{t.text&&"string"==typeof t.text&&(t.text=t.text.trim())}},ru={name:"Save Flow Result",group:Gh.save,flowTypes:[Hh,Vh,Wh],render:(t,e)=>H`<div>
8431
+ </div>`},form:{recipients:{type:"select",label:"Recipients",helpText:"Select the contacts or groups to receive the broadcast",options:[],multi:!0,searchable:!0,endpoint:"/api/v2/contacts.json",valueKey:"uuid",nameKey:"name",placeholder:"Search for contacts or groups...",required:!0},text:{type:"message-editor",label:"Message",helpText:"Enter the message to send with optional attachments. You can use expressions like @contact.name",required:!0,evaluated:!0,placeholder:"Type your message here...",maxAttachments:10,accept:"",endpoint:"/api/v2/media.json",counter:"temba-charcount",gsm:!0,autogrow:!0}},layout:["recipients","text"],toFormData:t=>({uuid:t.uuid,recipients:[...t.contacts||[],...t.groups||[]],text:t.text||"",attachments:t.attachments||[]}),fromFormData:t=>{const e=t.recipients||[],i=e.filter((t=>!t.group)).map((t=>({uuid:t.uuid,name:t.name}))),o=e.filter((t=>t.group)).map((t=>({uuid:t.uuid,name:t.name}))),n={uuid:t.uuid,type:"send_broadcast",text:t.text||"",contacts:i,groups:o,attachments:t.attachments||[]};return 0===n.attachments.length&&delete n.attachments,n},sanitize:t=>{t.text&&"string"==typeof t.text&&(t.text=t.text.trim())}},ru={name:"Save Flow Result",group:Gh.save,flowTypes:[Hh,Vh,Wh],render:(t,e)=>H`<div>
8431
8432
  Save <strong>${e.value}</strong> as <strong>${e.name}</strong>
8432
8433
  </div>`,form:{name:{type:"select",label:"Result Name",helpText:"Select an existing result name or type a new one",required:!0,placeholder:"Select or enter result name...",createArbitraryOption:(t,e)=>!e.some((e=>e.value.toLowerCase()===t.toLowerCase()||e.name.toLowerCase()===t.toLowerCase()))&&t.trim().length>0?{value:t,name:t}:null,searchable:!0,clearable:!1,getDynamicOptions:()=>{const t=Sd();return t?t.getState().getFlowResults().map((t=>({value:t.name,name:t.name}))):[]}},value:{type:"text",label:"Value",helpText:"The value to save for this result (can use expressions)",required:!1,evaluated:!0,placeholder:"Enter value..."},category:{type:"text",label:"Category",helpText:"Optional category for this result",required:!1,placeholder:"Enter category..."}},layout:["name","value","category"],toFormData:t=>({uuid:t.uuid,name:t.name?[{name:t.name,value:t.name}]:null,value:t.value||"",category:t.category||""}),fromFormData:t=>{let e=t.name||"";return Array.isArray(e)&&e.length>0&&(e=e[0]),"object"==typeof e&&e.value&&(e=e.value),"object"==typeof e&&e.name&&(e=e.name),{uuid:t.uuid,type:"set_run_result",name:String(e),value:t.value||"",category:t.category||""}}},au={name:"Send Message",group:Gh.send,flowTypes:[Hh,Vh,Wh],render:(t,e)=>{var i;const o=e.text.replace(/\n/g,"<br>");return H`
8433
8434
  ${Ve(o)}
@@ -8460,14 +8461,14 @@ background: #ccc;
8460
8461
  ${Ph([e.flow],"flow")}
8461
8462
  </div>
8462
8463
  </div>
8463
- `},toFormData:t=>{var e;const i=t;let o="manual";t.create_contact?o="create":i.contact_query&&(o="query");const n=[{value:"manual",name:"Select recipients manually"},{value:"query",name:"Select a contact with a query"},{value:"create",name:"Create a new contact"}],s=n.find((t=>t.value===o))||n[0];return{flow:t.flow?[t.flow]:null,recipients:[...t.contacts||[],...t.groups||[]],startType:[s],contactQuery:i.contact_query||"",skipContactsInFlow:(null===(e=i.exclusions)||void 0===e?void 0:e.in_a_flow)||!1,uuid:t.uuid}},form:{flow:{type:"select",label:"Flow",helpText:"Select the flow to start",required:!0,searchable:!0,endpoint:"/api/v2/flows.json",valueKey:"uuid",nameKey:"name",placeholder:"Select a flow..."},startType:{type:"select",label:"Start Type",helpText:"How should contacts be selected?",required:!0,options:[{value:"manual",name:"Select recipients manually"},{value:"query",name:"Select a contact with a query"},{value:"create",name:"Create a new contact"}]},recipients:{type:"select",label:"Recipients",helpText:"Select who should be started in the flow",options:[],multi:!0,searchable:!0,endpoint:"/api/v2/contacts.json",valueKey:"uuid",nameKey:"name",placeholder:"Search for contacts or groups...",conditions:{visible:t=>{var e,i;return"manual"===(null===(i=null===(e=t.startType)||void 0===e?void 0:e[0])||void 0===i?void 0:i.value)}}},contactQuery:{type:"text",evaluated:!0,label:"Contact Query",helpText:"Only one matching contact will be started",placeholder:"household_id = @fields.household_id",conditions:{visible:t=>{var e,i;return"query"===(null===(i=null===(e=t.startType)||void 0===e?void 0:e[0])||void 0===i?void 0:i.value)}}},skipContactsInFlow:{type:"checkbox",label:"Skip contacts currently in a flow",helpText:"Avoid interrupting a contact who is already in a flow"}},layout:["flow","startType","recipients","contactQuery","skipContactsInFlow"],validate:t=>{var e,i;const o={},n=null===(i=null===(e=t.startType)||void 0===e?void 0:e[0])||void 0===i?void 0:i.value;return"manual"!==n||t.recipients&&0!==t.recipients.length||(o.recipients="At least one contact or group must be selected"),"query"!==n||t.contactQuery&&t.contactQuery.trim()||(o.contactQuery="Contact query is required"),{valid:0===Object.keys(o).length,errors:o}},fromFormData:t=>{const e={uuid:t.uuid,type:"start_session",flow:t.flow[0],groups:[],contacts:[]},i=t.startType[0].value;if("create"===i)e.create_contact=!0;else if("query"===i)e.contact_query=t.contactQuery||"";else{const i=t.recipients||[];e.contacts=i.filter((t=>!t.group)),e.groups=i.filter((t=>t.group))}return t.skipContactsInFlow&&(e.exclusions={in_a_flow:!0}),e}},cu={name:"Update Name",group:Gh.contacts,flowTypes:[Hh,Vh,Wh],render:(t,e)=>H`<div>Set to <strong>${e.name}</strong></div>`,form:{name:{type:"text",label:"Name",placeholder:"Enter contact name...",required:!0,evaluated:!0,helpText:"The new name for the contact. You can use expressions like @contact.name"}},sanitize:t=>{t.name&&"string"==typeof t.name&&(t.name=t.name.trim())}},hu={name:"Add to Group",group:Gh.contacts,flowTypes:[Hh,Vh,Wh],render:(t,e)=>H`<div>${Ph(e.groups,"group")}</div>`,toFormData:t=>({groups:t.groups||null,uuid:t.uuid}),form:{groups:{type:"select",label:"Groups",helpText:"Select the groups to add the contact to",required:!0,options:[],multi:!0,searchable:!0,endpoint:"/api/v2/groups.json",valueKey:"uuid",nameKey:"name",placeholder:"Search for groups...",allowCreate:!0,createArbitraryOption:(t,e)=>!e.find((e=>e.name.toLowerCase().trim()===t.toLowerCase().trim()))&&t.trim()?{name:t.trim(),arbitrary:!0}:null}},fromFormData:t=>({uuid:t.uuid,type:"add_contact_groups",groups:t.groups||[]})},uu={name:"Remove from Group",group:Gh.contacts,flowTypes:[Hh,Vh,Wh],render:(t,e)=>e.all_groups?H`<div>Remove from all groups</div>`:H`<div>${Ph(e.groups,"group")}</div>`,toFormData:t=>({uuid:t.uuid,all_groups:t.all_groups||!1,groups:t.groups||null}),form:{groups:{type:"select",label:"Groups",helpText:"Select the groups to remove the contact from",options:[],multi:!0,searchable:!0,endpoint:"/api/v2/groups.json",valueKey:"uuid",nameKey:"name",placeholder:"Search for groups...",conditions:{visible:t=>!t.all_groups}},all_groups:{type:"checkbox",label:"Remove from All Groups",helpText:"Check this to remove the contact from all groups instead of specific ones"}},validate:t=>{const e={};return t.all_groups||t.groups&&0!==t.groups.length||(e.groups='At least one group must be selected or check "Remove from All Groups"'),{valid:0===Object.keys(e).length,errors:e}},fromFormData:t=>({uuid:t.uuid,type:"remove_contact_groups",groups:t.all_groups?[]:t.groups||[],all_groups:t.all_groups||!1})},pu={name:"Request Opt-in",group:Gh.send,flowTypes:[],render:(t,e)=>H`<div>Request Opt-in</div>`},mu=H`<svg
8464
+ `},toFormData:t=>{var e;const i=t;let o="manual";t.create_contact?o="create":i.contact_query&&(o="query");const n=[{value:"manual",name:"Select recipients manually"},{value:"query",name:"Select a contact with a query"},{value:"create",name:"Create a new contact"}],s=n.find((t=>t.value===o))||n[0];return{flow:t.flow?[t.flow]:null,recipients:[...t.contacts||[],...t.groups||[]],startType:[s],contactQuery:i.contact_query||"",skipContactsInFlow:(null===(e=i.exclusions)||void 0===e?void 0:e.in_a_flow)||!1,uuid:t.uuid}},form:{flow:{type:"select",label:"Flow",helpText:"Select the flow to start",required:!0,searchable:!0,endpoint:"/api/v2/flows.json",valueKey:"uuid",nameKey:"name",placeholder:"Select a flow..."},startType:{type:"select",label:"Start Type",helpText:"How should contacts be selected?",required:!0,options:[{value:"manual",name:"Select recipients manually"},{value:"query",name:"Select a contact with a query"},{value:"create",name:"Create a new contact"}]},recipients:{type:"select",label:"Recipients",helpText:"Select who should be started in the flow",options:[],multi:!0,searchable:!0,endpoint:"/api/v2/contacts.json",valueKey:"uuid",nameKey:"name",placeholder:"Search for contacts or groups...",conditions:{visible:t=>{var e,i;return"manual"===(null===(i=null===(e=t.startType)||void 0===e?void 0:e[0])||void 0===i?void 0:i.value)}}},contactQuery:{type:"text",evaluated:!0,label:"Contact Query",helpText:"Only one matching contact will be started",placeholder:"household_id = @fields.household_id",conditions:{visible:t=>{var e,i;return"query"===(null===(i=null===(e=t.startType)||void 0===e?void 0:e[0])||void 0===i?void 0:i.value)}}},skipContactsInFlow:{type:"checkbox",label:"Skip contacts currently in a flow",helpText:"Avoid interrupting a contact who is already in a flow"}},layout:["flow","startType","recipients","contactQuery","skipContactsInFlow"],validate:t=>{var e,i;const o={},n=null===(i=null===(e=t.startType)||void 0===e?void 0:e[0])||void 0===i?void 0:i.value;return"manual"!==n||t.recipients&&0!==t.recipients.length||(o.recipients="At least one contact or group must be selected"),"query"!==n||t.contactQuery&&t.contactQuery.trim()||(o.contactQuery="Contact query is required"),{valid:0===Object.keys(o).length,errors:o}},fromFormData:t=>{const e={uuid:t.uuid,type:"start_session",flow:{uuid:t.flow[0].uuid||t.flow[0].value,name:t.flow[0].name},groups:[],contacts:[]},i=t.startType[0].value;if("create"===i)e.create_contact=!0;else if("query"===i)e.contact_query=t.contactQuery||"";else{const i=t.recipients||[];e.contacts=i.filter((t=>!t.group)).map((t=>({uuid:t.uuid,name:t.name}))),e.groups=i.filter((t=>t.group)).map((t=>({uuid:t.uuid,name:t.name})))}return t.skipContactsInFlow&&(e.exclusions={in_a_flow:!0}),e}},cu={name:"Update Name",group:Gh.contacts,flowTypes:[Hh,Vh,Wh],render:(t,e)=>H`<div>Set to <strong>${e.name}</strong></div>`,form:{name:{type:"text",label:"Name",placeholder:"Enter contact name...",required:!0,evaluated:!0,helpText:"The new name for the contact. You can use expressions like @contact.name"}},sanitize:t=>{t.name&&"string"==typeof t.name&&(t.name=t.name.trim())}},hu={name:"Add to Group",group:Gh.contacts,flowTypes:[Hh,Vh,Wh],render:(t,e)=>H`<div>${Ph(e.groups,"group")}</div>`,toFormData:t=>({groups:t.groups||null,uuid:t.uuid}),form:{groups:{type:"select",label:"Groups",helpText:"Select the groups to add the contact to",required:!0,options:[],multi:!0,searchable:!0,endpoint:"/api/v2/groups.json",valueKey:"uuid",nameKey:"name",placeholder:"Search for groups...",allowCreate:!0,createArbitraryOption:(t,e)=>!e.find((e=>e.name.toLowerCase().trim()===t.toLowerCase().trim()))&&t.trim()?{name:t.trim(),arbitrary:!0}:null}},fromFormData:t=>({uuid:t.uuid,type:"add_contact_groups",groups:(t.groups||[]).map((t=>({uuid:t.uuid,name:t.name})))})},uu={name:"Remove from Group",group:Gh.contacts,flowTypes:[Hh,Vh,Wh],render:(t,e)=>e.all_groups?H`<div>Remove from all groups</div>`:H`<div>${Ph(e.groups,"group")}</div>`,toFormData:t=>({uuid:t.uuid,all_groups:t.all_groups||!1,groups:t.groups||null}),form:{groups:{type:"select",label:"Groups",helpText:"Select the groups to remove the contact from",options:[],multi:!0,searchable:!0,endpoint:"/api/v2/groups.json",valueKey:"uuid",nameKey:"name",placeholder:"Search for groups...",conditions:{visible:t=>!t.all_groups}},all_groups:{type:"checkbox",label:"Remove from All Groups",helpText:"Check this to remove the contact from all groups instead of specific ones"}},validate:t=>{const e={};return t.all_groups||t.groups&&0!==t.groups.length||(e.groups='At least one group must be selected or check "Remove from All Groups"'),{valid:0===Object.keys(e).length,errors:e}},fromFormData:t=>({uuid:t.uuid,type:"remove_contact_groups",groups:t.all_groups?[]:(t.groups||[]).map((t=>({uuid:t.uuid,name:t.name}))),all_groups:t.all_groups||!1})},pu={name:"Request Opt-in",group:Gh.send,flowTypes:[],render:(t,e)=>H`<div>Request Opt-in</div>`},mu=H`<svg
8464
8465
  viewBox="0 0 24 24"
8465
8466
  width="16"
8466
8467
  height="16"
8467
8468
  fill="currentColor"
8468
8469
  >
8469
8470
  <polygon points="6,3 20,12 6,21" />
8470
- </svg>`;let gu=null,fu=null;function vu(t){const e=t.querySelector(".audio-play-btn"),i=t.querySelector(".audio-progress");e&&(e.innerHTML='<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><polygon points="6,3 20,12 6,21"/></svg>'),i&&(i.style.width="0%")}function bu(t){t.stopPropagation(),t.preventDefault();const e=t.currentTarget.closest(".audio-player");if(!e)return;const i=e.dataset.url;if(!i)return;const o=e.querySelector(".audio-play-btn"),n=e.querySelector(".audio-progress");if(gu&&fu===e&&!gu.paused)return gu.pause(),void(o.innerHTML='<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><polygon points="6,3 20,12 6,21"/></svg>');gu&&(gu.pause(),gu.currentTime=0,fu&&vu(fu),gu=null,fu=null);const s=new Audio(i);gu=s,fu=e,o.innerHTML='<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><rect x="5" y="3" width="4" height="18"/><rect x="15" y="3" width="4" height="18"/></svg>',s.addEventListener("timeupdate",(()=>{if(s.duration&&n){const t=s.currentTime/s.duration*100;n.style.width=`${t}%`}})),s.addEventListener("ended",(()=>{vu(e),gu=null,fu=null})),s.addEventListener("error",(()=>{vu(e),gu=null,fu=null})),s.play().catch((()=>{vu(e),gu=null,fu=null}))}const yu={name:"Say Message",group:Gh.send,flowTypes:[Hh],render:(t,e)=>{const i=(e.text||"").replace(/\n/g,"<br>");return H`
8471
+ </svg>`;let gu=null,fu=null;function vu(t){const e=t.querySelector(".audio-play-btn"),i=t.querySelector(".audio-progress");e&&(e.innerHTML='<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><polygon points="6,3 20,12 6,21"/></svg>'),i&&(i.style.width="0%")}function yu(t){t.stopPropagation(),t.preventDefault();const e=t.currentTarget.closest(".audio-player");if(!e)return;const i=e.dataset.url;if(!i)return;const o=e.querySelector(".audio-play-btn"),n=e.querySelector(".audio-progress");if(gu&&fu===e&&!gu.paused)return gu.pause(),void(o.innerHTML='<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><polygon points="6,3 20,12 6,21"/></svg>');gu&&(gu.pause(),gu.currentTime=0,fu&&vu(fu),gu=null,fu=null);const s=new Audio(i);gu=s,fu=e,o.innerHTML='<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><rect x="5" y="3" width="4" height="18"/><rect x="15" y="3" width="4" height="18"/></svg>',s.addEventListener("timeupdate",(()=>{if(s.duration&&n){const t=s.currentTime/s.duration*100;n.style.width=`${t}%`}})),s.addEventListener("ended",(()=>{vu(e),gu=null,fu=null})),s.addEventListener("error",(()=>{vu(e),gu=null,fu=null})),s.play().catch((()=>{vu(e),gu=null,fu=null}))}const bu={name:"Say Message",group:Gh.send,flowTypes:[Hh],render:(t,e)=>{const i=(e.text||"").replace(/\n/g,"<br>");return H`
8471
8472
  ${Ve(i)}
8472
8473
  ${e.audio_url?H`<div style="margin-top: 0.5em;">
8473
8474
  ${o=e.audio_url,H`
@@ -8480,7 +8481,7 @@ background: #ccc;
8480
8481
  >
8481
8482
  <div
8482
8483
  class="audio-play-btn"
8483
- @click=${bu}
8484
+ @click=${yu}
8484
8485
  style="cursor: pointer; color: #666; display: flex; align-items: center; flex-shrink: 0;"
8485
8486
  >
8486
8487
  ${mu}
@@ -8511,11 +8512,11 @@ background: #ccc;
8511
8512
  ${s}
8512
8513
  ${r}${a>0?H` <span style="color: #999;">+${a} more</span>`:""}
8513
8514
  </div>
8514
- `},toFormData:t=>{var e,i;const o=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"transfer_airtime"===t.type)),n=[];return o&&o.amounts&&Object.entries(o.amounts).forEach((([t,e])=>{var i;n.push({currency:[{value:t,name:(null===(i=wu[t])||void 0===i?void 0:i.name)?`${wu[t].name} (${t})`:t}],amount:String(e)})})),{uuid:t.uuid,amounts:n,result_name:(null===(i=t.router)||void 0===i?void 0:i.result_name)||""}},fromFormData:(t,e)=>{var i,o,n;const s={};t.amounts&&Array.isArray(t.amounts)&&t.amounts.forEach((t=>{var e;if(!(null==t?void 0:t.currency)||!(null==t?void 0:t.amount)||""===t.amount.trim())return;let i;if(Array.isArray(t.currency)&&t.currency.length>0)i=t.currency[0].value;else if("string"==typeof t.currency)i=t.currency;else{if(!(null===(e=t.currency)||void 0===e?void 0:e.value))return;i=t.currency.value}const o=parseFloat(t.amount.trim());!isNaN(o)&&o>0&&(s[i]=o)}));const r=null===(i=e.actions)||void 0===i?void 0:i.find((t=>"transfer_airtime"===t.type)),a={type:"transfer_airtime",uuid:(null==r?void 0:r.uuid)||Xt(),amounts:s},l=(null===(o=e.router)||void 0===o?void 0:o.categories)||[],d=e.exits||[],c=(null===(n=e.router)||void 0===n?void 0:n.cases)||[],{router:h,exits:u}=De("@locals._new_transfer",{type:"has_text",arguments:[]},l,d,c),p={...h};return t.result_name&&""!==t.result_name.trim()&&(p.result_name=t.result_name.trim()),{uuid:e.uuid,actions:[a],router:p,exits:u}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},$u=[{type:"has_any_word",name:"has any of the words",operands:1},{type:"has_all_words",name:"has all of the words",operands:1},{type:"has_phrase",name:"has the phrase",operands:1},{type:"has_only_phrase",name:"has only the phrase",operands:1},{type:"has_beginning",name:"starts with",operands:1},{type:"has_text",name:"has some text",operands:0,categoryName:"Has Text"},{type:"has_number",name:"has a number",operands:0,categoryName:"Has Number"},{type:"has_number_between",name:"has a number between",operands:2},{type:"has_number_lt",name:"has a number below",operands:1},{type:"has_number_lte",name:"has a number at or below",operands:1},{type:"has_number_eq",name:"has a number equal to",operands:1},{type:"has_number_gte",name:"has a number at or above",operands:1},{type:"has_number_gt",name:"has a number above",operands:1},{type:"has_date",name:"has a date",operands:0,categoryName:"Has Date"},{type:"has_date_lt",name:"has a date before",operands:1},{type:"has_date_eq",name:"has a date equal to",operands:1},{type:"has_date_gt",name:"has a date after",operands:1},{type:"has_time",name:"has a time",operands:0,categoryName:"Has Time"},{type:"has_phone",name:"has a phone number",operands:0,categoryName:"Has Phone"},{type:"has_email",name:"has an email",operands:0,categoryName:"Has Email"},{type:"has_state",name:"has state",operands:0,categoryName:"Has State",filter:"HAS_LOCATIONS"},{type:"has_district",name:"has district",operands:1,categoryName:"Has District",filter:"HAS_LOCATIONS"},{type:"has_ward",name:"has ward",operands:2,categoryName:"Has Ward",filter:"HAS_LOCATIONS"},{type:"has_group",name:"is in the group",operands:1,visibility:"hidden"},{type:"has_category",name:"has the category",operands:0,visibility:"hidden"},{type:"has_error",name:"has an error",operands:0,categoryName:"Has Error",visibility:"hidden"},{type:"has_value",name:"is not empty",operands:0,categoryName:"Not Empty",visibility:"hidden"},{type:"has_pattern",name:"matches regex",operands:1}],Tu=()=>$u.filter((t=>"hidden"!==t.visibility&&!t.filter)),Du=new Set(["has_beginning","has_number","has_number_between","has_number_lt","has_number_lte","has_number_eq","has_number_gte","has_number_gt","has_pattern"]),Mu=t=>$u.find((e=>e.type===t)),Iu=t=>t.map((t=>({value:t.type,name:t.name}))),Ou=t=>{if("string"==typeof t)return t.trim();if(Array.isArray(t)&&t.length>0){const e=t[0];if(e&&"object"==typeof e&&e.value)return e.value.trim()}else if(t&&"object"==typeof t&&t.value)return t.value.trim();return""},Lu=t=>{const e=Ou(t.operator);if(!e||!t.category||""===t.category.trim())return!0;const i=Mu(e);return i&&1===i.operands?!t.value1||""===t.value1.trim():!(!i||2!==i.operands)&&(!t.value1||""===t.value1.trim()||!t.value2||""===t.value2.trim())},zu=t=>{const e=Ou(t.operator),i=Mu(e);return!i||i.operands>=1},Pu=t=>{const e=Ou(t.operator),i=Mu(e);return!!i&&2===i.operands},Ru=()=>({operator:{type:"select",required:!0,multi:!1,options:[],flavor:"xsmall",width:"220px"},value1:{type:"text",flavor:"xsmall",conditions:{visible:zu}},value2:{type:"text",flavor:"xsmall",conditions:{visible:Pu}},category:{type:"text",placeholder:"Category",required:!0,maxWidth:"120px",flavor:"xsmall"}}),Nu=t=>(t.rules||[]).filter((t=>{const e=Ou(null==t?void 0:t.operator);if(!e||!(null==t?void 0:t.category)||""===e||""===t.category.trim())return!1;const i=Mu(e);return i&&1===i.operands?(null==t?void 0:t.value1)&&""!==t.value1.trim():!i||2!==i.operands||(null==t?void 0:t.value1)&&""!==t.value1.trim()&&(null==t?void 0:t.value2)&&""!==t.value2.trim()})).map((t=>{const e=Ou(t.operator),i=Mu(e);let o="";if(i&&1===i.operands)o=t.value1?t.value1.trim():"";else if(i&&2===i.operands){o=`${t.value1?t.value1.trim():""} ${t.value2?t.value2.trim():""}`.trim()}else o="";return{operator:e,value:o,category:t.category.trim()}})),Bu=t=>{var e,i;const o=[];return(null===(e=t.router)||void 0===e?void 0:e.cases)&&(null===(i=t.router)||void 0===i?void 0:i.categories)&&t.router.cases.forEach((e=>{const i=t.router.categories.find((t=>t.uuid===e.category_uuid));if(i&&(n=i.name,!["No Response","Other","All Responses","Timeout"].includes(n))){const t=Mu(e.type),n=t?t.name:e.type;let s="",r="";t&&0===t.operands?(s="",r=""):t&&1===t.operands?(s=e.arguments.join(" "),r=""):t&&2===t.operands?(s=e.arguments[0]||"",r=e.arguments[1]||""):(s=e.arguments.join(" "),r=""),o.push({operator:{value:e.type,name:n},value1:s,value2:r,category:i.name})}var n})),o};const Fu=(t,e="Define rules to categorize responses")=>({type:"array",helpText:e,itemLabel:"Rule",minItems:0,maxItems:100,sortable:!0,maintainEmptyItem:!0,isEmptyItem:Lu,onItemChange:(t,e,i,o)=>{const n=[...o],s={...n[t]};s[e]=i;const r=o[t]||{},a=Ou("operator"===e?r.operator:s.operator),l=Ou(s.operator),d=Oe(a,Mu,"value1"===e?r.value1:s.value1,"value2"===e?r.value2:s.value2),c=Oe(l,Mu,s.value1,s.value2);return(!s.category||""===s.category.trim()||s.category===d)&&c&&(s.category=c),n[t]=s,n},itemConfig:{...Ru(),operator:{...Ru().operator,options:t}}}),qu={name:{id:"name",name:"Name",type:"property"},language:{id:"language",name:"Language",type:"property"},status:{id:"status",name:"Status",type:"property"},channel:{id:"channel",name:"Channel",type:"property"}},Uu={type:"split_by_contact_field",name:"Split by Contact Field",group:Kh.split,flowTypes:[Hh,Vh,Wh],dialogSize:"large",form:{field:{type:"select",required:!0,searchable:!0,clearable:!1,endpoint:"/api/v2/fields.json",valueKey:"key",nameKey:"name",placeholder:"Select a field...",options:[...Object.values(qu).map((t=>({value:t.id,name:t.name,type:t.type}))),...Nh.filter((t=>!t.excludeFromSplit)).map((t=>({value:t.scheme,name:t.path,type:"scheme"})))]},rules:Fu(Iu(Tu()),"Define rules to split the contact field into categories"),result_name:Cu},layout:["field","rules","result_name"],validate:t=>{const e={};return t.field&&0!==t.field.length||(e.field="A field is required"),{valid:0===Object.keys(e).length,errors:e}},toFormData:(t,e)=>{var i,o;const n=(null===(i=null==e?void 0:e.config)||void 0===i?void 0:i.operand)||qu.name,s=Bu(t);return{uuid:t.uuid,field:[n],rules:s,result_name:(null===(o=t.router)||void 0===o?void 0:o.result_name)||""}},fromFormData:(t,e)=>{var i,o,n;const s=null===(i=t.field)||void 0===i?void 0:i[0];if(!s)return e;const r=(t=>{if("scheme"===t.type)return`@(default(urn_parts(urns.${t.id||t.value}).path, ""))`;return"property"===t.type?`@contact.${t.id}`:`@fields.${t.key}`})(s),a=Nu(t),l=(null===(o=e.router)||void 0===o?void 0:o.categories)||[],d=e.exits||[],c=(null===(n=e.router)||void 0===n?void 0:n.cases)||[],{router:h,exits:u}=Le(r,a,Mu,l,d,c),p={...h};return t.result_name&&""!==t.result_name.trim()&&(p.result_name=t.result_name.trim()),{...e,router:p,exits:u}},toUIConfig:t=>{var e;const i=null===(e=t.field)||void 0===e?void 0:e[0];if(!i)return{};let o=i.id||i.value||i.key;"scheme"===i.type&&(o=i.value||i.id);let n=i.type;return"property"!==n&&"scheme"!==n&&(n="field"),{operand:{id:o,name:i.name||i.label,type:n}}},renderTitle:(t,e)=>H`<div>Split by ${e.config.operand.name}</div>`,localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},ju={type:"split_by_expression",name:"Split by Expression",group:Kh.split,flowTypes:[Hh,Vh,Wh],dialogSize:"large",form:{operand:{type:"text",label:"Expression",helpText:"The expression to evaluate and split on",required:!0,evaluated:!0,placeholder:"@fields.age"},rules:Fu(Iu(Tu()),"Define rules to categorize the expression result"),result_name:Cu},layout:["operand","rules","result_name"],validate:t=>{const e={};return t.operand&&""!==t.operand.trim()||(e.operand="Expression is required"),{valid:0===Object.keys(e).length,errors:e}},toFormData:t=>{var e,i;const o=Bu(t);return{uuid:t.uuid,operand:(null===(e=t.router)||void 0===e?void 0:e.operand)||"@input.text",rules:o,result_name:(null===(i=t.router)||void 0===i?void 0:i.result_name)||""}},fromFormData:(t,e)=>{var i,o,n;const s=Nu(t),r=(null===(i=t.operand)||void 0===i?void 0:i.trim())||"@input.text",a=(null===(o=e.router)||void 0===o?void 0:o.categories)||[],l=e.exits||[],d=(null===(n=e.router)||void 0===n?void 0:n.cases)||[],{router:c,exits:h}=Le(r,s,Mu,a,l,d),u={...c};return t.result_name&&""!==t.result_name.trim()&&(u.result_name=t.result_name.trim()),{...e,router:u,exits:h}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},Vu={type:"split_by_groups",name:"Split by Group",group:Kh.split,flowTypes:[Hh,Vh,Wh],form:{groups:{type:"select",label:"Groups",helpText:"Select the groups to split contacts by. Contacts will be routed based on their group membership.",required:!0,options:[],multi:!0,searchable:!0,endpoint:"/api/v2/groups.json",valueKey:"uuid",nameKey:"name",placeholder:"Search for groups...",allowCreate:!0,createArbitraryOption:(t,e)=>!e.find((e=>e.name.toLowerCase().trim()===t.toLowerCase().trim()))&&t.trim()?{name:t.trim(),arbitrary:!0}:null},result_name:Cu},layout:["groups","result_name"],validate:t=>{const e={};return t.groups&&Array.isArray(t.groups)&&0!==t.groups.length||(e.groups="At least one group is required"),{valid:0===Object.keys(e).length,errors:e}},toFormData:t=>{var e,i;const o=[];return(null===(e=t.router)||void 0===e?void 0:e.cases)&&t.router.cases.forEach((t=>{var e;"has_group"===t.type&&(null===(e=t.arguments)||void 0===e?void 0:e.length)>=2&&o.push({uuid:t.arguments[0],name:t.arguments[1]})})),{uuid:t.uuid,groups:o,result_name:(null===(i=t.router)||void 0===i?void 0:i.result_name)||""}},fromFormData:(t,e)=>{var i,o;const n=(t.groups||[]).filter((t=>(null==t?void 0:t.uuid)||(null==t?void 0:t.arbitrary))).map((t=>({uuid:t.uuid||Xt(),name:t.name}))),s=(null===(i=e.router)||void 0===i?void 0:i.categories)||[],r=e.exits||[],a=(null===(o=e.router)||void 0===o?void 0:o.cases)||[],{router:l,exits:d}=((t,e=[],i=[],o=[],n="")=>{const s=[],r=[],a=[];t.forEach((t=>{const n=e.find((e=>e.name===t.name)),l=n?i.find((t=>t.uuid===n.exit_uuid)):null,d=o.find((e=>{var i;return(null===(i=e.arguments)||void 0===i?void 0:i[0])===t.uuid})),c=(null==l?void 0:l.uuid)||Xt(),h=(null==n?void 0:n.uuid)||Xt(),u=(null==d?void 0:d.uuid)||Xt();s.push({uuid:h,name:t.name,exit_uuid:c}),r.push({uuid:c,destination_uuid:(null==l?void 0:l.destination_uuid)||null}),a.push({uuid:u,type:"has_group",arguments:[t.uuid,t.name],category_uuid:h})}));const l=e.find((e=>"Other"===e.name&&!t.some((t=>t.name===e.name)))),d=l?i.find((t=>t.uuid===l.exit_uuid)):null,c=(null==d?void 0:d.uuid)||Xt(),h=(null==l?void 0:l.uuid)||Xt();return s.push({uuid:h,name:"Other",exit_uuid:c}),r.push({uuid:c,destination_uuid:(null==d?void 0:d.destination_uuid)||null}),{router:{type:"switch",cases:a,categories:s,default_category_uuid:h,operand:"@contact.groups",result_name:n},exits:r}})(n,s,r,a,t.result_name||"");return{uuid:e.uuid,actions:e.actions||[],router:l,exits:d}},router:{type:"switch",operand:"@contact.groups"},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},Hu={type:"split_by_random",name:"Random Split",group:Kh.split,flowTypes:[Hh,Vh,Wh],form:{categories:{type:"array",label:"Buckets",helpText:"Define the buckets to randomly split contacts into",required:!0,itemLabel:"Bucket",sortable:!0,minItems:2,maxItems:10,isEmptyItem:t=>!t.name||""===t.name.trim(),itemConfig:{name:{type:"text",placeholder:"Bucket name",required:!0}}}},layout:["categories"],validate:t=>{const e={};if(t.categories&&Array.isArray(t.categories)){const i=t.categories.filter((t=>(null==t?void 0:t.name)&&""!==t.name.trim()));i.length<2&&(e.categories="At least 2 buckets are required for random split");const o=[],n=new Map;if(i.forEach((t=>{const e=t.name.trim().toLowerCase();n.has(e)||n.set(e,[]),n.get(e).push(t.name.trim())})),n.forEach((t=>{t.length>1&&o.push(...t)})),o.length>0){const t=[...new Set(o)];e.categories=`Duplicate bucket names found: ${t.join(", ")}`}}return{valid:0===Object.keys(e).length,errors:e}},toFormData:t=>{var e,i;const o=(null===(i=null===(e=t.router)||void 0===e?void 0:e.categories)||void 0===i?void 0:i.map((t=>({name:t.name}))))||[];return{uuid:t.uuid,categories:o}},fromFormData:(t,e)=>{var i;const o=(t.categories||[]).filter((t=>{var e;return null===(e=null==t?void 0:t.name)||void 0===e?void 0:e.trim()})).map((t=>t.name.trim())),n=(null===(i=e.router)||void 0===i?void 0:i.categories)||[],s=e.exits||[],{router:r,exits:a}=((t,e=[],i=[])=>{const o=[],n=[];return t.forEach((t=>{const s=e.find((e=>e.name===t)),r=s?i.find((t=>t.uuid===s.exit_uuid)):null,a=(null==r?void 0:r.uuid)||Xt(),l=(null==s?void 0:s.uuid)||Xt();o.push({uuid:l,name:t,exit_uuid:a}),n.push({uuid:a,destination_uuid:(null==r?void 0:r.destination_uuid)||null})})),{router:{type:"random",categories:o},exits:n}})(o,n,s);return{uuid:e.uuid,actions:e.actions||[],router:r,exits:a}},router:{type:"random"},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},Wu=[{value:"0",name:"first result"},{value:"1",name:"second result"},{value:"2",name:"third result"},{value:"3",name:"fourth result"},{value:"4",name:"fifth result"},{value:"5",name:"sixth result"},{value:"6",name:"seventh result"},{value:"7",name:"eighth result"},{value:"8",name:"ninth result"},{value:"9",name:"tenth result"},{value:"10",name:"11th result"},{value:"11",name:"12th result"},{value:"12",name:"13th result"},{value:"13",name:"14th result"},{value:"14",name:"15th result"},{value:"15",name:"16th result"},{value:"16",name:"17th result"},{value:"17",name:"18th result"},{value:"18",name:"19th result"},{value:"19",name:"20th result"}],Zu=[{value:"",name:"Don't delimit result"},{value:" ",name:"Delimited by spaces"},{value:".",name:"Delimited by periods"},{value:"+",name:"Delimited by plusses"}],Yu={type:"split_by_run_result",name:"Split by Result",aliases:["split_by_run_result_delimited"],group:Kh.split,flowTypes:[Hh,Vh,Wh],dialogSize:"large",form:{result:{type:"select",required:!0,searchable:!1,clearable:!1,placeholder:"Select a result...",getDynamicOptions:()=>{const t=Sd();return t?t.getState().getFlowResults().map((t=>({value:t.key,name:t.name}))):[]},valueKey:"value",nameKey:"name"},delimit_by:{type:"select",required:!1,searchable:!1,clearable:!1,options:Zu,valueKey:"value",nameKey:"name",maxWidth:"180px"},delimit_index:{type:"select",required:!1,searchable:!1,clearable:!1,options:Wu,valueKey:"value",nameKey:"name",maxWidth:"140px",conditions:{visible:t=>{var e,i;const o=null===(i=null===(e=t.delimit_by)||void 0===e?void 0:e[0])||void 0===i?void 0:i.value;return void 0!==o&&""!==o}}},rules:Fu(Iu(Tu()),"Define rules to categorize the result"),result_name:Cu},layout:[{type:"row",label:"Flow Result",helpText:"Select a flow result and optionally delimit it to split on a specific part",items:["result","delimit_by","delimit_index"]},"rules","result_name"],validate:t=>{const e={};return t.result&&0!==t.result.length||(e.result="A flow result is required"),{valid:0===Object.keys(e).length,errors:e}},toFormData:(t,e)=>{var i,o,n;const s=null===(i=null==e?void 0:e.config)||void 0===i?void 0:i.operand,r=Bu(t),a=((null===(o=t.router)||void 0===o?void 0:o.operand)||"").match(/field\(results\.[\w]+,\s*(\d+),\s*"(.+?)"\)/),l=null!==a,d=l?parseInt(a[1],10):0,c=l?a[2]:"";return{uuid:t.uuid,result:s?[s]:[],delimit_by:l?[Zu.find((t=>t.value===c))]:[Zu[0]],delimit_index:l?[Wu.find((t=>t.value===String(d)))]:[Wu[0]],rules:r,result_name:(null===(n=t.router)||void 0===n?void 0:n.result_name)||""}},fromFormData:(t,e)=>{var i,o,n,s,r,a,l,d;const c=null===(i=t.result)||void 0===i?void 0:i[0];if(!c)return e;let h;const u=null===(n=null===(o=t.delimit_by)||void 0===o?void 0:o[0])||void 0===n?void 0:n.value;if(void 0!==u&&""!==u){const e=null!==(a=null===(r=null===(s=t.delimit_index)||void 0===s?void 0:s[0])||void 0===r?void 0:r.value)&&void 0!==a?a:"0";h=`@(field(results.${c.value}, ${e}, "${u}"))`}else h=`@results.${c.value}`;const p=Nu(t),m=(null===(l=e.router)||void 0===l?void 0:l.categories)||[],g=e.exits||[],f=(null===(d=e.router)||void 0===d?void 0:d.cases)||[],{router:v,exits:b}=Le(h,p,Mu,m,g,f),y={...v};return t.result_name&&""!==t.result_name.trim()&&(y.result_name=t.result_name.trim()),{...e,router:y,exits:b}},toUIConfig:t=>{var e,i,o,n,s,r;const a=null===(e=t.result)||void 0===e?void 0:e[0];if(!a)return{};const l={operand:{id:a.value,name:a.name,type:"result"}},d=null===(o=null===(i=t.delimit_by)||void 0===i?void 0:i[0])||void 0===o?void 0:o.value,c=void 0!==d&&""!==d;return c&&(l.index=parseInt(null!==(r=null===(s=null===(n=t.delimit_index)||void 0===n?void 0:n[0])||void 0===s?void 0:s.value)&&void 0!==r?r:"0",10),l.delimiter=d),l.type=c?"split_by_run_result_delimited":"split_by_run_result",l},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},Gu={type:"split_by_scheme",name:"Split by URN Type",group:Kh.split,flowTypes:[Hh,Vh,Wh],form:{schemes:{type:"select",label:"Channel Types",helpText:"The contact's URN is the address they used to reach you such as their phone number or a Facebook ID. Select which URN types to split by.",required:!0,options:Nh.map((t=>({value:t.scheme,name:t.name}))),multi:!0,searchable:!0,placeholder:"Select the channels to split by..."},result_name:Cu},layout:["schemes","result_name"],validate:t=>{const e={};return t.schemes&&Array.isArray(t.schemes)&&0!==t.schemes.length||(e.schemes="At least one channel type is required"),{valid:0===Object.keys(e).length,errors:e}},toFormData:t=>{var e,i;const o=[];return(null===(e=t.router)||void 0===e?void 0:e.cases)&&t.router.cases.forEach((t=>{var e;"has_only_phrase"===t.type&&(null===(e=t.arguments)||void 0===e?void 0:e.length)>0&&o.push(t.arguments[0])})),{uuid:t.uuid,schemes:o.map((t=>{const e=Nh.find((e=>e.scheme===t));return{value:t,name:(null==e?void 0:e.name)||t}})),result_name:(null===(i=t.router)||void 0===i?void 0:i.result_name)||""}},fromFormData:(t,e)=>{var i,o;const n=(t.schemes||[]).filter((t=>t)).map((t=>"string"==typeof t?t:t.value)),s=(null===(i=e.router)||void 0===i?void 0:i.categories)||[],r=e.exits||[],a=(null===(o=e.router)||void 0===o?void 0:o.cases)||[],{router:l,exits:d}=((t,e=[],i=[],o=[],n="")=>{const s=[],r=[],a=[];t.forEach((t=>{const n=Nh.find((e=>e.scheme===t)),l=(null==n?void 0:n.name)||t,d=e.find((t=>t.name===l)),c=d?i.find((t=>t.uuid===d.exit_uuid)):null,h=o.find((e=>{var i;return(null===(i=e.arguments)||void 0===i?void 0:i[0])===t})),u=(null==c?void 0:c.uuid)||Xt(),p=(null==d?void 0:d.uuid)||Xt(),m=(null==h?void 0:h.uuid)||Xt();s.push({uuid:p,name:l,exit_uuid:u}),r.push({uuid:u,destination_uuid:(null==c?void 0:c.destination_uuid)||null}),a.push({uuid:m,type:"has_only_phrase",arguments:[t],category_uuid:p})}));const l=e.find((e=>{const i=t.some((t=>{const i=Nh.find((e=>e.scheme===t));return(null==i?void 0:i.name)===e.name}));return"Other"===e.name&&!i})),d=l?i.find((t=>t.uuid===l.exit_uuid)):null,c=(null==d?void 0:d.uuid)||Xt(),h=(null==l?void 0:l.uuid)||Xt();return s.push({uuid:h,name:"Other",exit_uuid:c}),r.push({uuid:c,destination_uuid:(null==d?void 0:d.destination_uuid)||null}),{router:{type:"switch",cases:a,categories:s,default_category_uuid:h,operand:"@(urn_parts(contact.urn).scheme)",result_name:n},exits:r}})(n,s,r,a,t.result_name||"");return{uuid:e.uuid,actions:e.actions||[],router:l,exits:d}},router:{type:"switch",operand:"@(urn_parts(contact.urn).scheme)"},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},Ku={type:"split_by_subflow",name:"Enter a Flow",group:Gh.trigger,flowTypes:[Hh,Vh,Wh],showAsAction:!0,form:{flow:{type:"select",required:!0,placeholder:"Select a flow...",helpText:"Once the subflow is complete or expires, the contact will return here",endpoint:"/api/v2/flows.json",valueKey:"uuid",nameKey:"name"}},layout:["flow"],render:t=>{var e;const i=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"enter_flow"===t.type));return H`
8515
+ `},toFormData:t=>{var e,i;const o=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"transfer_airtime"===t.type)),n=[];return o&&o.amounts&&Object.entries(o.amounts).forEach((([t,e])=>{var i;n.push({currency:[{value:t,name:(null===(i=wu[t])||void 0===i?void 0:i.name)?`${wu[t].name} (${t})`:t}],amount:String(e)})})),{uuid:t.uuid,amounts:n,result_name:(null===(i=t.router)||void 0===i?void 0:i.result_name)||""}},fromFormData:(t,e)=>{var i,o,n;const s={};t.amounts&&Array.isArray(t.amounts)&&t.amounts.forEach((t=>{var e;if(!(null==t?void 0:t.currency)||!(null==t?void 0:t.amount)||""===t.amount.trim())return;let i;if(Array.isArray(t.currency)&&t.currency.length>0)i=t.currency[0].value;else if("string"==typeof t.currency)i=t.currency;else{if(!(null===(e=t.currency)||void 0===e?void 0:e.value))return;i=t.currency.value}const o=parseFloat(t.amount.trim());!isNaN(o)&&o>0&&(s[i]=o)}));const r=null===(i=e.actions)||void 0===i?void 0:i.find((t=>"transfer_airtime"===t.type)),a={type:"transfer_airtime",uuid:(null==r?void 0:r.uuid)||Xt(),amounts:s},l=(null===(o=e.router)||void 0===o?void 0:o.categories)||[],d=e.exits||[],c=(null===(n=e.router)||void 0===n?void 0:n.cases)||[],{router:h,exits:u}=De("@locals._new_transfer",{type:"has_text",arguments:[]},l,d,c),p={...h};return t.result_name&&""!==t.result_name.trim()&&(p.result_name=t.result_name.trim()),{uuid:e.uuid,actions:[a],router:p,exits:u}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},$u=[{type:"has_any_word",name:"has any of the words",operands:1},{type:"has_all_words",name:"has all of the words",operands:1},{type:"has_phrase",name:"has the phrase",operands:1},{type:"has_only_phrase",name:"has only the phrase",operands:1},{type:"has_beginning",name:"starts with",operands:1},{type:"has_text",name:"has some text",operands:0,categoryName:"Has Text"},{type:"has_number",name:"has a number",operands:0,categoryName:"Has Number"},{type:"has_number_between",name:"has a number between",operands:2},{type:"has_number_lt",name:"has a number below",operands:1},{type:"has_number_lte",name:"has a number at or below",operands:1},{type:"has_number_eq",name:"has a number equal to",operands:1},{type:"has_number_gte",name:"has a number at or above",operands:1},{type:"has_number_gt",name:"has a number above",operands:1},{type:"has_date",name:"has a date",operands:0,categoryName:"Has Date"},{type:"has_date_lt",name:"has a date before",operands:1},{type:"has_date_eq",name:"has a date equal to",operands:1},{type:"has_date_gt",name:"has a date after",operands:1},{type:"has_time",name:"has a time",operands:0,categoryName:"Has Time"},{type:"has_phone",name:"has a phone number",operands:0,categoryName:"Has Phone"},{type:"has_email",name:"has an email",operands:0,categoryName:"Has Email"},{type:"has_state",name:"has state",operands:0,categoryName:"Has State",filter:"HAS_LOCATIONS"},{type:"has_district",name:"has district",operands:1,categoryName:"Has District",filter:"HAS_LOCATIONS"},{type:"has_ward",name:"has ward",operands:2,categoryName:"Has Ward",filter:"HAS_LOCATIONS"},{type:"has_group",name:"is in the group",operands:1,visibility:"hidden"},{type:"has_category",name:"has the category",operands:0,visibility:"hidden"},{type:"has_error",name:"has an error",operands:0,categoryName:"Has Error",visibility:"hidden"},{type:"has_value",name:"is not empty",operands:0,categoryName:"Not Empty",visibility:"hidden"},{type:"has_pattern",name:"matches regex",operands:1}],Tu=()=>$u.filter((t=>"hidden"!==t.visibility&&!t.filter)),Du=new Set(["has_beginning","has_number","has_number_between","has_number_lt","has_number_lte","has_number_eq","has_number_gte","has_number_gt","has_pattern"]),Mu=t=>$u.find((e=>e.type===t)),Iu=t=>t.map((t=>({value:t.type,name:t.name}))),Ou=t=>{if("string"==typeof t)return t.trim();if(Array.isArray(t)&&t.length>0){const e=t[0];if(e&&"object"==typeof e&&e.value)return e.value.trim()}else if(t&&"object"==typeof t&&t.value)return t.value.trim();return""},Lu=t=>{const e=Ou(t.operator);if(!e||!t.category||""===t.category.trim())return!0;const i=Mu(e);return i&&1===i.operands?!t.value1||""===t.value1.trim():!(!i||2!==i.operands)&&(!t.value1||""===t.value1.trim()||!t.value2||""===t.value2.trim())},zu=t=>{const e=Ou(t.operator),i=Mu(e);return!i||i.operands>=1},Pu=t=>{const e=Ou(t.operator),i=Mu(e);return!!i&&2===i.operands},Ru=()=>({operator:{type:"select",required:!0,multi:!1,options:[],flavor:"xsmall",width:"220px"},value1:{type:"text",flavor:"xsmall",conditions:{visible:zu}},value2:{type:"text",flavor:"xsmall",conditions:{visible:Pu}},category:{type:"text",placeholder:"Category",required:!0,maxWidth:"120px",flavor:"xsmall"}}),Nu=t=>(t.rules||[]).filter((t=>{const e=Ou(null==t?void 0:t.operator);if(!e||!(null==t?void 0:t.category)||""===e||""===t.category.trim())return!1;const i=Mu(e);return i&&1===i.operands?(null==t?void 0:t.value1)&&""!==t.value1.trim():!i||2!==i.operands||(null==t?void 0:t.value1)&&""!==t.value1.trim()&&(null==t?void 0:t.value2)&&""!==t.value2.trim()})).map((t=>{const e=Ou(t.operator),i=Mu(e);let o="";if(i&&1===i.operands)o=t.value1?t.value1.trim():"";else if(i&&2===i.operands){o=`${t.value1?t.value1.trim():""} ${t.value2?t.value2.trim():""}`.trim()}else o="";return{operator:e,value:o,category:t.category.trim()}})),Bu=t=>{var e,i;const o=[];return(null===(e=t.router)||void 0===e?void 0:e.cases)&&(null===(i=t.router)||void 0===i?void 0:i.categories)&&t.router.cases.forEach((e=>{const i=t.router.categories.find((t=>t.uuid===e.category_uuid));if(i&&(n=i.name,!["No Response","Other","All Responses","Timeout"].includes(n))){const t=Mu(e.type),n=t?t.name:e.type;let s="",r="";t&&0===t.operands?(s="",r=""):t&&1===t.operands?(s=e.arguments.join(" "),r=""):t&&2===t.operands?(s=e.arguments[0]||"",r=e.arguments[1]||""):(s=e.arguments.join(" "),r=""),o.push({operator:{value:e.type,name:n},value1:s,value2:r,category:i.name})}var n})),o};const Fu=(t,e="Define rules to categorize responses")=>({type:"array",helpText:e,itemLabel:"Rule",minItems:0,maxItems:100,sortable:!0,maintainEmptyItem:!0,isEmptyItem:Lu,onItemChange:(t,e,i,o)=>{const n=[...o],s={...n[t]};s[e]=i;const r=o[t]||{},a=Ou("operator"===e?r.operator:s.operator),l=Ou(s.operator),d=Oe(a,Mu,"value1"===e?r.value1:s.value1,"value2"===e?r.value2:s.value2),c=Oe(l,Mu,s.value1,s.value2);return(!s.category||""===s.category.trim()||s.category===d)&&c&&(s.category=c),n[t]=s,n},itemConfig:{...Ru(),operator:{...Ru().operator,options:t}}}),qu={name:{id:"name",name:"Name",type:"property"},language:{id:"language",name:"Language",type:"property"},status:{id:"status",name:"Status",type:"property"},channel:{id:"channel",name:"Channel",type:"property"}},Uu={type:"split_by_contact_field",name:"Split by Contact Field",group:Kh.split,flowTypes:[Hh,Vh,Wh],dialogSize:"large",form:{field:{type:"select",required:!0,searchable:!0,clearable:!1,endpoint:"/api/v2/fields.json",valueKey:"key",nameKey:"name",placeholder:"Select a field...",options:[...Object.values(qu).map((t=>({value:t.id,name:t.name,type:t.type}))),...Nh.filter((t=>!t.excludeFromSplit)).map((t=>({value:t.scheme,name:t.path,type:"scheme"})))]},rules:Fu(Iu(Tu()),""),result_name:Cu},layout:["field","rules","result_name"],validate:t=>{const e={};return t.field&&0!==t.field.length||(e.field="A field is required"),{valid:0===Object.keys(e).length,errors:e}},toFormData:(t,e)=>{var i,o;const n={...(null===(i=null==e?void 0:e.config)||void 0===i?void 0:i.operand)||qu.name};"field"===n.type?n.key||(n.key=n.id):n.value||(n.value=n.id);const s=Bu(t);return{uuid:t.uuid,field:[n],rules:s,result_name:(null===(o=t.router)||void 0===o?void 0:o.result_name)||""}},fromFormData:(t,e)=>{var i,o,n;const s=null===(i=t.field)||void 0===i?void 0:i[0];if(!s)return e;const r=(t=>{if("scheme"===t.type)return`@(default(urn_parts(urns.${t.id||t.value}).path, ""))`;return"property"===t.type?`@contact.${t.id||t.value}`:`@fields.${t.key||t.id||t.value}`})(s),a=Nu(t),l=(null===(o=e.router)||void 0===o?void 0:o.categories)||[],d=e.exits||[],c=(null===(n=e.router)||void 0===n?void 0:n.cases)||[],{router:h,exits:u}=Le(r,a,Mu,l,d,c),p={...h};return t.result_name&&""!==t.result_name.trim()&&(p.result_name=t.result_name.trim()),{...e,router:p,exits:u}},toUIConfig:t=>{var e;const i=null===(e=t.field)||void 0===e?void 0:e[0];if(!i)return{};let o=i.id||i.value||i.key;"scheme"===i.type&&(o=i.value||i.id);let n=i.type;return"property"!==n&&"scheme"!==n&&(n="field"),{operand:{id:o,name:i.name||i.label,type:n}}},renderTitle:(t,e)=>H`<div>Split by ${e.config.operand.name}</div>`,localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},ju={type:"split_by_expression",name:"Split by Expression",group:Kh.split,flowTypes:[Hh,Vh,Wh],dialogSize:"large",form:{operand:{type:"text",label:"Expression",helpText:"The expression to evaluate and split on",required:!0,evaluated:!0,placeholder:"@fields.age"},rules:Fu(Iu(Tu()),""),result_name:Cu},layout:["operand","rules","result_name"],validate:t=>{const e={};return t.operand&&""!==t.operand.trim()||(e.operand="Expression is required"),{valid:0===Object.keys(e).length,errors:e}},toFormData:t=>{var e,i;const o=Bu(t);return{uuid:t.uuid,operand:(null===(e=t.router)||void 0===e?void 0:e.operand)||"@input.text",rules:o,result_name:(null===(i=t.router)||void 0===i?void 0:i.result_name)||""}},fromFormData:(t,e)=>{var i,o,n;const s=Nu(t),r=(null===(i=t.operand)||void 0===i?void 0:i.trim())||"@input.text",a=(null===(o=e.router)||void 0===o?void 0:o.categories)||[],l=e.exits||[],d=(null===(n=e.router)||void 0===n?void 0:n.cases)||[],{router:c,exits:h}=Le(r,s,Mu,a,l,d),u={...c};return t.result_name&&""!==t.result_name.trim()&&(u.result_name=t.result_name.trim()),{...e,router:u,exits:h}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},Vu={type:"split_by_groups",name:"Split by Group",group:Kh.split,flowTypes:[Hh,Vh,Wh],form:{groups:{type:"select",label:"Groups",helpText:"Select the groups to split contacts by. Contacts will be routed based on their group membership.",required:!0,options:[],multi:!0,searchable:!0,endpoint:"/api/v2/groups.json",valueKey:"uuid",nameKey:"name",placeholder:"Search for groups...",allowCreate:!0,createArbitraryOption:(t,e)=>!e.find((e=>e.name.toLowerCase().trim()===t.toLowerCase().trim()))&&t.trim()?{name:t.trim(),arbitrary:!0}:null},result_name:Cu},layout:["groups","result_name"],validate:t=>{const e={};return t.groups&&Array.isArray(t.groups)&&0!==t.groups.length||(e.groups="At least one group is required"),{valid:0===Object.keys(e).length,errors:e}},toFormData:t=>{var e,i;const o=[];return(null===(e=t.router)||void 0===e?void 0:e.cases)&&t.router.cases.forEach((t=>{var e;"has_group"===t.type&&(null===(e=t.arguments)||void 0===e?void 0:e.length)>=2&&o.push({uuid:t.arguments[0],name:t.arguments[1]})})),{uuid:t.uuid,groups:o,result_name:(null===(i=t.router)||void 0===i?void 0:i.result_name)||""}},fromFormData:(t,e)=>{var i,o;const n=(t.groups||[]).filter((t=>(null==t?void 0:t.uuid)||(null==t?void 0:t.arbitrary))).map((t=>({uuid:t.uuid||Xt(),name:t.name}))),s=(null===(i=e.router)||void 0===i?void 0:i.categories)||[],r=e.exits||[],a=(null===(o=e.router)||void 0===o?void 0:o.cases)||[],{router:l,exits:d}=((t,e=[],i=[],o=[],n="")=>{const s=[],r=[],a=[];t.forEach((t=>{const n=e.find((e=>e.name===t.name)),l=n?i.find((t=>t.uuid===n.exit_uuid)):null,d=o.find((e=>{var i;return(null===(i=e.arguments)||void 0===i?void 0:i[0])===t.uuid})),c=(null==l?void 0:l.uuid)||Xt(),h=(null==n?void 0:n.uuid)||Xt(),u=(null==d?void 0:d.uuid)||Xt();s.push({uuid:h,name:t.name,exit_uuid:c}),r.push({uuid:c,destination_uuid:(null==l?void 0:l.destination_uuid)||null}),a.push({uuid:u,type:"has_group",arguments:[t.uuid,t.name],category_uuid:h})}));const l=e.find((e=>"Other"===e.name&&!t.some((t=>t.name===e.name)))),d=l?i.find((t=>t.uuid===l.exit_uuid)):null,c=(null==d?void 0:d.uuid)||Xt(),h=(null==l?void 0:l.uuid)||Xt();return s.push({uuid:h,name:"Other",exit_uuid:c}),r.push({uuid:c,destination_uuid:(null==d?void 0:d.destination_uuid)||null}),{router:{type:"switch",cases:a,categories:s,default_category_uuid:h,operand:"@contact.groups",result_name:n},exits:r}})(n,s,r,a,t.result_name||"");return{uuid:e.uuid,actions:e.actions||[],router:l,exits:d}},router:{type:"switch",operand:"@contact.groups"},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},Hu={type:"split_by_random",name:"Random Split",group:Kh.split,flowTypes:[Hh,Vh,Wh],form:{categories:{type:"array",helpText:"Define the buckets to randomly split contacts into",required:!0,itemLabel:"Bucket",sortable:!0,minItems:2,maxItems:10,isEmptyItem:t=>!t.name||""===t.name.trim(),itemConfig:{name:{type:"text",placeholder:"Bucket name",required:!0}}}},layout:["categories"],validate:t=>{const e={};if(t.categories&&Array.isArray(t.categories)){const i=t.categories.filter((t=>(null==t?void 0:t.name)&&""!==t.name.trim()));i.length<2&&(e.categories="At least 2 buckets are required for random split");const o=[],n=new Map;if(i.forEach((t=>{const e=t.name.trim().toLowerCase();n.has(e)||n.set(e,[]),n.get(e).push(t.name.trim())})),n.forEach((t=>{t.length>1&&o.push(...t)})),o.length>0){const t=[...new Set(o)];e.categories=`Duplicate bucket names found: ${t.join(", ")}`}}return{valid:0===Object.keys(e).length,errors:e}},toFormData:t=>{var e,i;const o=(null===(i=null===(e=t.router)||void 0===e?void 0:e.categories)||void 0===i?void 0:i.map((t=>({name:t.name}))))||[];return{uuid:t.uuid,categories:o}},fromFormData:(t,e)=>{var i;const o=(t.categories||[]).filter((t=>{var e;return null===(e=null==t?void 0:t.name)||void 0===e?void 0:e.trim()})).map((t=>t.name.trim())),n=(null===(i=e.router)||void 0===i?void 0:i.categories)||[],s=e.exits||[],{router:r,exits:a}=((t,e=[],i=[])=>{const o=[],n=[];return t.forEach((t=>{const s=e.find((e=>e.name===t)),r=s?i.find((t=>t.uuid===s.exit_uuid)):null,a=(null==r?void 0:r.uuid)||Xt(),l=(null==s?void 0:s.uuid)||Xt();o.push({uuid:l,name:t,exit_uuid:a}),n.push({uuid:a,destination_uuid:(null==r?void 0:r.destination_uuid)||null})})),{router:{type:"random",categories:o},exits:n}})(o,n,s);return{uuid:e.uuid,actions:e.actions||[],router:r,exits:a}},router:{type:"random"},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},Wu=[{value:"0",name:"first result"},{value:"1",name:"second result"},{value:"2",name:"third result"},{value:"3",name:"fourth result"},{value:"4",name:"fifth result"},{value:"5",name:"sixth result"},{value:"6",name:"seventh result"},{value:"7",name:"eighth result"},{value:"8",name:"ninth result"},{value:"9",name:"tenth result"},{value:"10",name:"11th result"},{value:"11",name:"12th result"},{value:"12",name:"13th result"},{value:"13",name:"14th result"},{value:"14",name:"15th result"},{value:"15",name:"16th result"},{value:"16",name:"17th result"},{value:"17",name:"18th result"},{value:"18",name:"19th result"},{value:"19",name:"20th result"}],Zu=[{value:"",name:"Don't delimit result"},{value:" ",name:"Delimited by spaces"},{value:".",name:"Delimited by periods"},{value:"+",name:"Delimited by plusses"}],Yu={type:"split_by_run_result",name:"Split by Result",aliases:["split_by_run_result_delimited"],group:Kh.split,flowTypes:[Hh,Vh,Wh],dialogSize:"large",form:{result:{type:"select",required:!0,searchable:!1,clearable:!1,placeholder:"Select a result...",getDynamicOptions:()=>{const t=Sd();return t?t.getState().getFlowResults().map((t=>({value:t.key,name:t.name}))):[]},valueKey:"value",nameKey:"name"},delimit_by:{type:"select",required:!1,searchable:!1,clearable:!1,options:Zu,valueKey:"value",nameKey:"name",maxWidth:"180px"},delimit_index:{type:"select",required:!1,searchable:!1,clearable:!1,options:Wu,valueKey:"value",nameKey:"name",maxWidth:"140px",conditions:{visible:t=>{var e,i;const o=null===(i=null===(e=t.delimit_by)||void 0===e?void 0:e[0])||void 0===i?void 0:i.value;return void 0!==o&&""!==o}}},rules:Fu(Iu(Tu()),""),result_name:Cu},layout:[{type:"row",label:"Flow Result",helpText:"Select a flow result and optionally delimit it to split on a specific part",items:["result","delimit_by","delimit_index"]},"rules","result_name"],validate:t=>{const e={};return t.result&&0!==t.result.length||(e.result="A flow result is required"),{valid:0===Object.keys(e).length,errors:e}},toFormData:(t,e)=>{var i,o,n;const s=null===(i=null==e?void 0:e.config)||void 0===i?void 0:i.operand,r=s?{...s,value:s.value||s.id}:null,a=Bu(t),l=((null===(o=t.router)||void 0===o?void 0:o.operand)||"").match(/field\(results\.[\w]+,\s*(\d+),\s*"(.+?)"\)/),d=null!==l,c=d?parseInt(l[1],10):0,h=d?l[2]:"";return{uuid:t.uuid,result:r?[r]:[],delimit_by:d?[Zu.find((t=>t.value===h))]:[Zu[0]],delimit_index:d?[Wu.find((t=>t.value===String(c)))]:[Wu[0]],rules:a,result_name:(null===(n=t.router)||void 0===n?void 0:n.result_name)||""}},fromFormData:(t,e)=>{var i,o,n,s,r,a,l,d;const c=null===(i=t.result)||void 0===i?void 0:i[0];if(!c)return e;let h;const u=c.value||c.id,p=null===(n=null===(o=t.delimit_by)||void 0===o?void 0:o[0])||void 0===n?void 0:n.value;if(void 0!==p&&""!==p){h=`@(field(results.${u}, ${null!==(a=null===(r=null===(s=t.delimit_index)||void 0===s?void 0:s[0])||void 0===r?void 0:r.value)&&void 0!==a?a:"0"}, "${p}"))`}else h=`@results.${u}`;const m=Nu(t),g=(null===(l=e.router)||void 0===l?void 0:l.categories)||[],f=e.exits||[],v=(null===(d=e.router)||void 0===d?void 0:d.cases)||[],{router:y,exits:b}=Le(h,m,Mu,g,f,v),x={...y};return t.result_name&&""!==t.result_name.trim()&&(x.result_name=t.result_name.trim()),{...e,router:x,exits:b}},toUIConfig:t=>{var e,i,o,n,s,r;const a=null===(e=t.result)||void 0===e?void 0:e[0];if(!a)return{};const l={operand:{id:a.value,name:a.name,type:"result"}},d=null===(o=null===(i=t.delimit_by)||void 0===i?void 0:i[0])||void 0===o?void 0:o.value,c=void 0!==d&&""!==d;return c&&(l.index=parseInt(null!==(r=null===(s=null===(n=t.delimit_index)||void 0===n?void 0:n[0])||void 0===s?void 0:s.value)&&void 0!==r?r:"0",10),l.delimiter=d),l.type=c?"split_by_run_result_delimited":"split_by_run_result",l},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},Gu={type:"split_by_scheme",name:"Split by URN Type",group:Kh.split,flowTypes:[Hh,Vh,Wh],form:{schemes:{type:"select",label:"Channel Types",helpText:"The contact's URN is the address they used to reach you such as their phone number or a Facebook ID. Select which URN types to split by.",required:!0,options:Nh.map((t=>({value:t.scheme,name:t.name}))),multi:!0,searchable:!0,placeholder:"Select the channels to split by..."},result_name:Cu},layout:["schemes","result_name"],validate:t=>{const e={};return t.schemes&&Array.isArray(t.schemes)&&0!==t.schemes.length||(e.schemes="At least one channel type is required"),{valid:0===Object.keys(e).length,errors:e}},toFormData:t=>{var e,i;const o=[];return(null===(e=t.router)||void 0===e?void 0:e.cases)&&t.router.cases.forEach((t=>{var e;"has_only_phrase"===t.type&&(null===(e=t.arguments)||void 0===e?void 0:e.length)>0&&o.push(t.arguments[0])})),{uuid:t.uuid,schemes:o.map((t=>{const e=Nh.find((e=>e.scheme===t));return{value:t,name:(null==e?void 0:e.name)||t}})),result_name:(null===(i=t.router)||void 0===i?void 0:i.result_name)||""}},fromFormData:(t,e)=>{var i,o;const n=(t.schemes||[]).filter((t=>t)).map((t=>"string"==typeof t?t:t.value)),s=(null===(i=e.router)||void 0===i?void 0:i.categories)||[],r=e.exits||[],a=(null===(o=e.router)||void 0===o?void 0:o.cases)||[],{router:l,exits:d}=((t,e=[],i=[],o=[],n="")=>{const s=[],r=[],a=[];t.forEach((t=>{const n=Nh.find((e=>e.scheme===t)),l=(null==n?void 0:n.name)||t,d=e.find((t=>t.name===l)),c=d?i.find((t=>t.uuid===d.exit_uuid)):null,h=o.find((e=>{var i;return(null===(i=e.arguments)||void 0===i?void 0:i[0])===t})),u=(null==c?void 0:c.uuid)||Xt(),p=(null==d?void 0:d.uuid)||Xt(),m=(null==h?void 0:h.uuid)||Xt();s.push({uuid:p,name:l,exit_uuid:u}),r.push({uuid:u,destination_uuid:(null==c?void 0:c.destination_uuid)||null}),a.push({uuid:m,type:"has_only_phrase",arguments:[t],category_uuid:p})}));const l=e.find((e=>{const i=t.some((t=>{const i=Nh.find((e=>e.scheme===t));return(null==i?void 0:i.name)===e.name}));return"Other"===e.name&&!i})),d=l?i.find((t=>t.uuid===l.exit_uuid)):null,c=(null==d?void 0:d.uuid)||Xt(),h=(null==l?void 0:l.uuid)||Xt();return s.push({uuid:h,name:"Other",exit_uuid:c}),r.push({uuid:c,destination_uuid:(null==d?void 0:d.destination_uuid)||null}),{router:{type:"switch",cases:a,categories:s,default_category_uuid:h,operand:"@(urn_parts(contact.urn).scheme)",result_name:n},exits:r}})(n,s,r,a,t.result_name||"");return{uuid:e.uuid,actions:e.actions||[],router:l,exits:d}},router:{type:"switch",operand:"@(urn_parts(contact.urn).scheme)"},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},Ku={type:"split_by_subflow",name:"Enter a Flow",group:Gh.trigger,flowTypes:[Hh,Vh,Wh],showAsAction:!0,form:{flow:{type:"select",required:!0,placeholder:"Select a flow...",helpText:"Once the subflow is complete or expires, the contact will return here",endpoint:"/api/v2/flows.json",valueKey:"uuid",nameKey:"name"}},layout:["flow"],render:t=>{var e;const i=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"enter_flow"===t.type));return H`
8515
8516
  <div class="body">
8516
8517
  ${Ph([null==i?void 0:i.flow],"flow")}
8517
8518
  </div>
8518
- `},toFormData:t=>{var e;const i=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"enter_flow"===t.type));return{uuid:t.uuid,flow:(null==i?void 0:i.flow)?[{uuid:i.flow.uuid,name:i.flow.name}]:[]}},fromFormData:(t,e)=>{var i,o,n;const s=Array.isArray(t.flow)&&t.flow.length>0?t.flow[0]:null,r=null===(i=e.actions)||void 0===i?void 0:i.find((t=>"enter_flow"===t.type)),a={type:"enter_flow",uuid:(null==r?void 0:r.uuid)||Xt(),flow:s?{uuid:s.uuid||s.value,name:s.name}:{uuid:"",name:""}},l=(null===(o=e.router)||void 0===o?void 0:o.categories)||[],d=e.exits||[],c=(null===(n=e.router)||void 0===n?void 0:n.cases)||[],h=l.find((t=>"Complete"===t.name)),u=h?d.find((t=>t.uuid===h.exit_uuid)):null,p=h?c.find((t=>t.category_uuid===h.uuid)):null,m=(null==h?void 0:h.uuid)||Xt(),g=(null==u?void 0:u.uuid)||Xt(),f=(null==p?void 0:p.uuid)||Xt(),v=l.find((t=>"Expired"===t.name)),b=v?d.find((t=>t.uuid===v.exit_uuid)):null,y=(null==v?void 0:v.uuid)||Xt(),x=(null==b?void 0:b.uuid)||Xt(),_=[{uuid:m,name:"Complete",exit_uuid:g},{uuid:y,name:"Expired",exit_uuid:x}],w=[{uuid:g,destination_uuid:(null==u?void 0:u.destination_uuid)||null},{uuid:x,destination_uuid:(null==b?void 0:b.destination_uuid)||null}],k={type:"switch",categories:_,default_category_uuid:y,operand:"@child.status",cases:[{uuid:f,type:"has_only_text",arguments:["completed"],category_uuid:m}]};return{uuid:e.uuid,actions:[a],router:k,exits:w}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},Xu={type:"split_by_ticket",name:"Open Ticket",group:Gh.trigger,flowTypes:[Hh,Vh,Wh],showAsAction:!0,form:{topic:{type:"select",label:"Topic",required:!0,placeholder:"Select a topic",options:[],endpoint:"/api/v2/topics.json",valueKey:"uuid",nameKey:"name",maxWidth:"200px"},assignee:{type:"select",label:"Assignee",required:!1,placeholder:"Select an agent (optional)",endpoint:"/api/v2/users.json",valueKey:"uuid",getName:t=>t.name||[t.first_name,t.last_name].join(" "),clearable:!0},note:{type:"textarea",label:"Note",required:!1,placeholder:"Enter a note for the ticket (optional)",minHeight:100}},layout:[{type:"row",items:["topic","assignee"]},"note"],render:t=>{var e,i;const o=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"open_ticket"===t.type));return H`
8519
+ `},toFormData:t=>{var e;const i=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"enter_flow"===t.type));return{uuid:t.uuid,flow:(null==i?void 0:i.flow)?[{uuid:i.flow.uuid,name:i.flow.name}]:[]}},fromFormData:(t,e)=>{var i,o,n;const s=Array.isArray(t.flow)&&t.flow.length>0?t.flow[0]:null,r=null===(i=e.actions)||void 0===i?void 0:i.find((t=>"enter_flow"===t.type)),a={type:"enter_flow",uuid:(null==r?void 0:r.uuid)||Xt(),flow:s?{uuid:s.uuid||s.value,name:s.name}:{uuid:"",name:""}},l=(null===(o=e.router)||void 0===o?void 0:o.categories)||[],d=e.exits||[],c=(null===(n=e.router)||void 0===n?void 0:n.cases)||[],h=l.find((t=>"Complete"===t.name)),u=h?d.find((t=>t.uuid===h.exit_uuid)):null,p=h?c.find((t=>t.category_uuid===h.uuid)):null,m=(null==h?void 0:h.uuid)||Xt(),g=(null==u?void 0:u.uuid)||Xt(),f=(null==p?void 0:p.uuid)||Xt(),v=l.find((t=>"Expired"===t.name)),y=v?d.find((t=>t.uuid===v.exit_uuid)):null,b=(null==v?void 0:v.uuid)||Xt(),x=(null==y?void 0:y.uuid)||Xt(),_=[{uuid:m,name:"Complete",exit_uuid:g},{uuid:b,name:"Expired",exit_uuid:x}],w=[{uuid:g,destination_uuid:(null==u?void 0:u.destination_uuid)||null},{uuid:x,destination_uuid:(null==y?void 0:y.destination_uuid)||null}],k={type:"switch",categories:_,default_category_uuid:b,operand:"@child.status",cases:[{uuid:f,type:"has_only_text",arguments:["completed"],category_uuid:m}]};return{uuid:e.uuid,actions:[a],router:k,exits:w}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},Xu={type:"split_by_ticket",name:"Open Ticket",group:Gh.trigger,flowTypes:[Hh,Vh,Wh],showAsAction:!0,form:{topic:{type:"select",label:"Topic",required:!0,placeholder:"Select a topic",options:[],endpoint:"/api/v2/topics.json",valueKey:"uuid",nameKey:"name",maxWidth:"200px"},assignee:{type:"select",label:"Assignee",required:!1,placeholder:"Select an agent (optional)",endpoint:"/api/v2/users.json",valueKey:"uuid",getName:t=>t.name||[t.first_name,t.last_name].join(" "),clearable:!0},note:{type:"textarea",label:"Note",required:!1,placeholder:"Enter a note for the ticket (optional)",minHeight:100}},layout:[{type:"row",items:["topic","assignee"]},"note"],render:t=>{var e,i;const o=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"open_ticket"===t.type));return H`
8519
8520
  <div class="body">
8520
8521
  ${(null===(i=null==o?void 0:o.topic)||void 0===i?void 0:i.name)||"Configure ticket"}
8521
8522
  </div>
@@ -8540,9 +8541,9 @@ background: #ccc;
8540
8541
  >
8541
8542
  ${(null==i?void 0:i.instructions)||"Configure AI instructions"}
8542
8543
  </div>
8543
- `},form:{llm:{type:"select",label:"LLM",required:!0,options:[],endpoint:"/test-assets/select/llms.json",searchable:!0,valueKey:"uuid",nameKey:"name",placeholder:"Select an LLM..."},input:{type:"text",label:"Input",helpText:"The input the AI will process",required:!0,evaluated:!0,placeholder:"@input"},instructions:{type:"textarea",label:"Instructions",helpText:"Tell the AI what to do with the input. The result can be referenced as **`@locals._llm_output`**",required:!0,evaluated:!0,placeholder:"Enter instructions for the AI model...",minHeight:130}},layout:["llm","input","instructions"],toFormData:t=>{var e;const i=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"call_llm"===t.type));return{uuid:t.uuid,llm:(null==i?void 0:i.llm)?[{value:i.llm.uuid,name:i.llm.name}]:[],input:(null==i?void 0:i.input)||"@input",instructions:(null==i?void 0:i.instructions)||""}},fromFormData:(t,e)=>{var i,o,n;const s=Array.isArray(t.llm)&&t.llm.length>0?t.llm[0]:null,r=null===(i=e.actions)||void 0===i?void 0:i.find((t=>"call_llm"===t.type)),a={type:"call_llm",uuid:(null==r?void 0:r.uuid)||Xt(),llm:s?{uuid:s.value,name:s.name}:{uuid:"",name:""},input:t.input||"@input",instructions:t.instructions||"",output_local:"_llm_output"},l=(null===(o=e.router)||void 0===o?void 0:o.categories)||[],d=e.exits||[],c=(null===(n=e.router)||void 0===n?void 0:n.cases)||[],{router:h,exits:u}=De("@locals._llm_output",{type:"has_text",arguments:[]},l,d,c);return{uuid:e.uuid,actions:[a],router:h,exits:u}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},ip={type:"split_by_llm_categorize",name:"Split by AI",group:Gh.services,flowTypes:[],features:[Zh],form:{llm:{type:"select",label:"LLM",helpText:"Select the LLM to use for categorization",required:!0,endpoint:"/test-assets/select/llms.json",valueKey:"uuid",nameKey:"name",placeholder:"Select an LLM..."},input:{type:"text",label:"Input",helpText:"The input to categorize (usually @input)",required:!0,evaluated:!0,placeholder:"@input"},categories:{type:"array",label:"Categories",helpText:"Define the categories for classification",required:!0,sortable:!0,itemLabel:"Category",minItems:1,maxItems:10,isEmptyItem:t=>!t.name||""===t.name.trim(),itemConfig:{name:{type:"text",placeholder:"Category name",required:!0}}}},layout:["llm","input","categories"],validate:t=>{const e={};if(t.categories&&Array.isArray(t.categories)){const i=t.categories.filter((t=>(null==t?void 0:t.name)&&""!==t.name.trim())),o=[],n=new Map;if(i.forEach((t=>{const e=t.name.trim().toLowerCase();n.has(e)||n.set(e,[]),n.get(e).push(t.name.trim())})),n.forEach((t=>{t.length>1&&o.push(...t)})),o.length>0){const t=[...new Set(o)];e.categories=`Duplicate category names found: ${t.join(", ")}`}}return{valid:0===Object.keys(e).length,errors:e}},render:t=>{var e;const i=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"call_llm"===t.type));return H`
8544
+ `},form:{llm:{type:"select",label:"LLM",required:!0,options:[],endpoint:"/test-assets/select/llms.json",searchable:!0,valueKey:"uuid",nameKey:"name",placeholder:"Select an LLM..."},input:{type:"text",label:"Input",helpText:"The input the AI will process",required:!0,evaluated:!0,placeholder:"@input"},instructions:{type:"textarea",label:"Instructions",helpText:"Tell the AI what to do with the input. The result can be referenced as **`@locals._llm_output`**",required:!0,evaluated:!0,placeholder:"Enter instructions for the AI model...",minHeight:130}},layout:["llm","input","instructions"],toFormData:t=>{var e;const i=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"call_llm"===t.type));return{uuid:t.uuid,llm:(null==i?void 0:i.llm)?[{value:i.llm.uuid,name:i.llm.name}]:[],input:(null==i?void 0:i.input)||"@input",instructions:(null==i?void 0:i.instructions)||""}},fromFormData:(t,e)=>{var i,o,n;const s=Array.isArray(t.llm)&&t.llm.length>0?t.llm[0]:null,r=null===(i=e.actions)||void 0===i?void 0:i.find((t=>"call_llm"===t.type)),a={type:"call_llm",uuid:(null==r?void 0:r.uuid)||Xt(),llm:s?{uuid:s.value,name:s.name}:{uuid:"",name:""},input:t.input||"@input",instructions:t.instructions||"",output_local:"_llm_output"},l=(null===(o=e.router)||void 0===o?void 0:o.categories)||[],d=e.exits||[],c=(null===(n=e.router)||void 0===n?void 0:n.cases)||[],{router:h,exits:u}=De("@locals._llm_output",{type:"has_text",arguments:[]},l,d,c);return{uuid:e.uuid,actions:[a],router:h,exits:u}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},ip={type:"split_by_llm_categorize",name:"Split by AI",group:Gh.services,flowTypes:[],features:[Zh],form:{llm:{type:"select",label:"LLM",helpText:"Select the LLM to use for categorization",required:!0,endpoint:"/test-assets/select/llms.json",valueKey:"uuid",nameKey:"name",placeholder:"Select an LLM..."},input:{type:"text",label:"Input",helpText:"The input to categorize (usually @input)",required:!0,evaluated:!0,placeholder:"@input"},categories:{type:"array",helpText:"Define the categories for classification",required:!0,sortable:!0,itemLabel:"Category",minItems:1,maxItems:10,isEmptyItem:t=>!t.name||""===t.name.trim(),itemConfig:{name:{type:"text",placeholder:"Category name",required:!0}}}},layout:["llm","input","categories"],validate:t=>{const e={};if(t.categories&&Array.isArray(t.categories)){const i=t.categories.filter((t=>(null==t?void 0:t.name)&&""!==t.name.trim())),o=[],n=new Map;if(i.forEach((t=>{const e=t.name.trim().toLowerCase();n.has(e)||n.set(e,[]),n.get(e).push(t.name.trim())})),n.forEach((t=>{t.length>1&&o.push(...t)})),o.length>0){const t=[...new Set(o)];e.categories=`Duplicate category names found: ${t.join(", ")}`}}return{valid:0===Object.keys(e).length,errors:e}},render:t=>{var e;const i=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"call_llm"===t.type));return H`
8544
8545
  <div class="body">Categorize with ${i.llm.name}</div>
8545
- `},toFormData:t=>{var e,i,o;const n=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"call_llm"===t.type)),s=(null===(o=null===(i=t.router)||void 0===i?void 0:i.categories)||void 0===o?void 0:o.filter((t=>"Other"!==t.name&&"Failure"!==t.name)).map((t=>({name:t.name}))))||[];return{uuid:t.uuid,llm:(null==n?void 0:n.llm)?[{value:n.llm.uuid,name:n.llm.name}]:[],input:(null==n?void 0:n.input)||"@input",categories:s}},fromFormData:(t,e)=>{var i,o,n;const s=Array.isArray(t.llm)&&t.llm.length>0?t.llm[0]:null,r=(t.categories||[]).filter((t=>{var e;return null===(e=null==t?void 0:t.name)||void 0===e?void 0:e.trim()})).map((t=>t.name.trim())),a=null===(i=e.actions)||void 0===i?void 0:i.find((t=>"call_llm"===t.type)),l={type:"call_llm",uuid:(null==a?void 0:a.uuid)||Xt(),llm:s?{uuid:s.value,name:s.name}:{uuid:"",name:""},instructions:'@(prompt("categorize", slice(node.categories, 0, -2)))',input:t.input||"@input",output_local:"_llm_output"},d=(null===(o=e.router)||void 0===o?void 0:o.categories)||[],c=e.exits||[],h=(null===(n=e.router)||void 0===n?void 0:n.cases)||[],{router:u,exits:p}=((t,e,i,o=[],n=[],s=[])=>{const r=[],a=[],l=[];e.forEach((t=>{const e=Te({name:t,existingCategories:o,existingExits:n,existingCases:s,caseConfig:i(t)});r.push(e.category),a.push(e.exit),e.case&&l.push(e.case)}));const d=Te({name:"Other",existingCategories:o,existingExits:n});r.push(d.category),a.push(d.exit);const c=Te({name:"Failure",existingCategories:o,existingExits:n,existingCases:s,caseConfig:{type:"has_only_text",arguments:["<ERROR>"]}});return r.push(c.category),a.push(c.exit),c.case&&l.push(c.case),{router:{type:"switch",categories:r,default_category_uuid:d.category.uuid,operand:t,cases:l},exits:a}})("@locals._llm_output",r,(t=>({type:"has_only_text",arguments:[t]})),d,c,h);return{uuid:e.uuid,actions:[l],router:u,exits:p}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},op={type:"wait_for_audio",name:"Make Recording",group:Kh.wait,flowTypes:[Hh],form:{result_name:{type:"text",label:"Result Name",required:!1,placeholder:"(optional)",helpText:"The name to use to reference this result in the flow"}},layout:["result_name"],toFormData:t=>{var e;return{uuid:t.uuid,result_name:(null===(e=t.router)||void 0===e?void 0:e.result_name)||""}},fromFormData:(t,e)=>{var i;const o=(null===(i=e.router)||void 0===i?void 0:i.categories)||[],n=e.exits||[];let s,r=o.find((t=>"All Responses"===t.name));if(r)s=n.find((t=>t.uuid===r.exit_uuid))||{uuid:r.exit_uuid,destination_uuid:null};else{const t=Xt();r={uuid:Xt(),name:"All Responses",exit_uuid:t},s={uuid:t,destination_uuid:null}}const a={type:"switch",operand:"@input",default_category_uuid:r.uuid,cases:[],categories:[r],wait:{type:"msg",hint:{type:"audio"}}};return t.result_name&&""!==t.result_name.trim()&&(a.result_name=t.result_name.trim()),{...e,router:a,exits:[s]}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},np=["Answered","No Answer","Busy","Failed"],sp=[{type:"has_only_text",arguments:["answered"],categoryName:"Answered"},{type:"has_only_text",arguments:["no_answer"],categoryName:"No Answer"},{type:"has_only_text",arguments:["busy"],categoryName:"Busy"}],rp={type:"wait_for_dial",name:"Redirect Call",group:Kh.wait,flowTypes:[Hh],router:{type:"switch",defaultCategory:"Failed",rules:sp.map((t=>({type:t.type,arguments:t.arguments,categoryName:t.categoryName})))},form:{phone:{type:"text",label:"Phone Number",required:!0,evaluated:!0,placeholder:"Phone number or expression"},dial_limit_seconds:{type:"text",label:"Dial Limit (seconds)",required:!1,placeholder:"60"},call_limit_seconds:{type:"text",label:"Call Limit (seconds)",required:!1,placeholder:"7200"},result_name:Cu},layout:["phone",{type:"row",items:["dial_limit_seconds","call_limit_seconds"]},"result_name"],toFormData:t=>{var e,i;const o=null===(e=t.router)||void 0===e?void 0:e.wait;return{uuid:t.uuid,phone:(null==o?void 0:o.phone)||"",dial_limit_seconds:(null==o?void 0:o.dial_limit_seconds)?String(o.dial_limit_seconds):"",call_limit_seconds:(null==o?void 0:o.call_limit_seconds)?String(o.call_limit_seconds):"",result_name:(null===(i=t.router)||void 0===i?void 0:i.result_name)||""}},fromFormData:(t,e)=>{var i,o;const n=(null===(i=e.router)||void 0===i?void 0:i.categories)||[],s=e.exits||[],r=(null===(o=e.router)||void 0===o?void 0:o.cases)||[],a=[],l=[],d=[];for(const t of np){const e=n.find((e=>e.name===t));if(e){a.push(e);const t=s.find((t=>t.uuid===e.exit_uuid));l.push(t||{uuid:e.exit_uuid,destination_uuid:null})}else{const e=Xt();a.push({uuid:Xt(),name:t,exit_uuid:e}),l.push({uuid:e,destination_uuid:null})}}for(const t of sp){const e=a.find((e=>e.name===t.categoryName));if(!e)continue;const i=r.find((e=>{var i;return e.type===t.type&&(null===(i=e.arguments)||void 0===i?void 0:i[0])===t.arguments[0]}));d.push({uuid:(null==i?void 0:i.uuid)||Xt(),type:t.type,arguments:t.arguments,category_uuid:e.uuid})}const c=a.find((t=>"Failed"===t.name)),h=(t.phone||"").trim(),u=parseInt(t.dial_limit_seconds,10),p=parseInt(t.call_limit_seconds,10),m={type:"dial",phone:h};!isNaN(u)&&u>0&&(m.dial_limit_seconds=u),!isNaN(p)&&p>0&&(m.call_limit_seconds=p);const g={type:"switch",operand:'@(default(resume.dial.status, ""))',default_category_uuid:null==c?void 0:c.uuid,cases:d,categories:a,wait:m};return t.result_name&&""!==t.result_name.trim()&&(g.result_name=t.result_name.trim()),{...e,router:g,exits:l}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},ap={type:"wait_for_digits",name:"Wait for Digits",group:Kh.wait,flowTypes:[Hh],dialogSize:"large",form:{rules:Fu(Iu($u.filter((t=>Du.has(t.type))))),result_name:Cu},layout:[{type:"text",text:"Rules match against all digits pressed by the caller followed by the # sign."},"rules","result_name"],validate:t=>({valid:!0,errors:{}}),toFormData:t=>{var e;const i=Bu(t);return{uuid:t.uuid,rules:i,result_name:(null===(e=t.router)||void 0===e?void 0:e.result_name)||""}},fromFormData:(t,e)=>{var i,o;const n=Nu(t),s=(null===(i=e.router)||void 0===i?void 0:i.categories)||[],r=e.exits||[],a=(null===(o=e.router)||void 0===o?void 0:o.cases)||[],{router:l,exits:d}=Le("@input.text",n,Mu,s,r,a),c={...l,wait:{type:"msg",hint:{type:"digits"}}};return t.result_name&&""!==t.result_name.trim()&&(c.result_name=t.result_name.trim()),{...e,router:c,exits:d}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},lp=["1","2","3","4","5","6","7","8","9","0"];function dp(t){return`digit_${t}`}const cp={type:"wait_for_menu",name:"Wait for Menu",group:Kh.wait,flowTypes:[Hh],form:{...Object.fromEntries(lp.map((t=>[dp(t),{type:"text",required:!1,placeholder:"",flavor:"xsmall"}]))),result_name:Cu},layout:[{type:"row",items:["digit_1","digit_2","digit_3"],gap:"2rem",marginBottom:"0.5rem",inlineLabels:{digit_1:"1",digit_2:"2",digit_3:"3"}},{type:"row",items:["digit_4","digit_5","digit_6"],gap:"2rem",marginBottom:"0.5rem",inlineLabels:{digit_4:"4",digit_5:"5",digit_6:"6"}},{type:"row",items:["digit_7","digit_8","digit_9"],gap:"2rem",marginBottom:"0.5rem",inlineLabels:{digit_7:"7",digit_8:"8",digit_9:"9"}},{type:"row",items:[{type:"spacer"},"digit_0",{type:"spacer"}],gap:"2rem",inlineLabels:{digit_0:"0"}},"result_name"],toFormData:t=>{var e,i,o,n;const s={uuid:t.uuid,result_name:(null===(e=t.router)||void 0===e?void 0:e.result_name)||""};for(const t of lp)s[dp(t)]="";if((null===(i=t.router)||void 0===i?void 0:i.cases)&&(null===(o=t.router)||void 0===o?void 0:o.categories))for(const e of t.router.cases)if("has_number_eq"===e.type&&(null===(n=e.arguments)||void 0===n?void 0:n[0])){const i=e.arguments[0],o=t.router.categories.find((t=>t.uuid===e.category_uuid));o&&lp.includes(i)&&(s[dp(i)]=o.name)}return s},fromFormData:(t,e)=>{var i,o;const n=(null===(i=e.router)||void 0===i?void 0:i.categories)||[],s=e.exits||[],r=(null===(o=e.router)||void 0===o?void 0:o.cases)||[],a=[],l=[],d=[];for(const e of lp){const i=(t[dp(e)]||"").trim();if(!i)continue;let o=a.find((t=>t.name===i));if(!o){const t=n.find((t=>t.name===i));if(t){o=t;const e=s.find((e=>e.uuid===t.exit_uuid));a.push(o),l.push(e||{uuid:t.exit_uuid,destination_uuid:null})}else{const t=Xt();o={uuid:Xt(),name:i,exit_uuid:t},a.push(o),l.push({uuid:t,destination_uuid:null})}}const c=r.find((t=>{var i;return"has_number_eq"===t.type&&(null===(i=t.arguments)||void 0===i?void 0:i[0])===e}));d.push({uuid:(null==c?void 0:c.uuid)||Xt(),type:"has_number_eq",arguments:[e],category_uuid:o.uuid})}const c=n.find((t=>"Other"===t.name));let h;if(c){h=c;const t=s.find((t=>t.uuid===c.exit_uuid));l.push(t||{uuid:c.exit_uuid,destination_uuid:null})}else{const t=Xt();h={uuid:Xt(),name:"Other",exit_uuid:t},l.push({uuid:t,destination_uuid:null})}a.push(h);const u={type:"switch",operand:"@input.text",default_category_uuid:h.uuid,cases:d,categories:a,wait:{type:"msg",hint:{type:"digits",count:1}}};return t.result_name&&""!==t.result_name.trim()&&(u.result_name=t.result_name.trim()),{...e,router:u,exits:l}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},hp=[{value:"60",name:"1 minute"},{value:"120",name:"2 minutes"},{value:"180",name:"3 minutes"},{value:"240",name:"4 minutes"},{value:"300",name:"5 minutes"},{value:"600",name:"10 minutes"},{value:"900",name:"15 minutes"},{value:"1800",name:"30 minutes"},{value:"3600",name:"1 hour"},{value:"7200",name:"2 hours"},{value:"10800",name:"3 hours"},{value:"21600",name:"6 hours"},{value:"43200",name:"12 hours"},{value:"64800",name:"18 hours"},{value:"86400",name:"1 day"},{value:"172800",name:"2 days"},{value:"259200",name:"3 days"},{value:"604800",name:"1 week"}],up=(t,e=[],i=[],o=[])=>{const{router:n,exits:s}=Le("@input.text",t,Mu,e,i,o),r=e.find((t=>"No Response"===t.name||"Timeout"===t.name));if(r){const t=i.find((t=>t.uuid===r.exit_uuid));t&&(n.categories.push(r),s.push({uuid:t.uuid,destination_uuid:t.destination_uuid||null}))}return{router:n,exits:s}},pp={type:"wait_for_response",name:"Wait for Response",group:Kh.wait,flowTypes:[Vh],dialogSize:"large",form:{rules:Fu(Iu(Tu()),"Define rules to categorize responses"),timeout_enabled:{type:"checkbox",label:t=>t.timeout_enabled?"Continue when there is no response for":"Continue when there is no response..",labelPadding:"4px 8px"},timeout_duration:{type:"select",placeholder:"5 minutes",multi:!1,maxWidth:"100px",flavor:"xsmall",options:hp,conditions:{visible:t=>!0===t.timeout_enabled}},result_name:Cu},layout:["rules","result_name"],gutter:[{type:"row",items:["timeout_enabled","timeout_duration"],gap:"0.5rem"}],validate:t=>{const e={};return{valid:0===Object.keys(e).length,errors:e}},toFormData:t=>{var e,i,o,n;const s=Bu(t),r=null===(o=null===(i=null===(e=t.router)||void 0===e?void 0:e.wait)||void 0===i?void 0:i.timeout)||void 0===o?void 0:o.seconds;let a=hp.find((t=>t.value===String(r)));return a||(a={value:"300",name:"5 minutes"}),{uuid:t.uuid,rules:s,timeout_enabled:!!r,timeout_duration:a,result_name:(null===(n=t.router)||void 0===n?void 0:n.result_name)||""}},fromFormData:(t,e)=>{var i,o,n,s,r,a,l,d;const c=Nu(t);if(0===c.length){let o=(null===(i=e.router)||void 0===i?void 0:i.categories)||[];const n=[...e.exits||[]];if(t.timeout_enabled){let t=o.find((t=>"No Response"===t.name));if(!t){const e=Xt();t={uuid:Xt(),name:"No Response",exit_uuid:e},o=[...o,t],n.find((t=>t.uuid===e))||n.push({uuid:e,destination_uuid:null})}}else o=o.filter((t=>"No Response"!==t.name));const{router:s,exits:r}=up([],o,n,[]),a={...s,cases:[]};t.result_name&&""!==t.result_name.trim()&&(a.result_name=t.result_name.trim());const l={type:"msg"};if(t.timeout_enabled){let e;e=t.timeout_duration?Array.isArray(t.timeout_duration)&&t.timeout_duration.length>0?parseInt(t.timeout_duration[0].value,10):"string"==typeof t.timeout_duration?parseInt(t.timeout_duration,10):t.timeout_duration&&"object"==typeof t.timeout_duration&&t.timeout_duration.value?parseInt(t.timeout_duration.value,10):300:300,(isNaN(e)||e<=0)&&(e=300);const i=a.categories.find((t=>"No Response"===t.name));i&&(l.timeout={seconds:e,category_uuid:i.uuid})}return a.wait=l,{...e,router:a,exits:r}}const h=(null===(o=e.router)||void 0===o?void 0:o.categories)||[],u=e.exits||[],p=(null===(n=e.router)||void 0===n?void 0:n.cases)||[],{router:m,exits:g}=up(c,h,u,p),f={...m};t.result_name&&""!==t.result_name.trim()&&(f.result_name=t.result_name.trim());const v={type:"msg"};try{if(t.timeout_enabled){let i;if(t.timeout_duration)try{i=parseInt(t.timeout_duration[0].value,10)}catch(t){i=300}const o=null===(r=null===(s=e.router)||void 0===s?void 0:s.categories)||void 0===r?void 0:r.find((t=>"No Response"===t.name)),n=o||{uuid:Xt(),name:"No Response",exit_uuid:Xt()};if(v.timeout={seconds:i,category_uuid:n.uuid},!(null===(a=m.categories)||void 0===a?void 0:a.some((t=>"No Response"===t.name)))&&(m.categories=m.categories||[],m.categories.push(n),!g.some((t=>t.uuid===n.exit_uuid)))){const t={uuid:n.exit_uuid,destination_uuid:(null==o?void 0:o.exit_uuid)&&(null===(d=null===(l=e.exits)||void 0===l?void 0:l.find((t=>t.uuid===o.exit_uuid)))||void 0===d?void 0:d.destination_uuid)||null};g.push(t)}}else if(m.categories){const t=m.categories.findIndex((t=>"No Response"===t.name));if(-1!==t){const e=m.categories[t];m.categories.splice(t,1);const i=g.findIndex((t=>t.uuid===e.exit_uuid));-1!==i&&g.splice(i,1)}}}catch(t){console.error("Error processing timeout configuration:",t)}return f.wait=v,{...e,router:f,exits:g}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},mp=gp({say_msg:yu,play_audio:xu,set_contact_field:eu,send_broadcast:su,set_run_result:ru,send_msg:au,send_email:lu,start_session:du,set_contact_name:cu,add_contact_groups:hu,remove_contact_groups:uu,set_contact_channel:iu,set_contact_language:ou,set_contact_status:nu,add_contact_urn:tu,add_input_labels:Jh,request_optin:pu,enter_flow:_u});function gp(t){const e={...t};return Object.values(t).forEach((t=>{t.aliases&&t.aliases.forEach((i=>{e[i]=t}))})),e}const fp=gp({execute_actions:{type:"execute_actions"},split_by_contact_field:Uu,split_by_expression:ju,split_by_groups:Vu,split_by_llm:ep,split_by_llm_categorize:ip,split_by_random:Hu,split_by_run_result:Yu,split_by_scheme:Gu,split_by_subflow:Ku,split_by_ticket:Xu,split_by_webhook:Ju,split_by_resthook:tp,wait_for_menu:cp,wait_for_digits:ap,wait_for_audio:op,wait_for_dial:rp,wait_for_response:pp,split_by_airtime:Eu,terminal:{type:"terminal"}});function vp(t,e,i,o,n=20,s=10,r=5,a="top"){const l=r;if("top"===a){const r=e+n,a=o-s;let d=`M ${t} ${e}`;if(t===i)d+=` L ${i} ${a}`;else{const o=i>t?1:-1,n=Math.max(e+l,Math.min(r,a-l)),s=Math.min(l,n-e);s>=1?(d+=` L ${t} ${n-s}`,d+=` Q ${t} ${n}, ${t+o*s} ${n}`):d+=` L ${t} ${n}`;const c=3,h=Math.min(l,Math.max(0,a-n-c));h>=1?(d+=` L ${i-o*h} ${n}`,d+=` Q ${i} ${n}, ${i} ${n+h}`):d+=` L ${i} ${n}`,d+=` L ${i} ${a}`}return d+=` L ${i} ${o}`,d}if("left"===a||"right"===a){const r=e+(o<e?0:n),d="left"===a?-1:1,c=i+d*s,h=c>t?1:-1,u=3,p=h===d?r+2*l:Math.max(r+2*l,o);let m=`M ${t} ${e} L ${t} ${r}`;p-r>l&&(m+=` L ${t} ${p-l}`,m+=` Q ${t} ${p}, ${t+h*l} ${p}`);const g=Math.abs(p-o);if(g<1)m+=` L ${c} ${o}`,m+=` L ${i} ${o}`;else{const t=o<p?-1:1,e=Math.min(l,Math.max(0,Math.floor((g-u)/2)),Math.max(0,s-u));e>=1?(m+=` L ${c-h*e} ${p}`,m+=` Q ${c} ${p}, ${c} ${p+t*e}`,m+=` L ${c} ${o-t*e}`,m+=` Q ${c} ${o}, ${c-d*e} ${o}`):(m+=` L ${c} ${p}`,m+=` L ${c} ${o}`),m+=` L ${i} ${o}`}return m}return`M ${t} ${e} L ${i} ${o}`}class bp{constructor(t,e){this.connections=new Map,this.sources=new Map,this.pendingConnections=[],this.connectionWait=null,this.connectionListeners=new Map,this.dragState=null,this.retryCount=0,this.maxRetries=3,this.activityData=null,this.overlays=new Map,this.hoveredActivityKey=null,this.recentContactsPopup=null,this.recentContactsCache={},this.pendingFetches={},this.hideContactsTimeout=null,this.showContactsTimeout=null,this.connectionDragging=!1,this.canvas=t,this.editor=e}notifyListeners(t,e){(this.connectionListeners.get(t)||[]).forEach((t=>t(e)))}on(t,e){this.connectionListeners.has(t)||this.connectionListeners.set(t,[]),this.connectionListeners.get(t).push(e)}off(t,e){if(!this.connectionListeners.has(t))return;const i=this.connectionListeners.get(t),o=i.indexOf(e);-1!==o&&i.splice(o,1)}makeSource(t){const e=document.getElementById(t);if(!e)return;this.sources.has(t)&&this.sources.get(t)();let i=null;const o=o=>{if(0!==o.button)return;if(this.connections.has(t))return;const n=o.clientX,s=o.clientY,r=e.closest("temba-flow-node"),a=(null==r?void 0:r.getAttribute("uuid"))||"",l=e=>{const o=e.clientX-n,r=e.clientY-s;Math.sqrt(o*o+r*r)>5&&(document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",d),i=null,this.startDrag(t,a,null,e))},d=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",d),i=null};document.addEventListener("mousemove",l),document.addEventListener("mouseup",d),i={startX:n,startY:s,onMove:l,onUp:d}};e.addEventListener("mousedown",o),this.sources.set(t,(()=>{e.removeEventListener("mousedown",o),i&&(document.removeEventListener("mousemove",i.onMove),document.removeEventListener("mouseup",i.onUp),i=null)}))}makeTarget(t){}connectIds(t,e,i){this.pendingConnections.push({scope:t,fromId:e,toId:i}),this.processPendingConnections()}processPendingConnections(){this.connectionWait&&(cancelAnimationFrame(this.connectionWait),this.connectionWait=null),this.connectionWait=requestAnimationFrame((()=>{const t=[],e=new Set;this.pendingConnections.forEach((i=>{const{scope:o,fromId:n,toId:s}=i;this.removeConnectionSVG(n),this.createConnectionSVG(n,o,s)?e.add(s):t.push(i)})),this.pendingConnections=[],e.size>0&&this.connections.forEach(((t,i)=>{e.has(t.toId)&&this.updateConnectionSVG(i)})),t.length>0&&this.retryCount<this.maxRetries?(this.retryCount++,this.pendingConnections=t,this.processPendingConnections()):this.retryCount=0}))}determineTargetFace(t,e,i,o){const n=i.left+i.width/2-o.left;return i.top-o.top-e>30?"top":t<n?"left":"right"}getConnectionEndpoints(t,e){const i=document.getElementById(t),o=document.getElementById(e);if(!i||!o)return null;const n=this.canvas.getBoundingClientRect(),s=i.getBoundingClientRect(),r=o.getBoundingClientRect();if(0===s.width||0===r.width)return null;const a=s.left+s.width/2-n.left,l=s.bottom-n.top,d=this.determineTargetFace(a,l,r,n),c=new Map;this.connections.forEach((t=>{if(t.toId===e){const e=document.getElementById(t.fromId);if(e){const i=e.getBoundingClientRect(),o=i.left+i.width/2-n.left,s=i.bottom-n.top,a=this.determineTargetFace(o,s,r,n);c.has(a)||c.set(a,[]);const l="top"===a?o:s;c.get(a).push({fromId:t.fromId,sortPos:l})}}})),c.has(d)||c.set(d,[]);const h=c.get(d);if(!h.find((e=>e.fromId===t))){const e="top"===d?a:l;h.push({fromId:t,sortPos:e})}h.sort(((t,e)=>t.sortPos-e.sortPos));const u=h.findIndex((e=>e.fromId===t)),p=h.length,m=r.left-n.left,g=r.top-n.top,f=r.width,v=r.height;let b,y;if("top"===d){b=1===p?m+f/2:m+.2*f+.6*f*(u+.5)/p,y=g}else if("left"===d){b=m;y=1===p?g+v/2:g+.2*v+.6*v*(u+.5)/p}else{b=m+f;y=1===p?g+v/2:g+.2*v+.6*v*(u+.5)/p}return{sourceX:a,sourceY:l,targetX:b,targetY:y,targetFace:d}}createSVGElement(){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.classList.add("plumb-connector"),t.style.position="absolute",t.style.left="0",t.style.top="0",t.style.width="100%",t.style.height="100%",t.style.pointerEvents="none",t.style.overflow="visible";const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("fill","none"),e.setAttribute("stroke","var(--color-connectors)"),e.setAttribute("stroke-width","3"),e.style.pointerEvents="stroke";const i=document.createElementNS("http://www.w3.org/2000/svg","polygon");i.setAttribute("fill","var(--color-connectors)"),i.classList.add("plumb-arrow"),i.style.pointerEvents="fill",i.style.cursor="pointer",t.appendChild(e),t.appendChild(i);const o=()=>t.classList.add("hover"),n=()=>t.classList.remove("hover");return e.addEventListener("mouseenter",o),e.addEventListener("mouseleave",n),i.addEventListener("mouseenter",o),i.addEventListener("mouseleave",n),{svgEl:t,pathEl:e,arrowEl:i}}updateSVGPath(t,e,i,o,n,s,r="top"){const a=6.5,l=13;let d=n,c=s;"top"===r?c=s-l:"left"===r?d=n-l:"right"===r&&(d=n+l);const h=vp(i,o,d,c,30,8,5,r);t.setAttribute("d",h),"top"===r?e.setAttribute("points",`${n},${s} ${n-a},${s-l} ${n+a},${s-l}`):"left"===r?e.setAttribute("points",`${n},${s} ${n-l},${s-a} ${n-l},${s+a}`):e.setAttribute("points",`${n},${s} ${n+l},${s-a} ${n+l},${s+a}`)}createConnectionSVG(t,e,i){const o=this.getConnectionEndpoints(t,i);if(!o)return!1;const{svgEl:n,pathEl:s,arrowEl:r}=this.createSVGElement();this.updateSVGPath(s,r,o.sourceX,o.sourceY,o.targetX,o.targetY,o.targetFace),this.canvas.appendChild(n),this.connections.set(t,{scope:e,fromId:t,toId:i,svgEl:n,pathEl:s,arrowEl:r});r.addEventListener("mousedown",(o=>{if(0!==o.button)return;o.stopPropagation();const n=o.clientX,s=o.clientY,r=o=>{const l=o.clientX-n,d=o.clientY-s;Math.sqrt(l*l+d*d)>5&&(document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",a),this.startDrag(t,e,i,o))},a=()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",a)};document.addEventListener("mousemove",r),document.addEventListener("mouseup",a)}));const a=document.getElementById(t);if(a&&a.classList.add("connected"),this.activityData){const e=`${t}:${i}`,o=this.activityData.segments[e];if(o&&o>0){const i=this.createOverlayElement(o,e);this.canvas.appendChild(i),this.overlays.set(t,i),this.updateOverlayPosition(t)}}return!0}updateConnectionSVG(t){const e=this.connections.get(t);if(!e)return;const i=this.getConnectionEndpoints(e.fromId,e.toId);i&&(this.updateSVGPath(e.pathEl,e.arrowEl,i.sourceX,i.sourceY,i.targetX,i.targetY,i.targetFace),this.updateOverlayPosition(t))}removeConnectionSVG(t){const e=this.connections.get(t);if(!e)return;const i=this.overlays.get(t);i&&(i.remove(),this.overlays.delete(t)),e.svgEl.remove(),this.connections.delete(t)}repaintEverything(){this.connections.forEach(((t,e)=>{this.updateConnectionSVG(e)}))}revalidate(t){const e=[],i=new Set;this.connections.forEach(((o,n)=>{(t.includes(o.fromId)||t.includes(o.toId)||t.includes(o.scope))&&(e.push(n),i.add(o.toId))}));const o=new Set(e);this.connections.forEach(((t,e)=>{i.has(t.toId)&&o.add(e)})),o.forEach((t=>{this.updateConnectionSVG(t)}))}forgetNode(t){var e;const i=[];this.connections.forEach(((e,o)=>{e.scope!==t&&e.toId!==t||i.push(o)})),i.forEach((t=>this.removeConnectionSVG(t)));const o=null===(e=document.getElementById(t))||void 0===e?void 0:e.querySelectorAll(".exit");o&&o.forEach((t=>{const e=t.id;this.sources.has(e)&&(this.sources.get(e)(),this.sources.delete(e))}))}removeNodeConnections(t,e){var i;(e||Array.from((null===(i=document.getElementById(t))||void 0===i?void 0:i.querySelectorAll(".exit"))||[]).map((t=>t.id))).forEach((t=>this.removeConnectionSVG(t)))}removeExitConnection(t){return!!this.connections.has(t)&&(this.removeConnectionSVG(t),!0)}removeAllEndpoints(t){var e;const i=null===(e=document.getElementById(t))||void 0===e?void 0:e.querySelectorAll(".exit");i&&i.forEach((t=>{const e=t.id;this.sources.has(e)&&(this.sources.get(e)(),this.sources.delete(e))}))}setConnectionRemovingState(t,e){const i=this.connections.get(t);return!!i&&(e?i.svgEl.classList.add("removing"):i.svgEl.classList.remove("removing"),!0)}setActivityData(t){this.activityData=t,this.clearRecentContactsCache(),this.updateActivityOverlays()}updateActivityOverlays(){if(!this.activityData)return this.overlays.forEach((t=>t.remove())),void this.overlays.clear();const t=new Set;this.connections.forEach(((e,i)=>{const o=`${e.fromId}:${e.toId}`,n=this.activityData.segments[o];if(n&&n>0){t.add(i);let e=this.overlays.get(i);e?(e.textContent=n.toLocaleString(),e.setAttribute("data-activity-key",o)):(e=this.createOverlayElement(n,o),this.canvas.appendChild(e),this.overlays.set(i,e)),this.updateOverlayPosition(i)}})),this.overlays.forEach(((e,i)=>{t.has(i)||(e.remove(),this.overlays.delete(i))}))}createOverlayElement(t,e){const i=document.createElement("div");return i.className="activity-overlay",i.textContent=t.toLocaleString(),i.setAttribute("data-activity-key",e),i.addEventListener("mouseenter",(()=>{const t=this.getFlowUuid();t&&(this.fetchRecentContacts(e,t),this.showContactsTimeout=window.setTimeout((()=>{this.showRecentContacts(e,t)}),500))})),i.addEventListener("mouseleave",(()=>{this.showContactsTimeout&&(clearTimeout(this.showContactsTimeout),this.showContactsTimeout=null),this.hoveredActivityKey=null,this.hideRecentContacts()})),i}updateOverlayPosition(t){const e=this.overlays.get(t),i=this.connections.get(t);if(!e||!i)return;const o=this.getConnectionEndpoints(i.fromId,i.toId);o&&(e.style.position="absolute",e.style.left=`${o.sourceX}px`,e.style.top=`${o.sourceY+15}px`,e.style.transform="translate(-50%, -50%)")}getFlowUuid(){var t,e;return(null===(e=null===(t=this.editor)||void 0===t?void 0:t.definition)||void 0===e?void 0:e.uuid)||null}async fetchRecentContacts(t,e){if(this.recentContactsCache[t]||this.pendingFetches[t])return;const i=new AbortController;this.pendingFetches[t]=i;try{const[o,n]=t.split(":"),s=`/flow/recent_contacts/${e}/${o}/${n}/`,r=await fetch(s,{signal:i.signal});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const a=await r.json();this.recentContactsCache[t]=Array.isArray(a)?a:a.results||[]}catch(t){"AbortError"!==t.name&&console.error("Failed to fetch recent contacts:",t)}finally{delete this.pendingFetches[t]}}async showRecentContacts(t,e){const i=this.findOverlayForActivityKey(t);i&&(this.hideContactsTimeout&&(clearTimeout(this.hideContactsTimeout),this.hideContactsTimeout=null),this.hoveredActivityKey=t,this.recentContactsPopup||(this.recentContactsPopup=document.createElement("div"),this.recentContactsPopup.className="recent-contacts-popup",this.recentContactsPopup.style.position="absolute",this.recentContactsPopup.style.zIndex="1015",this.recentContactsPopup.style.display="none",document.body.appendChild(this.recentContactsPopup),this.recentContactsPopup.onmouseenter=()=>{this.hideContactsTimeout&&(clearTimeout(this.hideContactsTimeout),this.hideContactsTimeout=null)},this.recentContactsPopup.onmouseleave=()=>{this.hoveredActivityKey=null,this.hideRecentContacts()},this.recentContactsPopup.onclick=t=>{const e=t.target;if(e.classList.contains("contact-name")){this.hideRecentContacts(!1);const t=e.getAttribute("data-uuid");t&&this.editor.fireCustomEvent("temba-contact-clicked",{uuid:t})}}),this.recentContactsCache[t]?(this.renderRecentContactsPopup(this.recentContactsCache[t]),this.positionPopup(i)):(this.recentContactsPopup.innerHTML='<div class="no-contacts-message">Loading...</div>',this.positionPopup(i),await this.fetchRecentContacts(t,e),this.hoveredActivityKey===t&&(this.renderRecentContactsPopup(this.recentContactsCache[t]||[]),this.positionPopup(i))))}findOverlayForActivityKey(t){for(const[,e]of this.overlays)if(e.getAttribute("data-activity-key")===t)return e;return null}positionPopup(t){if(!this.recentContactsPopup)return;const e=t.getBoundingClientRect();this.recentContactsPopup.style.left=`${e.left+window.scrollX}px`,this.recentContactsPopup.style.top=`${e.bottom+window.scrollY+5}px`,this.recentContactsPopup.style.display="",this.recentContactsPopup.classList.remove("show"),this.recentContactsPopup.offsetWidth,this.recentContactsPopup.classList.add("show")}renderRecentContactsPopup(t){if(!this.recentContactsPopup)return;if(0===t.length)return void(this.recentContactsPopup.innerHTML='<div class="no-contacts-message">No Recent Contacts</div>');let e='<div class="popup-title">Recent Contacts</div>';t.forEach((t=>{if(e+='<div class="contact-row">',e+=`<div class="contact-name" data-uuid="${t.contact.uuid}">${t.contact.name}</div>`,t.operand&&(e+=`<div class="contact-operand">${t.operand}</div>`),t.time){const i=new Date(t.time),o=Date.now()-i.getTime(),n=Math.floor(o/6e4),s=Math.floor(o/36e5),r=Math.floor(o/864e5);let a="";a=n<1?"just now":n<60?`${n}m ago`:s<24?`${s}h ago`:`${r}d ago`,e+=`<div class="contact-time">${a}</div>`}e+="</div>"})),this.recentContactsPopup.innerHTML=e}hideRecentContacts(t=!0){t?this.hideContactsTimeout=window.setTimeout((()=>{!this.hoveredActivityKey&&this.recentContactsPopup&&(this.recentContactsPopup.classList.remove("show"),this.recentContactsPopup.style.display="none",this.hoveredActivityKey=null)}),200):this.recentContactsPopup&&(this.recentContactsPopup.classList.remove("show"),this.recentContactsPopup.style.display="none",this.hoveredActivityKey=null)}clearRecentContactsCache(){this.recentContactsCache={},Object.values(this.pendingFetches).forEach((t=>t.abort())),this.pendingFetches={}}startDrag(t,e,i,o){this.removeConnectionSVG(t);const{svgEl:n,pathEl:s,arrowEl:r}=this.createSVGElement();n.classList.add("dragging"),s.style.pointerEvents="none",r.style.pointerEvents="none",this.canvas.appendChild(n);const a=document.getElementById(t);if(!a)return void n.remove();const l=this.canvas.getBoundingClientRect(),d=a.getBoundingClientRect(),c=d.left+d.width/2-l.left,h=d.bottom-l.top,u=6.5,p=(t,e)=>{const i=e<h;let o,n="top";i&&(n=t<c?"left":"right"),o=i?e+1+13:e-1;const a=vp(c,h,t,o,30,i?0:8,5,n);if(s.setAttribute("d",a),i){const i=e+1;r.setAttribute("points",`${t},${i} ${t-u},${o} ${t+u},${o}`)}else{const e=o+13;r.setAttribute("points",`${t},${e} ${t-u},${o} ${t+u},${o}`)}},m=o.clientX-l.left,g=o.clientY-l.top;p(m,g),this.connectionDragging=!0;const f=t=>{const e=t.clientX-l.left,i=t.clientY-l.top;p(e,i)},v=o=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",v),n.remove(),this.connectionDragging=!1,this.dragState=null,this.notifyListeners("connection:abort",{source:a,sourceId:t,target:{id:i},data:{nodeId:e}})};document.addEventListener("mousemove",f),document.addEventListener("mouseup",v),this.dragState={sourceId:t,scope:e,originalTargetId:i,svgEl:n,pathEl:s,arrowEl:r,onMove:f,onUp:v},this.notifyListeners("connection:drag",{sourceId:t,sourceX:c,sourceY:h,data:{nodeId:e},target:{id:i}})}reset(){this.connectionWait&&(cancelAnimationFrame(this.connectionWait),this.connectionWait=null),this.pendingConnections=[],this.connections.forEach((t=>t.svgEl.remove())),this.connections.clear(),this.overlays.forEach((t=>t.remove())),this.overlays.clear(),this.hideRecentContacts(!1),this.recentContactsPopup&&(this.recentContactsPopup.remove(),this.recentContactsPopup=null),this.recentContactsCache={},Object.values(this.pendingFetches).forEach((t=>t.abort())),this.pendingFetches={},this.sources.forEach((t=>t())),this.sources.clear(),this.dragState&&(document.removeEventListener("mousemove",this.dragState.onMove),document.removeEventListener("mouseup",this.dragState.onUp),this.dragState.svgEl.remove(),this.dragState=null,this.connectionDragging=!1)}}class yp extends Ne{createRenderRoot(){return this}static get styles(){return a`
8546
+ `},toFormData:t=>{var e,i,o;const n=null===(e=t.actions)||void 0===e?void 0:e.find((t=>"call_llm"===t.type)),s=(null===(o=null===(i=t.router)||void 0===i?void 0:i.categories)||void 0===o?void 0:o.filter((t=>"Other"!==t.name&&"Failure"!==t.name)).map((t=>({name:t.name}))))||[];return{uuid:t.uuid,llm:(null==n?void 0:n.llm)?[{value:n.llm.uuid,name:n.llm.name}]:[],input:(null==n?void 0:n.input)||"@input",categories:s}},fromFormData:(t,e)=>{var i,o,n;const s=Array.isArray(t.llm)&&t.llm.length>0?t.llm[0]:null,r=(t.categories||[]).filter((t=>{var e;return null===(e=null==t?void 0:t.name)||void 0===e?void 0:e.trim()})).map((t=>t.name.trim())),a=null===(i=e.actions)||void 0===i?void 0:i.find((t=>"call_llm"===t.type)),l={type:"call_llm",uuid:(null==a?void 0:a.uuid)||Xt(),llm:s?{uuid:s.value,name:s.name}:{uuid:"",name:""},instructions:'@(prompt("categorize", slice(node.categories, 0, -2)))',input:t.input||"@input",output_local:"_llm_output"},d=(null===(o=e.router)||void 0===o?void 0:o.categories)||[],c=e.exits||[],h=(null===(n=e.router)||void 0===n?void 0:n.cases)||[],{router:u,exits:p}=((t,e,i,o=[],n=[],s=[])=>{const r=[],a=[],l=[];e.forEach((t=>{const e=Te({name:t,existingCategories:o,existingExits:n,existingCases:s,caseConfig:i(t)});r.push(e.category),a.push(e.exit),e.case&&l.push(e.case)}));const d=Te({name:"Other",existingCategories:o,existingExits:n});r.push(d.category),a.push(d.exit);const c=Te({name:"Failure",existingCategories:o,existingExits:n,existingCases:s,caseConfig:{type:"has_only_text",arguments:["<ERROR>"]}});return r.push(c.category),a.push(c.exit),c.case&&l.push(c.case),{router:{type:"switch",categories:r,default_category_uuid:d.category.uuid,operand:t,cases:l},exits:a}})("@locals._llm_output",r,(t=>({type:"has_only_text",arguments:[t]})),d,c,h);return{uuid:e.uuid,actions:[l],router:u,exits:p}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},op={type:"wait_for_audio",name:"Make Recording",group:Kh.wait,flowTypes:[Hh],form:{result_name:{type:"text",label:"Result Name",required:!1,placeholder:"(optional)",helpText:"The name to use to reference this result in the flow"}},layout:["result_name"],toFormData:t=>{var e;return{uuid:t.uuid,result_name:(null===(e=t.router)||void 0===e?void 0:e.result_name)||""}},fromFormData:(t,e)=>{var i;const o=(null===(i=e.router)||void 0===i?void 0:i.categories)||[],n=e.exits||[];let s,r=o.find((t=>"All Responses"===t.name));if(r)s=n.find((t=>t.uuid===r.exit_uuid))||{uuid:r.exit_uuid,destination_uuid:null};else{const t=Xt();r={uuid:Xt(),name:"All Responses",exit_uuid:t},s={uuid:t,destination_uuid:null}}const a={type:"switch",operand:"@input",default_category_uuid:r.uuid,cases:[],categories:[r],wait:{type:"msg",hint:{type:"audio"}}};return t.result_name&&""!==t.result_name.trim()&&(a.result_name=t.result_name.trim()),{...e,router:a,exits:[s]}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},np=["Answered","No Answer","Busy","Failed"],sp=[{type:"has_only_text",arguments:["answered"],categoryName:"Answered"},{type:"has_only_text",arguments:["no_answer"],categoryName:"No Answer"},{type:"has_only_text",arguments:["busy"],categoryName:"Busy"}],rp={type:"wait_for_dial",name:"Redirect Call",group:Kh.wait,flowTypes:[Hh],router:{type:"switch",defaultCategory:"Failed",rules:sp.map((t=>({type:t.type,arguments:t.arguments,categoryName:t.categoryName})))},form:{phone:{type:"text",label:"Phone Number",required:!0,evaluated:!0,placeholder:"Phone number or expression"},dial_limit_seconds:{type:"text",label:"Dial Limit (seconds)",required:!1,placeholder:"60"},call_limit_seconds:{type:"text",label:"Call Limit (seconds)",required:!1,placeholder:"7200"},result_name:Cu},layout:["phone",{type:"row",items:["dial_limit_seconds","call_limit_seconds"]},"result_name"],toFormData:t=>{var e,i;const o=null===(e=t.router)||void 0===e?void 0:e.wait;return{uuid:t.uuid,phone:(null==o?void 0:o.phone)||"",dial_limit_seconds:(null==o?void 0:o.dial_limit_seconds)?String(o.dial_limit_seconds):"",call_limit_seconds:(null==o?void 0:o.call_limit_seconds)?String(o.call_limit_seconds):"",result_name:(null===(i=t.router)||void 0===i?void 0:i.result_name)||""}},fromFormData:(t,e)=>{var i,o;const n=(null===(i=e.router)||void 0===i?void 0:i.categories)||[],s=e.exits||[],r=(null===(o=e.router)||void 0===o?void 0:o.cases)||[],a=[],l=[],d=[];for(const t of np){const e=n.find((e=>e.name===t));if(e){a.push(e);const t=s.find((t=>t.uuid===e.exit_uuid));l.push(t||{uuid:e.exit_uuid,destination_uuid:null})}else{const e=Xt();a.push({uuid:Xt(),name:t,exit_uuid:e}),l.push({uuid:e,destination_uuid:null})}}for(const t of sp){const e=a.find((e=>e.name===t.categoryName));if(!e)continue;const i=r.find((e=>{var i;return e.type===t.type&&(null===(i=e.arguments)||void 0===i?void 0:i[0])===t.arguments[0]}));d.push({uuid:(null==i?void 0:i.uuid)||Xt(),type:t.type,arguments:t.arguments,category_uuid:e.uuid})}const c=a.find((t=>"Failed"===t.name)),h=(t.phone||"").trim(),u=parseInt(t.dial_limit_seconds,10),p=parseInt(t.call_limit_seconds,10),m={type:"dial",phone:h};!isNaN(u)&&u>0&&(m.dial_limit_seconds=u),!isNaN(p)&&p>0&&(m.call_limit_seconds=p);const g={type:"switch",operand:'@(default(resume.dial.status, ""))',default_category_uuid:null==c?void 0:c.uuid,cases:d,categories:a,wait:m};return t.result_name&&""!==t.result_name.trim()&&(g.result_name=t.result_name.trim()),{...e,router:g,exits:l}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},ap={type:"wait_for_digits",name:"Wait for Digits",group:Kh.wait,flowTypes:[Hh],dialogSize:"large",form:{rules:Fu(Iu($u.filter((t=>Du.has(t.type)))),""),result_name:Cu},layout:[{type:"text",text:"Rules match against all digits pressed by the caller followed by the # sign."},"rules","result_name"],validate:t=>({valid:!0,errors:{}}),toFormData:t=>{var e;const i=Bu(t);return{uuid:t.uuid,rules:i,result_name:(null===(e=t.router)||void 0===e?void 0:e.result_name)||""}},fromFormData:(t,e)=>{var i,o;const n=Nu(t),s=(null===(i=e.router)||void 0===i?void 0:i.categories)||[],r=e.exits||[],a=(null===(o=e.router)||void 0===o?void 0:o.cases)||[],{router:l,exits:d}=Le("@input.text",n,Mu,s,r,a),c={...l,wait:{type:"msg",hint:{type:"digits"}}};return t.result_name&&""!==t.result_name.trim()&&(c.result_name=t.result_name.trim()),{...e,router:c,exits:d}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},lp=["1","2","3","4","5","6","7","8","9","0"];function dp(t){return`digit_${t}`}const cp={type:"wait_for_menu",name:"Wait for Menu",group:Kh.wait,flowTypes:[Hh],form:{...Object.fromEntries(lp.map((t=>[dp(t),{type:"text",required:!1,placeholder:"",flavor:"xsmall"}]))),result_name:Cu},layout:[{type:"row",items:["digit_1","digit_2","digit_3"],gap:"2rem",marginBottom:"0.5rem",inlineLabels:{digit_1:"1",digit_2:"2",digit_3:"3"}},{type:"row",items:["digit_4","digit_5","digit_6"],gap:"2rem",marginBottom:"0.5rem",inlineLabels:{digit_4:"4",digit_5:"5",digit_6:"6"}},{type:"row",items:["digit_7","digit_8","digit_9"],gap:"2rem",marginBottom:"0.5rem",inlineLabels:{digit_7:"7",digit_8:"8",digit_9:"9"}},{type:"row",items:[{type:"spacer"},"digit_0",{type:"spacer"}],gap:"2rem",inlineLabels:{digit_0:"0"}},"result_name"],toFormData:t=>{var e,i,o,n;const s={uuid:t.uuid,result_name:(null===(e=t.router)||void 0===e?void 0:e.result_name)||""};for(const t of lp)s[dp(t)]="";if((null===(i=t.router)||void 0===i?void 0:i.cases)&&(null===(o=t.router)||void 0===o?void 0:o.categories))for(const e of t.router.cases)if("has_number_eq"===e.type&&(null===(n=e.arguments)||void 0===n?void 0:n[0])){const i=e.arguments[0],o=t.router.categories.find((t=>t.uuid===e.category_uuid));o&&lp.includes(i)&&(s[dp(i)]=o.name)}return s},fromFormData:(t,e)=>{var i,o;const n=(null===(i=e.router)||void 0===i?void 0:i.categories)||[],s=e.exits||[],r=(null===(o=e.router)||void 0===o?void 0:o.cases)||[],a=[],l=[],d=[];for(const e of lp){const i=(t[dp(e)]||"").trim();if(!i)continue;let o=a.find((t=>t.name===i));if(!o){const t=n.find((t=>t.name===i));if(t){o=t;const e=s.find((e=>e.uuid===t.exit_uuid));a.push(o),l.push(e||{uuid:t.exit_uuid,destination_uuid:null})}else{const t=Xt();o={uuid:Xt(),name:i,exit_uuid:t},a.push(o),l.push({uuid:t,destination_uuid:null})}}const c=r.find((t=>{var i;return"has_number_eq"===t.type&&(null===(i=t.arguments)||void 0===i?void 0:i[0])===e}));d.push({uuid:(null==c?void 0:c.uuid)||Xt(),type:"has_number_eq",arguments:[e],category_uuid:o.uuid})}const c=n.find((t=>"Other"===t.name));let h;if(c){h=c;const t=s.find((t=>t.uuid===c.exit_uuid));l.push(t||{uuid:c.exit_uuid,destination_uuid:null})}else{const t=Xt();h={uuid:Xt(),name:"Other",exit_uuid:t},l.push({uuid:t,destination_uuid:null})}a.push(h);const u={type:"switch",operand:"@input.text",default_category_uuid:h.uuid,cases:d,categories:a,wait:{type:"msg",hint:{type:"digits",count:1}}};return t.result_name&&""!==t.result_name.trim()&&(u.result_name=t.result_name.trim()),{...e,router:u,exits:l}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},hp=[{value:"60",name:"1 minute"},{value:"120",name:"2 minutes"},{value:"180",name:"3 minutes"},{value:"240",name:"4 minutes"},{value:"300",name:"5 minutes"},{value:"600",name:"10 minutes"},{value:"900",name:"15 minutes"},{value:"1800",name:"30 minutes"},{value:"3600",name:"1 hour"},{value:"7200",name:"2 hours"},{value:"10800",name:"3 hours"},{value:"21600",name:"6 hours"},{value:"43200",name:"12 hours"},{value:"64800",name:"18 hours"},{value:"86400",name:"1 day"},{value:"172800",name:"2 days"},{value:"259200",name:"3 days"},{value:"604800",name:"1 week"}],up=(t,e=[],i=[],o=[])=>{const{router:n,exits:s}=Le("@input.text",t,Mu,e,i,o),r=e.find((t=>"No Response"===t.name||"Timeout"===t.name));if(r){const t=i.find((t=>t.uuid===r.exit_uuid));t&&(n.categories.push(r),s.push({uuid:t.uuid,destination_uuid:t.destination_uuid||null}))}return{router:n,exits:s}},pp={type:"wait_for_response",name:"Wait for Response",group:Kh.wait,flowTypes:[Vh],dialogSize:"large",form:{rules:Fu(Iu(Tu()),"If the message from the contact..."),timeout_enabled:{type:"checkbox",label:t=>t.timeout_enabled?"Continue when there is no response for":"Continue when there is no response..",labelPadding:"4px 8px"},timeout_duration:{type:"select",placeholder:"5 minutes",multi:!1,maxWidth:"100px",flavor:"xsmall",options:hp,conditions:{visible:t=>!0===t.timeout_enabled}},result_name:Cu},layout:["rules","result_name"],gutter:[{type:"row",items:["timeout_enabled","timeout_duration"],gap:"0.5rem"}],validate:t=>{const e={};return{valid:0===Object.keys(e).length,errors:e}},toFormData:t=>{var e,i,o,n;const s=Bu(t),r=null===(o=null===(i=null===(e=t.router)||void 0===e?void 0:e.wait)||void 0===i?void 0:i.timeout)||void 0===o?void 0:o.seconds;let a=hp.find((t=>t.value===String(r)));return a||(a={value:"300",name:"5 minutes"}),{uuid:t.uuid,rules:s,timeout_enabled:!!r,timeout_duration:a,result_name:(null===(n=t.router)||void 0===n?void 0:n.result_name)||""}},fromFormData:(t,e)=>{var i,o,n,s,r,a,l,d;const c=Nu(t);if(0===c.length){let o=(null===(i=e.router)||void 0===i?void 0:i.categories)||[];const n=[...e.exits||[]];if(t.timeout_enabled){let t=o.find((t=>"No Response"===t.name));if(!t){const e=Xt();t={uuid:Xt(),name:"No Response",exit_uuid:e},o=[...o,t],n.find((t=>t.uuid===e))||n.push({uuid:e,destination_uuid:null})}}else o=o.filter((t=>"No Response"!==t.name));const{router:s,exits:r}=up([],o,n,[]),a={...s,cases:[]};t.result_name&&""!==t.result_name.trim()&&(a.result_name=t.result_name.trim());const l={type:"msg"};if(t.timeout_enabled){let e;e=t.timeout_duration?Array.isArray(t.timeout_duration)&&t.timeout_duration.length>0?parseInt(t.timeout_duration[0].value,10):"string"==typeof t.timeout_duration?parseInt(t.timeout_duration,10):t.timeout_duration&&"object"==typeof t.timeout_duration&&t.timeout_duration.value?parseInt(t.timeout_duration.value,10):300:300,(isNaN(e)||e<=0)&&(e=300);const i=a.categories.find((t=>"No Response"===t.name));i&&(l.timeout={seconds:e,category_uuid:i.uuid})}return a.wait=l,{...e,router:a,exits:r}}const h=(null===(o=e.router)||void 0===o?void 0:o.categories)||[],u=e.exits||[],p=(null===(n=e.router)||void 0===n?void 0:n.cases)||[],{router:m,exits:g}=up(c,h,u,p),f={...m};t.result_name&&""!==t.result_name.trim()&&(f.result_name=t.result_name.trim());const v={type:"msg"};try{if(t.timeout_enabled){let i;if(t.timeout_duration)try{i=parseInt(t.timeout_duration[0].value,10)}catch(t){i=300}const o=null===(r=null===(s=e.router)||void 0===s?void 0:s.categories)||void 0===r?void 0:r.find((t=>"No Response"===t.name)),n=o||{uuid:Xt(),name:"No Response",exit_uuid:Xt()};if(v.timeout={seconds:i,category_uuid:n.uuid},!(null===(a=m.categories)||void 0===a?void 0:a.some((t=>"No Response"===t.name)))&&(m.categories=m.categories||[],m.categories.push(n),!g.some((t=>t.uuid===n.exit_uuid)))){const t={uuid:n.exit_uuid,destination_uuid:(null==o?void 0:o.exit_uuid)&&(null===(d=null===(l=e.exits)||void 0===l?void 0:l.find((t=>t.uuid===o.exit_uuid)))||void 0===d?void 0:d.destination_uuid)||null};g.push(t)}}else if(m.categories){const t=m.categories.findIndex((t=>"No Response"===t.name));if(-1!==t){const e=m.categories[t];m.categories.splice(t,1);const i=g.findIndex((t=>t.uuid===e.exit_uuid));-1!==i&&g.splice(i,1)}}}catch(t){console.error("Error processing timeout configuration:",t)}return f.wait=v,{...e,router:f,exits:g}},localizable:"categories",toLocalizationFormData:Su,fromLocalizationFormData:Au},mp=gp({say_msg:bu,play_audio:xu,set_contact_field:eu,send_broadcast:su,set_run_result:ru,send_msg:au,send_email:lu,start_session:du,set_contact_name:cu,add_contact_groups:hu,remove_contact_groups:uu,set_contact_channel:iu,set_contact_language:ou,set_contact_status:nu,add_contact_urn:tu,add_input_labels:Jh,request_optin:pu,enter_flow:_u});function gp(t){const e={...t};return Object.values(t).forEach((t=>{t.aliases&&t.aliases.forEach((i=>{e[i]=t}))})),e}const fp=gp({execute_actions:{type:"execute_actions"},split_by_contact_field:Uu,split_by_expression:ju,split_by_groups:Vu,split_by_llm:ep,split_by_llm_categorize:ip,split_by_random:Hu,split_by_run_result:Yu,split_by_scheme:Gu,split_by_subflow:Ku,split_by_ticket:Xu,split_by_webhook:Ju,split_by_resthook:tp,wait_for_menu:cp,wait_for_digits:ap,wait_for_audio:op,wait_for_dial:rp,wait_for_response:pp,split_by_airtime:Eu,terminal:{type:"terminal"}});function vp(t,e,i,o,n=20,s=10,r=5,a="top",l=0){const d=r;if("top"===a){const r=e+n,a=o-s;let c=`M ${t} ${e}`;if(t===i)c+=` L ${i} ${a}`;else{const o=i>t?1:-1,n=Math.max(e+d,Math.min(r,a-d)),s=Math.max(e+d,Math.min(n+l,a-d-3)),h=Math.min(d,s-e);h>=1?(c+=` L ${t} ${s-h}`,c+=` Q ${t} ${s}, ${t+o*h} ${s}`):c+=` L ${t} ${s}`;const u=3,p=Math.min(d,Math.max(0,a-s-u));p>=1?(c+=` L ${i-o*p} ${s}`,c+=` Q ${i} ${s}, ${i} ${s+p}`):c+=` L ${i} ${s}`,c+=` L ${i} ${a}`}return c+=` L ${i} ${o}`,c}if("left"===a||"right"===a){const r=e+(o<e?0:n),l="left"===a?-1:1,c=i+l*s,h=c>t?1:-1,u=3,p=h===l?r+2*d:Math.max(r+2*d,o);let m=`M ${t} ${e} L ${t} ${r}`;p-r>d&&(m+=` L ${t} ${p-d}`,m+=` Q ${t} ${p}, ${t+h*d} ${p}`);const g=Math.abs(p-o);if(g<1)m+=` L ${c} ${o}`,m+=` L ${i} ${o}`;else{const t=o<p?-1:1,e=Math.min(d,Math.max(0,Math.floor((g-u)/2)),Math.max(0,s-u));e>=1?(m+=` L ${c-h*e} ${p}`,m+=` Q ${c} ${p}, ${c} ${p+t*e}`,m+=` L ${c} ${o-t*e}`,m+=` Q ${c} ${o}, ${c-l*e} ${o}`):(m+=` L ${c} ${p}`,m+=` L ${c} ${o}`),m+=` L ${i} ${o}`}return m}return`M ${t} ${e} L ${i} ${o}`}class yp{constructor(t,e){this.connections=new Map,this.sources=new Map,this.pendingConnections=[],this.connectionWait=null,this.connectionListeners=new Map,this.dragState=null,this.retryCount=0,this.maxRetries=3,this.activityData=null,this.overlays=new Map,this.hoveredActivityKey=null,this.recentContactsPopup=null,this.recentContactsCache={},this.pendingFetches={},this.hideContactsTimeout=null,this.showContactsTimeout=null,this.connectionDragging=!1,this.canvas=t,this.editor=e}notifyListeners(t,e){(this.connectionListeners.get(t)||[]).forEach((t=>t(e)))}on(t,e){this.connectionListeners.has(t)||this.connectionListeners.set(t,[]),this.connectionListeners.get(t).push(e)}off(t,e){if(!this.connectionListeners.has(t))return;const i=this.connectionListeners.get(t),o=i.indexOf(e);-1!==o&&i.splice(o,1)}makeSource(t){const e=document.getElementById(t);if(!e)return;this.sources.has(t)&&this.sources.get(t)();let i=null;const o=o=>{if(0!==o.button)return;if(this.connections.has(t))return;const n=o.clientX,s=o.clientY,r=e.closest("temba-flow-node"),a=(null==r?void 0:r.getAttribute("uuid"))||"",l=e=>{const o=e.clientX-n,r=e.clientY-s;Math.sqrt(o*o+r*r)>5&&(document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",d),i=null,this.startDrag(t,a,null,e))},d=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",d),i=null};document.addEventListener("mousemove",l),document.addEventListener("mouseup",d),i={startX:n,startY:s,onMove:l,onUp:d}};e.addEventListener("mousedown",o),this.sources.set(t,(()=>{e.removeEventListener("mousedown",o),i&&(document.removeEventListener("mousemove",i.onMove),document.removeEventListener("mouseup",i.onUp),i=null)}))}makeTarget(t){}connectIds(t,e,i){this.pendingConnections.push({scope:t,fromId:e,toId:i}),this.processPendingConnections()}processPendingConnections(){this.connectionWait&&(cancelAnimationFrame(this.connectionWait),this.connectionWait=null),this.connectionWait=requestAnimationFrame((()=>{const t=[],e=new Set;if(this.pendingConnections.forEach((i=>{const{scope:o,fromId:n,toId:s}=i;this.removeConnectionSVG(n),this.createConnectionSVG(n,o,s)?e.add(s):t.push(i)})),this.pendingConnections=[],e.size>0){const t=new Set;this.connections.forEach((i=>{e.has(i.toId)&&t.add(i.scope)})),this.connections.forEach(((i,o)=>{(e.has(i.toId)||t.has(i.scope))&&this.updateConnectionSVG(o)}))}t.length>0&&this.retryCount<this.maxRetries?(this.retryCount++,this.pendingConnections=t,this.processPendingConnections()):this.retryCount=0}))}determineTargetFace(t,e,i,o){const n=i.left+i.width/2-o.left;return i.top-o.top-e>30?"top":t<n?"left":"right"}getConnectionEndpoints(t,e,i){const o=document.getElementById(t),n=document.getElementById(e);if(!o||!n)return null;const s=this.canvas.getBoundingClientRect(),r=o.getBoundingClientRect(),a=n.getBoundingClientRect();if(0===r.width||0===a.width)return null;const l=r.left+r.width/2-s.left,d=r.bottom-s.top,c=this.determineTargetFace(l,d,a,s),h=new Map;this.connections.forEach((t=>{if(t.toId===e){const e=document.getElementById(t.fromId);if(e){const i=e.getBoundingClientRect(),o=i.left+i.width/2-s.left,n=i.bottom-s.top,r=this.determineTargetFace(o,n,a,s);h.has(r)||h.set(r,[]);const l="top"===r?o:n;h.get(r).push({fromId:t.fromId,sortPos:l})}}})),h.has(c)||h.set(c,[]);const u=h.get(c);if(!u.find((e=>e.fromId===t))){const e="top"===c?l:d;u.push({fromId:t,sortPos:e})}u.sort(((t,e)=>t.sortPos-e.sortPos));const p=u.findIndex((e=>e.fromId===t)),m=u.length,g=a.left-s.left,f=a.top-s.top,v=a.width,y=a.height;let b,x;if("top"===c){b=1===m?g+v/2:g+.2*v+.6*v*(p+.5)/m,x=f}else if("left"===c){b=g;x=1===m?f+y/2:f+.2*y+.6*y*(p+.5)/m}else{b=g+v;x=1===m?f+y/2:f+.2*y+.6*y*(p+.5)/m}let _=0;if("top"===c&&i){const o=8,n=50,r=[];if(this.connections.forEach((t=>{if(t.scope===i&&t.toId!==e){const e=document.getElementById(t.fromId),i=document.getElementById(t.toId);if(e&&i){const o=e.getBoundingClientRect(),n=i.getBoundingClientRect(),a=o.left+o.width/2-s.left,l=o.bottom-s.top;if("top"===this.determineTargetFace(a,l,n,s)){const e=n.left-s.left,i=n.width;r.push({fromId:t.fromId,targetX:e+i/2})}}}})),r.length>0){r.push({fromId:t,targetX:b}),r.sort(((t,e)=>t.targetX-e.targetX));const e=r.findIndex((e=>e.fromId===t)),i=r.length;_=(e-(i-1)/2)*((i-1)*o>n?n/(i-1):o)}}return{sourceX:l,sourceY:d,targetX:b,targetY:x,targetFace:c,jogYOffset:_}}createSVGElement(){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.classList.add("plumb-connector"),t.style.position="absolute",t.style.left="0",t.style.top="0",t.style.width="100%",t.style.height="100%",t.style.pointerEvents="none",t.style.overflow="visible";const e=document.createElementNS("http://www.w3.org/2000/svg","path");e.setAttribute("fill","none"),e.setAttribute("stroke","var(--color-connectors)"),e.setAttribute("stroke-width","3"),e.style.pointerEvents="stroke";const i=document.createElementNS("http://www.w3.org/2000/svg","polygon");i.setAttribute("fill","var(--color-connectors)"),i.classList.add("plumb-arrow"),i.style.pointerEvents="fill",i.style.cursor="pointer",t.appendChild(e),t.appendChild(i);const o=()=>t.classList.add("hover"),n=()=>t.classList.remove("hover");return e.addEventListener("mouseenter",o),e.addEventListener("mouseleave",n),i.addEventListener("mouseenter",o),i.addEventListener("mouseleave",n),{svgEl:t,pathEl:e,arrowEl:i}}updateSVGPath(t,e,i,o,n,s,r="top",a=0){const l=6.5,d=13;let c=n,h=s;"top"===r?h=s-d:"left"===r?c=n-d:"right"===r&&(c=n+d);const u=vp(i,o,c,h,30,8,5,r,a);t.setAttribute("d",u),"top"===r?e.setAttribute("points",`${n},${s} ${n-l},${s-d} ${n+l},${s-d}`):"left"===r?e.setAttribute("points",`${n},${s} ${n-d},${s-l} ${n-d},${s+l}`):e.setAttribute("points",`${n},${s} ${n+d},${s-l} ${n+d},${s+l}`)}createConnectionSVG(t,e,i){const o=this.getConnectionEndpoints(t,i,e);if(!o)return!1;const{svgEl:n,pathEl:s,arrowEl:r}=this.createSVGElement();this.updateSVGPath(s,r,o.sourceX,o.sourceY,o.targetX,o.targetY,o.targetFace,o.jogYOffset),this.canvas.appendChild(n),this.connections.set(t,{scope:e,fromId:t,toId:i,svgEl:n,pathEl:s,arrowEl:r});r.addEventListener("mousedown",(o=>{if(0!==o.button)return;o.stopPropagation();const n=o.clientX,s=o.clientY,r=o=>{const l=o.clientX-n,d=o.clientY-s;Math.sqrt(l*l+d*d)>5&&(document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",a),this.startDrag(t,e,i,o))},a=()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",a)};document.addEventListener("mousemove",r),document.addEventListener("mouseup",a)}));const a=document.getElementById(t);if(a&&a.classList.add("connected"),this.activityData){const e=`${t}:${i}`,o=this.activityData.segments[e];if(o&&o>0){const i=this.createOverlayElement(o,e);this.canvas.appendChild(i),this.overlays.set(t,i),this.updateOverlayPosition(t)}}return!0}updateConnectionSVG(t){const e=this.connections.get(t);if(!e)return;const i=this.getConnectionEndpoints(e.fromId,e.toId,e.scope);i&&(this.updateSVGPath(e.pathEl,e.arrowEl,i.sourceX,i.sourceY,i.targetX,i.targetY,i.targetFace,i.jogYOffset),this.updateOverlayPosition(t))}removeConnectionSVG(t){const e=this.connections.get(t);if(!e)return;const i=this.overlays.get(t);i&&(i.remove(),this.overlays.delete(t)),e.svgEl.remove(),this.connections.delete(t)}repaintEverything(){this.connections.forEach(((t,e)=>{this.updateConnectionSVG(e)}))}revalidate(t){const e=[],i=new Set;this.connections.forEach(((o,n)=>{(t.includes(o.fromId)||t.includes(o.toId)||t.includes(o.scope))&&(e.push(n),i.add(o.toId))}));const o=new Set(e);this.connections.forEach(((t,e)=>{i.has(t.toId)&&o.add(e)})),o.forEach((t=>{this.updateConnectionSVG(t)}))}forgetNode(t){var e;const i=[];this.connections.forEach(((e,o)=>{e.scope!==t&&e.toId!==t||i.push(o)})),i.forEach((t=>this.removeConnectionSVG(t)));const o=null===(e=document.getElementById(t))||void 0===e?void 0:e.querySelectorAll(".exit");o&&o.forEach((t=>{const e=t.id;this.sources.has(e)&&(this.sources.get(e)(),this.sources.delete(e))}))}removeNodeConnections(t,e){var i;(e||Array.from((null===(i=document.getElementById(t))||void 0===i?void 0:i.querySelectorAll(".exit"))||[]).map((t=>t.id))).forEach((t=>this.removeConnectionSVG(t)))}removeExitConnection(t){return!!this.connections.has(t)&&(this.removeConnectionSVG(t),!0)}removeAllEndpoints(t){var e;const i=null===(e=document.getElementById(t))||void 0===e?void 0:e.querySelectorAll(".exit");i&&i.forEach((t=>{const e=t.id;this.sources.has(e)&&(this.sources.get(e)(),this.sources.delete(e))}))}setConnectionRemovingState(t,e){const i=this.connections.get(t);return!!i&&(e?i.svgEl.classList.add("removing"):i.svgEl.classList.remove("removing"),!0)}setActivityData(t){this.activityData=t,this.clearRecentContactsCache(),this.updateActivityOverlays()}updateActivityOverlays(){if(!this.activityData)return this.overlays.forEach((t=>t.remove())),void this.overlays.clear();const t=new Set;this.connections.forEach(((e,i)=>{const o=`${e.fromId}:${e.toId}`,n=this.activityData.segments[o];if(n&&n>0){t.add(i);let e=this.overlays.get(i);e?(e.textContent=n.toLocaleString(),e.setAttribute("data-activity-key",o)):(e=this.createOverlayElement(n,o),this.canvas.appendChild(e),this.overlays.set(i,e)),this.updateOverlayPosition(i)}})),this.overlays.forEach(((e,i)=>{t.has(i)||(e.remove(),this.overlays.delete(i))}))}createOverlayElement(t,e){const i=document.createElement("div");return i.className="activity-overlay",i.textContent=t.toLocaleString(),i.setAttribute("data-activity-key",e),i.addEventListener("mouseenter",(()=>{const t=this.getFlowUuid();t&&(this.fetchRecentContacts(e,t),this.showContactsTimeout=window.setTimeout((()=>{this.showRecentContacts(e,t)}),500))})),i.addEventListener("mouseleave",(()=>{this.showContactsTimeout&&(clearTimeout(this.showContactsTimeout),this.showContactsTimeout=null),this.hoveredActivityKey=null,this.hideRecentContacts()})),i}updateOverlayPosition(t){const e=this.overlays.get(t),i=this.connections.get(t);if(!e||!i)return;const o=this.getConnectionEndpoints(i.fromId,i.toId,i.scope);o&&(e.style.position="absolute",e.style.left=`${o.sourceX}px`,e.style.top=`${o.sourceY+15}px`,e.style.transform="translate(-50%, -50%)")}getFlowUuid(){var t,e;return(null===(e=null===(t=this.editor)||void 0===t?void 0:t.definition)||void 0===e?void 0:e.uuid)||null}async fetchRecentContacts(t,e){if(this.recentContactsCache[t]||this.pendingFetches[t])return;const i=new AbortController;this.pendingFetches[t]=i;try{const[o,n]=t.split(":"),s=`/flow/recent_contacts/${e}/${o}/${n}/`,r=await fetch(s,{signal:i.signal});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const a=await r.json();this.recentContactsCache[t]=Array.isArray(a)?a:a.results||[]}catch(t){"AbortError"!==t.name&&console.error("Failed to fetch recent contacts:",t)}finally{delete this.pendingFetches[t]}}async showRecentContacts(t,e){const i=this.findOverlayForActivityKey(t);i&&(this.hideContactsTimeout&&(clearTimeout(this.hideContactsTimeout),this.hideContactsTimeout=null),this.hoveredActivityKey=t,this.recentContactsPopup||(this.recentContactsPopup=document.createElement("div"),this.recentContactsPopup.className="recent-contacts-popup",this.recentContactsPopup.style.position="absolute",this.recentContactsPopup.style.zIndex="1015",this.recentContactsPopup.style.display="none",document.body.appendChild(this.recentContactsPopup),this.recentContactsPopup.onmouseenter=()=>{this.hideContactsTimeout&&(clearTimeout(this.hideContactsTimeout),this.hideContactsTimeout=null)},this.recentContactsPopup.onmouseleave=()=>{this.hoveredActivityKey=null,this.hideRecentContacts()},this.recentContactsPopup.onclick=t=>{const e=t.target;if(e.classList.contains("contact-name")){this.hideRecentContacts(!1);const t=e.getAttribute("data-uuid");t&&this.editor.fireCustomEvent("temba-contact-clicked",{uuid:t})}}),this.recentContactsCache[t]?(this.renderRecentContactsPopup(this.recentContactsCache[t]),this.positionPopup(i)):(this.recentContactsPopup.innerHTML='<div class="no-contacts-message">Loading...</div>',this.positionPopup(i),await this.fetchRecentContacts(t,e),this.hoveredActivityKey===t&&(this.renderRecentContactsPopup(this.recentContactsCache[t]||[]),this.positionPopup(i))))}findOverlayForActivityKey(t){for(const[,e]of this.overlays)if(e.getAttribute("data-activity-key")===t)return e;return null}positionPopup(t){if(!this.recentContactsPopup)return;const e=t.getBoundingClientRect();this.recentContactsPopup.style.left=`${e.left+window.scrollX}px`,this.recentContactsPopup.style.top=`${e.bottom+window.scrollY+5}px`,this.recentContactsPopup.style.display="",this.recentContactsPopup.classList.remove("show"),this.recentContactsPopup.offsetWidth,this.recentContactsPopup.classList.add("show")}renderRecentContactsPopup(t){if(!this.recentContactsPopup)return;if(0===t.length)return void(this.recentContactsPopup.innerHTML='<div class="no-contacts-message">No Recent Contacts</div>');let e='<div class="popup-title">Recent Contacts</div>';t.forEach((t=>{if(e+='<div class="contact-row">',e+=`<div class="contact-name" data-uuid="${t.contact.uuid}">${t.contact.name}</div>`,t.operand&&(e+=`<div class="contact-operand">${t.operand}</div>`),t.time){const i=new Date(t.time),o=Date.now()-i.getTime(),n=Math.floor(o/6e4),s=Math.floor(o/36e5),r=Math.floor(o/864e5);let a="";a=n<1?"just now":n<60?`${n}m ago`:s<24?`${s}h ago`:`${r}d ago`,e+=`<div class="contact-time">${a}</div>`}e+="</div>"})),this.recentContactsPopup.innerHTML=e}hideRecentContacts(t=!0){t?this.hideContactsTimeout=window.setTimeout((()=>{!this.hoveredActivityKey&&this.recentContactsPopup&&(this.recentContactsPopup.classList.remove("show"),this.recentContactsPopup.style.display="none",this.hoveredActivityKey=null)}),200):this.recentContactsPopup&&(this.recentContactsPopup.classList.remove("show"),this.recentContactsPopup.style.display="none",this.hoveredActivityKey=null)}clearRecentContactsCache(){this.recentContactsCache={},Object.values(this.pendingFetches).forEach((t=>t.abort())),this.pendingFetches={}}startDrag(t,e,i,o){this.removeConnectionSVG(t);const{svgEl:n,pathEl:s,arrowEl:r}=this.createSVGElement();n.classList.add("dragging"),s.style.pointerEvents="none",r.style.pointerEvents="none",this.canvas.appendChild(n);const a=document.getElementById(t);if(!a)return void n.remove();const l=this.canvas.getBoundingClientRect(),d=a.getBoundingClientRect(),c=d.left+d.width/2-l.left,h=d.bottom-l.top,u=6.5,p=(t,e)=>{const i=e<h;let o,n="top";i&&(n=t<c?"left":"right"),o=i?e+1+13:e-1;const a=vp(c,h,t,o,30,i?0:8,5,n);if(s.setAttribute("d",a),i){const i=e+1;r.setAttribute("points",`${t},${i} ${t-u},${o} ${t+u},${o}`)}else{const e=o+13;r.setAttribute("points",`${t},${e} ${t-u},${o} ${t+u},${o}`)}},m=o.clientX-l.left,g=o.clientY-l.top;p(m,g),this.connectionDragging=!0;const f=t=>{const e=t.clientX-l.left,i=t.clientY-l.top;p(e,i)},v=o=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",v),n.remove(),this.connectionDragging=!1,this.dragState=null,this.notifyListeners("connection:abort",{source:a,sourceId:t,target:{id:i},data:{nodeId:e}})};document.addEventListener("mousemove",f),document.addEventListener("mouseup",v),this.dragState={sourceId:t,scope:e,originalTargetId:i,svgEl:n,pathEl:s,arrowEl:r,onMove:f,onUp:v},this.notifyListeners("connection:drag",{sourceId:t,sourceX:c,sourceY:h,data:{nodeId:e},target:{id:i}})}reset(){this.connectionWait&&(cancelAnimationFrame(this.connectionWait),this.connectionWait=null),this.pendingConnections=[],this.connections.forEach((t=>t.svgEl.remove())),this.connections.clear(),this.overlays.forEach((t=>t.remove())),this.overlays.clear(),this.hideRecentContacts(!1),this.recentContactsPopup&&(this.recentContactsPopup.remove(),this.recentContactsPopup=null),this.recentContactsCache={},Object.values(this.pendingFetches).forEach((t=>t.abort())),this.pendingFetches={},this.sources.forEach((t=>t())),this.sources.clear(),this.dragState&&(document.removeEventListener("mousemove",this.dragState.onMove),document.removeEventListener("mouseup",this.dragState.onUp),this.dragState.svgEl.remove(),this.dragState=null,this.connectionDragging=!1)}}class bp extends Ne{createRenderRoot(){return this}static get styles(){return a`
8546
8547
 
8547
8548
  .node {
8548
8549
  background-color: #fff;
@@ -8622,7 +8623,7 @@ background: #ccc;
8622
8623
  z-index: 10;
8623
8624
  transition: all 100ms ease-in-out;
8624
8625
  align-self: center;
8625
- margin-right:0.15em;
8626
+ margin-right: 0.3em;
8626
8627
  border: 0px solid red;
8627
8628
  width: 1em;
8628
8629
  pointer-events: auto; /* Ensure remove button can receive events */
@@ -9063,7 +9064,14 @@ background: #ccc;
9063
9064
  <temba-icon name="add"></temba-icon>
9064
9065
  </div>`}
9065
9066
  </div>
9066
- `}}t([mt({type:Object})],yp.prototype,"plumber",void 0),t([mt({type:Object})],yp.prototype,"node",void 0),t([mt({type:Object})],yp.prototype,"ui",void 0),t([kd(_d,(t=>t.isTranslating))],yp.prototype,"isTranslating",void 0),t([kd(_d,(t=>t.languageCode))],yp.prototype,"languageCode",void 0),t([kd(_d,(t=>t.viewingRevision))],yp.prototype,"viewingRevision",void 0),t([kd(_d,(t=>t.flowDefinition))],yp.prototype,"flowDefinition",void 0),t([kd(_d,(t=>{var e,i,o;return(null===(o=null===(i=null===(e=t.flowDefinition)||void 0===e?void 0:e._ui)||void 0===i?void 0:i.translation_filters)||void 0===o?void 0:o.categories)||!1}))],yp.prototype,"includeCategoriesInTranslation",void 0),t([kd(_d,(t=>t.getCurrentActivity()))],yp.prototype,"activity",void 0),t([kd(_d,(t=>t.issuesByNode))],yp.prototype,"issuesByNode",void 0),t([kd(_d,(t=>t.issuesByAction))],yp.prototype,"issuesByAction",void 0);class xp extends Ne{createRenderRoot(){return this}get dragging(){return this.isDragging}getAvailableLanguages(){var t,e,i;if((null===(t=this.workspace)||void 0===t?void 0:t.languages)&&this.workspace.languages.length>0){const t=new Intl.DisplayNames(["en"],{type:"language"});return this.workspace.languages.map((e=>{try{const i=t.of(e);return i?{code:e,name:i}:{code:e,name:e}}catch(t){return{code:e,name:e}}})).filter((t=>t.code&&t.name))}return(null===(i=null===(e=this.definition)||void 0===e?void 0:e._ui)||void 0===i?void 0:i.languages)&&this.definition._ui.languages.length>0?this.definition._ui.languages.map((t=>({code:"string"==typeof t?t:t.iso||t.code,name:"string"==typeof t?t:t.name}))):[]}static get styles(){return a`
9067
+ `}}t([mt({type:Object})],bp.prototype,"plumber",void 0),t([mt({type:Object})],bp.prototype,"node",void 0),t([mt({type:Object})],bp.prototype,"ui",void 0),t([kd(_d,(t=>t.isTranslating))],bp.prototype,"isTranslating",void 0),t([kd(_d,(t=>t.languageCode))],bp.prototype,"languageCode",void 0),t([kd(_d,(t=>t.viewingRevision))],bp.prototype,"viewingRevision",void 0),t([kd(_d,(t=>t.flowDefinition))],bp.prototype,"flowDefinition",void 0),t([kd(_d,(t=>{var e,i,o;return(null===(o=null===(i=null===(e=t.flowDefinition)||void 0===e?void 0:e._ui)||void 0===i?void 0:i.translation_filters)||void 0===o?void 0:o.categories)||!1}))],bp.prototype,"includeCategoriesInTranslation",void 0),t([kd(_d,(t=>t.getCurrentActivity()))],bp.prototype,"activity",void 0),t([kd(_d,(t=>t.issuesByNode))],bp.prototype,"issuesByNode",void 0),t([kd(_d,(t=>t.issuesByAction))],bp.prototype,"issuesByAction",void 0);class xp extends Ne{createRenderRoot(){return this}get dragging(){return this.isDragging}getAvailableLanguages(){var t,e,i;if((null===(t=this.workspace)||void 0===t?void 0:t.languages)&&this.workspace.languages.length>0){const t=new Intl.DisplayNames(["en"],{type:"language"});return this.workspace.languages.map((e=>{try{const i=t.of(e);return i?{code:e,name:i}:{code:e,name:e}}catch(t){return{code:e,name:e}}})).filter((t=>t.code&&t.name))}return(null===(i=null===(e=this.definition)||void 0===e?void 0:e._ui)||void 0===i?void 0:i.languages)&&this.definition._ui.languages.length>0?this.definition._ui.languages.map((t=>({code:"string"==typeof t?t:t.iso||t.code,name:"string"==typeof t?t:t.name}))):[]}static get styles(){return a`
9068
+ #editor-container {
9069
+ position: relative;
9070
+ flex: 1;
9071
+ display: flex;
9072
+ min-height: 0;
9073
+ }
9074
+
9067
9075
  #editor {
9068
9076
  overflow: scroll;
9069
9077
  flex: 1;
@@ -9542,7 +9550,72 @@ background: #ccc;
9542
9550
  color: tomato;
9543
9551
  flex-shrink: 0;
9544
9552
  }
9545
- `}constructor(){super(),this.saveTimer=null,this.flowType="message",this.features=[],this.activityTimer=null,this.activityInterval=100,this.isDragging=!1,this.isMouseDown=!1,this.dragStartPos={x:0,y:0},this.currentDragItem=null,this.startPos={left:0,top:0},this.selectedItems=new Set,this.isSelecting=!1,this.selectionBox=null,this.targetId=null,this.sourceId=null,this.dragFromNodeId=null,this.originalConnectionTargetId=null,this.isValidTarget=!0,this.connectionSourceX=null,this.connectionSourceY=null,this.issuesWindowHidden=!0,this.localizationWindowHidden=!0,this.translationFilters={categories:!1},this.translationSettingsExpanded=!1,this.autoTranslateDialogOpen=!1,this.autoTranslating=!1,this.autoTranslateModel=null,this.autoTranslateError=null,this.revisionsWindowHidden=!0,this.revisions=[],this.viewingRevision=null,this.isLoadingRevisions=!1,this.preRevertState=null,this.translationCache=new Map,this.editingNode=null,this.editingNodeUI=null,this.editingAction=null,this.dialogOrigin=null,this.isCreatingNewNode=!1,this.pendingNodePosition=null,this.canvasDropPreview=null,this.addActionToNodeUuid=null,this.actionDragTargetNodeUuid=null,this.previousActionDragTargetNodeUuid=null,this.connectionPlaceholder=null,this.pendingCanvasConnection=null,this.canvasMouseDown=!1,this.boundMouseMove=this.handleMouseMove.bind(this),this.boundMouseUp=this.handleMouseUp.bind(this),this.boundGlobalMouseDown=this.handleGlobalMouseDown.bind(this),this.boundKeyDown=this.handleKeyDown.bind(this),this.boundCanvasContextMenu=this.handleCanvasContextMenu.bind(this)}firstUpdated(t){super.firstUpdated(t),this.plumber=new bp(this.querySelector("#canvas"),this),this.setupGlobalEventListeners(),t.has("flow")&&Sd().getState().fetchRevision(`/flow/revisions/${this.flow}`),this.plumber.on("connection:drag",(t=>{this.dragFromNodeId=t.data.nodeId,this.sourceId=t.sourceId,this.connectionSourceX=t.sourceX,this.connectionSourceY=t.sourceY,this.originalConnectionTargetId=t.target.id})),this.plumber.on("connection:abort",(t=>{this.makeConnection(t)})),this.plumber.on("connection:detach",(t=>{this.makeConnection(t)}))}makeConnection(t){if(this.sourceId&&this.targetId&&this.isValidTarget)t.target.id===this.targetId?this.plumber.connectIds(this.dragFromNodeId,this.sourceId,this.targetId):Sd().getState().updateConnection(this.dragFromNodeId,this.sourceId,this.targetId);else if(this.connectionPlaceholder&&this.connectionPlaceholder.visible&&this.sourceId){const t={left:Lh(this.connectionPlaceholder.position.left),top:Lh(this.connectionPlaceholder.position.top)},e=!!this.connectionPlaceholder.dragUp;this.connectionPlaceholder.position=t,this.pendingCanvasConnection={fromNodeId:this.dragFromNodeId,exitId:this.sourceId,position:t};const i=this.querySelector("#canvas");if(i){const o=i.getBoundingClientRect(),n=o.left+t.left-40,s=e?o.top+t.top+74:o.top+t.top+80,r=this.querySelector("temba-canvas-menu");r&&r.show(n,s,{x:t.left,y:t.top},!1)}return void this.requestUpdate()}document.querySelectorAll("temba-flow-node").forEach((t=>{t.classList.remove("connection-target-valid","connection-target-invalid")})),this.pendingCanvasConnection||(this.sourceId=null,this.connectionSourceX=null,this.connectionSourceY=null,this.dragFromNodeId=null),this.targetId=null,this.isValidTarget=!0}updated(t){var e,i,o,n;if(super.updated(t),t.has("canvasSize"),t.has("definition")){this.updateCanvasSize(),(null===(e=this.definition)||void 0===e?void 0:e.type)&&(this.flowType=this.getFlowTypeFromDefinition(this.definition.type));const t={categories:!!((null===(o=null===(i=this.definition)||void 0===i?void 0:i._ui)||void 0===o?void 0:o.translation_filters)||{categories:!1}).categories};this.translationFilters.categories!==t.categories&&(this.translationFilters=t),this.translationCache.clear(),(null===(n=this.definition)||void 0===n?void 0:n.uuid)&&this.startActivityFetching()}t.has("simulatorActive")&&(this.simulatorActive?this.stopActivityFetching():(this.activityInterval=100,this.startActivityFetching())),t.has("activityData")&&this.plumber&&this.plumber.setActivityData(this.activityData),t.has("dirtyDate")&&this.dirtyDate&&this.debouncedSave(),t.has("languageCode")&&this.translationCache.clear()}getFlowTypeFromDefinition(t){return"voice"===t?"voice":"messaging_background"===t||"messaging_offline"===t?"background":"message"}debouncedSave(){null!==this.saveTimer&&clearTimeout(this.saveTimer),this.saveTimer=window.setTimeout((()=>{(new Date).getTime()-this.dirtyDate.getTime()>=500?(this.saveChanges(),this.saveTimer=null):this.debouncedSave()}),500)}saveChanges(t){const e=t||this.definition;return Sd().postJSON(`/flow/revisions/${this.flow}/`,e).then((t=>{var e;if(t.json){const i=Sd().getState();t.json.info&&i.setFlowInfo(t.json.info),void 0!==(null===(e=t.json.revision)||void 0===e?void 0:e.revision)&&i.setRevision(t.json.revision.revision),this.revisionsWindowHidden||this.fetchRevisions()}})).catch((t=>{console.error("Failed to save flow:",t)}))}startActivityFetching(){this.simulatorActive||this.fetchActivityData()}stopActivityFetching(){null!==this.activityTimer&&(clearTimeout(this.activityTimer),this.activityTimer=null)}fetchActivityData(){var t;if(!(null===(t=this.definition)||void 0===t?void 0:t.uuid))return;if(this.simulatorActive)return;const e=`/flow/activity/${this.definition.uuid}/`,i=Sd();if(!i)return;i.getState().fetchActivity(e).then((()=>{this.activityInterval=Math.min(3e5,this.activityInterval+100),null!==this.activityTimer&&clearTimeout(this.activityTimer),this.activityTimer=window.setTimeout((()=>{this.fetchActivityData()}),this.activityInterval)}))}handleLanguageChange(t){_d.getState().setLanguageCode(t)}disconnectedCallback(){super.disconnectedCallback(),null!==this.saveTimer&&(clearTimeout(this.saveTimer),this.saveTimer=null),null!==this.activityTimer&&(clearTimeout(this.activityTimer),this.activityTimer=null),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("mouseup",this.boundMouseUp),document.removeEventListener("mousedown",this.boundGlobalMouseDown),document.removeEventListener("keydown",this.boundKeyDown);const t=this.querySelector("#canvas");t&&t.removeEventListener("contextmenu",this.boundCanvasContextMenu)}setupGlobalEventListeners(){document.addEventListener("mousemove",this.boundMouseMove),document.addEventListener("mouseup",this.boundMouseUp),document.addEventListener("mousedown",this.boundGlobalMouseDown),document.addEventListener("keydown",this.boundKeyDown);const t=this.querySelector("#canvas");t&&t.addEventListener("contextmenu",this.boundCanvasContextMenu),this.addEventListener(Mo.ActionEditRequested,this.handleActionEditRequested.bind(this)),this.addEventListener(Mo.AddActionRequested,this.handleAddActionRequested.bind(this)),this.addEventListener(Mo.NodeEditRequested,this.handleNodeEditRequested.bind(this)),this.addEventListener(Mo.NodeDeleted,this.handleNodeDeleted.bind(this)),this.addEventListener(Mo.Selection,(t=>{const e=t.target;"TEMBA-CANVAS-MENU"===e.tagName?this.handleCanvasMenuSelection(t):"TEMBA-NODE-TYPE-SELECTOR"===e.tagName&&this.handleNodeTypeSelection(t)})),this.addEventListener(Mo.Canceled,(t=>{const e=t.target;"TEMBA-CANVAS-MENU"===e.tagName?this.handleCanvasMenuClosed():"TEMBA-NODE-TYPE-SELECTOR"===e.tagName&&this.handleNodeTypeSelectorClosed()})),this.addEventListener(Mo.DragExternal,this.handleActionDragExternal.bind(this)),this.addEventListener(Mo.DragInternal,this.handleActionDragInternal.bind(this)),this.addEventListener(Mo.DragStop,(t=>{t.detail.isExternal&&this.handleActionDropExternal(t)}))}getPosition(t,e){var i,o,n;return"node"===e?null===(i=this.definition._ui.nodes[t])||void 0===i?void 0:i.position:null===(n=null===(o=this.definition._ui.stickies)||void 0===o?void 0:o[t])||void 0===n?void 0:n.position}handleMouseDown(t){if(0!==t.button)return;if(this.isReadOnly())return;this.blurActiveContentEditable();const e=t.currentTarget,i=t.target;if(i.classList.contains("exit")||i.closest(".exit"))return;const o=e.getAttribute("uuid"),n="TEMBA-FLOW-NODE"===e.tagName?"node":"sticky",s=this.getPosition(o,n);s&&(this.selectedItems.has(o)||t.ctrlKey||t.metaKey?this.selectedItems.has(o)||this.selectedItems.add(o):this.selectedItems.clear(),this.isMouseDown=!0,this.dragStartPos={x:t.clientX,y:t.clientY},this.startPos={left:s.left,top:s.top},this.currentDragItem={uuid:o,position:s,element:e,type:n},t.preventDefault(),t.stopPropagation())}handleGlobalMouseDown(t){var e;if(0!==t.button)return;const i=null===(e=this.querySelector("#grid"))||void 0===e?void 0:e.getBoundingClientRect();if(!i)return;if(!(t.clientX>=i.left&&t.clientX<=i.right&&t.clientY>=i.top&&t.clientY<=i.bottom))return;t.target.closest(".draggable")||this.handleCanvasMouseDown(t)}blurActiveContentEditable(){var t;let e=document.activeElement;for(;null===(t=null==e?void 0:e.shadowRoot)||void 0===t?void 0:t.activeElement;)e=e.shadowRoot.activeElement;e instanceof HTMLElement&&"true"===e.getAttribute("contenteditable")&&e.blur()}handleCanvasMouseDown(t){var e;if(this.isReadOnly())return;this.blurActiveContentEditable();const i=t.target;if("canvas"===i.id||"grid"===i.id){this.canvasMouseDown=!0,this.dragStartPos={x:t.clientX,y:t.clientY};const i=null===(e=this.querySelector("#canvas"))||void 0===e?void 0:e.getBoundingClientRect();if(i){this.selectedItems.clear();const e=t.clientX-i.left,o=t.clientY-i.top;this.selectionBox={startX:e,startY:o,endX:e,endY:o}}t.preventDefault()}}handleKeyDown(t){"Delete"!==t.key&&"Backspace"!==t.key||this.selectedItems.size>0&&this.showDeleteConfirmation(),"Escape"===t.key&&(this.selectedItems.clear(),this.requestUpdate())}showDeleteConfirmation(){const t=this.selectedItems.size,e=1===t?"item":"items",i=document.createElement("temba-dialog");i.header="Delete Items",i.primaryButtonName="Delete",i.cancelButtonName="Cancel",i.destructive=!0,i.innerHTML=`<div style="padding: 20px;">Are you sure you want to delete ${t} ${e}?</div>`,i.addEventListener("temba-button-clicked",(t=>{"Delete"===t.detail.button.name&&(this.deleteSelectedItems(),i.open=!1)})),document.body.appendChild(i),i.open=!0,i.addEventListener("temba-dialog-hidden",(()=>{document.body.removeChild(i)}))}deleteNodes(t){t.length>0&&Sd().getState().removeNodes(t)}deleteSelectedItems(){const t=Array.from(this.selectedItems).filter((t=>this.definition.nodes.some((e=>e.uuid===t))));this.deleteNodes(Array.from(t));const e=Array.from(this.selectedItems).filter((t=>{var e,i;return null===(i=null===(e=this.definition._ui)||void 0===e?void 0:e.stickies)||void 0===i?void 0:i[t]}));Sd().getState().removeStickyNotes(e),this.selectedItems.clear()}updateSelectionBox(t){var e;if(!this.selectionBox||!this.canvasMouseDown)return;const i=null===(e=this.querySelector("#canvas"))||void 0===e?void 0:e.getBoundingClientRect();if(!i)return;const o=t.clientX-i.left,n=t.clientY-i.top;this.selectionBox={...this.selectionBox,endX:o,endY:n},this.updateSelectedItemsFromBox()}updateSelectedItemsFromBox(){var t,e,i;if(!this.selectionBox)return;const o=new Set,n=Math.min(this.selectionBox.startX,this.selectionBox.endX),s=Math.min(this.selectionBox.startY,this.selectionBox.endY),r=Math.max(this.selectionBox.startX,this.selectionBox.endX),a=Math.max(this.selectionBox.startY,this.selectionBox.endY);null===(t=this.definition)||void 0===t||t.nodes.forEach((t=>{var e,i,l;const d=this.querySelector(`[id="${t.uuid}"]`);if(d){const c=null===(i=null===(e=this.definition._ui)||void 0===e?void 0:e.nodes[t.uuid])||void 0===i?void 0:i.position;if(c){const e=d.getBoundingClientRect();if(null===(l=this.querySelector("#canvas"))||void 0===l?void 0:l.getBoundingClientRect()){const i=c.left,l=c.top,d=i+e.width,h=l+e.height;n<d&&r>i&&s<h&&a>l&&o.add(t.uuid)}}}}));const l=(null===(i=null===(e=this.definition)||void 0===e?void 0:e._ui)||void 0===i?void 0:i.stickies)||{};Object.entries(l).forEach((([t,e])=>{if(e.position){const i=this.querySelector(`temba-sticky-note[uuid="${t}"]`);if(i){const l=i.clientWidth,d=i.clientHeight,c=e.position.left,h=e.position.top;n<c+l&&r>c&&s<h+d&&a>h&&o.add(t)}}})),this.selectedItems=o}renderSelectionBox(){if(!this.selectionBox||!this.isSelecting)return"";const t=Math.min(this.selectionBox.startX,this.selectionBox.endX),e=Math.min(this.selectionBox.startY,this.selectionBox.endY),i=Math.abs(this.selectionBox.endX-this.selectionBox.startX),o=Math.abs(this.selectionBox.endY-this.selectionBox.startY);return H`<div
9553
+
9554
+ .empty-flow {
9555
+ position: sticky;
9556
+ top: 80px;
9557
+ left: 0;
9558
+ right: 0;
9559
+ height: 0;
9560
+ display: flex;
9561
+ justify-content: center;
9562
+ pointer-events: none;
9563
+ z-index: 50;
9564
+ }
9565
+
9566
+ .empty-flow-content {
9567
+ display: flex;
9568
+ flex-direction: column;
9569
+ align-items: center;
9570
+ gap: 16px;
9571
+ text-align: center;
9572
+ pointer-events: auto;
9573
+ }
9574
+
9575
+ .empty-flow-title {
9576
+ font-size: 18px;
9577
+ font-weight: 600;
9578
+ color: #374151;
9579
+ }
9580
+
9581
+ .empty-flow-description {
9582
+ font-size: 14px;
9583
+ color: #6b7280;
9584
+ max-width: 320px;
9585
+ line-height: 1.5;
9586
+ }
9587
+
9588
+ .empty-flow-button {
9589
+ background: var(--color-primary-dark);
9590
+ border: none;
9591
+ color: #fff;
9592
+ padding: 10px 20px;
9593
+ border-radius: var(--curvature);
9594
+ font-size: 14px;
9595
+ font-weight: 600;
9596
+ cursor: pointer;
9597
+ transition: opacity 0.2s ease;
9598
+ }
9599
+
9600
+ .empty-flow-button:hover {
9601
+ opacity: 0.9;
9602
+ }
9603
+
9604
+ .save-indicator {
9605
+ position: absolute;
9606
+ top: 8px;
9607
+ right: 16px;
9608
+ padding: 6px 10px;
9609
+ z-index: 10000;
9610
+ pointer-events: none;
9611
+ opacity: 0;
9612
+ transition: opacity 0.15s ease-in-out;
9613
+ }
9614
+
9615
+ .save-indicator.visible {
9616
+ opacity: 1;
9617
+ }
9618
+ `}constructor(){super(),this.saveTimer=null,this.flowType="message",this.features=[],this.activityTimer=null,this.activityInterval=100,this.isDragging=!1,this.isMouseDown=!1,this.dragStartPos={x:0,y:0},this.currentDragItem=null,this.startPos={left:0,top:0},this.selectedItems=new Set,this.isSelecting=!1,this.selectionBox=null,this.targetId=null,this.sourceId=null,this.dragFromNodeId=null,this.originalConnectionTargetId=null,this.isValidTarget=!0,this.connectionSourceX=null,this.connectionSourceY=null,this.issuesWindowHidden=!0,this.localizationWindowHidden=!0,this.translationFilters={categories:!1},this.translationSettingsExpanded=!1,this.autoTranslateDialogOpen=!1,this.autoTranslating=!1,this.autoTranslateModel=null,this.autoTranslateError=null,this.revisionsWindowHidden=!0,this.revisions=[],this.viewingRevision=null,this.isLoadingRevisions=!1,this.isSaving=!1,this.saveError=null,this.preRevertState=null,this.translationCache=new Map,this.editingNode=null,this.editingNodeUI=null,this.editingAction=null,this.dialogOrigin=null,this.isCreatingNewNode=!1,this.pendingNodePosition=null,this.canvasDropPreview=null,this.addActionToNodeUuid=null,this.actionDragTargetNodeUuid=null,this.previousActionDragTargetNodeUuid=null,this.connectionPlaceholder=null,this.pendingCanvasConnection=null,this.canvasMouseDown=!1,this.boundMouseMove=this.handleMouseMove.bind(this),this.boundMouseUp=this.handleMouseUp.bind(this),this.boundGlobalMouseDown=this.handleGlobalMouseDown.bind(this),this.boundKeyDown=this.handleKeyDown.bind(this),this.boundCanvasContextMenu=this.handleCanvasContextMenu.bind(this)}firstUpdated(t){super.firstUpdated(t),this.plumber=new yp(this.querySelector("#canvas"),this),this.setupGlobalEventListeners(),t.has("flow")&&(Sd().getState().fetchRevision(`/flow/revisions/${this.flow}`),this.fetchRevisions()),this.plumber.on("connection:drag",(t=>{this.dragFromNodeId=t.data.nodeId,this.sourceId=t.sourceId,this.connectionSourceX=t.sourceX,this.connectionSourceY=t.sourceY,this.originalConnectionTargetId=t.target.id})),this.plumber.on("connection:abort",(t=>{this.makeConnection(t)})),this.plumber.on("connection:detach",(t=>{this.makeConnection(t)}))}makeConnection(t){if(this.sourceId&&this.targetId&&this.isValidTarget)t.target.id===this.targetId?this.plumber.connectIds(this.dragFromNodeId,this.sourceId,this.targetId):Sd().getState().updateConnection(this.dragFromNodeId,this.sourceId,this.targetId);else if(this.connectionPlaceholder&&this.connectionPlaceholder.visible&&this.sourceId){const t={left:Lh(this.connectionPlaceholder.position.left),top:Lh(this.connectionPlaceholder.position.top)},e=!!this.connectionPlaceholder.dragUp;this.connectionPlaceholder.position=t,this.pendingCanvasConnection={fromNodeId:this.dragFromNodeId,exitId:this.sourceId,position:t};const i=this.querySelector("#canvas");if(i){const o=i.getBoundingClientRect(),n=o.left+t.left-40,s=e?o.top+t.top+74:o.top+t.top+80,r=this.querySelector("temba-canvas-menu");r&&r.show(n,s,{x:t.left,y:t.top},!1)}return void this.requestUpdate()}document.querySelectorAll("temba-flow-node").forEach((t=>{t.classList.remove("connection-target-valid","connection-target-invalid")})),this.pendingCanvasConnection||(this.sourceId=null,this.connectionSourceX=null,this.connectionSourceY=null,this.dragFromNodeId=null),this.targetId=null,this.isValidTarget=!0}updated(t){var e,i,o,n;if(super.updated(t),t.has("canvasSize"),t.has("definition")){this.updateCanvasSize(),(null===(e=this.definition)||void 0===e?void 0:e.type)&&(this.flowType=this.getFlowTypeFromDefinition(this.definition.type));const t={categories:!!((null===(o=null===(i=this.definition)||void 0===i?void 0:i._ui)||void 0===o?void 0:o.translation_filters)||{categories:!1}).categories};this.translationFilters.categories!==t.categories&&(this.translationFilters=t),this.translationCache.clear(),(null===(n=this.definition)||void 0===n?void 0:n.uuid)&&this.startActivityFetching()}t.has("simulatorActive")&&(this.simulatorActive?this.stopActivityFetching():(this.activityInterval=100,this.startActivityFetching())),t.has("activityData")&&this.plumber&&this.plumber.setActivityData(this.activityData),t.has("dirtyDate")&&this.dirtyDate&&(this.isSaving=!0,this.debouncedSave()),t.has("saveError")&&this.saveError&&(this.showSaveErrorDialog(this.saveError),this.saveError=null),t.has("languageCode")&&this.translationCache.clear()}getFlowTypeFromDefinition(t){return"voice"===t?"voice":"messaging_background"===t||"messaging_offline"===t?"background":"message"}debouncedSave(){null!==this.saveTimer&&clearTimeout(this.saveTimer),this.saveTimer=window.setTimeout((()=>{(new Date).getTime()-this.dirtyDate.getTime()>=2e3?(this.saveChanges(),this.saveTimer=null):this.debouncedSave()}),2e3)}saveChanges(t){const e=t||this.definition;return this.isSaving=!0,Sd().postJSON(`/flow/revisions/${this.flow}/`,e).then((t=>{var e;if(t.status<200||t.status>=300)this.saveError=this.extractErrorMessage(t);else{if(t.json){const i=Sd().getState();t.json.info&&i.setFlowInfo(t.json.info),void 0!==(null===(e=t.json.revision)||void 0===e?void 0:e.revision)&&i.setRevision(t.json.revision.revision),this.fetchRevisions()}Sd().getState().setDirtyDate(null)}})).catch((t=>{console.error("Failed to save flow:",t),t instanceof Response?this.saveError=`Server error (${t.status}). Your changes have not been saved.`:this.saveError="Unable to reach the server. Please check your connection and try again."})).finally((()=>{this.isSaving=!1}))}extractErrorMessage(t){if(t.json){if("string"==typeof t.json.detail)return t.json.detail;if("string"==typeof t.json.error)return t.json.error;if("string"==typeof t.json.description)return t.json.description}return`Save failed with status ${t.status}.`}showSaveErrorDialog(t){const e=document.createElement("temba-dialog");e.header="Save Failed",e.primaryButtonName="",e.cancelButtonName="Dismiss";const i=document.createElement("div");i.style.cssText="padding: 20px; font-size: 14px; line-height: 1.5;",i.textContent=t,e.appendChild(i),document.body.appendChild(e),e.open=!0,e.addEventListener("temba-dialog-hidden",(()=>{document.body.removeChild(e)}))}startActivityFetching(){this.simulatorActive||this.fetchActivityData()}stopActivityFetching(){null!==this.activityTimer&&(clearTimeout(this.activityTimer),this.activityTimer=null)}fetchActivityData(){var t;if(!(null===(t=this.definition)||void 0===t?void 0:t.uuid))return;if(this.simulatorActive)return;const e=`/flow/activity/${this.definition.uuid}/`,i=Sd();if(!i)return;i.getState().fetchActivity(e).then((()=>{this.isConnected&&(this.activityInterval=Math.min(3e5,this.activityInterval+100),null!==this.activityTimer&&clearTimeout(this.activityTimer),this.activityTimer=window.setTimeout((()=>{this.fetchActivityData()}),this.activityInterval))}))}handleLanguageChange(t){_d.getState().setLanguageCode(t)}disconnectedCallback(){super.disconnectedCallback(),null!==this.saveTimer&&(clearTimeout(this.saveTimer),this.saveTimer=null),null!==this.activityTimer&&(clearTimeout(this.activityTimer),this.activityTimer=null),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("mouseup",this.boundMouseUp),document.removeEventListener("mousedown",this.boundGlobalMouseDown),document.removeEventListener("keydown",this.boundKeyDown);const t=this.querySelector("#canvas");t&&t.removeEventListener("contextmenu",this.boundCanvasContextMenu),_d.getState().clearFlowData()}setupGlobalEventListeners(){document.addEventListener("mousemove",this.boundMouseMove),document.addEventListener("mouseup",this.boundMouseUp),document.addEventListener("mousedown",this.boundGlobalMouseDown),document.addEventListener("keydown",this.boundKeyDown);const t=this.querySelector("#canvas");t&&t.addEventListener("contextmenu",this.boundCanvasContextMenu),this.addEventListener(Mo.ActionEditRequested,this.handleActionEditRequested.bind(this)),this.addEventListener(Mo.AddActionRequested,this.handleAddActionRequested.bind(this)),this.addEventListener(Mo.NodeEditRequested,this.handleNodeEditRequested.bind(this)),this.addEventListener(Mo.NodeDeleted,this.handleNodeDeleted.bind(this)),this.addEventListener(Mo.Selection,(t=>{const e=t.target;"TEMBA-CANVAS-MENU"===e.tagName?this.handleCanvasMenuSelection(t):"TEMBA-NODE-TYPE-SELECTOR"===e.tagName&&this.handleNodeTypeSelection(t)})),this.addEventListener(Mo.Canceled,(t=>{const e=t.target;"TEMBA-CANVAS-MENU"===e.tagName?this.handleCanvasMenuClosed():"TEMBA-NODE-TYPE-SELECTOR"===e.tagName&&this.handleNodeTypeSelectorClosed()})),this.addEventListener(Mo.DragExternal,this.handleActionDragExternal.bind(this)),this.addEventListener(Mo.DragInternal,this.handleActionDragInternal.bind(this)),this.addEventListener(Mo.DragStop,(t=>{t.detail.isExternal&&this.handleActionDropExternal(t)}))}getPosition(t,e){var i,o,n;return"node"===e?null===(i=this.definition._ui.nodes[t])||void 0===i?void 0:i.position:null===(n=null===(o=this.definition._ui.stickies)||void 0===o?void 0:o[t])||void 0===n?void 0:n.position}handleMouseDown(t){if(0!==t.button)return;if(this.isReadOnly())return;this.blurActiveContentEditable();const e=t.currentTarget,i=t.target;if(i.classList.contains("exit")||i.closest(".exit"))return;const o=e.getAttribute("uuid"),n="TEMBA-FLOW-NODE"===e.tagName?"node":"sticky",s=this.getPosition(o,n);s&&(this.selectedItems.has(o)||t.ctrlKey||t.metaKey?this.selectedItems.has(o)||this.selectedItems.add(o):this.selectedItems.clear(),this.isMouseDown=!0,this.dragStartPos={x:t.clientX,y:t.clientY},this.startPos={left:s.left,top:s.top},this.currentDragItem={uuid:o,position:s,element:e,type:n},t.preventDefault(),t.stopPropagation())}handleGlobalMouseDown(t){var e;if(0!==t.button)return;const i=null===(e=this.querySelector("#grid"))||void 0===e?void 0:e.getBoundingClientRect();if(!i)return;if(!(t.clientX>=i.left&&t.clientX<=i.right&&t.clientY>=i.top&&t.clientY<=i.bottom))return;t.target.closest(".draggable")||this.handleCanvasMouseDown(t)}blurActiveContentEditable(){var t;let e=document.activeElement;for(;null===(t=null==e?void 0:e.shadowRoot)||void 0===t?void 0:t.activeElement;)e=e.shadowRoot.activeElement;e instanceof HTMLElement&&"true"===e.getAttribute("contenteditable")&&e.blur()}handleCanvasMouseDown(t){var e;if(this.isReadOnly())return;this.blurActiveContentEditable();const i=t.target;if("canvas"===i.id||"grid"===i.id){this.canvasMouseDown=!0,this.dragStartPos={x:t.clientX,y:t.clientY};const i=null===(e=this.querySelector("#canvas"))||void 0===e?void 0:e.getBoundingClientRect();if(i){this.selectedItems.clear();const e=t.clientX-i.left,o=t.clientY-i.top;this.selectionBox={startX:e,startY:o,endX:e,endY:o}}t.preventDefault()}}handleKeyDown(t){"Delete"!==t.key&&"Backspace"!==t.key||this.selectedItems.size>0&&this.showDeleteConfirmation(),"Escape"===t.key&&(this.selectedItems.clear(),this.requestUpdate())}showDeleteConfirmation(){const t=this.selectedItems.size,e=1===t?"item":"items",i=document.createElement("temba-dialog");i.header="Delete Items",i.primaryButtonName="Delete",i.cancelButtonName="Cancel",i.destructive=!0,i.innerHTML=`<div style="padding: 20px;">Are you sure you want to delete ${t} ${e}?</div>`,i.addEventListener("temba-button-clicked",(t=>{"Delete"===t.detail.button.name&&(this.deleteSelectedItems(),i.open=!1)})),document.body.appendChild(i),i.open=!0,i.addEventListener("temba-dialog-hidden",(()=>{document.body.removeChild(i)}))}deleteNodes(t){t.length>0&&Sd().getState().removeNodes(t)}deleteSelectedItems(){const t=Array.from(this.selectedItems).filter((t=>this.definition.nodes.some((e=>e.uuid===t))));this.deleteNodes(Array.from(t));const e=Array.from(this.selectedItems).filter((t=>{var e,i;return null===(i=null===(e=this.definition._ui)||void 0===e?void 0:e.stickies)||void 0===i?void 0:i[t]}));Sd().getState().removeStickyNotes(e),this.selectedItems.clear()}updateSelectionBox(t){var e;if(!this.selectionBox||!this.canvasMouseDown)return;const i=null===(e=this.querySelector("#canvas"))||void 0===e?void 0:e.getBoundingClientRect();if(!i)return;const o=t.clientX-i.left,n=t.clientY-i.top;this.selectionBox={...this.selectionBox,endX:o,endY:n},this.updateSelectedItemsFromBox()}updateSelectedItemsFromBox(){var t,e,i;if(!this.selectionBox)return;const o=new Set,n=Math.min(this.selectionBox.startX,this.selectionBox.endX),s=Math.min(this.selectionBox.startY,this.selectionBox.endY),r=Math.max(this.selectionBox.startX,this.selectionBox.endX),a=Math.max(this.selectionBox.startY,this.selectionBox.endY);null===(t=this.definition)||void 0===t||t.nodes.forEach((t=>{var e,i,l;const d=this.querySelector(`[id="${t.uuid}"]`);if(d){const c=null===(i=null===(e=this.definition._ui)||void 0===e?void 0:e.nodes[t.uuid])||void 0===i?void 0:i.position;if(c){const e=d.getBoundingClientRect();if(null===(l=this.querySelector("#canvas"))||void 0===l?void 0:l.getBoundingClientRect()){const i=c.left,l=c.top,d=i+e.width,h=l+e.height;n<d&&r>i&&s<h&&a>l&&o.add(t.uuid)}}}}));const l=(null===(i=null===(e=this.definition)||void 0===e?void 0:e._ui)||void 0===i?void 0:i.stickies)||{};Object.entries(l).forEach((([t,e])=>{if(e.position){const i=this.querySelector(`temba-sticky-note[uuid="${t}"]`);if(i){const l=i.clientWidth,d=i.clientHeight,c=e.position.left,h=e.position.top;n<c+l&&r>c&&s<h+d&&a>h&&o.add(t)}}})),this.selectedItems=o}renderSelectionBox(){if(!this.selectionBox||!this.isSelecting)return"";const t=Math.min(this.selectionBox.startX,this.selectionBox.endX),e=Math.min(this.selectionBox.startY,this.selectionBox.endY),i=Math.abs(this.selectionBox.endX-this.selectionBox.startX),o=Math.abs(this.selectionBox.endY-this.selectionBox.startY);return H`<div
9546
9619
  class="selection-box"
9547
9620
  style="left: ${t}px; top: ${e}px; width: ${i}px; height: ${o}px;"
9548
9621
  ></div>`}renderCanvasDropPreview(){var t;if(!this.canvasDropPreview)return"";const{action:e,position:i}=this.canvasDropPreview,o=mp[e.type];return o?H`<div
@@ -9605,7 +9678,7 @@ background: #ccc;
9605
9678
  </div>
9606
9679
  </div>
9607
9680
  </div>
9608
- </div>`}checkCollisionsAndReflow(t){var e;if(!this.definition)return;const i=[];for(const t of this.definition.nodes){const o=null===(e=this.definition._ui)||void 0===e?void 0:e.nodes[t.uuid];if(!(null==o?void 0:o.position))continue;const n=Bh(t.uuid,o.position);n&&i.push(n)}const o=((t,e)=>{const i=new Map,o=new Set(t),n=new Map;for(const t of e)n.set(t.uuid,{...t});for(const t of[...o]){const e=n.get(t);if(e)for(const[i,s]of n)if(i!==t&&!o.has(i)&&Fh(e,s)&&e.top>s.top&&s.top<30){o.delete(t),o.add(i);break}}const s=[],r=new Set;for(const t of o){const e=n.get(t);if(e)for(const[t,i]of n)o.has(t)||r.has(t)||Fh(e,i)&&(s.push(t),r.add(t))}const a=new Set;let l=0;for(;s.length>0&&l<200;){l++;const t=s.shift();if(a.has(t))continue;const e=n.get(t),d=[];for(const[i,s]of n)i!==t&&(o.has(i)||a.has(i))&&Fh(e,s)&&d.push(s);if(0===d.length)continue;const c=d.filter((t=>o.has(t.uuid))),h=[...qh];let u=null;if(c.length>0){for(const t of c){if(e.top>t.top){const t=h.indexOf("up");-1!==t&&h.splice(t,1)}if(e.left>t.left){const t=h.indexOf("left");-1!==t&&h.splice(t,1)}}let t=0,i=0;for(const o of c)t+=Math.min(e.right,o.right)-Math.max(e.left,o.left),i+=Math.min(e.bottom,o.bottom)-Math.max(e.top,o.top);t>i?u="vertical":i>t&&(u="horizontal")}let p=null,m=1/0;for(const i of h){const s=jh(e,d,i);if(!s)continue;const r=Uh(e,s.left,s.top);let l=!1,h=0;for(const[e,i]of n)if(e!==t&&Fh(r,i)){if(o.has(e)||a.has(e)){l=!0;break}h++}if(l)continue;const g=Math.abs(s.left-e.left)+Math.abs(s.top-e.top);let f;if(c.length>0){const t="up"===i||"down"===i;f=2e3*h+(null===u||"vertical"===u&&t||"horizontal"===u&&!t?0:5e3)+g}else f=1e4*h+g;f<m&&(m=f,p=s)}if(p){i.set(t,{left:p.left,top:p.top});const l=Uh(e,p.left,p.top);n.set(t,l),a.add(t);for(const[e,i]of n)e!==t&&(o.has(e)||a.has(e)||r.has(e)||Fh(l,i)&&(s.push(e),r.add(e)))}}return i})(t,i);if(o.size>0){const t={};for(const[e,i]of o.entries())t[e]=i;Sd().getState().updateCanvasPositions(t)}}handleMouseMove(t){if(this.canvasMouseDown&&!this.isMouseDown)return this.isSelecting=!0,this.updateSelectionBox(t),void this.requestUpdate();if(this.plumber.connectionDragging){const e=document.querySelector("temba-flow-node:hover");if(document.querySelectorAll("temba-flow-node").forEach((t=>{t.classList.remove("connection-target-valid","connection-target-invalid")})),e)this.targetId=e.getAttribute("uuid"),this.isValidTarget=this.targetId!==this.dragFromNodeId,this.isValidTarget?e.classList.add("connection-target-valid"):e.classList.add("connection-target-invalid"),this.connectionPlaceholder=null;else{this.targetId=null,this.isValidTarget=!0;const e=this.querySelector("#canvas");if(e){const i=e.getBoundingClientRect(),o=t.clientX-i.left,n=t.clientY-i.top,s=200,r=64,a=13,l=1,d=null!=this.connectionSourceY&&n<this.connectionSourceY;let c;c=d?n+l-r:n-l+a,this.connectionPlaceholder={position:{left:o-s/2,top:c},visible:!0,dragUp:d}}}this.requestUpdate()}if(!this.isMouseDown||!this.currentDragItem)return;const e=t.clientX-this.dragStartPos.x,i=t.clientY-this.dragStartPos.y,o=Math.sqrt(e*e+i*i);if(!this.isDragging&&o>5&&(this.isDragging=!0),this.isDragging){const t=this.selectedItems.has(this.currentDragItem.uuid)&&this.selectedItems.size>1?Array.from(this.selectedItems):[this.currentDragItem.uuid];t.forEach((t=>{const o=this.querySelector(`[uuid="${t}"]`);if(o){const n="TEMBA-FLOW-NODE"===o.tagName?"node":"sticky",s=this.getPosition(t,n);if(s){const t=s.left+e,n=s.top+i;o.style.left=`${t}px`,o.style.top=`${n}px`,o.classList.add("dragging")}}})),this.plumber.revalidate(t)}}handleMouseUp(t){if(this.canvasMouseDown&&this.isSelecting)return this.isSelecting=!1,this.selectionBox=null,this.canvasMouseDown=!1,void this.requestUpdate();if(!this.canvasMouseDown||this.isSelecting){if(this.isMouseDown&&this.currentDragItem){if(this.isDragging){const e=t.clientX-this.dragStartPos.x,i=t.clientY-this.dragStartPos.y,o=this.selectedItems.has(this.currentDragItem.uuid)&&this.selectedItems.size>1?Array.from(this.selectedItems):[this.currentDragItem.uuid],n={};if(o.forEach((t=>{const o=this.definition.nodes.find((e=>e.uuid===t))?"node":"sticky",s=this.getPosition(t,o);if(s){const o=s.left+e,r=s.top+i,a=Lh(o),l=Lh(r),d={left:a,top:l};n[t]=d;const c=this.querySelector(`[uuid="${t}"]`);c&&(c.classList.remove("dragging"),c.style.left=`${a}px`,c.style.top=`${l}px`)}})),Object.keys(n).length>0){Sd().getState().updateCanvasPositions(n);const t=o.filter((t=>this.definition.nodes.find((e=>e.uuid===t))));t.length>0?setTimeout((()=>{this.checkCollisionsAndReflow(t)}),0):setTimeout((()=>{this.plumber.repaintEverything()}),0)}this.selectedItems.clear()}this.isDragging=!1,this.isMouseDown=!1,this.currentDragItem=null,this.canvasMouseDown=!1}}else this.canvasMouseDown=!1}updateCanvasSize(){var t;if(!this.definition)return;const e=Sd();if(!e)return;let i=0,o=0;this.definition.nodes.forEach((t=>{const e=this.definition._ui.nodes[t.uuid];if(e&&e.position){const n=this.querySelector(`[id="${t.uuid}"]`);if(n){const t=n.getBoundingClientRect();i=Math.max(i,e.position.left+t.width),o=Math.max(o,e.position.top+t.height)}}}));const n=(null===(t=this.definition._ui)||void 0===t?void 0:t.stickies)||{};Object.entries(n).forEach((([t,e])=>{if(e.position){const n=this.querySelector(`temba-sticky-note[uuid="${t}"]`);if(n){const t=n.clientWidth,s=n.clientHeight;i=Math.max(i,e.position.left+t),o=Math.max(o,e.position.top+s)}else i=Math.max(i,e.position.left+200),o=Math.max(o,e.position.top+100)}})),e.getState().expandCanvas(i,o)}handleCanvasContextMenu(t){if(this.isReadOnly())return void t.preventDefault();if("canvas"!==t.target.id)return;t.preventDefault(),t.stopPropagation();const e=this.querySelector("#canvas");if(!e)return;const i=e.getBoundingClientRect(),o=t.clientX-i.left-10,n=t.clientY-i.top-10,s=Lh(o),r=Lh(n),a=this.querySelector("temba-canvas-menu");a&&a.show(t.clientX,t.clientY,{x:s,y:r})}handleCanvasMenuSelection(t){const e=t.detail,i=Sd();if("sticky"===e.action)i.getState().createStickyNote({left:e.position.x,top:e.position.y}),this.pendingCanvasConnection=null,this.connectionPlaceholder=null,this.sourceId=null,this.connectionSourceX=null,this.connectionSourceY=null,this.dragFromNodeId=null;else{const t=this.querySelector("temba-node-type-selector");t&&t.show(e.action,e.position)}}cleanUpConnection(){this.isCreatingNewNode&&(this.isCreatingNewNode=!1,this.pendingNodePosition=null),this.originalConnectionTargetId&&(this.plumber.connectIds(this.dragFromNodeId,this.sourceId,this.originalConnectionTargetId),this.originalConnectionTargetId=null),this.pendingCanvasConnection&&(this.pendingCanvasConnection=null,this.connectionPlaceholder=null,this.sourceId=null,this.connectionSourceX=null,this.connectionSourceY=null,this.dragFromNodeId=null,this.originalConnectionTargetId=null)}handleCanvasMenuClosed(){this.cleanUpConnection()}handleNodeTypeSelectorClosed(){this.cleanUpConnection()}handleNodeTypeSelection(t){const e=t.detail;if(this.pendingCanvasConnection,this.addActionToNodeUuid){const t=this.definition.nodes.find((t=>t.uuid===this.addActionToNodeUuid)),i=this.definition._ui.nodes[this.addActionToNodeUuid];if(t&&i){const o=Xt();return this.editingAction={uuid:o,type:e.nodeType},this.editingNode=t,this.editingNodeUI=i,this.isCreatingNewNode=!1,void(this.addActionToNodeUuid=null)}this.addActionToNodeUuid=null}const i=Xt(),o=e.nodeType in mp,n=o?"execute_actions":e.nodeType,s=fp[n],r=(null==s?void 0:s.form)&&Object.keys(s.form).some((t=>{var e;return["rules","categories","cases"].includes(t)||"array"===(null===(e=s.form[t])||void 0===e?void 0:e.type)})),a={uuid:i,actions:[],exits:r?[]:[{uuid:Xt(),destination_uuid:null}]};r&&(a.router={type:"switch",categories:[],cases:[],operand:"@input.text",default_category_uuid:void 0});const l={position:this.pendingCanvasConnection?this.pendingCanvasConnection.position:{left:e.position.x,top:e.position.y},type:n,config:{}};if(this.isCreatingNewNode=!0,this.pendingNodePosition=this.pendingCanvasConnection?this.pendingCanvasConnection.position:{left:e.position.x,top:e.position.y},this.editingNode=a,this.editingNodeUI=l,o){const t=Xt();this.editingAction={uuid:t,type:e.nodeType}}}handleActionEditRequested(t){this.editingAction=t.detail.action,this.dialogOrigin=null!=t.detail.originX?{x:t.detail.originX,y:t.detail.originY}:null;const e=t.detail.nodeUuid,i=this.definition.nodes.find((t=>t.uuid===e));i&&(this.editingNode=i,this.editingNodeUI=this.definition._ui.nodes[e])}handleAddActionRequested(t){const e=t.detail.nodeUuid,i=this.definition.nodes.find((t=>t.uuid===e));if(!i)return;const o=this.definition._ui.nodes[e];if(!o)return;const n=this.querySelector("temba-node-type-selector");n&&(n.show("action-no-branching",{x:o.position.left,y:o.position.top}),this.addActionToNodeUuid=e)}handleNodeEditRequested(t){this.editingNode=t.detail.node,this.editingNodeUI=t.detail.nodeUI,this.dialogOrigin=null!=t.detail.originX?{x:t.detail.originX,y:t.detail.originY}:null}handleNodeDeleted(t){const e=t.detail.uuid;e&&this.deleteNodes([e])}handleActionSaved(t){var e,i;if(this.editingNode&&this.editingAction){let o;o=this.editingNode.actions.findIndex((t=>t.uuid===this.editingAction.uuid))>=0?this.editingNode.actions.map((e=>e.uuid===this.editingAction.uuid?t:e)):[...this.editingNode.actions,t];const n={...this.editingNode,actions:o};if(this.isCreatingNewNode){const t=Sd(),i={position:this.pendingNodePosition||{left:0,top:0},type:null===(e=this.editingNodeUI)||void 0===e?void 0:e.type,config:{}};t.getState().addNode(n,i),this.pendingCanvasConnection&&(t.getState().updateConnection(this.pendingCanvasConnection.fromNodeId,this.pendingCanvasConnection.exitId,n.uuid),this.pendingCanvasConnection=null,this.connectionPlaceholder=null,this.sourceId=null,this.connectionSourceX=null,this.connectionSourceY=null,this.dragFromNodeId=null),this.isCreatingNewNode=!1,this.pendingNodePosition=null,requestAnimationFrame((()=>{this.checkCollisionsAndReflow([n.uuid])}))}else{const t=this.editingNode.uuid;null===(i=Sd())||void 0===i||i.getState().updateNode(t,n),requestAnimationFrame((()=>{this.checkCollisionsAndReflow([t])}))}}this.closeNodeEditor()}closeNodeEditor(){this.editingNode=null,this.editingNodeUI=null,this.editingAction=null,this.dialogOrigin=null}handleActionEditCanceled(){this.cleanUpConnection(),this.closeNodeEditor()}handleNodeSaved(t,e){var i,o,n;if(this.editingNode)if(this.isCreatingNewNode){const o=Sd(),n={position:this.pendingNodePosition||{left:0,top:0},type:null===(i=this.editingNodeUI)||void 0===i?void 0:i.type,config:e||{}};o.getState().addNode(t,n),this.pendingCanvasConnection&&(o.getState().updateConnection(this.pendingCanvasConnection.fromNodeId,this.pendingCanvasConnection.exitId,t.uuid),this.pendingCanvasConnection=null,this.connectionPlaceholder=null,this.sourceId=null,this.connectionSourceX=null,this.connectionSourceY=null,this.dragFromNodeId=null),this.isCreatingNewNode=!1,this.pendingNodePosition=null,requestAnimationFrame((()=>{this.checkCollisionsAndReflow([t.uuid])}))}else{if(this.plumber){const e=this.editingNode.exits||[],i=t.exits||[];e.filter((t=>!i.find((e=>e.uuid===t.uuid)))).forEach((t=>{this.plumber.removeExitConnection(t.uuid)}))}this.plumber.revalidate([t.uuid]),null===(o=Sd())||void 0===o||o.getState().updateNode(this.editingNode.uuid,t),e&&(null===(n=Sd())||void 0===n||n.getState().updateNodeUIConfig(t.uuid,e)),requestAnimationFrame((()=>{this.checkCollisionsAndReflow([this.editingNode.uuid])}))}this.closeNodeEditor()}handleNodeEditCanceled(){this.cleanUpConnection(),this.closeNodeEditor()}getNodeAtPosition(t,e){const i=this.querySelectorAll("temba-flow-node");for(const o of Array.from(i)){const i=o.getBoundingClientRect();if(t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom)return o.getAttribute("data-node-uuid")}return null}calculateCanvasDropPosition(t,e,i=!0){const o=this.querySelector("#canvas");if(!o)return{left:0,top:0};const n=o.getBoundingClientRect(),s=t-n.left-20,r=e-n.top-20;return i?{left:Lh(s),top:Lh(r)}:{left:s,top:r}}handleActionDragExternal(t){const{action:e,nodeUuid:i,actionIndex:o,mouseX:n,mouseY:s,actionHeight:r=60,isLastAction:a=!1}=t.detail,l=this.getNodeAtPosition(n,s);if(l&&l!==i){const t=this.definition._ui.nodes[l],a=this.definition.nodes.find((t=>t.uuid===l));if("execute_actions"===(null==t?void 0:t.type)&&a){if(this.previousActionDragTargetNodeUuid&&this.previousActionDragTargetNodeUuid!==l){const t=this.querySelector(`temba-flow-node[data-node-uuid="${this.previousActionDragTargetNodeUuid}"]`);t&&t.dispatchEvent(new CustomEvent("action-drag-leave",{detail:{},bubbles:!1}))}this.actionDragTargetNodeUuid=l,this.previousActionDragTargetNodeUuid=l,this.canvasDropPreview=null;const t=this.querySelector(`temba-flow-node[data-node-uuid="${i}"]`);t&&t.dispatchEvent(new CustomEvent("action-show-ghost",{detail:{},bubbles:!1}));const a=this.querySelector(`temba-flow-node[data-node-uuid="${l}"]`);return a&&a.dispatchEvent(new CustomEvent("action-drag-over",{detail:{action:e,sourceNodeUuid:i,actionIndex:o,mouseX:n,mouseY:s,actionHeight:r},bubbles:!1})),void this.requestUpdate()}}if(this.previousActionDragTargetNodeUuid){const t=this.querySelector(`temba-flow-node[data-node-uuid="${this.previousActionDragTargetNodeUuid}"]`);t&&t.dispatchEvent(new CustomEvent("action-drag-leave",{detail:{},bubbles:!1})),this.previousActionDragTargetNodeUuid=null}this.actionDragTargetNodeUuid=null;const d=this.querySelector(`temba-flow-node[data-node-uuid="${i}"]`);if(a)d&&d.dispatchEvent(new CustomEvent("action-show-ghost",{detail:{},bubbles:!1})),this.canvasDropPreview=null;else{d&&d.dispatchEvent(new CustomEvent("action-hide-ghost",{detail:{},bubbles:!1}));const t=this.calculateCanvasDropPosition(n,s,!1);this.canvasDropPreview={action:e,nodeUuid:i,actionIndex:o,position:t,actionHeight:r}}this.requestUpdate()}handleActionDragInternal(t){if(this.previousActionDragTargetNodeUuid){const t=this.querySelector(`temba-flow-node[data-node-uuid="${this.previousActionDragTargetNodeUuid}"]`);t&&t.dispatchEvent(new CustomEvent("action-drag-leave",{detail:{},bubbles:!1})),this.previousActionDragTargetNodeUuid=null}this.canvasDropPreview=null,this.actionDragTargetNodeUuid=null}handleActionDropExternal(t){var e,i;const{action:o,nodeUuid:n,actionIndex:s,mouseX:r,mouseY:a,isLastAction:l=!1}=t.detail,d=this.actionDragTargetNodeUuid;if(d&&d!==n){const t=this.querySelector(`temba-flow-node[data-node-uuid="${d}"]`);return t&&t.dispatchEvent(new CustomEvent("action-drop",{detail:{action:o,sourceNodeUuid:n,actionIndex:s,mouseX:r,mouseY:a},bubbles:!1})),this.canvasDropPreview=null,void(this.actionDragTargetNodeUuid=null)}if(l)return this.canvasDropPreview=null,void(this.actionDragTargetNodeUuid=null);const c=this.calculateCanvasDropPosition(r,a,!0),h=this.definition.nodes.find((t=>t.uuid===n));if(!h)return;const u=h.actions.filter(((t,e)=>e!==s));if(0===u.length)this.deleteNodes([n]);else{const t={...h,actions:u};null===(e=Sd())||void 0===e||e.getState().updateNode(n,t)}const p={uuid:Xt(),actions:[o],exits:[{uuid:Xt(),destination_uuid:null}]},m={position:c,type:"execute_actions",config:{}};null===(i=Sd())||void 0===i||i.getState().addNode(p,m),this.canvasDropPreview=null,this.actionDragTargetNodeUuid=null,requestAnimationFrame((()=>{this.checkCollisionsAndReflow([p.uuid])}))}getLocalizationLanguages(){if(!this.definition)return[];const t=this.definition.language;return this.getAvailableLanguages().filter((e=>e.code!==t))}getLocalizationProgress(t){if(!this.definition||!t||t===this.definition.language)return{total:0,localized:0};const e=this.buildTranslationBundles(this.translationFilters.categories,t);return this.getTranslationCounts(e)}getLanguageLocalization(t){var e;return(null===(e=this.definition)||void 0===e?void 0:e.localization)&&this.definition.localization[t]||{}}buildTranslationBundles(t,e=this.languageCode){if(!this.definition||!e||e===this.definition.language)return[];const i=this.getLanguageLocalization(e),o=[];return this.definition.nodes.forEach((e=>{var n,s,r,a,l;if(null===(n=e.actions)||void 0===n||n.forEach((t=>{const n=mp[t.type];if(!(null==n?void 0:n.localizable)||0===n.localizable.length)return;const s="send_msg"===t.type?n.localizable.filter((t=>"text"===t)):n.localizable,r=this.findTranslations("property",t.uuid,s,t,i);r.length>0&&o.push({nodeUuid:e.uuid,actionUuid:t.uuid,translations:r})})),!t)return;const d=null===(r=null===(s=this.definition._ui)||void 0===s?void 0:s.nodes)||void 0===r?void 0:r[e.uuid],c=null==d?void 0:d.type;if(!c)return;const h=fp[c];if("categories"===(null==h?void 0:h.localizable)&&(null===(l=null===(a=e.router)||void 0===a?void 0:a.categories)||void 0===l?void 0:l.length)){const t=e.router.categories.flatMap((t=>this.findTranslations("category",t.uuid,["name"],t,i)));t.length>0&&o.push({nodeUuid:e.uuid,translations:t})}})),o}findTranslations(t,e,i,o,n){const s=[];return i.forEach((i=>{if("quick_replies"===i)return;const r=i.split(".");let a=o,l=[];for(;r.length>0&&a;){a.uuid&&(l=n[a.uuid]);const t=r.shift();if(!t)break;l&&(l=l[t]),a=a[t]}if(!a)return;const d=this.formatTranslationValue(a);if(!d)return;const c=l?this.formatTranslationValue(l):null;s.push({uuid:e,type:t,attribute:i,from:d,to:c})})),s}formatTranslationValue(t){if(null==t)return null;if(Array.isArray(t)){const e=t.map((t=>this.formatTranslationValue(t))).filter((t=>!!t));return e.length>0?e.join(", "):null}if("object"==typeof t)return"name"in t&&t.name?String(t.name):"arguments"in t&&Array.isArray(t.arguments)?t.arguments.join(" "):null;if("number"==typeof t)return t.toString();if("string"==typeof t){const e=t.trim();return e.length>0?e:null}return null}getTranslationCounts(t){return t.reduce(((t,e)=>(e.translations.forEach((e=>{t.total+=1,e.to&&e.to.trim().length>0&&(t.localized+=1)})),t)),{total:0,localized:0})}handleLocalizationTabClick(){const t=this.getLocalizationLanguages();if(!t.length)return;this.localizationWindowHidden=!1,this.revisionsWindowHidden=!0,this.issuesWindowHidden=!0;t.some((t=>t.code===this.languageCode))||this.handleLanguageChange(t[0].code)}handleLocalizationLanguageSelect(t){t!==this.languageCode&&this.handleLanguageChange(t)}handleLocalizationLanguageSelectChange(t){var e,i;const o=t.target,n=null===(i=null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])||void 0===i?void 0:i.value;n&&this.handleLocalizationLanguageSelect(n)}handleLocalizationWindowClosed(){var t;this.localizationWindowHidden=!0;const e=null===(t=this.definition)||void 0===t?void 0:t.language;e&&this.languageCode!==e&&this.handleLanguageChange(e)}toggleTranslationSettings(){this.translationSettingsExpanded=!this.translationSettingsExpanded}handleLocalizationProgressToggleClick(t){t.target.closest(".translation-settings-toggle")||this.toggleTranslationSettings()}handleLocalizationProgressToggleKeydown(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.toggleTranslationSettings())}handleIncludeCategoriesChange(t){var e,i;const o=t.target,n=null!==(e=null==o?void 0:o.checked)&&void 0!==e&&e;this.translationFilters={categories:n},null===(i=Sd())||void 0===i||i.getState().setTranslationFilters({categories:n}),this.requestUpdate()}async handleAutoTranslateClick(t){t.preventDefault(),t.stopPropagation(),this.autoTranslating?this.autoTranslating=!1:this.autoTranslateDialogOpen=!0}handleAutoTranslateDialogButton(t){var e;const i=null===(e=t.detail)||void 0===e?void 0:e.button;if(i)if("Translate"===i.name){if(!this.autoTranslateModel)return;this.autoTranslateDialogOpen=!1,this.autoTranslateError=null,this.autoTranslating=!0,this.runAutoTranslation().catch((t=>{console.error("Auto translation failed",t),this.autoTranslateError="Auto translation failed. Please try again.",this.autoTranslating=!1}))}else"Cancel"!==i.name&&"Close"!==i.name||(this.autoTranslateDialogOpen=!1)}handleAutoTranslateModelChange(t){var e;const i=t.target,o=(null===(e=null==i?void 0:i.values)||void 0===e?void 0:e[0])||null;this.autoTranslateModel=o}shouldTranslateValue(t){if(!t)return!1;const e=t.trim();return!(e.length<=1)&&!/^\d+$/.test(e)}async requestAutoTranslation(t){var e,i;if(!this.autoTranslateModel||!this.definition)return null;const o={text:t,lang:{from:this.definition.language,to:this.languageCode}},n=await pe(`/llm/translate/${this.autoTranslateModel.uuid}/`,o);if(200===(null==n?void 0:n.status)){const t=(null===(e=n.json)||void 0===e?void 0:e.result)||(null===(i=n.json)||void 0===i?void 0:i.text);return t?String(t):null}throw new Error("Auto translation request failed")}applyLocalizationUpdates(t,e=!1){if(!t.length||!this.definition)return;const i=Sd();i&&t.forEach((({uuid:t,translations:o})=>{var n,s;const r=Object.entries(o).reduce(((t,[e,i])=>i?(t[e]=Array.isArray(i)?i:[i],t):t),{}),a={...(null===(s=null===(n=this.definition.localization)||void 0===n?void 0:n[this.languageCode])||void 0===s?void 0:s[t])||{},...r};i.getState().updateLocalization(this.languageCode,t,a),e&&_d.getState().markAutoTranslated(this.languageCode,t,Object.keys(o))}))}async runAutoTranslation(){if(!this.definition||this.languageCode===this.definition.language||!this.autoTranslateModel)return void(this.autoTranslating=!1);const t=this.buildTranslationBundles(this.translationFilters.categories);for(const e of t){if(!this.autoTranslating)break;const t=e.translations.filter((t=>!t.to||0===t.to.trim().length));if(0===t.length)continue;const i=[];for(const e of t){if(!this.autoTranslating)break;if(!this.shouldTranslateValue(e.from))continue;const t=this.translationCache.get(e.from);if(t)i.push({uuid:e.uuid,translations:{[e.attribute]:t}});else try{const t=await this.requestAutoTranslation(e.from);t&&(this.translationCache.set(e.from,t),i.push({uuid:e.uuid,translations:{[e.attribute]:t}}))}catch(t){console.error("Auto translation request failed",t),this.autoTranslateError="Auto translation failed. Please try again.",this.autoTranslating=!1;break}}if(i.length>0&&this.applyLocalizationUpdates(i,!0),!this.autoTranslating)break}this.autoTranslating=!1}handleIssuesTabClick(){this.issuesWindowHidden=!1,this.revisionsWindowHidden=!0,this.localizationWindowHidden=!0}handleIssuesWindowClosed(){this.issuesWindowHidden=!0}handleIssueItemClick(t){var e;const i=document.getElementById("issues-window");null==i||i.handleClose(),this.issuesWindowHidden=!0,this.focusNode(t.node_uuid);const o=this.definition.nodes.find((e=>e.uuid===t.node_uuid));if(o)if(t.action_uuid){const i=null===(e=o.actions)||void 0===e?void 0:e.find((e=>e.uuid===t.action_uuid));i&&(this.editingAction=i,this.editingNode=o,this.editingNodeUI=this.definition._ui.nodes[t.node_uuid])}else this.editingNode=o,this.editingNodeUI=this.definition._ui.nodes[t.node_uuid]}handleRevisionsTabClick(){this.revisionsWindowHidden&&(this.fetchRevisions(),this.revisionsWindowHidden=!1,this.issuesWindowHidden=!0,this.localizationWindowHidden=!0)}handleRevisionsWindowClosed(){this.resetRevisionsScroll(),this.revisionsWindowHidden=!0,this.viewingRevision&&this.handleCancelRevisionView()}resetRevisionsScroll(){var t;const e=null===(t=this.querySelector("#revisions-window").shadowRoot)||void 0===t?void 0:t.querySelector(".body");e&&(e.scrollTop=0)}async fetchRevisions(){this.isLoadingRevisions=!0;try{const t=await de(`/flow/revisions/${this.flow}/?version=${fd}`);this.revisions=t.slice(1)}catch(t){console.error("Error fetching revisions",t)}finally{this.isLoadingRevisions=!1}}async handleRevisionClick(t){var e,i;if((null===(e=this.viewingRevision)||void 0===e?void 0:e.id)!==t.id){this.viewingRevision||(this.preRevertState={definition:this.definition,dirtyDate:this.dirtyDate}),this.viewingRevision=t,this.isLoadingRevisions=!0,null===(i=this.plumber)||void 0===i||i.reset();try{await Sd().getState().fetchRevision(`/flow/revisions/${this.flow}`,t.id.toString())}catch(t){console.error("Error fetching revision details",t),this.handleCancelRevisionView()}finally{this.isLoadingRevisions=!1}}}handleCancelRevisionView(){var t;if(null===(t=this.plumber)||void 0===t||t.reset(),this.preRevertState){const t=Sd().getState().flowInfo;Sd().getState().setFlowContents({definition:this.preRevertState.definition,info:t}),this.preRevertState.dirtyDate&&Sd().getState().setDirtyDate(this.preRevertState.dirtyDate)}else Sd().getState().fetchRevision(`/flow/revisions/${this.flow}`);this.viewingRevision=null,this.preRevertState=null}async handleRevertClick(){var t;if(!this.viewingRevision||!this.preRevertState)return;null===(t=this.plumber)||void 0===t||t.reset();const e={...this.definition,revision:this.preRevertState.definition.revision};await this.saveChanges(e),this.viewingRevision=null,this.preRevertState=null,this.revisionsWindowHidden=!0;document.getElementById("revisions-window").handleClose(),this.fetchRevisions(),Sd().getState().fetchRevision(`/flow/revisions/${this.flow}`)}renderIssuesTab(){var t;return(null===(t=this.flowIssues)||void 0===t?void 0:t.length)?H`
9681
+ </div>`}checkCollisionsAndReflow(t){var e;if(!this.definition)return;const i=[];for(const t of this.definition.nodes){const o=null===(e=this.definition._ui)||void 0===e?void 0:e.nodes[t.uuid];if(!(null==o?void 0:o.position))continue;const n=Bh(t.uuid,o.position);n&&i.push(n)}const o=((t,e)=>{const i=new Map,o=new Set(t),n=new Map;for(const t of e)n.set(t.uuid,{...t});for(const t of[...o]){const e=n.get(t);if(e)for(const[i,s]of n)if(i!==t&&!o.has(i)&&Fh(e,s)&&e.top>s.top&&s.top<30){o.delete(t),o.add(i);break}}const s=[],r=new Set;for(const t of o){const e=n.get(t);if(e)for(const[t,i]of n)o.has(t)||r.has(t)||Fh(e,i)&&(s.push(t),r.add(t))}const a=new Set;let l=0;for(;s.length>0&&l<200;){l++;const t=s.shift();if(a.has(t))continue;const e=n.get(t),d=[];for(const[i,s]of n)i!==t&&(o.has(i)||a.has(i))&&Fh(e,s)&&d.push(s);if(0===d.length)continue;const c=d.filter((t=>o.has(t.uuid))),h=[...qh];let u=null;if(c.length>0){for(const t of c){if(e.top>t.top){const t=h.indexOf("up");-1!==t&&h.splice(t,1)}if(e.left>t.left){const t=h.indexOf("left");-1!==t&&h.splice(t,1)}}let t=0,i=0;for(const o of c)t+=Math.min(e.right,o.right)-Math.max(e.left,o.left),i+=Math.min(e.bottom,o.bottom)-Math.max(e.top,o.top);t>i?u="vertical":i>t&&(u="horizontal")}let p=null,m=1/0;for(const i of h){const s=jh(e,d,i);if(!s)continue;const r=Uh(e,s.left,s.top);let l=!1,h=0;for(const[e,i]of n)if(e!==t&&Fh(r,i)){if(o.has(e)||a.has(e)){l=!0;break}h++}if(l)continue;const g=Math.abs(s.left-e.left)+Math.abs(s.top-e.top);let f;if(c.length>0){const t="up"===i||"down"===i;f=2e3*h+(null===u||"vertical"===u&&t||"horizontal"===u&&!t?0:5e3)+g}else f=1e4*h+g;f<m&&(m=f,p=s)}if(p){i.set(t,{left:p.left,top:p.top});const l=Uh(e,p.left,p.top);n.set(t,l),a.add(t);for(const[e,i]of n)e!==t&&(o.has(e)||a.has(e)||r.has(e)||Fh(l,i)&&(s.push(e),r.add(e)))}}return i})(t,i);if(o.size>0){const t={};for(const[e,i]of o.entries())t[e]=i;Sd().getState().updateCanvasPositions(t)}}handleMouseMove(t){if(this.canvasMouseDown&&!this.isMouseDown)return this.isSelecting=!0,this.updateSelectionBox(t),void this.requestUpdate();if(this.plumber.connectionDragging){const e=document.querySelector("temba-flow-node:hover");if(document.querySelectorAll("temba-flow-node").forEach((t=>{t.classList.remove("connection-target-valid","connection-target-invalid")})),e)this.targetId=e.getAttribute("uuid"),this.isValidTarget=this.targetId!==this.dragFromNodeId,this.isValidTarget?e.classList.add("connection-target-valid"):e.classList.add("connection-target-invalid"),this.connectionPlaceholder=null;else{this.targetId=null,this.isValidTarget=!0;const e=this.querySelector("#canvas");if(e){const i=e.getBoundingClientRect(),o=t.clientX-i.left,n=t.clientY-i.top,s=200,r=64,a=13,l=1,d=null!=this.connectionSourceY&&n<this.connectionSourceY;let c;c=d?n+l-r:n-l+a,this.connectionPlaceholder={position:{left:o-s/2,top:c},visible:!0,dragUp:d}}}this.requestUpdate()}if(!this.isMouseDown||!this.currentDragItem)return;const e=t.clientX-this.dragStartPos.x,i=t.clientY-this.dragStartPos.y,o=Math.sqrt(e*e+i*i);if(!this.isDragging&&o>5&&(this.isDragging=!0),this.isDragging){const t=this.selectedItems.has(this.currentDragItem.uuid)&&this.selectedItems.size>1?Array.from(this.selectedItems):[this.currentDragItem.uuid];t.forEach((t=>{const o=this.querySelector(`[uuid="${t}"]`);if(o){const n="TEMBA-FLOW-NODE"===o.tagName?"node":"sticky",s=this.getPosition(t,n);if(s){const t=s.left+e,n=s.top+i;o.style.left=`${t}px`,o.style.top=`${n}px`,o.classList.add("dragging")}}})),this.plumber.revalidate(t)}}handleMouseUp(t){if(this.canvasMouseDown&&this.isSelecting)return this.isSelecting=!1,this.selectionBox=null,this.canvasMouseDown=!1,void this.requestUpdate();if(!this.canvasMouseDown||this.isSelecting){if(this.isMouseDown&&this.currentDragItem){if(this.isDragging){const e=t.clientX-this.dragStartPos.x,i=t.clientY-this.dragStartPos.y,o=this.selectedItems.has(this.currentDragItem.uuid)&&this.selectedItems.size>1?Array.from(this.selectedItems):[this.currentDragItem.uuid],n={};if(o.forEach((t=>{const o=this.definition.nodes.find((e=>e.uuid===t))?"node":"sticky",s=this.getPosition(t,o);if(s){const o=s.left+e,r=s.top+i,a=Lh(o),l=Lh(r),d={left:a,top:l};n[t]=d;const c=this.querySelector(`[uuid="${t}"]`);c&&(c.classList.remove("dragging"),c.style.left=`${a}px`,c.style.top=`${l}px`)}})),Object.keys(n).length>0){Sd().getState().updateCanvasPositions(n);const t=o.filter((t=>this.definition.nodes.find((e=>e.uuid===t))));t.length>0?setTimeout((()=>{this.checkCollisionsAndReflow(t)}),0):setTimeout((()=>{this.plumber.repaintEverything()}),0)}this.selectedItems.clear()}this.isDragging=!1,this.isMouseDown=!1,this.currentDragItem=null,this.canvasMouseDown=!1}}else this.canvasMouseDown=!1}updateCanvasSize(){var t;if(!this.definition)return;const e=Sd();if(!e)return;let i=0,o=0;this.definition.nodes.forEach((t=>{const e=this.definition._ui.nodes[t.uuid];if(e&&e.position){const n=this.querySelector(`[id="${t.uuid}"]`);if(n){const t=n.getBoundingClientRect();i=Math.max(i,e.position.left+t.width),o=Math.max(o,e.position.top+t.height)}}}));const n=(null===(t=this.definition._ui)||void 0===t?void 0:t.stickies)||{};Object.entries(n).forEach((([t,e])=>{if(e.position){const n=this.querySelector(`temba-sticky-note[uuid="${t}"]`);if(n){const t=n.clientWidth,s=n.clientHeight;i=Math.max(i,e.position.left+t),o=Math.max(o,e.position.top+s)}else i=Math.max(i,e.position.left+200),o=Math.max(o,e.position.top+100)}})),e.getState().expandCanvas(i,o)}handleCanvasContextMenu(t){if(this.isReadOnly())return void t.preventDefault();if("canvas"!==t.target.id)return;t.preventDefault(),t.stopPropagation();const e=this.querySelector("#canvas");if(!e)return;const i=e.getBoundingClientRect(),o=t.clientX-i.left-10,n=t.clientY-i.top-10,s=Lh(o),r=Lh(n),a=this.querySelector("temba-canvas-menu");a&&a.show(t.clientX,t.clientY,{x:s,y:r})}handleEmptyFlowClick(t){const e=this.querySelector("#editor");if(!e)return;e.scrollTo({left:0,top:0,behavior:"smooth"});const i=this.querySelector("temba-canvas-menu");if(i){const e=t.currentTarget.getBoundingClientRect(),o=265,n=e.left+e.width/2-o/2,s=e.bottom+8;i.show(n,s,{x:0,y:0},!1)}}handleCanvasMenuSelection(t){const e=t.detail,i=Sd();if("sticky"===e.action)i.getState().createStickyNote({left:e.position.x,top:e.position.y}),this.pendingCanvasConnection=null,this.connectionPlaceholder=null,this.sourceId=null,this.connectionSourceX=null,this.connectionSourceY=null,this.dragFromNodeId=null;else{const t=this.querySelector("temba-node-type-selector");t&&t.show(e.action,e.position)}}cleanUpConnection(){this.isCreatingNewNode&&(this.isCreatingNewNode=!1,this.pendingNodePosition=null),this.originalConnectionTargetId&&(this.plumber.connectIds(this.dragFromNodeId,this.sourceId,this.originalConnectionTargetId),this.originalConnectionTargetId=null),this.pendingCanvasConnection&&(this.pendingCanvasConnection=null,this.connectionPlaceholder=null,this.sourceId=null,this.connectionSourceX=null,this.connectionSourceY=null,this.dragFromNodeId=null,this.originalConnectionTargetId=null)}handleCanvasMenuClosed(){this.cleanUpConnection()}handleNodeTypeSelectorClosed(){this.cleanUpConnection()}handleNodeTypeSelection(t){const e=t.detail;if(this.pendingCanvasConnection,this.addActionToNodeUuid){const t=this.definition.nodes.find((t=>t.uuid===this.addActionToNodeUuid)),i=this.definition._ui.nodes[this.addActionToNodeUuid];if(t&&i){const o=Xt();return this.editingAction={uuid:o,type:e.nodeType},this.editingNode=t,this.editingNodeUI=i,this.isCreatingNewNode=!1,void(this.addActionToNodeUuid=null)}this.addActionToNodeUuid=null}const i=Xt(),o=e.nodeType in mp,n=o?"execute_actions":e.nodeType,s=fp[n],r=(null==s?void 0:s.form)&&Object.keys(s.form).some((t=>{var e;return["rules","categories","cases"].includes(t)||"array"===(null===(e=s.form[t])||void 0===e?void 0:e.type)})),a={uuid:i,actions:[],exits:r?[]:[{uuid:Xt(),destination_uuid:null}]};r&&(a.router={type:"switch",categories:[],cases:[],operand:"@input.text",default_category_uuid:void 0});const l={position:this.pendingCanvasConnection?this.pendingCanvasConnection.position:{left:e.position.x,top:e.position.y},type:n,config:{}};if(this.isCreatingNewNode=!0,this.pendingNodePosition=this.pendingCanvasConnection?this.pendingCanvasConnection.position:{left:e.position.x,top:e.position.y},this.editingNode=a,this.editingNodeUI=l,o){const t=Xt();this.editingAction={uuid:t,type:e.nodeType}}}handleActionEditRequested(t){this.editingAction=t.detail.action,this.dialogOrigin=null!=t.detail.originX?{x:t.detail.originX,y:t.detail.originY}:null;const e=t.detail.nodeUuid,i=this.definition.nodes.find((t=>t.uuid===e));i&&(this.editingNode=i,this.editingNodeUI=this.definition._ui.nodes[e])}handleAddActionRequested(t){const e=t.detail.nodeUuid,i=this.definition.nodes.find((t=>t.uuid===e));if(!i)return;const o=this.definition._ui.nodes[e];if(!o)return;const n=this.querySelector("temba-node-type-selector");n&&(n.show("action-no-branching",{x:o.position.left,y:o.position.top}),this.addActionToNodeUuid=e)}handleNodeEditRequested(t){this.editingNode=t.detail.node,this.editingNodeUI=t.detail.nodeUI,this.dialogOrigin=null!=t.detail.originX?{x:t.detail.originX,y:t.detail.originY}:null}handleNodeDeleted(t){const e=t.detail.uuid;e&&this.deleteNodes([e])}handleActionSaved(t){var e,i;if(this.editingNode&&this.editingAction){let o;o=this.editingNode.actions.findIndex((t=>t.uuid===this.editingAction.uuid))>=0?this.editingNode.actions.map((e=>e.uuid===this.editingAction.uuid?t:e)):[...this.editingNode.actions,t];const n={...this.editingNode,actions:o};if(this.isCreatingNewNode){const t=Sd(),i={position:this.pendingNodePosition||{left:0,top:0},type:null===(e=this.editingNodeUI)||void 0===e?void 0:e.type,config:{}};t.getState().addNode(n,i),this.pendingCanvasConnection&&(t.getState().updateConnection(this.pendingCanvasConnection.fromNodeId,this.pendingCanvasConnection.exitId,n.uuid),this.pendingCanvasConnection=null,this.connectionPlaceholder=null,this.sourceId=null,this.connectionSourceX=null,this.connectionSourceY=null,this.dragFromNodeId=null),this.isCreatingNewNode=!1,this.pendingNodePosition=null,requestAnimationFrame((()=>{this.checkCollisionsAndReflow([n.uuid])}))}else{const t=this.editingNode.uuid;null===(i=Sd())||void 0===i||i.getState().updateNode(t,n),requestAnimationFrame((()=>{this.checkCollisionsAndReflow([t])}))}}this.closeNodeEditor()}closeNodeEditor(){this.editingNode=null,this.editingNodeUI=null,this.editingAction=null,this.dialogOrigin=null}handleActionEditCanceled(){this.cleanUpConnection(),this.closeNodeEditor()}handleNodeSaved(t,e){var i,o,n;if(this.editingNode)if(this.isCreatingNewNode){const o=Sd(),n={position:this.pendingNodePosition||{left:0,top:0},type:null===(i=this.editingNodeUI)||void 0===i?void 0:i.type,config:e||{}};o.getState().addNode(t,n),this.pendingCanvasConnection&&(o.getState().updateConnection(this.pendingCanvasConnection.fromNodeId,this.pendingCanvasConnection.exitId,t.uuid),this.pendingCanvasConnection=null,this.connectionPlaceholder=null,this.sourceId=null,this.connectionSourceX=null,this.connectionSourceY=null,this.dragFromNodeId=null),this.isCreatingNewNode=!1,this.pendingNodePosition=null,requestAnimationFrame((()=>{this.checkCollisionsAndReflow([t.uuid])}))}else{if(this.plumber){const e=this.editingNode.exits||[],i=t.exits||[];e.filter((t=>!i.find((e=>e.uuid===t.uuid)))).forEach((t=>{this.plumber.removeExitConnection(t.uuid)}))}this.plumber.revalidate([t.uuid]),null===(o=Sd())||void 0===o||o.getState().updateNode(this.editingNode.uuid,t),e&&(null===(n=Sd())||void 0===n||n.getState().updateNodeUIConfig(t.uuid,e)),requestAnimationFrame((()=>{this.checkCollisionsAndReflow([this.editingNode.uuid])}))}this.closeNodeEditor()}handleNodeEditCanceled(){this.cleanUpConnection(),this.closeNodeEditor()}getNodeAtPosition(t,e){const i=this.querySelectorAll("temba-flow-node");for(const o of Array.from(i)){const i=o.getBoundingClientRect();if(t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom)return o.getAttribute("data-node-uuid")}return null}calculateCanvasDropPosition(t,e,i=!0){const o=this.querySelector("#canvas");if(!o)return{left:0,top:0};const n=o.getBoundingClientRect(),s=t-n.left-20,r=e-n.top-20;return i?{left:Lh(s),top:Lh(r)}:{left:s,top:r}}handleActionDragExternal(t){const{action:e,nodeUuid:i,actionIndex:o,mouseX:n,mouseY:s,actionHeight:r=60,isLastAction:a=!1}=t.detail,l=this.getNodeAtPosition(n,s);if(l&&l!==i){const t=this.definition._ui.nodes[l],a=this.definition.nodes.find((t=>t.uuid===l));if("execute_actions"===(null==t?void 0:t.type)&&a){if(this.previousActionDragTargetNodeUuid&&this.previousActionDragTargetNodeUuid!==l){const t=this.querySelector(`temba-flow-node[data-node-uuid="${this.previousActionDragTargetNodeUuid}"]`);t&&t.dispatchEvent(new CustomEvent("action-drag-leave",{detail:{},bubbles:!1}))}this.actionDragTargetNodeUuid=l,this.previousActionDragTargetNodeUuid=l,this.canvasDropPreview=null;const t=this.querySelector(`temba-flow-node[data-node-uuid="${i}"]`);t&&t.dispatchEvent(new CustomEvent("action-show-ghost",{detail:{},bubbles:!1}));const a=this.querySelector(`temba-flow-node[data-node-uuid="${l}"]`);return a&&a.dispatchEvent(new CustomEvent("action-drag-over",{detail:{action:e,sourceNodeUuid:i,actionIndex:o,mouseX:n,mouseY:s,actionHeight:r},bubbles:!1})),void this.requestUpdate()}}if(this.previousActionDragTargetNodeUuid){const t=this.querySelector(`temba-flow-node[data-node-uuid="${this.previousActionDragTargetNodeUuid}"]`);t&&t.dispatchEvent(new CustomEvent("action-drag-leave",{detail:{},bubbles:!1})),this.previousActionDragTargetNodeUuid=null}this.actionDragTargetNodeUuid=null;const d=this.querySelector(`temba-flow-node[data-node-uuid="${i}"]`);if(a)d&&d.dispatchEvent(new CustomEvent("action-show-ghost",{detail:{},bubbles:!1})),this.canvasDropPreview=null;else{d&&d.dispatchEvent(new CustomEvent("action-hide-ghost",{detail:{},bubbles:!1}));const t=this.calculateCanvasDropPosition(n,s,!1);this.canvasDropPreview={action:e,nodeUuid:i,actionIndex:o,position:t,actionHeight:r}}this.requestUpdate()}handleActionDragInternal(t){if(this.previousActionDragTargetNodeUuid){const t=this.querySelector(`temba-flow-node[data-node-uuid="${this.previousActionDragTargetNodeUuid}"]`);t&&t.dispatchEvent(new CustomEvent("action-drag-leave",{detail:{},bubbles:!1})),this.previousActionDragTargetNodeUuid=null}this.canvasDropPreview=null,this.actionDragTargetNodeUuid=null}handleActionDropExternal(t){var e,i;const{action:o,nodeUuid:n,actionIndex:s,mouseX:r,mouseY:a,isLastAction:l=!1}=t.detail,d=this.actionDragTargetNodeUuid;if(d&&d!==n){const t=this.querySelector(`temba-flow-node[data-node-uuid="${d}"]`);return t&&t.dispatchEvent(new CustomEvent("action-drop",{detail:{action:o,sourceNodeUuid:n,actionIndex:s,mouseX:r,mouseY:a},bubbles:!1})),this.canvasDropPreview=null,void(this.actionDragTargetNodeUuid=null)}if(l)return this.canvasDropPreview=null,void(this.actionDragTargetNodeUuid=null);const c=this.calculateCanvasDropPosition(r,a,!0),h=this.definition.nodes.find((t=>t.uuid===n));if(!h)return;const u=h.actions.filter(((t,e)=>e!==s));if(0===u.length)this.deleteNodes([n]);else{const t={...h,actions:u};null===(e=Sd())||void 0===e||e.getState().updateNode(n,t)}const p={uuid:Xt(),actions:[o],exits:[{uuid:Xt(),destination_uuid:null}]},m={position:c,type:"execute_actions",config:{}};null===(i=Sd())||void 0===i||i.getState().addNode(p,m),this.canvasDropPreview=null,this.actionDragTargetNodeUuid=null,requestAnimationFrame((()=>{this.checkCollisionsAndReflow([p.uuid])}))}getLocalizationLanguages(){if(!this.definition)return[];const t=this.definition.language;return this.getAvailableLanguages().filter((e=>e.code!==t))}getLocalizationProgress(t){if(!this.definition||!t||t===this.definition.language)return{total:0,localized:0};const e=this.buildTranslationBundles(this.translationFilters.categories,t);return this.getTranslationCounts(e)}getLanguageLocalization(t){var e;return(null===(e=this.definition)||void 0===e?void 0:e.localization)&&this.definition.localization[t]||{}}buildTranslationBundles(t,e=this.languageCode){if(!this.definition||!e||e===this.definition.language)return[];const i=this.getLanguageLocalization(e),o=[];return this.definition.nodes.forEach((e=>{var n,s,r,a,l;if(null===(n=e.actions)||void 0===n||n.forEach((t=>{const n=mp[t.type];if(!(null==n?void 0:n.localizable)||0===n.localizable.length)return;const s="send_msg"===t.type?n.localizable.filter((t=>"text"===t)):n.localizable,r=this.findTranslations("property",t.uuid,s,t,i);r.length>0&&o.push({nodeUuid:e.uuid,actionUuid:t.uuid,translations:r})})),!t)return;const d=null===(r=null===(s=this.definition._ui)||void 0===s?void 0:s.nodes)||void 0===r?void 0:r[e.uuid],c=null==d?void 0:d.type;if(!c)return;const h=fp[c];if("categories"===(null==h?void 0:h.localizable)&&(null===(l=null===(a=e.router)||void 0===a?void 0:a.categories)||void 0===l?void 0:l.length)){const t=e.router.categories.flatMap((t=>this.findTranslations("category",t.uuid,["name"],t,i)));t.length>0&&o.push({nodeUuid:e.uuid,translations:t})}})),o}findTranslations(t,e,i,o,n){const s=[];return i.forEach((i=>{if("quick_replies"===i)return;const r=i.split(".");let a=o,l=[];for(;r.length>0&&a;){a.uuid&&(l=n[a.uuid]);const t=r.shift();if(!t)break;l&&(l=l[t]),a=a[t]}if(!a)return;const d=this.formatTranslationValue(a);if(!d)return;const c=l?this.formatTranslationValue(l):null;s.push({uuid:e,type:t,attribute:i,from:d,to:c})})),s}formatTranslationValue(t){if(null==t)return null;if(Array.isArray(t)){const e=t.map((t=>this.formatTranslationValue(t))).filter((t=>!!t));return e.length>0?e.join(", "):null}if("object"==typeof t)return"name"in t&&t.name?String(t.name):"arguments"in t&&Array.isArray(t.arguments)?t.arguments.join(" "):null;if("number"==typeof t)return t.toString();if("string"==typeof t){const e=t.trim();return e.length>0?e:null}return null}getTranslationCounts(t){return t.reduce(((t,e)=>(e.translations.forEach((e=>{t.total+=1,e.to&&e.to.trim().length>0&&(t.localized+=1)})),t)),{total:0,localized:0})}handleLocalizationTabClick(){const t=this.getLocalizationLanguages();if(!t.length)return;this.localizationWindowHidden=!1,this.revisionsWindowHidden=!0,this.issuesWindowHidden=!0;t.some((t=>t.code===this.languageCode))||this.handleLanguageChange(t[0].code)}handleLocalizationLanguageSelect(t){t!==this.languageCode&&this.handleLanguageChange(t)}handleLocalizationLanguageSelectChange(t){var e,i;const o=t.target,n=null===(i=null===(e=null==o?void 0:o.values)||void 0===e?void 0:e[0])||void 0===i?void 0:i.value;n&&this.handleLocalizationLanguageSelect(n)}handleLocalizationWindowClosed(){var t;this.localizationWindowHidden=!0;const e=null===(t=this.definition)||void 0===t?void 0:t.language;e&&this.languageCode!==e&&this.handleLanguageChange(e)}toggleTranslationSettings(){this.translationSettingsExpanded=!this.translationSettingsExpanded}handleLocalizationProgressToggleClick(t){t.target.closest(".translation-settings-toggle")||this.toggleTranslationSettings()}handleLocalizationProgressToggleKeydown(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.toggleTranslationSettings())}handleIncludeCategoriesChange(t){var e,i;const o=t.target,n=null!==(e=null==o?void 0:o.checked)&&void 0!==e&&e;this.translationFilters={categories:n},null===(i=Sd())||void 0===i||i.getState().setTranslationFilters({categories:n}),this.requestUpdate()}async handleAutoTranslateClick(t){t.preventDefault(),t.stopPropagation(),this.autoTranslating?this.autoTranslating=!1:this.autoTranslateDialogOpen=!0}handleAutoTranslateDialogButton(t){var e;const i=null===(e=t.detail)||void 0===e?void 0:e.button;if(i)if("Translate"===i.name){if(!this.autoTranslateModel)return;this.autoTranslateDialogOpen=!1,this.autoTranslateError=null,this.autoTranslating=!0,this.runAutoTranslation().catch((t=>{console.error("Auto translation failed",t),this.autoTranslateError="Auto translation failed. Please try again.",this.autoTranslating=!1}))}else"Cancel"!==i.name&&"Close"!==i.name||(this.autoTranslateDialogOpen=!1)}handleAutoTranslateModelChange(t){var e;const i=t.target,o=(null===(e=null==i?void 0:i.values)||void 0===e?void 0:e[0])||null;this.autoTranslateModel=o}shouldTranslateValue(t){if(!t)return!1;const e=t.trim();return!(e.length<=1)&&!/^\d+$/.test(e)}async requestAutoTranslation(t){var e,i;if(!this.autoTranslateModel||!this.definition)return null;const o={text:t,lang:{from:this.definition.language,to:this.languageCode}},n=await pe(`/llm/translate/${this.autoTranslateModel.uuid}/`,o);if(200===(null==n?void 0:n.status)){const t=(null===(e=n.json)||void 0===e?void 0:e.result)||(null===(i=n.json)||void 0===i?void 0:i.text);return t?String(t):null}throw new Error("Auto translation request failed")}applyLocalizationUpdates(t,e=!1){if(!t.length||!this.definition)return;const i=Sd();i&&t.forEach((({uuid:t,translations:o})=>{var n,s;const r=Object.entries(o).reduce(((t,[e,i])=>i?(t[e]=Array.isArray(i)?i:[i],t):t),{}),a={...(null===(s=null===(n=this.definition.localization)||void 0===n?void 0:n[this.languageCode])||void 0===s?void 0:s[t])||{},...r};i.getState().updateLocalization(this.languageCode,t,a),e&&_d.getState().markAutoTranslated(this.languageCode,t,Object.keys(o))}))}async runAutoTranslation(){if(!this.definition||this.languageCode===this.definition.language||!this.autoTranslateModel)return void(this.autoTranslating=!1);const t=this.buildTranslationBundles(this.translationFilters.categories);for(const e of t){if(!this.autoTranslating)break;const t=e.translations.filter((t=>!t.to||0===t.to.trim().length));if(0===t.length)continue;const i=[];for(const e of t){if(!this.autoTranslating)break;if(!this.shouldTranslateValue(e.from))continue;const t=this.translationCache.get(e.from);if(t)i.push({uuid:e.uuid,translations:{[e.attribute]:t}});else try{const t=await this.requestAutoTranslation(e.from);t&&(this.translationCache.set(e.from,t),i.push({uuid:e.uuid,translations:{[e.attribute]:t}}))}catch(t){console.error("Auto translation request failed",t),this.autoTranslateError="Auto translation failed. Please try again.",this.autoTranslating=!1;break}}if(i.length>0&&this.applyLocalizationUpdates(i,!0),!this.autoTranslating)break}this.autoTranslating=!1}handleIssuesTabClick(){this.issuesWindowHidden=!1,this.revisionsWindowHidden=!0,this.localizationWindowHidden=!0}handleIssuesWindowClosed(){this.issuesWindowHidden=!0}handleIssueItemClick(t){var e;const i=document.getElementById("issues-window");null==i||i.handleClose(),this.issuesWindowHidden=!0,this.focusNode(t.node_uuid);const o=this.definition.nodes.find((e=>e.uuid===t.node_uuid));if(o)if(t.action_uuid){const i=null===(e=o.actions)||void 0===e?void 0:e.find((e=>e.uuid===t.action_uuid));i&&(this.editingAction=i,this.editingNode=o,this.editingNodeUI=this.definition._ui.nodes[t.node_uuid])}else this.editingNode=o,this.editingNodeUI=this.definition._ui.nodes[t.node_uuid]}handleRevisionsTabClick(){this.revisionsWindowHidden&&(this.fetchRevisions(),this.revisionsWindowHidden=!1,this.issuesWindowHidden=!0,this.localizationWindowHidden=!0)}handleRevisionsWindowClosed(){this.resetRevisionsScroll(),this.revisionsWindowHidden=!0,this.viewingRevision&&this.handleCancelRevisionView()}resetRevisionsScroll(){var t;const e=null===(t=this.querySelector("#revisions-window").shadowRoot)||void 0===t?void 0:t.querySelector(".body");e&&(e.scrollTop=0)}async fetchRevisions(){this.isLoadingRevisions=!0;try{const t=await de(`/flow/revisions/${this.flow}/?version=${fd}`);this.revisions=t.slice(1)}catch(t){console.error("Error fetching revisions",t)}finally{this.isLoadingRevisions=!1}}async handleRevisionClick(t){var e,i;if((null===(e=this.viewingRevision)||void 0===e?void 0:e.id)!==t.id){this.viewingRevision||(this.preRevertState={definition:this.definition,dirtyDate:this.dirtyDate}),this.viewingRevision=t,this.isLoadingRevisions=!0,null===(i=this.plumber)||void 0===i||i.reset();try{await Sd().getState().fetchRevision(`/flow/revisions/${this.flow}`,t.id.toString())}catch(t){console.error("Error fetching revision details",t),this.handleCancelRevisionView()}finally{this.isLoadingRevisions=!1}}}handleCancelRevisionView(){var t;if(null===(t=this.plumber)||void 0===t||t.reset(),this.preRevertState){const t=Sd().getState().flowInfo;Sd().getState().setFlowContents({definition:this.preRevertState.definition,info:t}),this.preRevertState.dirtyDate&&Sd().getState().setDirtyDate(this.preRevertState.dirtyDate)}else Sd().getState().fetchRevision(`/flow/revisions/${this.flow}`);this.viewingRevision=null,this.preRevertState=null}async handleRevertClick(){var t;if(!this.viewingRevision||!this.preRevertState)return;null===(t=this.plumber)||void 0===t||t.reset();const e={...this.definition,revision:this.preRevertState.definition.revision};await this.saveChanges(e),this.viewingRevision=null,this.preRevertState=null,this.revisionsWindowHidden=!0;document.getElementById("revisions-window").handleClose(),this.fetchRevisions(),Sd().getState().fetchRevision(`/flow/revisions/${this.flow}`)}renderIssuesTab(){var t;return(null===(t=this.flowIssues)||void 0===t?void 0:t.length)&&this.revisionsWindowHidden?H`
9609
9682
  <temba-floating-tab
9610
9683
  id="issues-tab"
9611
9684
  icon="alert_warning"
@@ -9638,7 +9711,7 @@ background: #ccc;
9638
9711
  `))}
9639
9712
  </div>
9640
9713
  </temba-floating-window>
9641
- `:""}renderRevisionsTab(){return H`
9714
+ `:""}renderRevisionsTab(){return this.revisions.length<=1?"":H`
9642
9715
  <temba-floating-tab
9643
9716
  id="revisions-tab"
9644
9717
  icon="revisions"
@@ -9832,7 +9905,7 @@ background: #ccc;
9832
9905
  </div>`:""}
9833
9906
  </div>
9834
9907
  </temba-dialog>
9835
- `}renderLocalizationTab(){return this.getLocalizationLanguages().length?H`
9908
+ `}renderLocalizationTab(){var t;if(!this.revisionsWindowHidden)return"";if(0===(null===(t=this.definition)||void 0===t?void 0:t.nodes.length))return"";return this.getLocalizationLanguages().length?H`
9836
9909
  <temba-floating-tab
9837
9910
  id="localization-tab"
9838
9911
  icon="language"
@@ -9844,44 +9917,64 @@ background: #ccc;
9844
9917
  ></temba-floating-tab>
9845
9918
  `:H``}focusNode(t){const e=this.querySelector(`temba-flow-node[uuid="${t}"]`);if(!e)return;const i=this.querySelector("#editor");if(!i)return;const o=i.getBoundingClientRect(),n=o.width/2,s=o.height/2,r=e.getBoundingClientRect(),a=e.offsetLeft+r.width/2-n,l=e.offsetTop+r.height/2-s;i.scrollTo({left:Math.max(0,a),top:Math.max(0,l),behavior:"smooth"})}isReadOnly(){return null!==this.viewingRevision||this.isTranslating}render(){var t,e;const i=H`<style>
9846
9919
  ${r(xp.styles.cssText)}
9847
- ${r(yp.styles.cssText)}
9920
+ ${r(bp.styles.cssText)}
9848
9921
  </style>`,o=(null===(e=null===(t=this.definition)||void 0===t?void 0:t._ui)||void 0===e?void 0:e.stickies)||{};return H`${i} ${this.renderIssuesWindow()}
9849
9922
  ${this.renderRevisionsWindow()} ${this.renderLocalizationWindow()}
9850
9923
  ${this.renderAutoTranslateDialog()}
9851
- <div id="editor">
9852
- <div
9853
- id="grid"
9854
- class="${this.viewingRevision?"viewing-revision":""}"
9855
- style="min-width:100%;width:${this.canvasSize.width}px; height:${this.canvasSize.height}px"
9856
- >
9924
+ <div id="editor-container">
9925
+ <div id="editor">
9926
+ ${this.definition&&0===this.definition.nodes.length&&!this.isReadOnly()?H`<div class="empty-flow">
9927
+ <div class="empty-flow-content">
9928
+ <div class="empty-flow-title">This flow is empty</div>
9929
+ <div class="empty-flow-description">
9930
+ Get started by adding your first action or split to define
9931
+ how this flow will work.
9932
+ </div>
9933
+ <button
9934
+ class="empty-flow-button"
9935
+ @click=${this.handleEmptyFlowClick}
9936
+ >
9937
+ Add first step
9938
+ </button>
9939
+ </div>
9940
+ </div>`:""}
9857
9941
  <div
9858
- id="canvas"
9859
- class="${ae({"viewing-revision":!!this.viewingRevision,"read-only-connections":!!this.viewingRevision||this.isTranslating})}"
9942
+ id="grid"
9943
+ class="${this.viewingRevision?"viewing-revision":""}"
9944
+ style="min-width:100%;width:${this.canvasSize.width}px; height:${this.canvasSize.height}px"
9860
9945
  >
9861
- ${this.definition?mc([...this.definition.nodes].sort(((t,e)=>t.uuid.localeCompare(e.uuid))),(t=>t.uuid),(t=>{var e,i,o;const n=(null===(i=null===(e=this.definition._ui)||void 0===e?void 0:e.nodes[t.uuid])||void 0===i?void 0:i.position)||{left:0,top:0},s=this.isDragging&&(null===(o=this.currentDragItem)||void 0===o?void 0:o.uuid)===t.uuid,r=this.selectedItems.has(t.uuid),a=this.definition.nodes.length>0&&this.definition.nodes[0].uuid===t.uuid;return H`<temba-flow-node
9862
- class="draggable ${s?"dragging":""} ${r?"selected":""} ${a?"flow-start":""}"
9863
- @mousedown=${this.handleMouseDown.bind(this)}
9864
- uuid=${t.uuid}
9865
- data-node-uuid=${t.uuid}
9866
- style="left:${n.left}px; top:${n.top}px;transition: all 0.2s ease-in-out;"
9867
- .plumber=${this.plumber}
9868
- .node=${t}
9869
- .ui=${this.definition._ui.nodes[t.uuid]}
9870
- @temba-node-deleted=${t=>{this.deleteNodes([t.detail.uuid])}}
9871
- ></temba-flow-node>`})):H`<temba-loading></temba-loading>`}
9872
- ${mc(Object.entries(o),(([t])=>t),(([t,e])=>{var i;const o=e.position||{left:0,top:0},n=this.isDragging&&(null===(i=this.currentDragItem)||void 0===i?void 0:i.uuid)===t,s=this.selectedItems.has(t);return H`<temba-sticky-note
9873
- class="draggable ${n?"dragging":""} ${s?"selected":""}"
9874
- @mousedown=${this.handleMouseDown.bind(this)}
9875
- style="left:${o.left}px; top:${o.top}px;"
9876
- uuid=${t}
9877
- .data=${e}
9878
- .dragging=${n}
9879
- .selected=${s}
9880
- ></temba-sticky-note>`}))}
9881
- ${this.renderSelectionBox()} ${this.renderCanvasDropPreview()}
9882
- ${this.renderConnectionPlaceholder()}
9946
+ <div
9947
+ id="canvas"
9948
+ class="${ae({"viewing-revision":!!this.viewingRevision,"read-only-connections":!!this.viewingRevision||this.isTranslating})}"
9949
+ >
9950
+ ${this.definition?mc([...this.definition.nodes].sort(((t,e)=>t.uuid.localeCompare(e.uuid))),(t=>t.uuid),(t=>{var e,i,o;const n=(null===(i=null===(e=this.definition._ui)||void 0===e?void 0:e.nodes[t.uuid])||void 0===i?void 0:i.position)||{left:0,top:0},s=this.isDragging&&(null===(o=this.currentDragItem)||void 0===o?void 0:o.uuid)===t.uuid,r=this.selectedItems.has(t.uuid),a=this.definition.nodes.length>0&&this.definition.nodes[0].uuid===t.uuid;return H`<temba-flow-node
9951
+ class="draggable ${s?"dragging":""} ${r?"selected":""} ${a?"flow-start":""}"
9952
+ @mousedown=${this.handleMouseDown.bind(this)}
9953
+ uuid=${t.uuid}
9954
+ data-node-uuid=${t.uuid}
9955
+ style="left:${n.left}px; top:${n.top}px;transition: all 0.2s ease-in-out;"
9956
+ .plumber=${this.plumber}
9957
+ .node=${t}
9958
+ .ui=${this.definition._ui.nodes[t.uuid]}
9959
+ @temba-node-deleted=${t=>{this.deleteNodes([t.detail.uuid])}}
9960
+ ></temba-flow-node>`})):H`<temba-loading></temba-loading>`}
9961
+ ${mc(Object.entries(o),(([t])=>t),(([t,e])=>{var i;const o=e.position||{left:0,top:0},n=this.isDragging&&(null===(i=this.currentDragItem)||void 0===i?void 0:i.uuid)===t,s=this.selectedItems.has(t);return H`<temba-sticky-note
9962
+ class="draggable ${n?"dragging":""} ${s?"selected":""}"
9963
+ @mousedown=${this.handleMouseDown.bind(this)}
9964
+ style="left:${o.left}px; top:${o.top}px;"
9965
+ uuid=${t}
9966
+ .data=${e}
9967
+ .dragging=${n}
9968
+ .selected=${s}
9969
+ ></temba-sticky-note>`}))}
9970
+ ${this.renderSelectionBox()} ${this.renderCanvasDropPreview()}
9971
+ ${this.renderConnectionPlaceholder()}
9972
+ </div>
9883
9973
  </div>
9884
9974
  </div>
9975
+ <div class="save-indicator ${this.isSaving?"visible":""}">
9976
+ <temba-loading units="3" size="8"></temba-loading>
9977
+ </div>
9885
9978
  </div>
9886
9979
 
9887
9980
  ${this.editingNode||this.editingAction?H`<temba-node-editor
@@ -9900,7 +9993,7 @@ background: #ccc;
9900
9993
  .features=${this.features}
9901
9994
  ></temba-node-type-selector>`}
9902
9995
  ${this.renderIssuesTab()} ${this.renderRevisionsTab()}
9903
- ${this.renderLocalizationTab()} `}}t([mt({type:String})],xp.prototype,"flow",void 0),t([mt({type:String})],xp.prototype,"version",void 0),t([mt({type:String})],xp.prototype,"flowType",void 0),t([mt({type:Array})],xp.prototype,"features",void 0),t([kd(_d,(t=>t.flowDefinition))],xp.prototype,"definition",void 0),t([kd(_d,(t=>t.simulatorActive))],xp.prototype,"simulatorActive",void 0),t([kd(_d,(t=>t.canvasSize))],xp.prototype,"canvasSize",void 0),t([kd(_d,(t=>t.dirtyDate))],xp.prototype,"dirtyDate",void 0),t([kd(_d,(t=>t.languageCode))],xp.prototype,"languageCode",void 0),t([kd(_d,(t=>t.isTranslating))],xp.prototype,"isTranslating",void 0),t([kd(_d,(t=>t.workspace))],xp.prototype,"workspace",void 0),t([kd(_d,(t=>t.getCurrentActivity()))],xp.prototype,"activityData",void 0),t([kd(_d,(t=>{var e;return(null===(e=t.flowInfo)||void 0===e?void 0:e.issues)||[]}))],xp.prototype,"flowIssues",void 0),t([gt()],xp.prototype,"isDragging",void 0),t([gt()],xp.prototype,"currentDragItem",void 0),t([gt()],xp.prototype,"selectedItems",void 0),t([gt()],xp.prototype,"isSelecting",void 0),t([gt()],xp.prototype,"selectionBox",void 0),t([gt()],xp.prototype,"targetId",void 0),t([gt()],xp.prototype,"sourceId",void 0),t([gt()],xp.prototype,"dragFromNodeId",void 0),t([gt()],xp.prototype,"originalConnectionTargetId",void 0),t([gt()],xp.prototype,"isValidTarget",void 0),t([gt()],xp.prototype,"issuesWindowHidden",void 0),t([gt()],xp.prototype,"localizationWindowHidden",void 0),t([gt()],xp.prototype,"translationFilters",void 0),t([gt()],xp.prototype,"translationSettingsExpanded",void 0),t([gt()],xp.prototype,"autoTranslateDialogOpen",void 0),t([gt()],xp.prototype,"autoTranslating",void 0),t([gt()],xp.prototype,"autoTranslateModel",void 0),t([gt()],xp.prototype,"autoTranslateError",void 0),t([gt()],xp.prototype,"revisionsWindowHidden",void 0),t([gt()],xp.prototype,"revisions",void 0),t([gt()],xp.prototype,"viewingRevision",void 0),t([gt()],xp.prototype,"isLoadingRevisions",void 0),t([gt()],xp.prototype,"editingNode",void 0),t([gt()],xp.prototype,"editingNodeUI",void 0),t([gt()],xp.prototype,"editingAction",void 0),t([gt()],xp.prototype,"isCreatingNewNode",void 0),t([gt()],xp.prototype,"pendingNodePosition",void 0),t([gt()],xp.prototype,"canvasDropPreview",void 0),t([gt()],xp.prototype,"addActionToNodeUuid",void 0),t([gt()],xp.prototype,"actionDragTargetNodeUuid",void 0),t([gt()],xp.prototype,"connectionPlaceholder",void 0);class _p extends Ne{constructor(){super(...arguments),this.dragging=!1,this.selected=!1,this.colorPickerExpanded=!1}static get styles(){return a`
9996
+ ${this.renderLocalizationTab()} `}}t([mt({type:String})],xp.prototype,"flow",void 0),t([mt({type:String})],xp.prototype,"version",void 0),t([mt({type:String})],xp.prototype,"flowType",void 0),t([mt({type:Array})],xp.prototype,"features",void 0),t([kd(_d,(t=>t.flowDefinition))],xp.prototype,"definition",void 0),t([kd(_d,(t=>t.simulatorActive))],xp.prototype,"simulatorActive",void 0),t([kd(_d,(t=>t.canvasSize))],xp.prototype,"canvasSize",void 0),t([kd(_d,(t=>t.dirtyDate))],xp.prototype,"dirtyDate",void 0),t([kd(_d,(t=>t.languageCode))],xp.prototype,"languageCode",void 0),t([kd(_d,(t=>t.isTranslating))],xp.prototype,"isTranslating",void 0),t([kd(_d,(t=>t.workspace))],xp.prototype,"workspace",void 0),t([kd(_d,(t=>t.getCurrentActivity()))],xp.prototype,"activityData",void 0),t([kd(_d,(t=>{var e;return(null===(e=t.flowInfo)||void 0===e?void 0:e.issues)||[]}))],xp.prototype,"flowIssues",void 0),t([gt()],xp.prototype,"isDragging",void 0),t([gt()],xp.prototype,"currentDragItem",void 0),t([gt()],xp.prototype,"selectedItems",void 0),t([gt()],xp.prototype,"isSelecting",void 0),t([gt()],xp.prototype,"selectionBox",void 0),t([gt()],xp.prototype,"targetId",void 0),t([gt()],xp.prototype,"sourceId",void 0),t([gt()],xp.prototype,"dragFromNodeId",void 0),t([gt()],xp.prototype,"originalConnectionTargetId",void 0),t([gt()],xp.prototype,"isValidTarget",void 0),t([gt()],xp.prototype,"issuesWindowHidden",void 0),t([gt()],xp.prototype,"localizationWindowHidden",void 0),t([gt()],xp.prototype,"translationFilters",void 0),t([gt()],xp.prototype,"translationSettingsExpanded",void 0),t([gt()],xp.prototype,"autoTranslateDialogOpen",void 0),t([gt()],xp.prototype,"autoTranslating",void 0),t([gt()],xp.prototype,"autoTranslateModel",void 0),t([gt()],xp.prototype,"autoTranslateError",void 0),t([gt()],xp.prototype,"revisionsWindowHidden",void 0),t([gt()],xp.prototype,"revisions",void 0),t([gt()],xp.prototype,"viewingRevision",void 0),t([gt()],xp.prototype,"isLoadingRevisions",void 0),t([gt()],xp.prototype,"isSaving",void 0),t([gt()],xp.prototype,"saveError",void 0),t([gt()],xp.prototype,"editingNode",void 0),t([gt()],xp.prototype,"editingNodeUI",void 0),t([gt()],xp.prototype,"editingAction",void 0),t([gt()],xp.prototype,"isCreatingNewNode",void 0),t([gt()],xp.prototype,"pendingNodePosition",void 0),t([gt()],xp.prototype,"canvasDropPreview",void 0),t([gt()],xp.prototype,"addActionToNodeUuid",void 0),t([gt()],xp.prototype,"actionDragTargetNodeUuid",void 0),t([gt()],xp.prototype,"connectionPlaceholder",void 0);class _p extends Ne{constructor(){super(...arguments),this.dragging=!1,this.selected=!1,this.colorPickerExpanded=!1}static get styles(){return a`
9904
9997
  :host {
9905
9998
  --sticky-color: #fef08a;
9906
9999
  --sticky-border-color: #facc15;
@@ -10949,13 +11042,13 @@ function Mp(t){return t+.5|0}t([mt({type:String})],Dp.prototype,"endpoint",void
10949
11042
  * https://www.chartjs.org
10950
11043
  * (c) 2025 Chart.js Contributors
10951
11044
  * Released under the MIT License
10952
- */function cm(){}const hm=(()=>{let t=0;return()=>t++})();function um(t){return null==t}function pm(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function mm(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function gm(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function fm(t,e){return gm(t)?t:e}function vm(t,e){return void 0===t?e:t}const bm=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function ym(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function xm(t,e,i,o){let n,s,r;if(pm(t))if(s=t.length,o)for(n=s-1;n>=0;n--)e.call(i,t[n],n);else for(n=0;n<s;n++)e.call(i,t[n],n);else if(mm(t))for(r=Object.keys(t),s=r.length,n=0;n<s;n++)e.call(i,t[r[n]],r[n])}function _m(t,e){let i,o,n,s;if(!t||!e||t.length!==e.length)return!1;for(i=0,o=t.length;i<o;++i)if(n=t[i],s=e[i],n.datasetIndex!==s.datasetIndex||n.index!==s.index)return!1;return!0}function wm(t){if(pm(t))return t.map(wm);if(mm(t)){const e=Object.create(null),i=Object.keys(t),o=i.length;let n=0;for(;n<o;++n)e[i[n]]=wm(t[i[n]]);return e}return t}function km(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function Cm(t,e,i,o){if(!km(t))return;const n=e[t],s=i[t];mm(n)&&mm(s)?Sm(n,s,o):e[t]=wm(s)}function Sm(t,e,i){const o=pm(e)?e:[e],n=o.length;if(!mm(t))return t;const s=(i=i||{}).merger||Cm;let r;for(let e=0;e<n;++e){if(r=o[e],!mm(r))continue;const n=Object.keys(r);for(let e=0,o=n.length;e<o;++e)s(n[e],t,r,i)}return t}function Am(t,e){return Sm(t,e,{merger:Em})}function Em(t,e,i){if(!km(t))return;const o=e[t],n=i[t];mm(o)&&mm(n)?Am(o,n):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=wm(n))}const $m={"":t=>t,x:t=>t.x,y:t=>t.y};function Tm(t,e){const i=$m[e]||($m[e]=function(t){const e=function(t){const e=t.split("."),i=[];let o="";for(const t of e)o+=t,o.endsWith("\\")?o=o.slice(0,-1)+".":(i.push(o),o="");return i}(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function Dm(t){return t.charAt(0).toUpperCase()+t.slice(1)}const Mm=t=>void 0!==t,Im=t=>"function"==typeof t,Om=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};const Lm=Math.PI,zm=2*Lm,Pm=zm+Lm,Rm=Number.POSITIVE_INFINITY,Nm=Lm/180,Bm=Lm/2,Fm=Lm/4,qm=2*Lm/3,Um=Math.log10,jm=Math.sign;function Vm(t,e,i){return Math.abs(t-e)<i}function Hm(t){const e=Math.round(t);t=Vm(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(Um(t))),o=t/i;return(o<=1?1:o<=2?2:o<=5?5:10)*i}function Wm(t){return!function(t){return"symbol"==typeof t||"object"==typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function Zm(t,e,i){let o,n,s;for(o=0,n=t.length;o<n;o++)s=t[o][i],isNaN(s)||(e.min=Math.min(e.min,s),e.max=Math.max(e.max,s))}function Ym(t){return t*(Lm/180)}function Gm(t){return t*(180/Lm)}function Km(t){if(!gm(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function Xm(t,e){const i=e.x-t.x,o=e.y-t.y,n=Math.sqrt(i*i+o*o);let s=Math.atan2(o,i);return s<-.5*Lm&&(s+=zm),{angle:s,distance:n}}function Qm(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Jm(t,e){return(t-e+Pm)%zm-Lm}function tg(t){return(t%zm+zm)%zm}function eg(t,e,i,o){const n=tg(t),s=tg(e),r=tg(i),a=tg(s-n),l=tg(r-n),d=tg(n-s),c=tg(n-r);return n===s||n===r||o&&s===r||a>l&&d<c}function ig(t,e,i){return Math.max(e,Math.min(i,t))}function og(t,e,i,o=1e-6){return t>=Math.min(e,i)-o&&t<=Math.max(e,i)+o}function ng(t,e,i){i=i||(i=>t[i]<e);let o,n=t.length-1,s=0;for(;n-s>1;)o=s+n>>1,i(o)?s=o:n=o;return{lo:s,hi:n}}const sg=(t,e,i,o)=>ng(t,i,o?o=>{const n=t[o][e];return n<i||n===i&&t[o+1][e]===i}:o=>t[o][e]<i),rg=(t,e,i)=>ng(t,i,(o=>t[o][e]>=i));const ag=["push","pop","shift","splice","unshift"];function lg(t,e){const i=t._chartjs;if(!i)return;const o=i.listeners,n=o.indexOf(e);-1!==n&&o.splice(n,1),o.length>0||(ag.forEach((e=>{delete t[e]})),delete t._chartjs)}function dg(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const cg="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function hg(t,e){let i=[],o=!1;return function(...n){i=n,o||(o=!0,cg.call(window,(()=>{o=!1,t.apply(e,i)})))}}const ug=t=>"start"===t?"left":"end"===t?"right":"center",pg=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2;function mg(t,e,i){const o=e.length;let n=0,s=o;if(t._sorted){const{iScale:r,vScale:a,_parsed:l}=t,d=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,c=r.axis,{min:h,max:u,minDefined:p,maxDefined:m}=r.getUserBounds();if(p){if(n=Math.min(sg(l,c,h).lo,i?o:sg(e,c,r.getPixelForValue(h)).lo),d){const t=l.slice(0,n+1).reverse().findIndex((t=>!um(t[a.axis])));n-=Math.max(0,t)}n=ig(n,0,o-1)}if(m){let t=Math.max(sg(l,r.axis,u,!0).hi+1,i?0:sg(e,c,r.getPixelForValue(u),!0).hi+1);if(d){const e=l.slice(t-1).findIndex((t=>!um(t[a.axis])));t+=Math.max(0,e)}s=ig(t,n,o)-n}else s=o-n}return{start:n,count:s}}function gg(t){const{xScale:e,yScale:i,_scaleRanges:o}=t,n={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!o)return t._scaleRanges=n,!0;const s=o.xmin!==e.min||o.xmax!==e.max||o.ymin!==i.min||o.ymax!==i.max;return Object.assign(o,n),s}const fg=t=>0===t||1===t,vg=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*zm/i),bg=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*zm/i)+1,yg={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*Bm),easeOutSine:t=>Math.sin(t*Bm),easeInOutSine:t=>-.5*(Math.cos(Lm*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>fg(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>fg(t)?t:vg(t,.075,.3),easeOutElastic:t=>fg(t)?t:bg(t,.075,.3),easeInOutElastic(t){const e=.1125;return fg(t)?t:t<.5?.5*vg(2*t,e,.45):.5+.5*bg(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-yg.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*yg.easeInBounce(2*t):.5*yg.easeOutBounce(2*t-1)+.5};function xg(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function _g(t){return xg(t)?t:new dm(t)}function wg(t){return xg(t)?t:new dm(t).saturate(.5).darken(.1).hexString()}const kg=["x","y","borderWidth","radius","tension"],Cg=["color","borderColor","backgroundColor"];const Sg=new Map;function Ag(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let o=Sg.get(i);return o||(o=new Intl.NumberFormat(t,e),Sg.set(i,o)),o}(e,i).format(t)}const Eg={values:t=>pm(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const o=this.chart.options.locale;let n,s=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(n="scientific"),s=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const r=Um(Math.abs(s)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:n,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Ag(t,o,l)},logarithmic(t,e,i){if(0===t)return"0";const o=i[e].significand||t/Math.pow(10,Math.floor(Um(t)));return[1,2,3,5,10,15].includes(o)||e>.8*i.length?Eg.numeric.call(this,t,e,i):""}};var $g={formatters:Eg};const Tg=Object.create(null),Dg=Object.create(null);function Mg(t,e){if(!e)return t;const i=e.split(".");for(let e=0,o=i.length;e<o;++e){const o=i[e];t=t[o]||(t[o]=Object.create(null))}return t}function Ig(t,e,i){return"string"==typeof e?Sm(Mg(t,e),i):Sm(Mg(t,""),e)}class Og{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>wg(e.backgroundColor),this.hoverBorderColor=(t,e)=>wg(e.borderColor),this.hoverColor=(t,e)=>wg(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return Ig(this,t,e)}get(t){return Mg(this,t)}describe(t,e){return Ig(Dg,t,e)}override(t,e){return Ig(Tg,t,e)}route(t,e,i,o){const n=Mg(this,t),s=Mg(this,i),r="_"+e;Object.defineProperties(n,{[r]:{value:n[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[r],e=s[o];return mm(t)?Object.assign({},e,t):vm(t,e)},set(t){this[r]=t}}})}apply(t){t.forEach((t=>t(this)))}}var Lg=new Og({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:Cg},numbers:{type:"number",properties:kg}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:$g.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function zg(t,e,i,o,n){let s=e[n];return s||(s=e[n]=t.measureText(n).width,i.push(n)),s>o&&(o=s),o}function Pg(t,e,i,o){let n=(o=o||{}).data=o.data||{},s=o.garbageCollect=o.garbageCollect||[];o.font!==e&&(n=o.data={},s=o.garbageCollect=[],o.font=e),t.save(),t.font=e;let r=0;const a=i.length;let l,d,c,h,u;for(l=0;l<a;l++)if(h=i[l],null==h||pm(h)){if(pm(h))for(d=0,c=h.length;d<c;d++)u=h[d],null==u||pm(u)||(r=zg(t,n,s,r,u))}else r=zg(t,n,s,r,h);t.restore();const p=s.length/2;if(p>i.length){for(l=0;l<p;l++)delete n[s[l]];s.splice(0,p)}return r}function Rg(t,e,i){const o=t.currentDevicePixelRatio,n=0!==i?Math.max(i/2,.5):0;return Math.round((e-n)*o)/o+n}function Ng(t,e){(e||t)&&((e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function Bg(t,e,i,o){Fg(t,e,i,o,null)}function Fg(t,e,i,o,n){let s,r,a,l,d,c,h,u;const p=e.pointStyle,m=e.rotation,g=e.radius;let f=(m||0)*Nm;if(p&&"object"==typeof p&&(s=p.toString(),"[object HTMLImageElement]"===s||"[object HTMLCanvasElement]"===s))return t.save(),t.translate(i,o),t.rotate(f),t.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),void t.restore();if(!(isNaN(g)||g<=0)){switch(t.beginPath(),p){default:n?t.ellipse(i,o,n/2,g,0,0,zm):t.arc(i,o,g,0,zm),t.closePath();break;case"triangle":c=n?n/2:g,t.moveTo(i+Math.sin(f)*c,o-Math.cos(f)*g),f+=qm,t.lineTo(i+Math.sin(f)*c,o-Math.cos(f)*g),f+=qm,t.lineTo(i+Math.sin(f)*c,o-Math.cos(f)*g),t.closePath();break;case"rectRounded":d=.516*g,l=g-d,r=Math.cos(f+Fm)*l,h=Math.cos(f+Fm)*(n?n/2-d:l),a=Math.sin(f+Fm)*l,u=Math.sin(f+Fm)*(n?n/2-d:l),t.arc(i-h,o-a,d,f-Lm,f-Bm),t.arc(i+u,o-r,d,f-Bm,f),t.arc(i+h,o+a,d,f,f+Bm),t.arc(i-u,o+r,d,f+Bm,f+Lm),t.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*g,c=n?n/2:l,t.rect(i-c,o-l,2*c,2*l);break}f+=Fm;case"rectRot":h=Math.cos(f)*(n?n/2:g),r=Math.cos(f)*g,a=Math.sin(f)*g,u=Math.sin(f)*(n?n/2:g),t.moveTo(i-h,o-a),t.lineTo(i+u,o-r),t.lineTo(i+h,o+a),t.lineTo(i-u,o+r),t.closePath();break;case"crossRot":f+=Fm;case"cross":h=Math.cos(f)*(n?n/2:g),r=Math.cos(f)*g,a=Math.sin(f)*g,u=Math.sin(f)*(n?n/2:g),t.moveTo(i-h,o-a),t.lineTo(i+h,o+a),t.moveTo(i+u,o-r),t.lineTo(i-u,o+r);break;case"star":h=Math.cos(f)*(n?n/2:g),r=Math.cos(f)*g,a=Math.sin(f)*g,u=Math.sin(f)*(n?n/2:g),t.moveTo(i-h,o-a),t.lineTo(i+h,o+a),t.moveTo(i+u,o-r),t.lineTo(i-u,o+r),f+=Fm,h=Math.cos(f)*(n?n/2:g),r=Math.cos(f)*g,a=Math.sin(f)*g,u=Math.sin(f)*(n?n/2:g),t.moveTo(i-h,o-a),t.lineTo(i+h,o+a),t.moveTo(i+u,o-r),t.lineTo(i-u,o+r);break;case"line":r=n?n/2:Math.cos(f)*g,a=Math.sin(f)*g,t.moveTo(i-r,o-a),t.lineTo(i+r,o+a);break;case"dash":t.moveTo(i,o),t.lineTo(i+Math.cos(f)*(n?n/2:g),o+Math.sin(f)*g);break;case!1:t.closePath()}t.fill(),e.borderWidth>0&&t.stroke()}}function qg(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function Ug(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function jg(t){t.restore()}function Vg(t,e,i,o,n){if(!e)return t.lineTo(i.x,i.y);if("middle"===n){const o=(e.x+i.x)/2;t.lineTo(o,e.y),t.lineTo(o,i.y)}else"after"===n!=!!o?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function Hg(t,e,i,o){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(o?e.cp1x:e.cp2x,o?e.cp1y:e.cp2y,o?i.cp2x:i.cp1x,o?i.cp2y:i.cp1y,i.x,i.y)}function Wg(t,e,i,o,n){if(n.strikethrough||n.underline){const s=t.measureText(o),r=e-s.actualBoundingBoxLeft,a=e+s.actualBoundingBoxRight,l=i-s.actualBoundingBoxAscent,d=i+s.actualBoundingBoxDescent,c=n.strikethrough?(l+d)/2:d;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=n.decorationWidth||2,t.moveTo(r,c),t.lineTo(a,c),t.stroke()}}function Zg(t,e){const i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}function Yg(t,e,i,o,n,s={}){const r=pm(e)?e:[e],a=s.strokeWidth>0&&""!==s.strokeColor;let l,d;for(t.save(),t.font=n.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),um(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,s),l=0;l<r.length;++l)d=r[l],s.backdrop&&Zg(t,s.backdrop),a&&(s.strokeColor&&(t.strokeStyle=s.strokeColor),um(s.strokeWidth)||(t.lineWidth=s.strokeWidth),t.strokeText(d,i,o,s.maxWidth)),t.fillText(d,i,o,s.maxWidth),Wg(t,i,o,d,s),o+=Number(n.lineHeight);t.restore()}function Gg(t,e){const{x:i,y:o,w:n,h:s,radius:r}=e;t.arc(i+r.topLeft,o+r.topLeft,r.topLeft,1.5*Lm,Lm,!0),t.lineTo(i,o+s-r.bottomLeft),t.arc(i+r.bottomLeft,o+s-r.bottomLeft,r.bottomLeft,Lm,Bm,!0),t.lineTo(i+n-r.bottomRight,o+s),t.arc(i+n-r.bottomRight,o+s-r.bottomRight,r.bottomRight,Bm,0,!0),t.lineTo(i+n,o+r.topRight),t.arc(i+n-r.topRight,o+r.topRight,r.topRight,0,-Bm,!0),t.lineTo(i+r.topLeft,o)}const Kg=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Xg=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Qg(t,e){const i=(""+t).match(Kg);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}const Jg=t=>+t||0;function tf(t,e){const i={},o=mm(e),n=o?Object.keys(e):e,s=mm(t)?o?i=>vm(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of n)i[t]=Jg(s(t));return i}function ef(t){return tf(t,{top:"y",right:"x",bottom:"y",left:"x"})}function of(t){return tf(t,["topLeft","topRight","bottomLeft","bottomRight"])}function nf(t){const e=ef(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function sf(t,e){t=t||{},e=e||Lg.font;let i=vm(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let o=vm(t.style,e.style);o&&!(""+o).match(Xg)&&(console.warn('Invalid font style specified: "'+o+'"'),o=void 0);const n={family:vm(t.family,e.family),lineHeight:Qg(vm(t.lineHeight,e.lineHeight),i),size:i,style:o,weight:vm(t.weight,e.weight),string:""};return n.string=function(t){return!t||um(t.size)||um(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(n),n}function rf(t,e,i,o){let n,s,r,a=!0;for(n=0,s=t.length;n<s;++n)if(r=t[n],void 0!==r&&(void 0!==e&&"function"==typeof r&&(r=r(e),a=!1),void 0!==i&&pm(r)&&(r=r[i%r.length],a=!1),void 0!==r))return o&&!a&&(o.cacheable=!1),r}function af(t,e){return Object.assign(Object.create(t),e)}function lf(t,e=[""],i,o,n=(()=>t[0])){const s=i||t;void 0===o&&(o=yf("_fallback",t));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:s,_fallback:o,_getTarget:n,override:i=>lf([i,...t],e,s,o)};return new Proxy(r,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,o)=>pf(i,o,(()=>function(t,e,i,o){let n;for(const s of e)if(n=yf(hf(s,t),i),void 0!==n)return uf(t,n)?vf(i,o,t,n):n}(o,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>xf(t).includes(e),ownKeys:t=>xf(t),set(t,e,i){const o=t._storage||(t._storage=n());return t[e]=o[e]=i,delete t._keys,!0}})}function df(t,e,i,o){const n={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:cf(t,o),setContext:e=>df(t,e,i,o),override:n=>df(t.override(n),e,i,o)};return new Proxy(n,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>pf(t,e,(()=>function(t,e,i){const{_proxy:o,_context:n,_subProxy:s,_descriptors:r}=t;let a=o[e];Im(a)&&r.isScriptable(e)&&(a=function(t,e,i,o){const{_proxy:n,_context:s,_subProxy:r,_stack:a}=i;if(a.has(t))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+t);a.add(t);let l=e(s,r||o);a.delete(t),uf(t,l)&&(l=vf(n._scopes,n,t,l));return l}(e,a,t,i));pm(a)&&a.length&&(a=function(t,e,i,o){const{_proxy:n,_context:s,_subProxy:r,_descriptors:a}=i;if(void 0!==s.index&&o(t))return e[s.index%e.length];if(mm(e[0])){const i=e,o=n._scopes.filter((t=>t!==i));e=[];for(const l of i){const i=vf(o,n,t,l);e.push(df(i,s,r&&r[t],a))}}return e}(e,a,t,r.isIndexable));uf(e,a)&&(a=df(a,n,s&&s[e],r));return a}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,o)=>(t[i]=o,delete e[i],!0)})}function cf(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:o=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:i,indexable:o,isScriptable:Im(i)?i:()=>i,isIndexable:Im(o)?o:()=>o}}const hf=(t,e)=>t?t+Dm(e):e,uf=(t,e)=>mm(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function pf(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const o=i();return t[e]=o,o}function mf(t,e,i){return Im(t)?t(e,i):t}const gf=(t,e)=>!0===t?e:"string"==typeof t?Tm(e,t):void 0;function ff(t,e,i,o,n){for(const s of e){const e=gf(i,s);if(e){t.add(e);const s=mf(e._fallback,i,n);if(void 0!==s&&s!==i&&s!==o)return s}else if(!1===e&&void 0!==o&&i!==o)return null}return!1}function vf(t,e,i,o){const n=e._rootScopes,s=mf(e._fallback,i,o),r=[...t,...n],a=new Set;a.add(o);let l=bf(a,r,i,s||i,o);return null!==l&&((void 0===s||s===i||(l=bf(a,r,s,l,o),null!==l))&&lf(Array.from(a),[""],n,s,(()=>function(t,e,i){const o=t._getTarget();e in o||(o[e]={});const n=o[e];if(pm(n)&&mm(i))return i;return n||{}}(e,i,o))))}function bf(t,e,i,o,n){for(;i;)i=ff(t,e,i,o,n);return i}function yf(t,e){for(const i of e){if(!i)continue;const e=i[t];if(void 0!==e)return e}}function xf(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}function _f(t,e,i,o){const{iScale:n}=t,{key:s="r"}=this._parsing,r=new Array(o);let a,l,d,c;for(a=0,l=o;a<l;++a)d=a+i,c=e[d],r[a]={r:n.parse(Tm(c,s),d)};return r}const wf=Number.EPSILON||1e-14,kf=(t,e)=>e<t.length&&!t[e].skip&&t[e],Cf=t=>"x"===t?"y":"x";function Sf(t,e,i,o){const n=t.skip?e:t,s=e,r=i.skip?e:i,a=Qm(s,n),l=Qm(r,s);let d=a/(a+l),c=l/(a+l);d=isNaN(d)?0:d,c=isNaN(c)?0:c;const h=o*d,u=o*c;return{previous:{x:s.x-h*(r.x-n.x),y:s.y-h*(r.y-n.y)},next:{x:s.x+u*(r.x-n.x),y:s.y+u*(r.y-n.y)}}}function Af(t,e="x"){const i=Cf(e),o=t.length,n=Array(o).fill(0),s=Array(o);let r,a,l,d=kf(t,0);for(r=0;r<o;++r)if(a=l,l=d,d=kf(t,r+1),l){if(d){const t=d[e]-l[e];n[r]=0!==t?(d[i]-l[i])/t:0}s[r]=a?d?jm(n[r-1])!==jm(n[r])?0:(n[r-1]+n[r])/2:n[r-1]:n[r]}!function(t,e,i){const o=t.length;let n,s,r,a,l,d=kf(t,0);for(let c=0;c<o-1;++c)l=d,d=kf(t,c+1),l&&d&&(Vm(e[c],0,wf)?i[c]=i[c+1]=0:(n=i[c]/e[c],s=i[c+1]/e[c],a=Math.pow(n,2)+Math.pow(s,2),a<=9||(r=3/Math.sqrt(a),i[c]=n*r*e[c],i[c+1]=s*r*e[c])))}(t,n,s),function(t,e,i="x"){const o=Cf(i),n=t.length;let s,r,a,l=kf(t,0);for(let d=0;d<n;++d){if(r=a,a=l,l=kf(t,d+1),!a)continue;const n=a[i],c=a[o];r&&(s=(n-r[i])/3,a[`cp1${i}`]=n-s,a[`cp1${o}`]=c-s*e[d]),l&&(s=(l[i]-n)/3,a[`cp2${i}`]=n+s,a[`cp2${o}`]=c+s*e[d])}}(t,s,e)}function Ef(t,e,i){return Math.max(Math.min(t,i),e)}function $f(t,e,i,o,n){let s,r,a,l;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)Af(t,n);else{let i=o?t[t.length-1]:t[0];for(s=0,r=t.length;s<r;++s)a=t[s],l=Sf(i,a,t[Math.min(s+1,r-(o?0:1))%r],e.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,i=a}e.capBezierPoints&&function(t,e){let i,o,n,s,r,a=qg(t[0],e);for(i=0,o=t.length;i<o;++i)r=s,s=a,a=i<o-1&&qg(t[i+1],e),s&&(n=t[i],r&&(n.cp1x=Ef(n.cp1x,e.left,e.right),n.cp1y=Ef(n.cp1y,e.top,e.bottom)),a&&(n.cp2x=Ef(n.cp2x,e.left,e.right),n.cp2y=Ef(n.cp2y,e.top,e.bottom)))}(t,i)}function Tf(){return"undefined"!=typeof window&&"undefined"!=typeof document}function Df(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function Mf(t,e,i){let o;return"string"==typeof t?(o=parseInt(t,10),-1!==t.indexOf("%")&&(o=o/100*e.parentNode[i])):o=t,o}const If=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);const Of=["top","right","bottom","left"];function Lf(t,e,i){const o={};i=i?"-"+i:"";for(let n=0;n<4;n++){const s=Of[n];o[s]=parseFloat(t[e+"-"+s+i])||0}return o.width=o.left+o.right,o.height=o.top+o.bottom,o}const zf=(t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot);function Pf(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:o}=e,n=If(i),s="border-box"===n.boxSizing,r=Lf(n,"padding"),a=Lf(n,"border","width"),{x:l,y:d,box:c}=function(t,e){const i=t.touches,o=i&&i.length?i[0]:t,{offsetX:n,offsetY:s}=o;let r,a,l=!1;if(zf(n,s,t.target))r=n,a=s;else{const t=e.getBoundingClientRect();r=o.clientX-t.left,a=o.clientY-t.top,l=!0}return{x:r,y:a,box:l}}(t,i),h=r.left+(c&&a.left),u=r.top+(c&&a.top);let{width:p,height:m}=e;return s&&(p-=r.width+a.width,m-=r.height+a.height),{x:Math.round((l-h)/p*i.width/o),y:Math.round((d-u)/m*i.height/o)}}const Rf=t=>Math.round(10*t)/10;function Nf(t,e,i,o){const n=If(t),s=Lf(n,"margin"),r=Mf(n.maxWidth,t,"clientWidth")||Rm,a=Mf(n.maxHeight,t,"clientHeight")||Rm,l=function(t,e,i){let o,n;if(void 0===e||void 0===i){const s=t&&Df(t);if(s){const t=s.getBoundingClientRect(),r=If(s),a=Lf(r,"border","width"),l=Lf(r,"padding");e=t.width-l.width-a.width,i=t.height-l.height-a.height,o=Mf(r.maxWidth,s,"clientWidth"),n=Mf(r.maxHeight,s,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:o||Rm,maxHeight:n||Rm}}(t,e,i);let{width:d,height:c}=l;if("content-box"===n.boxSizing){const t=Lf(n,"border","width"),e=Lf(n,"padding");d-=e.width+t.width,c-=e.height+t.height}d=Math.max(0,d-s.width),c=Math.max(0,o?d/o:c-s.height),d=Rf(Math.min(d,r,l.maxWidth)),c=Rf(Math.min(c,a,l.maxHeight)),d&&!c&&(c=Rf(d/2));return(void 0!==e||void 0!==i)&&o&&l.height&&c>l.height&&(c=l.height,d=Rf(Math.floor(c*o))),{width:d,height:c}}function Bf(t,e,i){const o=e||1,n=Math.floor(t.height*o),s=Math.floor(t.width*o);t.height=Math.floor(t.height),t.width=Math.floor(t.width);const r=t.canvas;return r.style&&(i||!r.style.height&&!r.style.width)&&(r.style.height=`${t.height}px`,r.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==o||r.height!==n||r.width!==s)&&(t.currentDevicePixelRatio=o,r.height=n,r.width=s,t.ctx.setTransform(o,0,0,o,0,0),!0)}const Ff=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};Tf()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(t){}return t}();function qf(t,e){const i=function(t,e){return If(t).getPropertyValue(e)}(t,e),o=i&&i.match(/^(\d+)(\.\d+)?px$/);return o?+o[1]:void 0}function Uf(t,e,i,o){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function jf(t,e,i,o){return{x:t.x+i*(e.x-t.x),y:"middle"===o?i<.5?t.y:e.y:"after"===o?i<1?t.y:e.y:i>0?e.y:t.y}}function Vf(t,e,i,o){const n={x:t.cp2x,y:t.cp2y},s={x:e.cp1x,y:e.cp1y},r=Uf(t,n,i),a=Uf(n,s,i),l=Uf(s,e,i),d=Uf(r,a,i),c=Uf(a,l,i);return Uf(d,c,i)}function Hf(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function Wf(t,e){let i,o;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,o=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=o)}function Zf(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Yf(t){return"angle"===t?{between:eg,compare:Jm,normalize:tg}:{between:og,compare:(t,e)=>t-e,normalize:t=>t}}function Gf({start:t,end:e,count:i,loop:o,style:n}){return{start:t%i,end:e%i,loop:o&&(e-t+1)%i==0,style:n}}function Kf(t,e,i){if(!i)return[t];const{property:o,start:n,end:s}=i,r=e.length,{compare:a,between:l,normalize:d}=Yf(o),{start:c,end:h,loop:u,style:p}=function(t,e,i){const{property:o,start:n,end:s}=i,{between:r,normalize:a}=Yf(o),l=e.length;let d,c,{start:h,end:u,loop:p}=t;if(p){for(h+=l,u+=l,d=0,c=l;d<c&&r(a(e[h%l][o]),n,s);++d)h--,u--;h%=l,u%=l}return u<h&&(u+=l),{start:h,end:u,loop:p,style:t.style}}(t,e,i),m=[];let g,f,v,b=!1,y=null;const x=()=>b||l(n,v,g)&&0!==a(n,v),_=()=>!b||0===a(s,g)||l(s,v,g);for(let t=c,i=c;t<=h;++t)f=e[t%r],f.skip||(g=d(f[o]),g!==v&&(b=l(g,n,s),null===y&&x()&&(y=0===a(g,n)?t:i),null!==y&&_()&&(m.push(Gf({start:y,end:t,loop:u,count:r,style:p})),y=null),i=t,v=g));return null!==y&&m.push(Gf({start:y,end:h,loop:u,count:r,style:p})),m}function Xf(t,e){const i=[],o=t.segments;for(let n=0;n<o.length;n++){const s=Kf(o[n],t.points,e);s.length&&i.push(...s)}return i}function Qf(t,e,i,o){return o&&o.setContext&&i?function(t,e,i,o){const n=t._chart.getContext(),s=Jf(t.options),{_datasetIndex:r,options:{spanGaps:a}}=t,l=i.length,d=[];let c=s,h=e[0].start,u=h;function p(t,e,o,n){const s=a?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=s;for(;i[e%l].skip;)e+=s;t%l!=e%l&&(d.push({start:t%l,end:e%l,loop:o,style:n}),c=n,h=e%l)}}for(const t of e){h=a?h:t.start;let e,s=i[h%l];for(u=h+1;u<=t.end;u++){const a=i[u%l];e=Jf(o.setContext(af(n,{type:"segment",p0:s,p1:a,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:r}))),tv(e,c)&&p(h,u-1,t.loop,c),s=a,c=e}h<u-1&&p(h,u-1,t.loop,c)}return d}(t,e,i,o):e}function Jf(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function tv(t,e){if(!e)return!1;const i=[],o=function(t,e){return xg(e)?(i.includes(e)||i.push(e),i.indexOf(e)):e};return JSON.stringify(t,o)!==JSON.stringify(e,o)}
11045
+ */function cm(){}const hm=(()=>{let t=0;return()=>t++})();function um(t){return null==t}function pm(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function mm(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function gm(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function fm(t,e){return gm(t)?t:e}function vm(t,e){return void 0===t?e:t}const ym=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function bm(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function xm(t,e,i,o){let n,s,r;if(pm(t))if(s=t.length,o)for(n=s-1;n>=0;n--)e.call(i,t[n],n);else for(n=0;n<s;n++)e.call(i,t[n],n);else if(mm(t))for(r=Object.keys(t),s=r.length,n=0;n<s;n++)e.call(i,t[r[n]],r[n])}function _m(t,e){let i,o,n,s;if(!t||!e||t.length!==e.length)return!1;for(i=0,o=t.length;i<o;++i)if(n=t[i],s=e[i],n.datasetIndex!==s.datasetIndex||n.index!==s.index)return!1;return!0}function wm(t){if(pm(t))return t.map(wm);if(mm(t)){const e=Object.create(null),i=Object.keys(t),o=i.length;let n=0;for(;n<o;++n)e[i[n]]=wm(t[i[n]]);return e}return t}function km(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function Cm(t,e,i,o){if(!km(t))return;const n=e[t],s=i[t];mm(n)&&mm(s)?Sm(n,s,o):e[t]=wm(s)}function Sm(t,e,i){const o=pm(e)?e:[e],n=o.length;if(!mm(t))return t;const s=(i=i||{}).merger||Cm;let r;for(let e=0;e<n;++e){if(r=o[e],!mm(r))continue;const n=Object.keys(r);for(let e=0,o=n.length;e<o;++e)s(n[e],t,r,i)}return t}function Am(t,e){return Sm(t,e,{merger:Em})}function Em(t,e,i){if(!km(t))return;const o=e[t],n=i[t];mm(o)&&mm(n)?Am(o,n):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=wm(n))}const $m={"":t=>t,x:t=>t.x,y:t=>t.y};function Tm(t,e){const i=$m[e]||($m[e]=function(t){const e=function(t){const e=t.split("."),i=[];let o="";for(const t of e)o+=t,o.endsWith("\\")?o=o.slice(0,-1)+".":(i.push(o),o="");return i}(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function Dm(t){return t.charAt(0).toUpperCase()+t.slice(1)}const Mm=t=>void 0!==t,Im=t=>"function"==typeof t,Om=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};const Lm=Math.PI,zm=2*Lm,Pm=zm+Lm,Rm=Number.POSITIVE_INFINITY,Nm=Lm/180,Bm=Lm/2,Fm=Lm/4,qm=2*Lm/3,Um=Math.log10,jm=Math.sign;function Vm(t,e,i){return Math.abs(t-e)<i}function Hm(t){const e=Math.round(t);t=Vm(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(Um(t))),o=t/i;return(o<=1?1:o<=2?2:o<=5?5:10)*i}function Wm(t){return!function(t){return"symbol"==typeof t||"object"==typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function Zm(t,e,i){let o,n,s;for(o=0,n=t.length;o<n;o++)s=t[o][i],isNaN(s)||(e.min=Math.min(e.min,s),e.max=Math.max(e.max,s))}function Ym(t){return t*(Lm/180)}function Gm(t){return t*(180/Lm)}function Km(t){if(!gm(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function Xm(t,e){const i=e.x-t.x,o=e.y-t.y,n=Math.sqrt(i*i+o*o);let s=Math.atan2(o,i);return s<-.5*Lm&&(s+=zm),{angle:s,distance:n}}function Qm(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Jm(t,e){return(t-e+Pm)%zm-Lm}function tg(t){return(t%zm+zm)%zm}function eg(t,e,i,o){const n=tg(t),s=tg(e),r=tg(i),a=tg(s-n),l=tg(r-n),d=tg(n-s),c=tg(n-r);return n===s||n===r||o&&s===r||a>l&&d<c}function ig(t,e,i){return Math.max(e,Math.min(i,t))}function og(t,e,i,o=1e-6){return t>=Math.min(e,i)-o&&t<=Math.max(e,i)+o}function ng(t,e,i){i=i||(i=>t[i]<e);let o,n=t.length-1,s=0;for(;n-s>1;)o=s+n>>1,i(o)?s=o:n=o;return{lo:s,hi:n}}const sg=(t,e,i,o)=>ng(t,i,o?o=>{const n=t[o][e];return n<i||n===i&&t[o+1][e]===i}:o=>t[o][e]<i),rg=(t,e,i)=>ng(t,i,(o=>t[o][e]>=i));const ag=["push","pop","shift","splice","unshift"];function lg(t,e){const i=t._chartjs;if(!i)return;const o=i.listeners,n=o.indexOf(e);-1!==n&&o.splice(n,1),o.length>0||(ag.forEach((e=>{delete t[e]})),delete t._chartjs)}function dg(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const cg="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function hg(t,e){let i=[],o=!1;return function(...n){i=n,o||(o=!0,cg.call(window,(()=>{o=!1,t.apply(e,i)})))}}const ug=t=>"start"===t?"left":"end"===t?"right":"center",pg=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2;function mg(t,e,i){const o=e.length;let n=0,s=o;if(t._sorted){const{iScale:r,vScale:a,_parsed:l}=t,d=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,c=r.axis,{min:h,max:u,minDefined:p,maxDefined:m}=r.getUserBounds();if(p){if(n=Math.min(sg(l,c,h).lo,i?o:sg(e,c,r.getPixelForValue(h)).lo),d){const t=l.slice(0,n+1).reverse().findIndex((t=>!um(t[a.axis])));n-=Math.max(0,t)}n=ig(n,0,o-1)}if(m){let t=Math.max(sg(l,r.axis,u,!0).hi+1,i?0:sg(e,c,r.getPixelForValue(u),!0).hi+1);if(d){const e=l.slice(t-1).findIndex((t=>!um(t[a.axis])));t+=Math.max(0,e)}s=ig(t,n,o)-n}else s=o-n}return{start:n,count:s}}function gg(t){const{xScale:e,yScale:i,_scaleRanges:o}=t,n={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!o)return t._scaleRanges=n,!0;const s=o.xmin!==e.min||o.xmax!==e.max||o.ymin!==i.min||o.ymax!==i.max;return Object.assign(o,n),s}const fg=t=>0===t||1===t,vg=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*zm/i),yg=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*zm/i)+1,bg={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*Bm),easeOutSine:t=>Math.sin(t*Bm),easeInOutSine:t=>-.5*(Math.cos(Lm*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>fg(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>fg(t)?t:vg(t,.075,.3),easeOutElastic:t=>fg(t)?t:yg(t,.075,.3),easeInOutElastic(t){const e=.1125;return fg(t)?t:t<.5?.5*vg(2*t,e,.45):.5+.5*yg(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-bg.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*bg.easeInBounce(2*t):.5*bg.easeOutBounce(2*t-1)+.5};function xg(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function _g(t){return xg(t)?t:new dm(t)}function wg(t){return xg(t)?t:new dm(t).saturate(.5).darken(.1).hexString()}const kg=["x","y","borderWidth","radius","tension"],Cg=["color","borderColor","backgroundColor"];const Sg=new Map;function Ag(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let o=Sg.get(i);return o||(o=new Intl.NumberFormat(t,e),Sg.set(i,o)),o}(e,i).format(t)}const Eg={values:t=>pm(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const o=this.chart.options.locale;let n,s=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(n="scientific"),s=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const r=Um(Math.abs(s)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:n,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Ag(t,o,l)},logarithmic(t,e,i){if(0===t)return"0";const o=i[e].significand||t/Math.pow(10,Math.floor(Um(t)));return[1,2,3,5,10,15].includes(o)||e>.8*i.length?Eg.numeric.call(this,t,e,i):""}};var $g={formatters:Eg};const Tg=Object.create(null),Dg=Object.create(null);function Mg(t,e){if(!e)return t;const i=e.split(".");for(let e=0,o=i.length;e<o;++e){const o=i[e];t=t[o]||(t[o]=Object.create(null))}return t}function Ig(t,e,i){return"string"==typeof e?Sm(Mg(t,e),i):Sm(Mg(t,""),e)}class Og{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>wg(e.backgroundColor),this.hoverBorderColor=(t,e)=>wg(e.borderColor),this.hoverColor=(t,e)=>wg(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return Ig(this,t,e)}get(t){return Mg(this,t)}describe(t,e){return Ig(Dg,t,e)}override(t,e){return Ig(Tg,t,e)}route(t,e,i,o){const n=Mg(this,t),s=Mg(this,i),r="_"+e;Object.defineProperties(n,{[r]:{value:n[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[r],e=s[o];return mm(t)?Object.assign({},e,t):vm(t,e)},set(t){this[r]=t}}})}apply(t){t.forEach((t=>t(this)))}}var Lg=new Og({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:Cg},numbers:{type:"number",properties:kg}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:$g.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function zg(t,e,i,o,n){let s=e[n];return s||(s=e[n]=t.measureText(n).width,i.push(n)),s>o&&(o=s),o}function Pg(t,e,i,o){let n=(o=o||{}).data=o.data||{},s=o.garbageCollect=o.garbageCollect||[];o.font!==e&&(n=o.data={},s=o.garbageCollect=[],o.font=e),t.save(),t.font=e;let r=0;const a=i.length;let l,d,c,h,u;for(l=0;l<a;l++)if(h=i[l],null==h||pm(h)){if(pm(h))for(d=0,c=h.length;d<c;d++)u=h[d],null==u||pm(u)||(r=zg(t,n,s,r,u))}else r=zg(t,n,s,r,h);t.restore();const p=s.length/2;if(p>i.length){for(l=0;l<p;l++)delete n[s[l]];s.splice(0,p)}return r}function Rg(t,e,i){const o=t.currentDevicePixelRatio,n=0!==i?Math.max(i/2,.5):0;return Math.round((e-n)*o)/o+n}function Ng(t,e){(e||t)&&((e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function Bg(t,e,i,o){Fg(t,e,i,o,null)}function Fg(t,e,i,o,n){let s,r,a,l,d,c,h,u;const p=e.pointStyle,m=e.rotation,g=e.radius;let f=(m||0)*Nm;if(p&&"object"==typeof p&&(s=p.toString(),"[object HTMLImageElement]"===s||"[object HTMLCanvasElement]"===s))return t.save(),t.translate(i,o),t.rotate(f),t.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),void t.restore();if(!(isNaN(g)||g<=0)){switch(t.beginPath(),p){default:n?t.ellipse(i,o,n/2,g,0,0,zm):t.arc(i,o,g,0,zm),t.closePath();break;case"triangle":c=n?n/2:g,t.moveTo(i+Math.sin(f)*c,o-Math.cos(f)*g),f+=qm,t.lineTo(i+Math.sin(f)*c,o-Math.cos(f)*g),f+=qm,t.lineTo(i+Math.sin(f)*c,o-Math.cos(f)*g),t.closePath();break;case"rectRounded":d=.516*g,l=g-d,r=Math.cos(f+Fm)*l,h=Math.cos(f+Fm)*(n?n/2-d:l),a=Math.sin(f+Fm)*l,u=Math.sin(f+Fm)*(n?n/2-d:l),t.arc(i-h,o-a,d,f-Lm,f-Bm),t.arc(i+u,o-r,d,f-Bm,f),t.arc(i+h,o+a,d,f,f+Bm),t.arc(i-u,o+r,d,f+Bm,f+Lm),t.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*g,c=n?n/2:l,t.rect(i-c,o-l,2*c,2*l);break}f+=Fm;case"rectRot":h=Math.cos(f)*(n?n/2:g),r=Math.cos(f)*g,a=Math.sin(f)*g,u=Math.sin(f)*(n?n/2:g),t.moveTo(i-h,o-a),t.lineTo(i+u,o-r),t.lineTo(i+h,o+a),t.lineTo(i-u,o+r),t.closePath();break;case"crossRot":f+=Fm;case"cross":h=Math.cos(f)*(n?n/2:g),r=Math.cos(f)*g,a=Math.sin(f)*g,u=Math.sin(f)*(n?n/2:g),t.moveTo(i-h,o-a),t.lineTo(i+h,o+a),t.moveTo(i+u,o-r),t.lineTo(i-u,o+r);break;case"star":h=Math.cos(f)*(n?n/2:g),r=Math.cos(f)*g,a=Math.sin(f)*g,u=Math.sin(f)*(n?n/2:g),t.moveTo(i-h,o-a),t.lineTo(i+h,o+a),t.moveTo(i+u,o-r),t.lineTo(i-u,o+r),f+=Fm,h=Math.cos(f)*(n?n/2:g),r=Math.cos(f)*g,a=Math.sin(f)*g,u=Math.sin(f)*(n?n/2:g),t.moveTo(i-h,o-a),t.lineTo(i+h,o+a),t.moveTo(i+u,o-r),t.lineTo(i-u,o+r);break;case"line":r=n?n/2:Math.cos(f)*g,a=Math.sin(f)*g,t.moveTo(i-r,o-a),t.lineTo(i+r,o+a);break;case"dash":t.moveTo(i,o),t.lineTo(i+Math.cos(f)*(n?n/2:g),o+Math.sin(f)*g);break;case!1:t.closePath()}t.fill(),e.borderWidth>0&&t.stroke()}}function qg(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function Ug(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function jg(t){t.restore()}function Vg(t,e,i,o,n){if(!e)return t.lineTo(i.x,i.y);if("middle"===n){const o=(e.x+i.x)/2;t.lineTo(o,e.y),t.lineTo(o,i.y)}else"after"===n!=!!o?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function Hg(t,e,i,o){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(o?e.cp1x:e.cp2x,o?e.cp1y:e.cp2y,o?i.cp2x:i.cp1x,o?i.cp2y:i.cp1y,i.x,i.y)}function Wg(t,e,i,o,n){if(n.strikethrough||n.underline){const s=t.measureText(o),r=e-s.actualBoundingBoxLeft,a=e+s.actualBoundingBoxRight,l=i-s.actualBoundingBoxAscent,d=i+s.actualBoundingBoxDescent,c=n.strikethrough?(l+d)/2:d;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=n.decorationWidth||2,t.moveTo(r,c),t.lineTo(a,c),t.stroke()}}function Zg(t,e){const i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}function Yg(t,e,i,o,n,s={}){const r=pm(e)?e:[e],a=s.strokeWidth>0&&""!==s.strokeColor;let l,d;for(t.save(),t.font=n.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),um(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,s),l=0;l<r.length;++l)d=r[l],s.backdrop&&Zg(t,s.backdrop),a&&(s.strokeColor&&(t.strokeStyle=s.strokeColor),um(s.strokeWidth)||(t.lineWidth=s.strokeWidth),t.strokeText(d,i,o,s.maxWidth)),t.fillText(d,i,o,s.maxWidth),Wg(t,i,o,d,s),o+=Number(n.lineHeight);t.restore()}function Gg(t,e){const{x:i,y:o,w:n,h:s,radius:r}=e;t.arc(i+r.topLeft,o+r.topLeft,r.topLeft,1.5*Lm,Lm,!0),t.lineTo(i,o+s-r.bottomLeft),t.arc(i+r.bottomLeft,o+s-r.bottomLeft,r.bottomLeft,Lm,Bm,!0),t.lineTo(i+n-r.bottomRight,o+s),t.arc(i+n-r.bottomRight,o+s-r.bottomRight,r.bottomRight,Bm,0,!0),t.lineTo(i+n,o+r.topRight),t.arc(i+n-r.topRight,o+r.topRight,r.topRight,0,-Bm,!0),t.lineTo(i+r.topLeft,o)}const Kg=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Xg=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Qg(t,e){const i=(""+t).match(Kg);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}const Jg=t=>+t||0;function tf(t,e){const i={},o=mm(e),n=o?Object.keys(e):e,s=mm(t)?o?i=>vm(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of n)i[t]=Jg(s(t));return i}function ef(t){return tf(t,{top:"y",right:"x",bottom:"y",left:"x"})}function of(t){return tf(t,["topLeft","topRight","bottomLeft","bottomRight"])}function nf(t){const e=ef(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function sf(t,e){t=t||{},e=e||Lg.font;let i=vm(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let o=vm(t.style,e.style);o&&!(""+o).match(Xg)&&(console.warn('Invalid font style specified: "'+o+'"'),o=void 0);const n={family:vm(t.family,e.family),lineHeight:Qg(vm(t.lineHeight,e.lineHeight),i),size:i,style:o,weight:vm(t.weight,e.weight),string:""};return n.string=function(t){return!t||um(t.size)||um(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(n),n}function rf(t,e,i,o){let n,s,r,a=!0;for(n=0,s=t.length;n<s;++n)if(r=t[n],void 0!==r&&(void 0!==e&&"function"==typeof r&&(r=r(e),a=!1),void 0!==i&&pm(r)&&(r=r[i%r.length],a=!1),void 0!==r))return o&&!a&&(o.cacheable=!1),r}function af(t,e){return Object.assign(Object.create(t),e)}function lf(t,e=[""],i,o,n=(()=>t[0])){const s=i||t;void 0===o&&(o=bf("_fallback",t));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:s,_fallback:o,_getTarget:n,override:i=>lf([i,...t],e,s,o)};return new Proxy(r,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,o)=>pf(i,o,(()=>function(t,e,i,o){let n;for(const s of e)if(n=bf(hf(s,t),i),void 0!==n)return uf(t,n)?vf(i,o,t,n):n}(o,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>xf(t).includes(e),ownKeys:t=>xf(t),set(t,e,i){const o=t._storage||(t._storage=n());return t[e]=o[e]=i,delete t._keys,!0}})}function df(t,e,i,o){const n={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:cf(t,o),setContext:e=>df(t,e,i,o),override:n=>df(t.override(n),e,i,o)};return new Proxy(n,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>pf(t,e,(()=>function(t,e,i){const{_proxy:o,_context:n,_subProxy:s,_descriptors:r}=t;let a=o[e];Im(a)&&r.isScriptable(e)&&(a=function(t,e,i,o){const{_proxy:n,_context:s,_subProxy:r,_stack:a}=i;if(a.has(t))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+t);a.add(t);let l=e(s,r||o);a.delete(t),uf(t,l)&&(l=vf(n._scopes,n,t,l));return l}(e,a,t,i));pm(a)&&a.length&&(a=function(t,e,i,o){const{_proxy:n,_context:s,_subProxy:r,_descriptors:a}=i;if(void 0!==s.index&&o(t))return e[s.index%e.length];if(mm(e[0])){const i=e,o=n._scopes.filter((t=>t!==i));e=[];for(const l of i){const i=vf(o,n,t,l);e.push(df(i,s,r&&r[t],a))}}return e}(e,a,t,r.isIndexable));uf(e,a)&&(a=df(a,n,s&&s[e],r));return a}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,o)=>(t[i]=o,delete e[i],!0)})}function cf(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:o=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:i,indexable:o,isScriptable:Im(i)?i:()=>i,isIndexable:Im(o)?o:()=>o}}const hf=(t,e)=>t?t+Dm(e):e,uf=(t,e)=>mm(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function pf(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const o=i();return t[e]=o,o}function mf(t,e,i){return Im(t)?t(e,i):t}const gf=(t,e)=>!0===t?e:"string"==typeof t?Tm(e,t):void 0;function ff(t,e,i,o,n){for(const s of e){const e=gf(i,s);if(e){t.add(e);const s=mf(e._fallback,i,n);if(void 0!==s&&s!==i&&s!==o)return s}else if(!1===e&&void 0!==o&&i!==o)return null}return!1}function vf(t,e,i,o){const n=e._rootScopes,s=mf(e._fallback,i,o),r=[...t,...n],a=new Set;a.add(o);let l=yf(a,r,i,s||i,o);return null!==l&&((void 0===s||s===i||(l=yf(a,r,s,l,o),null!==l))&&lf(Array.from(a),[""],n,s,(()=>function(t,e,i){const o=t._getTarget();e in o||(o[e]={});const n=o[e];if(pm(n)&&mm(i))return i;return n||{}}(e,i,o))))}function yf(t,e,i,o,n){for(;i;)i=ff(t,e,i,o,n);return i}function bf(t,e){for(const i of e){if(!i)continue;const e=i[t];if(void 0!==e)return e}}function xf(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}function _f(t,e,i,o){const{iScale:n}=t,{key:s="r"}=this._parsing,r=new Array(o);let a,l,d,c;for(a=0,l=o;a<l;++a)d=a+i,c=e[d],r[a]={r:n.parse(Tm(c,s),d)};return r}const wf=Number.EPSILON||1e-14,kf=(t,e)=>e<t.length&&!t[e].skip&&t[e],Cf=t=>"x"===t?"y":"x";function Sf(t,e,i,o){const n=t.skip?e:t,s=e,r=i.skip?e:i,a=Qm(s,n),l=Qm(r,s);let d=a/(a+l),c=l/(a+l);d=isNaN(d)?0:d,c=isNaN(c)?0:c;const h=o*d,u=o*c;return{previous:{x:s.x-h*(r.x-n.x),y:s.y-h*(r.y-n.y)},next:{x:s.x+u*(r.x-n.x),y:s.y+u*(r.y-n.y)}}}function Af(t,e="x"){const i=Cf(e),o=t.length,n=Array(o).fill(0),s=Array(o);let r,a,l,d=kf(t,0);for(r=0;r<o;++r)if(a=l,l=d,d=kf(t,r+1),l){if(d){const t=d[e]-l[e];n[r]=0!==t?(d[i]-l[i])/t:0}s[r]=a?d?jm(n[r-1])!==jm(n[r])?0:(n[r-1]+n[r])/2:n[r-1]:n[r]}!function(t,e,i){const o=t.length;let n,s,r,a,l,d=kf(t,0);for(let c=0;c<o-1;++c)l=d,d=kf(t,c+1),l&&d&&(Vm(e[c],0,wf)?i[c]=i[c+1]=0:(n=i[c]/e[c],s=i[c+1]/e[c],a=Math.pow(n,2)+Math.pow(s,2),a<=9||(r=3/Math.sqrt(a),i[c]=n*r*e[c],i[c+1]=s*r*e[c])))}(t,n,s),function(t,e,i="x"){const o=Cf(i),n=t.length;let s,r,a,l=kf(t,0);for(let d=0;d<n;++d){if(r=a,a=l,l=kf(t,d+1),!a)continue;const n=a[i],c=a[o];r&&(s=(n-r[i])/3,a[`cp1${i}`]=n-s,a[`cp1${o}`]=c-s*e[d]),l&&(s=(l[i]-n)/3,a[`cp2${i}`]=n+s,a[`cp2${o}`]=c+s*e[d])}}(t,s,e)}function Ef(t,e,i){return Math.max(Math.min(t,i),e)}function $f(t,e,i,o,n){let s,r,a,l;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)Af(t,n);else{let i=o?t[t.length-1]:t[0];for(s=0,r=t.length;s<r;++s)a=t[s],l=Sf(i,a,t[Math.min(s+1,r-(o?0:1))%r],e.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,i=a}e.capBezierPoints&&function(t,e){let i,o,n,s,r,a=qg(t[0],e);for(i=0,o=t.length;i<o;++i)r=s,s=a,a=i<o-1&&qg(t[i+1],e),s&&(n=t[i],r&&(n.cp1x=Ef(n.cp1x,e.left,e.right),n.cp1y=Ef(n.cp1y,e.top,e.bottom)),a&&(n.cp2x=Ef(n.cp2x,e.left,e.right),n.cp2y=Ef(n.cp2y,e.top,e.bottom)))}(t,i)}function Tf(){return"undefined"!=typeof window&&"undefined"!=typeof document}function Df(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function Mf(t,e,i){let o;return"string"==typeof t?(o=parseInt(t,10),-1!==t.indexOf("%")&&(o=o/100*e.parentNode[i])):o=t,o}const If=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);const Of=["top","right","bottom","left"];function Lf(t,e,i){const o={};i=i?"-"+i:"";for(let n=0;n<4;n++){const s=Of[n];o[s]=parseFloat(t[e+"-"+s+i])||0}return o.width=o.left+o.right,o.height=o.top+o.bottom,o}const zf=(t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot);function Pf(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:o}=e,n=If(i),s="border-box"===n.boxSizing,r=Lf(n,"padding"),a=Lf(n,"border","width"),{x:l,y:d,box:c}=function(t,e){const i=t.touches,o=i&&i.length?i[0]:t,{offsetX:n,offsetY:s}=o;let r,a,l=!1;if(zf(n,s,t.target))r=n,a=s;else{const t=e.getBoundingClientRect();r=o.clientX-t.left,a=o.clientY-t.top,l=!0}return{x:r,y:a,box:l}}(t,i),h=r.left+(c&&a.left),u=r.top+(c&&a.top);let{width:p,height:m}=e;return s&&(p-=r.width+a.width,m-=r.height+a.height),{x:Math.round((l-h)/p*i.width/o),y:Math.round((d-u)/m*i.height/o)}}const Rf=t=>Math.round(10*t)/10;function Nf(t,e,i,o){const n=If(t),s=Lf(n,"margin"),r=Mf(n.maxWidth,t,"clientWidth")||Rm,a=Mf(n.maxHeight,t,"clientHeight")||Rm,l=function(t,e,i){let o,n;if(void 0===e||void 0===i){const s=t&&Df(t);if(s){const t=s.getBoundingClientRect(),r=If(s),a=Lf(r,"border","width"),l=Lf(r,"padding");e=t.width-l.width-a.width,i=t.height-l.height-a.height,o=Mf(r.maxWidth,s,"clientWidth"),n=Mf(r.maxHeight,s,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:o||Rm,maxHeight:n||Rm}}(t,e,i);let{width:d,height:c}=l;if("content-box"===n.boxSizing){const t=Lf(n,"border","width"),e=Lf(n,"padding");d-=e.width+t.width,c-=e.height+t.height}d=Math.max(0,d-s.width),c=Math.max(0,o?d/o:c-s.height),d=Rf(Math.min(d,r,l.maxWidth)),c=Rf(Math.min(c,a,l.maxHeight)),d&&!c&&(c=Rf(d/2));return(void 0!==e||void 0!==i)&&o&&l.height&&c>l.height&&(c=l.height,d=Rf(Math.floor(c*o))),{width:d,height:c}}function Bf(t,e,i){const o=e||1,n=Math.floor(t.height*o),s=Math.floor(t.width*o);t.height=Math.floor(t.height),t.width=Math.floor(t.width);const r=t.canvas;return r.style&&(i||!r.style.height&&!r.style.width)&&(r.style.height=`${t.height}px`,r.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==o||r.height!==n||r.width!==s)&&(t.currentDevicePixelRatio=o,r.height=n,r.width=s,t.ctx.setTransform(o,0,0,o,0,0),!0)}const Ff=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};Tf()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(t){}return t}();function qf(t,e){const i=function(t,e){return If(t).getPropertyValue(e)}(t,e),o=i&&i.match(/^(\d+)(\.\d+)?px$/);return o?+o[1]:void 0}function Uf(t,e,i,o){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function jf(t,e,i,o){return{x:t.x+i*(e.x-t.x),y:"middle"===o?i<.5?t.y:e.y:"after"===o?i<1?t.y:e.y:i>0?e.y:t.y}}function Vf(t,e,i,o){const n={x:t.cp2x,y:t.cp2y},s={x:e.cp1x,y:e.cp1y},r=Uf(t,n,i),a=Uf(n,s,i),l=Uf(s,e,i),d=Uf(r,a,i),c=Uf(a,l,i);return Uf(d,c,i)}function Hf(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function Wf(t,e){let i,o;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,o=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=o)}function Zf(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Yf(t){return"angle"===t?{between:eg,compare:Jm,normalize:tg}:{between:og,compare:(t,e)=>t-e,normalize:t=>t}}function Gf({start:t,end:e,count:i,loop:o,style:n}){return{start:t%i,end:e%i,loop:o&&(e-t+1)%i==0,style:n}}function Kf(t,e,i){if(!i)return[t];const{property:o,start:n,end:s}=i,r=e.length,{compare:a,between:l,normalize:d}=Yf(o),{start:c,end:h,loop:u,style:p}=function(t,e,i){const{property:o,start:n,end:s}=i,{between:r,normalize:a}=Yf(o),l=e.length;let d,c,{start:h,end:u,loop:p}=t;if(p){for(h+=l,u+=l,d=0,c=l;d<c&&r(a(e[h%l][o]),n,s);++d)h--,u--;h%=l,u%=l}return u<h&&(u+=l),{start:h,end:u,loop:p,style:t.style}}(t,e,i),m=[];let g,f,v,y=!1,b=null;const x=()=>y||l(n,v,g)&&0!==a(n,v),_=()=>!y||0===a(s,g)||l(s,v,g);for(let t=c,i=c;t<=h;++t)f=e[t%r],f.skip||(g=d(f[o]),g!==v&&(y=l(g,n,s),null===b&&x()&&(b=0===a(g,n)?t:i),null!==b&&_()&&(m.push(Gf({start:b,end:t,loop:u,count:r,style:p})),b=null),i=t,v=g));return null!==b&&m.push(Gf({start:b,end:h,loop:u,count:r,style:p})),m}function Xf(t,e){const i=[],o=t.segments;for(let n=0;n<o.length;n++){const s=Kf(o[n],t.points,e);s.length&&i.push(...s)}return i}function Qf(t,e,i,o){return o&&o.setContext&&i?function(t,e,i,o){const n=t._chart.getContext(),s=Jf(t.options),{_datasetIndex:r,options:{spanGaps:a}}=t,l=i.length,d=[];let c=s,h=e[0].start,u=h;function p(t,e,o,n){const s=a?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=s;for(;i[e%l].skip;)e+=s;t%l!=e%l&&(d.push({start:t%l,end:e%l,loop:o,style:n}),c=n,h=e%l)}}for(const t of e){h=a?h:t.start;let e,s=i[h%l];for(u=h+1;u<=t.end;u++){const a=i[u%l];e=Jf(o.setContext(af(n,{type:"segment",p0:s,p1:a,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:r}))),tv(e,c)&&p(h,u-1,t.loop,c),s=a,c=e}h<u-1&&p(h,u-1,t.loop,c)}return d}(t,e,i,o):e}function Jf(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function tv(t,e){if(!e)return!1;const i=[],o=function(t,e){return xg(e)?(i.includes(e)||i.push(e),i.indexOf(e)):e};return JSON.stringify(t,o)!==JSON.stringify(e,o)}
10953
11046
  /*!
10954
11047
  * Chart.js v4.4.8
10955
11048
  * https://www.chartjs.org
10956
11049
  * (c) 2025 Chart.js Contributors
10957
11050
  * Released under the MIT License
10958
- */class ev{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,o){const n=e.listeners[o],s=e.duration;n.forEach((o=>o({chart:t,initial:e.initial,numSteps:s,currentStep:Math.min(i-e.start,s)})))}_refresh(){this._request||(this._running=!0,this._request=cg.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,o)=>{if(!i.running||!i.items.length)return;const n=i.items;let s,r=n.length-1,a=!1;for(;r>=0;--r)s=n[r],s._active?(s._total>i.duration&&(i.duration=s._total),s.tick(t),a=!0):(n[r]=n[n.length-1],n.pop());a&&(o.draw(),this._notify(o,i,t,"progress")),n.length||(i.running=!1,this._notify(o,i,t,"complete"),i.initial=!1),e+=n.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let o=i.length-1;for(;o>=0;--o)i[o].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var iv=new ev;const ov="transparent",nv={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const o=_g(t||ov),n=o.valid&&_g(e||ov);return n&&n.valid?n.mix(o,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class sv{constructor(t,e,i,o){const n=e[i];o=rf([t.to,o,n,t.from]);const s=rf([t.from,n,o]);this._active=!0,this._fn=t.fn||nv[t.type||typeof s],this._easing=yg[t.easing]||yg.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=s,this._to=o,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const o=this._target[this._prop],n=i-this._start,s=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(s,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=rf([t.to,e,o,t.from]),this._from=rf([t.from,o,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,o=this._prop,n=this._from,s=this._loop,r=this._to;let a;if(this._active=n!==r&&(s||e<i),!this._active)return this._target[o]=r,void this._notify(!0);e<0?this._target[o]=n:(a=e/i%2,a=s&&a>1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[o]=this._fn(n,r,a))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}class rv{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!mm(t))return;const e=Object.keys(Lg.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach((o=>{const n=t[o];if(!mm(n))return;const s={};for(const t of e)s[t]=n[t];(pm(n.properties)&&n.properties||[o]).forEach((t=>{t!==o&&i.has(t)||i.set(t,s)}))}))}_animateOptions(t,e){const i=e.options,o=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!o)return[];const n=this._createAnimations(o,i);return i.$shared&&function(t,e){const i=[],o=Object.keys(e);for(let e=0;e<o.length;e++){const n=t[o[e]];n&&n.active()&&i.push(n.wait())}return Promise.all(i)}(t.options.$animations,i).then((()=>{t.options=i}),(()=>{})),n}_createAnimations(t,e){const i=this._properties,o=[],n=t.$animations||(t.$animations={}),s=Object.keys(e),r=Date.now();let a;for(a=s.length-1;a>=0;--a){const l=s[a];if("$"===l.charAt(0))continue;if("options"===l){o.push(...this._animateOptions(t,e));continue}const d=e[l];let c=n[l];const h=i.get(l);if(c){if(h&&c.active()){c.update(h,d,r);continue}c.cancel()}h&&h.duration?(n[l]=c=new sv(h,t,l,d),o.push(c)):t[l]=d}return o}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(iv.add(this._chart,i),!0):void 0}}function av(t,e){const i=t&&t.options||{},o=i.reverse,n=void 0===i.min?e:0,s=void 0===i.max?e:0;return{start:o?s:n,end:o?n:s}}function lv(t,e){const i=[],o=t._getSortedDatasetMetas(e);let n,s;for(n=0,s=o.length;n<s;++n)i.push(o[n].index);return i}function dv(t,e,i,o={}){const n=t.keys,s="single"===o.mode;let r,a,l,d;if(null===e)return;let c=!1;for(r=0,a=n.length;r<a;++r){if(l=+n[r],l===i){if(c=!0,o.all)continue;break}d=t.values[l],gm(d)&&(s||0===e||jm(e)===jm(d))&&(e+=d)}return c||o.all?e:0}function cv(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function hv(t,e,i){const o=t[e]||(t[e]={});return o[i]||(o[i]={})}function uv(t,e,i,o){for(const n of e.getMatchingVisibleMetas(o).reverse()){const e=t[n.index];if(i&&e>0||!i&&e<0)return n.index}return null}function pv(t,e){const{chart:i,_cachedMeta:o}=t,n=i._stacks||(i._stacks={}),{iScale:s,vScale:r,index:a}=o,l=s.axis,d=r.axis,c=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(s,r,o),h=e.length;let u;for(let t=0;t<h;++t){const i=e[t],{[l]:s,[d]:h}=i;u=(i._stacks||(i._stacks={}))[d]=hv(n,c,s),u[a]=h,u._top=uv(u,r,!0,o.type),u._bottom=uv(u,r,!1,o.type);(u._visualValues||(u._visualValues={}))[a]=h}}function mv(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function gv(t,e){const i=t.controller.index,o=t.vScale&&t.vScale.axis;if(o){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[o]||void 0===e[o][i])return;delete e[o][i],void 0!==e[o]._visualValues&&void 0!==e[o]._visualValues[i]&&delete e[o]._visualValues[i]}}}const fv=t=>"reset"===t||"none"===t,vv=(t,e)=>e?t:Object.assign({},t);class bv{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=cv(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&gv(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),o=(t,e,i,o)=>"x"===t?e:"r"===t?o:i,n=e.xAxisID=vm(i.xAxisID,mv(t,"x")),s=e.yAxisID=vm(i.yAxisID,mv(t,"y")),r=e.rAxisID=vm(i.rAxisID,mv(t,"r")),a=e.indexAxis,l=e.iAxisID=o(a,n,s,r),d=e.vAxisID=o(a,s,n,r);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(s),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&lg(this._data,this),t._stacked&&gv(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(mm(e)){const t=this._cachedMeta;this._data=function(t,e){const{iScale:i,vScale:o}=e,n="x"===i.axis?"x":"y",s="x"===o.axis?"x":"y",r=Object.keys(t),a=new Array(r.length);let l,d,c;for(l=0,d=r.length;l<d;++l)c=r[l],a[l]={[n]:c,[s]:t[c]};return a}(e,t)}else if(i!==e){if(i){lg(i,this);const t=this._cachedMeta;gv(t),t._parsed=[]}e&&Object.isExtensible(e)&&(n=this,(o=e)._chartjs?o._chartjs.listeners.push(n):(Object.defineProperty(o,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[n]}}),ag.forEach((t=>{const e="_onData"+Dm(t),i=o[t];Object.defineProperty(o,t,{configurable:!0,enumerable:!1,value(...t){const n=i.apply(this,t);return o._chartjs.listeners.forEach((i=>{"function"==typeof i[e]&&i[e](...t)})),n}})})))),this._syncList=[],this._data=e}var o,n}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let o=!1;this._dataCheck();const n=e._stacked;e._stacked=cv(e.vScale,e),e.stack!==i.stack&&(o=!0,gv(e),e.stack=i.stack),this._resyncElements(t),(o||n!==e._stacked)&&(pv(this,e._parsed),e._stacked=cv(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:o}=this,{iScale:n,_stacked:s}=i,r=n.axis;let a,l,d,c=0===t&&e===o.length||i._sorted,h=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=o,i._sorted=!0,d=o;else{d=pm(o[t])?this.parseArrayData(i,o,t,e):mm(o[t])?this.parseObjectData(i,o,t,e):this.parsePrimitiveData(i,o,t,e);const n=()=>null===l[r]||h&&l[r]<h[r];for(a=0;a<e;++a)i._parsed[a+t]=l=d[a],c&&(n()&&(c=!1),h=l);i._sorted=c}s&&pv(this,d)}parsePrimitiveData(t,e,i,o){const{iScale:n,vScale:s}=t,r=n.axis,a=s.axis,l=n.getLabels(),d=n===s,c=new Array(o);let h,u,p;for(h=0,u=o;h<u;++h)p=h+i,c[h]={[r]:d||n.parse(l[p],p),[a]:s.parse(e[p],p)};return c}parseArrayData(t,e,i,o){const{xScale:n,yScale:s}=t,r=new Array(o);let a,l,d,c;for(a=0,l=o;a<l;++a)d=a+i,c=e[d],r[a]={x:n.parse(c[0],d),y:s.parse(c[1],d)};return r}parseObjectData(t,e,i,o){const{xScale:n,yScale:s}=t,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,l=new Array(o);let d,c,h,u;for(d=0,c=o;d<c;++d)h=d+i,u=e[h],l[d]={x:n.parse(Tm(u,r),h),y:s.parse(Tm(u,a),h)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const o=this.chart,n=this._cachedMeta,s=e[t.axis];return dv({keys:lv(o,!0),values:e._stacks[t.axis]._visualValues},s,n.index,{mode:i})}updateRangeFromParsed(t,e,i,o){const n=i[e.axis];let s=null===n?NaN:n;const r=o&&i._stacks[e.axis];o&&r&&(o.values=r,s=dv(o,n,this._cachedMeta.index)),t.min=Math.min(t.min,s),t.max=Math.max(t.max,s)}getMinMax(t,e){const i=this._cachedMeta,o=i._parsed,n=i._sorted&&t===i.iScale,s=o.length,r=this._getOtherScale(t),a=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:lv(i,!0),values:null})(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:c}=function(t){const{min:e,max:i,minDefined:o,maxDefined:n}=t.getUserBounds();return{min:o?e:Number.NEGATIVE_INFINITY,max:n?i:Number.POSITIVE_INFINITY}}(r);let h,u;function p(){u=o[h];const e=u[r.axis];return!gm(u[t.axis])||d>e||c<e}for(h=0;h<s&&(p()||(this.updateRangeFromParsed(l,t,u,a),!n));++h);if(n)for(h=s-1;h>=0;--h)if(!p()){this.updateRangeFromParsed(l,t,u,a);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let o,n,s;for(o=0,n=e.length;o<n;++o)s=e[o][t.axis],gm(s)&&i.push(s);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,o=e.vScale,n=this.getParsed(t);return{label:i?""+i.getLabelForValue(n[i.axis]):"",value:o?""+o.getLabelForValue(n[o.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,o,n;return mm(t)?(e=t.top,i=t.right,o=t.bottom,n=t.left):e=i=o=n=t,{top:e,right:i,bottom:o,left:n,disabled:!1===t}}(vm(this.options.clip,function(t,e,i){if(!1===i)return!1;const o=av(t,i),n=av(e,i);return{top:n.end,right:o.end,bottom:n.start,left:o.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,o=i.data||[],n=e.chartArea,s=[],r=this._drawStart||0,a=this._drawCount||o.length-r,l=this.options.drawActiveElementsOnTop;let d;for(i.dataset&&i.dataset.draw(t,n,r,a),d=r;d<r+a;++d){const e=o[d];e.hidden||(e.active&&l?s.push(e):e.draw(t,n))}for(d=0;d<s.length;++d)s[d].draw(t,n)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const o=this.getDataset();let n;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];n=e.$context||(e.$context=function(t,e,i){return af(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),n.parsed=this.getParsed(t),n.raw=o.data[t],n.index=n.dataIndex=t}else n=this.$context||(this.$context=function(t,e){return af(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),n.dataset=o,n.index=n.datasetIndex=this.index;return n.active=!!e,n.mode=i,n}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const o="active"===e,n=this._cachedDataOpts,s=t+"-"+e,r=n[s],a=this.enableOptionSharing&&Mm(i);if(r)return vv(r,a);const l=this.chart.config,d=l.datasetElementScopeKeys(this._type,t),c=o?[`${t}Hover`,"hover",t,""]:[t,""],h=l.getOptionScopes(this.getDataset(),d),u=Object.keys(Lg.elements[t]),p=l.resolveNamedOptions(h,u,(()=>this.getContext(i,o,e)),c);return p.$shared&&(p.$shared=a,n[s]=Object.freeze(vv(p,a))),p}_resolveAnimations(t,e,i){const o=this.chart,n=this._cachedDataOpts,s=`animation-${e}`,r=n[s];if(r)return r;let a;if(!1!==o.options.animation){const o=this.chart.config,n=o.datasetAnimationScopeKeys(this._type,e),s=o.getOptionScopes(this.getDataset(),n);a=o.createResolver(s,this.getContext(t,i,e))}const l=new rv(o,a&&a.animations);return a&&a._cacheable&&(n[s]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||fv(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),o=this._sharedOptions,n=this.getSharedOptions(i),s=this.includeOptions(e,n)||n!==o;return this.updateSharedOptions(n,e,i),{sharedOptions:n,includeOptions:s}}updateElement(t,e,i,o){fv(o)?Object.assign(t,i):this._resolveAnimations(e,o).update(t,i)}updateSharedOptions(t,e,i){t&&!fv(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,o){t.active=o;const n=this.getStyle(e,o);this._resolveAnimations(e,i,o).update(t,{options:!o&&this.getSharedOptions(n)||n})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const o=i.length,n=e.length,s=Math.min(n,o);s&&this.parse(0,s),n>o?this._insertElements(o,n-o,t):n<o&&this._removeElements(n,o-n)}_insertElements(t,e,i=!0){const o=this._cachedMeta,n=o.data,s=t+e;let r;const a=t=>{for(t.length+=e,r=t.length-1;r>=s;r--)t[r]=t[r-e]};for(a(n),r=t;r<s;++r)n[r]=new this.dataElementType;this._parsing&&a(o._parsed),this.parse(t,e),i&&this.updateElements(n,t,e,"reset")}updateElements(t,e,i,o){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const o=i._parsed.splice(t,e);i._stacked&&gv(i,o)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,o]=t;this[e](i,o)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function yv(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let o=[];for(let e=0,n=i.length;e<n;e++)o=o.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=dg(o.sort(((t,e)=>t-e)))}return t._cache.$bar}(e,t.type);let o,n,s,r,a=e._length;const l=()=>{32767!==s&&-32768!==s&&(Mm(r)&&(a=Math.min(a,Math.abs(s-r)||a)),r=s)};for(o=0,n=i.length;o<n;++o)s=e.getPixelForValue(i[o]),l();for(r=void 0,o=0,n=e.ticks.length;o<n;++o)s=e.getPixelForTick(o),l();return a}function xv(t,e,i,o){return pm(t)?function(t,e,i,o){const n=i.parse(t[0],o),s=i.parse(t[1],o),r=Math.min(n,s),a=Math.max(n,s);let l=r,d=a;Math.abs(r)>Math.abs(a)&&(l=a,d=r),e[i.axis]=d,e._custom={barStart:l,barEnd:d,start:n,end:s,min:r,max:a}}(t,e,i,o):e[i.axis]=i.parse(t,o),e}function _v(t,e,i,o){const n=t.iScale,s=t.vScale,r=n.getLabels(),a=n===s,l=[];let d,c,h,u;for(d=i,c=i+o;d<c;++d)u=e[d],h={},h[n.axis]=a||n.parse(r[d],d),l.push(xv(u,h,s,d));return l}function wv(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function kv(t,e,i,o){let n=e.borderSkipped;const s={};if(!n)return void(t.borderSkipped=s);if(!0===n)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:r,end:a,reverse:l,top:d,bottom:c}=function(t){let e,i,o,n,s;return t.horizontal?(e=t.base>t.x,i="left",o="right"):(e=t.base<t.y,i="bottom",o="top"),e?(n="end",s="start"):(n="start",s="end"),{start:i,end:o,reverse:e,top:n,bottom:s}}(t);"middle"===n&&i&&(t.enableBorderRadius=!0,(i._top||0)===o?n=d:(i._bottom||0)===o?n=c:(s[Cv(c,r,a,l)]=!0,n=d)),s[Cv(n,r,a,l)]=!0,t.borderSkipped=s}function Cv(t,e,i,o){var n,s,r;return o?(r=i,t=Sv(t=(n=t)===(s=e)?r:n===r?s:n,i,e)):t=Sv(t,e,i),t}function Sv(t,e,i){return"start"===t?e:"end"===t?i:t}function Av(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}class Ev extends bv{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:o}}=t.legend.options;return e.labels.map(((e,n)=>{const s=t.getDatasetMeta(0).controller.getStyle(n);return{text:e,fillStyle:s.backgroundColor,strokeStyle:s.borderColor,fontColor:o,lineWidth:s.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(n),index:n}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,o=this._cachedMeta;if(!1===this._parsing)o._parsed=i;else{let n,s,r=t=>+i[t];if(mm(i[t])){const{key:t="value"}=this._parsing;r=e=>+Tm(i[e],t)}for(n=t,s=t+e;n<s;++n)o._parsed[n]=r(n)}}_getRotation(){return Ym(this.options.rotation-90)}_getCircumference(){return Ym(this.options.circumference)}_getRotationExtents(){let t=zm,e=-zm;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const o=this.chart.getDatasetMeta(i).controller,n=o._getRotation(),s=o._getCircumference();t=Math.min(t,n),e=Math.max(e,n+s)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,o=this._cachedMeta,n=o.data,s=this.getMaxBorderWidth()+this.getMaxOffset(n)+this.options.spacing,r=Math.max((Math.min(i.width,i.height)-s)/2,0),a=Math.min((l=this.options.cutout,d=r,"string"==typeof l&&l.endsWith("%")?parseFloat(l)/100:+l/d),1);var l,d;const c=this._getRingWeight(this.index),{circumference:h,rotation:u}=this._getRotationExtents(),{ratioX:p,ratioY:m,offsetX:g,offsetY:f}=function(t,e,i){let o=1,n=1,s=0,r=0;if(e<zm){const a=t,l=a+e,d=Math.cos(a),c=Math.sin(a),h=Math.cos(l),u=Math.sin(l),p=(t,e,o)=>eg(t,a,l,!0)?1:Math.max(e,e*i,o,o*i),m=(t,e,o)=>eg(t,a,l,!0)?-1:Math.min(e,e*i,o,o*i),g=p(0,d,h),f=p(Bm,c,u),v=m(Lm,d,h),b=m(Lm+Bm,c,u);o=(g-v)/2,n=(f-b)/2,s=-(g+v)/2,r=-(f+b)/2}return{ratioX:o,ratioY:n,offsetX:s,offsetY:r}}(u,h,a),v=(i.width-s)/p,b=(i.height-s)/m,y=Math.max(Math.min(v,b)/2,0),x=bm(this.options.radius,y),_=(x-Math.max(x*a,0))/this._getVisibleDatasetWeightTotal();this.offsetX=g*x,this.offsetY=f*x,o.total=this.calculateTotal(),this.outerRadius=x-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*c,0),this.updateElements(n,0,n.length,t)}_circumference(t,e){const i=this.options,o=this._cachedMeta,n=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===o._parsed[t]||o.data[t].hidden?0:this.calculateCircumference(o._parsed[t]*n/zm)}updateElements(t,e,i,o){const n="reset"===o,s=this.chart,r=s.chartArea,a=s.options.animation,l=(r.left+r.right)/2,d=(r.top+r.bottom)/2,c=n&&a.animateScale,h=c?0:this.innerRadius,u=c?0:this.outerRadius,{sharedOptions:p,includeOptions:m}=this._getSharedOptions(e,o);let g,f=this._getRotation();for(g=0;g<e;++g)f+=this._circumference(g,n);for(g=e;g<e+i;++g){const e=this._circumference(g,n),i=t[g],s={x:l+this.offsetX,y:d+this.offsetY,startAngle:f,endAngle:f+e,circumference:e,outerRadius:u,innerRadius:h};m&&(s.options=p||this.resolveDataElementOptions(g,i.active?"active":o)),f+=e,this.updateElement(i,g,s,o)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,o=0;for(i=0;i<e.length;i++){const n=t._parsed[i];null===n||isNaN(n)||!this.chart.getDataVisibility(i)||e[i].hidden||(o+=Math.abs(n))}return o}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?zm*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,o=i.data.labels||[],n=Ag(e._parsed[t],i.options.locale);return{label:o[t]||"",value:n}}getMaxBorderWidth(t){let e=0;const i=this.chart;let o,n,s,r,a;if(!t)for(o=0,n=i.data.datasets.length;o<n;++o)if(i.isDatasetVisible(o)){s=i.getDatasetMeta(o),t=s.data,r=s.controller;break}if(!t)return 0;for(o=0,n=t.length;o<n;++o)a=r.resolveDataElementOptions(o),"inner"!==a.borderAlign&&(e=Math.max(e,a.borderWidth||0,a.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,o=t.length;i<o;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(vm(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class $v extends bv{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:o}}=t.legend.options;return e.labels.map(((e,n)=>{const s=t.getDatasetMeta(0).controller.getStyle(n);return{text:e,fillStyle:s.backgroundColor,strokeStyle:s.borderColor,fontColor:o,lineWidth:s.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(n),index:n}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,o=i.data.labels||[],n=Ag(e._parsed[t].r,i.options.locale);return{label:o[t]||"",value:n}}parseObjectData(t,e,i,o){return _f.bind(this)(t,e,i,o)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach(((t,i)=>{const o=this.getParsed(i).r;!isNaN(o)&&this.chart.getDataVisibility(i)&&(o<e.min&&(e.min=o),o>e.max&&(e.max=o))})),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,o=Math.min(e.right-e.left,e.bottom-e.top),n=Math.max(o/2,0),s=(n-Math.max(i.cutoutPercentage?n/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=n-s*this.index,this.innerRadius=this.outerRadius-s}updateElements(t,e,i,o){const n="reset"===o,s=this.chart,r=s.options.animation,a=this._cachedMeta.rScale,l=a.xCenter,d=a.yCenter,c=a.getIndexAngle(0)-.5*Lm;let h,u=c;const p=360/this.countVisibleElements();for(h=0;h<e;++h)u+=this._computeAngle(h,o,p);for(h=e;h<e+i;h++){const e=t[h];let i=u,m=u+this._computeAngle(h,o,p),g=s.getDataVisibility(h)?a.getDistanceFromCenterForValue(this.getParsed(h).r):0;u=m,n&&(r.animateScale&&(g=0),r.animateRotate&&(i=m=c));const f={x:l,y:d,innerRadius:0,outerRadius:g,startAngle:i,endAngle:m,options:this.resolveDataElementOptions(h,e.active?"active":o)};this.updateElement(e,h,f,o)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach(((t,i)=>{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++})),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?Ym(this.resolveDataElementOptions(t,e).angle||i):0}}var Tv=Object.freeze({__proto__:null,BarController:class extends bv{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,i,o){return _v(t,e,i,o)}parseArrayData(t,e,i,o){return _v(t,e,i,o)}parseObjectData(t,e,i,o){const{iScale:n,vScale:s}=t,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,l="x"===n.axis?r:a,d="x"===s.axis?r:a,c=[];let h,u,p,m;for(h=i,u=i+o;h<u;++h)m=e[h],p={},p[n.axis]=n.parse(Tm(m,l),h),c.push(xv(Tm(m,d),p,s,h));return c}updateRangeFromParsed(t,e,i,o){super.updateRangeFromParsed(t,e,i,o);const n=i._custom;n&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,n.min),t.max=Math.max(t.max,n.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:o}=e,n=this.getParsed(t),s=n._custom,r=wv(s)?"["+s.start+", "+s.end+"]":""+o.getLabelForValue(n[o.axis]);return{label:""+i.getLabelForValue(n[i.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize();this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,o){const n="reset"===o,{index:s,_cachedMeta:{vScale:r}}=this,a=r.getBasePixel(),l=r.isHorizontal(),d=this._getRuler(),{sharedOptions:c,includeOptions:h}=this._getSharedOptions(e,o);for(let u=e;u<e+i;u++){const e=this.getParsed(u),i=n||um(e[r.axis])?{base:a,head:a}:this._calculateBarValuePixels(u),p=this._calculateBarIndexPixels(u,d),m=(e._stacks||{})[r.axis],g={horizontal:l,base:i.base,enableBorderRadius:!m||wv(e._custom)||s===m._top||s===m._bottom,x:l?i.head:p.center,y:l?p.center:i.head,height:l?p.size:Math.abs(i.size),width:l?Math.abs(i.size):p.size};h&&(g.options=c||this.resolveDataElementOptions(u,t[u].active?"active":o));const f=g.options||t[u].options;kv(g,f,m,s),Av(g,f,d.ratio),this.updateElement(t[u],u,g,o)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,o=i.getMatchingVisibleMetas(this._type).filter((t=>t.controller.options.grouped)),n=i.options.stacked,s=[],r=this._cachedMeta.controller.getParsed(e),a=r&&r[i.axis],l=t=>{const e=t._parsed.find((t=>t[i.axis]===a)),o=e&&e[t.vScale.axis];if(um(o)||isNaN(o))return!0};for(const i of o)if((void 0===e||!l(i))&&((!1===n||-1===s.indexOf(i.stack)||void 0===n&&void 0===i.stack)&&s.push(i.stack),i.index===t))break;return s.length||s.push(void 0),s}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const o=this._getStacks(t,i),n=void 0!==e?o.indexOf(e):-1;return-1===n?o.length-1:n}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,o=[];let n,s;for(n=0,s=e.data.length;n<s;++n)o.push(i.getPixelForValue(this.getParsed(n)[i.axis],n));const r=t.barThickness;return{min:r||yv(e),pixels:o,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:o},options:{base:n,minBarLength:s}}=this,r=n||0,a=this.getParsed(t),l=a._custom,d=wv(l);let c,h,u=a[e.axis],p=0,m=i?this.applyStack(e,a,i):u;m!==u&&(p=m-u,m=u),d&&(u=l.barStart,m=l.barEnd-l.barStart,0!==u&&jm(u)!==jm(l.barEnd)&&(p=0),p+=u);const g=um(n)||d?p:n;let f=e.getPixelForValue(g);if(c=this.chart.getDataVisibility(t)?e.getPixelForValue(p+m):f,h=c-f,Math.abs(h)<s){h=function(t,e,i){return 0!==t?jm(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(h,e,r)*s,u===r&&(f-=h/2);const t=e.getPixelForDecimal(0),n=e.getPixelForDecimal(1),l=Math.min(t,n),p=Math.max(t,n);f=Math.max(Math.min(f,p),l),c=f+h,i&&!d&&(a._stacks[e.axis]._visualValues[o]=e.getValueForPixel(c)-e.getValueForPixel(f))}if(f===e.getPixelForValue(r)){const t=jm(h)*e.getLineWidthForValue(r)/2;f+=t,h-=t}return{size:h,base:f,head:c,center:c+h/2}}_calculateBarIndexPixels(t,e){const i=e.scale,o=this.options,n=o.skipNull,s=vm(o.maxBarThickness,1/0);let r,a;if(e.grouped){const i=n?this._getStackCount(t):e.stackCount,l="flex"===o.barThickness?function(t,e,i,o){const n=e.pixels,s=n[t];let r=t>0?n[t-1]:null,a=t<n.length-1?n[t+1]:null;const l=i.categoryPercentage;null===r&&(r=s-(null===a?e.end-e.start:a-s)),null===a&&(a=s+s-r);const d=s-(s-Math.min(r,a))/2*l;return{chunk:Math.abs(a-r)/2*l/o,ratio:i.barPercentage,start:d}}(t,e,o,i):function(t,e,i,o){const n=i.barThickness;let s,r;return um(n)?(s=e.min*i.categoryPercentage,r=i.barPercentage):(s=n*o,r=1),{chunk:s/o,ratio:r,start:e.pixels[t]-s/2}}(t,e,o,i),d=this._getStackIndex(this.index,this._cachedMeta.stack,n?t:void 0);r=l.start+l.chunk*d+l.chunk/2,a=Math.min(s,l.chunk*l.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.axis],t),a=Math.min(s,e.min*e.ratio);return{base:r-a/2,head:r+a/2,center:r,size:a}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,o=i.length;let n=0;for(;n<o;++n)null===this.getParsed(n)[e.axis]||i[n].hidden||i[n].draw(this._ctx)}},BubbleController:class extends bv{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,o){const n=super.parsePrimitiveData(t,e,i,o);for(let t=0;t<n.length;t++)n[t]._custom=this.resolveDataElementOptions(t+i).radius;return n}parseArrayData(t,e,i,o){const n=super.parseArrayData(t,e,i,o);for(let t=0;t<n.length;t++){const o=e[i+t];n[t]._custom=vm(o[2],this.resolveDataElementOptions(t+i).radius)}return n}parseObjectData(t,e,i,o){const n=super.parseObjectData(t,e,i,o);for(let t=0;t<n.length;t++){const o=e[i+t];n[t]._custom=vm(o&&o.r&&+o.r,this.resolveDataElementOptions(t+i).radius)}return n}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:o,yScale:n}=e,s=this.getParsed(t),r=o.getLabelForValue(s.x),a=n.getLabelForValue(s.y),l=s._custom;return{label:i[t]||"",value:"("+r+", "+a+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,o){const n="reset"===o,{iScale:s,vScale:r}=this._cachedMeta,{sharedOptions:a,includeOptions:l}=this._getSharedOptions(e,o),d=s.axis,c=r.axis;for(let h=e;h<e+i;h++){const e=t[h],i=!n&&this.getParsed(h),u={},p=u[d]=n?s.getPixelForDecimal(.5):s.getPixelForValue(i[d]),m=u[c]=n?r.getBasePixel():r.getPixelForValue(i[c]);u.skip=isNaN(p)||isNaN(m),l&&(u.options=a||this.resolveDataElementOptions(h,e.active?"active":o),n&&(u.options.radius=0)),this.updateElement(e,h,u,o)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let o=super.resolveDataElementOptions(t,e);o.$shared&&(o=Object.assign({},o,{$shared:!1}));const n=o.radius;return"active"!==e&&(o.radius=0),o.radius+=vm(i&&i._custom,n),o}},DoughnutController:Ev,LineController:class extends bv{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:o=[],_dataset:n}=e,s=this.chart._animationsDisabled;let{start:r,count:a}=mg(e,o,s);this._drawStart=r,this._drawCount=a,gg(e)&&(r=0,a=o.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!n._decimated,i.points=o;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!s,options:l},t),this.updateElements(o,r,a,t)}updateElements(t,e,i,o){const n="reset"===o,{iScale:s,vScale:r,_stacked:a,_dataset:l}=this._cachedMeta,{sharedOptions:d,includeOptions:c}=this._getSharedOptions(e,o),h=s.axis,u=r.axis,{spanGaps:p,segment:m}=this.options,g=Wm(p)?p:Number.POSITIVE_INFINITY,f=this.chart._animationsDisabled||n||"none"===o,v=e+i,b=t.length;let y=e>0&&this.getParsed(e-1);for(let i=0;i<b;++i){const p=t[i],b=f?p:{};if(i<e||i>=v){b.skip=!0;continue}const x=this.getParsed(i),_=um(x[u]),w=b[h]=s.getPixelForValue(x[h],i),k=b[u]=n||_?r.getBasePixel():r.getPixelForValue(a?this.applyStack(r,x,a):x[u],i);b.skip=isNaN(w)||isNaN(k)||_,b.stop=i>0&&Math.abs(x[h]-y[h])>g,m&&(b.parsed=x,b.raw=l.data[i]),c&&(b.options=d||this.resolveDataElementOptions(i,p.active?"active":o)),f||this.updateElement(p,i,b,o),y=x}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,o=t.data||[];if(!o.length)return i;const n=o[0].size(this.resolveDataElementOptions(0)),s=o[o.length-1].size(this.resolveDataElementOptions(o.length-1));return Math.max(i,n,s)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},PieController:class extends Ev{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:$v,RadarController:class extends bv{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,o){return _f.bind(this)(t,e,i,o)}update(t){const e=this._cachedMeta,i=e.dataset,o=e.data||[],n=e.iScale.getLabels();if(i.points=o,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const s={_loop:!0,_fullLoop:n.length===o.length,options:e};this.updateElement(i,void 0,s,t)}this.updateElements(o,0,o.length,t)}updateElements(t,e,i,o){const n=this._cachedMeta.rScale,s="reset"===o;for(let r=e;r<e+i;r++){const e=t[r],i=this.resolveDataElementOptions(r,e.active?"active":o),a=n.getPointPositionForValue(r,this.getParsed(r).r),l=s?n.xCenter:a.x,d=s?n.yCenter:a.y,c={x:l,y:d,angle:a.angle,skip:isNaN(l)||isNaN(d),options:i};this.updateElement(e,r,c,o)}}},ScatterController:class extends bv{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:o,yScale:n}=e,s=this.getParsed(t),r=o.getLabelForValue(s.x),a=n.getLabelForValue(s.y);return{label:i[t]||"",value:"("+r+", "+a+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,o=this.chart._animationsDisabled;let{start:n,count:s}=mg(e,i,o);if(this._drawStart=n,this._drawCount=s,gg(e)&&(n=0,s=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:n,_dataset:s}=e;n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!s._decimated,n.points=i;const r=this.resolveDatasetElementOptions(t);r.segment=this.options.segment,this.updateElement(n,void 0,{animated:!o,options:r},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,n,s,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,o){const n="reset"===o,{iScale:s,vScale:r,_stacked:a,_dataset:l}=this._cachedMeta,d=this.resolveDataElementOptions(e,o),c=this.getSharedOptions(d),h=this.includeOptions(o,c),u=s.axis,p=r.axis,{spanGaps:m,segment:g}=this.options,f=Wm(m)?m:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||n||"none"===o;let b=e>0&&this.getParsed(e-1);for(let d=e;d<e+i;++d){const e=t[d],i=this.getParsed(d),m=v?e:{},y=um(i[p]),x=m[u]=s.getPixelForValue(i[u],d),_=m[p]=n||y?r.getBasePixel():r.getPixelForValue(a?this.applyStack(r,i,a):i[p],d);m.skip=isNaN(x)||isNaN(_)||y,m.stop=d>0&&Math.abs(i[u]-b[u])>f,g&&(m.parsed=i,m.raw=l.data[d]),h&&(m.options=c||this.resolveDataElementOptions(d,e.active?"active":o)),v||this.updateElement(e,d,m,o),b=i}this.updateSharedOptions(c,o,d)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}const i=t.dataset,o=i.options&&i.options.borderWidth||0;if(!e.length)return o;const n=e[0].size(this.resolveDataElementOptions(0)),s=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(o,n,s)/2}}});function Dv(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Mv{static override(t){Object.assign(Mv.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return Dv()}parse(){return Dv()}format(){return Dv()}add(){return Dv()}diff(){return Dv()}startOf(){return Dv()}endOf(){return Dv()}}var Iv={_date:Mv};function Ov(t,e,i,o){const{controller:n,data:s,_sorted:r}=t,a=n._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(a&&e===a.axis&&"r"!==e&&r&&s.length){const r=a._reversePixels?rg:sg;if(!o){const o=r(s,e,i);if(l){const{vScale:e}=n._cachedMeta,{_parsed:i}=t,s=i.slice(0,o.lo+1).reverse().findIndex((t=>!um(t[e.axis])));o.lo-=Math.max(0,s);const r=i.slice(o.hi).findIndex((t=>!um(t[e.axis])));o.hi+=Math.max(0,r)}return o}if(n._sharedOptions){const t=s[0],o="function"==typeof t.getRange&&t.getRange(e);if(o){const t=r(s,e,i-o),n=r(s,e,i+o);return{lo:t.lo,hi:n.hi}}}}return{lo:0,hi:s.length-1}}function Lv(t,e,i,o,n){const s=t.getSortedVisibleDatasetMetas(),r=i[e];for(let t=0,i=s.length;t<i;++t){const{index:i,data:a}=s[t],{lo:l,hi:d}=Ov(s[t],e,r,n);for(let t=l;t<=d;++t){const e=a[t];e.skip||o(e,i,t)}}}function zv(t,e,i,o,n){const s=[];if(!n&&!t.isPointInArea(e))return s;return Lv(t,i,e,(function(i,r,a){(n||qg(i,t.chartArea,0))&&i.inRange(e.x,e.y,o)&&s.push({element:i,datasetIndex:r,index:a})}),!0),s}function Pv(t,e,i,o,n,s){let r=[];const a=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,o){const n=e?Math.abs(t.x-o.x):0,s=i?Math.abs(t.y-o.y):0;return Math.sqrt(Math.pow(n,2)+Math.pow(s,2))}}(i);let l=Number.POSITIVE_INFINITY;return Lv(t,i,e,(function(i,d,c){const h=i.inRange(e.x,e.y,n);if(o&&!h)return;const u=i.getCenterPoint(n);if(!(!!s||t.isPointInArea(u))&&!h)return;const p=a(e,u);p<l?(r=[{element:i,datasetIndex:d,index:c}],l=p):p===l&&r.push({element:i,datasetIndex:d,index:c})})),r}function Rv(t,e,i,o,n,s){return s||t.isPointInArea(e)?"r"!==i||o?Pv(t,e,i,o,n,s):function(t,e,i,o){let n=[];return Lv(t,i,e,(function(t,i,s){const{startAngle:r,endAngle:a}=t.getProps(["startAngle","endAngle"],o),{angle:l}=Xm(t,{x:e.x,y:e.y});eg(l,r,a)&&n.push({element:t,datasetIndex:i,index:s})})),n}(t,e,i,n):[]}function Nv(t,e,i,o,n){const s=[],r="x"===i?"inXRange":"inYRange";let a=!1;return Lv(t,i,e,((t,o,l)=>{t[r]&&t[r](e[i],n)&&(s.push({element:t,datasetIndex:o,index:l}),a=a||t.inRange(e.x,e.y,n))})),o&&!a?[]:s}var Bv={evaluateInteractionItems:Lv,modes:{index(t,e,i,o){const n=Pf(e,t),s=i.axis||"x",r=i.includeInvisible||!1,a=i.intersect?zv(t,n,s,o,r):Rv(t,n,s,!1,o,r),l=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=a[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})})),l):[]},dataset(t,e,i,o){const n=Pf(e,t),s=i.axis||"xy",r=i.includeInvisible||!1;let a=i.intersect?zv(t,n,s,o,r):Rv(t,n,s,!1,o,r);if(a.length>0){const e=a[0].datasetIndex,i=t.getDatasetMeta(e).data;a=[];for(let t=0;t<i.length;++t)a.push({element:i[t],datasetIndex:e,index:t})}return a},point:(t,e,i,o)=>zv(t,Pf(e,t),i.axis||"xy",o,i.includeInvisible||!1),nearest(t,e,i,o){const n=Pf(e,t),s=i.axis||"xy",r=i.includeInvisible||!1;return Rv(t,n,s,i.intersect,o,r)},x:(t,e,i,o)=>Nv(t,Pf(e,t),"x",i.intersect,o),y:(t,e,i,o)=>Nv(t,Pf(e,t),"y",i.intersect,o)}};const Fv=["left","top","right","bottom"];function qv(t,e){return t.filter((t=>t.pos===e))}function Uv(t,e){return t.filter((t=>-1===Fv.indexOf(t.pos)&&t.box.axis===e))}function jv(t,e){return t.sort(((t,i)=>{const o=e?i:t,n=e?t:i;return o.weight===n.weight?o.index-n.index:o.weight-n.weight}))}function Vv(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:o,stackWeight:n}=i;if(!t||!Fv.includes(o))continue;const s=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});s.count++,s.weight+=n}return e}(t),{vBoxMaxWidth:o,hBoxMaxHeight:n}=e;let s,r,a;for(s=0,r=t.length;s<r;++s){a=t[s];const{fullSize:r}=a.box,l=i[a.stack],d=l&&a.stackWeight/l.weight;a.horizontal?(a.width=d?d*o:r&&e.availableWidth,a.height=n):(a.width=o,a.height=d?d*n:r&&e.availableHeight)}return i}function Hv(t,e,i,o){return Math.max(t[i],e[i])+Math.max(t[o],e[o])}function Wv(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function Zv(t,e,i,o){const{pos:n,box:s}=i,r=t.maxPadding;if(!mm(n)){i.size&&(t[n]-=i.size);const e=o[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?s.height:s.width),i.size=e.size/e.count,t[n]+=i.size}s.getPadding&&Wv(r,s.getPadding());const a=Math.max(0,e.outerWidth-Hv(r,t,"left","right")),l=Math.max(0,e.outerHeight-Hv(r,t,"top","bottom")),d=a!==t.w,c=l!==t.h;return t.w=a,t.h=l,i.horizontal?{same:d,other:c}:{same:c,other:d}}function Yv(t,e){const i=e.maxPadding;function o(t){const o={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{o[t]=Math.max(e[t],i[t])})),o}return o(t?["left","right"]:["top","bottom"])}function Gv(t,e,i,o){const n=[];let s,r,a,l,d,c;for(s=0,r=t.length,d=0;s<r;++s){a=t[s],l=a.box,l.update(a.width||e.w,a.height||e.h,Yv(a.horizontal,e));const{same:r,other:h}=Zv(e,i,a,o);d|=r&&n.length,c=c||h,l.fullSize||n.push(a)}return d&&Gv(n,e,i,o)||c}function Kv(t,e,i,o,n){t.top=i,t.left=e,t.right=e+o,t.bottom=i+n,t.width=o,t.height=n}function Xv(t,e,i,o){const n=i.padding;let{x:s,y:r}=e;for(const a of t){const t=a.box,l=o[a.stack]||{count:1,placed:0,weight:1},d=a.stackWeight/l.weight||1;if(a.horizontal){const o=e.w*d,s=l.size||t.height;Mm(l.start)&&(r=l.start),t.fullSize?Kv(t,n.left,r,i.outerWidth-n.right-n.left,s):Kv(t,e.left+l.placed,r,o,s),l.start=r,l.placed+=o,r=t.bottom}else{const o=e.h*d,r=l.size||t.width;Mm(l.start)&&(s=l.start),t.fullSize?Kv(t,s,n.top,r,i.outerHeight-n.bottom-n.top):Kv(t,s,e.top+l.placed,r,o),l.start=s,l.placed+=o,s=t.right}}e.x=s,e.y=r}var Qv={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,o){if(!t)return;const n=nf(t.options.layout.padding),s=Math.max(e-n.width,0),r=Math.max(i-n.height,0),a=function(t){const e=function(t){const e=[];let i,o,n,s,r,a;for(i=0,o=(t||[]).length;i<o;++i)n=t[i],({position:s,options:{stack:r,stackWeight:a=1}}=n),e.push({index:i,box:n,pos:s,horizontal:n.isHorizontal(),weight:n.weight,stack:r&&s+r,stackWeight:a});return e}(t),i=jv(e.filter((t=>t.box.fullSize)),!0),o=jv(qv(e,"left"),!0),n=jv(qv(e,"right")),s=jv(qv(e,"top"),!0),r=jv(qv(e,"bottom")),a=Uv(e,"x"),l=Uv(e,"y");return{fullSize:i,leftAndTop:o.concat(s),rightAndBottom:n.concat(l).concat(r).concat(a),chartArea:qv(e,"chartArea"),vertical:o.concat(n).concat(l),horizontal:s.concat(r).concat(a)}}(t.boxes),l=a.vertical,d=a.horizontal;xm(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const c=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,h=Object.freeze({outerWidth:e,outerHeight:i,padding:n,availableWidth:s,availableHeight:r,vBoxMaxWidth:s/2/c,hBoxMaxHeight:r/2}),u=Object.assign({},n);Wv(u,nf(o));const p=Object.assign({maxPadding:u,w:s,h:r,x:n.left,y:n.top},n),m=Vv(l.concat(d),h);Gv(a.fullSize,p,h,m),Gv(l,p,h,m),Gv(d,p,h,m)&&Gv(l,p,h,m),function(t){const e=t.maxPadding;function i(i){const o=Math.max(e[i]-t[i],0);return t[i]+=o,o}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(p),Xv(a.leftAndTop,p,h,m),p.x+=p.w,p.y+=p.h,Xv(a.rightAndBottom,p,h,m),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},xm(a.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})}))}};class Jv{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,o){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,o?Math.floor(e/o):i)}}isAttached(t){return!0}updateConfig(t){}}class tb extends Jv{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const eb="$chartjs",ib={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},ob=t=>null===t||""===t;const nb=!!Ff&&{passive:!0};function sb(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,nb)}function rb(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function ab(t,e,i){const o=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||rb(i.addedNodes,o),e=e&&!rb(i.removedNodes,o);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}function lb(t,e,i){const o=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||rb(i.removedNodes,o),e=e&&!rb(i.addedNodes,o);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}const db=new Map;let cb=0;function hb(){const t=window.devicePixelRatio;t!==cb&&(cb=t,db.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function ub(t,e,i){const o=t.canvas,n=o&&Df(o);if(!n)return;const s=hg(((t,e)=>{const o=n.clientWidth;i(t,e),o<n.clientWidth&&i()}),window),r=new ResizeObserver((t=>{const e=t[0],i=e.contentRect.width,o=e.contentRect.height;0===i&&0===o||s(i,o)}));return r.observe(n),function(t,e){db.size||window.addEventListener("resize",hb),db.set(t,e)}(t,s),r}function pb(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){db.delete(t),db.size||window.removeEventListener("resize",hb)}(t)}function mb(t,e,i){const o=t.canvas,n=hg((e=>{null!==t.ctx&&i(function(t,e){const i=ib[t.type]||t.type,{x:o,y:n}=Pf(t,e);return{type:i,chart:e,native:t,x:void 0!==o?o:null,y:void 0!==n?n:null}}(e,t))}),t);return function(t,e,i){t&&t.addEventListener(e,i,nb)}(o,e,n),n}class gb extends Jv{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,o=t.getAttribute("height"),n=t.getAttribute("width");if(t[eb]={initial:{height:o,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",ob(n)){const e=qf(t,"width");void 0!==e&&(t.width=e)}if(ob(o))if(""===t.style.height)t.height=t.width/(e||2);else{const e=qf(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[eb])return!1;const i=e[eb].initial;["height","width"].forEach((t=>{const o=i[t];um(o)?e.removeAttribute(t):e.setAttribute(t,o)}));const o=i.style||{};return Object.keys(o).forEach((t=>{e.style[t]=o[t]})),e.width=e.width,delete e[eb],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const o=t.$proxies||(t.$proxies={}),n={attach:ab,detach:lb,resize:ub}[e]||mb;o[e]=n(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),o=i[e];if(!o)return;({attach:pb,detach:pb,resize:pb}[e]||sb)(t,e,o),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,o){return Nf(t,e,i,o)}isAttached(t){const e=t&&Df(t);return!(!e||!e.isConnected)}}let fb=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Wm(this.x)&&Wm(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const o={};return t.forEach((t=>{o[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),o}};function vb(t,e){const i=t.options.ticks,o=function(t){const e=t.options.offset,i=t._tickSize(),o=t._length/i+(e?0:1),n=t._maxLength/i;return Math.floor(Math.min(o,n))}(t),n=Math.min(i.maxTicksLimit||o,o),s=i.major.enabled?function(t){const e=[];let i,o;for(i=0,o=t.length;i<o;i++)t[i].major&&e.push(i);return e}(e):[],r=s.length,a=s[0],l=s[r-1],d=[];if(r>n)return function(t,e,i,o){let n,s=0,r=i[0];for(o=Math.ceil(o),n=0;n<t.length;n++)n===r&&(e.push(t[n]),s++,r=i[s*o])}(e,d,s,r/n),d;const c=function(t,e,i){const o=function(t){const e=t.length;let i,o;if(e<2)return!1;for(o=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==o)return!1;return o}(t),n=e.length/i;if(!o)return Math.max(n,1);const s=function(t){const e=[],i=Math.sqrt(t);let o;for(o=1;o<i;o++)t%o==0&&(e.push(o),e.push(t/o));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}(o);for(let t=0,e=s.length-1;t<e;t++){const e=s[t];if(e>n)return e}return Math.max(n,1)}(s,e,n);if(r>0){let t,i;const o=r>1?Math.round((l-a)/(r-1)):null;for(bb(e,d,c,um(o)?0:a-o,a),t=0,i=r-1;t<i;t++)bb(e,d,c,s[t],s[t+1]);return bb(e,d,c,l,um(o)?e.length:l+o),d}return bb(e,d,c),d}function bb(t,e,i,o,n){const s=vm(o,0),r=Math.min(vm(n,t.length),t.length);let a,l,d,c=0;for(i=Math.ceil(i),n&&(a=n-o,i=a/Math.floor(a/i)),d=s;d<0;)c++,d=Math.round(s+c*i);for(l=Math.max(s,0);l<r;l++)l===d&&(e.push(t[l]),c++,d=Math.round(s+c*i))}const yb=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,xb=(t,e)=>Math.min(e||t,t);function _b(t,e){const i=[],o=t.length/e,n=t.length;let s=0;for(;s<n;s+=o)i.push(t[Math.floor(s)]);return i}function wb(t,e,i){const o=t.ticks.length,n=Math.min(e,o-1),s=t._startPixel,r=t._endPixel,a=1e-6;let l,d=t.getPixelForTick(n);if(!(i&&(l=1===o?Math.max(d-s,r-d):0===e?(t.getPixelForTick(1)-d)/2:(d-t.getPixelForTick(n-1))/2,d+=n<e?l:-l,d<s-a||d>r+a)))return d}function kb(t){return t.drawTicks?t.tickLength:0}function Cb(t,e){if(!t.display)return 0;const i=sf(t.font,e),o=nf(t.padding);return(pm(t.text)?t.text.length:1)*i.lineHeight+o.height}function Sb(t,e,i){let o=ug(t);return(i&&"right"!==e||!i&&"right"===e)&&(o=(t=>"left"===t?"right":"right"===t?"left":t)(o)),o}class Ab extends fb{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:o}=this;return t=fm(t,Number.POSITIVE_INFINITY),e=fm(e,Number.NEGATIVE_INFINITY),i=fm(i,Number.POSITIVE_INFINITY),o=fm(o,Number.NEGATIVE_INFINITY),{min:fm(t,i),max:fm(e,o),minDefined:gm(t),maxDefined:gm(e)}}getMinMax(t){let e,{min:i,max:o,minDefined:n,maxDefined:s}=this.getUserBounds();if(n&&s)return{min:i,max:o};const r=this.getMatchingVisibleMetas();for(let a=0,l=r.length;a<l;++a)e=r[a].controller.getMinMax(this,t),n||(i=Math.min(i,e.min)),s||(o=Math.max(o,e.max));return i=s&&i>o?o:i,o=n&&i>o?i:o,{min:fm(i,fm(o,i)),max:fm(o,fm(i,o))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ym(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:o,grace:n,ticks:s}=this.options,r=s.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(t,e,i){const{min:o,max:n}=t,s=bm(e,(n-o)/2),r=(t,e)=>i&&0===t?0:t+e;return{min:r(o,-Math.abs(s)),max:r(n,s)}}(this,n,o),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const a=r<this.ticks.length;this._convertTicksToLabels(a?_b(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),s.display&&(s.autoSkip||"auto"===s.source)&&(this.ticks=vb(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),a&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){ym(this.options.afterUpdate,[this])}beforeSetDimensions(){ym(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){ym(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),ym(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){ym(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,o,n;for(i=0,o=t.length;i<o;i++)n=t[i],n.label=ym(e.callback,[n.value,i,t],this)}afterTickToLabelConversion(){ym(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){ym(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=xb(this.ticks.length,t.ticks.maxTicksLimit),o=e.minRotation||0,n=e.maxRotation;let s,r,a,l=o;if(!this._isVisible()||!e.display||o>=n||i<=1||!this.isHorizontal())return void(this.labelRotation=o);const d=this._getLabelSizes(),c=d.widest.width,h=d.highest.height,u=ig(this.chart.width-c,0,this.maxWidth);s=t.offset?this.maxWidth/i:u/(i-1),c+6>s&&(s=u/(i-(t.offset?.5:1)),r=this.maxHeight-kb(t.grid)-e.padding-Cb(t.title,this.chart.options.font),a=Math.sqrt(c*c+h*h),l=Gm(Math.min(Math.asin(ig((d.highest.height+6)/s,-1,1)),Math.asin(ig(r/a,-1,1))-Math.asin(ig(h/a,-1,1)))),l=Math.max(o,Math.min(n,l))),this.labelRotation=l}afterCalculateLabelRotation(){ym(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ym(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:o,grid:n}}=this,s=this._isVisible(),r=this.isHorizontal();if(s){const s=Cb(o,e.options.font);if(r?(t.width=this.maxWidth,t.height=kb(n)+s):(t.height=this.maxHeight,t.width=kb(n)+s),i.display&&this.ticks.length){const{first:e,last:o,widest:n,highest:s}=this._getLabelSizes(),a=2*i.padding,l=Ym(this.labelRotation),d=Math.cos(l),c=Math.sin(l);if(r){const e=i.mirror?0:c*n.width+d*s.height;t.height=Math.min(this.maxHeight,t.height+e+a)}else{const e=i.mirror?0:d*n.width+c*s.height;t.width=Math.min(this.maxWidth,t.width+e+a)}this._calculatePadding(e,o,c,d)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,o){const{ticks:{align:n,padding:s},position:r}=this.options,a=0!==this.labelRotation,l="top"!==r&&"x"===this.axis;if(this.isHorizontal()){const r=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,h=0;a?l?(c=o*t.width,h=i*e.height):(c=i*t.height,h=o*e.width):"start"===n?h=e.width:"end"===n?c=t.width:"inner"!==n&&(c=t.width/2,h=e.width/2),this.paddingLeft=Math.max((c-r+s)*this.width/(this.width-r),0),this.paddingRight=Math.max((h-d+s)*this.width/(this.width-d),0)}else{let i=e.height/2,o=t.height/2;"start"===n?(i=0,o=t.height):"end"===n&&(i=e.height,o=0),this.paddingTop=i+s,this.paddingBottom=o+s}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ym(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)um(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=_b(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:o,_longestTextCache:n}=this,s=[],r=[],a=Math.floor(e/xb(e,i));let l,d,c,h,u,p,m,g,f,v,b,y=0,x=0;for(l=0;l<e;l+=a){if(h=t[l].label,u=this._resolveTickFontOptions(l),o.font=p=u.string,m=n[p]=n[p]||{data:{},gc:[]},g=u.lineHeight,f=v=0,um(h)||pm(h)){if(pm(h))for(d=0,c=h.length;d<c;++d)b=h[d],um(b)||pm(b)||(f=zg(o,m.data,m.gc,f,b),v+=g)}else f=zg(o,m.data,m.gc,f,h),v=g;s.push(f),r.push(v),y=Math.max(f,y),x=Math.max(v,x)}!function(t,e){xm(t,(t=>{const i=t.gc,o=i.length/2;let n;if(o>e){for(n=0;n<o;++n)delete t.data[i[n]];i.splice(0,o)}}))}(n,e);const _=s.indexOf(y),w=r.indexOf(x),k=t=>({width:s[t]||0,height:r[t]||0});return{first:k(0),last:k(e-1),widest:k(_),highest:k(w),widths:s,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return ig(this._alignToPixels?Rg(this.chart,e,0):e,-32768,32767)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=function(t,e,i){return af(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=af(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=Ym(this.labelRotation),i=Math.abs(Math.cos(e)),o=Math.abs(Math.sin(e)),n=this._getLabelSizes(),s=t.autoSkipPadding||0,r=n?n.widest.width+s:0,a=n?n.highest.height+s:0;return this.isHorizontal()?a*i>r*o?r/i:a/o:a*o<r*i?a/i:r/o}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,o=this.options,{grid:n,position:s,border:r}=o,a=n.offset,l=this.isHorizontal(),d=this.ticks.length+(a?1:0),c=kb(n),h=[],u=r.setContext(this.getContext()),p=u.display?u.width:0,m=p/2,g=function(t){return Rg(i,t,p)};let f,v,b,y,x,_,w,k,C,S,A,E;if("top"===s)f=g(this.bottom),_=this.bottom-c,k=f-m,S=g(t.top)+m,E=t.bottom;else if("bottom"===s)f=g(this.top),S=t.top,E=g(t.bottom)-m,_=f+m,k=this.top+c;else if("left"===s)f=g(this.right),x=this.right-c,w=f-m,C=g(t.left)+m,A=t.right;else if("right"===s)f=g(this.left),C=t.left,A=g(t.right)-m,x=f+m,w=this.left+c;else if("x"===e){if("center"===s)f=g((t.top+t.bottom)/2+.5);else if(mm(s)){const t=Object.keys(s)[0],e=s[t];f=g(this.chart.scales[t].getPixelForValue(e))}S=t.top,E=t.bottom,_=f+m,k=_+c}else if("y"===e){if("center"===s)f=g((t.left+t.right)/2);else if(mm(s)){const t=Object.keys(s)[0],e=s[t];f=g(this.chart.scales[t].getPixelForValue(e))}x=f-m,w=x-c,C=t.left,A=t.right}const $=vm(o.ticks.maxTicksLimit,d),T=Math.max(1,Math.ceil(d/$));for(v=0;v<d;v+=T){const t=this.getContext(v),e=n.setContext(t),o=r.setContext(t),s=e.lineWidth,d=e.color,c=o.dash||[],u=o.dashOffset,p=e.tickWidth,m=e.tickColor,g=e.tickBorderDash||[],f=e.tickBorderDashOffset;b=wb(this,v,a),void 0!==b&&(y=Rg(i,b,s),l?x=w=C=A=y:_=k=S=E=y,h.push({tx1:x,ty1:_,tx2:w,ty2:k,x1:C,y1:S,x2:A,y2:E,width:s,color:d,borderDash:c,borderDashOffset:u,tickWidth:p,tickColor:m,tickBorderDash:g,tickBorderDashOffset:f}))}return this._ticksLength=d,this._borderValue=f,h}_computeLabelItems(t){const e=this.axis,i=this.options,{position:o,ticks:n}=i,s=this.isHorizontal(),r=this.ticks,{align:a,crossAlign:l,padding:d,mirror:c}=n,h=kb(i.grid),u=h+d,p=c?-d:u,m=-Ym(this.labelRotation),g=[];let f,v,b,y,x,_,w,k,C,S,A,E,$="middle";if("top"===o)_=this.bottom-p,w=this._getXAxisLabelAlignment();else if("bottom"===o)_=this.top+p,w=this._getXAxisLabelAlignment();else if("left"===o){const t=this._getYAxisLabelAlignment(h);w=t.textAlign,x=t.x}else if("right"===o){const t=this._getYAxisLabelAlignment(h);w=t.textAlign,x=t.x}else if("x"===e){if("center"===o)_=(t.top+t.bottom)/2+u;else if(mm(o)){const t=Object.keys(o)[0],e=o[t];_=this.chart.scales[t].getPixelForValue(e)+u}w=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===o)x=(t.left+t.right)/2-u;else if(mm(o)){const t=Object.keys(o)[0],e=o[t];x=this.chart.scales[t].getPixelForValue(e)}w=this._getYAxisLabelAlignment(h).textAlign}"y"===e&&("start"===a?$="top":"end"===a&&($="bottom"));const T=this._getLabelSizes();for(f=0,v=r.length;f<v;++f){b=r[f],y=b.label;const t=n.setContext(this.getContext(f));k=this.getPixelForTick(f)+n.labelOffset,C=this._resolveTickFontOptions(f),S=C.lineHeight,A=pm(y)?y.length:1;const e=A/2,i=t.color,a=t.textStrokeColor,d=t.textStrokeWidth;let h,u=w;if(s?(x=k,"inner"===w&&(u=f===v-1?this.options.reverse?"left":"right":0===f?this.options.reverse?"right":"left":"center"),E="top"===o?"near"===l||0!==m?-A*S+S/2:"center"===l?-T.highest.height/2-e*S+S:-T.highest.height+S/2:"near"===l||0!==m?S/2:"center"===l?T.highest.height/2-e*S:T.highest.height-A*S,c&&(E*=-1),0===m||t.showLabelBackdrop||(x+=S/2*Math.sin(m))):(_=k,E=(1-A)*S/2),t.showLabelBackdrop){const e=nf(t.backdropPadding),i=T.heights[f],o=T.widths[f];let n=E-e.top,s=0-e.left;switch($){case"middle":n-=i/2;break;case"bottom":n-=i}switch(w){case"center":s-=o/2;break;case"right":s-=o;break;case"inner":f===v-1?s-=o:f>0&&(s-=o/2)}h={left:s,top:n,width:o+e.width,height:i+e.height,color:t.backdropColor}}g.push({label:y,font:C,textOffset:E,options:{rotation:m,color:i,strokeColor:a,strokeWidth:d,textAlign:u,textBaseline:$,translation:[x,_],backdrop:h}})}return g}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Ym(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:o,padding:n}}=this.options,s=t+n,r=this._getLabelSizes().widest.width;let a,l;return"left"===e?o?(l=this.right+n,"near"===i?a="left":"center"===i?(a="center",l+=r/2):(a="right",l+=r)):(l=this.right-s,"near"===i?a="right":"center"===i?(a="center",l-=r/2):(a="left",l=this.left)):"right"===e?o?(l=this.left+n,"near"===i?a="right":"center"===i?(a="center",l-=r/2):(a="left",l-=r)):(l=this.left+s,"near"===i?a="left":"center"===i?(a="center",l+=r/2):(a="right",l=this.right)):a="right",{textAlign:a,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:o,width:n,height:s}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,o,n,s),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks.findIndex((e=>e.value===t));if(i>=0){return e.setContext(this.getContext(i)).lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,o=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,s;const r=(t,e,o)=>{o.width&&o.color&&(i.save(),i.lineWidth=o.width,i.strokeStyle=o.color,i.setLineDash(o.borderDash||[]),i.lineDashOffset=o.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(n=0,s=o.length;n<s;++n){const t=o[n];e.drawOnChartArea&&r({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&r({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:o}}=this,n=i.setContext(this.getContext()),s=i.display?n.width:0;if(!s)return;const r=o.setContext(this.getContext(0)).lineWidth,a=this._borderValue;let l,d,c,h;this.isHorizontal()?(l=Rg(t,this.left,s)-s/2,d=Rg(t,this.right,r)+r/2,c=h=a):(c=Rg(t,this.top,s)-s/2,h=Rg(t,this.bottom,r)+r/2,l=d=a),e.save(),e.lineWidth=n.width,e.strokeStyle=n.color,e.beginPath(),e.moveTo(l,c),e.lineTo(d,h),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&Ug(e,i);const o=this.getLabelItems(t);for(const t of o){const i=t.options,o=t.font;Yg(e,t.label,0,t.textOffset,o,i)}i&&jg(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:o}}=this;if(!i.display)return;const n=sf(i.font),s=nf(i.padding),r=i.align;let a=n.lineHeight/2;"bottom"===e||"center"===e||mm(e)?(a+=s.bottom,pm(i.text)&&(a+=n.lineHeight*(i.text.length-1))):a+=s.top;const{titleX:l,titleY:d,maxWidth:c,rotation:h}=function(t,e,i,o){const{top:n,left:s,bottom:r,right:a,chart:l}=t,{chartArea:d,scales:c}=l;let h,u,p,m=0;const g=r-n,f=a-s;if(t.isHorizontal()){if(u=pg(o,s,a),mm(i)){const t=Object.keys(i)[0],o=i[t];p=c[t].getPixelForValue(o)+g-e}else p="center"===i?(d.bottom+d.top)/2+g-e:yb(t,i,e);h=a-s}else{if(mm(i)){const t=Object.keys(i)[0],o=i[t];u=c[t].getPixelForValue(o)-f+e}else u="center"===i?(d.left+d.right)/2-f+e:yb(t,i,e);p=pg(o,r,n),m="left"===i?-Bm:Bm}return{titleX:u,titleY:p,maxWidth:h,rotation:m}}(this,a,e,r);Yg(t,i.text,0,0,n,{color:i.color,maxWidth:c,rotation:h,textAlign:Sb(r,e,o),textBaseline:"middle",translation:[l,d]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=vm(t.grid&&t.grid.z,-1),o=vm(t.border&&t.border.z,0);return this._isVisible()&&this.draw===Ab.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:o,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",o=[];let n,s;for(n=0,s=e.length;n<s;++n){const s=e[n];s[i]!==this.id||t&&s.type!==t||o.push(s)}return o}_resolveTickFontOptions(t){return sf(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Eb{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const o=this.items,n=t.id,s=this.scope+"."+n;if(!n)throw new Error("class does not have id: "+t);return n in o||(o[n]=t,function(t,e,i){const o=Sm(Object.create(null),[i?Lg.get(i):{},Lg.get(e),t.defaults]);Lg.set(e,o),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{const o=i.split("."),n=o.pop(),s=[t].concat(o).join("."),r=e[i].split("."),a=r.pop(),l=r.join(".");Lg.route(s,n,l,a)}))}(e,t.defaultRoutes);t.descriptors&&Lg.describe(e,t.descriptors)}(t,s,i),this.override&&Lg.override(t.id,t.overrides)),s}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,o=this.scope;i in e&&delete e[i],o&&i in Lg[o]&&(delete Lg[o][i],this.override&&delete Tg[i])}}class $b{constructor(){this.controllers=new Eb(bv,"datasets",!0),this.elements=new Eb(fb,"elements"),this.plugins=new Eb(Object,"plugins"),this.scales=new Eb(Ab,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const o=i||this._getRegistryForType(e);i||o.isForType(e)||o===this.plugins&&e.id?this._exec(t,o,e):xm(e,(e=>{const o=i||this._getRegistryForType(e);this._exec(t,o,e)}))}))}_exec(t,e,i){const o=Dm(t);ym(i["before"+o],[],i),e[t](i),ym(i["after"+o],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const o=e.get(t);if(void 0===o)throw new Error('"'+t+'" is not a registered '+i+".");return o}}var Tb=new $b;class Db{constructor(){this._init=[]}notify(t,e,i,o){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const n=o?this._descriptors(t).filter(o):this._descriptors(t),s=this._notify(n,t,e,i);return"afterDestroy"===e&&(this._notify(n,t,"stop"),this._notify(this._init,t,"uninstall")),s}_notify(t,e,i,o){o=o||{};for(const n of t){const t=n.plugin;if(!1===ym(t[i],[e,o,n.options],t)&&o.cancelable)return!1}return!0}invalidate(){um(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,o=vm(i.options&&i.options.plugins,{}),n=function(t){const e={},i=[],o=Object.keys(Tb.plugins.items);for(let t=0;t<o.length;t++)i.push(Tb.getPlugin(o[t]));const n=t.plugins||[];for(let t=0;t<n.length;t++){const o=n[t];-1===i.indexOf(o)&&(i.push(o),e[o.id]=!0)}return{plugins:i,localIds:e}}(i);return!1!==o||e?function(t,{plugins:e,localIds:i},o,n){const s=[],r=t.getContext();for(const a of e){const e=a.id,l=Mb(o[e],n);null!==l&&s.push({plugin:a,options:Ib(t.config,{plugin:a,local:i[e]},l,r)})}return s}(t,n,o,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,o=(t,e)=>t.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(o(e,i),t,"stop"),this._notify(o(i,e),t,"start")}}function Mb(t,e){return e||!1!==t?!0===t?{}:t:null}function Ib(t,{plugin:e,local:i},o,n){const s=t.pluginScopeKeys(e),r=t.getOptionScopes(o,s);return i&&e.defaults&&r.push(e.defaults),t.createResolver(r,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Ob(t,e){const i=Lg.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function Lb(t){if("x"===t||"y"===t||"r"===t)return t}function zb(t,...e){if(Lb(t))return t;for(const o of e){const e=o.axis||("top"===(i=o.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.length>1&&Lb(t[0].toLowerCase());if(e)return e}var i;throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function Pb(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function Rb(t,e){const i=Tg[t.type]||{scales:{}},o=e.scales||{},n=Ob(t.type,e),s=Object.create(null);return Object.keys(o).forEach((e=>{const r=o[e];if(!mm(r))return console.error(`Invalid scale configuration for scale: ${e}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);const a=zb(e,r,function(t,e){if(e.data&&e.data.datasets){const i=e.data.datasets.filter((e=>e.xAxisID===t||e.yAxisID===t));if(i.length)return Pb(t,"x",i[0])||Pb(t,"y",i[0])}return{}}(e,t),Lg.scales[r.type]),l=function(t,e){return t===e?"_index_":"_value_"}(a,n),d=i.scales||{};s[e]=Am(Object.create(null),[{axis:a},r,d[a],d[l]])})),t.data.datasets.forEach((i=>{const n=i.type||t.type,r=i.indexAxis||Ob(n,e),a=(Tg[n]||{}).scales||{};Object.keys(a).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,r),n=i[e+"AxisID"]||e;s[n]=s[n]||Object.create(null),Am(s[n],[{axis:e},o[n],a[t]])}))})),Object.keys(s).forEach((t=>{const e=s[t];Am(e,[Lg.scales[e.type],Lg.scale])})),s}function Nb(t){const e=t.options||(t.options={});e.plugins=vm(e.plugins,{}),e.scales=Rb(t,e)}function Bb(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const Fb=new Map,qb=new Set;function Ub(t,e){let i=Fb.get(t);return i||(i=e(),Fb.set(t,i),qb.add(i)),i}const jb=(t,e,i)=>{const o=Tm(e,i);void 0!==o&&t.add(o)};class Vb{constructor(t){this._config=function(t){return(t=t||{}).data=Bb(t.data),Nb(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Bb(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Nb(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ub(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return Ub(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return Ub(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return Ub(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let o=i.get(t);return o&&!e||(o=new Map,i.set(t,o)),o}getOptionScopes(t,e,i){const{options:o,type:n}=this,s=this._cachedScopes(t,i),r=s.get(e);if(r)return r;const a=new Set;e.forEach((e=>{t&&(a.add(t),e.forEach((e=>jb(a,t,e)))),e.forEach((t=>jb(a,o,t))),e.forEach((t=>jb(a,Tg[n]||{},t))),e.forEach((t=>jb(a,Lg,t))),e.forEach((t=>jb(a,Dg,t)))}));const l=Array.from(a);return 0===l.length&&l.push(Object.create(null)),qb.has(e)&&s.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,Tg[e]||{},Lg.datasets[e]||{},{type:e},Lg,Dg]}resolveNamedOptions(t,e,i,o=[""]){const n={$shared:!0},{resolver:s,subPrefixes:r}=Hb(this._resolverCache,t,o);let a=s;if(function(t,e){const{isScriptable:i,isIndexable:o}=cf(t);for(const n of e){const e=i(n),s=o(n),r=(s||e)&&t[n];if(e&&(Im(r)||Wb(r))||s&&pm(r))return!0}return!1}(s,e)){n.$shared=!1;a=df(s,i=Im(i)?i():i,this.createResolver(t,i,r))}for(const t of e)n[t]=a[t];return n}createResolver(t,e,i=[""],o){const{resolver:n}=Hb(this._resolverCache,t,i);return mm(e)?df(n,e,void 0,o):n}}function Hb(t,e,i){let o=t.get(e);o||(o=new Map,t.set(e,o));const n=i.join();let s=o.get(n);if(!s){s={resolver:lf(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},o.set(n,s)}return s}const Wb=t=>mm(t)&&Object.getOwnPropertyNames(t).some((e=>Im(t[e])));const Zb=["top","bottom","left","right","chartArea"];function Yb(t,e){return"top"===t||"bottom"===t||-1===Zb.indexOf(t)&&"x"===e}function Gb(t,e){return function(i,o){return i[t]===o[t]?i[e]-o[e]:i[t]-o[t]}}function Kb(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),ym(i&&i.onComplete,[t],e)}function Xb(t){const e=t.chart,i=e.options.animation;ym(i&&i.onProgress,[t],e)}function Qb(t){return Tf()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const Jb={},ty=t=>{const e=Qb(t);return Object.values(Jb).filter((t=>t.canvas===e)).pop()};function ey(t,e,i){const o=Object.keys(t);for(const n of o){const o=+n;if(o>=e){const s=t[n];delete t[n],(i>0||o>e)&&(t[o+i]=s)}}}function iy(t,e,i){return t.options.clip?t[i]:e[i]}class oy{static defaults=Lg;static instances=Jb;static overrides=Tg;static registry=Tb;static version="4.4.8";static getChart=ty;static register(...t){Tb.add(...t),ny()}static unregister(...t){Tb.remove(...t),ny()}constructor(t,e){const i=this.config=new Vb(e),o=Qb(t),n=ty(o);if(n)throw new Error("Canvas is already in use. Chart with ID '"+n.id+"' must be destroyed before the canvas with ID '"+n.canvas.id+"' can be reused.");const s=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||function(t){return!Tf()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?tb:gb}(o)),this.platform.updateConfig(i);const r=this.platform.acquireContext(o,s.aspectRatio),a=r&&r.canvas,l=a&&a.height,d=a&&a.width;this.id=hm(),this.ctx=r,this.canvas=a,this.width=d,this.height=l,this._options=s,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Db,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(t,e){let i;return function(...o){return e?(clearTimeout(i),i=setTimeout(t,e,o)):t.apply(this,o),e}}((t=>this.update(t)),s.resizeDelay||0),this._dataChanges=[],Jb[this.id]=this,r&&a?(iv.listen(this,"complete",Kb),iv.listen(this,"progress",Xb),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:o,_aspectRatio:n}=this;return um(t)?e&&n?n:o?i/o:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Tb}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Bf(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ng(this.canvas,this.ctx),this}stop(){return iv.stop(this),this}resize(t,e){iv.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,o=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,s=this.platform.getMaximumSize(o,t,e,n),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),a=this.width?"resize":"attach";this.width=s.width,this.height=s.height,this._aspectRatio=this.aspectRatio,Bf(this,r,!0)&&(this.notifyPlugins("resize",{size:s}),ym(i.onResize,[this,s],this),this.attached&&this._doResize(a)&&this.render())}ensureScalesHaveIDs(){xm(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,o=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let n=[];e&&(n=n.concat(Object.keys(e).map((t=>{const i=e[t],o=zb(t,i),n="r"===o,s="x"===o;return{options:i,dposition:n?"chartArea":s?"bottom":"left",dtype:n?"radialLinear":s?"category":"linear"}})))),xm(n,(e=>{const n=e.options,s=n.id,r=zb(s,n),a=vm(n.type,e.dtype);void 0!==n.position&&Yb(n.position,r)===Yb(e.dposition)||(n.position=e.dposition),o[s]=!0;let l=null;if(s in i&&i[s].type===a)l=i[s];else{l=new(Tb.getScale(a))({id:s,type:a,ctx:this.ctx,chart:this}),i[l.id]=l}l.init(n,t)})),xm(o,((t,e)=>{t||delete i[e]})),xm(i,(t=>{Qv.configure(this,t,t.options),Qv.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(Gb("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,o;for(this._removeUnreferencedMetasets(),i=0,o=e.length;i<o;i++){const o=e[i];let n=this.getDatasetMeta(i);const s=o.type||this.config.type;if(n.type&&n.type!==s&&(this._destroyDatasetMeta(i),n=this.getDatasetMeta(i)),n.type=s,n.indexAxis=o.indexAxis||Ob(s,this.options),n.order=o.order||0,n.index=i,n.label=""+o.label,n.visible=this.isDatasetVisible(i),n.controller)n.controller.updateIndex(i),n.controller.linkScales();else{const e=Tb.getController(s),{datasetElementType:o,dataElementType:r}=Lg.datasets[s];Object.assign(e,{dataElementType:Tb.getElement(r),datasetElementType:o&&Tb.getElement(o)}),n.controller=new e(this,i),t.push(n.controller)}}return this._updateMetasets(),t}_resetElements(){xm(this.data.datasets,((t,e)=>{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),o=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let s=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const{controller:e}=this.getDatasetMeta(t),i=!o&&-1===n.indexOf(e);e.buildOrUpdateElements(i),s=Math.max(+e.getMaxOverflow(),s)}s=this._minPadding=i.layout.autoPadding?s:0,this._updateLayout(s),o||xm(n,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Gb("z","_idx"));const{_active:r,_lastEvent:a}=this;a?this._eventHandler(a,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){xm(this.scales,(t=>{Qv.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);Om(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:o,count:n}of e){ey(t,o,"_removeElements"===i?-n:n)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),o=i(0);for(let t=1;t<e;t++)if(!Om(o,i(t)))return;return Array.from(o).map((t=>t.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;Qv.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],xm(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,Im(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),o={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",o)&&(i.controller._update(e),o.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",o))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(iv.has(this)?this.attached&&!iv.running(this)&&iv.start(this):(this.draw(),Kb({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,e)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let o,n;for(o=0,n=e.length;o<n;++o){const n=e[o];t&&!n.visible||i.push(n)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,o=!i.disabled,n=function(t,e){const{xScale:i,yScale:o}=t;return i&&o?{left:iy(i,e,"left"),right:iy(i,e,"right"),top:iy(o,e,"top"),bottom:iy(o,e,"bottom")}:e}(t,this.chartArea),s={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",s)&&(o&&Ug(e,{left:!1===i.left?0:n.left-i.left,right:!1===i.right?this.width:n.right+i.right,top:!1===i.top?0:n.top-i.top,bottom:!1===i.bottom?this.height:n.bottom+i.bottom}),t.controller.draw(),o&&jg(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return qg(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,o){const n=Bv.modes[e];return"function"==typeof n?n(this,t,i,o):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let o=i.filter((t=>t&&t._dataset===e)).pop();return o||(o={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(o)),o}getContext(){return this.$context||(this.$context=af(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const o=i?"show":"hide",n=this.getDatasetMeta(t),s=n.controller._resolveAnimations(void 0,o);Mm(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),s.update(n,{visible:i}),this.update((e=>e.datasetIndex===t?o:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),iv.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Ng(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Jb[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(i,o)=>{e.addEventListener(this,i,o),t[i]=o},o=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};xm(this.options.events,(t=>i(t,o)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,o)=>{e.addEventListener(this,i,o),t[i]=o},o=(i,o)=>{t[i]&&(e.removeEventListener(this,i,o),delete t[i])},n=(t,e)=>{this.canvas&&this.resize(t,e)};let s;const r=()=>{o("attach",r),this.attached=!0,this.resize(),i("resize",n),i("detach",s)};s=()=>{this.attached=!1,o("resize",n),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():s()}unbindEvents(){xm(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},xm(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const o=i?"set":"remove";let n,s,r,a;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+o+"DatasetHoverStyle"]()),r=0,a=t.length;r<a;++r){s=t[r];const e=s&&this.getDatasetMeta(s.datasetIndex).controller;e&&e[o+"HoverStyle"](s.element,s.datasetIndex,s.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map((({datasetIndex:t,index:e})=>{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!_m(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter((e=>e.plugin.id===t)).length}_updateHoverStyles(t,e,i){const o=this.options.hover,n=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),s=n(e,t),r=i?t:n(t,e);s.length&&this.updateHoverStyle(s,o.mode,!1),r.length&&o.mode&&this.updateHoverStyle(r,o.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},o=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,o))return;const n=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,o),(n||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:o=[],options:n}=this,s=e,r=this._getActiveElements(t,o,i,s),a=function(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}(t),l=function(t,e,i,o){return i&&"mouseout"!==t.type?o?e:t:null}(t,this._lastEvent,i,a);i&&(this._lastEvent=null,ym(n.onHover,[t,r,this],this),a&&ym(n.onClick,[t,r,this],this));const d=!_m(r,o);return(d||e)&&(this._active=r,this._updateHoverStyles(r,o,e)),this._lastEvent=l,d}_getActiveElements(t,e,i,o){if("mouseout"===t.type)return[];if(!i)return e;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,o)}}function ny(){return xm(oy.instances,(t=>t._plugins.invalidate()))}function sy(t,e,i,o){const n=tf(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const s=(i-e)/2,r=Math.min(s,o*e/2),a=t=>{const e=(i-Math.min(s,t))*o/2;return ig(t,0,Math.min(s,e))};return{outerStart:a(n.outerStart),outerEnd:a(n.outerEnd),innerStart:ig(n.innerStart,0,r),innerEnd:ig(n.innerEnd,0,r)}}function ry(t,e,i,o){return{x:i+t*Math.cos(e),y:o+t*Math.sin(e)}}function ay(t,e,i,o,n,s){const{x:r,y:a,startAngle:l,pixelMargin:d,innerRadius:c}=e,h=Math.max(e.outerRadius+o+i-d,0),u=c>0?c+o+i+d:0;let p=0;const m=n-l;if(o){const t=((c>0?c-o:0)+(h>0?h-o:0))/2;p=(m-(0!==t?m*t/(t+o):m))/2}const g=(m-Math.max(.001,m*h-i/Lm)/h)/2,f=l+g+p,v=n-g-p,{outerStart:b,outerEnd:y,innerStart:x,innerEnd:_}=sy(e,u,h,v-f),w=h-b,k=h-y,C=f+b/w,S=v-y/k,A=u+x,E=u+_,$=f+x/A,T=v-_/E;if(t.beginPath(),s){const e=(C+S)/2;if(t.arc(r,a,h,C,e),t.arc(r,a,h,e,S),y>0){const e=ry(k,S,r,a);t.arc(e.x,e.y,y,S,v+Bm)}const i=ry(E,v,r,a);if(t.lineTo(i.x,i.y),_>0){const e=ry(E,T,r,a);t.arc(e.x,e.y,_,v+Bm,T+Math.PI)}const o=(v-_/u+(f+x/u))/2;if(t.arc(r,a,u,v-_/u,o,!0),t.arc(r,a,u,o,f+x/u,!0),x>0){const e=ry(A,$,r,a);t.arc(e.x,e.y,x,$+Math.PI,f-Bm)}const n=ry(w,f,r,a);if(t.lineTo(n.x,n.y),b>0){const e=ry(w,C,r,a);t.arc(e.x,e.y,b,f-Bm,C)}}else{t.moveTo(r,a);const e=Math.cos(C)*h+r,i=Math.sin(C)*h+a;t.lineTo(e,i);const o=Math.cos(S)*h+r,n=Math.sin(S)*h+a;t.lineTo(o,n)}t.closePath()}function ly(t,e,i,o,n){const{fullCircles:s,startAngle:r,circumference:a,options:l}=e,{borderWidth:d,borderJoinStyle:c,borderDash:h,borderDashOffset:u}=l,p="inner"===l.borderAlign;if(!d)return;t.setLineDash(h||[]),t.lineDashOffset=u,p?(t.lineWidth=2*d,t.lineJoin=c||"round"):(t.lineWidth=d,t.lineJoin=c||"bevel");let m=e.endAngle;if(s){ay(t,e,i,o,m,n);for(let e=0;e<s;++e)t.stroke();isNaN(a)||(m=r+(a%zm||zm))}p&&function(t,e,i){const{startAngle:o,pixelMargin:n,x:s,y:r,outerRadius:a,innerRadius:l}=e;let d=n/a;t.beginPath(),t.arc(s,r,a,o-d,i+d),l>n?(d=n/l,t.arc(s,r,l,i+d,o-d,!0)):t.arc(s,r,n,i+Bm,o-Bm),t.closePath(),t.clip()}(t,e,m),s||(ay(t,e,i,o,m,n),t.stroke())}class dy extends fb{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const o=this.getProps(["x","y"],i),{angle:n,distance:s}=Xm(o,{x:t,y:e}),{startAngle:r,endAngle:a,innerRadius:l,outerRadius:d,circumference:c}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),h=(this.options.spacing+this.options.borderWidth)/2,u=vm(c,a-r),p=eg(n,r,a)&&r!==a,m=u>=zm||p,g=og(s,l+h,d+h);return m&&g}getCenterPoint(t){const{x:e,y:i,startAngle:o,endAngle:n,innerRadius:s,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:a,spacing:l}=this.options,d=(o+n)/2,c=(s+r+l+a)/2;return{x:e+Math.cos(d)*c,y:i+Math.sin(d)*c}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,o=(e.offset||0)/4,n=(e.spacing||0)/2,s=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>zm?Math.floor(i/zm):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();const r=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(r)*o,Math.sin(r)*o);const a=o*(1-Math.sin(Math.min(Lm,i||0)));t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,function(t,e,i,o,n){const{fullCircles:s,startAngle:r,circumference:a}=e;let l=e.endAngle;if(s){ay(t,e,i,o,l,n);for(let e=0;e<s;++e)t.fill();isNaN(a)||(l=r+(a%zm||zm))}ay(t,e,i,o,l,n),t.fill()}(t,this,a,n,s),ly(t,this,a,n,s),t.restore()}}function cy(t,e,i=e){t.lineCap=vm(i.borderCapStyle,e.borderCapStyle),t.setLineDash(vm(i.borderDash,e.borderDash)),t.lineDashOffset=vm(i.borderDashOffset,e.borderDashOffset),t.lineJoin=vm(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=vm(i.borderWidth,e.borderWidth),t.strokeStyle=vm(i.borderColor,e.borderColor)}function hy(t,e,i){t.lineTo(i.x,i.y)}function uy(t,e,i={}){const o=t.length,{start:n=0,end:s=o-1}=i,{start:r,end:a}=e,l=Math.max(n,r),d=Math.min(s,a),c=n<r&&s<r||n>a&&s>a;return{count:o,start:l,loop:e.loop,ilen:d<l&&!c?o+d-l:d-l}}function py(t,e,i,o){const{points:n,options:s}=e,{count:r,start:a,loop:l,ilen:d}=uy(n,i,o),c=function(t){return t.stepped?Vg:t.tension||"monotone"===t.cubicInterpolationMode?Hg:hy}(s);let h,u,p,{move:m=!0,reverse:g}=o||{};for(h=0;h<=d;++h)u=n[(a+(g?d-h:h))%r],u.skip||(m?(t.moveTo(u.x,u.y),m=!1):c(t,p,u,g,s.stepped),p=u);return l&&(u=n[(a+(g?d:0))%r],c(t,p,u,g,s.stepped)),!!l}function my(t,e,i,o){const n=e.points,{count:s,start:r,ilen:a}=uy(n,i,o),{move:l=!0,reverse:d}=o||{};let c,h,u,p,m,g,f=0,v=0;const b=t=>(r+(d?a-t:t))%s,y=()=>{p!==m&&(t.lineTo(f,m),t.lineTo(f,p),t.lineTo(f,g))};for(l&&(h=n[b(0)],t.moveTo(h.x,h.y)),c=0;c<=a;++c){if(h=n[b(c)],h.skip)continue;const e=h.x,i=h.y,o=0|e;o===u?(i<p?p=i:i>m&&(m=i),f=(v*f+e)/++v):(y(),t.lineTo(e,i),u=o,v=0,p=m=i),g=i}y()}function gy(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?my:py}const fy="function"==typeof Path2D;function vy(t,e,i,o){fy&&!e.options.segment?function(t,e,i,o){let n=e._path;n||(n=e._path=new Path2D,e.path(n,i,o)&&n.closePath()),cy(t,e.options),t.stroke(n)}(t,e,i,o):function(t,e,i,o){const{segments:n,options:s}=e,r=gy(e);for(const a of n)cy(t,s,a.style),t.beginPath(),r(t,e,a,{start:i,end:i+o-1})&&t.closePath(),t.stroke()}(t,e,i,o)}class by extends fb{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const o=i.spanGaps?this._loop:this._fullLoop;$f(this._points,i,t,o,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(t,e){const i=t.points,o=t.options.spanGaps,n=i.length;if(!n)return[];const s=!!t._loop,{start:r,end:a}=function(t,e,i,o){let n=0,s=e-1;if(i&&!o)for(;n<e&&!t[n].skip;)n++;for(;n<e&&t[n].skip;)n++;for(n%=e,i&&(s+=n);s>n&&t[s%e].skip;)s--;return s%=e,{start:n,end:s}}(i,n,s,o);return Qf(t,!0===o?[{start:r,end:a,loop:s}]:function(t,e,i,o){const n=t.length,s=[];let r,a=e,l=t[e];for(r=e+1;r<=i;++r){const i=t[r%n];i.skip||i.stop?l.skip||(o=!1,s.push({start:e%n,end:(r-1)%n,loop:o}),e=a=i.stop?r:null):(a=r,l.skip&&(e=r)),l=i}return null!==a&&s.push({start:e%n,end:a%n,loop:o}),s}(i,r,a<r?a+n:a,!!t._fullLoop&&0===r&&a===n-1),i,e)}(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,o=t[e],n=this.points,s=Xf(this,{property:e,start:o,end:o});if(!s.length)return;const r=[],a=function(t){return t.stepped?jf:t.tension||"monotone"===t.cubicInterpolationMode?Vf:Uf}(i);let l,d;for(l=0,d=s.length;l<d;++l){const{start:d,end:c}=s[l],h=n[d],u=n[c];if(h===u){r.push(h);continue}const p=a(h,u,Math.abs((o-h[e])/(u[e]-h[e])),i.stepped);p[e]=t[e],r.push(p)}return 1===r.length?r[0]:r}pathSegment(t,e,i){return gy(this)(t,this,e,i)}path(t,e,i){const o=this.segments,n=gy(this);let s=this._loop;e=e||0,i=i||this.points.length-e;for(const r of o)s&=n(t,this,r,{start:e,end:e+i-1});return!!s}draw(t,e,i,o){const n=this.options||{};(this.points||[]).length&&n.borderWidth&&(t.save(),vy(t,this,i,o),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function yy(t,e,i,o){const n=t.options,{[i]:s}=t.getProps([i],o);return Math.abs(e-s)<n.radius+n.hitRadius}class xy extends fb{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const o=this.options,{x:n,y:s}=this.getProps(["x","y"],i);return Math.pow(t-n,2)+Math.pow(e-s,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(t,e){return yy(this,t,"x",e)}inYRange(t,e){return yy(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0;e=Math.max(e,e&&t.hoverRadius||0);return 2*(e+(e&&t.borderWidth||0))}draw(t,e){const i=this.options;this.skip||i.radius<.1||!qg(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,Bg(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function _y(t,e){const{x:i,y:o,base:n,width:s,height:r}=t.getProps(["x","y","base","width","height"],e);let a,l,d,c,h;return t.horizontal?(h=r/2,a=Math.min(i,n),l=Math.max(i,n),d=o-h,c=o+h):(h=s/2,a=i-h,l=i+h,d=Math.min(o,n),c=Math.max(o,n)),{left:a,top:d,right:l,bottom:c}}function wy(t,e,i,o){return t?0:ig(e,i,o)}function ky(t){const e=_y(t),i=e.right-e.left,o=e.bottom-e.top,n=function(t,e,i){const o=t.options.borderWidth,n=t.borderSkipped,s=ef(o);return{t:wy(n.top,s.top,0,i),r:wy(n.right,s.right,0,e),b:wy(n.bottom,s.bottom,0,i),l:wy(n.left,s.left,0,e)}}(t,i/2,o/2),s=function(t,e,i){const{enableBorderRadius:o}=t.getProps(["enableBorderRadius"]),n=t.options.borderRadius,s=of(n),r=Math.min(e,i),a=t.borderSkipped,l=o||mm(n);return{topLeft:wy(!l||a.top||a.left,s.topLeft,0,r),topRight:wy(!l||a.top||a.right,s.topRight,0,r),bottomLeft:wy(!l||a.bottom||a.left,s.bottomLeft,0,r),bottomRight:wy(!l||a.bottom||a.right,s.bottomRight,0,r)}}(t,i/2,o/2);return{outer:{x:e.left,y:e.top,w:i,h:o,radius:s},inner:{x:e.left+n.l,y:e.top+n.t,w:i-n.l-n.r,h:o-n.t-n.b,radius:{topLeft:Math.max(0,s.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,s.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,s.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,s.bottomRight-Math.max(n.b,n.r))}}}}function Cy(t,e,i,o){const n=null===e,s=null===i,r=t&&!(n&&s)&&_y(t,o);return r&&(n||og(e,r.left,r.right))&&(s||og(i,r.top,r.bottom))}function Sy(t,e){t.rect(e.x,e.y,e.w,e.h)}function Ay(t,e,i={}){const o=t.x!==i.x?-e:0,n=t.y!==i.y?-e:0,s=(t.x+t.w!==i.x+i.w?e:0)-o,r=(t.y+t.h!==i.y+i.h?e:0)-n;return{x:t.x+o,y:t.y+n,w:t.w+s,h:t.h+r,radius:t.radius}}class Ey extends fb{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:o}}=this,{inner:n,outer:s}=ky(this),r=(a=s.radius).topLeft||a.topRight||a.bottomLeft||a.bottomRight?Gg:Sy;var a;t.save(),s.w===n.w&&s.h===n.h||(t.beginPath(),r(t,Ay(s,e,n)),t.clip(),r(t,Ay(n,-e,s)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),r(t,Ay(n,e)),t.fillStyle=o,t.fill(),t.restore()}inRange(t,e,i){return Cy(this,t,e,i)}inXRange(t,e){return Cy(this,t,null,e)}inYRange(t,e){return Cy(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:o,horizontal:n}=this.getProps(["x","y","base","horizontal"],t);return{x:n?(e+o)/2:e,y:n?i:(i+o)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}}var $y=Object.freeze({__proto__:null,ArcElement:dy,BarElement:Ey,LineElement:by,PointElement:xy});const Ty=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Dy=Ty.map((t=>t.replace("rgb(","rgba(").replace(")",", 0.5)")));function My(t){return Ty[t%Ty.length]}function Iy(t){return Dy[t%Dy.length]}function Oy(t){let e=0;return(i,o)=>{const n=t.getDatasetMeta(o).controller;n instanceof Ev?e=function(t,e){return t.backgroundColor=t.data.map((()=>My(e++))),e}(i,e):n instanceof $v?e=function(t,e){return t.backgroundColor=t.data.map((()=>Iy(e++))),e}(i,e):n&&(e=function(t,e){return t.borderColor=My(e),t.backgroundColor=Iy(e),++e}(i,e))}}function Ly(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}var zy={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){if(!i.enabled)return;const{data:{datasets:o},options:n}=t.config,{elements:s}=n,r=Ly(o)||(a=n)&&(a.borderColor||a.backgroundColor)||s&&Ly(s)||"rgba(0,0,0,0.1)"!==Lg.borderColor||"rgba(0,0,0,0.1)"!==Lg.backgroundColor;var a;if(!i.forceOverride&&r)return;const l=Oy(t);o.forEach(l)}};function Py(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function Ry(t){t.data.datasets.forEach((t=>{Py(t)}))}var Ny={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void Ry(t);const o=t.width;t.data.datasets.forEach(((e,n)=>{const{_data:s,indexAxis:r}=e,a=t.getDatasetMeta(n),l=s||e.data;if("y"===rf([r,t.options.indexAxis]))return;if(!a.controller.supportsDecimation)return;const d=t.scales[a.xAxisID];if("linear"!==d.type&&"time"!==d.type)return;if(t.options.parsing)return;let{start:c,count:h}=function(t,e){const i=e.length;let o,n=0;const{iScale:s}=t,{min:r,max:a,minDefined:l,maxDefined:d}=s.getUserBounds();return l&&(n=ig(sg(e,s.axis,r).lo,0,i-1)),o=d?ig(sg(e,s.axis,a).hi+1,n,i)-n:i-n,{start:n,count:o}}(a,l);if(h<=(i.threshold||4*o))return void Py(e);let u;switch(um(s)&&(e._data=l,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":u=function(t,e,i,o,n){const s=n.samples||o;if(s>=i)return t.slice(e,e+i);const r=[],a=(i-2)/(s-2);let l=0;const d=e+i-1;let c,h,u,p,m,g=e;for(r[l++]=t[g],c=0;c<s-2;c++){let o,n=0,s=0;const d=Math.floor((c+1)*a)+1+e,f=Math.min(Math.floor((c+2)*a)+1,i)+e,v=f-d;for(o=d;o<f;o++)n+=t[o].x,s+=t[o].y;n/=v,s/=v;const b=Math.floor(c*a)+1+e,y=Math.min(Math.floor((c+1)*a)+1,i)+e,{x:x,y:_}=t[g];for(u=p=-1,o=b;o<y;o++)p=.5*Math.abs((x-n)*(t[o].y-_)-(x-t[o].x)*(s-_)),p>u&&(u=p,h=t[o],m=o);r[l++]=h,g=m}return r[l++]=t[d],r}(l,c,h,o,i);break;case"min-max":u=function(t,e,i,o){let n,s,r,a,l,d,c,h,u,p,m=0,g=0;const f=[],v=e+i-1,b=t[e].x,y=t[v].x-b;for(n=e;n<e+i;++n){s=t[n],r=(s.x-b)/y*o,a=s.y;const e=0|r;if(e===l)a<u?(u=a,d=n):a>p&&(p=a,c=n),m=(g*m+s.x)/++g;else{const i=n-1;if(!um(d)&&!um(c)){const e=Math.min(d,c),o=Math.max(d,c);e!==h&&e!==i&&f.push({...t[e],x:m}),o!==h&&o!==i&&f.push({...t[o],x:m})}n>0&&i!==h&&f.push(t[i]),f.push(s),l=e,g=0,u=p=a,d=c=h=n}}return f}(l,c,h,o);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=u}))},destroy(t){Ry(t)}};function By(t,e,i,o){if(o)return;let n=e[t],s=i[t];return"angle"===t&&(n=tg(n),s=tg(s)),{property:t,start:n,end:s}}function Fy(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function qy(t,e,i,o){return t&&e?o(t[i],e[i]):t?t[i]:e?e[i]:0}function Uy(t,e){let i=[],o=!1;return pm(t)?(o=!0,i=t):i=function(t,e){const{x:i=null,y:o=null}=t||{},n=e.points,s=[];return e.segments.forEach((({start:t,end:e})=>{e=Fy(t,e,n);const r=n[t],a=n[e];null!==o?(s.push({x:r.x,y:o}),s.push({x:a.x,y:o})):null!==i&&(s.push({x:i,y:r.y}),s.push({x:i,y:a.y}))})),s}(t,e),i.length?new by({points:i,options:{tension:0},_loop:o,_fullLoop:o}):null}function jy(t){return t&&!1!==t.fill}function Vy(t,e,i){let o=t[e].fill;const n=[e];let s;if(!i)return o;for(;!1!==o&&-1===n.indexOf(o);){if(!gm(o))return o;if(s=t[o],!s)return!1;if(s.visible)return o;n.push(o),o=s.fill}return!1}function Hy(t,e,i){const o=function(t){const e=t.options,i=e.fill;let o=vm(i&&i.target,i);void 0===o&&(o=!!e.backgroundColor);if(!1===o||null===o)return!1;if(!0===o)return"origin";return o}(t);if(mm(o))return!isNaN(o.value)&&o;let n=parseFloat(o);return gm(n)&&Math.floor(n)===n?function(t,e,i,o){"-"!==t&&"+"!==t||(i=e+i);if(i===e||i<0||i>=o)return!1;return i}(o[0],e,n,i):["origin","start","end","stack","shape"].indexOf(o)>=0&&o}function Wy(t,e,i){const o=[];for(let n=0;n<i.length;n++){const s=i[n],{first:r,last:a,point:l}=Zy(s,e,"x");if(!(!l||r&&a))if(r)o.unshift(l);else if(t.push(l),!a)break}t.push(...o)}function Zy(t,e,i){const o=t.interpolate(e,i);if(!o)return{};const n=o[i],s=t.segments,r=t.points;let a=!1,l=!1;for(let t=0;t<s.length;t++){const e=s[t],o=r[e.start][i],d=r[e.end][i];if(og(n,o,d)){a=n===o,l=n===d;break}}return{first:a,last:l,point:o}}class Yy{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:o,y:n,radius:s}=this;return e=e||{start:0,end:zm},t.arc(o,n,s,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:o}=this,n=t.angle;return{x:e+Math.cos(n)*o,y:i+Math.sin(n)*o,angle:n}}}function Gy(t){const{chart:e,fill:i,line:o}=t;if(gm(i))return function(t,e){const i=t.getDatasetMeta(e),o=i&&t.isDatasetVisible(e);return o?i.dataset:null}(e,i);if("stack"===i)return function(t){const{scale:e,index:i,line:o}=t,n=[],s=o.segments,r=o.points,a=function(t,e){const i=[],o=t.getMatchingVisibleMetas("line");for(let t=0;t<o.length;t++){const n=o[t];if(n.index===e)break;n.hidden||i.unshift(n.dataset)}return i}(e,i);a.push(Uy({x:null,y:e.bottom},o));for(let t=0;t<s.length;t++){const e=s[t];for(let t=e.start;t<=e.end;t++)Wy(n,r[t],a)}return new by({points:n,options:{}})}(t);if("shape"===i)return!0;const n=function(t){const e=t.scale||{};if(e.getPointPositionForValue)return function(t){const{scale:e,fill:i}=t,o=e.options,n=e.getLabels().length,s=o.reverse?e.max:e.min,r=function(t,e,i){let o;return o="start"===t?i:"end"===t?e.options.reverse?e.min:e.max:mm(t)?t.value:e.getBaseValue(),o}(i,e,s),a=[];if(o.grid.circular){const t=e.getPointPositionForValue(0,s);return new Yy({x:t.x,y:t.y,radius:e.getDistanceFromCenterForValue(r)})}for(let t=0;t<n;++t)a.push(e.getPointPositionForValue(t,r));return a}(t);return function(t){const{scale:e={},fill:i}=t,o=function(t,e){let i=null;return"start"===t?i=e.bottom:"end"===t?i=e.top:mm(t)?i=e.getPixelForValue(t.value):e.getBasePixel&&(i=e.getBasePixel()),i}(i,e);if(gm(o)){const t=e.isHorizontal();return{x:t?o:null,y:t?null:o}}return null}(t)}(t);return n instanceof Yy?n:Uy(n,o)}function Ky(t,e,i){const o=Gy(e),{line:n,scale:s,axis:r}=e,a=n.options,l=a.fill,d=a.backgroundColor,{above:c=d,below:h=d}=l||{};o&&n.points.length&&(Ug(t,i),function(t,e){const{line:i,target:o,above:n,below:s,area:r,scale:a}=e,l=i._loop?"angle":e.axis;t.save(),"x"===l&&s!==n&&(Xy(t,o,r.top),Qy(t,{line:i,target:o,color:n,scale:a,property:l}),t.restore(),t.save(),Xy(t,o,r.bottom));Qy(t,{line:i,target:o,color:s,scale:a,property:l}),t.restore()}(t,{line:n,target:o,above:c,below:h,area:i,scale:s,axis:r}),jg(t))}function Xy(t,e,i){const{segments:o,points:n}=e;let s=!0,r=!1;t.beginPath();for(const a of o){const{start:o,end:l}=a,d=n[o],c=n[Fy(o,l,n)];s?(t.moveTo(d.x,d.y),s=!1):(t.lineTo(d.x,i),t.lineTo(d.x,d.y)),r=!!e.pathSegment(t,a,{move:r}),r?t.closePath():t.lineTo(c.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function Qy(t,e){const{line:i,target:o,property:n,color:s,scale:r}=e,a=function(t,e,i){const o=t.segments,n=t.points,s=e.points,r=[];for(const t of o){let{start:o,end:a}=t;a=Fy(o,a,n);const l=By(i,n[o],n[a],t.loop);if(!e.segments){r.push({source:t,target:l,start:n[o],end:n[a]});continue}const d=Xf(e,l);for(const e of d){const o=By(i,s[e.start],s[e.end],e.loop),a=Kf(t,n,o);for(const t of a)r.push({source:t,target:e,start:{[i]:qy(l,o,"start",Math.max)},end:{[i]:qy(l,o,"end",Math.min)}})}}return r}(i,o,n);for(const{source:e,target:l,start:d,end:c}of a){const{style:{backgroundColor:a=s}={}}=e,h=!0!==o;t.save(),t.fillStyle=a,Jy(t,r,h&&By(n,d,c)),t.beginPath();const u=!!i.pathSegment(t,e);let p;if(h){u?t.closePath():tx(t,o,c,n);const e=!!o.pathSegment(t,l,{move:u,reverse:!0});p=u&&e,p||tx(t,o,d,n)}t.closePath(),t.fill(p?"evenodd":"nonzero"),t.restore()}}function Jy(t,e,i){const{top:o,bottom:n}=e.chart.chartArea,{property:s,start:r,end:a}=i||{};"x"===s&&(t.beginPath(),t.rect(r,o,a-r,n-o),t.clip())}function tx(t,e,i,o){const n=e.interpolate(i,o);n&&t.lineTo(n.x,n.y)}var ex={id:"filler",afterDatasetsUpdate(t,e,i){const o=(t.data.datasets||[]).length,n=[];let s,r,a,l;for(r=0;r<o;++r)s=t.getDatasetMeta(r),a=s.dataset,l=null,a&&a.options&&a instanceof by&&(l={visible:t.isDatasetVisible(r),index:r,fill:Hy(a,r,o),chart:t,axis:s.controller.options.indexAxis,scale:s.vScale,line:a}),s.$filler=l,n.push(l);for(r=0;r<o;++r)l=n[r],l&&!1!==l.fill&&(l.fill=Vy(n,r,i.propagate))},beforeDraw(t,e,i){const o="beforeDraw"===i.drawTime,n=t.getSortedVisibleDatasetMetas(),s=t.chartArea;for(let e=n.length-1;e>=0;--e){const i=n[e].$filler;i&&(i.line.updateControlPoints(s,i.axis),o&&i.fill&&Ky(t.ctx,i,s))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const o=t.getSortedVisibleDatasetMetas();for(let e=o.length-1;e>=0;--e){const i=o[e].$filler;jy(i)&&Ky(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const o=e.meta.$filler;jy(o)&&"beforeDatasetDraw"===i.drawTime&&Ky(t.ctx,o,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const ix=(t,e)=>{let{boxHeight:i=e,boxWidth:o=e}=t;return t.usePointStyle&&(i=Math.min(i,e),o=t.pointStyleWidth||Math.min(o,e)),{boxWidth:o,boxHeight:i,itemHeight:Math.max(e,i)}};class ox extends fb{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=ym(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,o=sf(i.font),n=o.size,s=this._computeTitleHeight(),{boxWidth:r,itemHeight:a}=ix(i,n);let l,d;e.font=o.string,this.isHorizontal()?(l=this.maxWidth,d=this._fitRows(s,n,r,a)+10):(d=this.maxHeight,l=this._fitCols(s,o,r,a)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(d,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,o){const{ctx:n,maxWidth:s,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],l=this.lineWidths=[0],d=o+r;let c=t;n.textAlign="left",n.textBaseline="middle";let h=-1,u=-d;return this.legendItems.forEach(((t,p)=>{const m=i+e/2+n.measureText(t.text).width;(0===p||l[l.length-1]+m+2*r>s)&&(c+=d,l[l.length-(p>0?0:1)]=0,u+=d,h++),a[p]={left:0,top:u,row:h,width:m,height:o},l[l.length-1]+=m+r})),c}_fitCols(t,e,i,o){const{ctx:n,maxHeight:s,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],l=this.columnSizes=[],d=s-t;let c=r,h=0,u=0,p=0,m=0;return this.legendItems.forEach(((t,s)=>{const{itemWidth:g,itemHeight:f}=function(t,e,i,o,n){const s=function(t,e,i,o){let n=t.text;n&&"string"!=typeof n&&(n=n.reduce(((t,e)=>t.length>e.length?t:e)));return e+i.size/2+o.measureText(n).width}(o,t,e,i),r=function(t,e,i){let o=t;"string"!=typeof e.text&&(o=nx(e,i));return o}(n,o,e.lineHeight);return{itemWidth:s,itemHeight:r}}(i,e,n,t,o);s>0&&u+f+2*r>d&&(c+=h+r,l.push({width:h,height:u}),p+=h+r,m++,h=u=0),a[s]={left:p,top:u,col:m,width:g,height:f},h=Math.max(h,g),u+=f+r})),c+=h,l.push({width:h,height:u}),c}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:o},rtl:n}}=this,s=Hf(n,this.left,this.width);if(this.isHorizontal()){let n=0,r=pg(i,this.left+o,this.right-this.lineWidths[n]);for(const a of e)n!==a.row&&(n=a.row,r=pg(i,this.left+o,this.right-this.lineWidths[n])),a.top+=this.top+t+o,a.left=s.leftForLtr(s.x(r),a.width),r+=a.width+o}else{let n=0,r=pg(i,this.top+t+o,this.bottom-this.columnSizes[n].height);for(const a of e)a.col!==n&&(n=a.col,r=pg(i,this.top+t+o,this.bottom-this.columnSizes[n].height)),a.top=r,a.left+=this.left+o,a.left=s.leftForLtr(s.x(a.left),a.width),r+=a.height+o}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;Ug(t,this),this._draw(),jg(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:o}=this,{align:n,labels:s}=t,r=Lg.color,a=Hf(t.rtl,this.left,this.width),l=sf(s.font),{padding:d}=s,c=l.size,h=c/2;let u;this.drawTitle(),o.textAlign=a.textAlign("left"),o.textBaseline="middle",o.lineWidth=.5,o.font=l.string;const{boxWidth:p,boxHeight:m,itemHeight:g}=ix(s,c),f=this.isHorizontal(),v=this._computeTitleHeight();u=f?{x:pg(n,this.left+d,this.right-i[0]),y:this.top+d+v,line:0}:{x:this.left+d,y:pg(n,this.top+v+d,this.bottom-e[0].height),line:0},Wf(this.ctx,t.textDirection);const b=g+d;this.legendItems.forEach(((y,x)=>{o.strokeStyle=y.fontColor,o.fillStyle=y.fontColor;const _=o.measureText(y.text).width,w=a.textAlign(y.textAlign||(y.textAlign=s.textAlign)),k=p+h+_;let C=u.x,S=u.y;a.setWidth(this.width),f?x>0&&C+k+d>this.right&&(S=u.y+=b,u.line++,C=u.x=pg(n,this.left+d,this.right-i[u.line])):x>0&&S+b>this.bottom&&(C=u.x=C+e[u.line].width+d,u.line++,S=u.y=pg(n,this.top+v+d,this.bottom-e[u.line].height));if(function(t,e,i){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;o.save();const n=vm(i.lineWidth,1);if(o.fillStyle=vm(i.fillStyle,r),o.lineCap=vm(i.lineCap,"butt"),o.lineDashOffset=vm(i.lineDashOffset,0),o.lineJoin=vm(i.lineJoin,"miter"),o.lineWidth=n,o.strokeStyle=vm(i.strokeStyle,r),o.setLineDash(vm(i.lineDash,[])),s.usePointStyle){const r={radius:m*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:n},l=a.xPlus(t,p/2);Fg(o,r,l,e+h,s.pointStyleWidth&&p)}else{const s=e+Math.max((c-m)/2,0),r=a.leftForLtr(t,p),l=of(i.borderRadius);o.beginPath(),Object.values(l).some((t=>0!==t))?Gg(o,{x:r,y:s,w:p,h:m,radius:l}):o.rect(r,s,p,m),o.fill(),0!==n&&o.stroke()}o.restore()}(a.x(C),S,y),C=((t,e,i,o)=>t===(o?"left":"right")?i:"center"===t?(e+i)/2:e)(w,C+p+h,f?C+k:this.right,t.rtl),function(t,e,i){Yg(o,i.text,t,e+g/2,l,{strikethrough:i.hidden,textAlign:a.textAlign(i.textAlign)})}(a.x(C),S,y),f)u.x+=k+d;else if("string"!=typeof y.text){const t=l.lineHeight;u.y+=nx(y,t)+d}else u.y+=b})),Zf(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=sf(e.font),o=nf(e.padding);if(!e.display)return;const n=Hf(t.rtl,this.left,this.width),s=this.ctx,r=e.position,a=i.size/2,l=o.top+a;let d,c=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),d=this.top+l,c=pg(t.align,c,this.right-h);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);d=l+pg(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=pg(r,c,c+h);s.textAlign=n.textAlign(ug(r)),s.textBaseline="middle",s.strokeStyle=e.color,s.fillStyle=e.color,s.font=i.string,Yg(s,e.text,u,d,i)}_computeTitleHeight(){const t=this.options.title,e=sf(t.font),i=nf(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,o,n;if(og(t,this.left,this.right)&&og(e,this.top,this.bottom))for(n=this.legendHitBoxes,i=0;i<n.length;++i)if(o=n[i],og(t,o.left,o.left+o.width)&&og(e,o.top,o.top+o.height))return this.legendItems[i];return null}handleEvent(t){const e=this.options;if(!function(t,e){if(("mousemove"===t||"mouseout"===t)&&(e.onHover||e.onLeave))return!0;if(e.onClick&&("click"===t||"mouseup"===t))return!0;return!1}(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const o=this._hoveredItem,n=((t,e)=>null!==t&&null!==e&&t.datasetIndex===e.datasetIndex&&t.index===e.index)(o,i);o&&!n&&ym(e.onLeave,[t,o,this],this),this._hoveredItem=i,i&&!n&&ym(e.onHover,[t,i,this],this)}else i&&ym(e.onClick,[t,i,this],this)}}function nx(t,e){return e*(t.text?t.text.length:0)}var sx={id:"legend",_element:ox,start(t,e,i){const o=t.legend=new ox({ctx:t.ctx,options:i,chart:t});Qv.configure(t,o,i),Qv.addBox(t,o)},stop(t){Qv.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const o=t.legend;Qv.configure(t,o,i),o.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const o=e.datasetIndex,n=i.chart;n.isDatasetVisible(o)?(n.hide(o),e.hidden=!0):(n.show(o),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:o,textAlign:n,color:s,useBorderRadius:r,borderRadius:a}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const l=t.controller.getStyle(i?0:void 0),d=nf(l.borderWidth);return{text:e[t.index].label,fillStyle:l.backgroundColor,fontColor:s,hidden:!t.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:l.borderColor,pointStyle:o||l.pointStyle,rotation:l.rotation,textAlign:n||l.textAlign,borderRadius:r&&(a||l.borderRadius),datasetIndex:t.index}}),this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class rx extends fb{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const o=pm(i.text)?i.text.length:1;this._padding=nf(i.padding);const n=o*sf(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=n:this.width=n}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:o,right:n,options:s}=this,r=s.align;let a,l,d,c=0;return this.isHorizontal()?(l=pg(r,i,n),d=e+t,a=n-i):("left"===s.position?(l=i+t,d=pg(r,o,e),c=-.5*Lm):(l=n-t,d=pg(r,e,o),c=.5*Lm),a=o-e),{titleX:l,titleY:d,maxWidth:a,rotation:c}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=sf(e.font),o=i.lineHeight/2+this._padding.top,{titleX:n,titleY:s,maxWidth:r,rotation:a}=this._drawArgs(o);Yg(t,e.text,0,0,i,{color:e.color,maxWidth:r,rotation:a,textAlign:ug(e.align),textBaseline:"middle",translation:[n,s]})}}var ax={id:"title",_element:rx,start(t,e,i){!function(t,e){const i=new rx({ctx:t.ctx,options:e,chart:t});Qv.configure(t,i,e),Qv.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;Qv.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const o=t.titleBlock;Qv.configure(t,o,i),o.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const lx=new WeakMap;var dx={id:"subtitle",start(t,e,i){const o=new rx({ctx:t.ctx,options:i,chart:t});Qv.configure(t,o,i),Qv.addBox(t,o),lx.set(t,o)},stop(t){Qv.removeBox(t,lx.get(t)),lx.delete(t)},beforeUpdate(t,e,i){const o=lx.get(t);Qv.configure(t,o,i),o.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const cx={average(t){if(!t.length)return!1;let e,i,o=new Set,n=0,s=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();o.add(t.x),n+=t.y,++s}}if(0===s||0===o.size)return!1;const r=[...o].reduce(((t,e)=>t+e))/o.size;return{x:r,y:n/s}},nearest(t,e){if(!t.length)return!1;let i,o,n,s=e.x,r=e.y,a=Number.POSITIVE_INFINITY;for(i=0,o=t.length;i<o;++i){const o=t[i].element;if(o&&o.hasValue()){const t=Qm(e,o.getCenterPoint());t<a&&(a=t,n=o)}}if(n){const t=n.tooltipPosition();s=t.x,r=t.y}return{x:s,y:r}}};function hx(t,e){return e&&(pm(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function ux(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function px(t,e){const{element:i,datasetIndex:o,index:n}=e,s=t.getDatasetMeta(o).controller,{label:r,value:a}=s.getLabelAndValue(n);return{chart:t,label:r,parsed:s.getParsed(n),raw:t.data.datasets[o].data[n],formattedValue:a,dataset:s.getDataset(),dataIndex:n,datasetIndex:o,element:i}}function mx(t,e){const i=t.chart.ctx,{body:o,footer:n,title:s}=t,{boxWidth:r,boxHeight:a}=e,l=sf(e.bodyFont),d=sf(e.titleFont),c=sf(e.footerFont),h=s.length,u=n.length,p=o.length,m=nf(e.padding);let g=m.height,f=0,v=o.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(v+=t.beforeBody.length+t.afterBody.length,h&&(g+=h*d.lineHeight+(h-1)*e.titleSpacing+e.titleMarginBottom),v){g+=p*(e.displayColors?Math.max(a,l.lineHeight):l.lineHeight)+(v-p)*l.lineHeight+(v-1)*e.bodySpacing}u&&(g+=e.footerMarginTop+u*c.lineHeight+(u-1)*e.footerSpacing);let b=0;const y=function(t){f=Math.max(f,i.measureText(t).width+b)};return i.save(),i.font=d.string,xm(t.title,y),i.font=l.string,xm(t.beforeBody.concat(t.afterBody),y),b=e.displayColors?r+2+e.boxPadding:0,xm(o,(t=>{xm(t.before,y),xm(t.lines,y),xm(t.after,y)})),b=0,i.font=c.string,xm(t.footer,y),i.restore(),f+=m.width,{width:f,height:g}}function gx(t,e,i,o){const{x:n,width:s}=i,{width:r,chartArea:{left:a,right:l}}=t;let d="center";return"center"===o?d=n<=(a+l)/2?"left":"right":n<=s/2?d="left":n>=r-s/2&&(d="right"),function(t,e,i,o){const{x:n,width:s}=o,r=i.caretSize+i.caretPadding;return"left"===t&&n+s+r>e.width||"right"===t&&n-s-r<0||void 0}(d,t,e,i)&&(d="center"),d}function fx(t,e,i){const o=i.yAlign||e.yAlign||function(t,e){const{y:i,height:o}=e;return i<o/2?"top":i>t.height-o/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||gx(t,e,i,o),yAlign:o}}function vx(t,e,i,o){const{caretSize:n,caretPadding:s,cornerRadius:r}=t,{xAlign:a,yAlign:l}=i,d=n+s,{topLeft:c,topRight:h,bottomLeft:u,bottomRight:p}=of(r);let m=function(t,e){let{x:i,width:o}=t;return"right"===e?i-=o:"center"===e&&(i-=o/2),i}(e,a);const g=function(t,e,i){let{y:o,height:n}=t;return"top"===e?o+=i:o-="bottom"===e?n+i:n/2,o}(e,l,d);return"center"===l?"left"===a?m+=d:"right"===a&&(m-=d):"left"===a?m-=Math.max(c,u)+n:"right"===a&&(m+=Math.max(h,p)+n),{x:ig(m,0,o.width-e.width),y:ig(g,0,o.height-e.height)}}function bx(t,e,i){const o=nf(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-o.right:t.x+o.left}function yx(t){return hx([],ux(t))}function xx(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}const _x={beforeTitle:cm,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,o=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(o>0&&e.dataIndex<o)return i[e.dataIndex]}return""},afterTitle:cm,beforeBody:cm,beforeLabel:cm,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return um(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:cm,afterBody:cm,beforeFooter:cm,footer:cm,afterFooter:cm};function wx(t,e,i,o){const n=t[e].call(i,o);return void 0===n?_x[e].call(i,o):n}class kx extends fb{static positioners=cx;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),o=i.enabled&&e.options.animation&&i.animations,n=new rv(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(n)),n}getContext(){return this.$context||(this.$context=(t=this.chart.getContext(),e=this,i=this._tooltipItems,af(t,{tooltip:e,tooltipItems:i,type:"tooltip"})));var t,e,i}getTitle(t,e){const{callbacks:i}=e,o=wx(i,"beforeTitle",this,t),n=wx(i,"title",this,t),s=wx(i,"afterTitle",this,t);let r=[];return r=hx(r,ux(o)),r=hx(r,ux(n)),r=hx(r,ux(s)),r}getBeforeBody(t,e){return yx(wx(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,o=[];return xm(t,(t=>{const e={before:[],lines:[],after:[]},n=xx(i,t);hx(e.before,ux(wx(n,"beforeLabel",this,t))),hx(e.lines,wx(n,"label",this,t)),hx(e.after,ux(wx(n,"afterLabel",this,t))),o.push(e)})),o}getAfterBody(t,e){return yx(wx(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,o=wx(i,"beforeFooter",this,t),n=wx(i,"footer",this,t),s=wx(i,"afterFooter",this,t);let r=[];return r=hx(r,ux(o)),r=hx(r,ux(n)),r=hx(r,ux(s)),r}_createItems(t){const e=this._active,i=this.chart.data,o=[],n=[],s=[];let r,a,l=[];for(r=0,a=e.length;r<a;++r)l.push(px(this.chart,e[r]));return t.filter&&(l=l.filter(((e,o,n)=>t.filter(e,o,n,i)))),t.itemSort&&(l=l.sort(((e,o)=>t.itemSort(e,o,i)))),xm(l,(e=>{const i=xx(t.callbacks,e);o.push(wx(i,"labelColor",this,e)),n.push(wx(i,"labelPointStyle",this,e)),s.push(wx(i,"labelTextColor",this,e))})),this.labelColors=o,this.labelPointStyles=n,this.labelTextColors=s,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),o=this._active;let n,s=[];if(o.length){const t=cx[i.position].call(this,o,this._eventPosition);s=this._createItems(i),this.title=this.getTitle(s,i),this.beforeBody=this.getBeforeBody(s,i),this.body=this.getBody(s,i),this.afterBody=this.getAfterBody(s,i),this.footer=this.getFooter(s,i);const e=this._size=mx(this,i),r=Object.assign({},t,e),a=fx(this.chart,i,r),l=vx(i,r,a,this.chart);this.xAlign=a.xAlign,this.yAlign=a.yAlign,n={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=s,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,o){const n=this.getCaretPosition(t,i,o);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,i){const{xAlign:o,yAlign:n}=this,{caretSize:s,cornerRadius:r}=i,{topLeft:a,topRight:l,bottomLeft:d,bottomRight:c}=of(r),{x:h,y:u}=t,{width:p,height:m}=e;let g,f,v,b,y,x;return"center"===n?(y=u+m/2,"left"===o?(g=h,f=g-s,b=y+s,x=y-s):(g=h+p,f=g+s,b=y-s,x=y+s),v=g):(f="left"===o?h+Math.max(a,d)+s:"right"===o?h+p-Math.max(l,c)-s:this.caretX,"top"===n?(b=u,y=b-s,g=f-s,v=f+s):(b=u+m,y=b+s,g=f+s,v=f-s),x=b),{x1:g,x2:f,x3:v,y1:b,y2:y,y3:x}}drawTitle(t,e,i){const o=this.title,n=o.length;let s,r,a;if(n){const l=Hf(i.rtl,this.x,this.width);for(t.x=bx(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",s=sf(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=s.string,a=0;a<n;++a)e.fillText(o[a],l.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+r,a+1===n&&(t.y+=i.titleMarginBottom-r)}}_drawColorBox(t,e,i,o,n){const s=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:a,boxWidth:l}=n,d=sf(n.bodyFont),c=bx(this,"left",n),h=o.x(c),u=a<d.lineHeight?(d.lineHeight-a)/2:0,p=e.y+u;if(n.usePointStyle){const e={radius:Math.min(l,a)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},i=o.leftForLtr(h,l)+l/2,d=p+a/2;t.strokeStyle=n.multiKeyBackground,t.fillStyle=n.multiKeyBackground,Bg(t,e,i,d),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,Bg(t,e,i,d)}else{t.lineWidth=mm(s.borderWidth)?Math.max(...Object.values(s.borderWidth)):s.borderWidth||1,t.strokeStyle=s.borderColor,t.setLineDash(s.borderDash||[]),t.lineDashOffset=s.borderDashOffset||0;const e=o.leftForLtr(h,l),i=o.leftForLtr(o.xPlus(h,1),l-2),r=of(s.borderRadius);Object.values(r).some((t=>0!==t))?(t.beginPath(),t.fillStyle=n.multiKeyBackground,Gg(t,{x:e,y:p,w:l,h:a,radius:r}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),Gg(t,{x:i,y:p+1,w:l-2,h:a-2,radius:r}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(e,p,l,a),t.strokeRect(e,p,l,a),t.fillStyle=s.backgroundColor,t.fillRect(i,p+1,l-2,a-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:o}=this,{bodySpacing:n,bodyAlign:s,displayColors:r,boxHeight:a,boxWidth:l,boxPadding:d}=i,c=sf(i.bodyFont);let h=c.lineHeight,u=0;const p=Hf(i.rtl,this.x,this.width),m=function(i){e.fillText(i,p.x(t.x+u),t.y+h/2),t.y+=h+n},g=p.textAlign(s);let f,v,b,y,x,_,w;for(e.textAlign=s,e.textBaseline="middle",e.font=c.string,t.x=bx(this,g,i),e.fillStyle=i.bodyColor,xm(this.beforeBody,m),u=r&&"right"!==g?"center"===s?l/2+d:l+2+d:0,y=0,_=o.length;y<_;++y){for(f=o[y],v=this.labelTextColors[y],e.fillStyle=v,xm(f.before,m),b=f.lines,r&&b.length&&(this._drawColorBox(e,t,y,p,i),h=Math.max(c.lineHeight,a)),x=0,w=b.length;x<w;++x)m(b[x]),h=c.lineHeight;xm(f.after,m)}u=0,h=c.lineHeight,xm(this.afterBody,m),t.y-=n}drawFooter(t,e,i){const o=this.footer,n=o.length;let s,r;if(n){const a=Hf(i.rtl,this.x,this.width);for(t.x=bx(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=a.textAlign(i.footerAlign),e.textBaseline="middle",s=sf(i.footerFont),e.fillStyle=i.footerColor,e.font=s.string,r=0;r<n;++r)e.fillText(o[r],a.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+i.footerSpacing}}drawBackground(t,e,i,o){const{xAlign:n,yAlign:s}=this,{x:r,y:a}=t,{width:l,height:d}=i,{topLeft:c,topRight:h,bottomLeft:u,bottomRight:p}=of(o.cornerRadius);e.fillStyle=o.backgroundColor,e.strokeStyle=o.borderColor,e.lineWidth=o.borderWidth,e.beginPath(),e.moveTo(r+c,a),"top"===s&&this.drawCaret(t,e,i,o),e.lineTo(r+l-h,a),e.quadraticCurveTo(r+l,a,r+l,a+h),"center"===s&&"right"===n&&this.drawCaret(t,e,i,o),e.lineTo(r+l,a+d-p),e.quadraticCurveTo(r+l,a+d,r+l-p,a+d),"bottom"===s&&this.drawCaret(t,e,i,o),e.lineTo(r+u,a+d),e.quadraticCurveTo(r,a+d,r,a+d-u),"center"===s&&"left"===n&&this.drawCaret(t,e,i,o),e.lineTo(r,a+c),e.quadraticCurveTo(r,a,r+c,a),e.closePath(),e.fill(),o.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,o=i&&i.x,n=i&&i.y;if(o||n){const i=cx[t.position].call(this,this._active,this._eventPosition);if(!i)return;const s=this._size=mx(this,t),r=Object.assign({},i,this._size),a=fx(e,t,r),l=vx(t,r,a,e);o._to===l.x&&n._to===l.y||(this.xAlign=a.xAlign,this.yAlign=a.yAlign,this.width=s.width,this.height=s.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const o={width:this.width,height:this.height},n={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const s=nf(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,o,e),Wf(t,e.textDirection),n.y+=s.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),Zf(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,o=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),n=!_m(i,o),s=this._positionChanged(o,e);(n||s)&&(this._active=o,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const o=this.options,n=this._active||[],s=this._getActiveElements(t,n,e,i),r=this._positionChanged(s,t),a=e||!_m(s,n)||r;return a&&(this._active=s,(o.enabled||o.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),a}_getActiveElements(t,e,i,o){const n=this.options;if("mouseout"===t.type)return[];if(!o)return e.filter((t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index)));const s=this.chart.getElementsAtEventForMode(t,n.mode,n,i);return n.reverse&&s.reverse(),s}_positionChanged(t,e){const{caretX:i,caretY:o,options:n}=this,s=cx[n.position].call(this,t,e);return!1!==s&&(i!==s.x||o!==s.y)}}var Cx={id:"tooltip",_element:kx,positioners:cx,afterInit(t,e,i){i&&(t.tooltip=new kx({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:_x},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Sx=Object.freeze({__proto__:null,Colors:zy,Decimation:Ny,Filler:ex,Legend:sx,SubTitle:dx,Title:ax,Tooltip:Cx});function Ax(t,e,i,o){const n=t.indexOf(e);if(-1===n)return((t,e,i,o)=>("string"==typeof e?(i=t.push(e)-1,o.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,o);return n!==t.lastIndexOf(e)?i:n}function Ex(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}function $x(t,e){const i=[],{bounds:o,step:n,min:s,max:r,precision:a,count:l,maxTicks:d,maxDigits:c,includeBounds:h}=t,u=n||1,p=d-1,{min:m,max:g}=e,f=!um(s),v=!um(r),b=!um(l),y=(g-m)/(c+1);let x,_,w,k,C=Hm((g-m)/p/u)*u;if(C<1e-14&&!f&&!v)return[{value:m},{value:g}];k=Math.ceil(g/C)-Math.floor(m/C),k>p&&(C=Hm(k*C/p/u)*u),um(a)||(x=Math.pow(10,a),C=Math.ceil(C*x)/x),"ticks"===o?(_=Math.floor(m/C)*C,w=Math.ceil(g/C)*C):(_=m,w=g),f&&v&&n&&function(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}((r-s)/n,C/1e3)?(k=Math.round(Math.min((r-s)/C,d)),C=(r-s)/k,_=s,w=r):b?(_=f?s:_,w=v?r:w,k=l-1,C=(w-_)/k):(k=(w-_)/C,k=Vm(k,Math.round(k),C/1e3)?Math.round(k):Math.ceil(k));const S=Math.max(Km(C),Km(_));x=Math.pow(10,um(a)?S:a),_=Math.round(_*x)/x,w=Math.round(w*x)/x;let A=0;for(f&&(h&&_!==s?(i.push({value:s}),_<s&&A++,Vm(Math.round((_+A*C)*x)/x,s,Tx(s,y,t))&&A++):_<s&&A++);A<k;++A){const t=Math.round((_+A*C)*x)/x;if(v&&t>r)break;i.push({value:t})}return v&&h&&w!==r?i.length&&Vm(i[i.length-1].value,r,Tx(r,y,t))?i[i.length-1].value=r:i.push({value:r}):v&&w!==r||i.push({value:w}),i}function Tx(t,e,{horizontal:i,minRotation:o}){const n=Ym(o),s=(i?Math.sin(n):Math.cos(n))||.001,r=.75*e*(""+t).length;return Math.min(e/s,r)}class Dx extends Ab{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return um(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:o,max:n}=this;const s=t=>o=e?o:t,r=t=>n=i?n:t;if(t){const t=jm(o),e=jm(n);t<0&&e<0?r(0):t>0&&e>0&&s(0)}if(o===n){let e=0===n?1:Math.abs(.05*n);r(n+e),t||s(o-e)}this.min=o,this.max=n}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:o}=t;return o?(e=Math.ceil(this.max/o)-Math.floor(this.min/o)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${o} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const o=$x({maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&Zm(o,this,"value"),t.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const o=(i-e)/Math.max(t.length-1,1)/2;e-=o,i+=o}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return Ag(t,this.chart.options.locale,this.options.ticks.format)}}class Mx extends Dx{static id="linear";static defaults={ticks:{callback:$g.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=gm(t)?t:0,this.max=gm(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=Ym(this.options.ticks.minRotation),o=(t?Math.sin(i):Math.cos(i))||.001,n=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,n.lineHeight/o))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const Ix=t=>Math.floor(Um(t)),Ox=(t,e)=>Math.pow(10,Ix(t)+e);function Lx(t){return 1===t/Math.pow(10,Ix(t))}function zx(t,e,i){const o=Math.pow(10,i),n=Math.floor(t/o);return Math.ceil(e/o)-n}function Px(t,{min:e,max:i}){e=fm(t.min,e);const o=[],n=Ix(e);let s=function(t,e){let i=Ix(e-t);for(;zx(t,e,i)>10;)i++;for(;zx(t,e,i)<10;)i--;return Math.min(i,Ix(t))}(e,i),r=s<0?Math.pow(10,Math.abs(s)):1;const a=Math.pow(10,s),l=n>s?Math.pow(10,n):0,d=Math.round((e-l)*r)/r,c=Math.floor((e-l)/a/10)*a*10;let h=Math.floor((d-c)/Math.pow(10,s)),u=fm(t.min,Math.round((l+c+h*Math.pow(10,s))*r)/r);for(;u<i;)o.push({value:u,major:Lx(u),significand:h}),h>=10?h=h<15?15:20:h++,h>=20&&(s++,h=2,r=s>=0?1:r),u=Math.round((l+c+h*Math.pow(10,s))*r)/r;const p=fm(t.max,u);return o.push({value:p,major:Lx(p),significand:h}),o}class Rx extends Ab{static id="logarithmic";static defaults={ticks:{callback:$g.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=Dx.prototype.parse.apply(this,[t,e]);if(0!==i)return gm(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=gm(t)?Math.max(0,t):null,this.max=gm(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!gm(this._userMin)&&(this.min=t===Ox(this.min,0)?Ox(this.min,-1):Ox(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,o=this.max;const n=e=>i=t?i:e,s=t=>o=e?o:t;i===o&&(i<=0?(n(1),s(10)):(n(Ox(i,-1)),s(Ox(o,1)))),i<=0&&n(Ox(o,-1)),o<=0&&s(Ox(i,1)),this.min=i,this.max=o}buildTicks(){const t=this.options,e=Px({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&Zm(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":Ag(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Um(t),this._valueRange=Um(this.max)-Um(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Um(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function Nx(t){const e=t.ticks;if(e.display&&t.display){const t=nf(e.backdropPadding);return vm(e.font&&e.font.size,Lg.font.size)+t.height}return 0}function Bx(t,e,i,o,n){return t===o||t===n?{start:e-i/2,end:e+i/2}:t<o||t>n?{start:e-i,end:e}:{start:e,end:e+i}}function Fx(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),o=[],n=[],s=t._pointLabels.length,r=t.options.pointLabels,a=r.centerPointLabels?Lm/s:0;for(let h=0;h<s;h++){const s=r.setContext(t.getPointLabelContext(h));n[h]=s.padding;const u=t.getPointPosition(h,t.drawingArea+n[h],a),p=sf(s.font),m=(l=t.ctx,d=p,c=pm(c=t._pointLabels[h])?c:[c],{w:Pg(l,d.string,c),h:c.length*d.lineHeight});o[h]=m;const g=tg(t.getIndexAngle(h)+a),f=Math.round(Gm(g));qx(i,e,g,Bx(f,u.x,m.w,0,180),Bx(f,u.y,m.h,90,270))}var l,d,c;t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=function(t,e,i){const o=[],n=t._pointLabels.length,s=t.options,{centerPointLabels:r,display:a}=s.pointLabels,l={extra:Nx(s)/2,additionalAngle:r?Lm/n:0};let d;for(let s=0;s<n;s++){l.padding=i[s],l.size=e[s];const n=Ux(t,s,l);o.push(n),"auto"===a&&(n.visible=jx(n,d),n.visible&&(d=n))}return o}(t,o,n)}function qx(t,e,i,o,n){const s=Math.abs(Math.sin(i)),r=Math.abs(Math.cos(i));let a=0,l=0;o.start<e.l?(a=(e.l-o.start)/s,t.l=Math.min(t.l,e.l-a)):o.end>e.r&&(a=(o.end-e.r)/s,t.r=Math.max(t.r,e.r+a)),n.start<e.t?(l=(e.t-n.start)/r,t.t=Math.min(t.t,e.t-l)):n.end>e.b&&(l=(n.end-e.b)/r,t.b=Math.max(t.b,e.b+l))}function Ux(t,e,i){const o=t.drawingArea,{extra:n,additionalAngle:s,padding:r,size:a}=i,l=t.getPointPosition(e,o+n+r,s),d=Math.round(Gm(tg(l.angle+Bm))),c=function(t,e,i){90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e);return t}(l.y,a.h,d),h=function(t){if(0===t||180===t)return"center";if(t<180)return"left";return"right"}(d),u=function(t,e,i){"right"===i?t-=e:"center"===i&&(t-=e/2);return t}(l.x,a.w,h);return{visible:!0,x:l.x,y:c,textAlign:h,left:u,top:c,right:u+a.w,bottom:c+a.h}}function jx(t,e){if(!e)return!0;const{left:i,top:o,right:n,bottom:s}=t;return!(qg({x:i,y:o},e)||qg({x:i,y:s},e)||qg({x:n,y:o},e)||qg({x:n,y:s},e))}function Vx(t,e,i){const{left:o,top:n,right:s,bottom:r}=i,{backdropColor:a}=e;if(!um(a)){const i=of(e.borderRadius),l=nf(e.backdropPadding);t.fillStyle=a;const d=o-l.left,c=n-l.top,h=s-o+l.width,u=r-n+l.height;Object.values(i).some((t=>0!==t))?(t.beginPath(),Gg(t,{x:d,y:c,w:h,h:u,radius:i}),t.fill()):t.fillRect(d,c,h,u)}}function Hx(t,e,i,o){const{ctx:n}=t;if(i)n.arc(t.xCenter,t.yCenter,e,0,zm);else{let i=t.getPointPosition(0,e);n.moveTo(i.x,i.y);for(let s=1;s<o;s++)i=t.getPointPosition(s,e),n.lineTo(i.x,i.y)}}class Wx extends Dx{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:$g.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=nf(Nx(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=gm(t)&&!isNaN(t)?t:0,this.max=gm(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Nx(this.options))}generateTickLabels(t){Dx.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map(((t,e)=>{const i=ym(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})).filter(((t,e)=>this.chart.getDataVisibility(e)))}fit(){const t=this.options;t.display&&t.pointLabels.display?Fx(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,o){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-o)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,o))}getIndexAngle(t){return tg(t*(zm/(this._pointLabels.length||1))+Ym(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(um(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(um(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return function(t,e,i){return af(t,{label:i,index:e,type:"pointLabel"})}(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const o=this.getIndexAngle(t)-Bm+i;return{x:Math.cos(o)*e+this.xCenter,y:Math.sin(o)*e+this.yCenter,angle:o}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:o,bottom:n}=this._pointLabelItems[t];return{left:e,top:i,right:o,bottom:n}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),Hx(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:o,border:n}=e,s=this._pointLabels.length;let r,a,l;if(e.pointLabels.display&&function(t,e){const{ctx:i,options:{pointLabels:o}}=t;for(let n=e-1;n>=0;n--){const e=t._pointLabelItems[n];if(!e.visible)continue;const s=o.setContext(t.getPointLabelContext(n));Vx(i,s,e);const r=sf(s.font),{x:a,y:l,textAlign:d}=e;Yg(i,t._pointLabels[n],a,l+r.lineHeight/2,r,{color:s.color,textAlign:d,textBaseline:"middle"})}}(this,s),o.display&&this.ticks.forEach(((t,e)=>{if(0!==e||0===e&&this.min<0){a=this.getDistanceFromCenterForValue(t.value);const i=this.getContext(e),r=o.setContext(i),l=n.setContext(i);!function(t,e,i,o,n){const s=t.ctx,r=e.circular,{color:a,lineWidth:l}=e;!r&&!o||!a||!l||i<0||(s.save(),s.strokeStyle=a,s.lineWidth=l,s.setLineDash(n.dash||[]),s.lineDashOffset=n.dashOffset,s.beginPath(),Hx(t,i,r,o),s.closePath(),s.stroke(),s.restore())}(this,r,a,s,l)}})),i.display){for(t.save(),r=s-1;r>=0;r--){const o=i.setContext(this.getPointLabelContext(r)),{color:n,lineWidth:s}=o;s&&n&&(t.lineWidth=s,t.strokeStyle=n,t.setLineDash(o.borderDash),t.lineDashOffset=o.borderDashOffset,a=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),l=this.getPointPosition(r,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const o=this.getIndexAngle(0);let n,s;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(o),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((o,r)=>{if(0===r&&this.min>=0&&!e.reverse)return;const a=i.setContext(this.getContext(r)),l=sf(a.font);if(n=this.getDistanceFromCenterForValue(this.ticks[r].value),a.showLabelBackdrop){t.font=l.string,s=t.measureText(o.label).width,t.fillStyle=a.backdropColor;const e=nf(a.backdropPadding);t.fillRect(-s/2-e.left,-n-l.size/2-e.top,s+e.width,l.size+e.height)}Yg(t,o.label,0,-n,l,{color:a.color,strokeColor:a.textStrokeColor,strokeWidth:a.textStrokeWidth})})),t.restore()}drawTitle(){}}const Zx={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Yx=Object.keys(Zx);function Gx(t,e){return t-e}function Kx(t,e){if(um(e))return null;const i=t._adapter,{parser:o,round:n,isoWeekday:s}=t._parseOpts;let r=e;return"function"==typeof o&&(r=o(r)),gm(r)||(r="string"==typeof o?i.parse(r,o):i.parse(r)),null===r?null:(n&&(r="week"!==n||!Wm(s)&&!0!==s?i.startOf(r,n):i.startOf(r,"isoWeek",s)),+r)}function Xx(t,e,i,o){const n=Yx.length;for(let s=Yx.indexOf(t);s<n-1;++s){const t=Zx[Yx[s]],n=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(n*t.size))<=o)return Yx[s]}return Yx[n-1]}function Qx(t,e,i){if(i){if(i.length){const{lo:o,hi:n}=ng(i,e);t[i[o]>=e?i[o]:i[n]]=!0}}else t[e]=!0}function Jx(t,e,i){const o=[],n={},s=e.length;let r,a;for(r=0;r<s;++r)a=e[r],n[a]=r,o.push({value:a,major:!1});return 0!==s&&i?function(t,e,i,o){const n=t._adapter,s=+n.startOf(e[0].value,o),r=e[e.length-1].value;let a,l;for(a=s;a<=r;a=+n.add(a,1,o))l=i[a],l>=0&&(e[l].major=!0);return e}(t,o,n,i):o}class t_ extends Ab{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),o=this._adapter=new Iv._date(t.adapters.date);o.init(e),Am(i.displayFormats,o.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:Kx(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:o,max:n,minDefined:s,maxDefined:r}=this.getUserBounds();function a(t){s||isNaN(t.min)||(o=Math.min(o,t.min)),r||isNaN(t.max)||(n=Math.max(n,t.max))}s&&r||(a(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||a(this.getMinMax(!1))),o=gm(o)&&!isNaN(o)?o:+e.startOf(Date.now(),i),n=gm(n)&&!isNaN(n)?n:+e.endOf(Date.now(),i)+1,this.min=Math.min(o,n-1),this.max=Math.max(o+1,n)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,o="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&o.length&&(this.min=this._userMin||o[0],this.max=this._userMax||o[o.length-1]);const n=this.min,s=function(t,e,i){let o=0,n=t.length;for(;o<n&&t[o]<e;)o++;for(;n>o&&t[n-1]>i;)n--;return o>0||n<t.length?t.slice(o,n):t}(o,n,this.max);return this._unit=e.unit||(i.autoSkip?Xx(e.minUnit,this.min,this.max,this._getLabelCapacity(n)):function(t,e,i,o,n){for(let s=Yx.length-1;s>=Yx.indexOf(i);s--){const i=Yx[s];if(Zx[i].common&&t._adapter.diff(n,o,i)>=e-1)return i}return Yx[i?Yx.indexOf(i):0]}(this,s.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=Yx.indexOf(t)+1,i=Yx.length;e<i;++e)if(Zx[Yx[e]].common)return Yx[e]}(this._unit):void 0,this.initOffsets(o),t.reverse&&s.reverse(),Jx(this,s,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map((t=>+t.value)))}initOffsets(t=[]){let e,i,o=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),o=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),n=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const s=t.length<3?.5:.25;o=ig(o,0,s),n=ig(n,0,s),this._offsets={start:o,end:n,factor:1/(o+1+n)}}_generate(){const t=this._adapter,e=this.min,i=this.max,o=this.options,n=o.time,s=n.unit||Xx(n.minUnit,e,i,this._getLabelCapacity(e)),r=vm(o.ticks.stepSize,1),a="week"===s&&n.isoWeekday,l=Wm(a)||!0===a,d={};let c,h,u=e;if(l&&(u=+t.startOf(u,"isoWeek",a)),u=+t.startOf(u,l?"day":s),t.diff(i,e,s)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+s);const p="data"===o.ticks.source&&this.getDataTimestamps();for(c=u,h=0;c<i;c=+t.add(c,r,s),h++)Qx(d,c,p);return c!==i&&"ticks"!==o.bounds&&1!==h||Qx(d,c,p),Object.keys(d).sort(Gx).map((t=>+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const i=this.options.time.displayFormats,o=this._unit,n=e||i[o];return this._adapter.format(t,n)}_tickFormatFunction(t,e,i,o){const n=this.options,s=n.ticks.callback;if(s)return ym(s,[t,e,i],this);const r=n.time.displayFormats,a=this._unit,l=this._majorUnit,d=a&&r[a],c=l&&r[l],h=i[e],u=l&&c&&h&&h.major;return this._adapter.format(t,o||(u?c:d))}generateTickLabels(t){let e,i,o;for(e=0,i=t.length;e<i;++e)o=t[e],o.label=this._tickFormatFunction(o.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,o=Ym(this.isHorizontal()?e.maxRotation:e.minRotation),n=Math.cos(o),s=Math.sin(o),r=this._resolveTickFontOptions(0).size;return{w:i*n+r*s,h:i*s+r*n}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,o=i[e.unit]||i.millisecond,n=this._tickFormatFunction(t,0,Jx(this,[t],this._majorUnit),o),s=this._getLabelSize(n),r=Math.floor(this.isHorizontal()?this.width/s.w:this.height/s.h)-1;return r>0?r:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const o=this.getMatchingVisibleMetas();if(this._normalized&&o.length)return this._cache.data=o[0].controller.getAllParsedValues(this);for(t=0,e=o.length;t<e;++t)i=i.concat(o[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const o=this.getLabels();for(e=0,i=o.length;e<i;++e)t.push(Kx(this,o[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return dg(t.sort(Gx))}}function e_(t,e,i){let o,n,s,r,a=0,l=t.length-1;i?(e>=t[a].pos&&e<=t[l].pos&&({lo:a,hi:l}=sg(t,"pos",e)),({pos:o,time:s}=t[a]),({pos:n,time:r}=t[l])):(e>=t[a].time&&e<=t[l].time&&({lo:a,hi:l}=sg(t,"time",e)),({time:o,pos:s}=t[a]),({time:n,pos:r}=t[l]));const d=n-o;return d?s+(r-s)*(e-o)/d:s}var i_=Object.freeze({__proto__:null,CategoryScale:class extends Ab{static id="category";static defaults={ticks:{callback:Ex}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:o}of e)t[i]===o&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(um(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:ig(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:Ax(i,t,vm(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:o}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(o=this.getLabels().length-1)),this.min=i,this.max=o}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,o=[];let n=this.getLabels();n=0===t&&e===n.length-1?n:n.slice(t,e+1),this._valueRange=Math.max(n.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)o.push({value:i});return o}getLabelForValue(t){return Ex.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},LinearScale:Mx,LogarithmicScale:Rx,RadialLinearScale:Wx,TimeScale:t_,TimeSeriesScale:class extends t_{static id="timeseries";static defaults=t_.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=e_(e,this.min),this._tableRange=e_(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,o=[],n=[];let s,r,a,l,d;for(s=0,r=t.length;s<r;++s)l=t[s],l>=e&&l<=i&&o.push(l);if(o.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(s=0,r=o.length;s<r;++s)d=o[s+1],a=o[s-1],l=o[s],Math.round((d+a)/2)!==l&&n.push({time:l,pos:s/(r-1)});return n}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return i.includes(t)&&i.length||i.splice(0,0,t),i.includes(e)&&1!==i.length||i.push(e),i.sort(((t,e)=>t-e))}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(e_(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return e_(this._table,i*this._tableRange+this._minPos,!0)}}});const o_=[Tv,$y,Sx,i_];oy.register(...o_);
11051
+ */class ev{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,o){const n=e.listeners[o],s=e.duration;n.forEach((o=>o({chart:t,initial:e.initial,numSteps:s,currentStep:Math.min(i-e.start,s)})))}_refresh(){this._request||(this._running=!0,this._request=cg.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,o)=>{if(!i.running||!i.items.length)return;const n=i.items;let s,r=n.length-1,a=!1;for(;r>=0;--r)s=n[r],s._active?(s._total>i.duration&&(i.duration=s._total),s.tick(t),a=!0):(n[r]=n[n.length-1],n.pop());a&&(o.draw(),this._notify(o,i,t,"progress")),n.length||(i.running=!1,this._notify(o,i,t,"complete"),i.initial=!1),e+=n.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let o=i.length-1;for(;o>=0;--o)i[o].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var iv=new ev;const ov="transparent",nv={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const o=_g(t||ov),n=o.valid&&_g(e||ov);return n&&n.valid?n.mix(o,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class sv{constructor(t,e,i,o){const n=e[i];o=rf([t.to,o,n,t.from]);const s=rf([t.from,n,o]);this._active=!0,this._fn=t.fn||nv[t.type||typeof s],this._easing=bg[t.easing]||bg.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=s,this._to=o,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const o=this._target[this._prop],n=i-this._start,s=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(s,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=rf([t.to,e,o,t.from]),this._from=rf([t.from,o,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,o=this._prop,n=this._from,s=this._loop,r=this._to;let a;if(this._active=n!==r&&(s||e<i),!this._active)return this._target[o]=r,void this._notify(!0);e<0?this._target[o]=n:(a=e/i%2,a=s&&a>1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[o]=this._fn(n,r,a))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}class rv{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!mm(t))return;const e=Object.keys(Lg.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach((o=>{const n=t[o];if(!mm(n))return;const s={};for(const t of e)s[t]=n[t];(pm(n.properties)&&n.properties||[o]).forEach((t=>{t!==o&&i.has(t)||i.set(t,s)}))}))}_animateOptions(t,e){const i=e.options,o=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!o)return[];const n=this._createAnimations(o,i);return i.$shared&&function(t,e){const i=[],o=Object.keys(e);for(let e=0;e<o.length;e++){const n=t[o[e]];n&&n.active()&&i.push(n.wait())}return Promise.all(i)}(t.options.$animations,i).then((()=>{t.options=i}),(()=>{})),n}_createAnimations(t,e){const i=this._properties,o=[],n=t.$animations||(t.$animations={}),s=Object.keys(e),r=Date.now();let a;for(a=s.length-1;a>=0;--a){const l=s[a];if("$"===l.charAt(0))continue;if("options"===l){o.push(...this._animateOptions(t,e));continue}const d=e[l];let c=n[l];const h=i.get(l);if(c){if(h&&c.active()){c.update(h,d,r);continue}c.cancel()}h&&h.duration?(n[l]=c=new sv(h,t,l,d),o.push(c)):t[l]=d}return o}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(iv.add(this._chart,i),!0):void 0}}function av(t,e){const i=t&&t.options||{},o=i.reverse,n=void 0===i.min?e:0,s=void 0===i.max?e:0;return{start:o?s:n,end:o?n:s}}function lv(t,e){const i=[],o=t._getSortedDatasetMetas(e);let n,s;for(n=0,s=o.length;n<s;++n)i.push(o[n].index);return i}function dv(t,e,i,o={}){const n=t.keys,s="single"===o.mode;let r,a,l,d;if(null===e)return;let c=!1;for(r=0,a=n.length;r<a;++r){if(l=+n[r],l===i){if(c=!0,o.all)continue;break}d=t.values[l],gm(d)&&(s||0===e||jm(e)===jm(d))&&(e+=d)}return c||o.all?e:0}function cv(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function hv(t,e,i){const o=t[e]||(t[e]={});return o[i]||(o[i]={})}function uv(t,e,i,o){for(const n of e.getMatchingVisibleMetas(o).reverse()){const e=t[n.index];if(i&&e>0||!i&&e<0)return n.index}return null}function pv(t,e){const{chart:i,_cachedMeta:o}=t,n=i._stacks||(i._stacks={}),{iScale:s,vScale:r,index:a}=o,l=s.axis,d=r.axis,c=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(s,r,o),h=e.length;let u;for(let t=0;t<h;++t){const i=e[t],{[l]:s,[d]:h}=i;u=(i._stacks||(i._stacks={}))[d]=hv(n,c,s),u[a]=h,u._top=uv(u,r,!0,o.type),u._bottom=uv(u,r,!1,o.type);(u._visualValues||(u._visualValues={}))[a]=h}}function mv(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function gv(t,e){const i=t.controller.index,o=t.vScale&&t.vScale.axis;if(o){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[o]||void 0===e[o][i])return;delete e[o][i],void 0!==e[o]._visualValues&&void 0!==e[o]._visualValues[i]&&delete e[o]._visualValues[i]}}}const fv=t=>"reset"===t||"none"===t,vv=(t,e)=>e?t:Object.assign({},t);class yv{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=cv(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&gv(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),o=(t,e,i,o)=>"x"===t?e:"r"===t?o:i,n=e.xAxisID=vm(i.xAxisID,mv(t,"x")),s=e.yAxisID=vm(i.yAxisID,mv(t,"y")),r=e.rAxisID=vm(i.rAxisID,mv(t,"r")),a=e.indexAxis,l=e.iAxisID=o(a,n,s,r),d=e.vAxisID=o(a,s,n,r);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(s),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&lg(this._data,this),t._stacked&&gv(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(mm(e)){const t=this._cachedMeta;this._data=function(t,e){const{iScale:i,vScale:o}=e,n="x"===i.axis?"x":"y",s="x"===o.axis?"x":"y",r=Object.keys(t),a=new Array(r.length);let l,d,c;for(l=0,d=r.length;l<d;++l)c=r[l],a[l]={[n]:c,[s]:t[c]};return a}(e,t)}else if(i!==e){if(i){lg(i,this);const t=this._cachedMeta;gv(t),t._parsed=[]}e&&Object.isExtensible(e)&&(n=this,(o=e)._chartjs?o._chartjs.listeners.push(n):(Object.defineProperty(o,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[n]}}),ag.forEach((t=>{const e="_onData"+Dm(t),i=o[t];Object.defineProperty(o,t,{configurable:!0,enumerable:!1,value(...t){const n=i.apply(this,t);return o._chartjs.listeners.forEach((i=>{"function"==typeof i[e]&&i[e](...t)})),n}})})))),this._syncList=[],this._data=e}var o,n}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let o=!1;this._dataCheck();const n=e._stacked;e._stacked=cv(e.vScale,e),e.stack!==i.stack&&(o=!0,gv(e),e.stack=i.stack),this._resyncElements(t),(o||n!==e._stacked)&&(pv(this,e._parsed),e._stacked=cv(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:o}=this,{iScale:n,_stacked:s}=i,r=n.axis;let a,l,d,c=0===t&&e===o.length||i._sorted,h=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=o,i._sorted=!0,d=o;else{d=pm(o[t])?this.parseArrayData(i,o,t,e):mm(o[t])?this.parseObjectData(i,o,t,e):this.parsePrimitiveData(i,o,t,e);const n=()=>null===l[r]||h&&l[r]<h[r];for(a=0;a<e;++a)i._parsed[a+t]=l=d[a],c&&(n()&&(c=!1),h=l);i._sorted=c}s&&pv(this,d)}parsePrimitiveData(t,e,i,o){const{iScale:n,vScale:s}=t,r=n.axis,a=s.axis,l=n.getLabels(),d=n===s,c=new Array(o);let h,u,p;for(h=0,u=o;h<u;++h)p=h+i,c[h]={[r]:d||n.parse(l[p],p),[a]:s.parse(e[p],p)};return c}parseArrayData(t,e,i,o){const{xScale:n,yScale:s}=t,r=new Array(o);let a,l,d,c;for(a=0,l=o;a<l;++a)d=a+i,c=e[d],r[a]={x:n.parse(c[0],d),y:s.parse(c[1],d)};return r}parseObjectData(t,e,i,o){const{xScale:n,yScale:s}=t,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,l=new Array(o);let d,c,h,u;for(d=0,c=o;d<c;++d)h=d+i,u=e[h],l[d]={x:n.parse(Tm(u,r),h),y:s.parse(Tm(u,a),h)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const o=this.chart,n=this._cachedMeta,s=e[t.axis];return dv({keys:lv(o,!0),values:e._stacks[t.axis]._visualValues},s,n.index,{mode:i})}updateRangeFromParsed(t,e,i,o){const n=i[e.axis];let s=null===n?NaN:n;const r=o&&i._stacks[e.axis];o&&r&&(o.values=r,s=dv(o,n,this._cachedMeta.index)),t.min=Math.min(t.min,s),t.max=Math.max(t.max,s)}getMinMax(t,e){const i=this._cachedMeta,o=i._parsed,n=i._sorted&&t===i.iScale,s=o.length,r=this._getOtherScale(t),a=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:lv(i,!0),values:null})(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:c}=function(t){const{min:e,max:i,minDefined:o,maxDefined:n}=t.getUserBounds();return{min:o?e:Number.NEGATIVE_INFINITY,max:n?i:Number.POSITIVE_INFINITY}}(r);let h,u;function p(){u=o[h];const e=u[r.axis];return!gm(u[t.axis])||d>e||c<e}for(h=0;h<s&&(p()||(this.updateRangeFromParsed(l,t,u,a),!n));++h);if(n)for(h=s-1;h>=0;--h)if(!p()){this.updateRangeFromParsed(l,t,u,a);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let o,n,s;for(o=0,n=e.length;o<n;++o)s=e[o][t.axis],gm(s)&&i.push(s);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,o=e.vScale,n=this.getParsed(t);return{label:i?""+i.getLabelForValue(n[i.axis]):"",value:o?""+o.getLabelForValue(n[o.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,o,n;return mm(t)?(e=t.top,i=t.right,o=t.bottom,n=t.left):e=i=o=n=t,{top:e,right:i,bottom:o,left:n,disabled:!1===t}}(vm(this.options.clip,function(t,e,i){if(!1===i)return!1;const o=av(t,i),n=av(e,i);return{top:n.end,right:o.end,bottom:n.start,left:o.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,o=i.data||[],n=e.chartArea,s=[],r=this._drawStart||0,a=this._drawCount||o.length-r,l=this.options.drawActiveElementsOnTop;let d;for(i.dataset&&i.dataset.draw(t,n,r,a),d=r;d<r+a;++d){const e=o[d];e.hidden||(e.active&&l?s.push(e):e.draw(t,n))}for(d=0;d<s.length;++d)s[d].draw(t,n)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const o=this.getDataset();let n;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];n=e.$context||(e.$context=function(t,e,i){return af(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),n.parsed=this.getParsed(t),n.raw=o.data[t],n.index=n.dataIndex=t}else n=this.$context||(this.$context=function(t,e){return af(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),n.dataset=o,n.index=n.datasetIndex=this.index;return n.active=!!e,n.mode=i,n}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const o="active"===e,n=this._cachedDataOpts,s=t+"-"+e,r=n[s],a=this.enableOptionSharing&&Mm(i);if(r)return vv(r,a);const l=this.chart.config,d=l.datasetElementScopeKeys(this._type,t),c=o?[`${t}Hover`,"hover",t,""]:[t,""],h=l.getOptionScopes(this.getDataset(),d),u=Object.keys(Lg.elements[t]),p=l.resolveNamedOptions(h,u,(()=>this.getContext(i,o,e)),c);return p.$shared&&(p.$shared=a,n[s]=Object.freeze(vv(p,a))),p}_resolveAnimations(t,e,i){const o=this.chart,n=this._cachedDataOpts,s=`animation-${e}`,r=n[s];if(r)return r;let a;if(!1!==o.options.animation){const o=this.chart.config,n=o.datasetAnimationScopeKeys(this._type,e),s=o.getOptionScopes(this.getDataset(),n);a=o.createResolver(s,this.getContext(t,i,e))}const l=new rv(o,a&&a.animations);return a&&a._cacheable&&(n[s]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||fv(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),o=this._sharedOptions,n=this.getSharedOptions(i),s=this.includeOptions(e,n)||n!==o;return this.updateSharedOptions(n,e,i),{sharedOptions:n,includeOptions:s}}updateElement(t,e,i,o){fv(o)?Object.assign(t,i):this._resolveAnimations(e,o).update(t,i)}updateSharedOptions(t,e,i){t&&!fv(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,o){t.active=o;const n=this.getStyle(e,o);this._resolveAnimations(e,i,o).update(t,{options:!o&&this.getSharedOptions(n)||n})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const o=i.length,n=e.length,s=Math.min(n,o);s&&this.parse(0,s),n>o?this._insertElements(o,n-o,t):n<o&&this._removeElements(n,o-n)}_insertElements(t,e,i=!0){const o=this._cachedMeta,n=o.data,s=t+e;let r;const a=t=>{for(t.length+=e,r=t.length-1;r>=s;r--)t[r]=t[r-e]};for(a(n),r=t;r<s;++r)n[r]=new this.dataElementType;this._parsing&&a(o._parsed),this.parse(t,e),i&&this.updateElements(n,t,e,"reset")}updateElements(t,e,i,o){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const o=i._parsed.splice(t,e);i._stacked&&gv(i,o)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,o]=t;this[e](i,o)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function bv(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let o=[];for(let e=0,n=i.length;e<n;e++)o=o.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=dg(o.sort(((t,e)=>t-e)))}return t._cache.$bar}(e,t.type);let o,n,s,r,a=e._length;const l=()=>{32767!==s&&-32768!==s&&(Mm(r)&&(a=Math.min(a,Math.abs(s-r)||a)),r=s)};for(o=0,n=i.length;o<n;++o)s=e.getPixelForValue(i[o]),l();for(r=void 0,o=0,n=e.ticks.length;o<n;++o)s=e.getPixelForTick(o),l();return a}function xv(t,e,i,o){return pm(t)?function(t,e,i,o){const n=i.parse(t[0],o),s=i.parse(t[1],o),r=Math.min(n,s),a=Math.max(n,s);let l=r,d=a;Math.abs(r)>Math.abs(a)&&(l=a,d=r),e[i.axis]=d,e._custom={barStart:l,barEnd:d,start:n,end:s,min:r,max:a}}(t,e,i,o):e[i.axis]=i.parse(t,o),e}function _v(t,e,i,o){const n=t.iScale,s=t.vScale,r=n.getLabels(),a=n===s,l=[];let d,c,h,u;for(d=i,c=i+o;d<c;++d)u=e[d],h={},h[n.axis]=a||n.parse(r[d],d),l.push(xv(u,h,s,d));return l}function wv(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function kv(t,e,i,o){let n=e.borderSkipped;const s={};if(!n)return void(t.borderSkipped=s);if(!0===n)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:r,end:a,reverse:l,top:d,bottom:c}=function(t){let e,i,o,n,s;return t.horizontal?(e=t.base>t.x,i="left",o="right"):(e=t.base<t.y,i="bottom",o="top"),e?(n="end",s="start"):(n="start",s="end"),{start:i,end:o,reverse:e,top:n,bottom:s}}(t);"middle"===n&&i&&(t.enableBorderRadius=!0,(i._top||0)===o?n=d:(i._bottom||0)===o?n=c:(s[Cv(c,r,a,l)]=!0,n=d)),s[Cv(n,r,a,l)]=!0,t.borderSkipped=s}function Cv(t,e,i,o){var n,s,r;return o?(r=i,t=Sv(t=(n=t)===(s=e)?r:n===r?s:n,i,e)):t=Sv(t,e,i),t}function Sv(t,e,i){return"start"===t?e:"end"===t?i:t}function Av(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}class Ev extends yv{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:o}}=t.legend.options;return e.labels.map(((e,n)=>{const s=t.getDatasetMeta(0).controller.getStyle(n);return{text:e,fillStyle:s.backgroundColor,strokeStyle:s.borderColor,fontColor:o,lineWidth:s.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(n),index:n}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,o=this._cachedMeta;if(!1===this._parsing)o._parsed=i;else{let n,s,r=t=>+i[t];if(mm(i[t])){const{key:t="value"}=this._parsing;r=e=>+Tm(i[e],t)}for(n=t,s=t+e;n<s;++n)o._parsed[n]=r(n)}}_getRotation(){return Ym(this.options.rotation-90)}_getCircumference(){return Ym(this.options.circumference)}_getRotationExtents(){let t=zm,e=-zm;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const o=this.chart.getDatasetMeta(i).controller,n=o._getRotation(),s=o._getCircumference();t=Math.min(t,n),e=Math.max(e,n+s)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,o=this._cachedMeta,n=o.data,s=this.getMaxBorderWidth()+this.getMaxOffset(n)+this.options.spacing,r=Math.max((Math.min(i.width,i.height)-s)/2,0),a=Math.min((l=this.options.cutout,d=r,"string"==typeof l&&l.endsWith("%")?parseFloat(l)/100:+l/d),1);var l,d;const c=this._getRingWeight(this.index),{circumference:h,rotation:u}=this._getRotationExtents(),{ratioX:p,ratioY:m,offsetX:g,offsetY:f}=function(t,e,i){let o=1,n=1,s=0,r=0;if(e<zm){const a=t,l=a+e,d=Math.cos(a),c=Math.sin(a),h=Math.cos(l),u=Math.sin(l),p=(t,e,o)=>eg(t,a,l,!0)?1:Math.max(e,e*i,o,o*i),m=(t,e,o)=>eg(t,a,l,!0)?-1:Math.min(e,e*i,o,o*i),g=p(0,d,h),f=p(Bm,c,u),v=m(Lm,d,h),y=m(Lm+Bm,c,u);o=(g-v)/2,n=(f-y)/2,s=-(g+v)/2,r=-(f+y)/2}return{ratioX:o,ratioY:n,offsetX:s,offsetY:r}}(u,h,a),v=(i.width-s)/p,y=(i.height-s)/m,b=Math.max(Math.min(v,y)/2,0),x=ym(this.options.radius,b),_=(x-Math.max(x*a,0))/this._getVisibleDatasetWeightTotal();this.offsetX=g*x,this.offsetY=f*x,o.total=this.calculateTotal(),this.outerRadius=x-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*c,0),this.updateElements(n,0,n.length,t)}_circumference(t,e){const i=this.options,o=this._cachedMeta,n=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===o._parsed[t]||o.data[t].hidden?0:this.calculateCircumference(o._parsed[t]*n/zm)}updateElements(t,e,i,o){const n="reset"===o,s=this.chart,r=s.chartArea,a=s.options.animation,l=(r.left+r.right)/2,d=(r.top+r.bottom)/2,c=n&&a.animateScale,h=c?0:this.innerRadius,u=c?0:this.outerRadius,{sharedOptions:p,includeOptions:m}=this._getSharedOptions(e,o);let g,f=this._getRotation();for(g=0;g<e;++g)f+=this._circumference(g,n);for(g=e;g<e+i;++g){const e=this._circumference(g,n),i=t[g],s={x:l+this.offsetX,y:d+this.offsetY,startAngle:f,endAngle:f+e,circumference:e,outerRadius:u,innerRadius:h};m&&(s.options=p||this.resolveDataElementOptions(g,i.active?"active":o)),f+=e,this.updateElement(i,g,s,o)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,o=0;for(i=0;i<e.length;i++){const n=t._parsed[i];null===n||isNaN(n)||!this.chart.getDataVisibility(i)||e[i].hidden||(o+=Math.abs(n))}return o}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?zm*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,o=i.data.labels||[],n=Ag(e._parsed[t],i.options.locale);return{label:o[t]||"",value:n}}getMaxBorderWidth(t){let e=0;const i=this.chart;let o,n,s,r,a;if(!t)for(o=0,n=i.data.datasets.length;o<n;++o)if(i.isDatasetVisible(o)){s=i.getDatasetMeta(o),t=s.data,r=s.controller;break}if(!t)return 0;for(o=0,n=t.length;o<n;++o)a=r.resolveDataElementOptions(o),"inner"!==a.borderAlign&&(e=Math.max(e,a.borderWidth||0,a.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,o=t.length;i<o;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(vm(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class $v extends yv{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:o}}=t.legend.options;return e.labels.map(((e,n)=>{const s=t.getDatasetMeta(0).controller.getStyle(n);return{text:e,fillStyle:s.backgroundColor,strokeStyle:s.borderColor,fontColor:o,lineWidth:s.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(n),index:n}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,o=i.data.labels||[],n=Ag(e._parsed[t].r,i.options.locale);return{label:o[t]||"",value:n}}parseObjectData(t,e,i,o){return _f.bind(this)(t,e,i,o)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach(((t,i)=>{const o=this.getParsed(i).r;!isNaN(o)&&this.chart.getDataVisibility(i)&&(o<e.min&&(e.min=o),o>e.max&&(e.max=o))})),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,o=Math.min(e.right-e.left,e.bottom-e.top),n=Math.max(o/2,0),s=(n-Math.max(i.cutoutPercentage?n/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=n-s*this.index,this.innerRadius=this.outerRadius-s}updateElements(t,e,i,o){const n="reset"===o,s=this.chart,r=s.options.animation,a=this._cachedMeta.rScale,l=a.xCenter,d=a.yCenter,c=a.getIndexAngle(0)-.5*Lm;let h,u=c;const p=360/this.countVisibleElements();for(h=0;h<e;++h)u+=this._computeAngle(h,o,p);for(h=e;h<e+i;h++){const e=t[h];let i=u,m=u+this._computeAngle(h,o,p),g=s.getDataVisibility(h)?a.getDistanceFromCenterForValue(this.getParsed(h).r):0;u=m,n&&(r.animateScale&&(g=0),r.animateRotate&&(i=m=c));const f={x:l,y:d,innerRadius:0,outerRadius:g,startAngle:i,endAngle:m,options:this.resolveDataElementOptions(h,e.active?"active":o)};this.updateElement(e,h,f,o)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach(((t,i)=>{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++})),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?Ym(this.resolveDataElementOptions(t,e).angle||i):0}}var Tv=Object.freeze({__proto__:null,BarController:class extends yv{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,i,o){return _v(t,e,i,o)}parseArrayData(t,e,i,o){return _v(t,e,i,o)}parseObjectData(t,e,i,o){const{iScale:n,vScale:s}=t,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,l="x"===n.axis?r:a,d="x"===s.axis?r:a,c=[];let h,u,p,m;for(h=i,u=i+o;h<u;++h)m=e[h],p={},p[n.axis]=n.parse(Tm(m,l),h),c.push(xv(Tm(m,d),p,s,h));return c}updateRangeFromParsed(t,e,i,o){super.updateRangeFromParsed(t,e,i,o);const n=i._custom;n&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,n.min),t.max=Math.max(t.max,n.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:o}=e,n=this.getParsed(t),s=n._custom,r=wv(s)?"["+s.start+", "+s.end+"]":""+o.getLabelForValue(n[o.axis]);return{label:""+i.getLabelForValue(n[i.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize();this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,o){const n="reset"===o,{index:s,_cachedMeta:{vScale:r}}=this,a=r.getBasePixel(),l=r.isHorizontal(),d=this._getRuler(),{sharedOptions:c,includeOptions:h}=this._getSharedOptions(e,o);for(let u=e;u<e+i;u++){const e=this.getParsed(u),i=n||um(e[r.axis])?{base:a,head:a}:this._calculateBarValuePixels(u),p=this._calculateBarIndexPixels(u,d),m=(e._stacks||{})[r.axis],g={horizontal:l,base:i.base,enableBorderRadius:!m||wv(e._custom)||s===m._top||s===m._bottom,x:l?i.head:p.center,y:l?p.center:i.head,height:l?p.size:Math.abs(i.size),width:l?Math.abs(i.size):p.size};h&&(g.options=c||this.resolveDataElementOptions(u,t[u].active?"active":o));const f=g.options||t[u].options;kv(g,f,m,s),Av(g,f,d.ratio),this.updateElement(t[u],u,g,o)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,o=i.getMatchingVisibleMetas(this._type).filter((t=>t.controller.options.grouped)),n=i.options.stacked,s=[],r=this._cachedMeta.controller.getParsed(e),a=r&&r[i.axis],l=t=>{const e=t._parsed.find((t=>t[i.axis]===a)),o=e&&e[t.vScale.axis];if(um(o)||isNaN(o))return!0};for(const i of o)if((void 0===e||!l(i))&&((!1===n||-1===s.indexOf(i.stack)||void 0===n&&void 0===i.stack)&&s.push(i.stack),i.index===t))break;return s.length||s.push(void 0),s}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const o=this._getStacks(t,i),n=void 0!==e?o.indexOf(e):-1;return-1===n?o.length-1:n}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,o=[];let n,s;for(n=0,s=e.data.length;n<s;++n)o.push(i.getPixelForValue(this.getParsed(n)[i.axis],n));const r=t.barThickness;return{min:r||bv(e),pixels:o,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:o},options:{base:n,minBarLength:s}}=this,r=n||0,a=this.getParsed(t),l=a._custom,d=wv(l);let c,h,u=a[e.axis],p=0,m=i?this.applyStack(e,a,i):u;m!==u&&(p=m-u,m=u),d&&(u=l.barStart,m=l.barEnd-l.barStart,0!==u&&jm(u)!==jm(l.barEnd)&&(p=0),p+=u);const g=um(n)||d?p:n;let f=e.getPixelForValue(g);if(c=this.chart.getDataVisibility(t)?e.getPixelForValue(p+m):f,h=c-f,Math.abs(h)<s){h=function(t,e,i){return 0!==t?jm(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(h,e,r)*s,u===r&&(f-=h/2);const t=e.getPixelForDecimal(0),n=e.getPixelForDecimal(1),l=Math.min(t,n),p=Math.max(t,n);f=Math.max(Math.min(f,p),l),c=f+h,i&&!d&&(a._stacks[e.axis]._visualValues[o]=e.getValueForPixel(c)-e.getValueForPixel(f))}if(f===e.getPixelForValue(r)){const t=jm(h)*e.getLineWidthForValue(r)/2;f+=t,h-=t}return{size:h,base:f,head:c,center:c+h/2}}_calculateBarIndexPixels(t,e){const i=e.scale,o=this.options,n=o.skipNull,s=vm(o.maxBarThickness,1/0);let r,a;if(e.grouped){const i=n?this._getStackCount(t):e.stackCount,l="flex"===o.barThickness?function(t,e,i,o){const n=e.pixels,s=n[t];let r=t>0?n[t-1]:null,a=t<n.length-1?n[t+1]:null;const l=i.categoryPercentage;null===r&&(r=s-(null===a?e.end-e.start:a-s)),null===a&&(a=s+s-r);const d=s-(s-Math.min(r,a))/2*l;return{chunk:Math.abs(a-r)/2*l/o,ratio:i.barPercentage,start:d}}(t,e,o,i):function(t,e,i,o){const n=i.barThickness;let s,r;return um(n)?(s=e.min*i.categoryPercentage,r=i.barPercentage):(s=n*o,r=1),{chunk:s/o,ratio:r,start:e.pixels[t]-s/2}}(t,e,o,i),d=this._getStackIndex(this.index,this._cachedMeta.stack,n?t:void 0);r=l.start+l.chunk*d+l.chunk/2,a=Math.min(s,l.chunk*l.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.axis],t),a=Math.min(s,e.min*e.ratio);return{base:r-a/2,head:r+a/2,center:r,size:a}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,o=i.length;let n=0;for(;n<o;++n)null===this.getParsed(n)[e.axis]||i[n].hidden||i[n].draw(this._ctx)}},BubbleController:class extends yv{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,o){const n=super.parsePrimitiveData(t,e,i,o);for(let t=0;t<n.length;t++)n[t]._custom=this.resolveDataElementOptions(t+i).radius;return n}parseArrayData(t,e,i,o){const n=super.parseArrayData(t,e,i,o);for(let t=0;t<n.length;t++){const o=e[i+t];n[t]._custom=vm(o[2],this.resolveDataElementOptions(t+i).radius)}return n}parseObjectData(t,e,i,o){const n=super.parseObjectData(t,e,i,o);for(let t=0;t<n.length;t++){const o=e[i+t];n[t]._custom=vm(o&&o.r&&+o.r,this.resolveDataElementOptions(t+i).radius)}return n}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:o,yScale:n}=e,s=this.getParsed(t),r=o.getLabelForValue(s.x),a=n.getLabelForValue(s.y),l=s._custom;return{label:i[t]||"",value:"("+r+", "+a+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,o){const n="reset"===o,{iScale:s,vScale:r}=this._cachedMeta,{sharedOptions:a,includeOptions:l}=this._getSharedOptions(e,o),d=s.axis,c=r.axis;for(let h=e;h<e+i;h++){const e=t[h],i=!n&&this.getParsed(h),u={},p=u[d]=n?s.getPixelForDecimal(.5):s.getPixelForValue(i[d]),m=u[c]=n?r.getBasePixel():r.getPixelForValue(i[c]);u.skip=isNaN(p)||isNaN(m),l&&(u.options=a||this.resolveDataElementOptions(h,e.active?"active":o),n&&(u.options.radius=0)),this.updateElement(e,h,u,o)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let o=super.resolveDataElementOptions(t,e);o.$shared&&(o=Object.assign({},o,{$shared:!1}));const n=o.radius;return"active"!==e&&(o.radius=0),o.radius+=vm(i&&i._custom,n),o}},DoughnutController:Ev,LineController:class extends yv{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:o=[],_dataset:n}=e,s=this.chart._animationsDisabled;let{start:r,count:a}=mg(e,o,s);this._drawStart=r,this._drawCount=a,gg(e)&&(r=0,a=o.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!n._decimated,i.points=o;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!s,options:l},t),this.updateElements(o,r,a,t)}updateElements(t,e,i,o){const n="reset"===o,{iScale:s,vScale:r,_stacked:a,_dataset:l}=this._cachedMeta,{sharedOptions:d,includeOptions:c}=this._getSharedOptions(e,o),h=s.axis,u=r.axis,{spanGaps:p,segment:m}=this.options,g=Wm(p)?p:Number.POSITIVE_INFINITY,f=this.chart._animationsDisabled||n||"none"===o,v=e+i,y=t.length;let b=e>0&&this.getParsed(e-1);for(let i=0;i<y;++i){const p=t[i],y=f?p:{};if(i<e||i>=v){y.skip=!0;continue}const x=this.getParsed(i),_=um(x[u]),w=y[h]=s.getPixelForValue(x[h],i),k=y[u]=n||_?r.getBasePixel():r.getPixelForValue(a?this.applyStack(r,x,a):x[u],i);y.skip=isNaN(w)||isNaN(k)||_,y.stop=i>0&&Math.abs(x[h]-b[h])>g,m&&(y.parsed=x,y.raw=l.data[i]),c&&(y.options=d||this.resolveDataElementOptions(i,p.active?"active":o)),f||this.updateElement(p,i,y,o),b=x}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,o=t.data||[];if(!o.length)return i;const n=o[0].size(this.resolveDataElementOptions(0)),s=o[o.length-1].size(this.resolveDataElementOptions(o.length-1));return Math.max(i,n,s)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},PieController:class extends Ev{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:$v,RadarController:class extends yv{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,o){return _f.bind(this)(t,e,i,o)}update(t){const e=this._cachedMeta,i=e.dataset,o=e.data||[],n=e.iScale.getLabels();if(i.points=o,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const s={_loop:!0,_fullLoop:n.length===o.length,options:e};this.updateElement(i,void 0,s,t)}this.updateElements(o,0,o.length,t)}updateElements(t,e,i,o){const n=this._cachedMeta.rScale,s="reset"===o;for(let r=e;r<e+i;r++){const e=t[r],i=this.resolveDataElementOptions(r,e.active?"active":o),a=n.getPointPositionForValue(r,this.getParsed(r).r),l=s?n.xCenter:a.x,d=s?n.yCenter:a.y,c={x:l,y:d,angle:a.angle,skip:isNaN(l)||isNaN(d),options:i};this.updateElement(e,r,c,o)}}},ScatterController:class extends yv{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:o,yScale:n}=e,s=this.getParsed(t),r=o.getLabelForValue(s.x),a=n.getLabelForValue(s.y);return{label:i[t]||"",value:"("+r+", "+a+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,o=this.chart._animationsDisabled;let{start:n,count:s}=mg(e,i,o);if(this._drawStart=n,this._drawCount=s,gg(e)&&(n=0,s=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:n,_dataset:s}=e;n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!s._decimated,n.points=i;const r=this.resolveDatasetElementOptions(t);r.segment=this.options.segment,this.updateElement(n,void 0,{animated:!o,options:r},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,n,s,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,o){const n="reset"===o,{iScale:s,vScale:r,_stacked:a,_dataset:l}=this._cachedMeta,d=this.resolveDataElementOptions(e,o),c=this.getSharedOptions(d),h=this.includeOptions(o,c),u=s.axis,p=r.axis,{spanGaps:m,segment:g}=this.options,f=Wm(m)?m:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||n||"none"===o;let y=e>0&&this.getParsed(e-1);for(let d=e;d<e+i;++d){const e=t[d],i=this.getParsed(d),m=v?e:{},b=um(i[p]),x=m[u]=s.getPixelForValue(i[u],d),_=m[p]=n||b?r.getBasePixel():r.getPixelForValue(a?this.applyStack(r,i,a):i[p],d);m.skip=isNaN(x)||isNaN(_)||b,m.stop=d>0&&Math.abs(i[u]-y[u])>f,g&&(m.parsed=i,m.raw=l.data[d]),h&&(m.options=c||this.resolveDataElementOptions(d,e.active?"active":o)),v||this.updateElement(e,d,m,o),y=i}this.updateSharedOptions(c,o,d)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}const i=t.dataset,o=i.options&&i.options.borderWidth||0;if(!e.length)return o;const n=e[0].size(this.resolveDataElementOptions(0)),s=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(o,n,s)/2}}});function Dv(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Mv{static override(t){Object.assign(Mv.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return Dv()}parse(){return Dv()}format(){return Dv()}add(){return Dv()}diff(){return Dv()}startOf(){return Dv()}endOf(){return Dv()}}var Iv={_date:Mv};function Ov(t,e,i,o){const{controller:n,data:s,_sorted:r}=t,a=n._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(a&&e===a.axis&&"r"!==e&&r&&s.length){const r=a._reversePixels?rg:sg;if(!o){const o=r(s,e,i);if(l){const{vScale:e}=n._cachedMeta,{_parsed:i}=t,s=i.slice(0,o.lo+1).reverse().findIndex((t=>!um(t[e.axis])));o.lo-=Math.max(0,s);const r=i.slice(o.hi).findIndex((t=>!um(t[e.axis])));o.hi+=Math.max(0,r)}return o}if(n._sharedOptions){const t=s[0],o="function"==typeof t.getRange&&t.getRange(e);if(o){const t=r(s,e,i-o),n=r(s,e,i+o);return{lo:t.lo,hi:n.hi}}}}return{lo:0,hi:s.length-1}}function Lv(t,e,i,o,n){const s=t.getSortedVisibleDatasetMetas(),r=i[e];for(let t=0,i=s.length;t<i;++t){const{index:i,data:a}=s[t],{lo:l,hi:d}=Ov(s[t],e,r,n);for(let t=l;t<=d;++t){const e=a[t];e.skip||o(e,i,t)}}}function zv(t,e,i,o,n){const s=[];if(!n&&!t.isPointInArea(e))return s;return Lv(t,i,e,(function(i,r,a){(n||qg(i,t.chartArea,0))&&i.inRange(e.x,e.y,o)&&s.push({element:i,datasetIndex:r,index:a})}),!0),s}function Pv(t,e,i,o,n,s){let r=[];const a=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,o){const n=e?Math.abs(t.x-o.x):0,s=i?Math.abs(t.y-o.y):0;return Math.sqrt(Math.pow(n,2)+Math.pow(s,2))}}(i);let l=Number.POSITIVE_INFINITY;return Lv(t,i,e,(function(i,d,c){const h=i.inRange(e.x,e.y,n);if(o&&!h)return;const u=i.getCenterPoint(n);if(!(!!s||t.isPointInArea(u))&&!h)return;const p=a(e,u);p<l?(r=[{element:i,datasetIndex:d,index:c}],l=p):p===l&&r.push({element:i,datasetIndex:d,index:c})})),r}function Rv(t,e,i,o,n,s){return s||t.isPointInArea(e)?"r"!==i||o?Pv(t,e,i,o,n,s):function(t,e,i,o){let n=[];return Lv(t,i,e,(function(t,i,s){const{startAngle:r,endAngle:a}=t.getProps(["startAngle","endAngle"],o),{angle:l}=Xm(t,{x:e.x,y:e.y});eg(l,r,a)&&n.push({element:t,datasetIndex:i,index:s})})),n}(t,e,i,n):[]}function Nv(t,e,i,o,n){const s=[],r="x"===i?"inXRange":"inYRange";let a=!1;return Lv(t,i,e,((t,o,l)=>{t[r]&&t[r](e[i],n)&&(s.push({element:t,datasetIndex:o,index:l}),a=a||t.inRange(e.x,e.y,n))})),o&&!a?[]:s}var Bv={evaluateInteractionItems:Lv,modes:{index(t,e,i,o){const n=Pf(e,t),s=i.axis||"x",r=i.includeInvisible||!1,a=i.intersect?zv(t,n,s,o,r):Rv(t,n,s,!1,o,r),l=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=a[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})})),l):[]},dataset(t,e,i,o){const n=Pf(e,t),s=i.axis||"xy",r=i.includeInvisible||!1;let a=i.intersect?zv(t,n,s,o,r):Rv(t,n,s,!1,o,r);if(a.length>0){const e=a[0].datasetIndex,i=t.getDatasetMeta(e).data;a=[];for(let t=0;t<i.length;++t)a.push({element:i[t],datasetIndex:e,index:t})}return a},point:(t,e,i,o)=>zv(t,Pf(e,t),i.axis||"xy",o,i.includeInvisible||!1),nearest(t,e,i,o){const n=Pf(e,t),s=i.axis||"xy",r=i.includeInvisible||!1;return Rv(t,n,s,i.intersect,o,r)},x:(t,e,i,o)=>Nv(t,Pf(e,t),"x",i.intersect,o),y:(t,e,i,o)=>Nv(t,Pf(e,t),"y",i.intersect,o)}};const Fv=["left","top","right","bottom"];function qv(t,e){return t.filter((t=>t.pos===e))}function Uv(t,e){return t.filter((t=>-1===Fv.indexOf(t.pos)&&t.box.axis===e))}function jv(t,e){return t.sort(((t,i)=>{const o=e?i:t,n=e?t:i;return o.weight===n.weight?o.index-n.index:o.weight-n.weight}))}function Vv(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:o,stackWeight:n}=i;if(!t||!Fv.includes(o))continue;const s=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});s.count++,s.weight+=n}return e}(t),{vBoxMaxWidth:o,hBoxMaxHeight:n}=e;let s,r,a;for(s=0,r=t.length;s<r;++s){a=t[s];const{fullSize:r}=a.box,l=i[a.stack],d=l&&a.stackWeight/l.weight;a.horizontal?(a.width=d?d*o:r&&e.availableWidth,a.height=n):(a.width=o,a.height=d?d*n:r&&e.availableHeight)}return i}function Hv(t,e,i,o){return Math.max(t[i],e[i])+Math.max(t[o],e[o])}function Wv(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function Zv(t,e,i,o){const{pos:n,box:s}=i,r=t.maxPadding;if(!mm(n)){i.size&&(t[n]-=i.size);const e=o[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?s.height:s.width),i.size=e.size/e.count,t[n]+=i.size}s.getPadding&&Wv(r,s.getPadding());const a=Math.max(0,e.outerWidth-Hv(r,t,"left","right")),l=Math.max(0,e.outerHeight-Hv(r,t,"top","bottom")),d=a!==t.w,c=l!==t.h;return t.w=a,t.h=l,i.horizontal?{same:d,other:c}:{same:c,other:d}}function Yv(t,e){const i=e.maxPadding;function o(t){const o={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{o[t]=Math.max(e[t],i[t])})),o}return o(t?["left","right"]:["top","bottom"])}function Gv(t,e,i,o){const n=[];let s,r,a,l,d,c;for(s=0,r=t.length,d=0;s<r;++s){a=t[s],l=a.box,l.update(a.width||e.w,a.height||e.h,Yv(a.horizontal,e));const{same:r,other:h}=Zv(e,i,a,o);d|=r&&n.length,c=c||h,l.fullSize||n.push(a)}return d&&Gv(n,e,i,o)||c}function Kv(t,e,i,o,n){t.top=i,t.left=e,t.right=e+o,t.bottom=i+n,t.width=o,t.height=n}function Xv(t,e,i,o){const n=i.padding;let{x:s,y:r}=e;for(const a of t){const t=a.box,l=o[a.stack]||{count:1,placed:0,weight:1},d=a.stackWeight/l.weight||1;if(a.horizontal){const o=e.w*d,s=l.size||t.height;Mm(l.start)&&(r=l.start),t.fullSize?Kv(t,n.left,r,i.outerWidth-n.right-n.left,s):Kv(t,e.left+l.placed,r,o,s),l.start=r,l.placed+=o,r=t.bottom}else{const o=e.h*d,r=l.size||t.width;Mm(l.start)&&(s=l.start),t.fullSize?Kv(t,s,n.top,r,i.outerHeight-n.bottom-n.top):Kv(t,s,e.top+l.placed,r,o),l.start=s,l.placed+=o,s=t.right}}e.x=s,e.y=r}var Qv={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,o){if(!t)return;const n=nf(t.options.layout.padding),s=Math.max(e-n.width,0),r=Math.max(i-n.height,0),a=function(t){const e=function(t){const e=[];let i,o,n,s,r,a;for(i=0,o=(t||[]).length;i<o;++i)n=t[i],({position:s,options:{stack:r,stackWeight:a=1}}=n),e.push({index:i,box:n,pos:s,horizontal:n.isHorizontal(),weight:n.weight,stack:r&&s+r,stackWeight:a});return e}(t),i=jv(e.filter((t=>t.box.fullSize)),!0),o=jv(qv(e,"left"),!0),n=jv(qv(e,"right")),s=jv(qv(e,"top"),!0),r=jv(qv(e,"bottom")),a=Uv(e,"x"),l=Uv(e,"y");return{fullSize:i,leftAndTop:o.concat(s),rightAndBottom:n.concat(l).concat(r).concat(a),chartArea:qv(e,"chartArea"),vertical:o.concat(n).concat(l),horizontal:s.concat(r).concat(a)}}(t.boxes),l=a.vertical,d=a.horizontal;xm(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const c=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,h=Object.freeze({outerWidth:e,outerHeight:i,padding:n,availableWidth:s,availableHeight:r,vBoxMaxWidth:s/2/c,hBoxMaxHeight:r/2}),u=Object.assign({},n);Wv(u,nf(o));const p=Object.assign({maxPadding:u,w:s,h:r,x:n.left,y:n.top},n),m=Vv(l.concat(d),h);Gv(a.fullSize,p,h,m),Gv(l,p,h,m),Gv(d,p,h,m)&&Gv(l,p,h,m),function(t){const e=t.maxPadding;function i(i){const o=Math.max(e[i]-t[i],0);return t[i]+=o,o}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(p),Xv(a.leftAndTop,p,h,m),p.x+=p.w,p.y+=p.h,Xv(a.rightAndBottom,p,h,m),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},xm(a.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})}))}};class Jv{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,o){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,o?Math.floor(e/o):i)}}isAttached(t){return!0}updateConfig(t){}}class ty extends Jv{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ey="$chartjs",iy={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},oy=t=>null===t||""===t;const ny=!!Ff&&{passive:!0};function sy(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,ny)}function ry(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function ay(t,e,i){const o=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||ry(i.addedNodes,o),e=e&&!ry(i.removedNodes,o);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}function ly(t,e,i){const o=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||ry(i.removedNodes,o),e=e&&!ry(i.addedNodes,o);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}const dy=new Map;let cy=0;function hy(){const t=window.devicePixelRatio;t!==cy&&(cy=t,dy.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function uy(t,e,i){const o=t.canvas,n=o&&Df(o);if(!n)return;const s=hg(((t,e)=>{const o=n.clientWidth;i(t,e),o<n.clientWidth&&i()}),window),r=new ResizeObserver((t=>{const e=t[0],i=e.contentRect.width,o=e.contentRect.height;0===i&&0===o||s(i,o)}));return r.observe(n),function(t,e){dy.size||window.addEventListener("resize",hy),dy.set(t,e)}(t,s),r}function py(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){dy.delete(t),dy.size||window.removeEventListener("resize",hy)}(t)}function my(t,e,i){const o=t.canvas,n=hg((e=>{null!==t.ctx&&i(function(t,e){const i=iy[t.type]||t.type,{x:o,y:n}=Pf(t,e);return{type:i,chart:e,native:t,x:void 0!==o?o:null,y:void 0!==n?n:null}}(e,t))}),t);return function(t,e,i){t&&t.addEventListener(e,i,ny)}(o,e,n),n}class gy extends Jv{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,o=t.getAttribute("height"),n=t.getAttribute("width");if(t[ey]={initial:{height:o,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",oy(n)){const e=qf(t,"width");void 0!==e&&(t.width=e)}if(oy(o))if(""===t.style.height)t.height=t.width/(e||2);else{const e=qf(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[ey])return!1;const i=e[ey].initial;["height","width"].forEach((t=>{const o=i[t];um(o)?e.removeAttribute(t):e.setAttribute(t,o)}));const o=i.style||{};return Object.keys(o).forEach((t=>{e.style[t]=o[t]})),e.width=e.width,delete e[ey],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const o=t.$proxies||(t.$proxies={}),n={attach:ay,detach:ly,resize:uy}[e]||my;o[e]=n(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),o=i[e];if(!o)return;({attach:py,detach:py,resize:py}[e]||sy)(t,e,o),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,o){return Nf(t,e,i,o)}isAttached(t){const e=t&&Df(t);return!(!e||!e.isConnected)}}let fy=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Wm(this.x)&&Wm(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const o={};return t.forEach((t=>{o[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),o}};function vy(t,e){const i=t.options.ticks,o=function(t){const e=t.options.offset,i=t._tickSize(),o=t._length/i+(e?0:1),n=t._maxLength/i;return Math.floor(Math.min(o,n))}(t),n=Math.min(i.maxTicksLimit||o,o),s=i.major.enabled?function(t){const e=[];let i,o;for(i=0,o=t.length;i<o;i++)t[i].major&&e.push(i);return e}(e):[],r=s.length,a=s[0],l=s[r-1],d=[];if(r>n)return function(t,e,i,o){let n,s=0,r=i[0];for(o=Math.ceil(o),n=0;n<t.length;n++)n===r&&(e.push(t[n]),s++,r=i[s*o])}(e,d,s,r/n),d;const c=function(t,e,i){const o=function(t){const e=t.length;let i,o;if(e<2)return!1;for(o=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==o)return!1;return o}(t),n=e.length/i;if(!o)return Math.max(n,1);const s=function(t){const e=[],i=Math.sqrt(t);let o;for(o=1;o<i;o++)t%o==0&&(e.push(o),e.push(t/o));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}(o);for(let t=0,e=s.length-1;t<e;t++){const e=s[t];if(e>n)return e}return Math.max(n,1)}(s,e,n);if(r>0){let t,i;const o=r>1?Math.round((l-a)/(r-1)):null;for(yy(e,d,c,um(o)?0:a-o,a),t=0,i=r-1;t<i;t++)yy(e,d,c,s[t],s[t+1]);return yy(e,d,c,l,um(o)?e.length:l+o),d}return yy(e,d,c),d}function yy(t,e,i,o,n){const s=vm(o,0),r=Math.min(vm(n,t.length),t.length);let a,l,d,c=0;for(i=Math.ceil(i),n&&(a=n-o,i=a/Math.floor(a/i)),d=s;d<0;)c++,d=Math.round(s+c*i);for(l=Math.max(s,0);l<r;l++)l===d&&(e.push(t[l]),c++,d=Math.round(s+c*i))}const by=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,xy=(t,e)=>Math.min(e||t,t);function _y(t,e){const i=[],o=t.length/e,n=t.length;let s=0;for(;s<n;s+=o)i.push(t[Math.floor(s)]);return i}function wy(t,e,i){const o=t.ticks.length,n=Math.min(e,o-1),s=t._startPixel,r=t._endPixel,a=1e-6;let l,d=t.getPixelForTick(n);if(!(i&&(l=1===o?Math.max(d-s,r-d):0===e?(t.getPixelForTick(1)-d)/2:(d-t.getPixelForTick(n-1))/2,d+=n<e?l:-l,d<s-a||d>r+a)))return d}function ky(t){return t.drawTicks?t.tickLength:0}function Cy(t,e){if(!t.display)return 0;const i=sf(t.font,e),o=nf(t.padding);return(pm(t.text)?t.text.length:1)*i.lineHeight+o.height}function Sy(t,e,i){let o=ug(t);return(i&&"right"!==e||!i&&"right"===e)&&(o=(t=>"left"===t?"right":"right"===t?"left":t)(o)),o}class Ay extends fy{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:o}=this;return t=fm(t,Number.POSITIVE_INFINITY),e=fm(e,Number.NEGATIVE_INFINITY),i=fm(i,Number.POSITIVE_INFINITY),o=fm(o,Number.NEGATIVE_INFINITY),{min:fm(t,i),max:fm(e,o),minDefined:gm(t),maxDefined:gm(e)}}getMinMax(t){let e,{min:i,max:o,minDefined:n,maxDefined:s}=this.getUserBounds();if(n&&s)return{min:i,max:o};const r=this.getMatchingVisibleMetas();for(let a=0,l=r.length;a<l;++a)e=r[a].controller.getMinMax(this,t),n||(i=Math.min(i,e.min)),s||(o=Math.max(o,e.max));return i=s&&i>o?o:i,o=n&&i>o?i:o,{min:fm(i,fm(o,i)),max:fm(o,fm(i,o))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){bm(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:o,grace:n,ticks:s}=this.options,r=s.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(t,e,i){const{min:o,max:n}=t,s=ym(e,(n-o)/2),r=(t,e)=>i&&0===t?0:t+e;return{min:r(o,-Math.abs(s)),max:r(n,s)}}(this,n,o),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const a=r<this.ticks.length;this._convertTicksToLabels(a?_y(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),s.display&&(s.autoSkip||"auto"===s.source)&&(this.ticks=vy(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),a&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){bm(this.options.afterUpdate,[this])}beforeSetDimensions(){bm(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){bm(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),bm(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){bm(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,o,n;for(i=0,o=t.length;i<o;i++)n=t[i],n.label=bm(e.callback,[n.value,i,t],this)}afterTickToLabelConversion(){bm(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){bm(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=xy(this.ticks.length,t.ticks.maxTicksLimit),o=e.minRotation||0,n=e.maxRotation;let s,r,a,l=o;if(!this._isVisible()||!e.display||o>=n||i<=1||!this.isHorizontal())return void(this.labelRotation=o);const d=this._getLabelSizes(),c=d.widest.width,h=d.highest.height,u=ig(this.chart.width-c,0,this.maxWidth);s=t.offset?this.maxWidth/i:u/(i-1),c+6>s&&(s=u/(i-(t.offset?.5:1)),r=this.maxHeight-ky(t.grid)-e.padding-Cy(t.title,this.chart.options.font),a=Math.sqrt(c*c+h*h),l=Gm(Math.min(Math.asin(ig((d.highest.height+6)/s,-1,1)),Math.asin(ig(r/a,-1,1))-Math.asin(ig(h/a,-1,1)))),l=Math.max(o,Math.min(n,l))),this.labelRotation=l}afterCalculateLabelRotation(){bm(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){bm(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:o,grid:n}}=this,s=this._isVisible(),r=this.isHorizontal();if(s){const s=Cy(o,e.options.font);if(r?(t.width=this.maxWidth,t.height=ky(n)+s):(t.height=this.maxHeight,t.width=ky(n)+s),i.display&&this.ticks.length){const{first:e,last:o,widest:n,highest:s}=this._getLabelSizes(),a=2*i.padding,l=Ym(this.labelRotation),d=Math.cos(l),c=Math.sin(l);if(r){const e=i.mirror?0:c*n.width+d*s.height;t.height=Math.min(this.maxHeight,t.height+e+a)}else{const e=i.mirror?0:d*n.width+c*s.height;t.width=Math.min(this.maxWidth,t.width+e+a)}this._calculatePadding(e,o,c,d)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,o){const{ticks:{align:n,padding:s},position:r}=this.options,a=0!==this.labelRotation,l="top"!==r&&"x"===this.axis;if(this.isHorizontal()){const r=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,h=0;a?l?(c=o*t.width,h=i*e.height):(c=i*t.height,h=o*e.width):"start"===n?h=e.width:"end"===n?c=t.width:"inner"!==n&&(c=t.width/2,h=e.width/2),this.paddingLeft=Math.max((c-r+s)*this.width/(this.width-r),0),this.paddingRight=Math.max((h-d+s)*this.width/(this.width-d),0)}else{let i=e.height/2,o=t.height/2;"start"===n?(i=0,o=t.height):"end"===n&&(i=e.height,o=0),this.paddingTop=i+s,this.paddingBottom=o+s}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){bm(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)um(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=_y(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:o,_longestTextCache:n}=this,s=[],r=[],a=Math.floor(e/xy(e,i));let l,d,c,h,u,p,m,g,f,v,y,b=0,x=0;for(l=0;l<e;l+=a){if(h=t[l].label,u=this._resolveTickFontOptions(l),o.font=p=u.string,m=n[p]=n[p]||{data:{},gc:[]},g=u.lineHeight,f=v=0,um(h)||pm(h)){if(pm(h))for(d=0,c=h.length;d<c;++d)y=h[d],um(y)||pm(y)||(f=zg(o,m.data,m.gc,f,y),v+=g)}else f=zg(o,m.data,m.gc,f,h),v=g;s.push(f),r.push(v),b=Math.max(f,b),x=Math.max(v,x)}!function(t,e){xm(t,(t=>{const i=t.gc,o=i.length/2;let n;if(o>e){for(n=0;n<o;++n)delete t.data[i[n]];i.splice(0,o)}}))}(n,e);const _=s.indexOf(b),w=r.indexOf(x),k=t=>({width:s[t]||0,height:r[t]||0});return{first:k(0),last:k(e-1),widest:k(_),highest:k(w),widths:s,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return ig(this._alignToPixels?Rg(this.chart,e,0):e,-32768,32767)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=function(t,e,i){return af(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=af(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=Ym(this.labelRotation),i=Math.abs(Math.cos(e)),o=Math.abs(Math.sin(e)),n=this._getLabelSizes(),s=t.autoSkipPadding||0,r=n?n.widest.width+s:0,a=n?n.highest.height+s:0;return this.isHorizontal()?a*i>r*o?r/i:a/o:a*o<r*i?a/i:r/o}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,o=this.options,{grid:n,position:s,border:r}=o,a=n.offset,l=this.isHorizontal(),d=this.ticks.length+(a?1:0),c=ky(n),h=[],u=r.setContext(this.getContext()),p=u.display?u.width:0,m=p/2,g=function(t){return Rg(i,t,p)};let f,v,y,b,x,_,w,k,C,S,A,E;if("top"===s)f=g(this.bottom),_=this.bottom-c,k=f-m,S=g(t.top)+m,E=t.bottom;else if("bottom"===s)f=g(this.top),S=t.top,E=g(t.bottom)-m,_=f+m,k=this.top+c;else if("left"===s)f=g(this.right),x=this.right-c,w=f-m,C=g(t.left)+m,A=t.right;else if("right"===s)f=g(this.left),C=t.left,A=g(t.right)-m,x=f+m,w=this.left+c;else if("x"===e){if("center"===s)f=g((t.top+t.bottom)/2+.5);else if(mm(s)){const t=Object.keys(s)[0],e=s[t];f=g(this.chart.scales[t].getPixelForValue(e))}S=t.top,E=t.bottom,_=f+m,k=_+c}else if("y"===e){if("center"===s)f=g((t.left+t.right)/2);else if(mm(s)){const t=Object.keys(s)[0],e=s[t];f=g(this.chart.scales[t].getPixelForValue(e))}x=f-m,w=x-c,C=t.left,A=t.right}const $=vm(o.ticks.maxTicksLimit,d),T=Math.max(1,Math.ceil(d/$));for(v=0;v<d;v+=T){const t=this.getContext(v),e=n.setContext(t),o=r.setContext(t),s=e.lineWidth,d=e.color,c=o.dash||[],u=o.dashOffset,p=e.tickWidth,m=e.tickColor,g=e.tickBorderDash||[],f=e.tickBorderDashOffset;y=wy(this,v,a),void 0!==y&&(b=Rg(i,y,s),l?x=w=C=A=b:_=k=S=E=b,h.push({tx1:x,ty1:_,tx2:w,ty2:k,x1:C,y1:S,x2:A,y2:E,width:s,color:d,borderDash:c,borderDashOffset:u,tickWidth:p,tickColor:m,tickBorderDash:g,tickBorderDashOffset:f}))}return this._ticksLength=d,this._borderValue=f,h}_computeLabelItems(t){const e=this.axis,i=this.options,{position:o,ticks:n}=i,s=this.isHorizontal(),r=this.ticks,{align:a,crossAlign:l,padding:d,mirror:c}=n,h=ky(i.grid),u=h+d,p=c?-d:u,m=-Ym(this.labelRotation),g=[];let f,v,y,b,x,_,w,k,C,S,A,E,$="middle";if("top"===o)_=this.bottom-p,w=this._getXAxisLabelAlignment();else if("bottom"===o)_=this.top+p,w=this._getXAxisLabelAlignment();else if("left"===o){const t=this._getYAxisLabelAlignment(h);w=t.textAlign,x=t.x}else if("right"===o){const t=this._getYAxisLabelAlignment(h);w=t.textAlign,x=t.x}else if("x"===e){if("center"===o)_=(t.top+t.bottom)/2+u;else if(mm(o)){const t=Object.keys(o)[0],e=o[t];_=this.chart.scales[t].getPixelForValue(e)+u}w=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===o)x=(t.left+t.right)/2-u;else if(mm(o)){const t=Object.keys(o)[0],e=o[t];x=this.chart.scales[t].getPixelForValue(e)}w=this._getYAxisLabelAlignment(h).textAlign}"y"===e&&("start"===a?$="top":"end"===a&&($="bottom"));const T=this._getLabelSizes();for(f=0,v=r.length;f<v;++f){y=r[f],b=y.label;const t=n.setContext(this.getContext(f));k=this.getPixelForTick(f)+n.labelOffset,C=this._resolveTickFontOptions(f),S=C.lineHeight,A=pm(b)?b.length:1;const e=A/2,i=t.color,a=t.textStrokeColor,d=t.textStrokeWidth;let h,u=w;if(s?(x=k,"inner"===w&&(u=f===v-1?this.options.reverse?"left":"right":0===f?this.options.reverse?"right":"left":"center"),E="top"===o?"near"===l||0!==m?-A*S+S/2:"center"===l?-T.highest.height/2-e*S+S:-T.highest.height+S/2:"near"===l||0!==m?S/2:"center"===l?T.highest.height/2-e*S:T.highest.height-A*S,c&&(E*=-1),0===m||t.showLabelBackdrop||(x+=S/2*Math.sin(m))):(_=k,E=(1-A)*S/2),t.showLabelBackdrop){const e=nf(t.backdropPadding),i=T.heights[f],o=T.widths[f];let n=E-e.top,s=0-e.left;switch($){case"middle":n-=i/2;break;case"bottom":n-=i}switch(w){case"center":s-=o/2;break;case"right":s-=o;break;case"inner":f===v-1?s-=o:f>0&&(s-=o/2)}h={left:s,top:n,width:o+e.width,height:i+e.height,color:t.backdropColor}}g.push({label:b,font:C,textOffset:E,options:{rotation:m,color:i,strokeColor:a,strokeWidth:d,textAlign:u,textBaseline:$,translation:[x,_],backdrop:h}})}return g}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Ym(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:o,padding:n}}=this.options,s=t+n,r=this._getLabelSizes().widest.width;let a,l;return"left"===e?o?(l=this.right+n,"near"===i?a="left":"center"===i?(a="center",l+=r/2):(a="right",l+=r)):(l=this.right-s,"near"===i?a="right":"center"===i?(a="center",l-=r/2):(a="left",l=this.left)):"right"===e?o?(l=this.left+n,"near"===i?a="right":"center"===i?(a="center",l-=r/2):(a="left",l-=r)):(l=this.left+s,"near"===i?a="left":"center"===i?(a="center",l+=r/2):(a="right",l=this.right)):a="right",{textAlign:a,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:o,width:n,height:s}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,o,n,s),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks.findIndex((e=>e.value===t));if(i>=0){return e.setContext(this.getContext(i)).lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,o=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,s;const r=(t,e,o)=>{o.width&&o.color&&(i.save(),i.lineWidth=o.width,i.strokeStyle=o.color,i.setLineDash(o.borderDash||[]),i.lineDashOffset=o.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(n=0,s=o.length;n<s;++n){const t=o[n];e.drawOnChartArea&&r({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&r({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:o}}=this,n=i.setContext(this.getContext()),s=i.display?n.width:0;if(!s)return;const r=o.setContext(this.getContext(0)).lineWidth,a=this._borderValue;let l,d,c,h;this.isHorizontal()?(l=Rg(t,this.left,s)-s/2,d=Rg(t,this.right,r)+r/2,c=h=a):(c=Rg(t,this.top,s)-s/2,h=Rg(t,this.bottom,r)+r/2,l=d=a),e.save(),e.lineWidth=n.width,e.strokeStyle=n.color,e.beginPath(),e.moveTo(l,c),e.lineTo(d,h),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&Ug(e,i);const o=this.getLabelItems(t);for(const t of o){const i=t.options,o=t.font;Yg(e,t.label,0,t.textOffset,o,i)}i&&jg(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:o}}=this;if(!i.display)return;const n=sf(i.font),s=nf(i.padding),r=i.align;let a=n.lineHeight/2;"bottom"===e||"center"===e||mm(e)?(a+=s.bottom,pm(i.text)&&(a+=n.lineHeight*(i.text.length-1))):a+=s.top;const{titleX:l,titleY:d,maxWidth:c,rotation:h}=function(t,e,i,o){const{top:n,left:s,bottom:r,right:a,chart:l}=t,{chartArea:d,scales:c}=l;let h,u,p,m=0;const g=r-n,f=a-s;if(t.isHorizontal()){if(u=pg(o,s,a),mm(i)){const t=Object.keys(i)[0],o=i[t];p=c[t].getPixelForValue(o)+g-e}else p="center"===i?(d.bottom+d.top)/2+g-e:by(t,i,e);h=a-s}else{if(mm(i)){const t=Object.keys(i)[0],o=i[t];u=c[t].getPixelForValue(o)-f+e}else u="center"===i?(d.left+d.right)/2-f+e:by(t,i,e);p=pg(o,r,n),m="left"===i?-Bm:Bm}return{titleX:u,titleY:p,maxWidth:h,rotation:m}}(this,a,e,r);Yg(t,i.text,0,0,n,{color:i.color,maxWidth:c,rotation:h,textAlign:Sy(r,e,o),textBaseline:"middle",translation:[l,d]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=vm(t.grid&&t.grid.z,-1),o=vm(t.border&&t.border.z,0);return this._isVisible()&&this.draw===Ay.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:o,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",o=[];let n,s;for(n=0,s=e.length;n<s;++n){const s=e[n];s[i]!==this.id||t&&s.type!==t||o.push(s)}return o}_resolveTickFontOptions(t){return sf(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Ey{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const o=this.items,n=t.id,s=this.scope+"."+n;if(!n)throw new Error("class does not have id: "+t);return n in o||(o[n]=t,function(t,e,i){const o=Sm(Object.create(null),[i?Lg.get(i):{},Lg.get(e),t.defaults]);Lg.set(e,o),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{const o=i.split("."),n=o.pop(),s=[t].concat(o).join("."),r=e[i].split("."),a=r.pop(),l=r.join(".");Lg.route(s,n,l,a)}))}(e,t.defaultRoutes);t.descriptors&&Lg.describe(e,t.descriptors)}(t,s,i),this.override&&Lg.override(t.id,t.overrides)),s}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,o=this.scope;i in e&&delete e[i],o&&i in Lg[o]&&(delete Lg[o][i],this.override&&delete Tg[i])}}class $y{constructor(){this.controllers=new Ey(yv,"datasets",!0),this.elements=new Ey(fy,"elements"),this.plugins=new Ey(Object,"plugins"),this.scales=new Ey(Ay,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const o=i||this._getRegistryForType(e);i||o.isForType(e)||o===this.plugins&&e.id?this._exec(t,o,e):xm(e,(e=>{const o=i||this._getRegistryForType(e);this._exec(t,o,e)}))}))}_exec(t,e,i){const o=Dm(t);bm(i["before"+o],[],i),e[t](i),bm(i["after"+o],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const o=e.get(t);if(void 0===o)throw new Error('"'+t+'" is not a registered '+i+".");return o}}var Ty=new $y;class Dy{constructor(){this._init=[]}notify(t,e,i,o){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const n=o?this._descriptors(t).filter(o):this._descriptors(t),s=this._notify(n,t,e,i);return"afterDestroy"===e&&(this._notify(n,t,"stop"),this._notify(this._init,t,"uninstall")),s}_notify(t,e,i,o){o=o||{};for(const n of t){const t=n.plugin;if(!1===bm(t[i],[e,o,n.options],t)&&o.cancelable)return!1}return!0}invalidate(){um(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,o=vm(i.options&&i.options.plugins,{}),n=function(t){const e={},i=[],o=Object.keys(Ty.plugins.items);for(let t=0;t<o.length;t++)i.push(Ty.getPlugin(o[t]));const n=t.plugins||[];for(let t=0;t<n.length;t++){const o=n[t];-1===i.indexOf(o)&&(i.push(o),e[o.id]=!0)}return{plugins:i,localIds:e}}(i);return!1!==o||e?function(t,{plugins:e,localIds:i},o,n){const s=[],r=t.getContext();for(const a of e){const e=a.id,l=My(o[e],n);null!==l&&s.push({plugin:a,options:Iy(t.config,{plugin:a,local:i[e]},l,r)})}return s}(t,n,o,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,o=(t,e)=>t.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(o(e,i),t,"stop"),this._notify(o(i,e),t,"start")}}function My(t,e){return e||!1!==t?!0===t?{}:t:null}function Iy(t,{plugin:e,local:i},o,n){const s=t.pluginScopeKeys(e),r=t.getOptionScopes(o,s);return i&&e.defaults&&r.push(e.defaults),t.createResolver(r,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Oy(t,e){const i=Lg.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function Ly(t){if("x"===t||"y"===t||"r"===t)return t}function zy(t,...e){if(Ly(t))return t;for(const o of e){const e=o.axis||("top"===(i=o.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.length>1&&Ly(t[0].toLowerCase());if(e)return e}var i;throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function Py(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function Ry(t,e){const i=Tg[t.type]||{scales:{}},o=e.scales||{},n=Oy(t.type,e),s=Object.create(null);return Object.keys(o).forEach((e=>{const r=o[e];if(!mm(r))return console.error(`Invalid scale configuration for scale: ${e}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);const a=zy(e,r,function(t,e){if(e.data&&e.data.datasets){const i=e.data.datasets.filter((e=>e.xAxisID===t||e.yAxisID===t));if(i.length)return Py(t,"x",i[0])||Py(t,"y",i[0])}return{}}(e,t),Lg.scales[r.type]),l=function(t,e){return t===e?"_index_":"_value_"}(a,n),d=i.scales||{};s[e]=Am(Object.create(null),[{axis:a},r,d[a],d[l]])})),t.data.datasets.forEach((i=>{const n=i.type||t.type,r=i.indexAxis||Oy(n,e),a=(Tg[n]||{}).scales||{};Object.keys(a).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,r),n=i[e+"AxisID"]||e;s[n]=s[n]||Object.create(null),Am(s[n],[{axis:e},o[n],a[t]])}))})),Object.keys(s).forEach((t=>{const e=s[t];Am(e,[Lg.scales[e.type],Lg.scale])})),s}function Ny(t){const e=t.options||(t.options={});e.plugins=vm(e.plugins,{}),e.scales=Ry(t,e)}function By(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const Fy=new Map,qy=new Set;function Uy(t,e){let i=Fy.get(t);return i||(i=e(),Fy.set(t,i),qy.add(i)),i}const jy=(t,e,i)=>{const o=Tm(e,i);void 0!==o&&t.add(o)};class Vy{constructor(t){this._config=function(t){return(t=t||{}).data=By(t.data),Ny(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=By(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Ny(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Uy(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return Uy(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return Uy(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return Uy(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let o=i.get(t);return o&&!e||(o=new Map,i.set(t,o)),o}getOptionScopes(t,e,i){const{options:o,type:n}=this,s=this._cachedScopes(t,i),r=s.get(e);if(r)return r;const a=new Set;e.forEach((e=>{t&&(a.add(t),e.forEach((e=>jy(a,t,e)))),e.forEach((t=>jy(a,o,t))),e.forEach((t=>jy(a,Tg[n]||{},t))),e.forEach((t=>jy(a,Lg,t))),e.forEach((t=>jy(a,Dg,t)))}));const l=Array.from(a);return 0===l.length&&l.push(Object.create(null)),qy.has(e)&&s.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,Tg[e]||{},Lg.datasets[e]||{},{type:e},Lg,Dg]}resolveNamedOptions(t,e,i,o=[""]){const n={$shared:!0},{resolver:s,subPrefixes:r}=Hy(this._resolverCache,t,o);let a=s;if(function(t,e){const{isScriptable:i,isIndexable:o}=cf(t);for(const n of e){const e=i(n),s=o(n),r=(s||e)&&t[n];if(e&&(Im(r)||Wy(r))||s&&pm(r))return!0}return!1}(s,e)){n.$shared=!1;a=df(s,i=Im(i)?i():i,this.createResolver(t,i,r))}for(const t of e)n[t]=a[t];return n}createResolver(t,e,i=[""],o){const{resolver:n}=Hy(this._resolverCache,t,i);return mm(e)?df(n,e,void 0,o):n}}function Hy(t,e,i){let o=t.get(e);o||(o=new Map,t.set(e,o));const n=i.join();let s=o.get(n);if(!s){s={resolver:lf(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},o.set(n,s)}return s}const Wy=t=>mm(t)&&Object.getOwnPropertyNames(t).some((e=>Im(t[e])));const Zy=["top","bottom","left","right","chartArea"];function Yy(t,e){return"top"===t||"bottom"===t||-1===Zy.indexOf(t)&&"x"===e}function Gy(t,e){return function(i,o){return i[t]===o[t]?i[e]-o[e]:i[t]-o[t]}}function Ky(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),bm(i&&i.onComplete,[t],e)}function Xy(t){const e=t.chart,i=e.options.animation;bm(i&&i.onProgress,[t],e)}function Qy(t){return Tf()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const Jy={},tb=t=>{const e=Qy(t);return Object.values(Jy).filter((t=>t.canvas===e)).pop()};function eb(t,e,i){const o=Object.keys(t);for(const n of o){const o=+n;if(o>=e){const s=t[n];delete t[n],(i>0||o>e)&&(t[o+i]=s)}}}function ib(t,e,i){return t.options.clip?t[i]:e[i]}class ob{static defaults=Lg;static instances=Jy;static overrides=Tg;static registry=Ty;static version="4.4.8";static getChart=tb;static register(...t){Ty.add(...t),nb()}static unregister(...t){Ty.remove(...t),nb()}constructor(t,e){const i=this.config=new Vy(e),o=Qy(t),n=tb(o);if(n)throw new Error("Canvas is already in use. Chart with ID '"+n.id+"' must be destroyed before the canvas with ID '"+n.canvas.id+"' can be reused.");const s=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||function(t){return!Tf()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?ty:gy}(o)),this.platform.updateConfig(i);const r=this.platform.acquireContext(o,s.aspectRatio),a=r&&r.canvas,l=a&&a.height,d=a&&a.width;this.id=hm(),this.ctx=r,this.canvas=a,this.width=d,this.height=l,this._options=s,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Dy,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(t,e){let i;return function(...o){return e?(clearTimeout(i),i=setTimeout(t,e,o)):t.apply(this,o),e}}((t=>this.update(t)),s.resizeDelay||0),this._dataChanges=[],Jy[this.id]=this,r&&a?(iv.listen(this,"complete",Ky),iv.listen(this,"progress",Xy),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:o,_aspectRatio:n}=this;return um(t)?e&&n?n:o?i/o:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Ty}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Bf(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ng(this.canvas,this.ctx),this}stop(){return iv.stop(this),this}resize(t,e){iv.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,o=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,s=this.platform.getMaximumSize(o,t,e,n),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),a=this.width?"resize":"attach";this.width=s.width,this.height=s.height,this._aspectRatio=this.aspectRatio,Bf(this,r,!0)&&(this.notifyPlugins("resize",{size:s}),bm(i.onResize,[this,s],this),this.attached&&this._doResize(a)&&this.render())}ensureScalesHaveIDs(){xm(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,o=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let n=[];e&&(n=n.concat(Object.keys(e).map((t=>{const i=e[t],o=zy(t,i),n="r"===o,s="x"===o;return{options:i,dposition:n?"chartArea":s?"bottom":"left",dtype:n?"radialLinear":s?"category":"linear"}})))),xm(n,(e=>{const n=e.options,s=n.id,r=zy(s,n),a=vm(n.type,e.dtype);void 0!==n.position&&Yy(n.position,r)===Yy(e.dposition)||(n.position=e.dposition),o[s]=!0;let l=null;if(s in i&&i[s].type===a)l=i[s];else{l=new(Ty.getScale(a))({id:s,type:a,ctx:this.ctx,chart:this}),i[l.id]=l}l.init(n,t)})),xm(o,((t,e)=>{t||delete i[e]})),xm(i,(t=>{Qv.configure(this,t,t.options),Qv.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(Gy("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,o;for(this._removeUnreferencedMetasets(),i=0,o=e.length;i<o;i++){const o=e[i];let n=this.getDatasetMeta(i);const s=o.type||this.config.type;if(n.type&&n.type!==s&&(this._destroyDatasetMeta(i),n=this.getDatasetMeta(i)),n.type=s,n.indexAxis=o.indexAxis||Oy(s,this.options),n.order=o.order||0,n.index=i,n.label=""+o.label,n.visible=this.isDatasetVisible(i),n.controller)n.controller.updateIndex(i),n.controller.linkScales();else{const e=Ty.getController(s),{datasetElementType:o,dataElementType:r}=Lg.datasets[s];Object.assign(e,{dataElementType:Ty.getElement(r),datasetElementType:o&&Ty.getElement(o)}),n.controller=new e(this,i),t.push(n.controller)}}return this._updateMetasets(),t}_resetElements(){xm(this.data.datasets,((t,e)=>{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),o=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let s=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const{controller:e}=this.getDatasetMeta(t),i=!o&&-1===n.indexOf(e);e.buildOrUpdateElements(i),s=Math.max(+e.getMaxOverflow(),s)}s=this._minPadding=i.layout.autoPadding?s:0,this._updateLayout(s),o||xm(n,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Gy("z","_idx"));const{_active:r,_lastEvent:a}=this;a?this._eventHandler(a,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){xm(this.scales,(t=>{Qv.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);Om(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:o,count:n}of e){eb(t,o,"_removeElements"===i?-n:n)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),o=i(0);for(let t=1;t<e;t++)if(!Om(o,i(t)))return;return Array.from(o).map((t=>t.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;Qv.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],xm(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,Im(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),o={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",o)&&(i.controller._update(e),o.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",o))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(iv.has(this)?this.attached&&!iv.running(this)&&iv.start(this):(this.draw(),Ky({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,e)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let o,n;for(o=0,n=e.length;o<n;++o){const n=e[o];t&&!n.visible||i.push(n)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,o=!i.disabled,n=function(t,e){const{xScale:i,yScale:o}=t;return i&&o?{left:ib(i,e,"left"),right:ib(i,e,"right"),top:ib(o,e,"top"),bottom:ib(o,e,"bottom")}:e}(t,this.chartArea),s={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",s)&&(o&&Ug(e,{left:!1===i.left?0:n.left-i.left,right:!1===i.right?this.width:n.right+i.right,top:!1===i.top?0:n.top-i.top,bottom:!1===i.bottom?this.height:n.bottom+i.bottom}),t.controller.draw(),o&&jg(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return qg(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,o){const n=Bv.modes[e];return"function"==typeof n?n(this,t,i,o):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let o=i.filter((t=>t&&t._dataset===e)).pop();return o||(o={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(o)),o}getContext(){return this.$context||(this.$context=af(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const o=i?"show":"hide",n=this.getDatasetMeta(t),s=n.controller._resolveAnimations(void 0,o);Mm(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),s.update(n,{visible:i}),this.update((e=>e.datasetIndex===t?o:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),iv.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Ng(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Jy[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(i,o)=>{e.addEventListener(this,i,o),t[i]=o},o=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};xm(this.options.events,(t=>i(t,o)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,o)=>{e.addEventListener(this,i,o),t[i]=o},o=(i,o)=>{t[i]&&(e.removeEventListener(this,i,o),delete t[i])},n=(t,e)=>{this.canvas&&this.resize(t,e)};let s;const r=()=>{o("attach",r),this.attached=!0,this.resize(),i("resize",n),i("detach",s)};s=()=>{this.attached=!1,o("resize",n),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():s()}unbindEvents(){xm(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},xm(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const o=i?"set":"remove";let n,s,r,a;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+o+"DatasetHoverStyle"]()),r=0,a=t.length;r<a;++r){s=t[r];const e=s&&this.getDatasetMeta(s.datasetIndex).controller;e&&e[o+"HoverStyle"](s.element,s.datasetIndex,s.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map((({datasetIndex:t,index:e})=>{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!_m(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter((e=>e.plugin.id===t)).length}_updateHoverStyles(t,e,i){const o=this.options.hover,n=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),s=n(e,t),r=i?t:n(t,e);s.length&&this.updateHoverStyle(s,o.mode,!1),r.length&&o.mode&&this.updateHoverStyle(r,o.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},o=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,o))return;const n=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,o),(n||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:o=[],options:n}=this,s=e,r=this._getActiveElements(t,o,i,s),a=function(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}(t),l=function(t,e,i,o){return i&&"mouseout"!==t.type?o?e:t:null}(t,this._lastEvent,i,a);i&&(this._lastEvent=null,bm(n.onHover,[t,r,this],this),a&&bm(n.onClick,[t,r,this],this));const d=!_m(r,o);return(d||e)&&(this._active=r,this._updateHoverStyles(r,o,e)),this._lastEvent=l,d}_getActiveElements(t,e,i,o){if("mouseout"===t.type)return[];if(!i)return e;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,o)}}function nb(){return xm(ob.instances,(t=>t._plugins.invalidate()))}function sb(t,e,i,o){const n=tf(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const s=(i-e)/2,r=Math.min(s,o*e/2),a=t=>{const e=(i-Math.min(s,t))*o/2;return ig(t,0,Math.min(s,e))};return{outerStart:a(n.outerStart),outerEnd:a(n.outerEnd),innerStart:ig(n.innerStart,0,r),innerEnd:ig(n.innerEnd,0,r)}}function rb(t,e,i,o){return{x:i+t*Math.cos(e),y:o+t*Math.sin(e)}}function ab(t,e,i,o,n,s){const{x:r,y:a,startAngle:l,pixelMargin:d,innerRadius:c}=e,h=Math.max(e.outerRadius+o+i-d,0),u=c>0?c+o+i+d:0;let p=0;const m=n-l;if(o){const t=((c>0?c-o:0)+(h>0?h-o:0))/2;p=(m-(0!==t?m*t/(t+o):m))/2}const g=(m-Math.max(.001,m*h-i/Lm)/h)/2,f=l+g+p,v=n-g-p,{outerStart:y,outerEnd:b,innerStart:x,innerEnd:_}=sb(e,u,h,v-f),w=h-y,k=h-b,C=f+y/w,S=v-b/k,A=u+x,E=u+_,$=f+x/A,T=v-_/E;if(t.beginPath(),s){const e=(C+S)/2;if(t.arc(r,a,h,C,e),t.arc(r,a,h,e,S),b>0){const e=rb(k,S,r,a);t.arc(e.x,e.y,b,S,v+Bm)}const i=rb(E,v,r,a);if(t.lineTo(i.x,i.y),_>0){const e=rb(E,T,r,a);t.arc(e.x,e.y,_,v+Bm,T+Math.PI)}const o=(v-_/u+(f+x/u))/2;if(t.arc(r,a,u,v-_/u,o,!0),t.arc(r,a,u,o,f+x/u,!0),x>0){const e=rb(A,$,r,a);t.arc(e.x,e.y,x,$+Math.PI,f-Bm)}const n=rb(w,f,r,a);if(t.lineTo(n.x,n.y),y>0){const e=rb(w,C,r,a);t.arc(e.x,e.y,y,f-Bm,C)}}else{t.moveTo(r,a);const e=Math.cos(C)*h+r,i=Math.sin(C)*h+a;t.lineTo(e,i);const o=Math.cos(S)*h+r,n=Math.sin(S)*h+a;t.lineTo(o,n)}t.closePath()}function lb(t,e,i,o,n){const{fullCircles:s,startAngle:r,circumference:a,options:l}=e,{borderWidth:d,borderJoinStyle:c,borderDash:h,borderDashOffset:u}=l,p="inner"===l.borderAlign;if(!d)return;t.setLineDash(h||[]),t.lineDashOffset=u,p?(t.lineWidth=2*d,t.lineJoin=c||"round"):(t.lineWidth=d,t.lineJoin=c||"bevel");let m=e.endAngle;if(s){ab(t,e,i,o,m,n);for(let e=0;e<s;++e)t.stroke();isNaN(a)||(m=r+(a%zm||zm))}p&&function(t,e,i){const{startAngle:o,pixelMargin:n,x:s,y:r,outerRadius:a,innerRadius:l}=e;let d=n/a;t.beginPath(),t.arc(s,r,a,o-d,i+d),l>n?(d=n/l,t.arc(s,r,l,i+d,o-d,!0)):t.arc(s,r,n,i+Bm,o-Bm),t.closePath(),t.clip()}(t,e,m),s||(ab(t,e,i,o,m,n),t.stroke())}class db extends fy{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const o=this.getProps(["x","y"],i),{angle:n,distance:s}=Xm(o,{x:t,y:e}),{startAngle:r,endAngle:a,innerRadius:l,outerRadius:d,circumference:c}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),h=(this.options.spacing+this.options.borderWidth)/2,u=vm(c,a-r),p=eg(n,r,a)&&r!==a,m=u>=zm||p,g=og(s,l+h,d+h);return m&&g}getCenterPoint(t){const{x:e,y:i,startAngle:o,endAngle:n,innerRadius:s,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:a,spacing:l}=this.options,d=(o+n)/2,c=(s+r+l+a)/2;return{x:e+Math.cos(d)*c,y:i+Math.sin(d)*c}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,o=(e.offset||0)/4,n=(e.spacing||0)/2,s=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>zm?Math.floor(i/zm):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();const r=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(r)*o,Math.sin(r)*o);const a=o*(1-Math.sin(Math.min(Lm,i||0)));t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,function(t,e,i,o,n){const{fullCircles:s,startAngle:r,circumference:a}=e;let l=e.endAngle;if(s){ab(t,e,i,o,l,n);for(let e=0;e<s;++e)t.fill();isNaN(a)||(l=r+(a%zm||zm))}ab(t,e,i,o,l,n),t.fill()}(t,this,a,n,s),lb(t,this,a,n,s),t.restore()}}function cb(t,e,i=e){t.lineCap=vm(i.borderCapStyle,e.borderCapStyle),t.setLineDash(vm(i.borderDash,e.borderDash)),t.lineDashOffset=vm(i.borderDashOffset,e.borderDashOffset),t.lineJoin=vm(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=vm(i.borderWidth,e.borderWidth),t.strokeStyle=vm(i.borderColor,e.borderColor)}function hb(t,e,i){t.lineTo(i.x,i.y)}function ub(t,e,i={}){const o=t.length,{start:n=0,end:s=o-1}=i,{start:r,end:a}=e,l=Math.max(n,r),d=Math.min(s,a),c=n<r&&s<r||n>a&&s>a;return{count:o,start:l,loop:e.loop,ilen:d<l&&!c?o+d-l:d-l}}function pb(t,e,i,o){const{points:n,options:s}=e,{count:r,start:a,loop:l,ilen:d}=ub(n,i,o),c=function(t){return t.stepped?Vg:t.tension||"monotone"===t.cubicInterpolationMode?Hg:hb}(s);let h,u,p,{move:m=!0,reverse:g}=o||{};for(h=0;h<=d;++h)u=n[(a+(g?d-h:h))%r],u.skip||(m?(t.moveTo(u.x,u.y),m=!1):c(t,p,u,g,s.stepped),p=u);return l&&(u=n[(a+(g?d:0))%r],c(t,p,u,g,s.stepped)),!!l}function mb(t,e,i,o){const n=e.points,{count:s,start:r,ilen:a}=ub(n,i,o),{move:l=!0,reverse:d}=o||{};let c,h,u,p,m,g,f=0,v=0;const y=t=>(r+(d?a-t:t))%s,b=()=>{p!==m&&(t.lineTo(f,m),t.lineTo(f,p),t.lineTo(f,g))};for(l&&(h=n[y(0)],t.moveTo(h.x,h.y)),c=0;c<=a;++c){if(h=n[y(c)],h.skip)continue;const e=h.x,i=h.y,o=0|e;o===u?(i<p?p=i:i>m&&(m=i),f=(v*f+e)/++v):(b(),t.lineTo(e,i),u=o,v=0,p=m=i),g=i}b()}function gb(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?mb:pb}const fb="function"==typeof Path2D;function vb(t,e,i,o){fb&&!e.options.segment?function(t,e,i,o){let n=e._path;n||(n=e._path=new Path2D,e.path(n,i,o)&&n.closePath()),cb(t,e.options),t.stroke(n)}(t,e,i,o):function(t,e,i,o){const{segments:n,options:s}=e,r=gb(e);for(const a of n)cb(t,s,a.style),t.beginPath(),r(t,e,a,{start:i,end:i+o-1})&&t.closePath(),t.stroke()}(t,e,i,o)}class yb extends fy{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const o=i.spanGaps?this._loop:this._fullLoop;$f(this._points,i,t,o,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(t,e){const i=t.points,o=t.options.spanGaps,n=i.length;if(!n)return[];const s=!!t._loop,{start:r,end:a}=function(t,e,i,o){let n=0,s=e-1;if(i&&!o)for(;n<e&&!t[n].skip;)n++;for(;n<e&&t[n].skip;)n++;for(n%=e,i&&(s+=n);s>n&&t[s%e].skip;)s--;return s%=e,{start:n,end:s}}(i,n,s,o);return Qf(t,!0===o?[{start:r,end:a,loop:s}]:function(t,e,i,o){const n=t.length,s=[];let r,a=e,l=t[e];for(r=e+1;r<=i;++r){const i=t[r%n];i.skip||i.stop?l.skip||(o=!1,s.push({start:e%n,end:(r-1)%n,loop:o}),e=a=i.stop?r:null):(a=r,l.skip&&(e=r)),l=i}return null!==a&&s.push({start:e%n,end:a%n,loop:o}),s}(i,r,a<r?a+n:a,!!t._fullLoop&&0===r&&a===n-1),i,e)}(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,o=t[e],n=this.points,s=Xf(this,{property:e,start:o,end:o});if(!s.length)return;const r=[],a=function(t){return t.stepped?jf:t.tension||"monotone"===t.cubicInterpolationMode?Vf:Uf}(i);let l,d;for(l=0,d=s.length;l<d;++l){const{start:d,end:c}=s[l],h=n[d],u=n[c];if(h===u){r.push(h);continue}const p=a(h,u,Math.abs((o-h[e])/(u[e]-h[e])),i.stepped);p[e]=t[e],r.push(p)}return 1===r.length?r[0]:r}pathSegment(t,e,i){return gb(this)(t,this,e,i)}path(t,e,i){const o=this.segments,n=gb(this);let s=this._loop;e=e||0,i=i||this.points.length-e;for(const r of o)s&=n(t,this,r,{start:e,end:e+i-1});return!!s}draw(t,e,i,o){const n=this.options||{};(this.points||[]).length&&n.borderWidth&&(t.save(),vb(t,this,i,o),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function bb(t,e,i,o){const n=t.options,{[i]:s}=t.getProps([i],o);return Math.abs(e-s)<n.radius+n.hitRadius}class xb extends fy{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const o=this.options,{x:n,y:s}=this.getProps(["x","y"],i);return Math.pow(t-n,2)+Math.pow(e-s,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(t,e){return bb(this,t,"x",e)}inYRange(t,e){return bb(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0;e=Math.max(e,e&&t.hoverRadius||0);return 2*(e+(e&&t.borderWidth||0))}draw(t,e){const i=this.options;this.skip||i.radius<.1||!qg(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,Bg(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function _b(t,e){const{x:i,y:o,base:n,width:s,height:r}=t.getProps(["x","y","base","width","height"],e);let a,l,d,c,h;return t.horizontal?(h=r/2,a=Math.min(i,n),l=Math.max(i,n),d=o-h,c=o+h):(h=s/2,a=i-h,l=i+h,d=Math.min(o,n),c=Math.max(o,n)),{left:a,top:d,right:l,bottom:c}}function wb(t,e,i,o){return t?0:ig(e,i,o)}function kb(t){const e=_b(t),i=e.right-e.left,o=e.bottom-e.top,n=function(t,e,i){const o=t.options.borderWidth,n=t.borderSkipped,s=ef(o);return{t:wb(n.top,s.top,0,i),r:wb(n.right,s.right,0,e),b:wb(n.bottom,s.bottom,0,i),l:wb(n.left,s.left,0,e)}}(t,i/2,o/2),s=function(t,e,i){const{enableBorderRadius:o}=t.getProps(["enableBorderRadius"]),n=t.options.borderRadius,s=of(n),r=Math.min(e,i),a=t.borderSkipped,l=o||mm(n);return{topLeft:wb(!l||a.top||a.left,s.topLeft,0,r),topRight:wb(!l||a.top||a.right,s.topRight,0,r),bottomLeft:wb(!l||a.bottom||a.left,s.bottomLeft,0,r),bottomRight:wb(!l||a.bottom||a.right,s.bottomRight,0,r)}}(t,i/2,o/2);return{outer:{x:e.left,y:e.top,w:i,h:o,radius:s},inner:{x:e.left+n.l,y:e.top+n.t,w:i-n.l-n.r,h:o-n.t-n.b,radius:{topLeft:Math.max(0,s.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,s.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,s.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,s.bottomRight-Math.max(n.b,n.r))}}}}function Cb(t,e,i,o){const n=null===e,s=null===i,r=t&&!(n&&s)&&_b(t,o);return r&&(n||og(e,r.left,r.right))&&(s||og(i,r.top,r.bottom))}function Sb(t,e){t.rect(e.x,e.y,e.w,e.h)}function Ab(t,e,i={}){const o=t.x!==i.x?-e:0,n=t.y!==i.y?-e:0,s=(t.x+t.w!==i.x+i.w?e:0)-o,r=(t.y+t.h!==i.y+i.h?e:0)-n;return{x:t.x+o,y:t.y+n,w:t.w+s,h:t.h+r,radius:t.radius}}class Eb extends fy{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:o}}=this,{inner:n,outer:s}=kb(this),r=(a=s.radius).topLeft||a.topRight||a.bottomLeft||a.bottomRight?Gg:Sb;var a;t.save(),s.w===n.w&&s.h===n.h||(t.beginPath(),r(t,Ab(s,e,n)),t.clip(),r(t,Ab(n,-e,s)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),r(t,Ab(n,e)),t.fillStyle=o,t.fill(),t.restore()}inRange(t,e,i){return Cb(this,t,e,i)}inXRange(t,e){return Cb(this,t,null,e)}inYRange(t,e){return Cb(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:o,horizontal:n}=this.getProps(["x","y","base","horizontal"],t);return{x:n?(e+o)/2:e,y:n?i:(i+o)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}}var $b=Object.freeze({__proto__:null,ArcElement:db,BarElement:Eb,LineElement:yb,PointElement:xb});const Tb=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Db=Tb.map((t=>t.replace("rgb(","rgba(").replace(")",", 0.5)")));function Mb(t){return Tb[t%Tb.length]}function Ib(t){return Db[t%Db.length]}function Ob(t){let e=0;return(i,o)=>{const n=t.getDatasetMeta(o).controller;n instanceof Ev?e=function(t,e){return t.backgroundColor=t.data.map((()=>Mb(e++))),e}(i,e):n instanceof $v?e=function(t,e){return t.backgroundColor=t.data.map((()=>Ib(e++))),e}(i,e):n&&(e=function(t,e){return t.borderColor=Mb(e),t.backgroundColor=Ib(e),++e}(i,e))}}function Lb(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}var zb={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){if(!i.enabled)return;const{data:{datasets:o},options:n}=t.config,{elements:s}=n,r=Lb(o)||(a=n)&&(a.borderColor||a.backgroundColor)||s&&Lb(s)||"rgba(0,0,0,0.1)"!==Lg.borderColor||"rgba(0,0,0,0.1)"!==Lg.backgroundColor;var a;if(!i.forceOverride&&r)return;const l=Ob(t);o.forEach(l)}};function Pb(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function Rb(t){t.data.datasets.forEach((t=>{Pb(t)}))}var Nb={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void Rb(t);const o=t.width;t.data.datasets.forEach(((e,n)=>{const{_data:s,indexAxis:r}=e,a=t.getDatasetMeta(n),l=s||e.data;if("y"===rf([r,t.options.indexAxis]))return;if(!a.controller.supportsDecimation)return;const d=t.scales[a.xAxisID];if("linear"!==d.type&&"time"!==d.type)return;if(t.options.parsing)return;let{start:c,count:h}=function(t,e){const i=e.length;let o,n=0;const{iScale:s}=t,{min:r,max:a,minDefined:l,maxDefined:d}=s.getUserBounds();return l&&(n=ig(sg(e,s.axis,r).lo,0,i-1)),o=d?ig(sg(e,s.axis,a).hi+1,n,i)-n:i-n,{start:n,count:o}}(a,l);if(h<=(i.threshold||4*o))return void Pb(e);let u;switch(um(s)&&(e._data=l,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":u=function(t,e,i,o,n){const s=n.samples||o;if(s>=i)return t.slice(e,e+i);const r=[],a=(i-2)/(s-2);let l=0;const d=e+i-1;let c,h,u,p,m,g=e;for(r[l++]=t[g],c=0;c<s-2;c++){let o,n=0,s=0;const d=Math.floor((c+1)*a)+1+e,f=Math.min(Math.floor((c+2)*a)+1,i)+e,v=f-d;for(o=d;o<f;o++)n+=t[o].x,s+=t[o].y;n/=v,s/=v;const y=Math.floor(c*a)+1+e,b=Math.min(Math.floor((c+1)*a)+1,i)+e,{x:x,y:_}=t[g];for(u=p=-1,o=y;o<b;o++)p=.5*Math.abs((x-n)*(t[o].y-_)-(x-t[o].x)*(s-_)),p>u&&(u=p,h=t[o],m=o);r[l++]=h,g=m}return r[l++]=t[d],r}(l,c,h,o,i);break;case"min-max":u=function(t,e,i,o){let n,s,r,a,l,d,c,h,u,p,m=0,g=0;const f=[],v=e+i-1,y=t[e].x,b=t[v].x-y;for(n=e;n<e+i;++n){s=t[n],r=(s.x-y)/b*o,a=s.y;const e=0|r;if(e===l)a<u?(u=a,d=n):a>p&&(p=a,c=n),m=(g*m+s.x)/++g;else{const i=n-1;if(!um(d)&&!um(c)){const e=Math.min(d,c),o=Math.max(d,c);e!==h&&e!==i&&f.push({...t[e],x:m}),o!==h&&o!==i&&f.push({...t[o],x:m})}n>0&&i!==h&&f.push(t[i]),f.push(s),l=e,g=0,u=p=a,d=c=h=n}}return f}(l,c,h,o);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=u}))},destroy(t){Rb(t)}};function Bb(t,e,i,o){if(o)return;let n=e[t],s=i[t];return"angle"===t&&(n=tg(n),s=tg(s)),{property:t,start:n,end:s}}function Fb(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function qb(t,e,i,o){return t&&e?o(t[i],e[i]):t?t[i]:e?e[i]:0}function Ub(t,e){let i=[],o=!1;return pm(t)?(o=!0,i=t):i=function(t,e){const{x:i=null,y:o=null}=t||{},n=e.points,s=[];return e.segments.forEach((({start:t,end:e})=>{e=Fb(t,e,n);const r=n[t],a=n[e];null!==o?(s.push({x:r.x,y:o}),s.push({x:a.x,y:o})):null!==i&&(s.push({x:i,y:r.y}),s.push({x:i,y:a.y}))})),s}(t,e),i.length?new yb({points:i,options:{tension:0},_loop:o,_fullLoop:o}):null}function jb(t){return t&&!1!==t.fill}function Vb(t,e,i){let o=t[e].fill;const n=[e];let s;if(!i)return o;for(;!1!==o&&-1===n.indexOf(o);){if(!gm(o))return o;if(s=t[o],!s)return!1;if(s.visible)return o;n.push(o),o=s.fill}return!1}function Hb(t,e,i){const o=function(t){const e=t.options,i=e.fill;let o=vm(i&&i.target,i);void 0===o&&(o=!!e.backgroundColor);if(!1===o||null===o)return!1;if(!0===o)return"origin";return o}(t);if(mm(o))return!isNaN(o.value)&&o;let n=parseFloat(o);return gm(n)&&Math.floor(n)===n?function(t,e,i,o){"-"!==t&&"+"!==t||(i=e+i);if(i===e||i<0||i>=o)return!1;return i}(o[0],e,n,i):["origin","start","end","stack","shape"].indexOf(o)>=0&&o}function Wb(t,e,i){const o=[];for(let n=0;n<i.length;n++){const s=i[n],{first:r,last:a,point:l}=Zb(s,e,"x");if(!(!l||r&&a))if(r)o.unshift(l);else if(t.push(l),!a)break}t.push(...o)}function Zb(t,e,i){const o=t.interpolate(e,i);if(!o)return{};const n=o[i],s=t.segments,r=t.points;let a=!1,l=!1;for(let t=0;t<s.length;t++){const e=s[t],o=r[e.start][i],d=r[e.end][i];if(og(n,o,d)){a=n===o,l=n===d;break}}return{first:a,last:l,point:o}}class Yb{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:o,y:n,radius:s}=this;return e=e||{start:0,end:zm},t.arc(o,n,s,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:o}=this,n=t.angle;return{x:e+Math.cos(n)*o,y:i+Math.sin(n)*o,angle:n}}}function Gb(t){const{chart:e,fill:i,line:o}=t;if(gm(i))return function(t,e){const i=t.getDatasetMeta(e),o=i&&t.isDatasetVisible(e);return o?i.dataset:null}(e,i);if("stack"===i)return function(t){const{scale:e,index:i,line:o}=t,n=[],s=o.segments,r=o.points,a=function(t,e){const i=[],o=t.getMatchingVisibleMetas("line");for(let t=0;t<o.length;t++){const n=o[t];if(n.index===e)break;n.hidden||i.unshift(n.dataset)}return i}(e,i);a.push(Ub({x:null,y:e.bottom},o));for(let t=0;t<s.length;t++){const e=s[t];for(let t=e.start;t<=e.end;t++)Wb(n,r[t],a)}return new yb({points:n,options:{}})}(t);if("shape"===i)return!0;const n=function(t){const e=t.scale||{};if(e.getPointPositionForValue)return function(t){const{scale:e,fill:i}=t,o=e.options,n=e.getLabels().length,s=o.reverse?e.max:e.min,r=function(t,e,i){let o;return o="start"===t?i:"end"===t?e.options.reverse?e.min:e.max:mm(t)?t.value:e.getBaseValue(),o}(i,e,s),a=[];if(o.grid.circular){const t=e.getPointPositionForValue(0,s);return new Yb({x:t.x,y:t.y,radius:e.getDistanceFromCenterForValue(r)})}for(let t=0;t<n;++t)a.push(e.getPointPositionForValue(t,r));return a}(t);return function(t){const{scale:e={},fill:i}=t,o=function(t,e){let i=null;return"start"===t?i=e.bottom:"end"===t?i=e.top:mm(t)?i=e.getPixelForValue(t.value):e.getBasePixel&&(i=e.getBasePixel()),i}(i,e);if(gm(o)){const t=e.isHorizontal();return{x:t?o:null,y:t?null:o}}return null}(t)}(t);return n instanceof Yb?n:Ub(n,o)}function Kb(t,e,i){const o=Gb(e),{line:n,scale:s,axis:r}=e,a=n.options,l=a.fill,d=a.backgroundColor,{above:c=d,below:h=d}=l||{};o&&n.points.length&&(Ug(t,i),function(t,e){const{line:i,target:o,above:n,below:s,area:r,scale:a}=e,l=i._loop?"angle":e.axis;t.save(),"x"===l&&s!==n&&(Xb(t,o,r.top),Qb(t,{line:i,target:o,color:n,scale:a,property:l}),t.restore(),t.save(),Xb(t,o,r.bottom));Qb(t,{line:i,target:o,color:s,scale:a,property:l}),t.restore()}(t,{line:n,target:o,above:c,below:h,area:i,scale:s,axis:r}),jg(t))}function Xb(t,e,i){const{segments:o,points:n}=e;let s=!0,r=!1;t.beginPath();for(const a of o){const{start:o,end:l}=a,d=n[o],c=n[Fb(o,l,n)];s?(t.moveTo(d.x,d.y),s=!1):(t.lineTo(d.x,i),t.lineTo(d.x,d.y)),r=!!e.pathSegment(t,a,{move:r}),r?t.closePath():t.lineTo(c.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function Qb(t,e){const{line:i,target:o,property:n,color:s,scale:r}=e,a=function(t,e,i){const o=t.segments,n=t.points,s=e.points,r=[];for(const t of o){let{start:o,end:a}=t;a=Fb(o,a,n);const l=Bb(i,n[o],n[a],t.loop);if(!e.segments){r.push({source:t,target:l,start:n[o],end:n[a]});continue}const d=Xf(e,l);for(const e of d){const o=Bb(i,s[e.start],s[e.end],e.loop),a=Kf(t,n,o);for(const t of a)r.push({source:t,target:e,start:{[i]:qb(l,o,"start",Math.max)},end:{[i]:qb(l,o,"end",Math.min)}})}}return r}(i,o,n);for(const{source:e,target:l,start:d,end:c}of a){const{style:{backgroundColor:a=s}={}}=e,h=!0!==o;t.save(),t.fillStyle=a,Jb(t,r,h&&Bb(n,d,c)),t.beginPath();const u=!!i.pathSegment(t,e);let p;if(h){u?t.closePath():tx(t,o,c,n);const e=!!o.pathSegment(t,l,{move:u,reverse:!0});p=u&&e,p||tx(t,o,d,n)}t.closePath(),t.fill(p?"evenodd":"nonzero"),t.restore()}}function Jb(t,e,i){const{top:o,bottom:n}=e.chart.chartArea,{property:s,start:r,end:a}=i||{};"x"===s&&(t.beginPath(),t.rect(r,o,a-r,n-o),t.clip())}function tx(t,e,i,o){const n=e.interpolate(i,o);n&&t.lineTo(n.x,n.y)}var ex={id:"filler",afterDatasetsUpdate(t,e,i){const o=(t.data.datasets||[]).length,n=[];let s,r,a,l;for(r=0;r<o;++r)s=t.getDatasetMeta(r),a=s.dataset,l=null,a&&a.options&&a instanceof yb&&(l={visible:t.isDatasetVisible(r),index:r,fill:Hb(a,r,o),chart:t,axis:s.controller.options.indexAxis,scale:s.vScale,line:a}),s.$filler=l,n.push(l);for(r=0;r<o;++r)l=n[r],l&&!1!==l.fill&&(l.fill=Vb(n,r,i.propagate))},beforeDraw(t,e,i){const o="beforeDraw"===i.drawTime,n=t.getSortedVisibleDatasetMetas(),s=t.chartArea;for(let e=n.length-1;e>=0;--e){const i=n[e].$filler;i&&(i.line.updateControlPoints(s,i.axis),o&&i.fill&&Kb(t.ctx,i,s))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const o=t.getSortedVisibleDatasetMetas();for(let e=o.length-1;e>=0;--e){const i=o[e].$filler;jb(i)&&Kb(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const o=e.meta.$filler;jb(o)&&"beforeDatasetDraw"===i.drawTime&&Kb(t.ctx,o,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const ix=(t,e)=>{let{boxHeight:i=e,boxWidth:o=e}=t;return t.usePointStyle&&(i=Math.min(i,e),o=t.pointStyleWidth||Math.min(o,e)),{boxWidth:o,boxHeight:i,itemHeight:Math.max(e,i)}};class ox extends fy{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=bm(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,o=sf(i.font),n=o.size,s=this._computeTitleHeight(),{boxWidth:r,itemHeight:a}=ix(i,n);let l,d;e.font=o.string,this.isHorizontal()?(l=this.maxWidth,d=this._fitRows(s,n,r,a)+10):(d=this.maxHeight,l=this._fitCols(s,o,r,a)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(d,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,o){const{ctx:n,maxWidth:s,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],l=this.lineWidths=[0],d=o+r;let c=t;n.textAlign="left",n.textBaseline="middle";let h=-1,u=-d;return this.legendItems.forEach(((t,p)=>{const m=i+e/2+n.measureText(t.text).width;(0===p||l[l.length-1]+m+2*r>s)&&(c+=d,l[l.length-(p>0?0:1)]=0,u+=d,h++),a[p]={left:0,top:u,row:h,width:m,height:o},l[l.length-1]+=m+r})),c}_fitCols(t,e,i,o){const{ctx:n,maxHeight:s,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],l=this.columnSizes=[],d=s-t;let c=r,h=0,u=0,p=0,m=0;return this.legendItems.forEach(((t,s)=>{const{itemWidth:g,itemHeight:f}=function(t,e,i,o,n){const s=function(t,e,i,o){let n=t.text;n&&"string"!=typeof n&&(n=n.reduce(((t,e)=>t.length>e.length?t:e)));return e+i.size/2+o.measureText(n).width}(o,t,e,i),r=function(t,e,i){let o=t;"string"!=typeof e.text&&(o=nx(e,i));return o}(n,o,e.lineHeight);return{itemWidth:s,itemHeight:r}}(i,e,n,t,o);s>0&&u+f+2*r>d&&(c+=h+r,l.push({width:h,height:u}),p+=h+r,m++,h=u=0),a[s]={left:p,top:u,col:m,width:g,height:f},h=Math.max(h,g),u+=f+r})),c+=h,l.push({width:h,height:u}),c}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:o},rtl:n}}=this,s=Hf(n,this.left,this.width);if(this.isHorizontal()){let n=0,r=pg(i,this.left+o,this.right-this.lineWidths[n]);for(const a of e)n!==a.row&&(n=a.row,r=pg(i,this.left+o,this.right-this.lineWidths[n])),a.top+=this.top+t+o,a.left=s.leftForLtr(s.x(r),a.width),r+=a.width+o}else{let n=0,r=pg(i,this.top+t+o,this.bottom-this.columnSizes[n].height);for(const a of e)a.col!==n&&(n=a.col,r=pg(i,this.top+t+o,this.bottom-this.columnSizes[n].height)),a.top=r,a.left+=this.left+o,a.left=s.leftForLtr(s.x(a.left),a.width),r+=a.height+o}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;Ug(t,this),this._draw(),jg(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:o}=this,{align:n,labels:s}=t,r=Lg.color,a=Hf(t.rtl,this.left,this.width),l=sf(s.font),{padding:d}=s,c=l.size,h=c/2;let u;this.drawTitle(),o.textAlign=a.textAlign("left"),o.textBaseline="middle",o.lineWidth=.5,o.font=l.string;const{boxWidth:p,boxHeight:m,itemHeight:g}=ix(s,c),f=this.isHorizontal(),v=this._computeTitleHeight();u=f?{x:pg(n,this.left+d,this.right-i[0]),y:this.top+d+v,line:0}:{x:this.left+d,y:pg(n,this.top+v+d,this.bottom-e[0].height),line:0},Wf(this.ctx,t.textDirection);const y=g+d;this.legendItems.forEach(((b,x)=>{o.strokeStyle=b.fontColor,o.fillStyle=b.fontColor;const _=o.measureText(b.text).width,w=a.textAlign(b.textAlign||(b.textAlign=s.textAlign)),k=p+h+_;let C=u.x,S=u.y;a.setWidth(this.width),f?x>0&&C+k+d>this.right&&(S=u.y+=y,u.line++,C=u.x=pg(n,this.left+d,this.right-i[u.line])):x>0&&S+y>this.bottom&&(C=u.x=C+e[u.line].width+d,u.line++,S=u.y=pg(n,this.top+v+d,this.bottom-e[u.line].height));if(function(t,e,i){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;o.save();const n=vm(i.lineWidth,1);if(o.fillStyle=vm(i.fillStyle,r),o.lineCap=vm(i.lineCap,"butt"),o.lineDashOffset=vm(i.lineDashOffset,0),o.lineJoin=vm(i.lineJoin,"miter"),o.lineWidth=n,o.strokeStyle=vm(i.strokeStyle,r),o.setLineDash(vm(i.lineDash,[])),s.usePointStyle){const r={radius:m*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:n},l=a.xPlus(t,p/2);Fg(o,r,l,e+h,s.pointStyleWidth&&p)}else{const s=e+Math.max((c-m)/2,0),r=a.leftForLtr(t,p),l=of(i.borderRadius);o.beginPath(),Object.values(l).some((t=>0!==t))?Gg(o,{x:r,y:s,w:p,h:m,radius:l}):o.rect(r,s,p,m),o.fill(),0!==n&&o.stroke()}o.restore()}(a.x(C),S,b),C=((t,e,i,o)=>t===(o?"left":"right")?i:"center"===t?(e+i)/2:e)(w,C+p+h,f?C+k:this.right,t.rtl),function(t,e,i){Yg(o,i.text,t,e+g/2,l,{strikethrough:i.hidden,textAlign:a.textAlign(i.textAlign)})}(a.x(C),S,b),f)u.x+=k+d;else if("string"!=typeof b.text){const t=l.lineHeight;u.y+=nx(b,t)+d}else u.y+=y})),Zf(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=sf(e.font),o=nf(e.padding);if(!e.display)return;const n=Hf(t.rtl,this.left,this.width),s=this.ctx,r=e.position,a=i.size/2,l=o.top+a;let d,c=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),d=this.top+l,c=pg(t.align,c,this.right-h);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);d=l+pg(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=pg(r,c,c+h);s.textAlign=n.textAlign(ug(r)),s.textBaseline="middle",s.strokeStyle=e.color,s.fillStyle=e.color,s.font=i.string,Yg(s,e.text,u,d,i)}_computeTitleHeight(){const t=this.options.title,e=sf(t.font),i=nf(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,o,n;if(og(t,this.left,this.right)&&og(e,this.top,this.bottom))for(n=this.legendHitBoxes,i=0;i<n.length;++i)if(o=n[i],og(t,o.left,o.left+o.width)&&og(e,o.top,o.top+o.height))return this.legendItems[i];return null}handleEvent(t){const e=this.options;if(!function(t,e){if(("mousemove"===t||"mouseout"===t)&&(e.onHover||e.onLeave))return!0;if(e.onClick&&("click"===t||"mouseup"===t))return!0;return!1}(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const o=this._hoveredItem,n=((t,e)=>null!==t&&null!==e&&t.datasetIndex===e.datasetIndex&&t.index===e.index)(o,i);o&&!n&&bm(e.onLeave,[t,o,this],this),this._hoveredItem=i,i&&!n&&bm(e.onHover,[t,i,this],this)}else i&&bm(e.onClick,[t,i,this],this)}}function nx(t,e){return e*(t.text?t.text.length:0)}var sx={id:"legend",_element:ox,start(t,e,i){const o=t.legend=new ox({ctx:t.ctx,options:i,chart:t});Qv.configure(t,o,i),Qv.addBox(t,o)},stop(t){Qv.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const o=t.legend;Qv.configure(t,o,i),o.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const o=e.datasetIndex,n=i.chart;n.isDatasetVisible(o)?(n.hide(o),e.hidden=!0):(n.show(o),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:o,textAlign:n,color:s,useBorderRadius:r,borderRadius:a}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const l=t.controller.getStyle(i?0:void 0),d=nf(l.borderWidth);return{text:e[t.index].label,fillStyle:l.backgroundColor,fontColor:s,hidden:!t.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:l.borderColor,pointStyle:o||l.pointStyle,rotation:l.rotation,textAlign:n||l.textAlign,borderRadius:r&&(a||l.borderRadius),datasetIndex:t.index}}),this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class rx extends fy{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const o=pm(i.text)?i.text.length:1;this._padding=nf(i.padding);const n=o*sf(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=n:this.width=n}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:o,right:n,options:s}=this,r=s.align;let a,l,d,c=0;return this.isHorizontal()?(l=pg(r,i,n),d=e+t,a=n-i):("left"===s.position?(l=i+t,d=pg(r,o,e),c=-.5*Lm):(l=n-t,d=pg(r,e,o),c=.5*Lm),a=o-e),{titleX:l,titleY:d,maxWidth:a,rotation:c}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=sf(e.font),o=i.lineHeight/2+this._padding.top,{titleX:n,titleY:s,maxWidth:r,rotation:a}=this._drawArgs(o);Yg(t,e.text,0,0,i,{color:e.color,maxWidth:r,rotation:a,textAlign:ug(e.align),textBaseline:"middle",translation:[n,s]})}}var ax={id:"title",_element:rx,start(t,e,i){!function(t,e){const i=new rx({ctx:t.ctx,options:e,chart:t});Qv.configure(t,i,e),Qv.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;Qv.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const o=t.titleBlock;Qv.configure(t,o,i),o.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const lx=new WeakMap;var dx={id:"subtitle",start(t,e,i){const o=new rx({ctx:t.ctx,options:i,chart:t});Qv.configure(t,o,i),Qv.addBox(t,o),lx.set(t,o)},stop(t){Qv.removeBox(t,lx.get(t)),lx.delete(t)},beforeUpdate(t,e,i){const o=lx.get(t);Qv.configure(t,o,i),o.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const cx={average(t){if(!t.length)return!1;let e,i,o=new Set,n=0,s=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();o.add(t.x),n+=t.y,++s}}if(0===s||0===o.size)return!1;const r=[...o].reduce(((t,e)=>t+e))/o.size;return{x:r,y:n/s}},nearest(t,e){if(!t.length)return!1;let i,o,n,s=e.x,r=e.y,a=Number.POSITIVE_INFINITY;for(i=0,o=t.length;i<o;++i){const o=t[i].element;if(o&&o.hasValue()){const t=Qm(e,o.getCenterPoint());t<a&&(a=t,n=o)}}if(n){const t=n.tooltipPosition();s=t.x,r=t.y}return{x:s,y:r}}};function hx(t,e){return e&&(pm(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function ux(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function px(t,e){const{element:i,datasetIndex:o,index:n}=e,s=t.getDatasetMeta(o).controller,{label:r,value:a}=s.getLabelAndValue(n);return{chart:t,label:r,parsed:s.getParsed(n),raw:t.data.datasets[o].data[n],formattedValue:a,dataset:s.getDataset(),dataIndex:n,datasetIndex:o,element:i}}function mx(t,e){const i=t.chart.ctx,{body:o,footer:n,title:s}=t,{boxWidth:r,boxHeight:a}=e,l=sf(e.bodyFont),d=sf(e.titleFont),c=sf(e.footerFont),h=s.length,u=n.length,p=o.length,m=nf(e.padding);let g=m.height,f=0,v=o.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(v+=t.beforeBody.length+t.afterBody.length,h&&(g+=h*d.lineHeight+(h-1)*e.titleSpacing+e.titleMarginBottom),v){g+=p*(e.displayColors?Math.max(a,l.lineHeight):l.lineHeight)+(v-p)*l.lineHeight+(v-1)*e.bodySpacing}u&&(g+=e.footerMarginTop+u*c.lineHeight+(u-1)*e.footerSpacing);let y=0;const b=function(t){f=Math.max(f,i.measureText(t).width+y)};return i.save(),i.font=d.string,xm(t.title,b),i.font=l.string,xm(t.beforeBody.concat(t.afterBody),b),y=e.displayColors?r+2+e.boxPadding:0,xm(o,(t=>{xm(t.before,b),xm(t.lines,b),xm(t.after,b)})),y=0,i.font=c.string,xm(t.footer,b),i.restore(),f+=m.width,{width:f,height:g}}function gx(t,e,i,o){const{x:n,width:s}=i,{width:r,chartArea:{left:a,right:l}}=t;let d="center";return"center"===o?d=n<=(a+l)/2?"left":"right":n<=s/2?d="left":n>=r-s/2&&(d="right"),function(t,e,i,o){const{x:n,width:s}=o,r=i.caretSize+i.caretPadding;return"left"===t&&n+s+r>e.width||"right"===t&&n-s-r<0||void 0}(d,t,e,i)&&(d="center"),d}function fx(t,e,i){const o=i.yAlign||e.yAlign||function(t,e){const{y:i,height:o}=e;return i<o/2?"top":i>t.height-o/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||gx(t,e,i,o),yAlign:o}}function vx(t,e,i,o){const{caretSize:n,caretPadding:s,cornerRadius:r}=t,{xAlign:a,yAlign:l}=i,d=n+s,{topLeft:c,topRight:h,bottomLeft:u,bottomRight:p}=of(r);let m=function(t,e){let{x:i,width:o}=t;return"right"===e?i-=o:"center"===e&&(i-=o/2),i}(e,a);const g=function(t,e,i){let{y:o,height:n}=t;return"top"===e?o+=i:o-="bottom"===e?n+i:n/2,o}(e,l,d);return"center"===l?"left"===a?m+=d:"right"===a&&(m-=d):"left"===a?m-=Math.max(c,u)+n:"right"===a&&(m+=Math.max(h,p)+n),{x:ig(m,0,o.width-e.width),y:ig(g,0,o.height-e.height)}}function yx(t,e,i){const o=nf(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-o.right:t.x+o.left}function bx(t){return hx([],ux(t))}function xx(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}const _x={beforeTitle:cm,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,o=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(o>0&&e.dataIndex<o)return i[e.dataIndex]}return""},afterTitle:cm,beforeBody:cm,beforeLabel:cm,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return um(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:cm,afterBody:cm,beforeFooter:cm,footer:cm,afterFooter:cm};function wx(t,e,i,o){const n=t[e].call(i,o);return void 0===n?_x[e].call(i,o):n}class kx extends fy{static positioners=cx;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),o=i.enabled&&e.options.animation&&i.animations,n=new rv(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(n)),n}getContext(){return this.$context||(this.$context=(t=this.chart.getContext(),e=this,i=this._tooltipItems,af(t,{tooltip:e,tooltipItems:i,type:"tooltip"})));var t,e,i}getTitle(t,e){const{callbacks:i}=e,o=wx(i,"beforeTitle",this,t),n=wx(i,"title",this,t),s=wx(i,"afterTitle",this,t);let r=[];return r=hx(r,ux(o)),r=hx(r,ux(n)),r=hx(r,ux(s)),r}getBeforeBody(t,e){return bx(wx(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,o=[];return xm(t,(t=>{const e={before:[],lines:[],after:[]},n=xx(i,t);hx(e.before,ux(wx(n,"beforeLabel",this,t))),hx(e.lines,wx(n,"label",this,t)),hx(e.after,ux(wx(n,"afterLabel",this,t))),o.push(e)})),o}getAfterBody(t,e){return bx(wx(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,o=wx(i,"beforeFooter",this,t),n=wx(i,"footer",this,t),s=wx(i,"afterFooter",this,t);let r=[];return r=hx(r,ux(o)),r=hx(r,ux(n)),r=hx(r,ux(s)),r}_createItems(t){const e=this._active,i=this.chart.data,o=[],n=[],s=[];let r,a,l=[];for(r=0,a=e.length;r<a;++r)l.push(px(this.chart,e[r]));return t.filter&&(l=l.filter(((e,o,n)=>t.filter(e,o,n,i)))),t.itemSort&&(l=l.sort(((e,o)=>t.itemSort(e,o,i)))),xm(l,(e=>{const i=xx(t.callbacks,e);o.push(wx(i,"labelColor",this,e)),n.push(wx(i,"labelPointStyle",this,e)),s.push(wx(i,"labelTextColor",this,e))})),this.labelColors=o,this.labelPointStyles=n,this.labelTextColors=s,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),o=this._active;let n,s=[];if(o.length){const t=cx[i.position].call(this,o,this._eventPosition);s=this._createItems(i),this.title=this.getTitle(s,i),this.beforeBody=this.getBeforeBody(s,i),this.body=this.getBody(s,i),this.afterBody=this.getAfterBody(s,i),this.footer=this.getFooter(s,i);const e=this._size=mx(this,i),r=Object.assign({},t,e),a=fx(this.chart,i,r),l=vx(i,r,a,this.chart);this.xAlign=a.xAlign,this.yAlign=a.yAlign,n={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=s,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,o){const n=this.getCaretPosition(t,i,o);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,i){const{xAlign:o,yAlign:n}=this,{caretSize:s,cornerRadius:r}=i,{topLeft:a,topRight:l,bottomLeft:d,bottomRight:c}=of(r),{x:h,y:u}=t,{width:p,height:m}=e;let g,f,v,y,b,x;return"center"===n?(b=u+m/2,"left"===o?(g=h,f=g-s,y=b+s,x=b-s):(g=h+p,f=g+s,y=b-s,x=b+s),v=g):(f="left"===o?h+Math.max(a,d)+s:"right"===o?h+p-Math.max(l,c)-s:this.caretX,"top"===n?(y=u,b=y-s,g=f-s,v=f+s):(y=u+m,b=y+s,g=f+s,v=f-s),x=y),{x1:g,x2:f,x3:v,y1:y,y2:b,y3:x}}drawTitle(t,e,i){const o=this.title,n=o.length;let s,r,a;if(n){const l=Hf(i.rtl,this.x,this.width);for(t.x=yx(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",s=sf(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=s.string,a=0;a<n;++a)e.fillText(o[a],l.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+r,a+1===n&&(t.y+=i.titleMarginBottom-r)}}_drawColorBox(t,e,i,o,n){const s=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:a,boxWidth:l}=n,d=sf(n.bodyFont),c=yx(this,"left",n),h=o.x(c),u=a<d.lineHeight?(d.lineHeight-a)/2:0,p=e.y+u;if(n.usePointStyle){const e={radius:Math.min(l,a)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},i=o.leftForLtr(h,l)+l/2,d=p+a/2;t.strokeStyle=n.multiKeyBackground,t.fillStyle=n.multiKeyBackground,Bg(t,e,i,d),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,Bg(t,e,i,d)}else{t.lineWidth=mm(s.borderWidth)?Math.max(...Object.values(s.borderWidth)):s.borderWidth||1,t.strokeStyle=s.borderColor,t.setLineDash(s.borderDash||[]),t.lineDashOffset=s.borderDashOffset||0;const e=o.leftForLtr(h,l),i=o.leftForLtr(o.xPlus(h,1),l-2),r=of(s.borderRadius);Object.values(r).some((t=>0!==t))?(t.beginPath(),t.fillStyle=n.multiKeyBackground,Gg(t,{x:e,y:p,w:l,h:a,radius:r}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),Gg(t,{x:i,y:p+1,w:l-2,h:a-2,radius:r}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(e,p,l,a),t.strokeRect(e,p,l,a),t.fillStyle=s.backgroundColor,t.fillRect(i,p+1,l-2,a-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:o}=this,{bodySpacing:n,bodyAlign:s,displayColors:r,boxHeight:a,boxWidth:l,boxPadding:d}=i,c=sf(i.bodyFont);let h=c.lineHeight,u=0;const p=Hf(i.rtl,this.x,this.width),m=function(i){e.fillText(i,p.x(t.x+u),t.y+h/2),t.y+=h+n},g=p.textAlign(s);let f,v,y,b,x,_,w;for(e.textAlign=s,e.textBaseline="middle",e.font=c.string,t.x=yx(this,g,i),e.fillStyle=i.bodyColor,xm(this.beforeBody,m),u=r&&"right"!==g?"center"===s?l/2+d:l+2+d:0,b=0,_=o.length;b<_;++b){for(f=o[b],v=this.labelTextColors[b],e.fillStyle=v,xm(f.before,m),y=f.lines,r&&y.length&&(this._drawColorBox(e,t,b,p,i),h=Math.max(c.lineHeight,a)),x=0,w=y.length;x<w;++x)m(y[x]),h=c.lineHeight;xm(f.after,m)}u=0,h=c.lineHeight,xm(this.afterBody,m),t.y-=n}drawFooter(t,e,i){const o=this.footer,n=o.length;let s,r;if(n){const a=Hf(i.rtl,this.x,this.width);for(t.x=yx(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=a.textAlign(i.footerAlign),e.textBaseline="middle",s=sf(i.footerFont),e.fillStyle=i.footerColor,e.font=s.string,r=0;r<n;++r)e.fillText(o[r],a.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+i.footerSpacing}}drawBackground(t,e,i,o){const{xAlign:n,yAlign:s}=this,{x:r,y:a}=t,{width:l,height:d}=i,{topLeft:c,topRight:h,bottomLeft:u,bottomRight:p}=of(o.cornerRadius);e.fillStyle=o.backgroundColor,e.strokeStyle=o.borderColor,e.lineWidth=o.borderWidth,e.beginPath(),e.moveTo(r+c,a),"top"===s&&this.drawCaret(t,e,i,o),e.lineTo(r+l-h,a),e.quadraticCurveTo(r+l,a,r+l,a+h),"center"===s&&"right"===n&&this.drawCaret(t,e,i,o),e.lineTo(r+l,a+d-p),e.quadraticCurveTo(r+l,a+d,r+l-p,a+d),"bottom"===s&&this.drawCaret(t,e,i,o),e.lineTo(r+u,a+d),e.quadraticCurveTo(r,a+d,r,a+d-u),"center"===s&&"left"===n&&this.drawCaret(t,e,i,o),e.lineTo(r,a+c),e.quadraticCurveTo(r,a,r+c,a),e.closePath(),e.fill(),o.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,o=i&&i.x,n=i&&i.y;if(o||n){const i=cx[t.position].call(this,this._active,this._eventPosition);if(!i)return;const s=this._size=mx(this,t),r=Object.assign({},i,this._size),a=fx(e,t,r),l=vx(t,r,a,e);o._to===l.x&&n._to===l.y||(this.xAlign=a.xAlign,this.yAlign=a.yAlign,this.width=s.width,this.height=s.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const o={width:this.width,height:this.height},n={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const s=nf(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,o,e),Wf(t,e.textDirection),n.y+=s.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),Zf(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,o=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),n=!_m(i,o),s=this._positionChanged(o,e);(n||s)&&(this._active=o,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const o=this.options,n=this._active||[],s=this._getActiveElements(t,n,e,i),r=this._positionChanged(s,t),a=e||!_m(s,n)||r;return a&&(this._active=s,(o.enabled||o.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),a}_getActiveElements(t,e,i,o){const n=this.options;if("mouseout"===t.type)return[];if(!o)return e.filter((t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index)));const s=this.chart.getElementsAtEventForMode(t,n.mode,n,i);return n.reverse&&s.reverse(),s}_positionChanged(t,e){const{caretX:i,caretY:o,options:n}=this,s=cx[n.position].call(this,t,e);return!1!==s&&(i!==s.x||o!==s.y)}}var Cx={id:"tooltip",_element:kx,positioners:cx,afterInit(t,e,i){i&&(t.tooltip=new kx({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:_x},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Sx=Object.freeze({__proto__:null,Colors:zb,Decimation:Nb,Filler:ex,Legend:sx,SubTitle:dx,Title:ax,Tooltip:Cx});function Ax(t,e,i,o){const n=t.indexOf(e);if(-1===n)return((t,e,i,o)=>("string"==typeof e?(i=t.push(e)-1,o.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,o);return n!==t.lastIndexOf(e)?i:n}function Ex(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}function $x(t,e){const i=[],{bounds:o,step:n,min:s,max:r,precision:a,count:l,maxTicks:d,maxDigits:c,includeBounds:h}=t,u=n||1,p=d-1,{min:m,max:g}=e,f=!um(s),v=!um(r),y=!um(l),b=(g-m)/(c+1);let x,_,w,k,C=Hm((g-m)/p/u)*u;if(C<1e-14&&!f&&!v)return[{value:m},{value:g}];k=Math.ceil(g/C)-Math.floor(m/C),k>p&&(C=Hm(k*C/p/u)*u),um(a)||(x=Math.pow(10,a),C=Math.ceil(C*x)/x),"ticks"===o?(_=Math.floor(m/C)*C,w=Math.ceil(g/C)*C):(_=m,w=g),f&&v&&n&&function(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}((r-s)/n,C/1e3)?(k=Math.round(Math.min((r-s)/C,d)),C=(r-s)/k,_=s,w=r):y?(_=f?s:_,w=v?r:w,k=l-1,C=(w-_)/k):(k=(w-_)/C,k=Vm(k,Math.round(k),C/1e3)?Math.round(k):Math.ceil(k));const S=Math.max(Km(C),Km(_));x=Math.pow(10,um(a)?S:a),_=Math.round(_*x)/x,w=Math.round(w*x)/x;let A=0;for(f&&(h&&_!==s?(i.push({value:s}),_<s&&A++,Vm(Math.round((_+A*C)*x)/x,s,Tx(s,b,t))&&A++):_<s&&A++);A<k;++A){const t=Math.round((_+A*C)*x)/x;if(v&&t>r)break;i.push({value:t})}return v&&h&&w!==r?i.length&&Vm(i[i.length-1].value,r,Tx(r,b,t))?i[i.length-1].value=r:i.push({value:r}):v&&w!==r||i.push({value:w}),i}function Tx(t,e,{horizontal:i,minRotation:o}){const n=Ym(o),s=(i?Math.sin(n):Math.cos(n))||.001,r=.75*e*(""+t).length;return Math.min(e/s,r)}class Dx extends Ay{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return um(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:o,max:n}=this;const s=t=>o=e?o:t,r=t=>n=i?n:t;if(t){const t=jm(o),e=jm(n);t<0&&e<0?r(0):t>0&&e>0&&s(0)}if(o===n){let e=0===n?1:Math.abs(.05*n);r(n+e),t||s(o-e)}this.min=o,this.max=n}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:o}=t;return o?(e=Math.ceil(this.max/o)-Math.floor(this.min/o)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${o} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const o=$x({maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&Zm(o,this,"value"),t.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const o=(i-e)/Math.max(t.length-1,1)/2;e-=o,i+=o}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return Ag(t,this.chart.options.locale,this.options.ticks.format)}}class Mx extends Dx{static id="linear";static defaults={ticks:{callback:$g.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=gm(t)?t:0,this.max=gm(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=Ym(this.options.ticks.minRotation),o=(t?Math.sin(i):Math.cos(i))||.001,n=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,n.lineHeight/o))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const Ix=t=>Math.floor(Um(t)),Ox=(t,e)=>Math.pow(10,Ix(t)+e);function Lx(t){return 1===t/Math.pow(10,Ix(t))}function zx(t,e,i){const o=Math.pow(10,i),n=Math.floor(t/o);return Math.ceil(e/o)-n}function Px(t,{min:e,max:i}){e=fm(t.min,e);const o=[],n=Ix(e);let s=function(t,e){let i=Ix(e-t);for(;zx(t,e,i)>10;)i++;for(;zx(t,e,i)<10;)i--;return Math.min(i,Ix(t))}(e,i),r=s<0?Math.pow(10,Math.abs(s)):1;const a=Math.pow(10,s),l=n>s?Math.pow(10,n):0,d=Math.round((e-l)*r)/r,c=Math.floor((e-l)/a/10)*a*10;let h=Math.floor((d-c)/Math.pow(10,s)),u=fm(t.min,Math.round((l+c+h*Math.pow(10,s))*r)/r);for(;u<i;)o.push({value:u,major:Lx(u),significand:h}),h>=10?h=h<15?15:20:h++,h>=20&&(s++,h=2,r=s>=0?1:r),u=Math.round((l+c+h*Math.pow(10,s))*r)/r;const p=fm(t.max,u);return o.push({value:p,major:Lx(p),significand:h}),o}class Rx extends Ay{static id="logarithmic";static defaults={ticks:{callback:$g.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=Dx.prototype.parse.apply(this,[t,e]);if(0!==i)return gm(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=gm(t)?Math.max(0,t):null,this.max=gm(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!gm(this._userMin)&&(this.min=t===Ox(this.min,0)?Ox(this.min,-1):Ox(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,o=this.max;const n=e=>i=t?i:e,s=t=>o=e?o:t;i===o&&(i<=0?(n(1),s(10)):(n(Ox(i,-1)),s(Ox(o,1)))),i<=0&&n(Ox(o,-1)),o<=0&&s(Ox(i,1)),this.min=i,this.max=o}buildTicks(){const t=this.options,e=Px({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&Zm(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":Ag(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Um(t),this._valueRange=Um(this.max)-Um(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Um(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function Nx(t){const e=t.ticks;if(e.display&&t.display){const t=nf(e.backdropPadding);return vm(e.font&&e.font.size,Lg.font.size)+t.height}return 0}function Bx(t,e,i,o,n){return t===o||t===n?{start:e-i/2,end:e+i/2}:t<o||t>n?{start:e-i,end:e}:{start:e,end:e+i}}function Fx(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),o=[],n=[],s=t._pointLabels.length,r=t.options.pointLabels,a=r.centerPointLabels?Lm/s:0;for(let h=0;h<s;h++){const s=r.setContext(t.getPointLabelContext(h));n[h]=s.padding;const u=t.getPointPosition(h,t.drawingArea+n[h],a),p=sf(s.font),m=(l=t.ctx,d=p,c=pm(c=t._pointLabels[h])?c:[c],{w:Pg(l,d.string,c),h:c.length*d.lineHeight});o[h]=m;const g=tg(t.getIndexAngle(h)+a),f=Math.round(Gm(g));qx(i,e,g,Bx(f,u.x,m.w,0,180),Bx(f,u.y,m.h,90,270))}var l,d,c;t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=function(t,e,i){const o=[],n=t._pointLabels.length,s=t.options,{centerPointLabels:r,display:a}=s.pointLabels,l={extra:Nx(s)/2,additionalAngle:r?Lm/n:0};let d;for(let s=0;s<n;s++){l.padding=i[s],l.size=e[s];const n=Ux(t,s,l);o.push(n),"auto"===a&&(n.visible=jx(n,d),n.visible&&(d=n))}return o}(t,o,n)}function qx(t,e,i,o,n){const s=Math.abs(Math.sin(i)),r=Math.abs(Math.cos(i));let a=0,l=0;o.start<e.l?(a=(e.l-o.start)/s,t.l=Math.min(t.l,e.l-a)):o.end>e.r&&(a=(o.end-e.r)/s,t.r=Math.max(t.r,e.r+a)),n.start<e.t?(l=(e.t-n.start)/r,t.t=Math.min(t.t,e.t-l)):n.end>e.b&&(l=(n.end-e.b)/r,t.b=Math.max(t.b,e.b+l))}function Ux(t,e,i){const o=t.drawingArea,{extra:n,additionalAngle:s,padding:r,size:a}=i,l=t.getPointPosition(e,o+n+r,s),d=Math.round(Gm(tg(l.angle+Bm))),c=function(t,e,i){90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e);return t}(l.y,a.h,d),h=function(t){if(0===t||180===t)return"center";if(t<180)return"left";return"right"}(d),u=function(t,e,i){"right"===i?t-=e:"center"===i&&(t-=e/2);return t}(l.x,a.w,h);return{visible:!0,x:l.x,y:c,textAlign:h,left:u,top:c,right:u+a.w,bottom:c+a.h}}function jx(t,e){if(!e)return!0;const{left:i,top:o,right:n,bottom:s}=t;return!(qg({x:i,y:o},e)||qg({x:i,y:s},e)||qg({x:n,y:o},e)||qg({x:n,y:s},e))}function Vx(t,e,i){const{left:o,top:n,right:s,bottom:r}=i,{backdropColor:a}=e;if(!um(a)){const i=of(e.borderRadius),l=nf(e.backdropPadding);t.fillStyle=a;const d=o-l.left,c=n-l.top,h=s-o+l.width,u=r-n+l.height;Object.values(i).some((t=>0!==t))?(t.beginPath(),Gg(t,{x:d,y:c,w:h,h:u,radius:i}),t.fill()):t.fillRect(d,c,h,u)}}function Hx(t,e,i,o){const{ctx:n}=t;if(i)n.arc(t.xCenter,t.yCenter,e,0,zm);else{let i=t.getPointPosition(0,e);n.moveTo(i.x,i.y);for(let s=1;s<o;s++)i=t.getPointPosition(s,e),n.lineTo(i.x,i.y)}}class Wx extends Dx{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:$g.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=nf(Nx(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=gm(t)&&!isNaN(t)?t:0,this.max=gm(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Nx(this.options))}generateTickLabels(t){Dx.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map(((t,e)=>{const i=bm(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})).filter(((t,e)=>this.chart.getDataVisibility(e)))}fit(){const t=this.options;t.display&&t.pointLabels.display?Fx(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,o){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-o)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,o))}getIndexAngle(t){return tg(t*(zm/(this._pointLabels.length||1))+Ym(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(um(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(um(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return function(t,e,i){return af(t,{label:i,index:e,type:"pointLabel"})}(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const o=this.getIndexAngle(t)-Bm+i;return{x:Math.cos(o)*e+this.xCenter,y:Math.sin(o)*e+this.yCenter,angle:o}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:o,bottom:n}=this._pointLabelItems[t];return{left:e,top:i,right:o,bottom:n}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),Hx(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:o,border:n}=e,s=this._pointLabels.length;let r,a,l;if(e.pointLabels.display&&function(t,e){const{ctx:i,options:{pointLabels:o}}=t;for(let n=e-1;n>=0;n--){const e=t._pointLabelItems[n];if(!e.visible)continue;const s=o.setContext(t.getPointLabelContext(n));Vx(i,s,e);const r=sf(s.font),{x:a,y:l,textAlign:d}=e;Yg(i,t._pointLabels[n],a,l+r.lineHeight/2,r,{color:s.color,textAlign:d,textBaseline:"middle"})}}(this,s),o.display&&this.ticks.forEach(((t,e)=>{if(0!==e||0===e&&this.min<0){a=this.getDistanceFromCenterForValue(t.value);const i=this.getContext(e),r=o.setContext(i),l=n.setContext(i);!function(t,e,i,o,n){const s=t.ctx,r=e.circular,{color:a,lineWidth:l}=e;!r&&!o||!a||!l||i<0||(s.save(),s.strokeStyle=a,s.lineWidth=l,s.setLineDash(n.dash||[]),s.lineDashOffset=n.dashOffset,s.beginPath(),Hx(t,i,r,o),s.closePath(),s.stroke(),s.restore())}(this,r,a,s,l)}})),i.display){for(t.save(),r=s-1;r>=0;r--){const o=i.setContext(this.getPointLabelContext(r)),{color:n,lineWidth:s}=o;s&&n&&(t.lineWidth=s,t.strokeStyle=n,t.setLineDash(o.borderDash),t.lineDashOffset=o.borderDashOffset,a=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),l=this.getPointPosition(r,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const o=this.getIndexAngle(0);let n,s;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(o),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((o,r)=>{if(0===r&&this.min>=0&&!e.reverse)return;const a=i.setContext(this.getContext(r)),l=sf(a.font);if(n=this.getDistanceFromCenterForValue(this.ticks[r].value),a.showLabelBackdrop){t.font=l.string,s=t.measureText(o.label).width,t.fillStyle=a.backdropColor;const e=nf(a.backdropPadding);t.fillRect(-s/2-e.left,-n-l.size/2-e.top,s+e.width,l.size+e.height)}Yg(t,o.label,0,-n,l,{color:a.color,strokeColor:a.textStrokeColor,strokeWidth:a.textStrokeWidth})})),t.restore()}drawTitle(){}}const Zx={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Yx=Object.keys(Zx);function Gx(t,e){return t-e}function Kx(t,e){if(um(e))return null;const i=t._adapter,{parser:o,round:n,isoWeekday:s}=t._parseOpts;let r=e;return"function"==typeof o&&(r=o(r)),gm(r)||(r="string"==typeof o?i.parse(r,o):i.parse(r)),null===r?null:(n&&(r="week"!==n||!Wm(s)&&!0!==s?i.startOf(r,n):i.startOf(r,"isoWeek",s)),+r)}function Xx(t,e,i,o){const n=Yx.length;for(let s=Yx.indexOf(t);s<n-1;++s){const t=Zx[Yx[s]],n=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(n*t.size))<=o)return Yx[s]}return Yx[n-1]}function Qx(t,e,i){if(i){if(i.length){const{lo:o,hi:n}=ng(i,e);t[i[o]>=e?i[o]:i[n]]=!0}}else t[e]=!0}function Jx(t,e,i){const o=[],n={},s=e.length;let r,a;for(r=0;r<s;++r)a=e[r],n[a]=r,o.push({value:a,major:!1});return 0!==s&&i?function(t,e,i,o){const n=t._adapter,s=+n.startOf(e[0].value,o),r=e[e.length-1].value;let a,l;for(a=s;a<=r;a=+n.add(a,1,o))l=i[a],l>=0&&(e[l].major=!0);return e}(t,o,n,i):o}class t_ extends Ay{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),o=this._adapter=new Iv._date(t.adapters.date);o.init(e),Am(i.displayFormats,o.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:Kx(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:o,max:n,minDefined:s,maxDefined:r}=this.getUserBounds();function a(t){s||isNaN(t.min)||(o=Math.min(o,t.min)),r||isNaN(t.max)||(n=Math.max(n,t.max))}s&&r||(a(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||a(this.getMinMax(!1))),o=gm(o)&&!isNaN(o)?o:+e.startOf(Date.now(),i),n=gm(n)&&!isNaN(n)?n:+e.endOf(Date.now(),i)+1,this.min=Math.min(o,n-1),this.max=Math.max(o+1,n)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,o="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&o.length&&(this.min=this._userMin||o[0],this.max=this._userMax||o[o.length-1]);const n=this.min,s=function(t,e,i){let o=0,n=t.length;for(;o<n&&t[o]<e;)o++;for(;n>o&&t[n-1]>i;)n--;return o>0||n<t.length?t.slice(o,n):t}(o,n,this.max);return this._unit=e.unit||(i.autoSkip?Xx(e.minUnit,this.min,this.max,this._getLabelCapacity(n)):function(t,e,i,o,n){for(let s=Yx.length-1;s>=Yx.indexOf(i);s--){const i=Yx[s];if(Zx[i].common&&t._adapter.diff(n,o,i)>=e-1)return i}return Yx[i?Yx.indexOf(i):0]}(this,s.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=Yx.indexOf(t)+1,i=Yx.length;e<i;++e)if(Zx[Yx[e]].common)return Yx[e]}(this._unit):void 0,this.initOffsets(o),t.reverse&&s.reverse(),Jx(this,s,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map((t=>+t.value)))}initOffsets(t=[]){let e,i,o=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),o=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),n=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const s=t.length<3?.5:.25;o=ig(o,0,s),n=ig(n,0,s),this._offsets={start:o,end:n,factor:1/(o+1+n)}}_generate(){const t=this._adapter,e=this.min,i=this.max,o=this.options,n=o.time,s=n.unit||Xx(n.minUnit,e,i,this._getLabelCapacity(e)),r=vm(o.ticks.stepSize,1),a="week"===s&&n.isoWeekday,l=Wm(a)||!0===a,d={};let c,h,u=e;if(l&&(u=+t.startOf(u,"isoWeek",a)),u=+t.startOf(u,l?"day":s),t.diff(i,e,s)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+s);const p="data"===o.ticks.source&&this.getDataTimestamps();for(c=u,h=0;c<i;c=+t.add(c,r,s),h++)Qx(d,c,p);return c!==i&&"ticks"!==o.bounds&&1!==h||Qx(d,c,p),Object.keys(d).sort(Gx).map((t=>+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const i=this.options.time.displayFormats,o=this._unit,n=e||i[o];return this._adapter.format(t,n)}_tickFormatFunction(t,e,i,o){const n=this.options,s=n.ticks.callback;if(s)return bm(s,[t,e,i],this);const r=n.time.displayFormats,a=this._unit,l=this._majorUnit,d=a&&r[a],c=l&&r[l],h=i[e],u=l&&c&&h&&h.major;return this._adapter.format(t,o||(u?c:d))}generateTickLabels(t){let e,i,o;for(e=0,i=t.length;e<i;++e)o=t[e],o.label=this._tickFormatFunction(o.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,o=Ym(this.isHorizontal()?e.maxRotation:e.minRotation),n=Math.cos(o),s=Math.sin(o),r=this._resolveTickFontOptions(0).size;return{w:i*n+r*s,h:i*s+r*n}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,o=i[e.unit]||i.millisecond,n=this._tickFormatFunction(t,0,Jx(this,[t],this._majorUnit),o),s=this._getLabelSize(n),r=Math.floor(this.isHorizontal()?this.width/s.w:this.height/s.h)-1;return r>0?r:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const o=this.getMatchingVisibleMetas();if(this._normalized&&o.length)return this._cache.data=o[0].controller.getAllParsedValues(this);for(t=0,e=o.length;t<e;++t)i=i.concat(o[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const o=this.getLabels();for(e=0,i=o.length;e<i;++e)t.push(Kx(this,o[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return dg(t.sort(Gx))}}function e_(t,e,i){let o,n,s,r,a=0,l=t.length-1;i?(e>=t[a].pos&&e<=t[l].pos&&({lo:a,hi:l}=sg(t,"pos",e)),({pos:o,time:s}=t[a]),({pos:n,time:r}=t[l])):(e>=t[a].time&&e<=t[l].time&&({lo:a,hi:l}=sg(t,"time",e)),({time:o,pos:s}=t[a]),({time:n,pos:r}=t[l]));const d=n-o;return d?s+(r-s)*(e-o)/d:s}var i_=Object.freeze({__proto__:null,CategoryScale:class extends Ay{static id="category";static defaults={ticks:{callback:Ex}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:o}of e)t[i]===o&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(um(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:ig(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:Ax(i,t,vm(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:o}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(o=this.getLabels().length-1)),this.min=i,this.max=o}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,o=[];let n=this.getLabels();n=0===t&&e===n.length-1?n:n.slice(t,e+1),this._valueRange=Math.max(n.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)o.push({value:i});return o}getLabelForValue(t){return Ex.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},LinearScale:Mx,LogarithmicScale:Rx,RadialLinearScale:Wx,TimeScale:t_,TimeSeriesScale:class extends t_{static id="timeseries";static defaults=t_.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=e_(e,this.min),this._tableRange=e_(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,o=[],n=[];let s,r,a,l,d;for(s=0,r=t.length;s<r;++s)l=t[s],l>=e&&l<=i&&o.push(l);if(o.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(s=0,r=o.length;s<r;++s)d=o[s+1],a=o[s-1],l=o[s],Math.round((d+a)/2)!==l&&n.push({time:l,pos:s/(r-1)});return n}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return i.includes(t)&&i.length||i.splice(0,0,t),i.includes(e)&&1!==i.length||i.push(e),i.sort(((t,e)=>t-e))}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(e_(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return e_(this._table,i*this._tableRange+this._minPos,!0)}}});const o_=[Tv,$b,Sx,i_];ob.register(...o_);
10959
11052
  /*!
10960
11053
  * chartjs-adapter-luxon v1.3.1
10961
11054
  * https://www.chartjs.org
@@ -10969,7 +11062,7 @@ const n_={datetime:Za.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",seco
10969
11062
  * (c) 2017-2022 chartjs-plugin-datalabels contributors
10970
11063
  * Released under the MIT license
10971
11064
  */
10972
- var s_=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)return window.devicePixelRatio;var t=window.screen;if(t)return(t.deviceXDPI||1)/(t.logicalXDPI||1)}return 1}(),r_=function(t){var e,i=[];for(t=[].concat(t);t.length;)"string"==typeof(e=t.pop())?i.unshift.apply(i,e.split("\n")):Array.isArray(e)?t.push.apply(t,e):um(t)||i.unshift(""+e);return i},a_=function(t,e,i){var o,n=[].concat(e),s=n.length,r=t.font,a=0;for(t.font=i.string,o=0;o<s;++o)a=Math.max(t.measureText(n[o]).width,a);return t.font=r,{height:s*i.lineHeight,width:a}},l_=function(t,e,i){return Math.max(t,Math.min(e,i))},d_=function(t,e){var i,o,n,s,r=t.slice(),a=[];for(i=0,n=e.length;i<n;++i)s=e[i],-1===(o=r.indexOf(s))?a.push([s,1]):r.splice(o,1);for(i=0,n=r.length;i<n;++i)a.push([r[i],-1]);return a},c_=function(t){return Math.round(t*s_)/s_};function h_(t,e){var i=e.x,o=e.y;if(null===i)return{x:0,y:-1};if(null===o)return{x:1,y:0};var n=t.x-i,s=t.y-o,r=Math.sqrt(n*n+s*s);return{x:r?n/r:0,y:r?s/r:-1}}var u_=0,p_=1,m_=2,g_=4,f_=8;function v_(t,e,i){var o=u_;return t<i.left?o|=p_:t>i.right&&(o|=m_),e<i.top?o|=f_:e>i.bottom&&(o|=g_),o}function b_(t,e){var i,o,n=e.anchor,s=t;return e.clamp&&(s=function(t,e){for(var i,o,n,s=t.x0,r=t.y0,a=t.x1,l=t.y1,d=v_(s,r,e),c=v_(a,l,e);d|c&&!(d&c);)(i=d||c)&f_?(o=s+(a-s)*(e.top-r)/(l-r),n=e.top):i&g_?(o=s+(a-s)*(e.bottom-r)/(l-r),n=e.bottom):i&m_?(n=r+(l-r)*(e.right-s)/(a-s),o=e.right):i&p_&&(n=r+(l-r)*(e.left-s)/(a-s),o=e.left),i===d?d=v_(s=o,r=n,e):c=v_(a=o,l=n,e);return{x0:s,x1:a,y0:r,y1:l}}(s,e.area)),"start"===n?(i=s.x0,o=s.y0):"end"===n?(i=s.x1,o=s.y1):(i=(s.x0+s.x1)/2,o=(s.y0+s.y1)/2),function(t,e,i,o,n){switch(n){case"center":i=o=0;break;case"bottom":i=0,o=1;break;case"right":i=1,o=0;break;case"left":i=-1,o=0;break;case"top":i=0,o=-1;break;case"start":i=-i,o=-o;break;case"end":break;default:n*=Math.PI/180,i=Math.cos(n),o=Math.sin(n)}return{x:t,y:e,vx:i,vy:o}}(i,o,t.vx,t.vy,e.align)}var y_=function(t,e){var i=(t.startAngle+t.endAngle)/2,o=Math.cos(i),n=Math.sin(i),s=t.innerRadius,r=t.outerRadius;return b_({x0:t.x+o*s,y0:t.y+n*s,x1:t.x+o*r,y1:t.y+n*r,vx:o,vy:n},e)},x_=function(t,e){var i=h_(t,e.origin),o=i.x*t.options.radius,n=i.y*t.options.radius;return b_({x0:t.x-o,y0:t.y-n,x1:t.x+o,y1:t.y+n,vx:i.x,vy:i.y},e)},__=function(t,e){var i=h_(t,e.origin),o=t.x,n=t.y,s=0,r=0;return t.horizontal?(o=Math.min(t.x,t.base),s=Math.abs(t.base-t.x)):(n=Math.min(t.y,t.base),r=Math.abs(t.base-t.y)),b_({x0:o,y0:n+r,x1:o+s,y1:n,vx:i.x,vy:i.y},e)},w_=function(t,e){var i=h_(t,e.origin);return b_({x0:t.x,y0:t.y,x1:t.x+(t.width||0),y1:t.y+(t.height||0),vx:i.x,vy:i.y},e)},k_=c_;function C_(t,e){var i=e.chart.getDatasetMeta(e.datasetIndex).vScale;if(!i)return null;if(void 0!==i.xCenter&&void 0!==i.yCenter)return{x:i.xCenter,y:i.yCenter};var o=i.getBasePixel();return t.horizontal?{x:o,y:null}:{x:null,y:o}}function S_(t,e,i){var o=i.backgroundColor,n=i.borderColor,s=i.borderWidth;(o||n&&s)&&(t.beginPath(),function(t,e,i,o,n,s){var r=Math.PI/2;if(s){var a=Math.min(s,n/2,o/2),l=e+a,d=i+a,c=e+o-a,h=i+n-a;t.moveTo(e,d),l<c&&d<h?(t.arc(l,d,a,-Math.PI,-r),t.arc(c,d,a,-r,0),t.arc(c,h,a,0,r),t.arc(l,h,a,r,Math.PI)):l<c?(t.moveTo(l,i),t.arc(c,d,a,-r,r),t.arc(l,d,a,r,Math.PI+r)):d<h?(t.arc(l,d,a,-Math.PI,0),t.arc(l,h,a,0,Math.PI)):t.arc(l,d,a,-Math.PI,Math.PI),t.closePath(),t.moveTo(e,i)}else t.rect(e,i,o,n)}(t,k_(e.x)+s/2,k_(e.y)+s/2,k_(e.w)-s,k_(e.h)-s,i.borderRadius),t.closePath(),o&&(t.fillStyle=o,t.fill()),n&&s&&(t.strokeStyle=n,t.lineWidth=s,t.lineJoin="miter",t.stroke()))}function A_(t,e,i){var o=t.shadowBlur,n=i.stroked,s=k_(i.x),r=k_(i.y),a=k_(i.w);n&&t.strokeText(e,s,r,a),i.filled&&(o&&n&&(t.shadowBlur=0),t.fillText(e,s,r,a),o&&n&&(t.shadowBlur=o))}var E_=function(t,e,i,o){var n=this;n._config=t,n._index=o,n._model=null,n._rects=null,n._ctx=e,n._el=i};Sm(E_.prototype,{_modelize:function(t,e,i,o){var n,s=this,r=s._index,a=sf(rf([i.font,{}],o,r)),l=rf([i.color,Lg.color],o,r);return{align:rf([i.align,"center"],o,r),anchor:rf([i.anchor,"center"],o,r),area:o.chart.chartArea,backgroundColor:rf([i.backgroundColor,null],o,r),borderColor:rf([i.borderColor,null],o,r),borderRadius:rf([i.borderRadius,0],o,r),borderWidth:rf([i.borderWidth,0],o,r),clamp:rf([i.clamp,!1],o,r),clip:rf([i.clip,!1],o,r),color:l,display:t,font:a,lines:e,offset:rf([i.offset,4],o,r),opacity:rf([i.opacity,1],o,r),origin:C_(s._el,o),padding:nf(rf([i.padding,4],o,r)),positioner:(n=s._el,n instanceof dy?y_:n instanceof xy?x_:n instanceof Ey?__:w_),rotation:rf([i.rotation,0],o,r)*(Math.PI/180),size:a_(s._ctx,e,a),textAlign:rf([i.textAlign,"start"],o,r),textShadowBlur:rf([i.textShadowBlur,0],o,r),textShadowColor:rf([i.textShadowColor,l],o,r),textStrokeColor:rf([i.textStrokeColor,l],o,r),textStrokeWidth:rf([i.textStrokeWidth,0],o,r)}},update:function(t){var e,i,o,n=this,s=null,r=null,a=n._index,l=n._config,d=rf([l.display,!0],t,a);d&&(e=t.dataset.data[a],(o=um(i=vm(ym(l.formatter,[e,t]),e))?[]:r_(i)).length&&(r=function(t){var e=t.borderWidth||0,i=t.padding,o=t.size.height,n=t.size.width,s=-n/2,r=-o/2;return{frame:{x:s-i.left-e,y:r-i.top-e,w:n+i.width+2*e,h:o+i.height+2*e},text:{x:s,y:r,w:n,h:o}}}(s=n._modelize(d,o,l,t)))),n._model=s,n._rects=r},geometry:function(){return this._rects?this._rects.frame:{}},rotation:function(){return this._model?this._model.rotation:0},visible:function(){return this._model&&this._model.opacity},model:function(){return this._model},draw:function(t,e){var i,o=t.ctx,n=this._model,s=this._rects;this.visible()&&(o.save(),n.clip&&(i=n.area,o.beginPath(),o.rect(i.left,i.top,i.right-i.left,i.bottom-i.top),o.clip()),o.globalAlpha=l_(0,n.opacity,1),o.translate(k_(e.x),k_(e.y)),o.rotate(n.rotation),S_(o,s.frame,n),function(t,e,i,o){var n,s=o.textAlign,r=o.color,a=!!r,l=o.font,d=e.length,c=o.textStrokeColor,h=o.textStrokeWidth,u=c&&h;if(d&&(a||u))for(i=function(t,e,i){var o=i.lineHeight,n=t.w,s=t.x;return"center"===e?s+=n/2:"end"!==e&&"right"!==e||(s+=n),{h:o,w:n,x:s,y:t.y+o/2}}(i,s,l),t.font=l.string,t.textAlign=s,t.textBaseline="middle",t.shadowBlur=o.textShadowBlur,t.shadowColor=o.textShadowColor,a&&(t.fillStyle=r),u&&(t.lineJoin="round",t.lineWidth=h,t.strokeStyle=c),n=0,d=e.length;n<d;++n)A_(t,e[n],{stroked:u,filled:a,w:i.w,x:i.x,y:i.y+i.h*n})}(o,n.lines,s.text,n),o.restore())}});var $_=Number.MIN_SAFE_INTEGER||-9007199254740991,T_=Number.MAX_SAFE_INTEGER||9007199254740991;function D_(t,e,i){var o=Math.cos(i),n=Math.sin(i),s=e.x,r=e.y;return{x:s+o*(t.x-s)-n*(t.y-r),y:r+n*(t.x-s)+o*(t.y-r)}}function M_(t,e){var i,o,n,s,r,a=T_,l=$_,d=e.origin;for(i=0;i<t.length;++i)n=(o=t[i]).x-d.x,s=o.y-d.y,r=e.vx*n+e.vy*s,a=Math.min(a,r),l=Math.max(l,r);return{min:a,max:l}}function I_(t,e){var i=e.x-t.x,o=e.y-t.y,n=Math.sqrt(i*i+o*o);return{vx:(e.x-t.x)/n,vy:(e.y-t.y)/n,origin:t,ln:n}}var O_=function(){this._rotation=0,this._rect={x:0,y:0,w:0,h:0}};function L_(t,e,i){var o=e.positioner(t,e),n=o.vx,s=o.vy;if(!n&&!s)return{x:o.x,y:o.y};var r=i.w,a=i.h,l=e.rotation,d=Math.abs(r/2*Math.cos(l))+Math.abs(a/2*Math.sin(l)),c=Math.abs(r/2*Math.sin(l))+Math.abs(a/2*Math.cos(l)),h=1/Math.max(Math.abs(n),Math.abs(s));return d*=n*h,c*=s*h,d+=e.offset*n,c+=e.offset*s,{x:o.x+d,y:o.y+c}}Sm(O_.prototype,{center:function(){var t=this._rect;return{x:t.x+t.w/2,y:t.y+t.h/2}},update:function(t,e,i){this._rotation=i,this._rect={x:e.x+t.x,y:e.y+t.y,w:e.w,h:e.h}},contains:function(t){var e=this,i=e._rect;return!((t=D_(t,e.center(),-e._rotation)).x<i.x-1||t.y<i.y-1||t.x>i.x+i.w+2||t.y>i.y+i.h+2)},intersects:function(t){var e,i,o,n=this._points(),s=t._points(),r=[I_(n[0],n[1]),I_(n[0],n[3])];for(this._rotation!==t._rotation&&r.push(I_(s[0],s[1]),I_(s[0],s[3])),e=0;e<r.length;++e)if(i=M_(n,r[e]),o=M_(s,r[e]),i.max<o.min||o.max<i.min)return!1;return!0},_points:function(){var t=this,e=t._rect,i=t._rotation,o=t.center();return[D_({x:e.x,y:e.y},o,i),D_({x:e.x+e.w,y:e.y},o,i),D_({x:e.x+e.w,y:e.y+e.h},o,i),D_({x:e.x,y:e.y+e.h},o,i)]}});var z_={prepare:function(t){var e,i,o,n,s,r=[];for(e=0,o=t.length;e<o;++e)for(i=0,n=t[e].length;i<n;++i)s=t[e][i],r.push(s),s.$layout={_box:new O_,_hidable:!1,_visible:!0,_set:e,_idx:s._index};return r.sort((function(t,e){var i=t.$layout,o=e.$layout;return i._idx===o._idx?o._set-i._set:o._idx-i._idx})),this.update(r),r},update:function(t){var e,i,o,n,s,r=!1;for(e=0,i=t.length;e<i;++e)n=(o=t[e]).model(),(s=o.$layout)._hidable=n&&"auto"===n.display,s._visible=o.visible(),r|=s._hidable;r&&function(t){var e,i,o,n,s,r,a;for(e=0,i=t.length;e<i;++e)(n=(o=t[e]).$layout)._visible&&(a=new Proxy(o._el,{get:(t,e)=>t.getProps([e],!0)[e]}),s=o.geometry(),r=L_(a,o.model(),s),n._box.update(r,s,o.rotation()));(function(t,e){var i,o,n,s;for(i=t.length-1;i>=0;--i)for(n=t[i].$layout,o=i-1;o>=0&&n._visible;--o)(s=t[o].$layout)._visible&&n._box.intersects(s._box)&&e(n,s)})(t,(function(t,e){var i=t._hidable,o=e._hidable;i&&o||o?e._visible=!1:i&&(t._visible=!1)}))}(t)},lookup:function(t,e){var i,o;for(i=t.length-1;i>=0;--i)if((o=t[i].$layout)&&o._visible&&o._box.contains(e))return t[i];return null},draw:function(t,e){var i,o,n,s,r,a;for(i=0,o=e.length;i<o;++i)(s=(n=e[i]).$layout)._visible&&(r=n.geometry(),a=L_(n._el,n.model(),r),s._box.update(a,r,n.rotation()),n.draw(t,a))}},P_={align:"center",anchor:"center",backgroundColor:null,borderColor:null,borderRadius:0,borderWidth:0,clamp:!1,clip:!1,color:void 0,display:!0,font:{family:void 0,lineHeight:1.2,size:void 0,style:void 0,weight:null},formatter:function(t){if(um(t))return null;var e,i,o,n=t;if(mm(t))if(um(t.label))if(um(t.r))for(n="",o=0,i=(e=Object.keys(t)).length;o<i;++o)n+=(0!==o?", ":"")+e[o]+": "+t[e[o]];else n=t.r;else n=t.label;return""+n},labels:void 0,listeners:{},offset:4,opacity:1,padding:{top:4,right:4,bottom:4,left:4},rotation:0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,textShadowBlur:0,textShadowColor:void 0},R_="$datalabels",N_="$default";function B_(t,e,i,o){if(e){var n,s=i.$context,r=i.$groups;e[r._set]&&(n=e[r._set][r._key])&&!0===ym(n,[s,o])&&(t[R_]._dirty=!0,i.update(s))}}function F_(t,e){var i,o,n=t[R_],s=n._listeners;if(s.enter||s.leave){if("mousemove"===e.type)o=z_.lookup(n._labels,e);else if("mouseout"!==e.type)return;i=n._hovered,n._hovered=o,function(t,e,i,o,n){var s,r;(i||o)&&(i?o?i!==o&&(r=s=!0):r=!0:s=!0,r&&B_(t,e.leave,i,n),s&&B_(t,e.enter,o,n))}(t,s,i,o,e)}}var q_={id:"datalabels",defaults:P_,beforeInit:function(t){t[R_]={_actives:[]}},beforeUpdate:function(t){var e=t[R_];e._listened=!1,e._listeners={},e._datasets=[],e._labels=[]},afterDatasetUpdate:function(t,e,i){var o,n,s,r,a,l,d,c,h=e.index,u=t[R_],p=u._datasets[h]=[],m=t.isDatasetVisible(h),g=t.data.datasets[h],f=function(t,e){var i,o,n,s=t.datalabels,r=[];return!1===s?null:(!0===s&&(s={}),e=Sm({},[e,s]),o=e.labels||{},n=Object.keys(o),delete e.labels,n.length?n.forEach((function(t){o[t]&&r.push(Sm({},[e,o[t],{_key:t}]))})):r.push(e),i=r.reduce((function(t,e){return xm(e.listeners||{},(function(i,o){t[o]=t[o]||{},t[o][e._key||N_]=i})),delete e.listeners,t}),{}),{labels:r,listeners:i})}(g,i),v=e.meta.data||[],b=t.ctx;for(b.save(),o=0,s=v.length;o<s;++o)if((d=v[o])[R_]=[],m&&d&&t.getDataVisibility(o)&&!d.skip)for(n=0,r=f.labels.length;n<r;++n)l=(a=f.labels[n])._key,(c=new E_(a,b,d,o)).$groups={_set:h,_key:l||N_},c.$context={active:!1,chart:t,dataIndex:o,dataset:g,datasetIndex:h},c.update(c.$context),d[R_].push(c),p.push(c);b.restore(),Sm(u._listeners,f.listeners,{merger:function(t,i,o){i[t]=i[t]||{},i[t][e.index]=o[t],u._listened=!0}})},afterUpdate:function(t){t[R_]._labels=z_.prepare(t[R_]._datasets)},afterDatasetsDraw:function(t){z_.draw(t,t[R_]._labels)},beforeEvent:function(t,e){if(t[R_]._listened){var i=e.event;switch(i.type){case"mousemove":case"mouseout":F_(t,i);break;case"click":!function(t,e){var i=t[R_],o=i._listeners.click,n=o&&z_.lookup(i._labels,e);n&&B_(t,o,n,e)}(t,i)}}},afterEvent:function(t){var e,i,o,n,s,r,a,l=t[R_],d=l._actives,c=l._actives=t.getActiveElements(),h=d_(d,c);for(e=0,i=h.length;e<i;++e)if((s=h[e])[1])for(o=0,n=(a=s[0].element[R_]||[]).length;o<n;++o)(r=a[o]).$context.active=1===s[1],r.update(r.$context);(l._dirty||h.length)&&(z_.update(l._labels),t.render()),delete l._dirty}};oy.register(q_);const U_={"qualitative-set1":["#5ea3db","#c186e3","#66c2a5","#fc8d62","#a6d854","#ffd92f","#e5c494","#b3b3b3"],"qualitative-set2":["#377eb8","#984ea3","#4daf4a","#ff7f00","#e41a1c","#a65628","#f781bf","#ffff33"],"qualitative-set3":["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],"qualitative-paired":["#1f78b4","#a6cee3","#6a3d9a","#cab2d6","#33a02c","#b2df8a","#e31a1c","#fb9a99","#ff7f00","#fdbf6f"],"qualitative-accent":["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],"qualitative-pastel1":["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],"qualitative-pastel2":["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],"diverging-prgn":["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],"diverging-spectral":["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],"diverging-piyg":["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],"diverging-rdylgn":["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],"diverging-brbg":["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],"sequential-blues":["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],"sequential-greens":["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],"sequential-oranges":["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],"sequential-purples":["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],"sequential-reds":["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],"sequential-ylgnbu":["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]},j_="rgba(212, 212, 212, 0.5)";function V_(t){if(0===t)return"0s";const e=Math.floor(t/86400),i=t%86400,o=Math.floor(i/3600),n=i%3600,s=Math.floor(n/60),r=n%60,a=[];return e>0&&a.push(`${e}d`),o>0&&a.push(`${o}h`),s>0&&a.length<2&&a.push(`${s}m`),r>0&&a.length<2&&a.push(`${r}s`),a.slice(0,2).join(" ")}class H_ extends Ne{getInflatedMax(){if(!this.showPercent||!this.data)return;const t=Array(this.data.labels.length).fill(0);for(const e of this.datasets)e.data.forEach(((e,i)=>t[i]+=e));const e=Math.max(...t);return e>0?1.15*e:void 0}static get styles(){return a`
11065
+ var s_=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)return window.devicePixelRatio;var t=window.screen;if(t)return(t.deviceXDPI||1)/(t.logicalXDPI||1)}return 1}(),r_=function(t){var e,i=[];for(t=[].concat(t);t.length;)"string"==typeof(e=t.pop())?i.unshift.apply(i,e.split("\n")):Array.isArray(e)?t.push.apply(t,e):um(t)||i.unshift(""+e);return i},a_=function(t,e,i){var o,n=[].concat(e),s=n.length,r=t.font,a=0;for(t.font=i.string,o=0;o<s;++o)a=Math.max(t.measureText(n[o]).width,a);return t.font=r,{height:s*i.lineHeight,width:a}},l_=function(t,e,i){return Math.max(t,Math.min(e,i))},d_=function(t,e){var i,o,n,s,r=t.slice(),a=[];for(i=0,n=e.length;i<n;++i)s=e[i],-1===(o=r.indexOf(s))?a.push([s,1]):r.splice(o,1);for(i=0,n=r.length;i<n;++i)a.push([r[i],-1]);return a},c_=function(t){return Math.round(t*s_)/s_};function h_(t,e){var i=e.x,o=e.y;if(null===i)return{x:0,y:-1};if(null===o)return{x:1,y:0};var n=t.x-i,s=t.y-o,r=Math.sqrt(n*n+s*s);return{x:r?n/r:0,y:r?s/r:-1}}var u_=0,p_=1,m_=2,g_=4,f_=8;function v_(t,e,i){var o=u_;return t<i.left?o|=p_:t>i.right&&(o|=m_),e<i.top?o|=f_:e>i.bottom&&(o|=g_),o}function y_(t,e){var i,o,n=e.anchor,s=t;return e.clamp&&(s=function(t,e){for(var i,o,n,s=t.x0,r=t.y0,a=t.x1,l=t.y1,d=v_(s,r,e),c=v_(a,l,e);d|c&&!(d&c);)(i=d||c)&f_?(o=s+(a-s)*(e.top-r)/(l-r),n=e.top):i&g_?(o=s+(a-s)*(e.bottom-r)/(l-r),n=e.bottom):i&m_?(n=r+(l-r)*(e.right-s)/(a-s),o=e.right):i&p_&&(n=r+(l-r)*(e.left-s)/(a-s),o=e.left),i===d?d=v_(s=o,r=n,e):c=v_(a=o,l=n,e);return{x0:s,x1:a,y0:r,y1:l}}(s,e.area)),"start"===n?(i=s.x0,o=s.y0):"end"===n?(i=s.x1,o=s.y1):(i=(s.x0+s.x1)/2,o=(s.y0+s.y1)/2),function(t,e,i,o,n){switch(n){case"center":i=o=0;break;case"bottom":i=0,o=1;break;case"right":i=1,o=0;break;case"left":i=-1,o=0;break;case"top":i=0,o=-1;break;case"start":i=-i,o=-o;break;case"end":break;default:n*=Math.PI/180,i=Math.cos(n),o=Math.sin(n)}return{x:t,y:e,vx:i,vy:o}}(i,o,t.vx,t.vy,e.align)}var b_=function(t,e){var i=(t.startAngle+t.endAngle)/2,o=Math.cos(i),n=Math.sin(i),s=t.innerRadius,r=t.outerRadius;return y_({x0:t.x+o*s,y0:t.y+n*s,x1:t.x+o*r,y1:t.y+n*r,vx:o,vy:n},e)},x_=function(t,e){var i=h_(t,e.origin),o=i.x*t.options.radius,n=i.y*t.options.radius;return y_({x0:t.x-o,y0:t.y-n,x1:t.x+o,y1:t.y+n,vx:i.x,vy:i.y},e)},__=function(t,e){var i=h_(t,e.origin),o=t.x,n=t.y,s=0,r=0;return t.horizontal?(o=Math.min(t.x,t.base),s=Math.abs(t.base-t.x)):(n=Math.min(t.y,t.base),r=Math.abs(t.base-t.y)),y_({x0:o,y0:n+r,x1:o+s,y1:n,vx:i.x,vy:i.y},e)},w_=function(t,e){var i=h_(t,e.origin);return y_({x0:t.x,y0:t.y,x1:t.x+(t.width||0),y1:t.y+(t.height||0),vx:i.x,vy:i.y},e)},k_=c_;function C_(t,e){var i=e.chart.getDatasetMeta(e.datasetIndex).vScale;if(!i)return null;if(void 0!==i.xCenter&&void 0!==i.yCenter)return{x:i.xCenter,y:i.yCenter};var o=i.getBasePixel();return t.horizontal?{x:o,y:null}:{x:null,y:o}}function S_(t,e,i){var o=i.backgroundColor,n=i.borderColor,s=i.borderWidth;(o||n&&s)&&(t.beginPath(),function(t,e,i,o,n,s){var r=Math.PI/2;if(s){var a=Math.min(s,n/2,o/2),l=e+a,d=i+a,c=e+o-a,h=i+n-a;t.moveTo(e,d),l<c&&d<h?(t.arc(l,d,a,-Math.PI,-r),t.arc(c,d,a,-r,0),t.arc(c,h,a,0,r),t.arc(l,h,a,r,Math.PI)):l<c?(t.moveTo(l,i),t.arc(c,d,a,-r,r),t.arc(l,d,a,r,Math.PI+r)):d<h?(t.arc(l,d,a,-Math.PI,0),t.arc(l,h,a,0,Math.PI)):t.arc(l,d,a,-Math.PI,Math.PI),t.closePath(),t.moveTo(e,i)}else t.rect(e,i,o,n)}(t,k_(e.x)+s/2,k_(e.y)+s/2,k_(e.w)-s,k_(e.h)-s,i.borderRadius),t.closePath(),o&&(t.fillStyle=o,t.fill()),n&&s&&(t.strokeStyle=n,t.lineWidth=s,t.lineJoin="miter",t.stroke()))}function A_(t,e,i){var o=t.shadowBlur,n=i.stroked,s=k_(i.x),r=k_(i.y),a=k_(i.w);n&&t.strokeText(e,s,r,a),i.filled&&(o&&n&&(t.shadowBlur=0),t.fillText(e,s,r,a),o&&n&&(t.shadowBlur=o))}var E_=function(t,e,i,o){var n=this;n._config=t,n._index=o,n._model=null,n._rects=null,n._ctx=e,n._el=i};Sm(E_.prototype,{_modelize:function(t,e,i,o){var n,s=this,r=s._index,a=sf(rf([i.font,{}],o,r)),l=rf([i.color,Lg.color],o,r);return{align:rf([i.align,"center"],o,r),anchor:rf([i.anchor,"center"],o,r),area:o.chart.chartArea,backgroundColor:rf([i.backgroundColor,null],o,r),borderColor:rf([i.borderColor,null],o,r),borderRadius:rf([i.borderRadius,0],o,r),borderWidth:rf([i.borderWidth,0],o,r),clamp:rf([i.clamp,!1],o,r),clip:rf([i.clip,!1],o,r),color:l,display:t,font:a,lines:e,offset:rf([i.offset,4],o,r),opacity:rf([i.opacity,1],o,r),origin:C_(s._el,o),padding:nf(rf([i.padding,4],o,r)),positioner:(n=s._el,n instanceof db?b_:n instanceof xb?x_:n instanceof Eb?__:w_),rotation:rf([i.rotation,0],o,r)*(Math.PI/180),size:a_(s._ctx,e,a),textAlign:rf([i.textAlign,"start"],o,r),textShadowBlur:rf([i.textShadowBlur,0],o,r),textShadowColor:rf([i.textShadowColor,l],o,r),textStrokeColor:rf([i.textStrokeColor,l],o,r),textStrokeWidth:rf([i.textStrokeWidth,0],o,r)}},update:function(t){var e,i,o,n=this,s=null,r=null,a=n._index,l=n._config,d=rf([l.display,!0],t,a);d&&(e=t.dataset.data[a],(o=um(i=vm(bm(l.formatter,[e,t]),e))?[]:r_(i)).length&&(r=function(t){var e=t.borderWidth||0,i=t.padding,o=t.size.height,n=t.size.width,s=-n/2,r=-o/2;return{frame:{x:s-i.left-e,y:r-i.top-e,w:n+i.width+2*e,h:o+i.height+2*e},text:{x:s,y:r,w:n,h:o}}}(s=n._modelize(d,o,l,t)))),n._model=s,n._rects=r},geometry:function(){return this._rects?this._rects.frame:{}},rotation:function(){return this._model?this._model.rotation:0},visible:function(){return this._model&&this._model.opacity},model:function(){return this._model},draw:function(t,e){var i,o=t.ctx,n=this._model,s=this._rects;this.visible()&&(o.save(),n.clip&&(i=n.area,o.beginPath(),o.rect(i.left,i.top,i.right-i.left,i.bottom-i.top),o.clip()),o.globalAlpha=l_(0,n.opacity,1),o.translate(k_(e.x),k_(e.y)),o.rotate(n.rotation),S_(o,s.frame,n),function(t,e,i,o){var n,s=o.textAlign,r=o.color,a=!!r,l=o.font,d=e.length,c=o.textStrokeColor,h=o.textStrokeWidth,u=c&&h;if(d&&(a||u))for(i=function(t,e,i){var o=i.lineHeight,n=t.w,s=t.x;return"center"===e?s+=n/2:"end"!==e&&"right"!==e||(s+=n),{h:o,w:n,x:s,y:t.y+o/2}}(i,s,l),t.font=l.string,t.textAlign=s,t.textBaseline="middle",t.shadowBlur=o.textShadowBlur,t.shadowColor=o.textShadowColor,a&&(t.fillStyle=r),u&&(t.lineJoin="round",t.lineWidth=h,t.strokeStyle=c),n=0,d=e.length;n<d;++n)A_(t,e[n],{stroked:u,filled:a,w:i.w,x:i.x,y:i.y+i.h*n})}(o,n.lines,s.text,n),o.restore())}});var $_=Number.MIN_SAFE_INTEGER||-9007199254740991,T_=Number.MAX_SAFE_INTEGER||9007199254740991;function D_(t,e,i){var o=Math.cos(i),n=Math.sin(i),s=e.x,r=e.y;return{x:s+o*(t.x-s)-n*(t.y-r),y:r+n*(t.x-s)+o*(t.y-r)}}function M_(t,e){var i,o,n,s,r,a=T_,l=$_,d=e.origin;for(i=0;i<t.length;++i)n=(o=t[i]).x-d.x,s=o.y-d.y,r=e.vx*n+e.vy*s,a=Math.min(a,r),l=Math.max(l,r);return{min:a,max:l}}function I_(t,e){var i=e.x-t.x,o=e.y-t.y,n=Math.sqrt(i*i+o*o);return{vx:(e.x-t.x)/n,vy:(e.y-t.y)/n,origin:t,ln:n}}var O_=function(){this._rotation=0,this._rect={x:0,y:0,w:0,h:0}};function L_(t,e,i){var o=e.positioner(t,e),n=o.vx,s=o.vy;if(!n&&!s)return{x:o.x,y:o.y};var r=i.w,a=i.h,l=e.rotation,d=Math.abs(r/2*Math.cos(l))+Math.abs(a/2*Math.sin(l)),c=Math.abs(r/2*Math.sin(l))+Math.abs(a/2*Math.cos(l)),h=1/Math.max(Math.abs(n),Math.abs(s));return d*=n*h,c*=s*h,d+=e.offset*n,c+=e.offset*s,{x:o.x+d,y:o.y+c}}Sm(O_.prototype,{center:function(){var t=this._rect;return{x:t.x+t.w/2,y:t.y+t.h/2}},update:function(t,e,i){this._rotation=i,this._rect={x:e.x+t.x,y:e.y+t.y,w:e.w,h:e.h}},contains:function(t){var e=this,i=e._rect;return!((t=D_(t,e.center(),-e._rotation)).x<i.x-1||t.y<i.y-1||t.x>i.x+i.w+2||t.y>i.y+i.h+2)},intersects:function(t){var e,i,o,n=this._points(),s=t._points(),r=[I_(n[0],n[1]),I_(n[0],n[3])];for(this._rotation!==t._rotation&&r.push(I_(s[0],s[1]),I_(s[0],s[3])),e=0;e<r.length;++e)if(i=M_(n,r[e]),o=M_(s,r[e]),i.max<o.min||o.max<i.min)return!1;return!0},_points:function(){var t=this,e=t._rect,i=t._rotation,o=t.center();return[D_({x:e.x,y:e.y},o,i),D_({x:e.x+e.w,y:e.y},o,i),D_({x:e.x+e.w,y:e.y+e.h},o,i),D_({x:e.x,y:e.y+e.h},o,i)]}});var z_={prepare:function(t){var e,i,o,n,s,r=[];for(e=0,o=t.length;e<o;++e)for(i=0,n=t[e].length;i<n;++i)s=t[e][i],r.push(s),s.$layout={_box:new O_,_hidable:!1,_visible:!0,_set:e,_idx:s._index};return r.sort((function(t,e){var i=t.$layout,o=e.$layout;return i._idx===o._idx?o._set-i._set:o._idx-i._idx})),this.update(r),r},update:function(t){var e,i,o,n,s,r=!1;for(e=0,i=t.length;e<i;++e)n=(o=t[e]).model(),(s=o.$layout)._hidable=n&&"auto"===n.display,s._visible=o.visible(),r|=s._hidable;r&&function(t){var e,i,o,n,s,r,a;for(e=0,i=t.length;e<i;++e)(n=(o=t[e]).$layout)._visible&&(a=new Proxy(o._el,{get:(t,e)=>t.getProps([e],!0)[e]}),s=o.geometry(),r=L_(a,o.model(),s),n._box.update(r,s,o.rotation()));(function(t,e){var i,o,n,s;for(i=t.length-1;i>=0;--i)for(n=t[i].$layout,o=i-1;o>=0&&n._visible;--o)(s=t[o].$layout)._visible&&n._box.intersects(s._box)&&e(n,s)})(t,(function(t,e){var i=t._hidable,o=e._hidable;i&&o||o?e._visible=!1:i&&(t._visible=!1)}))}(t)},lookup:function(t,e){var i,o;for(i=t.length-1;i>=0;--i)if((o=t[i].$layout)&&o._visible&&o._box.contains(e))return t[i];return null},draw:function(t,e){var i,o,n,s,r,a;for(i=0,o=e.length;i<o;++i)(s=(n=e[i]).$layout)._visible&&(r=n.geometry(),a=L_(n._el,n.model(),r),s._box.update(a,r,n.rotation()),n.draw(t,a))}},P_={align:"center",anchor:"center",backgroundColor:null,borderColor:null,borderRadius:0,borderWidth:0,clamp:!1,clip:!1,color:void 0,display:!0,font:{family:void 0,lineHeight:1.2,size:void 0,style:void 0,weight:null},formatter:function(t){if(um(t))return null;var e,i,o,n=t;if(mm(t))if(um(t.label))if(um(t.r))for(n="",o=0,i=(e=Object.keys(t)).length;o<i;++o)n+=(0!==o?", ":"")+e[o]+": "+t[e[o]];else n=t.r;else n=t.label;return""+n},labels:void 0,listeners:{},offset:4,opacity:1,padding:{top:4,right:4,bottom:4,left:4},rotation:0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,textShadowBlur:0,textShadowColor:void 0},R_="$datalabels",N_="$default";function B_(t,e,i,o){if(e){var n,s=i.$context,r=i.$groups;e[r._set]&&(n=e[r._set][r._key])&&!0===bm(n,[s,o])&&(t[R_]._dirty=!0,i.update(s))}}function F_(t,e){var i,o,n=t[R_],s=n._listeners;if(s.enter||s.leave){if("mousemove"===e.type)o=z_.lookup(n._labels,e);else if("mouseout"!==e.type)return;i=n._hovered,n._hovered=o,function(t,e,i,o,n){var s,r;(i||o)&&(i?o?i!==o&&(r=s=!0):r=!0:s=!0,r&&B_(t,e.leave,i,n),s&&B_(t,e.enter,o,n))}(t,s,i,o,e)}}var q_={id:"datalabels",defaults:P_,beforeInit:function(t){t[R_]={_actives:[]}},beforeUpdate:function(t){var e=t[R_];e._listened=!1,e._listeners={},e._datasets=[],e._labels=[]},afterDatasetUpdate:function(t,e,i){var o,n,s,r,a,l,d,c,h=e.index,u=t[R_],p=u._datasets[h]=[],m=t.isDatasetVisible(h),g=t.data.datasets[h],f=function(t,e){var i,o,n,s=t.datalabels,r=[];return!1===s?null:(!0===s&&(s={}),e=Sm({},[e,s]),o=e.labels||{},n=Object.keys(o),delete e.labels,n.length?n.forEach((function(t){o[t]&&r.push(Sm({},[e,o[t],{_key:t}]))})):r.push(e),i=r.reduce((function(t,e){return xm(e.listeners||{},(function(i,o){t[o]=t[o]||{},t[o][e._key||N_]=i})),delete e.listeners,t}),{}),{labels:r,listeners:i})}(g,i),v=e.meta.data||[],y=t.ctx;for(y.save(),o=0,s=v.length;o<s;++o)if((d=v[o])[R_]=[],m&&d&&t.getDataVisibility(o)&&!d.skip)for(n=0,r=f.labels.length;n<r;++n)l=(a=f.labels[n])._key,(c=new E_(a,y,d,o)).$groups={_set:h,_key:l||N_},c.$context={active:!1,chart:t,dataIndex:o,dataset:g,datasetIndex:h},c.update(c.$context),d[R_].push(c),p.push(c);y.restore(),Sm(u._listeners,f.listeners,{merger:function(t,i,o){i[t]=i[t]||{},i[t][e.index]=o[t],u._listened=!0}})},afterUpdate:function(t){t[R_]._labels=z_.prepare(t[R_]._datasets)},afterDatasetsDraw:function(t){z_.draw(t,t[R_]._labels)},beforeEvent:function(t,e){if(t[R_]._listened){var i=e.event;switch(i.type){case"mousemove":case"mouseout":F_(t,i);break;case"click":!function(t,e){var i=t[R_],o=i._listeners.click,n=o&&z_.lookup(i._labels,e);n&&B_(t,o,n,e)}(t,i)}}},afterEvent:function(t){var e,i,o,n,s,r,a,l=t[R_],d=l._actives,c=l._actives=t.getActiveElements(),h=d_(d,c);for(e=0,i=h.length;e<i;++e)if((s=h[e])[1])for(o=0,n=(a=s[0].element[R_]||[]).length;o<n;++o)(r=a[o]).$context.active=1===s[1],r.update(r.$context);(l._dirty||h.length)&&(z_.update(l._labels),t.render()),delete l._dirty}};ob.register(q_);const U_={"qualitative-set1":["#5ea3db","#c186e3","#66c2a5","#fc8d62","#a6d854","#ffd92f","#e5c494","#b3b3b3"],"qualitative-set2":["#377eb8","#984ea3","#4daf4a","#ff7f00","#e41a1c","#a65628","#f781bf","#ffff33"],"qualitative-set3":["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],"qualitative-paired":["#1f78b4","#a6cee3","#6a3d9a","#cab2d6","#33a02c","#b2df8a","#e31a1c","#fb9a99","#ff7f00","#fdbf6f"],"qualitative-accent":["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],"qualitative-pastel1":["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],"qualitative-pastel2":["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],"diverging-prgn":["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],"diverging-spectral":["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],"diverging-piyg":["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],"diverging-rdylgn":["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],"diverging-brbg":["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],"sequential-blues":["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],"sequential-greens":["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],"sequential-oranges":["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],"sequential-purples":["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],"sequential-reds":["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],"sequential-ylgnbu":["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]},j_="rgba(212, 212, 212, 0.5)";function V_(t){if(0===t)return"0s";const e=Math.floor(t/86400),i=t%86400,o=Math.floor(i/3600),n=i%3600,s=Math.floor(n/60),r=n%60,a=[];return e>0&&a.push(`${e}d`),o>0&&a.push(`${o}h`),s>0&&a.length<2&&a.push(`${s}m`),r>0&&a.length<2&&a.push(`${r}s`),a.slice(0,2).join(" ")}class H_ extends Ne{getInflatedMax(){if(!this.showPercent||!this.data)return;const t=Array(this.data.labels.length).fill(0);for(const e of this.datasets)e.data.forEach(((e,i)=>t[i]+=e));const e=Math.max(...t);return e>0?1.15*e:void 0}static get styles(){return a`
10973
11066
  .chart-title {
10974
11067
  font-size: 1.2em;
10975
11068
  font-weight: 600;
@@ -11010,7 +11103,7 @@ var s_=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)retu
11010
11103
  padding: 2em 1em 1.5em 1em;
11011
11104
  max-height: 50px;
11012
11105
  }
11013
- `}constructor(){super(),this.chartType="bar",this.horizontal=!1,this.header="",this.other=!1,this.datasets=[],this.maxSplits=2,this.xType="category",this.xMaxTicks=10,this.yType="count",this.xFormat="auto",this.maxChartHeight=250,this.hideOther=!1,this.splits=[],this.dataname="Counts",this.single=!1,this.legend=!1,this.config=!1,this.showAll=!1,this.requireWindow=!1,this.colorIndex=0,this.showConfig=!1,this.opacity=1,this.seriesBorderRadius=2,this.seriesBorderWidth=1,this.showPercent=!1}firstUpdated(t){super.firstUpdated(t);const e=this.shadowRoot.querySelector("#canvas-wrapper");this.canvas=document.createElement("canvas"),this.canvas.setAttribute("height","300px"),e.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d")}updated(t){if(super.updated(t),t.has("splitNames")&&(this.splits=this.splitNames.split(",").map((t=>t.trim()))),(t.has("data")||t.has("splits"))&&this.calculateSplits(),t.has("datasets")&&this.updateChart(),t.has("horizontal")&&this.updateChart(),(t.has("url")||t.has("start")||t.has("end"))&&this.url&&(!this.requireWindow||this.start&&this.end)){const t=Sd();let e=this.url;const i=new URLSearchParams;if(this.start&&i.append("since",this.start),this.end&&i.append("until",this.end),i.toString()){const t=this.url.includes("?")?"&":"?";e=`${this.url}${t}${i.toString()}`}t.getUrl(e,{skipCache:!0}).then((t=>{this.data=t.json.data}))}if(t.has("chartType")&&"line"===this.chartType&&(this.seriesBorderWidth=Math.max(1,this.seriesBorderWidth)),t.has("showPercent")&&this.chart){const t=this.horizontal?this.chart.options.scales.x:this.chart.options.scales.y;t.ticks.display=!this.showPercent,t.grid.display=!this.showPercent,t.border.display=!this.showPercent,t.max=this.showPercent?this.getInflatedMax():void 0,this.chart.update()}}get colors(){const t=U_[this.palette]||U_["qualitative-set1"],e=Math.max(0,Math.min(1,this.opacity)),i=t.map((t=>Ae(t,.25))),o=t.map((t=>{if(t.startsWith("rgba"))return t.replace(/rgba\(([^,]+),([^,]+),([^,]+),([^)]+)\)/,((t,i,o,n)=>`rgba(${i},${o},${n},${e})`));if(t.startsWith("rgb("))return t.replace(/rgb\(([^,]+),([^,]+),([^,]+)\)/,((t,i,o,n)=>`rgba(${i},${o},${n},${e})`));if(t.startsWith("#")){let i=t.replace("#","");3===i.length&&(i=i.split("").map((t=>t+t)).join(""));const o=parseInt(i,16);return`rgba(${o>>16&255},${o>>8&255},${255&o},${e})`}return t}));return[o,i]}handleResize(){if(this.chart){const t=this.shadowRoot.querySelector("#canvas-wrapper");t&&t.clientHeight>this.maxChartHeight&&(this.canvas.style.height=`${this.maxChartHeight}px`,this.chart.resize())}}calculateSplits(){if(this.data){const t=[],e=[],[i,o]=this.colors;for(const n of this.data.datasets)if(this.showAll||void 0!==this.splits.find((t=>t===n.label))){const e=(t.length+this.colorIndex)%i.length,s=i[e],r=o[e];t.push({...n,backgroundColor:s,borderColor:r,borderWidth:this.seriesBorderWidth,borderRadius:this.seriesBorderRadius})}else for(let t=0;t<n.data.length;t++)void 0===e[t]?e[t]=n.data[t]:e[t]+=n.data[t];if(0===t.length){const n=this.colorIndex%i.length;t.push({label:this.single?this.dataname:`All ${this.dataname}`,data:e,backgroundColor:i[n],borderColor:o[n],borderWidth:this.seriesBorderWidth,borderRadius:this.seriesBorderRadius})}else this.hideOther||this.showAll||t.push({label:"Other",data:e,backgroundColor:j_,borderColor:Ae(j_,.05),borderWidth:1,borderRadius:this.seriesBorderRadius});this.datasets=t}}updateChart(){var t;if((null===(t=this.datasets)||void 0===t?void 0:t.length)>0){const t=this.datasets.reduce(((t,e)=>t+e.data.reduce(((t,e)=>t+(null!=e?e:0)),0)),0)||void 0,e=e=>{const i=t?e/t*100:0;return 0===i?"":`${Math.round(i)}%`};if(this.chart){this.chart.data.labels=this.data.labels,this.chart.data.datasets=this.datasets,this.showPercent&&(this.chart.options.scales.y.max=this.getInflatedMax());const t=this.chart.options.plugins.datalabels||{};t.display=this.showPercent,this.showPercent?t.formatter=e:delete t.formatter,this.chart.options.plugins.datalabels=t,this.horizontal?(this.chart.options.scales.x=this.getValueAxisConfig(),this.chart.options.scales.y=this.getCategoryAxisConfig()):(this.chart.options.scales.x=this.getCategoryAxisConfig(),this.chart.options.scales.y=this.getValueAxisConfig()),this.chart.update()}else{const t={type:this.chartType,data:{labels:this.data.labels,datasets:this.datasets},options:{...this.horizontal&&{indexAxis:"y"},maxBarThickness:80,plugins:{legend:{display:this.legend},tooltip:{callbacks:{label:t=>{const e=t.dataset.label||"",i=this.horizontal?t.parsed.x:t.parsed.y;return"duration"===this.yType?`${e}: ${V_(i)}`:`${e}: ${i}`}}},datalabels:{display:this.showPercent,anchor:"end",align:"end",offset:-3,clamp:!0,...this.showPercent&&{formatter:e},color:"#666",font:{weight:"600"}}},responsive:!0,aspectRatio:2,onResize:this.handleResize.bind(this),maintainAspectRatio:!1,animation:!1,animations:{x:{duration:0},y:{duration:0}},scales:this.horizontal?{x:this.getValueAxisConfig(),y:this.getCategoryAxisConfig()}:{y:this.getValueAxisConfig(),x:this.getCategoryAxisConfig()}}};this.chart=new oy(this.ctx,t)}}}handleSplitsChanged(t){const e=t.target;this.splits=e.values.map((t=>t.value))}handleToggleConfig(){this.showConfig=!this.showConfig,this.showConfig||(this.splits=[])}getValueAxisConfig(){return{min:0,...this.showPercent&&{max:this.getInflatedMax()},stacked:!0,grid:{color:"rgba(0,0,0,0.04)",display:!this.showPercent,drawBorder:!this.showPercent},border:{display:!this.showPercent},ticks:{display:!this.showPercent,..."duration"===this.yType&&!this.showPercent&&{callback:t=>V_(t)}}}}getCategoryAxisConfig(){let t=this.xFormat;if("time"===this.xType&&"auto"===this.xFormat){const e=this.data.labels[0],i=this.data.labels[this.data.labels.length-1],o=Date.parse(e),n=Date.parse(i);t="MMM dd",Math.ceil((n-o)/864e5)>365&&(t="MMM yyyy")}return{max:"time"===this.xType?this.end:this.xMaxTicks,min:"time"===this.xType?this.start:0,type:this.xType,grid:{display:!1},stacked:!0,ticks:{maxTicksLimit:this.xMaxTicks},..."time"===this.xType&&{time:{unit:"day",tooltipFormat:"DDD",displayFormats:{day:t}}}}}render(){var t,e,i;return H`<div>
11106
+ `}constructor(){super(),this.chartType="bar",this.horizontal=!1,this.header="",this.other=!1,this.datasets=[],this.maxSplits=2,this.xType="category",this.xMaxTicks=10,this.yType="count",this.xFormat="auto",this.maxChartHeight=250,this.hideOther=!1,this.splits=[],this.dataname="Counts",this.single=!1,this.legend=!1,this.config=!1,this.showAll=!1,this.requireWindow=!1,this.colorIndex=0,this.showConfig=!1,this.opacity=1,this.seriesBorderRadius=2,this.seriesBorderWidth=1,this.showPercent=!1}firstUpdated(t){super.firstUpdated(t);const e=this.shadowRoot.querySelector("#canvas-wrapper");this.canvas=document.createElement("canvas"),this.canvas.setAttribute("height","300px"),e.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d")}updated(t){if(super.updated(t),t.has("splitNames")&&(this.splits=this.splitNames.split(",").map((t=>t.trim()))),(t.has("data")||t.has("splits"))&&this.calculateSplits(),t.has("datasets")&&this.updateChart(),t.has("horizontal")&&this.updateChart(),(t.has("url")||t.has("start")||t.has("end"))&&this.url&&(!this.requireWindow||this.start&&this.end)){const t=Sd();let e=this.url;const i=new URLSearchParams;if(this.start&&i.append("since",this.start),this.end&&i.append("until",this.end),i.toString()){const t=this.url.includes("?")?"&":"?";e=`${this.url}${t}${i.toString()}`}t.getUrl(e,{skipCache:!0}).then((t=>{this.data=t.json.data}))}if(t.has("chartType")&&"line"===this.chartType&&(this.seriesBorderWidth=Math.max(1,this.seriesBorderWidth)),t.has("showPercent")&&this.chart){const t=this.horizontal?this.chart.options.scales.x:this.chart.options.scales.y;t.ticks.display=!this.showPercent,t.grid.display=!this.showPercent,t.border.display=!this.showPercent,t.max=this.showPercent?this.getInflatedMax():void 0,this.chart.update()}}get colors(){const t=U_[this.palette]||U_["qualitative-set1"],e=Math.max(0,Math.min(1,this.opacity)),i=t.map((t=>Ae(t,.25))),o=t.map((t=>{if(t.startsWith("rgba"))return t.replace(/rgba\(([^,]+),([^,]+),([^,]+),([^)]+)\)/,((t,i,o,n)=>`rgba(${i},${o},${n},${e})`));if(t.startsWith("rgb("))return t.replace(/rgb\(([^,]+),([^,]+),([^,]+)\)/,((t,i,o,n)=>`rgba(${i},${o},${n},${e})`));if(t.startsWith("#")){let i=t.replace("#","");3===i.length&&(i=i.split("").map((t=>t+t)).join(""));const o=parseInt(i,16);return`rgba(${o>>16&255},${o>>8&255},${255&o},${e})`}return t}));return[o,i]}handleResize(){if(this.chart){const t=this.shadowRoot.querySelector("#canvas-wrapper");t&&t.clientHeight>this.maxChartHeight&&(this.canvas.style.height=`${this.maxChartHeight}px`,this.chart.resize())}}calculateSplits(){if(this.data){const t=[],e=[],[i,o]=this.colors;for(const n of this.data.datasets)if(this.showAll||void 0!==this.splits.find((t=>t===n.label))){const e=(t.length+this.colorIndex)%i.length,s=i[e],r=o[e];t.push({...n,backgroundColor:s,borderColor:r,borderWidth:this.seriesBorderWidth,borderRadius:this.seriesBorderRadius})}else for(let t=0;t<n.data.length;t++)void 0===e[t]?e[t]=n.data[t]:e[t]+=n.data[t];if(0===t.length){const n=this.colorIndex%i.length;t.push({label:this.single?this.dataname:`All ${this.dataname}`,data:e,backgroundColor:i[n],borderColor:o[n],borderWidth:this.seriesBorderWidth,borderRadius:this.seriesBorderRadius})}else this.hideOther||this.showAll||t.push({label:"Other",data:e,backgroundColor:j_,borderColor:Ae(j_,.05),borderWidth:1,borderRadius:this.seriesBorderRadius});this.datasets=t}}updateChart(){var t;if((null===(t=this.datasets)||void 0===t?void 0:t.length)>0){const t=this.datasets.reduce(((t,e)=>t+e.data.reduce(((t,e)=>t+(null!=e?e:0)),0)),0)||void 0,e=e=>{const i=t?e/t*100:0;return 0===i?"":`${Math.round(i)}%`};if(this.chart){this.chart.data.labels=this.data.labels,this.chart.data.datasets=this.datasets,this.showPercent&&(this.chart.options.scales.y.max=this.getInflatedMax());const t=this.chart.options.plugins.datalabels||{};t.display=this.showPercent,this.showPercent?t.formatter=e:delete t.formatter,this.chart.options.plugins.datalabels=t,this.horizontal?(this.chart.options.scales.x=this.getValueAxisConfig(),this.chart.options.scales.y=this.getCategoryAxisConfig()):(this.chart.options.scales.x=this.getCategoryAxisConfig(),this.chart.options.scales.y=this.getValueAxisConfig()),this.chart.update()}else{const t={type:this.chartType,data:{labels:this.data.labels,datasets:this.datasets},options:{...this.horizontal&&{indexAxis:"y"},maxBarThickness:80,plugins:{legend:{display:this.legend},tooltip:{callbacks:{label:t=>{const e=t.dataset.label||"",i=this.horizontal?t.parsed.x:t.parsed.y;return"duration"===this.yType?`${e}: ${V_(i)}`:`${e}: ${i}`}}},datalabels:{display:this.showPercent,anchor:"end",align:"end",offset:-3,clamp:!0,...this.showPercent&&{formatter:e},color:"#666",font:{weight:"600"}}},responsive:!0,aspectRatio:2,onResize:this.handleResize.bind(this),maintainAspectRatio:!1,animation:!1,animations:{x:{duration:0},y:{duration:0}},scales:this.horizontal?{x:this.getValueAxisConfig(),y:this.getCategoryAxisConfig()}:{y:this.getValueAxisConfig(),x:this.getCategoryAxisConfig()}}};this.chart=new ob(this.ctx,t)}}}handleSplitsChanged(t){const e=t.target;this.splits=e.values.map((t=>t.value))}handleToggleConfig(){this.showConfig=!this.showConfig,this.showConfig||(this.splits=[])}getValueAxisConfig(){return{min:0,...this.showPercent&&{max:this.getInflatedMax()},stacked:!0,grid:{color:"rgba(0,0,0,0.04)",display:!this.showPercent,drawBorder:!this.showPercent},border:{display:!this.showPercent},ticks:{display:!this.showPercent,..."duration"===this.yType&&!this.showPercent&&{callback:t=>V_(t)}}}}getCategoryAxisConfig(){let t=this.xFormat;if("time"===this.xType&&"auto"===this.xFormat){const e=this.data.labels[0],i=this.data.labels[this.data.labels.length-1],o=Date.parse(e),n=Date.parse(i);t="MMM dd",Math.ceil((n-o)/864e5)>365&&(t="MMM yyyy")}return{max:"time"===this.xType?this.end:this.xMaxTicks,min:"time"===this.xType?this.start:0,type:this.xType,grid:{display:!1},stacked:!0,ticks:{maxTicksLimit:this.xMaxTicks},..."time"===this.xType&&{time:{unit:"day",tooltipFormat:"DDD",displayFormats:{day:t}}}}}render(){var t,e,i;return H`<div>
11014
11107
  ${this.header?H`<div class="chart-title">${this.header}</div>`:null}
11015
11108
  <div id="canvas-wrapper"></div>
11016
11109
  ${this.config&&this.data?H`
@@ -11317,6 +11410,11 @@ const Z_=(t,e)=>{const i=t._$AN;if(void 0===i)return!1;for(const t of i)t._$AO?.
11317
11410
  ></temba-key-value-editor>
11318
11411
  ${n.length?H`<div class="field-errors">${n.join(", ")}</div>`:""}
11319
11412
  </div>`}static renderArray(t,e,i,o){const{errors:n=[],onChange:s,showLabel:r=!0,extraClasses:a,style:l}=o;return H`<div class="form-field">
11413
+ ${e.helpText?H`<div
11414
+ style="color: #666; font-size: 13px; margin-bottom: 14px;"
11415
+ >
11416
+ ${e.helpText}
11417
+ </div>`:""}
11320
11418
  <temba-array-editor
11321
11419
  name="${t}"
11322
11420
  .label="${r?e.label:""}"
@@ -11786,7 +11884,7 @@ const Z_=(t,e)=>{const i=t._$AN;if(void 0===i)return!1;for(const t of i)t._$AO?.
11786
11884
  ${s?H`<label class="form-row-label">${s}</label>`:""}
11787
11885
  ${h}
11788
11886
  ${r?H`<div class="form-row-help">
11789
- ${yo(r)}
11887
+ ${bo(r)}
11790
11888
  </div>`:""}
11791
11889
  </div>
11792
11890
  `:h}renderGroup(t,e,i){var o,n;const{label:s,items:r,collapsible:a=!1,collapsed:l=!1,helpText:d,getGroupValueCount:c}=t;if(a&&!(s in this.groupCollapseState)){const t="function"==typeof l?l(this.formData):l;this.groupCollapseState={...this.groupCollapseState,[s]:t}}const h=!!a&&(null!==(o=this.groupCollapseState[s])&&void 0!==o?o:"function"==typeof l?l(this.formData):l),u=this.collectFieldsFromItems(r).some((t=>this.errors[t]));let p=0,m=!1,g=!1,f=!1;const v=null!==(n=this.groupHoverState[s])&&void 0!==n&&n;if(c&&a)try{const t=c(this.formData);"boolean"==typeof t?(g=t&&h&&!v,f=t):"number"==typeof t&&(p=t,m=p>0&&h&&!v,f=p>0)}catch(t){console.error(`Error calculating group value count for ${s}:`,t)}return H`
@@ -11802,7 +11900,7 @@ const Z_=(t,e)=>{const i=t._$AN;if(void 0===i)return!1;for(const t of i)t._$AO?.
11802
11900
  <div class="form-group-info">
11803
11901
  <div class="form-group-title">${s}</div>
11804
11902
  ${d?H`<div class="form-group-help">
11805
- ${yo(d)}
11903
+ ${bo(d)}
11806
11904
  </div>`:""}
11807
11905
  </div>
11808
11906
  ${u?H`<temba-icon
@@ -12320,7 +12418,7 @@ const Z_=(t,e)=>{const i=t._$AN;if(void 0===i)return!1;for(const t of i)t._$AO?.
12320
12418
  </div>
12321
12419
  <div class="label">${this.label}</div>
12322
12420
  </div>
12323
- `}}dw.TAB_HEIGHT=50,dw.TAB_GAP=4,dw.START_TOP=100,dw.allTabs=[],t([mt({type:String})],dw.prototype,"icon",void 0),t([mt({type:String})],dw.prototype,"label",void 0),t([mt({type:String})],dw.prototype,"color",void 0),t([mt({type:Number})],dw.prototype,"order",void 0),t([gt()],dw.prototype,"top",void 0),t([mt({type:Boolean})],dw.prototype,"hidden",void 0);class cw extends Ne{constructor(){super(...arguments),this.header="",this.width=500,this.minHeight=200,this.maxHeight=800,this.top=100,this.left=-1,this.hidden=!0,this.dragging=!1,this.chromeless=!1,this.color="#6B7280",this.leftBoundaryMargin=0,this.rightBoundaryMargin=0,this.topBoundaryMargin=0,this.bottomBoundaryMargin=0,this.dragStartX=0,this.dragStartY=0,this.dragOffsetX=0,this.dragOffsetY=0,this.positionFromRight=!1,this.defaultTop=100,this.defaultLeft=-1,this.handleSlotMouseDown=t=>{t.target.closest(".drag-handle")&&(this.dragging=!0,this.dragStartX=t.clientX,this.dragStartY=t.clientY,this.dragOffsetX=this.left,this.dragOffsetY=this.top,document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp),t.preventDefault())},this.handleMouseMove=t=>{var e;if(!this.dragging)return;const i=t.clientX-this.dragStartX,o=t.clientY-this.dragStartY;this.left=this.dragOffsetX+i,this.top=this.dragOffsetY+o;this.left=Math.max(20-this.leftBoundaryMargin,Math.min(this.left,window.innerWidth-this.width-20+this.rightBoundaryMargin));const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".window"),s=(null==n?void 0:n.offsetHeight)||this.maxHeight||window.innerHeight,r=Math.max(20-this.topBoundaryMargin,window.innerHeight-s-20+this.bottomBoundaryMargin);this.top=Math.max(20-this.topBoundaryMargin,Math.min(this.top,r))},this.handleMouseUp=()=>{this.dragging=!1,document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),this.positionFromRight=!1},this.handleResize=()=>{var t;if(this.hidden)return;const e=20,i=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".window"),o=(null==i?void 0:i.offsetHeight)||this.maxHeight||window.innerHeight;if(this.positionFromRight)this.left=window.innerWidth-this.width-e+this.rightBoundaryMargin;else{const t=e-this.leftBoundaryMargin,i=window.innerWidth-this.width-e+this.rightBoundaryMargin;this.left<t?this.left=t:this.left>i&&(this.left=i)}const n=e-this.topBoundaryMargin,s=Math.max(e-this.topBoundaryMargin,window.innerHeight-o-e+this.bottomBoundaryMargin);this.top<n?this.top=n:this.top>s&&(this.top=s)}}static get styles(){return a`
12421
+ `}}dw.TAB_HEIGHT=50,dw.TAB_GAP=4,dw.START_TOP=115,dw.allTabs=[],t([mt({type:String})],dw.prototype,"icon",void 0),t([mt({type:String})],dw.prototype,"label",void 0),t([mt({type:String})],dw.prototype,"color",void 0),t([mt({type:Number})],dw.prototype,"order",void 0),t([gt()],dw.prototype,"top",void 0),t([mt({type:Boolean})],dw.prototype,"hidden",void 0);class cw extends Ne{constructor(){super(...arguments),this.header="",this.width=500,this.minHeight=200,this.maxHeight=800,this.top=100,this.left=-1,this.hidden=!0,this.dragging=!1,this.chromeless=!1,this.color="#6B7280",this.leftBoundaryMargin=0,this.rightBoundaryMargin=0,this.topBoundaryMargin=0,this.bottomBoundaryMargin=0,this.dragStartX=0,this.dragStartY=0,this.dragOffsetX=0,this.dragOffsetY=0,this.positionFromRight=!1,this.defaultTop=100,this.defaultLeft=-1,this.handleSlotMouseDown=t=>{t.target.closest(".drag-handle")&&(this.dragging=!0,this.dragStartX=t.clientX,this.dragStartY=t.clientY,this.dragOffsetX=this.left,this.dragOffsetY=this.top,document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp),t.preventDefault())},this.handleMouseMove=t=>{var e;if(!this.dragging)return;const i=t.clientX-this.dragStartX,o=t.clientY-this.dragStartY;this.left=this.dragOffsetX+i,this.top=this.dragOffsetY+o;this.left=Math.max(20-this.leftBoundaryMargin,Math.min(this.left,window.innerWidth-this.width-20+this.rightBoundaryMargin));const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".window"),s=(null==n?void 0:n.offsetHeight)||this.maxHeight||window.innerHeight,r=Math.max(20-this.topBoundaryMargin,window.innerHeight-s-20+this.bottomBoundaryMargin);this.top=Math.max(20-this.topBoundaryMargin,Math.min(this.top,r))},this.handleMouseUp=()=>{this.dragging=!1,document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),this.positionFromRight=!1},this.handleResize=()=>{var t;if(this.hidden)return;const e=20,i=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".window"),o=(null==i?void 0:i.offsetHeight)||this.maxHeight||window.innerHeight;if(this.positionFromRight)this.left=window.innerWidth-this.width-e+this.rightBoundaryMargin;else{const t=e-this.leftBoundaryMargin,i=window.innerWidth-this.width-e+this.rightBoundaryMargin;this.left<t?this.left=t:this.left>i&&(this.left=i)}const n=e-this.topBoundaryMargin,s=Math.max(e-this.topBoundaryMargin,window.innerHeight-o-e+this.bottomBoundaryMargin);this.top<n?this.top=n:this.top>s&&(this.top=s)}}static get styles(){return a`
12324
12422
  .window.hidden {
12325
12423
  transform: translateX(100%);
12326
12424
  opacity: 0;
@@ -12992,19 +13090,19 @@ const Z_=(t,e)=>{const i=t._$AN;if(void 0===i)return!1;for(const t of i)t._$AO?.
12992
13090
  ${this.renderContextTree(i,o)}
12993
13091
  </div>`:H``}
12994
13092
  </div>
12995
- `}))}`}async resume(t,e){if(!t&&!e||!this.session)return;this.sprinting=!0,this.inputValue="",this.currentQuickReplies=[],this.attachmentMenuOpen=!1;const i=(new Date).toISOString(),o={uuid:Jt(),type:"msg_received",created_on:i,msg:{uuid:Jt(),text:t||"",urn:this.contact.urns[0],direction:"in",type:"text",attachments:e?[e]:[],quick_replies:[],channel:{uuid:Jt(),name:"Simulator"}}},n={...o,created_on:new Date(i)};this.chat?this.chat.addMessages([n],null,!0):this.events=[...this.events,n],this.requestUpdate(),this.scrollToBottom();const s={session:this.session,contact:this.contact,resume:{type:"msg",event:o,resumed_on:i}};try{const t=await pe(this.endpoint,s);await new Promise((t=>setTimeout(t,400))),this.updateRunContext(t.json,null)}catch(t){console.error("Failed to resume simulation:",t);const e={uuid:Jt(),type:"error",created_on:new Date(i),_rendered:{html:H`<p>Failed to send message</p>`,type:fc.Error}};this.chat?this.chat.addMessages([e],null,!0):this.events=[...this.events,e],this.sprinting=!1}}handleKeyUp(t){if("Enter"===t.key){const e=t.target.value.trim();e&&this.resume(e)}}handleInput(t){const e=t.target;this.inputValue=e.value}handleQuickReplyClick(t){!this.sprinting&&t&&this.resume(t)}handleToggleAttachmentMenu(){this.attachmentMenuOpen=!this.attachmentMenuOpen}handleClickOutsideAttachmentMenu(t){var e,i;if(!this.attachmentMenuOpen)return;const o=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".attachment-menu"),n=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector(".attachment-button");if(!o||!n)return;const s=o.contains(t.target),r=n.contains(t.target);s||r||(this.attachmentMenuOpen=!1)}handleSendAttachment(t){let e="";switch(t){case"image":e=`image/jpeg:${hw[this.imageIndex]}`,this.imageIndex=(this.imageIndex+1)%hw.length;break;case"video":e=`video/mp4:${uw[this.videoIndex]}`,this.videoIndex=(this.videoIndex+1)%uw.length;break;case"audio":e=`audio/mp3:${pw[this.audioIndex]}`,this.audioIndex=(this.audioIndex+1)%pw.length;break;case"location":e=mw[this.locationIndex],this.locationIndex=(this.locationIndex+1)%mw.length}e&&this.resume("",e)}updateBottomInputHeight(){requestAnimationFrame((()=>{var t;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".bottom-input-container");if(e){const t=e.offsetHeight;this.style.setProperty("--bottom-input-height",`${t}px`)}}))}render(){const t=this.sizeConfig,e=`\n --phone-width: ${t.phoneWidth}px;\n --phone-total-height: ${t.phoneTotalHeight}px;\n --context-width: ${t.contextWidth}px;\n --context-offset: ${t.contextOffset}px;\n --option-pane-width: ${t.optionPaneWidth}px;\n --option-pane-gap: ${t.optionPaneGap}px;\n --window-padding: ${t.windowPadding}px;\n --phone-screen-height: ${t.phoneScreenHeight}px;\n --context-height: ${t.contextHeight}px;\n --context-closed-left: ${this.contextClosedLeft}px;\n --cutout-height: ${t.cutoutHeight}px;\n --cutout-padding: ${t.cutoutPadding}px;\n --cutout-font-size: ${t.cutoutFontSize}px;\n --cutout-island-width: ${t.cutoutIslandWidth}px;\n --cutout-island-height: ${t.cutoutIslandHeight}px;\n --cutout-island-top: ${t.cutoutIslandTop}px;\n --animation-time: ${this.animationTime}ms;\n `;return H`
13093
+ `}))}`}async resume(t,e){if(!t&&!e||!this.session)return;this.sprinting=!0,this.inputValue="",this.currentQuickReplies=[],this.attachmentMenuOpen=!1;const i=(new Date).toISOString(),o={uuid:Jt(),type:"msg_received",created_on:i,msg:{uuid:Jt(),text:t||"",urn:this.contact.urns[0],direction:"in",type:"text",attachments:e?[e]:[],quick_replies:[],channel:{uuid:Jt(),name:"Simulator"}}},n={...o,created_on:new Date(i)};this.chat?this.chat.addMessages([n],null,!0):this.events=[...this.events,n],this.requestUpdate(),this.scrollToBottom();const s={session:this.session,contact:this.contact,resume:{type:"msg",event:o,resumed_on:i}};try{const t=await pe(this.endpoint,s);await new Promise((t=>setTimeout(t,400))),this.updateRunContext(t.json,null)}catch(t){console.error("Failed to resume simulation:",t);const e={uuid:Jt(),type:"error",created_on:new Date(i),_rendered:{html:H`<p>Failed to send message</p>`,type:fc.Error}};this.chat?this.chat.addMessages([e],null,!0):this.events=[...this.events,e],this.sprinting=!1}}handleKeyUp(t){if("Enter"===t.key){const e=t.target.value.trim();e&&this.resume(e)}}handleInput(t){const e=t.target;this.inputValue=e.value}handleQuickReplyClick(t){!this.sprinting&&t&&this.resume(t)}handleToggleAttachmentMenu(){this.attachmentMenuOpen=!this.attachmentMenuOpen}handleClickOutsideAttachmentMenu(t){var e,i;if(!this.attachmentMenuOpen)return;const o=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".attachment-menu"),n=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector(".attachment-button");if(!o||!n)return;const s=o.contains(t.target),r=n.contains(t.target);s||r||(this.attachmentMenuOpen=!1)}handleSendAttachment(t){let e="";switch(t){case"image":e=`image/jpeg:${hw[this.imageIndex]}`,this.imageIndex=(this.imageIndex+1)%hw.length;break;case"video":e=`video/mp4:${uw[this.videoIndex]}`,this.videoIndex=(this.videoIndex+1)%uw.length;break;case"audio":e=`audio/mp3:${pw[this.audioIndex]}`,this.audioIndex=(this.audioIndex+1)%pw.length;break;case"location":e=mw[this.locationIndex],this.locationIndex=(this.locationIndex+1)%mw.length}e&&this.resume("",e)}updateBottomInputHeight(){requestAnimationFrame((()=>{var t;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".bottom-input-container");if(e){const t=e.offsetHeight;this.style.setProperty("--bottom-input-height",`${t}px`)}}))}render(){var t;if(this.viewingRevision||0===(null===(t=this.definition)||void 0===t?void 0:t.nodes.length))return H``;const e=this.sizeConfig,i=`\n --phone-width: ${e.phoneWidth}px;\n --phone-total-height: ${e.phoneTotalHeight}px;\n --context-width: ${e.contextWidth}px;\n --context-offset: ${e.contextOffset}px;\n --option-pane-width: ${e.optionPaneWidth}px;\n --option-pane-gap: ${e.optionPaneGap}px;\n --window-padding: ${e.windowPadding}px;\n --phone-screen-height: ${e.phoneScreenHeight}px;\n --context-height: ${e.contextHeight}px;\n --context-closed-left: ${this.contextClosedLeft}px;\n --cutout-height: ${e.cutoutHeight}px;\n --cutout-padding: ${e.cutoutPadding}px;\n --cutout-font-size: ${e.cutoutFontSize}px;\n --cutout-island-width: ${e.cutoutIslandWidth}px;\n --cutout-island-height: ${e.cutoutIslandHeight}px;\n --cutout-island-top: ${e.cutoutIslandTop}px;\n --animation-time: ${this.animationTime}ms;\n `;return H`
12996
13094
  <temba-floating-window
12997
13095
  style="--transition-duration: ${this.animationTime}ms"
12998
13096
  id="phone-window"
12999
13097
  width="${this.windowWidth}"
13000
13098
  leftBoundaryMargin="${this.leftBoundaryMargin}"
13001
- bottomBoundaryMargin="${t.windowPadding}"
13002
- topBoundaryMargin="${t.windowPadding}"
13003
- height="${t.phoneTotalHeight}"
13099
+ bottomBoundaryMargin="${e.windowPadding}"
13100
+ topBoundaryMargin="${e.windowPadding}"
13101
+ height="${e.phoneTotalHeight}"
13004
13102
  top="0"
13005
13103
  chromeless
13006
13104
  >
13007
- <div class="phone-simulator" style="${e}">
13105
+ <div class="phone-simulator" style="${i}">
13008
13106
  <div
13009
13107
  class="context-explorer ${this.contextExplorerOpen?"open":""} ${this.isVisible?"visible":"hidden"}"
13010
13108
  >
@@ -13170,7 +13268,7 @@ const Z_=(t,e)=>{const i=t._$AN;if(void 0===i)return!1;for(const t of i)t._$AO?.
13170
13268
  .hidden=${this.isVisible}
13171
13269
  @temba-button-clicked=${this.handleShow}
13172
13270
  ></temba-floating-tab>
13173
- `}}function vw(t,e){window.customElements.get(t)||window.customElements.define(t,e)}t([mt({type:String})],fw.prototype,"flow",void 0),t([mt({type:String})],fw.prototype,"endpoint",void 0),t([mt({type:Number})],fw.prototype,"animationTime",void 0),t([_e("simulator-size","small")],fw.prototype,"size",void 0),t([mt({type:Array})],fw.prototype,"events",void 0),t([mt({type:Object})],fw.prototype,"session",void 0),t([mt({type:Object})],fw.prototype,"context",void 0),t([mt({type:Object})],fw.prototype,"contact",void 0),t([mt({type:Boolean})],fw.prototype,"sprinting",void 0),t([mt({type:String})],fw.prototype,"inputValue",void 0),t([_e("simulator-follow",!0)],fw.prototype,"following",void 0),t([_e("simulator-context-open",!1)],fw.prototype,"contextExplorerOpen",void 0),t([mt({type:Object})],fw.prototype,"expandedPaths",void 0),t([mt({type:String})],fw.prototype,"copiedExpression",void 0),t([mt({type:String})],fw.prototype,"toastMessage",void 0),t([mt({type:Boolean})],fw.prototype,"showAllKeys",void 0),t([mt({type:Array})],fw.prototype,"currentQuickReplies",void 0),t([mt({type:Boolean})],fw.prototype,"isVisible",void 0),t([mt({type:Boolean})],fw.prototype,"attachmentMenuOpen",void 0),vw("temba-anchor",qc),vw("temba-alert",Ic),vw("temba-store",Ad),vw("temba-textinput",Io),vw("temba-datepicker",rh),vw("temba-range-picker",W_),vw("temba-date",mh),vw("temba-completion",Ud),vw("temba-checkbox",wo),vw("temba-select",qd),vw("temba-options",Ed),vw("temba-loading",Yd),vw("temba-lightbox",fh),vw("temba-button",Zd),vw("temba-omnibox",Rc),vw("temba-tip",Nc),vw("temba-contact-name",Wc),vw("temba-contact-name-fetch",sh),vw("temba-contact-field",Kc),vw("temba-contact-fields",Yc),vw("temba-field-manager",dh),vw("temba-urn",Zc),vw("temba-content-menu",uh),vw("temba-dialog",Hd),vw("temba-modax",Wd),vw("temba-charcount",oc),vw("temba-contact-chat",Sc),vw("temba-contact-details",class extends rc{static get styles(){return a`
13271
+ `}}function vw(t,e){window.customElements.get(t)||window.customElements.define(t,e)}t([kd(_d,(t=>t.flowDefinition))],fw.prototype,"definition",void 0),t([kd(_d,(t=>t.viewingRevision))],fw.prototype,"viewingRevision",void 0),t([mt({type:String})],fw.prototype,"flow",void 0),t([mt({type:String})],fw.prototype,"endpoint",void 0),t([mt({type:Number})],fw.prototype,"animationTime",void 0),t([_e("simulator-size","small")],fw.prototype,"size",void 0),t([mt({type:Array})],fw.prototype,"events",void 0),t([mt({type:Object})],fw.prototype,"session",void 0),t([mt({type:Object})],fw.prototype,"context",void 0),t([mt({type:Object})],fw.prototype,"contact",void 0),t([mt({type:Boolean})],fw.prototype,"sprinting",void 0),t([mt({type:String})],fw.prototype,"inputValue",void 0),t([_e("simulator-follow",!0)],fw.prototype,"following",void 0),t([_e("simulator-context-open",!1)],fw.prototype,"contextExplorerOpen",void 0),t([mt({type:Object})],fw.prototype,"expandedPaths",void 0),t([mt({type:String})],fw.prototype,"copiedExpression",void 0),t([mt({type:String})],fw.prototype,"toastMessage",void 0),t([mt({type:Boolean})],fw.prototype,"showAllKeys",void 0),t([mt({type:Array})],fw.prototype,"currentQuickReplies",void 0),t([mt({type:Boolean})],fw.prototype,"isVisible",void 0),t([mt({type:Boolean})],fw.prototype,"attachmentMenuOpen",void 0),vw("temba-anchor",qc),vw("temba-alert",Ic),vw("temba-store",Ad),vw("temba-textinput",Io),vw("temba-datepicker",rh),vw("temba-range-picker",W_),vw("temba-date",mh),vw("temba-completion",Ud),vw("temba-checkbox",wo),vw("temba-select",qd),vw("temba-options",Ed),vw("temba-loading",Yd),vw("temba-lightbox",fh),vw("temba-button",Zd),vw("temba-omnibox",Rc),vw("temba-tip",Nc),vw("temba-contact-name",Wc),vw("temba-contact-name-fetch",sh),vw("temba-contact-field",Kc),vw("temba-contact-fields",Yc),vw("temba-field-manager",dh),vw("temba-urn",Zc),vw("temba-content-menu",uh),vw("temba-dialog",Hd),vw("temba-modax",Wd),vw("temba-charcount",oc),vw("temba-contact-chat",Sc),vw("temba-contact-details",class extends rc{static get styles(){return a`
13174
13272
  .urn {
13175
13273
  display: flex;
13176
13274
  padding: 0.4em 1em 0.8em 1em;
@@ -13294,7 +13392,7 @@ const Z_=(t,e)=>{const i=t._$AN;if(void 0===i)return!1;for(const t of i)t._$AO?.
13294
13392
  </div>`}}renderHeader(){return H`<div class="header">
13295
13393
  <temba-icon name="notification"></temba-icon>
13296
13394
  <div class="title">Notifications</div>
13297
- </div>`}scrollToTop(){window.setTimeout((()=>{this.shadowRoot.querySelector("temba-options").scrollToTop()}),1e3)}}),vw("temba-list",$c),vw("temba-sortable-list",$d),vw("temba-run-list",oh),vw("temba-flow-details",nh),vw("temba-label",Hc),vw("temba-menu",Fc),vw("temba-contact-search",Oc),vw("temba-icon",Lc),vw("temba-dropdown",Uc),vw("temba-tabs",jc),vw("temba-tab",Vc),vw("temba-contact-badges",Qc),vw("temba-contact-pending",th),vw("temba-slider",eh),vw("temba-content-menu",uh),vw("temba-compose",gh),vw("temba-color-picker",vh),vw("temba-resizer",bh),vw("temba-thumbnail",wh),vw("temba-webchat",Sh),vw("temba-image-picker",Eh),vw("temba-mask",$h),vw("temba-user",wl),vw("temba-template-editor",Th),vw("temba-toast",Dh),vw("temba-chat",xc),vw("temba-media-picker",Ih),vw("temba-flow-editor",xp),vw("temba-node-editor",nw),vw("temba-flow-node",yp),vw("temba-sticky-note",_p),vw("temba-canvas-menu",wp),vw("temba-node-type-selector",kp),vw("temba-contact-notepad",Cp),vw("temba-progress",Sp),vw("temba-start-progress",Ap),vw("temba-shortcuts",Ep),vw("temba-popup-select",$p),vw("temba-user-select",Tp),vw("temba-workspace-select",Dp),vw("temba-chart",H_),vw("temba-key-value-editor",rw),vw("temba-array-editor",aw),vw("temba-message-editor",lw),vw("temba-floating-tab",dw),vw("temba-floating-window",cw),vw("temba-simulator",fw);class bw extends dt{static get styles(){return a`
13395
+ </div>`}scrollToTop(){window.setTimeout((()=>{this.shadowRoot.querySelector("temba-options").scrollToTop()}),1e3)}}),vw("temba-list",$c),vw("temba-sortable-list",$d),vw("temba-run-list",oh),vw("temba-flow-details",nh),vw("temba-label",Hc),vw("temba-menu",Fc),vw("temba-contact-search",Oc),vw("temba-icon",Lc),vw("temba-dropdown",Uc),vw("temba-tabs",jc),vw("temba-tab",Vc),vw("temba-contact-badges",Qc),vw("temba-contact-pending",th),vw("temba-slider",eh),vw("temba-content-menu",uh),vw("temba-compose",gh),vw("temba-color-picker",vh),vw("temba-resizer",yh),vw("temba-thumbnail",wh),vw("temba-webchat",Sh),vw("temba-image-picker",Eh),vw("temba-mask",$h),vw("temba-user",wl),vw("temba-template-editor",Th),vw("temba-toast",Dh),vw("temba-chat",xc),vw("temba-media-picker",Ih),vw("temba-flow-editor",xp),vw("temba-node-editor",nw),vw("temba-flow-node",bp),vw("temba-sticky-note",_p),vw("temba-canvas-menu",wp),vw("temba-node-type-selector",kp),vw("temba-contact-notepad",Cp),vw("temba-progress",Sp),vw("temba-start-progress",Ap),vw("temba-shortcuts",Ep),vw("temba-popup-select",$p),vw("temba-user-select",Tp),vw("temba-workspace-select",Dp),vw("temba-chart",H_),vw("temba-key-value-editor",rw),vw("temba-array-editor",aw),vw("temba-message-editor",lw),vw("temba-floating-tab",dw),vw("temba-floating-window",cw),vw("temba-simulator",fw);class yw extends dt{static get styles(){return a`
13298
13396
  :host {
13299
13397
  line-height: normal;
13300
13398
  }
@@ -13502,7 +13600,7 @@ const Z_=(t,e)=>{const i=t._$AN;if(void 0===i)return!1;for(const t of i)t._$AO?.
13502
13600
  ></temba-textinput>
13503
13601
  </div>
13504
13602
  </temba-dialog>
13505
- `}}t([mt({type:Array,attribute:!1})],bw.prototype,"path",void 0),t([mt()],bw.prototype,"endpoint",void 0),t([mt()],bw.prototype,"osmId",void 0),t([mt({type:Object})],bw.prototype,"hovered",void 0),t([mt({type:Object})],bw.prototype,"editFeature",void 0),t([mt({type:String,attribute:!1})],bw.prototype,"editFeatureAliases",void 0);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var yw={exports:{}};(function(t){var e="1.5.1+build.2e3e0ffb",i=Object.freeze;function o(t){var e,i,o,n;for(i=1,o=arguments.length;i<o;i++)for(e in n=arguments[i])t[e]=n[e];return t}Object.freeze=function(t){return t};var n=Object.create||function(){function t(){}return function(e){return t.prototype=e,new t}}();function s(t,e){var i=Array.prototype.slice;if(t.bind)return t.bind.apply(t,i.call(arguments,1));var o=i.call(arguments,2);return function(){return t.apply(e,o.length?o.concat(i.call(arguments)):arguments)}}var r=0;function a(t){return t._leaflet_id=t._leaflet_id||++r,t._leaflet_id}function l(t,e,i){var o,n,s,r;return r=function(){o=!1,n&&(s.apply(i,n),n=!1)},s=function(){o?n=arguments:(t.apply(i,arguments),setTimeout(r,e),o=!0)},s}function d(t,e,i){var o=e[1],n=e[0],s=o-n;return t===o&&i?t:((t-n)%s+s)%s+n}function c(){return!1}function h(t,e){return e=void 0===e?6:e,+(Math.round(t+"e+"+e)+"e-"+e)}function u(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function p(t){return u(t).split(/\s+/)}function m(t,e){for(var i in t.hasOwnProperty("options")||(t.options=t.options?n(t.options):{}),e)t.options[i]=e[i];return t.options}function g(t,e,i){var o=[];for(var n in t)o.push(encodeURIComponent(i?n.toUpperCase():n)+"="+encodeURIComponent(t[n]));return(e&&-1!==e.indexOf("?")?"&":"?")+o.join("&")}var f=/\{ *([\w_-]+) *\}/g;function v(t,e){return t.replace(f,(function(t,i){var o=e[i];if(void 0===o)throw new Error("No value provided for variable "+t);return"function"==typeof o&&(o=o(e)),o}))}var b=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function y(t,e){for(var i=0;i<t.length;i++)if(t[i]===e)return i;return-1}var x="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function _(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var w=0;function k(t){var e=+new Date,i=Math.max(0,16-(e-w));return w=e+i,window.setTimeout(t,i)}var C=window.requestAnimationFrame||_("RequestAnimationFrame")||k,S=window.cancelAnimationFrame||_("CancelAnimationFrame")||_("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function A(t,e,i){if(!i||C!==k)return C.call(window,s(t,e));t.call(e)}function E(t){t&&S.call(window,t)}var $=(Object.freeze||Object)({freeze:i,extend:o,create:n,bind:s,lastId:r,stamp:a,throttle:l,wrapNum:d,falseFn:c,formatNum:h,trim:u,splitWords:p,setOptions:m,getParamString:g,template:v,isArray:b,indexOf:y,emptyImageUrl:x,requestFn:C,cancelFn:S,requestAnimFrame:A,cancelAnimFrame:E});function T(){}function D(t){if("undefined"!=typeof L&&L&&L.Mixin){t=b(t)?t:[t];for(var e=0;e<t.length;e++)t[e]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",(new Error).stack)}}T.extend=function(t){var e=function(){this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},i=e.__super__=this.prototype,s=n(i);for(var r in s.constructor=e,e.prototype=s,this)this.hasOwnProperty(r)&&"prototype"!==r&&"__super__"!==r&&(e[r]=this[r]);return t.statics&&(o(e,t.statics),delete t.statics),t.includes&&(D(t.includes),o.apply(null,[s].concat(t.includes)),delete t.includes),s.options&&(t.options=o(n(s.options),t.options)),o(s,t),s._initHooks=[],s.callInitHooks=function(){if(!this._initHooksCalled){i.callInitHooks&&i.callInitHooks.call(this),this._initHooksCalled=!0;for(var t=0,e=s._initHooks.length;t<e;t++)s._initHooks[t].call(this)}},e},T.include=function(t){return o(this.prototype,t),this},T.mergeOptions=function(t){return o(this.prototype.options,t),this},T.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),i="function"==typeof t?t:function(){this[t].apply(this,e)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(i),this};var M={on:function(t,e,i){if("object"==typeof t)for(var o in t)this._on(o,t[o],e);else for(var n=0,s=(t=p(t)).length;n<s;n++)this._on(t[n],e,i);return this},off:function(t,e,i){if(t)if("object"==typeof t)for(var o in t)this._off(o,t[o],e);else for(var n=0,s=(t=p(t)).length;n<s;n++)this._off(t[n],e,i);else delete this._events;return this},_on:function(t,e,i){this._events=this._events||{};var o=this._events[t];o||(o=[],this._events[t]=o),i===this&&(i=void 0);for(var n={fn:e,ctx:i},s=o,r=0,a=s.length;r<a;r++)if(s[r].fn===e&&s[r].ctx===i)return;s.push(n)},_off:function(t,e,i){var o,n,s;if(this._events&&(o=this._events[t]))if(e){if(i===this&&(i=void 0),o)for(n=0,s=o.length;n<s;n++){var r=o[n];if(r.ctx===i&&r.fn===e)return r.fn=c,this._firingCount&&(this._events[t]=o=o.slice()),void o.splice(n,1)}}else{for(n=0,s=o.length;n<s;n++)o[n].fn=c;delete this._events[t]}},fire:function(t,e,i){if(!this.listens(t,i))return this;var n=o({},e,{type:t,target:this,sourceTarget:e&&e.sourceTarget||this});if(this._events){var s=this._events[t];if(s){this._firingCount=this._firingCount+1||1;for(var r=0,a=s.length;r<a;r++){var l=s[r];l.fn.call(l.ctx||this,n)}this._firingCount--}}return i&&this._propagateEvent(n),this},listens:function(t,e){var i=this._events&&this._events[t];if(i&&i.length)return!0;if(e)for(var o in this._eventParents)if(this._eventParents[o].listens(t,e))return!0;return!1},once:function(t,e,i){if("object"==typeof t){for(var o in t)this.once(o,t[o],e);return this}var n=s((function(){this.off(t,e,i).off(t,n,i)}),this);return this.on(t,e,i).on(t,n,i)},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[a(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[a(t)],this},_propagateEvent:function(t){for(var e in this._eventParents)this._eventParents[e].fire(t.type,o({layer:t.target,propagatedFrom:t.target},t),!0)}};M.addEventListener=M.on,M.removeEventListener=M.clearAllEventListeners=M.off,M.addOneTimeEventListener=M.once,M.fireEvent=M.fire,M.hasEventListeners=M.listens;var I=T.extend(M);function O(t,e,i){this.x=i?Math.round(t):t,this.y=i?Math.round(e):e}var z=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};function P(t,e,i){return t instanceof O?t:b(t)?new O(t[0],t[1]):null==t?t:"object"==typeof t&&"x"in t&&"y"in t?new O(t.x,t.y):new O(t,e,i)}function R(t,e){if(t)for(var i=e?[t,e]:t,o=0,n=i.length;o<n;o++)this.extend(i[o])}function N(t,e){return!t||t instanceof R?t:new R(t,e)}function B(t,e){if(t)for(var i=e?[t,e]:t,o=0,n=i.length;o<n;o++)this.extend(i[o])}function F(t,e){return t instanceof B?t:new B(t,e)}function q(t,e,i){if(isNaN(t)||isNaN(e))throw new Error("Invalid LatLng object: ("+t+", "+e+")");this.lat=+t,this.lng=+e,void 0!==i&&(this.alt=+i)}function U(t,e,i){return t instanceof q?t:b(t)&&"object"!=typeof t[0]?3===t.length?new q(t[0],t[1],t[2]):2===t.length?new q(t[0],t[1]):null:null==t?t:"object"==typeof t&&"lat"in t?new q(t.lat,"lng"in t?t.lng:t.lon,t.alt):void 0===e?null:new q(t,e,i)}O.prototype={clone:function(){return new O(this.x,this.y)},add:function(t){return this.clone()._add(P(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(P(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new O(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new O(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=z(this.x),this.y=z(this.y),this},distanceTo:function(t){var e=(t=P(t)).x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){return(t=P(t)).x===this.x&&t.y===this.y},contains:function(t){return t=P(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+h(this.x)+", "+h(this.y)+")"}},R.prototype={extend:function(t){return t=P(t),this.min||this.max?(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(t.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(t.y,this.max.y)):(this.min=t.clone(),this.max=t.clone()),this},getCenter:function(t){return new O((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return new O(this.min.x,this.max.y)},getTopRight:function(){return new O(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var e,i;return(t="number"==typeof t[0]||t instanceof O?P(t):N(t))instanceof R?(e=t.min,i=t.max):e=i=t,e.x>=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y},intersects:function(t){t=N(t);var e=this.min,i=this.max,o=t.min,n=t.max,s=n.x>=e.x&&o.x<=i.x,r=n.y>=e.y&&o.y<=i.y;return s&&r},overlaps:function(t){t=N(t);var e=this.min,i=this.max,o=t.min,n=t.max,s=n.x>e.x&&o.x<i.x,r=n.y>e.y&&o.y<i.y;return s&&r},isValid:function(){return!(!this.min||!this.max)}},B.prototype={extend:function(t){var e,i,o=this._southWest,n=this._northEast;if(t instanceof q)e=t,i=t;else{if(!(t instanceof B))return t?this.extend(U(t)||F(t)):this;if(e=t._southWest,i=t._northEast,!e||!i)return this}return o||n?(o.lat=Math.min(e.lat,o.lat),o.lng=Math.min(e.lng,o.lng),n.lat=Math.max(i.lat,n.lat),n.lng=Math.max(i.lng,n.lng)):(this._southWest=new q(e.lat,e.lng),this._northEast=new q(i.lat,i.lng)),this},pad:function(t){var e=this._southWest,i=this._northEast,o=Math.abs(e.lat-i.lat)*t,n=Math.abs(e.lng-i.lng)*t;return new B(new q(e.lat-o,e.lng-n),new q(i.lat+o,i.lng+n))},getCenter:function(){return new q((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new q(this.getNorth(),this.getWest())},getSouthEast:function(){return new q(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(t){t="number"==typeof t[0]||t instanceof q||"lat"in t?U(t):F(t);var e,i,o=this._southWest,n=this._northEast;return t instanceof B?(e=t.getSouthWest(),i=t.getNorthEast()):e=i=t,e.lat>=o.lat&&i.lat<=n.lat&&e.lng>=o.lng&&i.lng<=n.lng},intersects:function(t){t=F(t);var e=this._southWest,i=this._northEast,o=t.getSouthWest(),n=t.getNorthEast(),s=n.lat>=e.lat&&o.lat<=i.lat,r=n.lng>=e.lng&&o.lng<=i.lng;return s&&r},overlaps:function(t){t=F(t);var e=this._southWest,i=this._northEast,o=t.getSouthWest(),n=t.getNorthEast(),s=n.lat>e.lat&&o.lat<i.lat,r=n.lng>e.lng&&o.lng<i.lng;return s&&r},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,e){return!!t&&(t=F(t),this._southWest.equals(t.getSouthWest(),e)&&this._northEast.equals(t.getNorthEast(),e))},isValid:function(){return!(!this._southWest||!this._northEast)}},q.prototype={equals:function(t,e){return!!t&&(t=U(t),Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng))<=(void 0===e?1e-9:e))},toString:function(t){return"LatLng("+h(this.lat,t)+", "+h(this.lng,t)+")"},distanceTo:function(t){return V.distance(this,U(t))},wrap:function(){return V.wrapLatLng(this)},toBounds:function(t){var e=180*t/40075017,i=e/Math.cos(Math.PI/180*this.lat);return F([this.lat-e,this.lng-i],[this.lat+e,this.lng+i])},clone:function(){return new q(this.lat,this.lng,this.alt)}};var j={latLngToPoint:function(t,e){var i=this.projection.project(t),o=this.scale(e);return this.transformation._transform(i,o)},pointToLatLng:function(t,e){var i=this.scale(e),o=this.transformation.untransform(t,i);return this.projection.unproject(o)},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},scale:function(t){return 256*Math.pow(2,t)},zoom:function(t){return Math.log(t/256)/Math.LN2},getProjectedBounds:function(t){if(this.infinite)return null;var e=this.projection.bounds,i=this.scale(t);return new R(this.transformation.transform(e.min,i),this.transformation.transform(e.max,i))},infinite:!1,wrapLatLng:function(t){var e=this.wrapLng?d(t.lng,this.wrapLng,!0):t.lng;return new q(this.wrapLat?d(t.lat,this.wrapLat,!0):t.lat,e,t.alt)},wrapLatLngBounds:function(t){var e=t.getCenter(),i=this.wrapLatLng(e),o=e.lat-i.lat,n=e.lng-i.lng;if(0===o&&0===n)return t;var s=t.getSouthWest(),r=t.getNorthEast();return new B(new q(s.lat-o,s.lng-n),new q(r.lat-o,r.lng-n))}},V=o({},j,{wrapLng:[-180,180],R:6371e3,distance:function(t,e){var i=Math.PI/180,o=t.lat*i,n=e.lat*i,s=Math.sin((e.lat-t.lat)*i/2),r=Math.sin((e.lng-t.lng)*i/2),a=s*s+Math.cos(o)*Math.cos(n)*r*r,l=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return this.R*l}}),H=6378137,W={R:H,MAX_LATITUDE:85.0511287798,project:function(t){var e=Math.PI/180,i=this.MAX_LATITUDE,o=Math.max(Math.min(i,t.lat),-i),n=Math.sin(o*e);return new O(this.R*t.lng*e,this.R*Math.log((1+n)/(1-n))/2)},unproject:function(t){var e=180/Math.PI;return new q((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:function(){var t=H*Math.PI;return new R([-t,-t],[t,t])}()};function Z(t,e,i,o){if(b(t))return this._a=t[0],this._b=t[1],this._c=t[2],void(this._d=t[3]);this._a=t,this._b=e,this._c=i,this._d=o}function Y(t,e,i,o){return new Z(t,e,i,o)}Z.prototype={transform:function(t,e){return this._transform(t.clone(),e)},_transform:function(t,e){return e=e||1,t.x=e*(this._a*t.x+this._b),t.y=e*(this._c*t.y+this._d),t},untransform:function(t,e){return e=e||1,new O((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}};var G=o({},V,{code:"EPSG:3857",projection:W,transformation:function(){var t=.5/(Math.PI*W.R);return Y(t,.5,-t,.5)}()}),K=o({},G,{code:"EPSG:900913"});function X(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Q(t,e){var i,o,n,s,r,a,l="";for(i=0,n=t.length;i<n;i++){for(o=0,s=(r=t[i]).length;o<s;o++)l+=(o?"L":"M")+(a=r[o]).x+" "+a.y;l+=e?Tt?"z":"x":""}return l||"M0 0"}var J=document.documentElement.style,tt="ActiveXObject"in window,et=tt&&!document.addEventListener,it="msLaunchUri"in navigator&&!("documentMode"in document),ot=Mt("webkit"),nt=Mt("android"),st=Mt("android 2")||Mt("android 3"),rt=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),at=nt&&Mt("Google")&&rt<537&&!("AudioNode"in window),lt=!!window.opera,dt=Mt("chrome"),ct=Mt("gecko")&&!ot&&!lt&&!tt,ht=!dt&&Mt("safari"),ut=Mt("phantom"),pt="OTransition"in J,mt=0===navigator.platform.indexOf("Win"),gt=tt&&"transition"in J,ft="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!st,vt="MozPerspective"in J,bt=!window.L_DISABLE_3D&&(gt||ft||vt)&&!pt&&!ut,yt="undefined"!=typeof orientation||Mt("mobile"),xt=yt&&ot,_t=yt&&ft,wt=!window.PointerEvent&&window.MSPointerEvent,kt=!(!window.PointerEvent&&!wt),Ct=!window.L_NO_TOUCH&&(kt||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),St=yt&&lt,At=yt&&ct,Et=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,$t=!!document.createElement("canvas").getContext,Tt=!(!document.createElementNS||!X("svg").createSVGRect),Dt=!Tt&&function(){try{var t=document.createElement("div");t.innerHTML='<v:shape adj="1"/>';var e=t.firstChild;return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}();function Mt(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var It=(Object.freeze||Object)({ie:tt,ielt9:et,edge:it,webkit:ot,android:nt,android23:st,androidStock:at,opera:lt,chrome:dt,gecko:ct,safari:ht,phantom:ut,opera12:pt,win:mt,ie3d:gt,webkit3d:ft,gecko3d:vt,any3d:bt,mobile:yt,mobileWebkit:xt,mobileWebkit3d:_t,msPointer:wt,pointer:kt,touch:Ct,mobileOpera:St,mobileGecko:At,retina:Et,canvas:$t,svg:Tt,vml:Dt}),Ot=wt?"MSPointerDown":"pointerdown",Lt=wt?"MSPointerMove":"pointermove",zt=wt?"MSPointerUp":"pointerup",Pt=wt?"MSPointerCancel":"pointercancel",Rt=["INPUT","SELECT","OPTION"],Nt={},Bt=!1,Ft=0;function qt(t,e,i,o){return"touchstart"===e?jt(t,i,o):"touchmove"===e?Yt(t,i,o):"touchend"===e&&Gt(t,i,o),this}function Ut(t,e,i){var o=t["_leaflet_"+e+i];return"touchstart"===e?t.removeEventListener(Ot,o,!1):"touchmove"===e?t.removeEventListener(Lt,o,!1):"touchend"===e&&(t.removeEventListener(zt,o,!1),t.removeEventListener(Pt,o,!1)),this}function jt(t,e,i){var o=s((function(t){if("mouse"!==t.pointerType&&t.MSPOINTER_TYPE_MOUSE&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE){if(!(Rt.indexOf(t.target.tagName)<0))return;je(t)}Zt(t,e)}));t["_leaflet_touchstart"+i]=o,t.addEventListener(Ot,o,!1),Bt||(document.documentElement.addEventListener(Ot,Vt,!0),document.documentElement.addEventListener(Lt,Ht,!0),document.documentElement.addEventListener(zt,Wt,!0),document.documentElement.addEventListener(Pt,Wt,!0),Bt=!0)}function Vt(t){Nt[t.pointerId]=t,Ft++}function Ht(t){Nt[t.pointerId]&&(Nt[t.pointerId]=t)}function Wt(t){delete Nt[t.pointerId],Ft--}function Zt(t,e){for(var i in t.touches=[],Nt)t.touches.push(Nt[i]);t.changedTouches=[t],e(t)}function Yt(t,e,i){var o=function(t){(t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&"mouse"!==t.pointerType||0!==t.buttons)&&Zt(t,e)};t["_leaflet_touchmove"+i]=o,t.addEventListener(Lt,o,!1)}function Gt(t,e,i){var o=function(t){Zt(t,e)};t["_leaflet_touchend"+i]=o,t.addEventListener(zt,o,!1),t.addEventListener(Pt,o,!1)}var Kt=wt?"MSPointerDown":kt?"pointerdown":"touchstart",Xt=wt?"MSPointerUp":kt?"pointerup":"touchend",Qt="_leaflet_";function Jt(t,e,i){var o,n,s=!1,r=250;function a(t){var e;if(kt){if(!it||"mouse"===t.pointerType)return;e=Ft}else e=t.touches.length;if(!(e>1)){var i=Date.now(),a=i-(o||i);n=t.touches?t.touches[0]:t,s=a>0&&a<=r,o=i}}function l(t){if(s&&!n.cancelBubble){if(kt){if(!it||"mouse"===t.pointerType)return;var i,r,a={};for(r in n)i=n[r],a[r]=i&&i.bind?i.bind(n):i;n=a}n.type="dblclick",n.button=0,e(n),o=null}}return t[Qt+Kt+i]=a,t[Qt+Xt+i]=l,t[Qt+"dblclick"+i]=e,t.addEventListener(Kt,a,!1),t.addEventListener(Xt,l,!1),t.addEventListener("dblclick",e,!1),this}function te(t,e){var i=t[Qt+Kt+e],o=t[Qt+Xt+e],n=t[Qt+"dblclick"+e];return t.removeEventListener(Kt,i,!1),t.removeEventListener(Xt,o,!1),it||t.removeEventListener("dblclick",n,!1),this}var ee,ie,oe,ne,se,re=ke(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ae=ke(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),le="webkitTransition"===ae||"OTransition"===ae?ae+"End":"transitionend";function de(t){return"string"==typeof t?document.getElementById(t):t}function ce(t,e){var i=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!i||"auto"===i)&&document.defaultView){var o=document.defaultView.getComputedStyle(t,null);i=o?o[e]:null}return"auto"===i?null:i}function he(t,e,i){var o=document.createElement(t);return o.className=e||"",i&&i.appendChild(o),o}function ue(t){var e=t.parentNode;e&&e.removeChild(t)}function pe(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function me(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function ge(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function fe(t,e){if(void 0!==t.classList)return t.classList.contains(e);var i=xe(t);return i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)}function ve(t,e){if(void 0!==t.classList)for(var i=p(e),o=0,n=i.length;o<n;o++)t.classList.add(i[o]);else if(!fe(t,e)){var s=xe(t);ye(t,(s?s+" ":"")+e)}}function be(t,e){void 0!==t.classList?t.classList.remove(e):ye(t,u((" "+xe(t)+" ").replace(" "+e+" "," ")))}function ye(t,e){void 0===t.className.baseVal?t.className=e:t.className.baseVal=e}function xe(t){return t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal}function _e(t,e){"opacity"in t.style?t.style.opacity=e:"filter"in t.style&&we(t,e)}function we(t,e){var i=!1,o="DXImageTransform.Microsoft.Alpha";try{i=t.filters.item(o)}catch(t){if(1===e)return}e=Math.round(100*e),i?(i.Enabled=100!==e,i.Opacity=e):t.style.filter+=" progid:"+o+"(opacity="+e+")"}function ke(t){for(var e=document.documentElement.style,i=0;i<t.length;i++)if(t[i]in e)return t[i];return!1}function Ce(t,e,i){var o=e||new O(0,0);t.style[re]=(gt?"translate("+o.x+"px,"+o.y+"px)":"translate3d("+o.x+"px,"+o.y+"px,0)")+(i?" scale("+i+")":"")}function Se(t,e){t._leaflet_pos=e,bt?Ce(t,e):(t.style.left=e.x+"px",t.style.top=e.y+"px")}function Ae(t){return t._leaflet_pos||new O(0,0)}if("onselectstart"in document)ee=function(){ze(window,"selectstart",je)},ie=function(){Re(window,"selectstart",je)};else{var Ee=ke(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);ee=function(){if(Ee){var t=document.documentElement.style;oe=t[Ee],t[Ee]="none"}},ie=function(){Ee&&(document.documentElement.style[Ee]=oe,oe=void 0)}}function $e(){ze(window,"dragstart",je)}function Te(){Re(window,"dragstart",je)}function De(t){for(;-1===t.tabIndex;)t=t.parentNode;t.style&&(Me(),ne=t,se=t.style.outline,t.style.outline="none",ze(window,"keydown",Me))}function Me(){ne&&(ne.style.outline=se,ne=void 0,se=void 0,Re(window,"keydown",Me))}function Ie(t){do{t=t.parentNode}while(!(t.offsetWidth&&t.offsetHeight||t===document.body));return t}function Oe(t){var e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}var Le=(Object.freeze||Object)({TRANSFORM:re,TRANSITION:ae,TRANSITION_END:le,get:de,getStyle:ce,create:he,remove:ue,empty:pe,toFront:me,toBack:ge,hasClass:fe,addClass:ve,removeClass:be,setClass:ye,getClass:xe,setOpacity:_e,testProp:ke,setTransform:Ce,setPosition:Se,getPosition:Ae,disableTextSelection:ee,enableTextSelection:ie,disableImageDrag:$e,enableImageDrag:Te,preventOutline:De,restoreOutline:Me,getSizedParentNode:Ie,getScale:Oe});function ze(t,e,i,o){if("object"==typeof e)for(var n in e)Ne(t,n,e[n],i);else for(var s=0,r=(e=p(e)).length;s<r;s++)Ne(t,e[s],i,o);return this}var Pe="_leaflet_events";function Re(t,e,i,o){if("object"==typeof e)for(var n in e)Be(t,n,e[n],i);else if(e)for(var s=0,r=(e=p(e)).length;s<r;s++)Be(t,e[s],i,o);else{for(var a in t[Pe])Be(t,a,t[Pe][a]);delete t[Pe]}return this}function Ne(t,e,i,o){var n=e+a(i)+(o?"_"+a(o):"");if(t[Pe]&&t[Pe][n])return this;var s=function(e){return i.call(o||t,e||window.event)},r=s;kt&&0===e.indexOf("touch")?qt(t,e,s,n):!Ct||"dblclick"!==e||!Jt||kt&&dt?"addEventListener"in t?"mousewheel"===e?t.addEventListener("onwheel"in t?"wheel":"mousewheel",s,!1):"mouseenter"===e||"mouseleave"===e?(s=function(e){e=e||window.event,Qe(t,e)&&r(e)},t.addEventListener("mouseenter"===e?"mouseover":"mouseout",s,!1)):("click"===e&&nt&&(s=function(t){Je(t,r)}),t.addEventListener(e,s,!1)):"attachEvent"in t&&t.attachEvent("on"+e,s):Jt(t,s,n),t[Pe]=t[Pe]||{},t[Pe][n]=s}function Be(t,e,i,o){var n=e+a(i)+(o?"_"+a(o):""),s=t[Pe]&&t[Pe][n];if(!s)return this;kt&&0===e.indexOf("touch")?Ut(t,e,n):!Ct||"dblclick"!==e||!te||kt&&dt?"removeEventListener"in t?"mousewheel"===e?t.removeEventListener("onwheel"in t?"wheel":"mousewheel",s,!1):t.removeEventListener("mouseenter"===e?"mouseover":"mouseleave"===e?"mouseout":e,s,!1):"detachEvent"in t&&t.detachEvent("on"+e,s):te(t,n),t[Pe][n]=null}function Fe(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,Xe(t),this}function qe(t){return Ne(t,"mousewheel",Fe),this}function Ue(t){return ze(t,"mousedown touchstart dblclick",Fe),Ne(t,"click",Ke),this}function je(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function Ve(t){return je(t),Fe(t),this}function He(t,e){if(!e)return new O(t.clientX,t.clientY);var i=Oe(e),o=i.boundingClientRect;return new O((t.clientX-o.left)/i.x-e.clientLeft,(t.clientY-o.top)/i.y-e.clientTop)}var We=mt&&dt?2*window.devicePixelRatio:ct?window.devicePixelRatio:1;function Ze(t){return it?t.wheelDeltaY/2:t.deltaY&&0===t.deltaMode?-t.deltaY/We:t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?20*-t.detail:t.detail?t.detail/-32765*60:0}var Ye,Ge={};function Ke(t){Ge[t.type]=!0}function Xe(t){var e=Ge[t.type];return Ge[t.type]=!1,e}function Qe(t,e){var i=e.relatedTarget;if(!i)return!0;try{for(;i&&i!==t;)i=i.parentNode}catch(t){return!1}return i!==t}function Je(t,e){var i=t.timeStamp||t.originalEvent&&t.originalEvent.timeStamp,o=Ye&&i-Ye;o&&o>100&&o<500||t.target._simulatedClick&&!t._simulated?Ve(t):(Ye=i,e(t))}var ti=(Object.freeze||Object)({on:ze,off:Re,stopPropagation:Fe,disableScrollPropagation:qe,disableClickPropagation:Ue,preventDefault:je,stop:Ve,getMousePosition:He,getWheelDelta:Ze,fakeStop:Ke,skipped:Xe,isExternalTarget:Qe,addListener:ze,removeListener:Re}),ei=I.extend({run:function(t,e,i,o){this.stop(),this._el=t,this._inProgress=!0,this._duration=i||.25,this._easeOutPower=1/Math.max(o||.5,.2),this._startPos=Ae(t),this._offset=e.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=A(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,i=1e3*this._duration;e<i?this._runFrame(this._easeOut(e/i),t):(this._runFrame(1),this._complete())},_runFrame:function(t,e){var i=this._startPos.add(this._offset.multiplyBy(t));e&&i._round(),Se(this._el,i),this.fire("step")},_complete:function(){E(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),ii=I.extend({options:{crs:G,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(t,e){e=m(this,e),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=s(this._onResize,this),this._initEvents(),e.maxBounds&&this.setMaxBounds(e.maxBounds),void 0!==e.zoom&&(this._zoom=this._limitZoom(e.zoom)),e.center&&void 0!==e.zoom&&this.setView(U(e.center),e.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=ae&&bt&&!St&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),ze(this._proxy,le,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,e,i){return e=void 0===e?this._zoom:this._limitZoom(e),t=this._limitCenter(U(t),e,this.options.maxBounds),i=i||{},this._stop(),this._loaded&&!i.reset&&!0!==i&&(void 0!==i.animate&&(i.zoom=o({animate:i.animate},i.zoom),i.pan=o({animate:i.animate,duration:i.duration},i.pan)),this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,i.zoom):this._tryAnimatedPan(t,i.pan))?(clearTimeout(this._sizeTimer),this):(this._resetView(t,e),this)},setZoom:function(t,e){return this._loaded?this.setView(this.getCenter(),t,{zoom:e}):(this._zoom=t,this)},zoomIn:function(t,e){return t=t||(bt?this.options.zoomDelta:1),this.setZoom(this._zoom+t,e)},zoomOut:function(t,e){return t=t||(bt?this.options.zoomDelta:1),this.setZoom(this._zoom-t,e)},setZoomAround:function(t,e,i){var o=this.getZoomScale(e),n=this.getSize().divideBy(2),s=(t instanceof O?t:this.latLngToContainerPoint(t)).subtract(n).multiplyBy(1-1/o),r=this.containerPointToLatLng(n.add(s));return this.setView(r,e,{zoom:i})},_getBoundsCenterZoom:function(t,e){e=e||{},t=t.getBounds?t.getBounds():F(t);var i=P(e.paddingTopLeft||e.padding||[0,0]),o=P(e.paddingBottomRight||e.padding||[0,0]),n=this.getBoundsZoom(t,!1,i.add(o));if((n="number"==typeof e.maxZoom?Math.min(e.maxZoom,n):n)===1/0)return{center:t.getCenter(),zoom:n};var s=o.subtract(i).divideBy(2),r=this.project(t.getSouthWest(),n),a=this.project(t.getNorthEast(),n);return{center:this.unproject(r.add(a).divideBy(2).add(s),n),zoom:n}},fitBounds:function(t,e){if(!(t=F(t)).isValid())throw new Error("Bounds are not valid.");var i=this._getBoundsCenterZoom(t,e);return this.setView(i.center,i.zoom,e)},fitWorld:function(t){return this.fitBounds([[-90,-180],[90,180]],t)},panTo:function(t,e){return this.setView(t,this._zoom,{pan:e})},panBy:function(t,e){if(e=e||{},!(t=P(t).round()).x&&!t.y)return this.fire("moveend");if(!0!==e.animate&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new ei,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire("movestart"),!1!==e.animate){ve(this._mapPane,"leaflet-pan-anim");var i=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,i,e.duration||.25,e.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(t,e,i){if(!1===(i=i||{}).animate||!bt)return this.setView(t,e,i);this._stop();var o=this.project(this.getCenter()),n=this.project(t),s=this.getSize(),r=this._zoom;t=U(t),e=void 0===e?r:e;var a=Math.max(s.x,s.y),l=a*this.getZoomScale(r,e),d=n.distanceTo(o)||1,c=1.42,h=c*c;function u(t){var e=(l*l-a*a+(t?-1:1)*h*h*d*d)/(2*(t?l:a)*h*d),i=Math.sqrt(e*e+1)-e;return i<1e-9?-18:Math.log(i)}function p(t){return(Math.exp(t)-Math.exp(-t))/2}function m(t){return(Math.exp(t)+Math.exp(-t))/2}function g(t){return p(t)/m(t)}var f=u(0);function v(t){return a*(m(f)/m(f+c*t))}function b(t){return a*(m(f)*g(f+c*t)-p(f))/h}function y(t){return 1-Math.pow(1-t,1.5)}var x=Date.now(),_=(u(1)-f)/c,w=i.duration?1e3*i.duration:1e3*_*.8;function k(){var i=(Date.now()-x)/w,s=y(i)*_;i<=1?(this._flyToFrame=A(k,this),this._move(this.unproject(o.add(n.subtract(o).multiplyBy(b(s)/d)),r),this.getScaleZoom(a/v(s),r),{flyTo:!0})):this._move(t,e)._moveEnd(!0)}return this._moveStart(!0,i.noMoveStart),k.call(this),this},flyToBounds:function(t,e){var i=this._getBoundsCenterZoom(t,e);return this.flyTo(i.center,i.zoom,e)},setMaxBounds:function(t){return(t=F(t)).isValid()?(this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this.off("moveend",this._panInsideMaxBounds))},setMinZoom:function(t){var e=this.options.minZoom;return this.options.minZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(t):this},setMaxZoom:function(t){var e=this.options.maxZoom;return this.options.maxZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var i=this.getCenter(),o=this._limitCenter(i,this._zoom,F(t));return i.equals(o)||this.panTo(o,e),this._enforcingBounds=!1,this},panInside:function(t,e){var i=P((e=e||{}).paddingTopLeft||e.padding||[0,0]),o=P(e.paddingBottomRight||e.padding||[0,0]),n=this.getCenter(),s=this.project(n),r=this.project(t),a=this.getPixelBounds(),l=a.getSize().divideBy(2),d=N([a.min.add(i),a.max.subtract(o)]);if(!d.contains(r)){this._enforcingBounds=!0;var c=s.subtract(r),h=P(r.x+c.x,r.y+c.y);(r.x<d.min.x||r.x>d.max.x)&&(h.x=s.x-c.x,c.x>0?h.x+=l.x-i.x:h.x-=l.x-o.x),(r.y<d.min.y||r.y>d.max.y)&&(h.y=s.y-c.y,c.y>0?h.y+=l.y-i.y:h.y-=l.y-o.y),this.panTo(this.unproject(h),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=o({animate:!1,pan:!0},!0===t?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var i=this.getSize(),n=e.divideBy(2).round(),r=i.divideBy(2).round(),a=n.subtract(r);return a.x||a.y?(t.animate&&t.pan?this.panBy(a):(t.pan&&this._rawPanBy(a),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(s(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=o({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var e=s(this._handleGeolocationResponse,this),i=s(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(e,i,t):navigator.geolocation.getCurrentPosition(e,i,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var e=t.code,i=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+i+"."})},_handleGeolocationResponse:function(t){var e=new q(t.coords.latitude,t.coords.longitude),i=e.toBounds(2*t.coords.accuracy),o=this._locateOptions;if(o.setView){var n=this.getBoundsZoom(i);this.setView(e,o.maxZoom?Math.min(n,o.maxZoom):n)}var s={latlng:e,bounds:i,timestamp:t.timestamp};for(var r in t.coords)"number"==typeof t.coords[r]&&(s[r]=t.coords[r]);this.fire("locationfound",s)},addHandler:function(t,e){if(!e)return this;var i=this[t]=new e(this);return this._handlers.push(i),this.options[t]&&i.enable(),this},remove:function(){if(this._initEvents(!0),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}var t;for(t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),ue(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(E(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)ue(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var i=he("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),e||this._mapPane);return t&&(this._panes[t]=i),i},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new B(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,i){t=F(t),i=P(i||[0,0]);var o=this.getZoom()||0,n=this.getMinZoom(),s=this.getMaxZoom(),r=t.getNorthWest(),a=t.getSouthEast(),l=this.getSize().subtract(i),d=N(this.project(a,o),this.project(r,o)).getSize(),c=bt?this.options.zoomSnap:1,h=l.x/d.x,u=l.y/d.y,p=e?Math.max(h,u):Math.min(h,u);return o=this.getScaleZoom(p,o),c&&(o=Math.round(o/(c/100))*(c/100),o=e?Math.ceil(o/c)*c:Math.floor(o/c)*c),Math.max(n,Math.min(s,o))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new O(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var i=this._getTopLeftPoint(t,e);return new R(i,i.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var i=this.options.crs;return e=void 0===e?this._zoom:e,i.scale(t)/i.scale(e)},getScaleZoom:function(t,e){var i=this.options.crs;e=void 0===e?this._zoom:e;var o=i.zoom(t*i.scale(e));return isNaN(o)?1/0:o},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(U(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(P(t),e)},layerPointToLatLng:function(t){var e=P(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){return this.project(U(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(U(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(F(t))},distance:function(t,e){return this.options.crs.distance(U(t),U(e))},containerPointToLayerPoint:function(t){return P(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return P(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(P(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(U(t)))},mouseEventToContainerPoint:function(t){return He(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var e=this._container=de(t);if(!e)throw new Error("Map container not found.");if(e._leaflet_id)throw new Error("Map container is already initialized.");ze(e,"scroll",this._onScroll,this),this._containerId=a(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&bt,ve(t,"leaflet-container"+(Ct?" leaflet-touch":"")+(Et?" leaflet-retina":"")+(et?" leaflet-oldie":"")+(ht?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=ce(t,"position");"absolute"!==e&&"relative"!==e&&"fixed"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Se(this._mapPane,new O(0,0)),this.createPane("tilePane"),this.createPane("shadowPane"),this.createPane("overlayPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(ve(t.markerPane,"leaflet-zoom-hide"),ve(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e){Se(this._mapPane,new O(0,0));var i=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset");var o=this._zoom!==e;this._moveStart(o,!1)._move(t,e)._moveEnd(o),this.fire("viewreset"),i&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,i){void 0===e&&(e=this._zoom);var o=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),(o||i&&i.pinch)&&this.fire("zoom",i),this.fire("move",i)},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return E(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){Se(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[a(this._container)]=this;var e=t?Re:ze;e(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),bt&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){E(this._resizeRequest),this._resizeRequest=A((function(){this.invalidateSize({debounceMoveend:!0})}),this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var i,o=[],n="mouseout"===e||"mouseover"===e,s=t.target||t.srcElement,r=!1;s;){if((i=this._targets[a(s)])&&("click"===e||"preclick"===e)&&!t._simulated&&this._draggableMoved(i)){r=!0;break}if(i&&i.listens(e,!0)){if(n&&!Qe(s,t))break;if(o.push(i),n)break}if(s===this._container)break;s=s.parentNode}return o.length||r||n||!Qe(s,t)||(o=[this]),o},_handleDOMEvent:function(t){if(this._loaded&&!Xe(t)){var e=t.type;"mousedown"!==e&&"keypress"!==e&&"keyup"!==e&&"keydown"!==e||De(t.target||t.srcElement),this._fireDOMEvent(t,e)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,i){if("click"===t.type){var n=o({},t);n.type="preclick",this._fireDOMEvent(n,n.type,i)}if(!t._stopped&&(i=(i||[]).concat(this._findEventTargets(t,e))).length){var s=i[0];"contextmenu"===e&&s.listens(e,!0)&&je(t);var r={originalEvent:t};if("keypress"!==t.type&&"keydown"!==t.type&&"keyup"!==t.type){var a=s.getLatLng&&(!s._radius||s._radius<=10);r.containerPoint=a?this.latLngToContainerPoint(s.getLatLng()):this.mouseEventToContainerPoint(t),r.layerPoint=this.containerPointToLayerPoint(r.containerPoint),r.latlng=a?s.getLatLng():this.layerPointToLatLng(r.layerPoint)}for(var l=0;l<i.length;l++)if(i[l].fire(e,r,!0),r.originalEvent._stopped||!1===i[l].options.bubblingMouseEvents&&-1!==y(this._mouseEvents,e))return}},_draggableMoved:function(t){return(t=t.dragging&&t.dragging.enabled()?t:this).dragging&&t.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var t=0,e=this._handlers.length;t<e;t++)this._handlers[t].disable()},whenReady:function(t,e){return this._loaded?t.call(e||this,{target:this}):this.on("load",t,e),this},_getMapPanePos:function(){return Ae(this._mapPane)||new O(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,e){return(t&&void 0!==e?this._getNewPixelOrigin(t,e):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,e){var i=this.getSize()._divideBy(2);return this.project(t,e)._subtract(i)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,e,i){var o=this._getNewPixelOrigin(i,e);return this.project(t,e)._subtract(o)},_latLngBoundsToNewLayerBounds:function(t,e,i){var o=this._getNewPixelOrigin(i,e);return N([this.project(t.getSouthWest(),e)._subtract(o),this.project(t.getNorthWest(),e)._subtract(o),this.project(t.getSouthEast(),e)._subtract(o),this.project(t.getNorthEast(),e)._subtract(o)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,e,i){if(!i)return t;var o=this.project(t,e),n=this.getSize().divideBy(2),s=new R(o.subtract(n),o.add(n)),r=this._getBoundsOffset(s,i,e);return r.round().equals([0,0])?t:this.unproject(o.add(r),e)},_limitOffset:function(t,e){if(!e)return t;var i=this.getPixelBounds(),o=new R(i.min.add(t),i.max.add(t));return t.add(this._getBoundsOffset(o,e))},_getBoundsOffset:function(t,e,i){var o=N(this.project(e.getNorthEast(),i),this.project(e.getSouthWest(),i)),n=o.min.subtract(t.min),s=o.max.subtract(t.max);return new O(this._rebound(n.x,-s.x),this._rebound(n.y,-s.y))},_rebound:function(t,e){return t+e>0?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))},_limitZoom:function(t){var e=this.getMinZoom(),i=this.getMaxZoom(),o=bt?this.options.zoomSnap:1;return o&&(t=Math.round(t/o)*o),Math.max(e,Math.min(i,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){be(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var i=this._getCenterOffset(t)._trunc();return!(!0!==(e&&e.animate)&&!this.getSize().contains(i)||(this.panBy(i,e),0))},_createAnimProxy:function(){var t=this._proxy=he("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",(function(t){var e=re,i=this._proxy.style[e];Ce(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),i===this._proxy.style[e]&&this._animatingZoom&&this._onZoomTransitionEnd()}),this),this.on("load moveend",(function(){var t=this.getCenter(),e=this.getZoom();Ce(this._proxy,this.project(t,e),this.getZoomScale(e,1))}),this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){ue(this._proxy),delete this._proxy},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,e,i){if(this._animatingZoom)return!0;if(i=i||{},!this._zoomAnimated||!1===i.animate||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var o=this.getZoomScale(e),n=this._getCenterOffset(t)._divideBy(1-1/o);return!(!0!==i.animate&&!this.getSize().contains(n)||(A((function(){this._moveStart(!0,!1)._animateZoom(t,e,!0)}),this),0))},_animateZoom:function(t,e,i,o){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,ve(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:o}),setTimeout(s(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&be(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),A((function(){this._moveEnd(!0)}),this))}});function oi(t,e){return new ii(t,e)}var ni=T.extend({options:{position:"topright"},initialize:function(t){m(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),i=this.getPosition(),o=t._controlCorners[i];return ve(e,"leaflet-control"),-1!==i.indexOf("bottom")?o.insertBefore(e,o.firstChild):o.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(ue(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),si=function(t){return new ni(t)};ii.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},e="leaflet-",i=this._controlContainer=he("div",e+"control-container",this._container);function o(o,n){var s=e+o+" "+e+n;t[o+n]=he("div",s,i)}o("top","left"),o("top","right"),o("bottom","left"),o("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)ue(this._controlCorners[t]);ue(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var ri=ni.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,i,o){return i<o?-1:o<i?1:0}},initialize:function(t,e,i){for(var o in m(this,i),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[o],o);for(o in e)this._addLayer(e[o],o,!0)},onAdd:function(t){this._initLayout(),this._update(),this._map=t,t.on("zoomend",this._checkDisabledLayers,this);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(t){return ni.prototype.addTo.call(this,t),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(t,e){return this._addLayer(t,e),this._map?this._update():this},addOverlay:function(t,e){return this._addLayer(t,e,!0),this._map?this._update():this},removeLayer:function(t){t.off("add remove",this._onLayerChange,this);var e=this._getLayer(a(t));return e&&this._layers.splice(this._layers.indexOf(e),1),this._map?this._update():this},expand:function(){ve(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(ve(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):be(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return be(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",e=this._container=he("div",t),i=this.options.collapsed;e.setAttribute("aria-haspopup",!0),Ue(e),qe(e);var o=this._section=he("section",t+"-list");i&&(this._map.on("click",this.collapse,this),nt||ze(e,{mouseenter:this.expand,mouseleave:this.collapse},this));var n=this._layersLink=he("a",t+"-toggle",e);n.href="#",n.title="Layers",Ct?(ze(n,"click",Ve),ze(n,"click",this.expand,this)):ze(n,"focus",this.expand,this),i||this.expand(),this._baseLayersList=he("div",t+"-base",o),this._separator=he("div",t+"-separator",o),this._overlaysList=he("div",t+"-overlays",o),e.appendChild(o)},_getLayer:function(t){for(var e=0;e<this._layers.length;e++)if(this._layers[e]&&a(this._layers[e].layer)===t)return this._layers[e]},_addLayer:function(t,e,i){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:e,overlay:i}),this.options.sortLayers&&this._layers.sort(s((function(t,e){return this.options.sortFunction(t.layer,e.layer,t.name,e.name)}),this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;pe(this._baseLayersList),pe(this._overlaysList),this._layerControlInputs=[];var t,e,i,o,n=0;for(i=0;i<this._layers.length;i++)o=this._layers[i],this._addItem(o),e=e||o.overlay,t=t||!o.overlay,n+=o.overlay?0:1;return this.options.hideSingleBase&&(t=t&&n>1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=e&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var e=this._getLayer(a(t.target)),i=e.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;i&&this._map.fire(i,e)},_createRadioElement:function(t,e){var i='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(e?' checked="checked"':"")+"/>",o=document.createElement("div");return o.innerHTML=i,o.firstChild},_addItem:function(t){var e,i=document.createElement("label"),o=this._map.hasLayer(t.layer);t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=o):e=this._createRadioElement("leaflet-base-layers_"+a(this),o),this._layerControlInputs.push(e),e.layerId=a(t.layer),ze(e,"click",this._onInputClick,this);var n=document.createElement("span");n.innerHTML=" "+t.name;var s=document.createElement("div");return i.appendChild(s),s.appendChild(e),s.appendChild(n),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(i),this._checkDisabledLayers(),i},_onInputClick:function(){var t,e,i=this._layerControlInputs,o=[],n=[];this._handlingClick=!0;for(var s=i.length-1;s>=0;s--)t=i[s],e=this._getLayer(t.layerId).layer,t.checked?o.push(e):t.checked||n.push(e);for(s=0;s<n.length;s++)this._map.hasLayer(n[s])&&this._map.removeLayer(n[s]);for(s=0;s<o.length;s++)this._map.hasLayer(o[s])||this._map.addLayer(o[s]);this._handlingClick=!1,this._refocusOnMap()},_checkDisabledLayers:function(){for(var t,e,i=this._layerControlInputs,o=this._map.getZoom(),n=i.length-1;n>=0;n--)t=i[n],e=this._getLayer(t.layerId).layer,t.disabled=void 0!==e.options.minZoom&&o<e.options.minZoom||void 0!==e.options.maxZoom&&o>e.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expand:function(){return this.expand()},_collapse:function(){return this.collapse()}}),ai=function(t,e,i){return new ri(t,e,i)},li=ni.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"&#x2212;",zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",i=he("div",e+" leaflet-bar"),o=this.options;return this._zoomInButton=this._createButton(o.zoomInText,o.zoomInTitle,e+"-in",i,this._zoomIn),this._zoomOutButton=this._createButton(o.zoomOutText,o.zoomOutTitle,e+"-out",i,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),i},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(t.shiftKey?3:1))},_zoomOut:function(t){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,i,o,n){var s=he("a",i,o);return s.innerHTML=t,s.href="#",s.title=e,s.setAttribute("role","button"),s.setAttribute("aria-label",e),Ue(s),ze(s,"click",Ve),ze(s,"click",n,this),ze(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";be(this._zoomInButton,e),be(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMinZoom())&&ve(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMaxZoom())&&ve(this._zoomInButton,e)}});ii.mergeOptions({zoomControl:!0}),ii.addInitHook((function(){this.options.zoomControl&&(this.zoomControl=new li,this.addControl(this.zoomControl))}));var di=function(t){return new li(t)},ci=ni.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",i=he("div",e),o=this.options;return this._addScales(o,e+"-line",i),t.on(o.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),i},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,i){t.metric&&(this._mScale=he("div",e,i)),t.imperial&&(this._iScale=he("div",e,i))},_update:function(){var t=this._map,e=t.getSize().y/2,i=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(i)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t),i=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,i,e/t)},_updateImperial:function(t){var e,i,o,n=3.2808399*t;n>5280?(e=n/5280,i=this._getRoundNum(e),this._updateScale(this._iScale,i+" mi",i/e)):(o=this._getRoundNum(n),this._updateScale(this._iScale,o+" ft",o/n))},_updateScale:function(t,e,i){t.style.width=Math.round(this.options.maxWidth*i)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),i=t/e;return e*(i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:1)}}),hi=function(t){return new ci(t)},ui=ni.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>'},initialize:function(t){m(this,t),this._attributions={}},onAdd:function(t){for(var e in t.attributionControl=this,this._container=he("div","leaflet-control-attribution"),Ue(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var e in this._attributions)this._attributions[e]&&t.push(e);var i=[];this.options.prefix&&i.push(this.options.prefix),t.length&&i.push(t.join(", ")),this._container.innerHTML=i.join(" | ")}}});ii.mergeOptions({attributionControl:!0}),ii.addInitHook((function(){this.options.attributionControl&&(new ui).addTo(this)}));var pi=function(t){return new ui(t)};ni.Layers=ri,ni.Zoom=li,ni.Scale=ci,ni.Attribution=ui,si.layers=ai,si.zoom=di,si.scale=hi,si.attribution=pi;var mi=T.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});mi.addTo=function(t,e){return t.addHandler(e,this),this};var gi,fi={Events:M},vi=Ct?"touchstart mousedown":"mousedown",bi={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},yi={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},xi=I.extend({options:{clickTolerance:3},initialize:function(t,e,i,o){m(this,o),this._element=t,this._dragStartTarget=e||t,this._preventOutline=i},enable:function(){this._enabled||(ze(this._dragStartTarget,vi,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(xi._dragging===this&&this.finishDrag(),Re(this._dragStartTarget,vi,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(!t._simulated&&this._enabled&&(this._moved=!1,!fe(this._element,"leaflet-zoom-anim")&&!(xi._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||(xi._dragging=this,this._preventOutline&&De(this._element),$e(),ee(),this._moving)))){this.fire("down");var e=t.touches?t.touches[0]:t,i=Ie(this._element);this._startPoint=new O(e.clientX,e.clientY),this._parentScale=Oe(i),ze(document,yi[t.type],this._onMove,this),ze(document,bi[t.type],this._onUp,this)}},_onMove:function(t){if(!t._simulated&&this._enabled)if(t.touches&&t.touches.length>1)this._moved=!0;else{var e=t.touches&&1===t.touches.length?t.touches[0]:t,i=new O(e.clientX,e.clientY)._subtract(this._startPoint);(i.x||i.y)&&(Math.abs(i.x)+Math.abs(i.y)<this.options.clickTolerance||(i.x/=this._parentScale.x,i.y/=this._parentScale.y,je(t),this._moved||(this.fire("dragstart"),this._moved=!0,this._startPos=Ae(this._element).subtract(i),ve(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),ve(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(i),this._moving=!0,E(this._animRequest),this._lastEvent=t,this._animRequest=A(this._updatePosition,this,!0)))}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),Se(this._element,this._newPos),this.fire("drag",t)},_onUp:function(t){!t._simulated&&this._enabled&&this.finishDrag()},finishDrag:function(){for(var t in be(document.body,"leaflet-dragging"),this._lastTarget&&(be(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),yi)Re(document,yi[t],this._onMove,this),Re(document,bi[t],this._onUp,this);Te(),ie(),this._moved&&this._moving&&(E(this._animRequest),this.fire("dragend",{distance:this._newPos.distanceTo(this._startPos)})),this._moving=!1,xi._dragging=!1}});function _i(t,e){if(!e||!t.length)return t.slice();var i=e*e;return t=Ci(t=Ai(t,i),i)}function wi(t,e,i){return Math.sqrt(Mi(t,e,i,!0))}function ki(t,e,i){return Mi(t,e,i)}function Ci(t,e){var i=t.length,o=new(typeof Uint8Array!=void 0+""?Uint8Array:Array)(i);o[0]=o[i-1]=1,Si(t,o,e,0,i-1);var n,s=[];for(n=0;n<i;n++)o[n]&&s.push(t[n]);return s}function Si(t,e,i,o,n){var s,r,a,l=0;for(r=o+1;r<=n-1;r++)(a=Mi(t[r],t[o],t[n],!0))>l&&(s=r,l=a);l>i&&(e[s]=1,Si(t,e,i,o,s),Si(t,e,i,s,n))}function Ai(t,e){for(var i=[t[0]],o=1,n=0,s=t.length;o<s;o++)Di(t[o],t[n])>e&&(i.push(t[o]),n=o);return n<s-1&&i.push(t[s-1]),i}function Ei(t,e,i,o,n){var s,r,a,l=o?gi:Ti(t,i),d=Ti(e,i);for(gi=d;;){if(!(l|d))return[t,e];if(l&d)return!1;a=Ti(r=$i(t,e,s=l||d,i,n),i),s===l?(t=r,l=a):(e=r,d=a)}}function $i(t,e,i,o,n){var s,r,a=e.x-t.x,l=e.y-t.y,d=o.min,c=o.max;return 8&i?(s=t.x+a*(c.y-t.y)/l,r=c.y):4&i?(s=t.x+a*(d.y-t.y)/l,r=d.y):2&i?(s=c.x,r=t.y+l*(c.x-t.x)/a):1&i&&(s=d.x,r=t.y+l*(d.x-t.x)/a),new O(s,r,n)}function Ti(t,e){var i=0;return t.x<e.min.x?i|=1:t.x>e.max.x&&(i|=2),t.y<e.min.y?i|=4:t.y>e.max.y&&(i|=8),i}function Di(t,e){var i=e.x-t.x,o=e.y-t.y;return i*i+o*o}function Mi(t,e,i,o){var n,s=e.x,r=e.y,a=i.x-s,l=i.y-r,d=a*a+l*l;return d>0&&((n=((t.x-s)*a+(t.y-r)*l)/d)>1?(s=i.x,r=i.y):n>0&&(s+=a*n,r+=l*n)),a=t.x-s,l=t.y-r,o?a*a+l*l:new O(s,r)}function Ii(t){return!b(t[0])||"object"!=typeof t[0][0]&&void 0!==t[0][0]}function Oi(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Ii(t)}var Li=(Object.freeze||Object)({simplify:_i,pointToSegmentDistance:wi,closestPointOnSegment:ki,clipSegment:Ei,_getEdgeIntersection:$i,_getBitCode:Ti,_sqClosestPointOnSegment:Mi,isFlat:Ii,_flat:Oi});function zi(t,e,i){var o,n,s,r,a,l,d,c,h,u=[1,4,2,8];for(n=0,d=t.length;n<d;n++)t[n]._code=Ti(t[n],e);for(r=0;r<4;r++){for(c=u[r],o=[],n=0,s=(d=t.length)-1;n<d;s=n++)a=t[n],l=t[s],a._code&c?l._code&c||((h=$i(l,a,c,e,i))._code=Ti(h,e),o.push(h)):(l._code&c&&((h=$i(l,a,c,e,i))._code=Ti(h,e),o.push(h)),o.push(a));t=o}return t}var Pi=(Object.freeze||Object)({clipPolygon:zi}),Ri={project:function(t){return new O(t.lng,t.lat)},unproject:function(t){return new q(t.y,t.x)},bounds:new R([-180,-90],[180,90])},Ni={R:6378137,R_MINOR:6356752.314245179,bounds:new R([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(t){var e=Math.PI/180,i=this.R,o=t.lat*e,n=this.R_MINOR/i,s=Math.sqrt(1-n*n),r=s*Math.sin(o),a=Math.tan(Math.PI/4-o/2)/Math.pow((1-r)/(1+r),s/2);return o=-i*Math.log(Math.max(a,1e-10)),new O(t.lng*e*i,o)},unproject:function(t){for(var e,i=180/Math.PI,o=this.R,n=this.R_MINOR/o,s=Math.sqrt(1-n*n),r=Math.exp(-t.y/o),a=Math.PI/2-2*Math.atan(r),l=0,d=.1;l<15&&Math.abs(d)>1e-7;l++)e=s*Math.sin(a),e=Math.pow((1-e)/(1+e),s/2),a+=d=Math.PI/2-2*Math.atan(r*e)-a;return new q(a*i,t.x*i/o)}},Bi=(Object.freeze||Object)({LonLat:Ri,Mercator:Ni,SphericalMercator:W}),Fi=o({},V,{code:"EPSG:3395",projection:Ni,transformation:function(){var t=.5/(Math.PI*Ni.R);return Y(t,.5,-t,.5)}()}),qi=o({},V,{code:"EPSG:4326",projection:Ri,transformation:Y(1/180,1,-1/180,.5)}),Ui=o({},j,{projection:Ri,transformation:Y(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,e){var i=e.lng-t.lng,o=e.lat-t.lat;return Math.sqrt(i*i+o*o)},infinite:!0});j.Earth=V,j.EPSG3395=Fi,j.EPSG3857=G,j.EPSG900913=K,j.EPSG4326=qi,j.Simple=Ui;var ji=I.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[a(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[a(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var e=t.target;if(e.hasLayer(this)){if(this._map=e,this._zoomAnimated=e._zoomAnimated,this.getEvents){var i=this.getEvents();e.on(i,this),this.once("remove",(function(){e.off(i,this)}),this)}this.onAdd(e),this.getAttribution&&e.attributionControl&&e.attributionControl.addAttribution(this.getAttribution()),this.fire("add"),e.fire("layeradd",{layer:this})}}});ii.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var e=a(t);return this._layers[e]||(this._layers[e]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t)),this},removeLayer:function(t){var e=a(t);return this._layers[e]?(this._loaded&&t.onRemove(this),t.getAttribution&&this.attributionControl&&this.attributionControl.removeAttribution(t.getAttribution()),delete this._layers[e],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return!!t&&a(t)in this._layers},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},_addLayers:function(t){for(var e=0,i=(t=t?b(t)?t:[t]:[]).length;e<i;e++)this.addLayer(t[e])},_addZoomLimit:function(t){!isNaN(t.options.maxZoom)&&isNaN(t.options.minZoom)||(this._zoomBoundLayers[a(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var e=a(t);this._zoomBoundLayers[e]&&(delete this._zoomBoundLayers[e],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,e=-1/0,i=this._getZoomSpan();for(var o in this._zoomBoundLayers){var n=this._zoomBoundLayers[o].options;t=void 0===n.minZoom?t:Math.min(t,n.minZoom),e=void 0===n.maxZoom?e:Math.max(e,n.maxZoom)}this._layersMaxZoom=e===-1/0?void 0:e,this._layersMinZoom=t===1/0?void 0:t,i!==this._getZoomSpan()&&this.fire("zoomlevelschange"),void 0===this.options.maxZoom&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Vi=ji.extend({initialize:function(t,e){var i,o;if(m(this,e),this._layers={},t)for(i=0,o=t.length;i<o;i++)this.addLayer(t[i])},addLayer:function(t){var e=this.getLayerId(t);return this._layers[e]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var e=t in this._layers?t:this.getLayerId(t);return this._map&&this._layers[e]&&this._map.removeLayer(this._layers[e]),delete this._layers[e],this},hasLayer:function(t){return!!t&&(t in this._layers||this.getLayerId(t)in this._layers)},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var e,i,o=Array.prototype.slice.call(arguments,1);for(e in this._layers)(i=this._layers[e])[t]&&i[t].apply(i,o);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},getLayer:function(t){return this._layers[t]},getLayers:function(){var t=[];return this.eachLayer(t.push,t),t},setZIndex:function(t){return this.invoke("setZIndex",t)},getLayerId:function(t){return a(t)}}),Hi=function(t,e){return new Vi(t,e)},Wi=Vi.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),Vi.prototype.addLayer.call(this,t),this.fire("layeradd",{layer:t}))},removeLayer:function(t){return this.hasLayer(t)?(t in this._layers&&(t=this._layers[t]),t.removeEventParent(this),Vi.prototype.removeLayer.call(this,t),this.fire("layerremove",{layer:t})):this},setStyle:function(t){return this.invoke("setStyle",t)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var t=new B;for(var e in this._layers){var i=this._layers[e];t.extend(i.getBounds?i.getBounds():i.getLatLng())}return t}}),Zi=function(t){return new Wi(t)},Yi=T.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0]},initialize:function(t){m(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,e){var i=this._getIconUrl(t);if(!i){if("icon"===t)throw new Error("iconUrl not set in Icon options (see the docs).");return null}var o=this._createImg(i,e&&"IMG"===e.tagName?e:null);return this._setIconStyles(o,t),o},_setIconStyles:function(t,e){var i=this.options,o=i[e+"Size"];"number"==typeof o&&(o=[o,o]);var n=P(o),s=P("shadow"===e&&i.shadowAnchor||i.iconAnchor||n&&n.divideBy(2,!0));t.className="leaflet-marker-"+e+" "+(i.className||""),s&&(t.style.marginLeft=-s.x+"px",t.style.marginTop=-s.y+"px"),n&&(t.style.width=n.x+"px",t.style.height=n.y+"px")},_createImg:function(t,e){return(e=e||document.createElement("img")).src=t,e},_getIconUrl:function(t){return Et&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}});function Gi(t){return new Yi(t)}var Ki=Yi.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(t){return Ki.imagePath||(Ki.imagePath=this._detectIconPath()),(this.options.imagePath||Ki.imagePath)+Yi.prototype._getIconUrl.call(this,t)},_detectIconPath:function(){var t=he("div","leaflet-default-icon-path",document.body),e=ce(t,"background-image")||ce(t,"backgroundImage");return document.body.removeChild(t),e=null===e||0!==e.indexOf("url")?"":e.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")}}),Xi=mi.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new xi(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),ve(t,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&be(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var e=this._marker,i=e._map,o=this._marker.options.autoPanSpeed,n=this._marker.options.autoPanPadding,s=Ae(e._icon),r=i.getPixelBounds(),a=i.getPixelOrigin(),l=N(r.min._subtract(a).add(n),r.max._subtract(a).subtract(n));if(!l.contains(s)){var d=P((Math.max(l.max.x,s.x)-l.max.x)/(r.max.x-l.max.x)-(Math.min(l.min.x,s.x)-l.min.x)/(r.min.x-l.min.x),(Math.max(l.max.y,s.y)-l.max.y)/(r.max.y-l.max.y)-(Math.min(l.min.y,s.y)-l.min.y)/(r.min.y-l.min.y)).multiplyBy(o);i.panBy(d,{animate:!1}),this._draggable._newPos._add(d),this._draggable._startPos._add(d),Se(e._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=A(this._adjustPan.bind(this,t))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup().fire("movestart").fire("dragstart")},_onPreDrag:function(t){this._marker.options.autoPan&&(E(this._panRequest),this._panRequest=A(this._adjustPan.bind(this,t)))},_onDrag:function(t){var e=this._marker,i=e._shadow,o=Ae(e._icon),n=e._map.layerPointToLatLng(o);i&&Se(i,o),e._latlng=n,t.latlng=n,t.oldLatLng=this._oldLatLng,e.fire("move",t).fire("drag",t)},_onDragEnd:function(t){E(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),Qi=ji.extend({options:{icon:new Ki,interactive:!0,keyboard:!0,title:"",alt:"",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(t,e){m(this,e),this._latlng=U(t)},onAdd:function(t){this._zoomAnimated=this._zoomAnimated&&t.options.markerZoomAnimation,this._zoomAnimated&&t.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(t){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&t.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(t){var e=this._latlng;return this._latlng=U(t),this.update(),this.fire("move",{oldLatLng:e,latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update()},getIcon:function(){return this.options.icon},setIcon:function(t){return this.options.icon=t,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var t=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(t)}return this},_initIcon:function(){var t=this.options,e="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),i=t.icon.createIcon(this._icon),o=!1;i!==this._icon&&(this._icon&&this._removeIcon(),o=!0,t.title&&(i.title=t.title),"IMG"===i.tagName&&(i.alt=t.alt||"")),ve(i,e),t.keyboard&&(i.tabIndex="0"),this._icon=i,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex});var n=t.icon.createShadow(this._shadow),s=!1;n!==this._shadow&&(this._removeShadow(),s=!0),n&&(ve(n,e),n.alt=""),this._shadow=n,t.opacity<1&&this._updateOpacity(),o&&this.getPane().appendChild(this._icon),this._initInteraction(),n&&s&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),ue(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&ue(this._shadow),this._shadow=null},_setPos:function(t){Se(this._icon,t),this._shadow&&Se(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon.style.zIndex=this._zIndex+t},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPos(e)},_initInteraction:function(){if(this.options.interactive&&(ve(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Xi)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Xi(this),t&&this.dragging.enable()}},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var t=this.options.opacity;this._icon&&_e(this._icon,t),this._shadow&&_e(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function Ji(t,e){return new Qi(t,e)}var to=ji.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(t){this._renderer=t.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(t){return m(this,t),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&t.hasOwnProperty("weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+this._renderer.options.tolerance}}),eo=to.extend({options:{fill:!0,radius:10},initialize:function(t,e){m(this,e),this._latlng=U(t),this._radius=this.options.radius},setLatLng:function(t){return this._latlng=U(t),this.redraw(),this.fire("move",{latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(t){return this.options.radius=this._radius=t,this.redraw()},getRadius:function(){return this._radius},setStyle:function(t){var e=t&&t.radius||this._radius;return to.prototype.setStyle.call(this,t),this.setRadius(e),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var t=this._radius,e=this._radiusY||t,i=this._clickTolerance(),o=[t+i,e+i];this._pxBounds=new R(this._point.subtract(o),this._point.add(o))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function io(t,e){return new eo(t,e)}var oo=eo.extend({initialize:function(t,e,i){if("number"==typeof e&&(e=o({},i,{radius:e})),m(this,e),this._latlng=U(t),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(t){return this._mRadius=t,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var t=[this._radius,this._radiusY||this._radius];return new B(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:to.prototype.setStyle,_project:function(){var t=this._latlng.lng,e=this._latlng.lat,i=this._map,o=i.options.crs;if(o.distance===V.distance){var n=Math.PI/180,s=this._mRadius/V.R/n,r=i.project([e+s,t]),a=i.project([e-s,t]),l=r.add(a).divideBy(2),d=i.unproject(l).lat,c=Math.acos((Math.cos(s*n)-Math.sin(e*n)*Math.sin(d*n))/(Math.cos(e*n)*Math.cos(d*n)))/n;(isNaN(c)||0===c)&&(c=s/Math.cos(Math.PI/180*e)),this._point=l.subtract(i.getPixelOrigin()),this._radius=isNaN(c)?0:l.x-i.project([d,t-c]).x,this._radiusY=l.y-r.y}else{var h=o.unproject(o.project(this._latlng).subtract([this._mRadius,0]));this._point=i.latLngToLayerPoint(this._latlng),this._radius=this._point.x-i.latLngToLayerPoint(h).x}this._updateBounds()}});function no(t,e,i){return new oo(t,e,i)}var so=to.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,e){m(this,e),this._setLatLngs(t)},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._setLatLngs(t),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(t){for(var e,i,o=1/0,n=null,s=Mi,r=0,a=this._parts.length;r<a;r++)for(var l=this._parts[r],d=1,c=l.length;d<c;d++){var h=s(t,e=l[d-1],i=l[d],!0);h<o&&(o=h,n=s(t,e,i))}return n&&(n.distance=Math.sqrt(o)),n},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,e,i,o,n,s,r,a=this._rings[0],l=a.length;if(!l)return null;for(t=0,e=0;t<l-1;t++)e+=a[t].distanceTo(a[t+1])/2;if(0===e)return this._map.layerPointToLatLng(a[0]);for(t=0,o=0;t<l-1;t++)if(n=a[t],s=a[t+1],(o+=i=n.distanceTo(s))>e)return r=(o-e)/i,this._map.layerPointToLatLng([s.x-r*(s.x-n.x),s.y-r*(s.y-n.y)])},getBounds:function(){return this._bounds},addLatLng:function(t,e){return e=e||this._defaultShape(),t=U(t),e.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new B,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return Ii(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var e=[],i=Ii(t),o=0,n=t.length;o<n;o++)i?(e[o]=U(t[o]),this._bounds.extend(e[o])):e[o]=this._convertLatLngs(t[o]);return e},_project:function(){var t=new R;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t),this._bounds.isValid()&&t.isValid()&&(this._rawPxBounds=t,this._updateBounds())},_updateBounds:function(){var t=this._clickTolerance(),e=new O(t,t);this._pxBounds=new R([this._rawPxBounds.min.subtract(e),this._rawPxBounds.max.add(e)])},_projectLatlngs:function(t,e,i){var o,n,s=t[0]instanceof q,r=t.length;if(s){for(n=[],o=0;o<r;o++)n[o]=this._map.latLngToLayerPoint(t[o]),i.extend(n[o]);e.push(n)}else for(o=0;o<r;o++)this._projectLatlngs(t[o],e,i)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else{var e,i,o,n,s,r,a,l=this._parts;for(e=0,o=0,n=this._rings.length;e<n;e++)for(i=0,s=(a=this._rings[e]).length;i<s-1;i++)(r=Ei(a[i],a[i+1],t,i,!0))&&(l[o]=l[o]||[],l[o].push(r[0]),r[1]===a[i+1]&&i!==s-2||(l[o].push(r[1]),o++))}},_simplifyPoints:function(){for(var t=this._parts,e=this.options.smoothFactor,i=0,o=t.length;i<o;i++)t[i]=_i(t[i],e)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,e){var i,o,n,s,r,a,l=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(i=0,s=this._parts.length;i<s;i++)for(o=0,n=(r=(a=this._parts[i]).length)-1;o<r;n=o++)if((e||0!==o)&&wi(t,a[n],a[o])<=l)return!0;return!1}});function ro(t,e){return new so(t,e)}so._flat=Oi;var ao=so.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,e,i,o,n,s,r,a,l,d=this._rings[0],c=d.length;if(!c)return null;for(s=r=a=0,t=0,e=c-1;t<c;e=t++)i=d[t],o=d[e],n=i.y*o.x-o.y*i.x,r+=(i.x+o.x)*n,a+=(i.y+o.y)*n,s+=3*n;return l=0===s?d[0]:[r/s,a/s],this._map.layerPointToLatLng(l)},_convertLatLngs:function(t){var e=so.prototype._convertLatLngs.call(this,t),i=e.length;return i>=2&&e[0]instanceof q&&e[0].equals(e[i-1])&&e.pop(),e},_setLatLngs:function(t){so.prototype._setLatLngs.call(this,t),Ii(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Ii(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,i=new O(e,e);if(t=new R(t.min.subtract(i),t.max.add(i)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var o,n=0,s=this._rings.length;n<s;n++)(o=zi(this._rings[n],t,!0)).length&&this._parts.push(o)},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var e,i,o,n,s,r,a,l,d=!1;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(n=0,a=this._parts.length;n<a;n++)for(s=0,r=(l=(e=this._parts[n]).length)-1;s<l;r=s++)i=e[s],o=e[r],i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(d=!d);return d||so.prototype._containsPoint.call(this,t,!0)}});function lo(t,e){return new ao(t,e)}var co=Wi.extend({initialize:function(t,e){m(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,i,o,n=b(t)?t:t.features;if(n){for(e=0,i=n.length;e<i;e++)((o=n[e]).geometries||o.geometry||o.features||o.coordinates)&&this.addData(o);return this}var s=this.options;if(s.filter&&!s.filter(t))return this;var r=ho(t,s);return r?(r.feature=vo(t),r.defaultOptions=r.options,this.resetStyle(r),s.onEachFeature&&s.onEachFeature(t,r),this.addLayer(r)):this},resetStyle:function(t){return t.options=o({},t.defaultOptions),this._setLayerStyle(t,this.options.style),this},setStyle:function(t){return this.eachLayer((function(e){this._setLayerStyle(e,t)}),this)},_setLayerStyle:function(t,e){t.setStyle&&("function"==typeof e&&(e=e(t.feature)),t.setStyle(e))}});function ho(t,e){var i,o,n,s,r="Feature"===t.type?t.geometry:t,a=r?r.coordinates:null,l=[],d=e&&e.pointToLayer,c=e&&e.coordsToLatLng||uo;if(!a&&!r)return null;switch(r.type){case"Point":return i=c(a),d?d(t,i):new Qi(i);case"MultiPoint":for(n=0,s=a.length;n<s;n++)i=c(a[n]),l.push(d?d(t,i):new Qi(i));return new Wi(l);case"LineString":case"MultiLineString":return o=po(a,"LineString"===r.type?0:1,c),new so(o,e);case"Polygon":case"MultiPolygon":return o=po(a,"Polygon"===r.type?1:2,c),new ao(o,e);case"GeometryCollection":for(n=0,s=r.geometries.length;n<s;n++){var h=ho({geometry:r.geometries[n],type:"Feature",properties:t.properties},e);h&&l.push(h)}return new Wi(l);default:throw new Error("Invalid GeoJSON object.")}}function uo(t){return new q(t[1],t[0],t[2])}function po(t,e,i){for(var o,n=[],s=0,r=t.length;s<r;s++)o=e?po(t[s],e-1,i):(i||uo)(t[s]),n.push(o);return n}function mo(t,e){return e="number"==typeof e?e:6,void 0!==t.alt?[h(t.lng,e),h(t.lat,e),h(t.alt,e)]:[h(t.lng,e),h(t.lat,e)]}function go(t,e,i,o){for(var n=[],s=0,r=t.length;s<r;s++)n.push(e?go(t[s],e-1,i,o):mo(t[s],o));return!e&&i&&n.push(n[0]),n}function fo(t,e){return t.feature?o({},t.feature,{geometry:e}):vo(e)}function vo(t){return"Feature"===t.type||"FeatureCollection"===t.type?t:{type:"Feature",properties:{},geometry:t}}var bo={toGeoJSON:function(t){return fo(this,{type:"Point",coordinates:mo(this.getLatLng(),t)})}};function yo(t,e){return new co(t,e)}Qi.include(bo),oo.include(bo),eo.include(bo),so.include({toGeoJSON:function(t){var e=!Ii(this._latlngs);return fo(this,{type:(e?"Multi":"")+"LineString",coordinates:go(this._latlngs,e?1:0,!1,t)})}}),ao.include({toGeoJSON:function(t){var e=!Ii(this._latlngs),i=e&&!Ii(this._latlngs[0]),o=go(this._latlngs,i?2:e?1:0,!0,t);return e||(o=[o]),fo(this,{type:(i?"Multi":"")+"Polygon",coordinates:o})}}),Vi.include({toMultiPoint:function(t){var e=[];return this.eachLayer((function(i){e.push(i.toGeoJSON(t).geometry.coordinates)})),fo(this,{type:"MultiPoint",coordinates:e})},toGeoJSON:function(t){var e=this.feature&&this.feature.geometry&&this.feature.geometry.type;if("MultiPoint"===e)return this.toMultiPoint(t);var i="GeometryCollection"===e,o=[];return this.eachLayer((function(e){if(e.toGeoJSON){var n=e.toGeoJSON(t);if(i)o.push(n.geometry);else{var s=vo(n);"FeatureCollection"===s.type?o.push.apply(o,s.features):o.push(s)}}})),i?fo(this,{geometries:o,type:"GeometryCollection"}):{type:"FeatureCollection",features:o}}});var xo=yo,_o=ji.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,e,i){this._url=t,this._bounds=F(e),m(this,i)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(ve(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){ue(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&me(this._image),this},bringToBack:function(){return this._map&&ge(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=F(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t="IMG"===this._url.tagName,e=this._image=t?this._url:he("img");ve(e,"leaflet-image-layer"),this._zoomAnimated&&ve(e,"leaflet-zoom-animated"),this.options.className&&ve(e,this.options.className),e.onselectstart=c,e.onmousemove=c,e.onload=s(this.fire,this,"load"),e.onerror=s(this._overlayOnError,this,"error"),(this.options.crossOrigin||""===this.options.crossOrigin)&&(e.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t?this._url=e.src:(e.src=this._url,e.alt=this.options.alt)},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),i=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;Ce(this._image,i,e)},_reset:function(){var t=this._image,e=new R(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),i=e.getSize();Se(t,e.min),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){_e(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)}}),wo=function(t,e,i){return new _o(t,e,i)},ko=_o.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0},_initImage:function(){var t="VIDEO"===this._url.tagName,e=this._image=t?this._url:he("video");if(ve(e,"leaflet-image-layer"),this._zoomAnimated&&ve(e,"leaflet-zoom-animated"),e.onselectstart=c,e.onmousemove=c,e.onloadeddata=s(this.fire,this,"load"),t){for(var i=e.getElementsByTagName("source"),o=[],n=0;n<i.length;n++)o.push(i[n].src);this._url=i.length>0?o:[e.src]}else{b(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&e.style.hasOwnProperty("objectFit")&&(e.style.objectFit="fill"),e.autoplay=!!this.options.autoplay,e.loop=!!this.options.loop;for(var r=0;r<this._url.length;r++){var a=he("source");a.src=this._url[r],e.appendChild(a)}}}});function Co(t,e,i){return new ko(t,e,i)}var So=_o.extend({_initImage:function(){var t=this._image=this._url;ve(t,"leaflet-image-layer"),this._zoomAnimated&&ve(t,"leaflet-zoom-animated"),t.onselectstart=c,t.onmousemove=c}});function Ao(t,e,i){return new So(t,e,i)}var Eo=ji.extend({options:{offset:[0,7],className:"",pane:"popupPane"},initialize:function(t,e){m(this,t),this._source=e},onAdd:function(t){this._zoomAnimated=t._zoomAnimated,this._container||this._initLayout(),t._fadeAnimated&&_e(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&_e(this._container,1),this.bringToFront()},onRemove:function(t){t._fadeAnimated?(_e(this._container,0),this._removeTimeout=setTimeout(s(ue,void 0,this._container),200)):ue(this._container)},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=U(t),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(t){return this._content=t,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var t={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&me(this._container),this},bringToBack:function(){return this._map&&ge(this._container),this},_prepareOpen:function(t,e,i){if(e instanceof ji||(i=e,e=t),e instanceof Wi)for(var o in t._layers){e=t._layers[o];break}if(!i)if(e.getCenter)i=e.getCenter();else{if(!e.getLatLng)throw new Error("Unable to get source layer LatLng.");i=e.getLatLng()}return this._source=e,this.update(),i},_updateContent:function(){if(this._content){var t=this._contentNode,e="function"==typeof this._content?this._content(this._source||this):this._content;if("string"==typeof e)t.innerHTML=e;else{for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(e)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var t=this._map.latLngToLayerPoint(this._latlng),e=P(this.options.offset),i=this._getAnchor();this._zoomAnimated?Se(this._container,t.add(i)):e=e.add(t).add(i);var o=this._containerBottom=-e.y,n=this._containerLeft=-Math.round(this._containerWidth/2)+e.x;this._container.style.bottom=o+"px",this._container.style.left=n+"px"}},_getAnchor:function(){return[0,0]}}),$o=Eo.extend({options:{maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(t){return t.openPopup(this),this},onAdd:function(t){Eo.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof to||this._source.on("preclick",Fe))},onRemove:function(t){Eo.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof to||this._source.off("preclick",Fe))},getEvents:function(){var t=Eo.prototype.getEvents.call(this);return(void 0!==this.options.closeOnClick?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(t.preclick=this._close),this.options.keepInView&&(t.moveend=this._adjustPan),t},_close:function(){this._map&&this._map.closePopup(this)},_initLayout:function(){var t="leaflet-popup",e=this._container=he("div",t+" "+(this.options.className||"")+" leaflet-zoom-animated"),i=this._wrapper=he("div",t+"-content-wrapper",e);if(this._contentNode=he("div",t+"-content",i),Ue(i),qe(this._contentNode),ze(i,"contextmenu",Fe),this._tipContainer=he("div",t+"-tip-container",e),this._tip=he("div",t+"-tip",this._tipContainer),this.options.closeButton){var o=this._closeButton=he("a",t+"-close-button",e);o.href="#close",o.innerHTML="&#215;",ze(o,"click",this._onCloseButtonClick,this)}},_updateLayout:function(){var t=this._contentNode,e=t.style;e.width="",e.whiteSpace="nowrap";var i=t.offsetWidth;i=Math.min(i,this.options.maxWidth),i=Math.max(i,this.options.minWidth),e.width=i+1+"px",e.whiteSpace="",e.height="";var o=t.offsetHeight,n=this.options.maxHeight,s="leaflet-popup-scrolled";n&&o>n?(e.height=n+"px",ve(t,s)):be(t,s),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),i=this._getAnchor();Se(this._container,e.add(i))},_adjustPan:function(){if(this.options.autoPan){this._map._panAnim&&this._map._panAnim.stop();var t=this._map,e=parseInt(ce(this._container,"marginBottom"),10)||0,i=this._container.offsetHeight+e,o=this._containerWidth,n=new O(this._containerLeft,-i-this._containerBottom);n._add(Ae(this._container));var s=t.layerPointToContainerPoint(n),r=P(this.options.autoPanPadding),a=P(this.options.autoPanPaddingTopLeft||r),l=P(this.options.autoPanPaddingBottomRight||r),d=t.getSize(),c=0,h=0;s.x+o+l.x>d.x&&(c=s.x+o-d.x+l.x),s.x-c-a.x<0&&(c=s.x-a.x),s.y+i+l.y>d.y&&(h=s.y+i-d.y+l.y),s.y-h-a.y<0&&(h=s.y-a.y),(c||h)&&t.fire("autopanstart").panBy([c,h])}},_onCloseButtonClick:function(t){this._close(),Ve(t)},_getAnchor:function(){return P(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),To=function(t,e){return new $o(t,e)};ii.mergeOptions({closePopupOnClick:!0}),ii.include({openPopup:function(t,e,i){return t instanceof $o||(t=new $o(i).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=t,this.addLayer(t))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),ji.include({bindPopup:function(t,e){return t instanceof $o?(m(t,e),this._popup=t,t._source=this):(this._popup&&!e||(this._popup=new $o(e,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t,e){return this._popup&&this._map&&(e=this._popup._prepareOpen(this,t,e),this._map.openPopup(this._popup,e)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var e=t.layer||t.target;this._popup&&this._map&&(Ve(t),e instanceof to?this.openPopup(t.layer||t.target,t.latlng):this._map.hasLayer(this._popup)&&this._popup._source===e?this.closePopup():this.openPopup(e,t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var Do=Eo.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){Eo.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&this._source.fire("tooltipopen",{tooltip:this},!0)},onRemove:function(t){Eo.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&this._source.fire("tooltipclose",{tooltip:this},!0)},getEvents:function(){var t=Eo.prototype.getEvents.call(this);return Ct&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=he("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e=this._map,i=this._container,o=e.latLngToContainerPoint(e.getCenter()),n=e.layerPointToContainerPoint(t),s=this.options.direction,r=i.offsetWidth,a=i.offsetHeight,l=P(this.options.offset),d=this._getAnchor();"top"===s?t=t.add(P(-r/2+l.x,-a+l.y+d.y,!0)):"bottom"===s?t=t.subtract(P(r/2-l.x,-l.y,!0)):"center"===s?t=t.subtract(P(r/2+l.x,a/2-d.y+l.y,!0)):"right"===s||"auto"===s&&n.x<o.x?(s="right",t=t.add(P(l.x+d.x,d.y-a/2+l.y,!0))):(s="left",t=t.subtract(P(r+d.x-l.x,a/2-d.y-l.y,!0))),be(i,"leaflet-tooltip-right"),be(i,"leaflet-tooltip-left"),be(i,"leaflet-tooltip-top"),be(i,"leaflet-tooltip-bottom"),ve(i,"leaflet-tooltip-"+s),Se(i,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&_e(this._container,t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(e)},_getAnchor:function(){return P(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Mo=function(t,e){return new Do(t,e)};ii.include({openTooltip:function(t,e,i){return t instanceof Do||(t=new Do(i).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:this.addLayer(t)},closeTooltip:function(t){return t&&this.removeLayer(t),this}}),ji.include({bindTooltip:function(t,e){return t instanceof Do?(m(t,e),this._tooltip=t,t._source=this):(this._tooltip&&!e||(this._tooltip=new Do(e,this)),this._tooltip.setContent(t)),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(t){if(t||!this._tooltipHandlersAdded){var e=t?"off":"on",i={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?i.add=this._openTooltip:(i.mouseover=this._openTooltip,i.mouseout=this.closeTooltip,this._tooltip.options.sticky&&(i.mousemove=this._moveTooltip),Ct&&(i.click=this._openTooltip)),this[e](i),this._tooltipHandlersAdded=!t}},openTooltip:function(t,e){return this._tooltip&&this._map&&(e=this._tooltip._prepareOpen(this,t,e),this._map.openTooltip(this._tooltip,e),this._tooltip.options.interactive&&this._tooltip._container&&(ve(this._tooltip._container,"leaflet-clickable"),this.addInteractiveTarget(this._tooltip._container))),this},closeTooltip:function(){return this._tooltip&&(this._tooltip._close(),this._tooltip.options.interactive&&this._tooltip._container&&(be(this._tooltip._container,"leaflet-clickable"),this.removeInteractiveTarget(this._tooltip._container))),this},toggleTooltip:function(t){return this._tooltip&&(this._tooltip._map?this.closeTooltip():this.openTooltip(t)),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(t){return this._tooltip&&this._tooltip.setContent(t),this},getTooltip:function(){return this._tooltip},_openTooltip:function(t){var e=t.layer||t.target;this._tooltip&&this._map&&this.openTooltip(e,this._tooltip.options.sticky?t.latlng:void 0)},_moveTooltip:function(t){var e,i,o=t.latlng;this._tooltip.options.sticky&&t.originalEvent&&(e=this._map.mouseEventToContainerPoint(t.originalEvent),i=this._map.containerPointToLayerPoint(e),o=this._map.layerPointToLatLng(i)),this._tooltip.setLatLng(o)}});var Io=Yi.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var e=t&&"DIV"===t.tagName?t:document.createElement("div"),i=this.options;if(i.html instanceof Element?(pe(e),e.appendChild(i.html)):e.innerHTML=!1!==i.html?i.html:"",i.bgPos){var o=P(i.bgPos);e.style.backgroundPosition=-o.x+"px "+-o.y+"px"}return this._setIconStyles(e,"icon"),e},createShadow:function(){return null}});function Oo(t){return new Io(t)}Yi.Default=Ki;var Lo=ji.extend({options:{tileSize:256,opacity:1,updateWhenIdle:yt,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(t){m(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView(),this._update()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),ue(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(me(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(ge(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){return this._map&&(this._removeAllTiles(),this._update()),this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=l(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},createTile:function(){return document.createElement("div")},getTileSize:function(){var t=this.options.tileSize;return t instanceof O?t:new O(t,t)},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var e,i=this.getPane().children,o=-t(-1/0,1/0),n=0,s=i.length;n<s;n++)e=i[n].style.zIndex,i[n]!==this._container&&e&&(o=t(o,+e));isFinite(o)&&(this.options.zIndex=o+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!et){_e(this._container,this.options.opacity);var t=+new Date,e=!1,i=!1;for(var o in this._tiles){var n=this._tiles[o];if(n.current&&n.loaded){var s=Math.min(1,(t-n.loaded)/200);_e(n.el,s),s<1?e=!0:(n.active?i=!0:this._onOpaqueTile(n),n.active=!0)}}i&&!this._noPrune&&this._pruneTiles(),e&&(E(this._fadeFrame),this._fadeFrame=A(this._updateOpacity,this))}},_onOpaqueTile:c,_initContainer:function(){this._container||(this._container=he("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var t=this._tileZoom,e=this.options.maxZoom;if(void 0!==t){for(var i in this._levels)this._levels[i].el.children.length||i===t?(this._levels[i].el.style.zIndex=e-Math.abs(t-i),this._onUpdateLevel(i)):(ue(this._levels[i].el),this._removeTilesAtZoom(i),this._onRemoveLevel(i),delete this._levels[i]);var o=this._levels[t],n=this._map;return o||((o=this._levels[t]={}).el=he("div","leaflet-tile-container leaflet-zoom-animated",this._container),o.el.style.zIndex=e,o.origin=n.project(n.unproject(n.getPixelOrigin()),t).round(),o.zoom=t,this._setZoomTransform(o,n.getCenter(),n.getZoom()),c(o.el.offsetWidth),this._onCreateLevel(o)),this._level=o,o}},_onUpdateLevel:c,_onRemoveLevel:c,_onCreateLevel:c,_pruneTiles:function(){if(this._map){var t,e,i=this._map.getZoom();if(i>this.options.maxZoom||i<this.options.minZoom)this._removeAllTiles();else{for(t in this._tiles)(e=this._tiles[t]).retain=e.current;for(t in this._tiles)if((e=this._tiles[t]).current&&!e.active){var o=e.coords;this._retainParent(o.x,o.y,o.z,o.z-5)||this._retainChildren(o.x,o.y,o.z,o.z+2)}for(t in this._tiles)this._tiles[t].retain||this._removeTile(t)}}},_removeTilesAtZoom:function(t){for(var e in this._tiles)this._tiles[e].coords.z===t&&this._removeTile(e)},_removeAllTiles:function(){for(var t in this._tiles)this._removeTile(t)},_invalidateAll:function(){for(var t in this._levels)ue(this._levels[t].el),this._onRemoveLevel(t),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,e,i,o){var n=Math.floor(t/2),s=Math.floor(e/2),r=i-1,a=new O(+n,+s);a.z=+r;var l=this._tileCoordsToKey(a),d=this._tiles[l];return d&&d.active?(d.retain=!0,!0):(d&&d.loaded&&(d.retain=!0),r>o&&this._retainParent(n,s,r,o))},_retainChildren:function(t,e,i,o){for(var n=2*t;n<2*t+2;n++)for(var s=2*e;s<2*e+2;s++){var r=new O(n,s);r.z=i+1;var a=this._tileCoordsToKey(r),l=this._tiles[a];l&&l.active?l.retain=!0:(l&&l.loaded&&(l.retain=!0),i+1<o&&this._retainChildren(n,s,i+1,o))}},_resetView:function(t){var e=t&&(t.pinch||t.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),e,e)},_animateZoom:function(t){this._setView(t.center,t.zoom,!0,t.noUpdate)},_clampZoom:function(t){var e=this.options;return void 0!==e.minNativeZoom&&t<e.minNativeZoom?e.minNativeZoom:void 0!==e.maxNativeZoom&&e.maxNativeZoom<t?e.maxNativeZoom:t},_setView:function(t,e,i,o){var n=this._clampZoom(Math.round(e));(void 0!==this.options.maxZoom&&n>this.options.maxZoom||void 0!==this.options.minZoom&&n<this.options.minZoom)&&(n=void 0);var s=this.options.updateWhenZooming&&n!==this._tileZoom;o&&!s||(this._tileZoom=n,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),void 0!==n&&this._update(t),i||this._pruneTiles(),this._noPrune=!!i),this._setZoomTransforms(t,e)},_setZoomTransforms:function(t,e){for(var i in this._levels)this._setZoomTransform(this._levels[i],t,e)},_setZoomTransform:function(t,e,i){var o=this._map.getZoomScale(i,t.zoom),n=t.origin.multiplyBy(o).subtract(this._map._getNewPixelOrigin(e,i)).round();bt?Ce(t.el,n,o):Se(t.el,n)},_resetGrid:function(){var t=this._map,e=t.options.crs,i=this._tileSize=this.getTileSize(),o=this._tileZoom,n=this._map.getPixelWorldBounds(this._tileZoom);n&&(this._globalTileRange=this._pxBoundsToTileRange(n)),this._wrapX=e.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,e.wrapLng[0]],o).x/i.x),Math.ceil(t.project([0,e.wrapLng[1]],o).x/i.y)],this._wrapY=e.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([e.wrapLat[0],0],o).y/i.x),Math.ceil(t.project([e.wrapLat[1],0],o).y/i.y)]},_onMoveEnd:function(){this._map&&!this._map._animatingZoom&&this._update()},_getTiledPixelBounds:function(t){var e=this._map,i=e._animatingZoom?Math.max(e._animateToZoom,e.getZoom()):e.getZoom(),o=e.getZoomScale(i,this._tileZoom),n=e.project(t,this._tileZoom).floor(),s=e.getSize().divideBy(2*o);return new R(n.subtract(s),n.add(s))},_update:function(t){var e=this._map;if(e){var i=this._clampZoom(e.getZoom());if(void 0===t&&(t=e.getCenter()),void 0!==this._tileZoom){var o=this._getTiledPixelBounds(t),n=this._pxBoundsToTileRange(o),s=n.getCenter(),r=[],a=this.options.keepBuffer,l=new R(n.getBottomLeft().subtract([a,-a]),n.getTopRight().add([a,-a]));if(!(isFinite(n.min.x)&&isFinite(n.min.y)&&isFinite(n.max.x)&&isFinite(n.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var d in this._tiles){var c=this._tiles[d].coords;c.z===this._tileZoom&&l.contains(new O(c.x,c.y))||(this._tiles[d].current=!1)}if(Math.abs(i-this._tileZoom)>1)this._setView(t,i);else{for(var h=n.min.y;h<=n.max.y;h++)for(var u=n.min.x;u<=n.max.x;u++){var p=new O(u,h);if(p.z=this._tileZoom,this._isValidTile(p)){var m=this._tiles[this._tileCoordsToKey(p)];m?m.current=!0:r.push(p)}}if(r.sort((function(t,e){return t.distanceTo(s)-e.distanceTo(s)})),0!==r.length){this._loading||(this._loading=!0,this.fire("loading"));var g=document.createDocumentFragment();for(u=0;u<r.length;u++)this._addTile(r[u],g);this._level.el.appendChild(g)}}}}},_isValidTile:function(t){var e=this._map.options.crs;if(!e.infinite){var i=this._globalTileRange;if(!e.wrapLng&&(t.x<i.min.x||t.x>i.max.x)||!e.wrapLat&&(t.y<i.min.y||t.y>i.max.y))return!1}if(!this.options.bounds)return!0;var o=this._tileCoordsToBounds(t);return F(this.options.bounds).overlaps(o)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,i=this.getTileSize(),o=t.scaleBy(i),n=o.add(i);return[e.unproject(o,t.z),e.unproject(n,t.z)]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),i=new B(e[0],e[1]);return this.options.noWrap||(i=this._map.wrapLatLngBounds(i)),i},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=t.split(":"),i=new O(+e[0],+e[1]);return i.z=+e[2],i},_removeTile:function(t){var e=this._tiles[t];e&&(ue(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){ve(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=c,t.onmousemove=c,et&&this.options.opacity<1&&_e(t,this.options.opacity),nt&&!st&&(t.style.WebkitBackfaceVisibility="hidden")},_addTile:function(t,e){var i=this._getTilePos(t),o=this._tileCoordsToKey(t),n=this.createTile(this._wrapCoords(t),s(this._tileReady,this,t));this._initTile(n),this.createTile.length<2&&A(s(this._tileReady,this,t,null,n)),Se(n,i),this._tiles[o]={el:n,coords:t,current:!0},e.appendChild(n),this.fire("tileloadstart",{tile:n,coords:t})},_tileReady:function(t,e,i){e&&this.fire("tileerror",{error:e,tile:i,coords:t});var o=this._tileCoordsToKey(t);(i=this._tiles[o])&&(i.loaded=+new Date,this._map._fadeAnimated?(_e(i.el,0),E(this._fadeFrame),this._fadeFrame=A(this._updateOpacity,this)):(i.active=!0,this._pruneTiles()),e||(ve(i.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:i.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),et||!this._map._fadeAnimated?A(this._pruneTiles,this):setTimeout(s(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new O(this._wrapX?d(t.x,this._wrapX):t.x,this._wrapY?d(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new R(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});function zo(t){return new Lo(t)}var Po=Lo.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(t,e){this._url=t,(e=m(this,e)).detectRetina&&Et&&e.maxZoom>0&&(e.tileSize=Math.floor(e.tileSize/2),e.zoomReverse?(e.zoomOffset--,e.minZoom++):(e.zoomOffset++,e.maxZoom--),e.minZoom=Math.max(0,e.minZoom)),"string"==typeof e.subdomains&&(e.subdomains=e.subdomains.split("")),nt||this.on("tileunload",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&void 0===e&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var i=document.createElement("img");return ze(i,"load",s(this._tileOnLoad,this,e,i)),ze(i,"error",s(this._tileOnError,this,e,i)),(this.options.crossOrigin||""===this.options.crossOrigin)&&(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),i.alt="",i.setAttribute("role","presentation"),i.src=this.getTileUrl(t),i},getTileUrl:function(t){var e={r:Et?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var i=this._globalTileRange.max.y-t.y;this.options.tms&&(e.y=i),e["-y"]=i}return v(this._url,o(e,this.options))},_tileOnLoad:function(t,e){et?setTimeout(s(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,i){var o=this.options.errorTileUrl;o&&e.getAttribute("src")!==o&&(e.src=o),t(i,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom;return this.options.zoomReverse&&(t=e-t),t+this.options.zoomOffset},_getSubdomain:function(t){var e=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[e]},_abortLoading:function(){var t,e;for(t in this._tiles)this._tiles[t].coords.z!==this._tileZoom&&((e=this._tiles[t].el).onload=c,e.onerror=c,e.complete||(e.src=x,ue(e),delete this._tiles[t]))},_removeTile:function(t){var e=this._tiles[t];if(e)return at||e.el.setAttribute("src",x),Lo.prototype._removeTile.call(this,t)},_tileReady:function(t,e,i){if(this._map&&(!i||i.getAttribute("src")!==x))return Lo.prototype._tileReady.call(this,t,e,i)}});function Ro(t,e){return new Po(t,e)}var No=Po.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,e){this._url=t;var i=o({},this.defaultWmsParams);for(var n in e)n in this.options||(i[n]=e[n]);var s=(e=m(this,e)).detectRetina&&Et?2:1,r=this.getTileSize();i.width=r.x*s,i.height=r.y*s,this.wmsParams=i},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var e=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[e]=this._crs.code,Po.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),i=this._crs,o=N(i.project(e[0]),i.project(e[1])),n=o.min,s=o.max,r=(this._wmsVersion>=1.3&&this._crs===qi?[n.y,n.x,s.y,s.x]:[n.x,n.y,s.x,s.y]).join(","),a=Po.prototype.getTileUrl.call(this,t);return a+g(this.wmsParams,a,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+r},setParams:function(t,e){return o(this.wmsParams,t),e||this.redraw(),this}});function Bo(t,e){return new No(t,e)}Po.WMS=No,Ro.wms=Bo;var Fo=ji.extend({options:{padding:.1,tolerance:0},initialize:function(t){m(this,t),a(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),this._zoomAnimated&&ve(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,e){var i=this._map.getZoomScale(e,this._zoom),o=Ae(this._container),n=this._map.getSize().multiplyBy(.5+this.options.padding),s=this._map.project(this._center,e),r=this._map.project(t,e).subtract(s),a=n.multiplyBy(-i).add(o).add(n).subtract(r);bt?Ce(this._container,a,i):Se(this._container,a)},_reset:function(){for(var t in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,e=this._map.getSize(),i=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new R(i,i.add(e.multiplyBy(1+2*t)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),qo=Fo.extend({getEvents:function(){var t=Fo.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Fo.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");ze(t,"mousemove",l(this._onMouseMove,32,this),this),ze(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),ze(t,"mouseout",this._handleMouseOut,this),this._ctx=t.getContext("2d")},_destroyContainer:function(){E(this._redrawRequest),delete this._ctx,ue(this._container),Re(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){for(var t in this._redrawBounds=null,this._layers)this._layers[t]._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){Fo.prototype._update.call(this);var t=this._bounds,e=this._container,i=t.getSize(),o=Et?2:1;Se(e,t.min),e.width=o*i.x,e.height=o*i.y,e.style.width=i.x+"px",e.style.height=i.y+"px",Et&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){Fo.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[a(t)]=t;var e=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=e),this._drawLast=e,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var e=t._order,i=e.next,o=e.prev;i?i.prev=o:this._drawLast=o,o?o.next=i:this._drawFirst=i,delete t._order,delete this._layers[a(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if("string"==typeof t.options.dashArray){var e,i,o=t.options.dashArray.split(/[, ]+/),n=[];for(i=0;i<o.length;i++){if(e=Number(o[i]),isNaN(e))return;n.push(e)}t.options._dashArray=n}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||A(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var e=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new R,this._redrawBounds.extend(t._pxBounds.min.subtract([e,e])),this._redrawBounds.extend(t._pxBounds.max.add([e,e]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var t=this._redrawBounds;if(t){var e=t.getSize();this._ctx.clearRect(t.min.x,t.min.y,e.x,e.y)}else this._ctx.clearRect(0,0,this._container.width,this._container.height)},_draw:function(){var t,e=this._redrawBounds;if(this._ctx.save(),e){var i=e.getSize();this._ctx.beginPath(),this._ctx.rect(e.min.x,e.min.y,i.x,i.y),this._ctx.clip()}this._drawing=!0;for(var o=this._drawFirst;o;o=o.next)t=o.layer,(!e||t._pxBounds&&t._pxBounds.intersects(e))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,e){if(this._drawing){var i,o,n,s,r=t._parts,a=r.length,l=this._ctx;if(a){for(l.beginPath(),i=0;i<a;i++){for(o=0,n=r[i].length;o<n;o++)s=r[i][o],l[o?"lineTo":"moveTo"](s.x,s.y);e&&l.closePath()}this._fillStroke(l,t)}}},_updateCircle:function(t){if(this._drawing&&!t._empty()){var e=t._point,i=this._ctx,o=Math.max(Math.round(t._radius),1),n=(Math.max(Math.round(t._radiusY),1)||o)/o;1!==n&&(i.save(),i.scale(1,n)),i.beginPath(),i.arc(e.x,e.y/n,o,0,2*Math.PI,!1),1!==n&&i.restore(),this._fillStroke(i,t)}},_fillStroke:function(t,e){var i=e.options;i.fill&&(t.globalAlpha=i.fillOpacity,t.fillStyle=i.fillColor||i.color,t.fill(i.fillRule||"evenodd")),i.stroke&&0!==i.weight&&(t.setLineDash&&t.setLineDash(e.options&&e.options._dashArray||[]),t.globalAlpha=i.opacity,t.lineWidth=i.weight,t.strokeStyle=i.color,t.lineCap=i.lineCap,t.lineJoin=i.lineJoin,t.stroke())},_onClick:function(t){for(var e,i,o=this._map.mouseEventToLayerPoint(t),n=this._drawFirst;n;n=n.next)(e=n.layer).options.interactive&&e._containsPoint(o)&&!this._map._draggableMoved(e)&&(i=e);i&&(Ke(t),this._fireEvent([i],t))},_onMouseMove:function(t){if(this._map&&!this._map.dragging.moving()&&!this._map._animatingZoom){var e=this._map.mouseEventToLayerPoint(t);this._handleMouseHover(t,e)}},_handleMouseOut:function(t){var e=this._hoveredLayer;e&&(be(this._container,"leaflet-interactive"),this._fireEvent([e],t,"mouseout"),this._hoveredLayer=null)},_handleMouseHover:function(t,e){for(var i,o,n=this._drawFirst;n;n=n.next)(i=n.layer).options.interactive&&i._containsPoint(e)&&(o=i);o!==this._hoveredLayer&&(this._handleMouseOut(t),o&&(ve(this._container,"leaflet-interactive"),this._fireEvent([o],t,"mouseover"),this._hoveredLayer=o)),this._hoveredLayer&&this._fireEvent([this._hoveredLayer],t)},_fireEvent:function(t,e,i){this._map._fireDOMEvent(e,i||e.type,t)},_bringToFront:function(t){var e=t._order;if(e){var i=e.next,o=e.prev;i&&(i.prev=o,o?o.next=i:i&&(this._drawFirst=i),e.prev=this._drawLast,this._drawLast.next=e,e.next=null,this._drawLast=e,this._requestRedraw(t))}},_bringToBack:function(t){var e=t._order;if(e){var i=e.next,o=e.prev;o&&(o.next=i,i?i.prev=o:o&&(this._drawLast=o),e.prev=null,e.next=this._drawFirst,this._drawFirst.prev=e,this._drawFirst=e,this._requestRedraw(t))}}});function Uo(t){return $t?new qo(t):null}var jo=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch(t){return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),Vo={_initContainer:function(){this._container=he("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Fo.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=jo("shape");ve(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=jo("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;ue(e),t.removeInteractiveTarget(e),delete this._layers[a(t)]},_updateStyle:function(t){var e=t._stroke,i=t._fill,o=t.options,n=t._container;n.stroked=!!o.stroke,n.filled=!!o.fill,o.stroke?(e||(e=t._stroke=jo("stroke")),n.appendChild(e),e.weight=o.weight+"px",e.color=o.color,e.opacity=o.opacity,o.dashArray?e.dashStyle=b(o.dashArray)?o.dashArray.join(" "):o.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=o.lineCap.replace("butt","flat"),e.joinstyle=o.lineJoin):e&&(n.removeChild(e),t._stroke=null),o.fill?(i||(i=t._fill=jo("fill")),n.appendChild(i),i.color=o.fillColor||o.color,i.opacity=o.fillOpacity):i&&(n.removeChild(i),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),i=Math.round(t._radius),o=Math.round(t._radiusY||i);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+i+","+o+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){me(t._container)},_bringToBack:function(t){ge(t._container)}},Ho=Dt?jo:X,Wo=Fo.extend({getEvents:function(){var t=Fo.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=Ho("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Ho("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ue(this._container),Re(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(!this._map._animatingZoom||!this._bounds){Fo.prototype._update.call(this);var t=this._bounds,e=t.getSize(),i=this._container;this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,i.setAttribute("width",e.x),i.setAttribute("height",e.y)),Se(i,t.min),i.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update")}},_initPath:function(t){var e=t._path=Ho("path");t.options.className&&ve(e,t.options.className),t.options.interactive&&ve(e,"leaflet-interactive"),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ue(t._path),t.removeInteractiveTarget(t._path),delete this._layers[a(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,i=t.options;e&&(i.stroke?(e.setAttribute("stroke",i.color),e.setAttribute("stroke-opacity",i.opacity),e.setAttribute("stroke-width",i.weight),e.setAttribute("stroke-linecap",i.lineCap),e.setAttribute("stroke-linejoin",i.lineJoin),i.dashArray?e.setAttribute("stroke-dasharray",i.dashArray):e.removeAttribute("stroke-dasharray"),i.dashOffset?e.setAttribute("stroke-dashoffset",i.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),i.fill?(e.setAttribute("fill",i.fillColor||i.color),e.setAttribute("fill-opacity",i.fillOpacity),e.setAttribute("fill-rule",i.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,Q(t._parts,e))},_updateCircle:function(t){var e=t._point,i=Math.max(Math.round(t._radius),1),o="a"+i+","+(Math.max(Math.round(t._radiusY),1)||i)+" 0 1,0 ",n=t._empty()?"M0 0":"M"+(e.x-i)+","+e.y+o+2*i+",0 "+o+2*-i+",0 ";this._setPath(t,n)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){me(t._path)},_bringToBack:function(t){ge(t._path)}});function Zo(t){return Tt||Dt?new Wo(t):null}Dt&&Wo.include(Vo),ii.include({getRenderer:function(t){var e=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return e||(e=this._renderer=this._createRenderer()),this.hasLayer(e)||this.addLayer(e),e},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var e=this._paneRenderers[t];return void 0===e&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&Uo(t)||Zo(t)}});var Yo=ao.extend({initialize:function(t,e){ao.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=F(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function Go(t,e){return new Yo(t,e)}Wo.create=Ho,Wo.pointsToPath=Q,co.geometryToLayer=ho,co.coordsToLatLng=uo,co.coordsToLatLngs=po,co.latLngToCoords=mo,co.latLngsToCoords=go,co.getFeature=fo,co.asFeature=vo,ii.mergeOptions({boxZoom:!0});var Ko=mi.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){ze(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Re(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ue(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),ee(),$e(),this._startPoint=this._map.mouseEventToContainerPoint(t),ze(document,{contextmenu:Ve,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=he("div","leaflet-zoom-box",this._container),ve(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=new R(this._point,this._startPoint),i=e.getSize();Se(this._box,e.min),this._box.style.width=i.x+"px",this._box.style.height=i.y+"px"},_finish:function(){this._moved&&(ue(this._box),be(this._container,"leaflet-crosshair")),ie(),Te(),Re(document,{contextmenu:Ve,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(s(this._resetState,this),0);var e=new B(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});ii.addInitHook("addHandler","boxZoom",Ko),ii.mergeOptions({doubleClickZoom:!0});var Xo=mi.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,i=e.getZoom(),o=e.options.zoomDelta,n=t.originalEvent.shiftKey?i-o:i+o;"center"===e.options.doubleClickZoom?e.setZoom(n):e.setZoomAround(t.containerPoint,n)}});ii.addInitHook("addHandler","doubleClickZoom",Xo),ii.mergeOptions({dragging:!0,inertia:!st,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Qo=mi.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new xi(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}ve(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){be(this._map._container,"leaflet-grab"),be(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var e=F(this._map.options.maxBounds);this._offsetLimit=N(this._map.latLngToContainerPoint(e.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(e.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var e=this._lastTime=+new Date,i=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(i),this._times.push(e),this._prunePositions(e)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),e=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=e.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,e){return t-(t-e)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var t=this._draggable._newPos.subtract(this._draggable._startPos),e=this._offsetLimit;t.x<e.min.x&&(t.x=this._viscousLimit(t.x,e.min.x)),t.y<e.min.y&&(t.y=this._viscousLimit(t.y,e.min.y)),t.x>e.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),i=this._initialWorldOffset,o=this._draggable._newPos.x,n=(o-e+i)%t+e-i,s=(o+e+i)%t-e-i,r=Math.abs(n+i)<Math.abs(s+i)?n:s;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=r},_onDragEnd:function(t){var e=this._map,i=e.options,o=!i.inertia||this._times.length<2;if(e.fire("dragend",t),o)e.fire("moveend");else{this._prunePositions(+new Date);var n=this._lastPos.subtract(this._positions[0]),s=(this._lastTime-this._times[0])/1e3,r=i.easeLinearity,a=n.multiplyBy(r/s),l=a.distanceTo([0,0]),d=Math.min(i.inertiaMaxSpeed,l),c=a.multiplyBy(d/l),h=d/(i.inertiaDeceleration*r),u=c.multiplyBy(-h/2).round();u.x||u.y?(u=e._limitOffset(u,e.options.maxBounds),A((function(){e.panBy(u,{duration:h,easeLinearity:r,noMoveStart:!0,animate:!0})}))):e.fire("moveend")}}});ii.addInitHook("addHandler","dragging",Qo),ii.mergeOptions({keyboard:!0,keyboardPanDelta:80});var Jo=mi.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(t){this._map=t,this._setPanDelta(t.options.keyboardPanDelta),this._setZoomDelta(t.options.zoomDelta)},addHooks:function(){var t=this._map._container;t.tabIndex<=0&&(t.tabIndex="0"),ze(t,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Re(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var t=document.body,e=document.documentElement,i=t.scrollTop||e.scrollTop,o=t.scrollLeft||e.scrollLeft;this._map._container.focus(),window.scrollTo(o,i)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){var e,i,o=this._panKeys={},n=this.keyCodes;for(e=0,i=n.left.length;e<i;e++)o[n.left[e]]=[-1*t,0];for(e=0,i=n.right.length;e<i;e++)o[n.right[e]]=[t,0];for(e=0,i=n.down.length;e<i;e++)o[n.down[e]]=[0,t];for(e=0,i=n.up.length;e<i;e++)o[n.up[e]]=[0,-1*t]},_setZoomDelta:function(t){var e,i,o=this._zoomKeys={},n=this.keyCodes;for(e=0,i=n.zoomIn.length;e<i;e++)o[n.zoomIn[e]]=t;for(e=0,i=n.zoomOut.length;e<i;e++)o[n.zoomOut[e]]=-t},_addHooks:function(){ze(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Re(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e,i=t.keyCode,o=this._map;if(i in this._panKeys)o._panAnim&&o._panAnim._inProgress||(e=this._panKeys[i],t.shiftKey&&(e=P(e).multiplyBy(3)),o.panBy(e),o.options.maxBounds&&o.panInsideBounds(o.options.maxBounds));else if(i in this._zoomKeys)o.setZoom(o.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[i]);else{if(27!==i||!o._popup||!o._popup.options.closeOnEscapeKey)return;o.closePopup()}Ve(t)}}});ii.addInitHook("addHandler","keyboard",Jo),ii.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var tn=mi.extend({addHooks:function(){ze(this._map._container,"mousewheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Re(this._map._container,"mousewheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var e=Ze(t),i=this._map.options.wheelDebounceTime;this._delta+=e,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var o=Math.max(i-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(s(this._performZoom,this),o),Ve(t)},_performZoom:function(){var t=this._map,e=t.getZoom(),i=this._map.options.zoomSnap||0;t._stop();var o=this._delta/(4*this._map.options.wheelPxPerZoomLevel),n=4*Math.log(2/(1+Math.exp(-Math.abs(o))))/Math.LN2,s=i?Math.ceil(n/i)*i:n,r=t._limitZoom(e+(this._delta>0?s:-s))-e;this._delta=0,this._startTime=null,r&&("center"===t.options.scrollWheelZoom?t.setZoom(e+r):t.setZoomAround(this._lastMousePos,e+r))}});ii.addInitHook("addHandler","scrollWheelZoom",tn),ii.mergeOptions({tap:!0,tapTolerance:15});var en=mi.extend({addHooks:function(){ze(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Re(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(t.touches){if(je(t),this._fireClick=!0,t.touches.length>1)return this._fireClick=!1,void clearTimeout(this._holdTimeout);var e=t.touches[0],i=e.target;this._startPos=this._newPos=new O(e.clientX,e.clientY),i.tagName&&"a"===i.tagName.toLowerCase()&&ve(i,"leaflet-active"),this._holdTimeout=setTimeout(s((function(){this._isTapValid()&&(this._fireClick=!1,this._onUp(),this._simulateEvent("contextmenu",e))}),this),1e3),this._simulateEvent("mousedown",e),ze(document,{touchmove:this._onMove,touchend:this._onUp},this)}},_onUp:function(t){if(clearTimeout(this._holdTimeout),Re(document,{touchmove:this._onMove,touchend:this._onUp},this),this._fireClick&&t&&t.changedTouches){var e=t.changedTouches[0],i=e.target;i&&i.tagName&&"a"===i.tagName.toLowerCase()&&be(i,"leaflet-active"),this._simulateEvent("mouseup",e),this._isTapValid()&&this._simulateEvent("click",e)}},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(t){var e=t.touches[0];this._newPos=new O(e.clientX,e.clientY),this._simulateEvent("mousemove",e)},_simulateEvent:function(t,e){var i=document.createEvent("MouseEvents");i._simulated=!0,e.target._simulatedClick=!0,i.initMouseEvent(t,!0,!0,window,1,e.screenX,e.screenY,e.clientX,e.clientY,!1,!1,!1,!1,0,null),e.target.dispatchEvent(i)}});Ct&&!kt&&ii.addInitHook("addHandler","tap",en),ii.mergeOptions({touchZoom:Ct&&!st,bounceAtZoomLimits:!0});var on=mi.extend({addHooks:function(){ve(this._map._container,"leaflet-touch-zoom"),ze(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){be(this._map._container,"leaflet-touch-zoom"),Re(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(t.touches&&2===t.touches.length&&!e._animatingZoom&&!this._zooming){var i=e.mouseEventToContainerPoint(t.touches[0]),o=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),"center"!==e.options.touchZoom&&(this._pinchStartLatLng=e.containerPointToLatLng(i.add(o)._divideBy(2))),this._startDist=i.distanceTo(o),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),ze(document,"touchmove",this._onTouchMove,this),ze(document,"touchend",this._onTouchEnd,this),je(t)}},_onTouchMove:function(t){if(t.touches&&2===t.touches.length&&this._zooming){var e=this._map,i=e.mouseEventToContainerPoint(t.touches[0]),o=e.mouseEventToContainerPoint(t.touches[1]),n=i.distanceTo(o)/this._startDist;if(this._zoom=e.getScaleZoom(n,this._startZoom),!e.options.bounceAtZoomLimits&&(this._zoom<e.getMinZoom()&&n<1||this._zoom>e.getMaxZoom()&&n>1)&&(this._zoom=e._limitZoom(this._zoom)),"center"===e.options.touchZoom){if(this._center=this._startLatLng,1===n)return}else{var r=i._add(o)._divideBy(2)._subtract(this._centerPoint);if(1===n&&0===r.x&&0===r.y)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(r),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),E(this._animRequest);var a=s(e._move,e,this._center,this._zoom,{pinch:!0,round:!1});this._animRequest=A(a,this,!0),je(t)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,E(this._animRequest),Re(document,"touchmove",this._onTouchMove),Re(document,"touchend",this._onTouchEnd),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});ii.addInitHook("addHandler","touchZoom",on),ii.BoxZoom=Ko,ii.DoubleClickZoom=Xo,ii.Drag=Qo,ii.Keyboard=Jo,ii.ScrollWheelZoom=tn,ii.Tap=en,ii.TouchZoom=on,Object.freeze=i,t.version=e,t.Control=ni,t.control=si,t.Browser=It,t.Evented=I,t.Mixin=fi,t.Util=$,t.Class=T,t.Handler=mi,t.extend=o,t.bind=s,t.stamp=a,t.setOptions=m,t.DomEvent=ti,t.DomUtil=Le,t.PosAnimation=ei,t.Draggable=xi,t.LineUtil=Li,t.PolyUtil=Pi,t.Point=O,t.point=P,t.Bounds=R,t.bounds=N,t.Transformation=Z,t.transformation=Y,t.Projection=Bi,t.LatLng=q,t.latLng=U,t.LatLngBounds=B,t.latLngBounds=F,t.CRS=j,t.GeoJSON=co,t.geoJSON=yo,t.geoJson=xo,t.Layer=ji,t.LayerGroup=Vi,t.layerGroup=Hi,t.FeatureGroup=Wi,t.featureGroup=Zi,t.ImageOverlay=_o,t.imageOverlay=wo,t.VideoOverlay=ko,t.videoOverlay=Co,t.SVGOverlay=So,t.svgOverlay=Ao,t.DivOverlay=Eo,t.Popup=$o,t.popup=To,t.Tooltip=Do,t.tooltip=Mo,t.Icon=Yi,t.icon=Gi,t.DivIcon=Io,t.divIcon=Oo,t.Marker=Qi,t.marker=Ji,t.TileLayer=Po,t.tileLayer=Ro,t.GridLayer=Lo,t.gridLayer=zo,t.SVG=Wo,t.svg=Zo,t.Renderer=Fo,t.Canvas=qo,t.canvas=Uo,t.Path=to,t.CircleMarker=eo,t.circleMarker=io,t.Circle=oo,t.circle=no,t.Polyline=so,t.polyline=ro,t.Polygon=ao,t.polygon=lo,t.Rectangle=Yo,t.rectangle=Go,t.Map=ii,t.map=oi;var nn=window.L;t.noConflict=function(){return window.L=nn,this},window.L=t})(yw.exports);var xw=yw.exports;const _w={weight:1,opacity:1,color:"white",fillOpacity:.7,fillColor:"#2387ca"},ww={weight:3,color:"white",fillOpacity:1,fillColor:"#2387ca"},kw=()=>_w;class Cw extends dt{static get styles(){return a`
13603
+ `}}t([mt({type:Array,attribute:!1})],yw.prototype,"path",void 0),t([mt()],yw.prototype,"endpoint",void 0),t([mt()],yw.prototype,"osmId",void 0),t([mt({type:Object})],yw.prototype,"hovered",void 0),t([mt({type:Object})],yw.prototype,"editFeature",void 0),t([mt({type:String,attribute:!1})],yw.prototype,"editFeatureAliases",void 0);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var bw={exports:{}};(function(t){var e="1.5.1+build.2e3e0ffb",i=Object.freeze;function o(t){var e,i,o,n;for(i=1,o=arguments.length;i<o;i++)for(e in n=arguments[i])t[e]=n[e];return t}Object.freeze=function(t){return t};var n=Object.create||function(){function t(){}return function(e){return t.prototype=e,new t}}();function s(t,e){var i=Array.prototype.slice;if(t.bind)return t.bind.apply(t,i.call(arguments,1));var o=i.call(arguments,2);return function(){return t.apply(e,o.length?o.concat(i.call(arguments)):arguments)}}var r=0;function a(t){return t._leaflet_id=t._leaflet_id||++r,t._leaflet_id}function l(t,e,i){var o,n,s,r;return r=function(){o=!1,n&&(s.apply(i,n),n=!1)},s=function(){o?n=arguments:(t.apply(i,arguments),setTimeout(r,e),o=!0)},s}function d(t,e,i){var o=e[1],n=e[0],s=o-n;return t===o&&i?t:((t-n)%s+s)%s+n}function c(){return!1}function h(t,e){return e=void 0===e?6:e,+(Math.round(t+"e+"+e)+"e-"+e)}function u(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function p(t){return u(t).split(/\s+/)}function m(t,e){for(var i in t.hasOwnProperty("options")||(t.options=t.options?n(t.options):{}),e)t.options[i]=e[i];return t.options}function g(t,e,i){var o=[];for(var n in t)o.push(encodeURIComponent(i?n.toUpperCase():n)+"="+encodeURIComponent(t[n]));return(e&&-1!==e.indexOf("?")?"&":"?")+o.join("&")}var f=/\{ *([\w_-]+) *\}/g;function v(t,e){return t.replace(f,(function(t,i){var o=e[i];if(void 0===o)throw new Error("No value provided for variable "+t);return"function"==typeof o&&(o=o(e)),o}))}var y=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function b(t,e){for(var i=0;i<t.length;i++)if(t[i]===e)return i;return-1}var x="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function _(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var w=0;function k(t){var e=+new Date,i=Math.max(0,16-(e-w));return w=e+i,window.setTimeout(t,i)}var C=window.requestAnimationFrame||_("RequestAnimationFrame")||k,S=window.cancelAnimationFrame||_("CancelAnimationFrame")||_("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function A(t,e,i){if(!i||C!==k)return C.call(window,s(t,e));t.call(e)}function E(t){t&&S.call(window,t)}var $=(Object.freeze||Object)({freeze:i,extend:o,create:n,bind:s,lastId:r,stamp:a,throttle:l,wrapNum:d,falseFn:c,formatNum:h,trim:u,splitWords:p,setOptions:m,getParamString:g,template:v,isArray:y,indexOf:b,emptyImageUrl:x,requestFn:C,cancelFn:S,requestAnimFrame:A,cancelAnimFrame:E});function T(){}function D(t){if("undefined"!=typeof L&&L&&L.Mixin){t=y(t)?t:[t];for(var e=0;e<t.length;e++)t[e]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",(new Error).stack)}}T.extend=function(t){var e=function(){this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},i=e.__super__=this.prototype,s=n(i);for(var r in s.constructor=e,e.prototype=s,this)this.hasOwnProperty(r)&&"prototype"!==r&&"__super__"!==r&&(e[r]=this[r]);return t.statics&&(o(e,t.statics),delete t.statics),t.includes&&(D(t.includes),o.apply(null,[s].concat(t.includes)),delete t.includes),s.options&&(t.options=o(n(s.options),t.options)),o(s,t),s._initHooks=[],s.callInitHooks=function(){if(!this._initHooksCalled){i.callInitHooks&&i.callInitHooks.call(this),this._initHooksCalled=!0;for(var t=0,e=s._initHooks.length;t<e;t++)s._initHooks[t].call(this)}},e},T.include=function(t){return o(this.prototype,t),this},T.mergeOptions=function(t){return o(this.prototype.options,t),this},T.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),i="function"==typeof t?t:function(){this[t].apply(this,e)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(i),this};var M={on:function(t,e,i){if("object"==typeof t)for(var o in t)this._on(o,t[o],e);else for(var n=0,s=(t=p(t)).length;n<s;n++)this._on(t[n],e,i);return this},off:function(t,e,i){if(t)if("object"==typeof t)for(var o in t)this._off(o,t[o],e);else for(var n=0,s=(t=p(t)).length;n<s;n++)this._off(t[n],e,i);else delete this._events;return this},_on:function(t,e,i){this._events=this._events||{};var o=this._events[t];o||(o=[],this._events[t]=o),i===this&&(i=void 0);for(var n={fn:e,ctx:i},s=o,r=0,a=s.length;r<a;r++)if(s[r].fn===e&&s[r].ctx===i)return;s.push(n)},_off:function(t,e,i){var o,n,s;if(this._events&&(o=this._events[t]))if(e){if(i===this&&(i=void 0),o)for(n=0,s=o.length;n<s;n++){var r=o[n];if(r.ctx===i&&r.fn===e)return r.fn=c,this._firingCount&&(this._events[t]=o=o.slice()),void o.splice(n,1)}}else{for(n=0,s=o.length;n<s;n++)o[n].fn=c;delete this._events[t]}},fire:function(t,e,i){if(!this.listens(t,i))return this;var n=o({},e,{type:t,target:this,sourceTarget:e&&e.sourceTarget||this});if(this._events){var s=this._events[t];if(s){this._firingCount=this._firingCount+1||1;for(var r=0,a=s.length;r<a;r++){var l=s[r];l.fn.call(l.ctx||this,n)}this._firingCount--}}return i&&this._propagateEvent(n),this},listens:function(t,e){var i=this._events&&this._events[t];if(i&&i.length)return!0;if(e)for(var o in this._eventParents)if(this._eventParents[o].listens(t,e))return!0;return!1},once:function(t,e,i){if("object"==typeof t){for(var o in t)this.once(o,t[o],e);return this}var n=s((function(){this.off(t,e,i).off(t,n,i)}),this);return this.on(t,e,i).on(t,n,i)},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[a(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[a(t)],this},_propagateEvent:function(t){for(var e in this._eventParents)this._eventParents[e].fire(t.type,o({layer:t.target,propagatedFrom:t.target},t),!0)}};M.addEventListener=M.on,M.removeEventListener=M.clearAllEventListeners=M.off,M.addOneTimeEventListener=M.once,M.fireEvent=M.fire,M.hasEventListeners=M.listens;var I=T.extend(M);function O(t,e,i){this.x=i?Math.round(t):t,this.y=i?Math.round(e):e}var z=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};function P(t,e,i){return t instanceof O?t:y(t)?new O(t[0],t[1]):null==t?t:"object"==typeof t&&"x"in t&&"y"in t?new O(t.x,t.y):new O(t,e,i)}function R(t,e){if(t)for(var i=e?[t,e]:t,o=0,n=i.length;o<n;o++)this.extend(i[o])}function N(t,e){return!t||t instanceof R?t:new R(t,e)}function B(t,e){if(t)for(var i=e?[t,e]:t,o=0,n=i.length;o<n;o++)this.extend(i[o])}function F(t,e){return t instanceof B?t:new B(t,e)}function q(t,e,i){if(isNaN(t)||isNaN(e))throw new Error("Invalid LatLng object: ("+t+", "+e+")");this.lat=+t,this.lng=+e,void 0!==i&&(this.alt=+i)}function U(t,e,i){return t instanceof q?t:y(t)&&"object"!=typeof t[0]?3===t.length?new q(t[0],t[1],t[2]):2===t.length?new q(t[0],t[1]):null:null==t?t:"object"==typeof t&&"lat"in t?new q(t.lat,"lng"in t?t.lng:t.lon,t.alt):void 0===e?null:new q(t,e,i)}O.prototype={clone:function(){return new O(this.x,this.y)},add:function(t){return this.clone()._add(P(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(P(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new O(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new O(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=z(this.x),this.y=z(this.y),this},distanceTo:function(t){var e=(t=P(t)).x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){return(t=P(t)).x===this.x&&t.y===this.y},contains:function(t){return t=P(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+h(this.x)+", "+h(this.y)+")"}},R.prototype={extend:function(t){return t=P(t),this.min||this.max?(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(t.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(t.y,this.max.y)):(this.min=t.clone(),this.max=t.clone()),this},getCenter:function(t){return new O((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return new O(this.min.x,this.max.y)},getTopRight:function(){return new O(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var e,i;return(t="number"==typeof t[0]||t instanceof O?P(t):N(t))instanceof R?(e=t.min,i=t.max):e=i=t,e.x>=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y},intersects:function(t){t=N(t);var e=this.min,i=this.max,o=t.min,n=t.max,s=n.x>=e.x&&o.x<=i.x,r=n.y>=e.y&&o.y<=i.y;return s&&r},overlaps:function(t){t=N(t);var e=this.min,i=this.max,o=t.min,n=t.max,s=n.x>e.x&&o.x<i.x,r=n.y>e.y&&o.y<i.y;return s&&r},isValid:function(){return!(!this.min||!this.max)}},B.prototype={extend:function(t){var e,i,o=this._southWest,n=this._northEast;if(t instanceof q)e=t,i=t;else{if(!(t instanceof B))return t?this.extend(U(t)||F(t)):this;if(e=t._southWest,i=t._northEast,!e||!i)return this}return o||n?(o.lat=Math.min(e.lat,o.lat),o.lng=Math.min(e.lng,o.lng),n.lat=Math.max(i.lat,n.lat),n.lng=Math.max(i.lng,n.lng)):(this._southWest=new q(e.lat,e.lng),this._northEast=new q(i.lat,i.lng)),this},pad:function(t){var e=this._southWest,i=this._northEast,o=Math.abs(e.lat-i.lat)*t,n=Math.abs(e.lng-i.lng)*t;return new B(new q(e.lat-o,e.lng-n),new q(i.lat+o,i.lng+n))},getCenter:function(){return new q((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new q(this.getNorth(),this.getWest())},getSouthEast:function(){return new q(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(t){t="number"==typeof t[0]||t instanceof q||"lat"in t?U(t):F(t);var e,i,o=this._southWest,n=this._northEast;return t instanceof B?(e=t.getSouthWest(),i=t.getNorthEast()):e=i=t,e.lat>=o.lat&&i.lat<=n.lat&&e.lng>=o.lng&&i.lng<=n.lng},intersects:function(t){t=F(t);var e=this._southWest,i=this._northEast,o=t.getSouthWest(),n=t.getNorthEast(),s=n.lat>=e.lat&&o.lat<=i.lat,r=n.lng>=e.lng&&o.lng<=i.lng;return s&&r},overlaps:function(t){t=F(t);var e=this._southWest,i=this._northEast,o=t.getSouthWest(),n=t.getNorthEast(),s=n.lat>e.lat&&o.lat<i.lat,r=n.lng>e.lng&&o.lng<i.lng;return s&&r},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,e){return!!t&&(t=F(t),this._southWest.equals(t.getSouthWest(),e)&&this._northEast.equals(t.getNorthEast(),e))},isValid:function(){return!(!this._southWest||!this._northEast)}},q.prototype={equals:function(t,e){return!!t&&(t=U(t),Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng))<=(void 0===e?1e-9:e))},toString:function(t){return"LatLng("+h(this.lat,t)+", "+h(this.lng,t)+")"},distanceTo:function(t){return V.distance(this,U(t))},wrap:function(){return V.wrapLatLng(this)},toBounds:function(t){var e=180*t/40075017,i=e/Math.cos(Math.PI/180*this.lat);return F([this.lat-e,this.lng-i],[this.lat+e,this.lng+i])},clone:function(){return new q(this.lat,this.lng,this.alt)}};var j={latLngToPoint:function(t,e){var i=this.projection.project(t),o=this.scale(e);return this.transformation._transform(i,o)},pointToLatLng:function(t,e){var i=this.scale(e),o=this.transformation.untransform(t,i);return this.projection.unproject(o)},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},scale:function(t){return 256*Math.pow(2,t)},zoom:function(t){return Math.log(t/256)/Math.LN2},getProjectedBounds:function(t){if(this.infinite)return null;var e=this.projection.bounds,i=this.scale(t);return new R(this.transformation.transform(e.min,i),this.transformation.transform(e.max,i))},infinite:!1,wrapLatLng:function(t){var e=this.wrapLng?d(t.lng,this.wrapLng,!0):t.lng;return new q(this.wrapLat?d(t.lat,this.wrapLat,!0):t.lat,e,t.alt)},wrapLatLngBounds:function(t){var e=t.getCenter(),i=this.wrapLatLng(e),o=e.lat-i.lat,n=e.lng-i.lng;if(0===o&&0===n)return t;var s=t.getSouthWest(),r=t.getNorthEast();return new B(new q(s.lat-o,s.lng-n),new q(r.lat-o,r.lng-n))}},V=o({},j,{wrapLng:[-180,180],R:6371e3,distance:function(t,e){var i=Math.PI/180,o=t.lat*i,n=e.lat*i,s=Math.sin((e.lat-t.lat)*i/2),r=Math.sin((e.lng-t.lng)*i/2),a=s*s+Math.cos(o)*Math.cos(n)*r*r,l=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return this.R*l}}),H=6378137,W={R:H,MAX_LATITUDE:85.0511287798,project:function(t){var e=Math.PI/180,i=this.MAX_LATITUDE,o=Math.max(Math.min(i,t.lat),-i),n=Math.sin(o*e);return new O(this.R*t.lng*e,this.R*Math.log((1+n)/(1-n))/2)},unproject:function(t){var e=180/Math.PI;return new q((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:function(){var t=H*Math.PI;return new R([-t,-t],[t,t])}()};function Z(t,e,i,o){if(y(t))return this._a=t[0],this._b=t[1],this._c=t[2],void(this._d=t[3]);this._a=t,this._b=e,this._c=i,this._d=o}function Y(t,e,i,o){return new Z(t,e,i,o)}Z.prototype={transform:function(t,e){return this._transform(t.clone(),e)},_transform:function(t,e){return e=e||1,t.x=e*(this._a*t.x+this._b),t.y=e*(this._c*t.y+this._d),t},untransform:function(t,e){return e=e||1,new O((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}};var G=o({},V,{code:"EPSG:3857",projection:W,transformation:function(){var t=.5/(Math.PI*W.R);return Y(t,.5,-t,.5)}()}),K=o({},G,{code:"EPSG:900913"});function X(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Q(t,e){var i,o,n,s,r,a,l="";for(i=0,n=t.length;i<n;i++){for(o=0,s=(r=t[i]).length;o<s;o++)l+=(o?"L":"M")+(a=r[o]).x+" "+a.y;l+=e?Tt?"z":"x":""}return l||"M0 0"}var J=document.documentElement.style,tt="ActiveXObject"in window,et=tt&&!document.addEventListener,it="msLaunchUri"in navigator&&!("documentMode"in document),ot=Mt("webkit"),nt=Mt("android"),st=Mt("android 2")||Mt("android 3"),rt=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),at=nt&&Mt("Google")&&rt<537&&!("AudioNode"in window),lt=!!window.opera,dt=Mt("chrome"),ct=Mt("gecko")&&!ot&&!lt&&!tt,ht=!dt&&Mt("safari"),ut=Mt("phantom"),pt="OTransition"in J,mt=0===navigator.platform.indexOf("Win"),gt=tt&&"transition"in J,ft="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!st,vt="MozPerspective"in J,yt=!window.L_DISABLE_3D&&(gt||ft||vt)&&!pt&&!ut,bt="undefined"!=typeof orientation||Mt("mobile"),xt=bt&&ot,_t=bt&&ft,wt=!window.PointerEvent&&window.MSPointerEvent,kt=!(!window.PointerEvent&&!wt),Ct=!window.L_NO_TOUCH&&(kt||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),St=bt&&lt,At=bt&&ct,Et=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,$t=!!document.createElement("canvas").getContext,Tt=!(!document.createElementNS||!X("svg").createSVGRect),Dt=!Tt&&function(){try{var t=document.createElement("div");t.innerHTML='<v:shape adj="1"/>';var e=t.firstChild;return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}();function Mt(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var It=(Object.freeze||Object)({ie:tt,ielt9:et,edge:it,webkit:ot,android:nt,android23:st,androidStock:at,opera:lt,chrome:dt,gecko:ct,safari:ht,phantom:ut,opera12:pt,win:mt,ie3d:gt,webkit3d:ft,gecko3d:vt,any3d:yt,mobile:bt,mobileWebkit:xt,mobileWebkit3d:_t,msPointer:wt,pointer:kt,touch:Ct,mobileOpera:St,mobileGecko:At,retina:Et,canvas:$t,svg:Tt,vml:Dt}),Ot=wt?"MSPointerDown":"pointerdown",Lt=wt?"MSPointerMove":"pointermove",zt=wt?"MSPointerUp":"pointerup",Pt=wt?"MSPointerCancel":"pointercancel",Rt=["INPUT","SELECT","OPTION"],Nt={},Bt=!1,Ft=0;function qt(t,e,i,o){return"touchstart"===e?jt(t,i,o):"touchmove"===e?Yt(t,i,o):"touchend"===e&&Gt(t,i,o),this}function Ut(t,e,i){var o=t["_leaflet_"+e+i];return"touchstart"===e?t.removeEventListener(Ot,o,!1):"touchmove"===e?t.removeEventListener(Lt,o,!1):"touchend"===e&&(t.removeEventListener(zt,o,!1),t.removeEventListener(Pt,o,!1)),this}function jt(t,e,i){var o=s((function(t){if("mouse"!==t.pointerType&&t.MSPOINTER_TYPE_MOUSE&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE){if(!(Rt.indexOf(t.target.tagName)<0))return;je(t)}Zt(t,e)}));t["_leaflet_touchstart"+i]=o,t.addEventListener(Ot,o,!1),Bt||(document.documentElement.addEventListener(Ot,Vt,!0),document.documentElement.addEventListener(Lt,Ht,!0),document.documentElement.addEventListener(zt,Wt,!0),document.documentElement.addEventListener(Pt,Wt,!0),Bt=!0)}function Vt(t){Nt[t.pointerId]=t,Ft++}function Ht(t){Nt[t.pointerId]&&(Nt[t.pointerId]=t)}function Wt(t){delete Nt[t.pointerId],Ft--}function Zt(t,e){for(var i in t.touches=[],Nt)t.touches.push(Nt[i]);t.changedTouches=[t],e(t)}function Yt(t,e,i){var o=function(t){(t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&"mouse"!==t.pointerType||0!==t.buttons)&&Zt(t,e)};t["_leaflet_touchmove"+i]=o,t.addEventListener(Lt,o,!1)}function Gt(t,e,i){var o=function(t){Zt(t,e)};t["_leaflet_touchend"+i]=o,t.addEventListener(zt,o,!1),t.addEventListener(Pt,o,!1)}var Kt=wt?"MSPointerDown":kt?"pointerdown":"touchstart",Xt=wt?"MSPointerUp":kt?"pointerup":"touchend",Qt="_leaflet_";function Jt(t,e,i){var o,n,s=!1,r=250;function a(t){var e;if(kt){if(!it||"mouse"===t.pointerType)return;e=Ft}else e=t.touches.length;if(!(e>1)){var i=Date.now(),a=i-(o||i);n=t.touches?t.touches[0]:t,s=a>0&&a<=r,o=i}}function l(t){if(s&&!n.cancelBubble){if(kt){if(!it||"mouse"===t.pointerType)return;var i,r,a={};for(r in n)i=n[r],a[r]=i&&i.bind?i.bind(n):i;n=a}n.type="dblclick",n.button=0,e(n),o=null}}return t[Qt+Kt+i]=a,t[Qt+Xt+i]=l,t[Qt+"dblclick"+i]=e,t.addEventListener(Kt,a,!1),t.addEventListener(Xt,l,!1),t.addEventListener("dblclick",e,!1),this}function te(t,e){var i=t[Qt+Kt+e],o=t[Qt+Xt+e],n=t[Qt+"dblclick"+e];return t.removeEventListener(Kt,i,!1),t.removeEventListener(Xt,o,!1),it||t.removeEventListener("dblclick",n,!1),this}var ee,ie,oe,ne,se,re=ke(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ae=ke(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),le="webkitTransition"===ae||"OTransition"===ae?ae+"End":"transitionend";function de(t){return"string"==typeof t?document.getElementById(t):t}function ce(t,e){var i=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!i||"auto"===i)&&document.defaultView){var o=document.defaultView.getComputedStyle(t,null);i=o?o[e]:null}return"auto"===i?null:i}function he(t,e,i){var o=document.createElement(t);return o.className=e||"",i&&i.appendChild(o),o}function ue(t){var e=t.parentNode;e&&e.removeChild(t)}function pe(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function me(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function ge(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function fe(t,e){if(void 0!==t.classList)return t.classList.contains(e);var i=xe(t);return i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)}function ve(t,e){if(void 0!==t.classList)for(var i=p(e),o=0,n=i.length;o<n;o++)t.classList.add(i[o]);else if(!fe(t,e)){var s=xe(t);be(t,(s?s+" ":"")+e)}}function ye(t,e){void 0!==t.classList?t.classList.remove(e):be(t,u((" "+xe(t)+" ").replace(" "+e+" "," ")))}function be(t,e){void 0===t.className.baseVal?t.className=e:t.className.baseVal=e}function xe(t){return t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal}function _e(t,e){"opacity"in t.style?t.style.opacity=e:"filter"in t.style&&we(t,e)}function we(t,e){var i=!1,o="DXImageTransform.Microsoft.Alpha";try{i=t.filters.item(o)}catch(t){if(1===e)return}e=Math.round(100*e),i?(i.Enabled=100!==e,i.Opacity=e):t.style.filter+=" progid:"+o+"(opacity="+e+")"}function ke(t){for(var e=document.documentElement.style,i=0;i<t.length;i++)if(t[i]in e)return t[i];return!1}function Ce(t,e,i){var o=e||new O(0,0);t.style[re]=(gt?"translate("+o.x+"px,"+o.y+"px)":"translate3d("+o.x+"px,"+o.y+"px,0)")+(i?" scale("+i+")":"")}function Se(t,e){t._leaflet_pos=e,yt?Ce(t,e):(t.style.left=e.x+"px",t.style.top=e.y+"px")}function Ae(t){return t._leaflet_pos||new O(0,0)}if("onselectstart"in document)ee=function(){ze(window,"selectstart",je)},ie=function(){Re(window,"selectstart",je)};else{var Ee=ke(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);ee=function(){if(Ee){var t=document.documentElement.style;oe=t[Ee],t[Ee]="none"}},ie=function(){Ee&&(document.documentElement.style[Ee]=oe,oe=void 0)}}function $e(){ze(window,"dragstart",je)}function Te(){Re(window,"dragstart",je)}function De(t){for(;-1===t.tabIndex;)t=t.parentNode;t.style&&(Me(),ne=t,se=t.style.outline,t.style.outline="none",ze(window,"keydown",Me))}function Me(){ne&&(ne.style.outline=se,ne=void 0,se=void 0,Re(window,"keydown",Me))}function Ie(t){do{t=t.parentNode}while(!(t.offsetWidth&&t.offsetHeight||t===document.body));return t}function Oe(t){var e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}var Le=(Object.freeze||Object)({TRANSFORM:re,TRANSITION:ae,TRANSITION_END:le,get:de,getStyle:ce,create:he,remove:ue,empty:pe,toFront:me,toBack:ge,hasClass:fe,addClass:ve,removeClass:ye,setClass:be,getClass:xe,setOpacity:_e,testProp:ke,setTransform:Ce,setPosition:Se,getPosition:Ae,disableTextSelection:ee,enableTextSelection:ie,disableImageDrag:$e,enableImageDrag:Te,preventOutline:De,restoreOutline:Me,getSizedParentNode:Ie,getScale:Oe});function ze(t,e,i,o){if("object"==typeof e)for(var n in e)Ne(t,n,e[n],i);else for(var s=0,r=(e=p(e)).length;s<r;s++)Ne(t,e[s],i,o);return this}var Pe="_leaflet_events";function Re(t,e,i,o){if("object"==typeof e)for(var n in e)Be(t,n,e[n],i);else if(e)for(var s=0,r=(e=p(e)).length;s<r;s++)Be(t,e[s],i,o);else{for(var a in t[Pe])Be(t,a,t[Pe][a]);delete t[Pe]}return this}function Ne(t,e,i,o){var n=e+a(i)+(o?"_"+a(o):"");if(t[Pe]&&t[Pe][n])return this;var s=function(e){return i.call(o||t,e||window.event)},r=s;kt&&0===e.indexOf("touch")?qt(t,e,s,n):!Ct||"dblclick"!==e||!Jt||kt&&dt?"addEventListener"in t?"mousewheel"===e?t.addEventListener("onwheel"in t?"wheel":"mousewheel",s,!1):"mouseenter"===e||"mouseleave"===e?(s=function(e){e=e||window.event,Qe(t,e)&&r(e)},t.addEventListener("mouseenter"===e?"mouseover":"mouseout",s,!1)):("click"===e&&nt&&(s=function(t){Je(t,r)}),t.addEventListener(e,s,!1)):"attachEvent"in t&&t.attachEvent("on"+e,s):Jt(t,s,n),t[Pe]=t[Pe]||{},t[Pe][n]=s}function Be(t,e,i,o){var n=e+a(i)+(o?"_"+a(o):""),s=t[Pe]&&t[Pe][n];if(!s)return this;kt&&0===e.indexOf("touch")?Ut(t,e,n):!Ct||"dblclick"!==e||!te||kt&&dt?"removeEventListener"in t?"mousewheel"===e?t.removeEventListener("onwheel"in t?"wheel":"mousewheel",s,!1):t.removeEventListener("mouseenter"===e?"mouseover":"mouseleave"===e?"mouseout":e,s,!1):"detachEvent"in t&&t.detachEvent("on"+e,s):te(t,n),t[Pe][n]=null}function Fe(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,Xe(t),this}function qe(t){return Ne(t,"mousewheel",Fe),this}function Ue(t){return ze(t,"mousedown touchstart dblclick",Fe),Ne(t,"click",Ke),this}function je(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function Ve(t){return je(t),Fe(t),this}function He(t,e){if(!e)return new O(t.clientX,t.clientY);var i=Oe(e),o=i.boundingClientRect;return new O((t.clientX-o.left)/i.x-e.clientLeft,(t.clientY-o.top)/i.y-e.clientTop)}var We=mt&&dt?2*window.devicePixelRatio:ct?window.devicePixelRatio:1;function Ze(t){return it?t.wheelDeltaY/2:t.deltaY&&0===t.deltaMode?-t.deltaY/We:t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?20*-t.detail:t.detail?t.detail/-32765*60:0}var Ye,Ge={};function Ke(t){Ge[t.type]=!0}function Xe(t){var e=Ge[t.type];return Ge[t.type]=!1,e}function Qe(t,e){var i=e.relatedTarget;if(!i)return!0;try{for(;i&&i!==t;)i=i.parentNode}catch(t){return!1}return i!==t}function Je(t,e){var i=t.timeStamp||t.originalEvent&&t.originalEvent.timeStamp,o=Ye&&i-Ye;o&&o>100&&o<500||t.target._simulatedClick&&!t._simulated?Ve(t):(Ye=i,e(t))}var ti=(Object.freeze||Object)({on:ze,off:Re,stopPropagation:Fe,disableScrollPropagation:qe,disableClickPropagation:Ue,preventDefault:je,stop:Ve,getMousePosition:He,getWheelDelta:Ze,fakeStop:Ke,skipped:Xe,isExternalTarget:Qe,addListener:ze,removeListener:Re}),ei=I.extend({run:function(t,e,i,o){this.stop(),this._el=t,this._inProgress=!0,this._duration=i||.25,this._easeOutPower=1/Math.max(o||.5,.2),this._startPos=Ae(t),this._offset=e.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=A(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,i=1e3*this._duration;e<i?this._runFrame(this._easeOut(e/i),t):(this._runFrame(1),this._complete())},_runFrame:function(t,e){var i=this._startPos.add(this._offset.multiplyBy(t));e&&i._round(),Se(this._el,i),this.fire("step")},_complete:function(){E(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),ii=I.extend({options:{crs:G,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(t,e){e=m(this,e),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=s(this._onResize,this),this._initEvents(),e.maxBounds&&this.setMaxBounds(e.maxBounds),void 0!==e.zoom&&(this._zoom=this._limitZoom(e.zoom)),e.center&&void 0!==e.zoom&&this.setView(U(e.center),e.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=ae&&yt&&!St&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),ze(this._proxy,le,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,e,i){return e=void 0===e?this._zoom:this._limitZoom(e),t=this._limitCenter(U(t),e,this.options.maxBounds),i=i||{},this._stop(),this._loaded&&!i.reset&&!0!==i&&(void 0!==i.animate&&(i.zoom=o({animate:i.animate},i.zoom),i.pan=o({animate:i.animate,duration:i.duration},i.pan)),this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,i.zoom):this._tryAnimatedPan(t,i.pan))?(clearTimeout(this._sizeTimer),this):(this._resetView(t,e),this)},setZoom:function(t,e){return this._loaded?this.setView(this.getCenter(),t,{zoom:e}):(this._zoom=t,this)},zoomIn:function(t,e){return t=t||(yt?this.options.zoomDelta:1),this.setZoom(this._zoom+t,e)},zoomOut:function(t,e){return t=t||(yt?this.options.zoomDelta:1),this.setZoom(this._zoom-t,e)},setZoomAround:function(t,e,i){var o=this.getZoomScale(e),n=this.getSize().divideBy(2),s=(t instanceof O?t:this.latLngToContainerPoint(t)).subtract(n).multiplyBy(1-1/o),r=this.containerPointToLatLng(n.add(s));return this.setView(r,e,{zoom:i})},_getBoundsCenterZoom:function(t,e){e=e||{},t=t.getBounds?t.getBounds():F(t);var i=P(e.paddingTopLeft||e.padding||[0,0]),o=P(e.paddingBottomRight||e.padding||[0,0]),n=this.getBoundsZoom(t,!1,i.add(o));if((n="number"==typeof e.maxZoom?Math.min(e.maxZoom,n):n)===1/0)return{center:t.getCenter(),zoom:n};var s=o.subtract(i).divideBy(2),r=this.project(t.getSouthWest(),n),a=this.project(t.getNorthEast(),n);return{center:this.unproject(r.add(a).divideBy(2).add(s),n),zoom:n}},fitBounds:function(t,e){if(!(t=F(t)).isValid())throw new Error("Bounds are not valid.");var i=this._getBoundsCenterZoom(t,e);return this.setView(i.center,i.zoom,e)},fitWorld:function(t){return this.fitBounds([[-90,-180],[90,180]],t)},panTo:function(t,e){return this.setView(t,this._zoom,{pan:e})},panBy:function(t,e){if(e=e||{},!(t=P(t).round()).x&&!t.y)return this.fire("moveend");if(!0!==e.animate&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new ei,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire("movestart"),!1!==e.animate){ve(this._mapPane,"leaflet-pan-anim");var i=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,i,e.duration||.25,e.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(t,e,i){if(!1===(i=i||{}).animate||!yt)return this.setView(t,e,i);this._stop();var o=this.project(this.getCenter()),n=this.project(t),s=this.getSize(),r=this._zoom;t=U(t),e=void 0===e?r:e;var a=Math.max(s.x,s.y),l=a*this.getZoomScale(r,e),d=n.distanceTo(o)||1,c=1.42,h=c*c;function u(t){var e=(l*l-a*a+(t?-1:1)*h*h*d*d)/(2*(t?l:a)*h*d),i=Math.sqrt(e*e+1)-e;return i<1e-9?-18:Math.log(i)}function p(t){return(Math.exp(t)-Math.exp(-t))/2}function m(t){return(Math.exp(t)+Math.exp(-t))/2}function g(t){return p(t)/m(t)}var f=u(0);function v(t){return a*(m(f)/m(f+c*t))}function y(t){return a*(m(f)*g(f+c*t)-p(f))/h}function b(t){return 1-Math.pow(1-t,1.5)}var x=Date.now(),_=(u(1)-f)/c,w=i.duration?1e3*i.duration:1e3*_*.8;function k(){var i=(Date.now()-x)/w,s=b(i)*_;i<=1?(this._flyToFrame=A(k,this),this._move(this.unproject(o.add(n.subtract(o).multiplyBy(y(s)/d)),r),this.getScaleZoom(a/v(s),r),{flyTo:!0})):this._move(t,e)._moveEnd(!0)}return this._moveStart(!0,i.noMoveStart),k.call(this),this},flyToBounds:function(t,e){var i=this._getBoundsCenterZoom(t,e);return this.flyTo(i.center,i.zoom,e)},setMaxBounds:function(t){return(t=F(t)).isValid()?(this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this.off("moveend",this._panInsideMaxBounds))},setMinZoom:function(t){var e=this.options.minZoom;return this.options.minZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(t):this},setMaxZoom:function(t){var e=this.options.maxZoom;return this.options.maxZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var i=this.getCenter(),o=this._limitCenter(i,this._zoom,F(t));return i.equals(o)||this.panTo(o,e),this._enforcingBounds=!1,this},panInside:function(t,e){var i=P((e=e||{}).paddingTopLeft||e.padding||[0,0]),o=P(e.paddingBottomRight||e.padding||[0,0]),n=this.getCenter(),s=this.project(n),r=this.project(t),a=this.getPixelBounds(),l=a.getSize().divideBy(2),d=N([a.min.add(i),a.max.subtract(o)]);if(!d.contains(r)){this._enforcingBounds=!0;var c=s.subtract(r),h=P(r.x+c.x,r.y+c.y);(r.x<d.min.x||r.x>d.max.x)&&(h.x=s.x-c.x,c.x>0?h.x+=l.x-i.x:h.x-=l.x-o.x),(r.y<d.min.y||r.y>d.max.y)&&(h.y=s.y-c.y,c.y>0?h.y+=l.y-i.y:h.y-=l.y-o.y),this.panTo(this.unproject(h),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=o({animate:!1,pan:!0},!0===t?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var i=this.getSize(),n=e.divideBy(2).round(),r=i.divideBy(2).round(),a=n.subtract(r);return a.x||a.y?(t.animate&&t.pan?this.panBy(a):(t.pan&&this._rawPanBy(a),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(s(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=o({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var e=s(this._handleGeolocationResponse,this),i=s(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(e,i,t):navigator.geolocation.getCurrentPosition(e,i,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var e=t.code,i=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+i+"."})},_handleGeolocationResponse:function(t){var e=new q(t.coords.latitude,t.coords.longitude),i=e.toBounds(2*t.coords.accuracy),o=this._locateOptions;if(o.setView){var n=this.getBoundsZoom(i);this.setView(e,o.maxZoom?Math.min(n,o.maxZoom):n)}var s={latlng:e,bounds:i,timestamp:t.timestamp};for(var r in t.coords)"number"==typeof t.coords[r]&&(s[r]=t.coords[r]);this.fire("locationfound",s)},addHandler:function(t,e){if(!e)return this;var i=this[t]=new e(this);return this._handlers.push(i),this.options[t]&&i.enable(),this},remove:function(){if(this._initEvents(!0),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}var t;for(t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),ue(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(E(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)ue(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var i=he("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),e||this._mapPane);return t&&(this._panes[t]=i),i},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new B(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,i){t=F(t),i=P(i||[0,0]);var o=this.getZoom()||0,n=this.getMinZoom(),s=this.getMaxZoom(),r=t.getNorthWest(),a=t.getSouthEast(),l=this.getSize().subtract(i),d=N(this.project(a,o),this.project(r,o)).getSize(),c=yt?this.options.zoomSnap:1,h=l.x/d.x,u=l.y/d.y,p=e?Math.max(h,u):Math.min(h,u);return o=this.getScaleZoom(p,o),c&&(o=Math.round(o/(c/100))*(c/100),o=e?Math.ceil(o/c)*c:Math.floor(o/c)*c),Math.max(n,Math.min(s,o))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new O(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var i=this._getTopLeftPoint(t,e);return new R(i,i.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var i=this.options.crs;return e=void 0===e?this._zoom:e,i.scale(t)/i.scale(e)},getScaleZoom:function(t,e){var i=this.options.crs;e=void 0===e?this._zoom:e;var o=i.zoom(t*i.scale(e));return isNaN(o)?1/0:o},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(U(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(P(t),e)},layerPointToLatLng:function(t){var e=P(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){return this.project(U(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(U(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(F(t))},distance:function(t,e){return this.options.crs.distance(U(t),U(e))},containerPointToLayerPoint:function(t){return P(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return P(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(P(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(U(t)))},mouseEventToContainerPoint:function(t){return He(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var e=this._container=de(t);if(!e)throw new Error("Map container not found.");if(e._leaflet_id)throw new Error("Map container is already initialized.");ze(e,"scroll",this._onScroll,this),this._containerId=a(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&yt,ve(t,"leaflet-container"+(Ct?" leaflet-touch":"")+(Et?" leaflet-retina":"")+(et?" leaflet-oldie":"")+(ht?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=ce(t,"position");"absolute"!==e&&"relative"!==e&&"fixed"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Se(this._mapPane,new O(0,0)),this.createPane("tilePane"),this.createPane("shadowPane"),this.createPane("overlayPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(ve(t.markerPane,"leaflet-zoom-hide"),ve(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e){Se(this._mapPane,new O(0,0));var i=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset");var o=this._zoom!==e;this._moveStart(o,!1)._move(t,e)._moveEnd(o),this.fire("viewreset"),i&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,i){void 0===e&&(e=this._zoom);var o=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),(o||i&&i.pinch)&&this.fire("zoom",i),this.fire("move",i)},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return E(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){Se(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[a(this._container)]=this;var e=t?Re:ze;e(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),yt&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){E(this._resizeRequest),this._resizeRequest=A((function(){this.invalidateSize({debounceMoveend:!0})}),this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var i,o=[],n="mouseout"===e||"mouseover"===e,s=t.target||t.srcElement,r=!1;s;){if((i=this._targets[a(s)])&&("click"===e||"preclick"===e)&&!t._simulated&&this._draggableMoved(i)){r=!0;break}if(i&&i.listens(e,!0)){if(n&&!Qe(s,t))break;if(o.push(i),n)break}if(s===this._container)break;s=s.parentNode}return o.length||r||n||!Qe(s,t)||(o=[this]),o},_handleDOMEvent:function(t){if(this._loaded&&!Xe(t)){var e=t.type;"mousedown"!==e&&"keypress"!==e&&"keyup"!==e&&"keydown"!==e||De(t.target||t.srcElement),this._fireDOMEvent(t,e)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,i){if("click"===t.type){var n=o({},t);n.type="preclick",this._fireDOMEvent(n,n.type,i)}if(!t._stopped&&(i=(i||[]).concat(this._findEventTargets(t,e))).length){var s=i[0];"contextmenu"===e&&s.listens(e,!0)&&je(t);var r={originalEvent:t};if("keypress"!==t.type&&"keydown"!==t.type&&"keyup"!==t.type){var a=s.getLatLng&&(!s._radius||s._radius<=10);r.containerPoint=a?this.latLngToContainerPoint(s.getLatLng()):this.mouseEventToContainerPoint(t),r.layerPoint=this.containerPointToLayerPoint(r.containerPoint),r.latlng=a?s.getLatLng():this.layerPointToLatLng(r.layerPoint)}for(var l=0;l<i.length;l++)if(i[l].fire(e,r,!0),r.originalEvent._stopped||!1===i[l].options.bubblingMouseEvents&&-1!==b(this._mouseEvents,e))return}},_draggableMoved:function(t){return(t=t.dragging&&t.dragging.enabled()?t:this).dragging&&t.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var t=0,e=this._handlers.length;t<e;t++)this._handlers[t].disable()},whenReady:function(t,e){return this._loaded?t.call(e||this,{target:this}):this.on("load",t,e),this},_getMapPanePos:function(){return Ae(this._mapPane)||new O(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,e){return(t&&void 0!==e?this._getNewPixelOrigin(t,e):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,e){var i=this.getSize()._divideBy(2);return this.project(t,e)._subtract(i)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,e,i){var o=this._getNewPixelOrigin(i,e);return this.project(t,e)._subtract(o)},_latLngBoundsToNewLayerBounds:function(t,e,i){var o=this._getNewPixelOrigin(i,e);return N([this.project(t.getSouthWest(),e)._subtract(o),this.project(t.getNorthWest(),e)._subtract(o),this.project(t.getSouthEast(),e)._subtract(o),this.project(t.getNorthEast(),e)._subtract(o)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,e,i){if(!i)return t;var o=this.project(t,e),n=this.getSize().divideBy(2),s=new R(o.subtract(n),o.add(n)),r=this._getBoundsOffset(s,i,e);return r.round().equals([0,0])?t:this.unproject(o.add(r),e)},_limitOffset:function(t,e){if(!e)return t;var i=this.getPixelBounds(),o=new R(i.min.add(t),i.max.add(t));return t.add(this._getBoundsOffset(o,e))},_getBoundsOffset:function(t,e,i){var o=N(this.project(e.getNorthEast(),i),this.project(e.getSouthWest(),i)),n=o.min.subtract(t.min),s=o.max.subtract(t.max);return new O(this._rebound(n.x,-s.x),this._rebound(n.y,-s.y))},_rebound:function(t,e){return t+e>0?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))},_limitZoom:function(t){var e=this.getMinZoom(),i=this.getMaxZoom(),o=yt?this.options.zoomSnap:1;return o&&(t=Math.round(t/o)*o),Math.max(e,Math.min(i,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){ye(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var i=this._getCenterOffset(t)._trunc();return!(!0!==(e&&e.animate)&&!this.getSize().contains(i)||(this.panBy(i,e),0))},_createAnimProxy:function(){var t=this._proxy=he("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",(function(t){var e=re,i=this._proxy.style[e];Ce(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),i===this._proxy.style[e]&&this._animatingZoom&&this._onZoomTransitionEnd()}),this),this.on("load moveend",(function(){var t=this.getCenter(),e=this.getZoom();Ce(this._proxy,this.project(t,e),this.getZoomScale(e,1))}),this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){ue(this._proxy),delete this._proxy},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,e,i){if(this._animatingZoom)return!0;if(i=i||{},!this._zoomAnimated||!1===i.animate||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var o=this.getZoomScale(e),n=this._getCenterOffset(t)._divideBy(1-1/o);return!(!0!==i.animate&&!this.getSize().contains(n)||(A((function(){this._moveStart(!0,!1)._animateZoom(t,e,!0)}),this),0))},_animateZoom:function(t,e,i,o){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,ve(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:o}),setTimeout(s(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&ye(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),A((function(){this._moveEnd(!0)}),this))}});function oi(t,e){return new ii(t,e)}var ni=T.extend({options:{position:"topright"},initialize:function(t){m(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),i=this.getPosition(),o=t._controlCorners[i];return ve(e,"leaflet-control"),-1!==i.indexOf("bottom")?o.insertBefore(e,o.firstChild):o.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(ue(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),si=function(t){return new ni(t)};ii.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},e="leaflet-",i=this._controlContainer=he("div",e+"control-container",this._container);function o(o,n){var s=e+o+" "+e+n;t[o+n]=he("div",s,i)}o("top","left"),o("top","right"),o("bottom","left"),o("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)ue(this._controlCorners[t]);ue(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var ri=ni.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,i,o){return i<o?-1:o<i?1:0}},initialize:function(t,e,i){for(var o in m(this,i),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[o],o);for(o in e)this._addLayer(e[o],o,!0)},onAdd:function(t){this._initLayout(),this._update(),this._map=t,t.on("zoomend",this._checkDisabledLayers,this);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(t){return ni.prototype.addTo.call(this,t),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(t,e){return this._addLayer(t,e),this._map?this._update():this},addOverlay:function(t,e){return this._addLayer(t,e,!0),this._map?this._update():this},removeLayer:function(t){t.off("add remove",this._onLayerChange,this);var e=this._getLayer(a(t));return e&&this._layers.splice(this._layers.indexOf(e),1),this._map?this._update():this},expand:function(){ve(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(ve(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):ye(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return ye(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",e=this._container=he("div",t),i=this.options.collapsed;e.setAttribute("aria-haspopup",!0),Ue(e),qe(e);var o=this._section=he("section",t+"-list");i&&(this._map.on("click",this.collapse,this),nt||ze(e,{mouseenter:this.expand,mouseleave:this.collapse},this));var n=this._layersLink=he("a",t+"-toggle",e);n.href="#",n.title="Layers",Ct?(ze(n,"click",Ve),ze(n,"click",this.expand,this)):ze(n,"focus",this.expand,this),i||this.expand(),this._baseLayersList=he("div",t+"-base",o),this._separator=he("div",t+"-separator",o),this._overlaysList=he("div",t+"-overlays",o),e.appendChild(o)},_getLayer:function(t){for(var e=0;e<this._layers.length;e++)if(this._layers[e]&&a(this._layers[e].layer)===t)return this._layers[e]},_addLayer:function(t,e,i){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:e,overlay:i}),this.options.sortLayers&&this._layers.sort(s((function(t,e){return this.options.sortFunction(t.layer,e.layer,t.name,e.name)}),this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;pe(this._baseLayersList),pe(this._overlaysList),this._layerControlInputs=[];var t,e,i,o,n=0;for(i=0;i<this._layers.length;i++)o=this._layers[i],this._addItem(o),e=e||o.overlay,t=t||!o.overlay,n+=o.overlay?0:1;return this.options.hideSingleBase&&(t=t&&n>1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=e&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var e=this._getLayer(a(t.target)),i=e.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;i&&this._map.fire(i,e)},_createRadioElement:function(t,e){var i='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(e?' checked="checked"':"")+"/>",o=document.createElement("div");return o.innerHTML=i,o.firstChild},_addItem:function(t){var e,i=document.createElement("label"),o=this._map.hasLayer(t.layer);t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=o):e=this._createRadioElement("leaflet-base-layers_"+a(this),o),this._layerControlInputs.push(e),e.layerId=a(t.layer),ze(e,"click",this._onInputClick,this);var n=document.createElement("span");n.innerHTML=" "+t.name;var s=document.createElement("div");return i.appendChild(s),s.appendChild(e),s.appendChild(n),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(i),this._checkDisabledLayers(),i},_onInputClick:function(){var t,e,i=this._layerControlInputs,o=[],n=[];this._handlingClick=!0;for(var s=i.length-1;s>=0;s--)t=i[s],e=this._getLayer(t.layerId).layer,t.checked?o.push(e):t.checked||n.push(e);for(s=0;s<n.length;s++)this._map.hasLayer(n[s])&&this._map.removeLayer(n[s]);for(s=0;s<o.length;s++)this._map.hasLayer(o[s])||this._map.addLayer(o[s]);this._handlingClick=!1,this._refocusOnMap()},_checkDisabledLayers:function(){for(var t,e,i=this._layerControlInputs,o=this._map.getZoom(),n=i.length-1;n>=0;n--)t=i[n],e=this._getLayer(t.layerId).layer,t.disabled=void 0!==e.options.minZoom&&o<e.options.minZoom||void 0!==e.options.maxZoom&&o>e.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expand:function(){return this.expand()},_collapse:function(){return this.collapse()}}),ai=function(t,e,i){return new ri(t,e,i)},li=ni.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"&#x2212;",zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",i=he("div",e+" leaflet-bar"),o=this.options;return this._zoomInButton=this._createButton(o.zoomInText,o.zoomInTitle,e+"-in",i,this._zoomIn),this._zoomOutButton=this._createButton(o.zoomOutText,o.zoomOutTitle,e+"-out",i,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),i},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(t.shiftKey?3:1))},_zoomOut:function(t){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,i,o,n){var s=he("a",i,o);return s.innerHTML=t,s.href="#",s.title=e,s.setAttribute("role","button"),s.setAttribute("aria-label",e),Ue(s),ze(s,"click",Ve),ze(s,"click",n,this),ze(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";ye(this._zoomInButton,e),ye(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMinZoom())&&ve(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMaxZoom())&&ve(this._zoomInButton,e)}});ii.mergeOptions({zoomControl:!0}),ii.addInitHook((function(){this.options.zoomControl&&(this.zoomControl=new li,this.addControl(this.zoomControl))}));var di=function(t){return new li(t)},ci=ni.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",i=he("div",e),o=this.options;return this._addScales(o,e+"-line",i),t.on(o.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),i},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,i){t.metric&&(this._mScale=he("div",e,i)),t.imperial&&(this._iScale=he("div",e,i))},_update:function(){var t=this._map,e=t.getSize().y/2,i=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(i)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t),i=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,i,e/t)},_updateImperial:function(t){var e,i,o,n=3.2808399*t;n>5280?(e=n/5280,i=this._getRoundNum(e),this._updateScale(this._iScale,i+" mi",i/e)):(o=this._getRoundNum(n),this._updateScale(this._iScale,o+" ft",o/n))},_updateScale:function(t,e,i){t.style.width=Math.round(this.options.maxWidth*i)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),i=t/e;return e*(i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:1)}}),hi=function(t){return new ci(t)},ui=ni.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>'},initialize:function(t){m(this,t),this._attributions={}},onAdd:function(t){for(var e in t.attributionControl=this,this._container=he("div","leaflet-control-attribution"),Ue(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var e in this._attributions)this._attributions[e]&&t.push(e);var i=[];this.options.prefix&&i.push(this.options.prefix),t.length&&i.push(t.join(", ")),this._container.innerHTML=i.join(" | ")}}});ii.mergeOptions({attributionControl:!0}),ii.addInitHook((function(){this.options.attributionControl&&(new ui).addTo(this)}));var pi=function(t){return new ui(t)};ni.Layers=ri,ni.Zoom=li,ni.Scale=ci,ni.Attribution=ui,si.layers=ai,si.zoom=di,si.scale=hi,si.attribution=pi;var mi=T.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});mi.addTo=function(t,e){return t.addHandler(e,this),this};var gi,fi={Events:M},vi=Ct?"touchstart mousedown":"mousedown",yi={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},bi={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},xi=I.extend({options:{clickTolerance:3},initialize:function(t,e,i,o){m(this,o),this._element=t,this._dragStartTarget=e||t,this._preventOutline=i},enable:function(){this._enabled||(ze(this._dragStartTarget,vi,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(xi._dragging===this&&this.finishDrag(),Re(this._dragStartTarget,vi,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(!t._simulated&&this._enabled&&(this._moved=!1,!fe(this._element,"leaflet-zoom-anim")&&!(xi._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||(xi._dragging=this,this._preventOutline&&De(this._element),$e(),ee(),this._moving)))){this.fire("down");var e=t.touches?t.touches[0]:t,i=Ie(this._element);this._startPoint=new O(e.clientX,e.clientY),this._parentScale=Oe(i),ze(document,bi[t.type],this._onMove,this),ze(document,yi[t.type],this._onUp,this)}},_onMove:function(t){if(!t._simulated&&this._enabled)if(t.touches&&t.touches.length>1)this._moved=!0;else{var e=t.touches&&1===t.touches.length?t.touches[0]:t,i=new O(e.clientX,e.clientY)._subtract(this._startPoint);(i.x||i.y)&&(Math.abs(i.x)+Math.abs(i.y)<this.options.clickTolerance||(i.x/=this._parentScale.x,i.y/=this._parentScale.y,je(t),this._moved||(this.fire("dragstart"),this._moved=!0,this._startPos=Ae(this._element).subtract(i),ve(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),ve(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(i),this._moving=!0,E(this._animRequest),this._lastEvent=t,this._animRequest=A(this._updatePosition,this,!0)))}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),Se(this._element,this._newPos),this.fire("drag",t)},_onUp:function(t){!t._simulated&&this._enabled&&this.finishDrag()},finishDrag:function(){for(var t in ye(document.body,"leaflet-dragging"),this._lastTarget&&(ye(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),bi)Re(document,bi[t],this._onMove,this),Re(document,yi[t],this._onUp,this);Te(),ie(),this._moved&&this._moving&&(E(this._animRequest),this.fire("dragend",{distance:this._newPos.distanceTo(this._startPos)})),this._moving=!1,xi._dragging=!1}});function _i(t,e){if(!e||!t.length)return t.slice();var i=e*e;return t=Ci(t=Ai(t,i),i)}function wi(t,e,i){return Math.sqrt(Mi(t,e,i,!0))}function ki(t,e,i){return Mi(t,e,i)}function Ci(t,e){var i=t.length,o=new(typeof Uint8Array!=void 0+""?Uint8Array:Array)(i);o[0]=o[i-1]=1,Si(t,o,e,0,i-1);var n,s=[];for(n=0;n<i;n++)o[n]&&s.push(t[n]);return s}function Si(t,e,i,o,n){var s,r,a,l=0;for(r=o+1;r<=n-1;r++)(a=Mi(t[r],t[o],t[n],!0))>l&&(s=r,l=a);l>i&&(e[s]=1,Si(t,e,i,o,s),Si(t,e,i,s,n))}function Ai(t,e){for(var i=[t[0]],o=1,n=0,s=t.length;o<s;o++)Di(t[o],t[n])>e&&(i.push(t[o]),n=o);return n<s-1&&i.push(t[s-1]),i}function Ei(t,e,i,o,n){var s,r,a,l=o?gi:Ti(t,i),d=Ti(e,i);for(gi=d;;){if(!(l|d))return[t,e];if(l&d)return!1;a=Ti(r=$i(t,e,s=l||d,i,n),i),s===l?(t=r,l=a):(e=r,d=a)}}function $i(t,e,i,o,n){var s,r,a=e.x-t.x,l=e.y-t.y,d=o.min,c=o.max;return 8&i?(s=t.x+a*(c.y-t.y)/l,r=c.y):4&i?(s=t.x+a*(d.y-t.y)/l,r=d.y):2&i?(s=c.x,r=t.y+l*(c.x-t.x)/a):1&i&&(s=d.x,r=t.y+l*(d.x-t.x)/a),new O(s,r,n)}function Ti(t,e){var i=0;return t.x<e.min.x?i|=1:t.x>e.max.x&&(i|=2),t.y<e.min.y?i|=4:t.y>e.max.y&&(i|=8),i}function Di(t,e){var i=e.x-t.x,o=e.y-t.y;return i*i+o*o}function Mi(t,e,i,o){var n,s=e.x,r=e.y,a=i.x-s,l=i.y-r,d=a*a+l*l;return d>0&&((n=((t.x-s)*a+(t.y-r)*l)/d)>1?(s=i.x,r=i.y):n>0&&(s+=a*n,r+=l*n)),a=t.x-s,l=t.y-r,o?a*a+l*l:new O(s,r)}function Ii(t){return!y(t[0])||"object"!=typeof t[0][0]&&void 0!==t[0][0]}function Oi(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Ii(t)}var Li=(Object.freeze||Object)({simplify:_i,pointToSegmentDistance:wi,closestPointOnSegment:ki,clipSegment:Ei,_getEdgeIntersection:$i,_getBitCode:Ti,_sqClosestPointOnSegment:Mi,isFlat:Ii,_flat:Oi});function zi(t,e,i){var o,n,s,r,a,l,d,c,h,u=[1,4,2,8];for(n=0,d=t.length;n<d;n++)t[n]._code=Ti(t[n],e);for(r=0;r<4;r++){for(c=u[r],o=[],n=0,s=(d=t.length)-1;n<d;s=n++)a=t[n],l=t[s],a._code&c?l._code&c||((h=$i(l,a,c,e,i))._code=Ti(h,e),o.push(h)):(l._code&c&&((h=$i(l,a,c,e,i))._code=Ti(h,e),o.push(h)),o.push(a));t=o}return t}var Pi=(Object.freeze||Object)({clipPolygon:zi}),Ri={project:function(t){return new O(t.lng,t.lat)},unproject:function(t){return new q(t.y,t.x)},bounds:new R([-180,-90],[180,90])},Ni={R:6378137,R_MINOR:6356752.314245179,bounds:new R([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(t){var e=Math.PI/180,i=this.R,o=t.lat*e,n=this.R_MINOR/i,s=Math.sqrt(1-n*n),r=s*Math.sin(o),a=Math.tan(Math.PI/4-o/2)/Math.pow((1-r)/(1+r),s/2);return o=-i*Math.log(Math.max(a,1e-10)),new O(t.lng*e*i,o)},unproject:function(t){for(var e,i=180/Math.PI,o=this.R,n=this.R_MINOR/o,s=Math.sqrt(1-n*n),r=Math.exp(-t.y/o),a=Math.PI/2-2*Math.atan(r),l=0,d=.1;l<15&&Math.abs(d)>1e-7;l++)e=s*Math.sin(a),e=Math.pow((1-e)/(1+e),s/2),a+=d=Math.PI/2-2*Math.atan(r*e)-a;return new q(a*i,t.x*i/o)}},Bi=(Object.freeze||Object)({LonLat:Ri,Mercator:Ni,SphericalMercator:W}),Fi=o({},V,{code:"EPSG:3395",projection:Ni,transformation:function(){var t=.5/(Math.PI*Ni.R);return Y(t,.5,-t,.5)}()}),qi=o({},V,{code:"EPSG:4326",projection:Ri,transformation:Y(1/180,1,-1/180,.5)}),Ui=o({},j,{projection:Ri,transformation:Y(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,e){var i=e.lng-t.lng,o=e.lat-t.lat;return Math.sqrt(i*i+o*o)},infinite:!0});j.Earth=V,j.EPSG3395=Fi,j.EPSG3857=G,j.EPSG900913=K,j.EPSG4326=qi,j.Simple=Ui;var ji=I.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[a(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[a(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var e=t.target;if(e.hasLayer(this)){if(this._map=e,this._zoomAnimated=e._zoomAnimated,this.getEvents){var i=this.getEvents();e.on(i,this),this.once("remove",(function(){e.off(i,this)}),this)}this.onAdd(e),this.getAttribution&&e.attributionControl&&e.attributionControl.addAttribution(this.getAttribution()),this.fire("add"),e.fire("layeradd",{layer:this})}}});ii.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var e=a(t);return this._layers[e]||(this._layers[e]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t)),this},removeLayer:function(t){var e=a(t);return this._layers[e]?(this._loaded&&t.onRemove(this),t.getAttribution&&this.attributionControl&&this.attributionControl.removeAttribution(t.getAttribution()),delete this._layers[e],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return!!t&&a(t)in this._layers},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},_addLayers:function(t){for(var e=0,i=(t=t?y(t)?t:[t]:[]).length;e<i;e++)this.addLayer(t[e])},_addZoomLimit:function(t){!isNaN(t.options.maxZoom)&&isNaN(t.options.minZoom)||(this._zoomBoundLayers[a(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var e=a(t);this._zoomBoundLayers[e]&&(delete this._zoomBoundLayers[e],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,e=-1/0,i=this._getZoomSpan();for(var o in this._zoomBoundLayers){var n=this._zoomBoundLayers[o].options;t=void 0===n.minZoom?t:Math.min(t,n.minZoom),e=void 0===n.maxZoom?e:Math.max(e,n.maxZoom)}this._layersMaxZoom=e===-1/0?void 0:e,this._layersMinZoom=t===1/0?void 0:t,i!==this._getZoomSpan()&&this.fire("zoomlevelschange"),void 0===this.options.maxZoom&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Vi=ji.extend({initialize:function(t,e){var i,o;if(m(this,e),this._layers={},t)for(i=0,o=t.length;i<o;i++)this.addLayer(t[i])},addLayer:function(t){var e=this.getLayerId(t);return this._layers[e]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var e=t in this._layers?t:this.getLayerId(t);return this._map&&this._layers[e]&&this._map.removeLayer(this._layers[e]),delete this._layers[e],this},hasLayer:function(t){return!!t&&(t in this._layers||this.getLayerId(t)in this._layers)},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var e,i,o=Array.prototype.slice.call(arguments,1);for(e in this._layers)(i=this._layers[e])[t]&&i[t].apply(i,o);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},getLayer:function(t){return this._layers[t]},getLayers:function(){var t=[];return this.eachLayer(t.push,t),t},setZIndex:function(t){return this.invoke("setZIndex",t)},getLayerId:function(t){return a(t)}}),Hi=function(t,e){return new Vi(t,e)},Wi=Vi.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),Vi.prototype.addLayer.call(this,t),this.fire("layeradd",{layer:t}))},removeLayer:function(t){return this.hasLayer(t)?(t in this._layers&&(t=this._layers[t]),t.removeEventParent(this),Vi.prototype.removeLayer.call(this,t),this.fire("layerremove",{layer:t})):this},setStyle:function(t){return this.invoke("setStyle",t)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var t=new B;for(var e in this._layers){var i=this._layers[e];t.extend(i.getBounds?i.getBounds():i.getLatLng())}return t}}),Zi=function(t){return new Wi(t)},Yi=T.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0]},initialize:function(t){m(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,e){var i=this._getIconUrl(t);if(!i){if("icon"===t)throw new Error("iconUrl not set in Icon options (see the docs).");return null}var o=this._createImg(i,e&&"IMG"===e.tagName?e:null);return this._setIconStyles(o,t),o},_setIconStyles:function(t,e){var i=this.options,o=i[e+"Size"];"number"==typeof o&&(o=[o,o]);var n=P(o),s=P("shadow"===e&&i.shadowAnchor||i.iconAnchor||n&&n.divideBy(2,!0));t.className="leaflet-marker-"+e+" "+(i.className||""),s&&(t.style.marginLeft=-s.x+"px",t.style.marginTop=-s.y+"px"),n&&(t.style.width=n.x+"px",t.style.height=n.y+"px")},_createImg:function(t,e){return(e=e||document.createElement("img")).src=t,e},_getIconUrl:function(t){return Et&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}});function Gi(t){return new Yi(t)}var Ki=Yi.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(t){return Ki.imagePath||(Ki.imagePath=this._detectIconPath()),(this.options.imagePath||Ki.imagePath)+Yi.prototype._getIconUrl.call(this,t)},_detectIconPath:function(){var t=he("div","leaflet-default-icon-path",document.body),e=ce(t,"background-image")||ce(t,"backgroundImage");return document.body.removeChild(t),e=null===e||0!==e.indexOf("url")?"":e.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")}}),Xi=mi.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new xi(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),ve(t,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&ye(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var e=this._marker,i=e._map,o=this._marker.options.autoPanSpeed,n=this._marker.options.autoPanPadding,s=Ae(e._icon),r=i.getPixelBounds(),a=i.getPixelOrigin(),l=N(r.min._subtract(a).add(n),r.max._subtract(a).subtract(n));if(!l.contains(s)){var d=P((Math.max(l.max.x,s.x)-l.max.x)/(r.max.x-l.max.x)-(Math.min(l.min.x,s.x)-l.min.x)/(r.min.x-l.min.x),(Math.max(l.max.y,s.y)-l.max.y)/(r.max.y-l.max.y)-(Math.min(l.min.y,s.y)-l.min.y)/(r.min.y-l.min.y)).multiplyBy(o);i.panBy(d,{animate:!1}),this._draggable._newPos._add(d),this._draggable._startPos._add(d),Se(e._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=A(this._adjustPan.bind(this,t))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup().fire("movestart").fire("dragstart")},_onPreDrag:function(t){this._marker.options.autoPan&&(E(this._panRequest),this._panRequest=A(this._adjustPan.bind(this,t)))},_onDrag:function(t){var e=this._marker,i=e._shadow,o=Ae(e._icon),n=e._map.layerPointToLatLng(o);i&&Se(i,o),e._latlng=n,t.latlng=n,t.oldLatLng=this._oldLatLng,e.fire("move",t).fire("drag",t)},_onDragEnd:function(t){E(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),Qi=ji.extend({options:{icon:new Ki,interactive:!0,keyboard:!0,title:"",alt:"",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(t,e){m(this,e),this._latlng=U(t)},onAdd:function(t){this._zoomAnimated=this._zoomAnimated&&t.options.markerZoomAnimation,this._zoomAnimated&&t.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(t){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&t.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(t){var e=this._latlng;return this._latlng=U(t),this.update(),this.fire("move",{oldLatLng:e,latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update()},getIcon:function(){return this.options.icon},setIcon:function(t){return this.options.icon=t,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var t=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(t)}return this},_initIcon:function(){var t=this.options,e="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),i=t.icon.createIcon(this._icon),o=!1;i!==this._icon&&(this._icon&&this._removeIcon(),o=!0,t.title&&(i.title=t.title),"IMG"===i.tagName&&(i.alt=t.alt||"")),ve(i,e),t.keyboard&&(i.tabIndex="0"),this._icon=i,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex});var n=t.icon.createShadow(this._shadow),s=!1;n!==this._shadow&&(this._removeShadow(),s=!0),n&&(ve(n,e),n.alt=""),this._shadow=n,t.opacity<1&&this._updateOpacity(),o&&this.getPane().appendChild(this._icon),this._initInteraction(),n&&s&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),ue(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&ue(this._shadow),this._shadow=null},_setPos:function(t){Se(this._icon,t),this._shadow&&Se(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon.style.zIndex=this._zIndex+t},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPos(e)},_initInteraction:function(){if(this.options.interactive&&(ve(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Xi)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Xi(this),t&&this.dragging.enable()}},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var t=this.options.opacity;this._icon&&_e(this._icon,t),this._shadow&&_e(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function Ji(t,e){return new Qi(t,e)}var to=ji.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(t){this._renderer=t.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(t){return m(this,t),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&t.hasOwnProperty("weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+this._renderer.options.tolerance}}),eo=to.extend({options:{fill:!0,radius:10},initialize:function(t,e){m(this,e),this._latlng=U(t),this._radius=this.options.radius},setLatLng:function(t){return this._latlng=U(t),this.redraw(),this.fire("move",{latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(t){return this.options.radius=this._radius=t,this.redraw()},getRadius:function(){return this._radius},setStyle:function(t){var e=t&&t.radius||this._radius;return to.prototype.setStyle.call(this,t),this.setRadius(e),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var t=this._radius,e=this._radiusY||t,i=this._clickTolerance(),o=[t+i,e+i];this._pxBounds=new R(this._point.subtract(o),this._point.add(o))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function io(t,e){return new eo(t,e)}var oo=eo.extend({initialize:function(t,e,i){if("number"==typeof e&&(e=o({},i,{radius:e})),m(this,e),this._latlng=U(t),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(t){return this._mRadius=t,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var t=[this._radius,this._radiusY||this._radius];return new B(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:to.prototype.setStyle,_project:function(){var t=this._latlng.lng,e=this._latlng.lat,i=this._map,o=i.options.crs;if(o.distance===V.distance){var n=Math.PI/180,s=this._mRadius/V.R/n,r=i.project([e+s,t]),a=i.project([e-s,t]),l=r.add(a).divideBy(2),d=i.unproject(l).lat,c=Math.acos((Math.cos(s*n)-Math.sin(e*n)*Math.sin(d*n))/(Math.cos(e*n)*Math.cos(d*n)))/n;(isNaN(c)||0===c)&&(c=s/Math.cos(Math.PI/180*e)),this._point=l.subtract(i.getPixelOrigin()),this._radius=isNaN(c)?0:l.x-i.project([d,t-c]).x,this._radiusY=l.y-r.y}else{var h=o.unproject(o.project(this._latlng).subtract([this._mRadius,0]));this._point=i.latLngToLayerPoint(this._latlng),this._radius=this._point.x-i.latLngToLayerPoint(h).x}this._updateBounds()}});function no(t,e,i){return new oo(t,e,i)}var so=to.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,e){m(this,e),this._setLatLngs(t)},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._setLatLngs(t),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(t){for(var e,i,o=1/0,n=null,s=Mi,r=0,a=this._parts.length;r<a;r++)for(var l=this._parts[r],d=1,c=l.length;d<c;d++){var h=s(t,e=l[d-1],i=l[d],!0);h<o&&(o=h,n=s(t,e,i))}return n&&(n.distance=Math.sqrt(o)),n},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,e,i,o,n,s,r,a=this._rings[0],l=a.length;if(!l)return null;for(t=0,e=0;t<l-1;t++)e+=a[t].distanceTo(a[t+1])/2;if(0===e)return this._map.layerPointToLatLng(a[0]);for(t=0,o=0;t<l-1;t++)if(n=a[t],s=a[t+1],(o+=i=n.distanceTo(s))>e)return r=(o-e)/i,this._map.layerPointToLatLng([s.x-r*(s.x-n.x),s.y-r*(s.y-n.y)])},getBounds:function(){return this._bounds},addLatLng:function(t,e){return e=e||this._defaultShape(),t=U(t),e.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new B,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return Ii(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var e=[],i=Ii(t),o=0,n=t.length;o<n;o++)i?(e[o]=U(t[o]),this._bounds.extend(e[o])):e[o]=this._convertLatLngs(t[o]);return e},_project:function(){var t=new R;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t),this._bounds.isValid()&&t.isValid()&&(this._rawPxBounds=t,this._updateBounds())},_updateBounds:function(){var t=this._clickTolerance(),e=new O(t,t);this._pxBounds=new R([this._rawPxBounds.min.subtract(e),this._rawPxBounds.max.add(e)])},_projectLatlngs:function(t,e,i){var o,n,s=t[0]instanceof q,r=t.length;if(s){for(n=[],o=0;o<r;o++)n[o]=this._map.latLngToLayerPoint(t[o]),i.extend(n[o]);e.push(n)}else for(o=0;o<r;o++)this._projectLatlngs(t[o],e,i)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else{var e,i,o,n,s,r,a,l=this._parts;for(e=0,o=0,n=this._rings.length;e<n;e++)for(i=0,s=(a=this._rings[e]).length;i<s-1;i++)(r=Ei(a[i],a[i+1],t,i,!0))&&(l[o]=l[o]||[],l[o].push(r[0]),r[1]===a[i+1]&&i!==s-2||(l[o].push(r[1]),o++))}},_simplifyPoints:function(){for(var t=this._parts,e=this.options.smoothFactor,i=0,o=t.length;i<o;i++)t[i]=_i(t[i],e)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,e){var i,o,n,s,r,a,l=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(i=0,s=this._parts.length;i<s;i++)for(o=0,n=(r=(a=this._parts[i]).length)-1;o<r;n=o++)if((e||0!==o)&&wi(t,a[n],a[o])<=l)return!0;return!1}});function ro(t,e){return new so(t,e)}so._flat=Oi;var ao=so.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,e,i,o,n,s,r,a,l,d=this._rings[0],c=d.length;if(!c)return null;for(s=r=a=0,t=0,e=c-1;t<c;e=t++)i=d[t],o=d[e],n=i.y*o.x-o.y*i.x,r+=(i.x+o.x)*n,a+=(i.y+o.y)*n,s+=3*n;return l=0===s?d[0]:[r/s,a/s],this._map.layerPointToLatLng(l)},_convertLatLngs:function(t){var e=so.prototype._convertLatLngs.call(this,t),i=e.length;return i>=2&&e[0]instanceof q&&e[0].equals(e[i-1])&&e.pop(),e},_setLatLngs:function(t){so.prototype._setLatLngs.call(this,t),Ii(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Ii(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,i=new O(e,e);if(t=new R(t.min.subtract(i),t.max.add(i)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var o,n=0,s=this._rings.length;n<s;n++)(o=zi(this._rings[n],t,!0)).length&&this._parts.push(o)},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var e,i,o,n,s,r,a,l,d=!1;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(n=0,a=this._parts.length;n<a;n++)for(s=0,r=(l=(e=this._parts[n]).length)-1;s<l;r=s++)i=e[s],o=e[r],i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(d=!d);return d||so.prototype._containsPoint.call(this,t,!0)}});function lo(t,e){return new ao(t,e)}var co=Wi.extend({initialize:function(t,e){m(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,i,o,n=y(t)?t:t.features;if(n){for(e=0,i=n.length;e<i;e++)((o=n[e]).geometries||o.geometry||o.features||o.coordinates)&&this.addData(o);return this}var s=this.options;if(s.filter&&!s.filter(t))return this;var r=ho(t,s);return r?(r.feature=vo(t),r.defaultOptions=r.options,this.resetStyle(r),s.onEachFeature&&s.onEachFeature(t,r),this.addLayer(r)):this},resetStyle:function(t){return t.options=o({},t.defaultOptions),this._setLayerStyle(t,this.options.style),this},setStyle:function(t){return this.eachLayer((function(e){this._setLayerStyle(e,t)}),this)},_setLayerStyle:function(t,e){t.setStyle&&("function"==typeof e&&(e=e(t.feature)),t.setStyle(e))}});function ho(t,e){var i,o,n,s,r="Feature"===t.type?t.geometry:t,a=r?r.coordinates:null,l=[],d=e&&e.pointToLayer,c=e&&e.coordsToLatLng||uo;if(!a&&!r)return null;switch(r.type){case"Point":return i=c(a),d?d(t,i):new Qi(i);case"MultiPoint":for(n=0,s=a.length;n<s;n++)i=c(a[n]),l.push(d?d(t,i):new Qi(i));return new Wi(l);case"LineString":case"MultiLineString":return o=po(a,"LineString"===r.type?0:1,c),new so(o,e);case"Polygon":case"MultiPolygon":return o=po(a,"Polygon"===r.type?1:2,c),new ao(o,e);case"GeometryCollection":for(n=0,s=r.geometries.length;n<s;n++){var h=ho({geometry:r.geometries[n],type:"Feature",properties:t.properties},e);h&&l.push(h)}return new Wi(l);default:throw new Error("Invalid GeoJSON object.")}}function uo(t){return new q(t[1],t[0],t[2])}function po(t,e,i){for(var o,n=[],s=0,r=t.length;s<r;s++)o=e?po(t[s],e-1,i):(i||uo)(t[s]),n.push(o);return n}function mo(t,e){return e="number"==typeof e?e:6,void 0!==t.alt?[h(t.lng,e),h(t.lat,e),h(t.alt,e)]:[h(t.lng,e),h(t.lat,e)]}function go(t,e,i,o){for(var n=[],s=0,r=t.length;s<r;s++)n.push(e?go(t[s],e-1,i,o):mo(t[s],o));return!e&&i&&n.push(n[0]),n}function fo(t,e){return t.feature?o({},t.feature,{geometry:e}):vo(e)}function vo(t){return"Feature"===t.type||"FeatureCollection"===t.type?t:{type:"Feature",properties:{},geometry:t}}var yo={toGeoJSON:function(t){return fo(this,{type:"Point",coordinates:mo(this.getLatLng(),t)})}};function bo(t,e){return new co(t,e)}Qi.include(yo),oo.include(yo),eo.include(yo),so.include({toGeoJSON:function(t){var e=!Ii(this._latlngs);return fo(this,{type:(e?"Multi":"")+"LineString",coordinates:go(this._latlngs,e?1:0,!1,t)})}}),ao.include({toGeoJSON:function(t){var e=!Ii(this._latlngs),i=e&&!Ii(this._latlngs[0]),o=go(this._latlngs,i?2:e?1:0,!0,t);return e||(o=[o]),fo(this,{type:(i?"Multi":"")+"Polygon",coordinates:o})}}),Vi.include({toMultiPoint:function(t){var e=[];return this.eachLayer((function(i){e.push(i.toGeoJSON(t).geometry.coordinates)})),fo(this,{type:"MultiPoint",coordinates:e})},toGeoJSON:function(t){var e=this.feature&&this.feature.geometry&&this.feature.geometry.type;if("MultiPoint"===e)return this.toMultiPoint(t);var i="GeometryCollection"===e,o=[];return this.eachLayer((function(e){if(e.toGeoJSON){var n=e.toGeoJSON(t);if(i)o.push(n.geometry);else{var s=vo(n);"FeatureCollection"===s.type?o.push.apply(o,s.features):o.push(s)}}})),i?fo(this,{geometries:o,type:"GeometryCollection"}):{type:"FeatureCollection",features:o}}});var xo=bo,_o=ji.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,e,i){this._url=t,this._bounds=F(e),m(this,i)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(ve(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){ue(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&me(this._image),this},bringToBack:function(){return this._map&&ge(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=F(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t="IMG"===this._url.tagName,e=this._image=t?this._url:he("img");ve(e,"leaflet-image-layer"),this._zoomAnimated&&ve(e,"leaflet-zoom-animated"),this.options.className&&ve(e,this.options.className),e.onselectstart=c,e.onmousemove=c,e.onload=s(this.fire,this,"load"),e.onerror=s(this._overlayOnError,this,"error"),(this.options.crossOrigin||""===this.options.crossOrigin)&&(e.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t?this._url=e.src:(e.src=this._url,e.alt=this.options.alt)},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),i=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;Ce(this._image,i,e)},_reset:function(){var t=this._image,e=new R(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),i=e.getSize();Se(t,e.min),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){_e(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)}}),wo=function(t,e,i){return new _o(t,e,i)},ko=_o.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0},_initImage:function(){var t="VIDEO"===this._url.tagName,e=this._image=t?this._url:he("video");if(ve(e,"leaflet-image-layer"),this._zoomAnimated&&ve(e,"leaflet-zoom-animated"),e.onselectstart=c,e.onmousemove=c,e.onloadeddata=s(this.fire,this,"load"),t){for(var i=e.getElementsByTagName("source"),o=[],n=0;n<i.length;n++)o.push(i[n].src);this._url=i.length>0?o:[e.src]}else{y(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&e.style.hasOwnProperty("objectFit")&&(e.style.objectFit="fill"),e.autoplay=!!this.options.autoplay,e.loop=!!this.options.loop;for(var r=0;r<this._url.length;r++){var a=he("source");a.src=this._url[r],e.appendChild(a)}}}});function Co(t,e,i){return new ko(t,e,i)}var So=_o.extend({_initImage:function(){var t=this._image=this._url;ve(t,"leaflet-image-layer"),this._zoomAnimated&&ve(t,"leaflet-zoom-animated"),t.onselectstart=c,t.onmousemove=c}});function Ao(t,e,i){return new So(t,e,i)}var Eo=ji.extend({options:{offset:[0,7],className:"",pane:"popupPane"},initialize:function(t,e){m(this,t),this._source=e},onAdd:function(t){this._zoomAnimated=t._zoomAnimated,this._container||this._initLayout(),t._fadeAnimated&&_e(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&_e(this._container,1),this.bringToFront()},onRemove:function(t){t._fadeAnimated?(_e(this._container,0),this._removeTimeout=setTimeout(s(ue,void 0,this._container),200)):ue(this._container)},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=U(t),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(t){return this._content=t,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var t={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&me(this._container),this},bringToBack:function(){return this._map&&ge(this._container),this},_prepareOpen:function(t,e,i){if(e instanceof ji||(i=e,e=t),e instanceof Wi)for(var o in t._layers){e=t._layers[o];break}if(!i)if(e.getCenter)i=e.getCenter();else{if(!e.getLatLng)throw new Error("Unable to get source layer LatLng.");i=e.getLatLng()}return this._source=e,this.update(),i},_updateContent:function(){if(this._content){var t=this._contentNode,e="function"==typeof this._content?this._content(this._source||this):this._content;if("string"==typeof e)t.innerHTML=e;else{for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(e)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var t=this._map.latLngToLayerPoint(this._latlng),e=P(this.options.offset),i=this._getAnchor();this._zoomAnimated?Se(this._container,t.add(i)):e=e.add(t).add(i);var o=this._containerBottom=-e.y,n=this._containerLeft=-Math.round(this._containerWidth/2)+e.x;this._container.style.bottom=o+"px",this._container.style.left=n+"px"}},_getAnchor:function(){return[0,0]}}),$o=Eo.extend({options:{maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(t){return t.openPopup(this),this},onAdd:function(t){Eo.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof to||this._source.on("preclick",Fe))},onRemove:function(t){Eo.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof to||this._source.off("preclick",Fe))},getEvents:function(){var t=Eo.prototype.getEvents.call(this);return(void 0!==this.options.closeOnClick?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(t.preclick=this._close),this.options.keepInView&&(t.moveend=this._adjustPan),t},_close:function(){this._map&&this._map.closePopup(this)},_initLayout:function(){var t="leaflet-popup",e=this._container=he("div",t+" "+(this.options.className||"")+" leaflet-zoom-animated"),i=this._wrapper=he("div",t+"-content-wrapper",e);if(this._contentNode=he("div",t+"-content",i),Ue(i),qe(this._contentNode),ze(i,"contextmenu",Fe),this._tipContainer=he("div",t+"-tip-container",e),this._tip=he("div",t+"-tip",this._tipContainer),this.options.closeButton){var o=this._closeButton=he("a",t+"-close-button",e);o.href="#close",o.innerHTML="&#215;",ze(o,"click",this._onCloseButtonClick,this)}},_updateLayout:function(){var t=this._contentNode,e=t.style;e.width="",e.whiteSpace="nowrap";var i=t.offsetWidth;i=Math.min(i,this.options.maxWidth),i=Math.max(i,this.options.minWidth),e.width=i+1+"px",e.whiteSpace="",e.height="";var o=t.offsetHeight,n=this.options.maxHeight,s="leaflet-popup-scrolled";n&&o>n?(e.height=n+"px",ve(t,s)):ye(t,s),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),i=this._getAnchor();Se(this._container,e.add(i))},_adjustPan:function(){if(this.options.autoPan){this._map._panAnim&&this._map._panAnim.stop();var t=this._map,e=parseInt(ce(this._container,"marginBottom"),10)||0,i=this._container.offsetHeight+e,o=this._containerWidth,n=new O(this._containerLeft,-i-this._containerBottom);n._add(Ae(this._container));var s=t.layerPointToContainerPoint(n),r=P(this.options.autoPanPadding),a=P(this.options.autoPanPaddingTopLeft||r),l=P(this.options.autoPanPaddingBottomRight||r),d=t.getSize(),c=0,h=0;s.x+o+l.x>d.x&&(c=s.x+o-d.x+l.x),s.x-c-a.x<0&&(c=s.x-a.x),s.y+i+l.y>d.y&&(h=s.y+i-d.y+l.y),s.y-h-a.y<0&&(h=s.y-a.y),(c||h)&&t.fire("autopanstart").panBy([c,h])}},_onCloseButtonClick:function(t){this._close(),Ve(t)},_getAnchor:function(){return P(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),To=function(t,e){return new $o(t,e)};ii.mergeOptions({closePopupOnClick:!0}),ii.include({openPopup:function(t,e,i){return t instanceof $o||(t=new $o(i).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=t,this.addLayer(t))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),ji.include({bindPopup:function(t,e){return t instanceof $o?(m(t,e),this._popup=t,t._source=this):(this._popup&&!e||(this._popup=new $o(e,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t,e){return this._popup&&this._map&&(e=this._popup._prepareOpen(this,t,e),this._map.openPopup(this._popup,e)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var e=t.layer||t.target;this._popup&&this._map&&(Ve(t),e instanceof to?this.openPopup(t.layer||t.target,t.latlng):this._map.hasLayer(this._popup)&&this._popup._source===e?this.closePopup():this.openPopup(e,t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var Do=Eo.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){Eo.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&this._source.fire("tooltipopen",{tooltip:this},!0)},onRemove:function(t){Eo.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&this._source.fire("tooltipclose",{tooltip:this},!0)},getEvents:function(){var t=Eo.prototype.getEvents.call(this);return Ct&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=he("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e=this._map,i=this._container,o=e.latLngToContainerPoint(e.getCenter()),n=e.layerPointToContainerPoint(t),s=this.options.direction,r=i.offsetWidth,a=i.offsetHeight,l=P(this.options.offset),d=this._getAnchor();"top"===s?t=t.add(P(-r/2+l.x,-a+l.y+d.y,!0)):"bottom"===s?t=t.subtract(P(r/2-l.x,-l.y,!0)):"center"===s?t=t.subtract(P(r/2+l.x,a/2-d.y+l.y,!0)):"right"===s||"auto"===s&&n.x<o.x?(s="right",t=t.add(P(l.x+d.x,d.y-a/2+l.y,!0))):(s="left",t=t.subtract(P(r+d.x-l.x,a/2-d.y-l.y,!0))),ye(i,"leaflet-tooltip-right"),ye(i,"leaflet-tooltip-left"),ye(i,"leaflet-tooltip-top"),ye(i,"leaflet-tooltip-bottom"),ve(i,"leaflet-tooltip-"+s),Se(i,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&_e(this._container,t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(e)},_getAnchor:function(){return P(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Mo=function(t,e){return new Do(t,e)};ii.include({openTooltip:function(t,e,i){return t instanceof Do||(t=new Do(i).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:this.addLayer(t)},closeTooltip:function(t){return t&&this.removeLayer(t),this}}),ji.include({bindTooltip:function(t,e){return t instanceof Do?(m(t,e),this._tooltip=t,t._source=this):(this._tooltip&&!e||(this._tooltip=new Do(e,this)),this._tooltip.setContent(t)),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(t){if(t||!this._tooltipHandlersAdded){var e=t?"off":"on",i={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?i.add=this._openTooltip:(i.mouseover=this._openTooltip,i.mouseout=this.closeTooltip,this._tooltip.options.sticky&&(i.mousemove=this._moveTooltip),Ct&&(i.click=this._openTooltip)),this[e](i),this._tooltipHandlersAdded=!t}},openTooltip:function(t,e){return this._tooltip&&this._map&&(e=this._tooltip._prepareOpen(this,t,e),this._map.openTooltip(this._tooltip,e),this._tooltip.options.interactive&&this._tooltip._container&&(ve(this._tooltip._container,"leaflet-clickable"),this.addInteractiveTarget(this._tooltip._container))),this},closeTooltip:function(){return this._tooltip&&(this._tooltip._close(),this._tooltip.options.interactive&&this._tooltip._container&&(ye(this._tooltip._container,"leaflet-clickable"),this.removeInteractiveTarget(this._tooltip._container))),this},toggleTooltip:function(t){return this._tooltip&&(this._tooltip._map?this.closeTooltip():this.openTooltip(t)),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(t){return this._tooltip&&this._tooltip.setContent(t),this},getTooltip:function(){return this._tooltip},_openTooltip:function(t){var e=t.layer||t.target;this._tooltip&&this._map&&this.openTooltip(e,this._tooltip.options.sticky?t.latlng:void 0)},_moveTooltip:function(t){var e,i,o=t.latlng;this._tooltip.options.sticky&&t.originalEvent&&(e=this._map.mouseEventToContainerPoint(t.originalEvent),i=this._map.containerPointToLayerPoint(e),o=this._map.layerPointToLatLng(i)),this._tooltip.setLatLng(o)}});var Io=Yi.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var e=t&&"DIV"===t.tagName?t:document.createElement("div"),i=this.options;if(i.html instanceof Element?(pe(e),e.appendChild(i.html)):e.innerHTML=!1!==i.html?i.html:"",i.bgPos){var o=P(i.bgPos);e.style.backgroundPosition=-o.x+"px "+-o.y+"px"}return this._setIconStyles(e,"icon"),e},createShadow:function(){return null}});function Oo(t){return new Io(t)}Yi.Default=Ki;var Lo=ji.extend({options:{tileSize:256,opacity:1,updateWhenIdle:bt,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(t){m(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView(),this._update()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),ue(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(me(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(ge(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){return this._map&&(this._removeAllTiles(),this._update()),this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=l(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},createTile:function(){return document.createElement("div")},getTileSize:function(){var t=this.options.tileSize;return t instanceof O?t:new O(t,t)},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var e,i=this.getPane().children,o=-t(-1/0,1/0),n=0,s=i.length;n<s;n++)e=i[n].style.zIndex,i[n]!==this._container&&e&&(o=t(o,+e));isFinite(o)&&(this.options.zIndex=o+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!et){_e(this._container,this.options.opacity);var t=+new Date,e=!1,i=!1;for(var o in this._tiles){var n=this._tiles[o];if(n.current&&n.loaded){var s=Math.min(1,(t-n.loaded)/200);_e(n.el,s),s<1?e=!0:(n.active?i=!0:this._onOpaqueTile(n),n.active=!0)}}i&&!this._noPrune&&this._pruneTiles(),e&&(E(this._fadeFrame),this._fadeFrame=A(this._updateOpacity,this))}},_onOpaqueTile:c,_initContainer:function(){this._container||(this._container=he("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var t=this._tileZoom,e=this.options.maxZoom;if(void 0!==t){for(var i in this._levels)this._levels[i].el.children.length||i===t?(this._levels[i].el.style.zIndex=e-Math.abs(t-i),this._onUpdateLevel(i)):(ue(this._levels[i].el),this._removeTilesAtZoom(i),this._onRemoveLevel(i),delete this._levels[i]);var o=this._levels[t],n=this._map;return o||((o=this._levels[t]={}).el=he("div","leaflet-tile-container leaflet-zoom-animated",this._container),o.el.style.zIndex=e,o.origin=n.project(n.unproject(n.getPixelOrigin()),t).round(),o.zoom=t,this._setZoomTransform(o,n.getCenter(),n.getZoom()),c(o.el.offsetWidth),this._onCreateLevel(o)),this._level=o,o}},_onUpdateLevel:c,_onRemoveLevel:c,_onCreateLevel:c,_pruneTiles:function(){if(this._map){var t,e,i=this._map.getZoom();if(i>this.options.maxZoom||i<this.options.minZoom)this._removeAllTiles();else{for(t in this._tiles)(e=this._tiles[t]).retain=e.current;for(t in this._tiles)if((e=this._tiles[t]).current&&!e.active){var o=e.coords;this._retainParent(o.x,o.y,o.z,o.z-5)||this._retainChildren(o.x,o.y,o.z,o.z+2)}for(t in this._tiles)this._tiles[t].retain||this._removeTile(t)}}},_removeTilesAtZoom:function(t){for(var e in this._tiles)this._tiles[e].coords.z===t&&this._removeTile(e)},_removeAllTiles:function(){for(var t in this._tiles)this._removeTile(t)},_invalidateAll:function(){for(var t in this._levels)ue(this._levels[t].el),this._onRemoveLevel(t),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,e,i,o){var n=Math.floor(t/2),s=Math.floor(e/2),r=i-1,a=new O(+n,+s);a.z=+r;var l=this._tileCoordsToKey(a),d=this._tiles[l];return d&&d.active?(d.retain=!0,!0):(d&&d.loaded&&(d.retain=!0),r>o&&this._retainParent(n,s,r,o))},_retainChildren:function(t,e,i,o){for(var n=2*t;n<2*t+2;n++)for(var s=2*e;s<2*e+2;s++){var r=new O(n,s);r.z=i+1;var a=this._tileCoordsToKey(r),l=this._tiles[a];l&&l.active?l.retain=!0:(l&&l.loaded&&(l.retain=!0),i+1<o&&this._retainChildren(n,s,i+1,o))}},_resetView:function(t){var e=t&&(t.pinch||t.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),e,e)},_animateZoom:function(t){this._setView(t.center,t.zoom,!0,t.noUpdate)},_clampZoom:function(t){var e=this.options;return void 0!==e.minNativeZoom&&t<e.minNativeZoom?e.minNativeZoom:void 0!==e.maxNativeZoom&&e.maxNativeZoom<t?e.maxNativeZoom:t},_setView:function(t,e,i,o){var n=this._clampZoom(Math.round(e));(void 0!==this.options.maxZoom&&n>this.options.maxZoom||void 0!==this.options.minZoom&&n<this.options.minZoom)&&(n=void 0);var s=this.options.updateWhenZooming&&n!==this._tileZoom;o&&!s||(this._tileZoom=n,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),void 0!==n&&this._update(t),i||this._pruneTiles(),this._noPrune=!!i),this._setZoomTransforms(t,e)},_setZoomTransforms:function(t,e){for(var i in this._levels)this._setZoomTransform(this._levels[i],t,e)},_setZoomTransform:function(t,e,i){var o=this._map.getZoomScale(i,t.zoom),n=t.origin.multiplyBy(o).subtract(this._map._getNewPixelOrigin(e,i)).round();yt?Ce(t.el,n,o):Se(t.el,n)},_resetGrid:function(){var t=this._map,e=t.options.crs,i=this._tileSize=this.getTileSize(),o=this._tileZoom,n=this._map.getPixelWorldBounds(this._tileZoom);n&&(this._globalTileRange=this._pxBoundsToTileRange(n)),this._wrapX=e.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,e.wrapLng[0]],o).x/i.x),Math.ceil(t.project([0,e.wrapLng[1]],o).x/i.y)],this._wrapY=e.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([e.wrapLat[0],0],o).y/i.x),Math.ceil(t.project([e.wrapLat[1],0],o).y/i.y)]},_onMoveEnd:function(){this._map&&!this._map._animatingZoom&&this._update()},_getTiledPixelBounds:function(t){var e=this._map,i=e._animatingZoom?Math.max(e._animateToZoom,e.getZoom()):e.getZoom(),o=e.getZoomScale(i,this._tileZoom),n=e.project(t,this._tileZoom).floor(),s=e.getSize().divideBy(2*o);return new R(n.subtract(s),n.add(s))},_update:function(t){var e=this._map;if(e){var i=this._clampZoom(e.getZoom());if(void 0===t&&(t=e.getCenter()),void 0!==this._tileZoom){var o=this._getTiledPixelBounds(t),n=this._pxBoundsToTileRange(o),s=n.getCenter(),r=[],a=this.options.keepBuffer,l=new R(n.getBottomLeft().subtract([a,-a]),n.getTopRight().add([a,-a]));if(!(isFinite(n.min.x)&&isFinite(n.min.y)&&isFinite(n.max.x)&&isFinite(n.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var d in this._tiles){var c=this._tiles[d].coords;c.z===this._tileZoom&&l.contains(new O(c.x,c.y))||(this._tiles[d].current=!1)}if(Math.abs(i-this._tileZoom)>1)this._setView(t,i);else{for(var h=n.min.y;h<=n.max.y;h++)for(var u=n.min.x;u<=n.max.x;u++){var p=new O(u,h);if(p.z=this._tileZoom,this._isValidTile(p)){var m=this._tiles[this._tileCoordsToKey(p)];m?m.current=!0:r.push(p)}}if(r.sort((function(t,e){return t.distanceTo(s)-e.distanceTo(s)})),0!==r.length){this._loading||(this._loading=!0,this.fire("loading"));var g=document.createDocumentFragment();for(u=0;u<r.length;u++)this._addTile(r[u],g);this._level.el.appendChild(g)}}}}},_isValidTile:function(t){var e=this._map.options.crs;if(!e.infinite){var i=this._globalTileRange;if(!e.wrapLng&&(t.x<i.min.x||t.x>i.max.x)||!e.wrapLat&&(t.y<i.min.y||t.y>i.max.y))return!1}if(!this.options.bounds)return!0;var o=this._tileCoordsToBounds(t);return F(this.options.bounds).overlaps(o)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,i=this.getTileSize(),o=t.scaleBy(i),n=o.add(i);return[e.unproject(o,t.z),e.unproject(n,t.z)]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),i=new B(e[0],e[1]);return this.options.noWrap||(i=this._map.wrapLatLngBounds(i)),i},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=t.split(":"),i=new O(+e[0],+e[1]);return i.z=+e[2],i},_removeTile:function(t){var e=this._tiles[t];e&&(ue(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){ve(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=c,t.onmousemove=c,et&&this.options.opacity<1&&_e(t,this.options.opacity),nt&&!st&&(t.style.WebkitBackfaceVisibility="hidden")},_addTile:function(t,e){var i=this._getTilePos(t),o=this._tileCoordsToKey(t),n=this.createTile(this._wrapCoords(t),s(this._tileReady,this,t));this._initTile(n),this.createTile.length<2&&A(s(this._tileReady,this,t,null,n)),Se(n,i),this._tiles[o]={el:n,coords:t,current:!0},e.appendChild(n),this.fire("tileloadstart",{tile:n,coords:t})},_tileReady:function(t,e,i){e&&this.fire("tileerror",{error:e,tile:i,coords:t});var o=this._tileCoordsToKey(t);(i=this._tiles[o])&&(i.loaded=+new Date,this._map._fadeAnimated?(_e(i.el,0),E(this._fadeFrame),this._fadeFrame=A(this._updateOpacity,this)):(i.active=!0,this._pruneTiles()),e||(ve(i.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:i.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),et||!this._map._fadeAnimated?A(this._pruneTiles,this):setTimeout(s(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new O(this._wrapX?d(t.x,this._wrapX):t.x,this._wrapY?d(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new R(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});function zo(t){return new Lo(t)}var Po=Lo.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(t,e){this._url=t,(e=m(this,e)).detectRetina&&Et&&e.maxZoom>0&&(e.tileSize=Math.floor(e.tileSize/2),e.zoomReverse?(e.zoomOffset--,e.minZoom++):(e.zoomOffset++,e.maxZoom--),e.minZoom=Math.max(0,e.minZoom)),"string"==typeof e.subdomains&&(e.subdomains=e.subdomains.split("")),nt||this.on("tileunload",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&void 0===e&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var i=document.createElement("img");return ze(i,"load",s(this._tileOnLoad,this,e,i)),ze(i,"error",s(this._tileOnError,this,e,i)),(this.options.crossOrigin||""===this.options.crossOrigin)&&(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),i.alt="",i.setAttribute("role","presentation"),i.src=this.getTileUrl(t),i},getTileUrl:function(t){var e={r:Et?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var i=this._globalTileRange.max.y-t.y;this.options.tms&&(e.y=i),e["-y"]=i}return v(this._url,o(e,this.options))},_tileOnLoad:function(t,e){et?setTimeout(s(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,i){var o=this.options.errorTileUrl;o&&e.getAttribute("src")!==o&&(e.src=o),t(i,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom;return this.options.zoomReverse&&(t=e-t),t+this.options.zoomOffset},_getSubdomain:function(t){var e=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[e]},_abortLoading:function(){var t,e;for(t in this._tiles)this._tiles[t].coords.z!==this._tileZoom&&((e=this._tiles[t].el).onload=c,e.onerror=c,e.complete||(e.src=x,ue(e),delete this._tiles[t]))},_removeTile:function(t){var e=this._tiles[t];if(e)return at||e.el.setAttribute("src",x),Lo.prototype._removeTile.call(this,t)},_tileReady:function(t,e,i){if(this._map&&(!i||i.getAttribute("src")!==x))return Lo.prototype._tileReady.call(this,t,e,i)}});function Ro(t,e){return new Po(t,e)}var No=Po.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,e){this._url=t;var i=o({},this.defaultWmsParams);for(var n in e)n in this.options||(i[n]=e[n]);var s=(e=m(this,e)).detectRetina&&Et?2:1,r=this.getTileSize();i.width=r.x*s,i.height=r.y*s,this.wmsParams=i},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var e=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[e]=this._crs.code,Po.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),i=this._crs,o=N(i.project(e[0]),i.project(e[1])),n=o.min,s=o.max,r=(this._wmsVersion>=1.3&&this._crs===qi?[n.y,n.x,s.y,s.x]:[n.x,n.y,s.x,s.y]).join(","),a=Po.prototype.getTileUrl.call(this,t);return a+g(this.wmsParams,a,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+r},setParams:function(t,e){return o(this.wmsParams,t),e||this.redraw(),this}});function Bo(t,e){return new No(t,e)}Po.WMS=No,Ro.wms=Bo;var Fo=ji.extend({options:{padding:.1,tolerance:0},initialize:function(t){m(this,t),a(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),this._zoomAnimated&&ve(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,e){var i=this._map.getZoomScale(e,this._zoom),o=Ae(this._container),n=this._map.getSize().multiplyBy(.5+this.options.padding),s=this._map.project(this._center,e),r=this._map.project(t,e).subtract(s),a=n.multiplyBy(-i).add(o).add(n).subtract(r);yt?Ce(this._container,a,i):Se(this._container,a)},_reset:function(){for(var t in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,e=this._map.getSize(),i=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new R(i,i.add(e.multiplyBy(1+2*t)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),qo=Fo.extend({getEvents:function(){var t=Fo.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Fo.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");ze(t,"mousemove",l(this._onMouseMove,32,this),this),ze(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),ze(t,"mouseout",this._handleMouseOut,this),this._ctx=t.getContext("2d")},_destroyContainer:function(){E(this._redrawRequest),delete this._ctx,ue(this._container),Re(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){for(var t in this._redrawBounds=null,this._layers)this._layers[t]._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){Fo.prototype._update.call(this);var t=this._bounds,e=this._container,i=t.getSize(),o=Et?2:1;Se(e,t.min),e.width=o*i.x,e.height=o*i.y,e.style.width=i.x+"px",e.style.height=i.y+"px",Et&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){Fo.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[a(t)]=t;var e=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=e),this._drawLast=e,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var e=t._order,i=e.next,o=e.prev;i?i.prev=o:this._drawLast=o,o?o.next=i:this._drawFirst=i,delete t._order,delete this._layers[a(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if("string"==typeof t.options.dashArray){var e,i,o=t.options.dashArray.split(/[, ]+/),n=[];for(i=0;i<o.length;i++){if(e=Number(o[i]),isNaN(e))return;n.push(e)}t.options._dashArray=n}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||A(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var e=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new R,this._redrawBounds.extend(t._pxBounds.min.subtract([e,e])),this._redrawBounds.extend(t._pxBounds.max.add([e,e]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var t=this._redrawBounds;if(t){var e=t.getSize();this._ctx.clearRect(t.min.x,t.min.y,e.x,e.y)}else this._ctx.clearRect(0,0,this._container.width,this._container.height)},_draw:function(){var t,e=this._redrawBounds;if(this._ctx.save(),e){var i=e.getSize();this._ctx.beginPath(),this._ctx.rect(e.min.x,e.min.y,i.x,i.y),this._ctx.clip()}this._drawing=!0;for(var o=this._drawFirst;o;o=o.next)t=o.layer,(!e||t._pxBounds&&t._pxBounds.intersects(e))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,e){if(this._drawing){var i,o,n,s,r=t._parts,a=r.length,l=this._ctx;if(a){for(l.beginPath(),i=0;i<a;i++){for(o=0,n=r[i].length;o<n;o++)s=r[i][o],l[o?"lineTo":"moveTo"](s.x,s.y);e&&l.closePath()}this._fillStroke(l,t)}}},_updateCircle:function(t){if(this._drawing&&!t._empty()){var e=t._point,i=this._ctx,o=Math.max(Math.round(t._radius),1),n=(Math.max(Math.round(t._radiusY),1)||o)/o;1!==n&&(i.save(),i.scale(1,n)),i.beginPath(),i.arc(e.x,e.y/n,o,0,2*Math.PI,!1),1!==n&&i.restore(),this._fillStroke(i,t)}},_fillStroke:function(t,e){var i=e.options;i.fill&&(t.globalAlpha=i.fillOpacity,t.fillStyle=i.fillColor||i.color,t.fill(i.fillRule||"evenodd")),i.stroke&&0!==i.weight&&(t.setLineDash&&t.setLineDash(e.options&&e.options._dashArray||[]),t.globalAlpha=i.opacity,t.lineWidth=i.weight,t.strokeStyle=i.color,t.lineCap=i.lineCap,t.lineJoin=i.lineJoin,t.stroke())},_onClick:function(t){for(var e,i,o=this._map.mouseEventToLayerPoint(t),n=this._drawFirst;n;n=n.next)(e=n.layer).options.interactive&&e._containsPoint(o)&&!this._map._draggableMoved(e)&&(i=e);i&&(Ke(t),this._fireEvent([i],t))},_onMouseMove:function(t){if(this._map&&!this._map.dragging.moving()&&!this._map._animatingZoom){var e=this._map.mouseEventToLayerPoint(t);this._handleMouseHover(t,e)}},_handleMouseOut:function(t){var e=this._hoveredLayer;e&&(ye(this._container,"leaflet-interactive"),this._fireEvent([e],t,"mouseout"),this._hoveredLayer=null)},_handleMouseHover:function(t,e){for(var i,o,n=this._drawFirst;n;n=n.next)(i=n.layer).options.interactive&&i._containsPoint(e)&&(o=i);o!==this._hoveredLayer&&(this._handleMouseOut(t),o&&(ve(this._container,"leaflet-interactive"),this._fireEvent([o],t,"mouseover"),this._hoveredLayer=o)),this._hoveredLayer&&this._fireEvent([this._hoveredLayer],t)},_fireEvent:function(t,e,i){this._map._fireDOMEvent(e,i||e.type,t)},_bringToFront:function(t){var e=t._order;if(e){var i=e.next,o=e.prev;i&&(i.prev=o,o?o.next=i:i&&(this._drawFirst=i),e.prev=this._drawLast,this._drawLast.next=e,e.next=null,this._drawLast=e,this._requestRedraw(t))}},_bringToBack:function(t){var e=t._order;if(e){var i=e.next,o=e.prev;o&&(o.next=i,i?i.prev=o:o&&(this._drawLast=o),e.prev=null,e.next=this._drawFirst,this._drawFirst.prev=e,this._drawFirst=e,this._requestRedraw(t))}}});function Uo(t){return $t?new qo(t):null}var jo=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch(t){return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),Vo={_initContainer:function(){this._container=he("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Fo.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=jo("shape");ve(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=jo("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;ue(e),t.removeInteractiveTarget(e),delete this._layers[a(t)]},_updateStyle:function(t){var e=t._stroke,i=t._fill,o=t.options,n=t._container;n.stroked=!!o.stroke,n.filled=!!o.fill,o.stroke?(e||(e=t._stroke=jo("stroke")),n.appendChild(e),e.weight=o.weight+"px",e.color=o.color,e.opacity=o.opacity,o.dashArray?e.dashStyle=y(o.dashArray)?o.dashArray.join(" "):o.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=o.lineCap.replace("butt","flat"),e.joinstyle=o.lineJoin):e&&(n.removeChild(e),t._stroke=null),o.fill?(i||(i=t._fill=jo("fill")),n.appendChild(i),i.color=o.fillColor||o.color,i.opacity=o.fillOpacity):i&&(n.removeChild(i),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),i=Math.round(t._radius),o=Math.round(t._radiusY||i);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+i+","+o+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){me(t._container)},_bringToBack:function(t){ge(t._container)}},Ho=Dt?jo:X,Wo=Fo.extend({getEvents:function(){var t=Fo.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=Ho("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Ho("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ue(this._container),Re(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(!this._map._animatingZoom||!this._bounds){Fo.prototype._update.call(this);var t=this._bounds,e=t.getSize(),i=this._container;this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,i.setAttribute("width",e.x),i.setAttribute("height",e.y)),Se(i,t.min),i.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update")}},_initPath:function(t){var e=t._path=Ho("path");t.options.className&&ve(e,t.options.className),t.options.interactive&&ve(e,"leaflet-interactive"),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ue(t._path),t.removeInteractiveTarget(t._path),delete this._layers[a(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,i=t.options;e&&(i.stroke?(e.setAttribute("stroke",i.color),e.setAttribute("stroke-opacity",i.opacity),e.setAttribute("stroke-width",i.weight),e.setAttribute("stroke-linecap",i.lineCap),e.setAttribute("stroke-linejoin",i.lineJoin),i.dashArray?e.setAttribute("stroke-dasharray",i.dashArray):e.removeAttribute("stroke-dasharray"),i.dashOffset?e.setAttribute("stroke-dashoffset",i.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),i.fill?(e.setAttribute("fill",i.fillColor||i.color),e.setAttribute("fill-opacity",i.fillOpacity),e.setAttribute("fill-rule",i.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,Q(t._parts,e))},_updateCircle:function(t){var e=t._point,i=Math.max(Math.round(t._radius),1),o="a"+i+","+(Math.max(Math.round(t._radiusY),1)||i)+" 0 1,0 ",n=t._empty()?"M0 0":"M"+(e.x-i)+","+e.y+o+2*i+",0 "+o+2*-i+",0 ";this._setPath(t,n)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){me(t._path)},_bringToBack:function(t){ge(t._path)}});function Zo(t){return Tt||Dt?new Wo(t):null}Dt&&Wo.include(Vo),ii.include({getRenderer:function(t){var e=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return e||(e=this._renderer=this._createRenderer()),this.hasLayer(e)||this.addLayer(e),e},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var e=this._paneRenderers[t];return void 0===e&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&Uo(t)||Zo(t)}});var Yo=ao.extend({initialize:function(t,e){ao.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=F(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function Go(t,e){return new Yo(t,e)}Wo.create=Ho,Wo.pointsToPath=Q,co.geometryToLayer=ho,co.coordsToLatLng=uo,co.coordsToLatLngs=po,co.latLngToCoords=mo,co.latLngsToCoords=go,co.getFeature=fo,co.asFeature=vo,ii.mergeOptions({boxZoom:!0});var Ko=mi.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){ze(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Re(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ue(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),ee(),$e(),this._startPoint=this._map.mouseEventToContainerPoint(t),ze(document,{contextmenu:Ve,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=he("div","leaflet-zoom-box",this._container),ve(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=new R(this._point,this._startPoint),i=e.getSize();Se(this._box,e.min),this._box.style.width=i.x+"px",this._box.style.height=i.y+"px"},_finish:function(){this._moved&&(ue(this._box),ye(this._container,"leaflet-crosshair")),ie(),Te(),Re(document,{contextmenu:Ve,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(s(this._resetState,this),0);var e=new B(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});ii.addInitHook("addHandler","boxZoom",Ko),ii.mergeOptions({doubleClickZoom:!0});var Xo=mi.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,i=e.getZoom(),o=e.options.zoomDelta,n=t.originalEvent.shiftKey?i-o:i+o;"center"===e.options.doubleClickZoom?e.setZoom(n):e.setZoomAround(t.containerPoint,n)}});ii.addInitHook("addHandler","doubleClickZoom",Xo),ii.mergeOptions({dragging:!0,inertia:!st,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Qo=mi.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new xi(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}ve(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){ye(this._map._container,"leaflet-grab"),ye(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var e=F(this._map.options.maxBounds);this._offsetLimit=N(this._map.latLngToContainerPoint(e.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(e.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var e=this._lastTime=+new Date,i=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(i),this._times.push(e),this._prunePositions(e)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),e=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=e.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,e){return t-(t-e)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var t=this._draggable._newPos.subtract(this._draggable._startPos),e=this._offsetLimit;t.x<e.min.x&&(t.x=this._viscousLimit(t.x,e.min.x)),t.y<e.min.y&&(t.y=this._viscousLimit(t.y,e.min.y)),t.x>e.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),i=this._initialWorldOffset,o=this._draggable._newPos.x,n=(o-e+i)%t+e-i,s=(o+e+i)%t-e-i,r=Math.abs(n+i)<Math.abs(s+i)?n:s;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=r},_onDragEnd:function(t){var e=this._map,i=e.options,o=!i.inertia||this._times.length<2;if(e.fire("dragend",t),o)e.fire("moveend");else{this._prunePositions(+new Date);var n=this._lastPos.subtract(this._positions[0]),s=(this._lastTime-this._times[0])/1e3,r=i.easeLinearity,a=n.multiplyBy(r/s),l=a.distanceTo([0,0]),d=Math.min(i.inertiaMaxSpeed,l),c=a.multiplyBy(d/l),h=d/(i.inertiaDeceleration*r),u=c.multiplyBy(-h/2).round();u.x||u.y?(u=e._limitOffset(u,e.options.maxBounds),A((function(){e.panBy(u,{duration:h,easeLinearity:r,noMoveStart:!0,animate:!0})}))):e.fire("moveend")}}});ii.addInitHook("addHandler","dragging",Qo),ii.mergeOptions({keyboard:!0,keyboardPanDelta:80});var Jo=mi.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(t){this._map=t,this._setPanDelta(t.options.keyboardPanDelta),this._setZoomDelta(t.options.zoomDelta)},addHooks:function(){var t=this._map._container;t.tabIndex<=0&&(t.tabIndex="0"),ze(t,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Re(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var t=document.body,e=document.documentElement,i=t.scrollTop||e.scrollTop,o=t.scrollLeft||e.scrollLeft;this._map._container.focus(),window.scrollTo(o,i)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){var e,i,o=this._panKeys={},n=this.keyCodes;for(e=0,i=n.left.length;e<i;e++)o[n.left[e]]=[-1*t,0];for(e=0,i=n.right.length;e<i;e++)o[n.right[e]]=[t,0];for(e=0,i=n.down.length;e<i;e++)o[n.down[e]]=[0,t];for(e=0,i=n.up.length;e<i;e++)o[n.up[e]]=[0,-1*t]},_setZoomDelta:function(t){var e,i,o=this._zoomKeys={},n=this.keyCodes;for(e=0,i=n.zoomIn.length;e<i;e++)o[n.zoomIn[e]]=t;for(e=0,i=n.zoomOut.length;e<i;e++)o[n.zoomOut[e]]=-t},_addHooks:function(){ze(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Re(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e,i=t.keyCode,o=this._map;if(i in this._panKeys)o._panAnim&&o._panAnim._inProgress||(e=this._panKeys[i],t.shiftKey&&(e=P(e).multiplyBy(3)),o.panBy(e),o.options.maxBounds&&o.panInsideBounds(o.options.maxBounds));else if(i in this._zoomKeys)o.setZoom(o.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[i]);else{if(27!==i||!o._popup||!o._popup.options.closeOnEscapeKey)return;o.closePopup()}Ve(t)}}});ii.addInitHook("addHandler","keyboard",Jo),ii.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var tn=mi.extend({addHooks:function(){ze(this._map._container,"mousewheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Re(this._map._container,"mousewheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var e=Ze(t),i=this._map.options.wheelDebounceTime;this._delta+=e,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var o=Math.max(i-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(s(this._performZoom,this),o),Ve(t)},_performZoom:function(){var t=this._map,e=t.getZoom(),i=this._map.options.zoomSnap||0;t._stop();var o=this._delta/(4*this._map.options.wheelPxPerZoomLevel),n=4*Math.log(2/(1+Math.exp(-Math.abs(o))))/Math.LN2,s=i?Math.ceil(n/i)*i:n,r=t._limitZoom(e+(this._delta>0?s:-s))-e;this._delta=0,this._startTime=null,r&&("center"===t.options.scrollWheelZoom?t.setZoom(e+r):t.setZoomAround(this._lastMousePos,e+r))}});ii.addInitHook("addHandler","scrollWheelZoom",tn),ii.mergeOptions({tap:!0,tapTolerance:15});var en=mi.extend({addHooks:function(){ze(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Re(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(t.touches){if(je(t),this._fireClick=!0,t.touches.length>1)return this._fireClick=!1,void clearTimeout(this._holdTimeout);var e=t.touches[0],i=e.target;this._startPos=this._newPos=new O(e.clientX,e.clientY),i.tagName&&"a"===i.tagName.toLowerCase()&&ve(i,"leaflet-active"),this._holdTimeout=setTimeout(s((function(){this._isTapValid()&&(this._fireClick=!1,this._onUp(),this._simulateEvent("contextmenu",e))}),this),1e3),this._simulateEvent("mousedown",e),ze(document,{touchmove:this._onMove,touchend:this._onUp},this)}},_onUp:function(t){if(clearTimeout(this._holdTimeout),Re(document,{touchmove:this._onMove,touchend:this._onUp},this),this._fireClick&&t&&t.changedTouches){var e=t.changedTouches[0],i=e.target;i&&i.tagName&&"a"===i.tagName.toLowerCase()&&ye(i,"leaflet-active"),this._simulateEvent("mouseup",e),this._isTapValid()&&this._simulateEvent("click",e)}},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(t){var e=t.touches[0];this._newPos=new O(e.clientX,e.clientY),this._simulateEvent("mousemove",e)},_simulateEvent:function(t,e){var i=document.createEvent("MouseEvents");i._simulated=!0,e.target._simulatedClick=!0,i.initMouseEvent(t,!0,!0,window,1,e.screenX,e.screenY,e.clientX,e.clientY,!1,!1,!1,!1,0,null),e.target.dispatchEvent(i)}});Ct&&!kt&&ii.addInitHook("addHandler","tap",en),ii.mergeOptions({touchZoom:Ct&&!st,bounceAtZoomLimits:!0});var on=mi.extend({addHooks:function(){ve(this._map._container,"leaflet-touch-zoom"),ze(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){ye(this._map._container,"leaflet-touch-zoom"),Re(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(t.touches&&2===t.touches.length&&!e._animatingZoom&&!this._zooming){var i=e.mouseEventToContainerPoint(t.touches[0]),o=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),"center"!==e.options.touchZoom&&(this._pinchStartLatLng=e.containerPointToLatLng(i.add(o)._divideBy(2))),this._startDist=i.distanceTo(o),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),ze(document,"touchmove",this._onTouchMove,this),ze(document,"touchend",this._onTouchEnd,this),je(t)}},_onTouchMove:function(t){if(t.touches&&2===t.touches.length&&this._zooming){var e=this._map,i=e.mouseEventToContainerPoint(t.touches[0]),o=e.mouseEventToContainerPoint(t.touches[1]),n=i.distanceTo(o)/this._startDist;if(this._zoom=e.getScaleZoom(n,this._startZoom),!e.options.bounceAtZoomLimits&&(this._zoom<e.getMinZoom()&&n<1||this._zoom>e.getMaxZoom()&&n>1)&&(this._zoom=e._limitZoom(this._zoom)),"center"===e.options.touchZoom){if(this._center=this._startLatLng,1===n)return}else{var r=i._add(o)._divideBy(2)._subtract(this._centerPoint);if(1===n&&0===r.x&&0===r.y)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(r),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),E(this._animRequest);var a=s(e._move,e,this._center,this._zoom,{pinch:!0,round:!1});this._animRequest=A(a,this,!0),je(t)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,E(this._animRequest),Re(document,"touchmove",this._onTouchMove),Re(document,"touchend",this._onTouchEnd),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});ii.addInitHook("addHandler","touchZoom",on),ii.BoxZoom=Ko,ii.DoubleClickZoom=Xo,ii.Drag=Qo,ii.Keyboard=Jo,ii.ScrollWheelZoom=tn,ii.Tap=en,ii.TouchZoom=on,Object.freeze=i,t.version=e,t.Control=ni,t.control=si,t.Browser=It,t.Evented=I,t.Mixin=fi,t.Util=$,t.Class=T,t.Handler=mi,t.extend=o,t.bind=s,t.stamp=a,t.setOptions=m,t.DomEvent=ti,t.DomUtil=Le,t.PosAnimation=ei,t.Draggable=xi,t.LineUtil=Li,t.PolyUtil=Pi,t.Point=O,t.point=P,t.Bounds=R,t.bounds=N,t.Transformation=Z,t.transformation=Y,t.Projection=Bi,t.LatLng=q,t.latLng=U,t.LatLngBounds=B,t.latLngBounds=F,t.CRS=j,t.GeoJSON=co,t.geoJSON=bo,t.geoJson=xo,t.Layer=ji,t.LayerGroup=Vi,t.layerGroup=Hi,t.FeatureGroup=Wi,t.featureGroup=Zi,t.ImageOverlay=_o,t.imageOverlay=wo,t.VideoOverlay=ko,t.videoOverlay=Co,t.SVGOverlay=So,t.svgOverlay=Ao,t.DivOverlay=Eo,t.Popup=$o,t.popup=To,t.Tooltip=Do,t.tooltip=Mo,t.Icon=Yi,t.icon=Gi,t.DivIcon=Io,t.divIcon=Oo,t.Marker=Qi,t.marker=Ji,t.TileLayer=Po,t.tileLayer=Ro,t.GridLayer=Lo,t.gridLayer=zo,t.SVG=Wo,t.svg=Zo,t.Renderer=Fo,t.Canvas=qo,t.canvas=Uo,t.Path=to,t.CircleMarker=eo,t.circleMarker=io,t.Circle=oo,t.circle=no,t.Polyline=so,t.polyline=ro,t.Polygon=ao,t.polygon=lo,t.Rectangle=Yo,t.rectangle=Go,t.Map=ii,t.map=oi;var nn=window.L;t.noConflict=function(){return window.L=nn,this},window.L=t})(bw.exports);var xw=bw.exports;const _w={weight:1,opacity:1,color:"white",fillOpacity:.7,fillColor:"#2387ca"},ww={weight:3,color:"white",fillOpacity:1,fillColor:"#2387ca"},kw=()=>_w;class Cw extends dt{static get styles(){return a`
13506
13604
  :host {
13507
13605
  display: block;
13508
13606
  padding: 0px;
@@ -13543,5 +13641,5 @@ const Z_=(t,e)=>{const i=t._$AN;if(void 0===i)return!1;for(const t of i)t._$AO?.
13543
13641
  href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css"
13544
13642
  />
13545
13643
  <div id="alias-map"></div>
13546
- `:H`<div>No osm map id</div>`}}t([mt()],Cw.prototype,"feature",void 0),t([mt()],Cw.prototype,"osmId",void 0),t([mt()],Cw.prototype,"endpoint",void 0),t([mt()],Cw.prototype,"onFeatureClicked",void 0),t([mt()],Cw.prototype,"hovered",void 0),t([mt()],Cw.prototype,"path",void 0),vw("leaflet-map",Cw),vw("alias-editor",bw)}();
13644
+ `:H`<div>No osm map id</div>`}}t([mt()],Cw.prototype,"feature",void 0),t([mt()],Cw.prototype,"osmId",void 0),t([mt()],Cw.prototype,"endpoint",void 0),t([mt()],Cw.prototype,"onFeatureClicked",void 0),t([mt()],Cw.prototype,"hovered",void 0),t([mt()],Cw.prototype,"path",void 0),vw("leaflet-map",Cw),vw("alias-editor",yw)}();
13547
13645
  //# sourceMappingURL=temba-components.js.map