@perses-dev/logs-table-plugin 0.2.1 → 0.3.0-beta.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 (240) hide show
  1. package/__mf/css/async/5369.85c2cbf6.css +1 -0
  2. package/__mf/css/async/__federation_expose_LogsTable.eedb54d8.css +1 -0
  3. package/__mf/font/inter-cyrillic-300-normal.432f2b21.woff +0 -0
  4. package/__mf/font/inter-cyrillic-300-normal.9da91009.woff2 +0 -0
  5. package/__mf/font/inter-cyrillic-400-normal.372704ff.woff2 +0 -0
  6. package/__mf/font/inter-cyrillic-400-normal.a6b6ef6f.woff +0 -0
  7. package/__mf/font/inter-cyrillic-500-normal.7c15bba8.woff2 +0 -0
  8. package/__mf/font/inter-cyrillic-500-normal.b9f8c929.woff +0 -0
  9. package/__mf/font/inter-cyrillic-600-normal.2f42892a.woff2 +0 -0
  10. package/__mf/font/inter-cyrillic-600-normal.c3987adc.woff +0 -0
  11. package/__mf/font/inter-cyrillic-700-normal.93eba3c3.woff +0 -0
  12. package/__mf/font/inter-cyrillic-700-normal.e9e5b2dc.woff2 +0 -0
  13. package/__mf/font/inter-cyrillic-900-normal.f285bd7a.woff2 +0 -0
  14. package/__mf/font/inter-cyrillic-900-normal.ffbd8a3a.woff +0 -0
  15. package/__mf/font/inter-cyrillic-ext-300-normal.95bb9038.woff2 +0 -0
  16. package/__mf/font/inter-cyrillic-ext-300-normal.cfc143a9.woff +0 -0
  17. package/__mf/font/inter-cyrillic-ext-400-normal.2a31c04b.woff +0 -0
  18. package/__mf/font/inter-cyrillic-ext-400-normal.f572b170.woff2 +0 -0
  19. package/__mf/font/inter-cyrillic-ext-500-normal.5a6bb1da.woff +0 -0
  20. package/__mf/font/inter-cyrillic-ext-500-normal.fe0d9b14.woff2 +0 -0
  21. package/__mf/font/inter-cyrillic-ext-600-normal.ecbdecad.woff +0 -0
  22. package/__mf/font/inter-cyrillic-ext-600-normal.f7b3c15b.woff2 +0 -0
  23. package/__mf/font/inter-cyrillic-ext-700-normal.4b4022a6.woff +0 -0
  24. package/__mf/font/inter-cyrillic-ext-700-normal.74b516d2.woff2 +0 -0
  25. package/__mf/font/inter-cyrillic-ext-900-normal.9970ddb5.woff +0 -0
  26. package/__mf/font/inter-cyrillic-ext-900-normal.a0d59adc.woff2 +0 -0
  27. package/__mf/font/inter-greek-300-normal.0d7be683.woff2 +0 -0
  28. package/__mf/font/inter-greek-300-normal.8f0b988e.woff +0 -0
  29. package/__mf/font/inter-greek-400-normal.cc58c11b.woff +0 -0
  30. package/__mf/font/inter-greek-400-normal.d7020e3c.woff2 +0 -0
  31. package/__mf/font/inter-greek-500-normal.d9a33207.woff +0 -0
  32. package/__mf/font/inter-greek-500-normal.f41f43db.woff2 +0 -0
  33. package/__mf/font/inter-greek-600-normal.4ec0c1c1.woff +0 -0
  34. package/__mf/font/inter-greek-600-normal.cc532937.woff2 +0 -0
  35. package/__mf/font/inter-greek-700-normal.5ec6c758.woff +0 -0
  36. package/__mf/font/inter-greek-700-normal.97f0eeeb.woff2 +0 -0
  37. package/__mf/font/inter-greek-900-normal.46b66369.woff2 +0 -0
  38. package/__mf/font/inter-greek-900-normal.9ae3a3c5.woff +0 -0
  39. package/__mf/font/inter-greek-ext-300-normal.10247a66.woff2 +0 -0
  40. package/__mf/font/inter-greek-ext-300-normal.4668e5cb.woff +0 -0
  41. package/__mf/font/inter-greek-ext-400-normal.4ce1df5d.woff2 +0 -0
  42. package/__mf/font/inter-greek-ext-400-normal.88ede1ea.woff +0 -0
  43. package/__mf/font/inter-greek-ext-500-normal.7a4aa726.woff +0 -0
  44. package/__mf/font/inter-greek-ext-500-normal.cbd51e2d.woff2 +0 -0
  45. package/__mf/font/inter-greek-ext-600-normal.089a95ee.woff +0 -0
  46. package/__mf/font/inter-greek-ext-600-normal.1f33d317.woff2 +0 -0
  47. package/__mf/font/inter-greek-ext-700-normal.31f1075d.woff +0 -0
  48. package/__mf/font/inter-greek-ext-700-normal.827cd618.woff2 +0 -0
  49. package/__mf/font/inter-greek-ext-900-normal.531bcee7.woff +0 -0
  50. package/__mf/font/inter-greek-ext-900-normal.8a9b36b9.woff2 +0 -0
  51. package/__mf/font/inter-latin-300-normal.15fb600d.woff2 +0 -0
  52. package/__mf/font/inter-latin-300-normal.6f95f590.woff +0 -0
  53. package/__mf/font/inter-latin-400-normal.2c7a775c.woff +0 -0
  54. package/__mf/font/inter-latin-400-normal.ef6d3f52.woff2 +0 -0
  55. package/__mf/font/inter-latin-500-normal.b7b43ace.woff2 +0 -0
  56. package/__mf/font/inter-latin-500-normal.cb4c8ceb.woff +0 -0
  57. package/__mf/font/inter-latin-600-normal.8fb1a964.woff2 +0 -0
  58. package/__mf/font/inter-latin-600-normal.ce0f5f43.woff +0 -0
  59. package/__mf/font/inter-latin-700-normal.953b7aa5.woff2 +0 -0
  60. package/__mf/font/inter-latin-700-normal.9c21d4dc.woff +0 -0
  61. package/__mf/font/inter-latin-900-normal.2a8028ec.woff2 +0 -0
  62. package/__mf/font/inter-latin-900-normal.fa252135.woff +0 -0
  63. package/__mf/font/inter-latin-ext-300-normal.167cc8c9.woff2 +0 -0
  64. package/__mf/font/inter-latin-ext-300-normal.f695be66.woff +0 -0
  65. package/__mf/font/inter-latin-ext-400-normal.32a25442.woff2 +0 -0
  66. package/__mf/font/inter-latin-ext-400-normal.4edcaace.woff +0 -0
  67. package/__mf/font/inter-latin-ext-500-normal.a19a84a6.woff +0 -0
  68. package/__mf/font/inter-latin-ext-500-normal.d9b491de.woff2 +0 -0
  69. package/__mf/font/inter-latin-ext-600-normal.38b075d8.woff2 +0 -0
  70. package/__mf/font/inter-latin-ext-600-normal.49faa47a.woff +0 -0
  71. package/__mf/font/inter-latin-ext-700-normal.93534b50.woff +0 -0
  72. package/__mf/font/inter-latin-ext-700-normal.b63daa1a.woff2 +0 -0
  73. package/__mf/font/inter-latin-ext-900-normal.0efdb307.woff +0 -0
  74. package/__mf/font/inter-latin-ext-900-normal.9c0fc2c7.woff2 +0 -0
  75. package/__mf/font/inter-vietnamese-300-normal.aad496d8.woff +0 -0
  76. package/__mf/font/inter-vietnamese-300-normal.ad9ef503.woff2 +0 -0
  77. package/__mf/font/inter-vietnamese-400-normal.a9dd2faf.woff +0 -0
  78. package/__mf/font/inter-vietnamese-400-normal.de4fc44f.woff2 +0 -0
  79. package/__mf/font/inter-vietnamese-500-normal.7c0a695f.woff2 +0 -0
  80. package/__mf/font/inter-vietnamese-500-normal.a3a73b95.woff +0 -0
  81. package/__mf/font/inter-vietnamese-600-normal.9d518599.woff2 +0 -0
  82. package/__mf/font/inter-vietnamese-600-normal.c5ce3fcb.woff +0 -0
  83. package/__mf/font/inter-vietnamese-700-normal.bc68b199.woff +0 -0
  84. package/__mf/font/inter-vietnamese-700-normal.faf12809.woff2 +0 -0
  85. package/__mf/font/inter-vietnamese-900-normal.2b782045.woff +0 -0
  86. package/__mf/font/inter-vietnamese-900-normal.e639b65a.woff2 +0 -0
  87. package/__mf/js/LogsTable.471dc288.js +7 -0
  88. package/__mf/js/async/1159.9276d668.js +22 -0
  89. package/__mf/js/async/1519.40e06bfc.js +1 -0
  90. package/__mf/js/async/1616.1b9a06fe.js +1 -0
  91. package/__mf/js/async/1805.ab82c1ef.js +1 -0
  92. package/__mf/js/async/20.b04ebcaa.js +3 -0
  93. package/__mf/js/async/2043.956cdbbb.js +2 -0
  94. package/__mf/js/async/256.20a94089.js +1 -0
  95. package/__mf/js/async/2842.4aad5bc1.js +1 -0
  96. package/__mf/js/async/304.8985bacb.js +37 -0
  97. package/__mf/js/async/392.f9cb0cfc.js +2 -0
  98. package/__mf/js/async/4077.e9103d7c.js +1 -0
  99. package/__mf/js/async/4121.c9ef0518.js +2 -0
  100. package/__mf/js/async/4869.940da5d7.js +1 -0
  101. package/__mf/js/async/5002.1fe02654.js +1 -0
  102. package/__mf/js/async/5071.87183f5a.js +1 -0
  103. package/__mf/js/async/5369.0aa8782c.js +7 -0
  104. package/__mf/js/async/{193.39599d76.js.LICENSE.txt → 5369.0aa8782c.js.LICENSE.txt} +19 -1
  105. package/__mf/js/async/540.d4d0de7f.js +2 -0
  106. package/__mf/js/async/540.d4d0de7f.js.LICENSE.txt +1 -0
  107. package/__mf/js/async/5587.c7e5a39c.js +1 -0
  108. package/__mf/js/async/5652.e6029fc8.js +2 -0
  109. package/__mf/js/async/{1117.0a72bc85.js.LICENSE.txt → 5652.e6029fc8.js.LICENSE.txt} +1 -1
  110. package/__mf/js/async/6274.940dee19.js +2 -0
  111. package/__mf/js/async/6458.b2359789.js +1 -0
  112. package/__mf/js/async/7177.44516b97.js +1 -0
  113. package/__mf/js/async/7192.84e9432b.js +1 -0
  114. package/__mf/js/async/7250.78e3cd06.js +1 -0
  115. package/__mf/js/async/7413.581476fb.js +1 -0
  116. package/__mf/js/async/7445.73c38e72.js +110 -0
  117. package/__mf/js/async/{7445.28262ec0.js.LICENSE.txt → 7445.73c38e72.js.LICENSE.txt} +1 -1
  118. package/__mf/js/async/7452.7c6fe277.js +2 -0
  119. package/__mf/js/async/7968.aaf8a8bc.js +1 -0
  120. package/__mf/js/async/7978.35e0aa88.js +1 -0
  121. package/__mf/js/async/8356.355b4afe.js +1 -0
  122. package/__mf/js/async/8470.878f89da.js +2 -0
  123. package/__mf/js/async/8542.e30a008f.js +1 -0
  124. package/__mf/js/async/8608.072381d3.js +1 -0
  125. package/__mf/js/async/873.a4b44e41.js +1 -0
  126. package/__mf/js/async/9235.33a97899.js +1 -0
  127. package/__mf/js/async/9293.77eed9f0.js +2 -0
  128. package/__mf/js/async/941.c74117a1.js +2 -0
  129. package/__mf/js/async/9588.4e751733.js +1 -0
  130. package/__mf/js/async/__federation_expose_LogsTable.b2bc5b29.js +1 -0
  131. package/__mf/js/async/lib-router.47d4d226.js +2 -0
  132. package/__mf/js/main.04ea2a20.js +7 -0
  133. package/lib/LogsTable.d.ts.map +1 -1
  134. package/lib/LogsTable.js +8 -1
  135. package/lib/LogsTable.js.map +1 -1
  136. package/lib/LogsTableExportAction.d.ts +3 -0
  137. package/lib/LogsTableExportAction.d.ts.map +1 -0
  138. package/lib/LogsTableExportAction.js +67 -0
  139. package/lib/LogsTableExportAction.js.map +1 -0
  140. package/lib/cjs/LogsTable.js +8 -1
  141. package/lib/cjs/LogsTableExportAction.js +80 -0
  142. package/lib/cjs/components/LogRow/LogDetailsTable.js +60 -5
  143. package/lib/cjs/components/LogRow/LogRow.js +18 -7
  144. package/lib/cjs/components/VirtualizedLogsList.js +4 -4
  145. package/lib/cjs/utils/ansi.js +60 -0
  146. package/lib/cjs/utils/copyHelpers.js +4 -2
  147. package/lib/components/LogRow/LogDetailsTable.d.ts +2 -1
  148. package/lib/components/LogRow/LogDetailsTable.d.ts.map +1 -1
  149. package/lib/components/LogRow/LogDetailsTable.js +22 -3
  150. package/lib/components/LogRow/LogDetailsTable.js.map +1 -1
  151. package/lib/components/LogRow/LogRow.d.ts +2 -1
  152. package/lib/components/LogRow/LogRow.d.ts.map +1 -1
  153. package/lib/components/LogRow/LogRow.js +20 -9
  154. package/lib/components/LogRow/LogRow.js.map +1 -1
  155. package/lib/components/LogsList.d.ts +1 -1
  156. package/lib/components/LogsList.js.map +1 -1
  157. package/lib/components/VirtualizedLogsList.d.ts +1 -1
  158. package/lib/components/VirtualizedLogsList.d.ts.map +1 -1
  159. package/lib/components/VirtualizedLogsList.js +5 -5
  160. package/lib/components/VirtualizedLogsList.js.map +1 -1
  161. package/lib/components/hooks/useSeverity.d.ts +1 -1
  162. package/lib/components/hooks/useSeverity.js.map +1 -1
  163. package/lib/components/utils.d.ts +1 -1
  164. package/lib/components/utils.js.map +1 -1
  165. package/lib/model.d.ts +2 -1
  166. package/lib/model.d.ts.map +1 -1
  167. package/lib/model.js.map +1 -1
  168. package/lib/utils/ansi.d.ts +3 -0
  169. package/lib/utils/ansi.d.ts.map +1 -0
  170. package/lib/utils/ansi.js +39 -0
  171. package/lib/utils/ansi.js.map +1 -0
  172. package/lib/utils/copyHelpers.d.ts +1 -1
  173. package/lib/utils/copyHelpers.d.ts.map +1 -1
  174. package/lib/utils/copyHelpers.js +4 -2
  175. package/lib/utils/copyHelpers.js.map +1 -1
  176. package/mf-manifest.json +93 -72
  177. package/mf-stats.json +109 -74
  178. package/package.json +9 -5
  179. package/__mf/css/async/3061.d3010b86.css +0 -1
  180. package/__mf/css/async/5442.d3010b86.css +0 -1
  181. package/__mf/css/async/7823.d3010b86.css +0 -1
  182. package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
  183. package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
  184. package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
  185. package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
  186. package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
  187. package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
  188. package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
  189. package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
  190. package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
  191. package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
  192. package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
  193. package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
  194. package/__mf/js/LogsTable.198d1d4a.js +0 -6
  195. package/__mf/js/async/1117.0a72bc85.js +0 -2
  196. package/__mf/js/async/1240.1a0b69fc.js +0 -1
  197. package/__mf/js/async/1616.832c6e3d.js +0 -1
  198. package/__mf/js/async/1634.90d6ae2a.js +0 -3
  199. package/__mf/js/async/193.39599d76.js +0 -7
  200. package/__mf/js/async/2043.3343388c.js +0 -2
  201. package/__mf/js/async/304.d0edd380.js +0 -37
  202. package/__mf/js/async/392.2e457deb.js +0 -2
  203. package/__mf/js/async/3982.ab5d25af.js +0 -1
  204. package/__mf/js/async/4077.4c4e9533.js +0 -1
  205. package/__mf/js/async/4121.6fa52018.js +0 -2
  206. package/__mf/js/async/5002.c1c54a52.js +0 -1
  207. package/__mf/js/async/5019.84406c37.js +0 -1
  208. package/__mf/js/async/5071.a0b2c6c3.js +0 -1
  209. package/__mf/js/async/5587.180213b1.js +0 -1
  210. package/__mf/js/async/6034.7c4a93c7.js +0 -22
  211. package/__mf/js/async/6274.145959f1.js +0 -2
  212. package/__mf/js/async/6458.4d73f1df.js +0 -1
  213. package/__mf/js/async/7177.848ebbb2.js +0 -1
  214. package/__mf/js/async/7192.269aa1db.js +0 -1
  215. package/__mf/js/async/7445.28262ec0.js +0 -110
  216. package/__mf/js/async/7452.60dd8e7a.js +0 -2
  217. package/__mf/js/async/7968.2c2a16b3.js +0 -1
  218. package/__mf/js/async/7978.8fed4f5a.js +0 -1
  219. package/__mf/js/async/8356.9ea56838.js +0 -1
  220. package/__mf/js/async/8470.6f543f7d.js +0 -2
  221. package/__mf/js/async/8542.1802a06b.js +0 -1
  222. package/__mf/js/async/8608.4e8b55b4.js +0 -1
  223. package/__mf/js/async/873.6dbef0bc.js +0 -1
  224. package/__mf/js/async/8859.f8f648fc.js +0 -1
  225. package/__mf/js/async/9235.3d5006e1.js +0 -1
  226. package/__mf/js/async/9293.7e278959.js +0 -2
  227. package/__mf/js/async/941.66a54646.js +0 -2
  228. package/__mf/js/async/9588.1ab96620.js +0 -1
  229. package/__mf/js/async/__federation_expose_LogsTable.018ab634.js +0 -1
  230. package/__mf/js/async/lib-router.04411383.js +0 -2
  231. package/__mf/js/main.363b5188.js +0 -6
  232. /package/__mf/js/async/{6034.7c4a93c7.js.LICENSE.txt → 1159.9276d668.js.LICENSE.txt} +0 -0
  233. /package/__mf/js/async/{2043.3343388c.js.LICENSE.txt → 2043.956cdbbb.js.LICENSE.txt} +0 -0
  234. /package/__mf/js/async/{392.2e457deb.js.LICENSE.txt → 392.f9cb0cfc.js.LICENSE.txt} +0 -0
  235. /package/__mf/js/async/{4121.6fa52018.js.LICENSE.txt → 4121.c9ef0518.js.LICENSE.txt} +0 -0
  236. /package/__mf/js/async/{6274.145959f1.js.LICENSE.txt → 6274.940dee19.js.LICENSE.txt} +0 -0
  237. /package/__mf/js/async/{7452.60dd8e7a.js.LICENSE.txt → 7452.7c6fe277.js.LICENSE.txt} +0 -0
  238. /package/__mf/js/async/{8470.6f543f7d.js.LICENSE.txt → 8470.878f89da.js.LICENSE.txt} +0 -0
  239. /package/__mf/js/async/{941.66a54646.js.LICENSE.txt → 941.c74117a1.js.LICENSE.txt} +0 -0
  240. /package/__mf/js/async/{lib-router.04411383.js.LICENSE.txt → lib-router.47d4d226.js.LICENSE.txt} +0 -0
@@ -0,0 +1,22 @@
1
+ /*! For license information please see 1159.9276d668.js.LICENSE.txt */
2
+ (self["chunk_LogsTable "]=self["chunk_LogsTable "]||[]).push([["1159"],{39098(e,t,n){"use strict";n.d(t,{A:()=>S});var r=n(70451),i=n(11750),a=n(46477),o=n(3725),s=n(81023),l=n(77308),u=n(56599),c=n(23434),d=n(72052),p=n(48927),f=n(32494),h=n(29424),g=n(29009),m=n(46733);function y(e){return(0,m.Ay)("MuiCollapse",e)}(0,g.A)("MuiCollapse",["root","horizontal","vertical","entered","hidden","wrapper","wrapperInner"]);var b=n(62540);let v=(0,l.A)("div",{name:"MuiCollapse",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.orientation],"entered"===n.state&&t.entered,"exited"===n.state&&!n.in&&"0px"===n.collapsedSize&&t.hidden]}})((0,c.A)(({theme:e})=>({height:0,overflow:"hidden",transition:e.transitions.create("height"),variants:[{props:{orientation:"horizontal"},style:{height:"auto",width:0,transition:e.transitions.create("width")}},{props:{state:"entered"},style:{height:"auto",overflow:"visible"}},{props:{state:"entered",orientation:"horizontal"},style:{width:"auto"}},{props:({ownerState:e})=>"exited"===e.state&&!e.in&&"0px"===e.collapsedSize,style:{visibility:"hidden"}}]}))),x=(0,l.A)("div",{name:"MuiCollapse",slot:"Wrapper",overridesResolver:(e,t)=>t.wrapper})({display:"flex",width:"100%",variants:[{props:{orientation:"horizontal"},style:{width:"auto",height:"100%"}}]}),w=(0,l.A)("div",{name:"MuiCollapse",slot:"WrapperInner",overridesResolver:(e,t)=>t.wrapperInner})({width:"100%",variants:[{props:{orientation:"horizontal"},style:{width:"auto",height:"100%"}}]}),j=r.forwardRef(function(e,t){let n=(0,d.b)({props:e,name:"MuiCollapse"}),{addEndListener:l,children:c,className:g,collapsedSize:m="0px",component:j,easing:S,in:A,onEnter:C,onEntered:E,onEntering:D,onExit:O,onExited:k,onExiting:P,orientation:T="vertical",style:M,timeout:R=p.p0.standard,TransitionComponent:L=a.Ay,..._}=n,I={...n,orientation:T,collapsedSize:m},V=(e=>{let{orientation:t,classes:n}=e,r={root:["root",`${t}`],entered:["entered"],hidden:["hidden"],wrapper:["wrapper",`${t}`],wrapperInner:["wrapperInner",`${t}`]};return(0,s.A)(r,y,n)})(I),H=(0,u.A)(),N=(0,o.A)(),z=r.useRef(null),$=r.useRef(),B="number"==typeof m?`${m}px`:m,G="horizontal"===T,W=G?"width":"height",F=r.useRef(null),q=(0,h.A)(t,F),U=e=>t=>{if(e){let n=F.current;void 0===t?e(n):e(n,t)}},K=()=>z.current?z.current[G?"clientWidth":"clientHeight"]:0,J=U((e,t)=>{z.current&&G&&(z.current.style.position="absolute"),e.style[W]=B,C&&C(e,t)}),Y=U((e,t)=>{let n=K();z.current&&G&&(z.current.style.position="");let{duration:r,easing:i}=(0,f.c)({style:M,timeout:R,easing:S},{mode:"enter"});if("auto"===R){let t=H.transitions.getAutoHeightDuration(n);e.style.transitionDuration=`${t}ms`,$.current=t}else e.style.transitionDuration="string"==typeof r?r:`${r}ms`;e.style[W]=`${n}px`,e.style.transitionTimingFunction=i,D&&D(e,t)}),X=U((e,t)=>{e.style[W]="auto",E&&E(e,t)}),Z=U(e=>{e.style[W]=`${K()}px`,O&&O(e)}),Q=U(k),ee=U(e=>{let t=K(),{duration:n,easing:r}=(0,f.c)({style:M,timeout:R,easing:S},{mode:"exit"});if("auto"===R){let n=H.transitions.getAutoHeightDuration(t);e.style.transitionDuration=`${n}ms`,$.current=n}else e.style.transitionDuration="string"==typeof n?n:`${n}ms`;e.style[W]=B,e.style.transitionTimingFunction=r,P&&P(e)});return(0,b.jsx)(L,{in:A,onEnter:J,onEntered:X,onEntering:Y,onExit:Z,onExited:Q,onExiting:ee,addEndListener:e=>{"auto"===R&&N.start($.current||0,e),l&&l(F.current,e)},nodeRef:F,timeout:"auto"===R?null:R,..._,children:(e,{ownerState:t,...n})=>(0,b.jsx)(v,{as:j,className:(0,i.A)(V.root,g,{entered:V.entered,exited:!A&&"0px"===B&&V.hidden}[e]),style:{[G?"minWidth":"minHeight"]:B,...M},ref:q,ownerState:{...I,state:e},...n,children:(0,b.jsx)(x,{ownerState:{...I,state:e},className:V.wrapper,ref:z,children:(0,b.jsx)(w,{ownerState:{...I,state:e},className:V.wrapperInner,children:c})})})})});j&&(j.muiSupportAuto=!0);let S=j},4122(e,t,n){"use strict";let r,i;n.r(t),n.d(t,{TIME_SHIFT_BACK_EVENT:()=>iw,DashboardDiscardChangesConfirmationDialog:()=>sM,usePanelGroupIds:()=>ee,EditDatasourcesButton:()=>o7,PanelGroupDialog:()=>sQ,RepeatGridLayout:()=>no,useDeletePanelDialog:()=>ev,EditJsonDialog:()=>sL,dispatchShortcutEvent:()=>iq,AddGroupButton:()=>eM,HeaderIconButton:()=>tX,ARIA_LABEL_TEXT:()=>d,Row:()=>nr,createPanelDefinition:()=>R,useHotkey:()=>lo,useHotkeys:()=>iu,useDashboardDuration:()=>ew,EmptyDashboard:()=>ru,TOGGLE_THEME_EVENT:()=>iM,DashboardStickyToolbar:()=>sD,TOOLTIP_TEXT:()=>c,TIME_PASTE_SHORTCUT:()=>i0,buildShortcutOptions:()=>iB,GridTitle:()=>nn,TOGGLE_EDIT_MODE_EVENT:()=>ib,PANEL_EDIT_SHORTCUT:()=>iV,DEFAULT_DASHBOARD_DURATION:()=>"1h",HEADER_ACTIONS_CONTAINER_NAME:()=>f,TIME_ZOOM_IN_SHORTCUT:()=>iJ,SaveChangesConfirmationDialog:()=>s3,TOGGLE_EDIT_MODE_SHORTCUT:()=>i_,useDashboardStore:()=>B,PanelEditorContext:()=>sG,useSelectionItemActions:()=>t2,usePanelKey:()=>ep,useEditJsonDialog:()=>eT,GO_EXPLORE_SHORTCUT:()=>le,useExternalVariableDefinitions:()=>nS,useHotkeySequences:()=>ig,isPanelGroupItemIdEqual:()=>eY,useListPanelGroups:()=>en,GridItemContent:()=>t7,PANEL_DELETE_EVENT:()=>ik,REFRESH_DASHBOARD_SHORTCUT:()=>iL,generateId:()=>M,usePanelGroup:()=>er,useVariableDefinitionStates:()=>nv,Variable:()=>sv,PanelPreview:()=>sY,DashboardContext:()=>$,VariableProvider:()=>nE,SHOW_SHORTCUTS_SHORTCUT:()=>lr,PANEL_EDIT_EVENT:()=>iE,LeaveDialog:()=>sN,useViewPanelGroup:()=>eC,useListVariableState:()=>sx,BuiltinVariableAccordions:()=>n8,createModEnterHandler:()=>iU,useDashboardLinksActions:()=>Z,DeletePanelDialog:()=>sk,DeletePanelGroupDialog:()=>sT,PANEL_DUPLICATE_SHORTCUT:()=>iN,VariableProviderWithQueryParams:()=>nD,useListVariableListBoxContext:()=>sg,TIME_SHIFT_BACK_SHORTCUT:()=>iY,HotkeysProvider:()=>ry,GridLayout:()=>na,ListVariableListBox:()=>sy,MAX_VARIABLE_WIDTH:()=>500,useDiscardChangesConfirmationDialog:()=>ek,PanelDrawer:()=>sK,TIME_ZOOM_IN_EVENT:()=>ix,VariableList:()=>sC,GO_PROFILE_SHORTCUT:()=>lt,useVariableDefinitions:()=>nj,ViewDashboard:()=>lh,HEADER_MEDIUM_WIDTH:()=>220,useHotkeyRegistrations:()=>lc,SHOW_SHORTCUTS_EVENT:()=>iT,useVariableDefinitionActions:()=>nw,useDashboardShortcuts:()=>i7,HEADER_SMALL_WIDTH:()=>170,usePanelEditor:()=>ey,TIME_PASTE_EVENT:()=>iC,usePanelFocusHandlers:()=>e1,SAVE_DASHBOARD_EVENT:()=>im,ListVariableListBoxProvider:()=>sm,VariableName:()=>rr,PANEL_DUPLICATE_EVENT:()=>iO,Panel:()=>t3,QuerySummaryTable:()=>s1,useFocusedPanel:()=>e0,PANEL_DELETE_SHORTCUT:()=>iz,useDashboardLinks:()=>Y,usePanelActions:()=>eg,TIME_SHIFT_FORWARD_EVENT:()=>ij,TIME_RANGE_SHORTCUTS:()=>i1,formatForDisplay:()=>rq,useViewPanel:()=>eS,TIME_MAKE_ABSOLUTE_SHORTCUT:()=>iZ,DatasourceStoreProvider:()=>s4,DashboardProvider:()=>G,requireShortcutSequence:()=>iW,GLOBAL_SHORTCUTS:()=>la,DashboardToolbar:()=>sO,SAVE_DASHBOARD_SHORTCUT:()=>iR,VariableListItem:()=>sE,requireShortcutHotkey:()=>iG,PanelPluginLoader:()=>ti,DashboardLinksEditor:()=>rp,Prompt:()=>sH,EditDashboardLinksButton:()=>rh,AddPanelButton:()=>eL,DEFAULT_REFRESH_INTERVAL:()=>"0s",useSaveChangesConfirmationDialog:()=>eD,VariableEditor:()=>re,DatasourceEditor:()=>o5,SHORTCUT_CATEGORY_LABELS:()=>s7,TIME_COPY_SHORTCUT:()=>iQ,TIME_SHIFT_FORWARD_SHORTCUT:()=>iX,editButtonStyle:()=>p,TIME_COPY_EVENT:()=>iA,usePanel:()=>ef,EditJsonButton:()=>o6,useDeletePanelGroupDialog:()=>ed,DASHBOARD_SHORTCUTS:()=>iI,OPEN_SEARCH_SHORTCUT:()=>ln,requireShortcutEvent:()=>iF,DownloadButton:()=>o4,SHORTCUT_CATEGORY_ORDER:()=>s8,Dashboard:()=>rc,GRID_LAYOUT_SMALL_BREAKPOINT:()=>"sm",PANEL_SHORTCUTS:()=>i$,PANEL_FULLSCREEN_SHORTCUT:()=>iH,GRID_LAYOUT_COLS:()=>V,usePanelGroupEditor:()=>eu,GO_HOME_SHORTCUT:()=>s6,GridContainer:()=>e$,PanelFocusProvider:()=>eQ,useEditMode:()=>q,TOGGLE_THEME_SHORTCUT:()=>li,useDashboard:()=>i2,useVariableDefinitionAndState:()=>nx,QueryViewerDialog:()=>t5,REFRESH_DASHBOARD_EVENT:()=>iy,useHotkeySequence:()=>ls,TIME_MAKE_ABSOLUTE_EVENT:()=>iS,useDashboardActions:()=>K,SaveDashboardButton:()=>se,PANEL_FULLSCREEN_EVENT:()=>iD,TIME_ZOOM_OUT_SHORTCUT:()=>iK,MIN_VARIABLE_WIDTH:()=>120,useVariableDefinitionStoreCtx:()=>nb,usePanelGroupActions:()=>ea,OPEN_SEARCH_EVENT:()=>iP,EditVariablesButton:()=>ri,useSaveDashboard:()=>i9,TIME_ZOOM_OUT_EVENT:()=>iv});var a,o=n(62540),s=n(7013),l=n(2859),u=n(58662);let c={addPanel:"Add panel",addGroup:"Add panel group",editDatasources:"Edit datasources",editJson:"Edit JSON",editLinks:"Edit links",editVariables:"Edit variables",viewJson:"View JSON",addPanelToGroup:"Add panel to group",deleteGroup:"Delete group",editGroup:"Edit group",moveGroupDown:"Move group down",moveGroupUp:"Move group up",viewPanel:"Toggle View Mode",editPanel:"Edit",duplicatePanel:"Duplicate",deletePanel:"Delete",movePanel:"Move",refreshVariableValues:"Refresh values",copyVariableValues:"Copy values to clipboard",queryView:"Open query view"},d={addPanelToGroup:e=>`add panel to group ${e}`,deleteGroup:e=>`delete group ${e}`,editGroup:e=>`edit group ${e}`,moveGroupDown:e=>`move group ${e} down`,moveGroupUp:e=>`move group ${e} up`,viewPanel:e=>e?`toggle panel ${e} view mode`:"toggle panel view mode",editPanel:e=>e?`edit panel ${e}`:"edit panel",duplicatePanel:e=>e?`duplicate panel ${e}`:"duplicate panel",deletePanel:e=>e?`delete panel ${e}`:"delete panel",showPanelActions:e=>e?`show panel actions for ${e}`:"show panel actions",movePanel:e=>e?`move panel ${e}`:"move panel",openQueryView:e=>e?`open query view for panel ${e}`:"open query view for panel"},p={whiteSpace:"nowrap",minWidth:"auto","& .MuiButton-startIcon":{marginRight:.5}},f="header-actions-container";var h=n(70451),g=n.n(h);let m=e=>{let t,n=new Set,r=(e,r)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=r?r:"object"!=typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},y=e=>e?m(e):m;var b=n(95390);let{useDebugValue:v}=g(),{useSyncExternalStoreWithSelector:x}=b,w=e=>e;function j(e,t=w,n){let r=x(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return v(r),r}let S=new Map,A=e=>{let t=S.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([e,t])=>[e,t.getState()])):{}},C=(e,t={})=>(n,r,i)=>{let a,{enabled:o,anonymousActionType:s,store:l,...u}=t;try{a=null!=o&&o&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}if(!a)return e(n,r,i);let{connection:c,...d}=((e,t,n)=>{if(void 0===e)return{type:"untracked",connection:t.connect(n)};let r=S.get(n.name);if(r)return{type:"tracked",store:e,...r};let i={connection:t.connect(n),stores:{}};return S.set(n.name,i),{type:"tracked",store:e,...i}})(l,a,u),p=!0;i.setState=(e,t,a)=>{let o=n(e,t);if(!p)return o;let d=void 0===a?{type:s||"anonymous"}:"string"==typeof a?{type:a}:a;return void 0===l?null==c||c.send(d,r()):null==c||c.send({...d,type:`${l}/${d.type}`},{...A(u.name),[l]:i.getState()}),o};let f=(...e)=>{let t=p;p=!1,n(...e),p=t},h=e(i.setState,r,i);if("untracked"===d.type?null==c||c.init(h):(d.stores[d.store]=i,null==c||c.init(Object.fromEntries(Object.entries(d.stores).map(([e,t])=>[e,e===d.store?h:t.getState()])))),i.dispatchFromDevtools&&"function"==typeof i.dispatch){let e=i.dispatch;i.dispatch=(...t)=>{e(...t)}}return c.subscribe(e=>{var t;switch(e.type){case"ACTION":if("string"!=typeof e.payload)return void console.error("[zustand devtools middleware] Unsupported action format");return E(e.payload,e=>{if("__setState"===e.type){if(void 0===l)return void f(e.state);1!==Object.keys(e.state).length&&console.error(`
3
+ [zustand devtools middleware] Unsupported __setState action format.
4
+ When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
5
+ and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
6
+ `);let t=e.state[l];return void(null==t||JSON.stringify(i.getState())!==JSON.stringify(t)&&f(t))}i.dispatchFromDevtools&&"function"==typeof i.dispatch&&i.dispatch(e)});case"DISPATCH":switch(e.payload.type){case"RESET":if(f(h),void 0===l)return null==c?void 0:c.init(i.getState());return null==c?void 0:c.init(A(u.name));case"COMMIT":if(void 0===l){null==c||c.init(i.getState());break}return null==c?void 0:c.init(A(u.name));case"ROLLBACK":return E(e.state,e=>{if(void 0===l){f(e),null==c||c.init(i.getState());return}f(e[l]),null==c||c.init(A(u.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return E(e.state,e=>{void 0===l?f(e):JSON.stringify(i.getState())!==JSON.stringify(e[l])&&f(e[l])});case"IMPORT_STATE":{let{nextLiftedState:n}=e.payload,r=null==(t=n.computedStates.slice(-1)[0])?void 0:t.state;if(!r)return;void 0===l?f(r):f(r[l]),null==c||c.send(null,n);break}case"PAUSE_RECORDING":return p=!p}return}}),h},E=(e,t)=>{let n;try{n=JSON.parse(e)}catch(e){console.error("[zustand devtools middleware] Could not parse the received json",e)}void 0!==n&&t(n)};var D=n(38662);let O=e=>(t,n,r)=>(r.setState=(e,n,...r)=>t("function"==typeof e?(0,D.jM)(e):e,n,...r),e(r.setState,n,r));function k(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var P=n(77830),T=n(97836);function M(){return void 0===globalThis.dashboardStoreId&&(globalThis.dashboardStoreId=0),globalThis.dashboardStoreId++}function R(e,t){return{kind:"Panel",spec:{display:{name:"",description:void 0},plugin:{kind:e??"",spec:t??{}},queries:[]}}}function L(e){let t={},n=[];for(let r of e){let e=[],i={};for(let t of r.spec.items){let n=M().toString();e.push({i:n,w:t.width,h:t.height,x:t.x,y:t.y}),i[n]=(0,T.getPanelKeyFromRef)(t.content)}let a=M();t[a]={id:a,isCollapsed:r.spec.display?.collapse?.open===!1,repeatVariable:r.spec.repeatVariable,title:r.spec.display?.title,itemLayouts:e,itemPanelKeys:i},n.push(a)}return{panelGroups:t,panelGroupOrder:n}}function _(){return{id:M(),title:void 0,isCollapsed:!1,itemLayouts:[],itemPanelKeys:{}}}function I(e,t){e.panelGroups[t.id]=t,e.panelGroupOrder.unshift(t.id)}let V={sm:24,xxs:2};function H(e){let t=0;for(let n of e.itemLayouts){let e=n.y+n.h;e>t&&(t=e)}return t}function N({x:e,y:t,w:n,h:r}){return{x1:e,x2:e+n,y1:t,y2:t+r}}let z=()=>{if(window.isSecureContext)return crypto.randomUUID().replaceAll("-","");let e=String(Date.now()),t=Math.random().toString(36).substring(2);return`${e}${t}`},$=(0,h.createContext)(void 0);function B(e){let t=(0,h.useContext)($);if(void 0===t)throw Error("No DashboardContext found. Did you forget a Provider?");return j(t,e,k)}function G(e){let t=(0,h.useCallback)(W,[e]),[n]=(0,h.useState)(t(e)),{defaultPluginKinds:r}=(0,P.usePluginRegistry)(),i=r?.Panel??"",{data:a}=(0,P.usePlugin)("Panel",i);return(0,h.useEffect)(()=>{if(void 0===a)return;let e=a.createInitialOptions?a.createInitialOptions():{};n.setState({initialValues:{panelDefinition:R(i,e)}})},[a,n,i]),(0,o.jsx)($.Provider,{value:n,children:e.children})}function W(e){let{initialState:{dashboardResource:t,isEditMode:n,viewPanelRef:r,setViewPanelRef:i}}=e,{kind:a,metadata:o,spec:{display:s,duration:l,refreshInterval:u="0s",datasources:c,layouts:d=[],panels:p={}}}=t,f=t.spec.links??[],h="ttl"in t.spec?t.spec.ttl:void 0;return y()(O(C((...e)=>{let[t]=e;return{...(function(e){let{panelGroups:t,panelGroupOrder:n}=L(e);return e=>({panelGroups:t,panelGroupOrder:n,swapPanelGroups(t,n){e(e=>{if(t<0||t>=e.panelGroupOrder.length||n<0||n>=e.panelGroupOrder.length)throw Error("index out of bound");let r=e.panelGroupOrder[t],i=e.panelGroupOrder[n];if(void 0===r||void 0===i)throw Error("panel group is undefined");[e.panelGroupOrder[t],e.panelGroupOrder[n]]=[i,r]})},updatePanelGroupLayouts(t,n){e(e=>{let r=e.panelGroups[t];if(void 0===r)throw Error(`Cannot find panel group ${t}`);r.itemLayouts=n})}})})(d)(...e),...((e,t)=>({panelGroupEditor:void 0,openAddPanelGroup:()=>{let t={mode:"Add",initialValues:{title:"",isCollapsed:!1,repeatVariable:""},applyChanges(t){let n=_();n.title=t.title,n.isCollapsed=t.isCollapsed,n.repeatVariable=t.repeatVariable,e(e=>{I(e,n)})},close(){e(e=>{e.panelGroupEditor=void 0})}};e(e=>{e.panelGroupEditor=t})},openEditPanelGroup:n=>{let r=t().panelGroups[n];if(void 0===r)throw Error(`Panel group with Id ${n} does not exist`);let i={mode:"Edit",initialValues:{title:r.title??"",isCollapsed:r.isCollapsed,repeatVariable:r.repeatVariable??""},applyChanges(t){e(e=>{let r=e.panelGroups[n];if(void 0===r)throw Error(`Panel group with Id ${n} does not exist`);r.title=t.title,r.isCollapsed=t.isCollapsed,r.repeatVariable=t.repeatVariable})},close(){e(e=>{e.panelGroupEditor=void 0})}};e(e=>{e.panelGroupEditor=i})}}))(...e),...((e,t)=>({deletePanelGroup(n){let{panelGroups:r,panelGroupOrder:i}=t(),a=r[n],o=i.findIndex(e=>e===n);if(void 0===a||-1===o)throw Error(`Panel group ${n} not found`);let s=Object.values(a.itemPanelKeys);e(e=>{delete e.panelGroups[n],e.panelGroupOrder.splice(o,1);let t=function(e){let t=new Set;for(let n of Object.values(e))for(let e of Object.values(n.itemPanelKeys))t.add(e);return t}(e.panelGroups);for(let n of s)t.has(n)||delete e.panels[n]})},openDeletePanelGroupDialog:n=>{let r=t().panelGroups[n];if(void 0===r)throw Error(`Panel group with Id ${n} not found`);e(e=>{e.deletePanelGroupDialog={panelGroupId:n,panelGroupName:r.title}})},closeDeletePanelGroupDialog:()=>e(e=>{e.deletePanelGroupDialog=void 0})}))(...e),...(()=>({panels:p}))(...e),...((e,t)=>({panelEditor:void 0,openEditPanel(n){let{panels:r,panelGroups:i}=t(),{panelGroupId:a,panelGroupItemLayoutId:o}=n,s=i[a]?.itemPanelKeys[o];if(void 0===s)throw Error(`Could not find Panel Group item ${n}`);let l=r[s];if(void 0===l)throw Error(`Cannot find Panel with key '${s}'`);let u={mode:"update",panelGroupItemId:n,initialValues:{groupId:n.panelGroupId,panelDefinition:l},applyChanges:t=>{e(e=>{if(e.panels[s]=t.panelDefinition,t.groupId===a)return;let n=e.panelGroups[a];if(void 0===n)throw Error(`Missing panel group ${a}`);let r=n.itemLayouts.findIndex(e=>e.i===o),i=n.itemLayouts[r],l=n.itemPanelKeys[o];if(-1===r||void 0===i||void 0===l)throw Error(`Missing panel group item ${o}`);n.itemLayouts.splice(r,1),delete n.itemPanelKeys[o];let u=e.panelGroups[t.groupId];if(void 0===u)throw Error(`Could not find new group ${t.groupId}`);u.itemLayouts.push({i:i.i,x:0,y:H(u),w:i.w,h:i.h}),u.itemPanelKeys[i.i]=l})},close:()=>{e(e=>{e.panelEditor=void 0})}};e(e=>{e.panelEditor=u})},openAddPanel(n){let r;void 0===(n??=t().panelGroupOrder[0])&&((r=_()).title="Panel Group",n=r.id);let i={mode:"create",initialValues:{groupId:n,panelDefinition:t().initialValues?.panelDefinition??R()},applyChanges:t=>{let n=z();e(e=>{e.panels[n]=t.panelDefinition;let r=e.panelGroups[t.groupId];if(void 0===r)throw Error(`Missing panel group ${t.groupId}`);let i={i:M().toString(),x:0,y:H(r),w:12,h:6};r.itemLayouts.push(i),r.itemPanelKeys[i.i]=n})},close:()=>{e(e=>{e.panelEditor=void 0})}};e(e=>{void 0!==r&&I(e,r),e.panelEditor=i})}}))(...e),...((e,t)=>({deletePanel(t){e(e=>{let{panelGroupId:n,panelGroupItemLayoutId:r}=t,i=e.panelGroups[n];if(void 0===i)throw Error(`Missing panel group ${n}`);let a=i.itemLayouts.findIndex(e=>e.i===r),o=i.itemPanelKeys[r];if(-1===a||void 0===o)throw Error(`Missing panel group item ${r}`);i.itemLayouts.splice(a,1),delete i.itemPanelKeys[r],!1===function(e,t){for(let n of Object.values(e))if(void 0!==Object.values(n.itemPanelKeys).find(e=>e===t))return!0;return!1}(e.panelGroups,o)&&delete e.panels[o]})},openDeletePanelDialog(n){let{panelGroupId:r,panelGroupItemLayoutId:i}=n,{panels:a,panelGroups:o}=t(),s=o[r];if(void 0===s)throw Error(`Panel group not found ${r}`);let l=s.itemPanelKeys[i];if(void 0===l)throw Error(`Could not find Panel Group item ${i}`);let u=a[l];if(void 0===u)throw Error(`Could not find panel ${l}`);e(e=>{e.deletePanelDialog={panelGroupItemId:n,panelName:u.spec.display?.name??l,panelGroupName:s.title??""}})},closeDeletePanelDialog(){e(e=>{e.deletePanelDialog=void 0})}}))(...e),...(e=>({duplicatePanel(t){e(e=>{let n=e.panels,{panelGroupId:r,panelGroupItemLayoutId:i}=t,a=e.panelGroups[r];if(void 0===a)throw Error(`Missing panel group ${r}`);let o=a.itemPanelKeys[i];if(void 0===o)throw Error(`Could not find Panel Group item ${t}`);let s=n[o];if(void 0===s)throw Error(`Cannot find Panel with key '${o}'`);let l=a.itemLayouts.find(e=>e.i===i);if(void 0===l)throw Error(`Cannot find layout for Panel with key '${o}'`);let u=z();e.panels[u]=s;let c={i:M().toString(),w:l.w,h:l.h};a.itemLayouts=function(e,t,n){let r=V.sm,i=N(t),a=[],o=[],s=[];n.forEach(e=>{let t=N(e);t.y2<=i.y1?a.push(e):t.y1>=i.y2?s.push(e):o.push(e)}),o.sort((e,t)=>e.x-t.x);let l=o.findIndex(e=>e.i===t.i);if(l===o.length-1){if(i.x2+e.w<=r)return[...a,...o,{...e,x:i.x2,y:i.y1},...s]}else if(l>=0){let t=o[l+1];if(t&&N(t).x1-i.x2>=e.w)return o.splice(l+1,0,{...e,x:i.x2,y:i.y1}),[...a,...o,...s]}return[...a,...o,{x:i.x1,y:i.y2,...e},...s.map(t=>({...t,y:t.y+e.h}))]}(c,l,a.itemLayouts),a.itemPanelKeys[c.i]=u})}}))(...e),...((e,t)=>({viewPanel:{panelGroupItemId:void 0,panelRef:r},getViewPanel:()=>{var e,n,r;return e=t().panelGroups,n=t().viewPanel.panelGroupItemId,r=t().viewPanel.panelRef,n||(r?function(e,t){for(let n of Object.values(e)){let e=Object.entries(n.itemPanelKeys??[]).find(([e,n])=>n===t.ref);if(e){let[r]=e;return{panelGroupId:n.id,panelGroupItemLayoutId:r,repeatVariable:t.repeatVariable}}}}(e,r):void 0)},setViewPanel(n){e(e=>{e.viewPanel={panelRef:void 0,panelGroupItemId:n};let r=function(e,t){if(!t)return;let n=e[t.panelGroupId];if(n){let e=n.itemPanelKeys[t.panelGroupItemLayoutId];if(e)return{ref:e,repeatVariable:t.repeatVariable}}}(t().panelGroups,n);i&&i(r)})}}))(...e),...(e=>({links:f,setLinks:t=>{e(e=>{e.links=t})}}))(...e),...(e=>({isOpen:!1,openDiscardChangesConfirmationDialog(t){e(e=>{e.discardChangesConfirmationDialog=t})},closeDiscardChangesConfirmationDialog(){e(e=>{e.discardChangesConfirmationDialog=void 0})}}))(...e),...(e=>({openEditJsonDialog(){e(e=>{e.editJsonDialog={isOpen:!0}})},closeEditJsonDialog(){e(e=>{e.editJsonDialog={isOpen:!1}})}}))(...e),...(e=>({isOpen:!1,openSaveChangesConfirmationDialog(t){e(e=>{e.saveChangesConfirmationDialog=t},!1,"openSaveChangesConfirmationDialog")},closeSaveChangesConfirmationDialog(){e(e=>{e.saveChangesConfirmationDialog=void 0},!1,"closeSaveChangesConfirmationDialog")}}))(...e),kind:a,metadata:o,display:s,duration:l,refreshInterval:u,datasources:c,ttl:h,isEditMode:!!n,setEditMode:e=>{t({isEditMode:e})},setDashboard:({kind:e,metadata:n,spec:{display:r,panels:i={},layouts:a=[],duration:o,refreshInterval:s,datasources:l={},links:u=[]}})=>{t(t=>{t.kind=e,t.metadata=n,t.display=r,t.panels=i;let{panelGroups:c,panelGroupOrder:d}=L(a);t.panelGroups=c,t.panelGroupOrder=d,t.duration=o,t.refreshInterval=s??"0s",t.datasources=l,t.links=u})}}})))}let F=({isEditMode:e,setEditMode:t})=>({isEditMode:e,setEditMode:t});function q(){return B(F)}let U=({setDashboard:e,openAddPanelGroup:t,openAddPanel:n})=>({setDashboard:e,openAddPanelGroup:t,openAddPanel:n});function K(){let{setDashboard:e,openAddPanelGroup:t,openAddPanel:n}=B(U);return{setDashboard:e,openAddPanelGroup:()=>t(),openAddPanel:()=>n()}}let J=e=>e.links;function Y(){return B(J)??[]}let X=e=>({setLinks:e.setLinks});function Z(){return B(X)}let Q=e=>e.panelGroupOrder;function ee(){return B(Q)}let et=e=>e.panelGroups;function en(){let e=ee(),t=B(et);return(0,h.useMemo)(()=>e.map(e=>{let n=t[e];if(void 0===n)throw Error(`Invalid panel group Id found ${e}`);return n}),[e,t])}function er(e){let t=B((0,h.useCallback)(t=>t.panelGroups[e],[e]));if(void 0===t)throw Error(`Panel group with Id ${e} was not found`);return t}let ei=({openEditPanelGroup:e,deletePanelGroup:t,openAddPanel:n,updatePanelGroupLayouts:r})=>({openEditPanelGroup:e,deletePanelGroup:t,openAddPanel:n,updatePanelGroupLayouts:r});function ea(e){let{moveUp:t,moveDown:n}=function(e){let t=B((0,h.useCallback)(t=>t.panelGroupOrder.findIndex(t=>t===e),[e])),n=B(es),r=B(eo);if(t<0)throw Error(`Could not find panel group with Id ${e} in order array`);return{moveUp:t>0?()=>r(t,t-1):void 0,moveDown:t<n-1?()=>r(t,t+1):void 0}}(e),{openEditPanelGroup:r,deletePanelGroup:i,openAddPanel:a,updatePanelGroupLayouts:o}=B(ei);return{openEditPanelGroup:()=>r(e),deletePanelGroup:()=>i(e),openAddPanel:()=>a(e),moveUp:t,moveDown:n,updatePanelGroupLayouts:t=>o(e,t)}}let eo=e=>e.swapPanelGroups,es=e=>e.panelGroupOrder.length,el=e=>e.panelGroupEditor;function eu(){return B(el)}let ec=({deletePanelGroupDialog:e,openDeletePanelGroupDialog:t,closeDeletePanelGroupDialog:n,deletePanelGroup:r})=>({deletePanelGroupDialog:e,openDeletePanelGroupDialog:t,closeDeletePanelGroupDialog:n,deletePanelGroup:r});function ed(){let{deletePanelGroupDialog:e,openDeletePanelGroupDialog:t,closeDeletePanelGroupDialog:n,deletePanelGroup:r}=B(ec);return{deletePanelGroupDialog:e,deletePanelGroup:r,openDeletePanelGroupDialog:t,closeDeletePanelGroupDialog:()=>n()}}function ep(e){return B((0,h.useCallback)(t=>{if(void 0!==e)return t.panelGroups[e.panelGroupId]?.itemPanelKeys[e.panelGroupItemLayoutId]},[e]))}function ef(e){let{panelGroupId:t,panelGroupItemLayoutId:n}=e,r=B((0,h.useCallback)(e=>{let r=e.panelGroups[t]?.itemPanelKeys[n];if(void 0!==r)return e.panels[r]},[t,n]));if(void 0===r)throw Error(`Could not find panel for Id ${e}`);return r}let eh=({openEditPanel:e,openDeletePanelDialog:t,duplicatePanel:n,setViewPanel:r})=>({openEditPanel:e,openDeletePanelDialog:t,duplicatePanel:n,setViewPanel:r});function eg(e){let{openEditPanel:t,openDeletePanelDialog:n,duplicatePanel:r,setViewPanel:i}=B(eh);return{openEditPanel:()=>t(e),openDeletePanelDialog:()=>n(e),duplicatePanel:()=>r(e),viewPanel:e=>i(e)}}let em=e=>e.panelEditor;function ey(){return B(em)}let eb=({deletePanelDialog:e,deletePanel:t,closeDeletePanelDialog:n})=>({deletePanelDialog:e,deletePanel:t,closeDeletePanelDialog:n});function ev(){return B(eb)}let ex=e=>e.duration;function ew(){return B(ex)}let ej=e=>({setViewPanel:e.setViewPanel,getViewPanel:e.getViewPanel,viewPanelId:e.getViewPanel()});function eS(){return B(ej)}let eA=e=>e.getViewPanel();function eC(){return B(eA)}let eE=({saveChangesConfirmationDialog:e,openSaveChangesConfirmationDialog:t,closeSaveChangesConfirmationDialog:n})=>({saveChangesConfirmationDialog:e,openSaveChangesConfirmationDialog:t,closeSaveChangesConfirmationDialog:n});function eD(){return B(eE)}let eO=({discardChangesConfirmationDialog:e,openDiscardChangesConfirmationDialog:t,closeDiscardChangesConfirmationDialog:n})=>({discardChangesConfirmationDialog:e,openDiscardChangesConfirmationDialog:t,closeDiscardChangesConfirmationDialog:n});function ek(){return B(eO)}let eP=({editJsonDialog:e,openEditJsonDialog:t,closeEditJsonDialog:n})=>({editJsonDialog:e,openEditJsonDialog:t,closeEditJsonDialog:n});function eT(){return B(eP)}let eM=()=>{let{openAddPanelGroup:e}=K();return(0,o.jsx)(u.InfoTooltip,{description:c.addGroup,children:(0,o.jsx)(s.A,{startIcon:(0,o.jsx)(l.default,{}),onClick:e,"aria-label":c.addGroup,sx:p,children:"Panel Group"})})};var eR=n(69525);let eL=({variant:e="text",color:t="primary",label:n="Panel",fullWidth:r})=>{let{openAddPanel:i}=K();return(0,o.jsx)(u.InfoTooltip,{description:c.addPanel,children:(0,o.jsx)(s.A,{startIcon:(0,o.jsx)(eR.default,{}),onClick:i,"aria-label":c.addPanel,variant:e,color:t,fullWidth:r,sx:p,children:n})})};var e_=n(74628),eI=n(56599),eV=n(39098),eH=n(29057),eN=n(12548),ez=n(77308);function e$(e){let[t,n]=(0,h.useState)(!0);return(0,h.useEffect)(()=>{t&&n(!1)},[t]),(0,o.jsx)(eB,{sx:[{"& + &":{marginTop:1},"& .react-grid-item.cssTransforms":{transitionProperty:t?"none":"transform"}},...Array.isArray(e.sx)?e.sx:[e.sx]],"data-testid":"panel-group",children:e.children})}let eB=(0,ez.A)("section")(({theme:e})=>({"& .react-grid-layout":{position:"relative",transition:"height 200ms ease"},"& .react-grid-item":{transition:"all 200ms ease",transitionProperty:"left, top"},"& .react-grid-item img":{pointerEvents:"none",userSelect:"none"},"& .react-grid-item.cssTransforms":{transitionProperty:"transform"},"& .react-grid-item.resizing":{zIndex:1,willChange:"width, height"},"& .react-grid-item.react-draggable-dragging":{transition:"none",zIndex:3,willChange:"transform"},"& .react-grid-item.dropping":{visibility:"hidden"},"& .react-grid-item.react-grid-placeholder":{background:e.palette.primary.main,opacity:.2,transitionDuration:"100ms",zIndex:2,userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",OUserSelect:"none"},"& .react-grid-item > .react-resizable-handle":{position:"absolute",width:"20px",height:"20px"},"& .react-grid-item > .react-resizable-handle::after":{content:'""',position:"absolute",right:"3px",bottom:"3px",width:"5px",height:"5px",borderRight:`2px solid ${e.palette.text.secondary}`,borderBottom:`2px solid ${e.palette.text.secondary}`},"& .react-resizable-hide > .react-resizable-handle":{display:"none"},"& .react-grid-item > .react-resizable-handle.react-resizable-handle-sw":{bottom:"0",left:"0",cursor:"sw-resize",transform:"rotate(90deg)"},"& .react-grid-item > .react-resizable-handle.react-resizable-handle-se":{bottom:"0",right:"0",cursor:"se-resize"},"& .react-grid-item > .react-resizable-handle.react-resizable-handle-nw":{top:"0",left:"0",cursor:"nw-resize",transform:"rotate(180deg)"},"& .react-grid-item > .react-resizable-handle.react-resizable-handle-ne":{top:"0",right:"0",cursor:"ne-resize",transform:"rotate(270deg)"},"& .react-grid-item > .react-resizable-handle.react-resizable-handle-w, &.react-grid-item > .react-resizable-handle.react-resizable-handle-e":{top:"50%",marginTop:"-10px",cursor:"ew-resize"},"& .react-grid-item > .react-resizable-handle.react-resizable-handle-w":{left:"0",transform:"rotate(135deg)"},"& .react-grid-item > .react-resizable-handle.react-resizable-handle-e":{right:"0",transform:"rotate(315deg)"},"& .react-grid-item > .react-resizable-handle.react-resizable-handle-n, &.react-grid-item > .react-resizable-handle.react-resizable-handle-s":{left:"50%",marginLeft:"-10px",cursor:"ns-resize"},"& .react-grid-item > .react-resizable-handle.react-resizable-handle-n":{top:"0",transform:"rotate(225deg)"},"& .react-grid-item > .react-resizable-handle.react-resizable-handle-s":{bottom:"0",transform:"rotate(45deg)"},"& .react-resizable":{position:"relative"},"& .react-resizable-handle":{position:"absolute",width:"20px",height:"20px",backgroundRepeat:"no-repeat",backgroundOrigin:"content-box",boxSizing:"border-box",backgroundImage:"url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+')",backgroundPosition:"bottom right",padding:"0 3px 3px 0"},"& .react-resizable-handle-sw":{bottom:"0",left:"0",cursor:"sw-resize",transform:"rotate(90deg)"},"& .react-resizable-handle-se":{bottom:"0",right:"0",cursor:"se-resize"},"& .react-resizable-handle-nw":{top:"0",left:"0",cursor:"nw-resize",transform:"rotate(180deg)"},"& .react-resizable-handle-ne":{top:"0",right:"0",cursor:"ne-resize",transform:"rotate(270deg)"},"& .react-resizable-handle-w, .react-resizable-handle-e":{top:"50%",marginTop:"-10px",cursor:"ew-resize"},"& .react-resizable-handle-w":{left:"0",transform:"rotate(135deg)"},"& .react-resizable-handle-e":{right:"0",transform:"rotate(315deg)"},"& .react-resizable-handle-n, .react-resizable-handle-s":{left:"50%",marginLeft:"-10px",cursor:"ns-resize"},"& .react-resizable-handle-n":{top:"0",transform:"rotate(225deg)"},"& .react-resizable-handle-s":{bottom:"0",transform:"rotate(45deg)"}}));var eG=n(29424),eW=Object.defineProperty,eF=new Map,eq=new WeakMap,eU=0,eK=void 0;function eJ({threshold:e,delay:t,trackVisibility:n,rootMargin:r,root:i,triggerOnce:a,skip:o,initialInView:s,fallbackInView:l,onChange:u}={}){var c;let[d,p]=h.useState(null),f=h.useRef(u),[g,m]=h.useState({inView:!!s,entry:void 0});f.current=u,h.useEffect(()=>{let s;if(!o&&d)return s=function(e,t,n={},r=eK){if(void 0===window.IntersectionObserver&&void 0!==r){let i=e.getBoundingClientRect();return t(r,{isIntersecting:r,target:e,intersectionRatio:"number"==typeof n.threshold?n.threshold:0,time:0,boundingClientRect:i,intersectionRect:i,rootBounds:i}),()=>{}}let{id:i,observer:a,elements:o}=function(e){let t=Object.keys(e).sort().filter(t=>void 0!==e[t]).map(t=>{var n;return`${t}_${"root"===t?!(n=e.root)?"0":(eq.has(n)||(eU+=1,eq.set(n,eU.toString())),eq.get(n)):e[t]}`}).toString(),n=eF.get(t);if(!n){let r,i=new Map,a=new IntersectionObserver(t=>{t.forEach(t=>{var n;let a=t.isIntersecting&&r.some(e=>t.intersectionRatio>=e);e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=a),null==(n=i.get(t.target))||n.forEach(e=>{e(a,t)})})},e);r=a.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:a,elements:i},eF.set(t,n)}return n}(n),s=o.get(e)||[];return o.has(e)||o.set(e,s),s.push(t),a.observe(e),function(){s.splice(s.indexOf(t),1),0===s.length&&(o.delete(e),a.unobserve(e)),0===o.size&&(a.disconnect(),eF.delete(i))}}(d,(e,t)=>{m({inView:e,entry:t}),f.current&&f.current(e,t),t.isIntersecting&&a&&s&&(s(),s=void 0)},{root:i,rootMargin:r,threshold:e,trackVisibility:n,delay:t},l),()=>{s&&s()}},[Array.isArray(e)?e.toString():e,d,i,r,a,o,n,l,t]);let y=null==(c=g.entry)?void 0:c.target,b=h.useRef(void 0);d||!y||a||o||b.current===y||(b.current=y,m({inView:!!s,entry:void 0}));let v=[p,g.inView,g.entry];return v.ref=v[0],v.inView=v[1],v.entry=v[2],v}function eY(e,t){return e?.panelGroupId===t?.panelGroupId&&e?.panelGroupItemLayoutId===t?.panelGroupItemLayoutId}h.Component;let eX=(0,h.createContext)(void 0);function eZ(){let e=(0,h.useContext)(eX);if(void 0===e)throw Error("Panel focus hooks must be used within a PanelFocusProvider");return e}function eQ({children:e}){let[t,n]=(0,h.useState)(null),r=(0,h.useCallback)(e=>{n(e)},[]),i=(0,h.useCallback)(()=>{n(null)},[]),a=(0,h.useMemo)(()=>({focusedPanelKey:t,setFocusedPanel:r,clearFocusedPanel:i}),[t,r,i]);return(0,o.jsx)(eX.Provider,{value:a,children:e})}function e0(){return eZ().focusedPanelKey}function e1(e){let{setFocusedPanel:t,clearFocusedPanel:n}=eZ(),r=(0,h.useRef)(null),i=(0,h.useCallback)(n=>{let i=n.currentTarget;null!==r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{t(e),i.focus({preventScroll:!0}),r.current=null},50)},[e,t]),a=(0,h.useCallback)(()=>{null!==r.current&&(clearTimeout(r.current),r.current=null),n()},[n]);return(0,h.useEffect)(()=>()=>{null!==r.current&&clearTimeout(r.current)},[]),(0,h.useMemo)(()=>({onMouseEnter:i,onMouseLeave:a}),[i,a])}var e2=n(68150),e9=n(11750),e3=n(81023),e4=n(72052),e5=n(29009),e7=n(46733);function e8(e){return(0,e7.Ay)("MuiCardContent",e)}(0,e5.A)("MuiCardContent",["root"]);let e6=(0,ez.A)("div",{name:"MuiCardContent",slot:"Root",overridesResolver:(e,t)=>t.root})({padding:16,"&:last-child":{paddingBottom:24}}),te=h.forwardRef(function(e,t){let n=(0,e4.b)({props:e,name:"MuiCardContent"}),{className:r,component:i="div",...a}=n,s={...n,component:i},l=(e=>{let{classes:t}=e;return(0,e3.A)({root:["root"]},e8,t)})(s);return(0,o.jsx)(e6,{as:i,className:(0,e9.A)(l.root,r),ownerState:s,ref:t,...a})});var tt=n(13850),tn=n.n(tt),tr=n(33313);function ti(e){let{kind:t,spec:n,contentDimensions:r,definition:i,queryResults:a}=e,{data:s,isLoading:l}=(0,P.usePlugin)("Panel",t,{useErrorBoundary:!0}),u=s?.PanelComponent,c=s?.supportedQueryTypes||[],d=c.length>0?a:[];if(l)return(0,o.jsx)(tr.A,{variant:"rectangular",width:r?.width,height:r?.height,"aria-label":"Loading..."});if(void 0===u)throw Error(`Missing PanelComponent from panel plugin for kind '${t}'`);for(let e of d)if(!c.includes(e.definition.kind))throw Error(`This panel does not support queries of type '${e.definition.kind}'. Supported query types: ${c.join(", ")}.`);return(0,o.jsx)(u,{spec:n,contentDimensions:r,definition:i,queryResults:d})}function ta(e){let{panelPluginKind:t,definition:n,queryResults:r,spec:i,contentDimensions:a}=e,{data:s,isLoading:l}=(0,P.usePlugin)("Panel",t,{useErrorBoundary:!0});if(l)return(0,o.jsx)(tr.A,{variant:"rectangular",width:a?.width,height:a?.height,"aria-label":"Loading..."});let u=r.flatMap(e=>e.data?[{data:e.data,definition:e.definition}]:[]);if(u.length>0||0===r.length)return(0,o.jsx)(ti,{kind:t,spec:i,contentDimensions:a,definition:n,queryResults:u});if(r.some(e=>e.isFetching))return(0,o.jsx)(to,{plugin:s,spec:i,definition:n,contentDimensions:a});let c=r.find(e=>e.error);if(c)throw c.error;return(0,o.jsx)(to,{plugin:s,spec:i,definition:n,contentDimensions:a})}function to({plugin:e,spec:t,definition:n,contentDimensions:r}){return e?.LoadingComponent?(0,o.jsx)(e.LoadingComponent,{spec:t,contentDimensions:r,definition:n,queryResults:[]}):(0,o.jsx)(u.LoadingOverlay,{})}var ts=n(47599),tl=n(88091);function tu(e){return(0,e7.Ay)("MuiCardHeader",e)}let tc=(0,e5.A)("MuiCardHeader",["root","avatar","action","content","title","subheader"]);var td=n(73397);let tp=(0,ez.A)("div",{name:"MuiCardHeader",slot:"Root",overridesResolver:(e,t)=>[{[`& .${tc.title}`]:t.title},{[`& .${tc.subheader}`]:t.subheader},t.root]})({display:"flex",alignItems:"center",padding:16}),tf=(0,ez.A)("div",{name:"MuiCardHeader",slot:"Avatar",overridesResolver:(e,t)=>t.avatar})({display:"flex",flex:"0 0 auto",marginRight:16}),th=(0,ez.A)("div",{name:"MuiCardHeader",slot:"Action",overridesResolver:(e,t)=>t.action})({flex:"0 0 auto",alignSelf:"flex-start",marginTop:-4,marginRight:-8,marginBottom:-4}),tg=(0,ez.A)("div",{name:"MuiCardHeader",slot:"Content",overridesResolver:(e,t)=>t.content})({flex:"1 1 auto",[`.${ts.A.root}:where(& .${tc.title})`]:{display:"block"},[`.${ts.A.root}:where(& .${tc.subheader})`]:{display:"block"}}),tm=h.forwardRef(function(e,t){let n=(0,e4.b)({props:e,name:"MuiCardHeader"}),{action:r,avatar:i,component:a="div",disableTypography:s=!1,subheader:l,subheaderTypographyProps:u,title:c,titleTypographyProps:d,slots:p={},slotProps:f={},...h}=n,g={...n,component:a,disableTypography:s},m=(e=>{let{classes:t}=e;return(0,e3.A)({root:["root"],avatar:["avatar"],action:["action"],content:["content"],title:["title"],subheader:["subheader"]},tu,t)})(g),y={slots:p,slotProps:{title:d,subheader:u,...f}},b=c,[v,x]=(0,td.A)("title",{className:m.title,elementType:tl.A,externalForwardedProps:y,ownerState:g,additionalProps:{variant:i?"body2":"h5",component:"span"}});null==b||b.type===tl.A||s||(b=(0,o.jsx)(v,{...x,children:b}));let w=l,[j,S]=(0,td.A)("subheader",{className:m.subheader,elementType:tl.A,externalForwardedProps:y,ownerState:g,additionalProps:{variant:i?"body2":"body1",color:"textSecondary",component:"span"}});null==w||w.type===tl.A||s||(w=(0,o.jsx)(j,{...S,children:w}));let[A,C]=(0,td.A)("root",{ref:t,className:m.root,elementType:tp,externalForwardedProps:{...y,...h,component:a},ownerState:g}),[E,D]=(0,td.A)("avatar",{className:m.avatar,elementType:tf,externalForwardedProps:y,ownerState:g}),[O,k]=(0,td.A)("content",{className:m.content,elementType:tg,externalForwardedProps:y,ownerState:g}),[P,T]=(0,td.A)("action",{className:m.action,elementType:th,externalForwardedProps:y,ownerState:g});return(0,o.jsxs)(A,{...C,children:[i&&(0,o.jsx)(E,{...D,children:i}),(0,o.jsxs)(O,{...k,children:[b,w]}),r&&(0,o.jsx)(P,{...T,children:r})]})});var ty=n(315),tb=n(65211),tv=n(25742),tx=n(48865),tw=n(95591),tj=n(83183),tS=n(10713),tA=n(30443);function tC(e){return e.substring(2).toLowerCase()}function tE(e){let{children:t,disableReactTree:n=!1,mouseEvent:r="onClick",onClickAway:i,touchEvent:a="onTouchEnd"}=e,o=h.useRef(!1),s=h.useRef(null),l=h.useRef(!1),u=h.useRef(!1);h.useEffect(()=>(setTimeout(()=>{l.current=!0},0),()=>{l.current=!1}),[]);let c=(0,tw.A)((0,tA.A)(t),s),d=(0,tj.A)(e=>{let t=u.current;u.current=!1;let r=(0,tS.A)(s.current);if(!(!l.current||!s.current||"clientX"in e&&(r.documentElement.clientWidth<e.clientX||r.documentElement.clientHeight<e.clientY))){if(o.current){o.current=!1;return}(e.composedPath?e.composedPath().includes(s.current):!r.documentElement.contains(e.target)||s.current.contains(e.target))||!n&&t||i(e)}}),p=e=>n=>{u.current=!0;let r=t.props[e];r&&r(n)},f={ref:c};return!1!==a&&(f[a]=p(a)),h.useEffect(()=>{if(!1!==a){let e=tC(a),t=(0,tS.A)(s.current),n=()=>{o.current=!0};return t.addEventListener(e,d),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,d),t.removeEventListener("touchmove",n)}}},[d,a]),!1!==r&&(f[r]=p(r)),h.useEffect(()=>{if(!1!==r){let e=tC(r),t=(0,tS.A)(s.current);return t.addEventListener(e,d),()=>{t.removeEventListener(e,d)}}},[d,r]),h.cloneElement(t,f)}var tD=n(72795),tO=n(35050),tk=n(53493),tP=n(59909),tT=n(86067),tM=n(61318),tR=n(50172),tL=n(14637),t_=n(4178),tI=n(74830),tV=n(17366),tH=n(66081),tN=n(47095),tz=n(24726),t$=n(30145),tB=n(47601),tG=n(63079),tW=n(57438),tF=n(65241);function tq({links:e,variant:t}){let[n,r]=(0,h.useState)(null);return 0===e.length?null:"panel"===t&&1===e.length&&e[0]?(0,o.jsx)(tK,{link:e[0]}):"dashboard"===t&&e.length<=3&&e.every(e=>e.name?e.name.length<30:!!e.url&&e.url.length<70)?(0,o.jsx)(ty.A,{direction:"row",spacing:1,children:e.map(e=>(0,o.jsx)(tU,{link:e},e.url))}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(u.InfoTooltip,{description:`${e.length} links`,enterDelay:100,children:(0,o.jsx)(tN.A,{"aria-label":`${(0,tz.A)(t)}-links`,id:`${t}-links-button`,size:"small",onClick:e=>{r(e.currentTarget)},sx:e=>({borderRadius:e.shape.borderRadius,padding:"4px"}),children:(0,o.jsx)(tF.default,{"aria-describedby":"links-icon",fontSize:"inherit",sx:{color:e=>e.palette.text.secondary}})})}),(0,o.jsx)(t$.A,{anchorEl:n,open:!!n,onClose:()=>{r(null)},MenuListProps:{"aria-labelledby":`${t}-links-button`},children:e.map(e=>(0,o.jsx)(tJ,{link:e},e.url))})]})}function tU({link:e}){let{url:t,name:n,tooltip:r,targetBlank:i}=tY(e);return(0,o.jsx)(u.InfoTooltip,{description:r??t,enterDelay:100,children:(0,o.jsx)(tB.A,{label:n??t,component:"a",href:t,target:i?"_blank":"_self",clickable:!0,size:"medium",icon:(0,o.jsx)(tF.default,{color:"inherit",fontSize:"small"}),sx:e=>({height:e.spacing(3)})})})}function tK({link:e}){let{url:t,name:n,tooltip:r,targetBlank:i}=tY(e);return(0,o.jsx)(u.InfoTooltip,{description:r??t,enterDelay:100,children:(0,o.jsx)(tN.A,{"aria-label":n??t,size:"small",href:t,target:i?"_blank":"_self",sx:e=>({borderRadius:e.shape.borderRadius,padding:"4px"}),children:(0,o.jsx)(tF.default,{fontSize:"inherit",sx:{color:e=>e.palette.text.secondary}})})})}function tJ({link:e}){let{url:t,name:n,tooltip:r,targetBlank:i}=tY(e);return(0,o.jsx)(u.InfoTooltip,{description:r??t,enterDelay:100,children:(0,o.jsx)(tG.A,{component:tW.A,href:t,target:i?"_blank":"_self",children:n??t})})}function tY(e){let t=(0,P.useReplaceVariablesInString)(e.url)??e.url,n=(0,P.useReplaceVariablesInString)(e.name),r=(0,P.useReplaceVariablesInString)(e.tooltip);return!1===e.renderVariables?e:{...e,url:t,name:n,tooltip:r}}let tX=(0,ez.A)(tN.A)(({theme:e})=>({borderRadius:e.shape.borderRadius,padding:"4px"})),tZ={error:(0,o.jsx)(tI.default,{color:"error"}),warning:(0,o.jsx)(t_.default,{fontSize:"inherit",color:"warning"}),info:(0,o.jsx)(tV.default,{fontSize:"inherit",color:"info"})},tQ=(0,ez.A)(e_.A)({display:"none",alignItems:"center",flexGrow:1,justifyContent:"flex-end"}),t0=({editHandlers:e,readHandlers:t,viewQueriesHandler:n,extra:r,title:i,description:a,descriptionTooltipId:s,links:l,queryResults:p,pluginActions:g=[],itemActions:m=[],showIcons:y})=>{let b=(0,h.useMemo)(()=>{if(a&&a.trim().length>0)return(0,o.jsx)(u.InfoTooltip,{id:s,description:a,enterDelay:100,children:(0,o.jsx)(tX,{"aria-label":"panel description",size:"small",children:(0,o.jsx)(tV.default,{"aria-describedby":"info-tooltip","aria-hidden":!1,fontSize:"inherit",sx:{color:e=>e.palette.text.secondary}})})})},[s,a]),v=l&&l.length>0&&(0,o.jsx)(tq,{links:l,variant:"panel"}),x=void 0===e&&r,w=(0,h.useMemo)(()=>{let e=p.some(e=>e.data),t=p.some(e=>e.isFetching),n=p.filter(e=>e.error);if(t&&e)return(0,o.jsx)(tv.A,{"aria-label":"loading",size:"1.125rem"});if(n.length>0){let e=n.map(e=>e.error).map(e=>e.message).join("\n");return(0,o.jsx)(u.InfoTooltip,{description:e,children:(0,o.jsx)(tX,{"aria-label":"panel errors",size:"small",children:(0,o.jsx)(t_.default,{fontSize:"inherit",sx:{color:e=>e.palette.error.main}})})})}},[p]),j=(0,h.useMemo)(()=>{let e=p.flatMap(e=>e.data?.metadata?.notices??[]);if(e.length>0){let t=e[e.length-1];return(0,o.jsx)(u.InfoTooltip,{description:t.message,children:(0,o.jsx)(tX,{"aria-label":"panel notices",size:"small",children:tZ[t.type]})})}},[p]),S=(0,h.useMemo)(()=>{if(void 0!==t)return(0,o.jsx)(u.InfoTooltip,{description:c.viewPanel,children:(0,o.jsx)(tX,{"aria-label":d.viewPanel(i),size:"small",onClick:t.onViewPanelClick,children:t.isPanelViewed?(0,o.jsx)(tO.default,{fontSize:"inherit"}):(0,o.jsx)(tk.default,{fontSize:"inherit"})})})},[t,i]),A=(0,h.useMemo)(()=>n?.onClick?(0,o.jsx)(u.InfoTooltip,{description:c.queryView,children:(0,o.jsx)(tX,{"aria-label":d.openQueryView(i),size:"small",onClick:n.onClick,children:(0,o.jsx)(tD.default,{fontSize:"inherit"})})}):null,[n,i]),C=(0,h.useMemo)(()=>{if(void 0!==e)return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(u.InfoTooltip,{description:c.editPanel,children:(0,o.jsx)(tX,{"aria-label":d.editPanel(i),size:"small",onClick:e.onEditPanelClick,children:(0,o.jsx)(tP.default,{fontSize:"inherit"})})}),(0,o.jsx)(u.InfoTooltip,{description:c.duplicatePanel,children:(0,o.jsx)(tX,{"aria-label":d.duplicatePanel(i),size:"small",onClick:e.onDuplicatePanelClick,children:(0,o.jsx)(tR.default,{fontSize:"inherit",sx:{transform:"scale(0.925)"}})})}),(0,o.jsx)(u.InfoTooltip,{description:c.deletePanel,children:(0,o.jsx)(tX,{"aria-label":d.deletePanel(i),size:"small",onClick:e.onDeletePanelClick,children:(0,o.jsx)(tT.default,{fontSize:"inherit"})})})]})},[e,i]),E=(0,h.useMemo)(()=>{if(C&&!t?.isPanelViewed)return(0,o.jsx)(e_.A,{sx:{background:e=>e.palette.background.default},children:(0,o.jsx)(u.InfoTooltip,{description:c.movePanel,children:(0,o.jsx)(tX,{"aria-label":d.movePanel(i),size:"small",children:(0,o.jsx)(tM.default,{className:"drag-handle",sx:{cursor:"grab"},fontSize:"inherit"})})})})},[C,t,i]),D=(0,o.jsx)(e_.A,{sx:{flexGrow:1}}),O=({children:e})=>"hover"===y?(0,o.jsx)(e_.A,{sx:{display:"var(--panel-hover, none)"},children:e}):(0,o.jsx)(o.Fragment,{children:e});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(tQ,{sx:e=>({[e.containerQueries(f).between(0,170)]:{display:"flex"}}),children:[D,(0,o.jsxs)(O,{children:[(0,o.jsxs)(t1,{title:i,children:[b," ",v," ",w," ",j," ",x," ",A,S," ",g," ",m,C]}),E]})]}),(0,o.jsxs)(tQ,{sx:e=>({[e.containerQueries(f).between(170,220)]:{display:"flex"}}),children:[(0,o.jsxs)(O,{children:[b," ",v]}),D," ",w,j,(0,o.jsxs)(O,{children:[x,S,(0,o.jsxs)(t1,{title:i,children:[C," ",A," ",g," ",m]}),E]})]}),(0,o.jsxs)(tQ,{sx:e=>({display:"flex",[e.containerQueries(f).down(220)]:{display:"none"}}),children:[(0,o.jsxs)(O,{children:[b," ",v]}),D," ",w,j,(0,o.jsxs)(O,{children:[x,A,S," ",C,g.length<=1?g:(0,o.jsx)(t1,{title:i,children:g}),m.length<=1?m:(0,o.jsx)(u.InfoTooltip,{description:`${m.length} actions`,children:(0,o.jsx)(t1,{icon:(0,o.jsx)(tH.default,{fontSize:"inherit"}),direction:"column",title:i,children:m})}),E]})]})]})},t1=({children:e,title:t,icon:n,direction:r="row",placement:i="bottom",offsetX:a=-2,offsetY:s=-25})=>{let[l,u]=(0,h.useState)(null);if(!((0,h.isValidElement)(e)||Array.isArray(e)&&e.some(h.isValidElement)))return null;let c=()=>{u(null)},p=!!l,f=p?"actions-menu":void 0;return(0,o.jsxs)(e_.A,{sx:{background:e=>e.palette.background.default},children:[(0,o.jsx)(tX,{className:"show-actions","aria-describedby":f,onClick:e=>{u(l?null:e.currentTarget)},"aria-label":d.showPanelActions(t),size:"small",children:n??(0,o.jsx)(tL.default,{fontSize:"inherit"})}),(0,o.jsx)(tx.A,{id:f,open:p,anchorEl:l,placement:i,modifiers:[{name:"offset",options:{offset:[a,s]}}],sx:{backgroundColor:e=>e.palette.background.paper,borderRadius:1,boxShadow:e=>e.shadows[4]},children:(0,o.jsx)(tE,{onClickAway:c,children:(0,o.jsx)(ty.A,{direction:r,alignItems:"center",sx:{padding:1},onClick:c,children:e})})})]})};function t2({actions:e,variableState:t,disabledWithEmptySelection:n}){let{selectionMap:r}=(0,u.useSelection)(),{actionStatuses:i,setActionStatus:a}=(0,u.useItemActions)(),[s,l]=(0,h.useState)({open:!1}),c=(0,h.useCallback)(async(e,n)=>{n?await (0,P.executeAction)({action:e,selectionMap:new Map([[n.id,n.data]]),variableState:t,setActionStatus:a}):await (0,P.executeAction)({action:e,selectionMap:r,variableState:t,setActionStatus:a})},[r,t,a]),d=(0,h.useCallback)((e,t)=>{e.confirmMessage?l({open:!0,action:e,item:t}):c(e,t)},[c]),p=(0,h.useCallback)(()=>l(e=>({...e,open:!1})),[]),f=(0,h.useCallback)(async()=>{l(e=>({...e,open:!1})),s.action&&await c(s.action,s.item)},[s.action,c,s.item]),g=n&&0===r.size,m=(0,h.useMemo)(()=>{if(!e?.length)return[];let t=[];for(let n of e){if(!n.enabled)continue;let e=i.get(n.name)?.loading??!1,r=n.icon?P.ACTION_ICONS.find(e=>e.value===n.icon):void 0;t.push((0,o.jsx)(u.InfoTooltip,{description:n.name,children:(0,o.jsx)(tX,{size:"small",disabled:e||g,onClick:e=>{e.stopPropagation(),d(n)},"aria-label":n.name,children:e?(0,o.jsx)(tv.A,{size:14}):r?r.icon:(0,o.jsx)(e_.A,{component:"span",sx:{fontSize:"0.75rem",px:.5},children:n.name})})},n.name))}return t},[e,i,d,g]),y=(0,h.useCallback)(t=>{if(!e?.length)return[];let n=[];for(let r of e){if(!r.enabled)continue;let e=i.get(r.name)?.itemStatuses?.get(t.id)?.loading??!1,a=r.icon?P.ACTION_ICONS.find(e=>e.value===r.icon):void 0;n.push((0,o.jsx)(u.InfoTooltip,{description:r.name,children:(0,o.jsx)(tX,{size:"small",disabled:e||g,onClick:e=>{e.stopPropagation(),d(r,t)},"aria-label":r.name,children:e?(0,o.jsx)(tv.A,{size:14}):a?a.icon:(0,o.jsx)(e_.A,{component:"span",sx:{fontSize:"0.75rem",px:.5},children:r.name})})},`${r.name}-${t.id}`))}return n},[e,i,g,d]);return{actionButtons:m,confirmDialog:(0,h.useMemo)(()=>(0,o.jsxs)(u.Dialog,{open:s.open&&!!s.action,onClose:p,children:[(0,o.jsx)(u.Dialog.Header,{onClose:p,children:s.action?.name?`Confirm: ${s.action.name}`:"Confirm Action"}),(0,o.jsx)(u.Dialog.Content,{children:s.action?.confirmMessage??"Are you sure you want to perform this action?"}),(0,o.jsxs)(u.Dialog.Actions,{children:[(0,o.jsx)(u.Dialog.PrimaryButton,{onClick:f,children:"Confirm"}),(0,o.jsx)(u.Dialog.SecondaryButton,{onClick:p,children:"Cancel"})]})]}),[s.open,s.action,p,f]),getItemActionButtons:y}}function t9({id:e,title:t,description:n,links:r,queryResults:i,readHandlers:a,editHandlers:s,sx:l,extra:c,pluginActions:d,itemActionsListConfig:p,showIcons:g,viewQueriesHandler:m,dimension:y,...b}){let v=`${e}-title`,x=`${e}-description`,w=(0,P.useReplaceVariablesInString)(t),j=(0,P.useReplaceVariablesInString)(n),S=(0,P.useAllVariableValues)(),A=(0,h.useRef)(null),C=!!(A.current&&y?.width)&&A.current.scrollWidth>A.current.clientWidth,{actionButtons:E,confirmDialog:D}=t2({actions:p,variableState:S,disabledWithEmptySelection:!0});return(0,o.jsxs)(o.Fragment,{children:[w?(0,o.jsx)(tm,{id:e,component:"header","aria-labelledby":v,"aria-describedby":x,disableTypography:!0,title:(0,o.jsxs)(ty.A,{direction:"row",alignItems:"center",height:"var(--panel-header-height, 30px)",children:[(0,o.jsx)(tb.A,{title:w,disableHoverListener:!C,children:(0,o.jsx)(tl.A,{id:v,variant:"subtitle1",ref:A,sx:{lineHeight:"24px",minHeight:"26px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:w})}),(0,o.jsx)(t0,{title:w,description:j,descriptionTooltipId:x,links:r,readHandlers:a,editHandlers:s,viewQueriesHandler:m,extra:c,queryResults:i,pluginActions:d,itemActions:E,showIcons:g})]}),sx:(0,u.combineSx)(e=>({containerType:"inline-size",containerName:f,padding:e.spacing(1),borderBottom:`solid 1px ${e.palette.divider}`,".MuiCardHeader-content":{overflow:"hidden"}}),l),...b}):(0,o.jsx)(ty.A,{id:e,component:"header","aria-describedby":x,sx:(0,u.combineSx)({position:"absolute",right:0,top:0,zIndex:5,containerType:"inline-size",containerName:f},l),...b,children:(0,o.jsx)(t0,{title:w,description:j,descriptionTooltipId:x,links:r,readHandlers:a,editHandlers:s,viewQueriesHandler:m,extra:c,queryResults:i,pluginActions:d,itemActions:E,showIcons:g})}),D]})}let t3=(0,h.memo)(function(e){let{definition:t,readHandlers:n,editHandlers:r,onMouseEnter:i,onMouseLeave:a,sx:s,panelOptions:l,panelGroupItemId:c,viewQueriesHandler:d,...p}=e,f=(0,u.useId)("Panel"),g=`${f}-header`,[m,y]=(0,h.useState)(null),{width:b,height:v}=tn()({ref:m}),x=(0,h.useMemo)(()=>{if(void 0!==b&&void 0!==v)return{width:b,height:v}},[b,v]),{queryResults:w}=(0,P.useDataQueriesContext)(),{getPlugin:j}=(0,P.usePluginRegistry)(),S=(0,h.useMemo)(()=>({spec:t.spec.plugin.spec,queryResults:w.map(e=>({definition:e.definition,data:e.data})),contentDimensions:x,definition:t}),[t,x,w]),[A,C]=(0,h.useState)([]);(0,h.useEffect)(()=>{(async()=>{let e=t.spec.plugin.kind;if(!e||!S||!j||"function"!=typeof j)return C([]);try{let t=await j({kind:"Panel",name:e});if(!t||"object"!=typeof t||!t.actions||!Array.isArray(t.actions)||0===t.actions.length)return void C([]);let n=t.actions.filter(e=>!e.location||"header"===e.location).map((e,t)=>{let n=e.component;try{return(0,o.jsx)(n,{...S},`plugin-action-${t}`)}catch(e){return console.warn(`Failed to render plugin action ${t}:`,e),null}}).filter(e=>!!e);C(n)}catch(e){console.warn("Failed to load plugin actions:",e),C([])}})()},[t.spec.plugin.kind,S,j]);let E=l?.showIcons??(r||n?.isPanelViewed?"always":"hover"),D=t.spec.plugin.spec?.actions?t.spec.plugin.spec.actions:void 0,O=D?.enabled&&D.displayInHeader?D.actionsList:[];return(0,o.jsx)(u.SelectionProvider,{children:(0,o.jsx)(u.ItemActionsProvider,{children:(0,o.jsxs)(e2.A,{component:"section",sx:(0,u.combineSx)({width:"100%",height:"100%",display:"flex",flexFlow:"column nowrap",":hover":{"--panel-hover":"block"}},s),variant:"outlined",onMouseEnter:e=>{i?.(e)},onMouseLeave:e=>{a?.(e)},"aria-labelledby":g,"aria-describedby":g,"data-testid":"panel",...p,children:[!l?.hideHeader&&(0,o.jsx)(t9,{extra:l?.extra?.({panelDefinition:t,panelGroupItemId:c}),id:g,title:t.spec.display?.name??"",description:t.spec.display?.description,queryResults:w,readHandlers:n,editHandlers:r,viewQueriesHandler:d,links:t.spec.links,pluginActions:A,itemActionsListConfig:O,showIcons:E,sx:{py:"2px",pl:"8px",pr:"2px"},dimension:x}),(0,o.jsx)(te,{component:"figure",sx:{position:"relative",overflow:"hidden",flexGrow:1,margin:0,padding:0,":last-child":{padding:0}},ref:y,children:(0,o.jsx)(u.ErrorBoundary,{FallbackComponent:u.ErrorAlert,resetKeys:[t.spec,w],children:(0,o.jsx)(ta,{definition:t,panelPluginKind:t.spec.plugin.kind,spec:t.spec.plugin.spec,contentDimensions:x,queryResults:w})})})]})})})});var t4=n(6227);function t5({open:e,queryDefinitions:t,onClose:n}){let r=(0,h.useMemo)(()=>{if(!t?.length)return null;let e=[];return t.forEach((n,r)=>{n?.spec?.plugin?.kind&&n?.kind&&e.push((0,o.jsxs)(g().Fragment,{children:[(0,o.jsx)(P.PluginSpecEditor,{value:n.spec.plugin.spec,pluginSelection:{kind:n.spec.plugin.kind,type:n.kind},onChange:()=>{},isReadonly:!0}),r<t.length-1&&(0,o.jsx)(t4.A,{sx:{my:2}})]},`query-${r}`))}),e},[t]);return(0,o.jsxs)(u.Dialog,{open:e,onClose:n,maxWidth:"lg",fullWidth:!0,children:[(0,o.jsx)(u.Dialog.Header,{children:"Query Viewer"}),(0,o.jsx)(u.Dialog.Content,{children:r}),(0,o.jsx)(u.Dialog.Actions,{children:(0,o.jsx)(s.A,{variant:"outlined",color:"secondary",onClick:n,children:"Close"})})]})}function t7(e){let t,{panelGroupItemId:n,width:r}=e,i=ef(n),{spec:{queries:a}}=i,{isEditMode:s}=q(),{openEditPanel:l,openDeletePanelDialog:u,duplicatePanel:c,viewPanel:d}=eg(n),p=eC(),{onMouseEnter:f,onMouseLeave:g}=e1(`${n.panelGroupId}-${n.panelGroupItemLayoutId}`),{ref:m,inView:y}=eJ({threshold:0,initialInView:!1,triggerOnce:!0}),{ref:b,inView:v}=eJ({threshold:.2,initialInView:!1,triggerOnce:!1}),x=(0,eG.A)(b,m),[w,j]=(0,h.useState)(!1),S=(0,h.useMemo)(()=>s||!a?.length?void 0:{onClick:()=>{j(!0)}},[s,a]),A={isPanelViewed:eY(p,n),onViewPanelClick:function(){void 0===p?d(n):d(void 0)}};s&&(t={onEditPanelClick:l,onDuplicatePanelClick:c,onDeletePanelClick:u});let C=(0,P.useSuggestedStepMs)(r),{data:E}=(0,P.usePlugin)("Panel",i.spec.plugin.kind),D=a??[],O=D.map(e=>({kind:e.spec.plugin.kind,spec:e.spec.plugin.spec})),k="function"==typeof E?.queryOptions?E?.queryOptions(i.spec.plugin.spec):E?.queryOptions;return(0,o.jsxs)(e_.A,{ref:x,tabIndex:-1,onMouseEnter:f,onMouseLeave:g,sx:{width:"100%",height:"100%",outline:"none"},children:[(0,o.jsx)(P.DataQueriesProvider,{definitions:O,options:{suggestedStepMs:C,...k},queryOptions:{enabled:y},children:v&&(0,o.jsx)(t3,{definition:i,readHandlers:A,editHandlers:t,viewQueriesHandler:S,panelOptions:e.panelOptions,panelGroupItemId:n})}),(0,o.jsx)(t5,{open:w,queryDefinitions:D,onClose:()=>j(!1)})]})}var t8=n(87275),t6=n(11061),ne=n(65168),nt=n(46001);function nn(e){let{panelGroupId:t,title:n,collapse:r}=e,i=(0,P.useReplaceVariablesInString)(n),{openAddPanel:a,openEditPanelGroup:s,moveUp:l,moveDown:p}=ea(t),{openDeletePanelGroupDialog:f}=ed(),{isEditMode:h}=q(),g=(0,o.jsx)(tl.A,{variant:"h2",children:i});return(0,o.jsx)(e_.A,{onClick:r?.onToggleOpen,sx:{display:"flex",justifyContent:"start",alignItems:"center",cursor:r?"pointer":"auto",backgroundColor:({palette:e})=>e.background.paper},"data-testid":"panel-group-header",children:r?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(tN.A,{sx:{marginRight:1},"aria-label":`${r.isOpen?"collapse":"expand"} group ${i}`,children:r.isOpen?(0,o.jsx)(t8.default,{}):(0,o.jsx)(t6.default,{})}),g,h&&(0,o.jsxs)(ty.A,{direction:"row",marginLeft:"auto",children:[(0,o.jsx)(u.InfoTooltip,{description:c.addPanelToGroup,children:(0,o.jsx)(tN.A,{"aria-label":d.addPanelToGroup(i),onClick:e=>{e.stopPropagation(),a()},children:(0,o.jsx)(eR.default,{})})}),(0,o.jsx)(u.InfoTooltip,{description:c.editGroup,children:(0,o.jsx)(tN.A,{"aria-label":d.editGroup(i),onClick:e=>{e.stopPropagation(),s()},children:(0,o.jsx)(tP.default,{})})}),(0,o.jsx)(u.InfoTooltip,{description:c.deleteGroup,children:(0,o.jsx)(tN.A,{"aria-label":d.deleteGroup(i),onClick:e=>{e.stopPropagation(),f(t)},children:(0,o.jsx)(tT.default,{})})}),(0,o.jsx)(u.InfoTooltip,{description:c.moveGroupDown,children:(0,o.jsx)(tN.A,{"aria-label":d.moveGroupDown(i),disabled:void 0===p,onClick:e=>{e.stopPropagation(),p?.()},children:(0,o.jsx)(nt.default,{})})}),(0,o.jsx)(u.InfoTooltip,{description:c.moveGroupUp,children:(0,o.jsx)(tN.A,{"aria-label":d.moveGroupUp(i),disabled:void 0===l,onClick:e=>{e.stopPropagation(),l?.()},children:(0,o.jsx)(ne.default,{})})})]})]}):g})}function nr({panelGroupId:e,groupDefinition:t,gridColWidth:n,panelFullHeight:r,panelOptions:i,isEditMode:a=!1,onLayoutChange:s,onWidthChange:l,repeatVariable:c}){let d=(0,h.useMemo)(()=>(0,eN.WidthProvider)(eN.Responsive),[]),p=(0,eI.A)(),f=(0,eH.useViewPanelGroup)(),[g,m]=(0,h.useState)(!t.isCollapsed),y=f?.panelGroupId===e&&f.repeatVariable?.[0]===c?.[0]&&f.repeatVariable?.[1]===c?.[1],b=f?.panelGroupItemLayoutId,v=!f||y;(0,h.useEffect)(()=>{y&&m(!0)},[y]);let x=(0,h.useMemo)(()=>b?t.itemLayouts.map(e=>e.i===b?{h:Math.round(((r??window.innerHeight)-48)/40),i:b,w:48,x:0,y:0}:e):t.itemLayouts,[t.itemLayouts,b,r]);return(0,o.jsxs)(e$,{sx:{display:v?"block":"none",height:b?`${r}px`:"unset",overflow:b?"hidden":"unset"},children:[t.title&&(0,o.jsx)(nn,{panelGroupId:e,title:t.title,collapse:void 0===t.isCollapsed?void 0:{isOpen:g,onToggleOpen:()=>m(e=>!e)}}),(0,o.jsx)(eV.A,{in:g,unmountOnExit:!0,appear:!1,"data-testid":"panel-group-content",children:(0,o.jsx)(d,{className:"layout",breakpoints:{sm:p.breakpoints.values.sm,xxs:0},cols:V,rowHeight:30,draggableHandle:".drag-handle",resizeHandles:["se"],isDraggable:a&&!y,isResizable:a&&!y,margin:[10,10],containerPadding:[0,10],layouts:{sm:x},onLayoutChange:s,onWidthChange:l,allowOverlap:y,children:x.map(({i:t,w:r})=>(0,o.jsx)("div",{style:{display:b?b===t?"unset":"none":"unset"},children:(0,o.jsx)(u.ErrorBoundary,{FallbackComponent:u.ErrorAlert,children:(0,o.jsx)(t7,{panelOptions:i,panelGroupItemId:{panelGroupId:e,panelGroupItemLayoutId:t,repeatVariable:c},width:ni(r,n)})})},t))})})]})}let ni=(e,t)=>Number.isFinite(e)?Math.round(t*e+10*Math.max(0,e-1)):e;function na(e){let{panelGroupId:t,panelOptions:n,panelFullHeight:r}=e,i=er(t),{updatePanelGroupLayouts:a}=ea(t),s=eC(),{isEditMode:l}=q(),[u,c]=(0,h.useState)(0),d=s?.panelGroupId===t,p=(e,t)=>{let n=t.sm;n&&!d&&a(n)},f=(e,t,n,r)=>{c((e-t[0]*(n-1)-2*r[0])/n)};return(0,o.jsx)(o.Fragment,{children:i.repeatVariable?(0,o.jsx)(no,{repeatVariableName:i.repeatVariable,panelGroupId:t,groupDefinition:i,gridColWidth:u,panelFullHeight:r,panelOptions:n,isEditMode:l,onLayoutChange:p,onWidthChange:f}):(0,o.jsx)(nr,{panelGroupId:t,groupDefinition:i,gridColWidth:u,panelFullHeight:r,panelOptions:n,isEditMode:l,onLayoutChange:p,onWidthChange:f})})}function no({repeatVariableName:e,panelGroupId:t,groupDefinition:n,gridColWidth:r,panelFullHeight:i,panelOptions:a,isEditMode:s=!1,onLayoutChange:l,onWidthChange:u}){let c=(0,P.useVariableValues)(),d=c[e];return void 0!==d&&Array.isArray(d.value)&&0!==d.value.length?(0,o.jsx)(o.Fragment,{children:d.value.map(d=>(0,o.jsx)(P.VariableContext.Provider,{value:{state:{...c,[e]:{value:d,loading:!1}}},children:(0,o.jsx)(nr,{panelGroupId:t,groupDefinition:n,gridColWidth:r,panelFullHeight:i,panelOptions:a,isEditMode:s,onLayoutChange:l,onWidthChange:u,repeatVariable:[e,d]})},`${e}-${d}`))}):(0,o.jsx)(nr,{panelGroupId:t,groupDefinition:n,gridColWidth:r,panelFullHeight:i,panelOptions:a,isEditMode:s,onLayoutChange:l,onWidthChange:u})}let{useDebugValue:ns}=g(),{useSyncExternalStoreWithSelector:nl}=b,nu=e=>e;function nc(e,t=nu,n){let r=nl(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return ns(r),r}function nd(e,t){var n,r,i;let a={},o=[];return n=e,r=t,i=(e,t)=>{a[t]||(o.push(e),a[t]=!0)},n.forEach(e=>i(e,e.spec.name)),r.forEach(e=>e.definitions.forEach(t=>i(t,t.spec.name,e.source))),o}function np(e,t){let n={value:null,loading:!1,overriding:!1,overridden:!1};switch(e.kind){case"TextVariable":n.value=t??e.spec.value;break;case"ListVariable":if(n.options=[],n.value=t??e.spec.defaultValue??null,n.options.length>0&&!n.value){let t=n.options[0]?.value??null;null!==t&&(n.value=e.spec.allowMultiple?[t]:t)}Array.isArray(n.value)&&1===n.value.length&&n.value[0]===T.DEFAULT_ALL_VALUE&&(n.value=T.DEFAULT_ALL_VALUE)}return n}function nf(e,t,n=[]){let r=new P.VariableStoreStateMap,i={};e.forEach(e=>{i[e.spec.name]=!0},{});let a={};return n.forEach(e=>{let n=e.source;e.definitions.forEach(e=>{let o=e.spec.name,s=t[o];r.set({source:n,name:o},{...np(e,s||null),overridden:!!i[o]}),i[o]=!0,a[e.spec.name]=!0})},{}),e.forEach(e=>{let n=e.spec.name,i=t[n];r.set({name:n},{...np(e,i||null),overriding:!!a[n]})}),i={},n.slice().reverse().forEach(e=>{let t=e.source;e.definitions.forEach(e=>{let n=e.spec.name,a=r.get({source:t,name:n});a&&(a.overriding=!!i[n]),i[n]=!0})}),r}var nh=n(57348);let ng="var-",nm={encode:function(e){return Array.isArray(e)?e.join(","):e},decode:e=>{if("string"==typeof e){if(!e)return null;let t=e.split(",");return 1===t.length?t[0]:t}return""}},ny=(0,h.createContext)(void 0);function nb(){let e=(0,h.useContext)(ny);if(!e)throw Error("VariableStoreContext not initialized");return e}function nv(e){return j(nb(),t=>{let n={};return(e??t.variableDefinitions.map(e=>e.spec.name)).forEach(e=>{let r=t.variableState.get({name:e});r&&!r.overridden&&(n[e]=r)}),t.externalVariableDefinitions.forEach(e=>{let r=e.source;e.definitions.forEach(e=>{let i=e.spec.name,a=t.variableState.get({name:i,source:r});a&&!a.overridden&&(n[i]=a)})}),n},(e,t)=>JSON.stringify(e)===JSON.stringify(t))}function nx(e,t){return nc(nb(),n=>({state:n.variableState.get({name:e,source:t}),definition:((t?n.externalVariableDefinitions.find(e=>e.source===t)?.definitions:n.variableDefinitions)||[]).find(t=>t.spec.name===e)}))}function nw(){return j(nb(),e=>({setVariableValue:e.setVariableValue,setVariableLoading:e.setVariableLoading,setVariableOptions:e.setVariableOptions,setVariableDefinitions:e.setVariableDefinitions,setVariableDefaultValues:e.setVariableDefaultValues,getSavedVariablesStatus:e.getSavedVariablesStatus}),k)}function nj(){return nc(nb(),e=>e.variableDefinitions)}function nS(){return nc(nb(),e=>e.externalVariableDefinitions)}function nA({children:e,builtinVariables:t}){let n=nv(),r=nj(),i=nS(),{absoluteTimeRange:a}=(0,P.useTimeRange)(),s=(0,h.useMemo)(()=>{let e={};return Object.keys(n).forEach(t=>{let a={...n[t]};if(a.value===T.DEFAULT_ALL_VALUE){let e=nd(r,i).find(e=>e.spec.name===t);e?.kind==="ListVariable"&&e.spec.customAllValue?a.value=e.spec.customAllValue:a.value=a.options?.map(e=>e.value)??null}e[t]=a}),e},[n,r,i]),l=(0,h.useMemo)(()=>{let e=[{kind:"BuiltinVariable",spec:{name:"__from",value:()=>a.start.valueOf().toString(),source:"Dashboard",display:{name:"__from",description:"Start time of the current time range in unix millisecond epoch",hidden:!0}}},{kind:"BuiltinVariable",spec:{name:"__to",value:()=>a.end.valueOf().toString(),source:"Dashboard",display:{name:"__to",description:"End time of the current time range in unix millisecond epoch",hidden:!0}}},{kind:"BuiltinVariable",spec:{name:"__range",value:()=>(0,T.formatDuration)((0,T.intervalToDuration)(a)),source:"Dashboard",display:{name:"__range",description:"The range for the current dashboard in human readable format",hidden:!0}}},{kind:"BuiltinVariable",spec:{name:"__range_s",value:()=>((a.end.valueOf()-a.start.valueOf())/1e3).toString(),source:"Dashboard",display:{name:"__range_s",description:"The range for the current dashboard in second",hidden:!0}}},{kind:"BuiltinVariable",spec:{name:"__range_ms",value:()=>(a.end.valueOf()-a.start.valueOf()).toString(),source:"Dashboard",display:{name:"__range_ms",description:"The range for the current dashboard in millisecond",hidden:!0}}}];return t?.forEach(t=>e.push(t)),e},[a,t]);return(0,o.jsx)(P.BuiltinVariableContext.Provider,{value:{variables:l},children:(0,o.jsx)(P.VariableContext.Provider,{value:{state:s},children:e})})}function nC({initialVariableDefinitions:e=[],externalVariableDefinitions:t=[],queryParams:n,initialVariableValues:r}){var i;let a,o={...(i=n?n[0]:{},a={},Object.keys(i).forEach(e=>{let t=i[e];t&&(a[e.replace(ng,"")]=t)}),a),...r};return y()(C(O((r,i)=>({variableState:nf(e,o,t),variableDefinitions:e,externalVariableDefinitions:t,setVariableDefinitions(e){r(n=>{n.variableDefinitions=e,n.variableState=nf(e,o,t)},!1,"[Variables] setVariableDefinitions")},setVariableOptions(e,t,n){r(r=>{let i=r.variableState.get({name:e,source:n});i&&(i.options=t)},!1,"[Variables] setVariableOptions")},setVariableLoading(e,t,n){r(r=>{let i=r.variableState.get({name:e,source:n});i&&(i.loading=t)},!1,"[Variables] setVariableLoading")},setVariableValue:(e,t,i)=>r(r=>{let a=t,o=r.variableState.get({name:e,source:i});if(o){(Array.isArray(a)&&a.includes(T.DEFAULT_ALL_VALUE)&&(a=a.at(-1)===T.DEFAULT_ALL_VALUE?T.DEFAULT_ALL_VALUE:a.filter(e=>e!==T.DEFAULT_ALL_VALUE)),n)&&(0,n[1])({[`${ng}${e}`]:a});o.value=a}},!1,"[Variables] setVariableValue"),setVariableDefaultValues:()=>{let e=i().variableDefinitions,t=i().variableState,n=(0,D.jM)(e,e=>{e.forEach((n,r)=>{let i=n.spec.name;if("ListVariable"===n.kind){let a=t.get({name:i});a?.value!==void 0&&(e[r]={kind:"ListVariable",spec:(0,D.jM)(n.spec,e=>{e.defaultValue=a.value})})}else if("TextVariable"===n.kind){let a=t.get({name:i}),o="string"==typeof a?.value?a.value:"";a?.value!==void 0&&(e[r]={kind:"TextVariable",spec:(0,D.jM)(n.spec,e=>{e.value=o})})}})});return r(e=>{e.variableDefinitions=n},!1,"[Variables] setVariableDefaultValues"),n},getSavedVariablesStatus:()=>(function(e,t){let n=!1,r=[];for(let i of e){let e=i.spec.name;if("ListVariable"===i.kind){let a=t.get({name:e});a?.value!==null&&a?.value!==i.spec.defaultValue&&(r.push(e),n=!0)}else if("TextVariable"===i.kind){let a=t.get({name:e}),o="string"==typeof a?.value?a.value:"";i.spec.value!==o&&(r.push(e),n=!0)}}return{isSavedVariableModified:n,modifiedVariableNames:r}})(i().variableDefinitions,i().variableState)}))))}function nE({children:e,initialVariableDefinitions:t=[],externalVariableDefinitions:n=[],builtinVariableDefinitions:r=[],initialVariableValues:i}){let[a]=(0,h.useState)(()=>nC({initialVariableDefinitions:t,externalVariableDefinitions:n,initialVariableValues:i}));return(0,o.jsx)(ny.Provider,{value:a,children:(0,o.jsx)(nA,{builtinVariables:r,children:e})})}function nD({children:e,initialVariableDefinitions:t=[],externalVariableDefinitions:n=[],builtinVariableDefinitions:r=[]}){let i,a=(i={},nd(t,n).forEach(e=>{var t;i[t=e.spec.name,`${ng}${t}`]=nm}),(0,nh.useQueryParams)(i,{updateType:"replaceIn"})),[s]=(0,h.useState)(()=>nC({initialVariableDefinitions:t,externalVariableDefinitions:n,queryParams:a}));return(0,o.jsx)(ny.Provider,{value:s,children:(0,o.jsx)(nA,{builtinVariables:r,children:e})})}var nO=n(34007),nk=n(347),nP=n(91394),nT=n(70561),nM=n(3399),nR=n(5139),nL=n(68003),n_=n(23434),nI=n(11502);let nV=h.createContext({});var nH=n(2203);function nN(e){return(0,e7.Ay)("MuiAccordion",e)}let nz=(0,e5.A)("MuiAccordion",["root","heading","rounded","expanded","disabled","gutters","region"]),n$=(0,ez.A)(nI.A,{name:"MuiAccordion",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${nz.region}`]:t.region},t.root,!n.square&&t.rounded,!n.disableGutters&&t.gutters]}})((0,n_.A)(({theme:e})=>{let t={duration:e.transitions.duration.shortest};return{position:"relative",transition:e.transitions.create(["margin"],t),overflowAnchor:"none","&::before":{position:"absolute",left:0,top:-1,right:0,height:1,content:'""',opacity:1,backgroundColor:(e.vars||e).palette.divider,transition:e.transitions.create(["opacity","background-color"],t)},"&:first-of-type":{"&::before":{display:"none"}},[`&.${nz.expanded}`]:{"&::before":{opacity:0},"&:first-of-type":{marginTop:0},"&:last-of-type":{marginBottom:0},"& + &":{"&::before":{display:"none"}}},[`&.${nz.disabled}`]:{backgroundColor:(e.vars||e).palette.action.disabledBackground}}}),(0,n_.A)(({theme:e})=>({variants:[{props:e=>!e.square,style:{borderRadius:0,"&:first-of-type":{borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius},"&:last-of-type":{borderBottomLeftRadius:(e.vars||e).shape.borderRadius,borderBottomRightRadius:(e.vars||e).shape.borderRadius,"@supports (-ms-ime-align: auto)":{borderBottomLeftRadius:0,borderBottomRightRadius:0}}}},{props:e=>!e.disableGutters,style:{[`&.${nz.expanded}`]:{margin:"16px 0"}}}]}))),nB=(0,ez.A)("h3",{name:"MuiAccordion",slot:"Heading",overridesResolver:(e,t)=>t.heading})({all:"unset"}),nG=h.forwardRef(function(e,t){let n=(0,e4.b)({props:e,name:"MuiAccordion"}),{children:r,className:i,defaultExpanded:a=!1,disabled:s=!1,disableGutters:l=!1,expanded:u,onChange:c,square:d=!1,slots:p={},slotProps:f={},TransitionComponent:g,TransitionProps:m,...y}=n,[b,v]=(0,nH.A)({controlled:u,default:a,name:"Accordion",state:"expanded"}),x=h.useCallback(e=>{v(!b),c&&c(e,!b)},[b,c,v]),[w,...j]=h.Children.toArray(r),S=h.useMemo(()=>({expanded:b,disabled:s,disableGutters:l,toggle:x}),[b,s,l,x]),A={...n,square:d,disabled:s,disableGutters:l,expanded:b},C=(e=>{let{classes:t,square:n,expanded:r,disabled:i,disableGutters:a}=e;return(0,e3.A)({root:["root",!n&&"rounded",r&&"expanded",i&&"disabled",!a&&"gutters"],heading:["heading"],region:["region"]},nN,t)})(A),E={slots:{transition:g,...p},slotProps:{transition:m,...f}},[D,O]=(0,td.A)("root",{elementType:n$,externalForwardedProps:{...E,...y},className:(0,e9.A)(C.root,i),shouldForwardComponentProp:!0,ownerState:A,ref:t,additionalProps:{square:d}}),[k,P]=(0,td.A)("heading",{elementType:nB,externalForwardedProps:E,className:C.heading,ownerState:A}),[T,M]=(0,td.A)("transition",{elementType:eV.A,externalForwardedProps:E,ownerState:A});return(0,o.jsxs)(D,{...O,children:[(0,o.jsx)(k,{...P,children:(0,o.jsx)(nV.Provider,{value:S,children:w})}),(0,o.jsx)(T,{in:b,timeout:"auto",...M,children:(0,o.jsx)("div",{"aria-labelledby":w.props.id,id:w.props["aria-controls"],role:"region",className:C.region,children:j})})]})});var nW=n(1337);function nF(e){return(0,e7.Ay)("MuiAccordionSummary",e)}let nq=(0,e5.A)("MuiAccordionSummary",["root","expanded","focusVisible","disabled","gutters","contentGutters","content","expandIconWrapper"]),nU=(0,ez.A)(nW.A,{name:"MuiAccordionSummary",slot:"Root",overridesResolver:(e,t)=>t.root})((0,n_.A)(({theme:e})=>{let t={duration:e.transitions.duration.shortest};return{display:"flex",width:"100%",minHeight:48,padding:e.spacing(0,2),transition:e.transitions.create(["min-height","background-color"],t),[`&.${nq.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${nq.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`&:hover:not(.${nq.disabled})`]:{cursor:"pointer"},variants:[{props:e=>!e.disableGutters,style:{[`&.${nq.expanded}`]:{minHeight:64}}}]}})),nK=(0,ez.A)("span",{name:"MuiAccordionSummary",slot:"Content",overridesResolver:(e,t)=>t.content})((0,n_.A)(({theme:e})=>({display:"flex",textAlign:"start",flexGrow:1,margin:"12px 0",variants:[{props:e=>!e.disableGutters,style:{transition:e.transitions.create(["margin"],{duration:e.transitions.duration.shortest}),[`&.${nq.expanded}`]:{margin:"20px 0"}}}]}))),nJ=(0,ez.A)("span",{name:"MuiAccordionSummary",slot:"ExpandIconWrapper",overridesResolver:(e,t)=>t.expandIconWrapper})((0,n_.A)(({theme:e})=>({display:"flex",color:(e.vars||e).palette.action.active,transform:"rotate(0deg)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shortest}),[`&.${nq.expanded}`]:{transform:"rotate(180deg)"}}))),nY=h.forwardRef(function(e,t){let n=(0,e4.b)({props:e,name:"MuiAccordionSummary"}),{children:r,className:i,expandIcon:a,focusVisibleClassName:s,onClick:l,slots:u,slotProps:c,...d}=n,{disabled:p=!1,disableGutters:f,expanded:g,toggle:m}=h.useContext(nV),y={...n,expanded:g,disabled:p,disableGutters:f},b=(e=>{let{classes:t,expanded:n,disabled:r,disableGutters:i}=e;return(0,e3.A)({root:["root",n&&"expanded",r&&"disabled",!i&&"gutters"],focusVisible:["focusVisible"],content:["content",n&&"expanded",!i&&"contentGutters"],expandIconWrapper:["expandIconWrapper",n&&"expanded"]},nF,t)})(y),v={slots:u,slotProps:c},[x,w]=(0,td.A)("root",{ref:t,shouldForwardComponentProp:!0,className:(0,e9.A)(b.root,i),elementType:nU,externalForwardedProps:{...v,...d},ownerState:y,additionalProps:{focusRipple:!1,disableRipple:!0,disabled:p,"aria-expanded":g,focusVisibleClassName:(0,e9.A)(b.focusVisible,s)},getSlotProps:e=>({...e,onClick:t=>{e.onClick?.(t),m&&m(t),l&&l(t)}})}),[j,S]=(0,td.A)("content",{className:b.content,elementType:nK,externalForwardedProps:v,ownerState:y}),[A,C]=(0,td.A)("expandIconWrapper",{className:b.expandIconWrapper,elementType:nJ,externalForwardedProps:v,ownerState:y});return(0,o.jsxs)(x,{...w,children:[(0,o.jsx)(j,{...S,children:r}),a&&(0,o.jsx)(A,{...C,children:a})]})});function nX(e){return(0,e7.Ay)("MuiAccordionDetails",e)}(0,e5.A)("MuiAccordionDetails",["root"]);let nZ=(0,ez.A)("div",{name:"MuiAccordionDetails",slot:"Root",overridesResolver:(e,t)=>t.root})((0,n_.A)(({theme:e})=>({padding:e.spacing(1,2,2)}))),nQ=h.forwardRef(function(e,t){let n=(0,e4.b)({props:e,name:"MuiAccordionDetails"}),{className:r,...i}=n,a=(e=>{let{classes:t}=e;return(0,e3.A)({root:["root"]},nX,t)})(n);return(0,o.jsx)(nZ,{className:(0,e9.A)(a.root,r),ref:t,ownerState:n,...i})});var n0=n(45271),n1=n(86742);function n2(e){var t=(0,h.useState)(function(){return(0,D.CN)("function"==typeof e?e():e,!0)}),n=t[1];return[t[0],(0,h.useCallback)(function(e){n("function"==typeof e?(0,D.jM)(e):(0,D.CN)(e))},[])]}var n9=n(49603),n3=n(4150),n4=n(30576),n5=n(10571),n7=n(38990);function n8({builtinVariableDefinitions:e}){let t=(0,h.useMemo)(()=>{let t={};for(let n of e){let e=t[n.spec.source];if(e){e.push(n);continue}t[n.spec.source]=[n]}return t},[e]),n=(0,h.useMemo)(()=>{let e=[];for(let n in t)e.includes(n)||e.push(n);return e},[t]);return(0,o.jsx)(o.Fragment,{children:n.map(e=>(0,o.jsxs)(nG,{sx:e=>({".MuiAccordionSummary-root":{backgroundColor:e.palette.background.lighter},".MuiAccordionDetails-root":{backgroundColor:e.palette.background.lighter}}),children:[(0,o.jsx)(nY,{expandIcon:(0,o.jsx)(n7.default,{}),"aria-controls":"builtin",id:"builtin",children:(0,o.jsx)(tl.A,{variant:"h2",children:(0,o.jsx)(u.InfoTooltip,{title:`${e} Built-in Variables`,description:"Variables computed during dashboard rendering.",children:(0,o.jsxs)("span",{children:[e," Built-in Variables"]})})})}),(0,o.jsx)(nQ,{children:(0,o.jsx)(nk.A,{children:(0,o.jsxs)(nP.A,{sx:{minWidth:650},"aria-label":"table of external variables",children:[(0,o.jsx)(nT.A,{children:(0,o.jsxs)(nM.A,{children:[(0,o.jsx)(n0.A,{children:"Name"}),(0,o.jsx)(n0.A,{children:"Description"})]})}),(0,o.jsx)(nR.A,{children:(t[e]??[]).map(t=>(0,o.jsxs)(nM.A,{children:[(0,o.jsx)(n0.A,{component:"th",scope:"row",sx:{fontWeight:"bold"},children:t.spec.name}),(0,o.jsx)(n0.A,{children:t.spec.display?.description??""})]},e+"-"+t.spec.name))})]})})})]},e))})}function n6(e){return P.VARIABLE_TYPES.find(t=>t.kind===e)?.label}function re(e){let[t,n]=n2(e.variableDefinitions),[r,i]=(0,h.useState)(null),[a,l]=(0,h.useState)("update"),c=e.externalVariableDefinitions,d=e.builtinVariableDefinitions,p=(0,h.useMemo)(()=>{let e,n,r;return e=[],r=new Set(n=t.map(e=>e.spec.name)),n.length!==r.size&&e.push("Variable names must be unique"),{errors:e,isValid:0===e.length}},[t]),[f]=(0,h.useMemo)(()=>[nf(t,{},c)],[c,t]),g="number"==typeof r&&t[r],{openDiscardChangesConfirmationDialog:m,closeDiscardChangesConfirmationDialog:y}=ek(),b=e=>{n(t=>{t.splice(e,1)})},v=(e,t)=>{n(n=>{if("up"===t){let t=n[e-1],r=n[e];0!==e&&t&&r&&(n[e-1]=r,n[e]=t)}else{let t=n[e+1],r=n[e];if(e===n.length-1||!t||!r)return;n[e+1]=r,n[e]=t}})};return(0,o.jsxs)(o.Fragment,{children:[g&&(0,o.jsx)(rn,{variableDefinitions:t,externalVariableDefinitions:c,builtinVariableDefinitions:d,currentEditingVariableDefinition:g,variableFormAction:a,onActionChange:l,onSave:e=>{n(t=>{t[r]=e,i(null)})},onClose:()=>{"create"===a&&b(r),i(null)}}),!g&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(e_.A,{sx:{display:"flex",alignItems:"center",padding:e=>e.spacing(1,2),borderBottom:e=>`1px solid ${e.palette.divider}`},children:[(0,o.jsx)(tl.A,{variant:"h2",children:"Edit Dashboard Variables"}),(0,o.jsxs)(ty.A,{direction:"row",spacing:1,marginLeft:"auto",children:[(0,o.jsx)(s.A,{disabled:e.variableDefinitions===t||!p.isValid,variant:"contained",onClick:()=>{e.onChange(t)},children:"Apply"}),(0,o.jsx)(s.A,{color:"secondary",variant:"outlined",onClick:()=>{JSON.stringify(e.variableDefinitions)!==JSON.stringify(t)?m({onDiscardChanges:()=>{y(),e.onCancel()},onCancel:()=>{y()},description:"You have unapplied changes. Are you sure you want to discard these changes? Changes cannot be recovered."}):e.onCancel()},children:"Cancel"})]})]}),(0,o.jsx)(e_.A,{padding:2,sx:{overflowY:"scroll"},children:(0,o.jsxs)(ty.A,{spacing:2,children:[(0,o.jsxs)(ty.A,{spacing:2,children:[!p.isValid&&p.errors.map(e=>(0,o.jsx)(nO.A,{severity:"error",children:e},e)),(0,o.jsx)(nk.A,{children:(0,o.jsxs)(nP.A,{sx:{minWidth:650},"aria-label":"table of variables",children:[(0,o.jsx)(nT.A,{children:(0,o.jsxs)(nM.A,{children:[(0,o.jsx)(rt,{children:"Visibility"}),(0,o.jsx)(rt,{children:"Name"}),(0,o.jsx)(rt,{children:"Type"}),(0,o.jsx)(rt,{children:"Description"}),(0,o.jsx)(rt,{align:"right",children:"Actions"})]})}),(0,o.jsx)(nR.A,{children:t.map((e,r)=>(0,o.jsxs)(nM.A,{children:[(0,o.jsx)(rt,{component:"th",scope:"row",children:(0,o.jsx)(nL.A,{checked:e.spec.display?.hidden!==!0,onChange:e=>{var t;t=e.target.checked,n(e=>{let n=e[r];n&&(n.spec.display||(n.spec.display={name:n.spec.name,hidden:!1}),n.spec.display.hidden=!1===t)})}})}),(0,o.jsx)(rt,{component:"th",scope:"row",sx:{fontWeight:"bold"},children:(0,o.jsx)(rr,{name:e.spec.name,state:f.get({name:e.spec.name})})}),(0,o.jsx)(rt,{children:n6(e.kind)??e.kind}),(0,o.jsx)(rt,{children:e.spec.display?.description??""}),(0,o.jsxs)(rt,{align:"right",sx:{whiteSpace:"nowrap"},children:[(0,o.jsx)(tN.A,{onClick:()=>v(r,"up"),disabled:0===r,children:(0,o.jsx)(ne.default,{})}),(0,o.jsx)(tN.A,{onClick:()=>v(r,"down"),disabled:r===t.length-1,children:(0,o.jsx)(nt.default,{})}),(0,o.jsx)(tN.A,{onClick:()=>{l("update"),i(r)},children:(0,o.jsx)(n9.default,{})}),(0,o.jsx)(tN.A,{onClick:()=>{n(t=>{"TextVariable"===e.kind?t.push({...e,spec:{...e.spec,value:e.spec.value,name:`${e.spec.name}_copy`}}):t.push({...e,spec:{...e.spec,name:`${e.spec.name}_copy`}})})},children:(0,o.jsx)(tR.default,{})}),(0,o.jsx)(tN.A,{onClick:()=>b(r),children:(0,o.jsx)(n3.default,{})})]})]},e.spec.name))})]})}),(0,o.jsx)(e_.A,{display:"flex",children:(0,o.jsx)(s.A,{variant:"contained",startIcon:(0,o.jsx)(n1.default,{}),sx:{marginLeft:"auto"},onClick:()=>{l("create"),n(e=>{e.push({kind:"TextVariable",spec:{name:"NewVariable",value:""}})}),i(t.length)},children:"Add Variable"})})]}),c&&!c.every(e=>0===e.definitions.length)&&c.map((e,t)=>e.definitions.length>0&&(0,o.jsxs)(nG,{sx:e=>({".MuiAccordionSummary-root":{backgroundColor:e.palette.background.lighter},".MuiAccordionDetails-root":{backgroundColor:e.palette.background.lighter}}),children:[(0,o.jsx)(nY,{expandIcon:(0,o.jsx)(n7.default,{}),"aria-controls":e.source,id:e.source,children:(0,o.jsx)(ty.A,{flexDirection:"row",alignItems:"center",justifyContent:"start",children:(0,o.jsxs)(o.Fragment,{children:[e.tooltip?(0,o.jsx)(tl.A,{variant:"h2",children:(0,o.jsx)(u.InfoTooltip,{title:e.tooltip.title||"",description:e.tooltip.description||"",children:(0,o.jsxs)("span",{children:[(0,tz.A)(e.source)," Variables"]})})}):(0,o.jsxs)(tl.A,{variant:"h2",children:[(0,tz.A)(e.source)," Variables"]}),e.editLink&&(0,o.jsx)(tN.A,{href:e.editLink,target:"_blank",children:(0,o.jsx)(n5.default,{fontSize:"small"})})]})})}),(0,o.jsx)(nQ,{children:(0,o.jsx)(nk.A,{children:(0,o.jsxs)(nP.A,{sx:{minWidth:650},"aria-label":"table of external variables",children:[(0,o.jsx)(nT.A,{children:(0,o.jsxs)(nM.A,{children:[(0,o.jsx)(rt,{children:"Visibility"}),(0,o.jsx)(rt,{children:"Name"}),(0,o.jsx)(rt,{children:"Type"}),(0,o.jsx)(rt,{children:"Description"}),(0,o.jsx)(rt,{align:"right",children:"Actions"})]})}),(0,o.jsx)(nR.A,{children:e.definitions.map(t=>(0,o.jsxs)(nM.A,{children:[(0,o.jsx)(rt,{component:"th",scope:"row",children:(0,o.jsx)(nL.A,{checked:t.spec.display?.hidden!==!0,disabled:!0})}),(0,o.jsx)(rt,{component:"th",scope:"row",sx:{fontWeight:"bold"},children:(0,o.jsx)(rr,{name:t.spec.name,state:f.get({name:t.spec.name,source:e.source})})}),(0,o.jsx)(rt,{children:n6(t.kind)??t.kind}),(0,o.jsx)(rt,{children:t.spec.display?.description??""}),(0,o.jsxs)(rt,{align:"right",children:[(0,o.jsx)(tb.A,{title:"Override",children:(0,o.jsx)(tN.A,{onClick:()=>{n(e=>{e.push(t)})},disabled:!!f.get({name:t.spec.name}),children:(0,o.jsx)(n4.default,{})})}),(0,o.jsx)(tN.A,{disabled:!0,children:(0,o.jsx)(ne.default,{})}),(0,o.jsx)(tN.A,{disabled:!0,children:(0,o.jsx)(nt.default,{})}),(0,o.jsx)(tN.A,{disabled:!0,children:(0,o.jsx)(n9.default,{})}),(0,o.jsx)(tN.A,{disabled:!0,children:(0,o.jsx)(n3.default,{})})]})]},t.spec.name))})]})})})]},t)),d&&(0,o.jsx)(n8,{builtinVariableDefinitions:d})]})})]})]})}let rt=(0,ez.A)(n0.A)(({theme:e})=>({borderBottom:`solid 1px ${e.palette.divider}`}));function rn({variableDefinitions:e,externalVariableDefinitions:t,builtinVariableDefinitions:n,currentEditingVariableDefinition:r,variableFormAction:i,onActionChange:a,onSave:s,onClose:l}){let{initialVariableValues:u,isLoading:c}=(0,P.useResolveListVariableValues)(e);return c?(0,o.jsx)(ty.A,{sx:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",width:"100%",overflow:"hidden"},children:(0,o.jsx)(tv.A,{"aria-label":"loading"})}):(0,o.jsx)(nE,{initialVariableDefinitions:e,externalVariableDefinitions:t,builtinVariableDefinitions:n,initialVariableValues:u,children:(0,o.jsx)(P.ValidationProvider,{children:(0,o.jsx)(P.VariableEditorForm,{initialVariableDefinition:r,action:i,isDraft:!0,onActionChange:a,onSave:s,onClose:l})})})}function rr(e){let{name:t,state:n}=e;return(0,o.jsxs)(o.Fragment,{children:[!n?.overridden&&`${t} `,!n?.overridden&&n?.overriding&&(0,o.jsx)(e_.A,{fontWeight:"normal",color:e=>e.palette.primary.main,children:"(overriding)"}),n?.overridden&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e_.A,{color:e=>e.palette.grey[500],children:t}),(0,o.jsx)(e_.A,{fontWeight:"normal",color:e=>e.palette.grey[500],children:"(overridden)"})]})]})}function ri({variant:e="text",label:t="Variables",color:n="primary",fullWidth:r}){let[i,a]=(0,h.useState)(!1),l=nj(),d=nS(),f=(0,P.useBuiltinVariableDefinitions)(),{setVariableDefinitions:g}=nw(),m=()=>{a(!1)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(u.InfoTooltip,{description:c.editVariables,children:(0,o.jsx)(s.A,{startIcon:(0,o.jsx)(tP.default,{}),onClick:()=>{a(!0)},"aria-label":c.editVariables,variant:e,color:n,fullWidth:r,sx:p,children:t})}),(0,o.jsx)(u.Drawer,{isOpen:i,onClose:m,PaperProps:{sx:{width:"50%"}},"data-testid":"variable-editor",children:(0,o.jsx)(re,{variableDefinitions:l,externalVariableDefinitions:d,builtinVariableDefinitions:f,onCancel:m,onChange:e=>{g(e),a(!1)}})})]})}let ra=({label:e="Edit",onClick:t})=>(0,o.jsx)(s.A,{onClick:t,startIcon:(0,o.jsx)(tP.default,{}),variant:"outlined",color:"secondary",sx:{whiteSpace:"nowrap",minWidth:"auto"},children:e}),ro="Let's get started",rs={variant:"outlined",color:"secondary"},rl=({actions:e,isEditMode:t,onEditButtonClick:n})=>e&&"boolean"!=typeof e?e:!1===e?null:t?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(eL,{variant:"outlined",color:"secondary",label:"Add Panel",fullWidth:!0}),(0,o.jsx)(ri,{variant:"outlined",color:"secondary",label:"Add Variables",fullWidth:!0})]}):n?(0,o.jsx)(ra,{...rs,label:"Edit Dashboard",onClick:n}):null,ru=({title:e=ro,image:t,description:n,additionalText:r,actions:i,onEditButtonClick:a})=>{let{isEditMode:s}=q(),l=s?"We currently support time series charts, gauge charts, stat charts and more!":"This dashboard is currently empty. Get started by clicking the edit button.",u=(0,o.jsx)(rl,{actions:i,onEditButtonClick:a,isEditMode:s});return(0,o.jsxs)(e_.A,{sx:{width:"500px",textAlign:"center",margin:"0 auto"},children:[(0,o.jsxs)(e_.A,{sx:{width:"289px",margin:"0 auto"},children:[!!t&&t,(0,o.jsx)(tl.A,{variant:"h2",gutterBottom:!0,children:e}),(0,o.jsx)(tl.A,{variant:"body1",children:n??l}),u&&(0,o.jsx)(e_.A,{sx:{display:"flex",gap:2,marginTop:1,justifyContent:"center"},children:u})]}),r&&(0,o.jsx)(tl.A,{variant:"subtitle1",sx:{marginTop:12},children:r})]})};function rc({emptyDashboardProps:e,panelOptions:t,...n}){let r=ee(),i=(0,h.useRef)(null),a=!r.length,s=i.current?.getBoundingClientRect().top??165,l=window.innerHeight-s-window.scrollY;return(0,o.jsx)(e_.A,{...n,sx:{height:"100%"},ref:i,children:(0,o.jsxs)(u.ErrorBoundary,{FallbackComponent:u.ErrorAlert,children:[a&&(0,o.jsx)(e_.A,{sx:{height:"100%",display:"flex",alignItems:"center"},children:(0,o.jsx)(ru,{...e})}),!a&&r.map(e=>(0,o.jsx)(na,{panelGroupId:e,panelOptions:t,panelFullHeight:l},e))]})})}let rd={url:"",name:"",tooltip:"",renderVariables:!0,targetBlank:!0};function rp({links:e,onChange:t,onCancel:n}){let[r,i]=n2(e),[a,l]=(0,h.useState)(null),{openDiscardChangesConfirmationDialog:u,closeDiscardChangesConfirmationDialog:c}=ek(),d=r.every(e=>e.url.trim().length>0);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(e_.A,{sx:{display:"flex",alignItems:"center",padding:e=>e.spacing(1,2),borderBottom:e=>`1px solid ${e.palette.divider}`},children:[(0,o.jsx)(tl.A,{variant:"h2",children:"Edit Dashboard Links"}),(0,o.jsxs)(ty.A,{direction:"row",spacing:1,marginLeft:"auto",children:[(0,o.jsx)(s.A,{disabled:!d,variant:"contained",onClick:()=>t(r),children:"Apply"}),(0,o.jsx)(s.A,{color:"secondary",variant:"outlined",onClick:()=>{JSON.stringify(e)!==JSON.stringify(r)?u({onDiscardChanges:()=>{c(),n()},onCancel:c}):n()},children:"Cancel"})]})]}),(0,o.jsx)(e_.A,{padding:2,sx:{overflowY:"scroll"},children:(0,o.jsxs)(ty.A,{spacing:2,children:[(0,o.jsx)(nk.A,{children:(0,o.jsxs)(nP.A,{size:"small",sx:{tableLayout:"fixed",width:"100%"},"aria-label":"table of dashboard links",children:[(0,o.jsx)(nT.A,{children:(0,o.jsxs)(nM.A,{children:[(0,o.jsx)(n0.A,{children:"Name"}),(0,o.jsx)(n0.A,{children:"URL"}),(0,o.jsx)(n0.A,{width:80,children:"New Tab"}),(0,o.jsx)(n0.A,{align:"right",width:180,children:"Actions"})]})}),(0,o.jsx)(nR.A,{children:r.map((e,t)=>(0,o.jsx)(rf,{link:e,index:t,isFirst:0===t,isLast:t===r.length-1,isExpanded:a===t,onToggleExpand:()=>l(a===t?null:t),onUpdate:e=>{i(n=>{n[t]=e})},onRemove:()=>{i(e=>{e.splice(t,1)}),a===t?l(null):null!==a&&a>t&&l(a-1)},onMoveUp:()=>{0!==t&&(i(e=>{let n=e[t-1];n&&e[t]&&(e[t-1]=e[t],e[t]=n)}),a===t?l(t-1):a===t-1&&l(t))},onMoveDown:()=>{t>=r.length-1||(i(e=>{let n=e[t+1];n&&e[t]&&(e[t+1]=e[t],e[t]=n)}),a===t?l(t+1):a===t+1&&l(t))}},t))})]})}),0===r.length&&(0,o.jsx)(tl.A,{variant:"body1",color:"text.secondary",fontStyle:"italic",textAlign:"center",py:4,children:"No links defined. Click 'Add Link' to create one."}),(0,o.jsx)(s.A,{variant:"contained",startIcon:(0,o.jsx)(n1.default,{}),onClick:()=>{i(e=>{e.push({...rd})}),l(r.length)},sx:{alignSelf:"flex-start"},children:"Add Link"})]})})]})}function rf({link:e,index:t,isFirst:n,isLast:r,isExpanded:i,onToggleExpand:a,onUpdate:s,onRemove:l,onMoveUp:c,onMoveDown:d}){let p=e.name?.trim()||`Link ${t+1}`,f=0===e.url.trim().length;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(nM.A,{children:[(0,o.jsx)(n0.A,{component:"th",scope:"row",sx:{fontWeight:"bold",overflow:"hidden",textOverflow:"ellipsis"},children:p}),(0,o.jsx)(n0.A,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:f?"error.main":void 0},children:(0,o.jsx)(u.InfoTooltip,{description:e.url,enterDelay:100,children:e.url||"(no URL)"})}),(0,o.jsx)(n0.A,{children:e.targetBlank?"Yes":"No"}),(0,o.jsxs)(n0.A,{align:"right",sx:{whiteSpace:"nowrap"},children:[(0,o.jsx)(tN.A,{onClick:c,disabled:n,"aria-label":"Move link up",children:(0,o.jsx)(ne.default,{})}),(0,o.jsx)(tN.A,{onClick:d,disabled:r,"aria-label":"Move link down",children:(0,o.jsx)(nt.default,{})}),(0,o.jsx)(tN.A,{onClick:a,"aria-label":i?"Collapse link editor":"Edit link",children:i?(0,o.jsx)(n7.default,{}):(0,o.jsx)(n9.default,{})}),(0,o.jsx)(tN.A,{onClick:l,"aria-label":"Remove link",children:(0,o.jsx)(n3.default,{})})]})]}),(0,o.jsx)(nM.A,{children:(0,o.jsx)(n0.A,{colSpan:4,sx:{paddingBottom:0,paddingTop:0,border:i?void 0:"none"},children:(0,o.jsx)(eV.A,{in:i,timeout:"auto",unmountOnExit:!0,children:(0,o.jsx)(e_.A,{sx:{margin:2},children:(0,o.jsx)(u.LinkEditorForm,{mode:"modalEmbedded",url:{value:e.url,label:"URL",error:{hasError:f,helperText:f?"URL is required":void 0},placeholder:"https://example.com/dashboard?var=$variable",onChange:t=>s({...e,url:t})},name:{value:e.name??"",label:"Display Name",onChange:t=>s({...e,name:t})},tooltip:{value:e.tooltip??"",label:"Tooltip",onChange:t=>s({...e,tooltip:t})},renderVariables:{value:e.renderVariables??!0,label:"Replace variables in URL",onChange:t=>s({...e,renderVariables:t})},newTabOpen:{value:e.targetBlank??!0,label:"Open in new tab",onChange:t=>s({...e,targetBlank:t})}})})})})})]})}function rh({variant:e="text",label:t="Links",color:n="primary",fullWidth:r}){let[i,a]=(0,h.useState)(!1),l=Y(),{setLinks:d}=Z(),f=()=>{a(!1)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(u.InfoTooltip,{description:c.editLinks,children:(0,o.jsx)(s.A,{startIcon:(0,o.jsx)(tP.default,{}),onClick:()=>{a(!0)},"aria-label":c.editLinks,variant:e,color:n,fullWidth:r,sx:p,children:t})}),(0,o.jsx)(u.Drawer,{isOpen:i,onClose:f,PaperProps:{sx:{width:"50%"}},"data-testid":"dashboard-links-editor",children:(0,o.jsx)(rp,{links:l,onCancel:f,onChange:e=>{d?.(e),a(!1)}})})]})}let rg=(0,h.createContext)(null),rm={};function ry({children:e,defaultOptions:t=rm}){let n=(0,h.useMemo)(()=>({defaultOptions:t}),[t]);return g().createElement(rg.Provider,{value:n},e)}function rb(){return(0,h.useContext)(rg)?.defaultOptions??{}}function rv(e){return null!==e&&"object"==typeof e&&"current"in e}function rx(){if("u"<typeof navigator)return"linux";let e=navigator.platform?.toLowerCase()??"",t=navigator.userAgent?.toLowerCase()??"";return e.includes("mac")||t.includes("mac")?"mac":e.includes("win")||t.includes("win")?"windows":"linux"}let rw=["Control","Alt","Shift","Meta"],rj={Control:"Control",Ctrl:"Control",control:"Control",ctrl:"Control",Shift:"Shift",shift:"Shift",Alt:"Alt",Option:"Alt",alt:"Alt",option:"Alt",Command:"Meta",Cmd:"Meta",Meta:"Meta",command:"Meta",cmd:"Meta",meta:"Meta",OS:"Meta",os:"Meta",Win:"Meta",win:"Meta",CommandOrControl:"Mod",Mod:"Mod",commandorcontrol:"Mod",mod:"Mod"};function rS(e,t=rx()){return"Mod"===e?"mac"===t?"Meta":"Control":e}let rA=new Set(["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]),rC=new Set(["0","1","2","3","4","5","6","7","8","9"]),rE=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),rD=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),rO=new Set(["Enter","Escape","Space","Tab","Backspace","Delete"]),rk=new Set(["/","[","]","\\","=","-",",",".",";","`"]),rP={Backquote:"`",Backslash:"\\",BracketLeft:"[",BracketRight:"]",Comma:",",Equal:"=",Minus:"-",Period:".",Semicolon:";",Slash:"/"};[...rA,...rC,...rE,...rD,...rO,...rk];let rT={Esc:"Escape",esc:"Escape",escape:"Escape",Return:"Enter",return:"Enter",enter:"Enter"," ":"Space",space:"Space",Spacebar:"Space",spacebar:"Space",tab:"Tab",backspace:"Backspace",Del:"Delete",del:"Delete",delete:"Delete",Up:"ArrowUp",up:"ArrowUp",arrowup:"ArrowUp",Down:"ArrowDown",down:"ArrowDown",arrowdown:"ArrowDown",Left:"ArrowLeft",left:"ArrowLeft",arrowleft:"ArrowLeft",Right:"ArrowRight",right:"ArrowRight",arrowright:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown",PgUp:"PageUp",PgDn:"PageDown",pgup:"PageUp",pgdn:"PageDown"};function rM(e){return/^\p{Letter}$/u.test(e)}function rR(e){if(!e)return"";if(e in rT)return rT[e];if(rM(e)){let t=e.toUpperCase();return 1===t.length?t:e}let t=e.toUpperCase();return/^F([1-9]|1[0-2])$/.test(t)?t:e}let rL={Control:"⌃",Alt:"⌥",Shift:"⇧",Meta:"⌘",Mod:"⌘"},r_={Control:"Control",Alt:"Option",Shift:"Shift",Meta:"Cmd",Mod:"Cmd"},rI={Control:"Ctrl",Alt:"Alt",Shift:"Shift",Meta:"Win",Mod:"Ctrl"},rV={...rI,Meta:"Super"},rH={"`":"Backquote","\\":"Backslash","[":"Left Bracket","]":"Right Bracket",",":"Comma","=":"Equal","-":"Minus",".":"Period",";":"Semicolon"},rN={ArrowUp:"↑",ArrowDown:"↓",ArrowLeft:"←",ArrowRight:"→",Enter:"↵",Escape:"Esc",Backspace:"⌫",Delete:"⌦",Tab:"⇥",Space:"␣"};function rz(e,t=rx()){let n=e.split("+"),r=new Set,i="";for(let e=0;e<n.length;e++){let a=n[e].trim();if(e===n.length-1)i=rR(a);else{let e=rj[a]??rj[a.toLowerCase()];if(e){let n=rS(e,t);r.add(n)}else 1===n.length&&(i=rR(a))}}return!i&&n.length>0&&(i=rR(n[n.length-1].trim())),{key:i,ctrl:r.has("Control"),shift:r.has("Shift"),alt:r.has("Alt"),meta:r.has("Meta"),modifiers:rw.filter(e=>r.has(e))}}function r$(e,t=rx()){let n=e.ctrl??!1,r=e.shift??!1,i=e.alt??!1,a=e.meta??!1;e.mod&&("Control"===rS("Mod",t)?n=!0:a=!0);let o=rw.filter(e=>{switch(e){case"Control":return n;case"Shift":return r;case"Alt":return i;case"Meta":return a;default:return!1}});return{key:e.key,ctrl:n,shift:r,alt:i,meta:a,modifiers:o}}function rB(e,t){let n="mac"===t?e.meta&&!e.ctrl:e.ctrl&&!e.meta,r=[];if(n)r.push("Mod"),e.alt&&r.push("Alt"),e.shift&&r.push("Shift");else for(let t of rw)e.modifiers.includes(t)&&r.push(t);return r.push(rR(e.key)),r.join("+")}function rG(e,t=rx()){return"string"==typeof e?function(e,t=rx()){return rB(rz(e,t),t)}(e,t):function(e,t=rx()){return rB(e,t)}(r$(e,t),t)}function rW(e){return e in rj||e.toLowerCase()in rj}function rF(e){return e.join(" ")}function rq(e,t={}){let n=t.platform??rx(),r=t.useSymbols??!0,i=t.separatorToken??("mac"===n&&r?" ":"+");return rG(e,n).split("+").map(e=>{if(rW(e)){let t=rj[e]??rj[e.toLowerCase()];return"mac"===n?r?rL[t]:r_[t]:"windows"===n?rI[t]:rV[t]}{let t=r&&rN[e];return t||!r&&rH[e]||e}}).join(i)}function rU(e,t,n=rx()){let r="string"==typeof t?rz(t,n):t;if(e.ctrlKey!==r.ctrl||e.shiftKey!==r.shift||e.altKey!==r.alt||e.metaKey!==r.meta)return!1;let i=rR(e.key),a=r.key;if("Dead"!==i&&1===i.length&&1===a.length){if(i.toUpperCase()===a.toUpperCase())return!0;if(rM(i)&&(/^[A-Za-z]$/.test(i)||!e.altKey))return!1}if(e.code&&("Dead"===i||1===i.length&&1===a.length)){if(e.code.startsWith("Key")){let t=e.code.slice(3);if(1===t.length&&/^[A-Za-z]$/.test(t))return t.toUpperCase()===a.toUpperCase()}if(e.code.startsWith("Digit")){let t=e.code.slice(5);if(1===t.length&&/^[0-9]$/.test(t))return t===a}return e.code in rP&&rP[e.code]===a}return i===a}let rK={preventDefault:!0,stopPropagation:!0,eventType:"keydown",enabled:!0,ignoreInputs:!0,conflictBehavior:"warn"};function rJ(e){return!e.ctrl&&!e.meta&&"Escape"!==e.key}function rY(e){if(!e)return!1;if(e instanceof HTMLInputElement){let t=e.type.toLowerCase();return"button"!==t&&"submit"!==t&&"reset"!==t}return!!(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable)}function rX(e,t,n){let r="u"<typeof document?null:"u">typeof Document&&t instanceof Document||"u">typeof Node&&t.nodeType===Node.DOCUMENT_NODE?t.activeElement:"u">typeof HTMLElement&&t instanceof HTMLElement?t.ownerDocument.activeElement??null:t.document.activeElement??null;return!!(r&&rY(r)&&r!==n||e.composedPath().some(e=>rY(e)&&e!==n))||rY(e.target)&&e.target!==n}function rZ(e,t){return t===document||t===window?e.currentTarget===t||e.currentTarget===document.documentElement:t===window?e.currentTarget===window||e.currentTarget===document||e.currentTarget===document.documentElement:!!(t instanceof HTMLElement&&(e.currentTarget===t||e.target instanceof Node&&t.contains(e.target)))||!1}function rQ(e,t,n,r){if("allow"!==n){if("warn"===n)return void console.warn(`'${t}' is already registered. Multiple handlers will be triggered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to suppress this warning.`);if("error"===n)throw Error(`'${t}' is already registered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to allow multiple registrations.`);r(e)}}var r0=((a=r0||{})[a.None=0]="None",a[a.Mutable=1]="Mutable",a[a.Watching=2]="Watching",a[a.RecursedCheck=4]="RecursedCheck",a[a.Recursed=8]="Recursed",a[a.Dirty=16]="Dirty",a[a.Pending=32]="Pending",a);function r1(e,t,n){let r="object"==typeof e,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}let r2=[],r9=0,{link:r3,unlink:r4,propagate:r5,checkDirty:r7,shallowPropagate:r8}=function({update:e,notify:t,unwatched:n}){return{link:function(e,t,n){let r=t.depsTail;if(void 0!==r&&r.dep===e)return;let i=void 0!==r?r.nextDep:t.deps;if(void 0!==i&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(void 0!==a&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};void 0!==i&&(i.prevDep=o),void 0!==r?r.nextDep=o:t.deps=o,void 0!==a?a.nextSub=o:e.subs=o},unlink:function(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return void 0!==a?a.prevDep=i:t.depsTail=i,void 0!==i?i.nextDep=a:t.deps=a,void 0!==o?o.prevSub=s:r.subsTail=s,void 0!==s?s.nextSub=o:void 0===(r.subs=o)&&n(r),a},propagate:function(e){let n,r=e.nextSub;e:for(;;){let i=e.sub,a=i.flags;if(60&a?12&a?4&a?!(48&a)&&function(e,t){let n=t.depsTail;for(;void 0!==n;){if(n===e)return!0;n=n.prevDep}return!1}(e,i)?(i.flags=40|a,a&=1):a=0:i.flags=-9&a|32:a=0:i.flags=32|a,2&a&&t(i),1&a){let t=i.subs;if(void 0!==t){let i=(e=t).nextSub;void 0!==i&&(n={value:r,prev:n},r=i);continue}}if(void 0!==(e=r)){r=e.nextSub;continue}for(;void 0!==n;)if(e=n.value,n=n.prev,void 0!==e){r=e.nextSub;continue e}break}},checkDirty:function(t,n){let i,a=0,o=!1;e:for(;;){let s=t.dep,l=s.flags;if(16&n.flags)o=!0;else if((17&l)==17){if(e(s)){let e=s.subs;void 0!==e.nextSub&&r(e),o=!0}}else if((33&l)==33){(void 0!==t.nextSub||void 0!==t.prevSub)&&(i={value:t,prev:i}),t=s.deps,n=s,++a;continue}if(!o){let e=t.nextDep;if(void 0!==e){t=e;continue}}for(;a--;){let a=n.subs,s=void 0!==a.nextSub;if(s?(t=i.value,i=i.prev):t=a,o){if(e(n)){s&&r(a),n=t.sub;continue}o=!1}else n.flags&=-33;n=t.sub;let l=t.nextDep;if(void 0!==l){t=l;continue e}}return o}},shallowPropagate:r};function r(e){do{let n=e.sub,r=n.flags;(48&r)==32&&(n.flags=16|r,(6&r)==2&&t(n))}while(void 0!==(e=e.nextSub))}}({update:e=>e._update(),notify(e){r2[ie++]=e,e.flags&=~r0.Watching},unwatched(e){void 0!==e.depsTail&&(e.depsTail=void 0,e.flags=r0.Mutable|r0.Dirty,it(e))}}),r6=0,ie=0;function it(e){let t=e.depsTail,n=void 0!==t?t.nextDep:e.deps;for(;void 0!==n;)n=r4(n,e)}class ir{constructor(e){this.atom=function(e){let t="function"==typeof e,n={_snapshot:t?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:t?r0.None:r0.Mutable,get:()=>(void 0!==r&&r3(n,r,r9),n._snapshot),subscribe(e){var t;let i,a,o=r1(e),s={current:!1},l=(t=()=>{n.get(),s.current?o.next?.(n._snapshot):s.current=!0},i=()=>{let e=r;r=a,++r9,a.depsTail=void 0,a.flags=r0.Watching|r0.RecursedCheck;try{return t()}finally{r=e,a.flags&=~r0.RecursedCheck,it(a)}},a={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:r0.Watching|r0.RecursedCheck,notify(){let e=this.flags;e&r0.Dirty||e&r0.Pending&&r7(this.deps,this)?i():this.flags=r0.Watching},stop(){this.flags=r0.None,this.depsTail=void 0,it(this)}},i(),a);return{unsubscribe:()=>{l.stop()}}},_update(i){let a=r,o=(void 0)??Object.is;if(t)r=n,++r9,n.depsTail=void 0;else if(void 0===i)return!1;t&&(n.flags=r0.Mutable|r0.RecursedCheck);try{let r=n._snapshot,a="function"==typeof i?i(r):void 0===i&&t?e(r):i;if(void 0===r||!o(r,a))return n._snapshot=a,!0;return!1}finally{r=a,t&&(n.flags&=~r0.RecursedCheck),it(n)}}};return t?(n.flags=r0.Mutable|r0.Dirty,n.get=function(){let e=n.flags;if(e&r0.Dirty||e&r0.Pending&&r7(n.deps,n)){if(n._update()){let e=n.subs;void 0!==e&&r8(e)}}else e&r0.Pending&&(n.flags=e&~r0.Pending);return void 0!==r&&r3(n,r,r9),n._snapshot}):n.set=function(e){if(n._update(e)){let e=n.subs;if(void 0!==e&&(r5(e),r8(e),1)){for(;r6<ie;){let e=r2[r6];r2[r6++]=void 0,e.notify()}r6=0,ie=0}}},n}(e)}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(r1(e))}}function ii(e){return{hotkey:e.hotkey,id:e.id,options:e.options,parsedHotkey:e.parsedHotkey,target:e.target,triggerCount:e.triggerCount,hasFired:e.hasFired}}let ia=0;function io(){return`hotkey_${++ia}`}var is=class e{static #e=null;#t;#n=new Map;#r=new Map;constructor(){this.registrations=new ir(new Map),this.#t=rx()}static getInstance(){return e.#e||(e.#e=new e),e.#e}static resetInstance(){e.#e&&(e.#e.destroy(),e.#e=null)}register(e,t,n={}){if("u"<typeof document&&!n.target){let e=t;return{id:io(),unregister:()=>{},get callback(){return e},set callback(newCallback){e=newCallback},setOptions:()=>{},get isActive(){return!1}}}let r=io(),i=n.platform??this.#t,a="string"==typeof e?rz(e,i):r$(e,i),o="string"==typeof e?e:function(e){let t=[];for(let n of rw)e.modifiers.includes(n)&&t.push(n);return t.push(e.key),t.join("+")}(a),s=n.target??document,l=n.conflictBehavior??"warn",u=this.#i(o,s);u&&rQ(u.id,o,l,e=>this.#a(e));let c=n.ignoreInputs??rJ(a),d={id:r,hotkey:o,parsedHotkey:a,callback:t,options:{...rK,requireReset:!1,...n,platform:i,ignoreInputs:c},hasFired:!1,triggerCount:0,target:s};this.registrations.setState(e=>new Map(e).set(r,d)),this.#r.has(s)||this.#r.set(s,new Set),this.#r.get(s).add(r),this.#o(s);let p=this;return{get id(){return r},unregister:()=>{p.#a(r)},get callback(){return p.registrations.state.get(r)?.callback??t},set callback(newCallback){let e=p.registrations.state.get(r);e&&(e.callback=newCallback)},setOptions:e=>{p.registrations.setState(t=>{let n=t.get(r);if(n){let i=new Map(t);return i.set(r,{...n,options:{...n.options,...e}}),i}return t})},get isActive(){return p.registrations.state.has(r)}}}#a(e){let t=this.registrations.state.get(e);if(!t)return;let n=t.target;this.registrations.setState(t=>{let n=new Map(t);return n.delete(e),n});let r=this.#r.get(n);r&&(r.delete(e),0===r.size&&this.#s(n))}#o(e){if("u"<typeof document||this.#n.has(e))return;let t=this.#l(e),n=this.#u(e);e.addEventListener("keydown",t),e.addEventListener("keyup",n),this.#n.set(e,{keydown:t,keyup:n})}#s(e){if("u"<typeof document)return;let t=this.#n.get(e);t&&(e.removeEventListener("keydown",t.keydown),e.removeEventListener("keyup",t.keyup),this.#n.delete(e),this.#r.delete(e))}#c(e,t,n){let r=this.#r.get(t);if(r)for(let i of r){let r=this.registrations.state.get(i);if(r&&rZ(e,t)&&r.options.enabled&&!(!1!==r.options.ignoreInputs&&rX(e,t,r.target)))if("keydown"===n){if("keydown"!==r.options.eventType)continue;rU(e,r.parsedHotkey,r.options.platform)&&(r.options.preventDefault&&e.preventDefault(),r.options.stopPropagation&&e.stopPropagation(),r.options.requireReset&&r.hasFired||(this.#d(r,e),r.options.requireReset&&(r.hasFired=!0)))}else"keyup"===r.options.eventType&&rU(e,r.parsedHotkey,r.options.platform)&&this.#d(r,e),r.options.requireReset&&r.hasFired&&this.#p(r,e)&&(r.hasFired=!1)}}#d(e,t){e.options.preventDefault&&t.preventDefault(),e.options.stopPropagation&&t.stopPropagation(),e.triggerCount++,this.registrations.setState(e=>new Map(e));let n={hotkey:e.hotkey,parsedHotkey:e.parsedHotkey};e.callback(t,n)}#l(e){return t=>{this.#c(t,e,"keydown")}}#u(e){return t=>{this.#c(t,e,"keyup")}}#i(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&n.target===t)return n;return null}#p(e,t){let n=e.parsedHotkey,r=rR(t.key),i=1===n.key.length?n.key.toUpperCase():n.key;return(1===r.length?r.toUpperCase():r)===i||!!n.ctrl&&"Control"===r||!!n.shift&&"Shift"===r||!!n.alt&&"Alt"===r||!!n.meta&&"Meta"===r}triggerRegistration(e){let t=this.registrations.state.get(e);if(!t)return!1;let n=t.parsedHotkey,r=new KeyboardEvent(t.options.eventType??"keydown",{key:n.key,ctrlKey:n.ctrl,shiftKey:n.shift,altKey:n.alt,metaKey:n.meta,bubbles:!0,cancelable:!0});return t.triggerCount++,this.registrations.setState(e=>new Map(e)),t.callback(r,{hotkey:t.hotkey,parsedHotkey:t.parsedHotkey}),!0}getRegistrationCount(){return this.registrations.state.size}isRegistered(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&(void 0===t||n.target===t))return!0;return!1}destroy(){for(let e of this.#n.keys())this.#s(e);this.registrations.setState(()=>new Map),this.#n.clear(),this.#r.clear()}};function il(){return is.getInstance()}function iu(e,t={}){let n=rb().hotkey,r=il(),i=t.platform??n?.platform??rx(),a=(0,h.useRef)(new Map),o=(0,h.useRef)(e),s=(0,h.useRef)([]),l=(0,h.useRef)(t),u=(0,h.useRef)(n),c=(0,h.useRef)(r),d=e.map(e=>rG(e.hotkey,i));o.current=e,s.current=d,l.current=t,u.current=n,c.current=r,(0,h.useEffect)(()=>{let e=a.current,t=new Map,n=[];for(let e=0;e<o.current.length;e++){let t=o.current[e],r=s.current[e],i={...u.current,...l.current,...t.options},a=rv(i.target)?i.target.current:i.target??("u">typeof document?document:null);if(!a)continue;let c=`${e}:${r}`;n.push({registrationKey:c,def:t,hotkeyStr:r,mergedOptions:i,resolvedTarget:a})}let r=new Set(n.map(e=>e.registrationKey));for(let[t,n]of e)!r.has(t)&&n.handle.isActive&&n.handle.unregister();for(let r of n){let{registrationKey:n,def:i,hotkeyStr:a,mergedOptions:o,resolvedTarget:s}=r,l=e.get(n);if(l?.handle.isActive&&l.target===s){t.set(n,l);continue}l?.handle.isActive&&l.handle.unregister();let u=c.current.register(a,i.callback,{...o,target:s});t.set(n,{handle:u,target:s})}a.current=t}),(0,h.useEffect)(()=>()=>{for(let{handle:e}of a.current.values())e.isActive&&e.unregister();a.current=new Map},[]);for(let r=0;r<e.length;r++){let i=e[r],o=d[r],s=`${r}:${o}`,l=a.current.get(s)?.handle;if(l?.isActive){l.callback=i.callback;let{target:e,...r}={...n,...t,...i.options};l.setOptions(r)}}}let ic=0;function id(e){let t=e.parsedSequence.length,n=e.currentIndex>0&&e.currentIndex<t;return{id:e.id,sequence:e.sequence,options:e.options,target:e.target,triggerCount:e.triggerCount,hasFired:e.hasFired,matchedStepCount:n?e.currentIndex:0,partialMatchLastKeyTime:n?e.lastKeyTime:0}}var ip=class e{static #e=null;#f=new Map;#n=new Map;#r=new Map;#t;constructor(){this.registrations=new ir(new Map),this.#t=rx()}static getInstance(){return e.#e||(e.#e=new e),e.#e}static resetInstance(){e.#e&&(e.#e.destroy(),e.#e=null)}#h(e){this.registrations.setState(t=>new Map(t).set(e.id,id(e)))}register(e,t,n={}){if(0===e.length)throw Error("Sequence must contain at least one hotkey");let r=`sequence_${++ic}`,i=n.platform??this.#t,a=e.map(e=>rz(e,i)),o=n.target??("u">typeof document?document:{}),s=n.conflictBehavior??"warn",l=this.#g(e,o);l&&rQ(l.id,rF(e),s,e=>this.#a(e));let u=a[0],c=n.ignoreInputs??rJ(u),d={id:r,sequence:e,parsedSequence:a,callback:t,options:{...rK,timeout:1e3,...n,platform:i,ignoreInputs:c},target:o,currentIndex:0,lastKeyTime:0,triggerCount:0,hasFired:!1};this.#f.set(r,d),this.registrations.setState(e=>new Map(e).set(r,id(d))),this.#r.has(o)||this.#r.set(o,new Set),this.#r.get(o).add(r),this.#o(o);let p=this;return{get id(){return r},get isActive(){return p.#f.has(r)},get callback(){return p.#f.get(r)?.callback??t},set callback(newCallback){let e=p.#f.get(r);e&&(e.callback=newCallback)},setOptions:e=>{let t=p.#f.get(r);t&&(t.options={...t.options,...e},p.registrations.setState(e=>new Map(e).set(r,id(t))))},unregister:()=>{p.#a(r)}}}#a(e){let t=this.#f.get(e);if(!t)return;let n=t.target;this.#f.delete(e),this.registrations.setState(t=>{let n=new Map(t);return n.delete(e),n});let r=this.#r.get(n);r&&(r.delete(e),0===r.size&&this.#s(n))}#o(e){if("u"<typeof document||this.#n.has(e))return;let t=this.#l(e),n=this.#u(e);e.addEventListener("keydown",t),e.addEventListener("keyup",n),this.#n.set(e,{keydown:t,keyup:n})}#s(e){if("u"<typeof document)return;let t=this.#n.get(e);t&&(e.removeEventListener("keydown",t.keydown),e.removeEventListener("keyup",t.keyup),this.#n.delete(e),this.#r.delete(e))}#l(e){return t=>{this.#c(t,e,"keydown")}}#u(e){return t=>{this.#c(t,e,"keyup")}}#c(e,t,n){if(rW(rR(e.key)))return;let r=this.#r.get(t);if(!r)return;let i=Date.now();for(let a of r){let r=this.#f.get(a);if(!r||!rZ(e,t)||!r.options.enabled||!1!==r.options.ignoreInputs&&rX(e,t,r.target)||r.options.eventType!==n)continue;let o=r.options.timeout??1e3;r.currentIndex>0&&i-r.lastKeyTime>o&&(r.currentIndex=0,this.#h(r));let s=r.parsedSequence[r.currentIndex];if(s)if(rU(e,s,r.options.platform))if(r.lastKeyTime=i,r.currentIndex++,r.currentIndex>=r.parsedSequence.length){r.options.preventDefault&&e.preventDefault(),r.options.stopPropagation&&e.stopPropagation();let t={hotkey:r.sequence.join(" "),parsedHotkey:r.parsedSequence[r.parsedSequence.length-1]};r.triggerCount++,r.hasFired=!0,r.currentIndex=0,this.#h(r),r.callback(e,t)}else this.#h(r);else r.currentIndex>0&&(rU(e,r.parsedSequence[0],r.options.platform)?(r.currentIndex=1,r.lastKeyTime=i):r.currentIndex=0,this.#h(r))}}#g(e,t){let n=e.join("|");for(let e of this.#f.values())if(e.sequence.join("|")===n&&e.target===t)return e;return null}resetAll(){for(let e of this.#f.values())e.currentIndex=0,e.lastKeyTime=0,this.#h(e)}triggerSequence(e){let t=this.#f.get(e);if(!t)return!1;let n=t.parsedSequence[t.parsedSequence.length-1];if(!n)return!1;let r=new KeyboardEvent(t.options.eventType??"keydown",{key:n.key,ctrlKey:n.ctrl,shiftKey:n.shift,altKey:n.alt,metaKey:n.meta,bubbles:!0,cancelable:!0});t.triggerCount++,t.hasFired=!0,this.#h(t);let i={hotkey:t.sequence.join(" "),parsedHotkey:n};return t.callback(r,i),!0}getRegistrationCount(){return this.#f.size}destroy(){for(let e of this.#n.keys())this.#s(e);this.#f.clear(),this.registrations.setState(()=>new Map)}};function ih(){return ip.getInstance()}function ig(e,t={}){let n=rb().hotkeySequence,r=ih(),i=(0,h.useRef)(new Map),a=(0,h.useRef)(e),o=(0,h.useRef)([]),s=(0,h.useRef)(t),l=(0,h.useRef)(n),u=(0,h.useRef)(r),c=e.map(e=>rF(e.sequence));a.current=e,o.current=c,s.current=t,l.current=n,u.current=r,(0,h.useEffect)(()=>{let e=i.current,t=new Map,n=[];for(let e=0;e<a.current.length;e++){let t=a.current[e],r=o.current[e],i=t.sequence;if(0===i.length)continue;let u={...l.current,...s.current,...t.options},c=rv(u.target)?u.target.current:u.target??("u">typeof document?document:null);if(!c)continue;let d=`${e}:${r}`;n.push({registrationKey:d,def:t,seq:i,seqStr:r,mergedOptions:u,resolvedTarget:c})}let r=new Set(n.map(e=>e.registrationKey));for(let[t,n]of e)!r.has(t)&&n.handle.isActive&&n.handle.unregister();for(let r of n){let{registrationKey:n,def:i,seq:a,mergedOptions:o,resolvedTarget:s}=r,l=e.get(n);if(l?.handle.isActive&&l.target===s){t.set(n,l);continue}l?.handle.isActive&&l.handle.unregister();let c=u.current.register(a,i.callback,{...o,target:s});t.set(n,{handle:c,target:s})}i.current=t}),(0,h.useEffect)(()=>()=>{for(let{handle:e}of i.current.values())e.isActive&&e.unregister();i.current=new Map},[]);for(let r=0;r<e.length;r++){let a=e[r],o=c[r],s=`${r}:${o}`,l=i.current.get(s)?.handle;if(l?.isActive&&a.sequence.length>0){l.callback=a.callback;let{target:e,...r}={...n,...t,...a.options};l.setOptions(r)}}}let im="perses:save-dashboard",iy="perses:refresh-dashboard",ib="perses:toggle-edit-mode",iv="perses:time-zoom-out",ix="perses:time-zoom-in",iw="perses:time-shift-back",ij="perses:time-shift-forward",iS="perses:time-make-absolute",iA="perses:time-copy",iC="perses:time-paste",iE="perses:panel-edit",iD="perses:panel-fullscreen",iO="perses:panel-duplicate",ik="perses:panel-delete",iP="perses:open-search",iT="perses:show-shortcuts",iM="perses:toggle-theme",iR={id:"save-dashboard",hotkey:"Mod+S",name:"Save Dashboard",description:"Save the current dashboard",category:"dashboard",scope:"dashboard",event:im},iL={id:"refresh-dashboard",sequence:["D","R"],name:"Refresh Dashboard",description:"Refresh all panels",category:"dashboard",scope:"dashboard",event:iy},i_={id:"toggle-edit-mode",sequence:["D","M"],name:"Toggle Edit Mode",description:"Toggle between edit and view mode",category:"dashboard",scope:"dashboard",event:ib},iI=[iR,iL,i_],iV={id:"panel-edit",hotkey:"E",name:"Edit Panel",description:"Edit the focused panel when in edit mode",category:"focused-panel",scope:"panel",event:iE,ignoreInputs:!0},iH={id:"panel-fullscreen",hotkey:"V",name:"Toggle Fullscreen",description:"Toggle fullscreen on the focused panel",category:"focused-panel",scope:"panel",event:iD,ignoreInputs:!0},iN={id:"panel-duplicate",sequence:["P","D"],name:"Duplicate Panel",description:"Duplicate the focused panel",category:"focused-panel",scope:"panel",event:iO},iz={id:"panel-delete",sequence:["P","R"],name:"Delete Panel",description:"Delete the focused panel",category:"focused-panel",scope:"panel",event:ik},i$=[iV,iH,iN,iz];function iB(e,t){return{enabled:t,meta:{id:e.id,name:e.name,description:e.description,category:e.category,scope:e.scope,displayOverride:e.displayOverride},...void 0!==e.ignoreInputs?{ignoreInputs:e.ignoreInputs}:{}}}function iG(e){if(void 0===e.hotkey)throw Error(`Shortcut ${e.id} is missing a hotkey definition`);return e.hotkey}function iW(e){if(void 0===e.sequence)throw Error(`Shortcut ${e.id} is missing a sequence definition`);return e.sequence}function iF(e){if(void 0===e.event)throw Error(`Shortcut ${e.id} is missing an event definition`);return e.event}function iq(e){window.dispatchEvent(new CustomEvent(e))}function iU(e){return t=>{"Enter"===t.key&&(t.ctrlKey||t.metaKey)&&!t.shiftKey&&!t.altKey&&(t.preventDefault(),e())}}let iK={id:"time-zoom-out",sequence:["T","O"],name:"Zoom Out",description:"Zoom out time range (2x)",category:"time-range",scope:"dashboard",event:iv},iJ={id:"time-zoom-in",sequence:["T","I"],name:"Zoom In",description:"Zoom in time range (\xbd)",category:"time-range",scope:"dashboard",event:ix},iY={id:"time-shift-back",sequence:["T","ArrowLeft"],name:"Shift Back",description:"Shift time range backward",category:"time-range",scope:"dashboard",event:iw},iX={id:"time-shift-forward",sequence:["T","ArrowRight"],name:"Shift Forward",description:"Shift time range forward",category:"time-range",scope:"dashboard",event:ij},iZ={id:"time-make-absolute",sequence:["T","A"],name:"Make Absolute",description:"Convert time range to absolute",category:"time-range",scope:"dashboard",event:iS},iQ={id:"time-copy",sequence:["T","C"],name:"Copy Time Range",description:"Copy time range to clipboard",category:"time-range",scope:"dashboard",event:iA},i0={id:"time-paste",sequence:["T","V"],name:"Paste Time Range",description:"Paste time range from clipboard",category:"time-range",scope:"dashboard",event:iC},i1=[iK,iJ,iY,iX,iZ,iQ,i0];function i2(){var e;let t,{panels:n,panelGroups:r,panelGroupOrder:i,setDashboard:a,kind:o,metadata:s,display:l,duration:u,refreshInterval:c,datasources:d,links:p,ttl:f}=B(({panels:e,panelGroups:t,panelGroupOrder:n,setDashboard:r,kind:i,metadata:a,display:o,duration:s,refreshInterval:l,datasources:u,links:c,ttl:d})=>({panels:e,panelGroups:t,panelGroupOrder:n,setDashboard:r,kind:i,metadata:a,display:o,duration:s,refreshInterval:l,datasources:u,links:c,ttl:d})),{setVariableDefinitions:h}=nw(),g=nj(),m=(e=r,t=[],i.map(n=>{let r,i=e[n];if(void 0===i)throw Error("panel group not found");let{title:a,isCollapsed:o,repeatVariable:s,itemLayouts:l,itemPanelKeys:u}=i;(a||void 0!==o)&&(r={title:a??"",collapse:{open:!o}});let c={kind:"Grid",spec:{display:r,items:l.map(e=>{let t=u[e.i];if(void 0===t)throw Error(`Missing panel key of layout ${e.i}`);return{x:e.x,y:e.y,width:e.w,height:e.h,content:(0,T.createPanelRef)(t)}}),repeatVariable:s}};t.push(c)}),t);return{dashboard:"Dashboard"===o?{kind:o,metadata:s,spec:{display:l,panels:n,layouts:m,variables:g,duration:u,refreshInterval:c,datasources:d,links:p}}:{kind:o,metadata:s,spec:{display:l,panels:n,layouts:m,variables:g,duration:u,refreshInterval:c,datasources:d,links:p,ttl:f}},setDashboard:e=>{h(e.spec.variables),a(e)}}}function i9(e){let[t,n]=(0,h.useState)(!1),{dashboard:r,setDashboard:i}=i2(),{setEditMode:a}=q(),{timeRange:o,refreshInterval:s}=(0,P.useTimeRange)(),{getSavedVariablesStatus:l,setVariableDefaultValues:u}=nw(),{openSaveChangesConfirmationDialog:c,closeSaveChangesConfirmationDialog:d}=eD(),p=(0,h.useCallback)(async()=>{if(!e)return void a(!1);try{n(!0),await e(r),d(),a(!1)}finally{n(!1)}},[d,r,e,a]);return{saveDashboard:(0,h.useCallback)(()=>{if(t)return;let{isSavedVariableModified:e}=l(),n=(0,T.isRelativeTimeRange)(o)&&r.spec.duration!==o.pastDuration,a=r.spec.refreshInterval!==s;n||e||a?c({onSaveChanges:(e,t,n)=>{if((0,T.isRelativeTimeRange)(o)&&e&&(r.spec.duration=o.pastDuration),n){let e=u();r.spec.variables=e}t&&a&&(r.spec.refreshInterval=s),i(r),p()},onCancel:()=>{d()},isSavedDurationModified:n,isSavedVariableModified:e,isSavedRefreshIntervalModified:a}):p()},[t,l,o,r,s,c,u,i,p,d]),isSaving:t}}function i3(e){let t=e.indexOf("-");if(-1===t)return null;let n=parseInt(e.substring(0,t),10),r=e.substring(t+1);return isNaN(n)?null:{panelGroupId:n,panelGroupItemLayoutId:r}}function i4(e){let t=(0,T.isRelativeTimeRange)(e)?(0,T.toAbsoluteTimeRange)(e):e,n=t.start.getTime(),r=t.end.getTime()-n,i=Math.round(n+r/2);return{absoluteRange:t,durationMs:r,midpointMs:i}}let i5=e=>({openEditPanel:e.openEditPanel,duplicatePanel:e.duplicatePanel,openDeletePanelDialog:e.openDeletePanelDialog,setViewPanel:e.setViewPanel,panelEditor:e.panelEditor});function i7({onSave:e,onRefresh:t,isReadonly:n,onEditButtonClick:r,onCancelButtonClick:i,disabled:a=!1}){let o=e0(),{isEditMode:s,setEditMode:l}=q(),{timeRange:c,setTimeRange:d,refresh:p}=(0,P.useTimeRange)(),{infoSnackbar:f,warningSnackbar:g}=(0,u.useSnackbar)(),m=eC(),{openEditPanel:y,duplicatePanel:b,openDeletePanelDialog:v,setViewPanel:x,panelEditor:w}=B(i5),{saveDashboard:j}=i9(e),S=null!==o,A=(0,h.useCallback)(()=>{n?g("This dashboard is read-only. Keyboard save is disabled."):s?e?j():g("Save action is unavailable for this dashboard."):f("Enter edit mode to save this dashboard.")},[f,s,n,e,j,g]),C=(0,h.useCallback)(()=>{p(),f("Dashboard refreshed."),t&&t()},[p,f,t]),E=(0,h.useCallback)(()=>{s?i?i():l(!1):r?r():l(!0)},[s,l,i,r]),D=(0,h.useCallback)(()=>{let{durationMs:e,midpointMs:t}=i4(c),n=Math.round(Math.min(2*e,315576e6)/2);d({start:new Date(t-n),end:new Date(t+n)})},[c,d]),O=(0,h.useCallback)(()=>{let{durationMs:e,midpointMs:t}=i4(c),n=Math.round(Math.max(Math.round(e/2),1e3)/2);d({start:new Date(t-n),end:new Date(t+n)})},[c,d]),k=(0,h.useCallback)(()=>{let{absoluteRange:e,durationMs:t}=i4(c),n=Math.round(t/2);d({start:new Date(e.start.getTime()-n),end:new Date(e.end.getTime()-n)})},[c,d]),M=(0,h.useCallback)(()=>{let{absoluteRange:e,durationMs:t}=i4(c),n=Math.round(t/2);d({start:new Date(e.start.getTime()+n),end:new Date(e.end.getTime()+n)})},[c,d]),R=(0,h.useCallback)(()=>{(0,T.isRelativeTimeRange)(c)&&d((0,T.toAbsoluteTimeRange)(c))},[c,d]),L=(0,h.useCallback)(()=>{let e=(0,T.isRelativeTimeRange)(c)?(0,T.toAbsoluteTimeRange)(c):c,t=`${e.start.toISOString()} - ${e.end.toISOString()}`;navigator.clipboard.writeText(t).then(()=>{f("Time range copied to clipboard.")}).catch(()=>{g("Failed to copy time range to clipboard.")})},[c,f,g]),_=(0,h.useCallback)(()=>{let e='Expected format: "<ISO date format> - <ISO date format>".';navigator.clipboard.readText().then(t=>{let n=t.split(" - ");if(2!==n.length)return void g(`Clipboard does not contain a valid time range. ${e}`);let[r,i]=n,a=new Date(r.trim()),o=new Date(i.trim());isNaN(a.getTime())||isNaN(o.getTime())?g(`Clipboard does not contain a valid time range. ${e}`):a>=o?g("Invalid time range: start must be before end."):(d({start:a,end:o}),f("Time range pasted from clipboard."))}).catch(()=>{g("Unable to read from clipboard. Check browser permissions.")})},[d,f,g]),I=(0,h.useCallback)(()=>{if(void 0!==w)return void w.close();if(o&&s){let e=i3(o);e&&y(e)}},[o,s,y,w]),V=(0,h.useCallback)(()=>{if(void 0!==m)return void x(void 0);if(o){let e=i3(o);e&&x(e)}},[o,x,m]),H=(0,h.useCallback)(()=>{if(o&&s){let e=i3(o);e&&b(e)}},[o,s,b]),N=(0,h.useCallback)(()=>{if(o&&s){let e=i3(o);e&&v(e)}},[o,s,v]);iu([{def:iR,enabled:!a,callback:A},{def:iV,enabled:!a&&(S||void 0!==w),callback:I},{def:iH,enabled:!a&&(S||void 0!==m),callback:V}].map(({def:e,enabled:t,callback:n})=>({hotkey:iG(e),callback:n,options:iB(e,t)}))),ig([{def:iL,enabled:!a,callback:C},{def:i_,enabled:!a,callback:E},{def:iK,enabled:!a,callback:D},{def:iJ,enabled:!a,callback:O},{def:iY,enabled:!a,callback:k},{def:iX,enabled:!a,callback:M},{def:iZ,enabled:!a,callback:R},{def:iQ,enabled:!a,callback:L},{def:i0,enabled:!a,callback:_},{def:iN,enabled:!a&&S,callback:H},{def:iz,enabled:!a&&S,callback:N}].map(({def:e,enabled:t,callback:n})=>({sequence:iW(e),callback:n,options:iB(e,t)})))}var i8=n(8072),i6=n(19557),ae=n(97090);let at=Symbol.for("yaml.alias"),an=Symbol.for("yaml.document"),ar=Symbol.for("yaml.map"),ai=Symbol.for("yaml.pair"),aa=Symbol.for("yaml.scalar"),ao=Symbol.for("yaml.seq"),as=Symbol.for("yaml.node.type"),al=e=>!!e&&"object"==typeof e&&e[as]===at,au=e=>!!e&&"object"==typeof e&&e[as]===an,ac=e=>!!e&&"object"==typeof e&&e[as]===ar,ad=e=>!!e&&"object"==typeof e&&e[as]===ai,ap=e=>!!e&&"object"==typeof e&&e[as]===aa,af=e=>!!e&&"object"==typeof e&&e[as]===ao;function ah(e){if(e&&"object"==typeof e)switch(e[as]){case ar:case ao:return!0}return!1}function ag(e){if(e&&"object"==typeof e)switch(e[as]){case at:case ar:case aa:case ao:return!0}return!1}let am=e=>(ap(e)||ah(e))&&!!e.anchor,ay=Symbol("break visit"),ab=Symbol("skip children"),av=Symbol("remove node");function ax(e,t){let n=aA(t);au(e)?aw(null,e.contents,n,Object.freeze([e]))===av&&(e.contents=null):aw(null,e,n,Object.freeze([]))}function aw(e,t,n,r){let i=aC(e,t,n,r);if(ag(i)||ad(i))return aE(e,r,i),aw(e,i,n,r);if("symbol"!=typeof i){if(ah(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=aw(e,t.items[e],n,r);if("number"==typeof i)e=i-1;else{if(i===ay)return ay;i===av&&(t.items.splice(e,1),e-=1)}}}else if(ad(t)){r=Object.freeze(r.concat(t));let e=aw("key",t.key,n,r);if(e===ay)return ay;e===av&&(t.key=null);let i=aw("value",t.value,n,r);if(i===ay)return ay;i===av&&(t.value=null)}}return i}async function aj(e,t){let n=aA(t);au(e)?await aS(null,e.contents,n,Object.freeze([e]))===av&&(e.contents=null):await aS(null,e,n,Object.freeze([]))}async function aS(e,t,n,r){let i=await aC(e,t,n,r);if(ag(i)||ad(i))return aE(e,r,i),aS(e,i,n,r);if("symbol"!=typeof i){if(ah(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await aS(e,t.items[e],n,r);if("number"==typeof i)e=i-1;else{if(i===ay)return ay;i===av&&(t.items.splice(e,1),e-=1)}}}else if(ad(t)){r=Object.freeze(r.concat(t));let e=await aS("key",t.key,n,r);if(e===ay)return ay;e===av&&(t.key=null);let i=await aS("value",t.value,n,r);if(i===ay)return ay;i===av&&(t.value=null)}}return i}function aA(e){return"object"==typeof e&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function aC(e,t,n,r){return"function"==typeof n?n(e,t,r):ac(t)?n.Map?.(e,t,r):af(t)?n.Seq?.(e,t,r):ad(t)?n.Pair?.(e,t,r):ap(t)?n.Scalar?.(e,t,r):al(t)?n.Alias?.(e,t,r):void 0}function aE(e,t,n){let r=t[t.length-1];if(ah(r))r.items[e]=n;else if(ad(r))"key"===e?r.key=n:r.value=n;else if(au(r))r.contents=n;else{let e=al(r)?"alias":"scalar";throw Error(`Cannot replace node with ${e} parent`)}}ax.BREAK=ay,ax.SKIP=ab,ax.REMOVE=av,aj.BREAK=ay,aj.SKIP=ab,aj.REMOVE=av;let aD={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},aO=e=>e.replace(/[!,[\]{}]/g,e=>aD[e]);class ak{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},ak.defaultYaml,e),this.tags=Object.assign({},ak.defaultTags,t)}clone(){let e=new ak(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new ak(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:ak.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},ak.defaultTags)}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:ak.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},ak.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case"%TAG":{if(2!==n.length&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[e,r]=n;return this.tags[e]=r,!0}case"%YAML":{if(this.yaml.explicit=!0,1!==n.length)return t(0,"%YAML directive should contain exactly one part"),!1;let[e]=n;if("1.1"===e||"1.2"===e)return this.yaml.version=e,!0;{let n=/^\d+\.\d+$/.test(e);return t(6,`Unsupported YAML version ${e}`,n),!1}}default:return t(0,`Unknown directive ${r}`,!0),!1}}tagName(e,t){if("!"===e)return"!";if("!"!==e[0])return t(`Not a valid tag: ${e}`),null;if("<"===e[1]){let n=e.slice(2,-1);return"!"===n||"!!"===n?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(">"!==e[e.length-1]&&t("Verbatim tags must end with a >"),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return"!"===n?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+aO(e.substring(n.length));return"!"===e[0]?e:`!<${e}>`}toString(e){let t,n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags);if(e&&r.length>0&&ag(e.contents)){let n={};ax(e.contents,(e,t)=>{ag(t)&&t.tag&&(n[t.tag]=!0)}),t=Object.keys(n)}else t=[];for(let[i,a]of r)("!!"!==i||"tag:yaml.org,2002:"!==a)&&(!e||t.some(e=>e.startsWith(a)))&&n.push(`%TAG ${i} ${a}`);return n.join("\n")}}function aP(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=JSON.stringify(e);throw Error(`Anchor must not contain whitespace or control characters: ${t}`)}return!0}function aT(e){let t=new Set;return ax(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function aM(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function aR(e,t,n,r){if(r&&"object"==typeof r)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=aR(e,r,String(t),n);void 0===i?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=aR(e,r,t,n);void 0===i?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=aR(e,r,t,t);void 0===n?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=aR(e,r,t,n);void 0===i?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function aL(e,t,n){if(Array.isArray(e))return e.map((e,t)=>aL(e,String(t),n));if(e&&"function"==typeof e.toJSON){if(!n||!am(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return"bigint"!=typeof e||n?.keep?e:Number(e)}ak.defaultYaml={explicit:!1,version:"1.2"},ak.defaultTags={"!!":"tag:yaml.org,2002:"};class a_{constructor(e){Object.defineProperty(this,as,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!au(e))throw TypeError("A document argument is required");let a={anchors:new Map,doc:e,keep:!0,mapAsMap:!0===t,mapKeyWarned:!1,maxAliasCount:"number"==typeof n?n:100},o=aL(this,"",a);if("function"==typeof r)for(let{count:e,res:t}of a.anchors.values())r(t,e);return"function"==typeof i?aR(i,{"":o},"",o):o}}class aI extends a_{constructor(e){super(at),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve(e,t){let n,r;if(t?.maxAliasCount===0)throw ReferenceError("Alias resolution is disabled");for(let i of(t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],ax(e,{Node:(e,t)=>{(al(t)||am(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n)),n)){if(i===this)break;i.anchor===this.source&&(r=i)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a)throw ReferenceError(`Unresolved alias (the anchor must be set before the alias): ${this.source}`);let o=n.get(a);if(o||(aL(a,null,t),o=n.get(a)),o?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(i>=0&&(o.count+=1,0===o.aliasCount&&(o.aliasCount=function e(t,n,r){if(al(n)){let e=n.resolve(t),i=r&&e&&r.get(e);return i?i.count*i.aliasCount:0}if(ah(n)){let i=0;for(let a of n.items){let n=e(t,a,r);n>i&&(i=n)}return i}return ad(n)?Math.max(e(t,n.key,r),e(t,n.value,r)):1}(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError("Excessive alias count indicates a resource exhaustion attack");return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(aP(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source))throw Error(`Unresolved alias (the anchor must be set before the alias): ${this.source}`);if(e.implicitKey)return`${r} `}return r}}let aV=e=>!e||"function"!=typeof e&&"object"!=typeof e;class aH extends a_{constructor(e){super(aa),this.value=e}toJSON(e,t){return t?.keep?this.value:aL(this.value,e,t)}toString(){return String(this.value)}}function aN(e,t,n){let r;if(au(e)&&(e=e.contents),ag(e))return e;if(ad(e)){let t=n.schema[ar].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||"u">typeof BigInt&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:i,onAnchor:a,onTagObj:o,schema:s,sourceObjects:l}=n;if(i&&e&&"object"==typeof e){if(r=l.get(e))return r.anchor??(r.anchor=a(e)),new aI(r.anchor);r={anchor:null,node:null},l.set(e,r)}t?.startsWith("!!")&&(t="tag:yaml.org,2002:"+t.slice(2));let u=function(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}(e,t,s.tags);if(!u){if(e&&"function"==typeof e.toJSON&&(e=e.toJSON()),!e||"object"!=typeof e){let t=new aH(e);return r&&(r.node=t),t}u=e instanceof Map?s[ar]:Symbol.iterator in Object(e)?s[ao]:s[ar]}o&&(o(u),delete n.onTagObj);let c=u?.createNode?u.createNode(n.schema,e,n):"function"==typeof u?.nodeClass?.from?u.nodeClass.from(n.schema,e,n):new aH(e);return t?c.tag=t:u.default||(c.tag=u.tag),r&&(r.node=c),c}function az(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if("number"==typeof n&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return aN(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}aH.BLOCK_FOLDED="BLOCK_FOLDED",aH.BLOCK_LITERAL="BLOCK_LITERAL",aH.PLAIN="PLAIN",aH.QUOTE_DOUBLE="QUOTE_DOUBLE",aH.QUOTE_SINGLE="QUOTE_SINGLE";let a$=e=>null==e||"object"==typeof e&&!!e[Symbol.iterator]().next().done;class aB extends a_{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>ag(t)||ad(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(a$(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(ah(i))i.addIn(r,t);else if(void 0===i&&this.schema)this.set(n,az(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(0===n.length)return this.delete(t);let r=this.get(t,!0);if(ah(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return 0===r.length?!t&&ap(i)?i.value:i:ah(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!ad(t))return!1;let n=t.value;return null==n||e&&ap(n)&&null==n.value&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(0===n.length)return this.has(t);let r=this.get(t,!0);return!!ah(r)&&r.hasIn(n)}setIn(e,t){let[n,...r]=e;if(0===r.length)this.set(n,t);else{let e=this.get(n,!0);if(ah(e))e.setIn(r,t);else if(void 0===e&&this.schema)this.set(n,az(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}}let aG=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function aW(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}let aF=(e,t,n)=>e.endsWith("\n")?aW(n,t):n.includes("\n")?"\n"+aW(n,t):(e.endsWith(" ")?"":" ")+n,aq="block",aU="quoted";function aK(e,t,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){let l,u,c;if(!i||i<0)return e;i<a&&(a=0);let d=Math.max(1+a,1+i-t.length);if(e.length<=d)return e;let p=[],f={},h=i-t.length;"number"==typeof r&&(r>i-Math.max(2,a)?p.push(0):h=i-r);let g=!1,m=-1,y=-1,b=-1;for(n===aq&&-1!==(m=aJ(e,m,t.length))&&(h=m+d);c=e[m+=1];){if(n===aU&&"\\"===c){switch(y=m,e[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}b=m}if("\n"===c)n===aq&&(m=aJ(e,m,t.length)),h=m+t.length+d,l=void 0;else{if(" "===c&&u&&" "!==u&&"\n"!==u&&" "!==u){let t=e[m+1];t&&" "!==t&&"\n"!==t&&" "!==t&&(l=m)}if(m>=h)if(l)p.push(l),h=l+d,l=void 0;else if(n===aU){for(;" "===u||" "===u;)u=c,c=e[m+=1],g=!0;let t=m>b+1?m-2:y-1;if(f[t])return e;p.push(t),f[t]=!0,h=t+d,l=void 0}else g=!0}u=c}if(g&&s&&s(),0===p.length)return e;o&&o();let v=e.slice(0,p[0]);for(let r=0;r<p.length;++r){let i=p[r],a=p[r+1]||e.length;0===i?v=`
7
+ ${t}${e.slice(0,a)}`:(n===aU&&f[i]&&(v+=`${e[i]}\\`),v+=`
8
+ ${t}${e.slice(i+1,a)}`)}return v}function aJ(e,t,n){let r=t,i=t+1,a=e[i];for(;" "===a||" "===a;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&"\n"!==a);r=t,a=e[i=t+1]}return r}let aY=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth});function aX(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(/^(%|---|\.\.\.)/m.test(e)?" ":""),o="",s=0;for(let e=0,t=n[e];t;t=n[++e])if(" "===t&&"\\"===n[e+1]&&"n"===n[e+2]&&(o+=n.slice(s,e)+"\\ ",e+=1,s=e,t="\\"),"\\"===t)switch(n[e+1]){case"u":{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:"00"===t.substr(0,2)?o+="\\x"+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case"n":if(r||'"'===n[e+2]||n.length<i)e+=1;else{for(o+=n.slice(s,e)+"\n\n";"\\"===n[e+2]&&"n"===n[e+3]&&'"'!==n[e+4];)o+="\n",e+=2;o+=a," "===n[e+2]&&(o+="\\"),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:aK(o,a,"quoted",aY(t,!1))}function aZ(e,t){if(!1===t.options.singleQuote||t.implicitKey&&e.includes("\n")||/[ \t]\n|\n[ \t]/.test(e))return aX(e,t);let n=t.indent||(/^(%|---|\.\.\.)/m.test(e)?" ":""),r="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
9
+ ${n}`)+"'";return t.implicitKey?r:aK(r,n,"flow",aY(t,!1))}function aQ(e,t){let n,{singleQuote:r}=t.options;if(!1===r)n=aX;else{let t=e.includes('"'),i=e.includes("'");n=t&&!i?aZ:i&&!t?aX:r?aZ:aX}return n(e,t)}try{i=RegExp("(^|(?<!\n))\n+(?!\n|$)","g")}catch{i=/\n+(?!\n|$)/g}function a0({comment:e,type:t,value:n},r,a,o){let s,l,u,c,{blockQuote:d,commentString:p,lineWidth:f}=r.options;if(!d||/\n[\t ]+$/.test(n))return aQ(n,r);let h=r.indent||(r.forceBlockIndent||(c=n,/^(%|---|\.\.\.)/m.test(c))?" ":""),g="literal"===d||"folded"!==d&&t!==aH.BLOCK_FOLDED&&(t===aH.BLOCK_LITERAL||!function(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if("\n"===e[t]){if(t-n>r)return!0;if(i-(n=t+1)<=r)return!1}return!0}(n,f,h.length));if(!n)return g?"|\n":">\n";for(l=n.length;l>0;--l){let e=n[l-1];if("\n"!==e&&" "!==e&&" "!==e)break}let m=n.substring(l),y=m.indexOf("\n");-1===y?s="-":n===m||y!==m.length-1?(s="+",o&&o()):s="",m&&(n=n.slice(0,-m.length),"\n"===m[m.length-1]&&(m=m.slice(0,-1)),m=m.replace(i,`$&${h}`));let b=!1,v=-1;for(u=0;u<n.length;++u){let e=n[u];if(" "===e)b=!0;else if("\n"===e)v=u;else break}let x=n.substring(0,v<u?v+1:u);x&&(n=n.substring(x.length),x=x.replace(/\n+/g,`$&${h}`));let w=h?"2":"1",j=(b?w:"")+s;if(e&&(j+=" "+p(e.replace(/ ?[\r\n]+/g," ")),a&&a()),!g){let e=n.replace(/\n+/g,"\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${h}`),i=!1,a=aY(r,!0);"folded"!==d&&t!==aH.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let o=aK(`${x}${e}${m}`,h,"block",a);if(!i)return`>${j}
10
+ ${h}${o}`}return n=n.replace(/\n+/g,`$&${h}`),`|${j}
11
+ ${h}${x}${n}${m}`}function a1(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o="string"==typeof e.value?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==aH.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=aH.QUOTE_DOUBLE);let l=e=>{switch(e){case aH.BLOCK_FOLDED:case aH.BLOCK_LITERAL:return i||a?aQ(o.value,t):a0(o,t,n,r);case aH.QUOTE_DOUBLE:return aX(o.value,t);case aH.QUOTE_SINGLE:return aZ(o.value,t);case aH.PLAIN:return function(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:l,indentStep:u,inFlow:c}=t;if(s&&a.includes("\n")||c&&/[[\]{},]/.test(a))return aQ(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||c||!a.includes("\n")?aQ(a,t):a0(e,t,n,r);if(!s&&!c&&i!==aH.PLAIN&&a.includes("\n"))return a0(e,t,n,r);if(/^(%|---|\.\.\.)/m.test(a)){if(""===l)return t.forceBlockIndent=!0,a0(e,t,n,r);else if(s&&l===u)return aQ(a,t)}let d=a.replace(/\n+/g,`$&
12
+ ${l}`);if(o){let e=e=>e.default&&"tag:yaml.org,2002:str"!==e.tag&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return aQ(a,t)}return s?d:aK(d,l,"flow",aY(t,!1))}(o,t,n,r);default:return null}},u=l(s);if(null===u){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(null===(u=l(r)))throw Error(`Unsupported default string type ${r}`)}return u}function a2(e,t){let n,r=Object.assign({blockQuote:!0,commentString:aG,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:e,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:"number"==typeof r.indent?" ".repeat(r.indent):" ",inFlow:n,options:r}}function a9(e,t,n,r){let i;if(ad(e))return e.toString(t,n,r);if(al(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let a=ag(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??(i=function(e,t){let n,r;if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}if(ap(t)){n=t.value;let i=e.filter(e=>e.identify?.(n));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}r=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else n=t,r=e.find(e=>e.nodeClass&&n instanceof e.nodeClass);if(!r){let e=n?.constructor?.name??(null===n?"null":typeof n);throw Error(`Tag not resolved for ${e} value`)}return r}(t.doc.schema.tags,a));let o=function(e,t,{anchors:n,doc:r}){if(!r.directives)return"";let i=[],a=(ap(e)||ah(e))&&e.anchor;a&&aP(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(" ")}(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s="function"==typeof i.stringify?i.stringify(a,t,n,r):ap(a)?a1(a,t,n,r):a.toString(t,n,r);return o?ap(a)||"{"===s[0]||"["===s[0]?`${o} ${s}`:`${o}
13
+ ${t.indent}${s}`:s}let a3={identify:e=>"<<"===e||"symbol"==typeof e&&"<<"===e.description,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new aH(Symbol("<<")),{addToJSMap:a4}),stringify:()=>"<<"};function a4(e,t,n){let r=a7(e,n);if(af(r))for(let n of r.items)a5(e,t,n);else if(Array.isArray(r))for(let n of r)a5(e,t,n);else a5(e,t,r)}function a5(e,t,n){let r=a7(e,n);if(!ac(r))throw Error("Merge sources must be maps or map aliases");for(let[n,i]of r.toJSON(null,e,Map))t instanceof Map?t.has(n)||t.set(n,i):t instanceof Set?t.add(n):Object.prototype.hasOwnProperty.call(t,n)||Object.defineProperty(t,n,{value:i,writable:!0,enumerable:!0,configurable:!0});return t}function a7(e,t){return e&&al(t)?t.resolve(e.doc,e):t}function a8(e,t,{key:n,value:r}){if(ag(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if((a3.identify(n)||ap(n)&&(!n.type||n.type===aH.PLAIN)&&a3.identify(n.value))&&e?.doc.schema.tags.some(e=>e.tag===a3.tag&&e.default))a4(e,t,r);else{let i=aL(n,"",e);if(t instanceof Map)t.set(i,aL(r,i,e));else if(t instanceof Set)t.add(i);else{let a=function(e,t,n){if(null===t)return"";if("object"!=typeof t)return String(t);if(ag(e)&&n?.doc){let t=a2(n.doc,{});for(let e of(t.anchors=new Set,n.anchors.keys()))t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let a=e.toString(t);if(!n.mapKeyWarned){var r,i;let e=JSON.stringify(a);e.length>40&&(e=e.substring(0,36)+'..."'),r=n.doc.options.logLevel,i=`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`,("debug"===r||"warn"===r)&&console.warn(i),n.mapKeyWarned=!0}return a}return JSON.stringify(t)}(n,i,e),o=aL(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function a6(e,t,n){return new oe(aN(e,void 0,n),aN(t,void 0,n))}class oe{constructor(e,t=null){Object.defineProperty(this,as,{value:ai}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return ag(t)&&(t=t.clone(e)),ag(n)&&(n=n.clone(e)),new oe(t,n)}toJSON(e,t){let n=t?.mapAsMap?new Map:{};return a8(t,n,this)}toString(e,t,n){return e?.doc?function({key:e,value:t},n,r,i){let a,o,s,{allNullValues:l,doc:u,indent:c,indentStep:d,options:{commentString:p,indentSeq:f,simpleKeys:h}}=n,g=ag(e)&&e.comment||null;if(h){if(g)throw Error("With simple keys, key nodes cannot have comments");if(ah(e)||!ag(e)&&"object"==typeof e)throw Error("With simple keys, collection cannot be used as a key value")}let m=!h&&(!e||g&&null==t&&!n.inFlow||ah(e)||(ap(e)?e.type===aH.BLOCK_FOLDED||e.type===aH.BLOCK_LITERAL:"object"==typeof e));n=Object.assign({},n,{allNullValues:!1,implicitKey:!m&&(h||!l),indent:c+d});let y=!1,b=!1,v=a9(e,n,()=>y=!0,()=>b=!0);if(!m&&!n.inFlow&&v.length>1024){if(h)throw Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(n.inFlow){if(l||null==t)return y&&r&&r(),""===v?"?":m?`? ${v}`:v}else if(l&&!h||null==t&&m)return v=`? ${v}`,g&&!y?v+=aF(v,n.indent,p(g)):b&&i&&i(),v;y&&(g=null),m?(g&&(v+=aF(v,n.indent,p(g))),v=`? ${v}
14
+ ${c}:`):(v=`${v}:`,g&&(v+=aF(v,n.indent,p(g)))),ag(t)?(a=!!t.spaceBefore,o=t.commentBefore,s=t.comment):(a=!1,o=null,s=null,t&&"object"==typeof t&&(t=u.createNode(t))),n.implicitKey=!1,!m&&!g&&ap(t)&&(n.indentAtStart=v.length+1),b=!1,!(!f&&d.length>=2&&!n.inFlow&&!m&&af(t))||t.flow||t.tag||t.anchor||(n.indent=n.indent.substring(2));let x=!1,w=a9(t,n,()=>x=!0,()=>b=!0),j=" ";if(g||a||o){if(j=a?"\n":"",o){let e=p(o);j+=`
15
+ ${aW(e,n.indent)}`}""!==w||n.inFlow?j+=`
16
+ ${n.indent}`:"\n"===j&&s&&(j="\n\n")}else if(!m&&ah(t)){let e=w[0],r=w.indexOf("\n"),i=-1!==r,a=n.inFlow??t.flow??0===t.items.length;if(i||!a){let t=!1;if(i&&("&"===e||"!"===e)){let n=w.indexOf(" ");"&"===e&&-1!==n&&n<r&&"!"===w[n+1]&&(n=w.indexOf(" ",n+1)),(-1===n||r<n)&&(t=!0)}t||(j=`
17
+ ${n.indent}`)}}else(""===w||"\n"===w[0])&&(j="");return v+=j+w,n.inFlow?x&&r&&r():s&&!x?v+=aF(v,n.indent,p(s)):b&&i&&i(),v}(this,e,t,n):JSON.stringify(this)}}function ot(e,t,n){return(t.inFlow??e.flow?function({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t,l=Object.assign({},t,{indent:r+=a,inFlow:!0,type:null}),u=!1,c=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(ag(i))i.spaceBefore&&d.push(""),on(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(ad(i)){let e=ag(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(""),on(t,d,e.commentBefore,!1),e.comment&&(u=!0));let n=ag(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(u=!0)):null==i.value&&e?.comment&&(a=e.comment)}a&&(u=!0);let o=a9(i,l,()=>a=null);u||(u=d.length>c||o.includes("\n")),n<e.length-1?o+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(u||(u=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth)),u&&(o+=",")),a&&(o+=aF(o,r,s(a))),d.push(o),c=d.length}let{start:p,end:f}=n;if(0===d.length)return p+f;if(!u){let e=d.reduce((e,t)=>e+t.length+2,2);u=t.options.lineWidth>0&&e>t.options.lineWidth}if(!u)return`${p}${o}${d.join(" ")}${o}${f}`;{let e=p;for(let t of d)e+=t?`
18
+ ${a}${i}${t}`:"\n";return`${e}
19
+ ${i}${f}`}}:function({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let l,{indent:u,options:{commentString:c}}=n,d=Object.assign({},n,{indent:a,type:null}),p=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(ag(i))!p&&i.spaceBefore&&f.push(""),on(n,f,i.commentBefore,p),i.comment&&(o=i.comment);else if(ad(i)){let e=ag(i.key)?i.key:null;e&&(!p&&e.spaceBefore&&f.push(""),on(n,f,e.commentBefore,p))}p=!1;let s=a9(i,d,()=>o=null,()=>p=!0);o&&(s+=aF(s,a,c(o))),p&&o&&(p=!1),f.push(r+s)}if(0===f.length)l=i.start+i.end;else{l=f[0];for(let e=1;e<f.length;++e){let t=f[e];l+=t?`
20
+ ${u}${t}`:"\n"}}return e?(l+="\n"+aW(c(e),u),s&&s()):p&&o&&o(),l})(e,t,n)}function on({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let i=aW(t(r),e);n.push(i.trimStart())}}function or(e,t){let n=ap(t)?t.value:t;for(let r of e)if(ad(r)&&(r.key===t||r.key===n||ap(r.key)&&r.key.value===n))return r}class oi extends aB{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(ar,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if("function"==typeof i)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(void 0!==o||r)&&a.items.push(a6(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&"object"==typeof t)for(let e of Object.keys(t))o(e,t[e]);return"function"==typeof e.sortMapEntries&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=ad(e)?e:e&&"object"==typeof e&&"key"in e?new oe(e.key,e.value):new oe(e,e?.value);let r=or(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);ap(r.value)&&aV(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>0>i(n,e));-1===e?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=or(this.items,e);return!!t&&this.items.splice(this.items.indexOf(t),1).length>0}get(e,t){let n=or(this.items,e),r=n?.value;return(!t&&ap(r)?r.value:r)??void 0}has(e){return!!or(this.items,e)}set(e,t){this.add(new oe(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};for(let e of(t?.onCreate&&t.onCreate(r),this.items))a8(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!ad(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),ot(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}}let oa={collection:"map",default:!0,nodeClass:oi,tag:"tag:yaml.org,2002:map",resolve:(e,t)=>(ac(e)||t("Expected a mapping for this tag"),e),createNode:(e,t,n)=>oi.from(e,t,n)};class oo extends aB{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(ao,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=os(e);return"number"==typeof t&&this.items.splice(t,1).length>0}get(e,t){let n=os(e);if("number"!=typeof n)return;let r=this.items[n];return!t&&ap(r)?r.value:r}has(e){let t=os(e);return"number"==typeof t&&t<this.items.length}set(e,t){let n=os(e);if("number"!=typeof n)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];ap(r)&&aV(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(aL(e,String(r++),t));return n}toString(e,t,n){return e?ot(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if("function"==typeof r){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(aN(a,void 0,n))}}return i}}function os(e){let t=ap(e)?e.value:e;return t&&"string"==typeof t&&(t=Number(t)),"number"==typeof t&&Number.isInteger(t)&&t>=0?t:null}let ol={collection:"seq",default:!0,nodeClass:oo,tag:"tag:yaml.org,2002:seq",resolve:(e,t)=>(af(e)||t("Expected a sequence for this tag"),e),createNode:(e,t,n)=>oo.from(e,t,n)},ou={identify:e=>"string"==typeof e,default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:(e,t,n,r)=>a1(e,t=Object.assign({actualString:!0},t),n,r)},oc={identify:e=>null==e,createNode:()=>new aH(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new aH(null),stringify:({source:e},t)=>"string"==typeof e&&oc.test.test(e)?e:t.options.nullStr},od={identify:e=>"boolean"==typeof e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new aH("t"===e[0]||"T"===e[0]),stringify:({source:e,value:t},n)=>e&&od.test.test(e)&&t===("t"===e[0]||"T"===e[0])?e:t?n.options.trueStr:n.options.falseStr};function op({format:e,minFractionDigits:t,tag:n,value:r}){if("bigint"==typeof r)return String(r);let i="number"==typeof r?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let a=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||"tag:yaml.org,2002:float"===n)&&/^-?\d/.test(a)&&!a.includes("e")){let e=a.indexOf(".");e<0&&(e=a.length,a+=".");let n=t-(a.length-e-1);for(;n-- >0;)a+="0"}return a}let of={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>"nan"===e.slice(-3).toLowerCase()?NaN:"-"===e[0]?-1/0:1/0,stringify:op},oh={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():op(e)}},og={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new aH(parseFloat(e)),n=e.indexOf(".");return -1!==n&&"0"===e[e.length-1]&&(t.minFractionDigits=e.length-n-1),t},stringify:op},om=e=>"bigint"==typeof e||Number.isInteger(e),oy=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function ob(e,t,n){let{value:r}=e;return om(r)&&r>=0?n+r.toString(t):op(e)}let ov={identify:e=>om(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>oy(e,2,8,n),stringify:e=>ob(e,8,"0o")},ox={identify:om,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>oy(e,0,10,n),stringify:op},ow={identify:e=>om(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>oy(e,2,16,n),stringify:e=>ob(e,16,"0x")},oj=[oa,ol,ou,oc,od,ov,ox,ow,of,oh,og];function oS(e){return"bigint"==typeof e||Number.isInteger(e)}let oA=({value:e})=>JSON.stringify(e),oC=[oa,ol].concat([{identify:e=>"string"==typeof e,default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:oA},{identify:e=>null==e,createNode:()=>new aH(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:oA},{identify:e=>"boolean"==typeof e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>"true"===e,stringify:oA},{identify:oS,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>oS(e)?e.toString():JSON.stringify(e)},{identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:oA}],{default:!0,tag:"",test:/^/,resolve:(e,t)=>(t(`Unresolved plain scalar ${JSON.stringify(e)}`),e)}),oE={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if("function"!=typeof atob)return t("This environment does not support reading binary tags; either Buffer or atob is required"),e;{let t=atob(e.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}},stringify({comment:e,type:t,value:n},r,i,a){let o;if(!n)return"";if("function"==typeof btoa){let e="";for(let t=0;t<n.length;++t)e+=String.fromCharCode(n[t]);o=btoa(e)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=aH.BLOCK_LITERAL),t!==aH.QUOTE_DOUBLE){let e=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),n=Math.ceil(o.length/e),i=Array(n);for(let t=0,r=0;t<n;++t,r+=e)i[t]=o.substr(r,e);o=i.join(t===aH.BLOCK_LITERAL?"\n":" ")}return a1({comment:e,type:t,value:o},r,i,a)}};function oD(e,t){if(af(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!ad(r)){if(ac(r)){r.items.length>1&&t("Each pair must have its own sequence indicator");let e=r.items[0]||new oe(new aH(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}
21
+ ${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}
22
+ ${t.comment}`:r.comment}r=e}e.items[n]=ad(r)?r:new oe(r)}}else t("Expected a sequence for this tag");return e}function oO(e,t,n){let{replacer:r}=n,i=new oo(e);i.tag="tag:yaml.org,2002:pairs";let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){let o,s;if("function"==typeof r&&(e=r.call(t,String(a++),e)),Array.isArray(e))if(2===e.length)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`);else if(e&&e instanceof Object){let t=Object.keys(e);if(1===t.length)s=e[o=t[0]];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(a6(o,s,n))}return i}let ok={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:oD,createNode:oO};class oP extends oo{constructor(){super(),this.add=oi.prototype.add.bind(this),this.delete=oi.prototype.delete.bind(this),this.get=oi.prototype.get.bind(this),this.has=oi.prototype.has.bind(this),this.set=oi.prototype.set.bind(this),this.tag=oP.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;for(let e of(t?.onCreate&&t.onCreate(n),this.items)){let r,i;if(ad(e)?(r=aL(e.key,"",t),i=aL(e.value,r,t)):r=aL(e,"",t),n.has(r))throw Error("Ordered maps must not include duplicate keys");n.set(r,i)}return n}static from(e,t,n){let r=oO(e,t,n),i=new this;return i.items=r.items,i}}oP.tag="tag:yaml.org,2002:omap";let oT={collection:"seq",identify:e=>e instanceof Map,nodeClass:oP,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=oD(e,t),r=[];for(let{key:e}of n.items)ap(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new oP,n)},createNode:(e,t,n)=>oP.from(e,t,n)};function oM({value:e,source:t},n){return t&&(e?oR:oL).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}let oR={identify:e=>!0===e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new aH(!0),stringify:oM},oL={identify:e=>!1===e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new aH(!1),stringify:oM},o_=e=>"bigint"==typeof e||Number.isInteger(e);function oI(e,t,n,{intAsBigInt:r}){let i=e[0];if(("-"===i||"+"===i)&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return"-"===i?BigInt(-1)*t:t}let a=parseInt(e,n);return"-"===i?-1*a:a}function oV(e,t,n){let{value:r}=e;if(o_(r)){let e=r.toString(t);return r<0?"-"+n+e.substr(1):n+e}return op(e)}class oH extends oi{constructor(e){super(e),this.tag=oH.tag}add(e){let t;t=ad(e)?e:e&&"object"==typeof e&&"key"in e&&"value"in e&&null===e.value?new oe(e.key,null):new oe(e,null),or(this.items,t.key)||this.items.push(t)}get(e,t){let n=or(this.items,e);return!t&&ad(n)?ap(n.key)?n.key.value:n.key:n}set(e,t){if("boolean"!=typeof t)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=or(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new oe(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error("Set items must all have null values")}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)"function"==typeof r&&(e=r.call(t,e,e)),i.items.push(a6(e,null,n));return i}}oH.tag="tag:yaml.org,2002:set";let oN={collection:"map",identify:e=>e instanceof Set,nodeClass:oH,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>oH.from(e,t,n),resolve(e,t){if(ac(e))if(e.hasAllNullValues(!0))return Object.assign(new oH,e);else t("Set items must all have null values");else t("Expected a mapping for this tag");return e}};function oz(e,t){let n=e[0],r="-"===n||"+"===n?e.substring(1):e,i=e=>t?BigInt(e):Number(e),a=r.replace(/_/g,"").split(":").reduce((e,t)=>e*i(60)+i(t),i(0));return"-"===n?i(-1)*a:a}function o$(e){let{value:t}=e,n=e=>e;if("bigint"==typeof t)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return op(e);let r="";t<0&&(r="-",t*=n(-1));let i=n(60),a=[t%i];return t<60?a.unshift(0):(t=(t-a[0])/i,a.unshift(t%i),t>=60&&(t=(t-a[0])/i,a.unshift(t))),r+a.map(e=>String(e).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}let oB={identify:e=>"bigint"==typeof e||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>oz(e,n),stringify:o$},oG={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>oz(e,!1),stringify:o$},oW={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(oW.test);if(!t)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,a,o,s]=t.map(Number),l=Date.UTC(n,r-1,i,a||0,o||0,s||0,t[7]?Number((t[7]+"00").substr(1,3)):0),u=t[8];if(u&&"Z"!==u){let e=oz(u,!1);30>Math.abs(e)&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""},oF=[oa,ol,ou,oc,oR,oL,{identify:o_,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>oI(e,2,2,n),stringify:e=>oV(e,2,"0b")},{identify:o_,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>oI(e,1,8,n),stringify:e=>oV(e,8,"0")},{identify:o_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>oI(e,0,10,n),stringify:op},{identify:o_,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>oI(e,2,16,n),stringify:e=>oV(e,16,"0x")},{identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>"nan"===e.slice(-3).toLowerCase()?NaN:"-"===e[0]?-1/0:1/0,stringify:op},{identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():op(e)}},{identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new aH(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(-1!==n){let r=e.substring(n+1).replace(/_/g,"");"0"===r[r.length-1]&&(t.minFractionDigits=r.length)}return t},stringify:op},oE,a3,oT,ok,oN,oB,oG,oW],oq=new Map([["core",oj],["failsafe",[oa,ol,ou]],["json",oC],["yaml11",oF],["yaml-1.1",oF]]),oU={binary:oE,bool:od,float:og,floatExp:oh,floatNaN:of,floatTime:oG,int:ox,intHex:ow,intOct:ov,intTime:oB,map:oa,merge:a3,null:oc,omap:oT,pairs:ok,seq:ol,set:oN,timestamp:oW},oK={"tag:yaml.org,2002:binary":oE,"tag:yaml.org,2002:merge":a3,"tag:yaml.org,2002:omap":oT,"tag:yaml.org,2002:pairs":ok,"tag:yaml.org,2002:set":oN,"tag:yaml.org,2002:timestamp":oW};function oJ(e,t,n){let r=oq.get(t);if(r&&!e)return n&&!r.includes(a3)?r.concat(a3):r.slice();let i=r;if(!i)if(Array.isArray(e))i=[];else{let e=Array.from(oq.keys()).filter(e=>"yaml11"!==e).map(e=>JSON.stringify(e)).join(", ");throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}if(Array.isArray(e))for(let t of e)i=i.concat(t);else"function"==typeof e&&(i=e(i.slice()));return n&&(i=i.concat(a3)),i.reduce((e,t)=>{let n="string"==typeof t?oU[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(oU).map(e=>JSON.stringify(e)).join(", ");throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}let oY=(e,t)=>e.key<t.key?-1:+(e.key>t.key);class oX{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?oJ(e,"compat"):e?oJ(null,e):null,this.name="string"==typeof i&&i||"core",this.knownTags=r?oK:{},this.tags=oJ(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,ar,{value:oa}),Object.defineProperty(this,aa,{value:ou}),Object.defineProperty(this,ao,{value:ol}),this.sortMapEntries="function"==typeof a?a:!0===a?oY:null}clone(){let e=Object.create(oX.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}class oZ{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,as,{value:an});let r=null;"function"==typeof t||Array.isArray(t)?r=t:void 0===n&&t&&(n=t,t=void 0);const i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new ak({version:a}),this.setSchema(a,n),this.contents=void 0===e?null:this.createNode(e,r,n)}clone(){let e=Object.create(oZ.prototype,{[as]:{value:an}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=ag(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){oQ(this.contents)&&this.contents.add(e)}addIn(e,t){oQ(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=aT(this);e.anchor=!t||n.has(t)?aM(t||"a",n):t}return new aI(e.anchor)}createNode(e,t,n){var r,i;let a,o,s,l;if("function"==typeof t)e=t.call({"":e},"",e),a=t;else if(Array.isArray(t)){let e=t.filter(e=>"number"==typeof e||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),a=t}else void 0===n&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:u,anchorPrefix:c,flow:d,keepUndefined:p,onTagObj:f,tag:h}=n??{},{onAnchor:g,setAnchors:m,sourceObjects:y}=(r=this,i=c||"a",o=[],s=new Map,l=null,{onAnchor:e=>{o.push(e),l??(l=aT(r));let t=aM(i,l);return l.add(t),t},setAnchors:()=>{for(let e of o){let t=s.get(e);if("object"==typeof t&&t.anchor&&(ap(t.node)||ah(t.node)))t.node.anchor=t.anchor;else{let t=Error("Failed to resolve repeated object (this should not happen)");throw t.source=e,t}}},sourceObjects:s}),b={aliasDuplicateObjects:u??!0,keepUndefined:p??!1,onAnchor:g,onTagObj:f,replacer:a,schema:this.schema,sourceObjects:y},v=aN(e,h,b);return d&&ah(v)&&(v.flow=!0),m(),v}createPair(e,t,n={}){return new oe(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return!!oQ(this.contents)&&this.contents.delete(e)}deleteIn(e){return a$(e)?null!=this.contents&&(this.contents=null,!0):!!oQ(this.contents)&&this.contents.deleteIn(e)}get(e,t){return ah(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return a$(e)?!t&&ap(this.contents)?this.contents.value:this.contents:ah(this.contents)?this.contents.getIn(e,t):void 0}has(e){return!!ah(this.contents)&&this.contents.has(e)}hasIn(e){return a$(e)?void 0!==this.contents:!!ah(this.contents)&&this.contents.hasIn(e)}set(e,t){null==this.contents?this.contents=az(this.schema,[e],t):oQ(this.contents)&&this.contents.set(e,t)}setIn(e,t){a$(e)?this.contents=t:null==this.contents?this.contents=az(this.schema,Array.from(e),t):oQ(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){let n;switch("number"==typeof e&&(e=String(e)),e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ak({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new ak({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new oX(Object.assign(n,t));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:!0===n,mapKeyWarned:!1,maxAliasCount:"number"==typeof r?r:100},s=aL(this.contents,t??"",o);if("function"==typeof i)for(let{count:e,res:t}of o.anchors.values())i(t,e);return"function"==typeof a?aR(a,{"":s},"",s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||0>=Number(e.indent))){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return function(e,t){let n=[],r=!0===t.directives;if(!1!==t.directives&&e.directives){let t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");let i=a2(e,t),{commentString:a}=i.options;if(e.commentBefore){1!==n.length&&n.unshift("");let t=a(e.commentBefore);n.unshift(aW(t,""))}let o=!1,s=null;if(e.contents){if(ag(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(aW(t,""))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,l=a9(e.contents,i,()=>s=null,t);s&&(l+=aF(l,"",a(s))),("|"===l[0]||">"===l[0])&&"---"===n[n.length-1]?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(a9(e.contents,i));if(e.directives?.docEnd)if(e.comment){let t=a(e.comment);t.includes("\n")?(n.push("..."),n.push(aW(t,""))):n.push(`... ${t}`)}else n.push("...");else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,"")),t&&((!o||s)&&""!==n[n.length-1]&&n.push(""),n.push(aW(a(t),"")))}return n.join("\n")+"\n"}(this,e)}}function oQ(e){if(ah(e))return!0;throw Error("Expected a YAML collection as document contents")}let o0=Symbol("break visit"),o1=Symbol("skip children"),o2=Symbol("remove item");function o9(e,t){"type"in e&&"document"===e.type&&(e={start:e.start,value:e.value}),function e(t,n,r){let i=r(n,t);if("symbol"==typeof i)return i;for(let a of["key","value"]){let o=n[a];if(o&&"items"in o){for(let n=0;n<o.items.length;++n){let i=e(Object.freeze(t.concat([[a,n]])),o.items[n],r);if("number"==typeof i)n=i-1;else{if(i===o0)return o0;i===o2&&(o.items.splice(n,1),n-=1)}}"function"==typeof i&&"key"===a&&(i=i(n,t))}}return"function"==typeof i?i(n,t):i}(Object.freeze([]),e,t)}function o3(e,t,n){let r=null;if("function"==typeof t||Array.isArray(t)?r=t:void 0===n&&t&&(n=t),"string"==typeof n&&(n=n.length),"number"==typeof n){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(void 0===e){let{keepUndefined:e}=n??t??{};if(!e)return}return au(e)&&!r?e.toString(n):new oZ(e,r,n).toString(n)}function o4(){let{dashboard:e}=i2(),t=(0,h.useRef)(null),[n,r]=g().useState(null),i=!!n,a=(n,i)=>()=>{r(null);let{contentType:a,content:o}=function(e,t,n){switch(t){case"json":return{contentType:"application/json",content:JSON.stringify(e,null,2)};case"yaml":let r;if("cr-v1alpha1"===n){let t=e.metadata.name.toLowerCase().replace(/[^a-z0-9-]/g,"-");r=o3({apiVersion:"perses.dev/v1alpha1",kind:"PersesDashboard",metadata:{labels:{"app.kubernetes.io/name":"perses-dashboard","app.kubernetes.io/instance":t,"app.kubernetes.io/part-of":"perses-operator"},name:t,namespace:e.metadata.project},spec:e.spec},{schema:"yaml-1.1"})}else if("cr-v1alpha2"===n){let t=e.metadata.name.toLowerCase().replace(/[^a-z0-9-]/g,"-");r=o3({apiVersion:"perses.dev/v1alpha2",kind:"PersesDashboard",metadata:{labels:{"app.kubernetes.io/name":"perses-dashboard","app.kubernetes.io/instance":t,"app.kubernetes.io/part-of":"perses-operator"},name:t,namespace:e.metadata.project},spec:{config:e.spec}},{schema:"yaml-1.1"})}else r=o3(e,{schema:"yaml-1.1"});return{contentType:"application/yaml",content:r}}}(e,n,i);if(!t||!t.current)return;let s=URL.createObjectURL(new Blob([o],{type:a}));t.current.download=`${e.metadata.name}${i?`-${i}`:""}.${n}`,t.current.href=s,t.current.click(),URL.revokeObjectURL(s)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(u.ToolbarIconButton,{id:"download-dashboard-button","aria-controls":i?"basic-menu":void 0,"aria-haspopup":"true","aria-expanded":i?"true":void 0,onClick:e=>{r(e.currentTarget)},children:(0,o.jsx)(ae.default,{})}),(0,o.jsx)(t$.A,{id:"download-dashboard-formats",anchorEl:n,open:i,hideBackdrop:!0,onClose:()=>r(null),MenuListProps:{"aria-labelledby":"download-dashboard-button"},children:(0,o.jsx)("div",{children:(0,o.jsx)(tE,{onClickAway:()=>r(null),children:(0,o.jsxs)(i6.A,{children:[(0,o.jsx)(tG.A,{onClick:a("json"),children:"JSON"}),(0,o.jsx)(tG.A,{onClick:a("yaml"),children:"YAML"}),(0,o.jsx)(tG.A,{onClick:a("yaml","cr-v1alpha2"),children:"YAML (CR v1alpha2)"}),(0,o.jsx)(tG.A,{onClick:a("yaml","cr-v1alpha1"),children:"YAML (CR v1alpha1)"})]})})})}),(0,o.jsx)("a",{ref:t,style:{display:"none"}})]})}function o5(e){let[t,n]=n2(e.datasources),[r,i]=(0,h.useState)("update"),[a,l]=(0,h.useState)(null),u={default:!1,plugin:{kind:"PrometheusDatasource",spec:{}}},{openDiscardChangesConfirmationDialog:c,closeDiscardChangesConfirmationDialog:d}=ek();return(0,o.jsx)(o.Fragment,{children:a?(0,o.jsx)(P.ValidationProvider,{children:(0,o.jsx)(P.DatasourceEditorForm,{initialDatasourceDefinition:a,action:r,isDraft:!0,onActionChange:i,onSave:e=>{n(t=>{delete t[a.name],t[e.name]=e.spec,l(null)})},onClose:()=>{l(null)}})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(e_.A,{sx:{display:"flex",alignItems:"center",padding:e=>e.spacing(1,2),borderBottom:e=>`1px solid ${e.palette.divider}`},children:[(0,o.jsx)(tl.A,{variant:"h2",children:"Edit Dashboard Datasources"}),(0,o.jsxs)(ty.A,{direction:"row",spacing:1,marginLeft:"auto",children:[(0,o.jsx)(s.A,{disabled:e.datasources===t,variant:"contained",onClick:()=>{e.onChange(t)},children:"Apply"}),(0,o.jsx)(s.A,{color:"secondary",variant:"outlined",onClick:()=>{JSON.stringify(e.datasources)!==JSON.stringify(t)?c({onDiscardChanges:()=>{d(),e.onCancel()},onCancel:()=>{d()},description:"You have unapplied changes. Are you sure you want to discard these changes? Changes cannot be recovered."}):e.onCancel()},children:"Cancel"})]})]}),(0,o.jsx)(e_.A,{padding:2,sx:{overflowY:"scroll"},children:(0,o.jsx)(ty.A,{spacing:2,children:(0,o.jsxs)(ty.A,{spacing:2,children:[(0,o.jsx)(nk.A,{children:(0,o.jsxs)(nP.A,{sx:{minWidth:650},"aria-label":"table of datasources",children:[(0,o.jsx)(nT.A,{children:(0,o.jsxs)(nM.A,{children:[(0,o.jsx)(n0.A,{children:"Name"}),(0,o.jsx)(n0.A,{children:"Type"}),(0,o.jsx)(n0.A,{children:"Description"}),(0,o.jsx)(n0.A,{align:"right",children:"Actions"})]})}),(0,o.jsx)(nR.A,{children:Object.entries(t).map(([e,r])=>(0,o.jsxs)(nM.A,{children:[(0,o.jsx)(n0.A,{component:"th",scope:"row",sx:{fontWeight:"bold"},children:e}),(0,o.jsx)(n0.A,{children:r.plugin.kind}),(0,o.jsx)(n0.A,{children:r.display?.description??""}),(0,o.jsxs)(n0.A,{align:"right",sx:{whiteSpace:"nowrap"},children:[(0,o.jsx)(tN.A,{onClick:()=>{i("update"),l({name:e,spec:t[e]??u})},children:(0,o.jsx)(n9.default,{})}),(0,o.jsx)(tN.A,{onClick:()=>{n(t=>{delete t[e]})},children:(0,o.jsx)(n3.default,{})})]})]},e))})]})}),(0,o.jsx)(e_.A,{display:"flex",children:(0,o.jsx)(s.A,{variant:"contained",startIcon:(0,o.jsx)(n1.default,{}),sx:{marginLeft:"auto"},onClick:()=>{i("create"),l({name:"NewDatasource",spec:u})},children:"Add Datasource"})})]})})})]})})}function o7(){let[e,t]=(0,h.useState)(!1),{getLocalDatasources:n,setLocalDatasources:r,getSavedDatasources:i,setSavedDatasources:a}=(0,P.useDatasourceStore)(),l=n(),d=i(),{dashboard:f,setDashboard:g}=i2(),m=()=>{t(!1)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(u.InfoTooltip,{description:c.editDatasources,children:(0,o.jsx)(s.A,{startIcon:(0,o.jsx)(tP.default,{}),onClick:()=>{t(!0)},"aria-label":c.editDatasources,variant:"text",color:"primary",sx:p,children:"Datasources"})}),(0,o.jsx)(u.Drawer,{isOpen:e,onClose:m,PaperProps:{sx:{width:"50%"}},"data-testid":"datasource-editor",children:(0,o.jsx)(o5,{datasources:l,onCancel:m,onChange:e=>{let n=Object.keys(e).filter(t=>{let n="directUrl"in(e[t]?.plugin?.spec??{}),r=!n&&!("directUrl"in(d[t]?.plugin?.spec??{}))&&e[t]?.plugin?.spec?.proxy===d[t]?.plugin?.spec?.proxy;return n||r}).reduce((t,n)=>(t[n]=e[n],t),{});g({...f,spec:{...f.spec,datasources:e}}),a(n),r(e),t(!1)}})})]})}o9.BREAK=o0,o9.SKIP=o1,o9.REMOVE=o2,o9.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(!t||!("items"in t))return;n=t.items[r]}return n},o9.parentCollection=(e,t)=>{let n=o9.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw Error("Parent collection not found")};var o8=n(65707);let o6=e=>{let{isReadonly:t}=e,{openEditJsonDialog:n}=eT(),r=t?c.viewJson:c.editJson;return(0,o.jsx)(u.InfoTooltip,{description:r,children:(0,o.jsx)(u.ToolbarIconButton,{"aria-label":r,variant:"outlined",onClick:()=>n(),children:(0,o.jsx)(o8.default,{})})})},se=({onSave:e,isDisabled:t,variant:n="contained"})=>{let{saveDashboard:r,isSaving:i}=i9(e);return(0,o.jsx)(s.A,{variant:n,onClick:r,disabled:t||i,children:"Save"})};function st(e,t){let{disableHysteresis:n=!1,threshold:r=100,target:i}=t,a=e.current;return i&&(e.current=void 0!==i.pageYOffset?i.pageYOffset:i.scrollTop),(!!n||void 0===a||!(e.current<a))&&e.current>r}let sn="u">typeof window?window:null;var sr=n(26952);function si(e){return(0,e7.Ay)("MuiAppBar",e)}(0,e5.A)("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);let sa=(e,t)=>e?`${e?.replace(")","")}, ${t})`:t,so=(0,ez.A)(nI.A,{name:"MuiAppBar",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`position${(0,tz.A)(n.position)}`],t[`color${(0,tz.A)(n.color)}`]]}})((0,n_.A)(({theme:e})=>({display:"flex",flexDirection:"column",width:"100%",boxSizing:"border-box",flexShrink:0,variants:[{props:{position:"fixed"},style:{position:"fixed",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0,"@media print":{position:"absolute"}}},{props:{position:"absolute"},style:{position:"absolute",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"sticky"},style:{position:"sticky",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"static"},style:{position:"static"}},{props:{position:"relative"},style:{position:"relative"}},{props:{color:"inherit"},style:{"--AppBar-color":"inherit"}},{props:{color:"default"},style:{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[100],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[100]),...e.applyStyles("dark",{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[900],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[900])})}},...Object.entries(e.palette).filter((0,sr.A)(["contrastText"])).map(([t])=>({props:{color:t},style:{"--AppBar-background":(e.vars??e).palette[t].main,"--AppBar-color":(e.vars??e).palette[t].contrastText}})),{props:e=>!0===e.enableColorOnDark&&!["inherit","transparent"].includes(e.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)"}},{props:e=>!1===e.enableColorOnDark&&!["inherit","transparent"].includes(e.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...e.applyStyles("dark",{backgroundColor:e.vars?sa(e.vars.palette.AppBar.darkBg,"var(--AppBar-background)"):null,color:e.vars?sa(e.vars.palette.AppBar.darkColor,"var(--AppBar-color)"):null})}},{props:{color:"transparent"},style:{"--AppBar-background":"transparent","--AppBar-color":"inherit",backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...e.applyStyles("dark",{backgroundImage:"none"})}}]}))),ss=h.forwardRef(function(e,t){let n=(0,e4.b)({props:e,name:"MuiAppBar"}),{className:r,color:i="primary",enableColorOnDark:a=!1,position:s="fixed",...l}=n,u={...n,color:i,position:s,enableColorOnDark:a},c=(e=>{let{color:t,position:n,classes:r}=e,i={root:["root",`color${(0,tz.A)(t)}`,`position${(0,tz.A)(n)}`]};return(0,e3.A)(i,si,r)})(u);return(0,o.jsx)(so,{square:!0,component:"header",ownerState:u,elevation:4,className:(0,e9.A)(c.root,r,"fixed"===s&&"mui-fixed"),ref:t,...l})});var sl=n(29917),su=n(80154),sc=n(81227),sd=n(5611),sp=n(93648),sf=n(42927);let sh=g().createContext(void 0);function sg(){let e=(0,h.useContext)(sh);if(!e)throw Error("ListVariableListBoxContext not found");return e}function sm({value:e,children:t}){return(0,o.jsx)(sh.Provider,{value:e,children:t})}let sy=(0,h.forwardRef)(function(e,t){let{children:n,...r}=e,{options:i,selectedOptions:a,filteredOptions:s,allowAllValue:l,onChange:u}=sg(),c=(0,h.useMemo)(()=>a.length,[a]),d=(0,h.useMemo)(()=>i.length>0&&c>0&&c!==i.length,[c,i]),p=(0,h.useMemo)(()=>i.length>0&&c===i.length,[c,i]);return(0,o.jsxs)("ul",{...r,ref:t,role:"listbox",children:[(0,o.jsxs)("li",{style:{display:"flex",alignItems:"center"},children:[(0,o.jsx)(sf.A,{indeterminate:d,checked:p,onChange:()=>{var e,t,n,r,o,c,f;return e=i,t=a,n=s,r=d,o=p,c=l,f=u,void(o?f(n.length!==e.length?t.filter(e=>!n.includes(e)):[]):r?f(c?n.length===e.length?t[0]?.value===T.DEFAULT_ALL_VALUE?e.filter(e=>e.value!==T.DEFAULT_ALL_VALUE):[{label:T.DEFAULT_ALL_VALUE,value:T.DEFAULT_ALL_VALUE}]:n.every(e=>t.includes(e))?t.filter(e=>!n.includes(e)):[...t,...n.filter(e=>e.value!==T.DEFAULT_ALL_VALUE)]:n.length===e.length?e:n.every(e=>t.includes(e))?t.filter(e=>!n.includes(e)):[...t,...n]):f(n))}}),(0,o.jsxs)("span",{children:[(0,o.jsx)("strong",{children:c})," Selected"]})]}),(0,o.jsx)(t4.A,{}),n]})});function sb(e){return null===e?null:Array.isArray(e)?e.map(e=>e.value):e.value}function sv({name:e,source:t}){let n=nx(e,t),r=n.definition?.kind;switch(r){case"TextVariable":return(0,o.jsx)(sA,{name:e,source:t});case"ListVariable":return(0,o.jsx)(sS,{name:e,source:t})}return(0,o.jsxs)("div",{children:["Unsupported Variable Kind: $",r]})}function sx(e,t,n){let r=e?.allowMultiple===!0,i=e?.allowAllValue===!0,a=e?.sort,o=(0,h.useMemo)(()=>n.isFetching??!1,[n.isFetching]),s=(0,h.useMemo)(()=>n.data??[],[n.data]),l=t?.value;r&&!Array.isArray(l)&&(l="string"==typeof l?[l]:[]);let u=(0,h.useMemo)(()=>{let e=s?[...s]:[];if(!a||"none"===a)return e;let t=P.SORT_METHODS[a];return t?t.sort(e):e},[s,a]),c=(0,h.useMemo)(()=>{let e=u;return i&&(e=[{value:T.DEFAULT_ALL_VALUE,label:"All"},...e]),e},[i,u]),d=(0,h.useMemo)(()=>!!c.find(e=>r?l.includes(e.value):l===e.value),[c,l,r]);l=(0,h.useMemo)(()=>{let e=c?.[+!!i]?.value;return!e||d&&l&&0!==l.length?l:r?[e]:e},[c,l,d,r,i]);let p=(0,h.useMemo)(()=>Array.isArray(l)?c.filter(e=>l?.includes(e.value)):c.find(e=>l===e.value)??{value:"",label:""},[l,c]);return{value:l,loading:o,options:s,selectedOptions:p,viewOptions:c}}let sw=e=>(0,o.jsx)(tx.A,{...e,sx:{minWidth:"fit-content"},placement:"bottom-start"}),sj=(e,t)=>{let n=(e.length+1)*8+40*("list"===t);return n<120?120:n>500?500:n};function sS({name:e,source:t}){let n=nx(e,t),r=n.definition,i=(0,P.useListVariablePluginValues)(r),{setVariableValue:a,setVariableLoading:s,setVariableOptions:l}=nw(),{selectedOptions:u,value:c,loading:d,options:p,viewOptions:f}=sx(r?.spec,n.state,i),[g,m]=(0,h.useState)(120),[y,b]=(0,h.useState)(""),v=r?.spec.display?.name??e,x=r?.spec.allowMultiple===!0,w=r?.spec.allowAllValue===!0,j=(0,sc.Z)({}),S=(0,h.useMemo)(()=>j(f,{inputValue:y,getOptionLabel:e=>e.label}),[y,f,j]);(0,h.useEffect)(()=>{c&&a(e,c,t)},[a,e,c,t]),(0,h.useEffect)(()=>{s(e,d,t)},[s,e,d,t]),(0,h.useEffect)(()=>{p&&l(e,p,t)},[l,e,p,t]);let A=(0,h.useCallback)(n=>{a(e,sb(n),t)},[e,a,t]),C=(0,h.useMemo)(()=>({options:f,selectedOptions:u,filteredOptions:S,allowAllValue:w,onChange:A}),[w,S,A,u,f]),E=(0,h.useMemo)(()=>(0,o.jsx)(sd.A,{disablePortal:!0,loading:d,disableCloseOnSelect:x,multiple:x,fullWidth:!0,limitTags:3,size:"small",disableClearable:!0,slotProps:{listbox:{component:x?sy:void 0}},slots:{popper:sw},sx:{"& .MuiInputBase-root":{minHeight:"38px"},"& .MuiAutocomplete-tag":{margin:"1px 2px"}},filterOptions:j,options:f,value:u,onChange:(n,r)=>{(null===r||Array.isArray(r)&&0===r.length)&&w?a(e,T.DEFAULT_ALL_VALUE,t):a(e,sb(r),t)},inputValue:x?y:void 0,onInputChange:(e,t)=>{x||m(sj(t,"list"))},onBlur:()=>{x&&b("")},renderInput:e=>x?(0,o.jsx)(sp.A,{...e,label:v,onChange:e=>b(e.target.value)}):(0,o.jsx)(sp.A,{...e,label:v,style:{width:`${g}px`}}),renderOption:(e,t,{selected:n})=>{let{key:r,...i}=e;return(0,o.jsxs)("li",{...i,style:{padding:0},children:[(0,o.jsx)(sf.A,{style:{marginRight:8},checked:n}),t.label]},r)},renderTags:(e,t,n)=>{if(n.focused)return(0,o.jsx)(e_.A,{sx:{maxHeight:200,overflowY:"auto"},children:e.map((e,n)=>(0,h.createElement)(tB.A,{...t({index:n}),key:n,label:e.label,size:"small"}))});let r=n.limitTags,i=e.length;return(0,o.jsxs)(o.Fragment,{children:[e.slice(0,r).map((e,n)=>(0,h.createElement)(tB.A,{...t({index:n}),key:n,label:e.label,size:"small"})),r&&i>r&&` +${i-r}`]})}}),[w,x,j,y,g,d,e,u,a,t,v,f]);return x?(0,o.jsx)(sm,{value:C,children:E}):E}function sA({name:e,source:t}){let n=nx(e,t),r=n.state,i=n.definition,[a,s]=(0,h.useState)(r?.value??""),[l,u]=(0,h.useState)(sj(a,"text")),{setVariableValue:c}=nw();return(0,h.useEffect)(()=>{s(r?.value??"")},[r?.value]),(0,o.jsx)(sp.A,{title:a,value:a,onChange:e=>{s(e.target.value),u(sj(e.target.value,"text"))},onBlur:()=>c(e,a,t),placeholder:e,label:i?.spec.display?.name??e,slotProps:{input:{readOnly:i?.spec.constant??!1}},sx:{width:`${l}px`,"& .MuiInputBase-root":{minHeight:"38px"},"& .MuiInputBase-input":{textOverflow:"ellipsis"}}})}function sC(){let e=nj(),t=nS();return(0,o.jsxs)(o.Fragment,{children:[t.slice().reverse().map(e=>e.definitions.map(t=>(0,o.jsx)(sE,{spec:t.spec,source:e.source},t.spec.name+e.source))),e.map(e=>(0,o.jsx)(sE,{spec:e.spec},e.spec.name))]})}function sE({spec:e,source:t}){let n=nx(e.name,t);return n.state?.overridden?null:(0,o.jsx)(e_.A,{display:e.display?.hidden?"none":void 0,minWidth:"120px",maxWidth:"500px",flexShrink:0,"data-testid":"variable-"+e.name,children:(0,o.jsx)(sv,{name:e.name,source:t},e.name+(t??""))},e.name+(t??""))}function sD(e){let[t,n]=(0,h.useState)(e.initialVariableIsSticky),r=function(e={}){let{getTrigger:t=st,target:n=sn,...r}=e,i=h.useRef(),[a,o]=h.useState(()=>t(i,r));return h.useEffect(()=>{if(null===n)return o(!1);let e=()=>{o(t(i,{target:n,...r}))};return e(),n.addEventListener("scroll",e,{passive:!0}),()=>{n.removeEventListener("scroll",e,{passive:!0})}},[n,t,JSON.stringify(r)]),a}({disableHysteresis:!0})&&e.initialVariableIsSticky&&t,i=(0,i8.A)((0,eI.A)().breakpoints.up("md")),{timeZone:a,setTimeZone:s}=(0,P.useTimeZoneParams)("local");return(0,o.jsx)(e_.A,{marginBottom:-1,"data-testid":"variable-list",children:(0,o.jsx)(ss,{color:"inherit",position:r?"fixed":"static",elevation:4*!!r,sx:{backgroundColor:"inherit",...e.sx},children:(0,o.jsxs)(e_.A,{display:"flex",justifyContent:"space-between",sx:{flexDirection:i?"row":"column"},children:[(0,o.jsxs)(e_.A,{display:"flex",flexWrap:!r&&i?"wrap":"nowrap",maxWidth:r||!i?"100vw":"100%",pt:1,pl:+!!r,mt:r&&i?.5:0,ml:r&&i?.5:0,sx:{overflowX:!r&&i?"hidden":"auto",scrollbarWidth:"thin","&::-webkit-scrollbar":{height:"8px",backgroundColor:e=>e.palette.grey["300"]},"&::-webkit-scrollbar-thumb":{background:e=>e.palette.grey["600"]}},gap:1,children:[(0,o.jsx)(sC,{}),e.initialVariableIsSticky&&(0,o.jsx)(tN.A,{style:{width:"fit-content",height:"fit-content"},onClick:()=>n(!t),children:t?(0,o.jsx)(sl.default,{}):(0,o.jsx)(su.default,{})})]}),r&&(0,o.jsx)(ty.A,{m:i?1.5:1,mt:1.5*!!i,ml:i?1.5:"auto",direction:"row",justifyContent:"end",children:(0,o.jsx)(P.TimeRangeControls,{timeZone:a,onTimeZoneChange:e=>s(e.value)})})]})})})}let sO=e=>{let{dashboardName:t,dashboardTitleComponent:n,initialVariableIsSticky:r,isReadonly:i,isVariableEnabled:a,isDatasourceEnabled:l,isLinksEnabled:c=!0,onEditButtonClick:d,onCancelButtonClick:p,onSave:f}=e,{isEditMode:h}=q(),{timeZone:g,setTimeZone:m}=(0,P.useTimeZoneParams)("local"),y=Y(),b=(0,i8.A)((0,eI.A)().breakpoints.up("sm")),v=(0,i8.A)((0,eI.A)().breakpoints.up("md")),x=n||(0,o.jsx)(tl.A,{variant:"h2",children:t});return(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)(ty.A,{"data-testid":"dashboard-toolbar",children:[(0,o.jsxs)(e_.A,{px:2,py:1.5,display:"flex",sx:{gap:2,backgroundColor:e=>e.palette.primary.main+(h?"30":"0")},children:[x,c&&(0,o.jsx)(ty.A,{display:"flex",justifyItems:"center",alignItems:"center",justifyContent:"center",children:(0,o.jsx)(tq,{links:y,variant:"dashboard"})}),h?(0,o.jsxs)(ty.A,{direction:"row",gap:1,ml:"auto",children:[i&&(0,o.jsx)(nO.A,{severity:"warning",sx:{backgroundColor:"transparent",padding:0},children:"Dashboard managed via code only. Download JSON and commit changes to save."}),(0,o.jsxs)(ty.A,{direction:"row",spacing:.5,ml:1,whiteSpace:"nowrap",children:[a&&(0,o.jsx)(ri,{}),l&&(0,o.jsx)(o7,{}),c&&(0,o.jsx)(rh,{}),(0,o.jsx)(eL,{}),(0,o.jsx)(eM,{})]}),(0,o.jsx)(se,{onSave:f,isDisabled:i}),(0,o.jsx)(s.A,{variant:"outlined",onClick:p,children:"Cancel"})]}):(0,o.jsx)(o.Fragment,{children:b&&(0,o.jsx)(ty.A,{direction:"row",gap:1,ml:"auto",children:(0,o.jsx)(ra,{onClick:d})})})]}),(0,o.jsxs)(e_.A,{sx:{display:"flex",width:"100%",alignItems:"start",padding:e=>e.spacing(1,2,0,2),flexDirection:v?"row":"column",flexWrap:"nowrap",gap:1},children:[(0,o.jsx)(e_.A,{width:"100%",children:(0,o.jsx)(u.ErrorBoundary,{FallbackComponent:u.ErrorAlert,children:(0,o.jsx)(sD,{initialVariableIsSticky:r,sx:{backgroundColor:({palette:e})=>e.background.default}})})}),(0,o.jsx)(ty.A,{direction:"row",ml:"auto",flexWrap:"wrap",justifyContent:"end",children:(0,o.jsxs)(ty.A,{direction:"row",spacing:1,mt:1,ml:1,children:[(0,o.jsx)(P.TimeRangeControls,{timeZone:g,onTimeZoneChange:e=>m(e.value)}),(0,o.jsx)(o4,{}),(0,o.jsx)(o6,{isReadonly:!h})]})})]})]})})},sk=()=>{let{deletePanelDialog:e,closeDeletePanelDialog:t}=ev();return(0,o.jsxs)(u.Dialog,{open:void 0!==e,children:[(0,o.jsx)(u.Dialog.Header,{onClose:()=>t(),children:"Delete Panel"}),e&&(0,o.jsx)(sP,{deletePanelDialog:e})]})},sP=({deletePanelDialog:e})=>{let{deletePanel:t,closeDeletePanelDialog:n}=ev(),{setViewPanel:r}=eS();return(0,o.jsxs)("form",{onSubmit:i=>{i.preventDefault();let{panelGroupItemId:a}=e;t(a),n(),r(void 0)},children:[(0,o.jsxs)(u.Dialog.Content,{children:["Are you sure you want to delete ",e.panelName," from ",e.panelGroupName,"? This action cannot be undone."]}),(0,o.jsxs)(u.Dialog.Actions,{children:[(0,o.jsx)(u.Dialog.PrimaryButton,{children:"Delete"}),(0,o.jsx)(u.Dialog.SecondaryButton,{onClick:()=>n(),children:"Cancel"})]})]})},sT=()=>{let{deletePanelGroupDialog:e,closeDeletePanelGroupDialog:t,deletePanelGroup:n}=ed(),{setViewPanel:r}=eS(),i=e?.panelGroupId;return(0,o.jsxs)(u.Dialog,{open:void 0!==e,children:[(0,o.jsx)(u.Dialog.Header,{children:"Delete Panel Group"}),(0,o.jsxs)("form",{onSubmit:e=>{if(e.preventDefault(),void 0===i)throw Error("group index is undefined");n(i),t(),r(void 0)},children:[(0,o.jsxs)(u.Dialog.Content,{dividers:!0,sx:{width:"500px"},children:["Are you sure you want to delete ",e?.panelGroupName??"panel group","? This will delete all the panels within the group."]}),(0,o.jsxs)(u.Dialog.Actions,{children:[(0,o.jsx)(s.A,{variant:"contained",type:"submit",children:"Delete"}),(0,o.jsx)(s.A,{variant:"outlined",color:"secondary",onClick:()=>t(),children:"Cancel"})]})]})]})},sM=()=>{let{discardChangesConfirmationDialog:e}=ek();return void 0===e?null:(0,o.jsx)(u.DiscardChangesConfirmationDialog,{description:e.description||"You have unsaved changes in this dashboard. Are you sure you want to discard these changes? Changes cannot be recovered.",isOpen:!0,onCancel:e.onCancel,onDiscardChanges:e.onDiscardChanges})};var sR=n(67987);let sL=e=>{let{isReadonly:t,disableMetadataEdition:n}=e,{editJsonDialog:r,closeEditJsonDialog:i}=eT();return(0,o.jsxs)(u.Dialog,{open:!!r?.isOpen,scroll:"paper",fullWidth:!0,maxWidth:"lg",children:[(0,o.jsxs)(u.Dialog.Header,{onClose:()=>i(),children:[!t&&"Edit "," Dashboard JSON"]}),r?.isOpen&&(0,o.jsx)(s_,{isReadonly:t,disableMetadataEdition:n})]})},s_=e=>{let{isReadonly:t,disableMetadataEdition:n}=e,{closeEditJsonDialog:r}=eT(),{setTimeRange:i,setRefreshInterval:a}=(0,P.useTimeRange)(),{dashboard:s,setDashboard:l}=i2(),{setLocalDatasources:c}=(0,P.useDatasourceStore)(),[d,p]=(0,h.useState)(s),f=e=>{e.preventDefault(),l(d),i({pastDuration:d.spec.duration}),a(d.spec.refreshInterval??"0s"),c(d.spec.datasources??{}),r()};return(0,o.jsxs)(u.Dialog.Form,{onSubmit:f,children:[(0,o.jsxs)(u.Dialog.Content,{sx:{width:"100%"},children:[n&&!t&&(0,o.jsx)(nO.A,{sx:{marginBottom:e=>e.spacing(1)},severity:"warning",children:"Metadata cannot be modified or saved."}),"EphemeralDashboard"===d.kind&&(0,o.jsx)(nO.A,{sx:{marginBottom:1},severity:"warning",children:"Time-to-live cannot be modified or saved from here. Go to the project view to modify it."}),(0,o.jsx)(sR.A,{fullWidth:!0,children:(0,o.jsx)(u.JSONEditor,{minHeight:"300px",maxHeight:"70vh",value:d,onChange:e=>(e=>{try{let t=JSON.parse(e??"{}");p(t)}catch(e){}})(e),readOnly:t})})]}),!t&&(0,o.jsx)(u.Dialog.Actions,{children:(0,o.jsx)(u.Dialog.PrimaryButton,{onClick:f,children:"Apply"})})]})};var sI=n(67435);let sV=e=>(e.preventDefault(),e.returnValue="","");function sH({isBlocked:e,message:t}){let n=(0,sI.KP)(e),r="blocked"===n.state,i="proceeding"===n.state;return(0,h.useEffect)(()=>(e?window.addEventListener("beforeunload",sV):window.removeEventListener("beforeunload",sV),()=>{window.removeEventListener("beforeunload",sV)}),[n,e,r]),(0,o.jsx)(u.DiscardChangesConfirmationDialog,{description:t,isOpen:r||i,onDiscardChanges:()=>n.proceed?.(),onCancel:()=>n.reset?.()})}function sN({original:e,current:t}){return(0,o.jsx)(sH,{isBlocked:n=>JSON.stringify(e)!==JSON.stringify(t)&&n.currentLocation.pathname!==n.nextLocation.pathname,message:"You have unsaved changes, are you sure you want to leave?"})}var sz=n(66395),s$=n(79215),sB=n(42338);let sG=(0,h.createContext)(void 0),sW=({children:e})=>{let[t,n]=(0,h.useState)(void 0),r=(0,h.useMemo)(()=>({preview:{previewPanelWidth:t,setPreviewPanelWidth:n}}),[t]);return(0,o.jsx)(sG.Provider,{value:r,children:e})};function sF({plugin:e,control:t,panelDefinition:n,onQueriesChange:r,onPluginSpecChange:i,onJSONChange:a}){let{data:s}=(0,P.usePlugin)("Panel",e.kind),l=(0,h.useContext)(eH.PanelEditorContext),c=(0,P.useSuggestedStepMs)(l?.preview.previewPanelWidth),d=(0,h.useMemo)(()=>"function"==typeof s?.queryOptions?s?.queryOptions(n.spec.plugin.spec):s?.queryOptions,[n.spec.plugin.spec,s]),[p,f]=(0,h.useState)(()=>n.spec.queries?.map(e=>({kind:e.spec.plugin.kind,spec:e.spec.plugin.spec}))??[]),g=(0,h.useCallback)(e=>{r(e),e.length!==p.length&&f(e.map(e=>({kind:e.spec.plugin.kind,spec:e.spec.plugin.spec})))},[r,p.length]),m=(0,h.useCallback)((e,t)=>{f(n=>{let r=[...n];return r[e]={kind:t.spec.plugin.kind,spec:t.spec.plugin.spec},r})},[]);return(0,o.jsxs)(P.DataQueriesProvider,{definitions:p,options:{suggestedStepMs:c,...d},children:[(0,o.jsxs)(sz.Ay,{item:!0,xs:12,children:[(0,o.jsx)(tl.A,{variant:"h4",marginBottom:1,children:"Preview"}),(0,o.jsx)(u.ErrorBoundary,{FallbackComponent:u.ErrorAlert,children:(0,o.jsx)(eH.PanelPreview,{panelDefinition:n})})]}),(0,o.jsx)(sz.Ay,{item:!0,xs:12,children:(0,o.jsx)(u.ErrorBoundary,{FallbackComponent:u.ErrorAlert,children:(0,o.jsx)(P.PanelSpecEditor,{control:t,panelDefinition:n,onJSONChange:a,onQueriesChange:g,onQueryRun:m,onPluginSpecChange:i})})})]})}function sq(e){let{initialValues:t,initialAction:n,panelKey:r,onSave:i,onClose:a}=e,l=en(),{panelDefinition:c,setName:d,setDescription:p,setLinks:f,setQueries:g,setPlugin:m,setPanelDefinition:y}=(e=>{let{display:t,plugin:n,queries:r,links:i}=e.spec,a=t??{name:void 0,description:void 0},[o,s]=(0,h.useState)(a.name),[l,u]=(0,h.useState)(a.description),[c,d]=(0,h.useState)(i),[p,f]=(0,h.useState)(n),[g,m]=(0,h.useState)(r),[y,b]=(0,h.useState)(r),v=(0,h.useCallback)((e,t)=>{t?(m(y),b(void 0)):b(void 0===e?g:e)},[b,y,m,g]),x=(0,h.useCallback)(e=>{let{display:t,plugin:n,queries:r,links:i}=e.spec;s(t?.name),u(t?.description),d(i),f(n),v(r)},[s,u,d,f,v]);return(0,h.useMemo)(()=>({panelDefinition:{kind:"Panel",spec:{display:void 0!==o||void 0!==l?{name:o,description:l}:void 0,plugin:p,queries:y,links:c}},setName:s,setDescription:u,setLinks:d,setQueries:v,setPlugin:f,setPanelDefinition:x}),[o,l,c,p,y,v,x])})(t.panelDefinition),{plugin:b}=c.spec,[v,x]=(0,h.useState)(!1),{panelEditorSchema:w}=(0,P.useValidationSchemas)(),j=(0,s$.useForm)({resolver:(0,sB.u)(w),mode:"onBlur",defaultValues:t}),S=(0,P.usePluginEditor)({pluginTypes:["Panel"],value:{selection:{kind:b.kind,type:"Panel"},spec:b.spec},onChange:e=>{j.setValue("panelDefinition.spec.plugin",{kind:e.selection.kind,spec:e.spec}),m({kind:e.selection.kind,spec:e.spec})},onHideQueryEditorChange:e=>{g(void 0,e)}}),A=(0,u.getTitleAction)(n,!0),C=(0,u.getSubmitText)(n,!0),E=(0,s$.useWatch)({control:j.control,name:"panelDefinition.spec.links"});(0,h.useEffect)(()=>{f(E)},[f,E]);let D=(0,h.useCallback)(e=>{i(e)},[i]),O=(0,s$.useWatch)({control:j.control,name:"panelDefinition.spec.display.name"}),k=(0,s$.useWatch)({control:j.control,name:"panelDefinition.spec.display.description"}),T=(0,s$.useWatch)({control:j.control,name:"panelDefinition.spec.plugin.kind"}),M=(0,h.useCallback)(()=>{j.handleSubmit(D)()},[j,D]);return(0,o.jsx)(s$.FormProvider,{...j,children:(0,o.jsxs)(sW,{children:[(0,o.jsxs)(e_.A,{sx:{display:"flex",alignItems:"center",padding:e=>e.spacing(1,2),borderBottom:e=>`1px solid ${e.palette.divider}`},children:[(0,o.jsxs)(ty.A,{direction:"row",spacing:1,alignItems:"center",children:[(0,o.jsxs)(tl.A,{variant:"h2",children:[A," Panel"]}),r&&(0,o.jsxs)(tl.A,{variant:"subtitle1",children:["(ID: ",r,")"]})]}),(0,o.jsxs)(ty.A,{direction:"row",spacing:1,marginLeft:"auto",children:[(0,o.jsx)(s.A,{variant:"contained",disabled:!j.formState.isValid,onClick:M,children:C}),(0,o.jsx)(s.A,{color:"secondary",variant:"outlined",onClick:function(){let e=j.getValues(),n=e=>(e.panelDefinition.spec.display?.name===void 0&&e.panelDefinition.spec.display?.description===void 0&&(e.panelDefinition.spec.display=void 0),e),r=n(JSON.parse(JSON.stringify(t))),i=n(JSON.parse(JSON.stringify(e)));JSON.stringify(r)!==JSON.stringify(i)?x(!0):a()},children:"Cancel"})]})]}),(0,o.jsx)(e_.A,{id:sU,sx:{flex:1,overflowY:"scroll",padding:e=>e.spacing(2)},children:(0,o.jsxs)(sz.Ay,{container:!0,spacing:2,children:[(0,o.jsx)(sz.Ay,{item:!0,xs:8,children:(0,o.jsx)(s$.Controller,{control:j.control,name:"panelDefinition.spec.display.name",render:({field:e,fieldState:t})=>(0,o.jsx)(sp.A,{...e,fullWidth:!0,label:"Name",error:!!t.error,helperText:t.error?.message,value:O??"",onChange:t=>{e.onChange(t),d(t.target.value)}})})}),(0,o.jsx)(sz.Ay,{item:!0,xs:4,children:(0,o.jsx)(s$.Controller,{control:j.control,name:"groupId",render:({field:e,fieldState:t})=>(0,o.jsx)(sp.A,{select:!0,...e,required:!0,fullWidth:!0,label:"Group",error:!!t.error,helperText:t.error?.message,onChange:t=>{e.onChange(t)},children:l.map((e,t)=>(0,o.jsx)(tG.A,{value:e.id,children:e.title??`Group ${t+1}`},e.id))})})}),(0,o.jsx)(sz.Ay,{item:!0,xs:8,children:(0,o.jsx)(s$.Controller,{control:j.control,name:"panelDefinition.spec.display.description",render:({field:e,fieldState:t})=>(0,o.jsx)(sp.A,{...e,fullWidth:!0,label:"Description",error:!!t.error,helperText:t.error?.message,value:k??"",onChange:t=>{e.onChange(t),p(t.target.value)}})})}),(0,o.jsx)(sz.Ay,{item:!0,xs:4,children:(0,o.jsx)(s$.Controller,{control:j.control,name:"panelDefinition.spec.plugin.kind",render:({field:e,fieldState:t})=>(0,o.jsx)(P.PluginKindSelect,{...e,pluginTypes:["Panel"],required:!0,fullWidth:!0,label:"Type",disabled:S.isLoading,error:!!S.error||!!t.error,helperText:S.error?.message??t.error?.message,value:{type:"Panel",kind:T},onChange:t=>{e.onChange(t.kind),S.onSelectionChange(t)}})})}),(0,o.jsx)(u.ErrorBoundary,{FallbackComponent:u.ErrorAlert,children:(0,o.jsx)(sF,{control:j.control,plugin:b,panelDefinition:c,onQueriesChange:e=>g(e),onPluginSpecChange:e=>{S.onSpecChange(e)},onJSONChange:e=>{let t=JSON.parse(e),{kind:n,spec:r}=t.spec.plugin;c.spec.plugin.kind!==n&&JSON.stringify(c.spec.plugin.spec)!==JSON.stringify(r)&&S.rememberCurrentSpecState(),y(t)}})})]})}),(0,o.jsx)(u.DiscardChangesConfirmationDialog,{description:"You have unapplied changes in this panel. Are you sure you want to discard these changes? Changes cannot be recovered.",isOpen:v,onCancel:()=>{x(!1)},onDiscardChanges:()=>{x(!1),a()}})]})})}let sU="panel-editor-form",sK=()=>{let e=ey(),t=ep(e?.panelGroupItemId),[n,r]=(0,h.useState)(!1),i=void 0!==e&&!n,a=(0,h.useCallback)(t=>{if(void 0===e||void 0===t)throw Error("Cannot apply changes");e.applyChanges(t),r(!0)},[e]),s=()=>{r(!0)},l=(0,h.useCallback)(()=>{e?.close(),r(!1)},[e]),c=()=>{},d=(0,h.useMemo)(()=>(0,o.jsx)(u.Drawer,{isOpen:i,onClose:c,slotProps:{transition:{onExited:l}},"data-testid":"panel-editor",children:e&&(0,o.jsx)(u.ErrorBoundary,{FallbackComponent:u.ErrorAlert,children:(0,o.jsx)(sq,{panelKey:t,initialAction:e.mode,initialValues:e.initialValues,onSave:a,onClose:s})})}),[l,a,i,e,t]);return e?.panelGroupItemId?.repeatVariable?(0,o.jsx)(sJ,{repeatVariable:e.panelGroupItemId.repeatVariable,children:d}):d};function sJ({repeatVariable:e,children:t}){let n=(0,P.useVariableValues)();return(0,o.jsx)(P.VariableContext.Provider,{value:{state:{...n,[e[0]]:{value:e[1],loading:!1}}},children:t})}function sY({panelDefinition:e}){let t=(0,h.useRef)(null),n=(0,h.useContext)(sG);return((0,h.useEffect)(()=>{let e=t.current?.getBoundingClientRect().width??840;n?.preview?.setPreviewPanelWidth?.(e)},[n]),""===e.spec.plugin.kind)?null:(0,o.jsx)(e_.A,{ref:t,height:300,children:(0,o.jsx)(t3,{definition:e})})}function sX(e){let{initialValues:t,variables:n,onSubmit:r}=e,[i,a]=(0,h.useState)(t.title),[s,l]=(0,h.useState)(t.isCollapsed),[u,c]=(0,h.useState)(t.repeatVariable);return(0,o.jsxs)("form",{id:sZ,onSubmit:e=>{e.preventDefault(),r({title:i,isCollapsed:s,repeatVariable:u})},children:[(0,o.jsx)(sR.A,{fullWidth:!0,margin:"normal",children:(0,o.jsx)(sp.A,{required:!0,label:"Name",variant:"outlined",value:i,onChange:e=>a(e.target.value),"data-testid":"panel-group-editor-name"})}),(0,o.jsxs)(sR.A,{fullWidth:!0,margin:"normal",children:[(0,o.jsxs)(sp.A,{select:!0,required:!0,label:"Collapse State",size:"small",value:s?"Closed":"Open",onChange:e=>l("Closed"===e.target.value),children:[(0,o.jsx)(tG.A,{value:"Open",children:"Open"}),(0,o.jsx)(tG.A,{value:"Closed",children:"Closed"})]}),(0,o.jsx)(sR.A,{fullWidth:!0,margin:"normal",children:(0,o.jsxs)(sp.A,{select:!0,label:"Repeat Variable",variant:"outlined",value:u??"",onChange:e=>c(""===e.target.value?void 0:e.target.value),children:[(0,o.jsx)(tG.A,{value:"",children:(0,o.jsx)(tl.A,{sx:{fontStyle:"italic"},children:"None"})}),n?.sort((e,t)=>e.localeCompare(t)).map(e=>(0,o.jsx)(tG.A,{value:e,children:e},e))]})})]})]})}let sZ="panel-group-editor-form";function sQ(){let e=eu(),t=(0,P.useVariableValues)(),[n,r]=(0,h.useState)(!1),i=void 0!==e&&!1===n;return(0,o.jsx)(u.Dialog,{open:i,TransitionProps:{onExited:()=>{e?.close(),r(!1)}},children:void 0!==e&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(u.Dialog.Header,{children:[e.mode," Panel Group"]}),(0,o.jsx)(u.Dialog.Content,{dividers:!0,sx:{width:"500px"},children:(0,o.jsx)(sX,{initialValues:e.initialValues,variables:Object.keys(t),onSubmit:t=>{if(void 0===e)throw Error("Cannot apply changes");e.applyChanges(t),r(!0)}})}),(0,o.jsxs)(u.Dialog.Actions,{children:[(0,o.jsx)(s.A,{variant:"contained",type:"submit",form:sZ,children:"Edit"===e.mode?"Apply":"Add"}),(0,o.jsx)(s.A,{variant:"outlined",color:"secondary",onClick:e.close,children:"Cancel"})]})]})})}var s0=n(65098);function s1(e){let{showTotalQueries:t=!0}=e,n=(0,P.useDatasourceClient)({kind:"PrometheusDatasource"}),{absoluteTimeRange:r}=(0,P.useTimeRange)(),i=(0,s0.jE)().getQueryCache().findAll(),a=i.filter(e=>"loading"===e.state.status),l=i.filter(e=>"success"===e.state.status),u=(0,P.useActiveTimeSeriesQueries)();if(!0===n.isLoading)return null;let c=[];return u.forEach(e=>{let t=e.state.data;if(t&&t.metadata?.notices){let n=e.queryKey,r=t.metadata.notices[0]?.message;r&&c.push({query:String(n[0].spec.plugin.spec.query),summary:r})}}),(0,o.jsxs)(ty.A,{spacing:1,mb:2,sx:{maxWidth:1e3},children:[(0,o.jsxs)(e_.A,{sx:{p:1},children:[(0,o.jsx)(tl.A,{variant:"h2",mb:1,children:"Query Summary"}),(0,o.jsx)(nk.A,{component:nI.A,children:(0,o.jsxs)(nP.A,{size:"small","aria-label":"query summary table",children:[(0,o.jsx)(nT.A,{children:(0,o.jsxs)(nM.A,{children:[(0,o.jsx)(n0.A,{children:"Queries Loading"}),(0,o.jsx)(n0.A,{children:"Recent Time Series Queries"}),t&&(0,o.jsx)(n0.A,{children:"Total Queries"}),(0,o.jsx)(n0.A,{children:"Start Time"}),(0,o.jsx)(n0.A,{children:"End Time"})]})}),(0,o.jsx)(nR.A,{children:(0,o.jsxs)(nM.A,{children:[(0,o.jsx)(n0.A,{children:a.length}),(0,o.jsx)(n0.A,{children:u.length}),t&&(0,o.jsx)(n0.A,{children:l.length}),(0,o.jsx)(n0.A,{children:r.start.toString()}),(0,o.jsx)(n0.A,{children:r.end.toString()})]})})]})})]}),c.length>0&&(0,o.jsxs)(e_.A,{sx:{p:1,m:0},children:[(0,o.jsx)(tl.A,{variant:"h3",mb:1,children:"Warnings"}),(0,o.jsx)(nk.A,{component:nI.A,sx:{mb:2},children:(0,o.jsxs)(nP.A,{size:"small","aria-label":"query warnings table",children:[(0,o.jsx)(nT.A,{children:(0,o.jsxs)(nM.A,{children:[(0,o.jsx)(n0.A,{children:"Query"}),(0,o.jsx)(n0.A,{children:"Summary"})]})}),(0,o.jsx)(nR.A,{children:c.map((e,t)=>(0,o.jsxs)(nM.A,{children:[(0,o.jsx)(n0.A,{children:e.query}),(0,o.jsx)(n0.A,{children:e.summary})]},t))})]})}),(0,o.jsx)(s.A,{disabled:!0,variant:"outlined",children:"TODO: Action Button"})]})]})}var s2=n(45158),s9=n(10740);let s3=()=>{let{saveChangesConfirmationDialog:e}=eD(),t=e?.isSavedDurationModified??!0,n=e?.isSavedVariableModified??!0,r=e?.isSavedRefreshIntervalModified??!0,[i,a]=(0,h.useState)(t),[s,l]=(0,h.useState)(n),[c,d]=(0,h.useState)(r),{getSavedVariablesStatus:p}=nw(),{modifiedVariableNames:f}=p(),g=void 0!==e,{timeRange:m,refreshInterval:y}=(0,P.useTimeRange)(),b=(0,T.isRelativeTimeRange)(m)?`(Last ${m.pastDuration})`:"(Absolute time ranges can not be saved)",v=`Save current time range as new default ${b}`,x=`Save current variable values as new default (${f.length>0?f.join(", "):"No modified variables"})`,w=P.DEFAULT_REFRESH_INTERVAL_OPTIONS.some(e=>e.display===y)?y:P.DEFAULT_REFRESH_INTERVAL_OPTIONS.find(e=>e.value.pastDuration===y)?.display,j=`Save current refresh interval as new default ${w?`(${w})`:"refresh interval not modified"}`;return(0,o.jsx)(u.Dialog,{open:g,children:void 0!==e&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(u.Dialog.Header,{onClose:()=>e.onCancel(),children:"Save Dashboard"}),(0,o.jsxs)(u.Dialog.Content,{children:[(0,o.jsx)(tl.A,{marginBottom:2,children:e.description||"You have made changes to the time range or the variables values. Would you like to save these as defaults?"}),(0,o.jsxs)(s2.A,{children:[(0,o.jsx)(s9.A,{control:(0,o.jsx)(sf.A,{disabled:!t||!(0,T.isRelativeTimeRange)(m),checked:i&&t&&(0,T.isRelativeTimeRange)(m),onChange:e=>a(e.target.checked)}),label:v}),(0,o.jsx)(s9.A,{control:(0,o.jsx)(sf.A,{disabled:!r,checked:c&&r,onChange:e=>d(e.target.checked)}),label:j}),(0,o.jsx)(s9.A,{control:(0,o.jsx)(sf.A,{disabled:!n,checked:s&&n,onChange:e=>l(e.target.checked)}),label:x})]})]}),(0,o.jsxs)(u.Dialog.Actions,{children:[(0,o.jsx)(u.Dialog.PrimaryButton,{onClick:()=>e.onSaveChanges(i,c,s),children:"Save Changes"}),(0,o.jsx)(u.Dialog.SecondaryButton,{onClick:()=>e.onCancel(),children:"Cancel"})]})]})})};function s4(e){let{projectName:t,datasourceApi:n,onCreate:r,children:i}=e,[a,s]=(0,h.useState)(e.dashboardResource),[l,u]=(0,h.useState)(e.savedDatasources??{}),c=t??a?.metadata.project,{getPlugin:d,listPluginMetadata:p}=(0,P.usePluginRegistry)(),f=(0,P.useEvent)(async e=>{if(a){let{datasources:t}=a.spec,r=function(e,t){if(void 0===e)return;if(void 0!==t.name){let n=e[t.name];if(void 0===n)return;return n.plugin.kind===t.kind?{name:t.name,spec:n}:void 0}let n=Object.entries(e).find(e=>e[1].plugin.kind===t.kind&&e[1].default);if(n)return{name:n[0],spec:n[1]}}(t,e);if(void 0!==r)return{spec:r.spec,proxyUrl:s5(n,{project:a.metadata.project,dashboard:a.metadata.name,name:r.name})}}if(c){let t=await n.getDatasource(String(c),e);if(void 0!==t)return{spec:t.spec,proxyUrl:s5(n,{project:t.metadata.project,name:t.metadata.name})}}let t=await n.getGlobalDatasource(e);if(void 0!==t)return{spec:t.spec,proxyUrl:s5(n,{name:t.metadata.name})};throw Error(`No datasource found for kind '${e.kind}' and name '${e.name}'`)}),g=(0,h.useCallback)(async e=>{let{spec:t}=await f(e);return t},[f]),m=(0,h.useCallback)(async function(e){let{kind:t}=e,[{spec:n,proxyUrl:i},a]=await Promise.all([f(e),d({kind:"Datasource",name:t})]),o=a.createClient(n.plugin.spec,{proxyUrl:i});return void 0!==r?r(o):o},[f,d,r]),y=(0,P.useEvent)(async e=>{var t;let r,i,o,s,u,d,[f,h,g]=await Promise.all([p(["Datasource"]),c?n.listDatasources(String(c),e):[],n.listGlobalDatasources(e)]),m=f.find(t=>t.spec.name===e);if(void 0===m)throw Error(`Could not find a Datasource plugin with kind '${e}'`);let{results:y,addItem:b}=(t=m.spec.display.name,r=[],i=new Set,o=!0,s=!1,u={},d=1,{results:r,addItem:({spec:e,selectorName:n,selectorGroup:a,editLink:l,saved:c})=>{a=a??"",o&&r.push({group:`Default ${t}`,items:[]});let p=r[u[a]??-1];!p&&(u[a]=d,p={items:[],group:a,editLink:l},r[d]=p,d++);let f=i.has(n);p.items.push({name:e.display?.name??n,overridden:f,saved:c,selector:{kind:e.plugin.kind,name:n,group:a}}),i.add(n);let h=!f&&e.default&&!s;if(r[0]&&(o||h)&&(r[0].items=[{name:`Default (${n} from ${a})`,selector:{kind:e.plugin.kind}}],s=h),f)for(let e=+!!s;e<d;e++)(r[e]?.items??[]).filter(e=>e.selector.name===n).forEach(e=>{e.overriding=!0});o=!1}});if(a?.spec.datasources)for(let t in a.spec.datasources){let n=a.spec.datasources[t];if(void 0===n||n.plugin.kind!==e)continue;let r=t in l;b({spec:n,selectorName:t,selectorGroup:"dashboard",saved:r})}for(let e of h){let t=e.metadata.name;b({spec:e.spec,selectorName:t,selectorGroup:"project",editLink:`/projects/${c}/datasources`})}for(let e of g){let t=e.metadata.name;b({spec:e.spec,selectorName:t,selectorGroup:"global",editLink:"/admin/datasources"})}return y}),b=(0,h.useCallback)(()=>a?.spec.datasources??{},[a]),v=(0,h.useCallback)(()=>l,[l]),x=(0,h.useCallback)(e=>{a&&s({...a,spec:{...a.spec,datasources:e}})},[a]),w=(0,h.useMemo)(()=>({getDatasource:g,getDatasourceClient:m,getLocalDatasources:b,setLocalDatasources:x,setSavedDatasources:u,getSavedDatasources:v,listDatasourceSelectItems:y}),[g,m,b,x,y,u,v]);return(0,o.jsx)(P.DatasourceStoreContext.Provider,{value:w,children:i})}function s5(e,t){return e.buildProxyUrl?e.buildProxyUrl(t):""}let s7={global:"Global","time-range":"Time Range",dashboard:"Dashboard","focused-panel":"Focused Panel"},s8=["global","time-range","dashboard","focused-panel"],s6={id:"go-home",sequence:["G","H"],name:"Go to Home",description:"Go to the Home page",category:"global",scope:"global"},le={id:"go-explore",sequence:["G","E"],name:"Go to Explore",description:"Go to the Explore page",category:"global",scope:"global"},lt={id:"go-profile",sequence:["G","P"],name:"Go to Profile",description:"Go to the Profile page",category:"global",scope:"global"},ln={id:"open-search",hotkey:"Mod+K",name:"Open Search",description:"Open the search dialog",category:"global",scope:"global",event:iP},lr={id:"show-shortcuts",hotkey:{key:"?",shift:!0},name:"Show Keyboard Shortcuts",description:"Show all the keyboard shortcuts",category:"global",scope:"global",event:iT,displayOverride:"?"},li={id:"toggle-theme",sequence:["C","T"],name:"Change Theme",description:"Change between dark and light theme",category:"global",scope:"global",event:iM},la=[s6,le,lt,ln,lr,li];function lo(e,t,n={}){let r={...rb().hotkey,...n},i=il(),a=(0,h.useRef)(null),o=(0,h.useRef)(t),s=(0,h.useRef)(r),l=(0,h.useRef)(i);o.current=t,s.current=r,l.current=i;let u=(0,h.useRef)(null),c=(0,h.useRef)(null),d=rG(e,r.platform??rx()),{target:p,...f}=r;(0,h.useEffect)(()=>{let e=rv(s.current.target)?s.current.target.current:s.current.target??("u">typeof document?document:null);if(!e){a.current?.isActive&&(a.current.unregister(),a.current=null),u.current=null,c.current=null;return}let t=null!==u.current&&u.current!==e,n=null!==c.current&&c.current!==d;return a.current?.isActive&&(t||n)&&(a.current.unregister(),a.current=null),a.current&&a.current.isActive||(a.current=l.current.register(d,o.current,{...s.current,target:e})),u.current=e,c.current=d,()=>{a.current?.isActive&&(a.current.unregister(),a.current=null)}},[d]),a.current?.isActive&&(a.current.callback=t,a.current.setOptions(f))}function ls(e,t,n={}){let r={...rb().hotkeySequence,...n},i=ih(),a=(0,h.useRef)(null),o=(0,h.useRef)(t),s=(0,h.useRef)(r),l=(0,h.useRef)(i),u=(0,h.useRef)(e);o.current=t,s.current=r,l.current=i,u.current=e;let c=(0,h.useRef)(null),d=(0,h.useRef)(null),p=rF(e),{target:f,...g}=r;(0,h.useEffect)(()=>{if(0===u.current.length){a.current?.isActive&&(a.current.unregister(),a.current=null),c.current=null,d.current=null;return}let e=rv(s.current.target)?s.current.target.current:s.current.target??("u">typeof document?document:null);if(!e){a.current?.isActive&&(a.current.unregister(),a.current=null),c.current=null,d.current=null;return}let t=null!==c.current&&c.current!==e,n=null!==d.current&&d.current!==p;return a.current?.isActive&&(t||n)&&(a.current.unregister(),a.current=null),a.current&&a.current.isActive||(a.current=l.current.register(u.current,(e,t)=>o.current(e,t),{...s.current,target:e})),c.current=e,d.current=p,()=>{a.current?.isActive&&(a.current.unregister(),a.current=null)}},[p]),a.current?.isActive&&(a.current.callback=(e,t)=>o.current(e,t),a.current.setOptions(g))}function ll(e,t){return e===t}function lu(e,t,n=ll){let r=(0,h.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,h.useCallback)(()=>e?.get(),[e]);return(0,b.useSyncExternalStoreWithSelector)(r,i,i,t,n)}function lc(){let e=il(),t=ih();return{hotkeys:lu(e.registrations,e=>Array.from(e.values()).map(ii)),sequences:lu(t.registrations,e=>Array.from(e.values()))}}function ld({children:e,initialState:t}){let[n,r]=(0,nh.useQueryParam)("viewPanelRef",nh.JsonParam);return(0,o.jsx)(G,{initialState:{...t,viewPanelRef:n??void 0,setViewPanelRef:r},children:e})}let lp=e=>(0,o.jsx)(eQ,{children:(0,o.jsx)(lf,{...e})}),lf=e=>{let{dashboardResource:t,emptyDashboardProps:n,isReadonly:r,isVariableEnabled:i,isDatasourceEnabled:a,disableShortcuts:s,isCreating:l,isInitialVariableSticky:c,isLeavingConfirmDialogEnabled:d,dashboardTitleComponent:p,onSave:f,onDiscard:g}=e,m=(0,u.useChartsTheme)(),{isEditMode:y,setEditMode:b}=q(),{dashboard:v,setDashboard:x}=i2(),[w,j]=(0,h.useState)(void 0),{setSavedDatasources:S}=(0,P.useDatasourceStore)(),{openDiscardChangesConfirmationDialog:A,closeDiscardChangesConfirmationDialog:C}=ek(),E=()=>{b(!0),j(v),S(v.spec.datasources??{})},D=()=>{JSON.stringify(v)===JSON.stringify(w)?b(!1):A({onDiscardChanges:()=>{w&&x(w),b(!1),C(),g&&g(v.metadata.name,v.spec)},onCancel:()=>{C()}})};return i7({onSave:f,isReadonly:r,onEditButtonClick:E,onCancelButtonClick:D,disabled:s}),(0,o.jsxs)(e_.A,{sx:{flexGrow:1,overflowX:"hidden",overflowY:"auto",display:"flex",flexDirection:"column"},children:[(0,o.jsx)(sO,{dashboardName:t.metadata.name,dashboardTitleComponent:p,initialVariableIsSticky:c,onSave:f,isReadonly:r,isVariableEnabled:i,isDatasourceEnabled:a,onEditButtonClick:E,onCancelButtonClick:D}),(0,o.jsxs)(e_.A,{sx:{paddingTop:2,paddingX:2,height:"100%"},children:[(0,o.jsx)(u.ErrorBoundary,{FallbackComponent:u.ErrorAlert,children:(0,o.jsx)(rc,{emptyDashboardProps:{onEditButtonClick:E,...n}})}),(0,o.jsx)(u.ChartsProvider,{chartsTheme:m,enablePinning:!1,enableSyncGrouping:!1,children:(0,o.jsx)(sK,{})}),(0,o.jsx)(sQ,{}),(0,o.jsx)(sT,{}),(0,o.jsx)(sk,{}),(0,o.jsx)(sM,{}),(0,o.jsx)(sL,{isReadonly:!y,disableMetadataEdition:!l}),(0,o.jsx)(s3,{}),d&&y&&(0,o.jsx)(sN,{original:w,current:v})]})]})};function lh(e){let{dashboardResource:t,datasourceApi:n,externalVariableDefinitions:r,emptyDashboardProps:i,isReadonly:a,isVariableEnabled:s,isDatasourceEnabled:l,disableShortcuts:c,isEditing:d,isCreating:p,isInitialVariableSticky:f,isLeavingConfirmDialogEnabled:g,dashboardTitleComponent:m,onSave:y,onDiscard:b,sx:v,...x}=e,{spec:w}=t,j=w.duration??"1h",S=w.refreshInterval??"0s",A=(0,P.useInitialTimeRange)(j),C=(0,P.useInitialRefreshInterval)(S),{data:E}=(0,P.usePluginBuiltinVariableDefinitions)(),D=(0,h.useMemo)(()=>{let e=[{kind:"BuiltinVariable",spec:{name:"__dashboard",value:()=>t.metadata.name,source:"Dashboard",display:{name:"__dashboard",description:"The name of the current dashboard",hidden:!0}}},{kind:"BuiltinVariable",spec:{name:"__project",value:()=>t.metadata.project,source:"Dashboard",display:{name:"__project",description:"The name of the current dashboard project",hidden:!0}}}];return E&&E.forEach(t=>e.push(t)),e},[t.metadata.name,t.metadata.project,E]);return(0,o.jsx)(s4,{dashboardResource:t,datasourceApi:n,children:(0,o.jsx)(ld,{initialState:{isEditMode:!!d,dashboardResource:t},children:(0,o.jsx)(P.TimeRangeProviderWithQueryParams,{initialTimeRange:A,initialRefreshInterval:C,children:(0,o.jsx)(nD,{initialVariableDefinitions:w.variables,externalVariableDefinitions:r,builtinVariableDefinitions:D,children:(0,o.jsx)(e_.A,{sx:(0,u.combineSx)({display:"flex",width:"100%",height:"100%",position:"relative",overflow:"hidden"},v),...x,children:(0,o.jsx)(u.ErrorBoundary,{FallbackComponent:u.ErrorAlert,children:(0,o.jsx)(lp,{dashboardResource:t,emptyDashboardProps:i,isReadonly:a,isVariableEnabled:s,isDatasourceEnabled:l,disableShortcuts:c,isCreating:p,isInitialVariableSticky:f,isLeavingConfirmDialogEnabled:g,dashboardTitleComponent:m,onSave:y,onDiscard:b})})})})})})})}},78784(e){function t(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=function e(t){var n,r,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t)){var a=t.length;for(n=0;n<a;n++)t[n]&&(r=e(t[n]))&&(i&&(i+=" "),i+=r)}else for(r in t)t[r]&&(i&&(i+=" "),i+=r);return i}(e))&&(r&&(r+=" "),r+=t);return r}e.exports=t,e.exports.clsx=t},90568(e,t){!function(e){"use strict";function t(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function n(e){return function(t,n,r,i){if(!t||!n||"object"!=typeof t||"object"!=typeof n)return e(t,n,r,i);var a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);var s=e(t,n,r,i);return i.delete(t),i.delete(n),s}}function r(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function i(e){return e.constructor===Object||null==e.constructor}function a(e){return"function"==typeof e.then}function o(e,t){return e===t||e!=e&&t!=t}var s=Object.prototype.toString;function l(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,l=e.areObjectsEqual,u=e.areRegExpsEqual,c=e.areSetsEqual,d=(0,e.createIsNestedEqual)(p);function p(e,p,f){if(e===p)return!0;if(!e||!p||"object"!=typeof e||"object"!=typeof p)return e!=e&&p!=p;if(i(e)&&i(p))return l(e,p,d,f);var h=Array.isArray(e),g=Array.isArray(p);if(h||g)return h===g&&t(e,p,d,f);var m=s.call(e);return m===s.call(p)&&("[object Date]"===m?n(e,p,d,f):"[object RegExp]"===m?u(e,p,d,f):"[object Map]"===m?r(e,p,d,f):"[object Set]"===m?c(e,p,d,f):"[object Object]"===m||"[object Arguments]"===m?!(a(e)||a(p))&&l(e,p,d,f):("[object Boolean]"===m||"[object Number]"===m||"[object String]"===m)&&o(e.valueOf(),p.valueOf()))}return p}function u(e,t,n,r){var i=e.length;if(t.length!==i)return!1;for(;i-- >0;)if(!n(e[i],t[i],i,i,e,t,r))return!1;return!0}var c=n(u);function d(e,t){return o(e.valueOf(),t.valueOf())}function p(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={},o=0;return e.forEach(function(s,l){if(i){var u=!1,c=0;t.forEach(function(i,d){!u&&!a[c]&&(u=n(l,d,o,c,e,t,r)&&n(s,i,l,d,e,t,r))&&(a[c]=!0),c++}),o++,i=u}}),i}var f=n(p),h=Object.prototype.hasOwnProperty;function g(e,t,n,r){var i,a=Object.keys(e),o=a.length;if(Object.keys(t).length!==o)return!1;for(;o-- >0;){if("_owner"===(i=a[o])){var s=!!e.$$typeof,l=!!t.$$typeof;if((s||l)&&s!==l)return!1}if(!h.call(t,i)||!n(e[i],t[i],i,i,e,t,r))return!1}return!0}var m=n(g);function y(e,t){return e.source===t.source&&e.flags===t.flags}function b(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={};return e.forEach(function(o,s){if(i){var l=!1,u=0;t.forEach(function(i,c){!l&&!a[u]&&(l=n(o,i,s,c,e,t,r))&&(a[u]=!0),u++}),i=l}}),i}var v=n(b),x=Object.freeze({areArraysEqual:u,areDatesEqual:d,areMapsEqual:p,areObjectsEqual:g,areRegExpsEqual:y,areSetsEqual:b,createIsNestedEqual:t}),w=Object.freeze({areArraysEqual:c,areDatesEqual:d,areMapsEqual:f,areObjectsEqual:m,areRegExpsEqual:y,areSetsEqual:v,createIsNestedEqual:t}),j=l(x),S=l(r(x,{createIsNestedEqual:function(){return o}})),A=l(w),C=l(r(w,{createIsNestedEqual:function(){return o}}));e.circularDeepEqual=function(e,t){return A(e,t,new WeakMap)},e.circularShallowEqual=function(e,t){return C(e,t,new WeakMap)},e.createCustomCircularEqual=function(e){var t=l(r(w,e(w)));return function(e,n,r){return void 0===r&&(r=new WeakMap),t(e,n,r)}},e.createCustomEqual=function(e){return l(r(x,e(x)))},e.deepEqual=function(e,t){return j(e,t,void 0)},e.sameValueZeroEqual=o,e.shallowEqual=function(e,t){return S(e,t,void 0)},Object.defineProperty(e,"__esModule",{value:!0})}(t)},74830(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z","AlertCircle")},35050(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M19.5,3.09L15,7.59V4H13V11H20V9H16.41L20.91,4.5L19.5,3.09M4,13V15H7.59L3.09,19.5L4.5,20.91L9,16.41V20H11V13H4Z","ArrowCollapse")},46001(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z","ArrowDown")},53493(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M10,21V19H6.41L10.91,14.5L9.5,13.09L5,17.59V14H3V21H10M14.5,10.91L19,6.41V10H21V3H14V5H17.59L13.09,9.5L14.5,10.91Z","ArrowExpand")},65168(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z","ArrowUp")},69525(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M22 5V7H19V10H17V7H14V5H17V2H19V5H22M19 19H5V5H11V3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V13H19V19M15 13V17H17V13H15M11 17H13V9H11V17M9 17V11H7V17H9Z","ChartBoxPlusOutline")},38990(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z","ChevronUp")},65707(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M8,3A2,2 0 0,0 6,5V9A2,2 0 0,1 4,11H3V13H4A2,2 0 0,1 6,15V19A2,2 0 0,0 8,21H10V19H8V14A2,2 0 0,0 6,12A2,2 0 0,0 8,10V5H10V3M16,3A2,2 0 0,1 18,5V9A2,2 0 0,0 20,11H21V13H20A2,2 0 0,0 18,15V19A2,2 0 0,1 16,21H14V19H16V14A2,2 0 0,1 18,12A2,2 0 0,1 16,10V5H14V3H16Z","CodeBraces")},50172(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z","ContentCopy")},30576(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M11,17H4A2,2 0 0,1 2,15V3A2,2 0 0,1 4,1H16V3H4V15H11V13L15,16L11,19V17M19,21V7H8V13H6V7A2,2 0 0,1 8,5H19A2,2 0 0,1 21,7V21A2,2 0 0,1 19,23H8A2,2 0 0,1 6,21V19H8V21H19Z","ContentDuplicate")},72795(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M18.68,12.32C16.92,10.56 14.07,10.57 12.32,12.33C10.56,14.09 10.56,16.94 12.32,18.69C13.81,20.17 16.11,20.43 17.89,19.32L21,22.39L22.39,21L19.3,17.89C20.43,16.12 20.17,13.8 18.68,12.32M17.27,17.27C16.29,18.25 14.71,18.24 13.73,17.27C12.76,16.29 12.76,14.71 13.74,13.73C14.71,12.76 16.29,12.76 17.27,13.73C18.24,14.71 18.24,16.29 17.27,17.27M10.9,20.1C10.25,19.44 9.74,18.65 9.42,17.78C6.27,17.25 4,15.76 4,14V17C4,19.21 7.58,21 12,21V21C11.6,20.74 11.23,20.44 10.9,20.1M4,9V12C4,13.68 6.07,15.12 9,15.7C9,15.63 9,15.57 9,15.5C9,14.57 9.2,13.65 9.58,12.81C6.34,12.3 4,10.79 4,9M12,3C7.58,3 4,4.79 4,7C4,9 7,10.68 10.85,11H10.9C12.1,9.74 13.76,9 15.5,9C16.41,9 17.31,9.19 18.14,9.56C19.17,9.09 19.87,8.12 20,7C20,4.79 16.42,3 12,3Z","DatabaseSearch")},97090(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M13,5V11H14.17L12,13.17L9.83,11H11V5H13M15,3H9V9H5L12,16L19,9H15V3M19,18H5V20H19V18Z","DownloadOutline")},61318(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M9,3H11V5H9V3M13,3H15V5H13V3M9,7H11V9H9V7M13,7H15V9H13V7M9,11H11V13H9V11M13,11H15V13H13V11M9,15H11V17H9V15M13,15H15V17H13V15M9,19H11V21H9V19M13,19H15V21H13V19Z","DragVertical")},65241(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z","Launch")},66081(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M11 15H6L13 1V9H18L11 23V15Z","LightningBolt")},14637(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z","Menu")},49603(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z","Pencil")},59909(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M14.06,9L15,9.94L5.92,19H5V18.08L14.06,9M17.66,3C17.41,3 17.15,3.1 16.96,3.29L15.13,5.12L18.88,8.87L20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18.17,3.09 17.92,3 17.66,3M14.06,6.19L3,17.25V21H6.75L17.81,9.94L14.06,6.19Z","PencilOutline")},80154(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M8,6.2V4H7V2H17V4H16V12L18,14V16H17.8L14,12.2V4H10V8.2L8,6.2M20,20.7L18.7,22L12.8,16.1V22H11.2V16H6V14L8,12V11.3L2,5.3L3.3,4L20,20.7M8.8,14H10.6L9.7,13.1L8.8,14Z","PinOffOutline")},2859(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M19,19V5H5V19H19M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5C3,3.89 3.9,3 5,3H19M11,7H13V11H17V13H13V17H11V13H7V11H11V7Z","PlusBoxOutline")},4150(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(1448))&&r.__esModule?r:{default:r}).default)("M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M9,8H11V17H9V8M13,8H15V17H13V8Z","TrashCan")},9111(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return c.default}}),t.default=void 0;var r=f(n(70451)),i=p(n(62688)),a=p(n(20231)),o=n(78784),s=n(32837),l=n(10402),u=n(26732),c=p(n(11060)),d=p(n(57988));function p(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if("function"==typeof WeakMap)var n=new WeakMap,r=new WeakMap;return(f=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)"default"!==t&&({}).hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function h(){return(h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}function g(e,t,n){var r;return(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class m extends r.Component{static getDerivedStateFromProps(e,t){let{position:n}=e,{prevPropsPosition:r}=t;return n&&(!r||n.x!==r.x||n.y!==r.y)?((0,d.default)("Draggable: getDerivedStateFromProps %j",{position:n,prevPropsPosition:r}),{x:n.x,y:n.y,prevPropsPosition:{...n}}):null}constructor(e){super(e),g(this,"onDragStart",(e,t)=>{if((0,d.default)("Draggable: onDragStart: %j",t),!1===this.props.onStart(e,(0,l.createDraggableData)(this,t)))return!1;this.setState({dragging:!0,dragged:!0})}),g(this,"onDrag",(e,t)=>{if(!this.state.dragging)return!1;(0,d.default)("Draggable: onDrag: %j",t);let n=(0,l.createDraggableData)(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=(0,l.getBoundPosition)(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(!1===this.props.onDrag(e,n))return!1;this.setState(r)}),g(this,"onDragStop",(e,t)=>{if(!this.state.dragging||!1===this.props.onStop(e,(0,l.createDraggableData)(this,t)))return!1;(0,d.default)("Draggable: onDragStop: %j",t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)}),this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){void 0!==window.SVGElement&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){return this.props?.nodeRef?.current??a.default.findDOMNode(this)}render(){let{axis:e,bounds:t,children:n,defaultPosition:i,defaultClassName:a,defaultClassNameDragging:u,defaultClassNameDragged:d,position:p,positionOffset:f,scale:g,...m}=this.props,y={},b=null,v=!p||this.state.dragging,x=p||i,w={x:(0,l.canDragX)(this)&&v?this.state.x:x.x,y:(0,l.canDragY)(this)&&v?this.state.y:x.y};this.state.isElementSVG?b=(0,s.createSVGTransform)(w,f):y=(0,s.createCSSTransform)(w,f);let j=(0,o.clsx)(n.props.className||"",a,{[u]:this.state.dragging,[d]:this.state.dragged});return r.createElement(c.default,h({},m,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),r.cloneElement(r.Children.only(n),{className:j,style:{...n.props.style,...y},transform:b}))}}t.default=m,g(m,"displayName","Draggable"),g(m,"propTypes",{...c.default.propTypes,axis:i.default.oneOf(["both","x","y","none"]),bounds:i.default.oneOfType([i.default.shape({left:i.default.number,right:i.default.number,top:i.default.number,bottom:i.default.number}),i.default.string,i.default.oneOf([!1])]),defaultClassName:i.default.string,defaultClassNameDragging:i.default.string,defaultClassNameDragged:i.default.string,defaultPosition:i.default.shape({x:i.default.number,y:i.default.number}),positionOffset:i.default.shape({x:i.default.oneOfType([i.default.number,i.default.string]),y:i.default.oneOfType([i.default.number,i.default.string])}),position:i.default.shape({x:i.default.number,y:i.default.number}),className:u.dontSetMe,style:u.dontSetMe,transform:u.dontSetMe}),g(m,"defaultProps",{...c.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})},11060(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=d(n(70451)),i=c(n(62688)),a=c(n(20231)),o=n(32837),s=n(10402),l=n(26732),u=c(n(57988));function c(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if("function"==typeof WeakMap)var n=new WeakMap,r=new WeakMap;return(d=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)"default"!==t&&({}).hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function p(e,t,n){var r;return(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let f={start:"touchstart",move:"touchmove",stop:"touchend"},h={start:"mousedown",move:"mousemove",stop:"mouseup"},g=h;class m extends r.Component{constructor(){super(...arguments),p(this,"dragging",!1),p(this,"lastX",NaN),p(this,"lastY",NaN),p(this,"touchIdentifier",null),p(this,"mounted",!1),p(this,"handleDragStart",e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&"number"==typeof e.button&&0!==e.button)return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error("<DraggableCore> not mounted on DragStart!");let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!(0,o.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,o.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;"touchstart"!==e.type||this.props.allowMobileScroll||e.preventDefault();let r=(0,o.getTouchIdentifier)(e);this.touchIdentifier=r;let i=(0,s.getControlPosition)(e,r,this);if(null==i)return;let{x:a,y:l}=i,c=(0,s.createCoreData)(this,a,l);(0,u.default)("DraggableCore: handleDragStart: %j",c),(0,u.default)("calling",this.props.onStart),!1!==this.props.onStart(e,c)&&!1!==this.mounted&&(this.props.enableUserSelectHack&&(0,o.addUserSelectStyles)(n),this.dragging=!0,this.lastX=a,this.lastY=l,(0,o.addEvent)(n,g.move,this.handleDrag),(0,o.addEvent)(n,g.stop,this.handleDragStop))}),p(this,"handleDrag",e=>{let t=(0,s.getControlPosition)(e,this.touchIdentifier,this);if(null==t)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=(0,s.snapToGrid)(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=(0,s.createCoreData)(this,n,r);if((0,u.default)("DraggableCore: handleDrag: %j",i),!1===this.props.onDrag(e,i)||!1===this.mounted){try{this.handleDragStop(new MouseEvent("mouseup"))}catch(t){let e=document.createEvent("MouseEvents");e.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r}),p(this,"handleDragStop",e=>{if(!this.dragging)return;let t=(0,s.getControlPosition)(e,this.touchIdentifier,this);if(null==t)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=(0,s.snapToGrid)(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=(0,s.createCoreData)(this,n,r);if(!1===this.props.onStop(e,i)||!1===this.mounted)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&(0,o.scheduleRemoveUserSelectStyles)(a.ownerDocument),(0,u.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&((0,u.default)("DraggableCore: Removing handlers"),(0,o.removeEvent)(a.ownerDocument,g.move,this.handleDrag),(0,o.removeEvent)(a.ownerDocument,g.stop,this.handleDragStop))}),p(this,"onMouseDown",e=>(g=h,this.handleDragStart(e))),p(this,"onMouseUp",e=>(g=h,this.handleDragStop(e))),p(this,"onTouchStart",e=>(g=f,this.handleDragStart(e))),p(this,"onTouchEnd",e=>(g=f,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&(0,o.addEvent)(e,f.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;(0,o.removeEvent)(t,h.move,this.handleDrag),(0,o.removeEvent)(t,f.move,this.handleDrag),(0,o.removeEvent)(t,h.stop,this.handleDragStop),(0,o.removeEvent)(t,f.stop,this.handleDragStop),(0,o.removeEvent)(e,f.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,o.scheduleRemoveUserSelectStyles)(t)}}findDOMNode(){return this.props?.nodeRef?this.props?.nodeRef?.current:a.default.findDOMNode(this)}render(){return r.cloneElement(r.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}t.default=m,p(m,"displayName","DraggableCore"),p(m,"propTypes",{allowAnyClick:i.default.bool,allowMobileScroll:i.default.bool,children:i.default.node.isRequired,disabled:i.default.bool,enableUserSelectHack:i.default.bool,offsetParent:function(e,t){if(e[t]&&1!==e[t].nodeType)throw Error("Draggable's offsetParent must be a DOM Node.")},grid:i.default.arrayOf(i.default.number),handle:i.default.string,cancel:i.default.string,nodeRef:i.default.object,onStart:i.default.func,onDrag:i.default.func,onStop:i.default.func,onMouseDown:i.default.func,scale:i.default.number,className:l.dontSetMe,style:l.dontSetMe,transform:l.dontSetMe}),p(m,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1})},38230(e,t,n){"use strict";let{default:r,DraggableCore:i}=n(9111);e.exports=r,e.exports.default=r,e.exports.DraggableCore=i},32837(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addClassName=c,t.addEvent=function(e,t,n,r){if(!e)return;let i={capture:!0,...r};e.addEventListener?e.addEventListener(t,n,i):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n},t.addUserSelectStyles=function(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||((t=e.createElement("style")).type="text/css",t.id="react-draggable-style-el",t.innerHTML=".react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n",t.innerHTML+=".react-draggable-transparent-selection *::selection {all: inherit;}\n",e.getElementsByTagName("head")[0].appendChild(t)),e.body&&c(e.body,"react-draggable-transparent-selection")},t.createCSSTransform=function(e,t){let n=l(e,t,"px");return{[(0,i.browserPrefixToKey)("transform",i.default)]:n}},t.createSVGTransform=function(e,t){return l(e,t,"")},t.getTouch=function(e,t){return e.targetTouches&&(0,r.findInArray)(e.targetTouches,e=>t===e.identifier)||e.changedTouches&&(0,r.findInArray)(e.changedTouches,e=>t===e.identifier)},t.getTouchIdentifier=function(e){return e.targetTouches&&e.targetTouches[0]?e.targetTouches[0].identifier:e.changedTouches&&e.changedTouches[0]?e.changedTouches[0].identifier:void 0},t.getTranslation=l,t.innerHeight=function(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,r.int)(n.paddingTop),t-=(0,r.int)(n.paddingBottom)},t.innerWidth=function(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,r.int)(n.paddingLeft),t-=(0,r.int)(n.paddingRight)},t.matchesSelector=s,t.matchesSelectorAndParentsTo=function(e,t,n){let r=e;do{if(s(r,t))return!0;if(r===n)break;r=r.parentNode}while(r);return!1},t.offsetXYFromParent=function(e,t,n){let r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect();return{x:(e.clientX+t.scrollLeft-r.left)/n,y:(e.clientY+t.scrollTop-r.top)/n}},t.outerHeight=function(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,r.int)(n.borderTopWidth),t+=(0,r.int)(n.borderBottomWidth)},t.outerWidth=function(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,r.int)(n.borderLeftWidth),t+=(0,r.int)(n.borderRightWidth)},t.removeClassName=d,t.removeEvent=function(e,t,n,r){if(!e)return;let i={capture:!0,...r};e.removeEventListener?e.removeEventListener(t,n,i):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null},t.scheduleRemoveUserSelectStyles=function(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{u(e)}):u(e)};var r=n(26732),i=a(n(47350));function a(e,t){if("function"==typeof WeakMap)var n=new WeakMap,r=new WeakMap;return(a=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)"default"!==t&&({}).hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}let o="";function s(e,t){return o||(o=(0,r.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(t){return(0,r.isFunction)(e[t])})),!!(0,r.isFunction)(e[o])&&e[o](t)}function l(e,t,n){let{x:r,y:i}=e,a=`translate(${r}${n},${i}${n})`;if(t){let e=`${"string"==typeof t.x?t.x:t.x+n}`,r=`${"string"==typeof t.y?t.y:t.y+n}`;a=`translate(${e}, ${r})`+a}return a}function u(e){if(e)try{if(e.body&&d(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{let t=(e.defaultView||window).getSelection();t&&"Caret"!==t.type&&t.removeAllRanges()}}catch(e){}}function c(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function d(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,"g"),"")}},47350(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.browserPrefixToKey=i,t.browserPrefixToStyle=function(e,t){return t?`-${t.toLowerCase()}-${e}`:e},t.default=void 0,t.getPrefix=r;let n=["Moz","Webkit","O","ms"];function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"transform";if("u"<typeof window)return"";let t=window.document?.documentElement?.style;if(!t||e in t)return"";for(let r=0;r<n.length;r++)if(i(e,n[r])in t)return n[r];return""}function i(e,t){return t?`${t}${function(e){let t="",n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):"-"===e[r]?n=!0:t+=e[r];return t}(e)}`:e}t.default=r()},57988(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){}},10402(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.canDragX=function(e){return"both"===e.props.axis||"x"===e.props.axis},t.canDragY=function(e){return"both"===e.props.axis||"y"===e.props.axis},t.createCoreData=function(e,t,n){let i=!(0,r.isNum)(e.lastX),o=a(e);return i?{node:o,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:o,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}},t.createDraggableData=function(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}},t.getBoundPosition=function(e,t,n){var o;if(!e.props.bounds)return[t,n];let{bounds:s}=e.props;s="string"==typeof s?s:{left:(o=s).left,top:o.top,right:o.right,bottom:o.bottom};let l=a(e);if("string"==typeof s){let e,{ownerDocument:t}=l,n=t.defaultView;if(!((e="parent"===s?l.parentNode:l.getRootNode().querySelector(s))instanceof n.HTMLElement))throw Error('Bounds selector "'+s+'" could not find an element.');let a=n.getComputedStyle(l),o=n.getComputedStyle(e);s={left:-l.offsetLeft+(0,r.int)(o.paddingLeft)+(0,r.int)(a.marginLeft),top:-l.offsetTop+(0,r.int)(o.paddingTop)+(0,r.int)(a.marginTop),right:(0,i.innerWidth)(e)-(0,i.outerWidth)(l)-l.offsetLeft+(0,r.int)(o.paddingRight)-(0,r.int)(a.marginRight),bottom:(0,i.innerHeight)(e)-(0,i.outerHeight)(l)-l.offsetTop+(0,r.int)(o.paddingBottom)-(0,r.int)(a.marginBottom)}}return(0,r.isNum)(s.right)&&(t=Math.min(t,s.right)),(0,r.isNum)(s.bottom)&&(n=Math.min(n,s.bottom)),(0,r.isNum)(s.left)&&(t=Math.max(t,s.left)),(0,r.isNum)(s.top)&&(n=Math.max(n,s.top)),[t,n]},t.getControlPosition=function(e,t,n){let r="number"==typeof t?(0,i.getTouch)(e,t):null;if("number"==typeof t&&!r)return null;let o=a(n),s=n.props.offsetParent||o.offsetParent||o.ownerDocument.body;return(0,i.offsetXYFromParent)(r||e,s,n.props.scale)},t.snapToGrid=function(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]};var r=n(26732),i=n(32837);function a(e){let t=e.findDOMNode();if(!t)throw Error("<DraggableCore>: Unmounted during event!");return t}},26732(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dontSetMe=function(e,t,n){if(e[t])return Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)},t.findInArray=function(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]},t.int=function(e){return parseInt(e,10)},t.isFunction=function(e){return"function"==typeof e||"[object Function]"===Object.prototype.toString.call(e)},t.isNum=function(e){return"number"==typeof e&&!isNaN(e)}},18100(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=p(n(70451)),i=n(20231),a=p(n(62688)),o=n(38230),s=n(50936),l=n(20414),u=n(20906),c=n(47222),d=p(n(78784));function p(e){return e&&e.__esModule?e:{default:e}}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach(function(t){g(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function g(e,t,n){var r;return(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class m extends r.default.Component{constructor(){super(...arguments),g(this,"state",{resizing:null,dragging:null,className:""}),g(this,"elementRef",r.default.createRef()),g(this,"onDragStart",(e,t)=>{let{node:n}=t,{onDragStart:r,transformScale:i}=this.props;if(!r)return;let a={top:0,left:0},{offsetParent:o}=n;if(!o)return;let s=o.getBoundingClientRect(),l=n.getBoundingClientRect(),c=l.left/i,d=s.left/i,p=l.top/i,f=s.top/i;a.left=c-d+o.scrollLeft,a.top=p-f+o.scrollTop,this.setState({dragging:a});let{x:h,y:g}=(0,u.calcXY)(this.getPositionParams(),a.top,a.left,this.props.w,this.props.h);return r.call(this,this.props.i,h,g,{e,node:n,newPosition:a})}),g(this,"onDrag",(e,t,n)=>{let{node:r,deltaX:a,deltaY:o}=t,{onDrag:s}=this.props;if(!s)return;if(!this.state.dragging)throw Error("onDrag called before onDragStart.");let l=this.state.dragging.top+o,c=this.state.dragging.left+a,{isBounded:d,i:p,w:f,h,containerWidth:g}=this.props,m=this.getPositionParams();if(d){let{offsetParent:e}=r;if(e){let{margin:t,rowHeight:n}=this.props,r=e.clientHeight-(0,u.calcGridItemWHPx)(h,n,t[1]);l=(0,u.clamp)(l,0,r);let i=(0,u.calcGridColWidth)(m),a=g-(0,u.calcGridItemWHPx)(f,i,t[0]);c=(0,u.clamp)(c,0,a)}}let y={top:l,left:c};n?this.setState({dragging:y}):(0,i.flushSync)(()=>{this.setState({dragging:y})});let{x:b,y:v}=(0,u.calcXY)(m,l,c,f,h);return s.call(this,p,b,v,{e,node:r,newPosition:y})}),g(this,"onDragStop",(e,t)=>{let{node:n}=t,{onDragStop:r}=this.props;if(!r)return;if(!this.state.dragging)throw Error("onDragEnd called before onDragStart.");let{w:i,h:a,i:o}=this.props,{left:s,top:l}=this.state.dragging;this.setState({dragging:null});let{x:c,y:d}=(0,u.calcXY)(this.getPositionParams(),l,s,i,a);return r.call(this,o,c,d,{e,node:n,newPosition:{top:l,left:s}})}),g(this,"onResizeStop",(e,t,n)=>this.onResizeHandler(e,t,n,"onResizeStop")),g(this,"onResizeStart",(e,t,n)=>this.onResizeHandler(e,t,n,"onResizeStart")),g(this,"onResize",(e,t,n)=>this.onResizeHandler(e,t,n,"onResize"))}shouldComponentUpdate(e,t){if(this.props.children!==e.children||this.props.droppingPosition!==e.droppingPosition)return!0;let n=(0,u.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),r=(0,u.calcGridItemPosition)(this.getPositionParams(e),e.x,e.y,e.w,e.h,t);return!(0,l.fastPositionEqual)(n,r)||this.props.useCSSTransforms!==e.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(e){this.moveDroppingItem(e)}moveDroppingItem(e){let{droppingPosition:t}=this.props;if(!t)return;let n=this.elementRef.current;if(!n)return;let r=e.droppingPosition||{left:0,top:0},{dragging:i}=this.state,a=i&&t.left!==r.left||t.top!==r.top;if(i){if(a){let e=t.left-i.left,r=t.top-i.top;this.onDrag(t.e,{node:n,deltaX:e,deltaY:r},!0)}}else this.onDragStart(t.e,{node:n,deltaX:t.left,deltaY:t.top})}getPositionParams(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;return{cols:e.cols,containerPadding:e.containerPadding,containerWidth:e.containerWidth,margin:e.margin,maxRows:e.maxRows,rowHeight:e.rowHeight}}createStyle(e){let t,{usePercentages:n,containerWidth:r,useCSSTransforms:i}=this.props;return i?t=(0,l.setTransform)(e):(t=(0,l.setTopLeft)(e),n&&(t.left=(0,l.perc)(e.left/r),t.width=(0,l.perc)(e.width/r))),t}mixinDraggable(e,t){return r.default.createElement(o.DraggableCore,{disabled:!t,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:".react-resizable-handle"+(this.props.cancel?","+this.props.cancel:""),scale:this.props.transformScale,nodeRef:this.elementRef},e)}curryResizeHandler(e,t){return(n,r)=>t(n,r,e)}mixinResizable(e,t,n){let{cols:i,minW:a,minH:o,maxW:l,maxH:c,transformScale:d,resizeHandles:p,resizeHandle:f}=this.props,h=this.getPositionParams(),g=(0,u.calcGridItemPosition)(h,0,0,i,0).width,m=(0,u.calcGridItemPosition)(h,0,0,a,o),y=(0,u.calcGridItemPosition)(h,0,0,l,c),b=[m.width,m.height],v=[Math.min(y.width,g),Math.min(y.height,1/0)];return r.default.createElement(s.Resizable,{draggableOpts:{disabled:!n},className:n?void 0:"react-resizable-hide",width:t.width,height:t.height,minConstraints:b,maxConstraints:v,onResizeStop:this.curryResizeHandler(t,this.onResizeStop),onResizeStart:this.curryResizeHandler(t,this.onResizeStart),onResize:this.curryResizeHandler(t,this.onResize),transformScale:d,resizeHandles:p,handle:f},e)}onResizeHandler(e,t,n,r){let{node:a,size:o,handle:s}=t,c=this.props[r];if(!c)return;let{x:d,y:p,i:f,maxH:h,minH:g,containerWidth:m}=this.props,{minW:y,maxW:b}=this.props,v=o;a&&(v=(0,l.resizeItemInDirection)(s,n,o,m),(0,i.flushSync)(()=>{this.setState({resizing:"onResizeStop"===r?null:v})}));let{w:x,h:w}=(0,u.calcWH)(this.getPositionParams(),v.width,v.height,d,p,s);x=(0,u.clamp)(x,Math.max(y,1),b),w=(0,u.clamp)(w,g,h),c.call(this,f,x,w,{e,node:a,size:v,handle:s})}render(){let{x:e,y:t,w:n,h:i,isDraggable:a,isResizable:o,droppingPosition:s,useCSSTransforms:l}=this.props,c=(0,u.calcGridItemPosition)(this.getPositionParams(),e,t,n,i,this.state),p=r.default.Children.only(this.props.children),f=r.default.cloneElement(p,{ref:this.elementRef,className:(0,d.default)("react-grid-item",p.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":a,"react-draggable-dragging":!!this.state.dragging,dropping:!!s,cssTransforms:l}),style:h(h(h({},this.props.style),p.props.style),this.createStyle(c))});return f=this.mixinResizable(f,c,o),f=this.mixinDraggable(f,a)}}t.default=m,g(m,"propTypes",{children:a.default.element,cols:a.default.number.isRequired,containerWidth:a.default.number.isRequired,rowHeight:a.default.number.isRequired,margin:a.default.array.isRequired,maxRows:a.default.number.isRequired,containerPadding:a.default.array.isRequired,x:a.default.number.isRequired,y:a.default.number.isRequired,w:a.default.number.isRequired,h:a.default.number.isRequired,minW:function(e,t){let n=e[t];return"number"!=typeof n?Error("minWidth not Number"):n>e.w||n>e.maxW?Error("minWidth larger than item width/maxWidth"):void 0},maxW:function(e,t){let n=e[t];return"number"!=typeof n?Error("maxWidth not Number"):n<e.w||n<e.minW?Error("maxWidth smaller than item width/minWidth"):void 0},minH:function(e,t){let n=e[t];return"number"!=typeof n?Error("minHeight not Number"):n>e.h||n>e.maxH?Error("minHeight larger than item height/maxHeight"):void 0},maxH:function(e,t){let n=e[t];return"number"!=typeof n?Error("maxHeight not Number"):n<e.h||n<e.minH?Error("maxHeight smaller than item height/minHeight"):void 0},i:a.default.string.isRequired,resizeHandles:c.resizeHandleAxesType,resizeHandle:c.resizeHandleType,onDragStop:a.default.func,onDragStart:a.default.func,onDrag:a.default.func,onResizeStop:a.default.func,onResizeStart:a.default.func,onResize:a.default.func,isDraggable:a.default.bool.isRequired,isResizable:a.default.bool.isRequired,isBounded:a.default.bool.isRequired,static:a.default.bool,useCSSTransforms:a.default.bool.isRequired,transformScale:a.default.number,className:a.default.string,handle:a.default.string,cancel:a.default.string,droppingPosition:a.default.shape({e:a.default.object.isRequired,left:a.default.number.isRequired,top:a.default.number.isRequired})}),g(m,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1})},59482(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=d(n(70451)),i=n(90568),a=c(n(78784)),o=n(20414),s=n(20906),l=c(n(18100)),u=c(n(47222));function c(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if("function"==typeof WeakMap)var n=new WeakMap,r=new WeakMap;return(d=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)"default"!==t&&({}).hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function h(e,t,n){var r;return(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let g="react-grid-layout",m=!1;try{m=/firefox/i.test(navigator.userAgent)}catch(e){}class y extends r.Component{constructor(){super(...arguments),h(this,"state",{activeDrag:null,layout:(0,o.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,o.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),h(this,"dragEnterCounter",0),h(this,"onDragStart",(e,t,n,r)=>{let{e:i,node:a}=r,{layout:s}=this.state,l=(0,o.getLayoutItem)(s,e);if(!l)return;let u={w:l.w,h:l.h,x:l.x,y:l.y,placeholder:!0,i:e};return this.setState({oldDragItem:(0,o.cloneLayoutItem)(l),oldLayout:s,activeDrag:u}),this.props.onDragStart(s,l,l,null,i,a)}),h(this,"onDrag",(e,t,n,r)=>{let{e:i,node:a}=r,{oldDragItem:s}=this.state,{layout:l}=this.state,{cols:u,allowOverlap:c,preventCollision:d}=this.props,p=(0,o.getLayoutItem)(l,e);if(!p)return;let f={w:p.w,h:p.h,x:p.x,y:p.y,placeholder:!0,i:e};l=(0,o.moveElement)(l,p,t,n,!0,d,(0,o.compactType)(this.props),u,c),this.props.onDrag(l,s,p,f,i,a),this.setState({layout:c?l:(0,o.compact)(l,(0,o.compactType)(this.props),u),activeDrag:f})}),h(this,"onDragStop",(e,t,n,r)=>{let{e:i,node:a}=r;if(!this.state.activeDrag)return;let{oldDragItem:s}=this.state,{layout:l}=this.state,{cols:u,preventCollision:c,allowOverlap:d}=this.props,p=(0,o.getLayoutItem)(l,e);if(!p)return;l=(0,o.moveElement)(l,p,t,n,!0,c,(0,o.compactType)(this.props),u,d);let f=d?l:(0,o.compact)(l,(0,o.compactType)(this.props),u);this.props.onDragStop(f,s,p,null,i,a);let{oldLayout:h}=this.state;this.setState({activeDrag:null,layout:f,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(f,h)}),h(this,"onResizeStart",(e,t,n,r)=>{let{e:i,node:a}=r,{layout:s}=this.state,l=(0,o.getLayoutItem)(s,e);l&&(this.setState({oldResizeItem:(0,o.cloneLayoutItem)(l),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(s,l,l,null,i,a))}),h(this,"onResize",(e,t,n,r)=>{let i,a,s,{e:l,node:u,size:c,handle:d}=r,{oldResizeItem:p}=this.state,{layout:h}=this.state,{cols:g,preventCollision:m,allowOverlap:y}=this.props,b=!1,[v,x]=(0,o.withLayoutItem)(h,e,e=>(a=e.x,s=e.y,-1!==["sw","w","nw","n","ne"].indexOf(d)&&(-1!==["sw","nw","w"].indexOf(d)&&(a=e.x+(e.w-t),t=e.x!==a&&a<0?e.w:t,a=a<0?0:a),-1!==["ne","n","nw"].indexOf(d)&&(s=e.y+(e.h-n),n=e.y!==s&&s<0?e.h:n,s=s<0?0:s),b=!0),m&&!y&&(0,o.getAllCollisions)(h,f(f({},e),{},{w:t,h:n,x:a,y:s})).filter(t=>t.i!==e.i).length>0&&(s=e.y,n=e.h,a=e.x,t=e.w,b=!1),e.w=t,e.h=n,e));if(!x)return;i=v,b&&(i=(0,o.moveElement)(v,x,a,s,!0,this.props.preventCollision,(0,o.compactType)(this.props),g,y));let w={w:x.w,h:x.h,x:x.x,y:x.y,static:!0,i:e};this.props.onResize(i,p,x,w,l,u),this.setState({layout:y?i:(0,o.compact)(i,(0,o.compactType)(this.props),g),activeDrag:w})}),h(this,"onResizeStop",(e,t,n,r)=>{let{e:i,node:a}=r,{layout:s,oldResizeItem:l}=this.state,{cols:u,allowOverlap:c}=this.props,d=(0,o.getLayoutItem)(s,e),p=c?s:(0,o.compact)(s,(0,o.compactType)(this.props),u);this.props.onResizeStop(p,l,d,null,i,a);let{oldLayout:f}=this.state;this.setState({activeDrag:null,layout:p,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(p,f)}),h(this,"onDragOver",e=>{var t;if(e.preventDefault(),e.stopPropagation(),m&&!(null!=(t=e.nativeEvent.target)&&t.classList.contains(g)))return!1;let{droppingItem:n,onDropDragOver:i,margin:a,cols:o,rowHeight:l,maxRows:u,width:c,containerPadding:d,transformScale:p}=this.props,h=null==i?void 0:i(e);if(!1===h)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;let y=f(f({},n),h),{layout:b}=this.state,v=e.currentTarget.getBoundingClientRect(),x=e.clientX-v.left,w=e.clientY-v.top,j={left:x/p,top:w/p,e};if(this.state.droppingDOMNode){if(this.state.droppingPosition){let{left:e,top:t}=this.state.droppingPosition;(e!=x||t!=w)&&this.setState({droppingPosition:j})}}else{let e=(0,s.calcXY)({cols:o,margin:a,maxRows:u,rowHeight:l,containerWidth:c,containerPadding:d||a},w,x,y.w,y.h);this.setState({droppingDOMNode:r.createElement("div",{key:y.i}),droppingPosition:j,layout:[...b,f(f({},y),{},{x:e.x,y:e.y,static:!1,isDraggable:!0})]})}}),h(this,"removeDroppingPlaceholder",()=>{let{droppingItem:e,cols:t}=this.props,{layout:n}=this.state,r=(0,o.compact)(n.filter(t=>t.i!==e.i),(0,o.compactType)(this.props),t,this.props.allowOverlap);this.setState({layout:r,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),h(this,"onDragLeave",e=>{e.preventDefault(),e.stopPropagation(),this.dragEnterCounter--,0===this.dragEnterCounter&&this.removeDroppingPlaceholder()}),h(this,"onDragEnter",e=>{e.preventDefault(),e.stopPropagation(),this.dragEnterCounter++}),h(this,"onDrop",e=>{e.preventDefault(),e.stopPropagation();let{droppingItem:t}=this.props,{layout:n}=this.state,r=n.find(e=>e.i===t.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(n,r,e)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(e,t){let n;return t.activeDrag?null:((0,i.deepEqual)(e.layout,t.propsLayout)&&e.compactType===t.compactType?(0,o.childrenEqual)(e.children,t.children)||(n=t.layout):n=e.layout,n)?{layout:(0,o.synchronizeLayoutWithChildren)(n,e.children,e.cols,(0,o.compactType)(e),e.allowOverlap),compactType:e.compactType,children:e.children,propsLayout:e.layout}:null}shouldComponentUpdate(e,t){return this.props.children!==e.children||!(0,o.fastRGLPropsEqual)(this.props,e,i.deepEqual)||this.state.activeDrag!==t.activeDrag||this.state.mounted!==t.mounted||this.state.droppingPosition!==t.droppingPosition}componentDidUpdate(e,t){if(!this.state.activeDrag){let e=this.state.layout,n=t.layout;this.onLayoutMaybeChanged(e,n)}}containerHeight(){if(!this.props.autoSize)return;let e=(0,o.bottom)(this.state.layout),t=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return e*this.props.rowHeight+(e-1)*this.props.margin[1]+2*t+"px"}onLayoutMaybeChanged(e,t){t||(t=this.state.layout),(0,i.deepEqual)(t,e)||this.props.onLayoutChange(e)}placeholder(){let{activeDrag:e}=this.state;if(!e)return null;let{width:t,cols:n,margin:i,containerPadding:a,rowHeight:o,maxRows:s,useCSSTransforms:u,transformScale:c}=this.props;return r.createElement(l.default,{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,className:"react-grid-placeholder ".concat(this.state.resizing?"placeholder-resizing":""),containerWidth:t,cols:n,margin:i,containerPadding:a||i,maxRows:s,rowHeight:o,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:u,transformScale:c},r.createElement("div",null))}processGridItem(e,t){if(!e||!e.key)return;let n=(0,o.getLayoutItem)(this.state.layout,String(e.key));if(!n)return null;let{width:i,cols:a,margin:s,containerPadding:u,rowHeight:c,maxRows:d,isDraggable:p,isResizable:f,isBounded:h,useCSSTransforms:g,transformScale:m,draggableCancel:y,draggableHandle:b,resizeHandles:v,resizeHandle:x}=this.props,{mounted:w,droppingPosition:j}=this.state,S="boolean"==typeof n.isDraggable?n.isDraggable:!n.static&&p,A="boolean"==typeof n.isResizable?n.isResizable:!n.static&&f,C=n.resizeHandles||v,E=S&&h&&!1!==n.isBounded;return r.createElement(l.default,{containerWidth:i,cols:a,margin:s,containerPadding:u||s,maxRows:d,rowHeight:c,cancel:y,handle:b,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:S,isResizable:A,isBounded:E,useCSSTransforms:g&&w,usePercentages:!w,transformScale:m,w:n.w,h:n.h,x:n.x,y:n.y,i:n.i,minH:n.minH,minW:n.minW,maxH:n.maxH,maxW:n.maxW,static:n.static,droppingPosition:t?j:void 0,resizeHandles:C,resizeHandle:x},e)}render(){let{className:e,style:t,isDroppable:n,innerRef:i}=this.props,s=(0,a.default)(g,e),l=f({height:this.containerHeight()},t);return r.createElement("div",{ref:i,className:s,style:l,onDrop:n?this.onDrop:o.noop,onDragLeave:n?this.onDragLeave:o.noop,onDragEnter:n?this.onDragEnter:o.noop,onDragOver:n?this.onDragOver:o.noop},r.Children.map(this.props.children,e=>this.processGridItem(e)),n&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}}t.default=y,h(y,"displayName","ReactGridLayout"),h(y,"propTypes",u.default),h(y,"defaultProps",{autoSize:!0,cols:12,className:"",style:{},draggableHandle:"",draggableCancel:"",containerPadding:null,rowHeight:150,maxRows:1/0,layout:[],margin:[10,10],isBounded:!1,isDraggable:!0,isResizable:!0,allowOverlap:!1,isDroppable:!1,useCSSTransforms:!0,transformScale:1,verticalCompact:!0,compactType:"vertical",preventCollision:!1,droppingItem:{i:"__dropping-elem__",h:1,w:1},resizeHandles:["se"],onLayoutChange:o.noop,onDragStart:o.noop,onDrag:o.noop,onDragStop:o.noop,onResizeStart:o.noop,onResize:o.noop,onResizeStop:o.noop,onDrop:o.noop,onDropDragOver:o.noop})},47222(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resizeHandleType=t.resizeHandleAxesType=t.default=void 0;var r=a(n(62688)),i=a(n(70451));function a(e){return e&&e.__esModule?e:{default:e}}let o=t.resizeHandleAxesType=r.default.arrayOf(r.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),s=t.resizeHandleType=r.default.oneOfType([r.default.node,r.default.func]);t.default={className:r.default.string,style:r.default.object,width:r.default.number,autoSize:r.default.bool,cols:r.default.number,draggableCancel:r.default.string,draggableHandle:r.default.string,verticalCompact:function(e){e.verticalCompact},compactType:r.default.oneOf(["vertical","horizontal"]),layout:function(e){var t=e.layout;void 0!==t&&n(20414).validateLayout(t,"layout")},margin:r.default.arrayOf(r.default.number),containerPadding:r.default.arrayOf(r.default.number),rowHeight:r.default.number,maxRows:r.default.number,isBounded:r.default.bool,isDraggable:r.default.bool,isResizable:r.default.bool,allowOverlap:r.default.bool,preventCollision:r.default.bool,useCSSTransforms:r.default.bool,transformScale:r.default.number,isDroppable:r.default.bool,resizeHandles:o,resizeHandle:s,onLayoutChange:r.default.func,onDragStart:r.default.func,onDrag:r.default.func,onDragStop:r.default.func,onResizeStart:r.default.func,onResize:r.default.func,onResizeStop:r.default.func,onDrop:r.default.func,droppingItem:r.default.shape({i:r.default.string.isRequired,w:r.default.number.isRequired,h:r.default.number.isRequired}),children:function(e,t){let n=e[t],r={};i.default.Children.forEach(n,function(e){if((null==e?void 0:e.key)!=null){if(r[e.key])throw Error('Duplicate child key "'+e.key+'" found! This will cause problems in ReactGridLayout.');r[e.key]=!0}})},innerRef:r.default.any}},74636(e,t,n){"use strict";t.default=void 0;var r=d(n(70451)),i=c(n(62688)),a=n(90568),o=n(20414),s=n(50544),l=c(n(59482));let u=["breakpoint","breakpoints","cols","layouts","margin","containerPadding","onBreakpointChange","onLayoutChange","onWidthChange"];function c(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if("function"==typeof WeakMap)var n=new WeakMap,r=new WeakMap;return(d=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)"default"!==t&&({}).hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function p(){return(p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach(function(t){g(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function g(e,t,n){var r;return(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let m=e=>Object.prototype.toString.call(e);function y(e,t){return null==e?null:Array.isArray(e)?e:e[t]}class b extends r.Component{constructor(){super(...arguments),g(this,"state",this.generateInitialState()),g(this,"onLayoutChange",e=>{this.props.onLayoutChange(e,h(h({},this.props.layouts),{},{[this.state.breakpoint]:e}))})}generateInitialState(){let{width:e,breakpoints:t,layouts:n,cols:r}=this.props,i=(0,s.getBreakpointFromWidth)(t,e),a=(0,s.getColsFromBreakpoint)(i,r),o=!1===this.props.verticalCompact?null:this.props.compactType;return{layout:(0,s.findOrGenerateResponsiveLayout)(n,t,i,i,a,o),breakpoint:i,cols:a}}static getDerivedStateFromProps(e,t){if(!(0,a.deepEqual)(e.layouts,t.layouts)){let{breakpoint:n,cols:r}=t;return{layout:(0,s.findOrGenerateResponsiveLayout)(e.layouts,e.breakpoints,n,n,r,e.compactType),layouts:e.layouts}}return null}componentDidUpdate(e){this.props.width==e.width&&this.props.breakpoint===e.breakpoint&&(0,a.deepEqual)(this.props.breakpoints,e.breakpoints)&&(0,a.deepEqual)(this.props.cols,e.cols)||this.onWidthChange(e)}onWidthChange(e){let{breakpoints:t,cols:n,layouts:r,compactType:i}=this.props,a=this.props.breakpoint||(0,s.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),l=this.state.breakpoint,u=(0,s.getColsFromBreakpoint)(a,n),c=h({},r);if(l!==a||e.breakpoints!==t||e.cols!==n){l in c||(c[l]=(0,o.cloneLayout)(this.state.layout));let e=(0,s.findOrGenerateResponsiveLayout)(c,t,a,l,u,i);e=(0,o.synchronizeLayoutWithChildren)(e,this.props.children,u,i,this.props.allowOverlap),c[a]=e,this.props.onBreakpointChange(a,u),this.props.onLayoutChange(e,c),this.setState({breakpoint:a,layout:e,cols:u})}let d=y(this.props.margin,a),p=y(this.props.containerPadding,a);this.props.onWidthChange(this.props.width,d,u,p)}render(){let e=this.props,{breakpoint:t,breakpoints:n,cols:i,layouts:a,margin:o,containerPadding:s,onBreakpointChange:c,onLayoutChange:d,onWidthChange:f}=e,h=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,u);return r.createElement(l.default,p({},h,{margin:y(o,this.state.breakpoint),containerPadding:y(s,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}t.default=b,g(b,"propTypes",{breakpoint:i.default.string,breakpoints:i.default.object,allowOverlap:i.default.bool,cols:i.default.object,margin:i.default.oneOfType([i.default.array,i.default.object]),containerPadding:i.default.oneOfType([i.default.array,i.default.object]),layouts(e,t){if("[object Object]"!==m(e[t]))throw Error("Layout property must be an object. Received: "+m(e[t]));Object.keys(e[t]).forEach(t=>{if(!(t in e.breakpoints))throw Error("Each key in layouts must align with a key in breakpoints.");(0,o.validateLayout)(e.layouts[t],"layouts."+t)})},width:i.default.number.isRequired,onBreakpointChange:i.default.func,onLayoutChange:i.default.func,onWidthChange:i.default.func}),g(b,"defaultProps",{breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},containerPadding:{lg:null,md:null,sm:null,xs:null,xxs:null},layouts:{},margin:[10,10],allowOverlap:!1,onBreakpointChange:o.noop,onLayoutChange:o.noop,onWidthChange:o.noop})},20906(e,t){"use strict";function n(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-2*n[0])/i}function r(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function i(e,t,n){return Math.max(Math.min(e,n),t)}Object.defineProperty(t,"__esModule",{value:!0}),t.calcGridColWidth=n,t.calcGridItemPosition=function(e,t,i,a,o,s){let{margin:l,containerPadding:u,rowHeight:c}=e,d=n(e),p={};return s&&s.resizing?(p.width=Math.round(s.resizing.width),p.height=Math.round(s.resizing.height)):(p.width=r(a,d,l[0]),p.height=r(o,c,l[1])),s&&s.dragging?(p.top=Math.round(s.dragging.top),p.left=Math.round(s.dragging.left)):s&&s.resizing&&"number"==typeof s.resizing.top&&"number"==typeof s.resizing.left?(p.top=Math.round(s.resizing.top),p.left=Math.round(s.resizing.left)):(p.top=Math.round((c+l[1])*i+u[1]),p.left=Math.round((d+l[0])*t+u[0])),p},t.calcGridItemWHPx=r,t.calcWH=function(e,t,r,a,o,s){let{margin:l,maxRows:u,cols:c,rowHeight:d}=e,p=n(e),f=Math.round((t+l[0])/(p+l[0])),h=Math.round((r+l[1])/(d+l[1])),g=i(f,0,c-a),m=i(h,0,u-o);return -1!==["sw","w","nw"].indexOf(s)&&(g=i(f,0,c)),-1!==["nw","n","ne"].indexOf(s)&&(m=i(h,0,u)),{w:g,h:m}},t.calcXY=function(e,t,r,a,o){let{margin:s,containerPadding:l,cols:u,rowHeight:c,maxRows:d}=e,p=n(e),f=Math.round((r-l[0])/(p+s[0])),h=Math.round((t-l[1])/(c+s[1]));return{x:f=i(f,0,u-a),y:h=i(h,0,d-o)}},t.clamp=i},59186(e,t,n){"use strict";t.default=function(e){var t;return t=class extends r.Component{constructor(){super(...arguments),d(this,"state",{width:1280}),d(this,"elementRef",r.createRef()),d(this,"mounted",!1),d(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new a.default(e=>{if(this.elementRef.current instanceof HTMLElement){let t=e[0].contentRect.width;this.setState({width:t})}});let e=this.elementRef.current;e instanceof HTMLElement&&this.resizeObserver.observe(e)}componentWillUnmount(){this.mounted=!1;let e=this.elementRef.current;e instanceof HTMLElement&&this.resizeObserver.unobserve(e),this.resizeObserver.disconnect()}render(){let t=this.props,{measureBeforeMount:n}=t,i=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(t,s);return n&&!this.mounted?r.createElement("div",{className:(0,o.default)(this.props.className,"react-grid-layout"),style:this.props.style,ref:this.elementRef}):r.createElement(e,c({innerRef:this.elementRef},i,this.state))}},d(t,"defaultProps",{measureBeforeMount:!1}),d(t,"propTypes",{measureBeforeMount:i.default.bool}),t};var r=u(n(70451)),i=l(n(62688)),a=l(n(90883)),o=l(n(78784));let s=["measureBeforeMount"];function l(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if("function"==typeof WeakMap)var n=new WeakMap,r=new WeakMap;return(u=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)"default"!==t&&({}).hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function c(){return(c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}function d(e,t,n){var r;return(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},37434(e){e.exports=function(e,t,n){return e===t||e.className===t.className&&n(e.style,t.style)&&e.width===t.width&&e.autoSize===t.autoSize&&e.cols===t.cols&&e.draggableCancel===t.draggableCancel&&e.draggableHandle===t.draggableHandle&&n(e.verticalCompact,t.verticalCompact)&&n(e.compactType,t.compactType)&&n(e.layout,t.layout)&&n(e.margin,t.margin)&&n(e.containerPadding,t.containerPadding)&&e.rowHeight===t.rowHeight&&e.maxRows===t.maxRows&&e.isBounded===t.isBounded&&e.isDraggable===t.isDraggable&&e.isResizable===t.isResizable&&e.allowOverlap===t.allowOverlap&&e.preventCollision===t.preventCollision&&e.useCSSTransforms===t.useCSSTransforms&&e.transformScale===t.transformScale&&e.isDroppable===t.isDroppable&&n(e.resizeHandles,t.resizeHandles)&&n(e.resizeHandle,t.resizeHandle)&&e.onLayoutChange===t.onLayoutChange&&e.onDragStart===t.onDragStart&&e.onDrag===t.onDrag&&e.onDragStop===t.onDragStop&&e.onResizeStart===t.onResizeStart&&e.onResize===t.onResize&&e.onResizeStop===t.onResizeStop&&e.onDrop===t.onDrop&&n(e.droppingItem,t.droppingItem)&&n(e.innerRef,t.innerRef)}},50544(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findOrGenerateResponsiveLayout=function(e,t,n,a,o,s){if(e[n])return(0,r.cloneLayout)(e[n]);let l=e[a],u=i(t),c=u.slice(u.indexOf(n));for(let t=0,n=c.length;t<n;t++){let n=c[t];if(e[n]){l=e[n];break}}return l=(0,r.cloneLayout)(l||[]),(0,r.compact)((0,r.correctBounds)(l,{cols:o}),s,o)},t.getBreakpointFromWidth=function(e,t){let n=i(e),r=n[0];for(let i=1,a=n.length;i<a;i++){let a=n[i];t>e[a]&&(r=a)}return r},t.getColsFromBreakpoint=function(e,t){if(!t[e])throw Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]},t.sortBreakpoints=i;var r=n(20414);function i(e){return Object.keys(e).sort(function(t,n){return e[t]-e[n]})}},20414(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bottom=l,t.childrenEqual=function(e,t){return(0,i.deepEqual)(a.default.Children.map(e,e=>null==e?void 0:e.key),a.default.Children.map(t,e=>null==e?void 0:e.key))&&(0,i.deepEqual)(a.default.Children.map(e,e=>null==e?void 0:e.props["data-grid"]),a.default.Children.map(t,e=>null==e?void 0:e.props["data-grid"]))},t.cloneLayout=u,t.cloneLayoutItem=d,t.collides=p,t.compact=f,t.compactItem=m,t.compactType=function(e){let{verticalCompact:t,compactType:n}=e||{};return!1===t?null:n},t.correctBounds=y,t.fastPositionEqual=function(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height},t.fastRGLPropsEqual=void 0,t.getAllCollisions=x,t.getFirstCollision=v,t.getLayoutItem=b,t.getStatics=w,t.modifyLayout=c,t.moveElement=j,t.moveElementAwayFromCollision=S,t.noop=void 0,t.perc=function(e){return 100*e+"%"},t.resizeItemInDirection=function(e,t,n,r){let i=P[e];return i?i(t,s(s({},t),n),r):n},t.setTopLeft=function(e){let{top:t,left:n,width:r,height:i}=e;return{top:"".concat(t,"px"),left:"".concat(n,"px"),width:"".concat(r,"px"),height:"".concat(i,"px"),position:"absolute"}},t.setTransform=function(e){let{top:t,left:n,width:r,height:i}=e,a="translate(".concat(n,"px,").concat(t,"px)");return{transform:a,WebkitTransform:a,MozTransform:a,msTransform:a,OTransform:a,width:"".concat(r,"px"),height:"".concat(i,"px"),position:"absolute"}},t.sortLayoutItems=T,t.sortLayoutItemsByColRow=R,t.sortLayoutItemsByRowCol=M,t.synchronizeLayoutWithChildren=function(e,t,n,r,i){e=e||[];let o=[];a.default.Children.forEach(t,t=>{if((null==t?void 0:t.key)==null)return;let n=b(e,String(t.key)),r=t.props["data-grid"];n&&null==r?o.push(d(n)):r?o.push(d(s(s({},r),{},{i:t.key}))):o.push(d({w:1,h:1,x:0,y:l(o),i:String(t.key)}))});let u=y(o,{cols:n});return i?u:f(u,r,n)},t.validateLayout=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Layout",n=["x","y","w","h"];if(!Array.isArray(e))throw Error(t+" must be an array!");for(let r=0,i=e.length;r<i;r++){let i=e[r];for(let e=0;e<n.length;e++){let a=n[e],o=i[a];if("number"!=typeof o||Number.isNaN(o))throw Error("ReactGridLayout: ".concat(t,"[").concat(r,"].").concat(a," must be a number! Received: ").concat(o," (").concat(typeof o,")"))}if(void 0!==i.i&&"string"!=typeof i.i)throw Error("ReactGridLayout: ".concat(t,"[").concat(r,"].i must be a string! Received: ").concat(i.i," (").concat(typeof i.i,")"))}},t.withLayoutItem=function(e,t,n){let r=b(e,t);return r?[e=c(e,r=n(d(r))),r]:[e,null]};var r,i=n(90568),a=(r=n(70451))&&r.__esModule?r:{default:r};function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e){let t=0,n;for(let r=0,i=e.length;r<i;r++)(n=e[r].y+e[r].h)>t&&(t=n);return t}function u(e){let t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=d(e[n]);return t}function c(e,t){let n=Array(e.length);for(let r=0,i=e.length;r<i;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function d(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function p(e,t){return e.i!==t.i&&!(e.x+e.w<=t.x)&&!(e.x>=t.x+t.w)&&!(e.y+e.h<=t.y)&&!(e.y>=t.y+t.h)}function f(e,t,n,r){let i=w(e),a=l(i),o=T(e,t),s=Array(e.length);for(let l=0,u=o.length;l<u;l++){let u=d(o[l]);u.static||(u=m(i,u,t,n,o,r,a),a=Math.max(a,u.y+u.h),i.push(u)),s[e.indexOf(o[l])]=u,u.moved=!1}return s}t.fastRGLPropsEqual=n(37434);let h={x:"w",y:"h"};function g(e,t,n,r){let i=h[r];t[r]+=1;let a=e.map(e=>e.i).indexOf(t.i);for(let o=a+1;o<e.length;o++){let a=e[o];if(!a.static){if(a.y>t.y+t.h)break;p(t,a)&&g(e,a,n+t[i],r)}}t[r]=n}function m(e,t,n,r,i,a,o){let s,u="horizontal"===n;if("vertical"===n)for("number"==typeof o?t.y=Math.min(o,t.y):t.y=Math.min(l(e),t.y);t.y>0&&!v(e,t);)t.y--;else if(u)for(;t.x>0&&!v(e,t);)t.x--;for(;(s=v(e,t))&&!(null===n&&a);)if(u?g(i,t,s.x+s.w,"x"):g(i,t,s.y+s.h,"y"),u&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!v(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function y(e,t){let n=w(e);for(let r=0,i=e.length;r<i;r++){let i=e[r];if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),i.static)for(;v(n,i);)i.y++;else n.push(i)}return e}function b(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function v(e,t){for(let n=0,r=e.length;n<r;n++)if(p(e[n],t))return e[n]}function x(e,t){return e.filter(e=>p(e,t))}function w(e){return e.filter(e=>e.static)}function j(e,t,n,r,i,a,o,s,l){if(t.static&&!0!==t.isDraggable||t.y===r&&t.x===n)return e;"Moving element ".concat(t.i," to [").concat(String(n),",").concat(String(r),"] from [").concat(t.x,",").concat(t.y,"]");let c=t.x,d=t.y;"number"==typeof n&&(t.x=n),"number"==typeof r&&(t.y=r),t.moved=!0;let p=T(e,o);("vertical"===o&&"number"==typeof r?d>=r:"horizontal"===o&&"number"==typeof n&&c>=n)&&(p=p.reverse());let f=x(p,t),h=f.length>0;if(h&&l)return u(e);if(h&&a)return L("Collision prevented on ".concat(t.i,", reverting.")),t.x=c,t.y=d,t.moved=!1,e;for(let n=0,r=f.length;n<r;n++){let r=f[n];"Resolving collision between ".concat(t.i," at [").concat(t.x,",").concat(t.y,"] and ").concat(r.i," at [").concat(r.x,",").concat(r.y,"]"),r.moved||(e=r.static?S(e,r,t,i,o,s):S(e,t,r,i,o,s))}return e}function S(e,t,n,r,i,a){let o="horizontal"===i,s="vertical"===i,l=t.static;if(r){r=!1;let u={x:o?Math.max(t.x-n.w,0):n.x,y:s?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},c=v(e,u),d=c&&c.y+c.h>t.y,p=c&&t.x+t.w>c.x;if(!c)return L("Doing reverse collision on ".concat(n.i," up to [").concat(u.x,",").concat(u.y,"].")),j(e,n,o?u.x:void 0,s?u.y:void 0,r,l,i,a);if(d&&s)return j(e,n,void 0,n.y+1,r,l,i,a);if(d&&null==i)return t.y=n.y,n.y=n.y+n.h,e;else if(p&&o)return j(e,t,n.x,void 0,r,l,i,a)}let u=o?n.x+1:void 0,c=s?n.y+1:void 0;return null==u&&null==c?e:j(e,n,o?n.x+1:void 0,s?n.y+1:void 0,r,l,i,a)}let A=(e,t,n,r)=>e+n>r?t:n,C=(e,t,n)=>e<0?t:n,E=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:C(o,e.height,i),top:Math.max(0,o)}},D=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:A(e.left,e.width,o,n),left:Math.max(0,i)}},O=(e,t,n)=>{let{top:r,height:i,width:a}=t,o=e.left-(a-e.width);return{height:i,width:o<0?e.width:A(e.left,e.width,a,n),top:Math.max(0,r),left:Math.max(0,o)}},k=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:C(r,e.height,a),top:Math.max(0,r)}},P={n:E,ne:function(){return E(arguments.length<=0?void 0:arguments[0],D(...arguments),arguments.length<=2?void 0:arguments[2])},e:D,se:function(){return k(arguments.length<=0?void 0:arguments[0],D(...arguments),arguments.length<=2?void 0:arguments[2])},s:k,sw:function(){return k(arguments.length<=0?void 0:arguments[0],O(...arguments),arguments.length<=2?void 0:arguments[2])},w:O,nw:function(){return E(arguments.length<=0?void 0:arguments[0],O(...arguments),arguments.length<=2?void 0:arguments[2])}};function T(e,t){return"horizontal"===t?R(e):"vertical"===t?M(e):e}function M(e){return e.slice(0).sort(function(e,t){return e.y>t.y||e.y===t.y&&e.x>t.x?1:e.y===t.y&&e.x===t.x?0:-1})}function R(e){return e.slice(0).sort(function(e,t){return e.x>t.x||e.x===t.x&&e.y>t.y?1:-1})}function L(){}t.noop=()=>{}},12548(e,t,n){e.exports=n(59482).default,n(20414),n(20906),e.exports.Responsive=n(74636).default,e.exports.Responsive.utils=n(50544),e.exports.WidthProvider=n(59186).default},11794(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=l(n(70451)),i=n(38230),a=n(39954),o=n(16333);let s=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function l(e,t){if("function"==typeof WeakMap)var n=new WeakMap,r=new WeakMap;return(l=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)"default"!==t&&({}).hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function u(){return(u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}class p extends r.Component{constructor(){super(...arguments),this.handleRefs={},this.lastHandleRect=null,this.slack=null,this.lastSize=null}componentWillUnmount(){this.resetData()}resetData(){this.lastHandleRect=this.slack=this.lastSize=null}runConstraints(e,t){let{minConstraints:n,maxConstraints:r,lockAspectRatio:i}=this.props;if(!n&&!r&&!i)return[e,t];if(i){let n=this.props.width/this.props.height;Math.abs(e-this.props.width)>Math.abs((t-this.props.height)*n)?t=e/n:e=t*n}let[a,o]=[e,t],[s,l]=this.slack||[0,0];return e+=s,t+=l,n&&(e=Math.max(n[0],e),t=Math.max(n[1],t)),r&&(e=Math.min(r[0],e),t=Math.min(r[1],t)),this.slack=[s+(a-e),l+(o-t)],[e,t]}resizeHandler(e,t){return(n,r)=>{let{node:i,deltaX:a,deltaY:o}=r;"onResizeStart"===e&&this.resetData();let s=("both"===this.props.axis||"x"===this.props.axis)&&"n"!==t&&"s"!==t,l=("both"===this.props.axis||"y"===this.props.axis)&&"e"!==t&&"w"!==t;if(!s&&!l)return;let u=t[0],c=t[t.length-1],d=i.getBoundingClientRect();null!=this.lastHandleRect&&("w"===c&&(a+=d.left-this.lastHandleRect.left),"n"===u&&(o+=d.top-this.lastHandleRect.top)),this.lastHandleRect=d,"w"===c&&(a=-a),"n"===u&&(o=-o);let p=this.props.width+(s?a/this.props.transformScale:0),f=this.props.height+(l?o/this.props.transformScale:0);[p,f]=this.runConstraints(p,f),"onResizeStop"===e&&this.lastSize&&({width:p,height:f}=this.lastSize);let h=p!==this.props.width||f!==this.props.height;"onResizeStop"!==e&&(this.lastSize={width:p,height:f});let g="function"==typeof this.props[e]?this.props[e]:null;g&&!("onResize"===e&&!h)&&(n.persist?.(),g(n,{node:i,size:{width:p,height:f},handle:t})),"onResizeStop"===e&&this.resetData()}}renderResizeHandle(e,t){let{handle:n}=this.props;if(!n)return r.createElement("span",{className:`react-resizable-handle react-resizable-handle-${e}`,ref:t});if("function"==typeof n)return n(e,t);let i=d({ref:t},"string"==typeof n.type?{}:{handleAxis:e});return r.cloneElement(n,i)}render(){let e=this.props,{children:t,className:n,draggableOpts:o,width:l,height:c,handle:p,handleSize:f,lockAspectRatio:h,axis:g,minConstraints:m,maxConstraints:y,onResize:b,onResizeStop:v,onResizeStart:x,resizeHandles:w,transformScale:j}=e,S=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,s);return(0,a.cloneElement)(t,d(d({},S),{},{className:`${n?`${n} `:""}react-resizable`,children:[...r.Children.toArray(t.props.children),...w.map(e=>{let t=this.handleRefs[e]??(this.handleRefs[e]=r.createRef());return r.createElement(i.DraggableCore,u({},o,{nodeRef:t,key:`resizableHandle-${e}`,onStop:this.resizeHandler("onResizeStop",e),onStart:this.resizeHandler("onResizeStart",e),onDrag:this.resizeHandler("onResize",e)}),this.renderResizeHandle(e,t))})]}))}}t.default=p,p.propTypes=o.resizableProps,p.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1}},96609(e,t,n){"use strict";t.default=void 0;var r=u(n(70451)),i=l(n(62688)),a=l(n(11794)),o=n(16333);let s=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function l(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if("function"==typeof WeakMap)var n=new WeakMap,r=new WeakMap;return(u=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)"default"!==t&&({}).hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function c(){return(c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}class f extends r.Component{constructor(){super(...arguments),this.state={width:this.props.width,height:this.props.height,propsWidth:this.props.width,propsHeight:this.props.height},this.onResize=(e,t)=>{let{size:n}=t;this.props.onResize?(e.persist?.(),this.setState(n,()=>this.props.onResize&&this.props.onResize(e,t))):this.setState(n)}}static getDerivedStateFromProps(e,t){return t.propsWidth!==e.width||t.propsHeight!==e.height?{width:e.width,height:e.height,propsWidth:e.width,propsHeight:e.height}:null}render(){let e=this.props,{handle:t,handleSize:n,onResize:i,onResizeStart:o,onResizeStop:l,draggableOpts:u,minConstraints:d,maxConstraints:f,lockAspectRatio:h,axis:g,width:m,height:y,resizeHandles:b,style:v,transformScale:x}=e,w=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,s);return r.createElement(a.default,{axis:g,draggableOpts:u,handle:t,handleSize:n,height:this.state.height,lockAspectRatio:h,maxConstraints:f,minConstraints:d,onResizeStart:o,onResize:this.onResize,onResizeStop:l,resizeHandles:b,transformScale:x,width:this.state.width},r.createElement("div",c({},w,{style:p(p({},v),{},{width:this.state.width+"px",height:this.state.height+"px"})})))}}t.default=f,f.propTypes=p(p({},o.resizableProps),{},{children:i.default.element})},16333(e,t,n){"use strict";t.__esModule=!0,t.resizableProps=void 0;var r,i=(r=n(62688))&&r.__esModule?r:{default:r};n(38230),t.resizableProps={axis:i.default.oneOf(["both","x","y","none"]),className:i.default.string,children:i.default.element.isRequired,draggableOpts:i.default.shape({allowAnyClick:i.default.bool,cancel:i.default.string,children:i.default.node,disabled:i.default.bool,enableUserSelectHack:i.default.bool,offsetParent:"u">typeof Element?i.default.instanceOf(Element):i.default.any,grid:i.default.arrayOf(i.default.number),handle:i.default.string,nodeRef:i.default.object,onStart:i.default.func,onDrag:i.default.func,onStop:i.default.func,onMouseDown:i.default.func,scale:i.default.number}),height:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];let[r]=t;return"both"===r.axis||"y"===r.axis?i.default.number.isRequired(...t):i.default.number(...t)},handle:i.default.oneOfType([i.default.node,i.default.func]),handleSize:i.default.arrayOf(i.default.number),lockAspectRatio:i.default.bool,maxConstraints:i.default.arrayOf(i.default.number),minConstraints:i.default.arrayOf(i.default.number),onResizeStop:i.default.func,onResizeStart:i.default.func,onResize:i.default.func,resizeHandles:i.default.arrayOf(i.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:i.default.number,width:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];let[r]=t;return"both"===r.axis||"x"===r.axis?i.default.number.isRequired(...t):i.default.number(...t)}}},39954(e,t,n){"use strict";t.__esModule=!0,t.cloneElement=function(e,t){return t.style&&e.props.style&&(t.style=o(o({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=`${e.props.className} ${t.className}`),i.default.cloneElement(e,t)};var r,i=(r=n(70451))&&r.__esModule?r:{default:r};function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}},50936(e,t,n){"use strict";e.exports=function(){throw Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},e.exports.Resizable=n(11794).default,e.exports.ResizableBox=n(96609).default},90883(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>j});var r=function(){if("u">typeof Map)return Map;function e(e,t){var n=-1;return e.some(function(e,r){return e[0]===t&&(n=r,!0)}),n}function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var n=e(this.__entries__,t),r=this.__entries__[n];return r&&r[1]},t.prototype.set=function(t,n){var r=e(this.__entries__,t);~r?this.__entries__[r][1]=n:this.__entries__.push([t,n])},t.prototype.delete=function(t){var n=this.__entries__,r=e(n,t);~r&&n.splice(r,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var n=0,r=this.__entries__;n<r.length;n++){var i=r[n];e.call(t,i[1],i[0])}},t}(),i="u">typeof window&&"u">typeof document&&window.document===document,a=void 0!==n.g&&n.g.Math===Math?n.g:"u">typeof self&&self.Math===Math?self:"u">typeof window&&window.Math===Math?window:Function("return this")(),o="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(a):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)},s=["top","right","bottom","left","width","height","size","weight"],l="u">typeof MutationObserver,u=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(e){var t=!1,n=!1,r=0;function i(){t&&(t=!1,e()),n&&s()}function a(){o(i)}function s(){var e=Date.now();if(t){if(e-r<2)return;n=!0}else t=!0,n=!1,setTimeout(a,20);r=e}return s}(this.refresh.bind(this))}return e.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},e.prototype.removeObserver=function(e){var t=this.observers_,n=t.indexOf(e);~n&&t.splice(n,1),!t.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},e.prototype.updateObservers_=function(){var e=this.observers_.filter(function(e){return e.gatherActive(),e.hasActive()});return e.forEach(function(e){return e.broadcastActive()}),e.length>0},e.prototype.connect_=function(){i&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),l?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){i&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,n=void 0===t?"":t;s.some(function(e){return!!~n.indexOf(e)})&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),c=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];Object.defineProperty(e,i,{value:t[i],enumerable:!1,writable:!1,configurable:!0})}return e},d=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||a},p=m(0,0,0,0);function f(e){return parseFloat(e)||0}function h(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(t,n){return t+f(e["border-"+n+"-width"])},0)}var g="u">typeof SVGGraphicsElement?function(e){return e instanceof d(e).SVGGraphicsElement}:function(e){return e instanceof d(e).SVGElement&&"function"==typeof e.getBBox};function m(e,t,n,r){return{x:e,y:t,width:n,height:r}}var y=function(){function e(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=m(0,0,0,0),this.target=e}return e.prototype.isActive=function(){var e=function(e){if(!i)return p;if(g(e)){var t;return m(0,0,(t=e.getBBox()).width,t.height)}return function(e){var t,n=e.clientWidth,r=e.clientHeight;if(!n&&!r)return p;var i=d(e).getComputedStyle(e),a=function(e){for(var t={},n=0,r=["top","right","bottom","left"];n<r.length;n++){var i=r[n],a=e["padding-"+i];t[i]=f(a)}return t}(i),o=a.left+a.right,s=a.top+a.bottom,l=f(i.width),u=f(i.height);if("border-box"===i.boxSizing&&(Math.round(l+o)!==n&&(l-=h(i,"left","right")+o),Math.round(u+s)!==r&&(u-=h(i,"top","bottom")+s)),(t=e)!==d(t).document.documentElement){var c=Math.round(l+o)-n,g=Math.round(u+s)-r;1!==Math.abs(c)&&(l-=c),1!==Math.abs(g)&&(u-=g)}return m(a.left,a.top,l,u)}(e)}(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},e}(),b=function(e,t){var n,r,i,a,o,s=(n=t.x,r=t.y,i=t.width,a=t.height,c(o=Object.create(("u">typeof DOMRectReadOnly?DOMRectReadOnly:Object).prototype),{x:n,y:r,width:i,height:a,top:r,right:n+i,bottom:a+r,left:n}),o);c(this,{target:e,contentRect:s})},v=function(){function e(e,t,n){if(this.activeObservations_=[],this.observations_=new r,"function"!=typeof e)throw TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=n}return e.prototype.observe=function(e){if(!arguments.length)throw TypeError("1 argument required, but only 0 present.");if(!("u"<typeof Element)&&Element instanceof Object){if(!(e instanceof d(e).Element))throw TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new y(e)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(e){if(!arguments.length)throw TypeError("1 argument required, but only 0 present.");if(!("u"<typeof Element)&&Element instanceof Object){if(!(e instanceof d(e).Element))throw TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(t){t.isActive()&&e.activeObservations_.push(t)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map(function(e){return new b(e.target,e.broadcastRect())});this.callback_.call(e,t,e),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),x="u">typeof WeakMap?new WeakMap:new r,w=function e(t){if(!(this instanceof e))throw TypeError("Cannot call a class as a function.");if(!arguments.length)throw TypeError("1 argument required, but only 0 present.");var n=new v(t,u.getInstance(),this);x.set(this,n)};["observe","unobserve","disconnect"].forEach(function(e){w.prototype[e]=function(){var t;return(t=x.get(this))[e].apply(t,arguments)}});let j=void 0!==a.ResizeObserver?a.ResizeObserver:w},21750(e,t,n){"use strict";var r=n(70451),i=n(43676),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=i.useSyncExternalStore,s=r.useRef,l=r.useEffect,u=r.useMemo,c=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(null===d.current){var p={hasValue:!1,value:null};d.current=p}else p=d.current;var f=o(e,(d=u(function(){function e(e){if(!l){if(l=!0,o=e,e=r(e),void 0!==i&&p.hasValue){var t=p.value;if(i(t,e))return s=t}return s=e}if(t=s,a(o,e))return t;var n=r(e);return void 0!==i&&i(t,n)?(o=e,t):(o=e,s=n)}var o,s,l=!1,u=void 0===n?null:n;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,n,r,i]))[0],d[1]);return l(function(){p.hasValue=!0,p.value=f},[f]),c(f),f}},95390(e,t,n){"use strict";e.exports=n(21750)}}]);