@getontime/cli 4.2.1 → 4.3.1

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 (452) hide show
  1. package/client/assets/Backstage-D2lEbqUt.js +2 -0
  2. package/client/assets/Backstage-D2lEbqUt.js.br +0 -0
  3. package/client/assets/Backstage-D2lEbqUt.js.gz +0 -0
  4. package/client/assets/Backstage-D2lEbqUt.js.map +1 -0
  5. package/client/assets/Countdown-VV03STbF.js +2 -0
  6. package/client/assets/Countdown-VV03STbF.js.br +0 -0
  7. package/client/assets/Countdown-VV03STbF.js.gz +0 -0
  8. package/client/assets/Countdown-VV03STbF.js.map +1 -0
  9. package/client/assets/CustomTranslationModal-D1nM9W1Z.js +2 -0
  10. package/client/assets/CustomTranslationModal-D1nM9W1Z.js.br +0 -0
  11. package/client/assets/CustomTranslationModal-D1nM9W1Z.js.gz +0 -0
  12. package/client/assets/{CustomTranslationModal-CtBvokyt.js.map → CustomTranslationModal-D1nM9W1Z.js.map} +1 -1
  13. package/client/assets/DelayIndicator-Co5rMYw9.js +2 -0
  14. package/client/assets/DelayIndicator-Co5rMYw9.js.br +0 -0
  15. package/client/assets/DelayIndicator-Co5rMYw9.js.gz +0 -0
  16. package/client/assets/{DelayIndicator-BFZFpsY5.js.map → DelayIndicator-Co5rMYw9.js.map} +1 -1
  17. package/client/assets/EditorFeatureWrapper-_t_4D7Es.js +2 -0
  18. package/client/assets/EditorFeatureWrapper-_t_4D7Es.js.br +0 -0
  19. package/client/assets/EditorFeatureWrapper-_t_4D7Es.js.gz +0 -0
  20. package/client/assets/{EditorFeatureWrapper-DaMxgBMP.js.map → EditorFeatureWrapper-_t_4D7Es.js.map} +1 -1
  21. package/client/assets/EditorUtils-C3QoonjM.js +2 -0
  22. package/client/assets/EditorUtils-C3QoonjM.js.br +0 -0
  23. package/client/assets/EditorUtils-C3QoonjM.js.gz +0 -0
  24. package/client/assets/{EditorUtils-DoaSwWiz.js.map → EditorUtils-C3QoonjM.js.map} +1 -1
  25. package/client/assets/EditorUtils-L4Sg72o_.css +1 -0
  26. package/client/assets/EditorUtils-L4Sg72o_.css.br +0 -0
  27. package/client/assets/EditorUtils-L4Sg72o_.css.gz +0 -0
  28. package/client/assets/{Empty-D1UteOYj.js → Empty-DJMjfXnt.js} +2 -2
  29. package/client/assets/Empty-DJMjfXnt.js.br +2 -0
  30. package/client/assets/Empty-DJMjfXnt.js.gz +0 -0
  31. package/client/assets/{Empty-D1UteOYj.js.map → Empty-DJMjfXnt.js.map} +1 -1
  32. package/client/assets/{EmptyPage-DeRjpRKZ.js → EmptyPage-BlXZqoIr.js} +2 -2
  33. package/client/assets/EmptyPage-BlXZqoIr.js.br +0 -0
  34. package/client/assets/EmptyPage-BlXZqoIr.js.gz +0 -0
  35. package/client/assets/{EmptyPage-DeRjpRKZ.js.map → EmptyPage-BlXZqoIr.js.map} +1 -1
  36. package/client/assets/{FollowButton-FodezDem.js → FollowButton-Dy5n1J2c.js} +2 -2
  37. package/client/assets/FollowButton-Dy5n1J2c.js.br +0 -0
  38. package/client/assets/FollowButton-Dy5n1J2c.js.gz +0 -0
  39. package/client/assets/{FollowButton-FodezDem.js.map → FollowButton-Dy5n1J2c.js.map} +1 -1
  40. package/client/assets/MessageControlExport-CWQX8mH0.js +3 -0
  41. package/client/assets/MessageControlExport-CWQX8mH0.js.br +0 -0
  42. package/client/assets/MessageControlExport-CWQX8mH0.js.gz +0 -0
  43. package/client/assets/MessageControlExport-CWQX8mH0.js.map +1 -0
  44. package/client/assets/MessageControlExport-D_pNX6Vj.css +1 -0
  45. package/client/assets/MessageControlExport-D_pNX6Vj.css.br +0 -0
  46. package/client/assets/MessageControlExport-D_pNX6Vj.css.gz +0 -0
  47. package/client/assets/MilestoneEditor-CxWZdQ1B.js +2 -0
  48. package/client/assets/MilestoneEditor-CxWZdQ1B.js.br +0 -0
  49. package/client/assets/MilestoneEditor-CxWZdQ1B.js.gz +0 -0
  50. package/client/assets/MilestoneEditor-CxWZdQ1B.js.map +1 -0
  51. package/client/assets/Modal-ePA-Go14.js +2 -0
  52. package/client/assets/Modal-ePA-Go14.js.br +0 -0
  53. package/client/assets/Modal-ePA-Go14.js.gz +0 -0
  54. package/client/assets/Modal-ePA-Go14.js.map +1 -0
  55. package/client/assets/{MultiPartProgressBar-BKHk19Hb.js → MultiPartProgressBar-GQaCHX4z.js} +2 -2
  56. package/client/assets/MultiPartProgressBar-GQaCHX4z.js.br +0 -0
  57. package/client/assets/MultiPartProgressBar-GQaCHX4z.js.gz +0 -0
  58. package/client/assets/{MultiPartProgressBar-BKHk19Hb.js.map → MultiPartProgressBar-GQaCHX4z.js.map} +1 -1
  59. package/client/assets/OperatorExport-CA5WcIt5.css +1 -0
  60. package/client/assets/OperatorExport-CA5WcIt5.css.br +0 -0
  61. package/client/assets/OperatorExport-CA5WcIt5.css.gz +0 -0
  62. package/client/assets/OperatorExport-CRS08UXj.js +2 -0
  63. package/client/assets/OperatorExport-CRS08UXj.js.br +0 -0
  64. package/client/assets/OperatorExport-CRS08UXj.js.gz +0 -0
  65. package/client/assets/OperatorExport-CRS08UXj.js.map +1 -0
  66. package/client/assets/OverviewWrapper-BNRb3Ub_.js +2 -0
  67. package/client/assets/OverviewWrapper-BNRb3Ub_.js.br +0 -0
  68. package/client/assets/OverviewWrapper-BNRb3Ub_.js.gz +0 -0
  69. package/client/assets/OverviewWrapper-BNRb3Ub_.js.map +1 -0
  70. package/client/assets/{PipHost-B9-cZ8Lm.js → PipHost-DNfEY6RN.js} +2 -2
  71. package/client/assets/PipHost-DNfEY6RN.js.br +0 -0
  72. package/client/assets/PipHost-DNfEY6RN.js.gz +0 -0
  73. package/client/assets/PipHost-DNfEY6RN.js.map +1 -0
  74. package/client/assets/ProjectInfo-KPf-pM8y.js +2 -0
  75. package/client/assets/ProjectInfo-KPf-pM8y.js.br +0 -0
  76. package/client/assets/ProjectInfo-KPf-pM8y.js.gz +0 -0
  77. package/client/assets/{ProjectInfo-Dp1TZyBd.js.map → ProjectInfo-KPf-pM8y.js.map} +1 -1
  78. package/client/assets/{ProtectRoute-EejQ5o_H.js → ProtectRoute-DW_vXgYI.js} +2 -2
  79. package/client/assets/ProtectRoute-DW_vXgYI.js.br +0 -0
  80. package/client/assets/ProtectRoute-DW_vXgYI.js.gz +0 -0
  81. package/client/assets/{ProtectRoute-EejQ5o_H.js.map → ProtectRoute-DW_vXgYI.js.map} +1 -1
  82. package/client/assets/ProtectedCuesheet-CCVDLsK-.js +2 -0
  83. package/client/assets/ProtectedCuesheet-CCVDLsK-.js.br +0 -0
  84. package/client/assets/ProtectedCuesheet-CCVDLsK-.js.gz +0 -0
  85. package/client/assets/ProtectedCuesheet-CCVDLsK-.js.map +1 -0
  86. package/client/assets/ProtectedCuesheet-DPO7xYMb.css +1 -0
  87. package/client/assets/ProtectedCuesheet-DPO7xYMb.css.br +0 -0
  88. package/client/assets/ProtectedCuesheet-DPO7xYMb.css.gz +0 -0
  89. package/client/assets/{ProtectedEditor-Dw0pWw0J.css → ProtectedEditor-BtSuTFlT.css} +1 -1
  90. package/client/assets/ProtectedEditor-BtSuTFlT.css.br +0 -0
  91. package/client/assets/{ProtectedEditor-Dw0pWw0J.css.gz → ProtectedEditor-BtSuTFlT.css.gz} +0 -0
  92. package/client/assets/ProtectedEditor-Ddu9vBS8.js +3 -0
  93. package/client/assets/ProtectedEditor-Ddu9vBS8.js.br +0 -0
  94. package/client/assets/ProtectedEditor-Ddu9vBS8.js.gz +0 -0
  95. package/client/assets/ProtectedEditor-Ddu9vBS8.js.map +1 -0
  96. package/client/assets/RundownEntry-CpspmKD0.js +2 -0
  97. package/client/assets/RundownEntry-CpspmKD0.js.br +0 -0
  98. package/client/assets/RundownEntry-CpspmKD0.js.gz +0 -0
  99. package/client/assets/RundownEntry-CpspmKD0.js.map +1 -0
  100. package/client/assets/{RundownExport-DtSvAfBG.css → RundownExport-Bgtg_idR.css} +1 -1
  101. package/client/assets/RundownExport-Bgtg_idR.css.br +0 -0
  102. package/client/assets/RundownExport-Bgtg_idR.css.gz +0 -0
  103. package/client/assets/RundownExport-DhCryTUp.js +3 -0
  104. package/client/assets/RundownExport-DhCryTUp.js.br +0 -0
  105. package/client/assets/RundownExport-DhCryTUp.js.gz +0 -0
  106. package/client/assets/RundownExport-DhCryTUp.js.map +1 -0
  107. package/client/assets/{Select-cHK8JrMG.js → Select-ASOzxGFV.js} +2 -2
  108. package/client/assets/Select-ASOzxGFV.js.br +0 -0
  109. package/client/assets/Select-ASOzxGFV.js.gz +0 -0
  110. package/client/assets/Select-ASOzxGFV.js.map +1 -0
  111. package/client/assets/Studio-D7evHV2Q.js +2 -0
  112. package/client/assets/Studio-D7evHV2Q.js.br +0 -0
  113. package/client/assets/Studio-D7evHV2Q.js.gz +0 -0
  114. package/client/assets/Studio-D7evHV2Q.js.map +1 -0
  115. package/client/assets/{StyleEditor-RZvkKHdf.js → StyleEditor-DYybY9tA.js} +2 -2
  116. package/client/assets/StyleEditor-DYybY9tA.js.br +0 -0
  117. package/client/assets/StyleEditor-DYybY9tA.js.gz +0 -0
  118. package/client/assets/{StyleEditor-RZvkKHdf.js.map → StyleEditor-DYybY9tA.js.map} +1 -1
  119. package/client/assets/{SuperscriptPeriod-DaZq1rr6.js → SuperscriptPeriod-NmBzJhFK.js} +2 -2
  120. package/client/assets/SuperscriptPeriod-NmBzJhFK.js.br +0 -0
  121. package/client/assets/SuperscriptPeriod-NmBzJhFK.js.gz +0 -0
  122. package/client/assets/SuperscriptPeriod-NmBzJhFK.js.map +1 -0
  123. package/client/assets/SuperscriptTime-CA_8XRM6.js +2 -0
  124. package/client/assets/SuperscriptTime-CA_8XRM6.js.br +0 -0
  125. package/client/assets/SuperscriptTime-CA_8XRM6.js.gz +0 -0
  126. package/client/assets/SuperscriptTime-CA_8XRM6.js.map +1 -0
  127. package/client/assets/SwatchPicker-C8eFQKBd.js +2 -0
  128. package/client/assets/SwatchPicker-C8eFQKBd.js.br +0 -0
  129. package/client/assets/SwatchPicker-C8eFQKBd.js.gz +0 -0
  130. package/client/assets/SwatchPicker-C8eFQKBd.js.map +1 -0
  131. package/client/assets/{TimeElements-dIvFHgcd.js → TimeElements-D3dl9gAM.js} +2 -2
  132. package/client/assets/TimeElements-D3dl9gAM.js.br +0 -0
  133. package/client/assets/TimeElements-D3dl9gAM.js.gz +0 -0
  134. package/client/assets/TimeElements-D3dl9gAM.js.map +1 -0
  135. package/client/assets/TimeInput-DR-NCEhH.js +2 -0
  136. package/client/assets/TimeInput-DR-NCEhH.js.br +0 -0
  137. package/client/assets/TimeInput-DR-NCEhH.js.gz +0 -0
  138. package/client/assets/{TimeInput-Duzx40TC.js.map → TimeInput-DR-NCEhH.js.map} +1 -1
  139. package/client/assets/TimelinePage-BfTV9IdT.js +2 -0
  140. package/client/assets/TimelinePage-BfTV9IdT.js.br +0 -0
  141. package/client/assets/TimelinePage-BfTV9IdT.js.gz +0 -0
  142. package/client/assets/TimelinePage-BfTV9IdT.js.map +1 -0
  143. package/client/assets/Timer-DvqDm4yX.js +2 -0
  144. package/client/assets/Timer-DvqDm4yX.js.br +0 -0
  145. package/client/assets/Timer-DvqDm4yX.js.gz +0 -0
  146. package/client/assets/Timer-DvqDm4yX.js.map +1 -0
  147. package/client/assets/TimerControlExport-CQQ2KxqK.js +2 -0
  148. package/client/assets/TimerControlExport-CQQ2KxqK.js.br +0 -0
  149. package/client/assets/TimerControlExport-CQQ2KxqK.js.gz +0 -0
  150. package/client/assets/{TimerControlExport-GJn4WWdH.js.map → TimerControlExport-CQQ2KxqK.js.map} +1 -1
  151. package/client/assets/{TimerControlExport-DavNxY9p.css → TimerControlExport-cJRa5GUp.css} +1 -1
  152. package/client/assets/TimerControlExport-cJRa5GUp.css.br +0 -0
  153. package/client/assets/{TimerControlExport-DavNxY9p.css.gz → TimerControlExport-cJRa5GUp.css.gz} +0 -0
  154. package/client/assets/{TitleCard-BqbrUnHO.js → TitleCard-AESdy7kI.js} +2 -2
  155. package/client/assets/TitleCard-AESdy7kI.js.br +0 -0
  156. package/client/assets/TitleCard-AESdy7kI.js.gz +0 -0
  157. package/client/assets/{TitleCard-BqbrUnHO.js.map → TitleCard-AESdy7kI.js.map} +1 -1
  158. package/client/assets/{Tooltip-BQBvaIZx.js → Tooltip-BTK4bJkV.js} +2 -2
  159. package/client/assets/Tooltip-BTK4bJkV.js.br +0 -0
  160. package/client/assets/Tooltip-BTK4bJkV.js.gz +0 -0
  161. package/client/assets/Tooltip-BTK4bJkV.js.map +1 -0
  162. package/client/assets/ViewLogo-BZVUUIZA.js +2 -0
  163. package/client/assets/ViewLogo-BZVUUIZA.js.br +0 -0
  164. package/client/assets/ViewLogo-BZVUUIZA.js.gz +0 -0
  165. package/client/assets/ViewLogo-BZVUUIZA.js.map +1 -0
  166. package/client/assets/ViewParamsEditor-CBnRitZ4.js +2 -0
  167. package/client/assets/ViewParamsEditor-CBnRitZ4.js.br +0 -0
  168. package/client/assets/ViewParamsEditor-CBnRitZ4.js.gz +0 -0
  169. package/client/assets/ViewParamsEditor-CBnRitZ4.js.map +1 -0
  170. package/client/assets/{dateConfig-BU1RZfIK.js → dateConfig-Crm-Cu2y.js} +2 -2
  171. package/client/assets/dateConfig-Crm-Cu2y.js.br +0 -0
  172. package/client/assets/dateConfig-Crm-Cu2y.js.gz +0 -0
  173. package/client/assets/{dateConfig-BU1RZfIK.js.map → dateConfig-Crm-Cu2y.js.map} +1 -1
  174. package/client/assets/{editorSettings-BMt-7s8I.js → editorSettings-CRJwIW7V.js} +2 -2
  175. package/client/assets/editorSettings-CRJwIW7V.js.br +0 -0
  176. package/client/assets/editorSettings-CRJwIW7V.js.gz +0 -0
  177. package/client/assets/{editorSettings-BMt-7s8I.js.map → editorSettings-CRJwIW7V.js.map} +1 -1
  178. package/client/assets/{getProgress-sdxPEEPi.js → getProgress-fD6vhbNF.js} +2 -2
  179. package/client/assets/getProgress-fD6vhbNF.js.br +0 -0
  180. package/client/assets/getProgress-fD6vhbNF.js.gz +0 -0
  181. package/client/assets/{getProgress-sdxPEEPi.js.map → getProgress-fD6vhbNF.js.map} +1 -1
  182. package/client/assets/index-B1K7rED_.js +3 -0
  183. package/client/assets/index-B1K7rED_.js.br +0 -0
  184. package/client/assets/index-B1K7rED_.js.gz +0 -0
  185. package/client/assets/index-B1K7rED_.js.map +1 -0
  186. package/client/assets/{index-BuJoGGff.css → index-BAvwULMi.css} +1 -1
  187. package/client/assets/index-BAvwULMi.css.br +0 -0
  188. package/client/assets/index-BAvwULMi.css.gz +0 -0
  189. package/client/assets/{offset-BS90Rks2.js → offset-FplkvYRD.js} +2 -2
  190. package/client/assets/offset-FplkvYRD.js.br +0 -0
  191. package/client/assets/offset-FplkvYRD.js.gz +0 -0
  192. package/client/assets/{offset-BS90Rks2.js.map → offset-FplkvYRD.js.map} +1 -1
  193. package/client/assets/{parseUserTime-DZJMcfuJ.js → parseUserTime-0pNWLcr0.js} +2 -2
  194. package/client/assets/parseUserTime-0pNWLcr0.js.br +0 -0
  195. package/client/assets/parseUserTime-0pNWLcr0.js.gz +0 -0
  196. package/client/assets/{parseUserTime-DZJMcfuJ.js.map → parseUserTime-0pNWLcr0.js.map} +1 -1
  197. package/client/assets/{playbackstate-CWexoP3a.js → playbackstate-1HCEpVh5.js} +2 -2
  198. package/client/assets/playbackstate-1HCEpVh5.js.br +0 -0
  199. package/client/assets/playbackstate-1HCEpVh5.js.gz +0 -0
  200. package/client/assets/{playbackstate-CWexoP3a.js.map → playbackstate-1HCEpVh5.js.map} +1 -1
  201. package/client/assets/{presentation.utils-Zo5hNQje.js → presentation.utils-CLt2UhON.js} +2 -2
  202. package/client/assets/presentation.utils-CLt2UhON.js.br +0 -0
  203. package/client/assets/presentation.utils-CLt2UhON.js.gz +0 -0
  204. package/client/assets/{presentation.utils-Zo5hNQje.js.map → presentation.utils-CLt2UhON.js.map} +1 -1
  205. package/client/assets/rundownUtils-D1oJpMdx.js +2 -0
  206. package/client/assets/rundownUtils-D1oJpMdx.js.br +0 -0
  207. package/client/assets/rundownUtils-D1oJpMdx.js.gz +0 -0
  208. package/client/assets/{rundownUtils-Dl1x6NDv.js.map → rundownUtils-D1oJpMdx.js.map} +1 -1
  209. package/client/assets/{timer.utils-BnMyVO6Z.js → timer.utils-FiqT1yNa.js} +2 -2
  210. package/client/assets/timer.utils-FiqT1yNa.js.br +0 -0
  211. package/client/assets/timer.utils-FiqT1yNa.js.gz +0 -0
  212. package/client/assets/timer.utils-FiqT1yNa.js.map +1 -0
  213. package/client/assets/{useCustomFields-CcTb-GQM.js → useCustomFields-nW-_Zyfw.js} +2 -2
  214. package/client/assets/useCustomFields-nW-_Zyfw.js.br +0 -0
  215. package/client/assets/useCustomFields-nW-_Zyfw.js.gz +0 -0
  216. package/client/assets/{useCustomFields-CcTb-GQM.js.map → useCustomFields-nW-_Zyfw.js.map} +1 -1
  217. package/client/assets/{useFollowComponent-BjhV6Uv8.js → useFollowComponent-4cbKEsVz.js} +2 -2
  218. package/client/assets/useFollowComponent-4cbKEsVz.js.br +0 -0
  219. package/client/assets/useFollowComponent-4cbKEsVz.js.gz +0 -0
  220. package/client/assets/{useFollowComponent-BjhV6Uv8.js.map → useFollowComponent-4cbKEsVz.js.map} +1 -1
  221. package/client/assets/useProjectData-DP-pr73E.js +2 -0
  222. package/client/assets/useProjectData-DP-pr73E.js.br +0 -0
  223. package/client/assets/useProjectData-DP-pr73E.js.gz +0 -0
  224. package/client/assets/useProjectData-DP-pr73E.js.map +1 -0
  225. package/client/assets/{useReport-zMbyWwpn.js → useReport-6XA_s2Vc.js} +2 -2
  226. package/client/assets/useReport-6XA_s2Vc.js.br +0 -0
  227. package/client/assets/useReport-6XA_s2Vc.js.gz +0 -0
  228. package/client/assets/{useReport-zMbyWwpn.js.map → useReport-6XA_s2Vc.js.map} +1 -1
  229. package/client/assets/useRundown-BGhL8DEI.js +2 -0
  230. package/client/assets/useRundown-BGhL8DEI.js.br +0 -0
  231. package/client/assets/useRundown-BGhL8DEI.js.gz +0 -0
  232. package/client/assets/useRundown-BGhL8DEI.js.map +1 -0
  233. package/client/assets/{useWindowTitle-mLKt65i7.js → useWindowTitle-ahZQIheF.js} +2 -2
  234. package/client/assets/useWindowTitle-ahZQIheF.js.br +0 -0
  235. package/client/assets/useWindowTitle-ahZQIheF.js.gz +0 -0
  236. package/client/assets/useWindowTitle-ahZQIheF.js.map +1 -0
  237. package/client/assets/{validateEvent-CUmvjN95.js → validateEvent-jVIMKhmx.js} +2 -2
  238. package/client/assets/validateEvent-jVIMKhmx.js.br +0 -0
  239. package/client/assets/validateEvent-jVIMKhmx.js.gz +0 -0
  240. package/client/assets/{validateEvent-CUmvjN95.js.map → validateEvent-jVIMKhmx.js.map} +1 -1
  241. package/client/assets/vendor-DmGkEtRj.js +74 -0
  242. package/client/assets/vendor-DmGkEtRj.js.br +0 -0
  243. package/client/assets/vendor-DmGkEtRj.js.gz +0 -0
  244. package/client/assets/{vendor-Cdwxo8bP.js.map → vendor-DmGkEtRj.js.map} +1 -1
  245. package/client/assets/{viewLoader.utils-DuXjY5zb.js → viewLoader.utils-Bniie8Op.js} +2 -2
  246. package/client/assets/viewLoader.utils-Bniie8Op.js.br +0 -0
  247. package/client/assets/viewLoader.utils-Bniie8Op.js.gz +0 -0
  248. package/client/assets/{viewLoader.utils-DuXjY5zb.js.map → viewLoader.utils-Bniie8Op.js.map} +1 -1
  249. package/client/assets/{viewUtils-dKRKkb_F.js → viewUtils-VNLYoR28.js} +2 -2
  250. package/client/assets/viewUtils-VNLYoR28.js.br +0 -0
  251. package/client/assets/viewUtils-VNLYoR28.js.gz +0 -0
  252. package/client/assets/viewUtils-VNLYoR28.js.map +1 -0
  253. package/client/index.html +3 -3
  254. package/package.json +1 -1
  255. package/server/index.cjs +102 -102
  256. package/client/assets/Backstage-WSlbFC9X.js +0 -2
  257. package/client/assets/Backstage-WSlbFC9X.js.br +0 -0
  258. package/client/assets/Backstage-WSlbFC9X.js.gz +0 -0
  259. package/client/assets/Backstage-WSlbFC9X.js.map +0 -1
  260. package/client/assets/Countdown-B32qlxYT.js +0 -2
  261. package/client/assets/Countdown-B32qlxYT.js.br +0 -0
  262. package/client/assets/Countdown-B32qlxYT.js.gz +0 -0
  263. package/client/assets/Countdown-B32qlxYT.js.map +0 -1
  264. package/client/assets/CustomTranslationModal-CtBvokyt.js +0 -2
  265. package/client/assets/CustomTranslationModal-CtBvokyt.js.br +0 -0
  266. package/client/assets/CustomTranslationModal-CtBvokyt.js.gz +0 -0
  267. package/client/assets/DelayIndicator-BFZFpsY5.js +0 -2
  268. package/client/assets/DelayIndicator-BFZFpsY5.js.br +0 -0
  269. package/client/assets/DelayIndicator-BFZFpsY5.js.gz +0 -0
  270. package/client/assets/Editor-B_NlyOLw.css +0 -1
  271. package/client/assets/Editor-B_NlyOLw.css.br +0 -0
  272. package/client/assets/Editor-B_NlyOLw.css.gz +0 -0
  273. package/client/assets/Editor.module-DvV2efYs.js +0 -2
  274. package/client/assets/Editor.module-DvV2efYs.js.br +0 -0
  275. package/client/assets/Editor.module-DvV2efYs.js.gz +0 -0
  276. package/client/assets/Editor.module-DvV2efYs.js.map +0 -1
  277. package/client/assets/EditorFeatureWrapper-DaMxgBMP.js +0 -2
  278. package/client/assets/EditorFeatureWrapper-DaMxgBMP.js.br +0 -0
  279. package/client/assets/EditorFeatureWrapper-DaMxgBMP.js.gz +0 -0
  280. package/client/assets/EditorUtils-CgF7UfHP.css +0 -1
  281. package/client/assets/EditorUtils-CgF7UfHP.css.br +0 -0
  282. package/client/assets/EditorUtils-CgF7UfHP.css.gz +0 -0
  283. package/client/assets/EditorUtils-DoaSwWiz.js +0 -2
  284. package/client/assets/EditorUtils-DoaSwWiz.js.br +0 -0
  285. package/client/assets/EditorUtils-DoaSwWiz.js.gz +0 -0
  286. package/client/assets/Empty-D1UteOYj.js.br +0 -0
  287. package/client/assets/Empty-D1UteOYj.js.gz +0 -0
  288. package/client/assets/EmptyPage-DeRjpRKZ.js.br +0 -0
  289. package/client/assets/EmptyPage-DeRjpRKZ.js.gz +0 -0
  290. package/client/assets/FollowButton-FodezDem.js.br +0 -0
  291. package/client/assets/FollowButton-FodezDem.js.gz +0 -0
  292. package/client/assets/MessageControlExport-CFGgiwk_.js +0 -3
  293. package/client/assets/MessageControlExport-CFGgiwk_.js.br +0 -0
  294. package/client/assets/MessageControlExport-CFGgiwk_.js.gz +0 -0
  295. package/client/assets/MessageControlExport-CFGgiwk_.js.map +0 -1
  296. package/client/assets/MessageControlExport-DjoUioWA.css +0 -1
  297. package/client/assets/MessageControlExport-DjoUioWA.css.br +0 -0
  298. package/client/assets/MessageControlExport-DjoUioWA.css.gz +0 -0
  299. package/client/assets/MilestoneEditor-B5BdJ5ju.js +0 -2
  300. package/client/assets/MilestoneEditor-B5BdJ5ju.js.br +0 -0
  301. package/client/assets/MilestoneEditor-B5BdJ5ju.js.gz +0 -0
  302. package/client/assets/MilestoneEditor-B5BdJ5ju.js.map +0 -1
  303. package/client/assets/Modal-B8ZZbVMg.js +0 -2
  304. package/client/assets/Modal-B8ZZbVMg.js.br +0 -0
  305. package/client/assets/Modal-B8ZZbVMg.js.gz +0 -0
  306. package/client/assets/Modal-B8ZZbVMg.js.map +0 -1
  307. package/client/assets/MultiPartProgressBar-BKHk19Hb.js.br +0 -0
  308. package/client/assets/MultiPartProgressBar-BKHk19Hb.js.gz +0 -0
  309. package/client/assets/OperatorExport-BiBcgVKc.css +0 -1
  310. package/client/assets/OperatorExport-BiBcgVKc.css.br +0 -0
  311. package/client/assets/OperatorExport-BiBcgVKc.css.gz +0 -0
  312. package/client/assets/OperatorExport-DQM14DsN.js +0 -2
  313. package/client/assets/OperatorExport-DQM14DsN.js.br +0 -0
  314. package/client/assets/OperatorExport-DQM14DsN.js.gz +0 -0
  315. package/client/assets/OperatorExport-DQM14DsN.js.map +0 -1
  316. package/client/assets/OverviewWrapper-D1hUkrRi.js +0 -2
  317. package/client/assets/OverviewWrapper-D1hUkrRi.js.br +0 -0
  318. package/client/assets/OverviewWrapper-D1hUkrRi.js.gz +0 -0
  319. package/client/assets/OverviewWrapper-D1hUkrRi.js.map +0 -1
  320. package/client/assets/PipHost-B9-cZ8Lm.js.br +0 -0
  321. package/client/assets/PipHost-B9-cZ8Lm.js.gz +0 -0
  322. package/client/assets/PipHost-B9-cZ8Lm.js.map +0 -1
  323. package/client/assets/ProjectInfo-Dp1TZyBd.js +0 -2
  324. package/client/assets/ProjectInfo-Dp1TZyBd.js.br +0 -0
  325. package/client/assets/ProjectInfo-Dp1TZyBd.js.gz +0 -0
  326. package/client/assets/ProtectRoute-EejQ5o_H.js.br +0 -0
  327. package/client/assets/ProtectRoute-EejQ5o_H.js.gz +0 -0
  328. package/client/assets/ProtectedCuesheet-C_tKodwo.css +0 -1
  329. package/client/assets/ProtectedCuesheet-C_tKodwo.css.br +0 -0
  330. package/client/assets/ProtectedCuesheet-C_tKodwo.css.gz +0 -0
  331. package/client/assets/ProtectedCuesheet-DvYSgueA.js +0 -2
  332. package/client/assets/ProtectedCuesheet-DvYSgueA.js.br +0 -0
  333. package/client/assets/ProtectedCuesheet-DvYSgueA.js.gz +0 -0
  334. package/client/assets/ProtectedCuesheet-DvYSgueA.js.map +0 -1
  335. package/client/assets/ProtectedEditor-B0l0X3QP.js +0 -3
  336. package/client/assets/ProtectedEditor-B0l0X3QP.js.br +0 -0
  337. package/client/assets/ProtectedEditor-B0l0X3QP.js.gz +0 -0
  338. package/client/assets/ProtectedEditor-B0l0X3QP.js.map +0 -1
  339. package/client/assets/ProtectedEditor-Dw0pWw0J.css.br +0 -0
  340. package/client/assets/RundownEntry-CwiStTnR.js +0 -2
  341. package/client/assets/RundownEntry-CwiStTnR.js.br +0 -0
  342. package/client/assets/RundownEntry-CwiStTnR.js.gz +0 -0
  343. package/client/assets/RundownEntry-CwiStTnR.js.map +0 -1
  344. package/client/assets/RundownExport-CCaOfHIr.js +0 -3
  345. package/client/assets/RundownExport-CCaOfHIr.js.br +0 -0
  346. package/client/assets/RundownExport-CCaOfHIr.js.gz +0 -0
  347. package/client/assets/RundownExport-CCaOfHIr.js.map +0 -1
  348. package/client/assets/RundownExport-DtSvAfBG.css.br +0 -0
  349. package/client/assets/RundownExport-DtSvAfBG.css.gz +0 -0
  350. package/client/assets/Select-cHK8JrMG.js.br +0 -0
  351. package/client/assets/Select-cHK8JrMG.js.gz +0 -0
  352. package/client/assets/Select-cHK8JrMG.js.map +0 -1
  353. package/client/assets/Studio-BzwFDYzk.js +0 -2
  354. package/client/assets/Studio-BzwFDYzk.js.br +0 -0
  355. package/client/assets/Studio-BzwFDYzk.js.gz +0 -0
  356. package/client/assets/Studio-BzwFDYzk.js.map +0 -1
  357. package/client/assets/StyleEditor-RZvkKHdf.js.br +0 -0
  358. package/client/assets/StyleEditor-RZvkKHdf.js.gz +0 -0
  359. package/client/assets/SuperscriptPeriod-DaZq1rr6.js.br +0 -0
  360. package/client/assets/SuperscriptPeriod-DaZq1rr6.js.gz +0 -0
  361. package/client/assets/SuperscriptPeriod-DaZq1rr6.js.map +0 -1
  362. package/client/assets/SuperscriptTime-Mc0ZGBMo.js +0 -2
  363. package/client/assets/SuperscriptTime-Mc0ZGBMo.js.br +0 -0
  364. package/client/assets/SuperscriptTime-Mc0ZGBMo.js.gz +0 -0
  365. package/client/assets/SuperscriptTime-Mc0ZGBMo.js.map +0 -1
  366. package/client/assets/TimeElements-dIvFHgcd.js.br +0 -0
  367. package/client/assets/TimeElements-dIvFHgcd.js.gz +0 -0
  368. package/client/assets/TimeElements-dIvFHgcd.js.map +0 -1
  369. package/client/assets/TimeInput-Duzx40TC.js +0 -2
  370. package/client/assets/TimeInput-Duzx40TC.js.br +0 -0
  371. package/client/assets/TimeInput-Duzx40TC.js.gz +0 -0
  372. package/client/assets/TimelinePage-C-OHrCR8.js +0 -2
  373. package/client/assets/TimelinePage-C-OHrCR8.js.br +0 -0
  374. package/client/assets/TimelinePage-C-OHrCR8.js.gz +0 -0
  375. package/client/assets/TimelinePage-C-OHrCR8.js.map +0 -1
  376. package/client/assets/Timer-CGqVtVEC.js +0 -2
  377. package/client/assets/Timer-CGqVtVEC.js.br +0 -0
  378. package/client/assets/Timer-CGqVtVEC.js.gz +0 -0
  379. package/client/assets/Timer-CGqVtVEC.js.map +0 -1
  380. package/client/assets/TimerControlExport-DavNxY9p.css.br +0 -0
  381. package/client/assets/TimerControlExport-GJn4WWdH.js +0 -2
  382. package/client/assets/TimerControlExport-GJn4WWdH.js.br +0 -0
  383. package/client/assets/TimerControlExport-GJn4WWdH.js.gz +0 -0
  384. package/client/assets/TitleCard-BqbrUnHO.js.br +0 -0
  385. package/client/assets/TitleCard-BqbrUnHO.js.gz +0 -0
  386. package/client/assets/Tooltip-BQBvaIZx.js.br +0 -0
  387. package/client/assets/Tooltip-BQBvaIZx.js.gz +0 -0
  388. package/client/assets/Tooltip-BQBvaIZx.js.map +0 -1
  389. package/client/assets/ViewLogo-BdL1hUV1.js +0 -2
  390. package/client/assets/ViewLogo-BdL1hUV1.js.br +0 -0
  391. package/client/assets/ViewLogo-BdL1hUV1.js.gz +0 -0
  392. package/client/assets/ViewLogo-BdL1hUV1.js.map +0 -1
  393. package/client/assets/ViewParamsEditor-CFedpp6w.js +0 -2
  394. package/client/assets/ViewParamsEditor-CFedpp6w.js.br +0 -0
  395. package/client/assets/ViewParamsEditor-CFedpp6w.js.gz +0 -0
  396. package/client/assets/ViewParamsEditor-CFedpp6w.js.map +0 -1
  397. package/client/assets/dateConfig-BU1RZfIK.js.br +0 -0
  398. package/client/assets/dateConfig-BU1RZfIK.js.gz +0 -0
  399. package/client/assets/editorSettings-BMt-7s8I.js.br +0 -0
  400. package/client/assets/editorSettings-BMt-7s8I.js.gz +0 -0
  401. package/client/assets/getProgress-sdxPEEPi.js.br +0 -0
  402. package/client/assets/getProgress-sdxPEEPi.js.gz +0 -0
  403. package/client/assets/index-BuJoGGff.css.br +0 -0
  404. package/client/assets/index-BuJoGGff.css.gz +0 -0
  405. package/client/assets/index-CoGiopcb.js +0 -3
  406. package/client/assets/index-CoGiopcb.js.br +0 -0
  407. package/client/assets/index-CoGiopcb.js.gz +0 -0
  408. package/client/assets/index-CoGiopcb.js.map +0 -1
  409. package/client/assets/offset-BS90Rks2.js.br +0 -0
  410. package/client/assets/offset-BS90Rks2.js.gz +0 -0
  411. package/client/assets/parseUserTime-DZJMcfuJ.js.br +0 -0
  412. package/client/assets/parseUserTime-DZJMcfuJ.js.gz +0 -0
  413. package/client/assets/playbackstate-CWexoP3a.js.br +0 -0
  414. package/client/assets/playbackstate-CWexoP3a.js.gz +0 -0
  415. package/client/assets/presentation.utils-Zo5hNQje.js.br +0 -0
  416. package/client/assets/presentation.utils-Zo5hNQje.js.gz +0 -0
  417. package/client/assets/rundownUtils-Dl1x6NDv.js +0 -2
  418. package/client/assets/rundownUtils-Dl1x6NDv.js.br +0 -0
  419. package/client/assets/rundownUtils-Dl1x6NDv.js.gz +0 -0
  420. package/client/assets/timer.utils-BnMyVO6Z.js.br +0 -0
  421. package/client/assets/timer.utils-BnMyVO6Z.js.gz +0 -0
  422. package/client/assets/timer.utils-BnMyVO6Z.js.map +0 -1
  423. package/client/assets/useCustomFields-CcTb-GQM.js.br +0 -0
  424. package/client/assets/useCustomFields-CcTb-GQM.js.gz +0 -0
  425. package/client/assets/useFollowComponent-BjhV6Uv8.js.br +0 -0
  426. package/client/assets/useFollowComponent-BjhV6Uv8.js.gz +0 -0
  427. package/client/assets/useProjectData-B5mjXsMj.js +0 -2
  428. package/client/assets/useProjectData-B5mjXsMj.js.br +0 -0
  429. package/client/assets/useProjectData-B5mjXsMj.js.gz +0 -0
  430. package/client/assets/useProjectData-B5mjXsMj.js.map +0 -1
  431. package/client/assets/useReport-zMbyWwpn.js.br +0 -0
  432. package/client/assets/useReport-zMbyWwpn.js.gz +0 -0
  433. package/client/assets/useRundown-CHsh5rnl.js +0 -2
  434. package/client/assets/useRundown-CHsh5rnl.js.br +0 -0
  435. package/client/assets/useRundown-CHsh5rnl.js.gz +0 -0
  436. package/client/assets/useRundown-CHsh5rnl.js.map +0 -1
  437. package/client/assets/useWindowTitle-mLKt65i7.js.br +0 -0
  438. package/client/assets/useWindowTitle-mLKt65i7.js.gz +0 -0
  439. package/client/assets/useWindowTitle-mLKt65i7.js.map +0 -1
  440. package/client/assets/validateEvent-CUmvjN95.js.br +0 -0
  441. package/client/assets/validateEvent-CUmvjN95.js.gz +0 -0
  442. package/client/assets/vendor-Cdwxo8bP.js +0 -75
  443. package/client/assets/vendor-Cdwxo8bP.js.br +0 -0
  444. package/client/assets/vendor-Cdwxo8bP.js.gz +0 -0
  445. package/client/assets/viewLoader.utils-DuXjY5zb.js.br +0 -0
  446. package/client/assets/viewLoader.utils-DuXjY5zb.js.gz +0 -0
  447. package/client/assets/viewUtils-dKRKkb_F.js.br +0 -0
  448. package/client/assets/viewUtils-dKRKkb_F.js.gz +0 -0
  449. package/client/assets/viewUtils-dKRKkb_F.js.map +0 -1
  450. /package/client/assets/{useProjectData-Cw1aXCwD.css → SwatchPicker-Cw1aXCwD.css} +0 -0
  451. /package/client/assets/{useProjectData-Cw1aXCwD.css.br → SwatchPicker-Cw1aXCwD.css.br} +0 -0
  452. /package/client/assets/{useProjectData-Cw1aXCwD.css.gz → SwatchPicker-Cw1aXCwD.css.gz} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"dateConfig-BU1RZfIK.js","sources":["../../src/features/rundown/rundown.utils.ts","../../src/common/hooks/useEntryAction.ts","../../src/common/utils/dateConfig.ts"],"sourcesContent":["import { EntryId, isOntimeEvent, isOntimeGroup, RundownEntries, SupportedEntry } from 'ontime-types';\n\n/**\n * Creates a sortable list of entries\n * ------------------------------------\n * Due to limitations in dnd-kit we need to flatten the list of entries\n * This list should also be aware of any elements that are sortable (ie: group ends)\n */\nexport function makeSortableList(order: EntryId[], entries: RundownEntries): EntryId[] {\n const flatIds: EntryId[] = [];\n\n for (let i = 0; i < order.length; i++) {\n const entry = entries[order[i]];\n\n if (!entry) {\n continue;\n }\n\n if (isOntimeGroup(entry)) {\n // inside a group there are delays and events\n // there is no need for special handling\n flatIds.push(entry.id);\n flatIds.push(...entry.entries);\n\n // close the group\n flatIds.push(`end-${entry.id}`);\n } else {\n flatIds.push(entry.id);\n }\n }\n return flatIds;\n}\n\n/**\n * Checks whether a drop operation is valid\n * Currently only used for validating dropping groups\n */\nexport function canDrop(\n targetType: SupportedEntry | 'end-group',\n targetParent: EntryId | null,\n order?: 'after' | 'before',\n isTargetCollapsed?: boolean,\n): boolean {\n // inserting before would mean adding a group inside another\n if (targetType === 'end-group') {\n return order === 'after';\n }\n\n // this means swapping places with another group\n // !!! if the user is dragging down, they could be inserting into a group depending on whether the group is collapsed\n if (targetType === 'group') {\n if (order !== undefined && order === 'after' && !isTargetCollapsed) {\n return false;\n }\n return true;\n }\n\n // for all other cases, we just need to check if we are inside a group\n return targetParent === null;\n}\n\n/**\n * calculates destinations for an entry moving one position up in the rundown\n * @returns An object describing how to move the entry:\n * - destinationId: The target entry ID (null if no movement possible)\n * - order: How to position relative to the destination:\n * - 'before': Place before the destination\n * - 'after': Place after the destination\n * - 'insert': Insert into the destination (for groups)\n */\nexport function moveUp(\n entryId: EntryId,\n flatOrder: EntryId[],\n entries: RundownEntries,\n): { destinationId: EntryId | null; order: 'before' | 'after' | 'insert' } {\n const currentEntry = entries[entryId];\n const currentIndex = flatOrder.indexOf(entryId);\n const previousEntryId = flatOrder[currentIndex - 1];\n\n // 1. moving at the top of the list\n if (!previousEntryId) {\n // 1a. we are in a group and need to move outside of it\n if ('parent' in currentEntry && currentEntry.parent !== null) {\n return { destinationId: currentEntry.parent, order: 'before' };\n }\n // 1b. we are at the start of the rundown, no movement possible\n return { destinationId: null, order: 'before' };\n }\n\n // 2. moving a group (always moves at top level)\n if (isOntimeGroup(currentEntry)) {\n // 21. if previous entry is inside a group, swap with parent\n const previousEntry = entries[previousEntryId];\n if ('parent' in previousEntry && previousEntry.parent !== null) {\n return { destinationId: previousEntry.parent, order: 'before' };\n }\n\n // 2b. previous entry is at top level, we just swap places\n return { destinationId: previousEntryId, order: 'before' };\n }\n\n const previousEntry = entries[previousEntryId];\n const currentEntryParent = currentEntry.parent;\n\n // 3. moving in and out of a group\n if (isOntimeGroup(previousEntry)) {\n // 3a. if we're not already in the group, move into it\n if (currentEntryParent === null) {\n return { destinationId: previousEntryId, order: 'insert' };\n }\n // 3b. otherwise, move before the group\n return { destinationId: previousEntryId, order: 'before' };\n }\n\n // 4. moving into the same group as previous entry\n if (isOntimeEvent(previousEntry) && previousEntry.parent !== null && currentEntryParent === null) {\n return { destinationId: previousEntryId, order: 'after' };\n }\n\n // default - swap positions with previous entry\n return { destinationId: previousEntryId, order: 'before' };\n}\n\n/**\n * calculates destinations for an entry moving one position down in the rundown\n * @returns An object describing how to move the entry:\n * - destinationId: The target entry ID (null if no movement possible)\n * - order: How to position relative to the destination:\n * - 'before': Place before the destination\n * - 'after': Place after the destination\n * - 'insert': Insert into the destination (for groups)\n */\nexport function moveDown(\n entryId: EntryId,\n flatOrder: EntryId[],\n entries: RundownEntries,\n): { destinationId: EntryId | null; order: 'before' | 'after' | 'insert' } {\n const currentEntry = entries[entryId];\n const currentIndex = flatOrder.indexOf(entryId);\n const nextEntryId = flatOrder[currentIndex + 1];\n\n // 1. check if we're the last entry in a group\n if ('parent' in currentEntry && currentEntry.parent !== null) {\n const parentGroup = entries[currentEntry.parent];\n if (isOntimeGroup(parentGroup) && parentGroup.entries[parentGroup.entries.length - 1] === entryId) {\n return { destinationId: currentEntry.parent, order: 'after' };\n }\n }\n\n // 2. moving at the end of the list\n if (!nextEntryId) {\n return { destinationId: null, order: 'after' };\n }\n\n // 3. moving a group (always moves at top level)\n if (isOntimeGroup(currentEntry)) {\n // if next entry is inside this group, skip past all children\n if (currentEntry.entries.includes(nextEntryId)) {\n const afterGroupIndex = currentIndex + currentEntry.entries.length + 1;\n const afterGroupId = flatOrder[afterGroupIndex];\n\n // 2a. group is the last top level entry\n if (!afterGroupId) {\n return { destinationId: null, order: 'after' };\n }\n // 2b. move after the next top level event\n return { destinationId: afterGroupId, order: 'after' };\n }\n // 2c. empty group move after the next entry\n return { destinationId: nextEntryId, order: 'after' };\n }\n\n const nextEntry = entries[nextEntryId];\n const currentEntryParent = currentEntry.parent;\n\n // 4. handle moving relative to groups\n if (isOntimeGroup(nextEntry)) {\n if (currentEntryParent === null) {\n // we are entering a group\n if (nextEntry.entries.length === 0) {\n // 3a. if the group is empty, insert into it\n return { destinationId: nextEntryId, order: 'insert' };\n }\n // 3b. otherwise, add before the first entry in the group\n const firstGroupEntryId = nextEntry.entries[0];\n return { destinationId: firstGroupEntryId, order: 'before' };\n }\n }\n\n // 5. handle moving between group and top level\n const nextEntryParent = isOntimeEvent(nextEntry) ? nextEntry.parent : null;\n if (nextEntryParent !== null && currentEntryParent === null) {\n return { destinationId: nextEntryId, order: 'after' };\n }\n\n // default - swap positions with next entry\n return { destinationId: nextEntryId, order: 'after' };\n}\n\n/**\n * Reorders unorderedArray to match the flatOrder entries\n * Useful for operations that convert selections (out of order) to rundown\n */\nexport function orderEntries(unorderedArray: EntryId[], flatOrder: EntryId[]): EntryId[] {\n const orderedArray: EntryId[] = [];\n for (const id of flatOrder) {\n if (unorderedArray.includes(id)) {\n orderedArray.push(id);\n }\n }\n return orderedArray;\n}\n","import { useCallback } from 'react';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport {\n EntryId,\n InsertOptions,\n isOntimeEvent,\n isOntimeGroup,\n MaybeString,\n OntimeEntry,\n OntimeEvent,\n Rundown,\n SupportedEntry,\n TimeField,\n TimeStrategy,\n TransientEventPayload,\n} from 'ontime-types';\nimport { dayInMs, generateId, MILLIS_PER_SECOND, parseUserTime, swapEventData } from 'ontime-utils';\n\nimport { moveDown, moveUp, orderEntries } from '../../features/rundown/rundown.utils';\nimport { RUNDOWN } from '../api/constants';\nimport {\n deleteEntries,\n patchReorderEntry,\n postAddEntry,\n postCloneEntry,\n putBatchEditEvents,\n putEditEntry,\n ReorderEntry,\n requestApplyDelay,\n requestDeleteAll,\n requestEventSwap,\n requestGroupEntries,\n requestUngroup,\n} from '../api/rundown';\nimport { logAxiosError } from '../api/utils';\nimport { useEditorSettings } from '../stores/editorSettings';\n\nexport type EventOptions = Partial<{\n // options of any new entries (event / delay / group)\n after: MaybeString;\n before: MaybeString;\n // options of entries of type OntimeEvent\n linkPrevious: boolean;\n lastEventId: MaybeString;\n}>;\n\n/**\n * Gather utilities for actions on entries\n */\nexport const useEntryActions = () => {\n const queryClient = useQueryClient();\n const {\n linkPrevious,\n defaultTimeStrategy,\n defaultDuration,\n defaultWarnTime,\n defaultDangerTime,\n defaultTimerType,\n defaultEndAction,\n } = useEditorSettings();\n\n /**\n * Returns the currently loaded rundown\n */\n const getCurrentRundownData = useCallback(() => {\n return queryClient.getQueryData<Rundown>(RUNDOWN);\n }, [queryClient]);\n\n /**\n * Looks for an entry with a given ID in the currently loaded rundown\n */\n const getEntryById = useCallback(\n (eventId: EntryId): OntimeEntry | undefined => {\n const cachedRundown = getCurrentRundownData();\n if (!cachedRundown?.entries) {\n return;\n }\n return cachedRundown.entries[eventId];\n },\n [getCurrentRundownData],\n );\n\n /**\n * Calls mutation to add new entry\n * @private\n */\n const { mutateAsync: addEntryMutation } = useMutation({\n mutationFn: ([rundownId, entry]: Parameters<typeof postAddEntry>) => postAddEntry(rundownId, entry),\n onMutate: () => queryClient.cancelQueries({ queryKey: RUNDOWN }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: RUNDOWN }),\n });\n\n /**\n * Adds an entry to rundown\n */\n const addEntry = useCallback(\n async (entry: Partial<OntimeEntry>, options?: EventOptions) => {\n const rundownData = getCurrentRundownData();\n const rundownId = rundownData?.id;\n\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n const newEntry: TransientEventPayload = { ...entry, id: generateId() };\n\n // ************* CHECK OPTIONS specific to events\n if (isOntimeEvent(newEntry)) {\n if (options?.lastEventId) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- we know this is a value\n const previousEvent = rundownData.entries[options?.lastEventId];\n if (isOntimeEvent(previousEvent)) {\n newEntry.timeStart = previousEvent.timeEnd;\n }\n }\n\n // Override event with options from editor settings\n newEntry.linkStart = options?.linkPrevious ?? linkPrevious;\n\n if (newEntry.duration === undefined && newEntry.timeEnd === undefined) {\n newEntry.duration = parseUserTime(defaultDuration);\n }\n\n if (newEntry.timeDanger === undefined) {\n newEntry.timeDanger = parseUserTime(defaultDangerTime);\n }\n\n if (newEntry.timeWarning === undefined) {\n newEntry.timeWarning = parseUserTime(defaultWarnTime);\n }\n\n if (newEntry.timerType === undefined) {\n newEntry.timerType = defaultTimerType;\n }\n\n if (newEntry.endAction === undefined) {\n newEntry.endAction = defaultEndAction;\n }\n\n if (newEntry.timeStrategy === undefined) {\n newEntry.timeStrategy = defaultTimeStrategy;\n }\n }\n\n // handle adding options that concern all event type\n if (options?.after) {\n (newEntry as TransientEventPayload).after = options.after;\n }\n if (options?.before) {\n (newEntry as TransientEventPayload).before = options.before;\n }\n\n try {\n await addEntryMutation([rundownId, newEntry]);\n } catch (error) {\n logAxiosError('Failed adding event', error);\n }\n },\n [\n getCurrentRundownData,\n linkPrevious,\n defaultDuration,\n defaultDangerTime,\n defaultWarnTime,\n defaultTimerType,\n defaultEndAction,\n defaultTimeStrategy,\n addEntryMutation,\n ],\n );\n\n /**\n * Calls mutation to clone a selection\n * @private\n */\n const { mutateAsync: cloneEntryMutation } = useMutation({\n mutationFn: ([rundownId, entryId, options]: Parameters<typeof postCloneEntry>) =>\n postCloneEntry(rundownId, entryId, options),\n onMutate: () => queryClient.cancelQueries({ queryKey: RUNDOWN }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: RUNDOWN }),\n });\n\n /**\n * Clone an entry\n */\n const clone = useCallback(\n async (entryId: EntryId, options?: InsertOptions) => {\n try {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n await cloneEntryMutation([rundownId, entryId, options]);\n } catch (error) {\n logAxiosError('Error cloning entry', error);\n }\n },\n [cloneEntryMutation, getCurrentRundownData],\n );\n\n /**\n * Calls mutation to update existing entry\n * @private\n */\n const { mutateAsync: updateEntryMutation } = useMutation({\n mutationFn: ([rundownId, newEvent]: Parameters<typeof putEditEntry>) => putEditEntry(rundownId, newEvent),\n // we optimistically update here\n onMutate: async ([_rundownId, newEvent]) => {\n // cancel ongoing queries\n await queryClient.cancelQueries({ queryKey: RUNDOWN });\n\n // Snapshot the previous value\n const previousData = queryClient.getQueryData<Rundown>(RUNDOWN);\n const eventId = newEvent.id;\n\n if (previousData && eventId) {\n // optimistically update object\n const newRundown = { ...previousData.entries };\n // @ts-expect-error -- we expect the events to be of same type\n newRundown[eventId] = { ...newRundown[eventId], ...newEvent };\n queryClient.setQueryData<Rundown>(RUNDOWN, {\n id: previousData.id,\n title: previousData.title,\n order: previousData.order,\n flatOrder: previousData.flatOrder,\n entries: newRundown,\n revision: -1,\n });\n }\n\n // Return a context with the previous and new events\n return { previousData, newEvent };\n },\n // Mutation fails, rollback undoes optimist update\n onError: (_error, _newEvent, context) => {\n if (context?.previousData) {\n queryClient.setQueryData<Rundown>(RUNDOWN, context?.previousData);\n }\n },\n // Mutation finished, failed or successful\n // Fetch anyway, just to be sure\n onSettled: async () => {\n await queryClient.invalidateQueries({ queryKey: RUNDOWN });\n },\n });\n\n /**\n * Updates existing entry\n */\n const updateEntry = useCallback(\n async (entry: Partial<OntimeEntry>) => {\n try {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n await updateEntryMutation([rundownId, entry]);\n } catch (error) {\n logAxiosError('Error updating event', error);\n }\n },\n [getCurrentRundownData, updateEntryMutation],\n );\n\n /**\n * Updates time of existing event\n * @param eventId {EntryId} - id of the event\n * @param field {TimeField} - field to update\n * @param value {string} - new value string to be parsed\n * @param lockOnUpdate {boolean} - whether we will apply the lock / release on update\n */\n const updateTimer = useCallback(\n async (eventId: EntryId, field: TimeField, value: string, lockOnUpdate?: boolean) => {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n // an empty value with no lock has no domain validity\n if (!lockOnUpdate && value === '') {\n return;\n }\n\n const newEvent: Partial<OntimeEvent> = {\n id: eventId,\n };\n\n // check if we should lock the field\n if (lockOnUpdate) {\n if (field === 'timeEnd') {\n // an empty value indicates that we should unlock the field\n newEvent.timeStrategy = value === '' ? TimeStrategy.LockDuration : TimeStrategy.LockEnd;\n newEvent.timeEnd = value === '' ? undefined : calculateNewValue();\n } else if (field === 'duration') {\n // an empty value indicates that we should unlock the field\n newEvent.timeStrategy = value === '' ? TimeStrategy.LockEnd : TimeStrategy.LockDuration;\n newEvent.duration = value === '' ? undefined : calculateNewValue();\n } else if (field === 'timeStart') {\n // an empty values means we should link to the previous\n newEvent.linkStart = value === '';\n newEvent.timeStart = value === '' ? undefined : calculateNewValue();\n }\n } else {\n newEvent[field] = calculateNewValue();\n }\n\n try {\n await updateEntryMutation([rundownId, newEvent]);\n } catch (error) {\n logAxiosError('Error updating event', error);\n }\n\n /**\n * Utility function to calculate the new time value\n */\n function calculateNewValue(): number {\n let newValMillis = 0;\n\n // check for previous keyword\n if (value === 'p' || value === 'prev' || value === 'previous') {\n newValMillis = getPreviousEnd();\n\n // check for adding time keyword\n } else if (value.startsWith('+') || value.startsWith('p+') || value.startsWith('p +')) {\n // TODO: is this logic solid?\n const remainingString = value.substring(1);\n newValMillis = getPreviousEnd() + parseUserTime(remainingString);\n } else {\n newValMillis = parseUserTime(value);\n }\n // dont allow timer values over 23:59:59\n return Math.min(newValMillis, dayInMs - MILLIS_PER_SECOND);\n }\n\n /**\n * Utility function to get the previous event end time\n */\n function getPreviousEnd(): number {\n const cachedRundown = queryClient.getQueryData<Rundown>(RUNDOWN);\n\n if (!cachedRundown?.order || !cachedRundown?.entries) {\n return 0;\n }\n\n const index = cachedRundown.order.indexOf(eventId);\n if (index === 0) {\n return 0;\n }\n let previousEnd = 0;\n for (let i = index - 1; i >= 0; i--) {\n const event = cachedRundown.entries[cachedRundown.order[i]];\n if (isOntimeEvent(event)) {\n previousEnd = event.timeEnd;\n break;\n }\n }\n return previousEnd;\n }\n },\n [getCurrentRundownData, updateEntryMutation, queryClient],\n );\n\n /**\n * Calls mutation to edit multiple events\n * @private\n */\n const { mutateAsync: batchUpdateEventsMutation } = useMutation({\n mutationFn: ([rundownId, data]: Parameters<typeof putBatchEditEvents>) => putBatchEditEvents(rundownId, data),\n onMutate: async ([_rundownId, data]) => {\n // cancel ongoing queries\n await queryClient.cancelQueries({ queryKey: RUNDOWN });\n\n // Snapshot the previous value\n const previousRundown = queryClient.getQueryData<Rundown>(RUNDOWN);\n\n if (previousRundown) {\n const eventIds = new Set(data.ids);\n const newRundown = { ...previousRundown.entries };\n\n eventIds.forEach((eventId) => {\n if (Object.hasOwn(newRundown, eventId)) {\n const event = newRundown[eventId];\n if (isOntimeEvent(event)) {\n newRundown[eventId] = {\n ...event,\n ...data,\n };\n }\n }\n });\n\n queryClient.setQueryData<Rundown>(RUNDOWN, {\n id: previousRundown.id,\n title: previousRundown.title,\n order: previousRundown.order,\n flatOrder: previousRundown.flatOrder,\n entries: newRundown,\n revision: -1,\n });\n }\n\n // Return a context with the previous rundown\n return { previousRundown };\n },\n onSuccess: (response) => {\n if (!response.data) return;\n\n const { id, title, order, flatOrder, entries, revision } = response.data;\n queryClient.setQueryData<Rundown>(RUNDOWN, {\n id,\n title,\n order,\n flatOrder,\n entries,\n revision,\n });\n },\n onError: (_error, _newEvent, context) => {\n queryClient.setQueryData<Rundown>(RUNDOWN, context?.previousRundown);\n },\n });\n\n const batchUpdateEvents = useCallback(\n async (data: Partial<OntimeEvent>, eventIds: EntryId[]) => {\n try {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n await batchUpdateEventsMutation([rundownId, { data, ids: eventIds }]);\n } catch (error) {\n logAxiosError('Error updating events', error);\n }\n },\n [batchUpdateEventsMutation, getCurrentRundownData],\n );\n\n /**\n * Calls mutation to delete an entry\n * @private\n */\n const { mutateAsync: deleteEntryMutation } = useMutation({\n mutationFn: ([rundownId, entryIds]: Parameters<typeof deleteEntries>) => deleteEntries(rundownId, entryIds),\n // we optimistically update here\n onMutate: async ([_rundownId, entryIds]) => {\n // cancel ongoing queries\n await queryClient.cancelQueries({ queryKey: RUNDOWN });\n\n // Snapshot the previous value\n const previousData = queryClient.getQueryData<Rundown>(RUNDOWN);\n\n if (previousData) {\n // optimistically update object\n const { entries, order, flatOrder } = optimisticDeleteEntries(entryIds, previousData);\n\n queryClient.setQueryData<Rundown>(RUNDOWN, {\n id: previousData.id,\n title: previousData.title,\n order,\n flatOrder,\n entries,\n revision: -1,\n });\n }\n\n // Return a context with the previous and new events\n return { previousData };\n },\n\n // Mutation fails, rollback undoes optimist update\n onError: (_error, _entryIds, context) => {\n queryClient.setQueryData<Rundown>(RUNDOWN, context?.previousData);\n },\n // Mutation finished, failed or successful\n // Fetch anyway, just to be sure\n onSettled: () => {\n queryClient.invalidateQueries({ queryKey: RUNDOWN });\n },\n });\n\n /**\n * Deletes an event entry from the rundown\n */\n const deleteEntry = useCallback(\n async (entryIds: EntryId[]) => {\n try {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n await deleteEntryMutation([rundownId, entryIds]);\n } catch (error) {\n logAxiosError('Error deleting event', error);\n }\n },\n [deleteEntryMutation, getCurrentRundownData],\n );\n\n /**\n * Calls mutation to delete all events\n * @private\n */\n const { mutateAsync: deleteAllEntriesMutation } = useMutation({\n mutationFn: ([rundownId]: Parameters<typeof requestDeleteAll>) => requestDeleteAll(rundownId),\n // we optimistically update here\n onMutate: async () => {\n // cancel ongoing queries\n await queryClient.cancelQueries({ queryKey: RUNDOWN });\n\n // Snapshot the previous value\n const previousData = queryClient.getQueryData<Rundown>(RUNDOWN);\n\n // optimistically update object\n queryClient.setQueryData<Rundown>(RUNDOWN, {\n id: previousData?.id ?? 'default',\n title: previousData?.title ?? '',\n order: [],\n flatOrder: [],\n entries: {},\n revision: -1,\n });\n\n // Return a context with the previous and new events\n return { previousData };\n },\n\n // Mutation fails, rollback optimist update\n onError: (_error, _, context) => {\n queryClient.setQueryData<Rundown>(RUNDOWN, context?.previousData);\n },\n // Mutation finished, failed or successful\n // Fetch anyway, just to be sure\n onSettled: () => {\n queryClient.invalidateQueries({ queryKey: RUNDOWN });\n },\n });\n\n /**\n * Deletes all entries in the rundown\n */\n const deleteAllEntries = useCallback(async () => {\n try {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n await deleteAllEntriesMutation([rundownId]);\n } catch (error) {\n logAxiosError('Error deleting events', error);\n }\n }, [deleteAllEntriesMutation, getCurrentRundownData]);\n\n /**\n * Calls mutation to apply a delay\n * @private\n */\n const { mutateAsync: applyDelayMutation } = useMutation({\n mutationFn: ([rundownId, delayId]: Parameters<typeof requestApplyDelay>) => requestApplyDelay(rundownId, delayId),\n onMutate: () => queryClient.cancelQueries({ queryKey: RUNDOWN }),\n onSuccess: (response) => {\n if (!response.data) return;\n\n const { id, title, order, flatOrder, entries, revision } = response.data;\n queryClient.setQueryData<Rundown>(RUNDOWN, {\n id,\n title,\n order,\n flatOrder,\n entries,\n revision,\n });\n },\n // Mutation finished, failed or successful\n onSettled: () => {\n queryClient.invalidateQueries({ queryKey: RUNDOWN });\n },\n });\n\n /**\n * Applies a given delay\n */\n const applyDelay = useCallback(\n async (delayEventId: EntryId) => {\n try {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n await applyDelayMutation([rundownId, delayEventId]);\n } catch (error) {\n logAxiosError('Error applying delay', error);\n }\n },\n [applyDelayMutation, getCurrentRundownData],\n );\n\n /**\n * Calls mutation to dissolve a group\n * @private\n */\n const { mutateAsync: ungroupMutation } = useMutation({\n mutationFn: ([rundownId, groupId]: Parameters<typeof requestUngroup>) => requestUngroup(rundownId, groupId),\n onMutate: () => queryClient.cancelQueries({ queryKey: RUNDOWN }),\n onSuccess: (response) => {\n if (!response.data) return;\n\n const { id, title, order, flatOrder, entries, revision } = response.data;\n queryClient.setQueryData<Rundown>(RUNDOWN, {\n id,\n title,\n order,\n flatOrder,\n entries,\n revision,\n });\n },\n onSettled: () => queryClient.invalidateQueries({ queryKey: RUNDOWN }),\n });\n\n /**\n * Deletes a group and moves its events to the top level\n */\n const ungroup = useCallback(\n async (groupId: EntryId) => {\n try {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n await ungroupMutation([rundownId, groupId]);\n } catch (error) {\n logAxiosError('Error dissolving group', error);\n }\n },\n [getCurrentRundownData, ungroupMutation],\n );\n\n /**\n * Calls mutation to create a group with a selection\n * @private\n */\n const { mutateAsync: groupEntriesMutation } = useMutation({\n mutationFn: ([rundownId, entryIds]: Parameters<typeof requestGroupEntries>) =>\n requestGroupEntries(rundownId, entryIds),\n onMutate: () => queryClient.cancelQueries({ queryKey: RUNDOWN }),\n onSuccess: (response) => {\n if (!response.data) return;\n\n const { id, title, order, flatOrder, entries, revision } = response.data;\n queryClient.setQueryData<Rundown>(RUNDOWN, {\n id,\n title,\n order,\n flatOrder,\n entries,\n revision,\n });\n },\n onSettled: () => queryClient.invalidateQueries({ queryKey: RUNDOWN }),\n });\n\n /**\n * Create a group with a selection\n */\n const groupEntries = useCallback(\n async (entryIds: EntryId[]) => {\n if (entryIds.length === 0) return;\n\n try {\n const rundownData = getCurrentRundownData();\n const rundownId = rundownData?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n if (entryIds.length === 1) {\n await groupEntriesMutation([rundownId, entryIds]);\n } else {\n // the user selection may be out of order\n const orderedIds = orderEntries(entryIds, rundownData.flatOrder);\n await groupEntriesMutation([rundownId, orderedIds]);\n }\n } catch (error) {\n logAxiosError('Error grouping entries', error);\n }\n },\n [getCurrentRundownData, groupEntriesMutation],\n );\n\n /**\n * Calls mutation to reorder an entry\n * @private\n */\n const { mutateAsync: reorderEntryMutation } = useMutation({\n mutationFn: ([rundownId, data]: Parameters<typeof patchReorderEntry>) => patchReorderEntry(rundownId, data),\n onMutate: () => queryClient.cancelQueries({ queryKey: RUNDOWN }),\n onSettled: () => {\n queryClient.invalidateQueries({ queryKey: RUNDOWN });\n },\n });\n\n /**\n * Reorders a given entry one step up or down in the timeline\n */\n const move = useCallback(\n async (entryId: EntryId, direction: 'up' | 'down') => {\n try {\n const rundownData = getCurrentRundownData();\n const rundownId = rundownData?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n const { destinationId, order } =\n direction === 'up'\n ? moveUp(entryId, rundownData.flatOrder, rundownData.entries)\n : moveDown(entryId, rundownData.flatOrder, rundownData.entries);\n\n if (!destinationId) {\n return; // noop\n }\n\n const reorderObject: ReorderEntry = {\n entryId,\n destinationId,\n order,\n };\n await reorderEntryMutation([rundownId, reorderObject]);\n // the rundown needs to know whether we moved into a group\n return rundownData.entries[destinationId]?.type === SupportedEntry.Group ? destinationId : undefined;\n } catch (error) {\n logAxiosError('Error re-ordering event', error);\n }\n return undefined;\n },\n [getCurrentRundownData, reorderEntryMutation],\n );\n /**\n * Reorders a given entry\n */\n const reorderEntry = useCallback(\n async (entryId: EntryId, destinationId: EntryId, order: 'before' | 'after' | 'insert') => {\n try {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n await reorderEntryMutation([\n rundownId,\n {\n entryId,\n destinationId,\n order,\n },\n ]);\n } catch (error) {\n logAxiosError('Error re-ordering event', error);\n throw error; // rethrow to handle in the component\n }\n },\n [getCurrentRundownData, reorderEntryMutation],\n );\n\n /**\n * Calls mutation to swap events\n * @private\n */\n const { mutateAsync: swapEventsMutation } = useMutation({\n mutationFn: ([rundownId, from, to]: Parameters<typeof requestEventSwap>) => requestEventSwap(rundownId, from, to),\n // we optimistically update here\n onMutate: async ([_rundownId, from, to]) => {\n // cancel ongoing queries\n await queryClient.cancelQueries({ queryKey: RUNDOWN });\n\n // Snapshot the previous value\n const previousData = queryClient.getQueryData<Rundown>(RUNDOWN);\n if (previousData) {\n // optimistically update object\n const newRundown = { ...previousData.entries };\n const eventA = previousData.entries[from];\n const eventB = previousData.entries[to];\n\n if (!isOntimeEvent(eventA) || !isOntimeEvent(eventB)) {\n return;\n }\n\n const [newA, newB] = swapEventData(eventA, eventB);\n newRundown[from] = newA;\n newRundown[to] = newB;\n\n queryClient.setQueryData<Rundown>(RUNDOWN, {\n id: previousData.id,\n title: previousData.title,\n order: previousData.order,\n flatOrder: previousData.flatOrder,\n entries: newRundown,\n revision: -1,\n });\n }\n\n // Return a context with the previous events\n return { previousData };\n },\n\n // Mutation fails, rollback undoes optimist update\n onError: (_error, _eventId, context) => {\n queryClient.setQueryData<Rundown>(RUNDOWN, context?.previousData);\n },\n // Mutation finished, failed or successful\n // Fetch anyway, just to be sure\n onSettled: () => {\n queryClient.invalidateQueries({ queryKey: RUNDOWN });\n },\n });\n\n /**\n * Swaps the schedule of two events\n */\n const swapEvents = useCallback(\n async (from: EntryId, to: EntryId) => {\n try {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n await swapEventsMutation([rundownId, from, to]);\n } catch (error) {\n logAxiosError('Error re-ordering event', error);\n }\n },\n [getCurrentRundownData, swapEventsMutation],\n );\n\n return {\n addEntry,\n applyDelay,\n batchUpdateEvents,\n clone,\n deleteEntry,\n deleteAllEntries,\n ungroup,\n getEntryById,\n groupEntries,\n move,\n reorderEntry,\n swapEvents,\n updateEntry,\n updateTimer,\n };\n};\n\n/**\n * Utility to optimistically delete entries from client cache\n */\nfunction optimisticDeleteEntries(entryIds: EntryId[], rundown: Rundown) {\n const entries = { ...rundown.entries };\n let order = [...rundown.order];\n let flatOrder = [...rundown.flatOrder];\n\n for (let i = 0; i < entryIds.length; i++) {\n const entry = entries[entryIds[i]];\n deleteEntry(entry);\n }\n\n function deleteEntry(entry: OntimeEntry) {\n if (isOntimeGroup(entry) || !entry.parent) {\n order = order.filter((id) => id !== entry.id);\n } else {\n const parent = entries[entry.parent];\n if (parent && isOntimeGroup(parent)) {\n parent.entries = parent.entries.filter((parentEntry) => parentEntry !== entry.id);\n }\n }\n\n delete entries[entry.id];\n flatOrder = flatOrder.filter((id) => id !== entry.id);\n }\n\n return { entries, order, flatOrder };\n}\n","import { MaybeNumber } from 'ontime-types';\nimport { formatFromMillis, MILLIS_PER_HOUR, MILLIS_PER_MINUTE } from 'ontime-utils';\n\n/**\n * Parses a value in millis to a string which encodes a delay\n * @param millis\n * @param format\n */\nexport function millisToDelayString(millis: MaybeNumber, format: 'compact' | 'expanded' = 'compact'): string {\n if (millis == null || millis === 0) {\n return '';\n }\n\n const isNegative = millis < 0;\n const absMillis = Math.abs(millis);\n const isCompact = format === 'compact';\n const delayed = isCompact ? '+' : 'delayed by ';\n const ahead = isCompact ? '-' : 'ahead by ';\n\n if (absMillis < MILLIS_PER_MINUTE) {\n return `${isNegative ? ahead : delayed}${formatFromMillis(absMillis, 's')} sec`;\n } else if (absMillis < MILLIS_PER_HOUR && absMillis % MILLIS_PER_MINUTE === 0) {\n return `${isNegative ? ahead : delayed}${formatFromMillis(absMillis, 'm')} min`;\n }\n\n return `${isNegative ? ahead : delayed}${formatFromMillis(absMillis, 'HH:mm:ss')}`;\n}\n"],"names":["makeSortableList","order","entries","flatIds","i","length","entry","isOntimeGroup","push","id","canDrop","targetType","targetParent","isTargetCollapsed","undefined","moveUp","entryId","flatOrder","currentEntry","currentIndex","indexOf","previousEntryId","parent","destinationId","previousEntry","currentEntryParent","isOntimeEvent","moveDown","nextEntryId","parentGroup","includes","afterGroupIndex","afterGroupId","nextEntry","orderEntries","unorderedArray","orderedArray","useEntryActions","queryClient","useQueryClient","linkPrevious","defaultTimeStrategy","defaultDuration","defaultWarnTime","defaultDangerTime","defaultTimerType","defaultEndAction","useEditorSettings","getCurrentRundownData","useCallback","getQueryData","RUNDOWN","getEntryById","eventId","cachedRundown","mutateAsync","addEntryMutation","useMutation","mutationFn","rundownId","postAddEntry","onMutate","cancelQueries","queryKey","onSettled","invalidateQueries","addEntry","options","rundownData","Error","newEntry","generateId","lastEventId","previousEvent","timeStart","timeEnd","linkStart","duration","parseUserTime","timeDanger","timeWarning","timerType","endAction","timeStrategy","after","before","error","logAxiosError","cloneEntryMutation","postCloneEntry","clone","updateEntryMutation","newEvent","putEditEntry","_rundownId","previousData","newRundown","setQueryData","title","revision","onError","_error","_newEvent","context","updateEntry","updateTimer","field","value","lockOnUpdate","TimeStrategy","LockDuration","LockEnd","calculateNewValue","newValMillis","getPreviousEnd","startsWith","remainingString","substring","Math","min","dayInMs","MILLIS_PER_SECOND","index","previousEnd","event","batchUpdateEventsMutation","data","putBatchEditEvents","previousRundown","eventIds","Set","ids","forEach","Object","hasOwn","onSuccess","response","batchUpdateEvents","deleteEntryMutation","entryIds","deleteEntries","optimisticDeleteEntries","_entryIds","deleteEntry","deleteAllEntriesMutation","requestDeleteAll","_","deleteAllEntries","applyDelayMutation","delayId","requestApplyDelay","applyDelay","delayEventId","ungroupMutation","groupId","requestUngroup","ungroup","groupEntriesMutation","requestGroupEntries","groupEntries","orderedIds","reorderEntryMutation","patchReorderEntry","move","direction","type","SupportedEntry","Group","reorderEntry","swapEventsMutation","from","to","requestEventSwap","eventA","eventB","newA","newB","swapEventData","_eventId","swapEvents","rundown","filter","parentEntry","millisToDelayString","millis","format","isNegative","absMillis","abs","isCompact","delayed","ahead","MILLIS_PER_MINUTE","formatFromMillis","MILLIS_PER_HOUR"],"mappings":"00BAQgBA,SAAAA,GAAiBC,EAAkBC,EAAoC,CACrF,MAAMC,EAAqB,CAAE,EAE7B,QAASC,EAAI,EAAGA,EAAIH,EAAMI,OAAQD,IAAK,CACrC,MAAME,EAAQJ,EAAQD,EAAMG,CAAC,CAAC,EAEzBE,IAIDC,EAAcD,CAAK,GAGbE,EAAAA,KAAKF,EAAMG,EAAE,EACbD,EAAAA,KAAK,GAAG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../../src/common/hooks/useEntryAction.ts","../../src/common/utils/dateConfig.ts"],"sourcesContent":["import { EntryId, isOntimeEvent, isOntimeGroup, RundownEntries, SupportedEntry } from 'ontime-types';\n\n/**\n * Creates a sortable list of entries\n * ------------------------------------\n * Due to limitations in dnd-kit we need to flatten the list of entries\n * This list should also be aware of any elements that are sortable (ie: group ends)\n */\nexport function makeSortableList(order: EntryId[], entries: RundownEntries): EntryId[] {\n const flatIds: EntryId[] = [];\n\n for (let i = 0; i < order.length; i++) {\n const entry = entries[order[i]];\n\n if (!entry) {\n continue;\n }\n\n if (isOntimeGroup(entry)) {\n // inside a group there are delays and events\n // there is no need for special handling\n flatIds.push(entry.id);\n flatIds.push(...entry.entries);\n\n // close the group\n flatIds.push(`end-${entry.id}`);\n } else {\n flatIds.push(entry.id);\n }\n }\n return flatIds;\n}\n\n/**\n * Checks whether a drop operation is valid\n * Currently only used for validating dropping groups\n */\nexport function canDrop(\n targetType: SupportedEntry | 'end-group',\n targetParent: EntryId | null,\n order?: 'after' | 'before',\n isTargetCollapsed?: boolean,\n): boolean {\n // inserting before would mean adding a group inside another\n if (targetType === 'end-group') {\n return order === 'after';\n }\n\n // this means swapping places with another group\n // !!! if the user is dragging down, they could be inserting into a group depending on whether the group is collapsed\n if (targetType === 'group') {\n if (order !== undefined && order === 'after' && !isTargetCollapsed) {\n return false;\n }\n return true;\n }\n\n // for all other cases, we just need to check if we are inside a group\n return targetParent === null;\n}\n\n/**\n * calculates destinations for an entry moving one position up in the rundown\n * @returns An object describing how to move the entry:\n * - destinationId: The target entry ID (null if no movement possible)\n * - order: How to position relative to the destination:\n * - 'before': Place before the destination\n * - 'after': Place after the destination\n * - 'insert': Insert into the destination (for groups)\n */\nexport function moveUp(\n entryId: EntryId,\n flatOrder: EntryId[],\n entries: RundownEntries,\n): { destinationId: EntryId | null; order: 'before' | 'after' | 'insert' } {\n const currentEntry = entries[entryId];\n const currentIndex = flatOrder.indexOf(entryId);\n const previousEntryId = flatOrder[currentIndex - 1];\n\n // 1. moving at the top of the list\n if (!previousEntryId) {\n // 1a. we are in a group and need to move outside of it\n if ('parent' in currentEntry && currentEntry.parent !== null) {\n return { destinationId: currentEntry.parent, order: 'before' };\n }\n // 1b. we are at the start of the rundown, no movement possible\n return { destinationId: null, order: 'before' };\n }\n\n // 2. moving a group (always moves at top level)\n if (isOntimeGroup(currentEntry)) {\n // 21. if previous entry is inside a group, swap with parent\n const previousEntry = entries[previousEntryId];\n if ('parent' in previousEntry && previousEntry.parent !== null) {\n return { destinationId: previousEntry.parent, order: 'before' };\n }\n\n // 2b. previous entry is at top level, we just swap places\n return { destinationId: previousEntryId, order: 'before' };\n }\n\n const previousEntry = entries[previousEntryId];\n const currentEntryParent = currentEntry.parent;\n\n // 3. moving in and out of a group\n if (isOntimeGroup(previousEntry)) {\n // 3a. if we're not already in the group, move into it\n if (currentEntryParent === null) {\n return { destinationId: previousEntryId, order: 'insert' };\n }\n // 3b. otherwise, move before the group\n return { destinationId: previousEntryId, order: 'before' };\n }\n\n // 4. moving into the same group as previous entry\n if (isOntimeEvent(previousEntry) && previousEntry.parent !== null && currentEntryParent === null) {\n return { destinationId: previousEntryId, order: 'after' };\n }\n\n // default - swap positions with previous entry\n return { destinationId: previousEntryId, order: 'before' };\n}\n\n/**\n * calculates destinations for an entry moving one position down in the rundown\n * @returns An object describing how to move the entry:\n * - destinationId: The target entry ID (null if no movement possible)\n * - order: How to position relative to the destination:\n * - 'before': Place before the destination\n * - 'after': Place after the destination\n * - 'insert': Insert into the destination (for groups)\n */\nexport function moveDown(\n entryId: EntryId,\n flatOrder: EntryId[],\n entries: RundownEntries,\n): { destinationId: EntryId | null; order: 'before' | 'after' | 'insert' } {\n const currentEntry = entries[entryId];\n const currentIndex = flatOrder.indexOf(entryId);\n const nextEntryId = flatOrder[currentIndex + 1];\n\n // 1. check if we're the last entry in a group\n if ('parent' in currentEntry && currentEntry.parent !== null) {\n const parentGroup = entries[currentEntry.parent];\n if (isOntimeGroup(parentGroup) && parentGroup.entries[parentGroup.entries.length - 1] === entryId) {\n return { destinationId: currentEntry.parent, order: 'after' };\n }\n }\n\n // 2. moving at the end of the list\n if (!nextEntryId) {\n return { destinationId: null, order: 'after' };\n }\n\n // 3. moving a group (always moves at top level)\n if (isOntimeGroup(currentEntry)) {\n // if next entry is inside this group, skip past all children\n if (currentEntry.entries.includes(nextEntryId)) {\n const afterGroupIndex = currentIndex + currentEntry.entries.length + 1;\n const afterGroupId = flatOrder[afterGroupIndex];\n\n // 2a. group is the last top level entry\n if (!afterGroupId) {\n return { destinationId: null, order: 'after' };\n }\n // 2b. move after the next top level event\n return { destinationId: afterGroupId, order: 'after' };\n }\n // 2c. empty group move after the next entry\n return { destinationId: nextEntryId, order: 'after' };\n }\n\n const nextEntry = entries[nextEntryId];\n const currentEntryParent = currentEntry.parent;\n\n // 4. handle moving relative to groups\n if (isOntimeGroup(nextEntry)) {\n if (currentEntryParent === null) {\n // we are entering a group\n if (nextEntry.entries.length === 0) {\n // 3a. if the group is empty, insert into it\n return { destinationId: nextEntryId, order: 'insert' };\n }\n // 3b. otherwise, add before the first entry in the group\n const firstGroupEntryId = nextEntry.entries[0];\n return { destinationId: firstGroupEntryId, order: 'before' };\n }\n }\n\n // 5. handle moving between group and top level\n const nextEntryParent = isOntimeEvent(nextEntry) ? nextEntry.parent : null;\n if (nextEntryParent !== null && currentEntryParent === null) {\n return { destinationId: nextEntryId, order: 'after' };\n }\n\n // default - swap positions with next entry\n return { destinationId: nextEntryId, order: 'after' };\n}\n\n/**\n * Reorders unorderedArray to match the flatOrder entries\n * Useful for operations that convert selections (out of order) to rundown\n */\nexport function orderEntries(unorderedArray: EntryId[], flatOrder: EntryId[]): EntryId[] {\n const orderedArray: EntryId[] = [];\n for (const id of flatOrder) {\n if (unorderedArray.includes(id)) {\n orderedArray.push(id);\n }\n }\n return orderedArray;\n}\n","import { useCallback } from 'react';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport {\n EntryId,\n InsertOptions,\n isOntimeEvent,\n isOntimeGroup,\n MaybeString,\n OntimeEntry,\n OntimeEvent,\n Rundown,\n SupportedEntry,\n TimeField,\n TimeStrategy,\n TransientEventPayload,\n} from 'ontime-types';\nimport { dayInMs, generateId, MILLIS_PER_SECOND, parseUserTime, swapEventData } from 'ontime-utils';\n\nimport { moveDown, moveUp, orderEntries } from '../../features/rundown/rundown.utils';\nimport { RUNDOWN } from '../api/constants';\nimport {\n deleteEntries,\n patchReorderEntry,\n postAddEntry,\n postCloneEntry,\n putBatchEditEvents,\n putEditEntry,\n ReorderEntry,\n requestApplyDelay,\n requestDeleteAll,\n requestEventSwap,\n requestGroupEntries,\n requestUngroup,\n} from '../api/rundown';\nimport { logAxiosError } from '../api/utils';\nimport { useEditorSettings } from '../stores/editorSettings';\n\nexport type EventOptions = Partial<{\n // options of any new entries (event / delay / group)\n after: MaybeString;\n before: MaybeString;\n // options of entries of type OntimeEvent\n linkPrevious: boolean;\n lastEventId: MaybeString;\n}>;\n\n/**\n * Gather utilities for actions on entries\n */\nexport const useEntryActions = () => {\n const queryClient = useQueryClient();\n const {\n linkPrevious,\n defaultTimeStrategy,\n defaultDuration,\n defaultWarnTime,\n defaultDangerTime,\n defaultTimerType,\n defaultEndAction,\n } = useEditorSettings();\n\n /**\n * Returns the currently loaded rundown\n */\n const getCurrentRundownData = useCallback(() => {\n return queryClient.getQueryData<Rundown>(RUNDOWN);\n }, [queryClient]);\n\n /**\n * Looks for an entry with a given ID in the currently loaded rundown\n */\n const getEntryById = useCallback(\n (eventId: EntryId): OntimeEntry | undefined => {\n const cachedRundown = getCurrentRundownData();\n if (!cachedRundown?.entries) {\n return;\n }\n return cachedRundown.entries[eventId];\n },\n [getCurrentRundownData],\n );\n\n /**\n * Calls mutation to add new entry\n * @private\n */\n const { mutateAsync: addEntryMutation } = useMutation({\n mutationFn: ([rundownId, entry]: Parameters<typeof postAddEntry>) => postAddEntry(rundownId, entry),\n onMutate: () => queryClient.cancelQueries({ queryKey: RUNDOWN }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: RUNDOWN }),\n });\n\n /**\n * Adds an entry to rundown\n */\n const addEntry = useCallback(\n async (entry: Partial<OntimeEntry>, options?: EventOptions) => {\n const rundownData = getCurrentRundownData();\n const rundownId = rundownData?.id;\n\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n const newEntry: TransientEventPayload = { ...entry, id: generateId() };\n\n // ************* CHECK OPTIONS specific to events\n if (isOntimeEvent(newEntry)) {\n if (options?.lastEventId) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- we know this is a value\n const previousEvent = rundownData.entries[options?.lastEventId];\n if (isOntimeEvent(previousEvent)) {\n newEntry.timeStart = previousEvent.timeEnd;\n }\n }\n\n // Override event with options from editor settings\n newEntry.linkStart = options?.linkPrevious ?? linkPrevious;\n\n if (newEntry.duration === undefined && newEntry.timeEnd === undefined) {\n newEntry.duration = parseUserTime(defaultDuration);\n }\n\n if (newEntry.timeDanger === undefined) {\n newEntry.timeDanger = parseUserTime(defaultDangerTime);\n }\n\n if (newEntry.timeWarning === undefined) {\n newEntry.timeWarning = parseUserTime(defaultWarnTime);\n }\n\n if (newEntry.timerType === undefined) {\n newEntry.timerType = defaultTimerType;\n }\n\n if (newEntry.endAction === undefined) {\n newEntry.endAction = defaultEndAction;\n }\n\n if (newEntry.timeStrategy === undefined) {\n newEntry.timeStrategy = defaultTimeStrategy;\n }\n }\n\n // handle adding options that concern all event type\n if (options?.after) {\n (newEntry as TransientEventPayload).after = options.after;\n }\n if (options?.before) {\n (newEntry as TransientEventPayload).before = options.before;\n }\n\n try {\n await addEntryMutation([rundownId, newEntry]);\n } catch (error) {\n logAxiosError('Failed adding event', error);\n }\n },\n [\n getCurrentRundownData,\n linkPrevious,\n defaultDuration,\n defaultDangerTime,\n defaultWarnTime,\n defaultTimerType,\n defaultEndAction,\n defaultTimeStrategy,\n addEntryMutation,\n ],\n );\n\n /**\n * Calls mutation to clone a selection\n * @private\n */\n const { mutateAsync: cloneEntryMutation } = useMutation({\n mutationFn: ([rundownId, entryId, options]: Parameters<typeof postCloneEntry>) =>\n postCloneEntry(rundownId, entryId, options),\n onMutate: () => queryClient.cancelQueries({ queryKey: RUNDOWN }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: RUNDOWN }),\n });\n\n /**\n * Clone an entry\n */\n const clone = useCallback(\n async (entryId: EntryId, options?: InsertOptions) => {\n try {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n await cloneEntryMutation([rundownId, entryId, options]);\n } catch (error) {\n logAxiosError('Error cloning entry', error);\n }\n },\n [cloneEntryMutation, getCurrentRundownData],\n );\n\n /**\n * Calls mutation to update existing entry\n * @private\n */\n const { mutateAsync: updateEntryMutation } = useMutation({\n mutationFn: ([rundownId, newEvent]: Parameters<typeof putEditEntry>) => putEditEntry(rundownId, newEvent),\n // we optimistically update here\n onMutate: async ([_rundownId, newEvent]) => {\n // cancel ongoing queries\n await queryClient.cancelQueries({ queryKey: RUNDOWN });\n\n // Snapshot the previous value\n const previousData = queryClient.getQueryData<Rundown>(RUNDOWN);\n const eventId = newEvent.id;\n\n if (previousData && eventId) {\n // optimistically update object\n const newRundown = { ...previousData.entries };\n // @ts-expect-error -- we expect the events to be of same type\n newRundown[eventId] = { ...newRundown[eventId], ...newEvent };\n queryClient.setQueryData<Rundown>(RUNDOWN, {\n id: previousData.id,\n title: previousData.title,\n order: previousData.order,\n flatOrder: previousData.flatOrder,\n entries: newRundown,\n revision: -1,\n });\n }\n\n // Return a context with the previous and new events\n return { previousData, newEvent };\n },\n // Mutation fails, rollback undoes optimist update\n onError: (_error, _newEvent, context) => {\n if (context?.previousData) {\n queryClient.setQueryData<Rundown>(RUNDOWN, context?.previousData);\n }\n },\n // Mutation finished, failed or successful\n // Fetch anyway, just to be sure\n onSettled: async () => {\n await queryClient.invalidateQueries({ queryKey: RUNDOWN });\n },\n });\n\n /**\n * Updates existing entry\n */\n const updateEntry = useCallback(\n async (entry: Partial<OntimeEntry>) => {\n try {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n await updateEntryMutation([rundownId, entry]);\n } catch (error) {\n logAxiosError('Error updating event', error);\n }\n },\n [getCurrentRundownData, updateEntryMutation],\n );\n\n /**\n * Updates time of existing event\n * @param eventId {EntryId} - id of the event\n * @param field {TimeField} - field to update\n * @param value {string} - new value string to be parsed\n * @param lockOnUpdate {boolean} - whether we will apply the lock / release on update\n */\n const updateTimer = useCallback(\n async (eventId: EntryId, field: TimeField, value: string, lockOnUpdate?: boolean) => {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n // an empty value with no lock has no domain validity\n if (!lockOnUpdate && value === '') {\n return;\n }\n\n const newEvent: Partial<OntimeEvent> = {\n id: eventId,\n };\n\n // check if we should lock the field\n if (lockOnUpdate) {\n if (field === 'timeEnd') {\n // an empty value indicates that we should unlock the field\n newEvent.timeStrategy = value === '' ? TimeStrategy.LockDuration : TimeStrategy.LockEnd;\n newEvent.timeEnd = value === '' ? undefined : calculateNewValue();\n } else if (field === 'duration') {\n // an empty value indicates that we should unlock the field\n newEvent.timeStrategy = value === '' ? TimeStrategy.LockEnd : TimeStrategy.LockDuration;\n newEvent.duration = value === '' ? undefined : calculateNewValue();\n } else if (field === 'timeStart') {\n // an empty values means we should link to the previous\n newEvent.linkStart = value === '';\n newEvent.timeStart = value === '' ? undefined : calculateNewValue();\n }\n } else {\n newEvent[field] = calculateNewValue();\n }\n\n try {\n await updateEntryMutation([rundownId, newEvent]);\n } catch (error) {\n logAxiosError('Error updating event', error);\n }\n\n /**\n * Utility function to calculate the new time value\n */\n function calculateNewValue(): number {\n let newValMillis = 0;\n\n // check for previous keyword\n if (value === 'p' || value === 'prev' || value === 'previous') {\n newValMillis = getPreviousEnd();\n\n // check for adding time keyword\n } else if (value.startsWith('+') || value.startsWith('p+') || value.startsWith('p +')) {\n // TODO: is this logic solid?\n const remainingString = value.substring(1);\n newValMillis = getPreviousEnd() + parseUserTime(remainingString);\n } else {\n newValMillis = parseUserTime(value);\n }\n // dont allow timer values over 23:59:59\n return Math.min(newValMillis, dayInMs - MILLIS_PER_SECOND);\n }\n\n /**\n * Utility function to get the previous event end time\n */\n function getPreviousEnd(): number {\n const cachedRundown = queryClient.getQueryData<Rundown>(RUNDOWN);\n\n if (!cachedRundown?.order || !cachedRundown?.entries) {\n return 0;\n }\n\n const index = cachedRundown.order.indexOf(eventId);\n if (index === 0) {\n return 0;\n }\n let previousEnd = 0;\n for (let i = index - 1; i >= 0; i--) {\n const event = cachedRundown.entries[cachedRundown.order[i]];\n if (isOntimeEvent(event)) {\n previousEnd = event.timeEnd;\n break;\n }\n }\n return previousEnd;\n }\n },\n [getCurrentRundownData, updateEntryMutation, queryClient],\n );\n\n /**\n * Calls mutation to edit multiple events\n * @private\n */\n const { mutateAsync: batchUpdateEventsMutation } = useMutation({\n mutationFn: ([rundownId, data]: Parameters<typeof putBatchEditEvents>) => putBatchEditEvents(rundownId, data),\n onMutate: async ([_rundownId, data]) => {\n // cancel ongoing queries\n await queryClient.cancelQueries({ queryKey: RUNDOWN });\n\n // Snapshot the previous value\n const previousRundown = queryClient.getQueryData<Rundown>(RUNDOWN);\n\n if (previousRundown) {\n const eventIds = new Set(data.ids);\n const newRundown = { ...previousRundown.entries };\n\n eventIds.forEach((eventId) => {\n if (Object.hasOwn(newRundown, eventId)) {\n const event = newRundown[eventId];\n if (isOntimeEvent(event)) {\n newRundown[eventId] = {\n ...event,\n ...data,\n };\n }\n }\n });\n\n queryClient.setQueryData<Rundown>(RUNDOWN, {\n id: previousRundown.id,\n title: previousRundown.title,\n order: previousRundown.order,\n flatOrder: previousRundown.flatOrder,\n entries: newRundown,\n revision: -1,\n });\n }\n\n // Return a context with the previous rundown\n return { previousRundown };\n },\n onSuccess: (response) => {\n if (!response.data) return;\n\n const { id, title, order, flatOrder, entries, revision } = response.data;\n queryClient.setQueryData<Rundown>(RUNDOWN, {\n id,\n title,\n order,\n flatOrder,\n entries,\n revision,\n });\n },\n onError: (_error, _newEvent, context) => {\n queryClient.setQueryData<Rundown>(RUNDOWN, context?.previousRundown);\n },\n });\n\n const batchUpdateEvents = useCallback(\n async (data: Partial<OntimeEvent>, eventIds: EntryId[]) => {\n try {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n await batchUpdateEventsMutation([rundownId, { data, ids: eventIds }]);\n } catch (error) {\n logAxiosError('Error updating events', error);\n }\n },\n [batchUpdateEventsMutation, getCurrentRundownData],\n );\n\n /**\n * Calls mutation to delete an entry\n * @private\n */\n const { mutateAsync: deleteEntryMutation } = useMutation({\n mutationFn: ([rundownId, entryIds]: Parameters<typeof deleteEntries>) => deleteEntries(rundownId, entryIds),\n // we optimistically update here\n onMutate: async ([_rundownId, entryIds]) => {\n // cancel ongoing queries\n await queryClient.cancelQueries({ queryKey: RUNDOWN });\n\n // Snapshot the previous value\n const previousData = queryClient.getQueryData<Rundown>(RUNDOWN);\n\n if (previousData) {\n // optimistically update object\n const { entries, order, flatOrder } = optimisticDeleteEntries(entryIds, previousData);\n\n queryClient.setQueryData<Rundown>(RUNDOWN, {\n id: previousData.id,\n title: previousData.title,\n order,\n flatOrder,\n entries,\n revision: -1,\n });\n }\n\n // Return a context with the previous and new events\n return { previousData };\n },\n\n // Mutation fails, rollback undoes optimist update\n onError: (_error, _entryIds, context) => {\n queryClient.setQueryData<Rundown>(RUNDOWN, context?.previousData);\n },\n // Mutation finished, failed or successful\n // Fetch anyway, just to be sure\n onSettled: () => {\n queryClient.invalidateQueries({ queryKey: RUNDOWN });\n },\n });\n\n /**\n * Deletes an event entry from the rundown\n */\n const deleteEntry = useCallback(\n async (entryIds: EntryId[]) => {\n try {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n await deleteEntryMutation([rundownId, entryIds]);\n } catch (error) {\n logAxiosError('Error deleting event', error);\n }\n },\n [deleteEntryMutation, getCurrentRundownData],\n );\n\n /**\n * Calls mutation to delete all events\n * @private\n */\n const { mutateAsync: deleteAllEntriesMutation } = useMutation({\n mutationFn: ([rundownId]: Parameters<typeof requestDeleteAll>) => requestDeleteAll(rundownId),\n // we optimistically update here\n onMutate: async () => {\n // cancel ongoing queries\n await queryClient.cancelQueries({ queryKey: RUNDOWN });\n\n // Snapshot the previous value\n const previousData = queryClient.getQueryData<Rundown>(RUNDOWN);\n\n // optimistically update object\n queryClient.setQueryData<Rundown>(RUNDOWN, {\n id: previousData?.id ?? 'default',\n title: previousData?.title ?? '',\n order: [],\n flatOrder: [],\n entries: {},\n revision: -1,\n });\n\n // Return a context with the previous and new events\n return { previousData };\n },\n\n // Mutation fails, rollback optimist update\n onError: (_error, _, context) => {\n queryClient.setQueryData<Rundown>(RUNDOWN, context?.previousData);\n },\n // Mutation finished, failed or successful\n // Fetch anyway, just to be sure\n onSettled: () => {\n queryClient.invalidateQueries({ queryKey: RUNDOWN });\n },\n });\n\n /**\n * Deletes all entries in the rundown\n */\n const deleteAllEntries = useCallback(async () => {\n try {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n await deleteAllEntriesMutation([rundownId]);\n } catch (error) {\n logAxiosError('Error deleting events', error);\n }\n }, [deleteAllEntriesMutation, getCurrentRundownData]);\n\n /**\n * Calls mutation to apply a delay\n * @private\n */\n const { mutateAsync: applyDelayMutation } = useMutation({\n mutationFn: ([rundownId, delayId]: Parameters<typeof requestApplyDelay>) => requestApplyDelay(rundownId, delayId),\n onMutate: () => queryClient.cancelQueries({ queryKey: RUNDOWN }),\n onSuccess: (response) => {\n if (!response.data) return;\n\n const { id, title, order, flatOrder, entries, revision } = response.data;\n queryClient.setQueryData<Rundown>(RUNDOWN, {\n id,\n title,\n order,\n flatOrder,\n entries,\n revision,\n });\n },\n // Mutation finished, failed or successful\n onSettled: () => {\n queryClient.invalidateQueries({ queryKey: RUNDOWN });\n },\n });\n\n /**\n * Applies a given delay\n */\n const applyDelay = useCallback(\n async (delayEventId: EntryId) => {\n try {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n await applyDelayMutation([rundownId, delayEventId]);\n } catch (error) {\n logAxiosError('Error applying delay', error);\n }\n },\n [applyDelayMutation, getCurrentRundownData],\n );\n\n /**\n * Calls mutation to dissolve a group\n * @private\n */\n const { mutateAsync: ungroupMutation } = useMutation({\n mutationFn: ([rundownId, groupId]: Parameters<typeof requestUngroup>) => requestUngroup(rundownId, groupId),\n onMutate: () => queryClient.cancelQueries({ queryKey: RUNDOWN }),\n onSuccess: (response) => {\n if (!response.data) return;\n\n const { id, title, order, flatOrder, entries, revision } = response.data;\n queryClient.setQueryData<Rundown>(RUNDOWN, {\n id,\n title,\n order,\n flatOrder,\n entries,\n revision,\n });\n },\n onSettled: () => queryClient.invalidateQueries({ queryKey: RUNDOWN }),\n });\n\n /**\n * Deletes a group and moves its events to the top level\n */\n const ungroup = useCallback(\n async (groupId: EntryId) => {\n try {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n await ungroupMutation([rundownId, groupId]);\n } catch (error) {\n logAxiosError('Error dissolving group', error);\n }\n },\n [getCurrentRundownData, ungroupMutation],\n );\n\n /**\n * Calls mutation to create a group with a selection\n * @private\n */\n const { mutateAsync: groupEntriesMutation } = useMutation({\n mutationFn: ([rundownId, entryIds]: Parameters<typeof requestGroupEntries>) =>\n requestGroupEntries(rundownId, entryIds),\n onMutate: () => queryClient.cancelQueries({ queryKey: RUNDOWN }),\n onSuccess: (response) => {\n if (!response.data) return;\n\n const { id, title, order, flatOrder, entries, revision } = response.data;\n queryClient.setQueryData<Rundown>(RUNDOWN, {\n id,\n title,\n order,\n flatOrder,\n entries,\n revision,\n });\n },\n onSettled: () => queryClient.invalidateQueries({ queryKey: RUNDOWN }),\n });\n\n /**\n * Create a group with a selection\n */\n const groupEntries = useCallback(\n async (entryIds: EntryId[]) => {\n if (entryIds.length === 0) return;\n\n try {\n const rundownData = getCurrentRundownData();\n const rundownId = rundownData?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n if (entryIds.length === 1) {\n await groupEntriesMutation([rundownId, entryIds]);\n } else {\n // the user selection may be out of order\n const orderedIds = orderEntries(entryIds, rundownData.flatOrder);\n await groupEntriesMutation([rundownId, orderedIds]);\n }\n } catch (error) {\n logAxiosError('Error grouping entries', error);\n }\n },\n [getCurrentRundownData, groupEntriesMutation],\n );\n\n /**\n * Calls mutation to reorder an entry\n * @private\n */\n const { mutateAsync: reorderEntryMutation } = useMutation({\n mutationFn: ([rundownId, data]: Parameters<typeof patchReorderEntry>) => patchReorderEntry(rundownId, data),\n onMutate: () => queryClient.cancelQueries({ queryKey: RUNDOWN }),\n onSettled: () => {\n queryClient.invalidateQueries({ queryKey: RUNDOWN });\n },\n });\n\n /**\n * Reorders a given entry one step up or down in the timeline\n */\n const move = useCallback(\n async (entryId: EntryId, direction: 'up' | 'down') => {\n try {\n const rundownData = getCurrentRundownData();\n const rundownId = rundownData?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n const { destinationId, order } =\n direction === 'up'\n ? moveUp(entryId, rundownData.flatOrder, rundownData.entries)\n : moveDown(entryId, rundownData.flatOrder, rundownData.entries);\n\n if (!destinationId) {\n return; // noop\n }\n\n const reorderObject: ReorderEntry = {\n entryId,\n destinationId,\n order,\n };\n await reorderEntryMutation([rundownId, reorderObject]);\n // the rundown needs to know whether we moved into a group\n return rundownData.entries[destinationId]?.type === SupportedEntry.Group ? destinationId : undefined;\n } catch (error) {\n logAxiosError('Error re-ordering event', error);\n }\n return undefined;\n },\n [getCurrentRundownData, reorderEntryMutation],\n );\n /**\n * Reorders a given entry\n */\n const reorderEntry = useCallback(\n async (entryId: EntryId, destinationId: EntryId, order: 'before' | 'after' | 'insert') => {\n try {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n await reorderEntryMutation([\n rundownId,\n {\n entryId,\n destinationId,\n order,\n },\n ]);\n } catch (error) {\n logAxiosError('Error re-ordering event', error);\n throw error; // rethrow to handle in the component\n }\n },\n [getCurrentRundownData, reorderEntryMutation],\n );\n\n /**\n * Calls mutation to swap events\n * @private\n */\n const { mutateAsync: swapEventsMutation } = useMutation({\n mutationFn: ([rundownId, from, to]: Parameters<typeof requestEventSwap>) => requestEventSwap(rundownId, from, to),\n // we optimistically update here\n onMutate: async ([_rundownId, from, to]) => {\n // cancel ongoing queries\n await queryClient.cancelQueries({ queryKey: RUNDOWN });\n\n // Snapshot the previous value\n const previousData = queryClient.getQueryData<Rundown>(RUNDOWN);\n if (previousData) {\n // optimistically update object\n const newRundown = { ...previousData.entries };\n const eventA = previousData.entries[from];\n const eventB = previousData.entries[to];\n\n if (!isOntimeEvent(eventA) || !isOntimeEvent(eventB)) {\n return;\n }\n\n const [newA, newB] = swapEventData(eventA, eventB);\n newRundown[from] = newA;\n newRundown[to] = newB;\n\n queryClient.setQueryData<Rundown>(RUNDOWN, {\n id: previousData.id,\n title: previousData.title,\n order: previousData.order,\n flatOrder: previousData.flatOrder,\n entries: newRundown,\n revision: -1,\n });\n }\n\n // Return a context with the previous events\n return { previousData };\n },\n\n // Mutation fails, rollback undoes optimist update\n onError: (_error, _eventId, context) => {\n queryClient.setQueryData<Rundown>(RUNDOWN, context?.previousData);\n },\n // Mutation finished, failed or successful\n // Fetch anyway, just to be sure\n onSettled: () => {\n queryClient.invalidateQueries({ queryKey: RUNDOWN });\n },\n });\n\n /**\n * Swaps the schedule of two events\n */\n const swapEvents = useCallback(\n async (from: EntryId, to: EntryId) => {\n try {\n const rundownId = getCurrentRundownData()?.id;\n if (!rundownId) {\n throw new Error('Rundown not initialised');\n }\n\n await swapEventsMutation([rundownId, from, to]);\n } catch (error) {\n logAxiosError('Error re-ordering event', error);\n }\n },\n [getCurrentRundownData, swapEventsMutation],\n );\n\n return {\n addEntry,\n applyDelay,\n batchUpdateEvents,\n clone,\n deleteEntry,\n deleteAllEntries,\n ungroup,\n getEntryById,\n groupEntries,\n move,\n reorderEntry,\n swapEvents,\n updateEntry,\n updateTimer,\n };\n};\n\n/**\n * Utility to optimistically delete entries from client cache\n */\nfunction optimisticDeleteEntries(entryIds: EntryId[], rundown: Rundown) {\n const entries = { ...rundown.entries };\n let order = [...rundown.order];\n let flatOrder = [...rundown.flatOrder];\n\n for (let i = 0; i < entryIds.length; i++) {\n const entry = entries[entryIds[i]];\n deleteEntry(entry);\n }\n\n function deleteEntry(entry: OntimeEntry) {\n if (isOntimeGroup(entry) || !entry.parent) {\n order = order.filter((id) => id !== entry.id);\n } else {\n const parent = entries[entry.parent];\n if (parent && isOntimeGroup(parent)) {\n parent.entries = parent.entries.filter((parentEntry) => parentEntry !== entry.id);\n }\n }\n\n delete entries[entry.id];\n flatOrder = flatOrder.filter((id) => id !== entry.id);\n }\n\n return { entries, order, flatOrder };\n}\n","import { MaybeNumber } from 'ontime-types';\nimport { formatFromMillis, MILLIS_PER_HOUR, MILLIS_PER_MINUTE } from 'ontime-utils';\n\n/**\n * Parses a value in millis to a string which encodes a delay\n * @param millis\n * @param format\n */\nexport function millisToDelayString(millis: MaybeNumber, format: 'compact' | 'expanded' = 'compact'): string {\n if (millis == null || millis === 0) {\n return '';\n }\n\n const isNegative = millis < 0;\n const absMillis = Math.abs(millis);\n const isCompact = format === 'compact';\n const delayed = isCompact ? '+' : 'delayed by ';\n const ahead = isCompact ? '-' : 'ahead by ';\n\n if (absMillis < MILLIS_PER_MINUTE) {\n return `${isNegative ? ahead : delayed}${formatFromMillis(absMillis, 's')} sec`;\n } else if (absMillis < MILLIS_PER_HOUR && absMillis % MILLIS_PER_MINUTE === 0) {\n return `${isNegative ? ahead : delayed}${formatFromMillis(absMillis, 'm')} min`;\n }\n\n return `${isNegative ? ahead : delayed}${formatFromMillis(absMillis, 'HH:mm:ss')}`;\n}\n"],"names":["makeSortableList","order","entries","flatIds","i","length","entry","isOntimeGroup","push","id","canDrop","targetType","targetParent","isTargetCollapsed","undefined","moveUp","entryId","flatOrder","currentEntry","currentIndex","indexOf","previousEntryId","parent","destinationId","previousEntry","currentEntryParent","isOntimeEvent","moveDown","nextEntryId","parentGroup","includes","afterGroupIndex","afterGroupId","nextEntry","orderEntries","unorderedArray","orderedArray","useEntryActions","queryClient","useQueryClient","linkPrevious","defaultTimeStrategy","defaultDuration","defaultWarnTime","defaultDangerTime","defaultTimerType","defaultEndAction","useEditorSettings","getCurrentRundownData","useCallback","getQueryData","RUNDOWN","getEntryById","eventId","cachedRundown","mutateAsync","addEntryMutation","useMutation","mutationFn","rundownId","postAddEntry","onMutate","cancelQueries","queryKey","onSettled","invalidateQueries","addEntry","options","rundownData","Error","newEntry","generateId","lastEventId","previousEvent","timeStart","timeEnd","linkStart","duration","parseUserTime","timeDanger","timeWarning","timerType","endAction","timeStrategy","after","before","error","logAxiosError","cloneEntryMutation","postCloneEntry","clone","updateEntryMutation","newEvent","putEditEntry","_rundownId","previousData","newRundown","setQueryData","title","revision","onError","_error","_newEvent","context","updateEntry","updateTimer","field","value","lockOnUpdate","TimeStrategy","LockDuration","LockEnd","calculateNewValue","newValMillis","getPreviousEnd","startsWith","remainingString","substring","Math","min","dayInMs","MILLIS_PER_SECOND","index","previousEnd","event","batchUpdateEventsMutation","data","putBatchEditEvents","previousRundown","eventIds","Set","ids","forEach","Object","hasOwn","onSuccess","response","batchUpdateEvents","deleteEntryMutation","entryIds","deleteEntries","optimisticDeleteEntries","_entryIds","deleteEntry","deleteAllEntriesMutation","requestDeleteAll","_","deleteAllEntries","applyDelayMutation","delayId","requestApplyDelay","applyDelay","delayEventId","ungroupMutation","groupId","requestUngroup","ungroup","groupEntriesMutation","requestGroupEntries","groupEntries","orderedIds","reorderEntryMutation","patchReorderEntry","move","direction","type","SupportedEntry","Group","reorderEntry","swapEventsMutation","from","to","requestEventSwap","eventA","eventB","newA","newB","swapEventData","_eventId","swapEvents","rundown","filter","parentEntry","millisToDelayString","millis","format","isNegative","absMillis","abs","isCompact","delayed","ahead","MILLIS_PER_MINUTE","formatFromMillis","MILLIS_PER_HOUR"],"mappings":"00BAQgBA,SAAAA,GAAiBC,EAAkBC,EAAoC,CACrF,MAAMC,EAAqB,CAAE,EAE7B,QAASC,EAAI,EAAGA,EAAIH,EAAMI,OAAQD,IAAK,CACrC,MAAME,EAAQJ,EAAQD,EAAMG,CAAC,CAAC,EAEzBE,IAIDC,EAAcD,CAAK,GAGbE,EAAAA,KAAKF,EAAMG,EAAE,EACbD,EAAAA,KAAK,GAAGF,EAAMJ,OAAO,EAG7BC,EAAQK,KAAK,OAAOF,EAAMG,EAAE,EAAE,GAEtBD,EAAAA,KAAKF,EAAMG,EAAE,EACvB,CAEKN,OAAAA,CACT,CAMO,SAASO,GACdC,EACAC,EACAX,EACAY,EACS,CAET,OAAIF,IAAe,YACVV,IAAU,QAKfU,IAAe,QACbV,EAAAA,IAAUa,QAAab,IAAU,SAAW,CAACY,GAO5CD,IAAiB,IAC1B,CAWgBG,SAAAA,GACdC,EACAC,EACAf,EACyE,CACnEgB,MAAAA,EAAehB,EAAQc,CAAO,EAC9BG,EAAeF,EAAUG,QAAQJ,CAAO,EACxCK,EAAkBJ,EAAUE,EAAe,CAAC,EAGlD,GAAI,CAACE,EAEH,MAAI,WAAYH,GAAgBA,EAAaI,SAAW,KAC/C,CAAEC,cAAeL,EAAaI,OAAQrB,MAAO,QAAS,EAGxD,CAAEsB,cAAe,KAAMtB,MAAO,QAAS,EAI5CM,GAAAA,EAAcW,CAAY,EAAG,CAEzBM,MAAAA,EAAgBtB,EAAQmB,CAAe,EAC7C,MAAI,WAAYG,GAAiBA,EAAcF,SAAW,KACjD,CAAEC,cAAeC,EAAcF,OAAQrB,MAAO,QAAS,EAIzD,CAAEsB,cAAeF,EAAiBpB,MAAO,QAAS,CAAA,CAGrDuB,M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AAIJ,CAAM,EAC3BK,EAAYJ,IAAW,UACvBK,EAAUD,EAAY,IAAM,cAC5BE,EAAQF,EAAY,IAAM,YAEhC,OAAIF,EAAYK,EACP,GAAGN,EAAaK,EAAQD,CAAO,GAAGG,EAAiBN,EAAW,GAAG,CAAC,OAChEA,EAAYO,IAAmBP,EAAYK,IAAsB,EACnE,GAAGN,EAAaK,EAAQD,CAAO,GAAGG,EAAiBN,EAAW,GAAG,CAAC,OAGpE,GAAGD,EAAaK,EAAQD,CAAO,GAAGG,EAAiBN,EAAW,UAAU,CAAC,EAClF"}
@@ -1,2 +1,2 @@
1
- import{h as d,j as f,f as g}from"./vendor-Cdwxo8bP.js";import{e as c,bE as y,T as S}from"./index-CoGiopcb.js";import{a as T,v as _,b,E as p,T as I}from"./validateEvent-CUmvjN95.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="4466a328-897a-4477-8a96-80fda40db929",t._sentryDebugIdIdentifier="sentry-dbid-4466a328-897a-4477-8a96-80fda40db929")}catch{}})();const h="_blink_19ahf_1",v="_fourtyfive_19ahf_13",x="_textarea_19ahf_17",D="_subtle_19ahf_47",k="_ghosted_19ahf_53",w="_fluid_19ahf_59",o={blink:h,fourtyfive:v,textarea:x,subtle:D,ghosted:k,fluid:w},j=d.forwardRef(function({className:e,variant:r="subtle",fluid:n,rows:i=5,resize:l="none",style:s,...u},m){return f.jsx("textarea",{ref:m,autoCorrect:"off",autoComplete:"off",spellCheck:"false",rows:i,style:{...s,resize:l},className:c([o.textarea,o[r],n&&o.fluid,e]),...u})}),a={duration:"00:10:00",linkPrevious:!0,timeStrategy:I.LockDuration,warnTime:"00:02:00",dangerTime:"00:01:00",timerType:S.CountDown,endAction:p.None},L=g(t=>({defaultDuration:localStorage.getItem("ontime-default-duration")??a.duration,linkPrevious:y("ontime-link-previous",a.linkPrevious),defaultTimeStrategy:b(localStorage.getItem("ontime-time-strategy"),a.timeStrategy),defaultWarnTime:localStorage.getItem("ontime-default-warn-time")??a.warnTime,defaultDangerTime:localStorage.getItem("ontime-default-danger-time")??a.dangerTime,defaultTimerType:_(localStorage.getItem("ontime-default-timer-type"),a.timerType),defaultEndAction:T(localStorage.getItem("ontime-default-end-action"),a.endAction),setDefaultDuration:e=>t(()=>(localStorage.setItem("ontime-default-duration",String(e)),{defaultDuration:e})),setLinkPrevious:e=>t(()=>(localStorage.setItem("ontime-link-previous",String(e)),{linkPrevious:e})),setTimeStrategy:e=>t(()=>(localStorage.setItem("ontime-time-strategy",String(e)),{defaultTimeStrategy:e})),setWarnTime:e=>t(()=>(localStorage.setItem("ontime-default-warn-time",String(e)),{defaultWarnTime:e})),setDangerTime:e=>t(()=>(localStorage.setItem("ontime-default-danger-time",String(e)),{defaultDangerTime:e})),setDefaultTimerType:e=>t(()=>(localStorage.setItem("ontime-default-timer-type",String(e)),{defaultTimerType:e})),setDefaultEndAction:e=>t(()=>(localStorage.setItem("ontime-default-end-action",String(e)),{defaultEndAction:e}))}));export{j as T,a as e,L as u};
2
- //# sourceMappingURL=editorSettings-BMt-7s8I.js.map
1
+ import{h as d,j as f,f as g}from"./vendor-DmGkEtRj.js";import{e as c,bE as y,T as S}from"./index-B1K7rED_.js";import{a as T,v as _,b,E as p,T as I}from"./validateEvent-jVIMKhmx.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="4466a328-897a-4477-8a96-80fda40db929",t._sentryDebugIdIdentifier="sentry-dbid-4466a328-897a-4477-8a96-80fda40db929")}catch{}})();const h="_blink_19ahf_1",v="_fourtyfive_19ahf_13",x="_textarea_19ahf_17",D="_subtle_19ahf_47",k="_ghosted_19ahf_53",w="_fluid_19ahf_59",o={blink:h,fourtyfive:v,textarea:x,subtle:D,ghosted:k,fluid:w},j=d.forwardRef(function({className:e,variant:r="subtle",fluid:n,rows:i=5,resize:l="none",style:s,...u},m){return f.jsx("textarea",{ref:m,autoCorrect:"off",autoComplete:"off",spellCheck:"false",rows:i,style:{...s,resize:l},className:c([o.textarea,o[r],n&&o.fluid,e]),...u})}),a={duration:"00:10:00",linkPrevious:!0,timeStrategy:I.LockDuration,warnTime:"00:02:00",dangerTime:"00:01:00",timerType:S.CountDown,endAction:p.None},L=g(t=>({defaultDuration:localStorage.getItem("ontime-default-duration")??a.duration,linkPrevious:y("ontime-link-previous",a.linkPrevious),defaultTimeStrategy:b(localStorage.getItem("ontime-time-strategy"),a.timeStrategy),defaultWarnTime:localStorage.getItem("ontime-default-warn-time")??a.warnTime,defaultDangerTime:localStorage.getItem("ontime-default-danger-time")??a.dangerTime,defaultTimerType:_(localStorage.getItem("ontime-default-timer-type"),a.timerType),defaultEndAction:T(localStorage.getItem("ontime-default-end-action"),a.endAction),setDefaultDuration:e=>t(()=>(localStorage.setItem("ontime-default-duration",String(e)),{defaultDuration:e})),setLinkPrevious:e=>t(()=>(localStorage.setItem("ontime-link-previous",String(e)),{linkPrevious:e})),setTimeStrategy:e=>t(()=>(localStorage.setItem("ontime-time-strategy",String(e)),{defaultTimeStrategy:e})),setWarnTime:e=>t(()=>(localStorage.setItem("ontime-default-warn-time",String(e)),{defaultWarnTime:e})),setDangerTime:e=>t(()=>(localStorage.setItem("ontime-default-danger-time",String(e)),{defaultDangerTime:e})),setDefaultTimerType:e=>t(()=>(localStorage.setItem("ontime-default-timer-type",String(e)),{defaultTimerType:e})),setDefaultEndAction:e=>t(()=>(localStorage.setItem("ontime-default-end-action",String(e)),{defaultEndAction:e}))}));export{j as T,a as e,L as u};
2
+ //# sourceMappingURL=editorSettings-CRJwIW7V.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"editorSettings-BMt-7s8I.js","sources":["../../src/common/components/input/textarea/Textarea.tsx","../../src/common/stores/editorSettings.ts"],"sourcesContent":["import { forwardRef, TextareaHTMLAttributes } from 'react';\n\nimport { cx } from '../../../utils/styleUtils';\n\nimport style from './Textarea.module.scss';\n\nexport interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n variant?: 'subtle' | 'ghosted';\n fluid?: boolean;\n resize?: 'none' | 'both' | 'horizontal' | 'vertical';\n}\n\nconst Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function TextArea(\n { className, variant = 'subtle', fluid, rows = 5, resize = 'none', style: customStyle, ...textareaProps },\n ref,\n) {\n return (\n <textarea\n ref={ref}\n autoCorrect='off'\n autoComplete='off'\n spellCheck='false'\n rows={rows}\n style={{ ...customStyle, resize }}\n className={cx([style.textarea, style[variant], fluid && style.fluid, className])}\n {...textareaProps}\n />\n );\n});\n\nexport default Textarea;\n","import { EndAction, TimerType, TimeStrategy } from 'ontime-types';\nimport { validateEndAction, validateTimerType, validateTimeStrategy } from 'ontime-utils';\nimport { create } from 'zustand';\n\nimport { booleanFromLocalStorage } from '../utils/localStorage';\n\ntype EditorSettingsStore = {\n defaultDuration: string;\n linkPrevious: boolean;\n defaultTimeStrategy: TimeStrategy;\n defaultWarnTime: string;\n defaultDangerTime: string;\n defaultTimerType: TimerType;\n defaultEndAction: EndAction;\n setDefaultDuration: (defaultDuration: string) => void;\n setLinkPrevious: (linkPrevious: boolean) => void;\n setTimeStrategy: (timeStrategy: TimeStrategy) => void;\n setWarnTime: (warnTime: string) => void;\n setDangerTime: (dangerTime: string) => void;\n setDefaultTimerType: (defaultTimerType: TimerType) => void;\n setDefaultEndAction: (defaultEndAction: EndAction) => void;\n};\n\nexport const editorSettingsDefaults = {\n duration: '00:10:00',\n linkPrevious: true,\n timeStrategy: TimeStrategy.LockDuration,\n warnTime: '00:02:00', // 120000 same as backend\n dangerTime: '00:01:00', // 60000 same as backend\n timerType: TimerType.CountDown,\n endAction: EndAction.None,\n};\n\nenum EditorSettingsKeys {\n DefaultDuration = 'ontime-default-duration',\n LinkPrevious = 'ontime-link-previous',\n DefaultTimeStrategy = 'ontime-time-strategy',\n DefaultWarnTime = 'ontime-default-warn-time',\n DefaultDangerTime = 'ontime-default-danger-time',\n DefaultTimerType = 'ontime-default-timer-type',\n DefaultEndAction = 'ontime-default-end-action',\n}\n\nexport const useEditorSettings = create<EditorSettingsStore>((set) => {\n return {\n defaultDuration: localStorage.getItem(EditorSettingsKeys.DefaultDuration) ?? editorSettingsDefaults.duration,\n linkPrevious: booleanFromLocalStorage(EditorSettingsKeys.LinkPrevious, editorSettingsDefaults.linkPrevious),\n defaultTimeStrategy: validateTimeStrategy(\n localStorage.getItem(EditorSettingsKeys.DefaultTimeStrategy),\n editorSettingsDefaults.timeStrategy,\n ),\n defaultWarnTime: localStorage.getItem(EditorSettingsKeys.DefaultWarnTime) ?? editorSettingsDefaults.warnTime,\n defaultDangerTime: localStorage.getItem(EditorSettingsKeys.DefaultDangerTime) ?? editorSettingsDefaults.dangerTime,\n defaultTimerType: validateTimerType(\n localStorage.getItem(EditorSettingsKeys.DefaultTimerType),\n editorSettingsDefaults.timerType,\n ),\n defaultEndAction: validateEndAction(\n localStorage.getItem(EditorSettingsKeys.DefaultEndAction),\n editorSettingsDefaults.endAction,\n ),\n\n setDefaultDuration: (defaultDuration) =>\n set(() => {\n localStorage.setItem(EditorSettingsKeys.DefaultDuration, String(defaultDuration));\n return { defaultDuration };\n }),\n\n setLinkPrevious: (linkPrevious) =>\n set(() => {\n localStorage.setItem(EditorSettingsKeys.LinkPrevious, String(linkPrevious));\n return { linkPrevious };\n }),\n setTimeStrategy: (defaultTimeStrategy) =>\n set(() => {\n localStorage.setItem(EditorSettingsKeys.DefaultTimeStrategy, String(defaultTimeStrategy));\n return { defaultTimeStrategy };\n }),\n\n setWarnTime: (defaultWarnTime) =>\n set(() => {\n localStorage.setItem(EditorSettingsKeys.DefaultWarnTime, String(defaultWarnTime));\n return { defaultWarnTime };\n }),\n setDangerTime: (defaultDangerTime) =>\n set(() => {\n localStorage.setItem(EditorSettingsKeys.DefaultDangerTime, String(defaultDangerTime));\n return { defaultDangerTime };\n }),\n setDefaultTimerType: (defaultTimerType) =>\n set(() => {\n localStorage.setItem(EditorSettingsKeys.DefaultTimerType, String(defaultTimerType));\n return { defaultTimerType };\n }),\n setDefaultEndAction: (defaultEndAction) =>\n set(() => {\n localStorage.setItem(EditorSettingsKeys.DefaultEndAction, String(defaultEndAction));\n return { defaultEndAction };\n }),\n };\n});\n"],"names":["Textarea","forwardRef","className","variant","fluid","rows","resize","style","customStyle","textareaProps","ref","jsx","cx","textarea","editorSettingsDefaults","duration","linkPrevious","timeStrategy","TimeStrategy","LockDuration","warnTime","dangerTime","timerType","TimerType","CountDown","endAction","EndAction","None","useEditorSettings","create","set","defaultDuration","localStorage","getItem","EditorSettingsKeys","booleanFromLocalStorage","defaultTimeStrategy","validateTimeStrategy","defaultWarnTime","defaultDangerTime","defaultTimerType","validateTimerType","defaultEndAction","validateEndAction","setDefaultDuration","setItem","String","setLinkPrevious","setTimeStrategy","setWarnTime","setDangerTime","setDefaultTimerType","setDefaultEndAction"],"mappings":"stBAYMA,EAAWC,EAAAA,WAA+C,SAC9D,CAAEC,UAAAA,EAAWC,QAAAA,EAAU,SAAUC,MAAAA,EAAOC,KAAAA,EAAO,EAAGC,OAAAA,EAAS,OAAQC,MAAOC,EAAa,GAAGC,CAAc,EACxGC,EACA,CAEE,OAAAC,MAAC,WACC,CAAA,IAAAD,EACA,YAAY,MACZ,aAAa,MACb,WAAW,QACX,KAAAL,EACA,MAAO,CAAE,GAAGG,EAAaF,OAAAA,CAAAA,EACzB,UAAWM,EAAG,CAACL,EAAMM,SAAUN,EAAMJ,CAAO,EAAGC,GAASG,EAAMH,MAAOF,CAAS,CAAC,EAC3EO,GAAAA,CACJ,CAAA,CAEN,CAAC,ECLYK,EAAyB,CACpCC,SAAU,WACVC,aAAc,GACdC,aAAcC,EAAaC,aAC3BC,SAAU,WACVC,WAAY,WACZC,UAAWC,EAAUC,UACrBC,UAA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,CAAEA,iBAAAA,CAAiB,EAC3B,CACL,EACD"}
1
+ {"version":3,"file":"editorSettings-CRJwIW7V.js","sources":["../../src/common/components/input/textarea/Textarea.tsx","../../src/common/stores/editorSettings.ts"],"sourcesContent":["import { forwardRef, TextareaHTMLAttributes } from 'react';\n\nimport { cx } from '../../../utils/styleUtils';\n\nimport style from './Textarea.module.scss';\n\nexport interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n variant?: 'subtle' | 'ghosted';\n fluid?: boolean;\n resize?: 'none' | 'both' | 'horizontal' | 'vertical';\n}\n\nconst Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function TextArea(\n { className, variant = 'subtle', fluid, rows = 5, resize = 'none', style: customStyle, ...textareaProps },\n ref,\n) {\n return (\n <textarea\n ref={ref}\n autoCorrect='off'\n autoComplete='off'\n spellCheck='false'\n rows={rows}\n style={{ ...customStyle, resize }}\n className={cx([style.textarea, style[variant], fluid && style.fluid, className])}\n {...textareaProps}\n />\n );\n});\n\nexport default Textarea;\n","import { EndAction, TimerType, TimeStrategy } from 'ontime-types';\nimport { validateEndAction, validateTimerType, validateTimeStrategy } from 'ontime-utils';\nimport { create } from 'zustand';\n\nimport { booleanFromLocalStorage } from '../utils/localStorage';\n\ntype EditorSettingsStore = {\n defaultDuration: string;\n linkPrevious: boolean;\n defaultTimeStrategy: TimeStrategy;\n defaultWarnTime: string;\n defaultDangerTime: string;\n defaultTimerType: TimerType;\n defaultEndAction: EndAction;\n setDefaultDuration: (defaultDuration: string) => void;\n setLinkPrevious: (linkPrevious: boolean) => void;\n setTimeStrategy: (timeStrategy: TimeStrategy) => void;\n setWarnTime: (warnTime: string) => void;\n setDangerTime: (dangerTime: string) => void;\n setDefaultTimerType: (defaultTimerType: TimerType) => void;\n setDefaultEndAction: (defaultEndAction: EndAction) => void;\n};\n\nexport const editorSettingsDefaults = {\n duration: '00:10:00',\n linkPrevious: true,\n timeStrategy: TimeStrategy.LockDuration,\n warnTime: '00:02:00', // 120000 same as backend\n dangerTime: '00:01:00', // 60000 same as backend\n timerType: TimerType.CountDown,\n endAction: EndAction.None,\n};\n\nenum EditorSettingsKeys {\n DefaultDuration = 'ontime-default-duration',\n LinkPrevious = 'ontime-link-previous',\n DefaultTimeStrategy = 'ontime-time-strategy',\n DefaultWarnTime = 'ontime-default-warn-time',\n DefaultDangerTime = 'ontime-default-danger-time',\n DefaultTimerType = 'ontime-default-timer-type',\n DefaultEndAction = 'ontime-default-end-action',\n}\n\nexport const useEditorSettings = create<EditorSettingsStore>((set) => {\n return {\n defaultDuration: localStorage.getItem(EditorSettingsKeys.DefaultDuration) ?? editorSettingsDefaults.duration,\n linkPrevious: booleanFromLocalStorage(EditorSettingsKeys.LinkPrevious, editorSettingsDefaults.linkPrevious),\n defaultTimeStrategy: validateTimeStrategy(\n localStorage.getItem(EditorSettingsKeys.DefaultTimeStrategy),\n editorSettingsDefaults.timeStrategy,\n ),\n defaultWarnTime: localStorage.getItem(EditorSettingsKeys.DefaultWarnTime) ?? editorSettingsDefaults.warnTime,\n defaultDangerTime: localStorage.getItem(EditorSettingsKeys.DefaultDangerTime) ?? editorSettingsDefaults.dangerTime,\n defaultTimerType: validateTimerType(\n localStorage.getItem(EditorSettingsKeys.DefaultTimerType),\n editorSettingsDefaults.timerType,\n ),\n defaultEndAction: validateEndAction(\n localStorage.getItem(EditorSettingsKeys.DefaultEndAction),\n editorSettingsDefaults.endAction,\n ),\n\n setDefaultDuration: (defaultDuration) =>\n set(() => {\n localStorage.setItem(EditorSettingsKeys.DefaultDuration, String(defaultDuration));\n return { defaultDuration };\n }),\n\n setLinkPrevious: (linkPrevious) =>\n set(() => {\n localStorage.setItem(EditorSettingsKeys.LinkPrevious, String(linkPrevious));\n return { linkPrevious };\n }),\n setTimeStrategy: (defaultTimeStrategy) =>\n set(() => {\n localStorage.setItem(EditorSettingsKeys.DefaultTimeStrategy, String(defaultTimeStrategy));\n return { defaultTimeStrategy };\n }),\n\n setWarnTime: (defaultWarnTime) =>\n set(() => {\n localStorage.setItem(EditorSettingsKeys.DefaultWarnTime, String(defaultWarnTime));\n return { defaultWarnTime };\n }),\n setDangerTime: (defaultDangerTime) =>\n set(() => {\n localStorage.setItem(EditorSettingsKeys.DefaultDangerTime, String(defaultDangerTime));\n return { defaultDangerTime };\n }),\n setDefaultTimerType: (defaultTimerType) =>\n set(() => {\n localStorage.setItem(EditorSettingsKeys.DefaultTimerType, String(defaultTimerType));\n return { defaultTimerType };\n }),\n setDefaultEndAction: (defaultEndAction) =>\n set(() => {\n localStorage.setItem(EditorSettingsKeys.DefaultEndAction, String(defaultEndAction));\n return { defaultEndAction };\n }),\n };\n});\n"],"names":["Textarea","forwardRef","className","variant","fluid","rows","resize","style","customStyle","textareaProps","ref","jsx","cx","textarea","editorSettingsDefaults","duration","linkPrevious","timeStrategy","TimeStrategy","LockDuration","warnTime","dangerTime","timerType","TimerType","CountDown","endAction","EndAction","None","useEditorSettings","create","set","defaultDuration","localStorage","getItem","EditorSettingsKeys","booleanFromLocalStorage","defaultTimeStrategy","validateTimeStrategy","defaultWarnTime","defaultDangerTime","defaultTimerType","validateTimerType","defaultEndAction","validateEndAction","setDefaultDuration","setItem","String","setLinkPrevious","setTimeStrategy","setWarnTime","setDangerTime","setDefaultTimerType","setDefaultEndAction"],"mappings":"stBAYMA,EAAWC,EAAAA,WAA+C,SAC9D,CAAEC,UAAAA,EAAWC,QAAAA,EAAU,SAAUC,MAAAA,EAAOC,KAAAA,EAAO,EAAGC,OAAAA,EAAS,OAAQC,MAAOC,EAAa,GAAGC,CAAc,EACxGC,EACA,CAEE,OAAAC,MAAC,WACC,CAAA,IAAAD,EACA,YAAY,MACZ,aAAa,MACb,WAAW,QACX,KAAAL,EACA,MAAO,CAAE,GAAGG,EAAaF,OAAAA,CAAAA,EACzB,UAAWM,EAAG,CAACL,EAAMM,SAAUN,EAAMJ,CAAO,EAAGC,GAASG,EAAMH,MAAOF,CAAS,CAAC,EAC3EO,GAAAA,CACJ,CAAA,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,CAAC,EAC3E,CAAEA,iBAAAA,CAAiB,EAC3B,EACHY,oBACEtB,GAAAA,EAAI,KACFE,aAAaa,QAAQX,4BAAqCY,OAAOJ,CAAgB,CAAC,EAC3E,CAAEA,iBAAAA,CAAiB,EAC3B,CACL,EACD"}
@@ -1,2 +1,2 @@
1
- import"./vendor-Cdwxo8bP.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3bddcef3-3c46-4d76-a6ef-4958e2a23011",e._sentryDebugIdIdentifier="sentry-dbid-3bddcef3-3c46-4d76-a6ef-4958e2a23011")}catch{}})();const d=(e,n,t)=>Math.max(Math.min(e,Math.max(n,t)),Math.min(n,t));function s(e,n){return e===null||n===null?0:e<=0?100:e>=n?0:d((n-e)/n*100,0,100)}export{s as g};
2
- //# sourceMappingURL=getProgress-sdxPEEPi.js.map
1
+ import"./vendor-DmGkEtRj.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3bddcef3-3c46-4d76-a6ef-4958e2a23011",e._sentryDebugIdIdentifier="sentry-dbid-3bddcef3-3c46-4d76-a6ef-4958e2a23011")}catch{}})();const d=(e,n,t)=>Math.max(Math.min(e,Math.max(n,t)),Math.min(n,t));function s(e,n){return e===null||n===null?0:e<=0?100:e>=n?0:d((n-e)/n*100,0,100)}export{s as g};
2
+ //# sourceMappingURL=getProgress-fD6vhbNF.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getProgress-sdxPEEPi.js","sources":["../../src/common/utils/math.ts","../../src/common/utils/getProgress.ts"],"sourcesContent":["/**\n * Clamps a value between a min and a max\n * @param {number} num - Value to clamp\n * @param {number} min - min value\n * @param {number} max - max value\n * @returns {number}\n */\nexport const clamp = (num: number, min: number, max: number) =>\n Math.max(Math.min(num, Math.max(min, max)), Math.min(min, max));\n","import { MaybeNumber } from 'ontime-types';\n\nimport { clamp } from './math';\n\n/**\n * Returns completion percentage of a progress bar\n * This code assumes the current time and duration have addedTime already applied\n */\nexport function getProgress(current: MaybeNumber, duration: MaybeNumber) {\n if (current === null || duration === null) {\n return 0;\n }\n\n if (current <= 0) {\n return 100;\n }\n\n if (current >= duration) {\n return 0;\n }\n\n return clamp(((duration - current) / duration) * 100, 0, 100);\n}\n"],"names":["clamp","num","min","max","Math","getProgress","current","duration"],"mappings":"uXAOaA,MAAAA,EAAQA,CAACC,EAAaC,EAAaC,IAC9CC,KAAKD,IAAIC,KAAKF,IAAID,EAAKG,KAAKD,IAAID,EAAKC,CAAG,CAAC,EAAGC,KAAKF,IAAIA,EAAKC,CAAG,CAAC,ECAhDE,SAAAA,EAAYC,EAAsBC,EAAuB,CACnED,OAAAA,IAAY,MAAQC,IAAa,KAC5B,EAGLD,GAAW,EACN,IAGLA,GAAWC,EACN,EAGFP,GAAQO,EAAWD,GAAWC,EAAY,IAAK,EAAG,GAAG,CAC9D"}
1
+ {"version":3,"file":"getProgress-fD6vhbNF.js","sources":["../../src/common/utils/math.ts","../../src/common/utils/getProgress.ts"],"sourcesContent":["/**\n * Clamps a value between a min and a max\n * @param {number} num - Value to clamp\n * @param {number} min - min value\n * @param {number} max - max value\n * @returns {number}\n */\nexport const clamp = (num: number, min: number, max: number) =>\n Math.max(Math.min(num, Math.max(min, max)), Math.min(min, max));\n","import { MaybeNumber } from 'ontime-types';\n\nimport { clamp } from './math';\n\n/**\n * Returns completion percentage of a progress bar\n * This code assumes the current time and duration have addedTime already applied\n */\nexport function getProgress(current: MaybeNumber, duration: MaybeNumber) {\n if (current === null || duration === null) {\n return 0;\n }\n\n if (current <= 0) {\n return 100;\n }\n\n if (current >= duration) {\n return 0;\n }\n\n return clamp(((duration - current) / duration) * 100, 0, 100);\n}\n"],"names":["clamp","num","min","max","Math","getProgress","current","duration"],"mappings":"uXAOaA,MAAAA,EAAQA,CAACC,EAAaC,EAAaC,IAC9CC,KAAKD,IAAIC,KAAKF,IAAID,EAAKG,KAAKD,IAAID,EAAKC,CAAG,CAAC,EAAGC,KAAKF,IAAIA,EAAKC,CAAG,CAAC,ECAhDE,SAAAA,EAAYC,EAAsBC,EAAuB,CACnED,OAAAA,IAAY,MAAQC,IAAa,KAC5B,EAGLD,GAAW,EACN,IAGLA,GAAWC,EACN,EAGFP,GAAQO,EAAWD,GAAWC,EAAY,IAAK,EAAG,GAAG,CAC9D"}
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Timer-DvqDm4yX.js","./vendor-DmGkEtRj.js","./vendor-4xP-6xVS.css","./timer.utils-FiqT1yNa.js","./viewUtils-VNLYoR28.js","./playbackstate-1HCEpVh5.js","./MultiPartProgressBar-GQaCHX4z.js","./getProgress-fD6vhbNF.js","./MultiPartProgressBar-1_EFIx1M.css","./EmptyPage-BlXZqoIr.js","./Empty-DJMjfXnt.js","./Empty-DvR62o5B.css","./EmptyPage-Cgxd2Z6S.css","./TitleCard-AESdy7kI.js","./TitleCard-BlCGzVFy.css","./ViewLogo-BZVUUIZA.js","./ViewLogo-Cu9JQggv.css","./ViewParamsEditor-CBnRitZ4.js","./useWindowTitle-ahZQIheF.js","./useWindowTitle-DrFGLRMI.css","./Select-ASOzxGFV.js","./Select-Cd08aEcf.css","./SwatchPicker-C8eFQKBd.js","./SwatchPicker-Cw1aXCwD.css","./ViewParamsEditor-CupOV30k.css","./SuperscriptTime-CA_8XRM6.js","./SuperscriptTime-Bk5IU6zG.css","./presentation.utils-CLt2UhON.js","./viewLoader.utils-Bniie8Op.js","./validateEvent-jVIMKhmx.js","./useCustomFields-nW-_Zyfw.js","./useProjectData-DP-pr73E.js","./Timer-Jjolf5Ra.css","./Countdown-VV03STbF.js","./useRundown-BGhL8DEI.js","./useFollowComponent-4cbKEsVz.js","./useReport-6XA_s2Vc.js","./offset-FplkvYRD.js","./FollowButton-Dy5n1J2c.js","./FollowButton-Dab8w6zT.css","./Countdown-BYXg70ir.css","./Backstage-D2lEbqUt.js","./SuperscriptPeriod-NmBzJhFK.js","./Backstage-BlanRQaw.css","./Studio-D7evHV2Q.js","./Studio-BbZ7w7aA.css","./TimelinePage-BfTV9IdT.js","./rundownUtils-D1oJpMdx.js","./TimelinePage-CcFl3uul.css","./ProjectInfo-KPf-pM8y.js","./ProjectInfo-CTQGba6F.css","./ProtectedEditor-Ddu9vBS8.js","./ProtectRoute-DW_vXgYI.js","./ProtectRoute-Bm5sjStK.css","./Modal-ePA-Go14.js","./Modal-D3tAPV2u.css","./OverviewWrapper-BNRb3Ub_.js","./OverviewWrapper-9aebU9w0.css","./editorSettings-CRJwIW7V.js","./editorSettings-BqHbWs9b.css","./EditorUtils-C3QoonjM.js","./EditorUtils-L4Sg72o_.css","./Tooltip-BTK4bJkV.js","./Tooltip-CKb7gU2M.css","./TimeInput-DR-NCEhH.js","./parseUserTime-0pNWLcr0.js","./TimeInput-Cu-N5DmX.css","./TimeElements-D3dl9gAM.js","./TimeElements-c2rTHN98.css","./ProtectedEditor-BtSuTFlT.css","./ProtectedCuesheet-CCVDLsK-.js","./MilestoneEditor-CxWZdQ1B.js","./dateConfig-Crm-Cu2y.js","./MilestoneEditor-BqNKKlvI.css","./DelayIndicator-Co5rMYw9.js","./DelayIndicator-VuYhhwTj.css","./ProtectedCuesheet-DPO7xYMb.css","./OperatorExport-CRS08UXj.js","./OperatorExport-CA5WcIt5.css","./EditorFeatureWrapper-_t_4D7Es.js","./EditorFeatureWrapper-MP8HHRxx.css","./RundownExport-DhCryTUp.js","./RundownExport-Bgtg_idR.css","./TimerControlExport-CQQ2KxqK.js","./TimerControlExport-cJRa5GUp.css","./MessageControlExport-CWQX8mH0.js","./MessageControlExport-D_pNX6Vj.css"])))=>i.map(i=>d[i]);
2
+ var Zt=Object.defineProperty;var Xt=(e,t,n)=>t in e?Zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Me=(e,t,n)=>Xt(e,typeof t!="symbol"?t+"":t,n);import{c as Yt,Q as en,a as tn,u as nn,i as on,b as rn,d as sn,e as b,f as _e,R as st,w as an,j as o,g as cn,r as ln,h as c,k as ne,l as un,I as dn,m as mn,n as B,o as at,p as fn,D as it,q as ct,s as lt,t as ut,v as Pe,x as oe,y as dt,z as pn,A as gn,B as hn,C as mt,E as _n,F as be,G as bn,H as vn,J as yn,K as xn,L as wn,M as Sn,N as kn,O as jn,P as de,S as Cn,T as En,U as Nn,V as In,W as Tn,X as Rn,Y as Pn,Z as Dn,_ as $n,$ as E,a0 as v,a1 as An,a2 as On,a3 as Ln,a4 as Un,a5 as Fn,a6 as Mn,a7 as zn}from"./vendor-DmGkEtRj.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="296e101b-c9fc-4601-b008-74f812b888db",e._sentryDebugIdIdentifier="sentry-dbid-296e101b-c9fc-4601-b008-74f812b888db")}catch{}})();(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();var Y=(e=>(e.CountDown="count-down",e.CountUp="count-up",e.Clock="clock",e.None="none",e))(Y||{}),T=(e=>(e.Editor="editor",e.Cuesheet="cuesheet",e.Operator="op",e.Timer="timer",e.Backstage="backstage",e.Timeline="timeline",e.StudioClock="studio",e.Countdown="countdown",e.ProjectInfo="info",e))(T||{}),N=(e=>(e.Ping="ping",e.Pong="pong",e.ClientInit="client-init",e.ClientSet="client-set",e.ClientSetPath="client-set-path",e.ClientRename="client-rename",e.ClientRedirect="client-redirect",e.ClientList="client-list",e.Dialog="dialog",e.Log="log",e.RuntimeData="runtime-data",e.Refetch="refetch",e))(N||{}),R=(e=>(e.All="all",e.CustomFields="custom-fields",e.ProjectData="project-data",e.Report="report",e.Rundown="rundown",e.UrlPresets="url-presets",e.ViewSettings="view-settings",e.Translation="translation",e.Settings="settings",e))(R||{}),ft=(e=>(e.Info="INFO",e.Warn="WARN",e.Error="ERROR",e.Severe="SEVERE",e))(ft||{}),p=(e=>(e.Client="CLIENT",e.Playback="PLAYBACK",e.Rx="RX",e.Server="SERVER",e.Tx="TX",e.User="USER",e))(p||{}),pt=(e=>(e.Roll="roll",e.Play="play",e.Pause="pause",e.Stop="stop",e.Armed="armed",e))(pt||{}),G=(e=>(e.Absolute="absolute",e.Relative="relative",e))(G||{}),W=(e=>(e.Start="start",e.Pause="pause",e.Stop="stop",e))(W||{}),me=(e=>(e.CountUp="count-up",e.CountDown="count-down",e))(me||{}),gt=(e=>(e.None="none",e.Default="default",e.Warning="warning",e.Danger="danger",e.Overtime="overtime",e.Pending="pending",e))(gt||{});const qn={clock:0,timer:{addedTime:0,current:null,duration:null,elapsed:null,expectedFinish:null,phase:gt.None,playback:pt.Stop,secondaryTimer:null,startedAt:null},message:{timer:{text:"",visible:!1,blink:!1,blackout:!1,secondarySource:null},secondary:""},rundown:{selectedEventIndex:null,numEvents:0,plannedStart:0,plannedEnd:0,actualStart:null,actualGroupStart:null,currentDay:null},offset:{absolute:0,relative:0,mode:G.Absolute,expectedFlagStart:null,expectedGroupEnd:null,expectedRundownEnd:null},groupNow:null,eventNow:null,eventNext:null,eventFlag:null,auxtimer1:{current:0,direction:me.CountUp,duration:0,playback:W.Stop},auxtimer2:{current:0,direction:me.CountUp,duration:0,playback:W.Stop},auxtimer3:{current:0,direction:me.CountUp,duration:0,playback:W.Stop},ping:1},ve={"common.expected_finish":"Expected Finish","common.minutes":"min","common.seconds":"sec","common.now":"Now","common.next":"Next","common.scheduled_start":"Scheduled start","common.scheduled_end":"Scheduled end","common.expected_start":"Expected start","common.expected_end":"Expected end","common.stage_timer":"Stage Timer","common.started_at":"Started At","common.time_now":"Time now","common.no_data":"No data","countdown.ended":"Event ended at","countdown.running":"Event running","countdown.loaded":"Event loaded","countdown.select_event":"Select an event to follow","countdown.to_start":"Time to start","countdown.waiting":"Waiting for event start","countdown.overtime":"in overtime","timeline.live":"live","timeline.done":"done","timeline.due":"due","timeline.followedby":"Followed by","project.title":"Title","project.description":"Description","project.info":"Project Info","project.url":"Project URL"},Bn="4.3.1",Pi="https://www.github.com/cpvalente/ontime",Di="https://api.github.com/repos/cpvalente/ontime/releases/latest",$i="https://www.getontime.no",Ai="https://discord.com/invite/eje3CSUEXm",Oi="https://www.reddit.com/r/ontimeapp/",Li="https://docs.getontime.no",Ui="https://docs.getontime.no/features/custom-fields/",Fi="https://github.com/sponsors/cpvalente",Mi="https://buymeacoffee.com/cpvalente",zi=Bn,qi=!1,Wn=!0,ze=window.location.hostname,Kn=ze==="localhost"||ze==="127.0.0.1";var ot;const Vn=(ot=document.querySelector("base"))==null?void 0:ot.hasAttribute("data-is-cloud"),Bi="ontouchstart"in window||navigator.maxTouchPoints>0,Hn=document.fullscreenEnabled,K=Gn(),J=ht("http",""),Qn=ht("ws","ws");function ht(e,t){const n=new URL(window.location.origin);if(e==="ws"){const s=window.location.protocol==="https:";n.protocol=s?"wss":"ws"}n.pathname=K?`${K}/${t}`:t;const r=n.toString();return r.endsWith("/")?r.slice(0,-1):r}function Gn(){var n;const t=((n=document.querySelector("base"))==null?void 0:n.getAttribute("href"))??"";return t.endsWith("/")?t.slice(0,-1):t}const Jn=Zn(),L=()=>new URLSearchParams(window.location.search).get("n")==="1";function Zn(){const e=document.cookie.split("; ").find(t=>t.startsWith("token="));if(e)try{const{scope:t}=JSON.parse(e.split("=")[1]);return t}catch{return"rw"}return"rw"}const Xn=["appinfo"],De=["appSettings"],Wi=["appVersion"],Ki=["automation"],qe=["customFields"],Yn=["project"],Vi=["projectList"],Hi=["projectRundowns"],Be=["rundown"],ee=["urlpresets"],fe=["viewSettings"];const eo=["report"],$e=["translation"],re=`${J}/data`,Ae="user",to="styles/override.css",no="translations/translations.json",oo=`${J}/${Ae}/${to}`,Qi=`${J}/${Ae}/logo`,ro=`${J}/${Ae}/${no}`,te=1e3,V=1e3*60,ge=1e3*60*60,We=864e5;function so(e,t=Y.CountDown){if(e===null)return 0;let n=0;return t===Y.CountDown&&(n=Math.ceil(e/te)),t===Y.CountUp&&(n=Math.floor(e/te)),n===0?0:n}function ao(e){return Math.floor(e/60)}function io(e){return Math.floor(e/3600)}function Gi(e){return e?Math.floor(e%V/te):0}const co=Yt("1234567890abcdef",6),lo=()=>co();function uo(e){return String(e).padStart(2,"0")}function mo(e,t){if(e==null)return(t==null?void 0:t.fallback)??"...";const n=e<0,r=Math.abs(so(e,t==null?void 0:t.direction)),s=r%60,a=ao(r)%60,i=io(r);return`${n?"-":""}${[i,a,s].map(uo).join(":")}`}function Ji(e){return e.startsWith("00:0")?e.slice(4):e.startsWith("00:")?e.slice(3):e.startsWith("-00:0")?`-${e.slice(5)}`:e.startsWith("-00:")?`-${e.slice(4)}`:e}function Zi(e){return e.endsWith(":00")?e.slice(0,-3):e}function Xi(e){return e.slice(0,-3)}function fo(e,t){if(e<0)return;const n=new Date(e),r=n.getUTCHours().toString().padStart(2,"0"),s=n.getUTCHours().toString(),a=n.getUTCMinutes().toString().padStart(2,"0"),i=n.getUTCMinutes().toString(),l=n.getUTCSeconds().toString().padStart(2,"0"),m=n.getUTCSeconds().toString(),_=n.getUTCMilliseconds().toString().padStart(3,"0"),j=(n.getUTCHours()%12||12).toString(),h=j.padStart(2,"0"),C=n.getUTCHours()>=12?"PM":"AM";return po(t,{HH:r,H:s,hh:h,h:j,mm:a,m:i,ss:l,s:m,S:_,a:C})}function po(e,t){return Object.keys(t).reduce((n,r)=>{const s=new RegExp(`\\b${r}\\b`,"g");return n.replace(s,t[r])},e)}const O={isOnlyNumbers:/^\d+$/,isIPAddress:/^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/,startsWithHttp:/^https?:\/\//,startsWithSlash:/^\//,isAlphanumeric:/^[a-z0-9]+$/i,isAlphanumericWithSpace:/^[a-z0-9_ ]+$/i,isASCII:/^[ -~]+$/,isASCIIorEmpty:/^$|^[ -~]+$/,isNotEmpty:/\S/},go={isOnlyNumbers:e=>O.isOnlyNumbers.test(e),isIPAddress:e=>O.isIPAddress.test(e),startsWithHttp:e=>O.startsWithHttp.test(e),startsWithSlash:e=>O.startsWithSlash.test(e),isAlphanumeric:e=>O.isAlphanumeric.test(e),isAlphanumericWithSpace:e=>O.isAlphanumericWithSpace.test(e),isASCII:e=>O.isASCII.test(e),isASCIIorEmpty:e=>O.isASCIIorEmpty.test(e),isNotEmpty:e=>O.isNotEmpty.test(e)},ho=e=>{const t=/^#((?:[a-f\d]{1}){3,4})$/i,n=/^#((?:[a-f\d]{2}){3,4})$/i;return t.test(e)||n.test(e)};function Yi(e){return e instanceof Error?e.message:String(e)}function _o(e){const t=e.replace(/[a-zA-Z0-9]/g,n=>/[a-zA-Z]/.test(n)?String.fromCharCode((n<="Z"?90:122)>=(n=n.charCodeAt(0)+13)?n:n-26):String.fromCharCode((n<="4"?57:48)>=(n=n.charCodeAt(0)+5)?n:n-10));return e.startsWith("_")?t.replace("_",""):`_${t}`}function Ke(e){return e.startsWith("_")?_o(e):e}function _t(e,t){const{timeStart:n,dayOffset:r,delay:s}=e,{currentDay:a,totalGap:i,isLinkedToLoaded:l,offset:m,mode:_,actualStart:j,plannedStart:h}=t,C=r-a,w=Math.max(0,n+s)+C*We;let A=0;_===G.Relative&&(A=(j??0)+a*We-(h??0));const u=w+A,se=u+m;return l?se:i>m?u:se-i}function bo(e,t,n=.5){const r=n,s=1-r;return{red:Math.round(e.red*r+t.red*s),green:Math.round(e.green*r+t.green*s),blue:Math.round(e.blue*r+t.blue*s),alpha:1}}function bt(e){const t=Math.round(e.alpha*255).toString(16).padStart(2,"0"),n=e.red.toString(16).padStart(2,"0"),r=e.green.toString(16).padStart(2,"0"),s=e.blue.toString(16).padStart(2,"0");return"#"+n+r+s+t}function vt(e){if(e.startsWith("#"))return Ve(e);const t=e.toLocaleLowerCase();return t in He?Ve(He[t]):null}function Ve(e){if(!ho(e))return null;let t=e.toLocaleLowerCase();t=t.replace(/^#/,"");let n=1;if(t.length===8){const l=t.slice(6,8);n=parseInt(l,16)/255,t=t.slice(0,6)}if(t.length===4){const l=t.slice(3,4).repeat(2);n=parseInt(l,16)/255,t=t.slice(0,3)}t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);const r=parseInt(t,16),s=r>>16,a=r>>8&255,i=r&255;return isNaN(s)||isNaN(a)||isNaN(i)||isNaN(n)?null:{red:s,green:a,blue:i,alpha:n}}function vo(e){return(e.red*299+e.green*587+e.blue*114)/1e3>=128}const He={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd3"},y=new en({defaultOptions:{queries:{gcTime:10*V,networkMode:"always",refetchOnWindowFocus:!1,retry:5,retryDelay:e=>e*2500},mutations:{networkMode:Vn?"online":"always"}}}),yo=[{url:"timer",label:"Timer"},{url:"backstage",label:"Backstage"},{url:"timeline",label:"Timeline"},{url:"studio",label:"Studio Clock"},{url:"countdown",label:"Countdown"},{url:"info",label:"Project Info"}],yt="h:mm:ss a",xt="HH:mm:ss",wt=(e,t)=>on(e,t),H=tn(()=>({...qn}),wt),St=e=>nn(H,e,wt);function kt(e,t){const n=H.getState();n[e]=t,H.setState({...n})}function xo(e){const t=H.getState();H.setState({...t,...e})}const f=e=>()=>St(e),jt={setIdentify:e=>d("client",e),setRedirect:e=>{d("client",e)},setClientName:e=>d("client",e)},ec=f(e=>{var t,n;return{playback:e.timer.playback,selectedEventId:((t=e.eventNow)==null?void 0:t.id)??null,nextEventId:((n=e.eventNext)==null?void 0:n.id)??null}}),tc=f(e=>({blackout:e.message.timer.blackout,blink:e.message.timer.blink,secondarySource:e.message.timer.secondarySource})),nc=f(e=>({text:e.message.timer.text,visible:e.message.timer.visible})),oc=f(e=>({text:e.message.secondary,visible:e.message.timer.secondarySource==="secondary"})),rc=f(e=>{var t,n;return{blink:e.message.timer.blink,blackout:e.message.timer.blackout,phase:e.timer.phase,secondarySource:e.message.timer.secondarySource,showTimerMessage:e.message.timer.visible&&!!e.message.timer.text,timerType:((t=e.eventNow)==null?void 0:t.timerType)??null,countToEnd:((n=e.eventNow)==null?void 0:n.countToEnd)??!1}}),sc={timerText:e=>d("message",{timer:{text:e}}),timerVisible:e=>d("message",{timer:{visible:e}}),secondaryMessage:e=>d("message",{secondary:e}),timerBlink:e=>d("message",{timer:{blink:e}}),timerBlackout:e=>d("message",{timer:{blackout:e}}),timerSecondarySource:e=>d("message",{timer:{secondarySource:e}})},ac=f(e=>({playback:e.timer.playback,selectedEventIndex:e.rundown.selectedEventIndex,numEvents:e.rundown.numEvents,timerPhase:e.timer.phase})),ic={start:()=>d("start",void 0),pause:()=>d("pause",void 0),roll:()=>d("roll",void 0),startNext:()=>d("start","next"),previous:()=>{d("load","previous")},next:()=>{d("load","next")},stop:()=>{d("stop",void 0)},reload:()=>{d("reload",void 0)},addTime:e=>{d("addtime",e)}},cc=f(e=>({aux1:e.auxtimer1.current,aux2:e.auxtimer2.current,aux3:e.auxtimer3.current})),lc=e=>f(t=>e===1?t.auxtimer1.current:e===2?t.auxtimer2.current:t.auxtimer3.current)(),uc=e=>f(t=>e===1?{playback:t.auxtimer1.playback,direction:t.auxtimer1.direction}:e===2?{playback:t.auxtimer2.playback,direction:t.auxtimer2.direction}:{playback:t.auxtimer3.playback,direction:t.auxtimer3.direction})(),dc={start:e=>d("auxtimer",{[e]:W.Start}),pause:e=>d("auxtimer",{[e]:W.Pause}),stop:e=>d("auxtimer",{[e]:W.Stop}),setDirection:(e,t)=>d("auxtimer",{[e]:{direction:t}}),setDuration:(e,t)=>d("auxtimer",{[e]:{duration:t}})},mc=f(e=>{var t;return{selectedEventId:((t=e.eventNow)==null?void 0:t.id)??null}}),fc=f(e=>{var t;return{currentGroupId:((t=e.groupNow)==null?void 0:t.id)??null}}),pc={loadEvent:e=>d("load",{id:e}),startEvent:e=>d("start",{id:e}),start:()=>d("start",void 0),pause:()=>d("pause",void 0)},gc=f(e=>({...e.timer})),hc=f(e=>({clock:e.clock})),_c=f(e=>{var t;return{id:((t=e.eventFlag)==null?void 0:t.id)??null,expectedStart:e.offset.expectedFlagStart}}),bc=f(e=>{var t,n;return{current:e.timer.current,duration:e.timer.duration,timeWarning:((t=e.eventNow)==null?void 0:t.timeWarning)??null,timeDanger:((n=e.eventNow)==null?void 0:n.timeDanger)??null}}),wo=f(e=>({offset:e.offset.mode===G.Absolute?e.offset.absolute:e.offset.relative,mode:e.offset.mode,currentDay:e.rundown.currentDay??0,actualStart:e.rundown.actualStart,plannedStart:e.rundown.plannedStart,clock:e.clock})),So=f(e=>({isOnline:e.ping>0})),vc=f(e=>({offsetMode:e.offset.mode})),yc=e=>d("offsetmode",e),xc=()=>St(t=>({playback:t.timer.playback})),wc=f(e=>({plannedStart:e.rundown.plannedStart,actualStart:e.rundown.actualStart,plannedEnd:e.rundown.plannedEnd})),Sc=f(e=>({expectedEnd:e.offset.expectedRundownEnd})),kc=f(e=>({numEvents:e.rundown.numEvents,selectedEventIndex:e.rundown.selectedEventIndex})),jc=f(e=>({offset:e.offset.mode===G.Absolute?e.offset.absolute:e.offset.relative,playback:e.timer.playback})),Cc=f(e=>{var t;return{clock:e.clock,mode:e.offset.mode,groupExpectedEnd:e.offset.expectedGroupEnd,actualGroupStart:e.rundown.actualGroupStart??0,currentDay:((t=e.eventNow)==null?void 0:t.dayOffset)??0,playback:e.timer.playback}}),Ec=f(e=>{var t;return{clock:e.clock,mode:e.offset.mode,actualStart:e.rundown.actualStart??0,plannedStart:e.rundown.plannedStart??0,currentDay:((t=e.eventNow)==null?void 0:t.dayOffset)??0,playback:e.timer.playback}}),Nc=f(e=>{var t,n;return{eventNext:e.eventNext,eventNow:e.eventNow,message:e.message,time:e.timer,clock:e.clock,timerTypeNow:((t=e.eventNow)==null?void 0:t.timerType)??Y.CountDown,countToEndNow:((n=e.eventNow)==null?void 0:n.countToEnd)??!1,auxTimer:{aux1:e.auxtimer1.current,aux2:e.auxtimer2.current,aux3:e.auxtimer3.current}}}),Ic=f(e=>({playback:e.timer.playback,current:e.timer.current,clock:e.clock})),Tc=f(e=>{var t;return{eventNext:e.eventNext,eventNow:e.eventNow,rundown:e.rundown,selectedEventId:((t=e.eventNow)==null?void 0:t.id)??null,time:e.timer}}),Rc=f(e=>({clock:e.clock,playback:e.timer.playback})),Pc=f(e=>({eventNext:e.eventNext,eventNow:e.eventNow,message:e.message,time:e.timer,offset:e.offset.mode===G.Absolute?e.offset.absolute:e.offset.relative,rundown:e.rundown,expectedRundownEnd:e.offset.expectedRundownEnd}));function ko(){const e=new Date;let t=e.getHours()*ge;return t+=e.getMinutes()*V,t+=e.getSeconds()*te,t+=e.getMilliseconds(),t}function jo(){return new URL(document.location.href).searchParams.get("timeformat")}function Co(){const e=y.getQueryData(De);return(e==null?void 0:e.timeFormat)??"24"}function Dc(e,t=yt,n=xt){return e==="12"?t:n}function Eo(e,t){const n=jo();return n||(Co()==="12"?e:t)}const $c=(e,t,n=Eo)=>{if(e===null)return"...";const r=n((t==null?void 0:t.format12)??yt,(t==null?void 0:t.format24)??xt),s=fo(Math.abs(e),r);return`${e<0?"-":""}${s}`};function Ac(e,t=!0){if(e<=0)return"0m";const n=Math.floor(e/ge),r=Math.floor(e%ge/V);let s="";if(n>0&&(s+=`${n}h`),r>0&&(s+=`${r}m`),!t){const i=e%V/te,l=Math.min(59,Math.ceil(i));l>0&&(s+=`${l}s`)}return s}function Oc(e,t){const{offset:n,currentDay:r,mode:s,actualStart:a,plannedStart:i,clock:l}=wo();return e===null?0:_t({...e},{...t,currentDay:r,offset:n,mode:s,actualStart:a,plannedStart:i})-l}function Lc(e,t){if(e===null)return{expectedStart:0,timeToStart:0,expectedEnd:0,plannedEnd:0};const n=_t({timeStart:e.timeStart,delay:e.delay,dayOffset:e.dayOffset},{totalGap:e.totalGap,isLinkedToLoaded:e.isLinkedToLoaded,...t}),r=e.timeStart+e.duration+e.delay;return{expectedStart:n,timeToStart:n-t.clock,expectedEnd:e.countToEnd?Math.max(n+e.duration,r):n+e.duration,plannedEnd:r}}const Oe=rn(()=>({logs:[]})),No=()=>sn(Oe),Ct=e=>Oe.setState(t=>({logs:[e,...t.logs]})),Io=()=>Oe.setState({logs:[]});function To(e){var t,n;if(b.isAxiosError(e)){const r=((t=e.response)==null?void 0:t.statusText)??"";let s=((n=e.response)==null?void 0:n.data)??"";return typeof s=="object"&&("message"in s?s=JSON.stringify(s.message):s=JSON.stringify(s)),`${r}: ${s}`}else return e instanceof Error?e.message:typeof e!="string"?JSON.stringify(e):e}function Uc(e){return e instanceof Error?e.message:typeof e!="string"?JSON.stringify(e):e}function Fc(e,t){const n=`${e}: ${To(t)}`;Ct({id:lo(),origin:"SERVER",time:mo(ko()),level:ft.Error,text:n})}async function Qe(){await y.invalidateQueries()}function Mc(e,t){return new Blob([e],{type:t})}function zc(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.setAttribute("href",n),r.setAttribute("download",t),document.body.appendChild(r),r.click(),URL.revokeObjectURL(n)}function Ro(e,t){const n=localStorage.getItem(e);return n?n==="true":(localStorage.setItem(e,String(t)),t)}function Po(e){return K?`${K}-${e}`:e}const Et=Po("client-name");function Do(e){localStorage.setItem(Et,e)}const S=_e(e=>({name:localStorage.getItem(Et)??void 0,setName:t=>e(()=>(Do(t),{name:t})),id:"",setId:t=>e({id:t}),redirect:"",setRedirect:t=>e({redirect:t}),clients:{},setClients:t=>e({clients:t})}));function $o(){return S.getState().name}function Ge(e){S.getState().setName(e)}function Ao(e){S.getState().setId(e)}function Je(){return S.getState().id}function Oo(e){S.getState().setRedirect(e)}function Lo(e){return S.getState().setClients(e)}const Uo=_e(e=>({showDialog:null,clearDialog:()=>e({showDialog:null}),setDialog:t=>e({showDialog:t})}));function Nt(e){Uo.getState().setDialog(e)}let P=null,Ze=null;const Fo=1e3;let It=!1,pe=0;const Tt=()=>{P=new WebSocket(Qn);const e=$o();P.onopen=()=>{clearTimeout(Ze),It=!0,pe=0,d(N.ClientSet,{type:"ontime",origin:window.location.origin,path:window.location.pathname+window.location.search,name:e}),Qe(),Xe(!0)},P.onclose=()=>{console.warn("WebSocket disconnected"),Ze=setTimeout(()=>{pe>2&&Xe(!1),console.warn("WebSocket: attempting reconnect"),P&&P.readyState===WebSocket.CLOSED&&(pe+=1,Tt())},Fo)},P.onerror=t=>{console.error("WebSocket error:",t)},P.onmessage=async t=>{try{const n=JSON.parse(t.data),{tag:r,payload:s}=n;if(!r)return;switch(r){case N.Pong:{const a=(new Date().getTime()-new Date(s).getTime())*.5;kt("ping",a);break}case N.ClientInit:{Ao(s.clientId),e||Ge(s.clientName);break}case N.ClientRename:{const a=Je();s.target===a&&Ge(s.name);break}case N.ClientRedirect:{const a=Je();s.target===a&&Oo(s.path);break}case N.ClientList:{Lo(s);break}case N.Dialog:{s.dialog==="welcome"&&Nt("welcome");break}case N.Log:{Ct(s);break}case N.RuntimeData:{xo(s);break}case N.Refetch:{const{target:a,revision:i}=s;switch(a){case R.All:Qe();break;case R.CustomFields:y.invalidateQueries({queryKey:qe});break;case R.ProjectData:y.invalidateQueries({queryKey:Yn});break;case R.Report:y.invalidateQueries({queryKey:eo});break;case R.Rundown:if(i===y.getQueryData(Be).revision)break;y.invalidateQueries({queryKey:Be}),y.invalidateQueries({queryKey:qe});break;case R.UrlPresets:y.invalidateQueries({queryKey:ee});break;case R.ViewSettings:y.invalidateQueries({queryKey:fe});break;case R.Translation:y.invalidateQueries({queryKey:$e});break;case R.Settings:y.invalidateQueries({queryKey:De});break;default:break}break}default:break}}catch{}}};function d(e,t){P&&P.readyState===WebSocket.OPEN&&P.send(JSON.stringify({tag:e,payload:t}))}function Xe(e){kt("ping",e?1:-1)}const Mo="_errorContainer_35w9k_17",zo="_error_35w9k_17",qo="_report_35w9k_30",ae={errorContainer:Mo,error:zo,report:qo};class Ye extends st.Component{constructor(n){super(n);Me(this,"reportContent","");this.state={error:null,errorInfo:null}}static getDerivedStateFromError(n){return{errorMessage:n.toString()}}componentDidCatch(n,r){this.setState({error:n,errorInfo:r}),this.reportContent=`${n} ${r.componentStack}`;const s=H.getState();s.ping<0||an(a=>{a.setExtras({error:n,store:s,hasSocket:{hasConnected:It,reconnectAttempts:pe}});const i=cn(n);this.setState({eventId:i,info:r})})}render(){return this.state.errorMessage?o.jsx("div",{className:ae.errorContainer,"data-testid":"error-container",children:o.jsxs("div",{children:[o.jsx("p",{className:ae.error,children:": /"}),o.jsx("p",{children:"Something went wrong."}),o.jsx("a",{className:ae.report,href:`mailto:mail@getontime.no?subject=Error%20Report&body=${encodeURIComponent(this.reportContent)}`,children:"Report error"}),o.jsx("div",{role:"button",className:ae.report,onClick:()=>{var n;((n=window==null?void 0:window.process)==null?void 0:n.type)==="renderer"?window.ipcRenderer.send("reload"):window.location.reload()},children:"Reload interface"})]})}):this.props.children}}const Bo="_overlay_9onby_17",Wo="_name_9onby_35",Ko="_message_9onby_43",Se={overlay:Bo,name:Wo,message:Ko};function Vo(){var s;const e=S(a=>a.clients),t=S(a=>a.id);if(!((s=e[t])==null?void 0:s.identify))return null;const r=document.getElementById("identify-portal");return r?ln.createPortal(o.jsx(Ho,{}),r):null}function Ho(){var l;const e=S(m=>m.clients),t=S(m=>m.id),n=S(m=>m.name),r=c.useRef(null),{setIdentify:s}=jt,a=(l=e[t])==null?void 0:l.identify,i=c.useCallback(()=>{r.current&&clearTimeout(r.current),s({target:t,identify:!1})},[t,s]);return c.useEffect(()=>(a&&(r.current=setTimeout(i,V)),()=>{r.current&&clearTimeout(r.current)}),[a,t,s,i]),o.jsxs("div",{className:Se.overlay,"data-testid":"identify-overlay",onClick:i,children:[o.jsx("div",{className:Se.name,children:n}),o.jsx("div",{className:Se.message,children:"Click to close"})]})}const Le=`${re}/settings`;async function Qo(){return(await b.get(Le)).data}async function qc(e){return b.post(Le,e)}async function Bc(e){b.post(`${Le}/welcomedialog`,{show:e})}const Go={version:"4.0.0",serverPort:4001,editorKey:null,operatorKey:null,timeFormat:"24",language:"en"};function Rt(){const{data:e,status:t,isFetching:n,isError:r,refetch:s}=ne({queryKey:De,queryFn:Qo,placeholderData:(a,i)=>a,select:a=>{const i={...a};return a.editorKey&&(i.editorKey=Ke(a.editorKey)),a.operatorKey&&(i.operatorKey=Ke(a.operatorKey)),i}});return{data:e??Go,status:t,isFetching:n,isError:r,refetch:s}}const Jo=c.createContext({editorAuth:!1,operatorAuth:!1,validate:()=>!1}),ie={editor:"ontime-editor-entry",operator:"ontime-operator-entry"},Zo=({children:e})=>{const{status:t,data:n}=Rt(),[r,s]=c.useState(!0),[a,i]=c.useState(!0);c.useEffect(()=>{if(t==="pending")return;const m=sessionStorage.getItem(ie.editor);m&&m===n.editorKey?s(!0):s(n.editorKey==null||n.editorKey==="");const _=sessionStorage.getItem(ie.operator);_&&_===n.operatorKey?i(!0):i(n.operatorKey==null||n.operatorKey==="")},[n,t]);const l=c.useCallback((m,_)=>{function j(h,C){return C==null||C===""||h===C}if(_==="editor"){const h=j(m,n.editorKey);return h&&sessionStorage.setItem(ie.editor,m),s(h),h}else if(_==="operator"){const h=j(m,n.operatorKey);return h&&sessionStorage.setItem(ie.operator,m),i(h),h}return!1},[n]);return o.jsx(Jo.Provider,{value:{editorAuth:r,operatorAuth:a,validate:l},children:e})},Pt=c.createContext(void 0),Dt=typeof window<"u"&&"wakeLock"in navigator;function Xo(){const{keepAwake:e}=$t(),t=c.useRef(null);c.useEffect(()=>{const n=()=>{t.current&&t.current.release().finally(()=>{t.current=null})},r=()=>{const a=t.current;if(!a||a.released){if(t.current=null,!Dt)return;navigator.wakeLock.request("screen").then(i=>{t.current=i}).catch(console.error)}},s=new AbortController;return e?(r(),document.addEventListener("visibilitychange",()=>{t.current!==null&&document.visibilityState==="visible"&&r()},{signal:s.signal})):n(),()=>{s.abort(),n()}},[e])}const he="keep-awake";function Yo(e,t){return(t==null?void 0:t.has(he))||e.has(he)}function $t(){const[e,t]=un(),n=c.use(Pt),r=c.useMemo(()=>{const a=n?new URLSearchParams(n.search):void 0;return Yo(e,a)},[n,e]),s=c.useCallback(()=>{t(a=>(r?a.delete(he):a.set(he,"1"),a))},[r,t]);return{keepAwake:r,toggleKeepAwake:s}}function er(){return Xo(),null}const ye=`${re}/assets`;async function Wc(){return(await b.get(`${ye}/css`)).data}async function Kc(e){await b.post(`${ye}/css`,{css:e})}async function Vc(){return(await b.post(`${ye}/css/restore`)).data}async function tr(){return(await b.get(ro)).data}async function nr(e){await b.post(`${ye}/translations`,{translation:e}),await y.invalidateQueries({queryKey:$e})}const Ue=12e4,Hc={cuesheetMode:"cuesheet-mode",editorMode:"editor-mode"};var or=(e=>(e.Run="run",e.Edit="edit",e))(or||{});function rr(){const{data:e,status:t,refetch:n}=ne({queryKey:$e,queryFn:tr,placeholderData:(r,s)=>r,refetchInterval:Ue});return{data:e??ve,status:t,refetch:n}}const sr={"common.expected_finish":"Erwartetes Ende","common.minutes":"min","common.seconds":"sek","common.now":"Jetzt","common.next":"Nächste","common.scheduled_start":"Geplanter beginn","common.scheduled_end":"Geplantes ende","common.expected_start":"Erwartetes beginn","common.expected_end":"Erwartetes ende","common.stage_timer":"Bühnen-Timer","common.started_at":"Gestartet am","common.time_now":"Aktuelle Zeit","common.no_data":"Keine Daten","countdown.ended":"Veranstaltung endete um","countdown.running":"Veranstaltung läuft","countdown.loaded":"Veranstaltung geladen","countdown.select_event":"Wählen Sie eine Veranstaltung aus, um sie zu verfolgen","countdown.to_start":"Zeit bis zum Start","countdown.waiting":"Warten auf den Veranstaltungsbeginn","countdown.overtime":"überfällig","timeline.live":"live","timeline.done":"Beendet","timeline.due":"fällig","timeline.followedby":"Gefolgt von","project.title":"Titel","project.description":"Beschreibung","project.info":"Projektinfo","project.url":"Projekt-URL"},ar={"common.expected_finish":"Finalización esperada","common.minutes":"min","common.seconds":"sec","common.now":"Ahora","common.next":"Siguiente","common.scheduled_start":"Inicio programado","common.scheduled_end":"Fin programado","common.expected_start":"Inicio previsto","common.expected_end":"Fin previsto","common.stage_timer":"Temporizador de presentador","common.started_at":"Iniciado en","common.time_now":"Ahora","common.no_data":"Sin datos","countdown.ended":"Evento finalizado a las","countdown.running":"Evento en curso","countdown.loaded":"Evento está cargado","countdown.select_event":"Seleccionar un evento para seguir","countdown.to_start":"Tiempo para comenzar","countdown.waiting":"Esperando el inicio del evento","countdown.overtime":"en tiempo extra","timeline.live":"live","timeline.done":"Terminado","timeline.due":"pendiente","timeline.followedby":"Seguido por","project.title":"Título","project.description":"Descripción","project.info":"Información del proyecto","project.url":"URL del proyecto"},ir={"common.expected_finish":"Fin estimée à","common.minutes":"min","common.seconds":"sec","common.now":"Maintenant","common.next":"A suivre","common.scheduled_start":"Début prévu","common.scheduled_end":"Fin prévue","common.expected_start":"Début projeté","common.expected_end":"Fin projetée","common.stage_timer":"Minuteur de scène","common.started_at":"Commencé à","common.time_now":"Heure","common.no_data":"Aucune donnée","countdown.ended":"Évènement terminé à","countdown.running":"Évènement en cours","countdown.loaded":"Évènement chargé","countdown.select_event":"Sélectionnez un évènement à suivre","countdown.to_start":"Évènement commence dans","countdown.waiting":"En attente du début de l’évènement","countdown.overtime":"en dépassement","timeline.live":"live","timeline.done":"Terminé","timeline.due":"dû","timeline.followedby":"Suivi de","project.title":"Titre","project.description":"Description","project.info":"Informations du projet","project.url":"URL du projet"},cr={"common.expected_finish":"Fine Prevista","common.minutes":"min","common.seconds":"sec","common.now":"Adesso","common.next":"Prossimo","common.scheduled_start":"Inizio programmato","common.scheduled_end":"Fine programmata","common.expected_start":"Inizio previsto","common.expected_end":"Fine prevista","common.stage_timer":"Orologio Palco","common.started_at":"Iniziato Alle","common.time_now":"Ora attuale","common.no_data":"Nessun dato disponibile","countdown.ended":"Evento finito alle","countdown.running":"Evento in corso","countdown.loaded":"Evento caricato","countdown.select_event":"Seleziona un evento da seguire","countdown.to_start":"Tempo alla partenza","countdown.waiting":"In attesa dell'inizio dell'evento","countdown.overtime":"in ritardo","timeline.live":"live","timeline.done":"Terminato","timeline.due":"previsto","timeline.followedby":"Seguito da","project.title":"Titolo","project.description":"Descrizione","project.info":"Informazioni sul progetto","project.url":"URL del progetto"},lr={"common.expected_finish":"Término esperado","common.minutes":"min","common.seconds":"sec","common.now":"Agora","common.next":"Próximo","common.scheduled_start":"Início programado","common.scheduled_end":"Fim programado","common.expected_start":"Início previsto","common.expected_end":"Fim previsto","common.stage_timer":"Temporizador do presentador","common.started_at":"Iniciado em","common.time_now":"Hora atual","common.no_data":"Sem dados","countdown.ended":"Evento encerrado às","countdown.running":"Evento em andamento","countdown.loaded":"Evento carregado","countdown.select_event":"Selecione um evento para acompanhar","countdown.to_start":"Tempo para iniciar","countdown.waiting":"Aguardando o início do evento","countdown.overtime":"em tempo extra","timeline.live":"live","timeline.done":"Concluído","timeline.due":"Pendente","timeline.followedby":"Seguido por","project.title":"Título","project.description":"Descrição","project.info":"Informações do projeto","project.url":"URL do projeto"},ke={en:ve,es:ar,fr:ir,it:cr,de:sr,pt:lr},At=c.createContext({userTranslation:ve,getLocalizedString:()=>"",postUserTranslation:async()=>{}}),ur=({children:e})=>{const{data:t}=Rt(),{data:n}=rr(),r=c.useCallback((a,i=(t==null?void 0:t.language)||"en")=>{if(i in ke){if(a in ke[i])return ke[i][a]}else if(i==="custom")return n[a];return ve[a]},[t==null?void 0:t.language,n]),s={userTranslation:n,getLocalizedString:r,postUserTranslation:nr};return o.jsx(At.Provider,{value:s,children:e})},Qc=()=>{const{userTranslation:e,getLocalizedString:t,postUserTranslation:n}=c.useContext(At);return{userTranslation:e,getLocalizedString:t,postUserTranslation:n}},dr=_e(e=>({isOpen:!1,open:()=>e({isOpen:!0}),close:()=>e({isOpen:!1}),toggle:()=>e(t=>({isOpen:!t.isOpen}))}));function mr(e,t){let n;return(...r)=>{n||(n=setTimeout(()=>{n=null,e(...r)},t))}}const fr=3e3,Ot=(e=!1)=>{const[t,n]=c.useState(e);return c.useEffect(()=>{let r=null;const a=mr(()=>{n(!0),r&&clearTimeout(r),r=setTimeout(()=>n(!1),fr)},1e3);return a(),document.addEventListener("mousemove",a),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousemove",a),document.removeEventListener("keydown",a),r&&clearTimeout(r)}},[]),t},pr={red:26,green:26,blue:26},Gc=e=>{if(!e)return{backgroundColor:"#1a1a1a",color:"#fffffa"};const t=vt(e);if(!t)return{backgroundColor:"#1a1a1a",color:"#fffffa"};const n=bo(pr,t,1-t.alpha),r=vo(n)?"black":"#fffffa";return{backgroundColor:bt(n),color:r}},k=e=>e.filter(Boolean).join(" "),Jc="–",Zc="––:––:––",Xc="––:––";function Yc(e,t){const n=vt(e);return n?(n.alpha=t,bt(n)):e}const gr="_blink_bz8cs_1",hr="_fourtyfive_bz8cs_13",_r="_mirror_bz8cs_17",br="_subtle_bz8cs_21",vr="_primary_bz8cs_51",yr="_destructive_bz8cs_66",xr="_ghosted_bz8cs_92",wr="_baseIconButton_bz8cs_140",Sr="_small_bz8cs_157",kr="_medium_bz8cs_162",jr="_large_bz8cs_167",Cr="_xlarge_bz8cs_172",je={blink:gr,fourtyfive:hr,mirror:_r,subtle:br,"subtle-white":"_subtle-white_bz8cs_35",primary:vr,destructive:yr,"subtle-destructive":"_subtle-destructive_bz8cs_79",ghosted:xr,"ghosted-white":"_ghosted-white_bz8cs_108","ghosted-destructive":"_ghosted-destructive_bz8cs_124",baseIconButton:wr,small:Sr,medium:kr,large:jr,xlarge:Cr},Q=c.forwardRef(({className:e,children:t,variant:n="subtle",size:r="medium",...s},a)=>o.jsx("button",{ref:a,className:k([je.baseIconButton,je[n],je[r],e]),type:"button",...s,children:t}));Q.displayName="IconButton";const Er="_fadeable_1nsno_17",Nr="_hidden_1nsno_22",Ir="_buttonContainer_1nsno_27",Ce={fadeable:Er,hidden:Nr,buttonContainer:Ir};function Tr({toggleMenu:e,toggleSettings:t}){const n=Ot(!0);return o.jsxs("div",{id:"fadeable-navigation",className:k([Ce.fadeable,Ce.buttonContainer,!n&&Ce.hidden]),children:[e&&o.jsx(Q,{variant:"subtle-white",size:"xlarge",onClick:e,"aria-label":"toggle menu","data-testid":"navigation__toggle-menu",children:o.jsx(dn,{})}),t&&o.jsx(Q,{variant:"subtle-white",size:"xlarge",onClick:t,"aria-label":"toggle settings","data-testid":"navigation__toggle-settings",children:o.jsx(mn,{})})]})}const Rr="_fadeable_1y6b8_17",Pr="_hidden_1y6b8_22",Dr="_lockIcon_1y6b8_27",Ee={fadeable:Rr,hidden:Pr,lockIcon:Dr};function $r(){const e=Ot();return o.jsx("div",{className:k([Ee.fadeable,Ee.lockIcon,!e&&Ee.hidden]),children:o.jsx(B,{})})}function Ar(){const{width:e}=at();return c.useMemo(()=>e<1300,[e])}const Or=_e()(e=>({mirror:Ro("view-mirror",!1),toggleMirror:t=>e(n=>{const r=typeof t>"u"?!n.mirror:t;return localStorage.setItem("view-mirror",String(r)),{mirror:r}})})),Lr="_blink_1erat_1",Ur="_fourtyfive_1erat_13",Fr="_mirror_1erat_17",Mr="_subtle_1erat_21",zr="_primary_1erat_51",qr="_destructive_1erat_66",Br="_ghosted_1erat_92",Wr="_baseButton_1erat_140",Kr="_loading_1erat_161",Vr="_content_1erat_164",Hr="_loadingOverlay_1erat_174",Qr="_spinner_1erat_180",Gr="_spin_1erat_180",Jr="_small_1erat_190",Zr="_medium_1erat_195",Xr="_large_1erat_200",Yr="_xlarge_1erat_205",es="_fluid_1erat_210",U={blink:Lr,fourtyfive:Ur,mirror:Fr,subtle:Mr,"subtle-white":"_subtle-white_1erat_35",primary:zr,destructive:qr,"subtle-destructive":"_subtle-destructive_1erat_79",ghosted:Br,"ghosted-white":"_ghosted-white_1erat_108","ghosted-destructive":"_ghosted-destructive_1erat_124",baseButton:Wr,loading:Kr,content:Vr,loadingOverlay:Hr,spinner:Qr,spin:Gr,small:Jr,medium:Zr,large:Xr,xlarge:Yr,fluid:es},I=c.forwardRef(({className:e,children:t,variant:n="subtle",size:r="medium",fluid:s,loading:a,...i},l)=>o.jsxs("button",{ref:l,className:k([U.baseButton,U[n],U[r],s&&U.fluid,a&&U.loading,e]),type:"button",disabled:a||i.disabled,...i,children:[o.jsx("span",{className:U.content,children:t}),a&&o.jsx("div",{className:U.loadingOverlay,children:o.jsx(fn,{className:U.spinner})})]}));I.displayName="Button";const ts="_dialog_qv1xq_17",ns="_backdrop_qv1xq_32",os="_title_qv1xq_42",rs="_body_qv1xq_51",ss="_footer_qv1xq_59",Z={dialog:ts,backdrop:ns,title:os,body:rs,footer:ss};function as({isOpen:e,title:t,showCloseButton:n,showBackdrop:r,bodyElements:s,footerElements:a,onClose:i}){return o.jsx(it,{open:e,onOpenChange:l=>{l||i()},children:o.jsxs(ct,{children:[r&&o.jsx(lt,{className:Z.backdrop}),o.jsxs(ut,{className:Z.dialog,children:[o.jsxs("div",{className:Z.title,children:[t,n&&o.jsx(Q,{variant:"subtle-white",onClick:i,children:o.jsx(Pe,{})})]}),o.jsx("div",{className:Z.body,children:s}),o.jsx("div",{className:Z.footer,children:a})]})]})})}const is="_blink_1r8lg_1",cs="_fourtyfive_1r8lg_13",ls="_input_1r8lg_17",us="_subtle_1r8lg_47",ds="_ghosted_1r8lg_51",ms="_medium_1r8lg_56",fs="_large_1r8lg_60",ps="_fluid_1r8lg_64",ce={blink:is,fourtyfive:cs,input:ls,subtle:us,ghosted:ds,medium:ms,large:fs,fluid:ps},gs=c.forwardRef(function({className:t,variant:n="subtle",height:r="medium",fluid:s,...a},i){return o.jsx("input",{ref:i,type:"text",autoCorrect:"off",autoComplete:"off",spellCheck:"false",className:k([ce.input,ce[n],ce[r],s&&ce.fluid,t]),...a})});function hs({id:e,name:t="",isOpen:n,onClose:r}){const[s,a]=c.useState(t),{setClientName:i}=jt,l=()=>{s!==t&&s!==""&&i({target:e,rename:s}),r()},m=s!==t&&s!=="";return o.jsx(as,{isOpen:n,title:`Rename Client: ${t}`,showCloseButton:!0,onClose:r,bodyElements:o.jsx(gs,{height:"large",placeholder:"New name",value:s,onChange:_=>a(_.target.value)}),footerElements:o.jsxs(o.Fragment,{children:[o.jsx(I,{variant:"subtle",size:"large",onClick:r,children:"Cancel"}),o.jsx(I,{variant:"primary",size:"large",onClick:l,disabled:!m,children:"Submit"})]})})}var rt;const Te=((rt=window.process)==null?void 0:rt.type)==="renderer",q=Te?window.require("electron").ipcRenderer:null;function Lt(){const e=c.useCallback((t,n)=>{Te&&q&&q.send(t,n)},[]);return{isElectron:Te,sendToElectron:e}}function el(){const e=oe(),{isElectron:t}=Lt();c.useEffect(()=>(t&&(q.on("request-editor-location",(n,r)=>{e(r,{relative:"route"})}),q.on("dialog",(n,r)=>{r==="welcome"&&Nt("welcome")})),()=>{q==null||q.removeAllListeners()}),[t,e])}function Ut(e){var t;((t=window.process)==null?void 0:t.type)==="renderer"?window.ipcRenderer.send("send-to-link",e):window.open(e)}function _s(e,t,n=J,r=K){t==null||t.preventDefault();const s=new URL(n);s.pathname=r?`${r}/${e}`:e,Ut(s.toString())}function bs(e,t,n=J,r=K){const s=new URL(n);return s.hostname=e,t&&(s.pathname=r?`${r}/${t}`:t),s.toString()}function vs(e){return e.key==="Enter"}function ys(e){return e.key==="Escape"}function tl(e,t){ys(e)&&(e.preventDefault(),e.stopPropagation(),t==null||t())}const xs="_link_pmy0j_17",ws="_current_pmy0j_41",et={link:xs,current:ws};function $({active:e,className:t,children:n,onClick:r}){return o.jsx("div",{className:k([et.link,e&&et.current,t]),tabIndex:0,role:"button",onClick:r,onKeyDown:s=>{vs(s)&&r()},children:n})}const Ss="_linkIcon_1wpyp_17",ks={linkIcon:Ss};function Ne({current:e,to:t,postAction:n,children:r}){const{isElectron:s}=Lt(),a=oe();return s?o.jsxs($,{active:e,onClick:()=>{_s(t),n==null||n()},children:[r,o.jsx(dt,{className:ks.linkIcon})]}):o.jsx($,{active:e,onClick:()=>{a(`/${t}`),n==null||n()},children:r})}function js(){const{width:e}=at(),t=pn();return c.useMemo(()=>(t==="ios"||t==="android")&&e<1300,[e,t])}function Cs(){const e=oe();return js()?o.jsxs(o.Fragment,{children:[o.jsxs($,{active:location.pathname==="/timercontrol",onClick:()=>e("/timercontrol"),children:[o.jsx(B,{}),"Timer Controls"]}),o.jsxs($,{active:location.pathname==="/messagecontrol",onClick:()=>e("/messagecontrol"),children:[o.jsx(B,{}),"Message Controls"]}),o.jsxs($,{active:location.pathname==="/rundown",onClick:()=>e("/rundown"),children:[o.jsx(B,{}),"Rundown"]})]}):o.jsxs($,{active:location.pathname==="/editor",onClick:()=>e("/editor"),children:[o.jsx(B,{}),"Editor"]})}const Ft=`${re}/session`;async function Es(){return(await b.get(`${Ft}/info`)).data}async function nl(e){return(await b.post(`${Ft}/url`,e)).data.url}const Ns={networkInterfaces:[],version:"4.0.0",serverPort:4001,publicDir:""};function Is(){const{data:e,status:t,isError:n,refetch:r,isFetching:s}=ne({queryKey:Xn,queryFn:Es,placeholderData:(a,i)=>a,retry:5,retryDelay:a=>a*2500,refetchInterval:Ue,networkMode:"always"});return{data:e??Ns,status:t,isError:n,refetch:r,isFetching:s}}async function Mt(e){var t;await((t=navigator.clipboard)==null?void 0:t.writeText(e))}async function ol(e){try{await Mt(e)}catch{}}const Ts="_blink_1pu1m_1",Rs="_fourtyfive_1pu1m_13",Ps="_copytag_1pu1m_17",Ds="_action_1pu1m_22",$s="_label_1pu1m_27",As="_small_1pu1m_38",Os="_medium_1pu1m_43",Ls="_large_1pu1m_48",Us="_copy_1pu1m_17",X={blink:Ts,fourtyfive:Rs,copytag:Ps,action:Ds,label:$s,small:As,medium:Os,large:Ls,copy:Us};function Fs({copyValue:e,disabled:t,size:n="medium",children:r,onClick:s}){const[a,i]=c.useState(!1),l=c.useRef(null),m=async()=>{try{await Mt(e),i(!0),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>i(!1),2e3)}catch{}};return o.jsxs("div",{className:X.copytag,children:[s!==void 0?o.jsx(I,{className:X.action,size:n,onClick:s,disabled:t,children:r}):o.jsx("div",{className:k([X.label,X[n]]),children:r}),o.jsx(Q,{className:X.copy,variant:"primary",size:n,onClick:m,disabled:t,children:a?o.jsx(gn,{}):o.jsx(hn,{})})]})}const Ms="_header_elv9y_17",zs="_interfaces_elv9y_23",qs="_interfaceCopy_elv9y_30",Bs="_goIcon_elv9y_35",le={header:Ms,interfaces:zs,interfaceCopy:qs,goIcon:Bs};function Ws({currentLocation:e}){var n;const{data:t}=Is();return t.networkInterfaces.length<2?null:o.jsxs(o.Fragment,{children:[o.jsx("div",{className:le.header,children:"Accessible on external networks"}),o.jsx("div",{className:le.interfaces,children:(n=t==null?void 0:t.networkInterfaces)==null?void 0:n.map(r=>{if(r.name==="localhost")return null;const s=bs(r.address,e);return o.jsx(Fs,{copyValue:s,onClick:()=>Ut(s),size:"small",children:o.jsxs("span",{className:le.interfaceCopy,children:[r.address," ",o.jsx(dt,{className:le.goIcon})]})},r.name)})})]})}const Ks="_separator_1f3q6_17",Vs="_backdrop_1f3q6_21",Hs="_drawer_1f3q6_31",Qs="_header_1f3q6_60",Gs="_body_1f3q6_70",Js="_note_1f3q6_75",F={separator:Ks,backdrop:Vs,drawer:Hs,header:Qs,body:Gs,note:Js},Zs=c.memo(Xs);function Xs({isOpen:e,onClose:t}){const n=S(w=>w.id),r=S(w=>w.name),s=Ar(),[a,i]=mt(!1),{fullscreen:l,toggle:m}=_n(),{mirror:_,toggleMirror:j}=Or(),{keepAwake:h,toggleKeepAwake:C}=$t(),x=be();return o.jsx(it,{open:e,onOpenChange:w=>{w||t()},children:o.jsxs(ct,{children:[o.jsx(lt,{className:F.backdrop}),o.jsx(hs,{id:n,name:r,isOpen:a,onClose:i.close}),o.jsxs(ut,{className:F.drawer,children:[o.jsxs("div",{className:F.header,children:[o.jsx(bn,{children:"Ontime"}),o.jsx(Q,{variant:"subtle-white",size:"large",onClick:t,children:o.jsx(Pe,{})})]}),o.jsxs("div",{className:F.body,children:[Hn&&o.jsxs($,{active:l,onClick:m,children:["Toggle Fullscreen",l?o.jsx(vn,{}):o.jsx(yn,{})]}),o.jsxs($,{active:_,onClick:()=>j(),children:["Flip Screen",o.jsx(xn,{}),_&&o.jsx("span",{className:F.note,children:"Active"})]}),Dt&&o.jsxs($,{active:h,onClick:C,children:["Keep Awake",o.jsx(wn,{}),h&&o.jsx("span",{className:F.note,children:"Active"})]}),o.jsx($,{onClick:i.open,children:"Rename Client"}),o.jsx("hr",{className:F.separator}),o.jsx(Cs,{}),o.jsxs(Ne,{to:"cuesheet",current:x.pathname==="/cuesheet",postAction:s?t:void 0,children:[o.jsx(B,{}),"Cuesheet"]}),o.jsxs(Ne,{to:"op",current:x.pathname==="/op",postAction:s?t:void 0,children:[o.jsx(B,{}),"Operator"]}),o.jsx("hr",{className:F.separator}),yo.map(w=>o.jsx(Ne,{to:w.url,current:x.pathname===`/${w.url}`,postAction:s?t:void 0,children:w.label},w.url))]}),Kn&&o.jsx("div",{children:o.jsx(Ws,{currentLocation:x.pathname})})]})]})})}const D=c.memo(Ys);function Ys({isNavigationLocked:e,suppressSettings:t}){const[n,r]=mt(),{open:s}=dr();return Sn([["Space",()=>{e||r.toggle()},{preventDefault:!0}],["mod + ,",()=>{t||s()},{preventDefault:!0}]]),e&&t?o.jsx($r,{}):o.jsxs(o.Fragment,{children:[o.jsx(Tr,{toggleMenu:e?void 0:r.toggle,toggleSettings:t?void 0:s}),!e&&o.jsx(Zs,{isOpen:n,onClose:r.close})]})}const ea=()=>{const e=oe(),{pathname:t,search:n}=be(),{redirect:r,setRedirect:s}=S(kn(i=>({redirect:i.redirect,setRedirect:i.setRedirect}))),a=So();c.useEffect(()=>{a&&d(N.ClientSetPath,t+n)},[t,n,a]),c.useEffect(()=>{r!==""&&(s(""),r!==t+n&&e(r,{replace:!0}))},[e,t,r,n,s])},xe=`${re}/url-presets`;async function ta(){return(await b.get(xe)).data}async function na(e){return(await b.post(xe,e)).data}async function oa(e,t){return(await b.put(`${xe}/${e}`,t)).data}async function ra(e){return(await b.delete(`${xe}/${e}`)).data}function Fe({skip:e=!1}={}){const{data:t,status:n,isError:r,refetch:s}=ne({queryKey:ee,queryFn:ta,placeholderData:(a,i)=>a,refetchInterval:Ue,enabled:!e});return{data:t??[],status:n,isError:r,refetch:s}}function rl(e){const{data:t}=Fe();return{viewPresets:c.useMemo(()=>t.filter(r=>r.target===e),[t,e])}}function sl(){const e=jn(),t=de({mutationFn:na,onSuccess:s=>{e.setQueryData(ee,s)}}),n=de({mutationFn:({alias:s,data:a})=>oa(s,a),onSuccess:s=>{e.setQueryData(ee,s)}}),r=de({mutationFn:ra,onSuccess:s=>{e.setQueryData(ee,s)}});return{addPreset:t.mutateAsync,updatePreset:(s,a)=>n.mutateAsync({alias:s,data:a}),deletePreset:r.mutateAsync,isMutating:t.isPending||n.isPending||r.isPending,isMutationError:t.isError||n.isError||r.isError}}function sa(e,t){if(la(e))return null;const n=`${e.pathname}${e.search}`.substring(1),r=zt(e),s=new URLSearchParams(e.search).get("token"),a=e.search.includes("n=1");for(const i of t)if(i.enabled&&(i.alias===r||i.target===r)){const l=aa(i.target,i.search,i.alias,a,s);return ia(n,l)?null:l}return null}function zt(e){const n=e.pathname.split("?")[0].split("/").filter(Boolean);return n[0]==="preset"&&n.length>1?n[1]:n[n.length-1]||""}function aa(e,t,n,r,s){const a=Cn(`${e}?${t}`),i=new URLSearchParams(a.search);return i.set("alias",n),r&&i.set("n","1"),s&&i.set("token",s),`${a.pathname}?${i}`.substring(1)}function ia(e,t){const n=new URL(e,document.location.origin),r=new URL(t,document.location.origin);return n.pathname.startsWith("/preset/")||r.pathname.startsWith("/preset/")?n.pathname===r.pathname:n.pathname!==r.pathname?!1:(n.searchParams.delete("token"),n.searchParams.delete("n"),r.searchParams.delete("token"),r.searchParams.delete("n"),n.searchParams.toString()===r.searchParams.toString())}function al(e,t){let n=t;go.startsWithHttp(t.toLowerCase())||(n=`http://${n}`);const r=new URL(n),s=zt(r);if(!ca(s))throw new Error(`Invalid target view: ${s}`);return{alias:e,target:s,search:r.searchParams.toString(),enabled:!0}}function ca(e){return e!==T.Editor&&Object.values(T).includes(e)}function la(e){return e.pathname.split("/").filter(Boolean)[0]==="preset"}const ua="_blink_o6gul_1",da="_fourtyfive_o6gul_13",ma="_header_o6gul_17",fa="_subheader_o6gul_24",pa="_title_o6gul_33",ga="_section_o6gul_43",ha="_indent_o6gul_44",_a="_paragraph_o6gul_63",ba="_card_o6gul_67",va="_highlight_o6gul_75",ya="_blockquote_o6gul_81",xa="_error_o6gul_87",wa="_pad_o6gul_93",Sa="_table_o6gul_99",ka="_listGroup_o6gul_130",ja="_listItem_o6gul_137",Ca="_fieldTitle_o6gul_145",Ea="_fieldDescription_o6gul_150",Na="_fieldError_o6gul_155",Ia="_divider_o6gul_160",Ta="_overlay_o6gul_166",Ra="_loader_o6gul_177",Pa="_animloader_o6gul_1",Da="_empty_o6gul_187",$a="_inlineElements_o6gul_200",Aa="_inner_o6gul_205",Oa="_component_o6gul_208",La="_start_o6gul_211",Ua="_end_o6gul_214",Fa="_apart_o6gul_217",g={blink:ua,fourtyfive:da,header:ma,subheader:fa,title:pa,section:ga,indent:ha,paragraph:_a,card:ba,highlight:va,blockquote:ya,error:xa,pad:wa,table:Sa,listGroup:ka,listItem:ja,fieldTitle:Ca,fieldDescription:Ea,fieldError:Na,divider:Ia,overlay:Ta,loader:Ra,animloader:Pa,empty:Da,inlineElements:$a,inner:Aa,component:Oa,start:La,end:Ua,apart:Fa};function il({children:e}){return o.jsx("h2",{className:g.header,children:e})}function cl({children:e}){return o.jsx("h3",{className:g.subheader,children:e})}function ll({children:e}){return o.jsx("h4",{className:g.title,children:e})}function ul({as:e,className:t,children:n,...r}){const s=e??"div";return o.jsx(s,{className:k([g.section,t]),...r,children:n})}function dl({as:e,className:t,children:n,...r}){const s=e??"div";return o.jsx(s,{className:k([g.indent,t]),...r,children:n})}function ml({children:e}){return o.jsx("p",{className:g.paragraph,children:e})}function fl({children:e,className:t,...n}){return o.jsx("div",{className:k([g.card,t]),...n,children:e})}function pl({className:e,children:t}){return o.jsx("div",{className:g.pad,children:o.jsx("table",{className:k([g.table,e]),children:t})})}function gl({label:e,handleClick:t}){return o.jsx("tr",{className:g.empty,children:o.jsxs("td",{colSpan:99,children:[o.jsx("div",{children:e??"No data yet"}),t&&o.jsxs(I,{onClick:t,disabled:!t,variant:"primary",children:["New ",o.jsx(En,{})]})]})})}function hl({className:e,children:t}){return o.jsx("ul",{className:k([g.listGroup,e]),children:t})}function _l({children:e}){return o.jsx("li",{className:g.listItem,children:e})}function bl({title:e,description:t,error:n}){return o.jsxs("div",{className:g.fieldTitle,children:[e,n&&o.jsx(za,{children:n}),!n&&t&&o.jsx(Ma,{children:t})]})}function Ma({children:e}){return o.jsx("div",{className:g.fieldDescription,children:e})}function vl({children:e}){return o.jsx("code",{className:g.highlight,children:e})}function za({children:e,className:t}){return o.jsx("div",{className:k([g.fieldError,t]),children:e})}function yl(){return o.jsx("hr",{className:g.divider})}function xl({isLoading:e}){return e?o.jsx("div",{className:g.overlay,children:o.jsx("div",{className:g.loader})}):null}function qa({children:e,as:t,relation:n="component",align:r="start",className:s}){const a=t??"div";return o.jsx(a,{className:k([g.inlineElements,g[n],g[r],s]),children:e})}const Ba="_blink_hxuk5_1",Wa="_fourtyfive_hxuk5_13",Ka="_log_hxuk5_17",Va="_apart_hxuk5_27",Ha="_logEntry_hxuk5_31",Qa="_INFO_hxuk5_34",Ga="_WARN_hxuk5_37",Ja="_ERROR_hxuk5_40",Za="_time_hxuk5_46",Xa="_origin_hxuk5_49",Ya="_msg_hxuk5_52",ei="_buttonBar_hxuk5_56",M={blink:Ba,fourtyfive:Wa,log:Ka,apart:Va,logEntry:Ha,INFO:Qa,WARN:Ga,ERROR:Ja,time:Za,origin:Xa,msg:Ya,buttonBar:ei};function ti(){const{logs:e}=No(),[t,n]=c.useState(!0),[r,s]=c.useState(!0),[a,i]=c.useState(!0),[l,m]=c.useState(!0),[_,j]=c.useState(!0),[h,C]=c.useState(!0),x=[];h&&x.push(p.User),t&&x.push(p.Client),r&&x.push(p.Server),a&&x.push(p.Rx),l&&x.push(p.Tx),_&&x.push(p.Playback);const w=e.filter(u=>x.some(se=>u.origin===se)),A=c.useCallback(u=>{u===p.User?C(!0):C(!1),u===p.Client?n(!0):n(!1),u===p.Server?s(!0):s(!1),u===p.Rx?i(!0):i(!1),u===p.Tx?m(!0):m(!1),u===p.Playback?j(!0):j(!1)},[]);return o.jsxs(o.Fragment,{children:[o.jsxs(qa,{className:M.buttonBar,children:[o.jsx(I,{variant:h?"primary":"subtle",size:"small",onClick:()=>C(u=>!u),onAuxClick:()=>A(p.User),onContextMenu:u=>u.preventDefault(),children:p.User}),o.jsx(I,{variant:t?"primary":"subtle",size:"small",onClick:()=>n(u=>!u),onAuxClick:()=>A(p.Client),onContextMenu:u=>u.preventDefault(),children:p.Client}),o.jsx(I,{variant:r?"primary":"subtle",size:"small",onClick:()=>s(u=>!u),onAuxClick:()=>A(p.Server),onContextMenu:u=>u.preventDefault(),children:p.Server}),o.jsx(I,{variant:_?"primary":"subtle",size:"small",onClick:()=>j(u=>!u),onAuxClick:()=>A(p.Playback),onContextMenu:u=>u.preventDefault(),children:p.Playback}),o.jsx(I,{variant:a?"primary":"subtle",size:"small",onClick:()=>i(u=>!u),onAuxClick:()=>A(p.Rx),onContextMenu:u=>u.preventDefault(),children:p.Rx}),o.jsx(I,{variant:l?"primary":"subtle",size:"small",onClick:()=>m(u=>!u),onAuxClick:()=>A(p.Tx),onContextMenu:u=>u.preventDefault(),children:p.Tx}),o.jsxs(I,{variant:"subtle-destructive",size:"small",onClick:Io,className:M.apart,children:[o.jsx(Pe,{})," Clear"]})]}),o.jsx("ul",{className:M.log,children:w.map(u=>o.jsxs("li",{className:`${M.logEntry} ${M[u.level]} `,children:[o.jsx("span",{className:M.time,children:u.time}),o.jsx("span",{className:M.origin,children:u.origin}),o.jsx("span",{className:M.msg,children:u.text})]},u.id))})]})}const ni="_loader_vno17_21",oi="_ellipsis_vno17_28",tt={loader:ni,ellipsis:oi};function we(){return o.jsx("div",{className:tt.loader,children:o.jsxs("div",{className:tt.ellipsis,children:[o.jsx("div",{}),o.jsx("div",{}),o.jsx("div",{}),o.jsx("div",{})]})})}const ri=e=>c.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:275,height:275,fill:"none",viewBox:"0 0 275 275",...e},c.createElement("path",{fill:"#4D4D4D",d:"M49.83 133.919c0-18.343 3.531-34.692 10.595-49.048 7.064-14.355 17.204-25.464 30.42-33.325 13.33-7.861 28.768-11.792 46.313-11.792 24.952 0 45.288 7.633 61.011 22.9 15.837 15.267 24.666 36.003 26.489 62.207l.342 12.647c0 28.369-7.918 51.155-23.755 68.359-15.836 17.09-37.085 25.635-63.745 25.635-26.66 0-47.965-8.545-63.916-25.635-15.836-17.09-23.755-40.332-23.755-69.726v-2.222zm49.389 3.589c0 17.545 3.304 30.989 9.912 40.332 6.608 9.228 16.064 13.843 28.369 13.843 11.963 0 21.305-4.558 28.028-13.672 6.722-9.229 10.083-23.926 10.083-44.092 0-17.204-3.361-30.534-10.083-39.99-6.723-9.457-16.179-14.185-28.37-14.185-12.076 0-21.419 4.728-28.027 14.185-6.608 9.342-9.912 23.869-9.912 43.579z"}),c.createElement("mask",{id:"a",width:177,height:193,x:49,y:39,maskUnits:"userSpaceOnUse"},c.createElement("path",{fill:"#fff",d:"M49.83 133.919c0-18.343 3.531-34.692 10.595-49.048 7.064-14.355 17.204-25.464 30.42-33.325 13.33-7.861 28.768-11.792 46.313-11.792 24.952 0 45.288 7.633 61.011 22.9 15.837 15.267 24.666 36.003 26.489 62.207l.342 12.647c0 28.369-7.918 51.155-23.755 68.359-15.836 17.09-37.085 25.635-63.745 25.635-26.66 0-47.965-8.545-63.916-25.635-15.836-17.09-23.755-40.332-23.755-69.726v-2.222zm49.389 3.589c0 17.545 3.304 30.989 9.912 40.332 6.608 9.228 16.064 13.843 28.369 13.843 11.963 0 21.305-4.558 28.028-13.672 6.722-9.229 10.083-23.926 10.083-44.092 0-17.204-3.361-30.534-10.083-39.99-6.723-9.457-16.179-14.185-28.37-14.185-12.076 0-21.419 4.728-28.027 14.185-6.608 9.342-9.912 23.869-9.912 43.579z"})),c.createElement("g",{mask:"url(#a)"},c.createElement("path",{fill:"url(#paint0_linear)",d:"M19.07 95.347c15.556-6.524 14.288-34.989 22.08-30.11 9.74 6.099 0-23.084 13.549-16.56 21.714 10.455-10.977 18.645 12.296 32.007 23.274 13.362 117.508 24.346 150.898 90.045 12.812 25.21 19.341 32.653 21.836 34.543 1.508-.13 1.78 1.349 0 0-.38.033-.838.168-1.362.476-5.516 3.245-106.876 85.867-148.54 34.124C48.162 188.129 2.25 140.221 14.31 127.463c9.648-10.205 1.393-25.103 4.76-32.116z"}),c.createElement("path",{fill:"url(#paint1_linear)",d:"M42.153 69.754c-7.791-4.88-.412 13.939-24.087 22.582-3.366 7.013 4.63 19.904-5.018 30.109-12.06 12.757 37.623 69.197 79.288 120.94 41.664 51.743 123.453-24.356 128.969-27.6 5.515-3.245 14.092 10.618-10.114-37.154-33.382-65.882-126.481-75.197-149.59-98.582-20.018-20.26 33.92-42.547 10.662-37.896-30.11 6.022-20.37 33.7-30.11 27.6z"})),c.createElement("defs",null,c.createElement("linearGradient",{id:"paint0_linear",x1:93.96,x2:67.62,y1:-33.993,y2:351.251,gradientUnits:"userSpaceOnUse"},c.createElement("stop",null),c.createElement("stop",{offset:1,stopColor:"#414141",stopOpacity:0})),c.createElement("linearGradient",{id:"paint1_linear",x1:88.433,x2:62.092,y1:-37.321,y2:347.924,gradientUnits:"userSpaceOnUse"},c.createElement("stop",{stopColor:"#FF005C",stopOpacity:.74}),c.createElement("stop",{offset:0}),c.createElement("stop",{offset:1,stopColor:"#242424",stopOpacity:0})))),si="_notFound_1d1tc_21",ai="_content_1d1tc_28",nt={notFound:si,content:ai};function Re(){return o.jsx("div",{className:nt.notFound,children:o.jsxs("section",{className:nt.content,children:[o.jsx(ri,{}),o.jsx("h1",{children:"Not found"}),o.jsxs("div",{children:["The page you are after was not found.",o.jsx("br",{}),"It may have moved or your URL may be incorrect.",o.jsx("br",{}),"Double check the URL and try again."]})]})})}const Ie="ontime-override",ii=e=>{const[t,n]=c.useState(!1);return c.useEffect(()=>{if(!e){r();return}if(document.getElementById(Ie)){n(!0);return}n(!1),s(e).then(i=>{if(!i){console.error("Error loading stylesheet: no data");return}return a(i)}).catch(i=>{console.error(`Error loading stylesheet: ${i}`)}).finally(()=>{setTimeout(()=>n(!0),0)});function r(){var i;(i=document.getElementById(Ie))==null||i.remove(),n(!0)}async function s(i){const l=await fetch(i);if(l.ok)return l.text()}async function a(i){const l=document.createElement("style");l.setAttribute("id",Ie),l.innerHTML=i,document.head.append(l)}},[e]),{shouldRender:t}},qt=`${re}/view-settings`;async function ci(){return(await b.get(qt)).data}async function li(e){return(await b.post(qt,e)).data}const ui={dangerColor:"#ff7300",normalColor:"#ffffffcc",overrideStyles:!1,warningColor:"#ffa528"};function di(){const{data:e,status:t}=ne({queryKey:fe,queryFn:ci,placeholderData:(r,s)=>r,staleTime:ge}),{mutateAsync:n}=de({mutationFn:li,onMutate:()=>{y.cancelQueries({queryKey:fe})},onSuccess:r=>{y.setQueryData(fe,r)}});return{data:e??ui,status:t,mutateAsync:n}}function z({children:e}){const{data:t}=di(),{shouldRender:n}=ii(t.overrideStyles?oo:void 0),s=new URLSearchParams(window.location.search).get("keyColour")??"#101010";return n?o.jsxs(o.Fragment,{children:[o.jsx("style",{children:`body { background: var(--background-color-override, ${s}); }`}),e]}):o.jsxs(o.Fragment,{children:[o.jsx("style",{children:`body { background: var(--background-color-override, ${s}); }`}),o.jsx(we,{})]})}const mi="4.3.1",fi=["top.GLOBALS","originalCreateNotification","canvas.contentDocument","MyApp_RemoveAllHighlights","http://tt.epicplay.com","Can't find variable: ZiteReader","jigsaw is not defined","ComboSearch is not defined","http://loading.retry.widdit.com/","atomicFindClose","fb_xd_fragment","bmi_SafeAddOnload","EBCallBackMessageReceived","conduitPage"],pi="https://5e4d2c4b57ab409cb98d4c08b2014755@o4504288369836032.ingest.sentry.io/4504288371343360",gi=()=>(Nn({dsn:pi,integrations:[In({useEffect:st.useEffect,useLocation:be,useNavigationType:Dn,createRoutesFromChildren:Pn,matchRoutes:Rn})],tracesSampleRate:.3,release:mi,enabled:!0,ignoreErrors:[...fi,/Unable to preload CSS/i,/dynamically imported module/i,/Failed to fetch dynamically imported module/i,/Loading chunk \d+ failed/i,/Loading CSS chunk \d+ failed/i,/ChunkLoadError/i,/Loading module .+ failed/i,/Cannot read propert.* of undefined/i,/Cannot read propert.* of null/i,/Network request failed/i,/Failed to fetch/i,/NetworkError/i,/The operation couldn't be completed/i],denyUrls:[/extensions\//i,/^chrome:\/\//i,/^chrome-extension:\/\//i,/external\//i],beforeSend(e){var n,r,s;const t=(s=(r=(n=e.exception)==null?void 0:n.values)==null?void 0:r[0])==null?void 0:s.value;return t&&(t.includes("Cannot read property")||t.includes("Cannot read properties")||t.includes("Network request failed")||t.includes("Failed to fetch"))?null:e}}),Tn($n)),Bt=c.lazy(()=>E(()=>import("./Timer-DvqDm4yX.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32]),import.meta.url)),Wt=c.lazy(()=>E(()=>import("./Countdown-VV03STbF.js"),__vite__mapDeps([33,1,2,34,10,11,9,12,15,16,17,18,19,4,20,21,22,23,24,25,26,28,35,36,37,38,39,30,31,40]),import.meta.url)),Kt=c.lazy(()=>E(()=>import("./Backstage-D2lEbqUt.js"),__vite__mapDeps([41,1,2,7,10,11,9,12,13,14,15,16,17,18,19,4,20,21,22,23,24,34,37,42,26,25,28,30,31,43]),import.meta.url)),Vt=c.lazy(()=>E(()=>import("./Studio-D7evHV2Q.js"),__vite__mapDeps([44,1,2,9,10,11,12,15,16,17,18,19,4,20,21,22,23,24,28,25,26,37,27,31,45]),import.meta.url)),Ht=c.lazy(()=>E(()=>import("./TimelinePage-BfTV9IdT.js"),__vite__mapDeps([46,1,2,9,10,11,12,15,16,17,18,19,4,20,21,22,23,24,25,26,34,28,47,7,31,48]),import.meta.url)),Qt=c.lazy(()=>E(()=>import("./ProjectInfo-KPf-pM8y.js"),__vite__mapDeps([49,1,2,9,10,11,12,15,16,17,18,19,4,20,21,22,23,24,31,50]),import.meta.url)),hi=c.lazy(()=>E(()=>import("./ProtectedEditor-Ddu9vBS8.js"),__vite__mapDeps([51,1,2,52,53,18,19,54,22,23,55,56,20,21,30,31,57,34,36,58,29,59,60,61,62,63,64,65,66,67,37,42,26,5,68,69]),import.meta.url)),Gt=c.lazy(()=>E(()=>import("./ProtectedCuesheet-CCVDLsK-.js"),__vite__mapDeps([70,1,2,52,53,18,19,67,62,63,34,37,42,26,5,68,56,20,21,22,23,30,31,57,54,55,71,60,61,64,65,66,72,29,58,59,47,73,6,7,8,9,10,11,12,74,75,76]),import.meta.url)),Jt=c.lazy(()=>E(()=>import("./OperatorExport-CRS08UXj.js"),__vite__mapDeps([77,1,2,52,53,34,9,10,11,12,17,18,19,4,20,21,22,23,24,35,58,29,59,72,65,47,38,39,74,62,63,75,67,37,42,26,5,68,6,7,8,28,30,78]),import.meta.url)),ue=c.lazy(()=>E(()=>import("./EditorFeatureWrapper-_t_4D7Es.js"),__vite__mapDeps([79,1,2,52,53,80]),import.meta.url)),_i=c.lazy(()=>E(()=>import("./RundownExport-DhCryTUp.js").then(e=>e.R),__vite__mapDeps([81,1,2,60,61,52,53,34,71,64,65,66,72,29,58,59,47,30,20,21,22,23,62,63,54,55,37,73,10,11,35,82]),import.meta.url)),bi=c.lazy(()=>E(()=>import("./TimerControlExport-CQQ2KxqK.js"),__vite__mapDeps([83,1,2,60,61,52,53,64,65,66,62,63,36,84]),import.meta.url)),vi=c.lazy(()=>E(()=>import("./MessageControlExport-CWQX8mH0.js"),__vite__mapDeps([85,1,2,60,61,52,53,20,21,62,63,86]),import.meta.url)),yi=gi();function xi(){return ea(),o.jsx(c.Suspense,{fallback:o.jsx(we,{}),children:o.jsxs(yi,{children:[o.jsx(v,{path:"/",element:o.jsx(An,{to:"/timer"})}),o.jsx(v,{path:"timer",element:o.jsxs(z,{children:[o.jsx(D,{isNavigationLocked:L()}),o.jsx(Bt,{})]})}),o.jsx(v,{path:"countdown",element:o.jsxs(z,{children:[o.jsx(D,{isNavigationLocked:L()}),o.jsx(Wt,{})]})}),o.jsx(v,{path:"backstage",element:o.jsxs(z,{children:[o.jsx(D,{isNavigationLocked:L()}),o.jsx(Kt,{})]})}),o.jsx(v,{path:"studio",element:o.jsxs(z,{children:[o.jsx(D,{isNavigationLocked:L()}),o.jsx(Vt,{})]})}),o.jsx(v,{path:"timeline",element:o.jsxs(z,{children:[o.jsx(D,{isNavigationLocked:L()}),o.jsx(Ht,{})]})}),o.jsx(v,{path:"info",element:o.jsxs(z,{children:[o.jsx(D,{suppressSettings:!0,isNavigationLocked:L()}),o.jsx(Qt,{})]})}),o.jsx(v,{path:"editor",element:o.jsx(hi,{})}),o.jsx(v,{path:"cuesheet",element:o.jsx(Gt,{})}),o.jsx(v,{path:"op",element:o.jsxs(z,{children:[o.jsx(D,{isNavigationLocked:L()}),o.jsx(Jt,{})]})}),o.jsx(v,{path:"rundown",element:o.jsx(ue,{children:o.jsx(_i,{})})}),o.jsx(v,{path:"timercontrol",element:o.jsx(ue,{children:o.jsx(bi,{})})}),o.jsx(v,{path:"messagecontrol",element:o.jsx(ue,{children:o.jsx(vi,{})})}),o.jsx(v,{path:"log",element:o.jsx(ue,{children:o.jsx(ti,{})})}),o.jsx(v,{path:"preset/:alias",element:o.jsx(Si,{})}),o.jsx(v,{path:"*",element:o.jsx(ki,{})})]})})}const wi={[T.Cuesheet]:Gt,[T.Operator]:Jt,[T.Timer]:Bt,[T.Backstage]:Kt,[T.Timeline]:Ht,[T.StudioClock]:Vt,[T.Countdown]:Wt,[T.ProjectInfo]:Qt};function Si(){const{data:e,status:t}=Fe(),{alias:n}=On(),r=c.useMemo(()=>{if(!(t==="pending"||!n))return e.find(i=>i.alias===n&&i.enabled)},[e,t,n]);if(t==="pending")return o.jsx(we,{});const s=Jn==="rw";if(!r)return o.jsxs(o.Fragment,{children:[o.jsx(D,{isNavigationLocked:!s,suppressSettings:!0}),o.jsx(Re,{})]});const a=wi[r.target];return o.jsxs(Pt,{value:r,children:[o.jsx(D,{isNavigationLocked:L(),suppressSettings:!0}),a?o.jsx(a,{}):o.jsx(Re,{})]})}function ki(){const{data:e,status:t}=Fe(),n=oe(),r=be(),s=c.useMemo(()=>t==="pending"?null:sa(r,e),[e,r,t]);return c.useEffect(()=>{s&&n(`/${s}`,{replace:!0})},[s,n]),t==="pending"?o.jsx(we,{}):o.jsxs(o.Fragment,{children:[o.jsx(D,{isNavigationLocked:L(),suppressSettings:!0}),o.jsx(Re,{})]})}Tt();function ji(){return o.jsx(Ln,{client:y,children:o.jsx(Zo,{children:o.jsx(Un,{children:o.jsxs(Fn,{basename:K,children:[o.jsxs("div",{className:"App",children:[o.jsx(Ye,{children:o.jsxs(ur,{children:[o.jsx(Vo,{}),o.jsx(er,{}),o.jsx(xi,{})]})}),o.jsx(Mn,{initialIsOpen:!1})]}),o.jsx(Ye,{children:o.jsx("div",{id:"identify-portal"})})]})})})})}const Ci=document.getElementById("root"),Ei=zn.createRoot(Ci);Ei.render(o.jsx(c.StrictMode,{children:o.jsx(ji,{})}));export{ul as $,Xc as A,I as B,Gi as C,Ar as D,Rc as E,yt as F,Pc as G,cc as H,ge as I,Yc as J,gc as K,we as L,V as M,Qi as N,T as O,Pt as P,Ut as Q,Di as R,Bn as S,Y as T,Kn as U,Wi as V,ml as W,zi as X,za as Y,Vn as Z,il as _,di as a,Zs as a$,fl as a0,cl as a1,$i as a2,Fi as a3,Mi as a4,Li as a5,Pi as a6,Ai as a7,Oi as a8,qa as a9,qe as aA,go as aB,Gc as aC,Yi as aD,Ui as aE,Hi as aF,Ue as aG,as as aH,yo as aI,jt as aJ,S as aK,hs as aL,ti as aM,qi as aN,Qe as aO,Vi as aP,Yn as aQ,qc as aR,Vc as aS,Kc as aT,Wc as aU,Lt as aV,vl as aW,vs as aX,Bc as aY,Uo as aZ,el as a_,yl as aa,tl as ab,xl as ac,ll as ad,hl as ae,_l as af,bl as ag,gs as ah,To as ai,dl as aj,Q as ak,pl as al,gl as am,Is as an,bs as ao,Fs as ap,Mc as aq,zc as ar,sl as as,Ma as at,al as au,Uc as av,Fe as aw,_s as ax,re as ay,Be as az,Rt as b,bc as b0,Po as b1,or as b2,ri as b3,vt as b4,bt as b5,Hc as b6,Jn as b7,L as b8,J as b9,Ye as bA,Ki as bB,Fc as bC,fo as bD,Ro as bE,ic as bF,uc as bG,W as bH,me as bI,dc as bJ,lc as bK,ac as bL,rc as bM,tc as bN,sc as bO,nc as bP,oc as bQ,Jo as bR,ve as bS,pc as bT,Zi as bU,eo as bV,lo as ba,nl as bb,ol as bc,So as bd,Xi as be,Oc as bf,te as bg,Bi as bh,rl as bi,dr as bj,Zc as bk,wc as bl,kc as bm,jc as bn,Sc as bo,Cc as bp,fc as bq,G as br,Ec as bs,_c as bt,y as bu,vc as bv,yc as bw,ec as bx,js as by,D as bz,Nc as c,Qc as d,k as e,$c as f,Dc as g,pt as h,_t as i,Ic as j,Ac as k,xt as l,mo as m,xc as n,mc as o,Ot as p,wo as q,Ji as r,We as s,mr as t,Or as u,hc as v,Lc as w,Jc as x,gt as y,Tc as z};
3
+ //# sourceMappingURL=index-B1K7rED_.js.map