@luzmo/analytics-components-kit 1.0.1-alpha.48 → 1.0.1-alpha.49

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 (191) hide show
  1. package/components/{bar-chart-options.config-BdbbHUJZ.js → bar-chart-options.config-D1mb5TDl.js} +1 -0
  2. package/components/{bar-chart-options.config-C9XGEujs.cjs → bar-chart-options.config-DcxEkOT5.cjs} +1 -1
  3. package/components/{bar-chart-options.de-DwTn_qfu.js → bar-chart-options.de-BQ4qGaQc.js} +1 -0
  4. package/components/{bar-chart-options.de-BGzu5Zgd.cjs → bar-chart-options.de-Dr5zKz8Q.cjs} +1 -1
  5. package/components/{column-chart-options.en-D1UfGsS3.cjs → bar-chart-options.en-DdQ2PYrw.cjs} +1 -1
  6. package/components/{bar-chart-options.en-Crc8tYUJ.js → bar-chart-options.en-LjG6f4hw.js} +1 -0
  7. package/components/{bar-chart-options.es-ByT_D06p.js → bar-chart-options.es-BfIKCPf-.js} +1 -0
  8. package/components/{bar-chart-options.es-B2UWafXc.cjs → bar-chart-options.es-DgYVxn9U.cjs} +1 -1
  9. package/components/{bar-chart-options.fr-BwiGRlQf.js → bar-chart-options.fr-Cg1lQV2y.js} +1 -0
  10. package/components/{bar-chart-options.fr-CP7DTrlk.cjs → bar-chart-options.fr-rteFm93C.cjs} +1 -1
  11. package/components/{column-chart-options.nl-3wAj9uWY.cjs → bar-chart-options.nl--gwlkpc0.cjs} +1 -1
  12. package/components/{bar-chart-options.nl-DzXnHdwX.js → bar-chart-options.nl-CB2W4rzf.js} +1 -0
  13. package/components/{calculate-data-item-icon-DlfbBvFN.cjs → calculate-data-item-icon-Dn-9Kd0U.cjs} +1 -1
  14. package/components/{calculate-data-item-icon-BiIL_s4Z.js → calculate-data-item-icon-Dpvf1aLI.js} +51 -51
  15. package/components/{column-chart-options.config-BqSQ1Sl9.js → column-chart-options.config-B5SjBVdy.js} +10 -9
  16. package/components/{column-chart-options.config-Bi0RAzK-.cjs → column-chart-options.config-BjDvA7i9.cjs} +1 -1
  17. package/components/{column-chart-options.de-pgdcIHqk.cjs → column-chart-options.de-BU__cJy3.cjs} +1 -1
  18. package/components/{column-chart-options.de-VQVdi8aP.js → column-chart-options.de-BkkWD9rB.js} +1 -0
  19. package/components/{bar-chart-options.en-D1UfGsS3.cjs → column-chart-options.en-DdQ2PYrw.cjs} +1 -1
  20. package/components/{column-chart-options.en-Crc8tYUJ.js → column-chart-options.en-LjG6f4hw.js} +1 -0
  21. package/components/{column-chart-options.es-CT9ZtjV_.js → column-chart-options.es-BgOc-gTh.js} +1 -0
  22. package/components/{column-chart-options.es-CAAXJv_2.cjs → column-chart-options.es-CkaTU6qn.cjs} +1 -1
  23. package/components/{column-chart-options.fr-BwiGRlQf.js → column-chart-options.fr-Cg1lQV2y.js} +1 -0
  24. package/components/{column-chart-options.fr-CP7DTrlk.cjs → column-chart-options.fr-rteFm93C.cjs} +1 -1
  25. package/components/{bar-chart-options.nl-DZe2pKRa.cjs → column-chart-options.nl-Bhe6rcUo.cjs} +1 -1
  26. package/components/{column-chart-options.nl-DB2dcotu.js → column-chart-options.nl-CAeBYwQC.js} +1 -0
  27. package/components/{de-eIqMhTVC.cjs → de-Cxe7xkT4.cjs} +1 -1
  28. package/components/{de-BbcctJsI.js → de-ZPzjN2kc.js} +0 -1
  29. package/components/directive-BOOaQO_r.cjs +24 -0
  30. package/components/directive-CF_9GVrT.js +46 -0
  31. package/components/display-settings/display-settings.d.ts +2 -2
  32. package/components/display-settings/index.cjs +1 -1
  33. package/components/display-settings/index.js +2 -2
  34. package/components/display-settings-binning/index.cjs +1 -1
  35. package/components/display-settings-binning/index.js +11 -11
  36. package/components/display-settings-datetime/index.cjs +1 -1
  37. package/components/display-settings-datetime/index.js +13 -13
  38. package/components/display-settings-grand-totals/index.cjs +1 -1
  39. package/components/display-settings-grand-totals/index.js +11 -11
  40. package/components/display-settings-numeric/display-settings-numeric.d.ts +3 -1
  41. package/components/display-settings-numeric/index.cjs +61 -40
  42. package/components/display-settings-numeric/index.js +223 -182
  43. package/components/display-settings-period-over-period/index.cjs +6 -6
  44. package/components/display-settings-period-over-period/index.js +11 -11
  45. package/components/draggable-data-item/draggable-data-item.d.ts +1 -0
  46. package/components/draggable-data-item/index.cjs +8 -5
  47. package/components/draggable-data-item/index.js +44 -38
  48. package/components/draggable-data-item-level/draggable-data-item-level.d.ts +4 -0
  49. package/components/draggable-data-item-level/index.cjs +10 -10
  50. package/components/draggable-data-item-level/index.js +102 -77
  51. package/components/droppable-slot/droppable-slot.d.ts +29 -9
  52. package/components/droppable-slot/index.cjs +25 -71
  53. package/components/droppable-slot/index.js +274 -623
  54. package/components/edit-item/index.cjs +2 -2
  55. package/components/edit-item/index.js +18 -18
  56. package/components/edit-option/index.cjs +1 -1
  57. package/components/edit-option/index.js +2 -2
  58. package/components/edit-option-action-button-group/index.cjs +1 -1
  59. package/components/edit-option-action-button-group/index.js +6 -6
  60. package/components/{edit-option-base-D25zHZVl.js → edit-option-base-CG0JcbX9.js} +3 -3
  61. package/components/{edit-option-base-h5ndfVK4.cjs → edit-option-base-a2yoNqdf.cjs} +1 -1
  62. package/components/edit-option-color-palette-picker/index.cjs +1 -1
  63. package/components/edit-option-color-palette-picker/index.js +3 -3
  64. package/components/edit-option-color-picker/index.cjs +1 -1
  65. package/components/edit-option-color-picker/index.js +5 -5
  66. package/components/edit-option-color-range/index.cjs +1 -1
  67. package/components/edit-option-color-range/index.js +12 -12
  68. package/components/edit-option-multi-language-field/index.cjs +1 -1
  69. package/components/edit-option-multi-language-field/index.js +4 -4
  70. package/components/edit-option-number-field/index.cjs +1 -1
  71. package/components/edit-option-number-field/index.js +5 -5
  72. package/components/edit-option-picker/index.cjs +1 -1
  73. package/components/edit-option-picker/index.js +5 -5
  74. package/components/edit-option-position-picker/index.cjs +1 -1
  75. package/components/edit-option-position-picker/index.js +4 -4
  76. package/components/edit-option-positions-number-field/index.cjs +1 -1
  77. package/components/edit-option-positions-number-field/index.js +6 -6
  78. package/components/edit-option-radio-button-group/index.cjs +1 -1
  79. package/components/edit-option-radio-button-group/index.js +4 -4
  80. package/components/edit-option-slider/index.cjs +1 -1
  81. package/components/edit-option-slider/index.js +3 -3
  82. package/components/edit-option-switch/index.cjs +1 -1
  83. package/components/edit-option-switch/index.js +3 -3
  84. package/components/edit-option-text-field/index.cjs +1 -1
  85. package/components/edit-option-text-field/index.js +7 -7
  86. package/components/{es-tWaYVbsQ.cjs → es-4dEouIgb.cjs} +1 -1
  87. package/components/{es-ByWFTJ0s.js → es-C0JGlz18.js} +0 -1
  88. package/components/filter-data-item-picker/index.cjs +1 -1
  89. package/components/filter-data-item-picker/index.js +8 -8
  90. package/components/filter-expression-picker/index.cjs +1 -1
  91. package/components/filter-expression-picker/index.js +2 -2
  92. package/components/filter-item/index.cjs +1 -1
  93. package/components/filter-item/index.js +24 -24
  94. package/components/filter-value-picker/index.cjs +1 -1
  95. package/components/filter-value-picker/index.js +4 -4
  96. package/components/filter-value-picker-datetime/index.cjs +1 -1
  97. package/components/filter-value-picker-datetime/index.js +302 -302
  98. package/components/filter-value-picker-hierarchy/index.cjs +1 -1
  99. package/components/filter-value-picker-hierarchy/index.js +8 -8
  100. package/components/filter-value-picker-numeric/index.cjs +1 -1
  101. package/components/filter-value-picker-numeric/index.js +8 -8
  102. package/components/{focusable-Bhf_beoW.js → focusable-BbymtxWI.js} +1 -1
  103. package/components/{focusable-B8t8a-WJ.cjs → focusable-DAGGGYyz.cjs} +1 -1
  104. package/components/{fr-C5b2Wgoz.js → fr-B_-_f-VN.js} +0 -1
  105. package/components/{fr-2igiTsHU.cjs → fr-Dwulhlbi.cjs} +1 -1
  106. package/components/grid/index.cjs +18 -22
  107. package/components/grid/index.js +28 -49
  108. package/components/{if-defined-Dg09naf2.js → if-defined-Barg9gGQ.js} +1 -1
  109. package/components/{if-defined-DjdbEoAa.cjs → if-defined-wiCAR_aA.cjs} +1 -1
  110. package/components/{index-cbfU96gS.cjs → index-1oIrlkAr.cjs} +8 -8
  111. package/components/{index-BqSQoHjg.js → index-5Z9GD60H.js} +6 -6
  112. package/components/{index-9LxnqLJa.js → index-B2ngKWOI.js} +2 -2
  113. package/components/{index-COU9XhBt.js → index-BC1LV3vH.js} +1 -1
  114. package/components/{index-Cf_a7VrO.js → index-BEtf1WaQ.js} +2 -2
  115. package/components/{index-DMhm0FM8.cjs → index-BbpsZYZF.cjs} +25 -26
  116. package/components/{index-DRLFjkH0.cjs → index-BfzppmHn.cjs} +2 -2
  117. package/components/{index-BobhBKA2.js → index-BssHAgUU.js} +1 -1
  118. package/components/index-Bt3JTHTC.js +787 -0
  119. package/components/index-CY_cyFdI.cjs +174 -0
  120. package/components/{index-DeIay7ZE.js → index-CbuHBIDB.js} +2 -2
  121. package/components/{index-BukPAqqU.cjs → index-Ck5VRoXN.cjs} +1 -1
  122. package/components/{index-DYmi-X87.js → index-DE3d0E0P.js} +2 -2
  123. package/components/{index-fwJBhawL.cjs → index-DSQyBS9Z.cjs} +1 -1
  124. package/components/{index-BY1yDIAI.js → index-DTI4dIyd.js} +586 -634
  125. package/components/index-D_jFGBMs.js +174 -0
  126. package/components/{index-D9yzIoGv.js → index-Delpl7qa.js} +368 -306
  127. package/components/{index-B7AFYrfv.cjs → index-Df-_TbOD.cjs} +1 -1
  128. package/components/{index-C6NpWavw.js → index-DsP81c4M.js} +2 -2
  129. package/components/index-Dy_5M3M5.cjs +42 -0
  130. package/components/{index-Bpdwb9Js.cjs → index-MPM_B4re.cjs} +3 -3
  131. package/components/{index-ydBgjAru.js → index-N845QLku.js} +16 -16
  132. package/components/{index--3gSNupB.cjs → index-Tx5oQjbt.cjs} +1 -1
  133. package/components/{index-BSgp4MWQ.cjs → index-cHKqEi5-.cjs} +1 -1
  134. package/components/index-eBsINoH9.cjs +20 -0
  135. package/components/{index-BKx2WhDB.cjs → index-tXl_aMnZ.cjs} +1 -1
  136. package/components/index.cjs +1 -1
  137. package/components/index.js +4 -4
  138. package/components/{localized-decorator-DNr1P1m0.js → localized-decorator-Bl5gcI6n.js} +1 -1
  139. package/components/{localized-decorator-SOrjcPab.cjs → localized-decorator-DIXYZ3RL.cjs} +1 -1
  140. package/components/{luzmo-icons-4Tmb3sKr.js → luzmo-icons-CVeTZ59u.js} +9 -9
  141. package/components/{luzmo-icons-4nDFv1Lq-D6-m-VWM.cjs → luzmo-icons-DbwDQtuO-DSQ-uVxy.cjs} +2 -2
  142. package/components/{luzmo-icons-4nDFv1Lq-DffGNBpO.js → luzmo-icons-DbwDQtuO-QG0fLECn.js} +7 -7
  143. package/components/{luzmo-icons-Bvm-_ECi.cjs → luzmo-icons-DonyjSXg.cjs} +1 -1
  144. package/components/{nl-B50x7wMn.cjs → nl-DxdBIXDd.cjs} +1 -1
  145. package/components/{nl-76jn_zMH.js → nl-gdQCG4WV.js} +0 -1
  146. package/components/{periods.const-CfXsouLz.cjs → periods.const-7sXlqgEo.cjs} +1 -1
  147. package/components/{periods.const-C89NNRX-.js → periods.const-B7FKokcH.js} +1 -1
  148. package/components/property-Cu4Q1hS4.cjs +42 -0
  149. package/components/{property-BFMfZY1k.js → property-DCzt3DR1.js} +277 -277
  150. package/components/{set-locale-Cam8nRIW.cjs → set-locale-DCPlazsZ.cjs} +1 -1
  151. package/components/{set-locale-DbEAMqUs.js → set-locale-GI34z_M7.js} +1 -1
  152. package/components/{sized-mixin-CkdMApAU.js → sized-mixin-BGzkX2g1.js} +1 -1
  153. package/components/{sized-mixin-C48t6K7U.cjs → sized-mixin-j_7aJM4b.cjs} +1 -1
  154. package/components/slot-contents-picker/index.cjs +1 -1
  155. package/components/slot-contents-picker/index.js +16 -16
  156. package/components/slot-menu/index.cjs +27 -22
  157. package/components/slot-menu/index.js +237 -148
  158. package/components/slot-menu/slot-menu.d.ts +34 -12
  159. package/components/slot-menu-list/index.cjs +1 -1
  160. package/components/slot-menu-list/index.js +5 -5
  161. package/components/{state-CuE7TJCY.cjs → state-fyl3IYMu.cjs} +1 -1
  162. package/components/{state-BSTa7W6f.js → state-nDsQPund.js} +1 -1
  163. package/components/{task-CDsB8Kbr.js → task-Bh_X-xIU.js} +1 -1
  164. package/components/{task-0B-FC3rj.cjs → task-CwmAXlv0.cjs} +1 -1
  165. package/components/{text-field-ol9Ed5lQ-cRqtIf_0.cjs → text-field-BIADXoLC-B8w9TVmS.cjs} +1 -1
  166. package/components/{text-field-ol9Ed5lQ-DbpeM4EP.js → text-field-BIADXoLC-B9oE05VF.js} +1 -1
  167. package/custom-elements.json +226 -41
  168. package/item-definitions/bar-chart/i18n/bar-chart-options.de.d.ts +1 -0
  169. package/item-definitions/bar-chart/i18n/bar-chart-options.en.d.ts +1 -0
  170. package/item-definitions/bar-chart/i18n/bar-chart-options.es.d.ts +1 -0
  171. package/item-definitions/bar-chart/i18n/bar-chart-options.fr.d.ts +1 -0
  172. package/item-definitions/bar-chart/i18n/bar-chart-options.nl.d.ts +1 -0
  173. package/item-definitions/box-plot/box-plot-options.config.d.ts +1 -1
  174. package/item-definitions/choropleth-map/choropleth-map-options.config.d.ts +1 -1
  175. package/item-definitions/column-chart/i18n/column-chart-options.de.d.ts +1 -0
  176. package/item-definitions/column-chart/i18n/column-chart-options.en.d.ts +1 -0
  177. package/item-definitions/column-chart/i18n/column-chart-options.es.d.ts +1 -0
  178. package/item-definitions/column-chart/i18n/column-chart-options.fr.d.ts +1 -0
  179. package/item-definitions/column-chart/i18n/column-chart-options.nl.d.ts +1 -0
  180. package/item-definitions/hexbin-map/hexbin-map-options.config.d.ts +1 -1
  181. package/item-definitions/route-map/route-map-options.config.d.ts +1 -1
  182. package/item-definitions/spike-map/spike-map-options.config.d.ts +1 -1
  183. package/package.json +1 -1
  184. package/utils/data-broker/index.d.ts +9 -0
  185. package/utils/store/slot-store.d.ts +9 -3
  186. package/components/index-Be-pSgzQ.js +0 -174
  187. package/components/index-DCdx3dxQ.cjs +0 -42
  188. package/components/index-PGX2p9Ns.js +0 -304
  189. package/components/index-TQG9Xdxu.cjs +0 -20
  190. package/components/index-VHrmgynd.cjs +0 -121
  191. package/components/property-BV1QaY8E.cjs +0 -42
@@ -17,18 +17,14 @@
17
17
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
18
  * SOFTWARE.
19
19
  * */
20
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../property-BV1QaY8E.cjs"),Ee=require("../state-CuE7TJCY.cjs"),Ge=require("../query-D5qWDopr.cjs"),ie=require("../luzmo-icons-Bvm-_ECi.cjs");require("../index-DCdx3dxQ.cjs");require("../index-CnP-Q5Bw.cjs");require("../index-fwJBhawL.cjs");const Kt=require("../base-D76d76ww-tT6yr8eb.cjs");require("../focusable-BxtpnzWp-CkK9AeMt.cjs");const bt=require("../color-B6LaL8qz.cjs"),fi=require("../query-all-CR2wWKRD.cjs"),pi=require("../item-list.cjs"),Je=require("../index-Vdyb9z2D.cjs"),K=require("../set-locale-Cam8nRIW.cjs"),yi=require("../localized-decorator-SOrjcPab.cjs");require("../index-CYeQkVeJ.cjs");/**
21
- * @license
22
- * Copyright 2017 Google LLC
23
- * SPDX-License-Identifier: BSD-3-Clause
24
- */const bi={ATTRIBUTE:1},vi=s=>(...e)=>({_$litDirective$:s,values:e});let wi=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};const st=Math.min,fe=Math.max,Ne=Math.round,Le=Math.floor,X=s=>({x:s,y:s}),_i={left:"right",right:"left",bottom:"top",top:"bottom"},Ei={start:"end",end:"start"};function ht(s,e){return typeof s=="function"?s(e):s}function we(s){return s.split("-")[0]}function Ve(s){return s.split("-")[1]}function xi(s){return s==="x"?"y":"x"}function Yt(s){return s==="y"?"height":"width"}function ce(s){return["top","bottom"].includes(we(s))?"y":"x"}function Xt(s){return xi(ce(s))}function zi(s,e,t){t===void 0&&(t=!1);const i=Ve(s),r=Xt(s),o=Yt(r);let n=r==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(n=Oe(n)),[n,Oe(n)]}function ki(s){const e=Oe(s);return[rt(s),e,rt(e)]}function rt(s){return s.replace(/start|end/g,e=>Ei[e])}function Ri(s,e,t){const i=["left","right"],r=["right","left"],o=["top","bottom"],n=["bottom","top"];switch(s){case"top":case"bottom":return t?e?r:i:e?i:r;case"left":case"right":return e?o:n;default:return[]}}function Ai(s,e,t,i){const r=Ve(s);let o=Ri(we(s),t==="start",i);return r&&(o=o.map(n=>n+"-"+r),e&&(o=o.concat(o.map(rt)))),o}function Oe(s){return s.replace(/left|right|bottom|top/g,e=>_i[e])}function Si(s){return{top:0,right:0,bottom:0,left:0,...s}}function Mi(s){return typeof s!="number"?Si(s):{top:s,right:s,bottom:s,left:s}}function Pe(s){const{x:e,y:t,width:i,height:r}=s;return{width:i,height:r,top:t,left:e,right:e+i,bottom:t+r,x:e,y:t}}function vt(s,e,t){let{reference:i,floating:r}=s;const o=ce(e),n=Xt(e),a=Yt(n),l=we(e),d=o==="y",h=i.x+i.width/2-r.width/2,c=i.y+i.height/2-r.height/2,u=i[a]/2-r[a]/2;let f;switch(l){case"top":f={x:h,y:i.y-r.height};break;case"bottom":f={x:h,y:i.y+i.height};break;case"right":f={x:i.x+i.width,y:c};break;case"left":f={x:i.x-r.width,y:c};break;default:f={x:i.x,y:i.y}}switch(Ve(e)){case"start":f[n]-=u*(t&&d?-1:1);break;case"end":f[n]+=u*(t&&d?-1:1);break}return f}const Di=async(s,e,t)=>{const{placement:i="bottom",strategy:r="absolute",middleware:o=[],platform:n}=t,a=o.filter(Boolean),l=await(n.isRTL==null?void 0:n.isRTL(e));let d=await n.getElementRects({reference:s,floating:e,strategy:r}),{x:h,y:c}=vt(d,i,l),u=i,f={},y=0;for(let v=0;v<a.length;v++){const{name:b,fn:w}=a[v],{x:z,y:k,data:A,reset:R}=await w({x:h,y:c,initialPlacement:i,placement:u,strategy:r,middlewareData:f,rects:d,platform:n,elements:{reference:s,floating:e}});h=z??h,c=k??c,f={...f,[b]:{...f[b],...A}},R&&y<=50&&(y++,typeof R=="object"&&(R.placement&&(u=R.placement),R.rects&&(d=R.rects===!0?await n.getElementRects({reference:s,floating:e,strategy:r}):R.rects),{x:h,y:c}=vt(d,u,l)),v=-1)}return{x:h,y:c,placement:u,strategy:r,middlewareData:f}};async function Ci(s,e){var t;e===void 0&&(e={});const{x:i,y:r,platform:o,rects:n,elements:a,strategy:l}=s,{boundary:d="clippingAncestors",rootBoundary:h="viewport",elementContext:c="floating",altBoundary:u=!1,padding:f=0}=ht(e,s),y=Mi(f),b=a[u?c==="floating"?"reference":"floating":c],w=Pe(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(b)))==null||t?b:b.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:d,rootBoundary:h,strategy:l})),z=c==="floating"?{x:i,y:r,width:n.floating.width,height:n.floating.height}:n.reference,k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),A=await(o.isElement==null?void 0:o.isElement(k))?await(o.getScale==null?void 0:o.getScale(k))||{x:1,y:1}:{x:1,y:1},R=Pe(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:z,offsetParent:k,strategy:l}):z);return{top:(w.top-R.top+y.top)/A.y,bottom:(R.bottom-w.bottom+y.bottom)/A.y,left:(w.left-R.left+y.left)/A.x,right:(R.right-w.right+y.right)/A.x}}const Ti=function(s){return s===void 0&&(s={}),{name:"flip",options:s,async fn(e){var t,i;const{placement:r,middlewareData:o,rects:n,initialPlacement:a,platform:l,elements:d}=e,{mainAxis:h=!0,crossAxis:c=!0,fallbackPlacements:u,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:v=!0,...b}=ht(s,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const w=we(r),z=ce(a),k=we(a)===a,A=await(l.isRTL==null?void 0:l.isRTL(d.floating)),R=u||(k||!v?[Oe(a)]:ki(a)),B=y!=="none";!u&&B&&R.push(...Ai(a,v,y,A));const $=[a,...R],se=await Ci(e,b),U=[];let I=((i=o.flip)==null?void 0:i.overflows)||[];if(h&&U.push(se[w]),c){const D=zi(r,n,A);U.push(se[D[0]],se[D[1]])}if(I=[...I,{placement:r,overflows:U}],!U.every(D=>D<=0)){var Ie,L;const D=(((Ie=o.flip)==null?void 0:Ie.index)||0)+1,ae=$[D];if(ae&&(!(c==="alignment"?z!==ce(ae):!1)||I.every(F=>F.overflows[0]>0&&ce(F.placement)===z)))return{data:{index:D,overflows:I},reset:{placement:ae}};let ze=(L=I.filter(le=>le.overflows[0]<=0).sort((le,F)=>le.overflows[1]-F.overflows[1])[0])==null?void 0:L.placement;if(!ze)switch(f){case"bestFit":{var Z;const le=(Z=I.filter(F=>{if(B){const re=ce(F.placement);return re===z||re==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(re=>re>0).reduce((re,gi)=>re+gi,0)]).sort((F,re)=>F[1]-re[1])[0])==null?void 0:Z[0];le&&(ze=le);break}case"initialPlacement":ze=a;break}if(r!==ze)return{reset:{placement:ze}}}return{}}}};async function Ii(s,e){const{placement:t,platform:i,elements:r}=s,o=await(i.isRTL==null?void 0:i.isRTL(r.floating)),n=we(t),a=Ve(t),l=ce(t)==="y",d=["left","top"].includes(n)?-1:1,h=o&&l?-1:1,c=ht(e,s);let{mainAxis:u,crossAxis:f,alignmentAxis:y}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return a&&typeof y=="number"&&(f=a==="end"?y*-1:y),l?{x:f*h,y:u*d}:{x:u*d,y:f*h}}const Li=function(s){return s===void 0&&(s=0),{name:"offset",options:s,async fn(e){var t,i;const{x:r,y:o,placement:n,middlewareData:a}=e,l=await Ii(e,s);return n===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+l.x,y:o+l.y,data:{...l,placement:n}}}}};function qe(){return typeof window<"u"}function xe(s){return Jt(s)?(s.nodeName||"").toLowerCase():"#document"}function O(s){var e;return(s==null||(e=s.ownerDocument)==null?void 0:e.defaultView)||window}function Q(s){var e;return(e=(Jt(s)?s.ownerDocument:s.document)||window.document)==null?void 0:e.documentElement}function Jt(s){return qe()?s instanceof Node||s instanceof O(s).Node:!1}function V(s){return qe()?s instanceof Element||s instanceof O(s).Element:!1}function J(s){return qe()?s instanceof HTMLElement||s instanceof O(s).HTMLElement:!1}function wt(s){return!qe()||typeof ShadowRoot>"u"?!1:s instanceof ShadowRoot||s instanceof O(s).ShadowRoot}function Te(s){const{overflow:e,overflowX:t,overflowY:i,display:r}=q(s);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!["inline","contents"].includes(r)}function Hi(s){return["table","td","th"].includes(xe(s))}function je(s){return[":popover-open",":modal"].some(e=>{try{return s.matches(e)}catch{return!1}})}function ct(s){const e=ut(),t=V(s)?q(s):s;return["transform","translate","scale","rotate","perspective"].some(i=>t[i]?t[i]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(i=>(t.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(t.contain||"").includes(i))}function Ni(s){let e=oe(s);for(;J(e)&&!_e(e);){if(ct(e))return e;if(je(e))return null;e=oe(e)}return null}function ut(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function _e(s){return["html","body","#document"].includes(xe(s))}function q(s){return O(s).getComputedStyle(s)}function Ke(s){return V(s)?{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}:{scrollLeft:s.scrollX,scrollTop:s.scrollY}}function oe(s){if(xe(s)==="html")return s;const e=s.assignedSlot||s.parentNode||wt(s)&&s.host||Q(s);return wt(e)?e.host:e}function Qt(s){const e=oe(s);return _e(e)?s.ownerDocument?s.ownerDocument.body:s.body:J(e)&&Te(e)?e:Qt(e)}function Me(s,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=Qt(s),o=r===((i=s.ownerDocument)==null?void 0:i.body),n=O(r);if(o){const a=ot(n);return e.concat(n,n.visualViewport||[],Te(r)?r:[],a&&t?Me(a):[])}return e.concat(r,Me(r,[],t))}function ot(s){return s.parent&&Object.getPrototypeOf(s.parent)?s.frameElement:null}function Zt(s){const e=q(s);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=J(s),o=r?s.offsetWidth:t,n=r?s.offsetHeight:i,a=Ne(t)!==o||Ne(i)!==n;return a&&(t=o,i=n),{width:t,height:i,$:a}}function mt(s){return V(s)?s:s.contextElement}function pe(s){const e=mt(s);if(!J(e))return X(1);const t=e.getBoundingClientRect(),{width:i,height:r,$:o}=Zt(e);let n=(o?Ne(t.width):t.width)/i,a=(o?Ne(t.height):t.height)/r;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const Oi=X(0);function ei(s){const e=O(s);return!ut()||!e.visualViewport?Oi:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Pi(s,e,t){return e===void 0&&(e=!1),!t||e&&t!==O(s)?!1:e}function ue(s,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=s.getBoundingClientRect(),o=mt(s);let n=X(1);e&&(i?V(i)&&(n=pe(i)):n=pe(s));const a=Pi(o,t,i)?ei(o):X(0);let l=(r.left+a.x)/n.x,d=(r.top+a.y)/n.y,h=r.width/n.x,c=r.height/n.y;if(o){const u=O(o),f=i&&V(i)?O(i):i;let y=u,v=ot(y);for(;v&&i&&f!==y;){const b=pe(v),w=v.getBoundingClientRect(),z=q(v),k=w.left+(v.clientLeft+parseFloat(z.paddingLeft))*b.x,A=w.top+(v.clientTop+parseFloat(z.paddingTop))*b.y;l*=b.x,d*=b.y,h*=b.x,c*=b.y,l+=k,d+=A,y=O(v),v=ot(y)}}return Pe({width:h,height:c,x:l,y:d})}function gt(s,e){const t=Ke(s).scrollLeft;return e?e.left+t:ue(Q(s)).left+t}function ti(s,e,t){t===void 0&&(t=!1);const i=s.getBoundingClientRect(),r=i.left+e.scrollLeft-(t?0:gt(s,i)),o=i.top+e.scrollTop;return{x:r,y:o}}function $i(s){let{elements:e,rect:t,offsetParent:i,strategy:r}=s;const o=r==="fixed",n=Q(i),a=e?je(e.floating):!1;if(i===n||a&&o)return t;let l={scrollLeft:0,scrollTop:0},d=X(1);const h=X(0),c=J(i);if((c||!c&&!o)&&((xe(i)!=="body"||Te(n))&&(l=Ke(i)),J(i))){const f=ue(i);d=pe(i),h.x=f.x+i.clientLeft,h.y=f.y+i.clientTop}const u=n&&!c&&!o?ti(n,l,!0):X(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-l.scrollLeft*d.x+h.x+u.x,y:t.y*d.y-l.scrollTop*d.y+h.y+u.y}}function Wi(s){return Array.from(s.getClientRects())}function Bi(s){const e=Q(s),t=Ke(s),i=s.ownerDocument.body,r=fe(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=fe(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let n=-t.scrollLeft+gt(s);const a=-t.scrollTop;return q(i).direction==="rtl"&&(n+=fe(e.clientWidth,i.clientWidth)-r),{width:r,height:o,x:n,y:a}}function Ui(s,e){const t=O(s),i=Q(s),r=t.visualViewport;let o=i.clientWidth,n=i.clientHeight,a=0,l=0;if(r){o=r.width,n=r.height;const d=ut();(!d||d&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:o,height:n,x:a,y:l}}function Fi(s,e){const t=ue(s,!0,e==="fixed"),i=t.top+s.clientTop,r=t.left+s.clientLeft,o=J(s)?pe(s):X(1),n=s.clientWidth*o.x,a=s.clientHeight*o.y,l=r*o.x,d=i*o.y;return{width:n,height:a,x:l,y:d}}function _t(s,e,t){let i;if(e==="viewport")i=Ui(s,t);else if(e==="document")i=Bi(Q(s));else if(V(e))i=Fi(e,t);else{const r=ei(s);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return Pe(i)}function ii(s,e){const t=oe(s);return t===e||!V(t)||_e(t)?!1:q(t).position==="fixed"||ii(t,e)}function Gi(s,e){const t=e.get(s);if(t)return t;let i=Me(s,[],!1).filter(a=>V(a)&&xe(a)!=="body"),r=null;const o=q(s).position==="fixed";let n=o?oe(s):s;for(;V(n)&&!_e(n);){const a=q(n),l=ct(n);!l&&a.position==="fixed"&&(r=null),(o?!l&&!r:!l&&a.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||Te(n)&&!l&&ii(s,n))?i=i.filter(h=>h!==n):r=a,n=oe(n)}return e.set(s,i),i}function Vi(s){let{element:e,boundary:t,rootBoundary:i,strategy:r}=s;const n=[...t==="clippingAncestors"?je(e)?[]:Gi(e,this._c):[].concat(t),i],a=n[0],l=n.reduce((d,h)=>{const c=_t(e,h,r);return d.top=fe(c.top,d.top),d.right=st(c.right,d.right),d.bottom=st(c.bottom,d.bottom),d.left=fe(c.left,d.left),d},_t(e,a,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function qi(s){const{width:e,height:t}=Zt(s);return{width:e,height:t}}function ji(s,e,t){const i=J(e),r=Q(e),o=t==="fixed",n=ue(s,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=X(0);function d(){l.x=gt(r)}if(i||!i&&!o)if((xe(e)!=="body"||Te(r))&&(a=Ke(e)),i){const f=ue(e,!0,o,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else r&&d();o&&!i&&r&&d();const h=r&&!i&&!o?ti(r,a):X(0),c=n.left+a.scrollLeft-l.x-h.x,u=n.top+a.scrollTop-l.y-h.y;return{x:c,y:u,width:n.width,height:n.height}}function Qe(s){return q(s).position==="static"}function Et(s,e){if(!J(s)||q(s).position==="fixed")return null;if(e)return e(s);let t=s.offsetParent;return Q(s)===t&&(t=t.ownerDocument.body),t}function si(s,e){const t=O(s);if(je(s))return t;if(!J(s)){let r=oe(s);for(;r&&!_e(r);){if(V(r)&&!Qe(r))return r;r=oe(r)}return t}let i=Et(s,e);for(;i&&Hi(i)&&Qe(i);)i=Et(i,e);return i&&_e(i)&&Qe(i)&&!ct(i)?t:i||Ni(s)||t}const Ki=async function(s){const e=this.getOffsetParent||si,t=this.getDimensions,i=await t(s.floating);return{reference:ji(s.reference,await e(s.floating),s.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Yi(s){return q(s).direction==="rtl"}const Xi={convertOffsetParentRelativeRectToViewportRelativeRect:$i,getDocumentElement:Q,getClippingRect:Vi,getOffsetParent:si,getElementRects:Ki,getClientRects:Wi,getDimensions:qi,getScale:pe,isElement:V,isRTL:Yi};function ri(s,e){return s.x===e.x&&s.y===e.y&&s.width===e.width&&s.height===e.height}function Ji(s,e){let t=null,i;const r=Q(s);function o(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function n(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const d=s.getBoundingClientRect(),{left:h,top:c,width:u,height:f}=d;if(a||e(),!u||!f)return;const y=Le(c),v=Le(r.clientWidth-(h+u)),b=Le(r.clientHeight-(c+f)),w=Le(h),k={rootMargin:-y+"px "+-v+"px "+-b+"px "+-w+"px",threshold:fe(0,st(1,l))||1};let A=!0;function R(B){const $=B[0].intersectionRatio;if($!==l){if(!A)return n();$?n(!1,$):i=setTimeout(()=>{n(!1,1e-7)},1e3)}$===1&&!ri(d,s.getBoundingClientRect())&&n(),A=!1}try{t=new IntersectionObserver(R,{...k,root:r.ownerDocument})}catch{t=new IntersectionObserver(R,k)}t.observe(s)}return n(!0),o}function xt(s,e,t,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,d=mt(s),h=r||o?[...d?Me(d):[],...Me(e)]:[];h.forEach(w=>{r&&w.addEventListener("scroll",t,{passive:!0}),o&&w.addEventListener("resize",t)});const c=d&&a?Ji(d,t):null;let u=-1,f=null;n&&(f=new ResizeObserver(w=>{let[z]=w;z&&z.target===d&&f&&(f.unobserve(e),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var k;(k=f)==null||k.observe(e)})),t()}),d&&!l&&f.observe(d),f.observe(e));let y,v=l?ue(s):null;l&&b();function b(){const w=ue(s);v&&!ri(v,w)&&t(),v=w,y=requestAnimationFrame(b)}return t(),()=>{var w;h.forEach(z=>{r&&z.removeEventListener("scroll",t),o&&z.removeEventListener("resize",t)}),c==null||c(),(w=f)==null||w.disconnect(),f=null,l&&cancelAnimationFrame(y)}}const zt=Li,kt=Ti,Rt=(s,e,t)=>{const i=new Map,r={platform:Xi,...t},o={...r.platform,_c:i};return Di(s,e,{...r,platform:o})},ft=(s,e)=>{let t="The dashboard component encountered an error";typeof(e==null?void 0:e.dashboardId)=="string"&&(t+=` for dashboard with id ${e.dashboardId}`),typeof(e==null?void 0:e.dashboardSlug)=="string"&&(t+=` for dashboard with slug ${e.dashboardSlug}`),typeof(e==null?void 0:e.container)=="string"&&(t+=` in container ${e.container}`),s&&(t+=`:
25
- ${s}`,console.warn(t))},Qi=s=>{let e=!1,t="";const r=(document.body||document.documentElement).style,o={svg:!!("createElementNS"in document&&document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect),flexbox:r.webkitFlexWrap===""||r.flexWrap==="",postMessage:!!window.postMessage},n=["svg","flexbox","postMessage"];for(const h of n)o[h]||(e=!0,s.browserNotSupported=s.browserNotSupported||[],s.browserNotSupported.push(h),t+=`Your browser does not support: ${h}
26
- `);const a=window.navigator.userAgent,l=a.includes("MSIE"),d=a.includes("Trident/");(l||d)&&(e=!0,t="IE is not supported."),e&&ft(t)},W={appServer:"https://app.luzmo.com/",apiHost:"https://api.luzmo.com/",dashboardId:null,dashboardSlug:null,container:null,key:null,token:null,language:"auto",editorLanguage:"auto",qeVersion:null,editMode:null,screenMode:null,switchScreenModeOnResize:!0,itemId:null,theme:"",mainColor:"",accentColor:"",itemDimensions:{width:"auto",height:"auto"},loaderBackground:"#f9f9f9",loaderFontColor:"#5a5a5a",loaderSpinnerColor:"rgba(255, 165, 0, 0.7)",loaderSpinnerBackground:"rgba(169, 169, 169, 0.14)",timezoneId:null,contextId:null},oi=[{mode:"mobile",width:[150,767]},{mode:"tablet",width:[768,1199]},{mode:"desktop",width:[1200,1599]},{mode:"largeScreen",width:[1600,9999]},{mode:"fixed",width:[]}],At={initializing:{en:"Initializing...",nl:"Laden...",fr:"Chargement...",de:"Initialisiere...",es:"Inicializando..."}},Ae=s=>s?s.endsWith("/")?s:`${s}/`:"",te=s=>s?s.endsWith("/")?s.slice(0,-1):s:"",Zi=(s,e,t,i)=>{var a;const r=(l,d)=>{var v;const h=l.users.find(b=>b.id===d.id),c=h&&h.userAccessRight?{flagRead:h.userAccessRight.flagRead,flagUse:h.userAccessRight.flagUse,flagModify:h.userAccessRight.flagModify,flagOwn:h.userAccessRight.flagOwn}:{flagRead:!1,flagUse:!1,flagModify:!1,flagOwn:!1},f=l.groups.filter(b=>d.userGroups.includes(b.id)||b.public===!0).map(b=>{if(b.groupAccessRight)return b.groupAccessRight});for(const b of f)!c.flagRead&&b.flagRead&&(c.flagRead=b.flagRead),!c.flagUse&&b.flagUse&&(c.flagUse=b.flagUse),!c.flagModify&&b.flagModify&&(c.flagModify=b.flagModify),!c.flagOwn&&b.flagOwn&&(c.flagOwn=b.flagOwn);const y=((v=l.integrations)==null?void 0:v.length)>0?l.integrations.map(b=>{if(b.integrationAccessRight)return b.integrationAccessRight}):[];for(const b of y)!c.flagRead&&b.flagRead&&(c.flagRead=b.flagRead),!c.flagUse&&b.flagUse&&(c.flagUse=b.flagUse),!c.flagModify&&b.flagModify&&(c.flagModify=b.flagModify);return c},o=(l,d)=>{if(l==null)return"";if(typeof l!="object"||Object.keys(l).length===0)return typeof l=="object"&&Object.keys(l).length===0?"":l;let h;return h=d&&l[d]?l[d]:l[Object.keys(l)[0]],h==null&&(h=""),h},n=[];for(const l of s){const d={accessibleBy:[],accessRights:r(l,t),id:l.id,modifiedAt:l.modified_at,name:o(l.name,i.language),slug:null,tags:l.tags.map(y=>y.tag).sort((y,v)=>y.localeCompare(v))},h=l.integrations.find(y=>y.id===e);(a=h==null?void 0:h.integrationAccessRight)!=null&&a.slug&&(d.slug=h.integrationAccessRight.slug);const c=l.users.map(y=>({model:"User",id:y.id,name:o(y.name,t.locale_id)})),u=l.groups.map(y=>({model:"Group",id:y.id,name:o(y.name,t.locale_id)||{}})),f=l.integrations.map(y=>({model:"Integration",id:y.id,name:o(y.name,t.locale_id)||{}}));d.accessibleBy=[...c,...u,...f],n.push(d)}return n},es="0.0.0-unknown-luzmo",ts=s=>{const e=/^(%20|\s)*(javascript|data)/im,t=/[^\u0020-\u007E]/gim,i=/^([^:]+):/gm,r=new Set([".","/"]),o=d=>r.has(d[0]);if(!s)return"about:blank";const n=s.replaceAll(t,"").trim();if(o(n))return n;const a=n.match(i);if(!a)return n;const l=a[0];return e.test(l)?"about:blank":n},St=s=>JSON.parse(JSON.stringify(s)),is=s=>s&&typeof s=="object",nt=(s,e)=>(Object.entries(e).forEach(([t,i])=>{t in s?s[t]===void 0?s[t]=i:s[t]=is(i)?nt(s[t],i):s[t]:s[t]=i}),s),ge=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g,function(s){const e=Math.random()*16|0;return(s=="x"?e:e&3|8).toString(16)}),Mt=s=>{const e=[],{appServer:t,language:i,editorLanguage:r,qeVersion:o,loaderBackground:n,loaderSpinnerColor:a,loaderSpinnerBackground:l,loaderFontColor:d,screenMode:h,key:c,token:u,timezoneId:f,itemEmbedding:y,itemDimensions:v,dashboardId:b,dashboardSlug:w,itemId:z,theme:k,mainColor:A,accentColor:R,editMode:B}=s.params;i&&i!=="auto"&&e.push(`language=${i}`),r&&r!=="auto"&&e.push(`editorLanguage=${r}`),o&&e.push(`qe_version=${o}`),n&&e.push(`ldrbg=${n}`),d&&e.push(`ldrftclr=${d}`),a&&e.push(`ldrspclr=${a}`),l&&e.push(`ldrspbg=${l}`),k&&e.push(`theme=${k}`),A&&e.push(`mainColor=${A}`),R&&e.push(`accentColor=${R}`),h&&h!=="auto"&&e.push("screenMode=&{screenMode}"),f&&e.push("timezoneId="+f),y&&v&&v.width&&e.push("width="+v.width),y&&v&&v.height&&e.push("height="+v.height),B&&e.push("editMode="+B);const $=c&&u?"#"+c+":"+u:"";e.push("version="+(s.libVersion||es));const se=y?`${t}i/${b||w}/${z}?${encodeURIComponent(e.join("&"))}${$}`:`${t}i/${b||w}?${encodeURIComponent(e.join("&"))}${$}`;return ts(se)},Dt=s=>{let e;(s.params.error||s.browserNotSupported.length>0)&&(s.params.error=!0,s.browserNotSupported&&(e="Browser is not supported."));const t=At.initializing[s.params.language]||At.initializing.en;return s.browserNotSupported||s.params.error?{loadingMsg:t,errorMsg:e}:{loadingMsg:t,errorMsg:""}};function de(s,e,t){s.promises[e]&&(s.promises[e].resolve(t),delete s.promises[e])}function He(s,e,t){s.promises[e]&&(s.promises[e].reject(t),delete s.promises[e])}function ni(s){const e={};return s.params.loaderBackground&&!s.iframeLoaded&&(e.background=s.params.loaderBackground),e}function ss(s){var r;const e=((r=s.params.itemDimensions)==null?void 0:r.height)||W.itemDimensions.height,t=s.params.itemEmbedding&&e!=="auto";return{display:s.iframeLoaded?"none":"",height:`${t?e:s.minHeight}px`}}function rs(s){var t,i;const e=s.params.loaderBackground||W.loaderBackground;if(s.params.itemEmbedding){s.loaderSize=24,s.borderWidth=4,s.minHeight=200;const r=((t=s.params.itemDimensions)==null?void 0:t.width)||W.itemDimensions.width,o=((i=s.params.itemDimensions)==null?void 0:i.height)||W.itemDimensions.height,n=r!=="auto",a=o!=="auto";return{background:e,width:n?`${r}px`:"100%",height:`${a?o:"200"}px`,"min-height":a?"":"200px"}}return{background:e}}function os(s){const{loaderSpinnerColor:e,loaderSpinnerBackground:t}=W,i=Tt(s.borderWidth,s.params.loaderSpinnerColor||e),r=Tt(s.borderWidth,s.params.loaderSpinnerBackground||t),o=`${s.loaderSize}px`;return{"border-top":i,"border-right":i,"border-bottom":r,"border-left":r,width:o,height:o}}function ns(s){var o;const e=((o=s.params.itemDimensions)==null?void 0:o.height)||W.itemDimensions.height,t=s.params.itemEmbedding&&e!=="auto",i=n=>`${(n-s.loaderSize-32)/2}px`;return{padding:`${s.params.itemId?i(t?Number.parseInt(`${e}`,10):s.minHeight):"128px"} 16px`}}function Ct(s){var r,o;const e=((r=s.params.itemDimensions)==null?void 0:r.height)||W.itemDimensions.height,t=((o=s.params.itemDimensions)==null?void 0:o.width)||W.itemDimensions.width;s.params.itemEmbedding&&e!=="auto"?s.iframeHeight=`${e}px`:s.params.itemEmbedding?s.iframeHeight="200px":["editFull","editLimited"].includes(s.params.editMode)?s.iframeHeight="100%":s.iframeHeight="400px",s.iframeWidth=s.params.itemEmbedding&&t!=="auto"?`${t}px`:"100%";const i={height:s.iframeHeight,width:s.iframeWidth};return s.iframeLoaded?i.opacity=1:s.error?(i.opacity=1,i.width="100%",i.height="400px"):i.opacity=0,i}function Tt(s,e){return`${s}px solid ${e}`}const as=(s,e)=>{s!=null&&s.contentWindow&&s.contentWindow.location.replace(e)},It=(s,e,t)=>{const i=ge();return e!=null&&e.contentWindow?(e.contentWindow.postMessage({action:"exportDashboard",format:t||"png",_version:s.libVersion,requestId:i},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o},setTimeout(()=>{if(s.promises[i]){const n="exportDashboard request timed out.";s.promises[i].reject(new Error(n)),delete s.promises[i]}},12e5)})):Promise.reject(new Error("Cannot retrieve contentWindow."))},ls=async s=>{if(await s.updateComplete,(s.currentAuthKey??s.authKey)&&(s.currentAuthToken??s.authToken)){const e=new Promise((t,i)=>{(()=>{try{window.fetch(`${Ae(s.params.apiHost)}0.1.0/authorization`,{method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",body:JSON.stringify({action:"get",version:"0.1.0",key:s.currentAuthKey??s.authKey,token:s.currentAuthToken??s.authToken,find:{where:{id:s.authKey},attributes:["id","integration_id"],include:[{model:"User",attributes:["id","name","locale_id"],include:[{model:"Group"}]}]}})}).then(o=>o.json()).then(o=>{!o||!o.rows||o.rows.length===0||!o.rows[0].user?i("Authorization failed, please check authKey and authToken. If the problem persists, please contact support@luzmo.com."):(o.rows[0].user.userGroups=o.rows[0].user.groups.map(n=>n.id),delete o.rows[0].user.groups,t({integrationId:o.rows[0].integration_id,user:o.rows[0].user}))})}catch(r){i(r)}})()});return new Promise((t,i)=>void(()=>{try{e.then(r=>{window.fetch(`${Ae(s.params.apiHost)}0.1.0/securable`,{method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",body:JSON.stringify({action:"get",version:"0.1.0",key:s.currentAuthKey??s.authKey,token:s.currentAuthToken??s.authToken,find:{where:{type:"dashboard",is_variant:!1},attributes:["id","name","modified_at"],order:[["modified_at","desc"]],include:[{model:"Tag",attributes:["tag"]},{model:"User",attributes:["id","name"]},{model:"Group",attributes:["id","name","public"]},{model:"Integration",attributes:["id","name"]}]}})}).then(n=>n.json()).then(n=>{const a=n.rows.length>0?Zi(n.rows,r.integrationId,r.user,s):[];t(a)})}).catch(r=>{i(r)})}catch(r){i(r)}})())}throw new Error("No authKey or authToken found in the luzmo-dashboard component.")},ds=(s,e,t)=>{if(e!=null&&e.contentWindow){const i=ge();return e.contentWindow.postMessage({action:"getData",id:t,_version:s.libVersion,requestId:i},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o},setTimeout(()=>{if(s.promises[i]){const n="getData request timed out.";s.promises[i].reject(new Error(n)),delete s.promises[i]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},hs=(s,e)=>{if(e!=null&&e.contentWindow){const t=ge();return e.contentWindow.postMessage({action:"getFilters",_version:s.libVersion,requestId:t},"*"),new Promise((i,r)=>{s.promises[t]={resolve:i,reject:r},setTimeout(()=>{if(s.promises[t]){const o="getFilters request timed out.";s.promises[t].reject(new Error(o)),delete s.promises[t]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},Lt=(s,e,t)=>e?(e.contentWindow.postMessage({action:"refreshData",id:t??null,_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),cs=(s,e)=>e?(e.contentWindow.postMessage({action:"reloadDashboard",_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),us=(s,e,t,i)=>e?(e.contentWindow.postMessage({action:"setAuthorization",key:t,token:i,_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),ms=(s,e,t)=>{if(e&&e.contentWindow){const i=ge();return s.params.editMode===t?Promise.reject(new Error("editMode parameter is currently already set to "+t)):t!=="editFull"&&t!=="editLimited"&&t!=="view"?Promise.reject(new Error("The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'.")):(e.contentWindow.postMessage({action:"setEditMode",editMode:t,_version:s.libVersion,requestId:i},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o}}))}return Promise.reject(new Error("Cannot retrieve contentWindow."))},gs=(s,e,t,i)=>{if(e){const r=ge();return e.contentWindow.postMessage({action:"setSelectedData",itemId:t,filters:i,_version:s.libVersion,requestId:r},"*"),new Promise((o,n)=>{s.promises[r]={resolve:o,reject:n},setTimeout(()=>{if(s.promises[r]){const a="setSelectedData request timed out.";s.promises[r].reject(new Error(a)),delete s.promises[r]}},2e3)})}return Promise.reject()},fs=(s,e,t)=>{if(e){const i=ge();return e.contentWindow.postMessage({action:"setPreview",preview:t,requestId:i,_version:s.libVersion},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o},setTimeout(()=>{if(s.promises[i]){const n="setPreview request timed out.";s.promises[i].reject(new Error(n)),delete s.promises[i]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},Se=s=>{var l,d,h,c,u,f,y,v;if(!s.dimensions){s.params.error=!0,ft("Got no valid dimensions.",s.params);return}const e=Object.keys(s.dimensions),t=[];let i,r=0,o=0;if(!s.params.switchScreenModeOnResize&&s.currentScreenMode&&(s.params.screenMode=s.currentScreenMode),s.dimensions&&(e==null?void 0:e[0])==="fixed")i="fixed",r=s.dimensions.fixed[0],o=s.dimensions.fixed[1];else{const b=["mobile","tablet","desktop","largeScreen"];if(s.params.itemEmbedding){const[w]=e;let z=St(w);for(const k of b){const A=e.find(R=>R===k);A?z=St(A):s.dimensions[k]=s.dimensions[z]}}for(const w of e)if(b.includes(w)){const z=oi.find(k=>k.mode===w);t.push({...z,height:s.dimensions[w][1]||50})}if(t.map(w=>w.mode).includes(s.params.screenMode)||(s.params.screenMode="auto"),s.params.screenMode==="auto"){t.sort((w,z)=>b.indexOf(w.mode)-b.indexOf(z.mode));for(const w of t){const[z,k]=w.width;s.params.itemEmbedding&&s.params.itemDimensions&&s.params.itemDimensions.width!=="auto"&&s.params.itemDimensions.height==="auto"?z<s.params.itemDimensions.width&&(i=w.mode,r=Number.parseInt(s.params.itemDimensions.width,10),o=s.dimensions[i][1]):z<s.containerWidth&&(i=w.mode,s.params.itemEmbedding?(r=(l=s.params.itemDimensions)!=null&&l.width&&((d=s.params.itemDimensions)==null?void 0:d.width)!=="auto"?Number.parseInt(s.params.itemDimensions.width,10):Math.min(s.containerWidth,k),o=(h=s.params.itemDimensions)!=null&&h.height&&((c=s.params.itemDimensions)==null?void 0:c.height)!=="auto"?Number.parseInt(s.params.itemDimensions.height,10):s.dimensions[i][1],s.params.itemDimensions&&s.params.itemDimensions.width!=="auto"&&s.params.itemDimensions.height==="auto"&&(r=Number.parseInt(s.params.itemDimensions.width,10),o=s.dimensions[i][1])):(r=Math.max(Math.min(k,s.containerWidth),z),o=w.height))}}else{const{height:w,width:[z,k]}=t.find(A=>A.mode===s.params.screenMode);i=s.params.screenMode,r=Math.max(Math.min(k,s.containerWidth),z),o=w,s.params.itemEmbedding&&((u=s.params.itemDimensions)!=null&&u.width&&((f=s.params.itemDimensions)==null?void 0:f.width)!=="auto"&&(r=Number.parseInt(s.params.itemDimensions.width,10)),(y=s.params.itemDimensions)!=null&&y.height&&((v=s.params.itemDimensions)==null?void 0:v.height)!=="auto"&&(o=Number.parseInt(s.params.itemDimensions.height,10)))}if(!i&&t.length>0){const[w]=t;i=w.mode,r=w.width[0],o=w.height}}s.currentScreenMode=i;const n={height:o===0?"100%":`${String(o)}px`,width:r===0?"100%":`${String(r)}px`,opacity:1};["editFull","editLimited"].includes(s.params.editMode)?(n.height="100%",n.width="100%"):s.params.itemEmbedding&&s.params.itemDimensions?(n.height=s.params.itemDimensions.height==="auto"?n.height:`${String(s.params.itemDimensions.height).replace("px","")}px`,n.width=s.params.itemDimensions.width==="auto"?n.width:`${String(s.params.itemDimensions.width).replace("px","")}px`):(n.height=o===0?"100%":`${String(o)}px`,n.width=r===0?"100%":`${String(r)}px`),s.currentScreenMode=i,s.iframeStyle=n},Ht=s=>{const e=Object.keys(W),t=[],i=["appServer","language","apiHost"],r=["key","token","screenMode","timezoneId","itemId","container","loaderBackground","loaderFontColor","loaderSpinnerColor","loaderSpinnerBackground"],o=["itemDimensions"],n=["mobile","tablet","desktop","largeScreen","fixed","auto"];for(const a of e)s.params[a]===null&&delete s.params[a];s.params=nt(s.params,W),(!s.params.dashboardId||typeof s.params.dashboardId!="string")&&(!s.params.dashboardSlug||typeof s.params.dashboardSlug!="string")&&(delete s.params.dashboardId,delete s.params.dashboardSlug);for(const a of i)typeof s.params[a]!="string"&&(delete s.params[a],t.push(`${a} needs to be of type string.`));for(const a of r)typeof s.params[a]!="string"&&s.params[a]!==null&&s.params[a]!==void 0&&(delete s.params[a],t.push(`${a} needs to be of type string or empty.`));if(s.params.screenMode&&!n.includes(s.params.screenMode)){const a=n.map(l=>`"${l}"`).join(", ");t.push(`"screenMode" needs should be one of these types: ${a}`),s.params.screenMode="auto"}s.params.itemId&&(s.params.itemEmbedding=!0);for(const a of o)typeof s.params[a]!="object"&&s.params[a]!==null&&(delete s.params[a],t.push(`${a} needs to be of type object or empty.`));if(typeof s.params.switchScreenModeOnResize!="boolean"&&(t.push("switchScreenModeOnResize needs to be of type boolean."),s.params.switchScreenModeOnResize=!0),s.params.itemDimensions){const a=["width","height"];for(const l of a)!["string","number"].includes(typeof s.params.itemDimensions[l])&&s.params.itemDimensions[l]!==null&&t.push(`itemDimensions ${l} needs to be of type string, number or empty.`)}s.params=nt(s.params,W),s.params.screenMode&&s.params.screenMode!=="auto"&&(s.params.switchScreenModeOnResize=!1),s.params.itemDimensions.width!=="auto"&&(s.params.itemDimensions.width=Number.parseInt(`${s.params.itemDimensions.width}`.replace("px",""),10)||"auto"),s.params.itemDimensions.height!=="auto"&&(s.params.itemDimensions.height=Number.parseInt(`${s.params.itemDimensions.height}`.replace("px",""),10)||"auto"),s.params.itemEmbedding=!!s.params.itemId,(s.params.error||t.length>0)&&ft(t.join(`
27
- `),s.params)},Ze={type:"type",slots:"slots",options:"options",appServer:"app-server",apiHost:"api-host",authKey:"auth-key",authToken:"auth-token",contextId:"context-id",canFilter:"can-filter",filters:"filters",dashboardId:"dashboard-id",itemId:"item-id",dashboardContentsVersion:"dashboard-contents-version",libVersion:"lib-version"},at="luzmo-embed-container",Re={},ps=async(s,e)=>{const t=typeof s=="function"?await s():s,i=document.createElement("script");i.type="text/javascript",i.addEventListener("load",e),i.src=t,document.querySelectorAll("head")[0].append(i)},Nt=s=>({});async function ys(s){const e=Re[s];if(e.inited)return e.lib;if(e.format==="var")return new Promise(t=>{const i=()=>{e.inited||(e.lib=window[s],e.lib.init(Nt(e.from)),e.inited=!0),t(e.lib)};return ps(e.url,i)});if(["esm","systemjs"].includes(e.format))return new Promise((t,i)=>{(typeof e.url=="function"?e.url:()=>Promise.resolve(e.url))().then(o=>{import(o).then(n=>{if(!e.inited){const a=Nt(e.from);n.init(a),e.lib=n,e.lib.init(a),e.inited=!0}t(e.lib)}).catch(i)})})}function bs(s,e){if(!(s!=null&&s.default)&&e){const t=Object.create(null);return t.default=s,t.__esModule=!0,t}return s}async function vs(s,e){return ys(s).then(t=>t.get(e).then(i=>i()))}async function ne(s,e="DashboardApp"){const t=s+e;if(Re[t])return Re[t].module;let i=`${te(s)}/remoteEntry.mjs`;if(!s.startsWith("http://localhost"))switch(e){case"DashboardApp":case"VizItemApp":{i=`${te(s)}/dashboard-app/remoteEntry.mjs`;break}case"IQApp":{i=`${te(s)}/iq-components/remoteEntry.mjs`;break}}Re[t]={url:i,format:"esm",from:"vite",module:void 0};const r=await vs(t,`./${e}`),o=bs(r,!0);return Re[t].module=o,o}/**
20
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../property-Cu4Q1hS4.cjs"),Ee=require("../state-fyl3IYMu.cjs"),Ge=require("../query-D5qWDopr.cjs"),Je=require("../directive-BOOaQO_r.cjs"),ie=require("../luzmo-icons-DonyjSXg.cjs");require("../index-Dy_5M3M5.cjs");require("../index-CnP-Q5Bw.cjs");require("../index-DSQyBS9Z.cjs");const Yt=require("../base-D76d76ww-tT6yr8eb.cjs");require("../focusable-BxtpnzWp-CkK9AeMt.cjs");const vt=require("../color-B6LaL8qz.cjs"),pi=require("../query-all-CR2wWKRD.cjs"),yi=require("../item-list.cjs"),Qe=require("../index-Vdyb9z2D.cjs"),K=require("../set-locale-DCPlazsZ.cjs"),bi=require("../localized-decorator-DIXYZ3RL.cjs");require("../index-CYeQkVeJ.cjs");const rt=Math.min,fe=Math.max,Ne=Math.round,Le=Math.floor,X=s=>({x:s,y:s}),vi={left:"right",right:"left",bottom:"top",top:"bottom"},wi={start:"end",end:"start"};function ct(s,e){return typeof s=="function"?s(e):s}function we(s){return s.split("-")[0]}function Ve(s){return s.split("-")[1]}function _i(s){return s==="x"?"y":"x"}function Xt(s){return s==="y"?"height":"width"}function ce(s){return["top","bottom"].includes(we(s))?"y":"x"}function Jt(s){return _i(ce(s))}function Ei(s,e,t){t===void 0&&(t=!1);const i=Ve(s),r=Jt(s),o=Xt(r);let n=r==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(n=Oe(n)),[n,Oe(n)]}function xi(s){const e=Oe(s);return[ot(s),e,ot(e)]}function ot(s){return s.replace(/start|end/g,e=>wi[e])}function zi(s,e,t){const i=["left","right"],r=["right","left"],o=["top","bottom"],n=["bottom","top"];switch(s){case"top":case"bottom":return t?e?r:i:e?i:r;case"left":case"right":return e?o:n;default:return[]}}function ki(s,e,t,i){const r=Ve(s);let o=zi(we(s),t==="start",i);return r&&(o=o.map(n=>n+"-"+r),e&&(o=o.concat(o.map(ot)))),o}function Oe(s){return s.replace(/left|right|bottom|top/g,e=>vi[e])}function Ri(s){return{top:0,right:0,bottom:0,left:0,...s}}function Si(s){return typeof s!="number"?Ri(s):{top:s,right:s,bottom:s,left:s}}function Pe(s){const{x:e,y:t,width:i,height:r}=s;return{width:i,height:r,top:t,left:e,right:e+i,bottom:t+r,x:e,y:t}}function wt(s,e,t){let{reference:i,floating:r}=s;const o=ce(e),n=Jt(e),a=Xt(n),l=we(e),d=o==="y",h=i.x+i.width/2-r.width/2,c=i.y+i.height/2-r.height/2,u=i[a]/2-r[a]/2;let f;switch(l){case"top":f={x:h,y:i.y-r.height};break;case"bottom":f={x:h,y:i.y+i.height};break;case"right":f={x:i.x+i.width,y:c};break;case"left":f={x:i.x-r.width,y:c};break;default:f={x:i.x,y:i.y}}switch(Ve(e)){case"start":f[n]-=u*(t&&d?-1:1);break;case"end":f[n]+=u*(t&&d?-1:1);break}return f}const Ai=async(s,e,t)=>{const{placement:i="bottom",strategy:r="absolute",middleware:o=[],platform:n}=t,a=o.filter(Boolean),l=await(n.isRTL==null?void 0:n.isRTL(e));let d=await n.getElementRects({reference:s,floating:e,strategy:r}),{x:h,y:c}=wt(d,i,l),u=i,f={},y=0;for(let v=0;v<a.length;v++){const{name:b,fn:w}=a[v],{x:z,y:k,data:S,reset:R}=await w({x:h,y:c,initialPlacement:i,placement:u,strategy:r,middlewareData:f,rects:d,platform:n,elements:{reference:s,floating:e}});h=z??h,c=k??c,f={...f,[b]:{...f[b],...S}},R&&y<=50&&(y++,typeof R=="object"&&(R.placement&&(u=R.placement),R.rects&&(d=R.rects===!0?await n.getElementRects({reference:s,floating:e,strategy:r}):R.rects),{x:h,y:c}=wt(d,u,l)),v=-1)}return{x:h,y:c,placement:u,strategy:r,middlewareData:f}};async function Mi(s,e){var t;e===void 0&&(e={});const{x:i,y:r,platform:o,rects:n,elements:a,strategy:l}=s,{boundary:d="clippingAncestors",rootBoundary:h="viewport",elementContext:c="floating",altBoundary:u=!1,padding:f=0}=ct(e,s),y=Si(f),b=a[u?c==="floating"?"reference":"floating":c],w=Pe(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(b)))==null||t?b:b.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:d,rootBoundary:h,strategy:l})),z=c==="floating"?{x:i,y:r,width:n.floating.width,height:n.floating.height}:n.reference,k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),S=await(o.isElement==null?void 0:o.isElement(k))?await(o.getScale==null?void 0:o.getScale(k))||{x:1,y:1}:{x:1,y:1},R=Pe(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:z,offsetParent:k,strategy:l}):z);return{top:(w.top-R.top+y.top)/S.y,bottom:(R.bottom-w.bottom+y.bottom)/S.y,left:(w.left-R.left+y.left)/S.x,right:(R.right-w.right+y.right)/S.x}}const Di=function(s){return s===void 0&&(s={}),{name:"flip",options:s,async fn(e){var t,i;const{placement:r,middlewareData:o,rects:n,initialPlacement:a,platform:l,elements:d}=e,{mainAxis:h=!0,crossAxis:c=!0,fallbackPlacements:u,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:v=!0,...b}=ct(s,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const w=we(r),z=ce(a),k=we(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(d.floating)),R=u||(k||!v?[Oe(a)]:xi(a)),B=y!=="none";!u&&B&&R.push(...ki(a,v,y,S));const $=[a,...R],se=await Mi(e,b),U=[];let T=((i=o.flip)==null?void 0:i.overflows)||[];if(h&&U.push(se[w]),c){const D=Ei(r,n,S);U.push(se[D[0]],se[D[1]])}if(T=[...T,{placement:r,overflows:U}],!U.every(D=>D<=0)){var Te,L;const D=(((Te=o.flip)==null?void 0:Te.index)||0)+1,ae=$[D];if(ae&&(!(c==="alignment"?z!==ce(ae):!1)||T.every(F=>F.overflows[0]>0&&ce(F.placement)===z)))return{data:{index:D,overflows:T},reset:{placement:ae}};let ze=(L=T.filter(le=>le.overflows[0]<=0).sort((le,F)=>le.overflows[1]-F.overflows[1])[0])==null?void 0:L.placement;if(!ze)switch(f){case"bestFit":{var Z;const le=(Z=T.filter(F=>{if(B){const re=ce(F.placement);return re===z||re==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(re=>re>0).reduce((re,fi)=>re+fi,0)]).sort((F,re)=>F[1]-re[1])[0])==null?void 0:Z[0];le&&(ze=le);break}case"initialPlacement":ze=a;break}if(r!==ze)return{reset:{placement:ze}}}return{}}}};async function Ci(s,e){const{placement:t,platform:i,elements:r}=s,o=await(i.isRTL==null?void 0:i.isRTL(r.floating)),n=we(t),a=Ve(t),l=ce(t)==="y",d=["left","top"].includes(n)?-1:1,h=o&&l?-1:1,c=ct(e,s);let{mainAxis:u,crossAxis:f,alignmentAxis:y}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return a&&typeof y=="number"&&(f=a==="end"?y*-1:y),l?{x:f*h,y:u*d}:{x:u*d,y:f*h}}const Ii=function(s){return s===void 0&&(s=0),{name:"offset",options:s,async fn(e){var t,i;const{x:r,y:o,placement:n,middlewareData:a}=e,l=await Ci(e,s);return n===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+l.x,y:o+l.y,data:{...l,placement:n}}}}};function qe(){return typeof window<"u"}function xe(s){return Qt(s)?(s.nodeName||"").toLowerCase():"#document"}function O(s){var e;return(s==null||(e=s.ownerDocument)==null?void 0:e.defaultView)||window}function Q(s){var e;return(e=(Qt(s)?s.ownerDocument:s.document)||window.document)==null?void 0:e.documentElement}function Qt(s){return qe()?s instanceof Node||s instanceof O(s).Node:!1}function V(s){return qe()?s instanceof Element||s instanceof O(s).Element:!1}function J(s){return qe()?s instanceof HTMLElement||s instanceof O(s).HTMLElement:!1}function _t(s){return!qe()||typeof ShadowRoot>"u"?!1:s instanceof ShadowRoot||s instanceof O(s).ShadowRoot}function Ie(s){const{overflow:e,overflowX:t,overflowY:i,display:r}=q(s);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!["inline","contents"].includes(r)}function Ti(s){return["table","td","th"].includes(xe(s))}function je(s){return[":popover-open",":modal"].some(e=>{try{return s.matches(e)}catch{return!1}})}function ut(s){const e=mt(),t=V(s)?q(s):s;return["transform","translate","scale","rotate","perspective"].some(i=>t[i]?t[i]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(i=>(t.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(t.contain||"").includes(i))}function Li(s){let e=oe(s);for(;J(e)&&!_e(e);){if(ut(e))return e;if(je(e))return null;e=oe(e)}return null}function mt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function _e(s){return["html","body","#document"].includes(xe(s))}function q(s){return O(s).getComputedStyle(s)}function Ke(s){return V(s)?{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}:{scrollLeft:s.scrollX,scrollTop:s.scrollY}}function oe(s){if(xe(s)==="html")return s;const e=s.assignedSlot||s.parentNode||_t(s)&&s.host||Q(s);return _t(e)?e.host:e}function Zt(s){const e=oe(s);return _e(e)?s.ownerDocument?s.ownerDocument.body:s.body:J(e)&&Ie(e)?e:Zt(e)}function Me(s,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=Zt(s),o=r===((i=s.ownerDocument)==null?void 0:i.body),n=O(r);if(o){const a=nt(n);return e.concat(n,n.visualViewport||[],Ie(r)?r:[],a&&t?Me(a):[])}return e.concat(r,Me(r,[],t))}function nt(s){return s.parent&&Object.getPrototypeOf(s.parent)?s.frameElement:null}function ei(s){const e=q(s);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=J(s),o=r?s.offsetWidth:t,n=r?s.offsetHeight:i,a=Ne(t)!==o||Ne(i)!==n;return a&&(t=o,i=n),{width:t,height:i,$:a}}function gt(s){return V(s)?s:s.contextElement}function pe(s){const e=gt(s);if(!J(e))return X(1);const t=e.getBoundingClientRect(),{width:i,height:r,$:o}=ei(e);let n=(o?Ne(t.width):t.width)/i,a=(o?Ne(t.height):t.height)/r;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const Hi=X(0);function ti(s){const e=O(s);return!mt()||!e.visualViewport?Hi:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Ni(s,e,t){return e===void 0&&(e=!1),!t||e&&t!==O(s)?!1:e}function ue(s,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=s.getBoundingClientRect(),o=gt(s);let n=X(1);e&&(i?V(i)&&(n=pe(i)):n=pe(s));const a=Ni(o,t,i)?ti(o):X(0);let l=(r.left+a.x)/n.x,d=(r.top+a.y)/n.y,h=r.width/n.x,c=r.height/n.y;if(o){const u=O(o),f=i&&V(i)?O(i):i;let y=u,v=nt(y);for(;v&&i&&f!==y;){const b=pe(v),w=v.getBoundingClientRect(),z=q(v),k=w.left+(v.clientLeft+parseFloat(z.paddingLeft))*b.x,S=w.top+(v.clientTop+parseFloat(z.paddingTop))*b.y;l*=b.x,d*=b.y,h*=b.x,c*=b.y,l+=k,d+=S,y=O(v),v=nt(y)}}return Pe({width:h,height:c,x:l,y:d})}function ft(s,e){const t=Ke(s).scrollLeft;return e?e.left+t:ue(Q(s)).left+t}function ii(s,e,t){t===void 0&&(t=!1);const i=s.getBoundingClientRect(),r=i.left+e.scrollLeft-(t?0:ft(s,i)),o=i.top+e.scrollTop;return{x:r,y:o}}function Oi(s){let{elements:e,rect:t,offsetParent:i,strategy:r}=s;const o=r==="fixed",n=Q(i),a=e?je(e.floating):!1;if(i===n||a&&o)return t;let l={scrollLeft:0,scrollTop:0},d=X(1);const h=X(0),c=J(i);if((c||!c&&!o)&&((xe(i)!=="body"||Ie(n))&&(l=Ke(i)),J(i))){const f=ue(i);d=pe(i),h.x=f.x+i.clientLeft,h.y=f.y+i.clientTop}const u=n&&!c&&!o?ii(n,l,!0):X(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-l.scrollLeft*d.x+h.x+u.x,y:t.y*d.y-l.scrollTop*d.y+h.y+u.y}}function Pi(s){return Array.from(s.getClientRects())}function $i(s){const e=Q(s),t=Ke(s),i=s.ownerDocument.body,r=fe(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=fe(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let n=-t.scrollLeft+ft(s);const a=-t.scrollTop;return q(i).direction==="rtl"&&(n+=fe(e.clientWidth,i.clientWidth)-r),{width:r,height:o,x:n,y:a}}function Wi(s,e){const t=O(s),i=Q(s),r=t.visualViewport;let o=i.clientWidth,n=i.clientHeight,a=0,l=0;if(r){o=r.width,n=r.height;const d=mt();(!d||d&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:o,height:n,x:a,y:l}}function Bi(s,e){const t=ue(s,!0,e==="fixed"),i=t.top+s.clientTop,r=t.left+s.clientLeft,o=J(s)?pe(s):X(1),n=s.clientWidth*o.x,a=s.clientHeight*o.y,l=r*o.x,d=i*o.y;return{width:n,height:a,x:l,y:d}}function Et(s,e,t){let i;if(e==="viewport")i=Wi(s,t);else if(e==="document")i=$i(Q(s));else if(V(e))i=Bi(e,t);else{const r=ti(s);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return Pe(i)}function si(s,e){const t=oe(s);return t===e||!V(t)||_e(t)?!1:q(t).position==="fixed"||si(t,e)}function Ui(s,e){const t=e.get(s);if(t)return t;let i=Me(s,[],!1).filter(a=>V(a)&&xe(a)!=="body"),r=null;const o=q(s).position==="fixed";let n=o?oe(s):s;for(;V(n)&&!_e(n);){const a=q(n),l=ut(n);!l&&a.position==="fixed"&&(r=null),(o?!l&&!r:!l&&a.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||Ie(n)&&!l&&si(s,n))?i=i.filter(h=>h!==n):r=a,n=oe(n)}return e.set(s,i),i}function Fi(s){let{element:e,boundary:t,rootBoundary:i,strategy:r}=s;const n=[...t==="clippingAncestors"?je(e)?[]:Ui(e,this._c):[].concat(t),i],a=n[0],l=n.reduce((d,h)=>{const c=Et(e,h,r);return d.top=fe(c.top,d.top),d.right=rt(c.right,d.right),d.bottom=rt(c.bottom,d.bottom),d.left=fe(c.left,d.left),d},Et(e,a,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Gi(s){const{width:e,height:t}=ei(s);return{width:e,height:t}}function Vi(s,e,t){const i=J(e),r=Q(e),o=t==="fixed",n=ue(s,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=X(0);function d(){l.x=ft(r)}if(i||!i&&!o)if((xe(e)!=="body"||Ie(r))&&(a=Ke(e)),i){const f=ue(e,!0,o,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else r&&d();o&&!i&&r&&d();const h=r&&!i&&!o?ii(r,a):X(0),c=n.left+a.scrollLeft-l.x-h.x,u=n.top+a.scrollTop-l.y-h.y;return{x:c,y:u,width:n.width,height:n.height}}function Ze(s){return q(s).position==="static"}function xt(s,e){if(!J(s)||q(s).position==="fixed")return null;if(e)return e(s);let t=s.offsetParent;return Q(s)===t&&(t=t.ownerDocument.body),t}function ri(s,e){const t=O(s);if(je(s))return t;if(!J(s)){let r=oe(s);for(;r&&!_e(r);){if(V(r)&&!Ze(r))return r;r=oe(r)}return t}let i=xt(s,e);for(;i&&Ti(i)&&Ze(i);)i=xt(i,e);return i&&_e(i)&&Ze(i)&&!ut(i)?t:i||Li(s)||t}const qi=async function(s){const e=this.getOffsetParent||ri,t=this.getDimensions,i=await t(s.floating);return{reference:Vi(s.reference,await e(s.floating),s.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function ji(s){return q(s).direction==="rtl"}const Ki={convertOffsetParentRelativeRectToViewportRelativeRect:Oi,getDocumentElement:Q,getClippingRect:Fi,getOffsetParent:ri,getElementRects:qi,getClientRects:Pi,getDimensions:Gi,getScale:pe,isElement:V,isRTL:ji};function oi(s,e){return s.x===e.x&&s.y===e.y&&s.width===e.width&&s.height===e.height}function Yi(s,e){let t=null,i;const r=Q(s);function o(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function n(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const d=s.getBoundingClientRect(),{left:h,top:c,width:u,height:f}=d;if(a||e(),!u||!f)return;const y=Le(c),v=Le(r.clientWidth-(h+u)),b=Le(r.clientHeight-(c+f)),w=Le(h),k={rootMargin:-y+"px "+-v+"px "+-b+"px "+-w+"px",threshold:fe(0,rt(1,l))||1};let S=!0;function R(B){const $=B[0].intersectionRatio;if($!==l){if(!S)return n();$?n(!1,$):i=setTimeout(()=>{n(!1,1e-7)},1e3)}$===1&&!oi(d,s.getBoundingClientRect())&&n(),S=!1}try{t=new IntersectionObserver(R,{...k,root:r.ownerDocument})}catch{t=new IntersectionObserver(R,k)}t.observe(s)}return n(!0),o}function zt(s,e,t,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,d=gt(s),h=r||o?[...d?Me(d):[],...Me(e)]:[];h.forEach(w=>{r&&w.addEventListener("scroll",t,{passive:!0}),o&&w.addEventListener("resize",t)});const c=d&&a?Yi(d,t):null;let u=-1,f=null;n&&(f=new ResizeObserver(w=>{let[z]=w;z&&z.target===d&&f&&(f.unobserve(e),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var k;(k=f)==null||k.observe(e)})),t()}),d&&!l&&f.observe(d),f.observe(e));let y,v=l?ue(s):null;l&&b();function b(){const w=ue(s);v&&!oi(v,w)&&t(),v=w,y=requestAnimationFrame(b)}return t(),()=>{var w;h.forEach(z=>{r&&z.removeEventListener("scroll",t),o&&z.removeEventListener("resize",t)}),c==null||c(),(w=f)==null||w.disconnect(),f=null,l&&cancelAnimationFrame(y)}}const kt=Ii,Rt=Di,St=(s,e,t)=>{const i=new Map,r={platform:Ki,...t},o={...r.platform,_c:i};return Ai(s,e,{...r,platform:o})},pt=(s,e)=>{let t="The dashboard component encountered an error";typeof(e==null?void 0:e.dashboardId)=="string"&&(t+=` for dashboard with id ${e.dashboardId}`),typeof(e==null?void 0:e.dashboardSlug)=="string"&&(t+=` for dashboard with slug ${e.dashboardSlug}`),typeof(e==null?void 0:e.container)=="string"&&(t+=` in container ${e.container}`),s&&(t+=`:
21
+ ${s}`,console.warn(t))},Xi=s=>{let e=!1,t="";const r=(document.body||document.documentElement).style,o={svg:!!("createElementNS"in document&&document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect),flexbox:r.webkitFlexWrap===""||r.flexWrap==="",postMessage:!!window.postMessage},n=["svg","flexbox","postMessage"];for(const h of n)o[h]||(e=!0,s.browserNotSupported=s.browserNotSupported||[],s.browserNotSupported.push(h),t+=`Your browser does not support: ${h}
22
+ `);const a=window.navigator.userAgent,l=a.includes("MSIE"),d=a.includes("Trident/");(l||d)&&(e=!0,t="IE is not supported."),e&&pt(t)},W={appServer:"https://app.luzmo.com/",apiHost:"https://api.luzmo.com/",dashboardId:null,dashboardSlug:null,container:null,key:null,token:null,language:"auto",editorLanguage:"auto",qeVersion:null,editMode:null,screenMode:null,switchScreenModeOnResize:!0,itemId:null,theme:"",mainColor:"",accentColor:"",itemDimensions:{width:"auto",height:"auto"},loaderBackground:"#f9f9f9",loaderFontColor:"#5a5a5a",loaderSpinnerColor:"rgba(255, 165, 0, 0.7)",loaderSpinnerBackground:"rgba(169, 169, 169, 0.14)",timezoneId:null,contextId:null},ni=[{mode:"mobile",width:[150,767]},{mode:"tablet",width:[768,1199]},{mode:"desktop",width:[1200,1599]},{mode:"largeScreen",width:[1600,9999]},{mode:"fixed",width:[]}],At={initializing:{en:"Initializing...",nl:"Laden...",fr:"Chargement...",de:"Initialisiere...",es:"Inicializando..."}},Se=s=>s?s.endsWith("/")?s:`${s}/`:"",te=s=>s?s.endsWith("/")?s.slice(0,-1):s:"",Ji=(s,e,t,i)=>{var a;const r=(l,d)=>{var v;const h=l.users.find(b=>b.id===d.id),c=h&&h.userAccessRight?{flagRead:h.userAccessRight.flagRead,flagUse:h.userAccessRight.flagUse,flagModify:h.userAccessRight.flagModify,flagOwn:h.userAccessRight.flagOwn}:{flagRead:!1,flagUse:!1,flagModify:!1,flagOwn:!1},f=l.groups.filter(b=>d.userGroups.includes(b.id)||b.public===!0).map(b=>{if(b.groupAccessRight)return b.groupAccessRight});for(const b of f)!c.flagRead&&b.flagRead&&(c.flagRead=b.flagRead),!c.flagUse&&b.flagUse&&(c.flagUse=b.flagUse),!c.flagModify&&b.flagModify&&(c.flagModify=b.flagModify),!c.flagOwn&&b.flagOwn&&(c.flagOwn=b.flagOwn);const y=((v=l.integrations)==null?void 0:v.length)>0?l.integrations.map(b=>{if(b.integrationAccessRight)return b.integrationAccessRight}):[];for(const b of y)!c.flagRead&&b.flagRead&&(c.flagRead=b.flagRead),!c.flagUse&&b.flagUse&&(c.flagUse=b.flagUse),!c.flagModify&&b.flagModify&&(c.flagModify=b.flagModify);return c},o=(l,d)=>{if(l==null)return"";if(typeof l!="object"||Object.keys(l).length===0)return typeof l=="object"&&Object.keys(l).length===0?"":l;let h;return h=d&&l[d]?l[d]:l[Object.keys(l)[0]],h==null&&(h=""),h},n=[];for(const l of s){const d={accessibleBy:[],accessRights:r(l,t),id:l.id,modifiedAt:l.modified_at,name:o(l.name,i.language),slug:null,tags:l.tags.map(y=>y.tag).sort((y,v)=>y.localeCompare(v))},h=l.integrations.find(y=>y.id===e);(a=h==null?void 0:h.integrationAccessRight)!=null&&a.slug&&(d.slug=h.integrationAccessRight.slug);const c=l.users.map(y=>({model:"User",id:y.id,name:o(y.name,t.locale_id)})),u=l.groups.map(y=>({model:"Group",id:y.id,name:o(y.name,t.locale_id)||{}})),f=l.integrations.map(y=>({model:"Integration",id:y.id,name:o(y.name,t.locale_id)||{}}));d.accessibleBy=[...c,...u,...f],n.push(d)}return n},Qi="0.0.0-unknown-luzmo",Zi=s=>{const e=/^(%20|\s)*(javascript|data)/im,t=/[^\u0020-\u007E]/gim,i=/^([^:]+):/gm,r=new Set([".","/"]),o=d=>r.has(d[0]);if(!s)return"about:blank";const n=s.replaceAll(t,"").trim();if(o(n))return n;const a=n.match(i);if(!a)return n;const l=a[0];return e.test(l)?"about:blank":n},Mt=s=>JSON.parse(JSON.stringify(s)),es=s=>s&&typeof s=="object",at=(s,e)=>(Object.entries(e).forEach(([t,i])=>{t in s?s[t]===void 0?s[t]=i:s[t]=es(i)?at(s[t],i):s[t]:s[t]=i}),s),ge=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g,function(s){const e=Math.random()*16|0;return(s=="x"?e:e&3|8).toString(16)}),Dt=s=>{const e=[],{appServer:t,language:i,editorLanguage:r,qeVersion:o,loaderBackground:n,loaderSpinnerColor:a,loaderSpinnerBackground:l,loaderFontColor:d,screenMode:h,key:c,token:u,timezoneId:f,itemEmbedding:y,itemDimensions:v,dashboardId:b,dashboardSlug:w,itemId:z,theme:k,mainColor:S,accentColor:R,editMode:B}=s.params;i&&i!=="auto"&&e.push(`language=${i}`),r&&r!=="auto"&&e.push(`editorLanguage=${r}`),o&&e.push(`qe_version=${o}`),n&&e.push(`ldrbg=${n}`),d&&e.push(`ldrftclr=${d}`),a&&e.push(`ldrspclr=${a}`),l&&e.push(`ldrspbg=${l}`),k&&e.push(`theme=${k}`),S&&e.push(`mainColor=${S}`),R&&e.push(`accentColor=${R}`),h&&h!=="auto"&&e.push("screenMode=&{screenMode}"),f&&e.push("timezoneId="+f),y&&v&&v.width&&e.push("width="+v.width),y&&v&&v.height&&e.push("height="+v.height),B&&e.push("editMode="+B);const $=c&&u?"#"+c+":"+u:"";e.push("version="+(s.libVersion||Qi));const se=y?`${t}i/${b||w}/${z}?${encodeURIComponent(e.join("&"))}${$}`:`${t}i/${b||w}?${encodeURIComponent(e.join("&"))}${$}`;return Zi(se)},Ct=s=>{let e;(s.params.error||s.browserNotSupported.length>0)&&(s.params.error=!0,s.browserNotSupported&&(e="Browser is not supported."));const t=At.initializing[s.params.language]||At.initializing.en;return s.browserNotSupported||s.params.error?{loadingMsg:t,errorMsg:e}:{loadingMsg:t,errorMsg:""}};function de(s,e,t){s.promises[e]&&(s.promises[e].resolve(t),delete s.promises[e])}function He(s,e,t){s.promises[e]&&(s.promises[e].reject(t),delete s.promises[e])}function ai(s){const e={};return s.params.loaderBackground&&!s.iframeLoaded&&(e.background=s.params.loaderBackground),e}function ts(s){var r;const e=((r=s.params.itemDimensions)==null?void 0:r.height)||W.itemDimensions.height,t=s.params.itemEmbedding&&e!=="auto";return{display:s.iframeLoaded?"none":"",height:`${t?e:s.minHeight}px`}}function is(s){var t,i;const e=s.params.loaderBackground||W.loaderBackground;if(s.params.itemEmbedding){s.loaderSize=24,s.borderWidth=4,s.minHeight=200;const r=((t=s.params.itemDimensions)==null?void 0:t.width)||W.itemDimensions.width,o=((i=s.params.itemDimensions)==null?void 0:i.height)||W.itemDimensions.height,n=r!=="auto",a=o!=="auto";return{background:e,width:n?`${r}px`:"100%",height:`${a?o:"200"}px`,"min-height":a?"":"200px"}}return{background:e}}function ss(s){const{loaderSpinnerColor:e,loaderSpinnerBackground:t}=W,i=Tt(s.borderWidth,s.params.loaderSpinnerColor||e),r=Tt(s.borderWidth,s.params.loaderSpinnerBackground||t),o=`${s.loaderSize}px`;return{"border-top":i,"border-right":i,"border-bottom":r,"border-left":r,width:o,height:o}}function rs(s){var o;const e=((o=s.params.itemDimensions)==null?void 0:o.height)||W.itemDimensions.height,t=s.params.itemEmbedding&&e!=="auto",i=n=>`${(n-s.loaderSize-32)/2}px`;return{padding:`${s.params.itemId?i(t?Number.parseInt(`${e}`,10):s.minHeight):"128px"} 16px`}}function It(s){var r,o;const e=((r=s.params.itemDimensions)==null?void 0:r.height)||W.itemDimensions.height,t=((o=s.params.itemDimensions)==null?void 0:o.width)||W.itemDimensions.width;s.params.itemEmbedding&&e!=="auto"?s.iframeHeight=`${e}px`:s.params.itemEmbedding?s.iframeHeight="200px":["editFull","editLimited"].includes(s.params.editMode)?s.iframeHeight="100%":s.iframeHeight="400px",s.iframeWidth=s.params.itemEmbedding&&t!=="auto"?`${t}px`:"100%";const i={height:s.iframeHeight,width:s.iframeWidth};return s.iframeLoaded?i.opacity=1:s.error?(i.opacity=1,i.width="100%",i.height="400px"):i.opacity=0,i}function Tt(s,e){return`${s}px solid ${e}`}const os=(s,e)=>{s!=null&&s.contentWindow&&s.contentWindow.location.replace(e)},Lt=(s,e,t)=>{const i=ge();return e!=null&&e.contentWindow?(e.contentWindow.postMessage({action:"exportDashboard",format:t||"png",_version:s.libVersion,requestId:i},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o},setTimeout(()=>{if(s.promises[i]){const n="exportDashboard request timed out.";s.promises[i].reject(new Error(n)),delete s.promises[i]}},12e5)})):Promise.reject(new Error("Cannot retrieve contentWindow."))},ns=async s=>{if(await s.updateComplete,(s.currentAuthKey??s.authKey)&&(s.currentAuthToken??s.authToken)){const e=new Promise((t,i)=>{(()=>{try{window.fetch(`${Se(s.params.apiHost)}0.1.0/authorization`,{method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",body:JSON.stringify({action:"get",version:"0.1.0",key:s.currentAuthKey??s.authKey,token:s.currentAuthToken??s.authToken,find:{where:{id:s.authKey},attributes:["id","integration_id"],include:[{model:"User",attributes:["id","name","locale_id"],include:[{model:"Group"}]}]}})}).then(o=>o.json()).then(o=>{!o||!o.rows||o.rows.length===0||!o.rows[0].user?i("Authorization failed, please check authKey and authToken. If the problem persists, please contact support@luzmo.com."):(o.rows[0].user.userGroups=o.rows[0].user.groups.map(n=>n.id),delete o.rows[0].user.groups,t({integrationId:o.rows[0].integration_id,user:o.rows[0].user}))})}catch(r){i(r)}})()});return new Promise((t,i)=>void(()=>{try{e.then(r=>{window.fetch(`${Se(s.params.apiHost)}0.1.0/securable`,{method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",body:JSON.stringify({action:"get",version:"0.1.0",key:s.currentAuthKey??s.authKey,token:s.currentAuthToken??s.authToken,find:{where:{type:"dashboard",is_variant:!1},attributes:["id","name","modified_at"],order:[["modified_at","desc"]],include:[{model:"Tag",attributes:["tag"]},{model:"User",attributes:["id","name"]},{model:"Group",attributes:["id","name","public"]},{model:"Integration",attributes:["id","name"]}]}})}).then(n=>n.json()).then(n=>{const a=n.rows.length>0?Ji(n.rows,r.integrationId,r.user,s):[];t(a)})}).catch(r=>{i(r)})}catch(r){i(r)}})())}throw new Error("No authKey or authToken found in the luzmo-dashboard component.")},as=(s,e,t)=>{if(e!=null&&e.contentWindow){const i=ge();return e.contentWindow.postMessage({action:"getData",id:t,_version:s.libVersion,requestId:i},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o},setTimeout(()=>{if(s.promises[i]){const n="getData request timed out.";s.promises[i].reject(new Error(n)),delete s.promises[i]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},ls=(s,e)=>{if(e!=null&&e.contentWindow){const t=ge();return e.contentWindow.postMessage({action:"getFilters",_version:s.libVersion,requestId:t},"*"),new Promise((i,r)=>{s.promises[t]={resolve:i,reject:r},setTimeout(()=>{if(s.promises[t]){const o="getFilters request timed out.";s.promises[t].reject(new Error(o)),delete s.promises[t]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},Ht=(s,e,t)=>e?(e.contentWindow.postMessage({action:"refreshData",id:t??null,_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),ds=(s,e)=>e?(e.contentWindow.postMessage({action:"reloadDashboard",_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),hs=(s,e,t,i)=>e?(e.contentWindow.postMessage({action:"setAuthorization",key:t,token:i,_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),cs=(s,e,t)=>{if(e&&e.contentWindow){const i=ge();return s.params.editMode===t?Promise.reject(new Error("editMode parameter is currently already set to "+t)):t!=="editFull"&&t!=="editLimited"&&t!=="view"?Promise.reject(new Error("The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'.")):(e.contentWindow.postMessage({action:"setEditMode",editMode:t,_version:s.libVersion,requestId:i},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o}}))}return Promise.reject(new Error("Cannot retrieve contentWindow."))},us=(s,e,t,i)=>{if(e){const r=ge();return e.contentWindow.postMessage({action:"setSelectedData",itemId:t,filters:i,_version:s.libVersion,requestId:r},"*"),new Promise((o,n)=>{s.promises[r]={resolve:o,reject:n},setTimeout(()=>{if(s.promises[r]){const a="setSelectedData request timed out.";s.promises[r].reject(new Error(a)),delete s.promises[r]}},2e3)})}return Promise.reject()},ms=(s,e,t)=>{if(e){const i=ge();return e.contentWindow.postMessage({action:"setPreview",preview:t,requestId:i,_version:s.libVersion},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o},setTimeout(()=>{if(s.promises[i]){const n="setPreview request timed out.";s.promises[i].reject(new Error(n)),delete s.promises[i]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},Ae=s=>{var l,d,h,c,u,f,y,v;if(!s.dimensions){s.params.error=!0,pt("Got no valid dimensions.",s.params);return}const e=Object.keys(s.dimensions),t=[];let i,r=0,o=0;if(!s.params.switchScreenModeOnResize&&s.currentScreenMode&&(s.params.screenMode=s.currentScreenMode),s.dimensions&&(e==null?void 0:e[0])==="fixed")i="fixed",r=s.dimensions.fixed[0],o=s.dimensions.fixed[1];else{const b=["mobile","tablet","desktop","largeScreen"];if(s.params.itemEmbedding){const[w]=e;let z=Mt(w);for(const k of b){const S=e.find(R=>R===k);S?z=Mt(S):s.dimensions[k]=s.dimensions[z]}}for(const w of e)if(b.includes(w)){const z=ni.find(k=>k.mode===w);t.push({...z,height:s.dimensions[w][1]||50})}if(t.map(w=>w.mode).includes(s.params.screenMode)||(s.params.screenMode="auto"),s.params.screenMode==="auto"){t.sort((w,z)=>b.indexOf(w.mode)-b.indexOf(z.mode));for(const w of t){const[z,k]=w.width;s.params.itemEmbedding&&s.params.itemDimensions&&s.params.itemDimensions.width!=="auto"&&s.params.itemDimensions.height==="auto"?z<s.params.itemDimensions.width&&(i=w.mode,r=Number.parseInt(s.params.itemDimensions.width,10),o=s.dimensions[i][1]):z<s.containerWidth&&(i=w.mode,s.params.itemEmbedding?(r=(l=s.params.itemDimensions)!=null&&l.width&&((d=s.params.itemDimensions)==null?void 0:d.width)!=="auto"?Number.parseInt(s.params.itemDimensions.width,10):Math.min(s.containerWidth,k),o=(h=s.params.itemDimensions)!=null&&h.height&&((c=s.params.itemDimensions)==null?void 0:c.height)!=="auto"?Number.parseInt(s.params.itemDimensions.height,10):s.dimensions[i][1],s.params.itemDimensions&&s.params.itemDimensions.width!=="auto"&&s.params.itemDimensions.height==="auto"&&(r=Number.parseInt(s.params.itemDimensions.width,10),o=s.dimensions[i][1])):(r=Math.max(Math.min(k,s.containerWidth),z),o=w.height))}}else{const{height:w,width:[z,k]}=t.find(S=>S.mode===s.params.screenMode);i=s.params.screenMode,r=Math.max(Math.min(k,s.containerWidth),z),o=w,s.params.itemEmbedding&&((u=s.params.itemDimensions)!=null&&u.width&&((f=s.params.itemDimensions)==null?void 0:f.width)!=="auto"&&(r=Number.parseInt(s.params.itemDimensions.width,10)),(y=s.params.itemDimensions)!=null&&y.height&&((v=s.params.itemDimensions)==null?void 0:v.height)!=="auto"&&(o=Number.parseInt(s.params.itemDimensions.height,10)))}if(!i&&t.length>0){const[w]=t;i=w.mode,r=w.width[0],o=w.height}}s.currentScreenMode=i;const n={height:o===0?"100%":`${String(o)}px`,width:r===0?"100%":`${String(r)}px`,opacity:1};["editFull","editLimited"].includes(s.params.editMode)?(n.height="100%",n.width="100%"):s.params.itemEmbedding&&s.params.itemDimensions?(n.height=s.params.itemDimensions.height==="auto"?n.height:`${String(s.params.itemDimensions.height).replace("px","")}px`,n.width=s.params.itemDimensions.width==="auto"?n.width:`${String(s.params.itemDimensions.width).replace("px","")}px`):(n.height=o===0?"100%":`${String(o)}px`,n.width=r===0?"100%":`${String(r)}px`),s.currentScreenMode=i,s.iframeStyle=n},Nt=s=>{const e=Object.keys(W),t=[],i=["appServer","language","apiHost"],r=["key","token","screenMode","timezoneId","itemId","container","loaderBackground","loaderFontColor","loaderSpinnerColor","loaderSpinnerBackground"],o=["itemDimensions"],n=["mobile","tablet","desktop","largeScreen","fixed","auto"];for(const a of e)s.params[a]===null&&delete s.params[a];s.params=at(s.params,W),(!s.params.dashboardId||typeof s.params.dashboardId!="string")&&(!s.params.dashboardSlug||typeof s.params.dashboardSlug!="string")&&(delete s.params.dashboardId,delete s.params.dashboardSlug);for(const a of i)typeof s.params[a]!="string"&&(delete s.params[a],t.push(`${a} needs to be of type string.`));for(const a of r)typeof s.params[a]!="string"&&s.params[a]!==null&&s.params[a]!==void 0&&(delete s.params[a],t.push(`${a} needs to be of type string or empty.`));if(s.params.screenMode&&!n.includes(s.params.screenMode)){const a=n.map(l=>`"${l}"`).join(", ");t.push(`"screenMode" needs should be one of these types: ${a}`),s.params.screenMode="auto"}s.params.itemId&&(s.params.itemEmbedding=!0);for(const a of o)typeof s.params[a]!="object"&&s.params[a]!==null&&(delete s.params[a],t.push(`${a} needs to be of type object or empty.`));if(typeof s.params.switchScreenModeOnResize!="boolean"&&(t.push("switchScreenModeOnResize needs to be of type boolean."),s.params.switchScreenModeOnResize=!0),s.params.itemDimensions){const a=["width","height"];for(const l of a)!["string","number"].includes(typeof s.params.itemDimensions[l])&&s.params.itemDimensions[l]!==null&&t.push(`itemDimensions ${l} needs to be of type string, number or empty.`)}s.params=at(s.params,W),s.params.screenMode&&s.params.screenMode!=="auto"&&(s.params.switchScreenModeOnResize=!1),s.params.itemDimensions.width!=="auto"&&(s.params.itemDimensions.width=Number.parseInt(`${s.params.itemDimensions.width}`.replace("px",""),10)||"auto"),s.params.itemDimensions.height!=="auto"&&(s.params.itemDimensions.height=Number.parseInt(`${s.params.itemDimensions.height}`.replace("px",""),10)||"auto"),s.params.itemEmbedding=!!s.params.itemId,(s.params.error||t.length>0)&&pt(t.join(`
23
+ `),s.params)},et={type:"type",slots:"slots",options:"options",appServer:"app-server",apiHost:"api-host",authKey:"auth-key",authToken:"auth-token",contextId:"context-id",canFilter:"can-filter",filters:"filters",dashboardId:"dashboard-id",itemId:"item-id",dashboardContentsVersion:"dashboard-contents-version",libVersion:"lib-version"},lt="luzmo-embed-container",Re={},gs=async(s,e)=>{const t=typeof s=="function"?await s():s,i=document.createElement("script");i.type="text/javascript",i.addEventListener("load",e),i.src=t,document.querySelectorAll("head")[0].append(i)},Ot=s=>({});async function fs(s){const e=Re[s];if(e.inited)return e.lib;if(e.format==="var")return new Promise(t=>{const i=()=>{e.inited||(e.lib=window[s],e.lib.init(Ot(e.from)),e.inited=!0),t(e.lib)};return gs(e.url,i)});if(["esm","systemjs"].includes(e.format))return new Promise((t,i)=>{(typeof e.url=="function"?e.url:()=>Promise.resolve(e.url))().then(o=>{import(o).then(n=>{if(!e.inited){const a=Ot(e.from);n.init(a),e.lib=n,e.lib.init(a),e.inited=!0}t(e.lib)}).catch(i)})})}function ps(s,e){if(!(s!=null&&s.default)&&e){const t=Object.create(null);return t.default=s,t.__esModule=!0,t}return s}async function ys(s,e){return fs(s).then(t=>t.get(e).then(i=>i()))}async function ne(s,e="DashboardApp"){const t=s+e;if(Re[t])return Re[t].module;let i=`${te(s)}/remoteEntry.mjs`;if(!s.startsWith("http://localhost"))switch(e){case"DashboardApp":case"VizItemApp":{i=`${te(s)}/dashboard-app/remoteEntry.mjs`;break}case"IQApp":{i=`${te(s)}/iq-components/remoteEntry.mjs`;break}}Re[t]={url:i,format:"esm",from:"vite",module:void 0};const r=await ys(t,`./${e}`),o=ps(r,!0);return Re[t].module=o,o}/**
28
24
  * @license
29
25
  * Copyright 2018 Google LLC
30
26
  * SPDX-License-Identifier: BSD-3-Clause
31
- */const ai="important",ws=" !"+ai,he=vi(class extends wi{constructor(s){var e;if(super(s),s.type!==bi.ATTRIBUTE||s.name!=="style"||((e=s.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{const i=s[t];return i==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(s,[e]){const{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?t.removeProperty(i):t[i]=null);for(const i in e){const r=e[i];if(r!=null){this.ft.add(i);const o=typeof r=="string"&&r.endsWith(ws);i.includes("-")||o?t.setProperty(i,o?r.slice(0,-11):r,o?ai:""):t[i]=r}}return m.T}});var _s=Object.defineProperty,p=(s,e,t,i)=>{for(var r=void 0,o=s.length-1,n;o>=0;o--)(n=s[o])&&(r=n(e,t,r)||r);return r&&_s(e,t,r),r},me="6.4.3",Es=class{constructor(){this._components=[]}},lt=new Es,xs=()=>{typeof window.__luzmoMessageHandler!="function"&&(window.__luzmoMessageHandler=s=>{var t,i;const e=lt._components.find(r=>s.data.name===r._iframeId);if(e)switch((t=s.data)==null?void 0:t.type){case"load":{e.dispatchEvent(new CustomEvent("load",{detail:{data:s.data}})),e._loadTimeoutHandle&&(clearTimeout(e._loadTimeoutHandle),e._loadTimeoutHandle=void 0),e.iframeLoaded=!0,e.dimensions=s.data.dimensions,e._calculateDimAfterDashboardLoaded();break}case"error":{e.dashboardError=!0,e._loadTimeoutHandle&&(clearTimeout(e._loadTimeoutHandle),e._loadTimeoutHandle=void 0),e.iframeLoaded=!0,e._displayError(),console.error("Dashboard error:",s.data.errorMsg??((i=s.data.error)==null?void 0:i.msg));break}case"data":{de(e,s.data.requestId,s.data.data);break}case"filters":{de(e,s.data.requestId,s.data.filters);break}case"getAccessibleDashboards":{de(e,s.data.requestId,s.data.accessibleDashboards);break}case"dashboardAction":{e.dispatchEvent(new CustomEvent("dashboardAction",{detail:{data:s.data}}));break}case"export":{s.data.error?He(e,s.data.requestId,s.data):(e.dispatchEvent(new CustomEvent("exported",{detail:{data:s.data}})),de(e,s.data.requestId,s.data));break}case"changedFilters":{e.dispatchEvent(new CustomEvent("changedFilters",{detail:{data:s.data}}));break}case"customEvent":{e.dispatchEvent(new CustomEvent("customEvent",{detail:{data:s.data}}));break}case"chartsRendered":case"itemsRendered":{s.data.type="itemsRendered",e.dispatchEvent(new CustomEvent("itemsRendered",{detail:{data:s.data}}));break}case"setEditMode":{s.data.error?He(e,s.data.requestId,s.data):(de(e,s.data.requestId,s.data),e.params.editMode=s.data.editMode,e._containerStyle=ni(e),e.dimensions&&Se(e));break}case"calculatedDimensions":{e.dimensions=s.data.dimensions,Se(e);break}case"setSelectedData":case"setFilters":{s.data.error?He(e,s.data.requestId,s.data):de(e,s.data.requestId,s.data);break}case"setPreview":{s.data.error?He(e,s.data.requestId,s.data):de(e,s.data.requestId,s.data);break}}},window.addEventListener("message",window.__luzmoMessageHandler,!1))},zs=m.i`
27
+ */const li="important",bs=" !"+li,he=Je.e(class extends Je.i{constructor(s){var e;if(super(s),s.type!==Je.t.ATTRIBUTE||s.name!=="style"||((e=s.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{const i=s[t];return i==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(s,[e]){const{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?t.removeProperty(i):t[i]=null);for(const i in e){const r=e[i];if(r!=null){this.ft.add(i);const o=typeof r=="string"&&r.endsWith(bs);i.includes("-")||o?t.setProperty(i,o?r.slice(0,-11):r,o?li:""):t[i]=r}}return m.T}});var vs=Object.defineProperty,p=(s,e,t,i)=>{for(var r=void 0,o=s.length-1,n;o>=0;o--)(n=s[o])&&(r=n(e,t,r)||r);return r&&vs(e,t,r),r},me="6.4.3",ws=class{constructor(){this._components=[]}},dt=new ws,_s=()=>{typeof window.__luzmoMessageHandler!="function"&&(window.__luzmoMessageHandler=s=>{var t,i;const e=dt._components.find(r=>s.data.name===r._iframeId);if(e)switch((t=s.data)==null?void 0:t.type){case"load":{e.dispatchEvent(new CustomEvent("load",{detail:{data:s.data}})),e._loadTimeoutHandle&&(clearTimeout(e._loadTimeoutHandle),e._loadTimeoutHandle=void 0),e.iframeLoaded=!0,e.dimensions=s.data.dimensions,e._calculateDimAfterDashboardLoaded();break}case"error":{e.dashboardError=!0,e._loadTimeoutHandle&&(clearTimeout(e._loadTimeoutHandle),e._loadTimeoutHandle=void 0),e.iframeLoaded=!0,e._displayError(),console.error("Dashboard error:",s.data.errorMsg??((i=s.data.error)==null?void 0:i.msg));break}case"data":{de(e,s.data.requestId,s.data.data);break}case"filters":{de(e,s.data.requestId,s.data.filters);break}case"getAccessibleDashboards":{de(e,s.data.requestId,s.data.accessibleDashboards);break}case"dashboardAction":{e.dispatchEvent(new CustomEvent("dashboardAction",{detail:{data:s.data}}));break}case"export":{s.data.error?He(e,s.data.requestId,s.data):(e.dispatchEvent(new CustomEvent("exported",{detail:{data:s.data}})),de(e,s.data.requestId,s.data));break}case"changedFilters":{e.dispatchEvent(new CustomEvent("changedFilters",{detail:{data:s.data}}));break}case"customEvent":{e.dispatchEvent(new CustomEvent("customEvent",{detail:{data:s.data}}));break}case"chartsRendered":case"itemsRendered":{s.data.type="itemsRendered",e.dispatchEvent(new CustomEvent("itemsRendered",{detail:{data:s.data}}));break}case"setEditMode":{s.data.error?He(e,s.data.requestId,s.data):(de(e,s.data.requestId,s.data),e.params.editMode=s.data.editMode,e._containerStyle=ai(e),e.dimensions&&Ae(e));break}case"calculatedDimensions":{e.dimensions=s.data.dimensions,Ae(e);break}case"setSelectedData":case"setFilters":{s.data.error?He(e,s.data.requestId,s.data):de(e,s.data.requestId,s.data);break}case"setPreview":{s.data.error?He(e,s.data.requestId,s.data):de(e,s.data.requestId,s.data);break}}},window.addEventListener("message",window.__luzmoMessageHandler,!1))},Es=m.i`
32
28
  :host {
33
29
  display: block;
34
30
  height: 100%;
@@ -141,7 +137,7 @@ ${s}`,console.warn(t))},Qi=s=>{let e=!1,t="";const r=(document.body||document.do
141
137
  position: absolute;
142
138
  transition-duration: 0.3s;
143
139
  }
144
- `,Ot="DashboardApp",E=class extends m.r$1{constructor(){super(),this.language="auto",this.editorLanguage="auto",this.screenMode="auto",this.switchScreenModeOnResize=!0,this.editMode="view",this.embedMode="iframe",this.iframeStyle={},this._containerStyle={},this._loaderStyle={},this._lcStyle={},this._loadingCircleStyle={},this._containerLoaderStyle={},this._loaderMsg="",this._itemEmbedding=!1,this.browserError=!1,this.browserErrorMsg="",this.dashboardError=!1,this.browserNotSupported=[],this.libVersion=me+"-wc-luzmo",this.isLibraryLoaded=!1,this.currentAuthKey=null,this.currentAuthToken=null,this.isInitCalled=!1,this.attributesMap={dashboardId:"dashboard-id",dashboardSlug:"dashboard-slug",itemId:"item-id",language:"language",editorLanguage:"editorLanguage",qeVersion:"qe-version",screenMode:"screen-mode",switchScreenModeOnResize:"switch-screen-mode-on-resize",authKey:"auth-key",authToken:"auth-token",editMode:"edit-mode",theme:"theme",mainColor:"main-color",accentColor:"accent-color",loaderBackground:"loader-background",loaderFontColor:"loader-font-color",loaderSpinnerColor:"loader-spinner-color",loaderSpinnerBackground:"loader-spinner-background",appServer:"app-server",apiHost:"api-host",itemDimensions:"item-dimensions",timezoneId:"timezone-id"},this.loaderSize=32,this.borderWidth=3,this.minHeight=400,this._containerId=ge(),this._iframeId=`luzmo-dashboard-${this._containerId}`,this.iframeLoaded=!1,this.promises={},this.params=this._setOptions(),this._onResize=()=>{var s;if((s=this.shadowRoot)!=null&&s.querySelector(".dashboard-container")){if(this.containerWidth=this.luzmoEmbedContainer.offsetWidth,this.params.switchScreenModeOnResize&&this.params.screenMode==="auto")for(const e of oi)e.width[0]<=window.innerWidth&&window.innerWidth<=e.width[1]&&(this.currentScreenMode=e.mode);this.iframeLoaded?this._calculateDimAfterDashboardLoaded():this.dimensions&&(this.containerWidth=this.luzmoEmbedContainer.offsetWidth,Se(this))}},this._resizeObserver=new ResizeObserver(s=>{window.requestAnimationFrame(()=>{!Array.isArray(s)||s.length===0||this._onResize()})})}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver.disconnect();for(const s of Object.keys(this.promises))this.promises[s].reject(new Error("Dashboard component was removed"))}firstUpdated(){var s;this._loaderMsg=(s=Dt(this))==null?void 0:s.loadingMsg,this._loaderStyles(),lt._components.push(this),this.luzmoEmbedContainer&&this._resizeObserver.observe(this.luzmoEmbedContainer)}initComponent(){var s,e;this.params=this._setOptions(),this.isWebComponentViewMode()?ne(this.params.appServer,Ot).then(async()=>{this.isLibraryLoaded=!0,await this.updateComplete;const t=this.renderRoot.querySelector("dashboard-component");this.dashboardReference=t.cloneNode(!0),t.replaceWith(this.dashboardReference),this.dashboardReference.addEventListener("load",i=>{this.containerWidth=this.dashboardReference.offsetWidth,this.dimensions=i.detail.dimensions,Se(this),window.dispatchEvent(new Event("resize")),this.dispatchEvent(new CustomEvent("load",i))}),this.dashboardReference.addEventListener("itemsRendered",i=>this.dispatchEvent(new CustomEvent("itemsRendered",i))),this.dashboardReference.addEventListener("customEvent",i=>this.dispatchEvent(new CustomEvent("customEvent",i))),this.dashboardReference.addEventListener("changedFilters",i=>this.dispatchEvent(new CustomEvent("changedFilters",i))),this.dashboardReference.addEventListener("dashboardAction",i=>this.dispatchEvent(new CustomEvent("dashboardAction",i))),this.dashboardReference.addEventListener("export",i=>this.dispatchEvent(new CustomEvent("exported",i))),this.setAllAttributes()}):(this.containerWidth=(s=this.container)==null?void 0:s.clientWidth,Ht(this),Qi(this),this._setupLoader(),this.params.error||(this._loaderStyles(),xs(),this._iframeUrl=Mt(this),(e=this.iframe)==null||e.setAttribute("src",this._iframeUrl),this.iframeStyle=Ct(this)))}setAllAttributes(){if(this.dashboardReference){for(const s in this.attributesMap)!["authKey","authToken","apiHost","itemDimensions"].includes(s)&&this.params[s]&&this.dashboardReference.setAttribute(this.attributesMap[s],this.params[s]);this.params.itemDimensions&&this.dashboardReference.setAttribute("item-dimensions",JSON.stringify(this.params.itemDimensions)),this.params.apiHost&&this.dashboardReference.setAttribute("api-host",te(this.params.apiHost)),this.params.key&&this.dashboardReference.setAttribute("auth-key",this.params.key),this.params.token&&this.dashboardReference.setAttribute("auth-token",this.params.token)}}updated(s){var r;const e=new Set(["dashboardId","dashboardSlug","itemId","language","editorLanguage","qeVersion","theme","editMode","screenMode","switchScreenModeOnResize","authToken","authKey","appServer","apiHost","timezoneId","itemDimensions"]),t=["dashboardId","dashboardSlug","itemId"];let i=!1;for(const o of t)i=i||s.get(o)===void 0&&this[o]!==void 0;if(i&&!this.isInitCalled){this.initComponent(),this.isInitCalled=!0;return}if(this.isWebComponentViewMode()){if(this.dashboardReference){for(const[o]of s.entries())if(o==="appSever")ne(s[o],Ot).then(async()=>{this.isLibraryLoaded=!0,await this.updateComplete,this.dashboardReference=this.renderRoot.querySelector("dashboard-component"),this.setAllAttributes()});else if(this.attributesMap[o]){const n=this.attributesMap[o]??o,a=typeof this[o]=="object"?JSON.stringify(this[o]):((r=this[o])==null?void 0:r.toString())||this[o];this.dashboardReference.setAttribute(n,a)}}}else for(const[o]of s.entries())e.has(o)&&o!=="editMode"?(this.iframeLoaded=!1,this._loadTimeoutHandle&&clearTimeout(this._loadTimeoutHandle),this._loadTimeoutHandle=setTimeout(()=>{console.warn("Failed to load dashboard, appServer is likely down or unreachable.")},15*1e3),this.params=this._setOptions(),Ht(this),this._setupLoader(),this._loaderStyles(),this._iframeUrl=Mt(this),this.iframe&&this._updateIframeUrl(),this.iframeStyle=Ct(this)):e.has(o)&&o==="editMode"&&(this.iframeLoaded&&this.setEditMode(this.editMode),this.params=this._setOptions())}_setOptions(){const s={dashboardId:this.dashboardId,dashboardSlug:this.dashboardSlug};return this.itemId?(s.itemId=this.itemId,this._itemEmbedding=!0):this._itemEmbedding=!1,this.language&&(s.language=this.language),this.editorLanguage&&(s.editorLanguage=this.editorLanguage),this.qeVersion&&(s.qeVersion=this.qeVersion),this.screenMode&&(s.screenMode=this.screenMode),s.switchScreenModeOnResize=this.switchScreenModeOnResize,this.authToken&&(s.token=this.authToken),this.authKey&&(s.key=this.authKey),this.editMode&&(s.editMode=this.editMode),this.theme&&(s.theme=this.theme),this.mainColor&&(s.mainColor=this.mainColor),this.accentColor&&(s.accentColor=this.accentColor),this.loaderBackground&&(s.loaderBackground=this.loaderBackground),this.loaderFontColor&&(s.loaderFontColor=this.loaderFontColor),this.loaderSpinnerColor&&(s.loaderSpinnerColor=this.loaderSpinnerColor),this.loaderSpinnerBackground&&(s.loaderSpinnerBackground=this.loaderSpinnerBackground),this.timezoneId&&(s.timezoneId=this.timezoneId),this.itemDimensions&&(s.itemDimensions=this.itemDimensions),this.appServer?(this.appServer=this.isWebComponentViewMode()?te(this.appServer):Ae(this.appServer),s.appServer=this.appServer):(this.appServer=Ae(W.appServer),s.appServer=this.appServer),this.apiHost?(this.apiHost=this.isWebComponentViewMode()?te(this.apiHost):Ae(this.apiHost),s.apiHost=this.apiHost):(this.apiHost=this.appServer.includes("luzmo.com")?this.appServer.replace("app","api"):this.appServer,s.apiHost=this.apiHost),this.currentAuthKey=this.authKey,this.currentAuthToken=this.authToken,s}_updateIframeUrl(){as(this.iframe,this._iframeUrl)}_setupLoader(){const s=Dt(this);this._loaderMsg=s.loadingMsg,s.errorMsg&&(this.browserError=!0,this.browserErrorMsg=s.errorMsg,this._displayError())}_displayError(){this.dashboardError&&(this._loaderStyles(),this.iframeStyle.opacity=1),this.browserError&&(this._containerStyle.display="none")}_calculateDimAfterDashboardLoaded(){this.dashboardError=!1,this._loaderStyles(),Se(this)}_loaderStyles(){this._containerStyle=ni(this),this._loaderStyle=rs(this),this._loadingCircleStyle=os(this),this._containerLoaderStyle=ss(this),this._lcStyle=ns(this)}static get styles(){return[zs]}render(){let s;const e=m.x`
140
+ `,Pt="DashboardApp",E=class extends m.r$1{constructor(){super(),this.language="auto",this.editorLanguage="auto",this.screenMode="auto",this.switchScreenModeOnResize=!0,this.editMode="view",this.embedMode="iframe",this.iframeStyle={},this._containerStyle={},this._loaderStyle={},this._lcStyle={},this._loadingCircleStyle={},this._containerLoaderStyle={},this._loaderMsg="",this._itemEmbedding=!1,this.browserError=!1,this.browserErrorMsg="",this.dashboardError=!1,this.browserNotSupported=[],this.libVersion=me+"-wc-luzmo",this.isLibraryLoaded=!1,this.currentAuthKey=null,this.currentAuthToken=null,this.isInitCalled=!1,this.attributesMap={dashboardId:"dashboard-id",dashboardSlug:"dashboard-slug",itemId:"item-id",language:"language",editorLanguage:"editorLanguage",qeVersion:"qe-version",screenMode:"screen-mode",switchScreenModeOnResize:"switch-screen-mode-on-resize",authKey:"auth-key",authToken:"auth-token",editMode:"edit-mode",theme:"theme",mainColor:"main-color",accentColor:"accent-color",loaderBackground:"loader-background",loaderFontColor:"loader-font-color",loaderSpinnerColor:"loader-spinner-color",loaderSpinnerBackground:"loader-spinner-background",appServer:"app-server",apiHost:"api-host",itemDimensions:"item-dimensions",timezoneId:"timezone-id"},this.loaderSize=32,this.borderWidth=3,this.minHeight=400,this._containerId=ge(),this._iframeId=`luzmo-dashboard-${this._containerId}`,this.iframeLoaded=!1,this.promises={},this.params=this._setOptions(),this._onResize=()=>{var s;if((s=this.shadowRoot)!=null&&s.querySelector(".dashboard-container")){if(this.containerWidth=this.luzmoEmbedContainer.offsetWidth,this.params.switchScreenModeOnResize&&this.params.screenMode==="auto")for(const e of ni)e.width[0]<=window.innerWidth&&window.innerWidth<=e.width[1]&&(this.currentScreenMode=e.mode);this.iframeLoaded?this._calculateDimAfterDashboardLoaded():this.dimensions&&(this.containerWidth=this.luzmoEmbedContainer.offsetWidth,Ae(this))}},this._resizeObserver=new ResizeObserver(s=>{window.requestAnimationFrame(()=>{!Array.isArray(s)||s.length===0||this._onResize()})})}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver.disconnect();for(const s of Object.keys(this.promises))this.promises[s].reject(new Error("Dashboard component was removed"))}firstUpdated(){var s;this._loaderMsg=(s=Ct(this))==null?void 0:s.loadingMsg,this._loaderStyles(),dt._components.push(this),this.luzmoEmbedContainer&&this._resizeObserver.observe(this.luzmoEmbedContainer)}initComponent(){var s,e;this.params=this._setOptions(),this.isWebComponentViewMode()?ne(this.params.appServer,Pt).then(async()=>{this.isLibraryLoaded=!0,await this.updateComplete;const t=this.renderRoot.querySelector("dashboard-component");this.dashboardReference=t.cloneNode(!0),t.replaceWith(this.dashboardReference),this.dashboardReference.addEventListener("load",i=>{this.containerWidth=this.dashboardReference.offsetWidth,this.dimensions=i.detail.dimensions,Ae(this),window.dispatchEvent(new Event("resize")),this.dispatchEvent(new CustomEvent("load",i))}),this.dashboardReference.addEventListener("itemsRendered",i=>this.dispatchEvent(new CustomEvent("itemsRendered",i))),this.dashboardReference.addEventListener("customEvent",i=>this.dispatchEvent(new CustomEvent("customEvent",i))),this.dashboardReference.addEventListener("changedFilters",i=>this.dispatchEvent(new CustomEvent("changedFilters",i))),this.dashboardReference.addEventListener("dashboardAction",i=>this.dispatchEvent(new CustomEvent("dashboardAction",i))),this.dashboardReference.addEventListener("export",i=>this.dispatchEvent(new CustomEvent("exported",i))),this.setAllAttributes()}):(this.containerWidth=(s=this.container)==null?void 0:s.clientWidth,Nt(this),Xi(this),this._setupLoader(),this.params.error||(this._loaderStyles(),_s(),this._iframeUrl=Dt(this),(e=this.iframe)==null||e.setAttribute("src",this._iframeUrl),this.iframeStyle=It(this)))}setAllAttributes(){if(this.dashboardReference){for(const s in this.attributesMap)!["authKey","authToken","apiHost","itemDimensions"].includes(s)&&this.params[s]&&this.dashboardReference.setAttribute(this.attributesMap[s],this.params[s]);this.params.itemDimensions&&this.dashboardReference.setAttribute("item-dimensions",JSON.stringify(this.params.itemDimensions)),this.params.apiHost&&this.dashboardReference.setAttribute("api-host",te(this.params.apiHost)),this.params.key&&this.dashboardReference.setAttribute("auth-key",this.params.key),this.params.token&&this.dashboardReference.setAttribute("auth-token",this.params.token)}}updated(s){var r;const e=new Set(["dashboardId","dashboardSlug","itemId","language","editorLanguage","qeVersion","theme","editMode","screenMode","switchScreenModeOnResize","authToken","authKey","appServer","apiHost","timezoneId","itemDimensions"]),t=["dashboardId","dashboardSlug","itemId"];let i=!1;for(const o of t)i=i||s.get(o)===void 0&&this[o]!==void 0;if(i&&!this.isInitCalled){this.initComponent(),this.isInitCalled=!0;return}if(this.isWebComponentViewMode()){if(this.dashboardReference){for(const[o]of s.entries())if(o==="appSever")ne(s[o],Pt).then(async()=>{this.isLibraryLoaded=!0,await this.updateComplete,this.dashboardReference=this.renderRoot.querySelector("dashboard-component"),this.setAllAttributes()});else if(this.attributesMap[o]){const n=this.attributesMap[o]??o,a=typeof this[o]=="object"?JSON.stringify(this[o]):((r=this[o])==null?void 0:r.toString())||this[o];this.dashboardReference.setAttribute(n,a)}}}else for(const[o]of s.entries())e.has(o)&&o!=="editMode"?(this.iframeLoaded=!1,this._loadTimeoutHandle&&clearTimeout(this._loadTimeoutHandle),this._loadTimeoutHandle=setTimeout(()=>{console.warn("Failed to load dashboard, appServer is likely down or unreachable.")},15*1e3),this.params=this._setOptions(),Nt(this),this._setupLoader(),this._loaderStyles(),this._iframeUrl=Dt(this),this.iframe&&this._updateIframeUrl(),this.iframeStyle=It(this)):e.has(o)&&o==="editMode"&&(this.iframeLoaded&&this.setEditMode(this.editMode),this.params=this._setOptions())}_setOptions(){const s={dashboardId:this.dashboardId,dashboardSlug:this.dashboardSlug};return this.itemId?(s.itemId=this.itemId,this._itemEmbedding=!0):this._itemEmbedding=!1,this.language&&(s.language=this.language),this.editorLanguage&&(s.editorLanguage=this.editorLanguage),this.qeVersion&&(s.qeVersion=this.qeVersion),this.screenMode&&(s.screenMode=this.screenMode),s.switchScreenModeOnResize=this.switchScreenModeOnResize,this.authToken&&(s.token=this.authToken),this.authKey&&(s.key=this.authKey),this.editMode&&(s.editMode=this.editMode),this.theme&&(s.theme=this.theme),this.mainColor&&(s.mainColor=this.mainColor),this.accentColor&&(s.accentColor=this.accentColor),this.loaderBackground&&(s.loaderBackground=this.loaderBackground),this.loaderFontColor&&(s.loaderFontColor=this.loaderFontColor),this.loaderSpinnerColor&&(s.loaderSpinnerColor=this.loaderSpinnerColor),this.loaderSpinnerBackground&&(s.loaderSpinnerBackground=this.loaderSpinnerBackground),this.timezoneId&&(s.timezoneId=this.timezoneId),this.itemDimensions&&(s.itemDimensions=this.itemDimensions),this.appServer?(this.appServer=this.isWebComponentViewMode()?te(this.appServer):Se(this.appServer),s.appServer=this.appServer):(this.appServer=Se(W.appServer),s.appServer=this.appServer),this.apiHost?(this.apiHost=this.isWebComponentViewMode()?te(this.apiHost):Se(this.apiHost),s.apiHost=this.apiHost):(this.apiHost=this.appServer.includes("luzmo.com")?this.appServer.replace("app","api"):this.appServer,s.apiHost=this.apiHost),this.currentAuthKey=this.authKey,this.currentAuthToken=this.authToken,s}_updateIframeUrl(){os(this.iframe,this._iframeUrl)}_setupLoader(){const s=Ct(this);this._loaderMsg=s.loadingMsg,s.errorMsg&&(this.browserError=!0,this.browserErrorMsg=s.errorMsg,this._displayError())}_displayError(){this.dashboardError&&(this._loaderStyles(),this.iframeStyle.opacity=1),this.browserError&&(this._containerStyle.display="none")}_calculateDimAfterDashboardLoaded(){this.dashboardError=!1,this._loaderStyles(),Ae(this)}_loaderStyles(){this._containerStyle=ai(this),this._loaderStyle=is(this),this._loadingCircleStyle=ss(this),this._containerLoaderStyle=ts(this),this._lcStyle=rs(this)}static get styles(){return[Es]}render(){let s;const e=m.x`
145
141
  <div
146
142
  class="luzmo-container-loader"
147
143
  id="luzmo-container-loader-${this._containerId}"
@@ -198,7 +194,7 @@ ${s}`,console.warn(t))},Qi=s=>{let e=!1,t="";const r=(document.body||document.do
198
194
  </div>
199
195
  `:""}
200
196
  `,m.x`
201
- <div class="${at} ${this.isWebComponentViewMode()?"":`${at}-ede`}">
197
+ <div class="${lt} ${this.isWebComponentViewMode()?"":`${lt}-ede`}">
202
198
  <div
203
199
  class="dashboard-container"
204
200
  style=${he(Object.assign({},this._containerStyle,{width:this.iframeStyle.width??"100%",height:this.iframeStyle.height??"100%"}))}
@@ -207,7 +203,7 @@ ${s}`,console.warn(t))},Qi=s=>{let e=!1,t="";const r=(document.body||document.do
207
203
  </div>
208
204
  </div>
209
205
 
210
- `}getDashboards(){return new Promise(s=>s(lt._components))}getData(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.getData(s):this.isWebComponentViewMode()?Promise.reject():ds(this,this.iframe,s)}getFilters(){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.getFilters():this.isWebComponentViewMode()?Promise.reject():hs(this,this.iframe)}setSelectedData(s,e){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setSelectedData(s,e):this.isWebComponentViewMode()?Promise.reject():gs(this,this.iframe,s,e)}setAuthorization(s,e){return this.currentAuthKey=s,this.currentAuthToken=e,this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setAuthorization(s,e):this.isWebComponentViewMode()?Promise.reject():us(this,this.iframe,s,e)}refreshData(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.refreshData(s):this.isWebComponentViewMode()?Promise.reject():s?Lt(this,this.iframe,s):Lt(this,this.iframe)}reloadDashboard(){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.reloadDashboard():this.isWebComponentViewMode()?Promise.reject():cs(this,this.iframe)}exportDashboard(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.exportDashboard(s):this.isWebComponentViewMode()?Promise.reject():s?It(this,this.iframe,s):It(this,this.iframe)}getAccessibleDashboards(){return ls(this)}addFilters(s,e){return this.dashboardReference.addFilters(s,e)}setEditMode(s){return this.dashboardReference&&s==="view"?(this.editMode="view",this.params.editMode="view",this.initComponent(),Promise.resolve({type:"setEditMode",editMode:s})):this.dashboardReference&&["editFull","editLimited"].includes(s)?(this.editMode=s,this.params.editMode=s,this.initComponent(),Promise.resolve({type:"setEditMode",editMode:s})):this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setEditMode(s):this.isWebComponentViewMode()?Promise.reject():ms(this,this.iframe,s)}setPreview(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setPreview(s):fs(this,this.iframe,s)}isWebComponentViewMode(){return this.embedMode==="webComponent"&&(this.params.editMode==="view"||this.params.editMode===void 0)}};p([Ge.e(".dashboard-container")],E.prototype,"container");p([Ge.e(`.${at}`)],E.prototype,"luzmoEmbedContainer");p([Ge.e("iframe")],E.prototype,"iframe");p([m.n()],E.prototype,"dashboardId");p([m.n()],E.prototype,"dashboardSlug");p([m.n()],E.prototype,"itemId");p([m.n()],E.prototype,"language");p([m.n()],E.prototype,"editorLanguage");p([m.n()],E.prototype,"qeVersion");p([m.n()],E.prototype,"screenMode");p([m.n({converter:{fromAttribute:s=>s==="true",toAttribute:String}})],E.prototype,"switchScreenModeOnResize");p([m.n()],E.prototype,"editMode");p([m.n()],E.prototype,"theme");p([m.n()],E.prototype,"mainColor");p([m.n()],E.prototype,"accentColor");p([m.n()],E.prototype,"authToken");p([m.n()],E.prototype,"authKey");p([m.n()],E.prototype,"loaderBackground");p([m.n()],E.prototype,"loaderFontColor");p([m.n()],E.prototype,"loaderSpinnerColor");p([m.n()],E.prototype,"loaderSpinnerBackground");p([m.n()],E.prototype,"appServer");p([m.n()],E.prototype,"timezoneId");p([m.n()],E.prototype,"apiHost");p([m.n({type:Object})],E.prototype,"itemDimensions");p([m.n()],E.prototype,"embedMode");p([m.n({attribute:!1})],E.prototype,"_containerId");p([m.n({attribute:!1})],E.prototype,"_iframeId");p([m.n({attribute:!1})],E.prototype,"params");p([m.n({attribute:!1})],E.prototype,"_iframeUrl");p([m.n({attribute:!1})],E.prototype,"iframeLoaded");p([m.n({attribute:!1})],E.prototype,"promises");p([m.n({attribute:!1})],E.prototype,"iframeStyle");p([m.n({attribute:!1})],E.prototype,"_containerStyle");p([m.n({attribute:!1})],E.prototype,"_loaderStyle");p([m.n({attribute:!1})],E.prototype,"_lcStyle");p([m.n({attribute:!1})],E.prototype,"_loadingCircleStyle");p([m.n({attribute:!1})],E.prototype,"_containerLoaderStyle");p([m.n({attribute:!1})],E.prototype,"_loaderMsg");p([m.n({attribute:!1})],E.prototype,"containerWidth");p([m.n({attribute:!1})],E.prototype,"dimensions");p([m.n({attribute:!1})],E.prototype,"currentScreenMode");p([m.n({attribute:!1})],E.prototype,"_itemEmbedding");p([m.n({attribute:!1})],E.prototype,"browserError");p([m.n({attribute:!1})],E.prototype,"browserErrorMsg");p([m.n({attribute:!1})],E.prototype,"dashboardError");p([m.n({attribute:!1})],E.prototype,"browserNotSupported");p([m.n()],E.prototype,"libVersion");p([Ee.r()],E.prototype,"isLibraryLoaded");p([Ee.r()],E.prototype,"dashboardReference");p([Ee.r()],E.prototype,"currentAuthKey");p([Ee.r()],E.prototype,"currentAuthToken");p([Ee.r()],E.prototype,"isInitCalled");var ks=class extends E{};customElements.get("luzmo-embed-dashboard")||customElements.define("luzmo-embed-dashboard",ks);var Rs="0.1.95",Pt="VizItemApp",ye,T=(ye=class extends m.r$1{constructor(){super(...arguments),this.appServer="https://app.luzmo.com",this.apiHost="https://api.luzmo.com",this.slots=[],this.version=me+"-wc-luzmo",this.dashboardContentsVersion=Rs,this.libVersion=me+"-wc-luzmo",this.postInitCallQueue=[]}createRenderRoot(){return this.style.display||(this.style.display="block"),this.style.height||(this.style.height="100%"),this.style.width||(this.style.width="100%"),this}canInitializeVizItem(){return!!(this.type||this.dashboardId&&this.itemId)}getFilters(){return this.chartElement.getFilters()}export(e="png"){return this.chartElement.export(e)}getData(){return this.chartElement.getData()}refreshData(){return this.chartElement.refreshData()}setSelectedData(e){return this.chartElement.setSelectedData(void 0,e)}setAuthorization(e,t){return this.chartElement.setAuthorization(e,t)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e==="selecteddata"&&(this.chartElement?this.setSelectedData(JSON.parse(i??"{}")):this.postInitCallQueue.push([this.setSelectedData,[JSON.parse(i??"{}")]]))}async firstUpdated(e){super.firstUpdated(e),this.canInitializeVizItem()&&(await ne(this.appServer,Pt),this.createAndAppendElement())}createAndAppendElement(){this.chartElement||(this.chartElement=document.createElement("chart-component"),this.chartElement.setAttribute("embedding-mode","chart"),this.chartElement.style.height="100%",this.chartElement.style.width="100%",this.chartElement.style.display="block",this.chartElement.addEventListener("load",e=>this.dispatchEvent(new CustomEvent("load",e))),this.chartElement.addEventListener("rendered",e=>{var t;if(((t=this.postInitCallQueue)==null?void 0:t.length)>0)for(const i of this.postInitCallQueue)i[0].bind(this)(...i[1]);else this.selectedData&&this.setSelectedData(this.selectedData);this.dispatchEvent(new CustomEvent("rendered",e))}),this.chartElement.addEventListener("changedFilters",e=>this.dispatchEvent(new CustomEvent("changedFilters",e))),this.chartElement.addEventListener("exported",e=>this.dispatchEvent(new CustomEvent("exported",e))),this.chartElement.addEventListener("customEvent",e=>this.dispatchEvent(new CustomEvent("customEvent",e))),this.updateVizItemProperties(),this.renderRoot.append(this.chartElement))}updateVizItemProperties(){if(this.chartElement)for(const e in Ze){const t=this[e];if(t){const i=["appServer","apiHost"].includes(e)?te(t):t;this.chartElement.setAttribute(Ze[e],typeof i=="object"?JSON.stringify(i):i)}}}async updated(e){var t;if(this.chartElement)for(const[i]of e.entries()){const r=Ze[i]??i,o=typeof this[i]=="object"?JSON.stringify(this[i]):((t=this[i])==null?void 0:t.toString())??this[i];this.chartElement.setAttribute(r,o)}else this.canInitializeVizItem()&&(await ne(this.appServer,Pt),this.createAndAppendElement())}render(){return m.x` `}},ye.styles=m.i`
206
+ `}getDashboards(){return new Promise(s=>s(dt._components))}getData(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.getData(s):this.isWebComponentViewMode()?Promise.reject():as(this,this.iframe,s)}getFilters(){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.getFilters():this.isWebComponentViewMode()?Promise.reject():ls(this,this.iframe)}setSelectedData(s,e){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setSelectedData(s,e):this.isWebComponentViewMode()?Promise.reject():us(this,this.iframe,s,e)}setAuthorization(s,e){return this.currentAuthKey=s,this.currentAuthToken=e,this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setAuthorization(s,e):this.isWebComponentViewMode()?Promise.reject():hs(this,this.iframe,s,e)}refreshData(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.refreshData(s):this.isWebComponentViewMode()?Promise.reject():s?Ht(this,this.iframe,s):Ht(this,this.iframe)}reloadDashboard(){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.reloadDashboard():this.isWebComponentViewMode()?Promise.reject():ds(this,this.iframe)}exportDashboard(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.exportDashboard(s):this.isWebComponentViewMode()?Promise.reject():s?Lt(this,this.iframe,s):Lt(this,this.iframe)}getAccessibleDashboards(){return ns(this)}addFilters(s,e){return this.dashboardReference.addFilters(s,e)}setEditMode(s){return this.dashboardReference&&s==="view"?(this.editMode="view",this.params.editMode="view",this.initComponent(),Promise.resolve({type:"setEditMode",editMode:s})):this.dashboardReference&&["editFull","editLimited"].includes(s)?(this.editMode=s,this.params.editMode=s,this.initComponent(),Promise.resolve({type:"setEditMode",editMode:s})):this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setEditMode(s):this.isWebComponentViewMode()?Promise.reject():cs(this,this.iframe,s)}setPreview(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setPreview(s):ms(this,this.iframe,s)}isWebComponentViewMode(){return this.embedMode==="webComponent"&&(this.params.editMode==="view"||this.params.editMode===void 0)}};p([Ge.e(".dashboard-container")],E.prototype,"container");p([Ge.e(`.${lt}`)],E.prototype,"luzmoEmbedContainer");p([Ge.e("iframe")],E.prototype,"iframe");p([m.n()],E.prototype,"dashboardId");p([m.n()],E.prototype,"dashboardSlug");p([m.n()],E.prototype,"itemId");p([m.n()],E.prototype,"language");p([m.n()],E.prototype,"editorLanguage");p([m.n()],E.prototype,"qeVersion");p([m.n()],E.prototype,"screenMode");p([m.n({converter:{fromAttribute:s=>s==="true",toAttribute:String}})],E.prototype,"switchScreenModeOnResize");p([m.n()],E.prototype,"editMode");p([m.n()],E.prototype,"theme");p([m.n()],E.prototype,"mainColor");p([m.n()],E.prototype,"accentColor");p([m.n()],E.prototype,"authToken");p([m.n()],E.prototype,"authKey");p([m.n()],E.prototype,"loaderBackground");p([m.n()],E.prototype,"loaderFontColor");p([m.n()],E.prototype,"loaderSpinnerColor");p([m.n()],E.prototype,"loaderSpinnerBackground");p([m.n()],E.prototype,"appServer");p([m.n()],E.prototype,"timezoneId");p([m.n()],E.prototype,"apiHost");p([m.n({type:Object})],E.prototype,"itemDimensions");p([m.n()],E.prototype,"embedMode");p([m.n({attribute:!1})],E.prototype,"_containerId");p([m.n({attribute:!1})],E.prototype,"_iframeId");p([m.n({attribute:!1})],E.prototype,"params");p([m.n({attribute:!1})],E.prototype,"_iframeUrl");p([m.n({attribute:!1})],E.prototype,"iframeLoaded");p([m.n({attribute:!1})],E.prototype,"promises");p([m.n({attribute:!1})],E.prototype,"iframeStyle");p([m.n({attribute:!1})],E.prototype,"_containerStyle");p([m.n({attribute:!1})],E.prototype,"_loaderStyle");p([m.n({attribute:!1})],E.prototype,"_lcStyle");p([m.n({attribute:!1})],E.prototype,"_loadingCircleStyle");p([m.n({attribute:!1})],E.prototype,"_containerLoaderStyle");p([m.n({attribute:!1})],E.prototype,"_loaderMsg");p([m.n({attribute:!1})],E.prototype,"containerWidth");p([m.n({attribute:!1})],E.prototype,"dimensions");p([m.n({attribute:!1})],E.prototype,"currentScreenMode");p([m.n({attribute:!1})],E.prototype,"_itemEmbedding");p([m.n({attribute:!1})],E.prototype,"browserError");p([m.n({attribute:!1})],E.prototype,"browserErrorMsg");p([m.n({attribute:!1})],E.prototype,"dashboardError");p([m.n({attribute:!1})],E.prototype,"browserNotSupported");p([m.n()],E.prototype,"libVersion");p([Ee.r()],E.prototype,"isLibraryLoaded");p([Ee.r()],E.prototype,"dashboardReference");p([Ee.r()],E.prototype,"currentAuthKey");p([Ee.r()],E.prototype,"currentAuthToken");p([Ee.r()],E.prototype,"isInitCalled");var xs=class extends E{};customElements.get("luzmo-embed-dashboard")||customElements.define("luzmo-embed-dashboard",xs);var zs="0.1.95",$t="VizItemApp",ye,I=(ye=class extends m.r$1{constructor(){super(...arguments),this.appServer="https://app.luzmo.com",this.apiHost="https://api.luzmo.com",this.slots=[],this.version=me+"-wc-luzmo",this.dashboardContentsVersion=zs,this.libVersion=me+"-wc-luzmo",this.postInitCallQueue=[]}createRenderRoot(){return this.style.display||(this.style.display="block"),this.style.height||(this.style.height="100%"),this.style.width||(this.style.width="100%"),this}canInitializeVizItem(){return!!(this.type||this.dashboardId&&this.itemId)}getFilters(){return this.chartElement.getFilters()}export(e="png"){return this.chartElement.export(e)}getData(){return this.chartElement.getData()}refreshData(){return this.chartElement.refreshData()}setSelectedData(e){return this.chartElement.setSelectedData(void 0,e)}setAuthorization(e,t){return this.chartElement.setAuthorization(e,t)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e==="selecteddata"&&(this.chartElement?this.setSelectedData(JSON.parse(i??"{}")):this.postInitCallQueue.push([this.setSelectedData,[JSON.parse(i??"{}")]]))}async firstUpdated(e){super.firstUpdated(e),this.canInitializeVizItem()&&(await ne(this.appServer,$t),this.createAndAppendElement())}createAndAppendElement(){this.chartElement||(this.chartElement=document.createElement("chart-component"),this.chartElement.setAttribute("embedding-mode","chart"),this.chartElement.style.height="100%",this.chartElement.style.width="100%",this.chartElement.style.display="block",this.chartElement.addEventListener("load",e=>this.dispatchEvent(new CustomEvent("load",e))),this.chartElement.addEventListener("rendered",e=>{var t;if(((t=this.postInitCallQueue)==null?void 0:t.length)>0)for(const i of this.postInitCallQueue)i[0].bind(this)(...i[1]);else this.selectedData&&this.setSelectedData(this.selectedData);this.dispatchEvent(new CustomEvent("rendered",e))}),this.chartElement.addEventListener("changedFilters",e=>this.dispatchEvent(new CustomEvent("changedFilters",e))),this.chartElement.addEventListener("exported",e=>this.dispatchEvent(new CustomEvent("exported",e))),this.chartElement.addEventListener("customEvent",e=>this.dispatchEvent(new CustomEvent("customEvent",e))),this.updateVizItemProperties(),this.renderRoot.append(this.chartElement))}updateVizItemProperties(){if(this.chartElement)for(const e in et){const t=this[e];if(t){const i=["appServer","apiHost"].includes(e)?te(t):t;this.chartElement.setAttribute(et[e],typeof i=="object"?JSON.stringify(i):i)}}}async updated(e){var t;if(this.chartElement)for(const[i]of e.entries()){const r=et[i]??i,o=typeof this[i]=="object"?JSON.stringify(this[i]):((t=this[i])==null?void 0:t.toString())??this[i];this.chartElement.setAttribute(r,o)}else this.canInitializeVizItem()&&(await ne(this.appServer,$t),this.createAndAppendElement())}render(){return m.x` `}},ye.styles=m.i`
211
207
  :host {
212
208
  display: block;
213
209
  width: 100%;
@@ -219,27 +215,27 @@ ${s}`,console.warn(t))},Qi=s=>{let e=!1,t="";const r=(document.body||document.do
219
215
  height: 1000%;
220
216
  display: block;
221
217
  }
222
- `,ye);p([m.n()],T.prototype,"appServer");p([m.n()],T.prototype,"apiHost");p([m.n({type:Array})],T.prototype,"slots");p([m.n({type:Object})],T.prototype,"options");p([m.n()],T.prototype,"type");p([m.n()],T.prototype,"authKey");p([m.n()],T.prototype,"authToken");p([m.n()],T.prototype,"version");p([m.n()],T.prototype,"contextId");p([m.n({converter:s=>{try{return JSON.parse(s)}catch{return s}}})],T.prototype,"canFilter");p([m.n({type:Array})],T.prototype,"filters");p([m.n()],T.prototype,"dashboardId");p([m.n()],T.prototype,"itemId");p([m.n({type:Object})],T.prototype,"selectedData");p([m.n()],T.prototype,"dashboardContentsVersion");p([m.n()],T.prototype,"libVersion");var As=class extends T{};customElements.get("luzmo-embed-viz-item")||customElements.define("luzmo-embed-viz-item",As);var et={aiEndpoint:"ai-endpoint",appServer:"app-server",apiHost:"api-host",options:"options",initialSuggestionsDatasetId:"initialSuggestionsDatasetId",authKey:"auth-key",authToken:"auth-token",version:"version",libVersion:"lib-version",aydHost:"ayd-host",availableDatasets:"available-datasets"},dt="luzmo-iq-embed-chat",$t="luzmo-iq-chat-component",be,P=(be=class extends m.r$1{constructor(){super(...arguments),this.appServer="https://app.luzmo.com",this.apiHost="https://api.luzmo.com",this.version=me+"-wc-luzmo",this.libVersion=me+"-wc-luzmo",this.remoteEntryServer="http://localhost:4202/",this.aydHost="https://ayd.luzmo.com/",this.availableDatasets=[]}createRenderRoot(){return this}async firstUpdated(e){super.firstUpdated(e),await ne(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}get calculatedAppServer(){return this.appServer.startsWith("http://localhost")?this.remoteEntryServer:this.appServer}createAndAppendElement(){this.chartElement||(this.chartElement=document.createElement($t),this.chartElement.addEventListener("load",e=>this.dispatchEvent(new CustomEvent("load",e))),this.updateVizItemProperties(),this.renderRoot.append(this.chartElement))}updateVizItemProperties(){if(this.chartElement)for(const e in et){const t=this[e];if(t){const i=["appServer","apiHost","aydHost"].includes(e)?te(t):t;this.chartElement.setAttribute(et[e],typeof i=="object"?JSON.stringify(i):i)}}}async updated(e){var t;if(this.chartElement)for(const[i]of e.entries()){const r=et[i]??i,o=typeof this[i]=="object"?JSON.stringify(this[i]):((t=this[i])==null?void 0:t.toString())??this[i];this.chartElement.setAttribute(r,o)}else await ne(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}render(){return m.x``}connectedCallback(){super.connectedCallback();const e=document.querySelector(dt);if(!e)return;const t=new MutationObserver(()=>{const i=e.querySelector('*[slot="custom-chat-widget-content"]');if(!i)return;const r=e.querySelector($t);r&&(r.append(i),t.disconnect())});t.observe(e,{childList:!0,subtree:!0})}},be.styles=m.i`
218
+ `,ye);p([m.n()],I.prototype,"appServer");p([m.n()],I.prototype,"apiHost");p([m.n({type:Array})],I.prototype,"slots");p([m.n({type:Object})],I.prototype,"options");p([m.n()],I.prototype,"type");p([m.n()],I.prototype,"authKey");p([m.n()],I.prototype,"authToken");p([m.n()],I.prototype,"version");p([m.n()],I.prototype,"contextId");p([m.n({converter:s=>{try{return JSON.parse(s)}catch{return s}}})],I.prototype,"canFilter");p([m.n({type:Array})],I.prototype,"filters");p([m.n()],I.prototype,"dashboardId");p([m.n()],I.prototype,"itemId");p([m.n({type:Object})],I.prototype,"selectedData");p([m.n()],I.prototype,"dashboardContentsVersion");p([m.n()],I.prototype,"libVersion");var ks=class extends I{};customElements.get("luzmo-embed-viz-item")||customElements.define("luzmo-embed-viz-item",ks);var tt={aiEndpoint:"ai-endpoint",appServer:"app-server",apiHost:"api-host",options:"options",initialSuggestionsDatasetId:"initialSuggestionsDatasetId",authKey:"auth-key",authToken:"auth-token",version:"version",libVersion:"lib-version",aydHost:"ayd-host",availableDatasets:"available-datasets"},ht="luzmo-iq-embed-chat",Wt="luzmo-iq-chat-component",be,P=(be=class extends m.r$1{constructor(){super(...arguments),this.appServer="https://app.luzmo.com",this.apiHost="https://api.luzmo.com",this.version=me+"-wc-luzmo",this.libVersion=me+"-wc-luzmo",this.remoteEntryServer="http://localhost:4202/",this.aydHost="https://ayd.luzmo.com/",this.availableDatasets=[]}createRenderRoot(){return this}async firstUpdated(e){super.firstUpdated(e),await ne(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}get calculatedAppServer(){return this.appServer.startsWith("http://localhost")?this.remoteEntryServer:this.appServer}createAndAppendElement(){this.chartElement||(this.chartElement=document.createElement(Wt),this.chartElement.addEventListener("load",e=>this.dispatchEvent(new CustomEvent("load",e))),this.updateVizItemProperties(),this.renderRoot.append(this.chartElement))}updateVizItemProperties(){if(this.chartElement)for(const e in tt){const t=this[e];if(t){const i=["appServer","apiHost","aydHost"].includes(e)?te(t):t;this.chartElement.setAttribute(tt[e],typeof i=="object"?JSON.stringify(i):i)}}}async updated(e){var t;if(this.chartElement)for(const[i]of e.entries()){const r=tt[i]??i,o=typeof this[i]=="object"?JSON.stringify(this[i]):((t=this[i])==null?void 0:t.toString())??this[i];this.chartElement.setAttribute(r,o)}else await ne(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}render(){return m.x``}connectedCallback(){super.connectedCallback();const e=document.querySelector(ht);if(!e)return;const t=new MutationObserver(()=>{const i=e.querySelector('*[slot="custom-chat-widget-content"]');if(!i)return;const r=e.querySelector(Wt);r&&(r.append(i),t.disconnect())});t.observe(e,{childList:!0,subtree:!0})}},be.styles=m.i`
223
219
  :host {
224
220
  display: block;
225
221
  width: 100%;
226
222
  height: 100%;
227
223
  }
228
- `,be);p([m.n()],P.prototype,"appServer");p([m.n()],P.prototype,"apiHost");p([m.n({type:Object})],P.prototype,"options");p([m.n({type:String})],P.prototype,"initialSuggestionsDatasetId");p([m.n()],P.prototype,"aiEndpoint");p([m.n()],P.prototype,"authKey");p([m.n()],P.prototype,"authToken");p([m.n()],P.prototype,"version");p([m.n()],P.prototype,"libVersion");p([m.n()],P.prototype,"remoteEntryServer");p([m.n()],P.prototype,"aydHost");p([m.n({type:Array})],P.prototype,"availableDatasets");customElements.get(dt)||customElements.define(dt,P);var tt={aiEndPoint:"ai-end-point",appServer:"app-server",apiHost:"api-host",options:"options",authKey:"auth-key",authToken:"auth-token",version:"version",libVersion:"lib-version",messages:"messages"},Wt="luzmo-iq-embed-answer",ve,j=(ve=class extends m.r$1{constructor(){super(...arguments),this.appServer="https://app.luzmo.com",this.apiHost="https://api.luzmo.com",this.version=me+"-wc-luzmo",this.libVersion=me+"-wc-luzmo",this.remoteEntryServer="http://localhost:4202"}createRenderRoot(){return this}async firstUpdated(e){super.firstUpdated(e),await ne(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}get calculatedAppServer(){return this.appServer.startsWith("http://localhost")?this.remoteEntryServer:this.appServer}createAndAppendElement(){this.chartElement||(this.chartElement=document.createElement("luzmo-iq-answer-component"),this.chartElement.addEventListener("addQuestion",e=>this.dispatchEvent(new CustomEvent("addQuestion",e))),this.chartElement.addEventListener("addAnswer",e=>this.dispatchEvent(new CustomEvent("addAnswer",e))),this.updateVizItemProperties(),this.renderRoot.append(this.chartElement))}updateVizItemProperties(){if(this.chartElement)for(const e in tt){const t=this[e];if(t){const i=["appServer","apiHost"].includes(e)?te(t):t;this.chartElement.setAttribute(tt[e],typeof i=="object"?JSON.stringify(i):i)}}}async updated(e){var t;if(this.chartElement)for(const[i]of e.entries()){const r=tt[i]??i,o=typeof this[i]=="object"?JSON.stringify(this[i]):((t=this[i])==null?void 0:t.toString())??this[i];this.chartElement.setAttribute(r,o)}else await ne(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}render(){return m.x` `}},ve.styles=m.i`
224
+ `,be);p([m.n()],P.prototype,"appServer");p([m.n()],P.prototype,"apiHost");p([m.n({type:Object})],P.prototype,"options");p([m.n({type:String})],P.prototype,"initialSuggestionsDatasetId");p([m.n()],P.prototype,"aiEndpoint");p([m.n()],P.prototype,"authKey");p([m.n()],P.prototype,"authToken");p([m.n()],P.prototype,"version");p([m.n()],P.prototype,"libVersion");p([m.n()],P.prototype,"remoteEntryServer");p([m.n()],P.prototype,"aydHost");p([m.n({type:Array})],P.prototype,"availableDatasets");customElements.get(ht)||customElements.define(ht,P);var it={aiEndPoint:"ai-end-point",appServer:"app-server",apiHost:"api-host",options:"options",authKey:"auth-key",authToken:"auth-token",version:"version",libVersion:"lib-version",messages:"messages"},Bt="luzmo-iq-embed-answer",ve,j=(ve=class extends m.r$1{constructor(){super(...arguments),this.appServer="https://app.luzmo.com",this.apiHost="https://api.luzmo.com",this.version=me+"-wc-luzmo",this.libVersion=me+"-wc-luzmo",this.remoteEntryServer="http://localhost:4202"}createRenderRoot(){return this}async firstUpdated(e){super.firstUpdated(e),await ne(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}get calculatedAppServer(){return this.appServer.startsWith("http://localhost")?this.remoteEntryServer:this.appServer}createAndAppendElement(){this.chartElement||(this.chartElement=document.createElement("luzmo-iq-answer-component"),this.chartElement.addEventListener("addQuestion",e=>this.dispatchEvent(new CustomEvent("addQuestion",e))),this.chartElement.addEventListener("addAnswer",e=>this.dispatchEvent(new CustomEvent("addAnswer",e))),this.updateVizItemProperties(),this.renderRoot.append(this.chartElement))}updateVizItemProperties(){if(this.chartElement)for(const e in it){const t=this[e];if(t){const i=["appServer","apiHost"].includes(e)?te(t):t;this.chartElement.setAttribute(it[e],typeof i=="object"?JSON.stringify(i):i)}}}async updated(e){var t;if(this.chartElement)for(const[i]of e.entries()){const r=it[i]??i,o=typeof this[i]=="object"?JSON.stringify(this[i]):((t=this[i])==null?void 0:t.toString())??this[i];this.chartElement.setAttribute(r,o)}else await ne(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}render(){return m.x` `}},ve.styles=m.i`
229
225
  :host {
230
226
  display: block;
231
227
  width: 100%;
232
228
  height: 100%;
233
229
  }
234
- `,ve);p([m.n()],j.prototype,"appServer");p([m.n()],j.prototype,"apiHost");p([m.n({type:Object})],j.prototype,"options");p([m.n()],j.prototype,"aiEndPoint");p([m.n()],j.prototype,"authKey");p([m.n()],j.prototype,"authToken");p([m.n()],j.prototype,"messages");p([m.n()],j.prototype,"version");p([m.n()],j.prototype,"libVersion");p([m.n()],j.prototype,"remoteEntryServer");customElements.get(Wt)||customElements.define(Wt,j);var qt,jt;(jt=(qt=m.r$1).disableWarning)==null||jt.call(qt,"change-in-update");function Ss(s,e,t,i,r){const o=(...n)=>(console.warn("gridstack.js: Function `"+t+"` is deprecated in "+r+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),e.apply(s,n));return o.prototype=e.prototype,o}class g{static getElements(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(i&&!isNaN(+e[0])){const o=i.getElementById(e);return o?[o]:[]}let r=t.querySelectorAll(e);return!r.length&&e[0]!=="."&&e[0]!=="#"&&(r=t.querySelectorAll("."+e),r.length||(r=t.querySelectorAll("#"+e))),Array.from(r)}return[e]}static getElement(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(!e.length)return null;if(i&&e[0]==="#")return i.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return t.querySelector(e);if(i&&!isNaN(+e[0]))return i.getElementById(e);let r=t.querySelector(e);return i&&!r&&(r=i.getElementById(e)),r||(r=t.querySelector("."+e)),r}return e}static lazyLoad(e){var t,i;return e.lazyLoad||((i=(t=e.grid)==null?void 0:t.opts)==null?void 0:i.lazyLoad)&&e.lazyLoad!==!1}static createDiv(e,t){const i=document.createElement("div");return e.forEach(r=>{r&&i.classList.add(r)}),t==null||t.appendChild(i),i}static shouldSizeToContent(e,t=!1){return(e==null?void 0:e.grid)&&(t?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,t){return!(e.y>=t.y+t.h||e.y+e.h<=t.y||e.x+e.w<=t.x||e.x>=t.x+t.w)}static isTouching(e,t){return g.isIntercepted(e,{x:t.x-.5,y:t.y-.5,w:t.w+1,h:t.h+1})}static areaIntercept(e,t){const i=e.x>t.x?e.x:t.x,r=e.x+e.w<t.x+t.w?e.x+e.w:t.x+t.w;if(r<=i)return 0;const o=e.y>t.y?e.y:t.y,n=e.y+e.h<t.y+t.h?e.y+e.h:t.y+t.h;return n<=o?0:(r-i)*(n-o)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((r,o)=>{const n=t*((r.y??1e4)-(o.y??1e4));return n===0?t*((r.x??1e4)-(o.x??1e4)):n})}static find(e,t){return t?e.find(i=>i.id===t):void 0}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let t,i="px";if(typeof e=="string")if(e==="auto"||e==="")t=0;else{const r=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!r)throw new Error(`Invalid height val = ${e}`);i=r[2]||"px",t=parseFloat(r[1])}else t=e;return{h:t,unit:i}}static defaults(e,...t){return t.forEach(i=>{for(const r in i){if(!i.hasOwnProperty(r))return;e[r]===null||e[r]===void 0?e[r]=i[r]:typeof i[r]=="object"&&typeof e[r]=="object"&&this.defaults(e[r],i[r])}}),e}static same(e,t){if(typeof e!="object")return e==t;if(typeof e!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}static copyPos(e,t,i=!1){return t.x!==void 0&&(e.x=t.x),t.y!==void 0&&(e.y=t.y),t.w!==void 0&&(e.w=t.w),t.h!==void 0&&(e.h=t.h),i&&(t.minW&&(e.minW=t.minW),t.minH&&(e.minH=t.minH),t.maxW&&(e.maxW=t.maxW),t.maxH&&(e.maxH=t.maxH)),e}static samePos(e,t){return e&&t&&e.x===t.x&&e.y===t.y&&(e.w||1)===(t.w||1)&&(e.h||1)===(t.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,t){if(!(typeof e!="object"||typeof t!="object"))for(let i in e){const r=e[i],o=t[i];i[0]==="_"||r===o?delete e[i]:r&&typeof r=="object"&&o!==void 0&&(g.removeInternalAndSame(r,o),Object.keys(r).length||delete e[i])}}static removeInternalForSave(e,t=!0){for(let i in e)(i[0]==="_"||e[i]===null||e[i]===void 0)&&delete e[i];delete e.grid,t&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,t){let i=!1;return(...r)=>{i||(i=!0,setTimeout(()=>{e(...r),i=!1},t))}}static removePositioningStyles(e){const t=e.style;t.position&&t.removeProperty("position"),t.left&&t.removeProperty("left"),t.top&&t.removeProperty("top"),t.width&&t.removeProperty("width"),t.height&&t.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const t=getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowY)?e:this.getScrollElement(e.parentElement)}static updateScrollPosition(e,t,i){const r=e.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight;if(r.top<0||r.bottom>o){const n=r.bottom-o,a=r.top,l=this.getScrollElement(e);if(l!==null){const d=l.scrollTop;r.top<0&&i<0?e.offsetHeight>o?l.scrollTop+=i:l.scrollTop+=Math.abs(a)>Math.abs(i)?i:a:i>0&&(e.offsetHeight>o?l.scrollTop+=i:l.scrollTop+=n>i?i:n),t.top+=l.scrollTop-d}}}static updateScrollResize(e,t,i){const r=this.getScrollElement(t),o=r.clientHeight,n=r===this.getScrollElement()?0:r.getBoundingClientRect().top,a=e.clientY-n,l=a<i,d=a>o-i;l?r.scrollBy({behavior:"smooth",top:a-i}):d&&r.scrollBy({behavior:"smooth",top:i-(o-a)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const t=["parentGrid","el","grid","subGrid","engine"],i=g.clone(e);for(const r in i)i.hasOwnProperty(r)&&typeof i[r]=="object"&&r.substring(0,2)!=="__"&&!t.find(o=>o===r)&&(i[r]=g.cloneDeep(e[r]));return i}static cloneNode(e){const t=e.cloneNode(!0);return t.removeAttribute("id"),t}static appendTo(e,t){let i;typeof t=="string"?i=g.getElement(t):i=t,i&&i.appendChild(e)}static addElStyles(e,t){if(t instanceof Object)for(const i in t)t.hasOwnProperty(i)&&(Array.isArray(t[i])?t[i].forEach(r=>{e.style[i]=r}):e.style[i]=t[i])}static initEvent(e,t){const i={type:t.type},r={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:t.target?t.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(o=>i[o]=e[o]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(o=>i[o]=e[o]),{...i,...r}}static simulateMouseEvent(e,t,i){const r=e,o=new MouseEvent(t,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:r.ctrlKey??!1,altKey:r.altKey??!1,shiftKey:r.shiftKey??!1,metaKey:r.metaKey??!1,button:0,relatedTarget:e.target});(i||e.target).dispatchEvent(o)}static getValuesFromTransformedElement(e){const t=document.createElement("div");g.addElStyles(t,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(t);const i=t.getBoundingClientRect();return e.removeChild(t),t.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(e,t,i){if(!e)return;const r=e[t];e[t]=e[i],e[i]=r}static canBeRotated(e){var t;return!(!e||e.w===e.h||e.locked||e.noResize||(t=e.grid)!=null&&t.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class ee{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,t=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,t&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,t){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||t.y<=e.y)}_fixCollisions(e,t=e,i,r={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return!1;if(e._moving&&!r.nested&&!this.float&&this.swap(e,i))return!0;let o=t;!this._loading&&this._useEntireRowArea(e,t)&&(o={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,o,r.skip));let n=!1;const a={nested:!0,pack:!1};let l=0;for(;i=i||this.collide(e,o,r.skip);){if(l++>this.nodes.length*2)throw new Error("Infinite collide check");let d;if(i.locked||this._loading||e._moving&&!e._skipDown&&t.y>e.y&&!this.float&&(!this.collide(i,{...i,y:e.y},e)||!this.collide(i,{...i,y:t.y-i.h},e))){e._skipDown=e._skipDown||t.y>e.y;const h={...t,y:i.y+i.h,...a};d=this._loading&&g.samePos(e,h)?!0:this.moveNode(e,h),(i.locked||this._loading)&&d?g.copyPos(t,e):!i.locked&&d&&r.pack&&(this._packNodes(),t.y=i.y+i.h,g.copyPos(e,t)),n=n||d}else d=this.moveNode(i,{...i,y:t.y+t.h,skip:e,...a});if(!d)return n;i=void 0}return n}collide(e,t=e,i){const r=e._id,o=i==null?void 0:i._id;return this.nodes.find(n=>n._id!==r&&n._id!==o&&g.isIntercepted(n,t))}collideAll(e,t=e,i){const r=e._id,o=i==null?void 0:i._id;return this.nodes.filter(n=>n._id!==r&&n._id!==o&&g.isIntercepted(n,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const r=e._rect,o={...t.rect};o.y>r.y?(o.h+=o.y-r.y,o.y=r.y):o.h+=r.y-o.y,o.x>r.x?(o.w+=o.x-r.x,o.x=r.x):o.w+=r.x-o.x;let n,a=.5;for(let l of i){if(l.locked||!l._rect)break;const d=l._rect;let h=Number.MAX_VALUE,c=Number.MAX_VALUE;r.y<d.y?h=(o.y+o.h-d.y)/d.h:r.y+r.h>d.y+d.h&&(h=(d.y+d.h-o.y)/d.h),r.x<d.x?c=(o.x+o.w-d.x)/d.w:r.x+r.w>d.x+d.w&&(c=(d.x+d.w-o.x)/d.w);const u=Math.min(c,h);u>a&&(a=u,n=l)}return t.collide=n,n}cacheRects(e,t,i,r,o,n){return this.nodes.forEach(a=>a._rect={y:a.y*t+i,x:a.x*e+n,w:a.w*e-n-r,h:a.h*t-i-o}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){const o=t.x,n=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=o,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=n):(e.x=o,e.y=n),e._dirty=t._dirty=!0,!0}let r;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(r=g.isTouching(e,t)))return i();if(r!==!1){if(e.w===t.w&&e.x===t.x&&(r||(r=g.isTouching(e,t)))){if(t.y<e.y){const o=e;e=t,t=o}return i()}if(r!==!1){if(e.h===t.h&&e.y===t.y&&(r||(r=g.isTouching(e,t)))){if(t.x<e.x){const o=e;e=t,t=o}return i()}return!1}}}isAreaEmpty(e,t,i,r){const o={x:e||0,y:t||0,w:i||1,h:r||1};return!this.collide(o)}compact(e="compact",t=!0){if(this.nodes.length===0)return this;t&&this.sortNodes();const i=this.batchMode;i||this.batchUpdate();const r=this._inColumnResize;r||(this._inColumnResize=!0);const o=this.nodes;return this.nodes=[],o.forEach((n,a,l)=>{let d;n.locked||(n.autoPosition=!0,e==="list"&&a&&(d=l[a-1])),this.addNode(n,!1,d)}),r||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=g.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let t=e.y;for(;t>e._orig.y;)--t,this.collide(e,{x:e.x,y:t,w:e.w,h:e.h})||(e._dirty=!0,e.y=t)}):this.nodes.forEach((e,t)=>{if(!e.locked)for(;e.y>0;){const i=t===0?0:e.y-1;if(!(t===0||!this.collide(e,{x:e.x,y:i,w:e.w,h:e.h})))break;e._dirty=e.y!==i,e.y=i}}),this)}prepareNode(e,t){e._id=e._id??ee._idSeq++;const i=e.id;if(i){let o=1;for(;this.nodes.find(n=>n.id===e.id&&n!==e);)e.id=i+"_"+o++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const r={x:0,y:0,w:1,h:1};return g.defaults(e,r),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,g.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=r.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=r.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=r.w),isNaN(e.h)&&(e.h=r.h),this.nodeBoundFix(e,t),e}nodeBoundFix(e,t){const i=e._orig||g.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id&&this.findCacheLayout(e,this.defaultColumn)===-1){const o={...e};o.autoPosition||o.x===void 0?(delete o.x,delete o.y):o.x=Math.min(this.defaultColumn-1,o.x),o.w=Math.min(this.defaultColumn,o.w||1),this.cacheOneLayout(o,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(t?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(t?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),g.samePos(e,i)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!g.samePos(t,t._orig)):this.nodes.filter(t=>t._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const t=(e||[]).concat(this.getDirtyNodes());return this.onChange(t),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=g.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||g.samePos(e,e._orig)||(g.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,r){const o=r?r.y*i+(r.x+r.w):0;let n=!1;for(let a=o;!n;++a){const l=a%i,d=Math.floor(a/i);if(l+e.w>i)continue;const h={x:l,y:d,w:e.w,h:e.h};t.find(c=>g.isIntercepted(h,c))||((e.x!==l||e.y!==d)&&(e._dirty=!0),e.x=l,e.y=d,delete e.autoPosition,n=!0)}return n}addNode(e,t=!1,i){const r=this.nodes.find(n=>n._id===e._id);if(r)return r;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let o;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,o=!0),this.nodes.push(e),t&&this.addedNodes.push(e),o||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,t=!0,i=!1){return this.nodes.find(r=>r._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=!0),this.nodes=this.nodes.filter(r=>r._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,t=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(r=>r._removeDOM=!0);const i=this.nodes;return this.removedNodes=t?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(e,t){if(!this.changedPosConstrain(e,t))return!1;if(t.pack=!0,!this.maxRow)return this.moveNode(e,t);let i;const r=new ee({column:this.column,float:this.float,nodes:this.nodes.map(n=>n._id===e._id?(i={...n},i):{...n})});if(!i)return!1;const o=r.moveNode(i,t)&&r.getRow()<=Math.max(this.getRow(),this.maxRow);if(!o&&!t.resizing&&t.collide){const n=t.collide.el.gridstackNode;if(this.swap(e,n))return this._notify(),!0}return o?(r.nodes.filter(n=>n._dirty).forEach(n=>{const a=this.nodes.find(l=>l._id===n._id);a&&(g.copyPos(a,n),a._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new ee({column:this.column,float:this.float,nodes:this.nodes.map(r=>({...r}))}),i={...e};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,t.addNode(i),t.getRow()<=this.maxRow?(e._willFitPos=g.copyPos({},i),!0):!1}changedPosConstrain(e,t){return t.w=t.w||e.w,t.h=t.h||e.h,e.x!==t.x||e.y!==t.y?!0:(e.maxW&&(t.w=Math.min(t.w,e.maxW)),e.maxH&&(t.h=Math.min(t.h,e.maxH)),e.minW&&(t.w=Math.max(t.w,e.minW)),e.minH&&(t.h=Math.max(t.h,e.minH)),e.w!==t.w||e.h!==t.h)}moveNode(e,t){var d,h;if(!e||!t)return!1;let i;t.pack===void 0&&!this.batchMode&&(i=t.pack=!0),typeof t.x!="number"&&(t.x=e.x),typeof t.y!="number"&&(t.y=e.y),typeof t.w!="number"&&(t.w=e.w),typeof t.h!="number"&&(t.h=e.h);const r=e.w!==t.w||e.h!==t.h,o=g.copyPos({},e,!0);if(g.copyPos(o,t),this.nodeBoundFix(o,r),g.copyPos(t,o),!t.forceCollide&&g.samePos(e,t))return!1;const n=g.copyPos({},e),a=this.collideAll(e,o,t.skip);let l=!0;if(a.length){const c=e._moving&&!t.nested;let u=c?this.directionCollideCoverage(e,t,a):a[0];if(c&&u&&((h=(d=e.grid)==null?void 0:d.opts)!=null&&h.subGridDynamic)&&!e.grid._isTemp){const f=g.areaIntercept(t.rect,u._rect),y=g.area(t.rect),v=g.area(u._rect);f/(y<v?y:v)>.8&&(u.grid.makeSubGrid(u.el,void 0,e),u=void 0)}u?l=!this._fixCollisions(e,o,u,t):(l=!1,i&&delete t.pack)}return l&&!g.samePos(e,o)&&(e._dirty=!0,g.copyPos(e,o)),t.pack&&this._packNodes()._notify(),!g.samePos(e,n)}getRow(){return this.nodes.reduce((e,t)=>Math.max(e,t.y+t.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(t=>t._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,t){var n;const i=(n=this._layouts)==null?void 0:n.length,r=i&&this.column!==i-1?this._layouts[i-1]:null,o=[];return this.sortNodes(),this.nodes.forEach(a=>{const l=r==null?void 0:r.find(h=>h._id===a._id),d={...a,...l||{}};g.removeInternalForSave(d,!e),t&&t(a,d),o.push(d)}),o}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((t,i)=>{if(!t||i===this.column)return this;if(i<this.column)this._layouts[i]=void 0;else{const r=i/this.column;e.forEach(o=>{if(!o._orig)return;const n=t.find(a=>a._id===o._id);n&&(n.y>=0&&o.y!==o._orig.y&&(n.y+=o.y-o._orig.y),o.x!==o._orig.x&&(n.x=Math.round(o.x*r)),o.w!==o._orig.w&&(n.w=Math.round(o.w*r)))})}}),this)}columnChanged(e,t,i="moveScale"){var a;if(!this.nodes.length||!t||e===t)return this;const r=i==="compact"||i==="list";r&&this.sortNodes(1),t<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let o=[],n=r?this.nodes:g.sort(this.nodes,-1);if(t>e&&this._layouts){const l=this._layouts[t]||[],d=this._layouts.length-1;!l.length&&e!==d&&((a=this._layouts[d])!=null&&a.length)&&(e=d,this._layouts[d].forEach(h=>{const c=n.find(u=>u._id===h._id);c&&(!r&&!h.autoPosition&&(c.x=h.x??c.x,c.y=h.y??c.y),c.w=h.w??c.w,(h.x==null||h.y===void 0)&&(c.autoPosition=!0))})),l.forEach(h=>{const c=n.findIndex(u=>u._id===h._id);if(c!==-1){const u=n[c];if(r){u.w=h.w;return}(h.autoPosition||isNaN(h.x)||isNaN(h.y))&&this.findEmptyPosition(h,o),h.autoPosition||(u.x=h.x??u.x,u.y=h.y??u.y,u.w=h.w??u.w,o.push(u)),n.splice(c,1)}})}if(r)this.compact(i,!1);else{if(n.length)if(typeof i=="function")i(t,e,o,n);else{const l=r||i==="none"?1:t/e,d=i==="move"||i==="moveScale",h=i==="scale"||i==="moveScale";n.forEach(c=>{c.x=t===1?0:d?Math.round(c.x*l):Math.min(c.x,t-1),c.w=t===1||e===1?1:h?Math.round(c.w*l)||1:Math.min(c.w,t),o.push(c)}),n=[]}o=g.sort(o,-1),this._inColumnResize=!0,this.nodes=[],o.forEach(l=>{this.addNode(l,!1),delete l._orig})}return this.nodes.forEach(l=>delete l._orig),this.batchUpdate(!1,!r),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const r=[];return e.forEach((o,n)=>{if(o._id===void 0){const a=o.id?this.nodes.find(l=>l.id===o.id):void 0;o._id=(a==null?void 0:a._id)??ee._idSeq++}r[n]={x:o.x,y:o.y,w:o.w,_id:o._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=r,this}cacheOneLayout(e,t){e._id=e._id??ee._idSeq++;const i={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete i.x,delete i.y,e.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];const r=this.findCacheLayout(e,t);return r===-1?this._layouts[t].push(i):this._layouts[t][r]=i,this}findCacheLayout(e,t){var i,r;return((r=(i=this._layouts)==null?void 0:i[t])==null?void 0:r.findIndex(o=>o._id===e._id))??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let t=0;t<this._layouts.length;t++){const i=this.findCacheLayout(e,t);i!==-1&&this._layouts[t].splice(i,1)}}cleanupNode(e){for(const t in e)t[0]==="_"&&t!=="_id"&&delete e[t];return this}}ee._idSeq=0;const N={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};class x{}const G=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class Y{}function $e(s,e){s.touches.length>1||(s.cancelable&&s.preventDefault(),g.simulateMouseEvent(s.changedTouches[0],e))}function li(s,e){s.cancelable&&s.preventDefault(),g.simulateMouseEvent(s,e)}function We(s){Y.touchHandled||(Y.touchHandled=!0,$e(s,"mousedown"))}function Be(s){Y.touchHandled&&$e(s,"mousemove")}function Ue(s){if(!Y.touchHandled)return;Y.pointerLeaveTimeout&&(window.clearTimeout(Y.pointerLeaveTimeout),delete Y.pointerLeaveTimeout);const e=!!x.dragElement;$e(s,"mouseup"),e||$e(s,"click"),Y.touchHandled=!1}function Fe(s){s.pointerType!=="mouse"&&s.target.releasePointerCapture(s.pointerId)}function Bt(s){x.dragElement&&s.pointerType!=="mouse"&&li(s,"mouseenter")}function Ut(s){x.dragElement&&s.pointerType!=="mouse"&&(Y.pointerLeaveTimeout=window.setTimeout(()=>{delete Y.pointerLeaveTimeout,li(s,"mouseleave")},10))}class Ye{constructor(e,t,i){this.host=e,this.dir=t,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){const e=this.el=document.createElement("div");return e.classList.add("ui-resizable-handle"),e.classList.add(`${Ye.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),G&&(this.el.addEventListener("touchstart",We),this.el.addEventListener("pointerdown",Fe)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),G&&(this.el.removeEventListener("touchstart",We),this.el.removeEventListener("pointerdown",Fe)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),G&&(this.el.addEventListener("touchmove",Be),this.el.addEventListener("touchend",Ue)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const t=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),G&&(this.el.removeEventListener("touchmove",Be),this.el.removeEventListener("touchend",Ue)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){var t,i;e.key==="Escape"&&((i=(t=this.host.gridstackNode)==null?void 0:t.grid)==null||i.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,t){return this.option[e]&&this.option[e](t),this}}Ye.prefix="ui-resizable-";class pt{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,t){this._eventRegister[e]=t}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,t){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](t)}}class De extends pt{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const r=this.el.parentElement.getBoundingClientRect(),o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},n=this.temporalRect||o;return{position:{left:(n.left-r.left)*this.rectScale.x,top:(n.top-r.top)*this.rectScale.y},size:{width:n.width*this.rectScale.x,height:n.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const t=e.handles&&e.handles!==this.option.handles,i=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(r=>this.option[r]=e[r]),t&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),x.overResizeElement===this&&delete x.overResizeElement),this}_mouseOver(e){x.overResizeElement||x.dragElement||(x.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){x.overResizeElement===this&&(delete x.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Ye(this.el,e,{start:t=>{this._resizeStart(t)},stop:t=>{this._resizeStop(t)},move:t=>{this._resizing(t,e)}})),this}_resizeStart(e){this.sizeToContent=g.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=g.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const t=g.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(t,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",t),this}_resizing(e,t){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,t),this._applyChange();const i=g.initEvent(e,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(e){const t=g.initEvent(e,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(t),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",t),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=De._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,t=g.getValuesFromTransformedElement(e);return this.rectScale={x:t.xScale,y:t.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return De._originStyleProp.forEach((e,t)=>{this.el.style[e]=this.elOriginStyleVal[t]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,t){const i=this.startEvent,r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},o=e.clientX-i.clientX,n=this.sizeToContent?0:e.clientY-i.clientY;let a,l;t.indexOf("e")>-1?r.width+=o:t.indexOf("w")>-1&&(r.width-=o,r.left+=o,a=!0),t.indexOf("s")>-1?r.height+=n:t.indexOf("n")>-1&&(r.height-=n,r.top+=n,l=!0);const d=this._constrainSize(r.width,r.height,a,l);return Math.round(r.width)!==Math.round(d.width)&&(t.indexOf("w")>-1&&(r.left+=r.width-d.width),r.width=d.width),Math.round(r.height)!==Math.round(d.height)&&(t.indexOf("n")>-1&&(r.top+=r.height-d.height),r.height=d.height),r}_constrainSize(e,t,i,r){const o=this.option,n=(i?o.maxWidthMoveLeft:o.maxWidth)||Number.MAX_SAFE_INTEGER,a=o.minWidth/this.rectScale.x||e,l=(r?o.maxHeightMoveUp:o.maxHeight)||Number.MAX_SAFE_INTEGER,d=o.minHeight/this.rectScale.y||t,h=Math.min(n,Math.max(a,e)),c=Math.min(l,Math.max(d,t));return{width:h,height:c}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const t=this.el.parentElement,{left:i,top:r}=t.getBoundingClientRect();e={left:i,top:r,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{const i=this.temporalRect[t],r=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(i-e[t])*r+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}De._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const Ms='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class Ce extends pt{constructor(e,t={}){var o;super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=(o=t==null?void 0:t.handle)==null?void 0:o.substring(1),r=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:r!=null&&r.subGrid?[e.querySelector(t.handle)||e]:Array.from(e.querySelectorAll(t.handle)),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),G&&(e.addEventListener("touchstart",We),e.addEventListener("pointerdown",Fe))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),G&&(t.removeEventListener("touchstart",We),t.removeEventListener("pointerdown",Fe))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this}_mouseDown(e){if(!x.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(Ms)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete x.dragElement,delete x.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),G&&(e.currentTarget.addEventListener("touchmove",Be),e.currentTarget.addEventListener("touchend",Ue)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),x.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const t=g.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}_mouseMove(e){var i;const t=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),x.pauseDrag){const r=Number.isInteger(x.pauseDrag)?x.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),r)}else this._callDrag(e);else if(Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>3){this.dragging=!0,x.dragElement=this;const r=(i=this.el.gridstackNode)==null?void 0:i.grid;r?x.dropElement=r.el.ddElement.ddDroppable:delete x.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=g.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const o=g.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(o,this.ui()),this.triggerEvent("dragstart",o),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){var t,i;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),G&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Be,!0),e.currentTarget.removeEventListener("touchend",Ue,!0)),this.dragging){delete this.dragging,(t=this.el.gridstackNode)==null||delete t._origRotate,document.removeEventListener("keydown",this._keyEvent),((i=x.dropElement)==null?void 0:i.el)===this.el.parentElement&&delete x.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const r=g.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(r),this.triggerEvent("dragstop",r),x.dropElement&&x.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete x.dragElement,delete x.dropElement,delete x.mouseHandled,e.preventDefault()}_keyEvent(e){var r,o;const t=this.el.gridstackNode,i=(t==null?void 0:t.grid)||((o=(r=x.dropElement)==null?void 0:r.el)==null?void 0:o.gridstack);if(e.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),i==null||i.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&i&&(e.key==="r"||e.key==="R")){if(!g.canBeRotated(t))return;t._origRotate=t._origRotate||{...t._orig},delete t._moving,i.setAnimation(!1).rotate(t.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),t._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,t.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",g.swap(t._orig,"w","h"),delete t._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=g.cloneNode(this.el)),e.parentElement||g.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=Ce.originStyleProp.map(t=>this.el.style[t]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging");const t=this.helper.style;return t.pointerEvents="none",t.width=this.dragOffset.width+"px",t.height=this.dragOffset.height+"px",t.willChange="left, top",t.position="fixed",this._dragFollow(e),t.transition="none",setTimeout(()=>{this.helper&&(t.transition=null)},0),this}_removeHelperStyle(){var t;this.helper.classList.remove("ui-draggable-dragging");const e=(t=this.helper)==null?void 0:t.gridstackNode;if(!(e!=null&&e._isAboutToRemove)&&this.dragElementOriginStyle){const i=this.helper,r=this.dragElementOriginStyle.transition||null;i.style.transition=this.dragElementOriginStyle.transition="none",Ce.originStyleProp.forEach(o=>i.style[o]=this.dragElementOriginStyle[o]||null),setTimeout(()=>i.style.transition=r,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const t={left:0,top:0},i=this.helper.style,r=this.dragOffset;i.left=(e.clientX+r.offsetLeft-t.left)*this.dragTransform.xScale+"px",i.top=(e.clientY+r.offsetTop-t.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,t,i){let r=0,o=0;i&&(r=this.dragTransform.xOffset,o=this.dragTransform.yOffset);const n=t.getBoundingClientRect();return{left:n.left,top:n.top,offsetLeft:-e.clientX+n.left-r,offsetTop:-e.clientY+n.top-o,width:n.width*this.dragTransform.xScale,height:n.height*this.dragTransform.yScale}}ui(){const t=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-t.top)*this.dragTransform.yScale,left:(i.left-t.left)*this.dragTransform.xScale}}}}Ce.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class Ds extends pt{constructor(e,t={}){super(),this.el=e,this.option=t,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),G&&(this.el.addEventListener("pointerenter",Bt),this.el.addEventListener("pointerleave",Ut)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),G&&(this.el.removeEventListener("pointerenter",Bt),this.el.removeEventListener("pointerleave",Ut)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this._setupAccept(),this}_mouseEnter(e){if(!x.dragElement||!this._canDrop(x.dragElement.el))return;e.preventDefault(),e.stopPropagation(),x.dropElement&&x.dropElement!==this&&x.dropElement._mouseLeave(e,!0),x.dropElement=this;const t=g.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(x.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){var r;if(!x.dragElement||x.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const i=g.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(x.dragElement)),this.triggerEvent("dropout",i),x.dropElement===this&&(delete x.dropElement,!t)){let o,n=this.el.parentElement;for(;!o&&n;)o=(r=n.ddElement)==null?void 0:r.ddDroppable,n=n.parentElement;o&&o._mouseEnter(e)}}drop(e){e.preventDefault();const t=g.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui(x.dragElement)),this.triggerEvent("drop",t)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}}class yt{static init(e){return e.ddElement||(e.ddElement=new yt(e)),e.ddElement}constructor(e){this.el=e}on(e,t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,t),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new Ce(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new De(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new Ds(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class Cs{resizable(e,t,i,r){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddResizable&&o.ddResizable[t]();else if(t==="destroy")o.ddResizable&&o.cleanResizable();else if(t==="option")o.setupResizable({[i]:r});else{const a=o.el.gridstackNode.grid;let l=o.el.getAttribute("gs-resize-handles")||a.opts.resizable.handles||"e,s,se";l==="all"&&(l="n,e,s,w,se,sw,ne,nw");const d=!a.opts.alwaysShowResizeHandle;o.setupResizable({...a.opts.resizable,handles:l,autoHide:d,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,r){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddDraggable&&o.ddDraggable[t]();else if(t==="destroy")o.ddDraggable&&o.cleanDraggable();else if(t==="option")o.setupDraggable({[i]:r});else{const n=o.el.gridstackNode.grid;o.setupDraggable({...n.opts.draggable,start:t.start,stop:t.stop,drag:t.drag})}}),this}dragIn(e,t){return this._getDDElements(e).forEach(i=>i.setupDraggable(t)),this}droppable(e,t,i,r){return typeof t.accept=="function"&&!t._accept&&(t._accept=t.accept,t.accept=o=>t._accept(o)),this._getDDElements(e,t).forEach(o=>{t==="disable"||t==="enable"?o.ddDroppable&&o.ddDroppable[t]():t==="destroy"?o.ddDroppable&&o.cleanDroppable():t==="option"?o.setupDroppable({[i]:r}):o.setupDroppable(t)}),this}isDroppable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,t,i){return this._getDDElements(e).forEach(r=>r.on(t,o=>{i(o,x.dragElement?x.dragElement.el:o.target,x.dragElement?x.dragElement.helper:null)})),this}off(e,t){return this._getDDElements(e).forEach(i=>i.off(t)),this}_getDDElements(e,t){const i=e.gridstack||t!=="destroy"&&t!=="disable",r=g.getElements(e);return r.length?r.map(n=>n.ddElement||(i?yt.init(n):null)).filter(n=>n):[]}}/*!
230
+ `,ve);p([m.n()],j.prototype,"appServer");p([m.n()],j.prototype,"apiHost");p([m.n({type:Object})],j.prototype,"options");p([m.n()],j.prototype,"aiEndPoint");p([m.n()],j.prototype,"authKey");p([m.n()],j.prototype,"authToken");p([m.n()],j.prototype,"messages");p([m.n()],j.prototype,"version");p([m.n()],j.prototype,"libVersion");p([m.n()],j.prototype,"remoteEntryServer");customElements.get(Bt)||customElements.define(Bt,j);var jt,Kt;(Kt=(jt=m.r$1).disableWarning)==null||Kt.call(jt,"change-in-update");function Rs(s,e,t,i,r){const o=(...n)=>(console.warn("gridstack.js: Function `"+t+"` is deprecated in "+r+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),e.apply(s,n));return o.prototype=e.prototype,o}class g{static getElements(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(i&&!isNaN(+e[0])){const o=i.getElementById(e);return o?[o]:[]}let r=t.querySelectorAll(e);return!r.length&&e[0]!=="."&&e[0]!=="#"&&(r=t.querySelectorAll("."+e),r.length||(r=t.querySelectorAll("#"+e))),Array.from(r)}return[e]}static getElement(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(!e.length)return null;if(i&&e[0]==="#")return i.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return t.querySelector(e);if(i&&!isNaN(+e[0]))return i.getElementById(e);let r=t.querySelector(e);return i&&!r&&(r=i.getElementById(e)),r||(r=t.querySelector("."+e)),r}return e}static lazyLoad(e){var t,i;return e.lazyLoad||((i=(t=e.grid)==null?void 0:t.opts)==null?void 0:i.lazyLoad)&&e.lazyLoad!==!1}static createDiv(e,t){const i=document.createElement("div");return e.forEach(r=>{r&&i.classList.add(r)}),t==null||t.appendChild(i),i}static shouldSizeToContent(e,t=!1){return(e==null?void 0:e.grid)&&(t?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,t){return!(e.y>=t.y+t.h||e.y+e.h<=t.y||e.x+e.w<=t.x||e.x>=t.x+t.w)}static isTouching(e,t){return g.isIntercepted(e,{x:t.x-.5,y:t.y-.5,w:t.w+1,h:t.h+1})}static areaIntercept(e,t){const i=e.x>t.x?e.x:t.x,r=e.x+e.w<t.x+t.w?e.x+e.w:t.x+t.w;if(r<=i)return 0;const o=e.y>t.y?e.y:t.y,n=e.y+e.h<t.y+t.h?e.y+e.h:t.y+t.h;return n<=o?0:(r-i)*(n-o)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((r,o)=>{const n=t*((r.y??1e4)-(o.y??1e4));return n===0?t*((r.x??1e4)-(o.x??1e4)):n})}static find(e,t){return t?e.find(i=>i.id===t):void 0}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let t,i="px";if(typeof e=="string")if(e==="auto"||e==="")t=0;else{const r=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!r)throw new Error(`Invalid height val = ${e}`);i=r[2]||"px",t=parseFloat(r[1])}else t=e;return{h:t,unit:i}}static defaults(e,...t){return t.forEach(i=>{for(const r in i){if(!i.hasOwnProperty(r))return;e[r]===null||e[r]===void 0?e[r]=i[r]:typeof i[r]=="object"&&typeof e[r]=="object"&&this.defaults(e[r],i[r])}}),e}static same(e,t){if(typeof e!="object")return e==t;if(typeof e!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}static copyPos(e,t,i=!1){return t.x!==void 0&&(e.x=t.x),t.y!==void 0&&(e.y=t.y),t.w!==void 0&&(e.w=t.w),t.h!==void 0&&(e.h=t.h),i&&(t.minW&&(e.minW=t.minW),t.minH&&(e.minH=t.minH),t.maxW&&(e.maxW=t.maxW),t.maxH&&(e.maxH=t.maxH)),e}static samePos(e,t){return e&&t&&e.x===t.x&&e.y===t.y&&(e.w||1)===(t.w||1)&&(e.h||1)===(t.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,t){if(!(typeof e!="object"||typeof t!="object"))for(let i in e){const r=e[i],o=t[i];i[0]==="_"||r===o?delete e[i]:r&&typeof r=="object"&&o!==void 0&&(g.removeInternalAndSame(r,o),Object.keys(r).length||delete e[i])}}static removeInternalForSave(e,t=!0){for(let i in e)(i[0]==="_"||e[i]===null||e[i]===void 0)&&delete e[i];delete e.grid,t&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,t){let i=!1;return(...r)=>{i||(i=!0,setTimeout(()=>{e(...r),i=!1},t))}}static removePositioningStyles(e){const t=e.style;t.position&&t.removeProperty("position"),t.left&&t.removeProperty("left"),t.top&&t.removeProperty("top"),t.width&&t.removeProperty("width"),t.height&&t.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const t=getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowY)?e:this.getScrollElement(e.parentElement)}static updateScrollPosition(e,t,i){const r=e.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight;if(r.top<0||r.bottom>o){const n=r.bottom-o,a=r.top,l=this.getScrollElement(e);if(l!==null){const d=l.scrollTop;r.top<0&&i<0?e.offsetHeight>o?l.scrollTop+=i:l.scrollTop+=Math.abs(a)>Math.abs(i)?i:a:i>0&&(e.offsetHeight>o?l.scrollTop+=i:l.scrollTop+=n>i?i:n),t.top+=l.scrollTop-d}}}static updateScrollResize(e,t,i){const r=this.getScrollElement(t),o=r.clientHeight,n=r===this.getScrollElement()?0:r.getBoundingClientRect().top,a=e.clientY-n,l=a<i,d=a>o-i;l?r.scrollBy({behavior:"smooth",top:a-i}):d&&r.scrollBy({behavior:"smooth",top:i-(o-a)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const t=["parentGrid","el","grid","subGrid","engine"],i=g.clone(e);for(const r in i)i.hasOwnProperty(r)&&typeof i[r]=="object"&&r.substring(0,2)!=="__"&&!t.find(o=>o===r)&&(i[r]=g.cloneDeep(e[r]));return i}static cloneNode(e){const t=e.cloneNode(!0);return t.removeAttribute("id"),t}static appendTo(e,t){let i;typeof t=="string"?i=g.getElement(t):i=t,i&&i.appendChild(e)}static addElStyles(e,t){if(t instanceof Object)for(const i in t)t.hasOwnProperty(i)&&(Array.isArray(t[i])?t[i].forEach(r=>{e.style[i]=r}):e.style[i]=t[i])}static initEvent(e,t){const i={type:t.type},r={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:t.target?t.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(o=>i[o]=e[o]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(o=>i[o]=e[o]),{...i,...r}}static simulateMouseEvent(e,t,i){const r=e,o=new MouseEvent(t,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:r.ctrlKey??!1,altKey:r.altKey??!1,shiftKey:r.shiftKey??!1,metaKey:r.metaKey??!1,button:0,relatedTarget:e.target});(i||e.target).dispatchEvent(o)}static getValuesFromTransformedElement(e){const t=document.createElement("div");g.addElStyles(t,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(t);const i=t.getBoundingClientRect();return e.removeChild(t),t.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(e,t,i){if(!e)return;const r=e[t];e[t]=e[i],e[i]=r}static canBeRotated(e){var t;return!(!e||e.w===e.h||e.locked||e.noResize||(t=e.grid)!=null&&t.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class ee{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,t=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,t&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,t){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||t.y<=e.y)}_fixCollisions(e,t=e,i,r={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return!1;if(e._moving&&!r.nested&&!this.float&&this.swap(e,i))return!0;let o=t;!this._loading&&this._useEntireRowArea(e,t)&&(o={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,o,r.skip));let n=!1;const a={nested:!0,pack:!1};let l=0;for(;i=i||this.collide(e,o,r.skip);){if(l++>this.nodes.length*2)throw new Error("Infinite collide check");let d;if(i.locked||this._loading||e._moving&&!e._skipDown&&t.y>e.y&&!this.float&&(!this.collide(i,{...i,y:e.y},e)||!this.collide(i,{...i,y:t.y-i.h},e))){e._skipDown=e._skipDown||t.y>e.y;const h={...t,y:i.y+i.h,...a};d=this._loading&&g.samePos(e,h)?!0:this.moveNode(e,h),(i.locked||this._loading)&&d?g.copyPos(t,e):!i.locked&&d&&r.pack&&(this._packNodes(),t.y=i.y+i.h,g.copyPos(e,t)),n=n||d}else d=this.moveNode(i,{...i,y:t.y+t.h,skip:e,...a});if(!d)return n;i=void 0}return n}collide(e,t=e,i){const r=e._id,o=i==null?void 0:i._id;return this.nodes.find(n=>n._id!==r&&n._id!==o&&g.isIntercepted(n,t))}collideAll(e,t=e,i){const r=e._id,o=i==null?void 0:i._id;return this.nodes.filter(n=>n._id!==r&&n._id!==o&&g.isIntercepted(n,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const r=e._rect,o={...t.rect};o.y>r.y?(o.h+=o.y-r.y,o.y=r.y):o.h+=r.y-o.y,o.x>r.x?(o.w+=o.x-r.x,o.x=r.x):o.w+=r.x-o.x;let n,a=.5;for(let l of i){if(l.locked||!l._rect)break;const d=l._rect;let h=Number.MAX_VALUE,c=Number.MAX_VALUE;r.y<d.y?h=(o.y+o.h-d.y)/d.h:r.y+r.h>d.y+d.h&&(h=(d.y+d.h-o.y)/d.h),r.x<d.x?c=(o.x+o.w-d.x)/d.w:r.x+r.w>d.x+d.w&&(c=(d.x+d.w-o.x)/d.w);const u=Math.min(c,h);u>a&&(a=u,n=l)}return t.collide=n,n}cacheRects(e,t,i,r,o,n){return this.nodes.forEach(a=>a._rect={y:a.y*t+i,x:a.x*e+n,w:a.w*e-n-r,h:a.h*t-i-o}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){const o=t.x,n=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=o,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=n):(e.x=o,e.y=n),e._dirty=t._dirty=!0,!0}let r;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(r=g.isTouching(e,t)))return i();if(r!==!1){if(e.w===t.w&&e.x===t.x&&(r||(r=g.isTouching(e,t)))){if(t.y<e.y){const o=e;e=t,t=o}return i()}if(r!==!1){if(e.h===t.h&&e.y===t.y&&(r||(r=g.isTouching(e,t)))){if(t.x<e.x){const o=e;e=t,t=o}return i()}return!1}}}isAreaEmpty(e,t,i,r){const o={x:e||0,y:t||0,w:i||1,h:r||1};return!this.collide(o)}compact(e="compact",t=!0){if(this.nodes.length===0)return this;t&&this.sortNodes();const i=this.batchMode;i||this.batchUpdate();const r=this._inColumnResize;r||(this._inColumnResize=!0);const o=this.nodes;return this.nodes=[],o.forEach((n,a,l)=>{let d;n.locked||(n.autoPosition=!0,e==="list"&&a&&(d=l[a-1])),this.addNode(n,!1,d)}),r||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=g.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let t=e.y;for(;t>e._orig.y;)--t,this.collide(e,{x:e.x,y:t,w:e.w,h:e.h})||(e._dirty=!0,e.y=t)}):this.nodes.forEach((e,t)=>{if(!e.locked)for(;e.y>0;){const i=t===0?0:e.y-1;if(!(t===0||!this.collide(e,{x:e.x,y:i,w:e.w,h:e.h})))break;e._dirty=e.y!==i,e.y=i}}),this)}prepareNode(e,t){e._id=e._id??ee._idSeq++;const i=e.id;if(i){let o=1;for(;this.nodes.find(n=>n.id===e.id&&n!==e);)e.id=i+"_"+o++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const r={x:0,y:0,w:1,h:1};return g.defaults(e,r),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,g.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=r.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=r.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=r.w),isNaN(e.h)&&(e.h=r.h),this.nodeBoundFix(e,t),e}nodeBoundFix(e,t){const i=e._orig||g.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id&&this.findCacheLayout(e,this.defaultColumn)===-1){const o={...e};o.autoPosition||o.x===void 0?(delete o.x,delete o.y):o.x=Math.min(this.defaultColumn-1,o.x),o.w=Math.min(this.defaultColumn,o.w||1),this.cacheOneLayout(o,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(t?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(t?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),g.samePos(e,i)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!g.samePos(t,t._orig)):this.nodes.filter(t=>t._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const t=(e||[]).concat(this.getDirtyNodes());return this.onChange(t),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=g.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||g.samePos(e,e._orig)||(g.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,r){const o=r?r.y*i+(r.x+r.w):0;let n=!1;for(let a=o;!n;++a){const l=a%i,d=Math.floor(a/i);if(l+e.w>i)continue;const h={x:l,y:d,w:e.w,h:e.h};t.find(c=>g.isIntercepted(h,c))||((e.x!==l||e.y!==d)&&(e._dirty=!0),e.x=l,e.y=d,delete e.autoPosition,n=!0)}return n}addNode(e,t=!1,i){const r=this.nodes.find(n=>n._id===e._id);if(r)return r;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let o;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,o=!0),this.nodes.push(e),t&&this.addedNodes.push(e),o||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,t=!0,i=!1){return this.nodes.find(r=>r._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=!0),this.nodes=this.nodes.filter(r=>r._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,t=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(r=>r._removeDOM=!0);const i=this.nodes;return this.removedNodes=t?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(e,t){if(!this.changedPosConstrain(e,t))return!1;if(t.pack=!0,!this.maxRow)return this.moveNode(e,t);let i;const r=new ee({column:this.column,float:this.float,nodes:this.nodes.map(n=>n._id===e._id?(i={...n},i):{...n})});if(!i)return!1;const o=r.moveNode(i,t)&&r.getRow()<=Math.max(this.getRow(),this.maxRow);if(!o&&!t.resizing&&t.collide){const n=t.collide.el.gridstackNode;if(this.swap(e,n))return this._notify(),!0}return o?(r.nodes.filter(n=>n._dirty).forEach(n=>{const a=this.nodes.find(l=>l._id===n._id);a&&(g.copyPos(a,n),a._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new ee({column:this.column,float:this.float,nodes:this.nodes.map(r=>({...r}))}),i={...e};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,t.addNode(i),t.getRow()<=this.maxRow?(e._willFitPos=g.copyPos({},i),!0):!1}changedPosConstrain(e,t){return t.w=t.w||e.w,t.h=t.h||e.h,e.x!==t.x||e.y!==t.y?!0:(e.maxW&&(t.w=Math.min(t.w,e.maxW)),e.maxH&&(t.h=Math.min(t.h,e.maxH)),e.minW&&(t.w=Math.max(t.w,e.minW)),e.minH&&(t.h=Math.max(t.h,e.minH)),e.w!==t.w||e.h!==t.h)}moveNode(e,t){var d,h;if(!e||!t)return!1;let i;t.pack===void 0&&!this.batchMode&&(i=t.pack=!0),typeof t.x!="number"&&(t.x=e.x),typeof t.y!="number"&&(t.y=e.y),typeof t.w!="number"&&(t.w=e.w),typeof t.h!="number"&&(t.h=e.h);const r=e.w!==t.w||e.h!==t.h,o=g.copyPos({},e,!0);if(g.copyPos(o,t),this.nodeBoundFix(o,r),g.copyPos(t,o),!t.forceCollide&&g.samePos(e,t))return!1;const n=g.copyPos({},e),a=this.collideAll(e,o,t.skip);let l=!0;if(a.length){const c=e._moving&&!t.nested;let u=c?this.directionCollideCoverage(e,t,a):a[0];if(c&&u&&((h=(d=e.grid)==null?void 0:d.opts)!=null&&h.subGridDynamic)&&!e.grid._isTemp){const f=g.areaIntercept(t.rect,u._rect),y=g.area(t.rect),v=g.area(u._rect);f/(y<v?y:v)>.8&&(u.grid.makeSubGrid(u.el,void 0,e),u=void 0)}u?l=!this._fixCollisions(e,o,u,t):(l=!1,i&&delete t.pack)}return l&&!g.samePos(e,o)&&(e._dirty=!0,g.copyPos(e,o)),t.pack&&this._packNodes()._notify(),!g.samePos(e,n)}getRow(){return this.nodes.reduce((e,t)=>Math.max(e,t.y+t.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(t=>t._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,t){var n;const i=(n=this._layouts)==null?void 0:n.length,r=i&&this.column!==i-1?this._layouts[i-1]:null,o=[];return this.sortNodes(),this.nodes.forEach(a=>{const l=r==null?void 0:r.find(h=>h._id===a._id),d={...a,...l||{}};g.removeInternalForSave(d,!e),t&&t(a,d),o.push(d)}),o}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((t,i)=>{if(!t||i===this.column)return this;if(i<this.column)this._layouts[i]=void 0;else{const r=i/this.column;e.forEach(o=>{if(!o._orig)return;const n=t.find(a=>a._id===o._id);n&&(n.y>=0&&o.y!==o._orig.y&&(n.y+=o.y-o._orig.y),o.x!==o._orig.x&&(n.x=Math.round(o.x*r)),o.w!==o._orig.w&&(n.w=Math.round(o.w*r)))})}}),this)}columnChanged(e,t,i="moveScale"){var a;if(!this.nodes.length||!t||e===t)return this;const r=i==="compact"||i==="list";r&&this.sortNodes(1),t<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let o=[],n=r?this.nodes:g.sort(this.nodes,-1);if(t>e&&this._layouts){const l=this._layouts[t]||[],d=this._layouts.length-1;!l.length&&e!==d&&((a=this._layouts[d])!=null&&a.length)&&(e=d,this._layouts[d].forEach(h=>{const c=n.find(u=>u._id===h._id);c&&(!r&&!h.autoPosition&&(c.x=h.x??c.x,c.y=h.y??c.y),c.w=h.w??c.w,(h.x==null||h.y===void 0)&&(c.autoPosition=!0))})),l.forEach(h=>{const c=n.findIndex(u=>u._id===h._id);if(c!==-1){const u=n[c];if(r){u.w=h.w;return}(h.autoPosition||isNaN(h.x)||isNaN(h.y))&&this.findEmptyPosition(h,o),h.autoPosition||(u.x=h.x??u.x,u.y=h.y??u.y,u.w=h.w??u.w,o.push(u)),n.splice(c,1)}})}if(r)this.compact(i,!1);else{if(n.length)if(typeof i=="function")i(t,e,o,n);else{const l=r||i==="none"?1:t/e,d=i==="move"||i==="moveScale",h=i==="scale"||i==="moveScale";n.forEach(c=>{c.x=t===1?0:d?Math.round(c.x*l):Math.min(c.x,t-1),c.w=t===1||e===1?1:h?Math.round(c.w*l)||1:Math.min(c.w,t),o.push(c)}),n=[]}o=g.sort(o,-1),this._inColumnResize=!0,this.nodes=[],o.forEach(l=>{this.addNode(l,!1),delete l._orig})}return this.nodes.forEach(l=>delete l._orig),this.batchUpdate(!1,!r),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const r=[];return e.forEach((o,n)=>{if(o._id===void 0){const a=o.id?this.nodes.find(l=>l.id===o.id):void 0;o._id=(a==null?void 0:a._id)??ee._idSeq++}r[n]={x:o.x,y:o.y,w:o.w,_id:o._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=r,this}cacheOneLayout(e,t){e._id=e._id??ee._idSeq++;const i={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete i.x,delete i.y,e.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];const r=this.findCacheLayout(e,t);return r===-1?this._layouts[t].push(i):this._layouts[t][r]=i,this}findCacheLayout(e,t){var i,r;return((r=(i=this._layouts)==null?void 0:i[t])==null?void 0:r.findIndex(o=>o._id===e._id))??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let t=0;t<this._layouts.length;t++){const i=this.findCacheLayout(e,t);i!==-1&&this._layouts[t].splice(i,1)}}cleanupNode(e){for(const t in e)t[0]==="_"&&t!=="_id"&&delete e[t];return this}}ee._idSeq=0;const N={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};class x{}const G=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class Y{}function $e(s,e){s.touches.length>1||(s.cancelable&&s.preventDefault(),g.simulateMouseEvent(s.changedTouches[0],e))}function di(s,e){s.cancelable&&s.preventDefault(),g.simulateMouseEvent(s,e)}function We(s){Y.touchHandled||(Y.touchHandled=!0,$e(s,"mousedown"))}function Be(s){Y.touchHandled&&$e(s,"mousemove")}function Ue(s){if(!Y.touchHandled)return;Y.pointerLeaveTimeout&&(window.clearTimeout(Y.pointerLeaveTimeout),delete Y.pointerLeaveTimeout);const e=!!x.dragElement;$e(s,"mouseup"),e||$e(s,"click"),Y.touchHandled=!1}function Fe(s){s.pointerType!=="mouse"&&s.target.releasePointerCapture(s.pointerId)}function Ut(s){x.dragElement&&s.pointerType!=="mouse"&&di(s,"mouseenter")}function Ft(s){x.dragElement&&s.pointerType!=="mouse"&&(Y.pointerLeaveTimeout=window.setTimeout(()=>{delete Y.pointerLeaveTimeout,di(s,"mouseleave")},10))}class Ye{constructor(e,t,i){this.host=e,this.dir=t,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){const e=this.el=document.createElement("div");return e.classList.add("ui-resizable-handle"),e.classList.add(`${Ye.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),G&&(this.el.addEventListener("touchstart",We),this.el.addEventListener("pointerdown",Fe)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),G&&(this.el.removeEventListener("touchstart",We),this.el.removeEventListener("pointerdown",Fe)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),G&&(this.el.addEventListener("touchmove",Be),this.el.addEventListener("touchend",Ue)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const t=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),G&&(this.el.removeEventListener("touchmove",Be),this.el.removeEventListener("touchend",Ue)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){var t,i;e.key==="Escape"&&((i=(t=this.host.gridstackNode)==null?void 0:t.grid)==null||i.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,t){return this.option[e]&&this.option[e](t),this}}Ye.prefix="ui-resizable-";class yt{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,t){this._eventRegister[e]=t}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,t){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](t)}}class De extends yt{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const r=this.el.parentElement.getBoundingClientRect(),o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},n=this.temporalRect||o;return{position:{left:(n.left-r.left)*this.rectScale.x,top:(n.top-r.top)*this.rectScale.y},size:{width:n.width*this.rectScale.x,height:n.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const t=e.handles&&e.handles!==this.option.handles,i=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(r=>this.option[r]=e[r]),t&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),x.overResizeElement===this&&delete x.overResizeElement),this}_mouseOver(e){x.overResizeElement||x.dragElement||(x.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){x.overResizeElement===this&&(delete x.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Ye(this.el,e,{start:t=>{this._resizeStart(t)},stop:t=>{this._resizeStop(t)},move:t=>{this._resizing(t,e)}})),this}_resizeStart(e){this.sizeToContent=g.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=g.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const t=g.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(t,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",t),this}_resizing(e,t){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,t),this._applyChange();const i=g.initEvent(e,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(e){const t=g.initEvent(e,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(t),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",t),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=De._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,t=g.getValuesFromTransformedElement(e);return this.rectScale={x:t.xScale,y:t.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return De._originStyleProp.forEach((e,t)=>{this.el.style[e]=this.elOriginStyleVal[t]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,t){const i=this.startEvent,r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},o=e.clientX-i.clientX,n=this.sizeToContent?0:e.clientY-i.clientY;let a,l;t.indexOf("e")>-1?r.width+=o:t.indexOf("w")>-1&&(r.width-=o,r.left+=o,a=!0),t.indexOf("s")>-1?r.height+=n:t.indexOf("n")>-1&&(r.height-=n,r.top+=n,l=!0);const d=this._constrainSize(r.width,r.height,a,l);return Math.round(r.width)!==Math.round(d.width)&&(t.indexOf("w")>-1&&(r.left+=r.width-d.width),r.width=d.width),Math.round(r.height)!==Math.round(d.height)&&(t.indexOf("n")>-1&&(r.top+=r.height-d.height),r.height=d.height),r}_constrainSize(e,t,i,r){const o=this.option,n=(i?o.maxWidthMoveLeft:o.maxWidth)||Number.MAX_SAFE_INTEGER,a=o.minWidth/this.rectScale.x||e,l=(r?o.maxHeightMoveUp:o.maxHeight)||Number.MAX_SAFE_INTEGER,d=o.minHeight/this.rectScale.y||t,h=Math.min(n,Math.max(a,e)),c=Math.min(l,Math.max(d,t));return{width:h,height:c}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const t=this.el.parentElement,{left:i,top:r}=t.getBoundingClientRect();e={left:i,top:r,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{const i=this.temporalRect[t],r=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(i-e[t])*r+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}De._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const Ss='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class Ce extends yt{constructor(e,t={}){var o;super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=(o=t==null?void 0:t.handle)==null?void 0:o.substring(1),r=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:r!=null&&r.subGrid?[e.querySelector(t.handle)||e]:Array.from(e.querySelectorAll(t.handle)),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),G&&(e.addEventListener("touchstart",We),e.addEventListener("pointerdown",Fe))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),G&&(t.removeEventListener("touchstart",We),t.removeEventListener("pointerdown",Fe))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this}_mouseDown(e){if(!x.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(Ss)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete x.dragElement,delete x.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),G&&(e.currentTarget.addEventListener("touchmove",Be),e.currentTarget.addEventListener("touchend",Ue)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),x.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const t=g.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}_mouseMove(e){var i;const t=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),x.pauseDrag){const r=Number.isInteger(x.pauseDrag)?x.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),r)}else this._callDrag(e);else if(Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>3){this.dragging=!0,x.dragElement=this;const r=(i=this.el.gridstackNode)==null?void 0:i.grid;r?x.dropElement=r.el.ddElement.ddDroppable:delete x.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=g.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const o=g.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(o,this.ui()),this.triggerEvent("dragstart",o),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){var t,i;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),G&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Be,!0),e.currentTarget.removeEventListener("touchend",Ue,!0)),this.dragging){delete this.dragging,(t=this.el.gridstackNode)==null||delete t._origRotate,document.removeEventListener("keydown",this._keyEvent),((i=x.dropElement)==null?void 0:i.el)===this.el.parentElement&&delete x.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const r=g.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(r),this.triggerEvent("dragstop",r),x.dropElement&&x.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete x.dragElement,delete x.dropElement,delete x.mouseHandled,e.preventDefault()}_keyEvent(e){var r,o;const t=this.el.gridstackNode,i=(t==null?void 0:t.grid)||((o=(r=x.dropElement)==null?void 0:r.el)==null?void 0:o.gridstack);if(e.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),i==null||i.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&i&&(e.key==="r"||e.key==="R")){if(!g.canBeRotated(t))return;t._origRotate=t._origRotate||{...t._orig},delete t._moving,i.setAnimation(!1).rotate(t.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),t._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,t.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",g.swap(t._orig,"w","h"),delete t._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=g.cloneNode(this.el)),e.parentElement||g.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=Ce.originStyleProp.map(t=>this.el.style[t]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging");const t=this.helper.style;return t.pointerEvents="none",t.width=this.dragOffset.width+"px",t.height=this.dragOffset.height+"px",t.willChange="left, top",t.position="fixed",this._dragFollow(e),t.transition="none",setTimeout(()=>{this.helper&&(t.transition=null)},0),this}_removeHelperStyle(){var t;this.helper.classList.remove("ui-draggable-dragging");const e=(t=this.helper)==null?void 0:t.gridstackNode;if(!(e!=null&&e._isAboutToRemove)&&this.dragElementOriginStyle){const i=this.helper,r=this.dragElementOriginStyle.transition||null;i.style.transition=this.dragElementOriginStyle.transition="none",Ce.originStyleProp.forEach(o=>i.style[o]=this.dragElementOriginStyle[o]||null),setTimeout(()=>i.style.transition=r,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const t={left:0,top:0},i=this.helper.style,r=this.dragOffset;i.left=(e.clientX+r.offsetLeft-t.left)*this.dragTransform.xScale+"px",i.top=(e.clientY+r.offsetTop-t.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,t,i){let r=0,o=0;i&&(r=this.dragTransform.xOffset,o=this.dragTransform.yOffset);const n=t.getBoundingClientRect();return{left:n.left,top:n.top,offsetLeft:-e.clientX+n.left-r,offsetTop:-e.clientY+n.top-o,width:n.width*this.dragTransform.xScale,height:n.height*this.dragTransform.yScale}}ui(){const t=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-t.top)*this.dragTransform.yScale,left:(i.left-t.left)*this.dragTransform.xScale}}}}Ce.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class As extends yt{constructor(e,t={}){super(),this.el=e,this.option=t,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),G&&(this.el.addEventListener("pointerenter",Ut),this.el.addEventListener("pointerleave",Ft)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),G&&(this.el.removeEventListener("pointerenter",Ut),this.el.removeEventListener("pointerleave",Ft)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this._setupAccept(),this}_mouseEnter(e){if(!x.dragElement||!this._canDrop(x.dragElement.el))return;e.preventDefault(),e.stopPropagation(),x.dropElement&&x.dropElement!==this&&x.dropElement._mouseLeave(e,!0),x.dropElement=this;const t=g.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(x.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){var r;if(!x.dragElement||x.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const i=g.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(x.dragElement)),this.triggerEvent("dropout",i),x.dropElement===this&&(delete x.dropElement,!t)){let o,n=this.el.parentElement;for(;!o&&n;)o=(r=n.ddElement)==null?void 0:r.ddDroppable,n=n.parentElement;o&&o._mouseEnter(e)}}drop(e){e.preventDefault();const t=g.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui(x.dragElement)),this.triggerEvent("drop",t)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}}class bt{static init(e){return e.ddElement||(e.ddElement=new bt(e)),e.ddElement}constructor(e){this.el=e}on(e,t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,t),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new Ce(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new De(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new As(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class Ms{resizable(e,t,i,r){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddResizable&&o.ddResizable[t]();else if(t==="destroy")o.ddResizable&&o.cleanResizable();else if(t==="option")o.setupResizable({[i]:r});else{const a=o.el.gridstackNode.grid;let l=o.el.getAttribute("gs-resize-handles")||a.opts.resizable.handles||"e,s,se";l==="all"&&(l="n,e,s,w,se,sw,ne,nw");const d=!a.opts.alwaysShowResizeHandle;o.setupResizable({...a.opts.resizable,handles:l,autoHide:d,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,r){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddDraggable&&o.ddDraggable[t]();else if(t==="destroy")o.ddDraggable&&o.cleanDraggable();else if(t==="option")o.setupDraggable({[i]:r});else{const n=o.el.gridstackNode.grid;o.setupDraggable({...n.opts.draggable,start:t.start,stop:t.stop,drag:t.drag})}}),this}dragIn(e,t){return this._getDDElements(e).forEach(i=>i.setupDraggable(t)),this}droppable(e,t,i,r){return typeof t.accept=="function"&&!t._accept&&(t._accept=t.accept,t.accept=o=>t._accept(o)),this._getDDElements(e,t).forEach(o=>{t==="disable"||t==="enable"?o.ddDroppable&&o.ddDroppable[t]():t==="destroy"?o.ddDroppable&&o.cleanDroppable():t==="option"?o.setupDroppable({[i]:r}):o.setupDroppable(t)}),this}isDroppable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,t,i){return this._getDDElements(e).forEach(r=>r.on(t,o=>{i(o,x.dragElement?x.dragElement.el:o.target,x.dragElement?x.dragElement.helper:null)})),this}off(e,t){return this._getDDElements(e).forEach(i=>i.off(t)),this}_getDDElements(e,t){const i=e.gridstack||t!=="destroy"&&t!=="disable",r=g.getElements(e);return r.length?r.map(n=>n.ddElement||(i?bt.init(n):null)).filter(n=>n):[]}}/*!
235
231
  * GridStack 12.2.1
236
232
  * https://gridstackjs.com/
237
233
  *
238
234
  * Copyright (c) 2021-2024 Alain Dumesny
239
235
  * see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
240
- */const H=new Cs;class _{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=_.getGridElement(t);return i?(i.gridstack||(i.gridstack=new _(i,g.cloneDeep(e))),i.gridstack):(console.error(typeof t=="string"?'GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
236
+ */const H=new Ms;class _{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=_.getGridElement(t);return i?(i.gridstack||(i.gridstack=new _(i,g.cloneDeep(e))),i.gridstack):(console.error(typeof t=="string"?'GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
241
237
  Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(e={},t=".grid-stack"){const i=[];return typeof document>"u"||(_.getGridElements(t).forEach(r=>{r.gridstack||(r.gridstack=new _(r,g.cloneDeep(e))),i.push(r.gridstack)}),i.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
242
- Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(e,t={}){if(!e)return null;let i=e;if(i.gridstack){const n=i.gridstack;return t&&(n.opts={...n.opts,...t}),t.children!==void 0&&n.load(t.children),n}return(!e.classList.contains("grid-stack")||_.addRemoveCB)&&(_.addRemoveCB?i=_.addRemoveCB(e,t,!0,!0):i=g.createDiv(["grid-stack",t.class],e)),_.init(t,i)}static registerEngine(e){_.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=g.createDiv([this.opts.placeholderClass,N.itemClass,this.opts.itemClass]);const e=g.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,t={}){var d;this.el=e,this.opts=t,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=t=t||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),t.row&&(t.minRow=t.maxRow=t.row,delete t.row);const i=g.toNumber(e.getAttribute("gs-row"));t.column==="auto"&&delete t.column,t.alwaysShowResizeHandle!==void 0&&(t._alwaysShowResizeHandle=t.alwaysShowResizeHandle);const r=t.columnOpts;if(r){const h=r.breakpoints;!r.columnWidth&&!(h!=null&&h.length)?delete t.columnOpts:(r.columnMax=r.columnMax||12,(h==null?void 0:h.length)>1&&h.sort((c,u)=>(u.w||0)-(c.w||0)))}const o={...g.cloneDeep(N),column:g.toNumber(e.getAttribute("gs-column"))||N.column,minRow:i||g.toNumber(e.getAttribute("gs-min-row"))||N.minRow,maxRow:i||g.toNumber(e.getAttribute("gs-max-row"))||N.maxRow,staticGrid:g.toBool(e.getAttribute("gs-static"))||N.staticGrid,sizeToContent:g.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||N.draggable.handle},removableOptions:{accept:t.itemClass||N.removableOptions.accept,decline:N.removableOptions.decline}};e.getAttribute("gs-animate")&&(o.animate=g.toBool(e.getAttribute("gs-animate"))),t=g.defaults(t,o),this._initMargin(),this.checkDynamicColumn(),this._updateColumnVar(t),t.rtl==="auto"&&(t.rtl=e.style.direction==="rtl"),t.rtl&&this.el.classList.add("grid-stack-rtl");const n=this.el.closest("."+N.itemClass),a=n==null?void 0:n.gridstackNode;if(a&&(a.subGrid=this,this.parentGridNode=a,this.el.classList.add("grid-stack-nested"),a.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=t.cellHeight==="auto",this._isAutoCellHeight||t.cellHeight==="initial")this.cellHeight(void 0);else{typeof t.cellHeight=="number"&&t.cellHeightUnit&&t.cellHeightUnit!==N.cellHeightUnit&&(t.cellHeight=t.cellHeight+t.cellHeightUnit,delete t.cellHeightUnit);const h=t.cellHeight;delete t.cellHeight,this.cellHeight(h)}t.alwaysShowResizeHandle==="mobile"&&(t.alwaysShowResizeHandle=G),this._setStaticClass();const l=t.engineClass||_.engineClass||ee;if(this.engine=new l({column:this.getColumn(),float:t.float,maxRow:t.maxRow,onChange:h=>{h.forEach(c=>{const u=c.el;u&&(c._removeDOM?(u&&u.remove(),delete c._removeDOM):this._writePosAttr(u,c))}),this._updateContainerHeight()}}),t.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(h=>this._prepareElement(h)),delete this.engine._loading,this.batchUpdate(!1)),t.children){const h=t.children;delete t.children,h.length&&this.load(h)}this.setAnimation(),t.subGridDynamic&&!x.pauseDrag&&(x.pauseDrag=!0),((d=t.draggable)==null?void 0:d.pause)!==void 0&&(x.pauseDrag=t.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}_updateColumnVar(e=this.opts){this.el.classList.add("gs-"+e.column),typeof e.column=="number"&&this.el.style.setProperty("--gs-column-width",`${100/e.column}%`)}addWidget(e){if(typeof e=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(e.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(e);let t,i=e;if(i.grid=this,i!=null&&i.el?t=i.el:_.addRemoveCB?t=_.addRemoveCB(this.el,e,!0,!1):t=this.createWidgetDivs(i),!t)return;if(i=t.gridstackNode,i&&t.parentElement===this.el&&this.engine.nodes.find(o=>o._id===i._id))return t;const r=this._readAttr(t);return g.defaults(e,r),this.engine.prepareNode(e),this.el.appendChild(t),this.makeWidget(t,e),t}createWidgetDivs(e){const t=g.createDiv(["grid-stack-item",this.opts.itemClass]),i=g.createDiv(["grid-stack-item-content"],t);return g.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([r])=>{var o,n;r.isIntersecting&&((o=e.visibleObservable)==null||o.disconnect(),delete e.visibleObservable,_.renderCB(i,e),(n=e.grid)==null||n.prepareDragDrop(e.el))}),window.setTimeout(()=>{var r;return(r=e.visibleObservable)==null?void 0:r.observe(t)})):_.renderCB(i,e),t}makeSubGrid(e,t,i,r=!0){var f,y,v;let o=e.gridstackNode;if(o||(o=this.makeWidget(e).gridstackNode),(f=o.subGrid)!=null&&f.el)return o.subGrid;let n,a=this;for(;a&&!n;)n=(y=a.opts)==null?void 0:y.subGridOpts,a=(v=a.parentGridNode)==null?void 0:v.grid;t=g.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...n||{},...t||o.subGridOpts||{}}),o.subGridOpts=t;let l;t.column==="auto"&&(l=!0,t.column=Math.max(o.w||1,(i==null?void 0:i.w)||1),delete t.columnOpts);let d=o.el.querySelector(".grid-stack-item-content"),h,c;if(r&&(this._removeDD(o.el),c={...o,x:0,y:0},g.removeInternalForSave(c),delete c.subGridOpts,o.content&&(c.content=o.content,delete o.content),_.addRemoveCB?h=_.addRemoveCB(this.el,c,!0,!1):(h=g.createDiv(["grid-stack-item"]),h.appendChild(d),d=g.createDiv(["grid-stack-item-content"],o.el)),this.prepareDragDrop(o.el)),i){const b=l?t.column:o.w,w=o.h+i.h,z=o.el.style;z.transition="none",this.update(o.el,{w:b,h:w}),setTimeout(()=>z.transition=null)}const u=o.subGrid=_.addGrid(d,t);return i!=null&&i._moving&&(u._isTemp=!0),l&&(u._autoColumn=!0),r&&u.makeWidget(h,c),i&&(i._moving?window.setTimeout(()=>g.simulateMouseEvent(i._event,"mouseenter",u.el),0):u.makeWidget(o.el,o)),this.resizeToContentCheck(!1,o),u}removeAsSubGrid(e){var i;const t=(i=this.parentGridNode)==null?void 0:i.grid;t&&(t.batchUpdate(),t.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(r=>{r.x+=this.parentGridNode.x,r.y+=this.parentGridNode.y,t.makeWidget(r.el,r)}),t.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>g.simulateMouseEvent(e._event,"mouseenter",t.el),0))}save(e=!0,t=!1,i=_.saveCB){const r=this.engine.save(e,i);if(r.forEach(o=>{var n;if(e&&o.el&&!o.subGrid&&!i){const a=o.el.querySelector(".grid-stack-item-content");o.content=a==null?void 0:a.innerHTML,o.content||delete o.content}else if(!e&&!i&&delete o.content,(n=o.subGrid)!=null&&n.el){const a=o.subGrid.save(e,t,i);o.subGridOpts=t?a:{children:a},delete o.subGrid}delete o.el}),t){const o=g.cloneDeep(this.opts);o.marginBottom===o.marginTop&&o.marginRight===o.marginLeft&&o.marginTop===o.marginRight&&(o.margin=o.marginTop,delete o.marginTop,delete o.marginRight,delete o.marginBottom,delete o.marginLeft),o.rtl===(this.el.style.direction==="rtl")&&(o.rtl="auto"),this._isAutoCellHeight&&(o.cellHeight="auto"),this._autoColumn&&(o.column="auto");const n=o._alwaysShowResizeHandle;return delete o._alwaysShowResizeHandle,n!==void 0?o.alwaysShowResizeHandle=n:delete o.alwaysShowResizeHandle,g.removeInternalAndSame(o,N),o.children=r,o}return r}load(e,t=_.addRemoveCB||!0){e=g.cloneDeep(e);const i=this.getColumn();e.forEach(h=>{h.w=h.w||1,h.h=h.h||1}),e=g.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let r=0;e.forEach(h=>{r=Math.max(r,(h.x||0)+h.w)}),r>this.engine.defaultColumn&&(this.engine.defaultColumn=r),r>i&&(this.engine.nodes.length===0&&this.responseLayout?(this.engine.nodes=e,this.engine.columnChanged(r,i,this.responseLayout),e=this.engine.nodes,this.engine.nodes=[],delete this.responseLayout):this.engine.cacheLayout(e,r,!0));const o=_.addRemoveCB;typeof t=="function"&&(_.addRemoveCB=t);const n=[];this.batchUpdate();const a=!this.engine.nodes.length,l=a&&this.opts.animate;l&&this.setAnimation(!1),!a&&t&&[...this.engine.nodes].forEach(c=>{if(!c.id)return;g.find(e,c.id)||(_.addRemoveCB&&_.addRemoveCB(this.el,c,!1,!1),n.push(c),this.removeWidget(c.el,!0,!1))}),this.engine._loading=!0;const d=[];return this.engine.nodes=this.engine.nodes.filter(h=>g.find(e,h.id)?(d.push(h),!1):!0),e.forEach(h=>{var u;const c=g.find(d,h.id);if(c){if(g.shouldSizeToContent(c)&&(h.h=c.h),this.engine.nodeBoundFix(h),(h.autoPosition||h.x===void 0||h.y===void 0)&&(h.w=h.w||c.w,h.h=h.h||c.h,this.engine.findEmptyPosition(h)),this.engine.nodes.push(c),g.samePos(c,h)&&this.engine.nodes.length>1&&(this.moveNode(c,{...h,forceCollide:!0}),g.copyPos(h,c)),this.update(c.el,h),(u=h.subGridOpts)!=null&&u.children){const f=c.el.querySelector(".grid-stack");f&&f.gridstack&&f.gridstack.load(h.subGridOpts.children)}}else t&&this.addWidget(h)}),delete this.engine._loading,this.engine.removedNodes=n,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,o?_.addRemoveCB=o:delete _.addRemoveCB,l&&this.setAnimation(!0,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const t=this.el.querySelector("."+this.opts.itemClass);if(t){const r=g.toNumber(t.getAttribute("gs-h"))||1;return Math.round(t.offsetHeight/r)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(e){if(e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){const i=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+i}const t=g.parseHeight(e);return this.opts.cellHeightUnit===t.unit&&this.opts.cellHeight===t.h?this:(this.opts.cellHeightUnit=t.unit,this.opts.cellHeight=t.h,this.el.style.setProperty("--gs-cell-height",`${this.opts.cellHeight}${this.opts.cellHeightUnit}`),this._updateContainerHeight(),this.resizeToContentCheck(),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(e=!1){var t;return e&&((t=this.opts.columnOpts)!=null&&t.breakpointForWindow)?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var o,n;const e=this.opts.columnOpts;if(!e||!e.columnWidth&&!((o=e.breakpoints)!=null&&o.length))return!1;const t=this.getColumn();let i=t;const r=this._widthOrContainer(!0);if(e.columnWidth)i=Math.min(Math.round(r/e.columnWidth)||1,e.columnMax);else{i=e.columnMax;let a=0;for(;a<e.breakpoints.length&&r<=e.breakpoints[a].w;)i=e.breakpoints[a++].c||t}if(i!==t){const a=(n=e.breakpoints)==null?void 0:n.find(l=>l.c===i);return this.column(i,(a==null?void 0:a.layout)||e.layout),!0}return!1}compact(e="compact",t=!0){return this.engine.compact(e,t),this._triggerChangeEvent(),this}column(e,t="moveScale"){if(!e||e<1||this.opts.column===e)return this;const i=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+i),this._updateColumnVar(),this.engine.columnChanged(i,e,t),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):(this.responseLayout=t,this)}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){var t;if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.removeAttribute("gs-current-row")),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,delete this.opts,(t=this._placeholder)==null||delete t.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,t=!1){const i=this.el.getBoundingClientRect();let r;t?r={top:i.top+document.documentElement.scrollTop,left:i.left}:r={top:this.el.offsetTop,left:this.el.offsetLeft};const o=e.left-r.left,n=e.top-r.top,a=i.width/this.getColumn(),l=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(o/a),y:Math.floor(n/l)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow||0)}isAreaEmpty(e,t,i,r){return this.engine.isAreaEmpty(e,t,i,r)}makeWidget(e,t){const i=_.getElement(e);if(!i||i.gridstackNode)return i;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);const r=i.gridstackNode;this._updateContainerHeight(),r.subGridOpts&&this.makeSubGrid(i,r.subGridOpts,void 0,!1);let o;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(o=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),o&&delete this._ignoreLayoutsNodeChange,i}on(e,t){return e.indexOf(" ")!==-1?(e.split(" ").forEach(r=>this.on(r,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=r=>t(r):this._gsEventHandler[e]=r=>{r.detail&&t(r,r.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=t:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.off(i)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,t=!0,i=!0){return e?(_.getElements(e).forEach(r=>{if(r.parentElement&&r.parentElement!==this.el)return;let o=r.gridstackNode;o||(o=this.engine.nodes.find(n=>r===n.el)),o&&(t&&_.addRemoveCB&&_.addRemoveCB(this.el,o,!1,!1),delete r.gridstackNode,this._removeDD(r),this.engine.removeNode(o,t,i),t&&r.parentElement&&r.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,t=!0){return this.engine.nodes.forEach(i=>{e&&_.addRemoveCB&&_.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(e,t),t&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,t){return t?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this.opts.animate=e,this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,t=!0,i=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(r=>{this.prepareDragDrop(r.el),r.subGrid&&i&&r.subGrid.setStatic(e,t,i)}),t&&this._setStaticClass(),this)}updateOptions(e){var i;const t=this.opts;return e===t?this:(e.acceptWidgets!==void 0&&(t.acceptWidgets=e.acceptWidgets,this._setupAcceptWidget()),e.animate!==void 0&&this.setAnimation(e.animate),e.cellHeight&&this.cellHeight(e.cellHeight),e.class!==void 0&&e.class!==t.class&&(t.class&&this.el.classList.remove(t.class),e.class&&this.el.classList.add(e.class)),e.columnOpts?(this.opts.columnOpts=e.columnOpts,this.checkDynamicColumn()):e.columnOpts===null&&this.opts.columnOpts?(delete this.opts.columnOpts,this._updateResizeEvent()):typeof e.column=="number"&&this.column(e.column),e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0?t.minRow=t.maxRow=t.row=e.row:(e.minRow!==void 0&&(t.minRow=e.minRow),e.maxRow!==void 0&&(t.maxRow=e.maxRow)),(i=e.children)!=null&&i.length&&this.load(e.children),this)}update(e,t){return _.getElements(e).forEach(i=>{var h;const r=i==null?void 0:i.gridstackNode;if(!r)return;const o={...g.copyPos({},r),...g.cloneDeep(t)};this.engine.nodeBoundFix(o),delete o.autoPosition;const n=["x","y","w","h"];let a;if(n.some(c=>o[c]!==void 0&&o[c]!==r[c])&&(a={},n.forEach(c=>{a[c]=o[c]!==void 0?o[c]:r[c],delete o[c]})),!a&&(o.minW||o.minH||o.maxW||o.maxH)&&(a={}),o.content!==void 0){const c=i.querySelector(".grid-stack-item-content");c&&c.textContent!==o.content&&(r.content=o.content,_.renderCB(c,o),(h=r.subGrid)!=null&&h.el&&(c.appendChild(r.subGrid.el),r.subGrid._updateContainerHeight())),delete o.content}let l=!1,d=!1;for(const c in o)c[0]!=="_"&&r[c]!==o[c]&&(r[c]=o[c],l=!0,d=d||!this.opts.staticGrid&&(c==="noResize"||c==="noMove"||c==="locked"));if(g.sanitizeMinMax(r),a){const c=a.w!==void 0&&a.w!==r.w;this.moveNode(r,a),c&&r.subGrid?r.subGrid.onResize(this.hasAnimationCSS()?r.w:void 0):this.resizeToContentCheck(c,r),delete r._orig}(a||l)&&this._writeAttr(i,r),d&&this.prepareDragDrop(r.el),_.updateCB&&_.updateCB(r)}),this}moveNode(e,t){const i=e._updating;i||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,t),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){var u,f;if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;const t=e.gridstackNode;if(!t)return;const i=t.grid;if(!i||e.parentElement!==i.el)return;const r=i.getCellHeight(!0);if(!r)return;let o=t.h?t.h*r:e.clientHeight,n;if(t.resizeToContentParent&&(n=e.querySelector(t.resizeToContentParent)),n||(n=e.querySelector(_.resizeToContentParent)),!n)return;const a=e.clientHeight-n.clientHeight,l=t.h?t.h*r-a:n.clientHeight;let d;if(t.subGrid){d=t.subGrid.getRow()*t.subGrid.getCellHeight(!0);const y=t.subGrid.el.getBoundingClientRect(),v=e.getBoundingClientRect();d+=y.top-v.top}else{if((f=(u=t.subGridOpts)==null?void 0:u.children)!=null&&f.length)return;{const y=n.firstElementChild;if(!y){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${_.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}d=y.getBoundingClientRect().height||l}}if(l===d)return;o+=d-l;let h=Math.ceil(o/r);const c=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;c&&h>c&&(h=c,e.classList.add("size-to-content-max")),t.minH&&h<t.minH?h=t.minH:t.maxH&&h>t.maxH&&(h=t.maxH),h!==t.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(t,{h}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){_.resizeToContentCB?_.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return _.getElements(e).forEach(i=>{const r=i.gridstackNode;if(!g.canBeRotated(r))return;const o={w:r.h,h:r.w,minH:r.minW,minW:r.minH,maxH:r.maxW,maxW:r.maxH};if(t){const a=t.left>0?Math.floor(t.left/this.cellWidth()):0,l=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;o.x=r.x+a-(r.h-(l+1)),o.y=r.y+l-a}Object.keys(o).forEach(a=>{o[a]===void 0&&delete o[a]});const n=r._orig;this.update(i,o),r._orig=n}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const i=g.parseHeight(e);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this}getMargin(){return this.opts.margin}willItFit(e){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const t=arguments;let i=0,r={x:t[i++],y:t[i++],w:t[i++],h:t[i++],autoPosition:t[i++]};return this.willItFit(r)}return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){var e;if(this.engine.batchMode)return this;if((e=this.engine.addedNodes)!=null&&e.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(i=>{delete i._dirty});const t=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",t)}return this}_triggerRemoveEvent(){var e;if(this.engine.batchMode)return this;if((e=this.engine.removedNodes)!=null&&e.length){const t=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",t)}return this}_triggerEvent(e,t){const i=t?new CustomEvent(e,{bubbles:!1,detail:t}):new Event(e);let r=this;for(;r.parentGridNode;)r=r.parentGridNode.grid;return r.el.dispatchEvent(i),this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const e=this.parentGridNode;let t=this.getRow()+this._extraDragRow;const i=this.opts.cellHeight,r=this.opts.cellHeightUnit;if(!i)return this;if(!e){const o=g.parseHeight(getComputedStyle(this.el).minHeight);if(o.h>0&&o.unit===r){const n=Math.floor(o.h/i);t<n&&(t=n)}}return this.el.setAttribute("gs-current-row",String(t)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),t&&(this.el.style[e?"minHeight":"height"]=t*i+r),e&&g.shouldSizeToContent(e)&&e.grid.resizeToContentCBCheck(e.el),this}_prepareElement(e,t=!1,i){i=i||this._readAttr(e),e.gridstackNode=i,i.el=e,i.grid=this,i=this.engine.addNode(i,t),this._writeAttr(e,i),e.classList.add(N.itemClass,this.opts.itemClass);const r=g.shouldSizeToContent(i);return r?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),r&&this.resizeToContentCheck(!1,i),g.lazyLoad(i)||this.prepareDragDrop(i.el),this}_writePosAttr(e,t){return(!t._moving&&!t._resizing||this._placeholder===e)&&(e.style.top=t.y?t.y===1?"var(--gs-cell-height)":`calc(${t.y} * var(--gs-cell-height))`:null,e.style.left=t.x?t.x===1?"var(--gs-column-width)":`calc(${t.x} * var(--gs-column-width))`:null,e.style.width=t.w>1?`calc(${t.w} * var(--gs-column-width))`:null,e.style.height=t.h>1?`calc(${t.h} * var(--gs-cell-height))`:null),t.x>0?e.setAttribute("gs-x",String(t.x)):e.removeAttribute("gs-x"),t.y>0?e.setAttribute("gs-y",String(t.y)):e.removeAttribute("gs-y"),t.w>1?e.setAttribute("gs-w",String(t.w)):e.removeAttribute("gs-w"),t.h>1?e.setAttribute("gs-h",String(t.h)):e.removeAttribute("gs-h"),this}_writeAttr(e,t){if(!t)return this;this._writePosAttr(e,t);const i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const r in i)t[r]?e.setAttribute(i[r],String(t[r])):e.removeAttribute(i[r]);return this}_readAttr(e,t=!0){const i={};i.x=g.toNumber(e.getAttribute("gs-x")),i.y=g.toNumber(e.getAttribute("gs-y")),i.w=g.toNumber(e.getAttribute("gs-w")),i.h=g.toNumber(e.getAttribute("gs-h")),i.autoPosition=g.toBool(e.getAttribute("gs-auto-position")),i.noResize=g.toBool(e.getAttribute("gs-no-resize")),i.noMove=g.toBool(e.getAttribute("gs-no-move")),i.locked=g.toBool(e.getAttribute("gs-locked"));const r=e.getAttribute("gs-size-to-content");r&&(r==="true"||r==="false"?i.sizeToContent=g.toBool(r):i.sizeToContent=parseInt(r,10)),i.id=e.getAttribute("gs-id"),i.maxW=g.toNumber(e.getAttribute("gs-max-w")),i.minW=g.toNumber(e.getAttribute("gs-min-w")),i.maxH=g.toNumber(e.getAttribute("gs-max-h")),i.minH=g.toNumber(e.getAttribute("gs-min-h")),t&&(i.w===1&&e.removeAttribute("gs-w"),i.h===1&&e.removeAttribute("gs-h"),i.maxW&&e.removeAttribute("gs-max-w"),i.minW&&e.removeAttribute("gs-min-w"),i.maxH&&e.removeAttribute("gs-max-h"),i.minH&&e.removeAttribute("gs-min-h"));for(const o in i){if(!i.hasOwnProperty(o))return;!i[o]&&i[o]!==0&&o!=="gs-size-to-content"&&delete i[o]}return i}_setStaticClass(){const e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onResize(e=(t=>(t=this.el)==null?void 0:t.clientWidth)()){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let i=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),i=!0):i=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(r=>{r.subGrid&&r.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(i),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(e=!1,t=void 0){if(this.engine){if(e&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,t),this.animationDelay);if(t)g.shouldSizeToContent(t)&&this.resizeToContentCBCheck(t.el);else if(this.engine.nodes.some(i=>g.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(r=>{g.shouldSizeToContent(r)&&this.resizeToContentCBCheck(r.el)}),this._ignoreLayoutsNodeChange=!0,this.batchUpdate(!1),this._ignoreLayoutsNodeChange=!1}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,t?[t]:this.engine.nodes)}}_updateResizeEvent(e=!1){const t=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!e&&t&&!this.resizeObserver?(this._sizeThrottle=g.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(e||!t)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(e=".grid-stack-item"){return g.getElement(e)}static getElements(e=".grid-stack-item"){return g.getElements(e)}static getGridElement(e){return _.getElement(e)}static getGridElements(e){return g.getElements(e)}_initMargin(){let e,t=0,i=[];typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(e=g.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,t=this.opts.margin=e.h),["marginTop","marginRight","marginBottom","marginLeft"].forEach(n=>{this.opts[n]===void 0?this.opts[n]=t:(e=g.parseHeight(this.opts[n]),this.opts[n]=e.h,delete this.opts.margin)}),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop);const o=this.el.style;return o.setProperty("--gs-item-margin-top",`${this.opts.marginTop}${this.opts.marginUnit}`),o.setProperty("--gs-item-margin-bottom",`${this.opts.marginBottom}${this.opts.marginUnit}`),o.setProperty("--gs-item-margin-right",`${this.opts.marginRight}${this.opts.marginUnit}`),o.setProperty("--gs-item-margin-left",`${this.opts.marginLeft}${this.opts.marginUnit}`),this}static getDD(){return H}static setupDragIn(e,t,i,r=document){(t==null?void 0:t.pause)!==void 0&&(x.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?g.getElements(e,r):e).forEach((n,a)=>{H.isDraggable(n)||H.dragIn(n,t),i!=null&&i[a]&&(n.gridstackNode=i[a])})}movable(e,t){return this.opts.staticGrid?this:(_.getElements(e).forEach(i=>{const r=i.gridstackNode;r&&(t?delete r.noMove:r.noMove=!0,this.prepareDragDrop(r.el))}),this)}resizable(e,t){return this.opts.staticGrid?this:(_.getElements(e).forEach(i=>{const r=i.gridstackNode;r&&(t?delete r.noResize:r.noResize=!0,this.prepareDragDrop(r.el))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableMove(e,t)}),this)}enableResize(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableResize(e,t)}),this)}cancelDrag(){var t;const e=(t=this._placeholder)==null?void 0:t.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&_._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return H.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,delete e.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return H.droppable(this.el,"destroy"),this;let e,t;const i=(r,o,n)=>{var u;n=n||o;const a=n.gridstackNode;if(!a)return;if(!((u=a.grid)!=null&&u.el)){n.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const f=n.getBoundingClientRect();n.style.left=f.x+(this.dragTransform.xScale-1)*(r.clientX-f.x)/this.dragTransform.xScale+"px",n.style.top=f.y+(this.dragTransform.yScale-1)*(r.clientY-f.y)/this.dragTransform.yScale+"px",n.style.transformOrigin="0px 0px"}let{top:l,left:d}=n.getBoundingClientRect();const h=this.el.getBoundingClientRect();d-=h.left,l-=h.top;const c={position:{top:l*this.dragTransform.xScale,left:d*this.dragTransform.yScale}};if(a._temporaryRemoved){if(a.x=Math.max(0,Math.round(d/t)),a.y=Math.max(0,Math.round(l/e)),delete a.autoPosition,this.engine.nodeBoundFix(a),!this.engine.willItFit(a)){if(a.autoPosition=!0,!this.engine.willItFit(a)){H.off(o,"drag");return}a._willFitPos&&(g.copyPos(a,a._willFitPos),delete a._willFitPos)}this._onStartMoving(n,r,c,a,t,e)}else this._dragOrResize(n,r,c,a,t,e)};return H.droppable(this.el,{accept:r=>{const o=r.gridstackNode||this._readAttr(r,!1);if((o==null?void 0:o.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;let n=!0;if(typeof this.opts.acceptWidgets=="function")n=this.opts.acceptWidgets(r);else{const a=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;n=r.matches(a)}if(n&&o&&this.opts.maxRow){const a={w:o.w,h:o.h,minW:o.minW,minH:o.minH};n=this.engine.willItFit(a)}return n}}).on(this.el,"dropover",(r,o,n)=>{let a=(n==null?void 0:n.gridstackNode)||o.gridstackNode;if((a==null?void 0:a.grid)===this&&!a._temporaryRemoved)return!1;if(a!=null&&a._sidebarOrig&&(a.w=a._sidebarOrig.w,a.h=a._sidebarOrig.h),a!=null&&a.grid&&a.grid!==this&&!a._temporaryRemoved&&a.grid._leave(o,n),n=n||o,t=this.cellWidth(),e=this.getCellHeight(!0),!a){const h=n.getAttribute("data-gs-widget")||n.getAttribute("gridstacknode");if(h){try{a=JSON.parse(h)}catch{console.error("Gridstack dropover: Bad JSON format: ",h)}n.removeAttribute("data-gs-widget"),n.removeAttribute("gridstacknode")}a||(a=this._readAttr(n)),a._sidebarOrig={w:a.w,h:a.h}}a.grid||(a.el||(a={...a}),a._isExternal=!0,n.gridstackNode=a);const l=a.w||Math.round(n.offsetWidth/t)||1,d=a.h||Math.round(n.offsetHeight/e)||1;return a.grid&&a.grid!==this?(o._gridstackNodeOrig||(o._gridstackNodeOrig=a),o.gridstackNode=a={...a,w:l,h:d,grid:this},delete a.x,delete a.y,this.engine.cleanupNode(a).nodeBoundFix(a),a._initDD=a._isExternal=a._temporaryRemoved=!0):(a.w=l,a.h=d,a._temporaryRemoved=!0),_._itemRemoving(a.el,!1),H.on(o,"drag",i),i(r,o,n),!1}).on(this.el,"dropout",(r,o,n)=>{const a=(n==null?void 0:n.gridstackNode)||o.gridstackNode;return a&&(!a.grid||a.grid===this)&&(this._leave(o,n),this._isTemp&&this.removeAsSubGrid(a)),!1}).on(this.el,"drop",(r,o,n)=>{var u,f,y;const a=(n==null?void 0:n.gridstackNode)||o.gridstackNode;if((a==null?void 0:a.grid)===this&&!a._isExternal)return!1;const l=!!this.placeholder.parentElement,d=o!==n;this.placeholder.remove(),delete this.placeholder.gridstackNode,l&&this.opts.animate&&(this.setAnimation(!1),this.setAnimation(!0,!0));const h=o._gridstackNodeOrig;if(delete o._gridstackNodeOrig,l&&(h!=null&&h.grid)&&h.grid!==this){const v=h.grid;v.engine.removeNodeFromLayoutCache(h),v.engine.removedNodes.push(h),v._triggerRemoveEvent()._triggerChangeEvent(),v.parentGridNode&&!v.engine.nodes.length&&v.opts.subGridDynamic&&v.removeAsSubGrid()}if(!a||(l&&(this.engine.cleanupNode(a),a.grid=this),(u=a.grid)==null||delete u._isTemp,H.off(o,"drag"),n!==o?(n.remove(),o=n):o.remove(),this._removeDD(o),!l))return!1;const c=(y=(f=a.subGrid)==null?void 0:f.el)==null?void 0:y.gridstack;return g.copyPos(a,this._readAttr(this.placeholder)),g.removePositioningStyles(o),d&&(a.content||a.subGridOpts||_.addRemoveCB)?(delete a.el,o=this.addWidget(a)):(this._prepareElement(o,!0,a),this.el.appendChild(o),this.resizeToContentCheck(!1,a),c&&(c.parentGridNode=a),this._updateContainerHeight()),this.engine.addedNodes.push(a),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...r,type:"dropped"},h&&h.grid?h:void 0,a),!1}),this}static _itemRemoving(e,t){if(!e)return;const i=e?e.gridstackNode:void 0;!(i!=null&&i.grid)||e.classList.contains(i.grid.opts.removableOptions.decline)||(t?i._isAboutToRemove=!0:delete i._isAboutToRemove,t?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!H.isDroppable(e)&&H.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>_._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>_._itemRemoving(i,!1)),this):this}prepareDragDrop(e,t=!1){const i=e==null?void 0:e.gridstackNode;if(!i)return;const r=i.noMove||this.opts.disableDrag,o=i.noResize||this.opts.disableResize,n=this.opts.staticGrid||r&&o;if((t||n)&&(i._initDD&&(this._removeDD(e),delete i._initDD),n&&e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!t))return this;if(!i._initDD){let a,l;const d=(u,f)=>{this.triggerEvent(u,u.target),a=this.cellWidth(),l=this.getCellHeight(!0),this._onStartMoving(e,u,f,i,a,l)},h=(u,f)=>{this._dragOrResize(e,u,f,i,a,l)},c=u=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._resizing,delete i._event,delete i._lastTried;const f=i.w!==i._orig.w,y=u.target;if(!(!y.gridstackNode||y.gridstackNode.grid!==this)){if(i.el=y,i._isAboutToRemove){const v=e.gridstackNode.grid;v._gsEventHandler[u.type]&&v._gsEventHandler[u.type](u,y),v.engine.nodes.push(i),v.removeWidget(e,!0,!0)}else g.removePositioningStyles(y),i._temporaryRemoved?(g.copyPos(i,i._orig),this._writePosAttr(y,i),this.engine.addNode(i)):this._writePosAttr(y,i),this.triggerEvent(u,y);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),u.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(f,i))}};H.draggable(e,{start:d,stop:c,drag:h}).resizable(e,{start:d,stop:c,resize:h}),i._initDD=!0}return H.draggable(e,r?"disable":"enable").resizable(e,o?"disable":"enable"),this}_onStartMoving(e,t,i,r,o,n){var a;if(this.engine.cleanNodes().beginUpdate(r),this._writePosAttr(this.placeholder,r),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=r,(a=r.grid)!=null&&a.el)this.dragTransform=g.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const l=this.placeholder.closest(".grid-stack");this.dragTransform=g.getValuesFromTransformedElement(l)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(r.el=this.placeholder,r._lastUiPosition=i.position,r._prevYPix=i.position.top,r._moving=t.type==="dragstart",r._resizing=t.type==="resizestart",delete r._lastTried,t.type==="dropover"&&r._temporaryRemoved&&(this.engine.addNode(r),r._moving=!0),this.engine.cacheRects(o,n,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),t.type==="resizestart"){const l=this.getColumn()-r.x,d=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-r.y;H.resizable(e,"option","minWidth",o*Math.min(r.minW||1,l)).resizable(e,"option","minHeight",n*Math.min(r.minH||1,d)).resizable(e,"option","maxWidth",o*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",o*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,r.x+r.w)).resizable(e,"option","maxHeight",n*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,d)).resizable(e,"option","maxHeightMoveUp",n*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,r.y+r.h))}}_dragOrResize(e,t,i,r,o,n){const a={...r._orig};let l,d=this.opts.marginLeft,h=this.opts.marginRight,c=this.opts.marginTop,u=this.opts.marginBottom;const f=Math.round(n*.1),y=Math.round(o*.1);if(d=Math.min(d,y),h=Math.min(h,y),c=Math.min(c,f),u=Math.min(u,f),t.type==="drag"){if(r._temporaryRemoved)return;const b=i.position.top-r._prevYPix;r._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&g.updateScrollPosition(e,i.position,b);const w=i.position.left+(i.position.left>r._lastUiPosition.left?-h:d),z=i.position.top+(i.position.top>r._lastUiPosition.top?-u:c);a.x=Math.round(w/o),a.y=Math.round(z/n);const k=this._extraDragRow;if(this.engine.collide(r,a)){const A=this.getRow();let R=Math.max(0,a.y+r.h-A);this.opts.maxRow&&A+R>this.opts.maxRow&&(R=Math.max(0,this.opts.maxRow-A)),this._extraDragRow=R}else this._extraDragRow=0;if(this._extraDragRow!==k&&this._updateContainerHeight(),r.x===a.x&&r.y===a.y)return}else if(t.type==="resize"){if(a.x<0||(g.updateScrollResize(t,e,n),a.w=Math.round((i.size.width-d)/o),a.h=Math.round((i.size.height-c)/n),r.w===a.w&&r.h===a.h)||r._lastTried&&r._lastTried.w===a.w&&r._lastTried.h===a.h)return;const b=i.position.left+d,w=i.position.top+c;a.x=Math.round(b/o),a.y=Math.round(w/n),l=!0}r._event=t,r._lastTried=a;const v={x:i.position.left+d,y:i.position.top+c,w:(i.size?i.size.width:r.w*o)-d-h,h:(i.size?i.size.height:r.h*n)-c-u};if(this.engine.moveNodeCheck(r,{...a,cellWidth:o,cellHeight:n,rect:v,resizing:l})){r._lastUiPosition=i.position,this.engine.cacheRects(o,n,c,h,u,d),delete r._skipDown,l&&r.subGrid&&r.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const b=t.target;r._sidebarOrig||this._writePosAttr(b,r),this.triggerEvent(t,b)}}triggerEvent(e,t){let i=this;for(;i.parentGridNode;)i=i.parentGridNode.grid;i._gsEventHandler[e.type]&&i._gsEventHandler[e.type](e,t)}_leave(e,t){t=t||e;const i=t.gridstackNode;if(!i||(t.style.transform=t.style.transformOrigin=null,H.off(e,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&t?t:e;const r=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=r,this.opts.removable===!0&&_._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return Ss(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}_.renderCB=(s,e)=>{s&&(e!=null&&e.content)&&(s.textContent=e.content)};_.resizeToContentParent=".grid-stack-item-content";_.Utils=g;_.Engine=ee;_.GDRev="12.2.1";const Ts=`.grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:#0000001a;margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0;top:0;left:0;width:var(--gs-column-width);height:var(--gs-cell-height)}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item.size-to-content:not(.size-to-content-max)>.grid-stack-item-content{overflow-y:hidden}.grid-stack>.grid-stack-item>.grid-stack-item-content,.grid-stack>.grid-stack-placeholder>.placeholder-content{top:var(--gs-item-margin-top);right:var(--gs-item-margin-right);bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle,.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="%23666" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 20 20"><path d="m10 3 2 2H8l2-2v14l-2-2h4l-2 2"/></svg>');background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:var(--gs-item-margin-top);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:var(--gs-item-margin-top);left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:var(--gs-item-margin-top);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px;right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:var(--gs-item-margin-bottom);right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px;left:var(--gs-item-margin-left)}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging{will-change:left,top}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.ui-draggable-dragging,.ui-resizable-resizing{z-index:10000}.ui-draggable-dragging>.grid-stack-item-content,.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px #0003;opacity:.8}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.grid-stack-placeholder,.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing{transition:left 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-y="0"]{top:0}.grid-stack>.grid-stack-item[gs-x="0"]{left:0}`,C=[];for(let s=0;s<256;++s)C.push((s+256).toString(16).slice(1));function Is(s,e=0){return(C[s[e+0]]+C[s[e+1]]+C[s[e+2]]+C[s[e+3]]+"-"+C[s[e+4]]+C[s[e+5]]+"-"+C[s[e+6]]+C[s[e+7]]+"-"+C[s[e+8]]+C[s[e+9]]+"-"+C[s[e+10]]+C[s[e+11]]+C[s[e+12]]+C[s[e+13]]+C[s[e+14]]+C[s[e+15]]).toLowerCase()}let it;const Ls=new Uint8Array(16);function Hs(){if(!it){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");it=crypto.getRandomValues.bind(crypto)}return it(Ls)}const Ns=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ft={randomUUID:Ns};function ke(s,e,t){var r;if(Ft.randomUUID&&!s)return Ft.randomUUID();s=s||{};const i=s.random??((r=s.rng)==null?void 0:r.call(s))??Hs();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,Is(i)}const Os={icon:ie.R1,label:"Lock",tooltip:"Lock",action:"lock",type:"toggle"},Ps={icon:ie.L2,label:"Edit",tooltip:"Edit",action:"edit",type:"toggle"},di={icon:ie.V1,label:"Edit data",tooltip:"Data",action:"edit-data",type:"toggle"},hi={icon:ie.M1,label:"Edit options",tooltip:"Options",action:"edit-options",type:"toggle"},Gt={icon:ie.a3,label:"Edit filters",tooltip:"Filters",action:"edit-filters",type:"toggle"},ci={icon:ie.e1,label:"Clone",tooltip:"Clone",action:"clone",type:"button"},ui={icon:ie.C1,label:"Delete",tooltip:"Delete",action:"delete",type:"button"},Vt=s=>{if(!s)return;let e=[];return e=structuredClone(s).map(t=>{if(t.type==="group")return t.actions=t.actions??[],t.actions=t.actions.map(i=>{if(typeof i=="string"&&["lock","filters","edit","edit-data","edit-options","edit-filters","delete","clone"].includes(i))return{delete:{...ui},filters:{...Gt},clone:{...ci},edit:{...Ps},"edit-data":{...di},"edit-options":{...hi},"edit-filters":{...Gt},lock:{...Os}}[i];if(typeof i=="object")return i.icon=i.icon??ie.i0,i.label=i.label??i.action,i.tooltip=i.tooltip??i.label??i.action,i.type=["toggle","button"].includes(i.type??"")?i.type:"button",i}).filter(Boolean),t}).filter(Boolean),e},mi=()=>[{type:"group",actions:[{...di},{...hi},{...ci}]},{type:"group",actions:[{...ui}]}],$s=":host{display:block;--luzmo-action-button-content-color-default: var( --luzmo-grid-item-action-button-content-color-default, #fff );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-action-button-content-color-hover, #fff );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-action-button-content-color-down, #fff );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-action-button-content-color-focus, #fff );--luzmo-action-button-background-color-default: var( --luzmo-grid-item-action-button-background-color-default, #333 );--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-action-button-background-color-hover, #444 );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-action-button-background-color-down, #555 );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-action-button-background-color-focus, #666 );--grid-item-actions-flex-direction: column}.action-buttons{display:flex;gap:var(--luzmo-grid-item-action-group-gap, .5rem);flex-direction:var(--luzmo-grid-item-actions-flex-direction, var(--grid-item-actions-flex-direction));outline:none}.action-button[selected]{--luzmo-action-button-background-color-default: var(--luzmo-primary);--luzmo-action-button-background-color-hover: var(--luzmo-primary-hover);--luzmo-action-button-background-color-down: var(--luzmo-primary-down);--luzmo-action-button-background-color-focus: var(--luzmo-primary-focus);--luzmo-action-button-content-color-default: var( --luzmo-primary-inverse-color );--luzmo-action-button-content-color-hover: var(--luzmo-primary-inverse-color);--luzmo-action-button-content-color-down: var(--luzmo-primary-inverse-color);--luzmo-action-button-content-color-focus: var(--luzmo-primary-inverse-color)}:host .action-buttons{--luzmo-action-button-content-color-default: var( --luzmo-grid-item-action-button-content-color-default, #fff );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-action-button-content-color-hover, #fff );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-action-button-content-color-down, #fff );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-action-button-content-color-focus, #fff );--luzmo-action-button-background-color-default: var( --luzmo-grid-item-action-button-background-color-default, #333 );--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-action-button-background-color-hover, #444 );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-action-button-background-color-down, #555 );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-action-button-background-color-focus, #666 )}.delete-button{--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-delete-button-background-color-hover, var(--luzmo-negative-color) );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-delete-button-content-color-hover, #fff );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-delete-button-background-color-focus, var(--luzmo-negative-color-focus) );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-delete-button-content-color-focus, #fff );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-delete-button-background-color-down, var(--luzmo-negative-color-down) );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-delete-button-content-color-down, #fff )}:host([placement=top-start]),:host([placement=top]),:host([placement=top-end]),:host([placement=bottom-start]),:host([placement=bottom]),:host([placement=bottom-end]){--grid-item-actions-flex-direction: row}";var Ws=Object.defineProperty,Bs=Object.getOwnPropertyDescriptor,Xe=(s,e,t,i)=>{for(var r=i>1?void 0:i?Bs(e,t):e,o=s.length-1,n;o>=0;o--)(n=s[o])&&(r=(i?n(e,t,r):n(r))||r);return i&&r&&Ws(e,t,r),r};exports.LuzmoGridItemActionsMenu=class extends Kt.It{constructor(){super(...arguments),this.placement="right-start",this.actions=mi(),this.language="en"}static get styles(){return[m.r($s)]}get isVertical(){return this.placement.includes("left")||this.placement.includes("right")}_dispatchAction(e){this.dispatchEvent(new CustomEvent("action",{bubbles:!0,composed:!0,detail:{action:e.action,type:e.type,active:e.active}}))}_handleActionClick(e){e.type==="toggle"&&(e.active=!e.active,this.actions.forEach(t=>{var i;(i=t.actions)==null||i.forEach(r=>{e!==r&&r.active&&(r.active=!1)})})),this._dispatchAction(e),this.requestUpdate()}clearActiveToggles(){this.actions=this.actions.map(e=>{var t;return{...e,actions:((t=e.actions)==null?void 0:t.map(i=>(i.type==="toggle"&&(i.active=!1),i)))??[]}})}focus(){var t,i;const e=(t=this.shadowRoot)==null?void 0:t.querySelectorAll("luzmo-action-button[toggles]");e&&((i=e[0])==null||i.focus())}_generateActionButton(e){var i,r,o,n;const t={Data:K.msg("Data",{desc:"Grid item action tooltip"}),Options:K.msg("Options",{desc:"Grid item action tooltip"}),Clone:K.msg("Clone",{desc:"Grid item action tooltip"}),Delete:K.msg("Delete",{desc:"Grid item action tooltip"}),Edit:K.msg("Edit",{desc:"Grid item action tooltip"}),Lock:K.msg("Lock",{desc:"Grid item action tooltip"}),Filters:K.msg("Filters",{desc:"Grid item action tooltip"})};return m.x`
238
+ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(e,t={}){if(!e)return null;let i=e;if(i.gridstack){const n=i.gridstack;return t&&(n.opts={...n.opts,...t}),t.children!==void 0&&n.load(t.children),n}return(!e.classList.contains("grid-stack")||_.addRemoveCB)&&(_.addRemoveCB?i=_.addRemoveCB(e,t,!0,!0):i=g.createDiv(["grid-stack",t.class],e)),_.init(t,i)}static registerEngine(e){_.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=g.createDiv([this.opts.placeholderClass,N.itemClass,this.opts.itemClass]);const e=g.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,t={}){var d;this.el=e,this.opts=t,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=t=t||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),t.row&&(t.minRow=t.maxRow=t.row,delete t.row);const i=g.toNumber(e.getAttribute("gs-row"));t.column==="auto"&&delete t.column,t.alwaysShowResizeHandle!==void 0&&(t._alwaysShowResizeHandle=t.alwaysShowResizeHandle);const r=t.columnOpts;if(r){const h=r.breakpoints;!r.columnWidth&&!(h!=null&&h.length)?delete t.columnOpts:(r.columnMax=r.columnMax||12,(h==null?void 0:h.length)>1&&h.sort((c,u)=>(u.w||0)-(c.w||0)))}const o={...g.cloneDeep(N),column:g.toNumber(e.getAttribute("gs-column"))||N.column,minRow:i||g.toNumber(e.getAttribute("gs-min-row"))||N.minRow,maxRow:i||g.toNumber(e.getAttribute("gs-max-row"))||N.maxRow,staticGrid:g.toBool(e.getAttribute("gs-static"))||N.staticGrid,sizeToContent:g.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||N.draggable.handle},removableOptions:{accept:t.itemClass||N.removableOptions.accept,decline:N.removableOptions.decline}};e.getAttribute("gs-animate")&&(o.animate=g.toBool(e.getAttribute("gs-animate"))),t=g.defaults(t,o),this._initMargin(),this.checkDynamicColumn(),this._updateColumnVar(t),t.rtl==="auto"&&(t.rtl=e.style.direction==="rtl"),t.rtl&&this.el.classList.add("grid-stack-rtl");const n=this.el.closest("."+N.itemClass),a=n==null?void 0:n.gridstackNode;if(a&&(a.subGrid=this,this.parentGridNode=a,this.el.classList.add("grid-stack-nested"),a.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=t.cellHeight==="auto",this._isAutoCellHeight||t.cellHeight==="initial")this.cellHeight(void 0);else{typeof t.cellHeight=="number"&&t.cellHeightUnit&&t.cellHeightUnit!==N.cellHeightUnit&&(t.cellHeight=t.cellHeight+t.cellHeightUnit,delete t.cellHeightUnit);const h=t.cellHeight;delete t.cellHeight,this.cellHeight(h)}t.alwaysShowResizeHandle==="mobile"&&(t.alwaysShowResizeHandle=G),this._setStaticClass();const l=t.engineClass||_.engineClass||ee;if(this.engine=new l({column:this.getColumn(),float:t.float,maxRow:t.maxRow,onChange:h=>{h.forEach(c=>{const u=c.el;u&&(c._removeDOM?(u&&u.remove(),delete c._removeDOM):this._writePosAttr(u,c))}),this._updateContainerHeight()}}),t.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(h=>this._prepareElement(h)),delete this.engine._loading,this.batchUpdate(!1)),t.children){const h=t.children;delete t.children,h.length&&this.load(h)}this.setAnimation(),t.subGridDynamic&&!x.pauseDrag&&(x.pauseDrag=!0),((d=t.draggable)==null?void 0:d.pause)!==void 0&&(x.pauseDrag=t.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}_updateColumnVar(e=this.opts){this.el.classList.add("gs-"+e.column),typeof e.column=="number"&&this.el.style.setProperty("--gs-column-width",`${100/e.column}%`)}addWidget(e){if(typeof e=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(e.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(e);let t,i=e;if(i.grid=this,i!=null&&i.el?t=i.el:_.addRemoveCB?t=_.addRemoveCB(this.el,e,!0,!1):t=this.createWidgetDivs(i),!t)return;if(i=t.gridstackNode,i&&t.parentElement===this.el&&this.engine.nodes.find(o=>o._id===i._id))return t;const r=this._readAttr(t);return g.defaults(e,r),this.engine.prepareNode(e),this.el.appendChild(t),this.makeWidget(t,e),t}createWidgetDivs(e){const t=g.createDiv(["grid-stack-item",this.opts.itemClass]),i=g.createDiv(["grid-stack-item-content"],t);return g.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([r])=>{var o,n;r.isIntersecting&&((o=e.visibleObservable)==null||o.disconnect(),delete e.visibleObservable,_.renderCB(i,e),(n=e.grid)==null||n.prepareDragDrop(e.el))}),window.setTimeout(()=>{var r;return(r=e.visibleObservable)==null?void 0:r.observe(t)})):_.renderCB(i,e),t}makeSubGrid(e,t,i,r=!0){var f,y,v;let o=e.gridstackNode;if(o||(o=this.makeWidget(e).gridstackNode),(f=o.subGrid)!=null&&f.el)return o.subGrid;let n,a=this;for(;a&&!n;)n=(y=a.opts)==null?void 0:y.subGridOpts,a=(v=a.parentGridNode)==null?void 0:v.grid;t=g.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...n||{},...t||o.subGridOpts||{}}),o.subGridOpts=t;let l;t.column==="auto"&&(l=!0,t.column=Math.max(o.w||1,(i==null?void 0:i.w)||1),delete t.columnOpts);let d=o.el.querySelector(".grid-stack-item-content"),h,c;if(r&&(this._removeDD(o.el),c={...o,x:0,y:0},g.removeInternalForSave(c),delete c.subGridOpts,o.content&&(c.content=o.content,delete o.content),_.addRemoveCB?h=_.addRemoveCB(this.el,c,!0,!1):(h=g.createDiv(["grid-stack-item"]),h.appendChild(d),d=g.createDiv(["grid-stack-item-content"],o.el)),this.prepareDragDrop(o.el)),i){const b=l?t.column:o.w,w=o.h+i.h,z=o.el.style;z.transition="none",this.update(o.el,{w:b,h:w}),setTimeout(()=>z.transition=null)}const u=o.subGrid=_.addGrid(d,t);return i!=null&&i._moving&&(u._isTemp=!0),l&&(u._autoColumn=!0),r&&u.makeWidget(h,c),i&&(i._moving?window.setTimeout(()=>g.simulateMouseEvent(i._event,"mouseenter",u.el),0):u.makeWidget(o.el,o)),this.resizeToContentCheck(!1,o),u}removeAsSubGrid(e){var i;const t=(i=this.parentGridNode)==null?void 0:i.grid;t&&(t.batchUpdate(),t.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(r=>{r.x+=this.parentGridNode.x,r.y+=this.parentGridNode.y,t.makeWidget(r.el,r)}),t.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>g.simulateMouseEvent(e._event,"mouseenter",t.el),0))}save(e=!0,t=!1,i=_.saveCB){const r=this.engine.save(e,i);if(r.forEach(o=>{var n;if(e&&o.el&&!o.subGrid&&!i){const a=o.el.querySelector(".grid-stack-item-content");o.content=a==null?void 0:a.innerHTML,o.content||delete o.content}else if(!e&&!i&&delete o.content,(n=o.subGrid)!=null&&n.el){const a=o.subGrid.save(e,t,i);o.subGridOpts=t?a:{children:a},delete o.subGrid}delete o.el}),t){const o=g.cloneDeep(this.opts);o.marginBottom===o.marginTop&&o.marginRight===o.marginLeft&&o.marginTop===o.marginRight&&(o.margin=o.marginTop,delete o.marginTop,delete o.marginRight,delete o.marginBottom,delete o.marginLeft),o.rtl===(this.el.style.direction==="rtl")&&(o.rtl="auto"),this._isAutoCellHeight&&(o.cellHeight="auto"),this._autoColumn&&(o.column="auto");const n=o._alwaysShowResizeHandle;return delete o._alwaysShowResizeHandle,n!==void 0?o.alwaysShowResizeHandle=n:delete o.alwaysShowResizeHandle,g.removeInternalAndSame(o,N),o.children=r,o}return r}load(e,t=_.addRemoveCB||!0){e=g.cloneDeep(e);const i=this.getColumn();e.forEach(h=>{h.w=h.w||1,h.h=h.h||1}),e=g.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let r=0;e.forEach(h=>{r=Math.max(r,(h.x||0)+h.w)}),r>this.engine.defaultColumn&&(this.engine.defaultColumn=r),r>i&&(this.engine.nodes.length===0&&this.responseLayout?(this.engine.nodes=e,this.engine.columnChanged(r,i,this.responseLayout),e=this.engine.nodes,this.engine.nodes=[],delete this.responseLayout):this.engine.cacheLayout(e,r,!0));const o=_.addRemoveCB;typeof t=="function"&&(_.addRemoveCB=t);const n=[];this.batchUpdate();const a=!this.engine.nodes.length,l=a&&this.opts.animate;l&&this.setAnimation(!1),!a&&t&&[...this.engine.nodes].forEach(c=>{if(!c.id)return;g.find(e,c.id)||(_.addRemoveCB&&_.addRemoveCB(this.el,c,!1,!1),n.push(c),this.removeWidget(c.el,!0,!1))}),this.engine._loading=!0;const d=[];return this.engine.nodes=this.engine.nodes.filter(h=>g.find(e,h.id)?(d.push(h),!1):!0),e.forEach(h=>{var u;const c=g.find(d,h.id);if(c){if(g.shouldSizeToContent(c)&&(h.h=c.h),this.engine.nodeBoundFix(h),(h.autoPosition||h.x===void 0||h.y===void 0)&&(h.w=h.w||c.w,h.h=h.h||c.h,this.engine.findEmptyPosition(h)),this.engine.nodes.push(c),g.samePos(c,h)&&this.engine.nodes.length>1&&(this.moveNode(c,{...h,forceCollide:!0}),g.copyPos(h,c)),this.update(c.el,h),(u=h.subGridOpts)!=null&&u.children){const f=c.el.querySelector(".grid-stack");f&&f.gridstack&&f.gridstack.load(h.subGridOpts.children)}}else t&&this.addWidget(h)}),delete this.engine._loading,this.engine.removedNodes=n,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,o?_.addRemoveCB=o:delete _.addRemoveCB,l&&this.setAnimation(!0,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const t=this.el.querySelector("."+this.opts.itemClass);if(t){const r=g.toNumber(t.getAttribute("gs-h"))||1;return Math.round(t.offsetHeight/r)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(e){if(e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){const i=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+i}const t=g.parseHeight(e);return this.opts.cellHeightUnit===t.unit&&this.opts.cellHeight===t.h?this:(this.opts.cellHeightUnit=t.unit,this.opts.cellHeight=t.h,this.el.style.setProperty("--gs-cell-height",`${this.opts.cellHeight}${this.opts.cellHeightUnit}`),this._updateContainerHeight(),this.resizeToContentCheck(),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(e=!1){var t;return e&&((t=this.opts.columnOpts)!=null&&t.breakpointForWindow)?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var o,n;const e=this.opts.columnOpts;if(!e||!e.columnWidth&&!((o=e.breakpoints)!=null&&o.length))return!1;const t=this.getColumn();let i=t;const r=this._widthOrContainer(!0);if(e.columnWidth)i=Math.min(Math.round(r/e.columnWidth)||1,e.columnMax);else{i=e.columnMax;let a=0;for(;a<e.breakpoints.length&&r<=e.breakpoints[a].w;)i=e.breakpoints[a++].c||t}if(i!==t){const a=(n=e.breakpoints)==null?void 0:n.find(l=>l.c===i);return this.column(i,(a==null?void 0:a.layout)||e.layout),!0}return!1}compact(e="compact",t=!0){return this.engine.compact(e,t),this._triggerChangeEvent(),this}column(e,t="moveScale"){if(!e||e<1||this.opts.column===e)return this;const i=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+i),this._updateColumnVar(),this.engine.columnChanged(i,e,t),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):(this.responseLayout=t,this)}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){var t;if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.removeAttribute("gs-current-row")),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,delete this.opts,(t=this._placeholder)==null||delete t.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,t=!1){const i=this.el.getBoundingClientRect();let r;t?r={top:i.top+document.documentElement.scrollTop,left:i.left}:r={top:this.el.offsetTop,left:this.el.offsetLeft};const o=e.left-r.left,n=e.top-r.top,a=i.width/this.getColumn(),l=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(o/a),y:Math.floor(n/l)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow||0)}isAreaEmpty(e,t,i,r){return this.engine.isAreaEmpty(e,t,i,r)}makeWidget(e,t){const i=_.getElement(e);if(!i||i.gridstackNode)return i;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);const r=i.gridstackNode;this._updateContainerHeight(),r.subGridOpts&&this.makeSubGrid(i,r.subGridOpts,void 0,!1);let o;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(o=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),o&&delete this._ignoreLayoutsNodeChange,i}on(e,t){return e.indexOf(" ")!==-1?(e.split(" ").forEach(r=>this.on(r,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=r=>t(r):this._gsEventHandler[e]=r=>{r.detail&&t(r,r.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=t:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.off(i)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,t=!0,i=!0){return e?(_.getElements(e).forEach(r=>{if(r.parentElement&&r.parentElement!==this.el)return;let o=r.gridstackNode;o||(o=this.engine.nodes.find(n=>r===n.el)),o&&(t&&_.addRemoveCB&&_.addRemoveCB(this.el,o,!1,!1),delete r.gridstackNode,this._removeDD(r),this.engine.removeNode(o,t,i),t&&r.parentElement&&r.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,t=!0){return this.engine.nodes.forEach(i=>{e&&_.addRemoveCB&&_.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(e,t),t&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,t){return t?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this.opts.animate=e,this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,t=!0,i=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(r=>{this.prepareDragDrop(r.el),r.subGrid&&i&&r.subGrid.setStatic(e,t,i)}),t&&this._setStaticClass(),this)}updateOptions(e){var i;const t=this.opts;return e===t?this:(e.acceptWidgets!==void 0&&(t.acceptWidgets=e.acceptWidgets,this._setupAcceptWidget()),e.animate!==void 0&&this.setAnimation(e.animate),e.cellHeight&&this.cellHeight(e.cellHeight),e.class!==void 0&&e.class!==t.class&&(t.class&&this.el.classList.remove(t.class),e.class&&this.el.classList.add(e.class)),e.columnOpts?(this.opts.columnOpts=e.columnOpts,this.checkDynamicColumn()):e.columnOpts===null&&this.opts.columnOpts?(delete this.opts.columnOpts,this._updateResizeEvent()):typeof e.column=="number"&&this.column(e.column),e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0?t.minRow=t.maxRow=t.row=e.row:(e.minRow!==void 0&&(t.minRow=e.minRow),e.maxRow!==void 0&&(t.maxRow=e.maxRow)),(i=e.children)!=null&&i.length&&this.load(e.children),this)}update(e,t){return _.getElements(e).forEach(i=>{var h;const r=i==null?void 0:i.gridstackNode;if(!r)return;const o={...g.copyPos({},r),...g.cloneDeep(t)};this.engine.nodeBoundFix(o),delete o.autoPosition;const n=["x","y","w","h"];let a;if(n.some(c=>o[c]!==void 0&&o[c]!==r[c])&&(a={},n.forEach(c=>{a[c]=o[c]!==void 0?o[c]:r[c],delete o[c]})),!a&&(o.minW||o.minH||o.maxW||o.maxH)&&(a={}),o.content!==void 0){const c=i.querySelector(".grid-stack-item-content");c&&c.textContent!==o.content&&(r.content=o.content,_.renderCB(c,o),(h=r.subGrid)!=null&&h.el&&(c.appendChild(r.subGrid.el),r.subGrid._updateContainerHeight())),delete o.content}let l=!1,d=!1;for(const c in o)c[0]!=="_"&&r[c]!==o[c]&&(r[c]=o[c],l=!0,d=d||!this.opts.staticGrid&&(c==="noResize"||c==="noMove"||c==="locked"));if(g.sanitizeMinMax(r),a){const c=a.w!==void 0&&a.w!==r.w;this.moveNode(r,a),c&&r.subGrid?r.subGrid.onResize(this.hasAnimationCSS()?r.w:void 0):this.resizeToContentCheck(c,r),delete r._orig}(a||l)&&this._writeAttr(i,r),d&&this.prepareDragDrop(r.el),_.updateCB&&_.updateCB(r)}),this}moveNode(e,t){const i=e._updating;i||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,t),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){var u,f;if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;const t=e.gridstackNode;if(!t)return;const i=t.grid;if(!i||e.parentElement!==i.el)return;const r=i.getCellHeight(!0);if(!r)return;let o=t.h?t.h*r:e.clientHeight,n;if(t.resizeToContentParent&&(n=e.querySelector(t.resizeToContentParent)),n||(n=e.querySelector(_.resizeToContentParent)),!n)return;const a=e.clientHeight-n.clientHeight,l=t.h?t.h*r-a:n.clientHeight;let d;if(t.subGrid){d=t.subGrid.getRow()*t.subGrid.getCellHeight(!0);const y=t.subGrid.el.getBoundingClientRect(),v=e.getBoundingClientRect();d+=y.top-v.top}else{if((f=(u=t.subGridOpts)==null?void 0:u.children)!=null&&f.length)return;{const y=n.firstElementChild;if(!y){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${_.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}d=y.getBoundingClientRect().height||l}}if(l===d)return;o+=d-l;let h=Math.ceil(o/r);const c=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;c&&h>c&&(h=c,e.classList.add("size-to-content-max")),t.minH&&h<t.minH?h=t.minH:t.maxH&&h>t.maxH&&(h=t.maxH),h!==t.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(t,{h}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){_.resizeToContentCB?_.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return _.getElements(e).forEach(i=>{const r=i.gridstackNode;if(!g.canBeRotated(r))return;const o={w:r.h,h:r.w,minH:r.minW,minW:r.minH,maxH:r.maxW,maxW:r.maxH};if(t){const a=t.left>0?Math.floor(t.left/this.cellWidth()):0,l=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;o.x=r.x+a-(r.h-(l+1)),o.y=r.y+l-a}Object.keys(o).forEach(a=>{o[a]===void 0&&delete o[a]});const n=r._orig;this.update(i,o),r._orig=n}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const i=g.parseHeight(e);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this}getMargin(){return this.opts.margin}willItFit(e){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const t=arguments;let i=0,r={x:t[i++],y:t[i++],w:t[i++],h:t[i++],autoPosition:t[i++]};return this.willItFit(r)}return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){var e;if(this.engine.batchMode)return this;if((e=this.engine.addedNodes)!=null&&e.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(i=>{delete i._dirty});const t=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",t)}return this}_triggerRemoveEvent(){var e;if(this.engine.batchMode)return this;if((e=this.engine.removedNodes)!=null&&e.length){const t=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",t)}return this}_triggerEvent(e,t){const i=t?new CustomEvent(e,{bubbles:!1,detail:t}):new Event(e);let r=this;for(;r.parentGridNode;)r=r.parentGridNode.grid;return r.el.dispatchEvent(i),this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const e=this.parentGridNode;let t=this.getRow()+this._extraDragRow;const i=this.opts.cellHeight,r=this.opts.cellHeightUnit;if(!i)return this;if(!e){const o=g.parseHeight(getComputedStyle(this.el).minHeight);if(o.h>0&&o.unit===r){const n=Math.floor(o.h/i);t<n&&(t=n)}}return this.el.setAttribute("gs-current-row",String(t)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),t&&(this.el.style[e?"minHeight":"height"]=t*i+r),e&&g.shouldSizeToContent(e)&&e.grid.resizeToContentCBCheck(e.el),this}_prepareElement(e,t=!1,i){i=i||this._readAttr(e),e.gridstackNode=i,i.el=e,i.grid=this,i=this.engine.addNode(i,t),this._writeAttr(e,i),e.classList.add(N.itemClass,this.opts.itemClass);const r=g.shouldSizeToContent(i);return r?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),r&&this.resizeToContentCheck(!1,i),g.lazyLoad(i)||this.prepareDragDrop(i.el),this}_writePosAttr(e,t){return(!t._moving&&!t._resizing||this._placeholder===e)&&(e.style.top=t.y?t.y===1?"var(--gs-cell-height)":`calc(${t.y} * var(--gs-cell-height))`:null,e.style.left=t.x?t.x===1?"var(--gs-column-width)":`calc(${t.x} * var(--gs-column-width))`:null,e.style.width=t.w>1?`calc(${t.w} * var(--gs-column-width))`:null,e.style.height=t.h>1?`calc(${t.h} * var(--gs-cell-height))`:null),t.x>0?e.setAttribute("gs-x",String(t.x)):e.removeAttribute("gs-x"),t.y>0?e.setAttribute("gs-y",String(t.y)):e.removeAttribute("gs-y"),t.w>1?e.setAttribute("gs-w",String(t.w)):e.removeAttribute("gs-w"),t.h>1?e.setAttribute("gs-h",String(t.h)):e.removeAttribute("gs-h"),this}_writeAttr(e,t){if(!t)return this;this._writePosAttr(e,t);const i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const r in i)t[r]?e.setAttribute(i[r],String(t[r])):e.removeAttribute(i[r]);return this}_readAttr(e,t=!0){const i={};i.x=g.toNumber(e.getAttribute("gs-x")),i.y=g.toNumber(e.getAttribute("gs-y")),i.w=g.toNumber(e.getAttribute("gs-w")),i.h=g.toNumber(e.getAttribute("gs-h")),i.autoPosition=g.toBool(e.getAttribute("gs-auto-position")),i.noResize=g.toBool(e.getAttribute("gs-no-resize")),i.noMove=g.toBool(e.getAttribute("gs-no-move")),i.locked=g.toBool(e.getAttribute("gs-locked"));const r=e.getAttribute("gs-size-to-content");r&&(r==="true"||r==="false"?i.sizeToContent=g.toBool(r):i.sizeToContent=parseInt(r,10)),i.id=e.getAttribute("gs-id"),i.maxW=g.toNumber(e.getAttribute("gs-max-w")),i.minW=g.toNumber(e.getAttribute("gs-min-w")),i.maxH=g.toNumber(e.getAttribute("gs-max-h")),i.minH=g.toNumber(e.getAttribute("gs-min-h")),t&&(i.w===1&&e.removeAttribute("gs-w"),i.h===1&&e.removeAttribute("gs-h"),i.maxW&&e.removeAttribute("gs-max-w"),i.minW&&e.removeAttribute("gs-min-w"),i.maxH&&e.removeAttribute("gs-max-h"),i.minH&&e.removeAttribute("gs-min-h"));for(const o in i){if(!i.hasOwnProperty(o))return;!i[o]&&i[o]!==0&&o!=="gs-size-to-content"&&delete i[o]}return i}_setStaticClass(){const e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onResize(e=(t=>(t=this.el)==null?void 0:t.clientWidth)()){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let i=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),i=!0):i=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(r=>{r.subGrid&&r.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(i),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(e=!1,t=void 0){if(this.engine){if(e&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,t),this.animationDelay);if(t)g.shouldSizeToContent(t)&&this.resizeToContentCBCheck(t.el);else if(this.engine.nodes.some(i=>g.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(r=>{g.shouldSizeToContent(r)&&this.resizeToContentCBCheck(r.el)}),this._ignoreLayoutsNodeChange=!0,this.batchUpdate(!1),this._ignoreLayoutsNodeChange=!1}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,t?[t]:this.engine.nodes)}}_updateResizeEvent(e=!1){const t=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!e&&t&&!this.resizeObserver?(this._sizeThrottle=g.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(e||!t)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(e=".grid-stack-item"){return g.getElement(e)}static getElements(e=".grid-stack-item"){return g.getElements(e)}static getGridElement(e){return _.getElement(e)}static getGridElements(e){return g.getElements(e)}_initMargin(){let e,t=0,i=[];typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(e=g.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,t=this.opts.margin=e.h),["marginTop","marginRight","marginBottom","marginLeft"].forEach(n=>{this.opts[n]===void 0?this.opts[n]=t:(e=g.parseHeight(this.opts[n]),this.opts[n]=e.h,delete this.opts.margin)}),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop);const o=this.el.style;return o.setProperty("--gs-item-margin-top",`${this.opts.marginTop}${this.opts.marginUnit}`),o.setProperty("--gs-item-margin-bottom",`${this.opts.marginBottom}${this.opts.marginUnit}`),o.setProperty("--gs-item-margin-right",`${this.opts.marginRight}${this.opts.marginUnit}`),o.setProperty("--gs-item-margin-left",`${this.opts.marginLeft}${this.opts.marginUnit}`),this}static getDD(){return H}static setupDragIn(e,t,i,r=document){(t==null?void 0:t.pause)!==void 0&&(x.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?g.getElements(e,r):e).forEach((n,a)=>{H.isDraggable(n)||H.dragIn(n,t),i!=null&&i[a]&&(n.gridstackNode=i[a])})}movable(e,t){return this.opts.staticGrid?this:(_.getElements(e).forEach(i=>{const r=i.gridstackNode;r&&(t?delete r.noMove:r.noMove=!0,this.prepareDragDrop(r.el))}),this)}resizable(e,t){return this.opts.staticGrid?this:(_.getElements(e).forEach(i=>{const r=i.gridstackNode;r&&(t?delete r.noResize:r.noResize=!0,this.prepareDragDrop(r.el))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableMove(e,t)}),this)}enableResize(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableResize(e,t)}),this)}cancelDrag(){var t;const e=(t=this._placeholder)==null?void 0:t.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&_._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return H.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,delete e.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return H.droppable(this.el,"destroy"),this;let e,t;const i=(r,o,n)=>{var u;n=n||o;const a=n.gridstackNode;if(!a)return;if(!((u=a.grid)!=null&&u.el)){n.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const f=n.getBoundingClientRect();n.style.left=f.x+(this.dragTransform.xScale-1)*(r.clientX-f.x)/this.dragTransform.xScale+"px",n.style.top=f.y+(this.dragTransform.yScale-1)*(r.clientY-f.y)/this.dragTransform.yScale+"px",n.style.transformOrigin="0px 0px"}let{top:l,left:d}=n.getBoundingClientRect();const h=this.el.getBoundingClientRect();d-=h.left,l-=h.top;const c={position:{top:l*this.dragTransform.xScale,left:d*this.dragTransform.yScale}};if(a._temporaryRemoved){if(a.x=Math.max(0,Math.round(d/t)),a.y=Math.max(0,Math.round(l/e)),delete a.autoPosition,this.engine.nodeBoundFix(a),!this.engine.willItFit(a)){if(a.autoPosition=!0,!this.engine.willItFit(a)){H.off(o,"drag");return}a._willFitPos&&(g.copyPos(a,a._willFitPos),delete a._willFitPos)}this._onStartMoving(n,r,c,a,t,e)}else this._dragOrResize(n,r,c,a,t,e)};return H.droppable(this.el,{accept:r=>{const o=r.gridstackNode||this._readAttr(r,!1);if((o==null?void 0:o.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;let n=!0;if(typeof this.opts.acceptWidgets=="function")n=this.opts.acceptWidgets(r);else{const a=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;n=r.matches(a)}if(n&&o&&this.opts.maxRow){const a={w:o.w,h:o.h,minW:o.minW,minH:o.minH};n=this.engine.willItFit(a)}return n}}).on(this.el,"dropover",(r,o,n)=>{let a=(n==null?void 0:n.gridstackNode)||o.gridstackNode;if((a==null?void 0:a.grid)===this&&!a._temporaryRemoved)return!1;if(a!=null&&a._sidebarOrig&&(a.w=a._sidebarOrig.w,a.h=a._sidebarOrig.h),a!=null&&a.grid&&a.grid!==this&&!a._temporaryRemoved&&a.grid._leave(o,n),n=n||o,t=this.cellWidth(),e=this.getCellHeight(!0),!a){const h=n.getAttribute("data-gs-widget")||n.getAttribute("gridstacknode");if(h){try{a=JSON.parse(h)}catch{console.error("Gridstack dropover: Bad JSON format: ",h)}n.removeAttribute("data-gs-widget"),n.removeAttribute("gridstacknode")}a||(a=this._readAttr(n)),a._sidebarOrig={w:a.w,h:a.h}}a.grid||(a.el||(a={...a}),a._isExternal=!0,n.gridstackNode=a);const l=a.w||Math.round(n.offsetWidth/t)||1,d=a.h||Math.round(n.offsetHeight/e)||1;return a.grid&&a.grid!==this?(o._gridstackNodeOrig||(o._gridstackNodeOrig=a),o.gridstackNode=a={...a,w:l,h:d,grid:this},delete a.x,delete a.y,this.engine.cleanupNode(a).nodeBoundFix(a),a._initDD=a._isExternal=a._temporaryRemoved=!0):(a.w=l,a.h=d,a._temporaryRemoved=!0),_._itemRemoving(a.el,!1),H.on(o,"drag",i),i(r,o,n),!1}).on(this.el,"dropout",(r,o,n)=>{const a=(n==null?void 0:n.gridstackNode)||o.gridstackNode;return a&&(!a.grid||a.grid===this)&&(this._leave(o,n),this._isTemp&&this.removeAsSubGrid(a)),!1}).on(this.el,"drop",(r,o,n)=>{var u,f,y;const a=(n==null?void 0:n.gridstackNode)||o.gridstackNode;if((a==null?void 0:a.grid)===this&&!a._isExternal)return!1;const l=!!this.placeholder.parentElement,d=o!==n;this.placeholder.remove(),delete this.placeholder.gridstackNode,l&&this.opts.animate&&(this.setAnimation(!1),this.setAnimation(!0,!0));const h=o._gridstackNodeOrig;if(delete o._gridstackNodeOrig,l&&(h!=null&&h.grid)&&h.grid!==this){const v=h.grid;v.engine.removeNodeFromLayoutCache(h),v.engine.removedNodes.push(h),v._triggerRemoveEvent()._triggerChangeEvent(),v.parentGridNode&&!v.engine.nodes.length&&v.opts.subGridDynamic&&v.removeAsSubGrid()}if(!a||(l&&(this.engine.cleanupNode(a),a.grid=this),(u=a.grid)==null||delete u._isTemp,H.off(o,"drag"),n!==o?(n.remove(),o=n):o.remove(),this._removeDD(o),!l))return!1;const c=(y=(f=a.subGrid)==null?void 0:f.el)==null?void 0:y.gridstack;return g.copyPos(a,this._readAttr(this.placeholder)),g.removePositioningStyles(o),d&&(a.content||a.subGridOpts||_.addRemoveCB)?(delete a.el,o=this.addWidget(a)):(this._prepareElement(o,!0,a),this.el.appendChild(o),this.resizeToContentCheck(!1,a),c&&(c.parentGridNode=a),this._updateContainerHeight()),this.engine.addedNodes.push(a),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...r,type:"dropped"},h&&h.grid?h:void 0,a),!1}),this}static _itemRemoving(e,t){if(!e)return;const i=e?e.gridstackNode:void 0;!(i!=null&&i.grid)||e.classList.contains(i.grid.opts.removableOptions.decline)||(t?i._isAboutToRemove=!0:delete i._isAboutToRemove,t?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!H.isDroppable(e)&&H.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>_._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>_._itemRemoving(i,!1)),this):this}prepareDragDrop(e,t=!1){const i=e==null?void 0:e.gridstackNode;if(!i)return;const r=i.noMove||this.opts.disableDrag,o=i.noResize||this.opts.disableResize,n=this.opts.staticGrid||r&&o;if((t||n)&&(i._initDD&&(this._removeDD(e),delete i._initDD),n&&e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!t))return this;if(!i._initDD){let a,l;const d=(u,f)=>{this.triggerEvent(u,u.target),a=this.cellWidth(),l=this.getCellHeight(!0),this._onStartMoving(e,u,f,i,a,l)},h=(u,f)=>{this._dragOrResize(e,u,f,i,a,l)},c=u=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._resizing,delete i._event,delete i._lastTried;const f=i.w!==i._orig.w,y=u.target;if(!(!y.gridstackNode||y.gridstackNode.grid!==this)){if(i.el=y,i._isAboutToRemove){const v=e.gridstackNode.grid;v._gsEventHandler[u.type]&&v._gsEventHandler[u.type](u,y),v.engine.nodes.push(i),v.removeWidget(e,!0,!0)}else g.removePositioningStyles(y),i._temporaryRemoved?(g.copyPos(i,i._orig),this._writePosAttr(y,i),this.engine.addNode(i)):this._writePosAttr(y,i),this.triggerEvent(u,y);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),u.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(f,i))}};H.draggable(e,{start:d,stop:c,drag:h}).resizable(e,{start:d,stop:c,resize:h}),i._initDD=!0}return H.draggable(e,r?"disable":"enable").resizable(e,o?"disable":"enable"),this}_onStartMoving(e,t,i,r,o,n){var a;if(this.engine.cleanNodes().beginUpdate(r),this._writePosAttr(this.placeholder,r),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=r,(a=r.grid)!=null&&a.el)this.dragTransform=g.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const l=this.placeholder.closest(".grid-stack");this.dragTransform=g.getValuesFromTransformedElement(l)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(r.el=this.placeholder,r._lastUiPosition=i.position,r._prevYPix=i.position.top,r._moving=t.type==="dragstart",r._resizing=t.type==="resizestart",delete r._lastTried,t.type==="dropover"&&r._temporaryRemoved&&(this.engine.addNode(r),r._moving=!0),this.engine.cacheRects(o,n,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),t.type==="resizestart"){const l=this.getColumn()-r.x,d=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-r.y;H.resizable(e,"option","minWidth",o*Math.min(r.minW||1,l)).resizable(e,"option","minHeight",n*Math.min(r.minH||1,d)).resizable(e,"option","maxWidth",o*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",o*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,r.x+r.w)).resizable(e,"option","maxHeight",n*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,d)).resizable(e,"option","maxHeightMoveUp",n*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,r.y+r.h))}}_dragOrResize(e,t,i,r,o,n){const a={...r._orig};let l,d=this.opts.marginLeft,h=this.opts.marginRight,c=this.opts.marginTop,u=this.opts.marginBottom;const f=Math.round(n*.1),y=Math.round(o*.1);if(d=Math.min(d,y),h=Math.min(h,y),c=Math.min(c,f),u=Math.min(u,f),t.type==="drag"){if(r._temporaryRemoved)return;const b=i.position.top-r._prevYPix;r._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&g.updateScrollPosition(e,i.position,b);const w=i.position.left+(i.position.left>r._lastUiPosition.left?-h:d),z=i.position.top+(i.position.top>r._lastUiPosition.top?-u:c);a.x=Math.round(w/o),a.y=Math.round(z/n);const k=this._extraDragRow;if(this.engine.collide(r,a)){const S=this.getRow();let R=Math.max(0,a.y+r.h-S);this.opts.maxRow&&S+R>this.opts.maxRow&&(R=Math.max(0,this.opts.maxRow-S)),this._extraDragRow=R}else this._extraDragRow=0;if(this._extraDragRow!==k&&this._updateContainerHeight(),r.x===a.x&&r.y===a.y)return}else if(t.type==="resize"){if(a.x<0||(g.updateScrollResize(t,e,n),a.w=Math.round((i.size.width-d)/o),a.h=Math.round((i.size.height-c)/n),r.w===a.w&&r.h===a.h)||r._lastTried&&r._lastTried.w===a.w&&r._lastTried.h===a.h)return;const b=i.position.left+d,w=i.position.top+c;a.x=Math.round(b/o),a.y=Math.round(w/n),l=!0}r._event=t,r._lastTried=a;const v={x:i.position.left+d,y:i.position.top+c,w:(i.size?i.size.width:r.w*o)-d-h,h:(i.size?i.size.height:r.h*n)-c-u};if(this.engine.moveNodeCheck(r,{...a,cellWidth:o,cellHeight:n,rect:v,resizing:l})){r._lastUiPosition=i.position,this.engine.cacheRects(o,n,c,h,u,d),delete r._skipDown,l&&r.subGrid&&r.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const b=t.target;r._sidebarOrig||this._writePosAttr(b,r),this.triggerEvent(t,b)}}triggerEvent(e,t){let i=this;for(;i.parentGridNode;)i=i.parentGridNode.grid;i._gsEventHandler[e.type]&&i._gsEventHandler[e.type](e,t)}_leave(e,t){t=t||e;const i=t.gridstackNode;if(!i||(t.style.transform=t.style.transformOrigin=null,H.off(e,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&t?t:e;const r=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=r,this.opts.removable===!0&&_._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return Rs(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}_.renderCB=(s,e)=>{s&&(e!=null&&e.content)&&(s.textContent=e.content)};_.resizeToContentParent=".grid-stack-item-content";_.Utils=g;_.Engine=ee;_.GDRev="12.2.1";const Ds=`.grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:#0000001a;margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0;top:0;left:0;width:var(--gs-column-width);height:var(--gs-cell-height)}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item.size-to-content:not(.size-to-content-max)>.grid-stack-item-content{overflow-y:hidden}.grid-stack>.grid-stack-item>.grid-stack-item-content,.grid-stack>.grid-stack-placeholder>.placeholder-content{top:var(--gs-item-margin-top);right:var(--gs-item-margin-right);bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle,.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="%23666" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 20 20"><path d="m10 3 2 2H8l2-2v14l-2-2h4l-2 2"/></svg>');background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:var(--gs-item-margin-top);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:var(--gs-item-margin-top);left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:var(--gs-item-margin-top);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px;right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:var(--gs-item-margin-bottom);right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px;left:var(--gs-item-margin-left)}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging{will-change:left,top}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.ui-draggable-dragging,.ui-resizable-resizing{z-index:10000}.ui-draggable-dragging>.grid-stack-item-content,.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px #0003;opacity:.8}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.grid-stack-placeholder,.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing{transition:left 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-y="0"]{top:0}.grid-stack>.grid-stack-item[gs-x="0"]{left:0}`,C=[];for(let s=0;s<256;++s)C.push((s+256).toString(16).slice(1));function Cs(s,e=0){return(C[s[e+0]]+C[s[e+1]]+C[s[e+2]]+C[s[e+3]]+"-"+C[s[e+4]]+C[s[e+5]]+"-"+C[s[e+6]]+C[s[e+7]]+"-"+C[s[e+8]]+C[s[e+9]]+"-"+C[s[e+10]]+C[s[e+11]]+C[s[e+12]]+C[s[e+13]]+C[s[e+14]]+C[s[e+15]]).toLowerCase()}let st;const Is=new Uint8Array(16);function Ts(){if(!st){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");st=crypto.getRandomValues.bind(crypto)}return st(Is)}const Ls=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Gt={randomUUID:Ls};function ke(s,e,t){var r;if(Gt.randomUUID&&!s)return Gt.randomUUID();s=s||{};const i=s.random??((r=s.rng)==null?void 0:r.call(s))??Ts();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,Cs(i)}const Hs={icon:ie.R1,label:"Lock",tooltip:"Lock",action:"lock",type:"toggle"},Ns={icon:ie.L2,label:"Edit",tooltip:"Edit",action:"edit",type:"toggle"},hi={icon:ie.V1,label:"Edit data",tooltip:"Data",action:"edit-data",type:"toggle"},ci={icon:ie.M1,label:"Edit options",tooltip:"Options",action:"edit-options",type:"toggle"},Vt={icon:ie.a3,label:"Edit filters",tooltip:"Filters",action:"edit-filters",type:"toggle"},ui={icon:ie.e1,label:"Clone",tooltip:"Clone",action:"clone",type:"button"},mi={icon:ie.C1,label:"Delete",tooltip:"Delete",action:"delete",type:"button"},qt=s=>{if(!s)return;let e=[];return e=structuredClone(s).map(t=>{if(t.type==="group")return t.actions=t.actions??[],t.actions=t.actions.map(i=>{if(typeof i=="string"&&["lock","filters","edit","edit-data","edit-options","edit-filters","delete","clone"].includes(i))return{delete:{...mi},filters:{...Vt},clone:{...ui},edit:{...Ns},"edit-data":{...hi},"edit-options":{...ci},"edit-filters":{...Vt},lock:{...Hs}}[i];if(typeof i=="object")return i.icon=i.icon??ie.i0,i.label=i.label??i.action,i.tooltip=i.tooltip??i.label??i.action,i.type=["toggle","button"].includes(i.type??"")?i.type:"button",i}).filter(Boolean),t}).filter(Boolean),e},gi=()=>[{type:"group",actions:[{...hi},{...ci},{...ui}]},{type:"group",actions:[{...mi}]}],Os=":host{display:block;--luzmo-action-button-content-color-default: var( --luzmo-grid-item-action-button-content-color-default, #fff );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-action-button-content-color-hover, #fff );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-action-button-content-color-down, #fff );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-action-button-content-color-focus, #fff );--luzmo-action-button-background-color-default: var( --luzmo-grid-item-action-button-background-color-default, #333 );--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-action-button-background-color-hover, #444 );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-action-button-background-color-down, #555 );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-action-button-background-color-focus, #666 );--grid-item-actions-flex-direction: column}.action-buttons{display:flex;gap:var(--luzmo-grid-item-action-group-gap, .5rem);flex-direction:var(--luzmo-grid-item-actions-flex-direction, var(--grid-item-actions-flex-direction));outline:none}.action-button[selected]{--luzmo-action-button-background-color-default: var(--luzmo-primary);--luzmo-action-button-background-color-hover: var(--luzmo-primary-hover);--luzmo-action-button-background-color-down: var(--luzmo-primary-down);--luzmo-action-button-background-color-focus: var(--luzmo-primary-focus);--luzmo-action-button-content-color-default: var( --luzmo-primary-inverse-color );--luzmo-action-button-content-color-hover: var(--luzmo-primary-inverse-color);--luzmo-action-button-content-color-down: var(--luzmo-primary-inverse-color);--luzmo-action-button-content-color-focus: var(--luzmo-primary-inverse-color)}:host .action-buttons{--luzmo-action-button-content-color-default: var( --luzmo-grid-item-action-button-content-color-default, #fff );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-action-button-content-color-hover, #fff );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-action-button-content-color-down, #fff );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-action-button-content-color-focus, #fff );--luzmo-action-button-background-color-default: var( --luzmo-grid-item-action-button-background-color-default, #333 );--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-action-button-background-color-hover, #444 );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-action-button-background-color-down, #555 );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-action-button-background-color-focus, #666 )}.delete-button{--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-delete-button-background-color-hover, var(--luzmo-negative-color) );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-delete-button-content-color-hover, #fff );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-delete-button-background-color-focus, var(--luzmo-negative-color-focus) );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-delete-button-content-color-focus, #fff );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-delete-button-background-color-down, var(--luzmo-negative-color-down) );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-delete-button-content-color-down, #fff )}:host([placement=top-start]),:host([placement=top]),:host([placement=top-end]),:host([placement=bottom-start]),:host([placement=bottom]),:host([placement=bottom-end]){--grid-item-actions-flex-direction: row}";var Ps=Object.defineProperty,$s=Object.getOwnPropertyDescriptor,Xe=(s,e,t,i)=>{for(var r=i>1?void 0:i?$s(e,t):e,o=s.length-1,n;o>=0;o--)(n=s[o])&&(r=(i?n(e,t,r):n(r))||r);return i&&r&&Ps(e,t,r),r};exports.LuzmoGridItemActionsMenu=class extends Yt.It{constructor(){super(...arguments),this.placement="right-start",this.actions=gi(),this.language="en"}static get styles(){return[m.r(Os)]}get isVertical(){return this.placement.includes("left")||this.placement.includes("right")}_dispatchAction(e){this.dispatchEvent(new CustomEvent("action",{bubbles:!0,composed:!0,detail:{action:e.action,type:e.type,active:e.active}}))}_handleActionClick(e){e.type==="toggle"&&(e.active=!e.active,this.actions.forEach(t=>{var i;(i=t.actions)==null||i.forEach(r=>{e!==r&&r.active&&(r.active=!1)})})),this._dispatchAction(e),this.requestUpdate()}clearActiveToggles(){this.actions=this.actions.map(e=>{var t;return{...e,actions:((t=e.actions)==null?void 0:t.map(i=>(i.type==="toggle"&&(i.active=!1),i)))??[]}})}focus(){var t,i;const e=(t=this.shadowRoot)==null?void 0:t.querySelectorAll("luzmo-action-button[toggles]");e&&((i=e[0])==null||i.focus())}_generateActionButton(e){var i,r,o,n;const t={Data:K.msg("Data",{desc:"Grid item action tooltip"}),Options:K.msg("Options",{desc:"Grid item action tooltip"}),Clone:K.msg("Clone",{desc:"Grid item action tooltip"}),Delete:K.msg("Delete",{desc:"Grid item action tooltip"}),Edit:K.msg("Edit",{desc:"Grid item action tooltip"}),Lock:K.msg("Lock",{desc:"Grid item action tooltip"}),Filters:K.msg("Filters",{desc:"Grid item action tooltip"})};return m.x`
243
239
  <luzmo-action-button
244
240
  class="${e.action}-button action-button"
245
241
  .label=${e.label}
@@ -264,11 +260,11 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
264
260
  >
265
261
  `:m.x``}willUpdate(e){e.has("language")&&this.language!==K.getLocale()&&([...K.targetLocales].includes(this.language??"en")||this.language==="en")&&K.setLocale(this.language)}render(){const e=this.actions.map(t=>this._generateActionGroup(t));return m.x`
266
262
  <div class="action-buttons" tabindex="0">${e}</div>
267
- `}};Xe([m.n({type:String,reflect:!0})],exports.LuzmoGridItemActionsMenu.prototype,"placement",2);Xe([m.n({type:Array})],exports.LuzmoGridItemActionsMenu.prototype,"actions",2);Xe([m.n({type:String})],exports.LuzmoGridItemActionsMenu.prototype,"language",2);exports.LuzmoGridItemActionsMenu=Xe([yi.localized()],exports.LuzmoGridItemActionsMenu);const Us=':host{display:block;width:100%}.grid-stack{width:100%;min-height:var(--luzmo-grid-min-height);position:relative;background:var(--luzmo-grid-background, var(--grid-background, var(--luzmo-background-color)))}.grid-stack[has-active-item] .grid-stack-item:not([active])>.grid-stack-item-content,.grid-stack[has-active-item] .grid-stack-item:not([active])>.grid-item-actions-popover{opacity:.5}.grid-stack .grid-stack-item[active]>.ui-resizable-handle,.grid-stack .grid-stack-item[active].ui-resizable-autohide>.ui-resizable-handle{display:block}.grid-stack .grid-stack-item.ui-resizable-resizing,.grid-stack .grid-stack-item.ui-resizable-resizing>.grid-stack-item-content{opacity:var(--luzmo-grid-item-resizing-opacity, .8)!important}.grid-item-drag-handle{position:absolute;color:var(--luzmo-grid-item-drag-handle-color, #000);top:var(--luzmo-grid-item-drag-handle-position-top, 0);left:var(--luzmo-grid-item-drag-handle-position-left, 0);right:var(--luzmo-grid-item-drag-handle-position-right, auto);bottom:var(--luzmo-grid-item-drag-handle-position-bottom, auto);padding:var(--luzmo-grid-item-drag-handle-padding, .5rem);z-index:var(--luzmo-grid-item-drag-handle-z-index, 3);cursor:var(--luzmo-grid-item-drag-handle-cursor, move)}.grid-stack[dark-background] .grid-item-drag-handle{color:var(--luzmo-grid-item-drag-handle-color, #fff)}.grid-stack .grid-stack-item .grid-stack-item-content{overflow:hidden;border-radius:var(--luzmo-grid-item-border-radius, var(--grid-item-border-radius, 4px));background:var(--luzmo-grid-item-background, var(--grid-item-background, transparent));box-shadow:var(--luzmo-grid-item-box-shadow, var(--grid-item-box-shadow, none));border-style:var(--luzmo-grid-item-border-style, none);border-color:var(--luzmo-grid-item-border-color, transparent);-webkit-backdrop-filter:var(--luzmo-grid-item-backdrop-filter, none);backdrop-filter:var(--luzmo-grid-item-backdrop-filter, none)}.grid-stack .grid-stack-item:not(.has-luzmo-viz-item) .grid-stack-item-content{border-style:var(--luzmo-grid-item-border-style, var(--grid-item-border-style, none));border-color:var(--luzmo-grid-item-border-color, var(--grid-item-border-color, transparent));border-width:var(--luzmo-grid-item-border-width, var(--grid-item-border-width, 0));border-top-width:var(--luzmo-grid-item-border-top-width, var(--grid-item-border-top-width, 0));border-right-width:var(--luzmo-grid-item-border-right-width, var(--grid-item-border-right-width, 0));border-bottom-width:var(--luzmo-grid-item-border-bottom-width, var(--grid-item-border-bottom-width, 0));border-left-width:var(--luzmo-grid-item-border-left-width, var(--grid-item-border-left-width, 0))}.grid-stack .grid-stack-placeholder>.placeholder-content{border-radius:var(--grid-item-border-radius, 4px)}:host .grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack-item:hover>.ui-resizable-handle{display:block!important;position:absolute!important;z-index:var(--luzmo-grid-resize-handle-z-index, 100);background:var(--luzmo-grid-resize-handle-background, #fff);border-radius:var(--luzmo-grid-resize-handle-border-radius, 3px);opacity:var(--luzmo-grid-resize-handle-opacity, 0);transition:var(--luzmo-grid-resize-handle-transition, opacity .2s ease);box-shadow:0 0 6px #0000001a,0 0 2px #000000bf}:host .grid-stack[dark-background]>.grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack[dark-background]>.grid-stack-item:hover>.ui-resizable-handle{background:var(--luzmo-grid-resize-handle-background, #333);box-shadow:0 0 6px #ffffff1a,0 0 2px #ffffffbf}:host .grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack-item:hover>.ui-resizable-handle{opacity:var(--luzmo-grid-resize-handle-opacity-hover, 1)}:host .grid-stack-item>.ui-resizable-handle:hover{opacity:var(--luzmo-grid-resize-handle-opacity-active, 1);background:var(--luzmo-grid-resize-handle-background-hover, var(--luzmo-background-color-highlight))}:host .grid-stack-item>.ui-resizable-n,:host .grid-stack-item>.ui-resizable-s{height:var(--luzmo-grid-resize-handle-edge-size, 8px);width:var(--luzmo-grid-resize-handle-side-size, 18px);left:calc(50% - var(--luzmo-grid-resize-handle-side-size, 18px) / 2)}:host .grid-stack-item>.ui-resizable-n{cursor:n-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-top, 0px))}:host .grid-stack-item>.ui-resizable-s{cursor:s-resize;bottom:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-e,:host .grid-stack-item>.ui-resizable-w{width:var(--luzmo-grid-resize-handle-edge-size, 8px);height:var(--luzmo-grid-resize-handle-side-size, 18px);top:calc(50% - var(--luzmo-grid-resize-handle-side-size, 18px) / 2)}:host .grid-stack-item>.ui-resizable-e{cursor:e-resize;right:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-right, 0px))}:host .grid-stack-item>.ui-resizable-w{cursor:w-resize;left:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-left, 0px))}:host .grid-stack-item>.ui-resizable-ne,:host .grid-stack-item>.ui-resizable-nw,:host .grid-stack-item>.ui-resizable-se,:host .grid-stack-item>.ui-resizable-sw{transform:none;background-image:none;width:var(--luzmo-grid-resize-handle-corner-size, 12px);height:var(--luzmo-grid-resize-handle-corner-size, 12px)}:host .grid-stack-item>.ui-resizable-ne{cursor:ne-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-top, 0px));right:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-right, 0px))}:host .grid-stack-item>.ui-resizable-nw{cursor:nw-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-top, 0px));left:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-left, 0px))}:host .grid-stack-item>.ui-resizable-se{cursor:se-resize;right:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-right, 0px));bottom:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-sw{cursor:sw-resize;left:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-left, 0px));bottom:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-resizing .ui-resizable-handle{opacity:1!important;background:var(--luzmo-grid-resize-handle-background-active, var(--luzmo-background-color-highlight))}.grid-item-actions-popover{position:absolute;outline:none;border:none;padding:0;margin:0;z-index:2;overflow:visible;background:transparent}luzmo-grid-item-actions-menu{padding:var(--luzmo-grid-item-actions-padding, var(--grid-item-actions-padding))}.dimensions-hint-popover{font-size:var(--luzmo-grid-item-dimensions-hint-font-size, var(--luzmo-font-size-xs, 10px));font-family:var(--luzmo-grid-item-dimensions-hint-font-family, var(--luzmo-font-family, inherit));position:absolute;outline:none;border-width:var(--luzmo-grid-item-dimensions-hint-border-width, var(--luzmo-border-width));border-style:solid;border-color:var(--luzmo-grid-item-dimensions-hint-border-color, var(--luzmo-border-color));border-radius:var(--luzmo-grid-item-dimensions-hint-border-radius, var(--luzmo-border-radius));padding:var(--luzmo-grid-item-dimensions-hint-padding, var(--luzmo-spacing-1) var(--luzmo-spacing-2));margin:0;z-index:3;overflow:visible;background:var(--luzmo-grid-item-dimensions-hint-background, var(--luzmo-background-color));color:var(--luzmo-grid-item-dimensions-hint-color, var(--luzmo-font-color));pointer-events:none}luzmo-grid-item-actions-menu{--grid-item-actions-padding: 0 .75rem}luzmo-grid-item-actions-menu[placement=top-start],luzmo-grid-item-actions-menu[placement=top],luzmo-grid-item-actions-menu[placement=top-end],luzmo-grid-item-actions-menu[placement=bottom-start],luzmo-grid-item-actions-menu[placement=bottom],luzmo-grid-item-actions-menu[placement=bottom-end]{--grid-item-actions-padding: .75rem 0}.grid-stack-item:focus-visible{outline:none}.grid-stack-item:focus-visible .grid-stack-item-content:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;border:var(--luzmo-indicator-width) solid var(--luzmo-indicator-color, var(--luzmo-primary));box-sizing:border-box;border-radius:var(--luzmo-grid-item-border-radius, var(--grid-item-border-radius, 4px));z-index:2}';var Fs=Object.defineProperty,M=(s,e,t,i)=>{for(var r=void 0,o=s.length-1,n;o>=0;o--)(n=s[o])&&(r=n(e,t,r)||r);return r&&Fs(e,t,r),r};class S extends Kt.It{constructor(){super(...arguments),this.appServer="https://app.luzmo.com/",this.apiHost="https://api.luzmo.com",this.language="en",this.contentLanguage="en",this.columns=48,this.rowHeight=16,this.viewMode=!1,this.placementItemActionsMenu="right-start",this.items=[],this.renderers={},this._initialized=!1,this.defaultRenderer=(e,t)=>m.x`
263
+ `}};Xe([m.n({type:String,reflect:!0})],exports.LuzmoGridItemActionsMenu.prototype,"placement",2);Xe([m.n({type:Array})],exports.LuzmoGridItemActionsMenu.prototype,"actions",2);Xe([m.n({type:String})],exports.LuzmoGridItemActionsMenu.prototype,"language",2);exports.LuzmoGridItemActionsMenu=Xe([bi.localized()],exports.LuzmoGridItemActionsMenu);const Ws=':host{display:block;width:100%}.grid-stack{width:100%;min-height:var(--luzmo-grid-min-height);position:relative;background:var(--luzmo-grid-background, var(--grid-background, var(--luzmo-background-color)))}.grid-stack[has-active-item] .grid-stack-item:not([active])>.grid-stack-item-content,.grid-stack[has-active-item] .grid-stack-item:not([active])>.grid-item-actions-popover{opacity:.5}.grid-stack .grid-stack-item[active]>.ui-resizable-handle,.grid-stack .grid-stack-item[active].ui-resizable-autohide>.ui-resizable-handle{display:block}.grid-stack .grid-stack-item.ui-resizable-resizing,.grid-stack .grid-stack-item.ui-resizable-resizing>.grid-stack-item-content{opacity:var(--luzmo-grid-item-resizing-opacity, .8)!important}.grid-item-drag-handle{position:absolute;color:var(--luzmo-grid-item-drag-handle-color, #000);top:var(--luzmo-grid-item-drag-handle-position-top, 0);left:var(--luzmo-grid-item-drag-handle-position-left, 0);right:var(--luzmo-grid-item-drag-handle-position-right, auto);bottom:var(--luzmo-grid-item-drag-handle-position-bottom, auto);padding:var(--luzmo-grid-item-drag-handle-padding, .5rem);z-index:var(--luzmo-grid-item-drag-handle-z-index, 3);cursor:var(--luzmo-grid-item-drag-handle-cursor, move)}.grid-stack[dark-background] .grid-item-drag-handle{color:var(--luzmo-grid-item-drag-handle-color, #fff)}.grid-stack .grid-stack-item .grid-stack-item-content{overflow:hidden;border-radius:var(--luzmo-grid-item-border-radius, var(--grid-item-border-radius, 4px));background:var(--luzmo-grid-item-background, var(--grid-item-background, transparent));box-shadow:var(--luzmo-grid-item-box-shadow, var(--grid-item-box-shadow, none));border-style:var(--luzmo-grid-item-border-style, none);border-color:var(--luzmo-grid-item-border-color, transparent);-webkit-backdrop-filter:var(--luzmo-grid-item-backdrop-filter, none);backdrop-filter:var(--luzmo-grid-item-backdrop-filter, none)}.grid-stack .grid-stack-item:not(.has-luzmo-viz-item) .grid-stack-item-content{border-style:var(--luzmo-grid-item-border-style, var(--grid-item-border-style, none));border-color:var(--luzmo-grid-item-border-color, var(--grid-item-border-color, transparent));border-width:var(--luzmo-grid-item-border-width, var(--grid-item-border-width, 0));border-top-width:var(--luzmo-grid-item-border-top-width, var(--grid-item-border-top-width, 0));border-right-width:var(--luzmo-grid-item-border-right-width, var(--grid-item-border-right-width, 0));border-bottom-width:var(--luzmo-grid-item-border-bottom-width, var(--grid-item-border-bottom-width, 0));border-left-width:var(--luzmo-grid-item-border-left-width, var(--grid-item-border-left-width, 0))}.grid-stack .grid-stack-placeholder>.placeholder-content{border-radius:var(--grid-item-border-radius, 4px)}:host .grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack-item:hover>.ui-resizable-handle{display:block!important;position:absolute!important;z-index:var(--luzmo-grid-resize-handle-z-index, 100);background:var(--luzmo-grid-resize-handle-background, #fff);border-radius:var(--luzmo-grid-resize-handle-border-radius, 3px);opacity:var(--luzmo-grid-resize-handle-opacity, 0);transition:var(--luzmo-grid-resize-handle-transition, opacity .2s ease);box-shadow:0 0 6px #0000001a,0 0 2px #000000bf}:host .grid-stack[dark-background]>.grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack[dark-background]>.grid-stack-item:hover>.ui-resizable-handle{background:var(--luzmo-grid-resize-handle-background, #333);box-shadow:0 0 6px #ffffff1a,0 0 2px #ffffffbf}:host .grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack-item:hover>.ui-resizable-handle{opacity:var(--luzmo-grid-resize-handle-opacity-hover, 1)}:host .grid-stack-item>.ui-resizable-handle:hover{opacity:var(--luzmo-grid-resize-handle-opacity-active, 1);background:var(--luzmo-grid-resize-handle-background-hover, var(--luzmo-background-color-highlight))}:host .grid-stack-item>.ui-resizable-n,:host .grid-stack-item>.ui-resizable-s{height:var(--luzmo-grid-resize-handle-edge-size, 8px);width:var(--luzmo-grid-resize-handle-side-size, 18px);left:calc(50% - var(--luzmo-grid-resize-handle-side-size, 18px) / 2)}:host .grid-stack-item>.ui-resizable-n{cursor:n-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-top, 0px))}:host .grid-stack-item>.ui-resizable-s{cursor:s-resize;bottom:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-e,:host .grid-stack-item>.ui-resizable-w{width:var(--luzmo-grid-resize-handle-edge-size, 8px);height:var(--luzmo-grid-resize-handle-side-size, 18px);top:calc(50% - var(--luzmo-grid-resize-handle-side-size, 18px) / 2)}:host .grid-stack-item>.ui-resizable-e{cursor:e-resize;right:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-right, 0px))}:host .grid-stack-item>.ui-resizable-w{cursor:w-resize;left:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-left, 0px))}:host .grid-stack-item>.ui-resizable-ne,:host .grid-stack-item>.ui-resizable-nw,:host .grid-stack-item>.ui-resizable-se,:host .grid-stack-item>.ui-resizable-sw{transform:none;background-image:none;width:var(--luzmo-grid-resize-handle-corner-size, 12px);height:var(--luzmo-grid-resize-handle-corner-size, 12px)}:host .grid-stack-item>.ui-resizable-ne{cursor:ne-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-top, 0px));right:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-right, 0px))}:host .grid-stack-item>.ui-resizable-nw{cursor:nw-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-top, 0px));left:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-left, 0px))}:host .grid-stack-item>.ui-resizable-se{cursor:se-resize;right:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-right, 0px));bottom:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-sw{cursor:sw-resize;left:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-left, 0px));bottom:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-resizing .ui-resizable-handle{opacity:1!important;background:var(--luzmo-grid-resize-handle-background-active, var(--luzmo-background-color-highlight))}.grid-item-actions-popover{position:absolute;outline:none;border:none;padding:0;margin:0;z-index:2;overflow:visible;background:transparent}luzmo-grid-item-actions-menu{padding:var(--luzmo-grid-item-actions-padding, var(--grid-item-actions-padding))}.dimensions-hint-popover{font-size:var(--luzmo-grid-item-dimensions-hint-font-size, var(--luzmo-font-size-xs, 10px));font-family:var(--luzmo-grid-item-dimensions-hint-font-family, var(--luzmo-font-family, inherit));position:absolute;outline:none;border-width:var(--luzmo-grid-item-dimensions-hint-border-width, var(--luzmo-border-width));border-style:solid;border-color:var(--luzmo-grid-item-dimensions-hint-border-color, var(--luzmo-border-color));border-radius:var(--luzmo-grid-item-dimensions-hint-border-radius, var(--luzmo-border-radius));padding:var(--luzmo-grid-item-dimensions-hint-padding, var(--luzmo-spacing-1) var(--luzmo-spacing-2));margin:0;z-index:3;overflow:visible;background:var(--luzmo-grid-item-dimensions-hint-background, var(--luzmo-background-color));color:var(--luzmo-grid-item-dimensions-hint-color, var(--luzmo-font-color));pointer-events:none}luzmo-grid-item-actions-menu{--grid-item-actions-padding: 0 .75rem}luzmo-grid-item-actions-menu[placement=top-start],luzmo-grid-item-actions-menu[placement=top],luzmo-grid-item-actions-menu[placement=top-end],luzmo-grid-item-actions-menu[placement=bottom-start],luzmo-grid-item-actions-menu[placement=bottom],luzmo-grid-item-actions-menu[placement=bottom-end]{--grid-item-actions-padding: .75rem 0}.grid-stack-item:focus-visible{outline:none}.grid-stack-item:focus-visible .grid-stack-item-content:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;border:var(--luzmo-indicator-width) solid var(--luzmo-indicator-color, var(--luzmo-primary));box-sizing:border-box;border-radius:var(--luzmo-grid-item-border-radius, var(--grid-item-border-radius, 4px));z-index:2}';var Bs=Object.defineProperty,M=(s,e,t,i)=>{for(var r=void 0,o=s.length-1,n;o>=0;o--)(n=s[o])&&(r=n(e,t,r)||r);return r&&Bs(e,t,r),r};class A extends Yt.It{constructor(){super(...arguments),this.appServer="https://app.luzmo.com/",this.apiHost="https://api.luzmo.com",this.language="en",this.contentLanguage="en",this.columns=48,this.rowHeight=16,this.viewMode=!1,this.placementItemActionsMenu="right-start",this.items=[],this.renderers={},this._initialized=!1,this.defaultRenderer=(e,t)=>m.x`
268
264
  <div class="grid-item-content">
269
265
  <div class="grid-item-type">${e.type}</div>
270
266
  </div>
271
- `,this._hasItemAdded=!1,this._handleMouseout=e=>{if(this.viewMode)return;const i=e.target.closest(".grid-stack-item");if(!i)return;const r=e.relatedTarget;r!=null&&r.closest(".grid-item-actions-popover")||i.hasAttribute("active")||this._removeItemActionsMenuPopover(i)},this._handleKeyDown=e=>{if(!this.viewMode){if(e.key==="Delete"&&this._focusedItemElement)this._handleDeleteItem(new Event("delete"));else if(e.key==="Escape"&&this._focusedItemElement)this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement),this._focusedItemElement=void 0,this._gridElement.focus();else if(e.key==="Enter"&&this._focusedItemElement)e.preventDefault(),e.stopPropagation(),this._activeItemElement&&(this._activeItemElement.removeAttribute("active"),this._gridElement.removeAttribute("has-active-item"),this._removeItemActionsMenuPopover(this._activeItemElement),this._activeItemElement=void 0),this._gridElement.querySelectorAll(".grid-stack-item").forEach(t=>{t!==this._focusedItemElement&&this._removeItemActionsMenuPopover(t)}),this._createItemActionsMenuPopover(this._focusedItemElement),requestAnimationFrame(()=>{var i;const t=(i=this._focusedItemElement)==null?void 0:i.querySelector("luzmo-grid-item-actions-menu");t&&t.focus()});else if(this._focusedItemElement&&this._grid&&["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)){e.preventDefault(),e.stopPropagation();const t=this._focusedItemElement.gridstackNode;if(!t)return;const i=this.columns??48,o={ArrowLeft:{move:{x:t.x-1},resize:{x:t.x-1,w:t.w+1},shrink:{w:t.w-1},canMove:t.x>0,canResize:t.x>0,canShrink:t.w>1},ArrowRight:{move:{x:t.x+1},resize:{w:t.w+1},shrink:{x:t.x+1,w:t.w-1},canMove:t.x<i-t.w,canResize:t.x+t.w<i,canShrink:t.w>1},ArrowUp:{move:{y:t.y-1},resize:{y:t.y-1,h:t.h+1},shrink:{h:t.h-1},canMove:t.y>0,canResize:t.y>0,canShrink:t.h>1},ArrowDown:{move:{y:t.y+1},resize:{h:t.h+1},shrink:{y:t.y+1,h:t.h-1},canMove:!0,canResize:!0,canShrink:t.h>1}}[e.key];let n=null;e.shiftKey&&o.canResize?n=o.resize:(e.ctrlKey||e.metaKey)&&o.canShrink?n=o.shrink:o.canMove&&(n=o.move),n&&this._grid.update(this._focusedItemElement,n)}}},this._handleFocus=e=>{const i=e.target.closest(".grid-stack-item");i&&(this._focusedItemElement&&this._focusedItemElement!==i&&(this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement)),this._focusedItemElement=i,i.setAttribute("focused","true"))},this._handleBlur=e=>{if(!this._focusedItemElement)return;const t=e.relatedTarget;t!=null&&t.closest("luzmo-grid-item-actions-menu")||(this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement),this._focusedItemElement=void 0,this._gridElement.focus())},this._handleDocumentClick=e=>{const t=e.composedPath(),i=this._gridElement.querySelector(".grid-stack-item[active]");if(!i||t.includes(i))return;const r=i.querySelector(".grid-item-actions-popover");r&&t.includes(r)||this._cleanupActiveItem(i)},this._handleAction=e=>{var o,n;const t=e.detail,i=(o=e.target)==null?void 0:o.closest(".grid-stack-item");if(!i)return;const r=i.getAttribute("gs-id");if(t.type==="toggle"&&t.action===this._activeItemActionToggle&&i===this._activeItemElement){this._activeItemElement=void 0,this._activeItemActionToggle=void 0,(n=this._gridElement)==null||n.removeAttribute("has-active-item"),i.removeAttribute("active"),this._cleanupActiveItem(i);return}if(!["delete","clone"].includes(t.action)){this._gridElement.querySelectorAll(".grid-stack-item").forEach(l=>{l!==i&&this._cleanupActiveItem(l)}),t.type==="toggle"&&(this._activeItemElement=i,this._activeItemActionToggle=t.action,this._gridElement.setAttribute("has-active-item","true"),i.setAttribute("active","true"));const a=this.items.find(l=>l.id===r);this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:t.action,items:this.items,element:i,id:r,type:a==null?void 0:a.type,slots:a==null?void 0:a.slots,options:a==null?void 0:a.options,filters:(a==null?void 0:a.filters)??[]},bubbles:!0,composed:!0,cancelable:!0}))}t.action==="delete"?(this._handleDeleteItem(e),this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:t.action,items:this.items,deletedId:r},bubbles:!0,composed:!0,cancelable:!0}))):t.action==="clone"&&this._handleCloneItem(e)},this._handleDeleteItem=e=>{var i;const t=((i=e.target)==null?void 0:i.closest(".grid-stack-item"))||this._focusedItemElement;t&&this.removeGridItemById(t.getAttribute("gs-id")||"")},this._handleCloneItem=e=>{const i=e.target.closest(".grid-stack-item");if(!i||!this._grid)return;const r=i.getAttribute("gs-id");if(!r)return;const o=this.items.find(l=>l.id===r);if(!o)return;const n={...structuredClone(o),id:ke()},a=this.addGridItem(n);this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:"clone",items:this.items,originalElement:i,element:a,id:n.id,type:n.type,slots:n.slots,options:n.options,filters:n.filters},bubbles:!0,composed:!0}))}}static get styles(){return[m.r(Ts),m.r(Us)]}async _loadTheme(e){var t,i,r,o,n,a,l;(e==null?void 0:e.type)==="custom"?this._fullTheme=structuredClone(e):e!=null&&e.id&&Je.systemThemeIds.includes(e.id)&&((t=this._fullTheme)==null?void 0:t.id)!==e.id?(this._fullTheme=await Je.getTheme(e.id),this._fullTheme.id=e.id):e!=null&&e.id&&((i=this._fullTheme)==null?void 0:i.id)!==e.id||!e&&this._fullTheme||(this._fullTheme=await Je.getTheme("default")),this._initialized&&this._updateThemeProperties(),!this._initialized&&this._gridElement&&await requestAnimationFrame(()=>{this._initializeGrid()}),this._grid&&((l=this._grid)==null||l.margin([(((o=(r=this.theme)==null?void 0:r.margins)==null?void 0:o[0])??16)/2,(((a=(n=this.theme)==null?void 0:n.margins)==null?void 0:a[1])??16)/2].join(" "))),this.requestUpdate()}firstUpdated(){document.addEventListener("click",this._handleDocumentClick),this.addEventListener("keydown",this._handleKeyDown),this._loadTheme(this.theme)}disconnectedCallback(){super.disconnectedCallback(),this._cleanup(),document.removeEventListener("click",this._handleDocumentClick),this.removeEventListener("keydown",this._handleKeyDown)}willUpdate(e){var i,r,o,n,a,l;super.willUpdate(e),e.has("_initialized")&&(this._updateThemeProperties(),this._initialized&&this._grid&&((i=this._fullTheme)!=null&&i.margins)&&((l=this._grid)==null||l.margin([(((o=(r=this._fullTheme)==null?void 0:r.margins)==null?void 0:o[0])??16)/2,(((a=(n=this._fullTheme)==null?void 0:n.margins)==null?void 0:a[1])??16)/2].join(" "))))}updated(e){var n,a,l;super.updated(e);const t=e.has("contentLanguage"),i=e.has("viewMode"),r=e.has("items"),o=e.has("theme");this.items.forEach(d=>{d.id=d.id??ke()}),this._initialized&&this._grid&&(r||this._hasItemAdded)&&(this._hasItemAdded&&this._gridItemElements.forEach(d=>{d.hasAttribute("orphan")&&d.remove()}),this._hasItemAdded=!1,(n=this._grid)==null||n.setAnimation(!1),(a=this._grid)==null||a.batchUpdate(),(l=this._grid)==null||l.removeAll(!1),this.items.forEach(d=>{var c,u,f,y,v,b,w;const h=[...this._gridItemElements].find(z=>z.getAttribute("luzmo-grid-item-id")===d.id);h&&((v=this._grid)==null||v.makeWidget(h,{x:((c=d==null?void 0:d.position)==null?void 0:c.col)??0,y:((u=d==null?void 0:d.position)==null?void 0:u.row)??0,w:((f=d==null?void 0:d.position)==null?void 0:f.sizeX)??1,h:((y=d==null?void 0:d.position)==null?void 0:y.sizeY)??1,id:d.id}),(b=this._grid)==null||b.batchUpdate(!1),(w=this._grid)==null||w.setAnimation(!0))})),t&&this._updateLuzmoVizItemsLanguage(),this._initialized&&this._grid&&i&&this.viewMode!==e.get("viewMode")&&(this.viewMode?(this._grid.disable(),this._activeItemElement&&(this._cleanupActiveItem(this._activeItemElement),this._activeItemElement=void 0,this._gridElement.removeAttribute("has-active-item"))):this._grid.enable()),o&&this._loadTheme(this.theme)}_updateLuzmoVizItemsLanguage(){this._gridItemElements.forEach(e=>{const t=e.querySelector("luzmo-embed-viz-item");t&&(t.options={...t.options,locale:this.contentLanguage})})}_handleMouseover(e){if(this.viewMode)return;const i=e.target.closest(".grid-stack-item");i&&this._createItemActionsMenuPopover(i)}_cleanupActiveItem(e){e.removeAttribute("active"),this._activeItemElement===e&&(this._activeItemElement=void 0,this._gridElement.removeAttribute("has-active-item")),this._removeItemActionsMenuPopover(e)}_cleanup(){for(const e of this._gridItemElements)this._cleanupActiveItem(e);this._grid&&(this._grid.destroy(),this._grid=void 0),this._initialized=!1}_initializeGrid(){var t,i,r,o,n,a,l,d;if(this._initialized||!this._gridElement)return;const e={column:this.columns??48,cellHeight:this.rowHeight??16,marginTop:(((i=(t=this._fullTheme)==null?void 0:t.margins)==null?void 0:i[0])??16)/2,marginLeft:(((o=(r=this._fullTheme)==null?void 0:r.margins)==null?void 0:o[1])??16)/2,marginRight:(((a=(n=this._fullTheme)==null?void 0:n.margins)==null?void 0:a[1])??16)/2,marginBottom:(((d=(l=this._fullTheme)==null?void 0:l.margins)==null?void 0:d[0])??16)/2,animate:!0,auto:!1,float:!1,removable:!1,acceptWidgets:!0,disableDrag:this.viewMode,disableResize:this.viewMode,minRow:1,resizable:{handles:["n","ne","e","se","s","sw","w","nw"].join(", ")},handle:".grid-item-drag-handle"};this._grid=_.init(e,this._gridElement),this._grid.batchUpdate(),this._gridItemElements.forEach(h=>{var y,v,b,w,z;const c=h.getAttribute("luzmo-grid-item-id"),u=this.items.find(k=>k.id===c),f={id:c,x:((y=u==null?void 0:u.position)==null?void 0:y.col)??0,y:((v=u==null?void 0:u.position)==null?void 0:v.row)??0,w:((b=u==null?void 0:u.position)==null?void 0:b.sizeX)??1,h:((w=u==null?void 0:u.position)==null?void 0:w.sizeY)??1};(z=this._grid)==null||z.makeWidget(h,f)}),this._grid.batchUpdate(!1),this._initialized=!0,this._grid.on("resizestart",(h,c)=>{const u=c.getAttribute("gs-w")??"",f=c.getAttribute("gs-h")??"";this._createOrUpdateDimensionsHint(c,u,f)}),this._grid.on("resize",(h,c)=>{const u=c.getAttribute("gs-w")??"",f=c.getAttribute("gs-h")??"";this._createOrUpdateDimensionsHint(c,u,f)}),this._grid.on("resizestop",(h,c)=>{this._removeDimensionsHint(c)}),this._grid.on("change",(h,c)=>{c.forEach(u=>{if(!(u!=null&&u.id))return;const f=this.items.findIndex(y=>y.id===u.id);f!==-1&&(this.items[f]={...this.items[f],position:{sizeX:u.w??1,sizeY:u.h??1,row:u.y??0,col:u.x??0}})}),this.dispatchEvent(new CustomEvent("grid-changed",{detail:{element:this._gridElement,grid:this._grid,items:this.items},bubbles:!0,composed:!0}))}),this.dispatchEvent(new CustomEvent("grid-ready",{detail:{element:this._gridElement,grid:this._grid,items:this.items},bubbles:!0,composed:!0}))}_createOrUpdateDimensionsHint(e,t,i){var l,d;const r=e.querySelector(".dimensions-hint-popover");if(r){r.style.display=t.length>0&&i.length>0?"block":"none",r.textContent=`${t} × ${i}`;return}const o=document.createElement("div");o.className="dimensions-hint-popover",o.setAttribute("popover","hint"),o.style.display=t.length>0&&i.length>0?"block":"none",o.textContent=`${t} × ${i}`,e.append(o);const n=10-(((d=(l=this.theme)==null?void 0:l.margins)==null?void 0:d[0])??10),a=xt(e,o,async()=>{const{x:h,y:c}=await Rt(e,o,{placement:"bottom",middleware:[zt(n),kt()]});o.style.left=`${h}px`,o.style.top=`${c}px`});o._cleanup=a,o.matches(":popover-open")||o.showPopover()}_removeDimensionsHint(e){const t=e.querySelector(".dimensions-hint-popover");t&&(t._cleanup&&(t._cleanup(),delete t._cleanup),t.matches(":popover-open")&&t.hidePopover(),t.remove())}get grid(){return this._grid}get gridItems(){return this.items.map(e=>{var r;const t={item:e,element:this._gridElement.querySelector(`[gs-id="${e.id}"]`)},i=(r=t.element)==null?void 0:r.querySelector("luzmo-embed-viz-item");return i&&(t.luzmoElement=i),t})}registerRenderer(e,t){this.renderers={...this.renderers,[e]:t}}_renderOverlayContent(e){let t=Vt(e==null?void 0:e.actionsMenu)??Vt(this.defaultItemActionsMenu)??mi();const i=pi.itemTypes.find(r=>r.type===(e==null?void 0:e.type));return!(i!=null&&i.containsData)&&!(e!=null&&e.actionsMenu)&&!this.defaultItemActionsMenu&&(t=t.map(r=>{var o;return{...r,actions:(o=r.actions)==null?void 0:o.filter(n=>n.action!=="edit-data")}})),m.x`
267
+ `,this._hasItemAdded=!1,this._handleMouseout=e=>{if(this.viewMode)return;const i=e.target.closest(".grid-stack-item");if(!i)return;const r=e.relatedTarget;r!=null&&r.closest(".grid-item-actions-popover")||i.hasAttribute("active")||this._removeItemActionsMenuPopover(i)},this._handleKeyDown=e=>{if(!this.viewMode){if(e.key==="Delete"&&this._focusedItemElement)this._handleDeleteItem(new Event("delete"));else if(e.key==="Escape"&&this._focusedItemElement)this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement),this._focusedItemElement=void 0,this._gridElement.focus();else if(e.key==="Enter"&&this._focusedItemElement)e.preventDefault(),e.stopPropagation(),this._activeItemElement&&(this._activeItemElement.removeAttribute("active"),this._gridElement.removeAttribute("has-active-item"),this._removeItemActionsMenuPopover(this._activeItemElement),this._activeItemElement=void 0),this._gridElement.querySelectorAll(".grid-stack-item").forEach(t=>{t!==this._focusedItemElement&&this._removeItemActionsMenuPopover(t)}),this._createItemActionsMenuPopover(this._focusedItemElement),requestAnimationFrame(()=>{var i;const t=(i=this._focusedItemElement)==null?void 0:i.querySelector("luzmo-grid-item-actions-menu");t&&t.focus()});else if(this._focusedItemElement&&this._grid&&["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)){e.preventDefault(),e.stopPropagation();const t=this._focusedItemElement.gridstackNode;if(!t)return;const i=this.columns??48,o={ArrowLeft:{move:{x:t.x-1},resize:{x:t.x-1,w:t.w+1},shrink:{w:t.w-1},canMove:t.x>0,canResize:t.x>0,canShrink:t.w>1},ArrowRight:{move:{x:t.x+1},resize:{w:t.w+1},shrink:{x:t.x+1,w:t.w-1},canMove:t.x<i-t.w,canResize:t.x+t.w<i,canShrink:t.w>1},ArrowUp:{move:{y:t.y-1},resize:{y:t.y-1,h:t.h+1},shrink:{h:t.h-1},canMove:t.y>0,canResize:t.y>0,canShrink:t.h>1},ArrowDown:{move:{y:t.y+1},resize:{h:t.h+1},shrink:{y:t.y+1,h:t.h-1},canMove:!0,canResize:!0,canShrink:t.h>1}}[e.key];let n=null;e.shiftKey&&o.canResize?n=o.resize:(e.ctrlKey||e.metaKey)&&o.canShrink?n=o.shrink:o.canMove&&(n=o.move),n&&this._grid.update(this._focusedItemElement,n)}}},this._handleFocus=e=>{const i=e.target.closest(".grid-stack-item");i&&(this._focusedItemElement&&this._focusedItemElement!==i&&(this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement)),this._focusedItemElement=i,i.setAttribute("focused","true"))},this._handleBlur=e=>{if(!this._focusedItemElement)return;const t=e.relatedTarget;t!=null&&t.closest("luzmo-grid-item-actions-menu")||(this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement),this._focusedItemElement=void 0,this._gridElement.focus())},this._handleDocumentClick=e=>{const t=e.composedPath(),i=this._gridElement.querySelector(".grid-stack-item[active]");if(!i||t.includes(i))return;const r=i.querySelector(".grid-item-actions-popover");r&&t.includes(r)||this._cleanupActiveItem(i)},this._handleAction=e=>{var o,n;const t=e.detail,i=(o=e.target)==null?void 0:o.closest(".grid-stack-item");if(!i)return;const r=i.getAttribute("gs-id");if(t.type==="toggle"&&t.action===this._activeItemActionToggle&&i===this._activeItemElement){this._activeItemElement=void 0,this._activeItemActionToggle=void 0,(n=this._gridElement)==null||n.removeAttribute("has-active-item"),i.removeAttribute("active"),this._cleanupActiveItem(i);return}if(!["delete","clone"].includes(t.action)){this._gridElement.querySelectorAll(".grid-stack-item").forEach(l=>{l!==i&&this._cleanupActiveItem(l)}),t.type==="toggle"&&(this._activeItemElement=i,this._activeItemActionToggle=t.action,this._gridElement.setAttribute("has-active-item","true"),i.setAttribute("active","true"));const a=this.items.find(l=>l.id===r);this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:t.action,items:this.items,element:i,id:r,type:a==null?void 0:a.type,slots:a==null?void 0:a.slots,options:a==null?void 0:a.options,filters:(a==null?void 0:a.filters)??[]},bubbles:!0,composed:!0,cancelable:!0}))}t.action==="delete"?(this._handleDeleteItem(e),this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:t.action,items:this.items,deletedId:r},bubbles:!0,composed:!0,cancelable:!0}))):t.action==="clone"&&this._handleCloneItem(e)},this._handleDeleteItem=e=>{var i;const t=((i=e.target)==null?void 0:i.closest(".grid-stack-item"))||this._focusedItemElement;t&&this.removeGridItemById(t.getAttribute("gs-id")||"")},this._handleCloneItem=e=>{const i=e.target.closest(".grid-stack-item");if(!i||!this._grid)return;const r=i.getAttribute("gs-id");if(!r)return;const o=this.items.find(l=>l.id===r);if(!o)return;const n={...structuredClone(o),id:ke()},a=this.addGridItem(n);this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:"clone",items:this.items,originalElement:i,element:a,id:n.id,type:n.type,slots:n.slots,options:n.options,filters:n.filters},bubbles:!0,composed:!0}))}}static get styles(){return[m.r(Ds),m.r(Ws)]}async _loadTheme(e){var t,i,r,o,n,a,l;(e==null?void 0:e.type)==="custom"?this._fullTheme=structuredClone(e):e!=null&&e.id&&Qe.systemThemeIds.includes(e.id)&&((t=this._fullTheme)==null?void 0:t.id)!==e.id?(this._fullTheme=await Qe.getTheme(e.id),this._fullTheme.id=e.id):e!=null&&e.id&&((i=this._fullTheme)==null?void 0:i.id)!==e.id||!e&&this._fullTheme||(this._fullTheme=await Qe.getTheme("default")),this._initialized&&this._updateThemeProperties(),!this._initialized&&this._gridElement&&await requestAnimationFrame(()=>{this._initializeGrid()}),this._grid&&((l=this._grid)==null||l.margin([(((o=(r=this.theme)==null?void 0:r.margins)==null?void 0:o[0])??16)/2,(((a=(n=this.theme)==null?void 0:n.margins)==null?void 0:a[1])??16)/2].join(" "))),this.requestUpdate()}firstUpdated(){document.addEventListener("click",this._handleDocumentClick),this.addEventListener("keydown",this._handleKeyDown),this._loadTheme(this.theme)}disconnectedCallback(){super.disconnectedCallback(),this._cleanup(),document.removeEventListener("click",this._handleDocumentClick),this.removeEventListener("keydown",this._handleKeyDown)}willUpdate(e){var i,r,o,n,a,l;super.willUpdate(e),e.has("_initialized")&&(this._updateThemeProperties(),this._initialized&&this._grid&&((i=this._fullTheme)!=null&&i.margins)&&((l=this._grid)==null||l.margin([(((o=(r=this._fullTheme)==null?void 0:r.margins)==null?void 0:o[0])??16)/2,(((a=(n=this._fullTheme)==null?void 0:n.margins)==null?void 0:a[1])??16)/2].join(" "))))}updated(e){var n,a,l;super.updated(e);const t=e.has("contentLanguage"),i=e.has("viewMode"),r=e.has("items"),o=e.has("theme");this.items.forEach(d=>{d.id=d.id??ke()}),this._initialized&&this._grid&&(r||this._hasItemAdded)&&(this._hasItemAdded&&this._gridItemElements.forEach(d=>{d.hasAttribute("orphan")&&d.remove()}),this._hasItemAdded=!1,(n=this._grid)==null||n.setAnimation(!1),(a=this._grid)==null||a.batchUpdate(),(l=this._grid)==null||l.removeAll(!1),this.items.forEach(d=>{var c,u,f,y,v,b,w;const h=[...this._gridItemElements].find(z=>z.getAttribute("luzmo-grid-item-id")===d.id);h&&((v=this._grid)==null||v.makeWidget(h,{x:((c=d==null?void 0:d.position)==null?void 0:c.col)??0,y:((u=d==null?void 0:d.position)==null?void 0:u.row)??0,w:((f=d==null?void 0:d.position)==null?void 0:f.sizeX)??1,h:((y=d==null?void 0:d.position)==null?void 0:y.sizeY)??1,id:d.id}),(b=this._grid)==null||b.batchUpdate(!1),(w=this._grid)==null||w.setAnimation(!0))})),t&&this._updateLuzmoVizItemsLanguage(),this._initialized&&this._grid&&i&&this.viewMode!==e.get("viewMode")&&(this.viewMode?(this._grid.disable(),this._activeItemElement&&(this._cleanupActiveItem(this._activeItemElement),this._activeItemElement=void 0,this._gridElement.removeAttribute("has-active-item"))):this._grid.enable()),o&&this._loadTheme(this.theme)}_updateLuzmoVizItemsLanguage(){this._gridItemElements.forEach(e=>{const t=e.querySelector("luzmo-embed-viz-item");t&&(t.options={...t.options,locale:this.contentLanguage})})}_handleMouseover(e){if(this.viewMode)return;const i=e.target.closest(".grid-stack-item");i&&this._createItemActionsMenuPopover(i)}_cleanupActiveItem(e){e.removeAttribute("active"),this._activeItemElement===e&&(this._activeItemElement=void 0,this._gridElement.removeAttribute("has-active-item")),this._removeItemActionsMenuPopover(e)}_cleanup(){for(const e of this._gridItemElements)this._cleanupActiveItem(e);this._grid&&(this._grid.destroy(),this._grid=void 0),this._initialized=!1}_initializeGrid(){var t,i,r,o,n,a,l,d;if(this._initialized||!this._gridElement)return;const e={column:this.columns??48,cellHeight:this.rowHeight??16,marginTop:(((i=(t=this._fullTheme)==null?void 0:t.margins)==null?void 0:i[0])??16)/2,marginLeft:(((o=(r=this._fullTheme)==null?void 0:r.margins)==null?void 0:o[1])??16)/2,marginRight:(((a=(n=this._fullTheme)==null?void 0:n.margins)==null?void 0:a[1])??16)/2,marginBottom:(((d=(l=this._fullTheme)==null?void 0:l.margins)==null?void 0:d[0])??16)/2,animate:!0,auto:!1,float:!1,removable:!1,acceptWidgets:!0,disableDrag:this.viewMode,disableResize:this.viewMode,minRow:1,resizable:{handles:["n","ne","e","se","s","sw","w","nw"].join(", ")},handle:".grid-item-drag-handle"};this._grid=_.init(e,this._gridElement),this._grid.batchUpdate(),this._gridItemElements.forEach(h=>{var y,v,b,w,z;const c=h.getAttribute("luzmo-grid-item-id"),u=this.items.find(k=>k.id===c),f={id:c,x:((y=u==null?void 0:u.position)==null?void 0:y.col)??0,y:((v=u==null?void 0:u.position)==null?void 0:v.row)??0,w:((b=u==null?void 0:u.position)==null?void 0:b.sizeX)??1,h:((w=u==null?void 0:u.position)==null?void 0:w.sizeY)??1};(z=this._grid)==null||z.makeWidget(h,f)}),this._grid.batchUpdate(!1),this._initialized=!0,this._grid.on("resizestart",(h,c)=>{const u=c.getAttribute("gs-w")??"",f=c.getAttribute("gs-h")??"";this._createOrUpdateDimensionsHint(c,u,f)}),this._grid.on("resize",(h,c)=>{const u=c.getAttribute("gs-w")??"",f=c.getAttribute("gs-h")??"";this._createOrUpdateDimensionsHint(c,u,f)}),this._grid.on("resizestop",(h,c)=>{this._removeDimensionsHint(c)}),this._grid.on("change",(h,c)=>{c.forEach(u=>{if(!(u!=null&&u.id))return;const f=this.items.findIndex(y=>y.id===u.id);f!==-1&&(this.items[f]={...this.items[f],position:{sizeX:u.w??1,sizeY:u.h??1,row:u.y??0,col:u.x??0}})}),this.dispatchEvent(new CustomEvent("grid-changed",{detail:{element:this._gridElement,grid:this._grid,items:this.items},bubbles:!0,composed:!0}))}),this.dispatchEvent(new CustomEvent("grid-ready",{detail:{element:this._gridElement,grid:this._grid,items:this.items},bubbles:!0,composed:!0}))}_createOrUpdateDimensionsHint(e,t,i){var l,d;const r=e.querySelector(".dimensions-hint-popover");if(r){r.style.display=t.length>0&&i.length>0?"block":"none",r.textContent=`${t} × ${i}`;return}const o=document.createElement("div");o.className="dimensions-hint-popover",o.setAttribute("popover","hint"),o.style.display=t.length>0&&i.length>0?"block":"none",o.textContent=`${t} × ${i}`,e.append(o);const n=10-(((d=(l=this.theme)==null?void 0:l.margins)==null?void 0:d[0])??10),a=zt(e,o,async()=>{const{x:h,y:c}=await St(e,o,{placement:"bottom",middleware:[kt(n),Rt()]});o.style.left=`${h}px`,o.style.top=`${c}px`});o._cleanup=a,o.matches(":popover-open")||o.showPopover()}_removeDimensionsHint(e){const t=e.querySelector(".dimensions-hint-popover");t&&(t._cleanup&&(t._cleanup(),delete t._cleanup),t.matches(":popover-open")&&t.hidePopover(),t.remove())}get grid(){return this._grid}get gridItems(){return this.items.map(e=>{var r;const t={item:e,element:this._gridElement.querySelector(`[gs-id="${e.id}"]`)},i=(r=t.element)==null?void 0:r.querySelector("luzmo-embed-viz-item");return i&&(t.luzmoElement=i),t})}registerRenderer(e,t){this.renderers={...this.renderers,[e]:t}}_renderOverlayContent(e){let t=qt(e==null?void 0:e.actionsMenu)??qt(this.defaultItemActionsMenu)??gi();const i=yi.itemTypes.find(r=>r.type===(e==null?void 0:e.type));return!(i!=null&&i.containsData)&&!(e!=null&&e.actionsMenu)&&!this.defaultItemActionsMenu&&(t=t.map(r=>{var o;return{...r,actions:(o=r.actions)==null?void 0:o.filter(n=>n.action!=="edit-data")}})),m.x`
272
268
  <div class="grid-item-actions-popover" popover="manual">
273
269
  <luzmo-grid-item-actions-menu
274
270
  .actions=${t}
@@ -278,7 +274,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
278
274
  >
279
275
  </luzmo-grid-item-actions-menu>
280
276
  </div>
281
- `}_createItemActionsMenuPopover(e){let t=e.querySelector(".grid-item-actions-popover");const i=e.querySelector(".grid-stack-item-content"),r=this.getGridItemById(e.getAttribute("gs-id")??"");if(!t){const n=document.createDocumentFragment();m.B(this._renderOverlayContent(r==null?void 0:r.item),n),t=n.querySelector(".grid-item-actions-popover"),e.append(t)}const o=xt(i,t,async()=>{var l;const{x:n,y:a}=await Rt(i,t,{placement:((l=r==null?void 0:r.item)==null?void 0:l.placementActionsMenu)??this.placementItemActionsMenu??"right-start",middleware:[zt(0),kt({crossAxis:!1})]});t.style.left=`${n}px`,t.style.top=`${a}px`});t._cleanup=o,t.matches(":popover-open")||t.showPopover()}_removeItemActionsMenuPopover(e){const t=e.querySelector(".grid-item-actions-popover");t&&(t._cleanup&&(t._cleanup(),delete t._cleanup),t.matches(":popover-open")&&t.hidePopover(),t.remove())}_updateThemeProperties(){var r,o,n,a,l,d,h,c,u,f,y,v,b,w,z,k,A,R,B,$,se;if(!this._fullTheme)return;const e=this._fullTheme.boxShadow;let t="";if(e){const U=new bt.Color(e.color),I={r:Math.round(U.srgb.r*255),g:Math.round(U.srgb.g*255),b:Math.round(U.srgb.b*255)},Ie=((r=this._fullTheme.margins)==null?void 0:r[0])??16,L=Math.min(Ie/10,2),Z=(D,ae)=>ae>=1?`rgba(${D.r},${D.g},${D.b},1)`:ae<=0?`rgba(${D.r},${D.g},${D.b},0)`:`rgba(${D.r},${D.g},${D.b},${ae})`;e.size==="none"?t="none":e.size==="S"?t=`0 ${L*2}px ${L*4}px ${Z(I,.16)}, 0 ${L*2}px ${L*4}px ${Z(I,.23)}`:e.size==="M"?t=`0 ${L*8}px ${L*16}px ${Z(I,.19)}, 0 ${L*4}px ${L*4}px ${Z(I,.23)}`:e.size==="L"&&(t=`0 ${L*12}px ${L*24}px ${Z(I,.25)}, 0 ${L*8}px ${L*8}px ${Z(I,.22)}`)}new Map([["--grid-font-family",(n=(o=this._fullTheme)==null?void 0:o.font)==null?void 0:n.fontFamily],["--grid-background",(a=this._fullTheme)==null?void 0:a.background],["--grid-item-box-shadow",t],["--grid-item-background",(l=this._fullTheme)==null?void 0:l.itemsBackground],["--grid-item-border-color",(h=(d=this._fullTheme)==null?void 0:d.borders)==null?void 0:h["border-color"]],["--grid-item-border-style",(u=(c=this._fullTheme)==null?void 0:c.borders)==null?void 0:u["border-style"]],["--grid-item-border-radius",(y=(f=this._fullTheme)==null?void 0:f.borders)==null?void 0:y["border-radius"]],["--grid-item-border-width",`${(b=(v=this._fullTheme)==null?void 0:v.borders)==null?void 0:b["border-top-width"]}`],["--grid-item-border-top-width",(z=(w=this._fullTheme)==null?void 0:w.borders)==null?void 0:z["border-top-width"]],["--grid-item-border-right-width",(A=(k=this._fullTheme)==null?void 0:k.borders)==null?void 0:A["border-right-width"]],["--grid-item-border-bottom-width",(B=(R=this._fullTheme)==null?void 0:R.borders)==null?void 0:B["border-bottom-width"]],["--grid-item-border-left-width",(se=($=this._fullTheme)==null?void 0:$.borders)==null?void 0:se["border-left-width"]]]).forEach((U,I)=>{U?this.style.setProperty(I,U):this.style.removeProperty(I)})}getGridItemById(e){return this.gridItems.find(t=>t.item.id===e)}addGridItem(e){var l,d,h,c,u;!this._initialized&&this._gridElement&&console.warn("Grid is not initialized, wait for grid-ready event");const t={...structuredClone(e),id:ke(),position:structuredClone(e==null?void 0:e.position)??{sizeX:1,sizeY:1,col:0,row:0}},i=this._renderItem(t,this.items.length),r=document.createDocumentFragment();m.B(i,r,{host:this}),this._gridElement.append(r);const o=this._gridElement.querySelector(`[luzmo-grid-item-id="${t.id}"]`);o.setAttribute("orphan","true");const n={x:((l=t.position)==null?void 0:l.col)??0,y:((d=t.position)==null?void 0:d.row)??0,w:((h=t.position)==null?void 0:h.sizeX)??1,h:((c=t.position)==null?void 0:c.sizeY)??1,autoPosition:!0,id:t.id},a=(u=this._grid)==null?void 0:u.makeWidget(o,n);return a&&(t.position={sizeX:Number.parseInt(a.getAttribute("gs-w")??"1",10),sizeY:Number.parseInt(a.getAttribute("gs-h")??"1",10),col:Number.parseInt(a.getAttribute("gs-x")??"0",10),row:Number.parseInt(a.getAttribute("gs-y")??"0",10)}),this.items.push(t),this._hasItemAdded=!0,this._activeItemElement&&this._cleanupActiveItem(this._activeItemElement),requestAnimationFrame(()=>{const f=o.getBoundingClientRect();(f.bottom>window.innerHeight||f.top<0)&&o.scrollIntoView({behavior:"smooth",block:"center"})}),o}removeGridItem(e){this.removeGridItemById((e==null?void 0:e.id)??"")}removeGridItemById(e){var r;if(!e)return;const t=(r=this.getGridItemById(e))==null?void 0:r.element;t&&this._grid&&(this._grid.removeWidget(t),this._focusedItemElement=void 0);const i=this.items.findIndex(o=>o.id===e);i!==-1&&this.items.splice(i,1),this._removeItemActionsMenuPopover(t),t&&this._activeItemElement===t&&this._cleanupActiveItem(t)}_renderItem(e,t){var o;const i={...e.options,locale:this.contentLanguage};i.theme||(i.theme=(o=this._fullTheme)!=null&&o.id?{id:this._fullTheme.id}:structuredClone(this._fullTheme));const r=!this.viewMode;return m.x`
277
+ `}_createItemActionsMenuPopover(e){let t=e.querySelector(".grid-item-actions-popover");const i=e.querySelector(".grid-stack-item-content"),r=this.getGridItemById(e.getAttribute("gs-id")??"");if(!t){const n=document.createDocumentFragment();m.B(this._renderOverlayContent(r==null?void 0:r.item),n),t=n.querySelector(".grid-item-actions-popover"),e.append(t)}const o=zt(i,t,async()=>{var l;const{x:n,y:a}=await St(i,t,{placement:((l=r==null?void 0:r.item)==null?void 0:l.placementActionsMenu)??this.placementItemActionsMenu??"right-start",middleware:[kt(0),Rt({crossAxis:!1})]});t.style.left=`${n}px`,t.style.top=`${a}px`});t._cleanup=o,t.matches(":popover-open")||t.showPopover()}_removeItemActionsMenuPopover(e){const t=e.querySelector(".grid-item-actions-popover");t&&(t._cleanup&&(t._cleanup(),delete t._cleanup),t.matches(":popover-open")&&t.hidePopover(),t.remove())}_updateThemeProperties(){var r,o,n,a,l,d,h,c,u,f,y,v,b,w,z,k,S,R,B,$,se;if(!this._fullTheme)return;const e=this._fullTheme.boxShadow;let t="";if(e){const U=new vt.Color(e.color),T={r:Math.round(U.srgb.r*255),g:Math.round(U.srgb.g*255),b:Math.round(U.srgb.b*255)},Te=((r=this._fullTheme.margins)==null?void 0:r[0])??16,L=Math.min(Te/10,2),Z=(D,ae)=>ae>=1?`rgba(${D.r},${D.g},${D.b},1)`:ae<=0?`rgba(${D.r},${D.g},${D.b},0)`:`rgba(${D.r},${D.g},${D.b},${ae})`;e.size==="none"?t="none":e.size==="S"?t=`0 ${L*2}px ${L*4}px ${Z(T,.16)}, 0 ${L*2}px ${L*4}px ${Z(T,.23)}`:e.size==="M"?t=`0 ${L*8}px ${L*16}px ${Z(T,.19)}, 0 ${L*4}px ${L*4}px ${Z(T,.23)}`:e.size==="L"&&(t=`0 ${L*12}px ${L*24}px ${Z(T,.25)}, 0 ${L*8}px ${L*8}px ${Z(T,.22)}`)}new Map([["--grid-font-family",(n=(o=this._fullTheme)==null?void 0:o.font)==null?void 0:n.fontFamily],["--grid-background",(a=this._fullTheme)==null?void 0:a.background],["--grid-item-box-shadow",t],["--grid-item-background",(l=this._fullTheme)==null?void 0:l.itemsBackground],["--grid-item-border-color",(h=(d=this._fullTheme)==null?void 0:d.borders)==null?void 0:h["border-color"]],["--grid-item-border-style",(u=(c=this._fullTheme)==null?void 0:c.borders)==null?void 0:u["border-style"]],["--grid-item-border-radius",(y=(f=this._fullTheme)==null?void 0:f.borders)==null?void 0:y["border-radius"]],["--grid-item-border-width",`${(b=(v=this._fullTheme)==null?void 0:v.borders)==null?void 0:b["border-top-width"]}`],["--grid-item-border-top-width",(z=(w=this._fullTheme)==null?void 0:w.borders)==null?void 0:z["border-top-width"]],["--grid-item-border-right-width",(S=(k=this._fullTheme)==null?void 0:k.borders)==null?void 0:S["border-right-width"]],["--grid-item-border-bottom-width",(B=(R=this._fullTheme)==null?void 0:R.borders)==null?void 0:B["border-bottom-width"]],["--grid-item-border-left-width",(se=($=this._fullTheme)==null?void 0:$.borders)==null?void 0:se["border-left-width"]]]).forEach((U,T)=>{U?this.style.setProperty(T,U):this.style.removeProperty(T)})}getGridItemById(e){return this.gridItems.find(t=>t.item.id===e)}addGridItem(e){var l,d,h,c,u;!this._initialized&&this._gridElement&&console.warn("Grid is not initialized, wait for grid-ready event");const t={...structuredClone(e),id:ke(),position:structuredClone(e==null?void 0:e.position)??{sizeX:1,sizeY:1,col:0,row:0}},i=this._renderItem(t,this.items.length),r=document.createDocumentFragment();m.B(i,r,{host:this}),this._gridElement.append(r);const o=this._gridElement.querySelector(`[luzmo-grid-item-id="${t.id}"]`);o.setAttribute("orphan","true");const n={x:((l=t.position)==null?void 0:l.col)??0,y:((d=t.position)==null?void 0:d.row)??0,w:((h=t.position)==null?void 0:h.sizeX)??1,h:((c=t.position)==null?void 0:c.sizeY)??1,autoPosition:!0,id:t.id},a=(u=this._grid)==null?void 0:u.makeWidget(o,n);return a&&(t.position={sizeX:Number.parseInt(a.getAttribute("gs-w")??"1",10),sizeY:Number.parseInt(a.getAttribute("gs-h")??"1",10),col:Number.parseInt(a.getAttribute("gs-x")??"0",10),row:Number.parseInt(a.getAttribute("gs-y")??"0",10)}),this.items.push(t),this._hasItemAdded=!0,this._activeItemElement&&this._cleanupActiveItem(this._activeItemElement),requestAnimationFrame(()=>{const f=o.getBoundingClientRect();(f.bottom>window.innerHeight||f.top<0)&&o.scrollIntoView({behavior:"smooth",block:"center"})}),o}removeGridItem(e){this.removeGridItemById((e==null?void 0:e.id)??"")}removeGridItemById(e){var r;if(!e)return;const t=(r=this.getGridItemById(e))==null?void 0:r.element;t&&this._grid&&(this._grid.removeWidget(t),this._focusedItemElement=void 0);const i=this.items.findIndex(o=>o.id===e);i!==-1&&this.items.splice(i,1),this._removeItemActionsMenuPopover(t),t&&this._activeItemElement===t&&this._cleanupActiveItem(t)}_renderItem(e,t){var o;const i={...e.options,locale:this.contentLanguage};i.theme||(i.theme=(o=this._fullTheme)!=null&&o.id?{id:this._fullTheme.id}:structuredClone(this._fullTheme));const r=!this.viewMode;return m.x`
282
278
  <div
283
279
  class="luzmo-grid-item has-luzmo-viz-item"
284
280
  luzmo-grid-item-id=${e.id??ke()}
@@ -314,7 +310,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
314
310
  ></luzmo-embed-viz-item>`:m.x``}
315
311
  </div>
316
312
  </div>
317
- `}_renderGrid(){var i,r;const e=this.items.map((o,n)=>(o.id=o.id??ke(),this._renderItem(o,n)));let t=!1;return this._initialized&&((i=this._fullTheme)!=null&&i.itemsBackground||(r=this._fullTheme)!=null&&r.background)&&(t=new bt.Color(this._fullTheme.itemsBackground??this._fullTheme.background).luminance<.5),m.x`
313
+ `}_renderGrid(){var i,r;const e=this.items.map((o,n)=>(o.id=o.id??ke(),this._renderItem(o,n)));let t=!1;return this._initialized&&((i=this._fullTheme)!=null&&i.itemsBackground||(r=this._fullTheme)!=null&&r.background)&&(t=new vt.Color(this._fullTheme.itemsBackground??this._fullTheme.background).luminance<.5),m.x`
318
314
  <div
319
315
  ?dark-background=${t}
320
316
  class="grid-stack"
@@ -324,4 +320,4 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
324
320
  >
325
321
  ${e}
326
322
  </div>
327
- `}render(){return this._renderGrid()}}M([m.n({type:String,attribute:"app-server",reflect:!0})],S.prototype,"appServer");M([m.n({type:String,attribute:"api-host",reflect:!0})],S.prototype,"apiHost");M([m.n({type:String,attribute:"auth-key",reflect:!0})],S.prototype,"authKey");M([m.n({type:String,attribute:"auth-token",reflect:!0})],S.prototype,"authToken");M([m.n({type:Number,attribute:"cache-time",reflect:!0})],S.prototype,"cacheTime");M([m.n({type:String,reflect:!0})],S.prototype,"language");M([m.n({type:String,attribute:"content-language",reflect:!0})],S.prototype,"contentLanguage");M([m.n({type:Number,reflect:!0})],S.prototype,"columns");M([m.n({type:Number,reflect:!0,attribute:"row-height"})],S.prototype,"rowHeight");M([m.n({type:Boolean,reflect:!0,attribute:"view-mode"})],S.prototype,"viewMode");M([m.n({type:String,reflect:!0,attribute:"placement-item-actions-menu"})],S.prototype,"placementItemActionsMenu");M([m.n({type:Array,reflect:!0,attribute:"default-item-actions-menu"})],S.prototype,"defaultItemActionsMenu");M([m.n({type:Object,reflect:!0})],S.prototype,"theme");M([m.n({type:Array,reflect:!1})],S.prototype,"items");M([m.n({type:Object,reflect:!1})],S.prototype,"renderers");M([Ee.r()],S.prototype,"_initialized");M([Ge.e(".grid-stack")],S.prototype,"_gridElement");M([fi.r(".luzmo-grid-item")],S.prototype,"_gridItemElements");customElements.get("luzmo-grid")||customElements.define("luzmo-grid",S);customElements.get("luzmo-grid-item-actions-menu")||customElements.define("luzmo-grid-item-actions-menu",exports.LuzmoGridItemActionsMenu);exports.LuzmoGrid=S;
323
+ `}render(){return this._renderGrid()}}M([m.n({type:String,attribute:"app-server",reflect:!0})],A.prototype,"appServer");M([m.n({type:String,attribute:"api-host",reflect:!0})],A.prototype,"apiHost");M([m.n({type:String,attribute:"auth-key",reflect:!0})],A.prototype,"authKey");M([m.n({type:String,attribute:"auth-token",reflect:!0})],A.prototype,"authToken");M([m.n({type:Number,attribute:"cache-time",reflect:!0})],A.prototype,"cacheTime");M([m.n({type:String,reflect:!0})],A.prototype,"language");M([m.n({type:String,attribute:"content-language",reflect:!0})],A.prototype,"contentLanguage");M([m.n({type:Number,reflect:!0})],A.prototype,"columns");M([m.n({type:Number,reflect:!0,attribute:"row-height"})],A.prototype,"rowHeight");M([m.n({type:Boolean,reflect:!0,attribute:"view-mode"})],A.prototype,"viewMode");M([m.n({type:String,reflect:!0,attribute:"placement-item-actions-menu"})],A.prototype,"placementItemActionsMenu");M([m.n({type:Array,reflect:!0,attribute:"default-item-actions-menu"})],A.prototype,"defaultItemActionsMenu");M([m.n({type:Object,reflect:!0})],A.prototype,"theme");M([m.n({type:Array,reflect:!1})],A.prototype,"items");M([m.n({type:Object,reflect:!1})],A.prototype,"renderers");M([Ee.r()],A.prototype,"_initialized");M([Ge.e(".grid-stack")],A.prototype,"_gridElement");M([pi.r(".luzmo-grid-item")],A.prototype,"_gridItemElements");customElements.get("luzmo-grid")||customElements.define("luzmo-grid",A);customElements.get("luzmo-grid-item-actions-menu")||customElements.define("luzmo-grid-item-actions-menu",exports.LuzmoGridItemActionsMenu);exports.LuzmoGrid=A;