drizzle-cube 0.12.3 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (471) hide show
  1. package/dist/adapters/ActivityGridChart.config-BSTVDQG3.js +1 -0
  2. package/dist/adapters/ActivityGridChart.config-D2oLDJki.cjs +1 -0
  3. package/dist/adapters/AreaChart.config-CaZVNqn-.cjs +1 -0
  4. package/dist/adapters/AreaChart.config-HUr9G5_c.js +1 -0
  5. package/dist/adapters/BarChart.config-BhYrmQ9W.js +1 -0
  6. package/dist/adapters/BarChart.config-BolWSYuN.cjs +1 -0
  7. package/dist/adapters/BoxPlotChart.config-DUxYeOWV.js +1 -0
  8. package/dist/adapters/BoxPlotChart.config-DxfUywRi.cjs +1 -0
  9. package/dist/adapters/BubbleChart.config-CNkdZMOF.cjs +1 -0
  10. package/dist/adapters/BubbleChart.config-DYtZIaKF.js +1 -0
  11. package/dist/adapters/CandlestickChart.config-C9ilaGM6.js +1 -0
  12. package/dist/adapters/CandlestickChart.config-CwOt677r.cjs +1 -0
  13. package/dist/adapters/DataTable.config-Br-X1vrT.js +1 -0
  14. package/dist/adapters/DataTable.config-BvuVZ9Jj.cjs +1 -0
  15. package/dist/adapters/DotStripChart.config-Beuh7di8.js +1 -0
  16. package/dist/adapters/DotStripChart.config-DViEbi8S.cjs +1 -0
  17. package/dist/adapters/FunnelChart.config-BnjD49Wp.js +1 -0
  18. package/dist/adapters/FunnelChart.config-DQob2fw6.cjs +1 -0
  19. package/dist/adapters/GaugeChart.config-4f1JNOsS.cjs +1 -0
  20. package/dist/adapters/GaugeChart.config-sHuMiR0R.js +1 -0
  21. package/dist/adapters/HeatMapChart.config-DGkFw6IU.js +1 -0
  22. package/dist/adapters/HeatMapChart.config-DUM2mA2Z.cjs +1 -0
  23. package/dist/adapters/KpiDelta.config-C3lTkG4L.js +1 -0
  24. package/dist/adapters/KpiDelta.config-KCvw480l.cjs +1 -0
  25. package/dist/adapters/KpiNumber.config-Bbt4Jk-l.cjs +1 -0
  26. package/dist/adapters/KpiNumber.config-DpVzsbkJ.js +1 -0
  27. package/dist/adapters/KpiText.config-B_wDkvrC.cjs +1 -0
  28. package/dist/adapters/KpiText.config-BpbC9fM8.js +1 -0
  29. package/dist/adapters/LineChart.config-C0JcDxH6.js +1 -0
  30. package/dist/adapters/LineChart.config-C2Xvxvxn.cjs +1 -0
  31. package/dist/adapters/MarkdownChart.config-5EolVJ3p.js +1 -0
  32. package/dist/adapters/MarkdownChart.config-YvMw-Ve_.cjs +1 -0
  33. package/dist/adapters/MeasureProfileChart.config-DYH3OLCF.cjs +1 -0
  34. package/dist/adapters/MeasureProfileChart.config-DxwRbnb1.js +1 -0
  35. package/dist/adapters/PieChart.config-DOkkTRV7.cjs +1 -0
  36. package/dist/adapters/PieChart.config-me-OCnBU.js +1 -0
  37. package/dist/adapters/ProportionBarChart.config--rJi1BjU.cjs +1 -0
  38. package/dist/adapters/ProportionBarChart.config-DAyp-gwk.js +1 -0
  39. package/dist/adapters/RadarChart.config-BA0Qep8F.cjs +1 -0
  40. package/dist/adapters/RadarChart.config-BMusTmHu.js +1 -0
  41. package/dist/adapters/RadialBarChart.config-CpN-rQQV.js +1 -0
  42. package/dist/adapters/RadialBarChart.config-CqKrOZ31.cjs +1 -0
  43. package/dist/adapters/RecordsTable.config-D1oll1Av.cjs +1 -0
  44. package/dist/adapters/RecordsTable.config-tQAxFn8Y.js +1 -0
  45. package/dist/adapters/RetentionCombinedChart.config-CfPPOzHw.js +1 -0
  46. package/dist/adapters/RetentionCombinedChart.config-DDX-9tjM.cjs +1 -0
  47. package/dist/adapters/RetentionHeatmap.config-DzmrQBgA.cjs +1 -0
  48. package/dist/adapters/RetentionHeatmap.config-sdYuBcId.js +1 -0
  49. package/dist/adapters/SankeyChart.config-BFkz9AUb.js +1 -0
  50. package/dist/adapters/SankeyChart.config-BKbMaV-d.cjs +1 -0
  51. package/dist/adapters/ScatterChart.config-D5tbnMBt.js +1 -0
  52. package/dist/adapters/ScatterChart.config-DlDcvEw6.cjs +1 -0
  53. package/dist/adapters/SunburstChart.config-Bb8nbyu6.cjs +1 -0
  54. package/dist/adapters/SunburstChart.config-CTRj2x0y.js +1 -0
  55. package/dist/adapters/TreeMapChart.config-DB99vBJS.cjs +1 -0
  56. package/dist/adapters/TreeMapChart.config-DviTwv0e.js +1 -0
  57. package/dist/adapters/WaterfallChart.config-CEOy3p3L.js +1 -0
  58. package/dist/adapters/WaterfallChart.config-DNBLGLpY.cjs +1 -0
  59. package/dist/adapters/core/index.cjs +1 -1
  60. package/dist/adapters/core/index.js +1 -1
  61. package/dist/adapters/{core-CD6SqK5q.js → core-D1FtXGPM.js} +2 -2
  62. package/dist/adapters/{core-3nDM2f7O.cjs → core-Ib5DN_B6.cjs} +1 -1
  63. package/dist/adapters/{cors-headers-DYYDrG7S.js → cors-headers-1y1YYuKm.js} +1 -1
  64. package/dist/adapters/{cors-headers-DxkPVNnZ.cjs → cors-headers-g45-9YKF.cjs} +1 -1
  65. package/dist/adapters/express/index.cjs +1 -1
  66. package/dist/adapters/express/index.js +5 -5
  67. package/dist/adapters/fastify/index.cjs +1 -1
  68. package/dist/adapters/fastify/index.js +5 -5
  69. package/dist/adapters/{handler-DSOaXFuV.cjs → handler-C3oYSaVM.cjs} +3 -3
  70. package/dist/adapters/{handler-B_vsFWWm.js → handler-C9ZFhsv6.js} +32 -32
  71. package/dist/adapters/hono/index.cjs +1 -1
  72. package/dist/adapters/hono/index.js +4 -4
  73. package/dist/adapters/mcp-app-html.cjs +1 -1
  74. package/dist/adapters/mcp-app-html.d.ts +3 -3
  75. package/dist/adapters/mcp-app-html.js +5 -1
  76. package/dist/adapters/mcp-tools.cjs +1 -1
  77. package/dist/adapters/mcp-tools.d.ts +21 -4
  78. package/dist/adapters/mcp-tools.js +42 -36
  79. package/dist/adapters/{mcp-transport-7zszPPXk.cjs → mcp-transport-DnnABB3F.cjs} +1 -1
  80. package/dist/adapters/{mcp-transport-DVI1lCNM.js → mcp-transport-DpJDF0M_.js} +1 -1
  81. package/dist/adapters/nextjs/index.cjs +1 -1
  82. package/dist/adapters/nextjs/index.js +5 -5
  83. package/dist/adapters/{openai-DA9yrRkA.js → openai-DDdpBh3c.js} +1 -1
  84. package/dist/adapters/{openai-Bdnnw3Ok.js → openai-DOMIchMU.js} +1 -1
  85. package/dist/adapters/{openai-JLaT_FPt.cjs → openai-Dxk9OT5p.cjs} +1 -1
  86. package/dist/adapters/{openai-CE52anhW.cjs → openai-Dxu_8i7e.cjs} +1 -1
  87. package/dist/adapters/{utils-OLv25-nn.cjs → utils-0Afl53Xc.cjs} +1 -1
  88. package/dist/adapters/{utils-BtiRfbcX.js → utils-DrbnoHoa.js} +3 -1
  89. package/dist/adapters/utils.cjs +1 -1
  90. package/dist/adapters/utils.js +1 -1
  91. package/dist/cjs/adapters/mcp-app-html.d.ts +3 -3
  92. package/dist/cjs/adapters/mcp-tools.d.ts +21 -4
  93. package/dist/cjs/client/components/charts/HeatMapCanvas.d.ts +1 -1
  94. package/dist/cjs/client/components/dashboard/DashboardContext.d.ts +1 -1
  95. package/dist/cjs/client/components/dashboard/gridLayoutModule.d.ts +9 -0
  96. package/dist/cjs/client/hooks/dashboard/useGridLayoutEngine.d.ts +1 -1
  97. package/dist/cjs/client/hooks/useDashboardHook.d.ts +1 -1
  98. package/dist/cjs/client/stores/dashboardStore.d.ts +1 -1
  99. package/dist/cjs/client/types/gridLayout.d.ts +29 -0
  100. package/dist/client/charts.js +15 -14
  101. package/dist/client/chunks/ActivityGridChart-BpA0H20k.js +297 -0
  102. package/dist/client/chunks/ActivityGridChart-BpA0H20k.js.map +1 -0
  103. package/dist/client/chunks/AngledXAxisTick-CY2hSVQ6.js +23 -0
  104. package/dist/client/chunks/AngledXAxisTick-CY2hSVQ6.js.map +1 -0
  105. package/dist/client/chunks/BarSeries-CA5hID9E.js +85 -0
  106. package/dist/client/chunks/BarSeries-CA5hID9E.js.map +1 -0
  107. package/dist/client/chunks/BatchCoordinator-DGE3i5Sj.js +315 -0
  108. package/dist/client/chunks/BatchCoordinator-DGE3i5Sj.js.map +1 -0
  109. package/dist/client/chunks/BubbleChart-Va-bRr3Y.js +222 -0
  110. package/dist/client/chunks/BubbleChart-Va-bRr3Y.js.map +1 -0
  111. package/dist/client/chunks/BubbleChart.helpers-CaDSYRlF.js +1477 -0
  112. package/dist/client/chunks/BubbleChart.helpers-CaDSYRlF.js.map +1 -0
  113. package/dist/client/chunks/ChartStates-DV1Jtonz.js +66 -0
  114. package/dist/client/chunks/ChartStates-DV1Jtonz.js.map +1 -0
  115. package/dist/client/chunks/ChartSummaryHeader-DSmXm_lT.js +67 -0
  116. package/dist/client/chunks/ChartSummaryHeader-DSmXm_lT.js.map +1 -0
  117. package/dist/client/chunks/{DashboardEditModal-F2fGr29d.js → DashboardEditModal-CnbCHKtu.js} +2611 -4403
  118. package/dist/client/chunks/DashboardEditModal-CnbCHKtu.js.map +1 -0
  119. package/dist/client/chunks/DataHistogram-zBz4Opmm.js +105 -0
  120. package/dist/client/chunks/DataHistogram-zBz4Opmm.js.map +1 -0
  121. package/dist/client/chunks/{DotStripChart-CQaJwo8K.js → DotStripChart-D6o5DpPf.js} +13 -9
  122. package/dist/client/chunks/{DotStripChart-CQaJwo8K.js.map → DotStripChart-D6o5DpPf.js.map} +1 -1
  123. package/dist/client/chunks/DotStripChart.config-BbyRO65s.js +118 -0
  124. package/dist/client/chunks/DotStripChart.config-BbyRO65s.js.map +1 -0
  125. package/dist/client/chunks/FunnelViews-DwvKEzU7.js +279 -0
  126. package/dist/client/chunks/FunnelViews-DwvKEzU7.js.map +1 -0
  127. package/dist/client/chunks/HeatMapChart-DqOZawm3.js +207 -0
  128. package/dist/client/chunks/HeatMapChart-DqOZawm3.js.map +1 -0
  129. package/dist/client/chunks/KpiCompactLayout-rsMv3YHG.js +176 -0
  130. package/dist/client/chunks/KpiCompactLayout-rsMv3YHG.js.map +1 -0
  131. package/dist/client/chunks/KpiDelta-CUqF9vVH.js +32 -0
  132. package/dist/client/chunks/KpiDelta-CUqF9vVH.js.map +1 -0
  133. package/dist/client/chunks/KpiText-Dply9kb4.js +61 -0
  134. package/dist/client/chunks/KpiText-Dply9kb4.js.map +1 -0
  135. package/dist/client/chunks/LoadingIndicator-DQ0k6L2K.js +20 -0
  136. package/dist/client/chunks/LoadingIndicator-DQ0k6L2K.js.map +1 -0
  137. package/dist/client/chunks/MarkdownChart-BlL5h7nK.js +4672 -0
  138. package/dist/client/chunks/MarkdownChart-BlL5h7nK.js.map +1 -0
  139. package/dist/client/chunks/PortletAnalysisModal-CDw3uit7.js +664 -0
  140. package/dist/client/chunks/PortletAnalysisModal-CDw3uit7.js.map +1 -0
  141. package/dist/client/chunks/{ProportionBarChart-DiA5ZGeg.js → ProportionBarChart-CK0FlfTr.js} +12 -9
  142. package/dist/client/chunks/{ProportionBarChart-DiA5ZGeg.js.map → ProportionBarChart-CK0FlfTr.js.map} +1 -1
  143. package/dist/client/chunks/ProportionBarChart.config-CMtPMCH4.js +65 -0
  144. package/dist/client/chunks/ProportionBarChart.config-CMtPMCH4.js.map +1 -0
  145. package/dist/client/chunks/{RecordsTable-Bgqo-LjT.js → RecordsTable-DURm8ypj.js} +22 -18
  146. package/dist/client/chunks/{RecordsTable-Bgqo-LjT.js.map → RecordsTable-DURm8ypj.js.map} +1 -1
  147. package/dist/client/chunks/RecordsTable.config-ke4o6xDT.js +71 -0
  148. package/dist/client/chunks/RecordsTable.config-ke4o6xDT.js.map +1 -0
  149. package/dist/client/chunks/{RetentionCombinedChart-BtMRtwlb.js → RetentionCombinedChart-90MBVuS7.js} +4 -3
  150. package/dist/client/chunks/{RetentionCombinedChart-BtMRtwlb.js.map → RetentionCombinedChart-90MBVuS7.js.map} +1 -1
  151. package/dist/client/chunks/RetentionCombinedChart.config-BHrENGdA.js +53 -0
  152. package/dist/client/chunks/RetentionCombinedChart.config-BHrENGdA.js.map +1 -0
  153. package/dist/client/chunks/{RetentionHeatmap-ChTa35gp.js → RetentionHeatmap-ChwWtk6j.js} +2 -2
  154. package/dist/client/chunks/{RetentionHeatmap-ChTa35gp.js.map → RetentionHeatmap-ChwWtk6j.js.map} +1 -1
  155. package/dist/client/chunks/RetentionHeatmap.config-Dk4X_BQS.js +22 -0
  156. package/dist/client/chunks/RetentionHeatmap.config-Dk4X_BQS.js.map +1 -0
  157. package/dist/client/chunks/ScatterSeries-CJCF4e7H.js +161 -0
  158. package/dist/client/chunks/ScatterSeries-CJCF4e7H.js.map +1 -0
  159. package/dist/client/chunks/SchemaVisualization-RWq1-GVI.js +1 -0
  160. package/dist/client/chunks/TextPortletModal-Fvuzf3mT.js +193 -0
  161. package/dist/client/chunks/TextPortletModal-Fvuzf3mT.js.map +1 -0
  162. package/dist/client/chunks/TreeMapLegend-D39xLZ7R.js +258 -0
  163. package/dist/client/chunks/TreeMapLegend-D39xLZ7R.js.map +1 -0
  164. package/dist/client/chunks/{analysis-builder-CnmkTZm2.js → analysis-builder-4WfT396_.js} +716 -712
  165. package/dist/client/chunks/{analysis-builder-CnmkTZm2.js.map → analysis-builder-4WfT396_.js.map} +1 -1
  166. package/dist/client/chunks/{analysis-builder-shared-BsjxOL7r.js → analysis-builder-shared-DQCAOl8f.js} +985 -983
  167. package/dist/client/chunks/{analysis-builder-shared-BsjxOL7r.js.map → analysis-builder-shared-DQCAOl8f.js.map} +1 -1
  168. package/dist/client/chunks/cartesianChartHelpers-D6a1iOJI.js +261 -0
  169. package/dist/client/chunks/cartesianChartHelpers-D6a1iOJI.js.map +1 -0
  170. package/dist/client/chunks/chart-activity-grid-C0V6erx3.js +133 -0
  171. package/dist/client/chunks/chart-activity-grid-C0V6erx3.js.map +1 -0
  172. package/dist/client/chunks/chart-area-D93yaXt_.js +127 -0
  173. package/dist/client/chunks/chart-area-D93yaXt_.js.map +1 -0
  174. package/dist/client/chunks/chart-bar-Cm5gacSp.js +131 -0
  175. package/dist/client/chunks/chart-bar-Cm5gacSp.js.map +1 -0
  176. package/dist/client/chunks/{chart-box-plot-CW5GZHM9.js → chart-box-plot-XWfiRDvb.js} +13 -11
  177. package/dist/client/chunks/{chart-box-plot-CW5GZHM9.js.map → chart-box-plot-XWfiRDvb.js.map} +1 -1
  178. package/dist/client/chunks/chart-bubble-B5eN2Ass.js +97 -0
  179. package/dist/client/chunks/chart-bubble-B5eN2Ass.js.map +1 -0
  180. package/dist/client/chunks/{chart-candlestick-BPFeay7t.js → chart-candlestick-DkjqHZaS.js} +4 -3
  181. package/dist/client/chunks/{chart-candlestick-BPFeay7t.js.map → chart-candlestick-DkjqHZaS.js.map} +1 -1
  182. package/dist/client/chunks/{chart-config-activity-grid-C4vXGQNu.js → chart-config-activity-grid-BxBwSQOi.js} +2 -2
  183. package/dist/client/chunks/{chart-config-activity-grid-C4vXGQNu.js.map → chart-config-activity-grid-BxBwSQOi.js.map} +1 -1
  184. package/dist/client/chunks/chart-config-area-BAQ3OOX8.js +53 -0
  185. package/dist/client/chunks/chart-config-area-BAQ3OOX8.js.map +1 -0
  186. package/dist/client/chunks/{chart-config-bar-G2HJJBVV.js → chart-config-bar-BI_fdiHp.js} +7 -7
  187. package/dist/client/chunks/{chart-config-bar-G2HJJBVV.js.map → chart-config-bar-BI_fdiHp.js.map} +1 -1
  188. package/dist/client/chunks/{chart-config-box-plot-DMuJZqkr.js → chart-config-box-plot-MlPKB7lL.js} +2 -2
  189. package/dist/client/chunks/{chart-config-box-plot-DMuJZqkr.js.map → chart-config-box-plot-MlPKB7lL.js.map} +1 -1
  190. package/dist/client/chunks/{chart-config-bubble-1IyZinH0.js → chart-config-bubble-kkgqYpmA.js} +2 -2
  191. package/dist/client/chunks/{chart-config-bubble-1IyZinH0.js.map → chart-config-bubble-kkgqYpmA.js.map} +1 -1
  192. package/dist/client/chunks/{chart-config-candlestick-QwQwJB_-.js → chart-config-candlestick-BROunjEW.js} +2 -2
  193. package/dist/client/chunks/{chart-config-candlestick-QwQwJB_-.js.map → chart-config-candlestick-BROunjEW.js.map} +1 -1
  194. package/dist/client/chunks/{chart-config-data-table-CrGyS7aJ.js → chart-config-data-table-B6Qi3Xm7.js} +2 -2
  195. package/dist/client/chunks/{chart-config-data-table-CrGyS7aJ.js.map → chart-config-data-table-B6Qi3Xm7.js.map} +1 -1
  196. package/dist/client/chunks/{chart-config-funnel-DMLLKtPF.js → chart-config-funnel-Dd5O8OuZ.js} +2 -2
  197. package/dist/client/chunks/{chart-config-funnel-DMLLKtPF.js.map → chart-config-funnel-Dd5O8OuZ.js.map} +1 -1
  198. package/dist/client/chunks/{chart-config-gauge-CJktdjox.js → chart-config-gauge-BHzJ-ajH.js} +2 -2
  199. package/dist/client/chunks/{chart-config-gauge-CJktdjox.js.map → chart-config-gauge-BHzJ-ajH.js.map} +1 -1
  200. package/dist/client/chunks/{chart-config-heat-map-CJF65SyL.js → chart-config-heat-map-BQ3lWgrt.js} +2 -2
  201. package/dist/client/chunks/{chart-config-heat-map-CJF65SyL.js.map → chart-config-heat-map-BQ3lWgrt.js.map} +1 -1
  202. package/dist/client/chunks/{chart-config-kpi-delta-BIAq1Ftg.js → chart-config-kpi-delta-B_RTgzlg.js} +3 -3
  203. package/dist/client/chunks/{chart-config-kpi-delta-BIAq1Ftg.js.map → chart-config-kpi-delta-B_RTgzlg.js.map} +1 -1
  204. package/dist/client/chunks/{chart-config-kpi-number-Dgc4gIYu.js → chart-config-kpi-number-DJAk5ijx.js} +3 -3
  205. package/dist/client/chunks/{chart-config-kpi-number-Dgc4gIYu.js.map → chart-config-kpi-number-DJAk5ijx.js.map} +1 -1
  206. package/dist/client/chunks/{chart-config-kpi-text-DnnxvOSA.js → chart-config-kpi-text-xy5s6xuC.js} +2 -2
  207. package/dist/client/chunks/{chart-config-kpi-text-DnnxvOSA.js.map → chart-config-kpi-text-xy5s6xuC.js.map} +1 -1
  208. package/dist/client/chunks/{chart-config-line-DLkRs1Zr.js → chart-config-line-IvPzwe7J.js} +9 -9
  209. package/dist/client/chunks/{chart-config-line-DLkRs1Zr.js.map → chart-config-line-IvPzwe7J.js.map} +1 -1
  210. package/dist/client/chunks/{chart-config-markdown-CK8PAWUg.js → chart-config-markdown-BWAma-cF.js} +2 -2
  211. package/dist/client/chunks/{chart-config-markdown-CK8PAWUg.js.map → chart-config-markdown-BWAma-cF.js.map} +1 -1
  212. package/dist/client/chunks/{chart-config-measure-profile-CRSRIpKh.js → chart-config-measure-profile-CLvcY5Qs.js} +2 -2
  213. package/dist/client/chunks/{chart-config-measure-profile-CRSRIpKh.js.map → chart-config-measure-profile-CLvcY5Qs.js.map} +1 -1
  214. package/dist/client/chunks/{chart-config-pie-XrHim0C8.js → chart-config-pie-XmiWQBnz.js} +3 -3
  215. package/dist/client/chunks/{chart-config-pie-XrHim0C8.js.map → chart-config-pie-XmiWQBnz.js.map} +1 -1
  216. package/dist/client/chunks/{chart-config-radar-xNS6Juqc.js → chart-config-radar-DgJ6MjX5.js} +3 -3
  217. package/dist/client/chunks/{chart-config-radar-xNS6Juqc.js.map → chart-config-radar-DgJ6MjX5.js.map} +1 -1
  218. package/dist/client/chunks/{chart-config-radial-bar-ChUChsEe.js → chart-config-radial-bar-XtEyL4I7.js} +3 -3
  219. package/dist/client/chunks/{chart-config-radial-bar-ChUChsEe.js.map → chart-config-radial-bar-XtEyL4I7.js.map} +1 -1
  220. package/dist/client/chunks/{chart-config-sankey-De8E0C1A.js → chart-config-sankey-CbqiUqXk.js} +2 -2
  221. package/dist/client/chunks/{chart-config-sankey-De8E0C1A.js.map → chart-config-sankey-CbqiUqXk.js.map} +1 -1
  222. package/dist/client/chunks/{chart-config-scatter-CWA89oX4.js → chart-config-scatter-CpsCAH0E.js} +2 -2
  223. package/dist/client/chunks/{chart-config-scatter-CWA89oX4.js.map → chart-config-scatter-CpsCAH0E.js.map} +1 -1
  224. package/dist/client/chunks/{chart-config-sunburst-B4NUYHMH.js → chart-config-sunburst-D_uXQPeS.js} +2 -2
  225. package/dist/client/chunks/{chart-config-sunburst-B4NUYHMH.js.map → chart-config-sunburst-D_uXQPeS.js.map} +1 -1
  226. package/dist/client/chunks/{chart-config-tree-map-CnrJ7OC1.js → chart-config-tree-map-BPkeTgk_.js} +3 -3
  227. package/dist/client/chunks/{chart-config-tree-map-CnrJ7OC1.js.map → chart-config-tree-map-BPkeTgk_.js.map} +1 -1
  228. package/dist/client/chunks/{chart-config-waterfall-DlQb_PLh.js → chart-config-waterfall-CNLbg6tA.js} +2 -2
  229. package/dist/client/chunks/{chart-config-waterfall-DlQb_PLh.js.map → chart-config-waterfall-CNLbg6tA.js.map} +1 -1
  230. package/dist/client/chunks/chart-data-table-LvjMZByO.js +167 -0
  231. package/dist/client/chunks/chart-data-table-LvjMZByO.js.map +1 -0
  232. package/dist/client/chunks/chart-funnel-B_YO8r5g.js +34 -0
  233. package/dist/client/chunks/chart-funnel-B_YO8r5g.js.map +1 -0
  234. package/dist/client/chunks/chart-gauge-BbcdeJ5v.js +145 -0
  235. package/dist/client/chunks/chart-gauge-BbcdeJ5v.js.map +1 -0
  236. package/dist/client/chunks/chart-heat-map-C35lzmXC.js +66 -0
  237. package/dist/client/chunks/chart-heat-map-C35lzmXC.js.map +1 -0
  238. package/dist/client/chunks/chart-kpi-delta-DB4S3nWz.js +211 -0
  239. package/dist/client/chunks/chart-kpi-delta-DB4S3nWz.js.map +1 -0
  240. package/dist/client/chunks/chart-kpi-number-D_NrcF-S.js +166 -0
  241. package/dist/client/chunks/chart-kpi-number-D_NrcF-S.js.map +1 -0
  242. package/dist/client/chunks/chart-kpi-text-CnaJn4Dj.js +132 -0
  243. package/dist/client/chunks/chart-kpi-text-CnaJn4Dj.js.map +1 -0
  244. package/dist/client/chunks/{chart-line-D_yFQDze.js → chart-line-B2R3wnGP.js} +35 -28
  245. package/dist/client/chunks/{chart-line-D_yFQDze.js.map → chart-line-B2R3wnGP.js.map} +1 -1
  246. package/dist/client/chunks/chart-markdown-DGPf7O38.js +68 -0
  247. package/dist/client/chunks/chart-markdown-DGPf7O38.js.map +1 -0
  248. package/dist/client/chunks/{chart-measure-profile-DOHIm-QY.js → chart-measure-profile-CYli1HVY.js} +14 -10
  249. package/dist/client/chunks/{chart-measure-profile-DOHIm-QY.js.map → chart-measure-profile-CYli1HVY.js.map} +1 -1
  250. package/dist/client/chunks/{chart-pie-DLrT81CL.js → chart-pie-CsO68YHG.js} +37 -32
  251. package/dist/client/chunks/{chart-pie-DLrT81CL.js.map → chart-pie-CsO68YHG.js.map} +1 -1
  252. package/dist/client/chunks/chart-radar-C17iNC8c.js +99 -0
  253. package/dist/client/chunks/chart-radar-C17iNC8c.js.map +1 -0
  254. package/dist/client/chunks/chart-radial-bar-ftFfZ-ob.js +90 -0
  255. package/dist/client/chunks/chart-radial-bar-ftFfZ-ob.js.map +1 -0
  256. package/dist/client/chunks/{chart-sankey-CWkctg-k.js → chart-sankey-BUSpiTBN.js} +64 -72
  257. package/dist/client/chunks/chart-sankey-BUSpiTBN.js.map +1 -0
  258. package/dist/client/chunks/chart-scatter-Btk1kofc.js +108 -0
  259. package/dist/client/chunks/chart-scatter-Btk1kofc.js.map +1 -0
  260. package/dist/client/chunks/{chart-sunburst-9sgiHFSO.js → chart-sunburst-BoaobkAb.js} +5 -4
  261. package/dist/client/chunks/{chart-sunburst-9sgiHFSO.js.map → chart-sunburst-BoaobkAb.js.map} +1 -1
  262. package/dist/client/chunks/chart-tree-map-DL_NEnww.js +79 -0
  263. package/dist/client/chunks/chart-tree-map-DL_NEnww.js.map +1 -0
  264. package/dist/client/chunks/{chart-waterfall-BS7x0dW-.js → chart-waterfall-FXv1uwLV.js} +17 -13
  265. package/dist/client/chunks/{chart-waterfall-BS7x0dW-.js.map → chart-waterfall-FXv1uwLV.js.map} +1 -1
  266. package/dist/client/chunks/chartAxisResolution-s-yFUG-H.js +14 -0
  267. package/dist/client/chunks/chartAxisResolution-s-yFUG-H.js.map +1 -0
  268. package/dist/client/chunks/chartComponentRegistry-D5I9EH9T.js +183 -0
  269. package/dist/client/chunks/chartComponentRegistry-D5I9EH9T.js.map +1 -0
  270. package/dist/client/chunks/chartConstants-CeG7zZmB.js +32 -0
  271. package/dist/client/chunks/chartConstants-CeG7zZmB.js.map +1 -0
  272. package/dist/client/chunks/chartPlugin-BHp3WRCj.js +126 -0
  273. package/dist/client/chunks/chartPlugin-BHp3WRCj.js.map +1 -0
  274. package/dist/client/chunks/chartRegistry-Bmubf4iX.js +430 -0
  275. package/dist/client/chunks/chartRegistry-Bmubf4iX.js.map +1 -0
  276. package/dist/client/chunks/chartScaffolding-BFh8cJ0z.js +132 -0
  277. package/dist/client/chunks/chartScaffolding-BFh8cJ0z.js.map +1 -0
  278. package/dist/client/chunks/chartUtils-BDj8NT4c.js +293 -0
  279. package/dist/client/chunks/chartUtils-BDj8NT4c.js.map +1 -0
  280. package/dist/client/chunks/charts-core-CII8LhSd.js +137 -0
  281. package/dist/client/chunks/charts-core-CII8LhSd.js.map +1 -0
  282. package/dist/client/chunks/charts-loader-B6kvPaGV.js +164 -0
  283. package/dist/client/chunks/charts-loader-B6kvPaGV.js.map +1 -0
  284. package/dist/client/chunks/comparisonUtils-BrJqygLf.js +150 -0
  285. package/dist/client/chunks/comparisonUtils-BrJqygLf.js.map +1 -0
  286. package/dist/client/chunks/{core-C6Oh9jUG.js → core-nhQQ5GTQ.js} +2 -2
  287. package/dist/client/chunks/{core-C6Oh9jUG.js.map → core-nhQQ5GTQ.js.map} +1 -1
  288. package/dist/client/chunks/{dashboardExport-ZiT4DcDZ.js → dashboardExport-BNWvcHvg.js} +2 -2
  289. package/dist/client/chunks/{dashboardExport-ZiT4DcDZ.js.map → dashboardExport-BNWvcHvg.js.map} +1 -1
  290. package/dist/client/chunks/dist-CiyOP0NN.js +3830 -0
  291. package/dist/client/chunks/dist-CiyOP0NN.js.map +1 -0
  292. package/dist/client/chunks/exportXlsx-Dnc0ZOJW.js +238 -0
  293. package/dist/client/chunks/exportXlsx-Dnc0ZOJW.js.map +1 -0
  294. package/dist/client/chunks/flow-utils-D1Ql5SVc.js +13 -0
  295. package/dist/client/chunks/flow-utils-D1Ql5SVc.js.map +1 -0
  296. package/dist/client/chunks/funnel-utils-DM7HviOg.js +107 -0
  297. package/dist/client/chunks/funnel-utils-DM7HviOg.js.map +1 -0
  298. package/dist/client/chunks/gaugeChartHelpers-DIizWJgM.js +317 -0
  299. package/dist/client/chunks/gaugeChartHelpers-DIizWJgM.js.map +1 -0
  300. package/dist/client/chunks/multiQueryUtils-My_HGw4K.js +104 -0
  301. package/dist/client/chunks/multiQueryUtils-My_HGw4K.js.map +1 -0
  302. package/dist/client/chunks/{nl-NL-CKfZudeP.js → nl-NL-D0By-h6j.js} +4 -2
  303. package/dist/client/chunks/{nl-NL-CKfZudeP.js.map → nl-NL-D0By-h6j.js.map} +1 -1
  304. package/dist/client/chunks/ordinal-CTFeIYeM.js +67 -0
  305. package/dist/client/chunks/ordinal-CTFeIYeM.js.map +1 -0
  306. package/dist/client/chunks/periodUtils-Ce0-vU2S.js +77 -0
  307. package/dist/client/chunks/periodUtils-Ce0-vU2S.js.map +1 -0
  308. package/dist/client/chunks/pivotUtils-wtiioqnU.js +117 -0
  309. package/dist/client/chunks/pivotUtils-wtiioqnU.js.map +1 -0
  310. package/dist/client/chunks/providers-jeBitA9w.js +238 -0
  311. package/dist/client/chunks/providers-jeBitA9w.js.map +1 -0
  312. package/dist/client/chunks/quantize-CaQkhIo6.js +906 -0
  313. package/dist/client/chunks/quantize-CaQkhIo6.js.map +1 -0
  314. package/dist/client/chunks/query-shape-Dv_qf-Nn.js +10 -0
  315. package/dist/client/chunks/query-shape-Dv_qf-Nn.js.map +1 -0
  316. package/dist/client/chunks/radarChartHelpers-qBWsG55A.js +47 -0
  317. package/dist/client/chunks/radarChartHelpers-qBWsG55A.js.map +1 -0
  318. package/dist/client/chunks/radialBarChartHelpers-BSdeHzM7.js +40 -0
  319. package/dist/client/chunks/radialBarChartHelpers-BSdeHzM7.js.map +1 -0
  320. package/dist/client/chunks/{rolldown-runtime-DArdT4gl.js → rolldown-runtime-B0aSnxlc.js} +2 -5
  321. package/dist/client/chunks/{schema-visualization-BO70spCF.js → schema-visualization-D8DYZY2B.js} +115 -106
  322. package/dist/client/chunks/schema-visualization-D8DYZY2B.js.map +1 -0
  323. package/dist/client/chunks/targetUtils-SRy303Hh.js +36 -0
  324. package/dist/client/chunks/targetUtils-SRy303Hh.js.map +1 -0
  325. package/dist/client/chunks/theme-wFun5b1M.js +100 -0
  326. package/dist/client/chunks/theme-wFun5b1M.js.map +1 -0
  327. package/dist/client/chunks/useChartDimensions-Dj85ySRd.js +52 -0
  328. package/dist/client/chunks/useChartDimensions-Dj85ySRd.js.map +1 -0
  329. package/dist/client/chunks/useCubeFieldLabel-CFIn-5yX.js +12 -0
  330. package/dist/client/chunks/useCubeFieldLabel-CFIn-5yX.js.map +1 -0
  331. package/dist/client/chunks/useCubeMetaQuery-CoYktIQn.js +46 -0
  332. package/dist/client/chunks/useCubeMetaQuery-CoYktIQn.js.map +1 -0
  333. package/dist/client/chunks/{useDirtyStateTracking-OVW-JnrF.js → useDirtyStateTracking-BRiIxFzz.js} +84 -81
  334. package/dist/client/chunks/{useDirtyStateTracking-OVW-JnrF.js.map → useDirtyStateTracking-BRiIxFzz.js.map} +1 -1
  335. package/dist/client/chunks/{useExplainAI-BrjlR24K.js → useExplainAI-Cxzacka-.js} +29 -29
  336. package/dist/client/chunks/{useExplainAI-BrjlR24K.js.map → useExplainAI-Cxzacka-.js.map} +1 -1
  337. package/dist/client/chunks/useTheme-Bq_gYwsK.js +27 -0
  338. package/dist/client/chunks/useTheme-Bq_gYwsK.js.map +1 -0
  339. package/dist/client/chunks/{chart-activity-grid-DeDPSs12.js → useTranslation-DiobqdOI.js} +38 -1007
  340. package/dist/client/chunks/useTranslation-DiobqdOI.js.map +1 -0
  341. package/dist/client/chunks/vendor-BPwAo1-t.js +2466 -0
  342. package/dist/client/chunks/vendor-BPwAo1-t.js.map +1 -0
  343. package/dist/client/components/charts/HeatMapCanvas.d.ts +1 -1
  344. package/dist/client/components/dashboard/DashboardContext.d.ts +1 -1
  345. package/dist/client/components/dashboard/gridLayoutModule.d.ts +9 -0
  346. package/dist/client/components.js +1214 -3
  347. package/dist/client/components.js.map +1 -0
  348. package/dist/client/hooks/dashboard/useGridLayoutEngine.d.ts +1 -1
  349. package/dist/client/hooks/useDashboardHook.d.ts +1 -1
  350. package/dist/client/hooks.js +4 -4
  351. package/dist/client/icons.js +1846 -1
  352. package/dist/client/icons.js.map +1 -0
  353. package/dist/client/index.js +454 -446
  354. package/dist/client/index.js.map +1 -1
  355. package/dist/client/providers.js +3 -3
  356. package/dist/client/schema.js +1 -1
  357. package/dist/client/stores/dashboardStore.d.ts +1 -1
  358. package/dist/client/types/gridLayout.d.ts +29 -0
  359. package/dist/client/utils.js +19 -16
  360. package/dist/client/utils.js.map +1 -1
  361. package/dist/client-bundle-stats.html +1 -1
  362. package/dist/mcp-app/mcp-app.html +139 -139
  363. package/dist/server/index.cjs +1 -1
  364. package/dist/server/index.js +3 -1
  365. package/package.json +47 -39
  366. package/dist/adapters/ActivityGridChart.config-D14_z5sv.js +0 -1
  367. package/dist/adapters/ActivityGridChart.config-ufhph9uT.cjs +0 -1
  368. package/dist/adapters/AreaChart.config-0WZQMQva.js +0 -1
  369. package/dist/adapters/AreaChart.config-D13ltksm.cjs +0 -1
  370. package/dist/adapters/BarChart.config-CKW_EixK.cjs +0 -1
  371. package/dist/adapters/BarChart.config-Dap2k5h9.js +0 -1
  372. package/dist/adapters/BoxPlotChart.config-BL9GycIS.js +0 -1
  373. package/dist/adapters/BoxPlotChart.config-D8ijk7P0.cjs +0 -1
  374. package/dist/adapters/BubbleChart.config-B5mdZpOU.js +0 -1
  375. package/dist/adapters/BubbleChart.config-D_F6Q5z3.cjs +0 -1
  376. package/dist/adapters/CandlestickChart.config-DWebnARH.cjs +0 -1
  377. package/dist/adapters/CandlestickChart.config-U_bjkKnh.js +0 -1
  378. package/dist/adapters/DataTable.config-CgONV9qM.cjs +0 -1
  379. package/dist/adapters/DataTable.config-Cuagfjxg.js +0 -1
  380. package/dist/adapters/DotStripChart.config-B5lxjWSO.js +0 -1
  381. package/dist/adapters/DotStripChart.config-fD9Mc6W1.cjs +0 -1
  382. package/dist/adapters/FunnelChart.config-BaE_hLT-.js +0 -1
  383. package/dist/adapters/FunnelChart.config-Cx7W7-R0.cjs +0 -1
  384. package/dist/adapters/GaugeChart.config-CgKuBQVo.cjs +0 -1
  385. package/dist/adapters/GaugeChart.config-ilNlLLj6.js +0 -1
  386. package/dist/adapters/HeatMapChart.config-Bbk6aa8K.js +0 -1
  387. package/dist/adapters/HeatMapChart.config-CURg_iiu.cjs +0 -1
  388. package/dist/adapters/KpiDelta.config-CuZ2C_6t.js +0 -1
  389. package/dist/adapters/KpiDelta.config-DRy870xF.cjs +0 -1
  390. package/dist/adapters/KpiNumber.config-BWowvaBG.cjs +0 -1
  391. package/dist/adapters/KpiNumber.config-h9VspPBo.js +0 -1
  392. package/dist/adapters/KpiText.config-CXouHoxx.js +0 -1
  393. package/dist/adapters/KpiText.config-dSbcOdVW.cjs +0 -1
  394. package/dist/adapters/LineChart.config-BrcTc3dO.cjs +0 -1
  395. package/dist/adapters/LineChart.config-DOZctkmK.js +0 -1
  396. package/dist/adapters/MarkdownChart.config-BduAIK5N.js +0 -1
  397. package/dist/adapters/MarkdownChart.config-CFnH92Fg.cjs +0 -1
  398. package/dist/adapters/MeasureProfileChart.config-BgdtMIbZ.js +0 -1
  399. package/dist/adapters/MeasureProfileChart.config-CUahwnse.cjs +0 -1
  400. package/dist/adapters/PieChart.config-Bwf8meCN.js +0 -1
  401. package/dist/adapters/PieChart.config-ClfJ6LyA.cjs +0 -1
  402. package/dist/adapters/ProportionBarChart.config-CKyen5fP.cjs +0 -1
  403. package/dist/adapters/ProportionBarChart.config-D7RADfKH.js +0 -1
  404. package/dist/adapters/RadarChart.config-CBR7pNrt.js +0 -1
  405. package/dist/adapters/RadarChart.config-DSLRklgx.cjs +0 -1
  406. package/dist/adapters/RadialBarChart.config-BTGjY6JD.js +0 -1
  407. package/dist/adapters/RadialBarChart.config-CPbimqdg.cjs +0 -1
  408. package/dist/adapters/RecordsTable.config-B1Z_3JTJ.js +0 -1
  409. package/dist/adapters/RecordsTable.config-C6QhLcZk.cjs +0 -1
  410. package/dist/adapters/RetentionCombinedChart.config-BkSezvSb.js +0 -1
  411. package/dist/adapters/RetentionCombinedChart.config-R1Eq-xRI.cjs +0 -1
  412. package/dist/adapters/RetentionHeatmap.config-BlUhtL5W.js +0 -1
  413. package/dist/adapters/RetentionHeatmap.config-DCIsToqo.cjs +0 -1
  414. package/dist/adapters/SankeyChart.config-Bt0F2A6e.js +0 -1
  415. package/dist/adapters/SankeyChart.config-_Z5ZrziF.cjs +0 -1
  416. package/dist/adapters/ScatterChart.config-BW0_kSo8.cjs +0 -1
  417. package/dist/adapters/ScatterChart.config-DCaM-v68.js +0 -1
  418. package/dist/adapters/SunburstChart.config-B8Q9pbbo.js +0 -1
  419. package/dist/adapters/SunburstChart.config-mhQZB6uc.cjs +0 -1
  420. package/dist/adapters/TreeMapChart.config-Ch--bdyv.js +0 -1
  421. package/dist/adapters/TreeMapChart.config-DaNlt1aC.cjs +0 -1
  422. package/dist/adapters/WaterfallChart.config-CR49XWjE.cjs +0 -1
  423. package/dist/adapters/WaterfallChart.config-qHaD0m4H.js +0 -1
  424. package/dist/adapters/mcp-app-html-DkiIh0rL.cjs +0 -1
  425. package/dist/adapters/mcp-app-html-DwnysAEL.js +0 -5
  426. package/dist/client/chunks/DashboardEditModal-F2fGr29d.js.map +0 -1
  427. package/dist/client/chunks/chart-activity-grid-DeDPSs12.js.map +0 -1
  428. package/dist/client/chunks/chart-area-WyrVYze7.js +0 -961
  429. package/dist/client/chunks/chart-area-WyrVYze7.js.map +0 -1
  430. package/dist/client/chunks/chart-bar-wGHC1Hfo.js +0 -201
  431. package/dist/client/chunks/chart-bar-wGHC1Hfo.js.map +0 -1
  432. package/dist/client/chunks/chart-bubble-CKkVi7L2.js +0 -221
  433. package/dist/client/chunks/chart-bubble-CKkVi7L2.js.map +0 -1
  434. package/dist/client/chunks/chart-config-area-BnsRQ-MY.js +0 -172
  435. package/dist/client/chunks/chart-config-area-BnsRQ-MY.js.map +0 -1
  436. package/dist/client/chunks/chart-data-table-uJG1V-be.js +0 -5548
  437. package/dist/client/chunks/chart-data-table-uJG1V-be.js.map +0 -1
  438. package/dist/client/chunks/chart-funnel-BtUexI1t.js +0 -409
  439. package/dist/client/chunks/chart-funnel-BtUexI1t.js.map +0 -1
  440. package/dist/client/chunks/chart-gauge-BSrfZFsW.js +0 -456
  441. package/dist/client/chunks/chart-gauge-BSrfZFsW.js.map +0 -1
  442. package/dist/client/chunks/chart-heat-map-DtMtuFnw.js +0 -236
  443. package/dist/client/chunks/chart-heat-map-DtMtuFnw.js.map +0 -1
  444. package/dist/client/chunks/chart-kpi-delta-B0BkN_Q6.js +0 -482
  445. package/dist/client/chunks/chart-kpi-delta-B0BkN_Q6.js.map +0 -1
  446. package/dist/client/chunks/chart-kpi-number-zlBkLesi.js +0 -263
  447. package/dist/client/chunks/chart-kpi-number-zlBkLesi.js.map +0 -1
  448. package/dist/client/chunks/chart-kpi-text-BXXfkhz_.js +0 -188
  449. package/dist/client/chunks/chart-kpi-text-BXXfkhz_.js.map +0 -1
  450. package/dist/client/chunks/chart-markdown-DaBTpRgf.js +0 -8565
  451. package/dist/client/chunks/chart-markdown-DaBTpRgf.js.map +0 -1
  452. package/dist/client/chunks/chart-radar-CcXG6k6o.js +0 -138
  453. package/dist/client/chunks/chart-radar-CcXG6k6o.js.map +0 -1
  454. package/dist/client/chunks/chart-radial-bar-DYn5FLrG.js +0 -122
  455. package/dist/client/chunks/chart-radial-bar-DYn5FLrG.js.map +0 -1
  456. package/dist/client/chunks/chart-sankey-CWkctg-k.js.map +0 -1
  457. package/dist/client/chunks/chart-scatter-CCGL2IEP.js +0 -258
  458. package/dist/client/chunks/chart-scatter-CCGL2IEP.js.map +0 -1
  459. package/dist/client/chunks/chart-tree-map-DOWeXCn_.js +0 -325
  460. package/dist/client/chunks/chart-tree-map-DOWeXCn_.js.map +0 -1
  461. package/dist/client/chunks/charts-core-DM-Eav_9.js +0 -190
  462. package/dist/client/chunks/charts-core-DM-Eav_9.js.map +0 -1
  463. package/dist/client/chunks/charts-loader-3N-LqjLk.js +0 -87
  464. package/dist/client/chunks/charts-loader-3N-LqjLk.js.map +0 -1
  465. package/dist/client/chunks/exceljs.min-BqhtpmKc.js +0 -32036
  466. package/dist/client/chunks/exceljs.min-BqhtpmKc.js.map +0 -1
  467. package/dist/client/chunks/providers-DwQCKdGW.js +0 -7
  468. package/dist/client/chunks/providers-DwQCKdGW.js.map +0 -1
  469. package/dist/client/chunks/schema-visualization-BO70spCF.js.map +0 -1
  470. package/dist/client/chunks/vendor-Das3qwov.js +0 -881
  471. package/dist/client/chunks/vendor-Das3qwov.js.map +0 -1
@@ -0,0 +1,4672 @@
1
+ import { r as e, t } from "./rolldown-runtime-B0aSnxlc.js";
2
+ import { t as n } from "./query-shape-Dv_qf-Nn.js";
3
+ import { c as r } from "./providers-jeBitA9w.js";
4
+ import { n as i } from "./dist-CiyOP0NN.js";
5
+ import { t as a } from "./chart-markdown-DGPf7O38.js";
6
+ import { useContext as o, useEffect as s, useMemo as c, useState as l } from "react";
7
+ //#region node_modules/knap/dist/chunk-DOF2LXGV.js
8
+ function u(e) {
9
+ let t = e.match(/^\/(.+)\/([gimsuy]*)$/);
10
+ return t ? {
11
+ pattern: t[1],
12
+ flags: t[2]
13
+ } : null;
14
+ }
15
+ function d(e) {
16
+ let t = e.trim();
17
+ if (!t.startsWith("(") || !t.endsWith(")")) return t;
18
+ let n = "", r = !1, i = 0;
19
+ for (let e = 0; e < t.length; e++) {
20
+ let a = t[e];
21
+ if (r) r = !1;
22
+ else if (a === "\\") r = !0;
23
+ else if (n) a === n && (n = "");
24
+ else if (a === "\"" || a === "'") n = a;
25
+ else if (a === "(") i++;
26
+ else if (a === ")" && (i--, i === 0 && e !== t.length - 1)) return t;
27
+ }
28
+ return i === 0 ? t.slice(1, -1).trim() : t;
29
+ }
30
+ function f(e) {
31
+ return e.trim().replace(/^(["'])([\s\S]*)\1$/, "$2");
32
+ }
33
+ function p(e) {
34
+ switch (e) {
35
+ case "n": return "\n";
36
+ case "t": return " ";
37
+ case "r": return "\r";
38
+ default: return e;
39
+ }
40
+ }
41
+ function m(e) {
42
+ return e.replace(/\\([\\,:|"'])/g, "$1");
43
+ }
44
+ function h(e) {
45
+ return m(f(e));
46
+ }
47
+ function g(e) {
48
+ if (e !== void 0) return e !== "" && e.trim() === "" ? e : f(d(e));
49
+ }
50
+ function _(e) {
51
+ let t = g(e);
52
+ return t === void 0 ? void 0 : m(t);
53
+ }
54
+ function v(e) {
55
+ let t = C(d(e)), n = t.length === 1 ? f(t[0]) : "";
56
+ return n !== t[0]?.trim() && n.includes(",") ? C(n) : t;
57
+ }
58
+ function y(e) {
59
+ return v(e).map((e) => f(e).replace(/\\(["'])/g, "$1"));
60
+ }
61
+ function b(e) {
62
+ let t = e.trim();
63
+ if (S(t)[1] !== void 0) return t;
64
+ if (t.length >= 2 && (t[0] === "\"" || t[0] === "'") && t.at(-1) === t[0]) return t.slice(1, -1).replace(/\\([\s\S])/g, (e, t) => p(t));
65
+ if (t === "true") return !0;
66
+ if (t === "false") return !1;
67
+ if (t === "null") return null;
68
+ if (/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/.test(t)) {
69
+ let e = Number(t);
70
+ if (Number.isFinite(e)) return e;
71
+ }
72
+ return t;
73
+ }
74
+ function x(e) {
75
+ if (e !== void 0 && e !== "") return C(d(e)).map(b);
76
+ }
77
+ function S(e) {
78
+ let t = "", n = !1, r = 0, i = 0, a = 0;
79
+ for (let o = 0; o < e.length; o++) {
80
+ let s = e[o];
81
+ if (n) n = !1;
82
+ else if (s === "\\") n = !0;
83
+ else if (t) s === t && (t = "");
84
+ else if (s === "\"" || s === "'") t = s;
85
+ else if (s === "(") r++;
86
+ else if (s === ")") r--;
87
+ else if (s === "{") i++;
88
+ else if (s === "}") i--;
89
+ else if (s === "[") a++;
90
+ else if (s === "]") a--;
91
+ else if (s === ":" && r === 0 && i === 0 && a === 0) return [e.slice(0, o).trim(), e.slice(o + 1).trim()];
92
+ }
93
+ return [e.trim()];
94
+ }
95
+ function C(e) {
96
+ let t = [], n = "", r = "", i = !1, a = 0, o = 0, s = 0;
97
+ for (let c of e) i ? (n += c, i = !1) : c === "\\" ? (n += c, i = !0) : r ? (n += c, c === r && (r = "")) : c === "\"" || c === "'" ? (n += c, r = c) : c === "(" ? (n += c, a++) : c === ")" ? (n += c, a--) : c === "{" ? (n += c, o++) : c === "}" ? (n += c, o--) : c === "[" ? (n += c, s++) : c === "]" ? (n += c, s--) : c === "," && a === 0 && o === 0 && s === 0 ? (t.push(n.trim()), n = "") : n += c;
98
+ return t.push(n.trim()), t;
99
+ }
100
+ function w(e, t, n = "FILTER_WARNING") {
101
+ e?.reportWarning?.({
102
+ message: t,
103
+ code: n
104
+ });
105
+ }
106
+ function T(e) {
107
+ return e instanceof Error ? e.message : String(e);
108
+ }
109
+ //#endregion
110
+ //#region node_modules/dayjs/dayjs.min.js
111
+ var E = /* @__PURE__ */ t(((e, t) => {
112
+ (function(n, r) {
113
+ typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs = r();
114
+ })(e, (function() {
115
+ var e = 1e3, t = 6e4, n = 36e5, r = "millisecond", i = "second", a = "minute", o = "hour", s = "day", c = "week", l = "month", u = "quarter", d = "year", f = "date", p = "Invalid Date", m = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, h = /\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, g = {
116
+ name: "en",
117
+ weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
118
+ months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
119
+ ordinal: function(e) {
120
+ var t = [
121
+ "th",
122
+ "st",
123
+ "nd",
124
+ "rd"
125
+ ], n = e % 100;
126
+ return "[" + e + (t[(n - 20) % 10] || t[n] || t[0]) + "]";
127
+ }
128
+ }, _ = function(e, t, n) {
129
+ var r = String(e);
130
+ return !r || r.length >= t ? e : "" + Array(t + 1 - r.length).join(n) + e;
131
+ }, v = {
132
+ s: _,
133
+ z: function(e) {
134
+ var t = -e.utcOffset(), n = Math.abs(t), r = Math.floor(n / 60), i = n % 60;
135
+ return (t <= 0 ? "+" : "-") + _(r, 2, "0") + ":" + _(i, 2, "0");
136
+ },
137
+ m: function e(t, n) {
138
+ if (t.date() < n.date()) return -e(n, t);
139
+ var r = 12 * (n.year() - t.year()) + (n.month() - t.month()), i = t.clone().add(r, l), a = n - i < 0, o = t.clone().add(r + (a ? -1 : 1), l);
140
+ return +(-(r + (n - i) / (a ? i - o : o - i)) || 0);
141
+ },
142
+ a: function(e) {
143
+ return e < 0 ? Math.ceil(e) || 0 : Math.floor(e);
144
+ },
145
+ p: function(e) {
146
+ return {
147
+ M: l,
148
+ y: d,
149
+ w: c,
150
+ d: s,
151
+ D: f,
152
+ h: o,
153
+ m: a,
154
+ s: i,
155
+ ms: r,
156
+ Q: u
157
+ }[e] || String(e || "").toLowerCase().replace(/s$/, "");
158
+ },
159
+ u: function(e) {
160
+ return e === void 0;
161
+ }
162
+ }, y = "en", b = {};
163
+ b[y] = g;
164
+ var x = "$isDayjsObject", S = function(e) {
165
+ return e instanceof E || !(!e || !e[x]);
166
+ }, C = function e(t, n, r) {
167
+ var i;
168
+ if (!t) return y;
169
+ if (typeof t == "string") {
170
+ var a = t.toLowerCase();
171
+ b[a] && (i = a), n && (b[a] = n, i = a);
172
+ var o = t.split("-");
173
+ if (!i && o.length > 1) return e(o[0]);
174
+ } else {
175
+ var s = t.name;
176
+ b[s] = t, i = s;
177
+ }
178
+ return !r && i && (y = i), i || !r && y;
179
+ }, w = function(e, t) {
180
+ if (S(e)) return e.clone();
181
+ var n = typeof t == "object" ? t : {};
182
+ return n.date = e, n.args = arguments, new E(n);
183
+ }, T = v;
184
+ T.l = C, T.i = S, T.w = function(e, t) {
185
+ return w(e, {
186
+ locale: t.$L,
187
+ utc: t.$u,
188
+ x: t.$x,
189
+ $offset: t.$offset
190
+ });
191
+ };
192
+ var E = function() {
193
+ function g(e) {
194
+ this.$L = C(e.locale, null, !0), this.parse(e), this.$x = this.$x || e.x || {}, this[x] = !0;
195
+ }
196
+ var _ = g.prototype;
197
+ return _.parse = function(e) {
198
+ this.$d = function(e) {
199
+ var t = e.date, n = e.utc;
200
+ if (t === null) return /* @__PURE__ */ new Date(NaN);
201
+ if (T.u(t)) return /* @__PURE__ */ new Date();
202
+ if (t instanceof Date) return new Date(t);
203
+ if (typeof t == "string" && !/Z$/i.test(t)) {
204
+ var r = t.match(m);
205
+ if (r) {
206
+ var i = r[2] - 1 || 0, a = (r[7] || "0").substring(0, 3);
207
+ return n ? new Date(Date.UTC(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, a)) : new Date(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, a);
208
+ }
209
+ }
210
+ return new Date(t);
211
+ }(e), this.init();
212
+ }, _.init = function() {
213
+ var e = this.$d;
214
+ this.$y = e.getFullYear(), this.$M = e.getMonth(), this.$D = e.getDate(), this.$W = e.getDay(), this.$H = e.getHours(), this.$m = e.getMinutes(), this.$s = e.getSeconds(), this.$ms = e.getMilliseconds();
215
+ }, _.$utils = function() {
216
+ return T;
217
+ }, _.isValid = function() {
218
+ return this.$d.toString() !== p;
219
+ }, _.isSame = function(e, t) {
220
+ var n = w(e);
221
+ return this.startOf(t) <= n && n <= this.endOf(t);
222
+ }, _.isAfter = function(e, t) {
223
+ return w(e) < this.startOf(t);
224
+ }, _.isBefore = function(e, t) {
225
+ return this.endOf(t) < w(e);
226
+ }, _.$g = function(e, t, n) {
227
+ return T.u(e) ? this[t] : this.set(n, e);
228
+ }, _.unix = function() {
229
+ return Math.floor(this.valueOf() / 1e3);
230
+ }, _.valueOf = function() {
231
+ return this.$d.getTime();
232
+ }, _.startOf = function(e, t) {
233
+ var n = this, r = !!T.u(t) || t, u = T.p(e), p = function(e, t) {
234
+ var i = T.w(n.$u ? Date.UTC(n.$y, t, e) : new Date(n.$y, t, e), n);
235
+ return r ? i : i.endOf(s);
236
+ }, m = function(e, t) {
237
+ return T.w(n.toDate()[e].apply(n.toDate("s"), (r ? [
238
+ 0,
239
+ 0,
240
+ 0,
241
+ 0
242
+ ] : [
243
+ 23,
244
+ 59,
245
+ 59,
246
+ 999
247
+ ]).slice(t)), n);
248
+ }, h = this.$W, g = this.$M, _ = this.$D, v = "set" + (this.$u ? "UTC" : "");
249
+ switch (u) {
250
+ case d: return r ? p(1, 0) : p(31, 11);
251
+ case l: return r ? p(1, g) : p(0, g + 1);
252
+ case c:
253
+ var y = this.$locale().weekStart || 0, b = (h < y ? h + 7 : h) - y;
254
+ return p(r ? _ - b : _ + (6 - b), g);
255
+ case s:
256
+ case f: return m(v + "Hours", 0);
257
+ case o: return m(v + "Minutes", 1);
258
+ case a: return m(v + "Seconds", 2);
259
+ case i: return m(v + "Milliseconds", 3);
260
+ default: return this.clone();
261
+ }
262
+ }, _.endOf = function(e) {
263
+ return this.startOf(e, !1);
264
+ }, _.$set = function(e, t) {
265
+ var n, c = T.p(e), u = "set" + (this.$u ? "UTC" : ""), p = (n = {}, n[s] = u + "Date", n[f] = u + "Date", n[l] = u + "Month", n[d] = u + "FullYear", n[o] = u + "Hours", n[a] = u + "Minutes", n[i] = u + "Seconds", n[r] = u + "Milliseconds", n)[c], m = c === s ? this.$D + (t - this.$W) : t;
266
+ if (c === l || c === d) {
267
+ var h = this.clone().set(f, 1);
268
+ h.$d[p](m), h.init(), this.$d = h.set(f, Math.min(this.$D, h.daysInMonth())).$d;
269
+ } else p && this.$d[p](m);
270
+ return this.init(), this;
271
+ }, _.set = function(e, t) {
272
+ return this.clone().$set(e, t);
273
+ }, _.get = function(e) {
274
+ return this[T.p(e)]();
275
+ }, _.add = function(r, u) {
276
+ var f, p = this;
277
+ r = Number(r);
278
+ var m = T.p(u), h = function(e) {
279
+ var t = w(p);
280
+ return T.w(t.date(t.date() + Math.round(e * r)), p);
281
+ };
282
+ if (m === l) return this.set(l, this.$M + r);
283
+ if (m === d) return this.set(d, this.$y + r);
284
+ if (m === s) return h(1);
285
+ if (m === c) return h(7);
286
+ var g = (f = {}, f[a] = t, f[o] = n, f[i] = e, f)[m] || 1, _ = this.$d.getTime() + r * g;
287
+ return T.w(_, this);
288
+ }, _.subtract = function(e, t) {
289
+ return this.add(-1 * e, t);
290
+ }, _.format = function(e) {
291
+ var t = this, n = this.$locale();
292
+ if (!this.isValid()) return n.invalidDate || p;
293
+ var r = e || "YYYY-MM-DDTHH:mm:ssZ", i = T.z(this), a = this.$H, o = this.$m, s = this.$M, c = n.weekdays, l = n.months, u = n.meridiem, d = function(e, n, i, a) {
294
+ return e && (e[n] || e(t, r)) || i[n].slice(0, a);
295
+ }, f = function(e) {
296
+ return T.s(a % 12 || 12, e, "0");
297
+ }, m = u || function(e, t, n) {
298
+ var r = e < 12 ? "AM" : "PM";
299
+ return n ? r.toLowerCase() : r;
300
+ };
301
+ return r.replace(h, (function(e, r) {
302
+ return r || function(e) {
303
+ switch (e) {
304
+ case "YY": return String(t.$y).slice(-2);
305
+ case "YYYY": return T.s(t.$y, 4, "0");
306
+ case "M": return s + 1;
307
+ case "MM": return T.s(s + 1, 2, "0");
308
+ case "MMM": return d(n.monthsShort, s, l, 3);
309
+ case "MMMM": return d(l, s);
310
+ case "D": return t.$D;
311
+ case "DD": return T.s(t.$D, 2, "0");
312
+ case "d": return String(t.$W);
313
+ case "dd": return d(n.weekdaysMin, t.$W, c, 2);
314
+ case "ddd": return d(n.weekdaysShort, t.$W, c, 3);
315
+ case "dddd": return c[t.$W];
316
+ case "H": return String(a);
317
+ case "HH": return T.s(a, 2, "0");
318
+ case "h": return f(1);
319
+ case "hh": return f(2);
320
+ case "a": return m(a, o, !0);
321
+ case "A": return m(a, o, !1);
322
+ case "m": return String(o);
323
+ case "mm": return T.s(o, 2, "0");
324
+ case "s": return String(t.$s);
325
+ case "ss": return T.s(t.$s, 2, "0");
326
+ case "SSS": return T.s(t.$ms, 3, "0");
327
+ case "Z": return i;
328
+ }
329
+ return null;
330
+ }(e) || i.replace(":", "");
331
+ }));
332
+ }, _.utcOffset = function() {
333
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
334
+ }, _.diff = function(r, f, p) {
335
+ var m, h = this, g = T.p(f), _ = w(r), v = (_.utcOffset() - this.utcOffset()) * t, y = this - _, b = function() {
336
+ return T.m(h, _);
337
+ };
338
+ switch (g) {
339
+ case d:
340
+ m = b() / 12;
341
+ break;
342
+ case l:
343
+ m = b();
344
+ break;
345
+ case u:
346
+ m = b() / 3;
347
+ break;
348
+ case c:
349
+ m = (y - v) / 6048e5;
350
+ break;
351
+ case s:
352
+ m = (y - v) / 864e5;
353
+ break;
354
+ case o:
355
+ m = y / n;
356
+ break;
357
+ case a:
358
+ m = y / t;
359
+ break;
360
+ case i:
361
+ m = y / e;
362
+ break;
363
+ default: m = y;
364
+ }
365
+ return p ? m : T.a(m);
366
+ }, _.daysInMonth = function() {
367
+ return this.endOf(l).$D;
368
+ }, _.$locale = function() {
369
+ return b[this.$L];
370
+ }, _.locale = function(e, t) {
371
+ if (!e) return this.$L;
372
+ var n = this.clone(), r = C(e, t, !0);
373
+ return r && (n.$L = r), n;
374
+ }, _.clone = function() {
375
+ return T.w(this.$d, this);
376
+ }, _.toDate = function() {
377
+ return new Date(this.valueOf());
378
+ }, _.toJSON = function() {
379
+ return this.isValid() ? this.toISOString() : null;
380
+ }, _.toISOString = function() {
381
+ return this.$d.toISOString();
382
+ }, _.toString = function() {
383
+ return this.$d.toUTCString();
384
+ }, g;
385
+ }(), ee = E.prototype;
386
+ return w.prototype = ee, [
387
+ ["$ms", r],
388
+ ["$s", i],
389
+ ["$m", a],
390
+ ["$H", o],
391
+ ["$W", s],
392
+ ["$M", l],
393
+ ["$y", d],
394
+ ["$D", f]
395
+ ].forEach((function(e) {
396
+ ee[e[1]] = function(t) {
397
+ return this.$g(t, e[0], e[1]);
398
+ };
399
+ })), w.extend = function(e, t) {
400
+ return e.$i ||= (e(t, E, w), !0), w;
401
+ }, w.locale = C, w.isDayjs = S, w.unix = function(e) {
402
+ return w(1e3 * e);
403
+ }, w.en = b[y], w.Ls = b, w.p = {}, w;
404
+ }));
405
+ })), ee = /* @__PURE__ */ t(((e, t) => {
406
+ (function(n, r) {
407
+ typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs_plugin_isoWeek = r();
408
+ })(e, (function() {
409
+ return function(e, t, n) {
410
+ var r = function(e) {
411
+ return e.add(4 - e.isoWeekday(), "day");
412
+ }, i = t.prototype;
413
+ i.isoWeekYear = function() {
414
+ return r(this).year();
415
+ }, i.isoWeek = function(e) {
416
+ if (!this.$utils().u(e)) return this.add(7 * (e - this.isoWeek()), "day");
417
+ var t, i, a, o, s = r(this), c = (t = this.isoWeekYear(), i = this.$u, a = (i ? n.utc : n)().year(t).startOf("year"), o = 4 - a.isoWeekday(), a.isoWeekday() > 4 && (o += 7), a.add(o, "day"));
418
+ return s.diff(c, "week") + 1;
419
+ }, i.isoWeekday = function(e) {
420
+ return this.$utils().u(e) ? this.day() || 7 : this.day(this.day() % 7 ? e : e - 7);
421
+ };
422
+ var a = i.startOf;
423
+ i.startOf = function(e, t) {
424
+ var n = this.$utils(), r = !!n.u(t) || t;
425
+ return n.p(e) === "isoweek" ? r ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : a.bind(this)(e, t);
426
+ };
427
+ };
428
+ }));
429
+ })), te = /* @__PURE__ */ t(((e, t) => {
430
+ (function(n, r) {
431
+ typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs_plugin_weekOfYear = r();
432
+ })(e, (function() {
433
+ var e = "week", t = "year";
434
+ return function(n, r, i) {
435
+ var a = r.prototype;
436
+ a.week = function(n) {
437
+ if (n === void 0 && (n = null), n !== null) return this.add(7 * (n - this.week()), "day");
438
+ var r = this.$locale().yearStart || 1;
439
+ if (this.month() === 11 && this.date() > 25) {
440
+ var a = i(this).startOf(t).add(1, t).date(r), o = i(this).endOf(e);
441
+ if (a.isBefore(o)) return 1;
442
+ }
443
+ var s = i(this).startOf(t).date(r).startOf(e).subtract(1, "millisecond"), c = this.diff(s, e, !0);
444
+ return c < 0 ? i(this).startOf("week").week() : Math.ceil(c);
445
+ }, a.weeks = function(e) {
446
+ return e === void 0 && (e = null), this.week(e);
447
+ };
448
+ };
449
+ }));
450
+ })), ne = /* @__PURE__ */ t(((e, t) => {
451
+ (function(n, r) {
452
+ typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs_plugin_customParseFormat = r();
453
+ })(e, (function() {
454
+ var e = {
455
+ LTS: "h:mm:ss A",
456
+ LT: "h:mm A",
457
+ L: "MM/DD/YYYY",
458
+ LL: "MMMM D, YYYY",
459
+ LLL: "MMMM D, YYYY h:mm A",
460
+ LLLL: "dddd, MMMM D, YYYY h:mm A"
461
+ }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d/, r = /\d\d/, i = /\d\d?/, a = /\d*[^-_:/,()\s\d]+/, o = {}, s = function(e) {
462
+ return (e = +e) + (e > 68 ? 1900 : 2e3);
463
+ }, c = function(e) {
464
+ return function(t) {
465
+ this[e] = +t;
466
+ };
467
+ }, l = [/[+-]\d\d:?(\d\d)?|Z/, function(e) {
468
+ (this.zone ||= {}).offset = function(e) {
469
+ if (!e || e === "Z") return 0;
470
+ var t = e.match(/([+-]|\d\d)/g), n = 60 * t[1] + (+t[2] || 0);
471
+ return n === 0 ? 0 : t[0] === "+" ? -n : n;
472
+ }(e);
473
+ }], u = function(e) {
474
+ var t = o[e];
475
+ return t && (t.indexOf ? t : t.s.concat(t.f));
476
+ }, d = function(e, t) {
477
+ var n, r = o.meridiem;
478
+ if (r) {
479
+ for (var i = 1; i <= 24; i += 1) if (e.indexOf(r(i, 0, t)) > -1) {
480
+ n = i > 12;
481
+ break;
482
+ }
483
+ } else n = e === (t ? "pm" : "PM");
484
+ return n;
485
+ }, f = {
486
+ A: [a, function(e) {
487
+ this.afternoon = d(e, !1);
488
+ }],
489
+ a: [a, function(e) {
490
+ this.afternoon = d(e, !0);
491
+ }],
492
+ Q: [n, function(e) {
493
+ this.month = 3 * (e - 1) + 1;
494
+ }],
495
+ S: [n, function(e) {
496
+ this.milliseconds = 100 * e;
497
+ }],
498
+ SS: [r, function(e) {
499
+ this.milliseconds = 10 * e;
500
+ }],
501
+ SSS: [/\d{3}/, function(e) {
502
+ this.milliseconds = +e;
503
+ }],
504
+ s: [i, c("seconds")],
505
+ ss: [i, c("seconds")],
506
+ m: [i, c("minutes")],
507
+ mm: [i, c("minutes")],
508
+ H: [i, c("hours")],
509
+ h: [i, c("hours")],
510
+ HH: [i, c("hours")],
511
+ hh: [i, c("hours")],
512
+ D: [i, c("day")],
513
+ DD: [r, c("day")],
514
+ Do: [a, function(e) {
515
+ var t = o.ordinal, n = e.match(/\d+/);
516
+ if (this.day = n[0], t) for (var r = 1; r <= 31; r += 1) t(r).replace(/\[|\]/g, "") === e && (this.day = r);
517
+ }],
518
+ w: [i, c("week")],
519
+ ww: [r, c("week")],
520
+ M: [i, c("month")],
521
+ MM: [r, c("month")],
522
+ MMM: [a, function(e) {
523
+ var t = u("months"), n = (u("monthsShort") || t.map((function(e) {
524
+ return e.slice(0, 3);
525
+ }))).indexOf(e) + 1;
526
+ if (n < 1) throw Error();
527
+ this.month = n % 12 || n;
528
+ }],
529
+ MMMM: [a, function(e) {
530
+ var t = u("months").indexOf(e) + 1;
531
+ if (t < 1) throw Error();
532
+ this.month = t % 12 || t;
533
+ }],
534
+ Y: [/[+-]?\d+/, c("year")],
535
+ YY: [r, function(e) {
536
+ this.year = s(e);
537
+ }],
538
+ YYYY: [/\d{4}/, c("year")],
539
+ Z: l,
540
+ ZZ: l
541
+ };
542
+ function p(n) {
543
+ for (var r = n, i = o && o.formats, a = (n = r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(t, n, r) {
544
+ var a = r && r.toUpperCase();
545
+ return n || i[r] || e[r] || i[a].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(e, t, n) {
546
+ return t || n.slice(1);
547
+ }));
548
+ }))).match(t), s = a.length, c = 0; c < s; c += 1) {
549
+ var l = a[c], u = f[l], d = u && u[0], p = u && u[1];
550
+ a[c] = p ? {
551
+ regex: d,
552
+ parser: p
553
+ } : l.replace(/^\[|\]$/g, "");
554
+ }
555
+ return function(e) {
556
+ for (var t = {}, n = 0, r = 0; n < s; n += 1) {
557
+ var i = a[n];
558
+ if (typeof i == "string") r += i.length;
559
+ else {
560
+ var o = i.regex, c = i.parser, l = e.slice(r), u = o.exec(l)[0];
561
+ c.call(t, u), e = e.replace(u, "");
562
+ }
563
+ }
564
+ return function(e) {
565
+ var t = e.afternoon;
566
+ if (t !== void 0) {
567
+ var n = e.hours;
568
+ t ? n < 12 && (e.hours += 12) : n === 12 && (e.hours = 0), delete e.afternoon;
569
+ }
570
+ }(t), t;
571
+ };
572
+ }
573
+ return function(e, t, n) {
574
+ n.p.customParseFormat = !0, e && e.parseTwoDigitYear && (s = e.parseTwoDigitYear);
575
+ var r = t.prototype, i = r.parse;
576
+ r.parse = function(e) {
577
+ var t = e.date, r = e.utc, a = e.args;
578
+ this.$u = r;
579
+ var s = a[1];
580
+ if (typeof s == "string") {
581
+ var c = !0 === a[2], l = !0 === a[3], u = c || l, d = a[2];
582
+ l && (d = a[2]), o = this.$locale(), !c && d && (o = n.Ls[d]), this.$d = function(e, t, n, r) {
583
+ try {
584
+ if (["x", "X"].indexOf(t) > -1) return /* @__PURE__ */ new Date((t === "X" ? 1e3 : 1) * e);
585
+ var i = p(t)(e), a = i.year, o = i.month, s = i.day, c = i.hours, l = i.minutes, u = i.seconds, d = i.milliseconds, f = i.zone, m = i.week, h = /* @__PURE__ */ new Date(), g = s || (a || o ? 1 : h.getDate()), _ = a || h.getFullYear(), v = 0;
586
+ a && !o || (v = o > 0 ? o - 1 : h.getMonth());
587
+ var y, b = c || 0, x = l || 0, S = u || 0, C = d || 0;
588
+ return f ? new Date(Date.UTC(_, v, g, b, x, S, C + 60 * f.offset * 1e3)) : n ? new Date(Date.UTC(_, v, g, b, x, S, C)) : (y = new Date(_, v, g, b, x, S, C), m && (y = r(y).week(m).toDate()), y);
589
+ } catch {
590
+ return /* @__PURE__ */ new Date("");
591
+ }
592
+ }(t, s, r, n), this.init(), d && !0 !== d && (this.$L = this.locale(d).$L), u && t != this.format(s) && (this.$d = /* @__PURE__ */ new Date("")), o = {};
593
+ } else if (s instanceof Array) for (var f = s.length, m = 1; m <= f; m += 1) {
594
+ a[1] = s[m - 1];
595
+ var h = n.apply(this, a);
596
+ if (h.isValid()) {
597
+ this.$d = h.$d, this.$L = h.$L, this.init();
598
+ break;
599
+ }
600
+ m === f && (this.$d = /* @__PURE__ */ new Date(""));
601
+ }
602
+ else i.call(this, e);
603
+ };
604
+ };
605
+ }));
606
+ })), re = /* @__PURE__ */ t(((e, t) => {
607
+ (function(n, r) {
608
+ typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs_plugin_advancedFormat = r();
609
+ })(e, (function() {
610
+ return function(e, t) {
611
+ var n = t.prototype, r = n.format;
612
+ n.format = function(e) {
613
+ var t = this, n = this.$locale();
614
+ if (!this.isValid()) return r.bind(this)(e);
615
+ var i = this.$utils(), a = (e || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, (function(e) {
616
+ switch (e) {
617
+ case "Q": return Math.ceil((t.$M + 1) / 3);
618
+ case "Do": return n.ordinal(t.$D);
619
+ case "gggg": return t.weekYear();
620
+ case "GGGG": return t.isoWeekYear();
621
+ case "wo": return n.ordinal(t.week(), "W");
622
+ case "w":
623
+ case "ww": return i.s(t.week(), e === "w" ? 1 : 2, "0");
624
+ case "W":
625
+ case "WW": return i.s(t.isoWeek(), e === "W" ? 1 : 2, "0");
626
+ case "k":
627
+ case "kk": return i.s(String(t.$H === 0 ? 24 : t.$H), e === "k" ? 1 : 2, "0");
628
+ case "X": return Math.floor(t.$d.getTime() / 1e3);
629
+ case "x": return t.$d.getTime();
630
+ case "z": return "[" + t.offsetName() + "]";
631
+ case "zzz": return "[" + t.offsetName("long") + "]";
632
+ default: return e;
633
+ }
634
+ }));
635
+ return r.bind(this)(a);
636
+ };
637
+ };
638
+ }));
639
+ })), ie = /* @__PURE__ */ t(((e, t) => {
640
+ (function(n, r) {
641
+ typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs_plugin_duration = r();
642
+ })(e, (function() {
643
+ var e, t, n = 1e3, r = 6e4, i = 36e5, a = 864e5, o = 31536e6, s = 2628e6, c = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, l = /\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g, u = {
644
+ years: o,
645
+ months: s,
646
+ days: a,
647
+ hours: i,
648
+ minutes: r,
649
+ seconds: n,
650
+ milliseconds: 1,
651
+ weeks: 6048e5
652
+ }, d = function(e) {
653
+ return e instanceof v;
654
+ }, f = function(e, t, n) {
655
+ return new v(e, n, t.$l);
656
+ }, p = function(e) {
657
+ return t.p(e) + "s";
658
+ }, m = function(e) {
659
+ return e < 0;
660
+ }, h = function(e) {
661
+ return m(e) ? Math.ceil(e) : Math.floor(e);
662
+ }, g = function(e) {
663
+ return Math.abs(e);
664
+ }, _ = function(e, t) {
665
+ return e ? m(e) ? {
666
+ negative: !0,
667
+ format: "" + g(e) + t
668
+ } : {
669
+ negative: !1,
670
+ format: "" + e + t
671
+ } : {
672
+ negative: !1,
673
+ format: ""
674
+ };
675
+ }, v = function() {
676
+ function m(e, t, n) {
677
+ var r = this;
678
+ if (this.$d = {}, this.$l = n, e === void 0 && (this.$ms = 0, this.parseFromMilliseconds()), t) return f(e * u[p(t)], this);
679
+ if (typeof e == "number") return this.$ms = e, this.parseFromMilliseconds(), this;
680
+ if (typeof e == "object") return Object.keys(e).forEach((function(t) {
681
+ r.$d[p(t)] = e[t];
682
+ })), this.calMilliseconds(), this;
683
+ if (typeof e == "string") {
684
+ var i = e.match(c);
685
+ if (i) {
686
+ var a = i.slice(2).map((function(e) {
687
+ return e == null ? 0 : Number(e);
688
+ }));
689
+ return this.$d.years = a[0], this.$d.months = a[1], this.$d.weeks = a[2], this.$d.days = a[3], this.$d.hours = a[4], this.$d.minutes = a[5], this.$d.seconds = a[6], this.calMilliseconds(), this;
690
+ }
691
+ }
692
+ return this;
693
+ }
694
+ var g = m.prototype;
695
+ return g.calMilliseconds = function() {
696
+ var e = this;
697
+ this.$ms = Object.keys(this.$d).reduce((function(t, n) {
698
+ return t + (e.$d[n] || 0) * u[n];
699
+ }), 0);
700
+ }, g.parseFromMilliseconds = function() {
701
+ var e = this.$ms;
702
+ this.$d.years = h(e / o), e %= o, this.$d.months = h(e / s), e %= s, this.$d.days = h(e / a), e %= a, this.$d.hours = h(e / i), e %= i, this.$d.minutes = h(e / r), e %= r, this.$d.seconds = h(e / n), e %= n, this.$d.milliseconds = e;
703
+ }, g.toISOString = function() {
704
+ var e = _(this.$d.years, "Y"), t = _(this.$d.months, "M"), n = +this.$d.days || 0;
705
+ this.$d.weeks && (n += 7 * this.$d.weeks);
706
+ var r = _(n, "D"), i = _(this.$d.hours, "H"), a = _(this.$d.minutes, "M"), o = this.$d.seconds || 0;
707
+ this.$d.milliseconds && (o += this.$d.milliseconds / 1e3, o = Math.round(1e3 * o) / 1e3);
708
+ var s = _(o, "S"), c = e.negative || t.negative || r.negative || i.negative || a.negative || s.negative, l = i.format || a.format || s.format ? "T" : "", u = (c ? "-" : "") + "P" + e.format + t.format + r.format + l + i.format + a.format + s.format;
709
+ return u === "P" || u === "-P" ? "P0D" : u;
710
+ }, g.toJSON = function() {
711
+ return this.toISOString();
712
+ }, g.format = function(e) {
713
+ var n = e || "YYYY-MM-DDTHH:mm:ss", r = {
714
+ Y: this.$d.years,
715
+ YY: t.s(this.$d.years, 2, "0"),
716
+ YYYY: t.s(this.$d.years, 4, "0"),
717
+ M: this.$d.months,
718
+ MM: t.s(this.$d.months, 2, "0"),
719
+ D: this.$d.days,
720
+ DD: t.s(this.$d.days, 2, "0"),
721
+ H: this.$d.hours,
722
+ HH: t.s(this.$d.hours, 2, "0"),
723
+ m: this.$d.minutes,
724
+ mm: t.s(this.$d.minutes, 2, "0"),
725
+ s: this.$d.seconds,
726
+ ss: t.s(this.$d.seconds, 2, "0"),
727
+ SSS: t.s(this.$d.milliseconds, 3, "0")
728
+ };
729
+ return n.replace(l, (function(e, t) {
730
+ return t || String(r[e]);
731
+ }));
732
+ }, g.as = function(e) {
733
+ return this.$ms / u[p(e)];
734
+ }, g.get = function(e) {
735
+ var t = this.$ms, n = p(e);
736
+ return n === "milliseconds" ? t %= 1e3 : t = n === "weeks" ? h(t / u[n]) : this.$d[n], t || 0;
737
+ }, g.add = function(e, t, n) {
738
+ var r = t ? e * u[p(t)] : d(e) ? e.$ms : f(e, this).$ms;
739
+ return f(this.$ms + r * (n ? -1 : 1), this);
740
+ }, g.subtract = function(e, t) {
741
+ return this.add(e, t, !0);
742
+ }, g.locale = function(e) {
743
+ var t = this.clone();
744
+ return t.$l = e, t;
745
+ }, g.clone = function() {
746
+ return f(this.$ms, this);
747
+ }, g.humanize = function(t) {
748
+ return e().add(this.$ms, "ms").locale(this.$l).fromNow(!t);
749
+ }, g.valueOf = function() {
750
+ return this.asMilliseconds();
751
+ }, g.milliseconds = function() {
752
+ return this.get("milliseconds");
753
+ }, g.asMilliseconds = function() {
754
+ return this.as("milliseconds");
755
+ }, g.seconds = function() {
756
+ return this.get("seconds");
757
+ }, g.asSeconds = function() {
758
+ return this.as("seconds");
759
+ }, g.minutes = function() {
760
+ return this.get("minutes");
761
+ }, g.asMinutes = function() {
762
+ return this.as("minutes");
763
+ }, g.hours = function() {
764
+ return this.get("hours");
765
+ }, g.asHours = function() {
766
+ return this.as("hours");
767
+ }, g.days = function() {
768
+ return this.get("days");
769
+ }, g.asDays = function() {
770
+ return this.as("days");
771
+ }, g.weeks = function() {
772
+ return this.get("weeks");
773
+ }, g.asWeeks = function() {
774
+ return this.as("weeks");
775
+ }, g.months = function() {
776
+ return this.get("months");
777
+ }, g.asMonths = function() {
778
+ return this.as("months");
779
+ }, g.years = function() {
780
+ return this.get("years");
781
+ }, g.asYears = function() {
782
+ return this.as("years");
783
+ }, m;
784
+ }(), y = function(e, t, n) {
785
+ return e.add(t.years() * n, "y").add(t.months() * n, "M").add(t.days() * n, "d").add(t.hours() * n, "h").add(t.minutes() * n, "m").add(t.seconds() * n, "s").add(t.milliseconds() * n, "ms");
786
+ };
787
+ return function(n, r, i) {
788
+ e = i, t = i().$utils(), i.duration = function(e, t) {
789
+ return f(e, { $l: i.locale() }, t);
790
+ }, i.isDuration = d;
791
+ var a = r.prototype.add, o = r.prototype.subtract;
792
+ r.prototype.add = function(e, t) {
793
+ return d(e) ? y(this, e, 1) : a.bind(this)(e, t);
794
+ }, r.prototype.subtract = function(e, t) {
795
+ return d(e) ? y(this, e, -1) : o.bind(this)(e, t);
796
+ };
797
+ };
798
+ }));
799
+ })), D = /* @__PURE__ */ e(E(), 1), ae = /* @__PURE__ */ e(ee(), 1), oe = /* @__PURE__ */ e(te(), 1), se = /* @__PURE__ */ e(ne(), 1), ce = /* @__PURE__ */ e(re(), 1), le = /* @__PURE__ */ e(ie(), 1), O = class extends Error {
800
+ constructor(e, t = "RENDER_ERROR", n, r) {
801
+ super(e), this.code = t, this.line = n, this.column = r, this.name = "TemplateRuntimeError";
802
+ }
803
+ code;
804
+ line;
805
+ column;
806
+ }, ue = class extends Error {
807
+ constructor(e) {
808
+ super(e.map((e) => e.message).join("; ") || "Template rendering failed"), this.errors = e, this.name = "TemplateRenderError";
809
+ }
810
+ errors;
811
+ }, de = Object.freeze({
812
+ maxTemplateLength: 1e6,
813
+ maxOutputLength: 5e6,
814
+ maxValueLength: 5e6,
815
+ maxOperations: 1e5,
816
+ maxDepth: 100
817
+ });
818
+ function fe(e = {}) {
819
+ let t = {
820
+ ...de,
821
+ ...e
822
+ };
823
+ for (let [e, n] of Object.entries(t)) if (!Number.isSafeInteger(n) || n < 1 || e === "maxDepth" && n > 256) throw new O(`Invalid ${e} limit`, "LIMIT_EXCEEDED");
824
+ return t;
825
+ }
826
+ function k(e) {
827
+ throw new O(`Template exceeded ${e}`, "LIMIT_EXCEEDED");
828
+ }
829
+ var pe = class {
830
+ limits;
831
+ operations = 0;
832
+ constructor(e = {}) {
833
+ this.limits = fe(e);
834
+ }
835
+ step() {
836
+ ++this.operations > this.limits.maxOperations && k("maxOperations");
837
+ }
838
+ output(e) {
839
+ e > this.limits.maxOutputLength && k("maxOutputLength");
840
+ }
841
+ length(e) {
842
+ e > this.limits.maxValueLength && k("maxValueLength");
843
+ }
844
+ value(e) {
845
+ let t = [{
846
+ value: e,
847
+ depth: 0
848
+ }], n = 0, r = 0;
849
+ for (; t.length;) {
850
+ this.step();
851
+ let { value: e, depth: i } = t.pop();
852
+ if (++r > this.limits.maxOperations && k("maxOperations"), i > this.limits.maxDepth && k("maxDepth"), typeof e == "string") n += e.length;
853
+ else if (typeof e == "object" && e) for (let a of Object.keys(e)) {
854
+ n += a.length + 4, t.length + r >= this.limits.maxOperations && k("maxOperations");
855
+ let o = Object.getOwnPropertyDescriptor(e, a);
856
+ "value" in o && t.push({
857
+ value: o.value,
858
+ depth: i + 1
859
+ });
860
+ }
861
+ else n += 8;
862
+ n > this.limits.maxValueLength && k("maxValueLength");
863
+ }
864
+ }
865
+ }, me = {
866
+ if: "keyword_if",
867
+ elseif: "keyword_elseif",
868
+ else: "keyword_else",
869
+ endif: "keyword_endif",
870
+ for: "keyword_for",
871
+ in: "keyword_in",
872
+ endfor: "keyword_endfor",
873
+ set: "keyword_set",
874
+ and: "op_and",
875
+ or: "op_or",
876
+ not: "op_not",
877
+ contains: "op_contains",
878
+ true: "boolean",
879
+ false: "boolean",
880
+ null: "null"
881
+ }, he = 123, ge = 37, _e = 35;
882
+ function ve(e) {
883
+ let t = {
884
+ input: e,
885
+ pos: 0,
886
+ line: 1,
887
+ column: 1,
888
+ mode: "text",
889
+ tokens: [],
890
+ errors: []
891
+ };
892
+ for (; t.pos < t.input.length;) switch (t.mode) {
893
+ case "text":
894
+ ye(t);
895
+ break;
896
+ case "variable":
897
+ be(t);
898
+ break;
899
+ case "tag": xe(t);
900
+ }
901
+ return t.tokens.push({
902
+ type: "eof",
903
+ value: "",
904
+ line: t.line,
905
+ column: t.column
906
+ }), {
907
+ tokens: t.tokens,
908
+ errors: t.errors
909
+ };
910
+ }
911
+ function ye(e) {
912
+ let t = e.pos, n = e.line, r = e.column, i = e.input;
913
+ for (; e.pos < i.length;) {
914
+ let a = i.indexOf("{", e.pos);
915
+ if (a === -1) break;
916
+ let o = i.charCodeAt(a + 1), s = o === he, c = o === ge, l = o === _e;
917
+ if (!s && !c && !l) Oe(e, a + 1);
918
+ else {
919
+ if (Oe(e, a), e.pos > t && e.tokens.push({
920
+ type: "text",
921
+ value: i.slice(t, e.pos),
922
+ line: n,
923
+ column: r
924
+ }), l) {
925
+ let t = i.indexOf("#}", e.pos + 2);
926
+ t === -1 && e.errors.push({
927
+ message: "Unclosed comment - missing '#}'",
928
+ line: e.line,
929
+ column: e.column
930
+ }), Oe(e, t === -1 ? i.length : t + 2);
931
+ return;
932
+ }
933
+ j(e, 2), e.tokens.push({
934
+ type: s ? "variable_start" : "tag_start",
935
+ value: s ? "{{" : "{%",
936
+ line: e.line,
937
+ column: e.column - 2,
938
+ trimLeft: !1
939
+ }), e.mode = s ? "variable" : "tag";
940
+ return;
941
+ }
942
+ }
943
+ Oe(e, i.length), e.pos > t && e.tokens.push({
944
+ type: "text",
945
+ value: e.input.slice(t, e.pos),
946
+ line: n,
947
+ column: r
948
+ });
949
+ }
950
+ function be(e) {
951
+ if (ke(e), A(e, "}}")) {
952
+ e.tokens.push({
953
+ type: "variable_end",
954
+ value: "}}",
955
+ line: e.line,
956
+ column: e.column,
957
+ trimRight: !1
958
+ }), j(e, 2), e.mode = "text";
959
+ return;
960
+ }
961
+ let t = e.input[e.pos + 1];
962
+ if (e.input[e.pos] === "}" && t !== "}" && ![
963
+ "|",
964
+ ",",
965
+ ")",
966
+ "]",
967
+ " ",
968
+ " ",
969
+ "\n",
970
+ "\r"
971
+ ].includes(t)) e.errors.push({
972
+ message: "Malformed variable: expected '}}' but found '}'. Did you forget a '}'?",
973
+ line: e.line,
974
+ column: e.column
975
+ }), e.tokens.push({
976
+ type: "variable_end",
977
+ value: "}",
978
+ line: e.line,
979
+ column: e.column,
980
+ trimRight: !1
981
+ }), M(e), e.mode = "text";
982
+ else if (A(e, "{%") || A(e, "{{")) {
983
+ let t = [...e.tokens].reverse().findIndex((e) => e.type === "variable_start"), n = t >= 0 ? e.tokens.length - 1 - t : -1, r = n >= 0 ? e.tokens[n] : null;
984
+ e.errors.push({
985
+ message: "Missing closing '}}' for variable",
986
+ line: r?.line || e.line,
987
+ column: r?.column || e.column
988
+ }), n >= 0 && e.tokens.splice(n), e.mode = "text";
989
+ } else Se(e, "variable");
990
+ }
991
+ function xe(e) {
992
+ if (ke(e), A(e, "%}")) e.tokens.push({
993
+ type: "tag_end",
994
+ value: "%}",
995
+ line: e.line,
996
+ column: e.column,
997
+ trimRight: !0
998
+ }), j(e, 2), e.mode = "text";
999
+ else if (A(e, "-%}")) e.tokens.push({
1000
+ type: "tag_end",
1001
+ value: "-%}",
1002
+ line: e.line,
1003
+ column: e.column,
1004
+ trimRight: !0
1005
+ }), j(e, 3), e.mode = "text";
1006
+ else if (e.input[e.pos] === "}" && e.pos > 0 && e.input[e.pos - 1] !== "%") e.errors.push({
1007
+ message: "Malformed tag: expected '%}' but found '}'. Did you forget the '%'?",
1008
+ line: e.line,
1009
+ column: e.column
1010
+ }), e.tokens.push({
1011
+ type: "tag_end",
1012
+ value: "}",
1013
+ line: e.line,
1014
+ column: e.column,
1015
+ trimRight: !0
1016
+ }), M(e), e.mode = "text";
1017
+ else if (A(e, "{%") || A(e, "{{")) {
1018
+ let t = [...e.tokens].reverse().findIndex((e) => e.type === "tag_start"), n = t >= 0 ? e.tokens.length - 1 - t : -1, r = n >= 0 ? e.tokens[n] : null;
1019
+ e.errors.push({
1020
+ message: "Missing closing '%}' for tag",
1021
+ line: r?.line || e.line,
1022
+ column: r?.column || e.column
1023
+ }), n >= 0 && e.tokens.splice(n), e.mode = "text";
1024
+ } else Se(e, "tag");
1025
+ }
1026
+ function Se(e, t) {
1027
+ if (ke(e), e.pos >= e.input.length) {
1028
+ e.errors.push({
1029
+ message: t === "variable" ? "Unclosed variable - missing '}}'" : "Unclosed tag - missing '%}'",
1030
+ line: e.line,
1031
+ column: e.column
1032
+ });
1033
+ return;
1034
+ }
1035
+ let n = e.input[e.pos], r = e.line, i = e.column;
1036
+ if (n === "\"" || n === "'") Ce(e);
1037
+ else if (N(n) || n === "-" && N(e.input[e.pos + 1])) Te(e);
1038
+ else if (A(e, "==")) e.tokens.push({
1039
+ type: "op_eq",
1040
+ value: "==",
1041
+ line: r,
1042
+ column: i
1043
+ }), j(e, 2);
1044
+ else if (A(e, "!=")) e.tokens.push({
1045
+ type: "op_neq",
1046
+ value: "!=",
1047
+ line: r,
1048
+ column: i
1049
+ }), j(e, 2);
1050
+ else if (A(e, ">=")) e.tokens.push({
1051
+ type: "op_gte",
1052
+ value: ">=",
1053
+ line: r,
1054
+ column: i
1055
+ }), j(e, 2);
1056
+ else if (A(e, "<=")) e.tokens.push({
1057
+ type: "op_lte",
1058
+ value: "<=",
1059
+ line: r,
1060
+ column: i
1061
+ }), j(e, 2);
1062
+ else if (A(e, "&&")) e.tokens.push({
1063
+ type: "op_and",
1064
+ value: "&&",
1065
+ line: r,
1066
+ column: i
1067
+ }), j(e, 2);
1068
+ else if (A(e, "||")) e.tokens.push({
1069
+ type: "op_or",
1070
+ value: "||",
1071
+ line: r,
1072
+ column: i
1073
+ }), j(e, 2);
1074
+ else if (A(e, "??")) e.tokens.push({
1075
+ type: "op_nullish",
1076
+ value: "??",
1077
+ line: r,
1078
+ column: i
1079
+ }), j(e, 2);
1080
+ else if (A(e, "=>")) e.tokens.push({
1081
+ type: "arrow",
1082
+ value: "=>",
1083
+ line: r,
1084
+ column: i
1085
+ }), j(e, 2);
1086
+ else {
1087
+ switch (n) {
1088
+ case ">":
1089
+ e.tokens.push({
1090
+ type: "op_gt",
1091
+ value: ">",
1092
+ line: r,
1093
+ column: i
1094
+ }), M(e);
1095
+ return;
1096
+ case "<":
1097
+ e.tokens.push({
1098
+ type: "op_lt",
1099
+ value: "<",
1100
+ line: r,
1101
+ column: i
1102
+ }), M(e);
1103
+ return;
1104
+ case "!":
1105
+ e.tokens.push({
1106
+ type: "op_not",
1107
+ value: "!",
1108
+ line: r,
1109
+ column: i
1110
+ }), M(e);
1111
+ return;
1112
+ case "=":
1113
+ e.tokens.push({
1114
+ type: "op_assign",
1115
+ value: "=",
1116
+ line: r,
1117
+ column: i
1118
+ }), M(e);
1119
+ return;
1120
+ case "|":
1121
+ e.tokens.push({
1122
+ type: "pipe",
1123
+ value: "|",
1124
+ line: r,
1125
+ column: i
1126
+ }), M(e);
1127
+ return;
1128
+ case "(":
1129
+ e.tokens.push({
1130
+ type: "lparen",
1131
+ value: "(",
1132
+ line: r,
1133
+ column: i
1134
+ }), M(e);
1135
+ return;
1136
+ case ")":
1137
+ e.tokens.push({
1138
+ type: "rparen",
1139
+ value: ")",
1140
+ line: r,
1141
+ column: i
1142
+ }), M(e);
1143
+ return;
1144
+ case "[":
1145
+ e.tokens.push({
1146
+ type: "lbracket",
1147
+ value: "[",
1148
+ line: r,
1149
+ column: i
1150
+ }), M(e);
1151
+ return;
1152
+ case "]":
1153
+ e.tokens.push({
1154
+ type: "rbracket",
1155
+ value: "]",
1156
+ line: r,
1157
+ column: i
1158
+ }), M(e);
1159
+ return;
1160
+ case ":":
1161
+ e.tokens.push({
1162
+ type: "colon",
1163
+ value: ":",
1164
+ line: r,
1165
+ column: i
1166
+ }), M(e);
1167
+ return;
1168
+ case ",":
1169
+ e.tokens.push({
1170
+ type: "comma",
1171
+ value: ",",
1172
+ line: r,
1173
+ column: i
1174
+ }), M(e);
1175
+ return;
1176
+ case ".":
1177
+ e.tokens.push({
1178
+ type: "dot",
1179
+ value: ".",
1180
+ line: r,
1181
+ column: i
1182
+ }), M(e);
1183
+ return;
1184
+ case "*":
1185
+ e.tokens.push({
1186
+ type: "star",
1187
+ value: "*",
1188
+ line: r,
1189
+ column: i
1190
+ }), M(e);
1191
+ return;
1192
+ case "/":
1193
+ e.tokens.push({
1194
+ type: "slash",
1195
+ value: "/",
1196
+ line: r,
1197
+ column: i
1198
+ }), M(e);
1199
+ return;
1200
+ case "+":
1201
+ e.tokens.push({
1202
+ type: "plus",
1203
+ value: "+",
1204
+ line: r,
1205
+ column: i
1206
+ }), M(e);
1207
+ return;
1208
+ case "{":
1209
+ e.tokens.push({
1210
+ type: "lbrace",
1211
+ value: "{",
1212
+ line: r,
1213
+ column: i
1214
+ }), M(e);
1215
+ return;
1216
+ case "}":
1217
+ e.tokens.push({
1218
+ type: "rbrace",
1219
+ value: "}",
1220
+ line: r,
1221
+ column: i
1222
+ }), M(e);
1223
+ return;
1224
+ case "$":
1225
+ e.tokens.push({
1226
+ type: "dollar",
1227
+ value: "$",
1228
+ line: r,
1229
+ column: i
1230
+ }), M(e);
1231
+ return;
1232
+ }
1233
+ je(n) ? Ee(e) : n === "\\" ? we(e) : (e.errors.push({
1234
+ message: `Unexpected character '${n}' in template`,
1235
+ line: e.line,
1236
+ column: e.column
1237
+ }), M(e));
1238
+ }
1239
+ }
1240
+ function Ce(e) {
1241
+ let t = e.input[e.pos], n = e.line, r = e.column, i = "", a = "";
1242
+ for (M(e); e.pos < e.input.length;) {
1243
+ let o = e.input[e.pos], s = e.input[e.pos + 1] || "";
1244
+ if (o === t) {
1245
+ M(e), u(a) && (i = a.replace(/\\([\\"'])/g, "$1")), e.tokens.push({
1246
+ type: "string",
1247
+ value: i,
1248
+ line: n,
1249
+ column: r
1250
+ });
1251
+ return;
1252
+ }
1253
+ if (o === "}" && s === "}" || o === "%" && s === "}") {
1254
+ e.errors.push({
1255
+ message: `Unclosed string - missing ${t} before ${o}${s}`,
1256
+ line: n,
1257
+ column: r
1258
+ }), e.tokens.push({
1259
+ type: "string",
1260
+ value: i,
1261
+ line: n,
1262
+ column: r
1263
+ });
1264
+ return;
1265
+ }
1266
+ if (o === "\\" && e.pos + 1 < e.input.length) {
1267
+ M(e);
1268
+ let t = e.input[e.pos];
1269
+ a += "\\" + t, i += p(t), M(e);
1270
+ } else i += o, a += o, M(e);
1271
+ }
1272
+ e.errors.push({
1273
+ message: `Unclosed string - missing closing ${t}`,
1274
+ line: n,
1275
+ column: r
1276
+ }), e.tokens.push({
1277
+ type: "string",
1278
+ value: i,
1279
+ line: n,
1280
+ column: r
1281
+ });
1282
+ }
1283
+ function we(e) {
1284
+ let t = e.line, n = e.column, r = "";
1285
+ for (; e.pos < e.input.length;) {
1286
+ let t = e.input[e.pos], n = e.input[e.pos + 1] || "";
1287
+ if (t === "|" || t === "%" || t === "}" || t === ")" || t === "+" && (n === "%" || n === "}")) break;
1288
+ if (t === "\\" && e.pos + 1 < e.input.length) {
1289
+ let t = e.input[e.pos + 1];
1290
+ switch (t) {
1291
+ case "\"":
1292
+ r += "\"";
1293
+ break;
1294
+ case "'":
1295
+ r += "'";
1296
+ break;
1297
+ case "\\":
1298
+ r += "\\";
1299
+ break;
1300
+ case "n":
1301
+ r += "\n";
1302
+ break;
1303
+ case "t":
1304
+ r += " ";
1305
+ break;
1306
+ case "r":
1307
+ r += "\r";
1308
+ break;
1309
+ case ",":
1310
+ r += ",";
1311
+ break;
1312
+ case "|":
1313
+ r += "|";
1314
+ break;
1315
+ default: r += t;
1316
+ }
1317
+ M(e), M(e);
1318
+ } else r += t, M(e);
1319
+ }
1320
+ e.tokens.push({
1321
+ type: "string",
1322
+ value: r,
1323
+ line: t,
1324
+ column: n
1325
+ });
1326
+ }
1327
+ function Te(e) {
1328
+ let t = e.line, n = e.column, r = "";
1329
+ for (e.input[e.pos] === "-" && (r += "-", M(e)); e.pos < e.input.length && N(e.input[e.pos]);) r += e.input[e.pos], M(e);
1330
+ if (e.pos < e.input.length && e.input[e.pos] === ".") for (r += ".", M(e); e.pos < e.input.length && N(e.input[e.pos]);) r += e.input[e.pos], M(e);
1331
+ e.tokens.push({
1332
+ type: "number",
1333
+ value: r,
1334
+ line: t,
1335
+ column: n
1336
+ });
1337
+ }
1338
+ function Ee(e) {
1339
+ let t = e.line, n = e.column, r = "";
1340
+ for (; e.pos < e.input.length && Me(e.input[e.pos]);) r += e.input[e.pos], M(e);
1341
+ (r === "selector" || r === "selectorHtml") && e.pos < e.input.length && e.input[e.pos] === ":" && (r += ":", M(e), r = De(e, r));
1342
+ let i = r.toLowerCase(), a = Object.prototype.hasOwnProperty.call(me, i) ? me[i] : void 0;
1343
+ e.tokens.push(a ? {
1344
+ type: a,
1345
+ value: r,
1346
+ line: t,
1347
+ column: n
1348
+ } : {
1349
+ type: "identifier",
1350
+ value: r,
1351
+ line: t,
1352
+ column: n
1353
+ });
1354
+ }
1355
+ function De(e, t) {
1356
+ let n = 0, r = 0, i = null;
1357
+ for (; e.pos < e.input.length;) {
1358
+ let a = e.input[e.pos], o = e.input[e.pos + 1] || "";
1359
+ if (!i && n === 0 && r === 0 && (a === "|" || a === "%" && o === "}" || a === "}" && o === "}" || a === "-" && o === "%" || a === "-" && o === "}" || a === "}" && o !== "}")) break;
1360
+ if (a === "}" && o === "}" || a === "%" && o === "}") {
1361
+ if (i) {
1362
+ e.errors.push({
1363
+ message: `Unclosed string in selector - missing closing ${i}`,
1364
+ line: e.line,
1365
+ column: e.column
1366
+ });
1367
+ break;
1368
+ }
1369
+ if (n > 0) {
1370
+ e.errors.push({
1371
+ message: "Unclosed '[' in selector - missing ']'",
1372
+ line: e.line,
1373
+ column: e.column
1374
+ });
1375
+ break;
1376
+ }
1377
+ if (r > 0) {
1378
+ e.errors.push({
1379
+ message: "Unclosed '(' in selector - missing ')'",
1380
+ line: e.line,
1381
+ column: e.column
1382
+ });
1383
+ break;
1384
+ }
1385
+ }
1386
+ !i && a === "\\" && (o === "\"" || o === "'") ? (t += a, M(e), t += e.input[e.pos], M(e)) : !i && (a === "\"" || a === "'") ? (i = a, t += a, M(e)) : i && a === i ? (i = null, t += a, M(e)) : i && a === "\\" && e.pos + 1 < e.input.length ? (t += a, M(e), t += e.input[e.pos], M(e)) : (i || (a === "[" ? n++ : a === "]" ? (n--, n < 0 && (e.errors.push({
1387
+ message: "Extra ']' in selector - no matching '['",
1388
+ line: e.line,
1389
+ column: e.column
1390
+ }), n = 0)) : a === "(" ? r++ : a === ")" && (r--, r < 0 && (e.errors.push({
1391
+ message: "Extra ')' in selector - no matching '('",
1392
+ line: e.line,
1393
+ column: e.column
1394
+ }), r = 0))), t += a, M(e));
1395
+ }
1396
+ return t.trimEnd();
1397
+ }
1398
+ function A(e, t) {
1399
+ return e.input.startsWith(t, e.pos);
1400
+ }
1401
+ function Oe(e, t) {
1402
+ if (t <= e.pos) return;
1403
+ let n = e.input, r = -1, i = 0;
1404
+ for (let a = n.indexOf("\n", e.pos); a !== -1 && a < t; a = n.indexOf("\n", a + 1)) r = a, i++;
1405
+ i > 0 ? (e.line += i, e.column = t - r) : e.column += t - e.pos, e.pos = t;
1406
+ }
1407
+ function j(e, t) {
1408
+ for (let n = 0; n < t; n++) M(e);
1409
+ }
1410
+ function M(e) {
1411
+ e.pos < e.input.length && (e.input[e.pos] === "\n" ? (e.line++, e.column = 1) : e.column++, e.pos++);
1412
+ }
1413
+ function ke(e) {
1414
+ for (; e.pos < e.input.length && Ae(e.input[e.pos]);) M(e);
1415
+ }
1416
+ function Ae(e) {
1417
+ return e === " " || e === " " || e === "\n" || e === "\r";
1418
+ }
1419
+ function N(e) {
1420
+ return e >= "0" && e <= "9";
1421
+ }
1422
+ function je(e) {
1423
+ return e >= "a" && e <= "z" || e >= "A" && e <= "Z" || e === "_" || e === "@";
1424
+ }
1425
+ function Me(e) {
1426
+ return je(e) || N(e) || e === "-" || e === ".";
1427
+ }
1428
+ function Ne(e, t = {}) {
1429
+ try {
1430
+ let n = fe(t);
1431
+ e.length > n.maxTemplateLength && k("maxTemplateLength");
1432
+ let r = ve(e);
1433
+ return Fe(r.tokens, t, r.errors);
1434
+ } catch (e) {
1435
+ return Pe(e);
1436
+ }
1437
+ }
1438
+ function Pe(e) {
1439
+ if (e instanceof O || e instanceof RangeError) return {
1440
+ ast: [],
1441
+ errors: [{
1442
+ message: e instanceof O ? e.message : "Template exceeded maxDepth",
1443
+ code: "LIMIT_EXCEEDED",
1444
+ line: 1,
1445
+ column: 1
1446
+ }]
1447
+ };
1448
+ throw e;
1449
+ }
1450
+ function Fe(e, t = {}, n = []) {
1451
+ try {
1452
+ let r = fe(t), i = {
1453
+ tokens: e,
1454
+ pos: 0,
1455
+ errors: n,
1456
+ depth: 0,
1457
+ maxDepth: r.maxDepth
1458
+ }, a = Le(i), o = a.map((e) => ({
1459
+ value: e,
1460
+ depth: 0
1461
+ }));
1462
+ for (; o.length;) {
1463
+ let { value: e, depth: t } = o.pop();
1464
+ if (t > r.maxDepth && k("maxDepth"), e && typeof e == "object") for (let n of Object.values(e)) n && typeof n == "object" && o.push({
1465
+ value: n,
1466
+ depth: t + +!Array.isArray(n)
1467
+ });
1468
+ }
1469
+ return {
1470
+ ast: a,
1471
+ errors: i.errors
1472
+ };
1473
+ } catch (e) {
1474
+ return Pe(e);
1475
+ }
1476
+ }
1477
+ function Ie(e, t) {
1478
+ ++e.depth > e.maxDepth && k("maxDepth");
1479
+ try {
1480
+ return t();
1481
+ } finally {
1482
+ e.depth--;
1483
+ }
1484
+ }
1485
+ function Le(e) {
1486
+ let t = [];
1487
+ for (; !z(e);) {
1488
+ let n = Re(e);
1489
+ n && t.push(n);
1490
+ }
1491
+ return t;
1492
+ }
1493
+ function Re(e) {
1494
+ let t = I(e);
1495
+ switch (t.type) {
1496
+ case "text": return ze(e);
1497
+ case "variable_start": return Be(e);
1498
+ case "tag_start": return Ve(e);
1499
+ case "eof": return L(e), null;
1500
+ default: return e.errors.push({
1501
+ message: `Unexpected "${t.value}" in template`,
1502
+ line: t.line,
1503
+ column: t.column
1504
+ }), L(e), null;
1505
+ }
1506
+ }
1507
+ function ze(e) {
1508
+ let t = L(e), n = [t.value];
1509
+ for (; R(e, "text");) n.push(L(e).value);
1510
+ return {
1511
+ type: "text",
1512
+ value: n.join(""),
1513
+ line: t.line,
1514
+ column: t.column
1515
+ };
1516
+ }
1517
+ function Be(e) {
1518
+ let t = L(e), n = t.trimLeft || !1;
1519
+ if (R(e, "identifier") && e.tokens[e.pos + 1]?.type === "identifier") {
1520
+ let t = e.tokens[e.pos], n = e.pos + 1, r = [t.value];
1521
+ for (; e.tokens[n]?.type === "identifier";) r.push(e.tokens[n].value), n++;
1522
+ e.tokens.splice(e.pos, n - e.pos, {
1523
+ ...t,
1524
+ value: r.join(" ")
1525
+ });
1526
+ }
1527
+ let r = P(e);
1528
+ if (!r) return e.errors.push({
1529
+ message: "Empty variable - add a variable name between {{ and }}",
1530
+ line: t.line,
1531
+ column: t.column
1532
+ }), ot(e), null;
1533
+ let i = !1;
1534
+ return R(e, "variable_end") ? i = L(e).trimRight || !1 : e.errors.push({
1535
+ message: "Missing closing }}",
1536
+ line: I(e).line,
1537
+ column: I(e).column
1538
+ }), {
1539
+ type: "variable",
1540
+ expression: r,
1541
+ trimLeft: n,
1542
+ trimRight: i,
1543
+ line: t.line,
1544
+ column: t.column
1545
+ };
1546
+ }
1547
+ function Ve(e) {
1548
+ let t = L(e), n = t.trimLeft || !1, r = I(e);
1549
+ switch (r.type) {
1550
+ case "keyword_if": return He(e, t, n);
1551
+ case "keyword_for": return Ue(e, t, n);
1552
+ case "keyword_set": return We(e, t, n);
1553
+ case "keyword_else":
1554
+ case "keyword_elseif":
1555
+ case "keyword_endif":
1556
+ case "keyword_endfor": return e.errors.push({
1557
+ message: `Unexpected {% ${r.value} %} - no matching opening tag`,
1558
+ line: r.line,
1559
+ column: r.column
1560
+ }), B(e), null;
1561
+ default: return e.errors.push({
1562
+ message: `Unknown tag: {% ${r.value} %}`,
1563
+ line: r.line,
1564
+ column: r.column
1565
+ }), B(e), null;
1566
+ }
1567
+ }
1568
+ function He(e, t, n) {
1569
+ L(e);
1570
+ let r = P(e);
1571
+ if (!r) return e.errors.push({
1572
+ message: "{% if %} requires a condition",
1573
+ line: t.line,
1574
+ column: t.column
1575
+ }), B(e), null;
1576
+ let i = !1;
1577
+ R(e, "tag_end") ? i = L(e).trimRight || !1 : e.errors.push({
1578
+ message: "Missing %} to close {% if %}",
1579
+ line: I(e).line,
1580
+ column: I(e).column
1581
+ });
1582
+ let a = Ge(e, [
1583
+ "keyword_elseif",
1584
+ "keyword_else",
1585
+ "keyword_endif"
1586
+ ], !0), o = [];
1587
+ for (; rt(e, "keyword_elseif");) {
1588
+ it(e), L(e);
1589
+ let t = P(e);
1590
+ if (!t) {
1591
+ e.errors.push({
1592
+ message: "{% elseif %} requires a condition",
1593
+ line: I(e).line,
1594
+ column: I(e).column
1595
+ }), B(e);
1596
+ continue;
1597
+ }
1598
+ at(e);
1599
+ let n = Ge(e, [
1600
+ "keyword_elseif",
1601
+ "keyword_else",
1602
+ "keyword_endif"
1603
+ ], !0);
1604
+ o.push({
1605
+ condition: t,
1606
+ body: n
1607
+ });
1608
+ }
1609
+ let s = null;
1610
+ return rt(e, "keyword_else") && (it(e), L(e), at(e), s = Ge(e, ["keyword_endif"], !0)), rt(e, "keyword_endif") ? (it(e), L(e), at(e)) : e.errors.push({
1611
+ message: "Missing {% endif %} to close {% if %}",
1612
+ line: I(e).line,
1613
+ column: I(e).column
1614
+ }), {
1615
+ type: "if",
1616
+ condition: r,
1617
+ consequent: a,
1618
+ elseifs: o,
1619
+ alternate: s,
1620
+ trimLeft: n,
1621
+ trimRight: i,
1622
+ line: t.line,
1623
+ column: t.column
1624
+ };
1625
+ }
1626
+ function Ue(e, t, n) {
1627
+ if (L(e), !R(e, "identifier")) return e.errors.push({
1628
+ message: "{% for %} requires a variable name, e.g. {% for item in items %}",
1629
+ line: I(e).line,
1630
+ column: I(e).column
1631
+ }), B(e), null;
1632
+ let r = L(e).value;
1633
+ if (!R(e, "keyword_in")) return e.errors.push({
1634
+ message: "{% for %} requires \"in\" keyword, e.g. {% for item in items %}",
1635
+ line: I(e).line,
1636
+ column: I(e).column
1637
+ }), B(e), null;
1638
+ L(e);
1639
+ let i = P(e);
1640
+ if (!i) return e.errors.push({
1641
+ message: "{% for %} requires something to loop over after \"in\"",
1642
+ line: I(e).line,
1643
+ column: I(e).column
1644
+ }), B(e), null;
1645
+ let a = !1;
1646
+ R(e, "tag_end") ? a = L(e).trimRight || !1 : e.errors.push({
1647
+ message: "Missing %} to close {% for %}",
1648
+ line: I(e).line,
1649
+ column: I(e).column
1650
+ });
1651
+ let o = Ge(e, ["keyword_endfor"]);
1652
+ return rt(e, "keyword_endfor") ? (it(e), L(e), at(e)) : e.errors.push({
1653
+ message: "Missing {% endfor %} to close {% for %}",
1654
+ line: I(e).line,
1655
+ column: I(e).column
1656
+ }), {
1657
+ type: "for",
1658
+ iterator: r,
1659
+ iterable: i,
1660
+ body: o,
1661
+ trimLeft: n,
1662
+ trimRight: a,
1663
+ line: t.line,
1664
+ column: t.column
1665
+ };
1666
+ }
1667
+ function We(e, t, n) {
1668
+ if (L(e), !R(e, "identifier")) return e.errors.push({
1669
+ message: "{% set %} requires a variable name, e.g. {% set name = value %}",
1670
+ line: I(e).line,
1671
+ column: I(e).column
1672
+ }), B(e), null;
1673
+ let r = L(e).value;
1674
+ if (!R(e, "op_assign")) return e.errors.push({
1675
+ message: "{% set %} requires \"=\" after variable name",
1676
+ line: I(e).line,
1677
+ column: I(e).column
1678
+ }), B(e), null;
1679
+ L(e);
1680
+ let i = P(e);
1681
+ if (!i) return e.errors.push({
1682
+ message: "{% set %} requires a value after \"=\"",
1683
+ line: I(e).line,
1684
+ column: I(e).column
1685
+ }), B(e), null;
1686
+ let a = !1;
1687
+ return R(e, "tag_end") ? a = L(e).trimRight || !1 : e.errors.push({
1688
+ message: "Missing %} to close {% set %}",
1689
+ line: I(e).line,
1690
+ column: I(e).column
1691
+ }), {
1692
+ type: "set",
1693
+ variable: r,
1694
+ value: i,
1695
+ trimLeft: n,
1696
+ trimRight: a,
1697
+ line: t.line,
1698
+ column: t.column
1699
+ };
1700
+ }
1701
+ function Ge(e, t, n = !1) {
1702
+ return Ie(e, () => Ke(e, t, n));
1703
+ }
1704
+ function Ke(e, t, n = !1) {
1705
+ let r = [];
1706
+ for (; !z(e);) {
1707
+ if (rt(e, ...t)) {
1708
+ if (n) {
1709
+ let t = e.pos;
1710
+ for (; t < e.tokens.length && e.tokens[t].type !== "tag_end";) t++;
1711
+ let n = e.tokens[t + 1], i = n?.type === "eof" || n?.type === "text" && /^[\t ]*(?:\r?\n|$)/.test(n.value), a = r[r.length - 1];
1712
+ i && a?.type === "text" && (a.value = a.value.replace(/\r?\n[\t ]*$/, ""));
1713
+ }
1714
+ break;
1715
+ }
1716
+ let i = Re(e);
1717
+ i && r.push(i);
1718
+ }
1719
+ return r;
1720
+ }
1721
+ function P(e) {
1722
+ return qe(e);
1723
+ }
1724
+ function qe(e) {
1725
+ let t = Ye(e);
1726
+ if (!t) return null;
1727
+ for (; R(e, "op_nullish");) {
1728
+ let n = L(e), r = Ye(e);
1729
+ if (!r) {
1730
+ e.errors.push({
1731
+ message: "Missing fallback value after ??",
1732
+ line: n.line,
1733
+ column: n.column
1734
+ });
1735
+ break;
1736
+ }
1737
+ t = {
1738
+ type: "binary",
1739
+ operator: "??",
1740
+ left: t,
1741
+ right: r,
1742
+ line: n.line,
1743
+ column: n.column
1744
+ };
1745
+ }
1746
+ return t;
1747
+ }
1748
+ function Je(e) {
1749
+ let t = I(e);
1750
+ if (R(e, "slash") || R(e, "star")) {
1751
+ let t = L(e);
1752
+ return {
1753
+ type: "literal",
1754
+ value: t.value,
1755
+ raw: t.value,
1756
+ line: t.line,
1757
+ column: t.column
1758
+ };
1759
+ }
1760
+ if (R(e, "lbracket")) {
1761
+ let t = "", n = 0, r = I(e).line, i = I(e).column;
1762
+ for (; !z(e);) {
1763
+ let r = I(e);
1764
+ if (r.type === "lbracket") n++;
1765
+ else if (r.type === "rbracket" && (n--, n === 0)) {
1766
+ t += r.value, L(e);
1767
+ break;
1768
+ }
1769
+ if (n === 0 && (r.type === "pipe" || r.type === "variable_end" || r.type === "comma")) break;
1770
+ t += r.value, L(e);
1771
+ }
1772
+ return {
1773
+ type: "literal",
1774
+ value: t,
1775
+ raw: t,
1776
+ line: r,
1777
+ column: i
1778
+ };
1779
+ }
1780
+ if (R(e, "identifier")) {
1781
+ let n = e.pos, r = L(e);
1782
+ if (R(e, "arrow")) {
1783
+ let n = r.value + " ";
1784
+ n += L(e).value + " ";
1785
+ let i = 0, a = 0;
1786
+ for (; !z(e);) {
1787
+ let t = I(e);
1788
+ if (i === 0 && a === 0 && (t.type === "pipe" || t.type === "variable_end" || t.type === "tag_end")) break;
1789
+ if (t.type === "lbrace" || t.type === "lparen") t.type === "lbrace" ? i++ : a++;
1790
+ else if ((t.type === "rbrace" || t.type === "rparen") && (t.type === "rbrace" ? i-- : a--, i < 0 || a < 0)) break;
1791
+ n += t.type === "string" ? `"${t.value}"` : t.value, L(e);
1792
+ }
1793
+ return {
1794
+ type: "literal",
1795
+ value: n.trim(),
1796
+ raw: n.trim(),
1797
+ line: t.line,
1798
+ column: t.column
1799
+ };
1800
+ }
1801
+ e.pos = n;
1802
+ }
1803
+ let n = nt(e);
1804
+ if (!n) return null;
1805
+ if (n.type === "literal" && t.type === "string") {
1806
+ let t = (e) => `"${e}"`, r = t(n.value), i = !1;
1807
+ for (; R(e, "colon");) {
1808
+ let n = e.pos;
1809
+ if (L(e), R(e, "string")) {
1810
+ let n = nt(e);
1811
+ n && n.type === "literal" && (r += ":" + t(n.value), i = !0);
1812
+ } else {
1813
+ e.pos = n;
1814
+ break;
1815
+ }
1816
+ }
1817
+ return {
1818
+ type: "literal",
1819
+ value: r,
1820
+ raw: r,
1821
+ ...i ? {} : { unquotedValue: n.value },
1822
+ line: n.line,
1823
+ column: n.column
1824
+ };
1825
+ }
1826
+ if (n.type === "identifier" && R(e, "plus")) {
1827
+ let t = e.pos;
1828
+ if (L(e), R(e, "number")) {
1829
+ let t = L(e), r = `${n.name}+${t.value}`;
1830
+ return {
1831
+ type: "literal",
1832
+ value: r,
1833
+ raw: r,
1834
+ line: n.line,
1835
+ column: n.column
1836
+ };
1837
+ }
1838
+ e.pos = t;
1839
+ }
1840
+ if (n.type === "literal" && t.type === "number" && R(e, "identifier")) {
1841
+ let t = I(e);
1842
+ if (t.value.length === 1 && /^[a-z]$/i.test(t.value)) {
1843
+ L(e);
1844
+ let r = String(n.value) + t.value;
1845
+ return {
1846
+ type: "literal",
1847
+ value: r,
1848
+ raw: r,
1849
+ line: n.line,
1850
+ column: n.column
1851
+ };
1852
+ }
1853
+ }
1854
+ if (!R(e, "colon")) return n;
1855
+ let r = "";
1856
+ if (n.type === "literal") r = String(n.value);
1857
+ else if (n.type === "identifier") r = n.name;
1858
+ else return n;
1859
+ for (; R(e, "colon") && !z(e);) {
1860
+ L(e), r += ":";
1861
+ let t = nt(e);
1862
+ if (t) t.type === "literal" ? r += String(t.value) : t.type === "identifier" && (r += t.name);
1863
+ else break;
1864
+ }
1865
+ return {
1866
+ type: "literal",
1867
+ value: r,
1868
+ raw: r,
1869
+ line: t.line,
1870
+ column: t.column
1871
+ };
1872
+ }
1873
+ function Ye(e) {
1874
+ let t = F(e);
1875
+ if (!t) return null;
1876
+ for (; R(e, "pipe");) {
1877
+ if (L(e), !R(e, "identifier")) {
1878
+ e.errors.push({
1879
+ message: "Missing filter name after |",
1880
+ line: I(e).line,
1881
+ column: I(e).column
1882
+ });
1883
+ break;
1884
+ }
1885
+ let n = L(e), r = [];
1886
+ if (R(e, "colon")) {
1887
+ if (L(e), R(e, "lparen")) {
1888
+ for (L(e); !R(e, "rparen") && !z(e);) {
1889
+ let t = F(e);
1890
+ if (!t) break;
1891
+ if (t.type === "literal" && typeof t.value == "string" && R(e, "colon")) {
1892
+ let n = (e) => `"${e}"`, i = n(t.value);
1893
+ for (; R(e, "colon");) {
1894
+ L(e);
1895
+ let t = F(e);
1896
+ if (t && t.type === "literal" && typeof t.value == "string") i += ":" + n(t.value);
1897
+ else break;
1898
+ }
1899
+ r.push({
1900
+ type: "literal",
1901
+ value: i,
1902
+ raw: i,
1903
+ line: t.line,
1904
+ column: t.column
1905
+ });
1906
+ } else r.push(t);
1907
+ if (R(e, "comma")) L(e);
1908
+ else break;
1909
+ }
1910
+ R(e, "rparen") && L(e);
1911
+ } else {
1912
+ let t = Je(e);
1913
+ for (t && r.push(t); R(e, "comma");) {
1914
+ L(e);
1915
+ let t = Je(e);
1916
+ t && r.push(t);
1917
+ }
1918
+ }
1919
+ }
1920
+ t = {
1921
+ type: "filter",
1922
+ value: t,
1923
+ name: n.value,
1924
+ args: r,
1925
+ line: n.line,
1926
+ column: n.column
1927
+ };
1928
+ }
1929
+ return t;
1930
+ }
1931
+ function F(e) {
1932
+ return Ie(e, () => Xe(e));
1933
+ }
1934
+ function Xe(e) {
1935
+ let t = Ze(e);
1936
+ if (!t) return null;
1937
+ for (; R(e, "op_or");) {
1938
+ let n = L(e), r = Ze(e);
1939
+ if (!r) {
1940
+ e.errors.push({
1941
+ message: "Missing value after \"or\"",
1942
+ line: n.line,
1943
+ column: n.column
1944
+ });
1945
+ break;
1946
+ }
1947
+ t = {
1948
+ type: "binary",
1949
+ operator: "or",
1950
+ left: t,
1951
+ right: r,
1952
+ line: n.line,
1953
+ column: n.column
1954
+ };
1955
+ }
1956
+ return t;
1957
+ }
1958
+ function Ze(e) {
1959
+ let t = Qe(e);
1960
+ if (!t) return null;
1961
+ for (; R(e, "op_and");) {
1962
+ let n = L(e), r = Qe(e);
1963
+ if (!r) {
1964
+ e.errors.push({
1965
+ message: "Missing value after \"and\"",
1966
+ line: n.line,
1967
+ column: n.column
1968
+ });
1969
+ break;
1970
+ }
1971
+ t = {
1972
+ type: "binary",
1973
+ operator: "and",
1974
+ left: t,
1975
+ right: r,
1976
+ line: n.line,
1977
+ column: n.column
1978
+ };
1979
+ }
1980
+ return t;
1981
+ }
1982
+ function Qe(e) {
1983
+ return Ie(e, () => $e(e));
1984
+ }
1985
+ function $e(e) {
1986
+ if (R(e, "op_not")) {
1987
+ let t = L(e), n = Qe(e);
1988
+ return n ? {
1989
+ type: "unary",
1990
+ operator: "not",
1991
+ argument: n,
1992
+ line: t.line,
1993
+ column: t.column
1994
+ } : (e.errors.push({
1995
+ message: "Missing value after \"not\"",
1996
+ line: t.line,
1997
+ column: t.column
1998
+ }), null);
1999
+ }
2000
+ return et(e);
2001
+ }
2002
+ function et(e) {
2003
+ let t = tt(e);
2004
+ if (!t) return null;
2005
+ if ([
2006
+ "op_eq",
2007
+ "op_neq",
2008
+ "op_gt",
2009
+ "op_lt",
2010
+ "op_gte",
2011
+ "op_lte",
2012
+ "op_contains"
2013
+ ].some((t) => R(e, t))) {
2014
+ let n = L(e), r = tt(e);
2015
+ return r ? {
2016
+ type: "binary",
2017
+ operator: {
2018
+ op_eq: "==",
2019
+ op_neq: "!=",
2020
+ op_gt: ">",
2021
+ op_lt: "<",
2022
+ op_gte: ">=",
2023
+ op_lte: "<=",
2024
+ op_contains: "contains"
2025
+ }[n.type] || n.value,
2026
+ left: t,
2027
+ right: r,
2028
+ line: n.line,
2029
+ column: n.column
2030
+ } : (e.errors.push({
2031
+ message: `Missing value after "${n.value}"`,
2032
+ line: n.line,
2033
+ column: n.column
2034
+ }), t);
2035
+ }
2036
+ return t;
2037
+ }
2038
+ function tt(e) {
2039
+ let t = nt(e);
2040
+ if (!t) return null;
2041
+ for (; R(e, "lbracket") || R(e, "dot");) {
2042
+ if (R(e, "dot")) {
2043
+ let n = L(e), r = I(e), i = r.value.split(".");
2044
+ if (r.type === "string" || !i.every((e) => /^[A-Za-z_@][A-Za-z0-9_@-]*$/.test(e))) {
2045
+ e.errors.push({
2046
+ message: "Expected a property name after .",
2047
+ line: n.line,
2048
+ column: n.column
2049
+ });
2050
+ break;
2051
+ }
2052
+ L(e);
2053
+ let a = r.column;
2054
+ for (let e of i) t = {
2055
+ type: "member",
2056
+ object: t,
2057
+ property: {
2058
+ type: "literal",
2059
+ value: e,
2060
+ raw: e,
2061
+ line: r.line,
2062
+ column: a
2063
+ },
2064
+ computed: !1,
2065
+ line: r.line,
2066
+ column: a
2067
+ }, a += e.length + 1;
2068
+ continue;
2069
+ }
2070
+ let n = L(e), r = F(e);
2071
+ if (!r) {
2072
+ e.errors.push({
2073
+ message: "Empty brackets [] - add an index or key",
2074
+ line: n.line,
2075
+ column: n.column
2076
+ });
2077
+ break;
2078
+ }
2079
+ R(e, "rbracket") ? L(e) : e.errors.push({
2080
+ message: "Missing closing ]",
2081
+ line: I(e).line,
2082
+ column: I(e).column
2083
+ }), t = {
2084
+ type: "member",
2085
+ object: t,
2086
+ property: r,
2087
+ computed: !0,
2088
+ line: n.line,
2089
+ column: n.column
2090
+ };
2091
+ }
2092
+ return t;
2093
+ }
2094
+ function nt(e) {
2095
+ let t = I(e);
2096
+ if (R(e, "lparen")) {
2097
+ L(e);
2098
+ let n = F(e);
2099
+ return n ? (R(e, "rparen") ? L(e) : e.errors.push({
2100
+ message: "Missing closing )",
2101
+ line: I(e).line,
2102
+ column: I(e).column
2103
+ }), {
2104
+ type: "group",
2105
+ expression: n,
2106
+ line: t.line,
2107
+ column: t.column
2108
+ }) : (e.errors.push({
2109
+ message: "Empty parentheses () - add an expression",
2110
+ line: t.line,
2111
+ column: t.column
2112
+ }), null);
2113
+ }
2114
+ if (R(e, "string")) {
2115
+ let t = L(e);
2116
+ return {
2117
+ type: "literal",
2118
+ value: t.value,
2119
+ raw: t.value,
2120
+ line: t.line,
2121
+ column: t.column
2122
+ };
2123
+ }
2124
+ if (R(e, "number")) {
2125
+ let t = L(e);
2126
+ return {
2127
+ type: "literal",
2128
+ value: parseFloat(t.value),
2129
+ raw: t.value,
2130
+ line: t.line,
2131
+ column: t.column
2132
+ };
2133
+ }
2134
+ if (R(e, "boolean")) {
2135
+ let t = L(e);
2136
+ return {
2137
+ type: "literal",
2138
+ value: t.value.toLowerCase() === "true",
2139
+ raw: t.value,
2140
+ line: t.line,
2141
+ column: t.column
2142
+ };
2143
+ }
2144
+ if (R(e, "null")) {
2145
+ let t = L(e);
2146
+ return {
2147
+ type: "literal",
2148
+ value: null,
2149
+ raw: "null",
2150
+ line: t.line,
2151
+ column: t.column
2152
+ };
2153
+ }
2154
+ if (R(e, "identifier")) {
2155
+ let t = L(e), n = t.value;
2156
+ if (R(e, "colon")) {
2157
+ L(e);
2158
+ let t = "";
2159
+ for (; R(e, "identifier") || R(e, "dot") || R(e, "colon") || R(e, "lbracket") || R(e, "rbracket") || R(e, "number") || R(e, "string") || R(e, "star");) t += L(e).value;
2160
+ n = n + ":" + t;
2161
+ }
2162
+ return {
2163
+ type: "identifier",
2164
+ name: n,
2165
+ ...n.includes(".") ? { path: n.split(".") } : {},
2166
+ line: t.line,
2167
+ column: t.column
2168
+ };
2169
+ }
2170
+ return null;
2171
+ }
2172
+ function I(e) {
2173
+ return e.tokens[e.pos] || {
2174
+ type: "eof",
2175
+ value: "",
2176
+ line: 0,
2177
+ column: 0
2178
+ };
2179
+ }
2180
+ function L(e) {
2181
+ let t = I(e);
2182
+ return z(e) || e.pos++, t;
2183
+ }
2184
+ function R(e, t) {
2185
+ return I(e).type === t;
2186
+ }
2187
+ function z(e) {
2188
+ return I(e).type === "eof";
2189
+ }
2190
+ function rt(e, ...t) {
2191
+ if (!R(e, "tag_start")) return !1;
2192
+ let n = e.pos + 1;
2193
+ return n >= e.tokens.length ? !1 : t.includes(e.tokens[n].type);
2194
+ }
2195
+ function it(e) {
2196
+ return R(e, "tag_start") ? L(e) : null;
2197
+ }
2198
+ function at(e) {
2199
+ return R(e, "tag_end") ? L(e) : (e.errors.push({
2200
+ message: "Missing closing %}",
2201
+ line: I(e).line,
2202
+ column: I(e).column
2203
+ }), null);
2204
+ }
2205
+ function B(e) {
2206
+ for (; !z(e) && !R(e, "tag_end");) L(e);
2207
+ R(e, "tag_end") && L(e);
2208
+ }
2209
+ function ot(e) {
2210
+ for (; !z(e) && !R(e, "variable_end");) L(e);
2211
+ R(e, "variable_end") && L(e);
2212
+ }
2213
+ function st(e, t) {
2214
+ let n = [];
2215
+ for (let e = 0; e <= t.length; e++) n[e] = [e];
2216
+ for (let t = 0; t <= e.length; t++) n[0][t] = t;
2217
+ for (let r = 1; r <= t.length; r++) for (let i = 1; i <= e.length; i++) t.charAt(r - 1) === e.charAt(i - 1) ? n[r][i] = n[r - 1][i - 1] : n[r][i] = Math.min(n[r - 1][i - 1] + 1, n[r][i - 1] + 1, n[r - 1][i] + 1);
2218
+ return n[t.length][e.length];
2219
+ }
2220
+ function V(e) {
2221
+ switch (e.type) {
2222
+ case "literal": return typeof e.value == "string" ? /^["'].*["']$/.test(e.value) || e.value.includes("\":\"") || e.value.includes("':'") || /\s*\w+\s*=>/.test(e.value) || /^[\w.:+\-*/]+$/.test(e.value) ? e.value : `"${e.value}"` : String(e.value);
2223
+ case "identifier": return e.name;
2224
+ case "filter":
2225
+ let t = V(e.value), n = e.args.map(V).join(":");
2226
+ return n ? `${t}|${e.name}:${n}` : `${t}|${e.name}`;
2227
+ case "binary": return `${V(e.left)} ${e.operator} ${V(e.right)}`;
2228
+ case "unary": return `${e.operator} ${V(e.argument)}`;
2229
+ case "group": return `(${V(e.expression)})`;
2230
+ case "member": return `${V(e.object)}.${V(e.property)}`;
2231
+ default: return "";
2232
+ }
2233
+ }
2234
+ function ct(e) {
2235
+ if (e.length !== 0) return e.map(V).join(",");
2236
+ }
2237
+ function lt(e) {
2238
+ return e.type === "literal" || e.type === "group" && lt(e.expression);
2239
+ }
2240
+ function ut(e, t) {
2241
+ let n = null, r = Infinity;
2242
+ for (let i of t) {
2243
+ let t = st(e.toLowerCase(), i.toLowerCase());
2244
+ t < Math.max(e.length, i.length) / 2 && t < r && (r = t, n = i);
2245
+ }
2246
+ return n;
2247
+ }
2248
+ function H(e, t) {
2249
+ switch (e.type) {
2250
+ case "filter":
2251
+ t.push({
2252
+ name: e.name,
2253
+ hasArgs: e.args.length > 0,
2254
+ args: e.args,
2255
+ line: e.line,
2256
+ column: e.column
2257
+ }), H(e.value, t);
2258
+ for (let n of e.args) H(n, t);
2259
+ break;
2260
+ case "binary":
2261
+ H(e.left, t), H(e.right, t);
2262
+ break;
2263
+ case "unary":
2264
+ H(e.argument, t);
2265
+ break;
2266
+ case "member":
2267
+ H(e.object, t), H(e.property, t);
2268
+ break;
2269
+ case "group": H(e.expression, t);
2270
+ }
2271
+ }
2272
+ function dt(e) {
2273
+ let t = [];
2274
+ function n(e) {
2275
+ switch (e.type) {
2276
+ case "variable":
2277
+ H(e.expression, t);
2278
+ break;
2279
+ case "set":
2280
+ H(e.value, t);
2281
+ break;
2282
+ case "if":
2283
+ H(e.condition, t), e.consequent.forEach(n), e.elseifs.forEach((e) => {
2284
+ H(e.condition, t), e.body.forEach(n);
2285
+ }), e.alternate?.forEach(n);
2286
+ break;
2287
+ case "for": H(e.iterable, t), e.body.forEach(n);
2288
+ }
2289
+ }
2290
+ return e.forEach(n), t;
2291
+ }
2292
+ function ft(e, t) {
2293
+ let n = [], r = dt(e), i = new Set(Object.keys(t));
2294
+ for (let e of r) {
2295
+ if (!i.has(e.name)) {
2296
+ let t = ut(e.name, i), r = `Unknown filter "${e.name}"`;
2297
+ t && (r += `. Did you mean "${t}"?`), n.push({
2298
+ message: r,
2299
+ line: e.line,
2300
+ column: e.column,
2301
+ code: "UNKNOWN_FILTER"
2302
+ });
2303
+ continue;
2304
+ }
2305
+ let r = t[e.name];
2306
+ if (r?.validateParams && e.args.every(lt)) {
2307
+ let t = e.hasArgs ? ct(e.args) : void 0, i = r.validateParams(t);
2308
+ !i.valid && i.error && n.push({
2309
+ message: `Filter "${e.name}" ${i.error}`,
2310
+ line: e.line,
2311
+ column: e.column,
2312
+ code: "INVALID_FILTER_ARGUMENTS"
2313
+ });
2314
+ }
2315
+ }
2316
+ return n;
2317
+ }
2318
+ function U(e, t) {
2319
+ if (e == null || typeof e == "function" || typeof t != "string" && typeof t != "number") return {
2320
+ exists: !1,
2321
+ value: void 0
2322
+ };
2323
+ let n = Object.getOwnPropertyDescriptor(Object(e), t);
2324
+ return n && "value" in n ? {
2325
+ exists: !0,
2326
+ value: n.value
2327
+ } : {
2328
+ exists: !1,
2329
+ value: void 0
2330
+ };
2331
+ }
2332
+ function pt(e, t) {
2333
+ if (!t || t.split(".").some((e) => e === "")) return {
2334
+ exists: !1,
2335
+ value: void 0
2336
+ };
2337
+ let n = e;
2338
+ for (let e of t.split(".")) {
2339
+ let t = U(n, e);
2340
+ if (!t.exists) return t;
2341
+ n = t.value;
2342
+ }
2343
+ return {
2344
+ exists: !0,
2345
+ value: n
2346
+ };
2347
+ }
2348
+ async function mt(e, t, n = {}, r = new pe(n.limits)) {
2349
+ let i = [], a = {
2350
+ context: t,
2351
+ errors: i,
2352
+ pendingTrimRight: !1,
2353
+ budget: r
2354
+ }, o = "";
2355
+ try {
2356
+ r.value(t.variables);
2357
+ for (let t = 0; t < e.length; t++) {
2358
+ let n = e[t], r = await ht(n, a);
2359
+ o = St(o, r, n, a);
2360
+ }
2361
+ } catch (e) {
2362
+ if (!(e instanceof O) || e.code !== "LIMIT_EXCEEDED") throw e;
2363
+ return {
2364
+ output: "",
2365
+ errors: [...i, {
2366
+ message: e.message,
2367
+ code: e.code,
2368
+ line: e.line ?? 1,
2369
+ column: e.column ?? 1
2370
+ }]
2371
+ };
2372
+ }
2373
+ return n.trimOutput && (o = o.trim()), {
2374
+ output: o,
2375
+ errors: i
2376
+ };
2377
+ }
2378
+ async function ht(e, t) {
2379
+ switch (t.budget.step(), e.type) {
2380
+ case "text": return gt(e, t);
2381
+ case "variable": return _t(e, t);
2382
+ case "if": return vt(e, t);
2383
+ case "for": return yt(e, t);
2384
+ case "set": return bt(e, t);
2385
+ default: return t.errors.push({
2386
+ message: `Unknown node type: ${e.type}`,
2387
+ line: e.line ?? 0,
2388
+ column: e.column ?? 0,
2389
+ code: "RENDER_ERROR"
2390
+ }), "";
2391
+ }
2392
+ }
2393
+ function gt(e, t) {
2394
+ let n = e.value;
2395
+ return t.pendingTrimRight &&= (n = Nt(n), !1), n;
2396
+ }
2397
+ async function _t(e, t) {
2398
+ try {
2399
+ let n = Ft(await W(e.expression, t), t);
2400
+ return e.trimRight && (t.pendingTrimRight = !0), n;
2401
+ } catch (n) {
2402
+ return t.errors.push(It(n, "Error evaluating variable", e.line, e.column)), "";
2403
+ }
2404
+ }
2405
+ async function vt(e, t) {
2406
+ try {
2407
+ if (G(await W(e.condition, t))) {
2408
+ let n = await xt(e.consequent, t);
2409
+ return e.trimRight && (t.pendingTrimRight = !0), n;
2410
+ }
2411
+ for (let n of e.elseifs) if (G(await W(n.condition, t))) {
2412
+ let r = await xt(n.body, t);
2413
+ return e.trimRight && (t.pendingTrimRight = !0), r;
2414
+ }
2415
+ if (e.alternate) {
2416
+ let n = await xt(e.alternate, t);
2417
+ return e.trimRight && (t.pendingTrimRight = !0), n;
2418
+ }
2419
+ return e.trimRight && (t.pendingTrimRight = !0), "";
2420
+ } catch (n) {
2421
+ return t.errors.push(It(n, "Error evaluating if condition", e.line, e.column)), "";
2422
+ }
2423
+ }
2424
+ async function yt(e, t) {
2425
+ try {
2426
+ let n = await W(e.iterable, t);
2427
+ if (n == null) return e.trimRight && (t.pendingTrimRight = !0), "";
2428
+ let r = n;
2429
+ if (!Array.isArray(r) && typeof r == "string") try {
2430
+ let e = JSON.parse(r);
2431
+ Array.isArray(e) && (r = e);
2432
+ } catch {}
2433
+ if (!Array.isArray(r)) return t.errors.push({
2434
+ message: `For loop iterable is not an array: ${typeof r}`,
2435
+ line: e.line,
2436
+ column: e.column,
2437
+ code: "RENDER_ERROR"
2438
+ }), e.trimRight && (t.pendingTrimRight = !0), "";
2439
+ let i = [], a = r.length, o = 0;
2440
+ for (let n = 0; n < a; n++) {
2441
+ t.budget.step();
2442
+ let s = r[n], c = {
2443
+ index: n + 1,
2444
+ index0: n,
2445
+ first: n === 0,
2446
+ last: n === a - 1,
2447
+ length: a
2448
+ }, l = {
2449
+ ...t.context,
2450
+ variables: {
2451
+ ...t.context.variables,
2452
+ [e.iterator]: s,
2453
+ [`${e.iterator}_index`]: n,
2454
+ loop: c
2455
+ }
2456
+ }, u = Nt(await xt(e.body, {
2457
+ ...t,
2458
+ context: l
2459
+ }));
2460
+ u !== "" && (o += u.length + (i.length && !i.at(-1).endsWith("\n") ? 1 : 0), t.budget.output(o), i.push(u));
2461
+ }
2462
+ return e.trimRight && (t.pendingTrimRight = !0), i.map((e, t) => t === i.length - 1 ? Mt(e) : e.endsWith("\n") ? e : e + "\n").join("");
2463
+ } catch (n) {
2464
+ return t.errors.push(It(n, "Error in for loop", e.line, e.column)), "";
2465
+ }
2466
+ }
2467
+ async function bt(e, t) {
2468
+ try {
2469
+ let n = await W(e.value, t);
2470
+ return t.budget.value(n), Object.defineProperty(t.context.variables, e.variable, {
2471
+ value: n,
2472
+ writable: !0,
2473
+ enumerable: !0,
2474
+ configurable: !0
2475
+ }), e.trimRight && (t.pendingTrimRight = !0), "";
2476
+ } catch (n) {
2477
+ return t.errors.push(It(n, "Error in set", e.line, e.column)), "";
2478
+ }
2479
+ }
2480
+ async function xt(e, t) {
2481
+ let n = "";
2482
+ for (let r of e) {
2483
+ let e = await ht(r, t);
2484
+ n = St(n, e, r, t);
2485
+ }
2486
+ return n;
2487
+ }
2488
+ function St(e, t, n, r) {
2489
+ return r.budget.output(e.length + t.length), "trimLeft" in n && n.trimLeft && e.length > 0 && (e = Mt(e)), r.pendingTrimRight && t.length > 0 ? (e += Nt(t), r.pendingTrimRight = !1) : e += t, e;
2490
+ }
2491
+ async function W(e, t) {
2492
+ switch (t.budget.step(), e.type) {
2493
+ case "literal": return Ct(e);
2494
+ case "identifier": return wt(e, t);
2495
+ case "binary": return Et(e, t);
2496
+ case "unary": return Dt(e, t);
2497
+ case "filter": return Ot(e, t);
2498
+ case "group": return W(e.expression, t);
2499
+ case "member": return Tt(e, t);
2500
+ default: throw Error(`Unknown expression type: ${e.type}`);
2501
+ }
2502
+ }
2503
+ function Ct(e) {
2504
+ return e.value;
2505
+ }
2506
+ async function wt(e, t) {
2507
+ let n = e.name, r = At(n, t.context.variables, e.path);
2508
+ if (r !== void 0) return r;
2509
+ if (t.context.asyncResolver) return t.context.asyncResolver(n, t.context);
2510
+ }
2511
+ async function Tt(e, t) {
2512
+ let n = await W(e.object, t), r = await W(e.property, t);
2513
+ if (n != null) return U(n, r).value;
2514
+ }
2515
+ async function Et(e, t) {
2516
+ if (e.operator === "??") {
2517
+ let n = await W(e.left, t);
2518
+ return G(n) ? n : W(e.right, t);
2519
+ }
2520
+ let n = await W(e.left, t), r = await W(e.right, t);
2521
+ switch (e.operator) {
2522
+ case "==": return n == r;
2523
+ case "!=": return n != r;
2524
+ case ">": return n > r;
2525
+ case "<": return n < r;
2526
+ case ">=": return n >= r;
2527
+ case "<=": return n <= r;
2528
+ case "contains": return kt(n, r);
2529
+ case "and": return G(n) && G(r);
2530
+ case "or": return G(n) || G(r);
2531
+ default: throw Error(`Unknown binary operator: ${e.operator}`);
2532
+ }
2533
+ }
2534
+ async function Dt(e, t) {
2535
+ let n = await W(e.argument, t);
2536
+ switch (e.operator) {
2537
+ case "not": return !G(n);
2538
+ default: throw Error(`Unknown unary operator: ${e.operator}`);
2539
+ }
2540
+ }
2541
+ async function Ot(e, t) {
2542
+ let n = await W(e.value, t), r = [];
2543
+ for (let n of e.args) {
2544
+ let e = await W(n, t);
2545
+ e === void 0 && n.type === "identifier" && (e = n.name), t.budget.value(e), r.push(e);
2546
+ }
2547
+ let i = r.map((t, n) => {
2548
+ let r = e.args[n];
2549
+ for (; r.type === "group";) r = r.expression;
2550
+ return r.type === "literal" ? r.unquotedValue ?? t : t;
2551
+ }), a = Ft(n, t), o;
2552
+ r.length > 0 && (o = r.map((e) => typeof e == "string" ? Pt(e) || /\s*\w+\s*=>/.test(e) || /^[\w.:+\-*/]+$/.test(e) ? e : `"${e}"` : String(e)).join(",")), t.budget.value(o);
2553
+ let s = await t.context.applyFilter(a, e.name, o, e.line, e.column, n, i, e.args.some((e) => !lt(e)));
2554
+ return t.budget.value(s), s;
2555
+ }
2556
+ function kt(e, t) {
2557
+ if (e == null || t == null) return !1;
2558
+ if (Array.isArray(e)) return e.some((e) => typeof e == "string" && typeof t == "string" ? e.toLowerCase() === t.toLowerCase() : e == t);
2559
+ if (typeof e == "string") {
2560
+ let n = typeof t == "string" ? t : String(t);
2561
+ return e.toLowerCase().includes(n.toLowerCase());
2562
+ }
2563
+ return !1;
2564
+ }
2565
+ function At(e, t, n) {
2566
+ let r = e.trim(), i = U(t, `{{${r}}}`).value;
2567
+ if (i !== void 0) return i;
2568
+ if (U(t, r).value !== void 0) return U(t, r).value;
2569
+ if (r.includes(".")) return jt(t, n ?? r.split("."));
2570
+ }
2571
+ function jt(e, t) {
2572
+ if (t.length === 0 || !e) return;
2573
+ let n = e;
2574
+ for (let e of t) {
2575
+ if (n == null) return;
2576
+ if (e.includes("[") && e.includes("]")) {
2577
+ let t = e.match(/^([^\[]*)\[([^\]]+)\]/);
2578
+ if (t) {
2579
+ let [, e, r] = t, i = e ? U(n, e).value : n;
2580
+ if (Array.isArray(i)) n = U(i, parseInt(r, 10)).value;
2581
+ else if (i && typeof i == "object") n = U(i, r.replace(/^["']|["']$/g, "")).value;
2582
+ else return;
2583
+ continue;
2584
+ }
2585
+ }
2586
+ n = U(n, `{{${e}}}`).value === void 0 ? U(n, e).value : U(n, `{{${e}}}`).value;
2587
+ }
2588
+ return n;
2589
+ }
2590
+ function Mt(e) {
2591
+ return e.replace(/[\t ]*\r?\n?$/, "");
2592
+ }
2593
+ function Nt(e) {
2594
+ return e.replace(/^[\t ]*\r?\n?/, "");
2595
+ }
2596
+ function Pt(e) {
2597
+ return /^["'][\s\S]*["']$/.test(e) || e.includes("\":\"") || e.includes("':'");
2598
+ }
2599
+ function G(e) {
2600
+ return !(e == null || e === "" || e === 0 || e === !1 || Array.isArray(e) && e.length === 0);
2601
+ }
2602
+ function Ft(e, t) {
2603
+ if (t.budget.value(e), e == null) return "";
2604
+ if (Array.isArray(e) && e.length === 1 && typeof e[0] != "object") return String(e[0]);
2605
+ if (typeof e == "object") {
2606
+ let n = JSON.stringify(e);
2607
+ return t.budget.value(n), n;
2608
+ }
2609
+ return String(e);
2610
+ }
2611
+ function It(e, t, n, r) {
2612
+ if (e instanceof O) {
2613
+ if (e.code === "LIMIT_EXCEEDED") throw e;
2614
+ return {
2615
+ message: e.message,
2616
+ line: e.line ?? n,
2617
+ column: e.column ?? r,
2618
+ code: e.code
2619
+ };
2620
+ }
2621
+ return {
2622
+ message: `${t}: ${e instanceof Error ? e.message : String(e)}`,
2623
+ line: n,
2624
+ column: r,
2625
+ code: "RENDER_ERROR"
2626
+ };
2627
+ }
2628
+ function Lt(e) {
2629
+ return {
2630
+ message: e.message,
2631
+ line: e.line,
2632
+ column: e.column,
2633
+ code: e.code ?? "PARSE_ERROR"
2634
+ };
2635
+ }
2636
+ function Rt(e) {
2637
+ return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, t.metadata ?? {}]));
2638
+ }
2639
+ function zt(e = {}) {
2640
+ let t = Object.freeze({ ...e.filters ?? {} }), n = Rt(t), r = (t) => Ne(t, e.limits);
2641
+ function i(t) {
2642
+ let i, a = [];
2643
+ if (typeof t == "string") {
2644
+ let e = r(t);
2645
+ i = e.ast, a.push(...e.errors.map(Lt));
2646
+ } else {
2647
+ i = t;
2648
+ try {
2649
+ new pe(e.limits).value(i);
2650
+ } catch (e) {
2651
+ if (!(e instanceof O)) throw e;
2652
+ return [{
2653
+ message: e.message,
2654
+ code: e.code,
2655
+ line: 1,
2656
+ column: 1
2657
+ }];
2658
+ }
2659
+ }
2660
+ return a.length === 0 && a.push(...ft(i, n).map(Lt)), a;
2661
+ }
2662
+ async function a(r, i, a = {}) {
2663
+ let o = {
2664
+ ...e.limits,
2665
+ ...a.limits
2666
+ }, s = Ne(r, o), c = s.errors.map(Lt);
2667
+ if (c.length > 0) return {
2668
+ output: "",
2669
+ errors: c,
2670
+ warnings: []
2671
+ };
2672
+ let l = new pe(o), u = ft(s.ast, n).map(Lt), d = [], f = /* @__PURE__ */ new Set(), p = {
2673
+ variables: i.variables,
2674
+ context: i.context
2675
+ }, m = await mt(s.ast, {
2676
+ variables: i.variables,
2677
+ asyncResolver: i.resolveVariable ? async (e) => {
2678
+ try {
2679
+ return await i.resolveVariable(e, p);
2680
+ } catch (t) {
2681
+ throw new O(`Could not resolve variable "${e}": ${t instanceof Error ? t.message : String(t)}`, "RESOLVE_ERROR");
2682
+ }
2683
+ } : void 0,
2684
+ applyFilter: async (r, i, a, o, s, c, u, m) => {
2685
+ let h = Object.prototype.hasOwnProperty.call(t, i) ? t[i] : void 0;
2686
+ if (!h) return r;
2687
+ try {
2688
+ if (m) {
2689
+ let e = n[i]?.validateParams?.(a);
2690
+ if (e && !e.valid) throw new O(`Filter "${i}" ${e.error ?? "has invalid arguments"}`, "INVALID_FILTER_ARGUMENTS");
2691
+ }
2692
+ let t = await h(r, a, {
2693
+ allowRegex: e.allowRegex ?? !0,
2694
+ checkValue: (e) => l.value(e),
2695
+ checkLength: (e) => l.length(e),
2696
+ ...p,
2697
+ rawValue: c,
2698
+ rawArguments: u,
2699
+ reportWarning: (e) => {
2700
+ let t = {
2701
+ message: e.message,
2702
+ line: o,
2703
+ column: s,
2704
+ code: e.code ?? "FILTER_WARNING",
2705
+ filter: i
2706
+ }, n = JSON.stringify([
2707
+ t.code,
2708
+ t.filter,
2709
+ t.line,
2710
+ t.column,
2711
+ t.message
2712
+ ]);
2713
+ f.has(n) || (f.add(n), d.push(t));
2714
+ }
2715
+ });
2716
+ return l.value(t), t;
2717
+ } catch (e) {
2718
+ throw e instanceof O ? new O(e.message, e.code, e.line ?? o, e.column ?? s) : new O(`Filter "${i}" failed: ${e instanceof Error ? e.message : String(e)}`, "FILTER_ERROR", o, s);
2719
+ }
2720
+ }
2721
+ }, {
2722
+ ...a,
2723
+ limits: o
2724
+ }, l);
2725
+ return {
2726
+ output: m.output,
2727
+ errors: [...u, ...m.errors],
2728
+ warnings: d
2729
+ };
2730
+ }
2731
+ return {
2732
+ filters: t,
2733
+ parse: r,
2734
+ validate: i,
2735
+ render: a,
2736
+ async renderOrThrow(e, t, n) {
2737
+ let r = await a(e, t, n);
2738
+ if (r.errors.length > 0) throw new ue(r.errors);
2739
+ return r.output;
2740
+ }
2741
+ };
2742
+ }
2743
+ var Bt = (e) => {
2744
+ let t = (e, t = 1) => {
2745
+ let n = "> ".repeat(t);
2746
+ return e.split("\n").map((e) => `${n}${e}`).join("\n");
2747
+ }, n = (e, r = 1) => e.map((e) => Array.isArray(e) ? n(e, r + 1) : t(String(e), r)).join("\n");
2748
+ try {
2749
+ let r = JSON.parse(e);
2750
+ return Array.isArray(r) ? n(r) : t(typeof r == "object" && r ? JSON.stringify(r, null, 2) : String(r));
2751
+ } catch {
2752
+ return Array.isArray(e) ? n(e) : t(e);
2753
+ }
2754
+ };
2755
+ function Vt(e) {
2756
+ if (typeof e == "number") return Number.isFinite(e) ? e : void 0;
2757
+ if (typeof e != "string" || e.trim() === "") return;
2758
+ let t = Number(e.trim());
2759
+ return Number.isFinite(t) ? t : void 0;
2760
+ }
2761
+ function K(e) {
2762
+ if (!e || typeof e != "object" || Array.isArray(e)) return !1;
2763
+ let t = Object.getPrototypeOf(e);
2764
+ return t === Object.prototype || t === null;
2765
+ }
2766
+ function q(e, t, n = !1) {
2767
+ if (t && Object.prototype.hasOwnProperty.call(t, "rawValue") && (Array.isArray(t.rawValue) || K(t.rawValue))) return t.rawValue;
2768
+ let r = n ? e.trimStart() : e;
2769
+ if (r.startsWith("[") || r.startsWith("{")) try {
2770
+ let t = JSON.parse(e);
2771
+ if (Array.isArray(t) || K(t)) return t;
2772
+ } catch {}
2773
+ return e;
2774
+ }
2775
+ function J(e, t, n = !1) {
2776
+ if (t && Object.prototype.hasOwnProperty.call(t, "rawValue")) {
2777
+ let e = t.rawValue;
2778
+ if (Array.isArray(e) || K(e) || typeof e != "string") return e;
2779
+ }
2780
+ let r = n ? e.trimStart() : e;
2781
+ if (r.startsWith("[") || r.startsWith("{")) try {
2782
+ let t = JSON.parse(e);
2783
+ if (Array.isArray(t) || K(t)) return t;
2784
+ } catch {}
2785
+ return e;
2786
+ }
2787
+ function Ht(e, t) {
2788
+ if (t && Object.prototype.hasOwnProperty.call(t, "rawValue")) {
2789
+ let e = t.rawValue;
2790
+ if (Array.isArray(e) || typeof e != "string") return e;
2791
+ }
2792
+ if (e.trimStart().startsWith("[")) try {
2793
+ let t = JSON.parse(e);
2794
+ if (Array.isArray(t)) return t;
2795
+ } catch {}
2796
+ return e;
2797
+ }
2798
+ function Y(e, t) {
2799
+ return typeof e == "string" ? t(e) : Array.isArray(e) ? e.map((e) => Y(e, t)) : K(e) ? Object.fromEntries(Object.entries(e).map(([e, n]) => [e, Y(n, t)])) : e;
2800
+ }
2801
+ function X(e) {
2802
+ return (t, n, r) => Y(q(t, r), e);
2803
+ }
2804
+ function Z(e, t, n = t) {
2805
+ if (!e.trim()) return e;
2806
+ let r = e.trim(), i = e.indexOf(r);
2807
+ return `${e.slice(0, i)}${t}${r}${n}${e.slice(i + r.length)}`;
2808
+ }
2809
+ function Ut(e) {
2810
+ let t = e.match(/^(?:[\t ]*\r?\n)+/)?.[0] ?? "", n = e.slice(t.length), r = n.match(/(?:\r?\n[\t ]*)+$/)?.[0] ?? "";
2811
+ return {
2812
+ leading: t,
2813
+ content: n.slice(0, n.length - r.length),
2814
+ trailing: r
2815
+ };
2816
+ }
2817
+ function Wt(e) {
2818
+ return /[\r\n]/.test(e);
2819
+ }
2820
+ function Q(e, t) {
2821
+ if (t === "") return t;
2822
+ let n = `${"#".repeat(e)} `;
2823
+ return t.split(/(\r?\n)/).map((e) => /^(?:\r?\n)$/.test(e) || !e.trim() ? e : `${n}${e}`).join("");
2824
+ }
2825
+ var Gt = X((e) => Q(1, e)), Kt = X((e) => Q(2, e)), qt = X((e) => Q(3, e)), Jt = X((e) => Q(4, e)), Yt = X((e) => Q(5, e)), Xt = X((e) => Q(6, e)), Zt = /[!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~]/g, Qt = X((e) => e.replace(Zt, "\\$&")), $t = X((e) => e.replace(/^([^\r\n]*\S)[\t ]*(\r?\n)(?=[^\r\n]*\S)/gm, "$1 $2"));
2826
+ function en(e, t) {
2827
+ let n = _(e);
2828
+ return n === void 0 || t.includes(n) ? { valid: !0 } : {
2829
+ valid: !1,
2830
+ error: `invalid marker "${n}". Use ${t.map((e) => `"${e}"`).join(" or ")}`
2831
+ };
2832
+ }
2833
+ var tn = (e) => en(e, ["*", "_"]), nn = (e) => en(e, ["*", "_"]), rn = (e, t, n) => {
2834
+ let r = _(t) ?? "*";
2835
+ return Y(q(e, n), (e) => Z(e, r.repeat(2)));
2836
+ }, an = (e, t, n) => {
2837
+ let r = _(t) ?? "*";
2838
+ return Y(q(e, n), (e) => Z(e, r));
2839
+ }, on = X((e) => Z(e, "~~")), sn = {
2840
+ red: "🔴",
2841
+ orange: "🟠",
2842
+ yellow: "🟡",
2843
+ green: "🟢",
2844
+ blue: "🔵",
2845
+ purple: "🟣"
2846
+ };
2847
+ function cn(e) {
2848
+ let t = _(e);
2849
+ if (t === void 0) return "";
2850
+ if (Object.prototype.hasOwnProperty.call(sn, t)) return sn[t];
2851
+ }
2852
+ var ln = (e) => {
2853
+ let t = _(e);
2854
+ return cn(e) === void 0 ? {
2855
+ valid: !1,
2856
+ error: `invalid color "${t}". Use red, orange, yellow, green, blue, or purple`
2857
+ } : { valid: !0 };
2858
+ }, un = (e, t, n) => {
2859
+ let r = cn(t) ?? "";
2860
+ return Y(q(e, n), (e) => Z(e, `==${r}`, "=="));
2861
+ };
2862
+ function dn(e, t) {
2863
+ return e === "" ? t : /(?:\r?\n[\t ]*){2,}$/.test(e) ? `${e}${t}` : /\r?\n[\t ]*$/.test(e) ? `${e}
2864
+ ${t}` : `${e}
2865
+
2866
+ ${t}`;
2867
+ }
2868
+ function fn(e, t) {
2869
+ return e === "" ? t : /^(?:[\t ]*\r?\n){2,}/.test(e) ? `${t}${e}` : /^[\t ]*\r?\n/.test(e) ? `${t}
2870
+ ${e}` : `${t}
2871
+
2872
+ ${e}`;
2873
+ }
2874
+ var pn = (e) => {
2875
+ let t = _(e);
2876
+ return t === void 0 || [
2877
+ "after",
2878
+ "before",
2879
+ "both"
2880
+ ].includes(t) ? { valid: !0 } : {
2881
+ valid: !1,
2882
+ error: `invalid position "${t}". Use "after", "before", or "both"`
2883
+ };
2884
+ }, mn = (e, t, n) => {
2885
+ let r = _(t) ?? "after";
2886
+ return Y(q(e, n), (e) => r === "before" ? fn(e, "---") : dn(r === "both" ? fn(e, "---") : e, "---"));
2887
+ };
2888
+ function hn(e) {
2889
+ return Math.max(0, ...Array.from(e.matchAll(/`+/g), (e) => e[0].length));
2890
+ }
2891
+ function gn(e) {
2892
+ if (!e.trim()) return e;
2893
+ let t = e.trim(), n = e.indexOf(t), r = "`".repeat(Math.max(1, hn(t) + 1)), i = t.startsWith("`") || t.endsWith("`") ? " " : "";
2894
+ return `${e.slice(0, n)}${r}${i}${t}${i}${r}${e.slice(n + t.length)}`;
2895
+ }
2896
+ function _n(e, t = "") {
2897
+ if (e === "") return e;
2898
+ let { leading: n, content: r, trailing: i } = Ut(e);
2899
+ if (r === "") return e;
2900
+ let a = "`".repeat(Math.max(3, hn(r) + 1));
2901
+ return `${n}${a}${t}
2902
+ ${r}
2903
+ ${a}${i}`;
2904
+ }
2905
+ var vn = (e) => {
2906
+ let t = _(e);
2907
+ return t === void 0 || !/[\r\n`]/.test(t) ? { valid: !0 } : {
2908
+ valid: !1,
2909
+ error: "language cannot contain newlines or backticks"
2910
+ };
2911
+ }, yn = (e, t, n) => {
2912
+ let r = _(t);
2913
+ return Y(q(e, n), (e) => r !== void 0 || Wt(e) ? _n(e, r ?? "") : gn(e));
2914
+ }, bn = (e, t, n) => {
2915
+ let r = _(t) ?? "";
2916
+ return Y(q(e, n), (e) => _n(e, r));
2917
+ };
2918
+ function xn(e) {
2919
+ if (e === "") return e;
2920
+ let { leading: t, content: n, trailing: r } = Ut(e);
2921
+ return n === "" ? e : `${t}$$
2922
+ ${n}
2923
+ $$${r}`;
2924
+ }
2925
+ var Sn = X((e) => Wt(e) ? xn(e) : Z(e, "$")), Cn = X(xn), wn = X((e) => {
2926
+ if (e === "") return e;
2927
+ if (!Wt(e)) return Z(e, "%%");
2928
+ let { leading: t, content: n, trailing: r } = Ut(e);
2929
+ return n ? `${t}%%
2930
+ ${n}
2931
+ %%${r}` : e;
2932
+ }), Tn = (e) => {
2933
+ if (!e) return {
2934
+ valid: !1,
2935
+ error: "requires an operation (e.g., calc:\"+10\", calc:\"*2\")"
2936
+ };
2937
+ let t = (_(e) ?? "").trim();
2938
+ if (!t) return {
2939
+ valid: !1,
2940
+ error: "operation cannot be empty"
2941
+ };
2942
+ let n = [
2943
+ "+",
2944
+ "-",
2945
+ "*",
2946
+ "/",
2947
+ "^",
2948
+ "**"
2949
+ ], r = t.slice(0, 2) === "**" ? "**" : t.charAt(0);
2950
+ if (!n.includes(r)) return {
2951
+ valid: !1,
2952
+ error: `invalid operator "${r}". Use +, -, *, /, ^ or **`
2953
+ };
2954
+ let i = t.slice(r === "**" ? 2 : 1);
2955
+ return !i || isNaN(Number(i)) ? {
2956
+ valid: !1,
2957
+ error: "requires a number after the operator (e.g., \"+10\")"
2958
+ } : { valid: !0 };
2959
+ }, En = (e, t, n) => {
2960
+ let r = !!(n && Object.prototype.hasOwnProperty.call(n, "rawValue")), i = r ? n?.rawValue : e;
2961
+ if (!t || r && i == null) return i;
2962
+ try {
2963
+ let r = Vt(e);
2964
+ if (r === void 0) return w(n, `Could not parse "${e}" as a number`, "INVALID_FILTER_INPUT"), i;
2965
+ let a = (_(t) ?? "").trim(), o = a.slice(0, 2) === "**" ? "**" : a.charAt(0), s = Number(a.slice(o === "**" ? 2 : 1));
2966
+ if (isNaN(s)) return i;
2967
+ let c;
2968
+ switch (o) {
2969
+ case "+":
2970
+ c = r + s;
2971
+ break;
2972
+ case "-":
2973
+ c = r - s;
2974
+ break;
2975
+ case "*":
2976
+ c = r * s;
2977
+ break;
2978
+ case "/":
2979
+ c = r / s;
2980
+ break;
2981
+ case "**":
2982
+ case "^":
2983
+ c = r ** +s;
2984
+ break;
2985
+ default: return i;
2986
+ }
2987
+ return Number.isFinite(c) ? Number(c.toFixed(10)) : (w(n, `Calculation produced a non-finite result for "${e}"`, "INVALID_FILTER_INPUT"), i);
2988
+ } catch (e) {
2989
+ return w(n, `Could not calculate value: ${T(e)}`), i;
2990
+ }
2991
+ }, Dn = (e, t) => {
2992
+ let n = "info", r = "", i = null;
2993
+ if (t) {
2994
+ let e = C(d(t)).map(f);
2995
+ e.length > 0 && (n = e[0] || n), e.length > 1 && (r = e[1] || r), e.length > 2 && (e[2].toLowerCase() === "true" ? i = "-" : e[2].toLowerCase() === "false" && (i = "+"));
2996
+ }
2997
+ let a = `> [!${n}]`;
2998
+ return i && (a += i), r && (a += ` ${r}`), `${a}
2999
+ ${e.split("\n").map((e) => `> ${e}`).join("\n")}`;
3000
+ }, On = (e) => e.replace(/(?:^\w|[A-Z]|\b\w)/g, (e, t) => t === 0 ? e.toLowerCase() : e.toUpperCase()).replace(/[\s_-]+/g, ""), kn = (e) => {
3001
+ let t = (e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
3002
+ try {
3003
+ let n = (e) => {
3004
+ if (typeof e == "string") return t(e);
3005
+ if (Array.isArray(e)) return e.map(n);
3006
+ if (typeof e == "object" && e) {
3007
+ let r = {};
3008
+ for (let [i, a] of Object.entries(e)) r[t(i)] = n(a);
3009
+ return r;
3010
+ }
3011
+ return e;
3012
+ }, r = n(JSON.parse(e));
3013
+ return JSON.stringify(r);
3014
+ } catch {
3015
+ return t(e);
3016
+ }
3017
+ };
3018
+ function An(e) {
3019
+ return e == null || typeof e == "string" && e.trim() === "";
3020
+ }
3021
+ var jn = (e, t, n) => {
3022
+ let r = q(e, n);
3023
+ return Array.isArray(r) ? r.filter((e) => !An(e)) : K(r) ? Object.fromEntries(Object.entries(r).filter(([, e]) => !An(e))) : r;
3024
+ };
3025
+ D.default.extend(se.default), D.default.extend(ae.default), D.default.extend(oe.default), D.default.extend(ce.default);
3026
+ var Mn = (e, t, n) => {
3027
+ if (e === "") return e;
3028
+ let r = e === "now" ? /* @__PURE__ */ new Date() : e;
3029
+ if (!t) return (0, D.default)(r).format("YYYY-MM-DD");
3030
+ let [i, a] = C(d(t)).map(f), o;
3031
+ return o = a ? (0, D.default)(r, a, !0) : (0, D.default)(r), o.isValid() ? o.format(i) : (w(n, `Could not parse "${e}" as a date`, "INVALID_FILTER_INPUT"), e);
3032
+ };
3033
+ D.default.extend(se.default), D.default.extend(ae.default), D.default.extend(oe.default), D.default.extend(ce.default);
3034
+ var Nn = [
3035
+ "year",
3036
+ "years",
3037
+ "month",
3038
+ "months",
3039
+ "week",
3040
+ "weeks",
3041
+ "day",
3042
+ "days",
3043
+ "hour",
3044
+ "hours",
3045
+ "minute",
3046
+ "minutes",
3047
+ "second",
3048
+ "seconds"
3049
+ ], Pn = (e) => {
3050
+ if (!e) return {
3051
+ valid: !1,
3052
+ error: "requires a modifier (e.g., date_modify:\"+1 day\", \"-2 weeks\")"
3053
+ };
3054
+ let t = (_(e) ?? "").trim().match(/^([+-])\s*(\d+)\s*(\w+)s?$/);
3055
+ if (!t) return {
3056
+ valid: !1,
3057
+ error: "invalid format. Use \"+1 day\", \"-2 weeks\", etc."
3058
+ };
3059
+ let [, , , n] = t, r = n.toLowerCase().replace(/s$/, "");
3060
+ return Nn.some((e) => e.replace(/s$/, "") === r) ? { valid: !0 } : {
3061
+ valid: !1,
3062
+ error: `invalid unit "${n}". Use year, month, week, day, hour, minute, or second`
3063
+ };
3064
+ }, Fn = (e, t, n) => {
3065
+ if (!t || e === "") return e;
3066
+ let r = (0, D.default)(e);
3067
+ if (!r.isValid()) return w(n, `Could not parse "${e}" as a date`, "INVALID_FILTER_INPUT"), e;
3068
+ t = (_(t) ?? "").trim();
3069
+ let i = t.match(/^([+-])\s*(\d+)\s*(\w+)s?$/);
3070
+ if (!i) return e;
3071
+ let [, a, o, s] = i, c = parseInt(o, 10);
3072
+ return r = a === "+" ? r.add(c, s) : r.subtract(c, s), r.format("YYYY-MM-DD");
3073
+ };
3074
+ function In(e) {
3075
+ try {
3076
+ return decodeURIComponent(e);
3077
+ } catch {
3078
+ return e;
3079
+ }
3080
+ }
3081
+ var Ln = (e, t, n) => Y(q(e, n), In);
3082
+ function Rn(e) {
3083
+ try {
3084
+ return encodeURIComponent(e);
3085
+ } catch {
3086
+ return e;
3087
+ }
3088
+ }
3089
+ var zn = (e, t, n) => Y(q(e, n), Rn), Bn = (e, t, n) => {
3090
+ let r = Ht(e, n);
3091
+ return Array.isArray(r) ? r.length > 0 ? r[0] : null : r;
3092
+ }, Vn = (e) => {
3093
+ if (e === "") return e;
3094
+ try {
3095
+ let t = JSON.parse(e);
3096
+ if (Array.isArray(t)) return t.map((e, t) => `[^${t + 1}]: ${e}`).join("\n\n");
3097
+ if (typeof t == "object" && t) return Object.entries(t).map(([e, t]) => `[^${e.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase()}]: ${t}`).join("\n\n");
3098
+ } catch {}
3099
+ return e;
3100
+ }, Hn = (e) => (e = e.replace(/!\[([^\]]*)\]\([^\)]+\)/g, ""), e = e.replace(/!\[\[([^\]]+)\]\]/g, ""), e = e.replace(/\[([^\]]+)\]\([^\)]+\)/g, "$1"), e = e.replace(/https?:\/\/\S+/g, ""), e = e.replace(/(\*\*|__)(.*?)\1/g, "$2"), e = e.replace(/(\*|_)(.*?)\1/g, "$2"), e = e.replace(/==(.*?)==/g, "$1"), e = e.replace(/^#+\s+/gm, ""), e = e.replace(/`([^`]+)`/g, "$1"), e = e.replace(/```[\s\S]*?```/g, ""), e = e.replace(/~~(.*?)~~/g, "$1"), e = e.replace(/^[-*+] (\[[x ]\] )?/gm, ""), e = e.replace(/^([-*_]){3,}\s*$/gm, ""), e = e.replace(/^>\s+/gm, ""), e = e.replace(/\|.*\|/g, ""), e = e.replace(/([~^])(\w+)\1/g, "$2"), e = e.replace(/:[a-z_]+:/g, ""), e = e.replace(/<[^>]+>/g, ""), e = e.replace(/\[\s*\]/g, ""), e = e.replace(/\[\^[^\]]+\]/g, ""), e = e.replace(/^\*\[[^\]]+\]:.+$/gm, ""), e = e.replace(/\[\[([^\]|]+)\|?([^\]]*)\]\]/g, (e, t, n) => n || t), e = e.replace(/\n{3,}/g, "\n\n"), e = e.trim(), e), Un = (e, t) => {
3101
+ if (!t || !e.trim()) return [e];
3102
+ t = t.replace(/^(['"])([\s\S]*)\1$/, "$2");
3103
+ let n = t.match(/^(.*?):?((https?:\/\/|file:\/\/).*$)/), r = String(n?.[1]?.trim().replace(/(['"])/g, "") || "link"), i = String(n?.[2] || t), a = (e) => {
3104
+ let t = Hn(e).split(/\s+/).filter(Boolean);
3105
+ return t.length > 10 ? {
3106
+ start: t.slice(0, 5).join(" "),
3107
+ end: t.slice(-5).join(" ")
3108
+ } : { start: t.join(" ") };
3109
+ }, o = (e) => {
3110
+ let { start: t, end: n } = a(e), r = n ? "," + encodeURIComponent(n) : "";
3111
+ return "#:~:text=" + (encodeURIComponent(t) + r);
3112
+ };
3113
+ try {
3114
+ let t = JSON.parse(e);
3115
+ if (Array.isArray(t)) return t.map((e) => typeof e == "object" && e && "text" in e ? {
3116
+ ...e,
3117
+ text: `${e.text} [${r}](${i}${o(e.text)})`
3118
+ } : `${e} [${r}](${i}${o(String(e))})`);
3119
+ if (typeof t == "object" && t) return Object.entries(t).map(([e, t]) => `${t} [${r}](${i}${o(String(t))})`);
3120
+ if (typeof t == "string") return [`${t} [${r}](${i}${o(t)})`];
3121
+ } catch {}
3122
+ return [e];
3123
+ };
3124
+ function Wn(e) {
3125
+ return e.replaceAll("&", "&amp;").replace(/[\\`*_[\]<>]/g, "\\$&").replace(/\r\n?|\n/g, " ");
3126
+ }
3127
+ function $(e) {
3128
+ let t = e.replace(/[\x00-\x20\x7f]/g, "");
3129
+ return /^(?:javascript|vbscript|data):/i.test(t) ? "" : e.replace(/&(?=(?:#\d+|#x[\da-f]+|[a-z][a-z\d]+);)/gi, "%26").replace(/[\x00-\x20\x7f()\[\]<>\\"`]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}`);
3130
+ }
3131
+ var Gn = (e, t) => {
3132
+ if (!e.trim()) return e;
3133
+ let n = "";
3134
+ t && (n = g(t) ?? n), n = Wn(n);
3135
+ try {
3136
+ let t = JSON.parse(e), r = (e) => Object.entries(e).map(([e, t]) => typeof t == "object" && t ? r(t) : `![${Wn(String(t))}](${$(e)})`).flat();
3137
+ if (Array.isArray(t)) return t.map((e) => typeof e == "object" && e ? r(e) : e ? `![${n}](${$(String(e))})` : "").flat();
3138
+ if (typeof t == "object" && t) return r(t);
3139
+ } catch {
3140
+ return `![${n}](${$(e)})`;
3141
+ }
3142
+ return e;
3143
+ }, Kn = 1e3, qn = (e) => {
3144
+ if (!e) return { valid: !0 };
3145
+ let t = _(e) ?? "", n = Number(t);
3146
+ return /^\d+$/.test(t) && Number.isSafeInteger(n) && n <= Kn ? { valid: !0 } : {
3147
+ valid: !1,
3148
+ error: `requires an integer from 0 to ${Kn} spaces (e.g., indent:2)`
3149
+ };
3150
+ }, Jn = (e, t) => {
3151
+ if (!qn(t).valid) return e;
3152
+ let n = t ? Number(_(t)) : 2, r = " ".repeat(n);
3153
+ return e.replace(/[^\r\n]+/g, (e) => r + e);
3154
+ }, Yn = (e, t) => {
3155
+ if (!e || e === "undefined" || e === "null") return "";
3156
+ let n;
3157
+ try {
3158
+ n = JSON.parse(e);
3159
+ } catch {
3160
+ return e;
3161
+ }
3162
+ if (!Array.isArray(n)) return e;
3163
+ let r = ",";
3164
+ return t && (r = g(t) ?? r, r = r.replace(/\\n/g, "\n")), n.join(r);
3165
+ }, Xn = (e) => e.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase(), Zn = (e, t, n) => {
3166
+ let r = Ht(e, n);
3167
+ return Array.isArray(r) ? r.length > 0 ? r[r.length - 1] : null : r;
3168
+ }, Qn = [
3169
+ "numbered",
3170
+ "task",
3171
+ "numbered-task"
3172
+ ], $n = (e) => {
3173
+ if (!e) return { valid: !0 };
3174
+ let t = _(e);
3175
+ return !t || !Qn.includes(t) ? {
3176
+ valid: !1,
3177
+ error: `invalid list type "${t ?? ""}". Use "numbered", "task", or "numbered-task"`
3178
+ } : { valid: !0 };
3179
+ }, er = (e, t) => {
3180
+ let n = _(t);
3181
+ if (e === "") return e;
3182
+ let r = (e, t, n = 0) => {
3183
+ let r = " ".repeat(n), a;
3184
+ switch (t) {
3185
+ case "numbered":
3186
+ a = "1. ";
3187
+ break;
3188
+ case "task":
3189
+ a = "- [ ] ";
3190
+ break;
3191
+ case "numbered-task":
3192
+ a = "1. [ ] ";
3193
+ break;
3194
+ default: a = "- ";
3195
+ }
3196
+ return Array.isArray(e) ? i(e, t, n + 1) : `${r}${a}${e}`;
3197
+ }, i = (e, t, n = 0) => e.map((e, i) => {
3198
+ let a = t;
3199
+ if (t === "numbered" || t === "numbered-task") {
3200
+ let t = i + 1;
3201
+ return r(e, a, n).replace(/^\d+/, t.toString());
3202
+ }
3203
+ return r(e, a, n);
3204
+ }).join("\n"), a = (e) => {
3205
+ switch (e) {
3206
+ case "numbered": return "numbered";
3207
+ case "task": return "task";
3208
+ case "numbered-task": return "numbered-task";
3209
+ default: return "bullet";
3210
+ }
3211
+ };
3212
+ try {
3213
+ let t = typeof e == "string" ? JSON.parse(e) : e;
3214
+ return i(Array.isArray(t) ? t : [t], a(n));
3215
+ } catch {
3216
+ return r(e, a(n));
3217
+ }
3218
+ }, tr = (e, t) => {
3219
+ if (!e.trim()) return e;
3220
+ let n = "link";
3221
+ t && (n = g(t) ?? n), n = Wn(n);
3222
+ try {
3223
+ let t = JSON.parse(e), r = (e) => Object.entries(e).map(([e, t]) => typeof t == "object" && t ? r(t) : `[${Wn(String(t))}](${$(e)})`).flat();
3224
+ if (Array.isArray(t)) return t.map((e) => typeof e == "object" && e ? r(e) : e ? `[${n}](${$(String(e))})` : "").join("\n");
3225
+ if (typeof t == "object" && t) return r(t).join("\n");
3226
+ } catch {
3227
+ return `[${n}](${$(e)})`;
3228
+ }
3229
+ return e;
3230
+ }, nr = (e, t, n) => {
3231
+ let r = q(e, n, !0);
3232
+ return Array.isArray(r) ? r.length : K(r) ? Object.keys(r).length : e.length;
3233
+ }, rr = (e) => {
3234
+ let t = (e) => e.toLocaleLowerCase();
3235
+ return Array.isArray(e) ? e.map(t) : t(e);
3236
+ }, ir = (e) => {
3237
+ if (!e) return {
3238
+ valid: !1,
3239
+ error: "requires a property path or arrow function (e.g., map:\"name\")"
3240
+ };
3241
+ if (e.match(/^\s*(\w+)\s*=>\s*(.+)$/)) return { valid: !0 };
3242
+ let t = C(d(e));
3243
+ return t.length !== 1 || f(t[0]) === "" ? {
3244
+ valid: !1,
3245
+ error: "requires a property path or arrow function (e.g., map:\"name\")"
3246
+ } : f(t[0]).split(".").some((e) => e === "") ? {
3247
+ valid: !1,
3248
+ error: "property path cannot contain empty segments"
3249
+ } : { valid: !0 };
3250
+ };
3251
+ function ar(e, t) {
3252
+ let n;
3253
+ try {
3254
+ n = JSON.parse(e);
3255
+ } catch {
3256
+ n = [e];
3257
+ }
3258
+ if (Array.isArray(n) && t) {
3259
+ let r = t.match(/^\s*(\w+)\s*=>\s*(.+)$/);
3260
+ if (!r) return e;
3261
+ let [, i, a] = r, o = n.map((e) => {
3262
+ let t = a.trim();
3263
+ if (t.startsWith("(") && t.endsWith(")") && (t = t.slice(1, -1).trim()), t.startsWith("{") && t.endsWith("}") || t.startsWith("\"") && t.endsWith("\"") || t.startsWith("'") && t.endsWith("'")) {
3264
+ let n = /* @__PURE__ */ Object.create(null);
3265
+ if (t.startsWith("{")) C(t.slice(1, -1)).forEach((t) => {
3266
+ let [r, a] = S(t);
3267
+ if (a === void 0) return;
3268
+ let o = r.replace(/^['"](.+)['"]$/, "$1"), s = cr(a, e, i);
3269
+ n[o] = s;
3270
+ });
3271
+ else return t.slice(1, -1).replace(RegExp(`\\$\\{${i}\\}`, "g"), e);
3272
+ return n;
3273
+ }
3274
+ return cr(a, e, i);
3275
+ });
3276
+ return JSON.stringify(o);
3277
+ }
3278
+ return e;
3279
+ }
3280
+ function or(e, t) {
3281
+ let n = t?.rawArguments?.[0];
3282
+ return n === void 0 ? f(d(e)) : typeof n == "string" ? n : void 0;
3283
+ }
3284
+ var sr = (e, t, n) => {
3285
+ if (!t) return e;
3286
+ if (/^\s*\w+\s*=>\s*(.+)$/.test(t)) return ar(e, t);
3287
+ let r = or(t, n);
3288
+ if (!r) return J(e, n);
3289
+ let i = J(e, n);
3290
+ return Array.isArray(i) ? i.map((e) => {
3291
+ let t = pt(e, r);
3292
+ return t.exists ? t.value : null;
3293
+ }) : i;
3294
+ };
3295
+ function cr(e, t, n) {
3296
+ if (typeof t == "string") return t;
3297
+ let r = e.replace(RegExp(`${n}\\.([\\w.\\[\\]]+)`, "g"), (e, n) => {
3298
+ let r = lr(t, n);
3299
+ return JSON.stringify(r);
3300
+ });
3301
+ try {
3302
+ return JSON.parse(r);
3303
+ } catch {
3304
+ return r.replace(/^["'](.+)["']$/, "$1");
3305
+ }
3306
+ }
3307
+ function lr(e, t) {
3308
+ return t.split(/[.\[\]]/).filter(Boolean).reduce((e, t) => U(e, t).value, e);
3309
+ }
3310
+ var ur = (e, t, n) => {
3311
+ if (!e || e === "undefined" || e === "null") return "[]";
3312
+ let r = n?.rawValue;
3313
+ if (!Array.isArray(r)) try {
3314
+ r = JSON.parse(e);
3315
+ } catch {
3316
+ r = [e];
3317
+ }
3318
+ let i = Array.isArray(r) ? r : [e];
3319
+ if (!t) return JSON.stringify(i);
3320
+ try {
3321
+ let e = n?.rawArguments?.length === 1 ? n.rawArguments[0] : void 0, r = v(typeof e == "string" && e.includes(",") ? e : t).map(f);
3322
+ return JSON.stringify([...i, ...r]);
3323
+ } catch (e) {
3324
+ return w(n, `Could not merge values: ${T(e)}`), JSON.stringify(i);
3325
+ }
3326
+ }, dr = (e) => {
3327
+ if (!e) return { valid: !0 };
3328
+ if (e.includes(":")) {
3329
+ let [t, n] = e.split(":").map((e) => e.trim()), r = t.split(",").map((e) => parseInt(e.trim(), 10)), i = parseInt(n, 10);
3330
+ return r.some((e) => isNaN(e) || e < 1) ? {
3331
+ valid: !1,
3332
+ error: "positions must be positive numbers (e.g., nth:1,2,3:7)"
3333
+ } : isNaN(i) || i < 1 ? {
3334
+ valid: !1,
3335
+ error: "basis must be a positive number (e.g., nth:1,2,3:7)"
3336
+ } : { valid: !0 };
3337
+ }
3338
+ let t = e.trim();
3339
+ return /^\d+$/.test(t) || /^\d+n$/.test(t) || /^n\+\d+$/.test(t) ? { valid: !0 } : {
3340
+ valid: !1,
3341
+ error: "invalid syntax. Use number (2), multiplier (5n), offset (n+7), or basis (1,2:5)"
3342
+ };
3343
+ }, fr = (e, t, n) => {
3344
+ let r = Ht(e, n);
3345
+ if (!Array.isArray(r)) {
3346
+ if (typeof r == "string" && r && r !== "undefined" && r !== "null") try {
3347
+ JSON.parse(e);
3348
+ } catch {
3349
+ w(n, "Could not parse value as a JSON array", "INVALID_FILTER_INPUT");
3350
+ }
3351
+ return r;
3352
+ }
3353
+ if (!t) return r;
3354
+ if (t.includes(":")) {
3355
+ let [e, n] = t.split(":").map((e) => e.trim()), i = e.split(",").map((e) => parseInt(e.trim(), 10)).filter((e) => !isNaN(e) && e > 0), a = parseInt(n, 10);
3356
+ return r.filter((e, t) => {
3357
+ let n = t % a + 1;
3358
+ return i.includes(n);
3359
+ });
3360
+ }
3361
+ let i = t.trim();
3362
+ if (/^\d+$/.test(i)) {
3363
+ let e = parseInt(i, 10);
3364
+ return r.filter((t, n) => n + 1 === e);
3365
+ }
3366
+ if (/^\d+n$/.test(i)) {
3367
+ let e = parseInt(i, 10);
3368
+ return r.filter((t, n) => (n + 1) % e === 0);
3369
+ }
3370
+ let a = i.match(/^n\+(\d+)$/);
3371
+ if (a) {
3372
+ let e = parseInt(a[1], 10);
3373
+ return r.filter((t, n) => n + 1 >= e);
3374
+ }
3375
+ return r;
3376
+ }, pr = (e, t, n) => {
3377
+ let r = (e, t, n, r) => {
3378
+ let i = e.toFixed(t).split(".");
3379
+ return i[0] = i[0].replace(/\B(?=(\d{3})+(?!\d))/g, r), i.join(n);
3380
+ }, i = (e, t, n, a) => {
3381
+ if (typeof e == "number" || typeof e == "string" && !isNaN(parseFloat(e))) return r(typeof e == "string" ? parseFloat(e) : e, t, n, a);
3382
+ if (Array.isArray(e)) return e.map((e) => i(e, t, n, a));
3383
+ if (typeof e == "object" && e) {
3384
+ let r = {};
3385
+ for (let [o, s] of Object.entries(e)) r[o] = i(s, t, n, a);
3386
+ return r;
3387
+ }
3388
+ return e;
3389
+ }, a = (e) => e.replace(/\\(.)/g, "$1");
3390
+ try {
3391
+ let n = 0, r = ".", o = ",";
3392
+ if (t) {
3393
+ let e = C(d(t)).map(f);
3394
+ e.length >= 1 && (n = parseInt(e[0], 10)), e.length >= 2 && (r = a(e[1])), e.length >= 3 && (o = a(e[2]));
3395
+ }
3396
+ isNaN(n) && (n = 0);
3397
+ let s;
3398
+ try {
3399
+ s = JSON.parse(e);
3400
+ } catch {
3401
+ s = e;
3402
+ }
3403
+ let c = i(s, n, r, o);
3404
+ return typeof c == "string" ? c : JSON.stringify(c);
3405
+ } catch (t) {
3406
+ return w(n, `Could not format number: ${T(t)}`), e;
3407
+ }
3408
+ }, mr = [
3409
+ "array",
3410
+ "keys",
3411
+ "values"
3412
+ ], hr = (e) => {
3413
+ if (!e) return {
3414
+ valid: !1,
3415
+ error: "requires a parameter: \"array\", \"keys\", or \"values\""
3416
+ };
3417
+ let t = _(e);
3418
+ return !t || !mr.includes(t) ? {
3419
+ valid: !1,
3420
+ error: `invalid parameter "${t ?? ""}". Use "array", "keys", or "values"`
3421
+ } : { valid: !0 };
3422
+ }, gr = (e, t, n) => {
3423
+ let r = _(t);
3424
+ try {
3425
+ let t = JSON.parse(e);
3426
+ if (typeof t == "object" && t) switch (r) {
3427
+ case "array": return JSON.stringify(Object.entries(t));
3428
+ case "keys": return JSON.stringify(Object.keys(t));
3429
+ case "values": return JSON.stringify(Object.values(t));
3430
+ default: return e;
3431
+ }
3432
+ } catch {
3433
+ w(n, "Could not parse value as JSON", "INVALID_FILTER_INPUT");
3434
+ }
3435
+ return e;
3436
+ }, _r = (e) => e.replace(/[\s_-]+(.)/g, (e, t) => t.toUpperCase()).replace(/^(.)/, (e) => e.toUpperCase()), vr = (e, t, n) => {
3437
+ if (n && Object.prototype.hasOwnProperty.call(n, "rawValue") && typeof n.rawValue != "string") return n.rawValue;
3438
+ try {
3439
+ return JSON.parse(e);
3440
+ } catch {
3441
+ return w(n, "Could not parse value as JSON", "INVALID_FILTER_INPUT"), e;
3442
+ }
3443
+ }, yr = (e) => {
3444
+ if (!e || e === "undefined" || e === "null") return "";
3445
+ try {
3446
+ let t = JSON.parse(e);
3447
+ if (Array.isArray(t)) return JSON.stringify(t.reverse());
3448
+ if (typeof t == "object" && t) {
3449
+ let e = Object.entries(t).reverse(), n = Object.fromEntries(e);
3450
+ return JSON.stringify(n);
3451
+ }
3452
+ } catch {
3453
+ return e.split("").reverse().join("");
3454
+ }
3455
+ return e;
3456
+ }, br = (e, t = "") => {
3457
+ if (!t) return e;
3458
+ let n = y(t).map((e) => e.toLowerCase()).filter(Boolean);
3459
+ return n.length === 0 ? e : e.replace(/<(\w+)\s+([^>]*?)>/g, (e, t, r) => {
3460
+ let i = /([a-zA-Z0-9_:-]+(?:\s*=\s*(?:"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|[^'"\s>]+))?)|(\s*\/?\s*$)/g, a = /^([a-zA-Z0-9_:-]+)/, o = [], s = Array.from(r.matchAll(i));
3461
+ for (let e of s) {
3462
+ let t = e[0], r = e[1], i = e[2];
3463
+ if (r) {
3464
+ let e = r.match(a);
3465
+ e && n.includes(e[0].toLowerCase()) || o.push(r);
3466
+ } else i && t && t.includes("/") && o.push(t.trim());
3467
+ }
3468
+ let c = o.join(" ").trim();
3469
+ return c ? `<${t} ${c}>` : `<${t}>`;
3470
+ });
3471
+ }, xr = (e, t = "") => {
3472
+ if (!t) return e;
3473
+ let n = y(t).filter(Boolean);
3474
+ if (n.length === 0) return e;
3475
+ let r = n.map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), i = RegExp(`<\\/?(?:${r})\\b[^>]*>`, "gi");
3476
+ return e.replace(i, "");
3477
+ }, Sr = (e) => {
3478
+ if (!e) return {
3479
+ valid: !1,
3480
+ error: "requires search and replacement (e.g., replace:\"old\":\"new\")"
3481
+ };
3482
+ let t = C(d(e)), n = t.length > 0 && t.every((e) => {
3483
+ let t = Cr(e);
3484
+ if (!t) return !1;
3485
+ let [n, r] = t, i = /^(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')$/.test(n.trim()), a = /^\/(?:\\.|[^/\\])+\/[gimsuy]*$/.test(n.trim()), o = r.trim() === "" || /^(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')$/.test(r.trim());
3486
+ return (i || a) && o;
3487
+ }), r = /["'][^"']*["']\s*:\s*["'][^"']*["']/.test(d(e)) || /["'][^"']*["']\s*:/.test(d(e)) || /\/[^/]+\/[gimsuy]*\s*:/.test(d(e));
3488
+ return !n && !r ? {
3489
+ valid: !1,
3490
+ error: "values must be quoted (e.g., replace:\"old\":\"new\" or replace:\"text\":\"\")"
3491
+ } : { valid: !0 };
3492
+ };
3493
+ function Cr(e) {
3494
+ let t = "", n = !1, r = !1;
3495
+ for (let i = 0; i < e.length; i++) {
3496
+ let a = e[i];
3497
+ if (r) r = !1;
3498
+ else if (a === "\\") r = !0;
3499
+ else if (t) a === t && (t = "");
3500
+ else if (n) a === "/" && (n = !1);
3501
+ else if (a === "\"" || a === "'") t = a;
3502
+ else if (a === "/" && e.slice(0, i).trim() === "") n = !0;
3503
+ else if (a === ":") return [e.slice(0, i), e.slice(i + 1)];
3504
+ }
3505
+ return null;
3506
+ }
3507
+ var wr = (e, t, n) => t ? C(d(t)).reduce((e, t) => {
3508
+ let r = t.split(/(?<=[^\\]["']):(?=["'])/), i = Cr(t) ?? (r.length >= 2 ? [r[0], r.slice(1).join(":")] : null);
3509
+ if (!i) return e;
3510
+ let [a, o] = i.map(f);
3511
+ o ||= "";
3512
+ let s = u(a);
3513
+ if (s) {
3514
+ if (n?.allowRegex === !1) throw new O("Regex replacements are disabled", "INVALID_FILTER_ARGUMENTS");
3515
+ try {
3516
+ return o = Tr(o), Er(e, new RegExp(s.pattern, s.flags), o, n);
3517
+ } catch (t) {
3518
+ if (t instanceof O) throw t;
3519
+ return w(n, `Invalid regular expression: ${T(t)}`, "INVALID_FILTER_INPUT"), e;
3520
+ }
3521
+ }
3522
+ if (a = Tr(a), o = Tr(o), a === "|" || a === ":" || a.includes("\n") || a.includes("\r") || a.includes(" ")) {
3523
+ let t = e.split(a);
3524
+ return n?.checkLength?.(e.length + (t.length - 1) * (o.length - a.length)), t.join(o);
3525
+ }
3526
+ return Er(e, new RegExp(a.replace(/([.*+?^${}()|[\]\\])/g, "\\$1"), "g"), o, n);
3527
+ }, e) : e;
3528
+ function Tr(e) {
3529
+ return e.replace(/\\([nrt]|[^nrt])/g, (e, t) => {
3530
+ switch (t) {
3531
+ case "n": return "\n";
3532
+ case "r": return "\r";
3533
+ case "t": return " ";
3534
+ default: return t;
3535
+ }
3536
+ });
3537
+ }
3538
+ function Er(e, t, n, r) {
3539
+ if (!r?.checkLength) return e.replace(t, n);
3540
+ let i = e.length;
3541
+ return e.replace(t, (t, ...a) => {
3542
+ let o = typeof a.at(-1) == "object" ? a.pop() : void 0;
3543
+ a.pop();
3544
+ let s = a.pop(), c = a, l = n.length, u = n.replace(/\$(\$|&|`|'|\d{1,2}|<[^>]*>)/g, (n, a) => {
3545
+ let u = (() => {
3546
+ if (a === "$") return "$";
3547
+ if (a === "&") return t;
3548
+ if (a === "`") return e.slice(0, s);
3549
+ if (a === "'") return e.slice(s + t.length);
3550
+ if (a.startsWith("<")) return o ? o[a.slice(1, -1)] ?? "" : n;
3551
+ let r = Number(a);
3552
+ if (r > 0 && r <= c.length) return c[r - 1] ?? "";
3553
+ let i = Number(a[0]);
3554
+ return a.length === 2 && i > 0 && i <= c.length ? (c[i - 1] ?? "") + a[1] : n;
3555
+ })();
3556
+ return l += u.length - n.length, r.checkLength(i - t.length + l), u;
3557
+ });
3558
+ return i += u.length - t.length, r.checkLength(i), u;
3559
+ });
3560
+ }
3561
+ var Dr = (e) => f(e).replace(/\\(.)/g, "$1"), Or = (e, t = "") => {
3562
+ let n = v(t).filter(Boolean), r = [];
3563
+ for (let e of n) {
3564
+ let [t, n] = S(e);
3565
+ r.push([Dr(t), n === void 0 ? "" : Dr(n)]);
3566
+ }
3567
+ if (r.some(([e, t]) => !/^[a-z][\w:-]*$/i.test(e) || t !== "" && !/^[a-z][\w:-]*$/i.test(t))) throw new O("replace_tags requires tag names", "INVALID_FILTER_ARGUMENTS");
3568
+ if (r.length === 0) return e;
3569
+ let i = e;
3570
+ return r.forEach(([e, t]) => {
3571
+ if (!e) return;
3572
+ let n = RegExp(`<${e}(\\s+[^>]*?)?>`, "g"), r = RegExp(`</${e}>`, "g");
3573
+ i = i.replace(n, (e, n) => t ? `<${t}${n || ""}>` : "").replace(r, t ? `</${t}>` : "");
3574
+ }), i;
3575
+ }, kr = (e) => {
3576
+ if (!e) return { valid: !0 };
3577
+ let t = parseInt(_(e) ?? "", 10);
3578
+ return isNaN(t) ? {
3579
+ valid: !1,
3580
+ error: "decimal places must be a number (e.g., round:2)"
3581
+ } : t < 0 ? {
3582
+ valid: !1,
3583
+ error: "decimal places must be non-negative (e.g., round:2)"
3584
+ } : { valid: !0 };
3585
+ }, Ar = (e, t, n) => {
3586
+ let r = (e, t) => {
3587
+ if (t === void 0) {
3588
+ let t = Math.round(e);
3589
+ return Number.isFinite(t) ? t : void 0;
3590
+ }
3591
+ let n = 10 ** t, r = Math.round(e * n) / n;
3592
+ return Number.isFinite(r) ? r : void 0;
3593
+ }, i = !1, a = (e, t) => {
3594
+ if (typeof e == "number") {
3595
+ if (!Number.isFinite(e)) return i = !0, e;
3596
+ let n = r(e, t);
3597
+ return n === void 0 ? (i = !0, e) : n;
3598
+ }
3599
+ if (typeof e == "string") {
3600
+ let n = Vt(e);
3601
+ if (n === void 0) return e;
3602
+ let a = r(n, t);
3603
+ return a === void 0 ? (i = !0, e) : a;
3604
+ }
3605
+ if (Array.isArray(e)) return e.map((e) => a(e, t));
3606
+ if (K(e)) {
3607
+ let n = {};
3608
+ for (let [r, i] of Object.entries(e)) n[r] = a(i, t);
3609
+ return n;
3610
+ }
3611
+ return e;
3612
+ };
3613
+ try {
3614
+ let o = _(t), s = o ? parseInt(o, 10) : void 0;
3615
+ if (o !== void 0 && isNaN(Number(o))) return J(e, n, !0);
3616
+ let c = J(e, n, !0);
3617
+ if (c == null) return c;
3618
+ if (!Array.isArray(c) && !K(c)) {
3619
+ let t = Vt(c);
3620
+ if (t === void 0) return w(n, `Could not parse "${e}" as a number`, "INVALID_FILTER_INPUT"), c;
3621
+ let i = r(t, s);
3622
+ return i === void 0 ? (w(n, `Rounding produced a non-finite result for "${e}"`, "INVALID_FILTER_INPUT"), c) : i;
3623
+ }
3624
+ let l = a(c, s);
3625
+ return i && w(n, "Could not round one or more non-finite collection values", "INVALID_FILTER_INPUT"), l;
3626
+ } catch (t) {
3627
+ return w(n, `Could not round value: ${T(t)}`), J(e, n, !0);
3628
+ }
3629
+ }, jr = [
3630
+ "windows",
3631
+ "mac",
3632
+ "linux"
3633
+ ], Mr = (e) => {
3634
+ if (!e) return { valid: !0 };
3635
+ let t = _(e)?.toLowerCase();
3636
+ return !t || !jr.includes(t) ? {
3637
+ valid: !1,
3638
+ error: `invalid OS "${t ?? ""}". Use "windows", "mac", or "linux"`
3639
+ } : { valid: !0 };
3640
+ }, Nr = (e, t) => {
3641
+ let n = _(t)?.toLowerCase() ?? "default", r = e;
3642
+ switch (r = r.replace(/[#|\^\[\]]/g, ""), n) {
3643
+ case "windows":
3644
+ r = r.replace(/[<>:"\/\\|?*\x00-\x1F]/g, "").replace(/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i, "_$1$2").replace(/[\s.]+$/, "");
3645
+ break;
3646
+ case "mac":
3647
+ r = r.replace(/[\/:\x00-\x1F]/g, "").replace(/^\./, "_");
3648
+ break;
3649
+ case "linux":
3650
+ r = r.replace(/[\/\x00-\x1F]/g, "").replace(/^\./, "_");
3651
+ break;
3652
+ default: r = r.replace(/[<>:"\/\\|?*:\x00-\x1F]/g, "").replace(/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i, "_$1$2").replace(/[\s.]+$/, "").replace(/^\./, "_");
3653
+ }
3654
+ return r = r.replace(/^\.+/, "").slice(0, 245), r.length === 0 && (r = "Untitled"), r;
3655
+ }, Pr = (e) => C(d(e)).map(h), Fr = (e) => {
3656
+ if (!e) return {
3657
+ valid: !1,
3658
+ error: "requires at least a start index (e.g., slice:0,5)"
3659
+ };
3660
+ let t = Pr(e);
3661
+ if (t.length > 2) return {
3662
+ valid: !1,
3663
+ error: "accepts at most 2 parameters: start and end"
3664
+ };
3665
+ for (let e of t) if (e !== "" && isNaN(parseInt(e, 10))) return {
3666
+ valid: !1,
3667
+ error: `"${e}" is not a valid number`
3668
+ };
3669
+ return { valid: !0 };
3670
+ }, Ir = (e, t, n) => {
3671
+ if (!t || e === "") return e;
3672
+ let [r, i] = Pr(t).map((e) => {
3673
+ if (e === "") return;
3674
+ let t = parseInt(e, 10);
3675
+ return isNaN(t) ? void 0 : t;
3676
+ }), a;
3677
+ try {
3678
+ a = JSON.parse(e);
3679
+ } catch {
3680
+ (e.startsWith("[") || e.startsWith("{")) && w(n, "Could not parse structured value as JSON", "INVALID_FILTER_INPUT"), a = e;
3681
+ }
3682
+ if (Array.isArray(a)) {
3683
+ let e = a.slice(r, i);
3684
+ return e.length === 1 ? e[0] == null ? "" : e[0].toString() : JSON.stringify(e);
3685
+ }
3686
+ return e.slice(r, i);
3687
+ }, Lr = (e) => e.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase();
3688
+ function Rr(e) {
3689
+ if (!e) return { direction: "asc" };
3690
+ let t = C(d(e)).map(h);
3691
+ return t.length === 1 && (t[0] === "asc" || t[0] === "desc") ? { direction: t[0] } : {
3692
+ property: t[0] || void 0,
3693
+ direction: t[1] || "asc"
3694
+ };
3695
+ }
3696
+ var zr = (e) => {
3697
+ if (!e) return { valid: !0 };
3698
+ let t = C(d(e)).map(h);
3699
+ if (t.length > 2) return {
3700
+ valid: !1,
3701
+ error: "accepts at most a property and direction"
3702
+ };
3703
+ if (t.length === 2 && !t[0]) return {
3704
+ valid: !1,
3705
+ error: "property cannot be empty"
3706
+ };
3707
+ let n = t.length === 1 && (t[0] === "asc" || t[0] === "desc") ? t[0] : t[1] || "asc";
3708
+ return n !== "asc" && n !== "desc" ? {
3709
+ valid: !1,
3710
+ error: `invalid direction "${n}". Use "asc" or "desc"`
3711
+ } : { valid: !0 };
3712
+ };
3713
+ function Br(e, t) {
3714
+ return t ? t.split(".").reduce((e, t) => e && typeof e == "object" ? e[t] : void 0, e) : e;
3715
+ }
3716
+ function Vr(e, t) {
3717
+ if (e === t) return 0;
3718
+ if (e == null) return 1;
3719
+ if (t == null) return -1;
3720
+ if (typeof e == "number" && typeof t == "number") return e - t;
3721
+ let n = typeof e == "string" ? e : JSON.stringify(e), r = typeof t == "string" ? t : JSON.stringify(t);
3722
+ return n < r ? -1 : +(n > r);
3723
+ }
3724
+ var Hr = (e, t, n) => {
3725
+ let r = q(e, n);
3726
+ if (!Array.isArray(r)) return r;
3727
+ let { property: i, direction: a } = Rr(t);
3728
+ return [...r].sort((e, t) => {
3729
+ let n = Br(e, i), r = Br(t, i), o = Vr(n, r);
3730
+ return n == null || r == null ? o : a === "desc" ? -o : o;
3731
+ });
3732
+ }, Ur = (e, t, n) => {
3733
+ if (!t || t === "") return JSON.stringify(e.split(""));
3734
+ t = g(t) ?? "";
3735
+ let r = t.length === 1 || n?.allowRegex === !1 ? t : new RegExp(t), i = e.split(r);
3736
+ return JSON.stringify(i);
3737
+ }, Wr = (e) => {
3738
+ if (!e) return { valid: !0 };
3739
+ let t = C(d(e));
3740
+ if (t.length !== 1) return {
3741
+ valid: !1,
3742
+ error: "accepts at most one property path"
3743
+ };
3744
+ let n = f(t[0]);
3745
+ return n ? n.split(".").some((e) => e === "") ? {
3746
+ valid: !1,
3747
+ error: "property path cannot contain empty segments"
3748
+ } : { valid: !0 } : {
3749
+ valid: !1,
3750
+ error: "property path cannot be empty"
3751
+ };
3752
+ }, Gr = (e, t, n) => {
3753
+ let r = J(e, n);
3754
+ if (!Array.isArray(r)) return r;
3755
+ let i = (n?.rawArguments ?? x(t) ?? [])[0];
3756
+ if (i !== void 0 && (typeof i != "string" || !i)) return r;
3757
+ let a = 0;
3758
+ for (let e of r) {
3759
+ let t = e;
3760
+ if (typeof i == "string") {
3761
+ let n = pt(e, i);
3762
+ if (!n.exists) continue;
3763
+ t = n.value;
3764
+ }
3765
+ let n = Vt(t);
3766
+ n !== void 0 && (a += n);
3767
+ }
3768
+ return a;
3769
+ }, Kr = (e, t = "") => {
3770
+ let n = y(t).filter(Boolean);
3771
+ return e.replace(/<(\w+)\s+(?:[^>]*?)>/g, (e, t) => {
3772
+ if (n.length === 0) return `<${t}>`;
3773
+ let r = n.map((t) => {
3774
+ let n = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), r = RegExp(`\\s${n}\\s*=\\s*("[^"]*"|'[^']*')`, "i"), i = e.match(r);
3775
+ return i ? i[0].trim() : "";
3776
+ }).filter(Boolean).join(" ");
3777
+ return r ? `<${t} ${r}>` : `<${t}>`;
3778
+ });
3779
+ }, qr = (e, t = "") => {
3780
+ let n = y(t).filter(Boolean), r;
3781
+ if (n.length === 0) r = e.replace(/<\/?[^>]+(>|$)/g, "");
3782
+ else {
3783
+ let t = n.map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), i = RegExp(`<(?!\\/?(?:${t})\\b)[^>]+>`, "gi");
3784
+ r = e.replace(i, "");
3785
+ }
3786
+ return r = r.replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"").replace(/&#39;/g, "'").replace(/&ldquo;/g, "\"").replace(/&rdquo;/g, "\"").replace(/&lsquo;/g, "'").replace(/&rsquo;/g, "'").replace(/&mdash;/g, "—").replace(/&ndash;/g, "–").replace(/&hellip;/g, "…").replace(/&#(\d+);/g, (e, t) => String.fromCharCode(Number(t))).replace(/&#x([0-9A-Fa-f]+);/g, (e, t) => String.fromCharCode(parseInt(t, 16))), r = r.replace(/\n{3,}/g, "\n\n"), r.trim();
3787
+ };
3788
+ function Jr(e) {
3789
+ return e ? C(d(e)).map(f) : [];
3790
+ }
3791
+ var Yr = (e) => e.replace(/\|/g, "\\|"), Xr = (e) => Array.from(e).length, Zr = (e, t) => `${e}${" ".repeat(t - Xr(e))}`;
3792
+ function Qr(e, t, n) {
3793
+ let r = n;
3794
+ for (let n of e) r = Math.max(r, Xr(n[t]));
3795
+ return r;
3796
+ }
3797
+ function $r(e) {
3798
+ let t = 0;
3799
+ for (let n of e) t = Math.max(t, n.length);
3800
+ return t;
3801
+ }
3802
+ function ei(e, t, n) {
3803
+ let r = e.length, i = e.map((e) => Yr(String(e))), a = t.map((e) => [...e, ...Array(Math.max(0, r - e.length)).fill("")].slice(0, r).map((e) => Yr(String(e))));
3804
+ if (!n) return [
3805
+ `| ${i.join(" | ")} |`,
3806
+ `| ${i.map(() => "-").join(" | ")} |`,
3807
+ ...a.map((e) => `| ${e.join(" | ")} |`)
3808
+ ].join("\n");
3809
+ let o = i.map((e, t) => Qr(a, t, Math.max(3, Xr(e)))), s = (e) => `| ${e.map((e, t) => Zr(e, o[t])).join(" | ")} |`;
3810
+ return [
3811
+ s(i),
3812
+ `| ${o.map((e) => "-".repeat(e)).join(" | ")} |`,
3813
+ ...a.map(s)
3814
+ ].join("\n");
3815
+ }
3816
+ var ti = (e, t, n, r) => {
3817
+ if (!e || e === "undefined" || e === "null") return e;
3818
+ try {
3819
+ let n = JSON.parse(e), i = Jr(t);
3820
+ if (typeof n == "object" && n && !Array.isArray(n)) {
3821
+ let t = Object.entries(n);
3822
+ return t.length === 0 ? e : ei(t[0], t.slice(1), r);
3823
+ }
3824
+ if (Array.isArray(n) && n.length > 0 && Array.isArray(n[0])) {
3825
+ let e = $r(n);
3826
+ return ei(i.length > 0 ? [...i, ...Array(Math.max(0, e - i.length)).fill("")] : Array(e).fill(""), n, r);
3827
+ }
3828
+ if (Array.isArray(n) && n.length > 0 && typeof n[0] == "object" && n[0] !== null) {
3829
+ let e = i.length > 0 ? i : Object.keys(n[0]);
3830
+ return ei(e, n.map((t) => e.map((e) => t[e] ?? "")), r);
3831
+ }
3832
+ if (Array.isArray(n)) {
3833
+ if (i.length > 0) {
3834
+ let e = [];
3835
+ for (let t = 0; t < n.length; t += i.length) e.push(n.slice(t, t + i.length));
3836
+ return ei(i, e, r);
3837
+ }
3838
+ return ei(["Value"], n.map((e) => [e]), r);
3839
+ }
3840
+ return e;
3841
+ } catch {
3842
+ return w(n, "Could not parse value as JSON table data", "INVALID_FILTER_INPUT"), e;
3843
+ }
3844
+ }, ni = (e, t, n) => ti(e, t, n, !1), ri = (e, t, n) => ti(e, t, n, !0), ii = (e) => e ? { valid: !0 } : {
3845
+ valid: !1,
3846
+ error: "requires a template string (e.g., template:\"${name}\")"
3847
+ }, ai = (e, t) => {
3848
+ if (!t) return typeof e == "string" ? e : JSON.stringify(e);
3849
+ t = g(t) ?? "";
3850
+ let n = [];
3851
+ if (typeof e == "string") try {
3852
+ n = JSON.parse(e);
3853
+ } catch {
3854
+ n = [e];
3855
+ }
3856
+ else n = e;
3857
+ return n = Array.isArray(n) ? n : [n], n.map((e) => oi(e, t)).join("\n\n");
3858
+ };
3859
+ function oi(e, t) {
3860
+ if (typeof e == "string") {
3861
+ let t = e;
3862
+ try {
3863
+ e = si(e);
3864
+ } catch {}
3865
+ e.str === void 0 && (e.str = t);
3866
+ }
3867
+ let n = t.replace(/\$\{([\w.]+)\}/g, (t, n) => {
3868
+ let r = ci(e, n);
3869
+ return r !== void 0 && r !== "undefined" ? r : "";
3870
+ });
3871
+ return n = n.replace(/\\n/g, "\n"), n = n.split("\n").filter((e) => e.trim() !== "").join("\n"), n.trim();
3872
+ }
3873
+ function si(e) {
3874
+ let t = /* @__PURE__ */ Object.create(null), n = /(\w+):\s*("(?:\\.|[^"\\])*"|[^,}]+)/g, r;
3875
+ for (; (r = n.exec(e)) !== null;) {
3876
+ let [, e, n] = r;
3877
+ n.startsWith("\"") && n.endsWith("\"") && (n = n.slice(1, -1)), t[e] = n === "undefined" ? void 0 : n;
3878
+ }
3879
+ return t;
3880
+ }
3881
+ function ci(e, t) {
3882
+ return pt(e, t).value;
3883
+ }
3884
+ var li = [
3885
+ "a",
3886
+ "an",
3887
+ "the",
3888
+ "and",
3889
+ "but",
3890
+ "or",
3891
+ "for",
3892
+ "nor",
3893
+ "on",
3894
+ "at",
3895
+ "to",
3896
+ "from",
3897
+ "by",
3898
+ "in",
3899
+ "of"
3900
+ ], ui = (e, t) => {
3901
+ let n = (e) => e.split(/\s+/).map((e, t) => t !== 0 && li.includes(e.toLowerCase()) ? e.toLowerCase() : e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" "), r = (e) => {
3902
+ if (typeof e == "string") return n(e);
3903
+ if (Array.isArray(e)) return e.map(r);
3904
+ if (typeof e == "object" && e) {
3905
+ let t = {};
3906
+ for (let [i, a] of Object.entries(e)) t[n(i)] = r(a);
3907
+ return t;
3908
+ }
3909
+ return e;
3910
+ };
3911
+ try {
3912
+ let t = r(JSON.parse(e));
3913
+ return JSON.stringify(t);
3914
+ } catch {
3915
+ return r(e);
3916
+ }
3917
+ }, di = (e) => e.trim(), fi = new Intl.Segmenter(void 0, { granularity: "grapheme" });
3918
+ function pi(e) {
3919
+ return [...fi.segment(e)].map((e) => e.segment);
3920
+ }
3921
+ function mi(e) {
3922
+ return e ? C(d(e)).map(h) : [];
3923
+ }
3924
+ function hi(e) {
3925
+ let t = mi(e);
3926
+ return {
3927
+ limit: Number.parseInt(t[0] ?? "0", 10),
3928
+ suffix: t[1] ?? "…"
3929
+ };
3930
+ }
3931
+ function gi(e, t) {
3932
+ let n = mi(e);
3933
+ return n.length === 0 || n[0] === "" ? {
3934
+ valid: !1,
3935
+ error: `requires a non-negative limit (e.g., ${t})`
3936
+ } : n.length > 2 ? {
3937
+ valid: !1,
3938
+ error: "accepts at most a limit and suffix"
3939
+ } : /^\d+$/.test(n[0]) ? { valid: !0 } : {
3940
+ valid: !1,
3941
+ error: "limit must be a non-negative integer"
3942
+ };
3943
+ }
3944
+ var _i = (e) => gi(e, "truncate:100"), vi = (e) => gi(e, "truncatewords:20");
3945
+ function yi(e, t) {
3946
+ if (t.limit === 0) return "";
3947
+ let n = pi(e);
3948
+ if (n.length <= t.limit) return e;
3949
+ let r = pi(t.suffix).slice(0, t.limit), i = Math.max(0, t.limit - r.length);
3950
+ return `${n.slice(0, i).join("")}${r.join("")}`;
3951
+ }
3952
+ function bi(e, t) {
3953
+ if (t.limit === 0) return "";
3954
+ let n = [...e.matchAll(/\S+/g)];
3955
+ if (n.length <= t.limit) return e;
3956
+ let r = n[t.limit - 1];
3957
+ return `${e.slice(0, r.index + r[0].length)}${t.suffix}`;
3958
+ }
3959
+ function xi(e, t, n, r) {
3960
+ let i = hi(t);
3961
+ return Y(q(e, n), (e) => r(e, i));
3962
+ }
3963
+ var Si = (e, t, n) => xi(e, t, n, yi), Ci = (e, t, n) => xi(e, t, n, bi), wi = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z])([A-Z][a-z])/g, "$1 $2").toLowerCase(), Ti = (e) => e.replace(/\\"/g, "\"").replace(/\\n/g, "\n"), Ei = (e) => {
3964
+ try {
3965
+ let t = JSON.parse(e);
3966
+ if (Array.isArray(t)) {
3967
+ if (t.every((e) => typeof e != "object")) return JSON.stringify([...new Set(t)]);
3968
+ let e = /* @__PURE__ */ new Set(), n = t.filter((t) => {
3969
+ let n = JSON.stringify(t);
3970
+ return !e.has(n) && (e.add(n), !0);
3971
+ });
3972
+ return JSON.stringify(n);
3973
+ }
3974
+ if (typeof t == "object" && t) {
3975
+ let e = Object.entries(t).reverse(), n = /* @__PURE__ */ new Set(), r = e.filter(([e, t]) => {
3976
+ let r = JSON.stringify(t);
3977
+ return !n.has(r) && (n.add(r), !0);
3978
+ }).reverse();
3979
+ return JSON.stringify(Object.fromEntries(r));
3980
+ }
3981
+ return e;
3982
+ } catch {
3983
+ return e;
3984
+ }
3985
+ }, Di = (e) => {
3986
+ let t = (e) => e.toLocaleUpperCase();
3987
+ return Array.isArray(e) ? e.map(t) : t(e);
3988
+ }, Oi = (e, t, n) => {
3989
+ if (!e.trim()) return e;
3990
+ let r = "";
3991
+ t && (r = g(t) ?? r);
3992
+ try {
3993
+ let t = JSON.parse(e), i = (e) => Object.entries(e).map(([e, t]) => typeof t == "object" && t ? i(t) : `${n}[[${e}|${t}]]`).flat();
3994
+ if (Array.isArray(t)) {
3995
+ let e = t.flatMap((e) => typeof e == "object" && e ? i(e) : e ? r ? `${n}[[${e}|${r}]]` : `${n}[[${e}]]` : "");
3996
+ return JSON.stringify(e);
3997
+ }
3998
+ if (typeof t == "object" && t) return JSON.stringify(i(t));
3999
+ } catch {
4000
+ return r ? `${n}[[${e}|${r}]]` : `${n}[[${e}]]`;
4001
+ }
4002
+ return e;
4003
+ }, ki = (e, t, n) => Oi(Array.isArray(n?.rawValue) ? JSON.stringify(n.rawValue) : e, t, ""), Ai = (e, t, n) => Oi(Array.isArray(n?.rawValue) ? JSON.stringify(n.rawValue) : e, t, "!");
4004
+ D.default.extend(le.default);
4005
+ var ji = (e, t, n) => {
4006
+ if (!e) return e;
4007
+ try {
4008
+ e = e.replace(/^["'](.*)["']$/g, "$1");
4009
+ let n = e.match(/^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/);
4010
+ if (!n) {
4011
+ let n = parseInt(e, 10);
4012
+ return isNaN(n) ? e : Mi(D.default.duration(n, "seconds"), t);
4013
+ }
4014
+ let [, r, i, a, o, s, c] = n, l = (r ? parseInt(r) * 365 * 24 * 3600 : 0) + (i ? parseInt(i) * 30 * 24 * 3600 : 0) + (a ? parseInt(a) * 24 * 3600 : 0) + (o ? parseInt(o) * 3600 : 0) + (s ? parseInt(s) * 60 : 0) + (c ? parseInt(c) : 0);
4015
+ return Mi(D.default.duration(l, "seconds"), t);
4016
+ } catch (t) {
4017
+ return w(n, `Could not format duration: ${T(t)}`), e;
4018
+ }
4019
+ };
4020
+ function Mi(e, t) {
4021
+ t ||= e.asHours() >= 1 ? "HH:mm:ss" : "mm:ss", t = t.replace(/^["'(](.*)["')]$/g, "$1");
4022
+ let n = Math.floor(e.asHours()), r = e.minutes(), i = e.seconds(), a = {
4023
+ HH: Ni(n),
4024
+ H: n.toString(),
4025
+ mm: Ni(r),
4026
+ m: r.toString(),
4027
+ ss: Ni(i),
4028
+ s: i.toString()
4029
+ };
4030
+ return t.replace(/HH|H|mm|m|ss|s/g, (e) => a[e].toString());
4031
+ }
4032
+ function Ni(e) {
4033
+ return e.toString().padStart(2, "0");
4034
+ }
4035
+ var Pi = (e) => !e || _(e) === "flow" ? { valid: !0 } : {
4036
+ valid: !1,
4037
+ error: "accepts only \"flow\"; omit the parameter for block YAML"
4038
+ };
4039
+ function Fi(e) {
4040
+ if (!e) return;
4041
+ let t = C(d(e));
4042
+ return t.length === 1 ? h(t[0]) : void 0;
4043
+ }
4044
+ var Ii = (e) => Fi(e)?.trim() ? { valid: !0 } : {
4045
+ valid: !1,
4046
+ error: "requires one non-empty property name (e.g., yaml_property:\"director\")"
4047
+ };
4048
+ function Li(e) {
4049
+ return JSON.stringify(e).replace(/[\u007f-\u009f\u2028\u2029]/g, (e) => `\\u${e.charCodeAt(0).toString(16).padStart(4, "0")}`);
4050
+ }
4051
+ function Ri(e) {
4052
+ return /^[a-z_][\w-]*$/i.test(e) && !/^(?:true|false|null|yes|no|on|off|y|n)$/i.test(e) ? e : Li(e);
4053
+ }
4054
+ function zi(e) {
4055
+ return typeof e == "object" && !!e && Object.keys(e).length > 0;
4056
+ }
4057
+ function Bi(e) {
4058
+ if (Array.isArray(e)) return e.length === 0 ? "[]" : e.map((e) => `- ${Bi(e).replace(/\n/g, "\n ")}`).join("\n");
4059
+ if (typeof e == "object" && e) {
4060
+ let t = Object.entries(e);
4061
+ return t.length === 0 ? "{}" : t.map(([e, t]) => zi(t) ? `${Ri(e)}:
4062
+ ${Bi(t).replace(/\n/g, "\n ")}` : `${Ri(e)}: ${Bi(t)}`).join("\n");
4063
+ }
4064
+ return Li(e);
4065
+ }
4066
+ function Vi(e) {
4067
+ return typeof e == "number" ? !Number.isFinite(e) : Array.isArray(e) ? e.some(Vi) : typeof e == "object" && e ? Object.values(e).some(Vi) : !1;
4068
+ }
4069
+ function Hi(e, t) {
4070
+ try {
4071
+ if ((Array.isArray(t?.rawValue) || K(t?.rawValue)) && Vi(t.rawValue)) {
4072
+ w(t, "Could not serialize a collection containing a number outside the finite JavaScript range", "INVALID_FILTER_INPUT");
4073
+ return;
4074
+ }
4075
+ let n = JSON.parse(Array.isArray(t?.rawValue) ? JSON.stringify(t.rawValue) : e);
4076
+ if (typeof n == "object" && n) {
4077
+ if (Vi(n)) {
4078
+ w(t, "Could not serialize a JSON collection containing a number outside the finite JavaScript range", "INVALID_FILTER_INPUT");
4079
+ return;
4080
+ }
4081
+ return n;
4082
+ }
4083
+ } catch {}
4084
+ }
4085
+ function Ui(e, t) {
4086
+ let n = t?.rawValue;
4087
+ return Li(n === null || typeof n == "boolean" || typeof n == "number" && Number.isFinite(n) ? n : e);
4088
+ }
4089
+ var Wi = (e, t, n) => {
4090
+ let r = Hi(e, n);
4091
+ return r ? _(t) === "flow" ? Li(r) : Bi(r) : Ui(e, n);
4092
+ }, Gi = (e, t, n) => {
4093
+ let r = Fi(t);
4094
+ if (!r?.trim()) return e;
4095
+ let i = Hi(e, n);
4096
+ return i ? Bi({ [r]: i }) : `${Ri(r)}: ${Ui(e, n)}`;
4097
+ }, Ki = (e) => {
4098
+ if (!e) return {
4099
+ valid: !1,
4100
+ error: "requires a property path and value"
4101
+ };
4102
+ let t = C(d(e));
4103
+ if (t.length !== 2) return {
4104
+ valid: !1,
4105
+ error: "requires exactly a property path and value"
4106
+ };
4107
+ let n = f(t[0]);
4108
+ return n ? n.split(".").some((e) => e === "") ? {
4109
+ valid: !1,
4110
+ error: "property path cannot contain empty segments"
4111
+ } : { valid: !0 } : {
4112
+ valid: !1,
4113
+ error: "property path cannot be empty"
4114
+ };
4115
+ };
4116
+ function qi(e) {
4117
+ return e === null || [
4118
+ "string",
4119
+ "number",
4120
+ "boolean"
4121
+ ].includes(typeof e);
4122
+ }
4123
+ var Ji = (e, t, n) => {
4124
+ let r = J(e, n);
4125
+ if (!Array.isArray(r)) return r;
4126
+ let [i, a] = n?.rawArguments ?? x(t) ?? [];
4127
+ return typeof i != "string" || !i || !qi(a) ? r : r.filter((e) => {
4128
+ let t = pt(e, i);
4129
+ return t.exists && t.value === a;
4130
+ });
4131
+ }, Yi = Object.freeze(Object.fromEntries(Object.entries({
4132
+ calc: {
4133
+ example: "calc:\"+10\"",
4134
+ validateParams: Tn
4135
+ },
4136
+ code: {
4137
+ example: "code:\"typescript\"",
4138
+ validateParams: vn
4139
+ },
4140
+ code_block: {
4141
+ example: "code_block:\"typescript\"",
4142
+ validateParams: vn
4143
+ },
4144
+ date_modify: {
4145
+ example: "date_modify:\"+1 day\"",
4146
+ validateParams: Pn
4147
+ },
4148
+ hr: {
4149
+ example: "hr:before",
4150
+ validateParams: pn
4151
+ },
4152
+ highlight: {
4153
+ example: "highlight:blue",
4154
+ validateParams: ln
4155
+ },
4156
+ map: {
4157
+ example: "map:x => x.name",
4158
+ validateParams: ir
4159
+ },
4160
+ replace: {
4161
+ example: "replace:\"old\":\"new\"",
4162
+ validateParams: Sr
4163
+ },
4164
+ slice: {
4165
+ example: "slice:0,5",
4166
+ validateParams: Fr
4167
+ },
4168
+ sort: {
4169
+ example: "sort:(\"name\", \"desc\")",
4170
+ validateParams: zr
4171
+ },
4172
+ sum: {
4173
+ example: "sum:\"amount\"",
4174
+ validateParams: Wr
4175
+ },
4176
+ template: {
4177
+ example: "template:\"${name}\"",
4178
+ validateParams: ii
4179
+ },
4180
+ truncate: {
4181
+ example: "truncate:(100, \"…\")",
4182
+ validateParams: _i
4183
+ },
4184
+ truncatewords: {
4185
+ example: "truncatewords:(20, \"…\")",
4186
+ validateParams: vi
4187
+ },
4188
+ where: {
4189
+ example: "where:(\"published\", true)",
4190
+ validateParams: Ki
4191
+ },
4192
+ blockquote: {},
4193
+ bold: {
4194
+ example: "bold:_",
4195
+ validateParams: tn
4196
+ },
4197
+ callout: { example: "callout:info" },
4198
+ camel: {},
4199
+ capitalize: {},
4200
+ compact: {},
4201
+ comment: {},
4202
+ date: { example: "date:\"YYYY-MM-DD\"" },
4203
+ decode_uri: {},
4204
+ duration: {},
4205
+ embed: { example: "embed:\"Preview\"" },
4206
+ encode_uri: {},
4207
+ escape_md: {},
4208
+ first: {},
4209
+ footnote: {},
4210
+ fragment_link: {},
4211
+ h1: {},
4212
+ h2: {},
4213
+ h3: {},
4214
+ h4: {},
4215
+ h5: {},
4216
+ h6: {},
4217
+ hard_break: {},
4218
+ image: {},
4219
+ indent: {
4220
+ example: "indent:2",
4221
+ validateParams: qn
4222
+ },
4223
+ italic: {
4224
+ example: "italic:_",
4225
+ validateParams: nn
4226
+ },
4227
+ join: { example: "join:\", \"" },
4228
+ kebab: {},
4229
+ last: {},
4230
+ length: {},
4231
+ link: {},
4232
+ list: {
4233
+ example: "list:numbered",
4234
+ validateParams: $n
4235
+ },
4236
+ lower: {},
4237
+ math: {},
4238
+ math_block: {},
4239
+ merge: {},
4240
+ nth: {
4241
+ example: "nth:2",
4242
+ validateParams: dr
4243
+ },
4244
+ number_format: {},
4245
+ object: {
4246
+ example: "object:\"keys\"",
4247
+ validateParams: hr
4248
+ },
4249
+ pascal: {},
4250
+ parse_json: {},
4251
+ remove_attr: {},
4252
+ remove_tags: {},
4253
+ replace_tags: {},
4254
+ reverse: {},
4255
+ round: {
4256
+ example: "round:2",
4257
+ validateParams: kr
4258
+ },
4259
+ safe_name: {
4260
+ example: "safe_name:windows",
4261
+ validateParams: Mr
4262
+ },
4263
+ snake: {},
4264
+ split: { example: "split:\",\"" },
4265
+ strip_attr: {},
4266
+ strip_md: {},
4267
+ strip_tags: {},
4268
+ stripmd: {},
4269
+ strike: {},
4270
+ table: {},
4271
+ table_pretty: {},
4272
+ title: {},
4273
+ trim: {},
4274
+ uncamel: {},
4275
+ unescape: {},
4276
+ unique: {},
4277
+ upper: {},
4278
+ wikilink: {},
4279
+ yaml: {
4280
+ example: "yaml:flow",
4281
+ validateParams: Pi
4282
+ },
4283
+ yaml_property: {
4284
+ example: "yaml_property:\"director\"",
4285
+ validateParams: Ii
4286
+ }
4287
+ }).map(([e, t]) => [e, Object.freeze({ ...t })]))), Xi = {
4288
+ blockquote: Bt,
4289
+ bold: rn,
4290
+ calc: En,
4291
+ callout: Dn,
4292
+ camel: On,
4293
+ capitalize: kn,
4294
+ compact: jn,
4295
+ code: yn,
4296
+ code_block: bn,
4297
+ comment: wn,
4298
+ date_modify: Fn,
4299
+ date: Mn,
4300
+ decode_uri: Ln,
4301
+ duration: ji,
4302
+ embed: Ai,
4303
+ encode_uri: zn,
4304
+ escape_md: Qt,
4305
+ first: Bn,
4306
+ footnote: Vn,
4307
+ fragment_link: Un,
4308
+ h1: Gt,
4309
+ h2: Kt,
4310
+ h3: qt,
4311
+ h4: Jt,
4312
+ h5: Yt,
4313
+ h6: Xt,
4314
+ hard_break: $t,
4315
+ highlight: un,
4316
+ hr: mn,
4317
+ image: Gn,
4318
+ indent: Jn,
4319
+ italic: an,
4320
+ join: Yn,
4321
+ kebab: Xn,
4322
+ last: Zn,
4323
+ length: nr,
4324
+ link: tr,
4325
+ list: er,
4326
+ lower: rr,
4327
+ map: sr,
4328
+ math: Sn,
4329
+ math_block: Cn,
4330
+ merge: ur,
4331
+ number_format: pr,
4332
+ nth: fr,
4333
+ object: gr,
4334
+ pascal: _r,
4335
+ parse_json: vr,
4336
+ reverse: yr,
4337
+ remove_attr: br,
4338
+ remove_tags: xr,
4339
+ replace: wr,
4340
+ replace_tags: Or,
4341
+ round: Ar,
4342
+ safe_name: Nr,
4343
+ slice: Ir,
4344
+ snake: Lr,
4345
+ sort: Hr,
4346
+ split: Ur,
4347
+ sum: Gr,
4348
+ strip_attr: Kr,
4349
+ strip_md: Hn,
4350
+ strip_tags: qr,
4351
+ stripmd: Hn,
4352
+ strike: on,
4353
+ table: ni,
4354
+ table_pretty: ri,
4355
+ template: ai,
4356
+ title: ui,
4357
+ trim: di,
4358
+ truncate: Si,
4359
+ truncatewords: Ci,
4360
+ uncamel: wi,
4361
+ unescape: Ti,
4362
+ unique: Ei,
4363
+ upper: Di,
4364
+ wikilink: ki,
4365
+ yaml: Wi,
4366
+ yaml_property: Gi,
4367
+ where: Ji
4368
+ };
4369
+ function Zi(e, t) {
4370
+ let n = (e, n, r) => t(e, n === "" ? void 0 : n, r);
4371
+ return n.metadata = Yi[e] ?? {}, n;
4372
+ }
4373
+ var Qi = Object.freeze(Object.fromEntries(Object.entries(Xi).map(([e, t]) => [e, Zi(e, t)])));
4374
+ //#endregion
4375
+ //#region src/client/components/charts/markdownTemplate.ts
4376
+ function $i(e) {
4377
+ return e.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2").replace(/[^A-Za-z0-9]+/g, "_").toLowerCase();
4378
+ }
4379
+ function ea(e) {
4380
+ let t = e.split(".").map($i).filter(Boolean).join("_").replace(/_+/g, "_").replace(/^_|_$/g, "");
4381
+ return t ? /^[0-9]/.test(t) ? `_${t}` : t : "field";
4382
+ }
4383
+ function ta(e, t) {
4384
+ if (!t.has(e)) return t.add(e), e;
4385
+ let n = 2;
4386
+ for (; t.has(`${e}_${n}`);) n++;
4387
+ let r = `${e}_${n}`;
4388
+ return t.add(r), r;
4389
+ }
4390
+ function na(e) {
4391
+ let t = [], n = /* @__PURE__ */ new Set();
4392
+ for (let r of e) for (let e of Object.keys(r)) n.has(e) || (n.add(e), t.push(e));
4393
+ return t;
4394
+ }
4395
+ function ra(e, t = (e) => e) {
4396
+ let n = na(e), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = n.map((e) => ({
4397
+ key: e,
4398
+ alias: ta(ea(e), r),
4399
+ label: ta(ia(t, e), i)
4400
+ })), o = (t) => e.map((e) => {
4401
+ let n = {};
4402
+ for (let r of a) r.key in e && (n[t(r)] = e[r.key]);
4403
+ return n;
4404
+ }), s = o((e) => e.alias);
4405
+ return {
4406
+ rows: s,
4407
+ labelled: o((e) => e.label),
4408
+ data: e,
4409
+ rowCount: e.length,
4410
+ first: s[0] ?? null,
4411
+ last: s.length > 0 ? s[s.length - 1] : null,
4412
+ fields: a
4413
+ };
4414
+ }
4415
+ function ia(e, t) {
4416
+ try {
4417
+ return e(t) || t;
4418
+ } catch {
4419
+ return t;
4420
+ }
4421
+ }
4422
+ var aa = [
4423
+ "rows",
4424
+ "labelled",
4425
+ "data",
4426
+ "rowCount",
4427
+ "first",
4428
+ "last",
4429
+ "fields"
4430
+ ], oa = ["first", "last"], sa = [
4431
+ "key",
4432
+ "alias",
4433
+ "label"
4434
+ ];
4435
+ function ca(e) {
4436
+ return typeof e == "object" && !!e;
4437
+ }
4438
+ function la(e) {
4439
+ return ca(e) && e.type === "identifier" && typeof e.name == "string";
4440
+ }
4441
+ function ua(e, t) {
4442
+ if (Array.isArray(e)) for (let n of e) ua(n, t);
4443
+ else if (ca(e)) {
4444
+ t(e);
4445
+ for (let n of Object.values(e)) ua(n, t);
4446
+ }
4447
+ }
4448
+ function da(e) {
4449
+ let t = /* @__PURE__ */ new Map();
4450
+ return ua(e, (e) => {
4451
+ if (e.type !== "for" || typeof e.iterator != "string") return;
4452
+ let n = e.iterable;
4453
+ t.set(e.iterator, la(n) ? n.name : "");
4454
+ }), t;
4455
+ }
4456
+ function fa(e, t) {
4457
+ if (oa.includes(e)) return { kind: "aliased" };
4458
+ switch (t.get(e)) {
4459
+ case "rows": return { kind: "aliased" };
4460
+ case "fields": return { kind: "metadata" };
4461
+ case "data": return { kind: "raw" };
4462
+ default: return { kind: "skip" };
4463
+ }
4464
+ }
4465
+ function pa(e, t) {
4466
+ let { ast: n, errors: r } = Ne(e);
4467
+ if (r.length > 0) return [];
4468
+ let i = t.fields.map((e) => e.alias), a = da(n), o = {
4469
+ aliases: i,
4470
+ loopSources: a,
4471
+ knownRoots: /* @__PURE__ */ new Set([...aa, ...a.keys()]),
4472
+ available: i.length > 0 ? i.join(", ") : aa.join(", ")
4473
+ }, s = [], c = /* @__PURE__ */ new Set();
4474
+ return ua(n, (e) => {
4475
+ if (!la(e)) return;
4476
+ let t = ma(e.path ?? [e.name], o);
4477
+ t && _a(s, c, e, t);
4478
+ }), s;
4479
+ }
4480
+ function ma(e, t) {
4481
+ let [n, r] = e;
4482
+ return t.knownRoots.has(n) ? r === void 0 ? null : ha(e, r, t) : `Unknown variable "${n}". Available: ${aa.join(", ")}.`;
4483
+ }
4484
+ function ha(e, t, n) {
4485
+ let r = e[0];
4486
+ switch (fa(r, n.loopSources).kind) {
4487
+ case "raw": return `"${r}" holds raw rows, so dotted access does not resolve. Use ${r}["${e.slice(1).join(".")}"], or loop over rows and use ${r}.${n.aliases[0] ?? "alias"}.`;
4488
+ case "aliased": return ga(t, n.aliases, n.available);
4489
+ case "metadata": return ga(t, sa, sa.join(", "));
4490
+ case "skip": return null;
4491
+ }
4492
+ }
4493
+ function ga(e, t, n) {
4494
+ return t.includes(e) ? null : `Unknown field "${e}". Available: ${n}.`;
4495
+ }
4496
+ function _a(e, t, n, r) {
4497
+ t.has(r) || (t.add(r), e.push({
4498
+ message: r,
4499
+ line: n.line,
4500
+ column: n.column
4501
+ }));
4502
+ }
4503
+ var va = {
4504
+ maxTemplateLength: 1e5,
4505
+ maxOutputLength: 5e5,
4506
+ maxValueLength: 1e5,
4507
+ maxOperations: 5e5,
4508
+ maxDepth: 50
4509
+ }, ya = null;
4510
+ function ba() {
4511
+ return ya ||= zt({
4512
+ filters: Qi,
4513
+ allowRegex: !1
4514
+ }), ya;
4515
+ }
4516
+ async function xa(e, t) {
4517
+ try {
4518
+ let n = {
4519
+ rows: t.rows,
4520
+ labelled: t.labelled,
4521
+ data: t.data,
4522
+ rowCount: t.rowCount,
4523
+ first: t.first,
4524
+ last: t.last,
4525
+ fields: t.fields
4526
+ }, r = await ba().render(e, { variables: n }, { limits: va }), i = r.errors.map((e) => ({
4527
+ message: e.message,
4528
+ line: e.line,
4529
+ column: e.column
4530
+ }));
4531
+ return {
4532
+ output: r.output,
4533
+ errors: i,
4534
+ warnings: i.length > 0 ? [] : pa(e, t)
4535
+ };
4536
+ } catch (e) {
4537
+ return {
4538
+ output: "",
4539
+ errors: [{
4540
+ message: Sa(e),
4541
+ line: 1,
4542
+ column: 1
4543
+ }],
4544
+ warnings: []
4545
+ };
4546
+ }
4547
+ }
4548
+ function Sa(e) {
4549
+ return e instanceof Error ? e.message : String(e);
4550
+ }
4551
+ //#endregion
4552
+ //#region src/client/components/charts/MarkdownChart.helpers.ts
4553
+ var Ca = {
4554
+ small: {
4555
+ 1: "dc:text-lg",
4556
+ 2: "dc:text-base",
4557
+ 3: "dc:text-sm"
4558
+ },
4559
+ medium: {
4560
+ 1: "dc:text-3xl",
4561
+ 2: "dc:text-2xl",
4562
+ 3: "dc:text-xl"
4563
+ },
4564
+ large: {
4565
+ 1: "dc:text-5xl",
4566
+ 2: "dc:text-4xl",
4567
+ 3: "dc:text-3xl"
4568
+ }
4569
+ }, wa = {
4570
+ 1: "dc:mb-4",
4571
+ 2: "dc:mb-3",
4572
+ 3: "dc:mb-2"
4573
+ }, Ta = {
4574
+ small: "dc:text-sm",
4575
+ medium: "dc:text-lg",
4576
+ large: "dc:text-xl"
4577
+ }, Ea = {
4578
+ left: "dc:text-left",
4579
+ center: "dc:text-center",
4580
+ right: "dc:text-right"
4581
+ };
4582
+ function Da(e) {
4583
+ return Ta[e] ?? Ta.medium;
4584
+ }
4585
+ function Oa(e) {
4586
+ return Ea[e] ?? Ea.left;
4587
+ }
4588
+ function ka(e, t, n) {
4589
+ return { props: {
4590
+ className: `dc:font-bold ${Ca[e]?.[t] ?? Ca.medium[t]} ${wa[t]}`,
4591
+ style: { color: n }
4592
+ } };
4593
+ }
4594
+ function Aa(e, t) {
4595
+ return {
4596
+ disableParsingRawHTML: !0,
4597
+ sanitizer: (e) => i(e),
4598
+ overrides: {
4599
+ h1: ka(t, 1, e),
4600
+ h2: ka(t, 2, e),
4601
+ h3: ka(t, 3, e),
4602
+ p: { props: { className: "dc:mb-3 dc:leading-relaxed text-dc-text" } },
4603
+ strong: { props: { className: "dc:font-bold text-dc-text" } },
4604
+ em: { props: { className: "dc:italic text-dc-text" } },
4605
+ a: { props: {
4606
+ className: "dc:hover:underline dc:transition-colors",
4607
+ target: "_blank",
4608
+ rel: "nofollow noopener noreferrer",
4609
+ style: { color: e }
4610
+ } },
4611
+ code: { props: { className: "dc:px-1 dc:py-0.5 dc:rounded-sm dc:text-xs bg-dc-surface-secondary text-dc-accent dc:font-mono" } },
4612
+ pre: { props: { className: "dc:rounded-lg dc:p-3 dc:my-2 dc:overflow-x-auto dc:text-xs bg-dc-surface-secondary text-dc-text dc:font-mono" } },
4613
+ ul: { props: { className: "dc:list-disc dc:ml-6 dc:mb-3 text-dc-text dc:space-y-1" } },
4614
+ ol: { props: { className: "dc:list-decimal dc:ml-6 dc:mb-3 text-dc-text dc:space-y-1" } },
4615
+ li: { props: { className: "dc:mb-1 text-dc-text" } },
4616
+ blockquote: { props: { className: "dc:border-l-4 border-dc-accent dc:pl-3 dc:my-2 dc:italic text-dc-text-secondary" } },
4617
+ hr: { props: {
4618
+ className: "dc:my-4 dc:border-none",
4619
+ style: {
4620
+ height: "2px",
4621
+ backgroundColor: e,
4622
+ opacity: .3
4623
+ }
4624
+ } },
4625
+ table: { props: { className: "dc:w-full dc:border-collapse dc:my-3 dc:text-sm" } },
4626
+ thead: { props: { className: "bg-dc-surface-secondary" } },
4627
+ th: { props: { className: "dc:px-3 dc:py-2 dc:text-left dc:font-semibold dc:text-xs text-dc-text-secondary dc:uppercase dc:tracking-wider border-dc-border dc:border-b" } },
4628
+ td: { props: { className: "dc:px-3 dc:py-2 text-dc-text border-dc-border dc:border-b" } },
4629
+ tr: { props: { className: "dc:hover:opacity-80" } }
4630
+ }
4631
+ };
4632
+ }
4633
+ function ja(e, t, n) {
4634
+ if (e === "none") return {};
4635
+ let r = { [`border${e.charAt(0).toUpperCase() + e.slice(1)}`]: `4px solid ${t}` };
4636
+ return n && e === "left" && (r.paddingLeft = "12px"), r;
4637
+ }
4638
+ function Ma(e, t) {
4639
+ return e && t < e.length ? e[t] : "#8884d8";
4640
+ }
4641
+ function Na(e) {
4642
+ return Array.isArray(e) ? e.filter((e) => typeof e == "object" && !!e && !Array.isArray(e)) : [];
4643
+ }
4644
+ function Pa(e, t, i) {
4645
+ let a = n(i), u = c(() => Na(t), [t]), d = o(r)?.getFieldLabel, [f, p] = l(null);
4646
+ return s(() => {
4647
+ if (!a || !e.trim()) {
4648
+ p(null);
4649
+ return;
4650
+ }
4651
+ let t = !1;
4652
+ return xa(e, ra(u, d)).then((e) => {
4653
+ t || p(e);
4654
+ }), () => {
4655
+ t = !0;
4656
+ };
4657
+ }, [
4658
+ a,
4659
+ e,
4660
+ u,
4661
+ d
4662
+ ]), {
4663
+ isTemplate: a,
4664
+ output: f?.output ?? null,
4665
+ errors: f?.errors ?? [],
4666
+ warnings: f?.warnings ?? []
4667
+ };
4668
+ }
4669
+ //#endregion
4670
+ export { Ma as a, a as default, Aa as i, Da as n, Pa as o, ja as r, Oa as t };
4671
+
4672
+ //# sourceMappingURL=MarkdownChart-BlL5h7nK.js.map