@diagrammo/dgmo 0.50.1 → 0.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/dist/advanced.d.ts +6640 -0
  2. package/dist/advanced.js +207 -161
  3. package/dist/{analyzer-UYKBXAKR.js → analyzer-BJ54GIFB.js} +3 -3
  4. package/dist/auto.css +31 -8
  5. package/dist/auto.d.ts +60 -0
  6. package/dist/auto.js +169 -133
  7. package/dist/auto.mjs +2245 -1030
  8. package/dist/block.css +28 -8
  9. package/dist/block.d.ts +130 -0
  10. package/dist/block.js +103 -68
  11. package/dist/{charts-d3-LR6D3D7A.js → charts-d3-7E4B4IMW.js} +9 -9
  12. package/dist/{chunk-6IAA2QQ2.js → chunk-2EQMXBBQ.js} +2 -2
  13. package/dist/{chunk-XJLKLU4D.js → chunk-2ILHQOL3.js} +3 -3
  14. package/dist/{chunk-SXRTRMEE.js → chunk-2UJSV2VT.js} +3 -3
  15. package/dist/{chunk-LE4MYMLI.js → chunk-32XPAAET.js} +5 -5
  16. package/dist/{chunk-NU3XLTGP.js → chunk-332ZR4QU.js} +4 -4
  17. package/dist/{chunk-F7BFXWNQ.js → chunk-3JLKYGBQ.js} +2 -2
  18. package/dist/{chunk-QROYX7TT.js → chunk-3LV2NCB6.js} +3 -3
  19. package/dist/{chunk-ZAD4HV2G.js → chunk-3ODS2VGL.js} +99 -99
  20. package/dist/{chunk-3XGZF2QJ.js → chunk-3YSQZ75W.js} +6 -6
  21. package/dist/{chunk-FJUNPCYI.js → chunk-467TVMQL.js} +2 -2
  22. package/dist/{chunk-HHXOONLX.js → chunk-4B5YISOR.js} +38 -1
  23. package/dist/{chunk-6HJBFVLO.js → chunk-4QZ43D7I.js} +3 -3
  24. package/dist/{chunk-4S52SK6G.js → chunk-4VWJ4LW2.js} +15 -8
  25. package/dist/chunk-4XFBQT5O.js +35 -0
  26. package/dist/{chunk-2C56LEML.js → chunk-5F5ELR3V.js} +3 -3
  27. package/dist/{chunk-EAMEADTV.js → chunk-5PDTIBLV.js} +83 -21
  28. package/dist/{chunk-C2CVAM3U.js → chunk-5PZT4DQG.js} +160 -87
  29. package/dist/{chunk-IAEC4KLA.js → chunk-5QKQSSPO.js} +2 -2
  30. package/dist/{chunk-5OWVC2A6.js → chunk-5SVOCD5W.js} +6 -6
  31. package/dist/{chunk-VBYSIOOY.js → chunk-5WPNFSXP.js} +3 -3
  32. package/dist/{chunk-4MJ7M6YL.js → chunk-5X6YQA2J.js} +7 -7
  33. package/dist/{chunk-JJUOHGX2.js → chunk-65WJYYKJ.js} +4 -4
  34. package/dist/{chunk-3UIKSPFB.js → chunk-6BQFET7X.js} +3 -3
  35. package/dist/{chunk-U2HGPLZS.js → chunk-6H7O2OPM.js} +14 -1
  36. package/dist/{chunk-DZXYF2F5.js → chunk-6K2M4VSR.js} +3 -3
  37. package/dist/{chunk-PGEGPSCZ.js → chunk-6MNGECP2.js} +2 -2
  38. package/dist/{chunk-3XPUDB7B.js → chunk-6NFYEQDX.js} +266 -38
  39. package/dist/{chunk-4XK3FLFB.js → chunk-6NYWYNBI.js} +3 -3
  40. package/dist/{chunk-TWQUYVP3.js → chunk-7DF4J4RL.js} +4 -4
  41. package/dist/{chunk-H73FP42Q.js → chunk-7DYOELRK.js} +3 -3
  42. package/dist/{chunk-L3UHP6TD.js → chunk-7L4UJOY6.js} +1 -2
  43. package/dist/{chunk-QJP6PG7F.js → chunk-AB7INMR5.js} +9 -9
  44. package/dist/{chunk-3LKM6FMW.js → chunk-AE7II3E3.js} +2 -2
  45. package/dist/{chunk-BTUTZMPT.js → chunk-AFIEPDLX.js} +97 -42
  46. package/dist/chunk-APKUAJ2L.js +220 -0
  47. package/dist/{chunk-X6EZPSW6.js → chunk-AXW3M6OQ.js} +7 -7
  48. package/dist/{chunk-66RUL3XF.js → chunk-B63YB7X3.js} +5 -5
  49. package/dist/{chunk-DSWVNQVS.js → chunk-BGP54HVR.js} +4 -59
  50. package/dist/{chunk-3NODSS6A.js → chunk-BYJBIALT.js} +7 -7
  51. package/dist/{chunk-3YPY3OXD.js → chunk-CC4YRBWV.js} +2 -2
  52. package/dist/{chunk-HLJVEAOF.js → chunk-DY7XLRHK.js} +8 -33
  53. package/dist/{chunk-OMNGQPEZ.js → chunk-E7Y3SYKW.js} +3 -3
  54. package/dist/{chunk-HTMN2Z6U.js → chunk-EDA6C7MV.js} +50 -7
  55. package/dist/{chunk-7L3R6I3U.js → chunk-ENRS56GC.js} +3 -3
  56. package/dist/{chunk-2KGXHFYK.js → chunk-EXOQP75F.js} +7 -7
  57. package/dist/{chunk-BBGDM4NQ.js → chunk-F3FYUFUH.js} +26 -8
  58. package/dist/{chunk-GL5UZ6NY.js → chunk-FC5I2KXV.js} +3 -3
  59. package/dist/{chunk-VVW3F3MD.js → chunk-FTBZV6NE.js} +9 -9
  60. package/dist/{chunk-7QKLIMRZ.js → chunk-G3PF3S7P.js} +41 -46
  61. package/dist/{chunk-J6K7RP6P.js → chunk-GD6L76WD.js} +3 -3
  62. package/dist/{chunk-I2WKW7C7.js → chunk-GGHRAITI.js} +3 -3
  63. package/dist/{chunk-YIA4LEX4.js → chunk-GNSFLJAA.js} +96 -4
  64. package/dist/{chunk-IUMPEA64.js → chunk-GROLTAWZ.js} +4 -4
  65. package/dist/{chunk-Q4V4XQWV.js → chunk-GTWKD3QT.js} +2 -2
  66. package/dist/{chunk-F2L5GCQ4.js → chunk-GU46PPT3.js} +3 -3
  67. package/dist/{chunk-6IUAK7RZ.js → chunk-H6PI3KJT.js} +2 -2
  68. package/dist/{chunk-SCQ5VPUF.js → chunk-HFMYN6N2.js} +2 -2
  69. package/dist/{chunk-GKC3HILQ.js → chunk-I2QZFCS2.js} +27 -4
  70. package/dist/{chunk-MCZ5LBZD.js → chunk-IE477RQZ.js} +7 -7
  71. package/dist/{chunk-3Y2DRD7S.js → chunk-IEDMFNU7.js} +3 -3
  72. package/dist/{chunk-M5RXSRO2.js → chunk-IEWG6J7C.js} +4 -4
  73. package/dist/{chunk-P7CE7LXL.js → chunk-IUJODQKX.js} +6 -6
  74. package/dist/{chunk-NWED7CYO.js → chunk-IUO34HKW.js} +6 -6
  75. package/dist/{chunk-NX4EQS3U.js → chunk-J76PIKAT.js} +2 -2
  76. package/dist/{chunk-O7WP4ZD4.js → chunk-JED6ZDEE.js} +2 -2
  77. package/dist/{chunk-6BFZKBGD.js → chunk-JJXGQIRV.js} +2 -2
  78. package/dist/{chunk-O7NUCTFU.js → chunk-JM4LEPY3.js} +2 -2
  79. package/dist/{chunk-VDOOQZUD.js → chunk-JSSX2SX4.js} +4 -4
  80. package/dist/{chunk-SQLNBA64.js → chunk-KFNWFNAA.js} +3 -3
  81. package/dist/{chunk-VVZRV54S.js → chunk-KJGG2JKQ.js} +143 -82
  82. package/dist/{chunk-OTAL43EH.js → chunk-LV4BETUU.js} +8 -2
  83. package/dist/{chunk-VUJGMJE6.js → chunk-MVN25IF6.js} +4 -4
  84. package/dist/{chunk-CLD2OKV7.js → chunk-MX2EY5Y7.js} +2 -2
  85. package/dist/{chunk-Y4RNXEAO.js → chunk-ND76YJCN.js} +139 -25
  86. package/dist/{chunk-KFZYNWWO.js → chunk-NEQ6GJXB.js} +4 -4
  87. package/dist/{chunk-PFHVU7UA.js → chunk-NI3XQBPB.js} +2 -2
  88. package/dist/{chunk-WW32K72E.js → chunk-OJTXTQA2.js} +9 -9
  89. package/dist/{chunk-YNRDWYZP.js → chunk-OQKP2X3D.js} +170 -51
  90. package/dist/{chunk-AHGF2YYA.js → chunk-OTOHI4JO.js} +2 -2
  91. package/dist/{chunk-HEVYAHLW.js → chunk-OU7HLO7I.js} +4 -4
  92. package/dist/{chunk-GBE54KY6.js → chunk-OZPBJM5Q.js} +3 -3
  93. package/dist/{chunk-EOFPYPAU.js → chunk-P3NRSSUU.js} +51 -11
  94. package/dist/{chunk-TSA237IM.js → chunk-PZDBOK2Q.js} +2 -2
  95. package/dist/{chunk-3P2DKJCG.js → chunk-Q62FEYK3.js} +2 -2
  96. package/dist/{chunk-DFTFPYUD.js → chunk-QHI5XVUJ.js} +7 -7
  97. package/dist/{chunk-HQCHYB5F.js → chunk-QOOUC2J5.js} +2 -2
  98. package/dist/{chunk-XDXNDSKO.js → chunk-QZPEGJOM.js} +5 -2
  99. package/dist/{chunk-TN35C5KM.js → chunk-RAHVMKBG.js} +2 -2
  100. package/dist/chunk-RBDIYLA5.js +267 -0
  101. package/dist/{chunk-OTQKUHRS.js → chunk-RBHWPDBB.js} +3 -3
  102. package/dist/{chunk-BH3UYK36.js → chunk-RLFVAKEO.js} +3 -3
  103. package/dist/{chunk-3LH5CLP4.js → chunk-RXKTSFDL.js} +150 -5
  104. package/dist/{chunk-RZ6YKEUJ.js → chunk-TK2VQQX2.js} +6 -6
  105. package/dist/{chunk-I7F2A35O.js → chunk-TMACGPW5.js} +25 -47
  106. package/dist/{chunk-5GJYGP5Z.js → chunk-TRM2J7ZN.js} +8 -8
  107. package/dist/{chunk-BCYVE3N5.js → chunk-TYS6CSS5.js} +2 -2
  108. package/dist/{chunk-7PQYTZMA.js → chunk-U5SI5NIM.js} +95 -232
  109. package/dist/{chunk-KHEYDLMT.js → chunk-VB4UJ3H2.js} +2 -2
  110. package/dist/{chunk-HGN652MU.js → chunk-VL2O2F3W.js} +2 -2
  111. package/dist/{chunk-ONA5KPV3.js → chunk-VNSXLA6G.js} +4 -4
  112. package/dist/{chunk-CMCR5WBW.js → chunk-WBRZJOEC.js} +3 -3
  113. package/dist/{chunk-5LWQH6QV.js → chunk-WCT3NYCV.js} +1 -1
  114. package/dist/{chunk-T4VOVZT5.js → chunk-WJ7RW65H.js} +4 -4
  115. package/dist/{chunk-SCHXJTZL.js → chunk-WQLMU7VG.js} +2 -2
  116. package/dist/{chunk-C4GQDB5L.js → chunk-WRNFDFPU.js} +2 -2
  117. package/dist/{chunk-66NVRO4K.js → chunk-X7EC3L2H.js} +7 -7
  118. package/dist/{chunk-QXKWYZNR.js → chunk-XEQXCIBC.js} +3 -3
  119. package/dist/{chunk-C63UWAKM.js → chunk-Y2ZE3MSG.js} +2 -2
  120. package/dist/{chunk-FA6K3FWM.js → chunk-Y6GBQTBK.js} +6 -6
  121. package/dist/{chunk-7UEMZREK.js → chunk-YAA6IID3.js} +2 -2
  122. package/dist/{chunk-PZFVK3IH.js → chunk-YGJZWZTY.js} +2 -2
  123. package/dist/{chunk-7TV5Y53Y.js → chunk-ZJ3LS7DW.js} +3 -3
  124. package/dist/{chunk-PH5X4GIP.js → chunk-ZO27FGJS.js} +2 -2
  125. package/dist/cli.cjs +163 -147
  126. package/dist/clock.js +91 -5
  127. package/dist/countdown.js +208 -82
  128. package/dist/dgmo-router-Y2VEX46B.js +86 -0
  129. package/dist/dimensions-F7B5C4BJ.js +22 -0
  130. package/dist/editor.js +14 -1
  131. package/dist/element.d.ts +68 -0
  132. package/dist/element.js +170 -134
  133. package/dist/element.mjs +2209 -1015
  134. package/dist/{flowchart-parser-OE4WHLTF.js → flowchart-parser-MY53QWTZ.js} +4 -4
  135. package/dist/{flowchart-renderer-GPCSMTOR.js → flowchart-renderer-AQSMEMYF.js} +8 -8
  136. package/dist/highlight.js +14 -1
  137. package/dist/index.d.ts +185 -0
  138. package/dist/index.js +57 -53
  139. package/dist/{layout-7SKMFYHL.js → layout-46N4JJYK.js} +5 -5
  140. package/dist/layout-4DIUOX2T.js +14 -0
  141. package/dist/{layout-7H4H46CS.js → layout-7QXCNOVS.js} +3 -3
  142. package/dist/{layout-NXG63LWH.js → layout-AM2JWW3X.js} +4 -4
  143. package/dist/{layout-7MZ5NF2N.js → layout-CBCLPMSG.js} +5 -5
  144. package/dist/{layout-DC4TVXER.js → layout-EE6GE46Y.js} +5 -5
  145. package/dist/{layout-FGQWRYYW.js → layout-F4WO357A.js} +3 -3
  146. package/dist/layout-G23F7LDH.js +9 -0
  147. package/dist/{layout-QNUQLEHU.js → layout-HYZPWAK5.js} +3 -3
  148. package/dist/{layout-FWODLIMP.js → layout-JDJAEQ3P.js} +6 -6
  149. package/dist/layout-MUPRALE5.js +14 -0
  150. package/dist/{layout-34CLNICW.js → layout-OAC4PEAC.js} +5 -5
  151. package/dist/{layout-5BG6DFCU.js → layout-YVTNOTN4.js} +6 -6
  152. package/dist/{layout-PUQCB6AN.js → layout-ZDOSXL5G.js} +7 -7
  153. package/dist/{layout-search-QS44PI5R.js → layout-search-55FU6HD3.js} +6 -157
  154. package/dist/map-data/gazetteer.json +1 -1
  155. package/dist/{parser-36HVKU5U.js → parser-2Q2T4C3B.js} +6 -5
  156. package/dist/{parser-B5FVS7O6.js → parser-3A42DZ72.js} +3 -3
  157. package/dist/{parser-CSFUN3CT.js → parser-4RFTKAQX.js} +5 -4
  158. package/dist/{parser-IJBMRXMC.js → parser-57ILIFZ2.js} +5 -5
  159. package/dist/{parser-DFFEDKHH.js → parser-5A2UWU6B.js} +3 -3
  160. package/dist/{parser-H3XEPFPV.js → parser-5PDYJGWA.js} +4 -4
  161. package/dist/{parser-O4HIUN6G.js → parser-6BJEXUFX.js} +4 -4
  162. package/dist/{parser-MTOMTWTD.js → parser-6ZKABF5S.js} +6 -5
  163. package/dist/{parser-WAV5JRPT.js → parser-AIMHGJRR.js} +4 -4
  164. package/dist/{parser-TXND652E.js → parser-AZJ25OKK.js} +4 -4
  165. package/dist/{parser-4AI5ZN5F.js → parser-B77S5SZM.js} +3 -3
  166. package/dist/{parser-IBWNAPY4.js → parser-BEPSWJAD.js} +3 -3
  167. package/dist/{parser-D5VILGN2.js → parser-BKI42XBQ.js} +4 -4
  168. package/dist/{parser-LWKKBNSA.js → parser-C3D7MVXY.js} +3 -3
  169. package/dist/{parser-HYRTF3DO.js → parser-CDG7CHV5.js} +3 -3
  170. package/dist/{parser-CVMEDULU.js → parser-CZOJ7XQ6.js} +4 -4
  171. package/dist/{parser-AXKBDGNO.js → parser-E2RL6JYF.js} +5 -5
  172. package/dist/{parser-PSA4UBSP.js → parser-EH5VE7ZN.js} +4 -4
  173. package/dist/{parser-K3XXLMUW.js → parser-FQ6GZFMR.js} +4 -4
  174. package/dist/{parser-RV4M6AS2.js → parser-GKLZKEIK.js} +4 -4
  175. package/dist/{parser-MPCE5JBG.js → parser-H6ABKHZZ.js} +4 -4
  176. package/dist/{parser-RZPVAQVX.js → parser-I6GGFKOQ.js} +4 -3
  177. package/dist/{parser-W4PQUGX3.js → parser-JA7JQ7NF.js} +4 -4
  178. package/dist/{parser-5OXGPNBF.js → parser-KKTJ6M3Y.js} +5 -5
  179. package/dist/parser-OK22AC6Y.js +14 -0
  180. package/dist/{parser-4NO6VZ6S.js → parser-OK2ILHRT.js} +4 -4
  181. package/dist/{parser-YS7TOS2K.js → parser-OUTPNJWC.js} +3 -3
  182. package/dist/{parser-KCR2WS3V.js → parser-PORDUX5E.js} +4 -4
  183. package/dist/{parser-VKOJM7KS.js → parser-SRVFR7PM.js} +4 -4
  184. package/dist/{parser-TGQZJ5OT.js → parser-UKFFZCFJ.js} +4 -4
  185. package/dist/{parser-JJR52VAT.js → parser-UMWPLORP.js} +5 -5
  186. package/dist/{parser-AGVYTQXV.js → parser-Z4TZV2CB.js} +4 -4
  187. package/dist/{renderer-A5VE5BCI.js → renderer-2AUFT3E2.js} +8 -8
  188. package/dist/{renderer-FPE3J5VZ.js → renderer-2HTNBIF2.js} +11 -11
  189. package/dist/{renderer-R2WNIC2C.js → renderer-3K3IB7D5.js} +8 -8
  190. package/dist/{renderer-2AZ5HJFK.js → renderer-3YNIWF5I.js} +4 -4
  191. package/dist/{renderer-PJM35LJN.js → renderer-3YPZHMOU.js} +3 -3
  192. package/dist/{renderer-JCCHNECZ.js → renderer-4WR6WMVF.js} +9 -9
  193. package/dist/{renderer-HDCCZURL.js → renderer-66MERVQ2.js} +9 -9
  194. package/dist/{renderer-2QPMJ2DA.js → renderer-6RKQPNJI.js} +9 -9
  195. package/dist/{renderer-FYSVXL7M.js → renderer-ARMJBP6C.js} +11 -11
  196. package/dist/{renderer-6OKF44KS.js → renderer-CO2DW7S7.js} +13 -13
  197. package/dist/{renderer-BSR2O2H6.js → renderer-EDJ2O4S5.js} +13 -12
  198. package/dist/{renderer-CYB4LK3G.js → renderer-F7U3MFCV.js} +9 -9
  199. package/dist/{renderer-72LGR2YF.js → renderer-GD2COXVL.js} +4 -2
  200. package/dist/{renderer-B5TBNZJE.js → renderer-GQIESYEM.js} +8 -8
  201. package/dist/{renderer-ODUUOPVT.js → renderer-HCKJDFXD.js} +13 -13
  202. package/dist/{renderer-QAOBLRXV.js → renderer-HYGHO4SJ.js} +10 -10
  203. package/dist/{renderer-5DSEWF74.js → renderer-JC3RDUT7.js} +8 -8
  204. package/dist/{renderer-7RH2SI3B.js → renderer-KQB7UGDS.js} +3 -3
  205. package/dist/{renderer-45PSOL3E.js → renderer-NKJ24TEA.js} +5 -5
  206. package/dist/{renderer-AUW2BE6G.js → renderer-OYO67VZK.js} +9 -9
  207. package/dist/{renderer-DAXMXIKD.js → renderer-QIWVHWZO.js} +3 -3
  208. package/dist/{renderer-PSMMZCKH.js → renderer-QRWACQRI.js} +8 -8
  209. package/dist/{renderer-4ITCHBT7.js → renderer-QXGN5H3A.js} +5 -5
  210. package/dist/renderer-QXPP4TA2.js +27 -0
  211. package/dist/{renderer-KS7YZJE2.js → renderer-RGIYOTKJ.js} +10 -10
  212. package/dist/{renderer-FF24KZCI.js → renderer-RHT4MHFU.js} +8 -8
  213. package/dist/{renderer-PPIHO5FI.js → renderer-RYR3TJ46.js} +12 -11
  214. package/dist/{renderer-NGXZTRK6.js → renderer-SRKDNDFB.js} +8 -8
  215. package/dist/{renderer-SBS3YWU5.js → renderer-TGTUABCI.js} +8 -8
  216. package/dist/{renderer-7SD6MSBS.js → renderer-TXJFKPOG.js} +11 -11
  217. package/dist/{renderer-HVCU2C3Z.js → renderer-UV6MI64M.js} +3 -3
  218. package/dist/renderer-radial-FWABAZHB.js +21 -0
  219. package/dist/{resolver-FHBCO3PL.js → resolver-EMTGNR3D.js} +4 -3
  220. package/dist/{state-parser-3REXRK3R.js → state-parser-6T6CNMPX.js} +4 -4
  221. package/dist/{state-renderer-XYLNRWXR.js → state-renderer-AWZ3ECAX.js} +8 -8
  222. package/dist/themes-32xj5ZTW.d.ts +943 -0
  223. package/docs/language-reference.md +98 -10
  224. package/gallery/fixtures/clock.dgmo +3 -3
  225. package/gallery/fixtures/countdown-far.dgmo +2 -0
  226. package/gallery/fixtures/countdown-tz.dgmo +5 -0
  227. package/package.json +1 -1
  228. package/dist/dgmo-router-YTU3ENAX.js +0 -84
  229. package/dist/dimensions-OTBKC5M6.js +0 -22
  230. package/dist/layout-6RDJHS6E.js +0 -9
  231. package/dist/layout-J36454XU.js +0 -14
  232. package/dist/layout-LD6XTLD6.js +0 -14
  233. package/dist/parser-4WQQQXCG.js +0 -13
  234. package/dist/renderer-UYMQQCJK.js +0 -24
  235. package/dist/renderer-radial-F7X5F2VU.js +0 -21
@@ -0,0 +1,267 @@
1
+ // src/utils/date.ts
2
+ var MONTHS_FULL = [
3
+ "january",
4
+ "february",
5
+ "march",
6
+ "april",
7
+ "may",
8
+ "june",
9
+ "july",
10
+ "august",
11
+ "september",
12
+ "october",
13
+ "november",
14
+ "december"
15
+ ];
16
+ var MONTHS_ABBR = [
17
+ "jan",
18
+ "feb",
19
+ "mar",
20
+ "apr",
21
+ "may",
22
+ "jun",
23
+ "jul",
24
+ "aug",
25
+ "sep",
26
+ "oct",
27
+ "nov",
28
+ "dec"
29
+ ];
30
+ function monthNameToNum(raw) {
31
+ const t = raw.toLowerCase().replace(/\.$/, "");
32
+ let i = MONTHS_FULL.indexOf(t);
33
+ if (i >= 0) return i + 1;
34
+ i = MONTHS_ABBR.indexOf(t.slice(0, 3));
35
+ return i >= 0 ? i + 1 : 0;
36
+ }
37
+ var ERA_RE = /^(\d{1,4})(?:-(\d{2})(?:-(\d{2}))?)?\s+(BCE|BC|CE|AD)\b/i;
38
+ var ISO_RE = /^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?/;
39
+ var MONTH_D_RE = /^([A-Za-z]{3,9})\.?\s+(\d{1,2})(?:,?\s+(\d{4}))?/;
40
+ var D_MONTH_RE = /^(\d{1,2})\s+([A-Za-z]{3,9})\.?(?:\s+(\d{4}))?/;
41
+ var SLASH_RE = /^(\d{1,2})[/-](\d{1,2})(?:[/-](\d{2,4}))?/;
42
+ var TIME_RE = /^[T ](\d{1,2}):(\d{2})(?::(\d{2}))?/;
43
+ function matchTime(rest) {
44
+ const m = rest.match(TIME_RE);
45
+ if (!m) return { hour: 0, minute: 0, second: 0, hasTime: false, consumed: 0 };
46
+ const hour = parseInt(m[1], 10);
47
+ const minute = parseInt(m[2], 10);
48
+ const second = m[3] !== void 0 ? parseInt(m[3], 10) : 0;
49
+ const ok = hour <= 23 && minute <= 59 && second <= 59;
50
+ return {
51
+ hour,
52
+ minute,
53
+ second,
54
+ hasTime: true,
55
+ consumed: m[0].length,
56
+ invalid: ok ? void 0 : m[0].trim()
57
+ };
58
+ }
59
+ function dayToken(year, month, day, sign = 1) {
60
+ return {
61
+ sign,
62
+ year,
63
+ month,
64
+ day,
65
+ hour: 0,
66
+ minute: 0,
67
+ second: 0,
68
+ grain: 3,
69
+ hasTime: false,
70
+ invalidTime: void 0
71
+ };
72
+ }
73
+ function parseDateToken(input, opts = {}) {
74
+ const order = opts.dateOrder ?? "mdy";
75
+ const era = input.match(ERA_RE);
76
+ if (era) {
77
+ const marker = era[4].toUpperCase();
78
+ const sign = marker === "BCE" || marker === "BC" ? -1 : 1;
79
+ const grain = era[3] ? 3 : era[2] ? 2 : 1;
80
+ return {
81
+ token: {
82
+ sign,
83
+ year: parseInt(era[1], 10),
84
+ month: era[2] ? parseInt(era[2], 10) : 1,
85
+ day: era[3] ? parseInt(era[3], 10) : 1,
86
+ hour: 0,
87
+ minute: 0,
88
+ second: 0,
89
+ grain,
90
+ hasTime: false
91
+ },
92
+ consumed: era[0].length
93
+ };
94
+ }
95
+ const iso = input.match(ISO_RE);
96
+ if (iso) {
97
+ const grain = iso[3] ? 3 : iso[2] ? 2 : 1;
98
+ let consumed = iso[0].length;
99
+ let time = {
100
+ hour: 0,
101
+ minute: 0,
102
+ second: 0,
103
+ hasTime: false,
104
+ consumed: 0
105
+ };
106
+ if (grain === 3) {
107
+ time = matchTime(input.slice(consumed));
108
+ consumed += time.consumed;
109
+ }
110
+ return {
111
+ token: {
112
+ sign: 1,
113
+ year: parseInt(iso[1], 10),
114
+ month: iso[2] ? parseInt(iso[2], 10) : 1,
115
+ day: iso[3] ? parseInt(iso[3], 10) : 1,
116
+ hour: time.hour,
117
+ minute: time.minute,
118
+ second: time.second,
119
+ grain,
120
+ hasTime: time.hasTime,
121
+ invalidTime: time.invalid
122
+ },
123
+ consumed
124
+ };
125
+ }
126
+ const md = input.match(MONTH_D_RE);
127
+ if (md && monthNameToNum(md[1]) > 0) {
128
+ const mo = monthNameToNum(md[1]);
129
+ const day = parseInt(md[2], 10);
130
+ const year = md[3] ? parseInt(md[3], 10) : null;
131
+ const tok = dayToken(year, mo, day);
132
+ const time = matchTime(input.slice(md[0].length));
133
+ tok.hour = time.hour;
134
+ tok.minute = time.minute;
135
+ tok.second = time.second;
136
+ tok.hasTime = time.hasTime;
137
+ tok.invalidTime = time.invalid;
138
+ return { token: tok, consumed: md[0].length + time.consumed };
139
+ }
140
+ const dm = input.match(D_MONTH_RE);
141
+ if (dm && monthNameToNum(dm[2]) > 0) {
142
+ const mo = monthNameToNum(dm[2]);
143
+ const day = parseInt(dm[1], 10);
144
+ const year = dm[3] ? parseInt(dm[3], 10) : null;
145
+ const tok = dayToken(year, mo, day);
146
+ const time = matchTime(input.slice(dm[0].length));
147
+ tok.hour = time.hour;
148
+ tok.minute = time.minute;
149
+ tok.second = time.second;
150
+ tok.hasTime = time.hasTime;
151
+ tok.invalidTime = time.invalid;
152
+ return { token: tok, consumed: dm[0].length + time.consumed };
153
+ }
154
+ const sl = input.match(SLASH_RE);
155
+ if (sl) {
156
+ const a = parseInt(sl[1], 10);
157
+ const b = parseInt(sl[2], 10);
158
+ let year = null;
159
+ if (sl[3]) {
160
+ year = parseInt(sl[3], 10);
161
+ if (sl[3].length === 2) year += 2e3;
162
+ }
163
+ let month;
164
+ let day;
165
+ if (a > 12 && b <= 12) {
166
+ day = a;
167
+ month = b;
168
+ } else if (b > 12 && a <= 12) {
169
+ month = a;
170
+ day = b;
171
+ } else if (order === "dmy") {
172
+ day = a;
173
+ month = b;
174
+ } else {
175
+ month = a;
176
+ day = b;
177
+ }
178
+ if (month < 1 || month > 12 || day < 1 || day > 31) return null;
179
+ const tok = dayToken(year, month, day);
180
+ const time = matchTime(input.slice(sl[0].length));
181
+ tok.hour = time.hour;
182
+ tok.minute = time.minute;
183
+ tok.second = time.second;
184
+ tok.hasTime = time.hasTime;
185
+ tok.invalidTime = time.invalid;
186
+ return { token: tok, consumed: sl[0].length + time.consumed };
187
+ }
188
+ return null;
189
+ }
190
+ function toInternal(token, resolvedYear) {
191
+ const y = token.year ?? resolvedYear;
192
+ const neg = token.sign < 0 ? "-" : "";
193
+ const yStr = String(y);
194
+ if (token.grain === 1) return `${neg}${yStr}`;
195
+ const mm = String(token.month).padStart(2, "0");
196
+ if (token.grain === 2) return `${neg}${yStr}-${mm}`;
197
+ const dd = String(token.day).padStart(2, "0");
198
+ let out = `${neg}${yStr}-${mm}-${dd}`;
199
+ if (token.hasTime) {
200
+ const hh = String(token.hour).padStart(2, "0");
201
+ const mi = String(token.minute).padStart(2, "0");
202
+ out += ` ${hh}:${mi}`;
203
+ if (token.second) out += `:${String(token.second).padStart(2, "0")}`;
204
+ }
205
+ return out;
206
+ }
207
+ function cmp(y, m, d, p) {
208
+ if (y !== p.y) return y - p.y;
209
+ if (m !== p.m) return m - p.m;
210
+ return d - p.d;
211
+ }
212
+ function resolveTokenYear(token, ctx) {
213
+ if (token.year != null) {
214
+ const signed = token.sign * token.year;
215
+ ctx.contextYear = signed;
216
+ ctx.prev = { y: signed, m: token.month, d: token.day };
217
+ return { internal: toInternal(token, token.year) };
218
+ }
219
+ let hint;
220
+ let error;
221
+ let y;
222
+ if (ctx.contextYear != null) {
223
+ y = ctx.contextYear;
224
+ } else if (ctx.noCurrentYear) {
225
+ error = "Date has no year and none can be derived. Add a full date, a `year 20XX` directive, or remove `no-current-year`.";
226
+ y = ctx.currentYear;
227
+ } else {
228
+ y = ctx.currentYear;
229
+ hint = "Date has no year; assuming the current year. Add `year 20XX` to make this diagram reproducible.";
230
+ }
231
+ if (ctx.prev && cmp(y, token.month, token.day, ctx.prev) < 0) {
232
+ y += 1;
233
+ }
234
+ ctx.contextYear = y;
235
+ ctx.prev = { y, m: token.month, d: token.day };
236
+ return { internal: toInternal(token, y), hint, error };
237
+ }
238
+ function makeYearContext(opts) {
239
+ const directiveYear = opts.directiveYear ?? null;
240
+ const seed = directiveYear ?? opts.prescanYear ?? null;
241
+ return {
242
+ order: opts.order ?? "mdy",
243
+ directiveYear,
244
+ currentYear: opts.currentYear ?? (/* @__PURE__ */ new Date()).getFullYear(),
245
+ noCurrentYear: opts.noCurrentYear ?? false,
246
+ contextYear: seed,
247
+ prev: null
248
+ };
249
+ }
250
+ function normalizeDate(raw, opts = {}) {
251
+ const s = raw.trim();
252
+ const res = parseDateToken(s, { dateOrder: opts.order });
253
+ if (!res) return null;
254
+ if (res.consumed !== s.length) return null;
255
+ if (res.token.invalidTime) return null;
256
+ const year = res.token.year ?? opts.year ?? opts.currentYear ?? (/* @__PURE__ */ new Date()).getFullYear();
257
+ return toInternal(res.token, year);
258
+ }
259
+
260
+ export {
261
+ parseDateToken,
262
+ toInternal,
263
+ resolveTokenYear,
264
+ makeYearContext,
265
+ normalizeDate
266
+ };
267
+ //# sourceMappingURL=chunk-RBDIYLA5.js.map
@@ -7,7 +7,7 @@ import {
7
7
  tagAttrKey,
8
8
  validateTagGroupNames,
9
9
  validateTagValues
10
- } from "./chunk-FJUNPCYI.js";
10
+ } from "./chunk-467TVMQL.js";
11
11
  import {
12
12
  normalizeName
13
13
  } from "./chunk-NOTA6TEI.js";
@@ -20,7 +20,7 @@ import {
20
20
  splitNameAndMeta,
21
21
  warnUnknownMetaKeys,
22
22
  withTagAliases
23
- } from "./chunk-OTAL43EH.js";
23
+ } from "./chunk-LV4BETUU.js";
24
24
  import {
25
25
  formatDgmoError,
26
26
  makeDgmoError,
@@ -351,4 +351,4 @@ export {
351
351
  looksLikeOrg,
352
352
  parseOrg
353
353
  };
354
- //# sourceMappingURL=chunk-OTQKUHRS.js.map
354
+ //# sourceMappingURL=chunk-RBHWPDBB.js.map
@@ -8,7 +8,7 @@ import {
8
8
  stripDefaultModifier,
9
9
  validateTagGroupNames,
10
10
  validateTagValues
11
- } from "./chunk-FJUNPCYI.js";
11
+ } from "./chunk-467TVMQL.js";
12
12
  import {
13
13
  parseArrow,
14
14
  parseInArrowLabel
@@ -26,7 +26,7 @@ import {
26
26
  splitNameAndMeta,
27
27
  warnUnknownMetaKeys,
28
28
  withTagAliases
29
- } from "./chunk-OTAL43EH.js";
29
+ } from "./chunk-LV4BETUU.js";
30
30
  import {
31
31
  NAME_DIAGNOSTIC_CODES,
32
32
  formatDgmoError,
@@ -1022,4 +1022,4 @@ export {
1022
1022
  parseSequenceDgmo,
1023
1023
  looksLikeSequence
1024
1024
  };
1025
- //# sourceMappingURL=chunk-BH3UYK36.js.map
1025
+ //# sourceMappingURL=chunk-RLFVAKEO.js.map
@@ -1,12 +1,25 @@
1
+ import {
2
+ buildSwatches
3
+ } from "./chunk-4XFBQT5O.js";
1
4
  import {
2
5
  layoutMap,
3
6
  mapLegendConfig,
4
7
  mapLegendGroups,
5
8
  parsePathRings
6
- } from "./chunk-LE4MYMLI.js";
9
+ } from "./chunk-32XPAAET.js";
7
10
  import {
8
11
  renderIntegratedLegend
9
- } from "./chunk-HEVYAHLW.js";
12
+ } from "./chunk-OU7HLO7I.js";
13
+ import {
14
+ parseClock
15
+ } from "./chunk-6NFYEQDX.js";
16
+ import {
17
+ fixedParts,
18
+ formatTime,
19
+ sunLine,
20
+ workStatus,
21
+ zoneParts
22
+ } from "./chunk-APKUAJ2L.js";
10
23
  import {
11
24
  TITLE_FONT_SIZE,
12
25
  TITLE_FONT_WEIGHT,
@@ -17,13 +30,132 @@ import {
17
30
  } from "./chunk-6KFWC4CO.js";
18
31
  import {
19
32
  measureText
20
- } from "./chunk-5LWQH6QV.js";
33
+ } from "./chunk-WCT3NYCV.js";
21
34
  import {
22
- mix
35
+ mix,
36
+ themeBaseBg
23
37
  } from "./chunk-P6T66CCZ.js";
24
38
 
25
39
  // src/map/renderer.ts
26
40
  import * as d3Selection from "d3-selection";
41
+
42
+ // src/map/clock-card.ts
43
+ var WEEKDAY_ABBR = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
44
+ var clamp = (v, lo, hi) => Math.max(lo, Math.min(hi, v));
45
+ function workFromDirectives(d) {
46
+ if (d.clockHours === void 0) return null;
47
+ const src = `clock
48
+ hours ${d.clockHours}` + (d.clockDays !== void 0 ? `
49
+ days ${d.clockDays}` : "");
50
+ const w = parseClock(src).work;
51
+ if (!w) return null;
52
+ return { startMin: w.startMin, endMin: w.endMin, days: w.days };
53
+ }
54
+ function partsFor(poi, now) {
55
+ return poi.tzFixedOffsetMin !== void 0 ? fixedParts(poi.tzFixedOffsetMin, now) : zoneParts(poi.tz, now);
56
+ }
57
+ function renderClockCards(gCards, layout, resolved, palette, isDark, now, frameW, frameH) {
58
+ const withTz = resolved.pois.filter((p) => p.tz !== void 0);
59
+ if (withTz.length === 0) return;
60
+ const byId = new Map(withTz.map((p) => [p.id, p]));
61
+ const baseBg = themeBaseBg(palette, isDark);
62
+ const muted = mix(palette.text, baseBg, 55);
63
+ const sw = buildSwatches(palette, muted);
64
+ const cardFill = mix(palette.text, palette.bg, 6);
65
+ const border = mix(palette.text, palette.bg, 32);
66
+ const work = workFromDirectives(resolved.directives);
67
+ const hours12 = true;
68
+ for (const lp of layout) {
69
+ const poi = byId.get(lp.id);
70
+ if (!poi) continue;
71
+ const parts = partsFor(poi, now);
72
+ const hasCoords = Number.isFinite(poi.lat) && Number.isFinite(poi.lon);
73
+ const isFixed = poi.tzFixedOffsetMin !== void 0;
74
+ const sun = !isFixed && hasCoords ? sunLine(now, poi.lat, poi.lon) : null;
75
+ const up = sun ? sun.up : parts.h >= 6 && parts.h < 18;
76
+ const ts = formatTime(parts.h, parts.m, parts.s, hours12);
77
+ const status = workStatus(parts, work);
78
+ const viewerWeekday = WEEKDAY_ABBR[new Date(now).getDay()];
79
+ const showWeekday = parts.weekday !== viewerWeekday;
80
+ const line2 = [showWeekday ? parts.weekday : null, status?.text].filter(Boolean).join(" \xB7 ");
81
+ const mainFont = 18;
82
+ const sf = 8;
83
+ const mainW = measureText(ts.main, mainFont);
84
+ const stackW = Math.max(
85
+ measureText(`:${ts.sec}`, sf),
86
+ ts.ap ? measureText(ts.ap, sf) : 0
87
+ );
88
+ const stackGap = 3;
89
+ const dotGap = 15;
90
+ const padX = 9;
91
+ const line1W = dotGap + mainW + stackGap + stackW;
92
+ const line2W = measureText(line2, 10.5);
93
+ const cardW = Math.max(line1W, line2W) + padX * 2;
94
+ const cardH = 44;
95
+ const leaderGap = 7;
96
+ const M = 6;
97
+ const cx = lp.cx;
98
+ const below = lp.cy - lp.r - leaderGap - cardH < M;
99
+ const cardTop = clamp(
100
+ below ? lp.cy + lp.r + leaderGap : lp.cy - lp.r - leaderGap - cardH,
101
+ M,
102
+ frameH - cardH - M
103
+ );
104
+ const cardLeft = clamp(cx - cardW / 2, M, frameW - cardW - M);
105
+ const g = gCards.append("g").attr("data-dgmo-clock", "").attr("data-dgmo-clock-zone", poi.tz).attr("data-dgmo-clock-hours12", hours12 ? "1" : "0").attr("data-dgmo-clock-sun", sun ? "1" : "0").attr("data-line-number", poi.lineNumber).attr("data-poi-clock", poi.id).attr("data-dgmo-clock-c-day", sw.day).attr("data-dgmo-clock-c-night", sw.night).attr("data-dgmo-clock-c-day-soft", sw.dayTint).attr("data-dgmo-clock-c-night-soft", sw.nightTint).attr("data-dgmo-clock-c-ok", sw.ok).attr("data-dgmo-clock-c-soon", sw.soon).attr("data-dgmo-clock-c-off", sw.off).attr("data-dgmo-clock-c-ok-soft", sw.okSoft).attr("data-dgmo-clock-c-soon-soft", sw.soonSoft).attr("data-dgmo-clock-c-off-soft", sw.offSoft);
106
+ if (hasCoords) {
107
+ g.attr("data-dgmo-clock-lat", poi.lat).attr(
108
+ "data-dgmo-clock-lon",
109
+ poi.lon
110
+ );
111
+ }
112
+ if (isFixed) g.attr("data-dgmo-clock-fixed-offset", poi.tzFixedOffsetMin);
113
+ if (work) {
114
+ g.attr("data-dgmo-clock-work-start", work.startMin).attr("data-dgmo-clock-work-end", work.endMin).attr(
115
+ "data-dgmo-clock-work-days",
116
+ WEEKDAY_ABBR.filter((d) => work.days[d]).join(",")
117
+ );
118
+ }
119
+ const leaderX = clamp(cx, cardLeft + 10, cardLeft + cardW - 10);
120
+ g.append("line").attr("x1", cx).attr("y1", below ? lp.cy + lp.r : lp.cy - lp.r).attr("x2", leaderX).attr("y2", below ? cardTop : cardTop + cardH).attr("stroke", border).attr("stroke-width", 1);
121
+ g.append("rect").attr("x", cardLeft).attr("y", cardTop).attr("width", cardW).attr("height", cardH).attr("rx", 6).attr("fill", cardFill).attr("stroke", border).attr("stroke-width", 1);
122
+ const dotCX = cardLeft + padX + 3.5;
123
+ const line1Y = cardTop + 20;
124
+ const dot = g.append("circle").attr("data-dgmo-clock-status-dot", "").attr("cx", dotCX).attr("cy", line1Y - mainFont * 0.35).attr("r", 3.5);
125
+ if (status) {
126
+ const dc = status.cls === "ok" ? sw.ok : status.cls === "soon" ? sw.soon : sw.off;
127
+ if (status.cls === "off") {
128
+ dot.attr("fill", "none").attr("stroke", dc).attr("stroke-width", 1.4);
129
+ } else {
130
+ dot.attr("fill", dc);
131
+ }
132
+ } else {
133
+ dot.attr("fill", up ? sw.day : sw.night);
134
+ }
135
+ const timeX = cardLeft + padX + dotGap;
136
+ g.append("text").attr("data-dgmo-clock-digital-part", "main").attr("x", timeX).attr("y", line1Y).attr("font-family", FONT_FAMILY).attr("fill", palette.text).attr("font-size", mainFont).attr("font-weight", 600).style("font-variant-numeric", "tabular-nums").text(ts.main);
137
+ const stackX = timeX + mainW + stackGap;
138
+ const capTop = line1Y - mainFont * 0.7;
139
+ g.append("text").attr("data-dgmo-clock-digital-part", "sec").attr("x", stackX).attr("y", capTop + sf * 0.72).attr("font-family", FONT_FAMILY).attr("fill", muted).attr("font-size", sf).style("font-variant-numeric", "tabular-nums").text(`:${ts.sec}`);
140
+ g.append("text").attr("data-dgmo-clock-digital-part", "ap").attr("x", stackX).attr("y", line1Y).attr("font-family", FONT_FAMILY).attr("fill", muted).attr("font-size", sf).text(ts.ap);
141
+ const line2Y = cardTop + 36;
142
+ const l2 = g.append("text").attr("x", cardLeft + padX).attr("y", line2Y).attr("font-family", FONT_FAMILY).attr("font-size", 10.5).attr("fill", muted);
143
+ let needSep = false;
144
+ if (showWeekday) {
145
+ l2.append("tspan").text(parts.weekday);
146
+ needSep = true;
147
+ }
148
+ if (status) {
149
+ if (needSep) l2.append("tspan").text(" \xB7 ");
150
+ l2.append("tspan").attr("data-dgmo-clock-status", "").attr(
151
+ "fill",
152
+ status.cls === "ok" ? sw.ok : status.cls === "soon" ? sw.soon : sw.off
153
+ ).text(status.text);
154
+ }
155
+ }
156
+ }
157
+
158
+ // src/map/renderer.ts
27
159
  var LABEL_FONT = 11;
28
160
  function pointInRing(px, py, ring) {
29
161
  let inside = false;
@@ -586,6 +718,19 @@ function renderMap(container, resolved, data, palette, isDark, onClickItem, expo
586
718
  );
587
719
  }
588
720
  }
721
+ if (resolved.pois.some((p) => p.tz !== void 0)) {
722
+ const gCards = svg.append("g").attr("class", "dgmo-map-clock-cards");
723
+ renderClockCards(
724
+ gCards,
725
+ layout.pois,
726
+ resolved,
727
+ palette,
728
+ isDark,
729
+ Date.now(),
730
+ width,
731
+ height
732
+ );
733
+ }
589
734
  if (layout.legend) {
590
735
  const legendY = (layout.title ? TITLE_Y + TITLE_FONT_SIZE : 0) + (layout.subtitle ? TITLE_FONT_SIZE : 0) + 8;
591
736
  const legendG = svg.append("g").attr("class", "dgmo-map-legend").attr("transform", `translate(0, ${legendY})`);
@@ -644,4 +789,4 @@ export {
644
789
  renderMap,
645
790
  renderMapForExport
646
791
  };
647
- //# sourceMappingURL=chunk-3LH5CLP4.js.map
792
+ //# sourceMappingURL=chunk-RXKTSFDL.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  renderIntegratedLegend
3
- } from "./chunk-HEVYAHLW.js";
3
+ } from "./chunk-OU7HLO7I.js";
4
4
  import {
5
5
  getMaxLegendReservedHeight
6
- } from "./chunk-7UEMZREK.js";
6
+ } from "./chunk-YAA6IID3.js";
7
7
  import {
8
8
  TITLE_FONT_SIZE,
9
9
  TITLE_FONT_WEIGHT,
@@ -14,10 +14,10 @@ import {
14
14
  } from "./chunk-6KFWC4CO.js";
15
15
  import {
16
16
  LEGEND_GROUP_GAP
17
- } from "./chunk-HQCHYB5F.js";
17
+ } from "./chunk-QOOUC2J5.js";
18
18
  import {
19
19
  measureText
20
- } from "./chunk-5LWQH6QV.js";
20
+ } from "./chunk-WCT3NYCV.js";
21
21
  import {
22
22
  isBlockNode
23
23
  } from "./chunk-NNAAJVBU.js";
@@ -27,7 +27,7 @@ import {
27
27
  import {
28
28
  resolveTagColor,
29
29
  tagAttrKey
30
- } from "./chunk-FJUNPCYI.js";
30
+ } from "./chunk-467TVMQL.js";
31
31
 
32
32
  // src/block/renderer.ts
33
33
  import * as d3Selection from "d3-selection";
@@ -359,4 +359,4 @@ export {
359
359
  renderBlock,
360
360
  authoredCollapsedIds
361
361
  };
362
- //# sourceMappingURL=chunk-RZ6YKEUJ.js.map
362
+ //# sourceMappingURL=chunk-TK2VQQX2.js.map
@@ -1,66 +1,44 @@
1
+ import {
2
+ parseDateToken,
3
+ toInternal
4
+ } from "./chunk-RBDIYLA5.js";
1
5
  import {
2
6
  TIMELINE_REGISTRY,
3
7
  splitNameAndMeta,
4
8
  warnUnknownMetaKeys,
5
9
  withTagAliases
6
- } from "./chunk-OTAL43EH.js";
10
+ } from "./chunk-LV4BETUU.js";
7
11
  import {
8
12
  makeDgmoError
9
13
  } from "./chunk-CXK4DZH3.js";
10
14
 
11
15
  // src/timeline/parser.ts
12
16
  var TIMELINE_DURATION_RE = /^(\d+(?:\.\d{1,2})?)(min|[dwmyhs])(\?)?$/;
13
- var DATE_RE = /^(\d{4}(?:-\d{2}(?:-\d{2})?)?)/;
14
- var TIME_RE = /^\s+(\d{1,2}:\d{2}(?::\d{2})?)/;
15
17
  var ARROW_RE = /^\s*(?:->|–>)\s*/;
16
- var ERA_DATE_RE = /^(\d{1,4}(?:-\d{2}(?:-\d{2})?)?)\s+(BCE|BC|CE|AD)\b/i;
17
- function parseTime(timeStr) {
18
- const [hStr, mStr, sStr] = timeStr.split(":");
19
- const h = parseInt(hStr, 10);
20
- const m = parseInt(mStr, 10);
21
- const s = sStr !== void 0 ? parseInt(sStr, 10) : 0;
22
- const valid = h >= 0 && h <= 23 && m >= 0 && m <= 59 && s >= 0 && s <= 59;
23
- return { valid, h, m, s };
24
- }
25
- function parseDateWithOptionalTime(input) {
26
- const eraMatch = input.match(ERA_DATE_RE);
27
- if (eraMatch) {
28
- const marker = eraMatch[2].toUpperCase();
29
- const bce = marker === "BCE" || marker === "BC";
30
- const date2 = (bce ? "-" : "") + eraMatch[1];
31
- return {
32
- date: date2,
33
- rest: input.slice(eraMatch[0].length),
34
- timeValid: true,
35
- invalidTime: void 0
36
- };
37
- }
38
- const dateMatch = input.match(DATE_RE);
39
- if (!dateMatch) return null;
40
- let date = dateMatch[1];
41
- let rest = input.slice(date.length);
42
- let timeValid = true;
43
- let invalidTime;
44
- const timeMatch = rest.match(TIME_RE);
45
- if (timeMatch) {
46
- const timeStr = timeMatch[1];
47
- const { valid } = parseTime(timeStr);
48
- timeValid = valid;
49
- if (!valid) invalidTime = timeStr;
50
- date = `${date} ${timeStr}`;
51
- rest = rest.slice(timeMatch[0].length);
52
- }
53
- return { date, rest, timeValid, invalidTime };
18
+ function parseDateWithOptionalTime(input, ctx) {
19
+ const res = parseDateToken(input, { dateOrder: ctx?.order });
20
+ if (!res) return null;
21
+ const { token, consumed } = res;
22
+ const internal = ctx?.resolve ? ctx.resolve(token).internal : toInternal(
23
+ token,
24
+ token.year ?? ctx?.currentYear ?? (/* @__PURE__ */ new Date()).getFullYear()
25
+ );
26
+ return {
27
+ date: internal,
28
+ rest: input.slice(consumed),
29
+ timeValid: !token.invalidTime,
30
+ invalidTime: token.invalidTime
31
+ };
54
32
  }
55
- function extractDatePrefix(line) {
56
- const startResult = parseDateWithOptionalTime(line);
33
+ function extractDatePrefix(line, ctx) {
34
+ const startResult = parseDateWithOptionalTime(line, ctx);
57
35
  if (!startResult) return null;
58
36
  const { date: startDate } = startResult;
59
37
  let { rest } = startResult;
60
38
  const arrowMatch = rest.match(ARROW_RE);
61
39
  if (arrowMatch) {
62
40
  rest = rest.slice(arrowMatch[0].length);
63
- const endResult = parseDateWithOptionalTime(rest);
41
+ const endResult = parseDateWithOptionalTime(rest, ctx);
64
42
  if (endResult) {
65
43
  let uncertain = false;
66
44
  let afterEnd = endResult.rest;
@@ -209,9 +187,9 @@ function parseTimelineDate(s) {
209
187
  const yearBase = p.sign * p.year;
210
188
  return yearBase + (p.month - 1) / 12 + (p.day - 1) / 365 + p.hour / 8760 + p.minute / 525600 + p.second / 31536e3;
211
189
  }
212
- function parseTimelineEventLine(line, lineNumber, currentGroup, groupMetadata, aliasMap, registry) {
190
+ function parseTimelineEventLine(line, lineNumber, currentGroup, groupMetadata, aliasMap, registry, dateCtx) {
213
191
  const diagnostics = [];
214
- const prefix = extractDatePrefix(line);
192
+ const prefix = extractDatePrefix(line, dateCtx);
215
193
  if (!prefix) {
216
194
  if (/^\d/.test(line)) {
217
195
  const firstToken = line.split(/\s/)[0];
@@ -336,4 +314,4 @@ export {
336
314
  parseTimelineDate,
337
315
  parseTimelineEventLine
338
316
  };
339
- //# sourceMappingURL=chunk-I7F2A35O.js.map
317
+ //# sourceMappingURL=chunk-TMACGPW5.js.map