django-advanced-report-builder 1.2.9__py3-none-any.whl

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 (360) hide show
  1. advanced_report_builder/.DS_Store +0 -0
  2. advanced_report_builder/.ruff_cache/.gitignore +2 -0
  3. advanced_report_builder/.ruff_cache/0.11.9/16555798982502606642 +0 -0
  4. advanced_report_builder/.ruff_cache/CACHEDIR.TAG +1 -0
  5. advanced_report_builder/__init__.py +0 -0
  6. advanced_report_builder/admin.py +264 -0
  7. advanced_report_builder/apps.py +7 -0
  8. advanced_report_builder/column_types.py +26 -0
  9. advanced_report_builder/columns.py +296 -0
  10. advanced_report_builder/customise.py +2 -0
  11. advanced_report_builder/data_merge/__init__.py +0 -0
  12. advanced_report_builder/data_merge/utils.py +112 -0
  13. advanced_report_builder/data_merge/widget.py +30 -0
  14. advanced_report_builder/duplicate.py +171 -0
  15. advanced_report_builder/exceptions.py +9 -0
  16. advanced_report_builder/field_types.py +466 -0
  17. advanced_report_builder/field_utils.py +401 -0
  18. advanced_report_builder/filter_query.py +862 -0
  19. advanced_report_builder/form_utils.py +12 -0
  20. advanced_report_builder/generate_series.py +14 -0
  21. advanced_report_builder/globals.py +276 -0
  22. advanced_report_builder/includes.py +72 -0
  23. advanced_report_builder/migrations/0001_initial.py +246 -0
  24. advanced_report_builder/migrations/0002_auto_20220209_1657.py +23 -0
  25. advanced_report_builder/migrations/0003_auto_20220215_1219.py +42 -0
  26. advanced_report_builder/migrations/0004_customreport.py +27 -0
  27. advanced_report_builder/migrations/0005_auto_20220303_0958.py +84 -0
  28. advanced_report_builder/migrations/0006_auto_20220310_1147.py +32 -0
  29. advanced_report_builder/migrations/0007_auto_20220322_1939.py +23 -0
  30. advanced_report_builder/migrations/0008_auto_20220404_1144.py +28 -0
  31. advanced_report_builder/migrations/0009_auto_20230428_1554.py +53 -0
  32. advanced_report_builder/migrations/0010_auto_20230428_2033.py +23 -0
  33. advanced_report_builder/migrations/0011_auto_20230620_1449.py +23 -0
  34. advanced_report_builder/migrations/0012_auto_20230718_1642.py +24 -0
  35. advanced_report_builder/migrations/0013_reportqueryorder.py +30 -0
  36. advanced_report_builder/migrations/0014_auto_20240706_2207.py +24 -0
  37. advanced_report_builder/migrations/0015_report_user_created_report_user_updated.py +26 -0
  38. advanced_report_builder/migrations/0016_calendarreport_dashboardreport_options_and_more.py +74 -0
  39. advanced_report_builder/migrations/0017_alter_barchartreport_options_and_more.py +57 -0
  40. advanced_report_builder/migrations/0018_reportquery_target_target_period_type.py +24 -0
  41. advanced_report_builder/migrations/0019_multicellstyle_and_more.py +107 -0
  42. advanced_report_builder/migrations/0020_alter_multicellstyle_font_size.py +18 -0
  43. advanced_report_builder/migrations/0021_multivalueheldquery_and_more.py +36 -0
  44. advanced_report_builder/migrations/0022_dashboardreport_show_options_report_template_style_and_more.py +44 -0
  45. advanced_report_builder/migrations/0023_rename_colour_target_default_colour_and_more.py +41 -0
  46. advanced_report_builder/migrations/0024_alter_target_period_type.py +18 -0
  47. advanced_report_builder/migrations/__init__.py +0 -0
  48. advanced_report_builder/models.py +954 -0
  49. advanced_report_builder/report_builder.py +28 -0
  50. advanced_report_builder/signals.py +3 -0
  51. advanced_report_builder/static/.DS_Store +0 -0
  52. advanced_report_builder/static/advanced_report_builder/.DS_Store +0 -0
  53. advanced_report_builder/static/advanced_report_builder/chart-js/js/chart.esm.js +10553 -0
  54. advanced_report_builder/static/advanced_report_builder/chart-js/js/chart.js +13190 -0
  55. advanced_report_builder/static/advanced_report_builder/chart-js/js/chart.min.js +13 -0
  56. advanced_report_builder/static/advanced_report_builder/chart-js/js/chartjs-adapter-moment.min.js +8 -0
  57. advanced_report_builder/static/advanced_report_builder/chart-js/js/chartjs-plugin-datalabels.min.js +7 -0
  58. advanced_report_builder/static/advanced_report_builder/chart-js/js/chunks/helpers.segment.js +2499 -0
  59. advanced_report_builder/static/advanced_report_builder/chart-js/js/helpers.esm.js +7 -0
  60. advanced_report_builder/static/advanced_report_builder/d3/js/d3.js +20196 -0
  61. advanced_report_builder/static/advanced_report_builder/d3/js/d3.min.js +2 -0
  62. advanced_report_builder/static/advanced_report_builder/d3-funnel/js/d3-funnel.js +6087 -0
  63. advanced_report_builder/static/advanced_report_builder/d3-funnel/js/d3-funnel.min.js +2 -0
  64. advanced_report_builder/static/advanced_report_builder/dashboard/js/dashboard.js +19 -0
  65. advanced_report_builder/static/advanced_report_builder/dot/js/.gitignore +31 -0
  66. advanced_report_builder/static/advanced_report_builder/dot/js/.travis.yml +9 -0
  67. advanced_report_builder/static/advanced_report_builder/dot/js/LICENSE-DOT.txt +24 -0
  68. advanced_report_builder/static/advanced_report_builder/dot/js/README.md +90 -0
  69. advanced_report_builder/static/advanced_report_builder/dot/js/bin/dot-packer +52 -0
  70. advanced_report_builder/static/advanced_report_builder/dot/js/bower.json +21 -0
  71. advanced_report_builder/static/advanced_report_builder/dot/js/doT.js +141 -0
  72. advanced_report_builder/static/advanced_report_builder/dot/js/doT.min.js +8 -0
  73. advanced_report_builder/static/advanced_report_builder/dot/js/doU.js +56 -0
  74. advanced_report_builder/static/advanced_report_builder/dot/js/index.js +143 -0
  75. advanced_report_builder/static/advanced_report_builder/dot/js/package.json +46 -0
  76. advanced_report_builder/static/advanced_report_builder/fullcalendar/.DS_Store +0 -0
  77. advanced_report_builder/static/advanced_report_builder/fullcalendar/LICENSE.txt +20 -0
  78. advanced_report_builder/static/advanced_report_builder/fullcalendar/README.md +10 -0
  79. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/LICENSE.txt +20 -0
  80. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/README.md +8 -0
  81. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/af.js +30 -0
  82. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ar-dz.js +31 -0
  83. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ar-kw.js +31 -0
  84. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ar-ly.js +31 -0
  85. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ar-ma.js +31 -0
  86. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ar-sa.js +31 -0
  87. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ar-tn.js +31 -0
  88. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ar.js +31 -0
  89. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/bg.js +31 -0
  90. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/bs.js +32 -0
  91. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ca.js +30 -0
  92. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/cs.js +32 -0
  93. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/da.js +30 -0
  94. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/de.js +33 -0
  95. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/el.js +30 -0
  96. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/en-au.js +17 -0
  97. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/en-gb.js +17 -0
  98. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/en-nz.js +17 -0
  99. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/es-us.js +30 -0
  100. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/es.js +30 -0
  101. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/et.js +32 -0
  102. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/eu.js +30 -0
  103. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/fa.js +33 -0
  104. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/fi.js +30 -0
  105. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/fr-ca.js +27 -0
  106. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/fr-ch.js +31 -0
  107. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/fr.js +31 -0
  108. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/gl.js +30 -0
  109. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/he.js +27 -0
  110. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/hi.js +32 -0
  111. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/hr.js +32 -0
  112. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/hu.js +30 -0
  113. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/id.js +30 -0
  114. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/is.js +30 -0
  115. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/it.js +32 -0
  116. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ja.js +28 -0
  117. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ka.js +32 -0
  118. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/kk.js +32 -0
  119. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ko.js +26 -0
  120. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/lb.js +30 -0
  121. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/lt.js +30 -0
  122. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/lv.js +32 -0
  123. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/mk.js +28 -0
  124. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ms.js +32 -0
  125. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/nb.js +30 -0
  126. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/nl.js +30 -0
  127. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/nn.js +30 -0
  128. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/pl.js +30 -0
  129. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/pt-br.js +28 -0
  130. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/pt.js +30 -0
  131. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ro.js +32 -0
  132. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/ru.js +32 -0
  133. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/sk.js +32 -0
  134. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/sl.js +30 -0
  135. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/sq.js +32 -0
  136. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/sr-cyrl.js +32 -0
  137. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/sr.js +32 -0
  138. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/sv.js +30 -0
  139. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/th.js +25 -0
  140. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/tr.js +30 -0
  141. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/uk.js +32 -0
  142. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/vi.js +32 -0
  143. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/zh-cn.js +33 -0
  144. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales/zh-tw.js +26 -0
  145. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales-all.js +1348 -0
  146. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/locales-all.min.js +1 -0
  147. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/main.css +1052 -0
  148. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/main.d.ts +2730 -0
  149. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/main.esm.js +8558 -0
  150. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/main.js +8717 -0
  151. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/main.min.css +1 -0
  152. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/main.min.js +6 -0
  153. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/core/package.json +30 -0
  154. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/daygrid/LICENSE.txt +20 -0
  155. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/daygrid/README.md +8 -0
  156. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/daygrid/main.css +78 -0
  157. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/daygrid/main.d.ts +310 -0
  158. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/daygrid/main.esm.js +1627 -0
  159. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/daygrid/main.js +1641 -0
  160. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/daygrid/main.min.css +1 -0
  161. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/daygrid/main.min.js +6 -0
  162. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/daygrid/package.json +33 -0
  163. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/fullcalendar-yearview/LICENSE +21 -0
  164. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/fullcalendar-yearview/css/main.css +85 -0
  165. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/fullcalendar-yearview/js/main.js +2018 -0
  166. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/google-calendar/LICENSE.txt +20 -0
  167. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/google-calendar/README.md +8 -0
  168. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/google-calendar/main.d.ts +20 -0
  169. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/google-calendar/main.esm.js +162 -0
  170. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/google-calendar/main.js +170 -0
  171. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/google-calendar/main.min.js +6 -0
  172. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/google-calendar/package.json +33 -0
  173. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/interaction/LICENSE.txt +20 -0
  174. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/interaction/README.md +8 -0
  175. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/interaction/main.d.ts +323 -0
  176. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/interaction/main.esm.js +2132 -0
  177. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/interaction/main.js +2143 -0
  178. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/interaction/main.min.js +6 -0
  179. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/interaction/package.json +33 -0
  180. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/list/LICENSE.txt +20 -0
  181. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/list/README.md +8 -0
  182. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/list/main.css +118 -0
  183. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/list/main.d.ts +33 -0
  184. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/list/main.esm.js +335 -0
  185. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/list/main.js +343 -0
  186. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/list/main.min.css +1 -0
  187. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/list/main.min.js +6 -0
  188. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/list/package.json +33 -0
  189. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/luxon/LICENSE.txt +20 -0
  190. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/luxon/README.md +8 -0
  191. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/luxon/main.d.ts +14 -0
  192. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/luxon/main.esm.js +162 -0
  193. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/luxon/main.js +170 -0
  194. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/luxon/main.min.js +6 -0
  195. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/luxon/package.json +34 -0
  196. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment/LICENSE.txt +20 -0
  197. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment/README.md +8 -0
  198. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment/main.d.ts +14 -0
  199. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment/main.esm.js +102 -0
  200. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment/main.js +110 -0
  201. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment/main.min.js +6 -0
  202. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment/package.json +34 -0
  203. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment-timezone/LICENSE.txt +20 -0
  204. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment-timezone/README.md +8 -0
  205. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment-timezone/main.d.ts +11 -0
  206. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment-timezone/main.esm.js +58 -0
  207. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment-timezone/main.js +64 -0
  208. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment-timezone/main.min.js +6 -0
  209. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/moment-timezone/package.json +35 -0
  210. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/rrule/LICENSE.txt +20 -0
  211. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/rrule/README.md +8 -0
  212. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/rrule/main.d.ts +9 -0
  213. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/rrule/main.esm.js +121 -0
  214. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/rrule/main.js +128 -0
  215. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/rrule/main.min.js +6 -0
  216. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/rrule/package.json +34 -0
  217. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/timegrid/LICENSE.txt +20 -0
  218. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/timegrid/README.md +8 -0
  219. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/timegrid/main.css +309 -0
  220. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/timegrid/main.d.ts +220 -0
  221. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/timegrid/main.esm.js +1345 -0
  222. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/timegrid/main.js +1357 -0
  223. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/timegrid/main.min.css +1 -0
  224. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/timegrid/main.min.js +6 -0
  225. advanced_report_builder/static/advanced_report_builder/fullcalendar/packages/timegrid/package.json +36 -0
  226. advanced_report_builder/static/advanced_report_builder/fullcalendar/vendor/rrule.js +3782 -0
  227. advanced_report_builder/static/advanced_report_builder/jquery_extendext/js/jQuery.extendext.js +132 -0
  228. advanced_report_builder/static/advanced_report_builder/jquery_extendext/js/jQuery.extendext.min.js +9 -0
  229. advanced_report_builder/static/advanced_report_builder/moment/locales.js +9769 -0
  230. advanced_report_builder/static/advanced_report_builder/moment/locales.min.js +1 -0
  231. advanced_report_builder/static/advanced_report_builder/moment/moment-with-locales.js +14289 -0
  232. advanced_report_builder/static/advanced_report_builder/moment/moment-with-locales.min.js +1 -0
  233. advanced_report_builder/static/advanced_report_builder/moment/moment.min.js +1 -0
  234. advanced_report_builder/static/advanced_report_builder/query_builder/.DS_Store +0 -0
  235. advanced_report_builder/static/advanced_report_builder/query_builder/css/.DS_Store +0 -0
  236. advanced_report_builder/static/advanced_report_builder/query_builder/css/query-builder.dark.css +173 -0
  237. advanced_report_builder/static/advanced_report_builder/query_builder/css/query-builder.dark.min.css +6 -0
  238. advanced_report_builder/static/advanced_report_builder/query_builder/css/query-builder.default.css +173 -0
  239. advanced_report_builder/static/advanced_report_builder/query_builder/css/query-builder.default.min.css +6 -0
  240. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.ar.js +80 -0
  241. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.az.js +79 -0
  242. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.bg.js +79 -0
  243. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.cs.js +79 -0
  244. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.da.js +56 -0
  245. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.de.js +76 -0
  246. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.el.js +80 -0
  247. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.en.js +83 -0
  248. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.es.js +81 -0
  249. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.fa-IR.js +79 -0
  250. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.fr.js +83 -0
  251. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.he.js +81 -0
  252. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.it.js +79 -0
  253. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.nl.js +76 -0
  254. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.no.js +54 -0
  255. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.pl.js +80 -0
  256. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.pt-BR.js +80 -0
  257. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.pt-PT.js +75 -0
  258. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.ro.js +54 -0
  259. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.ru.js +77 -0
  260. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.sq.js +78 -0
  261. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.tr.js +82 -0
  262. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.ua.js +79 -0
  263. advanced_report_builder/static/advanced_report_builder/query_builder/i18n/query-builder.zh-CN.js +80 -0
  264. advanced_report_builder/static/advanced_report_builder/query_builder/js/.DS_Store +0 -0
  265. advanced_report_builder/static/advanced_report_builder/query_builder/js/plugins/.DS_Store +0 -0
  266. advanced_report_builder/static/advanced_report_builder/query_builder/js/plugins/currency/plugin.js +30 -0
  267. advanced_report_builder/static/advanced_report_builder/query_builder/js/query-builder.js +6200 -0
  268. advanced_report_builder/static/advanced_report_builder/query_builder/js/query-builder.min.js +7 -0
  269. advanced_report_builder/static/advanced_report_builder/query_builder/js/query-builder.standalone.js +6477 -0
  270. advanced_report_builder/static/advanced_report_builder/query_builder/js/query-builder.standalone.min.js +7 -0
  271. advanced_report_builder/static/advanced_report_builder/query_builder/scss/.DS_Store +0 -0
  272. advanced_report_builder/static/advanced_report_builder/query_builder/scss/dark.scss +19 -0
  273. advanced_report_builder/static/advanced_report_builder/query_builder/scss/default.scss +186 -0
  274. advanced_report_builder/static/advanced_report_builder/query_builder/scss/plugins/_bt-checkbox.scss +12 -0
  275. advanced_report_builder/static/advanced_report_builder/query_builder/scss/plugins/_bt-tooltip-errors.scss +9 -0
  276. advanced_report_builder/static/advanced_report_builder/query_builder/scss/plugins/_filter-description.scss +21 -0
  277. advanced_report_builder/static/advanced_report_builder/query_builder/scss/plugins/_invert.scss +5 -0
  278. advanced_report_builder/static/advanced_report_builder/query_builder/scss/plugins/_sortable.scss +28 -0
  279. advanced_report_builder/static/advanced_report_builder/query_builder/scss/plugins/bt-tooltip-errors.scss +9 -0
  280. advanced_report_builder/static/advanced_report_builder/query_builder/scss/plugins/filter-description.scss +21 -0
  281. advanced_report_builder/static/advanced_report_builder/query_builder/scss/plugins/invert.scss +5 -0
  282. advanced_report_builder/static/advanced_report_builder/query_builder/scss/plugins/sortable.scss +27 -0
  283. advanced_report_builder/template_types.py +34 -0
  284. advanced_report_builder/templates/advanced_report_builder/calendar/description_modal.html +12 -0
  285. advanced_report_builder/templates/advanced_report_builder/calendar/middle.html +33 -0
  286. advanced_report_builder/templates/advanced_report_builder/calendar/modal.html +10 -0
  287. advanced_report_builder/templates/advanced_report_builder/calendar/report.html +80 -0
  288. advanced_report_builder/templates/advanced_report_builder/charts/bar/middle.html +122 -0
  289. advanced_report_builder/templates/advanced_report_builder/charts/funnel/middle.html +46 -0
  290. advanced_report_builder/templates/advanced_report_builder/charts/funnel/report.html +34 -0
  291. advanced_report_builder/templates/advanced_report_builder/charts/line/middle.html +119 -0
  292. advanced_report_builder/templates/advanced_report_builder/charts/modal.html +12 -0
  293. advanced_report_builder/templates/advanced_report_builder/charts/modal_field.html +13 -0
  294. advanced_report_builder/templates/advanced_report_builder/charts/pie/middle.html +58 -0
  295. advanced_report_builder/templates/advanced_report_builder/charts/report.html +33 -0
  296. advanced_report_builder/templates/advanced_report_builder/data_merge/data_merge.html +144 -0
  297. advanced_report_builder/templates/advanced_report_builder/datatables/fields/modal.html +13 -0
  298. advanced_report_builder/templates/advanced_report_builder/datatables/fields/single_query_builder.html +87 -0
  299. advanced_report_builder/templates/advanced_report_builder/datatables/modal.html +13 -0
  300. advanced_report_builder/templates/advanced_report_builder/datatables/onclick_menu.html +14 -0
  301. advanced_report_builder/templates/advanced_report_builder/datatables/report.html +37 -0
  302. advanced_report_builder/templates/advanced_report_builder/datatables/select_pivot.html +199 -0
  303. advanced_report_builder/templates/advanced_report_builder/error.html +21 -0
  304. advanced_report_builder/templates/advanced_report_builder/extra_query_modal.html +13 -0
  305. advanced_report_builder/templates/advanced_report_builder/kanban/description_modal.html +12 -0
  306. advanced_report_builder/templates/advanced_report_builder/kanban/middle.html +63 -0
  307. advanced_report_builder/templates/advanced_report_builder/kanban/modal.html +10 -0
  308. advanced_report_builder/templates/advanced_report_builder/kanban/report.html +71 -0
  309. advanced_report_builder/templates/advanced_report_builder/multi_values/held_modal.html +14 -0
  310. advanced_report_builder/templates/advanced_report_builder/multi_values/middle.html +61 -0
  311. advanced_report_builder/templates/advanced_report_builder/multi_values/modal.html +15 -0
  312. advanced_report_builder/templates/advanced_report_builder/multi_values/report.html +19 -0
  313. advanced_report_builder/templates/advanced_report_builder/query_builder.html +88 -0
  314. advanced_report_builder/templates/advanced_report_builder/query_modal.html +12 -0
  315. advanced_report_builder/templates/advanced_report_builder/select_column.html +230 -0
  316. advanced_report_builder/templates/advanced_report_builder/single_values/gauge_middle.html +143 -0
  317. advanced_report_builder/templates/advanced_report_builder/single_values/middle.html +63 -0
  318. advanced_report_builder/templates/advanced_report_builder/single_values/modal.html +13 -0
  319. advanced_report_builder/templates/advanced_report_builder/single_values/report.html +56 -0
  320. advanced_report_builder/toggle.py +9 -0
  321. advanced_report_builder/urls.py +237 -0
  322. advanced_report_builder/utils.py +171 -0
  323. advanced_report_builder/variable_date.py +670 -0
  324. advanced_report_builder/view_types.py +27 -0
  325. advanced_report_builder/views/.DS_Store +0 -0
  326. advanced_report_builder/views/__init__.py +0 -0
  327. advanced_report_builder/views/bar_charts.py +746 -0
  328. advanced_report_builder/views/calendar.py +745 -0
  329. advanced_report_builder/views/charts_base.py +625 -0
  330. advanced_report_builder/views/custom.py +147 -0
  331. advanced_report_builder/views/dashboard.py +357 -0
  332. advanced_report_builder/views/datatables/__init__.py +0 -0
  333. advanced_report_builder/views/datatables/datatables.py +151 -0
  334. advanced_report_builder/views/datatables/modal.py +1151 -0
  335. advanced_report_builder/views/datatables/utils.py +701 -0
  336. advanced_report_builder/views/error_pod.py +50 -0
  337. advanced_report_builder/views/funnel_charts.py +289 -0
  338. advanced_report_builder/views/helpers.py +22 -0
  339. advanced_report_builder/views/kanban.py +868 -0
  340. advanced_report_builder/views/line_charts.py +415 -0
  341. advanced_report_builder/views/modals_base.py +213 -0
  342. advanced_report_builder/views/multi_value.py +1160 -0
  343. advanced_report_builder/views/pie_charts.py +290 -0
  344. advanced_report_builder/views/query_modal/__init__.py +0 -0
  345. advanced_report_builder/views/query_modal/mixin.py +161 -0
  346. advanced_report_builder/views/query_modal/modal.py +274 -0
  347. advanced_report_builder/views/report.py +241 -0
  348. advanced_report_builder/views/report_utils_mixin.py +312 -0
  349. advanced_report_builder/views/reports.py +154 -0
  350. advanced_report_builder/views/single_values.py +792 -0
  351. advanced_report_builder/views/targets/__init__.py +0 -0
  352. advanced_report_builder/views/targets/utils.py +251 -0
  353. advanced_report_builder/views/targets/views.py +139 -0
  354. advanced_report_builder/views/value_base.py +198 -0
  355. advanced_report_builder/widgets.py +5 -0
  356. django_advanced_report_builder-1.2.9.dist-info/METADATA +35 -0
  357. django_advanced_report_builder-1.2.9.dist-info/RECORD +360 -0
  358. django_advanced_report_builder-1.2.9.dist-info/WHEEL +5 -0
  359. django_advanced_report_builder-1.2.9.dist-info/licenses/LICENSE +21 -0
  360. django_advanced_report_builder-1.2.9.dist-info/top_level.txt +1 -0
@@ -0,0 +1,3782 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("luxon"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define(["luxon"], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["rrule"] = factory(require("luxon"));
8
+ else
9
+ root["rrule"] = factory(root["luxon"]);
10
+ })(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE__2__) {
11
+ return /******/ (function(modules) { // webpackBootstrap
12
+ /******/ // The module cache
13
+ /******/ var installedModules = {};
14
+ /******/
15
+ /******/ // The require function
16
+ /******/ function __webpack_require__(moduleId) {
17
+ /******/
18
+ /******/ // Check if module is in cache
19
+ /******/ if(installedModules[moduleId]) {
20
+ /******/ return installedModules[moduleId].exports;
21
+ /******/ }
22
+ /******/ // Create a new module (and put it into the cache)
23
+ /******/ var module = installedModules[moduleId] = {
24
+ /******/ i: moduleId,
25
+ /******/ l: false,
26
+ /******/ exports: {}
27
+ /******/ };
28
+ /******/
29
+ /******/ // Execute the module function
30
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31
+ /******/
32
+ /******/ // Flag the module as loaded
33
+ /******/ module.l = true;
34
+ /******/
35
+ /******/ // Return the exports of the module
36
+ /******/ return module.exports;
37
+ /******/ }
38
+ /******/
39
+ /******/
40
+ /******/ // expose the modules object (__webpack_modules__)
41
+ /******/ __webpack_require__.m = modules;
42
+ /******/
43
+ /******/ // expose the module cache
44
+ /******/ __webpack_require__.c = installedModules;
45
+ /******/
46
+ /******/ // define getter function for harmony exports
47
+ /******/ __webpack_require__.d = function(exports, name, getter) {
48
+ /******/ if(!__webpack_require__.o(exports, name)) {
49
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
50
+ /******/ }
51
+ /******/ };
52
+ /******/
53
+ /******/ // define __esModule on exports
54
+ /******/ __webpack_require__.r = function(exports) {
55
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
56
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
57
+ /******/ }
58
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
59
+ /******/ };
60
+ /******/
61
+ /******/ // create a fake namespace object
62
+ /******/ // mode & 1: value is a module id, require it
63
+ /******/ // mode & 2: merge all properties of value into the ns
64
+ /******/ // mode & 4: return value when already ns object
65
+ /******/ // mode & 8|1: behave like require
66
+ /******/ __webpack_require__.t = function(value, mode) {
67
+ /******/ if(mode & 1) value = __webpack_require__(value);
68
+ /******/ if(mode & 8) return value;
69
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
70
+ /******/ var ns = Object.create(null);
71
+ /******/ __webpack_require__.r(ns);
72
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
73
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
74
+ /******/ return ns;
75
+ /******/ };
76
+ /******/
77
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
78
+ /******/ __webpack_require__.n = function(module) {
79
+ /******/ var getter = module && module.__esModule ?
80
+ /******/ function getDefault() { return module['default']; } :
81
+ /******/ function getModuleExports() { return module; };
82
+ /******/ __webpack_require__.d(getter, 'a', getter);
83
+ /******/ return getter;
84
+ /******/ };
85
+ /******/
86
+ /******/ // Object.prototype.hasOwnProperty.call
87
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
88
+ /******/
89
+ /******/ // __webpack_public_path__
90
+ /******/ __webpack_require__.p = "";
91
+ /******/
92
+ /******/
93
+ /******/ // Load entry module and return exports
94
+ /******/ return __webpack_require__(__webpack_require__.s = 1);
95
+ /******/ })
96
+ /************************************************************************/
97
+ /******/ ([
98
+ /* 0 */
99
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
100
+
101
+ "use strict";
102
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isPresent; });
103
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isNumber; });
104
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isArray; });
105
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return range; });
106
+ /* unused harmony export clone */
107
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return repeat; });
108
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return toArray; });
109
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return padStart; });
110
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return split; });
111
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return pymod; });
112
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return divmod; });
113
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return empty; });
114
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return notEmpty; });
115
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return includes; });
116
+ // =============================================================================
117
+ // Helper functions
118
+ // =============================================================================
119
+ var isPresent = function (value) {
120
+ return value !== null && value !== undefined;
121
+ };
122
+ var isNumber = function (value) {
123
+ return typeof value === 'number';
124
+ };
125
+ var isArray = Array.isArray;
126
+ /**
127
+ * Simplified version of python's range()
128
+ */
129
+ var range = function (start, end) {
130
+ if (end === void 0) { end = start; }
131
+ if (arguments.length === 1) {
132
+ end = start;
133
+ start = 0;
134
+ }
135
+ var rang = [];
136
+ for (var i = start; i < end; i++)
137
+ rang.push(i);
138
+ return rang;
139
+ };
140
+ var clone = function (array) {
141
+ return [].concat(array);
142
+ };
143
+ var repeat = function (value, times) {
144
+ var i = 0;
145
+ var array = [];
146
+ if (isArray(value)) {
147
+ for (; i < times; i++)
148
+ array[i] = [].concat(value);
149
+ }
150
+ else {
151
+ for (; i < times; i++)
152
+ array[i] = value;
153
+ }
154
+ return array;
155
+ };
156
+ var toArray = function (item) {
157
+ if (isArray(item)) {
158
+ return item;
159
+ }
160
+ return [item];
161
+ };
162
+ function padStart(item, targetLength, padString) {
163
+ if (padString === void 0) { padString = ' '; }
164
+ var str = String(item);
165
+ targetLength = targetLength >> 0;
166
+ if (str.length > targetLength) {
167
+ return String(str);
168
+ }
169
+ targetLength = targetLength - str.length;
170
+ if (targetLength > padString.length) {
171
+ padString += repeat(padString, targetLength / padString.length);
172
+ }
173
+ return padString.slice(0, targetLength) + String(str);
174
+ }
175
+ /**
176
+ * Python like split
177
+ */
178
+ var split = function (str, sep, num) {
179
+ var splits = str.split(sep);
180
+ return num
181
+ ? splits.slice(0, num).concat([splits.slice(num).join(sep)])
182
+ : splits;
183
+ };
184
+ /**
185
+ * closure/goog/math/math.js:modulo
186
+ * Copyright 2006 The Closure Library Authors.
187
+ * The % operator in JavaScript returns the remainder of a / b, but differs from
188
+ * some other languages in that the result will have the same sign as the
189
+ * dividend. For example, -1 % 8 == -1, whereas in some other languages
190
+ * (such as Python) the result would be 7. This function emulates the more
191
+ * correct modulo behavior, which is useful for certain applications such as
192
+ * calculating an offset index in a circular list.
193
+ *
194
+ * @param {number} a The dividend.
195
+ * @param {number} b The divisor.
196
+ * @return {number} a % b where the result is between 0 and b (either 0 <= x < b
197
+ * or b < x <= 0, depending on the sign of b).
198
+ */
199
+ var pymod = function (a, b) {
200
+ var r = a % b;
201
+ // If r and b differ in sign, add b to wrap the result to the correct sign.
202
+ return r * b < 0 ? r + b : r;
203
+ };
204
+ /**
205
+ * @see: <http://docs.python.org/library/functions.html#divmod>
206
+ */
207
+ var divmod = function (a, b) {
208
+ return { div: Math.floor(a / b), mod: pymod(a, b) };
209
+ };
210
+ var empty = function (obj) {
211
+ return !isPresent(obj) || obj.length === 0;
212
+ };
213
+ /**
214
+ * Python-like boolean
215
+ * @return {Boolean} value of an object/primitive, taking into account
216
+ * the fact that in Python an empty list's/tuple's
217
+ * boolean value is False, whereas in JS it's true
218
+ */
219
+ var notEmpty = function (obj) {
220
+ return !empty(obj);
221
+ };
222
+ /**
223
+ * Return true if a value is in an array
224
+ */
225
+ var includes = function (arr, val) {
226
+ return notEmpty(arr) && arr.indexOf(val) !== -1;
227
+ };
228
+
229
+
230
+ /***/ }),
231
+ /* 1 */
232
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
233
+
234
+ "use strict";
235
+ __webpack_require__.r(__webpack_exports__);
236
+
237
+ // EXTERNAL MODULE: ./src/helpers.ts
238
+ var helpers = __webpack_require__(0);
239
+
240
+ // CONCATENATED MODULE: ./src/dateutil.ts
241
+
242
+ /**
243
+ * General date-related utilities.
244
+ * Also handles several incompatibilities between JavaScript and Python
245
+ *
246
+ */
247
+ var dateutil_dateutil;
248
+ (function (dateutil) {
249
+ dateutil.MONTH_DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
250
+ /**
251
+ * Number of milliseconds of one day
252
+ */
253
+ dateutil.ONE_DAY = 1000 * 60 * 60 * 24;
254
+ /**
255
+ * @see: <http://docs.python.org/library/datetime.html#datetime.MAXYEAR>
256
+ */
257
+ dateutil.MAXYEAR = 9999;
258
+ /**
259
+ * Python uses 1-Jan-1 as the base for calculating ordinals but we don't
260
+ * want to confuse the JS engine with milliseconds > Number.MAX_NUMBER,
261
+ * therefore we use 1-Jan-1970 instead
262
+ */
263
+ dateutil.ORDINAL_BASE = new Date(Date.UTC(1970, 0, 1));
264
+ /**
265
+ * Python: MO-SU: 0 - 6
266
+ * JS: SU-SAT 0 - 6
267
+ */
268
+ dateutil.PY_WEEKDAYS = [6, 0, 1, 2, 3, 4, 5];
269
+ /**
270
+ * py_date.timetuple()[7]
271
+ */
272
+ dateutil.getYearDay = function (date) {
273
+ var dateNoTime = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
274
+ return (Math.ceil((dateNoTime.valueOf() -
275
+ new Date(date.getUTCFullYear(), 0, 1).valueOf()) /
276
+ dateutil.ONE_DAY) + 1);
277
+ };
278
+ dateutil.isLeapYear = function (year) {
279
+ return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
280
+ };
281
+ dateutil.isDate = function (value) {
282
+ return value instanceof Date;
283
+ };
284
+ dateutil.isValidDate = function (value) {
285
+ return dateutil.isDate(value) && !isNaN(value.getTime());
286
+ };
287
+ /**
288
+ * @return {Number} the date's timezone offset in ms
289
+ */
290
+ dateutil.tzOffset = function (date) {
291
+ return date.getTimezoneOffset() * 60 * 1000;
292
+ };
293
+ /**
294
+ * @see: <http://www.mcfedries.com/JavaScript/DaysBetween.asp>
295
+ */
296
+ dateutil.daysBetween = function (date1, date2) {
297
+ // The number of milliseconds in one day
298
+ // Convert both dates to milliseconds
299
+ var date1ms = date1.getTime() - dateutil.tzOffset(date1);
300
+ var date2ms = date2.getTime() - dateutil.tzOffset(date2);
301
+ // Calculate the difference in milliseconds
302
+ var differencems = date1ms - date2ms;
303
+ // Convert back to days and return
304
+ return Math.round(differencems / dateutil.ONE_DAY);
305
+ };
306
+ /**
307
+ * @see: <http://docs.python.org/library/datetime.html#datetime.date.toordinal>
308
+ */
309
+ dateutil.toOrdinal = function (date) {
310
+ return dateutil.daysBetween(date, dateutil.ORDINAL_BASE);
311
+ };
312
+ /**
313
+ * @see - <http://docs.python.org/library/datetime.html#datetime.date.fromordinal>
314
+ */
315
+ dateutil.fromOrdinal = function (ordinal) {
316
+ return new Date(dateutil.ORDINAL_BASE.getTime() + ordinal * dateutil.ONE_DAY);
317
+ };
318
+ dateutil.getMonthDays = function (date) {
319
+ var month = date.getUTCMonth();
320
+ return month === 1 && dateutil.isLeapYear(date.getUTCFullYear())
321
+ ? 29
322
+ : dateutil.MONTH_DAYS[month];
323
+ };
324
+ /**
325
+ * @return {Number} python-like weekday
326
+ */
327
+ dateutil.getWeekday = function (date) {
328
+ return dateutil.PY_WEEKDAYS[date.getUTCDay()];
329
+ };
330
+ /**
331
+ * @see: <http://docs.python.org/library/calendar.html#calendar.monthrange>
332
+ */
333
+ dateutil.monthRange = function (year, month) {
334
+ var date = new Date(Date.UTC(year, month, 1));
335
+ return [dateutil.getWeekday(date), dateutil.getMonthDays(date)];
336
+ };
337
+ /**
338
+ * @see: <http://docs.python.org/library/datetime.html#datetime.datetime.combine>
339
+ */
340
+ dateutil.combine = function (date, time) {
341
+ time = time || date;
342
+ return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), time.getHours(), time.getMinutes(), time.getSeconds(), time.getMilliseconds()));
343
+ };
344
+ dateutil.clone = function (date) {
345
+ var dolly = new Date(date.getTime());
346
+ return dolly;
347
+ };
348
+ dateutil.cloneDates = function (dates) {
349
+ var clones = [];
350
+ for (var i = 0; i < dates.length; i++) {
351
+ clones.push(dateutil.clone(dates[i]));
352
+ }
353
+ return clones;
354
+ };
355
+ /**
356
+ * Sorts an array of Date or dateutil.Time objects
357
+ */
358
+ dateutil.sort = function (dates) {
359
+ dates.sort(function (a, b) {
360
+ return a.getTime() - b.getTime();
361
+ });
362
+ };
363
+ dateutil.timeToUntilString = function (time, utc) {
364
+ if (utc === void 0) { utc = true; }
365
+ var date = new Date(time);
366
+ return [
367
+ Object(helpers["h" /* padStart */])(date.getUTCFullYear().toString(), 4, '0'),
368
+ Object(helpers["h" /* padStart */])(date.getUTCMonth() + 1, 2, '0'),
369
+ Object(helpers["h" /* padStart */])(date.getUTCDate(), 2, '0'),
370
+ 'T',
371
+ Object(helpers["h" /* padStart */])(date.getUTCHours(), 2, '0'),
372
+ Object(helpers["h" /* padStart */])(date.getUTCMinutes(), 2, '0'),
373
+ Object(helpers["h" /* padStart */])(date.getUTCSeconds(), 2, '0'),
374
+ utc ? 'Z' : ''
375
+ ].join('');
376
+ };
377
+ dateutil.untilStringToDate = function (until) {
378
+ var re = /^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z?)?$/;
379
+ var bits = re.exec(until);
380
+ if (!bits)
381
+ throw new Error("Invalid UNTIL value: " + until);
382
+ return new Date(Date.UTC(parseInt(bits[1], 10), parseInt(bits[2], 10) - 1, parseInt(bits[3], 10), parseInt(bits[5], 10) || 0, parseInt(bits[6], 10) || 0, parseInt(bits[7], 10) || 0));
383
+ };
384
+ })(dateutil_dateutil || (dateutil_dateutil = {}));
385
+ /* harmony default export */ var src_dateutil = (dateutil_dateutil);
386
+
387
+ // CONCATENATED MODULE: ./src/iterresult.ts
388
+ /**
389
+ * This class helps us to emulate python's generators, sorta.
390
+ */
391
+ var IterResult = /** @class */ (function () {
392
+ function IterResult(method, args) {
393
+ this.minDate = null;
394
+ this.maxDate = null;
395
+ this._result = [];
396
+ this.total = 0;
397
+ this.method = method;
398
+ this.args = args;
399
+ if (method === 'between') {
400
+ this.maxDate = args.inc
401
+ ? args.before
402
+ : new Date(args.before.getTime() - 1);
403
+ this.minDate = args.inc ? args.after : new Date(args.after.getTime() + 1);
404
+ }
405
+ else if (method === 'before') {
406
+ this.maxDate = args.inc ? args.dt : new Date(args.dt.getTime() - 1);
407
+ }
408
+ else if (method === 'after') {
409
+ this.minDate = args.inc ? args.dt : new Date(args.dt.getTime() + 1);
410
+ }
411
+ }
412
+ /**
413
+ * Possibly adds a date into the result.
414
+ *
415
+ * @param {Date} date - the date isn't necessarly added to the result
416
+ * list (if it is too late/too early)
417
+ * @return {Boolean} true if it makes sense to continue the iteration
418
+ * false if we're done.
419
+ */
420
+ IterResult.prototype.accept = function (date) {
421
+ ++this.total;
422
+ var tooEarly = this.minDate && date < this.minDate;
423
+ var tooLate = this.maxDate && date > this.maxDate;
424
+ if (this.method === 'between') {
425
+ if (tooEarly)
426
+ return true;
427
+ if (tooLate)
428
+ return false;
429
+ }
430
+ else if (this.method === 'before') {
431
+ if (tooLate)
432
+ return false;
433
+ }
434
+ else if (this.method === 'after') {
435
+ if (tooEarly)
436
+ return true;
437
+ this.add(date);
438
+ return false;
439
+ }
440
+ return this.add(date);
441
+ };
442
+ /**
443
+ *
444
+ * @param {Date} date that is part of the result.
445
+ * @return {Boolean} whether we are interested in more values.
446
+ */
447
+ IterResult.prototype.add = function (date) {
448
+ this._result.push(date);
449
+ return true;
450
+ };
451
+ /**
452
+ * 'before' and 'after' return only one date, whereas 'all'
453
+ * and 'between' an array.
454
+ * @return {Date,Array?}
455
+ */
456
+ IterResult.prototype.getValue = function () {
457
+ var res = this._result;
458
+ switch (this.method) {
459
+ case 'all':
460
+ case 'between':
461
+ return res;
462
+ case 'before':
463
+ case 'after':
464
+ default:
465
+ return (res.length ? res[res.length - 1] : null);
466
+ }
467
+ };
468
+ IterResult.prototype.clone = function () {
469
+ return new IterResult(this.method, this.args);
470
+ };
471
+ return IterResult;
472
+ }());
473
+ /* harmony default export */ var iterresult = (IterResult);
474
+
475
+ // CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.js
476
+ /*! *****************************************************************************
477
+ Copyright (c) Microsoft Corporation. All rights reserved.
478
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
479
+ this file except in compliance with the License. You may obtain a copy of the
480
+ License at http://www.apache.org/licenses/LICENSE-2.0
481
+
482
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
483
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
484
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
485
+ MERCHANTABLITY OR NON-INFRINGEMENT.
486
+
487
+ See the Apache Version 2.0 License for specific language governing permissions
488
+ and limitations under the License.
489
+ ***************************************************************************** */
490
+ /* global Reflect, Promise */
491
+
492
+ var extendStatics = function(d, b) {
493
+ extendStatics = Object.setPrototypeOf ||
494
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
495
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
496
+ return extendStatics(d, b);
497
+ };
498
+
499
+ function __extends(d, b) {
500
+ extendStatics(d, b);
501
+ function __() { this.constructor = d; }
502
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
503
+ }
504
+
505
+ var __assign = function() {
506
+ __assign = Object.assign || function __assign(t) {
507
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
508
+ s = arguments[i];
509
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
510
+ }
511
+ return t;
512
+ }
513
+ return __assign.apply(this, arguments);
514
+ }
515
+
516
+ function __rest(s, e) {
517
+ var t = {};
518
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
519
+ t[p] = s[p];
520
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
521
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
522
+ t[p[i]] = s[p[i]];
523
+ return t;
524
+ }
525
+
526
+ function __decorate(decorators, target, key, desc) {
527
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
528
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
529
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
530
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
531
+ }
532
+
533
+ function __param(paramIndex, decorator) {
534
+ return function (target, key) { decorator(target, key, paramIndex); }
535
+ }
536
+
537
+ function __metadata(metadataKey, metadataValue) {
538
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
539
+ }
540
+
541
+ function __awaiter(thisArg, _arguments, P, generator) {
542
+ return new (P || (P = Promise))(function (resolve, reject) {
543
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
544
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
545
+ function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
546
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
547
+ });
548
+ }
549
+
550
+ function __generator(thisArg, body) {
551
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
552
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
553
+ function verb(n) { return function (v) { return step([n, v]); }; }
554
+ function step(op) {
555
+ if (f) throw new TypeError("Generator is already executing.");
556
+ while (_) try {
557
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
558
+ if (y = 0, t) op = [op[0] & 2, t.value];
559
+ switch (op[0]) {
560
+ case 0: case 1: t = op; break;
561
+ case 4: _.label++; return { value: op[1], done: false };
562
+ case 5: _.label++; y = op[1]; op = [0]; continue;
563
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
564
+ default:
565
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
566
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
567
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
568
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
569
+ if (t[2]) _.ops.pop();
570
+ _.trys.pop(); continue;
571
+ }
572
+ op = body.call(thisArg, _);
573
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
574
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
575
+ }
576
+ }
577
+
578
+ function __exportStar(m, exports) {
579
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
580
+ }
581
+
582
+ function __values(o) {
583
+ var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
584
+ if (m) return m.call(o);
585
+ return {
586
+ next: function () {
587
+ if (o && i >= o.length) o = void 0;
588
+ return { value: o && o[i++], done: !o };
589
+ }
590
+ };
591
+ }
592
+
593
+ function __read(o, n) {
594
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
595
+ if (!m) return o;
596
+ var i = m.call(o), r, ar = [], e;
597
+ try {
598
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
599
+ }
600
+ catch (error) { e = { error: error }; }
601
+ finally {
602
+ try {
603
+ if (r && !r.done && (m = i["return"])) m.call(i);
604
+ }
605
+ finally { if (e) throw e.error; }
606
+ }
607
+ return ar;
608
+ }
609
+
610
+ function __spread() {
611
+ for (var ar = [], i = 0; i < arguments.length; i++)
612
+ ar = ar.concat(__read(arguments[i]));
613
+ return ar;
614
+ }
615
+
616
+ function __await(v) {
617
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
618
+ }
619
+
620
+ function __asyncGenerator(thisArg, _arguments, generator) {
621
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
622
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
623
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
624
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
625
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
626
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
627
+ function fulfill(value) { resume("next", value); }
628
+ function reject(value) { resume("throw", value); }
629
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
630
+ }
631
+
632
+ function __asyncDelegator(o) {
633
+ var i, p;
634
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
635
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
636
+ }
637
+
638
+ function __asyncValues(o) {
639
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
640
+ var m = o[Symbol.asyncIterator], i;
641
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
642
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
643
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
644
+ }
645
+
646
+ function __makeTemplateObject(cooked, raw) {
647
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
648
+ return cooked;
649
+ };
650
+
651
+ function __importStar(mod) {
652
+ if (mod && mod.__esModule) return mod;
653
+ var result = {};
654
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
655
+ result.default = mod;
656
+ return result;
657
+ }
658
+
659
+ function __importDefault(mod) {
660
+ return (mod && mod.__esModule) ? mod : { default: mod };
661
+ }
662
+
663
+ // CONCATENATED MODULE: ./src/callbackiterresult.ts
664
+
665
+
666
+ /**
667
+ * IterResult subclass that calls a callback function on each add,
668
+ * and stops iterating when the callback returns false.
669
+ */
670
+ var callbackiterresult_CallbackIterResult = /** @class */ (function (_super) {
671
+ __extends(CallbackIterResult, _super);
672
+ function CallbackIterResult(method, args, iterator) {
673
+ var _this = _super.call(this, method, args) || this;
674
+ _this.iterator = iterator;
675
+ return _this;
676
+ }
677
+ CallbackIterResult.prototype.add = function (date) {
678
+ if (this.iterator(date, this._result.length)) {
679
+ this._result.push(date);
680
+ return true;
681
+ }
682
+ return false;
683
+ };
684
+ return CallbackIterResult;
685
+ }(iterresult));
686
+ /* harmony default export */ var callbackiterresult = (callbackiterresult_CallbackIterResult);
687
+
688
+ // CONCATENATED MODULE: ./src/types.ts
689
+ var Frequency;
690
+ (function (Frequency) {
691
+ Frequency[Frequency["YEARLY"] = 0] = "YEARLY";
692
+ Frequency[Frequency["MONTHLY"] = 1] = "MONTHLY";
693
+ Frequency[Frequency["WEEKLY"] = 2] = "WEEKLY";
694
+ Frequency[Frequency["DAILY"] = 3] = "DAILY";
695
+ Frequency[Frequency["HOURLY"] = 4] = "HOURLY";
696
+ Frequency[Frequency["MINUTELY"] = 5] = "MINUTELY";
697
+ Frequency[Frequency["SECONDLY"] = 6] = "SECONDLY";
698
+ })(Frequency || (Frequency = {}));
699
+ function freqIsDailyOrGreater(freq) {
700
+ return freq < Frequency.HOURLY;
701
+ }
702
+
703
+ // CONCATENATED MODULE: ./src/weekday.ts
704
+ // =============================================================================
705
+ // Weekday
706
+ // =============================================================================
707
+ var WDAYS = ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU'];
708
+ var Weekday = /** @class */ (function () {
709
+ function Weekday(weekday, n) {
710
+ if (n === 0)
711
+ throw new Error("Can't create weekday with n == 0");
712
+ this.weekday = weekday;
713
+ this.n = n;
714
+ }
715
+ // __call__ - Cannot call the object directly, do it through
716
+ // e.g. RRule.TH.nth(-1) instead,
717
+ Weekday.prototype.nth = function (n) {
718
+ return this.n === n ? this : new Weekday(this.weekday, n);
719
+ };
720
+ // __eq__
721
+ Weekday.prototype.equals = function (other) {
722
+ return this.weekday === other.weekday && this.n === other.n;
723
+ };
724
+ // __repr__
725
+ Weekday.prototype.toString = function () {
726
+ var s = WDAYS[this.weekday];
727
+ if (this.n)
728
+ s = (this.n > 0 ? '+' : '') + String(this.n) + s;
729
+ return s;
730
+ };
731
+ Weekday.prototype.getJsWeekday = function () {
732
+ return this.weekday === 6 ? 0 : this.weekday + 1;
733
+ };
734
+ return Weekday;
735
+ }());
736
+
737
+
738
+ // CONCATENATED MODULE: ./src/datetime.ts
739
+
740
+
741
+
742
+
743
+ var Time = /** @class */ (function () {
744
+ function Time(hour, minute, second, millisecond) {
745
+ this.hour = hour;
746
+ this.minute = minute;
747
+ this.second = second;
748
+ this.millisecond = millisecond || 0;
749
+ }
750
+ Time.prototype.getHours = function () {
751
+ return this.hour;
752
+ };
753
+ Time.prototype.getMinutes = function () {
754
+ return this.minute;
755
+ };
756
+ Time.prototype.getSeconds = function () {
757
+ return this.second;
758
+ };
759
+ Time.prototype.getMilliseconds = function () {
760
+ return this.millisecond;
761
+ };
762
+ Time.prototype.getTime = function () {
763
+ return ((this.hour * 60 * 60 + this.minute * 60 + this.second) * 1000 +
764
+ this.millisecond);
765
+ };
766
+ return Time;
767
+ }());
768
+
769
+ var datetime_DateTime = /** @class */ (function (_super) {
770
+ __extends(DateTime, _super);
771
+ function DateTime(year, month, day, hour, minute, second, millisecond) {
772
+ var _this = _super.call(this, hour, minute, second, millisecond) || this;
773
+ _this.year = year;
774
+ _this.month = month;
775
+ _this.day = day;
776
+ return _this;
777
+ }
778
+ DateTime.fromDate = function (date) {
779
+ return new this(date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.valueOf() % 1000);
780
+ };
781
+ DateTime.prototype.getWeekday = function () {
782
+ return dateutil_dateutil.getWeekday(new Date(this.getTime()));
783
+ };
784
+ DateTime.prototype.getTime = function () {
785
+ return new Date(Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second, this.millisecond)).getTime();
786
+ };
787
+ DateTime.prototype.getDay = function () {
788
+ return this.day;
789
+ };
790
+ DateTime.prototype.getMonth = function () {
791
+ return this.month;
792
+ };
793
+ DateTime.prototype.getYear = function () {
794
+ return this.year;
795
+ };
796
+ DateTime.prototype.addYears = function (years) {
797
+ this.year += years;
798
+ };
799
+ DateTime.prototype.addMonths = function (months) {
800
+ this.month += months;
801
+ if (this.month > 12) {
802
+ var yearDiv = Math.floor(this.month / 12);
803
+ var monthMod = Object(helpers["i" /* pymod */])(this.month, 12);
804
+ this.month = monthMod;
805
+ this.year += yearDiv;
806
+ if (this.month === 0) {
807
+ this.month = 12;
808
+ --this.year;
809
+ }
810
+ }
811
+ };
812
+ DateTime.prototype.addWeekly = function (days, wkst) {
813
+ if (wkst > this.getWeekday()) {
814
+ this.day += -(this.getWeekday() + 1 + (6 - wkst)) + days * 7;
815
+ }
816
+ else {
817
+ this.day += -(this.getWeekday() - wkst) + days * 7;
818
+ }
819
+ this.fixDay();
820
+ };
821
+ DateTime.prototype.addDaily = function (days) {
822
+ this.day += days;
823
+ this.fixDay();
824
+ };
825
+ DateTime.prototype.addHours = function (hours, filtered, byhour) {
826
+ if (filtered) {
827
+ // Jump to one iteration before next day
828
+ this.hour += Math.floor((23 - this.hour) / hours) * hours;
829
+ }
830
+ while (true) {
831
+ this.hour += hours;
832
+ var _a = Object(helpers["a" /* divmod */])(this.hour, 24), dayDiv = _a.div, hourMod = _a.mod;
833
+ if (dayDiv) {
834
+ this.hour = hourMod;
835
+ this.addDaily(dayDiv);
836
+ }
837
+ if (Object(helpers["b" /* empty */])(byhour) || Object(helpers["c" /* includes */])(byhour, this.hour))
838
+ break;
839
+ }
840
+ };
841
+ DateTime.prototype.addMinutes = function (minutes, filtered, byhour, byminute) {
842
+ if (filtered) {
843
+ // Jump to one iteration before next day
844
+ this.minute +=
845
+ Math.floor((1439 - (this.hour * 60 + this.minute)) / minutes) * minutes;
846
+ }
847
+ while (true) {
848
+ this.minute += minutes;
849
+ var _a = Object(helpers["a" /* divmod */])(this.minute, 60), hourDiv = _a.div, minuteMod = _a.mod;
850
+ if (hourDiv) {
851
+ this.minute = minuteMod;
852
+ this.addHours(hourDiv, false, byhour);
853
+ }
854
+ if ((Object(helpers["b" /* empty */])(byhour) || Object(helpers["c" /* includes */])(byhour, this.hour)) &&
855
+ (Object(helpers["b" /* empty */])(byminute) || Object(helpers["c" /* includes */])(byminute, this.minute))) {
856
+ break;
857
+ }
858
+ }
859
+ };
860
+ DateTime.prototype.addSeconds = function (seconds, filtered, byhour, byminute, bysecond) {
861
+ if (filtered) {
862
+ // Jump to one iteration before next day
863
+ this.second +=
864
+ Math.floor((86399 - (this.hour * 3600 + this.minute * 60 + this.second)) / seconds) * seconds;
865
+ }
866
+ while (true) {
867
+ this.second += seconds;
868
+ var _a = Object(helpers["a" /* divmod */])(this.second, 60), minuteDiv = _a.div, secondMod = _a.mod;
869
+ if (minuteDiv) {
870
+ this.second = secondMod;
871
+ this.addMinutes(minuteDiv, false, byhour, byminute);
872
+ }
873
+ if ((Object(helpers["b" /* empty */])(byhour) || Object(helpers["c" /* includes */])(byhour, this.hour)) &&
874
+ (Object(helpers["b" /* empty */])(byminute) || Object(helpers["c" /* includes */])(byminute, this.minute)) &&
875
+ (Object(helpers["b" /* empty */])(bysecond) || Object(helpers["c" /* includes */])(bysecond, this.second))) {
876
+ break;
877
+ }
878
+ }
879
+ };
880
+ DateTime.prototype.fixDay = function () {
881
+ if (this.day <= 28) {
882
+ return;
883
+ }
884
+ var daysinmonth = dateutil_dateutil.monthRange(this.year, this.month - 1)[1];
885
+ if (this.day <= daysinmonth) {
886
+ return;
887
+ }
888
+ while (this.day > daysinmonth) {
889
+ this.day -= daysinmonth;
890
+ ++this.month;
891
+ if (this.month === 13) {
892
+ this.month = 1;
893
+ ++this.year;
894
+ if (this.year > dateutil_dateutil.MAXYEAR) {
895
+ return;
896
+ }
897
+ }
898
+ daysinmonth = dateutil_dateutil.monthRange(this.year, this.month - 1)[1];
899
+ }
900
+ };
901
+ DateTime.prototype.add = function (options, filtered) {
902
+ var freq = options.freq, interval = options.interval, wkst = options.wkst, byhour = options.byhour, byminute = options.byminute, bysecond = options.bysecond;
903
+ switch (freq) {
904
+ case Frequency.YEARLY: return this.addYears(interval);
905
+ case Frequency.MONTHLY: return this.addMonths(interval);
906
+ case Frequency.WEEKLY: return this.addWeekly(interval, wkst);
907
+ case Frequency.DAILY: return this.addDaily(interval);
908
+ case Frequency.HOURLY: return this.addHours(interval, filtered, byhour);
909
+ case Frequency.MINUTELY: return this.addMinutes(interval, filtered, byhour, byminute);
910
+ case Frequency.SECONDLY: return this.addSeconds(interval, filtered, byhour, byminute, bysecond);
911
+ }
912
+ };
913
+ return DateTime;
914
+ }(Time));
915
+
916
+
917
+ // CONCATENATED MODULE: ./src/parseoptions.ts
918
+
919
+
920
+
921
+
922
+
923
+
924
+ function initializeOptions(options) {
925
+ var invalid = [];
926
+ var keys = Object.keys(options);
927
+ var initializedOptions = {};
928
+ // Shallow copy for options and origOptions and check for invalid
929
+ keys.forEach(function (key) {
930
+ var value = options[key];
931
+ initializedOptions[key] = value;
932
+ if (!Object(helpers["c" /* includes */])(rrule_defaultKeys, key))
933
+ invalid.push(key);
934
+ if (src_dateutil.isDate(value) && !src_dateutil.isValidDate(value))
935
+ invalid.push(key);
936
+ });
937
+ if (invalid.length) {
938
+ throw new Error('Invalid options: ' + invalid.join(', '));
939
+ }
940
+ return initializedOptions;
941
+ }
942
+ function parseOptions(options) {
943
+ var opts = initializeOptions(options);
944
+ var keys = Object.keys(options);
945
+ // Merge in default options
946
+ rrule_defaultKeys.forEach(function (key) {
947
+ if (!Object(helpers["c" /* includes */])(keys, key) || !Object(helpers["f" /* isPresent */])(opts[key]))
948
+ opts[key] = DEFAULT_OPTIONS[key];
949
+ });
950
+ if (Object(helpers["f" /* isPresent */])(opts.byeaster))
951
+ opts.freq = src_rrule.YEARLY;
952
+ if (!(Object(helpers["f" /* isPresent */])(opts.freq) && src_rrule.FREQUENCIES[opts.freq])) {
953
+ throw new Error("Invalid frequency: " + opts.freq + " " + options.freq);
954
+ }
955
+ if (!opts.dtstart)
956
+ opts.dtstart = new Date(new Date().setMilliseconds(0));
957
+ if (!Object(helpers["f" /* isPresent */])(opts.wkst)) {
958
+ opts.wkst = src_rrule.MO.weekday;
959
+ }
960
+ else if (Object(helpers["e" /* isNumber */])(opts.wkst)) {
961
+ // cool, just keep it like that
962
+ }
963
+ else {
964
+ opts.wkst = opts.wkst.weekday;
965
+ }
966
+ if (Object(helpers["f" /* isPresent */])(opts.bysetpos)) {
967
+ if (Object(helpers["e" /* isNumber */])(opts.bysetpos))
968
+ opts.bysetpos = [opts.bysetpos];
969
+ for (var i = 0; i < opts.bysetpos.length; i++) {
970
+ var v = opts.bysetpos[i];
971
+ if (v === 0 || !(v >= -366 && v <= 366)) {
972
+ throw new Error('bysetpos must be between 1 and 366,' + ' or between -366 and -1');
973
+ }
974
+ }
975
+ }
976
+ if (!(Boolean(opts.byweekno) ||
977
+ Object(helpers["g" /* notEmpty */])(opts.byweekno) ||
978
+ Object(helpers["g" /* notEmpty */])(opts.byyearday) ||
979
+ Boolean(opts.bymonthday) ||
980
+ Object(helpers["g" /* notEmpty */])(opts.bymonthday) ||
981
+ Object(helpers["f" /* isPresent */])(opts.byweekday) ||
982
+ Object(helpers["f" /* isPresent */])(opts.byeaster))) {
983
+ switch (opts.freq) {
984
+ case src_rrule.YEARLY:
985
+ if (!opts.bymonth)
986
+ opts.bymonth = opts.dtstart.getUTCMonth() + 1;
987
+ opts.bymonthday = opts.dtstart.getUTCDate();
988
+ break;
989
+ case src_rrule.MONTHLY:
990
+ opts.bymonthday = opts.dtstart.getUTCDate();
991
+ break;
992
+ case src_rrule.WEEKLY:
993
+ opts.byweekday = [src_dateutil.getWeekday(opts.dtstart)];
994
+ break;
995
+ }
996
+ }
997
+ // bymonth
998
+ if (Object(helpers["f" /* isPresent */])(opts.bymonth) && !Object(helpers["d" /* isArray */])(opts.bymonth)) {
999
+ opts.bymonth = [opts.bymonth];
1000
+ }
1001
+ // byyearday
1002
+ if (Object(helpers["f" /* isPresent */])(opts.byyearday) &&
1003
+ !Object(helpers["d" /* isArray */])(opts.byyearday) &&
1004
+ Object(helpers["e" /* isNumber */])(opts.byyearday)) {
1005
+ opts.byyearday = [opts.byyearday];
1006
+ }
1007
+ // bymonthday
1008
+ if (!Object(helpers["f" /* isPresent */])(opts.bymonthday)) {
1009
+ opts.bymonthday = [];
1010
+ opts.bynmonthday = [];
1011
+ }
1012
+ else if (Object(helpers["d" /* isArray */])(opts.bymonthday)) {
1013
+ var bymonthday = [];
1014
+ var bynmonthday = [];
1015
+ for (var i = 0; i < opts.bymonthday.length; i++) {
1016
+ var v = opts.bymonthday[i];
1017
+ if (v > 0) {
1018
+ bymonthday.push(v);
1019
+ }
1020
+ else if (v < 0) {
1021
+ bynmonthday.push(v);
1022
+ }
1023
+ }
1024
+ opts.bymonthday = bymonthday;
1025
+ opts.bynmonthday = bynmonthday;
1026
+ }
1027
+ else if (opts.bymonthday < 0) {
1028
+ opts.bynmonthday = [opts.bymonthday];
1029
+ opts.bymonthday = [];
1030
+ }
1031
+ else {
1032
+ opts.bynmonthday = [];
1033
+ opts.bymonthday = [opts.bymonthday];
1034
+ }
1035
+ // byweekno
1036
+ if (Object(helpers["f" /* isPresent */])(opts.byweekno) && !Object(helpers["d" /* isArray */])(opts.byweekno)) {
1037
+ opts.byweekno = [opts.byweekno];
1038
+ }
1039
+ // byweekday / bynweekday
1040
+ if (!Object(helpers["f" /* isPresent */])(opts.byweekday)) {
1041
+ opts.bynweekday = null;
1042
+ }
1043
+ else if (Object(helpers["e" /* isNumber */])(opts.byweekday)) {
1044
+ opts.byweekday = [opts.byweekday];
1045
+ opts.bynweekday = null;
1046
+ }
1047
+ else if (opts.byweekday instanceof Weekday) {
1048
+ if (!opts.byweekday.n || opts.freq > src_rrule.MONTHLY) {
1049
+ opts.byweekday = [opts.byweekday.weekday];
1050
+ opts.bynweekday = null;
1051
+ }
1052
+ else {
1053
+ opts.bynweekday = [[opts.byweekday.weekday, opts.byweekday.n]];
1054
+ opts.byweekday = null;
1055
+ }
1056
+ }
1057
+ else {
1058
+ var byweekday = [];
1059
+ var bynweekday = [];
1060
+ for (var i = 0; i < opts.byweekday.length; i++) {
1061
+ var wday = opts.byweekday[i];
1062
+ if (Object(helpers["e" /* isNumber */])(wday)) {
1063
+ byweekday.push(wday);
1064
+ continue;
1065
+ }
1066
+ var wd = wday;
1067
+ if (!wd.n || opts.freq > src_rrule.MONTHLY) {
1068
+ byweekday.push(wd.weekday);
1069
+ }
1070
+ else {
1071
+ bynweekday.push([wd.weekday, wd.n]);
1072
+ }
1073
+ }
1074
+ opts.byweekday = Object(helpers["g" /* notEmpty */])(byweekday) ? byweekday : null;
1075
+ opts.bynweekday = Object(helpers["g" /* notEmpty */])(bynweekday) ? bynweekday : null;
1076
+ }
1077
+ // byhour
1078
+ if (!Object(helpers["f" /* isPresent */])(opts.byhour)) {
1079
+ opts.byhour =
1080
+ opts.freq < src_rrule.HOURLY ? [opts.dtstart.getUTCHours()] : null;
1081
+ }
1082
+ else if (Object(helpers["e" /* isNumber */])(opts.byhour)) {
1083
+ opts.byhour = [opts.byhour];
1084
+ }
1085
+ // byminute
1086
+ if (!Object(helpers["f" /* isPresent */])(opts.byminute)) {
1087
+ opts.byminute =
1088
+ opts.freq < src_rrule.MINUTELY ? [opts.dtstart.getUTCMinutes()] : null;
1089
+ }
1090
+ else if (Object(helpers["e" /* isNumber */])(opts.byminute)) {
1091
+ opts.byminute = [opts.byminute];
1092
+ }
1093
+ // bysecond
1094
+ if (!Object(helpers["f" /* isPresent */])(opts.bysecond)) {
1095
+ opts.bysecond =
1096
+ opts.freq < src_rrule.SECONDLY ? [opts.dtstart.getUTCSeconds()] : null;
1097
+ }
1098
+ else if (Object(helpers["e" /* isNumber */])(opts.bysecond)) {
1099
+ opts.bysecond = [opts.bysecond];
1100
+ }
1101
+ return { parsedOptions: opts };
1102
+ }
1103
+ function buildTimeset(opts) {
1104
+ var millisecondModulo = opts.dtstart.getTime() % 1000;
1105
+ if (!freqIsDailyOrGreater(opts.freq)) {
1106
+ return [];
1107
+ }
1108
+ var timeset = [];
1109
+ opts.byhour.forEach(function (hour) {
1110
+ opts.byminute.forEach(function (minute) {
1111
+ opts.bysecond.forEach(function (second) {
1112
+ timeset.push(new Time(hour, minute, second, millisecondModulo));
1113
+ });
1114
+ });
1115
+ });
1116
+ return timeset;
1117
+ }
1118
+
1119
+ // CONCATENATED MODULE: ./src/parsestring.ts
1120
+
1121
+
1122
+
1123
+
1124
+
1125
+ function parseString(rfcString) {
1126
+ var options = rfcString.split('\n').map(parseLine).filter(function (x) { return x !== null; });
1127
+ return __assign({}, options[0], options[1]);
1128
+ }
1129
+ function parseDtstart(line) {
1130
+ var options = {};
1131
+ var dtstartWithZone = /DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(line);
1132
+ if (!dtstartWithZone) {
1133
+ return options;
1134
+ }
1135
+ var _ = dtstartWithZone[0], tzid = dtstartWithZone[1], dtstart = dtstartWithZone[2];
1136
+ if (tzid) {
1137
+ options.tzid = tzid;
1138
+ }
1139
+ options.dtstart = src_dateutil.untilStringToDate(dtstart);
1140
+ return options;
1141
+ }
1142
+ function parseLine(rfcString) {
1143
+ rfcString = rfcString.replace(/^\s+|\s+$/, '');
1144
+ if (!rfcString.length)
1145
+ return null;
1146
+ var header = /^([A-Z]+?)[:;]/.exec(rfcString.toUpperCase());
1147
+ if (!header) {
1148
+ return parseRrule(rfcString);
1149
+ }
1150
+ var _ = header[0], key = header[1];
1151
+ switch (key.toUpperCase()) {
1152
+ case 'RRULE':
1153
+ case 'EXRULE':
1154
+ return parseRrule(rfcString);
1155
+ case 'DTSTART':
1156
+ return parseDtstart(rfcString);
1157
+ default:
1158
+ throw new Error("Unsupported RFC prop " + key + " in " + rfcString);
1159
+ }
1160
+ }
1161
+ function parseRrule(line) {
1162
+ var strippedLine = line.replace(/^RRULE:/i, '');
1163
+ var options = parseDtstart(strippedLine);
1164
+ var attrs = line.replace(/^(?:RRULE|EXRULE):/i, '').split(';');
1165
+ attrs.forEach(function (attr) {
1166
+ var _a = attr.split('='), key = _a[0], value = _a[1];
1167
+ switch (key.toUpperCase()) {
1168
+ case 'FREQ':
1169
+ options.freq = Frequency[value.toUpperCase()];
1170
+ break;
1171
+ case 'WKST':
1172
+ options.wkst = Days[value.toUpperCase()];
1173
+ break;
1174
+ case 'COUNT':
1175
+ case 'INTERVAL':
1176
+ case 'BYSETPOS':
1177
+ case 'BYMONTH':
1178
+ case 'BYMONTHDAY':
1179
+ case 'BYYEARDAY':
1180
+ case 'BYWEEKNO':
1181
+ case 'BYHOUR':
1182
+ case 'BYMINUTE':
1183
+ case 'BYSECOND':
1184
+ var num = parseNumber(value);
1185
+ var optionKey = key.toLowerCase();
1186
+ // @ts-ignore
1187
+ options[optionKey] = num;
1188
+ break;
1189
+ case 'BYWEEKDAY':
1190
+ case 'BYDAY':
1191
+ options.byweekday = parseWeekday(value);
1192
+ break;
1193
+ case 'DTSTART':
1194
+ case 'TZID':
1195
+ // for backwards compatibility
1196
+ var dtstart = parseDtstart(line);
1197
+ options.tzid = dtstart.tzid;
1198
+ options.dtstart = dtstart.dtstart;
1199
+ break;
1200
+ case 'UNTIL':
1201
+ options.until = src_dateutil.untilStringToDate(value);
1202
+ break;
1203
+ case 'BYEASTER':
1204
+ options.byeaster = Number(value);
1205
+ break;
1206
+ default:
1207
+ throw new Error("Unknown RRULE property '" + key + "'");
1208
+ }
1209
+ });
1210
+ return options;
1211
+ }
1212
+ function parseNumber(value) {
1213
+ if (value.indexOf(',') !== -1) {
1214
+ var values = value.split(',');
1215
+ return values.map(parseIndividualNumber);
1216
+ }
1217
+ return parseIndividualNumber(value);
1218
+ }
1219
+ function parseIndividualNumber(value) {
1220
+ if (/^[+-]?\d+$/.test(value)) {
1221
+ return Number(value);
1222
+ }
1223
+ return value;
1224
+ }
1225
+ function parseWeekday(value) {
1226
+ var days = value.split(',');
1227
+ return days.map(function (day) {
1228
+ if (day.length === 2) {
1229
+ // MO, TU, ...
1230
+ return Days[day]; // wday instanceof Weekday
1231
+ }
1232
+ // -1MO, +3FR, 1SO, 13TU ...
1233
+ var parts = day.match(/^([+-]?\d{1,2})([A-Z]{2})$/);
1234
+ var n = Number(parts[1]);
1235
+ var wdaypart = parts[2];
1236
+ var wday = Days[wdaypart].weekday;
1237
+ return new Weekday(wday, n);
1238
+ });
1239
+ }
1240
+
1241
+ // EXTERNAL MODULE: external "luxon"
1242
+ var external_luxon_ = __webpack_require__(2);
1243
+
1244
+ // CONCATENATED MODULE: ./src/datewithzone.ts
1245
+
1246
+
1247
+ var datewithzone_DateWithZone = /** @class */ (function () {
1248
+ function DateWithZone(date, tzid) {
1249
+ this.date = date;
1250
+ this.tzid = tzid;
1251
+ }
1252
+ Object.defineProperty(DateWithZone.prototype, "isUTC", {
1253
+ get: function () {
1254
+ return !this.tzid || this.tzid.toUpperCase() === 'UTC';
1255
+ },
1256
+ enumerable: true,
1257
+ configurable: true
1258
+ });
1259
+ DateWithZone.prototype.toString = function () {
1260
+ var datestr = src_dateutil.timeToUntilString(this.date.getTime(), this.isUTC);
1261
+ if (!this.isUTC) {
1262
+ return ";TZID=" + this.tzid + ":" + datestr;
1263
+ }
1264
+ return ":" + datestr;
1265
+ };
1266
+ DateWithZone.prototype.getTime = function () {
1267
+ return this.date.getTime();
1268
+ };
1269
+ DateWithZone.prototype.rezonedDate = function () {
1270
+ if (this.isUTC) {
1271
+ return this.date;
1272
+ }
1273
+ try {
1274
+ var datetime = external_luxon_["DateTime"]
1275
+ .fromJSDate(this.date);
1276
+ var rezoned = datetime.setZone(this.tzid, { keepLocalTime: true });
1277
+ return rezoned.toJSDate();
1278
+ }
1279
+ catch (e) {
1280
+ if (e instanceof TypeError) {
1281
+ console.error('Using TZID without Luxon available is unsupported. Returned times are in UTC, not the requested time zone');
1282
+ }
1283
+ return this.date;
1284
+ }
1285
+ };
1286
+ return DateWithZone;
1287
+ }());
1288
+
1289
+
1290
+ // CONCATENATED MODULE: ./src/optionstostring.ts
1291
+
1292
+
1293
+
1294
+
1295
+
1296
+ function optionsToString(options) {
1297
+ var rrule = [];
1298
+ var dtstart = '';
1299
+ var keys = Object.keys(options);
1300
+ var defaultKeys = Object.keys(DEFAULT_OPTIONS);
1301
+ for (var i = 0; i < keys.length; i++) {
1302
+ if (keys[i] === 'tzid')
1303
+ continue;
1304
+ if (!Object(helpers["c" /* includes */])(defaultKeys, keys[i]))
1305
+ continue;
1306
+ var key = keys[i].toUpperCase();
1307
+ var value = options[keys[i]];
1308
+ var outValue = '';
1309
+ if (!Object(helpers["f" /* isPresent */])(value) || (Object(helpers["d" /* isArray */])(value) && !value.length))
1310
+ continue;
1311
+ switch (key) {
1312
+ case 'FREQ':
1313
+ outValue = src_rrule.FREQUENCIES[options.freq];
1314
+ break;
1315
+ case 'WKST':
1316
+ if (Object(helpers["e" /* isNumber */])(value)) {
1317
+ outValue = new Weekday(value).toString();
1318
+ }
1319
+ else {
1320
+ outValue = value.toString();
1321
+ }
1322
+ break;
1323
+ case 'BYWEEKDAY':
1324
+ /*
1325
+ NOTE: BYWEEKDAY is a special case.
1326
+ RRule() deconstructs the rule.options.byweekday array
1327
+ into an array of Weekday arguments.
1328
+ On the other hand, rule.origOptions is an array of Weekdays.
1329
+ We need to handle both cases here.
1330
+ It might be worth change RRule to keep the Weekdays.
1331
+
1332
+ Also, BYWEEKDAY (used by RRule) vs. BYDAY (RFC)
1333
+
1334
+ */
1335
+ key = 'BYDAY';
1336
+ outValue = Object(helpers["m" /* toArray */])(value).map(function (wday) {
1337
+ if (wday instanceof Weekday) {
1338
+ return wday;
1339
+ }
1340
+ if (Object(helpers["d" /* isArray */])(wday)) {
1341
+ return new Weekday(wday[0], wday[1]);
1342
+ }
1343
+ return new Weekday(wday);
1344
+ }).toString();
1345
+ break;
1346
+ case 'DTSTART':
1347
+ dtstart = buildDtstart(value, options.tzid);
1348
+ break;
1349
+ case 'UNTIL':
1350
+ outValue = src_dateutil.timeToUntilString(value, !options.tzid);
1351
+ break;
1352
+ default:
1353
+ if (Object(helpers["d" /* isArray */])(value)) {
1354
+ var strValues = [];
1355
+ for (var j = 0; j < value.length; j++) {
1356
+ strValues[j] = String(value[j]);
1357
+ }
1358
+ outValue = strValues.toString();
1359
+ }
1360
+ else {
1361
+ outValue = String(value);
1362
+ }
1363
+ }
1364
+ if (outValue) {
1365
+ rrule.push([key, outValue]);
1366
+ }
1367
+ }
1368
+ var rules = rrule.map(function (_a) {
1369
+ var key = _a[0], value = _a[1];
1370
+ return key + "=" + value.toString();
1371
+ }).join(';');
1372
+ var ruleString = '';
1373
+ if (rules !== '') {
1374
+ ruleString = "RRULE:" + rules;
1375
+ }
1376
+ return [dtstart, ruleString].filter(function (x) { return !!x; }).join('\n');
1377
+ }
1378
+ function buildDtstart(dtstart, tzid) {
1379
+ if (!dtstart) {
1380
+ return '';
1381
+ }
1382
+ return 'DTSTART' + new datewithzone_DateWithZone(new Date(dtstart), tzid).toString();
1383
+ }
1384
+
1385
+ // CONCATENATED MODULE: ./src/cache.ts
1386
+
1387
+
1388
+
1389
+ var cache_Cache = /** @class */ (function () {
1390
+ function Cache() {
1391
+ this.all = false;
1392
+ this.before = [];
1393
+ this.after = [];
1394
+ this.between = [];
1395
+ }
1396
+ /**
1397
+ * @param {String} what - all/before/after/between
1398
+ * @param {Array,Date} value - an array of dates, one date, or null
1399
+ * @param {Object?} args - _iter arguments
1400
+ */
1401
+ Cache.prototype._cacheAdd = function (what, value, args) {
1402
+ if (value) {
1403
+ value =
1404
+ value instanceof Date
1405
+ ? src_dateutil.clone(value)
1406
+ : src_dateutil.cloneDates(value);
1407
+ }
1408
+ if (what === 'all') {
1409
+ this.all = value;
1410
+ }
1411
+ else {
1412
+ args._value = value;
1413
+ this[what].push(args);
1414
+ }
1415
+ };
1416
+ /**
1417
+ * @return false - not in the cache
1418
+ * null - cached, but zero occurrences (before/after)
1419
+ * Date - cached (before/after)
1420
+ * [] - cached, but zero occurrences (all/between)
1421
+ * [Date1, DateN] - cached (all/between)
1422
+ */
1423
+ Cache.prototype._cacheGet = function (what, args) {
1424
+ var cached = false;
1425
+ var argsKeys = args ? Object.keys(args) : [];
1426
+ var findCacheDiff = function (item) {
1427
+ for (var i = 0; i < argsKeys.length; i++) {
1428
+ var key = argsKeys[i];
1429
+ if (String(args[key]) !== String(item[key])) {
1430
+ return true;
1431
+ }
1432
+ }
1433
+ return false;
1434
+ };
1435
+ var cachedObject = this[what];
1436
+ if (what === 'all') {
1437
+ cached = this.all;
1438
+ }
1439
+ else if (Object(helpers["d" /* isArray */])(cachedObject)) {
1440
+ // Let's see whether we've already called the
1441
+ // 'what' method with the same 'args'
1442
+ for (var i = 0; i < cachedObject.length; i++) {
1443
+ var item = cachedObject[i];
1444
+ if (argsKeys.length && findCacheDiff(item))
1445
+ continue;
1446
+ cached = item._value;
1447
+ break;
1448
+ }
1449
+ }
1450
+ if (!cached && this.all) {
1451
+ // Not in the cache, but we already know all the occurrences,
1452
+ // so we can find the correct dates from the cached ones.
1453
+ var iterResult = new iterresult(what, args);
1454
+ for (var i = 0; i < this.all.length; i++) {
1455
+ if (!iterResult.accept(this.all[i]))
1456
+ break;
1457
+ }
1458
+ cached = iterResult.getValue();
1459
+ this._cacheAdd(what, cached, args);
1460
+ }
1461
+ return Object(helpers["d" /* isArray */])(cached)
1462
+ ? src_dateutil.cloneDates(cached)
1463
+ : cached instanceof Date
1464
+ ? src_dateutil.clone(cached)
1465
+ : cached;
1466
+ };
1467
+ return Cache;
1468
+ }());
1469
+
1470
+
1471
+ // CONCATENATED MODULE: ./src/masks.ts
1472
+
1473
+ // =============================================================================
1474
+ // Date masks
1475
+ // =============================================================================
1476
+ // Every mask is 7 days longer to handle cross-year weekly periods.
1477
+ var M365MASK = Object(helpers["k" /* repeat */])(1, 31).concat(Object(helpers["k" /* repeat */])(2, 28), Object(helpers["k" /* repeat */])(3, 31), Object(helpers["k" /* repeat */])(4, 30), Object(helpers["k" /* repeat */])(5, 31), Object(helpers["k" /* repeat */])(6, 30), Object(helpers["k" /* repeat */])(7, 31), Object(helpers["k" /* repeat */])(8, 31), Object(helpers["k" /* repeat */])(9, 30), Object(helpers["k" /* repeat */])(10, 31), Object(helpers["k" /* repeat */])(11, 30), Object(helpers["k" /* repeat */])(12, 31), Object(helpers["k" /* repeat */])(1, 7));
1478
+ var M366MASK = Object(helpers["k" /* repeat */])(1, 31).concat(Object(helpers["k" /* repeat */])(2, 29), Object(helpers["k" /* repeat */])(3, 31), Object(helpers["k" /* repeat */])(4, 30), Object(helpers["k" /* repeat */])(5, 31), Object(helpers["k" /* repeat */])(6, 30), Object(helpers["k" /* repeat */])(7, 31), Object(helpers["k" /* repeat */])(8, 31), Object(helpers["k" /* repeat */])(9, 30), Object(helpers["k" /* repeat */])(10, 31), Object(helpers["k" /* repeat */])(11, 30), Object(helpers["k" /* repeat */])(12, 31), Object(helpers["k" /* repeat */])(1, 7));
1479
+ var M28 = Object(helpers["j" /* range */])(1, 29);
1480
+ var M29 = Object(helpers["j" /* range */])(1, 30);
1481
+ var M30 = Object(helpers["j" /* range */])(1, 31);
1482
+ var M31 = Object(helpers["j" /* range */])(1, 32);
1483
+ var MDAY366MASK = M31.concat(M29, M31, M30, M31, M30, M31, M31, M30, M31, M30, M31, M31.slice(0, 7));
1484
+ var MDAY365MASK = M31.concat(M28, M31, M30, M31, M30, M31, M31, M30, M31, M30, M31, M31.slice(0, 7));
1485
+ var NM28 = Object(helpers["j" /* range */])(-28, 0);
1486
+ var NM29 = Object(helpers["j" /* range */])(-29, 0);
1487
+ var NM30 = Object(helpers["j" /* range */])(-30, 0);
1488
+ var NM31 = Object(helpers["j" /* range */])(-31, 0);
1489
+ var NMDAY366MASK = NM31.concat(NM29, NM31, NM30, NM31, NM30, NM31, NM31, NM30, NM31, NM30, NM31, NM31.slice(0, 7));
1490
+ var NMDAY365MASK = NM31.concat(NM28, NM31, NM30, NM31, NM30, NM31, NM31, NM30, NM31, NM30, NM31, NM31.slice(0, 7));
1491
+ var M366RANGE = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366];
1492
+ var M365RANGE = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365];
1493
+ var WDAYMASK = (function () {
1494
+ var wdaymask = [];
1495
+ for (var i = 0; i < 55; i++)
1496
+ wdaymask = wdaymask.concat(Object(helpers["j" /* range */])(7));
1497
+ return wdaymask;
1498
+ })();
1499
+
1500
+
1501
+ // CONCATENATED MODULE: ./src/iterinfo/yearinfo.ts
1502
+
1503
+
1504
+
1505
+
1506
+ function rebuildYear(year, options) {
1507
+ var firstyday = new Date(Date.UTC(year, 0, 1));
1508
+ var yearlen = src_dateutil.isLeapYear(year) ? 366 : 365;
1509
+ var nextyearlen = src_dateutil.isLeapYear(year + 1) ? 366 : 365;
1510
+ var yearordinal = src_dateutil.toOrdinal(firstyday);
1511
+ var yearweekday = src_dateutil.getWeekday(firstyday);
1512
+ var result = __assign({ yearlen: yearlen,
1513
+ nextyearlen: nextyearlen,
1514
+ yearordinal: yearordinal,
1515
+ yearweekday: yearweekday }, baseYearMasks(year), { wnomask: null });
1516
+ if (Object(helpers["b" /* empty */])(options.byweekno)) {
1517
+ return result;
1518
+ }
1519
+ result.wnomask = Object(helpers["k" /* repeat */])(0, yearlen + 7);
1520
+ var firstwkst;
1521
+ var wyearlen;
1522
+ var no1wkst = firstwkst = Object(helpers["i" /* pymod */])(7 - yearweekday + options.wkst, 7);
1523
+ if (no1wkst >= 4) {
1524
+ no1wkst = 0;
1525
+ // Number of days in the year, plus the days we got
1526
+ // from last year.
1527
+ wyearlen =
1528
+ result.yearlen + Object(helpers["i" /* pymod */])(yearweekday - options.wkst, 7);
1529
+ }
1530
+ else {
1531
+ // Number of days in the year, minus the days we
1532
+ // left in last year.
1533
+ wyearlen = yearlen - no1wkst;
1534
+ }
1535
+ var div = Math.floor(wyearlen / 7);
1536
+ var mod = Object(helpers["i" /* pymod */])(wyearlen, 7);
1537
+ var numweeks = Math.floor(div + mod / 4);
1538
+ for (var j = 0; j < options.byweekno.length; j++) {
1539
+ var n = options.byweekno[j];
1540
+ if (n < 0) {
1541
+ n += numweeks + 1;
1542
+ }
1543
+ if (!(n > 0 && n <= numweeks)) {
1544
+ continue;
1545
+ }
1546
+ var i = void 0;
1547
+ if (n > 1) {
1548
+ i = no1wkst + (n - 1) * 7;
1549
+ if (no1wkst !== firstwkst) {
1550
+ i -= 7 - firstwkst;
1551
+ }
1552
+ }
1553
+ else {
1554
+ i = no1wkst;
1555
+ }
1556
+ for (var k = 0; k < 7; k++) {
1557
+ result.wnomask[i] = 1;
1558
+ i++;
1559
+ if (result.wdaymask[i] === options.wkst)
1560
+ break;
1561
+ }
1562
+ }
1563
+ if (Object(helpers["c" /* includes */])(options.byweekno, 1)) {
1564
+ // Check week number 1 of next year as well
1565
+ // orig-TODO : Check -numweeks for next year.
1566
+ var i = no1wkst + numweeks * 7;
1567
+ if (no1wkst !== firstwkst)
1568
+ i -= 7 - firstwkst;
1569
+ if (i < yearlen) {
1570
+ // If week starts in next year, we
1571
+ // don't care about it.
1572
+ for (var j = 0; j < 7; j++) {
1573
+ result.wnomask[i] = 1;
1574
+ i += 1;
1575
+ if (result.wdaymask[i] === options.wkst)
1576
+ break;
1577
+ }
1578
+ }
1579
+ }
1580
+ if (no1wkst) {
1581
+ // Check last week number of last year as
1582
+ // well. If no1wkst is 0, either the year
1583
+ // started on week start, or week number 1
1584
+ // got days from last year, so there are no
1585
+ // days from last year's last week number in
1586
+ // this year.
1587
+ var lnumweeks = void 0;
1588
+ if (!Object(helpers["c" /* includes */])(options.byweekno, -1)) {
1589
+ var lyearweekday = src_dateutil.getWeekday(new Date(Date.UTC(year - 1, 0, 1)));
1590
+ var lno1wkst = Object(helpers["i" /* pymod */])(7 - lyearweekday.valueOf() + options.wkst, 7);
1591
+ var lyearlen = src_dateutil.isLeapYear(year - 1) ? 366 : 365;
1592
+ var weekst = void 0;
1593
+ if (lno1wkst >= 4) {
1594
+ lno1wkst = 0;
1595
+ weekst = lyearlen + Object(helpers["i" /* pymod */])(lyearweekday - options.wkst, 7);
1596
+ }
1597
+ else {
1598
+ weekst = yearlen - no1wkst;
1599
+ }
1600
+ lnumweeks = Math.floor(52 + Object(helpers["i" /* pymod */])(weekst, 7) / 4);
1601
+ }
1602
+ else {
1603
+ lnumweeks = -1;
1604
+ }
1605
+ if (Object(helpers["c" /* includes */])(options.byweekno, lnumweeks)) {
1606
+ for (var i = 0; i < no1wkst; i++)
1607
+ result.wnomask[i] = 1;
1608
+ }
1609
+ }
1610
+ return result;
1611
+ }
1612
+ function baseYearMasks(year) {
1613
+ var yearlen = src_dateutil.isLeapYear(year) ? 366 : 365;
1614
+ var firstyday = new Date(Date.UTC(year, 0, 1));
1615
+ var wday = src_dateutil.getWeekday(firstyday);
1616
+ if (yearlen === 365) {
1617
+ return {
1618
+ mmask: M365MASK,
1619
+ mdaymask: MDAY365MASK,
1620
+ nmdaymask: NMDAY365MASK,
1621
+ wdaymask: WDAYMASK.slice(wday),
1622
+ mrange: M365RANGE
1623
+ };
1624
+ }
1625
+ return {
1626
+ mmask: M366MASK,
1627
+ mdaymask: MDAY366MASK,
1628
+ nmdaymask: NMDAY366MASK,
1629
+ wdaymask: WDAYMASK.slice(wday),
1630
+ mrange: M366RANGE
1631
+ };
1632
+ }
1633
+
1634
+ // CONCATENATED MODULE: ./src/iterinfo/monthinfo.ts
1635
+
1636
+
1637
+ function rebuildMonth(year, month, yearlen, mrange, wdaymask, options) {
1638
+ var result = {
1639
+ lastyear: year,
1640
+ lastmonth: month,
1641
+ nwdaymask: []
1642
+ };
1643
+ var ranges = [];
1644
+ if (options.freq === src_rrule.YEARLY) {
1645
+ if (Object(helpers["b" /* empty */])(options.bymonth)) {
1646
+ ranges = [[0, yearlen]];
1647
+ }
1648
+ else {
1649
+ for (var j = 0; j < options.bymonth.length; j++) {
1650
+ month = options.bymonth[j];
1651
+ ranges.push(mrange.slice(month - 1, month + 1));
1652
+ }
1653
+ }
1654
+ }
1655
+ else if (options.freq === src_rrule.MONTHLY) {
1656
+ ranges = [mrange.slice(month - 1, month + 1)];
1657
+ }
1658
+ if (Object(helpers["b" /* empty */])(ranges)) {
1659
+ return result;
1660
+ }
1661
+ // Weekly frequency won't get here, so we may not
1662
+ // care about cross-year weekly periods.
1663
+ result.nwdaymask = Object(helpers["k" /* repeat */])(0, yearlen);
1664
+ for (var j = 0; j < ranges.length; j++) {
1665
+ var rang = ranges[j];
1666
+ var first = rang[0];
1667
+ var last = rang[1] - 1;
1668
+ for (var k = 0; k < options.bynweekday.length; k++) {
1669
+ var i = void 0;
1670
+ var _a = options.bynweekday[k], wday = _a[0], n = _a[1];
1671
+ if (n < 0) {
1672
+ i = last + (n + 1) * 7;
1673
+ i -= Object(helpers["i" /* pymod */])(wdaymask[i] - wday, 7);
1674
+ }
1675
+ else {
1676
+ i = first + (n - 1) * 7;
1677
+ i += Object(helpers["i" /* pymod */])(7 - wdaymask[i] + wday, 7);
1678
+ }
1679
+ if (first <= i && i <= last)
1680
+ result.nwdaymask[i] = 1;
1681
+ }
1682
+ }
1683
+ return result;
1684
+ }
1685
+
1686
+ // CONCATENATED MODULE: ./src/iterinfo/easter.ts
1687
+ function easter(y, offset) {
1688
+ if (offset === void 0) { offset = 0; }
1689
+ var a = y % 19;
1690
+ var b = Math.floor(y / 100);
1691
+ var c = y % 100;
1692
+ var d = Math.floor(b / 4);
1693
+ var e = b % 4;
1694
+ var f = Math.floor((b + 8) / 25);
1695
+ var g = Math.floor((b - f + 1) / 3);
1696
+ var h = Math.floor(19 * a + b - d - g + 15) % 30;
1697
+ var i = Math.floor(c / 4);
1698
+ var k = c % 4;
1699
+ var l = Math.floor(32 + 2 * e + 2 * i - h - k) % 7;
1700
+ var m = Math.floor((a + 11 * h + 22 * l) / 451);
1701
+ var month = Math.floor((h + l - 7 * m + 114) / 31);
1702
+ var day = ((h + l - 7 * m + 114) % 31) + 1;
1703
+ var date = Date.UTC(y, month - 1, day + offset);
1704
+ var yearStart = Date.UTC(y, 0, 1);
1705
+ return [Math.ceil((date - yearStart) / (1000 * 60 * 60 * 24))];
1706
+ }
1707
+
1708
+ // CONCATENATED MODULE: ./src/iterinfo/index.ts
1709
+
1710
+
1711
+
1712
+
1713
+
1714
+
1715
+
1716
+ // =============================================================================
1717
+ // Iterinfo
1718
+ // =============================================================================
1719
+ var iterinfo_Iterinfo = /** @class */ (function () {
1720
+ function Iterinfo(options) {
1721
+ this.options = options;
1722
+ }
1723
+ Iterinfo.prototype.rebuild = function (year, month) {
1724
+ var options = this.options;
1725
+ if (year !== this.lastyear) {
1726
+ this.yearinfo = rebuildYear(year, options);
1727
+ }
1728
+ if (Object(helpers["g" /* notEmpty */])(options.bynweekday) &&
1729
+ (month !== this.lastmonth || year !== this.lastyear)) {
1730
+ var _a = this.yearinfo, yearlen = _a.yearlen, mrange = _a.mrange, wdaymask = _a.wdaymask;
1731
+ this.monthinfo = rebuildMonth(year, month, yearlen, mrange, wdaymask, options);
1732
+ }
1733
+ if (Object(helpers["f" /* isPresent */])(options.byeaster)) {
1734
+ this.eastermask = easter(year, options.byeaster);
1735
+ }
1736
+ };
1737
+ Object.defineProperty(Iterinfo.prototype, "lastyear", {
1738
+ get: function () {
1739
+ return this.monthinfo ? this.monthinfo.lastyear : null;
1740
+ },
1741
+ enumerable: true,
1742
+ configurable: true
1743
+ });
1744
+ Object.defineProperty(Iterinfo.prototype, "lastmonth", {
1745
+ get: function () {
1746
+ return this.monthinfo ? this.monthinfo.lastmonth : null;
1747
+ },
1748
+ enumerable: true,
1749
+ configurable: true
1750
+ });
1751
+ Object.defineProperty(Iterinfo.prototype, "yearlen", {
1752
+ get: function () {
1753
+ return this.yearinfo.yearlen;
1754
+ },
1755
+ enumerable: true,
1756
+ configurable: true
1757
+ });
1758
+ Object.defineProperty(Iterinfo.prototype, "yearordinal", {
1759
+ get: function () {
1760
+ return this.yearinfo.yearordinal;
1761
+ },
1762
+ enumerable: true,
1763
+ configurable: true
1764
+ });
1765
+ Object.defineProperty(Iterinfo.prototype, "mrange", {
1766
+ get: function () {
1767
+ return this.yearinfo.mrange;
1768
+ },
1769
+ enumerable: true,
1770
+ configurable: true
1771
+ });
1772
+ Object.defineProperty(Iterinfo.prototype, "wdaymask", {
1773
+ get: function () {
1774
+ return this.yearinfo.wdaymask;
1775
+ },
1776
+ enumerable: true,
1777
+ configurable: true
1778
+ });
1779
+ Object.defineProperty(Iterinfo.prototype, "mmask", {
1780
+ get: function () {
1781
+ return this.yearinfo.mmask;
1782
+ },
1783
+ enumerable: true,
1784
+ configurable: true
1785
+ });
1786
+ Object.defineProperty(Iterinfo.prototype, "wnomask", {
1787
+ get: function () {
1788
+ return this.yearinfo.wnomask;
1789
+ },
1790
+ enumerable: true,
1791
+ configurable: true
1792
+ });
1793
+ Object.defineProperty(Iterinfo.prototype, "nwdaymask", {
1794
+ get: function () {
1795
+ return this.monthinfo ? this.monthinfo.nwdaymask : [];
1796
+ },
1797
+ enumerable: true,
1798
+ configurable: true
1799
+ });
1800
+ Object.defineProperty(Iterinfo.prototype, "nextyearlen", {
1801
+ get: function () {
1802
+ return this.yearinfo.nextyearlen;
1803
+ },
1804
+ enumerable: true,
1805
+ configurable: true
1806
+ });
1807
+ Object.defineProperty(Iterinfo.prototype, "mdaymask", {
1808
+ get: function () {
1809
+ return this.yearinfo.mdaymask;
1810
+ },
1811
+ enumerable: true,
1812
+ configurable: true
1813
+ });
1814
+ Object.defineProperty(Iterinfo.prototype, "nmdaymask", {
1815
+ get: function () {
1816
+ return this.yearinfo.nmdaymask;
1817
+ },
1818
+ enumerable: true,
1819
+ configurable: true
1820
+ });
1821
+ Iterinfo.prototype.ydayset = function () {
1822
+ return [Object(helpers["j" /* range */])(this.yearlen), 0, this.yearlen];
1823
+ };
1824
+ Iterinfo.prototype.mdayset = function (_, month, __) {
1825
+ var start = this.mrange[month - 1];
1826
+ var end = this.mrange[month];
1827
+ var set = Object(helpers["k" /* repeat */])(null, this.yearlen);
1828
+ for (var i = start; i < end; i++)
1829
+ set[i] = i;
1830
+ return [set, start, end];
1831
+ };
1832
+ Iterinfo.prototype.wdayset = function (year, month, day) {
1833
+ // We need to handle cross-year weeks here.
1834
+ var set = Object(helpers["k" /* repeat */])(null, this.yearlen + 7);
1835
+ var i = src_dateutil.toOrdinal(new Date(Date.UTC(year, month - 1, day))) -
1836
+ this.yearordinal;
1837
+ var start = i;
1838
+ for (var j = 0; j < 7; j++) {
1839
+ set[i] = i;
1840
+ ++i;
1841
+ if (this.wdaymask[i] === this.options.wkst)
1842
+ break;
1843
+ }
1844
+ return [set, start, i];
1845
+ };
1846
+ Iterinfo.prototype.ddayset = function (year, month, day) {
1847
+ var set = Object(helpers["k" /* repeat */])(null, this.yearlen);
1848
+ var i = src_dateutil.toOrdinal(new Date(Date.UTC(year, month - 1, day))) -
1849
+ this.yearordinal;
1850
+ set[i] = i;
1851
+ return [set, i, i + 1];
1852
+ };
1853
+ Iterinfo.prototype.htimeset = function (hour, _, second, millisecond) {
1854
+ var _this = this;
1855
+ var set = [];
1856
+ this.options.byminute.forEach(function (minute) {
1857
+ set = set.concat(_this.mtimeset(hour, minute, second, millisecond));
1858
+ });
1859
+ src_dateutil.sort(set);
1860
+ return set;
1861
+ };
1862
+ Iterinfo.prototype.mtimeset = function (hour, minute, _, millisecond) {
1863
+ var set = this.options.bysecond.map(function (second) {
1864
+ return new Time(hour, minute, second, millisecond);
1865
+ });
1866
+ src_dateutil.sort(set);
1867
+ return set;
1868
+ };
1869
+ Iterinfo.prototype.stimeset = function (hour, minute, second, millisecond) {
1870
+ return [new Time(hour, minute, second, millisecond)];
1871
+ };
1872
+ Iterinfo.prototype.getdayset = function (freq) {
1873
+ switch (freq) {
1874
+ case Frequency.YEARLY: return this.ydayset.bind(this);
1875
+ case Frequency.MONTHLY: return this.mdayset.bind(this);
1876
+ case Frequency.WEEKLY: return this.wdayset.bind(this);
1877
+ case Frequency.DAILY: return this.ddayset.bind(this);
1878
+ default: return this.ddayset.bind(this);
1879
+ }
1880
+ };
1881
+ Iterinfo.prototype.gettimeset = function (freq) {
1882
+ switch (freq) {
1883
+ case Frequency.HOURLY: return this.htimeset.bind(this);
1884
+ case Frequency.MINUTELY: return this.mtimeset.bind(this);
1885
+ case Frequency.SECONDLY: return this.stimeset.bind(this);
1886
+ }
1887
+ };
1888
+ return Iterinfo;
1889
+ }());
1890
+ /* harmony default export */ var iterinfo = (iterinfo_Iterinfo);
1891
+
1892
+ // CONCATENATED MODULE: ./src/iter/poslist.ts
1893
+
1894
+
1895
+ function buildPoslist(bysetpos, timeset, start, end, ii, dayset) {
1896
+ var poslist = [];
1897
+ for (var j = 0; j < bysetpos.length; j++) {
1898
+ var daypos = void 0;
1899
+ var timepos = void 0;
1900
+ var pos = bysetpos[j];
1901
+ if (pos < 0) {
1902
+ daypos = Math.floor(pos / timeset.length);
1903
+ timepos = Object(helpers["i" /* pymod */])(pos, timeset.length);
1904
+ }
1905
+ else {
1906
+ daypos = Math.floor((pos - 1) / timeset.length);
1907
+ timepos = Object(helpers["i" /* pymod */])(pos - 1, timeset.length);
1908
+ }
1909
+ var tmp = [];
1910
+ for (var k = start; k < end; k++) {
1911
+ var val = dayset[k];
1912
+ if (!Object(helpers["f" /* isPresent */])(val))
1913
+ continue;
1914
+ tmp.push(val);
1915
+ }
1916
+ var i = void 0;
1917
+ if (daypos < 0) {
1918
+ i = tmp.slice(daypos)[0];
1919
+ }
1920
+ else {
1921
+ i = tmp[daypos];
1922
+ }
1923
+ var time = timeset[timepos];
1924
+ var date = src_dateutil.fromOrdinal(ii.yearordinal + i);
1925
+ var res = src_dateutil.combine(date, time);
1926
+ // XXX: can this ever be in the array?
1927
+ // - compare the actual date instead?
1928
+ if (!Object(helpers["c" /* includes */])(poslist, res))
1929
+ poslist.push(res);
1930
+ }
1931
+ src_dateutil.sort(poslist);
1932
+ return poslist;
1933
+ }
1934
+
1935
+ // CONCATENATED MODULE: ./src/iter/index.ts
1936
+
1937
+
1938
+
1939
+
1940
+
1941
+
1942
+
1943
+
1944
+
1945
+ function iter(iterResult, options) {
1946
+ var dtstart = options.dtstart, freq = options.freq, interval = options.interval, until = options.until, bysetpos = options.bysetpos;
1947
+ var count = options.count;
1948
+ if (count === 0 || interval === 0) {
1949
+ return emitResult(iterResult);
1950
+ }
1951
+ var counterDate = datetime_DateTime.fromDate(dtstart);
1952
+ var ii = new iterinfo(options);
1953
+ ii.rebuild(counterDate.year, counterDate.month);
1954
+ var timeset = makeTimeset(ii, counterDate, options);
1955
+ while (true) {
1956
+ var _a = ii.getdayset(freq)(counterDate.year, counterDate.month, counterDate.day), dayset = _a[0], start = _a[1], end = _a[2];
1957
+ var filtered = removeFilteredDays(dayset, start, end, ii, options);
1958
+ if (Object(helpers["g" /* notEmpty */])(bysetpos)) {
1959
+ var poslist = buildPoslist(bysetpos, timeset, start, end, ii, dayset);
1960
+ for (var j = 0; j < poslist.length; j++) {
1961
+ var res = poslist[j];
1962
+ if (until && res > until) {
1963
+ return emitResult(iterResult);
1964
+ }
1965
+ if (res >= dtstart) {
1966
+ var rezonedDate = rezoneIfNeeded(res, options);
1967
+ if (!iterResult.accept(rezonedDate)) {
1968
+ return emitResult(iterResult);
1969
+ }
1970
+ if (count) {
1971
+ --count;
1972
+ if (!count) {
1973
+ return emitResult(iterResult);
1974
+ }
1975
+ }
1976
+ }
1977
+ }
1978
+ }
1979
+ else {
1980
+ for (var j = start; j < end; j++) {
1981
+ var currentDay = dayset[j];
1982
+ if (!Object(helpers["f" /* isPresent */])(currentDay)) {
1983
+ continue;
1984
+ }
1985
+ var date = src_dateutil.fromOrdinal(ii.yearordinal + currentDay);
1986
+ for (var k = 0; k < timeset.length; k++) {
1987
+ var time = timeset[k];
1988
+ var res = src_dateutil.combine(date, time);
1989
+ if (until && res > until) {
1990
+ return emitResult(iterResult);
1991
+ }
1992
+ if (res >= dtstart) {
1993
+ var rezonedDate = rezoneIfNeeded(res, options);
1994
+ if (!iterResult.accept(rezonedDate)) {
1995
+ return emitResult(iterResult);
1996
+ }
1997
+ if (count) {
1998
+ --count;
1999
+ if (!count) {
2000
+ return emitResult(iterResult);
2001
+ }
2002
+ }
2003
+ }
2004
+ }
2005
+ }
2006
+ }
2007
+ if (options.interval === 0) {
2008
+ return emitResult(iterResult);
2009
+ }
2010
+ // Handle frequency and interval
2011
+ counterDate.add(options, filtered);
2012
+ if (counterDate.year > src_dateutil.MAXYEAR) {
2013
+ return emitResult(iterResult);
2014
+ }
2015
+ if (!freqIsDailyOrGreater(freq)) {
2016
+ timeset = ii.gettimeset(freq)(counterDate.hour, counterDate.minute, counterDate.second, 0);
2017
+ }
2018
+ ii.rebuild(counterDate.year, counterDate.month);
2019
+ }
2020
+ }
2021
+ function isFiltered(ii, currentDay, options) {
2022
+ var bymonth = options.bymonth, byweekno = options.byweekno, byweekday = options.byweekday, byeaster = options.byeaster, bymonthday = options.bymonthday, bynmonthday = options.bynmonthday, byyearday = options.byyearday;
2023
+ return ((Object(helpers["g" /* notEmpty */])(bymonth) && !Object(helpers["c" /* includes */])(bymonth, ii.mmask[currentDay])) ||
2024
+ (Object(helpers["g" /* notEmpty */])(byweekno) && !ii.wnomask[currentDay]) ||
2025
+ (Object(helpers["g" /* notEmpty */])(byweekday) && !Object(helpers["c" /* includes */])(byweekday, ii.wdaymask[currentDay])) ||
2026
+ (Object(helpers["g" /* notEmpty */])(ii.nwdaymask) && !ii.nwdaymask[currentDay]) ||
2027
+ (byeaster !== null && !Object(helpers["c" /* includes */])(ii.eastermask, currentDay)) ||
2028
+ ((Object(helpers["g" /* notEmpty */])(bymonthday) || Object(helpers["g" /* notEmpty */])(bynmonthday)) &&
2029
+ !Object(helpers["c" /* includes */])(bymonthday, ii.mdaymask[currentDay]) &&
2030
+ !Object(helpers["c" /* includes */])(bynmonthday, ii.nmdaymask[currentDay])) ||
2031
+ (Object(helpers["g" /* notEmpty */])(byyearday) &&
2032
+ ((currentDay < ii.yearlen &&
2033
+ !Object(helpers["c" /* includes */])(byyearday, currentDay + 1) &&
2034
+ !Object(helpers["c" /* includes */])(byyearday, -ii.yearlen + currentDay)) ||
2035
+ (currentDay >= ii.yearlen &&
2036
+ !Object(helpers["c" /* includes */])(byyearday, currentDay + 1 - ii.yearlen) &&
2037
+ !Object(helpers["c" /* includes */])(byyearday, -ii.nextyearlen + currentDay - ii.yearlen)))));
2038
+ }
2039
+ function rezoneIfNeeded(date, options) {
2040
+ return new datewithzone_DateWithZone(date, options.tzid).rezonedDate();
2041
+ }
2042
+ function emitResult(iterResult) {
2043
+ return iterResult.getValue();
2044
+ }
2045
+ function removeFilteredDays(dayset, start, end, ii, options) {
2046
+ var filtered = false;
2047
+ for (var dayCounter = start; dayCounter < end; dayCounter++) {
2048
+ var currentDay = dayset[dayCounter];
2049
+ filtered = isFiltered(ii, currentDay, options);
2050
+ if (filtered)
2051
+ dayset[currentDay] = null;
2052
+ }
2053
+ return filtered;
2054
+ }
2055
+ function makeTimeset(ii, counterDate, options) {
2056
+ var freq = options.freq, byhour = options.byhour, byminute = options.byminute, bysecond = options.bysecond;
2057
+ if (freqIsDailyOrGreater(freq)) {
2058
+ return buildTimeset(options);
2059
+ }
2060
+ if ((freq >= src_rrule.HOURLY &&
2061
+ Object(helpers["g" /* notEmpty */])(byhour) &&
2062
+ !Object(helpers["c" /* includes */])(byhour, counterDate.hour)) ||
2063
+ (freq >= src_rrule.MINUTELY &&
2064
+ Object(helpers["g" /* notEmpty */])(byminute) &&
2065
+ !Object(helpers["c" /* includes */])(byminute, counterDate.minute)) ||
2066
+ (freq >= src_rrule.SECONDLY &&
2067
+ Object(helpers["g" /* notEmpty */])(bysecond) &&
2068
+ !Object(helpers["c" /* includes */])(bysecond, counterDate.second))) {
2069
+ return [];
2070
+ }
2071
+ return ii.gettimeset(freq)(counterDate.hour, counterDate.minute, counterDate.second, counterDate.millisecond);
2072
+ }
2073
+
2074
+ // CONCATENATED MODULE: ./src/rrule.ts
2075
+
2076
+
2077
+
2078
+
2079
+
2080
+
2081
+
2082
+
2083
+
2084
+
2085
+ var getnlp = function () {
2086
+ // Lazy, runtime import to avoid circular refs.
2087
+ if (!getnlp._nlp) {
2088
+ getnlp._nlp = __webpack_require__(3);
2089
+ }
2090
+ return getnlp._nlp;
2091
+ };
2092
+ // =============================================================================
2093
+ // RRule
2094
+ // =============================================================================
2095
+ var Days = {
2096
+ MO: new Weekday(0),
2097
+ TU: new Weekday(1),
2098
+ WE: new Weekday(2),
2099
+ TH: new Weekday(3),
2100
+ FR: new Weekday(4),
2101
+ SA: new Weekday(5),
2102
+ SU: new Weekday(6)
2103
+ };
2104
+ var DEFAULT_OPTIONS = {
2105
+ freq: Frequency.YEARLY,
2106
+ dtstart: null,
2107
+ interval: 1,
2108
+ wkst: Days.MO,
2109
+ count: null,
2110
+ until: null,
2111
+ tzid: null,
2112
+ bysetpos: null,
2113
+ bymonth: null,
2114
+ bymonthday: null,
2115
+ bynmonthday: null,
2116
+ byyearday: null,
2117
+ byweekno: null,
2118
+ byweekday: null,
2119
+ bynweekday: null,
2120
+ byhour: null,
2121
+ byminute: null,
2122
+ bysecond: null,
2123
+ byeaster: null
2124
+ };
2125
+ var rrule_defaultKeys = Object.keys(DEFAULT_OPTIONS);
2126
+ /**
2127
+ *
2128
+ * @param {Options?} options - see <http://labix.org/python-dateutil/#head-cf004ee9a75592797e076752b2a889c10f445418>
2129
+ * The only required option is `freq`, one of RRule.YEARLY, RRule.MONTHLY, ...
2130
+ * @constructor
2131
+ */
2132
+ var rrule_RRule = /** @class */ (function () {
2133
+ function RRule(options, noCache) {
2134
+ if (options === void 0) { options = {}; }
2135
+ if (noCache === void 0) { noCache = false; }
2136
+ // RFC string
2137
+ this._cache = noCache ? null : new cache_Cache();
2138
+ // used by toString()
2139
+ this.origOptions = initializeOptions(options);
2140
+ var parsedOptions = parseOptions(options).parsedOptions;
2141
+ this.options = parsedOptions;
2142
+ }
2143
+ RRule.parseText = function (text, language) {
2144
+ return getnlp().parseText(text, language);
2145
+ };
2146
+ RRule.fromText = function (text, language) {
2147
+ return getnlp().fromText(text, language);
2148
+ };
2149
+ RRule.fromString = function (str) {
2150
+ return new RRule(RRule.parseString(str) || undefined);
2151
+ };
2152
+ RRule.prototype._iter = function (iterResult) {
2153
+ return iter(iterResult, this.options);
2154
+ };
2155
+ RRule.prototype._cacheGet = function (what, args) {
2156
+ if (!this._cache)
2157
+ return false;
2158
+ return this._cache._cacheGet(what, args);
2159
+ };
2160
+ RRule.prototype._cacheAdd = function (what, value, args) {
2161
+ if (!this._cache)
2162
+ return;
2163
+ return this._cache._cacheAdd(what, value, args);
2164
+ };
2165
+ /**
2166
+ * @param {Function} iterator - optional function that will be called
2167
+ * on each date that is added. It can return false
2168
+ * to stop the iteration.
2169
+ * @return Array containing all recurrences.
2170
+ */
2171
+ RRule.prototype.all = function (iterator) {
2172
+ if (iterator) {
2173
+ return this._iter(new callbackiterresult('all', {}, iterator));
2174
+ }
2175
+ var result = this._cacheGet('all');
2176
+ if (result === false) {
2177
+ result = this._iter(new iterresult('all', {}));
2178
+ this._cacheAdd('all', result);
2179
+ }
2180
+ return result;
2181
+ };
2182
+ /**
2183
+ * Returns all the occurrences of the rrule between after and before.
2184
+ * The inc keyword defines what happens if after and/or before are
2185
+ * themselves occurrences. With inc == True, they will be included in the
2186
+ * list, if they are found in the recurrence set.
2187
+ * @return Array
2188
+ */
2189
+ RRule.prototype.between = function (after, before, inc, iterator) {
2190
+ if (inc === void 0) { inc = false; }
2191
+ if (!src_dateutil.isValidDate(after) || !src_dateutil.isValidDate(before))
2192
+ throw new Error('Invalid date passed in to RRule.between');
2193
+ var args = {
2194
+ before: before,
2195
+ after: after,
2196
+ inc: inc
2197
+ };
2198
+ if (iterator) {
2199
+ return this._iter(new callbackiterresult('between', args, iterator));
2200
+ }
2201
+ var result = this._cacheGet('between', args);
2202
+ if (result === false) {
2203
+ result = this._iter(new iterresult('between', args));
2204
+ this._cacheAdd('between', result, args);
2205
+ }
2206
+ return result;
2207
+ };
2208
+ /**
2209
+ * Returns the last recurrence before the given datetime instance.
2210
+ * The inc keyword defines what happens if dt is an occurrence.
2211
+ * With inc == True, if dt itself is an occurrence, it will be returned.
2212
+ * @return Date or null
2213
+ */
2214
+ RRule.prototype.before = function (dt, inc) {
2215
+ if (inc === void 0) { inc = false; }
2216
+ if (!src_dateutil.isValidDate(dt))
2217
+ throw new Error('Invalid date passed in to RRule.before');
2218
+ var args = { dt: dt, inc: inc };
2219
+ var result = this._cacheGet('before', args);
2220
+ if (result === false) {
2221
+ result = this._iter(new iterresult('before', args));
2222
+ this._cacheAdd('before', result, args);
2223
+ }
2224
+ return result;
2225
+ };
2226
+ /**
2227
+ * Returns the first recurrence after the given datetime instance.
2228
+ * The inc keyword defines what happens if dt is an occurrence.
2229
+ * With inc == True, if dt itself is an occurrence, it will be returned.
2230
+ * @return Date or null
2231
+ */
2232
+ RRule.prototype.after = function (dt, inc) {
2233
+ if (inc === void 0) { inc = false; }
2234
+ if (!src_dateutil.isValidDate(dt))
2235
+ throw new Error('Invalid date passed in to RRule.after');
2236
+ var args = { dt: dt, inc: inc };
2237
+ var result = this._cacheGet('after', args);
2238
+ if (result === false) {
2239
+ result = this._iter(new iterresult('after', args));
2240
+ this._cacheAdd('after', result, args);
2241
+ }
2242
+ return result;
2243
+ };
2244
+ /**
2245
+ * Returns the number of recurrences in this set. It will have go trough
2246
+ * the whole recurrence, if this hasn't been done before.
2247
+ */
2248
+ RRule.prototype.count = function () {
2249
+ return this.all().length;
2250
+ };
2251
+ /**
2252
+ * Converts the rrule into its string representation
2253
+ * @see <http://www.ietf.org/rfc/rfc2445.txt>
2254
+ * @return String
2255
+ */
2256
+ RRule.prototype.toString = function () {
2257
+ return optionsToString(this.origOptions);
2258
+ };
2259
+ /**
2260
+ * Will convert all rules described in nlp:ToText
2261
+ * to text.
2262
+ */
2263
+ RRule.prototype.toText = function (gettext, language, dateFormatter) {
2264
+ return getnlp().toText(this, gettext, language, dateFormatter);
2265
+ };
2266
+ RRule.prototype.isFullyConvertibleToText = function () {
2267
+ return getnlp().isFullyConvertible(this);
2268
+ };
2269
+ /**
2270
+ * @return a RRule instance with the same freq and options
2271
+ * as this one (cache is not cloned)
2272
+ */
2273
+ RRule.prototype.clone = function () {
2274
+ return new RRule(this.origOptions);
2275
+ };
2276
+ // RRule class 'constants'
2277
+ RRule.FREQUENCIES = [
2278
+ 'YEARLY',
2279
+ 'MONTHLY',
2280
+ 'WEEKLY',
2281
+ 'DAILY',
2282
+ 'HOURLY',
2283
+ 'MINUTELY',
2284
+ 'SECONDLY'
2285
+ ];
2286
+ RRule.YEARLY = Frequency.YEARLY;
2287
+ RRule.MONTHLY = Frequency.MONTHLY;
2288
+ RRule.WEEKLY = Frequency.WEEKLY;
2289
+ RRule.DAILY = Frequency.DAILY;
2290
+ RRule.HOURLY = Frequency.HOURLY;
2291
+ RRule.MINUTELY = Frequency.MINUTELY;
2292
+ RRule.SECONDLY = Frequency.SECONDLY;
2293
+ RRule.MO = Days.MO;
2294
+ RRule.TU = Days.TU;
2295
+ RRule.WE = Days.WE;
2296
+ RRule.TH = Days.TH;
2297
+ RRule.FR = Days.FR;
2298
+ RRule.SA = Days.SA;
2299
+ RRule.SU = Days.SU;
2300
+ RRule.parseString = parseString;
2301
+ RRule.optionsToString = optionsToString;
2302
+ return RRule;
2303
+ }());
2304
+ /* harmony default export */ var src_rrule = (rrule_RRule);
2305
+
2306
+ // CONCATENATED MODULE: ./src/iterset.ts
2307
+
2308
+
2309
+
2310
+ function iterSet(iterResult, _rrule, _exrule, _rdate, _exdate, tzid) {
2311
+ var _exdateHash = {};
2312
+ var _accept = iterResult.accept;
2313
+ function evalExdate(after, before) {
2314
+ _exrule.forEach(function (rrule) {
2315
+ rrule.between(after, before, true).forEach(function (date) {
2316
+ _exdateHash[Number(date)] = true;
2317
+ });
2318
+ });
2319
+ }
2320
+ _exdate.forEach(function (date) {
2321
+ var zonedDate = new datewithzone_DateWithZone(date, tzid).rezonedDate();
2322
+ _exdateHash[Number(zonedDate)] = true;
2323
+ });
2324
+ iterResult.accept = function (date) {
2325
+ var dt = Number(date);
2326
+ if (!_exdateHash[dt]) {
2327
+ evalExdate(new Date(dt - 1), new Date(dt + 1));
2328
+ if (!_exdateHash[dt]) {
2329
+ _exdateHash[dt] = true;
2330
+ return _accept.call(this, date);
2331
+ }
2332
+ }
2333
+ return true;
2334
+ };
2335
+ if (iterResult.method === 'between') {
2336
+ evalExdate(iterResult.args.after, iterResult.args.before);
2337
+ iterResult.accept = function (date) {
2338
+ var dt = Number(date);
2339
+ if (!_exdateHash[dt]) {
2340
+ _exdateHash[dt] = true;
2341
+ return _accept.call(this, date);
2342
+ }
2343
+ return true;
2344
+ };
2345
+ }
2346
+ for (var i = 0; i < _rdate.length; i++) {
2347
+ var zonedDate = new datewithzone_DateWithZone(_rdate[i], tzid).rezonedDate();
2348
+ if (!iterResult.accept(new Date(zonedDate.getTime())))
2349
+ break;
2350
+ }
2351
+ _rrule.forEach(function (rrule) {
2352
+ iter(iterResult, rrule.options);
2353
+ });
2354
+ var res = iterResult._result;
2355
+ src_dateutil.sort(res);
2356
+ switch (iterResult.method) {
2357
+ case 'all':
2358
+ case 'between':
2359
+ return res;
2360
+ case 'before':
2361
+ return ((res.length && res[res.length - 1]) || null);
2362
+ case 'after':
2363
+ default:
2364
+ return ((res.length && res[0]) || null);
2365
+ }
2366
+ }
2367
+
2368
+ // CONCATENATED MODULE: ./src/rrulestr.ts
2369
+
2370
+
2371
+
2372
+
2373
+
2374
+
2375
+ /**
2376
+ * RRuleStr
2377
+ * To parse a set of rrule strings
2378
+ */
2379
+ var rrulestr_DEFAULT_OPTIONS = {
2380
+ dtstart: null,
2381
+ cache: false,
2382
+ unfold: false,
2383
+ forceset: false,
2384
+ compatible: false,
2385
+ tzid: null
2386
+ };
2387
+ function parseInput(s, options) {
2388
+ var rrulevals = [];
2389
+ var rdatevals = [];
2390
+ var exrulevals = [];
2391
+ var exdatevals = [];
2392
+ var _a = parseDtstart(s), dtstart = _a.dtstart, tzid = _a.tzid;
2393
+ var lines = splitIntoLines(s, options.unfold);
2394
+ lines.forEach(function (line) {
2395
+ if (!line)
2396
+ return;
2397
+ var _a = breakDownLine(line), name = _a.name, parms = _a.parms, value = _a.value;
2398
+ switch (name.toUpperCase()) {
2399
+ case 'RRULE':
2400
+ if (parms.length) {
2401
+ throw new Error("unsupported RRULE parm: " + parms.join(','));
2402
+ }
2403
+ rrulevals.push(parseString(line));
2404
+ break;
2405
+ case 'RDATE':
2406
+ var _b = /RDATE(?:;TZID=([^:=]+))?/i.exec(line), _ = _b[0], rdateTzid = _b[1];
2407
+ if (rdateTzid && !tzid) {
2408
+ tzid = rdateTzid;
2409
+ }
2410
+ rdatevals = rdatevals.concat(parseRDate(value, parms));
2411
+ break;
2412
+ case 'EXRULE':
2413
+ if (parms.length) {
2414
+ throw new Error("unsupported EXRULE parm: " + parms.join(','));
2415
+ }
2416
+ exrulevals.push(parseString(value));
2417
+ break;
2418
+ case 'EXDATE':
2419
+ exdatevals = exdatevals.concat(parseRDate(value, parms));
2420
+ break;
2421
+ case 'DTSTART':
2422
+ break;
2423
+ default:
2424
+ throw new Error('unsupported property: ' + name);
2425
+ }
2426
+ });
2427
+ return {
2428
+ dtstart: dtstart,
2429
+ tzid: tzid,
2430
+ rrulevals: rrulevals,
2431
+ rdatevals: rdatevals,
2432
+ exrulevals: exrulevals,
2433
+ exdatevals: exdatevals
2434
+ };
2435
+ }
2436
+ function buildRule(s, options) {
2437
+ var _a = parseInput(s, options), rrulevals = _a.rrulevals, rdatevals = _a.rdatevals, exrulevals = _a.exrulevals, exdatevals = _a.exdatevals, dtstart = _a.dtstart, tzid = _a.tzid;
2438
+ var noCache = options.cache === false;
2439
+ if (options.compatible) {
2440
+ options.forceset = true;
2441
+ options.unfold = true;
2442
+ }
2443
+ if (options.forceset ||
2444
+ rrulevals.length > 1 ||
2445
+ rdatevals.length ||
2446
+ exrulevals.length ||
2447
+ exdatevals.length) {
2448
+ var rset_1 = new rruleset(noCache);
2449
+ rset_1.dtstart(dtstart);
2450
+ rset_1.tzid(tzid || undefined);
2451
+ rrulevals.forEach(function (val) {
2452
+ rset_1.rrule(new src_rrule(groomRruleOptions(val, dtstart, tzid), noCache));
2453
+ });
2454
+ rdatevals.forEach(function (date) {
2455
+ rset_1.rdate(date);
2456
+ });
2457
+ exrulevals.forEach(function (val) {
2458
+ rset_1.exrule(new src_rrule(groomRruleOptions(val, dtstart, tzid), noCache));
2459
+ });
2460
+ exdatevals.forEach(function (date) {
2461
+ rset_1.exdate(date);
2462
+ });
2463
+ if (options.compatible && options.dtstart)
2464
+ rset_1.rdate(dtstart);
2465
+ return rset_1;
2466
+ }
2467
+ var val = rrulevals[0] || {};
2468
+ return new src_rrule(groomRruleOptions(val, val.dtstart || options.dtstart || dtstart, val.tzid || options.tzid || tzid), noCache);
2469
+ }
2470
+ function rrulestr(s, options) {
2471
+ if (options === void 0) { options = {}; }
2472
+ return buildRule(s, rrulestr_initializeOptions(options));
2473
+ }
2474
+ function groomRruleOptions(val, dtstart, tzid) {
2475
+ return __assign({}, val, { dtstart: dtstart,
2476
+ tzid: tzid });
2477
+ }
2478
+ function rrulestr_initializeOptions(options) {
2479
+ var invalid = [];
2480
+ var keys = Object.keys(options);
2481
+ var defaultKeys = Object.keys(rrulestr_DEFAULT_OPTIONS);
2482
+ keys.forEach(function (key) {
2483
+ if (!Object(helpers["c" /* includes */])(defaultKeys, key))
2484
+ invalid.push(key);
2485
+ });
2486
+ if (invalid.length) {
2487
+ throw new Error('Invalid options: ' + invalid.join(', '));
2488
+ }
2489
+ var initializedOptions = __assign({}, options);
2490
+ // Merge in default options
2491
+ defaultKeys.forEach(function (key) {
2492
+ if (!Object(helpers["c" /* includes */])(keys, key))
2493
+ initializedOptions[key] = rrulestr_DEFAULT_OPTIONS[key];
2494
+ });
2495
+ return initializedOptions;
2496
+ }
2497
+ function extractName(line) {
2498
+ if (line.indexOf(':') === -1) {
2499
+ return {
2500
+ name: 'RRULE',
2501
+ value: line
2502
+ };
2503
+ }
2504
+ var _a = Object(helpers["l" /* split */])(line, ':', 1), name = _a[0], value = _a[1];
2505
+ return {
2506
+ name: name,
2507
+ value: value
2508
+ };
2509
+ }
2510
+ function breakDownLine(line) {
2511
+ var _a = extractName(line), name = _a.name, value = _a.value;
2512
+ var parms = name.split(';');
2513
+ if (!parms)
2514
+ throw new Error('empty property name');
2515
+ return {
2516
+ name: parms[0].toUpperCase(),
2517
+ parms: parms.slice(1),
2518
+ value: value
2519
+ };
2520
+ }
2521
+ function splitIntoLines(s, unfold) {
2522
+ if (unfold === void 0) { unfold = false; }
2523
+ s = s && s.trim();
2524
+ if (!s)
2525
+ throw new Error('Invalid empty string');
2526
+ // More info about 'unfold' option
2527
+ // Go head to http://www.ietf.org/rfc/rfc2445.txt
2528
+ if (!unfold) {
2529
+ return s.split(/\s/);
2530
+ }
2531
+ var lines = s.split('\n');
2532
+ var i = 0;
2533
+ while (i < lines.length) {
2534
+ // TODO
2535
+ var line = (lines[i] = lines[i].replace(/\s+$/g, ''));
2536
+ if (!line) {
2537
+ lines.splice(i, 1);
2538
+ }
2539
+ else if (i > 0 && line[0] === ' ') {
2540
+ lines[i - 1] += line.slice(1);
2541
+ lines.splice(i, 1);
2542
+ }
2543
+ else {
2544
+ i += 1;
2545
+ }
2546
+ }
2547
+ return lines;
2548
+ }
2549
+ function validateDateParm(parms) {
2550
+ parms.forEach(function (parm) {
2551
+ if (!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(parm)) {
2552
+ throw new Error('unsupported RDATE/EXDATE parm: ' + parm);
2553
+ }
2554
+ });
2555
+ }
2556
+ function parseRDate(rdateval, parms) {
2557
+ validateDateParm(parms);
2558
+ return rdateval
2559
+ .split(',')
2560
+ .map(function (datestr) { return src_dateutil.untilStringToDate(datestr); });
2561
+ }
2562
+
2563
+ // CONCATENATED MODULE: ./src/rruleset.ts
2564
+
2565
+
2566
+
2567
+
2568
+
2569
+
2570
+
2571
+ function createGetterSetter(fieldName) {
2572
+ var _this = this;
2573
+ return function (field) {
2574
+ if (field !== undefined) {
2575
+ _this["_" + fieldName] = field;
2576
+ }
2577
+ if (_this["_" + fieldName] !== undefined) {
2578
+ return _this["_" + fieldName];
2579
+ }
2580
+ for (var i = 0; i < _this._rrule.length; i++) {
2581
+ var field_1 = _this._rrule[i].origOptions[fieldName];
2582
+ if (field_1) {
2583
+ return field_1;
2584
+ }
2585
+ }
2586
+ };
2587
+ }
2588
+ var rruleset_RRuleSet = /** @class */ (function (_super) {
2589
+ __extends(RRuleSet, _super);
2590
+ /**
2591
+ *
2592
+ * @param {Boolean?} noCache
2593
+ * The same stratagy as RRule on cache, default to false
2594
+ * @constructor
2595
+ */
2596
+ function RRuleSet(noCache) {
2597
+ if (noCache === void 0) { noCache = false; }
2598
+ var _this = _super.call(this, {}, noCache) || this;
2599
+ _this.dtstart = createGetterSetter.apply(_this, ['dtstart']);
2600
+ _this.tzid = createGetterSetter.apply(_this, ['tzid']);
2601
+ _this._rrule = [];
2602
+ _this._rdate = [];
2603
+ _this._exrule = [];
2604
+ _this._exdate = [];
2605
+ return _this;
2606
+ }
2607
+ RRuleSet.prototype._iter = function (iterResult) {
2608
+ return iterSet(iterResult, this._rrule, this._exrule, this._rdate, this._exdate, this.tzid());
2609
+ };
2610
+ /**
2611
+ * Adds an RRule to the set
2612
+ *
2613
+ * @param {RRule}
2614
+ */
2615
+ RRuleSet.prototype.rrule = function (rrule) {
2616
+ _addRule(rrule, this._rrule);
2617
+ };
2618
+ /**
2619
+ * Adds an EXRULE to the set
2620
+ *
2621
+ * @param {RRule}
2622
+ */
2623
+ RRuleSet.prototype.exrule = function (rrule) {
2624
+ _addRule(rrule, this._exrule);
2625
+ };
2626
+ /**
2627
+ * Adds an RDate to the set
2628
+ *
2629
+ * @param {Date}
2630
+ */
2631
+ RRuleSet.prototype.rdate = function (date) {
2632
+ _addDate(date, this._rdate);
2633
+ };
2634
+ /**
2635
+ * Adds an EXDATE to the set
2636
+ *
2637
+ * @param {Date}
2638
+ */
2639
+ RRuleSet.prototype.exdate = function (date) {
2640
+ _addDate(date, this._exdate);
2641
+ };
2642
+ /**
2643
+ * Get list of included rrules in this recurrence set.
2644
+ *
2645
+ * @return List of rrules
2646
+ */
2647
+ RRuleSet.prototype.rrules = function () {
2648
+ return this._rrule.map(function (e) { return rrulestr(e.toString()); });
2649
+ };
2650
+ /**
2651
+ * Get list of excluded rrules in this recurrence set.
2652
+ *
2653
+ * @return List of exrules
2654
+ */
2655
+ RRuleSet.prototype.exrules = function () {
2656
+ return this._exrule.map(function (e) { return rrulestr(e.toString()); });
2657
+ };
2658
+ /**
2659
+ * Get list of included datetimes in this recurrence set.
2660
+ *
2661
+ * @return List of rdates
2662
+ */
2663
+ RRuleSet.prototype.rdates = function () {
2664
+ return this._rdate.map(function (e) { return new Date(e.getTime()); });
2665
+ };
2666
+ /**
2667
+ * Get list of included datetimes in this recurrence set.
2668
+ *
2669
+ * @return List of exdates
2670
+ */
2671
+ RRuleSet.prototype.exdates = function () {
2672
+ return this._exdate.map(function (e) { return new Date(e.getTime()); });
2673
+ };
2674
+ RRuleSet.prototype.valueOf = function () {
2675
+ var result = [];
2676
+ if (!this._rrule.length && this._dtstart) {
2677
+ result = result.concat(optionsToString({ dtstart: this._dtstart }));
2678
+ }
2679
+ this._rrule.forEach(function (rrule) {
2680
+ result = result.concat(rrule.toString().split('\n'));
2681
+ });
2682
+ this._exrule.forEach(function (exrule) {
2683
+ result = result.concat(exrule.toString().split('\n')
2684
+ .map(function (line) { return line.replace(/^RRULE:/, 'EXRULE:'); })
2685
+ .filter(function (line) { return !/^DTSTART/.test(line); }));
2686
+ });
2687
+ if (this._rdate.length) {
2688
+ result.push(rdatesToString('RDATE', this._rdate, this.tzid()));
2689
+ }
2690
+ if (this._exdate.length) {
2691
+ result.push(rdatesToString('EXDATE', this._exdate, this.tzid()));
2692
+ }
2693
+ return result;
2694
+ };
2695
+ /**
2696
+ * to generate recurrence field such as:
2697
+ * DTSTART:19970902T010000Z
2698
+ * RRULE:FREQ=YEARLY;COUNT=2;BYDAY=TU
2699
+ * RRULE:FREQ=YEARLY;COUNT=1;BYDAY=TH
2700
+ */
2701
+ RRuleSet.prototype.toString = function () {
2702
+ return this.valueOf().join('\n');
2703
+ };
2704
+ /**
2705
+ * Create a new RRuleSet Object completely base on current instance
2706
+ */
2707
+ RRuleSet.prototype.clone = function () {
2708
+ var rrs = new RRuleSet(!!this._cache);
2709
+ this._rrule.forEach(function (rule) { return rrs.rrule(rule.clone()); });
2710
+ this._exrule.forEach(function (rule) { return rrs.exrule(rule.clone()); });
2711
+ this._rdate.forEach(function (date) { return rrs.rdate(new Date(date.getTime())); });
2712
+ this._exdate.forEach(function (date) { return rrs.exdate(new Date(date.getTime())); });
2713
+ return rrs;
2714
+ };
2715
+ return RRuleSet;
2716
+ }(src_rrule));
2717
+ /* harmony default export */ var rruleset = (rruleset_RRuleSet);
2718
+ function _addRule(rrule, collection) {
2719
+ if (!(rrule instanceof src_rrule)) {
2720
+ throw new TypeError(String(rrule) + ' is not RRule instance');
2721
+ }
2722
+ if (!Object(helpers["c" /* includes */])(collection.map(String), String(rrule))) {
2723
+ collection.push(rrule);
2724
+ }
2725
+ }
2726
+ function _addDate(date, collection) {
2727
+ if (!(date instanceof Date)) {
2728
+ throw new TypeError(String(date) + ' is not Date instance');
2729
+ }
2730
+ if (!Object(helpers["c" /* includes */])(collection.map(Number), Number(date))) {
2731
+ collection.push(date);
2732
+ src_dateutil.sort(collection);
2733
+ }
2734
+ }
2735
+ function rdatesToString(param, rdates, tzid) {
2736
+ var isUTC = !tzid || tzid.toUpperCase() === 'UTC';
2737
+ var header = isUTC ? param + ":" : param + ";TZID=" + tzid + ":";
2738
+ var dateString = rdates
2739
+ .map(function (rdate) { return src_dateutil.timeToUntilString(rdate.valueOf(), isUTC); })
2740
+ .join(',');
2741
+ return "" + header + dateString;
2742
+ }
2743
+
2744
+ // CONCATENATED MODULE: ./src/index.ts
2745
+ /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "Frequency", function() { return Frequency; });
2746
+ /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "Weekday", function() { return Weekday; });
2747
+ /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "RRule", function() { return src_rrule; });
2748
+ /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "RRuleSet", function() { return rruleset; });
2749
+ /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "rrulestr", function() { return rrulestr; });
2750
+ /*!
2751
+ * rrule.js - Library for working with recurrence rules for calendar dates.
2752
+ * https://github.com/jakubroztocil/rrule
2753
+ *
2754
+ * Copyright 2010, Jakub Roztocil and Lars Schoning
2755
+ * Licenced under the BSD licence.
2756
+ * https://github.com/jakubroztocil/rrule/blob/master/LICENCE
2757
+ *
2758
+ * Based on:
2759
+ * python-dateutil - Extensions to the standard Python datetime module.
2760
+ * Copyright (c) 2003-2011 - Gustavo Niemeyer <gustavo@niemeyer.net>
2761
+ * Copyright (c) 2012 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
2762
+ * https://github.com/jakubroztocil/rrule/blob/master/LICENCE
2763
+ *
2764
+ */
2765
+
2766
+
2767
+
2768
+
2769
+
2770
+ // =============================================================================
2771
+ // Export
2772
+ // =============================================================================
2773
+
2774
+ /* harmony default export */ var src = __webpack_exports__["default"] = (src_rrule);
2775
+
2776
+
2777
+ /***/ }),
2778
+ /* 2 */
2779
+ /***/ (function(module, exports) {
2780
+
2781
+ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
2782
+
2783
+ /***/ }),
2784
+ /* 3 */
2785
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
2786
+
2787
+ "use strict";
2788
+ __webpack_require__.r(__webpack_exports__);
2789
+
2790
+ // CONCATENATED MODULE: ./src/nlp/i18n.ts
2791
+ // =============================================================================
2792
+ // i18n
2793
+ // =============================================================================
2794
+ var ENGLISH = {
2795
+ dayNames: [
2796
+ 'Sunday', 'Monday', 'Tuesday', 'Wednesday',
2797
+ 'Thursday', 'Friday', 'Saturday'
2798
+ ],
2799
+ monthNames: [
2800
+ 'January', 'February', 'March', 'April', 'May',
2801
+ 'June', 'July', 'August', 'September', 'October',
2802
+ 'November', 'December'
2803
+ ],
2804
+ tokens: {
2805
+ 'SKIP': /^[ \r\n\t]+|^\.$/,
2806
+ 'number': /^[1-9][0-9]*/,
2807
+ 'numberAsText': /^(one|two|three)/i,
2808
+ 'every': /^every/i,
2809
+ 'day(s)': /^days?/i,
2810
+ 'weekday(s)': /^weekdays?/i,
2811
+ 'week(s)': /^weeks?/i,
2812
+ 'hour(s)': /^hours?/i,
2813
+ 'minute(s)': /^minutes?/i,
2814
+ 'month(s)': /^months?/i,
2815
+ 'year(s)': /^years?/i,
2816
+ 'on': /^(on|in)/i,
2817
+ 'at': /^(at)/i,
2818
+ 'the': /^the/i,
2819
+ 'first': /^first/i,
2820
+ 'second': /^second/i,
2821
+ 'third': /^third/i,
2822
+ 'nth': /^([1-9][0-9]*)(\.|th|nd|rd|st)/i,
2823
+ 'last': /^last/i,
2824
+ 'for': /^for/i,
2825
+ 'time(s)': /^times?/i,
2826
+ 'until': /^(un)?til/i,
2827
+ 'monday': /^mo(n(day)?)?/i,
2828
+ 'tuesday': /^tu(e(s(day)?)?)?/i,
2829
+ 'wednesday': /^we(d(n(esday)?)?)?/i,
2830
+ 'thursday': /^th(u(r(sday)?)?)?/i,
2831
+ 'friday': /^fr(i(day)?)?/i,
2832
+ 'saturday': /^sa(t(urday)?)?/i,
2833
+ 'sunday': /^su(n(day)?)?/i,
2834
+ 'january': /^jan(uary)?/i,
2835
+ 'february': /^feb(ruary)?/i,
2836
+ 'march': /^mar(ch)?/i,
2837
+ 'april': /^apr(il)?/i,
2838
+ 'may': /^may/i,
2839
+ 'june': /^june?/i,
2840
+ 'july': /^july?/i,
2841
+ 'august': /^aug(ust)?/i,
2842
+ 'september': /^sep(t(ember)?)?/i,
2843
+ 'october': /^oct(ober)?/i,
2844
+ 'november': /^nov(ember)?/i,
2845
+ 'december': /^dec(ember)?/i,
2846
+ 'comma': /^(,\s*|(and|or)\s*)+/i
2847
+ }
2848
+ };
2849
+ /* harmony default export */ var i18n = (ENGLISH);
2850
+
2851
+ // EXTERNAL MODULE: ./src/index.ts + 23 modules
2852
+ var src = __webpack_require__(1);
2853
+
2854
+ // EXTERNAL MODULE: ./src/helpers.ts
2855
+ var helpers = __webpack_require__(0);
2856
+
2857
+ // CONCATENATED MODULE: ./src/nlp/totext.ts
2858
+
2859
+
2860
+
2861
+ // =============================================================================
2862
+ // Helper functions
2863
+ // =============================================================================
2864
+ /**
2865
+ * Return true if a value is in an array
2866
+ */
2867
+ var contains = function (arr, val) {
2868
+ return arr.indexOf(val) !== -1;
2869
+ };
2870
+ var defaultGetText = function (id) { return id.toString(); };
2871
+ var defaultDateFormatter = function (year, month, day) { return month + " " + day + ", " + year; };
2872
+ /**
2873
+ *
2874
+ * @param {RRule} rrule
2875
+ * Optional:
2876
+ * @param {Function} gettext function
2877
+ * @param {Object} language definition
2878
+ * @constructor
2879
+ */
2880
+ var totext_ToText = /** @class */ (function () {
2881
+ function ToText(rrule, gettext, language, dateFormatter) {
2882
+ if (gettext === void 0) { gettext = defaultGetText; }
2883
+ if (language === void 0) { language = i18n; }
2884
+ if (dateFormatter === void 0) { dateFormatter = defaultDateFormatter; }
2885
+ this.text = [];
2886
+ this.language = language || i18n;
2887
+ this.gettext = gettext;
2888
+ this.dateFormatter = dateFormatter;
2889
+ this.rrule = rrule;
2890
+ this.options = rrule.options;
2891
+ this.origOptions = rrule.origOptions;
2892
+ if (this.origOptions.bymonthday) {
2893
+ var bymonthday = [].concat(this.options.bymonthday);
2894
+ var bynmonthday = [].concat(this.options.bynmonthday);
2895
+ bymonthday.sort(function (a, b) { return a - b; });
2896
+ bynmonthday.sort(function (a, b) { return b - a; });
2897
+ // 1, 2, 3, .., -5, -4, -3, ..
2898
+ this.bymonthday = bymonthday.concat(bynmonthday);
2899
+ if (!this.bymonthday.length)
2900
+ this.bymonthday = null;
2901
+ }
2902
+ if (Object(helpers["f" /* isPresent */])(this.origOptions.byweekday)) {
2903
+ var byweekday = !Object(helpers["d" /* isArray */])(this.origOptions.byweekday)
2904
+ ? [this.origOptions.byweekday]
2905
+ : this.origOptions.byweekday;
2906
+ var days = String(byweekday);
2907
+ this.byweekday = {
2908
+ allWeeks: byweekday.filter(function (weekday) {
2909
+ return !weekday.n;
2910
+ }),
2911
+ someWeeks: byweekday.filter(function (weekday) {
2912
+ return Boolean(weekday.n);
2913
+ }),
2914
+ isWeekdays: days.indexOf('MO') !== -1 &&
2915
+ days.indexOf('TU') !== -1 &&
2916
+ days.indexOf('WE') !== -1 &&
2917
+ days.indexOf('TH') !== -1 &&
2918
+ days.indexOf('FR') !== -1 &&
2919
+ days.indexOf('SA') === -1 &&
2920
+ days.indexOf('SU') === -1,
2921
+ isEveryDay: days.indexOf('MO') !== -1 &&
2922
+ days.indexOf('TU') !== -1 &&
2923
+ days.indexOf('WE') !== -1 &&
2924
+ days.indexOf('TH') !== -1 &&
2925
+ days.indexOf('FR') !== -1 &&
2926
+ days.indexOf('SA') !== -1 &&
2927
+ days.indexOf('SU') !== -1
2928
+ };
2929
+ var sortWeekDays = function (a, b) {
2930
+ return a.weekday - b.weekday;
2931
+ };
2932
+ this.byweekday.allWeeks.sort(sortWeekDays);
2933
+ this.byweekday.someWeeks.sort(sortWeekDays);
2934
+ if (!this.byweekday.allWeeks.length)
2935
+ this.byweekday.allWeeks = null;
2936
+ if (!this.byweekday.someWeeks.length)
2937
+ this.byweekday.someWeeks = null;
2938
+ }
2939
+ else {
2940
+ this.byweekday = null;
2941
+ }
2942
+ }
2943
+ /**
2944
+ * Test whether the rrule can be fully converted to text.
2945
+ * @param {RRule} rrule
2946
+ * @return {Boolean}
2947
+ */
2948
+ ToText.isFullyConvertible = function (rrule) {
2949
+ var canConvert = true;
2950
+ if (!(rrule.options.freq in ToText.IMPLEMENTED))
2951
+ return false;
2952
+ if (rrule.origOptions.until && rrule.origOptions.count)
2953
+ return false;
2954
+ for (var key in rrule.origOptions) {
2955
+ if (contains(['dtstart', 'wkst', 'freq'], key))
2956
+ return true;
2957
+ if (!contains(ToText.IMPLEMENTED[rrule.options.freq], key))
2958
+ return false;
2959
+ }
2960
+ return canConvert;
2961
+ };
2962
+ ToText.prototype.isFullyConvertible = function () {
2963
+ return ToText.isFullyConvertible(this.rrule);
2964
+ };
2965
+ /**
2966
+ * Perform the conversion. Only some of the frequencies are supported.
2967
+ * If some of the rrule's options aren't supported, they'll
2968
+ * be omitted from the output an "(~ approximate)" will be appended.
2969
+ * @return {*}
2970
+ */
2971
+ ToText.prototype.toString = function () {
2972
+ var gettext = this.gettext;
2973
+ if (!(this.options.freq in ToText.IMPLEMENTED)) {
2974
+ return gettext('RRule error: Unable to fully convert this rrule to text');
2975
+ }
2976
+ this.text = [gettext('every')];
2977
+ // @ts-ignore
2978
+ this[src["default"].FREQUENCIES[this.options.freq]]();
2979
+ if (this.options.until) {
2980
+ this.add(gettext('until'));
2981
+ var until = this.options.until;
2982
+ this.add(this.dateFormatter(until.getUTCFullYear(), this.language.monthNames[until.getUTCMonth()], until.getUTCDate()));
2983
+ }
2984
+ else if (this.options.count) {
2985
+ this.add(gettext('for'))
2986
+ .add(this.options.count.toString())
2987
+ .add(this.plural(this.options.count) ? gettext('times') : gettext('time'));
2988
+ }
2989
+ if (!this.isFullyConvertible())
2990
+ this.add(gettext('(~ approximate)'));
2991
+ return this.text.join('');
2992
+ };
2993
+ ToText.prototype.HOURLY = function () {
2994
+ var gettext = this.gettext;
2995
+ if (this.options.interval !== 1)
2996
+ this.add(this.options.interval.toString());
2997
+ this.add(this.plural(this.options.interval) ? gettext('hours') : gettext('hour'));
2998
+ };
2999
+ ToText.prototype.MINUTELY = function () {
3000
+ var gettext = this.gettext;
3001
+ if (this.options.interval !== 1)
3002
+ this.add(this.options.interval.toString());
3003
+ this.add(this.plural(this.options.interval)
3004
+ ? gettext('minutes')
3005
+ : gettext('minutes'));
3006
+ };
3007
+ ToText.prototype.DAILY = function () {
3008
+ var gettext = this.gettext;
3009
+ if (this.options.interval !== 1)
3010
+ this.add(this.options.interval.toString());
3011
+ if (this.byweekday && this.byweekday.isWeekdays) {
3012
+ this.add(this.plural(this.options.interval)
3013
+ ? gettext('weekdays')
3014
+ : gettext('weekday'));
3015
+ }
3016
+ else {
3017
+ this.add(this.plural(this.options.interval) ? gettext('days') : gettext('day'));
3018
+ }
3019
+ if (this.origOptions.bymonth) {
3020
+ this.add(gettext('in'));
3021
+ this._bymonth();
3022
+ }
3023
+ if (this.bymonthday) {
3024
+ this._bymonthday();
3025
+ }
3026
+ else if (this.byweekday) {
3027
+ this._byweekday();
3028
+ }
3029
+ else if (this.origOptions.byhour) {
3030
+ this._byhour();
3031
+ }
3032
+ };
3033
+ ToText.prototype.WEEKLY = function () {
3034
+ var gettext = this.gettext;
3035
+ if (this.options.interval !== 1) {
3036
+ this.add(this.options.interval.toString()).add(this.plural(this.options.interval) ? gettext('weeks') : gettext('week'));
3037
+ }
3038
+ if (this.byweekday && this.byweekday.isWeekdays) {
3039
+ if (this.options.interval === 1) {
3040
+ this.add(this.plural(this.options.interval)
3041
+ ? gettext('weekdays')
3042
+ : gettext('weekday'));
3043
+ }
3044
+ else {
3045
+ this.add(gettext('on')).add(gettext('weekdays'));
3046
+ }
3047
+ }
3048
+ else if (this.byweekday && this.byweekday.isEveryDay) {
3049
+ this.add(this.plural(this.options.interval) ? gettext('days') : gettext('day'));
3050
+ }
3051
+ else {
3052
+ if (this.options.interval === 1)
3053
+ this.add(gettext('week'));
3054
+ if (this.origOptions.bymonth) {
3055
+ this.add(gettext('in'));
3056
+ this._bymonth();
3057
+ }
3058
+ if (this.bymonthday) {
3059
+ this._bymonthday();
3060
+ }
3061
+ else if (this.byweekday) {
3062
+ this._byweekday();
3063
+ }
3064
+ }
3065
+ };
3066
+ ToText.prototype.MONTHLY = function () {
3067
+ var gettext = this.gettext;
3068
+ if (this.origOptions.bymonth) {
3069
+ if (this.options.interval !== 1) {
3070
+ this.add(this.options.interval.toString()).add(gettext('months'));
3071
+ if (this.plural(this.options.interval))
3072
+ this.add(gettext('in'));
3073
+ }
3074
+ else {
3075
+ // this.add(gettext('MONTH'))
3076
+ }
3077
+ this._bymonth();
3078
+ }
3079
+ else {
3080
+ if (this.options.interval !== 1)
3081
+ this.add(this.options.interval.toString());
3082
+ this.add(this.plural(this.options.interval)
3083
+ ? gettext('months')
3084
+ : gettext('month'));
3085
+ }
3086
+ if (this.bymonthday) {
3087
+ this._bymonthday();
3088
+ }
3089
+ else if (this.byweekday && this.byweekday.isWeekdays) {
3090
+ this.add(gettext('on')).add(gettext('weekdays'));
3091
+ }
3092
+ else if (this.byweekday) {
3093
+ this._byweekday();
3094
+ }
3095
+ };
3096
+ ToText.prototype.YEARLY = function () {
3097
+ var gettext = this.gettext;
3098
+ if (this.origOptions.bymonth) {
3099
+ if (this.options.interval !== 1) {
3100
+ this.add(this.options.interval.toString());
3101
+ this.add(gettext('years'));
3102
+ }
3103
+ else {
3104
+ // this.add(gettext('YEAR'))
3105
+ }
3106
+ this._bymonth();
3107
+ }
3108
+ else {
3109
+ if (this.options.interval !== 1)
3110
+ this.add(this.options.interval.toString());
3111
+ this.add(this.plural(this.options.interval) ? gettext('years') : gettext('year'));
3112
+ }
3113
+ if (this.bymonthday) {
3114
+ this._bymonthday();
3115
+ }
3116
+ else if (this.byweekday) {
3117
+ this._byweekday();
3118
+ }
3119
+ if (this.options.byyearday) {
3120
+ this.add(gettext('on the'))
3121
+ .add(this.list(this.options.byyearday, this.nth, gettext('and')))
3122
+ .add(gettext('day'));
3123
+ }
3124
+ if (this.options.byweekno) {
3125
+ this.add(gettext('in'))
3126
+ .add(this.plural(this.options.byweekno.length)
3127
+ ? gettext('weeks')
3128
+ : gettext('week'))
3129
+ .add(this.list(this.options.byweekno, undefined, gettext('and')));
3130
+ }
3131
+ };
3132
+ ToText.prototype._bymonthday = function () {
3133
+ var gettext = this.gettext;
3134
+ if (this.byweekday && this.byweekday.allWeeks) {
3135
+ this.add(gettext('on'))
3136
+ .add(this.list(this.byweekday.allWeeks, this.weekdaytext, gettext('or')))
3137
+ .add(gettext('the'))
3138
+ .add(this.list(this.bymonthday, this.nth, gettext('or')));
3139
+ }
3140
+ else {
3141
+ this.add(gettext('on the')).add(this.list(this.bymonthday, this.nth, gettext('and')));
3142
+ }
3143
+ // this.add(gettext('DAY'))
3144
+ };
3145
+ ToText.prototype._byweekday = function () {
3146
+ var gettext = this.gettext;
3147
+ if (this.byweekday.allWeeks && !this.byweekday.isWeekdays) {
3148
+ this.add(gettext('on')).add(this.list(this.byweekday.allWeeks, this.weekdaytext));
3149
+ }
3150
+ if (this.byweekday.someWeeks) {
3151
+ if (this.byweekday.allWeeks)
3152
+ this.add(gettext('and'));
3153
+ this.add(gettext('on the')).add(this.list(this.byweekday.someWeeks, this.weekdaytext, gettext('and')));
3154
+ }
3155
+ };
3156
+ ToText.prototype._byhour = function () {
3157
+ var gettext = this.gettext;
3158
+ this.add(gettext('at')).add(this.list(this.origOptions.byhour, undefined, gettext('and')));
3159
+ };
3160
+ ToText.prototype._bymonth = function () {
3161
+ this.add(this.list(this.options.bymonth, this.monthtext, this.gettext('and')));
3162
+ };
3163
+ ToText.prototype.nth = function (n) {
3164
+ n = parseInt(n.toString(), 10);
3165
+ var nth;
3166
+ var npos;
3167
+ var gettext = this.gettext;
3168
+ if (n === -1)
3169
+ return gettext('last');
3170
+ npos = Math.abs(n);
3171
+ switch (npos) {
3172
+ case 1:
3173
+ case 21:
3174
+ case 31:
3175
+ nth = npos + gettext('st');
3176
+ break;
3177
+ case 2:
3178
+ case 22:
3179
+ nth = npos + gettext('nd');
3180
+ break;
3181
+ case 3:
3182
+ case 23:
3183
+ nth = npos + gettext('rd');
3184
+ break;
3185
+ default:
3186
+ nth = npos + gettext('th');
3187
+ }
3188
+ return n < 0 ? nth + ' ' + gettext('last') : nth;
3189
+ };
3190
+ ToText.prototype.monthtext = function (m) {
3191
+ return this.language.monthNames[m - 1];
3192
+ };
3193
+ ToText.prototype.weekdaytext = function (wday) {
3194
+ var weekday = Object(helpers["e" /* isNumber */])(wday) ? (wday + 1) % 7 : wday.getJsWeekday();
3195
+ return ((wday.n ? this.nth(wday.n) + ' ' : '') + this.language.dayNames[weekday]);
3196
+ };
3197
+ ToText.prototype.plural = function (n) {
3198
+ return n % 100 !== 1;
3199
+ };
3200
+ ToText.prototype.add = function (s) {
3201
+ this.text.push(' ');
3202
+ this.text.push(s);
3203
+ return this;
3204
+ };
3205
+ ToText.prototype.list = function (arr, callback, finalDelim, delim) {
3206
+ if (delim === void 0) { delim = ','; }
3207
+ if (!Object(helpers["d" /* isArray */])(arr)) {
3208
+ arr = [arr];
3209
+ }
3210
+ var delimJoin = function (array, delimiter, finalDelimiter) {
3211
+ var list = '';
3212
+ for (var i = 0; i < array.length; i++) {
3213
+ if (i !== 0) {
3214
+ if (i === array.length - 1) {
3215
+ list += ' ' + finalDelimiter + ' ';
3216
+ }
3217
+ else {
3218
+ list += delimiter + ' ';
3219
+ }
3220
+ }
3221
+ list += array[i];
3222
+ }
3223
+ return list;
3224
+ };
3225
+ callback =
3226
+ callback ||
3227
+ function (o) {
3228
+ return o.toString();
3229
+ };
3230
+ var self = this;
3231
+ var realCallback = function (arg) {
3232
+ return callback && callback.call(self, arg);
3233
+ };
3234
+ if (finalDelim) {
3235
+ return delimJoin(arr.map(realCallback), delim, finalDelim);
3236
+ }
3237
+ else {
3238
+ return arr.map(realCallback).join(delim + ' ');
3239
+ }
3240
+ };
3241
+ return ToText;
3242
+ }());
3243
+ /* harmony default export */ var totext = (totext_ToText);
3244
+
3245
+ // CONCATENATED MODULE: ./src/nlp/parsetext.ts
3246
+
3247
+
3248
+ // =============================================================================
3249
+ // Parser
3250
+ // =============================================================================
3251
+ var Parser = /** @class */ (function () {
3252
+ function Parser(rules) {
3253
+ this.done = true;
3254
+ this.rules = rules;
3255
+ }
3256
+ Parser.prototype.start = function (text) {
3257
+ this.text = text;
3258
+ this.done = false;
3259
+ return this.nextSymbol();
3260
+ };
3261
+ Parser.prototype.isDone = function () {
3262
+ return this.done && this.symbol === null;
3263
+ };
3264
+ Parser.prototype.nextSymbol = function () {
3265
+ var best;
3266
+ var bestSymbol;
3267
+ var p = this;
3268
+ this.symbol = null;
3269
+ this.value = null;
3270
+ do {
3271
+ if (this.done)
3272
+ return false;
3273
+ var rule = void 0;
3274
+ best = null;
3275
+ for (var name_1 in this.rules) {
3276
+ rule = this.rules[name_1];
3277
+ var match = rule.exec(p.text);
3278
+ if (match) {
3279
+ if (best === null || match[0].length > best[0].length) {
3280
+ best = match;
3281
+ bestSymbol = name_1;
3282
+ }
3283
+ }
3284
+ }
3285
+ if (best != null) {
3286
+ this.text = this.text.substr(best[0].length);
3287
+ if (this.text === '')
3288
+ this.done = true;
3289
+ }
3290
+ if (best == null) {
3291
+ this.done = true;
3292
+ this.symbol = null;
3293
+ this.value = null;
3294
+ return;
3295
+ }
3296
+ // @ts-ignore
3297
+ } while (bestSymbol === 'SKIP');
3298
+ // @ts-ignore
3299
+ this.symbol = bestSymbol;
3300
+ this.value = best;
3301
+ return true;
3302
+ };
3303
+ Parser.prototype.accept = function (name) {
3304
+ if (this.symbol === name) {
3305
+ if (this.value) {
3306
+ var v = this.value;
3307
+ this.nextSymbol();
3308
+ return v;
3309
+ }
3310
+ this.nextSymbol();
3311
+ return true;
3312
+ }
3313
+ return false;
3314
+ };
3315
+ Parser.prototype.acceptNumber = function () {
3316
+ return this.accept('number');
3317
+ };
3318
+ Parser.prototype.expect = function (name) {
3319
+ if (this.accept(name))
3320
+ return true;
3321
+ throw new Error('expected ' + name + ' but found ' + this.symbol);
3322
+ };
3323
+ return Parser;
3324
+ }());
3325
+ function parseText(text, language) {
3326
+ if (language === void 0) { language = i18n; }
3327
+ var options = {};
3328
+ var ttr = new Parser(language.tokens);
3329
+ if (!ttr.start(text))
3330
+ return null;
3331
+ S();
3332
+ return options;
3333
+ function S() {
3334
+ // every [n]
3335
+ ttr.expect('every');
3336
+ var n = ttr.acceptNumber();
3337
+ if (n)
3338
+ options.interval = parseInt(n[0], 10);
3339
+ if (ttr.isDone())
3340
+ throw new Error('Unexpected end');
3341
+ switch (ttr.symbol) {
3342
+ case 'day(s)':
3343
+ options.freq = src["default"].DAILY;
3344
+ if (ttr.nextSymbol()) {
3345
+ AT();
3346
+ F();
3347
+ }
3348
+ break;
3349
+ // FIXME Note: every 2 weekdays != every two weeks on weekdays.
3350
+ // DAILY on weekdays is not a valid rule
3351
+ case 'weekday(s)':
3352
+ options.freq = src["default"].WEEKLY;
3353
+ options.byweekday = [
3354
+ src["default"].MO,
3355
+ src["default"].TU,
3356
+ src["default"].WE,
3357
+ src["default"].TH,
3358
+ src["default"].FR
3359
+ ];
3360
+ ttr.nextSymbol();
3361
+ F();
3362
+ break;
3363
+ case 'week(s)':
3364
+ options.freq = src["default"].WEEKLY;
3365
+ if (ttr.nextSymbol()) {
3366
+ ON();
3367
+ F();
3368
+ }
3369
+ break;
3370
+ case 'hour(s)':
3371
+ options.freq = src["default"].HOURLY;
3372
+ if (ttr.nextSymbol()) {
3373
+ ON();
3374
+ F();
3375
+ }
3376
+ break;
3377
+ case 'minute(s)':
3378
+ options.freq = src["default"].MINUTELY;
3379
+ if (ttr.nextSymbol()) {
3380
+ ON();
3381
+ F();
3382
+ }
3383
+ break;
3384
+ case 'month(s)':
3385
+ options.freq = src["default"].MONTHLY;
3386
+ if (ttr.nextSymbol()) {
3387
+ ON();
3388
+ F();
3389
+ }
3390
+ break;
3391
+ case 'year(s)':
3392
+ options.freq = src["default"].YEARLY;
3393
+ if (ttr.nextSymbol()) {
3394
+ ON();
3395
+ F();
3396
+ }
3397
+ break;
3398
+ case 'monday':
3399
+ case 'tuesday':
3400
+ case 'wednesday':
3401
+ case 'thursday':
3402
+ case 'friday':
3403
+ case 'saturday':
3404
+ case 'sunday':
3405
+ options.freq = src["default"].WEEKLY;
3406
+ var key = ttr.symbol.substr(0, 2).toUpperCase();
3407
+ options.byweekday = [src["default"][key]];
3408
+ if (!ttr.nextSymbol())
3409
+ return;
3410
+ // TODO check for duplicates
3411
+ while (ttr.accept('comma')) {
3412
+ if (ttr.isDone())
3413
+ throw new Error('Unexpected end');
3414
+ var wkd = decodeWKD();
3415
+ if (!wkd) {
3416
+ throw new Error('Unexpected symbol ' + ttr.symbol + ', expected weekday');
3417
+ }
3418
+ // @ts-ignore
3419
+ options.byweekday.push(src["default"][wkd]);
3420
+ ttr.nextSymbol();
3421
+ }
3422
+ MDAYs();
3423
+ F();
3424
+ break;
3425
+ case 'january':
3426
+ case 'february':
3427
+ case 'march':
3428
+ case 'april':
3429
+ case 'may':
3430
+ case 'june':
3431
+ case 'july':
3432
+ case 'august':
3433
+ case 'september':
3434
+ case 'october':
3435
+ case 'november':
3436
+ case 'december':
3437
+ options.freq = src["default"].YEARLY;
3438
+ options.bymonth = [decodeM()];
3439
+ if (!ttr.nextSymbol())
3440
+ return;
3441
+ // TODO check for duplicates
3442
+ while (ttr.accept('comma')) {
3443
+ if (ttr.isDone())
3444
+ throw new Error('Unexpected end');
3445
+ var m = decodeM();
3446
+ if (!m) {
3447
+ throw new Error('Unexpected symbol ' + ttr.symbol + ', expected month');
3448
+ }
3449
+ options.bymonth.push(m);
3450
+ ttr.nextSymbol();
3451
+ }
3452
+ ON();
3453
+ F();
3454
+ break;
3455
+ default:
3456
+ throw new Error('Unknown symbol');
3457
+ }
3458
+ }
3459
+ function ON() {
3460
+ var on = ttr.accept('on');
3461
+ var the = ttr.accept('the');
3462
+ if (!(on || the))
3463
+ return;
3464
+ do {
3465
+ var nth = decodeNTH();
3466
+ var wkd = decodeWKD();
3467
+ var m = decodeM();
3468
+ // nth <weekday> | <weekday>
3469
+ if (nth) {
3470
+ // ttr.nextSymbol()
3471
+ if (wkd) {
3472
+ ttr.nextSymbol();
3473
+ if (!options.byweekday)
3474
+ options.byweekday = [];
3475
+ // @ts-ignore
3476
+ options.byweekday.push(src["default"][wkd].nth(nth));
3477
+ }
3478
+ else {
3479
+ if (!options.bymonthday)
3480
+ options.bymonthday = [];
3481
+ // @ts-ignore
3482
+ options.bymonthday.push(nth);
3483
+ ttr.accept('day(s)');
3484
+ }
3485
+ // <weekday>
3486
+ }
3487
+ else if (wkd) {
3488
+ ttr.nextSymbol();
3489
+ if (!options.byweekday)
3490
+ options.byweekday = [];
3491
+ // @ts-ignore
3492
+ options.byweekday.push(src["default"][wkd]);
3493
+ }
3494
+ else if (ttr.symbol === 'weekday(s)') {
3495
+ ttr.nextSymbol();
3496
+ if (!options.byweekday) {
3497
+ options.byweekday = [
3498
+ src["default"].MO,
3499
+ src["default"].TU,
3500
+ src["default"].WE,
3501
+ src["default"].TH,
3502
+ src["default"].FR
3503
+ ];
3504
+ }
3505
+ }
3506
+ else if (ttr.symbol === 'week(s)') {
3507
+ ttr.nextSymbol();
3508
+ var n = ttr.acceptNumber();
3509
+ if (!n) {
3510
+ throw new Error('Unexpected symbol ' + ttr.symbol + ', expected week number');
3511
+ }
3512
+ options.byweekno = [parseInt(n[0], 10)];
3513
+ while (ttr.accept('comma')) {
3514
+ n = ttr.acceptNumber();
3515
+ if (!n) {
3516
+ throw new Error('Unexpected symbol ' + ttr.symbol + '; expected monthday');
3517
+ }
3518
+ options.byweekno.push(parseInt(n[0], 10));
3519
+ }
3520
+ }
3521
+ else if (m) {
3522
+ ttr.nextSymbol();
3523
+ if (!options.bymonth)
3524
+ options.bymonth = [];
3525
+ // @ts-ignore
3526
+ options.bymonth.push(m);
3527
+ }
3528
+ else {
3529
+ return;
3530
+ }
3531
+ } while (ttr.accept('comma') || ttr.accept('the') || ttr.accept('on'));
3532
+ }
3533
+ function AT() {
3534
+ var at = ttr.accept('at');
3535
+ if (!at)
3536
+ return;
3537
+ do {
3538
+ var n = ttr.acceptNumber();
3539
+ if (!n) {
3540
+ throw new Error('Unexpected symbol ' + ttr.symbol + ', expected hour');
3541
+ }
3542
+ options.byhour = [parseInt(n[0], 10)];
3543
+ while (ttr.accept('comma')) {
3544
+ n = ttr.acceptNumber();
3545
+ if (!n) {
3546
+ throw new Error('Unexpected symbol ' + ttr.symbol + '; expected hour');
3547
+ }
3548
+ options.byhour.push(parseInt(n[0], 10));
3549
+ }
3550
+ } while (ttr.accept('comma') || ttr.accept('at'));
3551
+ }
3552
+ function decodeM() {
3553
+ switch (ttr.symbol) {
3554
+ case 'january':
3555
+ return 1;
3556
+ case 'february':
3557
+ return 2;
3558
+ case 'march':
3559
+ return 3;
3560
+ case 'april':
3561
+ return 4;
3562
+ case 'may':
3563
+ return 5;
3564
+ case 'june':
3565
+ return 6;
3566
+ case 'july':
3567
+ return 7;
3568
+ case 'august':
3569
+ return 8;
3570
+ case 'september':
3571
+ return 9;
3572
+ case 'october':
3573
+ return 10;
3574
+ case 'november':
3575
+ return 11;
3576
+ case 'december':
3577
+ return 12;
3578
+ default:
3579
+ return false;
3580
+ }
3581
+ }
3582
+ function decodeWKD() {
3583
+ switch (ttr.symbol) {
3584
+ case 'monday':
3585
+ case 'tuesday':
3586
+ case 'wednesday':
3587
+ case 'thursday':
3588
+ case 'friday':
3589
+ case 'saturday':
3590
+ case 'sunday':
3591
+ return ttr.symbol.substr(0, 2).toUpperCase();
3592
+ default:
3593
+ return false;
3594
+ }
3595
+ }
3596
+ function decodeNTH() {
3597
+ switch (ttr.symbol) {
3598
+ case 'last':
3599
+ ttr.nextSymbol();
3600
+ return -1;
3601
+ case 'first':
3602
+ ttr.nextSymbol();
3603
+ return 1;
3604
+ case 'second':
3605
+ ttr.nextSymbol();
3606
+ return ttr.accept('last') ? -2 : 2;
3607
+ case 'third':
3608
+ ttr.nextSymbol();
3609
+ return ttr.accept('last') ? -3 : 3;
3610
+ case 'nth':
3611
+ var v = parseInt(ttr.value[1], 10);
3612
+ if (v < -366 || v > 366)
3613
+ throw new Error('Nth out of range: ' + v);
3614
+ ttr.nextSymbol();
3615
+ return ttr.accept('last') ? -v : v;
3616
+ default:
3617
+ return false;
3618
+ }
3619
+ }
3620
+ function MDAYs() {
3621
+ ttr.accept('on');
3622
+ ttr.accept('the');
3623
+ var nth = decodeNTH();
3624
+ if (!nth)
3625
+ return;
3626
+ options.bymonthday = [nth];
3627
+ ttr.nextSymbol();
3628
+ while (ttr.accept('comma')) {
3629
+ nth = decodeNTH();
3630
+ if (!nth) {
3631
+ throw new Error('Unexpected symbol ' + ttr.symbol + '; expected monthday');
3632
+ }
3633
+ options.bymonthday.push(nth);
3634
+ ttr.nextSymbol();
3635
+ }
3636
+ }
3637
+ function F() {
3638
+ if (ttr.symbol === 'until') {
3639
+ var date = Date.parse(ttr.text);
3640
+ if (!date)
3641
+ throw new Error('Cannot parse until date:' + ttr.text);
3642
+ options.until = new Date(date);
3643
+ }
3644
+ else if (ttr.accept('for')) {
3645
+ options.count = parseInt(ttr.value[0], 10);
3646
+ ttr.expect('number');
3647
+ // ttr.expect('times')
3648
+ }
3649
+ }
3650
+ }
3651
+
3652
+ // CONCATENATED MODULE: ./src/nlp/index.ts
3653
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromText", function() { return fromText; });
3654
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isFullyConvertible", function() { return isFullyConvertible; });
3655
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toText", function() { return toText; });
3656
+ /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "parseText", function() { return parseText; });
3657
+
3658
+
3659
+
3660
+
3661
+ /*!
3662
+ * rrule.js - Library for working with recurrence rules for calendar dates.
3663
+ * https://github.com/jakubroztocil/rrule
3664
+ *
3665
+ * Copyright 2010, Jakub Roztocil and Lars Schoning
3666
+ * Licenced under the BSD licence.
3667
+ * https://github.com/jakubroztocil/rrule/blob/master/LICENCE
3668
+ *
3669
+ */
3670
+ /**
3671
+ *
3672
+ * Implementation of RRule.fromText() and RRule::toText().
3673
+ *
3674
+ *
3675
+ * On the client side, this file needs to be included
3676
+ * when those functions are used.
3677
+ *
3678
+ */
3679
+ // =============================================================================
3680
+ // fromText
3681
+ // =============================================================================
3682
+ /**
3683
+ * Will be able to convert some of the below described rules from
3684
+ * text format to a rule object.
3685
+ *
3686
+ *
3687
+ * RULES
3688
+ *
3689
+ * Every ([n])
3690
+ * day(s)
3691
+ * | [weekday], ..., (and) [weekday]
3692
+ * | weekday(s)
3693
+ * | week(s)
3694
+ * | month(s)
3695
+ * | [month], ..., (and) [month]
3696
+ * | year(s)
3697
+ *
3698
+ *
3699
+ * Plus 0, 1, or multiple of these:
3700
+ *
3701
+ * on [weekday], ..., (or) [weekday] the [monthday], [monthday], ... (or) [monthday]
3702
+ *
3703
+ * on [weekday], ..., (and) [weekday]
3704
+ *
3705
+ * on the [monthday], [monthday], ... (and) [monthday] (day of the month)
3706
+ *
3707
+ * on the [nth-weekday], ..., (and) [nth-weekday] (of the month/year)
3708
+ *
3709
+ *
3710
+ * Plus 0 or 1 of these:
3711
+ *
3712
+ * for [n] time(s)
3713
+ *
3714
+ * until [date]
3715
+ *
3716
+ * Plus (.)
3717
+ *
3718
+ *
3719
+ * Definitely no supported for parsing:
3720
+ *
3721
+ * (for year):
3722
+ * in week(s) [n], ..., (and) [n]
3723
+ *
3724
+ * on the [yearday], ..., (and) [n] day of the year
3725
+ * on day [yearday], ..., (and) [n]
3726
+ *
3727
+ *
3728
+ * NON-TERMINALS
3729
+ *
3730
+ * [n]: 1, 2 ..., one, two, three ..
3731
+ * [month]: January, February, March, April, May, ... December
3732
+ * [weekday]: Monday, ... Sunday
3733
+ * [nth-weekday]: first [weekday], 2nd [weekday], ... last [weekday], ...
3734
+ * [monthday]: first, 1., 2., 1st, 2nd, second, ... 31st, last day, 2nd last day, ..
3735
+ * [date]:
3736
+ * [month] (0-31(,) ([year])),
3737
+ * (the) 0-31.(1-12.([year])),
3738
+ * (the) 0-31/(1-12/([year])),
3739
+ * [weekday]
3740
+ *
3741
+ * [year]: 0000, 0001, ... 01, 02, ..
3742
+ *
3743
+ * Definitely not supported for parsing:
3744
+ *
3745
+ * [yearday]: first, 1., 2., 1st, 2nd, second, ... 366th, last day, 2nd last day, ..
3746
+ *
3747
+ * @param {String} text
3748
+ * @return {Object, Boolean} the rule, or null.
3749
+ */
3750
+ var fromText = function (text, language) {
3751
+ if (language === void 0) { language = i18n; }
3752
+ return new src["default"](parseText(text, language) || undefined);
3753
+ };
3754
+ var common = [
3755
+ 'count',
3756
+ 'until',
3757
+ 'interval',
3758
+ 'byweekday',
3759
+ 'bymonthday',
3760
+ 'bymonth'
3761
+ ];
3762
+ totext.IMPLEMENTED = [];
3763
+ totext.IMPLEMENTED[src["default"].HOURLY] = common;
3764
+ totext.IMPLEMENTED[src["default"].MINUTELY] = common;
3765
+ totext.IMPLEMENTED[src["default"].DAILY] = ['byhour'].concat(common);
3766
+ totext.IMPLEMENTED[src["default"].WEEKLY] = common;
3767
+ totext.IMPLEMENTED[src["default"].MONTHLY] = common;
3768
+ totext.IMPLEMENTED[src["default"].YEARLY] = ['byweekno', 'byyearday'].concat(common);
3769
+ // =============================================================================
3770
+ // Export
3771
+ // =============================================================================
3772
+ var toText = function (rrule, gettext, language, dateFormatter) {
3773
+ return new totext(rrule, gettext, language, dateFormatter).toString();
3774
+ };
3775
+ var isFullyConvertible = totext.isFullyConvertible;
3776
+
3777
+
3778
+
3779
+ /***/ })
3780
+ /******/ ]);
3781
+ });
3782
+ //# sourceMappingURL=rrule.js.map