iobroker.javascript 9.0.11 → 9.0.13

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 (134) hide show
  1. package/README.md +3 -5
  2. package/admin/assets/OpenAiDialog-BmcYPsVa.js +36 -0
  3. package/admin/assets/{Save--0ldNXLf.js → Save-DXaUpIPM.js} +1 -1
  4. package/admin/assets/{ScriptEditor-CpRWvDSw.js → ScriptEditor-BoSBgnK-.js} +1 -1
  5. package/admin/assets/{ScriptEditorVanillaMonaco-BWe9MiKn.js → ScriptEditorVanillaMonaco-Xge2wqgO.js} +1 -1
  6. package/admin/assets/{createSvgIcon-C_ElRFrf.js → createSvgIcon-DlIk-fDn.js} +3 -3
  7. package/admin/assets/hostInit-OBG53iVO.js +2 -0
  8. package/admin/assets/index-BCK6q-N6.css +1 -0
  9. package/admin/assets/{index-BLZa2V1g.js → index-BMwfsknM.js} +1 -1
  10. package/admin/assets/{index-Dr_ZFwru.css → index-BTsjunTt.css} +1 -1
  11. package/admin/assets/{index-CMttI-gM.js → index-BWM5lJbO.js} +4 -4
  12. package/admin/assets/index-Br_QjNUk.js +942 -0
  13. package/admin/assets/index-CePzv5-W.js +1294 -0
  14. package/admin/assets/index-Cjl4b70e.js +5 -0
  15. package/admin/assets/{index-BompUVvy.js → index-DZ3lKVw8.js} +1 -1
  16. package/admin/assets/{index-DmpUKunr.js → index-DwcZPzOL.js} +2 -2
  17. package/admin/assets/index-OIiv3PJA.js +16 -0
  18. package/admin/assets/{inheritsLoose-CLw44UEv.js → inheritsLoose-DNrhibGS.js} +1 -1
  19. package/admin/assets/{iobroker_javascript__loadShare__react__loadShare__-B-pIv4x_.js → iobroker_javascript__loadShare__react__loadShare__-i8pXne9X.js} +1 -1
  20. package/admin/assets/iobroker_javascript__mf_v__runtimeInit__mf_v__-DZdFIfoQ.js +5 -0
  21. package/admin/assets/preload-helper-BDBacUwf.js +1 -0
  22. package/admin/assets/useTheme-DakN8Abq.js +1 -0
  23. package/admin/custom/assets/{Components-za_0yG9W.js → Components-DjQ_LxKw.js} +1 -1
  24. package/admin/custom/assets/{ConfigCustomJavascriptSet__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-BHJt30My.js → ConfigCustomJavascriptSet__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-DaN0pfsw.js} +1 -1
  25. package/admin/custom/assets/{ConfigCustomJavascriptSet__loadShare___mf_0_mui_mf_1_material__loadShare__-WrqdT1Hz.js → ConfigCustomJavascriptSet__loadShare___mf_0_mui_mf_1_material__loadShare__-BqzgglHd.js} +1 -1
  26. package/admin/custom/assets/{ConfigCustomJavascriptSet__loadShare__react__loadShare__-B_YWmFeG.js → ConfigCustomJavascriptSet__loadShare__react__loadShare__-BNbscXK6.js} +1 -1
  27. package/admin/custom/assets/{ConfigCustomJavascriptSet__loadShare__react_mf_2_dom__loadShare__-DYzjQQsF.js → ConfigCustomJavascriptSet__loadShare__react_mf_2_dom__loadShare__-N2_tx_mJ.js} +1 -1
  28. package/admin/custom/assets/ConfigCustomJavascriptSet__mf_v__runtimeInit__mf_v__-jdUmHa_i.js +5 -0
  29. package/admin/custom/assets/DefaultPropsProvider-B8ZCC-c2.js +1 -0
  30. package/admin/custom/assets/DefaultPropsProvider-DfdXSIBu.js +1 -0
  31. package/admin/custom/assets/{FilledInput-BGGUNS4j.js → FilledInput-CSjr0QT8.js} +2 -2
  32. package/admin/custom/assets/{Tabs-DjdFNknI.js → Tabs-CiTQkBjL.js} +6 -6
  33. package/admin/custom/assets/{ThemeProvider-Uan4kCQd.js → ThemeProvider-C50pIiW4.js} +2 -2
  34. package/admin/custom/assets/_commonjsHelpers-CE1G-McA.js +1 -0
  35. package/admin/custom/assets/{createSvgIcon-BxCMHFh5.js → createSvgIcon-C7qUEvjp.js} +1 -1
  36. package/admin/custom/assets/createTheme-Bm92JF8u.js +8 -0
  37. package/admin/custom/assets/defaultTheme-BlO0eCf6.js +1 -0
  38. package/admin/custom/assets/{hostInit-CrAs5YZS.js → hostInit-BJ6gSofk.js} +2 -2
  39. package/admin/custom/assets/index-4wMOc304.js +1 -0
  40. package/admin/custom/assets/{index-UhQfKbTz.js → index-5CTGLw4h.js} +1 -1
  41. package/admin/custom/assets/index-BHN4DzE4.js +908 -0
  42. package/admin/custom/assets/{index-yiPj_-Rb.js → index-BkjEWGjf.js} +1 -1
  43. package/admin/custom/assets/{index-bxilEzdP.js → index-COcxCdeX.js} +2 -18
  44. package/admin/custom/assets/{index-DXg_kRe6.js → index-CnpybLRW.js} +1 -1
  45. package/admin/custom/assets/{index-ClFSKKDu.js → index-Db8nkuMR.js} +2 -2
  46. package/admin/custom/assets/{index-B2rBO0oC.js → index-DcK0RDrH.js} +1 -1
  47. package/admin/custom/assets/{index-7YkEnLQM.js → index-Df6OaCxx.js} +1 -1
  48. package/admin/custom/assets/{index-DOnIDI_a.js → index-Dx7rDE4p.js} +1 -1
  49. package/admin/custom/assets/index-t-NMdeH5.js +31 -0
  50. package/admin/custom/assets/index-u8R8UVCf.js +1393 -0
  51. package/admin/custom/assets/jsx-runtime-C1csJtRx.js +1 -0
  52. package/admin/custom/assets/leaflet-src-DpWQqQWv.js +1 -0
  53. package/admin/custom/assets/preload-helper-BDBacUwf.js +1 -0
  54. package/admin/custom/assets/useEnhancedEffect-aUb-5tTL.js +1 -0
  55. package/admin/custom/assets/{useTheme-DWmRkwMP.js → useTheme-Cgjfsi-1.js} +1 -1
  56. package/admin/custom/assets/useTheme-DFGylj2o.js +1 -0
  57. package/admin/custom/assets/virtualExposes-C_DtjFte.js +2 -0
  58. package/admin/custom/customComponents.js +2 -2
  59. package/admin/i18n/de.json +1 -1
  60. package/admin/mf-manifest.json +1 -1
  61. package/admin/remoteEntry.js +2 -2
  62. package/admin/tab.html +10 -13
  63. package/build/lib/crypto.js +32 -0
  64. package/build/lib/crypto.js.map +1 -0
  65. package/{build-backend → build}/lib/javascript.d.ts +3 -0
  66. package/{build-backend → build}/lib/utils.js.map +1 -1
  67. package/{build-backend → build}/main.js +20 -12
  68. package/build/main.js.map +1 -0
  69. package/{build-backend → build}/types.d.ts +1 -0
  70. package/docs/en/javascript.md +1 -1
  71. package/io-package.json +14 -14
  72. package/package.json +21 -20
  73. package/admin/assets/OpenAiDialog-BYXyaWDU.js +0 -36
  74. package/admin/assets/hostInit-fzxL8JAx.js +0 -2
  75. package/admin/assets/index-BUU5hWiL.js +0 -1294
  76. package/admin/assets/index-DUBaHZ92.css +0 -1
  77. package/admin/assets/index-DeFm7TiX.js +0 -5
  78. package/admin/assets/index-T5pCS60x.js +0 -16
  79. package/admin/assets/index-fhg5Z_KX.js +0 -930
  80. package/admin/assets/iobroker_javascript__mf_v__runtimeInit__mf_v__-CmuPLb0X.js +0 -5
  81. package/admin/assets/preload-helper-Dp1pzeXC.js +0 -1
  82. package/admin/assets/useTheme-CpAj0H76.js +0 -1
  83. package/admin/custom/assets/ConfigCustomJavascriptSet__mf_v__runtimeInit__mf_v__-Cib3-eWa.js +0 -5
  84. package/admin/custom/assets/DefaultPropsProvider-B41fRCEO.js +0 -1
  85. package/admin/custom/assets/DefaultPropsProvider-CfXkmG16.js +0 -7
  86. package/admin/custom/assets/_commonjsHelpers-D6-XlEtG.js +0 -1
  87. package/admin/custom/assets/createTheme-Ajie0adn.js +0 -16
  88. package/admin/custom/assets/defaultTheme-C_aSR-NR.js +0 -1
  89. package/admin/custom/assets/index-BkKMt4bp.js +0 -31
  90. package/admin/custom/assets/index-Bw5ZKbIF.js +0 -1399
  91. package/admin/custom/assets/index-Co3YA5NW.js +0 -9
  92. package/admin/custom/assets/index-DsPFm5o5.js +0 -904
  93. package/admin/custom/assets/jsx-runtime-lE4rOet2.js +0 -9
  94. package/admin/custom/assets/leaflet-src-A2ZHl6nF.js +0 -4
  95. package/admin/custom/assets/preload-helper-Dp1pzeXC.js +0 -1
  96. package/admin/custom/assets/useEnhancedEffect-DSK35Rma.js +0 -8
  97. package/admin/custom/assets/useTheme-CpiJlUE9.js +0 -1
  98. package/admin/custom/assets/virtualExposes-4pgHXHfp.js +0 -2
  99. package/build-backend/main.js.map +0 -1
  100. /package/{build-backend → build}/lib/consts.js +0 -0
  101. /package/{build-backend → build}/lib/consts.js.map +0 -0
  102. /package/{build-backend → build}/lib/convert.js +0 -0
  103. /package/{build-backend → build}/lib/convert.js.map +0 -0
  104. /package/{build-backend → build}/lib/debug.js +0 -0
  105. /package/{build-backend → build}/lib/debug.js.map +0 -0
  106. /package/{build-backend → build}/lib/debugger.js +0 -0
  107. /package/{build-backend → build}/lib/debugger.js.map +0 -0
  108. /package/{build-backend → build}/lib/eventObj.js +0 -0
  109. /package/{build-backend → build}/lib/eventObj.js.map +0 -0
  110. /package/{build-backend → build}/lib/inspect.js +0 -0
  111. /package/{build-backend → build}/lib/inspect.js.map +0 -0
  112. /package/{build-backend → build}/lib/mirror.js +0 -0
  113. /package/{build-backend → build}/lib/mirror.js.map +0 -0
  114. /package/{build-backend → build}/lib/nodeModulesManagement.js +0 -0
  115. /package/{build-backend → build}/lib/nodeModulesManagement.js.map +0 -0
  116. /package/{build-backend → build}/lib/patternCompareFunctions.js +0 -0
  117. /package/{build-backend → build}/lib/patternCompareFunctions.js.map +0 -0
  118. /package/{build-backend → build}/lib/protectFs.js +0 -0
  119. /package/{build-backend → build}/lib/protectFs.js.map +0 -0
  120. /package/{build-backend → build}/lib/request.js +0 -0
  121. /package/{build-backend → build}/lib/request.js.map +0 -0
  122. /package/{build-backend → build}/lib/sandbox.js +0 -0
  123. /package/{build-backend → build}/lib/sandbox.js.map +0 -0
  124. /package/{build-backend → build}/lib/scheduler.js +0 -0
  125. /package/{build-backend → build}/lib/scheduler.js.map +0 -0
  126. /package/{build-backend → build}/lib/tools.js +0 -0
  127. /package/{build-backend → build}/lib/tools.js.map +0 -0
  128. /package/{build-backend → build}/lib/typescriptSettings.js +0 -0
  129. /package/{build-backend → build}/lib/typescriptSettings.js.map +0 -0
  130. /package/{build-backend → build}/lib/typescriptTools.js +0 -0
  131. /package/{build-backend → build}/lib/typescriptTools.js.map +0 -0
  132. /package/{build-backend → build}/lib/utils.js +0 -0
  133. /package/{build-backend → build}/lib/words.js +0 -0
  134. /package/{build-backend → build}/lib/words.js.map +0 -0
@@ -0,0 +1,1294 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-BMwfsknM.js","./createSvgIcon-DlIk-fDn.js","./iobroker_javascript__loadShare__react__loadShare__-i8pXne9X.js","./_commonjsHelpers-Cpj98o6Y.js","./iobroker_javascript__mf_v__runtimeInit__mf_v__-DZdFIfoQ.js","./index-Cjl4b70e.js","./inheritsLoose-DNrhibGS.js","./preload-helper-BDBacUwf.js","./index-BCK6q-N6.css","./index-OIiv3PJA.js","./ScriptEditorVanillaMonaco-Xge2wqgO.js","./ScriptEditor-BoSBgnK-.js","./Save-DXaUpIPM.js","./OpenAiDialog-BmcYPsVa.js","./index-DZ3lKVw8.js"])))=>i.map(i=>d[i]);
2
+ import{a as OT,b as MT,r as NT,l as LT}from"./iobroker_javascript__mf_v__runtimeInit__mf_v__-DZdFIfoQ.js";import{j as g,c as dt,g as L_,r as B_,_ as Zp,i as gy,P as ee}from"./createSvgIcon-DlIk-fDn.js";import{i as P_,y as BT,_ as PT,a as FT,m as jT,S as my,T as fy}from"./inheritsLoose-DNrhibGS.js";import{R as X,i as H}from"./iobroker_javascript__loadShare__react__loadShare__-i8pXne9X.js";import{i as y,C as Do,I as zs,a as zl,b as zT,c as F_,F as UT,d as HT,e as Yl,f as Qp,g as WT,h as VT,j as GT,k as KT,M as YT,l as JT,m as XT,n as qT,_ as ZT,o as xl,p as QT,q as ek,r as Dl,s as $y,t as tk,u as sk,v as ok,w as ik,x as by,y as vc,z as nk,A as rk,B as ak,D as lk,E as ck,G as uk,H as j_,J as z_,K as U_,L as dk,N as hk,O as pk,P as gk,Q as mk,R as fk}from"./index-Cjl4b70e.js";import{g as hi,c as nn}from"./_commonjsHelpers-Cpj98o6Y.js";import{_ as mn}from"./preload-helper-BDBacUwf.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const u of l)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function i(l){const u={};return l.integrity&&(u.integrity=l.integrity),l.referrerPolicy&&(u.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?u.credentials="include":l.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function r(l){if(l.ep)return;l.ep=!0;const u=i(l);fetch(l.href,u)}})();var H_,vy=P_;H_=vy.createRoot,vy.hydrateRoot;var W_={exports:{}},nt={};/** @license React v17.0.2
3
+ * react-is.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var yc=60103,_c=60106,Or=60107,Mr=60108,Nr=60114,Lr=60109,Br=60110,Pr=60112,Fr=60113,Eg=60120,jr=60115,zr=60116,V_=60121,G_=60122,K_=60117,Y_=60129,J_=60131;if(typeof Symbol=="function"&&Symbol.for){var xt=Symbol.for;yc=xt("react.element"),_c=xt("react.portal"),Or=xt("react.fragment"),Mr=xt("react.strict_mode"),Nr=xt("react.profiler"),Lr=xt("react.provider"),Br=xt("react.context"),Pr=xt("react.forward_ref"),Fr=xt("react.suspense"),Eg=xt("react.suspense_list"),jr=xt("react.memo"),zr=xt("react.lazy"),V_=xt("react.block"),G_=xt("react.server.block"),K_=xt("react.fundamental"),Y_=xt("react.debug_trace_mode"),J_=xt("react.legacy_hidden")}function Cs(a){if(typeof a=="object"&&a!==null){var s=a.$$typeof;switch(s){case yc:switch(a=a.type,a){case Or:case Nr:case Mr:case Fr:case Eg:return a;default:switch(a=a&&a.$$typeof,a){case Br:case Pr:case zr:case jr:case Lr:return a;default:return s}}case _c:return s}}}var $k=Lr,bk=yc,vk=Pr,yk=Or,_k=zr,wk=jr,Ck=_c,Tk=Nr,kk=Mr,Sk=Fr;nt.ContextConsumer=Br;nt.ContextProvider=$k;nt.Element=bk;nt.ForwardRef=vk;nt.Fragment=yk;nt.Lazy=_k;nt.Memo=wk;nt.Portal=Ck;nt.Profiler=Tk;nt.StrictMode=kk;nt.Suspense=Sk;nt.isAsyncMode=function(){return!1};nt.isConcurrentMode=function(){return!1};nt.isContextConsumer=function(a){return Cs(a)===Br};nt.isContextProvider=function(a){return Cs(a)===Lr};nt.isElement=function(a){return typeof a=="object"&&a!==null&&a.$$typeof===yc};nt.isForwardRef=function(a){return Cs(a)===Pr};nt.isFragment=function(a){return Cs(a)===Or};nt.isLazy=function(a){return Cs(a)===zr};nt.isMemo=function(a){return Cs(a)===jr};nt.isPortal=function(a){return Cs(a)===_c};nt.isProfiler=function(a){return Cs(a)===Nr};nt.isStrictMode=function(a){return Cs(a)===Mr};nt.isSuspense=function(a){return Cs(a)===Fr};nt.isValidElementType=function(a){return typeof a=="string"||typeof a=="function"||a===Or||a===Nr||a===Y_||a===Mr||a===Fr||a===Eg||a===J_||typeof a=="object"&&a!==null&&(a.$$typeof===zr||a.$$typeof===jr||a.$$typeof===Lr||a.$$typeof===Br||a.$$typeof===Pr||a.$$typeof===K_||a.$$typeof===V_||a[0]===G_)};nt.typeOf=Cs;W_.exports=nt;var Ek=W_.exports;function Jl(a,s){const i=getComputedStyle(s);if(!i)return;let r=a===ut.Horizontal?s.clientWidth:s.clientHeight;return r!==0?(a===ut.Horizontal?r-=parseFloat(i.paddingLeft)+parseFloat(i.paddingRight):r-=parseFloat(i.paddingTop)+parseFloat(i.paddingBottom),r):void 0}/*! *****************************************************************************
10
+ Copyright (c) Microsoft Corporation.
11
+
12
+ Permission to use, copy, modify, and/or distribute this software for any
13
+ purpose with or without fee is hereby granted.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
16
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
17
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
18
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
19
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
20
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21
+ PERFORMANCE OF THIS SOFTWARE.
22
+ ***************************************************************************** */function Al(a,s,i=[],r={condition:!0}){const{condition:l}=r,u=(function(d,p){var m={};for(var f in d)Object.prototype.hasOwnProperty.call(d,f)&&p.indexOf(f)<0&&(m[f]=d[f]);if(d!=null&&typeof Object.getOwnPropertySymbols=="function"){var v=0;for(f=Object.getOwnPropertySymbols(d);v<f.length;v++)p.indexOf(f[v])<0&&Object.prototype.propertyIsEnumerable.call(d,f[v])&&(m[f[v]]=d[f[v]])}return m})(r,["condition"]);H.useEffect((()=>(l&&window.addEventListener(a,s,u),()=>{l&&window.removeEventListener(a,s)})),[a,s,l,...i])}(function(a,s){s===void 0&&(s={});var i=s.insertAt;if(typeof document<"u"){var r=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css",i==="top"&&r.firstChild?r.insertBefore(l,r.firstChild):r.appendChild(l),l.styleSheet?l.styleSheet.cssText=a:l.appendChild(document.createTextNode(a))}})(`/* === Main Container === */
23
+ .__dbk__container {
24
+ height: 100%;
25
+ width: 100%;
26
+
27
+ display: flex;
28
+ overflow: hidden;
29
+ }
30
+
31
+ .__dbk__container.Horizontal {
32
+ flex-direction: row;
33
+ }
34
+
35
+ .__dbk__container.Vertical {
36
+ flex-direction: column;
37
+ }
38
+ /* ====== */
39
+
40
+ /* === Wrapper for each child element === */
41
+ .__dbk__child-wrapper {
42
+ height: 100%;
43
+ width: 100%;
44
+ }
45
+ /* ====== */
46
+
47
+ /* === Gutter === */
48
+ .__dbk__gutter {
49
+ display: flex;
50
+ align-items: center;
51
+ justify-content: center;
52
+ }
53
+ /* .__dbk__gutter > div {
54
+ background: red;
55
+ } */
56
+ .__dbk__gutter.Horizontal {
57
+ height: 100%;
58
+ padding: 0 2px;
59
+ flex-direction: column;
60
+ }
61
+ .__dbk__gutter.Horizontal:hover {
62
+ cursor: col-resize;
63
+ }
64
+
65
+ .__dbk__gutter.Vertical {
66
+ width: 100%;
67
+ padding: 2px 0;
68
+ flex-direction: row;
69
+ }
70
+ .__dbk__gutter.Vertical:hover {
71
+ cursor: row-resize;
72
+ }
73
+
74
+ .__dbk__gutter.Light {
75
+ background: #EDF0EF;
76
+ }
77
+ .__dbk__gutter.Light:hover > .__dbk__dragger {
78
+ background: #76747B;
79
+ }
80
+
81
+ .__dbk__gutter.Dark {
82
+ background: #020203;
83
+ }
84
+ .__dbk__gutter.Dark:hover > .__dbk__dragger {
85
+ background: #9995A3;
86
+ }
87
+ /* ====== */
88
+
89
+ /* === Gutter's Dragger === */
90
+ .__dbk__dragger {
91
+ border-radius: 2px;
92
+ }
93
+
94
+ .__dbk__dragger.Horizontal {
95
+ width: 4px;
96
+ height: 24px;
97
+ }
98
+
99
+ .__dbk__dragger.Vertical {
100
+ width: 24px;
101
+ height: 4px;
102
+ }
103
+
104
+ .__dbk__dragger.Light {
105
+ background: #A6ACB5;
106
+ }
107
+
108
+ .__dbk__dragger.Dark {
109
+ background: #434252;
110
+ }
111
+ /* ====== */`);const Ik=X.forwardRef((({className:a,theme:s,draggerClassName:i,direction:r=ut.Vertical,onDragging:l},u)=>{const d=`__dbk__gutter ${r} ${a||s}`,p=`__dbk__dragger ${r} ${i||s}`;return g.jsx("div",Object.assign({className:d,ref:u,dir:r,onMouseDown:l,onTouchStart:Ul?l:void 0},{children:g.jsx("div",{className:p},void 0)}),void 0)}));var us;function eg(a,s,i){let r,l;return s?(r=a/2,l=a):i?(r=a,l=a/2):(r=a,l=a),{aGutterSize:r,bGutterSize:l}}function xk(a,s){switch(s.type){case us.SetIsReadyToCompute:return Object.assign(Object.assign({},a),{isReady:s.payload.isReady});case us.CreatePairs:{const{direction:i,children:r,gutters:l}=s.payload,u=r[0].parentNode;if(!u)throw new Error("Cannot create pairs - parent is undefined.");const d=Jl(i,u);if(d===void 0)throw new Error(`Cannot create pairs - parent has undefined or zero size: ${d}.`);const p=[];return r.forEach(((m,f)=>{if(f>0){const v=r[f-1],w=r[f],_=l[f-1],k=i===ut.Horizontal?v.getBoundingClientRect().left:v.getBoundingClientRect().top,S=i===ut.Horizontal?w.getBoundingClientRect().right:w.getBoundingClientRect().bottom,C=i===ut.Horizontal?v.getBoundingClientRect().width+_.getBoundingClientRect().width+w.getBoundingClientRect().width:v.getBoundingClientRect().height+_.getBoundingClientRect().height+w.getBoundingClientRect().height,I=i===ut.Horizontal?_.getBoundingClientRect().width:_.getBoundingClientRect().height,O={idx:f-1,a:v,b:w,gutter:_,parent:u,start:k,end:S,size:C,gutterSize:I,aSizePct:100/r.length,bSizePct:100/r.length};p.push(O)}})),Object.assign(Object.assign({},a),{pairs:p})}case us.StartDragging:{const{gutterIdx:i}=s.payload;return Object.assign(Object.assign({},a),{isDragging:!0,draggingIdx:i})}case us.StopDragging:return Object.assign(Object.assign({},a),{isDragging:!1});case us.CalculateSizes:{const{direction:i,gutterIdx:r}=s.payload,l=a.pairs[r],u=Jl(i,l.parent);if(!u)throw new Error("Cannot calculate sizes - 'pair.parent' has undefined or zero size.");const d=l.gutter[i===ut.Horizontal?"clientWidth":"clientHeight"],p=r===0,m=r===a.pairs.length-1,{aGutterSize:f,bGutterSize:v}=eg(d,p,m);let w,_,k,S,C;return i===ut.Horizontal?(w=l.a.getBoundingClientRect().left,_=l.b.getBoundingClientRect().right,S=(l.a.getBoundingClientRect().width+f)/u*100,C=(l.b.getBoundingClientRect().width+v)/u*100,k=l.a.getBoundingClientRect().width+f+v+l.b.getBoundingClientRect().width):(w=l.a.getBoundingClientRect().top,_=l.b.getBoundingClientRect().bottom,S=(l.a.getBoundingClientRect().height+f)/u*100,C=(l.b.getBoundingClientRect().height+v)/u*100,k=l.a.getBoundingClientRect().height+f+v+l.b.getBoundingClientRect().height),a.pairs[r]=Object.assign(Object.assign({},l),{start:w,end:_,size:k,aSizePct:S,bSizePct:C,gutterSize:d}),Object.assign({},a)}default:return a}}function X_(a,s=0,i=[]){return H.Children.toArray(a).reduce(((r,l,u)=>(Ek.isFragment(l)?r.push.apply(r,X_(l.props.children,s+1,i.concat(l.key||u))):H.isValidElement(l)?r.push(H.cloneElement(l,{key:i.concat(String(l.key)).join(".")})):typeof l!="string"&&typeof l!="number"||r.push(l),r)),[])}(function(a){a[a.SetIsReadyToCompute=0]="SetIsReadyToCompute",a[a.CreatePairs=1]="CreatePairs",a[a.CalculateSizes=2]="CalculateSizes",a[a.StartDragging=3]="StartDragging",a[a.StopDragging=4]="StopDragging"})(us||(us={}));const yy=a=>"changedTouches"in a;var ut,tg;(function(a){a.Horizontal="Horizontal",a.Vertical="Vertical"})(ut||(ut={})),(function(a){a.Light="Light",a.Dark="Dark"})(tg||(tg={}));const Ul=typeof window<"u"&&"ontouchstart"in window;function Cp(a){return a===ut.Horizontal?"col-resize":"row-resize"}const Dk={isReady:!1,isDragging:!1,pairs:[]};function _y({direction:a=ut.Horizontal,minWidths:s=[],minHeights:i=[],initialSizes:r,gutterTheme:l=tg.Dark,gutterClassName:u,draggerClassName:d,children:p,onResizeStarted:m,onResizeFinished:f,classes:v=[]}){const w=X_(p),[_,k]=H.useReducer(xk,Dk),S=H.useRef(null),C=H.useRef([]),I=H.useRef([]);C.current=[],I.current=[];const O=X.useCallback((ce=>{k({type:us.SetIsReadyToCompute,payload:{isReady:ce}})}),[]),A=X.useCallback(((ce,de)=>{k({type:us.StartDragging,payload:{gutterIdx:de}});const J=_.pairs[de];m==null||m(J.idx),J.a.style.userSelect="none",J.b.style.userSelect="none",J.gutter.style.cursor=Cp(ce),J.parent.style.cursor=Cp(ce),document.body.style.cursor=Cp(ce)}),[_.pairs]),R=X.useCallback((()=>{k({type:us.StopDragging});const ce=[];for(let J=0;J<_.pairs.length;J++){const we=_.pairs[J],ge=Jl(a,we.parent);if(ge===void 0)throw new Error("Cannot call the 'onResizeFinished' callback - parentSize is undefined");if(we.gutterSize===void 0)throw new Error("Cannot call 'onResizeFinished' callback - gutterSize is undefined");const Fe=J===0,Y=J===_.pairs.length-1,et=we.a.getBoundingClientRect()[a===ut.Horizontal?"width":"height"],{aGutterSize:Z,bGutterSize:se}=eg(we.gutterSize,Fe,Y),F=(et+Z)/ge*100;if(ce.push(F),Y){const V=(we.b.getBoundingClientRect()[a===ut.Horizontal?"width":"height"]+se)/ge*100;ce.push(V)}}if(_.draggingIdx===void 0)throw new Error("Could not reset cursor and user-select because 'state.draggingIdx' is undefined");const de=_.pairs[_.draggingIdx];f==null||f(de.idx,ce),de.a.style.userSelect="",de.b.style.userSelect="",de.gutter.style.cursor="",de.parent.style.cursor="",document.body.style.cursor=""}),[_.draggingIdx,_.pairs,a]),q=X.useCallback(((ce,de)=>{k({type:us.CalculateSizes,payload:{direction:ce,gutterIdx:de}})}),[]),re=X.useCallback(((ce,de,J)=>{k({type:us.CreatePairs,payload:{direction:ce,children:de,gutters:J}})}),[]),ie=X.useCallback(((ce,de,J,we)=>{const ge=de[0].parentNode;if(!ge)throw new Error("Cannot set initial sizes - parent is undefined");if(Jl(ce,ge)===void 0)throw new Error("Cannot set initial sizes - parent has undefined size");de.forEach(((Fe,Y)=>{const et=Y===0,Z=Y===de.length-1;let se,F=0;de.length>1&&(F=J[Z?Y-1:Y].getBoundingClientRect()[ce===ut.Horizontal?"width":"height"],F=et||Z?F/2:F),se=we&&Y<we.length?`calc(${we[Y]}% - ${F}px)`:`calc(${100/de.length}% - ${F}px)`,ce===ut.Horizontal?(Fe.style.width=se,Fe.style.height="100%"):(Fe.style.height=se,Fe.style.width="100%")}))}),[]),$e=X.useCallback(((ce,de)=>{if(_.draggingIdx===void 0)throw new Error("Cannot adjust size - 'draggingIdx' is undefined");const J=_.pairs[_.draggingIdx];if(J.size===void 0)throw new Error("Cannot adjust size - 'pair.size' is undefined");if(J.gutterSize===void 0)throw new Error("Cannot adjust size - 'pair.gutterSize' is undefined");const we=J.aSizePct+J.bSizePct,ge=de/J.size*we,Fe=we-de/J.size*we,Y=_.draggingIdx===0,et=_.draggingIdx===_.pairs.length-1,{aGutterSize:Z,bGutterSize:se}=eg(J.gutterSize,Y,et),F=`calc(${ge}% - ${Z}px)`,V=`calc(${Fe}% - ${se}px)`;ce===ut.Horizontal?(J.a.style.width=F,J.b.style.width=V):(J.a.style.height=F,J.b.style.height=V)}),[_.draggingIdx,_.pairs,a]),U=X.useCallback(((ce,de,J)=>{if(!_.isDragging)return;if(_.draggingIdx===void 0)throw new Error("Cannot drag - 'draggingIdx' is undefined");const we=_.pairs[_.draggingIdx];if(we.start===void 0)throw new Error("Cannot drag - 'pair.start' is undefined");if(we.size===void 0)throw new Error("Cannot drag - 'pair.size' is undefined");if(we.gutterSize===void 0)throw new Error("Cannot drag - 'pair.gutterSize' is undefined");let ge=(function(et,Z){const se=yy(Z)?Z.changedTouches[0]:Z;return et===ut.Horizontal?se.clientX:se.clientY})(de,ce)-we.start,Fe=16,Y=16;J.length>_.draggingIdx&&(Fe=J[_.draggingIdx]),J.length>=_.draggingIdx+1&&(Y=J[_.draggingIdx+1]),ge<we.gutterSize+Fe&&(ge=we.gutterSize+Fe),ge>=we.size-(we.gutterSize+Y)&&(ge=we.size-(we.gutterSize+Y)),$e(de,ge)}),[_.isDragging,_.draggingIdx,_.pairs,$e]),Me=()=>{if(_.isDragging){if(_.draggingIdx===void 0)throw new Error("Cannot calculate sizes after dragging = 'state.draggingIdx' is undefined");q(a,_.draggingIdx),R()}},Ne=ce=>{_.isDragging&&(yy(ce)&&ce.preventDefault(),U(ce,a,a===ut.Horizontal?s:i))};function qe(ce,de){if(!ce.current)throw new Error("Can't add element to ref object - ref isn't initialized");de&&!ce.current.includes(de)&&ce.current.push(de)}return Al("mouseup",Me,[_.isDragging,R]),Al("mousemove",Ne,[a,_.isDragging,U,s,i]),Al("touchend",Me,[_.isDragging,R],{condition:Ul}),Al("touchmove",Ne,[a,_.isDragging,U,s,i],{condition:Ul,passive:!Ul}),H.useEffect((function(){if(!S.current)return;const ce=S.current.parentElement;if(!ce)return;const de=new ResizeObserver((()=>{const J=getComputedStyle(ce),we=a===ut.Horizontal?ce.clientWidth:ce.clientHeight;O(!!J&&!!we)}));return de.observe(ce),()=>{de.disconnect()}}),[S.current,a]),H.useEffect((function(){if(_.isReady&&(!C.current||C.current[0].offsetParent)){if(!C.current||!I.current)throw new Error("Cannot create pairs - either variable 'childRefs' or 'gutterRefs' is undefined");w.length<=1?ie(a,C.current,I.current,r):(ie(a,C.current,I.current,r),re(a,C.current,I.current))}}),[p,_.isReady,a,ie,re,r]),g.jsx("div",Object.assign({className:`__dbk__container ${a}`,ref:S},{children:_.isReady&&w.map(((ce,de)=>g.jsxs(X.Fragment,{children:[g.jsx("div",Object.assign({ref:J=>qe(C,J),className:"__dbk__child-wrapper "+(de<v.length?v[de]:"")},{children:ce}),void 0),de<w.length-1&&g.jsx(Ik,{ref:J=>qe(I,J),className:u,theme:l,draggerClassName:d,direction:a,onDragging:()=>{return q(a,J=de),void A(a,J);var J}},void 0)]},de)))}),void 0)}const Ak=dt([g.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),g.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"AccessTime"),Rk=dt(g.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox"),Ok=dt(g.jsx("path",{d:"M4 8h4V4H4zm6 12h4v-4h-4zm-6 0h4v-4H4zm0-6h4v-4H4zm6 0h4v-4h-4zm6-10v4h4V4zm-6 4h4V4h-4zm6 6h4v-4h-4zm0 6h4v-4h-4z"}),"Apps"),Mk=dt(g.jsx("path",{d:"M9 2c-1.05 0-2.05.16-3 .46 4.06 1.27 7 5.06 7 9.54s-2.94 8.27-7 9.54c.95.3 1.95.46 3 .46 5.52 0 10-4.48 10-10S14.52 2 9 2"}),"Brightness3"),Nk=dt(g.jsx("path",{d:"M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5s-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20zm-6 8h-4v-2h4zm0-4h-4v-2h4z"}),"BugReport"),Lk=dt(g.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2zm-1 7h5.5L14 6.5z"}),"FileCopy"),Bk=dt(g.jsx("path",{d:"M7 2v11h3v9l7-12h-4l4-8z"}),"FlashOn"),Pk=dt(g.jsx("path",{d:"M3.27 5 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21 18 19.73 3.55 5.27zM6 5v.18L8.82 8h2.4l-.72 1.68 2.1 2.1L14.21 8H20V5z"}),"FormatClear"),Fk=dt(g.jsx("path",{d:"M18 4H6v2l6.5 6L6 18v2h12v-3h-7l5-5-5-5h7z"}),"Functions"),q_=dt(g.jsx("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutline"),jk=dt(g.jsx("path",{d:"M21 3.01H3c-1.1 0-2 .9-2 2V9h2V4.99h18v14.03H3V15H1v4.01c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98v-14c0-1.11-.9-2-2-2M11 16l4-4-4-4v3H1v2h10z"}),"Input"),wy=dt(g.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1z"}),"Lock"),zk=dt(g.jsx("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert"),Uk=dt(g.jsx("path",{d:"M12 2C6.49 2 2 6.49 2 12s4.49 10 10 10c1.38 0 2.5-1.12 2.5-2.5 0-.61-.23-1.2-.64-1.67-.08-.1-.13-.21-.13-.33 0-.28.22-.5.5-.5H16c3.31 0 6-2.69 6-6 0-4.96-4.49-9-10-9m5.5 11c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m-3-4c-.83 0-1.5-.67-1.5-1.5S13.67 6 14.5 6s1.5.67 1.5 1.5S15.33 9 14.5 9M5 11.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5S7.33 13 6.5 13 5 12.33 5 11.5m6-4c0 .83-.67 1.5-1.5 1.5S8 8.33 8 7.5 8.67 6 9.5 6s1.5.67 1.5 1.5"}),"Palette"),Hl=dt(g.jsx("path",{d:"M6 19h4V5H6zm8-14v14h4V5z"}),"Pause"),sg=dt(g.jsx("path",{d:"M8 5v14l11-7z"}),"PlayArrow"),Hk=dt(g.jsx("path",{d:"M11 5v5.59H7.5l4.5 4.5 4.5-4.5H13V5zm-5 9c0 3.31 2.69 6 6 6s6-2.69 6-6h-2c0 2.21-1.79 4-4 4s-4-1.79-4-4z"}),"PlayForWork"),Wk=dt(g.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"Search"),Vk=dt(g.jsx("path",{d:"M10.59 9.17 5.41 4 4 5.41l5.17 5.17zM14.5 4l2.04 2.04L4 18.59 5.41 20 17.96 7.46 20 9.5V4zm.33 9.41-1.41 1.41 3.13 3.13L14.5 20H20v-5.5l-2.04 2.04z"}),"Shuffle"),Gk=dt(g.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"}),"Storage"),Kk=dt(g.jsx("path",{d:"M14 17H4v2h10zm6-8H4v2h16zM4 15h16v-2H4zM4 5v2h16V5z"}),"Subject"),Yk=dt(g.jsx("path",{d:"M16 17.01V10h-2v7.01h-3L15 21l4-3.99zM9 3 5 6.99h3V14h2V6.99h3z"}),"SwapVert"),Jk=dt(g.jsx("path",{d:"M7.41 18.59 8.83 20 12 16.83 15.17 20l1.41-1.41L12 14zm9.18-13.18L15.17 4 12 7.17 8.83 4 7.41 5.41 12 10z"}),"UnfoldLess"),Xk=dt(g.jsx("path",{d:"M12 5.83 15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15z"}),"UnfoldMore"),{loadShare:qk}=MT,{initPromise:Zk}=OT,Qk=Zk.then(a=>qk("@iobroker/adapter-react-v5",{customShareInfo:{shareConfig:{singleton:!0,strictVersion:!1,requiredVersion:"*"}}})),eS=await Qk.then(a=>a());var b=eS;const Z_=H.createContext({dragDropManager:void 0});function Ir(a){"@babel/helpers - typeof";return Ir=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},Ir(a)}function tS(a,s){if(Ir(a)!="object"||!a)return a;var i=a[Symbol.toPrimitive];if(i!==void 0){var r=i.call(a,s);if(Ir(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}function sS(a){var s=tS(a,"string");return Ir(s)=="symbol"?s:s+""}function oS(a,s,i){return(s=sS(s))in a?Object.defineProperty(a,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[s]=i,a}function rs(a){return"Minified Redux error #"+a+"; visit https://redux.js.org/Errors?code="+a+" for the full message or use the non-minified dev environment for full errors. "}var Cy=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),Ty=function(){return Math.random().toString(36).substring(7).split("").join(".")},ky={INIT:"@@redux/INIT"+Ty(),REPLACE:"@@redux/REPLACE"+Ty()};function iS(a){if(typeof a!="object"||a===null)return!1;for(var s=a;Object.getPrototypeOf(s)!==null;)s=Object.getPrototypeOf(s);return Object.getPrototypeOf(a)===s}function Q_(a,s,i){var r;if(typeof s=="function"&&typeof i=="function"||typeof i=="function"&&typeof arguments[3]=="function")throw new Error(rs(0));if(typeof s=="function"&&typeof i>"u"&&(i=s,s=void 0),typeof i<"u"){if(typeof i!="function")throw new Error(rs(1));return i(Q_)(a,s)}if(typeof a!="function")throw new Error(rs(2));var l=a,u=s,d=[],p=d,m=!1;function f(){p===d&&(p=d.slice())}function v(){if(m)throw new Error(rs(3));return u}function w(C){if(typeof C!="function")throw new Error(rs(4));if(m)throw new Error(rs(5));var I=!0;return f(),p.push(C),function(){if(I){if(m)throw new Error(rs(6));I=!1,f();var A=p.indexOf(C);p.splice(A,1),d=null}}}function _(C){if(!iS(C))throw new Error(rs(7));if(typeof C.type>"u")throw new Error(rs(8));if(m)throw new Error(rs(9));try{m=!0,u=l(u,C)}finally{m=!1}for(var I=d=p,O=0;O<I.length;O++){var A=I[O];A()}return C}function k(C){if(typeof C!="function")throw new Error(rs(10));l=C,_({type:ky.REPLACE})}function S(){var C,I=w;return C={subscribe:function(A){if(typeof A!="object"||A===null)throw new Error(rs(11));function R(){A.next&&A.next(v())}R();var q=I(R);return{unsubscribe:q}}},C[Cy]=function(){return this},C}return _({type:ky.INIT}),r={dispatch:_,subscribe:w,getState:v,replaceReducer:k},r[Cy]=S,r}function De(a,s,...i){if(nS()&&s===void 0)throw new Error("invariant requires an error message argument");if(!a){let r;if(s===void 0)r=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let l=0;r=new Error(s.replace(/%s/g,function(){return i[l++]})),r.name="Invariant Violation"}throw r.framesToPop=1,r}}function nS(){return typeof process<"u"&&!0}function rS(a,s,i){return s.split(".").reduce((r,l)=>r&&r[l]?r[l]:i||null,a)}function aS(a,s){return a.filter(i=>i!==s)}function ew(a){return typeof a=="object"}function lS(a,s){const i=new Map,r=u=>{i.set(u,i.has(u)?i.get(u)+1:1)};a.forEach(r),s.forEach(r);const l=[];return i.forEach((u,d)=>{u===1&&l.push(d)}),l}function cS(a,s){return a.filter(i=>s.indexOf(i)>-1)}const Ig="dnd-core/INIT_COORDS",wc="dnd-core/BEGIN_DRAG",xg="dnd-core/PUBLISH_DRAG_SOURCE",Cc="dnd-core/HOVER",Tc="dnd-core/DROP",kc="dnd-core/END_DRAG";function Sy(a,s){return{type:Ig,payload:{sourceClientOffset:s||null,clientOffset:a||null}}}const uS={type:Ig,payload:{clientOffset:null,sourceClientOffset:null}};function dS(a){return function(i=[],r={publishSource:!0}){const{publishSource:l=!0,clientOffset:u,getSourceClientOffset:d}=r,p=a.getMonitor(),m=a.getRegistry();a.dispatch(Sy(u)),hS(i,p,m);const f=mS(i,p);if(f==null){a.dispatch(uS);return}let v=null;if(u){if(!d)throw new Error("getSourceClientOffset must be defined");pS(d),v=d(f)}a.dispatch(Sy(u,v));const _=m.getSource(f).beginDrag(p,f);if(_==null)return;gS(_),m.pinSource(f);const k=m.getSourceType(f);return{type:wc,payload:{itemType:k,item:_,sourceId:f,clientOffset:u||null,sourceClientOffset:v||null,isSourcePublic:!!l}}}}function hS(a,s,i){De(!s.isDragging(),"Cannot call beginDrag while dragging."),a.forEach(function(r){De(i.getSource(r),"Expected sourceIds to be registered.")})}function pS(a){De(typeof a=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function gS(a){De(ew(a),"Item must be an object.")}function mS(a,s){let i=null;for(let r=a.length-1;r>=0;r--)if(s.canDragSource(a[r])){i=a[r];break}return i}function fS(a,s,i){return s in a?Object.defineProperty(a,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[s]=i,a}function $S(a){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{},r=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable}))),r.forEach(function(l){fS(a,l,i[l])})}return a}function bS(a){return function(i={}){const r=a.getMonitor(),l=a.getRegistry();vS(r),wS(r).forEach((d,p)=>{const m=yS(d,p,l,r),f={type:Tc,payload:{dropResult:$S({},i,m)}};a.dispatch(f)})}}function vS(a){De(a.isDragging(),"Cannot call drop while not dragging."),De(!a.didDrop(),"Cannot call drop twice during one drag operation.")}function yS(a,s,i,r){const l=i.getTarget(a);let u=l?l.drop(r,a):void 0;return _S(u),typeof u>"u"&&(u=s===0?{}:r.getDropResult()),u}function _S(a){De(typeof a>"u"||ew(a),"Drop result must either be an object or undefined.")}function wS(a){const s=a.getTargetIds().filter(a.canDropOnTarget,a);return s.reverse(),s}function CS(a){return function(){const i=a.getMonitor(),r=a.getRegistry();TS(i);const l=i.getSourceId();return l!=null&&(r.getSource(l,!0).endDrag(i,l),r.unpinSource()),{type:kc}}}function TS(a){De(a.isDragging(),"Cannot call endDrag while not dragging.")}function og(a,s){return s===null?a===null:Array.isArray(a)?a.some(i=>i===s):a===s}function kS(a){return function(i,{clientOffset:r}={}){SS(i);const l=i.slice(0),u=a.getMonitor(),d=a.getRegistry(),p=u.getItemType();return IS(l,d,p),ES(l,u,d),xS(l,u,d),{type:Cc,payload:{targetIds:l,clientOffset:r||null}}}}function SS(a){De(Array.isArray(a),"Expected targetIds to be an array.")}function ES(a,s,i){De(s.isDragging(),"Cannot call hover while not dragging."),De(!s.didDrop(),"Cannot call hover after drop.");for(let r=0;r<a.length;r++){const l=a[r];De(a.lastIndexOf(l)===r,"Expected targetIds to be unique in the passed array.");const u=i.getTarget(l);De(u,"Expected targetIds to be registered.")}}function IS(a,s,i){for(let r=a.length-1;r>=0;r--){const l=a[r],u=s.getTargetType(l);og(u,i)||a.splice(r,1)}}function xS(a,s,i){a.forEach(function(r){i.getTarget(r).hover(s,r)})}function DS(a){return function(){if(a.getMonitor().isDragging())return{type:xg}}}function AS(a){return{beginDrag:dS(a),publishDragSource:DS(a),hover:kS(a),drop:bS(a),endDrag:CS(a)}}class RS{receiveBackend(s){this.backend=s}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const s=this,{dispatch:i}=this.store;function r(u){return(...d)=>{const p=u.apply(s,d);typeof p<"u"&&i(p)}}const l=AS(this);return Object.keys(l).reduce((u,d)=>{const p=l[d];return u[d]=r(p),u},{})}dispatch(s){this.store.dispatch(s)}constructor(s,i){this.isSetUp=!1,this.handleRefCountChange=()=>{const r=this.store.getState().refCount>0;this.backend&&(r&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!r&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=s,this.monitor=i,s.subscribe(this.handleRefCountChange)}}function OS(a,s){return{x:a.x+s.x,y:a.y+s.y}}function tw(a,s){return{x:a.x-s.x,y:a.y-s.y}}function MS(a){const{clientOffset:s,initialClientOffset:i,initialSourceClientOffset:r}=a;return!s||!i||!r?null:tw(OS(s,r),i)}function NS(a){const{clientOffset:s,initialClientOffset:i}=a;return!s||!i?null:tw(s,i)}const wr=[],Dg=[];wr.__IS_NONE__=!0;Dg.__IS_ALL__=!0;function LS(a,s){return a===wr?!1:a===Dg||typeof s>"u"?!0:cS(s,a).length>0}class BS{subscribeToStateChange(s,i={}){const{handlerIds:r}=i;De(typeof s=="function","listener must be a function."),De(typeof r>"u"||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");let l=this.store.getState().stateId;const u=()=>{const d=this.store.getState(),p=d.stateId;try{p===l||p===l+1&&!LS(d.dirtyHandlerIds,r)||s()}finally{l=p}};return this.store.subscribe(u)}subscribeToOffsetChange(s){De(typeof s=="function","listener must be a function.");let i=this.store.getState().dragOffset;const r=()=>{const l=this.store.getState().dragOffset;l!==i&&(i=l,s())};return this.store.subscribe(r)}canDragSource(s){if(!s)return!1;const i=this.registry.getSource(s);return De(i,`Expected to find a valid source. sourceId=${s}`),this.isDragging()?!1:i.canDrag(this,s)}canDropOnTarget(s){if(!s)return!1;const i=this.registry.getTarget(s);if(De(i,`Expected to find a valid target. targetId=${s}`),!this.isDragging()||this.didDrop())return!1;const r=this.registry.getTargetType(s),l=this.getItemType();return og(r,l)&&i.canDrop(this,s)}isDragging(){return!!this.getItemType()}isDraggingSource(s){if(!s)return!1;const i=this.registry.getSource(s,!0);if(De(i,`Expected to find a valid source. sourceId=${s}`),!this.isDragging()||!this.isSourcePublic())return!1;const r=this.registry.getSourceType(s),l=this.getItemType();return r!==l?!1:i.isDragging(this,s)}isOverTarget(s,i={shallow:!1}){if(!s)return!1;const{shallow:r}=i;if(!this.isDragging())return!1;const l=this.registry.getTargetType(s),u=this.getItemType();if(u&&!og(l,u))return!1;const d=this.getTargetIds();if(!d.length)return!1;const p=d.indexOf(s);return r?p===d.length-1:p>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return MS(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return NS(this.store.getState().dragOffset)}constructor(s,i){this.store=s,this.registry=i}}const Ey=typeof global<"u"?global:self,sw=Ey.MutationObserver||Ey.WebKitMutationObserver;function ow(a){return function(){const i=setTimeout(l,0),r=setInterval(l,50);function l(){clearTimeout(i),clearInterval(r),a()}}}function PS(a){let s=1;const i=new sw(a),r=document.createTextNode("");return i.observe(r,{characterData:!0}),function(){s=-s,r.data=s}}const FS=typeof sw=="function"?PS:ow;class jS{enqueueTask(s){const{queue:i,requestFlush:r}=this;i.length||(r(),this.flushing=!0),i[i.length]=s}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:s}=this;for(;this.index<s.length;){const i=this.index;if(this.index++,s[i].call(),this.index>this.capacity){for(let r=0,l=s.length-this.index;r<l;r++)s[r]=s[r+this.index];s.length-=this.index,this.index=0}}s.length=0,this.index=0,this.flushing=!1},this.registerPendingError=s=>{this.pendingErrors.push(s),this.requestErrorThrow()},this.requestFlush=FS(this.flush),this.requestErrorThrow=ow(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class zS{call(){try{this.task&&this.task()}catch(s){this.onError(s)}finally{this.task=null,this.release(this)}}constructor(s,i){this.onError=s,this.release=i,this.task=null}}class US{create(s){const i=this.freeTasks,r=i.length?i.pop():new zS(this.onError,l=>i[i.length]=l);return r.task=s,r}constructor(s){this.onError=s,this.freeTasks=[]}}const iw=new jS,HS=new US(iw.registerPendingError);function WS(a){iw.enqueueTask(HS.create(a))}const Ag="dnd-core/ADD_SOURCE",Rg="dnd-core/ADD_TARGET",Og="dnd-core/REMOVE_SOURCE",Sc="dnd-core/REMOVE_TARGET";function VS(a){return{type:Ag,payload:{sourceId:a}}}function GS(a){return{type:Rg,payload:{targetId:a}}}function KS(a){return{type:Og,payload:{sourceId:a}}}function YS(a){return{type:Sc,payload:{targetId:a}}}function JS(a){De(typeof a.canDrag=="function","Expected canDrag to be a function."),De(typeof a.beginDrag=="function","Expected beginDrag to be a function."),De(typeof a.endDrag=="function","Expected endDrag to be a function.")}function XS(a){De(typeof a.canDrop=="function","Expected canDrop to be a function."),De(typeof a.hover=="function","Expected hover to be a function."),De(typeof a.drop=="function","Expected beginDrag to be a function.")}function ig(a,s){if(s&&Array.isArray(a)){a.forEach(i=>ig(i,!1));return}De(typeof a=="string"||typeof a=="symbol",s?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var cs;(function(a){a.SOURCE="SOURCE",a.TARGET="TARGET"})(cs||(cs={}));let qS=0;function ZS(){return qS++}function QS(a){const s=ZS().toString();switch(a){case cs.SOURCE:return`S${s}`;case cs.TARGET:return`T${s}`;default:throw new Error(`Unknown Handler Role: ${a}`)}}function Iy(a){switch(a[0]){case"S":return cs.SOURCE;case"T":return cs.TARGET;default:throw new Error(`Cannot parse handler ID: ${a}`)}}function xy(a,s){const i=a.entries();let r=!1;do{const{done:l,value:[,u]}=i.next();if(u===s)return!0;r=!!l}while(!r);return!1}class eE{addSource(s,i){ig(s),JS(i);const r=this.addHandler(cs.SOURCE,s,i);return this.store.dispatch(VS(r)),r}addTarget(s,i){ig(s,!0),XS(i);const r=this.addHandler(cs.TARGET,s,i);return this.store.dispatch(GS(r)),r}containsHandler(s){return xy(this.dragSources,s)||xy(this.dropTargets,s)}getSource(s,i=!1){return De(this.isSourceId(s),"Expected a valid source ID."),i&&s===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(s)}getTarget(s){return De(this.isTargetId(s),"Expected a valid target ID."),this.dropTargets.get(s)}getSourceType(s){return De(this.isSourceId(s),"Expected a valid source ID."),this.types.get(s)}getTargetType(s){return De(this.isTargetId(s),"Expected a valid target ID."),this.types.get(s)}isSourceId(s){return Iy(s)===cs.SOURCE}isTargetId(s){return Iy(s)===cs.TARGET}removeSource(s){De(this.getSource(s),"Expected an existing source."),this.store.dispatch(KS(s)),WS(()=>{this.dragSources.delete(s),this.types.delete(s)})}removeTarget(s){De(this.getTarget(s),"Expected an existing target."),this.store.dispatch(YS(s)),this.dropTargets.delete(s),this.types.delete(s)}pinSource(s){const i=this.getSource(s);De(i,"Expected an existing source."),this.pinnedSourceId=s,this.pinnedSource=i}unpinSource(){De(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(s,i,r){const l=QS(s);return this.types.set(l,i),s===cs.SOURCE?this.dragSources.set(l,r):s===cs.TARGET&&this.dropTargets.set(l,r),l}constructor(s){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=s}}const tE=(a,s)=>a===s;function sE(a,s){return!a&&!s?!0:!a||!s?!1:a.x===s.x&&a.y===s.y}function oE(a,s,i=tE){if(a.length!==s.length)return!1;for(let r=0;r<a.length;++r)if(!i(a[r],s[r]))return!1;return!0}function iE(a=wr,s){switch(s.type){case Cc:break;case Ag:case Rg:case Sc:case Og:return wr;case wc:case xg:case kc:case Tc:default:return Dg}const{targetIds:i=[],prevTargetIds:r=[]}=s.payload,l=lS(i,r);if(!(l.length>0||!oE(i,r)))return wr;const d=r[r.length-1],p=i[i.length-1];return d!==p&&(d&&l.push(d),p&&l.push(p)),l}function nE(a,s,i){return s in a?Object.defineProperty(a,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[s]=i,a}function rE(a){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{},r=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable}))),r.forEach(function(l){nE(a,l,i[l])})}return a}const Dy={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function aE(a=Dy,s){const{payload:i}=s;switch(s.type){case Ig:case wc:return{initialSourceClientOffset:i.sourceClientOffset,initialClientOffset:i.clientOffset,clientOffset:i.clientOffset};case Cc:return sE(a.clientOffset,i.clientOffset)?a:rE({},a,{clientOffset:i.clientOffset});case kc:case Tc:return Dy;default:return a}}function lE(a,s,i){return s in a?Object.defineProperty(a,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[s]=i,a}function Zi(a){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{},r=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable}))),r.forEach(function(l){lE(a,l,i[l])})}return a}const cE={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function uE(a=cE,s){const{payload:i}=s;switch(s.type){case wc:return Zi({},a,{itemType:i.itemType,item:i.item,sourceId:i.sourceId,isSourcePublic:i.isSourcePublic,dropResult:null,didDrop:!1});case xg:return Zi({},a,{isSourcePublic:!0});case Cc:return Zi({},a,{targetIds:i.targetIds});case Sc:return a.targetIds.indexOf(i.targetId)===-1?a:Zi({},a,{targetIds:aS(a.targetIds,i.targetId)});case Tc:return Zi({},a,{dropResult:i.dropResult,didDrop:!0,targetIds:[]});case kc:return Zi({},a,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return a}}function dE(a=0,s){switch(s.type){case Ag:case Rg:return a+1;case Og:case Sc:return a-1;default:return a}}function hE(a=0){return a+1}function pE(a,s,i){return s in a?Object.defineProperty(a,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[s]=i,a}function gE(a){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{},r=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable}))),r.forEach(function(l){pE(a,l,i[l])})}return a}function mE(a={},s){return{dirtyHandlerIds:iE(a.dirtyHandlerIds,{type:s.type,payload:gE({},s.payload,{prevTargetIds:rS(a,"dragOperation.targetIds",[])})}),dragOffset:aE(a.dragOffset,s),refCount:dE(a.refCount,s),dragOperation:uE(a.dragOperation,s),stateId:hE(a.stateId)}}function fE(a,s=void 0,i={},r=!1){const l=$E(r),u=new BS(l,new eE(l)),d=new RS(l,u),p=a(d,s,i);return d.receiveBackend(p),d}function $E(a){const s=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Q_(mE,a&&s&&s({name:"dnd-core",instanceId:"dnd-core"}))}function bE(a,s){if(a==null)return{};var i=vE(a,s),r,l;if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(a);for(l=0;l<u.length;l++)r=u[l],!(s.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(a,r)&&(i[r]=a[r])}return i}function vE(a,s){if(a==null)return{};var i={},r=Object.keys(a),l,u;for(u=0;u<r.length;u++)l=r[u],!(s.indexOf(l)>=0)&&(i[l]=a[l]);return i}let Ay=0;const Wl=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var nw=H.memo(function(s){var{children:i}=s,r=bE(s,["children"]);const[l,u]=yE(r);return H.useEffect(()=>{if(u){const d=rw();return++Ay,()=>{--Ay===0&&(d[Wl]=null)}}},[]),g.jsx(Z_.Provider,{value:l,children:i})});function yE(a){if("manager"in a)return[{dragDropManager:a.manager},!1];const s=_E(a.backend,a.context,a.options,a.debugMode),i=!a.context;return[s,i]}function _E(a,s=rw(),i,r){const l=s;return l[Wl]||(l[Wl]={dragDropManager:fE(a,s,i,r)}),l[Wl]}function rw(){return typeof global<"u"?global:window}var wE=function a(s,i){if(s===i)return!0;if(s&&i&&typeof s=="object"&&typeof i=="object"){if(s.constructor!==i.constructor)return!1;var r,l,u;if(Array.isArray(s)){if(r=s.length,r!=i.length)return!1;for(l=r;l--!==0;)if(!a(s[l],i[l]))return!1;return!0}if(s.constructor===RegExp)return s.source===i.source&&s.flags===i.flags;if(s.valueOf!==Object.prototype.valueOf)return s.valueOf()===i.valueOf();if(s.toString!==Object.prototype.toString)return s.toString()===i.toString();if(u=Object.keys(s),r=u.length,r!==Object.keys(i).length)return!1;for(l=r;l--!==0;)if(!Object.prototype.hasOwnProperty.call(i,u[l]))return!1;for(l=r;l--!==0;){var d=u[l];if(!a(s[d],i[d]))return!1}return!0}return s!==s&&i!==i};const CE=hi(wE),ci=typeof window<"u"?H.useLayoutEffect:H.useEffect;function TE(a,s,i){const[r,l]=H.useState(()=>s(a)),u=H.useCallback(()=>{const d=s(a);CE(r,d)||(l(d),i&&i())},[r,a,i]);return ci(u),[r,u]}function kE(a,s,i){const[r,l]=TE(a,s,i);return ci(function(){const d=a.getHandlerId();if(d!=null)return a.subscribeToStateChange(l,{handlerIds:[d]})},[a,l]),r}function aw(a,s,i){return kE(s,a||(()=>({})),()=>i.reconnect())}function lw(a,s){const i=[];return typeof a!="function"&&i.push(a),H.useMemo(()=>typeof a=="function"?a():a,i)}function SE(a){return H.useMemo(()=>a.hooks.dragSource(),[a])}function EE(a){return H.useMemo(()=>a.hooks.dragPreview(),[a])}let Tp=!1,kp=!1;class IE{receiveHandlerId(s){this.sourceId=s}getHandlerId(){return this.sourceId}canDrag(){De(!Tp,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Tp=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Tp=!1}}isDragging(){if(!this.sourceId)return!1;De(!kp,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return kp=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{kp=!1}}subscribeToStateChange(s,i){return this.internalMonitor.subscribeToStateChange(s,i)}isDraggingSource(s){return this.internalMonitor.isDraggingSource(s)}isOverTarget(s,i){return this.internalMonitor.isOverTarget(s,i)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(s){return this.internalMonitor.subscribeToOffsetChange(s)}canDragSource(s){return this.internalMonitor.canDragSource(s)}canDropOnTarget(s){return this.internalMonitor.canDropOnTarget(s)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(s){this.sourceId=null,this.internalMonitor=s.getMonitor()}}let Sp=!1;class xE{receiveHandlerId(s){this.targetId=s}getHandlerId(){return this.targetId}subscribeToStateChange(s,i){return this.internalMonitor.subscribeToStateChange(s,i)}canDrop(){if(!this.targetId)return!1;De(!Sp,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return Sp=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Sp=!1}}isOver(s){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,s):!1}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(s){this.targetId=null,this.internalMonitor=s.getMonitor()}}function DE(a,s,i){const r=i.getRegistry(),l=r.addTarget(a,s);return[l,()=>r.removeTarget(l)]}function AE(a,s,i){const r=i.getRegistry(),l=r.addSource(a,s);return[l,()=>r.removeSource(l)]}function ng(a,s,i,r){let l;if(l!==void 0)return!!l;if(a===s)return!0;if(typeof a!="object"||!a||typeof s!="object"||!s)return!1;const u=Object.keys(a),d=Object.keys(s);if(u.length!==d.length)return!1;const p=Object.prototype.hasOwnProperty.bind(s);for(let m=0;m<u.length;m++){const f=u[m];if(!p(f))return!1;const v=a[f],w=s[f];if(l=void 0,l===!1||l===void 0&&v!==w)return!1}return!0}function rg(a){return a!==null&&typeof a=="object"&&Object.prototype.hasOwnProperty.call(a,"current")}function RE(a){if(typeof a.type=="string")return;const s=a.type.displayName||a.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${s} into a <div>, or turn it into a drag source or a drop target itself.`)}function OE(a){return(s=null,i=null)=>{if(!H.isValidElement(s)){const u=s;return a(u,i),u}const r=s;return RE(r),ME(r,i?u=>a(u,i):a)}}function cw(a){const s={};return Object.keys(a).forEach(i=>{const r=a[i];if(i.endsWith("Ref"))s[i]=a[i];else{const l=OE(r);s[i]=()=>l}}),s}function Ry(a,s){typeof a=="function"?a(s):a.current=s}function ME(a,s){const i=a.ref;return De(typeof i!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),i?H.cloneElement(a,{ref:r=>{Ry(i,r),Ry(s,r)}}):H.cloneElement(a,{ref:s})}class NE{receiveHandlerId(s){this.handlerId!==s&&(this.handlerId=s,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(s){this.dragSourceOptionsInternal=s}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(s){this.dragPreviewOptionsInternal=s}reconnect(){const s=this.reconnectDragSource();this.reconnectDragPreview(s)}reconnectDragSource(){const s=this.dragSource,i=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return i&&this.disconnectDragSource(),this.handlerId?s?(i&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=s,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,s,this.dragSourceOptions)),i):(this.lastConnectedDragSource=s,i):i}reconnectDragPreview(s=!1){const i=this.dragPreview,r=s||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(r&&this.disconnectDragPreview(),!!this.handlerId){if(!i){this.lastConnectedDragPreview=i;return}r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=i,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,i,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!ng(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!ng(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(s){this.hooks=cw({dragSource:(i,r)=>{this.clearDragSource(),this.dragSourceOptions=r||null,rg(i)?this.dragSourceRef=i:this.dragSourceNode=i,this.reconnectDragSource()},dragPreview:(i,r)=>{this.clearDragPreview(),this.dragPreviewOptions=r||null,rg(i)?this.dragPreviewRef=i:this.dragPreviewNode=i,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=s}}class LE{get connectTarget(){return this.dropTarget}reconnect(){const s=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();s&&this.disconnectDropTarget();const i=this.dropTarget;if(this.handlerId){if(!i){this.lastConnectedDropTarget=i;return}s&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=i,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,i,this.dropTargetOptions))}}receiveHandlerId(s){s!==this.handlerId&&(this.handlerId=s,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(s){this.dropTargetOptionsInternal=s}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!ng(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(s){this.hooks=cw({dropTarget:(i,r)=>{this.clearDropTarget(),this.dropTargetOptions=r,rg(i)?this.dropTargetRef=i:this.dropTargetNode=i,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=s}}function fn(){const{dragDropManager:a}=H.useContext(Z_);return De(a!=null,"Expected drag drop context"),a}function BE(a,s){const i=fn(),r=H.useMemo(()=>new NE(i.getBackend()),[i]);return ci(()=>(r.dragSourceOptions=a||null,r.reconnect(),()=>r.disconnectDragSource()),[r,a]),ci(()=>(r.dragPreviewOptions=s||null,r.reconnect(),()=>r.disconnectDragPreview()),[r,s]),r}function PE(){const a=fn();return H.useMemo(()=>new IE(a),[a])}class FE{beginDrag(){const s=this.spec,i=this.monitor;let r=null;return typeof s.item=="object"?r=s.item:typeof s.item=="function"?r=s.item(i):r={},r??null}canDrag(){const s=this.spec,i=this.monitor;return typeof s.canDrag=="boolean"?s.canDrag:typeof s.canDrag=="function"?s.canDrag(i):!0}isDragging(s,i){const r=this.spec,l=this.monitor,{isDragging:u}=r;return u?u(l):i===s.getSourceId()}endDrag(){const s=this.spec,i=this.monitor,r=this.connector,{end:l}=s;l&&l(i.getItem(),i),r.reconnect()}constructor(s,i,r){this.spec=s,this.monitor=i,this.connector=r}}function jE(a,s,i){const r=H.useMemo(()=>new FE(a,s,i),[s,i]);return H.useEffect(()=>{r.spec=a},[a]),r}function zE(a){return H.useMemo(()=>{const s=a.type;return De(s!=null,"spec.type must be defined"),s},[a])}function UE(a,s,i){const r=fn(),l=jE(a,s,i),u=zE(a);ci(function(){if(u!=null){const[p,m]=AE(u,l,r);return s.receiveHandlerId(p),i.receiveHandlerId(p),m}},[r,s,i,l,u])}function HE(a,s){const i=lw(a);De(!i.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const r=PE(),l=BE(i.options,i.previewOptions);return UE(i,r,l),[aw(i.collect,r,l),SE(l),EE(l)]}function WE(a){return H.useMemo(()=>a.hooks.dropTarget(),[a])}function VE(a){const s=fn(),i=H.useMemo(()=>new LE(s.getBackend()),[s]);return ci(()=>(i.dropTargetOptions=a||null,i.reconnect(),()=>i.disconnectDropTarget()),[a]),i}function GE(){const a=fn();return H.useMemo(()=>new xE(a),[a])}function KE(a){const{accept:s}=a;return H.useMemo(()=>(De(a.accept!=null,"accept must be defined"),Array.isArray(s)?s:[s]),[s])}class YE{canDrop(){const s=this.spec,i=this.monitor;return s.canDrop?s.canDrop(i.getItem(),i):!0}hover(){const s=this.spec,i=this.monitor;s.hover&&s.hover(i.getItem(),i)}drop(){const s=this.spec,i=this.monitor;if(s.drop)return s.drop(i.getItem(),i)}constructor(s,i){this.spec=s,this.monitor=i}}function JE(a,s){const i=H.useMemo(()=>new YE(a,s),[s]);return H.useEffect(()=>{i.spec=a},[a]),i}function XE(a,s,i){const r=fn(),l=JE(a,s),u=KE(a);ci(function(){const[p,m]=DE(u,l,r);return s.receiveHandlerId(p),i.receiveHandlerId(p),m},[r,s,l,i,u.map(d=>d.toString()).join("|")])}function qE(a,s){const i=lw(a),r=GE(),l=VE(i.options);return XE(i,r,l),[aw(i.collect,r,l),WE(l)]}function uw(a){let s=null;return()=>(s==null&&(s=a()),s)}function ZE(a,s){return a.filter(i=>i!==s)}function QE(a,s){const i=new Set,r=u=>i.add(u);a.forEach(r),s.forEach(r);const l=[];return i.forEach(u=>l.push(u)),l}class eI{enter(s){const i=this.entered.length,r=l=>this.isNodeInDocument(l)&&(!l.contains||l.contains(s));return this.entered=QE(this.entered.filter(r),[s]),i===0&&this.entered.length>0}leave(s){const i=this.entered.length;return this.entered=ZE(this.entered.filter(this.isNodeInDocument),s),i>0&&this.entered.length===0}reset(){this.entered=[]}constructor(s){this.entered=[],this.isNodeInDocument=s}}class tI{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(s=>{Object.defineProperty(this.item,s,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${s}" until the drop event.`),null}})})}loadDataTransfer(s){if(s){const i={};Object.keys(this.config.exposeProperties).forEach(r=>{const l=this.config.exposeProperties[r];l!=null&&(i[r]={value:l(s,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,i)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(s,i){return i===s.getSourceId()}endDrag(){}constructor(s){this.config=s,this.item={},this.initializeExposedProperties()}}const dw="__NATIVE_FILE__",hw="__NATIVE_URL__",pw="__NATIVE_TEXT__",gw="__NATIVE_HTML__",Oy=Object.freeze(Object.defineProperty({__proto__:null,FILE:dw,HTML:gw,TEXT:pw,URL:hw},Symbol.toStringTag,{value:"Module"}));function Ep(a,s,i){const r=s.reduce((l,u)=>l||a.getData(u),"");return r??i}const ag={[dw]:{exposeProperties:{files:a=>Array.prototype.slice.call(a.files),items:a=>a.items,dataTransfer:a=>a},matchesTypes:["Files"]},[gw]:{exposeProperties:{html:(a,s)=>Ep(a,s,""),dataTransfer:a=>a},matchesTypes:["Html","text/html"]},[hw]:{exposeProperties:{urls:(a,s)=>Ep(a,s,"").split(`
112
+ `),dataTransfer:a=>a},matchesTypes:["Url","text/uri-list"]},[pw]:{exposeProperties:{text:(a,s)=>Ep(a,s,""),dataTransfer:a=>a},matchesTypes:["Text","text/plain"]}};function sI(a,s){const i=ag[a];if(!i)throw new Error(`native type ${a} has no configuration`);const r=new tI(i);return r.loadDataTransfer(s),r}function Ip(a){if(!a)return null;const s=Array.prototype.slice.call(a.types||[]);return Object.keys(ag).filter(i=>{const r=ag[i];return r!=null&&r.matchesTypes?r.matchesTypes.some(l=>s.indexOf(l)>-1):!1})[0]||null}const oI=uw(()=>/firefox/i.test(navigator.userAgent)),mw=uw(()=>!!window.safari);class My{interpolate(s){const{xs:i,ys:r,c1s:l,c2s:u,c3s:d}=this;let p=i.length-1;if(s===i[p])return r[p];let m=0,f=d.length-1,v;for(;m<=f;){v=Math.floor(.5*(m+f));const k=i[v];if(k<s)m=v+1;else if(k>s)f=v-1;else return r[v]}p=Math.max(0,f);const w=s-i[p],_=w*w;return r[p]+l[p]*w+u[p]*_+d[p]*w*_}constructor(s,i){const{length:r}=s,l=[];for(let k=0;k<r;k++)l.push(k);l.sort((k,S)=>s[k]<s[S]?-1:1);const u=[],d=[];let p,m;for(let k=0;k<r-1;k++)p=s[k+1]-s[k],m=i[k+1]-i[k],u.push(p),d.push(m/p);const f=[d[0]];for(let k=0;k<u.length-1;k++){const S=d[k],C=d[k+1];if(S*C<=0)f.push(0);else{p=u[k];const I=u[k+1],O=p+I;f.push(3*O/((O+I)/S+(O+p)/C))}}f.push(d[d.length-1]);const v=[],w=[];let _;for(let k=0;k<f.length-1;k++){_=d[k];const S=f[k],C=1/u[k],I=S+f[k+1]-_-_;v.push((_-S-I)*C),w.push(I*C*C)}this.xs=s,this.ys=i,this.c1s=f,this.c2s=v,this.c3s=w}}const iI=1;function fw(a){const s=a.nodeType===iI?a:a.parentElement;if(!s)return null;const{top:i,left:r}=s.getBoundingClientRect();return{x:r,y:i}}function Rl(a){return{x:a.clientX,y:a.clientY}}function nI(a){var s;return a.nodeName==="IMG"&&(oI()||!(!((s=document.documentElement)===null||s===void 0)&&s.contains(a)))}function rI(a,s,i,r){let l=a?s.width:i,u=a?s.height:r;return mw()&&a&&(u/=window.devicePixelRatio,l/=window.devicePixelRatio),{dragPreviewWidth:l,dragPreviewHeight:u}}function aI(a,s,i,r,l){const u=nI(s),p=fw(u?a:s),m={x:i.x-p.x,y:i.y-p.y},{offsetWidth:f,offsetHeight:v}=a,{anchorX:w,anchorY:_}=r,{dragPreviewWidth:k,dragPreviewHeight:S}=rI(u,s,f,v),C=()=>{let ie=new My([0,.5,1],[m.y,m.y/v*S,m.y+S-v]).interpolate(_);return mw()&&u&&(ie+=(window.devicePixelRatio-1)*S),ie},I=()=>new My([0,.5,1],[m.x,m.x/f*k,m.x+k-f]).interpolate(w),{offsetX:O,offsetY:A}=l,R=O===0||O,q=A===0||A;return{x:R?O:I(),y:q?A:C()}}let lI=class{get window(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}get document(){var s;return!((s=this.globalContext)===null||s===void 0)&&s.document?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var s;return((s=this.optionsArgs)===null||s===void 0?void 0:s.rootElement)||this.window}constructor(s,i){this.ownerDocument=null,this.globalContext=s,this.optionsArgs=i}};function cI(a,s,i){return s in a?Object.defineProperty(a,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[s]=i,a}function Ny(a){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{},r=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable}))),r.forEach(function(l){cI(a,l,i[l])})}return a}class uI{profile(){var s,i;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((s=this.dragStartSourceIds)===null||s===void 0?void 0:s.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((i=this.dragOverTargetIds)===null||i===void 0?void 0:i.length)||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){const s=this.rootElement;if(s!==void 0){if(s.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");s.__isReactDndBackendSetUp=!0,this.addEventListeners(s)}}teardown(){const s=this.rootElement;if(s!==void 0&&(s.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var i;(i=this.window)===null||i===void 0||i.cancelAnimationFrame(this.asyncEndDragFrameId)}}connectDragPreview(s,i,r){return this.sourcePreviewNodeOptions.set(s,r),this.sourcePreviewNodes.set(s,i),()=>{this.sourcePreviewNodes.delete(s),this.sourcePreviewNodeOptions.delete(s)}}connectDragSource(s,i,r){this.sourceNodes.set(s,i),this.sourceNodeOptions.set(s,r);const l=d=>this.handleDragStart(d,s),u=d=>this.handleSelectStart(d);return i.setAttribute("draggable","true"),i.addEventListener("dragstart",l),i.addEventListener("selectstart",u),()=>{this.sourceNodes.delete(s),this.sourceNodeOptions.delete(s),i.removeEventListener("dragstart",l),i.removeEventListener("selectstart",u),i.setAttribute("draggable","false")}}connectDropTarget(s,i){const r=d=>this.handleDragEnter(d,s),l=d=>this.handleDragOver(d,s),u=d=>this.handleDrop(d,s);return i.addEventListener("dragenter",r),i.addEventListener("dragover",l),i.addEventListener("drop",u),()=>{i.removeEventListener("dragenter",r),i.removeEventListener("dragover",l),i.removeEventListener("drop",u)}}addEventListeners(s){s.addEventListener&&(s.addEventListener("dragstart",this.handleTopDragStart),s.addEventListener("dragstart",this.handleTopDragStartCapture,!0),s.addEventListener("dragend",this.handleTopDragEndCapture,!0),s.addEventListener("dragenter",this.handleTopDragEnter),s.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),s.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),s.addEventListener("dragover",this.handleTopDragOver),s.addEventListener("dragover",this.handleTopDragOverCapture,!0),s.addEventListener("drop",this.handleTopDrop),s.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(s){s.removeEventListener&&(s.removeEventListener("dragstart",this.handleTopDragStart),s.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),s.removeEventListener("dragend",this.handleTopDragEndCapture,!0),s.removeEventListener("dragenter",this.handleTopDragEnter),s.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),s.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),s.removeEventListener("dragover",this.handleTopDragOver),s.removeEventListener("dragover",this.handleTopDragOverCapture,!0),s.removeEventListener("drop",this.handleTopDrop),s.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const s=this.monitor.getSourceId(),i=this.sourceNodeOptions.get(s);return Ny({dropEffect:this.altKeyPressed?"copy":"move"},i||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const s=this.monitor.getSourceId(),i=this.sourcePreviewNodeOptions.get(s);return Ny({anchorX:.5,anchorY:.5,captureDraggingState:!1},i||{})}isDraggingNativeItem(){const s=this.monitor.getItemType();return Object.keys(Oy).some(i=>Oy[i]===s)}beginDragNativeItem(s,i){this.clearCurrentDragSourceNode(),this.currentNativeSource=sI(s,i),this.currentNativeHandle=this.registry.addSource(s,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(s){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=s;const i=1e3;this.mouseMoveTimeoutTimer=setTimeout(()=>{var r;return(r=this.rootElement)===null||r===void 0?void 0:r.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},i)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var s;(s=this.window)===null||s===void 0||s.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(s,i){s.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(i))}handleDragEnter(s,i){this.dragEnterTargetIds.unshift(i)}handleDragOver(s,i){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(i)}handleDrop(s,i){this.dropTargetIds.unshift(i)}constructor(s,i,r){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=l=>{const u=this.sourceNodes.get(l);return u&&fw(u)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=l=>!!(l&&this.document&&this.document.body&&this.document.body.contains(l)),this.endDragIfSourceWasRemovedFromDOM=()=>{const l=this.currentDragSourceNode;l==null||this.isNodeInDocument(l)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=l=>{this.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(l||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{this.hoverRafId!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=l=>{if(l.defaultPrevented)return;const{dragStartSourceIds:u}=this;this.dragStartSourceIds=null;const d=Rl(l);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(u||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:d});const{dataTransfer:p}=l,m=Ip(p);if(this.monitor.isDragging()){if(p&&typeof p.setDragImage=="function"){const v=this.monitor.getSourceId(),w=this.sourceNodes.get(v),_=this.sourcePreviewNodes.get(v)||w;if(_){const{anchorX:k,anchorY:S,offsetX:C,offsetY:I}=this.getCurrentSourcePreviewNodeOptions(),R=aI(w,_,d,{anchorX:k,anchorY:S},{offsetX:C,offsetY:I});p.setDragImage(_,R.x,R.y)}}try{p==null||p.setData("application/json",{})}catch{}this.setCurrentDragSourceNode(l.target);const{captureDraggingState:f}=this.getCurrentSourcePreviewNodeOptions();f?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(m)this.beginDragNativeItem(m);else{if(p&&!p.types&&(l.target&&!l.target.hasAttribute||!l.target.hasAttribute("draggable")))return;l.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=l=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var u;(u=this.currentNativeSource)===null||u===void 0||u.loadDataTransfer(l.dataTransfer)}if(!this.enterLeaveCounter.enter(l.target)||this.monitor.isDragging())return;const{dataTransfer:p}=l,m=Ip(p);m&&this.beginDragNativeItem(m,p)},this.handleTopDragEnter=l=>{const{dragEnterTargetIds:u}=this;if(this.dragEnterTargetIds=[],!this.monitor.isDragging())return;this.altKeyPressed=l.altKey,u.length>0&&this.actions.hover(u,{clientOffset:Rl(l)}),u.some(p=>this.monitor.canDropOnTarget(p))&&(l.preventDefault(),l.dataTransfer&&(l.dataTransfer.dropEffect=this.getCurrentDropEffect()))},this.handleTopDragOverCapture=l=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var u;(u=this.currentNativeSource)===null||u===void 0||u.loadDataTransfer(l.dataTransfer)}},this.handleTopDragOver=l=>{const{dragOverTargetIds:u}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){l.preventDefault(),l.dataTransfer&&(l.dataTransfer.dropEffect="none");return}this.altKeyPressed=l.altKey,this.lastClientOffset=Rl(l),this.scheduleHover(u),(u||[]).some(p=>this.monitor.canDropOnTarget(p))?(l.preventDefault(),l.dataTransfer&&(l.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?l.preventDefault():(l.preventDefault(),l.dataTransfer&&(l.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=l=>{this.isDraggingNativeItem()&&l.preventDefault(),this.enterLeaveCounter.leave(l.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=l=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var u;l.preventDefault(),(u=this.currentNativeSource)===null||u===void 0||u.loadDataTransfer(l.dataTransfer)}else Ip(l.dataTransfer)&&l.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=l=>{const{dropTargetIds:u}=this;this.dropTargetIds=[],this.actions.hover(u,{clientOffset:Rl(l)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=l=>{const u=l.target;typeof u.dragDrop=="function"&&(u.tagName==="INPUT"||u.tagName==="SELECT"||u.tagName==="TEXTAREA"||u.isContentEditable||(l.preventDefault(),u.dragDrop()))},this.options=new lI(i,r),this.actions=s.getActions(),this.monitor=s.getMonitor(),this.registry=s.getRegistry(),this.enterLeaveCounter=new eI(this.isNodeInDocument)}}const $w=function(s,i,r){return new uI(s,i,r)},Xl="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='512'%20height='512'%20shape-rendering='geometricPrecision'%20image-rendering='optimizeQuality'%20fill-rule='evenodd'%20xmlns:v='https://vecta.io/nano'%3e%3cpath%20fill='%23efda4e'%20d='M-.5-.5h512v512H-.5V-.5z'/%3e%3cpath%20fill='%23020100'%20d='M308.5%20287.5c1.777-3.005%202.777-6.338%203-10%209.147-21.963%2025.48-35.463%2049-40.5%2021.999-4.173%2043.666-2.84%2065%204%2014.575%205.411%2025.575%2014.911%2033%2028.5l-1%202c-12.413%205.624-24.58%2011.624-36.5%2018-5.321-8.25-12.821-13.417-22.5-15.5-13.957-3.122-27.29-1.455-40%205-8.125%205.36-10.958%2012.86-8.5%2022.5%203.223%206.223%208.057%2010.723%2014.5%2013.5l64%2020c38.459%2016.085%2052.626%2044.585%2042.5%2085.5-7.572%2026.208-24.738%2042.041-51.5%2047.5-25.102%205.733-49.768%204.4-74-4-19.291-8.625-32.291-22.958-39-43%2011.266-8.887%2023.433-16.387%2036.5-22.5%203.117%206.896%206.784%2013.563%2011%2020%2012.705%2012.307%2027.872%2016.807%2045.5%2013.5%2022.189-3.504%2032.355-16.338%2030.5-38.5-2.833-6.833-7.667-11.667-14.5-14.5l-57-17c-36.004-11.84-52.67-36.673-50-74.5z'/%3e%3cpath%20fill='%23020200'%20d='M222.5%20238.5h43l-.5%20159c-2.688%2052.355-30.188%2076.855-82.5%2073.5-24.871-3.543-41.204-17.21-49-41l.5-2.5a12.14%2012.14%200%200%200%204.5-3.5c10.653-5.825%2021.32-11.325%2032-16.5%204.763%2021.72%2017.763%2028.887%2039%2021.5%204.616-2.618%207.783-6.451%209.5-11.5%201.163-5.968%202.163-11.968%203-18l.5-161z'/%3e%3cpath%20fill='%23615820'%20d='M311.5%20277.5c-.223%203.662-1.223%206.995-3%2010%20.223-3.662%201.223-6.995%203-10z'/%3e%3c/svg%3e",bw="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20500%20500'%3e%3cpath%20fill='%234285f4'%20d='M44.271%2027.275l206.5%201v170l-58.5-36.5c-7.005-.916-12.505%201.584-16.5%207.5v147c4.625%204.412%2010.125%206.245%2016.5%205.5l57.5-35.5c.833%2054.003%201.356%20108.003.189%20162-1.272.546-45.599-.242-48.689%201.121-3.674%207.844-4.79%2011.207-13%2023.879-4.372%205.527-2.19%204.097-10.689%2012.258-5.166%202.748-4.191%203.45-14.311%206.242-17.67%201.983-35.336%201.983-53%200-9.535-3.774-10.879-4.163-18.526-11.22-5.562-4.39-11.131-11.803-11.974-15.28-4.068-7.881-3.42-9.116-5.5-13.5-3.672-1.503-35.798.203-40.746-1.335-5.823-2.314-2.946-.422-7.954-3.689-2.888-2.668-2.255-3.221-2.421-9.904L20.771%2050.275c.36-2.108-.41-5.806%202.522-11.615%204.343-5.852%205.374-7%2010.061-9.146%206.083-2.73%208.677-1.475%2010.917-2.239z'/%3e%3cpath%20d='M258.271%2030.275l154.63.407c5.654.559%2010.783%203.17%2014.37%207.093%204.907%204.408%206.204%208.723%207.5%2013.5v373c-.208%205.716-.297%207.982-4.848%2015.404-7.078%206.393-9.879%206.39-15.652%206.692-24.804%201.296-50.079%201.189-74.96%201.041-24.516-.014-68.46.89-81.5.391l-2.512-172.528c-20.083%2012.625-42.777%2025.125-63.028%2037.5-4.127%201.292-7.294.125-9.5-3.5l1-137c1.864-2.707%204.364-3.541%207.5-2.5%2020.366%2013.427%2064.35%2038.947%2065.581%2038.339l1.419-177.839z'%20fill='%23DDD'/%3e%3c/svg%3e",vw="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20width='32'%20height='32'%3e%3cpath%20fill='%23007acc'%20d='M-.5-.5h503l-1%20179h10v333h-421v-7h-91V-.5z'/%3e%3cpath%20fill='%230f81cf'%20d='M502.5-.5h9v179h-10l1-179z'/%3e%3cpath%20fill='%23fdfefe'%20d='M470.5%20227.5c.33%2017.508-.003%2034.841-1%2052-23.486-15.709-48.82-19.875-76-12.5-15.89%208.078-19.39%2019.911-10.5%2035.5%204.673%205.577%2010.173%2010.077%2016.5%2013.5l38%2019c17.945%209.278%2031.112%2023.112%2039.5%2041.5%201.352%203.22%202.186%206.553%202.5%2010a305.16%20305.16%200%200%201%201%2026c-3.553%2033.726-21.886%2054.559-55%2062.5-34.769%207.363-68.435%204.196-101-9.5-.167-19.003%200-38.003.5-57%2022.903%2021.314%2049.736%2029.147%2080.5%2023.5%2019.435-5.701%2025.268-17.868%2017.5-36.5-4.718-6.44-10.552-11.606-17.5-15.5a1552.42%201552.42%200%200%201-47-24c-27.679-19.331-38.846-45.831-33.5-79.5%206.43-26.433%2022.597-43.933%2048.5-52.5%2026.131-6.625%2052.464-7.292%2079-2a565.56%20565.56%200%200%201%2018%205.5z'/%3e%3cpath%20fill='%23fefefe'%20d='M122.5%20222.5h182v46h-65v206h-52v-206h-65v-46z'/%3e%3cpath%20fill='%2370b3e1'%20d='M470.5%20227.5c1.327%2017.505%201.327%2035.171%200%2053-.607-.124-.94-.457-1-1%20.997-17.159%201.33-34.492%201-52z'/%3e%3cpath%20fill='%236cafe0'%20d='M479.5%20386.5c1.465%205.09%202.132%2010.423%202%2016-.002%203.518-.335%206.851-1%2010a305.16%20305.16%200%200%200-1-26z'/%3e%3cpath%20fill='%231283cf'%20d='M-.5%20504.5h91v7h-91v-7z'/%3e%3c/svg%3e",yw="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MTIiIGhlaWdodD0iNTEyIj4KICAgIDxyYWRpYWxHcmFkaWVudCBpZD0ibXlHcmFkaWVudCI+CiAgICAgICAgPHN0b3Agb2Zmc2V0PSIxMCUiIHN0b3AtY29sb3I9IiMxQzJENUYiIC8+CiAgICAgICAgPHN0b3Agb2Zmc2V0PSI5NSUiIHN0b3AtY29sb3I9IiMwQjFENTMiIC8+CiAgICA8L3JhZGlhbEdyYWRpZW50PgogICAgPHBhdGggZmlsbD0idXJsKCcjbXlHcmFkaWVudCcpIiBkPSJNLS4xLS4xaDUxMnY1MTJILS4xVi0uMXoiLz4KICAgIDxwYXRoIGZpbGw9IiNmOGY4ZmEiCiAgICAgICAgICBkPSJNNDgyLjUgMjMxLjV2NmgtMjVjLS45NzItOC4xNy01LjYzOS0xMi4xNy0xNC0xMi05LjUzMS4wMjktMTMuMzY1IDQuNjk1LTExLjUgMTRsNC41IDQuNSAzMyA4YzE5LjM4OCA5LjYzNCAyMy4zODggMjMuODAxIDEyIDQyLjVhMzUuMDYgMzUuMDYgMCAwIDAtOCA2Yy0xMy45MjUgNC43NjEtMjguMjU4IDYuMjYxLTQzIDQuNS0xMC42MDEtMS4wMjQtMTguOTM1LTUuODU3LTI1LTE0LjUtMS4wNzctMi4yMjktMS43NDQtNC41NjMtMi03di04aDI1YzEuNDk1IDQuMjc5IDMuODI4IDguMTEzIDcgMTEuNSA3LjQ3OCAyLjI1OCAxNC44MTEgMS45MjUgMjItMSAyLjg5NC0yLjkwOSAzLjcyNy02LjQwOSAyLjUtMTAuNWEzNi44IDM2LjggMCAwIDAtMTIuNS01LjUgNTM5Ljc5IDUzOS43OSAwIDAgMS0yOC04Yy0xMi44NzQtNi41NjItMTcuNzA3LTE3LjA2Mi0xNC41LTMxLjUgMy41Ny0xMC41NjkgMTAuNzM3LTE3LjQwMyAyMS41LTIwLjUgMTYuMTQ4LTQuNTM5IDMxLjQ4Mi0yLjcwNiA0NiA1LjUgMiAyLjY2NyA0LjMzMyA1IDcgNyAxLjg3MSAyLjczNCAyLjg3MSA1LjczNCAzIDl6Ii8+CiAgICA8cGF0aCBmaWxsPSIjYTRhYmJmIiBkPSJNMTUzLjUgMjA5LjVjLjA2LS41NDMuMzkzLS44NzYgMS0xYTEwMjQuNjMgMTAyNC42MyAwIDAgMSAxIDY0bC0yLTYzeiIvPgogICAgPHBhdGggZmlsbD0iI2ZhZmJmYyIKICAgICAgICAgIGQ9Ik0xNTMuNSAyMDkuNWwyIDYzYzEuMjc4IDExLjQ0NCA3LjYxMSAxNi4yNzcgMTkgMTQuNSA4LjcwNC0xLjM3OCAxMy4yMDQtNi41NDQgMTMuNS0xNS41LjUtMjAuNjY0LjY2Ny00MS4zMzEuNS02MiA5Ljc0My0uMjE5IDE5LjQwOS0uMjE5IDI5IDAgLjQwMSAyMy4zNjItLjA5OSA0Ni42OTYtMS41IDcwLTQuMjk4IDE0Ljk2OC0xNC4xMzEgMjMuNDY4LTI5LjUgMjUuNWEyMjUuMTQgMjI1LjE0IDAgMCAxLTMwIDBjLTE1LjgyMi0yLjE1NS0yNS42NTUtMTAuOTg4LTI5LjUtMjYuNWwtLjUtNjloMjd6Ii8+CiAgICA8cGF0aCBmaWxsPSIjZmVmZWZlIgogICAgICAgICAgZD0iTTIzMy41IDIwOS41aDI3Yy0uMzMxIDI1LjE3Mi4wMDIgNTAuMTcyIDEgNzUgMCAuNjY3LjMzMyAxIDEgMSAxMy4xNTYuOTk2IDI2LjQ5IDEuMzI5IDQwIDF2MTdoLTY5di05NHoiLz4KICAgIDxwYXRoIGZpbGw9IiNhNWFjYmYiIGQ9Ik0yMzMuNSAyMDkuNWM5LjE1Mi0uOTk0IDE4LjQ4NS0xLjMyNyAyOC0xdjc2Yy0uOTk4LTI0LjgyOC0xLjMzMS00OS44MjgtMS03NWgtMjd6Ii8+CiAgICA8cGF0aCBmaWxsPSIjYTdhZWMxIiBkPSJNMzE2LjUgMjA5LjVoNzNjLjMyMyA2LjE5LS4wMSAxMi4xOS0xIDE4di0xN2MtMjQuMTcyLjMzMS00OC4xNzItLjAwMi03Mi0xeiIvPgogICAgPHBhdGggZmlsbD0iI2E1YWNjMCIgZD0iTTg1LjUgMjEwLjVoLTU5djkzaDI3Yy0uMzI4LTExLjE3OS4wMDUtMjIuMTc5IDEtMzN2MzRoLTI5di05NWE5MDAuOTggOTAwLjk4IDAgMCAxIDYwIDF6Ii8+CiAgICA8cGF0aCBmaWxsPSIjZmNmY2ZjIgogICAgICAgICAgZD0iTTg1LjUgMjEwLjVjMjIuMjIzIDMuNzU4IDI5LjU1NiAxNi40MjUgMjIgMzgtNC4yMjggNS4zOTctOS4yMjggOS44OTctMTUgMTMuNS0xLjMwNS44MDQtMS45NzEgMS45NzEtMiAzLjVsMjMgMzZjLTQuNDUxIDEuMzI3LTkuMjg0IDEuOTk0LTE0LjUgMmExMjguMTkgMTI4LjE5IDAgMCAxLTE1LjUtMWMtNi45NTUtMTAuMzI2LTEzLjQ1NS0yMC45OTItMTkuNS0zMi0zLjI2OS0xLjMxOC02LjQzNS0xLjMxOC05LjUgMC0uOTk1IDEwLjgyMS0xLjMyOCAyMS44MjEtMSAzM2gtMjd2LTkzaDU5eiIvPgogICAgPHBhdGggZmlsbD0iI2ZlZmVmZSIKICAgICAgICAgIGQ9Ik0zMTYuNSAyMDkuNWMyMy44MjguOTk4IDQ3LjgyOCAxLjMzMSA3MiAxdjE3Yy0xNC42Ny0uMTY3LTI5LjMzNyAwLTQ0IC41LTEuMzI2IDYuNTk5LTEuMzI2IDEzLjA5OSAwIDE5LjUgMTQuNDkuOTk2IDI5LjE1NyAxLjMyOSA0NCAxdjE2Yy0xNC44NDMtLjMyOS0yOS41MS4wMDQtNDQgMWE1MC41MSA1MC41MSAwIDAgMCAwIDIwYzE0LjQ5Ljk5NiAyOS4xNTcgMS4zMjkgNDQgMXYxN2gtNzNjLS4zMzItMzEuNTA0LjAwMi02Mi44MzggMS05NHoiLz4KICAgIDxwYXRoIGZpbGw9IiMxODI3NWIiCiAgICAgICAgICBkPSJNNTUuNSAyMjkuNWM3LjA4OS0uMzg0IDE0LjA4OS4xMTYgMjEgMS41IDMuNDAxIDEuMzIgNC43MzUgMy44MiA0IDcuNWwtLjUgNWMtMS43NzEuODA0LTMuMjcxIDEuOTcxLTQuNSAzLjUtNi41OTIgMS4zMjktMTMuMjU5IDEuODI5LTIwIDEuNXYtMTl6Ii8+CiAgICA8cGF0aCBmaWxsPSIjYTVhY2MwIiBkPSJNNDgyLjUgMjMxLjVjLjk2OCAyLjEwNyAxLjMwMiA0LjQ0MSAxIDctOC44NDkuMzI2LTE3LjUxNi0uMDA3LTI2LTFoMjV2LTZ6Ii8+CiAgICA8cGF0aCBmaWxsPSIjYTZhZGMwIiBkPSJNMzQ0LjUgMjQ3LjVoNDV2MThoLTQ1YzE0LjQ5LS45OTYgMjkuMTU3LTEuMzI5IDQ0LTF2LTE2Yy0xNC44NDMuMzI5LTI5LjUxLS4wMDQtNDQtMXoiLz4KICAgIDxwYXRoIGZpbGw9IiNhMmE5YmUiIGQ9Ik00MjguNSAyNzUuNWgtMjV2OGMtLjk3Ny0yLjc4Ny0xLjMxLTUuNzg3LTEtOSA4Ljg0OS0uMzI2IDE3LjUxNi4wMDcgMjYgMXoiLz4KICAgIDxwYXRoIGZpbGw9IiNhNWFjYmYiCiAgICAgICAgICBkPSJNMTEzLjUgMzAxLjVjLjk3OC4zMTEgMS42NDUuOTc4IDIgMmwtMTYgMWMtNS43MTEtLjAwNS0xMS4wNDQtLjY3Mi0xNi0yYTEyOC4xOSAxMjguMTkgMCAwIDAgMTUuNSAxYzUuMjE2LS4wMDYgMTAuMDQ5LS42NzMgMTQuNS0yeiIvPgogICAgPHBhdGggZmlsbD0iI2E1YWNjMCIgZD0iTTIzMy41IDIwOS41djk0aDY5di0xN2MtMTMuNTEuMzI5LTI2Ljg0NC0uMDA0LTQwLTFoNDF2MTloLTcxYTIyNTYuNDEgMjI1Ni40MSAwIDAgMSAxLTk1eiIvPgogICAgPHBhdGggZmlsbD0iI2E2YWNjMCIKICAgICAgICAgIGQ9Ik0zMTYuNSAyMDkuNWMtLjk5OCAzMS4xNjItMS4zMzIgNjIuNDk2LTEgOTRoNzN2LTE3Yy0xNC44NDMuMzI5LTI5LjUxLS4wMDQtNDQtMWg0NXYxOWgtNzVhMjMwNC45NSAyMzA0Ljk1IDAgMCAxIDEtOTZjLjYwNy4xMjQuOTQuNDU3IDEgMXoiLz4KPC9zdmc+";class Mg extends X.Component{isShowInstance;oldId;constructor(s){super(s),this.state={name:s.name,id:s.id,instance:s.instance||0,prefix:Mg.getPrefix(s.id)},this.isShowInstance=!s.folder&&!!s.instances&&(!!s.instance||!!s.instances[0]||s.instances.length>1),this.oldId=s.id}static getPrefix(s){const i=(s||"").split(".");return i.pop(),i.join(".")}getId(s){return s=(s||"").replace(/[\\/\][*,;'"`<>?\s]/g,"_"),`${this.state.prefix}.${s}`}handleCancel=()=>{this.props.onClose()};handleOk=()=>{this.props.onRename(this.oldId,this.state.id,this.state.name,this.state.instance===0?0:this.state.instance||void 0),this.props.onClose()};handleChange=s=>{this.setState({name:s,id:this.getId(s)})};render(){return g.jsxs(y.Dialog,{onClose:()=>!1,maxWidth:"md",fullWidth:!0,open:!0,"aria-labelledby":"confirmation-dialog-title",children:[g.jsx(y.DialogTitle,{id:"confirmation-dialog-title",children:b.I18n.t("Rename")}),g.jsx(y.DialogContent,{children:g.jsxs("form",{noValidate:!0,autoComplete:"off",children:[g.jsx(y.TextField,{variant:"standard",style:{width:"100%"},id:"standard-name",autoFocus:!0,label:b.I18n.t("Name"),value:this.state.name,onKeyUp:s=>{s.key==="Enter"&&(s.preventDefault(),setTimeout(()=>this.handleOk(),200))},onChange:s=>this.handleChange(s.target.value),margin:"normal"}),g.jsx(y.TextField,{variant:"standard",id:"standard-name-id",style:{width:"100%"},label:b.I18n.t("ID"),value:this.state.id,disabled:!0,margin:"normal"}),this.isShowInstance&&g.jsxs(y.FormControl,{variant:"standard",children:[g.jsx(y.InputLabel,{htmlFor:"instance",children:b.I18n.t("Instance")}),g.jsx(y.Select,{variant:"standard",value:this.state.instance,onChange:s=>this.setState({instance:parseInt(s.target.value,10)}),inputProps:{name:"instance",id:"instance"},children:this.props.instances.map(s=>g.jsx(y.MenuItem,{value:s,children:s||"0"},s))})]})]})}),g.jsxs(y.DialogActions,{children:[g.jsx(y.Button,{variant:"contained",onClick:this.handleOk,color:"primary",startIcon:g.jsx(Do,{}),children:b.I18n.t("Ok")}),g.jsx(y.Button,{color:"grey",variant:"contained",onClick:this.handleCancel,startIcon:g.jsx(zs,{}),children:b.I18n.t("Cancel")})]})]})}}class dI extends X.Component{constructor(s){super(s),this.state={name:s.name,id:s.id}}handleCancel=()=>{this.props.onClose()};handleOk=()=>{this.props.onDelete(this.state.id),this.props.onClose()};render(){return g.jsxs(y.Dialog,{onClose:()=>!1,maxWidth:"md",open:!0,"aria-labelledby":"confirmation-dialog-title",children:[g.jsx(y.DialogTitle,{id:"confirmation-dialog-title",children:b.I18n.t("Are you sure?")}),g.jsxs(y.DialogContent,{children:[g.jsx(zl,{}),g.jsx("span",{style:{fontSize:14,fontWeight:"bold"},children:b.I18n.t("Delete %s",this.state.name)})]}),g.jsxs(y.DialogActions,{children:[g.jsx(y.Button,{variant:"contained",onClick:this.handleOk,color:"primary",startIcon:g.jsx(Do,{}),children:b.I18n.t("Ok")}),g.jsx(y.Button,{color:"grey",variant:"contained",onClick:this.handleCancel,startIcon:g.jsx(zs,{}),children:b.I18n.t("Cancel")})]})]})}}const hI=""+new URL("tileJS-C48gYbHw.png",import.meta.url).href,pI=""+new URL("tileTS-CsXmgy4B.png",import.meta.url).href,gI=""+new URL("tileBlockly-BMpdinN3.png",import.meta.url).href,mI=""+new URL("tileRules-BkbaFIhs.png",import.meta.url).href,Ot={card:{maxWidth:345,minWidth:250,display:"inline-block",margin:"0 10px 0 10px"},media:{height:122},text:{maxWidth:218,minHeight:30},complexity:{fontWeight:"bold",fontStyle:"italic",marginBottom:8}};class rn extends X.Component{handleCancel=()=>{this.props.onClose()};static openHtml(s){const i=b.I18n.getLanguage();!s.includes("javascript.md")&&(i==="de"||i==="ru")&&(s=s.replace(/\/en\//,`/${i}/`));const r=window.open(s,"_blank");r==null||r.focus()}getJSCard(){return g.jsxs(y.Card,{style:Ot.card,children:[g.jsxs(y.CardActionArea,{onClick:()=>this.props.onClose&&this.props.onClose("Javascript/js"),children:[g.jsx(y.CardMedia,{style:Ot.media,image:hI,title:"JavaScript"}),g.jsxs(y.CardContent,{children:[g.jsx("h2",{children:"JavaScript"}),g.jsx("div",{style:Ot.complexity,children:b.I18n.t("for programmers")}),g.jsx("div",{style:Ot.text,children:b.I18n.t("JS description")})]})]}),g.jsxs(y.CardActions,{children:[g.jsx(y.Button,{size:"small",color:"primary",variant:"contained",onClick:()=>this.props.onClose&&this.props.onClose("Javascript/js"),children:b.I18n.t("Add")}),g.jsx(y.Button,{size:"small",color:"secondary",onClick:()=>rn.openHtml("https://github.com/ioBroker/ioBroker.javascript/blob/master/docs/en/javascript.md"),children:b.I18n.t("Learn More")})]})]})}getTSCard(){return g.jsxs(y.Card,{style:Ot.card,children:[g.jsxs(y.CardActionArea,{onClick:()=>this.props.onClose&&this.props.onClose("TypeScript/ts"),children:[g.jsx(y.CardMedia,{style:Ot.media,image:pI,title:"TypeScript"}),g.jsxs(y.CardContent,{children:[g.jsx("h2",{children:"TypeScript"}),g.jsx("div",{style:Ot.complexity,children:b.I18n.t("for professionals")}),g.jsx("div",{style:Ot.text,children:b.I18n.t("TS description")})]})]}),g.jsxs(y.CardActions,{children:[g.jsx(y.Button,{size:"small",color:"primary",variant:"contained",onClick:()=>this.props.onClose&&this.props.onClose("TypeScript/ts"),children:b.I18n.t("Add")}),g.jsx(y.Button,{size:"small",color:"secondary",onClick:()=>rn.openHtml("https://github.com/ioBroker/ioBroker.javascript/blob/master/docs/en/javascript.md"),children:b.I18n.t("Learn More")})]})]})}getBlocklyCard(){return g.jsxs(y.Card,{style:Ot.card,children:[g.jsxs(y.CardActionArea,{onClick:()=>this.props.onClose&&this.props.onClose("Blockly"),children:[g.jsx(y.CardMedia,{style:Ot.media,image:gI,title:"Blockly"}),g.jsxs(y.CardContent,{children:[g.jsx("h2",{children:"Blockly"}),g.jsx("div",{style:Ot.complexity,children:b.I18n.t("normal")}),g.jsx("div",{style:Ot.text,children:b.I18n.t("Blockly description")})]})]}),g.jsxs(y.CardActions,{children:[g.jsx(y.Button,{size:"small",color:"primary",variant:"contained",onClick:()=>this.props.onClose&&this.props.onClose("Blockly"),children:b.I18n.t("Add")}),g.jsx(y.Button,{size:"small",color:"secondary",onClick:()=>rn.openHtml("https://github.com/ioBroker/ioBroker.javascript/blob/master/docs/en/blockly.md"),children:b.I18n.t("Learn More")})]})]})}getRulesCard(){return g.jsxs(y.Card,{style:Ot.card,children:[g.jsxs(y.CardActionArea,{onClick:()=>this.props.onClose&&this.props.onClose("Rules"),children:[g.jsx(y.CardMedia,{style:Ot.media,image:mI,title:"Rules"}),g.jsxs(y.CardContent,{children:[g.jsx("h2",{children:"Rules"}),g.jsx("div",{style:Ot.complexity,children:b.I18n.t("easy")}),g.jsx("div",{style:Ot.text,children:b.I18n.t("Rules description")})]})]}),g.jsxs(y.CardActions,{children:[g.jsx(y.Button,{size:"small",color:"primary",variant:"contained",onClick:()=>this.props.onClose&&this.props.onClose("Rules"),children:b.I18n.t("Add")}),g.jsx(y.Button,{size:"small",color:"secondary",onClick:()=>rn.openHtml("https://github.com/ioBroker/ioBroker.javascript/blob/master/docs/en/javascript.md"),children:b.I18n.t("Learn More")})]})]})}render(){return g.jsxs(y.Dialog,{onClose:()=>!1,maxWidth:"lg",fullWidth:!0,open:!0,"aria-labelledby":"confirmation-dialog-title",children:[g.jsx(y.DialogTitle,{id:"confirmation-dialog-title",children:b.I18n.t("Add new script")}),g.jsxs(y.DialogContent,{style:{textAlign:"center"},children:[this.getRulesCard(),this.getBlocklyCard(),this.getJSCard(),this.getTSCard()]}),g.jsx(y.DialogActions,{children:g.jsx(y.Button,{color:"grey",onClick:this.handleCancel,startIcon:g.jsx(zs,{}),children:b.I18n.t("Cancel")})})]})}}class xp extends X.Component{isShowInstance;constructor(s){super(s),this.state={name:s.name||"Script",instance:s.instance||0,parent:s.parent,error:"",id:""},this.isShowInstance=!s.folder&&!!s.instances&&(!!s.instance||!!s.instances[0]||s.instances.length>1)}getId(s){return s=s||this.state.name||"",s=s.replace(/[\\/\][.*,;'"`<>?\s]/g,"_").trim().replace(/\.$/,"_"),`${this.state?this.state.parent:this.props.parent}.${s}`}handleOk=()=>{this.props.onAdd(this.getId(this.state.name),this.state.name,this.state.instance,this.props.type),this.props.onClose()};render(){var s;return console.log(this.state.name),g.jsxs(y.Dialog,{onClose:()=>!1,maxWidth:"md",fullWidth:!0,open:!0,"aria-labelledby":"confirmation-dialog-title",children:[g.jsx(y.DialogTitle,{id:"confirmation-dialog-title",children:this.props.title||b.I18n.t("Create new")}),g.jsx(y.DialogContent,{children:g.jsxs("form",{noValidate:!0,autoComplete:"off",children:[g.jsx(y.TextField,{variant:"standard",style:{width:"100%"},id:"standard-name",autoFocus:!0,error:!!this.state.error,label:b.I18n.t("Name"),value:this.state.name||"",helperText:this.state.error,slotProps:{input:{endAdornment:this.state.name?g.jsx(y.IconButton,{size:"small",onClick:()=>this.setState({name:""}),children:g.jsx(zT,{})}):void 0}},onKeyUp:i=>{i.preventDefault(),i.key==="Enter"&&!this.state.error&&setTimeout(()=>this.handleOk(),200)},onChange:i=>{var u;const r=i.target.value,l=this.getId(r);r?(u=this.props.existingItems)!=null&&u.includes(l)?this.setState({name:r,id:l,error:b.I18n.t("Duplicate name")}):(console.log(`Set name: "${r}"`),this.setState({name:r,id:l,error:""})):this.setState({name:r,id:l,error:b.I18n.t("Empty name is not allowed")})},margin:"normal"}),g.jsxs(y.FormControl,{variant:"standard",style:{width:"100%"},children:[g.jsx(y.InputLabel,{htmlFor:"parent",children:b.I18n.t("Folder")}),g.jsx(y.Select,{variant:"standard",style:{width:"100%"},value:this.state.parent,onChange:i=>this.setState({parent:i.target.value}),inputProps:{name:"parent",id:"parent"},children:this.props.parents.map(i=>{const r=i.id.split(".");r.splice(0,2);const l=[];let u="script.js";return r.forEach(d=>{u+=`.${d}`;const p=this.props.parents.find(m=>m.id===u);p?l.push(p.name):l.push(d)}),l.length||l.push(i.name),g.jsx(y.MenuItem,{value:i.id,children:l.join(" / ")},i.id)})})]}),g.jsx(y.TextField,{variant:"standard",id:"standard-name-id",style:{width:"100%"},label:b.I18n.t("ID"),value:this.getId(),disabled:!0,margin:"normal"}),this.isShowInstance&&g.jsxs(y.FormControl,{variant:"standard",children:[g.jsx(y.InputLabel,{htmlFor:"instance",children:b.I18n.t("Instance")}),g.jsx(y.Select,{variant:"standard",value:this.state.instance,onChange:i=>this.setState({instance:parseInt(i.target.value,10)}),inputProps:{name:"instance",id:"instance"},children:(s=this.props.instances)==null?void 0:s.map(i=>g.jsx(y.MenuItem,{value:i,children:i||"0"},`instance${i}`))})]})]})}),g.jsxs(y.DialogActions,{children:[g.jsx(y.Button,{variant:"contained",onClick:this.handleOk,disabled:!!this.state.error,color:"primary",startIcon:g.jsx(Do,{}),children:b.I18n.t("Ok")}),g.jsx(y.Button,{color:"grey",variant:"contained",onClick:()=>this.props.onClose(),startIcon:g.jsx(zs,{}),children:b.I18n.t("Cancel")})]})]})}}const fI={title:a=>({background:a.palette.error.main,color:a.palette.error.contrastText,"&>h2":{color:a.palette.error.contrastText}})};class Ec extends X.Component{handleOk=()=>{this.props.onClose()};render(){return g.jsxs(y.Dialog,{open:!0,maxWidth:"sm",fullWidth:!0,onClose:()=>this.handleOk(),"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[g.jsx(y.DialogTitle,{sx:fI.title,id:"alert-dialog-title",children:this.props.title||b.I18n.t("Error")}),g.jsx(y.DialogContent,{children:g.jsx(y.DialogContentText,{id:"alert-dialog-description",children:this.props.text||b.I18n.t("Unknown error!")})}),g.jsx(y.DialogActions,{children:g.jsx(y.Button,{variant:"contained",onClick:()=>this.handleOk(),color:"primary",autoFocus:!0,startIcon:g.jsx(Do,{}),children:b.I18n.t("Ok")})})]})}}const fr={icon:{width:24,height:24},filterWithButton:{width:"100%"},title:{fontWeight:"bold",marginTop:16}};class $I extends X.Component{constructor(s){super(s),this.state={instances:[],filter:window.localStorage.getItem("javascript.debug.filter")||"",showAskForStop:!1,jsInstance:window.localStorage.getItem("javascript.debug.instance")||"",jsInstanceHost:"",adapterToDebug:window.localStorage.getItem("javascript.debug.adapter")||""}}componentDidMount(){this.props.socket.getAdapterInstances().then(s=>{const i=s.filter(p=>{var m;return p&&!((m=p.common)!=null&&m.onlyWWW)}).map(p=>{var v,w,_;const m=p._id.replace(/^system\.adapter\./,""),[f]=m.split(".");return{id:m,enabled:(v=p.common)==null?void 0:v.enabled,host:(w=p.common)==null?void 0:w.host,icon:(_=p.common)!=null&&_.icon?`../../adapter/${f}/${p.common.icon}`:""}});i.sort((p,m)=>p.id>m.id?1:p.id<m.id?-1:0);let r=this.state.jsInstance||"";const l=this.state.jsInstance?i.find(p=>p.id===this.state.jsInstance):null;let u;if(!this.state.jsInstance||!l){const p=i.find(m=>m.id.startsWith("javascript."));u=(p==null?void 0:p.host)||"",r=(p==null?void 0:p.id)||""}else u=(l==null?void 0:l.host)||"";let d=this.state.adapterToDebug||"";d&&!i.find(p=>p.id===d)&&(d=""),this.setState({instances:i,jsInstance:r,adapterToDebug:d,jsInstanceHost:u})})}handleOk=()=>{var s;if((s=this.state.instances.find(i=>i.id===this.state.adapterToDebug))!=null&&s.enabled){this.props.socket.getObject(`system.adapter.${this.state.adapterToDebug}`).then(i=>{i&&(i.common.enabled=!1,this.props.socket.setObject(i._id,i).then(()=>this.props.onDebug(this.state.jsInstance,this.state.adapterToDebug)))});return}this.props.onDebug(this.state.jsInstance,this.state.adapterToDebug)};renderJavascriptList(){const s=this.state.instances.filter(i=>i.id.startsWith("javascript."));return s.length<2?null:g.jsxs(y.Grid2,{children:[g.jsx("div",{style:fr.title,children:b.I18n.t("Host")}),g.jsx(y.List,{component:"nav",children:s.map(i=>g.jsxs(y.ListItemButton,{component:"div",selected:this.state.jsInstance===i.id,onClick:()=>this.setState({jsInstance:i.id,jsInstanceHost:i.host}),children:[g.jsx(y.ListItemIcon,{children:g.jsx("img",{src:i.icon,alt:i.id,style:fr.icon})}),g.jsx(y.ListItemText,{primary:i.id})]},i.id))})]})}renderInstances(){if(!this.state.jsInstance)return g.jsx(y.Grid2,{});const s=this.state.instances.filter(i=>i.id!==this.state.jsInstance&&i.host===this.state.jsInstanceHost&&(!this.state.filter||i.id.includes(this.state.filter.toLowerCase())));return g.jsxs(y.Grid2,{children:[g.jsx("div",{style:fr.title,children:b.I18n.t("Instances")}),g.jsx(y.List,{component:"nav",children:s.map(i=>g.jsxs(y.ListItemButton,{selected:this.state.adapterToDebug===i.id,onDoubleClick:()=>this.setState({adapterToDebug:i.id},()=>this.handleOk()),onClick:()=>this.setState({adapterToDebug:i.id}),children:[g.jsx(y.ListItemIcon,{children:g.jsx("img",{src:i.icon,alt:i.id,style:fr.icon})}),g.jsx(y.ListItemText,{primary:i.id})]},i.id))})]})}render(){return g.jsxs(y.Dialog,{maxWidth:"md",fullWidth:!1,open:!0,onClose:()=>!1,"aria-labelledby":"confirmation-dialog-title",children:[g.jsx(y.DialogTitle,{id:"confirmation-dialog-title",children:this.props.title||b.I18n.t("Debug instance")}),g.jsx(y.DialogContent,{children:g.jsxs(y.Grid2,{container:!0,direction:"column",children:[g.jsx(y.Grid2,{children:g.jsx(y.Input,{style:fr.filterWithButton,value:this.state.filter,placeholder:b.I18n.t("Filter"),onChange:s=>{this.setState({filter:s.target.value}),window.localStorage.setItem("javascript.debug.filter",s.target.value)},endAdornment:g.jsx(y.InputAdornment,{position:"end",children:this.state.filter?g.jsx(y.IconButton,{size:"small","aria-label":"toggle password visibility",onClick:()=>this.setState({filter:""}),children:g.jsx(F_,{})}):""})})}),g.jsx(y.Grid2,{children:g.jsxs(y.Grid2,{container:!0,children:[this.renderJavascriptList(),this.renderInstances()]})})]})}),g.jsxs(y.DialogActions,{children:[g.jsx(y.Button,{variant:"contained",onClick:this.handleOk,disabled:!this.state.jsInstance||!this.state.adapterToDebug,color:"primary",startIcon:g.jsx(Do,{}),children:b.I18n.t("Start")}),g.jsx(y.Button,{color:"grey",variant:"contained",onClick:()=>this.props.onClose(),startIcon:g.jsx(zs,{}),children:b.I18n.t("Close")})]})]})}}function _w(a){if(!a)throw new Error("Password must be a non-empty string.")}function lg(a){return new TextEncoder().encode(a)}function bI(a){return new TextDecoder().decode(a)}function vI(a){let s="";for(let i=0;i<a.length;i++)s+=String.fromCharCode(a[i]);return btoa(s)}function yI(a){const s=atob(a),i=new Uint8Array(s.length);for(let r=0;r<s.length;r++)i[r]=s.charCodeAt(r);return i}function ww(a,s){const i=new Uint8Array(a.length);for(let r=0;r<a.length;r++)i[r]=a[r]^s[r%s.length];return i}function Vl(a,s){_w(a);const i=lg(s),r=lg(a),l=ww(i,r);return vI(l)}function cg(a,s){_w(a);const i=yI(s),r=lg(a),l=ww(i,r);return bI(l)}const _I=48,Ly=L_[400],By=BT[400],Py=B_[400],jt="script.js",Qi=`${jt}.common`,ao=`${jt}.global`,$r=350,wI=16,be={drawerPaper:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},toolbar:a=>({height:a.toolbar.height}),toolbarButtons:a=>({color:a.palette.mode==="dark"?"white !important":"black !important"}),iconButtonsDisabled:{filter:"grayscale(100%)",opacity:.5},toolbarSearch:{width:"calc(100% - 105px)",lineHeight:"34px",marginLeft:5},iconButtons:{width:32,height:32,padding:2},iconDropdownMenu:{paddingRight:5},menu:{width:"100%",height:"100%"},innerMenu:{width:"100%",height:"calc(100% - 76px)",overflowX:"hidden",overflowY:"auto"},listItemIcon:{minWidth:32},scriptIcon:{width:18,height:18,borderRadius:2,marginTop:4,marginBottom:4,marginLeft:8,marginRight:4},folder:{cursor:"pointer",padding:0,userSelect:"none"},folderReorder:{opacity:.3,transitionDuration:"0.5s",transitionProperty:"opacity"},folderIcon:{width:20,height:20},folderIconReorder:{paddingTop:4,paddingBottom:4,paddingLeft:8,paddingRight:4},folderIconNoReorder:{cursor:"pointer",paddingTop:4,paddingBottom:4,paddingLeft:8,paddingRight:4},script:{cursor:"pointer",padding:0,userSelect:"none"},scriptReorder:{opacity:1,transitionDuration:"0.5s",transitionProperty:"opacity"},reorder:{},selected:window.vendorPrefix?a=>({backgroundColor:a.palette.primary.main,color:a.palette.text.primary}):{backgroundColor:"#164477",color:"white"},instances:{color:"gray",fontSize:"smaller"},childrenCount:{fontSize:10,opacity:.4},footer:{height:24,display:"flex"},footerButtons:a=>({"& img":{color:a.palette.mode==="dark"?"#ffffff":"#111111",cursor:"pointer",mt:"1px",mr:"2px",height:22,width:22,"&:hover":{backgroundColor:"#dbdbdb"}},"& svg":{color:a.palette.mode==="dark"?"#ffffff":"#111111",cursor:"pointer",mt:"1px",mr:"2px",height:22,width:22,"&:hover":{backgroundColor:"#dbdbdb"}}}),footerButtonsRight:{float:"right"}},en={Blockly:bw,"Javascript/js":Xl,def:Xl,Rules:yw,"TypeScript/ts":vw};function ug(a,s,i){var r;return i=i||b.I18n.getLanguage(),(r=s==null?void 0:s.common)!=null&&r.name?typeof s.common.name=="object"?(s.common.name[i]||s.common.name.en||a.replace(/^script\.js./,"")).toString():s.common.name.toString():a.replace(/^script\.js./,"")}function Fy(a){var l;const s=[{id:jt,depth:0,index:0,parent:null,title:"root",type:"folder",parentIndex:null}],i=Object.keys(a);for(let u=0;u<i.length;u++){const d=a[i[u]],p=i[u].split(".");p.pop(),d.type==="script"?s.push({id:i[u],title:ug(i[u],d),enabled:!!((l=d==null?void 0:d.common)!=null&&l.enabled),depth:p.length-1,type:d.common.engineType,parent:p.length>1?p.join("."):null,instance:d.common.engine?parseInt(d.common.engine.split(".").pop(),10)||0:null,index:0,parentIndex:0}):s.push({id:i[u],title:ug(i[u],d),depth:p.length-1,type:"folder",parent:p.length>1?p.join("."):null,index:0,parentIndex:null})}let r;do r=!1,s.forEach(u=>{if(u.parent&&!s.find(p=>p.id===u.parent)){const p=u.parent.split(".");p.pop(),s.push({id:u.parent,title:u.parent.split(".").pop()||"",depth:p.length-1,type:"folder",parent:p.length>1?p.join("."):null,index:0,parentIndex:null}),r=!0}});while(r);return s.sort((u,d)=>{const p=u.id.toLowerCase(),m=d.id.toLowerCase();return u.type==="folder"&&d.type!=="folder"?-1:d.type==="folder"&&u.type!=="folder"||p>m?1:p<m?-1:0}),s.forEach((u,d)=>u.index=d),s.forEach(u=>{if(u.parent){const d=s.find(p=>p.id===u.parent);d&&(u.parentIndex=d.index)}}),s}function CI(a){const{onDrop:s}=a,[{isOver:i,isOverAny:r},l]=qE({accept:"script",drop:u=>i?s(u):void 0,collect:u=>({isOver:u.isOver({shallow:!0}),isOverAny:u.isOver()})});return g.jsx("div",{ref:l,style:{background:i?"#40adff":void 0,opacity:r?.7:void 0},children:a.children},a.folderName)}function jy(a){const{name:s}=a,[{opacity:i},r]=HE({type:"script",item:()=>({name:s}),collect:l=>({opacity:l.isDragging()?.3:1})});return g.jsx("div",{ref:r,style:{opacity:i,transform:"translate3d(0, 0, 0)"},children:a.children},s)}class lo extends X.Component{inputRef;filterTimer;problems;problemsTimer;onProblemUpdatedBound;parent=null;constructor(s){super(s);const i=window.localStorage?window.localStorage.getItem("SideMenu.expanded"):"[]";let r;try{r=JSON.parse(i||"[]")||[]}catch{r=[]}this.inputRef=X.createRef(),this.state={listItems:Fy(s.scripts||{}),expanded:r,problems:[],reorder:!1,themeName:this.props.themeName,selected:window.localStorage&&window.localStorage.getItem("SideMenu.selected")||null,creatingScript:null,creatingFolder:!1,copingScript:"",renaming:null,deleting:null,choosingType:!1,errorText:"",instances:s.instances||[],menuOpened:!1,menuAnchorEl:null,menuAnchorFilterEl:null,searchMode:!1,expertMode:this.props.expertMode,searchText:"",width:this.props.width||300,typeFilter:window.localStorage&&window.localStorage.getItem("SideMenu.typeFilter")||"",statusFilter:window.localStorage&&window.localStorage.getItem("SideMenu.statusFilter")||"",runningInstances:this.props.runningInstances||{},scriptsHash:s.scriptsHash,showAdapterDebug:!1,isAllZeroInstances:!1};const l=this.ensureSelectedIsVisible();l&&Object.assign(this.state,{expanded:l}),this.filterTimer=null,Object.assign(this.state,{isAllZeroInstances:this.getIsAllZeroInstances()}),this.problems=null,this.problemsTimer=null,this.onProblemUpdatedBound=this.onProblemUpdated.bind(this)}readProblems(s,i){var r,l;if(i||(i=Object.keys(this.props.scripts)),!i||!i.length)s&&s();else{const u=i.shift(),d=this.props.scripts[u];if(((r=this.props.scripts)==null?void 0:r[u].type)==="script"&&((l=d.common)!=null&&l.enabled)&&!u.match(/^script\.js\.global\./)){const p=d.common.engine.split(".").pop(),m=this,f=`javascript.${p}.scriptProblem.${u.substring(jt.length+1)}`;this.props.socket.getState(f).then(v=>{m.onProblemUpdated(f,v),setTimeout(()=>m.readProblems(s,i),0)})}else setTimeout(()=>this.readProblems(s,i),0)}}componentDidMount(){this.readProblems(()=>{this.props.instances.forEach(s=>{this.props.socket.subscribeState(`javascript.${s}.scriptProblem.*`,this.onProblemUpdatedBound)})})}componentWillUnmount(){this.props.instances.forEach(s=>{this.props.socket.unsubscribeState(`javascript.${s}.scriptProblem.*`,this.onProblemUpdatedBound)})}onProblemUpdated(s,i){if(!i||!s)return;s=`${jt}.${s.replace(/^javascript\.\d+\.scriptProblem\./,"")}`,this.problems||(this.problems=JSON.parse(JSON.stringify(this.state.problems))||[]);let r=!1;if(i.val)this.problems.includes(s)||(this.problems.push(s),r=!0);else{const l=this.problems.indexOf(s);l!==-1&&(this.problems.splice(l,1),r=!0)}r&&!this.problemsTimer&&(this.problemsTimer=setTimeout(()=>{this.problemsTimer=null,this.setState({problems:this.problems}),this.problems=null},300))}static filterListStatic(s,i,r,l,u){i=JSON.parse(JSON.stringify(i));let d=!1;const p={listItems:i};if(s&&r&&l){const m=l.toLowerCase();if(i.forEach(f=>{var k;const v=f.title.toLowerCase();f.filteredPartly=!1;let w=v.includes(m);const _=(k=u==null?void 0:u[f.id])==null?void 0:k.common;if(!w&&(_!=null&&_.source))if(_.engineType==="Blockly"){const S=_.source.lastIndexOf("//");w=_.source.substring(0,S).toLowerCase().includes(m)}else w=_.source.toLowerCase().includes(m);w?f.filtered&&(f.filtered=!1,d=!0):f.filtered||(f.filtered=!0,d=!0)}),d)for(let f=i.length-1;f>=0;f--){const v=i[f];if(!v.filtered||v.filteredPartly){let w=v;do w!=null&&w.parent&&i[w.parentIndex]&&(d=!0,i[w.parentIndex].filteredPartly=!0),w=w!=null&&w.parent&&i[w.parentIndex]?i[w.parentIndex]:null;while(w)}}}else i.forEach(m=>{(m.filtered||m.filteredPartly)&&(m.filtered=!1,m.filteredPartly=!1,d=!0)}),s||(p.searchText="",p.searchMode=!1,d=!0);return d?p:null}filterList(s,i){const r=lo.filterListStatic(s,this.state.listItems,this.state.searchMode,this.state.searchText,this.props.scripts);r?this.setState(r,()=>i&&i()):i&&i()}static ensureSelectedIsVisibleStatic(s,i,r){i=JSON.parse(JSON.stringify(i));let l=!1,u=typeof s=="object"?s:r.find(d=>d.id===s);do{if(u!=null&&u.parent){const d=u.parent;u=r.find(p=>p.id===d)}else u=void 0;u&&(i.includes(u.id)||(i.push(u.id),l=!0))}while(u);return l?i:null}ensureSelectedIsVisible(s,i){return lo.ensureSelectedIsVisibleStatic(s||this.state.selected,i||this.state.expanded,this.state.listItems)}static getDerivedStateFromProps(s,i){const r={};let l=!1;if(i.expertMode!==s.expertMode&&(l=!0,r.expertMode=s.expertMode),i.scriptsHash!==s.scriptsHash&&s.scripts){const u=Fy(s.scripts||{});if(r.listItems=u,i.searchText){const m=lo.filterListStatic(!0,u,i.searchMode,i.searchText,s.scripts);m&&Object.assign(r,m)}const d=lo.getIsAllZeroInstancesStatic(u,s.instances||[]),p=lo.ensureSelectedIsVisibleStatic(i.selected,i.expanded,i.listItems);r.isAllZeroInstances=d,p&&(r.expanded=p),l=!0}if(i.width!==s.width&&(l=!0,r.width=s.width),i.themeName!==s.themeName&&(l=!0,r.themeName=s.themeName),s.selectId&&i.selected!==s.selectId){const u=i.listItems.find(d=>d.id===s.selectId);if(!i.reorder&&u){const d=lo.ensureSelectedIsVisibleStatic(u,i.expanded,i.listItems);r.selected=u.id,d&&(r.expanded=d),l=!0,window.localStorage&&window.localStorage.setItem("SideMenu.selected",u.id)}}return l?r:null}static getIsAllZeroInstancesStatic(s,i){let r=!i[0]&&i.length<=1;return r&&s.forEach(l=>{l.type!=="folder"&&l.instance!==0&&(r=!1)}),r}getIsAllZeroInstances(s,i){return s=s||this.state.listItems,i=i||this.state.instances,lo.getIsAllZeroInstancesStatic(s||this.state.listItems,i||this.state.instances)}saveExpanded(s){window.localStorage.setItem("SideMenu.expanded",JSON.stringify(s||this.state.expanded))}showError(s){this.setState({errorText:s})}onToggle(s,i){if(i==null||i.stopPropagation(),s===jt)return;const r=[...this.state.expanded],l=r.indexOf(s);l!==-1?(r.splice(l,1),this.state.selected&&this.state.selected.startsWith(`${s}.`)&&window.localStorage&&window.localStorage.setItem("SideMenu.selected",s)):(r.push(s),r.sort()),this.setState({expanded:r}),this.saveExpanded(r)}renderItemButtonsOnEnd(s,i){if(this.state.reorder)return null;if(s.type!=="folder"){let r=s.enabled?Ly:Py;return s.enabled&&this.state.problems.includes(s.id)&&(r=By),[g.jsx(y.IconButton,{onClick:l=>{l.stopPropagation(),this.props.onEnableDisable&&this.props.onEnableDisable(s.id,!s.enabled)},title:s.enabled?b.I18n.t("Pause script"):b.I18n.t("Run script"),disabled:this.props.debugMode,style:{...be.iconButtons,...this.props.debugMode?be.iconButtonsDisabled:void 0,color:r},size:"medium",children:s.enabled?g.jsx(Hl,{}):g.jsx(sg,{})},"startStop"),this.state.width>$r?g.jsx(y.IconButton,{style:this.props.debugMode?be.iconButtonsDisabled:void 0,title:b.I18n.t("Delete script"),disabled:s.id===ao||s.id===Qi||this.props.debugMode,onClick:l=>this.onDelete(s,l),size:"medium",children:g.jsx(zl,{})},"delete"):null,g.jsx(y.IconButton,{style:this.props.debugMode?be.iconButtonsDisabled:void 0,disabled:this.props.debugMode,title:b.I18n.t("Edit script or just double click"),onClick:l=>this.onEdit(s,l),size:"medium",children:g.jsx(jk,{})},"openInEdit")]}return this.state.width>$r&&s.id!==jt&&s.id!==Qi&&s.id!==ao&&!(i!=null&&i.length)?g.jsx(y.IconButton,{style:this.props.debugMode?be.iconButtonsDisabled:void 0,title:b.I18n.t("Delete folder"),disabled:s.id===ao||s.id===Qi||this.props.debugMode,onClick:r=>this.onDelete(s,r),size:"medium",children:g.jsx(zl,{})},"delete"):null}onDelete(s,i){return i==null||i.stopPropagation(),new Promise(r=>{if(!s){r();return}typeof s!="object"?this.setState({deleting:s},()=>r()):this.setState({deleting:s.id},()=>r())})}onEdit(s,i){this.onClick(s,i),this.props.onEdit&&this.props.onEdit(s.id)}getTextStyle(s){return!this.state.reorder&&s.type!=="folder"?{width:`calc(100% - ${this.state.width>$r?185:137}px)`,overflow:"hidden",whiteSpace:"nowrap",flex:"none",padding:"0 16px 0 0"}:{whiteSpace:"nowrap",padding:"0 16px 0 0"}}onClick(s,i){if(i==null||i.stopPropagation(),!this.state.reorder&&s){const r=this.ensureSelectedIsVisible(s),l={selected:s.id};r&&(l.expanded=r),this.setState(l),window.localStorage&&window.localStorage.setItem("SideMenu.selected",s.id)}}onDblClick(s,i){i==null||i.stopPropagation(),!this.state.reorder&&(s.type==="folder"?this.onToggle(s.id):this.onEdit(s))}isFilteredOut(s){var i,r;return s.filtered&&!s.filteredPartly||this.state.typeFilter&&s.type!=="folder"&&s.type!==this.state.typeFilter||!this.state.expertMode&&((r=(i=this.props.scripts[s.id])==null?void 0:i.native)!=null&&r.protected)||this.state.statusFilter&&s.type!=="folder"&&(this.state.statusFilter==="running"&&!s.enabled||this.state.statusFilter==="paused"&&s.enabled||this.state.statusFilter==="problems"&&(!s.enabled||this.state.problems.indexOf(s.id)===-1))?!0:s.id===ao&&!this.state.expertMode}renderListItem(s,i,r){var _;if(s.id===jt&&!this.state.reorder)return null;const l=(this.state.reorder?s.depth:s.depth-1)*wI;let u=s.title;if(this.state.searchText){const k=u.toLowerCase().indexOf(this.state.searchText.toLowerCase());k!==-1&&(u=[g.jsx("span",{children:u.substring(0,k)},"first"),g.jsx("span",{style:{color:"orange"},children:u.substring(k,k+this.state.searchText.length)},"second"),g.jsx("span",{children:u.substring(k+this.state.searchText.length)},"third")])}!this.state.isAllZeroInstances&&s.type!=="folder"&&(u=[g.jsx("span",{children:u},"title"),g.jsxs("span",{title:b.I18n.t("Instance"),style:be.instances,children:["[",s.instance,"]"]},"instance")]);const d=this.state.reorder&&!this.props.debugMode,p={marginLeft:l,cursor:s.type==="folder"&&d?"default":"inherit",width:`calc(100% - ${l}px)`};d||(p.opacity=s.filteredPartly?.5:1),s.id===ao&&s.id!==this.state.selected&&(p.color="#00a200");let m=s.id===jt;!m&&i&&(m=this.state.expanded.includes(s.id));let f;s.type==="folder"?f={...be.folderIcon,...d?be.folderIconReorder:be.folderIconNoReorder}:f={...be.scriptIcon},s.id===ao?f.color="#356956":s.id===Qi&&(f.color="#4899e1");let v=null;(r&&r.length||i&&i.length)&&(v=g.jsx("span",{style:be.childrenCount,children:r&&r.length!==i.length?`${r.length}(${i.length})`:i.length}));const w={...s.type==="folder"?be.folder:be.script,...d?be.reorder:void 0,...d&&s.type!=="folder"?be.scriptReorder:void 0,...d&&s.type==="folder"?be.folderReorder:void 0,...p};return g.jsxs(y.ListItem,{style:w,sx:s.id===this.state.selected&&!d?be.selected:void 0,className:b.Utils.clsx(d&&s.type==="folder"&&"folder-reorder",d&&s.type!=="folder"&&"script-reorder"),onClick:k=>this.onClick(s,k),onDoubleClick:k=>this.onDblClick(s,k),secondaryAction:this.renderItemButtonsOnEnd(s,i),children:[(_=this.props.scripts[s.id].native)!=null&&_.protected?g.jsx(wy,{style:{color:"orange",position:"absolute",right:5,width:10,height:10}}):null,g.jsx(y.ListItemIcon,{style:be.listItemIcon,children:s.type==="folder"?d||m?g.jsx(UT,{style:f,onClick:k=>!d&&this.onToggle(s.id,k)}):g.jsx(HT,{style:f,onClick:k=>!d&&this.onToggle(s.id,k)}):g.jsx("img",{style:f,alt:s.type,src:en[s.type]||en.def})}),g.jsx(y.ListItemText,{sx:{"& .MuiListItemText-primary":s.id===this.state.selected&&!d?be.selected:void 0},style:this.getTextStyle(s),primary:g.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[u,v]})})]},s.id)}onDragFinish(s,i){let r=`${i}.${s.split(".").pop()}`;r!==s&&(this.state.listItems.find(l=>l.id===r)&&(r+=`_${b.I18n.t("copy")}`),this.props.onRename&&this.props.onRename(s,r))}renderOneItem(s,i){const r=this.state.statusFilter||this.state.typeFilter?s.filter(f=>f.parent===i.id?!this.isFilteredOut(f):!1):[],l=s.filter(f=>f.parent===i.id);if(this.isFilteredOut(i)||i.type==="folder"&&(this.state.statusFilter||this.state.typeFilter)&&!r.length)return null;const u=this.state.reorder&&!this.props.debugMode,d=this.renderListItem(i,l,r),p=[];let m;return l&&(u||this.state.expanded.includes(i.id)||i.id===jt)&&(m=l.map(f=>this.renderOneItem(s,f))),u?i.type==="folder"?p.push(g.jsxs(CI,{onDrop:f=>this.onDragFinish(f.name,i.id),folderName:i.id,children:[g.jsx(jy,{name:i.id,children:d},`draggable_${i.id}`),m||null]},`droppable_${i.id}`)):p.push(g.jsxs(jy,{name:i.id,children:[d,m||null]},`draggable_${i.id}`)):(p.push(d),m==null||m.forEach(f=>p.push(f))),p}renderAllItems(s){const i=s.filter(r=>!r.parent).map(r=>this.renderOneItem(s,r));return g.jsx(y.List,{dense:!0,disablePadding:!0,sx:be.mainList,children:i})}onAddNew(s){s==null||s.stopPropagation();let i=this.state.listItems.find(l=>l.id===this.state.selected),r=jt;for(;i&&i.type!=="folder";)i=this.state.listItems[i.parentIndex];i&&(r=i.id),this.parent=r,this.setState({choosingType:!0})}onCopy(s,i){s==null||s.stopPropagation();let r=this.state.listItems.find(u=>u.id===i),l=jt;for(;r&&r.type!=="folder";)r=this.state.listItems[r.parentIndex];r&&(l=r.id),this.parent=l,this.setState({copingScript:i||""})}onAddNewFolder(s){s==null||s.stopPropagation();let i=this.state.listItems.find(l=>l.id===this.state.selected),r=jt;for(;i&&i.type!=="folder";)i=this.state.listItems[i.parentIndex];i&&(r=i.id),this.parent=r,this.setState({creatingFolder:!0})}onRename(s){s==null||s.stopPropagation(),this.setState({renaming:this.state.selected})}getUniqueName(s){let i=1,r=`${b.I18n.t("Script")} `;if(s){const l=ug(s,this.props.scripts[s]),u=l.match(/\d+$/);u?(r=l.replace(/\d+$/,""),i=parseInt(u[0],10)+1):r=l}for(;this.state.listItems.find(l=>l.id===`${this.parent}.${r.replace(/\.\s/g,"_")}${i}`);)i++;return r+i}getUniqueFolderName(){let s=1;for(;this.state.listItems.find(i=>i.id===`${this.parent}.${b.I18n.t("Folder")}_${s}`);)s++;return`${b.I18n.t("Folder")} ${s}`}onCloseMenu(s){this.setState({menuOpened:!1,menuAnchorEl:null,menuAnchorFilterEl:null},s)}getMainMenu(s,i){var l,u;const r=this.state.expertMode&&!!Object.keys(this.props.changedScripts).find(d=>{var p,m;return this.props.changedScripts[d]&&((m=(p=this.props.scripts[d])==null?void 0:p.native)==null?void 0:m.protected)});return g.jsxs(y.Menu,{id:"long-menu",anchorEl:this.state.menuAnchorEl,open:this.state.menuOpened,onClose:()=>this.setState({menuOpened:!1,menuAnchorEl:null}),slotProps:{paper:{style:{maxHeight:_I*7.5}}},children:[this.state.width<=$r?g.jsxs(y.MenuItem,{disabled:this.props.debugMode||!this.state.selected||this.state.selected===ao||this.state.selected===Qi||!!(s!=null&&s.length),onClick:d=>{if(d.stopPropagation(),d.preventDefault(),this.state.listItems.find(p=>p.parent===this.state.selected)){this.showError(b.I18n.t("Cannot delete non empty item!"));return}this.setState({menuOpened:!1,menuAnchorEl:null},()=>this.onDelete(this.state.selected).then(()=>{}))},children:[g.jsx(zl,{style:{...be.iconDropdownMenu,color:"red"}}),b.I18n.t("Delete")]},"delete"):null,g.jsxs(y.MenuItem,{disabled:this.props.debugMode||r,selected:this.state.expertMode,onClick:d=>{d.stopPropagation(),d.preventDefault(),this.onCloseMenu(()=>this.props.onExpertModeChange&&this.props.onExpertModeChange(!this.state.expertMode))},children:[g.jsx(b.IconExpert,{style:{...be.iconDropdownMenu,color:this.state.expertMode?"orange":"inherit"}}),b.I18n.t("Expert mode")]},"expertMode"),this.props.onExport&&g.jsxs(y.MenuItem,{onClick:d=>{d.stopPropagation(),d.preventDefault(),this.onCloseMenu(()=>this.props.onExport())},children:[g.jsx(Yl,{style:be.iconDropdownMenu}),b.I18n.t("Export all scripts")]},"exportAll"),this.props.onImport&&g.jsxs(y.MenuItem,{disabled:this.props.debugMode,onClick:d=>{d.stopPropagation(),d.preventDefault(),this.onCloseMenu(()=>this.props.onImport())},children:[g.jsx(Qp,{style:be.iconDropdownMenu}),b.I18n.t("Import scripts")]},"import"),this.props.onThemeChange&&g.jsxs(y.MenuItem,{onClick:()=>this.onCloseMenu(()=>{this.props.onThemeChange&&this.props.onThemeChange(b.Utils.toggleTheme(this.state.themeName))}),children:[g.jsx(Uk,{style:be.iconDropdownMenu}),b.I18n.t('Change theme (actual "%s")',this.state.themeName)]},"dark"),this.props.onAddNew&&g.jsxs(y.MenuItem,{disabled:!this.state.selected||!i||i.type==="folder",onClick:d=>{const p=this.state.selected;this.onCloseMenu(()=>this.onCopy(d,p))},children:[g.jsx(WT,{style:be.iconDropdownMenu}),b.I18n.t("Copy script")]},"copy"),this.state.expertMode&&g.jsxs(y.MenuItem,{disabled:this.props.debugMode,onClick:d=>{d.stopPropagation(),d.preventDefault(),this.onCloseMenu(()=>this.setState({showAdapterDebug:!0}))},children:[g.jsx(Nk,{style:be.iconDropdownMenu}),b.I18n.t("Debug instance")]},"debugInstance"),this.state.selected&&this.props.password&&this.props.scripts[this.state.selected].type==="script"?g.jsxs(y.MenuItem,{disabled:this.props.debugMode||this.props.changedScripts[this.state.selected],onClick:d=>{d.stopPropagation(),d.preventDefault(),this.onCloseMenu(async()=>{var m;const p=await this.props.socket.getObject(this.state.selected);p&&((m=p.native)!=null&&m.protected?(delete p.native.protected,p.common.source=cg(this.props.password,p.common.source||"")):(p.native||={},p.native.protected=!0,p.common.source=Vl(this.props.password,p.common.source||"")),await this.props.socket.setObject(p._id,p))})},children:[g.jsx(wy,{style:{...be.iconDropdownMenu,color:"orange"}}),(l=this.props.scripts[this.state.selected].native)!=null&&l.protected?g.jsx("span",{style:{color:(u=this.props.scripts[this.state.selected].native)!=null&&u.protected?"orange":void 0},children:b.I18n.t("Unprotect script")}):b.I18n.t("Protect script")]},"encrypt"):null]},"menu")}getToolbarButtons(){const s=[],i=this.state.reorder&&!this.props.debugMode;if(this.state.searchMode&&!this.props.debugMode)s.push(g.jsx(y.Input,{value:this.state.searchText,style:be.toolbarSearch,ref:this.inputRef,autoFocus:!0,placeholder:b.I18n.t("Search..."),onChange:r=>{this.setState({searchText:r.target.value}),this.filterTimer&&clearTimeout(this.filterTimer),this.filterTimer=setTimeout(()=>{this.filterTimer=null,this.filterList(!0),this.props.onSearch&&this.props.onSearch(this.state.searchText)},400)}},"searchInput")),s.push(g.jsx(y.IconButton,{sx:be.toolbarButtons,style:{float:"right"},title:b.I18n.t("End search mode"),onClick:r=>{r.stopPropagation(),this.filterList(!1,()=>this.props.onSearch&&this.props.onSearch(this.state.searchText))},size:"medium",children:g.jsx(Pk,{})},"disableSearch")),this.state.searchText&&s.push(g.jsx(y.IconButton,{title:b.I18n.t("Clear search input"),sx:be.toolbarButtons,style:{marginTop:7,float:"right"},onClick:r=>{r.stopPropagation(),this.setState({searchText:""},()=>{this.filterList(!0),this.props.onSearch&&this.props.onSearch(this.state.searchText)})},size:"medium",children:g.jsx(F_,{fontSize:"small"})},"cleanSearch"));else{if(!i){s.push(g.jsx(y.IconButton,{"aria-label":"More","aria-owns":this.state.menuOpened?"long-menu":void 0,title:b.I18n.t("Menu"),"aria-haspopup":"true",onClick:u=>{u.stopPropagation(),u.preventDefault(),this.setState({menuOpened:!0,menuAnchorEl:u.currentTarget})},size:"medium",children:g.jsx(zk,{})},"menuButton"));const r=this.state.listItems.find(u=>u.id===this.state.selected);let l;r&&this.state.width<=$r&&r.type==="folder"&&(l=this.state.listItems.filter(u=>u.parent===this.state.selected)),s.push(this.getMainMenu(l,r)),s.push(g.jsx(y.IconButton,{disabled:this.props.debugMode,title:b.I18n.t("Create new script"),sx:{...be.toolbarButtons,...this.props.debugMode?be.iconButtonsDisabled:void 0},style:{color:i?"red":"inherit"},onClick:u=>this.onAddNew(u),size:"medium",children:g.jsx(VT,{})},"new-script")),s.push(g.jsx(y.IconButton,{disabled:this.props.debugMode,title:b.I18n.t("Create new folder"),sx:{...be.toolbarButtons,...this.props.debugMode?be.iconButtonsDisabled:void 0},style:{color:i?"red":"inherit"},onClick:u=>this.onAddNewFolder(u),size:"medium",children:g.jsx(GT,{})},"new-folder"))}s.push(g.jsx(y.IconButton,{disabled:i||this.props.debugMode,sx:{...be.toolbarButtons,...this.props.debugMode?be.iconButtonsDisabled:void 0},title:b.I18n.t("Search in scripts"),style:{float:"right",opacity:this.props.debugMode?.5:i?0:1},onClick:r=>{r.stopPropagation(),this.setState({searchMode:!0})},size:"medium",children:g.jsx(Wk,{})},"search")),s.push(g.jsx(y.IconButton,{disabled:this.props.debugMode,title:b.I18n.t("Reorder scripts in folders"),sx:{...be.toolbarButtons,...this.props.debugMode?be.iconButtonsDisabled:void 0},style:{color:i?"red":"inherit",float:"right"},onClick:r=>{r.stopPropagation(),this.setState({reorder:!this.state.reorder})},size:"medium",children:g.jsx(Yk,{})},"reorder")),!i&&this.state.selected&&this.state.selected!==ao&&this.state.selected!==Qi&&s.push(g.jsx(y.IconButton,{sx:{...be.toolbarButtons,...this.props.debugMode?be.iconButtonsDisabled:void 0},disabled:this.props.debugMode,title:b.I18n.t("Rename"),onClick:r=>this.onRename(r),size:"medium",children:g.jsx(KT,{})},"rename")),s.push(g.jsxs("span",{style:{opacity:.5,fontSize:10},children:["v",this.props.version]},"version"))}return s}getFolders(){const s=[{id:jt,name:b.I18n.t("Root folder")}];return this.state.listItems.forEach(i=>{i.type==="folder"&&i.id!==jt&&(!i.id.startsWith(ao)||this.state.expertMode)&&s.push({id:i.id,name:i.title})}),s}onCollapseAll(){this.setState({expanded:[]}),this.saveExpanded([])}onExpandAll(){const s=[];this.state.listItems.forEach(i=>this.state.listItems.find(r=>r.parent===i.id)&&s.push(i.id)),this.setState({expanded:s}),this.saveExpanded(s)}getBottomButtons(){return this.state.reorder||this.props.debugMode?null:[g.jsx(y.Box,{sx:be.footerButtons,title:b.I18n.t("Show only running scripts"),onClick:s=>{s.stopPropagation(),s.preventDefault();const i=this.state.statusFilter==="running"?"":"running";window.localStorage&&window.localStorage.setItem("SideMenu.statusFilter",i),this.setState({statusFilter:i})},children:g.jsx(Hl,{style:{color:Ly,opacity:this.state.statusFilter==="running"?1:.3,background:this.state.statusFilter==="running"?"gray":"inherit"}})},"filterByRunning"),g.jsx(y.Box,{sx:be.footerButtons,title:b.I18n.t("Show only paused scripts"),onClick:()=>{const s=this.state.statusFilter==="paused"?"":"paused";window.localStorage&&window.localStorage.setItem("SideMenu.statusFilter",s),this.setState({statusFilter:s})},children:g.jsx(sg,{style:{color:Py,opacity:this.state.statusFilter==="paused"?1:.3,background:this.state.statusFilter==="paused"?"gray":"inherit"}})},"filterByPaused"),g.jsx(y.Box,{sx:be.footerButtons,style:{marginRight:16},title:b.I18n.t("Show only scripts with problems"),onClick:()=>{const s=this.state.statusFilter==="problems"?"":"problems";window.localStorage&&window.localStorage.setItem("SideMenu.statusFilter",s),this.setState({statusFilter:s})},children:g.jsx(Hl,{style:{color:By,opacity:this.state.statusFilter==="problems"?1:.3,background:this.state.statusFilter==="problems"?"gray":"inherit"}})},"filterByProblem"),g.jsx(y.Box,{sx:be.footerButtons,children:g.jsx("img",{alt:"Blockly",style:{opacity:this.state.typeFilter==="Blockly"?1:.3,background:this.state.typeFilter==="Blockly"?"gray":"inherit"},src:en.Blockly,onClick:()=>{const s=this.state.typeFilter==="Blockly"?"":"Blockly";window.localStorage&&window.localStorage.setItem("SideMenu.typeFilter",s),this.setState({typeFilter:s})}})},"filterBlockly"),g.jsx(y.Box,{sx:be.footerButtons,children:g.jsx("img",{alt:"Javascript",style:{opacity:this.state.typeFilter==="Javascript/js"?1:.3,background:this.state.typeFilter==="Javascript/js"?"gray":"inherit"},src:en["Javascript/js"],onClick:()=>{const s=this.state.typeFilter==="Javascript/js"?"":"Javascript/js";window.localStorage&&window.localStorage.setItem("SideMenu.typeFilter",s),this.setState({typeFilter:s})}})},"filterJS"),g.jsx(y.Box,{sx:be.footerButtons,children:g.jsx("img",{alt:"TypeScript",style:{opacity:this.state.typeFilter==="TypeScript/ts"?1:.3,background:this.state.typeFilter==="TypeScript/ts"?"gray":"inherit"},src:en["TypeScript/ts"],onClick:()=>{const s=this.state.typeFilter==="TypeScript/ts"?"":"TypeScript/ts";window.localStorage&&window.localStorage.setItem("SideMenu.typeFilter",s),this.setState({typeFilter:s})}})},"filterTS"),g.jsx(y.Box,{sx:be.footerButtons,children:g.jsx("img",{alt:"Rules",style:{opacity:this.state.typeFilter==="Rules"?1:.3,background:this.state.typeFilter==="Rules"?"gray":"inherit"},src:en.Rules,onClick:()=>{const s=this.state.typeFilter==="Rules"?"":"Rules";window.localStorage&&window.localStorage.setItem("SideMenu.typeFilter",s),this.setState({typeFilter:s})}})},"filterRules"),g.jsx("div",{style:{flexGrow:1}},"padding"),g.jsx(y.Box,{sx:be.footerButtons,onClick:()=>this.onExpandAll(),title:b.I18n.t("Expand all"),children:g.jsx(Xk,{style:be.footerButtonsRight})},"expandAll"),this.state.expanded.length?g.jsx(y.Box,{sx:be.footerButtons,onClick:()=>this.onCollapseAll(),title:b.I18n.t("Collapse all"),children:g.jsx(Jk,{style:be.footerButtonsRight})},"collapseAll"):g.jsx("div",{style:{height:22,width:24}})]}getAdapterDebugDialog(){return this.state.showAdapterDebug?g.jsx($I,{socket:this.props.socket,onClose:()=>this.setState({showAdapterDebug:!1}),onDebug:(s,i)=>this.setState({showAdapterDebug:!1},()=>this.props.onDebugInstance({instance:s,adapter:i}))},"debug"):null}render(){var r,l,u;const s=this.state.renaming?this.state.listItems.find(d=>d.id===this.state.renaming):void 0,i=this.state.copingScript&&this.props.scripts[this.state.copingScript].type==="script"?this.props.scripts[this.state.copingScript]:void 0;return[g.jsxs(y.Drawer,{variant:"permanent",style:be.menu,sx:{"& .MuiDrawer-paper":be.drawerPaper},anchor:"left",onClick:()=>this.onClick({id:""}),children:[g.jsx(y.Box,{sx:be.toolbar,children:this.getToolbarButtons()}),g.jsx(y.Divider,{}),g.jsx(nw,{backend:$w,children:g.jsx("div",{style:be.innerMenu,children:this.renderAllItems(this.state.listItems)})}),g.jsx(y.Divider,{}),g.jsx("div",{style:be.footer,children:this.getBottomButtons()})]},"drawer"),s?g.jsx(Mg,{name:s.title,id:this.state.renaming||"",folder:s.type==="folder",instance:s.instance,instances:this.props.instances,onClose:()=>this.setState({renaming:null}),onRename:(d,p,m,f)=>this.props.onRename&&this.props.onRename(d,p,m,f)},"dialog-rename"):null,this.state.deleting?g.jsx(dI,{name:this.state.listItems.find(d=>d.id===this.state.deleting).title,id:this.state.deleting,onClose:()=>this.setState({deleting:null}),onDelete:d=>this.props.onDelete&&this.props.onDelete(d)},"dialog-delete"):null,this.state.choosingType?g.jsx(rn,{onClose:d=>{const p={choosingType:!1};d&&(p.creatingScript=d),this.setState(p)}},"dialog-script-type"):null,this.state.creatingScript?g.jsx(xp,{onClose:()=>this.setState({creatingScript:null}),title:b.I18n.t("Create new script"),name:this.getUniqueName(),parents:this.getFolders(),folder:!1,existingItems:this.state.listItems.map(d=>d.id),instance:this.props.instances[0]||0,instances:this.props.instances,type:this.state.creatingScript,parent:this.parent,onAdd:(d,p,m,f)=>this.props.onAddNew&&this.props.onAddNew(d,p,!1,m,f)},"dialog-new-script"):null,this.state.copingScript?g.jsx(xp,{onClose:()=>this.setState({copingScript:""}),title:b.I18n.t("Copy script"),name:this.getUniqueName(this.state.copingScript),parents:this.getFolders(),folder:!1,instance:parseInt((l=(r=i==null?void 0:i.common)==null?void 0:r.engine)==null?void 0:l.split(".").pop(),10)||0,instances:this.props.instances,type:((u=i==null?void 0:i.common)==null?void 0:u.engineType)||"Javascript/js",parent:this.parent,onAdd:(d,p,m,f)=>{var w;const v=this.state.copingScript&&this.props.scripts[this.state.copingScript].type==="script"?this.props.scripts[this.state.copingScript]:void 0;v!=null&&v.common&&(v.common.enabled=!1),this.props.onAddNew&&this.props.onAddNew(d,p,!1,m,f,(w=v==null?void 0:v.common)==null?void 0:w.source)}},"dialog-copy-script"):null,this.state.creatingFolder?g.jsx(xp,{onClose:()=>this.setState({creatingFolder:!1}),title:b.I18n.t("Create new folder"),parents:this.getFolders(),name:this.getUniqueFolderName(),parent:this.parent,onAdd:(d,p)=>this.props.onAddNew&&this.props.onAddNew(d,p,!0)},"dialog-new-folder"):null,this.state.errorText?g.jsx(Ec,{onClose:()=>this.setState({errorText:""}),text:this.state.errorText},"error"):null,this.getAdapterDebugDialog()]}}const TI="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgAQMAAADYVuV7AAAABlBMVEUAAAAzMzPI8eYgAAAAAXRSTlMAQObYZgAAACFJREFUeAFjAIJRwP////8PYIKWHCigNQdKj/pn1D+jAABTG16wVQqVpQAAAABJRU5ErkJggg==",kI="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgAQMAAADYVuV7AAAABlBMVEUAAAAzMzPI8eYgAAAAAXRSTlMAQObYZgAAABtJREFUeAFjAIJRwP8fCj7QkENn/4z6Z5QzCgBjbWaoyx1PqQAAAABJRU5ErkJggg==";function SI(a){let s,i=a.getHours();return i<10&&(i=`0${i.toString()}`),s=`${i}:`,i=a.getMinutes(),i<10&&(i=`0${i.toString()}`),s+=`${i}:`,i=a.getSeconds(),i<10&&(i=`0${i.toString()}`),s+=`${i}.`,i=a.getMilliseconds(),i<10?i=`00${i.toString()}`:i<100&&(i=`0${i.toString()}`),s+=i,s}const zy=34,Mt={logBox:{width:"100%",height:"100%",position:"relative",overflow:"hidden"},logBoxInner:a=>({display:"inline-block",color:a.palette.mode==="dark"?"white":"black",width:`calc(100% - ${zy}px)`,height:"100%",overflow:"auto",position:"relative",verticalAlign:"top"}),info:a=>({background:a.palette.mode==="dark"?"darkgrey":"lightgrey",color:(a.palette.mode==="dark","black")}),error:a=>({background:"#FF0000",color:a.palette.mode==="dark"?"black":"white"}),warn:a=>({background:"#FF8000",color:a.palette.mode==="dark"?"black":"white"}),debug:a=>({background:"gray",opacity:.8,color:a.palette.mode==="dark"?"black":"white"}),silly:a=>({background:"gray",opacity:.6,color:a.palette.mode==="dark"?"black":"white"}),table:{fontFamily:"monospace",width:"100%"},toolbox:{width:zy,height:"100%",boxShadow:"2px 0px 4px -1px rgba(0, 0, 0, 0.2), 4px 0px 5px 0px rgba(0, 0, 0, 0.14), 1px 0px 10px 0px rgba(0, 0, 0, 0.12)",display:"inline-block",verticalAlign:"top",overflow:"hidden"},trFrom:{width:90},trTime:{width:90},trSeverity:{width:40,fontWeight:"bold"},trPreMessage:{padding:0,margin:0},iconButtons:{width:32,height:32,padding:4},layoutIcon:a=>({"& img":{width:24,height:24,background:a.palette.mode==="dark"?"#9d9d9d":void 0,borderRadius:a.palette.mode==="dark"?"30px":void 0}})};function EI(a){return a<10?`00${a}`:a<100?`0${a}`:a.toString()}const Ps={};class Ng extends X.Component{messagesEnd;constructor(s){super(s),this.state={lines:{},goBottom:!0,selected:null,editing:this.props.editing||[]},this.messagesEnd=X.createRef()}static generateLine(s,i){let r=s.message||"";if(typeof r!="object"){const l=new RegExp(`${s.from.replace(".","\\.").replace(")","\\)").replace("(","\\(")} \\(\\d+\\) `,"g"),u=r.match(l);u?r=r.replace(u[0],""):r=r.replace(`${s.from} `,"")}return r.startsWith(`${i}: `)&&(r=r.substring(i.length+2)),g.jsxs(y.Box,{component:"tr",sx:Mt[s.severity],children:[g.jsx("td",{style:Mt.trFrom,children:s.from}),g.jsx("td",{style:Mt.trTime,children:SI(new Date(s.ts))}),g.jsx("td",{style:Mt.trSeverity,children:s.severity}),g.jsx("td",{children:g.jsx("pre",{style:Mt.trPreMessage,children:r})})]},`tr_${s.ts}_${s.message.substring(s.message.length-10)}`)}scrollToBottom(){var s,i;(i=(s=this.messagesEnd)==null?void 0:s.current)==null||i.scrollIntoView({behavior:"smooth"})}logHandler=s=>{const i=this.state.lines,r=this.state.editing.filter(f=>s.message.includes(f));let l=null;if(!r.length||(r.length===1?l=r[0]:(r.sort(),l=r[r.length-1]),!l))return;const u=i[l]||[],d=Ps[l]||[];u.push(Ng.generateLine(s,l));let p=s.severity;(p==="info"||p==="warn")&&(p+=" ");const m=new Date(s.ts);d.push(`${m.toLocaleString()}.${EI(m.getMilliseconds())} [${p}]: ${s.message}`),u.length>300&&(u.splice(0,u.length-300),d.splice(0,u.length-300)),Ps[l]=d,i[l]=u,this.setState({lines:i})};componentDidMount(){this.props.socket.registerLogHandler(this.logHandler)}componentWillUnmount(){this.props.socket.unregisterLogHandler(this.logHandler)}componentDidUpdate(){this.state.goBottom&&this.scrollToBottom()}static getDerivedStateFromProps(s,i){let r=!1;const l={};if(s.selected!==i.selected){const u=s.selected,d=i.lines;u&&(d[u]=d[u]||[],Ps[u]=Ps[u]||[]),l.selected=u,r=!0}if(JSON.stringify(s.editing)!==JSON.stringify(i.editing)){const u=JSON.parse(JSON.stringify(s.editing));r=!0;const d=i.lines;for(const p in Ps)Object.prototype.hasOwnProperty.call(Ps,p)&&(u.includes(p)||(delete Ps[p],delete d[p]));l.editing=u}return r?l:null}onCopy(){b.Utils.copyToClipboard((Ps[this.state.selected]||[]).join(`
113
+ `))}clearLog(){const s=this.state.lines;s[this.state.selected]&&(s[this.state.selected]=[]),Ps[this.state.selected]&&(Ps[this.state.selected]=[]),this.setState({lines:s})}renderLogList(s){return this.state.selected&&(s!=null&&s.length)?g.jsxs(y.Box,{sx:Mt.logBoxInner,children:[g.jsx("table",{style:Mt.table,children:g.jsx("tbody",{children:s})},"logTable"),g.jsx("div",{ref:this.messagesEnd,style:{float:"left",clear:"both"}},"logScrollPoint")]},"logList"):g.jsx(y.Box,{sx:Mt.logBoxInner,style:{paddingLeft:10},children:b.I18n.t("Log outputs")},"logList")}render(){const s=this.state.selected?this.state.lines[this.state.selected]:null;return g.jsxs("div",{style:Mt.logBox,children:[g.jsxs("div",{style:Mt.toolbox,children:[g.jsx(y.IconButton,{style:Mt.iconButtons,onClick:()=>this.setState({goBottom:!this.state.goBottom}),color:this.state.goBottom?"secondary":void 0,size:"medium",children:g.jsx(YT,{})}),s!=null&&s.length?g.jsx(y.IconButton,{style:Mt.iconButtons,onClick:()=>this.clearLog(),size:"medium",children:g.jsx(JT,{})}):null,s!=null&&s.length?g.jsx(y.IconButton,{style:Mt.iconButtons,onClick:()=>this.onCopy(),size:"medium",children:g.jsx(XT,{})}):null,this.props.onLayoutChange?g.jsx(y.IconButton,{style:Mt.iconButtons,onClick:()=>this.props.onLayoutChange&&this.props.onLayoutChange(),title:b.I18n.t("Change layout"),size:"medium",sx:Mt.layoutIcon,children:g.jsx("img",{alt:"split",src:this.props.verticalLayout?TI:kI})}):null,g.jsx(y.IconButton,{style:Mt.iconButtons,onClick:()=>this.props.onHideLog(),title:b.I18n.t("Hide logs"),size:"medium",children:g.jsx(qT,{})})]},"toolbox"),this.renderLogList(s)]})}}var Uy="focus-outline-hidden";function Cw(){var a=this;document.addEventListener("keydown",function(s){a.focusByKeyboard=!0},!0),document.addEventListener("mousedown",function(s){a.focusByKeyboard=!1},!0),document.addEventListener("focus",function(s){a.updateVisibility()},!0),document.addEventListener("focusout",function(s){window.setTimeout(function(){document.hasFocus()||(a.focusByKeyboard=!0,a.updateVisibility())},0)}),this.updateVisibility()}Cw.prototype={focusByKeyboard:!0,updateVisibility:function(){this.hidden=!this.focusByKeyboard},set hidden(a){document.documentElement.classList.toggle(Uy,a)},get hidden(){return document.documentElement.classList.contains(Uy)}};new Cw;var Tw={exports:{}};/*!
114
+ Copyright (c) 2018 Jed Watson.
115
+ Licensed under the MIT License (MIT), see
116
+ http://jedwatson.github.io/classnames
117
+ */(function(a){(function(){var s={}.hasOwnProperty;function i(){for(var r=[],l=0;l<arguments.length;l++){var u=arguments[l];if(u){var d=typeof u;if(d==="string"||d==="number")r.push(u);else if(Array.isArray(u)){if(u.length){var p=i.apply(null,u);p&&r.push(p)}}else if(d==="object")if(u.toString===Object.prototype.toString)for(var m in u)s.call(u,m)&&u[m]&&r.push(m);else r.push(u.toString())}}return r.join(" ")}a.exports?(i.default=i,a.exports=i):window.classNames=i})()})(Tw);var II=Tw.exports;const Hy=hi(II);var dg={exports:{}},hg={exports:{}},pi={};Object.defineProperty(pi,"__esModule",{value:!0});var xI=pi.easeFunctions={linear:function(s){return s},easeInQuad:function(s){return s*s},easeOutQuad:function(s){return s*(2-s)},easeInOutQuad:function(s){return s<.5?2*s*s:-1+(4-2*s)*s},easeInCubic:function(s){return s*s*s},easeOutCubic:function(s){return--s*s*s+1},easeInOutCubic:function(s){return s<.5?4*s*s*s:(s-1)*(2*s-2)*(2*s-2)+1},easeInQuart:function(s){return s*s*s*s},easeOutQuart:function(s){return 1- --s*s*s*s},easeInOutQuart:function(s){return s<.5?8*s*s*s*s:1-8*--s*s*s*s},easeInQuint:function(s){return s*s*s*s*s},easeOutQuint:function(s){return 1+--s*s*s*s*s},easeInOutQuint:function(s){return s<.5?16*s*s*s*s*s:1+16*--s*s*s*s*s}},DI=pi.isNumeric=function(s){return!isNaN(parseFloat(s))&&isFinite(s)};pi.setPosition=function(s,i,r,l){var u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"easeInOutCubic";return r>l?i:s+(i-s)*xI[u](r/l)};pi.calcEndPoint=function(s){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:window,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(DI(s))return parseInt(s)+r;var l=i===window||i===document.documentElement?window.pageYOffset:i.scrollTop-i.getBoundingClientRect().top,u=s.nodeName.toLowerCase()==="html"?-l:s.getBoundingClientRect().top+l;return u+r};(function(a,s){Object.defineProperty(s,"__esModule",{value:!0});var i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},r=pi;s.default=function(l){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},d=u.duration,p=d===void 0?500:d,m=u.context,f=m===void 0?window:m,v=u.offset,w=v===void 0?0:v,_=u.ease,k=_===void 0?"easeInOutCubic":_,S=u.callback;if((typeof window>"u"?"undefined":i(window))==="object"){var C=f.scrollTop!==null&&f.scrollTop!==void 0?f.scrollTop:window.pageYOffset,I=(0,r.calcEndPoint)(l,f,w),O=performance.now(),A=window.requestAnimationFrame,R=function q(){var re=performance.now()-O,ie=(0,r.setPosition)(C,I,re,p,k);f!==window?f.scrollTop=ie:window.scroll(0,ie),re>p?typeof S=="function"&&S(l):A(q)};R()}},a.exports=s.default})(hg,hg.exports);var kw=hg.exports,pg={exports:{}};(function(a,s){Object.defineProperty(s,"__esModule",{value:!0});var i=Object.assign||function(d){for(var p=1;p<arguments.length;p++){var m=arguments[p];for(var f in m)Object.prototype.hasOwnProperty.call(m,f)&&(d[f]=m[f])}return d},r=kw,l=u(r);function u(d){return d&&d.__esModule?d:{default:d}}s.default=function(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},p=d.query,m=p===void 0?'[href^="#"]:not([href="#"]':p,f=d.match,v=f===void 0?function(I){return document.getElementById(I.hash.substring(1))}:f,w=d.hashChange,_=w===void 0?!0:w,k=d.scrollSmoothConfig,S=document.querySelectorAll(m),C=function(O){O.preventDefault();var A=v(O.target);A&&(_&&history.replaceState(null,null,"#"+A.id),(0,l.default)(A,i({},k)))};Array.from(S).map(function(I){I.addEventListener("click",C,!1)})},a.exports=s.default})(pg,pg.exports);var AI=pg.exports,gg={exports:{}};(function(a,s){Object.defineProperty(s,"__esModule",{value:!0});function i(r){if(Array.isArray(r)){for(var l=0,u=Array(r.length);l<r.length;l++)u[l]=r[l];return u}else return Array.from(r)}s.default=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},l=r.activeClass,u=l===void 0?"active":l,d=r.query,p=d===void 0?'[href^="#"]:not([href="#"]):not([href="#0"])':d,m=r.threshold,f=m===void 0?[.25,.5,.75]:m,v=r.detectType,w=v===void 0?"max":v,_={threshold:f},k=function(ie){return ie.classList.remove(u)},S=function(ie){return ie.classList.add(u)},C=function(){document.querySelectorAll("."+u).forEach(k)},I=function(ie){C(),S(document.querySelector('a[href="#'+ie.id+'"]'))},O=function(ie){ie.forEach(function($e){$e.intersectionRatio>=Math[w].apply(Math,i(f))&&I($e.target)})},A=document.querySelectorAll(p),R=new IntersectionObserver(O,_),q=function(ie){var $e=document.querySelector("#"+ie.hash.slice(1));R.observe($e)};A.forEach(q)},a.exports=s.default})(gg,gg.exports);var RI=gg.exports;(function(a,s){Object.defineProperty(s,"__esModule",{value:!0});var i=kw,r=f(i),l=pi,u=AI,d=f(u),p=RI,m=f(p);function f(v){return v&&v.__esModule?v:{default:v}}s.default={to:r.default,calcEndPoint:l.calcEndPoint,anchorScroll:d.default,observe:m.default},a.exports=s.default})(dg,dg.exports);var OI=dg.exports;const MI=hi(OI);var Lg={exports:{}},NI=Lg.exports;(function(a){(function(s,i){a.exports?a.exports=i():s.Scrollparent=i()})(NI,function(){var s=/(auto|scroll)/,i=function(p,m){return p.parentNode===null?m:i(p.parentNode,m.concat([p]))},r=function(p,m){return getComputedStyle(p,null).getPropertyValue(m)},l=function(p){return r(p,"overflow")+r(p,"overflow-y")+r(p,"overflow-x")},u=function(p){return s.test(l(p))},d=function(p){if(p instanceof HTMLElement||p instanceof SVGElement){for(var m=i(p.parentNode,[]),f=0;f<m.length;f+=1)if(u(m[f]))return m[f];return document.scrollingElement||document.documentElement}};return d})})(Lg);var LI=Lg.exports;const BI=hi(LI);var PI="Expected a function",Wy=NaN,FI="[object Symbol]",jI=/^\s+|\s+$/g,zI=/^[-+]0x[0-9a-f]+$/i,UI=/^0b[01]+$/i,HI=/^0o[0-7]+$/i,WI=parseInt,VI=typeof nn=="object"&&nn&&nn.Object===Object&&nn,GI=typeof self=="object"&&self&&self.Object===Object&&self,KI=VI||GI||Function("return this")(),YI=Object.prototype,JI=YI.toString,XI=Math.max,qI=Math.min,Dp=function(){return KI.Date.now()};function ZI(a,s,i){var r,l,u,d,p,m,f=0,v=!1,w=!1,_=!0;if(typeof a!="function")throw new TypeError(PI);s=Vy(s)||0,mg(i)&&(v=!!i.leading,w="maxWait"in i,u=w?XI(Vy(i.maxWait)||0,s):u,_="trailing"in i?!!i.trailing:_);function k(ie){var $e=r,U=l;return r=l=void 0,f=ie,d=a.apply(U,$e),d}function S(ie){return f=ie,p=setTimeout(O,s),v?k(ie):d}function C(ie){var $e=ie-m,U=ie-f,Me=s-$e;return w?qI(Me,u-U):Me}function I(ie){var $e=ie-m,U=ie-f;return m===void 0||$e>=s||$e<0||w&&U>=u}function O(){var ie=Dp();if(I(ie))return A(ie);p=setTimeout(O,C(ie))}function A(ie){return p=void 0,_&&r?k(ie):(r=l=void 0,d)}function R(){p!==void 0&&clearTimeout(p),f=0,r=m=l=p=void 0}function q(){return p===void 0?d:A(Dp())}function re(){var ie=Dp(),$e=I(ie);if(r=arguments,l=this,m=ie,$e){if(p===void 0)return S(m);if(w)return p=setTimeout(O,s),k(m)}return p===void 0&&(p=setTimeout(O,s)),d}return re.cancel=R,re.flush=q,re}function mg(a){var s=typeof a;return!!a&&(s=="object"||s=="function")}function QI(a){return!!a&&typeof a=="object"}function ex(a){return typeof a=="symbol"||QI(a)&&JI.call(a)==FI}function Vy(a){if(typeof a=="number")return a;if(ex(a))return Wy;if(mg(a)){var s=typeof a.valueOf=="function"?a.valueOf():a;a=mg(s)?s+"":s}if(typeof a!="string")return a===0?a:+a;a=a.replace(jI,"");var i=UI.test(a);return i||HI.test(a)?WI(a.slice(2),i?2:8):zI.test(a)?Wy:+a}var tx=ZI;const sx=hi(tx);var fg="data-focus-lock",Sw="data-focus-lock-disabled",ox="data-no-focus-lock",ix="data-autofocus-inside",nx="data-no-autofocus";function Ap(a,s){return typeof a=="function"?a(s):a&&(a.current=s),a}function rx(a,s){var i=H.useState(function(){return{value:a,callback:s,facade:{get current(){return i.value},set current(r){var l=i.value;l!==r&&(i.value=r,i.callback(r,l))}}}})[0];return i.callback=s,i.facade}var ax=typeof window<"u"?H.useLayoutEffect:H.useEffect,Gy=new WeakMap;function lx(a,s){var i=rx(null,function(r){return a.forEach(function(l){return Ap(l,r)})});return ax(function(){var r=Gy.get(i);if(r){var l=new Set(r),u=new Set(a),d=i.current;l.forEach(function(p){u.has(p)||Ap(p,null)}),u.forEach(function(p){l.has(p)||Ap(p,d)})}Gy.set(i,a)},[a]),i}var Rp={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"};function Ew(a){return a}function Iw(a,s){s===void 0&&(s=Ew);var i=[],r=!1,l={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return i.length?i[i.length-1]:a},useMedium:function(u){var d=s(u,r);return i.push(d),function(){i=i.filter(function(p){return p!==d})}},assignSyncMedium:function(u){for(r=!0;i.length;){var d=i;i=[],d.forEach(u)}i={push:function(p){return u(p)},filter:function(){return i}}},assignMedium:function(u){r=!0;var d=[];if(i.length){var p=i;i=[],p.forEach(u),d=i}var m=function(){var v=d;d=[],v.forEach(u)},f=function(){return Promise.resolve().then(m)};f(),i={push:function(v){d.push(v),f()},filter:function(v){return d=d.filter(v),i}}}};return l}function Bg(a,s){return s===void 0&&(s=Ew),Iw(a,s)}function cx(a){a===void 0&&(a={});var s=Iw(null);return s.options=ZT({async:!0,ssr:!1},a),s}var xw=Bg({},function(a){var s=a.target,i=a.currentTarget;return{target:s,currentTarget:i}}),Dw=Bg(),ux=Bg(),dx=cx({async:!0,ssr:typeof document<"u"}),hx=H.createContext(void 0),px=[],Pg=H.forwardRef(function(s,i){var r,l=H.useState(),u=l[0],d=l[1],p=H.useRef(),m=H.useRef(!1),f=H.useRef(null),v=H.useState({}),w=v[1],_=s.children,k=s.disabled,S=k===void 0?!1:k,C=s.noFocusGuards,I=C===void 0?!1:C,O=s.persistentFocus,A=O===void 0?!1:O,R=s.crossFrame,q=R===void 0?!0:R,re=s.autoFocus,ie=re===void 0?!0:re;s.allowTextSelection;var $e=s.group,U=s.className,Me=s.whiteList,Ne=s.hasPositiveIndices,qe=s.shards,ce=qe===void 0?px:qe,de=s.as,J=de===void 0?"div":de,we=s.lockProps,ge=we===void 0?{}:we,Fe=s.sideCar,Y=s.returnFocus,et=Y===void 0?!1:Y,Z=s.focusOptions,se=s.onActivation,F=s.onDeactivation,V=H.useState({}),W=V[0],le=H.useCallback(function(Ee){var ve=Ee.captureFocusRestore;if(!f.current){var Be,ft=(Be=document)==null?void 0:Be.activeElement;f.current=ft,ft!==document.body&&(f.current=ve(ft))}p.current&&se&&se(p.current),m.current=!0,w()},[se]),x=H.useCallback(function(){m.current=!1,F&&F(p.current),w()},[F]),pe=H.useCallback(function(Ee){var ve=f.current;if(ve){var Be=(typeof ve=="function"?ve():ve)||document.body,ft=typeof et=="function"?et(Be):et;if(ft){var Q=typeof ft=="object"?ft:void 0;f.current=null,Ee?Promise.resolve().then(function(){return Be.focus(Q)}):Be.focus(Q)}}},[et]),G=H.useCallback(function(Ee){m.current&&xw.useMedium(Ee)},[]),ke=Dw.useMedium,ye=H.useCallback(function(Ee){p.current!==Ee&&(p.current=Ee,d(Ee))},[]),Ie=Zp((r={},r[Sw]=S&&"disabled",r[fg]=$e,r),ge),me=I!==!0,Ve=me&&I!=="tail",Ye=lx([i,ye]),Ce=H.useMemo(function(){return{observed:p,shards:ce,enabled:!S,active:m.current}},[S,m.current,ce,u]);return X.createElement(H.Fragment,null,me&&[X.createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:S?-1:0,style:Rp}),Ne?X.createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:S?-1:1,style:Rp}):null],!S&&X.createElement(Fe,{id:W,sideCar:dx,observed:u,disabled:S,persistentFocus:A,crossFrame:q,autoFocus:ie,whiteList:Me,shards:ce,onActivation:le,onDeactivation:x,returnFocus:pe,focusOptions:Z,noFocusGuards:I}),X.createElement(J,Zp({ref:Ye},Ie,{className:U,onBlur:ke,onFocus:G}),X.createElement(hx.Provider,{value:Ce},_)),Ve&&X.createElement("div",{"data-focus-guard":!0,tabIndex:S?-1:0,style:Rp}))});Pg.propTypes={};function gx(a,s){function i(r){return r.displayName||r.name||"Component"}return function(l){var u=[],d;function p(){d=a(u.map(function(f){return f.props})),s(d)}var m=(function(f){PT(v,f);function v(){return f.apply(this,arguments)||this}v.peek=function(){return d};var w=v.prototype;return w.componentDidMount=function(){u.push(this),p()},w.componentDidUpdate=function(){p()},w.componentWillUnmount=function(){var k=u.indexOf(this);u.splice(k,1),p()},w.render=function(){return X.createElement(l,this.props)},v})(H.PureComponent);return oS(m,"displayName","SideEffect("+i(l)+")"),m}}var Us=function(a){for(var s=Array(a.length),i=0;i<a.length;++i)s[i]=a[i];return s},ui=function(a){return Array.isArray(a)?a:[a]},Aw=function(a){return Array.isArray(a)?a[0]:a},mx=function(a){if(a.nodeType!==Node.ELEMENT_NODE)return!1;var s=window.getComputedStyle(a,null);return!s||!s.getPropertyValue?!1:s.getPropertyValue("display")==="none"||s.getPropertyValue("visibility")==="hidden"},Rw=function(a){return a.parentNode&&a.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?a.parentNode.host:a.parentNode},Ow=function(a){return a===document||a&&a.nodeType===Node.DOCUMENT_NODE},fx=function(a){return a.hasAttribute("inert")},$x=function(a,s){return!a||Ow(a)||!mx(a)&&!fx(a)&&s(Rw(a))},Mw=function(a,s){var i=a.get(s);if(i!==void 0)return i;var r=$x(s,Mw.bind(void 0,a));return a.set(s,r),r},bx=function(a,s){return a&&!Ow(a)?_x(a)?s(Rw(a)):!1:!0},Nw=function(a,s){var i=a.get(s);if(i!==void 0)return i;var r=bx(s,Nw.bind(void 0,a));return a.set(s,r),r},Lw=function(a){return a.dataset},vx=function(a){return a.tagName==="BUTTON"},Bw=function(a){return a.tagName==="INPUT"},Pw=function(a){return Bw(a)&&a.type==="radio"},yx=function(a){return!((Bw(a)||vx(a))&&(a.type==="hidden"||a.disabled))},_x=function(a){var s=a.getAttribute(nx);return![!0,"true",""].includes(s)},Fg=function(a){var s;return!!(a&&(!((s=Lw(a))===null||s===void 0)&&s.focusGuard))},$g=function(a){return!Fg(a)},wx=function(a){return!!a},Cx=function(a,s){var i=Math.max(0,a.tabIndex),r=Math.max(0,s.tabIndex),l=i-r,u=a.index-s.index;if(l){if(!i)return 1;if(!r)return-1}return l||u},Tx=function(a){return a.tabIndex<0&&!a.hasAttribute("tabindex")?0:a.tabIndex},jg=function(a,s,i){return Us(a).map(function(r,l){var u=Tx(r);return{node:r,index:l,tabIndex:i&&u===-1?(r.dataset||{}).focusGuard?0:-1:u}}).filter(function(r){return!s||r.tabIndex>=0}).sort(Cx)},kx=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],zg=kx.join(","),Sx="".concat(zg,", [data-focus-guard]"),Fw=function(a,s){return Us((a.shadowRoot||a).children).reduce(function(i,r){return i.concat(r.matches(s?Sx:zg)?[r]:[],Fw(r))},[])},Ex=function(a,s){var i;return a instanceof HTMLIFrameElement&&(!((i=a.contentDocument)===null||i===void 0)&&i.body)?pn([a.contentDocument.body],s):[a]},pn=function(a,s){return a.reduce(function(i,r){var l,u=Fw(r,s),d=(l=[]).concat.apply(l,u.map(function(p){return Ex(p,s)}));return i.concat(d,r.parentNode?Us(r.parentNode.querySelectorAll(zg)).filter(function(p){return p===r}):[])},[])},Ix=function(a){var s=a.querySelectorAll("[".concat(ix,"]"));return Us(s).map(function(i){return pn([i])}).reduce(function(i,r){return i.concat(r)},[])},Ug=function(a,s){return Us(a).filter(function(i){return Mw(s,i)}).filter(function(i){return yx(i)})},Ky=function(a,s){return s===void 0&&(s=new Map),Us(a).filter(function(i){return Nw(s,i)})},Hg=function(a,s,i){return jg(Ug(pn(a,i),s),!0,i)},xr=function(a,s){return jg(Ug(pn(a),s),!1)},xx=function(a,s){return Ug(Ix(a),s)},li=function(a,s){return a.shadowRoot?li(a.shadowRoot,s):Object.getPrototypeOf(a).contains!==void 0&&Object.getPrototypeOf(a).contains.call(a,s)?!0:Us(a.children).some(function(i){var r;if(i instanceof HTMLIFrameElement){var l=(r=i.contentDocument)===null||r===void 0?void 0:r.body;return l?li(l,s):!1}return li(i,s)})},Dx=function(a){for(var s=new Set,i=a.length,r=0;r<i;r+=1)for(var l=r+1;l<i;l+=1){var u=a[r].compareDocumentPosition(a[l]);(u&Node.DOCUMENT_POSITION_CONTAINED_BY)>0&&s.add(l),(u&Node.DOCUMENT_POSITION_CONTAINS)>0&&s.add(r)}return a.filter(function(d,p){return!s.has(p)})},jw=function(a){return a.parentNode?jw(a.parentNode):a},Wg=function(a){var s=ui(a);return s.filter(Boolean).reduce(function(i,r){var l=r.getAttribute(fg);return i.push.apply(i,l?Dx(Us(jw(r).querySelectorAll("[".concat(fg,'="').concat(l,'"]:not([').concat(Sw,'="disabled"])')))):[r]),i},[])},Ax=function(a){try{return a()}catch{return}},Dr=function(a){if(a===void 0&&(a=document),!(!a||!a.activeElement)){var s=a.activeElement;return s.shadowRoot?Dr(s.shadowRoot):s instanceof HTMLIFrameElement&&Ax(function(){return s.contentWindow.document})?Dr(s.contentWindow.document):s}},Rx=function(a,s){return a===s},Ox=function(a,s){return!!Us(a.querySelectorAll("iframe")).some(function(i){return Rx(i,s)})},zw=function(a,s){return s===void 0&&(s=Dr(Aw(a).ownerDocument)),!s||s.dataset&&s.dataset.focusGuard?!1:Wg(a).some(function(i){return li(i,s)||Ox(i,s)})},Mx=function(a){a===void 0&&(a=document);var s=Dr(a);return s?Us(a.querySelectorAll("[".concat(ox,"]"))).some(function(i){return li(i,s)}):!1},Nx=function(a,s){return s.filter(Pw).filter(function(i){return i.name===a.name}).filter(function(i){return i.checked})[0]||a},Vg=function(a,s){return Pw(a)&&a.name?Nx(a,s):a},Lx=function(a){var s=new Set;return a.forEach(function(i){return s.add(Vg(i,a))}),a.filter(function(i){return s.has(i)})},Yy=function(a){return a[0]&&a.length>1?Vg(a[0],a):a[0]},Jy=function(a,s){return a.indexOf(Vg(s,a))},bg="NEW_FOCUS",Bx=function(a,s,i,r,l){var u=a.length,d=a[0],p=a[u-1],m=Fg(r);if(!(r&&a.indexOf(r)>=0)){var f=r!==void 0?i.indexOf(r):-1,v=l?i.indexOf(l):f,w=l?a.indexOf(l):-1;if(f===-1)return w!==-1?w:bg;if(w===-1)return bg;var _=f-v,k=i.indexOf(d),S=i.indexOf(p),C=Lx(i),I=r!==void 0?C.indexOf(r):-1,O=l?C.indexOf(l):I,A=C.filter(function(U){return U.tabIndex>=0}),R=r!==void 0?A.indexOf(r):-1,q=l?A.indexOf(l):R,re=R>=0&&q>=0?q-R:O-I;if(!_&&w>=0||s.length===0)return w;var ie=Jy(a,s[0]),$e=Jy(a,s[s.length-1]);if(f<=k&&m&&Math.abs(_)>1)return $e;if(f>=S&&m&&Math.abs(_)>1)return ie;if(_&&Math.abs(re)>1)return w;if(f<=k)return $e;if(f>S)return ie;if(_)return Math.abs(_)>1?w:(u+w+_)%u}},Px=function(a){return function(s){var i,r=(i=Lw(s))===null||i===void 0?void 0:i.autofocus;return s.autofocus||r!==void 0&&r!=="false"||a.indexOf(s)>=0}},Xy=function(a,s,i){var r=a.map(function(u){var d=u.node;return d}),l=Ky(r.filter(Px(i)));return l&&l.length?Yy(l):Yy(Ky(s))},vg=function(a,s){return s===void 0&&(s=[]),s.push(a),a.parentNode&&vg(a.parentNode.host||a.parentNode,s),s},Op=function(a,s){for(var i=vg(a),r=vg(s),l=0;l<i.length;l+=1){var u=i[l];if(r.indexOf(u)>=0)return u}return!1},Uw=function(a,s,i){var r=ui(a),l=ui(s),u=r[0],d=!1;return l.filter(Boolean).forEach(function(p){d=Op(d||p,p)||d,i.filter(Boolean).forEach(function(m){var f=Op(u,m);f&&(!d||li(f,d)?d=f:d=Op(f,d))})}),d},qy=function(a,s){return a.reduce(function(i,r){return i.concat(xx(r,s))},[])},Fx=function(a,s){var i=new Map;return s.forEach(function(r){return i.set(r.node,r)}),a.map(function(r){return i.get(r)}).filter(wx)},jx=function(a,s){var i=Dr(ui(a).length>0?document:Aw(a).ownerDocument),r=Wg(a).filter($g),l=Uw(i||a,a,r),u=new Map,d=xr(r,u),p=d.filter(function(S){var C=S.node;return $g(C)});if(p[0]){var m=xr([l],u).map(function(S){var C=S.node;return C}),f=Fx(m,p),v=f.map(function(S){var C=S.node;return C}),w=f.filter(function(S){var C=S.tabIndex;return C>=0}).map(function(S){var C=S.node;return C}),_=Bx(v,w,m,i,s);if(_===bg){var k=Xy(d,w,qy(r,u))||Xy(d,v,qy(r,u));if(k)return{node:k};console.warn("focus-lock: cannot find any node to move focus into");return}return _===void 0?_:f[_]}},zx=function(a){var s=Wg(a).filter($g),i=Uw(a,a,s),r=jg(pn([i],!0),!0,!0),l=pn(s,!1);return r.map(function(u){var d=u.node,p=u.index;return{node:d,index:p,lockItem:l.indexOf(d)>=0,guard:Fg(d)}})},Gg=function(a,s){a&&("focus"in a&&a.focus(s),"contentWindow"in a&&a.contentWindow&&a.contentWindow.focus())},Mp=0,Np=!1,Hw=function(a,s,i){i===void 0&&(i={});var r=jx(a,s);if(!Np&&r){if(Mp>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),Np=!0,setTimeout(function(){Np=!1},1);return}Mp++,Gg(r.node,i.focusOptions),Mp--}};function br(a){if(!a)return null;if(typeof WeakRef>"u")return function(){return a||null};var s=a?new WeakRef(a):null;return function(){return(s==null?void 0:s.deref())||null}}var Ux=function(a){if(!a)return null;for(var s=[],i=a;i&&i!==document.body;)s.push({current:br(i),parent:br(i.parentElement),left:br(i.previousElementSibling),right:br(i.nextElementSibling)}),i=i.parentElement;return{element:br(a),stack:s,ownerDocument:a.ownerDocument}},Hx=function(a){var s,i,r,l,u;if(a)for(var d=a.stack,p=a.ownerDocument,m=new Map,f=0,v=d;f<v.length;f++){var w=v[f],_=(s=w.parent)===null||s===void 0?void 0:s.call(w);if(_&&p.contains(_)){for(var k=(i=w.left)===null||i===void 0?void 0:i.call(w),S=w.current(),C=_.contains(S)?S:void 0,I=(r=w.right)===null||r===void 0?void 0:r.call(w),O=Hg([_],m),A=(u=(l=C??(k==null?void 0:k.nextElementSibling))!==null&&l!==void 0?l:I)!==null&&u!==void 0?u:k;A;){for(var R=0,q=O;R<q.length;R++){var re=q[R];if(A!=null&&A.contains(re.node))return re.node}A=A.nextElementSibling}if(O.length)return O[0].node}}},Ww=function(a){var s=Ux(a);return function(){return Hx(s)}},Wx=function(a,s,i){if(!a||!s)return console.error("no element or scope given"),{};var r=ui(s);if(r.every(function(d){return!li(d,a)}))return console.error("Active element is not contained in the scope"),{};var l=i?Hg(r,new Map):xr(r,new Map),u=l.findIndex(function(d){var p=d.node;return p===a});if(u!==-1)return{prev:l[u-1],next:l[u+1],first:l[0],last:l[l.length-1]}},Vx=function(a,s){var i=s?Hg(ui(a),new Map):xr(ui(a),new Map);return{first:i[0],last:i[i.length-1]}},Gx=function(a){return Object.assign({scope:document.body,cycle:!0,onlyTabbable:!0},a)},Vw=function(a,s,i){s===void 0&&(s={});var r=Gx(s),l=Wx(a,r.scope,r.onlyTabbable);if(l){var u=i(l,r.cycle);u&&Gg(u.node,r.focusOptions)}},Kx=function(a,s){s===void 0&&(s={}),Vw(a,s,function(i,r){var l=i.next,u=i.first;return l||r&&u})},Yx=function(a,s){s===void 0&&(s={}),Vw(a,s,function(i,r){var l=i.prev,u=i.last;return l||r&&u})},Gw=function(a,s,i){var r,l=Vx(a,(r=s.onlyTabbable)!==null&&r!==void 0?r:!0),u=l[i];u&&Gg(u.node,s.focusOptions)},Jx=function(a,s){s===void 0&&(s={}),Gw(a,s,"first")},Xx=function(a,s){s===void 0&&(s={}),Gw(a,s,"last")};function Kg(a){setTimeout(a,1)}var qx=function(s){return s&&"current"in s?s.current:s},Kw=function(){return document&&document.activeElement===document.body},Zx=function(){return Kw()||Mx()},cn=null,Vt=null,Zy=function(){return null},un=null,Ar=!1,Yg=!1,Qx=function(){return!0},eD=function(s){return(cn.whiteList||Qx)(s)},tD=function(s,i){un={observerNode:s,portaledElement:i}},sD=function(s){return un&&un.portaledElement===s};function Qy(a,s,i,r){var l=null,u=a;do{var d=r[u];if(d.guard)d.node.dataset.focusAutoGuard&&(l=d);else if(d.lockItem){if(u!==a)return;l=null}else break}while((u+=i)!==s);l&&(l.node.tabIndex=0)}var oD=function(s){return s?!!Ar:Ar==="meanwhile"},iD=function a(s,i,r){return i&&(i.host===s&&(!i.activeElement||r.contains(i.activeElement))||i.parentNode&&a(s,i.parentNode,r))},nD=function(s,i){return i.some(function(r){return iD(s,r,r)})},Yw=function(s){return xr(s,new Map)},rD=function(s){return!Yw([s.parentNode]).some(function(i){return i.node===s})},ql=function(){var s=!1;if(cn){var i=cn,r=i.observed,l=i.persistentFocus,u=i.autoFocus,d=i.shards,p=i.crossFrame,m=i.focusOptions,f=i.noFocusGuards,v=r||un&&un.portaledElement;if(Kw()&&Vt&&Vt!==document.body&&(!document.body.contains(Vt)||rD(Vt))){var w=Zy();w&&w.focus()}var _=document&&document.activeElement;if(v){var k=[v].concat(d.map(qx).filter(Boolean)),S=function(){if(!oD(p)||!f||!Vt||Yg)return!1;var R=Yw(k),q=R.findIndex(function(re){var ie=re.node;return ie===Vt});return q===0||q===R.length-1};if((!_||eD(_))&&(l||S()||!Zx()||!Vt&&u)&&(v&&!(zw(k)||_&&nD(_,k)||sD(_))&&(document&&!Vt&&_&&!u?(_.blur&&_.blur(),document.body.focus()):(s=Hw(k,Vt,{focusOptions:m}),un={})),Vt=document&&document.activeElement,Vt!==document.body&&(Zy=Ww(Vt)),Ar=!1),document&&_!==document.activeElement&&document.querySelector("[data-focus-auto-guard]")){var C=document&&document.activeElement,I=zx(k),O=I.map(function(A){var R=A.node;return R}).indexOf(C);O>-1&&(I.filter(function(A){var R=A.guard,q=A.node;return R&&q.dataset.focusAutoGuard}).forEach(function(A){var R=A.node;return R.removeAttribute("tabIndex")}),Qy(O,I.length,1,I),Qy(O,-1,-1,I))}}}return s},Jw=function(s){ql()&&s&&(s.stopPropagation(),s.preventDefault())},Jg=function(){return Kg(ql)},aD=function(s){var i=s.target,r=s.currentTarget;r.contains(i)||tD(r,i)},lD=function(){return null},Xw=function(){Yg=!0},qw=function(){Yg=!1,Ar="just",Kg(function(){Ar="meanwhile"})},cD=function(){document.addEventListener("focusin",Jw),document.addEventListener("focusout",Jg),window.addEventListener("focus",Xw),window.addEventListener("blur",qw)},uD=function(){document.removeEventListener("focusin",Jw),document.removeEventListener("focusout",Jg),window.removeEventListener("focus",Xw),window.removeEventListener("blur",qw)};function dD(a){return a.filter(function(s){var i=s.disabled;return!i})}var Zw={moveFocusInside:Hw,focusInside:zw,focusNextElement:Kx,focusPrevElement:Yx,focusFirstElement:Jx,focusLastElement:Xx,captureFocusRestore:Ww};function hD(a){var s=a.slice(-1)[0];s&&!cn&&cD();var i=cn,r=i&&s&&s.id===i.id;cn=s,i&&!r&&(i.onDeactivation(),a.filter(function(l){var u=l.id;return u===i.id}).length||i.returnFocus(!s)),s?(Vt=null,(!r||i.observed!==s.observed)&&s.onActivation(Zw),ql(),Kg(ql)):(uD(),Vt=null)}xw.assignSyncMedium(aD);Dw.assignMedium(Jg);ux.assignMedium(function(a){return a(Zw)});const pD=gx(dD,hD)(lD);var Qw=H.forwardRef(function(s,i){return X.createElement(Pg,Zp({sideCar:pD,ref:i},s))}),eC=Pg.propTypes||{};eC.sideCar;FT(eC,["sideCar"]);Qw.propTypes={};var tC={exports:{}},Qe={};/**
118
+ * @license React
119
+ * react-is.production.min.js
120
+ *
121
+ * Copyright (c) Facebook, Inc. and its affiliates.
122
+ *
123
+ * This source code is licensed under the MIT license found in the
124
+ * LICENSE file in the root directory of this source tree.
125
+ */var Xg=Symbol.for("react.element"),qg=Symbol.for("react.portal"),Ic=Symbol.for("react.fragment"),xc=Symbol.for("react.strict_mode"),Dc=Symbol.for("react.profiler"),Ac=Symbol.for("react.provider"),Rc=Symbol.for("react.context"),gD=Symbol.for("react.server_context"),Oc=Symbol.for("react.forward_ref"),Mc=Symbol.for("react.suspense"),Nc=Symbol.for("react.suspense_list"),Lc=Symbol.for("react.memo"),Bc=Symbol.for("react.lazy"),mD=Symbol.for("react.offscreen"),sC;sC=Symbol.for("react.module.reference");function hs(a){if(typeof a=="object"&&a!==null){var s=a.$$typeof;switch(s){case Xg:switch(a=a.type,a){case Ic:case Dc:case xc:case Mc:case Nc:return a;default:switch(a=a&&a.$$typeof,a){case gD:case Rc:case Oc:case Bc:case Lc:case Ac:return a;default:return s}}case qg:return s}}}Qe.ContextConsumer=Rc;Qe.ContextProvider=Ac;Qe.Element=Xg;Qe.ForwardRef=Oc;Qe.Fragment=Ic;Qe.Lazy=Bc;Qe.Memo=Lc;Qe.Portal=qg;Qe.Profiler=Dc;Qe.StrictMode=xc;Qe.Suspense=Mc;Qe.SuspenseList=Nc;Qe.isAsyncMode=function(){return!1};Qe.isConcurrentMode=function(){return!1};Qe.isContextConsumer=function(a){return hs(a)===Rc};Qe.isContextProvider=function(a){return hs(a)===Ac};Qe.isElement=function(a){return typeof a=="object"&&a!==null&&a.$$typeof===Xg};Qe.isForwardRef=function(a){return hs(a)===Oc};Qe.isFragment=function(a){return hs(a)===Ic};Qe.isLazy=function(a){return hs(a)===Bc};Qe.isMemo=function(a){return hs(a)===Lc};Qe.isPortal=function(a){return hs(a)===qg};Qe.isProfiler=function(a){return hs(a)===Dc};Qe.isStrictMode=function(a){return hs(a)===xc};Qe.isSuspense=function(a){return hs(a)===Mc};Qe.isSuspenseList=function(a){return hs(a)===Nc};Qe.isValidElementType=function(a){return typeof a=="string"||typeof a=="function"||a===Ic||a===Dc||a===xc||a===Mc||a===Nc||a===mD||typeof a=="object"&&a!==null&&(a.$$typeof===Bc||a.$$typeof===Lc||a.$$typeof===Ac||a.$$typeof===Rc||a.$$typeof===Oc||a.$$typeof===sC||a.getModuleId!==void 0)};Qe.typeOf=hs;tC.exports=Qe;var oC=tC.exports;function fD(a){function s(F,V,W,le,x){for(var pe=0,G=0,ke=0,ye=0,Ie,me,Ve=0,Ye=0,Ce,Ee=Ce=Ie=0,ve=0,Be=0,ft=0,Q=0,lt=W.length,ze=lt-1,wt,_e="",tt="",Hs="",Ct="",Tt;ve<lt;){if(me=W.charCodeAt(ve),ve===ze&&G+ye+ke+pe!==0&&(G!==0&&(me=G===47?10:47),ye=ke=pe=0,lt++,ze++),G+ye+ke+pe===0){if(ve===ze&&(0<Be&&(_e=_e.replace(_,"")),0<_e.trim().length)){switch(me){case 32:case 9:case 59:case 13:case 10:break;default:_e+=W.charAt(ve)}me=59}switch(me){case 123:for(_e=_e.trim(),Ie=_e.charCodeAt(0),Ce=1,Q=++ve;ve<lt;){switch(me=W.charCodeAt(ve)){case 123:Ce++;break;case 125:Ce--;break;case 47:switch(me=W.charCodeAt(ve+1)){case 42:case 47:e:{for(Ee=ve+1;Ee<ze;++Ee)switch(W.charCodeAt(Ee)){case 47:if(me===42&&W.charCodeAt(Ee-1)===42&&ve+2!==Ee){ve=Ee+1;break e}break;case 10:if(me===47){ve=Ee+1;break e}}ve=Ee}}break;case 91:me++;case 40:me++;case 34:case 39:for(;ve++<ze&&W.charCodeAt(ve)!==me;);}if(Ce===0)break;ve++}switch(Ce=W.substring(Q,ve),Ie===0&&(Ie=(_e=_e.replace(w,"").trim()).charCodeAt(0)),Ie){case 64:switch(0<Be&&(_e=_e.replace(_,"")),me=_e.charCodeAt(1),me){case 100:case 109:case 115:case 45:Be=V;break;default:Be=ge}if(Ce=s(V,Be,Ce,me,x+1),Q=Ce.length,0<Y&&(Be=i(ge,_e,ft),Tt=p(3,Ce,Be,V,de,ce,Q,me,x,le),_e=Be.join(""),Tt!==void 0&&(Q=(Ce=Tt.trim()).length)===0&&(me=0,Ce="")),0<Q)switch(me){case 115:_e=_e.replace(ie,d);case 100:case 109:case 45:Ce=_e+"{"+Ce+"}";break;case 107:_e=_e.replace(A,"$1 $2"),Ce=_e+"{"+Ce+"}",Ce=we===1||we===2&&u("@"+Ce,3)?"@-webkit-"+Ce+"@"+Ce:"@"+Ce;break;default:Ce=_e+Ce,le===112&&(Ce=(tt+=Ce,""))}else Ce="";break;default:Ce=s(V,i(V,_e,ft),Ce,le,x+1)}Hs+=Ce,Ce=ft=Be=Ee=Ie=0,_e="",me=W.charCodeAt(++ve);break;case 125:case 59:if(_e=(0<Be?_e.replace(_,""):_e).trim(),1<(Q=_e.length))switch(Ee===0&&(Ie=_e.charCodeAt(0),Ie===45||96<Ie&&123>Ie)&&(Q=(_e=_e.replace(" ",":")).length),0<Y&&(Tt=p(1,_e,V,F,de,ce,tt.length,le,x,le))!==void 0&&(Q=(_e=Tt.trim()).length)===0&&(_e="\0\0"),Ie=_e.charCodeAt(0),me=_e.charCodeAt(1),Ie){case 0:break;case 64:if(me===105||me===99){Ct+=_e+W.charAt(ve);break}default:_e.charCodeAt(Q-1)!==58&&(tt+=l(_e,Ie,me,_e.charCodeAt(2)))}ft=Be=Ee=Ie=0,_e="",me=W.charCodeAt(++ve)}}switch(me){case 13:case 10:G===47?G=0:1+Ie===0&&le!==107&&0<_e.length&&(Be=1,_e+="\0"),0<Y*Z&&p(0,_e,V,F,de,ce,tt.length,le,x,le),ce=1,de++;break;case 59:case 125:if(G+ye+ke+pe===0){ce++;break}default:switch(ce++,wt=W.charAt(ve),me){case 9:case 32:if(ye+pe+G===0)switch(Ve){case 44:case 58:case 9:case 32:wt="";break;default:me!==32&&(wt=" ")}break;case 0:wt="\\0";break;case 12:wt="\\f";break;case 11:wt="\\v";break;case 38:ye+G+pe===0&&(Be=ft=1,wt="\f"+wt);break;case 108:if(ye+G+pe+J===0&&0<Ee)switch(ve-Ee){case 2:Ve===112&&W.charCodeAt(ve-3)===58&&(J=Ve);case 8:Ye===111&&(J=Ye)}break;case 58:ye+G+pe===0&&(Ee=ve);break;case 44:G+ke+ye+pe===0&&(Be=1,wt+="\r");break;case 34:case 39:G===0&&(ye=ye===me?0:ye===0?me:ye);break;case 91:ye+G+ke===0&&pe++;break;case 93:ye+G+ke===0&&pe--;break;case 41:ye+G+pe===0&&ke--;break;case 40:if(ye+G+pe===0){if(Ie===0)switch(2*Ve+3*Ye){case 533:break;default:Ie=1}ke++}break;case 64:G+ke+ye+pe+Ee+Ce===0&&(Ce=1);break;case 42:case 47:if(!(0<ye+pe+ke))switch(G){case 0:switch(2*me+3*W.charCodeAt(ve+1)){case 235:G=47;break;case 220:Q=ve,G=42}break;case 42:me===47&&Ve===42&&Q+2!==ve&&(W.charCodeAt(Q+2)===33&&(tt+=W.substring(Q,ve+1)),wt="",G=0)}}G===0&&(_e+=wt)}Ye=Ve,Ve=me,ve++}if(Q=tt.length,0<Q){if(Be=V,0<Y&&(Tt=p(2,tt,Be,F,de,ce,Q,le,x,le),Tt!==void 0&&(tt=Tt).length===0))return Ct+tt+Hs;if(tt=Be.join(",")+"{"+tt+"}",we*J!==0){switch(we!==2||u(tt,2)||(J=0),J){case 111:tt=tt.replace(q,":-moz-$1")+tt;break;case 112:tt=tt.replace(R,"::-webkit-input-$1")+tt.replace(R,"::-moz-$1")+tt.replace(R,":-ms-input-$1")+tt}J=0}}return Ct+tt+Hs}function i(F,V,W){var le=V.trim().split(I);V=le;var x=le.length,pe=F.length;switch(pe){case 0:case 1:var G=0;for(F=pe===0?"":F[0]+" ";G<x;++G)V[G]=r(F,V[G],W).trim();break;default:var ke=G=0;for(V=[];G<x;++G)for(var ye=0;ye<pe;++ye)V[ke++]=r(F[ye]+" ",le[G],W).trim()}return V}function r(F,V,W){var le=V.charCodeAt(0);switch(33>le&&(le=(V=V.trim()).charCodeAt(0)),le){case 38:return V.replace(O,"$1"+F.trim());case 58:return F.trim()+V.replace(O,"$1"+F.trim());default:if(0<1*W&&0<V.indexOf("\f"))return V.replace(O,(F.charCodeAt(0)===58?"":"$1")+F.trim())}return F+V}function l(F,V,W,le){var x=F+";",pe=2*V+3*W+4*le;if(pe===944){F=x.indexOf(":",9)+1;var G=x.substring(F,x.length-1).trim();return G=x.substring(0,F).trim()+G+";",we===1||we===2&&u(G,1)?"-webkit-"+G+G:G}if(we===0||we===2&&!u(x,1))return x;switch(pe){case 1015:return x.charCodeAt(10)===97?"-webkit-"+x+x:x;case 951:return x.charCodeAt(3)===116?"-webkit-"+x+x:x;case 963:return x.charCodeAt(5)===110?"-webkit-"+x+x:x;case 1009:if(x.charCodeAt(4)!==100)break;case 969:case 942:return"-webkit-"+x+x;case 978:return"-webkit-"+x+"-moz-"+x+x;case 1019:case 983:return"-webkit-"+x+"-moz-"+x+"-ms-"+x+x;case 883:if(x.charCodeAt(8)===45)return"-webkit-"+x+x;if(0<x.indexOf("image-set(",11))return x.replace(qe,"$1-webkit-$2")+x;break;case 932:if(x.charCodeAt(4)===45)switch(x.charCodeAt(5)){case 103:return"-webkit-box-"+x.replace("-grow","")+"-webkit-"+x+"-ms-"+x.replace("grow","positive")+x;case 115:return"-webkit-"+x+"-ms-"+x.replace("shrink","negative")+x;case 98:return"-webkit-"+x+"-ms-"+x.replace("basis","preferred-size")+x}return"-webkit-"+x+"-ms-"+x+x;case 964:return"-webkit-"+x+"-ms-flex-"+x+x;case 1023:if(x.charCodeAt(8)!==99)break;return G=x.substring(x.indexOf(":",15)).replace("flex-","").replace("space-between","justify"),"-webkit-box-pack"+G+"-webkit-"+x+"-ms-flex-pack"+G+x;case 1005:return S.test(x)?x.replace(k,":-webkit-")+x.replace(k,":-moz-")+x:x;case 1e3:switch(G=x.substring(13).trim(),V=G.indexOf("-")+1,G.charCodeAt(0)+G.charCodeAt(V)){case 226:G=x.replace(re,"tb");break;case 232:G=x.replace(re,"tb-rl");break;case 220:G=x.replace(re,"lr");break;default:return x}return"-webkit-"+x+"-ms-"+G+x;case 1017:if(x.indexOf("sticky",9)===-1)break;case 975:switch(V=(x=F).length-10,G=(x.charCodeAt(V)===33?x.substring(0,V):x).substring(F.indexOf(":",7)+1).trim(),pe=G.charCodeAt(0)+(G.charCodeAt(7)|0)){case 203:if(111>G.charCodeAt(8))break;case 115:x=x.replace(G,"-webkit-"+G)+";"+x;break;case 207:case 102:x=x.replace(G,"-webkit-"+(102<pe?"inline-":"")+"box")+";"+x.replace(G,"-webkit-"+G)+";"+x.replace(G,"-ms-"+G+"box")+";"+x}return x+";";case 938:if(x.charCodeAt(5)===45)switch(x.charCodeAt(6)){case 105:return G=x.replace("-items",""),"-webkit-"+x+"-webkit-box-"+G+"-ms-flex-"+G+x;case 115:return"-webkit-"+x+"-ms-flex-item-"+x.replace(U,"")+x;default:return"-webkit-"+x+"-ms-flex-line-pack"+x.replace("align-content","").replace(U,"")+x}break;case 973:case 989:if(x.charCodeAt(3)!==45||x.charCodeAt(4)===122)break;case 931:case 953:if(Ne.test(F)===!0)return(G=F.substring(F.indexOf(":")+1)).charCodeAt(0)===115?l(F.replace("stretch","fill-available"),V,W,le).replace(":fill-available",":stretch"):x.replace(G,"-webkit-"+G)+x.replace(G,"-moz-"+G.replace("fill-",""))+x;break;case 962:if(x="-webkit-"+x+(x.charCodeAt(5)===102?"-ms-"+x:"")+x,W+le===211&&x.charCodeAt(13)===105&&0<x.indexOf("transform",10))return x.substring(0,x.indexOf(";",27)+1).replace(C,"$1-webkit-$2")+x}return x}function u(F,V){var W=F.indexOf(V===1?":":"{"),le=F.substring(0,V!==3?W:10);return W=F.substring(W+1,F.length-1),et(V!==2?le:le.replace(Me,"$1"),W,V)}function d(F,V){var W=l(V,V.charCodeAt(0),V.charCodeAt(1),V.charCodeAt(2));return W!==V+";"?W.replace($e," or ($1)").substring(4):"("+V+")"}function p(F,V,W,le,x,pe,G,ke,ye,Ie){for(var me=0,Ve=V,Ye;me<Y;++me)switch(Ye=Fe[me].call(v,F,Ve,W,le,x,pe,G,ke,ye,Ie)){case void 0:case!1:case!0:case null:break;default:Ve=Ye}if(Ve!==V)return Ve}function m(F){switch(F){case void 0:case null:Y=Fe.length=0;break;default:if(typeof F=="function")Fe[Y++]=F;else if(typeof F=="object")for(var V=0,W=F.length;V<W;++V)m(F[V]);else Z=!!F|0}return m}function f(F){return F=F.prefix,F!==void 0&&(et=null,F?typeof F!="function"?we=1:(we=2,et=F):we=0),f}function v(F,V){var W=F;if(33>W.charCodeAt(0)&&(W=W.trim()),se=W,W=[se],0<Y){var le=p(-1,V,W,W,de,ce,0,0,0,0);le!==void 0&&typeof le=="string"&&(V=le)}var x=s(ge,W,V,0,0);return 0<Y&&(le=p(-2,x,W,W,de,ce,x.length,0,0,0),le!==void 0&&(x=le)),se="",J=0,ce=de=1,x}var w=/^\0+/g,_=/[\0\r\f]/g,k=/: */g,S=/zoo|gra/,C=/([,: ])(transform)/g,I=/,\r+?/g,O=/([\t\r\n ])*\f?&/g,A=/@(k\w+)\s*(\S*)\s*/,R=/::(place)/g,q=/:(read-only)/g,re=/[svh]\w+-[tblr]{2}/,ie=/\(\s*(.*)\s*\)/g,$e=/([\s\S]*?);/g,U=/-self|flex-/g,Me=/[^]*?(:[rp][el]a[\w-]+)[^]*/,Ne=/stretch|:\s*\w+\-(?:conte|avail)/,qe=/([^-])(image-set\()/,ce=1,de=1,J=0,we=1,ge=[],Fe=[],Y=0,et=null,Z=0,se="";return v.use=m,v.set=f,a!==void 0&&f(a),v}var $D={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},ls={};function js(){return(js=Object.assign||function(a){for(var s=1;s<arguments.length;s++){var i=arguments[s];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(a[r]=i[r])}return a}).apply(this,arguments)}var e_=function(a,s){for(var i=[a[0]],r=0,l=s.length;r<l;r+=1)i.push(s[r],a[r+1]);return i},yg=function(a){return a!==null&&typeof a=="object"&&(a.toString?a.toString():Object.prototype.toString.call(a))==="[object Object]"&&!oC.typeOf(a)},Zl=Object.freeze([]),Io=Object.freeze({});function Rr(a){return typeof a=="function"}function t_(a){return a.displayName||a.name||"Component"}function Zg(a){return a&&typeof a.styledComponentId=="string"}var gn=typeof process<"u"&&ls!==void 0&&(ls.REACT_APP_SC_ATTR||ls.SC_ATTR)||"data-styled",Qg=typeof window<"u"&&"HTMLElement"in window,bD=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&ls!==void 0&&(ls.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&ls.REACT_APP_SC_DISABLE_SPEEDY!==""?ls.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&ls.REACT_APP_SC_DISABLE_SPEEDY:ls.SC_DISABLE_SPEEDY!==void 0&&ls.SC_DISABLE_SPEEDY!==""&&ls.SC_DISABLE_SPEEDY!=="false"&&ls.SC_DISABLE_SPEEDY)),vD={};function Ur(a){for(var s=arguments.length,i=new Array(s>1?s-1:0),r=1;r<s;r++)i[r-1]=arguments[r];throw new Error("An error occurred. See https://git.io/JUIaE#"+a+" for more information."+(i.length>0?" Args: "+i.join(", "):""))}var yD=(function(){function a(i){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=i}var s=a.prototype;return s.indexOfGroup=function(i){for(var r=0,l=0;l<i;l++)r+=this.groupSizes[l];return r},s.insertRules=function(i,r){if(i>=this.groupSizes.length){for(var l=this.groupSizes,u=l.length,d=u;i>=d;)(d<<=1)<0&&Ur(16,""+i);this.groupSizes=new Uint32Array(d),this.groupSizes.set(l),this.length=d;for(var p=u;p<d;p++)this.groupSizes[p]=0}for(var m=this.indexOfGroup(i+1),f=0,v=r.length;f<v;f++)this.tag.insertRule(m,r[f])&&(this.groupSizes[i]++,m++)},s.clearGroup=function(i){if(i<this.length){var r=this.groupSizes[i],l=this.indexOfGroup(i),u=l+r;this.groupSizes[i]=0;for(var d=l;d<u;d++)this.tag.deleteRule(l)}},s.getGroup=function(i){var r="";if(i>=this.length||this.groupSizes[i]===0)return r;for(var l=this.groupSizes[i],u=this.indexOfGroup(i),d=u+l,p=u;p<d;p++)r+=this.tag.getRule(p)+`/*!sc*/
126
+ `;return r},a})(),Gl=new Map,Ql=new Map,Cr=1,Ol=function(a){if(Gl.has(a))return Gl.get(a);for(;Ql.has(Cr);)Cr++;var s=Cr++;return Gl.set(a,s),Ql.set(s,a),s},_D=function(a){return Ql.get(a)},wD=function(a,s){s>=Cr&&(Cr=s+1),Gl.set(a,s),Ql.set(s,a)},CD="style["+gn+'][data-styled-version="5.3.11"]',TD=new RegExp("^"+gn+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),kD=function(a,s,i){for(var r,l=i.split(","),u=0,d=l.length;u<d;u++)(r=l[u])&&a.registerName(s,r)},SD=function(a,s){for(var i=(s.textContent||"").split(`/*!sc*/
127
+ `),r=[],l=0,u=i.length;l<u;l++){var d=i[l].trim();if(d){var p=d.match(TD);if(p){var m=0|parseInt(p[1],10),f=p[2];m!==0&&(wD(f,m),kD(a,f,p[3]),a.getTag().insertRules(m,r)),r.length=0}else r.push(d)}}},ED=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null},iC=function(a){var s=document.head,i=a||s,r=document.createElement("style"),l=(function(p){for(var m=p.childNodes,f=m.length;f>=0;f--){var v=m[f];if(v&&v.nodeType===1&&v.hasAttribute(gn))return v}})(i),u=l!==void 0?l.nextSibling:null;r.setAttribute(gn,"active"),r.setAttribute("data-styled-version","5.3.11");var d=ED();return d&&r.setAttribute("nonce",d),i.insertBefore(r,u),r},ID=(function(){function a(i){var r=this.element=iC(i);r.appendChild(document.createTextNode("")),this.sheet=(function(l){if(l.sheet)return l.sheet;for(var u=document.styleSheets,d=0,p=u.length;d<p;d++){var m=u[d];if(m.ownerNode===l)return m}Ur(17)})(r),this.length=0}var s=a.prototype;return s.insertRule=function(i,r){try{return this.sheet.insertRule(r,i),this.length++,!0}catch{return!1}},s.deleteRule=function(i){this.sheet.deleteRule(i),this.length--},s.getRule=function(i){var r=this.sheet.cssRules[i];return r!==void 0&&typeof r.cssText=="string"?r.cssText:""},a})(),xD=(function(){function a(i){var r=this.element=iC(i);this.nodes=r.childNodes,this.length=0}var s=a.prototype;return s.insertRule=function(i,r){if(i<=this.length&&i>=0){var l=document.createTextNode(r),u=this.nodes[i];return this.element.insertBefore(l,u||null),this.length++,!0}return!1},s.deleteRule=function(i){this.element.removeChild(this.nodes[i]),this.length--},s.getRule=function(i){return i<this.length?this.nodes[i].textContent:""},a})(),DD=(function(){function a(i){this.rules=[],this.length=0}var s=a.prototype;return s.insertRule=function(i,r){return i<=this.length&&(this.rules.splice(i,0,r),this.length++,!0)},s.deleteRule=function(i){this.rules.splice(i,1),this.length--},s.getRule=function(i){return i<this.length?this.rules[i]:""},a})(),s_=Qg,AD={isServer:!Qg,useCSSOMInjection:!bD},ec=(function(){function a(i,r,l){i===void 0&&(i=Io),r===void 0&&(r={}),this.options=js({},AD,{},i),this.gs=r,this.names=new Map(l),this.server=!!i.isServer,!this.server&&Qg&&s_&&(s_=!1,(function(u){for(var d=document.querySelectorAll(CD),p=0,m=d.length;p<m;p++){var f=d[p];f&&f.getAttribute(gn)!=="active"&&(SD(u,f),f.parentNode&&f.parentNode.removeChild(f))}})(this))}a.registerId=function(i){return Ol(i)};var s=a.prototype;return s.reconstructWithOptions=function(i,r){return r===void 0&&(r=!0),new a(js({},this.options,{},i),this.gs,r&&this.names||void 0)},s.allocateGSInstance=function(i){return this.gs[i]=(this.gs[i]||0)+1},s.getTag=function(){return this.tag||(this.tag=(l=(r=this.options).isServer,u=r.useCSSOMInjection,d=r.target,i=l?new DD(d):u?new ID(d):new xD(d),new yD(i)));var i,r,l,u,d},s.hasNameForId=function(i,r){return this.names.has(i)&&this.names.get(i).has(r)},s.registerName=function(i,r){if(Ol(i),this.names.has(i))this.names.get(i).add(r);else{var l=new Set;l.add(r),this.names.set(i,l)}},s.insertRules=function(i,r,l){this.registerName(i,r),this.getTag().insertRules(Ol(i),l)},s.clearNames=function(i){this.names.has(i)&&this.names.get(i).clear()},s.clearRules=function(i){this.getTag().clearGroup(Ol(i)),this.clearNames(i)},s.clearTag=function(){this.tag=void 0},s.toString=function(){return(function(i){for(var r=i.getTag(),l=r.length,u="",d=0;d<l;d++){var p=_D(d);if(p!==void 0){var m=i.names.get(p),f=r.getGroup(d);if(m&&f&&m.size){var v=gn+".g"+d+'[id="'+p+'"]',w="";m!==void 0&&m.forEach((function(_){_.length>0&&(w+=_+",")})),u+=""+f+v+'{content:"'+w+`"}/*!sc*/
128
+ `}}}return u})(this)},a})(),RD=/(a)(d)/gi,o_=function(a){return String.fromCharCode(a+(a>25?39:97))};function _g(a){var s,i="";for(s=Math.abs(a);s>52;s=s/52|0)i=o_(s%52)+i;return(o_(s%52)+i).replace(RD,"$1-$2")}var an=function(a,s){for(var i=s.length;i;)a=33*a^s.charCodeAt(--i);return a},nC=function(a){return an(5381,a)};function rC(a){for(var s=0;s<a.length;s+=1){var i=a[s];if(Rr(i)&&!Zg(i))return!1}return!0}var OD=nC("5.3.11"),MD=(function(){function a(s,i,r){this.rules=s,this.staticRulesId="",this.isStatic=(r===void 0||r.isStatic)&&rC(s),this.componentId=i,this.baseHash=an(OD,i),this.baseStyle=r,ec.registerId(i)}return a.prototype.generateAndInjectStyles=function(s,i,r){var l=this.componentId,u=[];if(this.baseStyle&&u.push(this.baseStyle.generateAndInjectStyles(s,i,r)),this.isStatic&&!r.hash)if(this.staticRulesId&&i.hasNameForId(l,this.staticRulesId))u.push(this.staticRulesId);else{var d=di(this.rules,s,i,r).join(""),p=_g(an(this.baseHash,d)>>>0);if(!i.hasNameForId(l,p)){var m=r(d,"."+p,void 0,l);i.insertRules(l,p,m)}u.push(p),this.staticRulesId=p}else{for(var f=this.rules.length,v=an(this.baseHash,r.hash),w="",_=0;_<f;_++){var k=this.rules[_];if(typeof k=="string")w+=k;else if(k){var S=di(k,s,i,r),C=Array.isArray(S)?S.join(""):S;v=an(v,C+_),w+=C}}if(w){var I=_g(v>>>0);if(!i.hasNameForId(l,I)){var O=r(w,"."+I,void 0,l);i.insertRules(l,I,O)}u.push(I)}}return u.join(" ")},a})(),ND=/^\s*\/\/.*$/gm,LD=[":","[",".","#"];function BD(a){var s,i,r,l,u=Io,d=u.options,p=d===void 0?Io:d,m=u.plugins,f=m===void 0?Zl:m,v=new fD(p),w=[],_=(function(C){function I(O){if(O)try{C(O+"}")}catch{}}return function(O,A,R,q,re,ie,$e,U,Me,Ne){switch(O){case 1:if(Me===0&&A.charCodeAt(0)===64)return C(A+";"),"";break;case 2:if(U===0)return A+"/*|*/";break;case 3:switch(U){case 102:case 112:return C(R[0]+A),"";default:return A+(Ne===0?"/*|*/":"")}case-2:A.split("/*|*/}").forEach(I)}}})((function(C){w.push(C)})),k=function(C,I,O){return I===0&&LD.indexOf(O[i.length])!==-1||O.match(l)?C:"."+s};function S(C,I,O,A){A===void 0&&(A="&");var R=C.replace(ND,""),q=I&&O?O+" "+I+" { "+R+" }":R;return s=A,i=I,r=new RegExp("\\"+i+"\\b","g"),l=new RegExp("(\\"+i+"\\b){2,}"),v(O||!I?"":I,q)}return v.use([].concat(f,[function(C,I,O){C===2&&O.length&&O[0].lastIndexOf(i)>0&&(O[0]=O[0].replace(r,k))},_,function(C){if(C===-2){var I=w;return w=[],I}}])),S.hash=f.length?f.reduce((function(C,I){return I.name||Ur(15),an(C,I.name)}),5381).toString():"",S}var aC=X.createContext();aC.Consumer;var lC=X.createContext(),PD=(lC.Consumer,new ec),wg=BD();function cC(){return H.useContext(aC)||PD}function uC(){return H.useContext(lC)||wg}var FD=(function(){function a(s,i){var r=this;this.inject=function(l,u){u===void 0&&(u=wg);var d=r.name+u.hash;l.hasNameForId(r.id,d)||l.insertRules(r.id,d,u(r.rules,d,"@keyframes"))},this.toString=function(){return Ur(12,String(r.name))},this.name=s,this.id="sc-keyframes-"+s,this.rules=i}return a.prototype.getName=function(s){return s===void 0&&(s=wg),this.name+s.hash},a})(),jD=/([A-Z])/,zD=/([A-Z])/g,UD=/^ms-/,HD=function(a){return"-"+a.toLowerCase()};function i_(a){return jD.test(a)?a.replace(zD,HD).replace(UD,"-ms-"):a}var n_=function(a){return a==null||a===!1||a===""};function di(a,s,i,r){if(Array.isArray(a)){for(var l,u=[],d=0,p=a.length;d<p;d+=1)(l=di(a[d],s,i,r))!==""&&(Array.isArray(l)?u.push.apply(u,l):u.push(l));return u}if(n_(a))return"";if(Zg(a))return"."+a.styledComponentId;if(Rr(a)){if(typeof(f=a)!="function"||f.prototype&&f.prototype.isReactComponent||!s)return a;var m=a(s);return di(m,s,i,r)}var f;return a instanceof FD?i?(a.inject(i,r),a.getName(r)):a:yg(a)?(function v(w,_){var k,S,C=[];for(var I in w)w.hasOwnProperty(I)&&!n_(w[I])&&(Array.isArray(w[I])&&w[I].isCss||Rr(w[I])?C.push(i_(I)+":",w[I],";"):yg(w[I])?C.push.apply(C,v(w[I],I)):C.push(i_(I)+": "+(k=I,(S=w[I])==null||typeof S=="boolean"||S===""?"":typeof S!="number"||S===0||k in $D||k.startsWith("--")?String(S).trim():S+"px")+";"));return _?[_+" {"].concat(C,["}"]):C})(a):a.toString()}var r_=function(a){return Array.isArray(a)&&(a.isCss=!0),a};function dC(a){for(var s=arguments.length,i=new Array(s>1?s-1:0),r=1;r<s;r++)i[r-1]=arguments[r];return Rr(a)||yg(a)?r_(di(e_(Zl,[a].concat(i)))):i.length===0&&a.length===1&&typeof a[0]=="string"?a:r_(di(e_(a,i)))}var hC=function(a,s,i){return i===void 0&&(i=Io),a.theme!==i.theme&&a.theme||s||i.theme},WD=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,VD=/(^-|-$)/g;function Lp(a){return a.replace(WD,"-").replace(VD,"")}var pC=function(a){return _g(nC(a)>>>0)};function Ml(a){return typeof a=="string"&&!0}var Cg=function(a){return typeof a=="function"||typeof a=="object"&&a!==null&&!Array.isArray(a)},GD=function(a){return a!=="__proto__"&&a!=="constructor"&&a!=="prototype"};function KD(a,s,i){var r=a[i];Cg(s)&&Cg(r)?gC(r,s):a[i]=s}function gC(a){for(var s=arguments.length,i=new Array(s>1?s-1:0),r=1;r<s;r++)i[r-1]=arguments[r];for(var l=0,u=i;l<u.length;l++){var d=u[l];if(Cg(d))for(var p in d)GD(p)&&KD(a,d[p],p)}return a}var em=X.createContext();em.Consumer;var Bp={};function mC(a,s,i){var r=Zg(a),l=!Ml(a),u=s.attrs,d=u===void 0?Zl:u,p=s.componentId,m=p===void 0?(function(A,R){var q=typeof A!="string"?"sc":Lp(A);Bp[q]=(Bp[q]||0)+1;var re=q+"-"+pC("5.3.11"+q+Bp[q]);return R?R+"-"+re:re})(s.displayName,s.parentComponentId):p,f=s.displayName,v=f===void 0?(function(A){return Ml(A)?"styled."+A:"Styled("+t_(A)+")"})(a):f,w=s.displayName&&s.componentId?Lp(s.displayName)+"-"+s.componentId:s.componentId||m,_=r&&a.attrs?Array.prototype.concat(a.attrs,d).filter(Boolean):d,k=s.shouldForwardProp;r&&a.shouldForwardProp&&(k=s.shouldForwardProp?function(A,R,q){return a.shouldForwardProp(A,R,q)&&s.shouldForwardProp(A,R,q)}:a.shouldForwardProp);var S,C=new MD(i,w,r?a.componentStyle:void 0),I=C.isStatic&&d.length===0,O=function(A,R){return(function(q,re,ie,$e){var U=q.attrs,Me=q.componentStyle,Ne=q.defaultProps,qe=q.foldedComponentIds,ce=q.shouldForwardProp,de=q.styledComponentId,J=q.target,we=(function(le,x,pe){le===void 0&&(le=Io);var G=js({},x,{theme:le}),ke={};return pe.forEach((function(ye){var Ie,me,Ve,Ye=ye;for(Ie in Rr(Ye)&&(Ye=Ye(G)),Ye)G[Ie]=ke[Ie]=Ie==="className"?(me=ke[Ie],Ve=Ye[Ie],me&&Ve?me+" "+Ve:me||Ve):Ye[Ie]})),[G,ke]})(hC(re,H.useContext(em),Ne)||Io,re,U),ge=we[0],Fe=we[1],Y=(function(le,x,pe,G){var ke=cC(),ye=uC(),Ie=x?le.generateAndInjectStyles(Io,ke,ye):le.generateAndInjectStyles(pe,ke,ye);return Ie})(Me,$e,ge),et=ie,Z=Fe.$as||re.$as||Fe.as||re.as||J,se=Ml(Z),F=Fe!==re?js({},re,{},Fe):re,V={};for(var W in F)W[0]!=="$"&&W!=="as"&&(W==="forwardedAs"?V.as=F[W]:(ce?ce(W,gy,Z):!se||gy(W))&&(V[W]=F[W]));return re.style&&Fe.style!==re.style&&(V.style=js({},re.style,{},Fe.style)),V.className=Array.prototype.concat(qe,de,Y!==de?Y:null,re.className,Fe.className).filter(Boolean).join(" "),V.ref=et,H.createElement(Z,V)})(S,A,R,I)};return O.displayName=v,(S=X.forwardRef(O)).attrs=_,S.componentStyle=C,S.displayName=v,S.shouldForwardProp=k,S.foldedComponentIds=r?Array.prototype.concat(a.foldedComponentIds,a.styledComponentId):Zl,S.styledComponentId=w,S.target=r?a.target:a,S.withComponent=function(A){var R=s.componentId,q=(function(ie,$e){if(ie==null)return{};var U,Me,Ne={},qe=Object.keys(ie);for(Me=0;Me<qe.length;Me++)U=qe[Me],$e.indexOf(U)>=0||(Ne[U]=ie[U]);return Ne})(s,["componentId"]),re=R&&R+"-"+(Ml(A)?A:Lp(t_(A)));return mC(A,js({},q,{attrs:_,componentId:re}),i)},Object.defineProperty(S,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(A){this._foldedDefaultProps=r?gC({},a.defaultProps,A):A}}),Object.defineProperty(S,"toString",{value:function(){return"."+S.styledComponentId}}),l&&jT(S,a,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),S}var ds=function(a){return(function s(i,r,l){if(l===void 0&&(l=Io),!oC.isValidElementType(r))return Ur(1,String(r));var u=function(){return i(r,l,dC.apply(void 0,arguments))};return u.withConfig=function(d){return s(i,r,js({},l,{},d))},u.attrs=function(d){return s(i,r,js({},l,{attrs:Array.prototype.concat(l.attrs,d).filter(Boolean)}))},u})(mC,a)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach((function(a){ds[a]=ds(a)}));var YD=(function(){function a(i,r){this.rules=i,this.componentId=r,this.isStatic=rC(i),ec.registerId(this.componentId+1)}var s=a.prototype;return s.createStyles=function(i,r,l,u){var d=u(di(this.rules,r,l,u).join(""),""),p=this.componentId+i;l.insertRules(p,p,d)},s.removeStyles=function(i,r){r.clearRules(this.componentId+i)},s.renderStyles=function(i,r,l,u){i>2&&ec.registerId(this.componentId+i),this.removeStyles(i,l),this.createStyles(i,r,l,u)},a})();function JD(a){for(var s=arguments.length,i=new Array(s>1?s-1:0),r=1;r<s;r++)i[r-1]=arguments[r];var l=dC.apply(void 0,[a].concat(i)),u="sc-global-"+pC(JSON.stringify(l)),d=new YD(l,u);function p(f){var v=cC(),w=uC(),_=H.useContext(em),k=H.useRef(v.allocateGSInstance(u)).current;return v.server&&m(k,f,v,_,w),H.useLayoutEffect((function(){if(!v.server)return m(k,f,v,_,w),function(){return d.removeStyles(k,v)}}),[k,f,v,_,w]),null}function m(f,v,w,_,k){if(d.isStatic)d.renderStyles(f,vD,w,k);else{var S=js({},v,{theme:hC(v,_,p.defaultProps)});d.renderStyles(f,S,w,k)}}return X.memo(p)}function a_(a,s){(s==null||s>a.length)&&(s=a.length);for(var i=0,r=Array(s);i<s;i++)r[i]=a[i];return r}function XD(a){if(Array.isArray(a))return a}function qD(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function ZD(a,s,i){return s=tc(s),n0(a,fC()?Reflect.construct(s,[],tc(a).constructor):s.apply(a,i))}function QD(a,s){if(!(a instanceof s))throw new TypeError("Cannot call a class as a function")}function e0(a,s){for(var i=0;i<s.length;i++){var r=s[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(a,$C(r.key),r)}}function t0(a,s,i){return s&&e0(a.prototype,s),Object.defineProperty(a,"prototype",{writable:!1}),a}function dn(a,s){var i=typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(!i){if(Array.isArray(a)||(i=bC(a))||s){i&&(a=i);var r=0,l=function(){};return{s:l,n:function(){return r>=a.length?{done:!0}:{done:!1,value:a[r++]}},e:function(m){throw m},f:l}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
129
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var u,d=!0,p=!1;return{s:function(){i=i.call(a)},n:function(){var m=i.next();return d=m.done,m},e:function(m){p=!0,u=m},f:function(){try{d||i.return==null||i.return()}finally{if(p)throw u}}}}function as(a,s,i){return(s=$C(s))in a?Object.defineProperty(a,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[s]=i,a}function tc(a){return tc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},tc(a)}function s0(a,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(s&&s.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),s&&Tg(a,s)}function fC(){try{var a=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(fC=function(){return!!a})()}function o0(a,s){var i=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(i!=null){var r,l,u,d,p=[],m=!0,f=!1;try{if(u=(i=i.call(a)).next,s!==0)for(;!(m=(r=u.call(i)).done)&&(p.push(r.value),p.length!==s);m=!0);}catch(v){f=!0,l=v}finally{try{if(!m&&i.return!=null&&(d=i.return(),Object(d)!==d))return}finally{if(f)throw l}}return p}}function i0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
130
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function l_(a,s){var i=Object.keys(a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);s&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(a,l).enumerable})),i.push.apply(i,r)}return i}function sc(a){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{};s%2?l_(Object(i),!0).forEach(function(r){as(a,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):l_(Object(i)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(i,r))})}return a}function n0(a,s){if(s&&(typeof s=="object"||typeof s=="function"))return s;if(s!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qD(a)}function Tg(a,s){return Tg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,r){return i.__proto__=r,i},Tg(a,s)}function r0(a,s){return XD(a)||o0(a,s)||bC(a,s)||i0()}function Ts(a,s){return s||(s=a.slice(0)),Object.freeze(Object.defineProperties(a,{raw:{value:Object.freeze(s)}}))}function a0(a,s){if(typeof a!="object"||!a)return a;var i=a[Symbol.toPrimitive];if(i!==void 0){var r=i.call(a,s);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(a)}function $C(a){var s=a0(a,"string");return typeof s=="symbol"?s:s+""}function bC(a,s){if(a){if(typeof a=="string")return a_(a,s);var i={}.toString.call(a).slice(8,-1);return i==="Object"&&a.constructor&&(i=a.constructor.name),i==="Map"||i==="Set"?Array.from(a):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a_(a,s):void 0}}var c_,l0=JD(c_||(c_=Ts([`
131
+ .focus-outline-hidden :focus {
132
+ outline: none;
133
+ }
134
+ `]))),u_,vC=ds.button(u_||(u_=Ts([`
135
+ display: block;
136
+ padding: 0;
137
+ border: 0;
138
+ background: none;
139
+ font-size: 0;
140
+ cursor: `,`;
141
+ `])),function(a){return a.disabled?"not-allowed":"pointer"}),d_,h_,c0=ds.span(d_||(d_=Ts([`
142
+ font-size: 12px;
143
+ line-height: 1;
144
+ `])));function yC(a){var s=a.className,i=a.onClick,r=a.inverted,l=a.label,u=a.disabled;return X.createElement(vC,{className:s,onClick:i,"data-tour-elem":"".concat(r?"right":"left","-arrow"),disabled:u},l?X.createElement(c0,null,l):X.createElement("svg",{viewBox:"0 0 18.4 14.4"},X.createElement("path",{d:r?"M17 7.2H1M10.8 1L17 7.2l-6.2 6.2":"M1.4 7.2h16M7.6 1L1.4 7.2l6.2 6.2",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeMiterlimit:"10"})))}yC.propTypes={className:ee.string.isRequired,onClick:ee.func.isRequired,inverted:ee.bool,label:ee.node,disabled:ee.bool};var p_=ds(yC)(h_||(h_=Ts([`
145
+ color: `,`;
146
+
147
+ `,`;
148
+ `,`;
149
+
150
+ &:hover {
151
+ color: `,`;
152
+ }
153
+ `])),function(a){return a.disabled?"#caccce":"#646464"},function(a){return a.inverted?"margin-left: 24px;":"margin-right: 24px;"},function(a){return!a.label&&`
154
+ width: 16px;
155
+ height: 12px;
156
+ flex: 0 0 16px;
157
+ `},function(a){return a.disabled?"#caccce":"#000"}),g_;function _C(a){var s=a.className,i=a.onClick,r=a.ariaLabel;return X.createElement(vC,{className:s,onClick:i,"aria-label":r},X.createElement("svg",{viewBox:"0 0 9.1 9.1","aria-hidden":!0,role:"presentation"},X.createElement("path",{fill:"currentColor",d:"M5.9 4.5l2.8-2.8c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0L4.5 3.1 1.7.3C1.3-.1.7-.1.3.3c-.4.4-.4 1 0 1.4l2.8 2.8L.3 7.4c-.4.4-.4 1 0 1.4.2.2.4.3.7.3s.5-.1.7-.3L4.5 6l2.8 2.8c.3.2.5.3.8.3s.5-.1.7-.3c.4-.4.4-1 0-1.4L5.9 4.5z"})))}_C.propTypes={className:ee.string.isRequired,onClick:ee.func.isRequired,ariaLabel:ee.string};var u0=ds(_C)(g_||(g_=Ts([`
158
+ position: absolute;
159
+ top: 22px;
160
+ right: 22px;
161
+ width: 9px;
162
+ height: 9px;
163
+ color: #5e5e5e;
164
+ &:hover {
165
+ color: #000;
166
+ }
167
+ `])));function Kl(a){var s=a.getBoundingClientRect(),i=s.top,r=s.right,l=s.bottom,u=s.left,d=s.width,p=s.height;return{top:i,right:r,bottom:l,left:u,width:d,height:p}}function wC(a,s){if(!s.highlightedSelectors)return Kl(a);var i=Kl(a),r=dn(s.highlightedSelectors),l;try{for(r.s();!(l=r.n()).done;){var u=l.value,d=document.querySelector(u);if(!(!d||d.style.display==="none"||d.style.visibility==="hidden")){var p=Kl(d);p.top<i.top&&(i.top=p.top),p.right>i.right&&(i.right=p.right),p.bottom>i.bottom&&(i.bottom=p.bottom),p.left<i.left&&(i.left=p.left)}}}catch(m){r.e(m)}finally{r.f()}return i.width=i.right-i.left,i.height=i.bottom-i.top,i}function d0(a){var s=a.top,i=a.right,r=a.bottom,l=a.left,u=a.w,d=a.h,p=a.threshold,m=p===void 0?0:p;return s>=0+m&&l>=0+m&&r<=d-m&&i<=u-m}function h0(a){return a===document.querySelector("body")||a===document.querySelector("html")}var p0=function(s){return/(left|right)/.test(s)},Pp=function(s,i){return s>i},Fp=function(s,i){return s>i},Fs=function(s){return s<0?0:s};function g0(a){return Object.keys(a).map(function(s){return{position:s,value:a[s]}}).sort(function(s,i){return i.value-s.value}).map(function(s){return s.position})}var m_,m0=ds.div(m_||(m_=Ts([`
168
+ --reactour-accent: `,`;
169
+ `,`
170
+ position: fixed;
171
+ transition: transform 0.3s;
172
+ top: 0;
173
+ left: 0;
174
+ z-index: 1000000;
175
+
176
+ transform: `,`;
177
+ `])),function(a){return a.accentColor},function(a){return a.defaultStyles?`
178
+ max-width: 331px;
179
+ min-width: 150px;
180
+ padding-right: 40px;
181
+ border-radius: `.concat(a.rounded,`px;
182
+ background-color: #fff;
183
+ padding: 24px 30px;
184
+ box-shadow: 0 0.5em 3em rgba(0, 0, 0, 0.3);
185
+ color: inherit;
186
+ `):""},function(a){var s=a.targetTop,i=a.targetRight,r=a.targetBottom,l=a.targetLeft,u=a.windowWidth,d=a.windowHeight,p=a.helperWidth,m=a.helperHeight,f=a.helperPosition,v=a.padding,w={left:l,right:u-i,top:s,bottom:d-r},_=function(O){return w[O]>(p0(O)?p+v*2:m+v*2)},k=function(O){for(var A=g0(w),R=0;R<A.length;R++)if(_(A[R]))return O[A[R]];return O.center},S=function(O){if(Array.isArray(O)){var A=Pp(O[0],u),R=Fp(O[1],d),q=function(qe,ce){console.warn("".concat(qe,":").concat(ce," is outside window, falling back to center"))};return A&&q("x",O[0]),R&&q("y",O[1]),[A?u/2-p/2:O[0],R?d/2-m/2:O[1]]}var re=Pp(l+p,u)?Pp(i+v,u)?i-p:i-p+v:l-v,ie=re>v?re:v,$e=Fp(s+m,d)?Fp(r+v,d)?r-m:r-m+v:s-v,U=$e>v?$e:v,Me={top:[ie,s-m-v*2],right:[i+v*2,U],bottom:[ie,r+v*2],left:[l-p-v*2,U],center:[u/2-p/2,d/2-m/2]};return O==="center"||_(O)?Me[O]:k(Me)},C=S(f);return"translate(".concat(Math.round(C[0]),"px, ").concat(Math.round(C[1]),"px)")}),f_,f0=ds.span(f_||(f_=Ts([`
187
+ position: absolute;
188
+ font-family: monospace;
189
+ background: var(--reactour-accent);
190
+ background: `,`;
191
+ height: 1.875em;
192
+ line-height: 2;
193
+ padding-left: 0.8125em;
194
+ padding-right: 0.8125em;
195
+ font-size: 1em;
196
+ border-radius: 1.625em;
197
+ color: white;
198
+ text-align: center;
199
+ box-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.3);
200
+ top: -0.8125em;
201
+ left: -0.8125em;
202
+ `])),function(a){return a.accentColor}),$_,$0=ds.div($_||($_=Ts([`
203
+ display: flex;
204
+ margin-top: 24px;
205
+ align-items: center;
206
+ justify-content: center;
207
+ `]))),b_,b0=ds.nav(b_||(b_=Ts([`
208
+ counter-reset: dot;
209
+ display: flex;
210
+ justify-content: center;
211
+ align-items: center;
212
+ flex-wrap: wrap;
213
+ `]))),v_,v0=ds.button(v_||(v_=Ts([`
214
+ counter-increment: dot;
215
+ width: 8px;
216
+ height: 8px;
217
+ border: `,`;
218
+
219
+ border-radius: 100%;
220
+ padding: 0;
221
+ display: block;
222
+ margin: 4px;
223
+ transition: opacity 0.3s, transform 0.3s;
224
+ cursor: `,`;
225
+ transform: scale(`,`);
226
+
227
+ color: `,`;
228
+ background: `,`;
229
+
230
+ color: `,`;
231
+ background: `,`;
232
+
233
+ &:before {
234
+ content: counter(dot);
235
+ position: absolute;
236
+ bottom: calc(100% + 0.25em);
237
+ left: 50%;
238
+ opacity: 0;
239
+ transform: translate(-50%, 1em);
240
+ transition: 0.3s;
241
+ display: `,`;
242
+ }
243
+
244
+ &:hover {
245
+ background-color: currentColor;
246
+
247
+ &:before {
248
+ opacity: 0.5;
249
+ transform: translate(-50%, -2px);
250
+ }
251
+ }
252
+ `])),function(a){return a.current===a.index?"0":"1px solid #caccce"},function(a){return a.disabled?"not-allowed":"pointer"},function(a){return a.current===a.index?1.25:1},function(a){return a.current===a.index?"var(--reactour-accent)":"#caccce"},function(a){return a.current===a.index?"var(--reactour-accent)":"none"},function(a){return a.current===a.index?a.accentColor:"#caccce"},function(a){return a.current===a.index?a.accentColor:"none"},function(a){return a.showNumber?"block":"none"}),y_,y0=ds.div(y_||(y_=Ts([`
253
+ opacity: `,`;
254
+ color: `,`;
255
+ width: 100%;
256
+ left: 0;
257
+ top: 0;
258
+ height: 100%;
259
+ position: fixed;
260
+ z-index: 99999;
261
+ pointer-events: none;
262
+ `])),function(a){return!a.maskClassName&&.7},function(a){return!a.maskClassName&&"#000"});function CC(a){var s=a.windowWidth,i=a.windowHeight,r=a.targetWidth,l=a.targetHeight,u=a.targetTop,d=a.targetLeft,p=a.padding,m=a.rounded,f=a.roundedStep,v=a.disableInteraction,w=a.disableInteractionClassName,_=a.className,k=a.onClick,S=a.highlightedBorder,C=Fs(r+p*2),I=Fs(l+p*2),O=Fs(u-p),A=Fs(d-p),R=f?Math.min(C/2,I/2):m;return X.createElement(y0,{onClick:k,maskClassName:_},X.createElement("svg",{width:s,height:i,xmlns:"http://www.w3.org/2000/svg",className:_},X.createElement("defs",null,X.createElement("mask",{id:"mask-main"},X.createElement("rect",{x:0,y:0,width:s,height:i,fill:"white"}),X.createElement("rect",{x:A,y:O,width:C,height:I,fill:"black"}),X.createElement("rect",{x:A-1,y:O-1,width:R,height:R,fill:"white"}),X.createElement("circle",{cx:A+R,cy:O+R,r:R,fill:"black"}),X.createElement("rect",{x:A+C-R+1,y:O-1,width:R,height:R,fill:"white"}),X.createElement("circle",{cx:A+C-R,cy:O+R,r:R,fill:"black"}),X.createElement("rect",{x:A-1,y:O+I-R+1,width:R,height:R,fill:"white"}),X.createElement("circle",{cx:A+R,cy:O+I-R,r:R,fill:"black"}),X.createElement("rect",{x:A+C-R+1,y:O+I-R+1,width:R,height:R,fill:"white"}),X.createElement("circle",{cx:A+C-R,cy:O+I-R,r:R,fill:"black "})),X.createElement("clipPath",{id:"clip-path"},X.createElement("rect",{x:0,y:0,width:s,height:O}),X.createElement("rect",{x:0,y:O,width:A,height:I}),X.createElement("rect",{x:d+r+p,y:O,width:Fs(s-r-A),height:I}),X.createElement("rect",{x:0,y:u+l+p,width:s,height:Fs(i-l-O)}))),X.createElement("rect",{x:0,y:0,width:s,height:i,fill:"currentColor",mask:"url(#mask-main)"}),X.createElement("rect",{x:0,y:0,width:s,height:i,fill:"currentColor",clipPath:"url(#clip-path)",pointerEvents:"auto"}),X.createElement("rect",{x:A,y:O,width:C,height:I,pointerEvents:"auto",fill:"transparent",display:v?"block":"none",className:w}),S&&X.createElement("rect",{x:Fs(A+S.width/2),y:Fs(O+S.width/2),width:Fs(C-S.width),height:Fs(I-S.width),pointerEvents:"auto",fill:"none",strokeWidth:S.width,stroke:S.color,rx:R-2})))}CC.propTypes={windowWidth:ee.number.isRequired,windowHeight:ee.number.isRequired,targetWidth:ee.number.isRequired,targetHeight:ee.number.isRequired,targetTop:ee.number.isRequired,targetLeft:ee.number.isRequired,padding:ee.number.isRequired,rounded:ee.number.isRequired,roundedStep:ee.bool,disableInteraction:ee.bool.isRequired,disableInteractionClassName:ee.string.isRequired,highlightedBorder:ee.shape({color:ee.string.isRequired,width:ee.number.isRequired})};var _0=(function(a){var s=a.step,i=a.refresh,r=H.useState(0),l=r0(r,2),u=l[0],d=l[1];return H.useEffect(function(){if(s.resizeObservables){var p=function(_){var k=dn(_),S;try{var C=function(){var O=S.value;if(!O.attributes)return 1;var A=s.resizeObservables.find(function(R){return O.matches(R)||O.querySelector(R)!=null});A&&d(u+1)};for(k.s();!(S=k.n()).done;)C()}catch(I){k.e(I)}finally{k.f()}},m=new MutationObserver(function(w){var _=dn(w),k;try{for(_.s();!(k=_.n()).done;){var S=k.value;S.addedNodes.length!==0&&p(S.addedNodes),S.removedNodes.length!==0&&p(S.removedNodes)}}catch(C){_.e(C)}finally{_.f()}}),f=document.documentElement||document.body,v={childList:!0,subtree:!0};return m.observe(f,v),function(){m.disconnect()}}},[s,u]),H.useEffect(function(){if(s.resizeObservables){var p=new ResizeObserver(function(_){i()}),m=dn(s.resizeObservables),f;try{for(m.s();!(f=m.n()).done;){var v=f.value,w=document.querySelector(v);w&&p.observe(w)}}catch(_){m.e(_)}finally{m.f()}return function(){p.disconnect()}}},[s,u]),null}),w0=(function(a){var s=a.step,i=a.refresh;return H.useEffect(function(){if(s.mutationObservables){var r=function(m){var f=dn(m),v;try{var w=function(){var k=v.value;if(!k.attributes)return 1;var S=s.mutationObservables.find(function(C){return k.matches(C)||k.querySelector(C)!=null});S&&i()};for(f.s();!(v=f.n()).done;)w()}catch(_){f.e(_)}finally{f.f()}},l=new MutationObserver(function(p){var m=dn(p),f;try{for(m.s();!(f=m.n()).done;){var v=f.value;v.addedNodes.length!==0&&r(v.addedNodes),v.removedNodes.length!==0&&r(v.removedNodes)}}catch(w){m.e(w)}finally{m.f()}}),u=document.documentElement||document.body,d={childList:!0,subtree:!0};return l.observe(u,d),function(){l.disconnect()}}},[s]),null});function C0(a){var s=a.children,i=H.useRef(null);return i.current===null&&(i.current=document.createElement("div"),i.current.setAttribute("id","___reactour")),H.useEffect(function(){return document.body.appendChild(i.current),function(){document.body.removeChild(i.current)}},[i]),P_.createPortal(s,i.current)}var T0={disableFocusLock:ee.bool,badgeContent:ee.func,highlightedMaskClassName:ee.string,children:ee.oneOfType([ee.node,ee.element]),className:ee.string,closeButtonAriaLabel:ee.string,closeWithMask:ee.bool,inViewThreshold:ee.number,isOpen:ee.bool.isRequired,lastStepNextButton:ee.node,maskClassName:ee.string,maskSpace:ee.number,nextButton:ee.node,onAfterOpen:ee.func,onBeforeClose:ee.func,onRequestClose:ee.func,prevButton:ee.node,scrollDuration:ee.number,scrollOffset:ee.number,showButtons:ee.bool,showCloseButton:ee.bool,showNavigation:ee.bool,showNavigationNumber:ee.bool,showNumber:ee.bool,startAt:ee.number,goToStep:ee.number,getCurrentStep:ee.func,nextStep:ee.func,prevStep:ee.func,steps:ee.arrayOf(ee.shape({selector:ee.string,content:ee.oneOfType([ee.node,ee.element,ee.func]).isRequired,position:ee.oneOfType([ee.arrayOf(ee.number),ee.oneOf(["top","right","bottom","left","center"])]),action:ee.func,style:ee.object,stepInteraction:ee.bool,navDotAriaLabel:ee.string,roundedStep:ee.bool})),update:ee.string,updateDelay:ee.number,disableInteraction:ee.bool,disableDotsNavigation:ee.bool,disableKeyboardNavigation:ee.oneOfType([ee.arrayOf(ee.oneOf(["esc","right","left"])),ee.bool]),rounded:ee.number,accentColor:ee.string,highlightedBorder:ee.shape({color:ee.string.isRequired,width:ee.number.isRequired})},k0={disableFocusLock:!1,showNavigation:!0,showNavigationNumber:!0,showButtons:!0,showCloseButton:!0,closeButtonAriaLabel:"Close",showNumber:!0,scrollDuration:1,maskSpace:10,updateDelay:1,disableInteraction:!1,rounded:0,accentColor:"#007aff",closeWithMask:!0},tn={mask:{disableInteraction:"reactour__mask--disable-interaction"},helper:{base:"reactour__helper",isOpen:"reactour__helper--is-open"},dot:{base:"reactour__dot",active:"reactour__dot--is-active"}},tm=(function(a){function s(){var i;return QD(this,s),i=ZD(this,s),as(i,"unlockFocus",function(r){i.setState({focusUnlocked:!0},r())}),as(i,"showStep",function(){if(!(!i.helper||!i.helper.current)){var r=i.props.steps,l=i.state,u=l.current,d=l.focusUnlocked;d&&i.setState({focusUnlocked:!1});var p=r[u],m=p.selector?document.querySelector(p.selector):null,f=function(S){p.action&&typeof p.action=="function"&&i.unlockFocus(function(){return p.action(S)})};if(p.observe){var v=document.querySelector(p.observe),w={attributes:!0,childList:!0,characterData:!0};i.setState(function(k){return k.observer&&setTimeout(function(){k.observer.disconnect()},0),{observer:new MutationObserver(function(S){S.forEach(function(C){if(C.type==="childList"&&C.addedNodes.length>0){var I=function(){return f(C.addedNodes[0])};setTimeout(function(){return i.calculateNode(C.addedNodes[0],p,I)},100)}else if(C.type==="childList"&&C.removedNodes.length>0){var O=function(){return f(m)};i.calculateNode(m,p,O)}})})}},function(){return i.state.observer.observe(v,w)})}else i.state.observer&&(i.state.observer.disconnect(),i.setState({observer:null}));if(m){var _=function(){return f(m)};i.calculateNode(m,p,_)}else i.setState(jp(null,p,i.helper.current),f),p.selector&&console.warn("Doesn't find a DOM node '".concat(p.selector,"'. Please check the 'steps' Tour prop Array at position ").concat(u,"."))}}),as(i,"calculateNode",function(r,l,u){var d=i.props,p=d.scrollDuration,m=d.inViewThreshold,f=d.scrollOffset,v=wC(r,l),w=Math.max(document.documentElement.clientWidth,window.innerWidth||0),_=Math.max(document.documentElement.clientHeight,window.innerHeight||0);if(d0(sc(sc({},v),{},{w,h:_,threshold:m})))i.setState(jp(r,l,i.helper.current),u);else{var k=BI(r),S=f||(v.height>_?-25:-(_/2)+v.height/2);MI.to(r,{context:h0(k)?window:k,duration:p,offset:S,callback:function(I){i.setState(jp(I,l,i.helper.current),u)}})}}),as(i,"recalculateNode",function(r){var l=document.querySelector(r.selector),u=function(p){r.action&&typeof r.action=="function"&&i.unlockFocus(function(){return r.action(p)})};i.calculateNode(l,r,function(){return u(l)})}),as(i,"maskClickHandler",function(r){var l=i.props,u=l.closeWithMask,d=l.onRequestClose;u&&!r.target.classList.contains(tn.mask.disableInteraction)&&d(r)}),as(i,"nextStep",function(){var r=i.props,l=r.steps,u=r.getCurrentStep;i.setState(function(d){var p=d.current<l.length-1?d.current+1:d.current;return typeof u=="function"&&u(p),{current:p}},i.showStep)}),as(i,"prevStep",function(){var r=i.props.getCurrentStep;i.setState(function(l){var u=l.current>0?l.current-1:l.current;return typeof r=="function"&&r(u),{current:u}},i.showStep)}),as(i,"gotoStep",function(r){var l=i.props,u=l.steps,d=l.getCurrentStep;i.setState(function(p){var m=u[r]?r:p.current;return typeof d=="function"&&d(m),{current:m}},i.showStep)}),as(i,"keyDownHandler",function(r){var l=i.props,u=l.onRequestClose,d=l.nextStep,p=l.prevStep,m=l.disableKeyboardNavigation;if(r.stopPropagation(),m!==!0){var f,v,w;m&&(f=m.includes("esc"),v=m.includes("right"),w=m.includes("left")),r.keyCode===27&&!f&&(r.preventDefault(),u()),r.keyCode===39&&!v&&(r.preventDefault(),typeof d=="function"?d():i.nextStep()),r.keyCode===37&&!w&&(r.preventDefault(),typeof p=="function"?p():i.prevStep())}}),i.state={isOpen:!1,current:0,top:0,right:0,bottom:0,left:0,width:0,height:0,w:0,h:0,inDOM:!1,observer:null,focusUnlocked:!1},i.helper=H.createRef(),i.helperElement=null,i.debouncedShowStep=sx(i.showStep,70),i}return s0(s,a),t0(s,[{key:"componentDidMount",value:function(){var r=this.props,l=r.isOpen,u=r.startAt;l&&this.open(u)}},{key:"UNSAFE_componentWillReceiveProps",value:function(r){var l=this.props,u=l.isOpen,d=l.update,p=l.updateDelay;!u&&r.isOpen?this.open(r.startAt):u&&!r.isOpen&&this.close(),u&&d!==r.update&&(r.steps[this.state.current]?setTimeout(this.showStep,p):this.props.onRequestClose()),u&&r.isOpen&&this.state.current!==r.goToStep&&this.gotoStep(r.goToStep)}},{key:"componentWillUnmount",value:function(){var r=this.props.isOpen;r&&this.close(),this.state.observer&&this.state.observer.disconnect()}},{key:"open",value:function(r){var l=this,u=this.props.onAfterOpen;this.setState(function(d){return{isOpen:!0,current:r!==void 0?r:d.current}},function(){setTimeout(l.showStep,1),l.helperElement=l.helper.current,l.props.disableFocusLock||l.helper.current.focus(),u&&u(l.helperElement)}),window.addEventListener("resize",this.debouncedShowStep,!1),window.addEventListener("keydown",this.keyDownHandler,!1)}},{key:"close",value:function(){this.setState(function(r){return r.observer&&r.observer.disconnect(),{isOpen:!1,observer:null}},this.onBeforeClose),window.removeEventListener("resize",this.debouncedShowStep),window.removeEventListener("keydown",this.keyDownHandler)}},{key:"onBeforeClose",value:function(){var r=this.props.onBeforeClose;r&&r(this.helperElement)}},{key:"render",value:function(){var r=this,l=this.props,u=l.className,d=l.steps,p=l.maskClassName,m=l.showButtons,f=l.showCloseButton,v=l.closeButtonAriaLabel,w=l.showNavigation,_=l.showNavigationNumber,k=l.showNumber,S=l.onRequestClose,C=l.maskSpace,I=l.lastStepNextButton,O=l.nextButton,A=l.prevButton,R=l.badgeContent,q=l.highlightedMaskClassName,re=l.disableInteraction,ie=l.disableDotsNavigation,$e=l.nextStep,U=l.prevStep,Me=l.rounded,Ne=l.accentColor,qe=l.CustomHelper,ce=l.disableFocusLock,de=l.highlightedBorder,J=this.state,we=J.isOpen,ge=J.current,Fe=J.inDOM,Y=J.top,et=J.right,Z=J.bottom,se=J.left,F=J.width,V=J.height,W=J.w,le=J.h,x=J.helperWidth,pe=J.helperHeight,G=J.helperPosition;return we?X.createElement(C0,null,X.createElement(l0,null),X.createElement(_0,{step:d[ge],refresh:function(){return r.recalculateNode(d[ge])}}),X.createElement(w0,{step:d[ge],refresh:function(){return r.recalculateNode(d[ge])}}),X.createElement(CC,{onClick:this.maskClickHandler,forwardRef:function(ye){return r.mask=ye},windowWidth:W,windowHeight:le,targetWidth:F,targetHeight:V,targetTop:Y,targetLeft:se,padding:C,rounded:Me,roundedStep:d[ge].roundedStep,className:p,disableInteraction:d[ge].stepInteraction===!1||re?!d[ge].stepInteraction:re,disableInteractionClassName:"".concat(tn.mask.disableInteraction," ").concat(q),highlightedBorder:de}),X.createElement(Qw,{disabled:ce,autoFocus:!1},X.createElement(m0,{ref:this.helper,targetHeight:V,targetWidth:F,targetTop:Y,targetRight:et,targetBottom:Z,targetLeft:se,windowWidth:W,windowHeight:le,helperWidth:x,helperHeight:pe,helperPosition:G,padding:C,tabIndex:-1,current:ge,style:d[ge].style?d[ge].style:{},rounded:Me,className:Hy(tn.helper.base,u,as({},tn.helper.isOpen,we)),accentColor:Ne,defaultStyles:!qe,role:"dialog"},qe?X.createElement(qe,{current:ge,totalSteps:d.length,gotoStep:this.gotoStep,close:S,content:d[ge]&&(typeof d[ge].content=="function"?d[ge].content({close:S,goTo:this.gotoStep,inDOM:Fe,step:ge+1}):d[ge].content)},this.props.children):X.createElement(X.Fragment,null,this.props.children,d[ge]&&(typeof d[ge].content=="function"?d[ge].content({close:S,goTo:this.gotoStep,inDOM:Fe,step:ge+1}):d[ge].content),k&&X.createElement(f0,{"data-tour-elem":"badge",accentColor:Ne},typeof R=="function"?R(ge+1,d.length):ge+1),(m||w)&&X.createElement($0,{"data-tour-elem":"controls"},m&&X.createElement(p_,{onClick:typeof U=="function"?U:this.prevStep,disabled:ge===0,label:A||null}),w&&X.createElement(b0,{"data-tour-elem":"navigation"},d.map(function(ke,ye){return X.createElement(v0,{key:"".concat(ke.selector?ke.selector:"undef","_").concat(ye),onClick:function(){return r.gotoStep(ye)},current:ge,index:ye,accentColor:Ne,disabled:ge===ye||ie,showNumber:_,"data-tour-elem":"dot",className:Hy(tn.dot.base,as({},tn.dot.active,ge===ye)),"aria-label":ke.navDotAriaLabel})})),m&&X.createElement(p_,{onClick:ge===d.length-1?I?S:function(){}:typeof $e=="function"?$e:this.nextStep,disabled:!I&&ge===d.length-1,inverted:!0,label:I&&ge===d.length-1?I:O||null})),f&&X.createElement(u0,{onClick:S,className:"reactour__close",ariaLabel:v}))))):null}}])})(H.Component),jp=function(s,i,r){if(r){var l=Math.max(document.documentElement.clientWidth,window.innerWidth||0),u=Math.max(document.documentElement.clientHeight,window.innerHeight||0),d=Kl(r),p=d.width,m=d.height,f={top:u+10,right:l/2+9,bottom:u/2+9,left:l/2-p/2,width:0,height:0,w:l,h:u,helperPosition:"center"};return s&&(f=wC(s,i)),function(){return sc(sc({w:l,h:u,helperWidth:p,helperHeight:m,helperPosition:i.position},f),{},{inDOM:!!s})}}};tm.propTypes=T0;tm.defaultProps=k0;const S0=""+new URL("blockly2js-B3Jxf2e-.svg",import.meta.url).href,E0=""+new URL("rules2js-DnYyR8mI.svg",import.meta.url).href,ws={selectTriggers:0,addScheduleByDoubleClick:1,openTagsMenu:2,selectIntervalTag:3,selectActions:4,addActionPrintText:5,showJavascript:6,switchBackToRules:7,saveTheScript:8},I0=[{selector:".blocks-triggers",content:"Select triggers"},{selector:".block-TriggerScheduleBlock",content:"Double click to add the block"},{selector:".tag-card",content:"Open drop down menu"},{selector:".tag-card-interval",content:"Select interval"},{selector:".blocks-actions",content:"Select action blocks"},{selector:".block-ActionPrintText",content:"Double click to add the block"},{selector:".button-js-code",content:"Check the script"},{selector:".button-js-code",content:"Switch back to rules"},{selector:".button-save",content:"Save the script"}],zp=187,Nl={root:{left:0,top:0,width:"100%",height:"100%",position:"fixed",background:"rgba(0, 0, 0, .3)",zIndex:2e4},connecting:{left:"40%",top:"40%",width:"20%",height:"20%",position:"absolute"},spinner:{animation:"admin-connecting-rotator 1.4s linear infinite"},path:{strokeDasharray:187,strokeDashoffset:0,transformOrigin:"center",animation:"admin-connecting-dash 1.4s ease-in-out infinite, $colors 5.6s ease-in-out infinite"}};function sn(){return g.jsxs("div",{style:Nl.root,children:[g.jsx("style",{children:`
263
+ ' @keyframes admin-connecting-colors {
264
+ 0% {
265
+ stroke: #4285F4;
266
+ }
267
+ 25% {
268
+ stroke: #DE3E35;
269
+ }
270
+ 50% {
271
+ stroke: #F7C223;
272
+ }
273
+ 75% {
274
+ stroke: #1B9A59;
275
+ }
276
+ 100% {
277
+ stroke: #4285F4;
278
+ }
279
+ }
280
+ @keyframes admin-connecting-dash {
281
+ 0% {
282
+ stroke-dashoffset: ${zp};
283
+ }
284
+ 50% {
285
+ stroke-dashoffset: ${zp/4};
286
+ transform: rotate(135deg);
287
+ }
288
+ 100% {
289
+ stroke-dashoffset: ${zp};
290
+ transform: 'rotate(450deg);
291
+ }
292
+ }
293
+ @keyframes admin-connecting-rotator {
294
+ 0% {
295
+ transform: rotate(0deg);
296
+ }
297
+ 100% {
298
+ transform: rotate(270deg);
299
+ }
300
+ }
301
+ `}),g.jsx("div",{style:Nl.connecting,children:g.jsx("svg",{style:Nl.spinner,width:"100%",height:"100%",viewBox:"0 0 66 66",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("circle",{style:Nl.path,fill:"none",strokeWidth:"6",strokeLinecap:"round",cx:"33",cy:"33",r:"30"})})})]})}const x0=X.lazy(()=>mn(()=>Promise.resolve().then(()=>aA),void 0,import.meta.url)),D0=X.lazy(()=>mn(()=>import("./index-BMwfsknM.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url)),A0=X.lazy(()=>mn(()=>import("./index-OIiv3PJA.js"),__vite__mapDeps([9,1,2,3,4,5,10,6,7]),import.meta.url)),R0=X.lazy(()=>mn(()=>import("./ScriptEditorVanillaMonaco-Xge2wqgO.js"),__vite__mapDeps([10,1,2,3,4,5,6,7]),import.meta.url)),O0=X.lazy(()=>mn(()=>import("./ScriptEditor-BoSBgnK-.js"),__vite__mapDeps([11,1,2,3,4,5,10,6,7,12]),import.meta.url)),M0=X.lazy(()=>mn(()=>import("./OpenAiDialog-BmcYPsVa.js"),__vite__mapDeps([13,1,2,3,4,5,7,14,10,6]),import.meta.url)),__={Blockly:bw,"Javascript/js":Xl,Rules:yw,def:Xl,"TypeScript/ts":vw},N0=48,w_="#02a102",Up="#70aae9",L0=L_[400],B0=B_[400],Se={toolbar:a=>({minHeight:38,boxShadow:"0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12)",backgroundColor:a.palette.mode==="dark"?"#1e1e1e":"#E2E2E2"}),toolbarButtons:{padding:4,marginLeft:4},toolbarButtonsDisabled:{filter:"grayscale(100%)",opacity:.5},editorDiv:a=>({height:`calc(100% - ${(parseInt(a.toolbar.height,10)||48)+38+10}px)`,width:"100%",overflow:"hidden",position:"relative"}),textButton:{marginRight:10,minHeight:24,padding:"6px 16px",height:32},saveButton:{background:"#ff9900"},tabIcon:{width:24,height:24,verticalAlign:"middle",marginBottom:2,marginRight:2,borderRadius:3},hintIcon:{padding:"0 8px 0 8px"},hintButton:{marginTop:8,marginLeft:20},tabMenuButton:{position:"absolute",top:0,right:0},tabChanged:a=>({color:a.palette.secondary.main}),tabText:{maxWidth:130,textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",display:"inline-block",verticalAlign:"middle"},tabChangedIcon:{color:"#FF0000",fontSize:16,marginLeft:5},closeButton:{marginLeft:5},notRunning:{color:"#ffbc00",marginRight:8,marginLeft:8},tabButton:{minHeight:48},tabButtonWrapper:{display:"inline-block"},menuIcon:{width:18,height:18,borderRadius:2,marginRight:5}};function P0(){return g.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 2406 2406",children:[g.jsx("path",{d:"M1 578.4C1 259.5 259.5 1 578.4 1h1249.1c319 0 577.5 258.5 577.5 577.4V2406H578.4C259.5 2406 1 2147.5 1 1828.6V578.4z",fill:"#74aa9c"}),g.jsx("path",{d:"M1107.3 299.1c-198 0-373.9 127.3-435.2 315.3C544.8 640.6 434.9 720.2 370.5 833c-99.3 171.4-76.6 386.9 56.4 533.8-41.1 123.1-27 257.7 38.6 369.2 98.7 172 297.3 260.2 491.6 219.2 86.1 97 209.8 152.3 339.6 151.8 198 0 373.9-127.3 435.3-315.3 127.5-26.3 237.2-105.9 301-218.5 99.9-171.4 77.2-386.9-55.8-533.9v-.6c41.1-123.1 27-257.8-38.6-369.8-98.7-171.4-297.3-259.6-491-218.6-86.6-96.8-210.5-151.8-340.3-151.2zm0 117.5-.6.6c79.7 0 156.3 27.5 217.6 78.4-2.5 1.2-7.4 4.3-11 6.1L952.8 709.3c-18.4 10.4-29.4 30-29.4 51.4V1248l-155.1-89.4V755.8c-.1-187.1 151.6-338.9 339-339.2zm434.2 141.9c121.6-.2 234 64.5 294.7 169.8 39.2 68.6 53.9 148.8 40.4 226.5-2.5-1.8-7.3-4.3-10.4-6.1l-360.4-208.2c-18.4-10.4-41-10.4-59.4 0L1024 984.2V805.4L1372.7 604c51.3-29.7 109.5-45.4 168.8-45.5zM650 743.5v427.9c0 21.4 11 40.4 29.4 51.4l421.7 243-155.7 90L597.2 1355c-162-93.8-217.4-300.9-123.8-462.8C513.1 823.6 575.5 771 650 743.5zm807.9 106 348.8 200.8c162.5 93.7 217.6 300.6 123.8 462.8l.6.6c-39.8 68.6-102.4 121.2-176.5 148.2v-428c0-21.4-11-41-29.4-51.4l-422.3-243.7 155-89.3zM1201.7 997l177.8 102.8v205.1l-177.8 102.8-177.8-102.8v-205.1L1201.7 997zm279.5 161.6 155.1 89.4v402.2c0 187.3-152 339.2-339 339.2v-.6c-79.1 0-156.3-27.6-217-78.4 2.5-1.2 8-4.3 11-6.1l360.4-207.5c18.4-10.4 30-30 29.4-51.4l.1-486.8zM1380 1421.9v178.8l-348.8 200.8c-162.5 93.1-369.6 38-463.4-123.7h.6c-39.8-68-54-148.8-40.5-226.5 2.5 1.8 7.4 4.3 10.4 6.1l360.4 208.2c18.4 10.4 41 10.4 59.4 0l421.9-243.7z",fill:"white"})]})}class ln extends X.Component{getSelect=null;changedMirror={};cron={initValue:null,callback:null};scriptDialog={initValue:null,callback:null,args:null,isReturn:!1};objects;scripts;selectId={initValue:null,callback:null};confirmCallback=null;constructor(s){var u,d;super(s);let i=window.localStorage.getItem("Editor.selected")||"";const r=window.localStorage.getItem("Editor.editing")||"[]";let l;try{l=JSON.parse(r)}catch{l=[]}i&&!l.includes(i)&&l.push(i),i&&!this.props.password&&((d=(u=this.props.objects[i])==null?void 0:u.native)!=null&&d.protected)&&(i=l.find(p=>{var m,f;return!((f=(m=this.props.objects[p])==null?void 0:m.native)!=null&&f.protected)})||""),!i&&l.length&&(this.props.password?i=l[0]:i=l.find(p=>{var m,f;return!((f=(m=this.props.objects[p])==null?void 0:m.native)!=null&&f.protected)})||""),this.state={askAboutDebug:!1,astroEvents:null,blockly:null,changed:{},cmdToBlockly:"",cmdToRules:"",confirm:"",debugEnabled:!1,editing:l,insert:"",instancesLoaded:!1,isTourOpen:window.localStorage.getItem("tour")!=="true",menuDebugAnchorEl:null,menuOpened:!!this.props.menuOpened,menuTabsOpened:!1,openAiDialog:!1,triggerPrettier:1,rules:null,runningInstances:this.props.runningInstances||{},searchText:"",selected:i,showAdapterDebug:!1,showAstro:!1,showCompiledCode:!1,showCron:!1,showDebugMenu:!1,showScript:!1,showSelectId:!1,themeType:this.props.themeType,toast:"",tourStep:ws.selectTriggers,verboseEnabled:!1,visible:s.visible},this.setChangedInAdmin(),window.systemLang=b.I18n.getLanguage(),window.main={objects:{},getObject:(p,m)=>this.props.socket.getObject(p).then(f=>m==null?void 0:m(null,f)).catch(f=>m==null?void 0:m(f)),instances:[],selectIdDialog:(p,m,f)=>{typeof m=="function"&&(f=m,m=null),this.selectId.callback=f,this.selectId.initValue=p,this.selectId.type=m,this.setState({showSelectId:!0})},cronDialog:(p,m)=>{this.cron.callback=m,this.cron.initValue=p,this.setState({showCron:!0})},showScriptDialog:(p,m,f,v)=>{this.scriptDialog.callback=v,this.scriptDialog.initValue=p,this.scriptDialog.args=m,this.scriptDialog.isReturn=f||!1,this.setState({showScript:!0})}},this.objects=s.objects,this.scripts={},this.getAllAdapterInstances().then(()=>{this.props.onSelectedChange&&this.state.selected&&setTimeout(()=>this.props.onSelectedChange(this.state.selected,this.state.editing),100)})}async getAllAdapterInstances(){const s=await this.props.socket.getAdapterInstances(!0),i={},r=s.map(l=>(i[l._id]=l,l._id));window.main.objects=i,window.main.instances=r,this.setState({instancesLoaded:!0})}static onInstanceChanged(s,i){if(s)if(!i&&window.main.instances.includes(s)){delete window.main.objects[s];const r=window.main.instances.indexOf(s);window.main.instances.splice(r,1)}else(i==null?void 0:i.type)==="instance"&&(window.main.instances.includes(s)||(window.main.instances.push(s),window.main.instances.sort()),window.main.objects[s]=i)}setChangedInAdmin(){const s=Object.keys(this.state.changed).find(i=>this.state.changed[i]);Object.keys(this.state.changed).forEach(i=>{this.changedMirror[i]=this.state.changed[i]}),Object.keys(this.changedMirror).forEach(i=>{this.state.changed[i]===void 0&&delete this.changedMirror[i]}),this.props.onChangedChanged(this.changedMirror),typeof window.parent<"u"&&window.parent&&(window.parent.configNotSaved=!!s)}componentDidMount(){window.addEventListener("beforeunload",this.onBrowserClose,!1),this.props.socket.subscribeObject("system.adapter.*",ln.onInstanceChanged)}componentWillUnmount(){window.removeEventListener("beforeunload",this.onBrowserClose),this.props.socket.unsubscribeObject("system.adapter.*",ln.onInstanceChanged)}onBrowserClose=s=>{const i=Object.keys(this.scripts).find(r=>JSON.stringify(this.scripts[r])!==JSON.stringify(this.getScriptFromObject(r)));if(i){console.log(`Script ${JSON.stringify(this.scripts[i])}`);const r=b.I18n.t("Configuration not saved.");return s=s||window.event,s&&(s.returnValue=r),r}};removeNonExistingScripts(s,i){s=s||this.props,i=i||{};let r=!1;if(this.state.editing&&this.state.editing.find(u=>s&&!s.objects[u])){const u=[...this.state.editing];for(let d=u.length-1;d>=0;d--)this.objects[u[d]]||(r=!0,u.splice(d,1));r&&(i.editing=u),this.state.selected&&!this.objects[this.state.selected]&&(r=!0,i.selected=u[0]||"",i.selected&&this.scripts[i.selected]&&(this.state.blockly!==(this.scripts[i.selected].engineType==="Blockly")&&(i.blockly=this.scripts[i.selected].engineType==="Blockly",r=!0),this.state.rules!==(this.scripts[i.selected].engineType==="Rules")&&(i.rules=this.scripts[i.selected].engineType==="Rules",r=!0),this.state.verboseEnabled!==this.scripts[i.selected].verbose&&(i.verboseEnabled=this.scripts[i.selected].verbose,r=!0),this.state.debugEnabled!==this.scripts[i.selected].debug&&(i.debugEnabled=this.scripts[i.selected].debug,r=!0)))}return r}UNSAFE_componentWillReceiveProps(s){var l,u,d;const i={};let r=!1;if(JSON.stringify(s.runningInstances)!==JSON.stringify(this.state.runningInstances)&&(r=!0,i.runningInstances=s.runningInstances),this.state.menuOpened!==s.menuOpened&&(i.menuOpened=s.menuOpened,r=!0),this.state.themeType!==s.themeType&&(i.themeType=s.themeType,r=!0),this.removeNonExistingScripts(s,i)&&(r=!0),this.state.searchText!==s.searchText&&(i.searchText=s.searchText,r=!0),this.objects!==s.objects){this.objects=s.objects,window.main.objects=s.objects,Object.keys(this.scripts).forEach(m=>{const f=this.scripts[m].source;this.scripts[m]=JSON.parse(JSON.stringify(this.objects[m].common)),this.scripts[m].source=f}),this.state.selected&&this.objects[this.state.selected]&&(this.scripts[this.state.selected]||=JSON.parse(JSON.stringify(this.objects[this.state.selected].common)),this.state.blockly!==(this.scripts[this.state.selected].engineType==="Blockly")&&(i.blockly=this.scripts[this.state.selected].engineType==="Blockly",r=!0),this.state.rules!==(this.scripts[this.state.selected].engineType==="Rules")&&(i.rules=this.scripts[this.state.selected].engineType==="Rules",r=!0),this.state.verboseEnabled!==this.scripts[this.state.selected].verbose&&(i.verboseEnabled=this.scripts[this.state.selected].verbose,r=!0),this.state.debugEnabled!==this.scripts[this.state.selected].debug&&(i.debugEnabled=this.scripts[this.state.selected].debug,r=!0));const p=[...this.state.editing];for(let m=p.length-1;m>=0;m--)this.objects[p[m]]||(r=!0,p.splice(m,1),this.state.changed[p[m]]!==void 0&&(i.changed||={...this.state.changed},i.changed&&delete i.changed[p[m]]));this.state.selected&&!this.objects[this.state.selected]&&(i.selected=p[0]||""),r&&(i.editing=p)}else for(const p in this.scripts)if(Object.prototype.hasOwnProperty.call(this.scripts,p)){if((l=this.objects[p])!=null&&l.common){if(this.objects[p].type==="script"){const m=this.scripts[p].source,f=JSON.parse(JSON.stringify(this.scripts[p]));f.source=this.objects[p].common.source,JSON.stringify(f)!==JSON.stringify(this.objects[p].common)&&(this.scripts[p]=JSON.parse(JSON.stringify(this.objects[p].common)),this.scripts[p].source=m),m!==this.objects[p].common.source?this.state.changed[p]?(d=this.objects[p].from)!=null&&d.startsWith("system.adapter.javascript.")&&(this.objects[p].from="system.adapter.admin.0",this.setState({toast:b.I18n.t("Script %s was modified on disk.",p.split(".").pop())})):this.props.password&&((u=this.objects[p].native)!=null&&u.protected)?this.scripts[p].source=cg(this.props.password,this.objects[p].common.source):this.scripts[p].source=this.objects[p].common.source:this.state.changed[p]&&(i.changed||={...this.state.changed},i.changed&&(i.changed[p]=!1),r=!0)}}else if(this.scripts[p]&&(delete this.scripts[p],this.state.selected===p)){if(this.state.editing.indexOf(p)!==-1){const m=[...this.state.editing],f=m.indexOf(p);f!==-1&&(m.splice(f,1),i.editing=m,r=!0)}i.selected=this.state.editing[0]||"",r=!0}}if(s.selected&&this.state.selected!==s.selected){const p=this.getScriptFromObject(s.selected);this.scripts[s.selected]||=p;const m=p&&JSON.stringify(this.scripts[s.selected])!==JSON.stringify(p),f=[...this.state.editing];s.selected&&!f.includes(s.selected)&&(f.push(s.selected),this.props.onSelectedChange(s.selected,f),window.localStorage.setItem("Editor.editing",JSON.stringify(f))),r=!0,i.changed||={...this.state.changed},i.changed[s.selected]=!!m,i.editing=f,i.selected=s.selected,i.blockly=this.scripts[s.selected].engineType==="Blockly",i.rules=this.scripts[s.selected].engineType==="Rules",i.verboseEnabled=this.scripts[s.selected].verbose,i.debugEnabled=this.scripts[s.selected].debug,i.showCompiledCode=!1}this.state.visible!==s.visible&&(r=!0,i.visible=s.visible),r&&this.setState(i,()=>this.setChangedInAdmin())}onRestart(){var s,i;(i=(s=this.props).onRestart)==null||i.call(s,this.state.selected)}onStartStop(){var i,r,l;const s=JSON.parse(JSON.stringify(this.scripts[this.state.selected]));s.enabled=!s.enabled,this.props.password&&((i=this.props.objects[this.state.selected].native)!=null&&i.protected)&&(s.source=Vl(this.props.password,s.source)),(l=(r=this.props).onChange)==null||l.call(r,this.state.selected,s)}onSave(){if(this.state.isTourOpen&&this.state.tourStep===ws.saveTheScript&&(this.setState({isTourOpen:!1}),window.localStorage.setItem("tour","true")),this.state.changed[this.state.selected]){const s={...this.state.changed};s[this.state.selected]=!1,this.setState({changed:s},()=>{var r,l,u;this.setChangedInAdmin();const i=JSON.parse(JSON.stringify(this.scripts[this.state.selected]));this.props.password&&((r=this.props.objects[this.state.selected].native)!=null&&r.protected)&&(i.source=Vl(this.props.password,i.source)),(u=(l=this.props).onChange)==null||u.call(l,this.state.selected,i)})}}onSaveAll(){const s={...this.state.changed};Object.keys(s).forEach(i=>{var r,l,u;if(s[i]){s[i]=!1;const d=JSON.parse(JSON.stringify(this.scripts[i]));this.props.password&&((r=this.props.objects[i].native)!=null&&r.protected)&&(d.source=Vl(this.props.password,d.source)),(u=(l=this.props).onChange)==null||u.call(l,i,d)}}),this.setState({changed:s},()=>this.setChangedInAdmin())}onCancel(){this.scripts[this.state.selected]=this.getScriptFromObject(this.state.selected);const s={...this.state.changed};s[this.state.selected]=!1,this.setState({changed:s},()=>this.setChangedInAdmin())}onRegisterSelect(s){this.getSelect=s}onConvertBlockly2JS(){this.showConfirmDialog(b.I18n.t("It will not be possible to revert this operation."),s=>{if(s){this.scripts[this.state.selected].engineType="Javascript/js";const r=this.scripts[this.state.selected].source.split(`
302
+ `);r.pop(),this.scripts[this.state.selected].source=r.join(`
303
+ `);const l=this.state.selected,u={...this.state.changed};u[this.state.selected]=!0,this.setState({changed:u,blockly:!1,selected:""},()=>{this.setChangedInAdmin(),setTimeout(()=>this.setState({selected:l}),100)})}})}onChange(s){if(s.script!==void 0){if(s.script===this.scripts[this.state.selected].source)return;this.scripts[this.state.selected].source=s.script}s.debug!==void 0&&(this.scripts[this.state.selected].debug=s.debug),s.verbose!==void 0&&(this.scripts[this.state.selected].verbose=s.verbose);const i=JSON.stringify(this.scripts[this.state.selected])!==JSON.stringify(this.getScriptFromObject(this.state.selected));if(i!==!!this.state.changed[this.state.selected]){const r={...this.state.changed};r[this.state.selected]=i,this.objects[this.state.selected].from="system.adapter.admin.0",this.setState({changed:r},()=>this.setChangedInAdmin())}}onTabChange(s){var r,l;if(this.props.debugMode)return;window.localStorage.setItem("Editor.selected",s);const i=this.scripts[s]||this.getScriptFromObject(s);this.setState({selected:s,rules:i.engineType==="Rules",blockly:i.engineType==="Blockly",showCompiledCode:!1,verboseEnabled:i.verbose,debugEnabled:i.debug}),(l=(r=this.props).onSelectedChange)==null||l.call(r,s,this.state.editing)}isScriptChanged(s){return!!(this.scripts[s]&&this.props.objects[s]&&JSON.stringify(this.scripts[s])!==JSON.stringify(this.getScriptFromObject(s)))}onTabClose(s,i){i==null||i.stopPropagation();const r=this.state.editing.indexOf(s);if(this.state.editing.includes(s))if(this.isScriptChanged(s))this.showConfirmDialog(b.I18n.t("Discard changes for %s",this.props.objects[s].common.name),l=>{l&&(delete this.scripts[s],this.onTabClose(s))});else{const l=[...this.state.editing];l.splice(r,1);const u={editing:l};if(s===this.state.selected?l.length?r===0||l.length===1?u.selected=l[0]:u.selected=l[r-1]:u.selected="":this.state.selected&&!l.length&&(u.selected=""),window.localStorage.setItem("Editor.editing",JSON.stringify(l)),u.selected!==void 0){u.changed||={...this.state.changed},u.changed[u.selected]=this.isScriptChanged(u.selected);const d=u.selected?this.scripts[u.selected]||this.getScriptFromObject(u.selected):void 0;u.blockly=(d==null?void 0:d.engineType)==="Blockly",u.rules=(d==null?void 0:d.engineType)==="Rules",u.verboseEnabled=!!(d!=null&&d.verbose),u.debugEnabled=!!(d!=null&&d.debug),u.showCompiledCode=!1}this.setState(u,()=>{var d,p,m,f;this.setChangedInAdmin(),u.selected!==void 0?((p=(d=this.props).onSelectedChange)==null||p.call(d,u.selected,this.state.editing),window.localStorage.setItem("Editor.selected",u.selected)):(f=(m=this.props).onSelectedChange)==null||f.call(m,this.state.selected,this.state.editing)})}}showConfirmDialog(s,i){this.confirmCallback=i,this.setState({confirm:s})}sendCommandToBlockly(s){this.setState({cmdToBlockly:s},()=>setTimeout(()=>this.setState({cmdToBlockly:""}),200))}sendCommandToRules(s){this.setState({cmdToRules:s},()=>setTimeout(()=>this.setState({cmdToRules:""}),200))}static getText(s){return typeof s=="object"?s[b.I18n.getLanguage()]||s.en:s}getScriptFullName(s){var u;const i=s.split(".");i.shift(),i.shift();const r=[];let l="script.js";for(let d=0;d<i.length;d++)l+=`.${i[d]}`,(u=this.props.objects[l])!=null&&u.common?r.push(ln.getText(this.props.objects[l].common.name)):r.push(i[d]);return`/ ${r.join(" / ")}`}getTabs(){return this.state.editing.length?[g.jsxs(y.Tabs,{component:"div",value:this.props.debugInstance?this.props.debugInstance.adapter:this.state.selected,onChange:(s,i)=>this.onTabChange(i),indicatorColor:"primary",style:{position:"relative",marginLeft:10,width:this.state.editing.length>1?"calc(100% - 50px)":"100%",display:"inline-block"},textColor:"primary",variant:"scrollable",scrollButtons:"auto",allowScrollButtonsMobile:!0,children:[this.state.editing.map(s=>{var p,m;if(!this.props.objects[s]){const f=[g.jsx(y.Box,{sx:this.isScriptChanged(s)?Se.tabChanged:void 0,style:Se.tabText,children:s.split(".").pop()},"text"),g.jsx(y.IconButton,{onClick:v=>this.onTabClose(s,v),style:Se.closeButton,size:"small",component:"span",children:g.jsx(xl,{})},"icon")];return g.jsx(y.Tab,{wrapped:!0,href:`#${s}`,label:f,value:s,sx:{"& .MuiTab-wrapper":Se.tabButtonWrapper}},s)}if(!this.props.password&&((p=this.props.objects[s].native)!=null&&p.protected))return null;let i=ln.getText(this.props.objects[s].common.name)||"";const r=this.getScriptFullName(s);i.length>18&&(i=`${i.substring(0,15)}...`);const l=(m=this.getScriptFromObject(s))==null?void 0:m.source,u=this.scripts[s]&&l!==this.scripts[s].source,d=[g.jsx(y.Box,{sx:this.isScriptChanged(s)?Se.tabChanged:void 0,style:Se.tabText,children:i},"text"),u?g.jsx("span",{style:Se.tabChangedIcon,children:"▣"},"changedSign"):null,!this.props.debugInstance&&(!this.props.debugMode||this.state.selected!==s)&&g.jsx(y.IconButton,{onClick:f=>this.onTabClose(s,f),style:Se.closeButton,size:"small",component:"span",children:g.jsx(xl,{})},"icon")];return g.jsx(y.Tab,{disabled:!!this.props.debugInstance||this.state.selected!==s&&this.props.debugMode,wrapped:!0,iconPosition:"start",icon:g.jsx("img",{alt:"",src:__[this.props.objects[s].common.engineType]||__.def,style:Se.tabIcon},"icon"),href:`#${s}`,label:d,style:Se.tabButton,value:s,title:r,sx:{"& .MuiTab-wrapper":Se.tabButtonWrapper}},s)}),this.props.debugInstance?g.jsx(y.Tab,{disabled:!1,wrapped:!0,href:`#${this.props.debugInstance.adapter}`,label:this.props.debugInstance.adapter,style:Se.tabButton,value:this.props.debugInstance.adapter,title:this.props.debugInstance.adapter,sx:{"& .MuiTab-wrapper":Se.tabButtonWrapper}},this.props.debugInstance.adapter):""]},"tabs1"),this.state.editing.length>1?g.jsx(y.IconButton,{href:"#","aria-label":"Close all but current",style:Se.tabMenuButton,title:b.I18n.t("Close all but current"),"aria-haspopup":"false",onClick:s=>{const i=[this.state.selected];Object.keys(this.scripts).forEach(r=>r!==this.state.selected&&JSON.stringify(this.scripts[r])!==JSON.stringify(this.getScriptFromObject(r))&&i.push(r)),window.localStorage.setItem("Editor.editing",JSON.stringify(i)),this.setState({menuTabsOpened:!1,editing:i})},size:"medium",children:g.jsx(QT,{})},"menuButton"):null]:g.jsx(y.Box,{sx:Se.toolbar,children:g.jsxs(y.Button,{color:"grey",disabled:!0,style:Se.hintButton,href:"",children:[g.jsx("span",{children:b.I18n.t("Click on this icon")},"select2"),g.jsx(ek,{style:Se.hintIcon},"select3"),g.jsx("span",{children:b.I18n.t("for edit or create script")},"select4")]},"select1")},"tabs2")}getDebugMenu(){return this.state.showDebugMenu?g.jsxs(y.Menu,{id:"menu-debug",anchorEl:this.state.menuDebugAnchorEl,open:this.state.showDebugMenu,onClose:()=>this.setState({showDebugMenu:!1,menuDebugAnchorEl:null}),slotProps:{root:{style:{maxHeight:N0*7.5}}},children:[g.jsxs(y.MenuItem,{title:b.I18n.t("debug_help"),onClick:s=>{s.stopPropagation(),s.preventDefault(),this.setState({showDebugMenu:!1,menuDebugAnchorEl:null,debugEnabled:!this.state.debugEnabled},()=>this.onChange({debug:this.state.debugEnabled}))},children:[g.jsx(y.Checkbox,{checked:this.state.debugEnabled}),g.jsx(Dl,{style:{...Se.menuIcon,color:w_}}),b.I18n.t("debug_label")]},"debugEnabled"),g.jsxs(y.MenuItem,{title:b.I18n.t("verbose_help"),onClick:s=>{s.stopPropagation(),s.preventDefault(),this.setState({showDebugMenu:!1,menuDebugAnchorEl:null,verboseEnabled:!this.state.verboseEnabled},()=>this.onChange({verbose:this.state.verboseEnabled}))},children:[g.jsx(y.Checkbox,{checked:this.state.verboseEnabled}),g.jsx($y,{style:{...Se.menuIcon,color:Up}}),b.I18n.t("verbose_label")]},"verboseEnabled")]},"menuDebug"):null}getDebugBadge(){return[this.state.debugEnabled&&this.state.verboseEnabled?g.jsx(Dl,{style:{...Se.menuIcon,color:Up}},"DebugVerbose"):null,this.state.debugEnabled&&!this.state.verboseEnabled?g.jsx(Dl,{style:{...Se.menuIcon,color:w_}},"DebugNoVerbose"):null,!this.state.debugEnabled&&this.state.verboseEnabled?g.jsx($y,{style:{...Se.menuIcon,color:Up}},"noDebugVerbose"):null]}getAskAboutDebug(){return this.state.askAboutDebug?g.jsx(b.DialogConfirm,{onClose:()=>{this.setState({askAboutDebug:!1},()=>this.props.onDebugModeChange(!0))},ok:b.I18n.t("Yes"),cancel:b.I18n.t("Cancel"),text:b.I18n.t("The script will be stopped and must be activated manually after debugging. Continue?")}):null}renderOpenAiDialog(){return this.state.openAiDialog?g.jsx(H.Suspense,{fallback:g.jsx(sn,{}),children:g.jsx(M0,{adapterName:this.props.adapterName,socket:this.props.socket,runningInstances:this.state.runningInstances,themeType:this.state.themeType,onClose:()=>this.setState({openAiDialog:!1}),language:this.scripts[this.state.selected].engineType==="TypeScript/ts"?"typescript":"javascript",onAddCode:s=>this.setState({insert:s})})}):null}getToolbar(){var r,l;const s=!!(this.state.selected&&((r=this.scripts[this.state.selected])!=null&&r.engine)&&this.state.runningInstances[this.scripts[this.state.selected].engine]),i=!!(this.state.selected&&((l=this.scripts[this.state.selected])!=null&&l.enabled));if(this.state.selected){const u=Object.keys(this.state.changed).filter(p=>this.state.changed[p]).length,d=this.state.changed[this.state.selected];return g.jsxs(y.Toolbar,{variant:"dense",sx:Se.toolbar,children:[!this.props.debugInstance&&this.state.menuOpened&&this.props.onLocate&&g.jsx(y.IconButton,{style:Se.toolbarButtons,title:b.I18n.t("Locate file"),onClick:()=>this.props.onLocate(this.state.selected),size:"medium",children:g.jsx(tk,{})},"locate"),!this.props.debugInstance&&!d&&s?g.jsx(y.IconButton,{disabled:this.props.debugMode,style:Se.toolbarButtons,onClick:()=>this.onRestart(),title:b.I18n.t("Restart"),size:"medium",children:g.jsx(sk,{})},"restart"):null,!this.props.debugInstance&&!d?g.jsx(y.IconButton,{disabled:this.props.debugMode,onClick:()=>this.onStartStop(),title:i?b.I18n.t("Pause script"):b.I18n.t("Run script"),size:"medium",style:{...Se.toolbarButtons,color:i?L0:B0},children:i?g.jsx(ok,{}):g.jsx(ik,{})},"start-stop"):null,!this.props.debugInstance&&!d&&!i?g.jsx("span",{style:Se.notRunning,children:b.I18n.t("Script is not running")}):null,!d&&i&&!s?g.jsx("span",{style:Se.notRunning,children:b.I18n.t("Instance is disabled")}):null,d?g.jsx(y.Button,{color:"grey",variant:"contained",style:{...Se.textButton,...Se.saveButton},className:"button-save",onClick:()=>this.onSave(),endIcon:g.jsx(by,{}),children:b.I18n.t("Save")},"save"):null,u>1||u===1&&!d?g.jsx(y.Button,{color:"grey",variant:"contained",style:Se.textButton,onClick:()=>this.onSaveAll(),endIcon:g.jsx(by,{}),children:b.I18n.t("Save all")},"saveall"):null,d?g.jsx(y.Button,{color:"grey",variant:"contained",style:Se.textButton,onClick:()=>this.onCancel(),endIcon:g.jsx(vc,{}),children:b.I18n.t("Cancel")},"cancel"):null,g.jsx("div",{style:{flex:2}}),!this.props.debugInstance&&!this.state.showCompiledCode&&g.jsx(y.IconButton,{style:Se.toolbarButtons,title:b.I18n.t("Prettify the script"),onClick:()=>this.setState({triggerPrettier:this.state.triggerPrettier+1}),size:"medium",children:g.jsx(nk,{})},"prettier"),this.state.blockly&&!this.state.showCompiledCode?g.jsx(y.IconButton,{"aria-label":"Export Blocks",title:b.I18n.t("Export blocks"),style:Se.toolbarButtons,onClick:()=>this.sendCommandToBlockly("export"),size:"medium",children:g.jsx(Yl,{})},"export"):null,this.state.blockly&&!this.state.showCompiledCode&&g.jsx(y.IconButton,{"aria-label":"Import Blocks",title:b.I18n.t("Import blocks"),style:Se.toolbarButtons,onClick:()=>this.sendCommandToBlockly("import"),size:"medium",children:g.jsx(Qp,{})},"import"),this.state.blockly&&!this.state.showCompiledCode&&g.jsx(y.IconButton,{"aria-label":"Check code",title:b.I18n.t("Check blocks"),style:Se.toolbarButtons,onClick:()=>this.sendCommandToBlockly("check"),size:"medium",children:g.jsx(rk,{})},"check"),!this.props.debugMode&&!this.state.blockly&&!this.state.rules&&!this.state.showCompiledCode?g.jsx(y.IconButton,{"aria-label":"create CRON",title:b.I18n.t("Create or edit CRON or time wizard"),style:Se.toolbarButtons,onClick:()=>this.setState({showCron:!0}),size:"medium",children:g.jsx(ak,{})},"select-cron"):null,this.scripts[this.state.selected]&&this.scripts[this.state.selected].engineType!=="Blockly"&&this.scripts[this.state.selected].engineType!=="Rules"?g.jsx(y.IconButton,{"aria-label":"AI",title:b.I18n.t("AI code generator"),style:Se.toolbarButtons,size:"medium",onClick:()=>this.setState({openAiDialog:!0}),children:g.jsx(P0,{})},"ai"):null,g.jsx(y.IconButton,{"aria-label":"Show astronomical events",title:b.I18n.t("Show astronomical events"),style:Se.toolbarButtons,disabled:!s,onClick:()=>{this.setState({showAstro:!0,astroEvents:null}),this.props.socket.sendTo(this.scripts[this.state.selected].engine.replace("system.adapter.",""),"calcAstroAll",{}).then(p=>this.setState({astroEvents:p}))},size:"medium",children:g.jsx(lk,{})},"show-astro"),!this.props.debugMode&&!this.state.blockly&&!this.state.rules&&!this.state.showCompiledCode&&g.jsx(y.IconButton,{"aria-label":"select ID",title:b.I18n.t("Insert object ID"),style:Se.toolbarButtons,onClick:()=>this.setState({showSelectId:!0}),size:"medium",children:g.jsx(ck,{})},"select-id"),this.state.blockly&&!this.state.rules&&this.state.showCompiledCode&&g.jsx(y.Button,{color:"grey","aria-label":"convert to javascript",title:b.I18n.t("Convert blockly to javascript for ever."),onClick:()=>this.onConvertBlockly2JS(),children:"Blockly=>JS"},"convert2js"),this.state.rules&&!this.state.showCompiledCode&&g.jsx(y.IconButton,{"aria-label":"Export Blocks",title:b.I18n.t("Export blocks"),style:Se.toolbarButtons,onClick:()=>this.sendCommandToRules("export"),size:"medium",children:g.jsx(Yl,{})},"export"),this.state.rules&&!this.state.showCompiledCode&&g.jsx(y.IconButton,{"aria-label":"Import Blocks",title:b.I18n.t("Import blocks"),style:Se.toolbarButtons,onClick:()=>this.sendCommandToRules("import"),size:"medium",children:g.jsx(Qp,{})},"import"),this.props.expertMode&&!d&&(this.props.debugMode||!this.state.blockly&&!this.state.rules||(this.state.blockly||this.state.rules)&&this.state.showCompiledCode)&&g.jsx(y.IconButton,{style:Se.toolbarButtons,color:this.props.debugMode?"primary":"default",disabled:!this.props.debugMode&&!s,onClick:()=>{!this.props.debugMode&&i?this.setState({askAboutDebug:!0}):this.props.onDebugModeChange(!this.props.debugMode)},size:"medium",children:g.jsx(Dl,{style:{fontSize:32}})}),(this.state.blockly||this.state.rules)&&g.jsx(y.Button,{"aria-label":"blockly",title:b.I18n.t("Show javascript code"),className:"button-js-code",color:this.state.showCompiledCode?"secondary":"inherit",disabled:this.props.debugMode,style:{...Se.toolbarButtons,...this.props.debugMode?Se.toolbarButtonsDisabled:void 0,padding:"0 5px"},onClick:()=>{this.props.debugMode||(this.setState({showCompiledCode:!this.state.showCompiledCode}),this.state.isTourOpen&&this.state.tourStep===ws.showJavascript&&this.setState({tourStep:ws.switchBackToRules}),this.state.isTourOpen&&this.state.tourStep===ws.switchBackToRules&&this.setState({tourStep:ws.saveTheScript}))},children:g.jsx("img",{alt:this.state.blockly?"blockly2js":"rules2js",src:this.state.blockly?S0:E0})},"blockly-code"),g.jsx(y.IconButton,{disabled:this.props.debugMode,"aria-label":"Debug menu",title:b.I18n.t("Debug options"),style:Se.toolbarButtons,onClick:p=>this.setState({showDebugMenu:!0,menuDebugAnchorEl:p.currentTarget}),size:"medium",children:g.jsx(y.Badge,{style:Se.badgeMargin,badgeContent:this.getDebugBadge(),children:g.jsx(uk,{})})},"debug")]},"toolbar1")}return null}getScriptEditor(){return!this.props.debugMode&&this.state.selected&&this.props.objects[this.state.selected]&&this.state.blockly!==null&&(!this.state.blockly||this.state.showCompiledCode)&&(!this.state.rules||this.state.showCompiledCode)?(this.scripts[this.state.selected]||=this.getScriptFromObject(this.state.selected),g.jsx(y.Box,{sx:Se.editorDiv,children:g.jsx(H.Suspense,{fallback:g.jsx(sn,{}),children:g.jsx(R0,{name:this.state.selected,adapterName:this.props.adapterName,insert:this.state.insert,onInserted:()=>this.setState({insert:""}),onForceSave:()=>this.onSave(),searchText:this.state.searchText,onRegisterSelect:s=>this.onRegisterSelect(s),readOnly:this.state.showCompiledCode,changed:this.state.changed[this.state.selected],code:this.scripts[this.state.selected].source||"",isDark:this.state.themeType==="dark",socket:this.props.socket,runningInstances:this.state.runningInstances,triggerPrettier:this.state.triggerPrettier,onChange:s=>this.onChange({script:s}),language:this.scripts[this.state.selected].engineType==="TypeScript/ts"?"typescript":"javascript"},"scriptEditor1")})},"scriptEditorDiv")):null}getBlocklyEditor(){return!this.props.debugMode&&this.state.instancesLoaded&&this.state.selected&&this.props.objects[this.state.selected]&&this.state.blockly&&!this.state.showCompiledCode&&this.state.visible?(this.scripts[this.state.selected]||=this.getScriptFromObject(this.state.selected),g.jsx(y.Box,{sx:Se.editorDiv,children:g.jsx(H.Suspense,{fallback:g.jsx(sn,{}),children:g.jsx(x0,{command:this.state.cmdToBlockly,themeType:this.state.themeType,searchText:this.state.searchText,code:this.scripts[this.state.selected].source||"",scriptId:this.state.selected,onChange:s=>this.onChange({script:s})},"BlocklyEditor")})},"blocklyEditorDiv")):null}getRulesEditor(){var s,i;if(!this.props.debugMode&&this.state.instancesLoaded&&this.state.selected&&this.props.objects[this.state.selected]&&this.state.rules&&!this.state.showCompiledCode&&this.state.visible){this.scripts[this.state.selected]||=this.getScriptFromObject(this.state.selected);const r=!!this.state.selected&&!!((s=this.scripts[this.state.selected])!=null&&s.engine)&&this.state.runningInstances[this.scripts[this.state.selected].engine],l=!!this.state.selected&&((i=this.scripts[this.state.selected])==null?void 0:i.enabled);return g.jsx(y.Box,{sx:Se.editorDiv,children:g.jsx(H.Suspense,{fallback:g.jsx(sn,{}),children:g.jsx(D0,{scriptId:this.state.selected,setTourStep:this.setTourStep,tourStep:this.state.tourStep,isTourOpen:this.state.isTourOpen,changed:this.state.changed[this.state.selected],running:r&&l,command:this.state.cmdToRules,themeType:this.state.themeType,themeName:this.props.themeName,theme:this.props.theme,searchText:this.state.searchText,resizing:this.props.resizing,code:this.scripts[this.state.selected].source||"",onChange:u=>this.onChange({script:u})},"flowEditor")})},"flowEditorDiv")}return null}getConfirmDialog(){return this.state.confirm?g.jsx(b.DialogConfirm,{text:this.state.confirm,onClose:s=>{if(this.confirmCallback){const i=this.confirmCallback;this.confirmCallback=null,i(s)}this.setState({confirm:""})}},"dialogConfirm1"):null}getSelectIdDialog(){var s;if(this.state.showSelectId){const i=["state","channel","device","adapter","instance","enum","host","config","script","user","group"],r=["adapter","instance","enum","host","config","script","user","group"];let l=this.selectId.callback?this.selectId.initValue||"":this.getSelect&&this.getSelect()||"",u=l.indexOf("/*");u!==-1&&(l=l.substring(0,u)),u=l.indexOf("//"),u!==-1&&(l=l.substring(0,u));let d=l.match(/"([^"]+)"/);return d&&(l=d[1]),d=l.match(/'([^']+)'/),d&&(l=d[1]),g.jsx(b.DialogSelectID,{theme:this.props.theme,imagePrefix:"../..",themeName:this.props.themeName,themeType:this.state.themeType,socket:this.props.socket,selected:l,expertMode:this.selectId.type&&this.selectId.type!=="all"&&r.includes(this.selectId.type)?!0:void 0,types:((s=this.selectId)==null?void 0:s.type)==="all"?i:[this.selectId.type||"state"],onClose:()=>{this.setState({showSelectId:!1}),this.selectId.callback&&(this.selectId.callback=null)},onOk:(p,m)=>{this.selectId.initValue=null,this.selectId.callback?(this.selectId.callback(p),this.selectId.callback=null):this.setState({insert:`'${p}'/*${m}*/`})}},"dialogSelectID1")}return null}getCronDialog(){return this.state.showCron?g.jsx(b.DialogCron,{theme:this.props.theme,cron:this.cron.callback?this.cron.initValue||"":this.getSelect?this.getSelect():"* * * * *",onClose:()=>this.setState({showCron:!1}),onOk:s=>{this.cron.initValue=null,this.cron.callback?(this.cron.callback(s),this.cron.callback=null):this.setState({insert:`'${s}'`})}},"dialogCron1"):null}getAstroDialog(){return this.state.showAstro?g.jsxs(y.Dialog,{open:!0,onClose:()=>this.setState({showAstro:!1}),children:[g.jsx(y.DialogTitle,{children:b.I18n.t("Astronomical events today")}),g.jsx(y.DialogContent,{children:this.state.astroEvents?g.jsx(y.TableContainer,{component:y.Paper,children:g.jsxs(y.Table,{size:"small",children:[g.jsx(y.TableHead,{children:g.jsxs(y.TableRow,{children:[g.jsx(y.TableCell,{children:b.I18n.t("Name")}),g.jsx(y.TableCell,{children:b.I18n.t("Server time")}),g.jsx(y.TableCell,{children:b.I18n.t("Description")})]})}),g.jsx(y.TableBody,{children:Object.keys(this.state.astroEvents).map(s=>{var i,r,l,u;return g.jsxs(y.TableRow,{children:[g.jsx(y.TableCell,{component:"th",scope:"row",children:s.startsWith("next")?"":s}),g.jsx(y.Tooltip,{title:`${b.I18n.t("Local time")}: ${(i=this.state.astroEvents)!=null&&i[s].isValidDate?new Date((r=this.state.astroEvents)==null?void 0:r[s].date).toLocaleTimeString():"n/a"}`,children:g.jsx(y.TableCell,{align:"right",children:(l=this.state.astroEvents)!=null&&l[s].isValidDate?(u=this.state.astroEvents)==null?void 0:u[s].serverTime:"n/a"})}),g.jsx(y.TableCell,{children:b.I18n.t(s)})]},s)})})]})}):g.jsx(y.LinearProgress,{})}),g.jsx(y.DialogActions,{children:g.jsx(y.Button,{variant:"contained",onClick:()=>this.setState({showAstro:!1}),color:"primary",startIcon:g.jsx(xl,{}),children:b.I18n.t("Close")})})]},"dialogAstro"):null}getEditorDialog(){return this.state.showScript?g.jsx(H.Suspense,{fallback:g.jsx(sn,{}),children:g.jsx(O0,{adapterName:this.props.adapterName,source:this.scriptDialog.initValue||"",args:this.scriptDialog.args?this.scriptDialog.args.join(", "):"",isReturn:this.scriptDialog.isReturn,socket:this.props.socket,runningInstances:this.state.runningInstances,themeType:this.state.themeType,onClose:s=>{this.scriptDialog.initValue=null,this.scriptDialog.callback&&(s!==!1&&this.scriptDialog.callback(s||""),this.scriptDialog.callback=null),this.setState({showScript:!1})}},"scriptEditorDialog")}):null}getToast(){return g.jsx(y.Snackbar,{anchorOrigin:{vertical:"bottom",horizontal:"left"},open:!!this.state.toast,autoHideDuration:6e3,onClose:()=>this.setState({toast:""}),slotProps:{content:{"aria-describedby":"message-id"}},message:g.jsx("span",{id:"message-id",children:this.state.toast}),action:[g.jsx(y.IconButton,{"aria-label":"close",color:"inherit",style:Se.closeToast,onClick:()=>this.setState({toast:""}),size:"medium",children:g.jsx(xl,{})},"close")]},"toast")}setTourStep=s=>this.setState({tourStep:s});getTour(){return this.state.instancesLoaded&&this.state.selected&&this.props.isAnyRulesExists===1&&this.props.objects[this.state.selected]&&this.state.rules&&this.state.visible?g.jsx(tm,{steps:I0,isOpen:this.state.isTourOpen,onRequestClose:()=>{this.setState({isTourOpen:!1}),window.localStorage.setItem("tour","true"),this.props.socket.setState("javascript.0.variables.rulesTour",{val:!0,ack:!0})},goToStep:this.state.tourStep},"tour"):null}getDebug(){return this.props.debugMode?this.state.selected&&this.scripts[this.state.selected]&&this.scripts[this.state.selected].engine&&this.state.runningInstances[this.scripts[this.state.selected].engine]?g.jsx(H.Suspense,{fallback:g.jsx(sn,{}),children:g.jsx(A0,{runningInstances:this.state.runningInstances,adapterName:this.props.adapterName,socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.themeType,src:this.props.debugInstance?this.props.debugInstance.adapter:this.state.selected,debugInstance:this.props.debugInstance},"debugger")}):(setTimeout(()=>this.props.onDebugModeChange(!1)),null):null}getScriptFromObject(s){var r,l;if(!((r=this.props.objects[s])!=null&&r.common))return;const i=JSON.parse(JSON.stringify(this.props.objects[s].common));return(l=this.props.objects[s].native)!=null&&l.protected&&this.props.password&&(i.source=cg(this.props.password,i.source)),i}render(){var s,i;return this.state.selected&&this.props.objects[this.state.selected]&&this.state.blockly===null&&this.state.rules===null&&(this.scripts[this.state.selected]||=this.getScriptFromObject(this.state.selected),setTimeout(()=>{const r={blockly:this.scripts[this.state.selected].engineType==="Blockly",rules:this.scripts[this.state.selected].engineType==="Rules",showCompiledCode:!1,debugEnabled:this.scripts[this.state.selected].debug,verboseEnabled:this.scripts[this.state.selected].verbose};this.removeNonExistingScripts(null,r),this.setState(r)},100)),this.state.selected&&!this.props.password&&((i=(s=this.props.objects[this.state.selected])==null?void 0:s.native)!=null&&i.protected)&&setTimeout(()=>{const r=this.state.editing.find(l=>{var u,d;return!((d=(u=this.props.objects[l])==null?void 0:u.native)!=null&&d.protected)})||"";Object.keys(this.scripts).forEach(l=>{var u,d;(d=(u=this.props.objects[l])==null?void 0:u.native)!=null&&d.protected&&delete this.scripts[l]}),this.setState({selected:r},()=>{var l,u;(u=(l=this.props).onSelectedChange)==null||u.call(l,r,this.state.editing),this.state.selected?window.localStorage.setItem("Editor.selected",this.state.selected):window.localStorage.removeItem("Editor.selected")})},50),!this.state.selected&&this.props.password&&this.state.editing.length&&setTimeout(()=>{const r=this.state.editing[0];this.setState({selected:r},()=>{var l,u;(u=(l=this.props).onSelectedChange)==null||u.call(l,r,this.state.editing),window.localStorage.setItem("Editor.selected",this.state.selected)})},50),[this.getTabs(),this.getToolbar(),this.getScriptEditor(),this.getAskAboutDebug(),this.getBlocklyEditor(),this.getRulesEditor(),this.getDebug(),this.getConfirmDialog(),this.getSelectIdDialog(),this.getCronDialog(),this.getEditorDialog(),this.getAstroDialog(),this.getDebugMenu(),this.renderOpenAiDialog(),this.getToast(),this.getTour()]}}const Ft={dialog:{height:"95%"},dropzone:{marginTop:20,width:"100%",borderWidth:5,borderStyle:"dashed",borderColor:"#d0cccc",textAlign:"center",boxSizing:"border-box",paddingTop:45,borderRadius:10,height:"calc(100% - 10px)"},dropzoneDiv:{width:"100%",height:"100%"},dropzoneRejected:{borderColor:"#970000"},dropzoneAccepted:{borderColor:"#17cd02"},icon:{height:"30%",width:"30%",color:"#eeeeee",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%,-50%)",zIndex:0},iconError:{color:"#ffc3c6"},iconOk:{color:"#aaeebc"},text:{top:"50%",left:"50%",transform:"translate(-50%,-50%)",color:"#868686",position:"absolute",zIndex:1}};class sm extends X.Component{constructor(s){super(s),this.state={error:"",imageStatus:""}}componentDidMount(){setTimeout(()=>{var s;try{(s=window.document.getElementById("import-text-area"))==null||s.focus()}catch{}},100)}handleCancel(){this.props.onClose()}static readFileDataUrl(s,i){const r=new FileReader;r.onload=()=>{i(null,{data:r.result,name:s.name})},r.onabort=()=>{console.error("file reading was aborted"),i(b.I18n.t("file reading was aborted"))},r.onerror=l=>{console.error("file reading has failed"),i(b.I18n.t("file reading has failed: %s",l))},r.readAsDataURL(s)}handleDropFile(s){if(!(s!=null&&s.length))return;const i=s[s.length-1];i&&sm.readFileDataUrl(i,(r,l)=>{var u;r||!l?this.setState({error:r||"No data"}):this.props.onClose(((u=l.data)==null?void 0:u.toString())||"")})}render(){const s={...Ft.dropzone,...this.state.imageStatus==="accepted"?Ft.dropzoneAccepted:this.state.imageStatus==="rejected"?Ft.dropzoneRejected:void 0};return g.jsxs(y.Dialog,{onClose:()=>!1,maxWidth:"lg",sx:{"& .MuiDialog-paper":Ft.dialog},fullWidth:!0,open:!0,"aria-labelledby":"import-dialog-title",PaperProps:{style:{minHeight:"90%",maxHeight:"90%"}},children:[g.jsx(y.DialogTitle,{id:"import-dialog-title",children:b.I18n.t("Import scripts")}),g.jsxs(y.DialogContent,{children:[g.jsx(j_,{maxSize:5e7,onDrop:(i,r)=>{var l,u,d;i.length?this.handleDropFile(i):window.alert(((d=(u=(l=r==null?void 0:r[0])==null?void 0:l.errors)==null?void 0:u[0])==null?void 0:d.message)||b.I18n.t("ra_Cannot upload"))},multiple:!1,accept:{"application/zip":[],"application/x-zip-compressed":[]},children:({getRootProps:i,getInputProps:r,isDragActive:l,isDragReject:u})=>u?(this.state.imageStatus!=="rejected"&&this.setState({imageStatus:"rejected"}),g.jsxs("div",{style:{...s,...Ft.dropzoneDiv},...i(),children:[g.jsx("input",{...r()}),g.jsx("span",{style:Ft.text,children:b.I18n.t("Some files will be rejected")},"text"),g.jsx(vc,{style:{...Ft.icon,...Ft.iconError}},"icon")]})):l?(this.state.imageStatus!=="accepted"&&this.setState({imageStatus:"accepted"}),g.jsxs("div",{style:{...s,...Ft.dropzoneDiv},...i(),children:[g.jsx("input",{...r()}),g.jsx("span",{style:Ft.text,children:b.I18n.t("All files will be accepted")},"text"),g.jsx(z_,{style:{...Ft.icon,...Ft.iconOk}},"icon")]})):(this.state.imageStatus!=="wait"&&this.setState({imageStatus:"wait"}),g.jsxs("div",{style:{...s,...Ft.dropzoneDiv},...i(),children:[g.jsx("input",{...r()}),g.jsx("span",{style:Ft.text,children:b.I18n.t("Drop some files here or click...")},"text"),g.jsx(U_,{style:Ft.icon},"icon")]}))},"image-drop"),this.state.error?g.jsx(Ec,{text:this.state.error,onClose:()=>this.setState({error:""})}):null]}),g.jsx(y.DialogActions,{children:g.jsx(y.Button,{color:"grey",variant:"contained",onClick:()=>this.handleCancel(),startIcon:g.jsx(zs,{}),children:b.I18n.t("Close")})})]})}}var om={exports:{}},F0=om.exports;(function(a,s){(function(i,r){a.exports=r()})(F0,function(){var i={},r,l,u,d,p,m,f,v,w,_,k,S,C,I,O,A,R,q,re,ie,$e,U,Me,Ne,qe,ce,de,J,we,ge,Fe,Y,et,Z,se,F,V,W,le,x,pe,G,ke,ye,Ie,me,Ve,Ye,Ce,Ee,ve,Be,ft,Q,lt,ze,wt,_e,tt,Hs,Ct,Tt,Pc,L,fe,Hr,st,rm,Ge,Ao,Wr,Ro,Oo,Fc,$n,Vr,Gr,bn,am,jc,ks,co,zc,Uc,Kr,Hc,vn,Yr,Wc,Vc,lm,cm,um,gi,dm,Jr,hm,yn,Xr,pm,qr,gm,Zr,Gc,Kc,Qr,ea,ta,_n,mm,mi,wn,sa,fm,$m,bm,uo,kt,Cn,Yc,ps,Ws,vm,Jc,oa,Xc,ym,qc,Tn,_m,ia,wm,Cm,na,Tm,fi,km,Zc,ra,Qc,eu,Sm,aa,$i,la,Em,tu,su,Im,xm,Mo,Dm,kn,Gt,Am,Rm,Om,Mm,Nm,Lm,Bm,ou,Vs,bi,iu,Pm,Fm,jm,zm,Um,Hm,Wm,Vm,Gm,nu,Km,vi,ca,Ym,yi,ru,au,lu,Sn,ua,cu,Jm,uu,du,hu,pu,gu,mu,fu,Xm,En,$u,da,ha,Ss,bu,vu,In,yu,_u,qm,pa,wu,Zm,Qm,ef,tf,sf,_i,Cu,Tu,wi,ga,of,nf,ku,Su,Gs,Eu,Iu,rf,af,lf,cf,xu,uf,Du,df,No,xn,ma,fa,Lo,Au,$a,Ru,ht,hf,Ci,Bo,pf,Ou,ba,Ti,Mu,Po,Dn,Nu,Lu,gf,mf,ff,Bu,$f,Pu,An,bf,vf,yf,_f,Rn,Fu,ju,va,ya,wf,On,zu,Mn,Cf,Tf,ho,Uu,Es,kf,Sf,Hu,Ef,Fo,Wu,If,xf,Df,Af,Rf,Vu,Of,Mf,_a,Nf,Lf,Gu,wa,Ku,Ca,Yu,Ju,ki,jo,Ks,Is,Bf,Pf,Ff,Xu,Ta,jf,zf,Uf,qu,ka,Zu,Sa,Hf,Wf,Vf,Gf,he,zt,vt,rt,xs,Si,ae,pt,Qu,Kf,po,Ea,Ia,ed,Yf,td,xa,sd,od,Jf,id,Xf,Da,qf,Zf,Qf,e$,t$,nd,s$,Nn,Ln,o$,rd,ad,ld,cd,Aa,ud,i$,n$,r$,Ei,dd,a$,Ra,Qt,l$,go,hd,c$,Bn,pd,gd,md,fd,$d,bd,vd,yd,_d,wd,u$,d$,h$,p$,g$,m$,Oa,f$,$$,Cd,Td,kd,Sd,Ed,Id,xd,Ma,Pn,Dd,b$,Ad,Rd,Od,Md,Nd,Ld,Bd,Pd,Fd,jd,v$,y$,_$,zd,w$,C$,T$,k$,S$,j;r=function(e,t,o,n){if(!(e instanceof z)&&typeof e!="string"||`${e}`.trim()==="")throw Error('Invalid type "'+e+'". The type must be a non-empty string or a Blockly.registry.Type.');if(e=`${e}`.toLowerCase(),typeof t!="string"||t.trim()==="")throw Error('Invalid name "'+t+'". The name must be a non-empty string.');const c=t.toLowerCase();if(!o)throw Error("Can not register a null value");let h=mo[e],$=Na[e];if(h||(h=mo[e]=Object.create(null),$=Na[e]=Object.create(null)),l(e,o),!n&&h[c]&&h[c]!==o)throw Error('Name "'+c+'" with type "'+e+'" already registered.');h[c]=o,$[c]=t},l=function(e,t){switch(e){case String(z.FIELD):if(typeof t.fromJson!="function")throw Error('Type "'+e+'" must have a fromJson function')}},u=function(e,t){e=`${e}`.toLowerCase(),t=t.toLowerCase();const o=mo[e];o&&o[t]?(delete mo[e][t],delete Na[e][t]):console.warn("Unable to unregister ["+t+"]["+e+"] from the registry.")},d=function(e,t,o){e=`${e}`.toLowerCase(),t=t.toLowerCase();const n=mo[e];if(!n||!n[t]){if(t="Unable to find ["+t+"]["+e+"] in the registry.",o)throw Error(t+" You must require or register a "+e+" plugin.");return console.warn(t),null}return n[t]},p=function(e,t){return e=`${e}`.toLowerCase(),t=t.toLowerCase(),(e=mo[e])?!!e[t]:!1},m=function(e,t,o){return d(e,t,o)},f=function(e,t,o){return d(e,t,o)},v=function(e,t,o){e=`${e}`.toLowerCase();var n=mo[e];if(!n){if(n=`Unable to find [${e}] in the registry.`,o)throw Error(`${n} You must require or register a ${e} plugin.`);return console.warn(n),null}if(!t)return n;e=Na[e],o=Object.create(null);for(const c of Object.keys(n))o[e[c]]=n[c];return o},w=function(e,t,o){return t=t.plugins[String(e)]||Ds,typeof t=="function"?t:m(e,t,o)},_=function(e,t,o,n){e=e+" was deprecated in "+t+" and will be deleted in "+o+".",n&&(e+=`
304
+ Use `+n+" instead."),I$.has(e)||(I$.add(e),console.warn(e))},k=function(){return"blockly-"+(FC++).toString(36)},S=function(){return A$.genUid()},C=function(e){return e.type===M.BLOCK_CREATE},I=function(e){return e.type===M.BLOCK_DELETE},O=function(e){return e.type===M.BLOCK_CHANGE},A=function(e){return e.type===M.BLOCK_FIELD_INTERMEDIATE_CHANGE},R=function(e){return e.type===M.BLOCK_MOVE},q=function(e){return e.type===M.CLICK},re=function(e){return e.type===M.BUBBLE_OPEN},ie=function(e){return e.type===M.VIEWPORT_CHANGE},i.setRecordUndo$$module$build$src$core$events$utils=function(e){Fn=e},$e=function(){return Fn},U=function(e){O$.fireInternal(e)},Me=function(e){if(J()){if(!Js.length)try{requestAnimationFrame(()=>{setTimeout(Ne,0)})}catch{setTimeout(Ne,0)}qe(e)}},Ne=function(){const e=ce(Js,!0);Js.length=0;for(const t of e){if(!t.workspaceId)continue;let o;(o=Z(t.workspaceId))==null||o.fireChangeListener(t)}},qe=function(e){if(O(e)&&e.element==="mutation"){let t;for(t=Js.length;0<t;t--){const o=Js[t-1];if(o.group!==e.group||o.workspaceId!==e.workspaceId||!R(o)||o.newParentId!==e.blockId)break}Js.splice(t,0,e)}else Js.push(e)},ce=function(e,t=!0){t||(_("filter(queue, /*forward=*/false)","v11.2","v12"),e=e.slice().reverse());const o=[];for(const n of e)if(e=o[o.length-1],!n.isNull())if(e&&e.workspaceId===n.workspaceId&&e.group===n.group)if(R(n)&&R(e)&&n.blockId===e.blockId){if(e.newParentId=n.newParentId,e.newInputName=n.newInputName,e.newCoordinate=n.newCoordinate,e.reason||n.reason){let c,h;e.reason=Array.from(new Set(((c=e.reason)!=null?c:[]).concat((h=n.reason)!=null?h:[])))}}else O(n)&&O(e)&&n.blockId===e.blockId&&n.element===e.element&&n.name===e.name?e.newValue=n.newValue:ie(n)&&ie(e)?(e.viewTop=n.viewTop,e.viewLeft=n.viewLeft,e.scale=n.scale,e.oldScale=n.oldScale):q(n)&&re(e)||o.push(n);else o.push(n);return e=o.filter(n=>!n.isNull()),t||e.reverse(),e},de=function(){for(let e=0,t;t=Js[e];e++)t.recordUndo=!1},i.disable$$module$build$src$core$events$utils=function(){Hd++},i.enable$$module$build$src$core$events$utils=function(){Hd--},J=function(){return Hd===0},i.getGroup$$module$build$src$core$events$utils=function(){return R$},i.setGroup$$module$build$src$core$events$utils=function(e){O$.setGroupInternal(e)},we=function(e){R$=typeof e=="boolean"?e?S():"":e},ge=function(e){const t=[];e=e.getDescendants(!1);for(let o=0,n;n=e[o];o++)t[o]=n.id;return t},Fe=function(e,t){const o=Y(e.type);if(!o)throw Error("Unknown event type.");return o.fromJson(e,t)},Y=function(e){const t=m(z.EVENT,e);if(!t)throw Error(`Event type ${e} not found in registry.`);return t},et=function(e){if((R(e)||C(e))&&e.workspaceId){var t=Z(e.workspaceId);if(!e.blockId)throw Error("Encountered a blockEvent without a proper blockId");if(e=t.getBlockById(e.blockId)){const o=Fn;try{Fn=!1;const n=e.getParent();if(n&&!n.hasDisabledReason(Wd)){const c=e.getDescendants(!1);for(let h=0,$;$=c[h];h++)$.setDisabledReason(!1,Wd)}else if((e.outputConnection||e.previousConnection)&&!t.isDragging())do e.setDisabledReason(!0,Wd),e=e.getNextBlock();while(e)}finally{Fn=o}}}},Z=function(e){return jn[e]||null},se=function(){const e=[];for(const t in jn)e.push(jn[t]);return e},F=function(e){jn[e.id]=e},V=function(e){delete jn[e.id]},W=function(){return M$},le=function(e){M$=e},x=function(){return zo},i.setSelected$$module$build$src$core$common=function(e){if(zo!==e){var t,o,n,c,h,$,T=new(Y(M.SELECTED))((n=(t=zo)==null?void 0:t.id)!=null?n:null,(c=e==null?void 0:e.id)!=null?c:null,($=(h=e==null?void 0:e.workspace.id)!=null?h:(o=zo)==null?void 0:o.workspace.id)!=null?$:"");U(T);var B;(B=zo)==null||B.unselect(),zo=e;var oe;(oe=zo)==null||oe.select()}},pe=function(){return N$},G=function(e){N$=e},ke=function(e){for(;e.options.parentWorkspace;)e=e.options.parentWorkspace;const t=e.getParentSvg(),o=e.getCachedParentSvgSize();var n=t.parentElement;if(n instanceof HTMLElement){var c=n.offsetWidth;n=n.offsetHeight,o.width!==c&&(t.setAttribute("width",c+"px"),e.setCachedParentSvgSize(c,null)),o.height!==n&&(t.setAttribute("height",n+"px"),e.setCachedParentSvgSize(null,n)),e.resize()}},ye=function(e,t){const o=Object.create(null),n=e.getDescendants(!0);t&&(e=e.getNextBlock())&&(e=n.indexOf(e),n.splice(e,n.length-e));for(let c=0,h;h=n[c];c++)o[h.type]?o[h.type]++:o[h.type]=1;return o},Ie=function(e){return function(){this.jsonInit(e)}},me=function(e){L$.defineBlocksWithJsonArrayInternal(e)},Ve=function(e){i.defineBlocks$$module$build$src$core$common(i.createBlockDefinitionsFromJsonArray$$module$build$src$core$common(e))},i.createBlockDefinitionsFromJsonArray$$module$build$src$core$common=function(e){const t={};for(let o=0;o<e.length;o++){const n=e[o];if(!n){console.warn(`Block definition #${o} in JSON array is ${n}. Skipping`);continue}const c=n.type;c?t[c]={init:Ie(n)}:console.warn(`Block definition #${o} in JSON array is missing a type attribute. Skipping.`)}return t},i.defineBlocks$$module$build$src$core$common=function(e){for(const t of Object.keys(e)){const o=e[t];t in Ut&&console.warn(`Block definition "${t}" overwrites previous definition.`),Ut[t]=o}},Ye=function(e,t){Ce(),Ba=setTimeout(function(){t&&t.handleRightClick(e)},jC)},Ce=function(){Ba&&(clearTimeout(Ba),Ba=0)},Ee=function(){La=null},ve=function(e){return!e.type.startsWith("pointer")||e instanceof PointerEvent&&ft(e)},Be=function(e){return`${e.pointerId}`},ft=function(e){const t=Be(e);return La?La===t:e.type==="pointerdown"?(La=t,!0):!1},Q=function(e,t,o,n,c){function h(T){(c||ve(T))&&(o?n.call(o,T):n(T))}const $=[];if(t in Uo)for(let T=0;T<Uo[t].length;T++){const B=Uo[t][T];e.addEventListener(B,h,!1),$.push([e,B,h])}else e.addEventListener(t,h,!1),$.push([e,t,h]);return $},lt=function(e,t,o,n){function c($){o?n.call(o,$):n($)}const h=[];if(t in Uo)for(let $=0;$<Uo[t].length;$++){const T=Uo[t][$];e.addEventListener(T,c,!1),h.push([e,T,c])}else e.addEventListener(t,c,!1),h.push([e,t,c]);return h},ze=function(e){const t=e[e.length-1][2];for(;e.length;){const[o,n,c]=e.pop();o.removeEventListener(n,c,!1)}return t},wt=function(e){if(e.target instanceof HTMLElement){if(e.target.isContentEditable||e.target.getAttribute("data-is-text-input")==="true")return!0;if(e.target instanceof HTMLInputElement)return e=e.target,e.type==="text"||e.type==="number"||e.type==="email"||e.type==="password"||e.type==="search"||e.type==="tel"||e.type==="url";if(e.target instanceof HTMLTextAreaElement)return!0}return!1},_e=function(e){return e.ctrlKey&&Xd?!0:e.button===2},tt=function(e,t,o){const n=t.createSVGPoint();return n.x=e.clientX,n.y=e.clientY,o||(o=t.getScreenCTM().inverse()),n.matrixTransform(o)},Hs=function(e){switch(e.deltaMode){default:return{x:e.deltaX,y:e.deltaY};case 1:return{x:e.deltaX*Y$,y:e.deltaY*Y$};case 2:return{x:e.deltaX*J$,y:e.deltaY*J$}}},Ct=function(e,t){return t=e.indexOf(t),t===-1?!1:(e.splice(t,1),!0)},Tt=function(e){if(qd)throw Error("CSS already injected");Zd+=`
305
+ `+e},Pc=function(e,t){qd||(qd=!0,e&&(e=t.replace(/[\\/]$/,""),t=Zd.replace(/<<<PATH>>>/g,e),Zd="",e=document.createElement("style"),e.id="blockly-common-style",t=document.createTextNode(t),e.appendChild(t),document.head.insertBefore(e,document.head.firstChild)))},L=function(e,t,o){e=document.createElementNS(Un,`${e}`);for(const n in t)e.setAttribute(n,`${t[n]}`);return o&&o.appendChild(e),e},fe=function(e,t){return t=t.split(" "),t.every(o=>e.classList.contains(o))?!1:(e.classList.add(...t),!0)},Hr=function(e,t){e.classList.remove(...t.split(" "))},st=function(e,t){return t=t.split(" "),t.every(o=>!e.classList.contains(o))?!1:(e.classList.remove(...t),!0)},rm=function(e,t){return e.classList.contains(t)},Ge=function(e){return e&&e.parentNode?e.parentNode.removeChild(e):null},Ao=function(e,t){const o=t.nextSibling;if(t=t.parentNode,!t)throw Error("Reference node has no parent.");o?t.insertBefore(e,o):t.appendChild(e)},Wr=function(e,t){e.style.transform=t,e.style["-webkit-transform"]=t},Ro=function(){eh++,ms||(ms=Object.create(null))},Oo=function(){eh--,eh||(ms=null)},Fc=function(e){const t=e.textContent+`
306
+ `+e.className.baseVal;let o;if(ms&&(o=ms[t]))return o;try{o=e.getComputedTextLength()}catch{return 8*e.textContent.length}return ms&&(ms[t]=o),o},$n=function(e,t,o,n){return Vr(e,t+"pt",o,n)},Vr=function(e,t,o,n){const c=e.textContent;e=c+`
307
+ `+e.className.baseVal;var h;return ms&&(h=ms[e])||(za||(h=document.createElement("canvas"),h.className="blocklyComputeCanvas",document.body.appendChild(h),za=h.getContext("2d")),za.font=o+" "+t+" "+n,h=c?za.measureText(c).width:0,ms&&(ms[e]=h)),h},Gr=function(e,t,o,n){const c=document.createElement("span");c.style.font=o+" "+t+" "+n,c.textContent=e,e=document.createElement("div"),e.style.width="1px",e.style.height="0",t=document.createElement("div"),t.style.display="flex",t.style.position="fixed",t.style.top="0",t.style.left="0",t.appendChild(c),t.appendChild(e),document.body.appendChild(t),o={height:0,baseline:0};try{t.style.alignItems="baseline",o.baseline=e.offsetTop-c.offsetTop,t.style.alignItems="flex-end",o.height=e.offsetTop-c.offsetTop}finally{document.body.removeChild(t)}return o},bn=function(e){return q$.getSizeInternal(e)},am=function(e){if(ks(e,"display")!=="none")return jc(e);const t=e.style,o=t.display,n=t.visibility,c=t.position;t.visibility="hidden",t.position="absolute",t.display="inline";const h=e.offsetWidth;return e=e.offsetHeight,t.display=o,t.position=c,t.visibility=n,new Le(h,e)},jc=function(e){return new Le(e.offsetWidth,e.offsetHeight)},ks=function(e,t){return e=window.getComputedStyle(e),e[t]||e.getPropertyValue(t)},co=function(e){const t=new K(0,0);e=e.getBoundingClientRect();var o=document.documentElement;return o=new K(window.pageXOffset||o.scrollLeft,window.pageYOffset||o.scrollTop),t.x=e.left+o.x,t.y=e.top+o.y,t},zc=function(){const e=document.body,t=document.documentElement;return new K(e.scrollLeft||t.scrollLeft,e.scrollTop||t.scrollTop)},Uc=function(e){const t=parseFloat(ks(e,"borderLeftWidth")),o=parseFloat(ks(e,"borderRightWidth")),n=parseFloat(ks(e,"borderTopWidth"));return e=parseFloat(ks(e,"borderBottomWidth")),new Je(n,e,t,o)},Kr=function(e,t,o){e=Hc(e,t,o),t.scrollLeft=e.x,t.scrollTop=e.y},Hc=function(e,t,o){var n=co(e),c=co(t),h=Uc(t);const $=n.x-c.x-h.left;return n=n.y-c.y-h.top,c=jc(e),e=t.clientWidth-c.width,c=t.clientHeight-c.height,h=t.scrollLeft,t=t.scrollTop,o?(h+=$-e/2,t+=n-c/2):(h+=Math.min($,Math.max($-e,0)),t+=Math.min(n,Math.max(n-c,0))),new K(h,t)},vn=function(e){const t=new K(0,0);var o=e.x&&e.getAttribute("x");const n=e.y&&e.getAttribute("y");return o&&(t.x=parseInt(o)),n&&(t.y=parseInt(n)),(o=(o=e.getAttribute("transform"))&&o.match(Z$))&&(t.x+=Number(o[1]),o[3]&&(t.y+=Number(o[3]))),(e=e.getAttribute("style"))&&e.includes("translate")&&(e=e.match(Q$))&&(t.x+=Number(e[1]),e[3]&&(t.y+=Number(e[3]))),t},Yr=function(e){let t=0,o=0;for(;e;){const n=vn(e);if(t+=n.x,o+=n.y,(" "+(e.getAttribute("class")||"")+" ").includes(" injectionDiv "))break;e=e.parentNode}return new K(t,o)},Wc=function(){const e=zc();return new Je(e.y,document.documentElement.clientHeight+e.y,e.x,document.documentElement.clientWidth+e.x)},Vc=function(){const e=document.documentElement,t=window;return new K(t.pageXOffset||e.scrollLeft,t.pageYOffset||e.scrollTop)},lm=function(e,t){var o=t.x;t=t.y;const n=e.getInjectionDiv().getBoundingClientRect();return o=new K(o-n.left,t-n.top),t=e.getOriginOffsetInPixels(),K.difference(o,t).scale(1/e.scale)},cm=function(e,t){var o=t.scale(e.scale);t=o.x,o=o.y;const n=e.getInjectionDiv().getBoundingClientRect();return e=e.getOriginOffsetInPixels(),new K(t+n.left+e.x,o+n.top+e.y)},um=function(e){({document:Ha=Ha,DOMParser:Hn=Hn,XMLSerializer:Wn=Wn}=e),Ua=new Hn,th=new Wn},i.createElement$$module$build$src$core$utils$xml=function(e){return Ha.createElementNS(eb,e)},i.createTextNode$$module$build$src$core$utils$xml=function(e){return Ha.createTextNode(e)},i.textToDom$$module$build$src$core$utils$xml=function(e){let t=Ua.parseFromString(e,"text/xml");if(t&&t.documentElement&&!t.getElementsByTagName("parsererror").length)return t.documentElement;if((t=Ua.parseFromString(e,"text/html"))&&t.body.firstChild&&t.body.firstChild.nodeName.toLowerCase()==="xml")return t.body.firstChild;throw Error(`DOMParser was unable to parse: ${e}`)},gi=function(e){return dm(th.serializeToString(e))},dm=function(e){return e.replace(WC,t=>`&#${t.charCodeAt(0)};`)},Jr=function(e){return e?((e instanceof Element||typeof e=="string")&&(e=Kc(e),e=gm(e)),hm(e),e):null},hm=function(e){const t=e.kind;if(e=e.contents,t&&t!==tb&&t!==sh)throw Error("Invalid toolbox kind "+t+". Please supply either "+tb+" or "+sh);if(!e)throw Error("Toolbox must have a contents attribute.")},yn=function(e){return e?e.contents?e.contents:Array.isArray(e)&&0<e.length&&!e[0].nodeType?e:Zr(e):[]},Xr=function(e){return sb.hasCategoriesInternal(e)},pm=function(e){if(!e)return!1;const t=e.kind;return t?t===sh:!!e.contents.filter(o=>o.kind.toUpperCase()==="CATEGORY").length},qr=function(e){return e&&e.contents?!!e.contents.filter(function(t){return t.kind.toUpperCase()==="CATEGORY"}).length:!1},gm=function(e){const t={contents:Zr(e)};return e instanceof Node&&Gc(e,t),t},Zr=function(e){const t=[];let o=e.childNodes;o||(o=e);for(let n=0,c;c=o[n];n++){if(!c.tagName)continue;e={};const h=c.tagName.toUpperCase();e.kind=h,h==="BLOCK"?e.blockxml=c:c.childNodes&&0<c.childNodes.length&&(e.contents=Zr(c)),Gc(c,e),t.push(e)}return t},Gc=function(e,t){for(let o=0;o<e.attributes.length;o++){const n=e.attributes[o];n.nodeName.includes("css-")?(t.cssconfig=t.cssconfig||{},t.cssconfig[n.nodeName.replace("css-","")]=n.value):t[n.nodeName]=n.value}},Kc=function(e){let t=null;if(e)if(typeof e=="string"){if(t=i.textToDom$$module$build$src$core$utils$xml(e),t.nodeName.toLowerCase()!=="xml")throw TypeError("Toolbox should be an <xml> document.")}else e instanceof Element&&(t=e);return t},Qr=function(e,t,o,n,c,h){const $=h.scrollbar&&h.scrollbar.canScrollVertically();return e.horizontal===Di.LEFT?(o=c.absoluteMetrics.left+o,$&&h.RTL&&(o+=gt.scrollbarThickness)):(o=c.absoluteMetrics.left+c.viewMetrics.width-t.width-o,$&&!h.RTL&&(o-=gt.scrollbarThickness)),e.vertical===Qs.TOP?e=c.absoluteMetrics.top+n:(e=c.absoluteMetrics.top+c.viewMetrics.height-t.height-n,h.scrollbar&&h.scrollbar.canScrollHorizontally()&&(e-=gt.scrollbarThickness)),new Je(e,e+t.height,o,o+t.width)},ea=function(e,t){return{horizontal:t.toolboxMetrics.position===xe.LEFT||e.horizontalLayout&&!e.RTL?Di.RIGHT:Di.LEFT,vertical:t.toolboxMetrics.position===xe.BOTTOM?Qs.TOP:Qs.BOTTOM}},ta=function(e,t,o,n){const c=e.left,h=e.right-e.left,$=e.bottom-e.top;for(let T=0;T<n.length;T++){const B=n[T];e.intersects(B)&&(e=o===bo.UP?B.top-$-t:B.bottom+t,e=new Je(e,e+$,c,c+h),T=-1)}return e},_n=function(e,t){r(z.SERIALIZER,e,t)},mm=function(e){u(z.SERIALIZER,e)},mi=function(e,{addCoordinates:t=!1,saveIds:o=!0}={}){const n=e.workspace,c=Object.create(null);return c.height=e.getSize().height,c.width=e.getSize().width,o&&(c.id=e.id),t&&(t=e.getRelativeToSurfaceXY(),c.x=n.RTL?n.getWidth()-t.x:t.x,c.y=t.y),e.getText()&&(c.text=e.getText()),e.isCollapsed()&&(c.collapsed=!0),e.isOwnEditable()||(c.editable=!1),e.isOwnMovable()||(c.movable=!1),e.isOwnDeletable()||(c.deletable=!1),c},wn=function(e,t,{recordUndo:o=!1}={}){const n=$e();if(i.setRecordUndo$$module$build$src$core$events$utils(o),o=t.newComment(e.id),e.text!==void 0&&o.setText(e.text),e.x!==void 0||e.y!==void 0){const h=o.getRelativeToSurfaceXY();let $,T=($=e.x)!=null?$:h.x;T=t.RTL?t.getWidth()-T:T;var c;t=(c=e.y)!=null?c:h.y,o.moveTo(new K(T,t))}if(e.width!==void 0||e.height){c=o.getSize();let h,$;o.setSize(new Le((h=e.width)!=null?h:c.width,($=e.height)!=null?$:c.height))}return e.collapsed!==void 0&&o.setCollapsed(e.collapsed),e.editable!==void 0&&o.setEditable(e.editable),e.movable!==void 0&&o.setMovable(e.movable),e.deletable!==void 0&&o.setDeletable(e.deletable),i.setRecordUndo$$module$build$src$core$events$utils(n),o},sa=function(e,t){r(z.PASTER,e,t)},fm=function(e){u(z.PASTER,e)},$m=function(e){const t=e.workspace,o=e.getRelativeToSurfaceXY(),n=new K(0,0),c=t.getTopComments(!1).filter(h=>h.id!==e.id).map(h=>h.getRelativeToSurfaceXY());for(;bm(K.sum(o,n),c);)n.translate(t.RTL?-30:30,30);e.moveTo(K.sum(o,n))},bm=function(e,t){return t.some(o=>1>=Math.abs(o.x-e.x)&&1>=Math.abs(o.y-e.y))},uo=function(e,t){e.setAttribute(KC,t)},kt=function(e,t,o){Array.isArray(o)&&(o=o.join(" ")),e.setAttribute(GC+t,`${o}`)},Cn=function(e){return e.saveState!==void 0&&e.loadState!==void 0},Yc=function(e){return Jc(e),vm()?(oa(),Promise.resolve()):(Ai||(Ai=new Promise(t=>{uh=t,cb=window.requestAnimationFrame(()=>{oa(),t()})})),Ai)},ps=function(){return Ai||Promise.resolve()},Ws=function(e){e||window.cancelAnimationFrame(cb),oa(e),!e&&uh&&uh()},vm=function(){return W$},Jc=function(e){lh.add(e),ch.set(e,i.getGroup$$module$build$src$core$events$utils());const t=e.getParent();t?Jc(t):Ka.add(e)},oa=function(e){const t=e?new Set([e]):new Set([...Ka].map(h=>h.workspace)),o=[...Ka].filter(ym).filter(h=>t.has(h.workspace));for(var n of o)qc(n);for(const h of t)h.resizeContents();for(var c of o)n=c.getRelativeToSurfaceXY(),c.updateComponentLocations(n);for(const h of o)c=i.getGroup$$module$build$src$core$events$utils(),(n=ch.get(h))&&i.setGroup$$module$build$src$core$events$utils(n),h.bumpNeighbours(),i.setGroup$$module$build$src$core$events$utils(c);for(const h of o)Xc(h);e||(Ai=null)},Xc=function(e){Ka.delete(e),lh.delete(e),ch.delete(e);for(const t of e.getChildren(!1))Xc(t)},ym=function(e){return!e.isDisposed()&&!e.getParent()},qc=function(e){if(lh.has(e)&&e.initialized){for(const t of e.getChildren(!1))qc(t);e.renderEfficiently()}},Tn=function(e,t){ub(e,t)},_m=function(e){ub=e},ia=function(e,t){pb.confirmInternal(e,t)},wm=function(e,t){db(e,t)},Cm=function(e){db=e},na=function(e,t,o){hb(e,t,o)},Tm=function(e){hb=e},fi=function(e){return e.getProcedureDef!==void 0},km=function(e){return e.getProcedureCall!==void 0&&e.renameProcedure!==void 0},Zc=function(e){return e.getVariableModel!==void 0},i.allUsedVarModels$$module$build$src$core$variables=function(e){e=e.getAllBlocks(!1);const t=new Set;for(let o=0;o<e.length;o++){const n=e[o].getVarModels();if(n)for(let c=0;c<n.length;c++){const h=n[c];h.getId()&&t.add(h)}}return Array.from(t.values())},i.allDeveloperVariables$$module$build$src$core$variables=function(e){e=e.getAllBlocks(!1);const t=new Set;for(let n=0,c;c=e[n];n++){var o=c.getDeveloperVariables;if(o){o=o();for(let h=0;h<o.length;h++)t.add(o[h])}}return Array.from(t.values())},ra=function(e){let t=[];const o=document.createElement("button");return o.setAttribute("text","%{BKY_NEW_VARIABLE}"),o.setAttribute("callbackKey","CREATE_VARIABLE"),e.registerButtonCallback("CREATE_VARIABLE",function(n){$i(n.getTargetWorkspace())}),t.push(o),e=Qc(e),t=t.concat(e)},Qc=function(e){e=e.getVariablesOfType("");const t=[];if(0<e.length){var o=e[e.length-1];if(Ut.variables_set){var n=i.createElement$$module$build$src$core$utils$xml("block");n.setAttribute("type","variables_set"),n.setAttribute("gap",Ut.math_change?"8":"24"),n.appendChild(Mo(o)),t.push(n)}if(Ut.math_change&&(n=i.createElement$$module$build$src$core$utils$xml("block"),n.setAttribute("type","math_change"),n.setAttribute("gap",Ut.variables_get?"20":"8"),n.appendChild(Mo(o)),o=i.textToDom$$module$build$src$core$utils$xml('<value name="DELTA"><shadow type="math_number"><field name="NUM">1</field></shadow></value>'),n.appendChild(o),t.push(n)),Ut.variables_get){e.sort(Yn.compareByName);for(let c=0,h;h=e[c];c++)o=i.createElement$$module$build$src$core$utils$xml("block"),o.setAttribute("type","variables_get"),o.setAttribute("gap","8"),o.appendChild(Mo(h)),t.push(o)}}return t},eu=function(e){return mb.generateUniqueNameInternal(e)},Sm=function(e){return aa(gh.charAt(0),e.getAllVariableNames())},aa=function(e,t){if(!t.length)return e;const o=gh;let n="",c=o.indexOf(e);for(;;){let h=!1;for(let $=0;$<t.length;$++)if(t[$].toLowerCase()===e){h=!0;break}if(!h)break;c++,c===o.length&&(c=0,n=`${Number(n)+1}`),e=o.charAt(c)+n}return e},$i=function(e,t,o){function n(h){la(i.Msg$$module$build$src$core$msg.NEW_VARIABLE_TITLE,h,function($){if($){var T=tu($,e);if(T){if(T.type===c)var B=i.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS.replace("%1",T.name);else B=i.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE,B=B.replace("%1",T.name).replace("%2",T.type);Tn(B,function(){n($)})}else e.createVariable($,c),t&&t($)}else t&&t(null)})}const c=o||"";n("")},i.renameVariable$$module$build$src$core$variables=function(e,t,o){function n(c){const h=i.Msg$$module$build$src$core$msg.RENAME_VARIABLE_TITLE.replace("%1",t.name);la(h,c,function($){if($){var T=Em($,t.type,e),B=su(t.name,$,e);if(T||B){var oe="";T?oe=i.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE.replace("%1",T.name).replace("%2",T.type):B&&(oe=i.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_A_PARAMETER.replace("%1",$).replace("%2",B)),Tn(oe,function(){n($)})}else e.renameVariableById(t.getId(),$),o&&o($)}else o&&o(null)})}n("")},la=function(e,t,o){na(e,t,function(n){n&&(n=n.replace(/[\s\xa0]+/g," ").trim(),n===i.Msg$$module$build$src$core$msg.RENAME_VARIABLE||n===i.Msg$$module$build$src$core$msg.NEW_VARIABLE)&&(n=null),o(n)})},Em=function(e,t,o){o=o.getVariableMap().getAllVariables(),e=e.toLowerCase();for(let n=0,c;c=o[n];n++)if(c.name.toLowerCase()===e&&c.type!==t)return c;return null},tu=function(e,t){t=t.getVariableMap().getAllVariables(),e=e.toLowerCase();for(let o=0,n;n=t[o];o++)if(n.name.toLowerCase()===e)return n;return null},su=function(e,t,o){return o.getProcedureMap().getProcedures().length?Im(e,t,o):xm(e,t,o)},Im=function(e,t,o){e=e.toLowerCase(),t=t.toLowerCase(),o=o.getProcedureMap().getProcedures();for(const c of o){var n=c.getParameters().filter(Zc).map(h=>h.getVariableModel().name);if(n&&(o=n.some(h=>h.toLowerCase()===e),n=n.some(h=>h.toLowerCase()===t),o&&n))return c.getName()}return null},xm=function(e,t,o){e=e.toLowerCase(),t=t.toLowerCase(),o=o.getAllBlocks(!1);for(const c of o){if(!fi(c))continue;o=c.getProcedureDef();var n=o[1];const h=n.some($=>$.toLowerCase()===e);if(n=n.some($=>$.toLowerCase()===t),h&&n)return o[0]}return null},Mo=function(e){const t=i.createElement$$module$build$src$core$utils$xml("field");return t.setAttribute("name","VAR"),t.setAttribute("id",e.getId()),t.setAttribute("variabletype",e.type),e=i.createTextNode$$module$build$src$core$utils$xml(e.name),t.appendChild(e),t},i.getOrCreateVariablePackage$$module$build$src$core$variables=function(e,t,o,n){let c=i.getVariable$$module$build$src$core$variables(e,t,o,n);return c||(c=Dm(e,t,o,n)),c},i.getVariable$$module$build$src$core$variables=function(e,t,o,n){const c=e.getPotentialVariableMap();let h=null;if(t&&(h=e.getVariableById(t),!h&&c&&(h=c.getVariableById(t)),h))return h;if(o){if(n===void 0)throw Error("Tried to look up a variable by name without a type");h=e.getVariable(o,n),!h&&c&&(h=c.getVariable(o,n))}return h},Dm=function(e,t,o,n){const c=e.getPotentialVariableMap();return o||(o=eu(e.isFlyout?e.targetWorkspace:e)),c?c.createVariable(o,n,t):e.createVariable(o,n,t)},kn=function(e,t){e=e.getAllVariables();const o=[];if(t.length!==e.length)for(let n=0;n<e.length;n++){const c=e[n];t.includes(c)||o.push(c)}return o},Gt=function(e,{addCoordinates:t=!1,addInputBlocks:o=!0,addNextBlocks:n=!0,doFullSerialization:c=!0,saveIds:h=!0}={}){if(e.isInsertionMarker())return null;const $={type:e.type,id:h?e.id:void 0};return t&&Rm(e,$),Am(e,$),Om(e,$,c),Mm(e,$,c),Nm(e,$,c),o&&Lm(e,$,c,h),n&&Bm(e,$,c,h),$},Am=function(e,t){e.isCollapsed()&&(t.collapsed=!0),e.isEnabled()||(t.disabledReasons=Array.from(e.getDisabledReasons())),e.isOwnDeletable()||(t.deletable=!1),e.isOwnMovable()||(t.movable=!1),e.isOwnEditable()||(t.editable=!1),e.inputsInline!==void 0&&e.inputsInline!==e.inputsInlineDefault&&(t.inline=e.inputsInline),e.data&&(t.data=e.data)},Rm=function(e,t){const o=e.workspace;e=e.getRelativeToSurfaceXY(),t.x=Math.round(o.RTL?o.getWidth()-e.x:e.x),t.y=Math.round(e.y)},Om=function(e,t,o){e.saveExtraState?(e=e.saveExtraState(o),e!==null&&(t.extraState=e)):e.mutationToDom&&(e=e.mutationToDom(),e!==null&&(t.extraState=Es(e).replace(' xmlns="https://developers.google.com/blockly/xml"',"")))},Mm=function(e,t,o){const n=Object.create(null);for(const c of e.getIcons())Cn(c)&&(e=c.saveState(o))&&(n[c.getType().toString()]=e);Object.keys(n).length&&(t.icons=n)},Nm=function(e,t,o){const n=Object.create(null);for(let c=0;c<e.inputList.length;c++){const h=e.inputList[c];for(let $=0;$<h.fieldRow.length;$++){const T=h.fieldRow[$];T.isSerializable()&&(n[T.name]=T.saveState(o))}}Object.keys(n).length&&(t.fields=n)},Lm=function(e,t,o,n){const c=Object.create(null);for(let h=0;h<e.inputList.length;h++){const $=e.inputList[h];if(!$.connection)continue;const T=ou($.connection,o,n);T&&(c[$.name]=T)}Object.keys(c).length&&(t.inputs=c)},Bm=function(e,t,o,n){e.nextConnection&&(e=ou(e.nextConnection,o,n))&&(t.next=e)},ou=function(e,t,o){const n=e.getShadowState(!0);if(e=e.targetBlock(),!n&&!e)return null;const c=Object.create(null);return n&&(c.shadow=n),e&&!e.isShadow()&&(c.block=Gt(e,{doFullSerialization:t,saveIds:o})),c},Vs=function(e,t,{recordUndo:o=!1}={}){return e=bi(e,t,{recordUndo:o}),t.rendered&&Ws(),e},bi=function(e,t,{parentConnection:o,isShadow:n=!1,recordUndo:c=!1}={}){const h=$e();i.setRecordUndo$$module$build$src$core$events$utils(c),(c=i.getGroup$$module$build$src$core$events$utils())||i.setGroup$$module$build$src$core$events$utils(!0),i.disable$$module$build$src$core$events$utils();const $=t.getAllVariables();let T;try{T=iu(e,t,{parentConnection:o,isShadow:n})}finally{i.enable$$module$build$src$core$events$utils()}if(Pm(t,$),J()&&U(new(Y(M.BLOCK_CREATE))(T)),i.setGroup$$module$build$src$core$events$utils(c),i.setRecordUndo$$module$build$src$core$events$utils(h),t.rendered){const B=T;setTimeout(()=>{B.disposed||B.setConnectionTracking(!0)},1)}return T},iu=function(e,t,{parentConnection:o,isShadow:n=!1}={}){if(!e.type)throw new fb(e);const c=t.newBlock(e.type,e.id);return c.setShadow(n),Fm(c,e),jm(c,e),zm(c,e),Um(o,c,e),Hm(c,e),Wm(c,e),Vm(c,e),Gm(c,e),Km(c,t.rendered),c},Pm=function(e,t){if(J())for(e=kn(e,t),t=0;t<e.length;t++){const o=e[t];U(new(Y(M.VAR_CREATE))(o))}},Fm=function(e,t){let o=t.x===void 0?0:t.x;t=t.y===void 0?0:t.y;const n=e.workspace;o=n.RTL?n.getWidth()-o:o,e.moveBy(o,t)},jm=function(e,t){if(t.collapsed&&e.setCollapsed(!0),t.deletable===!1&&e.setDeletable(!1),t.movable===!1&&e.setMovable(!1),t.editable===!1&&e.setEditable(!1),t.enabled===!1&&e.setDisabledReason(!0,Lt),Array.isArray(t.disabledReasons))for(const o of t.disabledReasons)e.setDisabledReason(!0,o);t.inline!==void 0&&e.setInputsInline(t.inline),t.data!==void 0&&(e.data=t.data)},zm=function(e,t){t.extraState&&(e.loadExtraState?e.loadExtraState(t.extraState):e.domToMutation&&e.domToMutation(i.textToDom$$module$build$src$core$utils$xml(t.extraState)))},Um=function(e,t,o){if(e){if(e.getSourceBlock().isShadow()&&!t.isShadow())throw new bb(o);if(e.type===i.inputTypes$$module$build$src$core$inputs$input_types.VALUE){var n=t.outputConnection;if(!n)throw new Jn("output",t,o)}else if(n=t.previousConnection,!n)throw new Jn("previous",t,o);if(!e.connect(n)){const c=t.workspace.connectionChecker;throw new $b(c.getErrorMessage(c.canConnectWithReason(n,e,!1),n,e),e.type===i.inputTypes$$module$build$src$core$inputs$input_types.VALUE?"output connection":"previous connection",t,o)}}},Hm=function(e,t){if(t.icons){var o=Object.keys(t.icons);for(const c of o){o=t.icons[c];var n=e.getIcon(c);if(!n){if(n=m(z.ICON,c,!1),!n)throw new vb(c,e,t);n=new n(e),e.addIcon(n)}Cn(n)&&n.loadState(o)}}},Wm=function(e,t){if(t.fields){var o=Object.keys(t.fields);for(let n=0;n<o.length;n++){const c=o[n],h=t.fields[c],$=e.getField(c);$?$.loadState(h):console.warn(`Ignoring non-existant field ${c} in block ${e.type}`)}}},Vm=function(e,t){if(t.inputs){var o=Object.keys(t.inputs);for(let n=0;n<o.length;n++){const c=o[n],h=e.getInput(c);if(!h||!h.connection)throw new Jn(c,e,t);nu(h.connection,t.inputs[c])}}},Gm=function(e,t){if(t.next){if(!e.nextConnection)throw new Jn("next",e,t);nu(e.nextConnection,t.next)}},nu=function(e,t){t.shadow&&e.setShadowState(t.shadow),t.block&&iu(t.block,e.getSourceBlock().workspace,{parentConnection:e})},Km=function(e,t){if(t){e.setConnectionTracking(!1),e.initSvg(),e.queueRender();for(const o of e.getIcons())o.onLocationChange(e.getRelativeToSurfaceXY())}else e.initModel()},vi=function(e){return e.bubbleIsVisible!==void 0&&e.setBubbleVisible!==void 0},ca=function(e){return e*Math.PI/180},Ym=function(e){return 180*e/Math.PI},yi=function(e,t,o){if(o<e){const n=o;o=e,e=n}return Math.max(e,Math.min(t,o))},ru=function(){document.querySelector(".blocklyDropDownDiv")||(Ue=document.createElement("div"),Ue.className="blocklyDropDownDiv",(pe()||document.body).appendChild(Ue),Ni=document.createElement("div"),Ni.className="blocklyDropDownContent",Ue.appendChild(Ni),qo=document.createElement("div"),qo.className="blocklyDropDownArrow",Ue.appendChild(qo),Ue.style.opacity="0",Ue.style.transition="transform "+qa+"s, opacity "+qa+"s",Ue.addEventListener("focusin",function(){fe(Ue,"blocklyFocused")}),Ue.addEventListener("focusout",function(){st(Ue,"blocklyFocused")}))},au=function(e){$h=e},lu=function(){return vo},Sn=function(){return Ni},ua=function(){Ni.textContent="",Ni.style.width=""},cu=function(e,t){Ue.style.backgroundColor=e,Ue.style.borderColor=t},Jm=function(e,t,o,n){return pu(du(t),e,o,n)},uu=function(e,t,o){return Cb=!0,pu(hu(e),e,t,o)},du=function(e){var t=e.getSvgRoot();const o=e.workspace.scale,n=e.height*o;return e=e.width*o,t=co(t),new Je(t.y,t.y+n,t.x,t.x+e)},hu=function(e){return e=e.getScaledBBox(),new Je(e.top,e.bottom,e.left,e.right)},pu=function(e,t,o,n){const c=e.left+(e.right-e.left)/2,h=e.bottom;e=e.top,n&&(e+=n),n=t.getSourceBlock();let $=n.workspace;for(;$.options.parentWorkspace;)$=$.options.parentWorkspace;return au($.getParentSvg().parentNode),gu(t,n.RTL,c,h,c,e,o)},gu=function(e,t,o,n,c,h,$){return vo=e,Xo=$||null,Ue.style.direction=t?"rtl":"ltr",e=W(),Oi=e.getRenderer().getClassName(),Mi=e.getTheme().getClassName(),Oi&&fe(Ue,Oi),Mi&&fe(Ue,Mi),bu(o,n,c,h)},mu=function(e,t,o,n){return e=En(e,o.left,o.right,n.width),{initialX:e.divX,initialY:t,finalX:e.divX,finalY:t+mh,arrowX:e.arrowX,arrowY:-9,arrowAtTop:!0,arrowVisible:!0}},fu=function(e,t,o,n){return e=En(e,o.left,o.right,n.width),{initialX:e.divX,initialY:t-n.height,finalX:e.divX,finalY:t-n.height-mh,arrowX:e.arrowX,arrowY:n.height-2*_b-Xa/2,arrowAtTop:!1,arrowVisible:!0}},Xm=function(e,t,o){return e=En(e,t.left,t.right,o.width),{initialX:e.divX,initialY:0,finalX:e.divX,finalY:0,arrowAtTop:null,arrowX:null,arrowY:null,arrowVisible:!1}},En=function(e,t,o,n){return t=yi(t,e-n/2,o-n),e=e-Xa/2-t,o=wb,e=yi(o,e,n-o-Xa),{arrowX:e,divX:t}},$u=function(){return!!vo},da=function(e,t){return vo===e?(t?Ss():ha(),!0):!1},ha=function(){Ue.style.transform="translate(0, 0)",Ue.style.opacity="0",fh=setTimeout(function(){Ss()},1e3*qa),Xo&&(Xo(),Xo=null)},Ss=function(){$u()&&(fh&&clearTimeout(fh),Ue.style.transform="",Ue.style.left="",Ue.style.top="",Ue.style.opacity="0",Ue.style.display="none",Ue.style.backgroundColor="",Ue.style.borderColor="",Xo&&(Xo(),Xo=null),ua(),vo=null,Oi&&(st(Ue,Oi),Oi=""),Mi&&(st(Ue,Mi),Mi=""),W().markFocused())},bu=function(e,t,o,n){e=bh.getPositionMetrics(e,t,o,n),e.arrowVisible?(qo.style.display="",qo.style.transform="translate("+e.arrowX+"px,"+e.arrowY+"px) rotate(45deg)",qo.setAttribute("class",e.arrowAtTop?"blocklyDropDownArrow blocklyArrowTop":"blocklyDropDownArrow blocklyArrowBottom")):qo.style.display="none",t=Math.floor(e.initialX),o=Math.floor(e.initialY),n=Math.floor(e.finalX);const c=Math.floor(e.finalY);return Ue.style.left=t+"px",Ue.style.top=o+"px",Ue.style.display="block",Ue.style.opacity="1",Ue.style.transform="translate("+(n-t)+"px,"+(c-o)+"px)",!!e.arrowAtTop},vu=function(){if(vo){var e=vo.getSourceBlock();e=Cb?hu(vo):du(e);const t=e.left+(e.right-e.left)/2;bu(t,e.bottom,t,e.top)}else ha()},In=function(e){return e.length?e.reduce(function(t,o){return t.length<o.length?t:o}).length:0},yu=function(e,t){if(!e.length)return 0;if(e.length===1)return e[0].length;let o=0;t=t||In(e);let n;for(n=0;n<t;n++){for(var c=e[0][n],h=1;h<e.length;h++)if(c!==e[h][n])return o;c===" "&&(o=n+1)}for(c=1;c<e.length;c++)if((h=e[c][n])&&h!==" ")return o;return t},_u=function(e,t){if(!e.length)return 0;if(e.length===1)return e[0].length;let o=0;t=t||In(e);let n;for(n=0;n<t;n++){for(var c=e[0].substr(-n-1,1),h=1;h<e.length;h++)if(c!==e[h].substr(-n-1,1))return o;c===" "&&(o=n+1)}for(c=1;c<e.length;c++)if((h=e[c].charAt(e[c].length-n-1))&&h!==" ")return o;return t},i.wrap$$module$build$src$core$utils$string=function(e,t){e=e.split(`
308
+ `);for(let o=0;o<e.length;o++)e[o]=qm(e[o],t);return e.join(`
309
+ `)},qm=function(e,t){if(e.length<=t)return e;const o=e.trim().split(/\s+/);for(var n=0;n<o.length;n++)o[n].length>t&&(t=o[n].length);var c=-1/0;let h,$=1;do{n=c,h=e,e=[],c=o.length/$;let T=1;for(let B=0;B<o.length-1;B++)T<(B+1.5)/c?(T++,e[B]=!0):e[B]=!1;e=wu(o,e,t),c=pa(o,e,t),e=Zm(o,e),$++}while(c>n);return h},pa=function(e,t,o){const n=[0],c=[];for(var h=0;h<e.length;h++)n[n.length-1]+=e[h].length,t[h]===!0?(n.push(0),c.push(e[h].charAt(e[h].length-1))):t[h]===!1&&n[n.length-1]++;for(e=Math.max(...n),t=0,h=0;h<n.length;h++)t-=2*Math.pow(Math.abs(o-n[h]),1.5),t-=Math.pow(e-n[h],1.5),".?!".includes(c[h])?t+=o/3:",;)]}".includes(c[h])&&(t+=o/4);return 1<n.length&&n[n.length-1]<=n[n.length-2]&&(t+=.5),t},wu=function(e,t,o){let n=pa(e,t,o),c;for(let h=0;h<t.length-1;h++){if(t[h]===t[h+1])continue;const $=[].concat(t);$[h]=!$[h],$[h+1]=!$[h+1];const T=pa(e,$,o);T>n&&(n=T,c=$)}return c?wu(e,c,o):t},Zm=function(e,t){const o=[];for(let n=0;n<e.length;n++)o.push(e[n]),t[n]!==void 0&&o.push(t[n]?`
310
+ `:" ");return o.join("")},i.isNumber$$module$build$src$core$utils$string=function(e){return/^\s*-?\d+(\.\d+)?\s*$/.test(e)},Qm=function(e){Za=e},ef=function(){return Za},tf=function(){return Zn},sf=function(){return bt},_i=function(e){if(e=Cu(e)){for(e=e.tooltip;typeof e=="function";)e=e();if(typeof e!="string")throw Error("Tooltip function must return a string.");return e}return""},Cu=function(e){for(;e&&e.tooltip;){if(typeof e.tooltip=="string"||typeof e.tooltip=="function")return e;e=e.tooltip}return null},Tu=function(){document.querySelector(".blocklyTooltipDiv")||(bt=document.createElement("div"),bt.className="blocklyTooltipDiv",(pe()||document.body).appendChild(bt))},wi=function(e){e.mouseOverWrapper_=lt(e,"pointerover",null,of),e.mouseOutWrapper_=lt(e,"pointerout",null,nf),e.addEventListener("pointermove",ku,!1)},ga=function(e){e&&(ze(e.mouseOverWrapper_),ze(e.mouseOutWrapper_),e.removeEventListener("pointermove",ku))},of=function(e){Bi||(e=Cu(e.currentTarget),es!==e&&(Gs(),Qn=null,es=e),clearTimeout(kb))},nf=function(e){Bi||(kb=setTimeout(function(){Qn=es=null,Gs()},1),clearTimeout(Zo),Zo=0)},ku=function(e){if(es&&es.tooltip&&!Bi)if(Zn){const t=vh-e.pageX;e=yh-e.pageY,Math.sqrt(t*t+e*e)>Sb&&Gs()}else Qn!==es&&(clearTimeout(Zo),vh=e.pageX,yh=e.pageY,Zo=setTimeout(cf,Eb))},Su=function(){Qn=es=null,Gs()},Gs=function(){Zn&&(Zn=!1,bt&&(bt.style.display="none")),Zo&&(clearTimeout(Zo),Zo=0)},Eu=function(){Gs(),Bi=!0},Iu=function(){Bi=!1},rf=function(){bt&&es&&(typeof Za=="function"?Za(bt,es):af())},af=function(){var e=_i(es);e=i.wrap$$module$build$src$core$utils$string(e,Tb),e=e.split(`
311
+ `);for(let t=0;t<e.length;t++){const o=document.createElement("div");o.appendChild(document.createTextNode(e[t])),bt.appendChild(o)}},lf=function(e){const t=document.documentElement.clientWidth,o=document.documentElement.clientHeight;let n=vh;n=e?n-(_h+bt.offsetWidth):n+_h;let c=yh+wh;return c+bt.offsetHeight>o+window.scrollY&&(c-=bt.offsetHeight+2*wh),e?n=Math.max(Qa-window.scrollX,n):n+bt.offsetWidth>t+window.scrollX-2*Qa&&(n=t-bt.offsetWidth-2*Qa),{x:n,y:c}},cf=function(){if(!Bi&&(Qn=es,bt)){bt.textContent="",rf();var e=es.RTL;bt.style.direction=e?"rtl":"ltr",bt.style.display="block",Zn=!0;var{x:t,y:o}=lf(e);bt.style.left=t+"px",bt.style.top=o+"px"}},xu=function(){return Ch},uf=function(e){Ch=e},Du=function(){return Th},df=function(e){Th=e},No=function(e){e=`${e}`.toLowerCase().trim();var t=Ib[e];if(t||(t=e.substring(0,2)==="0x"?"#"+e.substring(2):e,t=t[0]==="#"?t:"#"+t,/^#[0-9a-f]{6}$/.test(t)))return t;if(/^#[0-9a-f]{3}$/.test(t))return["#",t[1],t[1],t[2],t[2],t[3],t[3]].join("");var o=e.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return o&&(e=Number(o[1]),t=Number(o[2]),o=Number(o[3]),0<=e&&256>e&&0<=t&&256>t&&0<=o&&256>o)?xn(e,t,o):null},xn=function(e,t,o){return t=e<<16|t<<8|o,16>e?"#"+(16777216|t).toString(16).substr(1):"#"+t.toString(16)},ma=function(e){return e=No(e),e?(e=parseInt(e.substr(1),16),[e>>16,e>>8&255,e&255]):[0,0,0]},fa=function(e,t,o){let n=0,c=0,h=0;if(t===0)h=c=n=o;else{const $=Math.floor(e/60),T=e/60-$;e=o*(1-t);const B=o*(1-t*T);switch(t=o*(1-t*(1-T)),$){case 1:n=B,c=o,h=e;break;case 2:n=e,c=o,h=t;break;case 3:n=e,c=B,h=o;break;case 4:n=t,c=e,h=o;break;case 5:n=o,c=e,h=B;break;case 6:case 0:n=o,c=t,h=e}}return xn(Math.floor(n),Math.floor(c),Math.floor(h))},Lo=function(e,t,o){return e=No(e),!e||(t=No(t),!t)?null:(e=ma(e),t=ma(t),xn(Math.round(t[0]+o*(e[0]-t[0])),Math.round(t[1]+o*(e[1]-t[1])),Math.round(t[2]+o*(e[2]-t[2]))))},Au=function(e){return fa(e,Ch,255*Th)},$a=function(e,t,o){const n=[];var c=e.split("");c.push("");var h=0;e=[];let $=null;for(let oe=0;oe<c.length;oe++){var T=c[oe];if(h===0)if(T==="%")(h=e.join(""))&&n.push(h),e.length=0,h=1;else if(o&&T===`
312
+ `){const it=e.join("");it&&n.push(it),e.length=0,n.push(T)}else e.push(T);else if(h===1)T==="%"?(e.push(T),h=0):t&&"0"<=T&&"9">=T?(h=2,$=T,(T=e.join(""))&&n.push(T),e.length=0):T==="{"?h=3:(e.push("%",T),h=0);else if(h===2)if("0"<=T&&"9">=T)$+=T;else{var B=void 0;n.push(parseInt((B=$)!=null?B:"",10)),oe--,h=0}else h===3&&(T===""?(e.splice(0,0,"%{"),oe--,h=0):T!=="}"?e.push(T):(h=e.join(""),/[A-Z]\w*/i.test(h)?(T=h.toUpperCase(),(T=T.startsWith("BKY_")?T.substring(4):null)&&T in i.Msg$$module$build$src$core$msg?(h=i.Msg$$module$build$src$core$msg[T],typeof h=="string"?Array.prototype.push.apply(n,$a(h,t,o)):t?n.push(`${h}`):n.push(h)):n.push("%{"+h+"}")):n.push("%{"+h+"}"),h=e.length=0))}for((t=e.join(""))&&n.push(t),B=[],e.length=0,c=0;c<n.length;c++)typeof n[c]!="string"||o&&n[c]===`
313
+ `?((t=e.join(""))&&B.push(t),e.length=0,B.push(n[c])):e.push(n[c]);return(t=e.join(""))&&B.push(t),e.length=0,B},Ru=function(e){return $a(e,!0,!0)},ht=function(e){return typeof e!="string"?e:(e=$a(e,!1,!1),e.length?String(e[0]):"")},hf=function(e){let t=!0;const o=i.Msg$$module$build$src$core$msg,n=e.match(/%{BKY_[A-Z]\w*}/gi);if(n)for(let c=0;c<n.length;c++){const h=n[c].toUpperCase();o[h.slice(6,-1)]===void 0&&(console.warn("No message string for "+n[c]+" in "+e),t=!1)}return t},Ci=function(e){const t=typeof e=="string"?ht(e):e;var o=Number(t);if(!isNaN(o)&&0<=o&&360>=o)return{hue:o,hex:fa(o,xu(),255*Du())};if(o=No(t))return{hue:null,hex:o};throw o='Invalid colour: "'+t+'"',e!==t&&(o+=' (from "'+e+'")'),Error(o)},Bo=function(){return $s},pf=function(e){if($s=e,e===null){let t;(t=document.querySelector("."+tl))==null||t.remove()}},Ou=function(){const e=pe()||document.body;document.querySelector("."+tl)?$s=document.querySelector("."+tl):($s=document.createElement("div"),$s.className=tl),e.appendChild($s)},ba=function(e,t,o,n){if(Ti(),Pi=e,el=o,o=$s){if(o.style.direction=t?"rtl":"ltr",o.style.display="block",!n&&e instanceof Ze){let $;n=($=e.getSourceBlock())==null?void 0:$.workspace}var c;kh=(c=n)!=null?c:null;var h;e=(h=n)!=null?h:W(),Fi=e.getRenderer().getClassName(),ji=e.getTheme().getClassName(),Fi&&fe(o,Fi),ji&&fe(o,ji)}},Ti=function(){if(Mu()){Pi=null;var e=$s;e&&(e.style.display="none",e.style.left="",e.style.top="",el&&el(),el=null,e.textContent="",Fi&&(st(e,Fi),Fi=""),ji&&(st(e,ji),ji=""),W().markFocused())}},Mu=function(){return!!Pi},Po=function(e){Pi===e&&Ti()},Dn=function(e){kh!==null&&kh!==e||Ti()},Nu=function(e,t,o){$s.style.left=e+"px",$s.style.top=t+"px",$s.style.height=o+"px"},Lu=function(e,t,o,n){const c=mf(e,t,o);e=gf(e,t,o,n),0>c?Nu(e,0,o.height+c):Nu(e,c,o.height)},gf=function(e,t,o,n){return n?Math.min(Math.max(t.right-o.width,e.left),e.right-o.width):Math.max(Math.min(t.left,e.right-o.width),e.left)},mf=function(e,t,o){return t.bottom+o.height>=e.bottom?t.top-o.height:t.bottom},ff=function(e){return!(e==null||!e.repositionForWindowResize)},Bu=function(){ff(Pi)&&Pi.repositionForWindowResize()||Ti()},$f=function(){return sl},Pu=function(e){sl=e},An=function(e,t,o,n){if(ba(xb,o,Fu,n),t.length){var c=bf(t,o,e);ol=c,vf(c,e,o),setTimeout(function(){c.focus()},1),sl=null}else Rn()},bf=function(e,t,o){const n=new rh;n.setRole(fs.MENU);for(let c=0;c<e.length;c++){const h=e[c],$=new ah(h.text);$.setRightToLeft(t),$.setRole(fs.MENUITEM),n.addChild($),$.setEnabled(h.enabled),h.enabled&&$.onAction(function(){Rn(),requestAnimationFrame(()=>{setTimeout(()=>{h.callback(h.scope,o)},0)})},{})}return n},vf=function(e,t,o){const n=Wc();t=new Je(t.clientY+n.top,t.clientY+n.top,t.clientX+n.left,t.clientX+n.left),yf(e);const c=e.getSize();o&&(t.left+=c.width,t.right+=c.width,n.left+=c.width,n.right+=c.width),Lu(n,t,c,o),e.focus()},yf=function(e){var t=Bo();if(!t)throw Error("Attempting to create a context menu when widget div is null");t=e.render(t),fe(t,"blocklyContextMenu"),Q(t,"contextmenu",null,_f),e.focus()},_f=function(e){e.preventDefault(),e.stopPropagation()},Rn=function(){Po(xb),sl=null},Fu=function(){ol&&(ol.dispose(),ol=null)},i.callbackFactory$$module$build$src$core$contextmenu=function(e,t){return()=>{i.disable$$module$build$src$core$events$utils();let o;try{o=t instanceof Element?Fo(t,e.workspace):bi(t,e.workspace);const n=e.getRelativeToSurfaceXY();n.x=e.RTL?n.x-i.config$$module$build$src$core$config.snapRadius:n.x+i.config$$module$build$src$core$config.snapRadius,n.y+=2*i.config$$module$build$src$core$config.snapRadius,o.moveBy(n.x,n.y)}finally{i.enable$$module$build$src$core$events$utils()}return J()&&!o.isShadow()&&U(new(Y(M.BLOCK_CREATE))(o)),i.setSelected$$module$build$src$core$common(o),o}},ju=function(e,t){return t=tt(t,e.getParentSvg(),e.getInverseScreenCTM()),t.x/=e.scale,t.y/=e.scale,t},va=function(e,t,o){t=ju(e,t),Ab.set(e,K.difference(o,t))},ya=function(e,t){if(t=ju(e,t),e=Ab.get(e),!e)throw Error("Drag not initialized");return K.sum(e,t)},wf=function(e,t=!1){const o=i.createElement$$module$build$src$core$utils$xml("xml");var n=zu(i.allUsedVarModels$$module$build$src$core$variables(e));n.hasChildNodes()&&o.appendChild(n);for(const c of e.getTopComments())o.appendChild(On(c,t));for(e=e.getTopBlocks(!0),n=0;n<e.length;n++)o.appendChild(Mn(e[n],t));return o},On=function(e,t=!1){const o=i.createElement$$module$build$src$core$utils$xml("comment");t||o.setAttribute("id",e.id),t=e.workspace;const n=e.getRelativeToSurfaceXY();return n.x=t.RTL?t.getWidth()-n.x:n.x,o.setAttribute("x",`${n.x}`),o.setAttribute("y",`${n.y}`),o.setAttribute("w",`${e.getSize().width}`),o.setAttribute("h",`${e.getSize().height}`),e.getText()&&(o.textContent=e.getText()),e.isCollapsed()&&o.setAttribute("collapsed","true"),e.isOwnEditable()||o.setAttribute("editable","false"),e.isOwnMovable()||o.setAttribute("movable","false"),e.isOwnDeletable()||o.setAttribute("deletable","false"),o},zu=function(e){const t=i.createElement$$module$build$src$core$utils$xml("variables");for(let o=0;o<e.length;o++){const n=e[o],c=i.createElement$$module$build$src$core$utils$xml("variable");c.appendChild(i.createTextNode$$module$build$src$core$utils$xml(n.name)),n.type&&c.setAttribute("type",n.type),c.id=n.getId(),t.appendChild(c)}return t},Mn=function(e,t){if(e.isInsertionMarker()&&(e=e.getChildren(!1)[0],!e))return new DocumentFragment;let o=0;if(e.workspace.RTL&&(o=e.workspace.getWidth()),t=ho(e,t),Gu(t)){const n=e.getRelativeToSurfaceXY();t.setAttribute("x",String(Math.round(e.workspace.RTL?o-n.x:n.x))),t.setAttribute("y",String(Math.round(n.y)))}return t},Cf=function(e){if(e.isSerializable()){const t=i.createElement$$module$build$src$core$utils$xml("field");return t.setAttribute("name",e.name||""),e.toXml(t)}return null},Tf=function(e,t){for(let o=0;o<e.inputList.length;o++){const n=e.inputList[o];for(let c=0;c<n.fieldRow.length;c++){const h=Cf(n.fieldRow[c]);h&&t.appendChild(h)}}},ho=function(e,t){if(e.isInsertionMarker())return(t=e.getChildren(!1)[0])?ho(t):new DocumentFragment;const o=i.createElement$$module$build$src$core$utils$xml(e.isShadow()?"shadow":"block");if(o.setAttribute("type",e.type),t||(o.id=e.id),e.mutationToDom){var n=e.mutationToDom();n&&(n.hasChildNodes()||n.hasAttributes())&&o.appendChild(n)}if(Tf(e,o),n=e.getCommentText()){var c=e.getIcon($t.COMMENT),h=c.getBubbleSize();c=c.bubbleIsVisible();var $=i.createElement$$module$build$src$core$utils$xml("comment");$.appendChild(i.createTextNode$$module$build$src$core$utils$xml(n)),$.setAttribute("pinned",`${c}`),$.setAttribute("h",String(h.height)),$.setAttribute("w",String(h.width)),o.appendChild($)}for(e.data&&(n=i.createElement$$module$build$src$core$utils$xml("data"),n.appendChild(i.createTextNode$$module$build$src$core$utils$xml(e.data)),o.appendChild(n)),n=0;n<e.inputList.length;n++){h=e.inputList[n];var T=void 0;if(c=!0,h.type!==i.inputTypes$$module$build$src$core$inputs$input_types.DUMMY&&h.type!==i.inputTypes$$module$build$src$core$inputs$input_types.END_ROW){$=h.connection.targetBlock(),h.type===i.inputTypes$$module$build$src$core$inputs$input_types.VALUE?T=i.createElement$$module$build$src$core$utils$xml("value"):h.type===i.inputTypes$$module$build$src$core$inputs$input_types.STATEMENT&&(T=i.createElement$$module$build$src$core$utils$xml("statement"));const oe=h.connection.getShadowDom();!oe||$&&$.isShadow()||T.appendChild(Uu(oe,t)),$&&($=ho($,t),$.nodeType===Zs.ELEMENT_NODE&&(T.appendChild($),c=!1)),T.setAttribute("name",h.name),c||o.appendChild(T)}}e.inputsInline!==void 0&&e.inputsInline!==e.inputsInlineDefault&&o.setAttribute("inline",String(e.inputsInline)),e.isCollapsed()&&o.setAttribute("collapsed","true"),e.isEnabled()||o.setAttribute("disabled-reasons",Array.from(e.getDisabledReasons()).map(encodeURIComponent).join(",")),e.isOwnDeletable()||o.setAttribute("deletable","false"),e.isOwnMovable()||o.setAttribute("movable","false"),e.isOwnEditable()||o.setAttribute("editable","false"),T=e.getNextBlock();let B;return T&&(n=ho(T,t),n.nodeType===Zs.ELEMENT_NODE&&(B=i.createElement$$module$build$src$core$utils$xml("next"),B.appendChild(n),o.appendChild(B))),e=e.nextConnection&&e.nextConnection.getShadowDom(),!e||T&&T.isShadow()||B.appendChild(Uu(e,t)),o},Uu=function(e,t){let o=e=e.cloneNode(!0),n;for(;o;)if(t&&o.nodeName==="shadow"&&o.removeAttribute("id"),o.firstChild)o=o.firstChild;else{for(;o&&!o.nextSibling;){n=o,o=o.parentNode;let c;n.nodeType===Zs.TEXT_NODE&&n.data.trim()===""&&((c=o)==null?void 0:c.firstChild)!==n&&Ge(n)}o&&(n=o,o=o.nextSibling,n.nodeType===Zs.TEXT_NODE&&n.data.trim()===""&&Ge(n))}return e},Es=function(e){return gi(e).replace(/<(\w+)([^<]*)\/>/g,"<$1$2></$1>")},kf=function(e){e=Es(e).split("<");let t="";for(let o=1;o<e.length;o++){const n=e[o];n[0]==="/"&&(t=t.substring(2)),e[o]=t+"<"+n,n[0]!=="/"&&n.slice(-2)!=="/>"&&(t+=" ")}return e=e.join(`
314
+ `),e=e.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1</$2>"),e.replace(/^\n/,"")},Sf=function(e,t){return t.setResizesEnabled(!1),t.clear(),e=i.domToWorkspace$$module$build$src$core$xml(e,t),t.setResizesEnabled(!0),e},i.domToWorkspace$$module$build$src$core$xml=function(e,t){let o=0;t.RTL&&(o=t.getWidth());const n=[];Ro();const c=i.getGroup$$module$build$src$core$events$utils();c||i.setGroup$$module$build$src$core$events$utils(!0),t.setResizesEnabled&&t.setResizesEnabled(!1);let h=!0;try{for(let $=0,T;T=e.childNodes[$];$++){const B=T.nodeName.toLowerCase(),oe=T;if(B==="block"||B==="shadow"&&!$e()){const it=Fo(oe,t);n.push(it.id);let ot;const Wt=parseInt((ot=oe.getAttribute("x"))!=null?ot:"10",10);let qi;const mr=parseInt((qi=oe.getAttribute("y"))!=null?qi:"10",10);isNaN(Wt)||isNaN(mr)||it.moveBy(t.RTL?o-Wt:Wt,mr,["create"]),h=!1}else{if(B==="shadow")throw TypeError("Shadow block cannot be a top-level block.");if(B==="comment")Hu(oe,t);else if(B==="variables"){if(h)Wu(oe,t);else throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");h=!1}}}}finally{i.setGroup$$module$build$src$core$events$utils(c),t.setResizesEnabled&&t.setResizesEnabled(!0),t.rendered&&Ws(),Oo()}return U(new(Y(M.FINISHED_LOADING))(t)),n},Hu=function(e,t){var o;const n=(o=e.getAttribute("id"))!=null?o:void 0;o=t.rendered?new rl(t,n):new nl(t,n);var c;o.setText((c=e.textContent)!=null?c:"");var h;c=parseInt((h=e.getAttribute("x"))!=null?h:"",10);let $;h=parseInt(($=e.getAttribute("y"))!=null?$:"",10),isNaN(c)||isNaN(h)||(c=t.RTL?t.getWidth()-c:c,o.moveTo(new K(c,h)));var T;t=parseInt((T=e.getAttribute("w"))!=null?T:"",10);let B;return T=parseInt((B=e.getAttribute("h"))!=null?B:"",10),isNaN(t)||isNaN(T)||o.setSize(new Le(t,T)),e.getAttribute("collapsed")==="true"&&o.setCollapsed(!0),e.getAttribute("editable")==="false"&&o.setEditable(!1),e.getAttribute("movable")==="false"&&o.setMovable(!1),e.getAttribute("deletable")==="false"&&o.setDeletable(!1),o},Ef=function(e,t){if(!t.getBlocksBoundingBox)return i.domToWorkspace$$module$build$src$core$xml(e,t);var o=t.getBlocksBoundingBox();if(e=i.domToWorkspace$$module$build$src$core$xml(e,t),o&&o.top!==o.bottom){var n=o.bottom;o=t.RTL?o.right:o.left;var c=1/0;let h=-1/0,$=1/0;for(let T=0;T<e.length;T++){const B=t.getBlockById(e[T]).getRelativeToSurfaceXY();B.y<$&&($=B.y),B.x<c&&(c=B.x),B.x>h&&(h=B.x)}for(n=n-$+10,o=t.RTL?o-h:o-c,c=0;c<e.length;c++)t.getBlockById(e[c]).moveBy(o,n,["create"])}return e},i.domToBlock$$module$build$src$core$xml=function(e,t){return e=Fo(e,t),t.rendered&&Ws(),e},Fo=function(e,t){i.disable$$module$build$src$core$events$utils();var o=t.getAllVariables();let n;try{if(n=_a(e,t),t.rendered){const c=n,h=n.getDescendants(!1);c.setConnectionTracking(!1);for(let $=h.length-1;0<=$;$--)h[$].initSvg();for(let $=h.length-1;0<=$;$--)h[$].queueRender();setTimeout(function(){c.disposed||c.setConnectionTracking(!0)},1),t.resizeContents()}else{const c=n.getDescendants(!1);for(let h=c.length-1;0<=h;h--)c[h].initModel()}}finally{i.enable$$module$build$src$core$events$utils()}if(J()){for(e=kn(t,o),t=0;t<e.length;t++)o=e[t],U(new(Y(M.VAR_CREATE))(o));U(new(Y(M.BLOCK_CREATE))(n))}return n},Wu=function(e,t){for(let n=0;n<e.children.length;n++){var o=e.children[n];const c=o.getAttribute("type"),h=o.getAttribute("id");if(o=o.textContent,!o)break;t.createVariable(o,c,h)}},If=function(e){const t={mutation:[],comment:[],data:[],field:[],input:[],next:[]};for(let o=0;o<e.children.length;o++){const n=e.children[o];if(n.nodeType!==Zs.TEXT_NODE)switch(n.nodeName.toLowerCase()){case"mutation":t.mutation.push(n);break;case"comment":t.comment.push(n);break;case"data":t.data.push(n);break;case"title":case"field":t.field.push(n);break;case"value":case"statement":t.input.push(n);break;case"next":t.next.push(n);break;default:console.warn("Ignoring unknown tag: "+n.nodeName)}}return t},xf=function(e,t){let o=!1;for(let n=0;n<e.length;n++){const c=e[n];t.domToMutation&&(t.domToMutation(c),t.initSvg&&(o=!0))}return o},Df=function(e,t){for(let n=0;n<e.length;n++){var o=e[n];const c=o.textContent,h=o.getAttribute("pinned")==="true";let $;const T=parseInt(($=o.getAttribute("w"))!=null?$:"50",10);let B;o=parseInt((B=o.getAttribute("h"))!=null?B:"50",10),t.setCommentText(c);const oe=t.getIcon($t.COMMENT);isNaN(T)||isNaN(o)||oe.setBubbleSize(new Le(T,o)),oe.setBubbleVisible(h),setTimeout(()=>oe.setBubbleVisible(h),1)}},Af=function(e,t){for(let o=0;o<e.length;o++)t.data=e[o].textContent},Rf=function(e,t){for(let o=0;o<e.length;o++){const n=e[o],c=n.getAttribute("name");c?Nf(t,c,n):console.warn(`Ignoring unnamed field in block ${t.type}`)}},Vu=function(e){let t=null,o=null;for(let n=0;n<e.childNodes.length;n++){const c=e.childNodes[n];Gu(c)&&(c.nodeName.toLowerCase()==="block"?t=c:c.nodeName.toLowerCase()==="shadow"&&(o=c))}return{childBlockElement:t,childShadowElement:o}},Of=function(e,t,o,n){for(let h=0;h<e.length;h++){var c=e[h];const $=c.getAttribute("name"),T=$?o.getInput($):null;if(!T){console.warn("Ignoring non-existent input "+$+" in block "+n);break}if(c=Vu(c),c.childBlockElement){if(!T.connection)throw TypeError("Input connection does not exist.");_a(c.childBlockElement,t,T.connection,!1)}if(c.childShadowElement){let B;(B=T.connection)==null||B.setShadowDom(c.childShadowElement)}}},Mf=function(e,t,o){for(let n=0;n<e.length;n++){const c=Vu(e[n]);if(c.childBlockElement){if(!o.nextConnection)throw TypeError("Next statement does not exist.");if(o.nextConnection.isConnected())throw TypeError("Next statement is already connected.");_a(c.childBlockElement,t,o.nextConnection,!0)}c.childShadowElement&&o.nextConnection&&o.nextConnection.setShadowDom(c.childShadowElement)}},_a=function(e,t,o,n){var c;const h=e.getAttribute("type");if(!h)throw TypeError("Block type unspecified: "+e.outerHTML);var $=(c=e.getAttribute("id"))!=null?c:void 0;c=t.newBlock(h,$),$=If(e);const T=xf($.mutation,c);if(Df($.comment,c),Af($.data,c),o)if(n)if(c.previousConnection)o.connect(c.previousConnection);else throw TypeError("Next block does not have previous statement.");else if(c.outputConnection)o.connect(c.outputConnection);else if(c.previousConnection)o.connect(c.previousConnection);else throw TypeError("Child block does not have output or previous statement.");if(Rf($.field,c),Of($.input,t,c,h),Mf($.next,t,c),T&&c.initSvg(),(t=e.getAttribute("inline"))&&c.setInputsInline(t==="true"),(t=e.getAttribute("disabled"))&&c.setDisabledReason(t==="true"||t==="disabled",Lt),t=e.getAttribute("disabled-reasons"),t!==null)for(var B of t.split(","))c.setDisabledReason(!0,decodeURIComponent(B));if((B=e.getAttribute("deletable"))&&c.setDeletable(B==="true"),(B=e.getAttribute("movable"))&&c.setMovable(B==="true"),(B=e.getAttribute("editable"))&&c.setEditable(B==="true"),(B=e.getAttribute("collapsed"))&&c.setCollapsed(B==="true"),e.nodeName.toLowerCase()==="shadow"){for(e=c.getChildren(!1),B=0;B<e.length;B++)if(!e[B].isShadow())throw TypeError("Shadow block not allowed non-shadow child.");c.setShadow(!0)}return c},Nf=function(e,t,o){const n=e.getField(t);n?n.fromXml(o):console.warn("Ignoring non-existent field "+t+" in block "+e.type)},Lf=function(e){for(let t=0;t<e.childNodes.length;t++){const o=e.childNodes[t];if(o.nodeName.toLowerCase()==="next"){e.removeChild(o);break}}},Gu=function(e){return e.nodeType===Zs.ELEMENT_NODE},wa=function(e){if(!(100<e.getDescendants(!1).length)){var t=e.workspace,o=e.getSvgRoot();t.getAudioManager().play("delete");var n=e.getRelativeToSurfaceXY(),c=o.cloneNode(!0);c.setAttribute("transform","translate("+n.x+","+n.y+")");var h;(h=t.getLayerManager())==null||h.appendToAnimationLayer({getSvgRoot:()=>c}),Ku(c,{x:n.x,y:n.y,width:e.width,height:e.height},t.RTL,new Date)}},Ku=function(e,t,o,n){const c=(new Date().getTime()-n.getTime())/150;1<c?Ge(e):(e.setAttribute("transform","translate("+(t.x+(o?-1:1)*t.width/2*c)+","+(t.y+t.height/2*c)+") scale("+(1-c)+")"),setTimeout(Ku,10,e,t,o,n))},Ca=function(e){var t=e.workspace;const o=t.scale;if(t.getAudioManager().play("click"),!(1>o)){var n=t.getSvgXY(e.getSvgRoot());e.outputConnection?(n.x+=(e.RTL?3:-3)*o,n.y+=13*o):e.previousConnection&&(n.x+=(e.RTL?-23:23)*o,n.y+=3*o);var c=L(D.CIRCLE,{cx:n.x,cy:n.y,r:0,fill:"none",stroke:"#888","stroke-width":10},t.getParentSvg());e=L(D.ANIMATE,{id:"animationCircle",begin:"indefinite",attributeName:"r",dur:"150ms",from:0,to:25*o},c),t=L(D.ANIMATE,{id:"animationOpacity",begin:"indefinite",attributeName:"opacity",dur:"150ms",from:1,to:0},c),e.beginElement(),t.beginElement(),setTimeout(()=>void Ge(c),150)}},Yu=function(e){if(ki(),e.workspace.getAudioManager().play("disconnect"),!(1>e.workspace.scale)){var t=e.getHeightWidth().height;t=Math.atan(10/t)/Math.PI*180,e.RTL||(t*=-1),tr=e,Ju(e,t,new Date,0)}},Ju=function(e,t,o,n){const c=[.66,1,.66,0,-.66,-1,-.66,0];let h="";o.getTime()+200>new Date().getTime()&&(h=`skewX(${Math.round(c[n%c.length]*t)})`,al=setTimeout(Ju,15,e,t,o,n+1)),e.getSvgRoot().setAttribute("transform",`${e.getTranslation()} ${h}`)},ki=function(){tr&&(al&&(clearTimeout(al),al=null),tr.getSvgRoot().setAttribute("transform",tr.getTranslation()),tr=null)},jo=function(e){return e.getRelativeToSurfaceXY!==void 0&&e.isMovable!==void 0&&e.startDrag!==void 0&&e.drag!==void 0&&e.endDrag!==void 0&&e.revertDrag!==void 0},Ks=function(e,t){for(const o in t)e[o]=t[o]!==null&&typeof t[o]=="object"?Ks(e[o]||Object.create(null),t[o]):t[o];return e},Is=function(e,t){r(z.FIELD,e,t)},Bf=function(e){u(z.FIELD,e)},i.fromJson$$module$build$src$core$field_registry=function(e){return Nb.fromJsonInternal(e)},Pf=function(e){const t=f(z.FIELD,e.type);return t?t.fromJson(e):(console.warn("Blockly could not create a field of type "+e.type+". The field is probably not being registered. This could be because the file is not loaded, the field does not register itself (Issue #1584), or the registration is not being reached."),null)},i.register$$module$build$src$core$extensions=function(e,t){if(typeof e!="string"||e.trim()==="")throw Error('Error: Invalid extension name "'+e+'"');if(Ui[e])throw Error('Error: Extension "'+e+'" is already registered.');if(typeof t!="function")throw Error('Error: Extension "'+e+'" must be a function');Ui[e]=t},i.registerMixin$$module$build$src$core$extensions=function(e,t){if(!t||typeof t!="object")throw Error('Error: Mixin "'+e+'" must be a object');i.register$$module$build$src$core$extensions(e,function(){this.mixin(t)})},i.registerMutator$$module$build$src$core$extensions=function(e,t,o,n){const c='Error when registering mutator "'+e+'": ';Zu(c,t);const h=qu(t,c);if(o&&typeof o!="function")throw Error(c+'Extension "'+e+'" is not a function');i.register$$module$build$src$core$extensions(e,function(){h&&this.setMutator(new i.MutatorIcon$$module$build$src$core$icons$mutator_icon(n||[],this)),this.mixin(t),o&&o.apply(this)})},Ff=function(e){Xu(e)?delete Ui[e]:console.warn('No extension mapping for name "'+e+'" found to unregister')},Xu=function(e){return!!Ui[e]},Ta=function(e,t,o){const n=Ui[e];if(typeof n!="function")throw Error('Error: Extension "'+e+'" not found.');let c;if(o?jf(e,t):c=Sa(t),n.apply(t),o)Zu('Error after applying mutator "'+e+'": ',t);else if(!Hf(c,t))throw Error('Error when applying extension "'+e+'": mutation properties changed when applying a non-mutator extension.')},jf=function(e,t){if(Sa(t).length)throw Error('Error: tried to apply mutation "'+e+'" to a block that already has mutator functions. Block id: '+t.id)},zf=function(e,t){return ka(e.mutationToDom,e.domToMutation,t+" mutationToDom/domToMutation")},Uf=function(e,t){return ka(e.saveExtraState,e.loadExtraState,t+" saveExtraState/loadExtraState")},qu=function(e,t){return ka(e.compose,e.decompose,t+" compose/decompose")},ka=function(e,t,o){if(e&&t){if(typeof e!="function"||typeof t!="function")throw Error(o+" must be a function");return!0}if(!e&&!t)return!1;throw Error(o+"Must have both or neither functions")},Zu=function(e,t){const o=zf(t,e),n=Uf(t,e);if(!o&&!n)throw Error(e+"Mutations must contain either XML hooks, or JSON hooks, or both");qu(t,e)},Sa=function(e){const t=[];return e.domToMutation!==void 0&&t.push(e.domToMutation),e.mutationToDom!==void 0&&t.push(e.mutationToDom),e.saveExtraState!==void 0&&t.push(e.saveExtraState),e.loadExtraState!==void 0&&t.push(e.loadExtraState),e.compose!==void 0&&t.push(e.compose),e.decompose!==void 0&&t.push(e.decompose),t},Hf=function(e,t){if(t=Sa(t),t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(e[o]!==t[o])return!1;return!0},Wf=function(e){if(typeof document!="object")throw Error("runAfterPageLoad() requires browser document.");if(document.readyState==="complete")e();else{const t=setInterval(function(){document.readyState==="complete"&&(clearInterval(t),e())},10)}},i.buildTooltipForDropdown$$module$build$src$core$extensions=function(e,t){const o=[];return function(){o.includes(this.type)||(Vf(this,e,t),o.push(this.type)),this.setTooltip(function(){const n=String(this.getFieldValue(e));return ht(t[n])}.bind(this))}},Vf=function(e,t,o){var n=e.getField(t);if(n instanceof Ht&&!n.isOptionListDynamic()){n=n.getOptions();for(const[,c]of n)o[c]===void 0&&console.warn(`No tooltip mapping for value ${c} of field ${t} of block type ${e.type}.`)}},i.buildTooltipWithFieldText$$module$build$src$core$extensions=function(e,t){return function(){this.setTooltip(function(){const o=this.getField(t);return ht(e).replace("%1",o?o.getText():"")}.bind(this))}},Gf=function(){const e=this.tooltip;this.setTooltip(function(){const t=this.getParent();return t&&t.getInputsInline()&&t.tooltip||e}.bind(this))},he=function(e,t){return" "+e+","+t+" "},zt=function(e,t){return" "+e+t.join("")},vt=function(e,t){return" M "+e+","+t+" "},rt=function(e,t){return" m "+e+","+t+" "},xs=function(e,t){return" l "+e+","+t+" "},Si=function(e){return" l"+e.join("")},ae=function(e,t){return" "+e+" "+t+" "},pt=function(e,t,o,n){return e+" "+o+" "+o+" "+t+n},Qu=function(e,t){r(z.ICON,e.toString(),t)},Kf=function(e){u(z.ICON,e)},po=function(e){return e.getProcedureModel!==void 0&&e.doProcedureUpdate!==void 0&&e.isProcedureDef!==void 0},Ea=function(e){return e.startPublishing!==void 0&&e.stopPublishing!==void 0},Ia=function(e){const t=e.getProcedureMap().getProcedures().filter(n=>!n.getReturnTypes()).map(n=>[n.getName(),n.getParameters().map(c=>c.getName()),!1]);e.getBlocksByType("procedures_defnoreturn",!1).forEach(n=>{!po(n)&&fi(n)&&t.push(n.getProcedureDef())});const o=e.getProcedureMap().getProcedures().filter(n=>!!n.getReturnTypes()).map(n=>[n.getName(),n.getParameters().map(c=>c.getName()),!0]);return e.getBlocksByType("procedures_defreturn",!1).forEach(n=>{!po(n)&&fi(n)&&o.push(n.getProcedureDef())}),t.sort(ed),o.sort(ed),[t,o]},ed=function(e,t){return e[0].localeCompare(t[0],void 0,{sensitivity:"base"})},i.findLegalName$$module$build$src$core$procedures=function(e,t){if(t.isInFlyout)return e;for(e=e||i.Msg$$module$build$src$core$msg.UNNAMED_KEY||"unnamed";!Yf(e,t.workspace,t);){const o=e.match(/^(.*?)(\d+)$/);e=o?o[1]+(parseInt(o[2])+1):e+"2"}return e},Yf=function(e,t,o){return!td(e,t,o)},td=function(e,t,o){for(const n of t.getAllBlocks(!1))if(n!==o&&fi(n)&&i.Names$$module$build$src$core$names.equals(n.getProcedureDef()[0],e))return!0;o=o&&po(o)?o==null?void 0:o.getProcedureModel():void 0;for(const n of t.getProcedureMap().getProcedures())if(n!==o&&i.Names$$module$build$src$core$names.equals(n.getName(),e))return!0;return!1},i.rename$$module$build$src$core$procedures=function(e){var t=this.getSourceBlock();if(!t)throw new mt;e=e.trim();const o=i.findLegalName$$module$build$src$core$procedures(e,t);po(t)&&!t.isInsertionMarker()&&t.getProcedureModel().setName(o);const n=this.getValue();if(n!==e&&n!==o)for(e=t.workspace.getAllBlocks(!1),t=0;t<e.length;t++){const c=e[t];c.renameProcedure&&c.renameProcedure(n,o)}return o},xa=function(e){function t(h,$){for(let B=0;B<h.length;B++){var T=h[B][0];const oe=h[B][1],it=i.createElement$$module$build$src$core$utils$xml("block");it.setAttribute("type",$),it.setAttribute("gap","16");const ot=i.createElement$$module$build$src$core$utils$xml("mutation");for(ot.setAttribute("name",T),it.appendChild(ot),T=0;T<oe.length;T++){const Wt=i.createElement$$module$build$src$core$utils$xml("arg");Wt.setAttribute("name",oe[T]),ot.appendChild(Wt)}o.push(it)}}const o=[];if(Ut.procedures_defnoreturn){var n=i.createElement$$module$build$src$core$utils$xml("block");n.setAttribute("type","procedures_defnoreturn"),n.setAttribute("gap","16");var c=i.createElement$$module$build$src$core$utils$xml("field");c.setAttribute("name","NAME"),c.appendChild(i.createTextNode$$module$build$src$core$utils$xml(i.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_PROCEDURE)),n.appendChild(c),o.push(n)}return Ut.procedures_defreturn&&(n=i.createElement$$module$build$src$core$utils$xml("block"),n.setAttribute("type","procedures_defreturn"),n.setAttribute("gap","16"),c=i.createElement$$module$build$src$core$utils$xml("field"),c.setAttribute("name","NAME"),c.appendChild(i.createTextNode$$module$build$src$core$utils$xml(i.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_PROCEDURE)),n.appendChild(c),o.push(n)),Ut.procedures_ifreturn&&(n=i.createElement$$module$build$src$core$utils$xml("block"),n.setAttribute("type","procedures_ifreturn"),n.setAttribute("gap","16"),o.push(n)),o.length&&o[o.length-1].setAttribute("gap","24"),e=Ia(e),t(e[0],"procedures_callnoreturn"),t(e[1],"procedures_callreturn"),o},sd=function(e){var t=[],o=e.getBlocksByType("procedures_mutatorarg",!1);for(let h=0,$;$=o[h];h++)t.push($.getFieldValue("NAME"));o=i.createElement$$module$build$src$core$utils$xml("xml");const n=i.createElement$$module$build$src$core$utils$xml("block");n.setAttribute("type","procedures_mutatorarg");const c=i.createElement$$module$build$src$core$utils$xml("field");c.setAttribute("name","NAME"),t=aa(i.DEFAULT_ARG$$module$build$src$core$procedures,t),t=i.createTextNode$$module$build$src$core$utils$xml(t),c.appendChild(t),n.appendChild(c),o.appendChild(n),e.updateToolbox(o)},od=function(e){if(re(e)&&e.bubbleType==="mutator"&&e.isOpen&&e.blockId){e=Z(e.workspaceId).getBlockById(e.blockId);var t=e.type;(t==="procedures_defnoreturn"||t==="procedures_defreturn")&&(e=e.getIcon(i.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE).getWorkspace(),sd(e),e.addChangeListener(Jf))}},Jf=function(e){(C(e)||I(e)||O(e)||A(e))&&(e=Z(e.workspaceId),sd(e))},id=function(e,t){return t.getAllBlocks(!1).filter(o=>Xf(o,e)||km(o)&&i.Names$$module$build$src$core$names.equals(o.getProcedureCall(),e))},Xf=function(e,t){return po(e)&&!e.isProcedureDef()&&e.getProcedureModel()&&i.Names$$module$build$src$core$names.equals(e.getProcedureModel().getName(),t)},i.mutateCallers$$module$build$src$core$procedures=function(e){const t=$e();var o=e.getProcedureDef()[0];const n=e.mutationToDom(!0);e=id(o,e.workspace);for(let h=0,$;$=e[h];h++){o=(o=$.mutationToDom())&&gi(o),$.domToMutation&&$.domToMutation(n);var c=$.mutationToDom();c=c&&gi(c),o!==c&&(i.setRecordUndo$$module$build$src$core$events$utils(!1),U(new(Y(M.BLOCK_CHANGE))($,"mutation",null,o,c)),i.setRecordUndo$$module$build$src$core$events$utils(t))}},i.getDefinition$$module$build$src$core$procedures=function(e,t){for(const o of t.getAllBlocks(!1))if(po(o)&&o.isProcedureDef()&&i.Names$$module$build$src$core$names.equals(o.getProcedureModel().getName(),e)||fi(o)&&i.Names$$module$build$src$core$names.equals(o.getProcedureDef()[0],e))return o;return null},Da=function(e){return e.isDynamic},qf=function(e){return e.pathDown!==void 0&&e.pathUp!==void 0},Zf=function(e){return e.pathLeft!==void 0&&e.pathRight!==void 0},Qf=function(e,t){if(!e||!t)throw Error("Cannot connect null connections.");e.targetConnection=t,t.targetConnection=e},e$=function(e,t){let o=null;t=t.outputConnection;const n=t==null?void 0:t.getConnectionChecker();for(let c=0,h;h=e.inputList[c];c++){const $=h.connection;let T;if($&&((T=n)!=null&&T.canConnect(t,$,!1))){if(o)return null;o=$}}return o},t$=function(e,t){let o;for(;o=e$(e,t);)if(e=o.targetBlock(),!e||e.isShadow())return o;return null},nd=function(e){return e.getType!==void 0&&e.initView!==void 0&&e.dispose!==void 0&&e.getWeight!==void 0&&e.getSize!==void 0&&e.applyColour!==void 0&&e.hideForInsertionMarker!==void 0&&e.updateEditable!==void 0&&e.updateCollapsed!==void 0&&e.isShownWhenCollapsed!==void 0&&e.setOffsetInBlock!==void 0&&e.onLocationChange!==void 0&&e.onClick!==void 0},s$=function(e){return nd(e)&&vi(e)&&Cn(e)&&e.setText!==void 0&&e.getText!==void 0&&e.setBubbleSize!==void 0&&e.getBubbleSize!==void 0&&e.getType()===$t.COMMENT},Nn=function(e){let t=e.outputConnection;return(!t||e.previousConnection&&e.previousConnection.isConnected())&&(t=e.previousConnection),t},Ln=function(e,t){r(z.RENDERER,e,t)},o$=function(e){u(z.RENDERER,e)},rd=function(e,t,o){return e=new(m(z.RENDERER,e))(e),e.init(t,o),e},ad=function(e){$i(e.getTargetWorkspace(),void 0,"String")},ld=function(e){$i(e.getTargetWorkspace(),void 0,"Number")},cd=function(e){$i(e.getTargetWorkspace(),void 0,"Colour")},Aa=function(e){let t=[],o=document.createElement("button");return o.setAttribute("text",i.Msg$$module$build$src$core$msg.NEW_STRING_VARIABLE),o.setAttribute("callbackKey","CREATE_VARIABLE_STRING"),t.push(o),o=document.createElement("button"),o.setAttribute("text",i.Msg$$module$build$src$core$msg.NEW_NUMBER_VARIABLE),o.setAttribute("callbackKey","CREATE_VARIABLE_NUMBER"),t.push(o),o=document.createElement("button"),o.setAttribute("text",i.Msg$$module$build$src$core$msg.NEW_COLOUR_VARIABLE),o.setAttribute("callbackKey","CREATE_VARIABLE_COLOUR"),t.push(o),e.registerButtonCallback("CREATE_VARIABLE_STRING",ad),e.registerButtonCallback("CREATE_VARIABLE_NUMBER",ld),e.registerButtonCallback("CREATE_VARIABLE_COLOUR",cd),e=ud(e),t=t.concat(e)},ud=function(e){e=e.getAllVariables();const t=[];if(0<e.length){if(Ut.variables_set_dynamic){var o=e[e.length-1];const n=i.createElement$$module$build$src$core$utils$xml("block");n.setAttribute("type","variables_set_dynamic"),n.setAttribute("gap","24"),n.appendChild(Mo(o)),t.push(n)}if(Ut.variables_get_dynamic){e.sort(Yn.compareByName);for(let n=0,c;c=e[n];n++)o=i.createElement$$module$build$src$core$utils$xml("block"),o.setAttribute("type","variables_get_dynamic"),o.setAttribute("gap","8"),o.appendChild(Mo(c)),t.push(o)}}return t},i$=function(e,t){const o=e.workspace,n=i.config$$module$build$src$core$config.snapRadius,c=K.difference(t,e.getRelativeToSurfaceXY()),h=new K(0,0),$=o.getAllBlocks(!1).filter(T=>T.id!=e.id).map(T=>T.getRelativeToSurfaceXY());for(;n$(K.sum(t,h),$)||r$(e,K.sum(c,h),n);)o.RTL?h.translate(-n,2*n):h.translate(n,2*n);e.moveTo(K.sum(t,h))},n$=function(e,t){return t.some(o=>1>=Math.abs(o.x-e.x)&&1>=Math.abs(o.y-e.y))},r$=function(e,t,o){return e.getConnections_(!1).some(n=>!!n.closest(o,t).connection)},Ei=function(e,t,o){const n=o.getBoundingRectangle(),c=n.right-n.left,h=yi(t.top,n.top,t.top+t.height-(n.bottom-n.top))-n.top;let $=t.left;return t=t.left+t.width-c,e.RTL?$=Math.min(t,$):t=Math.max($,t),(e=yi($,n.left,t)-n.left)||h?(o.moveBy(e,h,["inbounds"]),!0):!1},dd=function(e){return t=>{var o=e.getMetricsManager();if(o.hasFixedEdges()&&!e.isDragging()){var n;if(E$.includes((n=t.type)!=null?n:"")){n=o.getScrollMetrics(!0);const c=a$(e,t);c&&(o=i.getGroup$$module$build$src$core$events$utils()||!1,i.setGroup$$module$build$src$core$events$utils(t.group),Ei(e,n,c)&&!t.group&&console.warn("Moved object in bounds but there was no event group. This may break undo."),i.setGroup$$module$build$src$core$events$utils(o))}else ie(t)&&t.scale&&t.oldScale&&t.scale>t.oldScale&&Ra(e)}}},a$=function(e,t){let o=null;switch(t.type){case M.BLOCK_CREATE:case M.BLOCK_MOVE:(o=e.getBlockById(t.blockId))&&(o=o.getRootBlock());break;case M.COMMENT_CREATE:case M.COMMENT_MOVE:case M.COMMENT_RESIZE:o=e.getCommentById(t.commentId)}return o},Ra=function(e){var t=e.getMetricsManager();if(t.hasFixedEdges()&&!e.isDragging()){t=t.getScrollMetrics(!0);var o=e.getTopBoundedElements();for(let n=0,c;c=o[n];n++)Ei(e,t,c)}},Qt=function(e){return e.isDeletable!==void 0&&e.dispose!==void 0&&e.setDeleteStyle!==void 0},l$=function(e){const t=e.toCopyData();Qh=t;let o;return ep=(o=e.workspace)!=null?o:null,t},go=function(e,t,o){return e&&t?hd(e,t,o):Qh&&ep?hd(Qh,ep):null},hd=function(e,t,o){let n;t=t.isMutator?t:(n=t.getRootWorkspace())!=null?n:t;let c,h;return(h=(c=f(z.PASTER,e.paster,!1))==null?void 0:c.paste(e,t,o))!=null?h:null},c$=function(e){const t=e.toCopyData();return t?go(t,e.workspace):null},Bn=function(e){return e.toCopyData!==void 0},pd=function(){He.registry.register({name:Ms.ESCAPE,preconditionFn(e){return!e.options.readOnly},callback(e){return e.hideChaff(),!0},keyCodes:[Re.ESC]})},gd=function(){He.registry.register({name:Ms.DELETE,preconditionFn(e){const t=x();return!e.options.readOnly&&t!=null&&Qt(t)&&t.isDeletable()&&!eo.inProgress()},callback(e,t){return t.preventDefault(),e=x(),e instanceof ns?e.checkAndDelete():Qt(e)&&e.isDeletable()&&(i.setGroup$$module$build$src$core$events$utils(!0),e.dispose(),i.setGroup$$module$build$src$core$events$utils(!1)),!0},keyCodes:[Re.DELETE,Re.BACKSPACE]})},md=function(){const e=He.registry.createSerializedKey(Re.C,[Re.CTRL]),t=He.registry.createSerializedKey(Re.C,[Re.ALT]),o=He.registry.createSerializedKey(Re.C,[Re.META]);He.registry.register({name:Ms.COPY,preconditionFn(n){const c=x();return!n.options.readOnly&&!eo.inProgress()&&c!=null&&Qt(c)&&c.isDeletable()&&jo(c)&&c.isMovable()&&Bn(c)},callback(n,c){return c.preventDefault(),n.hideChaff(),c=x(),!c||!Bn(c)?!1:(To=c.toCopyData(),ko=c.workspace instanceof Zt?c.workspace:n,Yi=jo(c)?c.getRelativeToSurfaceXY():null,!!To)},keyCodes:[e,t,o]})},fd=function(){const e=He.registry.createSerializedKey(Re.X,[Re.CTRL]),t=He.registry.createSerializedKey(Re.X,[Re.ALT]),o=He.registry.createSerializedKey(Re.X,[Re.META]);He.registry.register({name:Ms.CUT,preconditionFn(n){const c=x();return!n.options.readOnly&&!eo.inProgress()&&c!=null&&Qt(c)&&c.isDeletable()&&jo(c)&&c.isMovable()&&!c.workspace.isFlyout},callback(n){const c=x();return c instanceof ns?(To=c.toCopyData(),ko=n,Yi=c.getRelativeToSurfaceXY(),c.checkAndDelete(),!0):Qt(c)&&c.isDeletable()&&Bn(c)?(To=c.toCopyData(),ko=n,Yi=jo(c)?c.getRelativeToSurfaceXY():null,c.dispose(),!0):!1},keyCodes:[e,t,o]})},$d=function(){const e=He.registry.createSerializedKey(Re.V,[Re.CTRL]),t=He.registry.createSerializedKey(Re.V,[Re.ALT]),o=He.registry.createSerializedKey(Re.V,[Re.META]);He.registry.register({name:Ms.PASTE,preconditionFn(n){return!n.options.readOnly&&!eo.inProgress()},callback(){if(!To||!ko)return!1;if(!Yi)return!!go(To,ko);const{left:n,top:c,width:h,height:$}=ko.getMetricsManager().getViewMetrics(!0);if(new Je(c,c+$,n,n+h).contains(Yi.x,Yi.y))return!!go(To,ko);const T=new K(n+h/2,c+$/2);return!!go(To,ko,T)},keyCodes:[e,t,o]})},bd=function(){const e=He.registry.createSerializedKey(Re.Z,[Re.CTRL]),t=He.registry.createSerializedKey(Re.Z,[Re.ALT]),o=He.registry.createSerializedKey(Re.Z,[Re.META]);He.registry.register({name:Ms.UNDO,preconditionFn(n){return!n.options.readOnly&&!eo.inProgress()},callback(n,c){return n.hideChaff(),n.undo(!1),c.preventDefault(),!0},keyCodes:[e,t,o]})},vd=function(){const e=He.registry.createSerializedKey(Re.Z,[Re.SHIFT,Re.CTRL]),t=He.registry.createSerializedKey(Re.Z,[Re.SHIFT,Re.ALT]),o=He.registry.createSerializedKey(Re.Z,[Re.SHIFT,Re.META]),n=He.registry.createSerializedKey(Re.Y,[Re.CTRL]);He.registry.register({name:Ms.REDO,preconditionFn(c){return!eo.inProgress()&&!c.options.readOnly},callback(c,h){return c.hideChaff(),c.undo(!0),h.preventDefault(),!0},keyCodes:[e,t,o,n]})},yd=function(){pd(),gd(),md(),fd(),$d(),bd(),vd()},_d=function(e){const t=e.saveState();return e.getParameters().length&&(t.parameters=e.getParameters().map(o=>o.saveState())),t},wd=function(e,t,o,n){if(e=e.loadState(o,n),!o.parameters)return e;for(const[c,h]of o.parameters.entries())e.insertParameter(t.loadState(h,n),c);return e},u$=function(e){const t=Object.create(null),o=v(z.SERIALIZER,!0);for(const n in o){let c;const h=(c=o[n])==null?void 0:c.save(e);h&&(t[n]=h)}return t},d$=function(e,t,{recordUndo:o=!1}={}){var n=v(z.SERIALIZER,!0);if(n){n=Object.entries(n).sort((h,$)=>$[1].priority-h[1].priority);var c=$e();i.setRecordUndo$$module$build$src$core$events$utils(o),(o=i.getGroup$$module$build$src$core$events$utils())||i.setGroup$$module$build$src$core$events$utils(!0),Ro(),t instanceof Zt&&t.setResizesEnabled(!1);for(const[,h]of n.reverse()){let $;($=h)==null||$.clear(t)}for(const[h,$]of n.reverse())if(e[h]){let T;(T=$)==null||T.load(e[h],t)}t instanceof Zt&&t.setResizesEnabled(!0),Oo(),U(new(Y(M.FINISHED_LOADING))(t)),i.setGroup$$module$build$src$core$events$utils(o),i.setRecordUndo$$module$build$src$core$events$utils(c)}},h$=function(e,t){let o=null;o=typeof e=="string"?document.getElementById(e)||document.querySelector(e):e;var n;if(!document.contains(o)&&document!==((n=o)==null?void 0:n.ownerDocument))throw Error("Error: container is not in current document");e=new ss(t||{}),n=document.createElement("div"),fe(n,"injectionDiv"),t!=null&&t.rtl&&fe(n,"blocklyRTL"),n.tabIndex=0,kt(n,yt.LABEL,i.Msg$$module$build$src$core$msg.WORKSPACE_ARIA_LABEL),o.appendChild(n),t=p$(n,e);const c=g$(n,t,e);return m$(c),le(c),ke(c),n.addEventListener("focusin",function(){le(c)}),Q(n,"keydown",null,Oa),Q(Sn(),"keydown",null,Oa),(t=Bo())&&Q(t,"keydown",null,Oa),c},p$=function(e,t){e.setAttribute("dir","LTR"),Pc(t.hasCss,t.pathToMedia),e=L(D.SVG,{xmlns:Un,"xmlns:html":As,"xmlns:xlink":Kt,version:"1.1",class:"blocklySvg",tabindex:"0"},e);const o=L(D.DEFS,{},e),n=String(Math.random()).substring(2);return t.gridPattern=xh.createDom(n,t.gridOptions,o),e},g$=function(e,t,o){o.parentWorkspace=null,o=new Zt(o);const n=o.options;o.scale=n.zoomOptions.startScale,t.appendChild(o.createDom("blocklyMainBackground",e));var c=o.getRenderer().getClassName();return c&&fe(e,c),(c=o.getTheme().getClassName())&&fe(e,c),!n.hasCategories&&n.languageTree&&(e=o.addFlyout(D.SVG),Ao(e,t)),n.hasTrashcan&&o.addTrashcan(),n.zoomOptions&&n.zoomOptions.controls&&o.addZoomControls(),o.getThemeManager().subscribe(t,"workspaceBackgroundColour","background-color"),o.translate(0,0),o.addChangeListener(dd(o)),ke(o),Ou(),ru(),Tu(),o},m$=function(e){const t=e.options;var o=e.getParentSvg();if(Q(o.parentNode,"contextmenu",null,function(n){wt(n)||n.preventDefault()}),o=Q(window,"resize",null,function(){Gs(),e.hideComponents(!0),vu(),Bu(),ke(e),Ra(e)}),e.setResizeHandlerWrapper(o),f$(),t.languageTree){o=e.getToolbox();const n=e.getFlyout(!0);o?o.init():n&&(n.init(e),n.show(t.languageTree),typeof n.scrollToStart=="function"&&n.scrollToStart())}t.hasTrashcan&&e.trashcan.init(),t.zoomOptions&&t.zoomOptions.controls&&e.zoomControls_.init(),t.moveOptions&&t.moveOptions.scrollbars?(e.scrollbar=new sp(e,t.moveOptions.scrollbars===!0||!!t.moveOptions.scrollbars.horizontal,t.moveOptions.scrollbars===!0||!!t.moveOptions.scrollbars.vertical,"blocklyMainWorkspaceScrollbar"),e.scrollbar.resize()):e.setMetrics({x:.5,y:.5}),t.hasSounds&&$$(t.pathToMedia,e)},Oa=function(e){const t=W();t&&!(wt(e)||t.rendered&&!t.isVisible())&&He.registry.onKeyDown(t,e)},f$=function(){yv||(Q(document,"scroll",null,function(){const e=se();for(let t=0,o;o=e[t];t++)o instanceof Zt&&o.updateInverseScreenCTM()}),lt(document,"touchend",null,Ce),lt(document,"touchcancel",null,Ce)),yv=!0},$$=function(e,t){function o(){for(;c.length;){const h=c.pop();h&&ze(h)}n.preload()}const n=t.getAudioManager();n.load([e+"click.mp3",e+"click.wav",e+"click.ogg"],"click"),n.load([e+"disconnect.wav",e+"disconnect.mp3",e+"disconnect.ogg"],"disconnect"),n.load([e+"delete.mp3",e+"delete.ogg",e+"delete.wav"],"delete");const c=[];c.push(Q(document,"pointermove",null,o,!0)),c.push(Q(document,"touchstart",null,o,!0))},Cd=function(){Ae.registry.register({displayText(){return i.Msg$$module$build$src$core$msg.UNDO},preconditionFn(e){return 0<e.workspace.getUndoStack().length?"enabled":"disabled"},callback(e){e.workspace.undo(!1)},scopeType:Ae.ScopeType.WORKSPACE,id:"undoWorkspace",weight:1})},Td=function(){Ae.registry.register({displayText(){return i.Msg$$module$build$src$core$msg.REDO},preconditionFn(e){return 0<e.workspace.getRedoStack().length?"enabled":"disabled"},callback(e){e.workspace.undo(!0)},scopeType:Ae.ScopeType.WORKSPACE,id:"redoWorkspace",weight:2})},kd=function(){Ae.registry.register({displayText(){return i.Msg$$module$build$src$core$msg.CLEAN_UP},preconditionFn(e){return e.workspace.isMovable()?1<e.workspace.getTopBlocks(!1).length?"enabled":"disabled":"hidden"},callback(e){e.workspace.cleanUp()},scopeType:Ae.ScopeType.WORKSPACE,id:"cleanWorkspace",weight:3})},Sd=function(e,t){function o(h){c--,h.setCollapsed(e),c===0&&i.setGroup$$module$build$src$core$events$utils(!1)}let n=0,c=0;i.setGroup$$module$build$src$core$events$utils(!0);for(let h=0;h<t.length;h++){let $=t[h];for(;$;)c++,setTimeout(o.bind(null,$),n),$=$.getNextBlock(),n+=10}},Ed=function(){Ae.registry.register({displayText(){return i.Msg$$module$build$src$core$msg.COLLAPSE_ALL},preconditionFn(e){if(e.workspace.options.collapse){e=e.workspace.getTopBlocks(!1);for(let t=0;t<e.length;t++){let o=e[t];for(;o;){if(!o.isCollapsed())return"enabled";o=o.getNextBlock()}}return"disabled"}return"hidden"},callback(e){Sd(!0,e.workspace.getTopBlocks(!0))},scopeType:Ae.ScopeType.WORKSPACE,id:"collapseWorkspace",weight:4})},Id=function(){Ae.registry.register({displayText(){return i.Msg$$module$build$src$core$msg.EXPAND_ALL},preconditionFn(e){if(e.workspace.options.collapse){e=e.workspace.getTopBlocks(!1);for(let t=0;t<e.length;t++){let o=e[t];for(;o;){if(o.isCollapsed())return"enabled";o=o.getNextBlock()}}return"disabled"}return"hidden"},callback(e){Sd(!1,e.workspace.getTopBlocks(!0))},scopeType:Ae.ScopeType.WORKSPACE,id:"expandWorkspace",weight:5})},xd=function(e,t){if(e.isDeletable())Array.prototype.push.apply(t,e.getDescendants(!1));else{e=e.getChildren(!1);for(let o=0;o<e.length;o++)xd(e[o],t)}},Ma=function(e){const t=[];e=e.getTopBlocks(!0);for(let o=0;o<e.length;o++)xd(e[o],t);return t},Pn=function(e,t){t?i.setGroup$$module$build$src$core$events$utils(t):(i.setGroup$$module$build$src$core$events$utils(!0),t=i.getGroup$$module$build$src$core$events$utils());const o=e.shift();o&&(o.isDeadOrDying()?Pn(e,t):(o.dispose(!1,!0),setTimeout(Pn,10,e,t))),i.setGroup$$module$build$src$core$events$utils(!1)},Dd=function(){Ae.registry.register({displayText(e){return e.workspace?(e=Ma(e.workspace).length,e===1?i.Msg$$module$build$src$core$msg.DELETE_BLOCK:i.Msg$$module$build$src$core$msg.DELETE_X_BLOCKS.replace("%1",`${e}`)):""},preconditionFn(e){return e.workspace&&0<Ma(e.workspace).length?"enabled":"disabled"},callback(e){if(e.workspace){e.workspace.cancelCurrentGesture();var t=Ma(e.workspace);2>t.length?Pn(t):ia(i.Msg$$module$build$src$core$msg.DELETE_ALL_BLOCKS.replace("%1",String(t.length)),function(o){o&&Pn(t)})}},scopeType:Ae.ScopeType.WORKSPACE,id:"workspaceDelete",weight:6})},b$=function(){Cd(),Td(),kd(),Ed(),Id(),Dd()},Ad=function(){Ae.registry.register({displayText(){return i.Msg$$module$build$src$core$msg.DUPLICATE_BLOCK},preconditionFn(e){return e=e.block,!e.isInFlyout&&e.isDeletable()&&e.isMovable()?e.isDuplicatable()?"enabled":"disabled":"hidden"},callback(e){if(e.block){var t=e.block.toCopyData();t&&go(t,e.block.workspace)}},scopeType:Ae.ScopeType.BLOCK,id:"blockDuplicate",weight:1})},Rd=function(){Ae.registry.register({displayText(e){return e.block.hasIcon(oo.TYPE)?i.Msg$$module$build$src$core$msg.REMOVE_COMMENT:i.Msg$$module$build$src$core$msg.ADD_COMMENT},preconditionFn(e){return e=e.block,!e.isInFlyout&&e.workspace.options.comments&&!e.isCollapsed()&&e.isEditable()?"enabled":"hidden"},callback(e){e=e.block,e.hasIcon(oo.TYPE)?e.setCommentText(null):e.setCommentText("")},scopeType:Ae.ScopeType.BLOCK,id:"blockComment",weight:2})},Od=function(){Ae.registry.register({displayText(e){return e.block.getInputsInline()?i.Msg$$module$build$src$core$msg.EXTERNAL_INPUTS:i.Msg$$module$build$src$core$msg.INLINE_INPUTS},preconditionFn(e){if(e=e.block,!e.isInFlyout&&e.isMovable()&&!e.isCollapsed()){for(let t=1;t<e.inputList.length;t++)if(!(e.inputList[t-1]instanceof Sl||e.inputList[t]instanceof Sl))return"enabled"}return"hidden"},callback(e){e.block.setInputsInline(!e.block.getInputsInline())},scopeType:Ae.ScopeType.BLOCK,id:"blockInline",weight:3})},Md=function(){Ae.registry.register({displayText(e){return e.block.isCollapsed()?i.Msg$$module$build$src$core$msg.EXPAND_BLOCK:i.Msg$$module$build$src$core$msg.COLLAPSE_BLOCK},preconditionFn(e){return e=e.block,!e.isInFlyout&&e.isMovable()&&e.workspace.options.collapse?"enabled":"hidden"},callback(e){e.block.setCollapsed(!e.block.isCollapsed())},scopeType:Ae.ScopeType.BLOCK,id:"blockCollapseExpand",weight:4})},Nd=function(){Ae.registry.register({displayText(e){return e.block.hasDisabledReason(Lt)?i.Msg$$module$build$src$core$msg.ENABLE_BLOCK:i.Msg$$module$build$src$core$msg.DISABLE_BLOCK},preconditionFn(e){if(e=e.block,!e.isInFlyout&&e.workspace.options.disable&&e.isEditable()){var t=e.getDisabledReasons();return t=t.size>(t.has(Lt)?1:0),e.getInheritedDisabled()||t?"disabled":"enabled"}return"hidden"},callback(e){e=e.block;const t=i.getGroup$$module$build$src$core$events$utils();t||i.setGroup$$module$build$src$core$events$utils(!0),e.setDisabledReason(!e.hasDisabledReason(Lt),Lt),i.setGroup$$module$build$src$core$events$utils(t)},scopeType:Ae.ScopeType.BLOCK,id:"blockDisable",weight:5})},Ld=function(){Ae.registry.register({displayText(e){var t=e.block;return e=t.getDescendants(!1).length,(t=t.getNextBlock())&&(e-=t.getDescendants(!1).length),e===1?i.Msg$$module$build$src$core$msg.DELETE_BLOCK:i.Msg$$module$build$src$core$msg.DELETE_X_BLOCKS.replace("%1",`${e}`)},preconditionFn(e){return!e.block.isInFlyout&&e.block.isDeletable()?"enabled":"hidden"},callback(e){e.block&&e.block.checkAndDelete()},scopeType:Ae.ScopeType.BLOCK,id:"blockDelete",weight:6})},Bd=function(){Ae.registry.register({displayText(){return i.Msg$$module$build$src$core$msg.HELP},preconditionFn(e){return e=e.block,(typeof e.helpUrl=="function"?e.helpUrl():e.helpUrl)?"enabled":"hidden"},callback(e){e.block.showHelp()},scopeType:Ae.ScopeType.BLOCK,id:"blockHelp",weight:7})},Pd=function(){Ae.registry.register({displayText:()=>i.Msg$$module$build$src$core$msg.REMOVE_COMMENT,preconditionFn(e){let t;return(t=e.comment)!=null&&t.isDeletable()?"enabled":"hidden"},callback(e){i.setGroup$$module$build$src$core$events$utils(!0);let t;(t=e.comment)==null||t.dispose(),i.setGroup$$module$build$src$core$events$utils(!1)},scopeType:Ae.ScopeType.COMMENT,id:"commentDelete",weight:6})},Fd=function(){Ae.registry.register({displayText:()=>i.Msg$$module$build$src$core$msg.DUPLICATE_COMMENT,preconditionFn(e){let t;return(t=e.comment)!=null&&t.isMovable()?"enabled":"hidden"},callback(e){if(e.comment){var t=e.comment.toCopyData();t&&go(t,e.comment.workspace)}},scopeType:Ae.ScopeType.COMMENT,id:"commentDuplicate",weight:1})},jd=function(){Ae.registry.register({displayText:()=>i.Msg$$module$build$src$core$msg.ADD_COMMENT,preconditionFn:e=>{let t;return(t=e.workspace)!=null&&t.isMutator?"hidden":"enabled"},callback:(e,t)=>{if(e=e.workspace){i.setGroup$$module$build$src$core$events$utils(!0);var o=new rl(e);o.setText(i.Msg$$module$build$src$core$msg.WORKSPACE_COMMENT_DEFAULT_TEXT),o.moveTo(v$(new K(t.clientX,t.clientY),e)),i.setSelected$$module$build$src$core$common(o),i.setGroup$$module$build$src$core$events$utils(!1)}},scopeType:Ae.ScopeType.WORKSPACE,id:"commentCreate",weight:8})},v$=function(e,t){var o=t.getInjectionDiv().getBoundingClientRect();return e=new K(e.x-o.left,e.y-o.top),o=t.getOriginOffsetInPixels(),e=K.difference(e,o),e.scale(1/t.scale),e},y$=function(){Ad(),Rd(),Od(),Md(),Nd(),Ld(),Bd()},_$=function(){Fd(),Pd(),jd()},zd=function(){b$(),y$()},w$=function(e){return e.paste!==void 0},C$=function(e){return e.getSvgRoot!==void 0},T$=function(e){return typeof e.id=="string"&&e.workspace!==void 0&&e.select!==void 0&&e.unselect!==void 0},k$=function(e){return e.isSelectable()},S$=function(e){W().hideChaff(e)},j=j||{},j.scope={},j.ASSUME_ES5=!1,j.ASSUME_NO_NATIVE_MAP=!1,j.ASSUME_NO_NATIVE_SET=!1,j.SIMPLE_FROUND_POLYFILL=!1,j.ISOLATE_POLYFILLS=!1,j.FORCE_POLYFILL_PROMISE=!1,j.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1,j.defineProperty=j.ASSUME_ES5||typeof Object.defineProperties=="function"?Object.defineProperty:function(e,t,o){return e==Array.prototype||e==Object.prototype||(e[t]=o.value),e},j.getGlobal=function(e){e=[typeof globalThis=="object"&&globalThis,e,typeof window=="object"&&window,typeof self=="object"&&self,typeof nn=="object"&&nn];for(var t=0;t<e.length;++t){var o=e[t];if(o&&o.Math==Math)return o}throw Error("Cannot find global object")},j.global=j.getGlobal(this),j.IS_SYMBOL_NATIVE=typeof Symbol=="function"&&typeof Symbol("x")=="symbol",j.TRUST_ES6_POLYFILLS=!j.ISOLATE_POLYFILLS||j.IS_SYMBOL_NATIVE,j.polyfills={},j.propertyToPolyfillSymbol={},j.POLYFILL_PREFIX="$jscp$",j.polyfill=function(e,t,o,n){t&&(j.ISOLATE_POLYFILLS?j.polyfillIsolated(e,t,o,n):j.polyfillUnisolated(e,t,o,n))},j.polyfillUnisolated=function(e,t,o,n){for(o=j.global,e=e.split("."),n=0;n<e.length-1;n++){var c=e[n];if(!(c in o))return;o=o[c]}e=e[e.length-1],n=o[e],t=t(n),t!=n&&t!=null&&j.defineProperty(o,e,{configurable:!0,writable:!0,value:t})},j.polyfillIsolated=function(e,t,o,n){var c=e.split(".");e=c.length===1,n=c[0],n=!e&&n in j.polyfills?j.polyfills:j.global;for(var h=0;h<c.length-1;h++){var $=c[h];if(!($ in n))return;n=n[$]}c=c[c.length-1],o=j.IS_SYMBOL_NATIVE&&o==="es6"?n[c]:null,t=t(o),t!=null&&(e?j.defineProperty(j.polyfills,c,{configurable:!0,writable:!0,value:t}):t!==o&&(j.propertyToPolyfillSymbol[c]===void 0&&(o=1e9*Math.random()>>>0,j.propertyToPolyfillSymbol[c]=j.IS_SYMBOL_NATIVE?j.global.Symbol(c):j.POLYFILL_PREFIX+o+"$"+c),j.defineProperty(n,j.propertyToPolyfillSymbol[c],{configurable:!0,writable:!0,value:t})))},j.underscoreProtoCanBeSet=function(){var e={a:!0},t={};try{return t.__proto__=e,t.a}catch{}return!1},j.setPrototypeOf=j.TRUST_ES6_POLYFILLS&&typeof Object.setPrototypeOf=="function"?Object.setPrototypeOf:j.underscoreProtoCanBeSet()?function(e,t){if(e.__proto__=t,e.__proto__!==t)throw new TypeError(e+" is not extensible");return e}:null,j.arrayIteratorImpl=function(e){var t=0;return function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}},j.arrayIterator=function(e){return{next:j.arrayIteratorImpl(e)}},j.makeIterator=function(e){var t=typeof Symbol<"u"&&Symbol.iterator&&e[Symbol.iterator];if(t)return t.call(e);if(typeof e.length=="number")return j.arrayIterator(e);throw Error(String(e)+" is not an iterable or ArrayLike")},j.generator={},j.generator.ensureIteratorResultIsObject_=function(e){if(!(e instanceof Object))throw new TypeError("Iterator result "+e+" is not an object")},j.generator.Context=function(){this.isRunning_=!1,this.yieldAllIterator_=null,this.yieldResult=void 0,this.nextAddress=1,this.finallyAddress_=this.catchAddress_=0,this.finallyContexts_=this.abruptCompletion_=null},j.generator.Context.prototype.start_=function(){if(this.isRunning_)throw new TypeError("Generator is already running");this.isRunning_=!0},j.generator.Context.prototype.stop_=function(){this.isRunning_=!1},j.generator.Context.prototype.jumpToErrorHandler_=function(){this.nextAddress=this.catchAddress_||this.finallyAddress_},j.generator.Context.prototype.next_=function(e){this.yieldResult=e},j.generator.Context.prototype.throw_=function(e){this.abruptCompletion_={exception:e,isException:!0},this.jumpToErrorHandler_()},j.generator.Context.prototype.return=function(e){this.abruptCompletion_={return:e},this.nextAddress=this.finallyAddress_},j.generator.Context.prototype.jumpThroughFinallyBlocks=function(e){this.abruptCompletion_={jumpTo:e},this.nextAddress=this.finallyAddress_},j.generator.Context.prototype.yield=function(e,t){return this.nextAddress=t,{value:e}},j.generator.Context.prototype.yieldAll=function(e,t){e=j.makeIterator(e);var o=e.next();if(j.generator.ensureIteratorResultIsObject_(o),o.done)this.yieldResult=o.value,this.nextAddress=t;else return this.yieldAllIterator_=e,this.yield(o.value,t)},j.generator.Context.prototype.jumpTo=function(e){this.nextAddress=e},j.generator.Context.prototype.jumpToEnd=function(){this.nextAddress=0},j.generator.Context.prototype.setCatchFinallyBlocks=function(e,t){this.catchAddress_=e,t!=null&&(this.finallyAddress_=t)},j.generator.Context.prototype.setFinallyBlock=function(e){this.catchAddress_=0,this.finallyAddress_=e||0},j.generator.Context.prototype.leaveTryBlock=function(e,t){this.nextAddress=e,this.catchAddress_=t||0},j.generator.Context.prototype.enterCatchBlock=function(e){return this.catchAddress_=e||0,e=this.abruptCompletion_.exception,this.abruptCompletion_=null,e},j.generator.Context.prototype.enterFinallyBlock=function(e,t,o){o?this.finallyContexts_[o]=this.abruptCompletion_:this.finallyContexts_=[this.abruptCompletion_],this.catchAddress_=e||0,this.finallyAddress_=t||0},j.generator.Context.prototype.leaveFinallyBlock=function(e,t){if(t=this.finallyContexts_.splice(t||0)[0],t=this.abruptCompletion_=this.abruptCompletion_||t){if(t.isException)return this.jumpToErrorHandler_();t.jumpTo!=null&&this.finallyAddress_<t.jumpTo?(this.nextAddress=t.jumpTo,this.abruptCompletion_=null):this.nextAddress=this.finallyAddress_}else this.nextAddress=e},j.generator.Context.prototype.forIn=function(e){return new j.generator.Context.PropertyIterator(e)},j.generator.Context.PropertyIterator=function(e){this.object_=e,this.properties_=[];for(var t in e)this.properties_.push(t);this.properties_.reverse()},j.generator.Context.PropertyIterator.prototype.getNext=function(){for(;0<this.properties_.length;){var e=this.properties_.pop();if(e in this.object_)return e}return null},j.generator.Engine_=function(e){this.context_=new j.generator.Context,this.program_=e},j.generator.Engine_.prototype.next_=function(e){return this.context_.start_(),this.context_.yieldAllIterator_?this.yieldAllStep_(this.context_.yieldAllIterator_.next,e,this.context_.next_):(this.context_.next_(e),this.nextStep_())},j.generator.Engine_.prototype.return_=function(e){this.context_.start_();var t=this.context_.yieldAllIterator_;return t?this.yieldAllStep_("return"in t?t.return:function(o){return{value:o,done:!0}},e,this.context_.return):(this.context_.return(e),this.nextStep_())},j.generator.Engine_.prototype.throw_=function(e){return this.context_.start_(),this.context_.yieldAllIterator_?this.yieldAllStep_(this.context_.yieldAllIterator_.throw,e,this.context_.next_):(this.context_.throw_(e),this.nextStep_())},j.generator.Engine_.prototype.yieldAllStep_=function(e,t,o){try{var n=e.call(this.context_.yieldAllIterator_,t);if(j.generator.ensureIteratorResultIsObject_(n),!n.done)return this.context_.stop_(),n;var c=n.value}catch(h){return this.context_.yieldAllIterator_=null,this.context_.throw_(h),this.nextStep_()}return this.context_.yieldAllIterator_=null,o.call(this.context_,c),this.nextStep_()},j.generator.Engine_.prototype.nextStep_=function(){for(;this.context_.nextAddress;)try{var e=this.program_(this.context_);if(e)return this.context_.stop_(),{value:e.value,done:!1}}catch(t){this.context_.yieldResult=void 0,this.context_.throw_(t)}if(this.context_.stop_(),this.context_.abruptCompletion_){if(e=this.context_.abruptCompletion_,this.context_.abruptCompletion_=null,e.isException)throw e.exception;return{value:e.return,done:!0}}return{value:void 0,done:!0}},j.generator.Generator_=function(e){this.next=function(t){return e.next_(t)},this.throw=function(t){return e.throw_(t)},this.return=function(t){return e.return_(t)},this[Symbol.iterator]=function(){return this}},j.generator.createGenerator=function(e,t){return t=new j.generator.Generator_(new j.generator.Engine_(t)),j.setPrototypeOf&&e.prototype&&j.setPrototypeOf(t,e.prototype),t},j.asyncExecutePromiseGenerator=function(e){function t(n){return e.next(n)}function o(n){return e.throw(n)}return new Promise(function(n,c){function h($){$.done?n($.value):Promise.resolve($.value).then(t,o).then(h,c)}h(e.next())})},j.asyncExecutePromiseGeneratorFunction=function(e){return j.asyncExecutePromiseGenerator(e())},j.asyncExecutePromiseGeneratorProgram=function(e){return j.asyncExecutePromiseGenerator(new j.generator.Generator_(new j.generator.Engine_(e)))},j.polyfill("globalThis",function(e){return e||j.global},"es_2020","es3"),j.polyfill("Array.prototype.includes",function(e){return e||function(t,o){var n=this;n instanceof String&&(n=String(n));var c=n.length;for(o=o||0,0>o&&(o=Math.max(o+c,0));o<c;o++){var h=n[o];if(h===t||Object.is(h,t))return!0}return!1}},"es7","es3"),j.initSymbol=function(){},j.iteratorPrototype=function(e){return e={next:e},e[Symbol.iterator]=function(){return this},e},j.iteratorFromArray=function(e,t){e instanceof String&&(e+="");var o=0,n=!1,c={next:function(){if(!n&&o<e.length){var h=o++;return{value:t(h,e[h]),done:!1}}return n=!0,{done:!0,value:void 0}}};return c[Symbol.iterator]=function(){return c},c},j.polyfill("Array.prototype.values",function(e){return e||function(){return j.iteratorFromArray(this,function(t,o){return o})}},"es8","es3"),j.polyfill("Array.prototype.flat",function(e){return e||function(t){t=t===void 0?1:t;var o=[];return Array.prototype.forEach.call(this,function(n){Array.isArray(n)&&0<t?(n=Array.prototype.flat.call(n,t-1),o.push.apply(o,n)):o.push(n)}),o}},"es9","es5"),j.polyfill("Array.prototype.flatMap",function(e){return e||function(t,o){var n=[];return Array.prototype.forEach.call(this,function(c,h){c=t.call(o,c,h,this),Array.isArray(c)?n.push.apply(n,c):n.push(c)}),n}},"es9","es5"),j.owns=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},j.polyfill("Object.entries",function(e){return e||function(t){var o=[],n;for(n in t)j.owns(t,n)&&o.push([n,t[n]]);return o}},"es8","es3"),j.polyfill("Object.values",function(e){return e||function(t){var o=[],n;for(n in t)j.owns(t,n)&&o.push(t[n]);return o}},"es8","es3");var mo=Object.create(null),PC={typeMap:mo},Na=Object.create(null),Ds="default",z=class{constructor(e){this.name=e}toString(){return this.name}};z.CONNECTION_CHECKER=new z("connectionChecker"),z.CONNECTION_PREVIEWER=new z("connectionPreviewer"),z.CURSOR=new z("cursor"),z.EVENT=new z("event"),z.FIELD=new z("field"),z.INPUT=new z("input"),z.RENDERER=new z("renderer"),z.TOOLBOX=new z("toolbox"),z.THEME=new z("theme"),z.TOOLBOX_ITEM=new z("toolboxItem"),z.FLYOUTS_VERTICAL_TOOLBOX=new z("flyoutsVerticalToolbox"),z.FLYOUTS_HORIZONTAL_TOOLBOX=new z("flyoutsHorizontalToolbox"),z.METRICS_MANAGER=new z("metricsManager"),z.BLOCK_DRAGGER=new z("blockDragger"),z.SERIALIZER=new z("serializer"),z.ICON=new z("icon"),z.PASTER=new z("paster");var Ys={DEFAULT:Ds,TEST_ONLY:PC};Ys.Type=z,Ys.getAllItems=v,Ys.getClass=m,Ys.getClassFromOptions=w,Ys.getObject=f,Ys.hasItem=p,Ys.register=r,Ys.unregister=u;var Ut=Object.create(null),M;(function(e){e.BLOCK_CREATE="create",e.BLOCK_DELETE="delete",e.BLOCK_CHANGE="change",e.BLOCK_FIELD_INTERMEDIATE_CHANGE="block_field_intermediate_change",e.BLOCK_MOVE="move",e.VAR_CREATE="var_create",e.VAR_DELETE="var_delete",e.VAR_RENAME="var_rename",e.UI="ui",e.BLOCK_DRAG="drag",e.SELECTED="selected",e.CLICK="click",e.MARKER_MOVE="marker_move",e.BUBBLE_OPEN="bubble_open",e.TRASHCAN_OPEN="trashcan_open",e.TOOLBOX_ITEM_SELECT="toolbox_item_select",e.THEME_CHANGE="theme_change",e.VIEWPORT_CHANGE="viewport_change",e.COMMENT_CREATE="comment_create",e.COMMENT_DELETE="comment_delete",e.COMMENT_CHANGE="comment_change",e.COMMENT_MOVE="comment_move",e.COMMENT_RESIZE="comment_resize",e.COMMENT_DRAG="comment_drag",e.COMMENT_COLLAPSE="comment_collapse",e.FINISHED_LOADING="finished_loading"})(M||(M={}));var E$=[M.BLOCK_CREATE,M.BLOCK_MOVE,M.COMMENT_CREATE,M.COMMENT_MOVE],I$=new Set,x$={};x$.warn=_;var D$="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",A$={genUid:()=>{const e=D$.length,t=[];for(let o=0;20>o;o++)t[o]=D$.charAt(Math.random()*e);return t.join("")}},FC=0,Ud={TEST_ONLY:A$};Ud.genUid=S,Ud.getNextUniqueId=k;var R$="",Fn=!0,Hd=0,Wd="ORPHANED_BLOCK",Js=[],O$={FIRE_QUEUE:Js,enqueueEvent:qe,fireNow:Ne,fireInternal:Me,setGroupInternal:we};i.disable$$module$build$src$core$events$utils,i.enable$$module$build$src$core$events$utils,i.getGroup$$module$build$src$core$events$utils,i.setGroup$$module$build$src$core$events$utils,i.setRecordUndo$$module$build$src$core$events$utils;var jn=Object.create(null),M$,zo=null,N$,zn=[],L$={defineBlocksWithJsonArrayInternal:Ve},Et={TEST_ONLY:L$};Et.createBlockDefinitionsFromJsonArray=i.createBlockDefinitionsFromJsonArray$$module$build$src$core$common,Et.defineBlocks=i.defineBlocks$$module$build$src$core$common,Et.defineBlocksWithJsonArray=me,Et.draggingConnections=zn,Et.getAllWorkspaces=se,Et.getBlockTypeCounts=ye,Et.getMainWorkspace=W,Et.getParentContainer=pe,Et.getSelected=x,Et.getWorkspaceById=Z,Et.registerWorkspace=F,Et.setMainWorkspace=le,Et.setParentContainer=G,Et.setSelected=i.setSelected$$module$build$src$core$common,Et.svgResize=ke,Et.unregisterWorkpace=V;var Ii=class{constructor(){this.workspaceId=void 0,this.isUiEvent=!1,this.type="",this.group=i.getGroup$$module$build$src$core$events$utils(),this.recordUndo=$e()}toJson(){return{type:this.type,group:this.group}}static fromJson(e,t,o){return o.isBlank=!1,o.group=e.group||"",o.workspaceId=t.id,o}isNull(){return!1}run(e){}getEventWorkspace_(){let e;if(this.workspaceId&&(e=Z(this.workspaceId)),!e)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return e}},gs=class extends Ii{constructor(e){super(),this.recordUndo=!1,this.isUiEvent=!0,this.isBlank=typeof e>"u",this.workspaceId=e||""}},Vd=class extends gs{constructor(e,t,o){t=e?e.workspace.id:t,t===null&&(t=void 0),super(t),this.type=M.CLICK,this.blockId=e?e.id:void 0,this.targetType=o}toJson(){const e=super.toJson();if(!this.targetType)throw Error("The click target type is undefined. Either pass a block to the constructor, or call fromJson");return e.targetType=this.targetType,e.blockId=this.blockId,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Vd),t.targetType=e.targetType,t.blockId=e.blockId,t}},Gd;(function(e){e.BLOCK="block",e.WORKSPACE="workspace",e.ZOOM_CONTROLS="zoom_controls"})(Gd||(Gd={})),r(z.EVENT,M.CLICK,Vd);var jC=750,B$="ontouchstart"in globalThis||!!(globalThis.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!globalThis.navigator||!globalThis.navigator.maxTouchPoints&&!globalThis.navigator.msMaxTouchPoints),La=null,Uo={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]},Ba=0,Ho={TOUCH_ENABLED:B$,TOUCH_MAP:Uo};Ho.checkTouchIdentifier=ft,Ho.clearTouchIdentifier=Ee,Ho.getTouchIdentifierFromEvent=Be,Ho.longStart=Ye,Ho.longStop=Ce,Ho.shouldHandleEvent=ve;var Kd,P$,F$,j$,Pa,Fa,Yd,z$,U$,H$;(function(e){function t(n){return o.includes(n.toUpperCase())}Kd=e;const o=Kd.toUpperCase();P$=t("JavaFX"),F$=t("WebKit"),j$=t("Gecko")&&!F$,Pa=t("Android"),e=globalThis.navigator&&globalThis.navigator.maxTouchPoints,Fa=t("iPad")||t("Macintosh")&&0<e,Yd=t("iPhone")&&!Fa,z$=t("Macintosh"),U$=Fa||Pa&&!t("Mobile")||t("Silk"),H$=!U$&&(Yd||Pa)})(globalThis.navigator&&globalThis.navigator.userAgent||"");var zC=Kd,W$=P$,V$=j$,Jd=Pa,ja=Fa,G$=Yd,Xd=z$,K$=H$,UC={ANDROID:Jd,GECKO:V$,IPAD:ja,IPHONE:G$,JavaFx:W$,MAC:Xd,MOBILE:K$,raw:zC},Y$=40,J$=125,Xs={};Xs.bind=lt,Xs.conditionalBind=Q,Xs.getScrollDeltaPixels=Hs,Xs.isRightButton=_e,Xs.isTargetInput=wt,Xs.mouseToSvg=tt,Xs.unbind=ze;var X$={};X$.removeElem=Ct;var qs=class{constructor(e){this.name=e}toString(){return this.name}};qs.POSITIONABLE=new qs("positionable"),qs.DRAG_TARGET=new qs("drag_target"),qs.DELETE_AREA=new qs("delete_area"),qs.AUTOHIDEABLE=new qs("autohideable");var at=class{constructor(){this.componentData=new Map,this.capabilityToComponentIds=new Map}addComponent(e,t){const o=e.component.id;if(!t&&this.componentData.has(o)){var n;throw Error('Plugin "'+o+'" with capabilities "'+((n=this.componentData.get(o))==null?void 0:n.capabilities)+'" already added.')}for(this.componentData.set(o,e),t=[],n=0;n<e.capabilities.length;n++){const c=String(e.capabilities[n]).toLowerCase();if(t.push(c),this.capabilityToComponentIds.has(c)){let h;(h=this.capabilityToComponentIds.get(c))==null||h.push(o)}else this.capabilityToComponentIds.set(c,[o])}this.componentData.get(o).capabilities=t}removeComponent(e){const t=this.componentData.get(e);if(t){for(let o=0;o<t.capabilities.length;o++){const n=String(t.capabilities[o]).toLowerCase();Ct(this.capabilityToComponentIds.get(n),e)}this.componentData.delete(e)}}addCapability(e,t){if(!this.getComponent(e))throw Error('Cannot add capability, "'+t+'". Plugin "'+e+'" has not been added to the ComponentManager');if(this.hasCapability(e,t))console.warn('Plugin "'+e+'already has capability "'+t+'"');else{t=`${t}`.toLowerCase();var o;(o=this.componentData.get(e))==null||o.capabilities.push(t);var n;(n=this.capabilityToComponentIds.get(t))==null||n.push(e)}}removeCapability(e,t){if(!this.getComponent(e))throw Error('Cannot remove capability, "'+t+'". Plugin "'+e+'" has not been added to the ComponentManager');this.hasCapability(e,t)?(t=`${t}`.toLowerCase(),Ct(this.componentData.get(e).capabilities,t),Ct(this.capabilityToComponentIds.get(t),e)):console.warn('Plugin "'+e+`doesn't have capability "`+t+'" to remove')}hasCapability(e,t){return t=`${t}`.toLowerCase(),this.componentData.has(e)&&this.componentData.get(e).capabilities.includes(t)}getComponent(e){let t;return(t=this.componentData.get(e))==null?void 0:t.component}getComponents(e,t){if(e=`${e}`.toLowerCase(),e=this.capabilityToComponentIds.get(e),!e)return[];const o=[];if(t){const n=[];e.forEach(c=>{n.push(this.componentData.get(c))}),n.sort(function(c,h){return c.weight-h.weight}),n.forEach(function(c){o.push(c.component)})}else e.forEach(n=>{o.push(this.componentData.get(n).component)});return o}};at.Capability=qs,(function(e){e=e.ComponentWeight||(e.ComponentWeight={}),e[e.TOOLBOX_WEIGHT=0]="TOOLBOX_WEIGHT",e[e.FLYOUT_WEIGHT=1]="FLYOUT_WEIGHT",e[e.TRASHCAN_WEIGHT=2]="TRASHCAN_WEIGHT",e[e.ZOOM_CONTROLS_WEIGHT=3]="ZOOM_CONTROLS_WEIGHT"})(at||(at={})),at.ComponentWeight;var qd=!1,Zd=`
315
+ .blocklySvg {
316
+ background-color: #fff;
317
+ outline: none;
318
+ overflow: hidden; /* IE overflows by default. */
319
+ position: absolute;
320
+ display: block;
321
+ }
322
+
323
+ .blocklyWidgetDiv {
324
+ display: none;
325
+ position: absolute;
326
+ z-index: 99999; /* big value for bootstrap3 compatibility */
327
+ }
328
+
329
+ .injectionDiv {
330
+ height: 100%;
331
+ position: relative;
332
+ overflow: hidden; /* So blocks in drag surface disappear at edges */
333
+ touch-action: none;
334
+ user-select: none;
335
+ -webkit-user-select: none;
336
+ }
337
+
338
+ .blocklyNonSelectable {
339
+ user-select: none;
340
+ -ms-user-select: none;
341
+ -webkit-user-select: none;
342
+ }
343
+
344
+ .blocklyBlockCanvas.blocklyCanvasTransitioning,
345
+ .blocklyBubbleCanvas.blocklyCanvasTransitioning {
346
+ transition: transform .5s;
347
+ }
348
+
349
+ .blocklyTooltipDiv {
350
+ background-color: #ffffc7;
351
+ border: 1px solid #ddc;
352
+ box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);
353
+ color: #000;
354
+ display: none;
355
+ font: 9pt sans-serif;
356
+ opacity: .9;
357
+ padding: 2px;
358
+ position: absolute;
359
+ z-index: 100000; /* big value for bootstrap3 compatibility */
360
+ }
361
+
362
+ .blocklyDropDownDiv {
363
+ position: absolute;
364
+ left: 0;
365
+ top: 0;
366
+ z-index: 1000;
367
+ display: none;
368
+ border: 1px solid;
369
+ border-color: #dadce0;
370
+ background-color: #fff;
371
+ border-radius: 2px;
372
+ padding: 4px;
373
+ box-shadow: 0 0 3px 1px rgba(0,0,0,.3);
374
+ }
375
+
376
+ .blocklyDropDownDiv.blocklyFocused {
377
+ box-shadow: 0 0 6px 1px rgba(0,0,0,.3);
378
+ }
379
+
380
+ .blocklyDropDownContent {
381
+ max-height: 300px; /* @todo: spec for maximum height. */
382
+ overflow: auto;
383
+ overflow-x: hidden;
384
+ position: relative;
385
+ }
386
+
387
+ .blocklyDropDownArrow {
388
+ position: absolute;
389
+ left: 0;
390
+ top: 0;
391
+ width: 16px;
392
+ height: 16px;
393
+ z-index: -1;
394
+ background-color: inherit;
395
+ border-color: inherit;
396
+ }
397
+
398
+ .blocklyDropDownButton {
399
+ display: inline-block;
400
+ float: left;
401
+ padding: 0;
402
+ margin: 4px;
403
+ border-radius: 4px;
404
+ outline: none;
405
+ border: 1px solid;
406
+ transition: box-shadow .1s;
407
+ cursor: pointer;
408
+ }
409
+
410
+ .blocklyArrowTop {
411
+ border-top: 1px solid;
412
+ border-left: 1px solid;
413
+ border-top-left-radius: 4px;
414
+ border-color: inherit;
415
+ }
416
+
417
+ .blocklyArrowBottom {
418
+ border-bottom: 1px solid;
419
+ border-right: 1px solid;
420
+ border-bottom-right-radius: 4px;
421
+ border-color: inherit;
422
+ }
423
+
424
+ .blocklyResizeSE {
425
+ cursor: se-resize;
426
+ fill: #aaa;
427
+ }
428
+
429
+ .blocklyResizeSW {
430
+ cursor: sw-resize;
431
+ fill: #aaa;
432
+ }
433
+
434
+ .blocklyResizeLine {
435
+ stroke: #515A5A;
436
+ stroke-width: 1;
437
+ }
438
+
439
+ .blocklyHighlightedConnectionPath {
440
+ fill: none;
441
+ stroke: #fc3;
442
+ stroke-width: 4px;
443
+ }
444
+
445
+ .blocklyPathLight {
446
+ fill: none;
447
+ stroke-linecap: round;
448
+ stroke-width: 1;
449
+ }
450
+
451
+ .blocklySelected>.blocklyPathLight {
452
+ display: none;
453
+ }
454
+
455
+ .blocklyDraggable {
456
+ cursor: grab;
457
+ cursor: -webkit-grab;
458
+ }
459
+
460
+ .blocklyDragging {
461
+ cursor: grabbing;
462
+ cursor: -webkit-grabbing;
463
+ /* Drag surface disables events to not block the toolbox, so we have to
464
+ * reenable them here for the cursor values to work. */
465
+ pointer-events: auto;
466
+ }
467
+
468
+ /* Changes cursor on mouse down. Not effective in Firefox because of
469
+ https://bugzilla.mozilla.org/show_bug.cgi?id=771241 */
470
+ .blocklyDraggable:active {
471
+ cursor: grabbing;
472
+ cursor: -webkit-grabbing;
473
+ }
474
+
475
+ .blocklyDragging.blocklyDraggingDelete {
476
+ cursor: url("<<<PATH>>>/handdelete.cur"), auto;
477
+ }
478
+
479
+ .blocklyDragging>.blocklyPath,
480
+ .blocklyDragging>.blocklyPathLight {
481
+ fill-opacity: .8;
482
+ stroke-opacity: .8;
483
+ }
484
+
485
+ .blocklyDragging>.blocklyPathDark {
486
+ display: none;
487
+ }
488
+
489
+ .blocklyDisabled>.blocklyPath {
490
+ fill-opacity: .5;
491
+ stroke-opacity: .5;
492
+ }
493
+
494
+ .blocklyDisabled>.blocklyPathLight,
495
+ .blocklyDisabled>.blocklyPathDark {
496
+ display: none;
497
+ }
498
+
499
+ .blocklyInsertionMarker>.blocklyPath,
500
+ .blocklyInsertionMarker>.blocklyPathLight,
501
+ .blocklyInsertionMarker>.blocklyPathDark {
502
+ fill-opacity: .2;
503
+ stroke: none;
504
+ }
505
+
506
+ .blocklyNonEditableText>text {
507
+ pointer-events: none;
508
+ }
509
+
510
+ .blocklyFlyout {
511
+ position: absolute;
512
+ z-index: 20;
513
+ }
514
+
515
+ .blocklyText text {
516
+ cursor: default;
517
+ }
518
+
519
+ .blocklyHidden {
520
+ display: none;
521
+ }
522
+
523
+ .blocklyFieldDropdown:not(.blocklyHidden) {
524
+ display: block;
525
+ }
526
+
527
+ .blocklyIconGroup {
528
+ cursor: default;
529
+ }
530
+
531
+ .blocklyIconGroup:not(:hover),
532
+ .blocklyIconGroupReadonly {
533
+ opacity: .6;
534
+ }
535
+
536
+ .blocklyIconShape {
537
+ fill: #00f;
538
+ stroke: #fff;
539
+ stroke-width: 1px;
540
+ }
541
+
542
+ .blocklyIconSymbol {
543
+ fill: #fff;
544
+ }
545
+
546
+ .blocklyMinimalBody {
547
+ margin: 0;
548
+ padding: 0;
549
+ height: 100%;
550
+ }
551
+
552
+ .blocklyHtmlInput {
553
+ border: none;
554
+ border-radius: 4px;
555
+ height: 100%;
556
+ margin: 0;
557
+ outline: none;
558
+ padding: 0;
559
+ width: 100%;
560
+ text-align: center;
561
+ display: block;
562
+ box-sizing: border-box;
563
+ }
564
+
565
+ /* Remove the increase and decrease arrows on the field number editor */
566
+ input.blocklyHtmlInput[type=number]::-webkit-inner-spin-button,
567
+ input.blocklyHtmlInput[type=number]::-webkit-outer-spin-button {
568
+ -webkit-appearance: none;
569
+ margin: 0;
570
+ }
571
+
572
+ input[type=number] {
573
+ -moz-appearance: textfield;
574
+ }
575
+
576
+ .blocklyMainBackground {
577
+ stroke-width: 1;
578
+ stroke: #c6c6c6; /* Equates to #ddd due to border being off-pixel. */
579
+ }
580
+
581
+ .blocklyMutatorBackground {
582
+ fill: #fff;
583
+ stroke: #ddd;
584
+ stroke-width: 1;
585
+ }
586
+
587
+ .blocklyFlyoutBackground {
588
+ fill: #ddd;
589
+ fill-opacity: .8;
590
+ }
591
+
592
+ .blocklyMainWorkspaceScrollbar {
593
+ z-index: 20;
594
+ }
595
+
596
+ .blocklyFlyoutScrollbar {
597
+ z-index: 30;
598
+ }
599
+
600
+ .blocklyScrollbarHorizontal,
601
+ .blocklyScrollbarVertical {
602
+ position: absolute;
603
+ outline: none;
604
+ }
605
+
606
+ .blocklyScrollbarBackground {
607
+ opacity: 0;
608
+ pointer-events: none;
609
+ }
610
+
611
+ .blocklyScrollbarHandle {
612
+ fill: #ccc;
613
+ }
614
+
615
+ .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,
616
+ .blocklyScrollbarHandle:hover {
617
+ fill: #bbb;
618
+ }
619
+
620
+ /* Darken flyout scrollbars due to being on a grey background. */
621
+ /* By contrast, workspace scrollbars are on a white background. */
622
+ .blocklyFlyout .blocklyScrollbarHandle {
623
+ fill: #bbb;
624
+ }
625
+
626
+ .blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,
627
+ .blocklyFlyout .blocklyScrollbarHandle:hover {
628
+ fill: #aaa;
629
+ }
630
+
631
+ .blocklyInvalidInput {
632
+ background: #faa;
633
+ }
634
+
635
+ .blocklyVerticalMarker {
636
+ stroke-width: 3px;
637
+ fill: rgba(255,255,255,.5);
638
+ pointer-events: none;
639
+ }
640
+
641
+ .blocklyComputeCanvas {
642
+ position: absolute;
643
+ width: 0;
644
+ height: 0;
645
+ }
646
+
647
+ .blocklyNoPointerEvents {
648
+ pointer-events: none;
649
+ }
650
+
651
+ .blocklyContextMenu {
652
+ border-radius: 4px;
653
+ max-height: 100%;
654
+ }
655
+
656
+ .blocklyDropdownMenu {
657
+ border-radius: 2px;
658
+ padding: 0 !important;
659
+ }
660
+
661
+ .blocklyDropdownMenu .blocklyMenuItem {
662
+ /* 28px on the left for icon or checkbox. */
663
+ padding-left: 28px;
664
+ }
665
+
666
+ /* BiDi override for the resting state. */
667
+ .blocklyDropdownMenu .blocklyMenuItemRtl {
668
+ /* Flip left/right padding for BiDi. */
669
+ padding-left: 5px;
670
+ padding-right: 28px;
671
+ }
672
+
673
+ .blocklyWidgetDiv .blocklyMenu {
674
+ background: #fff;
675
+ border: 1px solid transparent;
676
+ box-shadow: 0 0 3px 1px rgba(0,0,0,.3);
677
+ font: normal 13px Arial, sans-serif;
678
+ margin: 0;
679
+ outline: none;
680
+ padding: 4px 0;
681
+ position: absolute;
682
+ overflow-y: auto;
683
+ overflow-x: hidden;
684
+ max-height: 100%;
685
+ z-index: 20000; /* Arbitrary, but some apps depend on it... */
686
+ }
687
+
688
+ .blocklyWidgetDiv .blocklyMenu.blocklyFocused {
689
+ box-shadow: 0 0 6px 1px rgba(0,0,0,.3);
690
+ }
691
+
692
+ .blocklyDropDownDiv .blocklyMenu {
693
+ background: inherit; /* Compatibility with gapi, reset from goog-menu */
694
+ border: inherit; /* Compatibility with gapi, reset from goog-menu */
695
+ font: normal 13px "Helvetica Neue", Helvetica, sans-serif;
696
+ outline: none;
697
+ position: relative; /* Compatibility with gapi, reset from goog-menu */
698
+ z-index: 20000; /* Arbitrary, but some apps depend on it... */
699
+ }
700
+
701
+ /* State: resting. */
702
+ .blocklyMenuItem {
703
+ border: none;
704
+ color: #000;
705
+ cursor: pointer;
706
+ list-style: none;
707
+ margin: 0;
708
+ /* 7em on the right for shortcut. */
709
+ min-width: 7em;
710
+ padding: 6px 15px;
711
+ white-space: nowrap;
712
+ }
713
+
714
+ /* State: disabled. */
715
+ .blocklyMenuItemDisabled {
716
+ color: #ccc;
717
+ cursor: inherit;
718
+ }
719
+
720
+ /* State: hover. */
721
+ .blocklyMenuItemHighlight {
722
+ background-color: rgba(0,0,0,.1);
723
+ }
724
+
725
+ /* State: selected/checked. */
726
+ .blocklyMenuItemCheckbox {
727
+ height: 16px;
728
+ position: absolute;
729
+ width: 16px;
730
+ }
731
+
732
+ .blocklyMenuItemSelected .blocklyMenuItemCheckbox {
733
+ background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;
734
+ float: left;
735
+ margin-left: -24px;
736
+ position: static; /* Scroll with the menu. */
737
+ }
738
+
739
+ .blocklyMenuItemRtl .blocklyMenuItemCheckbox {
740
+ float: right;
741
+ margin-right: -24px;
742
+ }
743
+
744
+ .blocklyBlockDragSurface, .blocklyAnimationLayer {
745
+ position: absolute;
746
+ top: 0;
747
+ left: 0;
748
+ right: 0;
749
+ bottom: 0;
750
+ overflow: visible !important;
751
+ z-index: 80;
752
+ pointer-events: none;
753
+ }
754
+ `,Qd={};Qd.inject=Pc,Qd.register=Tt;var K=class{constructor(e,t){this.x=e,this.y=t}clone(){return new K(this.x,this.y)}scale(e){return this.x*=e,this.y*=e,this}translate(e,t){return this.x+=e,this.y+=t,this}static equals(e,t){return e===t?!0:e&&t?e.x===t.x&&e.y===t.y:!1}static distance(e,t){const o=e.x-t.x;return e=e.y-t.y,Math.sqrt(o*o+e*e)}static magnitude(e){return Math.sqrt(e.x*e.x+e.y*e.y)}static difference(e,t){return new K(e.x-t.x,e.y-t.y)}static sum(e,t){return new K(e.x+t.x,e.y+t.y)}},Un="http://www.w3.org/2000/svg",As="http://www.w3.org/1999/xhtml",Kt="http://www.w3.org/1999/xlink",Zs;(function(e){e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE"})(Zs||(Zs={}));var ms=null,eh=0,za=null,St={HTML_NS:As};St.NodeType=Zs,St.SVG_NS=Un,St.XLINK_NS=Kt,St.addClass=fe,St.createSvgElement=L,St.getFastTextWidth=$n,St.getFastTextWidthWithSizeString=Vr,St.getTextWidth=Fc,St.hasClass=rm,St.insertAfter=Ao,St.measureFontMetrics=Gr,St.removeClass=st,St.removeClasses=Hr,St.removeNode=Ge,St.setCssTransform=Wr,St.startTextWidthCache=Ro,St.stopTextWidthCache=Oo;var D=class{constructor(e){this.tagName=e}toString(){return this.tagName}};D.ANIMATE=new D("animate"),D.CIRCLE=new D("circle"),D.CLIPPATH=new D("clipPath"),D.DEFS=new D("defs"),D.FECOMPOSITE=new D("feComposite"),D.FECOMPONENTTRANSFER=new D("feComponentTransfer"),D.FEFLOOD=new D("feFlood"),D.FEFUNCA=new D("feFuncA"),D.FEGAUSSIANBLUR=new D("feGaussianBlur"),D.FEPOINTLIGHT=new D("fePointLight"),D.FESPECULARLIGHTING=new D("feSpecularLighting"),D.FILTER=new D("filter"),D.FOREIGNOBJECT=new D("foreignObject"),D.G=new D("g"),D.IMAGE=new D("image"),D.LINE=new D("line"),D.PATH=new D("path"),D.PATTERN=new D("pattern"),D.POLYGON=new D("polygon"),D.RECT=new D("rect"),D.SVG=new D("svg"),D.TEXT=new D("text"),D.TSPAN=new D("tspan");var Je=class{constructor(e,t,o,n){this.top=e,this.bottom=t,this.left=o,this.right=n}clone(){return new Je(this.top,this.bottom,this.left,this.right)}getHeight(){return this.bottom-this.top}getWidth(){return this.right-this.left}contains(e,t){return e>=this.left&&e<=this.right&&t>=this.top&&t<=this.bottom}intersects(e){return this.left<=e.right&&this.right>=e.left&&this.bottom>=e.top&&this.top<=e.bottom}static equals(e,t){return e===t?!0:e&&t?e.top===t.top&&e.bottom===t.bottom&&e.left===t.left&&e.right===t.right:!1}static createFromPoint(e,t,o){const n=e.x;return e=e.y,new Je(e,e+o,n,n+t)}},Le=class{constructor(e,t){this.width=e,this.height=t}static equals(e,t){return e===t?!0:e&&t?e.width===t.width&&e.height===t.height:!1}static max(e,t){return new Le(Math.max(e.width,t.width),Math.max(e.height,t.height))}static min(e,t){return new Le(Math.min(e.width,t.width),Math.min(e.height,t.height))}},q$={getSizeInternal:am},fo={TEST_ONLY:q$};fo.getBorderBox=Uc,fo.getComputedStyle=ks,fo.getContainerOffsetToScrollInto=Hc,fo.getPageOffset=co,fo.getSize=bn,fo.getViewportPageOffset=zc,fo.scrollIntoContainerView=Kr;var Z$=/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*)?/,Q$=/transform:\s*translate(?:3d)?\(\s*([-+\d.e]+)\s*px([ ,]\s*([-+\d.e]+)\s*px)?/,HC={XY_REGEX:Z$,XY_STYLE_REGEX:Q$},Wo={TEST_ONLY:HC};Wo.getDocumentScroll=Vc,Wo.getInjectionDivXY=Yr,Wo.getRelativeXY=vn,Wo.getViewportBBox=Wc,Wo.screenToWsCoordinates=lm,Wo.wsToScreenCoordinates=cm;var gt=class{constructor(e,t,o,n,c){this.workspace=e,this.horizontal=t,this.oldHostMetrics=null,this.ratio=1,this.origin=new K(0,0),this.startDragHandle=this.handlePosition=this.handleLength=this.scrollbarLength=this.startDragMouse=0,this.containerVisible=this.isHandleVisible=!0,this.position=new K(0,0),this.onMouseMoveWrapper_=this.onMouseUpWrapper_=null,this.pair=o||!1,this.margin=c!==void 0?c:gt.DEFAULT_SCROLLBAR_MARGIN,e="blocklyScrollbar"+(this.horizontal?"Horizontal":"Vertical"),n&&(e+=" "+n),this.outerSvg=L(D.SVG,{class:e}),n=L(D.G,{},this.outerSvg),this.svgBackground=L(D.RECT,{class:"blocklyScrollbarBackground"},n),e=Math.floor((gt.scrollbarThickness-5)/2),this.svgHandle=L(D.RECT,{class:"blocklyScrollbarHandle",rx:e,ry:e},n),this.workspace.getThemeManager().subscribe(this.svgHandle,"scrollbarColour","fill"),this.workspace.getThemeManager().subscribe(this.svgHandle,"scrollbarOpacity","fill-opacity"),Ao(this.outerSvg,this.workspace.getParentSvg()),this.setInitialThickness(),t?(this.lengthAttribute_="width",this.positionAttribute_="x"):(this.lengthAttribute_="height",this.positionAttribute_="y"),this.onMouseDownBarWrapper_=Q(this.svgBackground,"pointerdown",this,this.onMouseDownBar),this.onMouseDownHandleWrapper_=Q(this.svgHandle,"pointerdown",this,this.onMouseDownHandle)}setInitialThickness(){const e=gt.scrollbarThickness;this.horizontal?(this.svgBackground.setAttribute("height",String(e)),this.outerSvg.setAttribute("height",String(e)),this.svgHandle.setAttribute("height",String(e-5)),this.svgHandle.setAttribute("y","2.5")):(this.svgBackground.setAttribute("width",String(e)),this.outerSvg.setAttribute("width",String(e)),this.svgHandle.setAttribute("width",String(e-5)),this.svgHandle.setAttribute("x","2.5"))}dispose(){this.cleanUp(),ze(this.onMouseDownBarWrapper_),ze(this.onMouseDownHandleWrapper_),Ge(this.outerSvg),this.workspace.getThemeManager().unsubscribe(this.svgHandle)}constrainHandleLength(e){return e=0>=e||isNaN(e)?0:Math.min(e,this.scrollbarLength)}setHandleLength(e){this.handleLength=e,this.svgHandle.setAttribute(this.lengthAttribute_,String(this.handleLength))}constrainHandlePosition(e){return e=0>=e||isNaN(e)?0:Math.min(e,this.scrollbarLength-this.handleLength)}setHandlePosition(e){this.handlePosition=e,this.svgHandle.setAttribute(this.positionAttribute_,String(this.handlePosition))}setScrollbarLength(e){this.scrollbarLength=e,this.outerSvg.setAttribute(this.lengthAttribute_,String(this.scrollbarLength)),this.svgBackground.setAttribute(this.lengthAttribute_,String(this.scrollbarLength))}setPosition(e,t){this.position.x=e,this.position.y=t,Wr(this.outerSvg,"translate("+(this.position.x+this.origin.x)+"px,"+(this.position.y+this.origin.y)+"px)")}resize(e){!e&&(e=this.workspace.getMetrics(),!e)||this.oldHostMetrics&&gt.metricsAreEquivalent(e,this.oldHostMetrics)||(this.horizontal?this.resizeHorizontal(e):this.resizeVertical(e),this.oldHostMetrics=e,this.updateMetrics())}requiresViewResize(e){return this.oldHostMetrics?this.oldHostMetrics.viewWidth!==e.viewWidth||this.oldHostMetrics.viewHeight!==e.viewHeight||this.oldHostMetrics.absoluteLeft!==e.absoluteLeft||this.oldHostMetrics.absoluteTop!==e.absoluteTop:!0}resizeHorizontal(e){this.requiresViewResize(e)?this.resizeViewHorizontal(e):this.resizeContentHorizontal(e)}resizeViewHorizontal(e){var t=e.viewWidth-2*this.margin;this.pair&&(t-=gt.scrollbarThickness),this.setScrollbarLength(Math.max(0,t)),t=e.absoluteLeft+this.margin,this.pair&&this.workspace.RTL&&(t+=gt.scrollbarThickness),this.setPosition(t,e.absoluteTop+e.viewHeight-gt.scrollbarThickness-this.margin),this.resizeContentHorizontal(e)}resizeContentHorizontal(e){if(e.viewWidth>=e.scrollWidth)this.setHandleLength(this.scrollbarLength),this.setHandlePosition(0),this.pair||this.setVisible(!1);else{this.pair||this.setVisible(!0);var t=this.scrollbarLength*e.viewWidth/e.scrollWidth;t=this.constrainHandleLength(t),this.setHandleLength(t),t=e.scrollWidth-e.viewWidth;var o=this.scrollbarLength-this.handleLength;e=(e.viewLeft-e.scrollLeft)/t*o,e=this.constrainHandlePosition(e),this.setHandlePosition(e),this.ratio=o/t}}resizeVertical(e){this.requiresViewResize(e)?this.resizeViewVertical(e):this.resizeContentVertical(e)}resizeViewVertical(e){let t=e.viewHeight-2*this.margin;this.pair&&(t-=gt.scrollbarThickness),this.setScrollbarLength(Math.max(0,t)),this.setPosition(this.workspace.RTL?e.absoluteLeft+this.margin:e.absoluteLeft+e.viewWidth-gt.scrollbarThickness-this.margin,e.absoluteTop+this.margin),this.resizeContentVertical(e)}resizeContentVertical(e){if(e.viewHeight>=e.scrollHeight)this.setHandleLength(this.scrollbarLength),this.setHandlePosition(0),this.pair||this.setVisible(!1);else{this.pair||this.setVisible(!0);var t=this.scrollbarLength*e.viewHeight/e.scrollHeight;t=this.constrainHandleLength(t),this.setHandleLength(t),t=e.scrollHeight-e.viewHeight;var o=this.scrollbarLength-this.handleLength;e=(e.viewTop-e.scrollTop)/t*o,e=this.constrainHandlePosition(e),this.setHandlePosition(e),this.ratio=o/t}}isVisible(){return this.isHandleVisible}setContainerVisible(e){const t=e!==this.containerVisible;this.containerVisible=e,t&&this.updateDisplay_()}setVisible(e){if(this.pair)throw Error("Unable to toggle visibility of paired scrollbars.");this.setVisibleInternal(e)}setVisibleInternal(e){const t=e!==this.isVisible();this.isHandleVisible=e,t&&this.updateDisplay_()}updateDisplay_(){this.containerVisible&&this.isVisible()?this.outerSvg.setAttribute("display","block"):this.outerSvg.setAttribute("display","none")}onMouseDownBar(e){if(this.workspace.markFocused(),Ee(),this.cleanUp(),_e(e))e.stopPropagation();else{var t=tt(e,this.workspace.getParentSvg(),this.workspace.getInverseScreenCTM());t=this.horizontal?t.x:t.y;var o=Yr(this.svgHandle);o=this.horizontal?o.x:o.y;var n=this.handlePosition,c=.95*this.handleLength;t<=o?n-=c:t>=o+this.handleLength&&(n+=c),this.setHandlePosition(this.constrainHandlePosition(n)),this.updateMetrics(),e.stopPropagation(),e.preventDefault()}}onMouseDownHandle(e){this.workspace.markFocused(),this.cleanUp(),_e(e)?e.stopPropagation():(this.startDragHandle=this.handlePosition,this.startDragMouse=this.horizontal?e.clientX:e.clientY,this.onMouseUpWrapper_=Q(document,"pointerup",this,this.onMouseUpHandle),this.onMouseMoveWrapper_=Q(document,"pointermove",this,this.onMouseMoveHandle),e.stopPropagation(),e.preventDefault())}onMouseMoveHandle(e){this.setHandlePosition(this.constrainHandlePosition(this.startDragHandle+((this.horizontal?e.clientX:e.clientY)-this.startDragMouse))),this.updateMetrics()}onMouseUpHandle(){Ee(),this.cleanUp()}cleanUp(){this.workspace.hideChaff(!0),this.onMouseUpWrapper_&&(ze(this.onMouseUpWrapper_),this.onMouseUpWrapper_=null),this.onMouseMoveWrapper_&&(ze(this.onMouseMoveWrapper_),this.onMouseMoveWrapper_=null)}getRatio_(){let e=this.handlePosition/(this.scrollbarLength-this.handleLength);return isNaN(e)&&(e=0),e}updateMetrics(){const e=this.getRatio_();this.horizontal?this.workspace.setMetrics({x:e}):this.workspace.setMetrics({y:e})}set(e,t){this.setHandlePosition(this.constrainHandlePosition(e*this.ratio)),(t||t===void 0)&&this.updateMetrics()}setOrigin(e,t){this.origin=new K(e,t)}static metricsAreEquivalent(e,t){return e.viewWidth===t.viewWidth&&e.viewHeight===t.viewHeight&&e.viewLeft===t.viewLeft&&e.viewTop===t.viewTop&&e.absoluteTop===t.absoluteTop&&e.absoluteLeft===t.absoluteLeft&&e.scrollWidth===t.scrollWidth&&e.scrollHeight===t.scrollHeight&&e.scrollLeft===t.scrollLeft&&e.scrollTop===t.scrollTop}};gt.scrollbarThickness=B$?25:15,gt.DEFAULT_SCROLLBAR_MARGIN=.5;var Ua={parseFromString:function(){throw Error("DOMParser was not found in the global scope and was not properly injected using injectDependencies")}},th={serializeToString:function(){throw Error("XMLSerializer was not foundin the global scope and was not properly injected using injectDependencies")}},{document:Ha,DOMParser:Hn,XMLSerializer:Wn}=globalThis;Hn&&(Ua=new Hn),Wn&&(th=new Wn);var eb="https://developers.google.com/blockly/xml",WC=/[\x00-\x09\x0B\x0C\x0E-\x1F]/g,xi={NAME_SPACE:eb};xi.createElement=i.createElement$$module$build$src$core$utils$xml,xi.createTextNode=i.createTextNode$$module$build$src$core$utils$xml,xi.domToText=gi,xi.injectDependencies=um,xi.textToDom=i.textToDom$$module$build$src$core$utils$xml;var sh="categoryToolbox",tb="flyoutToolbox",xe;(function(e){e[e.TOP=0]="TOP",e[e.BOTTOM=1]="BOTTOM",e[e.LEFT=2]="LEFT",e[e.RIGHT=3]="RIGHT"})(xe||(xe={}));var sb={hasCategoriesInternal:pm},$o={};$o.Position=xe,$o.TEST_ONLY=sb,$o.convertFlyoutDefToJsonArray=yn,$o.convertToolboxDefToJson=Jr,$o.hasCategories=Xr,$o.isCategoryCollapsible=qr,$o.parseToolboxTree=Kc;var Qs;(function(e){e[e.TOP=0]="TOP",e[e.BOTTOM=1]="BOTTOM"})(Qs||(Qs={}));var Di;(function(e){e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT"})(Di||(Di={}));var bo;(function(e){e[e.UP=0]="UP",e[e.DOWN=1]="DOWN"})(bo||(bo={}));var Vo={};Vo.bumpDirection=bo,Vo.bumpPositionRect=ta,Vo.getCornerOppositeToolbox=ea,Vo.getStartPositionRect=Qr,Vo.horizontalPosition=Di,Vo.verticalPosition=Qs;var Nt={width:96,height:124,url:"sprites.png"},ob=class{constructor(e){this.workspace=e,this.id="zoomControls",this.boundEvents=[],this.zoomResetGroup=this.zoomOutGroup=this.zoomInGroup=null,this.HEIGHT=this.WIDTH=32,this.SMALL_SPACING=2,this.LARGE_SPACING=11,this.MARGIN_HORIZONTAL=this.MARGIN_VERTICAL=20,this.svgGroup=null,this.top=this.left=0,this.initialized=!1}createDom(){this.svgGroup=L(D.G,{});const e=String(Math.random()).substring(2);return this.createZoomOutSvg(e),this.createZoomInSvg(e),this.workspace.isMovable()&&this.createZoomResetSvg(e),this.svgGroup}init(){this.workspace.getComponentManager().addComponent({component:this,weight:at.ComponentWeight.ZOOM_CONTROLS_WEIGHT,capabilities:[at.Capability.POSITIONABLE]}),this.initialized=!0}dispose(){this.workspace.getComponentManager().removeComponent("zoomControls"),this.svgGroup&&Ge(this.svgGroup);for(const e of this.boundEvents)ze(e);this.boundEvents.length=0}getBoundingRectangle(){let e=this.SMALL_SPACING+2*this.HEIGHT;return this.zoomResetGroup&&(e+=this.LARGE_SPACING+this.HEIGHT),new Je(this.top,this.top+e,this.left,this.left+this.WIDTH)}position(e,t){if(this.initialized){var o=ea(this.workspace,e),n=this.SMALL_SPACING+2*this.HEIGHT;if(this.zoomResetGroup&&(n+=this.LARGE_SPACING+this.HEIGHT),e=Qr(o,new Le(this.WIDTH,n),this.MARGIN_HORIZONTAL,this.MARGIN_VERTICAL,e,this.workspace),o=o.vertical,t=ta(e,this.MARGIN_VERTICAL,o===Qs.TOP?bo.DOWN:bo.UP,t),o===Qs.TOP){var c=this.SMALL_SPACING+this.HEIGHT,h;(h=this.zoomInGroup)==null||h.setAttribute("transform","translate(0, "+c+")"),this.zoomResetGroup&&this.zoomResetGroup.setAttribute("transform","translate(0, "+(c+this.LARGE_SPACING+this.HEIGHT)+")")}else{h=this.zoomResetGroup?this.LARGE_SPACING+this.HEIGHT:0;let T;(T=this.zoomInGroup)==null||T.setAttribute("transform","translate(0, "+h+")"),h=h+this.SMALL_SPACING+this.HEIGHT,(c=this.zoomOutGroup)==null||c.setAttribute("transform","translate(0, "+h+")")}this.top=t.top,this.left=t.left;var $;($=this.svgGroup)==null||$.setAttribute("transform","translate("+this.left+","+this.top+")")}}createZoomOutSvg(e){this.zoomOutGroup=L(D.G,{class:"blocklyZoom blocklyZoomOut"},this.svgGroup);const t=L(D.CLIPPATH,{id:"blocklyZoomoutClipPath"+e},this.zoomOutGroup);L(D.RECT,{width:32,height:32},t),L(D.IMAGE,{width:Nt.width,height:Nt.height,x:-64,y:-92,"clip-path":"url(#blocklyZoomoutClipPath"+e+")"},this.zoomOutGroup).setAttributeNS(Kt,"xlink:href",this.workspace.options.pathToMedia+Nt.url),this.boundEvents.push(Q(this.zoomOutGroup,"pointerdown",null,this.zoom.bind(this,-1)))}createZoomInSvg(e){this.zoomInGroup=L(D.G,{class:"blocklyZoom blocklyZoomIn"},this.svgGroup);const t=L(D.CLIPPATH,{id:"blocklyZoominClipPath"+e},this.zoomInGroup);L(D.RECT,{width:32,height:32},t),L(D.IMAGE,{width:Nt.width,height:Nt.height,x:-32,y:-92,"clip-path":"url(#blocklyZoominClipPath"+e+")"},this.zoomInGroup).setAttributeNS(Kt,"xlink:href",this.workspace.options.pathToMedia+Nt.url),this.boundEvents.push(Q(this.zoomInGroup,"pointerdown",null,this.zoom.bind(this,1)))}zoom(e,t){this.workspace.markFocused(),this.workspace.zoomCenter(e),this.fireZoomEvent(),Ee(),t.stopPropagation(),t.preventDefault()}createZoomResetSvg(e){this.zoomResetGroup=L(D.G,{class:"blocklyZoom blocklyZoomReset"},this.svgGroup);const t=L(D.CLIPPATH,{id:"blocklyZoomresetClipPath"+e},this.zoomResetGroup);L(D.RECT,{width:32,height:32},t),L(D.IMAGE,{width:Nt.width,height:Nt.height,y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+e+")"},this.zoomResetGroup).setAttributeNS(Kt,"xlink:href",this.workspace.options.pathToMedia+Nt.url),this.boundEvents.push(Q(this.zoomResetGroup,"pointerdown",null,this.resetZoom.bind(this)))}resetZoom(e){this.workspace.markFocused();const t=Math.log(this.workspace.options.zoomOptions.startScale/this.workspace.scale)/Math.log(this.workspace.options.zoomOptions.scaleSpeed);this.workspace.beginCanvasTransition(),this.workspace.zoomCenter(t),this.workspace.scrollCenter(),setTimeout(this.workspace.endCanvasTransition.bind(this.workspace),500),this.fireZoomEvent(),Ee(),e.stopPropagation(),e.preventDefault()}fireZoomEvent(){const e=new(Y(M.CLICK))(null,this.workspace.id,"zoom_controls");U(e)}};Tt(`
755
+ .blocklyZoom>image, .blocklyZoom>svg>image {
756
+ opacity: .4;
757
+ }
758
+
759
+ .blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {
760
+ opacity: .6;
761
+ }
762
+
763
+ .blocklyZoom>image:active, .blocklyZoom>svg>image:active {
764
+ opacity: .8;
765
+ }
766
+ `);var ib=100,nb=75,rb=50,ab=25,VC={BLOCKS:rb,PROCEDURES:nb,VARIABLES:ib,WORKSPACE_COMMENTS:ab},oh={};oh.register=_n,oh.unregister=mm;var lb=class{constructor(){this.priority=ab}save(e){const t=[];for(const o of e.getTopComments())(e=mi(o,{addCoordinates:!0,saveIds:!0}))&&t.push(e);return t.length?t:null}load(e,t){for(const o of e)wn(o,t,{recordUndo:$e()})}clear(e){for(const t of e.getTopComments())t.dispose()}};_n("workspaceComments",new lb);var Wa={};Wa.WorkspaceCommentSerializer=lb,Wa.append=wn,Wa.save=mi;var ih={};ih.register=sa,ih.unregister=fm;var Va=class{paste(e,t,o){e=e.commentState,o&&(e.x=o.x,e.y=o.y),i.disable$$module$build$src$core$events$utils();let n;try{n=wn(e,t),$m(n)}finally{i.enable$$module$build$src$core$events$utils()}return n?(J()&&U(new(Y(M.COMMENT_CREATE))(n)),i.setSelected$$module$build$src$core$common(n),n):null}};Va.TYPE="workspace-comment",sa(Va.TYPE,new Va);var nh;nh=28,i.config$$module$build$src$core$config={dragRadius:5,flyoutDragRadius:10,snapRadius:nh,connectingSnapRadius:nh,currentConnectionPreference:8,bumpDelay:250},i.config$$module$build$src$core$config;var GC="aria-",KC="role",fs;(function(e){e.GRID="grid",e.GRIDCELL="gridcell",e.GROUP="group",e.LISTBOX="listbox",e.MENU="menu",e.MENUITEM="menuitem",e.MENUITEMCHECKBOX="menuitemcheckbox",e.OPTION="option",e.PRESENTATION="presentation",e.ROW="row",e.TREE="tree",e.TREEITEM="treeitem"})(fs||(fs={}));var yt;(function(e){e.ACTIVEDESCENDANT="activedescendant",e.COLCOUNT="colcount",e.DISABLED="disabled",e.EXPANDED="expanded",e.INVALID="invalid",e.LABEL="label",e.LABELLEDBY="labelledby",e.LEVEL="level",e.ORIENTATION="orientation",e.POSINSET="posinset",e.ROWCOUNT="rowcount",e.SELECTED="selected",e.SETSIZE="setsize",e.VALUEMAX="valuemax",e.VALUEMIN="valuemin"})(yt||(yt={}));var Vn={};Vn.Role=fs,Vn.State=yt,Vn.setRole=uo,Vn.setState=kt;var rh=class{constructor(){this.menuItems=[],this.roleName=this.element=this.onKeyDownHandler=this.pointerLeaveHandler=this.pointerEnterHandler=this.clickHandler=this.pointerMoveHandler=this.highlightedItem=this.openingCoords=null}addChild(e){this.menuItems.push(e)}render(e){const t=document.createElement("div");t.className="blocklyMenu goog-menu blocklyNonSelectable",t.tabIndex=0,this.roleName&&uo(t,this.roleName),this.element=t;for(let o=0,n;n=this.menuItems[o];o++)t.appendChild(n.createDom());return this.pointerMoveHandler=Q(t,"pointermove",this,this.handlePointerMove,!0),this.clickHandler=Q(t,"pointerup",this,this.handleClick,!0),this.pointerEnterHandler=Q(t,"pointerenter",this,this.handlePointerEnter,!0),this.pointerLeaveHandler=Q(t,"pointerleave",this,this.handlePointerLeave,!0),this.onKeyDownHandler=Q(t,"keydown",this,this.handleKeyEvent),e.appendChild(t),t}getElement(){return this.element}focus(){const e=this.getElement();e&&(e.focus({preventScroll:!0}),fe(e,"blocklyFocused"))}blur(){const e=this.getElement();e&&(e.blur(),st(e,"blocklyFocused"))}setRole(e){this.roleName=e}dispose(){this.pointerMoveHandler&&(ze(this.pointerMoveHandler),this.pointerMoveHandler=null),this.clickHandler&&(ze(this.clickHandler),this.clickHandler=null),this.pointerEnterHandler&&(ze(this.pointerEnterHandler),this.pointerEnterHandler=null),this.pointerLeaveHandler&&(ze(this.pointerLeaveHandler),this.pointerLeaveHandler=null),this.onKeyDownHandler&&(ze(this.onKeyDownHandler),this.onKeyDownHandler=null);for(let e=0,t;t=this.menuItems[e];e++)t.dispose();this.element=null}getMenuItem(e){const t=this.getElement();for(;e&&e!==t;){if(e.classList.contains("blocklyMenuItem")){for(let o=0,n;n=this.menuItems[o];o++)if(n.getElement()===e)return n}e=e.parentElement}return null}setHighlighted(e){var t=this.highlightedItem;if(t&&(t.setHighlighted(!1),this.highlightedItem=null),e){e.setHighlighted(!0),this.highlightedItem=e,t=this.getElement();const o=t==null?void 0:t.parentElement,n=e.getElement();o&&n&&(Kr(n,o),kt(t,yt.ACTIVEDESCENDANT,e.getId()))}}highlightNext(){const e=this.highlightedItem?this.menuItems.indexOf(this.highlightedItem):-1;this.highlightHelper(e,1)}highlightPrevious(){const e=this.highlightedItem?this.menuItems.indexOf(this.highlightedItem):-1;this.highlightHelper(0>e?this.menuItems.length:e,-1)}highlightFirst(){this.highlightHelper(-1,1)}highlightLast(){this.highlightHelper(this.menuItems.length,-1)}highlightHelper(e,t){e+=t;let o;for(;o=this.menuItems[e];){if(o.isEnabled()){this.setHighlighted(o);break}e+=t}}handlePointerMove(e){Math.max(Math.abs(e.movementX),Math.abs(e.movementY))!==0&&(e=this.getMenuItem(e.target))&&(e.isEnabled()?this.highlightedItem!==e&&this.setHighlighted(e):this.setHighlighted(null))}handleClick(e){const t=this.openingCoords;if(this.openingCoords=null,t&&typeof e.clientX=="number"){const o=new K(e.clientX,e.clientY);if(1>K.distance(t,o))return}(e=this.getMenuItem(e.target))&&e.performAction()}handlePointerEnter(e){this.focus()}handlePointerLeave(e){this.getElement()&&this.setHighlighted(null)}handleKeyEvent(e){if(this.menuItems.length&&!(e.shiftKey||e.ctrlKey||e.metaKey||e.altKey)){var t=this.highlightedItem;switch(e.key){case"Enter":case" ":t&&t.performAction();break;case"ArrowUp":this.highlightPrevious();break;case"ArrowDown":this.highlightNext();break;case"PageUp":case"Home":this.highlightFirst();break;case"PageDown":case"End":this.highlightLast();break;default:return}e.preventDefault(),e.stopPropagation()}}getSize(){const e=this.getElement(),t=bn(e);return t.height=e.scrollHeight,t}},ah=class{constructor(e,t){this.content=e,this.opt_value=t,this.enabled=!0,this.element=null,this.rightToLeft=!1,this.roleName=null,this.highlight=this.checked=this.checkable=!1,this.actionHandler=null}createDom(){const e=document.createElement("div");e.id=k(),this.element=e,e.className="blocklyMenuItem goog-menuitem "+(this.enabled?"":"blocklyMenuItemDisabled goog-menuitem-disabled ")+(this.checked?"blocklyMenuItemSelected goog-option-selected ":"")+(this.highlight?"blocklyMenuItemHighlight goog-menuitem-highlight ":"")+(this.rightToLeft?"blocklyMenuItemRtl goog-menuitem-rtl ":"");const t=document.createElement("div");if(t.className="blocklyMenuItemContent goog-menuitem-content",this.checkable){var o=document.createElement("div");o.className="blocklyMenuItemCheckbox goog-menuitem-checkbox",t.appendChild(o)}return o=this.content,typeof this.content=="string"&&(o=document.createTextNode(this.content)),t.appendChild(o),e.appendChild(t),this.roleName&&uo(e,this.roleName),kt(e,yt.SELECTED,this.checkable&&this.checked||!1),kt(e,yt.DISABLED,!this.enabled),e}dispose(){this.element=null}getElement(){return this.element}getId(){return this.element.id}getValue(){let e;return(e=this.opt_value)!=null?e:null}setRightToLeft(e){this.rightToLeft=e}setRole(e){this.roleName=e}setCheckable(e){this.checkable=e}setChecked(e){this.checked=e}setHighlighted(e){this.highlight=e;const t=this.getElement();t&&this.isEnabled()&&(e?(fe(t,"blocklyMenuItemHighlight"),fe(t,"goog-menuitem-highlight")):(st(t,"blocklyMenuItemHighlight"),st(t,"goog-menuitem-highlight")))}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}performAction(){this.isEnabled()&&this.actionHandler&&this.actionHandler(this)}onAction(e,t){this.actionHandler=e.bind(t)}},Gn="_TEMP_COLLAPSED_INPUT",Ga="_TEMP_COLLAPSED_FIELD",Lt="MANUALLY_DISABLED",YC={COLLAPSED_FIELD_NAME:Ga,COLLAPSED_INPUT_NAME:Gn,MANUALLY_DISABLED:Lt};(function(e){e[e.VALUE=1]="VALUE",e[e.STATEMENT=3]="STATEMENT",e[e.DUMMY=5]="DUMMY",e[e.CUSTOM=6]="CUSTOM",e[e.END_ROW=7]="END_ROW"})(i.inputTypes$$module$build$src$core$inputs$input_types||(i.inputTypes$$module$build$src$core$inputs$input_types={})),i.inputTypes$$module$build$src$core$inputs$input_types;var Ka=new Set,lh=new WeakSet,ch=new WeakMap,Ai=null,uh=null,cb=0,Ya={};Ya.finishQueuedRenders=ps,Ya.queueRender=Yc,Ya.triggerQueuedRenders=Ws;var ub=function(e,t){window.alert(e),t&&t()},db=function(e,t){t(window.confirm(e))},hb=function(e,t,o){o(window.prompt(e,t))},pb={confirmInternal:wm},Go={TEST_ONLY:pb};Go.alert=Tn,Go.confirm=ia,Go.prompt=na,Go.setAlert=_m,Go.setConfirm=Cm,Go.setPrompt=Tm;var dh,gb;i.Msg$$module$build$src$core$msg=Object.create(null),dh=function(e){Object.keys(e).forEach(function(t){i.Msg$$module$build$src$core$msg[t]=e[t]})},gb={Msg:i.Msg$$module$build$src$core$msg,setLocale:dh};var Kn=class extends Ii{constructor(e){super(),this.isBlank=typeof e>"u",e&&(this.varId=e.getId(),this.workspaceId=e.workspace.id)}toJson(){const e=super.toJson();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");return e.varId=this.varId,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Kn),t.varId=e.varId,t}},hh=class extends Kn{constructor(e){super(e),this.type=M.VAR_CREATE,e&&(this.varType=e.type,this.varName=e.name)}toJson(){const e=super.toJson();if(this.varType===void 0)throw Error("The var type is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");return e.varType=this.varType,e.varName=this.varName,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new hh),t.varType=e.varType,t.varName=e.varName,t}run(e){const t=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");e?t.createVariable(this.varName,this.varType,this.varId):t.deleteVariableById(this.varId)}};r(z.EVENT,M.VAR_CREATE,hh);var Yn=class{constructor(e,t,o,n){this.workspace=e,this.name=t,this.type=o||"",this.id=n||S()}getId(){return this.id}static compareByName(e,t){return e.name.localeCompare(t.name,void 0,{sensitivity:"base"})}},ph="VARIABLE",gh="ijkmnopqrstuvwxyzabcdefgh",mb={generateUniqueNameInternal:Sm},It={CATEGORY_NAME:ph,TEST_ONLY:mb,VAR_LETTER_OPTIONS:gh};It.allDeveloperVariables=i.allDeveloperVariables$$module$build$src$core$variables,It.allUsedVarModels=i.allUsedVarModels$$module$build$src$core$variables,It.createVariableButtonHandler=$i,It.flyoutCategory=ra,It.flyoutCategoryBlocks=Qc,It.generateUniqueName=eu,It.generateUniqueNameFromOptions=aa,It.generateVariableFieldDom=Mo,It.getAddedVariables=kn,It.getOrCreateVariablePackage=i.getOrCreateVariablePackage$$module$build$src$core$variables,It.getVariable=i.getVariable$$module$build$src$core$variables,It.nameUsedWithAnyType=tu,It.nameUsedWithConflictingParam=su,It.promptName=la,It.renameVariable=i.renameVariable$$module$build$src$core$variables;var Ri=class extends Error{},fb=class extends Ri{constructor(e){super("Expected to find a 'type' property, defining the block type"),this.state=e}},Jn=class extends Ri{constructor(e,t,o){super(`The block ${t.toDevString()} is missing a(n) ${e}
767
+ connection`),this.block=t,this.state=o}},$b=class extends Ri{constructor(e,t,o,n){super(`The block ${o.toDevString()} could not connect its
768
+ ${t} to its parent, because: ${e}`),this.childBlock=o,this.childState=n}},bb=class extends Ri{constructor(e){super(`Encountered a real block which is defined as a child of a shadow
769
+ block. It is an invariant of Blockly that shadow blocks only have shadow
770
+ children`),this.state=e}},vb=class extends Ri{constructor(e,t,o){super(`Cannot add an icon of type '${e}' to the block ${t.toDevString()}, because there is no icon registered with type '${e}'. Make sure that all of your icons have been registered.`),this.block=t,this.state=o}},Ko={};Ko.BadConnectionCheck=$b,Ko.DeserializationError=Ri,Ko.MissingBlockType=fb,Ko.MissingConnection=Jn,Ko.RealChildOfShadow=bb,Ko.UnregisteredIcon=vb;var yb=class{constructor(){this.priority=rb}save(e){const t=[];for(const o of e.getTopBlocks(!1))(e=Gt(o,{addCoordinates:!0,doFullSerialization:!1}))&&t.push(e);return t.length?{languageVersion:0,blocks:t}:null}load(e,t){e=e.blocks;for(const o of e)Vs(o,t,{recordUndo:$e()})}clear(e){for(const t of e.getTopBlocks(!1))t.dispose(!1)}};_n("blocks",new yb);var Xn={};Xn.BlockSerializer=yb,Xn.append=Vs,Xn.appendInternal=bi,Xn.save=Gt;var $t=class{constructor(e){this.name=e}toString(){return this.name}equals(e){return this.name===e.toString()}};$t.MUTATOR=new $t("mutator"),$t.WARNING=new $t("warning"),$t.COMMENT=new $t("comment");var Yo=class extends Ii{constructor(e){super(),this.isBlank=!e,e&&(this.blockId=e.id,this.workspaceId=e.workspace.id)}toJson(){const e=super.toJson();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");return e.blockId=this.blockId,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Yo),t.blockId=e.blockId,t}},Jo=class extends Yo{constructor(e,t,o,n,c){super(e),this.type=M.BLOCK_CHANGE,e&&(this.element=t,this.name=o||void 0,this.oldValue=n,this.newValue=c)}toJson(){const e=super.toJson();if(!this.element)throw Error("The changed element is undefined. Either pass an element to the constructor, or call fromJson");return e.element=this.element,e.name=this.name,e.oldValue=this.oldValue,e.newValue=this.newValue,this.disabledReason&&(e.disabledReason=this.disabledReason),e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Jo),t.element=e.element,t.name=e.name,t.oldValue=e.oldValue,t.newValue=e.newValue,e.disabledReason!==void 0&&(t.disabledReason=e.disabledReason),t}setDisabledReason(e){if(this.element!=="disabled")throw Error('Cannot set the disabled reason for a BlockChange event if the element is not "disabled".');this.disabledReason=e}isNull(){return this.oldValue===this.newValue}run(e){var t=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");if(t=t.getBlockById(this.blockId),!t)throw Error("The associated block is undefined. Either pass a block to the constructor, or call fromJson");const o=t.getIcon($t.MUTATOR);switch(o&&vi(o)&&o.bubbleIsVisible()&&o.setBubbleVisible(!1),e=e?this.newValue:this.oldValue,this.element){case"field":(t=t.getField(this.name))?t.setValue(e):console.warn("Can't set non-existent field: "+this.name);break;case"comment":t.setCommentText(e||null);break;case"collapsed":t.setCollapsed(!!e);break;case"disabled":var n;t.setDisabledReason(!!e,(n=this.disabledReason)!=null?n:Lt);break;case"inline":t.setInputsInline(!!e);break;case"mutation":n=Jo.getExtraBlockState_(t),t.loadExtraState?t.loadExtraState(JSON.parse(e||"{}")):t.domToMutation&&t.domToMutation(i.textToDom$$module$build$src$core$utils$xml(e||"<mutation/>")),U(new Jo(t,"mutation",null,n,e));break;default:console.warn("Unknown change type: "+this.element)}}static getExtraBlockState_(e){return e.saveExtraState?(e=e.saveExtraState(!0))?JSON.stringify(e):"":e.mutationToDom&&(e=e.mutationToDom())?Es(e):""}};r(z.EVENT,M.BLOCK_CHANGE,Jo);var Ja={};Ja.clamp=yi,Ja.toDegrees=Ym,Ja.toRadians=ca;var Xa=16,_b=1,wb=12,mh=16,qa=.25,fh=null,Xo=null,Oi="",Mi="",Ue,Ni,qo,$h=null,vo=null,Cb=null,bh={getBoundsInfo:function(){const e=co($h),t=bn($h);return{left:e.x,right:e.x+t.width,top:e.y,bottom:e.y+t.height,width:t.width,height:t.height}},getPositionMetrics:function(e,t,o,n){const c=bh.getBoundsInfo(),h=bn(Ue);return t+h.height<c.bottom?mu(e,t,c,h):n-h.height>c.top?fu(o,n,c,h):t+h.height<document.documentElement.clientHeight?mu(e,t,c,h):n-h.height>document.documentElement.clientTop?fu(o,n,c,h):Xm(e,c,h)}},At={ANIMATION_TIME:qa,ARROW_HORIZONTAL_PADDING:wb,ARROW_SIZE:Xa,BORDER_SIZE:_b,PADDING_Y:mh,TEST_ONLY:bh};At.clearContent=ua,At.createDom=ru,At.getContentDiv=Sn,At.getOwner=lu,At.getPositionX=En,At.hide=ha,At.hideIfOwner=da,At.hideWithoutAnimation=Ss,At.isVisible=$u,At.repositionForWindowResize=vu,At.setBoundsElement=au,At.setColour=cu,At.show=gu,At.showPositionedByBlock=Jm,At.showPositionedByField=uu;var qn=class{constructor(e){this.workspace=e,this.cursorSvg=this.cursor=null,this.markers=new Map,this.markerSvg=null}registerMarker(e,t){this.markers.has(e)&&this.unregisterMarker(e),t.setDrawer(this.workspace.getRenderer().makeMarkerDrawer(this.workspace,t)),this.setMarkerSvg(t.getDrawer().createDom()),this.markers.set(e,t)}unregisterMarker(e){const t=this.markers.get(e);if(t)t.dispose(),this.markers.delete(e);else throw Error("Marker with ID "+e+" does not exist. Can only unregister markers that exist.")}getCursor(){return this.cursor}getMarker(e){return this.markers.get(e)||null}setCursor(e){this.cursor&&this.cursor.getDrawer()&&this.cursor.getDrawer().dispose(),(this.cursor=e)&&(e=this.workspace.getRenderer().makeMarkerDrawer(this.workspace,this.cursor),this.cursor.setDrawer(e),this.setCursorSvg(this.cursor.getDrawer().createDom()))}setCursorSvg(e){e?(this.workspace.getBlockCanvas().appendChild(e),this.cursorSvg=e):this.cursorSvg=null}setMarkerSvg(e){e?this.workspace.getBlockCanvas()&&(this.cursorSvg?this.workspace.getBlockCanvas().insertBefore(e,this.cursorSvg):this.workspace.getBlockCanvas().appendChild(e)):this.markerSvg=null}updateMarkers(){this.workspace.keyboardAccessibilityMode&&this.cursorSvg&&this.workspace.getCursor().draw()}dispose(){const e=Object.keys(this.markers);for(let t=0,o;o=e[t];t++)this.unregisterMarker(o);this.markers.clear(),this.cursor&&(this.cursor.dispose(),this.cursor=null)}};qn.LOCAL_MARKER="local_marker_1";var Li={};Li.commonWordPrefix=yu,Li.commonWordSuffix=_u,Li.isNumber=i.isNumber$$module$build$src$core$utils$string,Li.shortestStringLength=In,Li.wrap=i.wrap$$module$build$src$core$utils$string;var Za=void 0,Zn=!1,Bi=!1,Tb=50,kb=0,Zo=0,vh=0,yh=0,es=null,Qn=null,_h=0,wh=10,Sb=10,Eb=750,Qa=5,bt=null,Yt={HOVER_MS:Eb,LIMIT:Tb,MARGINS:Qa,OFFSET_X:_h,OFFSET_Y:wh,RADIUS_OK:Sb};Yt.bindMouseEvents=wi,Yt.block=Eu,Yt.createDom=Tu,Yt.dispose=Su,Yt.getCustomTooltip=ef,Yt.getDiv=sf,Yt.getTooltipOfObject=_i,Yt.hide=Gs,Yt.isVisible=tf,Yt.setCustomTooltip=Qm,Yt.unbindMouseEvents=ga,Yt.unblock=Iu;var Ch=.45,Th=.65,Ib={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00"},ts={};ts.blend=Lo,ts.getHsvSaturation=xu,ts.getHsvValue=Du,ts.hexToRgb=ma,ts.hsvToHex=fa,ts.hueToHex=Au,ts.names=Ib,ts.parse=No,ts.rgbToHex=xn,ts.setHsvSaturation=uf,ts.setHsvValue=df;var er={};er.checkMessageReferences=hf,er.parseBlockColour=Ci,er.replaceMessageReferences=ht,er.tokenizeInterpolation=Ru;var Ze=class{constructor(e,t,o){this.DEFAULT_VALUE=null,this.name=void 0,this.constants_=this.mouseDownWrapper=this.textContent_=this.textElement_=this.borderRect_=this.fieldGroup_=this.markerSvg=this.cursorSvg=this.tooltip=this.validator_=null,this.disposed=!1,this.maxDisplayLength=50,this.sourceBlock_=null,this.enabled_=this.visible_=this.isDirty_=!0,this.suffixField=this.prefixField=this.clickTarget_=null,this.EDITABLE=!0,this.SERIALIZABLE=!1,this.CURSOR="",this.value_="DEFAULT_VALUE"in new.target.prototype?new.target.prototype.DEFAULT_VALUE:this.DEFAULT_VALUE,this.size_=new Le(0,0),e!==Ze.SKIP_SETUP&&(o&&this.configure_(o),this.setValue(e),t&&this.setValidator(t))}configure_(e){e.tooltip&&this.setTooltip(ht(e.tooltip))}setSourceBlock(e){if(this.sourceBlock_)throw Error("Field already bound to a block");this.sourceBlock_=e}getConstants(){return!this.constants_&&this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()&&this.sourceBlock_.workspace.rendered&&(this.constants_=this.sourceBlock_.workspace.getRenderer().getConstants()),this.constants_}getSourceBlock(){return this.sourceBlock_}init(){this.fieldGroup_||(this.fieldGroup_=L(D.G,{}),this.isVisible()||(this.fieldGroup_.style.display="none"),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_),this.initView(),this.updateEditable(),this.setTooltip(this.tooltip),this.bindEvents_(),this.initModel(),this.applyColour())}initView(){this.createBorderRect_(),this.createTextElement_()}initModel(){}isFullBlockField(){return!this.borderRect_}createBorderRect_(){this.borderRect_=L(D.RECT,{rx:this.getConstants().FIELD_BORDER_RECT_RADIUS,ry:this.getConstants().FIELD_BORDER_RECT_RADIUS,x:0,y:0,height:this.size_.height,width:this.size_.width,class:"blocklyFieldRect"},this.fieldGroup_)}createTextElement_(){this.textElement_=L(D.TEXT,{class:"blocklyText"},this.fieldGroup_),this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.textElement_.setAttribute("dominant-baseline","central"),this.textContent_=document.createTextNode(""),this.textElement_.appendChild(this.textContent_)}bindEvents_(){const e=this.getClickTarget_();if(!e)throw Error("A click target has not been set.");wi(e),this.mouseDownWrapper=Q(e,"pointerdown",this,this.onMouseDown_)}fromXml(e){this.setValue(e.textContent)}toXml(e){return e.textContent=this.getValue(),e}saveState(e){return e=this.saveLegacyState(Ze),e!==null?e:this.getValue()}loadState(e){this.loadLegacyState(Ze,e)||this.setValue(e)}saveLegacyState(e){return e.prototype.saveState===this.saveState&&e.prototype.toXml!==this.toXml?(e=i.createElement$$module$build$src$core$utils$xml("field"),e.setAttribute("name",this.name||""),gi(this.toXml(e)).replace(' xmlns="https://developers.google.com/blockly/xml"',"")):null}loadLegacyState(e,t){return e.prototype.loadState===this.loadState&&e.prototype.fromXml!==this.fromXml?(this.fromXml(i.textToDom$$module$build$src$core$utils$xml(t)),!0):!1}dispose(){da(this),Po(this);let e;(e=this.getSourceBlock())!=null&&e.isDeadOrDying()||Ge(this.fieldGroup_),this.disposed=!0}updateEditable(){const e=this.fieldGroup_,t=this.getSourceBlock();this.EDITABLE&&e&&t&&(this.enabled_&&t.isEditable()?(fe(e,"blocklyEditableText"),st(e,"blocklyNonEditableText"),e.style.cursor=this.CURSOR):(fe(e,"blocklyNonEditableText"),st(e,"blocklyEditableText"),e.style.cursor=""))}setEnabled(e){this.enabled_=e,this.updateEditable()}isEnabled(){return this.enabled_}isClickable(){return this.enabled_&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&this.showEditor_!==Ze.prototype.showEditor_}isClickableInFlyout(e){return!e}isCurrentlyEditable(){return this.enabled_&&this.EDITABLE&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()}isSerializable(){let e=!1;return this.name&&(this.SERIALIZABLE?e=!0:this.EDITABLE&&(console.warn("Detected an editable field that was not serializable. Please define SERIALIZABLE property as true on all editable custom fields. Proceeding with serialization."),e=!0)),e}isVisible(){return this.visible_}setVisible(e){if(this.visible_!==e){this.visible_=e;var t=this.fieldGroup_;t&&(t.style.display=e?"block":"none")}}setValidator(e){this.validator_=e}getValidator(){return this.validator_}getSvgRoot(){return this.fieldGroup_}getBorderRect(){if(!this.borderRect_)throw Error(`The border rectangle is ${this.borderRect_}.`);return this.borderRect_}getTextElement(){if(!this.textElement_)throw Error(`The text element is ${this.textElement_}.`);return this.textElement_}getTextContent(){if(!this.textContent_)throw Error(`The text content is ${this.textContent_}.`);return this.textContent_}applyColour(){}render_(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_()}showEditor(e){this.isClickable()&&this.showEditor_(e)}showEditor_(e){}repositionForWindowResize(){return!1}updateSize_(e){const t=this.getConstants();e=e!==void 0?e:this.isFullBlockField()?0:this.getConstants().FIELD_BORDER_RECT_X_PADDING;let o=2*e,n=t.FIELD_TEXT_HEIGHT,c=0;this.textElement_&&(c=$n(this.textElement_,t.FIELD_TEXT_FONTSIZE,t.FIELD_TEXT_FONTWEIGHT,t.FIELD_TEXT_FONTFAMILY),o+=c),this.isFullBlockField()||(n=Math.max(n,t.FIELD_BORDER_RECT_HEIGHT)),this.size_.height=n,this.size_.width=o,this.positionTextElement_(e,c),this.positionBorderRect_()}positionTextElement_(e,t){if(this.textElement_){var o=this.getConstants(),n=this.size_.height/2,c;this.textElement_.setAttribute("x",String((c=this.getSourceBlock())!=null&&c.RTL?this.size_.width-t-e:e)),this.textElement_.setAttribute("y",String(o.FIELD_TEXT_BASELINE_CENTER?n:n-o.FIELD_TEXT_HEIGHT/2+o.FIELD_TEXT_BASELINE))}}positionBorderRect_(){this.borderRect_&&(this.borderRect_.setAttribute("width",String(this.size_.width)),this.borderRect_.setAttribute("height",String(this.size_.height)),this.borderRect_.setAttribute("rx",String(this.getConstants().FIELD_BORDER_RECT_RADIUS)),this.borderRect_.setAttribute("ry",String(this.getConstants().FIELD_BORDER_RECT_RADIUS)))}getSize(){return this.isVisible()?(this.isDirty_?(this.render_(),this.isDirty_=!1):this.visible_&&this.size_.width===0&&(this.render_(),this.size_.width!==0&&console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead.")),this.size_):new Le(0,0)}getScaledBBox(){let e;var t=this.getSourceBlock();if(!t)throw new mt;if(this.isFullBlockField()){var o=this.sourceBlock_.getHeightWidth();const n=t.workspace.scale;e=this.getAbsoluteXY_(),t=(o.width+1)*n,o=(o.height+1)*n,V$?(e.x+=1.5*n,e.y+=1.5*n):(e.x-=.5*n,e.y-=.5*n)}else o=this.borderRect_.getBoundingClientRect(),e=co(this.borderRect_),t=o.width,o=o.height;return new Je(e.y,e.y+o,e.x,e.x+t)}onLocationChange(e){}getDisplayText_(){let e=this.getText();return e?(e.length>this.maxDisplayLength&&(e=e.substring(0,this.maxDisplayLength-2)+"…"),e=e.replace(/\s/g,Ze.NBSP),this.sourceBlock_&&this.sourceBlock_.RTL&&(e+="‏"),e):Ze.NBSP}getText(){const e=this.getText_();return String(e!==null?e:this.getValue())}getText_(){return null}markDirty(){this.isDirty_=!0,this.constants_=null}forceRerender(){this.isDirty_=!0,this.sourceBlock_&&this.sourceBlock_.rendered&&this.sourceBlock_.queueRender()}setValue(e,t=!0){if(e!==null){var o=i.getGroup$$module$build$src$core$events$utils();o||i.setGroup$$module$build$src$core$events$utils(!0);try{const B=this.doClassValidation_(e),oe=this.processValidation(e,B,t);if(!(oe instanceof Error)){var n,c=(n=this.getValidator())==null?void 0:n.call(this,oe),h=this.processValidation(oe,c,t);if(!(h instanceof Error)){var $=this.sourceBlock_;if(!$||!$.disposed){var T=this.getValue();T===h?this.doValueUpdate_(h):(this.doValueUpdate_(h),t&&$&&J()&&U(new(Y(M.BLOCK_CHANGE))($,"field",this.name||null,T,h)),this.isDirty_&&this.forceRerender())}}}}finally{i.setGroup$$module$build$src$core$events$utils(o)}}}processValidation(e,t,o){return t===null?(this.doValueInvalid_(e,o),this.isDirty_&&this.forceRerender(),Error()):t===void 0?e:t}getValue(){return this.value_}doClassValidation_(e){return e??null}doValueUpdate_(e){this.value_=e,this.isDirty_=!0}doValueInvalid_(e,t){}onMouseDown_(e){this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()&&(e=this.sourceBlock_.workspace.getGesture(e))&&e.setStartField(this)}setTooltip(e){e||e===""||(e=this.sourceBlock_);const t=this.getClickTarget_();t?t.tooltip=e:this.tooltip=e}getTooltip(){const e=this.getClickTarget_();return _i(e||{tooltip:this.tooltip})}getClickTarget_(){return this.clickTarget_||this.getSvgRoot()}getAbsoluteXY_(){return co(this.getClickTarget_())}referencesVariables(){return!1}refreshVariableName(){}getParentInput(){let e=null;const t=this.getSourceBlock();if(!t)throw new mt;const o=t.inputList;for(let n=0;n<t.inputList.length;n++){const c=o[n],h=c.fieldRow;for(let $=0;$<h.length;$++)if(h[$]===this){e=c;break}}return e}getFlipRtl(){return!1}isTabNavigable(){return!1}onShortcut(e){return!1}setCursorSvg(e){if(e){if(!this.fieldGroup_)throw Error(`The field group is ${this.fieldGroup_}.`);this.fieldGroup_.appendChild(e),this.cursorSvg=e}else this.cursorSvg=null}setMarkerSvg(e){if(e){if(!this.fieldGroup_)throw Error(`The field group is ${this.fieldGroup_}.`);this.fieldGroup_.appendChild(e),this.markerSvg=e}else this.markerSvg=null}updateMarkers_(){var e=this.getSourceBlock();if(!e)throw new mt;e=e.workspace,e.keyboardAccessibilityMode&&this.cursorSvg&&e.getCursor().draw(),e.keyboardAccessibilityMode&&this.markerSvg&&e.getMarker(qn.LOCAL_MARKER).draw()}static fromJson(e){throw Error("Attempted to instantiate a field from the registry that hasn't defined a 'fromJson' method.")}};Ze.NBSP=" ",Ze.SKIP_SETUP=Symbol("SKIP_SETUP");var mt=class extends Error{constructor(){super("The field has not yet been attached to its input. Call appendField to attach it.")}},Pi=null,kh=null,el=null,tl="blocklyWidgetDiv",Fi="",ji="",$s,bs={};bs.createDom=Ou,bs.getDiv=Bo,bs.hide=Ti,bs.hideIfOwner=Po,bs.hideIfOwnerIsInWorkspace=Dn,bs.isVisible=Mu,bs.positionWithAnchor=Lu,bs.repositionForWindowResize=Bu,bs.show=ba,bs.testOnly_setDiv=pf;var sl=null,xb={},ol=null,Qo={};Qo.callbackFactory=i.callbackFactory$$module$build$src$core$contextmenu,Qo.dispose=Fu,Qo.getCurrentBlock=$f,Qo.hide=Rn,Qo.setCurrentBlock=Pu,Qo.show=An;var Ae=class{constructor(){this.registeredItems=new Map,this.reset()}reset(){this.registeredItems.clear()}register(e){if(this.registeredItems.has(e.id))throw Error('Menu item with ID "'+e.id+'" is already registered.');this.registeredItems.set(e.id,e)}unregister(e){if(!this.registeredItems.has(e))throw Error('Menu item with ID "'+e+'" not found.');this.registeredItems.delete(e)}getItem(e){let t;return(t=this.registeredItems.get(e))!=null?t:null}getContextMenuOptions(e,t){const o=[];for(const c of this.registeredItems.values())if(e===c.scopeType){var n=c.preconditionFn(t);n!=="hidden"&&(n={text:typeof c.displayText=="function"?c.displayText(t):c.displayText,enabled:n==="enabled",callback:c.callback,scope:t,weight:c.weight},o.push(n))}return o.sort(function(c,h){return c.weight-h.weight}),o}};(function(e){var t=e.ScopeType||(e.ScopeType={});t.BLOCK="block",t.WORKSPACE="workspace",t.COMMENT="comment",e.registry=new e})(Ae||(Ae={})),Ae.ScopeType;var yo=50,il=100,JC={BLOCK:yo,BUBBLE:il},Db=class{constructor(e){this.comment=e,this.startLoc=null,this.inGroup=!1,this.workspace=e.workspace}isMovable(){return this.comment.isOwnMovable()&&!this.comment.isDeadOrDying()&&!this.workspace.options.readOnly}startDrag(){(this.inGroup=!!i.getGroup$$module$build$src$core$events$utils())||i.setGroup$$module$build$src$core$events$utils(!0),this.fireDragStartEvent(),this.startLoc=this.comment.getRelativeToSurfaceXY(),this.workspace.setResizesEnabled(!1);let e;(e=this.workspace.getLayerManager())==null||e.moveToDragLayer(this.comment),this.comment.setDragging(!0)}drag(e){this.comment.moveDuringDrag(e)}endDrag(){this.fireDragEndEvent(),this.fireMoveEvent();let e;(e=this.workspace.getLayerManager())==null||e.moveOffDragLayer(this.comment,yo),this.comment.setDragging(!1),this.comment.snapToGrid(),this.workspace.setResizesEnabled(!0),this.inGroup||i.setGroup$$module$build$src$core$events$utils(!1)}fireDragStartEvent(){const e=new(Y(M.COMMENT_DRAG))(this.comment,!0);U(e)}fireDragEndEvent(){const e=new(Y(M.COMMENT_DRAG))(this.comment,!1);U(e)}fireMoveEvent(){if(!this.comment.isDeadOrDying()){var e=new(Y(M.COMMENT_MOVE))(this.comment);e.setReason(["drag"]),e.oldCoordinate_=this.startLoc,e.recordNew(),U(e)}}revertDrag(){this.startLoc&&this.comment.moveDuringDrag(this.startLoc)}},Ab=new WeakMap,Rb=class{constructor(e){this.workspace=e,this.size=new Le(120,100),this.collapsed=!1,this.editable=!0,this.location=new K(0,0),this.text="",this.textChangeListeners=[],this.sizeChangeListeners=[],this.disposeListeners=[],this.collapseChangeListeners=[],this.resizePointerMoveListener=this.resizePointerUpListener=null,this.disposed=this.disposing=!1,this.svgRoot=L(D.G,{class:"blocklyComment blocklyEditable blocklyDraggable"}),this.highlightRect=this.createHighlightRect(this.svgRoot),{topBarGroup:this.topBarGroup,topBarBackground:this.topBarBackground,deleteIcon:this.deleteIcon,foldoutIcon:this.foldoutIcon,textPreview:this.textPreview,textPreviewNode:this.textPreviewNode}=this.createTopBar(this.svgRoot,e),{foreignObject:this.foreignObject,textArea:this.textArea}=this.createTextArea(this.svgRoot),this.resizeHandle=this.createResizeHandle(this.svgRoot,e);let t;(t=e.getLayerManager())==null||t.append(this,yo),this.setSizeWithoutFiringEvents(this.size),this.moveTo(new K(0,0))}createHighlightRect(e){return L(D.RECT,{class:"blocklyCommentHighlight"},e)}createTopBar(e,t){e=L(D.G,{class:"blocklyCommentTopbar"},e);const o=L(D.RECT,{class:"blocklyCommentTopbarBackground"},e),n=L(D.IMAGE,{class:"blocklyDeleteIcon",href:`${t.options.pathToMedia}delete-icon.svg`},e);t=L(D.IMAGE,{class:"blocklyFoldoutIcon",href:`${t.options.pathToMedia}foldout-icon.svg`},e);const c=L(D.TEXT,{class:"blocklyCommentPreview blocklyCommentText blocklyText"},e),h=document.createTextNode("");return c.appendChild(h),Q(t,"pointerdown",this,this.onFoldoutDown),Q(n,"pointerdown",this,this.onDeleteDown),{topBarGroup:e,topBarBackground:o,deleteIcon:n,foldoutIcon:t,textPreview:c,textPreviewNode:h}}createTextArea(e){e=L(D.FOREIGNOBJECT,{class:"blocklyCommentForeignObject"},e);const t=document.createElementNS(As,"body");t.setAttribute("xmlns",As),t.className="blocklyMinimalBody";const o=document.createElementNS(As,"textarea");return fe(o,"blocklyCommentText"),fe(o,"blocklyTextarea"),fe(o,"blocklyText"),t.appendChild(o),e.appendChild(t),Q(o,"change",this,this.onTextChange),{foreignObject:e,textArea:o}}createResizeHandle(e,t){return e=L(D.IMAGE,{class:"blocklyResizeHandle",href:`${t.options.pathToMedia}resize-handle.svg`},e),Q(e,"pointerdown",this,this.onResizePointerDown),e}getSvgRoot(){return this.svgRoot}getSize(){return this.collapsed?this.topBarBackground.getBBox():this.size}setSizeWithoutFiringEvents(e){const t=this.topBarBackground.getBBox(),o=this.deleteIcon.getBBox(),n=this.foldoutIcon.getBBox(),c=this.textPreview.getBBox(),h=this.resizeHandle.getBBox();this.size=e=Le.max(e,this.calcMinSize(t,n,o)),this.svgRoot.setAttribute("height",`${e.height}`),this.svgRoot.setAttribute("width",`${e.width}`),this.updateHighlightRect(e),this.updateTopBarSize(e),this.updateTextAreaSize(e,t),this.updateDeleteIconPosition(e,t,o),this.updateFoldoutIconPosition(t,n),this.updateTextPreviewSize(e,t,c,o,h),this.updateResizeHandlePosition(e,h)}setSize(e){const t=this.preResizeSize||this.size;this.setSizeWithoutFiringEvents(e),this.onSizeChange(t,this.size)}calcMinSize(e,t,o){var n;this.updateTextPreview((n=this.textArea.value)!=null?n:""),n=Fc(this.textPreview);const c=this.calcFoldoutMargin(e,t),h=this.calcDeleteMargin(e,o);let $=n;return this.foldoutIcon.checkVisibility()?$+=t.width+2*c:n&&($+=4),this.deleteIcon.checkVisibility()?$+=o.width+2*h:n&&($+=4),new Le($,e.height+20)}calcDeleteMargin(e,t){return(e.height-t.height)/2}calcFoldoutMargin(e,t){return(e.height-t.height)/2}updateHighlightRect(e){this.highlightRect.setAttribute("height",`${e.height}`),this.highlightRect.setAttribute("width",`${e.width}`),this.workspace.RTL&&this.highlightRect.setAttribute("x",`${-e.width}`)}updateTopBarSize(e){this.topBarBackground.setAttribute("width",`${e.width}`)}updateTextAreaSize(e,t){this.foreignObject.setAttribute("height",`${e.height-t.height}`),this.foreignObject.setAttribute("width",`${e.width}`),this.foreignObject.setAttribute("y",`${t.height}`),this.workspace.RTL&&this.foreignObject.setAttribute("x",`${-e.width}`)}updateDeleteIconPosition(e,t,o){t=this.calcDeleteMargin(t,o),this.deleteIcon.setAttribute("y",`${t}`),this.deleteIcon.setAttribute("x",`${e.width-o.width-t}`)}updateFoldoutIconPosition(e,t){e=this.calcFoldoutMargin(e,t),this.foldoutIcon.setAttribute("y",`${e}`),this.foldoutIcon.setAttribute("x",`${e}`)}updateTextPreviewSize(e,t,o,n,c){const h=(t.height-o.height)/2,$=this.calcDeleteMargin(t,n);t=this.calcFoldoutMargin(t,c),e=e.width-c.width-2*t-n.width-2*$,this.textPreview.setAttribute("x",`${c.width+2*t*(this.workspace.RTL?-1:1)}`),this.textPreview.setAttribute("y",`${h+o.height/2}`),this.textPreview.setAttribute("width",`${e}`)}updateResizeHandlePosition(e,t){this.resizeHandle.setAttribute("y",`${e.height-t.height}`),this.resizeHandle.setAttribute("x",`${e.width-t.width}`)}onSizeChange(e,t){for(let o=this.sizeChangeListeners.length-1;0<=o;o--)this.sizeChangeListeners[o](e,t)}addSizeChangeListener(e){this.sizeChangeListeners.push(e)}removeSizeChangeListener(e){this.sizeChangeListeners.splice(this.sizeChangeListeners.indexOf(e),1)}onResizePointerDown(e){this.isEditable()&&(this.bringToFront(),_e(e)||(this.preResizeSize=this.getSize(),va(this.workspace,e,new K(this.workspace.RTL?-this.getSize().width:this.getSize().width,this.getSize().height)),this.resizePointerUpListener=Q(document,"pointerup",this,this.onResizePointerUp),this.resizePointerMoveListener=Q(document,"pointermove",this,this.onResizePointerMove),this.workspace.hideChaff()),e.stopPropagation())}onResizePointerUp(e){Ee(),this.resizePointerUpListener&&(ze(this.resizePointerUpListener),this.resizePointerUpListener=null),this.resizePointerMoveListener&&(ze(this.resizePointerMoveListener),this.resizePointerMoveListener=null),this.setSize(this.size),this.preResizeSize=void 0}onResizePointerMove(e){e=ya(this.workspace,e),this.setSizeWithoutFiringEvents(new Le(this.workspace.RTL?-e.x:e.x,e.y))}isCollapsed(){return this.collapsed}setCollapsed(e){(this.collapsed=e)?fe(this.svgRoot,"blocklyCollapsed"):st(this.svgRoot,"blocklyCollapsed"),this.setSizeWithoutFiringEvents(this.size),this.onCollapse()}onCollapse(){for(let e=this.collapseChangeListeners.length-1;0<=e;e--)this.collapseChangeListeners[e](this.collapsed)}addOnCollapseListener(e){this.collapseChangeListeners.push(e)}removeOnCollapseListener(e){this.collapseChangeListeners.splice(this.collapseChangeListeners.indexOf(e),1)}onFoldoutDown(e){Ee(),this.bringToFront(),_e(e)||(this.setCollapsed(!this.collapsed),this.workspace.hideChaff()),e.stopPropagation()}isEditable(){return this.editable}setEditable(e){(this.editable=e)?(fe(this.svgRoot,"blocklyEditable"),st(this.svgRoot,"blocklyReadonly"),this.textArea.removeAttribute("readonly")):(st(this.svgRoot,"blocklyEditable"),fe(this.svgRoot,"blocklyReadonly"),this.textArea.setAttribute("readonly","true"))}getRelativeToSurfaceXY(){return this.location}moveTo(e){this.location=e,this.svgRoot.setAttribute("transform",`translate(${e.x}, ${e.y})`)}getText(){return this.text}setText(e){this.textArea.value=e,this.onTextChange()}addTextChangeListener(e){this.textChangeListeners.push(e)}removeTextChangeListener(e){this.textChangeListeners.splice(this.textChangeListeners.indexOf(e),1)}onTextChange(){const e=this.text;this.text=this.textArea.value,this.updateTextPreview(this.text),this.setSize(this.size);for(let t=this.textChangeListeners.length-1;0<=t;t--)this.textChangeListeners[t](e,this.text)}updateTextPreview(e){this.textPreviewNode.textContent=this.truncateText(e)}truncateText(e){return 12<=e.length?`${e.substring(0,9)}...`:e}bringToFront(){const e=this.svgRoot.parentNode,t=e.childNodes;t[t.length-1]!==this.svgRoot&&e.appendChild(this.svgRoot)}onDeleteDown(e){Ee(),_e(e)||this.dispose(),e.stopPropagation()}dispose(){this.disposing=!0,Ge(this.svgRoot);for(let e=this.disposeListeners.length-1;0<=e;e--)this.disposeListeners[e]();this.disposed=!0}isDisposed(){return this.disposed}isDeadOrDying(){return this.disposing||this.disposed}addDisposeListener(e){this.disposeListeners.push(e)}removeDisposeListener(e){this.disposeListeners.splice(this.disposeListeners.indexOf(e),1)}};Tt(`
771
+ .injectionDiv {
772
+ --commentFillColour: #FFFCC7;
773
+ --commentBorderColour: #F2E49B;
774
+ }
775
+
776
+ .blocklyComment .blocklyTextarea {
777
+ background-color: var(--commentFillColour);
778
+ border: 1px solid var(--commentBorderColour);
779
+ box-sizing: border-box;
780
+ display: block;
781
+ outline: 0;
782
+ padding: 5px;
783
+ resize: none;
784
+ width: 100%;
785
+ height: 100%;
786
+ }
787
+
788
+ .blocklyReadonly.blocklyComment .blocklyTextarea {
789
+ cursor: inherit;
790
+ }
791
+
792
+ .blocklyDeleteIcon {
793
+ width: 20px;
794
+ height: 20px;
795
+ display: none;
796
+ cursor: pointer;
797
+ }
798
+
799
+ .blocklyFoldoutIcon {
800
+ width: 20px;
801
+ height: 20px;
802
+ transform-origin: 12px 12px;
803
+ cursor: pointer;
804
+ }
805
+ .blocklyResizeHandle {
806
+ width: 12px;
807
+ height: 12px;
808
+ cursor: se-resize;
809
+ }
810
+ .blocklyReadonly.blocklyComment .blocklyResizeHandle {
811
+ cursor: inherit;
812
+ }
813
+
814
+ .blocklyCommentTopbarBackground {
815
+ fill: var(--commentBorderColour);
816
+ height: 24px;
817
+ }
818
+
819
+ .blocklyComment .blocklyCommentPreview.blocklyText {
820
+ fill: #000;
821
+ dominant-baseline: middle;
822
+ visibility: hidden;
823
+ }
824
+
825
+ .blocklyCollapsed.blocklyComment .blocklyCommentPreview {
826
+ visibility: visible;
827
+ }
828
+
829
+ .blocklyCollapsed.blocklyComment .blocklyCommentForeignObject,
830
+ .blocklyCollapsed.blocklyComment .blocklyResizeHandle {
831
+ display: none;
832
+ }
833
+
834
+ .blocklyCollapsed.blocklyComment .blocklyFoldoutIcon {
835
+ transform: rotate(-90deg);
836
+ }
837
+
838
+ .blocklyRTL .blocklyCommentTopbar {
839
+ transform: scale(-1, 1);
840
+ }
841
+
842
+ .blocklyRTL .blocklyCommentForeignObject {
843
+ direction: rtl;
844
+ }
845
+
846
+ .blocklyRTL .blocklyCommentPreview {
847
+ /* Revert the scale and control RTL using direction instead. */
848
+ transform: scale(-1, 1);
849
+ direction: rtl;
850
+ }
851
+
852
+ .blocklyRTL .blocklyResizeHandle {
853
+ transform: scale(-1, 1);
854
+ cursor: sw-resize;
855
+ }
856
+
857
+ .blocklyCommentHighlight {
858
+ fill: none;
859
+ }
860
+
861
+ .blocklySelected .blocklyCommentHighlight {
862
+ stroke: #fc3;
863
+ stroke-width: 3px;
864
+ }
865
+
866
+ .blocklyCollapsed.blocklySelected .blocklyCommentHighlight {
867
+ stroke: none;
868
+ }
869
+
870
+ .blocklyCollapsed.blocklySelected .blocklyCommentTopbarBackground {
871
+ stroke: #fc3;
872
+ stroke-width: 3px;
873
+ }
874
+ `);var nl=class{constructor(e,t){this.workspace=e,this.text="",this.size=new Le(120,100),this.collapsed=!1,this.deletable=this.movable=this.editable=!0,this.location=new K(0,0),this.disposing=this.disposed=!1,this.id=t&&!e.getCommentById(t)?t:S(),e.addTopComment(this),this.fireCreateEvent()}fireCreateEvent(){J()&&U(new(Y(M.COMMENT_CREATE))(this))}fireDeleteEvent(){J()&&U(new(Y(M.COMMENT_DELETE))(this))}fireChangeEvent(e,t){J()&&U(new(Y(M.COMMENT_CHANGE))(this,e,t))}fireCollapseEvent(e){J()&&U(new(Y(M.COMMENT_COLLAPSE))(this,e))}setText(e){const t=this.text;this.text=e,this.fireChangeEvent(t,e)}getText(){return this.text}setSize(e){const t=new(Y(M.COMMENT_RESIZE))(this);this.size=e,t.recordCurrentSizeAsNewSize(),U(t)}getSize(){return this.size}setCollapsed(e){this.collapsed=e,this.fireCollapseEvent(e)}isCollapsed(){return this.collapsed}setEditable(e){this.editable=e}isEditable(){return this.isOwnEditable()&&!this.workspace.options.readOnly}isOwnEditable(){return this.editable}setMovable(e){this.movable=e}isMovable(){return this.isOwnMovable()&&!this.workspace.options.readOnly}isOwnMovable(){return this.movable}setDeletable(e){this.deletable=e}isDeletable(){return this.isOwnDeletable()&&!this.isDeadOrDying()&&!this.workspace.options.readOnly}isOwnDeletable(){return this.deletable}moveTo(e,t){const o=new(Y(M.COMMENT_MOVE))(this);t&&o.setReason(t),this.location=e,o.recordNew(),U(o)}getRelativeToSurfaceXY(){return this.location}dispose(){this.disposing=!0,this.fireDeleteEvent(),this.workspace.removeTopComment(this),this.disposed=!0}isDisposed(){return this.disposed}isDeadOrDying(){return this.disposing||this.disposed}},rl=class extends nl{constructor(e,t){super(e,t),this.dragStrategy=new Db(this),this.workspace=e,this.view=new Rb(e),this.view.setSize(this.getSize()),this.view.setEditable(this.isEditable()),this.view.getSvgRoot().setAttribute("data-id",this.id),this.addModelUpdateBindings(),Q(this.view.getSvgRoot(),"pointerdown",this,this.startGesture),Q(this.view.getSvgRoot(),"wheel",this,o=>{o.stopPropagation()})}addModelUpdateBindings(){this.view.addTextChangeListener((e,t)=>void super.setText(t)),this.view.addSizeChangeListener((e,t)=>void super.setSize(t)),this.view.addOnCollapseListener(()=>void super.setCollapsed(this.view.isCollapsed())),this.view.addDisposeListener(()=>{this.isDeadOrDying()||this.dispose()})}setText(e){this.view.setText(e)}setSize(e){this.view.setSize(e)}setCollapsed(e){this.view.setCollapsed(e)}setEditable(e){super.setEditable(e),this.view.setEditable(this.isEditable())}getSvgRoot(){return this.view.getSvgRoot()}getSize(){return super.getSize()}getBoundingRectangle(){const e=this.getRelativeToSurfaceXY();var t,o;const n=(o=(t=this.view)==null?void 0:t.getSize())!=null?o:this.getSize();return this.workspace.RTL?(t=e.x-n.width,o=e.x):(t=e.x,o=e.x+n.width),new Je(e.y,e.y+n.height,t,o)}moveBy(e,t,o){const n=this.getRelativeToSurfaceXY();e=new K(n.x+e,n.y+t),this.moveTo(e,o)}moveTo(e,t){super.moveTo(e,t),this.view.moveTo(e)}moveDuringDrag(e){this.location=e,this.view.moveTo(e)}setDragging(e){e?fe(this.getSvgRoot(),"blocklyDragging"):st(this.getSvgRoot(),"blocklyDragging")}dispose(){this.disposing=!0,this.view.isDeadOrDying()||this.view.dispose(),super.dispose()}startGesture(e){const t=this.workspace.getGesture(e);if(t){if(wt(e))e.stopPropagation();else{t.handleCommentStart(e,this);let o;(o=this.workspace.getLayerManager())==null||o.append(this,yo)}i.setSelected$$module$build$src$core$common(this)}}setDeleteStyle(e){e?fe(this.getSvgRoot(),"blocklyDraggingDelete"):st(this.getSvgRoot(),"blocklyDraggingDelete")}isMovable(){return this.dragStrategy.isMovable()}startDrag(){this.dragStrategy.startDrag()}drag(e){this.dragStrategy.drag(e)}endDrag(){this.dragStrategy.endDrag()}revertDrag(){this.dragStrategy.revertDrag()}select(){fe(this.getSvgRoot(),"blocklySelected")}unselect(){st(this.getSvgRoot(),"blocklySelected")}toCopyData(){return{paster:Va.TYPE,commentState:mi(this,{addCoordinates:!0})}}showContextMenu(e){const t=Ae.registry.getContextMenuOptions(Ae.ScopeType.COMMENT,{comment:this});An(e,t,this.workspace.RTL,this.workspace)}snapToGrid(){if(!this.isDeadOrDying()){var e=this.workspace.getGrid();if(e!=null&&e.shouldSnap()){var t=this.getRelativeToSurfaceXY();e=e.alignXY(t),e!==t&&this.moveTo(e,["snap"])}}}},Rt={};Rt.appendDomToWorkspace=Ef,Rt.blockToDom=ho,Rt.blockToDomWithXY=Mn,Rt.clearWorkspaceAndLoadFromXml=Sf,Rt.deleteNext=Lf,Rt.domToBlock=i.domToBlock$$module$build$src$core$xml,Rt.domToBlockInternal=Fo,Rt.domToPrettyText=kf,Rt.domToText=Es,Rt.domToVariables=Wu,Rt.domToWorkspace=i.domToWorkspace$$module$build$src$core$xml,Rt.loadWorkspaceComment=Hu,Rt.saveWorkspaceComment=On,Rt.variablesToDom=zu,Rt.workspaceToDom=wf;var Sh=class extends Yo{constructor(e){super(e),this.type=M.BLOCK_CREATE,e&&(e.isShadow()&&(this.recordUndo=!1),this.xml=Mn(e),this.ids=ge(e),this.json=Gt(e,{addCoordinates:!0}))}toJson(){const e=super.toJson();if(!this.xml)throw Error("The block XML is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!this.json)throw Error("The block JSON is undefined. Either pass a block to the constructor, or call fromJson");return e.xml=Es(this.xml),e.ids=this.ids,e.json=this.json,this.recordUndo||(e.recordUndo=this.recordUndo),e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Sh),t.xml=i.textToDom$$module$build$src$core$utils$xml(e.xml),t.ids=e.ids,t.json=e.json,e.recordUndo!==void 0&&(t.recordUndo=e.recordUndo),t}run(e){const t=this.getEventWorkspace_();if(!this.json)throw Error("The block JSON is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!XC(t,this.ids))if(e)Vs(this.json,t);else for(e=0;e<this.ids.length;e++){const o=this.ids[e],n=t.getBlockById(o);n?n.dispose(!1):o===this.blockId&&console.warn("Can't uncreate non-existent block: "+o)}}},XC=function(e,t){return t.map(o=>e.getBlockById(o)).filter(o=>o&&o.isShadow()).length===t.length};r(z.EVENT,M.BLOCK_CREATE,Sh);var Eh=class extends gs{constructor(e,t){super(t),this.type=M.THEME_CHANGE,this.themeName=e}toJson(){const e=super.toJson();if(!this.themeName)throw Error("The theme name is undefined. Either pass a theme name to the constructor, or call fromJson");return e.themeName=this.themeName,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Eh),t.themeName=e.themeName,t}};r(z.EVENT,M.THEME_CHANGE,Eh);var Ih=class extends gs{constructor(e,t,o,n,c){super(n),this.type=M.VIEWPORT_CHANGE,this.viewTop=e,this.viewLeft=t,this.scale=o,this.oldScale=c}toJson(){const e=super.toJson();if(this.viewTop===void 0)throw Error("The view top is undefined. Either pass a value to the constructor, or call fromJson");if(this.viewLeft===void 0)throw Error("The view left is undefined. Either pass a value to the constructor, or call fromJson");if(this.scale===void 0)throw Error("The scale is undefined. Either pass a value to the constructor, or call fromJson");if(this.oldScale===void 0)throw Error("The old scale is undefined. Either pass a value to the constructor, or call fromJson");return e.viewTop=this.viewTop,e.viewLeft=this.viewLeft,e.scale=this.scale,e.oldScale=this.oldScale,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Ih),t.viewTop=e.viewTop,t.viewLeft=e.viewLeft,t.scale=e.scale,t.oldScale=e.oldScale,t}};r(z.EVENT,M.VIEWPORT_CHANGE,Ih);var ne;(function(e){e[e.INPUT_VALUE=1]="INPUT_VALUE",e[e.OUTPUT_VALUE=2]="OUTPUT_VALUE",e[e.NEXT_STATEMENT=3]="NEXT_STATEMENT",e[e.PREVIOUS_STATEMENT=4]="PREVIOUS_STATEMENT"})(ne||(ne={}));var zi=class{constructor(e){this.connectionChecker=e,this.connections=[]}addConnection(e,t){t=this.calculateIndexForYPos(t),this.connections.splice(t,0,e)}findIndexOfConnection(e,t){if(!this.connections.length)return-1;const o=this.calculateIndexForYPos(t);if(o>=this.connections.length)return-1;t=e.y;let n=o;for(;0<=n&&this.connections[n].y===t;){if(this.connections[n]===e)return n;n--}for(n=o;n<this.connections.length&&this.connections[n].y===t;){if(this.connections[n]===e)return n;n++}return-1}calculateIndexForYPos(e){if(!this.connections.length)return 0;let t=0,o=this.connections.length;for(;t<o;){const n=Math.floor((t+o)/2);if(this.connections[n].y<e)t=n+1;else if(this.connections[n].y>e)o=n;else{t=n;break}}return t}removeConnection(e,t){if(e=this.findIndexOfConnection(e,t),e===-1)throw Error("Unable to find connection in connectionDB.");this.connections.splice(e,1)}getNeighbours(e,t){function o(oe){const it=c-n[oe].x,ot=h-n[oe].y;return Math.sqrt(it*it+ot*ot)<=t&&B.push(n[oe]),ot<t}const n=this.connections,c=e.x,h=e.y;e=0;let $=n.length-2,T=$;for(;e<T;)n[T].y<h?e=T:$=T,T=Math.floor((e+$)/2);const B=[];if($=e=T,n.length){for(;0<=e&&o(e);)e--;do $++;while($<n.length&&o($))}return B}isInYRange(e,t,o){return Math.abs(this.connections[e].y-t)<=o}searchForClosest(e,t,o){if(!this.connections.length)return{connection:null,radius:t};const n=e.y,c=e.x;e.x=c+o.x,e.y=n+o.y;var h=this.calculateIndexForYPos(e.y);o=null;let $=t,T,B=h-1;for(;0<=B&&this.isInYRange(B,e.y,t);)T=this.connections[B],this.connectionChecker.canConnect(e,T,!0,$)&&(o=T,$=T.distanceFrom(e)),B--;for(;h<this.connections.length&&this.isInYRange(h,e.y,t);)T=this.connections[h],this.connectionChecker.canConnect(e,T,!0,$)&&(o=T,$=T.distanceFrom(e)),h++;return e.x=c,e.y=n,{connection:o,radius:$}}static init(e){const t=[];return t[ne.INPUT_VALUE]=new zi(e),t[ne.OUTPUT_VALUE]=new zi(e),t[ne.NEXT_STATEMENT]=new zi(e),t[ne.PREVIOUS_STATEMENT]=new zi(e),t}},al=null,tr=null,sr={};sr.connectionUiEffect=Ca,sr.disconnectUiEffect=Yu,sr.disconnectUiStop=ki,sr.disposeUiEffect=wa;var Ob=class{constructor(e){this.workspace=e,this.horizontalScrollEnabled=this.workspace.isMovableHorizontally(),this.verticalScrollEnabled=this.workspace.isMovableVertically(),this.startScrollXY_=new K(e.scrollX,e.scrollY)}dispose(){this.workspace=null}startDrag(){x()&&x().unselect()}endDrag(e){this.drag(e)}drag(e){if(e=K.sum(this.startScrollXY_,e),this.horizontalScrollEnabled&&this.verticalScrollEnabled)this.workspace.scroll(e.x,e.y);else if(this.horizontalScrollEnabled)this.workspace.scroll(e.x,this.workspace.scrollY);else if(this.verticalScrollEnabled)this.workspace.scroll(this.workspace.scrollX,e.y);else throw new TypeError("Invalid state.")}},qC=5,ZC=6,eo=class{constructor(e,t){this.creatorWorkspace=t,this.mouseDownXY=new K(0,0),this.startWorkspace_=this.targetBlock=this.startComment=this.startBlock=this.startIcon=this.startField=this.startBubble=null,this.hasExceededDragRadius=!1,this.boundEvents=[],this.workspaceDragger=this.dragger=null,this.dragging=!1,this.flyout=null,this.multiTouch=this.isEnding_=this.gestureHasStarted=this.calledUpdateIsDragging=!1,this.cachedPoints=new Map,this.startDistance=this.previousScale=0,this.currentDropdownOwner=this.isPinchZoomEnabled=null,this.mostRecentEvent=e,this.currentDragDeltaXY=new K(0,0)}dispose(){Ee(),Iu(),this.creatorWorkspace.clearGesture();for(const e of this.boundEvents)ze(e);this.boundEvents.length=0,this.workspaceDragger&&this.workspaceDragger.dispose()}updateFromEvent(e){const t=new K(e.clientX,e.clientY);this.updateDragDelta(t)&&(this.updateIsDragging(e),Ce()),this.mostRecentEvent=e}updateDragDelta(e){return this.currentDragDeltaXY=K.difference(e,this.mouseDownXY),this.hasExceededDragRadius?!1:this.hasExceededDragRadius=K.magnitude(this.currentDragDeltaXY)>(this.flyout?i.config$$module$build$src$core$config.flyoutDragRadius:i.config$$module$build$src$core$config.dragRadius)}updateIsDraggingFromFlyout(){let e;if(!this.targetBlock||(e=this.flyout)==null||!e.isBlockCreatable(this.targetBlock))return!1;if(!this.flyout.targetWorkspace)throw Error(`Cannot update dragging from the flyout because the ' +
875
+ 'flyout's target workspace is undefined`);return!this.flyout.isScrollable()||this.flyout.isDragTowardWorkspace(this.currentDragDeltaXY)?(this.startWorkspace_=this.flyout.targetWorkspace,this.startWorkspace_.updateScreenCalculationsIfScrolled(),i.getGroup$$module$build$src$core$events$utils()||i.setGroup$$module$build$src$core$events$utils(!0),this.startBlock=null,this.targetBlock=this.flyout.createBlock(this.targetBlock),i.setSelected$$module$build$src$core$common(this.targetBlock),!0):!1}updateIsDraggingWorkspace(){if(!this.startWorkspace_)throw Error("Cannot update dragging the workspace because the start workspace is undefined");(this.flyout?this.flyout.isScrollable():this.startWorkspace_&&this.startWorkspace_.isDraggable())&&(this.dragging=!0,this.workspaceDragger=new Ob(this.startWorkspace_),this.workspaceDragger.startDrag())}updateIsDragging(e){if(!this.startWorkspace_)throw Error("Cannot update dragging because the start workspace is undefined");if(this.calledUpdateIsDragging)throw Error("updateIsDragging_ should only be called once per gesture.");this.calledUpdateIsDragging=!0,this.flyout&&this.updateIsDraggingFromFlyout();const t=x();t&&jo(t)&&t.isMovable()?(this.dragging=!0,this.dragger=this.createDragger(t,this.startWorkspace_),this.dragger.onDragStart(e),this.dragger.onDrag(e,this.currentDragDeltaXY)):this.updateIsDraggingWorkspace()}createDragger(e,t){return new(w(z.BLOCK_DRAGGER,this.creatorWorkspace.options,!0))(e,t)}doStart(e){if(!this.startWorkspace_)throw Error("Cannot start the touch gesture becauase the start workspace is undefined");this.isPinchZoomEnabled=this.startWorkspace_.options.zoomOptions&&this.startWorkspace_.options.zoomOptions.pinch,wt(e)?this.cancel():(this.gestureHasStarted=!0,ki(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),this.currentDropdownOwner=lu(),this.startWorkspace_.hideChaff(!!this.flyout),this.startWorkspace_.markFocused(),this.mostRecentEvent=e,Eu(),_e(e)?this.handleRightClick(e):(e.type.toLowerCase()==="pointerdown"&&e.pointerType!=="mouse"&&Ye(e,this),this.mouseDownXY=new K(e.clientX,e.clientY),this.bindMouseEvents(e),this.isEnding_||this.handleTouchStart(e)))}bindMouseEvents(e){this.boundEvents.push(Q(document,"pointerdown",null,this.handleStart.bind(this),!0)),this.boundEvents.push(Q(document,"pointermove",null,this.handleMove.bind(this),!0)),this.boundEvents.push(Q(document,"pointerup",null,this.handleUp.bind(this),!0)),e.preventDefault(),e.stopPropagation()}handleStart(e){this.isDragging()||(this.handleTouchStart(e),this.isMultiTouch()&&Ce())}handleMove(e){this.isDragging()&&ve(e)||!this.isMultiTouch()?(this.updateFromEvent(e),this.workspaceDragger?this.workspaceDragger.drag(this.currentDragDeltaXY):this.dragger&&this.dragger.onDrag(this.mostRecentEvent,this.currentDragDeltaXY),e.preventDefault(),e.stopPropagation()):this.isMultiTouch()&&(this.handleTouchMove(e),Ce())}handleUp(e){if(this.isDragging()||this.handleTouchEnd(e),!this.isMultiTouch()||this.isDragging()){if(!ve(e))return;if(this.updateFromEvent(e),Ce(),this.isEnding_){console.log("Trying to end a gesture recursively.");return}this.isEnding_=!0,this.dragger?this.dragger.onDragEnd(e,this.currentDragDeltaXY):this.workspaceDragger?this.workspaceDragger.endDrag(this.currentDragDeltaXY):this.isBubbleClick()||this.isCommentClick()||(this.isFieldClick()?this.doFieldClick():this.isIconClick()?this.doIconClick():this.isBlockClick()?this.doBlockClick():this.isWorkspaceClick()&&this.doWorkspaceClick(e))}e.preventDefault(),e.stopPropagation(),this.dispose()}handleTouchStart(e){var t=Be(e);this.cachedPoints.set(t,this.getTouchPoint(e));var o=Array.from(this.cachedPoints.keys());o.length===2&&(t=this.cachedPoints.get(o[0]),o=this.cachedPoints.get(o[1]),this.startDistance=K.distance(t,o),this.multiTouch=!0,e.preventDefault())}handleTouchMove(e){const t=Be(e);this.cachedPoints.set(t,this.getTouchPoint(e)),this.isPinchZoomEnabled&&this.cachedPoints.size===2?this.handlePinch(e):(this.updateFromEvent(e),this.workspaceDragger?this.workspaceDragger.drag(this.currentDragDeltaXY):this.dragger&&this.dragger.onDrag(this.mostRecentEvent,this.currentDragDeltaXY),e.preventDefault(),e.stopPropagation())}handlePinch(e){var t=Array.from(this.cachedPoints.keys()),o=this.cachedPoints.get(t[0]);if(t=this.cachedPoints.get(t[1]),o=K.distance(o,t)/this.startDistance,0<this.previousScale&&1/0>this.previousScale){if(t=o-this.previousScale,t=0<t?t*qC:t*ZC,!this.startWorkspace_)throw Error("Cannot handle a pinch because the start workspace is undefined");const n=this.startWorkspace_,c=tt(e,n.getParentSvg(),n.getInverseScreenCTM());n.zoom(c.x,c.y,t)}this.previousScale=o,e.preventDefault()}handleTouchEnd(e){e=Be(e),this.cachedPoints.has(e)&&this.cachedPoints.delete(e),2>this.cachedPoints.size&&(this.cachedPoints.clear(),this.previousScale=0)}getTouchPoint(e){return this.startWorkspace_?new K(e.pageX,e.pageY):null}isMultiTouch(){return this.multiTouch}cancel(){this.isEnding_||(Ce(),this.dragger?this.dragger.onDragEnd(this.mostRecentEvent,this.currentDragDeltaXY):this.workspaceDragger&&this.workspaceDragger.endDrag(this.currentDragDeltaXY),this.dispose())}handleRightClick(e){this.targetBlock?(this.bringBlockToFront(),this.targetBlock.workspace.hideChaff(!!this.flyout),this.targetBlock.showContextMenu(e)):this.startBubble?this.startBubble.showContextMenu(e):this.startComment?(this.startComment.workspace.hideChaff(),this.startComment.showContextMenu(e)):this.startWorkspace_&&!this.flyout&&(this.startWorkspace_.hideChaff(),this.startWorkspace_.showContextMenu(e)),e.preventDefault(),e.stopPropagation(),this.dispose()}handleWsStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");this.setStartWorkspace(t),this.mostRecentEvent=e,this.startBlock||this.startBubble||this.startComment||i.setSelected$$module$build$src$core$common(null),this.doStart(e)}fireWorkspaceClick(e){U(new(Y(M.CLICK))(null,e.id,"workspace"))}handleFlyoutStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");this.setStartFlyout(t),this.handleWsStart(e,t.getWorkspace())}handleBlockStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleBlockStart, but the gesture had already been started.");this.setStartBlock(t),this.mostRecentEvent=e}handleBubbleStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");this.setStartBubble(t),this.mostRecentEvent=e}handleCommentStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleCommentStart, but the gesture had already been started.");this.setStartComment(t),this.mostRecentEvent=e}doFieldClick(){if(!this.startField)throw Error("Cannot do a field click because the start field is undefined");this.currentDropdownOwner!==this.startField&&this.startField.showEditor(this.mostRecentEvent),this.bringBlockToFront()}doIconClick(){if(!this.startIcon)throw Error("Cannot do an icon click because the start icon is undefined");this.bringBlockToFront(),this.startIcon.onClick()}doBlockClick(){if(this.flyout&&this.flyout.autoClose){if(!this.targetBlock)throw Error("Cannot do a block click because the target block is undefined");if(this.targetBlock.isEnabled()){i.getGroup$$module$build$src$core$events$utils()||i.setGroup$$module$build$src$core$events$utils(!0);var e=this.flyout.createBlock(this.targetBlock);e.snapToGrid(),e.bumpNeighbours()}}else{if(!this.startWorkspace_)throw Error("Cannot do a block click because the start workspace is undefined");e=new(Y(M.CLICK))(this.startBlock,this.startWorkspace_.id,"block"),U(e)}this.bringBlockToFront(),i.setGroup$$module$build$src$core$events$utils(!1)}doWorkspaceClick(e){e=this.creatorWorkspace,x()&&x().unselect(),this.fireWorkspaceClick(this.startWorkspace_||e)}bringBlockToFront(){this.targetBlock&&!this.flyout&&this.targetBlock.bringToFront()}setStartField(e){if(this.gestureHasStarted)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");this.startField||(this.startField=e)}setStartIcon(e){if(this.gestureHasStarted)throw Error("Tried to call gesture.setStartIcon, but the gesture had already been started.");this.startIcon||(this.startIcon=e)}setStartBubble(e){this.startBubble||(this.startBubble=e)}setStartComment(e){this.startComment||(this.startComment=e)}setStartBlock(e){this.startBlock||this.startBubble||(this.startBlock=e,i.setSelected$$module$build$src$core$common(this.startBlock),e.isInFlyout&&e!==e.getRootBlock()?this.setTargetBlock(e.getRootBlock()):this.setTargetBlock(e))}setTargetBlock(e){e.isShadow()?this.setTargetBlock(e.getParent()):this.targetBlock=e}setStartWorkspace(e){this.startWorkspace_||(this.startWorkspace_=e)}setStartFlyout(e){this.flyout||(this.flyout=e)}isBubbleClick(){return!!this.startBubble&&!this.hasExceededDragRadius}isCommentClick(){return!!this.startComment&&!this.hasExceededDragRadius}isBlockClick(){return!!this.startBlock&&!this.hasExceededDragRadius&&!this.isFieldClick()&&!this.isIconClick()}isFieldClick(){return this.startField?this.startField.isClickable()&&!this.hasExceededDragRadius&&(!this.flyout||this.startField.isClickableInFlyout(this.flyout.autoClose)):!1}isIconClick(){if(!this.startIcon)return!1;const e=!this.flyout||!this.startIcon.isClickableInFlyout||this.startIcon.isClickableInFlyout(this.flyout.autoClose);return!this.hasExceededDragRadius&&e}isWorkspaceClick(){return!this.startBlock&&!this.startBubble&&!this.startField&&!this.hasExceededDragRadius}getCurrentDragger(){let e,t;return(t=(e=this.workspaceDragger)!=null?e:this.dragger)!=null?t:null}isDragging(){return this.dragging}hasStarted(){return this.gestureHasStarted}static inProgress(){const e=se();for(let t=0,o;o=e[t];t++)if(o.currentGesture_)return!0;return!1}},xh=class{constructor(e,t){this.pattern=e,this.scale=1;let o;this.spacing=(o=t.spacing)!=null?o:0;let n;this.length=(n=t.length)!=null?n:1,this.line2=(this.line1=e.firstChild)&&this.line1.nextSibling;let c;this.snapToGrid=(c=t.snap)!=null?c:!1}setSpacing(e){this.spacing=e,this.update(this.scale)}getSpacing(){return this.spacing}setLength(e){this.length=e,this.update(this.scale)}getLength(){return this.length}setSnapToGrid(e){this.snapToGrid=e}shouldSnap(){return this.snapToGrid}getPatternId(){return this.pattern.id}update(e){this.scale=e;var t=this.spacing*e;this.pattern.setAttribute("width",`${t}`),this.pattern.setAttribute("height",`${t}`),t=Math.floor(this.spacing/2)+.5;let o=t-this.length/2,n=t+this.length/2;t*=e,o*=e,n*=e,this.setLineAttributes(this.line1,e,o,n,t,t),this.setLineAttributes(this.line2,e,t,t,o,n)}setLineAttributes(e,t,o,n,c,h){e&&(e.setAttribute("stroke-width",`${t}`),e.setAttribute("x1",`${o}`),e.setAttribute("y1",`${c}`),e.setAttribute("x2",`${n}`),e.setAttribute("y2",`${h}`))}moveTo(e,t){this.pattern.setAttribute("x",`${e}`),this.pattern.setAttribute("y",`${t}`)}alignXY(e){var t=this.getSpacing();const o=t/2,n=Math.round(Math.round((e.x-o)/t)*t+o);return t=Math.round(Math.round((e.y-o)/t)*t+o),n===e.x&&t===e.y?e:new K(n,t)}static createDom(e,t,o){e=L(D.PATTERN,{id:"blocklyGridPattern"+e,patternUnits:"userSpaceOnUse"},o);let n,c;if(0<((n=t.length)!=null?n:1)&&0<((c=t.spacing)!=null?c:0)){L(D.LINE,{stroke:t.colour},e);let h;(h=t.length)!=null&&h&&L(D.LINE,{stroke:t.colour},e)}else L(D.LINE,{},e);return e}},QC=class{constructor(e){this.workspace=e,this.layers=new Map,(e=e.getInjectionDiv())&&(this.dragLayer=this.createDragLayer(e),this.animationLayer=this.createAnimationLayer(e)),e=this.createLayer(yo),fe(e,"blocklyBlockCanvas"),e=this.createLayer(il),fe(e,"blocklyBubbleCanvas")}createDragLayer(e){const t=L(D.SVG,{class:"blocklyBlockDragSurface",xmlns:Un,"xmlns:html":As,"xmlns:xlink":Kt,version:"1.1"});return e.append(t),L(D.G,{},t)}createAnimationLayer(e){const t=L(D.SVG,{class:"blocklyAnimationLayer",xmlns:Un,"xmlns:html":As,"xmlns:xlink":Kt,version:"1.1"});return e.append(t),L(D.G,{},t)}appendToAnimationLayer(e){let t;const o=(t=this.dragLayer)==null?void 0:t.getAttribute("transform");if(o){let c;(c=this.animationLayer)==null||c.setAttribute("transform",o)}let n;(n=this.animationLayer)==null||n.appendChild(e.getSvgRoot())}translateLayers(e,t){e=`translate(${e.x}, ${e.y}) scale(${t})`;let o;(o=this.dragLayer)==null||o.setAttribute("transform",e);for(const[,n]of this.layers)n.setAttribute("transform",e)}moveToDragLayer(e){let t;(t=this.dragLayer)==null||t.appendChild(e.getSvgRoot())}moveOffDragLayer(e,t){this.append(e,t)}append(e,t){this.layers.has(t)||this.createLayer(t);let o;(o=this.layers.get(t))==null||o.appendChild(e.getSvgRoot())}createLayer(e){const t=this.workspace.getSvgGroup(),o=L(D.G,{});let n=!1;const c=[...this.layers].sort((h,$)=>h[0]-$[0]);for(const[h,$]of c)if(e<h){t.insertBefore(o,$),n=!0;break}return n||t.appendChild(o),this.layers.set(e,o),o}hasLayer(e){return e===this.dragLayer||new Set(this.layers.values()).has(e)}getBlockLayer(){return this.layers.get(yo)}getBubbleLayer(){return this.layers.get(il)}},Mb={};Mb.deepMerge=Ks;var ei=class{constructor(e,t,o,n){this.name=e,this.startHats=!1,this.blockStyles=t||Object.create(null),this.categoryStyles=o||Object.create(null),this.componentStyles=n||Object.create(null),this.fontStyle=Object.create(null),r(z.THEME,e,this,!0)}getClassName(){return this.name+"-theme"}setBlockStyle(e,t){this.blockStyles[e]=t}setCategoryStyle(e,t){this.categoryStyles[e]=t}getComponentStyle(e){if(e=this.componentStyles[e],!e)return null;if(typeof e=="string"){const t=this.getComponentStyle(e);if(t)return t}return`${e}`}setComponentStyle(e,t){this.componentStyles[e]=t}setFontStyle(e){this.fontStyle=e}setStartHats(e){this.startHats=e}static defineTheme(e,t){e=e.toLowerCase();const o=new ei(e);let n=t.base;if(n){if(typeof n=="string"){let c;n=(c=f(z.THEME,n))!=null?c:void 0}n instanceof ei&&(Ks(o,n),o.name=e)}return Ks(o.blockStyles,t.blockStyles),Ks(o.categoryStyles,t.categoryStyles),Ks(o.componentStyles,t.componentStyles),Ks(o.fontStyle,t.fontStyle),t.startHats!==null&&(o.startHats=t.startHats),o}},eT={colour_blocks:{colourPrimary:"20"},list_blocks:{colourPrimary:"260"},logic_blocks:{colourPrimary:"210"},loop_blocks:{colourPrimary:"120"},math_blocks:{colourPrimary:"230"},procedure_blocks:{colourPrimary:"290"},text_blocks:{colourPrimary:"160"},variable_blocks:{colourPrimary:"330"},variable_dynamic_blocks:{colourPrimary:"310"},hat_blocks:{colourPrimary:"330",hat:"cap"}},tT={colour_category:{colour:"20"},list_category:{colour:"260"},logic_category:{colour:"210"},loop_category:{colour:"120"},math_category:{colour:"230"},procedure_category:{colour:"290"},text_category:{colour:"160"},variable_category:{colour:"330"},variable_dynamic_category:{colour:"310"}},ll=new ei("classic",eT,tT),ss=class{constructor(e){this.gridPattern=null,this.getMetrics=this.setMetrics=void 0;let t=null,o=!1;var n=!1,c=!1,h=!1,$=!1,T=!1;const B=!!e.readOnly;if(!B){var oe;t=Jr((oe=e.toolbox)!=null?oe:null),o=Xr(t),n=e.trashcan,n=n===void 0?o:n,c=e.collapse,c=c===void 0?o:c,h=e.comments,h=h===void 0?o:h,$=e.disable,$=$===void 0?o:$,T=e.sounds,T=T===void 0?!0:T}oe=e.maxTrashcanContents,n?oe===void 0&&(oe=32):oe=0;const it=!!e.rtl;let ot=e.horizontalLayout;ot===void 0&&(ot=!1);var Wt=e.toolboxPosition!=="end";Wt=ot?Wt?xe.TOP:xe.BOTTOM:Wt===it?xe.RIGHT:xe.LEFT;let qi=e.css;qi===void 0&&(qi=!0);let mr="https://blockly-demo.appspot.com/static/media/";e.media&&(mr=e.media.endsWith("/")?e.media:e.media+"/");const uy=e.oneBasedIndex,AT=e.renderer||"geras",RT=e.plugins||{};let wp=e.modalInputs;wp===void 0&&(wp=!0),this.RTL=it,this.oneBasedIndex=uy===void 0?!0:uy,this.collapse=c,this.comments=h,this.disable=$,this.readOnly=B,this.maxBlocks=e.maxBlocks||1/0;let dy;this.maxInstances=(dy=e.maxInstances)!=null?dy:null,this.modalInputs=wp,this.pathToMedia=mr,this.hasCategories=o,this.moveOptions=ss.parseMoveOptions(e,o),this.hasScrollbars=!!this.moveOptions.scrollbars,this.hasTrashcan=n,this.maxTrashcanContents=oe,this.hasSounds=T,this.hasCss=qi,this.horizontalLayout=ot,this.languageTree=t,this.gridOptions=ss.parseGridOptions(e),this.zoomOptions=ss.parseZoomOptions(e),this.toolboxPosition=Wt,this.theme=ss.parseThemeOptions(e),this.renderer=AT;let hy;this.rendererOverrides=(hy=e.rendererOverrides)!=null?hy:null;let py;this.parentWorkspace=(py=e.parentWorkspace)!=null?py:null,this.plugins=RT}static parseMoveOptions(e,t){const o=e.move||{},n={};return o.scrollbars===void 0&&e.scrollbars===void 0?n.scrollbars=t:typeof o.scrollbars=="object"?(n.scrollbars={horizontal:!!o.scrollbars.horizontal,vertical:!!o.scrollbars.vertical},n.scrollbars.horizontal&&n.scrollbars.vertical?n.scrollbars=!0:n.scrollbars.horizontal||n.scrollbars.vertical||(n.scrollbars=!1)):n.scrollbars=!!o.scrollbars||!!e.scrollbars,n.wheel=n.scrollbars&&o.wheel!==void 0?!!o.wheel:typeof n.scrollbars=="object",n.drag=n.scrollbars?o.drag===void 0?!0:!!o.drag:!1,n}static parseZoomOptions(e){e=e.zoom||{};const t={};return t.controls=e.controls===void 0?!1:!!e.controls,t.wheel=e.wheel===void 0?!1:!!e.wheel,t.startScale=e.startScale===void 0?1:Number(e.startScale),t.maxScale=e.maxScale===void 0?3:Number(e.maxScale),t.minScale=e.minScale===void 0?.3:Number(e.minScale),t.scaleSpeed=e.scaleSpeed===void 0?1.2:Number(e.scaleSpeed),t.pinch=e.pinch===void 0?t.wheel||t.controls:!!e.pinch,t}static parseGridOptions(e){e=e.grid||{};const t={};return t.spacing=Number(e.spacing)||0,t.colour=e.colour||"#888",t.length=e.length===void 0?1:Number(e.length),t.snap=0<t.spacing&&!!e.snap,t}static parseThemeOptions(e){return e=e.theme||ll,typeof e=="string"?f(z.THEME,e):e instanceof ei?e:ei.defineTheme(e.name||"builtin"+k(),e)}},Nb={fromJsonInternal:Pf},cl={TEST_ONLY:Nb};cl.fromJson=i.fromJson$$module$build$src$core$field_registry,cl.register=Is,cl.unregister=Bf;var Ht=class extends Ze{constructor(e,t,o){super(Ze.SKIP_SETUP),this.svgArrow=this.arrow=this.imageElement=this.menu_=this.selectedMenuItem=null,this.SERIALIZABLE=!0,this.CURSOR="default",this.clickTarget_=this.suffixField=this.prefixField=this.generatedOptions=null,e!==Ze.SKIP_SETUP&&(Array.isArray(e)?(this.validateOptions(e),e=this.trimOptions(e),this.menuGenerator_=e.options,this.prefixField=e.prefix||null,this.suffixField=e.suffix||null):this.menuGenerator_=e,this.selectedOption=this.getOptions(!1)[0],o&&this.configure_(o),this.setValue(this.selectedOption[1]),t&&this.setValidator(t))}fromXml(e){this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(e.textContent)}loadState(e){this.loadLegacyState(Ht,e)||(this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(e))}initView(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot(),this.createTextElement_(),this.imageElement=L(D.IMAGE,{},this.fieldGroup_),this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_(),this.borderRect_&&fe(this.borderRect_,"blocklyDropdownRect")}shouldAddBorderRect_(){let e;return!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&!((e=this.getSourceBlock())!=null&&e.isShadow())}createTextArrow_(){this.arrow=L(D.TSPAN,{},this.textElement_);let e;this.arrow.appendChild(document.createTextNode((e=this.getSourceBlock())!=null&&e.RTL?Ht.ARROW_CHAR+" ":" "+Ht.ARROW_CHAR)),this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.arrow.setAttribute("dominant-baseline","central");let t;(t=this.getSourceBlock())!=null&&t.RTL?this.getTextElement().insertBefore(this.arrow,this.textContent_):this.getTextElement().appendChild(this.arrow)}createSVGArrow_(){this.svgArrow=L(D.IMAGE,{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_),this.svgArrow.setAttributeNS(Kt,"xlink:href",this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI)}showEditor_(e){var t=this.getSourceBlock();if(!t)throw new mt;this.dropdownCreate(),this.menu_.openingCoords=e&&typeof e.clientX=="number"?new K(e.clientX,e.clientY):null,ua(),e=this.menu_.render(Sn()),fe(e,"blocklyDropdownMenu"),this.getConstants().FIELD_DROPDOWN_COLOURED_DIV&&(t=t.getColour(),e=this.sourceBlock_.getColourTertiary(),cu(t,e)),uu(this,this.dropdownDispose_.bind(this)),this.menu_.focus(),this.selectedMenuItem&&(this.menu_.setHighlighted(this.selectedMenuItem),Kr(this.selectedMenuItem.getElement(),Sn(),!0)),this.applyColour()}dropdownCreate(){const e=this.getSourceBlock();if(!e)throw new mt;const t=new rh;t.setRole(fs.LISTBOX),this.menu_=t;const o=this.getOptions(!1);this.selectedMenuItem=null;for(let c=0;c<o.length;c++){const[h,$]=o[c];if(typeof h=="object"){var n=new Image(h.width,h.height);n.src=h.src,n.alt=h.alt||""}else n=h;n=new ah(n,$),n.setRole(fs.OPTION),n.setRightToLeft(e.RTL),n.setCheckable(!0),t.addChild(n),n.setChecked($===this.value_),$===this.value_&&(this.selectedMenuItem=n),n.onAction(this.handleMenuActionEvent,this)}}dropdownDispose_(){this.menu_&&this.menu_.dispose(),this.selectedMenuItem=this.menu_=null,this.applyColour()}handleMenuActionEvent(e){da(this,!0),this.onItemSelected_(this.menu_,e)}onItemSelected_(e,t){this.setValue(t.getValue())}isOptionListDynamic(){return typeof this.menuGenerator_=="function"}getOptions(e){if(!this.menuGenerator_)throw TypeError("A menu generator was never defined.");return Array.isArray(this.menuGenerator_)?this.menuGenerator_:e&&this.generatedOptions?this.generatedOptions:(this.generatedOptions=this.menuGenerator_(),this.validateOptions(this.generatedOptions),this.generatedOptions)}doClassValidation_(e){return this.getOptions(!0).some(t=>t[1]===e)?e:(this.sourceBlock_&&console.warn("Cannot set the dropdown's value to an unavailable option. Block type: "+this.sourceBlock_.type+", Field name: "+this.name+", Value: "+e),null)}doValueUpdate_(e){super.doValueUpdate_(e),e=this.getOptions(!0);for(let t=0,o;o=e[t];t++)o[1]===this.value_&&(this.selectedOption=o)}applyColour(){const e=this.sourceBlock_;this.borderRect_&&(this.borderRect_.setAttribute("stroke",e.getColourTertiary()),this.menu_?this.borderRect_.setAttribute("fill",e.getColourTertiary()):this.borderRect_.setAttribute("fill","transparent")),e&&this.arrow&&(e.isShadow()?this.arrow.style.fill=e.getColourSecondary():this.arrow.style.fill=e.getColour())}render_(){this.getTextContent().nodeValue="",this.imageElement.style.display="none";const e=this.selectedOption&&this.selectedOption[0];e&&typeof e=="object"?this.renderSelectedImage(e):this.renderSelectedText(),this.positionBorderRect_()}renderSelectedImage(e){const t=this.getSourceBlock();if(!t)throw new mt;this.imageElement.style.display="",this.imageElement.setAttributeNS(Kt,"xlink:href",e.src),this.imageElement.setAttribute("height",String(e.height)),this.imageElement.setAttribute("width",String(e.width));const o=Number(e.height);e=Number(e.width);var n=!!this.borderRect_;const c=Math.max(n?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,o+Ht.IMAGE_Y_PADDING);n=n?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let h;h=this.svgArrow?this.positionSVGArrow(e+n,c/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2):$n(this.arrow,this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY),this.size_.width=e+h+2*n,this.size_.height=c;let $=0;t.RTL?this.imageElement.setAttribute("x",`${n+h}`):($=e+h,this.getTextElement().setAttribute("text-anchor","end"),this.imageElement.setAttribute("x",`${n}`)),this.imageElement.setAttribute("y",String(c/2-o/2)),this.positionTextElement_($+n,e+h)}renderSelectedText(){this.getTextContent().nodeValue=this.getDisplayText_();var e=this.getTextElement();fe(e,"blocklyDropdownText"),e.setAttribute("text-anchor","start");var t=!!this.borderRect_;e=Math.max(t?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,this.getConstants().FIELD_TEXT_HEIGHT);const o=$n(this.getTextElement(),this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY);t=t?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let n=0;this.svgArrow&&(n=this.positionSVGArrow(o+t,e/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2)),this.size_.width=o+n+2*t,this.size_.height=e,this.positionTextElement_(t,o)}positionSVGArrow(e,t){if(!this.svgArrow)return 0;const o=this.getSourceBlock();if(!o)throw new mt;const n=this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,c=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_PADDING,h=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE;return this.svgArrow.setAttribute("transform","translate("+(o.RTL?n:e+c)+","+t+")"),h+c}getText_(){if(!this.selectedOption)return null;const e=this.selectedOption[0];return typeof e=="object"?e.alt:e}static fromJson(e){if(!e.options)throw Error("options are required for the dropdown field. The options property must be assigned an array of [humanReadableValue, languageNeutralValue] tuples.");return new this(e.options,void 0,e)}trimOptions(e){let t=!1;const o=e.map(([$,T])=>typeof $=="string"?[ht($),T]:(t=!0,[$.alt!==null?Object.assign({},$,{alt:ht($.alt)}):Object.assign({},$),T]));if(t||2>e.length)return{options:o};var n=o.map(([$])=>$),c=In(n);e=yu(n,c);const h=_u(n,c);return!e&&!h||c<=e+h?{options:o}:(c=e?n[0].substring(0,e-1):void 0,n=h?n[0].substr(1-h):void 0,{options:this.applyTrim(o,e,h),prefix:c,suffix:n})}applyTrim(e,t,o){return e.map(([n,c])=>[n.substring(t,n.length-o),c])}validateOptions(e){if(!Array.isArray(e))throw TypeError("FieldDropdown options must be an array.");if(!e.length)throw TypeError("FieldDropdown options must not be an empty array.");let t=!1;for(let o=0;o<e.length;o++){const n=e[o];Array.isArray(n)?typeof n[1]!="string"?(t=!0,console.error(`Invalid option[${o}]: Each FieldDropdown option id must be a string.
876
+ Found ${n[1]} in: ${n}`)):n[0]&&typeof n[0]!="string"&&typeof n[0].src!="string"&&(t=!0,console.error(`Invalid option[${o}]: Each FieldDropdown option must have a string
877
+ label or image description. Found ${n[0]} in: ${n}`)):(t=!0,console.error(`Invalid option[${o}]: Each FieldDropdown option must be an array.
878
+ Found: ${n}`))}if(t)throw TypeError("Found invalid FieldDropdown options.")}};Ht.CHECKMARK_OVERHANG=25,Ht.MAX_MENU_HEIGHT_VH=.45,Ht.ARROW_CHAR="▾",Ht.IMAGE_Y_OFFSET=5,Ht.IMAGE_Y_PADDING=2*Ht.IMAGE_Y_OFFSET,Is("field_dropdown",Ht);var Lb=class{constructor(e,t){this.bubble=e,this.workspace=t,this.startLoc=null,this.inGroup=!1}isMovable(){return!0}startDrag(){(this.inGroup=!!i.getGroup$$module$build$src$core$events$utils())||i.setGroup$$module$build$src$core$events$utils(!0),this.startLoc=this.bubble.getRelativeToSurfaceXY(),this.workspace.setResizesEnabled(!1);let e;(e=this.workspace.getLayerManager())==null||e.moveToDragLayer(this.bubble),this.bubble.setDragging&&this.bubble.setDragging(!0)}drag(e){this.bubble.moveDuringDrag(e)}endDrag(){this.workspace.setResizesEnabled(!0),this.inGroup||i.setGroup$$module$build$src$core$events$utils(!1);let e;(e=this.workspace.getLayerManager())==null||e.moveOffDragLayer(this.bubble,il),this.bubble.setDragging(!1)}revertDrag(){this.startLoc&&this.bubble.moveDuringDrag(this.startLoc)}},Jt,Ke=class{constructor(e,t,o){this.workspace=e,this.anchor=t,this.ownerRect=o,this.size=new Le(0,0),this.colour="#ffffff",this.disposed=!1,this.relativeLeft=this.relativeTop=0,this.dragStrategy=new Lb(this,this.workspace),this.id=k(),this.svgRoot=L(D.G,{class:"blocklyBubble"},e.getBubbleCanvas()),e=L(D.G,{filter:`url(#${this.workspace.getRenderer().getConstants().embossFilterId})`},this.svgRoot),this.tail=L(D.PATH,{class:"blocklyBubbleTail"},e),this.background=L(D.RECT,{class:"blocklyDraggable",x:0,y:0,rx:Jt.BORDER_WIDTH,ry:Jt.BORDER_WIDTH},e),this.contentContainer=L(D.G,{},this.svgRoot),Q(this.background,"pointerdown",this,this.onMouseDown)}dispose(){Ge(this.svgRoot),this.disposed=!0}setAnchorLocation(e,t=!1){this.anchor=e,t?this.positionByRect(this.ownerRect):this.positionRelativeToAnchor(),this.renderTail()}setPositionRelativeToAnchor(e,t){this.relativeLeft=e,this.relativeTop=t,this.positionRelativeToAnchor(),this.renderTail()}getSize(){return this.size}setSize(e,t=!1){e.width=Math.max(e.width,Jt.MIN_SIZE),e.height=Math.max(e.height,Jt.MIN_SIZE),this.size=e,this.background.setAttribute("width",`${e.width}`),this.background.setAttribute("height",`${e.height}`),t?this.positionByRect(this.ownerRect):this.positionRelativeToAnchor(),this.renderTail()}getColour(){return this.colour}setColour(e){this.colour=e,this.tail.setAttribute("fill",e),this.background.setAttribute("fill",e)}onMouseDown(e){let t;(t=this.workspace.getGesture(e))==null||t.handleBubbleStart(e,this),this.bringToFront(),i.setSelected$$module$build$src$core$common(this)}positionRelativeToAnchor(){let e=this.anchor.x;e=this.workspace.RTL?e-(this.relativeLeft+this.size.width):e+this.relativeLeft,this.moveTo(e,this.relativeTop+this.anchor.y)}moveTo(e,t){this.svgRoot.setAttribute("transform",`translate(${e}, ${t})`)}positionByRect(e=new Je(0,0,0,0)){var t=this.workspace.getMetricsManager().getViewMetrics(!0),o=this.getOptimalRelativeLeft(t),n=this.getOptimalRelativeTop(t);const c={x:o,y:-this.size.height-this.workspace.getRenderer().getConstants().MIN_BLOCK_HEIGHT},h={x:-this.size.width-30,y:n};n={x:e.getWidth(),y:n};var $={x:o,y:e.getHeight()};o=e.getWidth()<e.getHeight()?n:$,e=e.getWidth()<e.getHeight()?$:n,n=this.getOverlap(c,t),$=this.getOverlap(h,t);const T=this.getOverlap(o,t);t=this.getOverlap(e,t),t=Math.max(n,$,T,t),n===t?(this.relativeLeft=c.x,this.relativeTop=c.y):$===t?(this.relativeLeft=h.x,this.relativeTop=h.y):T===t?(this.relativeLeft=o.x,this.relativeTop=o.y):(this.relativeLeft=e.x,this.relativeTop=e.y),this.positionRelativeToAnchor()}getOverlap(e,t){var o=this.workspace.RTL?this.anchor.x-e.x-this.size.width:e.x+this.anchor.x;return e=e.y+this.anchor.y,Math.max(0,Math.min(1,(Math.min(o+this.size.width,t.left+t.width)-Math.max(o,t.left))*(Math.min(e+this.size.height,t.top+t.height)-Math.max(e,t.top))/(this.size.width*this.size.height)))}getOptimalRelativeLeft(e){let t=-this.size.width/4;if(this.size.width>e.width)return t;if(e=this.getWorkspaceViewRect(e),this.workspace.RTL){var o=this.anchor.x-t;o-this.size.width<e.left?t=-(e.left-this.anchor.x+this.size.width):o>e.right&&(t=-(e.right-this.anchor.x))}else{o=t+this.anchor.x;const n=o+this.size.width;o<e.left?t=e.left-this.anchor.x:n>e.right&&(t=e.right-this.anchor.x-this.size.width)}return t}getOptimalRelativeTop(e){let t=-this.size.height/4;if(this.size.height>e.height)return t;const o=this.anchor.y+t,n=o+this.size.height;return e=this.getWorkspaceViewRect(e),o<e.top?t=e.top-this.anchor.y:n>e.bottom&&(t=e.bottom-this.anchor.y-this.size.height),t}getWorkspaceViewRect(e){const t=e.top;let o=e.top+e.height,n=e.left;return e=e.left+e.width,o-=this.getScrollbarThickness(),this.workspace.RTL?n-=this.getScrollbarThickness():e-=this.getScrollbarThickness(),new Je(t,o,n,e)}getScrollbarThickness(){return gt.scrollbarThickness/this.workspace.scale}renderTail(){const e=[];var t=this.size.width/2,o=this.size.height/2,n=-this.relativeLeft,c=-this.relativeTop;if(t===n&&o===c)e.push("M "+t+","+o);else{c-=o,n-=t,this.workspace.RTL&&(n*=-1);var h=Math.sqrt(c*c+n*n),$=Math.acos(n/h);0>c&&($=2*Math.PI-$);var T=$+Math.PI/2;T>2*Math.PI&&(T-=2*Math.PI);var B=Math.sin(T);const it=Math.cos(T);let ot=(this.size.width+this.size.height)/Jt.TAIL_THICKNESS;ot=Math.min(ot,this.size.width,this.size.height)/4,T=1-Jt.ANCHOR_RADIUS/h,n=t+T*n,c=o+T*c,T=t+ot*it;const Wt=o+ot*B;t-=ot*it,o-=ot*B,B=ca(this.workspace.RTL?-Jt.TAIL_ANGLE:Jt.TAIL_ANGLE),B=$+B,B>2*Math.PI&&(B-=2*Math.PI),$=Math.sin(B)*h/Jt.TAIL_BEND,h=Math.cos(B)*h/Jt.TAIL_BEND,e.push("M"+T+","+Wt),e.push("C"+(T+h)+","+(Wt+$)+" "+n+","+c+" "+n+","+c),e.push("C"+n+","+c+" "+(t+h)+","+(o+$)+" "+t+","+o)}e.push("z");let oe;(oe=this.tail)==null||oe.setAttribute("d",e.join(" "))}bringToFront(){let e;const t=(e=this.svgRoot)==null?void 0:e.parentNode;return this.svgRoot&&(t==null?void 0:t.lastChild)!==this.svgRoot?(t==null||t.appendChild(this.svgRoot),!0):!1}getRelativeToSurfaceXY(){return new K(this.workspace.RTL?-this.relativeLeft+this.anchor.x-this.size.width:this.anchor.x+this.relativeLeft,this.anchor.y+this.relativeTop)}getSvgRoot(){return this.svgRoot}moveDuringDrag(e){this.moveTo(e.x,e.y),this.relativeLeft=this.workspace.RTL?this.anchor.x-e.x-this.size.width:e.x-this.anchor.x,this.relativeTop=e.y-this.anchor.y,this.renderTail()}setDragging(e){}setDeleteStyle(e){}isDeletable(){return!1}showContextMenu(e){}isMovable(){return!0}startDrag(){this.dragStrategy.startDrag()}drag(e){this.dragStrategy.drag(e)}endDrag(){this.dragStrategy.endDrag()}revertDrag(){this.dragStrategy.revertDrag()}select(){}unselect(){}};Jt=Ke,Ke.BORDER_WIDTH=6,Ke.DOUBLE_BORDER=2*Jt.BORDER_WIDTH,Ke.MIN_SIZE=Jt.DOUBLE_BORDER,Ke.TAIL_THICKNESS=1,Ke.TAIL_ANGLE=20,Ke.TAIL_BEND=4,Ke.ANCHOR_RADIUS=8;var to=class extends Ke{constructor(e,t,o,n){super(t,o,n),this.workspace=t,this.anchor=o,this.ownerRect=n,this.autoLayout=!0,t=new ss(e),this.validateWorkspaceOptions(t),this.svgDialog=L(D.SVG,{x:Ke.BORDER_WIDTH,y:Ke.BORDER_WIDTH},this.contentContainer),e.parentWorkspace=this.workspace,this.miniWorkspace=this.newWorkspaceSvg(new ss(e)),this.miniWorkspace.internalIsMutator=!0,e=this.miniWorkspace.createDom("blocklyMutatorBackground"),this.svgDialog.appendChild(e),t.languageTree&&(e.insertBefore(this.miniWorkspace.addFlyout(D.G),this.miniWorkspace.getCanvas()),e=this.miniWorkspace.getFlyout(),e==null||e.init(this.miniWorkspace),e==null||e.show(t.languageTree)),this.miniWorkspace.addChangeListener(this.onWorkspaceChange.bind(this));let c,h;(c=this.miniWorkspace.getFlyout())==null||(h=c.getWorkspace())==null||h.addChangeListener(this.onWorkspaceChange.bind(this)),this.updateBubbleSize()}dispose(){this.miniWorkspace.dispose(),super.dispose()}getWorkspace(){return this.miniWorkspace}addWorkspaceChangeListener(e){this.miniWorkspace.addChangeListener(e)}validateWorkspaceOptions(e){if(e.hasCategories)throw Error("The miniworkspace bubble does not support toolboxes with categories");if(e.hasTrashcan)throw Error("The miniworkspace bubble does not support trashcans");if(e.zoomOptions.controls||e.zoomOptions.wheel||e.zoomOptions.pinch)throw Error("The miniworkspace bubble does not support zooming");if(e.moveOptions.scrollbars||e.moveOptions.wheel||e.moveOptions.drag)throw Error("The miniworkspace bubble does not scrolling/moving the workspace");if(e.horizontalLayout)throw Error("The miniworkspace bubble does not support horizontal layouts")}onWorkspaceChange(){this.bumpBlocksIntoBounds(),this.updateBubbleSize()}bumpBlocksIntoBounds(){if(!this.miniWorkspace.isDragging())for(const e of this.miniWorkspace.getTopBlocks(!1)){const t=e.getRelativeToSurfaceXY();if(20>t.y&&e.moveBy(0,20-t.y),e.RTL){let o=-20;const n=this.miniWorkspace.getFlyout();n&&(o-=n.getWidth()),t.x>o&&e.moveBy(o-t.x,0)}else 20>t.x&&e.moveBy(20-t.x,0)}}updateBubbleSize(){if(!this.miniWorkspace.isDragging()){var e=this.getSize(),t=this.calculateWorkspaceSize();Math.abs(e.width-t.width)<to.MINIMUM_VIEW_CHANGE&&Math.abs(e.height-t.height)<to.MINIMUM_VIEW_CHANGE||(this.svgDialog.setAttribute("width",`${t.width}px`),this.svgDialog.setAttribute("height",`${t.height}px`),this.miniWorkspace.setCachedParentSvgSize(t.width,t.height),this.miniWorkspace.RTL&&this.miniWorkspace.getCanvas().setAttribute("transform",`translate(${t.width}, 0)`),this.setSize(new Le(t.width+Ke.DOUBLE_BORDER,t.height+Ke.DOUBLE_BORDER),this.autoLayout),this.miniWorkspace.resize(),this.miniWorkspace.recordDragTargets())}}calculateWorkspaceSize(){var e=this.miniWorkspace.getCanvas().getBBox();let t=e.width+to.MARGIN;e=e.height+to.MARGIN;const o=this.miniWorkspace.getFlyout();if(o){const n=o.getWorkspace().getMetricsManager().getScrollMetrics();e=Math.max(e,n.height+20),t+=o.getWidth()}return new Le(t,e)}updateBlockStyles(){for(var e of this.miniWorkspace.getAllBlocks(!1))e.setStyle(e.getStyleName());let t;if(e=(t=this.miniWorkspace.getFlyout())==null?void 0:t.getWorkspace())for(const o of e.getAllBlocks(!1))o.setStyle(o.getStyleName())}moveDuringDrag(e){super.moveDuringDrag(e),this.autoLayout=!1}moveTo(e,t){super.moveTo(e,t),this.miniWorkspace.recordDragTargets()}newWorkspaceSvg(e){throw Error("The implementation of newWorkspaceSvg should be monkey-patched in by blockly.ts")}};to.MINIMUM_VIEW_CHANGE=10,to.MARGIN=3*Ke.DOUBLE_BORDER;var ul=class{constructor(e){this.sourceBlock=e,this.offsetInBlock=new K(0,0),this.workspaceLocation=new K(0,0),this.svgRoot=null,this.tooltip=e}getType(){throw Error("Icons must implement getType")}initView(e){if(!this.svgRoot){var t=this.sourceBlock;this.svgRoot=L(D.G,{class:"blocklyIconGroup"}),t.getSvgRoot().appendChild(this.svgRoot),this.updateSvgRootOffset(),Q(this.svgRoot,"pointerdown",this,e),this.svgRoot.tooltip=this,wi(this.svgRoot)}}dispose(){ga(this.svgRoot),Ge(this.svgRoot)}getWeight(){return-1}getSize(){return new Le(0,0)}setTooltip(e){this.tooltip=e??this.sourceBlock}getTooltip(){return this.tooltip}applyColour(){}updateEditable(){}updateCollapsed(){this.svgRoot&&(this.sourceBlock.isCollapsed()?this.svgRoot.style.display="none":this.svgRoot.style.display="block",vi(this)&&this.setBubbleVisible(!1))}hideForInsertionMarker(){this.svgRoot&&(this.svgRoot.style.display="none")}isShownWhenCollapsed(){return!1}setOffsetInBlock(e){this.offsetInBlock=e,this.updateSvgRootOffset()}updateSvgRootOffset(){let e;(e=this.svgRoot)==null||e.setAttribute("transform",`translate(${this.offsetInBlock.x}, ${this.offsetInBlock.y})`)}onLocationChange(e){this.workspaceLocation=K.sum(e,this.offsetInBlock)}onClick(){}isClickableInFlyout(e){return!0}},dl,hl;dl=17,hl=16,i.MutatorIcon$$module$build$src$core$icons$mutator_icon=class extends ul{constructor(e,t){super(t),this.flyoutBlockTypes=e,this.sourceBlock=t,this.saveConnectionsListener=this.updateWorkspacePid=this.rootBlock=this.miniWorkspaceBubble=null}getType(){return i.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE}initView(e){this.svgRoot||(super.initView(e),L(D.RECT,{class:"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},this.svgRoot),L(D.PATH,{class:"blocklyIconSymbol",d:"m4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 -0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z"},this.svgRoot),L(D.CIRCLE,{class:"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},this.svgRoot),fe(this.svgRoot,"blockly-icon-mutator"))}dispose(){super.dispose();let e;(e=this.miniWorkspaceBubble)==null||e.dispose()}getWeight(){return i.MutatorIcon$$module$build$src$core$icons$mutator_icon.WEIGHT}getSize(){return new Le(dl,dl)}applyColour(){super.applyColour();let e;(e=this.miniWorkspaceBubble)==null||e.setColour(this.sourceBlock.getColour());let t;(t=this.miniWorkspaceBubble)==null||t.updateBlockStyles()}updateCollapsed(){super.updateCollapsed(),this.sourceBlock.isCollapsed()&&this.setBubbleVisible(!1)}onLocationChange(e){super.onLocationChange(e);let t;(t=this.miniWorkspaceBubble)==null||t.setAnchorLocation(this.getAnchorLocation())}onClick(){super.onClick(),this.sourceBlock.isEditable()&&this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}bubbleIsVisible(){return!!this.miniWorkspaceBubble}setBubbleVisible(e){const t=this;return j.asyncExecutePromiseGeneratorFunction(function*(){if(t.bubbleIsVisible()!==e){if(yield ps(),e){t.miniWorkspaceBubble=new to(t.getMiniWorkspaceConfig(),t.sourceBlock.workspace,t.getAnchorLocation(),t.getBubbleOwnerRect()),t.applyColour(),t.createRootBlock(),t.addSaveConnectionsListener();let o;(o=t.miniWorkspaceBubble)==null||o.addWorkspaceChangeListener(t.createMiniWorkspaceChangeListener())}else{let o;(o=t.miniWorkspaceBubble)==null||o.dispose(),t.miniWorkspaceBubble=null,t.saveConnectionsListener&&t.sourceBlock.workspace.removeChangeListener(t.saveConnectionsListener),t.saveConnectionsListener=null}U(new(Y(M.BUBBLE_OPEN))(t.sourceBlock,e,"mutator"))}})}getMiniWorkspaceConfig(){let e;const t={disable:!1,media:this.sourceBlock.workspace.options.pathToMedia,rtl:this.sourceBlock.RTL,renderer:this.sourceBlock.workspace.options.renderer,rendererOverrides:(e=this.sourceBlock.workspace.options.rendererOverrides)!=null?e:void 0};return this.flyoutBlockTypes.length&&(t.toolbox={kind:"flyoutToolbox",contents:this.flyoutBlockTypes.map(o=>({kind:"block",type:o}))}),t}getAnchorLocation(){const e=dl/2;return K.sum(this.workspaceLocation,new K(e,e))}getBubbleOwnerRect(){const e=this.sourceBlock.getSvgRoot().getBBox();return new Je(e.y,e.y+e.height,e.x,e.x+e.width)}createRootBlock(){if(!this.sourceBlock.decompose)throw Error("Blocks with mutator icons must include a decompose method");this.rootBlock=this.sourceBlock.decompose(this.miniWorkspaceBubble.getWorkspace());for(var e of this.rootBlock.getDescendants(!1))e.queueRender();this.rootBlock.setMovable(!1),this.rootBlock.setDeletable(!1);let t,o,n,c;e=(c=(t=this.miniWorkspaceBubble)==null||(o=t.getWorkspace())==null||(n=o.getFlyout())==null?void 0:n.getWidth())!=null?c:0,this.rootBlock.moveBy(this.rootBlock.RTL?-(e+hl):hl,hl)}addSaveConnectionsListener(){this.sourceBlock.saveConnections&&this.rootBlock&&(this.saveConnectionsListener=()=>{this.sourceBlock.saveConnections&&this.rootBlock&&this.sourceBlock.saveConnections(this.rootBlock)},this.saveConnectionsListener(),this.sourceBlock.workspace.addChangeListener(this.saveConnectionsListener))}createMiniWorkspaceChangeListener(){return e=>{i.MutatorIcon$$module$build$src$core$icons$mutator_icon.isIgnorableMutatorEvent(e)||this.updateWorkspacePid||(this.updateWorkspacePid=setTimeout(()=>{this.updateWorkspacePid=null,this.recomposeSourceBlock()},0))}}static isIgnorableMutatorEvent(e){return e.isUiEvent||C(e)||O(e)&&e.element==="disabled"}recomposeSourceBlock(){if(this.rootBlock){if(!this.sourceBlock.compose)throw Error("Blocks with mutator icons must include a compose method");var e=i.getGroup$$module$build$src$core$events$utils();e||i.setGroup$$module$build$src$core$events$utils(!0);var t=Jo.getExtraBlockState_(this.sourceBlock);this.sourceBlock.compose(this.rootBlock);var o=Jo.getExtraBlockState_(this.sourceBlock);t!==o&&U(new(Y(M.BLOCK_CHANGE))(this.sourceBlock,"mutation",null,t,o)),i.setGroup$$module$build$src$core$events$utils(e)}}getWorkspace(){let e;return(e=this.miniWorkspaceBubble)==null?void 0:e.getWorkspace()}},i.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE=$t.MUTATOR,i.MutatorIcon$$module$build$src$core$icons$mutator_icon.WEIGHT=1,i.MutatorIcon$$module$build$src$core$icons$mutator_icon;var Ui=Object.create(null),sT={allExtensions:Ui};i.register$$module$build$src$core$extensions("parent_tooltip_when_inline",Gf);var vs={TEST_ONLY:sT};vs.apply=Ta,vs.buildTooltipForDropdown=i.buildTooltipForDropdown$$module$build$src$core$extensions,vs.buildTooltipWithFieldText=i.buildTooltipWithFieldText$$module$build$src$core$extensions,vs.isRegistered=Xu,vs.register=i.register$$module$build$src$core$extensions,vs.registerMixin=i.registerMixin$$module$build$src$core$extensions,vs.registerMutator=i.registerMutator$$module$build$src$core$extensions,vs.runAfterPageLoad=Wf,vs.unregister=Ff;var Re;(function(e){e[e.WIN_KEY_FF_LINUX=0]="WIN_KEY_FF_LINUX",e[e.MAC_ENTER=3]="MAC_ENTER",e[e.BACKSPACE=8]="BACKSPACE",e[e.TAB=9]="TAB",e[e.NUM_CENTER=12]="NUM_CENTER",e[e.ENTER=13]="ENTER",e[e.SHIFT=16]="SHIFT",e[e.CTRL=17]="CTRL",e[e.ALT=18]="ALT",e[e.PAUSE=19]="PAUSE",e[e.CAPS_LOCK=20]="CAPS_LOCK",e[e.ESC=27]="ESC",e[e.SPACE=32]="SPACE",e[e.PAGE_UP=33]="PAGE_UP",e[e.PAGE_DOWN=34]="PAGE_DOWN",e[e.END=35]="END",e[e.HOME=36]="HOME",e[e.LEFT=37]="LEFT",e[e.UP=38]="UP",e[e.RIGHT=39]="RIGHT",e[e.DOWN=40]="DOWN",e[e.PLUS_SIGN=43]="PLUS_SIGN",e[e.PRINT_SCREEN=44]="PRINT_SCREEN",e[e.INSERT=45]="INSERT",e[e.DELETE=46]="DELETE",e[e.ZERO=48]="ZERO",e[e.ONE=49]="ONE",e[e.TWO=50]="TWO",e[e.THREE=51]="THREE",e[e.FOUR=52]="FOUR",e[e.FIVE=53]="FIVE",e[e.SIX=54]="SIX",e[e.SEVEN=55]="SEVEN",e[e.EIGHT=56]="EIGHT",e[e.NINE=57]="NINE",e[e.FF_SEMICOLON=59]="FF_SEMICOLON",e[e.FF_EQUALS=61]="FF_EQUALS",e[e.FF_DASH=173]="FF_DASH",e[e.FF_HASH=163]="FF_HASH",e[e.QUESTION_MARK=63]="QUESTION_MARK",e[e.AT_SIGN=64]="AT_SIGN",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.META=91]="META",e[e.WIN_KEY_RIGHT=92]="WIN_KEY_RIGHT",e[e.CONTEXT_MENU=93]="CONTEXT_MENU",e[e.NUM_ZERO=96]="NUM_ZERO",e[e.NUM_ONE=97]="NUM_ONE",e[e.NUM_TWO=98]="NUM_TWO",e[e.NUM_THREE=99]="NUM_THREE",e[e.NUM_FOUR=100]="NUM_FOUR",e[e.NUM_FIVE=101]="NUM_FIVE",e[e.NUM_SIX=102]="NUM_SIX",e[e.NUM_SEVEN=103]="NUM_SEVEN",e[e.NUM_EIGHT=104]="NUM_EIGHT",e[e.NUM_NINE=105]="NUM_NINE",e[e.NUM_MULTIPLY=106]="NUM_MULTIPLY",e[e.NUM_PLUS=107]="NUM_PLUS",e[e.NUM_MINUS=109]="NUM_MINUS",e[e.NUM_PERIOD=110]="NUM_PERIOD",e[e.NUM_DIVISION=111]="NUM_DIVISION",e[e.F1=112]="F1",e[e.F2=113]="F2",e[e.F3=114]="F3",e[e.F4=115]="F4",e[e.F5=116]="F5",e[e.F6=117]="F6",e[e.F7=118]="F7",e[e.F8=119]="F8",e[e.F9=120]="F9",e[e.F10=121]="F10",e[e.F11=122]="F11",e[e.F12=123]="F12",e[e.NUMLOCK=144]="NUMLOCK",e[e.SCROLL_LOCK=145]="SCROLL_LOCK",e[e.FIRST_MEDIA_KEY=166]="FIRST_MEDIA_KEY",e[e.LAST_MEDIA_KEY=183]="LAST_MEDIA_KEY",e[e.SEMICOLON=186]="SEMICOLON",e[e.DASH=189]="DASH",e[e.EQUALS=187]="EQUALS",e[e.COMMA=188]="COMMA",e[e.PERIOD=190]="PERIOD",e[e.SLASH=191]="SLASH",e[e.APOSTROPHE=192]="APOSTROPHE",e[e.TILDE=192]="TILDE",e[e.SINGLE_QUOTE=222]="SINGLE_QUOTE",e[e.OPEN_SQUARE_BRACKET=219]="OPEN_SQUARE_BRACKET",e[e.BACKSLASH=220]="BACKSLASH",e[e.CLOSE_SQUARE_BRACKET=221]="CLOSE_SQUARE_BRACKET",e[e.WIN_KEY=224]="WIN_KEY",e[e.MAC_FF_META=224]="MAC_FF_META",e[e.MAC_WK_CMD_LEFT=91]="MAC_WK_CMD_LEFT",e[e.MAC_WK_CMD_RIGHT=93]="MAC_WK_CMD_RIGHT",e[e.WIN_IME=229]="WIN_IME",e[e.VK_NONAME=252]="VK_NONAME",e[e.PHANTOM=255]="PHANTOM"})(Re||(Re={}));var so={};so.arc=pt,so.curve=zt,so.line=Si,so.lineOnAxis=ae,so.lineTo=xs,so.moveBy=rt,so.moveTo=vt,so.point=he;var ct={};ct.Coordinate=K,ct.KeyCodes=Re,ct.Rect=Je,ct.Size=Le,ct.Svg=D,ct.aria=Vn,ct.array=X$,ct.browserEvents=Xs,ct.colour=ts,ct.deprecation=x$,ct.dom=St,ct.extensions=vs,ct.idGenerator=Ud,ct.math=Ja,ct.object=Mb,ct.parsing=er,ct.string=Li,ct.style=fo,ct.svgMath=Wo,ct.svgPaths=so,ct.toolbox=$o,ct.userAgent=UC,ct.xml=xi;var Bb=class extends Ke{constructor(e,t,o){super(e,t,o),this.workspace=e,this.anchor=t,this.ownerRect=o,this.resizePointerMoveListener=this.resizePointerUpListener=null,this.textChangeListeners=[],this.sizeChangeListeners=[],this.text="",this.DEFAULT_SIZE=new Le(160+Ke.DOUBLE_BORDER,80+Ke.DOUBLE_BORDER),this.MIN_SIZE=new Le(45+Ke.DOUBLE_BORDER,20+Ke.DOUBLE_BORDER),this.editable=!0,fe(this.svgRoot,"blocklyTextInputBubble"),{inputRoot:this.inputRoot,textArea:this.textArea}=this.createEditor(this.contentContainer),this.resizeGroup=this.createResizeHandle(this.svgRoot,e),this.setSize(this.DEFAULT_SIZE,!0)}getText(){return this.text}setText(e){this.text=e,this.textArea.value=e,this.onTextChange()}setEditable(e){(this.editable=e)?this.textArea.removeAttribute("readonly"):this.textArea.setAttribute("readonly","")}isEditable(){return this.editable}addTextChangeListener(e){this.textChangeListeners.push(e)}addSizeChangeListener(e){this.sizeChangeListeners.push(e)}createEditor(e){e=L(D.FOREIGNOBJECT,{x:Ke.BORDER_WIDTH,y:Ke.BORDER_WIDTH},e);const t=document.createElementNS(As,"body");t.setAttribute("xmlns",As),t.className="blocklyMinimalBody";const o=document.createElementNS(As,"textarea");return o.className="blocklyTextarea blocklyText",o.setAttribute("dir",this.workspace.RTL?"RTL":"LTR"),t.appendChild(o),e.appendChild(t),this.bindTextAreaEvents(o),setTimeout(()=>{o.focus()},0),{inputRoot:e,textArea:o}}bindTextAreaEvents(e){Q(e,"wheel",this,t=>{t.stopPropagation()}),Q(e,"focus",this,this.onStartEdit,!0),Q(e,"change",this,this.onTextChange)}createResizeHandle(e,t){return e=L(D.IMAGE,{class:"blocklyResizeHandle",href:`${t.options.pathToMedia}resize-handle.svg`},e),Q(e,"pointerdown",this,this.onResizePointerDown),e}setSize(e,t=!1){e.width=Math.max(e.width,this.MIN_SIZE.width),e.height=Math.max(e.height,this.MIN_SIZE.height);const o=e.width-Ke.DOUBLE_BORDER,n=e.height-Ke.DOUBLE_BORDER;this.inputRoot.setAttribute("width",`${o}`),this.inputRoot.setAttribute("height",`${n}`),this.resizeGroup.setAttribute("y",`${n}`),this.workspace.RTL?this.resizeGroup.setAttribute("x",`${-Ke.DOUBLE_BORDER}`):this.resizeGroup.setAttribute("x",`${o}`),super.setSize(e,t),this.onSizeChange()}getSize(){return super.getSize()}onResizePointerDown(e){this.bringToFront(),_e(e)||(va(this.workspace,e,new K(this.workspace.RTL?-this.getSize().width:this.getSize().width,this.getSize().height)),this.resizePointerUpListener=Q(document,"pointerup",this,this.onResizePointerUp),this.resizePointerMoveListener=Q(document,"pointermove",this,this.onResizePointerMove),this.workspace.hideChaff()),e.stopPropagation()}onResizePointerUp(e){Ee(),this.resizePointerUpListener&&(ze(this.resizePointerUpListener),this.resizePointerUpListener=null),this.resizePointerMoveListener&&(ze(this.resizePointerMoveListener),this.resizePointerMoveListener=null)}onResizePointerMove(e){e=ya(this.workspace,e),this.setSize(new Le(this.workspace.RTL?-e.x:e.x,e.y),!1),this.onSizeChange()}onStartEdit(){this.bringToFront()&&this.textArea.focus()}onTextChange(){this.text=this.textArea.value;for(const e of this.textChangeListeners)e()}onSizeChange(){for(const e of this.sizeChangeListeners)e()}};Tt(`
879
+ .blocklyTextInputBubble .blocklyTextarea {
880
+ background-color: var(--commentFillColour);
881
+ border: 0;
882
+ box-sizing: border-box;
883
+ display: block;
884
+ outline: 0;
885
+ padding: 5px;
886
+ resize: none;
887
+ width: 100%;
888
+ height: 100%;
889
+ }
890
+ `);var Dh={};Dh.register=Qu,Dh.unregister=Kf;var Ah=17,Pb=160,Fb=80,oo=class extends ul{constructor(e){super(e),this.sourceBlock=e,this.textInputBubble=null,this.text="",this.bubbleSize=new Le(Pb,Fb),this.bubbleVisiblity=!1}getType(){return oo.TYPE}initView(e){this.svgRoot||(super.initView(e),L(D.CIRCLE,{class:"blocklyIconShape",r:"8",cx:"8",cy:"8"},this.svgRoot),L(D.PATH,{class:"blocklyIconSymbol",d:"m6.8,10h2c0.003,-0.617 0.271,-0.962 0.633,-1.266 2.875,-2.4050.607,-5.534 -3.765,-3.874v1.7c3.12,-1.657 3.698,0.118 2.336,1.25-1.201,0.998 -1.201,1.528 -1.204,2.19z"},this.svgRoot),L(D.RECT,{class:"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},this.svgRoot),fe(this.svgRoot,"blockly-icon-comment"))}dispose(){super.dispose();let e;(e=this.textInputBubble)==null||e.dispose()}getWeight(){return oo.WEIGHT}getSize(){return new Le(Ah,Ah)}applyColour(){super.applyColour();const e=this.sourceBlock.getColour();let t;(t=this.textInputBubble)==null||t.setColour(e)}updateEditable(){const e=this,t=()=>super.updateEditable;return j.asyncExecutePromiseGeneratorFunction(function*(){t().call(e),e.bubbleIsVisible()&&(yield e.setBubbleVisible(!1),yield e.setBubbleVisible(!0))})}onLocationChange(e){super.onLocationChange(e),e=this.getAnchorLocation();let t;(t=this.textInputBubble)==null||t.setAnchorLocation(e)}setText(e){const t=this.text;U(new(Y(M.BLOCK_CHANGE))(this.sourceBlock,"comment",null,t,e)),this.text=e;let o;(o=this.textInputBubble)==null||o.setText(this.text)}getText(){return this.text}setBubbleSize(e){this.bubbleSize=e;let t;(t=this.textInputBubble)==null||t.setSize(this.bubbleSize,!0)}getBubbleSize(){return this.bubbleSize}saveState(){return this.text?{text:this.text,pinned:this.bubbleIsVisible(),height:this.bubbleSize.height,width:this.bubbleSize.width}:null}loadState(e){let t;this.text=(t=e.text)!=null?t:"";let o,n;this.bubbleSize=new Le((o=e.width)!=null?o:Pb,(n=e.height)!=null?n:Fb);let c;this.bubbleVisiblity=(c=e.pinned)!=null?c:!1,this.setBubbleVisible(this.bubbleVisiblity)}onClick(){super.onClick(),this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}onTextChange(){if(this.textInputBubble){var e=this.textInputBubble.getText();this.text!==e&&(U(new(Y(M.BLOCK_CHANGE))(this.sourceBlock,"comment",null,this.text,e)),this.text=e)}}onSizeChange(){this.textInputBubble&&(this.bubbleSize=this.textInputBubble.getSize())}bubbleIsVisible(){return this.bubbleVisiblity}setBubbleVisible(e){const t=this;return j.asyncExecutePromiseGeneratorFunction(function*(){t.bubbleVisiblity!==e&&(t.bubbleVisiblity=e,yield ps(),!t.sourceBlock.rendered||t.sourceBlock.isInFlyout||t.sourceBlock.isInsertionMarker()||(e?(t.sourceBlock.isEditable()?t.showEditableBubble():t.showNonEditableBubble(),t.applyColour()):t.hideBubble(),U(new(Y(M.BUBBLE_OPEN))(t.sourceBlock,e,"comment"))))})}showEditableBubble(){this.createBubble();let e;(e=this.textInputBubble)==null||e.addTextChangeListener(()=>this.onTextChange());let t;(t=this.textInputBubble)==null||t.addSizeChangeListener(()=>this.onSizeChange())}showNonEditableBubble(){this.createBubble();let e;(e=this.textInputBubble)==null||e.setEditable(!1)}createBubble(){this.textInputBubble=new Bb(this.sourceBlock.workspace,this.getAnchorLocation(),this.getBubbleOwnerRect()),this.textInputBubble.setText(this.getText()),this.textInputBubble.setSize(this.bubbleSize,!0)}hideBubble(){let e;(e=this.textInputBubble)==null||e.dispose(),this.textInputBubble=null}getAnchorLocation(){const e=Ah/2;return K.sum(this.workspaceLocation,new K(e,e))}getBubbleOwnerRect(){return this.sourceBlock.getBoundingRectangleWithoutChildren()}};oo.TYPE=$t.COMMENT,oo.WEIGHT=3,Qu(oo.TYPE,oo);var jb=class extends Error{constructor(e){super(`Tried to append an icon of type ${e.getType()} when an icon of that type already exists on the block. Use getIcon to access the existing icon.`),this.icon=e}},zb={};zb.DuplicateIconType=jb;var Ub=class extends Ke{constructor(e,t,o,n){super(t,o,n),this.text=e,this.workspace=t,this.anchor=o,this.ownerRect=n,this.paragraph=this.stringToSvg(e,this.contentContainer),this.updateBubbleSize()}getText(){return this.text}setText(e){this.text=e,Ge(this.paragraph),this.paragraph=this.stringToSvg(e,this.contentContainer),this.updateBubbleSize()}stringToSvg(e,t){return t=this.createParagraph(t),e=this.createTextFragments(t,e),this.workspace.RTL&&this.rightAlignTextFragments(t.getBBox().width,e),t}createParagraph(e){return L(D.G,{class:"blocklyText blocklyBubbleText blocklyNoPointerEvents",transform:`translate(0,${Ke.BORDER_WIDTH})`,style:`direction: ${this.workspace.RTL?"rtl":"ltr"}`},e)}createTextFragments(e,t){let o=1;return t.split(`
891
+ `).map(n=>{const c=L(D.TEXT,{y:`${o}em`,x:Ke.BORDER_WIDTH},e);return n=document.createTextNode(n),c.appendChild(n),o+=1,c})}rightAlignTextFragments(e,t){for(const o of t)o.setAttribute("text-anchor","start"),o.setAttribute("x",`${e+Ke.BORDER_WIDTH}`)}updateBubbleSize(){const e=this.paragraph.getBBox();this.setSize(new Le(e.width+2*Ke.BORDER_WIDTH,e.height+2*Ke.BORDER_WIDTH),!0)}},Rh=17,io=class extends ul{constructor(e){super(e),this.sourceBlock=e,this.textMap=new Map,this.textBubble=null}getType(){return io.TYPE}initView(e){this.svgRoot||(super.initView(e),L(D.PATH,{class:"blocklyIconShape",d:"M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z"},this.svgRoot),L(D.PATH,{class:"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},this.svgRoot),L(D.RECT,{class:"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},this.svgRoot),fe(this.svgRoot,"blockly-icon-warning"))}dispose(){super.dispose();let e;(e=this.textBubble)==null||e.dispose()}getWeight(){return io.WEIGHT}getSize(){return new Le(Rh,Rh)}applyColour(){super.applyColour();let e;(e=this.textBubble)==null||e.setColour(this.sourceBlock.getColour())}updateCollapsed(){}isShownWhenCollapsed(){return!0}onLocationChange(e){super.onLocationChange(e);let t;(t=this.textBubble)==null||t.setAnchorLocation(this.getAnchorLocation())}addMessage(e,t){if(this.textMap.get(t)===e)return this;e?this.textMap.set(t,e):this.textMap.delete(t);let o;return(o=this.textBubble)==null||o.setText(this.getText()),this}getText(){return[...this.textMap.values()].join(`
892
+ `)}onClick(){super.onClick(),this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}bubbleIsVisible(){return!!this.textBubble}setBubbleVisible(e){const t=this;return j.asyncExecutePromiseGeneratorFunction(function*(){if(t.bubbleIsVisible()!==e){if(yield ps(),e)t.textBubble=new Ub(t.getText(),t.sourceBlock.workspace,t.getAnchorLocation(),t.getBubbleOwnerRect()),t.applyColour();else{let o;(o=t.textBubble)==null||o.dispose(),t.textBubble=null}U(new(Y(M.BUBBLE_OPEN))(t.sourceBlock,e,"warning"))}})}getAnchorLocation(){const e=Rh/2;return K.sum(this.workspaceLocation,new K(e,e))}getBubbleOwnerRect(){const e=this.sourceBlock.getSvgRoot().getBBox();return new Je(e.y,e.y+e.height,e.x,e.x+e.width)}};io.TYPE=$t.WARNING,io.WEIGHT=2;var _o={};_o.CommentIcon=oo,_o.Icon=ul,_o.IconType=$t,_o.MutatorIcon=i.MutatorIcon$$module$build$src$core$icons$mutator_icon,_o.WarningIcon=io,_o.exceptions=zb,_o.registry=Dh,i.Names$$module$build$src$core$names=class{constructor(e,t){this.db=new Map,this.dbReverse=new Set,this.variableMap=null,this.variablePrefix=t||"",this.reservedWords=new Set(e?e.split(","):[])}reset(){this.db.clear(),this.dbReverse.clear(),this.variableMap=null}setVariableMap(e){this.variableMap=e}getNameForUserVariable(e){return this.variableMap?(e=this.variableMap.getVariableById(e))?e.name:null:(console.warn(`Deprecated call to Names.prototype.getName without defining a variable map. To fix, add the following code in your generator's init() function:
893
+ Blockly.YourGeneratorName.nameDB_.setVariableMap(workspace.getVariableMap());`),null)}populateVariables(e){e=i.allUsedVarModels$$module$build$src$core$variables(e);for(let t=0;t<e.length;t++)this.getName(e[t].getId(),i.NameType$$module$build$src$core$names.VARIABLE)}populateProcedures(e){throw Error("The implementation of populateProcedures should be monkey-patched in by blockly.ts")}getName(e,t){let o=e;t===i.NameType$$module$build$src$core$names.VARIABLE&&(e=this.getNameForUserVariable(e))&&(o=e),e=o.toLowerCase();const n=t===i.NameType$$module$build$src$core$names.VARIABLE||t===i.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE?this.variablePrefix:"";this.db.has(t)||this.db.set(t,new Map);const c=this.db.get(t);return c.has(e)?n+c.get(e):(t=this.getDistinctName(o,t),c.set(e,t.substr(n.length)),t)}getUserNames(e){let t;return(e=(t=this.db.get(e))==null?void 0:t.keys())?Array.from(e):[]}getDistinctName(e,t){e=this.safeName(e);let o=null,n,c;for(;this.dbReverse.has(e+((n=o)!=null?n:""))||this.reservedWords.has(e+((c=o)!=null?c:""));)o=o?o+1:2;let h;return e+=(h=o)!=null?h:"",this.dbReverse.add(e),(t===i.NameType$$module$build$src$core$names.VARIABLE||t===i.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE?this.variablePrefix:"")+e}safeName(e){return e?(e=encodeURI(e.replace(/ /g,"_")).replace(/[^\w]/g,"_"),"0123456789".includes(e[0])&&(e="my_"+e)):e=i.Msg$$module$build$src$core$msg.UNNAMED_KEY||"unnamed",e}static equals(e,t){return e.toLowerCase()===t.toLowerCase()}},(function(e){e=e.NameType||(e.NameType={}),e.DEVELOPER_VARIABLE="DEVELOPER_VARIABLE",e.VARIABLE="VARIABLE",e.PROCEDURE="PROCEDURE"})(i.Names$$module$build$src$core$names||(i.Names$$module$build$src$core$names={})),i.NameType$$module$build$src$core$names=i.Names$$module$build$src$core$names.NameType,i.Names$$module$build$src$core$names.DEVELOPER_VARIABLE_TYPE=i.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE,i.NameType$$module$build$src$core$names,i.Names$$module$build$src$core$names;var Hb=class extends Map{constructor(){super()}set(e,t){return this.get(e)===t?this:(super.set(e,t),Ea(t)&&t.startPublishing(),this)}delete(e){const t=this.get(e);return e=super.delete(e),e&&(Ea(t)&&t.stopPublishing(),e)}clear(){if(this.size)for(const e of this.keys())this.delete(e)}add(e){return this.set(e.getId(),e)}getProcedures(){return[...this.values()]}},pl,Bt;pl="PROCEDURE",i.DEFAULT_ARG$$module$build$src$core$procedures="x",Bt={CATEGORY_NAME:pl,DEFAULT_ARG:i.DEFAULT_ARG$$module$build$src$core$procedures},Bt.ObservableProcedureMap=Hb,Bt.allProcedures=Ia,Bt.findLegalName=i.findLegalName$$module$build$src$core$procedures,Bt.flyoutCategory=xa,Bt.getCallers=id,Bt.getDefinition=i.getDefinition$$module$build$src$core$procedures,Bt.isNameUsed=td,Bt.isProcedureBlock=po,Bt.mutateCallers=i.mutateCallers$$module$build$src$core$procedures,Bt.mutatorOpenListener=od,Bt.rename=i.rename$$module$build$src$core$procedures;var oT=class{constructor(){this.NONE=0,this.FIELD=1,this.HAT=2,this.ICON=4,this.SPACER=8,this.BETWEEN_ROW_SPACER=16,this.IN_ROW_SPACER=32,this.EXTERNAL_VALUE_INPUT=64,this.INPUT=128,this.INLINE_INPUT=256,this.STATEMENT_INPUT=512,this.CONNECTION=1024,this.PREVIOUS_CONNECTION=2048,this.NEXT_CONNECTION=4096,this.OUTPUT_CONNECTION=8192,this.CORNER=16384,this.LEFT_SQUARE_CORNER=32768,this.LEFT_ROUND_CORNER=65536,this.RIGHT_SQUARE_CORNER=131072,this.RIGHT_ROUND_CORNER=262144,this.JAGGED_EDGE=524288,this.ROW=1048576,this.TOP_ROW=2097152,this.BOTTOM_ROW=4194304,this.INPUT_ROW=8388608,this.LEFT_CORNER=this.LEFT_SQUARE_CORNER|this.LEFT_ROUND_CORNER,this.RIGHT_CORNER=this.RIGHT_SQUARE_CORNER|this.RIGHT_ROUND_CORNER,this.nextTypeValue_=16777216}getType(e){return Object.prototype.hasOwnProperty.call(this,e)||(this[e]=this.nextTypeValue_,this.nextTypeValue_<<=1),this[e]}isField(e){return e.type&this.FIELD}isHat(e){return e.type&this.HAT}isIcon(e){return e.type&this.ICON}isSpacer(e){return e.type&this.SPACER}isInRowSpacer(e){return e.type&this.IN_ROW_SPACER}isInput(e){return e.type&this.INPUT}isExternalInput(e){return e.type&this.EXTERNAL_VALUE_INPUT}isInlineInput(e){return e.type&this.INLINE_INPUT}isStatementInput(e){return e.type&this.STATEMENT_INPUT}isPreviousConnection(e){return e.type&this.PREVIOUS_CONNECTION}isNextConnection(e){return e.type&this.NEXT_CONNECTION}isPreviousOrNextConnection(e){return e.type&(this.PREVIOUS_CONNECTION|this.NEXT_CONNECTION)}isLeftRoundedCorner(e){return e.type&this.LEFT_ROUND_CORNER}isRightRoundedCorner(e){return e.type&this.RIGHT_ROUND_CORNER}isLeftSquareCorner(e){return e.type&this.LEFT_SQUARE_CORNER}isRightSquareCorner(e){return e.type&this.RIGHT_SQUARE_CORNER}isCorner(e){return e.type&this.CORNER}isJaggedEdge(e){return e.type&this.JAGGED_EDGE}isRow(e){return e.type&this.ROW}isBetweenRowSpacer(e){return e.type&this.BETWEEN_ROW_SPACER}isTopRow(e){return e.type&this.TOP_ROW}isBottomRow(e){return e.type&this.BOTTOM_ROW}isTopOrBottomRow(e){return e.type&(this.TOP_ROW|this.BOTTOM_ROW)}isInputRow(e){return e.type&this.INPUT_ROW}},E=new oT,Rs=class{constructor(e){this.centerline=this.xPos=this.height=this.width=0,this.constants_=e,this.type=E.NONE,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT}},or=class{constructor(e){this.elements=[],this.xPos=this.yPos=this.widthWithConnectedBlocks=this.minWidth=this.minHeight=this.width=this.height=0,this.hasStatement=this.hasExternalInput=!1,this.statementEdge=0,this.hasJaggedEdge=this.hasDummyInput=this.hasInlineInput=!1,this.align=null,this.constants_=e,this.type=E.ROW,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT}getLastInput(){for(let e=this.elements.length-1;0<=e;e--){const t=this.elements[e];if(E.isInput(t))return t}return null}measure(){throw Error("Unexpected attempt to measure a base Row.")}startsWithElemSpacer(){return!0}endsWithElemSpacer(){return!0}getFirstSpacer(){for(let e=0;e<this.elements.length;e++){const t=this.elements[e];if(E.isSpacer(t))return t}return null}getLastSpacer(){for(let e=this.elements.length-1;0<=e;e--){const t=this.elements[e];if(E.isSpacer(t))return t}return null}},Oh=class extends or{constructor(e){super(e),this.hasNextConnection=!1,this.connection=null,this.baseline=this.descenderHeight=0,this.type|=E.BOTTOM_ROW}hasLeftSquareCorner(e){return!!e.outputConnection||!!e.getNextBlock()}hasRightSquareCorner(e){return!0}measure(){let e=0,t=0,o=0;for(let n=0;n<this.elements.length;n++){const c=this.elements[n];t+=c.width,E.isSpacer(c)||(E.isNextConnection(c)?o=Math.max(o,c.height):e=Math.max(e,c.height))}this.width=Math.max(this.minWidth,t),this.height=Math.max(this.minHeight,e)+o,this.descenderHeight=o,this.widthWithConnectedBlocks=this.width}startsWithElemSpacer(){return!1}endsWithElemSpacer(){return!1}},no=class extends Rs{constructor(e,t){super(e),this.connectionModel=t,this.type|=E.CONNECTION,this.shape=this.constants_.shapeFor(t),this.isDynamicShape="isDynamic"in this.shape&&this.shape.isDynamic,this.highlighted=t.isHighlighted()}},wo=class extends no{constructor(e,t){super(e,t.connection),this.input=t,this.connectionOffsetY=this.connectionOffsetX=0,this.type|=E.INPUT,this.align=t.align,(this.connectedBlock=t.connection&&t.connection.targetBlock()?t.connection.targetBlock():null)?(e=this.connectedBlock.getHeightWidth(),this.connectedBlockWidth=e.width,this.connectedBlockHeight=e.height):this.connectedBlockHeight=this.connectedBlockWidth=0}},gl=class extends wo{constructor(e,t){super(e,t),this.height=0,this.type|=E.EXTERNAL_VALUE_INPUT,this.height=this.connectedBlock?this.connectedBlockHeight-this.constants_.TAB_OFFSET_FROM_TOP-this.constants_.MEDIUM_PADDING:this.shape.height,this.width=this.shape.width+this.constants_.EXTERNAL_VALUE_INPUT_PADDING,this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP,this.connectionHeight=this.shape.height,this.connectionWidth=this.shape.width}},Hi=class extends Rs{constructor(e,t,o){super(e),this.field=t,this.parentInput=o,this.isEditable=t.EDITABLE,this.flipRtl=t.getFlipRtl(),this.type|=E.FIELD,e=this.field.getSize(),this.height=e.height,this.width=e.width}},Mh=class extends Rs{constructor(e){super(e),this.type|=E.HAT,this.height=this.constants_.START_HAT.height,this.width=this.constants_.START_HAT.width,this.ascenderHeight=this.height}},Wb=class extends Rs{constructor(e,t){super(e),this.icon=t,this.flipRtl=!1,this.type|=E.ICON,e=t.getSize(),this.height=e.height,this.width=e.width}},Xt=class extends Rs{constructor(e,t){super(e),this.type=this.type|E.SPACER|E.IN_ROW_SPACER,this.width=t,this.height=this.constants_.SPACER_DEFAULT_HEIGHT}},Nh=class extends wo{constructor(e,t){super(e,t),this.type|=E.INLINE_INPUT,this.connectedBlock?(this.width=this.connectedBlockWidth,this.height=this.connectedBlockHeight):(this.height=this.constants_.EMPTY_INLINE_INPUT_HEIGHT,this.width=this.constants_.EMPTY_INLINE_INPUT_PADDING),this.connectionHeight=this.isDynamicShape?this.shape.height(this.height):this.shape.height,this.connectionWidth=this.isDynamicShape?this.shape.width(this.height):this.shape.width,this.connectedBlock||(this.width+=this.connectionWidth*(this.isDynamicShape?2:1)),this.connectionOffsetY="connectionOffsetY"in this.shape?this.shape.connectionOffsetY(this.connectionHeight):this.constants_.TAB_OFFSET_FROM_TOP,this.connectionOffsetX="connectionOffsetX"in this.shape?this.shape.connectionOffsetX(this.connectionWidth):0}},ir=class extends wo{constructor(e,t){super(e,t),this.type|=E.STATEMENT_INPUT,this.height=this.connectedBlock?this.connectedBlockHeight+this.constants_.STATEMENT_BOTTOM_SPACER:this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT,this.width=this.constants_.STATEMENT_INPUT_NOTCH_OFFSET+this.shape.width}},Lh=class extends or{constructor(e){super(e),this.connectedBlockWidths=0,this.type|=E.INPUT_ROW}measure(){this.width=this.minWidth,this.height=this.minHeight;let e=0;for(let t=0;t<this.elements.length;t++){const o=this.elements[t];this.width+=o.width,E.isInput(o)&&o instanceof wo&&(E.isStatementInput(o)&&o instanceof ir?e+=o.connectedBlockWidth:E.isExternalInput(o)&&o instanceof gl&&o.connectedBlockWidth!==0&&(e+=o.connectedBlockWidth-o.connectionWidth)),E.isSpacer(o)||(this.height=Math.max(this.height,o.height))}this.connectedBlockWidths=e,this.widthWithConnectedBlocks=this.width+e}endsWithElemSpacer(){return!this.hasExternalInput&&!this.hasStatement}},Vb=class extends Rs{constructor(e){super(e),this.type|=E.JAGGED_EDGE,this.height=this.constants_.JAGGED_TEETH.height,this.width=this.constants_.JAGGED_TEETH.width}},Gb=class extends no{constructor(e,t){super(e,t),this.type|=E.NEXT_CONNECTION,this.height=this.shape.height,this.width=this.shape.width}},Kb=class extends no{constructor(e,t){super(e,t),this.connectionOffsetX=0,this.type|=E.OUTPUT_CONNECTION,this.height=this.isDynamicShape?0:this.shape.height,this.startX=this.width=this.isDynamicShape?0:this.shape.width,this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP}},Yb=class extends no{constructor(e,t){super(e,t),this.type|=E.PREVIOUS_CONNECTION,this.height=this.shape.height,this.width=this.shape.width}},nr=class extends Rs{constructor(e,t){super(e),this.type=(t&&t!=="left"?E.RIGHT_ROUND_CORNER:E.LEFT_ROUND_CORNER)|E.CORNER,this.width=this.constants_.CORNER_RADIUS,this.height=this.constants_.CORNER_RADIUS/2}},Bh=class extends or{constructor(e,t,o){super(e),this.height=t,this.width=o,this.precedesStatement=this.followsStatement=!1,this.widthWithConnectedBlocks=0,this.type=this.type|E.SPACER|E.BETWEEN_ROW_SPACER,this.elements=[new Xt(this.constants_,o)]}measure(){}},rr=class extends Rs{constructor(e,t){super(e),this.type=(t&&t!=="left"?E.RIGHT_SQUARE_CORNER:E.LEFT_SQUARE_CORNER)|E.CORNER,this.width=this.height=this.constants_.NO_PADDING}},Ph=class extends or{constructor(e){super(e),this.ascenderHeight=this.capline=0,this.hasPreviousConnection=!1,this.connection=null,this.type|=E.TOP_ROW}hasLeftSquareCorner(e){const t=(e.hat?e.hat==="cap":this.constants_.ADD_START_HATS)&&!e.outputConnection&&!e.previousConnection,o=e.getPreviousBlock();return!!e.outputConnection||t||(o?o.getNextBlock()===e:!1)}hasRightSquareCorner(e){return!0}measure(){let e=0,t=0,o=0;for(let n=0;n<this.elements.length;n++){const c=this.elements[n];t+=c.width,E.isSpacer(c)||(E.isHat(c)&&c instanceof Mh?o=Math.max(o,c.ascenderHeight):e=Math.max(e,c.height))}this.width=Math.max(this.minWidth,t),this.height=Math.max(this.minHeight,e)+o,this.capline=this.ascenderHeight=o,this.widthWithConnectedBlocks=this.width}startsWithElemSpacer(){return!1}endsWithElemSpacer(){return!1}},ml=class{constructor(){this.NO_PADDING=0,this.SMALL_PADDING=3,this.MEDIUM_PADDING=5,this.MEDIUM_LARGE_PADDING=8,this.LARGE_PADDING=10,this.TAB_HEIGHT=15,this.TAB_OFFSET_FROM_TOP=5,this.TAB_VERTICAL_OVERLAP=2.5,this.TAB_WIDTH=8,this.NOTCH_WIDTH=15,this.NOTCH_HEIGHT=4,this.MIN_BLOCK_WIDTH=12,this.EMPTY_BLOCK_SPACER_HEIGHT=16,this.CORNER_RADIUS=8,this.NOTCH_OFFSET_LEFT=15,this.STATEMENT_BOTTOM_SPACER=0,this.STATEMENT_INPUT_PADDING_LEFT=20,this.BETWEEN_STATEMENT_PADDING_Y=4,this.ADD_START_HATS=!1,this.START_HAT_HEIGHT=15,this.START_HAT_WIDTH=100,this.SPACER_DEFAULT_HEIGHT=15,this.MIN_BLOCK_HEIGHT=24,this.EMPTY_INLINE_INPUT_PADDING=14.5,this.EXTERNAL_VALUE_INPUT_PADDING=2,this.JAGGED_TEETH_HEIGHT=12,this.JAGGED_TEETH_WIDTH=6,this.FIELD_TEXT_FONTSIZE=11,this.FIELD_TEXT_FONTWEIGHT="normal",this.FIELD_TEXT_FONTFAMILY="sans-serif",this.FIELD_TEXT_BASELINE=this.FIELD_TEXT_HEIGHT=-1,this.FIELD_BORDER_RECT_RADIUS=4,this.FIELD_BORDER_RECT_HEIGHT=16,this.FIELD_BORDER_RECT_X_PADDING=5,this.FIELD_BORDER_RECT_Y_PADDING=3,this.FIELD_BORDER_RECT_COLOUR="#fff",this.FIELD_DROPDOWN_SVG_ARROW=this.FIELD_DROPDOWN_COLOURED_DIV=this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW=!1,this.FIELD_DROPDOWN_SVG_ARROW_SIZE=12,this.FIELD_COLOUR_FULL_BLOCK=this.FIELD_TEXTINPUT_BOX_SHADOW=!1,this.FIELD_COLOUR_DEFAULT_WIDTH=26,this.defs=null,this.embossFilterId="",this.embossFilter=null,this.disabledPatternId="",this.disabledPattern=null,this.debugFilterId="",this.cssNode=this.debugFilter=null,this.CURSOR_COLOUR="#cc0a0a",this.MARKER_COLOUR="#4286f4",this.CURSOR_WS_WIDTH=100,this.WS_CURSOR_HEIGHT=5,this.CURSOR_STACK_PADDING=10,this.CURSOR_BLOCK_PADDING=2,this.CURSOR_STROKE_WIDTH=4,this.FULL_BLOCK_FIELDS=!1,this.INSERTION_MARKER_COLOUR="#000000",this.INSERTION_MARKER_OPACITY=.2,this.SHAPES={PUZZLE:1,NOTCH:2},this.TALL_INPUT_FIELD_OFFSET_Y=this.MEDIUM_PADDING,this.DUMMY_INPUT_SHADOW_MIN_HEIGHT=this.DUMMY_INPUT_MIN_HEIGHT=this.TAB_HEIGHT,this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT,this.TOP_ROW_MIN_HEIGHT=this.MEDIUM_PADDING,this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING,this.BOTTOM_ROW_MIN_HEIGHT=this.MEDIUM_PADDING,this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING,this.EMPTY_INLINE_INPUT_HEIGHT=this.TAB_HEIGHT+11,this.EMPTY_STATEMENT_INPUT_HEIGHT=this.MIN_BLOCK_HEIGHT,this.START_POINT=rt(0,0),this.FIELD_TEXT_BASELINE_CENTER=!0,this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT,this.FIELD_DROPDOWN_SVG_ARROW_PADDING=this.FIELD_BORDER_RECT_X_PADDING,this.FIELD_DROPDOWN_SVG_ARROW_DATAURI="data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMi43MSIgaGVpZ2h0PSI4Ljc5IiB2aWV3Qm94PSIwIDAgMTIuNzEgOC43OSI+PHRpdGxlPmRyb3Bkb3duLWFycm93PC90aXRsZT48ZyBvcGFjaXR5PSIwLjEiPjxwYXRoIGQ9Ik0xMi43MSwyLjQ0QTIuNDEsMi40MSwwLDAsMSwxMiw0LjE2TDguMDgsOC4wOGEyLjQ1LDIuNDUsMCwwLDEtMy40NSwwTDAuNzIsNC4xNkEyLjQyLDIuNDIsMCwwLDEsMCwyLjQ0LDIuNDgsMi40OCwwLDAsMSwuNzEuNzFDMSwwLjQ3LDEuNDMsMCw2LjM2LDBTMTEuNzUsMC40NiwxMiwuNzFBMi40NCwyLjQ0LDAsMCwxLDEyLjcxLDIuNDRaIiBmaWxsPSIjMjMxZjIwIi8+PC9nPjxwYXRoIGQ9Ik02LjM2LDcuNzlhMS40MywxLjQzLDAsMCwxLTEtLjQyTDEuNDIsMy40NWExLjQ0LDEuNDQsMCwwLDEsMC0yYzAuNTYtLjU2LDkuMzEtMC41Niw5Ljg3LDBhMS40NCwxLjQ0LDAsMCwxLDAsMkw3LjM3LDcuMzdBMS40MywxLjQzLDAsMCwxLDYuMzYsNy43OVoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",this.FIELD_COLOUR_DEFAULT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT,this.FIELD_CHECKBOX_X_OFFSET=this.FIELD_BORDER_RECT_X_PADDING-3,this.randomIdentifier=String(Math.random()).substring(2)}init(){this.JAGGED_TEETH=this.makeJaggedTeeth(),this.NOTCH=this.makeNotch(),this.START_HAT=this.makeStartHat(),this.PUZZLE_TAB=this.makePuzzleTab(),this.INSIDE_CORNERS=this.makeInsideCorners(),this.OUTSIDE_CORNERS=this.makeOutsideCorners()}setTheme(e){this.blockStyles=Object.create(null);const t=e.blockStyles;for(const o in t)this.blockStyles[o]=this.validatedBlockStyle_(t[o]);this.setDynamicProperties_(e)}setDynamicProperties_(e){this.setFontConstants_(e),this.setComponentConstants_(e),this.ADD_START_HATS=e.startHats!==void 0?e.startHats:this.ADD_START_HATS}setFontConstants_(e){e.fontStyle&&e.fontStyle.family&&(this.FIELD_TEXT_FONTFAMILY=e.fontStyle.family),e.fontStyle&&e.fontStyle.weight&&(this.FIELD_TEXT_FONTWEIGHT=e.fontStyle.weight),e.fontStyle&&e.fontStyle.size&&(this.FIELD_TEXT_FONTSIZE=e.fontStyle.size),e=Gr("Hg",this.FIELD_TEXT_FONTSIZE+"pt",this.FIELD_TEXT_FONTWEIGHT,this.FIELD_TEXT_FONTFAMILY),this.FIELD_TEXT_HEIGHT=e.height,this.FIELD_TEXT_BASELINE=e.baseline}setComponentConstants_(e){this.CURSOR_COLOUR=e.getComponentStyle("cursorColour")||this.CURSOR_COLOUR,this.MARKER_COLOUR=e.getComponentStyle("markerColour")||this.MARKER_COLOUR,this.INSERTION_MARKER_COLOUR=e.getComponentStyle("insertionMarkerColour")||this.INSERTION_MARKER_COLOUR,this.INSERTION_MARKER_OPACITY=Number(e.getComponentStyle("insertionMarkerOpacity"))||this.INSERTION_MARKER_OPACITY}getBlockStyleForColour(e){const t="auto_"+e;return this.blockStyles[t]||(this.blockStyles[t]=this.createBlockStyle_(e)),{style:this.blockStyles[t],name:t}}getBlockStyle(e){return this.blockStyles[e||""]||(e&&e.startsWith("auto_")?this.getBlockStyleForColour(e.substring(5)).style:this.createBlockStyle_("#000000"))}createBlockStyle_(e){return this.validatedBlockStyle_({colourPrimary:e})}validatedBlockStyle_(e){const t={};return e&&Object.assign(t,e),e=Ci(t.colourPrimary||"#000"),t.colourPrimary=e.hex,t.colourSecondary=t.colourSecondary?Ci(t.colourSecondary).hex:this.generateSecondaryColour_(t.colourPrimary),t.colourTertiary=t.colourTertiary?Ci(t.colourTertiary).hex:this.generateTertiaryColour_(t.colourPrimary),t.hat=t.hat||"",t}generateSecondaryColour_(e){return Lo("#fff",e,.6)||e}generateTertiaryColour_(e){return Lo("#fff",e,.3)||e}dispose(){this.embossFilter&&Ge(this.embossFilter),this.disabledPattern&&Ge(this.disabledPattern),this.debugFilter&&Ge(this.debugFilter),this.cssNode=null}makeJaggedTeeth(){const e=this.JAGGED_TEETH_HEIGHT,t=this.JAGGED_TEETH_WIDTH,o=Si([he(t,e/4),he(2*-t,e/2),he(t,e/4)]);return{height:e,width:t,path:o}}makeStartHat(){const e=this.START_HAT_HEIGHT,t=this.START_HAT_WIDTH,o=zt("c",[he(30,-e),he(70,-e),he(t,0)]);return{height:e,width:t,path:o}}makePuzzleTab(){function e(h){h=h?-1:1;const $=-h;var T=o/2;const B=T+2.5,oe=T+.5,it=he(-t,h*T);return T=he(t,h*T),zt("c",[he(0,h*B),he(-t,$*oe),it])+zt("s",[he(t,2.5*$),T])}const t=this.TAB_WIDTH,o=this.TAB_HEIGHT,n=e(!0),c=e(!1);return{type:this.SHAPES.PUZZLE,width:t,height:o,pathDown:c,pathUp:n}}makeNotch(){function e($){return Si([he($*n,o),he(3*$,0),he($*n,-o)])}const t=this.NOTCH_WIDTH,o=this.NOTCH_HEIGHT,n=(t-3)/2,c=e(1),h=e(-1);return{type:this.SHAPES.NOTCH,width:t,height:o,pathLeft:c,pathRight:h}}makeInsideCorners(){const e=this.CORNER_RADIUS,t=pt("a","0 0,0",e,he(-e,e)),o=pt("a","0 0,0",e,he(e,e));return{width:e,height:e,pathTop:t,pathBottom:o}}makeOutsideCorners(){const e=this.CORNER_RADIUS,t=rt(0,e)+pt("a","0 0,1",e,he(e,-e)),o=pt("a","0 0,1",e,he(e,e)),n=pt("a","0 0,1",e,he(-e,-e)),c=pt("a","0 0,1",e,he(-e,e));return{topLeft:t,topRight:o,bottomRight:c,bottomLeft:n,rightHeight:e}}shapeFor(e){switch(e.type){case ne.INPUT_VALUE:case ne.OUTPUT_VALUE:return this.PUZZLE_TAB;case ne.PREVIOUS_STATEMENT:case ne.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown connection type")}}createDom(e,t,o){this.injectCSS_(t,o),this.defs=L(D.DEFS,{},e),e=L(D.FILTER,{id:"blocklyEmbossFilter"+this.randomIdentifier},this.defs),L(D.FEGAUSSIANBLUR,{in:"SourceAlpha",stdDeviation:1,result:"blur"},e),t=L(D.FESPECULARLIGHTING,{in:"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white",result:"specOut"},e),L(D.FEPOINTLIGHT,{x:-5e3,y:-1e4,z:2e4},t),L(D.FECOMPOSITE,{in:"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},e),L(D.FECOMPOSITE,{in:"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},e),this.embossFilterId=e.id,this.embossFilter=e,e=L(D.PATTERN,{id:"blocklyDisabledPattern"+this.randomIdentifier,patternUnits:"userSpaceOnUse",width:10,height:10},this.defs),L(D.RECT,{width:10,height:10,fill:"#aaa"},e),L(D.PATH,{d:"M 0 0 L 10 10 M 10 0 L 0 10",stroke:"#cc0"},e),this.disabledPatternId=e.id,this.disabledPattern=e,this.createDebugFilter()}createDebugFilter(){if(!this.debugFilter){const e=L(D.FILTER,{id:"blocklyDebugFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},this.defs),t=L(D.FECOMPONENTTRANSFER,{result:"outBlur"},e);L(D.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},t),L(D.FEFLOOD,{"flood-color":"#ff0000","flood-opacity":.5,result:"outColor"},e),L(D.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},e),this.debugFilterId=e.id,this.debugFilter=e}}injectCSS_(e,t){t=this.getCSS_(t),e="blockly-renderer-style-"+e,this.cssNode=document.getElementById(e);const o=t.join(`
894
+ `);this.cssNode?this.cssNode.firstChild.textContent=o:(t=document.createElement("style"),t.id=e,e=document.createTextNode(o),t.appendChild(e),document.head.insertBefore(t,document.head.firstChild),this.cssNode=t)}getCSS_(e){return[`${e} .blocklyText, `,`${e} .blocklyFlyoutLabelText {`,`font: ${this.FIELD_TEXT_FONTWEIGHT} ${this.FIELD_TEXT_FONTSIZE}pt ${this.FIELD_TEXT_FONTFAMILY};`,"}",`${e} .blocklyText {`,"fill: #fff;","}",`${e} .blocklyNonEditableText>rect,`,`${e} .blocklyEditableText>rect {`,`fill: ${this.FIELD_BORDER_RECT_COLOUR};`,"fill-opacity: .6;","stroke: none;","}",`${e} .blocklyNonEditableText>text,`,`${e} .blocklyEditableText>text {`,"fill: #000;","}",`${e} .blocklyFlyoutLabelText {`,"fill: #000;","}",`${e} .blocklyText.blocklyBubbleText {`,"fill: #000;","}",`${e} .blocklyEditableText:not(.editing):hover>rect {`,"stroke: #fff;","stroke-width: 2;","}",`${e} .blocklyHtmlInput {`,`font-family: ${this.FIELD_TEXT_FONTFAMILY};`,`font-weight: ${this.FIELD_TEXT_FONTWEIGHT};`,"}",`${e} .blocklySelected>.blocklyPath {`,"stroke: #fc3;","stroke-width: 3px;","}",`${e} .blocklyHighlightedConnectionPath {`,"stroke: #fc3;","}",`${e} .blocklyReplaceable .blocklyPath {`,"fill-opacity: .5;","}",`${e} .blocklyReplaceable .blocklyPathLight,`,`${e} .blocklyReplaceable .blocklyPathDark {`,"display: none;","}",`${e} .blocklyInsertionMarker>.blocklyPath {`,`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,"stroke: none;","}"]}},fl=class{constructor(e,t){this.inlinePath_=this.outlinePath_="",this.block_=e,this.info_=t,this.topLeft_=e.getRelativeToSurfaceXY(),this.constants_=t.getRenderer().getConstants()}draw(){this.drawOutline_(),this.drawInternals_(),this.updateConnectionHighlights(),this.block_.pathObject.setPath(this.outlinePath_+`
895
+ `+this.inlinePath_),this.info_.RTL&&this.block_.pathObject.flipRTL(),this.recordSizeOnBlock_()}recordSizeOnBlock_(){this.block_.height=this.info_.height,this.block_.width=this.info_.widthWithChildren,this.block_.childlessWidth=this.info_.width}drawOutline_(){this.drawTop_();for(let e=1;e<this.info_.rows.length-1;e++){const t=this.info_.rows[e];t.hasJaggedEdge?this.drawJaggedEdge_(t):t.hasStatement?this.drawStatementInput_(t):t.hasExternalInput?this.drawValueInput_(t):this.drawRightSideRow_(t)}this.drawBottom_(),this.drawLeft_()}drawTop_(){const e=this.info_.topRow,t=e.elements;this.positionPreviousConnection_(),this.outlinePath_+=rt(e.xPos,this.info_.startY);for(let o=0,n;n=t[o];o++)E.isLeftRoundedCorner(n)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topLeft:E.isRightRoundedCorner(n)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topRight:E.isPreviousConnection(n)&&n instanceof no?this.outlinePath_+=n.shape.pathLeft:E.isHat(n)?this.outlinePath_+=this.constants_.START_HAT.path:E.isSpacer(n)&&(this.outlinePath_+=ae("h",n.width));this.outlinePath_+=ae("v",e.height)}drawJaggedEdge_(e){this.outlinePath_+=this.constants_.JAGGED_TEETH.path+ae("v",e.height-this.constants_.JAGGED_TEETH.height)}drawValueInput_(e){const t=e.getLastInput();this.positionExternalValueConnection_(e);const o=Da(t.shape)?t.shape.pathDown(t.height):t.shape.pathDown;this.outlinePath_+=ae("H",t.xPos+t.width)+o+ae("v",e.height-t.connectionHeight)}drawStatementInput_(e){var t=e.getLastInput();if(t){var o=t.xPos+t.notchOffset+t.shape.width;t=t.shape.pathRight+ae("h",-(t.notchOffset-this.constants_.INSIDE_CORNERS.width))+this.constants_.INSIDE_CORNERS.pathTop;var n=e.height-2*this.constants_.INSIDE_CORNERS.height;this.outlinePath_+=ae("H",o)+t+ae("v",n)+this.constants_.INSIDE_CORNERS.pathBottom+ae("H",e.xPos+e.width),this.positionStatementInputConnection_(e)}}drawRightSideRow_(e){this.outlinePath_+=ae("V",e.yPos+e.height)}drawBottom_(){const e=this.info_.bottomRow,t=e.elements;this.positionNextConnection_();let o=0,n="";for(let c=t.length-1,h;h=t[c];c--)E.isNextConnection(h)&&h instanceof no?n+=h.shape.pathRight:E.isLeftSquareCorner(h)?n+=ae("H",e.xPos):E.isLeftRoundedCorner(h)?n+=this.constants_.OUTSIDE_CORNERS.bottomLeft:E.isRightRoundedCorner(h)?(n+=this.constants_.OUTSIDE_CORNERS.bottomRight,o=this.constants_.OUTSIDE_CORNERS.rightHeight):E.isSpacer(h)&&(n+=ae("h",-1*h.width));this.outlinePath_+=ae("V",e.baseline-o),this.outlinePath_+=n}drawLeft_(){var e=this.info_.outputConnection;if(this.positionOutputConnection_(),e){const t=e.connectionOffsetY+e.height;e=Da(e.shape)?e.shape.pathUp(e.height):e.shape.pathUp,this.outlinePath_+=ae("V",t)+e}this.outlinePath_+="z"}drawInternals_(){for(let e=0,t;t=this.info_.rows[e];e++)for(let o=0,n;n=t.elements[o];o++)E.isInlineInput(n)?this.drawInlineInput_(n):(E.isIcon(n)||E.isField(n))&&this.layoutField_(n)}layoutField_(e){const t=e.centerline-e.height/2;let o=e.xPos;var n="";this.info_.RTL&&(o=-(o+e.width),e.flipRtl&&(o+=e.width,n="scale(-1 1)")),E.isIcon(e)?(n=e.icon,n.setOffsetInBlock(new K(o,t)),this.info_.isInsertionMarker&&n.hideForInsertionMarker()):(e=e.field.getSvgRoot(),e.setAttribute("transform","translate("+o+","+t+")"+n),this.info_.isInsertionMarker&&e.setAttribute("display","none"))}drawInlineInput_(e){const t=e.width,o=e.height,n=e.connectionOffsetY,c=e.connectionHeight+n;this.inlinePath_+=vt(e.xPos+e.connectionWidth,e.centerline-o/2)+ae("v",n)+e.shape.pathDown+ae("v",o-c)+ae("h",t-e.connectionWidth)+ae("v",-o)+"z",this.positionInlineInputConnection_(e)}positionInlineInputConnection_(e){const t=e.centerline-e.height/2;if(e.connectionModel){let o=e.xPos+e.connectionWidth+e.connectionOffsetX;this.info_.RTL&&(o*=-1),e.connectionModel.setOffsetInBlock(o,t+e.connectionOffsetY)}}positionStatementInputConnection_(e){const t=e.getLastInput();if(t!=null&&t.connectionModel){let o=e.xPos+e.statementEdge+t.notchOffset;this.info_.RTL&&(o*=-1),t.connectionModel.setOffsetInBlock(o,e.yPos)}}positionExternalValueConnection_(e){const t=e.getLastInput();if(t&&t.connectionModel){let o=e.xPos+e.width;this.info_.RTL&&(o*=-1),t.connectionModel.setOffsetInBlock(o,e.yPos)}}positionPreviousConnection_(){const e=this.info_.topRow;if(e.connection){const t=e.xPos+e.notchOffset;e.connection.connectionModel.setOffsetInBlock(this.info_.RTL?-t:t,0)}}positionNextConnection_(){const e=this.info_.bottomRow;if(e.connection){const t=e.connection,o=t.xPos;t.connectionModel.setOffsetInBlock(this.info_.RTL?-o:o,e.baseline)}}positionOutputConnection_(){if(this.info_.outputConnection){const e=this.info_.startX+this.info_.outputConnection.connectionOffsetX;this.block_.outputConnection.setOffsetInBlock(this.info_.RTL?-e:e,this.info_.outputConnection.connectionOffsetY)}}updateConnectionHighlights(){for(const e of this.info_.rows)for(const t of e.elements)if(t instanceof no)if(t.highlighted)this.drawConnectionHighlightPath(t);else{let o,n;(n=(o=this.block_.pathObject).removeConnectionHighlight)==null||n.call(o,t.connectionModel)}}drawConnectionHighlightPath(e){const t=e.connectionModel;e=t.type===ne.INPUT_VALUE||t.type===ne.OUTPUT_VALUE?this.getExpressionConnectionHighlightPath(e):this.getStatementConnectionHighlightPath(e);const o=t.getSourceBlock();let n,c;(c=(n=o.pathObject).addConnectionHighlight)==null||c.call(n,t,e,t.getOffsetInBlock(),o.RTL)}getExpressionConnectionHighlightPath(e){let t="";return Da(e.shape)?t=e.shape.pathDown(e.height):qf(e.shape)&&(t=e.shape.pathDown),e=this.constants_.TAB_OFFSET_FROM_TOP,rt(0,-e)+ae("v",e)+t+ae("v",e)}getStatementConnectionHighlightPath(e){if(!Zf(e.shape))throw Error("Statement connections should have notch shapes");const t=this.constants_.NOTCH_OFFSET_LEFT-this.constants_.CORNER_RADIUS;return rt(-t,0)+ae("h",t)+e.shape.pathLeft+ae("h",t)}};(function(e){e[e.LEFT=-1]="LEFT",e[e.CENTRE=0]="CENTRE",e[e.RIGHT=1]="RIGHT"})(i.Align$$module$build$src$core$inputs$align||(i.Align$$module$build$src$core$inputs$align={})),i.Align$$module$build$src$core$inputs$align;var ti=class extends Ze{constructor(e,t,o){super(Ze.SKIP_SETUP),this.class=null,this.EDITABLE=!1,this.maxDisplayLength=1/0,e!==Ze.SKIP_SETUP&&(o?this.configure_(o):this.class=t||null,this.setValue(e))}configure_(e){super.configure_(e),e.class&&(this.class=e.class)}initView(){this.createTextElement_(),this.class&&fe(this.getTextElement(),this.class)}doClassValidation_(e){return e==null?null:`${e}`}setClass(e){this.textElement_&&(this.class&&st(this.textElement_,this.class),e&&fe(this.textElement_,e)),this.class=e}static fromJson(e){return new this(ht(e.text),void 0,e)}};Is("field_label",ti),ti.prototype.DEFAULT_VALUE="";var Wi=class{constructor(e,t){this.name=e,this.sourceBlock=t,this.fieldRow=[],this.align=i.Align$$module$build$src$core$inputs$align.LEFT,this.visible=!0,this.type=i.inputTypes$$module$build$src$core$inputs$input_types.CUSTOM,this.connection=null}getSourceBlock(){return this.sourceBlock}appendField(e,t){return this.insertFieldAt(this.fieldRow.length,e,t),this}insertFieldAt(e,t,o){if(0>e||e>this.fieldRow.length)throw Error("index "+e+" out of bounds.");return(t||t===""&&o)&&(typeof t=="string"&&(t=i.fromJson$$module$build$src$core$field_registry({type:"field_label",text:t})),t.setSourceBlock(this.sourceBlock),this.sourceBlock.initialized&&this.initField(t),t.name=o,t.setVisible(this.isVisible()),t.prefixField&&(e=this.insertFieldAt(e,t.prefixField)),this.fieldRow.splice(e,0,t),e++,t.suffixField&&(e=this.insertFieldAt(e,t.suffixField)),this.sourceBlock.rendered&&this.sourceBlock.queueRender()),e}removeField(e,t){for(let o=0,n;n=this.fieldRow[o];o++)if(n.name===e)return n.dispose(),this.fieldRow.splice(o,1),this.sourceBlock.rendered&&this.sourceBlock.queueRender(),!0;if(t)return!1;throw Error('Field "'+e+'" not found.')}isVisible(){return this.visible}setVisible(e){let t=[];if(this.visible===e)return t;this.visible=e;for(let n=0,c;c=this.fieldRow[n];n++)c.setVisible(e);if(this.connection){var o=this.connection;e?t=o.startTrackingAll():o.stopTrackingAll(),(o=o.targetBlock())&&(o.getSvgRoot().style.display=e?"block":"none")}return t}markDirty(){for(let e=0,t;t=this.fieldRow[e];e++)t.markDirty()}setCheck(e){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.setCheck(e),this}setAlign(e){return this.align=e,this.sourceBlock.rendered&&this.sourceBlock.queueRender(),this}setShadowDom(e){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.setShadowDom(e),this}getShadowDom(){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.getShadowDom()}init(){for(const e of this.fieldRow)e.init()}initModel(){for(const e of this.fieldRow)e.initModel()}initField(e){this.sourceBlock.rendered?e.init():e.initModel()}dispose(){for(let e=0,t;t=this.fieldRow[e];e++)t.dispose();this.connection&&this.connection.dispose()}makeConnection(e){return this.sourceBlock.makeConnection_(e)}},Os=class extends Wi{constructor(e,t){super(e,t),this.name=e,this.type=i.inputTypes$$module$build$src$core$inputs$input_types.DUMMY}},ro=class extends Wi{constructor(e,t){super(e,t),this.name=e,this.type=i.inputTypes$$module$build$src$core$inputs$input_types.END_ROW}},qt=class extends Wi{constructor(e,t){if(!e)throw Error("Statement inputs must have a non-empty name");super(e,t),this.name=e,this.type=i.inputTypes$$module$build$src$core$inputs$input_types.STATEMENT,this.connection=this.makeConnection(ne.NEXT_STATEMENT)}},Jb;i.ValueInput$$module$build$src$core$inputs$value_input=class extends Wi{constructor(e,t){if(!e)throw Error("Value inputs must have a non-empty name");super(e,t),this.name=e,this.type=i.inputTypes$$module$build$src$core$inputs$input_types.VALUE,this.connection=this.makeConnection(ne.INPUT_VALUE)}},Jb={},Jb.ValueInput=i.ValueInput$$module$build$src$core$inputs$value_input;var ar=class{constructor(e,t){this.statementEdge=this.width=this.widthWithChildren=this.height=0,this.rows=[],this.inputRows=[],this.startY=this.startX=0,this.renderer_=e,this.block_=t,this.constants_=this.renderer_.getConstants(),this.outputConnection=t.outputConnection?new Kb(this.constants_,t.outputConnection):null,this.isInline=t.getInputsInline()&&!t.isCollapsed(),this.isCollapsed=t.isCollapsed(),this.isInsertionMarker=t.isInsertionMarker(),this.RTL=t.RTL,this.topRow=new Ph(this.constants_),this.bottomRow=new Oh(this.constants_)}getRenderer(){return this.renderer_}measure(){this.createRows_(),this.addElemSpacing_(),this.addRowSpacing_(),this.computeBounds_(),this.alignRowElements_(),this.finalize_()}createRows_(){this.populateTopRow_(),this.rows.push(this.topRow);let e=new Lh(this.constants_);this.inputRows.push(e);var t=this.block_.getIcons();for(let o=0,n;n=t[o];o++){const c=new Wb(this.constants_,n);this.isCollapsed&&!n.isShownWhenCollapsed()||e.elements.push(c)}t=void 0;for(let o=0,n;n=this.block_.inputList[o];o++)if(n.isVisible()){this.shouldStartNewRow_(n,t)&&(this.rows.push(e),e=new Lh(this.constants_),this.inputRows.push(e));for(let c=0,h;h=n.fieldRow[c];c++)e.elements.push(new Hi(this.constants_,h,n));this.addInput_(n,e),t=n}this.isCollapsed&&(e.hasJaggedEdge=!0,e.elements.push(new Vb(this.constants_))),(e.elements.length||e.hasDummyInput)&&this.rows.push(e),this.populateBottomRow_(),this.rows.push(this.bottomRow)}populateTopRow_(){var e=!!this.block_.previousConnection;const t=(this.block_.hat?this.block_.hat==="cap":this.constants_.ADD_START_HATS)&&!this.outputConnection&&!e;let o=this.topRow.hasLeftSquareCorner(this.block_)?rr:nr;this.topRow.elements.push(new o(this.constants_)),t?(e=new Mh(this.constants_),this.topRow.elements.push(e),this.topRow.capline=e.ascenderHeight):e&&(this.topRow.hasPreviousConnection=!0,this.topRow.connection=new Yb(this.constants_,this.block_.previousConnection),this.topRow.elements.push(this.topRow.connection)),this.block_.inputList.length&&this.block_.inputList[0]instanceof qt&&!this.block_.isCollapsed()?this.topRow.minHeight=this.constants_.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT:this.topRow.minHeight=this.constants_.TOP_ROW_MIN_HEIGHT,o=this.topRow.hasRightSquareCorner(this.block_)?rr:nr,this.topRow.elements.push(new o(this.constants_,"right"))}populateBottomRow_(){this.bottomRow.hasNextConnection=!!this.block_.nextConnection,this.bottomRow.minHeight=this.block_.inputList.length&&this.block_.inputList[this.block_.inputList.length-1]instanceof qt?this.constants_.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT:this.constants_.BOTTOM_ROW_MIN_HEIGHT,this.bottomRow.hasLeftSquareCorner(this.block_)?this.bottomRow.elements.push(new rr(this.constants_)):this.bottomRow.elements.push(new nr(this.constants_)),this.bottomRow.hasNextConnection&&(this.bottomRow.connection=new Gb(this.constants_,this.block_.nextConnection),this.bottomRow.elements.push(this.bottomRow.connection)),this.bottomRow.hasRightSquareCorner(this.block_)?this.bottomRow.elements.push(new rr(this.constants_,"right")):this.bottomRow.elements.push(new nr(this.constants_,"right"))}addInput_(e,t){this.isInline&&e instanceof i.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new Nh(this.constants_,e)),t.hasInlineInput=!0):e instanceof qt?(t.elements.push(new ir(this.constants_,e)),t.hasStatement=!0):e instanceof i.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new gl(this.constants_,e)),t.hasExternalInput=!0):(e instanceof Os||e instanceof ro)&&(t.minHeight=Math.max(t.minHeight,e.getSourceBlock()&&e.getSourceBlock().isShadow()?this.constants_.DUMMY_INPUT_SHADOW_MIN_HEIGHT:this.constants_.DUMMY_INPUT_MIN_HEIGHT),t.hasDummyInput=!0),t.align===null&&(t.align=e.align)}shouldStartNewRow_(e,t){return t?t instanceof ro||e instanceof qt||t instanceof qt?!0:e instanceof i.ValueInput$$module$build$src$core$inputs$value_input||e instanceof Os||t instanceof i.ValueInput$$module$build$src$core$inputs$value_input?!this.isInline:!1:!1}addElemSpacing_(){for(let e=0,t;t=this.rows[e];e++){const o=t.elements;if(t.elements=[],t.startsWithElemSpacer()&&t.elements.push(new Xt(this.constants_,this.getInRowSpacing_(null,o[0]))),o.length){for(let n=0;n<o.length-1;n++){t.elements.push(o[n]);const c=this.getInRowSpacing_(o[n],o[n+1]);t.elements.push(new Xt(this.constants_,c))}t.elements.push(o[o.length-1]),t.endsWithElemSpacer()&&t.elements.push(new Xt(this.constants_,this.getInRowSpacing_(o[o.length-1],null)))}}}getInRowSpacing_(e,t){if(!e&&t&&E.isStatementInput(t))return this.constants_.STATEMENT_INPUT_PADDING_LEFT;if(e&&E.isInput(e)&&!t){if(E.isExternalInput(e))return this.constants_.NO_PADDING;if(E.isInlineInput(e))return this.constants_.LARGE_PADDING;if(E.isStatementInput(e))return this.constants_.NO_PADDING}return e&&E.isLeftSquareCorner(e)&&t&&(E.isPreviousConnection(t)||E.isNextConnection(t))?t.notchOffset:e&&E.isLeftRoundedCorner(e)&&t&&(E.isPreviousConnection(t)||E.isNextConnection(t))?t.notchOffset-this.constants_.CORNER_RADIUS:this.constants_.MEDIUM_PADDING}computeBounds_(){let e=0,t=0,o=0;for(let c=0,h;h=this.rows[c];c++){if(h.measure(),t=Math.max(t,h.width),h.hasStatement){var n=h.getLastInput();let $,T;n=h.width-((T=($=n)==null?void 0:$.width)!=null?T:0),e=Math.max(e,n)}o=Math.max(o,h.widthWithConnectedBlocks)}this.statementEdge=e,this.width=t;for(let c=0,h;h=this.rows[c];c++)h.hasStatement&&(h.statementEdge=this.statementEdge);this.widthWithChildren=Math.max(t,o),this.outputConnection&&(this.startX=this.outputConnection.width,this.width+=this.outputConnection.width,this.widthWithChildren+=this.outputConnection.width)}alignRowElements_(){for(let t=0,o;o=this.rows[t];t++)if(o.hasStatement)this.alignStatementRow_(o);else{var e=o.width;e=this.getDesiredRowWidth_(o)-e,0<e&&this.addAlignmentPadding_(o,e),E.isTopOrBottomRow(o)&&(o.widthWithConnectedBlocks=o.width)}}getDesiredRowWidth_(e){return this.width-this.startX}addAlignmentPadding_(e,t){const o=e.getFirstSpacer(),n=e.getLastSpacer();if((e.hasExternalInput||e.hasStatement)&&(e.widthWithConnectedBlocks+=t),e.align===i.Align$$module$build$src$core$inputs$align.LEFT&&n)n.width+=t;else if(e.align===i.Align$$module$build$src$core$inputs$align.CENTRE&&o&&n)o.width+=t/2,n.width+=t/2;else if(e.align===i.Align$$module$build$src$core$inputs$align.RIGHT&&o)o.width+=t;else if(n)n.width+=t;else return;e.width+=t}alignStatementRow_(e){const t=e.getLastInput();if(t){var o=e.width-t.width,n=this.statementEdge;o=n-o,0<o&&this.addAlignmentPadding_(e,o),o=e.width,n=this.getDesiredRowWidth_(e),t.width+=n-o,t.height=Math.max(t.height,e.height),e.width+=n-o,e.widthWithConnectedBlocks=Math.max(e.width,this.statementEdge+e.connectedBlockWidths)}}addRowSpacing_(){const e=this.rows;this.rows=[];for(let t=0;t<e.length;t++)this.rows.push(e[t]),t!==e.length-1&&this.rows.push(this.makeSpacerRow_(e[t],e[t+1]))}makeSpacerRow_(e,t){var o=this.getSpacerRowHeight_(e,t);const n=this.getSpacerRowWidth_(e,t);return o=new Bh(this.constants_,o,n),e.hasStatement&&(o.followsStatement=!0),t.hasStatement&&(o.precedesStatement=!0),o}getSpacerRowWidth_(e,t){return this.width-this.startX}getSpacerRowHeight_(e,t){return this.constants_.MEDIUM_PADDING}getElemCenterline_(e,t){return E.isSpacer(t)?e.yPos+t.height/2:E.isBottomRow(e)?(e=e.yPos+e.height-e.descenderHeight,E.isNextConnection(t)?e+t.height/2:e-t.height/2):E.isTopRow(e)?E.isHat(t)?e.capline-t.height/2:e.capline+t.height/2:e.yPos+e.height/2}recordElemPositions_(e){let t=e.xPos;for(let o=0,n;n=e.elements[o];o++)E.isSpacer(n)&&(n.height=e.height),n.xPos=t,n.centerline=this.getElemCenterline_(e,n),t+=n.width}finalize_(){let e=0,t=0;for(let o=0,n;n=this.rows[o];o++)n.yPos=t,n.xPos=this.startX,t+=n.height,e=Math.max(e,n.widthWithConnectedBlocks),this.recordElemPositions_(n);if(this.outputConnection&&this.block_.nextConnection){const o=this.block_.nextConnection.targetBlock();o&&(e=Math.max(e,o.getHeightWidth().width))}this.widthWithChildren=e+this.startX,this.height=t,this.startY=this.topRow.capline,this.bottomRow.baseline=t-this.bottomRow.descenderHeight}getMeasureableForConnection(e){let t;if(((t=this.outputConnection)==null?void 0:t.connectionModel)===e)return this.outputConnection;for(const o of this.rows)for(const n of o.elements)if(n instanceof no&&n.connectionModel===e)return n;return null}},Fh=class extends Yo{constructor(e){if(super(e),this.type=M.BLOCK_DELETE,e){if(e.getParent())throw Error("Connected blocks cannot be deleted.");e.isShadow()&&(this.recordUndo=!1),this.oldXml=Mn(e),this.ids=ge(e),this.wasShadow=e.isShadow(),this.oldJson=Gt(e,{addCoordinates:!0})}}toJson(){const e=super.toJson();if(!this.oldXml)throw Error("The old block XML is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(this.wasShadow===void 0)throw Error("Whether the block was a shadow is undefined. Either pass a block to the constructor, or call fromJson");if(!this.oldJson)throw Error("The old block JSON is undefined. Either pass a block to the constructor, or call fromJson");return e.oldXml=Es(this.oldXml),e.ids=this.ids,e.wasShadow=this.wasShadow,e.oldJson=this.oldJson,this.recordUndo||(e.recordUndo=this.recordUndo),e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Fh),t.oldXml=i.textToDom$$module$build$src$core$utils$xml(e.oldXml),t.ids=e.ids,t.wasShadow=e.wasShadow||t.oldXml.tagName.toLowerCase()==="shadow",t.oldJson=e.oldJson,e.recordUndo!==void 0&&(t.recordUndo=e.recordUndo),t}run(e){const t=this.getEventWorkspace_();if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!this.oldJson)throw Error("The old block JSON is undefined. Either pass a block to the constructor, or call fromJson");if(e)for(e=0;e<this.ids.length;e++){const o=this.ids[e],n=t.getBlockById(o);n?n.dispose(!1):o===this.blockId&&console.warn("Can't delete non-existent block: "+o)}else Vs(this.oldJson,t)}};r(z.EVENT,M.BLOCK_DELETE,Fh);var Pe=class{constructor(e,t){this.type=t,this.targetConnection=null,this.disposed=!1,this.shadowDom=this.check=null,this.y=this.x=0,this.shadowState=null,this.sourceBlock_=e}connect_(e){const t=ne.INPUT_VALUE,o=this.getSourceBlock();var n=e.getSourceBlock();e.isConnected()&&e.disconnectInternal(!1);let c;if(this.isConnected()){const $=this.stashShadowState(),T=this.targetBlock();T.isShadow()?T.dispose(!1):(this.disconnectInternal(),c=T),this.applyShadowState($)}let h;J()&&(h=new(Y(M.BLOCK_MOVE))(n),h.setReason(["connect"])),Qf(this,e),n.setParent(o),h&&(h.recordNew(),U(h)),c&&(e=this.type===t?c.outputConnection:c.previousConnection)&&((n=Pe.getConnectionForOrphanedConnection(n,e))?e.connect(n):e.onFailedConnect(this))}dispose(){if(this.isConnected()){this.isSuperior()&&this.setShadowStateInternal();const e=this.targetBlock();e&&!e.isDeadOrDying()&&e.unplug()}this.disposed=!0}getSourceBlock(){return this.sourceBlock_}isSuperior(){return this.type===ne.INPUT_VALUE||this.type===ne.NEXT_STATEMENT}isConnected(){return!!this.targetConnection}getConnectionChecker(){return this.sourceBlock_.workspace.connectionChecker}onFailedConnect(e){}connect(e){if(this.targetConnection===e)return!0;if(this.getConnectionChecker().canConnect(this,e,!1)){const t=i.getGroup$$module$build$src$core$events$utils();t||i.setGroup$$module$build$src$core$events$utils(!0),this.isSuperior()?this.connect_(e):e.connect_(this),i.setGroup$$module$build$src$core$events$utils(t)}return this.isConnected()}disconnect(){this.disconnectInternal()}disconnectInternal(e=!0){const{parentConnection:t,childConnection:o}=this.getParentAndChildConnections();if(!t||!o)throw Error("Source connection not connected.");const n=i.getGroup$$module$build$src$core$events$utils();n||i.setGroup$$module$build$src$core$events$utils(!0);let c;J()&&(c=new(Y(M.BLOCK_MOVE))(o.getSourceBlock()),c.setReason(["disconnect"]));const h=this.targetConnection;h&&(h.targetConnection=null),this.targetConnection=null,e&&o.getSourceBlock().setParent(null),c&&(c.recordNew(),U(c)),o.getSourceBlock().isShadow()||t.respawnShadow_(),i.setGroup$$module$build$src$core$events$utils(n)}getParentAndChildConnections(){return this.targetConnection?this.isSuperior()?{parentConnection:this,childConnection:this.targetConnection}:{parentConnection:this.targetConnection,childConnection:this}:{}}respawnShadow_(){this.createShadowBlock(!0)}reconnect(e,t){if(this.getSourceBlock().isDeadOrDying())return!1;var o;return t=(o=e.getInput(t))==null?void 0:o.connection,o=this.targetBlock(),o&&o!==e||!t||t.targetConnection===this?!1:(t.isConnected()&&t.disconnect(),t.connect(this),!0)}targetBlock(){if(this.isConnected()){let e,t;return(t=(e=this.targetConnection)==null?void 0:e.getSourceBlock())!=null?t:null}return null}onCheckChanged_(){!this.isConnected()||this.targetConnection&&this.getConnectionChecker().canConnect(this,this.targetConnection,!1)||(this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug()}setCheck(e){return e?(Array.isArray(e)||(e=[e]),this.check=e,this.onCheckChanged_()):this.check=null,this}getCheck(){return this.check}setShadowDom(e){this.setShadowStateInternal({shadowDom:e})}getShadowDom(e){return e&&this.targetBlock().isShadow()?ho(this.targetBlock()):this.shadowDom}setShadowState(e){this.setShadowStateInternal({shadowState:e})}getShadowState(e){return e&&this.targetBlock()&&this.targetBlock().isShadow()?Gt(this.targetBlock()):this.shadowState}neighbours(e){return[]}getParentInput(){let e=null;const t=this.sourceBlock_.inputList;for(let o=0;o<t.length;o++)if(t[o].connection===this){e=t[o];break}return e}toString(){const e=this.sourceBlock_;if(!e)return"Orphan Connection";if(e.outputConnection===this)var t="Output Connection of ";else if(e.previousConnection===this)t="Previous Connection of ";else if(e.nextConnection===this)t="Next Connection of ";else{t=null;for(let o=0,n;n=e.inputList[o];o++)if(n.connection===this){t=n;break}if(t)t='Input "'+t.name+'" connection on ';else return console.warn("Connection not actually connected to sourceBlock_"),"Orphan Connection"}return t+e.toDevString()}stashShadowState(){const e=this.getShadowDom(!0),t=this.getShadowState(!0);return this.shadowState=this.shadowDom=null,{shadowDom:e,shadowState:t}}applyShadowState({shadowDom:e,shadowState:t}){this.shadowDom=e,this.shadowState=t}setShadowStateInternal({shadowDom:e=null,shadowState:t=null}={}){this.shadowDom=e,this.shadowState=t,this.getSourceBlock().isDeadOrDying()||((e=this.targetBlock())?e.isShadow()?(e.dispose(!1),this.respawnShadow_(),this.targetBlock()&&this.targetBlock().isShadow()&&this.serializeShadow(this.targetBlock())):(e=this.createShadowBlock(!1),this.serializeShadow(e),e&&e.dispose(!1)):(this.respawnShadow_(),this.targetBlock()&&this.targetBlock().isShadow()&&this.serializeShadow(this.targetBlock())))}createShadowBlock(e){var t=this.getSourceBlock();const o=this.getShadowState(),n=this.getShadowDom();if(t.isDeadOrDying()||!o&&!n)return null;if(o)return t=bi(o,t.workspace,{parentConnection:e?this:void 0,isShadow:!0,recordUndo:!1});if(n){if(t=Fo(n,t.workspace),e)if(this.type===ne.INPUT_VALUE){if(!t.outputConnection)throw Error("Shadow block is missing an output connection");if(!this.connect(t.outputConnection))throw Error("Could not connect shadow block to connection")}else if(this.type===ne.NEXT_STATEMENT){if(!t.previousConnection)throw Error("Shadow block is missing previous connection");if(!this.connect(t.previousConnection))throw Error("Could not connect shadow block to connection")}else throw Error("Cannot connect a shadow block to a previous/output connection");return t}return null}serializeShadow(e){e&&(this.shadowDom=ho(e),this.shadowState=Gt(e))}static getConnectionForOrphanedConnection(e,t){if(t.type===ne.OUTPUT_VALUE)return t$(e,t.getSourceBlock());e=e.lastConnectionInStack(!0);const o=t.getConnectionChecker();return e&&o.canConnect(t,e,!1)?e:null}};Pe.CAN_CONNECT=0,Pe.REASON_SELF_CONNECTION=1,Pe.REASON_WRONG_TYPE=2,Pe.REASON_TARGET_NULL=3,Pe.REASON_CHECKS_FAILED=4,Pe.REASON_DIFFERENT_WORKSPACES=5,Pe.REASON_SHADOW_PARENT=6,Pe.REASON_DRAG_CHECKS_FAILED=7,Pe.REASON_PREVIOUS_AND_OUTPUT=8;var Co=class{constructor(e,t,o){if(this.data=null,this.disposed=!1,this.hue=null,this.colour_="#000000",this.styleName_="",this.suppressPrefixSuffix=!1,this.previousConnection=this.nextConnection=this.outputConnection=null,this.inputList=[],this.icons=[],this.disabledReasons=new Set,this.tooltip="",this.contextMenu=!0,this.parentBlock_=null,this.childBlocks_=[],this.editable=this.movable=this.deletable=!0,this.collapsed_=this.shadow=!1,this.outputShape_=null,this.rendered=this.isInsertionMarker_=this.initialized=this.disposing=!1,this.onchangeWrapper=this.helpUrl=null,this.statementInputCount=0,this.workspace=e,this.id=o&&!e.getBlockById(o)?o:S(),e.setBlockById(this.id,this),this.xy=new K(0,0),this.isInFlyout=e.isFlyout,this.isInMutator=e.isMutator,this.RTL=e.RTL,t){if(this.type=t,o=Ut[t],!o||typeof o!="object")throw TypeError("Invalid block definition for type: "+t);Object.assign(this,o)}e.addTopBlock(this),e.addTypedBlock(this),new.target===Co&&this.doInit_()}doInit_(){const e=i.getGroup$$module$build$src$core$events$utils();e||i.setGroup$$module$build$src$core$events$utils(!0);const t=$e();try{typeof this.init=="function"&&(i.setRecordUndo$$module$build$src$core$events$utils(!1),this.init(),i.setRecordUndo$$module$build$src$core$events$utils(t)),J()&&U(new(Y(M.BLOCK_CREATE))(this))}finally{i.setGroup$$module$build$src$core$events$utils(e),i.setRecordUndo$$module$build$src$core$events$utils(t)}this.inputsInlineDefault=this.inputsInline,typeof this.onchange=="function"&&this.setOnChange(this.onchange)}dispose(e=!1){this.disposing=!0,this.onchangeWrapper&&this.workspace.removeChangeListener(this.onchangeWrapper),this.unplug(e),J()&&U(new(Y(M.BLOCK_DELETE))(this)),this.workspace.removeTopBlock(this),this.disposeInternal()}disposeInternal(){this.disposing=!0,this.onchangeWrapper&&this.workspace.removeChangeListener(this.onchangeWrapper),this.workspace.removeTypedBlock(this),this.workspace.removeBlockById(this.id),typeof this.destroy=="function"&&this.destroy(),this.childBlocks_.forEach(e=>e.disposeInternal()),this.inputList.forEach(e=>e.dispose()),this.inputList.length=0,this.getConnections_(!0).forEach(e=>e.dispose()),this.disposed=!0}isDeadOrDying(){return this.disposing||this.disposed}initModel(){if(!this.initialized){for(const e of this.inputList)e.initModel();this.initialized=!0}}unplug(e){this.outputConnection&&this.unplugFromRow(e),this.previousConnection&&this.unplugFromStack(e)}unplugFromRow(e){let t=null,o;(o=this.outputConnection)!=null&&o.isConnected()&&(t=this.outputConnection.targetConnection,this.outputConnection.disconnect()),t&&e&&(e=this.getOnlyValueConnection())&&e.isConnected()&&!e.targetBlock().isShadow()&&(e=e.targetConnection,e==null||e.disconnect(),this.workspace.connectionChecker.canConnect(e,t,!1)?t.connect(e):e==null||e.onFailedConnect(t))}getOnlyValueConnection(){let e=null;for(let t=0;t<this.inputList.length;t++){const o=this.inputList[t].connection;if(o&&o.type===ne.INPUT_VALUE&&o.targetConnection){if(e)return null;e=o}}return e}unplugFromStack(e){let t=null;var o;if((o=this.previousConnection)!=null&&o.isConnected()&&(t=this.previousConnection.targetConnection,this.previousConnection.disconnect()),o=this.getNextBlock(),e&&o&&!o.isShadow()){let n,c;e=(c=(n=this.nextConnection)==null?void 0:n.targetConnection)!=null?c:null,e==null||e.disconnect(),t&&this.workspace.connectionChecker.canConnect(t,e,!1)&&t.connect(e)}}getConnections_(e){e=[],this.outputConnection&&e.push(this.outputConnection),this.previousConnection&&e.push(this.previousConnection),this.nextConnection&&e.push(this.nextConnection);for(let t=0,o;o=this.inputList[t];t++)o.connection&&e.push(o.connection);return e}lastConnectionInStack(e){let t=this.nextConnection;for(;t;){const o=t.targetBlock();if(!o||e&&o.isShadow())return t;t=o.nextConnection}return null}bumpNeighbours(){}getParent(){return this.parentBlock_}getInputWithBlock(e){for(let t=0,o;o=this.inputList[t];t++)if(o.connection&&o.connection.targetBlock()===e)return o;return null}getSurroundParent(){let e=this,t;do if(t=e,e=e.getParent(),!e)return null;while(e.getNextBlock()===t);return e}getNextBlock(){return this.nextConnection&&this.nextConnection.targetBlock()}getPreviousBlock(){return this.previousConnection&&this.previousConnection.targetBlock()}getRootBlock(){let e,t=this;do e=t,t=e.parentBlock_;while(t);return e}getTopStackBlock(){let e=this,t;do t=e.getPreviousBlock();while(t&&t.getNextBlock()===e&&(e=t));return e}getChildren(e){if(!e)return this.childBlocks_;e=[];for(let o=0,n;n=this.inputList[o];o++)if(n.connection){var t=n.connection.targetBlock();t&&e.push(t)}return(t=this.getNextBlock())&&e.push(t),e}setParent(e){if(e!==this.parentBlock_){var t=this.previousConnection&&this.previousConnection.targetBlock()||this.outputConnection&&this.outputConnection.targetBlock(),o=!!t;if(o&&e&&t!==e)throw Error("Block connected to superior one that is not new parent.");if(!o&&e)throw Error("Block not connected to new parent.");if(o&&!e)throw Error("Cannot set parent to null while block is still connected to superior block.");this.parentBlock_?Ct(this.parentBlock_.childBlocks_,this):this.workspace.removeTopBlock(this),(this.parentBlock_=e)?e.childBlocks_.push(this):this.workspace.addTopBlock(this)}}getDescendants(e){const t=[this],o=this.getChildren(e);for(let n,c=0;n=o[c];c++)t.push(...n.getDescendants(e));return t}isDeletable(){return this.deletable&&!this.shadow&&!this.isDeadOrDying()&&!this.workspace.options.readOnly}isOwnDeletable(){return this.deletable}setDeletable(e){this.deletable=e}isMovable(){return this.movable&&!this.shadow&&!this.isDeadOrDying()&&!this.workspace.options.readOnly}isOwnMovable(){return this.movable}setMovable(e){this.movable=e}isDuplicatable(){return this.workspace.hasBlockLimits()?this.workspace.isCapacityAvailable(ye(this,!0)):!0}isShadow(){return this.shadow}setShadow(e){this.shadow=e}isInsertionMarker(){return this.isInsertionMarker_}setInsertionMarker(e){this.isInsertionMarker_=e}isEditable(){return this.editable&&!this.isDeadOrDying()&&!this.workspace.options.readOnly}isOwnEditable(){return this.editable}setEditable(e){this.editable=e;for(let t=0,o;o=this.inputList[t];t++)for(let n=0,c;c=o.fieldRow[n];n++)c.updateEditable()}isDisposed(){return this.disposed}isSimpleReporter(){if(!this.outputConnection)return!1;for(const e of this.inputList)if(e.connection||1<e.fieldRow.length)return!1;return!0}getMatchingConnection(e,t){const o=this.getConnections_(!0);if(e=e.getConnections_(!0),o.length!==e.length)throw Error("Connection lists did not match in length.");for(let n=0;n<e.length;n++)if(e[n]===t)return o[n];return null}setHelpUrl(e){this.helpUrl=e}setTooltip(e){this.tooltip=e}getTooltip(){return _i(this)}getColour(){return this.colour_}getStyleName(){return this.styleName_}getHue(){return this.hue}setColour(e){e=Ci(e),this.hue=e.hue,this.colour_=e.hex}setStyle(e){this.styleName_=e}setOnChange(e){if(e&&typeof e!="function")throw Error("onchange must be a function.");this.onchangeWrapper&&this.workspace.removeChangeListener(this.onchangeWrapper),this.onchange=e,this.onchangeWrapper=e.bind(this),this.workspace.addChangeListener(this.onchangeWrapper)}getField(e){if(typeof e!="string")throw TypeError("Block.prototype.getField expects a string with the field name but received "+(e===void 0?"nothing":e+" of type "+typeof e)+" instead");for(let t=0,o;o=this.inputList[t];t++)for(let n=0,c;c=o.fieldRow[n];n++)if(c.name===e)return c;return null}getVars(){const e=[];for(let t=0,o;o=this.inputList[t];t++)for(let n=0,c;c=o.fieldRow[n];n++)c.referencesVariables()&&e.push(c.getValue());return e}getVarModels(){const e=[];for(let t=0,o;o=this.inputList[t];t++)for(let n=0,c;c=o.fieldRow[n];n++)if(c.referencesVariables()){const h=this.workspace.getVariableById(c.getValue());h&&e.push(h)}return e}updateVarName(e){for(let t=0,o;o=this.inputList[t];t++)for(let n=0,c;c=o.fieldRow[n];n++)c.referencesVariables()&&e.getId()===c.getValue()&&c.refreshVariableName()}renameVarById(e,t){for(let o=0,n;n=this.inputList[o];o++)for(let c=0,h;h=n.fieldRow[c];c++)h.referencesVariables()&&e===h.getValue()&&h.setValue(t)}getFieldValue(e){return(e=this.getField(e))?e.getValue():null}setFieldValue(e,t){const o=this.getField(t);if(!o)throw Error('Field "'+t+'" not found.');o.setValue(e)}setPreviousStatement(e,t){if(e)t===void 0&&(t=null),this.previousConnection||(this.previousConnection=this.makeConnection_(ne.PREVIOUS_STATEMENT)),this.previousConnection.setCheck(t);else if(this.previousConnection){if(this.previousConnection.isConnected())throw Error("Must disconnect previous statement before removing connection.");this.previousConnection.dispose(),this.previousConnection=null}}setNextStatement(e,t){if(e)t===void 0&&(t=null),this.nextConnection||(this.nextConnection=this.makeConnection_(ne.NEXT_STATEMENT)),this.nextConnection.setCheck(t);else if(this.nextConnection){if(this.nextConnection.isConnected())throw Error("Must disconnect next statement before removing connection.");this.nextConnection.dispose(),this.nextConnection=null}}setOutput(e,t){if(e)t===void 0&&(t=null),this.outputConnection||(this.outputConnection=this.makeConnection_(ne.OUTPUT_VALUE)),this.outputConnection.setCheck(t);else if(this.outputConnection){if(this.outputConnection.isConnected())throw Error("Must disconnect output value before removing connection.");this.outputConnection.dispose(),this.outputConnection=null}}setInputsInline(e){this.inputsInline!==e&&(U(new(Y(M.BLOCK_CHANGE))(this,"inline",null,this.inputsInline,e)),this.inputsInline=e)}getInputsInline(){if(this.inputsInline!==void 0)return this.inputsInline;for(var e=1;e<this.inputList.length;e++)if(this.inputList[e-1]instanceof Os&&this.inputList[e]instanceof Os)return!1;for(e=1;e<this.inputList.length;e++)if(this.inputList[e-1]instanceof i.ValueInput$$module$build$src$core$inputs$value_input&&this.inputList[e]instanceof Os)return!0;for(e=0;e<this.inputList.length;e++)if(this.inputList[e]instanceof ro)return!0;return!1}setOutputShape(e){this.outputShape_=e}getOutputShape(){return this.outputShape_}isEnabled(){return this.disabledReasons.size===0}get disabled(){return _("disabled","v11","v12","the isEnabled or hasDisabledReason methods of Block"),this.hasDisabledReason(Lt)}set disabled(e){_("disabled","v11","v12","the setDisabledReason method of Block"),this.setDisabledReason(e,Lt)}setEnabled(e){_("setEnabled","v11","v12","the setDisabledReason method of Block"),this.setDisabledReason(!e,Lt)}setDisabledReason(e,t){e||this.workspace.options.disable||!this.hasDisabledReason(Lt)||t==Lt||this.setDisabledReason(!1,Lt),this.disabledReasons.has(t)!==e&&(e?this.disabledReasons.add(t):this.disabledReasons.delete(t),e=new(Y(M.BLOCK_CHANGE))(this,"disabled",null,!e,e),e.setDisabledReason(t),U(e))}getInheritedDisabled(){let e=this.getSurroundParent();for(;e;){if(!e.isEnabled())return!0;e=e.getSurroundParent()}return!1}hasDisabledReason(e){return this.disabledReasons.has(e)}getDisabledReasons(){return this.disabledReasons}isCollapsed(){return this.collapsed_}setCollapsed(e){this.collapsed_!==e&&(U(new(Y(M.BLOCK_CHANGE))(this,"collapsed",null,this.collapsed_,e)),this.collapsed_=e)}toString(e,t){t=this.toTokens(t);for(let n=2;n<t.length;n++)t[n-2]==="("&&t[n]===")"&&(t[n-2]=t[n-1],t.splice(n-1,2));let o="";return t=t.reduce((n,c)=>(n=n+(o==="("||c===")"?"":" ")+c,o=c[c.length-1],n),""),t=t.trim()||"???",e&&t.length>e&&(t=t.substring(0,e-3)+"..."),t}toTokens(e="?"){const t=[];for(const n of this.inputList)if(n.name!=Gn){for(const c of n.fieldRow)t.push(c.getText());if(n.connection){const c=n.connection.targetBlock();if(c){var o=n.connection;let h=o.getCheck();!h&&o.targetConnection&&(h=o.targetConnection.getCheck()),(o=!!h&&(h.includes("Boolean")||h.includes("Number")))&&t.push("("),t.push(...c.toTokens(e)),o&&t.push(")")}else t.push(e)}}return t}appendValueInput(e){return this.appendInput(new i.ValueInput$$module$build$src$core$inputs$value_input(e,this))}appendStatementInput(e){return this.statementInputCount++,this.appendInput(new qt(e,this))}appendDummyInput(e=""){return this.appendInput(new Os(e,this))}appendEndRowInput(e=""){return this.appendInput(new ro(e,this))}appendInput(e){return this.inputList.push(e),e}appendInputFromRegistry(e,t){return(e=m(z.INPUT,e,!1))?this.appendInput(new e(t,this)):null}jsonInit(e){var t=e.type?'Block "'+e.type+'": ':"";if(e.output&&e.previousStatement)throw Error(t+"Must not have both an output and a previousStatement.");for(var o=0;e["args"+o];){if(e["message"+o]===void 0)throw Error(t+`args${o} must have a corresponding message (message${o}).`);o++}if(e.style&&e.style.hat&&(this.hat=e.style.hat,e.style=null),e.style&&e.colour)throw Error(t+"Must not have both a colour and a style.");for(e.style?this.jsonInitStyle(e,t):this.jsonInitColour(e,t),o=0;e["message"+o]!==void 0;)this.interpolate(e["message"+o],e["args"+o]||[],e["implicitAlign"+o]||e["lastDummyAlign"+o],t),o++;if(e.inputsInline!==void 0&&(i.disable$$module$build$src$core$events$utils(),this.setInputsInline(e.inputsInline),i.enable$$module$build$src$core$events$utils()),e.output!==void 0&&this.setOutput(!0,e.output),e.outputShape!==void 0&&this.setOutputShape(e.outputShape),e.previousStatement!==void 0&&this.setPreviousStatement(!0,e.previousStatement),e.nextStatement!==void 0&&this.setNextStatement(!0,e.nextStatement),e.tooltip!==void 0&&(o=ht(e.tooltip),this.setTooltip(o)),e.enableContextMenu!==void 0&&(this.contextMenu=!!e.enableContextMenu),e.suppressPrefixSuffix!==void 0&&(this.suppressPrefixSuffix=!!e.suppressPrefixSuffix),e.helpUrl!==void 0&&(o=ht(e.helpUrl),this.setHelpUrl(o)),typeof e.extensions=="string"&&(console.warn(t+"JSON attribute 'extensions' should be an array of strings. Found raw string in JSON for '"+e.type+"' block."),e.extensions=[e.extensions]),e.mutator!==void 0&&Ta(e.mutator,this,!0),e=e.extensions,Array.isArray(e))for(t=0;t<e.length;t++)Ta(e[t],this,!1)}jsonInitColour(e,t){if("colour"in e)if(e.colour===void 0)console.warn(t+"Undefined colour value.");else{e=e.colour;try{this.setColour(e)}catch{console.warn(t+"Illegal colour value: ",e)}}}jsonInitStyle(e,t){e=e.style;try{this.setStyle(e)}catch{console.warn(t+"Style does not exist: ",e)}}mixin(e,t){if(t!==void 0&&typeof t!="boolean")throw Error("opt_disableCheck must be a boolean if provided");if(!t){t=[];for(const o in e)this[o]!==void 0&&t.push(o);if(t.length)throw Error("Mixin will overwrite block members: "+JSON.stringify(t))}Object.assign(this,e)}interpolate(e,t,o,n){e=Ru(e),this.validateTokens(e,t.length),t=this.interpolateArguments(e,t,o),o=[];for(let c=0,h;h=t[c];c++)if(this.isInputKeyword(h.type)){if(e=this.inputFromJson(h,n)){for(let $=0,T;T=o[$];$++)e.appendField(T[0],T[1]);o.length=0}}else(e=this.fieldFromJson(h))&&o.push([e,h.name])}validateTokens(e,t){const o=[];let n=0;for(let c=0;c<e.length;c++){const h=e[c];if(typeof h=="number"){if(1>h||h>t)throw Error('Block "'+this.type+'": Message index %'+h+" out of range.");if(o[h])throw Error('Block "'+this.type+'": Message index %'+h+" duplicated.");o[h]=!0,n++}}if(n!==t)throw Error('Block "'+this.type+'": Message does not reference all '+t+" arg(s).")}interpolateArguments(e,t,o){const n=[];for(let h=0;h<e.length;h++){var c=e[h];if(typeof c=="number"&&(c=t[c-1]),typeof c=="string"){if(c===`
896
+ `)c={type:"input_end_row"},o&&(c.align=o);else if(c=this.stringToFieldJson(c),!c)continue}n.push(c)}return(e=n.length)&&!this.isInputKeyword(n[e-1].type)&&(e={type:"input_dummy"},o&&(e.align=o),n.push(e)),n}fieldFromJson(e){const t=i.fromJson$$module$build$src$core$field_registry(e);return!t&&e.alt?typeof e.alt=="string"?(e=this.stringToFieldJson(e.alt))?this.fieldFromJson(e):null:this.fieldFromJson(e.alt):t}inputFromJson(e,t){var o={LEFT:i.Align$$module$build$src$core$inputs$align.LEFT,RIGHT:i.Align$$module$build$src$core$inputs$align.RIGHT,CENTRE:i.Align$$module$build$src$core$inputs$align.CENTRE,CENTER:i.Align$$module$build$src$core$inputs$align.CENTRE};let n;switch(e.type){case"input_value":n=this.appendValueInput(e.name);break;case"input_statement":n=this.appendStatementInput(e.name);break;case"input_dummy":n=this.appendDummyInput(e.name);break;case"input_end_row":n=this.appendEndRowInput(e.name);break;default:n=this.appendInputFromRegistry(e.type,e.name)}return n?(e.check&&n.setCheck(e.check),e.align&&(o=o[e.align.toUpperCase()],o===void 0?console.warn(t+"Illegal align value: ",e.align):n.setAlign(o)),n):null}isInputKeyword(e){return e==="input_value"||e==="input_statement"||e==="input_dummy"||e==="input_end_row"||p(z.INPUT,e)}stringToFieldJson(e){return(e=e.trim())?{type:"field_label",text:e}:null}moveInputBefore(e,t){if(e!==t){var o=-1,n=t?-1:this.inputList.length;for(let c=0,h;h=this.inputList[c];c++)if(h.name===e){if(o=c,n!==-1)break}else if(t&&h.name===t&&(n=c,o!==-1))break;if(o===-1)throw Error('Named input "'+e+'" not found.');if(n===-1)throw Error('Reference input "'+t+'" not found.');this.moveNumberedInputBefore(o,n)}}moveNumberedInputBefore(e,t){if(e===t)throw Error("Can't move input to itself.");if(e>=this.inputList.length)throw RangeError("Input index "+e+" out of bounds.");if(t>this.inputList.length)throw RangeError("Reference input "+t+" out of bounds.");const o=this.inputList[e];this.inputList.splice(e,1),e<t&&t--,this.inputList.splice(t,0,o)}removeInput(e,t){for(let o=0,n;n=this.inputList[o];o++)if(n.name===e)return n instanceof qt&&this.statementInputCount--,n.dispose(),this.inputList.splice(o,1),!0;if(t)return!1;throw Error("Input not found: "+e)}getInput(e){for(let t=0,o;o=this.inputList[t];t++)if(o.name===e)return o;return null}getInputTargetBlock(e){return(e=this.getInput(e))&&e.connection&&e.connection.targetBlock()}getCommentText(){let e,t;return(t=(e=this.getIcon($t.COMMENT))==null?void 0:e.getText())!=null?t:null}setCommentText(e){var t;let o;const n=(o=(t=this.getIcon($t.COMMENT))==null?void 0:t.getText())!=null?o:null;if(n!==e){if(e!==null){if(t=this.getIcon($t.COMMENT),!t){if(t=m(z.ICON,$t.COMMENT.toString(),!1),!t)throw Error("No comment icon class is registered, so a comment cannot be set");if(t=new t(this),!s$(t))throw Error("The class registered as a comment icon does not conform to the ICommentIcon interface");t=this.addIcon(t)}i.disable$$module$build$src$core$events$utils(),t.setText(e),i.enable$$module$build$src$core$events$utils()}else this.removeIcon($t.COMMENT);U(new(Y(M.BLOCK_CHANGE))(this,"comment",null,n,e))}}setWarningText(e,t){}setMutator(e){}addIcon(e){if(this.hasIcon(e.getType()))throw new jb(e);return this.icons.push(e),this.icons.sort((t,o)=>t.getWeight()-o.getWeight()),e}removeIcon(e){if(!this.hasIcon(e))return!1;let t;return(t=this.getIcon(e))==null||t.dispose(),this.icons=this.icons.filter(o=>!o.getType().equals(e)),!0}hasIcon(e){return this.icons.some(t=>t.getType().equals(e))}getIcon(e){return e instanceof $t?this.icons.find(t=>t.getType().equals(e)):this.icons.find(t=>t.getType().toString()===e)}getIcons(){return[...this.icons]}getRelativeToSurfaceXY(){return this.xy}moveBy(e,t,o){if(this.parentBlock_)throw Error("Block has parent");const n=new(Y(M.BLOCK_MOVE))(this);o&&n.setReason(o),this.xy.translate(e,t),n.recordNew(),U(n)}makeConnection_(e){return new Pe(this,e)}allInputsFilled(e){if(e===void 0&&(e=!0),!e&&this.isShadow())return!1;for(let o=0,n;n=this.inputList[o];o++)if(n.connection){var t=n.connection.targetBlock();if(!t||!t.allInputsFilled(e))return!1}return(t=this.getNextBlock())?t.allInputsFilled(e):!0}toDevString(){let e=this.type?'"'+this.type+'" block':"Block";return this.id&&(e+=' (id="'+this.id+'")'),e}};Co.COLLAPSED_INPUT_NAME=Gn,Co.COLLAPSED_FIELD_NAME=Ga;var os=class{constructor(e,t,o,n){this.workspace=e,this.targetWorkspace=t,this.isFlyoutLabel=n,this.onMouseUpWrapper=null,this.height=this.width=0,this.cursorSvg=this.svgText=this.svgGroup=null,this.text=o.text,this.position=new K(0,0),this.callbackKey=o.callbackKey||o.callbackkey,this.cssClass=o["web-class"]||null,this.info=o}createDom(){var e=this.isFlyoutLabel?"blocklyFlyoutLabel":"blocklyFlyoutButton";this.cssClass&&(e+=" "+this.cssClass),this.svgGroup=L(D.G,{class:e},this.workspace.getCanvas());let t;this.isFlyoutLabel||(t=L(D.RECT,{class:"blocklyFlyoutButtonShadow",rx:os.BORDER_RADIUS,ry:os.BORDER_RADIUS,x:1,y:1},this.svgGroup)),e=L(D.RECT,{class:this.isFlyoutLabel?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",rx:os.BORDER_RADIUS,ry:os.BORDER_RADIUS},this.svgGroup);const o=L(D.TEXT,{class:this.isFlyoutLabel?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.svgGroup);var n=ht(this.text);this.workspace.RTL&&(n+="‏"),o.textContent=n,this.isFlyoutLabel&&(this.svgText=o,this.workspace.getThemeManager().subscribe(this.svgText,"flyoutForegroundColour","fill"));const c=ks(o,"fontSize"),h=ks(o,"fontWeight"),$=ks(o,"fontFamily");if(this.width=Vr(o,c,h,$),n=Gr(n,c,h,$),this.height=n.height,!this.isFlyoutLabel){this.width+=2*os.TEXT_MARGIN_X,this.height+=2*os.TEXT_MARGIN_Y;let T;(T=t)==null||T.setAttribute("width",String(this.width));let B;(B=t)==null||B.setAttribute("height",String(this.height))}return e.setAttribute("width",String(this.width)),e.setAttribute("height",String(this.height)),o.setAttribute("x",String(this.width/2)),o.setAttribute("y",String(this.height/2-n.height/2+n.baseline)),this.updateTransform(),this.onMouseUpWrapper=Q(this.svgGroup,"pointerup",this,this.onMouseUp),this.svgGroup}show(){this.updateTransform(),this.svgGroup.setAttribute("display","block")}updateTransform(){this.svgGroup.setAttribute("transform","translate("+this.position.x+","+this.position.y+")")}moveTo(e,t){this.position.x=e,this.position.y=t,this.updateTransform()}isLabel(){return this.isFlyoutLabel}getPosition(){return this.position}getButtonText(){return this.text}getTargetWorkspace(){return this.targetWorkspace}getWorkspace(){return this.workspace}dispose(){this.onMouseUpWrapper&&ze(this.onMouseUpWrapper),this.svgGroup&&Ge(this.svgGroup),this.svgText&&this.workspace.getThemeManager().unsubscribe(this.svgText)}setCursorSvg(e){e?this.svgGroup&&(this.svgGroup.appendChild(e),this.cursorSvg=e):this.cursorSvg=null}setMarkerSvg(){throw Error("Attempted to set a marker on a button.")}onMouseUp(e){(e=this.targetWorkspace.getGesture(e))&&e.cancel(),this.isFlyoutLabel&&this.callbackKey?console.warn("Labels should not have callbacks. Label text: "+this.text):this.isFlyoutLabel||this.callbackKey&&this.targetWorkspace.getButtonCallback(this.callbackKey)?this.isFlyoutLabel||(e=this.targetWorkspace.getButtonCallback(this.callbackKey))&&e(this):console.warn("Buttons should have callbacks. Button text: "+this.text)}};os.TEXT_MARGIN_X=5,os.TEXT_MARGIN_Y=2,os.BORDER_RADIUS=4,Tt(`
897
+ .blocklyFlyoutButton {
898
+ fill: #888;
899
+ cursor: default;
900
+ }
901
+
902
+ .blocklyFlyoutButtonShadow {
903
+ fill: #666;
904
+ }
905
+
906
+ .blocklyFlyoutButton:hover {
907
+ fill: #aaa;
908
+ }
909
+
910
+ .blocklyFlyoutLabel {
911
+ cursor: default;
912
+ }
913
+
914
+ .blocklyFlyoutLabelBackground {
915
+ opacity: 0;
916
+ }
917
+ `);var P=class{constructor(e,t,o){if(this.wsCoordinate=null,!t)throw Error("Cannot create a node without a location.");this.type=e,this.isConnectionLocation=P.isConnectionType(e),this.location=t,this.processParams(o||null)}processParams(e){e&&e.wsCoordinate&&(this.wsCoordinate=e.wsCoordinate)}getLocation(){return this.location}getType(){return this.type}getWsCoordinate(){return this.wsCoordinate}isConnection(){return this.isConnectionLocation}findNextForInput(){var e=this.location.getParentInput();const t=e.getSourceBlock();for(e=t.inputList.indexOf(e),e+=1;e<t.inputList.length;e++){const o=t.inputList[e],n=o.fieldRow;for(let c=0;c<n.length;c++){const h=n[c];if(h.isClickable()||P.NAVIGATE_ALL_FIELDS)return P.createFieldNode(h)}if(o.connection)return P.createInputNode(o)}return null}findNextForField(){var e=this.location,t=e.getParentInput();const o=e.getSourceBlock();if(!o)throw Error("The current AST location is not associated with a block");var n=o.inputList.indexOf(t);for(e=t.fieldRow.indexOf(e)+1;n<o.inputList.length;n++){t=o.inputList[n];const c=t.fieldRow;for(;e<c.length;){if(c[e].isClickable()||P.NAVIGATE_ALL_FIELDS)return P.createFieldNode(c[e]);e++}if(e=0,t.connection)return P.createInputNode(t)}return null}findPrevForInput(){const e=this.location.getParentInput(),t=e.getSourceBlock();for(var o=t.inputList.indexOf(e);0<=o;o--){var n=t.inputList[o];if(n.connection&&n!==e)return P.createInputNode(n);n=n.fieldRow;for(let c=n.length-1;0<=c;c--){const h=n[c];if(h.isClickable()||P.NAVIGATE_ALL_FIELDS)return P.createFieldNode(h)}}return null}findPrevForField(){var e=this.location;const t=e.getParentInput(),o=e.getSourceBlock();if(!o)throw Error("The current AST location is not associated with a block");var n=o.inputList.indexOf(t);for(e=t.fieldRow.indexOf(e)-1;0<=n;n--){var c=o.inputList[n];if(c.connection&&c!==t)return P.createInputNode(c);for(c=c.fieldRow;-1<e;){if(c[e].isClickable()||P.NAVIGATE_ALL_FIELDS)return P.createFieldNode(c[e]);e--}0<=n-1&&(e=o.inputList[n-1].fieldRow.length-1)}return null}navigateBetweenStacks(e){var t=this.getLocation();if(t.getSourceBlock){var o=t.getSourceBlock();o&&(t=o)}if(!t||t.isDeadOrDying())return null;if(t.workspace.isFlyout)return this.navigateFlyoutContents(e);o=t.getRootBlock(),t=o.workspace.getTopBlocks(!0);for(let n=0;n<t.length;n++)if(o.id===t[n].id)return e=n+(e?1:-1),e===-1||e===t.length?null:P.createStackNode(t[e]);throw Error("Couldn't find "+(e?"next":"previous")+" stack?!")}navigateFlyoutContents(e){let t;switch(this.getType()){case P.types.STACK:t=this.getLocation();var o=t.workspace.targetWorkspace;break;case P.types.BUTTON:t=this.getLocation(),o=t.getTargetWorkspace();break;default:return null}return o=o.getFlyout(),o&&(e=this.findNextLocationInFlyout(o.getContents(),t,e))?e.type==="button"&&e.button?P.createButtonNode(e.button):e.type==="block"&&e.block?P.createStackNode(e.block):null:null}findNextLocationInFlyout(e,t,o){const n=e.findIndex(c=>t instanceof Co&&c.block===t||t instanceof os&&c.button===t);return 0>n?null:(o=o?n+1:n-1,o===-1||o===e.length?null:e[o])}findTopASTNodeForBlock(e){const t=Nn(e);return t?P.createConnectionNode(t):P.createBlockNode(e)}getOutAstNodeForBlock(e){if(!e)return null;e=e.getTopStackBlock();const t=Nn(e);return t&&t.targetConnection&&t.targetConnection.getParentInput()?P.createInputNode(t.targetConnection.getParentInput()):P.createStackNode(e)}findFirstFieldOrInput(e){e=e.inputList;for(let t=0;t<e.length;t++){const o=e[t],n=o.fieldRow;for(let c=0;c<n.length;c++){const h=n[c];if(h.isClickable()||P.NAVIGATE_ALL_FIELDS)return P.createFieldNode(h)}if(o.connection)return P.createInputNode(o)}return null}getSourceBlock(){return this.getType()===P.types.BLOCK?this.getLocation():this.getType()===P.types.STACK?this.getLocation():this.getType()===P.types.WORKSPACE||this.getType()===P.types.BUTTON?null:this.getLocation().getSourceBlock()}next(){switch(this.type){case P.types.STACK:return this.navigateBetweenStacks(!0);case P.types.OUTPUT:return P.createBlockNode(this.location.getSourceBlock());case P.types.FIELD:return this.findNextForField();case P.types.INPUT:return this.findNextForInput();case P.types.BLOCK:const e=this.location.nextConnection;if(!e)break;return P.createConnectionNode(e);case P.types.PREVIOUS:return P.createBlockNode(this.location.getSourceBlock());case P.types.NEXT:return P.createConnectionNode(this.location.targetConnection);case P.types.BUTTON:return this.navigateFlyoutContents(!0)}return null}in(){switch(this.type){case P.types.WORKSPACE:const e=this.location.getTopBlocks(!0);if(0<e.length)return P.createStackNode(e[0]);break;case P.types.STACK:return this.findTopASTNodeForBlock(this.location);case P.types.BLOCK:return this.findFirstFieldOrInput(this.location);case P.types.INPUT:return P.createConnectionNode(this.location.targetConnection)}return null}prev(){switch(this.type){case P.types.STACK:return this.navigateBetweenStacks(!1);case P.types.FIELD:return this.findPrevForField();case P.types.INPUT:return this.findPrevForInput();case P.types.BLOCK:var e=Nn(this.location);if(!e)break;return P.createConnectionNode(e);case P.types.PREVIOUS:if((e=this.location.targetConnection)&&!e.getParentInput())return P.createConnectionNode(e);break;case P.types.NEXT:return P.createBlockNode(this.location.getSourceBlock());case P.types.BUTTON:return this.navigateFlyoutContents(!1)}return null}out(){switch(this.type){case P.types.STACK:var e=this.location,t=e.getRelativeToSurfaceXY();return t=new K(t.x,t.y+P.DEFAULT_OFFSET_Y),P.createWorkspaceNode(e.workspace,t);case P.types.OUTPUT:return e=this.location,(t=e.targetConnection)?P.createConnectionNode(t):P.createStackNode(e.getSourceBlock());case P.types.FIELD:if(e=this.location.getSourceBlock(),!e)throw Error("The current AST location is not associated with a block");return P.createBlockNode(e);case P.types.INPUT:return P.createBlockNode(this.location.getSourceBlock());case P.types.BLOCK:return this.getOutAstNodeForBlock(this.location);case P.types.PREVIOUS:return this.getOutAstNodeForBlock(this.location.getSourceBlock());case P.types.NEXT:return this.getOutAstNodeForBlock(this.location.getSourceBlock())}return null}static isConnectionType(e){switch(e){case P.types.PREVIOUS:case P.types.NEXT:case P.types.INPUT:case P.types.OUTPUT:return!0}return!1}static createFieldNode(e){return e?new P(P.types.FIELD,e):null}static createConnectionNode(e){if(!e)return null;const t=e.type;return t===ne.INPUT_VALUE||t===ne.NEXT_STATEMENT&&e.getParentInput()?P.createInputNode(e.getParentInput()):t===ne.NEXT_STATEMENT?new P(P.types.NEXT,e):t===ne.OUTPUT_VALUE?new P(P.types.OUTPUT,e):t===ne.PREVIOUS_STATEMENT?new P(P.types.PREVIOUS,e):null}static createInputNode(e){return e&&e.connection?new P(P.types.INPUT,e.connection):null}static createBlockNode(e){return e?new P(P.types.BLOCK,e):null}static createStackNode(e){return e?new P(P.types.STACK,e):null}static createButtonNode(e){return e?new P(P.types.BUTTON,e):null}static createWorkspaceNode(e,t){return t&&e?new P(P.types.WORKSPACE,e,{wsCoordinate:t}):null}static createTopNode(e){const t=Nn(e);return t?P.createConnectionNode(t):P.createBlockNode(e)}};P.NAVIGATE_ALL_FIELDS=!1,P.DEFAULT_OFFSET_Y=-20,(function(e){e=e.types||(e.types={}),e.FIELD="field",e.BLOCK="block",e.INPUT="input",e.OUTPUT="output",e.NEXT="next",e.PREVIOUS="previous",e.STACK="stack",e.WORKSPACE="workspace",e.BUTTON="button"})(P||(P={}));var jh=class extends gs{constructor(e,t,o,n){let c=e?e.workspace.id:void 0;n&&n.getType()===P.types.WORKSPACE&&(c=n.getLocation().id),super(c),this.type=M.MARKER_MOVE,this.blockId=e==null?void 0:e.id,this.oldNode=o||void 0,this.newNode=n,this.isCursor=t}toJson(){const e=super.toJson();if(this.isCursor===void 0)throw Error("Whether this is a cursor event or not is undefined. Either pass a value to the constructor, or call fromJson");if(!this.newNode)throw Error("The new node is undefined. Either pass a node to the constructor, or call fromJson");return e.isCursor=this.isCursor,e.blockId=this.blockId,e.oldNode=this.oldNode,e.newNode=this.newNode,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new jh),t.isCursor=e.isCursor,t.blockId=e.blockId,t.oldNode=e.oldNode,t.newNode=e.newNode,t}};r(z.EVENT,M.MARKER_MOVE,jh);var iT="blocklyCursor",nT="blocklyMarker",rT=.75,zh=class{constructor(e,t,o){this.workspace=e,this.marker=o,this.markerSvgRect_=this.markerSvgLine_=this.markerInput_=this.markerBlock_=this.svgGroup_=this.markerSvg_=this.currentMarkerSvg=this.parent=null,this.constants_=t,e=this.isCursor()?this.constants_.CURSOR_COLOUR:this.constants_.MARKER_COLOUR,this.colour_=o.colour||e}getSvgRoot(){return this.svgGroup_}getMarker(){return this.marker}isCursor(){return this.marker.type==="cursor"}createDom(){const e=this.isCursor()?iT:nT;return this.svgGroup_=L(D.G,{class:e}),this.createDomInternal_(),this.svgGroup_}setParent_(e){this.isCursor()?(this.parent&&this.parent.setCursorSvg(null),e.setCursorSvg(this.getSvgRoot())):(this.parent&&this.parent.setMarkerSvg(null),e.setMarkerSvg(this.getSvgRoot())),this.parent=e}draw(e,t){if(t){this.constants_=this.workspace.getRenderer().getConstants();var o=this.isCursor()?this.constants_.CURSOR_COLOUR:this.constants_.MARKER_COLOUR;this.colour_=this.marker.colour||o,this.applyColour_(t),this.showAtLocation_(t),this.fireMarkerEvent(e,t),e=this.currentMarkerSvg.childNodes[0],e!==void 0&&e.beginElement&&e.beginElement()}else this.hide()}showAtLocation_(e){const t=e.getLocation().type;e.getType()===P.types.BLOCK?this.showWithBlock_(e):e.getType()===P.types.OUTPUT?this.showWithOutput_(e):t===ne.INPUT_VALUE?this.showWithInput_(e):t===ne.NEXT_STATEMENT?this.showWithNext_(e):e.getType()===P.types.PREVIOUS?this.showWithPrevious_(e):e.getType()===P.types.FIELD?this.showWithField_(e):e.getType()===P.types.WORKSPACE?this.showWithCoordinates_(e):e.getType()===P.types.STACK?this.showWithStack_(e):e.getType()===P.types.BUTTON&&this.showWithButton_(e)}showWithBlockPrevOutput(e){e=e.getSourceBlock();const t=e.width;var o=e.height,n=o*rT;const c=this.constants_.CURSOR_BLOCK_PADDING;e.previousConnection?(o=this.constants_.shapeFor(e.previousConnection),this.positionPrevious_(t,c,n,o)):e.outputConnection?(n=this.constants_.shapeFor(e.outputConnection),this.positionOutput_(t,o,n)):this.positionBlock_(t,c,n),this.setParent_(e),this.showCurrent_()}showWithBlock_(e){this.showWithBlockPrevOutput(e)}showWithPrevious_(e){this.showWithBlockPrevOutput(e)}showWithOutput_(e){this.showWithBlockPrevOutput(e)}showWithCoordinates_(e){var t=e.getWsCoordinate();e=t.x,t=t.y,this.workspace.RTL&&(e-=this.constants_.CURSOR_WS_WIDTH),this.positionLine_(e,t,this.constants_.CURSOR_WS_WIDTH),this.setParent_(this.workspace),this.showCurrent_()}showWithField_(e){e=e.getLocation();const t=e.getSize().width,o=e.getSize().height;this.positionRect_(0,0,t,o),this.setParent_(e),this.showCurrent_()}showWithInput_(e){e=e.getLocation();const t=e.getSourceBlock();this.positionInput_(e),this.setParent_(t),this.showCurrent_()}showWithNext_(e){var t=e.getLocation();e=t.getSourceBlock();let o=0;t=t.getOffsetInBlock().y;const n=e.getHeightWidth().width;this.workspace.RTL&&(o=-n),this.positionLine_(o,t,n),this.setParent_(e),this.showCurrent_()}showWithStack_(e){e=e.getLocation();var t=e.getHeightWidth();const o=t.width+this.constants_.CURSOR_STACK_PADDING;t=t.height+this.constants_.CURSOR_STACK_PADDING;const n=-this.constants_.CURSOR_STACK_PADDING/2,c=-this.constants_.CURSOR_STACK_PADDING/2;let h=n;this.workspace.RTL&&(h=-(o+n)),this.positionRect_(h,c,o,t),this.setParent_(e),this.showCurrent_()}showWithButton_(e){e=e.getLocation();const t=e.width+this.constants_.CURSOR_STACK_PADDING,o=e.height+this.constants_.CURSOR_STACK_PADDING,n=-this.constants_.CURSOR_STACK_PADDING/2,c=-this.constants_.CURSOR_STACK_PADDING/2;let h=n;this.workspace.RTL&&(h=-(t+n)),this.positionRect_(h,c,t,o),this.setParent_(e),this.showCurrent_()}showCurrent_(){this.hide(),this.currentMarkerSvg&&(this.currentMarkerSvg.style.display="")}positionBlock_(e,t,o){if(e=rt(-t,o)+ae("V",-t)+ae("H",e+2*t)+ae("V",o),!this.markerBlock_)throw Error("createDom should be called before positioning the marker");this.markerBlock_.setAttribute("d",e),this.workspace.RTL&&this.flipRtl(this.markerBlock_),this.currentMarkerSvg=this.markerBlock_}positionInput_(e){const t=e.getOffsetInBlock().x,o=e.getOffsetInBlock().y;e=vt(0,0)+this.constants_.shapeFor(e).pathDown,this.markerInput_.setAttribute("d",e),this.markerInput_.setAttribute("transform","translate("+t+","+o+")"+(this.workspace.RTL?" scale(-1 1)":"")),this.currentMarkerSvg=this.markerInput_}positionLine_(e,t,o){if(!this.markerSvgLine_)throw Error("createDom should be called before positioning the line");this.markerSvgLine_.setAttribute("x",`${e}`),this.markerSvgLine_.setAttribute("y",`${t}`),this.markerSvgLine_.setAttribute("width",`${o}`),this.currentMarkerSvg=this.markerSvgLine_}positionOutput_(e,t,o){if(!this.markerBlock_)throw Error("createDom should be called before positioning the output");e=rt(e,0)+ae("h",-(e-o.width))+ae("v",this.constants_.TAB_OFFSET_FROM_TOP)+o.pathDown+ae("V",t)+ae("H",e),this.markerBlock_.setAttribute("d",e),this.workspace.RTL&&this.flipRtl(this.markerBlock_),this.currentMarkerSvg=this.markerBlock_}positionPrevious_(e,t,o,n){if(!this.markerBlock_)throw Error("createDom should be called before positioning the previous connection marker");e=rt(-t,o)+ae("V",-t)+ae("H",this.constants_.NOTCH_OFFSET_LEFT)+n.pathLeft+ae("H",e+2*t)+ae("V",o),this.markerBlock_.setAttribute("d",e),this.workspace.RTL&&this.flipRtl(this.markerBlock_),this.currentMarkerSvg=this.markerBlock_}positionRect_(e,t,o,n){if(!this.markerSvgRect_)throw Error("createDom should be called before positioning the rect");this.markerSvgRect_.setAttribute("x",`${e}`),this.markerSvgRect_.setAttribute("y",`${t}`),this.markerSvgRect_.setAttribute("width",`${o}`),this.markerSvgRect_.setAttribute("height",`${n}`),this.currentMarkerSvg=this.markerSvgRect_}flipRtl(e){e.setAttribute("transform","scale(-1 1)")}hide(){if(!(this.markerSvgLine_&&this.markerSvgRect_&&this.markerInput_&&this.markerBlock_))throw Error("createDom should be called before hiding the marker");this.markerSvgLine_.style.display="none",this.markerSvgRect_.style.display="none",this.markerInput_.style.display="none",this.markerBlock_.style.display="none"}fireMarkerEvent(e,t){const o=t.getSourceBlock();e=new(Y(M.MARKER_MOVE))(o,this.isCursor(),e,t),U(e)}getBlinkProperties_(){return{attributeType:"XML",attributeName:"fill",dur:"1s",values:this.colour_+";transparent;transparent;",repeatCount:"indefinite"}}createDomInternal_(){if(this.markerSvg_=L(D.G,{width:this.constants_.CURSOR_WS_WIDTH,height:this.constants_.WS_CURSOR_HEIGHT},this.svgGroup_),this.markerSvgLine_=L(D.RECT,{width:this.constants_.CURSOR_WS_WIDTH,height:this.constants_.WS_CURSOR_HEIGHT},this.markerSvg_),this.markerSvgRect_=L(D.RECT,{class:"blocklyVerticalMarker",rx:10,ry:10},this.markerSvg_),this.markerInput_=L(D.PATH,{transform:""},this.markerSvg_),this.markerBlock_=L(D.PATH,{transform:"",fill:"none","stroke-width":this.constants_.CURSOR_STROKE_WIDTH},this.markerSvg_),this.hide(),this.isCursor()){const e=this.getBlinkProperties_();L(D.ANIMATE,e,this.markerSvgLine_),L(D.ANIMATE,e,this.markerInput_),L(D.ANIMATE,Object.assign({},e,{attributeName:"stroke"}),this.markerBlock_)}return this.markerSvg_}applyColour_(e){if(!(this.markerSvgLine_&&this.markerSvgRect_&&this.markerInput_&&this.markerBlock_))throw Error("createDom should be called before applying color to the markerj");this.markerSvgLine_.setAttribute("fill",this.colour_),this.markerSvgRect_.setAttribute("stroke",this.colour_),this.markerInput_.setAttribute("fill",this.colour_),this.markerBlock_.setAttribute("stroke",this.colour_),this.isCursor()&&(e=this.colour_+";transparent;transparent;",this.markerSvgLine_.firstElementChild.setAttribute("values",e),this.markerInput_.firstElementChild.setAttribute("values",e),this.markerBlock_.firstElementChild.setAttribute("values",e))}dispose(){this.svgGroup_&&Ge(this.svgGroup_)}},$l=class{constructor(e,t,o){this.markerSvg=this.cursorSvg=null,this.connectionHighlights=new WeakMap,this.highlightOffsets=new WeakMap,this.constants=o,this.style=t,this.svgRoot=e,this.svgPath=L(D.PATH,{class:"blocklyPath"},this.svgRoot)}setPath(e){this.svgPath.setAttribute("d",e)}flipRTL(){this.svgPath.setAttribute("transform","scale(-1 1)")}setCursorSvg(e){e?(this.svgRoot.appendChild(e),this.cursorSvg=e):this.cursorSvg=null}setMarkerSvg(e){e?(this.cursorSvg?this.svgRoot.insertBefore(e,this.cursorSvg):this.svgRoot.appendChild(e),this.markerSvg=e):this.markerSvg=null}applyColour(e){this.svgPath.setAttribute("stroke",this.style.colourTertiary),this.svgPath.setAttribute("fill",this.style.colourPrimary),this.updateShadow_(e.isShadow()),this.updateDisabled_(!e.isEnabled()||e.getInheritedDisabled())}setStyle(e){this.style=e}setClass_(e,t){e&&(t?fe(this.svgRoot,e):st(this.svgRoot,e))}updateHighlighted(e){e?this.svgPath.setAttribute("filter","url(#"+this.constants.embossFilterId+")"):this.svgPath.setAttribute("filter","none")}updateShadow_(e){e&&(this.svgPath.setAttribute("stroke","none"),this.svgPath.setAttribute("fill",this.style.colourSecondary))}updateDisabled_(e){this.setClass_("blocklyDisabled",e),e&&this.svgPath.setAttribute("fill","url(#"+this.constants.disabledPatternId+")")}updateSelected(e){this.setClass_("blocklySelected",e)}updateDraggingDelete(e){this.setClass_("blocklyDraggingDelete",e)}updateInsertionMarker(e){this.setClass_("blocklyInsertionMarker",e)}updateMovable(e){this.setClass_("blocklyDraggable",e)}updateReplacementFade(e){this.setClass_("blocklyReplaceable",e)}updateShapeForInputHighlight(e,t){}addConnectionHighlight(e,t,o,n){if(this.connectionHighlights.has(e)){if(this.currentHighlightMatchesNew(e,t,o))return;this.removeConnectionHighlight(e)}t=L(D.PATH,{class:"blocklyHighlightedConnectionPath",d:t,transform:`translate(${o.x}, ${o.y})`+(n?" scale(-1 1)":"")},this.svgRoot),this.connectionHighlights.set(e,t)}currentHighlightMatchesNew(e,t,o){let n;const c=(n=this.connectionHighlights.get(e))==null?void 0:n.getAttribute("d");return e=this.highlightOffsets.get(e),c===t&&K.equals(e,o)}removeConnectionHighlight(e){const t=this.connectionHighlights.get(e);t&&(Ge(t),this.connectionHighlights.delete(e))}},is=class{constructor(e){this.activeCandidate=this.lastMarker=this.lastOnStack=null,this.wouldDeleteBlock=!1,this.fadedBlock=this.highlightedBlock=this.markerConnection=null,i.setSelected$$module$build$src$core$common(e),this.topBlock=e,this.workspace=e.workspace,this.firstMarker=this.createMarkerBlock(this.topBlock),this.availableConnections=this.initAvailableConnections(),this.lastOnStack&&(this.lastMarker=this.createMarkerBlock(this.lastOnStack.getSourceBlock()))}dispose(){this.availableConnections.length=0,this.disposeInsertionMarker(this.firstMarker),this.disposeInsertionMarker(this.lastMarker)}updateAvailableConnections(){this.availableConnections=this.initAvailableConnections()}wouldConnectBlock(){return!!this.activeCandidate}applyConnections(){if(this.activeCandidate){i.disable$$module$build$src$core$events$utils(),this.hidePreview(),i.enable$$module$build$src$core$events$utils();var{local:e,closest:t}=this.activeCandidate;e.connect(t);var o=e.isSuperior()?t:e,n=this.topBlock.getRootBlock();ps().then(()=>{Ca(o.getSourceBlock()),setTimeout(()=>{n.bringToFront()},0)})}}update(e,t){const o=this.getCandidate(e);((this.wouldDeleteBlock=this.shouldDelete(!!o,t))||this.shouldUpdatePreviews(o,e))&&(i.disable$$module$build$src$core$events$utils(),this.maybeHidePreview(o),this.maybeShowPreview(o),i.enable$$module$build$src$core$events$utils())}createMarkerBlock(e){i.disable$$module$build$src$core$events$utils();let t;try{const o=Gt(e,{addCoordinates:!1,addInputBlocks:!1,addNextBlocks:!1,doFullSerialization:!1});if(!o)throw Error(`Failed to serialize source block. ${e.toDevString()}`);t=Vs(o,this.workspace);for(const n of t.getDescendants(!1))n.setInsertionMarker(!0);t.initSvg(),t.getSvgRoot().setAttribute("visibility","hidden")}finally{i.enable$$module$build$src$core$events$utils()}return t}initAvailableConnections(){const e=this.topBlock.getConnections_(!1),t=this.topBlock.lastConnectionInStack(!0);return t&&t!==this.topBlock.nextConnection&&(e.push(t),this.lastOnStack=t),e}shouldUpdatePreviews(e,t){if(!e)return!!this.activeCandidate;if(!this.activeCandidate)return!0;const{local:o,closest:n}=this.activeCandidate;if(n===e.closest&&o===e.local)return!1;const c=o.x+t.x-n.x;return t=o.y+t.y-n.y,e.radius<Math.sqrt(c*c+t*t)-i.config$$module$build$src$core$config.currentConnectionPreference}getCandidate(e){this.markerConnection&&this.markerConnection.isConnected()||this.updateAvailableConnections();let t=this.getStartRadius(),o=null;for(let n=0;n<this.availableConnections.length;n++){const c=this.availableConnections[n],h=c.closest(t,e);h.connection&&(o={closest:h.connection,local:c,radius:h.radius},t=h.radius)}return o}getStartRadius(){return this.activeCandidate?i.config$$module$build$src$core$config.connectingSnapRadius:i.config$$module$build$src$core$config.snapRadius}shouldDelete(e,t){return t&&this.workspace.getComponentManager().hasCapability(t.id,at.Capability.DELETE_AREA)?t.wouldDelete(this.topBlock):!1}maybeShowPreview(e){if(!this.wouldDeleteBlock&&e){var t=e.closest,o;t===((o=this.activeCandidate)==null?void 0:o.closest)||t.getSourceBlock().isInsertionMarker()?console.log("Trying to connect to an insertion marker"):(this.activeCandidate=e,this.showPreview(this.activeCandidate))}}showPreview(e){const t=this.workspace.getRenderer();switch(t.getConnectionPreviewMethod(e.closest,e.local,this.topBlock)){case is.PREVIEW_TYPE.INPUT_OUTLINE:this.showInsertionInputOutline(e);break;case is.PREVIEW_TYPE.INSERTION_MARKER:this.showInsertionMarker(e);break;case is.PREVIEW_TYPE.REPLACEMENT_FADE:this.showReplacementFade(e)}t.shouldHighlightConnection(e.closest)&&e.closest.highlight()}maybeHidePreview(e){if(!e)this.hidePreview();else if(this.activeCandidate){const t=this.activeCandidate.local!==e.local;(this.activeCandidate.closest!==e.closest||t||this.wouldDeleteBlock)&&this.hidePreview()}this.activeCandidate=this.markerConnection=null}hidePreview(){let e;const t=(e=this.activeCandidate)==null?void 0:e.closest;t&&t.targetBlock()&&this.workspace.getRenderer().shouldHighlightConnection(t)&&t.unhighlight(),this.hideReplacementFade(),this.hideInsertionInputOutline(),this.hideInsertionMarker()}showInsertionMarker(e){const{local:t,closest:o}=e;let n=(e=this.lastOnStack&&t===this.lastOnStack)?this.lastMarker:this.firstMarker;if(!n)throw Error("Cannot show the insertion marker because there is no insertion marker block");let c;try{c=n.getMatchingConnection(t.getSourceBlock(),t)}catch{if(e&&this.lastOnStack?(this.disposeInsertionMarker(this.lastMarker),n=this.lastMarker=this.createMarkerBlock(this.lastOnStack.getSourceBlock())):(this.disposeInsertionMarker(this.firstMarker),n=this.firstMarker=this.createMarkerBlock(this.topBlock)),!n)throw Error("Cannot show the insertion marker because there is no insertion marker block");c=n.getMatchingConnection(t.getSourceBlock(),t)}if(!c)throw Error("Cannot show the insertion marker because there is no associated connection");if(c===this.markerConnection)throw Error("Made it to showInsertionMarker_ even though the marker isn't changing");n.queueRender(),Ws(),c.connect(o);const h={x:o.x-c.x,y:o.y-c.y},$=c.getOffsetInBlock().clone(),T=c;ps().then(()=>{let B;(B=n)==null||B.positionNearConnection(T,h,$);let oe;(oe=n)==null||oe.getSvgRoot().setAttribute("visibility","visible")}),this.markerConnection=c}hideInsertionMarker(){if(this.markerConnection){var e=this.markerConnection,t=e.getSourceBlock(),o=t.outputConnection,n;if((n=t.previousConnection)!=null&&n.targetConnection||o!=null&&o.targetConnection)t.unplug(!0);else{let c;(c=e.targetBlock())==null||c.unplug(!1)}if(e.targetConnection)throw Error("markerConnection still connected at the end of disconnectInsertionMarker");this.markerConnection=null,(e=t.getSvgRoot())&&e.setAttribute("visibility","hidden")}}showInsertionInputOutline(e){e=e.closest,this.highlightedBlock=e.getSourceBlock(),this.highlightedBlock.highlightShapeForInput(e,!0)}hideInsertionInputOutline(){if(this.highlightedBlock){if(!this.activeCandidate)throw Error("Cannot hide the insertion marker outline because there is no active candidate");this.highlightedBlock.highlightShapeForInput(this.activeCandidate.closest,!1),this.highlightedBlock=null}}showReplacementFade(e){if(this.fadedBlock=e.closest.targetBlock(),!this.fadedBlock)throw Error("Cannot show the replacement fade because the closest connection does not have a target block");this.fadedBlock.fadeForReplacement(!0)}hideReplacementFade(){this.fadedBlock&&(this.fadedBlock.fadeForReplacement(!1),this.fadedBlock=null)}getInsertionMarkers(){const e=[];return this.firstMarker&&e.push(this.firstMarker),this.lastMarker&&e.push(this.lastMarker),e}disposeInsertionMarker(e){if(e){i.disable$$module$build$src$core$events$utils();try{e.dispose()}finally{i.enable$$module$build$src$core$events$utils()}}}};(function(e){e=e.PREVIEW_TYPE||(e.PREVIEW_TYPE={}),e[e.INSERTION_MARKER=0]="INSERTION_MARKER",e[e.INPUT_OUTLINE=1]="INPUT_OUTLINE",e[e.REPLACEMENT_FADE=2]="REPLACEMENT_FADE"})(is||(is={})),is.PREVIEW_TYPE;var bl=class{constructor(e){this.overrides=null,this.name=e}getClassName(){return this.name+"-renderer"}init(e,t){this.constants_=this.makeConstants_(),t&&(this.overrides=t,Object.assign(this.constants_,t)),this.constants_.setTheme(e),this.constants_.init()}createDom(e,t){this.constants_.createDom(e,this.name+"-"+t.name,"."+this.getClassName()+"."+t.getClassName())}refreshDom(e,t){const o=this.getConstants();o.dispose(),this.constants_=this.makeConstants_(),this.overrides&&Object.assign(this.constants_,this.overrides),this.constants_.randomIdentifier=o.randomIdentifier,this.constants_.setTheme(t),this.constants_.init(),this.createDom(e,t)}dispose(){this.constants_&&this.constants_.dispose()}makeConstants_(){return new ml}makeRenderInfo_(e){return new ar(this,e)}makeDrawer_(e,t){return new fl(e,t)}makeMarkerDrawer(e,t){return new zh(e,this.getConstants(),t)}makePathObject(e,t){return new $l(e,t,this.constants_)}getConstants(){return this.constants_}shouldHighlightConnection(e){return!0}orphanCanConnectAtEnd(e,t,o){return!!Pe.getConnectionForOrphanedConnection(e,o===ne.OUTPUT_VALUE?t.outputConnection:t.previousConnection)}getConnectionPreviewMethod(e,t,o){return _("getConnectionPreviewMethod","v10","v12","an IConnectionPreviewer, if it fulfills your use case."),t.type===ne.OUTPUT_VALUE||t.type===ne.PREVIOUS_STATEMENT?!e.isConnected()||this.orphanCanConnectAtEnd(o,e.targetBlock(),t.type)?is.PREVIEW_TYPE.INSERTION_MARKER:is.PREVIEW_TYPE.REPLACEMENT_FADE:is.PREVIEW_TYPE.INSERTION_MARKER}render(e){const t=this.makeRenderInfo_(e);t.measure(),this.makeDrawer_(e,t).draw()}},We={};We.BottomRow=Oh,We.Connection=no,We.ConstantProvider=ml,We.Drawer=fl,We.ExternalValueInput=gl,We.Field=Hi,We.Hat=Mh,We.Icon=Wb,We.InRowSpacer=Xt,We.InlineInput=Nh,We.InputConnection=wo,We.InputRow=Lh,We.JaggedEdge=Vb,We.MarkerSvg=zh,We.Measurable=Rs,We.NextConnection=Gb,We.OutputConnection=Kb,We.PathObject=$l,We.PreviousConnection=Yb,We.RenderInfo=ar,We.Renderer=bl,We.RoundCorner=nr,We.Row=or,We.SpacerRow=Bh,We.SquareCorner=rr,We.StatementInput=ir,We.TopRow=Ph,We.Types=E,We.init=rd,We.register=Ln,We.unregister=o$;var Xb=class{constructor(e,t){this.workspace=e,this.theme=t,this.subscribedWorkspaces=[],this.componentDB=new Map}getTheme(){return this.theme}setTheme(e){var t=this.theme;this.theme=e,(e=this.workspace.getInjectionDiv())&&(t&&(t=t.getClassName())&&st(e,t),(t=this.theme.getClassName())&&fe(e,t));for(let o=0,n;n=this.subscribedWorkspaces[o];o++)n.refreshTheme();for(const[o,n]of this.componentDB)for(const c of n){e=c.element,t=c.propertyName;const h=this.theme&&this.theme.getComponentStyle(o);e.style.setProperty(t,h||"")}for(const o of this.subscribedWorkspaces)o.hideChaff()}subscribeWorkspace(e){this.subscribedWorkspaces.push(e)}unsubscribeWorkspace(e){if(!Ct(this.subscribedWorkspaces,e))throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.")}subscribe(e,t,o){this.componentDB.has(t)||this.componentDB.set(t,[]),this.componentDB.get(t).push({element:e,propertyName:o}),t=this.theme&&this.theme.getComponentStyle(t),e.style.setProperty(o,t||"")}unsubscribe(e){if(e)for(const[t,o]of this.componentDB){for(let n=o.length-1;0<=n;n--)o[n].element===e&&o.splice(n,1);o.length||this.componentDB.delete(t)}}dispose(){this.subscribedWorkspaces.length=0,this.componentDB.clear()}},Uh="VARIABLE_DYNAMIC",si={CATEGORY_NAME:Uh};si.flyoutCategory=Aa,si.flyoutCategoryBlocks=ud,si.onCreateVariableButtonClick_Colour=cd,si.onCreateVariableButtonClick_Number=ld,si.onCreateVariableButtonClick_String=ad;var qb=30,oi=[];oi[ne.INPUT_VALUE]=ne.OUTPUT_VALUE,oi[ne.OUTPUT_VALUE]=ne.INPUT_VALUE,oi[ne.NEXT_STATEMENT]=ne.PREVIOUS_STATEMENT,oi[ne.PREVIOUS_STATEMENT]=ne.NEXT_STATEMENT;var Hh="RENAME_VARIABLE_ID",Wh="DELETE_VARIABLE_ID",Zb=class{canConnect(e,t,o,n){return this.canConnectWithReason(e,t,o,n)===Pe.CAN_CONNECT}canConnectWithReason(e,t,o,n){const c=this.doSafetyChecks(e,t);return c!==Pe.CAN_CONNECT?c:this.doTypeChecks(e,t)?o&&!this.doDragChecks(e,t,n||0)?Pe.REASON_DRAG_CHECKS_FAILED:Pe.CAN_CONNECT:Pe.REASON_CHECKS_FAILED}getErrorMessage(e,t,o){switch(e){case Pe.REASON_SELF_CONNECTION:return"Attempted to connect a block to itself.";case Pe.REASON_DIFFERENT_WORKSPACES:return"Blocks not on same workspace.";case Pe.REASON_WRONG_TYPE:return"Attempt to connect incompatible types.";case Pe.REASON_TARGET_NULL:return"Target connection is null.";case Pe.REASON_CHECKS_FAILED:return"Connection checks failed. "+(t+" expected "+t.getCheck()+", found "+o.getCheck());case Pe.REASON_SHADOW_PARENT:return"Connecting non-shadow to shadow block.";case Pe.REASON_DRAG_CHECKS_FAILED:return"Drag checks failed.";case Pe.REASON_PREVIOUS_AND_OUTPUT:return"Block would have an output and a previous connection.";default:return"Unknown connection failure: this should never happen!"}}doSafetyChecks(e,t){if(!e||!t)return Pe.REASON_TARGET_NULL;let o,n,c;return e.isSuperior()?(o=e.getSourceBlock(),n=t.getSourceBlock(),c=t):(n=e.getSourceBlock(),o=t.getSourceBlock(),c=e,e=t),o===n?Pe.REASON_SELF_CONNECTION:c.type!==oi[e.type]?Pe.REASON_WRONG_TYPE:o.workspace!==n.workspace?Pe.REASON_DIFFERENT_WORKSPACES:o.isShadow()&&!n.isShadow()?Pe.REASON_SHADOW_PARENT:c.type===ne.OUTPUT_VALUE&&n.previousConnection&&n.previousConnection.isConnected()||c.type===ne.PREVIOUS_STATEMENT&&n.outputConnection&&n.outputConnection.isConnected()?Pe.REASON_PREVIOUS_AND_OUTPUT:Pe.CAN_CONNECT}doTypeChecks(e,t){if(e=e.getCheck(),t=t.getCheck(),!e||!t)return!0;for(let o=0;o<e.length;o++)if(t.includes(e[o]))return!0;return!1}doDragChecks(e,t,o){if(e.distanceFrom(t)>o||t.getSourceBlock().isInsertionMarker())return!1;switch(t.type){case ne.PREVIOUS_STATEMENT:return this.canConnectToPrevious_(e,t);case ne.OUTPUT_VALUE:if(t.isConnected()&&!t.targetBlock().isInsertionMarker()||e.isConnected())return!1;break;case ne.INPUT_VALUE:if(t.isConnected()&&!t.targetBlock().isMovable()&&!t.targetBlock().isShadow())return!1;break;case ne.NEXT_STATEMENT:if(t.isConnected()&&!e.getSourceBlock().nextConnection&&!t.targetBlock().isShadow()&&t.targetBlock().nextConnection||t.targetBlock()&&!t.targetBlock().isMovable()&&!t.targetBlock().isShadow())return!1;break;default:return!1}return!zn.includes(t)}canConnectToPrevious_(e,t){return e.targetConnection||zn.includes(t)?!1:t.targetConnection?(e=t.targetBlock(),e.isInsertionMarker()?!e.getPreviousBlock():!1):!0}};r(z.CONNECTION_CHECKER,Ds,Zb);var Vh=class extends Kn{constructor(e){super(e),this.type=M.VAR_DELETE,e&&(this.varType=e.type,this.varName=e.name)}toJson(){const e=super.toJson();if(this.varType===void 0)throw Error("The var type is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");return e.varType=this.varType,e.varName=this.varName,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Vh),t.varType=e.varType,t.varName=e.varName,t}run(e){const t=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");e?t.deleteVariableById(this.varId):t.createVariable(this.varName,this.varType,this.varId)}};r(z.EVENT,M.VAR_DELETE,Vh);var Gh=class extends Kn{constructor(e,t){super(e),this.type=M.VAR_RENAME,e&&(this.oldName=e.name,this.newName=typeof t>"u"?"":t)}toJson(){const e=super.toJson();if(!this.oldName)throw Error("The old var name is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.newName)throw Error("The new var name is undefined. Either pass a value to the constructor, or call fromJson");return e.oldName=this.oldName,e.newName=this.newName,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Gh),t.oldName=e.oldName,t.newName=e.newName,t}run(e){const t=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.oldName)throw Error("The old var name is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.newName)throw Error("The new var name is undefined. Either pass a value to the constructor, or call fromJson");e?t.renameVariableById(this.varId,this.newName):t.renameVariableById(this.varId,this.oldName)}};r(z.EVENT,M.VAR_RENAME,Gh);var Kh=class{constructor(e){this.workspace=e,this.variableMap=new Map}clear(){for(const e of this.variableMap.values())for(;0<e.length;)this.deleteVariable(e[0]);if(this.variableMap.size!==0)throw Error("Non-empty variable map")}renameVariable(e,t){if(e.name!==t){var o=this.getVariable(t,e.type),n=this.workspace.getAllBlocks(!1),c=i.getGroup$$module$build$src$core$events$utils();c||i.setGroup$$module$build$src$core$events$utils(!0);try{o&&o.getId()!==e.getId()?this.renameVariableWithConflict(e,t,o,n):this.renameVariableAndUses(e,t,n)}finally{i.setGroup$$module$build$src$core$events$utils(c)}}}renameVariableById(e,t){const o=this.getVariableById(e);if(!o)throw Error("Tried to rename a variable that didn't exist. ID: "+e);this.renameVariable(o,t)}renameVariableAndUses(e,t,o){for(U(new(Y(M.VAR_RENAME))(e,t)),e.name=t,t=0;t<o.length;t++)o[t].updateVarName(e)}renameVariableWithConflict(e,t,o,n){const c=e.type;for(t!==o.name&&this.renameVariableAndUses(o,t,n),t=0;t<n.length;t++)n[t].renameVarById(e.getId(),o.getId());U(new(Y(M.VAR_DELETE))(e)),Ct(this.variableMap.get(c),e)}createVariable(e,t,o){var n=this.getVariable(e,t);if(n){if(o&&n.getId()!==o)throw Error('Variable "'+e+'" is already in use and its id is "'+n.getId()+'" which conflicts with the passed in id, "'+o+'".');return n}if(o&&this.getVariableById(o))throw Error('Variable id, "'+o+'", is already in use.');return n=o||S(),t=t||"",n=new Yn(this.workspace,e,t,n),e=this.variableMap.get(t)||[],e.push(n),this.variableMap.delete(t),this.variableMap.set(t,e),U(new(Y(M.VAR_CREATE))(n)),n}deleteVariable(e){const t=e.getId(),o=this.variableMap.get(e.type);if(o){for(let n=0;n<o.length;n++)if(o[n].getId()===t){o.splice(n,1),U(new(Y(M.VAR_DELETE))(e)),o.length===0&&this.variableMap.delete(e.type);break}}}deleteVariableById(e){const t=this.getVariableById(e);if(t){var o=t.name;const n=this.getVariableUsesById(e);for(let c=0,h;h=n[c];c++)if(h.type==="procedures_defnoreturn"||h.type==="procedures_defreturn"){e=String(h.getFieldValue("NAME")),o=i.Msg$$module$build$src$core$msg.CANNOT_DELETE_VARIABLE_PROCEDURE.replace("%1",o).replace("%2",e),Tn(o);return}1<n.length?(o=i.Msg$$module$build$src$core$msg.DELETE_VARIABLE_CONFIRMATION.replace("%1",String(n.length)).replace("%2",o),ia(o,c=>{c&&t&&this.deleteVariableInternal(t,n)})):this.deleteVariableInternal(t,n)}else console.warn("Can't delete non-existent variable: "+e)}deleteVariableInternal(e,t){const o=i.getGroup$$module$build$src$core$events$utils();o||i.setGroup$$module$build$src$core$events$utils(!0);try{for(let n=0;n<t.length;n++)t[n].dispose(!0);this.deleteVariable(e)}finally{i.setGroup$$module$build$src$core$events$utils(o)}}getVariable(e,t){if(t=this.variableMap.get(t||"")){for(let o=0,n;n=t[o];o++)if(i.Names$$module$build$src$core$names.equals(n.name,e))return n}return null}getVariableById(e){for(const t of this.variableMap.values())for(const o of t)if(o.getId()===e)return o;return null}getVariablesOfType(e){return(e=this.variableMap.get(e||""))?e.slice():[]}getVariableTypes(e){const t=new Set(this.variableMap.keys());if(e&&e.getPotentialVariableMap())for(const o of e.getPotentialVariableMap().variableMap.keys())t.add(o);return t.has("")||t.add(""),Array.from(t.values())}getAllVariables(){let e=[];for(const t of this.variableMap.values())e=e.concat(t);return e}getAllVariableNames(){return Array.from(this.variableMap.values()).flat().map(e=>e.name)}getVariableUsesById(e){const t=[],o=this.workspace.getAllBlocks(!1);for(let n=0;n<o.length;n++){const c=o[n].getVarModels();if(c)for(let h=0;h<c.length;h++)c[h].getId()===e&&t.push(o[n])}return t}},Vi=class{get isFlyout(){return this.internalIsFlyout}get isMutator(){return this.internalIsMutator}constructor(e){this.isClearing=this.internalIsMutator=this.internalIsFlyout=this.rendered=!1,this.MAX_UNDO=1024,this.connectionDBList=[],this.topBlocks=[],this.topComments=[],this.commentDB=new Map,this.listeners=[],this.undoStack_=[],this.redoStack_=[],this.blockDB=new Map,this.typedBlocksDB=new Map,this.procedureMap=new Hb,this.potentialVariableMap=null,this.id=S(),F(this),this.options=e||new ss({}),this.RTL=!!this.options.RTL,this.horizontalLayout=!!this.options.horizontalLayout,this.toolboxPosition=this.options.toolboxPosition,this.connectionChecker=new(w(z.CONNECTION_CHECKER,this.options,!0))(this),this.variableMap=new Kh(this)}dispose(){this.listeners.length=0,this.clear(),V(this)}sortObjects(e,t){const o=Math.sin(ca(Vi.SCAN_ANGLE))*(this.RTL?-1:1);return e=e.getRelativeToSurfaceXY(),t=t.getRelativeToSurfaceXY(),e.y+o*e.x-(t.y+o*t.x)}addTopBlock(e){this.topBlocks.push(e)}removeTopBlock(e){if(!Ct(this.topBlocks,e))throw Error("Block not present in workspace's list of top-most blocks.")}getTopBlocks(e=!1){const t=[].concat(this.topBlocks);return e&&1<t.length&&t.sort(this.sortObjects.bind(this)),t}addTypedBlock(e){this.typedBlocksDB.has(e.type)||this.typedBlocksDB.set(e.type,[]),this.typedBlocksDB.get(e.type).push(e)}removeTypedBlock(e){Ct(this.typedBlocksDB.get(e.type),e),this.typedBlocksDB.get(e.type).length||this.typedBlocksDB.delete(e.type)}getBlocksByType(e,t=!1){return this.typedBlocksDB.has(e)?(e=this.typedBlocksDB.get(e).slice(0),t&&e&&1<e.length&&e.sort(this.sortObjects.bind(this)),e.filter(o=>!o.isInsertionMarker())):[]}addTopComment(e){this.topComments.push(e),this.commentDB.has(e.id)&&console.warn('Overriding an existing comment on this workspace, with id "'+e.id+'"'),this.commentDB.set(e.id,e)}removeTopComment(e){if(!Ct(this.topComments,e))throw Error("Comment not present in workspace's list of top-most comments.");this.commentDB.delete(e.id)}getTopComments(e=!1){const t=[].concat(this.topComments);return e&&1<t.length&&t.sort(this.sortObjects.bind(this)),t}getAllBlocks(e=!1){if(e){var t=this.getTopBlocks(!0);e=[];for(let o=0;o<t.length;o++)e.push(...t[o].getDescendants(!0))}else for(e=this.getTopBlocks(!1),t=0;t<e.length;t++)e.push(...e[t].getChildren(!1));return e.filter(o=>!o.isInsertionMarker())}clear(){this.isClearing=!0;try{const e=i.getGroup$$module$build$src$core$events$utils();for(e||i.setGroup$$module$build$src$core$events$utils(!0);this.topBlocks.length;)this.topBlocks[0].dispose(!1);for(;this.topComments.length;)this.topComments[this.topComments.length-1].dispose();i.setGroup$$module$build$src$core$events$utils(e),this.variableMap.clear(),this.potentialVariableMap&&this.potentialVariableMap.clear()}finally{this.isClearing=!1}}renameVariableById(e,t){this.variableMap.renameVariableById(e,t)}createVariable(e,t,o){return this.variableMap.createVariable(e,t,o)}getVariableUsesById(e){return this.variableMap.getVariableUsesById(e)}deleteVariableById(e){this.variableMap.deleteVariableById(e)}getVariable(e,t){return this.variableMap.getVariable(e,t)}getVariableById(e){return this.variableMap.getVariableById(e)}getVariablesOfType(e){return this.variableMap.getVariablesOfType(e)}getVariableTypes(){return this.variableMap.getVariableTypes(this)}getAllVariables(){return this.variableMap.getAllVariables()}getAllVariableNames(){return this.variableMap.getAllVariableNames()}getWidth(){return 0}newBlock(e,t){throw Error("The implementation of newBlock should be monkey-patched in by blockly.ts")}newComment(e){throw Error("The implementation of newComment should be monkey-patched in by blockly.ts")}remainingCapacity(){return isNaN(this.options.maxBlocks)?1/0:this.options.maxBlocks-this.getAllBlocks(!1).length}remainingCapacityOfType(e){return this.options.maxInstances?(this.options.maxInstances[e]!==void 0?this.options.maxInstances[e]:1/0)-this.getBlocksByType(e,!1).length:1/0}isCapacityAvailable(e){if(!this.hasBlockLimits())return!0;let t=0;for(const o in e){if(e[o]>this.remainingCapacityOfType(o))return!1;t+=e[o]}return!(t>this.remainingCapacity())}hasBlockLimits(){return this.options.maxBlocks!==1/0||!!this.options.maxInstances}getUndoStack(){return this.undoStack_}getRedoStack(){return this.redoStack_}undo(e){var t=e?this.redoStack_:this.undoStack_,o=e?this.undoStack_:this.redoStack_;const n=t.pop();if(n){for(var c=[n];t.length&&n.group&&n.group===t[t.length-1].group;){const h=t.pop();h&&c.push(h)}for(t=0;t<c.length;t++)o.push(c[t]);i.setRecordUndo$$module$build$src$core$events$utils(!1);try{for(o=0;o<c.length;o++)c[o].run(e)}finally{i.setRecordUndo$$module$build$src$core$events$utils(!0)}}}clearUndo(){this.undoStack_.length=0,this.redoStack_.length=0,de()}addChangeListener(e){return this.listeners.push(e),e}removeChangeListener(e){Ct(this.listeners,e)}fireChangeListener(e){if(e.recordUndo)for(this.undoStack_.push(e),this.redoStack_.length=0;this.undoStack_.length>this.MAX_UNDO&&0<=this.MAX_UNDO;)this.undoStack_.shift();for(let t=0;t<this.listeners.length;t++)(0,this.listeners[t])(e)}getBlockById(e){return this.blockDB.get(e)||null}setBlockById(e,t){this.blockDB.set(e,t)}removeBlockById(e){this.blockDB.delete(e)}getCommentById(e){let t;return(t=this.commentDB.get(e))!=null?t:null}allInputsFilled(e){const t=this.getTopBlocks(!1);for(let o=0;o<t.length;o++)if(!t[o].allInputsFilled(e))return!1;return!0}getPotentialVariableMap(){return this.potentialVariableMap}createPotentialVariableMap(){this.potentialVariableMap=new Kh(this)}getVariableMap(){return this.variableMap}setVariableMap(e){this.variableMap=e}getProcedureMap(){return this.procedureMap}getRootWorkspace(){let e=null;const t=this.options.parentWorkspace;return this.isFlyout?t&&t.options&&(e=t.options.parentWorkspace):t&&(e=t),e}static getById(e){return Z(e)}static getAll(){return se()}};Vi.SCAN_ANGLE=3;var aT=100,Qb=class{constructor(e){this.parentWorkspace=e,this.sounds=new Map,this.lastSound=null,this.muted=!1}dispose(){this.sounds.clear()}load(e,t){if(e.length){try{var o=new globalThis.Audio}catch{return}for(let c=0;c<e.length;c++){const h=e[c],$=h.match(/\.(\w+)$/);if($&&o.canPlayType("audio/"+$[1])){var n=new globalThis.Audio(h);break}}n&&this.sounds.set(t,n)}}preload(){for(const e of this.sounds.values()){e.volume=.01;const t=e.play();if(t!==void 0?t.then(e.pause).catch(function(){}):e.pause(),ja||G$)break}}play(e,t){if(!this.muted){var o=this.sounds.get(e);o?(e=new Date,this.lastSound!==null&&e.getTime()-this.lastSound.getTime()<aT||(this.lastSound=e,o=ja||Jd?o:o.cloneNode(),o.volume=t===void 0?1:t,o.play())):this.parentWorkspace&&this.parentWorkspace.getAudioManager().play(e,t)}}setMuted(e){this.muted=e}getMuted(){return this.muted}},lT=20,Zt=class extends Vi{constructor(e){super(e),this.resizeHandlerWrapper=null,this.resizesEnabled=this.visible=this.rendered=!0,this.startScrollY=this.startScrollX=this.scrollY=this.scrollX=0,this.oldScale=this.scale=1,this.oldLeft=this.oldTop=0,this.inverseScreenCTM=this.targetWorkspace=this.dummyWheelListener=this.configureContextMenu=this.lastRecordedPageScroll=this.injectionDiv=this.currentGesture_=this.toolbox=this.flyout=this.scrollbar=this.trashcan=null,this.inverseScreenCTMDirty=!0,this.highlightedBlocks=[],this.toolboxCategoryCallbacks=new Map,this.flyoutButtonCallbacks=new Map,this.cachedParentSvg=null,this.keyboardAccessibilityMode=!1,this.topBoundedElements=[],this.dragTargetAreas=[],this.zoomControls_=this.layerManager=null,this.metricsManager=new(w(z.METRICS_MANAGER,e,!0))(this),this.getMetrics=e.getMetrics||this.metricsManager.getMetrics.bind(this.metricsManager),this.setMetrics=e.setMetrics||Zt.setTopLevelWorkspaceMetrics,this.componentManager=new at,this.connectionDBList=zi.init(this.connectionChecker),this.audioManager=new Qb(e.parentWorkspace),this.grid=this.options.gridPattern?new xh(this.options.gridPattern,e.gridOptions):null,this.markerManager=new qn(this),It&&ra&&this.registerToolboxCategoryCallback(ph,ra),si&&Aa&&this.registerToolboxCategoryCallback(Uh,Aa),Bt&&xa&&(this.registerToolboxCategoryCallback(pl,xa),this.addChangeListener(od)),this.themeManager_=this.options.parentWorkspace?this.options.parentWorkspace.getThemeManager():new Xb(this,this.options.theme||ll),this.themeManager_.subscribeWorkspace(this);let t;this.renderer=rd(this.options.renderer||"geras",this.getTheme(),(t=this.options.rendererOverrides)!=null?t:void 0),this.cachedParentSvgSize=new Le(0,0)}getMarkerManager(){return this.markerManager}getMetricsManager(){return this.metricsManager}setMetricsManager(e){this.metricsManager=e,this.getMetrics=this.metricsManager.getMetrics.bind(this.metricsManager)}getComponentManager(){return this.componentManager}setCursorSvg(e){this.markerManager.setCursorSvg(e)}setMarkerSvg(e){this.markerManager.setMarkerSvg(e)}getMarker(e){return this.markerManager?this.markerManager.getMarker(e):null}getCursor(){return this.markerManager?this.markerManager.getCursor():null}getRenderer(){return this.renderer}getThemeManager(){return this.themeManager_}getTheme(){return this.themeManager_.getTheme()}setTheme(e){e||(e=ll),this.themeManager_.setTheme(e)}refreshTheme(){this.svgGroup_&&this.renderer.refreshDom(this.svgGroup_,this.getTheme()),this.updateBlockStyles(this.getAllBlocks(!1).filter(t=>!!t.getStyleName())),this.refreshToolboxSelection(),this.toolbox&&this.toolbox.refreshTheme(),this.isVisible()&&this.setVisible(!0);const e=new(Y(M.THEME_CHANGE))(this.getTheme().name,this.id);U(e)}updateBlockStyles(e){for(let t=0,o;o=e[t];t++){const n=o.getStyleName();n&&o.setStyle(n)}}getInverseScreenCTM(){if(this.inverseScreenCTMDirty){const e=this.getParentSvg().getScreenCTM();e&&(this.inverseScreenCTM=e.inverse(),this.inverseScreenCTMDirty=!1)}return this.inverseScreenCTM}updateInverseScreenCTM(){this.inverseScreenCTMDirty=!0}isVisible(){return this.visible}getSvgXY(e){let t=0,o=0,n=1;(this.getCanvas().contains(e)||this.getBubbleCanvas().contains(e))&&(n=this.scale);do{const c=vn(e);(e===this.getCanvas()||e===this.getBubbleCanvas())&&(n=1),t+=c.x*n,o+=c.y*n,e=e.parentNode}while(e&&e!==this.getParentSvg()&&e!==this.getInjectionDiv());return new K(t,o)}getCachedParentSvgSize(){const e=this.cachedParentSvgSize;return new Le(e.width,e.height)}getOriginOffsetInPixels(){return Yr(this.getCanvas())}getInjectionDiv(){if(!this.injectionDiv){let e=this.svgGroup_;for(;e;){if((" "+(e.getAttribute("class")||"")+" ").includes(" injectionDiv ")){this.injectionDiv=e;break}e=e.parentNode}}return this.injectionDiv}getSvgGroup(){return this.svgGroup_}getBlockCanvas(){return this.getCanvas()}setResizeHandlerWrapper(e){this.resizeHandlerWrapper=e}createDom(e,t){return this.injectionDiv||(this.injectionDiv=t??null),this.svgGroup_=L(D.G,{class:"blocklyWorkspace"}),e&&(this.svgBackground_=L(D.RECT,{height:"100%",width:"100%",class:e},this.svgGroup_),e==="blocklyMainBackground"&&this.grid?this.svgBackground_.style.fill="url(#"+this.grid.getPatternId()+")":this.themeManager_.subscribe(this.svgBackground_,"workspaceBackgroundColour","fill")),this.layerManager=new QC(this),this.svgBlockCanvas_=this.layerManager.getBlockLayer(),this.svgBubbleCanvas_=this.layerManager.getBubbleLayer(),this.isFlyout||(Q(this.svgGroup_,"pointerdown",this,this.onMouseDown,!1),this.dummyWheelListener=()=>{},document.body.addEventListener("wheel",this.dummyWheelListener),Q(this.svgGroup_,"wheel",this,this.onMouseWheel)),this.options.hasCategories&&(this.toolbox=new(w(z.TOOLBOX,this.options,!0))(this)),this.grid&&this.grid.update(this.scale),this.recordDragTargets(),(e=w(z.CURSOR,this.options))&&this.markerManager.setCursor(new e),this.renderer.createDom(this.svgGroup_,this.getTheme()),this.svgGroup_}dispose(){if(this.rendered=!1,this.currentGesture_&&this.currentGesture_.cancel(),this.svgGroup_&&Ge(this.svgGroup_),this.toolbox&&(this.toolbox.dispose(),this.toolbox=null),this.flyout&&(this.flyout.dispose(),this.flyout=null),this.trashcan&&(this.trashcan.dispose(),this.trashcan=null),this.scrollbar&&(this.scrollbar.dispose(),this.scrollbar=null),this.zoomControls_&&this.zoomControls_.dispose(),this.audioManager&&this.audioManager.dispose(),this.grid&&(this.grid=null),this.renderer.dispose(),this.markerManager&&this.markerManager.dispose(),super.dispose(),this.themeManager_&&(this.themeManager_.unsubscribeWorkspace(this),this.themeManager_.unsubscribe(this.svgBackground_),this.options.parentWorkspace||this.themeManager_.dispose()),this.connectionDBList.length=0,this.toolboxCategoryCallbacks.clear(),this.flyoutButtonCallbacks.clear(),!this.options.parentWorkspace){const e=this.getParentSvg();e&&e.parentNode&&Ge(e.parentNode)}this.resizeHandlerWrapper&&(ze(this.resizeHandlerWrapper),this.resizeHandlerWrapper=null),this.dummyWheelListener&&(document.body.removeEventListener("wheel",this.dummyWheelListener),this.dummyWheelListener=null)}addTrashcan(){this.trashcan=Zt.newTrashcan(this);const e=this.trashcan.createDom();this.svgGroup_.insertBefore(e,this.getCanvas())}static newTrashcan(e){throw Error("The implementation of newTrashcan should be monkey-patched in by blockly.ts")}addZoomControls(){this.zoomControls_=new ob(this);const e=this.zoomControls_.createDom();this.svgGroup_.appendChild(e)}addFlyout(e){const t=new ss({parentWorkspace:this,rtl:this.RTL,oneBasedIndex:this.options.oneBasedIndex,horizontalLayout:this.horizontalLayout,renderer:this.options.renderer,rendererOverrides:this.options.rendererOverrides,move:{scrollbars:!0}});return t.toolboxPosition=this.options.toolboxPosition,this.flyout=this.horizontalLayout?new(w(z.FLYOUTS_HORIZONTAL_TOOLBOX,this.options,!0))(t):new(w(z.FLYOUTS_VERTICAL_TOOLBOX,this.options,!0))(t),this.flyout.autoClose=!1,this.flyout.getWorkspace().setVisible(!0),this.flyout.createDom(e)}getFlyout(e){return this.flyout||e?this.flyout:this.toolbox?this.toolbox.getFlyout():null}getToolbox(){return this.toolbox}updateScreenCalculations(){this.updateInverseScreenCTM(),this.recordDragTargets()}resizeContents(){this.resizesEnabled&&this.rendered&&(this.scrollbar&&this.scrollbar.resize(),this.updateInverseScreenCTM())}resize(){this.toolbox&&this.toolbox.position(),this.flyout&&this.flyout.position();const e=this.componentManager.getComponents(at.Capability.POSITIONABLE,!0),t=this.getMetricsManager().getUiMetrics(),o=[];for(let n=0,c;c=e[n];n++){c.position(t,o);const h=c.getBoundingRectangle();h&&o.push(h)}this.scrollbar&&this.scrollbar.resize(),this.updateScreenCalculations()}updateScreenCalculationsIfScrolled(){const e=Vc();K.equals(this.lastRecordedPageScroll,e)||(this.lastRecordedPageScroll=e,this.updateScreenCalculations())}getLayerManager(){return this.layerManager}getCanvas(){return this.layerManager.getBlockLayer()}setCachedParentSvgSize(e,t){const o=this.getParentSvg();e!=null&&(this.cachedParentSvgSize.width=e,o.setAttribute("data-cached-width",`${e}`)),t!=null&&(this.cachedParentSvgSize.height=t,o.setAttribute("data-cached-height",`${t}`))}getBubbleCanvas(){return this.layerManager.getBubbleLayer()}getParentSvg(){if(!this.cachedParentSvg){let e=this.svgGroup_;for(;e;){if(e.tagName==="svg"){this.cachedParentSvg=e;break}e=e.parentNode}}return this.cachedParentSvg}maybeFireViewportChangeEvent(){if(J()){var e=this.scale,t=-this.scrollY,o=-this.scrollX;if(!(e===this.oldScale&&1>Math.abs(t-this.oldTop)&&1>Math.abs(o-this.oldLeft))){var n=new(Y(M.VIEWPORT_CHANGE))(t,o,e,this.id,this.oldScale);this.oldScale=e,this.oldTop=t,this.oldLeft=o,U(n)}}}translate(e,t){let o;(o=this.layerManager)==null||o.translateLayers(new K(e,t),this.scale);let n;(n=this.grid)==null||n.moveTo(e,t),this.maybeFireViewportChangeEvent()}getWidth(){const e=this.getMetrics();return e?e.viewWidth/this.scale:0}setVisible(e){this.visible=e,this.svgGroup_&&(this.scrollbar&&this.scrollbar.setContainerVisible(e),this.getFlyout()&&this.getFlyout().setContainerVisible(e),this.getParentSvg().style.display=e?"block":"none",this.toolbox&&this.toolbox.setVisible(e),e||this.hideChaff(!0))}render(){const e=this.getAllBlocks(!1);for(let t=e.length-1;0<=t;t--)e[t].queueRender();this.getTopBlocks().flatMap(t=>t.getDescendants(!1)).filter(t=>t.isInsertionMarker()).forEach(t=>t.queueRender()),ps().then(()=>void this.markerManager.updateMarkers())}highlightBlock(e,t){if(t===void 0){for(let o=0,n;n=this.highlightedBlocks[o];o++)n.setHighlighted(!1);this.highlightedBlocks.length=0}(e=e?this.getBlockById(e):null)&&((t=t===void 0||t)?this.highlightedBlocks.includes(e)||this.highlightedBlocks.push(e):Ct(this.highlightedBlocks,e),e.setHighlighted(t))}refreshToolboxSelection(){const e=this.isFlyout?this.targetWorkspace:this;e&&!e.currentGesture_&&e.toolbox&&e.toolbox.getFlyout()&&e.toolbox.refreshSelection()}renameVariableById(e,t){super.renameVariableById(e,t),this.refreshToolboxSelection()}deleteVariableById(e){super.deleteVariableById(e),this.refreshToolboxSelection()}createVariable(e,t,o){return e=super.createVariable(e,t,o),this.refreshToolboxSelection(),e}recordDragTargets(){const e=this.componentManager.getComponents(at.Capability.DRAG_TARGET,!0);this.dragTargetAreas=[];for(let t=0,o;o=e[t];t++){const n=o.getClientRect();n&&this.dragTargetAreas.push({component:o,clientRect:n})}}newBlock(e,t){throw Error("The implementation of newBlock should be monkey-patched in by blockly.ts")}newComment(e){throw Error("The implementation of newComment should be monkey-patched in by blockly.ts")}getDragTarget(e){for(let t=0,o;o=this.dragTargetAreas[t];t++)if(o.clientRect.contains(e.clientX,e.clientY))return o.component;return null}onMouseDown(e){const t=this.getGesture(e);t&&t.handleWsStart(e,this)}startDrag(e,t){va(this,e,t)}moveDrag(e){return ya(this,e)}isDragging(){return this.currentGesture_!==null&&this.currentGesture_.isDragging()}isDraggable(){return this.options.moveOptions&&this.options.moveOptions.drag}isMovable(){return this.options.moveOptions&&!!this.options.moveOptions.scrollbars||this.options.moveOptions&&this.options.moveOptions.wheel||this.options.moveOptions&&this.options.moveOptions.drag||this.options.zoomOptions&&this.options.zoomOptions.wheel||this.options.zoomOptions&&this.options.zoomOptions.pinch}isMovableHorizontally(){const e=!!this.scrollbar;return this.isMovable()&&(!e||e&&this.scrollbar.canScrollHorizontally())}isMovableVertically(){const e=!!this.scrollbar;return this.isMovable()&&(!e||e&&this.scrollbar.canScrollVertically())}onMouseWheel(e){if(eo.inProgress())e.preventDefault(),e.stopPropagation();else{var t=this.options.zoomOptions&&this.options.zoomOptions.wheel,o=this.options.moveOptions&&this.options.moveOptions.wheel;if(t||o){var n=Hs(e);if(Xd)var c=e.metaKey;t&&(e.ctrlKey||c||!o)?(n=-n.y/50,t=tt(e,this.getParentSvg(),this.getInverseScreenCTM()),this.zoom(t.x,t.y,n)):(t=this.scrollX-n.x,o=this.scrollY-n.y,e.shiftKey&&!n.x&&(t=this.scrollX-n.y,o=this.scrollY),this.scroll(t,o)),e.preventDefault()}}}getBlocksBoundingBox(){const e=this.getTopBoundedElements();if(!e.length)return new Je(0,0,0,0);const t=e[0].getBoundingRectangle();for(let n=1;n<e.length;n++){var o=e[n];o.isInsertionMarker&&o.isInsertionMarker()||(o=o.getBoundingRectangle(),o.top<t.top&&(t.top=o.top),o.bottom>t.bottom&&(t.bottom=o.bottom),o.left<t.left&&(t.left=o.left),o.right>t.right&&(t.right=o.right))}return t}cleanUp(){this.setResizesEnabled(!1),i.setGroup$$module$build$src$core$events$utils(!0);var e=this.getTopBlocks(!0),t=e.filter(h=>h.isMovable());const o=e.filter(h=>!h.isMovable()).map(h=>h.getBoundingRectangle());e=function(h){for(const $ of o)if(h.intersects($))return $;return null};var n=0;const c=this.renderer.getConstants().MIN_BLOCK_HEIGHT;for(const h of t){for(t=h.getBoundingRectangle(),h.moveBy(-t.left,n-t.top,["cleanup"]),h.snapToGrid(),t=h.getBoundingRectangle(),n=e(t);n!=null;)n=n.top+n.getHeight()+c,h.moveBy(0,n-t.top,["cleanup"]),h.snapToGrid(),t=h.getBoundingRectangle(),n=e(t);n=h.getRelativeToSurfaceXY().y+h.getHeightWidth().height+c}i.setGroup$$module$build$src$core$events$utils(!1),this.setResizesEnabled(!0)}showContextMenu(e){if(!this.options.readOnly&&!this.isFlyout){var t=Ae.registry.getContextMenuOptions(Ae.ScopeType.WORKSPACE,{workspace:this});this.configureContextMenu&&this.configureContextMenu(t,e),An(e,t,this.RTL,this)}}updateToolbox(e){if(e=Jr(e)){if(!this.options.languageTree)throw Error("Existing toolbox is null. Can't create new toolbox.");if(Xr(e)){if(!this.toolbox)throw Error("Existing toolbox has no categories. Can't change mode.");this.options.languageTree=e,this.toolbox.render(e)}else{if(!this.flyout)throw Error("Existing toolbox has categories. Can't change mode.");this.options.languageTree=e,this.flyout.show(e)}}else if(this.options.languageTree)throw Error("Can't nullify an existing toolbox.")}markFocused(){this.options.parentWorkspace?this.options.parentWorkspace.markFocused():(le(this),this.getParentSvg().focus({preventScroll:!0}))}zoom(e,t,o){o=Math.pow(this.options.zoomOptions.scaleSpeed,o);const n=this.scale*o;if(this.scale!==n){n>this.options.zoomOptions.maxScale?o=this.options.zoomOptions.maxScale/this.scale:n<this.options.zoomOptions.minScale&&(o=this.options.zoomOptions.minScale/this.scale);var c=this.getCanvas().getCTM(),h=this.getParentSvg().createSVGPoint();h.x=e,h.y=t,h=h.matrixTransform(c.inverse()),e=h.x,t=h.y,c=c.translate(e*(1-o),t*(1-o)).scale(o),this.scrollX=c.e,this.scrollY=c.f,this.setScale(n)}}zoomCenter(e){var t=this.getMetrics();let o;this.flyout?(o=t.svgWidth?t.svgWidth/2:0,t=t.svgHeight?t.svgHeight/2:0):(o=t.viewWidth/2+t.absoluteLeft,t=t.viewHeight/2+t.absoluteTop),this.zoom(o,t,e)}zoomToFit(){if(this.isMovable()){var e=this.getMetrics(),t=e.viewWidth;e=e.viewHeight;var o=this.getBlocksBoundingBox(),n=2*lT,c=o.right-o.left+n;if(o=o.bottom-o.top+n,c){this.flyout&&(this.horizontalLayout?(e+=this.flyout.getHeight(),o+=this.flyout.getHeight()/this.scale):(t+=this.flyout.getWidth(),c+=this.flyout.getWidth()/this.scale)),t/=c,e/=o,i.disable$$module$build$src$core$events$utils();try{this.setScale(Math.min(t,e)),this.scrollCenter()}finally{i.enable$$module$build$src$core$events$utils()}this.maybeFireViewportChangeEvent()}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")}beginCanvasTransition(){fe(this.getCanvas(),"blocklyCanvasTransitioning"),fe(this.getBubbleCanvas(),"blocklyCanvasTransitioning")}endCanvasTransition(){st(this.getCanvas(),"blocklyCanvasTransitioning"),st(this.getBubbleCanvas(),"blocklyCanvasTransitioning")}scrollCenter(){if(this.isMovable()){var e=this.getMetrics(),t=(e.scrollWidth-e.viewWidth)/2,o=(e.scrollHeight-e.viewHeight)/2;t=-t-e.scrollLeft,o=-o-e.scrollTop,this.scroll(t,o)}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")}centerOnBlock(e,t){if(this.isMovable()){var o=e?this.getBlockById(e):null;if(o){e=o.getRelativeToSurfaceXY(),o=t?{height:o.height,width:o.width}:o.getHeightWidth();var n=this.scale;t=(e.x+(this.RTL?-1:1)*o.width/2)*n,e=(e.y+o.height/2)*n,o=this.getMetrics(),this.scroll(-(t-o.viewWidth/2),-(e-o.viewHeight/2))}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")}setScale(e){this.options.zoomOptions.maxScale&&e>this.options.zoomOptions.maxScale?e=this.options.zoomOptions.maxScale:this.options.zoomOptions.minScale&&e<this.options.zoomOptions.minScale&&(e=this.options.zoomOptions.minScale),this.scale=e,this.hideChaff(!1),(e=this.getFlyout(!1))&&e.isVisible()&&(e.reflow(),this.recordDragTargets()),this.grid&&this.grid.update(this.scale),e=this.getMetrics(),this.scrollX-=e.absoluteLeft,this.scrollY-=e.absoluteTop,e.viewLeft+=e.absoluteLeft,e.viewTop+=e.absoluteTop,this.scroll(this.scrollX,this.scrollY),this.scrollbar&&(this.flyout?this.scrollbar.resizeView(e):this.scrollbar.resizeContent(e))}getScale(){return this.options.parentWorkspace?this.options.parentWorkspace.getScale():this.scale}scroll(e,t){this.hideChaff(!0);const o=this.getMetrics();e=Math.min(e,-o.scrollLeft),t=Math.min(t,-o.scrollTop);const n=o.scrollTop+Math.max(0,o.scrollHeight-o.viewHeight);e=Math.max(e,-(o.scrollLeft+Math.max(0,o.scrollWidth-o.viewWidth))),t=Math.max(t,-n),this.scrollX=e,this.scrollY=t,this.scrollbar&&this.scrollbar.set(-(e+o.scrollLeft),-(t+o.scrollTop),!1),e+=o.absoluteLeft,t+=o.absoluteTop,this.translate(e,t)}getBlockById(e){return super.getBlockById(e)}getAllBlocks(e=!1){return super.getAllBlocks(e)}getTopBlocks(e=!1){return super.getTopBlocks(e)}addTopBlock(e){this.addTopBoundedElement(e),super.addTopBlock(e)}removeTopBlock(e){this.removeTopBoundedElement(e),super.removeTopBlock(e)}addTopComment(e){this.addTopBoundedElement(e),super.addTopComment(e)}removeTopComment(e){this.removeTopBoundedElement(e),super.removeTopComment(e)}getRootWorkspace(){return super.getRootWorkspace()}addTopBoundedElement(e){this.topBoundedElements.push(e)}removeTopBoundedElement(e){Ct(this.topBoundedElements,e)}getTopBoundedElements(){return[].concat(this.topBoundedElements)}setResizesEnabled(e){const t=!this.resizesEnabled&&e;this.resizesEnabled=e,t&&this.resizeContents()}clear(){this.setResizesEnabled(!1),super.clear(),this.topBoundedElements=[],this.setResizesEnabled(!0)}registerButtonCallback(e,t){if(typeof t!="function")throw TypeError("Button callbacks must be functions.");this.flyoutButtonCallbacks.set(e,t)}getButtonCallback(e){let t;return(t=this.flyoutButtonCallbacks.get(e))!=null?t:null}removeButtonCallback(e){this.flyoutButtonCallbacks.delete(e)}registerToolboxCategoryCallback(e,t){if(typeof t!="function")throw TypeError("Toolbox category callbacks must be functions.");this.toolboxCategoryCallbacks.set(e,t)}getToolboxCategoryCallback(e){return this.toolboxCategoryCallbacks.get(e)||null}removeToolboxCategoryCallback(e){this.toolboxCategoryCallbacks.delete(e)}getGesture(e){const t=e.type==="pointerdown",o=this.currentGesture_;return o?t&&o.hasStarted()?(console.warn("Tried to start the same gesture twice."),o.cancel(),null):o:t?this.currentGesture_=new eo(e,this):null}clearGesture(){this.currentGesture_=null}cancelCurrentGesture(){this.currentGesture_&&this.currentGesture_.cancel()}getAudioManager(){return this.audioManager}getGrid(){return this.grid}hideChaff(e=!1){Gs(),Dn(this),Ss(),this.hideComponents(e)}hideComponents(e=!1){this.getComponentManager().getComponents(at.Capability.AUTOHIDEABLE,!0).forEach(t=>t.autoHide(e))}static setTopLevelWorkspaceMetrics(e){const t=this.getMetrics();typeof e.x=="number"&&(this.scrollX=-(t.scrollLeft+(t.scrollWidth-t.viewWidth)*e.x)),typeof e.y=="number"&&(this.scrollY=-(t.scrollTop+(t.scrollHeight-t.viewHeight)*e.y)),this.translate(this.scrollX+t.absoluteLeft,this.scrollY+t.absoluteTop)}},Yh=class extends gs{constructor(e,t,o){super(o),this.type=M.SELECTED,this.oldElementId=e??void 0,this.newElementId=t??void 0}toJson(){const e=super.toJson();return e.oldElementId=this.oldElementId,e.newElementId=this.newElementId,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Yh),t.oldElementId=e.oldElementId,t.newElementId=e.newElementId,t}};r(z.EVENT,M.SELECTED,Yh);var lr=class{paste(e,t,o){if(!t.isCapacityAvailable(e.typeCounts))return null;o&&(e.blockState.x=o.x,e.blockState.y=o.y),o=o||new K(e.blockState.x||0,e.blockState.y||0),i.disable$$module$build$src$core$events$utils();let n;try{n=Vs(e.blockState,t),i$(n,o)}finally{i.enable$$module$build$src$core$events$utils()}return n&&(J()&&!n.isShadow()&&U(new(Y(M.BLOCK_CREATE))(n)),i.setSelected$$module$build$src$core$common(n),n)}};lr.TYPE="block",sa(lr.TYPE,new lr);var vl={};vl.bumpIntoBounds=Ei,vl.bumpIntoBoundsHandler=dd,vl.bumpTopObjectsIntoBounds=Ra;var ev=class{constructor(e){this.block=e,this.connectionPreviewer=this.connectionCandidate=this.startLoc=this.startChildConn=this.startParentConn=null,this.dragging=!1,this.dragOffset=new K(0,0),this.inGroup=!1,this.workspace=e.workspace}isMovable(){if(this.block.isShadow()){let e,t;return(t=(e=this.block.getParent())==null?void 0:e.isMovable())!=null?t:!1}return this.block.isOwnMovable()&&!this.block.isDeadOrDying()&&!this.workspace.options.readOnly&&!this.block.isInFlyout}startDrag(e){if(this.block.isShadow())this.startDraggingShadow(e);else{this.dragging=!0,(this.inGroup=!!i.getGroup$$module$build$src$core$events$utils())||i.setGroup$$module$build$src$core$events$utils(!0),this.fireDragStartEvent(),this.startLoc=this.block.getRelativeToSurfaceXY(),this.connectionCandidate=null,this.connectionPreviewer=new(w(z.CONNECTION_PREVIEWER,this.workspace.options))(this.block),Ro(),this.workspace.setResizesEnabled(!1),ki(),e=!!e&&(e.altKey||e.ctrlKey||e.metaKey),this.shouldDisconnect(e)&&this.disconnectBlock(e),this.block.setDragging(!0);var t;(t=this.workspace.getLayerManager())==null||t.moveToDragLayer(this.block)}}startDraggingShadow(e){const t=this.block.getParent();if(!t)throw Error("Tried to drag a shadow block with no parent. Shadow blocks should always have parents.");this.dragOffset=K.difference(t.getRelativeToSurfaceXY(),this.block.getRelativeToSurfaceXY()),t.startDrag(e)}shouldDisconnect(e){return!!(this.block.getParent()||e&&this.block.nextConnection&&this.block.nextConnection.targetBlock())}disconnectBlock(e){let t,o,n;if(this.startParentConn=(n=(t=this.block.outputConnection)==null?void 0:t.targetConnection)!=null?n:(o=this.block.previousConnection)==null?void 0:o.targetConnection,e){let c;this.startChildConn=(c=this.block.nextConnection)==null?void 0:c.targetConnection}this.block.unplug(e),Yu(this.block)}fireDragStartEvent(){const e=new(Y(M.BLOCK_DRAG))(this.block,!0,this.block.getDescendants(!1));U(e)}fireDragEndEvent(){const e=new(Y(M.BLOCK_DRAG))(this.block,!1,this.block.getDescendants(!1));U(e)}fireMoveEvent(){if(!this.block.isDeadOrDying()){var e=new(Y(M.BLOCK_MOVE))(this.block);e.setReason(["drag"]),e.oldCoordinate=this.startLoc,e.recordNew(),U(e)}}drag(e){if(this.block.isShadow()){let t;(t=this.block.getParent())==null||t.drag(K.sum(e,this.dragOffset))}else this.block.moveDuringDrag(e),this.updateConnectionPreview(this.block,K.difference(e,this.startLoc))}updateConnectionPreview(e,t){var o=this.connectionCandidate;const n=this.getConnectionCandidate(e,t);if(n){this.connectionCandidate=t=o&&this.currCandidateIsBetter(o,t,n)?o:n;var{local:c,neighbour:h}=t;t=c.type===ne.OUTPUT_VALUE||c.type===ne.PREVIOUS_STATEMENT,o=h.isConnected()&&!h.targetBlock().isInsertionMarker(),t&&o&&!this.orphanCanConnectAtEnd(e,h.targetBlock(),c.type)?this.connectionPreviewer.previewReplacement(c,h,h.targetBlock()):this.connectionPreviewer.previewConnection(c,h)}else this.connectionPreviewer.hidePreview(),this.connectionCandidate=null}orphanCanConnectAtEnd(e,t,o){return!!Pe.getConnectionForOrphanedConnection(e,o===ne.OUTPUT_VALUE?t.outputConnection:t.previousConnection)}currCandidateIsBetter(e,t,o){const{local:n,neighbour:c}=e;e=new K(n.x,n.y);const h=new K(c.x,c.y);return t=K.distance(K.sum(e,t),h),o.distance>t-i.config$$module$build$src$core$config.currentConnectionPreference}getConnectionCandidate(e,t){e=this.getLocalConnections(e);let o=this.connectionCandidate?i.config$$module$build$src$core$config.connectingSnapRadius:i.config$$module$build$src$core$config.snapRadius,n=null;for(const c of e){const{connection:h,radius:$}=c.closest(o,t);h&&(n={local:c,neighbour:h,distance:$},o=$)}return n}getLocalConnections(e){const t=e.getConnections_(!1),o=e.lastConnectionInStack(!0);return o&&o!==e.nextConnection&&t.push(o),t}endDrag(e){if(this.block.isShadow()){let t;(t=this.block.getParent())==null||t.endDrag(e)}else{if(this.fireDragEndEvent(),this.fireMoveEvent(),Oo(),ki(),this.connectionPreviewer.hidePreview(),!this.block.isDeadOrDying()&&this.dragging){let t;(t=this.workspace.getLayerManager())==null||t.moveOffDragLayer(this.block,yo),this.block.setDragging(!1)}this.connectionCandidate?(this.applyConnections(this.connectionCandidate),this.disposeStep()):this.block.queueRender().then(()=>this.disposeStep()),this.inGroup||i.setGroup$$module$build$src$core$events$utils(!1)}}disposeStep(){this.block.snapToGrid(),this.connectionPreviewer.dispose(),this.workspace.setResizesEnabled(!0)}applyConnections(e){const{local:t,neighbour:o}=e;t.connect(o);const n=t.isSuperior()?o:t,c=this.block.getRootBlock();ps().then(()=>{Ca(n.getSourceBlock()),setTimeout(()=>{c.bringToFront()},0)})}revertDrag(){if(this.block.isShadow()){let t;(t=this.block.getParent())==null||t.revertDrag()}else{var e;if((e=this.startChildConn)==null||e.connect(this.block.nextConnection),this.startParentConn)switch(this.startParentConn.type){case ne.INPUT_VALUE:this.startParentConn.connect(this.block.outputConnection);break;case ne.NEXT_STATEMENT:this.startParentConn.connect(this.block.previousConnection)}else{this.block.moveTo(this.startLoc,["drag"]);let t;(t=this.workspace.getLayerManager())==null||t.moveOffDragLayer(this.block,yo),Ei(this.workspace,this.workspace.getMetricsManager().getScrollMetrics(!0),this.block)}this.startParentConn=this.startChildConn=null,this.connectionPreviewer.hidePreview(),this.connectionCandidate=null,this.block.setDragging(!1),this.dragging=!1}}},tv=class{constructor(){this.drawer=this.curNode=this.colour=null,this.type="marker"}setDrawer(e){this.drawer=e}getDrawer(){return this.drawer}getCurNode(){return this.curNode}setCurNode(e){const t=this.curNode;this.curNode=e,this.drawer&&this.drawer.draw(t,this.curNode)}draw(){this.drawer&&this.drawer.draw(this.curNode,this.curNode)}hide(){this.drawer&&this.drawer.hide()}dispose(){this.getDrawer()&&this.getDrawer().dispose()}},Jh=class extends tv{constructor(){super(),this.type="cursor"}next(){var e=this.getCurNode();if(!e)return null;for(e=e.next();e&&e.next()&&(e.getType()===P.types.NEXT||e.getType()===P.types.BLOCK);)e=e.next();return e&&this.setCurNode(e),e}in(){var e=this.getCurNode();if(!e)return null;(e.getType()===P.types.PREVIOUS||e.getType()===P.types.OUTPUT)&&(e=e.next());let t,o;return(e=(o=(t=e)==null?void 0:t.in())!=null?o:null)&&this.setCurNode(e),e}prev(){var e=this.getCurNode();if(!e)return null;for(e=e.prev();e&&e.prev()&&(e.getType()===P.types.NEXT||e.getType()===P.types.BLOCK);)e=e.prev();return e&&this.setCurNode(e),e}out(){var e=this.getCurNode();return e?((e=e.out())&&e.getType()===P.types.BLOCK&&(e=e.prev()||e),e&&this.setCurNode(e),e):null}};r(z.CURSOR,Ds,Jh);var cr=class extends Jh{constructor(){super()}next(){var e=this.getCurNode();return e?((e=this.getNextNode_(e,this.validNode_))&&this.setCurNode(e),e):null}in(){return this.next()}prev(){var e=this.getCurNode();return e?((e=this.getPreviousNode_(e,this.validNode_))&&this.setCurNode(e),e):null}out(){return this.prev()}getNextNode_(e,t){if(!e)return null;const o=e.in()||e.next();return t(o)?o:o?this.getNextNode_(o,t):(e=this.findSiblingOrParent(e.out()),t(e)?e:e?this.getNextNode_(e,t):null)}getPreviousNode_(e,t){if(!e)return null;let o=e.prev();return o=o?this.getRightMostChild(o):e.out(),t(o)?o:o?this.getPreviousNode_(o,t):null}validNode_(e){let t=!1;return e=e&&e.getType(),(e===P.types.OUTPUT||e===P.types.INPUT||e===P.types.FIELD||e===P.types.NEXT||e===P.types.PREVIOUS||e===P.types.WORKSPACE)&&(t=!0),t}findSiblingOrParent(e){if(!e)return null;const t=e.next();return t||this.findSiblingOrParent(e.out())}getRightMostChild(e){if(!e.in())return e;for(e=e.in();e&&e.next();)e=e.next();return this.getRightMostChild(e)}};cr.registrationName="basicCursor",r(z.CURSOR,cr.registrationName,cr);var sv=class extends cr{validNode_(e){let t=!1;const o=e&&e.getType();return e&&(e=e.getLocation(),o===P.types.FIELD&&e&&e.isTabNavigable()&&e.isClickable()&&(t=!0)),t}},ov=10,Pt=class extends Pe{constructor(e,t){super(e,t),this.highlighted=!1,this.targetConnection=null,this.db=e.workspace.connectionDBList[t],this.dbOpposite=e.workspace.connectionDBList[oi[t]],this.offsetInBlock=new K(0,0),this.trackedState=Pt.TrackedState.WILL_TRACK}dispose(){super.dispose(),this.trackedState===Pt.TrackedState.TRACKED&&this.db.removeConnection(this,this.y);let e,t;(t=(e=this.sourceBlock_.pathObject).removeConnectionHighlight)==null||t.call(e,this)}getSourceBlock(){return super.getSourceBlock()}targetBlock(){return super.targetBlock()}distanceFrom(e){const t=this.x-e.x;return e=this.y-e.y,Math.sqrt(t*t+e*e)}bumpAwayFrom(e,t=!1){if(!this.sourceBlock_.workspace.isDragging()){var o=i.config$$module$build$src$core$config.snapRadius+Math.floor(Math.random()*ov),n=i.config$$module$build$src$core$config.snapRadius+Math.floor(Math.random()*ov),c=e.sourceBlock_.getRootBlock(),h=this.sourceBlock_.getRootBlock();if(!c.isInFlyout&&!h.isInFlyout){var $=!0;if(h.isMovable())c.isMovable()&&t&&(n=-n);else if(c.isMovable())$=!1,o=-o,n=-n;else return;t=$?e:this,e=$?this:e,c=$?h:c,(h=x()===c)||c.addSelect(),c.RTL&&(o=-o),c.moveBy(t.x+o-e.x,t.y+n-e.y,["bump"]),h||c.removeSelect()}}}moveTo(e,t){let o=!1;return this.trackedState===Pt.TrackedState.WILL_TRACK?(this.db.addConnection(this,t),this.trackedState=Pt.TrackedState.TRACKED,o=!0):this.trackedState===Pt.TrackedState.TRACKED&&(this.db.removeConnection(this,this.y),this.db.addConnection(this,t),o=!0),this.x=e,this.y=t,o}moveBy(e,t){return this.moveTo(this.x+e,this.y+t)}moveToOffset(e){return this.moveTo(e.x+this.offsetInBlock.x,e.y+this.offsetInBlock.y)}setOffsetInBlock(e,t){this.offsetInBlock.x=e,this.offsetInBlock.y=t}getOffsetInBlock(){return this.offsetInBlock}tightenEfficiently(){var e=this.targetConnection;const t=this.targetBlock();e&&t&&(e=K.difference(this.offsetInBlock,e.offsetInBlock),t.translate(e.x,e.y))}closest(e,t){return this.dbOpposite.searchForClosest(this,e,t)}highlight(){this.highlighted=!0,this.getSourceBlock().queueRender()}unhighlight(){this.highlighted=!1,this.getSourceBlock().queueRender()}isHighlighted(){return this.highlighted}setTracking(e){e&&this.trackedState===Pt.TrackedState.TRACKED||!e&&this.trackedState===Pt.TrackedState.UNTRACKED||this.sourceBlock_.isInFlyout||(e?(this.db.addConnection(this,this.y),this.trackedState=Pt.TrackedState.TRACKED):(this.trackedState===Pt.TrackedState.TRACKED&&this.db.removeConnection(this,this.y),this.trackedState=Pt.TrackedState.UNTRACKED))}stopTrackingAll(){if(this.setTracking(!1),this.targetConnection){const e=this.targetBlock().getDescendants(!1);for(let t=0;t<e.length;t++){const o=e[t],n=o.getConnections_(!0);for(let c=0;c<n.length;c++)n[c].setTracking(!1);for(const c of o.getIcons())vi(c)&&c.setBubbleVisible(!1)}}}startTrackingAll(){this.setTracking(!0);let e=[];if(this.type!==ne.INPUT_VALUE&&this.type!==ne.NEXT_STATEMENT)return e;const t=this.targetBlock();if(t){let o;t.isCollapsed()?(o=[],t.outputConnection&&o.push(t.outputConnection),t.nextConnection&&o.push(t.nextConnection),t.previousConnection&&o.push(t.previousConnection)):o=t.getConnections_(!0);for(let n=0;n<o.length;n++)e.push(...o[n].startTrackingAll());e.length||(e=[t])}return e}onFailedConnect(e){const t=this.getSourceBlock();if($e()){const o=i.getGroup$$module$build$src$core$events$utils();setTimeout(function(){t.isDisposed()||t.getParent()||(i.setGroup$$module$build$src$core$events$utils(o),this.bumpAwayFrom(e),i.setGroup$$module$build$src$core$events$utils(!1))}.bind(this),i.config$$module$build$src$core$config.bumpDelay)}}disconnectInternal(e=!0){const{parentConnection:t,childConnection:o}=this.getParentAndChildConnections();if(t&&o){var n=i.getGroup$$module$build$src$core$events$utils();n||i.setGroup$$module$build$src$core$events$utils(!0);var c=t.getSourceBlock(),h=o.getSourceBlock();super.disconnectInternal(e),c.queueRender(),h.updateDisabled(),h.queueRender(),h.getSvgRoot().style.display="block",i.setGroup$$module$build$src$core$events$utils(n)}}respawnShadow_(){super.respawnShadow_();const e=this.targetBlock();e&&(e.initSvg(),e.queueRender())}neighbours(e){return this.dbOpposite.getNeighbours(this,e)}connect_(e){super.connect_(e);var t=this.getSourceBlock();e=e.getSourceBlock(),t.updateDisabled(),e.updateDisabled(),e.queueRender();var o=x();(o=o===t&&t||o===e&&e)&&(o.removeSelect(),o.addSelect()),(t=t.getInputWithBlock(e))&&(t=t.isVisible(),e.getSvgRoot().style.display=t?"block":"none")}onCheckChanged_(){!this.isConnected()||this.targetConnection&&this.getConnectionChecker().canConnect(this,this.targetConnection,!1)||(this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug()}setCheck(e){return super.setCheck(e),this.sourceBlock_.queueRender(),this}};(function(e){e=e.TrackedState||(e.TrackedState={}),e[e.WILL_TRACK=-1]="WILL_TRACK",e[e.UNTRACKED=0]="UNTRACKED",e[e.TRACKED=1]="TRACKED"})(Pt||(Pt={})),Pt.TrackedState;var ns=class extends Co{constructor(e,t,o){if(super(e,t,o),this.childlessWidth=this.width=this.height=0,this.warningTextDb=new Map,this.mutator=null,this.rendered=!0,this.visuallyDisabled=!1,this.translation="",this.dragging=!1,this.relativeCoords=new K(0,0),this.dragStrategy=new ev(this),!e.rendered)throw TypeError("Cannot create a rendered block in a headless workspace");this.workspace=e,this.svgGroup=L(D.G,{}),this.style=e.getRenderer().getConstants().getBlockStyle(null),this.pathObject=e.getRenderer().makePathObject(this.svgGroup,this.style),e=this.pathObject.svgPath,e.tooltip=this,wi(e),this.svgGroup.setAttribute("data-id",this.id),this.doInit_()}initSvg(){if(!this.initialized){for(var e of this.inputList)e.init();for(const t of this.getIcons())t.initView(this.createIconPointerDownListener(t)),t.updateEditable();this.applyColour(),this.pathObject.updateMovable(this.isMovable()||this.isInFlyout),e=this.getSvgRoot(),!this.workspace.options.readOnly&&e&&Q(e,"pointerdown",this,this.onMouseDown),e.parentNode||this.workspace.getCanvas().appendChild(e),this.initialized=!0}}getColourSecondary(){return this.style.colourSecondary}getColourTertiary(){return this.style.colourTertiary}select(){if(this.isShadow()){let e;(e=this.getParent())==null||e.select()}else this.addSelect()}unselect(){if(this.isShadow()){let e;(e=this.getParent())==null||e.unselect()}else this.removeSelect()}setParent(e){const t=this.parentBlock_;if(e!==t){Ro(),super.setParent(e),Oo();var o=this.getSvgRoot();if(!this.workspace.isClearing&&o){var n=this.getRelativeToSurfaceXY();e?e.getSvgRoot().appendChild(o):t&&((e=this.workspace.getCanvas().querySelector(".blocklyDragging"))?this.workspace.getCanvas().insertBefore(o,e):this.workspace.getCanvas().appendChild(o),this.translate(n.x,n.y)),this.applyColour()}}}getRelativeToSurfaceXY(){const e=this.workspace.getLayerManager();if(!e)throw Error("Cannot calculate position because the workspace has not been appended");let t=0,o=0,n=this.getSvgRoot();if(n)do{const c=vn(n);t+=c.x,o+=c.y,n=n.parentNode}while(n&&!e.hasLayer(n));return new K(t,o)}moveBy(e,t,o){if(this.parentBlock_)throw Error("Block has parent");const n=J();let c=null;n&&(c=new(Y(M.BLOCK_MOVE))(this),o&&c.setReason(o)),e=new K(e,t),t=this.getRelativeToSurfaceXY(),e=K.sum(t,e),this.translate(e.x,e.y),this.updateComponentLocations(e),n&&c&&(c.recordNew(),U(c)),this.workspace.resizeContents()}translate(e,t){this.translation=`translate(${e}, ${t})`,this.relativeCoords=new K(e,t),this.getSvgRoot().setAttribute("transform",this.getTranslation())}getTranslation(){return this.translation}moveTo(e,t){const o=this.getRelativeToSurfaceXY();this.moveBy(e.x-o.x,e.y-o.y,t)}moveDuringDrag(e){this.translate(e.x,e.y),this.getSvgRoot().setAttribute("transform",this.getTranslation()),this.updateComponentLocations(e)}snapToGrid(){if(!this.isDeadOrDying()&&!this.getParent()&&!this.isInFlyout){var e=this.workspace.getGrid();if(e!=null&&e.shouldSnap()){var t=this.getRelativeToSurfaceXY();e=e.alignXY(t),e!==t&&this.moveTo(e,["snap"])}}}getBoundingRectangle(){return this.getBoundingRectangleWithDimensions(this.getHeightWidth())}getBoundingRectangleWithoutChildren(){return this.getBoundingRectangleWithDimensions({height:this.height,width:this.childlessWidth})}getBoundingRectangleWithDimensions(e){const t=this.getRelativeToSurfaceXY();let o,n;return this.RTL?(o=t.x-e.width,n=t.x):(o=t.x,n=t.x+e.width),new Je(t.y,t.y+e.height,o,n)}markDirty(){this.pathObject.constants=this.workspace.getRenderer().getConstants();for(let e=0,t;t=this.inputList[e];e++)t.markDirty()}setCollapsed(e){this.collapsed_!==e&&(super.setCollapsed(e),this.updateCollapsed())}updateCollapsed(){var e=this.isCollapsed();const t=Gn,o=Ga;for(let c=0,h;h=this.inputList[c];c++)h.name!==t&&h.setVisible(!e);for(var n of this.getIcons())n.updateCollapsed();e?(e=this.toString(qb),(n=this.getField(o))?n.setValue(e):(this.getInput(t)||this.appendDummyInput(t)).appendField(new ti(e),o)):(this.updateDisabled(),this.removeInput(t))}tab(e,t){const o=new sv;o.setCurNode(P.createFieldNode(e)),e=o.getCurNode(),t?o.next():o.prev(),(t=o.getCurNode())&&t!==e&&(t.getLocation().showEditor(),this.workspace.keyboardAccessibilityMode&&this.workspace.getCursor().setCurNode(t))}onMouseDown(e){const t=this.workspace.getGesture(e);t&&t.handleBlockStart(e,this)}showHelp(){const e=typeof this.helpUrl=="function"?this.helpUrl():this.helpUrl;e&&window.open(e)}generateContextMenu(){if(this.workspace.options.readOnly||!this.contextMenu)return null;const e=Ae.registry.getContextMenuOptions(Ae.ScopeType.BLOCK,{block:this});return this.customContextMenu&&this.customContextMenu(e),e}showContextMenu(e){const t=this.generateContextMenu();t&&t.length&&(An(e,t,this.RTL,this.workspace),Pu(this))}updateComponentLocations(e){this.dragging||this.updateConnectionLocations(e),this.updateIconLocations(e),this.updateFieldLocations(e);for(const t of this.getChildren(!1))t.updateComponentLocations(K.sum(e,t.relativeCoords))}updateConnectionLocations(e){for(const t of this.getConnections_(!1))t.moveToOffset(e)}updateIconLocations(e){for(const t of this.getIcons())t.onLocationChange(e)}updateFieldLocations(e){for(const t of this.inputList)for(const o of t.fieldRow)o.onLocationChange(e)}setDragging(e){(this.dragging=e)?(this.translation="",zn.push(...this.getConnections_(!0)),fe(this.svgGroup,"blocklyDragging")):(zn.length=0,st(this.svgGroup,"blocklyDragging"));for(let t=0;t<this.childBlocks_.length;t++)this.childBlocks_[t].setDragging(e)}setMovable(e){super.setMovable(e),this.pathObject.updateMovable(e)}setEditable(e){super.setEditable(e),e=this.getIcons();for(let t=0;t<e.length;t++)e[t].updateEditable()}setShadow(e){super.setShadow(e),this.applyColour()}setInsertionMarker(e){this.isInsertionMarker_!==e&&(this.isInsertionMarker_=e)&&(this.setColour(this.workspace.getRenderer().getConstants().INSERTION_MARKER_COLOUR),this.pathObject.updateInsertionMarker(!0))}getSvgRoot(){return this.svgGroup}dispose(e,t){if(this.disposing=!0,Su(),Rn(),t&&(this.unplug(e),wa(this)),t=x(),t instanceof Co){let o=t;for(;o!==null;)o===this&&t.unselect(),o=o.getParent()}super.dispose(!!e),Ge(this.svgGroup)}disposeInternal(){this.disposing=!0,super.disposeInternal(),x()===this&&(this.unselect(),this.workspace.cancelCurrentGesture()),[...this.warningTextDb.values()].forEach(e=>clearTimeout(e)),this.warningTextDb.clear(),this.getIcons().forEach(e=>e.dispose())}checkAndDelete(){this.workspace.isFlyout||(i.setGroup$$module$build$src$core$events$utils(!0),this.workspace.hideChaff(),this.outputConnection?this.dispose(!1,!0):this.dispose(!0,!0),i.setGroup$$module$build$src$core$events$utils(!1))}toCopyData(){return this.isInsertionMarker_?null:{paster:lr.TYPE,blockState:Gt(this,{addCoordinates:!0,addNextBlocks:!1}),typeCounts:ye(this,!0)}}applyColour(){this.pathObject.applyColour(this);const e=this.getIcons();for(let t=0;t<e.length;t++)e[t].applyColour();for(let t=0,o;o=this.inputList[t];t++)for(let n=0,c;c=o.fieldRow[n];n++)c.applyColour()}updateDisabled(){const e=!this.isEnabled()||this.getInheritedDisabled();if(this.visuallyDisabled===e){let t;(t=this.getNextBlock())==null||t.updateDisabled()}else{this.applyColour(),this.visuallyDisabled=e;for(const t of this.getChildren(!1))t.updateDisabled()}}setWarningText(e,t=""){if(t)this.warningTextDb.has(t)&&(clearTimeout(this.warningTextDb.get(t)),this.warningTextDb.delete(t));else{for(var o of this.warningTextDb.values())clearTimeout(o);this.warningTextDb.clear()}if(this.workspace.isDragging())this.warningTextDb.set(t,setTimeout(()=>{this.isDeadOrDying()||(this.warningTextDb.delete(t),this.setWarningText(e,t))},100));else if(this.isInFlyout&&(e=null),o=this.getIcon(io.TYPE),e){let n=this.getSurroundParent(),c=null;for(;n;)n.isCollapsed()&&(c=n),n=n.getSurroundParent();c&&c.setWarningText(i.Msg$$module$build$src$core$msg.COLLAPSED_WARNINGS_WARNING,ns.COLLAPSED_WARNING_ID),o?o.addMessage(e,t):this.addIcon(new io(this).addMessage(e,t))}else o&&(t?(o.addMessage("",t),o.getText()||this.removeIcon(io.TYPE)):this.removeIcon(io.TYPE))}setMutator(e){this.removeIcon(i.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE),e&&this.addIcon(e)}addIcon(e){return super.addIcon(e),e instanceof i.MutatorIcon$$module$build$src$core$icons$mutator_icon&&(this.mutator=e),e.initView(this.createIconPointerDownListener(e)),e.applyColour(),e.updateEditable(),this.queueRender(),e}createIconPointerDownListener(e){return t=>{this.isDeadOrDying()||(t=this.workspace.getGesture(t))&&t.setStartIcon(e)}}removeIcon(e){const t=super.removeIcon(e);return e.equals(i.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE)&&(this.mutator=null),this.queueRender(),t}setEnabled(e){_("setEnabled","v11","v12","the setDisabledReason method of BlockSvg");const t=this.isEnabled();super.setEnabled(e),this.isEnabled()===t||this.getInheritedDisabled()||this.updateDisabled()}setDisabledReason(e,t){const o=this.isEnabled();super.setDisabledReason(e,t),this.isEnabled()===o||this.getInheritedDisabled()||this.updateDisabled()}setHighlighted(e){this.pathObject.updateHighlighted(e)}addSelect(){this.pathObject.updateSelected(!0)}removeSelect(){this.pathObject.updateSelected(!1)}setDeleteStyle(e){this.pathObject.updateDraggingDelete(e)}getColour(){return this.style.colourPrimary}setColour(e){super.setColour(e),e=this.workspace.getRenderer().getConstants().getBlockStyleForColour(this.colour_),this.pathObject.setStyle(e.style),this.style=e.style,this.styleName_=e.name,this.applyColour()}setStyle(e){const t=this.workspace.getRenderer().getConstants().getBlockStyle(e);if(this.styleName_=e,t)this.hat=t.hat,this.pathObject.setStyle(t),this.colour_=t.colourPrimary,this.style=t,this.applyColour();else throw Error("Invalid style name: "+e)}getStyle(){return this.style}bringToFront(e=!1){let t=this;if(!t.isDeadOrDying())do{const o=t.getSvgRoot(),n=o.parentNode,c=n.childNodes;if(c[c.length-1]!==o&&n.appendChild(o),e)break;t=t.getParent()}while(t)}setPreviousStatement(e,t){super.setPreviousStatement(e,t),this.queueRender()}setNextStatement(e,t){super.setNextStatement(e,t),this.queueRender()}setOutput(e,t){super.setOutput(e,t),this.queueRender()}setInputsInline(e){super.setInputsInline(e),this.queueRender()}removeInput(e,t){return e=super.removeInput(e,t),this.queueRender(),e}moveNumberedInputBefore(e,t){super.moveNumberedInputBefore(e,t),this.queueRender()}appendInput(e){return super.appendInput(e),this.queueRender(),e}setConnectionTracking(e){if(this.previousConnection&&this.previousConnection.setTracking(e),this.outputConnection&&this.outputConnection.setTracking(e),this.nextConnection){this.nextConnection.setTracking(e);var t=this.nextConnection.targetBlock();t&&t.setConnectionTracking(e)}if(!this.collapsed_)for(t=0;t<this.inputList.length;t++){var o=this.inputList[t].connection;o&&(o.setTracking(e),(o=o.targetBlock())&&o.setConnectionTracking(e))}}getConnections_(e){const t=[];if(this.outputConnection&&t.push(this.outputConnection),this.previousConnection&&t.push(this.previousConnection),this.nextConnection&&t.push(this.nextConnection),e||!this.collapsed_)for(let o=0,n;n=this.inputList[o];o++)n.connection&&t.push(n.connection);return t}lastConnectionInStack(e){return super.lastConnectionInStack(e)}getMatchingConnection(e,t){return super.getMatchingConnection(e,t)}makeConnection_(e){return new Pt(this,e)}getNextBlock(){return super.getNextBlock()}getPreviousBlock(){return super.getPreviousBlock()}bumpNeighbours(){const e=this.getRootBlock();if(!(this.isDeadOrDying()||this.workspace.isDragging()||e.isInFlyout))for(const t of this.getConnections_(!1)){if(t.isSuperior()){let o;(o=t.targetBlock())==null||o.bumpNeighbours()}for(const o of t.neighbours(i.config$$module$build$src$core$config.snapRadius))o.getSourceBlock().getRootBlock()!==e&&(t.isConnected()&&o.isConnected()||(t.isSuperior()?o.bumpAwayFrom(t,!1):t.bumpAwayFrom(o,!0)))}}scheduleSnapAndBump(){this.snapToGrid(),this.bumpNeighbours()}positionNearConnection(e,t,o){if(e.type===ne.NEXT_STATEMENT||e.type===ne.INPUT_VALUE){let n=t.x;t=t.y,n+=o.x-e.getOffsetInBlock().x,t+=o.y-e.getOffsetInBlock().y,this.moveBy(n,t)}}getChildren(e){return super.getChildren(e)}queueRender(){return Yc(this)}render(){this.queueRender(),Ws()}renderEfficiently(){Ro(),this.isCollapsed()&&this.updateCollapsed(),this.isEnabled()||this.updateDisabled(),this.workspace.getRenderer().render(this),this.tightenChildrenEfficiently(),Oo(),this.updateMarkers_()}tightenChildrenEfficiently(){for(const e of this.inputList){const t=e.connection;t&&t.tightenEfficiently()}this.nextConnection&&this.nextConnection.tightenEfficiently()}updateMarkers_(){this.workspace.keyboardAccessibilityMode&&this.pathObject.cursorSvg&&this.workspace.getCursor().draw(),this.workspace.keyboardAccessibilityMode&&this.pathObject.markerSvg&&this.workspace.getMarker(qn.LOCAL_MARKER).draw();for(const e of this.inputList)for(const t of e.fieldRow)t.updateMarkers_()}setCursorSvg(e){this.pathObject.setCursorSvg(e)}setMarkerSvg(e){this.pathObject.setMarkerSvg(e)}getHeightWidth(){let e=this.height,t=this.width;var o=this.getNextBlock();if(o){o=o.getHeightWidth();const n=this.workspace.getRenderer().getConstants().NOTCH_HEIGHT;e+=o.height-n,t=Math.max(t,o.width)}return{height:e,width:t}}fadeForReplacement(e){this.pathObject.updateReplacementFade(e)}highlightShapeForInput(e,t){this.pathObject.updateShapeForInputHighlight(e,t)}setDragStrategy(e){this.dragStrategy=e}isMovable(){return this.dragStrategy.isMovable()}startDrag(e){this.dragStrategy.startDrag(e)}drag(e,t){this.dragStrategy.drag(e,t)}endDrag(e){this.dragStrategy.endDrag(e)}revertDrag(){this.dragStrategy.revertDrag()}toFlyoutInfo(){const e=Object.assign({},{kind:"BLOCK"},Gt(this)),t=new Set(["id","height","width","pinned","enabled"]),o=function(n){for(const c in n)t.has(c)?delete n[c]:typeof n[c]=="object"&&o(n[c])};return o(e),[e]}};ns.INLINE=-1,ns.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_";var iv=class{constructor(){}onDragEnter(e){}onDragOver(e){}onDragExit(e){}onDrop(e){}getClientRect(){return null}shouldPreventMove(e){return!1}},yl=class extends iv{constructor(){super(),this.wouldDelete_=!1}wouldDelete(e){return e instanceof ns?(e=!e.getParent()&&e.isDeletable(),this.updateWouldDelete_(e)):this.updateWouldDelete_(Qt(e)&&e.isDeletable()),this.wouldDelete_}updateWouldDelete_(e){this.wouldDelete_=e}},Xh=class extends gs{constructor(e,t){super(t),this.type=M.TRASHCAN_OPEN,this.isOpen=e}toJson(){const e=super.toJson();if(this.isOpen===void 0)throw Error("Whether this is already open or not is undefined. Either pass a value to the constructor, or call fromJson");return e.isOpen=this.isOpen,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Xh),t.isOpen=e.isOpen,t}};r(z.EVENT,M.TRASHCAN_OPEN,Xh);var nv=class extends yl{constructor(e){super(),this.workspace=e,this.id="trashcan",this.contents=[],this.flyout=null,this.isLidOpen=!1,this.minOpenness=0,this.lidTask=this.svgLid=this.svgGroup=null,this.top=this.left=this.lidOpen=0,this.initialized=!1,0>=this.workspace.options.maxTrashcanContents||(e=new ss({scrollbars:!0,parentWorkspace:this.workspace,rtl:this.workspace.RTL,oneBasedIndex:this.workspace.options.oneBasedIndex,renderer:this.workspace.options.renderer,rendererOverrides:this.workspace.options.rendererOverrides,move:{scrollbars:!0}}),this.workspace.horizontalLayout?(e.toolboxPosition=this.workspace.toolboxPosition===xe.TOP?xe.BOTTOM:xe.TOP,this.flyout=new(w(z.FLYOUTS_HORIZONTAL_TOOLBOX,this.workspace.options,!0))(e)):(e.toolboxPosition=this.workspace.toolboxPosition===xe.RIGHT?xe.LEFT:xe.RIGHT,this.flyout=new(w(z.FLYOUTS_VERTICAL_TOOLBOX,this.workspace.options,!0))(e)),this.workspace.addChangeListener(this.onDelete.bind(this)))}createDom(){this.svgGroup=L(D.G,{class:"blocklyTrash"});let e;const t=String(Math.random()).substring(2);e=L(D.CLIPPATH,{id:"blocklyTrashBodyClipPath"+t},this.svgGroup),L(D.RECT,{width:Gi,height:_l,y:Ki},e);const o=L(D.IMAGE,{width:Nt.width,x:-qh,height:Nt.height,y:-Zh,"clip-path":"url(#blocklyTrashBodyClipPath"+t+")"},this.svgGroup);return o.setAttributeNS(Kt,"xlink:href",this.workspace.options.pathToMedia+Nt.url),e=L(D.CLIPPATH,{id:"blocklyTrashLidClipPath"+t},this.svgGroup),L(D.RECT,{width:Gi,height:Ki},e),this.svgLid=L(D.IMAGE,{width:Nt.width,x:-qh,height:Nt.height,y:-Zh,"clip-path":"url(#blocklyTrashLidClipPath"+t+")"},this.svgGroup),this.svgLid.setAttributeNS(Kt,"xlink:href",this.workspace.options.pathToMedia+Nt.url),lt(this.svgGroup,"pointerdown",this,this.blockMouseDownWhenOpenable),lt(this.svgGroup,"pointerup",this,this.click),lt(o,"pointerover",this,this.mouseOver),lt(o,"pointerout",this,this.mouseOut),this.animateLid(),this.svgGroup}init(){0<this.workspace.options.maxTrashcanContents&&(Ao(this.flyout.createDom(D.SVG),this.workspace.getParentSvg()),this.flyout.init(this.workspace)),this.workspace.getComponentManager().addComponent({component:this,weight:at.ComponentWeight.TRASHCAN_WEIGHT,capabilities:[at.Capability.AUTOHIDEABLE,at.Capability.DELETE_AREA,at.Capability.DRAG_TARGET,at.Capability.POSITIONABLE]}),this.initialized=!0,this.setLidOpen(!1)}dispose(){this.workspace.getComponentManager().removeComponent("trashcan"),this.svgGroup&&Ge(this.svgGroup),this.lidTask&&clearTimeout(this.lidTask)}hasContents(){return!!this.contents.length}contentsIsOpen(){return!!this.flyout&&this.flyout.isVisible()}openFlyout(){if(!this.contentsIsOpen()){var e=this.contents.map(function(o){return JSON.parse(o)}),t=this.workspace.getParentSvg().style;t.cursor="wait",setTimeout(()=>{let o;(o=this.flyout)==null||o.show(e),t.cursor="";let n;(n=this.workspace.scrollbar)==null||n.setVisible(!1)},10),this.fireUiEvent(!0)}}closeFlyout(){if(this.contentsIsOpen()){var e;(e=this.flyout)==null||e.hide();var t;(t=this.workspace.scrollbar)==null||t.setVisible(!0),this.fireUiEvent(!1),this.workspace.recordDragTargets()}}autoHide(e){!e&&this.flyout&&this.closeFlyout()}emptyContents(){this.hasContents()&&(this.contents.length=0,this.setMinOpenness(0),this.closeFlyout())}position(e,t){if(this.initialized){var o=ea(this.workspace,e);e=Qr(o,new Le(Gi,_l+Ki),cT,rv,e,this.workspace),t=ta(e,rv,o.vertical===Qs.TOP?bo.DOWN:bo.UP,t),this.top=t.top,this.left=t.left;var n;(n=this.svgGroup)==null||n.setAttribute("transform","translate("+this.left+","+this.top+")");var c;(c=this.flyout)==null||c.position()}}getBoundingRectangle(){return new Je(this.top,this.top+_l+Ki,this.left,this.left+Gi)}getClientRect(){if(!this.svgGroup)return null;var e=this.svgGroup.getBoundingClientRect();const t=e.top+Zh-wl;return e=e.left+qh-wl,new Je(t,t+Ki+_l+2*wl,e,e+Gi+2*wl)}onDragOver(e){this.setLidOpen(this.wouldDelete_)}onDragExit(e){this.setLidOpen(!1)}onDrop(e){setTimeout(this.setLidOpen.bind(this,!1),100)}setLidOpen(e){this.isLidOpen!==e&&(this.lidTask&&clearTimeout(this.lidTask),this.isLidOpen=e,this.animateLid())}animateLid(){const e=hT;var t=1/(e+1);this.lidOpen+=this.isLidOpen?t:-t,this.lidOpen=Math.min(Math.max(this.lidOpen,this.minOpenness),1),this.setLidAngle(this.lidOpen*lv),t=av+this.lidOpen*(pT-av),this.svgGroup&&(this.svgGroup.style.opacity=`${t}`),this.lidOpen>this.minOpenness&&1>this.lidOpen&&(this.lidTask=setTimeout(this.animateLid.bind(this),dT/e))}setLidAngle(e){const t=this.workspace.toolboxPosition===xe.RIGHT||this.workspace.horizontalLayout&&this.workspace.RTL;let o;(o=this.svgLid)==null||o.setAttribute("transform","rotate("+(t?-e:e)+","+(t?4:Gi-4)+","+(Ki-2)+")")}setMinOpenness(e){this.minOpenness=e,this.isLidOpen||this.setLidAngle(e*lv)}closeLid(){this.setLidOpen(!1)}click(){this.hasContents()&&!this.workspace.isDragging()&&this.openFlyout()}fireUiEvent(e){e=new(Y(M.TRASHCAN_OPEN))(e,this.workspace.id),U(e)}blockMouseDownWhenOpenable(e){!this.contentsIsOpen()&&this.hasContents()&&e.stopPropagation()}mouseOver(){this.hasContents()&&this.setLidOpen(!0)}mouseOut(){this.setLidOpen(!1)}onDelete(e){if(!(0>=this.workspace.options.maxTrashcanContents||!I(e)||e.wasShadow)){if(!e.oldJson)throw Error("Encountered a delete event without proper oldJson");if(e=JSON.stringify(this.cleanBlockJson(e.oldJson)),!this.contents.includes(e)){for(this.contents.unshift(e);this.contents.length>this.workspace.options.maxTrashcanContents;)this.contents.pop();this.setMinOpenness(uT)}}}cleanBlockJson(e){function t(o){if(o){if(delete o.id,delete o.x,delete o.y,delete o.enabled,delete o.disabledReasons,o.icons&&o.icons.comment){var n=o.icons.comment;delete n.height,delete n.width,delete n.pinned}n=o.inputs;for(var c in n){var h=n[c];const $=h.block;h=h.shadow,$&&t($),h&&t(h)}o.next&&(c=o.next,o=c.block,c=c.shadow,o&&t(o),c&&t(c))}}return e=JSON.parse(JSON.stringify(e)),t(e),Object.assign({},{kind:"BLOCK"},e)}},Gi=47,_l=44,Ki=16,rv=20,cT=20,wl=10,qh=0,Zh=32,uT=.1,dT=80,hT=4,av=.4,pT=.8,lv=45,He=class{constructor(){this.shortcuts=new Map,this.keyMap=new Map,this.reset()}reset(){this.shortcuts.clear(),this.keyMap.clear()}register(e,t){if(this.shortcuts.get(e.name)&&!t)throw Error(`Shortcut named "${e.name}" already exists.`);if(this.shortcuts.set(e.name,e),t=e.keyCodes,t!=null&&t.length)for(const o of t)this.addKeyMapping(o,e.name,!!e.allowCollision)}unregister(e){return this.shortcuts.get(e)?(this.removeAllKeyMappings(e),this.shortcuts.delete(e),!0):(console.warn(`Keyboard shortcut named "${e}" not found.`),!1)}addKeyMapping(e,t,o){e=`${e}`;const n=this.keyMap.get(e);if(n&&!o)throw Error(`Shortcut named "${t}" collides with shortcuts "${n}"`);n&&o?n.unshift(t):this.keyMap.set(e,[t])}removeKeyMapping(e,t,o){const n=this.keyMap.get(e);if(!n)return o||console.warn(`No keyboard shortcut named "${t}" registered with key code "${e}"`),!1;const c=n.indexOf(t);return-1<c?(n.splice(c,1),n.length===0&&this.keyMap.delete(e),!0):(o||console.warn(`No keyboard shortcut named "${t}" registered with key code "${e}"`),!1)}removeAllKeyMappings(e){for(const t of this.keyMap.keys())this.removeKeyMapping(t,e,!0)}setKeyMap(e){this.keyMap.clear();for(const t in e)this.keyMap.set(t,e[t])}getKeyMap(){const e=Object.create(null);for(const[t,o]of this.keyMap)e[t]=o;return e}getRegistry(){const e=Object.create(null);for(const[t,o]of this.shortcuts)e[t]=o;return Ks(Object.create(null),e)}onKeyDown(e,t){var o=this.serializeKeyEvent(t);if(o=this.getShortcutNamesByKeyCode(o),!o)return!1;for(const n of o){if(o=this.shortcuts.get(n),!o||o.preconditionFn&&!o.preconditionFn(e))continue;let c,h;if((h=(c=o).callback)!=null&&h.call(c,e,t,o))return!0}return!1}getShortcutNamesByKeyCode(e){return this.keyMap.get(e)||[]}getKeyCodesByShortcutName(e){const t=[];for(const[o,n]of this.keyMap)-1<n.indexOf(e)&&t.push(o);return t}serializeKeyEvent(e){let t="";for(const o in He.modifierKeys)e.getModifierState(o)&&(t!==""&&(t+="+"),t+=o);return t!==""&&e.keyCode?t+="+"+e.keyCode:e.keyCode&&(t=String(e.keyCode)),t}checkModifiers(e){for(const t of e)if(!(t in He.modifierKeys))throw Error(t+" is not a valid modifier key.")}createSerializedKey(e,t){let o="";if(t){this.checkModifiers(t);for(const n in He.modifierKeys)t.includes(He.modifierKeys[n])&&(o!==""&&(o+="+"),o+=n)}return o!==""&&e?o+="+"+e:e&&(o=`${e}`),o}};He.registry=new He,(function(e){e=e.modifierKeys||(e.modifierKeys={}),e[e.Shift=16]="Shift",e[e.Control=17]="Control",e[e.Alt=18]="Alt",e[e.Meta=91]="Meta"})(He||(He={}));var Qh=null,ep=null,gT={duplicateInternal:c$,copyInternal:l$},ur={};ur.BlockPaster=lr,ur.TEST_ONLY=gT,ur.paste=go,ur.registry=ih;var Ms;(function(e){e.ESCAPE="escape",e.DELETE="delete",e.COPY="copy",e.CUT="cut",e.PASTE="paste",e.UNDO="undo",e.REDO="redo"})(Ms||(Ms={}));var To=null,ko=null,Yi=null;yd();var Ns={};Ns.names=Ms,Ns.registerCopy=md,Ns.registerCut=fd,Ns.registerDefaultShortcuts=yd,Ns.registerDelete=gd,Ns.registerEscape=pd,Ns.registerPaste=$d,Ns.registerRedo=vd,Ns.registerUndo=bd;var mT=class{constructor(e,t){this.procedureModelClass=e,this.parameterModelClass=t,this.priority=nb}save(e){return e=e.getProcedureMap().getProcedures().map(t=>_d(t)),e.length?e:null}load(e,t){const o=t.getProcedureMap();for(const n of e)o.add(wd(this.procedureModelClass,this.parameterModelClass,n,t))}clear(e){e.getProcedureMap().clear()}},Cl={};Cl.ProcedureSerializer=mT,Cl.loadProcedure=wd,Cl.saveProcedure=_d;var cv=class{constructor(){this.priority=ib}save(e){const t=[];for(const o of e.getAllVariables())e={name:o.name,id:o.getId()},o.type&&(e.type=o.type),t.push(e);return t.length?t:null}load(e,t){for(const o of e)t.createVariable(o.name,o.type,o.id)}clear(e){e.getVariableMap().clear()}};_n("variables",new cv);var uv={};uv.VariableSerializer=cv;var tp={};tp.load=d$,tp.save=u$;var fT={blocks:Xn,exceptions:Ko,priorities:VC,procedures:Cl,registry:oh,variables:uv,workspaceComments:Wa,workspaces:tp},sp=class{constructor(e,t,o,n,c){this.workspace=e,this.oldHostMetrics=this.corner_=this.vScroll=this.hScroll=null,t=t===void 0?!0:t,o=o===void 0?!0:o;const h=t&&o;t&&(this.hScroll=new gt(e,!0,h,n,c)),o&&(this.vScroll=new gt(e,!1,h,n,c)),h&&(this.corner_=L(D.RECT,{height:gt.scrollbarThickness,width:gt.scrollbarThickness,class:"blocklyScrollbarBackground"}),Ao(this.corner_,e.getBubbleCanvas()))}dispose(){Ge(this.corner_),this.oldHostMetrics=this.corner_=null,this.hScroll&&(this.hScroll.dispose(),this.hScroll=null),this.vScroll&&(this.vScroll.dispose(),this.vScroll=null)}resize(){const e=this.workspace.getMetrics();if(e){var t=!1,o=!1;if(this.oldHostMetrics&&this.oldHostMetrics.viewWidth===e.viewWidth&&this.oldHostMetrics.viewHeight===e.viewHeight&&this.oldHostMetrics.absoluteTop===e.absoluteTop&&this.oldHostMetrics.absoluteLeft===e.absoluteLeft?(this.oldHostMetrics&&this.oldHostMetrics.scrollWidth===e.scrollWidth&&this.oldHostMetrics.viewLeft===e.viewLeft&&this.oldHostMetrics.scrollLeft===e.scrollLeft||(t=!0),this.oldHostMetrics&&this.oldHostMetrics.scrollHeight===e.scrollHeight&&this.oldHostMetrics.viewTop===e.viewTop&&this.oldHostMetrics.scrollTop===e.scrollTop||(o=!0)):o=t=!0,t||o){try{i.disable$$module$build$src$core$events$utils(),this.hScroll&&t&&this.hScroll.resize(e),this.vScroll&&o&&this.vScroll.resize(e)}finally{i.enable$$module$build$src$core$events$utils()}this.workspace.maybeFireViewportChangeEvent()}if(this.hScroll&&this.vScroll){if(!this.oldHostMetrics||this.oldHostMetrics.viewWidth!==e.viewWidth||this.oldHostMetrics.absoluteLeft!==e.absoluteLeft){let n;(n=this.corner_)==null||n.setAttribute("x",String(this.vScroll.position.x))}if(!this.oldHostMetrics||this.oldHostMetrics.viewHeight!==e.viewHeight||this.oldHostMetrics.absoluteTop!==e.absoluteTop){let n;(n=this.corner_)==null||n.setAttribute("y",String(this.hScroll.position.y))}}this.oldHostMetrics=e}}canScrollHorizontally(){return!!this.hScroll}canScrollVertically(){return!!this.vScroll}setOrigin(e,t){this.hScroll&&this.hScroll.setOrigin(e,t),this.vScroll&&this.vScroll.setOrigin(e,t)}set(e,t,o){this.hScroll&&this.hScroll.set(e,!1),this.vScroll&&this.vScroll.set(t,!1),(o||o===void 0)&&(e={},this.hScroll&&(e.x=this.hScroll.getRatio_()),this.vScroll&&(e.y=this.vScroll.getRatio_()),this.workspace.setMetrics(e))}setX(e){this.hScroll&&this.hScroll.set(e,!0)}setY(e){this.vScroll&&this.vScroll.set(e,!0)}setContainerVisible(e){this.hScroll&&this.hScroll.setContainerVisible(e),this.vScroll&&this.vScroll.setContainerVisible(e)}isVisible(){let e=!1;return this.hScroll&&(e=this.hScroll.isVisible()),this.vScroll&&(e=e||this.vScroll.isVisible()),e}setVisible(e){this.hScroll&&this.hScroll.setVisibleInternal(e),this.vScroll&&this.vScroll.setVisibleInternal(e)}resizeContent(e){this.hScroll&&this.hScroll.resizeContentHorizontal(e),this.vScroll&&this.vScroll.resizeContentVertical(e)}resizeView(e){this.hScroll&&this.hScroll.resizeViewHorizontal(e),this.vScroll&&this.vScroll.resizeViewVertical(e)}},op=class{constructor(e){this.workspace_=e}getDimensionsPx_(e){let t=0,o=0;return e&&(t=e.getWidth(),o=e.getHeight()),new Le(t,o)}getFlyoutMetrics(e){return e=this.getDimensionsPx_(this.workspace_.getFlyout(e)),{width:e.width,height:e.height,position:this.workspace_.toolboxPosition}}getToolboxMetrics(){const e=this.getDimensionsPx_(this.workspace_.getToolbox());return{width:e.width,height:e.height,position:this.workspace_.toolboxPosition}}getSvgMetrics(){return this.workspace_.getCachedParentSvgSize()}getAbsoluteMetrics(){let e=0,t=0;const o=this.getToolboxMetrics(),n=this.getFlyoutMetrics(),c=!!this.workspace_.getToolbox();var h;const $=!((h=this.workspace_.getFlyout())!=null&&h.autoClose);h=c?o.position:n.position;const T=h===xe.TOP;return h===xe.LEFT&&(c&&(e+=o.width),$&&(e+=n.width)),T&&(c&&(t+=o.height),$&&(t+=n.height)),{top:t,left:e}}getViewMetrics(e){e=e?this.workspace_.scale:1;const t=this.getSvgMetrics(),o=this.getToolboxMetrics(),n=this.getFlyoutMetrics(),c=!!this.workspace_.getToolbox();var h;const $=!((h=this.workspace_.getFlyout())!=null&&h.autoClose);h=c?o.position:n.position;const T=h===xe.LEFT||h===xe.RIGHT;return(h===xe.TOP||h===xe.BOTTOM)&&(c&&(t.height-=o.height),$&&(t.height-=n.height)),T&&(c&&(t.width-=o.width),$&&(t.width-=n.width)),{height:t.height/e,width:t.width/e,top:-this.workspace_.scrollY/e,left:-this.workspace_.scrollX/e}}getContentMetrics(e){e=e?1:this.workspace_.scale;const t=this.workspace_.getBlocksBoundingBox();return{height:(t.bottom-t.top)*e,width:(t.right-t.left)*e,top:t.top*e,left:t.left*e}}hasFixedEdges(){return!this.workspace_.isMovableHorizontally()||!this.workspace_.isMovableVertically()}getComputedFixedEdges_(e){if(!this.hasFixedEdges())return{};const t=this.workspace_.isMovableHorizontally(),o=this.workspace_.isMovableVertically();e=e||this.getViewMetrics(!1);const n={};return o||(n.top=e.top,n.bottom=e.top+e.height),t||(n.left=e.left,n.right=e.left+e.width),n}getPaddedContent_(e,t){const o=t.top+t.height,n=t.left+t.width,c=e.width;e=e.height;const h=c/2,$=e/2;return{top:Math.min(t.top-$,o-e),bottom:Math.max(o+$,t.top+e),left:Math.min(t.left-h,n-c),right:Math.max(n+h,t.left+c)}}getScrollMetrics(e,t,o){e=e?this.workspace_.scale:1,t=t||this.getViewMetrics(!1);var n=o||this.getContentMetrics();o=this.getComputedFixedEdges_(t),t=this.getPaddedContent_(t,n),n=o.top!==void 0?o.top:t.top;const c=o.left!==void 0?o.left:t.left;return{top:n/e,left:c/e,width:((o.right!==void 0?o.right:t.right)-c)/e,height:((o.bottom!==void 0?o.bottom:t.bottom)-n)/e}}getUiMetrics(){return{viewMetrics:this.getViewMetrics(),absoluteMetrics:this.getAbsoluteMetrics(),toolboxMetrics:this.getToolboxMetrics()}}getMetrics(){const e=this.getToolboxMetrics(),t=this.getFlyoutMetrics(!0),o=this.getSvgMetrics(),n=this.getAbsoluteMetrics(),c=this.getViewMetrics(),h=this.getContentMetrics(),$=this.getScrollMetrics(!1,c,h);return{contentHeight:h.height,contentWidth:h.width,contentTop:h.top,contentLeft:h.left,scrollHeight:$.height,scrollWidth:$.width,scrollTop:$.top,scrollLeft:$.left,viewHeight:c.height,viewWidth:c.width,viewTop:c.top,viewLeft:c.left,absoluteTop:n.top,absoluteLeft:n.left,svgHeight:o.height,svgWidth:o.width,toolboxWidth:e.width,toolboxHeight:e.height,toolboxPosition:e.position,flyoutWidth:t.width,flyoutHeight:t.height}}};r(z.METRICS_MANAGER,Ds,op),"Blockly"in globalThis||(globalThis.Blockly={Msg:gb});var dv=class extends ml{constructor(){super(),this.GRID_UNIT=4,this.CURSOR_COLOUR="#ffa200",this.CURSOR_RADIUS=5,this.JAGGED_TEETH_WIDTH=this.JAGGED_TEETH_HEIGHT=0,this.START_HAT_HEIGHT=22,this.START_HAT_WIDTH=96,this.SHAPES={HEXAGONAL:1,ROUND:2,SQUARE:3,PUZZLE:4,NOTCH:5},this.SHAPE_IN_SHAPE_PADDING={1:{0:5*this.GRID_UNIT,1:2*this.GRID_UNIT,2:5*this.GRID_UNIT,3:5*this.GRID_UNIT},2:{0:3*this.GRID_UNIT,1:3*this.GRID_UNIT,2:1*this.GRID_UNIT,3:2*this.GRID_UNIT},3:{0:2*this.GRID_UNIT,1:2*this.GRID_UNIT,2:2*this.GRID_UNIT,3:2*this.GRID_UNIT}},this.FULL_BLOCK_FIELDS=!0,this.FIELD_TEXT_FONTWEIGHT="bold",this.FIELD_TEXT_FONTFAMILY='"Helvetica Neue", "Segoe UI", Helvetica, sans-serif',this.FIELD_COLOUR_FULL_BLOCK=this.FIELD_TEXTINPUT_BOX_SHADOW=this.FIELD_DROPDOWN_SVG_ARROW=this.FIELD_DROPDOWN_COLOURED_DIV=this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW=!0,this.SELECTED_GLOW_COLOUR="#fff200",this.SELECTED_GLOW_SIZE=.5,this.REPLACEMENT_GLOW_COLOUR="#fff200",this.REPLACEMENT_GLOW_SIZE=2,this.selectedGlowFilterId="",this.selectedGlowFilter=null,this.replacementGlowFilterId="",this.SQUARED=this.ROUNDED=this.HEXAGONAL=this.replacementGlowFilter=null,this.SMALL_PADDING=this.GRID_UNIT,this.MEDIUM_PADDING=2*this.GRID_UNIT,this.MEDIUM_LARGE_PADDING=3*this.GRID_UNIT,this.LARGE_PADDING=4*this.GRID_UNIT,this.CORNER_RADIUS=1*this.GRID_UNIT,this.NOTCH_WIDTH=9*this.GRID_UNIT,this.NOTCH_HEIGHT=2*this.GRID_UNIT,this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT=3*this.GRID_UNIT,this.MIN_BLOCK_WIDTH=2*this.GRID_UNIT,this.MIN_BLOCK_HEIGHT=12*this.GRID_UNIT,this.EMPTY_STATEMENT_INPUT_HEIGHT=6*this.GRID_UNIT,this.TOP_ROW_MIN_HEIGHT=this.CORNER_RADIUS,this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING,this.BOTTOM_ROW_MIN_HEIGHT=this.CORNER_RADIUS,this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT=6*this.GRID_UNIT,this.STATEMENT_BOTTOM_SPACER=-this.NOTCH_HEIGHT,this.STATEMENT_INPUT_SPACER_MIN_WIDTH=40*this.GRID_UNIT,this.STATEMENT_INPUT_PADDING_LEFT=4*this.GRID_UNIT,this.EMPTY_INLINE_INPUT_PADDING=4*this.GRID_UNIT,this.EMPTY_INLINE_INPUT_HEIGHT=8*this.GRID_UNIT,this.DUMMY_INPUT_MIN_HEIGHT=8*this.GRID_UNIT,this.DUMMY_INPUT_SHADOW_MIN_HEIGHT=6*this.GRID_UNIT,this.CURSOR_WS_WIDTH=20*this.GRID_UNIT,this.FIELD_TEXT_FONTSIZE=3*this.GRID_UNIT,this.FIELD_BORDER_RECT_RADIUS=this.CORNER_RADIUS,this.FIELD_BORDER_RECT_X_PADDING=2*this.GRID_UNIT,this.FIELD_BORDER_RECT_Y_PADDING=1.625*this.GRID_UNIT,this.FIELD_BORDER_RECT_HEIGHT=8*this.GRID_UNIT,this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=8*this.GRID_UNIT,this.FIELD_DROPDOWN_SVG_ARROW_PADDING=this.FIELD_BORDER_RECT_X_PADDING,this.FIELD_COLOUR_DEFAULT_WIDTH=6*this.GRID_UNIT,this.FIELD_COLOUR_DEFAULT_HEIGHT=8*this.GRID_UNIT,this.FIELD_CHECKBOX_X_OFFSET=1*this.GRID_UNIT,this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH=12*this.GRID_UNIT}setFontConstants_(e){super.setFontConstants_(e),this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT=this.FIELD_TEXT_HEIGHT+2*this.FIELD_BORDER_RECT_Y_PADDING}init(){super.init(),this.HEXAGONAL=this.makeHexagonal(),this.ROUNDED=this.makeRounded(),this.SQUARED=this.makeSquared(),this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT+this.INSIDE_CORNERS.rightWidth}setDynamicProperties_(e){super.setDynamicProperties_(e),this.SELECTED_GLOW_COLOUR=e.getComponentStyle("selectedGlowColour")||this.SELECTED_GLOW_COLOUR;const t=Number(e.getComponentStyle("selectedGlowSize"));this.SELECTED_GLOW_SIZE=t&&!isNaN(t)?t:this.SELECTED_GLOW_SIZE,this.REPLACEMENT_GLOW_COLOUR=e.getComponentStyle("replacementGlowColour")||this.REPLACEMENT_GLOW_COLOUR,this.REPLACEMENT_GLOW_SIZE=(e=Number(e.getComponentStyle("replacementGlowSize")))&&!isNaN(e)?e:this.REPLACEMENT_GLOW_SIZE}dispose(){super.dispose(),this.selectedGlowFilter&&Ge(this.selectedGlowFilter),this.replacementGlowFilter&&Ge(this.replacementGlowFilter)}makeStartHat(){const e=this.START_HAT_HEIGHT,t=this.START_HAT_WIDTH,o=zt("c",[he(25,-e),he(71,-e),he(t,0)]);return{height:e,width:t,path:o}}makeHexagonal(){function e(o,n,c){var h=o/2;return h=h>t?t:h,c=c?-1:1,o=(n?-1:1)*o/2,xs(-c*h,o)+xs(c*h,o)}const t=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH;return{type:this.SHAPES.HEXAGONAL,isDynamic:!0,width(o){return o/=2,o>t?t:o},height(o){return o},connectionOffsetY(o){return o/2},connectionOffsetX(o){return-o},pathDown(o){return e(o,!1,!1)},pathUp(o){return e(o,!0,!1)},pathRightDown(o){return e(o,!1,!0)},pathRightUp(o){return e(o,!1,!0)}}}makeRounded(){function e(n,c,h){const $=n>o?n-o:0;n=(n>o?o:n)/2;const T=h===c?"0":"1";return pt("a","0 0,"+T,n,he((h?1:-1)*n,(c?-1:1)*n))+ae("v",(c?-1:1)*$)+pt("a","0 0,"+T,n,he((h?-1:1)*n,(c?-1:1)*n))}const t=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,o=2*t;return{type:this.SHAPES.ROUND,isDynamic:!0,width(n){return n/=2,n>t?t:n},height(n){return n},connectionOffsetY(n){return n/2},connectionOffsetX(n){return-n},pathDown(n){return e(n,!1,!1)},pathUp(n){return e(n,!0,!1)},pathRightDown(n){return e(n,!1,!0)},pathRightUp(n){return e(n,!1,!0)}}}makeSquared(){function e(o,n,c){o-=2*t;const h=c===n?"0":"1";return pt("a","0 0,"+h,t,he((c?1:-1)*t,(n?-1:1)*t))+ae("v",(n?-1:1)*o)+pt("a","0 0,"+h,t,he((c?-1:1)*t,(n?-1:1)*t))}const t=this.CORNER_RADIUS;return{type:this.SHAPES.SQUARE,isDynamic:!0,width(o){return t},height(o){return o},connectionOffsetY(o){return o/2},connectionOffsetX(o){return-o},pathDown(o){return e(o,!1,!1)},pathUp(o){return e(o,!0,!1)},pathRightDown(o){return e(o,!1,!0)},pathRightUp(o){return e(o,!1,!0)}}}shapeFor(e){let t=e.getCheck();switch(!t&&e.targetConnection&&(t=e.targetConnection.getCheck()),e.type){case ne.INPUT_VALUE:case ne.OUTPUT_VALUE:if(e=e.getSourceBlock().getOutputShape(),e!==null)switch(e){case this.SHAPES.HEXAGONAL:return this.HEXAGONAL;case this.SHAPES.ROUND:return this.ROUNDED;case this.SHAPES.SQUARE:return this.SQUARED}return t&&t.includes("Boolean")?this.HEXAGONAL:t&&t.includes("Number")?this.ROUNDED:(t&&t.includes("String"),this.ROUNDED);case ne.PREVIOUS_STATEMENT:case ne.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown type")}}makeNotch(){function e(oe){return zt("c",[he(oe*c/2,0),he(oe*c*3/4,$/2),he(oe*c,$)])+Si([he(oe*c,h)])+zt("c",[he(oe*c/4,$/2),he(oe*c/2,$),he(oe*c,$)])+ae("h",oe*n)+zt("c",[he(oe*c/2,0),he(oe*c*3/4,-($/2)),he(oe*c,-$)])+Si([he(oe*c,-h)])+zt("c",[he(oe*c/4,-($/2)),he(oe*c/2,-$),he(oe*c,-$)])}const t=this.NOTCH_WIDTH,o=this.NOTCH_HEIGHT,n=t/3,c=n/3,h=o/2,$=h/2,T=e(1),B=e(-1);return{type:this.SHAPES.NOTCH,width:t,height:o,pathLeft:T,pathRight:B}}makeInsideCorners(){const e=this.CORNER_RADIUS,t=pt("a","0 0,0",e,he(-e,e)),o=pt("a","0 0,1",e,he(-e,e)),n=pt("a","0 0,0",e,he(e,e)),c=pt("a","0 0,1",e,he(e,e));return{width:e,height:e,pathTop:t,pathBottom:n,rightWidth:e,rightHeight:e,pathTopRight:o,pathBottomRight:c}}generateSecondaryColour_(e){return Lo("#000",e,.15)||e}generateTertiaryColour_(e){return Lo("#000",e,.25)||e}createDom(e,t,o){super.createDom(e,t,o),e=L(D.DEFS,{},e),t=L(D.FILTER,{id:"blocklySelectedGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),L(D.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.SELECTED_GLOW_SIZE},t),o=L(D.FECOMPONENTTRANSFER,{result:"outBlur"},t),L(D.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},o),L(D.FEFLOOD,{"flood-color":this.SELECTED_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},t),L(D.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},t),this.selectedGlowFilterId=t.id,this.selectedGlowFilter=t,e=L(D.FILTER,{id:"blocklyReplacementGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),L(D.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.REPLACEMENT_GLOW_SIZE},e),t=L(D.FECOMPONENTTRANSFER,{result:"outBlur"},e),L(D.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},t),L(D.FEFLOOD,{"flood-color":this.REPLACEMENT_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},e),L(D.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},e),L(D.FECOMPOSITE,{in:"SourceGraphic",in2:"outGlow",operator:"over"},e),this.replacementGlowFilterId=e.id,this.replacementGlowFilter=e}getCSS_(e){return[`${e} .blocklyText,`,`${e} .blocklyFlyoutLabelText {`,`font: ${this.FIELD_TEXT_FONTWEIGHT} ${this.FIELD_TEXT_FONTSIZE}pt ${this.FIELD_TEXT_FONTFAMILY};`,"}",`${e} .blocklyTextInputBubble textarea {`,"font-weight: normal;","}",`${e} .blocklyText {`,"fill: #fff;","}",`${e} .blocklyNonEditableText>rect:not(.blocklyDropdownRect),`,`${e} .blocklyEditableText>rect:not(.blocklyDropdownRect) {`,`fill: ${this.FIELD_BORDER_RECT_COLOUR};`,"}",`${e} .blocklyNonEditableText>text,`,`${e} .blocklyEditableText>text,`,`${e} .blocklyNonEditableText>g>text,`,`${e} .blocklyEditableText>g>text {`,"fill: #575E75;","}",`${e} .blocklyFlyoutLabelText {`,"fill: #575E75;","}",`${e} .blocklyText.blocklyBubbleText {`,"fill: #575E75;","}",`${e} .blocklyDraggable:not(.blocklyDisabled)`," .blocklyEditableText:not(.editing):hover>rect,",`${e} .blocklyDraggable:not(.blocklyDisabled)`," .blocklyEditableText:not(.editing):hover>.blocklyPath {","stroke: #fff;","stroke-width: 2;","}",`${e} .blocklyHtmlInput {`,`font-family: ${this.FIELD_TEXT_FONTFAMILY};`,`font-weight: ${this.FIELD_TEXT_FONTWEIGHT};`,"color: #575E75;","}",`${e} .blocklyDropdownText {`,"fill: #fff !important;","}",`${e}.blocklyWidgetDiv .blocklyMenuItem,`,`${e}.blocklyDropDownDiv .blocklyMenuItem {`,`font-family: ${this.FIELD_TEXT_FONTFAMILY};`,"}",`${e}.blocklyDropDownDiv .blocklyMenuItemContent {`,"color: #fff;","}",`${e} .blocklyHighlightedConnectionPath {`,`stroke: ${this.SELECTED_GLOW_COLOUR};`,"}",`${e} .blocklyDisabled > .blocklyOutlinePath {`,`fill: url(#blocklyDisabledPattern${this.randomIdentifier})`,"}",`${e} .blocklyInsertionMarker>.blocklyPath {`,`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,"stroke: none;","}"]}},hv=class extends fl{constructor(e,t){super(e,t)}draw(){const e=this.block_.pathObject;e.beginDrawing(),this.drawOutline_(),this.drawInternals_(),this.updateConnectionHighlights(),e.setPath(this.outlinePath_+`
918
+ `+this.inlinePath_),this.info_.RTL&&e.flipRTL(),this.recordSizeOnBlock_(),this.info_.outputConnection&&(e.outputShapeType=this.info_.outputConnection.shape.type),e.endDrawing()}drawOutline_(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape&&!this.info_.hasStatementInput&&!this.info_.bottomRow.hasNextConnection?(this.drawFlatTop_(),this.drawRightDynamicConnection_(),this.drawFlatBottom_(),this.drawLeftDynamicConnection_()):super.drawOutline_()}drawLeft_(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape?this.drawLeftDynamicConnection_():super.drawLeft_()}drawRightSideRow_(e){if(!(0>=e.height)){if(E.isSpacer(e)){const n=e.precedesStatement;var t=e.followsStatement;if(n||t){const c=this.constants_.INSIDE_CORNERS;var o=c.rightHeight;o=e.height-(n?o:0),t=t?c.pathBottomRight:"",e=0<o?ae("V",e.yPos+o):"",this.outlinePath_+=t+e+(n?c.pathTopRight:"");return}}this.outlinePath_+=ae("V",e.yPos+e.height)}}drawRightDynamicConnection_(){if(!this.info_.outputConnection)throw Error("Cannot draw the output connection of a block that doesn't have one");this.outlinePath_+=this.info_.outputConnection.shape.pathRightDown(this.info_.outputConnection.height)}drawLeftDynamicConnection_(){if(!this.info_.outputConnection)throw Error("Cannot draw the output connection of a block that doesn't have one");this.positionOutputConnection_(),this.outlinePath_+=this.info_.outputConnection.shape.pathUp(this.info_.outputConnection.height),this.outlinePath_+="z"}drawFlatTop_(){const e=this.info_.topRow;this.positionPreviousConnection_(),this.outlinePath_+=rt(e.xPos,this.info_.startY),this.outlinePath_+=ae("h",e.width)}drawFlatBottom_(){const e=this.info_.bottomRow;this.positionNextConnection_(),this.outlinePath_+=ae("V",e.baseline),this.outlinePath_+=ae("h",-e.width)}drawInlineInput_(e){this.positionInlineInputConnection_(e);const t=e.input.name;e.connectedBlock||this.info_.isInsertionMarker||(e=vt(e.xPos+e.connectionWidth,e.centerline-e.height/2)+this.getInlineInputPath(e),this.block_.pathObject.setOutlinePath(t,e))}getInlineInputPath(e){const t=e.width-2*e.connectionWidth,o=e.height;return ae("h",t)+e.shape.pathRightDown(o)+ae("h",-t)+e.shape.pathUp(o)+"z"}drawStatementInput_(e){var t=e.getLastInput();const o=t.xPos+t.notchOffset+t.shape.width,n=this.constants_.INSIDE_CORNERS,c=t.shape.pathRight+ae("h",-(t.notchOffset-n.width))+n.pathTop,h=e.height-2*n.height;t=n.pathBottom+ae("h",t.notchOffset-n.width)+(t.connectedBottomNextConnection?"":t.shape.pathLeft),this.outlinePath_+=ae("H",o)+c+ae("v",h)+t+ae("H",e.xPos+e.width),this.positionStatementInputConnection_(e)}drawConnectionHighlightPath(e){const t=e.connectionModel;if(t.type===ne.NEXT_STATEMENT||t.type===ne.PREVIOUS_STATEMENT||t.type===ne.OUTPUT_VALUE&&!e.isDynamicShape)super.drawConnectionHighlightPath(e);else{e=t.type===ne.INPUT_VALUE?vt(e.connectionWidth,-e.height/2)+this.getInlineInputPath(e):vt(e.width,-e.height/2)+e.shape.pathDown(e.height);var o=t.getSourceBlock(),n,c;(c=(n=o.pathObject).addConnectionHighlight)==null||c.call(n,t,e,t.getOffsetInBlock(),o.RTL)}}},ii=class extends Ze{constructor(e,t,o,n,c,h,$){if(super(Ze.SKIP_SETUP),this.imageElement=this.clickHandler=null,this.flipRtl=this.isDirty_=this.EDITABLE=!1,this.altText="",o=Number(ht(o)),t=Number(ht(t)),isNaN(o)||isNaN(t))throw Error("Height and width values of an image field must cast to numbers.");if(0>=o||0>=t)throw Error("Height and width values of an image field must be greater than 0.");this.size_=new Le(t,o+ii.Y_PADDING),this.imageHeight=o,typeof c=="function"&&(this.clickHandler=c),e!==Ze.SKIP_SETUP&&($?this.configure_($):(this.flipRtl=!!h,this.altText=ht(n)||""),this.setValue(ht(e)))}configure_(e){super.configure_(e),e.flipRtl&&(this.flipRtl=e.flipRtl),e.alt&&(this.altText=ht(e.alt))}initView(){this.imageElement=L(D.IMAGE,{height:this.imageHeight+"px",width:this.size_.width+"px",alt:this.altText},this.fieldGroup_),this.imageElement.setAttributeNS(Kt,"xlink:href",this.value_),this.clickHandler&&(this.imageElement.style.cursor="pointer")}updateSize_(){}doClassValidation_(e){return typeof e!="string"?null:e}doValueUpdate_(e){this.value_=e,this.imageElement&&this.imageElement.setAttributeNS(Kt,"xlink:href",this.value_)}getFlipRtl(){return this.flipRtl}setAlt(e){e!==this.altText&&(this.altText=e||"",this.imageElement&&this.imageElement.setAttribute("alt",this.altText))}showEditor_(){this.clickHandler&&this.clickHandler(this)}setOnClickHandler(e){this.clickHandler=e}getText_(){return this.altText}static fromJson(e){if(!e.src||!e.width||!e.height)throw Error("src, width, and height values for an image field arerequired. The width and height must be non-zero.");return new this(e.src,e.width,e.height,void 0,void 0,void 0,e)}};ii.Y_PADDING=1,Is("field_image",ii),ii.prototype.DEFAULT_VALUE="";var Tl=class extends Ze{constructor(e,t,o){super(Ze.SKIP_SETUP),this.spellcheck_=!0,this.htmlInput_=null,this.isTextValid_=this.isBeingEdited_=!1,this.onKeyInputWrapper=this.onKeyDownWrapper=this.valueWhenEditorWasOpened_=null,this.fullBlockClickTarget_=!1,this.workspace_=null,this.SERIALIZABLE=!0,this.CURSOR="text",e!==Ze.SKIP_SETUP&&(o&&this.configure_(o),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),e.spellcheck!==void 0&&(this.spellcheck_=e.spellcheck)}initView(){if(!this.getSourceBlock())throw new mt;super.initView(),this.isFullBlockField()&&(this.clickTarget_=this.sourceBlock_.getSvgRoot())}isFullBlockField(){const e=this.getSourceBlock();if(!e)throw new mt;let t;return this.fullBlockClickTarget_=!((t=this.getConstants())==null||!t.FULL_BLOCK_FIELDS)&&e.isSimpleReporter()}doValueInvalid_(e,t=!0){this.isBeingEdited_&&(this.isDirty_=!0,this.isTextValid_=!1,e=this.value_,this.value_=this.valueWhenEditorWasOpened_,this.sourceBlock_&&J()&&this.value_!==e&&t&&U(new(Y(M.BLOCK_CHANGE))(this.sourceBlock_,"field",this.name||null,e,this.value_)))}doValueUpdate_(e){this.isTextValid_=this.isDirty_=!0,this.value_=e}applyColour(){const e=this.getSourceBlock();if(!e)throw new mt;this.getConstants().FULL_BLOCK_FIELDS&&this.fieldGroup_&&(!this.isFullBlockField()&&this.borderRect_?(this.borderRect_.style.display="block",this.borderRect_.setAttribute("stroke",e.getColourTertiary())):(this.borderRect_.style.display="none",e.pathObject.svgPath.setAttribute("fill",this.getConstants().FIELD_BORDER_RECT_COLOUR)))}getSize(){let e;return(e=this.getConstants())!=null&&e.FULL_BLOCK_FIELDS&&(this.render_(),this.isDirty_=!1),super.getSize()}onLocationChange(){this.isBeingEdited_&&this.resizeEditor_()}render_(){if(super.render_(),this.isBeingEdited_){var e=this.htmlInput_;this.isTextValid_?(st(e,"blocklyInvalidInput"),kt(e,yt.INVALID,!1)):(fe(e,"blocklyInvalidInput"),kt(e,yt.INVALID,!0))}if(e=this.getSourceBlock(),!e)throw new mt;this.getConstants().FULL_BLOCK_FIELDS&&e.applyColour()}setSpellcheck(e){e!==this.spellcheck_&&(this.spellcheck_=e,this.htmlInput_&&this.htmlInput_.setAttribute("spellcheck",this.spellcheck_))}showEditor_(e,t=!1){this.workspace_=this.sourceBlock_.workspace,!t&&this.workspace_.options.modalInputs&&(K$||Jd||ja)?this.showPromptEditor():this.showInlineEditor(t)}showPromptEditor(){na(i.Msg$$module$build$src$core$msg.CHANGE_VALUE_TITLE,this.getText(),e=>{e!==null&&this.setValue(this.getValueFromEditorText_(e)),this.onFinishEditing_(this.value_)})}showInlineEditor(e){const t=this.getSourceBlock();if(!t)throw new mt;ba(this,t.RTL,this.widgetDispose_.bind(this),this.workspace_),this.htmlInput_=this.widgetCreate_(),this.isBeingEdited_=!0,this.valueWhenEditorWasOpened_=this.value_,e||(this.htmlInput_.focus({preventScroll:!0}),this.htmlInput_.select())}widgetCreate_(){var e=this.getSourceBlock();if(!e)throw new mt;i.setGroup$$module$build$src$core$events$utils(!0);const t=Bo();var o=this.getClickTarget_();if(!o)throw Error("A click target has not been set.");fe(o,"editing"),o=document.createElement("input"),o.className="blocklyHtmlInput",o.setAttribute("spellcheck",this.spellcheck_);const n=this.workspace_.getScale();var c=this.getConstants().FIELD_TEXT_FONTSIZE*n+"pt";return t.style.fontSize=c,o.style.fontSize=c,c=Tl.BORDERRADIUS*n+"px",this.isFullBlockField()&&(c=this.getScaledBBox(),c=(c.bottom-c.top)/2+"px",e=e.getParent()?e.getParent().getColourTertiary():this.sourceBlock_.getColourTertiary(),o.style.border=1*n+"px solid "+e,t.style.borderRadius=c,t.style.transition="box-shadow 0.25s ease 0s",this.getConstants().FIELD_TEXTINPUT_BOX_SHADOW&&(t.style.boxShadow="rgba(255, 255, 255, 0.3) 0 0 0 "+4*n+"px")),o.style.borderRadius=c,t.appendChild(o),o.value=o.defaultValue=this.getEditorText_(this.value_),o.setAttribute("data-untyped-default-value",String(this.value_)),this.resizeEditor_(),this.bindInputEvents_(o),o}widgetDispose_(){this.isBeingEdited_=!1,this.isTextValid_=!0,this.forceRerender(),this.onFinishEditing_(this.value_),this.sourceBlock_&&J()&&this.valueWhenEditorWasOpened_!==null&&this.valueWhenEditorWasOpened_!==this.value_&&(U(new(Y(M.BLOCK_CHANGE))(this.sourceBlock_,"field",this.name||null,this.valueWhenEditorWasOpened_,this.value_)),this.valueWhenEditorWasOpened_=null),i.setGroup$$module$build$src$core$events$utils(!1),this.unbindInputEvents_();var e=Bo().style;if(e.width="auto",e.height="auto",e.fontSize="",e.transition="",e.boxShadow="",this.htmlInput_=null,e=this.getClickTarget_(),!e)throw Error("A click target has not been set.");st(e,"editing")}onFinishEditing_(e){}bindInputEvents_(e){this.onKeyDownWrapper=Q(e,"keydown",this,this.onHtmlInputKeyDown_),this.onKeyInputWrapper=Q(e,"input",this,this.onHtmlInputChange)}unbindInputEvents_(){this.onKeyDownWrapper&&(ze(this.onKeyDownWrapper),this.onKeyDownWrapper=null),this.onKeyInputWrapper&&(ze(this.onKeyInputWrapper),this.onKeyInputWrapper=null)}onHtmlInputKeyDown_(e){e.key==="Enter"?(Po(this),Ss()):e.key==="Escape"?(this.setValue(this.htmlInput_.getAttribute("data-untyped-default-value"),!1),Po(this),Ss()):e.key==="Tab"&&(Po(this),Ss(),this.sourceBlock_.tab(this,!e.shiftKey),e.preventDefault())}onHtmlInputChange(e){e=this.value_,this.setValue(this.getValueFromEditorText_(this.htmlInput_.value),!1),this.sourceBlock_&&J()&&this.value_!==e&&U(new(Y(M.BLOCK_FIELD_INTERMEDIATE_CHANGE))(this.sourceBlock_,this.name||null,e,this.value_))}setEditorValue_(e,t=!0){this.isDirty_=!0,this.isBeingEdited_&&(this.htmlInput_.value=this.getEditorText_(e)),this.setValue(e,t)}resizeEditor_(){ps().then(()=>{const e=this.getSourceBlock();if(!e)throw new mt;const t=Bo(),o=this.getScaledBBox();t.style.width=o.right-o.left+"px",t.style.height=o.bottom-o.top+"px";const n=o.top;t.style.left=`${e.RTL?o.right-t.offsetWidth:o.left}px`,t.style.top=`${n}px`})}repositionForWindowResize(){let e;const t=(e=this.getSourceBlock())==null?void 0:e.getRootBlock();return t instanceof ns?(Ei(this.workspace_,this.workspace_.getMetricsManager().getViewMetrics(!0),t)||this.resizeEditor_(),!0):!1}isTabNavigable(){return!0}getText_(){return this.isBeingEdited_&&this.htmlInput_?this.htmlInput_.value:null}getEditorText_(e){return`${e}`}getValueFromEditorText_(e){return e}};Tl.BORDERRADIUS=4;var kl=class extends Tl{constructor(e,t,o){super(e,t,o)}doClassValidation_(e){return e===void 0?null:`${e}`}static fromJson(e){return new this(ht(e.text),void 0,e)}};Is("field_input",kl),kl.prototype.DEFAULT_VALUE="";var pv=class extends Oh{constructor(e){super(e)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(e){return!!e.outputConnection}hasRightSquareCorner(e){return!!e.outputConnection&&!e.statementInputCount&&!e.nextConnection}},Sl=class extends ir{constructor(e,t){if(super(e,t),this.connectedBottomNextConnection=!1,this.connectedBlock){for(e=this.connectedBlock;t=e.getNextBlock();)e=t;e.nextConnection||(this.height=this.connectedBlockHeight,this.connectedBottomNextConnection=!0)}}},gv=class extends Rs{constructor(e){super(e),this.width=this.height=0,this.type|=E.getType("RIGHT_CONNECTION")}},mv=class extends Ph{constructor(e){super(e)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(e){const t=(e.hat?e.hat==="cap":this.constants_.ADD_START_HATS)&&!e.outputConnection&&!e.previousConnection;return!!e.outputConnection||t}hasRightSquareCorner(e){return!!e.outputConnection&&!e.statementInputCount&&!e.nextConnection}},fv=class extends ar{constructor(e,t){super(e,t),this.isInline=!0,this.renderer_=e,this.constants_=this.renderer_.getConstants(),this.topRow=new mv(this.constants_),this.bottomRow=new pv(this.constants_),this.isMultiRow=!t.getInputsInline()||t.isCollapsed(),this.hasStatementInput=0<t.statementInputCount,this.rightSide=this.outputConnection?new gv(this.constants_):null,this.rightAlignedDummyInputs=new WeakMap}getRenderer(){return this.renderer_}measure(){this.createRows_(),this.addElemSpacing_(),this.addRowSpacing_(),this.adjustXPosition_(),this.computeBounds_(),this.alignRowElements_(),this.finalize_()}shouldStartNewRow_(e,t){return t?t instanceof ro||e instanceof qt||t instanceof qt?!0:e instanceof i.ValueInput$$module$build$src$core$inputs$value_input||e instanceof Os||e instanceof ro?!this.isInline||this.isMultiRow:!1:!1}getDesiredRowWidth_(e){return e.hasStatement?this.width-this.startX-(this.constants_.INSIDE_CORNERS.rightWidth||0):super.getDesiredRowWidth_(e)}getInRowSpacing_(e,t){return e&&t||!this.outputConnection||!this.outputConnection.isDynamicShape||this.hasStatementInput||this.bottomRow.hasNextConnection?!e&&t&&E.isStatementInput(t)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:e&&E.isLeftRoundedCorner(e)&&t&&(E.isPreviousConnection(t)||E.isNextConnection(t))?t.notchOffset-this.constants_.CORNER_RADIUS:e&&E.isLeftSquareCorner(e)&&t&&E.isHat(t)?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING:this.constants_.NO_PADDING}getSpacerRowHeight_(e,t){if(E.isTopRow(e)&&E.isBottomRow(t))return this.constants_.EMPTY_BLOCK_SPACER_HEIGHT;const o=E.isInputRow(e)&&e.hasStatement,n=E.isInputRow(t)&&t.hasStatement;return n||o?(e=Math.max(this.constants_.NOTCH_HEIGHT,this.constants_.INSIDE_CORNERS.rightHeight||0),n&&o?Math.max(e,this.constants_.DUMMY_INPUT_MIN_HEIGHT):e):E.isTopRow(e)?e.hasPreviousConnection||this.outputConnection&&!this.hasStatementInput?this.constants_.NO_PADDING:Math.abs(this.constants_.NOTCH_HEIGHT-this.constants_.CORNER_RADIUS):E.isBottomRow(t)?this.outputConnection?!t.hasNextConnection&&this.hasStatementInput?Math.abs(this.constants_.NOTCH_HEIGHT-this.constants_.CORNER_RADIUS):this.constants_.NO_PADDING:Math.max(this.topRow.minHeight,Math.max(this.constants_.NOTCH_HEIGHT,this.constants_.CORNER_RADIUS))-this.constants_.CORNER_RADIUS:this.constants_.MEDIUM_PADDING}getSpacerRowWidth_(e,t){const o=this.width-this.startX;return E.isInputRow(e)&&e.hasStatement||E.isInputRow(t)&&t.hasStatement?Math.max(o,this.constants_.STATEMENT_INPUT_SPACER_MIN_WIDTH):o}getElemCenterline_(e,t){if(e.hasStatement&&!E.isSpacer(t)&&!E.isStatementInput(t))return e.yPos+this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT/2;if(E.isInlineInput(t)&&t instanceof wo){const o=t.connectedBlock;if(o&&o.outputConnection&&o.nextConnection)return e.yPos+o.height/2}return super.getElemCenterline_(e,t)}addInput_(e,t){if((e instanceof Os||e instanceof ro)&&t.hasDummyInput&&t.align===i.Align$$module$build$src$core$inputs$align.LEFT&&e.align===i.Align$$module$build$src$core$inputs$align.RIGHT)this.rightAlignedDummyInputs.set(t,e);else if(e instanceof qt){t.elements.push(new Sl(this.constants_,e)),t.hasStatement=!0,t.align===null&&(t.align=e.align);return}super.addInput_(e,t)}addAlignmentPadding_(e,t){if(this.rightAlignedDummyInputs.get(e)){let o;for(let n=0;n<e.elements.length;n++){const c=e.elements[n];if(E.isSpacer(c)&&(o=c),E.isField(c)&&c instanceof Hi&&c.parentInput===this.rightAlignedDummyInputs.get(e))break}if(o){o.width+=t,e.width+=t;return}}super.addAlignmentPadding_(e,t)}adjustXPosition_(){const e=this.constants_.NOTCH_OFFSET_LEFT+this.constants_.NOTCH_WIDTH;let t=e;for(let c=2;c<this.rows.length-1;c+=2){var o=this.rows[c-1];const h=this.rows[c];var n=this.rows[c+1];if(o=c===2?!!this.topRow.hasPreviousConnection:!!o.followsStatement,n=c+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!n.precedesStatement,E.isInputRow(h)&&h.hasStatement){h.measure();let $,T;t=h.width-((T=($=h.getLastInput())==null?void 0:$.width)!=null?T:0)+e}else if(o&&(c===2||n)&&E.isInputRow(h)&&!h.hasStatement){n=h.xPos,o=null;for(let $=0;$<h.elements.length;$++){const T=h.elements[$];E.isSpacer(T)&&(o=T),o&&(E.isField(T)||E.isInput(T))&&n<t&&!(E.isField(T)&&T instanceof Hi&&(T.field instanceof ti||T.field instanceof ii))&&(o.width+=t-n),n+=T.width}}}}finalizeOutputConnection_(){if(this.outputConnection&&this.outputConnection.isDynamicShape){var e=this.outputConnection.shape;if("isDynamic"in e&&e.isDynamic){for(var t=0,o=0;o<this.rows.length;o++){const n=this.rows[o];n.yPos=t,t+=n.height}this.height=t,o=this.bottomRow.hasNextConnection?this.height-this.bottomRow.descenderHeight:this.height,t=e.height(o),o=e.width(o),this.outputConnection.height=t,this.outputConnection.width=o,this.outputConnection.startX=o,this.outputConnection.connectionOffsetY=e.connectionOffsetY(t),this.outputConnection.connectionOffsetX=e.connectionOffsetX(o),e=0,this.hasStatementInput||this.bottomRow.hasNextConnection||(e=o,this.rightSide.height=t,this.rightSide.width=e,this.rightSide.centerline=t/2,this.rightSide.xPos=this.width+e),this.startX=o,this.width+=o+e,this.widthWithChildren+=o+e}}}finalizeHorizontalAlignment_(){if(this.outputConnection&&!this.hasStatementInput&&!this.bottomRow.hasNextConnection){for(var e=0,t=0;t<this.rows.length;t++){var o=this.rows[t];if(!E.isInputRow(o))continue;e=o.elements[o.elements.length-2];let n=this.getNegativeSpacing_(o.elements[1]),c=this.getNegativeSpacing_(e);e=n+c;const h=this.constants_.MIN_BLOCK_WIDTH+2*this.outputConnection.width;this.width-e<h&&(e=this.width-h,n=e/2,c=e/2),o.elements.unshift(new Xt(this.constants_,-n)),o.elements.push(new Xt(this.constants_,-c))}if(e)for(this.width-=e,this.widthWithChildren-=e,this.rightSide.xPos-=e,t=0;t<this.rows.length;t++)o=this.rows[t],E.isTopOrBottomRow(o)&&(o.elements[1].width-=e),o.width-=e,o.widthWithConnectedBlocks-=e}}getNegativeSpacing_(e){if(!e||!this.outputConnection)return 0;const t=this.outputConnection.width;var o=this.outputConnection.shape.type;const n=this.constants_;if(1<this.inputRows.length)switch(o){case n.SHAPES.ROUND:return o=this.constants_.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,o=this.height/2>o?o:this.height/2,t-o*(1-Math.sin(Math.acos((o-this.constants_.SMALL_PADDING)/o)));default:return 0}if(E.isInlineInput(e)&&e instanceof wo){const c=e.connectedBlock;return e=c?c.pathObject.outputShapeType:e.shape.type,e==null||c&&c.outputConnection&&(c.statementInputCount||c.nextConnection)||o===n.SHAPES.HEXAGONAL&&o!==e?0:t-this.constants_.SHAPE_IN_SHAPE_PADDING[o][e]}return E.isField(e)&&e instanceof Hi?o===n.SHAPES.ROUND&&e.field instanceof kl?t-2.75*n.GRID_UNIT:t-this.constants_.SHAPE_IN_SHAPE_PADDING[o][0]:E.isIcon(e)?this.constants_.SMALL_PADDING:0}finalizeVerticalAlignment_(){if(!this.outputConnection)for(let n=2;n<this.rows.length-1;n+=2){const c=this.rows[n-1],h=this.rows[n],$=this.rows[n+1];var e=n===2,t=n+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!$.precedesStatement;if(e?this.topRow.hasPreviousConnection:c.followsStatement){var o=h.elements[1];if(o=h.elements.length===3&&o instanceof Hi&&(o.field instanceof ti||o.field instanceof ii),!e&&o)c.height-=this.constants_.SMALL_PADDING,$.height-=this.constants_.SMALL_PADDING,h.height-=this.constants_.MEDIUM_PADDING;else if(!e&&!t)c.height+=this.constants_.SMALL_PADDING;else if(t){for(e=!1,t=0;t<h.elements.length;t++)if(o=h.elements[t],o instanceof wo&&E.isInlineInput(o)&&o.connectedBlock&&!o.connectedBlock.isShadow()&&40<=o.connectedBlock.getHeightWidth().height){e=!0;break}e&&(c.height-=this.constants_.SMALL_PADDING,$.height-=this.constants_.SMALL_PADDING)}}}}finalize_(){this.finalizeOutputConnection_(),this.finalizeHorizontalAlignment_(),this.finalizeVerticalAlignment_(),super.finalize_(),this.rightSide&&(this.widthWithChildren+=this.rightSide.width)}},$v=class extends zh{constructor(e,t,o){super(e,t,o),this.markerCircle=null}showWithInputOutput(e){const t=e.getSourceBlock();e=e.getLocation().getOffsetInBlock(),this.positionCircle(e.x,e.y),this.setParent_(t),this.showCurrent_()}showWithOutput_(e){this.showWithInputOutput(e)}showWithInput_(e){this.showWithInputOutput(e)}showWithBlock_(e){e=e.getLocation();const t=e.getHeightWidth();this.positionRect_(0,0,t.width,t.height),this.setParent_(e),this.showCurrent_()}positionCircle(e,t){let o;(o=this.markerCircle)==null||o.setAttribute("cx",`${e}`);let n;(n=this.markerCircle)==null||n.setAttribute("cy",`${t}`),this.currentMarkerSvg=this.markerCircle}hide(){super.hide(),this.markerCircle&&(this.markerCircle.style.display="none")}createDomInternal_(){if(super.createDomInternal_(),this.markerCircle=L(D.CIRCLE,{r:this.constants_.CURSOR_RADIUS,"stroke-width":this.constants_.CURSOR_STROKE_WIDTH},this.markerSvg_),this.hide(),this.isCursor()){const e=this.getBlinkProperties_();L(D.ANIMATE,e,this.markerCircle)}return this.markerSvg_}applyColour_(e){super.applyColour_(e);let t;(t=this.markerCircle)==null||t.setAttribute("fill",this.colour_);let o;if((o=this.markerCircle)==null||o.setAttribute("stroke",this.colour_),this.isCursor()){e=this.colour_+";transparent;transparent;";let n;(n=this.markerCircle)==null||n.firstElementChild.setAttribute("values",e)}}},bv=class extends $l{constructor(e,t,o){super(e,t,o),this.svgPathSelected=null,this.outlines=new Map,this.remainingOutlines=new Set,this.outputShapeType=null,this.constants=o}setPath(e){super.setPath(e),this.svgPathSelected&&this.svgPathSelected.setAttribute("d",e)}applyColour(e){super.applyColour(e);const t=e.getParent();e.isShadow()&&t&&this.svgPath.setAttribute("stroke",t.getColourTertiary());for(const o of this.outlines.values())o.setAttribute("fill",this.style.colourTertiary)}flipRTL(){super.flipRTL();for(const e of this.outlines.values())e.setAttribute("transform","scale(-1 1)")}updateSelected(e){this.setClass_("blocklySelected",e),e?this.svgPathSelected||(this.svgPathSelected=this.svgPath.cloneNode(!0),this.svgPathSelected.setAttribute("fill","none"),this.svgPathSelected.setAttribute("filter","url(#"+this.constants.selectedGlowFilterId+")"),this.svgRoot.appendChild(this.svgPathSelected)):this.svgPathSelected&&(this.svgRoot.removeChild(this.svgPathSelected),this.svgPathSelected=null)}updateReplacementFade(e){this.setClass_("blocklyReplaceable",e),e?this.svgPath.setAttribute("filter","url(#"+this.constants.replacementGlowFilterId+")"):this.svgPath.removeAttribute("filter")}updateShapeForInputHighlight(e,t){e=e.getParentInput().name,(e=this.getOutlinePath(e))&&(t?e.setAttribute("filter","url(#"+this.constants.replacementGlowFilterId+")"):e.removeAttribute("filter"))}beginDrawing(){this.remainingOutlines.clear();for(const e of this.outlines.keys())this.remainingOutlines.add(e)}endDrawing(){if(this.remainingOutlines.size)for(const e of this.remainingOutlines)this.removeOutlinePath(e);this.remainingOutlines.clear()}setOutlinePath(e,t){e=this.getOutlinePath(e),e.setAttribute("d",t),e.setAttribute("fill",this.style.colourTertiary)}getOutlinePath(e){return this.outlines.has(e)||this.outlines.set(e,L(D.PATH,{class:"blocklyOutlinePath",d:""},this.svgRoot)),this.remainingOutlines.delete(e),this.outlines.get(e)}removeOutlinePath(e){let t,o;(t=this.outlines.get(e))==null||(o=t.parentNode)==null||o.removeChild(this.outlines.get(e)),this.outlines.delete(e)}},ip=class extends bl{constructor(e){super(e)}makeConstants_(){return new dv}makeRenderInfo_(e){return new fv(this,e)}makeDrawer_(e,t){return new hv(e,t)}makeMarkerDrawer(e,t){return new $v(e,this.getConstants(),t)}makePathObject(e,t){return new bv(e,t,this.getConstants())}getConstants(){return this.constants_}getConnectionPreviewMethod(e,t,o){return _("getConnectionPreviewMethod","v10","v12","an IConnectionPreviewer, if it fulfills your use case."),t.type===ne.OUTPUT_VALUE?e.isConnected()?is.PREVIEW_TYPE.REPLACEMENT_FADE:is.PREVIEW_TYPE.INPUT_OUTLINE:super.getConnectionPreviewMethod(e,t,o)}};Ln("zelos",ip);var vv=class{constructor(e){this.staticConn=this.draggedConn=this.markerConn=this.fadedBlock=null,this.workspace=e.workspace}previewReplacement(e,t,o){i.disable$$module$build$src$core$events$utils();try{this.hidePreview(),this.fadedBlock=o,o.fadeForReplacement(!0),this.workspace.getRenderer().shouldHighlightConnection(t)&&(t.highlight(),this.staticConn=t)}finally{i.enable$$module$build$src$core$events$utils()}}previewConnection(e,t){if(e!==this.draggedConn||t!==this.staticConn){i.disable$$module$build$src$core$events$utils();try{this.hidePreview(),this.shouldUseMarkerPreview(e,t)&&(this.markerConn=this.previewMarker(e,t)),this.workspace.getRenderer().shouldHighlightConnection(t)&&t.highlight(),this.draggedConn=e,this.staticConn=t}finally{i.enable$$module$build$src$core$events$utils()}}}shouldUseMarkerPreview(e,t){return t.type===ne.PREVIOUS_STATEMENT||t.type===ne.NEXT_STATEMENT||!(this.workspace.getRenderer()instanceof ip)}previewMarker(e,t){const o=e.getSourceBlock(),n=this.createInsertionMarker(o),c=this.getMatchingConnection(o,n,e);if(!c)return null;n.queueRender(),Ws(),c.connect(t);const h={x:t.x-c.x,y:t.y-c.y},$=c.getOffsetInBlock().clone();return ps().then(()=>{if(!n.isDeadOrDying()){i.disable$$module$build$src$core$events$utils();try{n==null||n.positionNearConnection(c,h,$),n==null||n.getSvgRoot().setAttribute("visibility","visible")}finally{i.enable$$module$build$src$core$events$utils()}}}),c}createInsertionMarker(e){const t=Gt(e,{addCoordinates:!1,addInputBlocks:!1,addNextBlocks:!1,doFullSerialization:!1});if(!t)throw Error(`Failed to serialize source block. ${e.toDevString()}`);e=Vs(t,this.workspace);for(const o of e.getDescendants(!1))o.setInsertionMarker(!0);return e.initSvg(),e.getSvgRoot().setAttribute("visibility","hidden"),e}getMatchingConnection(e,t,o){if(e=e.getConnections_(!0),t=t.getConnections_(!0),e.length!==t.length)return null;for(let n=0;n<e.length;n++)if(e[n]===o)return t[n];return null}hidePreview(){i.disable$$module$build$src$core$events$utils();try{this.staticConn&&(this.staticConn.unhighlight(),this.staticConn=null),this.fadedBlock&&(this.fadedBlock.fadeForReplacement(!1),this.fadedBlock=null),this.markerConn&&(this.hideInsertionMarker(this.markerConn),this.draggedConn=this.markerConn=null)}finally{i.enable$$module$build$src$core$events$utils()}}hideInsertionMarker(e){const t=e.getSourceBlock(),o=t.outputConnection;let n;if((n=t.previousConnection)!=null&&n.targetConnection||o!=null&&o.targetConnection)t.unplug(!0);else{let c;(c=e.targetBlock())==null||c.unplug(!1)}t.dispose()}dispose(){this.hidePreview()}};r(z.CONNECTION_PREVIEWER,Ds,vv);var So={};So.Align=i.Align$$module$build$src$core$inputs$align,So.DummyInput=Os,So.EndRowInput=ro,So.Input=Wi,So.StatementInput=qt,So.ValueInput=i.ValueInput$$module$build$src$core$inputs$value_input,So.inputTypes=i.inputTypes$$module$build$src$core$inputs$input_types;var yv=!1,_v;i.CodeGenerator$$module$build$src$core$generator=class{constructor(e){this.forBlock=Object.create(null),this.FUNCTION_NAME_PLACEHOLDER_="{leCUI8hutHZI4480Dc}",this.STATEMENT_SUFFIX=this.STATEMENT_PREFIX=this.INFINITE_LOOP_TRAP=null,this.INDENT=" ",this.COMMENT_WRAP=60,this.ORDER_OVERRIDES=[],this.isInitialized=null,this.RESERVED_WORDS_="",this.definitions_=Object.create(null),this.functionNames_=Object.create(null),this.nameDB_=void 0,this.name_=e,this.FUNCTION_NAME_PLACEHOLDER_REGEXP_=new RegExp(this.FUNCTION_NAME_PLACEHOLDER_,"g")}workspaceToCode(e){e||(console.warn("No workspace specified in workspaceToCode call. Guessing."),e=W());var t=[];this.init(e),e=e.getTopBlocks(!0);for(let o=0,n;n=e[o];o++){let c=this.blockToCode(n);Array.isArray(c)&&(c=c[0]),c&&(n.outputConnection&&(c=this.scrubNakedValue(c),this.STATEMENT_PREFIX&&!n.suppressPrefixSuffix&&(c=this.injectId(this.STATEMENT_PREFIX,n)+c),this.STATEMENT_SUFFIX&&!n.suppressPrefixSuffix&&(c+=this.injectId(this.STATEMENT_SUFFIX,n))),t.push(c))}return t=t.join(`
919
+ `),t=this.finish(t),t=t.replace(/^\s+\n/,""),t=t.replace(/\n\s+$/,`
920
+ `),t=t.replace(/[ \t]+\n/g,`
921
+ `)}prefixLines(e,t){return t+e.replace(/(?!\n$)\n/g,`
922
+ `+t)}allNestedComments(e){const t=[];e=e.getDescendants(!0);for(let o=0;o<e.length;o++){const n=e[o].getCommentText();n&&t.push(n)}return t.length&&t.push(""),t.join(`
923
+ `)}blockToCode(e,t){if(this.isInitialized===!1&&console.warn("CodeGenerator init was not called before blockToCode was called."),!e)return"";if(!e.isEnabled())return t?"":this.blockToCode(e.getNextBlock());if(e.isInsertionMarker())return t?"":this.blockToCode(e.getChildren(!1)[0]);var o=this.forBlock[e.type];if(typeof o!="function")throw Error(`${this.name_} generator does not know how to generate code for block type "${e.type}".`);if(o=o.call(e,e,this),Array.isArray(o)){if(!e.outputConnection)throw TypeError("Expecting string from statement block: "+e.type);return[this.scrub_(e,o[0],t),o[1]]}if(typeof o=="string")return this.STATEMENT_PREFIX&&!e.suppressPrefixSuffix&&(o=this.injectId(this.STATEMENT_PREFIX,e)+o),this.STATEMENT_SUFFIX&&!e.suppressPrefixSuffix&&(o+=this.injectId(this.STATEMENT_SUFFIX,e)),this.scrub_(e,o,t);if(o===null)return"";throw SyntaxError("Invalid code generated: "+o)}valueToCode(e,t,o){if(isNaN(o))throw TypeError("Expecting valid order from block: "+e.type);var n=e.getInputTargetBlock(t);if(!n&&!e.getInput(t))throw ReferenceError(`Input "${t}" doesn't exist on "${e.type}"`);if(!n||(t=this.blockToCode(n),t===""))return"";if(!Array.isArray(t))throw TypeError(`Expecting tuple from value block: ${n.type} See developers.google.com/blockly/guides/create-custom-blocks/generating-code for more information`);if(e=t[0],t=t[1],isNaN(t))throw TypeError("Expecting valid order from value block: "+n.type);if(!e)return"";n=!1;var c=Math.floor(o);const h=Math.floor(t);if(c<=h&&(c!==h||c!==0&&c!==99)){for(n=!0,c=0;c<this.ORDER_OVERRIDES.length;c++)if(this.ORDER_OVERRIDES[c][0]===o&&this.ORDER_OVERRIDES[c][1]===t){n=!1;break}}return n&&(e="("+e+")"),e}statementToCode(e,t){const o=e.getInputTargetBlock(t);if(!o&&!e.getInput(t))throw ReferenceError(`Input "${t}" doesn't exist on "${e.type}"`);if(e=this.blockToCode(o),typeof e!="string")throw TypeError("Expecting code from statement block: "+(o&&o.type));return e&&(e=this.prefixLines(e,this.INDENT)),e}addLoopTrap(e,t){return this.INFINITE_LOOP_TRAP&&(e=this.prefixLines(this.injectId(this.INFINITE_LOOP_TRAP,t),this.INDENT)+e),this.STATEMENT_SUFFIX&&!t.suppressPrefixSuffix&&(e=this.prefixLines(this.injectId(this.STATEMENT_SUFFIX,t),this.INDENT)+e),this.STATEMENT_PREFIX&&!t.suppressPrefixSuffix&&(e+=this.prefixLines(this.injectId(this.STATEMENT_PREFIX,t),this.INDENT)),e}injectId(e,t){return t=t.id.replace(/\$/g,"$$$$"),e.replace(/%1/g,"'"+t+"'")}addReservedWords(e){this.RESERVED_WORDS_+=e+","}provideFunction_(e,t){if(!this.definitions_[e]){const o=this.nameDB_.getDistinctName(e,i.NameType$$module$build$src$core$names.PROCEDURE);this.functionNames_[e]=o,Array.isArray(t)&&(t=t.join(`
924
+ `)),t=t.trim().replace(this.FUNCTION_NAME_PLACEHOLDER_REGEXP_,o);let n;for(;n!==t;)n=t,t=t.replace(/^(( {2})*) {2}/gm,"$1\0");t=t.replace(/\0/g,this.INDENT),this.definitions_[e]=t}return this.functionNames_[e]}getVariableName(e){return this.getName(e,i.NameType$$module$build$src$core$names.VARIABLE)}getProcedureName(e){return this.getName(e,i.NameType$$module$build$src$core$names.PROCEDURE)}getName(e,t){if(!this.nameDB_)throw Error("Name database is not defined. You must initialize `nameDB_` in your generator class and call `init` first.");return this.nameDB_.getName(e,t)}init(e){this.definitions_=Object.create(null),this.functionNames_=Object.create(null)}scrub_(e,t,o){return t}finish(e){return this.definitions_=Object.create(null),this.functionNames_=Object.create(null),e}scrubNakedValue(e){return e}},_v={},_v.CodeGenerator=i.CodeGenerator$$module$build$src$core$generator;var wv=class extends op{constructor(e,t){super(e),this.flyout_=t}getBoundingBox(){let e;try{e=this.workspace_.getCanvas().getBBox()}catch{e={height:0,y:0,width:0,x:0}}return e}getContentMetrics(e){const t=this.getBoundingBox();return e=e?1:this.workspace_.scale,{height:t.height*e,width:t.width*e,top:t.y*e,left:t.x*e}}getScrollMetrics(e,t,o){return t=o||this.getContentMetrics(),o=this.flyout_.MARGIN*this.workspace_.scale,e=e?this.workspace_.scale:1,{height:(t.height+2*o)/e,width:(t.width+t.left+o)/e,top:0,left:0}}},Ji;(function(e){e.BLOCK="block",e.BUTTON="button"})(Ji||(Ji={}));var $T="WORKSPACE_AT_BLOCK_CAPACITY",El=class extends yl{constructor(e){super(),this.horizontalLayout=!1,this.boundEvents=[],this.filterWrapper=this.reflowWrapper=null,this.mats=[],this.buttons_=[],this.contents=[],this.listeners=[],this.permanentlyDisabled=[],this.recycledBlocks=[],this.autoClose=!0,this.visible=!1,this.containerVisible=!0,this.CORNER_RADIUS=8,this.SCROLLBAR_MARGIN=2.5,this.height_=this.width_=0,this.dragAngleRange_=70,this.svgGroup_=this.svgBackground_=null,e.setMetrics=this.setMetrics_.bind(this),this.workspace_=new Zt(e),this.workspace_.setMetricsManager(new wv(this.workspace_,this)),this.workspace_.internalIsFlyout=!0,this.workspace_.setVisible(this.visible),this.id=S(),this.RTL=!!e.RTL,this.toolboxPosition_=e.toolboxPosition,this.tabWidth_=this.workspace_.getRenderer().getConstants().TAB_WIDTH,this.rectMap_=new WeakMap,this.MARGIN=this.CORNER_RADIUS,this.GAP_X=3*this.MARGIN,this.GAP_Y=3*this.MARGIN}createDom(e){return this.svgGroup_=L(e,{class:"blocklyFlyout"}),this.svgGroup_.style.display="none",this.svgBackground_=L(D.PATH,{class:"blocklyFlyoutBackground"},this.svgGroup_),this.svgGroup_.appendChild(this.workspace_.createDom()),this.workspace_.getThemeManager().subscribe(this.svgBackground_,"flyoutBackgroundColour","fill"),this.workspace_.getThemeManager().subscribe(this.svgBackground_,"flyoutOpacity","fill-opacity"),this.svgGroup_}init(e){this.targetWorkspace=e,this.workspace_.targetWorkspace=e,this.workspace_.scrollbar=new sp(this.workspace_,this.horizontalLayout,!this.horizontalLayout,"blocklyFlyoutScrollbar",this.SCROLLBAR_MARGIN),this.hide(),this.boundEvents.push(Q(this.svgGroup_,"wheel",this,this.wheel_)),this.filterWrapper=this.filterForCapacity.bind(this),this.targetWorkspace.addChangeListener(this.filterWrapper),this.boundEvents.push(Q(this.svgBackground_,"pointerdown",this,this.onMouseDown)),this.workspace_.getGesture=this.targetWorkspace.getGesture.bind(this.targetWorkspace),this.workspace_.setVariableMap(this.targetWorkspace.getVariableMap()),this.workspace_.createPotentialVariableMap(),e.getComponentManager().addComponent({component:this,weight:at.ComponentWeight.FLYOUT_WEIGHT,capabilities:[at.Capability.AUTOHIDEABLE,at.Capability.DELETE_AREA,at.Capability.DRAG_TARGET]})}dispose(){this.hide(),this.targetWorkspace.getComponentManager().removeComponent(this.id);for(const e of this.boundEvents)ze(e);this.boundEvents.length=0,this.filterWrapper&&this.targetWorkspace.removeChangeListener(this.filterWrapper),this.workspace_&&(this.workspace_.getThemeManager().unsubscribe(this.svgBackground_),this.workspace_.dispose()),this.svgGroup_&&Ge(this.svgGroup_)}getWidth(){return this.width_}getHeight(){return this.height_}getFlyoutScale(){return this.targetWorkspace.scale}getWorkspace(){return this.workspace_}setAutoClose(e){this.autoClose=e,this.targetWorkspace.recordDragTargets(),this.targetWorkspace.resizeContents()}autoHide(e){!e&&this.targetWorkspace.getFlyout(!0)===this&&this.autoClose&&this.hide()}getTargetWorkspace(){return this.targetWorkspace}isVisible(){return this.visible}setVisible(e){const t=e!==this.isVisible();this.visible=e,t&&(this.autoClose||this.targetWorkspace.recordDragTargets(),this.updateDisplay())}setContainerVisible(e){const t=e!==this.containerVisible;this.containerVisible=e,t&&this.updateDisplay()}getContents(){return this.contents}setContents(e){this.contents=e}updateDisplay(){let e;e=this.containerVisible?this.isVisible():!1,this.svgGroup_&&(this.svgGroup_.style.display=e?"block":"none");let t;(t=this.workspace_.scrollbar)==null||t.setContainerVisible(e)}positionAt_(e,t,o,n){let c;(c=this.svgGroup_)==null||c.setAttribute("width",`${e}`);let h;(h=this.svgGroup_)==null||h.setAttribute("height",`${t}`),this.workspace_.setCachedParentSvgSize(e,t),this.svgGroup_&&Wr(this.svgGroup_,"translate("+o+"px,"+n+"px)"),(e=this.workspace_.scrollbar)&&(e.setOrigin(o,n),e.resize(),e.hScroll&&e.hScroll.setPosition(e.hScroll.position.x,e.hScroll.position.y),e.vScroll&&e.vScroll.setPosition(e.vScroll.position.x,e.vScroll.position.y))}hide(){if(this.isVisible()){this.setVisible(!1);for(const e of this.listeners)ze(e);this.listeners.length=0,this.reflowWrapper&&(this.workspace_.removeChangeListener(this.reflowWrapper),this.reflowWrapper=null)}}show(e){this.workspace_.setResizesEnabled(!1),this.hide(),this.clearOldBlocks(),typeof e=="string"&&(e=this.getDynamicCategoryContents(e)),this.setVisible(!0),e=yn(e),e=this.createFlyoutInfo(e),Ws(this.workspace_),this.setContents(e.contents),this.layout_(e.contents,e.gaps),this.horizontalLayout?this.height_=0:this.width_=0,this.workspace_.setResizesEnabled(!0),this.reflow(),this.filterForCapacity(),this.position(),this.reflowWrapper=this.reflow.bind(this),this.workspace_.addChangeListener(this.reflowWrapper),this.emptyRecycledBlocks()}createFlyoutInfo(e){const t=[],o=[];this.permanentlyDisabled.length=0;const n=this.horizontalLayout?this.GAP_X:this.GAP_Y;for(const c of e){if("custom"in c){e=this.getDynamicCategoryContents(c.custom),e=yn(e);const{contents:h,gaps:$}=this.createFlyoutInfo(e);t.push(...h),o.push(...$)}switch(c.kind.toUpperCase()){case"BLOCK":e=c;const h=this.createFlyoutBlock(e);t.push({type:Ji.BLOCK,block:h}),this.addBlockGap(e,o,n);break;case"SEP":this.addSeparatorGap(c,o,n);break;case"LABEL":e=this.createButton(c,!0),t.push({type:Ji.BUTTON,button:e}),o.push(n);break;case"BUTTON":e=this.createButton(c,!1),t.push({type:Ji.BUTTON,button:e}),o.push(n)}}return{contents:t,gaps:o}}getDynamicCategoryContents(e){if(e=this.workspace_.targetWorkspace.getToolboxCategoryCallback(e),typeof e!="function")throw TypeError("Couldn't find a callback function when opening a toolbox category.");return e(this.workspace_.targetWorkspace)}createButton(e,t){return new os(this.workspace_,this.targetWorkspace,e,t)}createFlyoutBlock(e){let t;return e.blockxml?(e=typeof e.blockxml=="string"?i.textToDom$$module$build$src$core$utils$xml(e.blockxml):e.blockxml,(t=this.getRecycledBlock(e.getAttribute("type")))||(t=Fo(e,this.workspace_))):(t=this.getRecycledBlock(e.type),t||(e.enabled===void 0&&(e.enabled=e.disabled!=="true"&&e.disabled!==!0),e.disabledReasons===void 0&&e.enabled===!1&&(e.disabledReasons=[Lt]),t=bi(e,this.workspace_))),t.isEnabled()||this.permanentlyDisabled.push(t),t}getRecycledBlock(e){let t=-1;for(let o=0;o<this.recycledBlocks.length;o++)if(this.recycledBlocks[o].type===e){t=o;break}return t===-1?void 0:this.recycledBlocks.splice(t,1)[0]}addBlockGap(e,t,o){let n;e.gap?n=parseInt(String(e.gap)):e.blockxml&&(e=typeof e.blockxml=="string"?i.textToDom$$module$build$src$core$utils$xml(e.blockxml):e.blockxml,n=parseInt(e.getAttribute("gap"))),t.push(!n||isNaN(n)?o:n)}addSeparatorGap(e,t,o){e=parseInt(String(e.gap)),!isNaN(e)&&0<t.length?t[t.length-1]=e:t.push(o)}clearOldBlocks(){var e=this.workspace_.getTopBlocks(!1);for(let o=0,n;n=e[o];o++)this.blockIsRecyclable_(n)?this.recycleBlock(n):n.dispose(!1,!1);for(e=0;e<this.mats.length;e++){const o=this.mats[e];o&&(ga(o),Ge(o))}this.mats.length=0;for(let o=0,n;n=this.buttons_[o];o++)n.dispose();this.buttons_.length=0;let t;(t=this.workspace_.getPotentialVariableMap())==null||t.clear()}emptyRecycledBlocks(){for(let e=0;e<this.recycledBlocks.length;e++)this.recycledBlocks[e].dispose();this.recycledBlocks=[]}blockIsRecyclable_(e){return!1}recycleBlock(e){const t=e.getRelativeToSurfaceXY();e.moveBy(-t.x,-t.y),this.recycledBlocks.push(e)}addBlockListeners_(e,t,o){this.listeners.push(Q(e,"pointerdown",null,this.blockMouseDown(t))),this.listeners.push(Q(o,"pointerdown",null,this.blockMouseDown(t))),this.listeners.push(lt(e,"pointerenter",t,()=>{this.targetWorkspace.isDragging()||t.addSelect()})),this.listeners.push(lt(e,"pointerleave",t,()=>{this.targetWorkspace.isDragging()||t.removeSelect()})),this.listeners.push(lt(o,"pointerenter",t,()=>{this.targetWorkspace.isDragging()||t.addSelect()})),this.listeners.push(lt(o,"pointerleave",t,()=>{this.targetWorkspace.isDragging()||t.removeSelect()}))}blockMouseDown(e){return t=>{const o=this.targetWorkspace.getGesture(t);o&&(o.setStartBlock(e),o.handleFlyoutStart(t,this))}}onMouseDown(e){const t=this.targetWorkspace.getGesture(e);t&&t.handleFlyoutStart(e,this)}isBlockCreatable(e){return e.isEnabled()}createBlock(e){let t=null;i.disable$$module$build$src$core$events$utils();var o=this.targetWorkspace.getAllVariables();this.targetWorkspace.setResizesEnabled(!1);try{t=this.placeNewBlock(e)}finally{i.enable$$module$build$src$core$events$utils()}if(this.targetWorkspace.hideChaff(),e=kn(this.targetWorkspace,o),J()){for(i.setGroup$$module$build$src$core$events$utils(!0),o=0;o<e.length;o++){const n=e[o];U(new(Y(M.VAR_CREATE))(n))}U(new(Y(M.BLOCK_CREATE))(t))}return this.autoClose?this.hide():this.filterForCapacity(),t}initFlyoutButton_(e,t,o){const n=e.createDom();e.moveTo(t,o),e.show(),this.listeners.push(Q(n,"pointerdown",this,this.onMouseDown)),this.buttons_.push(e)}createRect_(e,t,o,n,c){return t=L(D.RECT,{"fill-opacity":0,x:t,y:o,height:n.height,width:n.width}),t.tooltip=e,wi(t),this.workspace_.getCanvas().insertBefore(t,e.getSvgRoot()),this.rectMap_.set(e,t),this.mats[c]=t}moveRectToBlock_(e,t){const o=t.getHeightWidth();e.setAttribute("width",String(o.width)),e.setAttribute("height",String(o.height)),t=t.getRelativeToSurfaceXY(),e.setAttribute("y",String(t.y)),e.setAttribute("x",String(this.RTL?t.x-o.width:t.x))}filterForCapacity(){const e=this.workspace_.getTopBlocks(!1);for(let t=0,o;o=e[t];t++)if(!this.permanentlyDisabled.includes(o)){const n=this.targetWorkspace.isCapacityAvailable(ye(o));for(;o;)o.setDisabledReason(!n,$T),o=o.getNextBlock()}}reflow(){this.reflowWrapper&&this.workspace_.removeChangeListener(this.reflowWrapper),this.reflowInternal_(),this.reflowWrapper&&this.workspace_.addChangeListener(this.reflowWrapper)}isScrollable(){return this.workspace_.scrollbar?this.workspace_.scrollbar.isVisible():!1}placeNewBlock(e){var t=this.targetWorkspace;if(!e.getSvgRoot())throw Error("oldBlock is not rendered");const o=this.serializeBlock(e);return t.setResizesEnabled(!1),t=Vs(o,t),this.positionNewBlock(e,t),t}serializeBlock(e){return Gt(e)}positionNewBlock(e,t){const o=this.targetWorkspace;var n=o.getOriginOffsetInPixels(),c=this.workspace_.getOriginOffsetInPixels();e=e.getRelativeToSurfaceXY(),e.scale(this.workspace_.scale),c=K.sum(c,e),n=K.difference(c,n),n.scale(1/o.scale),t.moveTo(new K(n.x,n.y))}};El.FlyoutItemType=Ji;var np=class extends El{constructor(e){super(e)}setMetrics_(e){if(this.isVisible()){var t=this.workspace_.getMetricsManager(),o=t.getScrollMetrics(),n=t.getViewMetrics();t=t.getAbsoluteMetrics(),typeof e.y=="number"&&(this.workspace_.scrollY=-(o.top+(o.height-n.height)*e.y)),this.workspace_.translate(this.workspace_.scrollX+t.left,this.workspace_.scrollY+t.top)}}getX(){if(!this.isVisible())return 0;var e=this.targetWorkspace.getMetricsManager();const t=e.getAbsoluteMetrics(),o=e.getViewMetrics();return e=e.getToolboxMetrics(),this.targetWorkspace.toolboxPosition===this.toolboxPosition_?this.targetWorkspace.getToolbox()?this.toolboxPosition_===xe.LEFT?e.width:o.width-this.width_:this.toolboxPosition_===xe.LEFT?0:o.width:this.toolboxPosition_===xe.LEFT?0:o.width+t.left-this.width_}getY(){return 0}position(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var e=this.targetWorkspace.getMetricsManager().getViewMetrics();this.height_=e.height,this.setBackgroundPath(this.width_-this.CORNER_RADIUS,e.height-2*this.CORNER_RADIUS),e=this.getX();var t=this.getY();this.positionAt_(this.width_,this.height_,e,t)}}setBackgroundPath(e,t){const o=this.toolboxPosition_===xe.RIGHT;var n=e+this.CORNER_RADIUS;n=["M "+(o?n:0)+",0"],n.push("h",o?-e:e),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,o?0:1,o?-this.CORNER_RADIUS:this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("v",Math.max(0,t)),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,o?0:1,o?this.CORNER_RADIUS:-this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("h",o?e:-e),n.push("z"),this.svgBackground_.setAttribute("d",n.join(" "))}scrollToStart(){let e;(e=this.workspace_.scrollbar)==null||e.setY(0)}wheel_(e){var t=Hs(e);if(t.y){const o=this.workspace_.getMetricsManager(),n=o.getScrollMetrics();t=o.getViewMetrics().top-n.top+t.y;let c;(c=this.workspace_.scrollbar)==null||c.setY(t),Dn(this.workspace_),Ss()}e.preventDefault(),e.stopPropagation()}layout_(e,t){this.workspace_.scale=this.targetWorkspace.scale;var o=this.MARGIN;const n=this.RTL?o:o+this.tabWidth_;for(let T=0,B;B=e[T];T++)if(B.type==="block"){var c=B.block;if(!c)continue;var h=c.getDescendants(!1);for(let it=0,ot;ot=h[it];it++)ot.isInFlyout=!0;h=c.getSvgRoot();const oe=c.getHeightWidth();var $=c.outputConnection?n-this.tabWidth_:n;c.moveBy($,o),$=this.createRect_(c,this.RTL?$-oe.width:$,o,oe,T),this.addBlockListeners_(h,c,$),o+=oe.height+t[T]}else B.type==="button"&&(c=B.button,this.initFlyoutButton_(c,n,o),o+=c.height+t[T])}isDragTowardWorkspace(e){e=Math.atan2(e.y,e.x)/Math.PI*180;const t=this.dragAngleRange_;return e<t&&e>-t||e<-180+t||e>180-t}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;const e=this.svgGroup_.getBoundingClientRect(),t=e.left;return this.toolboxPosition_===xe.LEFT?new Je(-1e9,1e9,-1e9,t+e.width):new Je(-1e9,1e9,t,1e9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let e=0;var t=this.workspace_.getTopBlocks(!1);for(let n=0,c;c=t[n];n++){var o=c.getHeightWidth().width;c.outputConnection&&(o-=this.tabWidth_),e=Math.max(e,o)}for(let n=0,c;c=this.buttons_[n];n++)e=Math.max(e,c.width);if(e+=1.5*this.MARGIN+this.tabWidth_,e*=this.workspace_.scale,e+=gt.scrollbarThickness,this.width_!==e){for(let n=0,c;c=t[n];n++){if(this.RTL){o=c.getRelativeToSurfaceXY().x;let h=e/this.workspace_.scale-this.MARGIN;c.outputConnection||(h-=this.tabWidth_),c.moveBy(h-o,0)}this.rectMap_.has(c)&&this.moveRectToBlock_(this.rectMap_.get(c),c)}if(this.RTL)for(let n=0,c;c=this.buttons_[n];n++)t=c.getPosition().y,c.moveTo(e/this.workspace_.scale-c.width-this.MARGIN-this.tabWidth_,t);this.targetWorkspace.scrollbar||this.autoClose||this.targetWorkspace.getFlyout()!==this||this.toolboxPosition_!==xe.LEFT||this.targetWorkspace.translate(this.targetWorkspace.scrollX+e,this.targetWorkspace.scrollY),this.width_=e,this.position(),this.targetWorkspace.resizeContents(),this.targetWorkspace.recordDragTargets()}}};np.registryName="verticalFlyout",r(z.FLYOUTS_VERTICAL_TOOLBOX,Ds,np);var Cv=class extends El{constructor(e){super(e),this.horizontalLayout=!0}setMetrics_(e){if(this.isVisible()){var t=this.workspace_.getMetricsManager(),o=t.getScrollMetrics(),n=t.getViewMetrics();t=t.getAbsoluteMetrics(),typeof e.x=="number"&&(this.workspace_.scrollX=-(o.left+(o.width-n.width)*e.x)),this.workspace_.translate(this.workspace_.scrollX+t.left,this.workspace_.scrollY+t.top)}}getX(){return 0}getY(){if(!this.isVisible())return 0;var e=this.targetWorkspace.getMetricsManager();const t=e.getAbsoluteMetrics(),o=e.getViewMetrics();e=e.getToolboxMetrics();const n=this.toolboxPosition_===xe.TOP;return this.targetWorkspace.toolboxPosition===this.toolboxPosition_?this.targetWorkspace.getToolbox()?n?e.height:o.height-this.height_:n?0:o.height:n?0:o.height+t.top-this.height_}position(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var e=this.targetWorkspace.getMetricsManager().getViewMetrics();this.width_=e.width,this.setBackgroundPath(e.width-2*this.CORNER_RADIUS,this.height_-this.CORNER_RADIUS),e=this.getX();var t=this.getY();this.positionAt_(this.width_,this.height_,e,t)}}setBackgroundPath(e,t){const o=this.toolboxPosition_===xe.TOP,n=["M 0,"+(o?0:this.CORNER_RADIUS)];o?(n.push("h",e+2*this.CORNER_RADIUS),n.push("v",t),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("h",-e),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,-this.CORNER_RADIUS)):(n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,-this.CORNER_RADIUS),n.push("h",e),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("v",t),n.push("h",-e-2*this.CORNER_RADIUS)),n.push("z"),this.svgBackground_.setAttribute("d",n.join(" "))}scrollToStart(){let e;(e=this.workspace_.scrollbar)==null||e.setX(this.RTL?1/0:0)}wheel_(e){var t=Hs(e);if(t=t.x||t.y){const o=this.workspace_.getMetricsManager(),n=o.getScrollMetrics();t=o.getViewMetrics().left-n.left+t;let c;(c=this.workspace_.scrollbar)==null||c.setX(t),Dn(this.workspace_),Ss()}e.preventDefault(),e.stopPropagation()}layout_(e,t){this.workspace_.scale=this.targetWorkspace.scale;const o=this.MARGIN;let n=o+this.tabWidth_;this.RTL&&(e=e.reverse());for(let T=0,B;B=e[T];T++)if(B.type==="block"){var c=B.block;if(c==null)continue;var h=c.getDescendants(!1);for(let it=0,ot;ot=h[it];it++)ot.isInFlyout=!0;h=c.getSvgRoot();const oe=c.getHeightWidth();var $=c.outputConnection?this.tabWidth_:0;$=this.RTL?n+oe.width:n-$,c.moveBy($,o),$=this.createRect_(c,$,o,oe,T),n+=oe.width+t[T],this.addBlockListeners_(h,c,$)}else B.type==="button"&&(c=B.button,this.initFlyoutButton_(c,n,o),n+=c.width+t[T])}isDragTowardWorkspace(e){e=Math.atan2(e.y,e.x)/Math.PI*180;const t=this.dragAngleRange_;return e<90+t&&e>90-t||e>-90-t&&e<-90+t}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;const e=this.svgGroup_.getBoundingClientRect(),t=e.top;return this.toolboxPosition_===xe.TOP?new Je(-1e9,t+e.height,-1e9,1e9):new Je(t,1e9,-1e9,1e9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let e=0;const t=this.workspace_.getTopBlocks(!1);for(let n=0,c;c=t[n];n++)e=Math.max(e,c.getHeightWidth().height);const o=this.buttons_;for(let n=0,c;c=o[n];n++)e=Math.max(e,c.height);if(e+=1.5*this.MARGIN,e*=this.workspace_.scale,e+=gt.scrollbarThickness,this.height_!==e){for(let n=0,c;c=t[n];n++)this.rectMap_.has(c)&&this.moveRectToBlock_(this.rectMap_.get(c),c);this.targetWorkspace.scrollbar||this.autoClose||this.targetWorkspace.getFlyout()!==this||this.toolboxPosition_!==xe.TOP||this.targetWorkspace.translate(this.targetWorkspace.scrollX,this.targetWorkspace.scrollY+e),this.height_=e,this.position(),this.targetWorkspace.resizeContents(),this.targetWorkspace.recordDragTargets()}}};r(z.FLYOUTS_HORIZONTAL_TOOLBOX,Ds,Cv);var dr=class extends Ht{constructor(e,t,o,n,c){super(Ze.SKIP_SETUP),this.defaultType="",this.variableTypes=[],this.variable=null,this.SERIALIZABLE=!0,this.menuGenerator_=dr.dropdownCreate,this.defaultVariableName=typeof e=="string"?e:"",this.size_=new Le(0,0),e!==Ze.SKIP_SETUP&&(c?this.configure_(c):this.setTypes(o,n),t&&this.setValidator(t))}configure_(e){super.configure_(e),this.setTypes(e.variableTypes,e.defaultType)}initModel(){var e=this.getSourceBlock();if(!e)throw new mt;this.variable||(e=i.getOrCreateVariablePackage$$module$build$src$core$variables(e.workspace,null,this.defaultVariableName,this.defaultType),this.doValueUpdate_(e.getId()))}shouldAddBorderRect_(){const e=this.getSourceBlock();if(!e)throw new mt;return super.shouldAddBorderRect_()&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||e.type!=="variables_get")}fromXml(e){var t=this.getSourceBlock();if(!t)throw new mt;const o=e.getAttribute("id"),n=e.textContent,c=e.getAttribute("variabletype")||e.getAttribute("variableType")||"";if(t=i.getOrCreateVariablePackage$$module$build$src$core$variables(t.workspace,o,n,c),c!==null&&c!==t.type)throw Error("Serialized variable type with id '"+t.getId()+"' had type "+t.type+", and does not match variable field that references it: "+Es(e)+".");this.setValue(t.getId())}toXml(e){return this.initModel(),e.id=this.variable.getId(),e.textContent=this.variable.name,this.variable.type&&e.setAttribute("variabletype",this.variable.type),e}saveState(e){var t=this.saveLegacyState(dr);return t!==null||(this.initModel(),t={id:this.variable.getId()},e&&(t.name=this.variable.name,t.type=this.variable.type)),t}loadState(e){const t=this.getSourceBlock();if(!t)throw new mt;this.loadLegacyState(dr,e)||(e=i.getOrCreateVariablePackage$$module$build$src$core$variables(t.workspace,e.id||null,e.name,e.type||""),this.setValue(e.getId()))}setSourceBlock(e){if(e.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");super.setSourceBlock(e)}getValue(){return this.variable?this.variable.getId():null}getText(){return this.variable?this.variable.name:""}getVariable(){return this.variable}getValidator(){return this.variable?this.validator_:null}doClassValidation_(e){if(e===null)return null;var t=this.getSourceBlock();if(!t)throw new mt;return t=i.getVariable$$module$build$src$core$variables(t.workspace,e),t?(t=t.type,this.typeIsAllowed(t)?e:(console.warn("Variable type doesn't match this field! Type was "+t),null)):(console.warn("Variable id doesn't point to a real variable! ID was "+e),null)}doValueUpdate_(e){const t=this.getSourceBlock();if(!t)throw new mt;this.variable=i.getVariable$$module$build$src$core$variables(t.workspace,e),super.doValueUpdate_(e)}typeIsAllowed(e){const t=this.getVariableTypes();if(!t)return!0;for(let o=0;o<t.length;o++)if(e===t[o])return!0;return!1}getVariableTypes(){var e=this.variableTypes;if(e===null&&this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying())return this.sourceBlock_.workspace.getVariableTypes();if(e=e||[""],e.length===0)throw e=this.getText(),Error("'variableTypes' of field variable "+e+" was an empty list");return e}setTypes(e=null,t=""){if(Array.isArray(e)){let o=!1;for(let n=0;n<e.length;n++)e[n]===t&&(o=!0);if(!o)throw Error("Invalid default type '"+t+"' in the definition of a FieldVariable")}else if(e!==null)throw Error("'variableTypes' was not an array in the definition of a FieldVariable");this.defaultType=t,this.variableTypes=e}refreshVariableName(){this.forceRerender()}onItemSelected_(e,t){if(e=t.getValue(),this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()){if(e===Hh){i.renameVariable$$module$build$src$core$variables(this.sourceBlock_.workspace,this.variable);return}if(e===Wh){this.sourceBlock_.workspace.deleteVariableById(this.variable.getId());return}}this.setValue(e)}referencesVariables(){return!0}static fromJson(e){return new this(ht(e.variable),void 0,void 0,void 0,e)}static dropdownCreate(){if(!this.variable)throw Error("Tried to call dropdownCreate on a variable field with no variable selected.");const e=this.getText();let t=[];if(this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying())for(var o=this.getVariableTypes(),n=0;n<o.length;n++){const c=this.sourceBlock_.workspace.getVariablesOfType(o[n]);t=t.concat(c)}for(t.sort(Yn.compareByName),o=[],n=0;n<t.length;n++)o[n]=[t[n].name,t[n].getId()];return o.push([i.Msg$$module$build$src$core$msg.RENAME_VARIABLE,Hh]),i.Msg$$module$build$src$core$msg.DELETE_VARIABLE&&o.push([i.Msg$$module$build$src$core$msg.DELETE_VARIABLE.replace("%1",e),Wh]),o}};Is("field_variable",dr);var rp=class extends Tl{constructor(e,t,o,n,c,h){super(Ze.SKIP_SETUP),this.min_=-1/0,this.max_=1/0,this.precision_=0,this.decimalPlaces=null,this.spellcheck_=!1,e!==Ze.SKIP_SETUP&&(h?this.configure_(h):this.setConstraints(t,o,n),this.setValue(e),c&&this.setValidator(c))}configure_(e){super.configure_(e),this.setMinInternal(e.min),this.setMaxInternal(e.max),this.setPrecisionInternal(e.precision)}setConstraints(e,t,o){this.setMinInternal(e),this.setMaxInternal(t),this.setPrecisionInternal(o),this.setValue(this.getValue())}setMin(e){this.setMinInternal(e),this.setValue(this.getValue())}setMinInternal(e){e==null?this.min_=-1/0:(e=Number(e),isNaN(e)||(this.min_=e))}getMin(){return this.min_}setMax(e){this.setMaxInternal(e),this.setValue(this.getValue())}setMaxInternal(e){e==null?this.max_=1/0:(e=Number(e),isNaN(e)||(this.max_=e))}getMax(){return this.max_}setPrecision(e){this.setPrecisionInternal(e),this.setValue(this.getValue())}setPrecisionInternal(e){this.precision_=Number(e)||0;let t=String(this.precision_);t.includes("e")&&(t=this.precision_.toLocaleString("en-US",{maximumFractionDigits:20}));const o=t.indexOf(".");this.decimalPlaces=o===-1?e?0:null:t.length-o-1}getPrecision(){return this.precision_}doClassValidation_(e){return e===null||(e=`${e}`.replace(/O/gi,"0"),e=e.replace(/,/g,""),e=e.replace(/infinity/i,"Infinity"),e=Number(e||0),isNaN(e))?null:(e=Math.min(Math.max(e,this.min_),this.max_),this.precision_&&isFinite(e)&&(e=Math.round(e/this.precision_)*this.precision_),this.decimalPlaces!==null&&(e=Number(e.toFixed(this.decimalPlaces))),e)}widgetCreate_(){const e=super.widgetCreate_();return-1/0<this.min_&&(e.min=`${this.min_}`,kt(e,yt.VALUEMIN,this.min_)),1/0>this.max_&&(e.max=`${this.max_}`,kt(e,yt.VALUEMAX,this.max_)),e}static fromJson(e){return new this(e.value,void 0,void 0,void 0,void 0,e)}};Is("field_number",rp),rp.prototype.DEFAULT_VALUE=0;var Tv=class extends ti{constructor(e,t,o){super(String(e??""),t,o),this.EDITABLE=!1,this.SERIALIZABLE=!0}static fromJson(e){return new this(ht(e.text),void 0,e)}};Is("field_label_serializable",Tv);var ni=class extends Ze{constructor(e,t,o){super(Ze.SKIP_SETUP),this.SERIALIZABLE=!0,this.CURSOR="default",this.value_=this.value_,this.checkChar=ni.CHECK_CHAR,e!==Ze.SKIP_SETUP&&(o&&this.configure_(o),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),e.checkCharacter&&(this.checkChar=e.checkCharacter)}saveState(){const e=this.saveLegacyState(ni);return e!==null?e:this.getValueBoolean()}initView(){super.initView();const e=this.getTextElement();fe(e,"blocklyCheckbox"),e.style.display=this.value_?"block":"none"}render_(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_(this.getConstants().FIELD_CHECKBOX_X_OFFSET)}getDisplayText_(){return this.checkChar}setCheckCharacter(e){this.checkChar=e||ni.CHECK_CHAR,this.forceRerender()}showEditor_(){this.setValue(!this.value_)}doClassValidation_(e){return e===!0||e==="TRUE"?"TRUE":e===!1||e==="FALSE"?"FALSE":null}doValueUpdate_(e){this.value_=this.convertValueToBool(e),this.textElement_&&(this.textElement_.style.display=this.value_?"block":"none")}getValue(){return this.value_?"TRUE":"FALSE"}getValueBoolean(){return this.value_}getText(){return String(this.convertValueToBool(this.value_))}convertValueToBool(e){return typeof e=="string"?e==="TRUE":!!e}static fromJson(e){return new this(e.checked,void 0,e)}};ni.CHECK_CHAR="✓",Is("field_checkbox",ni),ni.prototype.DEFAULT_VALUE=!1;var kv=class{constructor(e,t){this.draggable=e,this.workspace=t,this.dragTarget=null,this.startLoc=e.getRelativeToSurfaceXY()}onDragStart(e){this.draggable.startDrag(e)}onDrag(e,t){this.moveDraggable(e,t),t=this.getRoot(this.draggable),Qt(t)&&t.setDeleteStyle(this.wouldDeleteDraggable(e,t)),this.updateDragTarget(e)}updateDragTarget(e){e=this.workspace.getDragTarget(e);const t=this.getRoot(this.draggable);if(this.dragTarget!==e){let o;(o=this.dragTarget)==null||o.onDragExit(t),e==null||e.onDragEnter(t)}e==null||e.onDragOver(t),this.dragTarget=e}moveDraggable(e,t){t=this.pixelsToWorkspaceUnits(t),t=K.sum(this.startLoc,t),this.draggable.drag(t,e)}wouldDeleteDraggable(e,t){return(e=this.workspace.getDragTarget(e))&&this.workspace.getComponentManager().hasCapability(e.id,at.Capability.DELETE_AREA)?e.wouldDelete(t):!1}onDragEnd(e){const t=i.getGroup$$module$build$src$core$events$utils();var o=this.workspace.getDragTarget(e);const n=this.getRoot(this.draggable);if(o){let c;(c=this.dragTarget)==null||c.onDrop(n)}this.shouldReturnToStart(e,n)&&this.draggable.revertDrag(),(o=Qt(n)&&this.wouldDeleteDraggable(e,n))&&this.draggable instanceof ns&&wa(this.draggable.getRootBlock()),this.draggable.endDrag(e),o&&Qt(n)&&(e=i.getGroup$$module$build$src$core$events$utils(),i.setGroup$$module$build$src$core$events$utils(t),n.dispose(),i.setGroup$$module$build$src$core$events$utils(e))}getRoot(e){return e instanceof ns?e.getRootBlock():e}shouldReturnToStart(e,t){return(e=this.workspace.getDragTarget(e))?e.shouldPreventMove(t):!1}pixelsToWorkspaceUnits(e){return e=new K(e.x/this.workspace.scale,e.y/this.workspace.scale),this.workspace.isMutator&&e.scale(1/this.workspace.options.parentWorkspace.scale),e}};r(z.BLOCK_DRAGGER,Ds,kv);var hr={};hr.BlockDragStrategy=ev,hr.BubbleDragStrategy=Lb,hr.CommentDragStrategy=Db,hr.Dragger=kv;var ap=class extends gs{constructor(e,t,o){super(e?e.workspace.id:void 0),this.type=M.BLOCK_DRAG,e&&(this.blockId=e.id,this.isStart=t,this.blocks=o)}toJson(){const e=super.toJson();if(this.isStart===void 0)throw Error("Whether this event is the start of a drag is undefined. Either pass the value to the constructor, or call fromJson");if(this.blockId===void 0)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");return e.isStart=this.isStart,e.blockId=this.blockId,e.blocks=this.blocks,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new ap),t.isStart=e.isStart,t.blockId=e.blockId,t.blocks=e.blocks,t}};r(z.EVENT,M.BLOCK_DRAG,ap);var lp=class extends Yo{constructor(e,t,o,n){super(e),this.type=M.BLOCK_FIELD_INTERMEDIATE_CHANGE,this.recordUndo=!1,e&&(this.name=t,this.oldValue=o,this.newValue=n)}toJson(){const e=super.toJson();if(!this.name)throw Error("The changed field name is undefined. Either pass a name to the constructor, or call fromJson.");return e.name=this.name,e.oldValue=this.oldValue,e.newValue=this.newValue,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new lp),t.name=e.name,t.oldValue=e.oldValue,t.newValue=e.newValue,t}isNull(){return this.oldValue===this.newValue}run(e){var t=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");if(t=t.getBlockById(this.blockId),!t)throw Error("The associated block is undefined. Either pass a block to the constructor, or call fromJson");e=e?this.newValue:this.oldValue,(t=t.getField(this.name))?t.setValue(e):console.warn("Can't set non-existent field: "+this.name)}};r(z.EVENT,M.BLOCK_FIELD_INTERMEDIATE_CHANGE,lp);var cp=class extends Yo{constructor(e){super(e),this.type=M.BLOCK_MOVE,e&&(e.isShadow()&&(this.recordUndo=!1),e=this.currentLocation(),this.oldParentId=e.parentId,this.oldInputName=e.inputName,this.oldCoordinate=e.coordinate)}toJson(){const e=super.toJson();return e.oldParentId=this.oldParentId,e.oldInputName=this.oldInputName,this.oldCoordinate&&(e.oldCoordinate=`${Math.round(this.oldCoordinate.x)}, ${Math.round(this.oldCoordinate.y)}`),e.newParentId=this.newParentId,e.newInputName=this.newInputName,this.newCoordinate&&(e.newCoordinate=`${Math.round(this.newCoordinate.x)}, ${Math.round(this.newCoordinate.y)}`),this.reason&&(e.reason=this.reason),this.recordUndo||(e.recordUndo=this.recordUndo),e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new cp),t.oldParentId=e.oldParentId,t.oldInputName=e.oldInputName,e.oldCoordinate&&(o=e.oldCoordinate.split(","),t.oldCoordinate=new K(Number(o[0]),Number(o[1]))),t.newParentId=e.newParentId,t.newInputName=e.newInputName,e.newCoordinate&&(o=e.newCoordinate.split(","),t.newCoordinate=new K(Number(o[0]),Number(o[1]))),e.reason!==void 0&&(t.reason=e.reason),e.recordUndo!==void 0&&(t.recordUndo=e.recordUndo),t}recordNew(){const e=this.currentLocation();this.newParentId=e.parentId,this.newInputName=e.inputName,this.newCoordinate=e.coordinate}setReason(e){this.reason=e}currentLocation(){var e=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");var t=e.getBlockById(this.blockId);if(!t)throw Error("The block associated with the block move event could not be found");e={};const o=t.getParent();return o?(e.parentId=o.id,(t=o.getInputWithBlock(t))&&(e.inputName=t.name)):e.coordinate=t.getRelativeToSurfaceXY(),e}isNull(){return this.oldParentId===this.newParentId&&this.oldInputName===this.newInputName&&K.equals(this.oldCoordinate,this.newCoordinate)}run(e){var t=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");var o=t.getBlockById(this.blockId);if(o){var n=e?this.newParentId:this.oldParentId,c=e?this.newInputName:this.oldInputName;if(e=e?this.newCoordinate:this.oldCoordinate,n){var h=t.getBlockById(n);if(!h){console.warn("Can't connect to non-existent block: "+n);return}}if(o.getParent()&&o.unplug(),e)c=o.getRelativeToSurfaceXY(),o.moveBy(e.x-c.x,e.y-c.y,this.reason);else{t=o.outputConnection,(!t||o.previousConnection&&o.previousConnection.isConnected())&&(t=o.previousConnection);let $,T;o=(T=t)==null?void 0:T.type,c?(o=h.getInput(c))&&($=o.connection):o===ne.PREVIOUS_STATEMENT&&($=h.nextConnection),$&&t?t.connect($):console.warn("Can't connect to non-existent input: "+c)}}else console.warn("Can't move non-existent block: "+this.blockId)}};r(z.EVENT,M.BLOCK_MOVE,cp);var up=class extends gs{constructor(e,t,o){super(e?e.workspace.id:void 0),this.type=M.BUBBLE_OPEN,e&&(this.blockId=e.id,this.isOpen=t,this.bubbleType=o)}toJson(){const e=super.toJson();if(this.isOpen===void 0)throw Error("Whether this event is for opening the bubble is undefined. Either pass the value to the constructor, or call fromJson");if(!this.bubbleType)throw Error("The type of bubble is undefined. Either pass the value to the constructor, or call fromJson");return e.isOpen=this.isOpen,e.bubbleType=this.bubbleType,e.blockId=this.blockId||"",e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new up),t.isOpen=e.isOpen,t.bubbleType=e.bubbleType,t.blockId=e.blockId,t}},dp;(function(e){e.MUTATOR="mutator",e.COMMENT="comment",e.WARNING="warning"})(dp||(dp={})),r(z.EVENT,M.BUBBLE_OPEN,up);var Ls=class extends Ii{constructor(e){super(),this.isBlank=!e,e&&(this.commentId=e.id,this.workspaceId=e.workspace.id,this.group=i.getGroup$$module$build$src$core$events$utils(),this.recordUndo=$e())}toJson(){const e=super.toJson();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");return e.commentId=this.commentId,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Ls),t.commentId=e.commentId,t}static CommentCreateDeleteHelper(e,t){const o=e.getEventWorkspace_();if(t){if(!e.json)throw Error("Encountered a comment event without proper json");wn(e.json,o)}else{if(!e.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");(t=o.getCommentById(e.commentId))?t.dispose():console.warn("Can't delete non-existent comment: "+e.commentId)}}},hp=class extends Ls{constructor(e,t,o){super(e),this.type=M.COMMENT_CHANGE,e&&(this.oldContents_=typeof t>"u"?"":t,this.newContents_=typeof o>"u"?"":o)}toJson(){const e=super.toJson();if(!this.oldContents_)throw Error("The old contents is undefined. Either pass a value to the constructor, or call fromJson");if(!this.newContents_)throw Error("The new contents is undefined. Either pass a value to the constructor, or call fromJson");return e.oldContents=this.oldContents_,e.newContents=this.newContents_,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new hp),t.oldContents_=e.oldContents,t.newContents_=e.newContents,t}isNull(){return this.oldContents_===this.newContents_}run(e){var t=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");if(t=t.getCommentById(this.commentId)){var o=e?this.newContents_:this.oldContents_;if(o===void 0)throw Error(e?"The new contents is undefined. Either pass a value to the constructor, or call fromJson":"The old contents is undefined. Either pass a value to the constructor, or call fromJson");t.setText(o)}else console.warn("Can't change non-existent comment: "+this.commentId)}};r(z.EVENT,M.COMMENT_CHANGE,hp);var pp=class extends Ls{constructor(e,t){super(e),this.newCollapsed=t,this.type=M.COMMENT_COLLAPSE}toJson(){const e=super.toJson();if(this.newCollapsed===void 0)throw Error("The new collapse value undefined. Either call recordNew, or call fromJson");return e.newCollapsed=this.newCollapsed,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new pp),t.newCollapsed=e.newCollapsed,t}run(e){var t=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");(t=t.getCommentById(this.commentId))?t.setCollapsed(e?!!this.newCollapsed:!this.newCollapsed):console.warn("Can't collapse or uncollapse non-existent comment: "+this.commentId)}};r(z.EVENT,M.COMMENT_COLLAPSE,pp);var gp=class extends Ls{constructor(e){super(e),this.type=M.COMMENT_CREATE,e&&(this.xml=On(e),this.json=mi(e,{addCoordinates:!0}))}toJson(){const e=super.toJson();if(!this.xml)throw Error("The comment XML is undefined. Either pass a comment to the constructor, or call fromJson");if(!this.json)throw Error("The comment JSON is undefined. Either pass a block to the constructor, or call fromJson");return e.xml=Es(this.xml),e.json=this.json,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new gp),t.xml=i.textToDom$$module$build$src$core$utils$xml(e.xml),t.json=e.json,t}run(e){Ls.CommentCreateDeleteHelper(this,e)}};r(z.EVENT,M.COMMENT_CREATE,gp);var mp=class extends Ls{constructor(e){super(e),this.type=M.COMMENT_DELETE,e&&(this.xml=On(e),this.json=mi(e,{addCoordinates:!0}))}run(e){Ls.CommentCreateDeleteHelper(this,!e)}toJson(){const e=super.toJson();if(!this.xml)throw Error("The comment XML is undefined. Either pass a comment to the constructor, or call fromJson");if(!this.json)throw Error("The comment JSON is undefined. Either pass a block to the constructor, or call fromJson");return e.xml=Es(this.xml),e.json=this.json,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new mp),t.xml=i.textToDom$$module$build$src$core$utils$xml(e.xml),t.json=e.json,t}};r(z.EVENT,M.COMMENT_DELETE,mp);var fp=class extends gs{constructor(e,t){super(e?e.workspace.id:void 0),this.type=M.COMMENT_DRAG,e&&(this.commentId=e.id,this.isStart=t)}toJson(){const e=super.toJson();if(this.isStart===void 0)throw Error("Whether this event is the start of a drag is undefined. Either pass the value to the constructor, or call fromJson");if(this.commentId===void 0)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");return e.isStart=this.isStart,e.commentId=this.commentId,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new fp),t.isStart=e.isStart,t.commentId=e.commentId,t}};r(z.EVENT,M.COMMENT_DRAG,fp);var $p=class extends Ls{constructor(e){super(e),this.type=M.COMMENT_MOVE,e&&(this.comment_=e,this.oldCoordinate_=e.getRelativeToSurfaceXY())}recordNew(){if(this.newCoordinate_)throw Error("Tried to record the new position of a comment on the same event twice.");if(!this.comment_)throw Error("The comment is undefined. Pass a comment to the constructor if you want to use the record functionality");this.newCoordinate_=this.comment_.getRelativeToSurfaceXY()}setReason(e){this.reason=e}setOldCoordinate(e){this.oldCoordinate_=e}toJson(){const e=super.toJson();if(!this.oldCoordinate_)throw Error("The old comment position is undefined. Either pass a comment to the constructor, or call fromJson");if(!this.newCoordinate_)throw Error("The new comment position is undefined. Either call recordNew, or call fromJson");return e.oldCoordinate=`${Math.round(this.oldCoordinate_.x)}, ${Math.round(this.oldCoordinate_.y)}`,e.newCoordinate=Math.round(this.newCoordinate_.x)+","+Math.round(this.newCoordinate_.y),e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new $p),o=e.oldCoordinate.split(","),t.oldCoordinate_=new K(Number(o[0]),Number(o[1])),o=e.newCoordinate.split(","),t.newCoordinate_=new K(Number(o[0]),Number(o[1])),t}isNull(){return K.equals(this.oldCoordinate_,this.newCoordinate_)}run(e){var t=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");if(t=t.getCommentById(this.commentId)){if(e=e?this.newCoordinate_:this.oldCoordinate_,!e)throw Error("Either oldCoordinate_ or newCoordinate_ is undefined. Either pass a comment to the constructor and call recordNew, or call fromJson");t.moveTo(e)}else console.warn("Can't move non-existent comment: "+this.commentId)}};r(z.EVENT,M.COMMENT_MOVE,$p);var bp=class extends Ls{constructor(e){super(e),this.type=M.COMMENT_RESIZE,e&&(this.oldSize=e.getSize())}recordCurrentSizeAsNewSize(){if(this.newSize)throw Error("Tried to record the new size of a comment on the same event twice.");var e=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");if(e=e.getCommentById(this.commentId),!e)throw Error("The comment associated with the comment resize event could not be found");this.newSize=e.getSize()}toJson(){const e=super.toJson();if(!this.oldSize)throw Error("The old comment size is undefined. Either pass a comment to the constructor, or call fromJson");if(!this.newSize)throw Error("The new comment size is undefined. Either call recordCurrentSizeAsNewSize, or call fromJson");return e.oldWidth=Math.round(this.oldSize.width),e.oldHeight=Math.round(this.oldSize.height),e.newWidth=Math.round(this.newSize.width),e.newHeight=Math.round(this.newSize.height),e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new bp),t.oldSize=new Le(e.oldWidth,e.oldHeight),t.newSize=new Le(e.newWidth,e.newHeight),t}isNull(){return Le.equals(this.oldSize,this.newSize)}run(e){var t=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");if(t=t.getCommentById(this.commentId)){if(e=e?this.newSize:this.oldSize,!e)throw Error("Either oldSize or newSize is undefined. Either pass a comment to the constructor and call recordCurrentSizeAsNewSize, or call fromJson");t.setSize(e)}else console.warn("Can't resize non-existent comment: "+this.commentId)}};r(z.EVENT,M.COMMENT_RESIZE,bp);var vp=class extends gs{constructor(e,t,o){super(o),this.type=M.TOOLBOX_ITEM_SELECT,this.oldItem=e??void 0,this.newItem=t??void 0}toJson(){const e=super.toJson();return e.oldItem=this.oldItem,e.newItem=this.newItem,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new vp),t.oldItem=e.oldItem,t.newItem=e.newItem,t}};r(z.EVENT,M.TOOLBOX_ITEM_SELECT,vp);var Sv=class extends Ii{constructor(e){super(),this.isBlank=!0,this.recordUndo=!1,this.type=M.FINISHED_LOADING,this.isBlank=!!e,e&&(this.workspaceId=e.id)}};r(z.EVENT,M.FINISHED_LOADING,Sv);var Ev,Iv,xv,Dv,Av,Rv,Ov,Mv,Nv,Lv,Bv,Pv,Fv,jv,zv,Uv,Hv,Wv,Vv,Gv,Kv,Yv,Jv,Xv,qv,te;i.BLOCK_CHANGE$$module$build$src$core$events$events=M.BLOCK_CHANGE,i.BLOCK_CREATE$$module$build$src$core$events$events=M.BLOCK_CREATE,i.BLOCK_DELETE$$module$build$src$core$events$events=M.BLOCK_DELETE,Ev=M.BLOCK_DRAG,i.BLOCK_MOVE$$module$build$src$core$events$events=M.BLOCK_MOVE,Iv=M.BLOCK_FIELD_INTERMEDIATE_CHANGE,xv=M.BUBBLE_OPEN,Dv=M.BLOCK_CHANGE,Av=M.CLICK,Rv=M.COMMENT_CHANGE,Ov=M.COMMENT_CREATE,Mv=M.COMMENT_DELETE,Nv=M.COMMENT_MOVE,Lv=M.COMMENT_RESIZE,Bv=M.COMMENT_DRAG,Pv=M.BLOCK_CREATE,Fv=M.BLOCK_DELETE,jv=M.FINISHED_LOADING,zv=M.MARKER_MOVE,Uv=M.BLOCK_MOVE,Hv=M.SELECTED,Wv=M.THEME_CHANGE,Vv=M.TOOLBOX_ITEM_SELECT,Gv=M.TRASHCAN_OPEN,Kv=M.UI,Yv=M.VAR_CREATE,Jv=M.VAR_DELETE,Xv=M.VAR_RENAME,qv=M.VIEWPORT_CHANGE,te={},te.Abstract=Ii,te.BLOCK_CHANGE=i.BLOCK_CHANGE$$module$build$src$core$events$events,te.BLOCK_CREATE=i.BLOCK_CREATE$$module$build$src$core$events$events,te.BLOCK_DELETE=i.BLOCK_DELETE$$module$build$src$core$events$events,te.BLOCK_DRAG=Ev,te.BLOCK_FIELD_INTERMEDIATE_CHANGE=Iv,te.BLOCK_MOVE=i.BLOCK_MOVE$$module$build$src$core$events$events,te.BUBBLE_OPEN=xv,te.BUMP_EVENTS=E$,te.BlockBase=Yo,te.BlockChange=Jo,te.BlockCreate=Sh,te.BlockDelete=Fh,te.BlockDrag=ap,te.BlockFieldIntermediateChange=lp,te.BlockMove=cp,te.BubbleOpen=up,te.BubbleType=dp,te.CHANGE=Dv,te.CLICK=Av,te.COMMENT_CHANGE=Rv,te.COMMENT_CREATE=Ov,te.COMMENT_DELETE=Mv,te.COMMENT_DRAG=Bv,te.COMMENT_MOVE=Nv,te.COMMENT_RESIZE=Lv,te.CREATE=Pv,te.Click=Vd,te.ClickTarget=Gd,te.CommentBase=Ls,te.CommentChange=hp,te.CommentCollapse=pp,te.CommentCreate=gp,te.CommentDelete=mp,te.CommentDrag=fp,te.CommentMove=$p,te.CommentResize=bp,te.DELETE=Fv,te.FINISHED_LOADING=jv,te.FinishedLoading=Sv,te.MARKER_MOVE=zv,te.MOVE=Uv,te.MarkerMove=jh,te.SELECTED=Hv,te.Selected=Yh,te.THEME_CHANGE=Wv,te.TOOLBOX_ITEM_SELECT=Vv,te.TRASHCAN_OPEN=Gv,te.ThemeChange=Eh,te.ToolboxItemSelect=vp,te.TrashcanOpen=Xh,te.UI=Kv,te.UiBase=gs,te.VAR_CREATE=Yv,te.VAR_DELETE=Jv,te.VAR_RENAME=Xv,te.VIEWPORT_CHANGE=qv,te.VarBase=Kn,te.VarCreate=hh,te.VarDelete=Vh,te.VarRename=Gh,te.ViewportChange=Ih,te.clearPendingUndo=de,te.disable=i.disable$$module$build$src$core$events$utils,te.disableOrphans=et,te.enable=i.enable$$module$build$src$core$events$utils,te.filter=ce,te.fire=U,te.fromJson=Fe,te.get=Y,te.getDescendantIds=ge,te.getGroup=i.getGroup$$module$build$src$core$events$utils,te.getRecordUndo=$e,te.isEnabled=J,te.setGroup=i.setGroup$$module$build$src$core$events$utils,te.setRecordUndo=i.setRecordUndo$$module$build$src$core$events$utils;var ys={};ys.BottomRow=pv,ys.ConstantProvider=dv,ys.Drawer=hv,ys.MarkerSvg=$v,ys.PathObject=bv,ys.RenderInfo=fv,ys.Renderer=ip,ys.RightConnectionShape=gv,ys.StatementInput=Sl,ys.TopRow=mv,zd();var _t={};_t.registerCleanup=kd,_t.registerCollapse=Ed,_t.registerCollapseExpandBlock=Md,_t.registerComment=Rd,_t.registerCommentCreate=jd,_t.registerCommentDelete=Pd,_t.registerCommentDuplicate=Fd,_t.registerCommentOptions=_$,_t.registerDefaultOptions=zd,_t.registerDelete=Ld,_t.registerDeleteAll=Dd,_t.registerDisable=Nd,_t.registerDuplicate=Ad,_t.registerExpand=Id,_t.registerHelp=Bd,_t.registerInline=Od,_t.registerRedo=Td,_t.registerUndo=Cd;var Il={};Il.CommentView=Rb,Il.RenderedWorkspaceComment=rl,Il.WorkspaceComment=nl;var pr={};pr.Bubble=Ke,pr.MiniWorkspaceBubble=to,pr.TextBubble=Ub,pr.TextInputBubble=Bb;var Zv=class extends ml{constructor(){super(),this.FIELD_TEXT_BASELINE_CENTER=!1,this.DARK_PATH_OFFSET=1,this.MAX_BOTTOM_WIDTH=30,this.STATEMENT_BOTTOM_SPACER=-this.NOTCH_HEIGHT/2}getCSS_(e){return super.getCSS_(e).concat([`${e} .blocklyInsertionMarker>.blocklyPathLight,`,`${e} .blocklyInsertionMarker>.blocklyPathDark {`,`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,"stroke: none;","}"])}},Qv=class{constructor(e){this.inlineSteps_=this.steps_="",this.info_=e,this.RTL_=this.info_.RTL,e=e.getRenderer(),this.constants_=e.getConstants(),this.highlightConstants_=e.getHighlightConstants(),this.highlightOffset=this.highlightConstants_.OFFSET,this.outsideCornerPaths_=this.highlightConstants_.OUTSIDE_CORNER,this.insideCornerPaths_=this.highlightConstants_.INSIDE_CORNER,this.puzzleTabPaths_=this.highlightConstants_.PUZZLE_TAB,this.notchPaths_=this.highlightConstants_.NOTCH,this.startPaths_=this.highlightConstants_.START_HAT,this.jaggedTeethPaths_=this.highlightConstants_.JAGGED_TEETH}getPath(){return this.steps_+`
925
+ `+this.inlineSteps_}drawTopCorner(e){this.steps_+=rt(e.xPos,this.info_.startY);for(let t=0,o;o=e.elements[t];t++)E.isLeftSquareCorner(o)?this.steps_+=this.highlightConstants_.START_POINT:E.isLeftRoundedCorner(o)?this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):E.isPreviousConnection(o)?this.steps_+=this.notchPaths_.pathLeft:E.isHat(o)?this.steps_+=this.startPaths_.path(this.RTL_):E.isSpacer(o)&&o.width!==0&&(this.steps_+=ae("H",o.xPos+o.width-this.highlightOffset));this.steps_+=ae("H",e.xPos+e.width-this.highlightOffset)}drawJaggedEdge_(e){this.info_.RTL&&(this.steps_+=this.jaggedTeethPaths_.pathLeft+ae("v",e.height-this.jaggedTeethPaths_.height-this.highlightOffset))}drawValueInput(e){const t=e.getLastInput();if(this.RTL_){const o=e.height-t.connectionHeight;this.steps_+=vt(t.xPos+t.width-this.highlightOffset,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+ae("v",o)}else this.steps_+=vt(t.xPos+t.width,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)}drawStatementInput(e){const t=e.getLastInput();if(t)if(this.RTL_){const o=e.height-2*this.insideCornerPaths_.height;this.steps_+=vt(t.xPos,e.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+ae("v",o)+this.insideCornerPaths_.pathBottom(this.RTL_)+xs(e.width-t.xPos-this.insideCornerPaths_.width,0)}else this.steps_+=vt(t.xPos,e.yPos+e.height)+this.insideCornerPaths_.pathBottom(this.RTL_)+xs(e.width-t.xPos-this.insideCornerPaths_.width,0)}drawRightSideRow(e){const t=e.xPos+e.width-this.highlightOffset;e instanceof Bh&&e.followsStatement&&(this.steps_+=ae("H",t)),this.RTL_&&(this.steps_+=ae("H",t),e.height>this.highlightOffset&&(this.steps_+=ae("V",e.yPos+e.height-this.highlightOffset)))}drawBottomRow(e){if(this.RTL_)this.steps_+=ae("V",e.baseline-this.highlightOffset);else{const t=this.info_.bottomRow.elements[0];E.isLeftSquareCorner(t)?this.steps_+=vt(e.xPos+this.highlightOffset,e.baseline-this.highlightOffset):E.isLeftRoundedCorner(t)&&(this.steps_+=vt(e.xPos,e.baseline),this.steps_+=this.outsideCornerPaths_.bottomLeft())}}drawLeft(){var e=this.info_.outputConnection;e&&(e=e.connectionOffsetY+e.height,this.RTL_?this.steps_+=vt(this.info_.startX,e):(this.steps_+=vt(this.info_.startX+this.highlightOffset,this.info_.bottomRow.baseline-this.highlightOffset),this.steps_+=ae("V",e)),this.steps_+=this.puzzleTabPaths_.pathUp(this.RTL_)),this.RTL_||(e=this.info_.topRow,E.isLeftRoundedCorner(e.elements[0])?this.steps_+=ae("V",this.outsideCornerPaths_.height):this.steps_+=ae("V",e.capline+this.highlightOffset))}drawInlineInput(e){const t=this.highlightOffset,o=e.xPos+e.connectionWidth;var n=e.centerline-e.height/2;const c=e.width-e.connectionWidth,h=n+t;this.RTL_?(n=e.connectionOffsetY-t,e=e.height-(e.connectionOffsetY+e.connectionHeight)+t,this.inlineSteps_+=vt(o-t,h)+ae("v",n)+this.puzzleTabPaths_.pathDown(this.RTL_)+ae("v",e)+ae("h",c)):this.inlineSteps_+=vt(e.xPos+e.width+t,h)+ae("v",e.height)+ae("h",-c)+vt(o,n+e.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_)}},ey=class extends fl{constructor(e,t){super(e,t),this.highlighter_=new Qv(t)}draw(){this.drawOutline_(),this.drawInternals_(),this.updateConnectionHighlights();const e=this.block_.pathObject;e.setPath(this.outlinePath_+`
926
+ `+this.inlinePath_),e.setHighlightPath(this.highlighter_.getPath()),this.info_.RTL&&e.flipRTL(),this.recordSizeOnBlock_()}drawTop_(){this.highlighter_.drawTopCorner(this.info_.topRow),this.highlighter_.drawRightSideRow(this.info_.topRow),super.drawTop_()}drawJaggedEdge_(e){this.highlighter_.drawJaggedEdge_(e),super.drawJaggedEdge_(e)}drawValueInput_(e){this.highlighter_.drawValueInput(e),super.drawValueInput_(e)}drawStatementInput_(e){this.highlighter_.drawStatementInput(e),super.drawStatementInput_(e)}drawRightSideRow_(e){this.highlighter_.drawRightSideRow(e),this.outlinePath_+=ae("H",e.xPos+e.width)+ae("V",e.yPos+e.height)}drawBottom_(){this.highlighter_.drawBottomRow(this.info_.bottomRow),super.drawBottom_()}drawLeft_(){this.highlighter_.drawLeft(),super.drawLeft_()}drawInlineInput_(e){this.highlighter_.drawInlineInput(e),super.drawInlineInput_(e)}positionInlineInputConnection_(e){const t=e.centerline-e.height/2;if(e.connectionModel){let o=e.xPos+e.connectionWidth+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(o*=-1),e.connectionModel.setOffsetInBlock(o,t+e.connectionOffsetY+this.constants_.DARK_PATH_OFFSET)}}positionStatementInputConnection_(e){const t=e.getLastInput();if(t!=null&&t.connectionModel){let o=e.xPos+e.statementEdge+t.notchOffset;o=this.info_.RTL?-1*o:o+this.constants_.DARK_PATH_OFFSET,t.connectionModel.setOffsetInBlock(o,e.yPos+this.constants_.DARK_PATH_OFFSET)}}positionExternalValueConnection_(e){const t=e.getLastInput();if(t&&t.connectionModel){let o=e.xPos+e.width+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(o*=-1),t.connectionModel.setOffsetInBlock(o,e.yPos)}}positionNextConnection_(){const e=this.info_.bottomRow;if(e.connection){const t=e.connection,o=t.xPos;t.connectionModel.setOffsetInBlock((this.info_.RTL?-o:o)+this.constants_.DARK_PATH_OFFSET/2,e.baseline+this.constants_.DARK_PATH_OFFSET)}}},ty=class{constructor(e){this.OFFSET=.5,this.constantProvider=e,this.START_POINT=rt(this.OFFSET,this.OFFSET)}init(){this.INSIDE_CORNER=this.makeInsideCorner(),this.OUTSIDE_CORNER=this.makeOutsideCorner(),this.PUZZLE_TAB=this.makePuzzleTab(),this.NOTCH=this.makeNotch(),this.JAGGED_TEETH=this.makeJaggedTeeth(),this.START_HAT=this.makeStartHat()}makeInsideCorner(){const e=this.constantProvider.CORNER_RADIUS,t=this.OFFSET,o=(1-Math.SQRT1_2)*(e+t)-t,n=rt(o,o)+pt("a","0 0,0",e,he(-o-t,e-o)),c=pt("a","0 0,0",e+t,he(e+t,e+t)),h=rt(o,-o)+pt("a","0 0,0",e+t,he(e-o,o+t));return{width:e+t,height:e,pathTop($){return $?n:""},pathBottom($){return $?c:h}}}makeOutsideCorner(){const e=this.constantProvider.CORNER_RADIUS,t=this.OFFSET,o=(1-Math.SQRT1_2)*(e-t)+t,n=rt(o,o)+pt("a","0 0,1",e-t,he(e-o,-o+t)),c=rt(t,e)+pt("a","0 0,1",e-t,he(e,-e+t)),h=-o,$=rt(o,h)+pt("a","0 0,1",e-t,he(-o+t,-h-e));return{height:e,topLeft(T){return T?n:c},bottomLeft(){return $}}}makePuzzleTab(){const e=this.constantProvider.TAB_WIDTH,t=this.constantProvider.TAB_HEIGHT,o=rt(-2,-t+3.4)+xs(-.45*e,-2.1),n=ae("v",2.5)+rt(.97*-e,2.5)+zt("q",[he(.05*-e,10),he(.3*e,9.5)])+rt(.67*e,-1.9)+ae("v",2.5),c=ae("v",-1.5)+rt(-.92*e,-.5)+zt("q",[he(-.19*e,-5.5),he(0,-11)])+rt(.92*e,1),h=rt(-5,t-.7)+xs(.46*e,-2.1);return{width:e,height:t,pathUp($){return $?o:c},pathDown($){return $?n:h}}}makeNotch(){return{pathLeft:ae("h",this.OFFSET)+this.constantProvider.NOTCH.pathLeft}}makeJaggedTeeth(){return{pathLeft:xs(5.1,2.6)+rt(-10.2,6.8)+xs(5.1,2.6),height:12,width:10.2}}makeStartHat(){const e=this.constantProvider.START_HAT.height,t=rt(25,-8.7)+zt("c",[he(29.7,-6.2),he(57.2,-.5),he(75,8.7)]),o=zt("c",[he(17.8,-9.2),he(45.3,-14.9),he(75,-8.7)])+vt(100.5,e+.5);return{path(n){return n?t:o}}}},sy=class extends Nh{constructor(e,t){super(e,t),this.constants_=e,this.connectedBlock&&(this.width+=this.constants_.DARK_PATH_OFFSET,this.height+=this.constants_.DARK_PATH_OFFSET)}},oy=class extends ir{constructor(e,t){super(e,t),this.constants_=e,this.connectedBlock&&(this.height+=this.constants_.DARK_PATH_OFFSET)}},iy=class extends ar{constructor(e,t){super(e,t),this.renderer_=e}getRenderer(){return this.renderer_}populateBottomRow_(){super.populateBottomRow_(),this.block_.inputList.length&&this.block_.inputList[this.block_.inputList.length-1]instanceof qt||(this.bottomRow.minHeight=this.constants_.MEDIUM_PADDING-this.constants_.DARK_PATH_OFFSET)}addInput_(e,t){this.isInline&&e instanceof i.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new sy(this.constants_,e)),t.hasInlineInput=!0):e instanceof qt?(t.elements.push(new oy(this.constants_,e)),t.hasStatement=!0):e instanceof i.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new gl(this.constants_,e)),t.hasExternalInput=!0):(e instanceof Os||e instanceof ro)&&(t.minHeight=Math.max(t.minHeight,this.constants_.DUMMY_INPUT_MIN_HEIGHT),t.hasDummyInput=!0),this.isInline||t.align!==null||(t.align=e.align)}addElemSpacing_(){let e=!1;for(let o=0,n;n=this.rows[o];o++)n.hasExternalInput&&(e=!0);for(let o=0,n;n=this.rows[o];o++){var t=n.elements;if(n.elements=[],n.startsWithElemSpacer()&&n.elements.push(new Xt(this.constants_,this.getInRowSpacing_(null,t[0]))),t.length){for(let c=0;c<t.length-1;c++){n.elements.push(t[c]);const h=this.getInRowSpacing_(t[c],t[c+1]);n.elements.push(new Xt(this.constants_,h))}n.elements.push(t[t.length-1]),n.endsWithElemSpacer()&&(t=this.getInRowSpacing_(t[t.length-1],null),e&&n.hasDummyInput&&(t+=this.constants_.TAB_WIDTH),n.elements.push(new Xt(this.constants_,t)))}}}getInRowSpacing_(e,t){if(!e)return t&&E.isField(t)&&t.isEditable?this.constants_.MEDIUM_PADDING:t&&E.isInlineInput(t)?this.constants_.MEDIUM_LARGE_PADDING:t&&E.isStatementInput(t)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!E.isInput(e)&&(!t||E.isStatementInput(t)))return E.isField(e)&&e.isEditable?this.constants_.MEDIUM_PADDING:E.isIcon(e)?2*this.constants_.LARGE_PADDING+1:E.isHat(e)?this.constants_.NO_PADDING:E.isPreviousOrNextConnection(e)?this.constants_.LARGE_PADDING:E.isLeftRoundedCorner(e)?this.constants_.MIN_BLOCK_WIDTH:E.isJaggedEdge(e)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(E.isInput(e)&&!t){if(E.isExternalInput(e))return this.constants_.NO_PADDING;if(E.isInlineInput(e))return this.constants_.LARGE_PADDING;if(E.isStatementInput(e))return this.constants_.NO_PADDING}if(!E.isInput(e)&&t&&E.isInput(t)){if(E.isField(e)&&e.isEditable){if(E.isInlineInput(t)||E.isExternalInput(t))return this.constants_.SMALL_PADDING}else{if(E.isInlineInput(t)||E.isExternalInput(t))return this.constants_.MEDIUM_LARGE_PADDING;if(E.isStatementInput(t))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(E.isIcon(e)&&t&&!E.isInput(t))return this.constants_.LARGE_PADDING;if(E.isInlineInput(e)&&t&&E.isField(t))return t.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(E.isLeftSquareCorner(e)&&t){if(E.isHat(t))return this.constants_.NO_PADDING;if(E.isPreviousConnection(t))return t.notchOffset;if(E.isNextConnection(t))return t.notchOffset+(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2}if(E.isLeftRoundedCorner(e)&&t){if(E.isPreviousConnection(t))return t.notchOffset-this.constants_.CORNER_RADIUS;if(E.isNextConnection(t))return t.notchOffset-this.constants_.CORNER_RADIUS+(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2}return E.isField(e)&&t&&E.isField(t)&&e.isEditable===t.isEditable||t&&E.isJaggedEdge(t)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getSpacerRowHeight_(e,t){return E.isTopRow(e)&&E.isBottomRow(t)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:E.isTopRow(e)||E.isBottomRow(t)?this.constants_.NO_PADDING:e.hasExternalInput&&t.hasExternalInput?this.constants_.LARGE_PADDING:!e.hasStatement&&t.hasStatement?this.constants_.BETWEEN_STATEMENT_PADDING_Y:e.hasStatement&&t.hasStatement||!e.hasStatement&&t.hasDummyInput||e.hasDummyInput?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getElemCenterline_(e,t){if(E.isSpacer(t))return e.yPos+t.height/2;if(E.isBottomRow(e))return e=e.yPos+e.height-e.descenderHeight,E.isNextConnection(t)?e+t.height/2:e-t.height/2;if(E.isTopRow(e))return E.isHat(t)?e.capline-t.height/2:e.capline+t.height/2;let o=e.yPos;return E.isField(t)||E.isIcon(t)?(o+=t.height/2,(e.hasInlineInput||e.hasStatement)&&t.height+this.constants_.TALL_INPUT_FIELD_OFFSET_Y<=e.height&&(o+=this.constants_.TALL_INPUT_FIELD_OFFSET_Y)):o=E.isInlineInput(t)?o+t.height/2:o+e.height/2,o}alignRowElements_(){if(this.isInline){var e=0,t=new WeakMap,o=null;for(let n=this.rows.length-1,c;c=this.rows[n];n--)t.set(c,e),E.isInputRow(c)&&(c.hasStatement&&this.alignStatementRow_(c),o&&o.hasStatement&&c.width<o.width?t.set(c,o.width):e=c.hasStatement?c.width:Math.max(e,c.width),o=c);e=0;for(let n=0,c;c=this.rows[n];n++)c.hasStatement?e=this.getDesiredRowWidth_(c):E.isSpacer(c)?c.width=Math.max(e,t.get(c)):(o=c.width,e=Math.max(e,t.get(c))-o,0<e&&this.addAlignmentPadding_(c,e),e=c.width)}else super.alignRowElements_()}getDesiredRowWidth_(e){return this.isInline&&e.hasStatement?this.statementEdge+this.constants_.MAX_BOTTOM_WIDTH+this.startX:super.getDesiredRowWidth_(e)}finalize_(){let e=0,t=0;for(let n=0,c;c=this.rows[n];n++){c.yPos=t,c.xPos=this.startX,t+=c.height,e=Math.max(e,c.widthWithConnectedBlocks);var o=t-this.topRow.ascenderHeight;c===this.bottomRow&&o<this.constants_.MIN_BLOCK_HEIGHT&&(o=this.constants_.MIN_BLOCK_HEIGHT-o,this.bottomRow.height+=o,t+=o),this.recordElemPositions_(c)}this.outputConnection&&this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(o=this.block_.nextConnection.targetBlock())&&(e=Math.max(e,o.getHeightWidth().width-this.constants_.DARK_PATH_OFFSET)),this.bottomRow.baseline=t-this.bottomRow.descenderHeight,this.widthWithChildren=e+this.startX+this.constants_.DARK_PATH_OFFSET,this.width+=this.constants_.DARK_PATH_OFFSET,this.height=t+this.constants_.DARK_PATH_OFFSET,this.startY=this.topRow.capline}},ny=class extends $l{constructor(e,t,o){super(e,t,o),this.constants=o,this.colourDark="#000000",this.svgPathDark=L(D.PATH,{class:"blocklyPathDark",transform:"translate(1,1)"}),this.svgRoot.insertBefore(this.svgPathDark,this.svgPath),this.svgPathLight=L(D.PATH,{class:"blocklyPathLight"},this.svgRoot)}setPath(e){this.svgPath.setAttribute("d",e),this.svgPathDark.setAttribute("d",e)}setHighlightPath(e){this.svgPathLight.setAttribute("d",e)}flipRTL(){this.svgPath.setAttribute("transform","scale(-1 1)"),this.svgPathLight.setAttribute("transform","scale(-1 1)"),this.svgPathDark.setAttribute("transform","translate(1,1) scale(-1 1)")}applyColour(e){if(this.svgPathLight.style.display="",this.svgPathDark.style.display="",!this.style.colourTertiary)throw Error("The renderer did not properly initialize the tertiary colour of the block style");this.svgPathLight.setAttribute("stroke",this.style.colourTertiary),this.svgPathDark.setAttribute("fill",this.colourDark),super.applyColour(e),this.svgPath.setAttribute("stroke","none")}setStyle(e){this.style=e,this.colourDark=Lo("#000",this.style.colourPrimary,.2)||this.colourDark}updateHighlighted(e){e?(this.svgPath.setAttribute("filter","url(#"+this.constants.embossFilterId+")"),this.svgPathLight.style.display="none"):(this.svgPath.setAttribute("filter","none"),this.svgPathLight.style.display="inline")}updateShadow_(e){if(e){if(this.svgPathLight.style.display="none",!this.style.colourSecondary)throw Error("The renderer did not properly initialize the secondary colour of the block style block style");this.svgPathDark.setAttribute("fill",this.style.colourSecondary),this.svgPath.setAttribute("stroke","none"),this.svgPath.setAttribute("fill",this.style.colourSecondary)}}updateDisabled_(e){super.updateDisabled_(e),e&&this.svgPath.setAttribute("stroke","none")}},ry=class extends bl{constructor(e){super(e),this.highlightConstants=null}init(e,t){super.init(e,t),this.highlightConstants=this.makeHighlightConstants_(),this.highlightConstants.init()}refreshDom(e,t){super.refreshDom(e,t),this.getHighlightConstants().init()}makeConstants_(){return new Zv}makeRenderInfo_(e){return new iy(this,e)}makeDrawer_(e,t){return new ey(e,t)}makePathObject(e,t){return new ny(e,t,this.getConstants())}makeHighlightConstants_(){return new ty(this.getConstants())}getHighlightConstants(){if(!this.highlightConstants)throw Error("Cannot access the highlight constants because init has not been called");return this.highlightConstants}};Ln("geras",ry);var Bs={};Bs.ConstantProvider=Zv,Bs.Drawer=ey,Bs.HighlightConstantProvider=ty,Bs.Highlighter=Qv,Bs.InlineInput=sy,Bs.PathObject=ny,Bs.RenderInfo=iy,Bs.Renderer=ry,Bs.StatementInput=oy;var ay=class extends ar{constructor(e,t){super(e,t)}getRenderer(){return this.renderer_}addElemSpacing_(){let e=!1;for(var t=0;t<this.rows.length;t++)if(this.rows[t].hasExternalInput){e=!0;break}for(t=0;t<this.rows.length;t++){const n=this.rows[t];var o=n.elements;if(n.elements=[],n.startsWithElemSpacer()&&n.elements.push(new Xt(this.constants_,this.getInRowSpacing_(null,o[0]))),o.length){for(let c=0;c<o.length-1;c++){n.elements.push(o[c]);const h=this.getInRowSpacing_(o[c],o[c+1]);n.elements.push(new Xt(this.constants_,h))}n.elements.push(o[o.length-1]),n.endsWithElemSpacer()&&(o=this.getInRowSpacing_(o[o.length-1],null),e&&n.hasDummyInput&&(o+=this.constants_.TAB_WIDTH),n.elements.push(new Xt(this.constants_,o)))}}}getInRowSpacing_(e,t){if(!e)return t&&E.isField(t)&&t.isEditable?this.constants_.MEDIUM_PADDING:t&&E.isInlineInput(t)?this.constants_.MEDIUM_LARGE_PADDING:t&&E.isStatementInput(t)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!E.isInput(e)&&!t)return E.isField(e)&&e.isEditable?this.constants_.MEDIUM_PADDING:E.isIcon(e)?2*this.constants_.LARGE_PADDING+1:E.isHat(e)?this.constants_.NO_PADDING:E.isPreviousOrNextConnection(e)?this.constants_.LARGE_PADDING:E.isLeftRoundedCorner(e)?this.constants_.MIN_BLOCK_WIDTH:E.isJaggedEdge(e)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(E.isInput(e)&&!t){if(E.isExternalInput(e))return this.constants_.NO_PADDING;if(E.isInlineInput(e))return this.constants_.LARGE_PADDING;if(E.isStatementInput(e))return this.constants_.NO_PADDING}if(!E.isInput(e)&&t&&E.isInput(t)){if(E.isField(e)&&e.isEditable){if(E.isInlineInput(t)||E.isExternalInput(t))return this.constants_.SMALL_PADDING}else{if(E.isInlineInput(t)||E.isExternalInput(t))return this.constants_.MEDIUM_LARGE_PADDING;if(E.isStatementInput(t))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(E.isIcon(e)&&t&&!E.isInput(t))return this.constants_.LARGE_PADDING;if(E.isInlineInput(e)&&t&&E.isField(t))return t.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(E.isLeftSquareCorner(e)&&t){if(E.isHat(t))return this.constants_.NO_PADDING;if(E.isPreviousConnection(t)||E.isNextConnection(t))return t.notchOffset}return E.isLeftRoundedCorner(e)&&t?t.notchOffset-this.constants_.CORNER_RADIUS:E.isField(e)&&t&&E.isField(t)&&e.isEditable===t.isEditable||t&&E.isJaggedEdge(t)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getSpacerRowHeight_(e,t){return E.isTopRow(e)&&E.isBottomRow(t)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:E.isTopRow(e)||E.isBottomRow(t)?this.constants_.NO_PADDING:e.hasExternalInput&&t.hasExternalInput?this.constants_.LARGE_PADDING:!e.hasStatement&&t.hasStatement?this.constants_.BETWEEN_STATEMENT_PADDING_Y:e.hasStatement&&t.hasStatement||e.hasDummyInput||t.hasDummyInput?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getElemCenterline_(e,t){if(E.isSpacer(t))return e.yPos+t.height/2;if(E.isBottomRow(e))return e=e.yPos+e.height-e.descenderHeight,E.isNextConnection(t)?e+t.height/2:e-t.height/2;if(E.isTopRow(e))return E.isHat(t)?e.capline-t.height/2:e.capline+t.height/2;let o=e.yPos;return o=E.isField(t)&&e.hasStatement?o+(this.constants_.TALL_INPUT_FIELD_OFFSET_Y+t.height/2):o+e.height/2}finalize_(){let e=0,t=0;for(var o=0;o<this.rows.length;o++){const c=this.rows[o];c.yPos=t,c.xPos=this.startX,t+=c.height,e=Math.max(e,c.widthWithConnectedBlocks);var n=t-this.topRow.ascenderHeight;c===this.bottomRow&&n<this.constants_.MIN_BLOCK_HEIGHT&&(n=this.constants_.MIN_BLOCK_HEIGHT-n,this.bottomRow.height+=n,t+=n),this.recordElemPositions_(c)}this.outputConnection&&this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(o=this.block_.nextConnection.targetBlock())&&(e=Math.max(e,o.getHeightWidth().width)),this.bottomRow.baseline=t-this.bottomRow.descenderHeight,this.widthWithChildren=e+this.startX,this.height=t,this.startY=this.topRow.capline}},ly=class extends bl{constructor(e){super(e)}makeRenderInfo_(e){return new ay(this,e)}};Ln("thrasos",ly);var yp={};yp.RenderInfo=ay,yp.Renderer=ly;var bT={colour_blocks:{colourPrimary:"#CF63CF",colourSecondary:"#C94FC9",colourTertiary:"#BD42BD"},list_blocks:{colourPrimary:"#9966FF",colourSecondary:"#855CD6",colourTertiary:"#774DCB"},logic_blocks:{colourPrimary:"#4C97FF",colourSecondary:"#4280D7",colourTertiary:"#3373CC"},loop_blocks:{colourPrimary:"#0fBD8C",colourSecondary:"#0DA57A",colourTertiary:"#0B8E69"},math_blocks:{colourPrimary:"#59C059",colourSecondary:"#46B946",colourTertiary:"#389438"},procedure_blocks:{colourPrimary:"#FF6680",colourSecondary:"#FF4D6A",colourTertiary:"#FF3355"},text_blocks:{colourPrimary:"#FFBF00",colourSecondary:"#E6AC00",colourTertiary:"#CC9900"},variable_blocks:{colourPrimary:"#FF8C1A",colourSecondary:"#FF8000",colourTertiary:"#DB6E00"},variable_dynamic_blocks:{colourPrimary:"#FF8C1A",colourSecondary:"#FF8000",colourTertiary:"#DB6E00"},hat_blocks:{colourPrimary:"#4C97FF",colourSecondary:"#4280D7",colourTertiary:"#3373CC",hat:"cap"}},vT={colour_category:{colour:"#CF63CF"},list_category:{colour:"#9966FF"},logic_category:{colour:"#4C97FF"},loop_category:{colour:"#0fBD8C"},math_category:{colour:"#59C059"},procedure_category:{colour:"#FF6680"},text_category:{colour:"#FFBF00"},variable_category:{colour:"#FF8C1A"},variable_dynamic_category:{colour:"#FF8C1A"}},yT=new ei("zelos",bT,vT),_T={Classic:ll,Zelos:yT},_p=class{constructor(e,t,o){this.id_=e.toolboxitemid||k(),this.level_=(this.parent_=o||null)?this.parent_.getLevel()+1:0,this.toolboxItemDef_=e,this.parentToolbox_=t,this.workspace_=this.parentToolbox_.getWorkspace()}init(){}getDiv(){return null}getClickTarget(){return null}getId(){return this.id_}getParent(){return null}getLevel(){return this.level_}isSelectable(){return!1}isCollapsible(){return!1}dispose(){}setVisible_(e){}},_s=class extends _p{constructor(e,t,o){super(e,t,o),this.colour_=this.name_="",this.labelDom_=this.iconDom_=this.rowContents_=this.rowDiv_=this.htmlDiv_=null,this.isDisabled_=this.isHidden_=!1,this.flyoutItems_=[],this.cssConfig_=this.makeDefaultCssConfig_()}init(){this.parseCategoryDef_(this.toolboxItemDef_),this.parseContents_(this.toolboxItemDef_),this.createDom_(),this.toolboxItemDef_.hidden==="true"&&this.hide()}makeDefaultCssConfig_(){return{container:"blocklyToolboxCategory",row:"blocklyTreeRow",rowcontentcontainer:"blocklyTreeRowContentContainer",icon:"blocklyTreeIcon",label:"blocklyTreeLabel",contents:"blocklyToolboxContents",selected:"blocklyTreeSelected",openicon:"blocklyTreeIconOpen",closedicon:"blocklyTreeIconClosed"}}parseContents_(e){if("custom"in e)this.flyoutItems_=e.custom;else if(e=e.contents)for(let t=0;t<e.length;t++){const o=e[t];Array.isArray(this.flyoutItems_)&&this.flyoutItems_.push(o)}}parseCategoryDef_(e){this.name_="name"in e?ht(e.name):"",this.colour_=this.getColour_(e),Object.assign(this.cssConfig_,e.cssconfig||e.cssConfig)}createDom_(){this.htmlDiv_=this.createContainer_(),uo(this.htmlDiv_,fs.TREEITEM),kt(this.htmlDiv_,yt.SELECTED,!1),kt(this.htmlDiv_,yt.LEVEL,this.level_+1),this.rowDiv_=this.createRowContainer_(),this.rowDiv_.style.pointerEvents="auto",this.htmlDiv_.appendChild(this.rowDiv_),this.rowContents_=this.createRowContentsContainer_(),this.rowContents_.style.pointerEvents="none",this.rowDiv_.appendChild(this.rowContents_),this.iconDom_=this.createIconDom_(),uo(this.iconDom_,fs.PRESENTATION),this.rowContents_.appendChild(this.iconDom_),this.labelDom_=this.createLabelDom_(this.name_),this.rowContents_.appendChild(this.labelDom_);const e=this.labelDom_.getAttribute("id");return e&&kt(this.htmlDiv_,yt.LABELLEDBY,e),this.addColourBorder_(this.colour_),this.htmlDiv_}createContainer_(){const e=document.createElement("div"),t=this.cssConfig_.container;return t&&fe(e,t),e}createRowContainer_(){const e=document.createElement("div");var t=this.cssConfig_.row;return t&&fe(e,t),t=`${_s.nestedPadding*this.getLevel()}px`,this.workspace_.RTL?e.style.paddingRight=t:e.style.paddingLeft=t,e}createRowContentsContainer_(){const e=document.createElement("div"),t=this.cssConfig_.rowcontentcontainer;return t&&fe(e,t),e}createIconDom_(){const e=document.createElement("span");if(!this.parentToolbox_.isHorizontal()){const t=this.cssConfig_.icon;t&&fe(e,t)}return e.style.display="inline-block",e}createLabelDom_(e){const t=document.createElement("span");return t.setAttribute("id",this.getId()+".label"),t.textContent=e,(e=this.cssConfig_.label)&&fe(t,e),t}refreshTheme(){this.colour_=this.getColour_(this.toolboxItemDef_),this.addColourBorder_(this.colour_)}addColourBorder_(e){e&&(e=_s.borderWidth+"px solid "+(e||"#ddd"),this.workspace_.RTL?this.rowDiv_.style.borderRight=e:this.rowDiv_.style.borderLeft=e)}getColour_(e){const t=e.categorystyle||e.categoryStyle;if((e=e.colour)&&t)console.warn('Toolbox category "'+this.name_+'" must not have both a style and a colour');else{if(t)return this.getColourfromStyle(t);if(e)return this.parseColour(e)}return""}getColourfromStyle(e){var t=this.workspace_.getTheme();if(e&&t){if((t=t.categoryStyles[e])&&t.colour)return this.parseColour(t.colour);console.warn('Style "'+e+'" must exist and contain a colour value')}return""}getClickTarget(){return this.rowDiv_}parseColour(e){if(e=ht(e),e==null||e==="")return"";var t=Number(e);return isNaN(t)?(t=No(e))?t:(console.warn('Toolbox category "'+this.name_+'" has unrecognized colour attribute: '+e),""):Au(t)}openIcon_(e){if(e){var t=this.cssConfig_.closedicon;t&&Hr(e,t),(t=this.cssConfig_.openicon)&&fe(e,t)}}closeIcon_(e){if(e){var t=this.cssConfig_.openicon;t&&Hr(e,t),(t=this.cssConfig_.closedicon)&&fe(e,t)}}setVisible_(e){this.htmlDiv_.style.display=e?"block":"none",this.isHidden_=!e,this.parentToolbox_.getSelectedItem()===this&&this.parentToolbox_.clearSelection()}hide(){this.setVisible_(!1)}show(){this.setVisible_(!0)}isVisible(){return!this.isHidden_&&this.allAncestorsExpanded_()}allAncestorsExpanded_(){let e=this;for(;e.getParent();)if(e=e.getParent(),!e.isExpanded())return!1;return!0}isSelectable(){return this.isVisible()&&!this.isDisabled_}onClick(e){}setSelected(e){if(this.rowDiv_){var t=this.cssConfig_.selected;if(e){const o=this.parseColour(_s.defaultBackgroundColour);this.rowDiv_.style.backgroundColor=this.colour_||o,t&&fe(this.rowDiv_,t)}else this.rowDiv_.style.backgroundColor="",t&&st(this.rowDiv_,t);kt(this.htmlDiv_,yt.SELECTED,e)}}setDisabled(e){this.isDisabled_=e,this.getDiv().setAttribute("disabled",`${e}`),e?this.getDiv().setAttribute("disabled","true"):this.getDiv().removeAttribute("disabled")}getName(){return this.name_}getParent(){return this.parent_}getDiv(){return this.htmlDiv_}getContents(){return this.flyoutItems_}updateFlyoutContents(e){this.flyoutItems_=[],this.toolboxItemDef_=typeof e=="string"?{kind:this.toolboxItemDef_.kind,custom:e,id:this.toolboxItemDef_.id,categorystyle:this.toolboxItemDef_.categorystyle,colour:this.toolboxItemDef_.colour,cssconfig:this.toolboxItemDef_.cssconfig,hidden:this.toolboxItemDef_.hidden}:{kind:this.toolboxItemDef_.kind,name:"name"in this.toolboxItemDef_?this.toolboxItemDef_.name:"",contents:yn(e),id:this.toolboxItemDef_.id,categorystyle:this.toolboxItemDef_.categorystyle,colour:this.toolboxItemDef_.colour,cssconfig:this.toolboxItemDef_.cssconfig,hidden:this.toolboxItemDef_.hidden},this.parseContents_(this.toolboxItemDef_)}dispose(){Ge(this.htmlDiv_)}};_s.registrationName="category",_s.nestedPadding=19,_s.borderWidth=8,_s.defaultBackgroundColour="#57e",Tt(`
927
+ .blocklyTreeRow:not(.blocklyTreeSelected):hover {
928
+ background-color: rgba(255, 255, 255, .2);
929
+ }
930
+
931
+ .blocklyToolboxDiv[layout="h"] .blocklyToolboxCategory {
932
+ margin: 1px 5px 1px 0;
933
+ }
934
+
935
+ .blocklyToolboxDiv[dir="RTL"][layout="h"] .blocklyToolboxCategory {
936
+ margin: 1px 0 1px 5px;
937
+ }
938
+
939
+ .blocklyTreeRow {
940
+ height: 22px;
941
+ line-height: 22px;
942
+ margin-bottom: 3px;
943
+ padding-right: 8px;
944
+ white-space: nowrap;
945
+ }
946
+
947
+ .blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {
948
+ margin-left: 8px;
949
+ padding-right: 0;
950
+ }
951
+
952
+ .blocklyTreeIcon {
953
+ background-image: url(<<<PATH>>>/sprites.png);
954
+ height: 16px;
955
+ vertical-align: middle;
956
+ visibility: hidden;
957
+ width: 16px;
958
+ }
959
+
960
+ .blocklyTreeIconClosed {
961
+ background-position: -32px -1px;
962
+ }
963
+
964
+ .blocklyToolboxDiv[dir="RTL"] .blocklyTreeIconClosed {
965
+ background-position: 0 -1px;
966
+ }
967
+
968
+ .blocklyTreeSelected>.blocklyTreeIconClosed {
969
+ background-position: -32px -17px;
970
+ }
971
+
972
+ .blocklyToolboxDiv[dir="RTL"] .blocklyTreeSelected>.blocklyTreeIconClosed {
973
+ background-position: 0 -17px;
974
+ }
975
+
976
+ .blocklyTreeIconOpen {
977
+ background-position: -16px -1px;
978
+ }
979
+
980
+ .blocklyTreeSelected>.blocklyTreeIconOpen {
981
+ background-position: -16px -17px;
982
+ }
983
+
984
+ .blocklyTreeLabel {
985
+ cursor: default;
986
+ font: 16px sans-serif;
987
+ padding: 0 3px;
988
+ vertical-align: middle;
989
+ }
990
+
991
+ .blocklyToolboxDelete .blocklyTreeLabel {
992
+ cursor: url("<<<PATH>>>/handdelete.cur"), auto;
993
+ }
994
+
995
+ .blocklyTreeSelected .blocklyTreeLabel {
996
+ color: #fff;
997
+ }
998
+ `),r(z.TOOLBOX_ITEM,_s.registrationName,_s);var gr=class extends _p{constructor(e,t){super(e,t),this.cssConfig_={container:"blocklyTreeSeparator"},this.htmlDiv=null,Object.assign(this.cssConfig_,e.cssconfig||e.cssConfig)}init(){this.createDom_()}createDom_(){const e=document.createElement("div"),t=this.cssConfig_.container;return t&&fe(e,t),this.htmlDiv=e}getDiv(){return this.htmlDiv}dispose(){Ge(this.htmlDiv)}};gr.registrationName="sep",Tt(`
999
+ .blocklyTreeSeparator {
1000
+ border-bottom: solid #e5e5e5 1px;
1001
+ height: 0;
1002
+ margin: 5px 0;
1003
+ }
1004
+
1005
+ .blocklyToolboxDiv[layout="h"] .blocklyTreeSeparator {
1006
+ border-right: solid #e5e5e5 1px;
1007
+ border-bottom: none;
1008
+ height: auto;
1009
+ margin: 0 5px 0 5px;
1010
+ padding: 5px 0;
1011
+ width: 0;
1012
+ }
1013
+ `),r(z.TOOLBOX_ITEM,gr.registrationName,gr);var Xi=class extends _s{constructor(e,t,o){super(e,t,o),this.subcategoriesDiv_=null,this.expanded_=!1,this.toolboxItems_=[]}makeDefaultCssConfig_(){const e=super.makeDefaultCssConfig_();return e.contents="blocklyToolboxContents",e}parseContents_(e){if("custom"in e)this.flyoutItems_=e.custom;else{const t=e.contents;if(t){this.flyoutItems_=[],e=!0;for(let o=0;o<t.length;o++){const n=t[o];!p(z.TOOLBOX_ITEM,n.kind)||n.kind.toLowerCase()===gr.registrationName&&e?(this.flyoutItems_.push(n),e=!0):(this.createToolboxItem(n),e=!1)}}}}createToolboxItem(e){let t=e.kind;t.toUpperCase()==="CATEGORY"&&qr(e)&&(t=Xi.registrationName),e=new(m(z.TOOLBOX_ITEM,t))(e,this.parentToolbox_,this),this.toolboxItems_.push(e)}init(){super.init(),this.setExpanded(this.toolboxItemDef_.expanded==="true"||this.toolboxItemDef_.expanded===!0)}createDom_(){super.createDom_();const e=this.getChildToolboxItems();return this.subcategoriesDiv_=this.createSubCategoriesDom_(e),uo(this.subcategoriesDiv_,fs.GROUP),this.htmlDiv_.appendChild(this.subcategoriesDiv_),this.closeIcon_(this.iconDom_),kt(this.htmlDiv_,yt.EXPANDED,!1),this.htmlDiv_}createIconDom_(){const e=document.createElement("span");if(!this.parentToolbox_.isHorizontal()){const t=this.cssConfig_.icon;t&&fe(e,t),e.style.visibility="visible"}return e.style.display="inline-block",e}createSubCategoriesDom_(e){const t=document.createElement("div");t.style.display="none";var o=this.cssConfig_.contents;for(o&&fe(t,o),o=0;o<e.length;o++){const n=e[o];n.init();const c=n.getDiv();if(t.appendChild(c),n.getClickTarget){let h;(h=n.getClickTarget())==null||h.setAttribute("id",n.getId())}}return t}setExpanded(e){if(this.expanded_!==e){if(this.expanded_=e)this.subcategoriesDiv_.style.display="block",this.openIcon_(this.iconDom_);else{let t;(t=this.parentToolbox_.getFlyout())==null||t.setVisible(!1),this.subcategoriesDiv_.style.display="none",this.closeIcon_(this.iconDom_)}kt(this.htmlDiv_,yt.EXPANDED,e),this.parentToolbox_.handleToolboxItemResize()}}setVisible_(e){this.htmlDiv_.style.display=e?"block":"none";const t=this.getChildToolboxItems();for(let o=0;o<t.length;o++)t[o].setVisible_(e);this.isHidden_=!e,this.parentToolbox_.getSelectedItem()===this&&this.parentToolbox_.clearSelection()}isExpanded(){return this.expanded_}isCollapsible(){return!0}onClick(e){this.toggleExpanded()}toggleExpanded(){this.setExpanded(!this.expanded_)}getDiv(){return this.htmlDiv_}getChildToolboxItems(){return this.toolboxItems_}};Xi.registrationName="collapsibleCategory",r(z.TOOLBOX_ITEM,Xi.registrationName,Xi);var cy=class extends yl{constructor(e){super(),this.id="toolbox",this.contentsDiv_=this.HtmlDiv=null,this.isVisible_=!1,this.contents_=[],this.height_=this.width_=0,this.previouslySelectedItem_=this.selectedItem_=this.flyout=null,this.boundEvents_=[],this.workspace_=e,this.toolboxDef_=e.options.languageTree||{contents:[]},this.horizontalLayout=e.options.horizontalLayout,this.RTL=e.options.RTL,this.contentMap_=Object.create(null),this.toolboxPosition=e.options.toolboxPosition}onShortcut(e){return!1}init(){var e=this.workspace_;const t=e.getParentSvg();this.flyout=this.createFlyout_(),this.HtmlDiv=this.createDom_(this.workspace_),Ao(this.flyout.createDom("svg"),t),this.setVisible(!0),this.flyout.init(e),this.render(this.toolboxDef_),e=e.getThemeManager(),e.subscribe(this.HtmlDiv,"toolboxBackgroundColour","background-color"),e.subscribe(this.HtmlDiv,"toolboxForegroundColour","color"),this.workspace_.getComponentManager().addComponent({component:this,weight:at.ComponentWeight.TOOLBOX_WEIGHT,capabilities:[at.Capability.AUTOHIDEABLE,at.Capability.DELETE_AREA,at.Capability.DRAG_TARGET]})}createDom_(e){e=e.getParentSvg();const t=this.createContainer_();return this.contentsDiv_=this.createContentsContainer_(),this.contentsDiv_.tabIndex=0,uo(this.contentsDiv_,fs.TREE),t.appendChild(this.contentsDiv_),e.parentNode.insertBefore(t,e),this.attachEvents_(t,this.contentsDiv_),t}createContainer_(){const e=document.createElement("div");return e.setAttribute("layout",this.isHorizontal()?"h":"v"),fe(e,"blocklyToolboxDiv"),e.setAttribute("dir",this.RTL?"RTL":"LTR"),e}createContentsContainer_(){const e=document.createElement("div");return fe(e,"blocklyToolboxContents"),this.isHorizontal()&&(e.style.flexDirection="row"),e}attachEvents_(e,t){e=Q(e,"pointerdown",this,this.onClick_,!1),this.boundEvents_.push(e),t=Q(t,"keydown",this,this.onKeyDown_,!1),this.boundEvents_.push(t)}onClick_(e){if(_e(e)||e.target===this.HtmlDiv)W().hideChaff(!1);else{var t=e.target.getAttribute("id");t&&(t=this.getToolboxItemById(t),t.isSelectable()&&(this.setSelectedItem(t),t.onClick(e))),W().hideChaff(!0)}Ee()}onKeyDown_(e){let t=!1;switch(e.key){case"ArrowDown":t=this.selectNext();break;case"ArrowUp":t=this.selectPrevious();break;case"ArrowLeft":t=this.selectParent();break;case"ArrowRight":t=this.selectChild();break;case"Enter":case" ":this.selectedItem_&&this.selectedItem_.isCollapsible()&&(this.selectedItem_.toggleExpanded(),t=!0);break;default:t=!1}!t&&this.selectedItem_&&this.selectedItem_.onKeyDown&&(t=this.selectedItem_.onKeyDown(e)),t&&e.preventDefault()}createFlyout_(){const e=this.workspace_,t=new ss({parentWorkspace:e,rtl:e.RTL,oneBasedIndex:e.options.oneBasedIndex,horizontalLayout:e.horizontalLayout,renderer:e.options.renderer,rendererOverrides:e.options.rendererOverrides,move:{scrollbars:!0}});return t.toolboxPosition=e.options.toolboxPosition,new(e.horizontalLayout?w(z.FLYOUTS_HORIZONTAL_TOOLBOX,e.options,!0):w(z.FLYOUTS_VERTICAL_TOOLBOX,e.options,!0))(t)}render(e){this.toolboxDef_=e;for(let t=0;t<this.contents_.length;t++){const o=this.contents_[t];o&&o.dispose()}this.contents_=[],this.contentMap_=Object.create(null),this.renderContents_(e.contents),this.position(),this.handleToolboxItemResize()}renderContents_(e){const t=document.createDocumentFragment();for(let o=0;o<e.length;o++)this.createToolboxItem(e[o],t);this.contentsDiv_.appendChild(t)}createToolboxItem(e,t){var o=e.kind;o.toUpperCase()==="CATEGORY"&&qr(e)&&(o=Xi.registrationName),(o=m(z.TOOLBOX_ITEM,o.toLowerCase()))&&(e=new o(e,this),e.init(),this.addToolboxItem_(e),(o=e.getDiv())&&t.appendChild(o),e.getClickTarget()&&e.getClickTarget().setAttribute("id",e.getId()))}addToolboxItem_(e){if(this.contents_.push(e),this.contentMap_[e.getId()]=e,e.isCollapsible()){e=e.getChildToolboxItems();for(let t=0;t<e.length;t++)this.addToolboxItem_(e[t])}}getToolboxItems(){return this.contents_}addStyle(e){e&&this.HtmlDiv&&fe(this.HtmlDiv,e)}removeStyle(e){e&&this.HtmlDiv&&st(this.HtmlDiv,e)}getClientRect(){if(!this.HtmlDiv||!this.isVisible_)return null;var e=this.HtmlDiv.getBoundingClientRect();const t=e.top,o=t+e.height,n=e.left;return e=n+e.width,this.toolboxPosition===xe.TOP?new Je(-1e7,o,-1e7,1e7):this.toolboxPosition===xe.BOTTOM?new Je(t,1e7,-1e7,1e7):this.toolboxPosition===xe.LEFT?new Je(-1e7,1e7,-1e7,e):new Je(-1e7,1e7,n,1e7)}wouldDelete(e){return e instanceof ns?this.updateWouldDelete_(!e.getParent()&&e.isDeletable()):this.updateWouldDelete_(Qt(e)&&e.isDeletable()),this.wouldDelete_}onDragEnter(e){this.updateCursorDeleteStyle_(!0)}onDragExit(e){this.updateCursorDeleteStyle_(!1)}onDrop(e){this.updateCursorDeleteStyle_(!1)}updateWouldDelete_(e){e!==this.wouldDelete_&&(this.updateCursorDeleteStyle_(!1),this.wouldDelete_=e,this.updateCursorDeleteStyle_(!0))}updateCursorDeleteStyle_(e){const t=this.wouldDelete_?"blocklyToolboxDelete":"blocklyToolboxGrab";e?this.addStyle(t):this.removeStyle(t)}getToolboxItemById(e){return this.contentMap_[e]||null}getWidth(){return this.width_}getHeight(){return this.height_}getFlyout(){return this.flyout}getWorkspace(){return this.workspace_}getSelectedItem(){return this.selectedItem_}getPreviouslySelectedItem(){return this.previouslySelectedItem_}isHorizontal(){return this.horizontalLayout}position(){const e=this.workspace_.getMetrics(),t=this.HtmlDiv;t&&(this.horizontalLayout?(t.style.left="0",t.style.height="auto",t.style.width="100%",this.height_=t.offsetHeight,this.width_=e.viewWidth,this.toolboxPosition===xe.TOP?t.style.top="0":t.style.bottom="0"):(this.toolboxPosition===xe.RIGHT?t.style.right="0":t.style.left="0",t.style.height="100%",this.width_=t.offsetWidth,this.height_=e.viewHeight),this.flyout.position())}handleToolboxItemResize(){const e=this.workspace_,t=this.HtmlDiv.getBoundingClientRect();e.translate(this.toolboxPosition===xe.LEFT?e.scrollX+t.width:e.scrollX,this.toolboxPosition===xe.TOP?e.scrollY+t.height:e.scrollY),ke(e)}clearSelection(){this.setSelectedItem(null)}refreshTheme(){for(let e=0;e<this.contents_.length;e++){const t=this.contents_[e];t.refreshTheme&&t.refreshTheme()}}refreshSelection(){this.selectedItem_&&this.selectedItem_.isSelectable()&&this.selectedItem_.getContents().length&&this.flyout.show(this.selectedItem_.getContents())}setVisible(e){this.isVisible_!==e&&(this.HtmlDiv.style.display=e?"block":"none",this.isVisible_=e,this.workspace_.recordDragTargets())}autoHide(e){!e&&this.flyout&&this.flyout.autoClose&&this.clearSelection()}setSelectedItem(e){const t=this.selectedItem_;!e&&!t||e&&!k$(e)||(this.shouldDeselectItem_(t,e)&&t!==null&&this.deselectItem_(t),this.shouldSelectItem_(t,e)&&e!==null&&this.selectItem_(t,e),this.updateFlyout_(t,e),this.fireSelectEvent(t,e))}shouldDeselectItem_(e,t){return e!==null&&(!e.isCollapsible()||e!==t)}shouldSelectItem_(e,t){return t!==null&&t!==e}deselectItem_(e){this.selectedItem_=null,this.previouslySelectedItem_=e,e.setSelected(!1),kt(this.contentsDiv_,yt.ACTIVEDESCENDANT,"")}selectItem_(e,t){this.selectedItem_=t,this.previouslySelectedItem_=e,t.setSelected(!0),kt(this.contentsDiv_,yt.ACTIVEDESCENDANT,t.getId())}selectItemByPosition(e){-1<e&&e<this.contents_.length&&(e=this.contents_[e],e.isSelectable()&&this.setSelectedItem(e))}updateFlyout_(e,t){t&&(e!==t||t.isCollapsible())&&t.getContents().length?(this.flyout.show(t.getContents()),this.flyout.scrollToStart()):this.flyout.hide()}fireSelectEvent(e,t){const o=e&&e.getName();let n=t&&t.getName();e===t&&(n=null),e=new(Y(M.TOOLBOX_ITEM_SELECT))(o,n,this.workspace_.id),U(e)}selectParent(){return this.selectedItem_?this.selectedItem_.isCollapsible()&&this.selectedItem_.isExpanded()?(this.selectedItem_.toggleExpanded(),!0):this.selectedItem_.getParent()&&this.selectedItem_.getParent().isSelectable()?(this.setSelectedItem(this.selectedItem_.getParent()),!0):!1:!1}selectChild(){if(!this.selectedItem_||!this.selectedItem_.isCollapsible())return!1;const e=this.selectedItem_;return e.isExpanded()?this.selectNext():e.toggleExpanded(),!0}selectNext(){if(!this.selectedItem_)return!1;let e=this.contents_.indexOf(this.selectedItem_)+1;if(-1<e&&e<this.contents_.length){let t=this.contents_[e];for(;t&&!t.isSelectable();)t=this.contents_[++e];if(t&&t.isSelectable())return this.setSelectedItem(t),!0}return!1}selectPrevious(){if(!this.selectedItem_)return!1;let e=this.contents_.indexOf(this.selectedItem_)-1;if(-1<e&&e<this.contents_.length){let t=this.contents_[e];for(;t&&!t.isSelectable();)t=this.contents_[--e];if(t&&t.isSelectable())return this.setSelectedItem(t),!0}return!1}dispose(){this.workspace_.getComponentManager().removeComponent("toolbox"),this.flyout.dispose();for(var e=0;e<this.contents_.length;e++)this.contents_[e].dispose();for(e=0;e<this.boundEvents_.length;e++)ze(this.boundEvents_[e]);this.boundEvents_=[],this.contents_=[],this.HtmlDiv&&(this.workspace_.getThemeManager().unsubscribe(this.HtmlDiv),Ge(this.HtmlDiv))}};Tt(`
1014
+ .blocklyToolboxDelete {
1015
+ cursor: url("<<<PATH>>>/handdelete.cur"), auto;
1016
+ }
1017
+
1018
+ .blocklyToolboxGrab {
1019
+ cursor: url("<<<PATH>>>/handclosed.cur"), auto;
1020
+ cursor: grabbing;
1021
+ cursor: -webkit-grabbing;
1022
+ }
1023
+
1024
+ /* Category tree in Toolbox. */
1025
+ .blocklyToolboxDiv {
1026
+ background-color: #ddd;
1027
+ overflow-x: visible;
1028
+ overflow-y: auto;
1029
+ padding: 4px 0 4px 0;
1030
+ position: absolute;
1031
+ z-index: 70; /* so blocks go under toolbox when dragging */
1032
+ -webkit-tap-highlight-color: transparent; /* issue #1345 */
1033
+ }
1034
+
1035
+ .blocklyToolboxContents {
1036
+ display: flex;
1037
+ flex-wrap: wrap;
1038
+ flex-direction: column;
1039
+ }
1040
+
1041
+ .blocklyToolboxContents:focus {
1042
+ outline: none;
1043
+ }
1044
+ `),r(z.TOOLBOX,Ds,cy);var wT="11.2.2",CT=ne.INPUT_VALUE,TT=ne.OUTPUT_VALUE,kT=ne.NEXT_STATEMENT,ST=ne.PREVIOUS_STATEMENT,ET=xe.TOP,IT=xe.BOTTOM,xT=xe.LEFT,DT=xe.RIGHT;Vi.prototype.newBlock=function(e,t){return new Co(this,e,t)},Zt.prototype.newBlock=function(e,t){return new ns(this,e,t)},Vi.prototype.newComment=function(e){return new nl(this,e)},Zt.prototype.newComment=function(e){return new rl(this,e)},Zt.newTrashcan=function(e){return new nv(e)},to.prototype.newWorkspaceSvg=function(e){return new Zt(e)},i.Names$$module$build$src$core$names.prototype.populateProcedures=function(e){e=Ia(e),e=e[0].concat(e[1]);for(let t=0;t<e.length;t++)this.getName(e[t][0],i.Names$$module$build$src$core$names.NameType.PROCEDURE)};var N={};return N.ASTNode=P,N.BasicCursor=cr,N.Block=Co,N.BlockSvg=ns,N.Blocks=Ut,N.COLLAPSED_FIELD_NAME=Ga,N.COLLAPSED_INPUT_NAME=Gn,N.COLLAPSE_CHARS=qb,N.CodeGenerator=i.CodeGenerator$$module$build$src$core$generator,N.CollapsibleToolboxCategory=Xi,N.ComponentManager=at,N.Connection=Pe,N.ConnectionChecker=Zb,N.ConnectionDB=zi,N.ConnectionType=ne,N.ContextMenu=Qo,N.ContextMenuItems=_t,N.ContextMenuRegistry=Ae,N.Css=Qd,N.Cursor=Jh,N.DELETE_VARIABLE_ID=Wh,N.DeleteArea=yl,N.DragTarget=iv,N.DropDownDiv=At,N.Events=te,N.Extensions=vs,N.Field=Ze,N.FieldCheckbox=ni,N.FieldDropdown=Ht,N.FieldImage=ii,N.FieldLabel=ti,N.FieldLabelSerializable=Tv,N.FieldNumber=rp,N.FieldTextInput=kl,N.FieldVariable=dr,N.Flyout=El,N.FlyoutButton=os,N.FlyoutMetricsManager=wv,N.Generator=i.CodeGenerator$$module$build$src$core$generator,N.Gesture=eo,N.Grid=xh,N.HorizontalFlyout=Cv,N.INPUT_VALUE=CT,N.Input=Wi,N.InsertionMarkerManager=is,N.InsertionMarkerPreviewer=vv,N.Marker=tv,N.MarkerManager=qn,N.Menu=rh,N.MenuItem=ah,N.MetricsManager=op,N.Msg=i.Msg$$module$build$src$core$msg,N.NEXT_STATEMENT=kT,N.Names=i.Names$$module$build$src$core$names,N.OPPOSITE_TYPE=oi,N.OUTPUT_VALUE=TT,N.Options=ss,N.PREVIOUS_STATEMENT=ST,N.PROCEDURE_CATEGORY_NAME=pl,N.Procedures=Bt,N.RENAME_VARIABLE_ID=Hh,N.RenderedConnection=Pt,N.Scrollbar=gt,N.ScrollbarPair=sp,N.ShortcutItems=Ns,N.ShortcutRegistry=He,N.TOOLBOX_AT_BOTTOM=IT,N.TOOLBOX_AT_LEFT=xT,N.TOOLBOX_AT_RIGHT=DT,N.TOOLBOX_AT_TOP=ET,N.TabNavigateCursor=sv,N.Theme=ei,N.ThemeManager=Xb,N.Themes=_T,N.Toolbox=cy,N.ToolboxCategory=_s,N.ToolboxItem=_p,N.ToolboxSeparator=gr,N.Tooltip=Yt,N.Touch=Ho,N.Trashcan=nv,N.UnattachedFieldError=mt,N.VARIABLE_CATEGORY_NAME=ph,N.VARIABLE_DYNAMIC_CATEGORY_NAME=Uh,N.VERSION=wT,N.VariableMap=Kh,N.VariableModel=Yn,N.Variables=It,N.VariablesDynamic=si,N.VerticalFlyout=np,N.WidgetDiv=bs,N.Workspace=Vi,N.WorkspaceAudio=Qb,N.WorkspaceDragger=Ob,N.WorkspaceSvg=Zt,N.Xml=Rt,N.ZoomControls=ob,N.blockAnimations=sr,N.blockRendering=We,N.browserEvents=Xs,N.bubbles=pr,N.bumpObjects=vl,N.clipboard=ur,N.comments=Il,N.common=Et,N.config=i.config$$module$build$src$core$config,N.constants=YC,N.defineBlocksWithJsonArray=me,N.dialog=Go,N.dragging=hr,N.fieldRegistry=cl,N.geras=Bs,N.getMainWorkspace=W,N.getSelected=x,N.hasBubble=vi,N.hideChaff=S$,N.icons=_o,N.inject=h$,N.inputs=So,N.isCopyable=Bn,N.isDeletable=Qt,N.isDraggable=jo,N.isIcon=nd,N.isObservable=Ea,N.isPaster=w$,N.isRenderedElement=C$,N.isSelectable=T$,N.isSerializable=Cn,N.isVariableBackedParameterModel=Zc,N.layers=JC,N.procedures=Bt,N.registry=Ys,N.renderManagement=Ya,N.serialization=fT,N.setLocale=dh,N.setParentContainer=G,N.svgResize=ke,N.thrasos=yp,N.uiPosition=Vo,N.utils=ct,N.zelos=ys,N.__namespace__=i,N})})(om);var j0=om.exports;const z0=hi(j0),{ASTNode:ate,BasicCursor:lte,Block:cte,BlockSvg:ute,Blocks:dte,COLLAPSED_FIELD_NAME:hte,COLLAPSED_INPUT_NAME:pte,COLLAPSE_CHARS:gte,CodeGenerator:mte,CollapsibleToolboxCategory:fte,ComponentManager:$te,Connection:bte,ConnectionChecker:vte,ConnectionDB:yte,ConnectionType:_te,ContextMenu:wte,ContextMenuItems:Cte,ContextMenuRegistry:Tte,Css:kte,Cursor:Ste,DELETE_VARIABLE_ID:Ete,DeleteArea:Ite,DragTarget:xte,DropDownDiv:Dte,Events:Ate,Extensions:Rte,Field:Ote,FieldCheckbox:Mte,FieldDropdown:Nte,FieldImage:Lte,FieldLabel:Bte,FieldLabelSerializable:Pte,FieldNumber:Fte,FieldTextInput:jte,FieldVariable:zte,Flyout:Ute,FlyoutButton:Hte,FlyoutMetricsManager:Wte,Generator:Vte,Gesture:Gte,Grid:Kte,HorizontalFlyout:Yte,INPUT_VALUE:Jte,Input:Xte,InsertionMarkerManager:qte,InsertionMarkerPreviewer:Zte,Marker:Qte,MarkerManager:ese,Menu:tse,MenuItem:sse,MetricsManager:ose,Msg:ise,NEXT_STATEMENT:nse,Names:rse,OPPOSITE_TYPE:ase,OUTPUT_VALUE:lse,Options:cse,PREVIOUS_STATEMENT:use,PROCEDURE_CATEGORY_NAME:dse,Procedures:hse,RENAME_VARIABLE_ID:pse,RenderedConnection:gse,Scrollbar:mse,ScrollbarPair:fse,ShortcutItems:$se,ShortcutRegistry:bse,TOOLBOX_AT_BOTTOM:vse,TOOLBOX_AT_LEFT:yse,TOOLBOX_AT_RIGHT:_se,TOOLBOX_AT_TOP:wse,TabNavigateCursor:Cse,Theme:U0,ThemeManager:Tse,Themes:H0,Toolbox:kse,ToolboxCategory:Sse,ToolboxItem:Ese,ToolboxSeparator:Ise,Tooltip:xse,Touch:Dse,Trashcan:Ase,UnattachedFieldError:Rse,VARIABLE_CATEGORY_NAME:Ose,VARIABLE_DYNAMIC_CATEGORY_NAME:Mse,VERSION:Nse,VariableMap:Lse,VariableModel:Bse,Variables:Pse,VariablesDynamic:Fse,VerticalFlyout:jse,WidgetDiv:zse,Workspace:Use,WorkspaceAudio:Hse,WorkspaceDragger:Wse,WorkspaceSvg:Vse,Xml:Gse,ZoomControls:Kse,blockAnimations:Yse,blockRendering:Jse,browserEvents:Xse,bubbles:qse,bumpObjects:Zse,clipboard:Qse,comments:eoe,common:toe,config:soe,constants:ooe,defineBlocksWithJsonArray:ioe,dialog:noe,dragging:roe,fieldRegistry:aoe,geras:loe,getMainWorkspace:coe,getSelected:uoe,hasBubble:doe,hideChaff:hoe,icons:poe,inject:goe,inputs:moe,isCopyable:foe,isDeletable:$oe,isDraggable:boe,isIcon:voe,isObservable:yoe,isPaster:_oe,isRenderedElement:woe,isSelectable:Coe,isSerializable:Toe,isVariableBackedParameterModel:koe,layers:Soe,procedures:Eoe,registry:Ioe,renderManagement:xoe,serialization:Doe,setLocale:Aoe,setParentContainer:Roe,svgResize:Ooe,thrasos:Moe,uiPosition:Noe,utils:Loe,zelos:Boe}=z0;/**
1045
+ * @license
1046
+ * Copyright 2021 Google LLC
1047
+ * SPDX-License-Identifier: Apache-2.0
1048
+ */const C_=U0.defineTheme("dark",{base:H0.Classic,componentStyles:{workspaceBackgroundColour:"#1e1e1e",toolboxBackgroundColour:"blackBackground",toolboxForegroundColour:"#fff",flyoutBackgroundColour:"#252526",flyoutForegroundColour:"#ccc",flyoutOpacity:1,scrollbarColour:"#797979",insertionMarkerColour:"#fff",insertionMarkerOpacity:.3,scrollbarOpacity:.4,cursorColour:"#d0d0d0",blackBackground:"#333"}}),vr={textArea:{width:"100%",height:"100%",overflow:"auto"},textAreaLight:{background:"lightgray"},dialog:{height:"95%"},typography:{padding:16},overflowY:{overflowY:"hidden"}};class W0 extends X.Component{constructor(s){super(s),this.state={anchorEl:null,popper:""}}handleCancel(){this.props.onClose()}onCopy(s){b.Utils.copyToClipboard(this.props.text);const i=s.currentTarget;setTimeout(()=>{this.setState({popper:b.I18n.t("Copied"),anchorEl:i}),setTimeout(()=>this.setState({popper:"",anchorEl:null}),1e3)},50)}render(){const s=new Blob([this.props.text],{type:"application/xml"}),i=`${this.props.scriptId.substring(10)}.xml`;return g.jsxs(y.Dialog,{onClose:()=>!1,maxWidth:"lg",sx:{"& .MuiDialog-paper":vr.dialog},fullWidth:!0,open:!0,"aria-labelledby":"export-dialog-title",children:[g.jsx(y.DialogTitle,{id:"export-dialog-title",children:b.I18n.t("Export selected blocks")}),g.jsx(y.DialogContent,{style:vr.overflowY,children:g.jsx("pre",{id:"export-text",style:{...vr.textArea,...this.props.themeType==="dark"?void 0:vr.textAreaLight},children:this.props.text})}),g.jsxs(y.DialogActions,{children:[g.jsx(y.Button,{variant:"contained",color:"secondary",startIcon:g.jsx(Yl,{}),children:g.jsx("a",{download:i,target:"_blank",rel:"noreferrer",href:URL.createObjectURL(s),style:{textDecoration:"inherit",color:"inherit"},children:b.I18n.t("Download as file")})}),g.jsx(y.Button,{variant:"contained",onClick:r=>this.onCopy(r),color:"secondary",startIcon:g.jsx(Lk,{}),children:b.I18n.t("Copy to clipboard")}),g.jsx(y.Button,{variant:"contained",onClick:()=>this.handleCancel(),color:"primary",startIcon:g.jsx(zs,{}),children:b.I18n.t("Close")}),g.jsx(y.Popper,{id:"popper",style:{zIndex:1e4},open:!!this.state.popper,placement:"top",anchorEl:this.state.anchorEl,transition:!0,children:({TransitionProps:r})=>g.jsx(y.Fade,{...r,timeout:350,children:g.jsx(y.Paper,{children:g.jsx("p",{style:vr.typography,children:this.state.popper})})})}),g.jsx("textarea",{id:"copy_input",readOnly:!0,style:{position:"absolute",left:-9999},tabIndex:-1,"aria-hidden":!0,value:this.props.text})]})]},"export-dialog")}}const Dt={textArea:{width:"calc(100% - 10px)",height:"calc(80% - 20px)",resize:"none",fontFamily:"monospace",fontSize:"1em",backgroundColor:"transparent",borderRadius:4,outline:"none"},dropzone:{marginTop:20,width:"100%",borderWidth:5,borderStyle:"dashed",borderColor:"#d0cccc",textAlign:"center",boxSizing:"border-box",paddingTop:45,borderRadius:10,height:"calc(100% - 10px)"},dropzoneDiv:{width:"100%",height:"20%",position:"relative"},dropzoneRejected:{borderColor:"#970000"},dropzoneAccepted:{borderColor:"#17cd02"},icon:{height:"80%",width:"80%",opacity:.3,color:"#eeeeee",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%,-50%)",zIndex:0},iconError:{color:"#ffc3c6"},iconOk:{color:"#aaeebc"},text:{top:"50%",left:"50%",transform:"translate(-50%,-50%)",color:"#868686",position:"absolute",zIndex:1},dialog:{height:"95%"},fullHeight:{height:"100%",overflow:"hidden"}};class im extends X.Component{constructor(s){super(s),this.state={text:"",imageStatus:"",error:""}}componentDidMount(){setTimeout(()=>{var s;try{(s=window.document.getElementById("import-text-area"))==null||s.focus()}catch{}},100)}static readFileDataUrl(s,i){const r=new FileReader;r.onload=()=>{i(null,{data:r.result,name:s.name})},r.onabort=()=>{console.error("file reading was aborted"),i(b.I18n.t("file reading was aborted"))},r.onerror=l=>{console.error("file reading has failed"),i(b.I18n.t("file reading has failed: %s",l))},r.readAsText(s)}handleDropFile(s){if(!(s!=null&&s.length))return;const i=s[s.length-1];i&&im.readFileDataUrl(i,(r,l)=>{var u;r||!l?this.setState({error:r||"No data"}):this.setState({text:((u=l.data)==null?void 0:u.toString())||""})})}handleCancel(){this.props.onClose()}handleOk(){this.props.onClose(this.state.text)}onChange(s){this.setState({text:s.target.value})}render(){const s={...Dt.dropzone,...this.state.imageStatus==="accepted"?Dt.dropzoneAccepted:this.state.imageStatus==="rejected"?Dt.dropzoneRejected:void 0};return g.jsxs(y.Dialog,{onClose:()=>!1,maxWidth:"lg",sx:{"& .MuiDialog-paper":Dt.dialog},fullWidth:!0,open:!0,"aria-labelledby":"import-dialog-title",children:[g.jsx(y.DialogTitle,{id:"import-dialog-title",children:b.I18n.t("Import blocks")}),g.jsxs(y.DialogContent,{style:Dt.fullHeight,children:[g.jsx("textarea",{autoFocus:!0,id:"import-text-area",placeholder:b.I18n.t("Paste your blocks here"),style:{...Dt.textArea,color:this.props.themeType==="dark"?"#ffffff":"#000000"},onChange:i=>this.onChange(i),value:this.state.text}),g.jsx(j_,{maxSize:5e7,onDrop:(i,r)=>{var l,u,d;i.length?this.handleDropFile(i):window.alert(((d=(u=(l=r==null?void 0:r[0])==null?void 0:l.errors)==null?void 0:u[0])==null?void 0:d.message)||b.I18n.t("ra_Cannot upload"))},multiple:!1,accept:{"text/plain":[],"text/xml":[],"application/xml":[]},children:({getRootProps:i,getInputProps:r,isDragActive:l,isDragReject:u})=>u?(this.state.imageStatus!=="rejected"&&this.setState({imageStatus:"rejected"}),g.jsxs("div",{style:{...s,...Dt.dropzoneDiv},...i(),children:[g.jsx("input",{...r()}),g.jsx("span",{style:Dt.text,children:b.I18n.t("Some files will be rejected")},"text"),g.jsx(vc,{style:{...Dt.icon,...Dt.iconError}},"icon")]})):l?(this.state.imageStatus!=="accepted"&&this.setState({imageStatus:"accepted"}),g.jsxs("div",{style:{...s,...Dt.dropzoneDiv},...i(),children:[g.jsx("input",{...r()}),g.jsx("span",{style:Dt.text,children:b.I18n.t("All files will be accepted")},"text"),g.jsx(z_,{style:{...Dt.icon,...Dt.iconOk}},"icon")]})):(this.state.imageStatus!=="wait"&&this.setState({imageStatus:"wait"}),g.jsxs("div",{style:{...s,...Dt.dropzoneDiv},...i(),children:[g.jsx("input",{...r()}),g.jsx("span",{style:Dt.text,children:b.I18n.t("Drop some files here or click...")},"text"),g.jsx(U_,{style:Dt.icon},"icon")]}))})]}),g.jsxs(y.DialogActions,{children:[g.jsx(y.Button,{variant:"contained",disabled:!this.state.text,onClick:()=>this.handleOk(),color:"primary",startIcon:g.jsx(Do,{}),children:b.I18n.t("Import")}),g.jsx(y.Button,{color:"grey",variant:"contained",onClick:()=>this.handleCancel(),startIcon:g.jsx(zs,{}),children:b.I18n.t("Close")})]})]})}}/**
1049
+ * @license
1050
+ * Copyright 2023 Google LLC
1051
+ * SPDX-License-Identifier: Apache-2.0
1052
+ */const Te=window.Blockly;class Hp extends Error{constructor(){super("The field has not yet been attached to its input. Call appendField to attach it.")}}class oc extends Te.Field{textGroup=null;borderRect_=null;maxLines_=1/0;isOverflowedY_=!1;constructor(s,i,r){super(s),s!==Symbol("SKIP_SETUP")&&(r&&this.configure_(r),this.SERIALIZABLE=!0,this.setValue((s==null?void 0:s.toString())||""),i&&this.setValidator(i))}configure_(s){super.configure_(s),s.maxLines&&this.setMaxLines(s.maxLines)}toXml(s){return s.textContent=this.getValue().replace(/\n/g,"&#10;"),s}fromXml(s){this.setValue(s.textContent.replace(/&#10;/g,`
1053
+ `))}saveState(){const s=this.saveLegacyState(oc);return s!==null?s:this.getValue()}loadState(s){this.loadLegacyState(Te.Field,s)||this.setValue(s)}initView(){this.createBorderRect_(),this.textGroup=Te.utils.dom.createSvgElement(Te.utils.Svg.G,{class:"blocklyEditableText"},this.fieldGroup_)}onHtmlInputKeyDownSuper_(s){s.key==="Enter"?(Te.WidgetDiv.hideIfOwner(this),Te.dropDownDiv.hideWithoutAnimation()):s.key==="Escape"?(this.setValue(this.htmlInput_.getAttribute("data-untyped-default-value"),!1),Te.WidgetDiv.hideIfOwner(this),Te.dropDownDiv.hideWithoutAnimation()):s.key==="Tab"&&(Te.WidgetDiv.hideIfOwner(this),Te.dropDownDiv.hideWithoutAnimation(),this.sourceBlock_.tab(this,!s.shiftKey),s.preventDefault())}onHtmlInputChange_(s){const i=this.value_;this.setValue(this.getValueFromEditorText_(this.htmlInput_.value),!1),this.sourceBlock_&&Te.Events.isEnabled()&&this.value_!==i&&Te.Events.fire(new(Te.Events.get("block_field_intermediate_change"))(this.sourceBlock_,this.name||null,i,this.value_))}onFinishEditing_(s){}getValueFromEditorText_(s){return s}bindInputEvents_(s){this.onKeyDownWrapper_=Te.browserEvents.conditionalBind(s,"keydown",this,this.onHtmlInputKeyDown_),this.onKeyInputWrapper_=Te.browserEvents.conditionalBind(s,"input",this,this.onHtmlInputChange_)}getDisplayText_(){const s=this.getSourceBlock();if(!s)throw new Error("The field has not yet been attached to its input. Call appendField to attach it.");let i=this.getText();if(!i)return Te.Field.NBSP;const r=i.split(`
1054
+ `);i="";const l=this.isOverflowedY_?this.maxLines_:r.length;for(let u=0;u<l;u++){let d=r[u]||"";d.length>this.maxDisplayLength?d=`${d.substring(0,this.maxDisplayLength-4)}...`:this.isOverflowedY_&&u===l-1&&(d=`${d.substring(0,d.length-3)}...`),d=d.replace(/\s/g,Te.Field.NBSP),i+=d,u!==l-1&&(i+=`
1055
+ `)}return s.RTL&&(i+="‏"),i}doValueUpdate_(s){super.doValueUpdate_(s),this.value_!==null&&(this.isOverflowedY_=this.value_.split(`
1056
+ `).length>this.maxLines_)}render_(){const s=this.getSourceBlock();if(!s)throw new Error("The field has not yet been attached to its input. Call appendField to attach it.");let i;const r=this.textGroup;for(;i=r.firstChild;)r.removeChild(i);const l=this.getConstants();if(!l)throw Error("Constants not found");const u=this.getDisplayText_().split(`
1057
+ `);let d=0;for(let p=0;p<u.length;p++){const m=l.FIELD_TEXT_HEIGHT+l.FIELD_BORDER_RECT_Y_PADDING;Te.utils.dom.createSvgElement(Te.utils.Svg.TEXT,{class:"blocklyText blocklyMultilineText",x:l.FIELD_BORDER_RECT_X_PADDING,y:d+l.FIELD_BORDER_RECT_Y_PADDING,dy:l.FIELD_TEXT_BASELINE},r).appendChild(document.createTextNode(u[p])),d+=m}if(this.isBeingEdited_){const p=this.htmlInput_;this.isOverflowedY_?Te.utils.dom.addClass(p,"blocklyHtmlTextAreaInputOverflowedY"):Te.utils.dom.removeClass(p,"blocklyHtmlTextAreaInputOverflowedY")}if(this.updateSize_(),this.isBeingEdited_){s.RTL?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_();const p=this.htmlInput_;this.isTextValid_?(Te.utils.dom.removeClass(p,"blocklyInvalidInput"),Te.utils.aria.setState(p,Te.utils.aria.State.INVALID,!1)):(Te.utils.dom.addClass(p,"blocklyInvalidInput"),Te.utils.aria.setState(p,Te.utils.aria.State.INVALID,!0))}}updateSize_(){const s=this.getConstants();if(!s)throw Error("Constants not found");const i=this.textGroup.childNodes,r=s.FIELD_TEXT_FONTSIZE,l=s.FIELD_TEXT_FONTWEIGHT,u=s.FIELD_TEXT_FONTFAMILY;let d=0,p=0;for(let m=0;m<i.length;m++){const f=i[m],v=Te.utils.dom.getFastTextWidth(f,r,l,u);v>d&&(d=v),p+=s.FIELD_TEXT_HEIGHT+(m>0?s.FIELD_BORDER_RECT_Y_PADDING:0)}if(this.isBeingEdited_){const m=String(this.value_).split(`
1058
+ `),f=Te.utils.dom.createSvgElement(Te.utils.Svg.TEXT,{class:"blocklyText blocklyMultilineText"});for(let _=0;_<m.length;_++){m[_].length>this.maxDisplayLength&&(m[_]=m[_].substring(0,this.maxDisplayLength)),f.textContent=m[_];const k=Te.utils.dom.getFastTextWidth(f,r,l,u);k>d&&(d=k)}const v=this.htmlInput_,w=v.offsetWidth-v.clientWidth;d+=w}this.borderRect_&&(p+=s.FIELD_BORDER_RECT_Y_PADDING*2,d+=s.FIELD_BORDER_RECT_X_PADDING*2+1,this.borderRect_.setAttribute("width",`${d}`),this.borderRect_.setAttribute("height",`${p}`)),this.size_.width=d,this.size_.height=p,this.positionBorderRect_()}showInlineEditor_(s){const i=this.getSourceBlock();if(!i)throw new Hp;Te.WidgetDiv.show(this,i.RTL,this.widgetDispose_.bind(this),this.workspace_),this.htmlInput_=this.widgetCreate_(),this.isBeingEdited_=!0,this.valueWhenEditorWasOpened_=this.value_,s||(this.htmlInput_.focus({preventScroll:!0}),this.htmlInput_.select())}getEditorText_(s){return`${s}`}getScaledBBox(){let s,i,r;const l=this.getSourceBlock();if(!l)throw new Hp;if(this.isFullBlockField()){const u=this.sourceBlock_.getHeightWidth(),d=l.workspace.scale;r=this.getAbsoluteXY_(),s=(u.width+1)*d,i=(u.height+1)*d,Te.utils.userAgent.GECKO?(r.x+=1.5*d,r.y+=1.5*d):(r.x-=.5*d,r.y-=.5*d)}else{const u=this.borderRect_.getBoundingClientRect();r=Te.utils.style.getPageOffset(this.borderRect_),s=u.width,i=u.height}return new Te.utils.Rect(r.y,r.y+i,r.x,r.x+s)}resizeEditor_(){Te.renderManagement.finishQueuedRenders().then(()=>{const s=this.getSourceBlock();if(!s)throw new Hp;const i=Te.WidgetDiv.getDiv(),r=this.getScaledBBox();i.style.width=`${r.right-r.left}px`,i.style.height=`${r.bottom-r.top}px`;const l=s.RTL?r.right-i.offsetWidth:r.left,u=r.top;i.style.left=`${l}px`,i.style.top=`${u}px`})}unbindInputEvents_(){this.onKeyDownWrapper_&&(Te.browserEvents.unbind(this.onKeyDownWrapper_),this.onKeyDownWrapper_=null),this.onKeyInputWrapper_&&(Te.browserEvents.unbind(this.onKeyInputWrapper_),this.onKeyInputWrapper_=null)}getClickTarget_(){return this.clickTarget_||this.getSvgRoot()}widgetDispose_(){this.isBeingEdited_=!1,this.isTextValid_=!0,this.forceRerender(),this.onFinishEditing_(this.value_),this.sourceBlock_&&Te.Events.isEnabled()&&this.valueWhenEditorWasOpened_!==null&&this.valueWhenEditorWasOpened_!==this.value_&&(Te.Events.fire(new(Te.Events.get("change"))(this.sourceBlock_,"field",this.name||null,this.valueWhenEditorWasOpened_,this.value_)),this.valueWhenEditorWasOpened_=null),Te.Events.setGroup(!1),this.unbindInputEvents_();const s=Te.WidgetDiv.getDiv().style;s.width="auto",s.height="auto",s.fontSize="",s.transition="",s.boxShadow="",this.htmlInput_=null;const i=this.getClickTarget_();if(!i)throw new Error("A click target has not been set.");Te.utils.dom.removeClass(i,"editing")}showEditor_(s,i){this.workspace_=this.sourceBlock_.workspace,!i&&this.workspace_.options.modalInputs&&(Te.utils.userAgent.MOBILE||Te.utils.userAgent.ANDROID||Te.utils.userAgent.IPAD)?this.showPromptEditor_():this.showInlineEditor_(!!i),this.forceRerender()}widgetCreate_(){const s=Te.WidgetDiv.getDiv(),i=this.workspace_.getScale(),r=this.getConstants();if(!r)throw Error("Constants not found");const l=document.createElement("textarea");l.className="blocklyHtmlInput blocklyHtmlTextAreaInput",l.setAttribute("spellcheck",String(this.spellcheck_));const u=`${r.FIELD_TEXT_FONTSIZE*i}pt`;s.style.fontSize=u,l.style.fontSize=u;const d=`${Te.FieldTextInput.BORDERRADIUS*i}px`;l.style.borderRadius=d;const p=r.FIELD_BORDER_RECT_X_PADDING*i,m=r.FIELD_BORDER_RECT_Y_PADDING*i/2;l.style.padding=`${m}px ${p}px ${m}px ${p}px`;const f=r.FIELD_TEXT_HEIGHT+r.FIELD_BORDER_RECT_Y_PADDING;return l.style.lineHeight=`${f*i}px`,s.appendChild(l),l.value=l.defaultValue=this.getEditorText_(this.value_),l.setAttribute("data-untyped-default-value",String(this.value_)),l.setAttribute("data-old-value",""),Te.utils.userAgent.GECKO?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_(),this.bindInputEvents_(l),l}setMaxLines(s){typeof s=="number"&&s>0&&s!==this.maxLines_&&(this.maxLines_=s,this.forceRerender())}getMaxLines(){return this.maxLines_}onHtmlInputKeyDown_(s){s.key!=="Enter"&&this.onHtmlInputKeyDownSuper_(s)}static fromJson(s){const i=Te.utils.parsing.replaceMessageReferences(s.text);return new this(i,void 0,s)}}Te.Css.register(`
1059
+ .blocklyHtmlTextAreaInput {
1060
+ font-family: monospace;
1061
+ resize: none;
1062
+ overflow: hidden;
1063
+ height: 100%;
1064
+ text-align: left;
1065
+ }
1066
+
1067
+ .blocklyHtmlTextAreaInputOverflowedY {
1068
+ overflow-y: scroll;
1069
+ }
1070
+ `);/**
1071
+ * @license
1072
+ * Copyright 2024 Google LLC
1073
+ * SPDX-License-Identifier: Apache-2.0
1074
+ */const TC="text_multiline",V0={type:TC,message0:"%1 %2",args0:[{type:"field_image",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAARCAYAAADpPU2iAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAdhgAAHYYBXaITgQAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS42/U4J6AAAAP1JREFUOE+Vks0KQUEYhjmRIja4ABtZ2dm5A3t3Ia6AUm7CylYuQRaUhZSlLZJiQbFAyRnPN33y01HOW08z8873zpwzM4F3GWOCruvGIE4/rLaV+Nq1hVGMBqzhqlxgCys4wJA65xnogMHsQ5lujnYHTejBBCK2mE4abjCgMGhNxHgDFWjDSG07kdfVa2pZMf4ZyMAdWmpZMfYOsLiDMYMjlMB+K613QISRhTnITnsYg5yUd0DETmEoMlkFOeIT/A58iyK5E18BuTBfgYXfwNJv4P9/oEBerLylOnRhygmGdPpTTBZAPkde61lbQe4moWUvYUZYLfUNftIY4zwA5X2Z9AYnQrEAAAAASUVORK5CYII=",width:12,height:17,alt:"¶"},{type:"field_multilinetext",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["parent_tooltip_when_inline"]};function G0(a,s){const i=s.multiline_quote_(a.getFieldValue("TEXT")),r=i.indexOf("+")!==-1?6.2:0;return[i,r]}const K0=window.Blockly.common.createBlockDefinitionsFromJsonArray([V0]);K0[TC];/**
1075
+ * @license
1076
+ * Copyright 2023 Google LLC
1077
+ * SPDX-License-Identifier: Apache-2.0
1078
+ */const Oe=window.Blockly;class kg extends Oe.Field{picker=null;highlightedIndex=null;boundEvents=[];SERIALIZABLE=!0;CURSOR="default";isDirty_=!1;colours=["#ffffff","#cccccc","#c0c0c0","#999999","#666666","#333333","#000000","#ffcccc","#ff6666","#ff0000","#cc0000","#990000","#660000","#330000","#ffcc99","#ff9966","#ff9900","#ff6600","#cc6600","#993300","#663300","#ffff99","#ffff66","#ffcc66","#ffcc33","#cc9933","#996633","#663333","#ffffcc","#ffff33","#ffff00","#ffcc00","#999900","#666600","#333300","#99ff99","#66ff99","#33ff33","#33cc00","#009900","#006600","#003300","#99ffff","#33ffff","#66cccc","#00cccc","#339999","#336666","#003333","#ccffff","#66ffff","#33ccff","#3366ff","#3333ff","#000099","#000066","#ccccff","#9999ff","#6666cc","#6633ff","#6600cc","#333399","#330099","#ffccff","#ff99ff","#cc66cc","#cc33cc","#993399","#663366","#330033"];titles=[];columns=7;constructor(s,i,r){super(s),s!==Symbol("SKIP_SETUP")&&(r&&this.configure_(r),this.setValue(s),i&&this.setValidator(i))}configure_(s){super.configure_(s),s.colourOptions&&(this.colours=s.colourOptions),s.colourTitles&&(this.titles=s.colourTitles),s.columns&&(this.columns=s.columns)}initView(){const s=this.getConstants();if(!s)throw Error("Constants not found");this.size_=new Oe.utils.Size(s.FIELD_COLOUR_DEFAULT_WIDTH,s.FIELD_COLOUR_DEFAULT_HEIGHT),this.createBorderRect_(),this.getBorderRect().style.fillOpacity="1",this.getBorderRect().setAttribute("stroke","#fff"),this.isFullBlockField()&&(this.clickTarget_=this.sourceBlock_.getSvgRoot())}isFullBlockField(){if(!this.getSourceBlock())throw new Oe.UnattachedFieldError;const i=this.getConstants();return this.blockIsSimpleReporter()&&!!(i!=null&&i.FIELD_COLOUR_FULL_BLOCK)}blockIsSimpleReporter(){const s=this.getSourceBlock();if(!s)throw new Oe.UnattachedFieldError;if(!s.outputConnection)return!1;for(const i of s.inputList)if(i.connection||i.fieldRow.length>1)return!1;return!0}applyColour(){const s=this.getSourceBlock();if(!s)throw new Oe.UnattachedFieldError;if(!this.fieldGroup_)return;const i=this.borderRect_;if(!i)throw new Error("The border rect has not been initialized");this.isFullBlockField()?(i.style.display="none",s.pathObject.svgPath.setAttribute("fill",this.getValue()),s.pathObject.svgPath.setAttribute("stroke","#fff")):(i.style.display="block",i.style.fill=this.getValue())}getSize(){var s;return(s=this.getConstants())!=null&&s.FIELD_COLOUR_FULL_BLOCK&&(this.render_(),this.isDirty_=!1),super.getSize()}render_(){super.render_();const s=this.getSourceBlock();if(!s)throw new Oe.UnattachedFieldError;s.applyColour()}updateSize_(s){const i=this.getConstants();if(!i)return;let r,l;this.isFullBlockField()?(r=(s??0)*2,l=i.FIELD_TEXT_HEIGHT):(r=i.FIELD_COLOUR_DEFAULT_WIDTH,l=i.FIELD_COLOUR_DEFAULT_HEIGHT),this.size_.height=l,this.size_.width=r,this.positionBorderRect_()}doClassValidation_(s){return typeof s!="string"?null:Oe.utils.colour.parse(s)}getText(){let s=this.value_;return/^#(.)\1(.)\2(.)\3$/.test(s)&&(s=`#${s[1]}${s[3]}${s[5]}`),s}setColours(s,i){return this.colours=s,i&&(this.titles=i),this}setColumns(s){return this.columns=s,this}showEditor_(){if(this.dropdownCreate(),!this.picker)throw Error("Picker not found");Oe.DropDownDiv.getContentDiv().appendChild(this.picker),Oe.DropDownDiv.showPositionedByField(this,this.dropdownDispose.bind(this)),this.picker.focus({preventScroll:!0})}onClick(s){const i=s.target,r=i==null?void 0:i.getAttribute("data-colour");r!==null&&(this.setValue(r),Oe.DropDownDiv.hideIfOwner(this))}onKeyDown(s){let i=!0,r;switch(s.key){case"ArrowUp":this.moveHighlightBy(0,-1);break;case"ArrowDown":this.moveHighlightBy(0,1);break;case"ArrowLeft":this.moveHighlightBy(-1,0);break;case"ArrowRight":this.moveHighlightBy(1,0);break;case"Enter":if(r=this.getHighlighted(),r){const l=r.getAttribute("data-colour");l!==null&&this.setValue(l)}Oe.DropDownDiv.hideWithoutAnimation();break;default:i=!1}i&&s.stopPropagation()}moveHighlightBy(s,i){if(!this.highlightedIndex)return;const r=this.colours,l=this.columns;let u=this.highlightedIndex%l,d=Math.floor(this.highlightedIndex/l);u+=s,d+=i,s<0?u<0&&d>0?(u=l-1,d--):u<0&&(u=0):s>0?u>l-1&&d<Math.floor(r.length/l)-1?(u=0,d++):u>l-1&&u--:i<0?d<0&&(d=0):i>0&&d>Math.floor(r.length/l)-1&&(d=Math.floor(r.length/l)-1);const p=this.picker.childNodes[d].childNodes[u],m=d*l+u;this.setHighlightedCell(p,m)}onMouseMove(s){const i=s.target,r=i&&Number(i.getAttribute("data-index"));r!==null&&r!==this.highlightedIndex&&this.setHighlightedCell(i,r)}onMouseEnter(){var s;(s=this.picker)==null||s.focus({preventScroll:!0})}onMouseLeave(){var i;(i=this.picker)==null||i.blur();const s=this.getHighlighted();s&&Oe.utils.dom.removeClass(s,"blocklyColourHighlighted")}getHighlighted(){var l;if(!this.highlightedIndex)return null;const s=this.highlightedIndex%this.columns,i=Math.floor(this.highlightedIndex/this.columns),r=(l=this.picker)==null?void 0:l.childNodes[i];return r?r.childNodes[s]:null}setHighlightedCell(s,i){const r=this.getHighlighted();r&&Oe.utils.dom.removeClass(r,"blocklyColourHighlighted"),Oe.utils.dom.addClass(s,"blocklyColourHighlighted"),this.highlightedIndex=i;const l=s.getAttribute("id");l&&this.picker&&Oe.utils.aria.setState(this.picker,Oe.utils.aria.State.ACTIVEDESCENDANT,l)}dropdownCreate(){const s=this.columns,i=this.colours,r=this.getValue(),l=document.createElement("table");l.className="blocklyColourTable",l.tabIndex=0,l.dir="ltr",Oe.utils.aria.setRole(l,Oe.utils.aria.Role.GRID),Oe.utils.aria.setState(l,Oe.utils.aria.State.EXPANDED,!0),Oe.utils.aria.setState(l,Oe.utils.aria.State.ROWCOUNT,Math.floor(i.length/s)),Oe.utils.aria.setState(l,Oe.utils.aria.State.COLCOUNT,s);let u=null;for(let d=0;d<i.length;d++){d%s===0&&(u=document.createElement("tr"),Oe.utils.aria.setRole(u,Oe.utils.aria.Role.ROW),l.appendChild(u));const p=document.createElement("td");u.appendChild(p),p.setAttribute("data-colour",i[d]),p.title=this.titles[d]||i[d],p.id=Oe.utils.idGenerator.getNextUniqueId(),p.setAttribute("data-index",`${d}`),Oe.utils.aria.setRole(p,Oe.utils.aria.Role.GRIDCELL),Oe.utils.aria.setState(p,Oe.utils.aria.State.LABEL,i[d]),Oe.utils.aria.setState(p,Oe.utils.aria.State.SELECTED,i[d]===r),p.style.backgroundColor=i[d],i[d]===r&&(p.className="blocklyColourSelected",this.highlightedIndex=d)}this.boundEvents.push(Oe.browserEvents.conditionalBind(l,"pointerdown",this,this.onClick,!0)),this.boundEvents.push(Oe.browserEvents.conditionalBind(l,"pointermove",this,this.onMouseMove,!0)),this.boundEvents.push(Oe.browserEvents.conditionalBind(l,"pointerenter",this,this.onMouseEnter,!0)),this.boundEvents.push(Oe.browserEvents.conditionalBind(l,"pointerleave",this,this.onMouseLeave,!0)),this.boundEvents.push(Oe.browserEvents.conditionalBind(l,"keydown",this,this.onKeyDown,!1)),this.picker=l}dropdownDispose(){for(const s of this.boundEvents)Oe.browserEvents.unbind(s);this.boundEvents.length=0,this.picker=null,this.highlightedIndex=null}static fromJson(s){return new this(s.colour,void 0,s)}}kg.prototype.DEFAULT_VALUE="#ffffff";Oe.Css.register(`
1079
+ .blocklyColourTable {
1080
+ border-collapse: collapse;
1081
+ display: block;
1082
+ outline: none;
1083
+ padding: 1px;
1084
+ }
1085
+
1086
+ .blocklyColourTable>tr>td {
1087
+ border: 0.5px solid #888;
1088
+ box-sizing: border-box;
1089
+ cursor: pointer;
1090
+ display: inline-block;
1091
+ height: 20px;
1092
+ padding: 0;
1093
+ width: 20px;
1094
+ }
1095
+
1096
+ .blocklyColourTable>tr>td.blocklyColourHighlighted {
1097
+ border-color: #eee;
1098
+ box-shadow: 2px 2px 7px 2px rgba(0, 0, 0, 0.3);
1099
+ position: relative;
1100
+ }
1101
+
1102
+ .blocklyColourSelected, .blocklyColourSelected:hover {
1103
+ border-color: #eee !important;
1104
+ outline: 1px solid #333;
1105
+ position: relative;
1106
+ }
1107
+ `);/**
1108
+ * @license
1109
+ * Copyright 2024 Google LLC
1110
+ * SPDX-License-Identifier: Apache-2.0
1111
+ */const kC="colour_picker",Y0={type:kC,message0:"%1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],output:"Colour",helpUrl:"%{BKY_COLOUR_PICKER_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_PICKER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]};function J0(a,s){return[s.quote_(a.getFieldValue("COLOUR")),0]}const X0=window.Blockly.common.createBlockDefinitionsFromJsonArray([Y0]);X0[kC];/**
1112
+ * @license
1113
+ * Copyright 2024 Google LLC
1114
+ * SPDX-License-Identifier: Apache-2.0
1115
+ */const SC="colour_random",q0={type:SC,message0:"%{BKY_COLOUR_RANDOM_TITLE}",output:"Colour",helpUrl:"%{BKY_COLOUR_RANDOM_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RANDOM_TOOLTIP}"};function Z0(a,s){return[`${s.provideFunction_("colourRandom",`
1116
+ function ${s.FUNCTION_NAME_PLACEHOLDER_}() {
1117
+ var num = Math.floor(Math.random() * 0x1000000);
1118
+ return '#' + ('00000' + num.toString(16)).substr(-6);
1119
+ }
1120
+ `)}()`,2]}const Q0=window.Blockly.common.createBlockDefinitionsFromJsonArray([q0]);Q0[SC];/**
1121
+ * @license
1122
+ * Copyright 2024 Google LLC
1123
+ * SPDX-License-Identifier: Apache-2.0
1124
+ */const EC="colour_rgb",eA={type:EC,message0:"%{BKY_COLOUR_RGB_TITLE} %{BKY_COLOUR_RGB_RED} %1 %{BKY_COLOUR_RGB_GREEN} %2 %{BKY_COLOUR_RGB_BLUE} %3",args0:[{type:"input_value",name:"RED",check:"Number",align:"RIGHT"},{type:"input_value",name:"GREEN",check:"Number",align:"RIGHT"},{type:"input_value",name:"BLUE",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_RGB_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RGB_TOOLTIP}"};function tA(a,s){const i=s.valueToCode(a,"RED",99)||0,r=s.valueToCode(a,"GREEN",99)||0,l=s.valueToCode(a,"BLUE",99)||0;return[`${s.provideFunction_("colourRgb",`
1125
+ function ${s.FUNCTION_NAME_PLACEHOLDER_}(r, g, b) {
1126
+ r = Math.max(Math.min(Number(r), 100), 0) * 2.55;
1127
+ g = Math.max(Math.min(Number(g), 100), 0) * 2.55;
1128
+ b = Math.max(Math.min(Number(b), 100), 0) * 2.55;
1129
+ r = ('0' + (Math.round(r) || 0).toString(16)).slice(-2);
1130
+ g = ('0' + (Math.round(g) || 0).toString(16)).slice(-2);
1131
+ b = ('0' + (Math.round(b) || 0).toString(16)).slice(-2);
1132
+ return '#' + r + g + b;
1133
+ }
1134
+ `)}(${i}, ${r}, ${l})`,2]}const sA=window.Blockly.common.createBlockDefinitionsFromJsonArray([eA]);sA[EC];/**
1135
+ * @license
1136
+ * Copyright 2024 Google LLC
1137
+ * SPDX-License-Identifier: Apache-2.0
1138
+ */const IC="colour_blend",oA={type:IC,message0:"%{BKY_COLOUR_BLEND_TITLE} %{BKY_COLOUR_BLEND_COLOUR1} %1 %{BKY_COLOUR_BLEND_COLOUR2} %2 %{BKY_COLOUR_BLEND_RATIO} %3",args0:[{type:"input_value",name:"COLOUR1",check:"Colour",align:"RIGHT"},{type:"input_value",name:"COLOUR2",check:"Colour",align:"RIGHT"},{type:"input_value",name:"RATIO",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_BLEND_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_BLEND_TOOLTIP}"};function iA(a,s){const i=s.valueToCode(a,"COLOUR1",99)||"'#000000'",r=s.valueToCode(a,"COLOUR2",99)||"'#000000'",l=s.valueToCode(a,"RATIO",99)||.5;return[`${s.provideFunction_("colourBlend",`
1139
+ function ${s.FUNCTION_NAME_PLACEHOLDER_}(c1, c2, ratio) {
1140
+ ratio = Math.max(Math.min(Number(ratio), 1), 0);
1141
+ var r1 = parseInt(c1.substring(1, 3), 16);
1142
+ var g1 = parseInt(c1.substring(3, 5), 16);
1143
+ var b1 = parseInt(c1.substring(5, 7), 16);
1144
+ var r2 = parseInt(c2.substring(1, 3), 16);
1145
+ var g2 = parseInt(c2.substring(3, 5), 16);
1146
+ var b2 = parseInt(c2.substring(5, 7), 16);
1147
+ var r = Math.round(r1 * (1 - ratio) + r2 * ratio);
1148
+ var g = Math.round(g1 * (1 - ratio) + g2 * ratio);
1149
+ var b = Math.round(b1 * (1 - ratio) + b2 * ratio);
1150
+ r = ('0' + (r || 0).toString(16)).slice(-2);
1151
+ g = ('0' + (g || 0).toString(16)).slice(-2);
1152
+ b = ('0' + (b || 0).toString(16)).slice(-2);
1153
+ return '#' + r + g + b;
1154
+ }
1155
+ `)}(${i}, ${r}, ${l})`,2]}const nA=window.Blockly.common.createBlockDefinitionsFromJsonArray([oA]);nA[IC];function rA(){window.Blockly.FieldMultilineInput||(window.Blockly.fieldRegistry.register("field_multilinetext",oc),window.Blockly.JavaScript.forBlock.text_multiline=G0,window.Blockly.FieldMultilineInput=oc,Object.assign(window.Blockly.Blocks,window.Blockly.common.createBlockDefinitionsFromJsonArray([{type:"text_multiline",message0:"%1 %2",args0:[{type:"field_image",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAARCAYAAADpPU2iAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAdhgAAHYYBXaITgQAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS42/U4J6AAAAP1JREFUOE+Vks0KQUEYhjmRIja4ABtZ2dm5A3t3Ia6AUm7CylYuQRaUhZSlLZJiQbFAyRnPN33y01HOW08z8873zpwzM4F3GWOCruvGIE4/rLaV+Nq1hVGMBqzhqlxgCys4wJA65xnogMHsQ5lujnYHTejBBCK2mE4abjCgMGhNxHgDFWjDSG07kdfVa2pZMf4ZyMAdWmpZMfYOsLiDMYMjlMB+K613QISRhTnITnsYg5yUd0DETmEoMlkFOeIT/A58iyK5E18BuTBfgYXfwNJv4P9/oEBerLylOnRhygmGdPpTTBZAPkde61lbQe4moWUvYUZYLfUNftIY4zwA5X2Z9AYnQrEAAAAASUVORK5CYII=",width:12,height:17,alt:"¶"},{type:"field_multilinetext",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["parent_tooltip_when_inline"]}]))),window.Blockly.FieldColour||(window.Blockly.fieldRegistry.register("field_colour",kg),window.Blockly.JavaScript.forBlock.colour_picker=J0,window.Blockly.JavaScript.forBlock.colour_blend=iA,window.Blockly.JavaScript.forBlock.colour_random=Z0,window.Blockly.JavaScript.forBlock.colour_rgb=tA,window.Blockly.FieldColour=kg,Object.assign(window.Blockly.Blocks,window.Blockly.common.createBlockDefinitionsFromJsonArray([{type:"colour_picker",message0:"%1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],output:"Colour",helpUrl:"%{BKY_COLOUR_PICKER_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_PICKER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]}])),Object.assign(window.Blockly.Blocks,window.Blockly.common.createBlockDefinitionsFromJsonArray([{type:"colour_random",message0:"%{BKY_COLOUR_RANDOM_TITLE}",output:"Colour",helpUrl:"%{BKY_COLOUR_RANDOM_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RANDOM_TOOLTIP}"}])),Object.assign(window.Blockly.Blocks,window.Blockly.common.createBlockDefinitionsFromJsonArray([{type:"colour_rgb",message0:"%{BKY_COLOUR_RGB_TITLE} %{BKY_COLOUR_RGB_RED} %1 %{BKY_COLOUR_RGB_GREEN} %2 %{BKY_COLOUR_RGB_BLUE} %3",args0:[{type:"input_value",name:"RED",check:"Number",align:"RIGHT"},{type:"input_value",name:"GREEN",check:"Number",align:"RIGHT"},{type:"input_value",name:"BLUE",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_RGB_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RGB_TOOLTIP}"}])),Object.assign(window.Blockly.Blocks,window.Blockly.common.createBlockDefinitionsFromJsonArray([{type:"colour_blend",message0:"%{BKY_COLOUR_BLEND_TITLE} %{BKY_COLOUR_BLEND_COLOUR1} %1 %{BKY_COLOUR_BLEND_COLOUR2} %2 %{BKY_COLOUR_BLEND_RATIO} %3",args0:[{type:"input_value",name:"COLOUR1",check:"Colour",align:"RIGHT"},{type:"input_value",name:"COLOUR2",check:"Colour",align:"RIGHT"},{type:"input_value",name:"RATIO",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_BLEND_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_BLEND_TOOLTIP}"}])));const a=window.Blockly.JavaScript;a.forBlock&&Object.keys(a).forEach(s=>{typeof a[s]=="function"&&(a.forBlock[s]||(console.log(`Migrating Blockly.JavaScript.${s} to Blockly.JavaScript.forBlock.${s}`),a.forBlock[s]=a[s],delete a[s]))})}let Ll=!1,Bl=!1,Wp=null,Vp=null;const T_=[];function xC(a,s,i,r){var l;if(r=r||[],(a.tagName==="BLOCK"||a.tagName==="block")&&(i=a.id),a.tagName==="FIELD"||a.tagName==="field")for(let u=0;u<a.attributes.length;u++){const d=(a.attributes[u].value||"").toLowerCase();a.attributes[u].nodeName==="name"&&(d==="oid"||d==="text"||d==="var")&&i&&(l=a.innerHTML)!=null&&l.toLowerCase().includes(s)&&r.push(i)}return a.childNodes.forEach(u=>xC(u,s,i,r)),r}class je extends X.Component{blockly=null;blocklyWorkspace=null;originalCode;someSelected=null;changeTimer=null;someSelectedTime=0;ignoreChanges=!1;blinkBlock;onResizeBind;didUpdate=null;lastCommand="";lastSearch;static Blockly=window.Blockly;constructor(s){super(s),this.state={languageOwnLoaded:Bl,languageBlocklyLoaded:Ll,changed:!1,message:"",error:"",themeType:this.props.themeType,exportText:"",importText:!1,searchText:this.props.searchText||"",showInputPrompt:null},this.originalCode=s.code||"",this.someSelected=null,this.onResizeBind=this.onResize.bind(this),this.lastSearch=this.props.searchText||"",this.blinkBlock=null,rA(),je.Blockly.dialog.setPrompt(this.onShowNameDialog),this.loadLanguages()}onShowNameDialog=(s,i,r)=>{this.setState({showInputPrompt:{promptText:s,defaultText:i,callback:r,value:i}})};static loadJS(s,i,r){const l=document.createElement("script");try{l.src=s,l.onload=i,l.onerror=i,(r||window.document.body).appendChild(l)}catch(u){console.error(`Cannot load ${s}: ${u}`),i&&i()}}static loadScripts(s,i){if(!(s!=null&&s.length)){i&&i();return}const r=s.pop();r&&!T_.includes(r)?(T_.push(r),je.loadJS(`../../adapter/${r}/blockly.js`,()=>setTimeout(()=>je.loadScripts(s,i),0))):setTimeout(()=>je.loadScripts(s,i),0)}static loadCustomBlockly(s,i){var l;const r=[];for(const u in s)!Object.prototype.hasOwnProperty.call(s,u)||!s[u]||!u.match(/^system\.adapter\./)||s[u].type!=="adapter"||(l=s[u].common)!=null&&l.blockly&&(console.log(`Detected custom blockly: ${s[u].common.name}`),r.push(s[u].common.name));je.loadScripts(r,i)}static loadXMLDoc(s){let i;return window.DOMParser?i=r=>new window.DOMParser().parseFromString(r,"text/xml"):typeof window.ActiveXObject<"u"&&new window.ActiveXObject("Microsoft.XMLDOM")?i=r=>{const l=new window.ActiveXObject("Microsoft.XMLDOM");return l.async="false",l.loadXML(r),l}:i=()=>null,i(s)}searchBlocks(s){if(this.blocklyWorkspace){const i=je.Blockly.Xml.workspaceToDom(this.blocklyWorkspace),r=xC(i,s.toLowerCase());return console.log(`Search "${s}" found blocks: ${r.length?JSON.stringify(r):"none"}`),r}return[]}searchId(){const s=this.lastSearch?this.searchBlocks(this.lastSearch):null;s!=null&&s.length?(this.someSelected=s,this.someSelected.forEach(i=>{var r;return(r=this.blocklyWorkspace)==null?void 0:r.highlightBlock(i,!0)}),this.someSelectedTime=Date.now()):this.someSelected&&(this.someSelected.forEach(i=>{var r;return(r=this.blocklyWorkspace)==null?void 0:r.highlightBlock(i,!1)}),this.someSelected=null)}UNSAFE_componentWillReceiveProps(s){s.command&&this.lastCommand!==s.command&&(this.lastCommand=s.command,setTimeout(()=>this.lastCommand="",300),this.lastCommand==="check"?this.blocklyCheckBlocks((i,r)=>{i?(r&&je.blocklyBlinkBlock(r),this.setState({error:{text:b.I18n.t(i),title:b.I18n.t("Error was found")}}),this.blinkBlock=r):this.setState({message:b.I18n.t("Ok")})}):this.lastCommand==="export"?this.exportBlocks():this.lastCommand==="import"&&this.importBlocks()),s.searchText!==this.lastSearch&&(this.lastSearch=s.searchText,this.searchId()),this.state.themeType!==s.themeType&&this.setState({themeType:s.themeType},()=>this.updateBackground()),this.originalCode!==s.code&&(this.originalCode=s.code||"",this.loadCode(),this.searchId())}loadLanguages(){if(!Ll){const s=window.document.createElement("script");s.setAttribute("type","text/javascript"),s.setAttribute("src",`google-blockly/msg/js/${b.I18n.getLanguage()}.js`),s.onload=()=>{Ll=!0,this.setState({languageBlocklyLoaded:Ll})},window.document.getElementsByTagName("head")[0].appendChild(s)}if(!Bl){const s=window.document.createElement("script");s.setAttribute("type","text/javascript"),s.setAttribute("src",`google-blockly/own/msg/${b.I18n.getLanguage()}.js`),s.onload=()=>{Bl=!0,this.setState({languageOwnLoaded:Bl})},window.document.getElementsByTagName("head")[0].appendChild(s)}}onResize(){this.blocklyWorkspace&&je.Blockly.svgResize(this.blocklyWorkspace)}static jsCode2Blockly(s){s=s||"";const i=s.split(/[\r\n]+|\r|\n/g);let r="";for(let u=i.length-1;u>=0;u--)if(i[u].substring(0,2)==="//"){r=i[u].substring(2);break}if(r.substring(0,4)==="<xml")return r;let l;try{l=window.decodeURIComponent(window.atob(r))}catch(u){l=null,console.error(`cannot decode: ${r}`),console.error(u)}return l}static blocklyBlinkBlock(s){for(let i=300;i<3e3;i+=300)setTimeout(()=>s.select(),i),setTimeout(()=>s.unselect(),i+150)}blocklyRemoveOrphanedShadows(){if(this.blocklyWorkspace){const s=this.blocklyWorkspace.getAllBlocks();let i;for(let r=0;i=s[r];r++)if(i.isShadow()){const l=i.getConnections_(!0);let u;for(let d=0;u=l[d];d++)if(!u.targetConnection){i.dispose();break}}}}blocklyCheckBlocks(s){let i;if(!this.blocklyWorkspace||this.blocklyWorkspace.getAllBlocks().length===0)return s&&s("no blocks found"),!1;let r=this.blocklyGetUnconnectedBlock();return r?i="not properly connected":(r=this.blocklyGetBlockWithWarning(),r&&(i="warning on this block")),r?(s?s(i,r):je.blocklyBlinkBlock(r),!1):(s(),!0)}blocklyGetUnconnectedBlock(){var r;const s=(r=this.blocklyWorkspace)==null?void 0:r.getAllBlocks();let i;if(s)for(let l=0;i=s[l];l++){const u=i.getConnections_(!0);let d;for(let p=0;d=u[p];p++)if(!d.sourceBlock_||(d.type===je.Blockly.INPUT_VALUE||d.type===je.Blockly.OUTPUT_VALUE)&&!d.targetConnection&&!d._optional)return i}return null}blocklyGetBlockWithWarning(){var r;const s=(r=this.blocklyWorkspace)==null?void 0:r.getAllBlocks();let i;if(s){for(let l=0;i=s[l];l++)if(i.warning)return i}return null}blocklyCode2JSCode(s){if(!this.blocklyWorkspace)return"";let i=je.Blockly.JavaScript.workspaceToCode(this.blocklyWorkspace);if(!s){i+=`
1156
+ `;const r=je.Blockly.Xml.workspaceToDom(this.blocklyWorkspace),l=je.Blockly.Xml.domToText(r);i+=`//${btoa(encodeURIComponent(l))}`}return i}exportBlocks(){if(!this.blocklyWorkspace)return;let s;const i=je.Blockly.getSelected();if(i){const r=je.Blockly.Xml.blockToDom(i),l=i.getRelativeToSurfaceXY();r.setAttribute("x",(i.RTL?-l.x:l.x).toString()),r.setAttribute("y",l.y.toString()),s=je.Blockly.Xml.domToPrettyText(r)}else{const r=je.Blockly.Xml.workspaceToDom(this.blocklyWorkspace);s=je.Blockly.Xml.domToPrettyText(r)}this.setState({exportText:s})}importBlocks(){this.setState({importText:!0})}onImportBlocks(s){if(this.blocklyWorkspace&&(s=(s||"").trim(),s))try{s.startsWith("<xml")||(s=`<xml xmlns="https://developers.google.com/blockly/xml">${s}</xml>`),s=s.replace(/[\n\r]/g,"").replace(/<variables>.*<\/variables>/g,""),window.scripts.loading=!0;const i=je.Blockly.utils.xml.textToDom(s);je.Blockly.Xml.appendDomToWorkspace(i,this.blocklyWorkspace),window.scripts.loading=!1,this.onBlocklyChanged()}catch(i){this.setState({error:{text:i.toString(),title:b.I18n.t("Import error")}})}}loadCode(){if(this.blocklyWorkspace){this.ignoreChanges=!0,this.blocklyWorkspace.clear();try{const s=je.jsCode2Blockly(this.originalCode)||'<xml xmlns="https://developers.google.com/blockly/xml"></xml>';window.scripts.loading=!0;const i=je.Blockly.utils.xml.textToDom(s);je.Blockly.Xml.domToWorkspace(i,this.blocklyWorkspace),window.scripts.loading=!1}catch(s){console.error(s),setTimeout(()=>this.setState({error:b.I18n.t("Cannot extract Blockly code!")}))}setTimeout(()=>this.ignoreChanges=!1,100)}}onBlocklyChanged(){this.blocklyRemoveOrphanedShadows(),this.setState({changed:!0}),this.onChange()}async componentDidUpdate(){if(!this.blockly||(this.didUpdate&&(clearTimeout(this.didUpdate),this.didUpdate=null),this.blocklyWorkspace))return;window.addEventListener("resize",this.onResizeBind,!1),Wp=Wp||await this.getToolbox(),Vp=Vp||je.Blockly.utils.xml.textToDom(Wp),this.blocklyWorkspace=je.Blockly.inject(this.blockly,{renderer:"thrasos",theme:this.state.themeType==="dark"?C_:"classic",media:"google-blockly/media/",toolbox:Vp,zoom:{controls:!0,wheel:!1,startScale:1,maxScale:3,minScale:.3,scaleSpeed:1.2,pinch:!0},move:{scrollbars:{horizontal:!0,vertical:!0},drag:!0,wheel:!0},trashcan:!0,grid:{spacing:25,length:1,snap:!0},sounds:!1}),window.scripts={blocklyWorkspace:this.blocklyWorkspace},this.blocklyWorkspace.registerToolboxCategoryCallback("PROCEDURE",window.Blockly.Procedures.flyoutCategoryNew),this.blocklyWorkspace.addChangeListener(i=>{var r;if(this.someSelected&&Date.now()-this.someSelectedTime>500){const l=(r=this.blocklyWorkspace)==null?void 0:r.getAllBlocks();this.someSelected=null,l==null||l.forEach(u=>u.removeSelect())}[je.Blockly.Events.UI,je.Blockly.Events.CREATE,je.Blockly.Events.VIEWPORT_CHANGE].includes(i.type)||this.ignoreChanges||(this.changeTimer&&clearTimeout(this.changeTimer),this.changeTimer=setTimeout(()=>{this.changeTimer=null,this.onBlocklyChanged()},200))}),this.loadCode(),this.onResize();const s=document.getElementsByClassName("blocklyToolboxDiv")[0];this.blockly.appendChild(s),this.updateBackground(),setTimeout(()=>this.searchId(),200)}updateBackground(){var s;this.state.themeType==="dark"?(s=this.blocklyWorkspace)==null||s.setTheme(C_):this.blocklyWorkspace&&(this.blocklyWorkspace.getThemeManager(),this.blocklyWorkspace.setTheme(je.Blockly.Themes.Classic))}componentWillUnmount(){this.blocklyWorkspace&&(this.blocklyWorkspace.dispose(),this.blocklyWorkspace=null,this.changeTimer&&clearTimeout(this.changeTimer),this.changeTimer=null,window.removeEventListener("resize",this.onResizeBind))}onChange(){this.originalCode=this.blocklyCode2JSCode(),this.props.onChange&&this.props.onChange(this.originalCode)}async getToolbox(s){const i=window.document.getElementById("toolbox");let r=i==null?void 0:i.outerHTML;if(!r)return s?(console.error("Cannot load blocks!"),""):new Promise(l=>{setTimeout(()=>l(this.getToolbox(!0)),500)});if(r=r.replace(/{(\w+)}/g,(l,u)=>window.MSG[u]),window.Blockly.CustomBlocks){let l="";const u=b.I18n.getLanguage();for(let d=0;d<window.Blockly.CustomBlocks.length;d++){const p=window.Blockly.CustomBlocks[d],m=window.Blockly[p];l+=`<category name="${window.Blockly.Words[p][u]}" colour="${m.HUE}">`;for(const f in m.blocks)Object.prototype.hasOwnProperty.call(m.blocks,f)&&(l+=m.blocks[f]);l+="</category>"}r=r.replace("<category><block>%%CUSTOM_BLOCKS%%</block></category>",l)}return r}renderMessageDialog(){return this.state.message?g.jsx(b.Message,{text:typeof this.state.message=="object"?this.state.message.text:this.state.message,title:typeof this.state.message=="object"?this.state.message.title:"",onClose:()=>this.setState({message:""})},"dialogMessage"):null}renderErrorDialog(){return this.state.error?g.jsx(Ec,{text:typeof this.state.error=="object"?this.state.error.text.toString():this.state.error,title:typeof this.state.error=="object"?this.state.error.title:"",onClose:()=>{this.blinkBlock&&(je.blocklyBlinkBlock(this.blinkBlock),this.blinkBlock=null),this.setState({error:""})}},"dialogError"):null}renderExportDialog(){return this.state.exportText?g.jsx(W0,{themeType:this.state.themeType,onClose:()=>this.setState({exportText:""}),text:this.state.exportText,scriptId:this.props.scriptId},"dialogExport"):null}renderImportDialog(){return this.state.importText?g.jsx(im,{themeType:this.props.themeType,onClose:s=>{this.setState({importText:!1}),this.onImportBlocks(s)}},"dialogImport"):null}renderDialogPrompt(){return this.state.showInputPrompt?g.jsxs(y.Dialog,{onClose:()=>{var i;const s=(i=this.state.showInputPrompt)==null?void 0:i.callback;s&&s(null),this.setState({showInputPrompt:null})},maxWidth:"sm",fullWidth:!0,open:!0,children:[g.jsx(y.DialogTitle,{children:this.state.showInputPrompt.promptText}),g.jsx(y.DialogContent,{children:g.jsx(y.TextField,{variant:"standard",fullWidth:!0,autoFocus:!0,value:this.state.showInputPrompt.value,onKeyUp:s=>{var i,r;if(s.key==="Enter"){const l=(i=this.state.showInputPrompt)==null?void 0:i.callback,u=(r=this.state.showInputPrompt)==null?void 0:r.value;l&&l(u===void 0?null:u),this.setState({showInputPrompt:null})}},onChange:s=>{var r,l;const i={...this.state.showInputPrompt};(r=this.state.showInputPrompt)!=null&&r.callback&&(i.callback=(l=this.state.showInputPrompt)==null?void 0:l.callback),i.value=s.target.value,this.setState({showInputPrompt:i})}})}),g.jsxs(y.DialogActions,{children:[g.jsx(y.Button,{variant:"contained",disabled:!this.state.showInputPrompt.value,onClick:()=>{var r,l;const s=(r=this.state.showInputPrompt)==null?void 0:r.callback,i=(l=this.state.showInputPrompt)==null?void 0:l.value;s&&s(i===void 0?null:i),this.setState({showInputPrompt:null})},color:"primary",startIcon:g.jsx(Do,{}),children:b.I18n.t("Apply")}),g.jsx(y.Button,{color:"grey",variant:"contained",onClick:()=>{var i;const s=(i=this.state.showInputPrompt)==null?void 0:i.callback;s&&s(null),this.setState({showInputPrompt:null})},startIcon:g.jsx(zs,{}),children:b.I18n.t("Close")})]})]},"inputDialog"):null}render(){return this.state.languageBlocklyLoaded&&this.state.languageOwnLoaded?(this.didUpdate=setTimeout(()=>{this.didUpdate=null,this.componentDidUpdate()},100),[g.jsx("div",{ref:s=>this.blockly=s,style:{width:"100%",height:"100%",position:"relative"}},"blocklyDOM"),this.renderDialogPrompt(),this.renderMessageDialog(),this.renderErrorDialog(),this.renderExportDialog(),this.renderImportDialog()]):null}}const aA=Object.freeze(Object.defineProperty({__proto__:null,default:je},Symbol.toStringTag,{value:"Module"})),lA="_nameCard_15el3_28",cA="_iconThemCard_15el3_40",uA="_iconThemCardSelectable_15el3_49",dA="_iconHelp_15el3_53",hA="_blockName_15el3_64",pA="_controlMenuTop_15el3_123",gA="_debugInfo_15el3_132",mA="_tagCard_15el3_142",fA="_displayFlex_15el3_161",$A="_blockMarginTop_15el3_166",bA="_nameBlock_15el3_167",vA="_frontText_15el3_171",yA="_backText_15el3_177",_A="_iconTag_15el3_181",wA="_displayItalic_15el3_191",ue={nameCard:lA,iconThemCard:cA,iconThemCardSelectable:uA,iconHelp:dA,blockName:hA,controlMenuTop:pA,debugInfo:gA,tagCard:mA,displayFlex:fA,blockMarginTop:$A,nameBlock:bA,frontText:vA,backText:yA,iconTag:_A,displayItalic:wA},CA="_root_1dr6a_1",TA="_square_1dr6a_11",kA="_icon_1dr6a_16",Gp={root:CA,square:TA,icon:kA},Tr=({fullWidth:a,size:s,onClick:i,style:r,className:l,value:u,square:d,icon:p})=>g.jsx(y.Button,{variant:"outlined",color:"primary",onClick:i,fullWidth:a,style:r,className:b.Utils.clsx(Gp.root,l,d?Gp.square:""),size:s||"medium",children:p?g.jsx(b.Icon,{className:Gp.icon,src:p}):u}),SA="_root_1ucda_1",EA={root:SA},IA=({size:a,value:s,title:i,onChange:r,className:l,customValue:u,disabled:d})=>{const[p,m]=H.useState(!1);return g.jsxs(g.Fragment,{children:[g.jsx(y.Checkbox,{disabled:d,checked:!!(u?s:p),className:b.Utils.clsx(EA.root,l),onChange:f=>{u&&m(f.target.checked),r&&r(f.target.checked)},size:a||"medium"}),i||null]})},DC=H.memo(IA),xA="_root_19roy_1",k_={root:xA},ri=a=>{const[s,i]=H.useState(""),{value:r,type:l,error:u,className:d,icon:p,label:m,style:f,onChange:v,fullWidth:w,autoComplete:_,customValue:k,autoFocus:S,rows:C,size:I,variant:O,multiline:A,disabled:R}=Object.assign({value:"",type:"text",error:"",className:null,table:!1,native:{},variant:"standard",size:"medium",component:null,styleComponentBlock:null,fullWidth:!1,autoComplete:"",customValue:!1,autoFocus:!1,rows:1},a);return g.jsx(y.TextField,{error:!!u,autoFocus:S,fullWidth:w,label:m,disabled:R,variant:O,multiline:A,rows:C,value:k?r:s,type:l,helperText:u,style:f,className:b.Utils.clsx(k_.root,d),autoComplete:_,onChange:q=>{!k&&i(q.target.value),v&&v(q.target.value)},slotProps:{input:{endAdornment:p?g.jsx(y.InputAdornment,{position:"end",children:g.jsx(b.Icon,{className:k_.icon,src:p})}):null}},margin:"normal",size:I})},DA={formControl:{m:"10px 0","& .MuiFormControl-marginNormal":{mt:0,mb:0},"& > *":{color:"#2d0440 !important"},"& .MuiSelect-icon":{color:"#81688c"},"& label.Mui-focused":{color:"#81688c"},"& .MuiInput-underline:after":{borderBottomColor:"#510573"},"& .MuiInput-underline:before":{borderBottomColor:"#81688c"},"& .MuiInput-underline:hover:before":{borderBottomColor:"#81688c"}}},AA=({multiple:a,value:s,customValue:i,socket:r,title:l,attr:u,adapter:d,style:p,onChange:m,onInstanceHide:f})=>{const[v,w]=H.useState(s||"test1"),[_,k]=H.useState([]);return H.useEffect(()=>{r==null||r.getAdapterInstances(d).then(S=>{const C=S.map(I=>({value:I._id.replace("system.adapter.",""),title:I._id.replace("system.adapter.","")}));C.length===1?f(C[0].value):C.unshift({value:d,title:b.I18n.t("All")}),k(C)})},[r,d,f]),g.jsxs(y.FormControl,{sx:DA.formControl,fullWidth:!0,style:p,children:[g.jsx(y.Select,{variant:"standard",value:(i?s:v)||"_",fullWidth:!0,multiple:a,renderValue:S=>a&&Array.isArray(S)?S.join(", "):S,onChange:S=>{!i&&w(S.target.value),m(S.target.value)},input:u?g.jsx(y.Input,{name:u,id:`${u}-helper`}):g.jsx(y.Input,{name:u}),children:_.map(S=>g.jsx(y.MenuItem,{style:{placeContent:"space-between"},value:S.value||"_",children:b.I18n.t(S.title)},`key-${S.value}`))}),l?g.jsx(y.FormHelperText,{children:b.I18n.t(l)}):null]})},RA="_modalWrapper_587ci_33",OA="_modalDialog_587ci_40",S_={modalWrapper:RA,modalDialog:OA},Sg=({onClose:a,children:s,titleButtonApply:i,titleButtonClose:r,onApply:l,className:u,textInput:d,defaultValue:p,disabled:m})=>{const[f,v]=H.useState(p||""),[w]=H.useState(p||"");return g.jsxs(y.Dialog,{open:!0,maxWidth:"md",disableEscapeKeyDown:!1,onClose:a,classes:{paper:S_.modalDialog},className:S_.modalWrapper,children:[g.jsxs(y.DialogContent,{children:[d&&g.jsx(ri,{className:u,autoComplete:"off",fullWidth:!0,variant:"outlined",size:"medium",rows:10,multiline:!0,value:f,onChange:v,customValue:!0}),!d&&s]}),g.jsxs(y.DialogActions,{children:[g.jsx(y.Button,{disabled:m===void 0?w===f:m,onClick:()=>l(d?f:null),variant:"contained",color:"primary",children:b.I18n.t(i||"Ok")}),g.jsx(y.Button,{color:"grey",onClick:a,variant:"contained",children:b.I18n.t(r||"Cancel")})]})]})},MA="_root_15mo1_1",NA={root:MA},LA=({multiple:a,value:s,customValue:i,title:r,attr:l,options:u,style:d,onChange:p,className:m,doNotTranslate:f,doNotTranslate2:v})=>{const[w,_]=H.useState(s===void 0?u[0].value:s),k=i?s:w,S=k===""||k===null||k===void 0?"_":k;return g.jsxs(y.FormControl,{variant:"standard",className:b.Utils.clsx(NA.root,m),fullWidth:!0,style:d,children:[g.jsxs(y.Select,{variant:"standard",value:S,fullWidth:!0,multiple:a,renderValue:C=>{if(a&&Array.isArray(C)){C.sort();let O=C.indexOf("0");O!==-1&&(C.splice(O,1),C.push("0")),O=C.indexOf("_"),O!==-1&&(C.splice(O,1),C.unshift("_"));const A=u.find(q=>q.only);return A&&C.includes(A.value)?A.titleShort?f?A.titleShort:b.I18n.t(A.titleShort):f?A.title:b.I18n.t(A.title):C.map(q=>u.find(re=>re.value===q||q==="_"&&re.value==="")||q).map(q=>typeof q=="object"?q.titleShort?f?q.titleShort:b.I18n.t(q.titleShort):f?q.title:b.I18n.t(q.title):f?q:b.I18n.t(q)).join(", ")}const I=u?u.find(O=>O.value===C||C==="_"&&O.value===""):null;return I!=null&&I.title?f?I==null?void 0:I.title:b.I18n.t(I==null?void 0:I.title):C},onChange:C=>{if(i||_(C.target.value),a){const I=C.target.value,O=u.find(A=>A.only);if(O){const A=O.value;if(I.length===u.length-1&&I.includes(A))return p(I.filter(R=>R!==A),l);if(I.includes(A))return p(u.map(R=>R.value),l)}}p(C.target.value,l)},input:l?g.jsx(y.Input,{name:l,id:`${l}-helper`}):g.jsx(y.Input,{name:l}),children:[!a&&(u==null?void 0:u.map(C=>g.jsxs(y.MenuItem,{style:{placeContent:"space-between"},value:C.value===""||C.value===null||C.value===void 0?"_":C.value,children:[f?C.title:b.I18n.t(C.title),C.title2&&g.jsx("div",{children:v?C.title2:b.I18n.t(C.title2)})]},`key-${C.value}`))),a&&(u==null?void 0:u.map(C=>g.jsxs(y.MenuItem,{style:{placeContent:"space-between"},value:C.value||"_",children:[f?C.title:b.I18n.t(C.title)," ",g.jsx(DC,{customValue:!0,value:s==null?void 0:s.includes(C.value)})]},`key-${C.value}`)))]}),r?g.jsx(y.FormHelperText,{children:b.I18n.t(r)}):null]})},BA="_root_1gt4d_1",PA="_mark_1gt4d_27",E_={root:BA,mark:PA},FA=({size:a,value:s,style:i,onChange:r,className:l,customValue:u,min:d,max:p,step:m,unit:f})=>{const[v,w]=H.useState(0);d=d!==void 0?d:0,p=p!==void 0?p:0,m=m!==void 0?m:(p-d)/100;const _=[{value:d,label:d+(f||"")},{value:p,label:p+(f||"")}];return g.jsx(y.Slider,{defaultValue:u?s:v,"aria-labelledby":"discrete-slider",valueLabelDisplay:"auto",classes:{mark:E_.mark},marks:_,step:m,min:d,max:p,value:u?s:v,style:i,className:b.Utils.clsx(E_.root,l),onChange:(k,S)=>{Array.isArray(S)?(!u&&w(S[0]),r(S[0])):(!u&&w(S),r(S))},size:a||"medium"})},jA="_root_rzul6_1",zA={root:jA},UA=({label:a,size:s,value:i,style:r,onChange:l,className:u,customValue:d})=>{const[p,m]=H.useState(!1);return g.jsx(y.FormControlLabel,{className:zA.root,control:g.jsx(y.Switch,{checked:d?i:p,style:r,className:u,onChange:f=>{d||m(f.target.checked),l(f.target.checked)},size:s||"medium"}),label:a??"all"})},HA=H.memo(UA),WA="_root_135pm_1",VA={root:WA},GA=({value:a,style:s,onChange:i,className:r})=>g.jsx(y.TextField,{variant:"standard",id:"time",type:"time",onChange:l=>i(l.currentTarget.value),value:a,className:b.Utils.clsx(VA.root,r),fullWidth:!0,style:s,slotProps:{htmlInput:{step:300},inputLabel:{shrink:!0}}}),KA="_root_135pm_1",Pl={root:KA},Kp=[31,29,31,30,31,30,31,31,30,31,30,31],YA=({value:a,onChange:s,className:i,style:r})=>{const[l,u]=(a||"01.01").toString().split(".");let d=parseInt(u,10)||0,p=parseInt(l,10)||0;p>12?p=12:p<0&&(p=0),d>Kp[p]?d=Kp[p]:d<0&&(d=0);const m=[];for(let f=0;f<Kp[p];f++)m.push(f+1);return g.jsxs("div",{children:[g.jsx(y.FormControl,{variant:"standard",className:b.Utils.clsx(Pl.root,i),style:r,children:g.jsxs(y.Select,{variant:"standard",className:b.Utils.clsx(Pl.root,i),margin:"dense",label:b.I18n.t("Month"),onChange:f=>s(`${f.target.value.toString().padStart(2,"0")}.${d.toString().padStart(2,"0")}`),value:p,children:[g.jsx(y.MenuItem,{style:{placeContent:"space-between"},value:0,children:b.I18n.t("Any month")},0),g.jsx(y.MenuItem,{style:{placeContent:"space-between"},value:1,children:b.I18n.t("January")},1),g.jsx(y.MenuItem,{style:{placeContent:"space-between"},value:2,children:b.I18n.t("February")},2),g.jsx(y.MenuItem,{style:{placeContent:"space-between"},value:3,children:b.I18n.t("March")},3),g.jsx(y.MenuItem,{style:{placeContent:"space-between"},value:4,children:b.I18n.t("April")},4),g.jsx(y.MenuItem,{style:{placeContent:"space-between"},value:5,children:b.I18n.t("May")},5),g.jsx(y.MenuItem,{style:{placeContent:"space-between"},value:6,children:b.I18n.t("June")},6),g.jsx(y.MenuItem,{style:{placeContent:"space-between"},value:7,children:b.I18n.t("July")},7),g.jsx(y.MenuItem,{style:{placeContent:"space-between"},value:8,children:b.I18n.t("August")},8),g.jsx(y.MenuItem,{style:{placeContent:"space-between"},value:9,children:b.I18n.t("September")},9),g.jsx(y.MenuItem,{style:{placeContent:"space-between"},value:10,children:b.I18n.t("October")},10),g.jsx(y.MenuItem,{style:{placeContent:"space-between"},value:11,children:b.I18n.t("November")},11),g.jsx(y.MenuItem,{style:{placeContent:"space-between"},value:12,children:b.I18n.t("December")},12)]})}),g.jsx(y.FormControl,{variant:"standard",className:b.Utils.clsx(Pl.root,i),style:r,children:g.jsxs(y.Select,{variant:"standard",className:b.Utils.clsx(Pl.root,i),margin:"dense",label:b.I18n.t("Date"),onChange:f=>s(`${p.toString().padStart(2,"0")}.${f.target.value.toString().padStart(2,"0")}`),value:d,children:[g.jsx(y.MenuItem,{style:{placeContent:"space-between"},value:0,children:b.I18n.t("Any")},"A"),m.map(f=>g.jsx(y.MenuItem,{style:{placeContent:"space-between"},value:f,children:f},f))]})})]})},Yp={},JA={Shuffle:Vk,Apps:Ok,Functions:Fk,Language:dk,AddBox:Rk,Pause:Hl,Subject:Kk,PlayForWork:Hk,Brightness3:Mk,HelpOutline:q_,Storage:Gk,AccessTime:Ak,PlayArrow:sg,FlashOn:Bk};function I_({iconName:a,className:s,adapter:i,socket:r,onClick:l,style:u}){const[d,p]=H.useState("");if(H.useEffect(()=>{i&&r&&(Yp[i]instanceof Promise||(Yp[i]=r.getObject(`system.adapter.${i}`)),Yp[i].then(f=>{var v;return((v=f==null?void 0:f.common)==null?void 0:v.icon)&&p(`../../adapter/${i}/${f.common.icon}`)}))},[i,r]),i)return g.jsx("img",{onClick:f=>l&&l(f),src:d||"",className:s,style:u,alt:""});const m=a&&JA[a]||hk;return g.jsx(m,{className:s,style:u,onClick:f=>l&&l(f)})}let Jp;function XA(a){return Jp=Jp||b.I18n.getLanguage(),a&&typeof a=="object"?a[Jp]||a.en:a||""}function hn(a){return a===null?"null":a===void 0?"undefined":Array.isArray(a)?a.join(", "):typeof a=="object"?JSON.stringify(a):a.toString()}class Xe extends H.Component{debugHideTimeout=null;lastObjectIdChange=0;enableSimulationProcessing=!1;lastDebugMessage=0;debugMessageTimeout=null;static getStaticData(){return{acceptedBy:"actions",name:"Not found",id:"ActionEmpty",icon:"Shuffle"}}static compile(s,i){return""}constructor(s,i){super(s),i||={};const r=s.settings||{tagCard:i.tagCardArray?typeof i.tagCardArray[0]!="string"?i.tagCardArray[0].title:i.tagCardArray[0]:""};!r.tagCard&&i.tagCardArray&&(r.tagCard=typeof i.tagCardArray[0]!="string"?i.tagCardArray[0].title:i.tagCardArray[0]),this.state={inputs:i.inputs||s.inputs||[],name:i.name||s.name||"",icon:i.icon||s.icon||"",adapter:i.adapter||s.adapter||"",helpDialog:i.helpDialog||s.helpDialog||"",tagCardArray:i.tagCardArray||[],openTagMenu:!1,openModal:!1,iconTag:!1,error:"",helpText:"",instanceSelectionOptions:[],instanceSelectionDef:"",hideAttributes:[],settings:r,debugMessage:null,enableSimulation:this.props.enableSimulation}}componentWillUnmount(){this.debugMessageTimeout&&(clearTimeout(this.debugMessageTimeout),this.debugMessageTimeout=null),this.debugHideTimeout&&(clearTimeout(this.debugHideTimeout),this.debugHideTimeout=null)}onTagChange(s,i,r,l,u){let d=!1;const p=JSON.parse(JSON.stringify(this.state.settings));this.state.inputs.forEach(m=>{const f=m.attr,v=m.defaultValue;f&&v!==void 0&&p[f]===void 0&&(d=!0,p[f]=v)}),d?(this.setState({settings:p},()=>i==null?void 0:i()),this.props.onChange(p)):i&&i()}onUpdate(){}onValueChanged(s,i){}renderText(s,i,r){const{className:l}=this.props,{attr:u,frontText:d,backText:p,nameBlock:m,name:f,doNotTranslate:v,doNotTranslateBack:w}=s;return g.jsxs(H.Fragment,{children:[g.jsxs("div",{className:b.Utils.clsx(ue.displayFlex,ue.blockMarginTop),children:[d&&g.jsx("div",{className:ue.frontText,children:v?d:b.I18n.t(d)}),g.jsx(ri,{className:l,autoComplete:"off",label:XA(f),variant:"outlined",size:"small",fullWidth:!0,value:i,onChange:r,customValue:!0}),p&&g.jsx("div",{className:ue.backText,children:w?p:b.I18n.t(p)})]}),m&&g.jsx("div",{className:ue.nameBlock,children:b.I18n.t(m)})]},u)}renderSwitch(s,i,r){const{className:l}=this.props,{attr:u,frontText:d,backText:p,nameBlock:m,doNotTranslate:f,doNotTranslateBack:v}=s;return g.jsxs("div",{children:[g.jsxs("div",{className:b.Utils.clsx(ue.displayFlex,ue.blockMarginTop),children:[d&&g.jsx("div",{className:ue.frontText,children:f?d:b.I18n.t(d)}),g.jsx(HA,{className:l,label:"",customValue:!0,value:i,onChange:r}),p&&g.jsx("div",{className:ue.backText,children:v?p:b.I18n.t(p)})]}),m&&g.jsx("div",{className:ue.nameBlock,children:b.I18n.t(m)})]},u)}renderNameText({attr:s,signature:i,doNotTranslate:r,defaultValue:l},u){return g.jsx("div",{className:b.Utils.clsx(i?ue.displayItalic:ue.displayFlex,ue.blockMarginTop),children:u?r?u:b.I18n.t(u):r?l:b.I18n.t(l)},s)}renderNumber(s,i,r){const{className:l}=this.props,{settings:u}=this.state,{attr:d,backText:p,frontText:m,openCheckbox:f,doNotTranslate:v,doNotTranslateBack:w}=s;let _=!0;return f&&(_=typeof u.offset=="boolean"?u.offset:!0),_?g.jsxs("div",{className:b.Utils.clsx(ue.displayFlex,ue.blockMarginTop),children:[m&&g.jsx("div",{className:ue.frontText,children:v?m:b.I18n.t(m)}),g.jsx(ri,{className:b.Utils.clsx(l,s.className),fullWidth:!0,autoComplete:"off",label:s.noHelperText?"":"number",variant:"outlined",size:"small",type:"number",value:i,onChange:r,customValue:!0}),p&&g.jsx("div",{className:ue.backText,children:w?p:b.I18n.t(p)})]},d):null}renderColor(s,i,r){const{className:l}=this.props,{attr:u,backText:d,frontText:p,doNotTranslate:m,doNotTranslateBack:f}=s;return g.jsxs("div",{className:b.Utils.clsx(ue.displayFlex,ue.blockMarginTop),children:[p&&g.jsx("div",{className:ue.frontText,children:m?p:b.I18n.t(p)}),g.jsx(ri,{className:l,autoComplete:"off",fullWidth:!0,variant:"outlined",size:"small",type:"color",value:i,onChange:r}),d&&g.jsx("div",{className:ue.backText,children:f?d:b.I18n.t(d)})]},u)}renderCheckbox(s,i,r){const{className:l}=this.props,{settings:u}=this.state,{attr:d,backText:p,frontText:m,defaultValue:f,doNotTranslate:v,doNotTranslateBack:w}=s;return g.jsxs("div",{className:ue.displayFlex,children:[m&&g.jsx("div",{className:ue.frontText,children:v?m:b.I18n.t(m)}),g.jsx(DC,{className:l,size:"small",value:typeof u[d]=="boolean"?!!u[d]:!!f,customValue:!0,onChange:r}),p&&g.jsx("div",{onClick:()=>r(typeof u[d]=="boolean"?!u[d]:!f),className:ue.backText,children:w?p:b.I18n.t(p)})]},d)}renderSlider(s,i,r){const{className:l}=this.props,{attr:u,frontText:d,backText:p,nameBlock:m,min:f,max:v,step:w,unit:_,doNotTranslate:k,doNotTranslateBack:S}=s;return g.jsxs("div",{children:[g.jsxs("div",{className:ue.displayFlex,style:{marginRight:20},children:[d&&g.jsx("div",{className:ue.frontText,children:k?d:b.I18n.t(d)}),g.jsx(FA,{customValue:!0,min:f,max:v,step:w,unit:_,className:l,autoComplete:"off",label:"number",variant:"outlined",size:"small",value:i,onChange:C=>{console.log(C),r(C)}}),p&&g.jsx("div",{style:{marginLeft:20},className:ue.backText,children:S?p:b.I18n.t(p)})]}),m&&g.jsx("div",{className:ue.nameBlock,children:b.I18n.t(m)})]},u)}renderButton(s,i,r){const{className:l}=this.props,{attr:u,frontText:d,backText:p,doNotTranslate:m,doNotTranslateBack:f}=s;return g.jsxs("div",{className:b.Utils.clsx(ue.displayFlex,ue.blockMarginTop),children:[d&&g.jsx("div",{className:ue.frontText,children:m?d:b.I18n.t(d)}),g.jsx(Tr,{fullWidth:!0,value:i.toString(),className:l,onClick:()=>r(i)}),p&&g.jsx("div",{className:ue.backText,children:f?p:b.I18n.t(p)})]},u)}async findIcon(s){var i;if(!s)return null;if((i=s.common)!=null&&i.icon)return b.getSelectIdIcon(s,"../..");if(s.type==="state"||s.type==="channel"){const r=s._id.split(".");r.pop();const l=r.join(".");try{const u=await this.props.socket.getObject(l);return await this.findIcon(u)}catch{return null}}return null}renderObjectID(s,i,r){const{attr:l,openCheckbox:u,checkReadOnly:d}=s,{settings:p}=this.state,m=this.state[`showSelectId${l}`],{className:f,socket:v,style:w}=this.props;let _=!0;u&&(_=typeof p.offset=="boolean"?p.offset:!0);const k=p[l],S=k?this.state[k]:void 0;return k&&!S&&S!==!1&&setTimeout(async C=>{var R;const I=await v.getObject(i),O=await this.findIcon(I),A={[C]:I||!1,[`${C}___icon`]:O,error:d&&this.lastObjectIdChange&&Date.now()-this.lastObjectIdChange<1e3&&((R=I==null?void 0:I.common)==null?void 0:R.write)===!1?b.I18n.t("Read only ID selected: %s",p[C]):""};this.setState(A)},0,k),_?g.jsxs("div",{className:ue.blockMarginTop,children:[g.jsxs("div",{className:ue.displayFlex,children:[s.title?g.jsx("div",{children:b.I18n.t(s.title)}):null,g.jsx(ri,{className:f,style:w,autoComplete:"off",fullWidth:!0,disabled:!0,variant:"outlined",size:"small",value:i,customValue:!0}),g.jsx(Tr,{icon:this.state[`${k}___icon`],square:!0,style:{...w||void 0,marginLeft:7},value:"...",className:f,onClick:()=>{const C={};C[`showSelectId${l}`]=!0,this.setState(C)}})]}),S?g.jsx("div",{className:b.Utils.clsx(ue.nameBlock,ue.displayItalic),children:b.Utils.getObjectNameFromObj(S,b.I18n.getLanguage())}):null,m?g.jsx(b.DialogSelectID,{theme:this.props.theme,imagePrefix:"../..",dialogName:"javascript",themeType:b.Utils.getThemeName(),socket:v,selected:i,onClose:()=>{const C={};C[`showSelectId${l}`]=!1,this.setState(C)},onOk:(C,I)=>{const O={};O[`showSelectId${l}`]=!1;const A=Array.isArray(C)?C[0]:C;this.setState(O,async()=>{var q,re,ie,$e,U,Me,Ne,qe,ce,de;const R=A?await v.getObject(A):void 0;this.lastObjectIdChange=Date.now(),r({[l]:C,[`${l}Role`]:(q=R==null?void 0:R.common)==null?void 0:q.role,[`${l}Type`]:(re=R==null?void 0:R.common)==null?void 0:re.type,[`${l}Unit`]:(ie=R==null?void 0:R.common)==null?void 0:ie.unit,[`${l}States`]:($e=R==null?void 0:R.common)==null?void 0:$e.states,[`${l}Min`]:(U=R==null?void 0:R.common)==null?void 0:U.min,[`${l}Max`]:(Me=R==null?void 0:R.common)==null?void 0:Me.max,[`${l}Step`]:(Ne=R==null?void 0:R.common)==null?void 0:Ne.step,[`${l}Def`]:(qe=R==null?void 0:R.common)==null?void 0:qe.def,[`${l}Write`]:(ce=R==null?void 0:R.common)==null?void 0:ce.write,[`${l}Read`]:(de=R==null?void 0:R.common)==null?void 0:de.read},()=>this.props.setOnUpdate&&this.props.setOnUpdate(!0))})}}):null]},l):null}renderIconTag(){return g.jsx("div",{className:ue.iconTag,onClick:s=>{this.state.settings.tagCard&&(this.state.tagCardArray.length<3?this.onChangeTag():this.setState({openTagMenu:s.currentTarget}))},children:this.state.settings.tagCard})}renderTime(s,i,r){const{attr:l,backText:u,frontText:d,doNotTranslate:p,doNotTranslateBack:m}=s;return g.jsxs("div",{className:ue.displayFlex,style:{whiteSpace:"nowrap"},children:[d&&g.jsx("div",{className:ue.frontText,children:p?d:b.I18n.t(d)}),g.jsx(GA,{value:i,onChange:r}),u&&g.jsx("div",{className:ue.backText,children:m?u:b.I18n.t(u)})]},l)}renderSelect(s,i,r){const{className:l,style:u}=this.props,{name:d,options:p,frontText:m,backText:f,attr:v,multiple:w,doNotTranslate:_,doNotTranslate2:k,doNotTranslateBack:S}=s;return g.jsxs("div",{className:b.Utils.clsx(ue.displayFlex,ue.blockMarginTop),style:{whiteSpace:"nowrap"},children:[m&&g.jsx("div",{className:ue.frontText,children:b.I18n.t(m)}),g.jsx(LA,{attr:v,doNotTranslate:_,doNotTranslate2:k,title:d,className:l,style:u,options:p,value:i,onChange:r,multiple:w,customValue:!0}),f&&g.jsx("div",{className:ue.backText,children:S?f:b.I18n.t(f)})]},v)}renderInstance(s,i,r){const{socket:l}=this.props,{name:u,frontText:d,backText:p,attr:m,adapter:f,doNotTranslate:v,doNotTranslateBack:w}=s;return this.state.hideAttributes.includes(m)?null:g.jsxs("div",{className:b.Utils.clsx(ue.displayFlex,ue.blockMarginTop),style:{whiteSpace:"nowrap"},children:[d&&g.jsx("div",{className:ue.frontText,children:v?d:b.I18n.t(d)}),g.jsx(AA,{attr:m,socket:l,adapter:f,title:u,value:i,onChange:_=>{r(Array.isArray(_)?_[0]:_)},customValue:!0,onInstanceHide:_=>this.setState({hideAttributes:[...this.state.hideAttributes,m]},()=>r(_))}),p&&g.jsx("div",{className:ue.backText,children:w?p:b.I18n.t(p)})]},m)}renderDialog(s){const{onShowDialog:i,frontText:r,backText:l,attr:u,icon:d,doNotTranslate:p,doNotTranslateBack:m}=s;return g.jsxs("div",{className:b.Utils.clsx(ue.displayFlex,ue.blockMarginTop),style:{whiteSpace:"nowrap"},children:[r&&g.jsx("div",{className:ue.frontText,children:p?r:b.I18n.t(r)}),g.jsx(I_,{iconName:d,className:b.Utils.clsx(ue.iconDialog),onClick:()=>i&&i()}),l&&g.jsx("div",{className:ue.backText,children:m?l:b.I18n.t(l)})]},u)}renderModalInput(s,i,r){const{openModal:l}=this.state,{className:u}=this.props,{attr:d,nameBlock:p,frontText:m,backText:f,noTextEdit:v,doNotTranslate:w,doNotTranslateBack:_}=s;return g.jsxs("div",{children:[g.jsxs("div",{className:b.Utils.clsx(ue.displayFlex,ue.blockMarginTop),children:[m&&g.jsx("div",{className:ue.frontText,children:w?m:b.I18n.t(m)}),g.jsx(ri,{disabled:!!v,className:u,autoComplete:"off",fullWidth:!0,variant:"outlined",size:"small",value:i,onChange:r,customValue:!0}),g.jsx(Tr,{square:!0,style:{marginLeft:5},value:"...",className:u,onClick:()=>this.setState({openModal:!0})}),f&&g.jsx("div",{className:ue.backText,children:_?f:b.I18n.t(f)})]}),l?g.jsx(Sg,{onApply:k=>this.setState({openModal:!1},()=>k!=null&&r(k)),onClose:()=>this.setState({openModal:!1}),defaultValue:i,textInput:!0}):null,p&&g.jsx("div",{className:ue.nameBlock,children:b.I18n.t(p)})]},d)}renderDate(s,i,r){const{attr:l,backText:u,frontText:d,doNotTranslate:p,doNotTranslateBack:m}=s;return g.jsxs("div",{className:ue.displayFlex,style:{whiteSpace:"nowrap"},children:[d&&g.jsx("div",{className:ue.frontText,children:p?d:b.I18n.t(d)}),g.jsx(YA,{value:i,onChange:r}),u&&g.jsx("div",{className:ue.backText,children:m?u:b.I18n.t(u)})]},l)}static getReplacesInText(s){var r;let i="";return(r=s.trigger)!=null&&r.oidType?i=".replace(/%s/g, obj.state.val).replace(/%id/g, obj.id).replace(/%name/g, obj.common && obj.common.name).replace(/%old/g, obj.oldState.val)":s.conditionsStates.length&&(i=`.replace(/%s/g, ${s.conditionsStates[0].name}).replace(/%id/g, "${s.conditionsStates[0].id}")`),i}renderTags(){const{tagCardArray:s,openTagMenu:i}=this.state,{tagCard:r}=this.state.settings;let l=r!=="="&&r!=="<>"&&r!==">="&&r!=="()"&&r!=="."&&r!=="<="&&r!=="<"&&r!==">"&&r?b.I18n.t(r):r;return s.length>=3&&(l=g.jsxs("div",{children:[g.jsx("div",{"aria-controls":"simple-menu","aria-haspopup":"true",onClick:u=>{this.setState({openTagMenu:u.currentTarget},()=>{this.props.isTourOpen&&this.props.tourStep===ws.openTagsMenu&&setTimeout(()=>this.props.setTourStep&&this.props.setTourStep(ws.selectIntervalTag),300)})},children:l}),g.jsx(y.Menu,{id:"simple-menu",anchorEl:i,keepMounted:!0,open:!!i,onClose:()=>this.setState({openTagMenu:null}),children:s.map((u,d)=>{let p;return typeof u!="string"?p=u.title:p=u,g.jsxs(y.MenuItem,{selected:p===r,className:`tag-card-${p}`,style:{placeContent:"space-between"},onClick:m=>{m.stopPropagation(),this.props.isTourOpen&&(this.props.tourStep===ws.openTagsMenu||this.props.tourStep===ws.selectIntervalTag)&&p==="interval"&&setTimeout(()=>{var v,w;return(w=(v=this.props).setTourStep)==null?void 0:w.call(v,ws.selectActions)},500);const f=JSON.parse(JSON.stringify(this.state.settings));f.tagCard=p,this.setState({openTagMenu:null,settings:f},()=>{this.props.onChange(this.state.settings),this.onTagChange(this.state.settings.tagCard)})},children:[p.search(/>|<|<>|<=|>=|=/)!==-1?p:b.I18n.t(p),typeof u!="string"&&u.title2&&g.jsx("div",{style:{marginLeft:4},children:b.I18n.t(u.title2)})]},`${p}_${d}`)})})]})),l}getData(){return{acceptedBy:"triggers",name:"",id:""}}onChangeTag(){const{tagCardArray:s,settings:i,settings:{tagCard:r}}=this.state;let l;if(typeof s[0]!="string"?l=s.map(u=>u.title):l=[...s],r&&l.length<3){const u={...i},d=l[(l.indexOf(r)+1)%l.length];u.tagCard=d,this.setState({settings:u},()=>{this.props.onChange(u),this.onTagChange(d)})}}componentDidMount(){this.onTagChange()}componentDidUpdate(){this.props.acceptedBy!=="triggers"&&this.props.onUpdate&&setTimeout(()=>this.onUpdate(),0)}onChangeInput(s){return(i,r,l)=>{const u=JSON.parse(JSON.stringify(this.state.settings));typeof i=="object"&&(!r||typeof r=="function")?(Object.keys(i).forEach(d=>u[d]=i[d]),typeof r=="function"&&(l=r,r=void 0)):u[r||s]=i,u.id=this.getData().id,u._id=this.props._id,this.setState({settings:u},()=>{this.onValueChanged(i,r||s),this.props.onChange(u),l==null||l()})}}renderSpecific(){return null}renderDebug(s){return""}renderDebugInfo(){return this.state.debugMessage?g.jsx("div",{className:ue.debugInfo,style:{opacity:1,height:22,bottom:-22},children:this.renderDebug?this.renderDebug(this.state.debugMessage):b.I18n.t("executed")},this.state.debugMessage.ts):null}renderCron(s,i,r){return null}renderWizard(s,i,r){return null}renderWriteState(){return null}renderInputElement(s,i){const{nameRender:r,defaultValue:l,attr:u}=s,{settings:d}=this.state;let p=u?d[u]:void 0;switch(p===void 0&&(p=l),r){case"renderTime":return u?this.renderTime(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderTime")},`invalid_${i}`);case"renderNameText":return this.renderNameText(s,l);case"renderSelect":return u?this.renderSelect(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderSelect")},`invalid_${i}`);case"renderModalInput":return u?this.renderModalInput(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderModalInput")},`invalid_${i}`);case"renderObjectID":return u?this.renderObjectID(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderObjectID")},`invalid_${i}`);case"renderDialog":return u?this.renderDialog(s):g.jsx("div",{children:b.I18n.t("Invalid renderDialog")},`invalid_${i}`);case"renderInstance":return u?this.renderInstance(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderInstance")},`invalid_${i}`);case"renderText":return u?this.renderText(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderText")},`invalid_${i}`);case"renderSlider":return u?this.renderSlider(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderSlider")},`invalid_${i}`);case"renderCheckbox":return u?this.renderCheckbox(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderCheckbox")},`invalid_${i}`);case"renderButton":return u?this.renderButton(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderButton")},`invalid_${i}`);case"renderColor":return u?this.renderColor(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderColor")},`invalid_${i}`);case"renderSwitch":return u?this.renderSwitch(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderSwitch")},`invalid_${i}`);case"renderDate":return u?this.renderDate(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderDate")},`invalid_${i}`);case"renderCron":return u?this.renderCron(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderCron")},`invalid_${i}`);case"renderWizard":return u?this.renderWizard(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderWizard")},`invalid_${i}`);case"renderWriteState":return this.renderWriteState();case"renderNumber":return u?this.renderNumber(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderNumber")},`invalid_${i}`);default:return this[r]?this[r](s,p,u?this.onChangeInput(u):null):g.jsx("div",{children:b.I18n.t("Invalid input type: %s",r)},`invalid_${i}`)}}render(){var _;const{inputs:s,name:i,icon:r,iconTag:l,settings:u,adapter:d,settings:{tagCard:p},helpDialog:m}=this.state,{socket:f,notFound:v}=this.props;this.state.settings&&!this.state.settings.tagCard&&((_=this.state.tagCardArray)!=null&&_.length)&&setTimeout(()=>{const k=JSON.parse(JSON.stringify(this.state.settings));k.tagCard=typeof this.state.tagCardArray[0]!="string"?this.state.tagCardArray[0].title:this.state.tagCardArray[0],this.setState({settings:k})},50),this.state.enableSimulation!==this.props.enableSimulation&&!this.enableSimulationProcessing&&(this.enableSimulationProcessing=!0,setTimeout(()=>{this.setState({enableSimulation:this.props.enableSimulation},()=>{this.enableSimulationProcessing=!1})},50));let w;if(this.props.onDebugMessage)for(let k=this.props.onDebugMessage.length-1;k>=0;k--){const S=this.props.onDebugMessage[k];if(S.blockId===this.props._id&&S.ts>this.lastDebugMessage&&S.ts>Date.now()-1e3){w=S;break}}return w&&(this.lastDebugMessage=w.ts,this.debugMessageTimeout&&clearTimeout(this.debugMessageTimeout),this.debugHideTimeout&&(clearTimeout(this.debugHideTimeout),this.debugHideTimeout=null),this.debugMessageTimeout=setTimeout(k=>{const S=JSON.parse(k),C=S.hideTimeout||5e3;this.debugMessageTimeout=null,this.setState({debugMessage:S},()=>{this.debugHideTimeout&&clearTimeout(this.debugHideTimeout),this.debugHideTimeout=setTimeout(()=>{this.debugHideTimeout=null,this.setState({debugMessage:null})},C)})},50,JSON.stringify(w))),g.jsxs(H.Fragment,{children:[l?this.renderIconTag():g.jsx(I_,{iconName:r,className:b.Utils.clsx(ue.iconThemCard,p&&this.state.tagCardArray.length&&ue.iconThemCardSelectable),adapter:d,socket:f,onClick:k=>{p&&(this.state.tagCardArray.length<3?this.onChangeTag():this.setState({openTagMenu:k.currentTarget}))}}),g.jsxs("div",{className:ue.blockName,children:[g.jsxs("span",{className:ue.nameCard,children:[b.I18n.t(i),v?b.I18n.t("%s not found",u.id):"",m?g.jsx(y.IconButton,{className:ue.iconHelp,size:"small",onClick:()=>this.setState({helpText:b.I18n.t(m)}),children:g.jsx(q_,{})}):null]}),s.map((k,S)=>this.renderInputElement(k,S))]}),p&&g.jsx("div",{className:ue.controlMenuTop,style:{opacity:1,height:22,top:-22},children:g.jsx("div",{onClick:()=>this.onChangeTag(),className:b.Utils.clsx(ue.tagCard,"tag-card"),children:this.renderTags()})}),this.renderDebugInfo(),this.state.error?g.jsx(b.DialogError,{title:b.I18n.t("Warning"),text:this.state.error,onClose:()=>this.setState({error:""})}):null,this.state.helpText?g.jsx(b.DialogMessage,{title:b.I18n.t("Instructions"),text:this.state.helpText,onClose:()=>this.setState({helpText:""})}):null,this.renderSpecific()]})}}const x_={en:{name:"Google - English",engine:"google",params:[]},de:{name:"Google - Deutsch",engine:"google",params:[]},ru:{name:"Google - Русский",engine:"google",params:[]},it:{name:"Google - Italiano",engine:"google",params:[]},es:{name:"Google - Espaniol",engine:"google",params:[]},fr:{name:"Google - Français",engine:"google",params:[]},ru_YA:{name:"Yandex - Русский",engine:"yandex",params:["key","voice","emotion","ill","drunk","robot"],voice:["jane","zahar"],emotion:["none","good","neutral","evil","mixed"]},ru_YA_CLOUD:{name:"Yandex Cloud - Русский",engine:"yandexCloud",params:["key","folderID","voice","emotion"],voice:["alyss","oksana","jane","zahar"],emotion:["good","neutral","evil"]},"en-US":{name:"PicoTTS - Englisch US",engine:"PicoTTS",params:[]},"en-GB":{name:"PicoTTS - Englisch GB",engine:"PicoTTS",params:[]},"de-DE":{name:"PicoTTS - Deutsch",engine:"PicoTTS",params:[]},"it-IT":{name:"PicoTTS - Italiano",engine:"PicoTTS",params:[]},"es-ES":{name:"PicoTTS - Espaniol",engine:"PicoTTS",params:[]},"fr-FR":{name:"PicoTTS - Français",engine:"PicoTTS",params:[]},"ru-RU_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"ru-RU",ename:"Tatyana",ssml:!0,name:"Cloud - Русский - Татьяна"},"ru-RU_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"ru-RU",ename:"Maxim",ssml:!0,name:"Cloud - Русский - Максим"},"de-DE_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"de-DE",ename:"Marlene",ssml:!0,name:"Cloud - Deutsch - Marlene"},"de-DE_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"de-DE",ename:"Hans",ssml:!0,name:"Cloud - Deutsch - Hans"},"en-US_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-US",ename:"Salli",ssml:!0,name:"Cloud - en-US - Female - Salli"},"en-US_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"en-US",ename:"Joey",ssml:!0,name:"Cloud - en-US - Male - Joey"},"da-DK_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"da-DK",ename:"Naja",ssml:!0,name:"Cloud - da-DK - Female - Naja"},"da-DK_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"da-DK",ename:"Mads",ssml:!0,name:"Cloud - da-DK - Male - Mads"},"en-AU_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-AU",ename:"Nicole",ssml:!0,name:"Cloud - en-AU - Female - Nicole"},"en-AU_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"en-AU",ename:"Russell",ssml:!0,name:"Cloud - en-AU - Male - Russell"},"en-GB_CLOUD_Female_Amy":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-GB",ename:"Amy",ssml:!0,name:"Cloud - en-GB - Female - Amy"},"en-GB_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"en-GB",ename:"Brian",ssml:!0,name:"Cloud - en-GB - Male - Brian"},"en-GB_CLOUD_Female_Emma":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-GB",ename:"Emma",ssml:!0,name:"Cloud - en-GB - Female - Emma"},"en-GB-WLS_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-GB-WLS",ename:"Gwyneth",ssml:!0,name:"Cloud - en-GB-WLS - Female - Gwyneth"},"en-GB-WLS_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"en-GB-WLS",ename:"Geraint",ssml:!0,name:"Cloud - en-GB-WLS - Male - Geraint"},"cy-GB_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"cy-GB",ename:"Gwyneth",ssml:!0,name:"Cloud - cy-GB - Female - Gwyneth"},"cy-GB_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"cy-GB",ename:"Geraint",ssml:!0,name:"Cloud - cy-GB - Male - Geraint"},"en-IN_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-IN",ename:"Raveena",ssml:!0,name:"Cloud - en-IN - Female - Raveena"},"en-US_CLOUD_Male_Chipmunk":{gender:"Male",engine:"cloud",params:["cloud"],language:"en-US",ename:"Chipmunk",ssml:!0,name:"Cloud - en-US - Male - Chipmunk"},"en-US_CLOUD_Male_Eric":{gender:"Male",engine:"cloud",params:["cloud"],language:"en-US",ename:"Eric",ssml:!0,name:"Cloud - en-US - Male - Eric"},"en-US_CLOUD_Female_Ivy":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-US",ename:"Ivy",ssml:!0,name:"Cloud - en-US - Female - Ivy"},"en-US_CLOUD_Female_Jennifer":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-US",ename:"Jennifer",ssml:!0,name:"Cloud - en-US - Female - Jennifer"},"en-US_CLOUD_Male_Justin":{gender:"Male",engine:"cloud",params:["cloud"],language:"en-US",ename:"Justin",ssml:!0,name:"Cloud - en-US - Male - Justin"},"en-US_CLOUD_Female_Kendra":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-US",ename:"Kendra",ssml:!0,name:"Cloud - en-US - Female - Kendra"},"en-US_CLOUD_Female_Kimberly":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-US",ename:"Kimberly",ssml:!0,name:"Cloud - en-US - Female - Kimberly"},"es-ES_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"es-ES",ename:"Conchita",ssml:!0,name:"Cloud - es-ES - Female - Conchita"},"es-ES_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"es-ES",ename:"Enrique",ssml:!0,name:"Cloud - es-ES - Male - Enrique"},"es-US_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"es-US",ename:"Penelope",ssml:!0,name:"Cloud - es-US - Female - Penelope"},"es-US_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"es-US",ename:"Miguel",ssml:!0,name:"Cloud - es-US - Male - Miguel"},"fr-CA_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"fr-CA",ename:"Chantal",ssml:!0,name:"Cloud - fr-CA - Female - Chantal"},"fr-FR_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"fr-FR",ename:"Celine",ssml:!0,name:"Cloud - fr-FR - Female - Celine"},"fr-FR_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"fr-FR",ename:"Mathieu",ssml:!0,name:"Cloud - fr-FR - Male - Mathieu"},"is-IS_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"is-IS",ename:"Dora",ssml:!0,name:"Cloud - is-IS - Female - Dora"},"is-IS_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"is-IS",ename:"Karl",ssml:!0,name:"Cloud - is-IS - Male - Karl"},"it-IT_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"it-IT",ename:"Carla",ssml:!0,name:"Cloud - it-IT - Female - Carla"},"it-IT_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"it-IT",ename:"Giorgio",ssml:!0,name:"Cloud - it-IT - Male - Giorgio"},"nb-NO_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"nb-NO",ename:"Liv",ssml:!0,name:"Cloud - nb-NO - Female - Liv"},"nl-NL_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"nl-NL",ename:"Lotte",ssml:!0,name:"Cloud - nl-NL - Female - Lotte"},"nl-NL_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"nl-NL",ename:"Ruben",ssml:!0,name:"Cloud - nl-NL - Male - Ruben"},"pl-PL_CLOUD_Female_Agnieszka":{gender:"Female",engine:"cloud",params:["cloud"],language:"pl-PL",ename:"Agnieszka",ssml:!0,name:"Cloud - pl-PL - Female - Agnieszka"},"pl-PL_CLOUD_Male_Jacek":{gender:"Male",engine:"cloud",params:["cloud"],language:"pl-PL",ename:"Jacek",ssml:!0,name:"Cloud - pl-PL - Male - Jacek"},"pl-PL_CLOUD_Female_Ewa":{gender:"Female",engine:"cloud",params:["cloud"],language:"pl-PL",ename:"Ewa",ssml:!0,name:"Cloud - pl-PL - Female - Ewa"},"pl-PL_CLOUD_Male_Jan":{gender:"Male",engine:"cloud",params:["cloud"],language:"pl-PL",ename:"Jan",ssml:!0,name:"Cloud - pl-PL - Male - Jan"},"pl-PL_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"pl-PL",ename:"Maja",ssml:!0,name:"Cloud - pl-PL - Female - Maja"},"pt-BR_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"pt-BR",ename:"Vitoria",ssml:!0,name:"Cloud - pt-BR - Female - Vitoria"},"pt-BR_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"pt-BR",ename:"Ricardo",ssml:!0,name:"Cloud - pt-BR - Male - Ricardo"},"pt-PT_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"pt-PT",ename:"Cristiano",ssml:!0,name:"Cloud - pt-PT - Male - Cristiano"},"pt-PT_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"pt-PT",ename:"Ines",ssml:!0,name:"Cloud - pt-PT - Female - Ines"},"ro-RO_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"ro-RO",ename:"Carmen",ssml:!0,name:"Cloud - ro-RO - Female - Carmen"},"sv-SE_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"sv-SE",ename:"Astrid",ssml:!0,name:"Cloud - sv-SE - Female - Astrid"},"tr-TR_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"tr-TR",ename:"Filiz",ssml:!0,name:"Cloud - tr-TR - Female - Filiz"},"ru-RU_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"ru-RU",ename:"Tatyana",ssml:!0,name:"AWS Polly - Русский - Татьяна"},"ru-RU_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"ru-RU",ename:"Maxim",ssml:!0,name:"AWS Polly - Русский - Максим"},"de-DE_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"de-DE",ename:"Marlene",ssml:!0,name:"AWS Polly - Deutsch - Marlene"},"de-DE_AP_Female_Vicky":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"de-DE",ename:"Vicky",ssml:!0,name:"AWS Polly - Deutsch - Vicky"},"de-DE_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"de-DE",ename:"Hans",ssml:!0,name:"AWS Polly - Deutsch - Hans"},"en-US_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-US",ename:"Salli",ssml:!0,name:"AWS Polly - en-US - Female - Salli"},"en-US_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"en-US",ename:"Joey",ssml:!0,name:"AWS Polly - en-US - Male - Joey"},"da-DK_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"da-DK",ename:"Naja",ssml:!0,name:"AWS Polly - da-DK - Female - Naja"},"da-DK_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"da-DK",ename:"Mads",ssml:!0,name:"AWS Polly - da-DK - Male - Mads"},"en-AU_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-AU",ename:"Nicole",ssml:!0,name:"AWS Polly - en-AU - Female - Nicole"},"en-AU_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"en-AU",ename:"Russell",ssml:!0,name:"AWS Polly - en-AU - Male - Russell"},"en-GB_AP_Female_Amy":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-GB",ename:"Amy",ssml:!0,name:"AWS Polly - en-GB - Female - Amy"},"en-GB_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"en-GB",ename:"Brian",ssml:!0,name:"AWS Polly - en-GB - Male - Brian"},"en-GB_AP_Female_Emma":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-GB",ename:"Emma",ssml:!0,name:"AWS Polly - en-GB - Female - Emma"},"en-GB-WLS_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-GB-WLS",ename:"Gwyneth",ssml:!0,name:"AWS Polly - en-GB-WLS - Female - Gwyneth"},"en-GB-WLS_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"en-GB-WLS",ename:"Geraint",ssml:!0,name:"AWS Polly - en-GB-WLS - Male - Geraint"},"cy-GB_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"cy-GB",ename:"Gwyneth",ssml:!0,name:"AWS Polly - cy-GB - Female - Gwyneth"},"cy-GB_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"cy-GB",ename:"Geraint",ssml:!0,name:"AWS Polly - cy-GB - Male - Geraint"},"en-IN_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-IN",ename:"Raveena",ssml:!0,name:"AWS Polly - en-IN - Female - Raveena"},"en-US_AP_Male_Chipmunk":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"en-US",ename:"Chipmunk",ssml:!0,name:"AWS Polly - en-US - Male - Chipmunk"},"en-US_AP_Male_Eric":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"en-US",ename:"Eric",ssml:!0,name:"AWS Polly - en-US - Male - Eric"},"en-US_AP_Female_Ivy":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-US",ename:"Ivy",ssml:!0,name:"AWS Polly - en-US - Female - Ivy"},"en-US_AP_Female_Jennifer":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-US",ename:"Jennifer",ssml:!0,name:"AWS Polly - en-US - Female - Jennifer"},"en-US_AP_Male_Justin":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"en-US",ename:"Justin",ssml:!0,name:"AWS Polly - en-US - Male - Justin"},"en-US_AP_Female_Kendra":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-US",ename:"Kendra",ssml:!0,name:"AWS Polly - en-US - Female - Kendra"},"en-US_AP_Female_Kimberly":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-US",ename:"Kimberly",ssml:!0,name:"AWS Polly - en-US - Female - Kimberly"},"es-ES_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"es-ES",ename:"Conchita",ssml:!0,name:"AWS Polly - es-ES - Female - Conchita"},"es-ES_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"es-ES",ename:"Enrique",ssml:!0,name:"AWS Polly - es-ES - Male - Enrique"},"es-US_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"es-US",ename:"Penelope",ssml:!0,name:"AWS Polly - es-US - Female - Penelope"},"es-US_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"es-US",ename:"Miguel",ssml:!0,name:"AWS Polly - es-US - Male - Miguel"},"fr-CA_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"fr-CA",ename:"Chantal",ssml:!0,name:"AWS Polly - fr-CA - Female - Chantal"},"fr-FR_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"fr-FR",ename:"Celine",ssml:!0,name:"AWS Polly - fr-FR - Female - Celine"},"fr-FR_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"fr-FR",ename:"Mathieu",ssml:!0,name:"AWS Polly - fr-FR - Male - Mathieu"},"is-IS_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"is-IS",ename:"Dora",ssml:!0,name:"AWS Polly - is-IS - Female - Dora"},"is-IS_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"is-IS",ename:"Karl",ssml:!0,name:"AWS Polly - is-IS - Male - Karl"},"it-IT_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"it-IT",ename:"Carla",ssml:!0,name:"AWS Polly - it-IT - Female - Carla"},"it-IT_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"it-IT",ename:"Giorgio",ssml:!0,name:"AWS Polly - it-IT - Male - Giorgio"},"nb-NO_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"nb-NO",ename:"Liv",ssml:!0,name:"AWS Polly - nb-NO - Female - Liv"},"nl-NL_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"nl-NL",ename:"Lotte",ssml:!0,name:"AWS Polly - nl-NL - Female - Lotte"},"nl-NL_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"nl-NL",ename:"Ruben",ssml:!0,name:"AWS Polly - nl-NL - Male - Ruben"},"pl-PL_AP_Female_Agnieszka":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"pl-PL",ename:"Agnieszka",ssml:!0,name:"AWS Polly - pl-PL - Female - Agnieszka"},"pl-PL_AP_Male_Jacek":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"pl-PL",ename:"Jacek",ssml:!0,name:"AWS Polly - pl-PL - Male - Jacek"},"pl-PL_AP_Female_Ewa":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"pl-PL",ename:"Ewa",ssml:!0,name:"AWS Polly - pl-PL - Female - Ewa"},"pl-PL_AP_Male_Jan":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"pl-PL",ename:"Jan",ssml:!0,name:"AWS Polly - pl-PL - Male - Jan"},"pl-PL_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"pl-PL",ename:"Maja",ssml:!0,name:"AWS Polly - pl-PL - Female - Maja"},"pt-BR_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"pt-BR",ename:"Vitoria",ssml:!0,name:"AWS Polly - pt-BR - Female - Vitoria"},"pt-BR_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"pt-BR",ename:"Ricardo",ssml:!0,name:"AWS Polly - pt-BR - Male - Ricardo"},"pt-PT_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"pt-PT",ename:"Cristiano",ssml:!0,name:"AWS Polly - pt-PT - Male - Cristiano"},"pt-PT_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"pt-PT",ename:"Ines",ssml:!0,name:"AWS Polly - pt-PT - Female - Ines"},"ro-RO_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"ro-RO",ename:"Carmen",ssml:!0,name:"AWS Polly - ro-RO - Female - Carmen"},"sv-SE_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"sv-SE",ename:"Astrid",ssml:!0,name:"AWS Polly - sv-SE - Female - Astrid"},"tr-TR_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"tr-TR",ename:"Filiz",ssml:!0,name:"AWS Polly - tr-TR - Female - Filiz"}};class ic extends Xe{constructor(s){super(s,ic.getStaticData())}static compile(s,i){return s.text?`// Sayit ${s.text||""}
1157
+ const subActionVar${s._id} = "${s.language&&s.language!=="_"?`${s.language};`:""}${s.volume?`${s.volume};`:""}${(s.text||"").replace(/"/g,'\\"')}"${Xe.getReplacesInText(i)};
1158
+ _sendToFrontEnd(${s._id}, {text: subActionVar${s._id}});
1159
+ await setStateAsync("${s.instance}.tts.text", subActionVar${s._id});`:`// no text defined
1160
+ _sendToFrontEnd(${s._id}, {text: 'No text defined'});`}renderDebug(s){return`${b.I18n.t("Say:")} ${s.data.text}`}onTagChange(){const s=b.I18n.getLanguage(),r=Object.keys(x_).filter(l=>l.startsWith(s)).map(l=>({title:x_[l].name,value:l}));r.unshift({title:"Default",value:"_"}),this.setState({inputs:[{attr:"instance",nameRender:"renderInstance",adapter:"sayit",defaultValue:"sayit.0",frontText:"Instance:"},{nameRender:"renderSelect",frontText:"Language:",options:r,defaultValue:"_",attr:"language"},{nameRender:"renderNameText",defaultValue:"Volume",attr:"textVol"},{nameRender:"renderSlider",attr:"volume",defaultValue:100,min:0,max:100},{attr:"text",nameRender:"renderModalInput",defaultValue:"Hallo",nameBlock:"",frontText:"Text:"}]},()=>super.onTagChange())}static getStaticData(){return{acceptedBy:"actions",name:"Say It",id:"ActionSayText",adapter:"sayit",title:"Say some text via sayit adapter",helpDialog:"You can use %s in the text to display current trigger value or %id to display the triggered object ID"}}getData(){return ic.getStaticData()}}class nc extends Xe{constructor(s){super(s,nc.getStaticData())}static compile(s,i){const r=(s.text||"").replace(/"/g,'\\"');return r?`// Pushover ${s.text||""}
1161
+ const subActionVar${s._id} = "${r}"${Xe.getReplacesInText(i)};
1162
+ _sendToFrontEnd(${s._id}, {text: subActionVar${s._id}});
1163
+ sendTo("${s.instance}", "send", {
1164
+ message: subActionVar${s._id},
1165
+ title: "${(s.title||"").replace(/"/g,'\\"')}"${Xe.getReplacesInText(i)},
1166
+ sound: "${s.sound}",
1167
+ priority: ${s.priority}
1168
+ });`:`// no text defined
1169
+ _sendToFrontEnd(${s._id}, {text: 'No text defined'});`}renderDebug(s){return`Sent: ${s.data.text}`}onTagChange(){this.setState({inputs:[{nameRender:"renderInstance",adapter:"pushover",frontText:"Instance:",defaultValue:"pushover.0",attr:"instance"},{nameRender:"renderModalInput",attr:"text",defaultValue:"Hello",nameBlock:"",frontText:"Text:"},{nameRender:"renderText",attr:"title",defaultValue:"ioBroker",frontText:"Title:"},{nameRender:"renderSelect",attr:"sound",defaultValue:"magic",frontText:"Sound:",doNotTranslate:!0,options:[{value:"pushover",title:"pushover"},{value:"bike",title:"bike"},{value:"bugle",title:"bugle"},{value:"cashregister",title:"cashregister"},{value:"classical",title:"classical"},{value:"cosmic",title:"cosmic"},{value:"falling",title:"falling"},{value:"gamelan",title:"gamelan"},{value:"incoming",title:"incoming"},{value:"intermission",title:"intermission"},{value:"magic",title:"magic"},{value:"mechanical",title:"mechanical"},{value:"pianobar",title:"pianobar"},{value:"siren",title:"siren"},{value:"spacealarm",title:"spacealarm"},{value:"tugboat",title:"tugboat"},{value:"alien",title:"alien"},{value:"climb",title:"climb"},{value:"persistent",title:"persistent"},{value:"echo",title:"echo"},{value:"updown",title:"updown"},{value:"none",title:"none"}]},{nameRender:"renderSelect",attr:"priority",defaultValue:-1,frontText:"Priority:",options:[{value:-1,title:"quiet"},{value:0,title:"normal"},{value:1,title:"high-priority"},{value:2,title:"acknowledgment"}]}]},()=>super.onTagChange())}static getStaticData(){return{acceptedBy:"actions",name:"Pushover",id:"ActionPushover",adapter:"pushover",title:"Sends message via pushover",helpDialog:"You can use %s in the text to display current trigger value or %id to display the triggered object ID"}}getData(){return nc.getStaticData()}}class rc extends Xe{constructor(s){super(s,rc.getStaticData())}static compile(s,i){const r=(s.text||"").replace(/"/g,'\\"');return r?`// whatsapp ${r||""}
1170
+ const subActionVar${s._id} = "${(r||"").replace(/"/g,'\\"')}"${Xe.getReplacesInText(i)};
1171
+ _sendToFrontEnd(${s._id}, {text: subActionVar${s._id}});
1172
+ sendTo("${s.instance}", "send", {text: subActionVar${s._id}${s.phone?`, phone: "${s.phone.replace(/"/g,'\\"')}"`:""}});`:`// no text defined
1173
+ _sendToFrontEnd(${s._id}, {text: 'No text defined'});`}renderDebug(s){return`${b.I18n.t("Sent:")} ${s.data.text}`}onTagChange(){this.setState({inputs:[{nameRender:"renderInstance",adapter:"whatsapp-cmb",frontText:"Instance:",defaultValue:"whatsapp-cmb.0",attr:"instance"},{nameRender:"renderModalInput",attr:"text",defaultValue:"Hello",nameBlock:"",frontText:"Text:"},{nameRender:"renderText",attr:"phone",defaultValue:"",frontText:"Phone:",backText:"(optional)"}]},()=>super.onTagChange())}static getStaticData(){return{acceptedBy:"actions",name:"Whatsapp-cmb",id:"ActionWhatsappcmb",adapter:"whatsapp-cmb",title:"Sends message via whatsapp-cmb",helpDialog:"You can use %s in the text to display current trigger value or %id to display the triggered object ID"}}getData(){return rc.getStaticData()}}class ac extends Xe{constructor(s){super(s,ac.getStaticData())}static compile(s,i){const r=(s.text||"").replace(/"/g,'\\"');return r?`// Pushsafer ${s.text||""}
1174
+ const subActionVar${s._id} = "${r}"${Xe.getReplacesInText(i)};
1175
+ _sendToFrontEnd(${s._id}, {text: subActionVar${s._id}});
1176
+ sendTo("${s.instance}", "send", {
1177
+ message: subActionVar${s._id},
1178
+ title: "${(s.title||"").replace(/"/g,'\\"')}"${Xe.getReplacesInText(i)},
1179
+ ${s.sound&&s.sound!=="_"?`sound: "${s.sound}",`:""}
1180
+ priority: ${s.priority},
1181
+ ${s.vibration&&s.vibration!=="_"?`vibration: ${s.vibration},`:""}
1182
+ });`:`// no text defined
1183
+ _sendToFrontEnd(${s._id}, {text: 'No text defined'});`}renderDebug(s){return`Sent: ${s.data.text}`}onTagChange(){this.setState({inputs:[{nameRender:"renderInstance",adapter:"pushsafer",frontText:"Instance:",defaultValue:"pushsafer.0",attr:"instance"},{nameRender:"renderModalInput",attr:"text",defaultValue:"Hello",nameBlock:"",frontText:"Text:"},{nameRender:"renderText",attr:"title",defaultValue:"ioBroker",frontText:"Title:"},{nameRender:"renderSelect",attr:"sound",defaultValue:"magic",frontText:"Sound:",doNotTranslate:!0,options:[{value:"_",title:"Device Default"},{value:"0",title:"Silent"},{value:"1",title:"Ahem (IM)"},{value:"2",title:"Applause (Mail)"},{value:"3",title:"Arrow (Reminder)"},{value:"4",title:"Baby (SMS)"},{value:"5",title:"Bell (Alarm)"},{value:"6",title:"Bicycle (Alarm2)"},{value:"7",title:"Boing (Alarm3)"},{value:"8",title:"Buzzer (Alarm4)"},{value:"9",title:"Camera (Alarm5)"},{value:"10",title:"Car Horn (Alarm6)"},{value:"11",title:"Cash Register (Alarm7)"},{value:"12",title:"Chime (Alarm8)"},{value:"13",title:"Creaky Door (Alarm9)"},{value:"14",title:"Cuckoo Clock (Alarm10)"},{value:"15",title:"Disconnect (Call)"},{value:"16",title:"Dog (Call2)"},{value:"17",title:"Doorbell (Call3)"},{value:"18",title:"Fanfare (Call4)"},{value:"19",title:"Gun Shot (Call5)"},{value:"20",title:"Honk (Call6)"},{value:"21",title:"Jaw Harp (Call7)"},{value:"22",title:"Morse (Call8)"},{value:"23",title:"Electricity (Call9)"},{value:"24",title:"Radio Tuner (Call10)"},{value:"25",title:"Sirens"},{value:"26",title:"Military Trumpets"},{value:"27",title:"Ufo"},{value:"28",title:"Whah Whah Whah"},{value:"29",title:"Man Saying Goodbye"},{value:"30",title:"Man Saying Hello"},{value:"31",title:"Man Saying No"},{value:"32",title:"Man Saying Ok"},{value:"33",title:"Man Saying Ooohhhweee"},{value:"34",title:"Man Saying Warning"},{value:"35",title:"Man Saying Welcome"},{value:"36",title:"Man Saying Yeah"},{value:"37",title:"Man Saying Yes"},{value:"38",title:"Beep short"},{value:"39",title:"Weeeee short"},{value:"40",title:"Cut in and out short"},{value:"41",title:"Finger flicking glas short"},{value:"42",title:"Wa Wa Waaaa short"},{value:"43",title:"Laser short"},{value:"44",title:"Wind Chime short"},{value:"45",title:"Echo short"},{value:"46",title:"Zipper short"},{value:"47",title:"HiHat short"},{value:"48",title:"Beep 2 short"},{value:"49",title:"Beep 3 short"},{value:"50",title:"Beep 4 short"},{value:"51",title:"The Alarm is armed"},{value:"52",title:"The Alarm is disarmed"},{value:"53",title:"The Backup is ready"},{value:"54",title:"The Door is closed"},{value:"55",title:"The Door is opend"},{value:"56",title:"The Window is closed"},{value:"57",title:"The Window is open"},{value:"58",title:"The Light is off"},{value:"59",title:"The Light is on"},{value:"60",title:"The Doorbell rings"},{value:"61",title:"Pager short"},{value:"62",title:"Pager long"}]},{nameRender:"renderSelect",attr:"priority",defaultValue:0,frontText:"Priority:",options:[{value:-2,title:"lowest priority"},{value:-1,title:"lower priority"},{value:0,title:"normal priority"},{value:1,title:"high priority"},{value:2,title:"highest priority"}]},{nameRender:"renderSelect",attr:"vibration",defaultValue:0,frontText:"Vibration:",options:[{value:"_",title:"default"},{value:1,title:"1"},{value:2,title:"2"},{value:3,title:"3"}]}]},()=>super.onTagChange())}static getStaticData(){return{acceptedBy:"actions",name:"Pushsafer",id:"ActionPushsafer",adapter:"pushsafer",title:"Sends message via Pushsafer",helpDialog:"You can use %s in the text to display current trigger value or %id to display the triggered object ID"}}getData(){return ac.getStaticData()}}const AC=`async function (obj) {
1184
+ "__%%DEBUG_TRIGGER%%__";
1185
+ __%%CONDITIONS_VARS%%__
1186
+ const _cond = __%%CONDITION%%__;
1187
+
1188
+ "__%%DEBUG_CONDITIONS%%__";
1189
+
1190
+ if (_cond) {
1191
+ __%%THEN%%__
1192
+ } else {
1193
+ __%%ELSE%%__
1194
+ }
1195
+ }`,RC=`async function (obj) {
1196
+ "__%%DEBUG_TRIGGER%%__";
1197
+ __%%CONDITIONS_VARS%%__
1198
+ const _cond = __%%CONDITION%%__;
1199
+
1200
+ "__%%DEBUG_CONDITIONS%%__";
1201
+
1202
+ if (__%%STATE%%__ === false && _cond) {
1203
+ __%%STATE%%__ = true;
1204
+ __%%THEN%%__
1205
+ } else if (__%%STATE%%__ === true && !_cond) {
1206
+ __%%STATE%%__ = false;
1207
+ __%%ELSE%%__
1208
+ }
1209
+ }`,qA=`"__%%DEBUG_TRIGGER%%__";
1210
+ __%%CONDITIONS_VARS%%__
1211
+ const _cond = __%%CONDITION%%__;
1212
+
1213
+ "__%%DEBUG_CONDITIONS%%__";
1214
+
1215
+ if (_cond) {
1216
+ __%%THEN%%__
1217
+ } else {
1218
+ __%%ELSE%%__
1219
+ }`,Xp={triggers:[],conditions:[[]],justCheck:!1,actions:{then:[],else:[]}};function ZA(a,s,i){const r=[];let l=a.triggers;l.length||(l=[{id:"TriggerScriptSave"}]);const u=[],d=[],p=a.conditions.find(f=>f.find(v=>v.tagCard==="()"));l.forEach((f,v)=>{var _;const w=nm(f.id,i);if(w){const k={trigger:f,condition:{index:0},justCheck:p?!1:a.justCheck||!a.conditions.length||!a.conditions[0].length,conditionsDebug:[],conditionsVars:[],conditionsStates:[]},S=w.compile(f,k),C=QA(a.conditions,k,i),I=D_(a.actions.then,k,i),O=D_(a.actions.else,k,i);u.push(`cond${v}`),(_=k.prelines)!=null&&_.length&&k.prelines.forEach(A=>d.push(A)),S.includes(" __%%CONDITIONS_VARS%%__")&&(k.conditionsVars=k.conditionsVars.map((A,R)=>R?` ${A}`:A),k.conditionsDebug=k.conditionsDebug.map((A,R)=>R?` ${A}`:A)),r.push(S.replace("__%%CONDITIONS_VARS%%__",k.conditionsVars.join(`
1220
+ `)).replace('"__%%DEBUG_CONDITIONS%%__";',k.conditionsDebug.join(`
1221
+ `)).replace("__%%CONDITION%%__",C).replace("__%%THEN%%__",I||"// ignore").replace("__%%ELSE%%__",O||"// ignore").replace(/__%%STATE%%__/g,`cond${v}`))}});let m=r.join(`
1222
+
1223
+ `);return(!a.justCheck||p)&&(m=`${u.map(f=>`let ${f} = false;`).join(`
1224
+ `)}
1225
+
1226
+ ${m}`),d&&(m=`${d.join(`
1227
+ `)}
1228
+
1229
+ ${m}`),m}function nm(a,s){return s.find(i=>i.getStaticData&&i.getStaticData().id===a)}function D_(a,s,i){const r=[];return a==null||a.forEach(l=>{const u=nm(l.id,i);u&&r.push(u.compile(l,s))}),` ${r.join(`
1230
+
1231
+ `)}`}function QA(a,s,i){const r=[];let l=0;return a==null||a.forEach(u=>{const d=[];u!=null&&u.length&&(u.forEach(p=>{const m=nm(p.id,i);m&&(s.condition.index=l++,d.push(m.compile(p,s)))}),r.push(`(${d.join(`) &&
1232
+ (`)})`))}),r.length?r.length===1?r[0]||"true":`(${r.join(") || (")})`:"true"}function eR(a,s){return ZA(a,null,s)}function Poe(a){if(!a)return Xp;const s=a.split(`
1233
+ `);try{const i=(s.pop()||"").replace(/^\/\//,"");let r=JSON.parse(i);return r.triggers||(r=Xp),r}catch{return Xp}}function Foe(a,s){let i="";const r=eR(a,s);return i+=r,i+=`
1234
+ /*
1235
+ const demo = ${JSON.stringify(a,null,2).replace(/\*\//g,"* /")};
1236
+ */
1237
+ `,`${i}
1238
+ //${JSON.stringify(a)}`}class lc extends Xe{constructor(s){super(s,lc.getStaticData())}static compile(s,i){return qA.replace('"__%%DEBUG_TRIGGER%%__"',`_sendToFrontEnd(${s._id}, {trigger: true})`)}renderDebug(){return b.I18n.t("Triggered")}onTagChange(s){this.setState({inputs:[{nameRender:"renderNameText",defaultValue:"On script save or adapter start",attr:"script"}]},()=>super.onTagChange())}static getStaticData(){return{acceptedBy:"triggers",name:"Start script",id:"TriggerScriptSave",icon:"PlayArrow",title:"Triggers the on script saving or the javascript instance restart"}}getData(){return lc.getStaticData()}}var OC={exports:{}};(function(a,s){(function(){var i=Math.PI,r=Math.sin,l=Math.cos,u=Math.tan,d=Math.asin,p=Math.atan2,m=Math.acos,f=i/180,v=1e3*60*60*24,w=2440588,_=2451545;function k(Z){return Z.valueOf()/v-.5+w}function S(Z){return new Date((Z+.5-w)*v)}function C(Z){return k(Z)-_}var I=f*23.4397;function O(Z,se){return p(r(Z)*l(I)-u(se)*r(I),l(Z))}function A(Z,se){return d(r(se)*l(I)+l(se)*r(I)*r(Z))}function R(Z,se,F){return p(r(Z),l(Z)*r(se)-u(F)*l(se))}function q(Z,se,F){return d(r(se)*r(F)+l(se)*l(F)*l(Z))}function re(Z,se){return f*(280.16+360.9856235*Z)-se}function ie(Z){return Z<0&&(Z=0),2967e-7/Math.tan(Z+.00312536/(Z+.08901179))}function $e(Z){return f*(357.5291+.98560028*Z)}function U(Z){var se=f*(1.9148*r(Z)+.02*r(2*Z)+3e-4*r(3*Z)),F=f*102.9372;return Z+se+F+i}function Me(Z){var se=$e(Z),F=U(se);return{dec:A(F,0),ra:O(F,0)}}var Ne={};Ne.getPosition=function(Z,se,F){var V=f*-F,W=f*se,le=C(Z),x=Me(le),pe=re(le,V)-x.ra;return{azimuth:R(pe,W,x.dec),altitude:q(pe,W,x.dec)}};var qe=Ne.times=[[-.833,"sunrise","sunset"],[-.3,"sunriseEnd","sunsetStart"],[-6,"dawn","dusk"],[-12,"nauticalDawn","nauticalDusk"],[-18,"nightEnd","night"],[6,"goldenHourEnd","goldenHour"]];Ne.addTime=function(Z,se,F){qe.push([Z,se,F])};var ce=9e-4;function de(Z,se){return Math.round(Z-ce-se/(2*i))}function J(Z,se,F){return ce+(Z+se)/(2*i)+F}function we(Z,se,F){return _+Z+.0053*r(se)-.0069*r(2*F)}function ge(Z,se,F){return m((r(Z)-r(se)*r(F))/(l(se)*l(F)))}function Fe(Z,se,F,V,W,le,x){var pe=ge(Z,F,V),G=J(pe,se,W);return we(G,le,x)}Ne.getTimes=function(Z,se,F){var V=f*-F,W=f*se,le=C(Z),x=de(le,V),pe=J(0,V,x),G=$e(pe),ke=U(G),ye=A(ke,0),Ie=we(pe,G,ke),me,Ve,Ye,Ce,Ee,ve={solarNoon:S(Ie),nadir:S(Ie+.5)};for(me=0,Ve=qe.length;me<Ve;me+=1)Ye=qe[me],Ce=Fe(Ye[0]*f,V,W,ye,x,G,ke),Ee=Ie-(Ce-Ie),ve[Ye[1]]=S(Ee),ve[Ye[2]]=S(Ce);return ve};function Y(Z){var se=f*(218.316+13.176396*Z),F=f*(134.963+13.064993*Z),V=f*(93.272+13.22935*Z),W=se+f*6.289*r(F),le=f*5.128*r(V),x=385001-20905*l(F);return{ra:O(W,le),dec:A(W,le),dist:x}}Ne.getMoonPosition=function(Z,se,F){var V=f*-F,W=f*se,le=C(Z),x=Y(le),pe=re(le,V)-x.ra,G=q(pe,W,x.dec),ke=p(r(pe),u(W)*l(x.dec)-r(x.dec)*l(pe));return G=G+ie(G),{azimuth:R(pe,W,x.dec),altitude:G,distance:x.dist,parallacticAngle:ke}},Ne.getMoonIllumination=function(Z){var se=C(Z||new Date),F=Me(se),V=Y(se),W=149598e3,le=m(r(F.dec)*r(V.dec)+l(F.dec)*l(V.dec)*l(F.ra-V.ra)),x=p(W*r(le),V.dist-W*l(le)),pe=p(l(F.dec)*r(F.ra-V.ra),r(F.dec)*l(V.dec)-l(F.dec)*r(V.dec)*l(F.ra-V.ra));return{fraction:(1+l(x))/2,phase:.5+.5*x*(pe<0?-1:1)/Math.PI,angle:pe}};function et(Z,se){return new Date(Z.valueOf()+se*v/24)}Ne.getMoonTimes=function(Z,se,F,V){var W=new Date(Z);V?W.setUTCHours(0,0,0,0):W.setHours(0,0,0,0);for(var le=.133*f,x=Ne.getMoonPosition(W,se,F).altitude-le,pe,G,ke,ye,Ie,me,Ve,Ye,Ce,Ee,ve,Be,ft,Q=1;Q<=24&&(pe=Ne.getMoonPosition(et(W,Q),se,F).altitude-le,G=Ne.getMoonPosition(et(W,Q+1),se,F).altitude-le,Ie=(x+G)/2-pe,me=(G-x)/2,Ve=-me/(2*Ie),Ye=(Ie*Ve+me)*Ve+pe,Ce=me*me-4*Ie*pe,Ee=0,Ce>=0&&(ft=Math.sqrt(Ce)/(Math.abs(Ie)*2),ve=Ve-ft,Be=Ve+ft,Math.abs(ve)<=1&&Ee++,Math.abs(Be)<=1&&Ee++,ve<-1&&(ve=Be)),Ee===1?x<0?ke=Q+ve:ye=Q+ve:Ee===2&&(ke=Q+(Ye<0?Be:ve),ye=Q+(Ye<0?ve:Be)),!(ke&&ye));Q+=2)x=G;var lt={};return ke&&(lt.rise=et(W,ke)),ye&&(lt.set=et(W,ye)),!ke&&!ye&&(lt[Ye>0?"alwaysUp":"alwaysDown"]=!0),lt},a.exports=Ne})()})(OC);var tR=OC.exports;const MC=hi(tR),sR='{"time":{"start":"00:00","end":"24:00","mode":"hours","interval":1},"period":{"days":1}}';class ai extends Xe{coordinates=null;constructor(s){super(s,ai.getStaticData())}static compile(s,i){var u;let r="",l=i.justCheck?AC:RC;if(l=l.replace('"__%%DEBUG_TRIGGER%%__"',`_sendToFrontEnd(${s._id}, {trigger: true})`),s.tagCard==="interval")r=`setInterval(${l}, ${s.interval||1} * ${s.unit==="s"?1e3:s.unit==="m"?6e4:36e5});`;else if(s.tagCard==="cron")r=`schedule("${s.cron}", ${l});`;else if(s.tagCard==="at"){const[d,p]=(s.at||"").split(":");let m="*";if((u=s==null?void 0:s.dow)!=null&&u.length&&!s.dow.includes("_")){const f=[...s.dow].map(k=>parseInt(k,10));f.sort();const v=[];let w=f[0],_=1;for(;_<f.length;_++)f[_]-f[_-1]>1?(w===f[_-1]?v.push(w.toString()):f[_-1]-w===1?v.push(`${w},${f[_-1]}`):v.push(`${w}-${f[_-1]}`),w=f[_]):_===f.length-1&&(w===f[_-1]||f[_]-w===1?v.push(`${w},${f[_]}`):v.push(`${w}-${f[_]}`));m=v.join(",")}r=`schedule("${p||"0"} ${d||"0"} * * ${m}", ${l});`}else s.tagCard==="astro"?r=`schedule({astro: "${s.astro}", shift: ${s.offset?s.offsetValue:0}}, ${l});`:s.tagCard==="wizard"&&(r=`schedule('${s.wizard}', ${l});`);return r}static _time2String(s){return s?`${s.getHours().toString().padStart(2,"0")}:${s.getMinutes().toString().padStart(2,"0")}`:"--:--"}async _setAstro(s,i,r){var m,f;if(s||=this.state.settings.astro||"solarNoon",i??=this.state.settings.offset,r??=this.state.settings.offsetValue,r=parseInt(r,10)||0,!this.coordinates){const v=await this.props.socket.getObject("system.adapter.javascript.0"),w=(m=v==null?void 0:v.native)==null?void 0:m.latitude,_=(f=v==null?void 0:v.native)==null?void 0:f.longitude;if(!w&&!_){const k=await this.props.socket.getObject("system.config");k!=null&&k.common&&(k.common.latitude||k.common.longitude)?this.coordinates={latitude:parseFloat(k.common.latitude),longitude:parseFloat(k.common.longitude)}:this.coordinates=null}else this.coordinates={latitude:parseFloat(w),longitude:parseFloat(_)}}const l=this.coordinates&&MC.getTimes(new Date,this.coordinates.latitude,this.coordinates.longitude),u=l?Object.keys(l).map(v=>({value:v,title:v,title2:`[${ai._time2String(l[v])}]`,order:l?ai._time2String(l[v]):"??:??"})):[];u.sort((v,w)=>v.order>w.order?1:v.order<w.order?-1:0);let d="--:--";if(s&&l&&l[s]){const v=new Date(l[s]);i&&v.setMinutes(v.getMinutes()+parseInt(r,10)),d=b.I18n.t("(at %s)",ai._time2String(v))}let p;i?p=[{frontText:"at",attr:"astro",nameRender:"renderSelect",options:u,defaultValue:"solarNoon",doNotTranslate2:!0},{backText:"with offset",nameRender:"renderCheckbox",attr:"offset"},{backText:r===1?"minute":"minutes",frontText:"offset",nameRender:"renderNumber",defaultValue:0,attr:"offsetValue",noHelperText:!0},{nameRender:"renderNameText",attr:"textTime",defaultValue:d,doNotTranslate:!0}]:p=[{frontText:"at",attr:"astro",nameRender:"renderSelect",options:u,doNotTranslate2:!0,defaultValue:"solarNoon"},{backText:"with offset",nameRender:"renderCheckbox",attr:"offset"},{nameRender:"renderNameText",attr:"textTime1",defaultValue:d,doNotTranslate:!0}],this.setState({inputs:p},()=>super.onTagChange())}_setInterval(s){s=parseInt(s||this.state.settings.interval,10)||30;let i;s===1?i=[{value:"s",title:"second"},{value:"m",title:"minute"},{value:"h",title:"hour"}]:i=[{value:"s",title:"seconds"},{value:"m",title:"minutes"},{value:"h",title:"hours"}],this.setState({inputs:[{nameRender:"renderNumber",attr:"interval",frontText:"every",defaultValue:30,className:"block-input-interval"},{nameRender:"renderSelect",attr:"unit",defaultValue:"s",options:i}]},()=>super.onTagChange())}renderDebug(s){return b.I18n.t("Triggered")}onValueChanged(s,i){this.state.settings.tagCard==="astro"?i==="astro"?this._setAstro(s):i==="offset"?this._setAstro(void 0,s):i==="offsetValue"&&this._setAstro(void 0,void 0,s):this.state.settings.tagCard==="interval"&&i==="interval"&&this._setInterval(s)}renderCron(s,i,r){const{className:l}=this.props;return g.jsxs("div",{children:[g.jsxs("div",{style:{display:"flex",alignItems:"baseline"},children:[g.jsx("div",{style:{width:"100%"},children:this.renderText({nameRender:"renderText",attr:"cron",defaultValue:i},this.state.settings.cron||i,r)}),g.jsx(Tr,{square:!0,style:{marginLeft:7},value:"...",className:l,onClick:()=>this.setState({openDialog:!0,textCron:this.state.settings.cron})})]}),this.state.openDialog?g.jsx(Sg,{disabled:this.state.settings.cron===this.state.textCron,onApply:()=>{const u=this.state.textCron;r(u,"cron",()=>{r(b.convertCronToText(u,b.I18n.getLanguage()),"addText"),this.setState({openDialog:!1})})},onClose:()=>this.setState({openDialog:!1,textCron:""}),children:g.jsx(b.ComplexCron,{cronExpression:this.state.settings.cron,onChange:u=>this.setState({textCron:u}),language:b.I18n.getLanguage()})}):null,this.renderNameText({nameRender:"renderNameText",defaultValue:b.I18n.t("every hour at 0 minutes"),attr:"addText",signature:!0,doNotTranslate:!0},this.state.settings.addText||b.I18n.t("every hour at 0 minutes"))]},"cron")}renderWizard(s,i,r){const{className:l}=this.props;return g.jsxs("div",{children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",marginTop:7},children:[g.jsx(ri,{className:l,autoComplete:"off",fullWidth:!0,variant:"outlined",size:"small",multiline:!0,rows:2,value:this.state.settings.wizardText,onChange:u=>r(u),customValue:!0}),g.jsx(Tr,{square:!0,style:{marginLeft:7},value:"...",className:l,onClick:()=>this.setState({openDialog:!0,wizard:this.state.settings.wizard,wizardText:b.Schedule.state2text(this.state.settings.wizard)})})]}),this.state.openDialog?g.jsx(Sg,{disabled:this.state.settings.wizard===this.state.wizard,onApply:()=>this.setState({openDialog:!1},()=>{const u=JSON.parse(this.state.wizard);u.valid||={from:b.Schedule.now2string()},u.valid.from||=b.Schedule.now2string(),r({wizardText:this.state.wizardText,wizard:JSON.stringify(u)})}),onClose:()=>this.setState({openDialog:!1}),children:g.jsx(b.Schedule,{theme:this.props.theme,schedule:i,onChange:(u,d)=>this.setState({wizardText:d||"",wizard:u})})}):null]},"wizard")}onTagChange(s){switch(s||=this.state.settings.tagCard,s){case"interval":this._setInterval();break;case"cron":this.setState({inputs:[{nameRender:"renderCron",attr:"cron",defaultValue:"0 * * * *"}]},()=>super.onTagChange());break;case"wizard":{const i=JSON.parse(sR);i.valid||={from:b.Schedule.now2string()},i.valid.from||=b.Schedule.now2string(),this.setState({inputs:[{nameRender:"renderWizard",attr:"wizard",defaultValue:JSON.stringify(i)}]},()=>super.onTagChange(null,()=>{const r=b.Schedule.state2text(this.state.settings.wizard||i);if(this.state.settings.wizard!==r){const l=JSON.parse(JSON.stringify(this.state.settings));l.wizardText=r,this.setState({settings:l}),this.props.onChange(l)}}));break}case"at":this.setState({inputs:[{nameRender:"renderTime",prefix:"at",attr:"at",defaultValue:"07:30"},{nameRender:"renderSelect",attr:"dow",default:"",multiple:!0,defaultValue:["_","1","2","3","4","5","6","0"],options:[{value:"_",title:"Every day",only:!0},{value:"1",title:"Monday",titleShort:"Mo"},{value:"2",title:"Tuesday",titleShort:"Tu"},{value:"3",title:"Wednesday",titleShort:"We"},{value:"4",title:"Thursday",titleShort:"Th"},{value:"5",title:"Friday",titleShort:"Fr"},{value:"6",title:"Saturday",titleShort:"Sa"},{value:"0",title:"Sunday",titleShort:"Su"}]}]},()=>super.onTagChange());break;case"astro":this._setAstro();break}}static getStaticData(){return{acceptedBy:"triggers",name:"Schedule",id:"TriggerScheduleBlock",icon:"AccessTime",tagCardArray:["cron","wizard","interval","at","astro"],title:"Triggers the rule periodically or on some specific time"}}getData(){return ai.getStaticData()}}const on={valueAck:{color:"#b02323"},valueNotAck:{color:"#12ac15"}},NC=X.forwardRef((a,s)=>g.jsx(y.Slide,{direction:"up",ref:s,...a}));NC.displayName="Transition";class cc extends Xe{inputRef;constructor(s){super(s,cc.getStaticData()),this.inputRef=X.createRef()}static compile(s,i){let r=i.justCheck?AC:RC;return r=r.replace('"__%%DEBUG_TRIGGER%%__"',`_sendToFrontEnd(${s._id}, {val: obj.state.val, ack: obj.state.ack, valOld: obj.oldState && obj.oldState.val, ackOld: obj.oldState && obj.oldState.ack})`),`on({id: "${s.oid||""}", change: "${s.tagCard==="on update"?"any":"ne"}"}, ${r});`}renderDebug(s){return s.data.valOld!==void 0?g.jsxs("span",{children:[b.I18n.t("Triggered")," ",g.jsx("span",{style:s.data.ackOld?on.valueAck:on.valueNotAck,children:hn(s.data.valOld)})," ","→"," ",g.jsx("span",{style:s.data.ack?on.valueAck:on.valueNotAck,children:hn(s.data.val)})]}):g.jsxs("span",{children:[b.I18n.t("Triggered")," ",g.jsx("span",{style:s.data.ack?on.valueAck:on.valueNotAck,children:hn(s.data.val)})]})}onWriteValue(){this.setState({openSimulate:!1});let s=this.state.simulateValue;window.localStorage.setItem(`javascript.app.${this.state.settings.oid}_ack`,this.state.simulateAck?"true":"false"),this.state.settings.oidType==="boolean"?(s=s===!0||s==="true"||s==="1",window.localStorage.setItem(`javascript.app.${this.state.settings.oid}`,s?"true":"false")):this.state.settings.oidType==="number"?(s=parseFloat(s)||0,window.localStorage.setItem(`javascript.app.${this.state.settings.oid}`,s.toString())):window.localStorage.setItem(`javascript.app.${this.state.settings.oid}`,(s==null?void 0:s.toString())||""),this.props.socket.setState(this.state.settings.oid,{val:s,ack:!!this.state.simulateAck})}renderWriteState(){return[g.jsx(y.Button,{disabled:!this.state.settings.oid||!this.state.enableSimulation,variant:"contained",color:"primary",onClick:()=>{this.setState({openSimulate:!0,simulateValue:this.state.settings.oidType==="boolean"?window.localStorage.getItem(`javascript.app.${this.state.settings.oid}`)==="true":window.localStorage.getItem(`javascript.app.${this.state.settings.oid}`)||"",simulateAck:window.localStorage.getItem(`javascript.app.${this.state.settings.oid}_ack`)==="true"}),setTimeout(()=>{var s;return(s=this.inputRef.current)==null?void 0:s.focus()},200)},children:b.I18n.t("Simulate")},"buttonWrite"),g.jsxs(y.Dialog,{open:!!this.state.openSimulate,TransitionComponent:NC,keepMounted:!0,onClose:()=>this.setState({openSimulate:!1}),"aria-labelledby":"simulate-dialog-slide-title","aria-describedby":"simulate-dialog-slide-description",children:[g.jsx(y.DialogTitle,{id:"simulate-dialog-slide-title",children:b.I18n.t("Trigger with value")}),g.jsxs(y.DialogContent,{children:[this.state.settings.oidType==="boolean"?g.jsx(y.FormControlLabel,{control:g.jsx(y.Switch,{inputRef:this.inputRef,onKeyUp:s=>s.key==="Enter"&&this.onWriteValue(),value:!!this.state.simulateValue,onChange:s=>this.setState({simulateValue:s.target.checked})}),label:b.I18n.t("Value")}):g.jsx(y.TextField,{variant:"standard",inputRef:this.inputRef,label:b.I18n.t("Value"),fullWidth:!0,onKeyUp:s=>s.key==="Enter"&&this.onWriteValue(),value:!this.state.simulateValue&&this.state.simulateValue!==0?"":this.state.simulateValue,onChange:s=>this.setState({simulateValue:s.target.value})}),g.jsx("br",{}),g.jsx(y.FormControlLabel,{control:g.jsx(y.Checkbox,{checked:!!this.state.simulateAck,onChange:s=>this.setState({simulateAck:s.target.checked}),color:"primary"}),label:b.I18n.t("Ack")})]}),g.jsxs(y.DialogActions,{children:[g.jsxs(y.Button,{variant:"contained",onClick:()=>this.onWriteValue(),color:"primary",children:[g.jsx(pk,{}),b.I18n.t("Write")]}),g.jsxs(y.Button,{color:"grey",variant:"contained",onClick:()=>this.setState({openSimulate:!1}),children:[g.jsx(vc,{}),b.I18n.t("Close")]})]})]},"dialogWrite")]}onTagChange(s){this.setState({inputs:[{nameRender:"renderObjectID",attr:"oid",defaultValue:""},{nameRender:"renderWriteState"}]},()=>{super.onTagChange()})}static getStaticData(){return{acceptedBy:"triggers",name:"State",id:"TriggerState",icon:"FlashOn",tagCardArray:["on change","on update"],title:"Triggers the rule on update or change of some state"}}getData(){return cc.getStaticData()}}const oR=""+new URL("hysteresis-CLhhemcG.png",import.meta.url).href,A_=`function __hysteresis(val, limit, state, hist, comp) {
1239
+ let cond1, cond2;
1240
+ if (comp === '>') {
1241
+ cond1 = val > limit + hist;
1242
+ cond2 = val <= limit - hist;
1243
+ } else if (comp === '<') {
1244
+ cond1 = val < limit - hist;
1245
+ cond2 = val >= limit + hist;
1246
+ } else if (comp === '>=') {
1247
+ cond1 = val >= limit + hist;
1248
+ cond2 = val < limit - hist;
1249
+ } else if (comp === '<=') {
1250
+ cond1 = val <= limit - hist;
1251
+ cond2 = val > limit + hist;
1252
+ } else if (comp === '=') {
1253
+ cond1 = val <= limit + hist && val > limit - hist;
1254
+ cond2 = val > limit + hist || val <= limit - hist;
1255
+ } else if (comp === '<>') {
1256
+ cond1 = val > limit + hist || val <= limit - hist;
1257
+ cond2 = val <= limit + hist && val > limit - hist;
1258
+ }
1259
+
1260
+ if (!state && cond1) {
1261
+ return true;
1262
+ } else if (state && cond2) {
1263
+ return false;
1264
+ } else {
1265
+ return state;
1266
+ }
1267
+ }`;class kr extends Xe{constructor(s){super(s,kr.getStaticData())}isAllTriggersOnState(){var s,i,r,l;return!!((i=(s=this.props.userRules)==null?void 0:s.triggers)!=null&&i.find(u=>u.id==="TriggerState"))&&!((l=(r=this.props.userRules)==null?void 0:r.triggers)!=null&&l.find(u=>u.id!=="TriggerState"))}static compile(s,i){var d,p;let r=s.value;r==null&&(r=!1);let l,u;if(s.tagCard==="()")i.prelines||=[],i.prelines.find(m=>m!==A_)||i.prelines.push(A_),s.useTrigger?(l="obj.state.val",r===""&&(r=0),u=`__hysteresis(subCondVar${s._id}, ${r}, __%%STATE%%__, ${s.hist}, "${s.histComp}")`):(l=`(await getStateAsync("${s.oid}")).val`,r===""&&(r=0),typeof r=="string"&&parseFloat(r.trim()).toString()!==r.trim()&&(r=`"${r}"`),u=`__hysteresis(subCondVar${s._id}, ${r}, __%%STATE%%__, ${s.hist}, "${s.histComp}")`);else if(s.tagCard!=="includes"){const m=s.tagCard==="="?"==":s.tagCard==="<>"?"!=":s.tagCard;s.useTrigger?(l="obj.state.val",((d=i==null?void 0:i.trigger)==null?void 0:d.oidType)==="string"?(r=r.replace(/"/g,'\\"'),u=`subCondVar${s._id} ${m} "${r}"`):(r===""&&(r=0),typeof r=="string"&&parseFloat(r.trim()).toString()!==r.trim()&&(r=`"${r}"`),u=`subCondVar${s._id} ${m} ${r}`)):(l=`(await getStateAsync("${s.oid}")).val`,s.oidType==="string"?(r=r.replace(/"/g,'\\"'),u=`subCondVar${s._id} ${m} "${r}"`):(r===""&&(r=0),typeof r=="string"&&parseFloat(r.trim()).toString()!==r.trim()&&(r=`"${r}"`),u=`subCondVar${s._id} ${m} ${r}`))}else s.useTrigger?(l="obj.state.val",((p=i==null?void 0:i.trigger)==null?void 0:p.oidType)==="string"?(r=r.replace(/"/g,'\\"'),u=`obj.state.val.includes("${r}")`):u="false"):(l=`(await getStateAsync("${s.oid}")).val`,s.oidType==="string"?(r=r.replace(/"/g,'\\"'),u=`subCondVar${s._id}.includes("${r}")`):u="false");return i.conditionsStates.push({name:`subCondVar${s._id}`,id:s.oid}),i.conditionsVars.push(`const subCondVar${s._id} = ${l};`),i.conditionsVars.push(`const subCond${s._id} = ${u};`),i.conditionsDebug.push(`_sendToFrontEnd(${s._id}, {result: subCond${s._id}, value: subCondVar${s._id}, compareWith: "${r}"});`),`subCond${s._id}`}renderDebug(s){const i=this.state.settings.tagCard;return i!=="()"?`${s.data.result.toString().toUpperCase()} [${s.data.value} ${i} ${s.data.compareWith}]`:b.I18n.t("Triggered")}onShowHelp=()=>this.setState({showHysteresisHelp:!0});_setInputs(s,i,r,l,u){var C,I;const d=this.isAllTriggersOnState();i=i||this.state.settings.tagCard,r=r||this.state.settings.oidType,l=l||this.state.settings.oidUnit,u=u||this.state.settings.oidStates,s===void 0&&(s=this.state.settings.useTrigger),d&&s&&((I=(C=this.props.userRules)==null?void 0:C.triggers)==null?void 0:I.length)===1&&(r=this.props.userRules.triggers[0].oidType,l=this.props.userRules.triggers[0].oidUnit,u=this.props.userRules.triggers[0].oidStates);const p=kr.getStaticData().tagCardArray,m=p.find(O=>O.title===i)||p[0];let f,v=null;r==="number"?(f=[{title:"=",title2:"[equal]",text:"equal to"},{title:">=",title2:"[greater or equal]",text:"greater or equal"},{title:">",title2:"[greater]",text:"greater than"},{title:"<=",title2:"[less or equal]",text:"less or equal"},{title:"<",title2:"[less]",text:"less than"},{title:"<>",title2:"[not equal]",text:"not equal to"},{title:"()",title2:"[hysteresis]",text:"hysteresis"}],u&&(v=Object.keys(u).map(O=>u?{value:O,title:u[O]}:null).filter(O=>O))):r==="boolean"?(f=[{title:"=",title2:"[equal]",text:"equal to"},{title:"<>",title2:"[not equal]",text:"not equal to"}],v=[{title:"false",value:!1},{title:"true",value:!0}]):(f=[{title:"=",title2:"[equal]",text:"equal to"},{title:">=",title2:"[greater or equal]",text:"greater or equal"},{title:">",title2:"[greater]",text:"greater than"},{title:"<=",title2:"[less or equal]",text:"less or equal"},{title:"<",title2:"[less]",text:"less than"},{title:"<>",title2:"[not equal]",text:"not equal to"},{title:".",title2:"[includes]",text:"includes"}],u&&(v=Object.keys(u).map(O=>({value:O,title:u?u[O]:O.toString()}))));let w=null;f.find(O=>O.title===i)||(i=f[0].title,w=w||{...this.state.settings},w.tagCard=i);let _,k={nameRender:"renderText",defaultValue:"",attr:"value",frontText:i==="()"?"Limit":(m==null?void 0:m.text)||"compare with",doNotTranslateBack:!0,backText:l};v&&(k={nameRender:"renderSelect",defaultValue:v[0].value,options:v,attr:"value",frontText:(m==null?void 0:m.text)||"compare with",doNotTranslateBack:!0,backText:l},v.find(O=>O.value===this.state.settings.value)||(w=w||{...this.state.settings},w.value=v[0].value),v.length<=2&&(f=[{title:"=",title2:"[equal]",text:"equal to"},{title:"<>",title2:"[not equal]",text:"not equal to"}])),d&&s?_=[{backText:"use trigger value",nameRender:"renderCheckbox",attr:"useTrigger",defaultValue:!1},k]:d?_=[{backText:"use trigger value",nameRender:"renderCheckbox",attr:"useTrigger"},{nameRender:"renderObjectID",attr:"oid",defaultValue:""},k]:_=[{nameRender:"renderObjectID",attr:"oid",defaultValue:""},k],i==="()"&&(_.splice(1,0,{nameRender:"renderDialog",icon:"HelpOutline",frontText:"Explanation",onShowDialog:this.onShowHelp}),_.splice(2,0,{nameRender:"renderSelect",attr:"histComp",defaultValue:">",frontText:"Condition",doNotTranslate:!0,options:[{title:">",value:">"},{title:">=",value:">="},{title:"<",value:"<"},{title:"<=",value:"<="},{title:"=",value:"="},{title:"<>",value:"<>"}]}),_.push({frontText:"Δ",doNotTranslate:!0,nameRender:"renderNumber",noHelperText:!0,attr:"hist",defaultValue:1,doNotTranslateBack:!0,backText:l}));const S={iconTag:!0,tagCardArray:f,inputs:_};this.setState(S,()=>super.onTagChange(null,()=>{w&&(this.setState({settings:w}),this.props.onChange(w))}))}onValueChanged(s,i){typeof s=="object"?this._setInputs(s.useTrigger,s.tagCard,s.oidType,s.states):i==="useTrigger"?this._setInputs(s):i==="oidType"?this._setInputs(void 0,void 0,s):i==="oidUnit"?this._setInputs(void 0,void 0,void 0,s):i==="oidStates"&&this._setInputs(void 0,void 0,void 0,void 0,s)}onUpdate(){this._setInputs(this.state.settings.useTrigger)}onTagChange(s){this._setInputs(this.state.settings.useTrigger,s)}static getStaticData(){return{acceptedBy:"conditions",name:"State condition",id:"ConditionState",icon:"Shuffle",tagCardArray:[{title:"=",title2:"[equal]",text:"equal to"},{title:">=",title2:"[greater or equal]",text:"greater or equal"},{title:">",title2:"[greater]",text:"greater than"},{title:"<=",title2:"[less or equal]",text:"less or equal"},{title:"<",title2:"[less]",text:"less than"},{title:"<>",title2:"[not equal]",text:"not equal to"},{title:".",title2:"[includes]",text:"includes"},{title:"()",title2:"[hysteresis]",text:"hysteresis"}],title:"Compares the state value with user defined value"}}getData(){return kr.getStaticData()}renderSpecific(){return this.state.showHysteresisHelp?g.jsxs(y.Dialog,{open:!0,maxWidth:"md",onClose:()=>this.setState({showHysteresisHelp:!1}),"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[g.jsx(y.DialogContent,{children:g.jsx(y.DialogContentText,{id:"alert-dialog-description",children:g.jsx("img",{src:oR,alt:"Hysteresis"})})}),g.jsx(y.DialogActions,{children:g.jsx(y.Button,{onClick:()=>this.setState({showHysteresisHelp:!1}),color:"primary",autoFocus:!0,children:b.I18n.t("OK")})})]}):null}}const R_=[31,29,31,30,31,30,31,31,30,31,30,31];class Sr extends Xe{constructor(s){super(s,Sr.getStaticData())}static compile(s,i){const r=s.tagCard==="="?"===":s.tagCard==="<>"?"!==":s.tagCard;let l;if(s.withDate){const[u,d]=(s.date||"01.01").toString().split(".");let p=parseInt(d,10)||0,m=parseInt(u,10)||0;m>12?m=12:m<0&&(m=0),p>R_[m]?p=R_[m]:p<0&&(p=0),p&&m?l=`formatDate(Date.now(), 'MM.DD-hh:mm') ${r} "${s.date}-${s.time}"`:p===0&&m?l=`formatDate(Date.now(), 'MM-hh:mm') ${r} "${m.toString().padStart(2,"0")}-${s.time}"`:m===0&&p?l=`formatDate(Date.now(), 'DD-hh:mm') ${r} "${p.toString().padStart(2,"0")}-${s.time}"`:l=`formatDate(Date.now(), 'hh:mm') ${r} "${s.time}"`}else l=`formatDate(Date.now(), 'hh:mm') ${r} "${s.time}"`;return i.conditionsVars.push(`const subCond${s._id} = ${l};`),i.conditionsDebug.push(`_sendToFrontEnd(${s._id}, {result: subCond${s._id}});`),`subCond${s._id}`}_setInputs(s,i){i=i===void 0?this.state.settings.withDate:i,s=s||this.state.settings.tagCard;const r=Sr.getStaticData().tagCardArray,l=r==null?void 0:r.find(d=>d.title===s),u=[{nameRender:"renderNameText",attr:"interval",defaultValue:"Actual time of day"},{frontText:(l==null?void 0:l.text)||s,nameRender:"renderTime",attr:"time",defaultValue:"12:00"},{frontText:"with date",nameRender:"renderCheckbox",attr:"withDate",defaultValue:!1}];i&&u.push({nameRender:"renderDate",attr:"date",defaultValue:"01.01"}),this.setState({inputs:u,iconTag:!0},()=>super.onTagChange())}onValueChanged(s,i){i==="withDate"&&this._setInputs(void 0,s)}onTagChange(s){this._setInputs(s)}static getStaticData(){return{acceptedBy:"conditions",name:"Time condition",id:"ConditionTime",icon:"Shuffle",tagCardArray:[{title:"=",title2:"[equal]",text:"equal to"},{title:">=",title2:"[greater or equal]",text:"greater or equal"},{title:">",title2:"[greater]",text:"greater than"},{title:"<=",title2:"[less or equal]",text:"less or equal"},{title:"<",title2:"[less]",text:"less than"},{title:"<>",title2:"[not equal]",text:"not equal to"}],title:"Compares current time with the user specific time"}}getData(){return Sr.getStaticData()}}class Eo extends Xe{coordinates=null;constructor(s){super(s,Eo.getStaticData())}static compile(s,i){const r=s.tagCard==="="?"===":s.tagCard==="<>"?"!==":s.tagCard;let l;s.offset&&(l=parseInt(s.offsetValue,10)||0);const u=`formatDate(Date.now(), 'hh:mm') ${r} formatDate(getAstroDate("${s.astro}"${l?`, undefined, ${l}`:""}), 'hh:mm')`;return i.conditionsVars.push(`const subCond${s._id} = ${u};`),i.conditionsDebug.push(`_sendToFrontEnd(${s._id}, {result: ${u}});`),u}static _time2String(s){return s?`${s.getHours().toString().padStart(2,"0")}:${s.getMinutes().toString().padStart(2,"0")}`:"--:--"}onValueChanged(s,i){i==="astro"?this._setAstro(s):i==="offset"?this._setAstro(void 0,s):i==="offsetValue"&&this._setAstro(void 0,void 0,s)}async _setAstro(s,i,r){if(s=s||this.state.settings.astro||"solarNoon",i=i===void 0?this.state.settings.offset:i,r=r===void 0?this.state.settings.offsetValue:r,r=parseInt(r,10)||0,!this.coordinates){const v=await this.props.socket.getObject("system.adapter.javascript.0");if(!(v!=null&&v.native.latitude)&&!(v!=null&&v.native.longitude)){const w=await this.props.socket.getObject("system.config");w&&(w.common.latitude||w.common.longitude)?this.coordinates={latitude:w.common.latitude,longitude:w.common.longitude}:this.coordinates=null}else this.coordinates={latitude:v==null?void 0:v.native.latitude,longitude:v==null?void 0:v.native.longitude}}const l=this.coordinates?MC.getTimes(new Date,this.coordinates.latitude,this.coordinates.longitude):null,u=l?Object.keys(l).map(v=>({value:v,title:v,title2:`[${Eo._time2String(l[v])}]`,order:Eo._time2String(l[v])})):[];u.sort((v,w)=>v.order>w.order?1:v.order<w.order?-1:0);const d=Eo.getStaticData().tagCardArray,p=d.find(v=>v.title===this.state.settings.tagCard)||d[0];let m="--:--";if(s&&l&&l[s]){const v=new Date(l[s]);i&&v.setMinutes(v.getMinutes()+parseInt(r,10)),m=`(${b.I18n.t(p.text)} ${Eo._time2String(v)})`}let f;i?f=[{nameRender:"renderNameText",defaultValue:"Actual time of day",attr:"text"},{frontText:p.text,attr:"astro",nameRender:"renderSelect",options:u,doNotTranslate2:!0,defaultValue:"solarNoon"},{backText:"with offset",nameRender:"renderCheckbox",attr:"offset"},{backText:r===1?"minute":"minutes",frontText:"offset",nameRender:"renderNumber",defaultValue:0,attr:"offsetValue",noHelperText:!0},{nameRender:"renderNameText",attr:"textTime",doNotTranslate:!0,defaultValue:m}]:f=[{nameRender:"renderNameText",defaultValue:"Actual time of day",attr:"text"},{frontText:p.text,attr:"astro",nameRender:"renderSelect",options:u,doNotTranslate2:!0,defaultValue:"solarNoon"},{backText:"with offset",nameRender:"renderCheckbox",attr:"offset"},{nameRender:"renderNameText",attr:"textTime",doNotTranslate:!0,defaultValue:m}],this.setState({inputs:f},()=>super.onTagChange())}onTagChange(){this._setAstro()}static getStaticData(){return{acceptedBy:"conditions",name:"Astronomical",id:"ConditionAstronomical",icon:"Brightness3",tagCardArray:[{title:"=",title2:"[equal]",text:"equal to"},{title:">=",title2:"[greater or equal]",text:"greater or equal to"},{title:">",title2:"[greater]",text:"greater than"},{title:"<=",title2:"[less or equal]",text:"less or equal to"},{title:"<",title2:"[less]",text:"less than"},{title:"<>",title2:"[not equal]",text:"not equal to"}],title:"Compares current time with astronomical event"}}getData(){return Eo.getStaticData()}}const O_={valueAck:{color:"#b02323"},valueNotAck:{color:"#12ac15"}};class uc extends Xe{constructor(s){super(s,uc.getStaticData())}isAllTriggersOnState(){var s,i,r,l;return!!((i=(s=this.props.userRules)==null?void 0:s.triggers)!=null&&i.find(u=>u.id==="TriggerState"))&&!((l=(r=this.props.userRules)==null?void 0:r.triggers)!=null&&l.find(u=>u.id!=="TriggerState"))}static compile(s,i){let r=s.value;s.useTrigger?r=s.toggle?"!obj.state.val":"obj.state.val":(r==null&&(r=""),typeof s.value=="string"&&parseFloat(s.value).toString()!==s.value&&s.value!=="true"&&s.value!=="false"&&(r=`"${r.replace(/"/g,'\\"')}"${Xe.getReplacesInText(i)}`));let l;return s.toggle&&!s.useTrigger?l=`const subActionVar${s._id} = !(await getStateAsync("${s.oid}")).val`:l=`const subActionVar${s._id} = ${r}`,`// set state ${s.oid} to ${s.toggle&&!s.useTrigger?"toggle":r}
1268
+ ${l};
1269
+ _sendToFrontEnd(${s._id}, {val: subActionVar${s._id}, ack: ${s.tagCard==="update"}});
1270
+ await setStateAsync("${s.oid}", subActionVar${s._id}, ${s.tagCard==="update"});`}renderDebug(s){return g.jsxs("span",{children:[b.I18n.t("Set:")," ",g.jsx("span",{style:s.data.ack?O_.valueAck:O_.valueNotAck,children:hn(s.data.val)})]})}_setInputs(s,i){const r=this.isAllTriggersOnState();i=i===void 0?this.state.settings.toggle:i,s=s===void 0?this.state.settings.useTrigger:s;let l="",u;const{oidType:d,oidUnit:p,oidStates:m,oidMax:f,oidMin:v,oidRole:w,oidWrite:_,oidStep:k}=this.state.settings;let S;d&&(d==="number"?(l="number",f!==void 0&&v!==void 0&&(l="slider")):d==="boolean"?(l="boolean",w&&w.includes("button")&&_&&(l="button")):(l="",w&&w.includes("color")&&(l="color")),m&&(u=Object.keys(m).map(I=>({value:I,title:m[I]})),l="select"));let C;if(r&&s)C=[{backText:"use trigger value",nameRender:"renderCheckbox",attr:"useTrigger",defaultValue:!1}],l==="boolean"&&C.push({backText:"toggle value",attr:"toggle",nameRender:"renderCheckbox",defaultValue:!1});else{switch(l){case"number":C=[{backText:p||"",frontText:"with",nameRender:"renderNumber",defaultValue:f===void 0?0:f,attr:"value"}],this.state.settings.value!==void 0&&isNaN(parseFloat(this.state.settings.value))&&(S={value:f===void 0?0:f});break;case"slider":{C=[{nameRender:"renderSlider",defaultValue:f,min:v,max:f,unit:p,step:k,attr:"value"}];const I=parseFloat(this.state.settings.value);this.state.settings.value!==void 0&&(isNaN(I)||I<v||I>f)&&(S={value:f});break}case"select":C=[{nameRender:"renderSelect",frontText:"with",options:u,defaultValue:(u==null?void 0:u[0].value)||"",attr:"value"}],this.state.settings.value!==void 0&&!(u!=null&&u.find(I=>I.value===this.state.settings.value))&&(S={value:(u==null?void 0:u[0].value)||""});break;case"boolean":C=[{backText:"toggle value",attr:"toggle",nameRender:"renderCheckbox",defaultValue:!1}],i||C.push({backText:"true",frontText:"false",nameRender:"renderSwitch",defaultValue:!1,attr:"value"}),this.state.settings.value!==void 0&&this.state.settings.value!==!1&&this.state.settings.value!==!0&&(S={value:!1});break;case"button":C=[{nameRender:"renderButton",defaultValue:!0,attr:"value"}],this.state.settings.value!==void 0&&this.state.settings.value!==!0&&(S={value:!0});break;case"color":C=[{nameRender:"renderColor",frontText:"with",defaultValue:"#FFFFFF",attr:"value"}],this.state.settings.value!==void 0&&(typeof this.state.settings.value!="string"||!this.state.settings.value.startsWith("#")&&!this.state.settings.value.startsWith("rgb"))&&(S={value:"#FFFFFF"});break;default:C=[{backText:p||"",frontText:"with",nameRender:"renderText",defaultValue:"",attr:"value"}];break}r&&C.unshift({backText:"use trigger value",nameRender:"renderCheckbox",attr:"useTrigger"})}return{inputs:C,newSettings:S}}onTagChange(s,i,r,l,u){u=u===void 0?this.state.settings.useTrigger:u;const{inputs:d,newSettings:p}=this._setInputs(u,l);d.unshift({nameRender:"renderObjectID",attr:"oid",defaultValue:"",checkReadOnly:!0}),this.setState({inputs:d},()=>super.onTagChange(null,()=>{if(p){const m=JSON.parse(JSON.stringify(this.state.settings));Object.assign(m,p),this.setState(m),this.props.onChange(m)}}))}onValueChanged(s,i){this.onTagChange(void 0,void 0,void 0,i==="toggle"?s:void 0,i==="useTrigger"?s:void 0)}onUpdate(){this.onTagChange()}static getStaticData(){return{acceptedBy:"actions",name:"Set state action",id:"ActionSetState",icon:"PlayForWork",tagCardArray:["control","update"],title:"Control or update some state",helpDialog:"You can use %s in the value to use the current trigger value or %id to display the triggered object ID"}}getData(){return uc.getStaticData()}}class dc extends Xe{constructor(s){super(s,dc.getStaticData())}static compile(s,i){return`// exec "${s.exec}"
1271
+ const subActionVar${s._id} = "${(s.exec||"").replace(/"/g,'\\"')}"${Xe.getReplacesInText(i)};
1272
+ _sendToFrontEnd(${s._id}, {exec: subActionVar${s._id}});
1273
+ console.log(subActionVar${s._id});`}renderDebug(s){return`Exec: ${s.data.exec}`}onTagChange(s){this.setState({inputs:[{nameRender:"renderModalInput",attr:"exec",defaultValue:"ls /opt/iobroker",nameBlock:"Shell command"}]},()=>super.onTagChange(s))}static getStaticData(){return{acceptedBy:"actions",name:"Exec",id:"ActionExec",icon:"Apps",title:"Executes some shell command",helpDialog:"You can use %s in the command to use current trigger value or %id to use the triggered object ID"}}getData(){return dc.getStaticData()}}class hc extends Xe{constructor(s){super(s,hc.getStaticData())}static compile(s,i){return`// HTTP request ${s.url}
1274
+ const subActionVar${s._id} = "${(s.url||"").replace(/"/g,'\\"')}"${Xe.getReplacesInText(i)};
1275
+ _sendToFrontEnd(${s._id}, {url: subActionVar${s._id}});
1276
+ request(subActionVar${s._id});`}renderDebug(s){return`URL: ${s.data.url}`}onTagChange(s){this.setState({inputs:[{nameRender:"renderModalInput",attr:"url",defaultValue:"http://mydevice.com?...",nameBlock:"URL"}]},()=>super.onTagChange(s))}static getStaticData(){return{acceptedBy:"actions",name:"HTTP Call",id:"ActionHTTPCall",icon:"Language",title:"Make a HTTP get request",helpDialog:"You can use %s in the URL to use current trigger value or %id to use the triggered object ID"}}getData(){return hc.getStaticData()}}class pc extends Xe{constructor(s){super(s,pc.getStaticData())}static compile(s,i){return`// Log ${s.text}
1277
+ const subActionVar${s._id} = "${(s.text||"").replace(/"/g,'\\"')}"${Xe.getReplacesInText(i)};
1278
+ _sendToFrontEnd(${s._id}, {text: subActionVar${s._id}});
1279
+ console.log(subActionVar${s._id});`}renderDebug(s){return b.I18n.t("Log: %s",s.data.text)}onTagChange(){this.setState({inputs:[{nameRender:"renderModalInput",attr:"text",defaultValue:"My device triggered",nameBlock:"Log text"}]},()=>super.onTagChange())}static getStaticData(){return{acceptedBy:"actions",name:"Log text",id:"ActionPrintText",icon:"Subject",title:"Print some text in log",helpDialog:"You can use %s in the text to display current trigger value or %id to display the triggered object ID"}}getData(){return pc.getStaticData()}}class gc extends Xe{constructor(s){super(s,gc.getStaticData())}static compile(s){const i=s.unit==="ms"?1:s.unit==="s"?1e3:s.unit==="m"?6e4:36e5;return`// pause for ${i}ms
1280
+ _sendToFrontEnd(${s._id}, {paused: true});
1281
+
1282
+ await wait(${s.pause} * ${i});
1283
+
1284
+ _sendToFrontEnd(${s._id}, {paused: false});`}renderDebug(s){return b.I18n.t("Paused: %s",s.data.paused)}_getOptions(s){return s=s===void 0?this.state.settings.pause:s,s===1||s==="1"?[{value:"ms",title:"millisecond"},{value:"s",title:"second"},{value:"m",title:"minute"},{value:"h",title:"hour"}]:[{value:"ms",title:"milliseconds"},{value:"s",title:"seconds"},{value:"m",title:"minutes"},{value:"h",title:"hours"}]}_setInputs(s){this.setState({inputs:[{nameRender:"renderNumber",attr:"pause",defaultValue:100,noHelperText:!0},{nameRender:"renderSelect",attr:"unit",defaultValue:"ms",options:this._getOptions(s)}]},()=>super.onTagChange())}onValueChanged(s,i){i==="pause"&&this._setInputs(s)}onTagChange(){this._setInputs()}static getStaticData(){return{acceptedBy:"actions",name:"Pause",id:"ActionPause",icon:"Pause",title:"Make a pause between actions"}}getData(){return gc.getStaticData()}}class mc extends Xe{constructor(s){super(s,mc.getStaticData())}static compile(s){const i=(s.func||"").split(`
1285
+ `).map(r=>` ${r}`);return i.unshift(` _sendToFrontEnd(${s._id}, {func: 'executed'});`),i.unshift("// user function"),i.join(`
1286
+ `)}renderDebug(){return b.I18n.t("Function: executed")}onTagChange(s){this.setState({inputs:[{nameRender:"renderModalInput",attr:"func",noTextEdit:!0,defaultValue:'console.log("Test")',nameBlock:"Function"}]},()=>super.onTagChange(s))}static getStaticData(){return{acceptedBy:"actions",name:"User function",id:"ActionFunction",icon:"Functions",title:"Write your own code",helpDialog:"This is advances option. You can write your own code here and it will be executed on trigger"}}getData(){return mc.getStaticData()}}class fc extends Xe{constructor(s){super(s,fc.getStaticData())}isAllTriggersOnState(){var s,i,r,l;return!!((i=(s=this.props.userRules)==null?void 0:s.triggers)!=null&&i.find(u=>u.id==="TriggerState"))&&!((l=(r=this.props.userRules)==null?void 0:r.triggers)!=null&&l.find(u=>u.id!=="TriggerState"))}static compile(s,i){let r=s.value;s.useTrigger?r=s.toggle?"!obj.state.val":"obj.state.val":(r==null&&(r=""),typeof s.value=="string"&&parseFloat(s.value).toString()!==s.value&&s.value!=="true"&&s.value!=="false"&&(r=`"${r.replace(/"/g,'\\"')}"${Xe.getReplacesInText(i)}`));let l;return s.toggle&&!s.useTrigger?l=`const subActionVar${s._id} = !(await getStateAsync("${s.oid}")).val`:l=`const subActionVar${s._id} = ${r}`,`// set delayed state ${s.oid} to ${s.toggle&&!s.useTrigger?"toggle":r} with delay of ${s.delay}ms
1287
+ ${l};
1288
+ _sendToFrontEnd(${s._id}, {val: subActionVar${s._id}, ack: ${s.tagCard==="update"}});
1289
+ setStateDelayed("${s.oid}", subActionVar${s._id}, ${s.tagCard==="update"}, ${parseInt(s.delay,10)}, ${s.clearRunning?"true":"false"});`}renderDebug(s){var i,r;return g.jsxs("span",{children:[b.I18n.t("Set:")," ",g.jsx("span",{className:s.data.ack?(i=this.props.classes)==null?void 0:i.valueAck:(r=this.props.classes)==null?void 0:r.valueNotAck,children:hn(s.data.val)})]})}_setInputs(s,i){const r=this.isAllTriggersOnState();i=i===void 0?this.state.settings.toggle:i,s=s===void 0?this.state.settings.useTrigger:s;let l="",u;const{oidType:d,oidUnit:p,oidStates:m,oidMax:f,oidMin:v,oidRole:w,oidWrite:_,oidStep:k}=this.state.settings;let S;d&&(d==="number"?(l="number",f!==void 0&&v!==void 0&&(l="slider")):d==="boolean"?(l="boolean",w&&w.includes("button")&&_&&(l="button")):(l="",w&&w.includes("color")&&(l="color")),m&&(u=Object.keys(m).map(I=>({value:I,title:m[I]})),l="select"));let C;if(r&&s)C=[{backText:"use trigger value",nameRender:"renderCheckbox",attr:"useTrigger",defaultValue:!1}],l==="boolean"&&C.push({backText:"toggle value",attr:"toggle",nameRender:"renderCheckbox",defaultValue:!1});else{switch(l){case"number":C=[{backText:p||"",frontText:"with",nameRender:"renderNumber",defaultValue:f===void 0?0:f,attr:"value"}],this.state.settings.value!==void 0&&isNaN(parseFloat(this.state.settings.value))&&(S={value:f===void 0?0:f});break;case"slider":{C=[{nameRender:"renderSlider",defaultValue:f,min:v,max:f,unit:p,step:k,attr:"value"}];const I=parseFloat(this.state.settings.value);this.state.settings.value!==void 0&&(isNaN(I)||I<v||I>f)&&(S={value:f});break}case"select":C=[{nameRender:"renderSelect",frontText:"with",options:u,defaultValue:(u==null?void 0:u[0].value)||"",attr:"value"}],this.state.settings.value!==void 0&&!(u!=null&&u.find(I=>I.value===this.state.settings.value))&&(S={value:(u==null?void 0:u[0].value)||""});break;case"boolean":C=[{backText:"toggle value",attr:"toggle",nameRender:"renderCheckbox",defaultValue:!1}],i||C.push({backText:"true",frontText:"false",nameRender:"renderSwitch",defaultValue:!1,attr:"value"}),this.state.settings.value!==void 0&&this.state.settings.value!==!1&&this.state.settings.value!==!0&&(S={value:!1});break;case"button":C=[{nameRender:"renderButton",defaultValue:!0,attr:"value"}],this.state.settings.value!==void 0&&this.state.settings.value!==!0&&(S={value:!0});break;case"color":C=[{nameRender:"renderColor",frontText:"with",defaultValue:"#FFFFFF",attr:"value"}],this.state.settings.value!==void 0&&(typeof this.state.settings.value!="string"||!this.state.settings.value.startsWith("#")&&!this.state.settings.value.startsWith("rgb"))&&(S={value:"#FFFFFF"});break;default:C=[{backText:p||"",frontText:"with",nameRender:"renderText",defaultValue:"",attr:"value"}];break}r&&C.unshift({backText:"use trigger value",nameRender:"renderCheckbox",attr:"useTrigger"})}return C.push({backText:"ms",frontText:"Delay",nameRender:"renderNumber",defaultValue:1e3,noHelperText:!0,attr:"delay"}),C.push({backText:"clear running",nameRender:"renderCheckbox",defaultValue:!0,attr:"clearRunning"}),{inputs:C,newSettings:S}}onTagChange(s,i,r,l,u){u=u===void 0?this.state.settings.useTrigger:u;const{inputs:d,newSettings:p}=this._setInputs(u,l);d.unshift({nameRender:"renderObjectID",attr:"oid",defaultValue:"",checkReadOnly:!0}),this.setState({inputs:d},()=>super.onTagChange(null,()=>{if(p){const m=JSON.parse(JSON.stringify(this.state.settings));Object.assign(m,p),this.setState(m),this.props.onChange(m)}}))}onValueChanged(s,i){this.onTagChange(void 0,void 0,void 0,i==="toggle"?s:void 0,i==="useTrigger"?s:void 0)}onUpdate(){this.onTagChange()}static getStaticData(){return{acceptedBy:"actions",name:"Set with delay",id:"ActionSetStateDelayed",icon:"PlayForWork",tagCardArray:["control","update"],title:"Control or update some state with delay",helpDialog:"You can use %s in the value to use the current trigger value or %id to display the triggered object ID"}}getData(){return fc.getStaticData()}}class $c extends Xe{constructor(s){super(s,$c.getStaticData())}isAllTriggersOnState(){var s,i,r,l;return!!((i=(s=this.props.userRules)==null?void 0:s.triggers)!=null&&i.find(u=>u.id==="TriggerState"))&&!((l=(r=this.props.userRules)==null?void 0:r.triggers)!=null&&l.find(u=>u.id!=="TriggerState"))}static compile(s){const i=`const val2_${s._id} = (await getStateAsync("${s.oid1}")).val;`,r=`const val1_${s._id} = (await getStateAsync("${s.oid2}")).val;`;return`// ${s.oid1} ${s.operation} ${s.oid2} => ${s.oidResult}
1290
+ ${i}
1291
+ ${r}
1292
+ _sendToFrontEnd(${s._id}, {val: val1_${s._id} ${s.operation} val2_${s._id}, ack: ${s.tagCard==="update"}});
1293
+ await setStateAsync("${s.oidResult}", val1_${s._id} ${s.operation} val2_${s._id}, ${s.tagCard==="update"});`}renderDebug(s){var i,r;return g.jsxs("span",{children:[b.I18n.t("Set:")," ",g.jsx("span",{className:s.data.ack?(i=this.props.classes)==null?void 0:i.valueAck:(r=this.props.classes)==null?void 0:r.valueNotAck,children:hn(s.data.val)})]})}onTagChange(){const s=[];s.push({nameRender:"renderObjectID",title:"ID1",attr:"oid1",defaultValue:"",checkReadOnly:!1}),s.push({nameRender:"renderSelect",options:[{value:"+",title:"+"},{value:"-",title:"-"},{value:"*",title:"*"},{value:"/",title:"/"}],doNotTranslate:!0,defaultValue:"+",attr:"operation"}),s.push({nameRender:"renderObjectID",title:"ID2",attr:"oid2",defaultValue:"",checkReadOnly:!1}),s.push({nameRender:"renderNameText",defaultValue:"store in",attr:"textEqual"}),s.push({nameRender:"renderObjectID",attr:"oidResult",defaultValue:"",checkReadOnly:!0}),this.setState({inputs:s},()=>super.onTagChange(null,()=>{const i=JSON.parse(JSON.stringify(this.state.settings));this.props.onChange(i)}))}onValueChanged(s,i){this.onTagChange()}onUpdate(){this.onTagChange()}static getStaticData(){return{acceptedBy:"actions",name:"Operate two states",id:"ActionOperateStates",icon:"AddBox",tagCardArray:["control","update"],title:"Operations with two states"}}getData(){return $c.getStaticData()}}const iR=[ai,lc,cc,kr,Sr,Eo,uc,dc,hc,pc,gc,mc,fc,$c],Fl={sayit:ic,pushover:nc,"whatsapp-cmb":rc,pushsafer:ac},nR=H.createContext({blocks:null,socket:null,onUpdate:!1,setOnUpdate:a=>{},setOnDebugMessage:a=>{},onDebugMessage:[],enableSimulation:!1,setEnableSimulation:a=>{},changedScripts:{},setChangedScripts:a=>{}}),rR=({children:a,socket:s})=>{const[i,r]=H.useState(null),[l,u]=H.useState(!1),[d,p]=H.useState([]),[m,f]=H.useState(!1),[v,w]=H.useState({});return H.useEffect(()=>{l&&u(!1)},[l]),H.useEffect(()=>{(async()=>{const _=await s.getAdapterInstances(),k=Object.keys(Fl).filter(A=>_.find(R=>{var q;return((q=R==null?void 0:R.common)==null?void 0:q.name)===A})),S=[],C=_.filter(A=>A.common.javascriptRules),I=[];for(const A of C){if(I.includes(A.common.name)||!A.common.javascriptRules)continue;let R;if(A.common.javascriptRules.url.startsWith("http:")||A.common.javascriptRules.url.startsWith("https:")?R=A.common.javascriptRules.url:A.common.javascriptRules.url.startsWith("./")?R=`${window.location.protocol}//${window.location.host}${A.common.javascriptRules.url.replace(/^\./,"")}`:R=`${window.location.protocol}//${window.location.host}/adapter/${A.common.name}/${A.common.javascriptRules.url}`,A.common.javascriptRules.i18n===!0){const q=R.lastIndexOf("/");let re;q!==-1?re=R.substring(0,q):re=R;const ie=b.I18n.getLanguage(),$e=`${re}/i18n/${ie}.json`;await fetch($e).then(U=>U.json()).then(U=>b.I18n.extendTranslations(U,ie)).catch(U=>{if(ie!=="en")return fetch(`${re}/i18n/en.json`).then(Me=>Me.json()).then(Me=>b.I18n.extendTranslations(Me,ie)).catch(Me=>console.error(`Cannot load i18n "${$e}": ${Me}`));console.log(`Cannot load i18n "${$e}": ${U}`)})}else if(A.common.javascriptRules.i18n&&typeof A.common.javascriptRules.i18n=="object")try{b.I18n.extendTranslations(A.common.javascriptRules.i18n)}catch(q){console.error(`Cannot import i18n for "${A.common.javascriptRules.name}": ${q}`)}try{NT([{name:A.common.javascriptRules.name,entry:R,type:A.common.javascriptRules.type}]);const q=(await LT(`${A.common.javascriptRules.name}/${A.common.javascriptRules.name}`)).default;q&&(S.push(q),I.push(A.common.name),Fl[A.common.name]=null)}catch(q){console.error(`Cannot load component "${A.common.javascriptRules.name}": ${q}`)}}const O=k.filter(A=>Fl[A]).map(A=>Fl[A]);r([...iR,...O,...S])})()},[]),g.jsx(nR.Provider,{value:{blocks:i,socket:s,onUpdate:l,setOnUpdate:u,onDebugMessage:d,setOnDebugMessage:p,enableSimulation:m,setEnableSimulation:f,changedScripts:v,setChangedScripts:w},children:a})},aR="Acknowledged",lR="Actions",cR="Add",uR="All",dR="Any",hR="Apply",pR="April",gR="Ask",mR="Astronomical",fR="August",$R="Cancel",bR="Close",vR="Condition",yR="Conditions",_R="Console",wR="Copied",CR="December",TR="Default",kR="Delay",SR="Delete",ER="Description",IR="Done",xR="Exec shell",DR="Explanation",AR="Export",RR="Februar",OR="February",MR="Filter",NR="Folder",LR="Fr",BR="Friday",PR="ID",FR="ID1",jR="ID2",zR="Import",UR="Instance",HR="Instances",WR="Instructions",VR="Januar",GR="January",KR="July",YR="June",JR="Limit",XR="March",qR="May",ZR="Menu",QR="Message",eO="Mo",tO="Model",sO="Monday",oO="Month",iO="More",nO="Name",rO="November",aO="OK",lO="October",cO="Ok",uO="Pause",dO="Pushover",hO="Pushsafer",pO="Rename",gO="Repeat",mO="Restart",fO="Result",$O="Sa",bO="Saturday",vO="Save",yO="Schedule",_O="Script",wO="September",CO="Simulate",TO="Stack",kO="Start",SO="State",EO="Su",IO="Sunday",xO="Telegram",DO="Th",AO="Thursday",RO="Time",OO="Triggered",MO="Triggers",NO="Tu",LO="Tuesday",BO="URL",PO="Value",FO="Volume",jO="We",zO="Wednesday",UO="Write",HO="Yes",WO="acknowledgment",VO="all",GO="and",KO="Astro",YO="at",JO="control",XO="copy",qO="CRON",ZO="Dawn",QO="This is a special mode in which states and objects will not change. But only information about each planned change will be displayed in the protocol.",eM="Debug",tM="Dusk",sM="easy",oM="every",iM="Function",nM="ID",rM="Name",aM="Role",lM="Room",cM="Golden hour",uM="End of golden hour",dM='The code will be executed only every time when condition is true. E.g. if triggering on the temperature sensor value and the condition is "if temperature is greater than 20°C", the "then" actions will be executed every time when sensor sends the temperature and it is over 20°C. By 21°C, by 22°C and so on.',hM='The code will be executed only if the condition result changes. E.g. if triggering on the temperature sensor value and the condition is "if temperature is greater than 20°C", the "then" actions will be executed once when temperature is over 20. Next time the "then" actions will be executed when the temperature fails under 20 and then rises over 20 again.',pM="hours",gM="includes",mM="interval",fM="magic",$M="milliseconds",bM="minutes",vM="ms",yM="Nadir",_M="Nautical dawn",wM="Nautical dusk",CM="Next Sunrise",TM="Next sunset",kM="Night",SM="Night end",EM="normal",IM="offset",xM="one",DM="or",AM="quiet",RM="search",OM="seconds",MM="Solar noon",NM="sunrise",LM="Sunrise end",BM="Sunset",PM="Sunset start",FM="then",jM="Acknowledge",zM="From",UM="Last changed",HM="Quality",WM="Timestamp",VM="User",GM="Value",KM="two",YM="update",JM="Adds debug output to the log for many system commands",XM="Verbose log outputs",qM="when",ZM="Wizard",QM={"%s not found":"%s not found","()":"()","(at %s)":"(at %s)","(optional)":"(optional)","-":"-",".":".","AI code generator":"AI code generator",Ack:aR,Actions:lR,"Actual time of day":"Actual time of day",Add:cR,"Add new script":"Add new script",All:uR,"All files will be accepted":"All files will be accepted",Any:dR,"Any month":"Any month",Apply:hR,April:pR,"Are you sure?":"Are you sure?",Ask:gR,Astronomical:mR,"Astronomical events today":"Astronomical events today",August:fR,"Blockly description":"Creating rules by graphic blocks","Body:":"Body:",Cancel:$R,"Cannot delete non empty item!":"Cannot delete non empty item!","Change layout":"Change layout",'Change theme (actual "%s")':'Change theme (now - "%s")',"Check blocks":"Check blocks","Check is not active, because javascript adapter is disabled":"Check is not active, because Javascript adapter is disabled","Clear search input":"Clear search input","Click on this icon":"Click on this icon",Close:bR,"Close all but current":"Close all but current","Collapse all":"Collapse all","Compares current time with astronomical event":"Compares current time with astronomical event","Compares current time with the user specific time":"Compares current time with the user specific time","Compares the state value with user defined value":"Compares the state value with user defined value",Condition:vR,Conditions:yR,"Configuration not saved.":"Configuration not saved.",Console:_R,"Control or update some state":"Control or update some state","Control or update some state with delay":"Control or update some state with delay","Convert blockly to javascript for ever.":"Permanently convert Blockly to Javascript.",Copied:wR,"Copy script":"Copy script","Copy to clipboard":"Copy to clipboard","Create new":"Create new","Create new folder":"Create new folder","Create new script":"Create new script","Create or edit CRON or time wizard":"Create or edit CRON or time wizard","Dark Theme":"Dark theme","Dark style":"Dark style",Date:"Date","Debug instance":"Debug instance","Debug options":"Debug options",December:CR,Default:TR,"Define cron...":"Define cron...","Define schedule...":"Define schedule...",Delay:kR,Delete:SR,"Delete %s":"Delete %s...","Delete folder":"Delete folder","Delete script":"Delete script",Description:ER,"Deselect all":"Deselect all","Discard changes for %s":"Discard changes for %s",Done:IR,"Double click to write value":"Double click to write value","Download as file":"Download as file","Drop some files here or click...":"Drop some files here or click...","Duplicate name":"Duplicate name","Edit script or just double click":"Edit script or just double click","Empty name is not allowed":"Empty name is not allowed","End search mode":"End search mode","Enter your question":"Enter your request",Error:"Error","Error formatting code":"Error formatting code","Error was found":"Error was found","Every day":"Every day",Exec:xR,"Executes some shell command":"Executes some shell command","Existing scripts will be overwritten.":"Existing scripts will be overwritten.","Expand all":"Expand all","Expert mode":"Expert mode",Explanation:DR,Export:AR,"Export all scripts":"Export all scripts","Export blocks":"Export blocks","Export selected blocks":"Export selected blocks",Februar:RR,February:OR,Filter:MR,Folder:NR,Fr:LR,Friday:BR,Function:"Function","Function editor":"Function editor","Function: executed":"Function: executed","Go to next line":"Go to next line","HTTP Call":"HTTP Call","Hide logs":"Hide logs",ID:PR,ID1:FR,ID2:jR,Import:zR,"Import blocks":"Import blocks","Import error":"Import error","Import scripts":"Import scripts","Insert object ID":"Insert object ID",Instance:UR,"Instance is disabled":"Instance is disabled","Instance:":"Instance:",Instances:HR,Instructions:WR,"Invalid CRON":"Invalid CRON","It will not be possible to revert this operation.":"It will not be possible to revert this operation.","JS description":"Creating rules by writing Javascript",Januar:VR,January:GR,July:KR,June:YR,"Just check":"Just check","Language:":"Language:","Learn More":"Learn More","Light style":"Light style",Limit:JR,"Local time":"Local time","Locate file":"Locate file","Log outputs":"Log outputs","Log text":"Log text","Log: %s":"Log: %s","Make a HTTP get request":"Make a HTTP get request","Make a pause between actions":"Make a pause between actions",March:XR,"March ":"March ",May:qR,Menu:ZR,Message:QR,Mo:eO,Model:tO,Monday:sO,Month:oO,More:iO,Name:nO,"No Chat GPT Key found":"No Chat GPT Key found","No active host found":"No active host found","Nothing found":"Nothing found",November:rO,OK:aO,October:lO,Ok:cO,"On condition change":"On condition result change","On script save or adapter start":"On script save or adapter start","On weekdays":"On weekdays","Open configuration":"Open configuration","Operate two states":"Operate two states","Operations with two states":"Operations with two states","Paste your blocks here":"Paste your blocks here",Pause:uO,"Pause execution":"Pause execution","Pause script":"Pause script","Phone:":"Phone:","Please select object ID...":"Please select object ID...","Press Ctrl+Enter to get the answer":"Press Ctrl+Enter to get the answer","Prettify the script":"Prettify the script","Print some text in log":"Print some text in log","Priority:":"Priority:",Pushover:dO,Pushsafer:hO,"Read only ID selected: %s":"Read only ID selected: %s",Rename:pO,"Reorder scripts in folders":"Reorder scripts in folders",Repeat:gO,Restart:mO,Result:fO,"Resume execution":"Resume execution","Root folder":"Root folder","Rules description":"Create rules with IF, THEN, ELSE blocks","Run script":"Run script",Sa:$O,Saturday:bO,Save:vO,"Save all":"Save all","Say It":"Say It","Say some text via sayit adapter":"Say some text via sayit adapter",Schedule:yO,Script:_O,"Script %s was modified on disk":"Script %s was modified on disk","Script is not running":"Script is not running","Search in scripts":"Search in scripts","Search...":"Search...","Select all":"Select all","Send email":"Send email","Sends an email":"Sends an email","Sends message via Pushsafer":"Sends message via Pushsafer","Sends message via pushover":"Sends message via pushover","Sends message via telegram":"Sends message via telegram","Sends message via whatsapp-cmb":"Sends message via whatsapp-cmb",September:wO,"Server time":"Server time","Set state action":"Set state action","Set with delay":"Set with delay","Shell command":"Shell command","Show astronomical events":"Show astronomical events","Show javascript code":"Show Javascript code","Show logs":"Show logs","Show only paused scripts":"Show only paused scripts","Show only running scripts":"Show only running scripts","Show only scripts with problems":"Show only scripts with problems",Simulate:CO,"Some files will be rejected":"Some files will be rejected","Sound:":"Sound:",Stack:TO,Start:kO,"Start script":"Start script",State:SO,"State condition":"State condition","Step into function":"Step into function","Step out from function":"Step out from function","Stop on exception":"Stop on exception",Su:EO,"Subject:":"Subject:",Sunday:IO,"TS description":"Creating rules by writing Typescript",Telegram:xO,"Text:":"Text:",Th:DO,"The script will be stopped and must be activated manually after debugging. Continue?":"The script will be stopped and must be activated manually after debugging. Continue?","This is advances option. You can write your own code here and it will be executed on trigger":"This is advances option. You can write your own code here and it will be executed on trigger",Thursday:AO,Time:RO,"Time condition":"Time condition","Title:":"Title:","To:":"To:","Trigger with value":"Trigger with value",Triggered:OO,Triggers:MO,"Triggers the on script saving or the javascript instance restart":"Triggers the on script saving or the javascript instance restart","Triggers the rule on update or change of some state":"Triggers the rule on update or change of some state","Triggers the rule periodically or on some specific time":"Triggers the rule periodically or on some specific time",Tu:NO,Tuesday:LO,URL:BO,"Unknown error":"Unknown error","Unknown error!":"Unknown error!","Use generated code":"Use generated code","User function":"User function","User:":"User:",Value:PO,"Vibration:":"Vibration:",Volume:FO,We:jO,Wednesday:zO,"Whatsapp-cmb":"Whatsapp-cmb",Write:UO,"Write your own code":"Write your own code",Yes:HO,"Yet exists!":"Yet exists!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"You can use %s in the URL to use current trigger value, %id to use the triggered object ID, %name to show triggered object ID name or %old to use old trigger value","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"You can use %s in the command to use current trigger value, %id to use the triggered object ID, %name to show triggered object ID name or %old to use old trigger value","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"You can use %s in the text to display current trigger value, %id to use the triggered object ID, %name to show triggered object ID name or %old to use old trigger value","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"You can use %s in the value to use the current trigger value, %id to use the triggered object ID, %name to show triggered object ID name or %old to use old trigger value","You have to enter OpenAI API key in the configuration of javascript adapter.":"You have to enter OpenAI API key in the configuration of javascript adapter.","[equal]":"[equal]","[greater or equal]":"[greater or equal]","[greater]":"[greater]","[hysteresis]":"[hysteresis]","[includes]":"[includes]","[less or equal]":"[less or equal]","[less]":"[less]","[not equal]":"[not equal]",acknowledgment:WO,all:VO,and:GO,astro:KO,at:YO,"clear running":"clear running",control:JO,copy:XO,cron:qO,dawn:ZO,debug_help:QO,debug_label:eM,default:"default",dusk:tM,easy:sM,else:"else","equal to":"equal to",every:oM,"every hour at 0 minutes":"every hour at 0 minutes",false:"false","file reading has failed: %s":"file reading has failed: %s","file reading was aborted":"file reading was aborted",filter_func:iM,filter_id:nM,filter_name:rM,filter_role:aM,filter_room:lM,"for edit or create script":"for edit or create a new script","for professionals":"for professionals","for programmers":"for programmers",goldenHour:cM,goldenHourEnd:uM,"greater or equal":"greater or equal","greater or equal to":"greater or equal to","greater than":"greater than",help_just_check:dM,help_on_change:hM,"high priority":"high priority","high-priority":"high-priority","highest priority":"highest priority",hours:pM,includes:gM,interval:mM,"just check":"just check","less or equal":"less or equal","less or equal to":"less or equal to","less than":"less than","lower priority":"lower priority","lowest priority":"lowest priority",magic:fM,milliseconds:$M,minutes:bM,ms:vM,nadir:yM,nauticalDawn:_M,nauticalDusk:wM,nextSunrise:CM,nextSunset:TM,night:kM,nightEnd:SM,"no blocks found":"No blocks found","no group":"NO GROUP",normal:EM,"normal priority":"normal priority","not equal to":"not equal to","not properly connected":"This block is not properly connected to other blocks.",offset:IM,"on change":"on change","on condition change":"on condition change","on update":"on update",one:xM,or:DM,quiet:AM,"reset search":"reset search",search:RM,seconds:OM,solarNoon:MM,"store in":"store in",sunrise:NM,sunriseEnd:LM,sunset:BM,sunsetStart:PM,then:FM,"toggle value":"toggle value",tooltip_ack:jM,tooltip_from:zM,tooltip_lc:UM,tooltip_quality:HM,tooltip_ts:WM,tooltip_user:VM,tooltip_value:GM,true:"true",two:KM,undefined:"undefined",update:YM,"use seconds":"use seconds","use trigger value":"use trigger value",verbose_help:JM,verbose_label:XM,when:qM,with:"with","with date":"with date","with offset":"with offset",wizard:ZM},eN="Bestätigt",tN="Aktionen",sN="Hinzufügen",oN="Alle",iN="Egal",nN="Anwenden",rN="April",aN="Fragen",lN="Astronomisch",cN="August",uN="Abbrechen",dN="Schließen",hN="Bedingung",pN="Bedingungen",gN="Konsole",mN="Kopiert",fN="Dezember",$N="Standard",bN="Verzögerung",vN="Löschen",yN="Beschreibung",_N="Fertig",wN="Exec shell",CN="Erläuterung",TN="Export",kN="Februar",SN="Februar",EN="Filter",IN="Ordner",xN="Fr",DN="Freitag",AN="ID",RN="ID1",ON="ID2",MN="Import",NN="Instanz",LN="Instanzen",BN="Anleitung",PN="Januar",FN="Januar",jN="Juli",zN="Juni",UN="Grenze",HN="März",WN="Mai",VN="Menü",GN="Nachricht",KN="Mo",YN="Modell",JN="Montag",XN="Monat",qN="Mehr",ZN="Name",QN="November",eL="OK",tL="Oktober",sL="Ok",oL="Pause",iL="Pushover",nL="Pushsafer",rL="Umbenennen",aL="Wiederholen",lL="Neustart",cL="Ergebnis",uL="Sa",dL="Samstag",hL="Speichern",pL="Zeitplan",gL="Skript",mL="September",fL="Simulieren",$L="Stack",bL="Start",vL="Zustand",yL="So",_L="Sonntag",wL="Telegram",CL="Do",TL="Donnerstag",kL="Zeit",SL="Ausgelöst",EL="Löst aus",IL="Di",xL="Dienstag",DL="URL",AL="Wert",RL="Volumen",OL="Mi",ML="Mittwoch",NL="Schreiben",LL="Ja",BL="Wissen",PL="alle",FL="und",jL="Astro",zL="um",UL="Steuerung",HL="Kopie",WL="CRON",VL="Morgendämmerung",GL="Dies ist ein spezieller Modus, in dem sich Zustände und Objekte nicht ändern. Im Protokoll werden jedoch nur Informationen zu jeder geplanten Änderung angezeigt.",KL="Debuggen",YL="Abenddämmerung",JL="einfach",XL="jeder",qL="Funktion",ZL="ID",QL="Name",e1="Rolle",t1="Raum",s1="Goldene Abendstunde",o1="Vormittag",i1='Der Code wird jedes Mal ausgeführt, wenn die Bedingung erfüllt ist. z.B. wenn der Temperatur wert sich ändert und die Bedingung "Wenn die Temperatur größer als 20°C ist" lautet, werden die "Dann" -Aktionen jedes Mal ausgeführt, wenn der Sensor die Temperatur sendet und diese über 20°C liegt. Bei 21°C, bei 22°C und so weiter.',n1='Der Code wird nur ausgeführt, wenn sich das Ergebnis der Bedingung ändert. z.B. wenn sich der Temperatur wert ändert und die Bedingung "Wenn die Temperatur größer als 20°C ist" lautet, werden die "Dann" -Aktionen einmal ausgeführt, wenn die Temperatur über 20°C liegt. Das nächste Mal werden die "Dann" -Aktionen ausgeführt, wenn die Temperatur unter 20°C gefallen ist und dann wieder über 20°C ansteigt.',r1="Stunden",a1="beinhaltet",l1="Intervall",c1="Magie",u1="Millisekunden",d1="Minuten",h1="ms",p1="Nadir",g1="nautische Morgendämmerung",m1="nautische Abenddämmerung",f1="Nächster Sonnenaufgang",$1="Nächster Sonnenuntergang",b1="Nacht",v1="astronomische Morgendämmerung",y1="Normal",_1="Versatz",w1="einer",C1="oder",T1="ruhig",k1="Suche",S1="Sekunden",E1="(Nach-)Mittag",I1="Sonnenaufgang",x1="Goldene Morgenstunde",D1="Sonnenuntergang",A1="Sonnenuntergang (Anfang)",R1="dann",O1="Bestätigen",M1="Von",N1="Zuletzt geändert",L1="Qualität",B1="Zeitstempel",P1="Benutzer",F1="Wert",j1="zwei",z1="Aktualisieren",U1="Fügt Debug-Ausgaben für viele Systembefehle zum Protokoll hinzu",H1="Ausführliche Protokollausgaben",W1="falls",V1="Assistent",G1={"%s not found":"%s nicht gefunden","()":"()","(at %s)":"(um %s)","(optional)":"(optional)","-":"-",".":".","AI code generator":"KI-Codegenerator",Ack:eN,Actions:tN,"Actual time of day":"Tatsächliche Tageszeit",Add:sN,"Add new script":"Neues Skript hinzufügen",All:oN,"All files will be accepted":"Alle Dateien werden akzeptiert",Any:iN,"Any month":"Jeden Monat",Apply:nN,April:rN,"Are you sure?":"Wirklich sicher?",Ask:aN,Astronomical:lN,"Astronomical events today":"Astronomische Ereignisse heute",August:cN,"Blockly description":"Erstellen von Regeln durch Grafikblöcke","Body:":"Körper:",Cancel:uN,"Cannot delete non empty item!":"Kann nicht gelöscht werden, weil noch einige Elementen darin sind!","Change layout":"Layout ändern",'Change theme (actual "%s")':'Thema ändern (jetzt - "%s")',"Check blocks":"Blöcke prüfen","Check is not active, because javascript adapter is disabled":"Syntax-Check ist nicht aktiv, weil der Javascript Adapter nicht aktiv ist.","Clear search input":"Sucheingabe löschen","Click on this icon":"Auf dieses Symbol klicken",Close:dN,"Close all but current":"Alle anderen außer dem Aktiven schließen","Collapse all":"Alles einklappen","Compares current time with astronomical event":"Vergleicht die aktuelle Zeit mit einem astronomischen Ereignis","Compares current time with the user specific time":"Vergleicht die aktuelle Zeit mit der benutzerspezifischen Zeit","Compares the state value with user defined value":"Vergleicht den Zustandswert mit dem benutzerdefinierten Wert",Condition:hN,Conditions:pN,"Configuration not saved.":"Die Konfiguration ist nicht gespeichert.",Console:gN,"Control or update some state":"Zustand steuern oder aktualisieren","Control or update some state with delay":"Zustand mit Verzögerung steuern oder aktualisieren","Convert blockly to javascript for ever.":"Blockly dauerhaft in Javascript konvertieren.",Copied:mN,"Copy script":"Skript kopieren","Copy to clipboard":"In die Zwischenablage kopieren","Create new":"Neu erstellen","Create new folder":"Neuen Ordner erstellen","Create new script":"Neues Skript erstellen","Create or edit CRON or time wizard":"CRON- oder Zeit-Assistenten erstellen oder bearbeiten","Dark Theme":"Dunkles Thema","Dark style":"Dunkler Stil",Date:"Datum","Debug instance":"Debug-Instanz","Debug options":"Debug-Optionen",December:fN,Default:$N,"Define cron...":"Cron definieren ...","Define schedule...":"Zeitplan definieren ...",Delay:bN,Delete:vN,"Delete %s":"Löschen %s...","Delete folder":"Ordner löschen","Delete script":"Skript löschen",Description:yN,"Deselect all":"Alles abwählen","Discard changes for %s":"Änderungen für %s verwerfen",Done:_N,"Double click to write value":"Doppelklick zum Schreiben des Wertes","Download as file":"Download als Datei","Drop some files here or click...":"Dateien hier ablegen oder klicken ...","Duplicate name":"Doppelter Name","Edit script or just double click":"Skript bearbeiten oder einfach doppelklicken","Empty name is not allowed":"Leerer Name ist nicht zulässig","End search mode":"Suchmodus beenden","Enter your question":"Anfrage eingeben",Error:"Fehler","Error formatting code":"Fehler beim Formatieren des Codes","Error was found":"Fehler wurde gefunden","Every day":"Täglich",Exec:wN,"Executes some shell command":"Führt einen Shell-Befehl aus","Existing scripts will be overwritten.":"Vorhandene Skripte werden überschrieben.","Expand all":"Alle erweitern","Expert mode":"Expertenmodus",Explanation:CN,Export:TN,"Export all scripts":"Alle Skripte exportieren","Export blocks":"Blöcke exportieren","Export selected blocks":"Ausgewählte Blöcke exportieren",Februar:kN,February:SN,Filter:EN,Folder:IN,Fr:xN,Friday:DN,Function:"Funktion","Function editor":"Funktions-Editor","Function: executed":"Funktion: ausgeführt","Go to next line":"Gehe zur nächsten Zeile","HTTP Call":"HTTP-Aufruf","Hide logs":"Protokoll ausblenden",ID:AN,ID1:RN,ID2:ON,Import:MN,"Import blocks":"Blöcke importieren","Import error":"Fehler beim Importieren","Import scripts":"Skripte importieren","Insert object ID":"Objekt-ID einfügen",Instance:NN,"Instance is disabled":"Instanz ist deaktiviert","Instance:":"Instanz:",Instances:LN,Instructions:BN,"Invalid CRON":"Ungültiger CRON","It will not be possible to revert this operation.":"Dieser Vorgang kann nicht rückgängig gemacht werden.","JS description":"Regeln erstellen mit JavaScript",Januar:PN,January:FN,July:jN,June:zN,"Just check":"Einfach überprüfen","Language:":"Sprache:","Learn More":"Mehr erfahren","Light style":"Heller Stil",Limit:UN,"Local time":"Lokale Zeit","Locate file":"Datei zeigen","Log outputs":"Protokoll","Log text":"Protokolltext","Log: %s":"Log: %s","Make a HTTP get request":"Eine HTTP-Abrufanforderung stellen","Make a pause between actions":"Eine Pause zwischen den Aktionen machen",March:HN,"March ":"März ",May:WN,Menu:VN,Message:GN,Mo:KN,Model:YN,Monday:JN,Month:XN,More:qN,Name:ZN,"No Chat GPT Key found":"Kein Chat-GPT-Schlüssel gefunden","No active host found":"Kein aktiver Host gefunden","Nothing found":"Nichts gefunden",November:QN,OK:eL,October:tL,Ok:sL,"On condition change":"Bei Änderung des Ergebnis der Bedingung","On script save or adapter start":"Beim Speichern des Skripts oder beim Starten des Adapters","On weekdays":"An Wochentagen","Open configuration":"Konfiguration öffnen","Operate two states":"Zwei Zustände operieren","Operations with two states":"Operationen mit zwei Zuständen","Paste your blocks here":"Fügen Sie Ihre Blöcke hier ein",Pause:oL,"Pause execution":"Ausführung pausieren","Pause script":"Skript anhalten","Phone:":"Telefon:","Please select object ID...":"Objekt-ID auswählen ...","Press Ctrl+Enter to get the answer":"Strg+Eingabetaste, um die Antwort zu erhalten","Prettify the script":"Verschönern Sie das Skript","Print some text in log":"Einen Text im Protokoll ausdrucken","Priority:":"Priorität:",Pushover:iL,Pushsafer:nL,"Read only ID selected: %s":"Schreibgeschützte ID ausgewählt: %s",Rename:rL,"Reorder scripts in folders":"Skripte in Ordnern neu ordnen",Repeat:aL,Restart:lL,Result:cL,"Resume execution":"Ausführung fortsetzen","Root folder":"Root-Verzeichnis","Rules description":"Regeln erstellen mit WENN-, DANN- und SONST-Blöcken","Run script":"Skript ausführen",Sa:uL,Saturday:dL,Save:hL,"Save all":"Alle speichern","Say It":"Say It","Say some text via sayit adapter":"Einen Text über den Sayit-Adapter sagen",Schedule:pL,Script:gL,"Script %s was modified on disk":'Skript "%s" wurde auf der Festplatte geändert',"Script is not running":"Skript läuft nicht","Search in scripts":"Suche in Skripten","Search...":"Suche...","Select all":"Alles auswählen","Send email":"E-Mail senden","Sends an email":"Sendet eine E-Mail","Sends message via Pushsafer":"Sendet eine Nachricht über Pushsafer","Sends message via pushover":"Sendet eine Nachricht per Pushover","Sends message via telegram":"Sendet eine Nachricht per telegram","Sends message via whatsapp-cmb":"Sendet eine Nachricht über WhatsApp-Cmb",September:mL,"Server time":"Server-Zeit","Set state action":"Zustand setzten","Set with delay":"Setzen mit Verzögerung","Shell command":"Shell-Befehl","Show astronomical events":"Astronomische Ereignisse anzeigen","Show javascript code":"Javascript-Code zeigen","Show logs":"Protokoll anzeigen","Show only paused scripts":"Nur angehaltene Skripte zeigen","Show only running scripts":"Nur laufende Skripte zeigen","Show only scripts with problems":"Nur Skripte mit Problemen zeigen",Simulate:fL,"Some files will be rejected":"Einige Dateien werden abgelehnt","Sound:":"Klang:",Stack:$L,Start:bL,"Start script":"Skript starten",State:vL,"State condition":"Zustandsbedingung","Step into function":"Schritt in die Funktion","Step out from function":"Raus aus der Funktion","Stop on exception":"Bei Ausnahme anhalten",Su:yL,"Subject:":"Gegenstand:",Sunday:_L,"TS description":"Regeln erstellen mit TypeScript",Telegram:wL,"Text:":"Text:",Th:CL,"The script will be stopped and must be activated manually after debugging. Continue?":"Das Skript wird gestoppt und muss nach dem Debuggen manuell aktiviert werden. Fortsetzen?","This is advances option. You can write your own code here and it will be executed on trigger":"Dies ist eine erweiterte Option. Sie können hier Ihren eigenen Code schreiben, der beim Auslösen ausgeführt wird",Thursday:TL,Time:kL,"Time condition":"Zeitbedingung","Title:":"Titel:","To:":"Zu:","Trigger with value":"Trigger mit Wert",Triggered:SL,Triggers:EL,"Triggers the on script saving or the javascript instance restart":"Löst das Speichern des Skripts oder den Neustart der Javascript-Instanz aus","Triggers the rule on update or change of some state":"Löst die Regel beim Aktualisieren oder Ändern eines Zustands aus","Triggers the rule periodically or on some specific time":"Löst periodisch oder zu einem bestimmten Zeitpunkt aus",Tu:IL,Tuesday:xL,URL:DL,"Unknown error":"Unbekannter Fehler","Unknown error!":"Unbekannter Fehler!","Use generated code":"Code verwenden","User function":"Benutzerfunktion","User:":"Benutzer:",Value:AL,"Vibration:":"Vibration:",Volume:RL,We:OL,Wednesday:ML,"Whatsapp-cmb":"WhatsApp-cmb",Write:NL,"Write your own code":"Eigenen Code schreiben",Yes:LL,"Yet exists!":"Existiert schon!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"Sie können %s in der URL verwenden, um den aktuellen Triggerwert zu verwenden, %id, um die ausgelöste Objekt-ID zu verwenden, %name, um den ID-Namen des ausgelösten Objekts anzuzeigen, oder %old, um den alten Triggerwert zu verwenden","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"Sie können %s im Befehl verwenden, um den aktuellen Triggerwert zu verwenden, %id, um die ausgelöste Objekt-ID zu verwenden, %name, um den ID-Namen des ausgelösten Objekts anzuzeigen, oder %old, um den alten Triggerwert zu verwenden","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"Sie können %s im Text verwenden, um den aktuellen Triggerwert anzuzeigen, %id, um die ausgelöste Objekt-ID zu verwenden, %name, um den ID-Namen des ausgelösten Objekts anzuzeigen, oder %old, um den alten Triggerwert zu verwenden","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"Sie können %s im Wert verwenden, um den aktuellen Triggerwert zu verwenden, %id, um die ID des ausgelösten Objekts zu verwenden, %name, um den ID-Namen des ausgelösten Objekts anzuzeigen, oder %old, um den alten Triggerwert zu verwenden","You have to enter OpenAI API key in the configuration of javascript adapter.":"Sie müssen den OpenAI-API-Schlüssel in der Konfiguration des Javascript-Adapters eingeben.","[equal]":"[gleich]","[greater or equal]":"[größer oder gleich]","[greater]":"[größer]","[hysteresis]":"[Hysterese]","[includes]":"[enthält]","[less or equal]":"[kleiner oder gleich]","[less]":"[kleiner]","[not equal]":"[ungleich]",acknowledgment:BL,all:PL,and:FL,astro:jL,at:zL,"clear running":"laufende abbrechen",control:UL,copy:HL,cron:WL,dawn:VL,debug_help:GL,debug_label:KL,default:"Standard",dusk:YL,easy:JL,else:"sonst","equal to":"gleich",every:XL,"every hour at 0 minutes":"jede Stunde bei 0 Minuten",false:"falsch","file reading has failed: %s":"Das Lesen der Datei ist fehlgeschlagen: %s","file reading was aborted":"Das Lesen der Datei wurde abgebrochen",filter_func:qL,filter_id:ZL,filter_name:QL,filter_role:e1,filter_room:t1,"for edit or create script":"zum Bearbeiten oder zum Erstellen eines neues Skripts","for professionals":"für Profis","for programmers":"für Programmierer",goldenHour:s1,goldenHourEnd:o1,"greater or equal":"größer oder gleich","greater or equal to":"größer oder gleich","greater than":"größer als",help_just_check:i1,help_on_change:n1,"high priority":"hohe Priorität","high-priority":"hohe Priorität","highest priority":"höchste Priorität",hours:r1,includes:a1,interval:l1,"just check":"einfach prüfen","less or equal":"kleiner oder gleich","less or equal to":"kleiner oder gleich","less than":"kleiner als","lower priority":"geringere Priorität","lowest priority":"niedrigste Priorität",magic:c1,milliseconds:u1,minutes:d1,ms:h1,nadir:p1,nauticalDawn:g1,nauticalDusk:m1,nextSunrise:f1,nextSunset:$1,night:b1,nightEnd:v1,"no blocks found":"Keine Blöcke gefunden","no group":"KEINE GRUPPE",normal:y1,"normal priority":"normale Priorität","not equal to":"ungleich","not properly connected":"Dieser Block ist mit anderen nicht richtig verbunden.",offset:_1,"on change":"bei Änderung","on condition change":"bei Zustandsänderung","on update":"beim Aktualisieren",one:w1,or:C1,quiet:T1,"reset search":"Suche zurücksetzen",search:k1,seconds:S1,solarNoon:E1,"store in":"speichern in",sunrise:I1,sunriseEnd:x1,sunset:D1,sunsetStart:A1,then:R1,"toggle value":"Wert umschalten",tooltip_ack:O1,tooltip_from:M1,tooltip_lc:N1,tooltip_quality:L1,tooltip_ts:B1,tooltip_user:P1,tooltip_value:F1,true:"wahr",two:j1,undefined:"nicht definiert",update:z1,"use seconds":"Sekunden verwenden","use trigger value":"Triggerwert benutzen",verbose_help:U1,verbose_label:H1,when:W1,with:"mit","with date":"mit Datum","with offset":"mit Versatz",wizard:V1},K1="Admitido",Y1="Comportamiento",J1="Añadir",X1="Todos",q1="Alguna",Z1="Apply",Q1="abril",eB="Preguntar",tB="Astronómico",sB="agosto",oB="Cancelar",iB="Cerrar",nB="Condición",rB="Condiciones",aB="Consola",lB="Copiado",cB="diciembre",uB="Defecto",dB="Demora",hB="Eliminar",pB="Descripción",gB="Hecho",mB="Ejecutivo shell",fB="Explicación",$B="Exportar",bB="Februar",vB="febrero",yB="Filtrar",_B="Carpeta",wB="P.",CB="viernes",TB="CARNÉ DE IDENTIDAD",kB="ID1",SB="ID2",EB="Importar",IB="Ejemplo",xB="Instancias",DB="Instrucciones",AB="Enero",RB="enero",OB="julio",MB="junio",NB="Límite",LB="marzo",BB="Mayo",PB="Menú",FB="Mensaje",jB="Mes",zB="Modelo",UB="lunes",HB="Mes",WB="Más",VB="Nombre",GB="noviembre",KB="OK",YB="octubre",JB="Okay",XB="Pausa",qB="Persona fácil de convencer",ZB="Pushsafer",QB="Rebautizar",eP="Repetir",tP="Reiniciar",sP="Resultado",oP="Sa",iP="sábado",nP="Salvar",rP="Calendario",aP="Guión",lP="septiembre",cP="Simular",uP="Stack",dP="Comienzo",hP="Expresar",pP="Su",gP="domingo",mP="Telegrama",fP="4",$P="jueves",bP="Tiempo",vP="Motivado",yP="Disparadores",_P="Tu",wP="martes",CP="URL",TP="Valor",kP="Volumen",SP="3",EP="miércoles",IP="Escribir",xP="sí",DP="Reconocimiento",AP="todos",RP="y",OP="astro",MP="a",NP="control",LP="Copiar",BP="CRON",PP="Amanecer",FP="Este es un modo especial en el que los estados y los objetos no cambiarán. Pero solo se mostrará información sobre cada cambio planificado en el protocolo.",jP="Depurar",zP="Oscuridad",UP="fácil",HP="cada",WP="Función",VP="CARNÉ DE IDENTIDAD",GP="Nombre",KP="Papel",YP="Habitación",JP="hora dorada",XP="Fin de la hora dorada",qP='El código se ejecutará solo cada vez que la condición sea verdadera. P.ej. si se activa en el valor del sensor de temperatura y la condición es "si la temperatura es superior a 20 ° C", las acciones "entonces" se ejecutarán cada vez que el sensor envíe la temperatura y supere los 20 ° C. Por 21 ° C, por 22 ° C y así sucesivamente.',ZP='El código se ejecutará solo si cambia el resultado de la condición. P.ej. si se activa en el valor del sensor de temperatura y la condición es "si la temperatura es superior a 20 ° C", las acciones "entonces" se ejecutarán una vez cuando la temperatura sea superior a 20. La próxima vez, las acciones "entonces" se ejecutarán cuando la temperatura falla por debajo de 20 y luego sube por encima de 20 nuevamente.',QP="horas",eF="incluye",tF="intervalo",sF="magia",oF="milisegundos",iF="minutos",nF="ms",rF="nadir",aF="Amanecer náutico",lF="Atardecer náutico",cF="próximo amanecer",uF="Próxima puesta de sol",dF="Noche",hF="Fin de la noche",pF="normal",gF="compensar",mF="uno",fF="o",$F="tranquilo",bF="buscar",vF="segundos",yF="Mediodía solar",_F="amanecer",wF="Final del amanecer",CF="puesta de sol",TF="Inicio al atardecer",kF="entonces",SF="Reconocer",EF="De",IF="Último cambio",xF="Calidad",DF="Marca de tiempo",AF="Usuario",RF="Valor",OF="dos",MF="actualizar",NF="Agrega salida de depuración al registro para muchos comandos del sistema",LF="Salidas de registro detalladas",BF="cuando",PF="Wizard",FF={"%s not found":"%s no encontrado","()":"()","(at %s)":"(en %s)","(optional)":"(Opcional)","-":"-",".":".","AI code generator":"Generador de código de IA",Ack:K1,Actions:Y1,"Actual time of day":"Hora real del día",Add:J1,"Add new script":"Agregar nuevo script",All:X1,"All files will be accepted":"Todos los archivos serán aceptados.",Any:q1,"Any month":"Cualquier mes",Apply:Z1,April:Q1,"Are you sure?":"¿Estás seguro?",Ask:eB,Astronomical:tB,"Astronomical events today":"Eventos astronómicos hoy",August:sB,"Blockly description":"Crear reglas por bloques gráficos","Body:":"Cuerpo:",Cancel:oB,"Cannot delete non empty item!":"¡No se puede eliminar un elemento no vacío!","Change layout":"Cambia el diseño",'Change theme (actual "%s")':'Cambiar tema (ahora - "%s")',"Check blocks":"Comprobar bloques","Check is not active, because javascript adapter is disabled":"La comprobación no está activa porque el adaptador Javascript está desactivado","Clear search input":"Borrar entrada de búsqueda","Click on this icon":"Haga clic en este ícono",Close:iB,"Close all but current":"Cerrar todo menos el actual","Collapse all":"Desplegar todo","Compares current time with astronomical event":"Compara la hora actual con un evento astronómico","Compares current time with the user specific time":"Compara la hora actual con la hora específica del usuario","Compares the state value with user defined value":"Compara el valor del estado con el valor definido por el usuario",Condition:nB,Conditions:rB,"Configuration not saved.":"Configuración no guardada.",Console:aB,"Control or update some state":"Controlar o actualizar algún estado","Control or update some state with delay":"Controlar o actualizar algún estado con retraso","Convert blockly to javascript for ever.":"Convierta instantáneamente en bloque a Javascript.",Copied:lB,"Copy script":"Copiar guion","Copy to clipboard":"Copiar al portapapeles","Create new":"Crear nuevo","Create new folder":"Crear nueva carpeta","Create new script":"Crear nuevo script","Create or edit CRON or time wizard":"Crear o editar CRON o asistente de tiempo","Dark Theme":"Tema oscuro","Dark style":"Estilo oscuro",Date:"Fecha","Debug instance":"Instancia de depuración","Debug options":"Opciones de depuración",December:cB,Default:uB,"Define cron...":"Definir cron ...","Define schedule...":"Definir horario ...",Delay:dB,Delete:hB,"Delete %s":"Eliminar %s ...","Delete folder":"Eliminar carpeta","Delete script":"Eliminar guión",Description:pB,"Deselect all":"Deseleccionar todo","Discard changes for %s":"Descartar cambios para %s",Done:gB,"Double click to write value":"Doble clic para escribir el valor","Download as file":"Descargar como archivo","Drop some files here or click...":"Suelta algunos archivos aquí o haz clic ...","Duplicate name":"Nombre duplicado","Edit script or just double click":"Editar guión o simplemente hacer doble clic","Empty name is not allowed":"No se permite el nombre vacío","End search mode":"Fin del modo de búsqueda","Enter your question":"Ingrese su solicitud",Error:"Error","Error formatting code":"Código de formato de error","Error was found":"Error encontrado","Every day":"Diario",Exec:mB,"Executes some shell command":"Ejecuta algún comando de shell","Existing scripts will be overwritten.":"Los guiones existentes se sobrescribirán.","Expand all":"Expandir todo","Expert mode":"Modo experto",Explanation:fB,Export:$B,"Export all scripts":"Exportar todos los scripts","Export blocks":"Exportar bloques","Export selected blocks":"Exportar bloques seleccionados",Februar:bB,February:vB,Filter:yB,Folder:_B,Fr:wB,Friday:CB,Function:"Función","Function editor":"Editor de funciones","Function: executed":"Función: ejecutada","Go to next line":"Ir a la siguiente línea","HTTP Call":"Llamada HTTP","Hide logs":"Ocultar registros",ID:TB,ID1:kB,ID2:SB,Import:EB,"Import blocks":"Importar bloques","Import error":"Error de importación","Import scripts":"Importar guiones","Insert object ID":"Insertar ID de objeto",Instance:IB,"Instance is disabled":"La instancia está deshabilitada","Instance:":"Ejemplo:",Instances:xB,Instructions:DB,"Invalid CRON":"CRON inválido","It will not be possible to revert this operation.":"No será posible revertir esta operación.","JS description":"Crear reglas escribiendo Javascript",Januar:AB,January:RB,July:OB,June:MB,"Just check":"Sólo revisa","Language:":"Idioma:","Learn More":"Aprende más","Light style":"Estilo ligero",Limit:NB,"Local time":"Hora local","Locate file":"Localizar el archivo","Log outputs":"Salidas de registro","Log text":"Texto de registro","Log: %s":"Log: %s","Make a HTTP get request":"Realizar una solicitud de obtención HTTP","Make a pause between actions":"Hacer una pausa entre acciones",March:LB,"March ":"marzo",May:BB,Menu:PB,Message:FB,Mo:jB,Model:zB,Monday:UB,Month:HB,More:WB,Name:VB,"No Chat GPT Key found":"No se ha encontrado ninguna clave GPT de chat","No active host found":"No se encontró un host activo","Nothing found":"Nada Encontrado",November:GB,OK:KB,October:YB,Ok:JB,"On condition change":"En condición de cambio","On script save or adapter start":"Al guardar el script o al iniciar el adaptador","On weekdays":"De lunes a viernes","Open configuration":"Configuración abierta","Operate two states":"Operar dos estados","Operations with two states":"Operaciones con dos estados","Paste your blocks here":"Pega tus bloques aquí",Pause:XB,"Pause execution":"Pausar ejecución","Pause script":"Pausar guion","Phone:":"Teléfono:","Please select object ID...":"Por favor, seleccione la ID del objeto ...","Press Ctrl+Enter to get the answer":"Presiona Ctrl+Enter para obtener la respuesta","Prettify the script":"Embellecer el guión","Print some text in log":"Imprime texto en el registro","Priority:":"Prioridad:",Pushover:qB,Pushsafer:ZB,"Read only ID selected: %s":"ID de solo lectura seleccionado: %s",Rename:QB,"Reorder scripts in folders":"Reordenar guiones en carpetas",Repeat:eP,Restart:tP,Result:sP,"Resume execution":"Reanudar ejecución","Root folder":"Carpeta raíz","Rules description":"Crea reglas con bloques IF, THEN, ELSE","Run script":"Ejecutar guión",Sa:oP,Saturday:iP,Save:nP,"Save all":"Salvar a todos","Say It":"Say It","Say some text via sayit adapter":"Di un mensaje de texto a través del adaptador sayit",Schedule:rP,Script:aP,"Script %s was modified on disk":"El script %s fue modificado en el disco","Script is not running":"El script no se está ejecutando","Search in scripts":"Buscar en guiones","Search...":"Buscar...","Select all":"Seleccionar todo","Send email":"Enviar correo electrónico","Sends an email":"Envía un correo electrónico","Sends message via Pushsafer":"Envía mensaje a través de Pushsafer","Sends message via pushover":"Envía un mensaje a través de un pushover","Sends message via telegram":"Envía mensaje por telegrama","Sends message via whatsapp-cmb":"Envía mensaje vía whatsapp-cmb",September:lP,"Server time":"Tiempo del servidor","Set state action":"Establecer acción estatal","Set with delay":"Establecer con retraso","Shell command":"Comando de Shell","Show astronomical events":"Mostrar eventos astronómicos","Show javascript code":"Mostrar código Javascript","Show logs":"Mostrar registros","Show only paused scripts":"Mostrar solo secuencias de comandos pausadas","Show only running scripts":"Mostrar solo scripts en ejecución","Show only scripts with problems":"Mostrar solo guiones con problemas",Simulate:cP,"Some files will be rejected":"Algunos archivos serán rechazados","Sound:":"Sonido:",Stack:uP,Start:dP,"Start script":"Iniciar guion",State:hP,"State condition":"Condición del estado","Step into function":"Entra en función","Step out from function":"Sal de la función","Stop on exception":"Deténgase en excepción",Su:pP,"Subject:":"Sujeto:",Sunday:gP,"TS description":"Crear reglas escribiendo el mecanografiado",Telegram:mP,"Text:":"Texto:",Th:fP,"The script will be stopped and must be activated manually after debugging. Continue?":"El script se detendrá y deberá activarse manualmente después de la depuración. ¿Continuar?","This is advances option. You can write your own code here and it will be executed on trigger":"Esta es la opción de avances. Puede escribir su propio código aquí y se ejecutará en el disparador",Thursday:$P,Time:bP,"Time condition":"Condición de tiempo","Title:":"Título:","To:":"A:","Trigger with value":"Activar con valor",Triggered:vP,Triggers:yP,"Triggers the on script saving or the javascript instance restart":"Activa el guardado de la secuencia de comandos o el reinicio de la instancia de JavaScript","Triggers the rule on update or change of some state":"Activa la regla de actualización o cambio de algún estado","Triggers the rule periodically or on some specific time":"Activa la regla periódicamente o en un momento específico",Tu:_P,Tuesday:wP,URL:CP,"Unknown error":"Error desconocido","Unknown error!":"¡Error desconocido!","Use generated code":"Usar código generado","User function":"Función de usuario","User:":"Usuario:",Value:TP,"Vibration:":"Vibración:",Volume:kP,We:SP,Wednesday:EP,"Whatsapp-cmb":"Whatsapp-cmb",Write:IP,"Write your own code":"Escribe tu propio código",Yes:xP,"Yet exists!":"¡Sin embargo existe!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"Puede usar %s en la URL para usar el valor de activación actual, %id para usar el ID de objeto activado, %name para mostrar el nombre de ID de objeto activado o %old para usar el valor de activación antiguo","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"Puede usar %s en el comando para usar el valor de activación actual, %id para usar el ID de objeto activado, %name para mostrar el nombre de ID de objeto activado o %old para usar el valor de activación anterior","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"Puede usar %s en el texto para mostrar el valor de activación actual, %id para usar el ID de objeto activado, %name para mostrar el nombre de ID de objeto activado o %old para usar el valor de activación antiguo","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"Puede usar %s en el valor para usar el valor de activación actual, %id para usar el ID de objeto activado, %name para mostrar el nombre de ID de objeto activado o %old para usar el valor de activación antiguo","You have to enter OpenAI API key in the configuration of javascript adapter.":"Debe ingresar la clave API de OpenAI en la configuración del adaptador de JavaScript.","[equal]":"[igual]","[greater or equal]":"[mayor o igual]","[greater]":"[mayor que]","[hysteresis]":"[histéresis]","[includes]":"[incluye]","[less or equal]":"[menor o igual]","[less]":"[menos]","[not equal]":"[no es igual]",acknowledgment:DP,all:AP,and:RP,astro:OP,at:MP,"clear running":"carrera clara",control:NP,copy:LP,cron:BP,dawn:PP,debug_help:FP,debug_label:jP,default:"defecto",dusk:zP,easy:UP,else:"demás","equal to":"igual a",every:HP,"every hour at 0 minutes":"cada hora a los 0 minutos",false:"falso","file reading has failed: %s":"la lectura del archivo ha fallado: %s","file reading was aborted":"la lectura del archivo fue abortada",filter_func:WP,filter_id:VP,filter_name:GP,filter_role:KP,filter_room:YP,"for edit or create script":"para editar o crear un nuevo script","for professionals":"para profesionales","for programmers":"para programadores",goldenHour:JP,goldenHourEnd:XP,"greater or equal":"mayor o igual","greater or equal to":"mayor o igual a","greater than":"mas grande que",help_just_check:qP,help_on_change:ZP,"high priority":"alta prioridad","high-priority":"alta prioridad","highest priority":"más alta prioridad",hours:QP,includes:eF,interval:tF,"just check":"Sólo revisa","less or equal":"menor o igual","less or equal to":"menor o igual a","less than":"menos que","lower priority":"prioridad más baja","lowest priority":"prioridad más baja",magic:sF,milliseconds:oF,minutes:iF,ms:nF,nadir:rF,nauticalDawn:aF,nauticalDusk:lF,nextSunrise:cF,nextSunset:uF,night:dF,nightEnd:hF,"no blocks found":"No se encontraron bloques","no group":"NO GRUPO",normal:pF,"normal priority":"prioridad normal","not equal to":"no igual a","not properly connected":"Este bloque no está conectado correctamente a otros bloques.",offset:gF,"on change":"en el cambio","on condition change":"con cambio de condición","on update":"en actualización",one:mF,or:fF,quiet:$F,"reset search":"restablecer la búsqueda",search:bF,seconds:vF,solarNoon:yF,"store in":"almacenar en",sunrise:_F,sunriseEnd:wF,sunset:CF,sunsetStart:TF,then:kF,"toggle value":"alternar valor",tooltip_ack:SF,tooltip_from:EF,tooltip_lc:IF,tooltip_quality:xF,tooltip_ts:DF,tooltip_user:AF,tooltip_value:RF,true:"cierto",two:OF,undefined:"indefinido",update:MF,"use seconds":"usar segundos","use trigger value":"usar valor de activación",verbose_help:NF,verbose_label:LF,when:BF,with:"con","with date":"con fecha","with offset":"con desplazamiento",wizard:PF},jF="Reconnu",zF="Actions",UF="Ajouter",HF="Tout",WF="Tout",VF="Postuler",GF="avril",KF="Demander",YF="Astronomique",JF="août",XF="Annuler",qF="proche",ZF="État",QF="Conditions",ej="Console",tj="Copié",sj="décembre",oj="Défaut",ij="Retard",nj="Effacer",rj="Description",aj="Terminé",lj="Exec shell",cj="Explication",uj="Exportation",dj="Février",hj="février",pj="Filtre",gj="Dossier",mj="Fr",fj="Vendredi",$j="ID",bj="ID1",vj="ID2",yj="Importation",_j="Exemple",wj="Instances",Cj="Instructions",Tj="Janvier",kj="janvier",Sj="juillet",Ej="juin",Ij="Limite",xj="Mars",Dj="Mai",Aj="M e n u",Rj="Message",Oj="Mo",Mj="Modèle",Nj="Lundi",Lj="Mois",Bj="Plus",Pj="Nom",Fj="novembre",jj="OK",zj="octobre",Uj="D'accord",Hj="Pause",Wj="Pushover",Vj="Pushsafer",Gj="Renommer",Kj="Répéter",Yj="Redémarrer",Jj="Résultat",Xj="Sa",qj="samedi",Zj="sauver",Qj="Horaire",e2="Scénario",t2="septembre",s2="Simuler",o2="Stack",i2="Début",n2="État",r2="Su",a2="dimanche",l2="Télégramme",c2="4",u2="Jeudi",d2="Temps",h2="Déclenché",p2="Déclencheurs",g2="Tu",m2="Mardi",f2="URL",$2="Valeur",b2="Le volume",v2="3",y2="Mercredi",_2="Écrivez",w2="Oui",C2="reconnaissance",T2="tout",k2="et",S2="astro",E2="à",I2="contrôler",x2="copie",D2="CRON",A2="Aube",R2="Il s'agit d'un mode spécial dans lequel les états et les objets ne changeront pas. Mais seules les informations sur chaque changement prévu seront affichées dans le protocole.",O2="Déboguer",M2="Crépuscule",N2="facile",L2="chaque",B2="Une fonction",P2="ID",F2="Nom",j2="Rôle",z2="Pièce",U2="Heure d'or",H2="Fin de l'heure d'or",W2="Le code ne sera exécuté que chaque fois que la condition est vraie. Par exemple. si déclenchement sur la valeur du capteur de température et que la condition est «si la température est supérieure à 20 ° C», les actions «alors» seront exécutées à chaque fois que le capteur envoie la température et qu'elle est supérieure à 20 ° C. À 21 ° C, à 22 ° C et ainsi de suite.",V2="Le code ne sera exécuté que si le résultat de la condition change. Par exemple. si le déclenchement sur la valeur du capteur de température et que la condition est «si la température est supérieure à 20 ° C», les actions «alors» seront exécutées une fois lorsque la température est supérieure à 20. La prochaine fois, les actions «alors» seront exécutées lorsque la température échoue sous 20 puis remonte au-dessus de 20.",G2="les heures",K2="comprend",Y2="intervalle",J2="la magie",X2="millisecondes",q2="minutes",Z2="ms",Q2="nadir",ez="Aube nautique",tz="Crépuscule nautique",sz="Prochain lever de soleil",oz="Prochain coucher de soleil",iz="Nuit",nz="Fin de nuit",rz="Ordinaire",az="décalage",lz="une",cz="ou",uz="calmer",dz="chercher",hz="secondes",pz="Midi solaire",gz="lever du soleil",mz="Fin du lever du soleil",fz="le coucher du soleil",$z="Début du coucher du soleil",bz="alors",vz="Reconnaître",yz="De",_z="Dernière modification",wz="Qualité",Cz="Horodatage",Tz="Utilisateur",kz="Valeur",Sz="deux",Ez="mettre à jour",Iz="Ajoute une sortie de débogage au journal pour de nombreuses commandes système",xz="Sorties de journal détaillées",Dz="lorsque",Az="Wizard",Rz={"%s not found":"%s non trouvé","()":"()","(at %s)":"(à %s)","(optional)":"(optionnel)","-":"-",".":".","AI code generator":"Générateur de code IA",Ack:jF,Actions:zF,"Actual time of day":"Heure réelle de la journée",Add:UF,"Add new script":"Ajouter un nouveau script",All:HF,"All files will be accepted":"Tous les fichiers seront acceptés",Any:WF,"Any month":"N'importe quel mois",Apply:VF,April:GF,"Are you sure?":"Êtes-vous sûr?",Ask:KF,Astronomical:YF,"Astronomical events today":"Événements astronomiques aujourd'hui",August:JF,"Blockly description":"Création de règles par blocs graphiques","Body:":"Corps:",Cancel:XF,"Cannot delete non empty item!":"Impossible de supprimer un élément non vide!","Change layout":"Changer la disposition",'Change theme (actual "%s")':'Changer de thème (maintenant - "%s")',"Check blocks":"Vérifier les blocs","Check is not active, because javascript adapter is disabled":"La vérification n'est pas active, car l'adaptateur Javascript est désactivé","Clear search input":"Effacer la recherche","Click on this icon":"Cliquez sur cette icône",Close:qF,"Close all but current":"Ferme tout sauf courant","Collapse all":"Réduire tout","Compares current time with astronomical event":"Compare l'heure actuelle avec un événement astronomique","Compares current time with the user specific time":"Compare l'heure actuelle avec l'heure spécifique de l'utilisateur","Compares the state value with user defined value":"Compare la valeur d'état avec la valeur définie par l'utilisateur",Condition:ZF,Conditions:QF,"Configuration not saved.":"Configuration non enregistrée.",Console:ej,"Control or update some state":"Contrôler ou mettre à jour un état","Control or update some state with delay":"Contrôler ou mettre à jour un état avec un délai","Convert blockly to javascript for ever.":"Convertissez instantanément en Javascript.",Copied:tj,"Copy script":"Copier le script","Copy to clipboard":"Copier dans le presse-papier","Create new":"Créer un nouveau","Create new folder":"Créer un nouveau dossier","Create new script":"Créer un nouveau script","Create or edit CRON or time wizard":"Créer ou éditer CRON ou un assistant de temps","Dark Theme":"Thème sombre","Dark style":"Style sombre",Date:"Date","Debug instance":"Instance de débogage","Debug options":"Options de débogage",December:sj,Default:oj,"Define cron...":"Définir le cron ...","Define schedule...":"Définir le calendrier ...",Delay:ij,Delete:nj,"Delete %s":"Supprimer %s ...","Delete folder":"Supprimer le dossier","Delete script":"Supprimer le script",Description:rj,"Deselect all":"Tout déselectionner","Discard changes for %s":"Ignorer les modifications pour %s",Done:aj,"Double click to write value":"Double clic pour écrire la valeur","Download as file":"Télécharger le fichier","Drop some files here or click...":"Déposer des fichiers ici ou cliquez sur ...","Duplicate name":"Nom en double","Edit script or just double click":"Modifiez le script ou double-cliquez simplement sur","Empty name is not allowed":"Le nom vide n'est pas autorisé","End search mode":"Fin du mode de recherche","Enter your question":"Entrez votre demande",Error:"Erreur","Error formatting code":"Erreur lors du formatage du code","Error was found":"Une erreur a été trouvée","Every day":"Tous les jours",Exec:lj,"Executes some shell command":"Exécute une commande shell","Existing scripts will be overwritten.":"Les scripts existants seront écrasés.","Expand all":"Développer tout","Expert mode":"Mode expert",Explanation:cj,Export:uj,"Export all scripts":"Exporter tous les scripts","Export blocks":"Blocs d'exportation","Export selected blocks":"Exporter les blocs sélectionnés",Februar:dj,February:hj,Filter:pj,Folder:gj,Fr:mj,Friday:fj,Function:"Fonction","Function editor":"Éditeur de fonction","Function: executed":"Fonction : exécutée","Go to next line":"Aller à la ligne suivante","HTTP Call":"Appel HTTP","Hide logs":"Masquer les journaux",ID:$j,ID1:bj,ID2:vj,Import:yj,"Import blocks":"Blocs d'importation","Import error":"Erreur d'importation","Import scripts":"Importer des scripts","Insert object ID":"Insérer un identifiant d'objet",Instance:_j,"Instance is disabled":"L'instance est désactivée","Instance:":"Exemple:",Instances:wj,Instructions:Cj,"Invalid CRON":"CRON invalide","It will not be possible to revert this operation.":"Il ne sera pas possible de revenir sur cette opération.","JS description":"Créer des règles en écrivant du Javascript",Januar:Tj,January:kj,July:Sj,June:Ej,"Just check":"Vérifiez simplement","Language:":"Langue:","Learn More":"Apprendre encore plus","Light style":"Style de lumière",Limit:Ij,"Local time":"Heure locale","Locate file":"Localiser le fichier","Log outputs":"Journal des sorties","Log text":"Texte du journal","Log: %s":"Log : %s","Make a HTTP get request":"Faire une requête HTTP Get","Make a pause between actions":"Faites une pause entre les actions",March:xj,"March ":"mars",May:Dj,Menu:Aj,Message:Rj,Mo:Oj,Model:Mj,Monday:Nj,Month:Lj,More:Bj,Name:Pj,"No Chat GPT Key found":"Aucune clé GPT de chat trouvée","No active host found":"Aucun hôte actif trouvé","Nothing found":"Rien n'a été trouvé",November:Fj,OK:jj,October:zj,Ok:Uj,"On condition change":"En cas de changement de condition","On script save or adapter start":"Lors de l'enregistrement du script ou du démarrage de l'adaptateur","On weekdays":"En semaine","Open configuration":"Configuration ouverte","Operate two states":"Opérer deux états","Operations with two states":"Opérations à deux états","Paste your blocks here":"Collez vos blocs ici",Pause:Hj,"Pause execution":"Suspendre l'exécution","Pause script":"Script de pause","Phone:":"Téléphone:","Please select object ID...":"Veuillez sélectionner l'ID d'objet ...","Press Ctrl+Enter to get the answer":"Appuyez sur Ctrl+Entrée pour obtenir la réponse","Prettify the script":"Embellir le scénario","Print some text in log":"Imprimer du texte dans le journal","Priority:":"Priorité:",Pushover:Wj,Pushsafer:Vj,"Read only ID selected: %s":"ID en lecture seule sélectionné: %s",Rename:Gj,"Reorder scripts in folders":"Réorganiser les scripts dans des dossiers",Repeat:Kj,Restart:Yj,Result:Jj,"Resume execution":"Reprendre l'exécution","Root folder":"Dossier racine","Rules description":"Créer des règles avec des blocs IF, THEN, ELSE","Run script":"Script de lancement",Sa:Xj,Saturday:qj,Save:Zj,"Save all":"Sauver tous","Say It":"Say It","Say some text via sayit adapter":"Dites du texte via l'adaptateur sayit",Schedule:Qj,Script:e2,"Script %s was modified on disk":"Le script %s a été modifié sur le disque","Script is not running":"Le script n'est pas en cours d'exécution","Search in scripts":"Rechercher dans les scripts","Search...":"Chercher...","Select all":"Tout sélectionner","Send email":"Envoyer un e-mail","Sends an email":"Envoie un e-mail","Sends message via Pushsafer":"Envoie un message via Pushsafer","Sends message via pushover":"Envoie un message via pushover","Sends message via telegram":"Envoie un message par télégramme","Sends message via whatsapp-cmb":"Envoie un message via whatsapp-cmb",September:t2,"Server time":"Heure du serveur","Set state action":"Définir l'action de l'état","Set with delay":"Set avec retard","Shell command":"Commande Shell","Show astronomical events":"Afficher les événements astronomiques","Show javascript code":"Afficher le code Javascript","Show logs":"Afficher les journaux","Show only paused scripts":"Afficher uniquement les scripts en pause","Show only running scripts":"Afficher uniquement les scripts en cours d'exécution","Show only scripts with problems":"Afficher uniquement les scripts avec des problèmes",Simulate:s2,"Some files will be rejected":"Certains fichiers seront rejetés","Sound:":"Sonner:",Stack:o2,Start:i2,"Start script":"Lancer le script",State:n2,"State condition":"État condition","Step into function":"Entrez dans la fonction","Step out from function":"Sortez de la fonction","Stop on exception":"Arrêt sur exception",Su:r2,"Subject:":"Sujet:",Sunday:a2,"TS description":"Créer des règles en écrivant des caractères dactylographiés",Telegram:l2,"Text:":"Texte:",Th:c2,"The script will be stopped and must be activated manually after debugging. Continue?":"Le script sera arrêté et doit être activé manuellement après le débogage. Continuez?","This is advances option. You can write your own code here and it will be executed on trigger":"C'est une option avancée. Vous pouvez écrire votre propre code ici et il sera exécuté au déclenchement",Thursday:u2,Time:d2,"Time condition":"Condition de temps","Title:":"Titre:","To:":"À:","Trigger with value":"Déclencheur avec valeur",Triggered:h2,Triggers:p2,"Triggers the on script saving or the javascript instance restart":"Déclenche l'enregistrement du script ou le redémarrage de l'instance javascript","Triggers the rule on update or change of some state":"Déclenche la règle sur la mise à jour ou le changement d'un état","Triggers the rule periodically or on some specific time":"Déclenche la règle périodiquement ou à une heure précise",Tu:g2,Tuesday:m2,URL:f2,"Unknown error":"Erreur inconnue","Unknown error!":"Erreur inconnue!","Use generated code":"Utiliser le code généré","User function":"Fonction utilisateur","User:":"Utilisateur:",Value:$2,"Vibration:":"Vibration:",Volume:b2,We:v2,Wednesday:y2,"Whatsapp-cmb":"Whatsapp-cmb",Write:_2,"Write your own code":"Écrivez votre propre code",Yes:w2,"Yet exists!":"Pourtant existe!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"Vous pouvez utiliser %s dans l'URL pour utiliser la valeur de déclenchement actuelle, %id pour utiliser l'ID de l'objet déclenché, %name pour afficher le nom de l'ID de l'objet déclenché ou %old pour utiliser l'ancienne valeur de déclenchement","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"Vous pouvez utiliser %s dans la commande pour utiliser la valeur de déclenchement actuelle, %id pour utiliser l'ID de l'objet déclenché, %name pour afficher le nom de l'ID de l'objet déclenché ou %old pour utiliser l'ancienne valeur de déclenchement","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"Vous pouvez utiliser %s dans le texte pour afficher la valeur de déclenchement actuelle, %id pour utiliser l'ID de l'objet déclenché, %name pour afficher le nom de l'ID de l'objet déclenché ou %old pour utiliser l'ancienne valeur de déclenchement","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"Vous pouvez utiliser %s dans la valeur pour utiliser la valeur de déclenchement actuelle, %id pour utiliser l'ID de l'objet déclenché, %name pour afficher le nom de l'ID de l'objet déclenché ou %old pour utiliser l'ancienne valeur de déclenchement","You have to enter OpenAI API key in the configuration of javascript adapter.":"Vous devez entrer la clé API OpenAI dans la configuration de l'adaptateur javascript.","[equal]":"[égal]","[greater or equal]":"[supérieur ou égal]","[greater]":"[plus grand]","[hysteresis]":"[hystérèse]","[includes]":"[comprend]","[less or equal]":"[inférieur ou égal]","[less]":"[moins]","[not equal]":"[inégal]",acknowledgment:C2,all:T2,and:k2,astro:S2,at:E2,"clear running":"course claire",control:I2,copy:x2,cron:D2,dawn:A2,debug_help:R2,debug_label:O2,default:"défaut",dusk:M2,easy:N2,else:"autre","equal to":"égal à",every:L2,"every hour at 0 minutes":"toutes les heures à 0 minute",false:"faux","file reading has failed: %s":"La lecture du fichier a échoué: %s","file reading was aborted":"la lecture du fichier a été abandonnée",filter_func:B2,filter_id:P2,filter_name:F2,filter_role:j2,filter_room:z2,"for edit or create script":"pour éditer ou créer un nouveau script","for professionals":"pour les professionnels","for programmers":"pour les programmeurs",goldenHour:U2,goldenHourEnd:H2,"greater or equal":"supérieur ou égal","greater or equal to":"supérieur ou égal à","greater than":"plus grand que",help_just_check:W2,help_on_change:V2,"high priority":"haute priorité","high-priority":"haute priorité","highest priority":"priorité la plus élevée",hours:G2,includes:K2,interval:Y2,"just check":"Vérifiez simplement","less or equal":"inférieur ou égal","less or equal to":"inférieur ou égal à","less than":"moins que","lower priority":"priorité inférieure","lowest priority":"priorité la plus basse",magic:J2,milliseconds:X2,minutes:q2,ms:Z2,nadir:Q2,nauticalDawn:ez,nauticalDusk:tz,nextSunrise:sz,nextSunset:oz,night:iz,nightEnd:nz,"no blocks found":"Aucun bloc trouvé","no group":"PAS DE GROUPE",normal:rz,"normal priority":"priorité normale","not equal to":"pas égal à","not properly connected":"Ce bloc n'est pas correctement connecté à d'autres blocs.",offset:az,"on change":"sur le changement","on condition change":"sur changement de condition","on update":"sur mise à jour",one:lz,or:cz,quiet:uz,"reset search":"Réinitialiser la recherche",search:dz,seconds:hz,solarNoon:pz,"store in":"stocker dans",sunrise:gz,sunriseEnd:mz,sunset:fz,sunsetStart:$z,then:bz,"toggle value":"valeur de bascule",tooltip_ack:vz,tooltip_from:yz,tooltip_lc:_z,tooltip_quality:wz,tooltip_ts:Cz,tooltip_user:Tz,tooltip_value:kz,true:"vrai",two:Sz,undefined:"indéfini",update:Ez,"use seconds":"utiliser les secondes","use trigger value":"use trigger value",verbose_help:Iz,verbose_label:xz,when:Dz,with:"avec","with date":"avec date","with offset":"avec offset",wizard:Az},Oz="Riconosciuto",Mz="Azioni",Nz="Inserisci",Lz="Tutti",Bz="Qualunque",Pz="Applica",Fz="aprile",jz="Chiedere",zz="Astronomico",Uz="agosto",Hz="Annulla",Wz="Vicino",Vz="Condizione",Gz="Condizioni",Kz="Console",Yz="Copiato",Jz="dicembre",Xz="Predefinito",qz="Ritardo",Zz="Elimina",Qz="Descrizione",eU="Fatto",tU="Execshell",sU="Spiegazione",oU="Esportare",iU="Februar",nU="febbraio",rU="Filtro",aU="Cartella",lU="P",cU="Venerdì",uU="ID",dU="ID1",hU="ID2",pU="Importare",gU="Esempio",mU="istanze",fU="Istruzioni",$U="Januar",bU="gennaio",vU="luglio",yU="giugno",_U="Limite",wU="marzo",CU="Maggio",TU="Menu",kU="Messaggio",SU="Mo",EU="Modello",IU="Lunedi",xU="Mese",DU="Di più",AU="Nome",RU="novembre",OU="OK",MU="ottobre",NU="Ok",LU="Pausa",BU="Pushover",PU="Pushsafer",FU="Rinominare",jU="Ripetere",zU="Ricomincia",UU="Risultato",HU="Sa",WU="Sabato",VU="Salva",GU="Programma",KU="copione",YU="settembre",JU="Simulare",XU="Stack",qU="Cominciare",ZU="Stato",QU="Su",eH="Domenica",tH="Telegramma",sH="4",oH="giovedi",iH="Tempo",nH="Innescato",rH="Trigger",aH="Tu",lH="martedì",cH="URL",uH="Valore",dH="Volume",hH="3",pH="mercoledì",gH="Scrivi",mH="sì",fH="riconoscimento",$H="tutti",bH="e",vH="astro",yH="a",_H="controllo",wH="copia",CH="CRON",TH="alba",kH="Questa è una modalità speciale in cui gli stati e gli oggetti non cambieranno. Ma nel protocollo verranno visualizzate solo le informazioni su ogni modifica pianificata.",SH="Debug",EH="crepuscolo",IH="facile",xH="ogni",DH="Funzione",AH="ID",RH="Nome",OH="Ruolo",MH="Camera",NH="Ora d'oro",LH="Fine dell'ora d'oro",BH='Il codice verrà eseguito solo ogni volta che la condizione è vera. Per esempio. se si attiva il valore del sensore di temperatura e la condizione è "se la temperatura è maggiore di 20 ° C", le azioni "allora" verranno eseguite ogni volta che il sensore invia la temperatura e questa è superiore a 20 ° C. Di 21 ° C, di 22 ° C e così via.',PH='Il codice verrà eseguito solo se il risultato della condizione cambia. Per esempio. se si attiva il valore del sensore di temperatura e la condizione è "se la temperatura è maggiore di 20 ° C", le azioni "allora" verranno eseguite una volta quando la temperatura è superiore a 20. La prossima volta le azioni "allora" verranno eseguite quando la temperatura fallisce sotto 20 e poi sale di nuovo oltre 20.',FH="ore",jH="include",zH="intervallo",UH="Magia",HH="millisecondi",WH="minuti",VH="ms",GH="nadir",KH="Alba nautica",YH="Crepuscolo nautico",JH="Prossima alba",XH="Prossimo tramonto",qH="Notte",ZH="Fine della notte",QH="normale",eW="compensare",tW="uno",sW="o",oW="silenzioso",iW="ricerca",nW="secondi",rW="Mezzogiorno solare",aW="Alba",lW="Fine dell'alba",cW="tramonto",uW="Inizio del tramonto",dW="poi",hW="Riconoscere",pW="A partire dal",gW="Ultima modifica",mW="Qualità",fW="timestamp",$W="Utente",bW="Valore",vW="Due",yW="aggiornare",_W="Aggiunge l'output di debug al registro per molti comandi di sistema",wW="Output di log dettagliati",CW="quando",TW="procedura guidata",kW={"%s not found":"%s non trovato","()":"()","(at %s)":"(a %s)","(optional)":"(opzionale)","-":"-",".":".","AI code generator":"Generatore di codice AI",Ack:Oz,Actions:Mz,"Actual time of day":"Ora effettiva della giornata",Add:Nz,"Add new script":"Aggiungi nuovo script",All:Lz,"All files will be accepted":"Tutti i file saranno accettati",Any:Bz,"Any month":"Ogni mese",Apply:Pz,April:Fz,"Are you sure?":"Sei sicuro?",Ask:jz,Astronomical:zz,"Astronomical events today":"Eventi astronomici oggi",August:Uz,"Blockly description":"Creazione di regole tramite blocchi grafici","Body:":"Corpo:",Cancel:Hz,"Cannot delete non empty item!":"Impossibile eliminare l'elemento non vuoto!","Change layout":"Cambia layout",'Change theme (actual "%s")':'Cambia tema (ora - "%s")',"Check blocks":"Controlla i blocchi","Check is not active, because javascript adapter is disabled":"Il controllo non è attivo perché l'adattatore Javascript è disabilitato","Clear search input":"Cancella input di ricerca","Click on this icon":"Clicca su questa icona",Close:Wz,"Close all but current":"Chiudi tutto tranne corrente","Collapse all":"Comprimi tutto","Compares current time with astronomical event":"Confronta l'ora corrente con l'evento astronomico","Compares current time with the user specific time":"Confronta l'ora corrente con l'ora specifica dell'utente","Compares the state value with user defined value":"Confronta il valore dello stato con il valore definito dall'utente",Condition:Vz,Conditions:Gz,"Configuration not saved.":"Configurazione non salvata.",Console:Kz,"Control or update some state":"Controlla o aggiorna uno stato","Control or update some state with delay":"Controlla o aggiorna uno stato con ritardo","Convert blockly to javascript for ever.":"Converti istantaneamente a blocchi in Javascript.",Copied:Yz,"Copy script":"Copia script","Copy to clipboard":"Copia negli appunti","Create new":"Creare nuovo","Create new folder":"Crea una nuova cartella","Create new script":"Crea nuovo script","Create or edit CRON or time wizard":"Crea o modifica la procedura guidata CRON o time","Dark Theme":"Tema scuro","Dark style":"Stile scuro",Date:"Data","Debug instance":"Istanza di debug","Debug options":"Opzioni di debug",December:Jz,Default:Xz,"Define cron...":"Definisci cron ...","Define schedule...":"Definisci programma ...",Delay:qz,Delete:Zz,"Delete %s":"Elimina %s ...","Delete folder":"Elimina cartella","Delete script":"Elimina script",Description:Qz,"Deselect all":"Deselezionare tutto","Discard changes for %s":"Annulla modifiche per %s",Done:eU,"Double click to write value":"Doppio clic per scrivere il valore","Download as file":"Scarica come file","Drop some files here or click...":"Trascina alcuni file qui o fai clic su ...","Duplicate name":"Nome duplicato","Edit script or just double click":"Modifica lo script o fai doppio clic","Empty name is not allowed":"Il nome vuoto non è consentito","End search mode":"Termina la modalità di ricerca","Enter your question":"Inserisci la tua richiesta",Error:"Errore","Error formatting code":"Errore di formattazione del codice","Error was found":"Errore trovato","Every day":"Ogni giorno",Exec:tU,"Executes some shell command":"Esegue alcuni comandi della shell","Existing scripts will be overwritten.":"Gli script esistenti verranno sovrascritti.","Expand all":"Espandi tutto","Expert mode":"Modalità esperto",Explanation:sU,Export:oU,"Export all scripts":"Esporta tutti gli script","Export blocks":"Esporta blocchi","Export selected blocks":"Esporta i blocchi selezionati",Februar:iU,February:nU,Filter:rU,Folder:aU,Fr:lU,Friday:cU,Function:"Funzione","Function editor":"Editor di funzioni","Function: executed":"Funzione: eseguita","Go to next line":"Vai alla riga successiva","HTTP Call":"Chiamata HTTP","Hide logs":"Nascondi i registri",ID:uU,ID1:dU,ID2:hU,Import:pU,"Import blocks":"Importa blocchi","Import error":"Errore di importazione","Import scripts":"Importa script","Insert object ID":"Inserisci l'ID oggetto",Instance:gU,"Instance is disabled":"L'istanza è disabilitata","Instance:":"Esempio:",Instances:mU,Instructions:fU,"Invalid CRON":"CRON non valido","It will not be possible to revert this operation.":"Non sarà possibile ripristinare questa operazione.","JS description":"Creare regole scrivendo Javascript",Januar:$U,January:bU,July:vU,June:yU,"Just check":"Controlla solamente","Language:":"Linguaggio:","Learn More":"Per saperne di più","Light style":"Stile leggero",Limit:_U,"Local time":"Ora locale","Locate file":"Localizza file","Log outputs":"Registra le uscite","Log text":"Testo del registro","Log: %s":"Log: %s","Make a HTTP get request":"Effettua una richiesta get HTTP","Make a pause between actions":"Fai una pausa tra le azioni",March:wU,"March ":"marzo",May:CU,Menu:TU,Message:kU,Mo:SU,Model:EU,Monday:IU,Month:xU,More:DU,Name:AU,"No Chat GPT Key found":"Nessuna chiave GPT chat trovata","No active host found":"Nessun host attivo trovato","Nothing found":"Non abbiamo trovato nulla",November:RU,OK:OU,October:MU,Ok:NU,"On condition change":"A condizione che cambino","On script save or adapter start":"Al salvataggio dello script o all'avvio dell'adattatore","On weekdays":"Nei giorni della settimana","Open configuration":"Configurazione aperta","Operate two states":"Gestisci due stati","Operations with two states":"Operazioni con due stati","Paste your blocks here":"Incolla qui i tuoi blocchi",Pause:LU,"Pause execution":"Metti in pausa l'esecuzione","Pause script":"Metti in pausa lo script","Phone:":"Telefono:","Please select object ID...":"Seleziona l'ID oggetto ...","Press Ctrl+Enter to get the answer":"Premi Ctrl+Invio per ottenere la risposta","Prettify the script":"Abbellire la sceneggiatura","Print some text in log":"Stampa del testo nel registro","Priority:":"Priorità:",Pushover:BU,Pushsafer:PU,"Read only ID selected: %s":"ID di sola lettura selezionato: %s",Rename:FU,"Reorder scripts in folders":"Riordina gli script nelle cartelle",Repeat:jU,Restart:zU,Result:UU,"Resume execution":"Riprendi esecuzione","Root folder":"Cartella root","Rules description":"Crea regole con i blocchi IF, THEN, ELSE","Run script":"Esegui script",Sa:HU,Saturday:WU,Save:VU,"Save all":"Salva tutto","Say It":"Say It","Say some text via sayit adapter":"Pronuncia del testo tramite l'adattatore sayit",Schedule:GU,Script:KU,"Script %s was modified on disk":"Lo script %s è stato modificato sul disco","Script is not running":"Lo script non è in esecuzione","Search in scripts":"Cerca negli script","Search...":"Ricerca...","Select all":"Seleziona tutto","Send email":"Invia una email","Sends an email":"Invia un'e-mail","Sends message via Pushsafer":"Invia messaggio tramite Pushsafer","Sends message via pushover":"Invia messaggio tramite pushover","Sends message via telegram":"Invia messaggio tramite telegramma","Sends message via whatsapp-cmb":"Invia messaggio tramite whatsapp-cmb",September:YU,"Server time":"Ora del server","Set state action":"Imposta l'azione dello stato","Set with delay":"Impostato con ritardo","Shell command":"Comando Shell","Show astronomical events":"Mostra eventi astronomici","Show javascript code":"Mostra codice Javascript","Show logs":"Mostra i log","Show only paused scripts":"Mostra solo script in pausa","Show only running scripts":"Mostra solo gli script in esecuzione","Show only scripts with problems":"Mostra solo script con problemi",Simulate:JU,"Some files will be rejected":"Alcuni file verranno rifiutati","Sound:":"Suono:",Stack:XU,Start:qU,"Start script":"Avvia script",State:ZU,"State condition":"Condizione dello stato","Step into function":"Entra in funzione","Step out from function":"Esci dalla funzione","Stop on exception":"Ferma in caso di eccezione",Su:QU,"Subject:":"Soggetto:",Sunday:eH,"TS description":"Creare regole scrivendo dattiloscritto",Telegram:tH,"Text:":"Testo:",Th:sH,"The script will be stopped and must be activated manually after debugging. Continue?":"Lo script verrà interrotto e dovrà essere attivato manualmente dopo il debug. Continua?","This is advances option. You can write your own code here and it will be executed on trigger":"Questa è un'opzione anticipata. Puoi scrivere il tuo codice qui e verrà eseguito al trigger",Thursday:oH,Time:iH,"Time condition":"Condizione temporale","Title:":"Titolo:","To:":"Per:","Trigger with value":"Trigger con valore",Triggered:nH,Triggers:rH,"Triggers the on script saving or the javascript instance restart":"Attiva il salvataggio dello script o il riavvio dell'istanza javascript","Triggers the rule on update or change of some state":"Attiva la regola in caso di aggiornamento o modifica di uno stato","Triggers the rule periodically or on some specific time":"Attiva la regola periodicamente o in un momento specifico",Tu:aH,Tuesday:lH,URL:cH,"Unknown error":"Errore sconosciuto","Unknown error!":"Errore sconosciuto!","Use generated code":"Usa il codice generato","User function":"Funzione utente","User:":"Utente:",Value:uH,"Vibration:":"Vibrazione:",Volume:dH,We:hH,Wednesday:pH,"Whatsapp-cmb":"Whatsapp-cmb",Write:gH,"Write your own code":"Scrivi il tuo codice",Yes:mH,"Yet exists!":"Esiste ancora!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"È possibile utilizzare %s nell'URL per utilizzare il valore di trigger corrente, %id per utilizzare l'ID dell'oggetto attivato, %name per mostrare il nome dell'ID dell'oggetto attivato o %old per utilizzare il vecchio valore di trigger","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"È possibile utilizzare %s nel comando per utilizzare il valore di trigger corrente, %id per utilizzare l'ID dell'oggetto attivato, %name per mostrare il nome dell'ID dell'oggetto attivato o %old per utilizzare il vecchio valore di trigger","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"È possibile utilizzare %s nel testo per visualizzare il valore di trigger corrente, %id per utilizzare l'ID dell'oggetto attivato, %name per mostrare il nome dell'ID dell'oggetto attivato o %old per utilizzare il vecchio valore di trigger","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"È possibile utilizzare %s nel valore per utilizzare il valore di trigger corrente, %id per utilizzare l'ID dell'oggetto attivato, %name per mostrare il nome dell'ID dell'oggetto attivato o %old per utilizzare il vecchio valore di trigger","You have to enter OpenAI API key in the configuration of javascript adapter.":"Devi inserire la chiave API OpenAI nella configurazione dell'adattatore javascript.","[equal]":"[pari]","[greater or equal]":"[maggiore o uguale]","[greater]":"[maggiore]","[hysteresis]":"[isteresi]","[includes]":"[include]","[less or equal]":"[minore o uguale]","[less]":"[Di meno]","[not equal]":"[non uguale]",acknowledgment:fH,all:$H,and:bH,astro:vH,at:yH,"clear running":"chiara esecuzione",control:_H,copy:wH,cron:CH,dawn:TH,debug_help:kH,debug_label:SH,default:"predefinito",dusk:EH,easy:IH,else:"altro","equal to":"uguale a",every:xH,"every hour at 0 minutes":"ogni ora a 0 minuti",false:"falso","file reading has failed: %s":"lettura file non riuscita: %s","file reading was aborted":"la lettura del file è stata interrotta",filter_func:DH,filter_id:AH,filter_name:RH,filter_role:OH,filter_room:MH,"for edit or create script":"per modificare o creare un nuovo script","for professionals":"per i professionisti","for programmers":"per i programmatori",goldenHour:NH,goldenHourEnd:LH,"greater or equal":"maggiore o uguale","greater or equal to":"maggiore o uguale a","greater than":"più grande di",help_just_check:BH,help_on_change:PH,"high priority":"priorità alta","high-priority":"priorità alta","highest priority":"massima priorità",hours:FH,includes:jH,interval:zH,"just check":"controlla solamente","less or equal":"inferiore o uguale","less or equal to":"minore o uguale a","less than":"meno di","lower priority":"priorità inferiore","lowest priority":"priorità più bassa",magic:UH,milliseconds:HH,minutes:WH,ms:VH,nadir:GH,nauticalDawn:KH,nauticalDusk:YH,nextSunrise:JH,nextSunset:XH,night:qH,nightEnd:ZH,"no blocks found":"Nessun blocco trovato","no group":"NESSUN GRUPPO",normal:QH,"normal priority":"priorità normale","not equal to":"non uguale a","not properly connected":"Questo blocco non è correttamente collegato ad altri blocchi.",offset:eW,"on change":"sul cambiamento","on condition change":"a cambio di condizione","on update":"in aggiornamento",one:tW,or:sW,quiet:oW,"reset search":"resetta la ricerca",search:iW,seconds:nW,solarNoon:rW,"store in":"conservare in",sunrise:aW,sunriseEnd:lW,sunset:cW,sunsetStart:uW,then:dW,"toggle value":"alterna valore",tooltip_ack:hW,tooltip_from:pW,tooltip_lc:gW,tooltip_quality:mW,tooltip_ts:fW,tooltip_user:$W,tooltip_value:bW,true:"vero",two:vW,undefined:"non definito",update:yW,"use seconds":"usa i secondi","use trigger value":"usa il trigger",verbose_help:_W,verbose_label:wW,when:CW,with:"con","with date":"con data","with offset":"con offset",wizard:TW},SW="Erkend",EW="Acties",IW="Toevoegen",xW="Alle",DW="Ieder",AW="Solliciteer",RW="april",OW="Vragen",MW="Astronomisch",NW="augustus",LW="annuleren",BW="Dichtbij",PW="Staat",FW="Voorwaarden",jW="Troosten",zW="Gekopieerd",UW="december",HW="Standaard",WW="Vertraging",VW="Verwijder",GW="Beschrijving",KW="Gedaan",YW="Exec shell",JW="Uitleg",XW="Exporteren",qW="Februari",ZW="februari",QW="Filter",eV="Map",tV="Vr",sV="vrijdag",oV="ID kaart",iV="ID1",nV="ID2",rV="Importeren",aV="Voorbeeld",lV="Instanties",cV="Instructies",uV="Januar",dV="januari",hV="juli",pV="juni",gV="Begrenzing",mV="maart",fV="mei",$V="Menu",bV="Bericht",vV="Ma",yV="Model",_V="maandag",wV="Maand",CV="Meer",TV="Naam",kV="november",SV="OK",EV="oktober",IV="OK",xV="Pauze",DV="Pushover",AV="Duwijzer",RV="andere naam geven",OV="Herhaling",MV="Herstarten",NV="Resultaat",LV="Za",BV="zaterdag",PV="Opslaan",FV="Schema",jV="Script",zV="september",UV="Simuleren",HV="Stack",WV="Begin",VV="Staat",GV="Zo",KV="zondag",YV="Telegram",JV="4",XV="donderdag",qV="Tijd",ZV="Veroorzaakt",QV="Triggers",eG="Di",tG="dinsdag",sG="URL",oG="Waarde",iG="Volume",nG="3",rG="woensdag",aG="Schrijven",lG="Ja",cG="erkenning",uG="alle",dG="en",hG="astro",pG="Bij",gG="controle",mG="kopiëren",fG="cron",$G="dageraad",bG="Dit is een speciale modus waarin toestanden en objecten niet veranderen. Maar alleen informatie over elke geplande wijziging wordt in het protocol weergegeven.",vG="Debuggen",yG="schemer",_G="eenvoudig",wG="elke",CG="Functie",TG="ID kaart",kG="Naam",SG="Rol",EG="Kamer",IG="gouden uur",xG="Einde van gouden uur",DG='De code wordt alleen uitgevoerd als de voorwaarde waar is. Bijv. als het triggeren op de temperatuursensorwaarde en de conditie is "als de temperatuur hoger is dan 20 ° C", zullen de "dan" acties worden uitgevoerd elke keer dat de sensor de temperatuur verzendt en deze hoger is dan 20 ° C. Bij 21 ° C, bij 22 ° C enzovoort.',AG='De code wordt alleen uitgevoerd als het conditieresultaat verandert. Bijv. als de temperatuursensor wordt geactiveerd en de conditie is "als de temperatuur hoger is dan 20 ° C", worden de "dan" -acties eenmaal uitgevoerd wanneer de temperatuur hoger is dan 20. De volgende keer worden de "dan" -acties uitgevoerd wanneer de temperatuur faalt onder de 20 en stijgt dan weer boven de 20.',RG="uren",OG="omvat",MG="interval",NG="magie",LG="milliseconden",BG="minuten",PG="ms",FG="nadir",jG="Nautische dageraad",zG="Nautische schemering",UG="Volgende zonsopgang",HG="Volgende zonsondergang",WG="nacht",VG="Einde van de nacht",GG="normaal",KG="compensatie",YG="een",JG="of",XG="stil",qG="zoeken",ZG="seconden",QG="Zonne-middag",e5="zonsopkomst",t5="Einde zonsopgang",s5="zonsondergang",o5="Begin van de zonsondergang",i5="vervolgens",n5="Erkennen",r5="Van",a5="Laatst gewijzigd",l5="Kwaliteit",c5="tijdstempel",u5="Gebruiker",d5="Waarde",h5="twee",p5="bijwerken",g5="Voegt foutopsporingsuitvoer toe aan het logboek voor veel systeemopdrachten",m5="Uitgebreide log-uitgangen",f5="wanneer",$5="tovenaar",b5={"%s not found":"%s niet gevonden","()":"()","(at %s)":"(op %s)","(optional)":"(optioneel)","-":"-",".":".","AI code generator":"AI-codegenerator",Ack:SW,Actions:EW,"Actual time of day":"Werkelijke tijd van de dag",Add:IW,"Add new script":"Nieuw script toevoegen",All:xW,"All files will be accepted":"Alle bestanden worden geaccepteerd",Any:DW,"Any month":"Elke maand",Apply:AW,April:RW,"Are you sure?":"Weet je zeker dat?",Ask:OW,Astronomical:MW,"Astronomical events today":"Astronomische gebeurtenissen vandaag",August:NW,"Blockly description":"Regels maken door grafische blokken","Body:":"Lichaam:",Cancel:LW,"Cannot delete non empty item!":"Kan niet leeg item niet verwijderen!","Change layout":"Opmaak veranderen",'Change theme (actual "%s")':'Thema wijzigen (nu - "%s")',"Check blocks":"Controleer blokken","Check is not active, because javascript adapter is disabled":"Controle is niet actief, omdat Javascript-adapter is uitgeschakeld","Clear search input":"Zoekopdracht wissen","Click on this icon":"Klik op dit pictogram",Close:BW,"Close all but current":"Alles sluiten behalve huidig","Collapse all":"Alles inklappen","Compares current time with astronomical event":"Vergelijkt huidige tijd met astronomische gebeurtenis","Compares current time with the user specific time":"Vergelijkt de huidige tijd met de gebruikerspecifieke tijd","Compares the state value with user defined value":"Vergelijkt de statuswaarde met de door de gebruiker gedefinieerde waarde",Condition:PW,Conditions:FW,"Configuration not saved.":"Configuratie niet opgeslagen.",Console:jW,"Control or update some state":"Beheer of update een bepaalde staat","Control or update some state with delay":"Beheer of update een bepaalde staat met vertraging","Convert blockly to javascript for ever.":"Converteer direct blockly naar Javascript.",Copied:zW,"Copy script":"Kopieer script","Copy to clipboard":"Kopieer naar klembord","Create new":"Maak nieuw","Create new folder":"Maak een nieuwe map","Create new script":"Maak een nieuw script","Create or edit CRON or time wizard":"Creëer of bewerk CRON of tijdwizard","Dark Theme":"Donker thema","Dark style":"Donkere stijl",Date:"Datum","Debug instance":"Debug-instantie","Debug options":"Foutopsporingsopties",December:UW,Default:HW,"Define cron...":"Definieer cron ...","Define schedule...":"Definieer schema ...",Delay:WW,Delete:VW,"Delete %s":"%s verwijderen ...","Delete folder":"Verwijder map","Delete script":"Script verwijderen",Description:GW,"Deselect all":"Deselecteer alles","Discard changes for %s":"Wijzigingen voor %s annuleren",Done:KW,"Double click to write value":"Dubbelklikken om waarde te schrijven","Download as file":"Download","Drop some files here or click...":"Zet hier enkele bestanden neer of klik op ...","Duplicate name":"Dubbele naam","Edit script or just double click":"Bewerk het script of dubbelklik erop","Empty name is not allowed":"Lege naam is niet toegestaan","End search mode":"Zoekmodus beëindigen","Enter your question":"Voer uw verzoek in",Error:"Fout","Error formatting code":"Fout bij het opmaken van de code","Error was found":"Er is een fout gevonden","Every day":"Elke dag",Exec:YW,"Executes some shell command":"Voert een shell-commando uit","Existing scripts will be overwritten.":"Bestaande scripts worden overschreven.","Expand all":"Alles uitvouwen","Expert mode":"Expert modus",Explanation:JW,Export:XW,"Export all scripts":"Exporteer alle scripts","Export blocks":"Blokken exporteren","Export selected blocks":"Exporteer geselecteerde blokken",Februar:qW,February:ZW,Filter:QW,Folder:eV,Fr:tV,Friday:sV,Function:"Functie","Function editor":"Functie-editor","Function: executed":"Functie: uitgevoerd","Go to next line":"Ga naar de volgende regel","HTTP Call":"HTTP-oproep","Hide logs":"Verberg logboeken",ID:oV,ID1:iV,ID2:nV,Import:rV,"Import blocks":"Blokken importeren","Import error":"Importfout","Import scripts":"Scripts importeren","Insert object ID":"Object-ID invoegen",Instance:aV,"Instance is disabled":"Exemplaar is uitgeschakeld","Instance:":"Voorbeeld:",Instances:lV,Instructions:cV,"Invalid CRON":"Ongeldige CRON","It will not be possible to revert this operation.":"Het is niet mogelijk om deze bewerking terug te zetten.","JS description":"Regels maken door Javascript te schrijven",Januar:uV,January:dV,July:hV,June:pV,"Just check":"Kijk maar","Language:":"Taal:","Learn More":"Leer meer","Light style":"Lichte stijl",Limit:gV,"Local time":"Lokale tijd","Locate file":"Vind het bestand","Log outputs":"Log uitgangen","Log text":"Log tekst","Log: %s":"Logboek: %s","Make a HTTP get request":"Maak een HTTP-ophaalverzoek","Make a pause between actions":"Pauzeer tussen acties",March:mV,"March ":"maart",May:fV,Menu:$V,Message:bV,Mo:vV,Model:yV,Monday:_V,Month:wV,More:CV,Name:TV,"No Chat GPT Key found":"Geen Chat GPT-sleutel gevonden","No active host found":"Geen actieve host gevonden","Nothing found":"Niets gevonden",November:kV,OK:SV,October:EV,Ok:IV,"On condition change":"Op voorwaarde verandering","On script save or adapter start":"Bij het opslaan van het script of het starten van de adapter","On weekdays":"Op weekdagen","Open configuration":"Configuratie openen","Operate two states":"Bedien twee toestanden:","Operations with two states":"Bewerkingen met twee toestanden","Paste your blocks here":"Plak hier je blokken",Pause:xV,"Pause execution":"Uitvoering pauzeren","Pause script":"Pauzeer script","Phone:":"Telefoon:","Please select object ID...":"Selecteer object-ID ...","Press Ctrl+Enter to get the answer":"Druk op Ctrl+Enter om het antwoord te krijgen","Prettify the script":"Maak het script mooier","Print some text in log":"Druk wat tekst af in het logboek","Priority:":"Prioriteit:",Pushover:DV,Pushsafer:AV,"Read only ID selected: %s":"Alleen-lezen ID geselecteerd: %s",Rename:RV,"Reorder scripts in folders":"Sorteer scripts in mappen opnieuw",Repeat:OV,Restart:MV,Result:NV,"Resume execution":"Uitvoering hervatten","Root folder":"Hoofdmap","Rules description":"Maak regels met IF, THEN, ELSE blokken","Run script":"Voer script uit",Sa:LV,Saturday:BV,Save:PV,"Save all":"Sla alles op","Say It":"Say It","Say some text via sayit adapter":"Zeg wat tekst via de sayit-adapter",Schedule:FV,Script:jV,"Script %s was modified on disk":"Script %s is gewijzigd op schijf","Script is not running":"Script is niet actief","Search in scripts":"Zoeken in scripts","Search...":"Zoeken...","Select all":"Selecteer alles","Send email":"E-mail verzenden","Sends an email":"Stuurt een e-mail","Sends message via Pushsafer":"Stuurt bericht via Pushsafer","Sends message via pushover":"Stuurt bericht via pushover","Sends message via telegram":"Verzendt bericht via telegram","Sends message via whatsapp-cmb":"Stuurt bericht via whatsapp-cmb",September:zV,"Server time":"Servertijd","Set state action":"Stel statusactie in","Set with delay":"Met vertraging ingesteld","Shell command":"Shell-opdracht","Show astronomical events":"Laat astronomische gebeurtenissen zien","Show javascript code":"Javascript-code weergeven","Show logs":"Toon logboeken","Show only paused scripts":"Toon alleen onderbroken scripts","Show only running scripts":"Toon alleen actieve scripts","Show only scripts with problems":"Toon alleen scripts met problemen",Simulate:UV,"Some files will be rejected":"Sommige bestanden worden geweigerd","Sound:":"Geluid:",Stack:HV,Start:WV,"Start script":"Start het script",State:VV,"State condition":"Staat staat","Step into function":"Stap in functie","Step out from function":"Stap uit de functie","Stop on exception":"Stop bij uitzondering",Su:GV,"Subject:":"Onderwerpen:",Sunday:KV,"TS description":"Regels maken door Typescript te schrijven",Telegram:YV,"Text:":"Tekst:",Th:JV,"The script will be stopped and must be activated manually after debugging. Continue?":"Het script wordt gestopt en moet na het debuggen handmatig worden geactiveerd. Doorgaan met?","This is advances option. You can write your own code here and it will be executed on trigger":"Dit is een voorschotoptie. U kunt hier uw eigen code schrijven en deze wordt bij een trigger uitgevoerd",Thursday:XV,Time:qV,"Time condition":"Tijdsvoorwaarde","Title:":"Titel:","To:":"Naar:","Trigger with value":"Trigger met waarde",Triggered:ZV,Triggers:QV,"Triggers the on script saving or the javascript instance restart":"Activeert het opslaan van het script of het opnieuw opstarten van de JavaScript-instantie","Triggers the rule on update or change of some state":"Activeert de regel voor het bijwerken of wijzigen van een bepaalde staat","Triggers the rule periodically or on some specific time":"Activeert de regel periodiek of op een specifieke tijd",Tu:eG,Tuesday:tG,URL:sG,"Unknown error":"Onbekende fout","Unknown error!":"Onbekende fout!","Use generated code":"Gebruik gegenereerde code","User function":"Gebruikersfunctie","User:":"Gebruiker:",Value:oG,"Vibration:":"Trilling:",Volume:iG,We:nG,Wednesday:rG,"Whatsapp-cmb":"Whatsapp-cmb",Write:aG,"Write your own code":"Schrijf je eigen code",Yes:lG,"Yet exists!":"Toch bestaat!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"U kunt %s in de URL gebruiken om de huidige triggerwaarde te gebruiken, %id om de geactiveerde object-ID te gebruiken, %name om de geactiveerde object-ID-naam te tonen of %old om de oude triggerwaarde te gebruiken","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"U kunt %s in de opdracht gebruiken om de huidige triggerwaarde te gebruiken, %id om de getriggerde object-ID te gebruiken, %name om de getriggerde object-ID-naam te tonen of %old om de oude triggerwaarde te gebruiken","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"U kunt %s in de tekst gebruiken om de huidige triggerwaarde weer te geven, %id om de geactiveerde object-ID te gebruiken, %name om de geactiveerde object-ID-naam weer te geven of %old om de oude triggerwaarde te gebruiken","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"U kunt %s in de waarde gebruiken om de huidige triggerwaarde te gebruiken, %id om de geactiveerde object-ID te gebruiken, %name om de geactiveerde object-ID-naam te tonen of %old om de oude triggerwaarde te gebruiken","You have to enter OpenAI API key in the configuration of javascript adapter.":"U moet de OpenAI API-sleutel invoeren in de configuratie van de javascript-adapter.","[equal]":"[Gelijk]","[greater or equal]":"[groter of gelijk]","[greater]":"[groter]","[hysteresis]":"[hysterese]","[includes]":"[inclusief]","[less or equal]":"[minder of gelijk]","[less]":"[minder]","[not equal]":"[niet gelijk]",acknowledgment:cG,all:uG,and:dG,astro:hG,at:pG,"clear running":"duidelijk rennen",control:gG,copy:mG,cron:fG,dawn:$G,debug_help:bG,debug_label:vG,default:"standaard",dusk:yG,easy:_G,else:"anders","equal to":"gelijk aan",every:wG,"every hour at 0 minutes":"elk uur op 0 minuten",false:"false","file reading has failed: %s":"bestands lezen is mislukt: %s","file reading was aborted":"bestands lezen is afgebroken",filter_func:CG,filter_id:TG,filter_name:kG,filter_role:SG,filter_room:EG,"for edit or create script":"voor bewerken of een nieuw script maken","for professionals":"voor professionals","for programmers":"voor programmeurs",goldenHour:IG,goldenHourEnd:xG,"greater or equal":"groter of gelijk","greater or equal to":"groter of gelijk aan","greater than":"groter dan",help_just_check:DG,help_on_change:AG,"high priority":"hoge prioriteit","high-priority":"hoge prioriteit","highest priority":"hoogste prioriteit",hours:RG,includes:OG,interval:MG,"just check":"kijk maar","less or equal":"minder of gelijk","less or equal to":"minder of gelijk aan","less than":"minder dan","lower priority":"lagere prioriteit","lowest priority":"laagste prioriteit",magic:NG,milliseconds:LG,minutes:BG,ms:PG,nadir:FG,nauticalDawn:jG,nauticalDusk:zG,nextSunrise:UG,nextSunset:HG,night:WG,nightEnd:VG,"no blocks found":"Geen blokken gevonden","no group":"GEEN GROEP",normal:GG,"normal priority":"normale prioriteit","not equal to":"niet gelijk aan","not properly connected":"Dit blok is niet correct verbonden met andere blokken.",offset:KG,"on change":"bij verandering","on condition change":"op voorwaarde verandering","on update":"bij update",one:YG,or:JG,quiet:XG,"reset search":"reset zoeken",search:qG,seconds:ZG,solarNoon:QG,"store in":"opslaan in",sunrise:e5,sunriseEnd:t5,sunset:s5,sunsetStart:o5,then:i5,"toggle value":"schakelwaarde",tooltip_ack:n5,tooltip_from:r5,tooltip_lc:a5,tooltip_quality:l5,tooltip_ts:c5,tooltip_user:u5,tooltip_value:d5,true:"waar",two:h5,undefined:"ongedefinieerd",update:p5,"use seconds":"gebruik seconden","use trigger value":"triggerwaarde gebruiken",verbose_help:g5,verbose_label:m5,when:f5,with:"met","with date":"met datum","with offset":"met offset",wizard:$5},v5="Potwierdzony",y5="Działania",_5="Dodaj",w5="Wszystko",C5="Każdy",T5="Zastosuj",k5="Kwiecień",S5="Zapytać",E5="Astronomiczny",I5="Sierpień",x5="Odwołaj",D5="Zamknij",A5="Stan",R5="Warunki",O5="Konsola",M5="Skopiowano",N5="Grudzień",L5="Domyślna",B5="Opóźnienie",P5="Usuń",F5="Opis",j5="Gotowe",z5="Uruchom shell",U5="Wyjaśnienie",H5="Eksport",W5="Luty",V5="Luty",G5="Filtr",K5="Folder",Y5="Pt",J5="Piątek",X5="ID",q5="ID1",Z5="ID2",Q5="Import",e3="Instancja",t3="Instancje",s3="Instrukcje",o3="Styczeń",i3="Styczeń",n3="Lipiec",r3="Czerwiec",a3="Limit",l3="Marzec",c3="Maj",u3="Menu",d3="Wiadomość",h3="Po",p3="Model",g3="Poniedziałek",m3="Miesiąc",f3="Więcej",$3="Nazwa",b3="Listopad",v3="OK",y3="Październik",_3="Ok",w3="Pauza",C3="Pushover",T3="Pushsafer",k3="Przemianuj",S3="Powtórz",E3="Uruchom ponownie",I3="Wynik",x3="So",D3="Sobota",A3="Zapisz",R3="Harmonogram",O3="Skrypt",M3="Wrzesień",N3="Symulacja",L3="Stos",B3="Początek",P3="Stan",F3="Nd",j3="Niedziela",z3="Telegram",U3="Cz",H3="Czwartek",W3="Czas",V3="Wyzwolony",G3="Wyzwalacze",K3="Wt",Y3="Wtorek",J3="URL",X3="Wartość",q3="Wolumen",Z3="Śr",Q3="Środa",e4="Pisać",t4="Tak",s4="potwierdzenie",o4="wszystko",i4="i",n4="Astro",r4="w",a4="kontrola",l4="Kopiuj",c4="CRON",u4="Świt",d4="Jest to specjalny tryb, w którym stany i obiekty się nie zmieniają. Jednak w protokole będą wyświetlane tylko informacje o każdej planowanej zmianie.",h4="Odpluskwić",p4="Zmierzch",g4="łatwy",m4="każdy",f4="Funkcja",$4="ID",b4="Nazwa",v4="Rola",y4="Pokój",_4="Złota godzina",w4="Koniec złotej godziny",C4="Kod zostanie wykonany tylko za każdym razem, gdy warunek będzie spełniony. Na przykład. jeśli wyzwalanie na wartość czujnika temperatury i warunek to „jeśli temperatura jest wyższa niż 20 ° C”, to działania „następnie” będą wykonywane za każdym razem, gdy czujnik wyśle temperaturę i jest powyżej 20 ° C. O 21 ° C, o 22 ° C i tak dalej.",T4="Kod zostanie wykonany tylko wtedy, gdy wynik warunku ulegnie zmianie. Na przykład. jeśli wyzwalanie na wartość czujnika temperatury i warunek „jeśli temperatura jest wyższa niż 20 ° C”, to akcje „następnie” zostaną wykonane raz, gdy temperatura przekroczy 20. Następnym razem działania „następnie” zostaną wykonane, gdy temperatura nie udaje się poniżej 20, a następnie ponownie wzrasta powyżej 20.",k4="godziny",S4="zawiera",E4="interwał",I4="magia",x4="milisekund",D4="minuty",A4="ms",R4="Północ słoneczna",O4="Żeglarski świt",M4="Żeglarski zmierzch",N4="Następny wschód słońca",L4="Następny zachód słońca",B4="Noc",P4="Koniec nocy",F4="normalny",j4="przesunięcie",z4="jeden",U4="lub",H4="cisza",W4="Szukaj",V4="sekundy",G4="Południe słoneczne",K4="Wschód słońca",Y4="Koniec wschodu słońca",J4="Zachód słońca",X4="Początek zachodu słońca",q4="następnie",Z4="Akceptuj",Q4="Od",e8="Ostatnia zmiana",t8="Jakość",s8="Znacznik czasu",o8="Użytkownik",i8="Wartość",n8="dwa",r8="aktualizacja",a8="Dodaje wyniki debugowania do dziennika dla wielu poleceń systemowych",l8="Pełne dane wyjściowe dziennika",c8="gdy",u8="Wizard",d8={"%s not found":"%s nie znaleziono","()":"()","(at %s)":"(w %s)","(optional)":"(opcjonalny)","-":"-",".":".","AI code generator":"Generator kodu AI",Ack:v5,Actions:y5,"Actual time of day":"Aktualna pora dnia",Add:_5,"Add new script":"Dodaj nowy skrypt",All:w5,"All files will be accepted":"Wszystkie pliki zostaną zaakceptowane",Any:C5,"Any month":"Dowolny miesiąc",Apply:T5,April:k5,"Are you sure?":"Jesteś pewny?",Ask:S5,Astronomical:E5,"Astronomical events today":"Wydarzenia astronomiczne dzisiaj",August:I5,"Blockly description":"Tworzenie reguł za pomocą bloków graficznych","Body:":"Treść:",Cancel:x5,"Cannot delete non empty item!":"Nie można usunąć niepustego elementu!","Change layout":"Zmiana układu",'Change theme (actual "%s")':"Zmień motyw (obecnie - „%s”)","Check blocks":"Sprawdź bloki","Check is not active, because javascript adapter is disabled":"Sprawdzanie nie jest aktywne, ponieważ adapter Javascript jest wyłączony","Clear search input":"Wyczyść dane wyszukiwania","Click on this icon":"Kliknij tę ikonę",Close:D5,"Close all but current":"Zamknij wszystkie oprócz bieżących","Collapse all":"Zwinąć wszystkie","Compares current time with astronomical event":"Porównuje aktualny czas z wydarzeniem astronomicznym","Compares current time with the user specific time":"Porównuje aktualny czas z czasem określonym przez użytkownika","Compares the state value with user defined value":"Porównuje wartość stanu z wartością zdefiniowaną przez użytkownika",Condition:A5,Conditions:R5,"Configuration not saved.":"Konfiguracja nie została zapisana.",Console:O5,"Control or update some state":"Kontroluj lub aktualizuj stan","Control or update some state with delay":"Kontroluj lub aktualizuj jakiś stan z opóźnieniem","Convert blockly to javascript for ever.":"Bezpowrotna konwersja Blockly na Javascript.",Copied:M5,"Copy script":"Skopiuj skrypt","Copy to clipboard":"Skopiuj do schowka","Create new":"Utwórz nowy","Create new folder":"Utwórz nowy folder","Create new script":"Utwórz nowy skrypt","Create or edit CRON or time wizard":"Utwórz lub edytuj CRON lub kreator czasu","Dark Theme":"Ciemny schemat","Dark style":"Ciemny styl",Date:"Data","Debug instance":"Debuguj instancję","Debug options":"Opcje debugowania",December:N5,Default:L5,"Define cron...":"Zdefiniuj CRON ...","Define schedule...":"Zdefiniuj harmonogram ...",Delay:B5,Delete:P5,"Delete %s":"Usuń %s ...","Delete folder":"Usuń folder","Delete script":"Usuń skrypt",Description:F5,"Deselect all":"Odznacz wszystkie","Discard changes for %s":"Odrzuć zmiany dla %s",Done:j5,"Double click to write value":"Kliknij dwukrotnie, aby zapisać wartość","Download as file":"Download jako plik plik","Drop some files here or click...":"Upuść niektóre pliki tutaj lub kliknij ...","Duplicate name":"Duplikat nazwy","Edit script or just double click":"Edytuj skrypt lub po prostu kliknij dwukrotnie","Empty name is not allowed":"Pusta nazwa jest niedozwolona","End search mode":"Zakończ tryb wyszukiwania","Enter your question":"Wpisz swoją prośbę",Error:"Błąd","Error formatting code":"Błąd formatowania kodu","Error was found":"Błąd został znaleziony","Every day":"Codziennie",Exec:z5,"Executes some shell command":"Wykonuje polecenie powłoki","Existing scripts will be overwritten.":"Istniejące skrypty zostaną zastąpione.","Expand all":"Rozwiń wszystkie","Expert mode":"Tryb ekspercki",Explanation:U5,Export:H5,"Export all scripts":"Wyeksportuj wszystkie skrypty","Export blocks":"Eksportuj bloki","Export selected blocks":"Eksportuj wybrane bloki",Februar:W5,February:V5,Filter:G5,Folder:K5,Fr:Y5,Friday:J5,Function:"Funkcja","Function editor":"Edytor funkcji","Function: executed":"Funkcja: wykonywana","Go to next line":"Przejdź do następnej linii","HTTP Call":"Połączenie HTTP","Hide logs":"Ukryj dzienniki",ID:X5,ID1:q5,ID2:Z5,Import:Q5,"Import blocks":"Importuj bloki","Import error":"Błąd importowania","Import scripts":"Importuj skrypty","Insert object ID":"Wstaw identyfikator obiektu",Instance:e3,"Instance is disabled":"Instancja jest wyłączona","Instance:":"Instancja:",Instances:t3,Instructions:s3,"Invalid CRON":"Nieprawidłowy CRON","It will not be possible to revert this operation.":"Cofnięcie tej operacji nie będzie możliwe.","JS description":"Tworzenie reguł w Javascript",Januar:o3,January:i3,July:n3,June:r3,"Just check":"Po prostu sprawdź","Language:":"Język:","Learn More":"Ucz się więcej","Light style":"Lekki styl",Limit:a3,"Local time":"Czas lokalny","Locate file":"Znajdź plik","Log outputs":"Log dziennika","Log text":"Tekst dziennika","Log: %s":"Dziennik: %s","Make a HTTP get request":"Złóż żądanie HTTP get","Make a pause between actions":"Zrób przerwę między czynnościami",March:l3,"March ":"Marzec ",May:c3,Menu:u3,Message:d3,Mo:h3,Model:p3,Monday:g3,Month:m3,More:f3,Name:$3,"No Chat GPT Key found":"Nie znaleziono klucza GPT czatu","No active host found":"Nie znaleziono aktywnego hosta","Nothing found":"Nic nie znaleziono",November:b3,OK:v3,October:y3,Ok:_3,"On condition change":"W przypadku zmiany warunków","On script save or adapter start":"Podczas zapisywania skryptu lub uruchamiania adaptera","On weekdays":"W dni powszednie","Open configuration":"Otwarta konfiguracja","Operate two states":"Obsługuj dwa stany","Operations with two states":"Operacje z dwoma stanami","Paste your blocks here":"Wklej tutaj swoje bloki",Pause:w3,"Pause execution":"Wstrzymaj wykonanie","Pause script":"Wstrzymaj skrypt","Phone:":"Telefon:","Please select object ID...":"Wybierz identyfikator obiektu ...","Press Ctrl+Enter to get the answer":"Naciśnij klawisze Ctrl+Enter, aby uzyskać odpowiedź","Prettify the script":"Upiększ skrypt","Print some text in log":"Wydrukuj tekst w dzienniku","Priority:":"Priorytet:",Pushover:C3,Pushsafer:T3,"Read only ID selected: %s":"Wybrano identyfikator tylko do odczytu: %s",Rename:k3,"Reorder scripts in folders":"Zmień kolejność skryptów w folderach",Repeat:S3,Restart:E3,Result:I3,"Resume execution":"Wznów wykonanie","Root folder":"Folder główny","Rules description":"Twórz reguły z blokami IF, THEN, ELSE","Run script":"Uruchom skrypt",Sa:x3,Saturday:D3,Save:A3,"Save all":"Zapisz wszystko","Say It":"Wypowiedz","Say some text via sayit adapter":"Powiedz tekst przez adapter sayit",Schedule:R3,Script:O3,"Script %s was modified on disk":"Skrypt %s został zmodyfikowany na dysku","Script is not running":"Skrypt nie działa","Search in scripts":"Szukaj w skryptach","Search...":"Szukaj...","Select all":"Zaznacz wszystko","Send email":"Wysłać email","Sends an email":"Wysyła e-mail","Sends message via Pushsafer":"Wysyła wiadomość przez Pushsafer","Sends message via pushover":"Wysyła wiadomość przez pushover","Sends message via telegram":"Wysyła wiadomość telegramem","Sends message via whatsapp-cmb":"Wysyła wiadomość przez WhatsApp-cmb",September:M3,"Server time":"Czas serwera","Set state action":"Ustaw stan działania","Set with delay":"Ustaw z opóźnieniem","Shell command":"Polecenie powłoki","Show astronomical events":"Pokaż wydarzenia astronomiczne","Show javascript code":"Pokaż kod JavaScript","Show logs":"Pokaż dzienniki","Show only paused scripts":"Pokaż tylko wstrzymane skrypty","Show only running scripts":"Pokaż tylko działające skrypty","Show only scripts with problems":"Pokaż tylko skrypty z problemami",Simulate:N3,"Some files will be rejected":"Niektóre pliki zostaną odrzucone","Sound:":"Dźwięk:",Stack:L3,Start:B3,"Start script":"Uruchom skrypt",State:P3,"State condition":"Warunek stanu","Step into function":"Wejdź do funkcji","Step out from function":"Wyjdź z funkcji","Stop on exception":"Zatrzymaj się na wyjątku",Su:F3,"Subject:":"Temat:",Sunday:j3,"TS description":"Tworzenie reguł w Typescript",Telegram:z3,"Text:":"Tekst:",Th:U3,"The script will be stopped and must be activated manually after debugging. Continue?":"Skrypt zostanie zatrzymany i należy go aktywować ręcznie po debugowaniu. Kontyntynuj?","This is advances option. You can write your own code here and it will be executed on trigger":"To jest opcja zaawansowana. Możesz tutaj napisać własny kod, który zostanie wykonany po wyzwoleniu",Thursday:H3,Time:W3,"Time condition":"Warunek czasowy","Title:":"Tytuł:","To:":"Do:","Trigger with value":"Wyzwalacz z wartością",Triggered:V3,Triggers:G3,"Triggers the on script saving or the javascript instance restart":"Uruchamia zapisywanie skryptu lub restart instancji javascript","Triggers the rule on update or change of some state":"Uruchamia regułę przy aktualizacji lub zmianie jakiegoś stanu","Triggers the rule periodically or on some specific time":"Uruchamia regułę okresowo lub w określonym czasie",Tu:K3,Tuesday:Y3,URL:J3,"Unknown error":"Nieznany błąd","Unknown error!":"Nieznany błąd!","Use generated code":"Użyj wygenerowanego kodu","User function":"Funkcja użytkownika","User:":"Użytkownik:",Value:X3,"Vibration:":"Wibracja:",Volume:q3,We:Z3,Wednesday:Q3,"Whatsapp-cmb":"Whatsapp-cmb",Write:e4,"Write your own code":"Napisz swój własny kod",Yes:t4,"Yet exists!":"A jednak istnieje!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"Możesz użyć %s w adresie URL, aby użyć bieżącej wartości wyzwalacza, %id, aby użyć wyzwalanego identyfikatora obiektu, %name, aby wyświetlić nazwę identyfikatora wyzwalanego obiektu, lub %old, aby użyć starej wartości wyzwalacza","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"Możesz użyć %s w poleceniu, aby użyć bieżącej wartości wyzwalającej, %id, aby użyć identyfikatora wyzwalanego obiektu, %name, aby wyświetlić nazwę identyfikatora wyzwalanego obiektu, lub %old, aby użyć starej wartości wyzwalającej","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"Możesz użyć %s w tekście, aby wyświetlić aktualną wartość wyzwalającą, %id, aby użyć identyfikatora wyzwolonego obiektu, %name, aby wyświetlić nazwę identyfikatora wyzwolonego obiektu lub %old, aby użyć starej wartości wyzwalającej","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"Możesz użyć %s w wartości, aby użyć bieżącej wartości wyzwalacza, %id, aby użyć identyfikatora wyzwalanego obiektu, %name, aby wyświetlić nazwę identyfikatora wyzwalanego obiektu, lub %old, aby użyć starej wartości wyzwalacza","You have to enter OpenAI API key in the configuration of javascript adapter.":"Należy wprowadzić klucz OpenAI API w konfiguracji adaptera javascript.","[equal]":"[równy]","[greater or equal]":"[większe lub równe]","[greater]":"[większe]","[hysteresis]":"[histereza]","[includes]":"[obejmuje]","[less or equal]":"[mniejsze lub równe]","[less]":"[mniejsze]","[not equal]":"[nie równe]",acknowledgment:s4,all:o4,and:i4,astro:n4,at:r4,"clear running":"czyste uruchomienie",control:a4,copy:l4,cron:c4,dawn:u4,debug_help:d4,debug_label:h4,default:"domyślna",dusk:p4,easy:g4,else:"inaczej","equal to":"równy",every:m4,"every hour at 0 minutes":"co godzinę po 0 minutach",false:"fałsz","file reading has failed: %s":"odczyt pliku nie powiódł się: %s","file reading was aborted":"odczyt pliku został przerwany",filter_func:f4,filter_id:$4,filter_name:b4,filter_role:v4,filter_room:y4,"for edit or create script":"do edycji lub utwórz nowy skrypt","for professionals":"dla profesjonalistów","for programmers":"dla programistów",goldenHour:_4,goldenHourEnd:w4,"greater or equal":"większe lub równe","greater or equal to":"więcej lub równo","greater than":"więcej niż",help_just_check:C4,help_on_change:T4,"high priority":"wysoki priorytet","high-priority":"wysoki priorytet","highest priority":"najwyższy priorytet",hours:k4,includes:S4,interval:E4,"just check":"po prostu sprawdź","less or equal":"mniejsze lub równe","less or equal to":"mniej lub równo","less than":"mniej niż","lower priority":"niższy priorytet","lowest priority":"najniższy priorytet",magic:I4,milliseconds:x4,minutes:D4,ms:A4,nadir:R4,nauticalDawn:O4,nauticalDusk:M4,nextSunrise:N4,nextSunset:L4,night:B4,nightEnd:P4,"no blocks found":"Nie znaleziono bloków","no group":"BRAK GRUPY",normal:F4,"normal priority":"normalny priorytet","not equal to":"nie równa się","not properly connected":"Ten blok nie jest poprawnie podłączony do innych bloków.",offset:j4,"on change":"na zmianę","on condition change":"pod warunkiem zmiany warunków","on update":"po aktualizacji",one:z4,or:U4,quiet:H4,"reset search":"zresetuj wyszukiwanie",search:W4,seconds:V4,solarNoon:G4,"store in":"przechowaj w",sunrise:K4,sunriseEnd:Y4,sunset:J4,sunsetStart:X4,then:q4,"toggle value":"wartość przełączania",tooltip_ack:Z4,tooltip_from:Q4,tooltip_lc:e8,tooltip_quality:t8,tooltip_ts:s8,tooltip_user:o8,tooltip_value:i8,true:"prawda",two:n8,undefined:"nieokreślony",update:r8,"use seconds":"użyj sekund","use trigger value":"użyj wartości wyzwalającej",verbose_help:a8,verbose_label:l8,when:c8,with:"z","with date":"z datą","with offset":"z przesunięciem",wizard:u8},h8="Reconhecido",p8="Ações",g8="Adicionar",m8="Todos",f8="Nenhum",$8="Aplique",b8="abril",v8="Perguntar",y8="Astronômico",_8="agosto",w8="Cancelar",C8="Fechar",T8="Doença",k8="Condições",S8="Console",E8="Copiado",I8="dezembro",x8="Predefinição",D8="Atraso",A8="Deletar",R8="Descrição",O8="Pronto",M8="Exec shell",N8="Explicação",L8="Exportação",B8="Februar",P8="fevereiro",F8="Filtro",j8="Pasta",z8="Fr",U8="Sexta-feira",H8="ID",W8="ID1",V8="ID2",G8="Importar",K8="Instância",Y8="Instâncias",J8="Instruções",X8="Januar",q8="janeiro",Z8="julho",Q8="junho",e6="Limite",t6="março",s6="maio",o6="Menu",i6="mensagem",n6="Mo",r6="Modelo",a6="Segunda-feira",l6="Mês",c6="Mais",u6="Nome",d6="novembro",h6="OK",p6="outubro",g6="Ok",m6="Pausa",f6="Pushover",$6="Pushsafer",b6="Renomear",v6="Repetir",y6="Reiniciar",_6="Resultado",w6="Sá",C6="Sábado",T6="Salve",k6="Cronograma",S6="Script",E6="setembro",I6="Simular",x6="Pilha",D6="Começar",A6="Estado",R6="Su",O6="Domingo",M6="Telegrama",N6="4",L6="Quinta-feira",B6="Tempo",P6="Provocado",F6="Gatilhos",j6="Tu",z6="terça",U6="URL",H6="Valor",W6="Volume",V6="3",G6="quarta",K6="Escrever",Y6="sim",J6="reconhecimento",X6="todos",q6="e",Z6="astro",Q6="no",e9="ao controle",t9="copiar",s9="CRON",o9="alvorecer",i9="Este é um modo especial no qual estados e objetos não serão alterados. Mas apenas as informações sobre cada mudança planejada serão exibidas no protocolo.",n9="Depurar",r9="Crepúsculo",a9="fácil",l9="cada",c9="Função",u9="ID",d9="Nome",h9="Tipo",p9="Quarto",g9="Hora dourada",m9="Fim da hora de ouro",f9='O código será executado apenas sempre que a condição for verdadeira. Por exemplo. se disparar no valor do sensor de temperatura e a condição for "se a temperatura for maior que 20 ° C", as ações "então" serão executadas toda vez que o sensor enviar a temperatura e ela estiver acima de 20 ° C. Por 21 ° C, por 22 ° C e assim por diante.',$9='O código será executado apenas se o resultado da condição mudar. Por exemplo. se disparar no valor do sensor de temperatura e a condição for "se a temperatura for maior que 20 ° C", as ações "então" serão executadas uma vez quando a temperatura estiver acima de 20. Na próxima vez, as ações "então" serão executadas quando a temperatura falha abaixo de 20 e sobe acima de 20 novamente.',b9="horas",v9="inclui",y9="intervalo",_9="Magia",w9="milissegundos",C9="minutos",T9="ms",k9="nadir",S9="Madrugada náutica",E9="Crepúsculo náutico",I9="próximo nascer do sol",x9="Próximo pôr do sol",D9="Noite",A9="Fim de noite",R9="normal",O9="Deslocamento",M9="1",N9="ou",L9="quieto",B9="procurar",P9="segundos",F9="Meio-dia solar",j9="nascer do sol",z9="Fim do nascer do sol",U9="pôr do sol",H9="Começo do pôr do sol",W9="então",V9="reconhecer",G9="de",K9="Última alteração",Y9="Qualidade",J9="timestamp",X9="usuário",q9="valor",Z9="dois",Q9="atualizar",eK="Adiciona saída de depuração ao log para muitos comandos do sistema",tK="Saídas de log detalhadas",sK="quando",oK="Wizard",iK={"%s not found":"%s não encontrado","()":"()","(at %s)":"(em %s)","(optional)":"(opcional)","-":"-",".":".","AI code generator":"Gerador de código de IA",Ack:h8,Actions:p8,"Actual time of day":"Hora real do dia",Add:g8,"Add new script":"Adicionar novo script",All:m8,"All files will be accepted":"Todos os arquivos serão aceitos",Any:f8,"Any month":"Qualquer mês",Apply:$8,April:b8,"Are you sure?":"Você tem certeza?",Ask:v8,Astronomical:y8,"Astronomical events today":"Eventos astronômicos hoje",August:_8,"Blockly description":"Criando regras por blocos gráficos","Body:":"Corpo:",Cancel:w8,"Cannot delete non empty item!":"Não pode ser deletar, porque não está vazio!","Change layout":"Alterar layout",'Change theme (actual "%s")':'Alterar tema (agora - "%s")',"Check blocks":"Verificar blocos","Check is not active, because javascript adapter is disabled":"A verificação de sintaxe não está ativa porque o adaptador javascript não está rodando.","Clear search input":"Limpar entrada de pesquisa","Click on this icon":"Clique neste ícone",Close:C8,"Close all but current":"Fechar tudo, menos atual","Collapse all":"Recolher todos","Compares current time with astronomical event":"Compara o tempo atual com o evento astronômico","Compares current time with the user specific time":"Compara a hora atual com a hora específica do usuário","Compares the state value with user defined value":"Compara o valor do estado com o valor definido pelo usuário",Condition:T8,Conditions:k8,"Configuration not saved.":"Configuração não esta salva.",Console:S8,"Control or update some state":"Controlar ou atualizar algum estado","Control or update some state with delay":"Controlar ou atualizar algum estado com atraso","Convert blockly to javascript for ever.":"Converter Blockly em Javascript permanentemente.",Copied:E8,"Copy script":"Copiar script","Copy to clipboard":"Copiar para área de transferência","Create new":"Crie um novo","Create new folder":"Criar nova pasta","Create new script":"Criar novo script","Create or edit CRON or time wizard":"Criar ou editar o assistente cron ou o assistente de horário","Dark Theme":"Layout escuro","Dark style":"Estilo escuro",Date:"Encontro","Debug instance":"Instância de depuração","Debug options":"Opções de depuração",December:I8,Default:x8,"Define cron...":"Definir cron...","Define schedule...":"Definir agendamento ...",Delay:D8,Delete:A8,"Delete %s":"Deletar %s...","Delete folder":"Deletar pasta","Delete script":"Deletar script",Description:R8,"Deselect all":"Desmarcar todos","Discard changes for %s":"Descartar alterações para %s",Done:O8,"Double click to write value":"Clique duas vezes para escrever o valor","Download as file":"Baixar como arquivo","Drop some files here or click...":"Solte alguns arquivos aqui ou clique em...","Duplicate name":"Nome duplicado","Edit script or just double click":"Edite o script ou clique duas vezes","Empty name is not allowed":"Nome vazio não é permitido","End search mode":"Finalizar modo de pesquisa","Enter your question":"Digite sua solicitação",Error:"Erro","Error formatting code":"Erro de formatação de código","Error was found":"Erro foi encontrado","Every day":"Todos os dias",Exec:M8,"Executes some shell command":"Executa algum comando shell","Existing scripts will be overwritten.":"Os scripts existentes serão substituídos.","Expand all":"Expandir todos","Expert mode":"Modo de especialista",Explanation:N8,Export:L8,"Export all scripts":"Exportar todos os scripts","Export blocks":"Exportar blocos","Export selected blocks":"Exportar blocos selecionados",Februar:B8,February:P8,Filter:F8,Folder:j8,Fr:z8,Friday:U8,Function:"Função","Function editor":"Editor de funções","Function: executed":"Função: executado","Go to next line":"Vá para a próxima linha","HTTP Call":"Chamada HTTP","Hide logs":"Ocultar logs",ID:H8,ID1:W8,ID2:V8,Import:G8,"Import blocks":"Importar blocos","Import error":"Erro de importação","Import scripts":"Importar script","Insert object ID":"Inserir ID do objeto",Instance:K8,"Instance is disabled":"Instância está desativada","Instance:":"Instância:",Instances:Y8,Instructions:J8,"Invalid CRON":"CRON inválido","It will not be possible to revert this operation.":"Não será possível reverter esta operação.","JS description":"Criando regras escrevendo Javascript",Januar:X8,January:q8,July:Z8,June:Q8,"Just check":"Apenas verifique","Language:":"Língua:","Learn More":"Aprender mais","Light style":"Estilo claro",Limit:e6,"Local time":"Hora local","Locate file":"Localize o arquivo","Log outputs":"Saídas de log","Log text":"Texto de registro","Log: %s":"Log: %s","Make a HTTP get request":"Faça uma solicitação HTTP get","Make a pause between actions":"Faça uma pausa entre as ações",March:t6,"March ":"Março",May:s6,Menu:o6,Message:i6,Mo:n6,Model:r6,Monday:a6,Month:l6,More:c6,Name:u6,"No Chat GPT Key found":"Nenhuma chave GPT de bate-papo encontrada","No active host found":"Nenhum host ativo encontrado","Nothing found":"Nada encontrado",November:d6,OK:h6,October:p6,Ok:g6,"On condition change":"Na mudança de condição","On script save or adapter start":"Ao salvar o script ou iniciar o adaptador","On weekdays":"Nos dias úteis","Open configuration":"Configuração aberta","Operate two states":"Operar dois estados","Operations with two states":"Operações com dois estados","Paste your blocks here":"Cole seus blocos aqui",Pause:m6,"Pause execution":"Pausar a execução","Pause script":"Pausar script","Phone:":"Telefone:","Please select object ID...":"Selecione o ID do objeto...","Press Ctrl+Enter to get the answer":"Pressione Ctrl+Enter para obter a resposta","Prettify the script":"Embeleze o roteiro","Print some text in log":"Imprimir algum texto no log","Priority:":"Prioridade:",Pushover:f6,Pushsafer:$6,"Read only ID selected: %s":"ID somente leitura selecionada: %s",Rename:b6,"Reorder scripts in folders":"Reordenar scripts em pastas",Repeat:v6,Restart:y6,Result:_6,"Resume execution":"Retomar execução","Root folder":"Pasta principal","Rules description":"Crie regras com blocos IF, THEN, ELSE","Run script":"Executar script",Sa:w6,Saturday:C6,Save:T6,"Save all":"Salvar tudo","Say It":"Say It","Say some text via sayit adapter":"Diga algum texto através do adaptador sayit",Schedule:k6,Script:S6,"Script %s was modified on disk":'O script "%s" foi modificado no disco rígido',"Script is not running":"Script não está sendo executado","Search in scripts":"Pesquisa em scripts","Search...":"Procurar...","Select all":"Selecionar tudo","Send email":"Enviar email","Sends an email":"Envia um email","Sends message via Pushsafer":"Envia mensagem via Pushsafer","Sends message via pushover":"Envia mensagem via pushover","Sends message via telegram":"Envia mensagem via telegrama","Sends message via whatsapp-cmb":"Envia mensagem via whatsapp-cmb",September:E6,"Server time":"Tempo de servidor","Set state action":"Definir ação de estado","Set with delay":"Definido com atraso","Shell command":"Comando shell","Show astronomical events":"Mostrar eventos astronômicos","Show javascript code":"Mostrar código Javascript","Show logs":"Mostrar logs","Show only paused scripts":"Mostrar apenas scripts pausados","Show only running scripts":"Mostrar apenas scripts em execução","Show only scripts with problems":"Mostrar apenas scripts com problemas",Simulate:I6,"Some files will be rejected":"Alguns arquivos serão rejeitados","Sound:":"Som:",Stack:x6,Start:D6,"Start script":"Iniciar script",State:A6,"State condition":"Condição de estado","Step into function":"Entre na função","Step out from function":"Saia da função","Stop on exception":"Pare na exceção",Su:R6,"Subject:":"Sujeito:",Sunday:O6,"TS description":"Criando regras escrevendo Typecript",Telegram:M6,"Text:":"Texto:",Th:N6,"The script will be stopped and must be activated manually after debugging. Continue?":"O script será interrompido e deve ser ativado manualmente após a depuração. Continuar?","This is advances option. You can write your own code here and it will be executed on trigger":"Esta é a opção de avanços. Você pode escrever seu próprio código aqui e ele será executado no gatilho",Thursday:L6,Time:B6,"Time condition":"Condição de tempo","Title:":"Título:","To:":"Para:","Trigger with value":"Trigger com valor",Triggered:P6,Triggers:F6,"Triggers the on script saving or the javascript instance restart":"Aciona o salvamento do script ou a reinicialização da instância javascript","Triggers the rule on update or change of some state":"Aciona a regra na atualização ou mudança de algum estado","Triggers the rule periodically or on some specific time":"Aciona a regra periodicamente ou em algum momento específico",Tu:j6,Tuesday:z6,URL:U6,"Unknown error":"Erro desconhecido","Unknown error!":"Erro desconhecido!","Use generated code":"Usar código gerado","User function":"Função do usuário","User:":"Do utilizador:",Value:H6,"Vibration:":"Vibração:",Volume:W6,We:V6,Wednesday:G6,"Whatsapp-cmb":"Whatsapp-cmb",Write:K6,"Write your own code":"Escreva seu próprio código",Yes:Y6,"Yet exists!":"Ainda existe!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"Você pode usar %s na URL para usar o valor do gatilho atual, %id para usar o ID do objeto acionado, %name para mostrar o nome do ID do objeto acionado ou %old para usar o valor do gatilho antigo","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"Você pode usar %s no comando para usar o valor do acionador atual, %id para usar o ID do objeto acionado, %name para mostrar o nome do ID do objeto acionado ou %old para usar o valor do acionador antigo","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"Você pode usar %s no texto para exibir o valor do acionador atual, %id para usar o ID do objeto acionado, %name para mostrar o nome do ID do objeto acionado ou %old para usar o valor do acionador antigo","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"Você pode usar %s no valor para usar o valor do acionador atual, %id para usar o ID do objeto acionado, %name para mostrar o nome do ID do objeto acionado ou %old para usar o valor do acionador antigo","You have to enter OpenAI API key in the configuration of javascript adapter.":"Você deve inserir a chave da API OpenAI na configuração do adaptador javascript.","[equal]":"[igual]","[greater or equal]":"[maior ou igual]","[greater]":"[maior]","[hysteresis]":"[histerese]","[includes]":"[inclui]","[less or equal]":"[menor ou igual]","[less]":"[menos]","[not equal]":"[não igual]",acknowledgment:J6,all:X6,and:q6,astro:Z6,at:Q6,"clear running":"corrida limpa",control:e9,copy:t9,cron:s9,dawn:o9,debug_help:i9,debug_label:n9,default:"predefinição",dusk:r9,easy:a9,else:"outro","equal to":"igual a",every:l9,"every hour at 0 minutes":"a cada hora em 0 minutos",false:"falso","file reading has failed: %s":"a leitura do arquivo falhou: %s","file reading was aborted":"a leitura do arquivo foi abortada",filter_func:c9,filter_id:u9,filter_name:d9,filter_role:h9,filter_room:p9,"for edit or create script":"para editar ou criar um novo script","for professionals":"para profissionais","for programmers":"para programadores",goldenHour:g9,goldenHourEnd:m9,"greater or equal":"maior ou igual","greater or equal to":"maior ou igual a","greater than":"Maior que",help_just_check:f9,help_on_change:$9,"high priority":"prioridade máxima","high-priority":"prioridade máxima","highest priority":"Prioridade máxima",hours:b9,includes:v9,interval:y9,"just check":"Apenas verifique","less or equal":"menor ou igual","less or equal to":"menor ou igual a","less than":"Menor que","lower priority":"prioridade mais baixa","lowest priority":"prioridade mais baixa",magic:_9,milliseconds:w9,minutes:C9,ms:T9,nadir:k9,nauticalDawn:S9,nauticalDusk:E9,nextSunrise:I9,nextSunset:x9,night:D9,nightEnd:A9,"no blocks found":"Nenhum bloco encontrado","no group":"SEM GRUPO",normal:R9,"normal priority":"prioridade normal","not equal to":"não é igual a","not properly connected":"Este bloco não está conectado corretamente com outros blocos.",offset:O9,"on change":"em mudança","on condition change":"na mudança de condição","on update":"em atualização",one:M9,or:N9,quiet:L9,"reset search":"redefinir pesquisa",search:B9,seconds:P9,solarNoon:F9,"store in":"armazenar em",sunrise:j9,sunriseEnd:z9,sunset:U9,sunsetStart:H9,then:W9,"toggle value":"valor de alternância",tooltip_ack:V9,tooltip_from:G9,tooltip_lc:K9,tooltip_quality:Y9,tooltip_ts:J9,tooltip_user:X9,tooltip_value:q9,true:"verdade",two:Z9,undefined:"Indefinido",update:Q9,"use seconds":"use segundos","use trigger value":"use o gatilho",verbose_help:eK,verbose_label:tK,when:sK,with:"com","with date":"com data","with offset":"com deslocamento",wizard:oK},nK="Подтверждение",rK="Действия",aK="Добавить",lK="Все",cK="Любая",uK="Применить",dK="Апрель",hK="Спросить",pK="Aстрономический",gK="Август",mK="Отмена",fK="Закрыть",$K="Условие",bK="Условия",vK="Приставка",yK="Скопировано",_K="Декабрь",wK="Дефолт",CK="Задержка",TK="Удалить",kK="Описание",SK="Готово",EK="Исполнить shell",IK="Объяснение",xK="Экспорт",DK="Февраль",AK="Февраль",RK="Фильтр",OK="Папка",MK="Пт",NK="пятница",LK="ID",BK="ID1",PK="ID2",FK="Импорт",jK="Экземпляр",zK="Экземпляры",UK="Инструкции",HK="Январь",WK="Январь",VK="Июль",GK="Июнь",KK="Предел",YK="Март",JK="Май",XK="Меню",qK="Сообщение",ZK="Пн",QK="Модель",e7="понедельник",t7="Месяц",s7="Более",o7="Имя",i7="Ноябрь",n7="Ок",r7="Октябрь",a7="Ok",l7="Пауза",c7="Pushover",u7="Pushsafer",d7="Переименовать",h7="Повторение",p7="Перезапустить",g7="Результат",m7="Сб",f7="суббота",$7="Сохранить",b7="Расписание",v7="скрипт",y7="Сентябрь",_7="Симулировать",w7="Stack",C7="Начинать",T7="Состояние",k7="Вс",S7="Воскресенье",E7="Telegram",I7="Чт",x7="Четверг",D7="Время",A7="Срабатывает",R7="Триггеры",O7="Вт",M7="вторник",N7="URL",L7="Значение",B7="Громкость",P7="Ср",F7="среда",j7="Напишите",z7="Да",U7="подтверждение",H7="все",W7="и",V7="Астро",G7="в",K7="контроль",Y7="копия",J7="CRON",X7="Рассвет",q7="Это особый режим, в котором состояния и объекты не будут меняться. Но в протоколе будет отображаться только информация о каждом планируемом изменении.",Z7="Отлаживать",Q7="Сумерки",eY="легкий",tY="каждые(ый)",sY="Функция",oY="ID",iY="Название",nY="Роль",rY="Комната",aY="Золотой час",lY="Конец золотого часа",cY="Код будет выполняться только каждый раз, когда условие истинно. Например. при срабатывании по значению датчика температуры и условию «если температура выше 20°C», действия «затем» будут выполняться каждый раз, когда датчик отправляет значение температуры, и оно превышает 20°C. На 21°С, на 22°С и так далее.",uY="Код будет выполнен только в случае изменения результата условия. Например, при срабатывании по значению датчика температуры и условию «если температура больше 20°C», действия «затем» будут выполнены один раз, когда температура превысит 20°C. В следующий раз действия «затем» будут выполнены, когда температура опустится ниже 20°C, а затем снова поднимается выше 20°C.",dY="час(ов)",hY="содержит",pY="интервал",gY="магия",mY="миллисекунды",fY="минут(у)",$Y="мс",bY="Надир",vY="Морской рассвет",yY="Морские сумерки",_Y="Следующий восход",wY="Следующий закат",CY="Ночь",TY="Конец ночи",kY="нормальный",SY="сдвиг",EY="один",IY="или",xY="тихий",DY="поиск",AY="секунд",RY="Солнечный полдень",OY="Восход солнца",MY="Конец восхода",NY="Закат солнца",LY="Начало заката",BY="тогда",PY="Подтверждено",FY="От",jY="Последнее изменение",zY="Качественный",UY="Время",HY="Пользователь",WY="Значение",VY="два",GY="обновить",KY="Добавляет вывод отладки в журнал для многих системных команд.",YY="Подробный протокол",JY="если",XY="Мастер",qY={"%s not found":"%s не найден","()":"()","(at %s)":"(в %s)","(optional)":"(необязательный)","-":"-",".":".","AI code generator":"ИИ Генератор кода",Ack:nK,Actions:rK,"Actual time of day":"Фактическое время суток",Add:aK,"Add new script":"Добавить новый скрипт",All:lK,"All files will be accepted":"Все файлы будут приняты",Any:cK,"Any month":"В любой месяц",Apply:uK,April:dK,"Are you sure?":"Вы уверены?",Ask:hK,Astronomical:pK,"Astronomical events today":"Астрономические события сегодня",August:gK,"Blockly description":"Создание правил графическими блоками","Body:":"Тело:",Cancel:mK,"Cannot delete non empty item!":"Не удается удалить непустой элемент!","Change layout":"Изменить макет",'Change theme (actual "%s")':'Сменить тему (сейчас - "%s")',"Check blocks":"Проверить блоки","Check is not active, because javascript adapter is disabled":"Проверка неактивна, потому что адаптер Javascript отключен","Clear search input":"Очистить ввод","Click on this icon":"Нажмите на этот значок",Close:fK,"Close all but current":"Закрыть все кроме текущего","Collapse all":"Свернуть все","Compares current time with astronomical event":"Сравнивает текущее время с астрономическим событием","Compares current time with the user specific time":"Сравнивает текущее время с конкретным временем пользователя","Compares the state value with user defined value":"Сравнивает значение состояния с пользовательским значением",Condition:$K,Conditions:bK,"Configuration not saved.":"Конфигурация не сохранена.",Console:vK,"Control or update some state":"Контролировать или обновлять какое-то состояние","Control or update some state with delay":"Контролировать или обновлять какое-либо состояние с задержкой","Convert blockly to javascript for ever.":"Преобразовать blockly в Javascript навсегда.",Copied:yK,"Copy script":"Скопировать скрипт","Copy to clipboard":"Скопировать в буфер обмена","Create new":"Создать новый","Create new folder":"Создать новую папку","Create new script":"Создать новый скрипт","Create or edit CRON or time wizard":"Создание или редактирование CRON или мастера времени","Dark Theme":"Тёмная тема","Dark style":"Темный стиль",Date:"Дата","Debug instance":"Экземпляр отладки","Debug options":"Варианты отладки",December:_K,Default:wK,"Define cron...":"Задать правило ...","Define schedule...":"Задать расписание...",Delay:CK,Delete:TK,"Delete %s":"Удалить %s...","Delete folder":"Удалить папку","Delete script":"Удалить скрипт",Description:kK,"Deselect all":"Снять выбор со всех","Discard changes for %s":"Отменить изменения для %s",Done:SK,"Double click to write value":"Двойной щелчок для записи значения","Download as file":"Скачать как файл","Drop some files here or click...":"Перетыщите сюда файлы или нажмите ...","Duplicate name":"Повторяющееся имя","Edit script or just double click":"Редактировать скрипт или просто дважды щелкнуть","Empty name is not allowed":"Пустое имя не допускается","End search mode":"Закончить поиск","Enter your question":"Введи свою просьбу",Error:"Ошибка","Error formatting code":"Ошибка форматирования кода","Error was found":"Ошибка была найдена","Every day":"Каждый день",Exec:EK,"Executes some shell command":"Выполняет некоторую команду оболочки","Existing scripts will be overwritten.":"Существующие скрипты будут перезаписаны.","Expand all":"Открыть все","Expert mode":"Экспертный режим",Explanation:IK,Export:xK,"Export all scripts":"Экспорт всех скриптов","Export blocks":"Экспортировать блоки","Export selected blocks":"Экспортировать выбранные блоки",Februar:DK,February:AK,Filter:RK,Folder:OK,Fr:MK,Friday:NK,Function:"Функция","Function editor":"Редактор функции","Function: executed":"Функция: выполнено","Go to next line":"Перейти к следующей строке","HTTP Call":"HTTP-вызов","Hide logs":"Скрыть журналы",ID:LK,ID1:BK,ID2:PK,Import:FK,"Import blocks":"Импортировать блоки","Import error":"Ошибка импорта","Import scripts":"Импорт скриптов","Insert object ID":"Вставить ID объекта",Instance:jK,"Instance is disabled":"Экземпляр отключен","Instance:":"Пример:",Instances:zK,Instructions:UK,"Invalid CRON":"Неправильный CRON","It will not be possible to revert this operation.":"Невозможно вернуть эту операцию.","JS description":"Создание правил путём написания Javascript",Januar:HK,January:WK,July:VK,June:GK,"Just check":"Просто проверить","Language:":"Язык:","Learn More":"Узнать больше","Light style":"Светлый стиль",Limit:KK,"Local time":"Местное время","Locate file":"Показать файл в дереве","Log outputs":"Журнал","Log text":"Текст журнала","Log: %s":"Журнал: %s","Make a HTTP get request":"Сделайте HTTP-запрос на получение","Make a pause between actions":"Сделайте паузу между действиями",March:YK,"March ":"Март ",May:JK,Menu:XK,Message:qK,Mo:ZK,Model:QK,Monday:e7,Month:t7,More:s7,Name:o7,"No Chat GPT Key found":"Ключ GPT для чата не найден","No active host found":"Активный host не найден","Nothing found":"Ничего не найдено",November:i7,OK:n7,October:r7,Ok:a7,"On condition change":"При изменении реузльтата условий","On script save or adapter start":"При сохранении скрипта или запуске адаптера","On weekdays":"По дням недели","Open configuration":"Открыть настройки","Operate two states":"Операции над двумя состояниями","Operations with two states":"Операции с двумя состояниями","Paste your blocks here":"Вставьте свои блоки сюда",Pause:l7,"Pause execution":"Приостановить выполнение","Pause script":"Остановить скрипт","Phone:":"Телефон:","Please select object ID...":"Пожалуйста, выберите ID объекта ...","Press Ctrl+Enter to get the answer":"Нажмите Ctrl+Enter, чтобы получить ответ","Prettify the script":"Украсьте сценарий","Print some text in log":"Напечатать текст в журнале","Priority:":"Приоритет:",Pushover:c7,Pushsafer:u7,"Read only ID selected: %s":"Выбран идентификатор только для чтения: %s",Rename:d7,"Reorder scripts in folders":"Сортировать скрипты в папках",Repeat:h7,Restart:p7,Result:g7,"Resume execution":"Возобновить выполнение","Root folder":"Корневая папка","Rules description":"Создавайте правила с блоками ЕСЛИ, ТО, ИНАЧЕ","Run script":"Запустить скрипт",Sa:m7,Saturday:f7,Save:$7,"Save all":"Сохранить все","Say It":"Say It","Say some text via sayit adapter":"Произнесите текст через адаптер Sayit",Schedule:b7,Script:v7,"Script %s was modified on disk":'Скрипт "%s" был изменен на диске',"Script is not running":"Сценарий не запущен","Search in scripts":"Поиск в скриптах","Search...":"Поиск...","Select all":"Выбрать все","Send email":"Отправить email","Sends an email":"Отправляет электронное письмо","Sends message via Pushsafer":"Отправляет сообщение через Pushsafer","Sends message via pushover":"Отправляет сообщение через пустышку","Sends message via telegram":"Отправляет сообщение в телеграмме","Sends message via whatsapp-cmb":"Отправляет сообщение через whatsapp-cmb",September:y7,"Server time":"Время сервера","Set state action":"Установить состояние","Set with delay":"Установить с задержкой","Shell command":"Команда оболочки","Show astronomical events":"Показать астрономические события","Show javascript code":"Показать код Javascript","Show logs":"Показать журналы","Show only paused scripts":"Показывать только приостановленные сценарии","Show only running scripts":"Показывать только запущенные скрипты","Show only scripts with problems":"Показывать только скрипты с проблемами",Simulate:_7,"Some files will be rejected":"Некоторые файлы будут отклонены","Sound:":"Звук:",Stack:w7,Start:C7,"Start script":"Старт скрипта",State:T7,"State condition":"Сравнение состояния","Step into function":"Шаг в функционирование","Step out from function":"Выйти из функции","Stop on exception":"Остановить при исключении",Su:k7,"Subject:":"Предмет:",Sunday:S7,"TS description":"Создание правил путём написания Typescript",Telegram:E7,"Text:":"Текст:",Th:I7,"The script will be stopped and must be activated manually after debugging. Continue?":"Cкрипт будет остановлен и должен быть активирован вручную после отладки. Продолжать?","This is advances option. You can write your own code here and it will be executed on trigger":"Это расширеный вариант. Вы можете написать здесь свой код и он будет выполняться по триггеру",Thursday:x7,Time:D7,"Time condition":"Условие времени","Title:":"Заголовок:","To:":"К:","Trigger with value":"Триггер со значением",Triggered:A7,Triggers:R7,"Triggers the on script saving or the javascript instance restart":"Запускает при сохранении скрипта или перезапуске экземпляра javascript","Triggers the rule on update or change of some state":"Запускает правило при обновлении или изменении какого-либо состояния","Triggers the rule periodically or on some specific time":"Срабатывает правило периодически или в определенное время",Tu:O7,Tuesday:M7,URL:N7,"Unknown error":"Неизвестная ошибка","Unknown error!":"Неизвестная ошибка!","Use generated code":"Использовать сгенерированный код","User function":"Функция пользователя","User:":"Пользователь:",Value:L7,"Vibration:":"Вибрация:",Volume:B7,We:P7,Wednesday:F7,"Whatsapp-cmb":"Whatsapp-cmb",Write:j7,"Write your own code":"Напишите свой код",Yes:z7,"Yet exists!":"Имя уже существует!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"Вы можете использовать %s в URL-адресе, чтобы использовать текущее значение триггера, %id, чтобы использовать идентификатор инициированного объекта, %name, чтобы показать имя идентификатора инициированного объекта, или %old, чтобы использовать старое значение триггера.","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"Вы можете использовать %s в команде, чтобы использовать текущее значение триггера, %id, чтобы использовать идентификатор сработавшего объекта, %name, чтобы показать имя сработавшего идентификатора объекта, или %old, чтобы использовать старое значение триггера.","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"Вы можете использовать %s в тексте для отображения текущего значения триггера, %id для использования идентификатора сработавшего объекта, %name для отображения имени сработавшего идентификатора объекта или %old для использования старого значения триггера.","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"Вы можете использовать %s в значении, чтобы использовать текущее значение триггера, %id, чтобы использовать идентификатор инициированного объекта, %name, чтобы показать имя идентификатора инициированного объекта, или %old, чтобы использовать старое значение триггера.","You have to enter OpenAI API key in the configuration of javascript adapter.":"Вы должны ввести ключ OpenAI API в конфигурации адаптера javascript.","[equal]":"[равно]","[greater or equal]":"[больше или равно]","[greater]":"[больше]","[hysteresis]":"[гистерезис]","[includes]":"[содержит]","[less or equal]":"[меньше или равно]","[less]":"[меньше]","[not equal]":"[не равно]",acknowledgment:U7,all:H7,and:W7,astro:V7,at:G7,"clear running":"остановить уже бегущие",control:K7,copy:Y7,cron:J7,dawn:X7,debug_help:q7,debug_label:Z7,default:"дефолт",dusk:Q7,easy:eY,else:"иначе","equal to":"равно",every:tY,"every hour at 0 minutes":"каждый час через 0 минут",false:"false","file reading has failed: %s":"Ошибка чтения файла: %s","file reading was aborted":"Чтение файла было прервано",filter_func:sY,filter_id:oY,filter_name:iY,filter_role:nY,filter_room:rY,"for edit or create script":"для редактирования или создайте новый скрипт","for professionals":"для профессионалов","for programmers":"для программистов",goldenHour:aY,goldenHourEnd:lY,"greater or equal":"больше или равно","greater or equal to":"больше или равно","greater than":"больше чем",help_just_check:cY,help_on_change:uY,"high priority":"высокий приоритет","high-priority":"высокий-приоритет","highest priority":"высший приоритет",hours:dY,includes:hY,interval:pY,"just check":"просто проверить","less or equal":"меньше или равно","less or equal to":"меньше или равно","less than":"меньше, чем","lower priority":"более низкий приоритет","lowest priority":"самый низкий приоритет",magic:gY,milliseconds:mY,minutes:fY,ms:$Y,nadir:bY,nauticalDawn:vY,nauticalDusk:yY,nextSunrise:_Y,nextSunset:wY,night:CY,nightEnd:TY,"no blocks found":"Блоков нет","no group":"Нет группы",normal:kY,"normal priority":"нормальный приоритет","not equal to":"не равно","not properly connected":"Этот блок неправильно соединён или не соединён с другими блоками.",offset:SY,"on change":"по изменению","on condition change":"при изменении результата условия","on update":"при обновлении",one:EY,or:IY,quiet:xY,"reset search":"Cбросить поиск",search:DY,seconds:AY,solarNoon:RY,"store in":"сохранить в",sunrise:OY,sunriseEnd:MY,sunset:NY,sunsetStart:LY,then:BY,"toggle value":"инвертировать текщее значение",tooltip_ack:PY,tooltip_from:FY,tooltip_lc:jY,tooltip_quality:zY,tooltip_ts:UY,tooltip_user:HY,tooltip_value:WY,true:"true",two:VY,undefined:"неопределенный",update:GY,"use seconds":"использовать секунды","use trigger value":"использовать значение триггера",verbose_help:KY,verbose_label:YY,when:JY,with:"с","with date":"с датой","with offset":"со сдвигом",wizard:XY},ZY="Визнано",QY="Дії",eJ="додати",tJ="все",sJ="Будь-який",oJ="Застосувати",iJ="квітень",nJ="Запитуйте",rJ="Астрономічний",aJ="серпень",lJ="Скасувати",cJ="Закрити",uJ="Хвороба",dJ="Умови",hJ="Консоль",pJ="Скопійовано",gJ="Грудень",mJ="За замовчуванням",fJ="Затримка",$J="Видалити",bJ="опис",vJ="Готово",yJ="Виконавча оболонка",_J="Пояснення",wJ="Експорт",CJ="Лютий",TJ="Лютий",kJ="фільтр",SJ="Папка",EJ="О",IJ="П'ятниця",xJ="ID",DJ="ID1",AJ="ID2",RJ="Імпорт",OJ="Екземпляр",MJ="Примірники",NJ="Інструкції",LJ="січень",BJ="січня",PJ="липень",FJ="червень",jJ="Ліміт",zJ="березень",UJ="Може",HJ="Меню",WJ="повідомлення",VJ="пн",GJ="Модель",KJ="понеділок",YJ="місяць",JJ="Більше",XJ="Ім'я",qJ="Листопад",ZJ="в порядку",QJ="жовтень",eX="В порядку",tX="Пауза",sX="Pushover",oX="Pushsafer",iX="Перейменувати",nX="Повторіть",rX="Перезапустіть",aX="Результат",lX="Sa",cX="Субота",uX="зберегти",dX="розклад",hX="Сценарій",pX="Вересень",gX="Симулювати",mX="Стек",fX="старт",$X="Держава",bX="Нд",vX="неділя",yX="Телеграма",_X="чт",wX="четвер",CX="час",TX="Спрацьовує",kX="Тригери",SX="вт",EX="вівторок",IX="URL",xX="Значення",DX="Обсяг",AX="ми",RX="Середа",OX="Напишіть",MX="Так",NX="підтвердження",LX="все",BX="і",PX="Астро",FX="в",jX="КОНТРОЛЬ",zX="копія",UX="CRON",HX="Світанок",WX="Це особливий режим, в якому стану та об'єкти не змінюватимуться. Але в протоколі відображатиметься лише інформація про кожну заплановану зміну.",VX="Відлагоджувати",GX="Сутінки",KX="легко",YX="кожен",JX="функція",XX="ID",qX="Ім'я",ZX="Роль",QX="Кімната",eq="Золота година",tq="Кінець золотої години",sq="Код буде виконуватися лише щоразу, коли умова виконується. наприклад якщо спрацьовує значення датчика температури та умова «якщо температура перевищує 20°C», дії «тоді» виконуватимуться щоразу, коли датчик надсилає температуру, і вона перевищує 20°C. На 21°C, на 22°C і так далі.",oq="Код буде виконано лише у разі зміни результату умови. наприклад якщо спрацьовує значення датчика температури та умова «якщо температура перевищує 20°C», дії «тоді» будуть виконані один раз, коли температура буде вище 20. Наступного разу дії «тоді» буде виконано, коли температура падає нижче 20, а потім знову піднімається вище 20.",iq="години",nq="включає в себе",rq="інтервал",aq="магія",lq="мілісекунд",cq="хвилин",uq="РС",dq="Надір",hq="Морський світанок",pq="Морські сутінки",gq="Наступний схід сонця",mq="Наступний захід сонця",fq="ніч",$q="Кінець ночі",bq="нормально",vq="зсув",yq="один",_q="або",wq="тихо",Cq="пошук",Tq="секунд",kq="Сонячний полудень",Sq="схід сонця",Eq="Кінець сходу сонця",Iq="Захід сонця",xq="Початок заходу сонця",Dq="потім",Aq="Визнати",Rq="Від",Oq="Востаннє змінено",Mq="якість",Nq="Мітка часу",Lq="Користувач",Bq="Значення",Pq="два",Fq="оновлення",jq="Додає вихідні дані налагодження до журналу для багатьох системних команд",zq="Докладні результати журналу",Uq="коли",Hq="майстер",Wq={"%s not found":"%s не знайдено","()":"()","(at %s)":"(у %s)","(optional)":"(необов'язково)","-":"-",".":".","AI code generator":"Генератор коду ШІ",Ack:ZY,Actions:QY,"Actual time of day":"Фактичний час доби",Add:eJ,"Add new script":"Додати новий сценарій",All:tJ,"All files will be accepted":"Усі файли будуть прийняті",Any:sJ,"Any month":"Будь-який місяць",Apply:oJ,April:iJ,"Are you sure?":"Ти впевнений?",Ask:nJ,Astronomical:rJ,"Astronomical events today":"Астрономічні події сьогодні",August:aJ,"Blockly description":"Створення правил за графічними блоками","Body:":"Тіло:",Cancel:lJ,"Cannot delete non empty item!":"Неможливо видалити непорожній елемент!","Change layout":"Змінити макет",'Change theme (actual "%s")':'Змінити тему (тепер - "%s")',"Check blocks":"Перевірте блоки","Check is not active, because javascript adapter is disabled":"Перевірка не активна, оскільки адаптер Javascript вимкнено","Clear search input":"Очистити пошуковий запит","Click on this icon":"Натисніть на цей значок",Close:cJ,"Close all but current":"Закрити всі, крім поточних","Collapse all":"Закрити всі","Compares current time with astronomical event":"Порівнює поточний час з астрономічною подією","Compares current time with the user specific time":"Порівнює поточний час із конкретним часом користувача","Compares the state value with user defined value":"Порівнює значення стану з визначеним користувачем значенням",Condition:uJ,Conditions:dJ,"Configuration not saved.":"Конфігурація не збережена.",Console:hJ,"Control or update some state":"Контролюйте або оновлюйте певний стан","Control or update some state with delay":"Контролюйте або оновлюйте деякий стан із затримкою","Convert blockly to javascript for ever.":"Назавжди конвертуйте Blockly у Javascript.",Copied:pJ,"Copy script":"Копіювати сценарій","Copy to clipboard":"Копіювати в буфер обміну","Create new":"Створити новий","Create new folder":"Створити нову папку","Create new script":"Створіть новий сценарій","Create or edit CRON or time wizard":"Створення або редагування CRON або майстра часу","Dark Theme":"Темна тема","Dark style":"Темний стиль",Date:"Дата","Debug instance":"Екземпляр налагодження","Debug options":"Параметри налагодження",December:gJ,Default:mJ,"Define cron...":"Визначити cron...","Define schedule...":"Визначити розклад...",Delay:fJ,Delete:$J,"Delete %s":"Видалити %s...","Delete folder":"Видалити папку","Delete script":"Видалити сценарій",Description:bJ,"Deselect all":"Зняти вибір із усіх","Discard changes for %s":"Скасувати зміни для %s",Done:vJ,"Double click to write value":"Двічі клацніть, щоб записати значення","Download as file":"Завантажити файл","Drop some files here or click...":"Перетягніть кілька файлів сюди або натисніть...","Duplicate name":"Повторюване ім'я","Edit script or just double click":"Відредагуйте сценарій або просто двічі клацніть","Empty name is not allowed":"Порожнє ім'я не допускається","End search mode":"Завершити режим пошуку","Enter your question":"Введи своє прохання",Error:"Помилка","Error formatting code":"Помилка форматування коду","Error was found":"Виявлено помилку","Every day":"Кожен день",Exec:yJ,"Executes some shell command":"Виконує певну команду оболонки","Existing scripts will be overwritten.":"Існуючі сценарії буде перезаписано.","Expand all":"Розгорнути все","Expert mode":"Експертний режим",Explanation:_J,Export:wJ,"Export all scripts":"Експортувати всі сценарії","Export blocks":"Експорт блоків","Export selected blocks":"Експортувати вибрані блоки",Februar:CJ,February:TJ,Filter:kJ,Folder:SJ,Fr:EJ,Friday:IJ,Function:"функція","Function editor":"Редактор функцій","Function: executed":"Функція: виконано","Go to next line":"Перейти до наступного рядка","HTTP Call":"Виклик HTTP","Hide logs":"Приховати журнали",ID:xJ,ID1:DJ,ID2:AJ,Import:RJ,"Import blocks":"Імпорт блоків","Import error":"Помилка імпорту","Import scripts":"Імпорт скриптів","Insert object ID":"Вставте ID об'єкта",Instance:OJ,"Instance is disabled":"Примірник вимкнено","Instance:":"екземпляр:",Instances:MJ,Instructions:NJ,"Invalid CRON":"Недійсний CRON","It will not be possible to revert this operation.":"Скасувати цю операцію буде неможливо.","JS description":"Створення правил шляхом написання Javascript",Januar:LJ,January:BJ,July:PJ,June:FJ,"Just check":"Просто перевірте","Language:":"Мову:","Learn More":"Вивчайте більше","Light style":"Легкий стиль",Limit:jJ,"Local time":"Місцевий час","Locate file":"Знайти файл","Log outputs":"Виходи журналу","Log text":"Текст журналу","Log: %s":"Журнал: %s","Make a HTTP get request":"Зробіть HTTP-запит на отримання","Make a pause between actions":"Між діями робіть паузу",March:zJ,"March ":"березень",May:UJ,Menu:HJ,Message:WJ,Mo:VJ,Model:GJ,Monday:KJ,Month:YJ,More:JJ,Name:XJ,"No Chat GPT Key found":"Ключ GPT для чату не знайдено","No active host found":"Активний хост не знайдено","Nothing found":"Нічого не знайдено",November:qJ,OK:ZJ,October:QJ,Ok:eX,"On condition change":"За умови зміни результату","On script save or adapter start":"Під час збереження сценарію або запуску адаптера","On weekdays":"В будні дні","Open configuration":"Відкрита конфігурація","Operate two states":"Керуйте двома станами","Operations with two states":"Операції з двома станами","Paste your blocks here":"Вставте сюди свої блоки",Pause:tX,"Pause execution":"Призупинити виконання","Pause script":"Призупинити сценарій","Phone:":"телефон:","Please select object ID...":"Виберіть ідентифікатор об'єкта...","Press Ctrl+Enter to get the answer":"Натисніть Ctrl+Enter, щоб отримати відповідь","Prettify the script":"Прикрасьте сценарій","Print some text in log":"Надрукувати текст у журналі","Priority:":"Пріоритет:",Pushover:sX,Pushsafer:oX,"Read only ID selected: %s":"Вибрано ідентифікатор лише для читання: %s",Rename:iX,"Reorder scripts in folders":"Зміна порядку сценаріїв у папках",Repeat:nX,Restart:rX,Result:aX,"Resume execution":"Відновити виконання","Root folder":"Коренева папка","Rules description":"Створюйте правила з блоками IF, THEN, ELSE","Run script":"Запустіть сценарій",Sa:lX,Saturday:cX,Save:uX,"Save all":"Зберегти все","Say It":"Скажи це","Say some text via sayit adapter":"Скажіть текст через адаптер sayit",Schedule:dX,Script:hX,"Script %s was modified on disk":"Сценарій %s змінено на диску","Script is not running":"Сценарій не працює","Search in scripts":"Пошук у скриптах","Search...":"пошук...","Select all":"Вибрати все","Send email":"Відправити лист","Sends an email":"Надсилає електронний лист","Sends message via Pushsafer":"Надсилає повідомлення через Pushsafer","Sends message via pushover":"Надсилає повідомлення через pushover","Sends message via telegram":"Надсилає повідомлення через телеграм","Sends message via whatsapp-cmb":"Надсилає повідомлення через whatsapp-cmb",September:pX,"Server time":"Час сервера","Set state action":"Встановити дію стану","Set with delay":"Встановити із затримкою","Shell command":"Команда оболонки","Show astronomical events":"Показати астрономічні події","Show javascript code":"Показати код Javascript","Show logs":"Показати журнали","Show only paused scripts":"Показувати лише призупинені сценарії","Show only running scripts":"Показувати лише запущені сценарії","Show only scripts with problems":"Показувати лише сценарії з проблемами",Simulate:gX,"Some files will be rejected":"Деякі файли буде відхилено","Sound:":"звук:",Stack:mX,Start:fX,"Start script":"Запустити сценарій",State:$X,"State condition":"Стан стану","Step into function":"Крок у функції","Step out from function":"Вийти з функції","Stop on exception":"Зупинка на винятках",Su:bX,"Subject:":"Тема:",Sunday:vX,"TS description":"Створення правил шляхом написання Typescript",Telegram:yX,"Text:":"Текст:",Th:_X,"The script will be stopped and must be activated manually after debugging. Continue?":"Сценарій буде зупинено, і його необхідно активувати вручну після налагодження. Продовжити?","This is advances option. You can write your own code here and it will be executed on trigger":"Це авансовий варіант. Ви можете написати тут свій власний код, і він буде виконано на тригері",Thursday:wX,Time:CX,"Time condition":"Умова часу","Title:":"Назва:","To:":"до:","Trigger with value":"Тригер зі значенням",Triggered:TX,Triggers:kX,"Triggers the on script saving or the javascript instance restart":"Ініціює збереження сценарію або перезапуск екземпляра JavaScript","Triggers the rule on update or change of some state":"Запускає правило при оновленні або зміні якогось стану","Triggers the rule periodically or on some specific time":"Спрацьовує правило періодично або в певний час",Tu:SX,Tuesday:EX,URL:IX,"Unknown error":"Невідома помилка","Unknown error!":"Невідома помилка!","Use generated code":"Використовуйте згенерований код","User function":"Функція користувача","User:":"Користувач:",Value:xX,"Vibration:":"Вібрація:",Volume:DX,We:AX,Wednesday:RX,"Whatsapp-cmb":"Whatsapp-cmb",Write:OX,"Write your own code":"Напишіть власний код",Yes:MX,"Yet exists!":"Все ж існує!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"Ви можете використовувати %s в URL-адресі, щоб використовувати поточне значення тригера, %id, щоб використовувати ідентифікатор активованого об’єкта, %name, щоб показати назву ідентифікатора активованого об’єкта, або %old, щоб використовувати старе значення тригера","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"Ви можете використовувати %s у команді, щоб використовувати поточне значення тригера, %id, щоб використовувати ідентифікатор активованого об’єкта, %name, щоб показати назву ідентифікатора активованого об’єкта, або %old, щоб використовувати старе значення тригера","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"Ви можете використовувати %s у тексті для відображення поточного значення тригера, %id для використання ідентифікатора активованого об’єкта, %name для відображення імені ідентифікатора активованого об’єкта або %old для використання старого значення тригера","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"Ви можете використовувати %s у значенні, щоб використовувати поточне значення тригера, %id, щоб використовувати ідентифікатор активованого об’єкта, %name, щоб показати назву ідентифікатора активованого об’єкта, або %old, щоб використовувати старе значення тригера","You have to enter OpenAI API key in the configuration of javascript adapter.":"Ви повинні ввести ключ OpenAI API у конфігурації адаптера JavaScript.","[equal]":"[рівний]","[greater or equal]":"[більше або дорівнює]","[greater]":"[більший]","[hysteresis]":"[гістерезис]","[includes]":"[включає]","[less or equal]":"[менше або рівно]","[less]":"[менше]","[not equal]":"[не дорівнює]",acknowledgment:NX,all:LX,and:BX,astro:PX,at:FX,"clear running":"чіткий біг",control:jX,copy:zX,cron:UX,dawn:HX,debug_help:WX,debug_label:VX,default:"за замовчуванням",dusk:GX,easy:KX,else:"інше","equal to":"дорівнює",every:YX,"every hour at 0 minutes":"щогодини о 0 хвилин",false:"помилковий","file reading has failed: %s":"не вдалося прочитати файл: %s","file reading was aborted":"читання файлу було перервано",filter_func:JX,filter_id:XX,filter_name:qX,filter_role:ZX,filter_room:QX,"for edit or create script":"для редагування або створення нового сценарію","for professionals":"для професіоналів","for programmers":"для програмістів",goldenHour:eq,goldenHourEnd:tq,"greater or equal":"більший або рівний","greater or equal to":"більше або дорівнює","greater than":"більше, ніж, величніше ніж, крутіший за",help_just_check:sq,help_on_change:oq,"high priority":"високий пріоритет","high-priority":"високий пріоритет","highest priority":"найвищий пріоритет",hours:iq,includes:nq,interval:rq,"just check":"просто перевірте","less or equal":"менше або дорівнює","less or equal to":"менше або дорівнює","less than":"менше ніж","lower priority":"нижчий пріоритет","lowest priority":"найнижчий пріоритет",magic:aq,milliseconds:lq,minutes:cq,ms:uq,nadir:dq,nauticalDawn:hq,nauticalDusk:pq,nextSunrise:gq,nextSunset:mq,night:fq,nightEnd:$q,"no blocks found":"Блоків не знайдено","no group":"НЕМАЄ ГРУПИ",normal:bq,"normal priority":"нормальний пріоритет","not equal to":"не дорівнює","not properly connected":"Цей блок неправильно з’єднаний з іншими блоками.",offset:vq,"on change":"на зміну","on condition change":"про зміну умов","on update":"на оновлення",one:yq,or:_q,quiet:wq,"reset search":"скинути пошук",search:Cq,seconds:Tq,solarNoon:kq,"store in":"зберігати в",sunrise:Sq,sunriseEnd:Eq,sunset:Iq,sunsetStart:xq,then:Dq,"toggle value":"значення перемикання",tooltip_ack:Aq,tooltip_from:Rq,tooltip_lc:Oq,tooltip_quality:Mq,tooltip_ts:Nq,tooltip_user:Lq,tooltip_value:Bq,true:"правда",two:Pq,undefined:"невизначений",update:Fq,"use seconds":"використовуйте секунди","use trigger value":"використовувати значення тригера",verbose_help:jq,verbose_label:zq,when:Uq,with:"з","with date":"з датою","with offset":"зі зміщенням",wizard:Hq},Vq="确认",Gq="动作",Kq="添加",Yq="所有",Jq="任何",Xq="申请",qq="四月",Zq="问",Qq="天文",eZ="八月",tZ="取消",sZ="关闭",oZ="健康)状况",iZ="情况",nZ="安慰",rZ="复制的",aZ="十二月",lZ="默认",cZ="延迟",uZ="删除",dZ="描述",hZ="完成",pZ="执行力",gZ="解释",mZ="导出",fZ="二月",$Z="二月",bZ="筛选",vZ="文件夹",yZ="r",_Z="星期五",wZ="ID",CZ="ID1",TZ="ID2",kZ="导入",SZ="实例",EZ="实例",IZ="指示",xZ="亚努尔",DZ="一月",AZ="七月",RZ="六月",OZ="限制",MZ="三月",NZ="五月",LZ="菜单",BZ="信息",PZ="莫",FZ="模型",jZ="星期一",zZ="月",UZ="更多的",HZ="名称",WZ="十一月",VZ="好的",GZ="十月",KZ="确定",YZ="暂停",JZ="俯卧撑",XZ="推安全",qZ="重命名",ZZ="重复",QZ="重启",eQ="结果",tQ="萨",sQ="星期六",oQ="保存",iQ="日程",nQ="脚本",rQ="九月",aQ="模拟",lQ="堆",cQ="开始",uQ="状态",dQ="苏",hQ="星期日",pQ="电报",gQ="4",mQ="星期四",fQ="时间",$Q="触发",bQ="扳机",vQ="涂",yQ="星期二",_Q="网址",wQ="价值",CQ="体积",TQ="3",kQ="星期三",SQ="写",EQ="是的",IQ="致谢",xQ="全部",DQ="和",AQ="天文",RQ="在",OQ="控制",MQ="复制",NQ="克朗",LQ="黎明",BQ="这是一种特殊模式,其中状态和对象不会改变。但只有有关每个计划更改的信息才会显示在协议中。",PQ="调试",FQ="黄昏",jQ="简单的",zQ="每一个",UQ="功能",HQ="ID",WQ="名字",VQ="角色",GQ="房间",KQ="黄金时段",YQ="黄金时段结束",JQ="仅在条件为真时才执行代码。例如。如果触发温度传感器值并且条件为“如果温度大于20°C”,则每次传感器发送温度且温度超过20°C时,将执行“然后”动作。 21°C,22°C等。",XQ="仅当条件结果更改时,代码才会执行。例如。如果触发温度传感器值且条件为“如果温度大于20°C”,则温度超过20时将执行一次“则”动作,下一次,当温度超过20时将执行“则”动作低于20失败,然后再次超过20。",qQ="小时",ZQ="包括",QQ="间隔",eee="魔法",tee="毫秒",see="分钟",oee="毫秒",iee="最低点",nee="航海黎明",ree="航海黄昏",aee="下一个日出",lee="下一个日落",cee="夜晚",uee="夜晚结束",dee="普通的",hee="抵消",pee="一",gee="或",mee="安静的",fee="搜索",$ee="秒",bee="星期日正午",vee="日出",yee="日出结束",_ee="日落",wee="日落开始",Cee="然后",Tee="确认",kee="从",See="上一次改变",Eee="质量",Iee="时间戳",xee="用户",Dee="值",Aee="二",Ree="更新",Oee="将调试输出添加到许多系统命令的日志中",Mee="详细日志输出",Nee="什么时候",Lee="巫师",Bee={"%s not found":"%s 未找到","()":"()","(at %s)":"(在 %s)","(optional)":"(选修的)","-":"-",".":".","AI code generator":"AI代码生成器",Ack:Vq,Actions:Gq,"Actual time of day":"一天中的实际时间",Add:Kq,"Add new script":"添加新脚本",All:Yq,"All files will be accepted":"所有文件都将被接受",Any:Jq,"Any month":"任何月份",Apply:Xq,April:qq,"Are you sure?":"你确定吗?",Ask:Zq,Astronomical:Qq,"Astronomical events today":"今天的天文事件",August:eZ,"Blockly description":"按图形块创建规则","Body:":"身体:",Cancel:tZ,"Cannot delete non empty item!":"无法删除非空项目!","Change layout":"变更版面",'Change theme (actual "%s")':"更改主题(现在为“%s”)","Check blocks":"检查块","Check is not active, because javascript adapter is disabled":"检查未激活,因为禁用了Javascript适配器","Clear search input":"清除搜索输入","Click on this icon":"单击此图标",Close:sZ,"Close all but current":"关闭所有(当前除外)","Collapse all":"全部收缩","Compares current time with astronomical event":"将当前时间与天文事件进行比较","Compares current time with the user specific time":"将当前时间与用户特定时间进行比较","Compares the state value with user defined value":"比较状态值和用户定义的值",Condition:oZ,Conditions:iZ,"Configuration not saved.":"配置未保存。",Console:nZ,"Control or update some state":"控制或更新某些状态","Control or update some state with delay":"延迟控制或更新某些状态","Convert blockly to javascript for ever.":"立即将blockly转换为Javascript。",Copied:rZ,"Copy script":"复制脚本","Copy to clipboard":"复制到剪贴板","Create new":"创建新的","Create new folder":"创建新文件夹","Create new script":"创建新脚本","Create or edit CRON or time wizard":"创建或编辑周期任务或时间向导","Dark Theme":"深色调主题","Dark style":"深色调风格",Date:"日期","Debug instance":"调试实例","Debug options":"调试选项",December:aZ,Default:lZ,"Define cron...":"定义周期任务...","Define schedule...":"定义调度器......",Delay:cZ,Delete:uZ,"Delete %s":"删除%s...","Delete folder":"删除文件夹","Delete script":"删除脚本",Description:dZ,"Deselect all":"取消全选","Discard changes for %s":"放弃%s的更改",Done:hZ,"Double click to write value":"Double click to write value","Download as file":"档案","Drop some files here or click...":"将文件拖拽到这里或单击......","Duplicate name":"重名","Edit script or just double click":"双击编辑脚本","Empty name is not allowed":"不允许使用空名称","End search mode":"结束搜索模式","Enter your question":"输入您的要求",Error:"错误","Error formatting code":"代码格式错误","Error was found":"发现错误","Every day":"每天",Exec:pZ,"Executes some shell command":"执行一些shell命令","Existing scripts will be overwritten.":"现有脚本将被覆盖。","Expand all":"展开全部","Expert mode":"专家模式",Explanation:gZ,Export:mZ,"Export all scripts":"导出所有脚本","Export blocks":"导出块","Export selected blocks":"导出选定的块",Februar:fZ,February:$Z,Filter:bZ,Folder:vZ,Fr:yZ,Friday:_Z,Function:"功能","Function editor":"功能编辑器","Function: executed":"功能:执行","Go to next line":"转到下一行","HTTP Call":"HTTP呼叫","Hide logs":"隐藏日志",ID:wZ,ID1:CZ,ID2:TZ,Import:kZ,"Import blocks":"导入块","Import error":"导入错误","Import scripts":"导入脚本","Insert object ID":"插入对象ID",Instance:SZ,"Instance is disabled":"实例已禁用","Instance:":"实例:",Instances:EZ,Instructions:IZ,"Invalid CRON":"无效的周期任务","It will not be possible to revert this operation.":"无法恢复此操作。","JS description":"通过编写Javascript来创建规则",Januar:xZ,January:DZ,July:AZ,June:RZ,"Just check":"只是检查","Language:":"语言:","Learn More":"了解更多","Light style":"浅色调风格",Limit:OZ,"Local time":"当地时间","Locate file":"定位文件","Log outputs":"记录输出","Log text":"记录文字","Log: %s":"日志:%s","Make a HTTP get request":"发出HTTP获取请求","Make a pause between actions":"在动作之间暂停",March:MZ,"March ":"行进",May:NZ,Menu:LZ,Message:BZ,Mo:PZ,Model:FZ,Monday:jZ,Month:zZ,More:UZ,Name:HZ,"No Chat GPT Key found":"找不到聊天 GPT 密钥","No active host found":"找不到活动主机","Nothing found":"没有发现",November:WZ,OK:VZ,October:GZ,Ok:KZ,"On condition change":"条件变化时","On script save or adapter start":"在脚本保存或适配器启动时","On weekdays":"在工作日","Open configuration":"开放配置","Operate two states":"操作两种状态","Operations with two states":"具有两种状态的操作","Paste your blocks here":"在此处粘贴您的区块",Pause:YZ,"Pause execution":"暂停执行","Pause script":"暂停脚本","Phone:":"电话:","Please select object ID...":"请选择对象ID...","Press Ctrl+Enter to get the answer":"按 Ctrl+Enter 即可得到答案","Prettify the script":"美化脚本","Print some text in log":"在日志中打印一些文本","Priority:":"优先:",Pushover:JZ,Pushsafer:XZ,"Read only ID selected: %s":"选择的只读ID:%s",Rename:qZ,"Reorder scripts in folders":"重新排序文件夹中的脚本",Repeat:ZZ,Restart:QZ,Result:eQ,"Resume execution":"恢复执行","Root folder":"根文件夹","Rules description":"使用IF,THEN,ELSE块创建规则","Run script":"运行脚本",Sa:tQ,Saturday:sQ,Save:oQ,"Save all":"保存全部","Say It":"Say It","Say some text via sayit adapter":"通过sayit适配器说一些文字",Schedule:iQ,Script:nQ,"Script %s was modified on disk":"脚本%s已在磁盘上修改","Script is not running":"脚本没有运行","Search in scripts":"在脚本中搜索","Search...":"搜索...","Select all":"全选","Send email":"发送电子邮件","Sends an email":"发送邮件","Sends message via Pushsafer":"通过Pushsafer发送消息","Sends message via pushover":"通过推播发送消息","Sends message via telegram":"通过电报发送消息","Sends message via whatsapp-cmb":"通过whatsapp-cmb发送消息",September:rQ,"Server time":"服务器时间","Set state action":"设定状态动作","Set with delay":"延迟设置","Shell command":"Shell命令","Show astronomical events":"显示天文事件","Show javascript code":"显示Javascript代码","Show logs":"显示记录","Show only paused scripts":"仅显示暂停的脚本","Show only running scripts":"仅显示正在运行的脚本","Show only scripts with problems":"仅显示有问题的脚本",Simulate:aQ,"Some files will be rejected":"有些文件将被拒绝","Sound:":"声音:",Stack:lQ,Start:cQ,"Start script":"启动脚本",State:uQ,"State condition":"状态条件","Step into function":"进入功能","Step out from function":"退出函数","Stop on exception":"异常停止",Su:dQ,"Subject:":"学科:",Sunday:hQ,"TS description":"通过编写Typescript来创建规则",Telegram:pQ,"Text:":"文本:",Th:gQ,"The script will be stopped and must be activated manually after debugging. Continue?":"该脚本将停止,并且必须在调试后手动激活。继续?","This is advances option. You can write your own code here and it will be executed on trigger":"这是高级选项。您可以在此处编写自己的代码,它将在触发器上执行",Thursday:mQ,Time:fQ,"Time condition":"时间条件","Title:":"标题:","To:":"到:","Trigger with value":"用值触发",Triggered:$Q,Triggers:bQ,"Triggers the on script saving or the javascript instance restart":"触发脚本保存或javascript实例重启","Triggers the rule on update or change of some state":"在某些状态的更新或更改时触发规则","Triggers the rule periodically or on some specific time":"定期或在特定时间触发规则",Tu:vQ,Tuesday:yQ,URL:_Q,"Unknown error":"未知错误","Unknown error!":"未知错误!","Use generated code":"使用生成的代码","User function":"用户功能","User:":"用户:",Value:wQ,"Vibration:":"振动:",Volume:CQ,We:TQ,Wednesday:kQ,"Whatsapp-cmb":"Whatsapp的cmb",Write:SQ,"Write your own code":"编写自己的代码",Yes:EQ,"Yet exists!":"不存在!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"您可以在 URL 中使用 %s 以使用当前触发值,%id 以使用触发对象 ID,%name 以显示触发对象 ID 名称或 %old 以使用旧触发值","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"您可以在命令中使用 %s 以使用当前触发值,%id 使用触发对象 ID,%name 显示触发对象 ID 名称或 %old 使用旧触发值","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"您可以在文本中使用 %s 显示当前触发值,%id 使用触发对象 ID,%name 显示触发对象 ID 名称或 %old 使用旧触发值","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"您可以在值中使用 %s 以使用当前触发器值,%id 使用触发对象 ID,%name 显示触发对象 ID 名称或 %old 使用旧触发器值","You have to enter OpenAI API key in the configuration of javascript adapter.":"您必须在 javascript 适配器的配置中输入 OpenAI API 密钥。","[equal]":"[平等的]","[greater or equal]":"[大于等于]","[greater]":"[更大]","[hysteresis]":"[磁滞]","[includes]":"[包括]","[less or equal]":"[小于或等于]","[less]":"[较少的]","[not equal]":"[不相等]",acknowledgment:IQ,all:xQ,and:DQ,astro:AQ,at:RQ,"clear running":"畅通无阻",control:OQ,copy:MQ,cron:NQ,dawn:LQ,debug_help:BQ,debug_label:PQ,default:"默认",dusk:FQ,easy:jQ,else:"别的","equal to":"等于",every:zQ,"every hour at 0 minutes":"每小时0分钟",false:"错误的","file reading has failed: %s":"文件读取失败:%s","file reading was aborted":"文件读取中止",filter_func:UQ,filter_id:HQ,filter_name:WQ,filter_role:VQ,filter_room:GQ,"for edit or create script":"用于编辑或创建脚本","for professionals":"对于专业人士","for programmers":"对于程序员",goldenHour:KQ,goldenHourEnd:YQ,"greater or equal":"大于或等于","greater or equal to":"大于或等于","greater than":"比...更棒",help_just_check:JQ,help_on_change:XQ,"high priority":"高优先级","high-priority":"高优先级","highest priority":"最高优先级",hours:qQ,includes:ZQ,interval:QQ,"just check":"只是检查","less or equal":"小于或等于","less or equal to":"小于或等于","less than":"少于","lower priority":"低优先级","lowest priority":"最低优先级",magic:eee,milliseconds:tee,minutes:see,ms:oee,nadir:iee,nauticalDawn:nee,nauticalDusk:ree,nextSunrise:aee,nextSunset:lee,night:cee,nightEnd:uee,"no blocks found":"找不到块","no group":"没有组",normal:dee,"normal priority":"正常优先","not equal to":"不等于","not properly connected":"此块未正确连接到其他块。",offset:hee,"on change":"在变化","on condition change":"在条件变化时","on update":"更新时",one:pee,or:gee,quiet:mee,"reset search":"重置搜索",search:fee,seconds:$ee,solarNoon:bee,"store in":"存放在",sunrise:vee,sunriseEnd:yee,sunset:_ee,sunsetStart:wee,then:Cee,"toggle value":"切换值",tooltip_ack:Tee,tooltip_from:kee,tooltip_lc:See,tooltip_quality:Eee,tooltip_ts:Iee,tooltip_user:xee,tooltip_value:Dee,true:"真的",two:Aee,undefined:"不明确的",update:Ree,"use seconds":"精确到秒","use trigger value":"使用触发值",verbose_help:Oee,verbose_label:Mee,when:Nee,with:"和","with date":"有日期","with offset":"带偏移",wizard:Lee};function Pee(a){const[s,i]=X.useState(""),[r,l]=X.useState("");return H.useEffect(()=>{a.socket.decrypt(a.systemConfig.native.javascriptPassword).then(u=>l(u))},[a.systemConfig,a.socket]),g.jsxs(y.Dialog,{open:!0,onClose:()=>a.onEntered(null),fullWidth:!0,maxWidth:"sm",children:[g.jsx(y.DialogTitle,{children:b.I18n.t("Please enter a password for expert mode")}),g.jsx(y.DialogContent,{children:g.jsx(y.TextField,{autoFocus:!0,margin:"dense",variant:"standard",label:b.I18n.t("Password"),type:"password",fullWidth:!0,value:s,onKeyDown:u=>{u.key==="Enter"&&s&&(u.preventDefault(),u.stopPropagation(),r===s?a.onEntered(s):a.onEntered(""))},onChange:u=>i(u.target.value)})}),g.jsxs(y.DialogActions,{children:[g.jsx(y.Button,{variant:"contained",disabled:!s,onClick:()=>{r===s?a.onEntered(s):a.onEntered("")},startIcon:g.jsx(Do,{}),children:b.I18n.t("Ok")}),g.jsx(y.Button,{color:"grey",variant:"contained",onClick:()=>a.onEntered(null),startIcon:g.jsx(zs,{}),children:b.I18n.t("Cancel")})]})]})}const yr={root:{flexGrow:1,display:"flex",width:"100%",height:"100%"},mainDiv:{width:"100%",height:"100%",overflow:"hidden"},content:a=>({width:"100%",height:"100%",backgroundColor:a.palette.background&&a.palette.background.default,position:"relative"}),menuOpenCloseButton:a=>({position:"absolute",left:0,borderRadius:"0 5px 5px 0",top:6,pt:1,cursor:"pointer",zIndex:1,height:25,width:20,background:a.palette.secondary.main,color:a.palette.primary.main,pl:"3px","&:hover":{color:"white"}}),showLogButton:a=>({position:"absolute",right:3,borderRadius:"5px 5px 0 0",bottom:0,pt:"3px",cursor:"pointer",zIndex:10,height:20,width:25,background:a.palette.secondary.main,color:a.palette.primary.main,pl:1,"&:hover":{color:"white"}})};class Fee extends b.GenericApp{hosts=[];importFile=null;scripts={};confirmCallback=null;changedScripts={};javascriptPassword="";constructor(s){super(s,{Connection:b.AdminConnection,translations:{en:QM,de:G1,es:FF,fr:Rz,it:kW,nl:b5,pl:d8,pt:iK,ru:qY,uk:Wq,"zh-cn":Bee},bottomButtons:!1,socket:{autoSubscribeLog:!0},sentryDSN:window.sentryDSN});const i=window.localStorage.getItem("JS.logSizes");let r=[80,20];if(i)try{r=JSON.parse(i)}catch{}const l=window.localStorage.getItem("JS.splitSizes");let u=[20,80];if(l)try{u=JSON.parse(l)}catch{}this.state={...this.state,splitSizes:u,logSizes:r},window.alert=d=>{console.error(d),this.showJsError(d.toString())}}onScriptsChanged=(s,i)=>{if(!s)return;let r=!1;const l={};s.startsWith("script.js.")&&(i?JSON.stringify(this.scripts[s])!==JSON.stringify(i)&&(this.scripts[s]=i,r=!0,l.scriptsHash=this.state.scriptsHash+1):this.scripts[s]&&(delete this.scripts[s],r=!0,l.scriptsHash=this.state.scriptsHash+1)),r&&this.setState(l)};onInstanceChanged=(s,i)=>{var u;if(!s)return;let r=!1;const l={};if(s.match(/^system\.adapter\.[-_\w\d]+\$/)){if(s.startsWith(`system.adapter.${this.adapterName}.`)){const d=parseInt(s.split(".").pop()||"0",10)||0;if((i==null?void 0:i.type)==="instance")this.state.instances.includes(d)||(l.instances=[...this.state.instances],l.instances.push(d),l.instances.sort(),r=!0,this.socket.subscribeState(`${i._id}.alive`,this.onInstanceAliveChange));else if(!i&&this.state.instances.includes(d)){this.socket.unsubscribeState(`${s}.alive`,this.onInstanceAliveChange),l.instances=[...this.state.instances];const p=l.instances.indexOf(d);l.instances.splice(p,1),r=!0}}(u=i==null?void 0:i.common)!=null&&u.blockly&&(this.confirmCallback=d=>d&&window.location.reload(),l.confirm=b.I18n.t("Some blocks were updated. Reload admin?"),r=!0)}r&&this.setState(l)};onHostChanged=(s,i)=>{if(s&&s.startsWith("system.host.")){if((i==null?void 0:i.type)==="host")this.hosts.includes(s)||(this.hosts.push(s),this.hosts.sort());else if(!i&&this.hosts.includes(s)){const r=this.hosts.indexOf(s);this.hosts.splice(r,1)}}};onConnectionReady(){window.systemLang=this.socket.systemLang,this.setState({ready:!1,scriptsHash:0,instances:[],updating:!1,resizing:!1,selected:null,logMessage:{},editing:[],menuOpened:window.localStorage.getItem("App.menuOpened")!=="false",menuSelectId:"",expertMode:window.localStorage.getItem("App.expertMode")==="true",logHorzLayout:window.localStorage.getItem("App.logHorzLayout")==="true",runningInstances:{},confirm:"",importFile:!1,message:"",searchText:"",hideLog:window.localStorage.getItem("App.hideLog")==="true",debugMode:!1,debugInstance:null,splitSizes:[20,80],password:""},async()=>{var d;const s={},i=await this.subscribeOnInstances();s.instances=i.instances,s.runningInstances=i.runningInstances,this.javascriptPassword=((d=this.socket.systemConfig)==null?void 0:d.native.javascriptPassword)||"",await this.readAdaptersWithBlockly();const r=await this.socket.getHosts();this.hosts=r.map(p=>p._id);const l=await this.readAllScripts();window.localStorage.getItem("App.expertMode")!=="true"&&window.localStorage.getItem("App.expertMode")!=="false"&&!this.javascriptPassword?Object.keys(l).find(p=>p.startsWith("script.js.global.")&&l[p].type==="script")&&(s.expertMode=!0):this.javascriptPassword&&(s.expertMode=!1),this.scripts=l;let u=this.state.scriptsHash;this.compareScripts(l)&&u++,s.scriptsHash=u,s.ready=!0,this.setState(s),await this.socket.subscribeObject("script.*",this.onScriptsChanged),await this.socket.subscribeObject("system.adapter.*",this.onInstanceChanged),await this.socket.subscribeObject("system.host.*",this.onHostChanged)})}async subscribeOnInstances(){const i=(await this.socket.getAdapterInstances(this.adapterName)).map(l=>parseInt(l._id.split(".").pop()||"0")).sort(),r={};i.forEach(l=>r[`system.adapter.${this.adapterName}.${l}`]=!1);for(let l=0;l<i.length;l++){const u=`system.adapter.${this.adapterName}.${i[l]}`,d=`${u}.alive`,p=await this.socket.getState(d);r[u]=p?!!p.val:!1,await this.socket.subscribeState(d,this.onInstanceAliveChange)}return{instances:i,runningInstances:r}}async readAllScripts(){const s=await this.socket.getObjectViewSystem("channel","script.js.","script.js.香"),i=await this.socket.getObjectViewSystem("script","script.js.","script.js.香");return Object.keys(i).forEach(r=>s[r]=i[r]),s}async readAdaptersWithBlockly(){const s=await this.socket.getObjectViewSystem("adapter","system.adapter.","system.adapter.香");return new Promise(i=>je.loadCustomBlockly(s,()=>i()))}onInstanceAliveChange=(s,i)=>{if(s&&(s=s?s.substring(0,s.length-6):"",this.state.runningInstances[s]!==(i?i.val:!1))){const r=JSON.parse(JSON.stringify(this.state.runningInstances));r[s]=i?!!i.val:!1,this.setState({runningInstances:r})}};compareScripts(s){const i=Object.keys(this.scripts),r=Object.keys(s);if(i.length!==r.length)return this.scripts=s,!0;if(JSON.stringify(i)!==JSON.stringify(r))return this.scripts=s,!0;for(let l=0;l<i.length;l++){const u=this.scripts[i[l]].common,d=s[i[l]].common,p=this.scripts[i[l]].native,m=s[i[l]].native;if(u.name!==d.name)return this.scripts=s,!0;if(u.source!==d.source)return this.scripts=s,!0;if(u.engine!==d.engine)return this.scripts=s,!0;if(u.engineType!==d.engineType)return this.scripts=s,!0;if(u.enabled!==d.enabled)return this.scripts=s,!0;if(!!(p!=null&&p.protected)!=!!(m!=null&&m.protected))return this.scripts=s,!0}return!1}async onRename(s,i,r,l){var u;i.trim().endsWith(".")&&(i=i.replace(/\.\s*$/,"_")),console.log(`Rename ${s} => ${i}`),this.setState({updating:!0});try{if(((u=this.scripts[s])==null?void 0:u.type)==="script"){const d=JSON.parse(JSON.stringify(this.scripts[s].common));d.name=r||d.name,l!==void 0&&(d.engine=`system.adapter.javascript.${l}`);const p=i.split(".");p.pop();const m=p.join(".");this.scripts[m]&&this.scripts[m].type==="script"&&(p.pop(),i=`${p.join(".")}.${i.split(".").pop()}`),await this.updateScript(s,i,d)}else await this.renameGroup(s,i,r)}catch(d){d.toString().includes("canceled")||this.showJsError(d)}this.setState({updating:!1})}async renameGroup(s,i,r,l){if(l){if(l.length){let u=l.pop();if(u){const d=await this.socket.getObject(u);if(d){try{await this.socket.delObject(u)}catch{}u=i+u.substring(s.length),d._id=u,d.common=d.common||{},d.common.expert=!0,await this.socket.setObject(u,d),await this.renameGroup(s,i,r,l)}}}}else{l=[],l=Object.keys(this.scripts).filter(d=>d.startsWith(`${s}.`));let u=await this.socket.getObject(s);u=u||{common:{},type:"channel"},u.common.name=r||u.common.name||s.split(".").pop()||"",u._id=i;try{await this.socket.delObject(s)}catch{}try{await this.socket.setObject(i,u),await this.renameGroup(s,i,r,l)}catch(d){console.log(d);const p={_id:i,type:"channel",common:{name:r||s.split(".").pop()||"",expert:!0},native:{}};await this.socket.setObject(i,p),await this.renameGroup(s,i,r,l)}}}async onUpdateScript(s,i){var r;if(((r=this.scripts[s])==null?void 0:r.type)==="script")try{await this.updateScript(s,s,i)}catch(l){l.toString().includes("canceled")||this.showJsError(l)}}onSelect(s){this.scripts[s]&&this.scripts[s].common&&this.scripts[s].type==="script"&&this.setState({selected:s,menuSelectId:s},()=>setTimeout(()=>this.setState({menuSelectId:""}),300))}renderPasswordDialog(){return this.state.showPasswordDialog?g.jsx(Pee,{socket:this.socket,systemConfig:this.socket.systemConfig,onEntered:s=>{s===null?this.setState({showPasswordDialog:!1,expertMode:!1,password:""}):s?this.setState({expertMode:!0,showPasswordDialog:!1,password:s}):this.setState({showPasswordDialog:!1,expertMode:!1,message:b.I18n.t("Wrong password"),password:""})}},"passwordDialog"):null}onExpertModeChange(s){var i;if(this.state.expertMode!==s)if(s&&this.javascriptPassword)this.setState({showPasswordDialog:!0});else{let r=this.state.selected;r&&!s&&((i=this.scripts[r].native)!=null&&i.protected)&&(r=this.state.editing.find(l=>{var u;return this.scripts[l]&&!((u=this.scripts[l].native)!=null&&u.protected)})||null),window.localStorage.setItem("App.expertMode",s?"true":"false"),this.setState({expertMode:s,password:"",selected:r})}}showJsError(s){this.setState({errorText:s?s.toString():""})}showMessage(s){this.setState({message:s?s.toString():""})}onDelete(s){this.socket.delObject(s).catch(i=>this.showJsError(i))}onEdit(s){this.state.selected!==s&&this.setState({selected:s})}onAddNew(s,i,r,l,u,d){const p=new RegExp(`^${s}\\.`);if(Object.keys(this.scripts).find(m=>s===m||p.test(s)))return this.showJsError(b.I18n.t("Yet exists!"));r?this.socket.setObject(s,{_id:s,type:"channel",common:{name:i,expert:!0},native:{}}).then(()=>setTimeout(()=>this.setState({menuSelectId:s},()=>setTimeout(()=>this.setState({menuSelectId:""}),300)),1e3)).catch(m=>this.showJsError(m)):(u==="Blockly"&&!d&&(d=`
1294
+ //${btoa(encodeURIComponent('<xml xmlns="https://developers.google.com/blockly/xml"></xml>'))}`),this.socket.setObject(s,{_id:s,type:"script",common:{name:i,expert:!0,engineType:u||"Javascript/js",enabled:!1,engine:`system.adapter.javascript.${l||0}`,source:d||"",debug:!1,verbose:!1},native:{}}).then(()=>setTimeout(()=>this.onSelect(s),1e3)).catch(m=>this.showJsError(m)))}async updateScript(s,i,r){let l=await this.socket.getObject(s);const u={common:{}};if(r.engine!==void 0&&(u.common.engine=r.engine),r.enabled!==void 0&&(u.common.enabled=r.enabled),r.source!==void 0&&(u.common.source=r.source),r.debug!==void 0&&(u.common.debug=r.debug),r.verbose!==void 0&&(u.common.verbose=r.verbose),u.from="system.adapter.admin.0",s===i&&(l!=null&&l.common)&&r.name===l.common.name){(!r.engineType||r.engineType!==l.common.engineType)&&r.engineType!==void 0&&(u.common.engineType=r.engineType||"Javascript/js"),u.type="script",await this.socket.extendObject(s,u);return}if(l!=null&&l.common){l.common.engineType=r.engineType||l.common.engineType||"Javascript/js",await this.socket.delObject(s),u.common.engine!==void 0&&(l.common.engine=u.common.engine),u.common.enabled!==void 0&&(l.common.enabled=u.common.enabled),u.common.source!==void 0&&(l.common.source=u.common.source),u.common.name!==void 0&&(l.common.name=u.common.name),u.common.debug!==void 0&&(l.common.debug=u.common.debug),u.common.verbose!==void 0&&(l.common.verbose=u.common.verbose),l._rev!==void 0&&delete l._rev,l.common.name=r.name,l.common.expert=!0,l.type="script",l._id=i,await this.socket.setObject(i,l);return}l=u,l.common.name=r.name,l.common.expert=!0,l.type="script",l._id=i,await this.socket.setObject(i,l)}onEnableDisable(s,i){var r;if(((r=this.scripts[s])==null?void 0:r.type)==="script"){const l=this.scripts[s].common;l.enabled=i,l.expert=!0,this.updateScript(s,s,l).catch(u=>u!=="canceled"&&this.showJsError(u))}}async getLiveHost(){for(let s=0;s<this.hosts.length;s++){const i=this.hosts[s],r=await this.socket.getState(`${i}.alive`);if(r&&(r!=null&&r.val))return i}}async onExport(){const s=await this.getLiveHost();if(!s){this.showJsError(b.I18n.t("No active host found"));return}const i=new Date;let r=i.getFullYear().toString(),l=i.getMonth()+1;l<10&&(l=`0${l}`),r+=`-${l}`,l=i.getDate(),l<10&&(l=`0${l}`),r+=`-${l}-`,this.socket.getRawSocket().emit("sendToHost",s,"readObjectsAsZip",{adapter:"javascript",id:"script.js",link:`${r}scripts.zip`,fileStorageNamespace:`admin.${this.instance}`},u=>{if(typeof u=="string"){const d=document.createElement("a");d.href=`../../files/${u}`,document.body.appendChild(d),d.click(),d.remove()}else if(u.error&&this.showJsError(u.error),u.data){const d=document.createElement("a");d.href=`data: application/zip;base64,${u.data}`,d.download=`${r}scripts.zip`,document.body.appendChild(d),d.click(),d.remove()}})}onImport(s){this.importFile=s||null,s?(this.confirmCallback=this.onImportConfirmed.bind(this),this.setState({importFile:!1,confirm:b.I18n.t("Existing scripts will be overwritten.")})):this.setState({importFile:!1})}async onImportConfirmed(s){let i=this.importFile;if(this.importFile=null,s&&i){i=i.split(",")[1];const r=await this.getLiveHost();if(!r){this.showJsError(b.I18n.t("No active host found"));return}this.socket.getRawSocket().emit("sendToHost",r,"writeObjectsAsZip",{data:i,adapter:"javascript",id:"script.js"},l=>{l==="permissionError"?this.showJsError(b.I18n.t(l)):!l||l.error?this.showJsError(l?b.I18n.t(l.error||""):b.I18n.t("Unknown error")):this.showMessage(b.I18n.t("Done"))})}}toggleLogLayout(){window.localStorage.setItem("App.logHorzLayout",this.state.logHorzLayout?"false":"true"),this.setState({logHorzLayout:!this.state.logHorzLayout})}renderEditor(){var i;const s=Object.keys(this.scripts).reduce((r,l)=>r+(this.scripts[l].common.engineType==="Rules"?1:0),0);return g.jsx(ln,{scriptsHash:this.state.scriptsHash,debugMode:this.state.debugMode,onDebugModeChange:r=>{r?this.setState({debugMode:!0}):this.setState({debugMode:!1,debugInstance:null})},visible:!this.state.resizing,socket:this.socket,adapterName:this.adapterName,onLocate:r=>this.setState({menuSelectId:r}),password:this.state.password,runningInstances:this.state.runningInstances,menuOpened:this.state.menuOpened,searchText:this.state.searchText,themeType:this.state.themeType,themeName:this.state.themeName,theme:this.state.theme,expertMode:this.state.expertMode,onChange:(r,l)=>this.onUpdateScript(r,l),isAnyRulesExists:s,debugInstance:this.state.debugInstance,onSelectedChange:(r,l)=>{const u={};let d=!1;r!==this.state.selected&&(d=!0,u.selected=r),JSON.stringify(l)!==JSON.stringify(this.state.editing)&&(d=!0,u.editing=[...l]),d&&this.setState(u)},onRestart:r=>this.socket.extendObject(r,{common:{enabled:!0}}),selected:this.state.selected&&((i=this.scripts[this.state.selected])==null?void 0:i.type)==="script"?this.state.selected:"",objects:this.scripts,resizing:this.state.resizing,onChangedChanged:r=>this.changedScripts=r},"editor")}showLogButton(){return g.jsx(y.Box,{title:b.I18n.t("Show logs"),sx:yr.showLogButton,onClick:()=>{window.localStorage.setItem("App.hideLog","false"),this.setState({hideLog:!1,resizing:!0}),setTimeout(()=>this.setState({resizing:!1}),300)},children:g.jsx(gk,{})},"showLog")}renderErrorDialog(){return this.state.errorText?g.jsx(Ec,{onClose:()=>this.setState({errorText:""}),text:this.state.errorText},"dialogError"):null}renderMain(){let s;return this.state.debugMode||this.state.hideLog?s=g.jsxs(g.Fragment,{children:[!this.state.debugMode&&this.state.hideLog?this.showLogButton():void 0,this.renderEditor()]}):s=g.jsxs(_y,{direction:this.state.logHorzLayout?ut.Horizontal:ut.Vertical,initialSizes:this.state.logSizes,minWidths:[500,100],minHeights:[150,50],onResizeStarted:()=>this.setState({resizing:!0}),onResizeFinished:(i,r)=>{this.setState({logSizes:r,resizing:!1}),window.localStorage.setItem("JS.logSizes",JSON.stringify(r))},gutterClassName:this.state.themeType==="dark"?"Dark visGutter":"Light visGutter",children:[this.renderEditor(),g.jsx(Ng,{verticalLayout:!this.state.logHorzLayout,onLayoutChange:()=>this.toggleLogLayout(),editing:this.state.editing,socket:this.socket,selected:this.state.selected,onHideLog:()=>{window.localStorage.setItem("App.hideLog","true"),this.setState({hideLog:!0,resizing:!0}),setTimeout(()=>this.setState({resizing:!1}),300)}},"log")]}),g.jsxs(y.Box,{sx:yr.content,className:"iobVerticalSplitter",children:[g.jsx(y.Box,{sx:yr.menuOpenCloseButton,onClick:()=>{window.localStorage.setItem("App.menuOpened",this.state.menuOpened?"false":"true"),this.setState({menuOpened:!this.state.menuOpened,resizing:!0}),setTimeout(()=>this.setState({resizing:!1}),300)},children:this.state.menuOpened?g.jsx(mk,{}):g.jsx(fk,{})},"closeMenu"),this.state.message?g.jsx(b.Message,{onClose:()=>this.setState({message:""}),text:this.state.message},"dialogMessage"):null,this.renderErrorDialog(),this.state.importFile?g.jsx(sm,{onClose:i=>this.onImport(i)},"dialogImportFile"):null,this.state.confirm?g.jsx(b.Confirm,{onClose:i=>{this.state.confirm&&this.setState({confirm:""}),this.confirmCallback&&this.confirmCallback(i),this.confirmCallback=null},text:this.state.confirm},"dialogConfirm"):null,this.renderPasswordDialog(),s]},"main")}render(){if(!this.state.ready)return g.jsx(my,{injectFirst:!0,children:g.jsx(fy,{theme:this.state.theme,children:g.jsx(b.Loader,{themeType:this.state.themeType})})});let s;return this.state.menuOpened?s=g.jsxs(_y,{direction:ut.Horizontal,initialSizes:this.state.splitSizes,minWidths:[270,400],onResizeFinished:(i,r)=>{this.setState({splitSizes:r}),window.localStorage.setItem("JS.splitSizes",JSON.stringify(r))},gutterClassName:this.state.themeType==="dark"?"Dark visGutter":"Light visGutter",children:[g.jsx("div",{style:yr.mainDiv,children:g.jsx(lo,{password:this.state.password,debugMode:this.state.debugMode,onDebugInstance:i=>this.setState({debugInstance:i,debugMode:!!i}),scripts:this.scripts,scriptsHash:this.state.scriptsHash,instances:this.state.instances,onRename:this.onRename.bind(this),socket:this.socket,selectId:this.state.menuSelectId,onEdit:this.onEdit.bind(this),expertMode:this.state.expertMode,themeName:this.state.themeName,onThemeChange:i=>{b.Utils.setThemeName(i);const r=b.Utils.getThemeType(i);this.setState({themeName:i,themeType:r},()=>this.toggleTheme(i))},runningInstances:this.state.runningInstances,onExpertModeChange:i=>this.onExpertModeChange(i),onDelete:this.onDelete.bind(this),onAddNew:this.onAddNew.bind(this),onEnableDisable:this.onEnableDisable.bind(this),onExport:this.onExport.bind(this),width:500,onImport:()=>this.setState({importFile:!0}),onSearch:i=>this.setState({searchText:i}),version:this.props.version,changedScripts:this.changedScripts},"sidemenu")},"menu"),this.renderMain()]}):s=this.renderMain(),g.jsx(my,{injectFirst:!0,children:g.jsx(fy,{theme:this.state.theme,children:g.jsx("div",{style:yr.root,children:g.jsx(rR,{socket:this.socket,children:s})})})})}}window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/);function jee(){"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(a=>{a.unregister()})}const zee="9.0.13",LC={version:zee};var xo;(function(a){a.mouse="mouse",a.touch="touch",a.keyboard="keyboard"})(xo||(xo={}));class Uee{get delay(){var s;return(s=this.args.delay)!==null&&s!==void 0?s:0}get scrollAngleRanges(){return this.args.scrollAngleRanges}get getDropTargetElementsAtPoint(){return this.args.getDropTargetElementsAtPoint}get ignoreContextMenu(){var s;return(s=this.args.ignoreContextMenu)!==null&&s!==void 0?s:!1}get enableHoverOutsideTarget(){var s;return(s=this.args.enableHoverOutsideTarget)!==null&&s!==void 0?s:!1}get enableKeyboardEvents(){var s;return(s=this.args.enableKeyboardEvents)!==null&&s!==void 0?s:!1}get enableMouseEvents(){var s;return(s=this.args.enableMouseEvents)!==null&&s!==void 0?s:!1}get enableTouchEvents(){var s;return(s=this.args.enableTouchEvents)!==null&&s!==void 0?s:!0}get touchSlop(){return this.args.touchSlop||0}get delayTouchStart(){var s,i,r,l;return(l=(r=(s=this.args)===null||s===void 0?void 0:s.delayTouchStart)!==null&&r!==void 0?r:(i=this.args)===null||i===void 0?void 0:i.delay)!==null&&l!==void 0?l:0}get delayMouseStart(){var s,i,r,l;return(l=(r=(s=this.args)===null||s===void 0?void 0:s.delayMouseStart)!==null&&r!==void 0?r:(i=this.args)===null||i===void 0?void 0:i.delay)!==null&&l!==void 0?l:0}get window(){if(this.context&&this.context.window)return this.context.window;if(typeof window<"u")return window}get document(){var s;if(!((s=this.context)===null||s===void 0)&&s.document)return this.context.document;if(this.window)return this.window.document}get rootElement(){var s;return((s=this.args)===null||s===void 0?void 0:s.rootElement)||this.document}constructor(s,i){this.args=s,this.context=i}}function Hee(a,s,i,r){return Math.sqrt(Math.pow(Math.abs(i-a),2)+Math.pow(Math.abs(r-s),2))}function Wee(a,s,i,r,l){if(!l)return!1;const u=Math.atan2(r-s,i-a)*180/Math.PI+180;for(let d=0;d<l.length;++d){const p=l[d];if(p&&(p.start==null||u>=p.start)&&(p.end==null||u<=p.end))return!0}return!1}const Vee={Left:1},Gee={Left:0};function qp(a){return a.button===void 0||a.button===Gee.Left}function Kee(a){return a.buttons===void 0||(a.buttons&Vee.Left)===0}function BC(a){return!!a.targetTouches}const Yee=1;function Jee(a){const s=a.nodeType===Yee?a:a.parentElement;if(!s)return;const{top:i,left:r}=s.getBoundingClientRect();return{x:r,y:i}}function Xee(a,s){if(a.targetTouches.length===1)return bc(a.targetTouches[0]);if(s&&a.touches.length===1&&a.touches[0].target===s.target)return bc(a.touches[0])}function bc(a,s){return BC(a)?Xee(a,s):{x:a.clientX,y:a.clientY}}const M_=(()=>{let a=!1;try{addEventListener("test",()=>{},Object.defineProperty({},"passive",{get(){return a=!0,!0}}))}catch{}return a})(),_r={[xo.mouse]:{start:"mousedown",move:"mousemove",end:"mouseup",contextmenu:"contextmenu"},[xo.touch]:{start:"touchstart",move:"touchmove",end:"touchend"},[xo.keyboard]:{keydown:"keydown"}};class Er{profile(){var s;return{sourceNodes:this.sourceNodes.size,sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,targetNodes:this.targetNodes.size,dragOverTargetIds:((s=this.dragOverTargetIds)===null||s===void 0?void 0:s.length)||0}}get document(){return this.options.document}setup(){const s=this.options.rootElement;s&&(De(!Er.isSetUp,"Cannot have two Touch backends at the same time."),Er.isSetUp=!0,this.addEventListener(s,"start",this.getTopMoveStartHandler()),this.addEventListener(s,"start",this.handleTopMoveStartCapture,!0),this.addEventListener(s,"move",this.handleTopMove),this.addEventListener(s,"move",this.handleTopMoveCapture,!0),this.addEventListener(s,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.addEventListener(s,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.addEventListener(s,"keydown",this.handleCancelOnEscape,!0))}teardown(){const s=this.options.rootElement;s&&(Er.isSetUp=!1,this._mouseClientOffset={},this.removeEventListener(s,"start",this.handleTopMoveStartCapture,!0),this.removeEventListener(s,"start",this.handleTopMoveStart),this.removeEventListener(s,"move",this.handleTopMoveCapture,!0),this.removeEventListener(s,"move",this.handleTopMove),this.removeEventListener(s,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.removeEventListener(s,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.removeEventListener(s,"keydown",this.handleCancelOnEscape,!0),this.uninstallSourceNodeRemovalObserver())}addEventListener(s,i,r,l=!1){const u=M_?{capture:l,passive:!1}:l;this.listenerTypes.forEach(function(d){const p=_r[d][i];p&&s.addEventListener(p,r,u)})}removeEventListener(s,i,r,l=!1){const u=M_?{capture:l,passive:!1}:l;this.listenerTypes.forEach(function(d){const p=_r[d][i];p&&s.removeEventListener(p,r,u)})}connectDragSource(s,i){const r=this.handleMoveStart.bind(this,s);return this.sourceNodes.set(s,i),this.addEventListener(i,"start",r),()=>{this.sourceNodes.delete(s),this.removeEventListener(i,"start",r)}}connectDragPreview(s,i,r){return this.sourcePreviewNodeOptions.set(s,r),this.sourcePreviewNodes.set(s,i),()=>{this.sourcePreviewNodes.delete(s),this.sourcePreviewNodeOptions.delete(s)}}connectDropTarget(s,i){const r=this.options.rootElement;if(!this.document||!r)return()=>{};const l=u=>{if(!this.document||!r||!this.monitor.isDragging())return;let d;switch(u.type){case _r.mouse.move:d={x:u.clientX,y:u.clientY};break;case _r.touch.move:var p,m;d={x:((p=u.touches[0])===null||p===void 0?void 0:p.clientX)||0,y:((m=u.touches[0])===null||m===void 0?void 0:m.clientY)||0};break}const f=d!=null?this.document.elementFromPoint(d.x,d.y):void 0,v=f&&i.contains(f);if(f===i||v)return this.handleMove(u,s)};return this.addEventListener(this.document.body,"move",l),this.targetNodes.set(s,i),()=>{this.document&&(this.targetNodes.delete(s),this.removeEventListener(this.document.body,"move",l))}}getTopMoveStartHandler(){return!this.options.delayTouchStart&&!this.options.delayMouseStart?this.handleTopMoveStart:this.handleTopMoveStartDelay}installSourceNodeRemovalObserver(s){this.uninstallSourceNodeRemovalObserver(),this.draggedSourceNode=s,this.draggedSourceNodeRemovalObserver=new MutationObserver(()=>{s&&!s.parentElement&&(this.resurrectSourceNode(),this.uninstallSourceNodeRemovalObserver())}),!(!s||!s.parentElement)&&this.draggedSourceNodeRemovalObserver.observe(s.parentElement,{childList:!0})}resurrectSourceNode(){this.document&&this.draggedSourceNode&&(this.draggedSourceNode.style.display="none",this.draggedSourceNode.removeAttribute("data-reactid"),this.document.body.appendChild(this.draggedSourceNode))}uninstallSourceNodeRemovalObserver(){this.draggedSourceNodeRemovalObserver&&this.draggedSourceNodeRemovalObserver.disconnect(),this.draggedSourceNodeRemovalObserver=void 0,this.draggedSourceNode=void 0}constructor(s,i,r){this.getSourceClientOffset=l=>{const u=this.sourceNodes.get(l);return u&&Jee(u)},this.handleTopMoveStartCapture=l=>{qp(l)&&(this.moveStartSourceIds=[])},this.handleMoveStart=l=>{Array.isArray(this.moveStartSourceIds)&&this.moveStartSourceIds.unshift(l)},this.handleTopMoveStart=l=>{if(!qp(l))return;const u=bc(l);u&&(BC(l)&&(this.lastTargetTouchFallback=l.targetTouches[0]),this._mouseClientOffset=u),this.waitingForDelay=!1},this.handleTopMoveStartDelay=l=>{if(!qp(l))return;const u=l.type===_r.touch.start?this.options.delayTouchStart:this.options.delayMouseStart;this.timeout=setTimeout(this.handleTopMoveStart.bind(this,l),u),this.waitingForDelay=!0},this.handleTopMoveCapture=()=>{this.dragOverTargetIds=[]},this.handleMove=(l,u)=>{this.dragOverTargetIds&&this.dragOverTargetIds.unshift(u)},this.handleTopMove=l=>{if(this.timeout&&clearTimeout(this.timeout),!this.document||this.waitingForDelay)return;const{moveStartSourceIds:u,dragOverTargetIds:d}=this,p=this.options.enableHoverOutsideTarget,m=bc(l,this.lastTargetTouchFallback);if(!m)return;if(this._isScrolling||!this.monitor.isDragging()&&Wee(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,m.x,m.y,this.options.scrollAngleRanges)){this._isScrolling=!0;return}if(!this.monitor.isDragging()&&this._mouseClientOffset.hasOwnProperty("x")&&u&&Hee(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,m.x,m.y)>(this.options.touchSlop?this.options.touchSlop:0)&&(this.moveStartSourceIds=void 0,this.actions.beginDrag(u,{clientOffset:this._mouseClientOffset,getSourceClientOffset:this.getSourceClientOffset,publishSource:!1})),!this.monitor.isDragging())return;const f=this.sourceNodes.get(this.monitor.getSourceId());this.installSourceNodeRemovalObserver(f),this.actions.publishDragSource(),l.cancelable&&l.preventDefault();const v=(d||[]).map(S=>this.targetNodes.get(S)).filter(S=>!!S),w=this.options.getDropTargetElementsAtPoint?this.options.getDropTargetElementsAtPoint(m.x,m.y,v):this.document.elementsFromPoint(m.x,m.y),_=[];for(const S in w){if(!w.hasOwnProperty(S))continue;let C=w[S];for(C!=null&&_.push(C);C;)C=C.parentElement,C&&_.indexOf(C)===-1&&_.push(C)}const k=_.filter(S=>v.indexOf(S)>-1).map(S=>this._getDropTargetId(S)).filter(S=>!!S).filter((S,C,I)=>I.indexOf(S)===C);if(p)for(const S in this.targetNodes){const C=this.targetNodes.get(S);if(f&&C&&C.contains(f)&&k.indexOf(S)===-1){k.unshift(S);break}}k.reverse(),this.actions.hover(k,{clientOffset:m})},this._getDropTargetId=l=>{const u=this.targetNodes.keys();let d=u.next();for(;d.done===!1;){const p=d.value;if(l===this.targetNodes.get(p))return p;d=u.next()}},this.handleTopMoveEndCapture=l=>{if(this._isScrolling=!1,this.lastTargetTouchFallback=void 0,!!Kee(l)){if(!this.monitor.isDragging()||this.monitor.didDrop()){this.moveStartSourceIds=void 0;return}l.cancelable&&l.preventDefault(),this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.drop(),this.actions.endDrag()}},this.handleCancelOnEscape=l=>{l.key==="Escape"&&this.monitor.isDragging()&&(this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.endDrag())},this.options=new Uee(r,i),this.actions=s.getActions(),this.monitor=s.getMonitor(),this.sourceNodes=new Map,this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.targetNodes=new Map,this.listenerTypes=[],this._mouseClientOffset={},this._isScrolling=!1,this.options.enableMouseEvents&&this.listenerTypes.push(xo.mouse),this.options.enableTouchEvents&&this.listenerTypes.push(xo.touch),this.options.enableKeyboardEvents&&this.listenerTypes.push(xo.keyboard)}}const qee=function(s,i={},r={}){return new Er(s,i,r)};window.GenericBlock=Xe;window.adapterName="javascript";window.sentryDSN="https://504499a725eb4898930d3b9e9da95740@sentry.iobroker.net/56";console.log(`iobroker.${window.adapterName}@${LC.version}`);const Zee=window.innerWidth<600,N_=document.getElementById("root");N_&&H_(N_).render(g.jsx(nw,{backend:Zee?qee:$w,children:g.jsx(Fee,{version:LC.version})}));jee();const jl=window.loadDynamicScript;jl&&jl(window.location.port==="3000"?`${window.location.protocol}//${window.location.hostname}:8081/lib/js/socket.io.js`:"./../../lib/js/socket.io.js",()=>jl("vs/loader.js",()=>jl("vs/configure.js",()=>typeof window.socketLoadedHandler=="function"&&window.socketLoadedHandler())));export{nR as C,W0 as D,Xe as G,q_ as I,I_ as M,ws as S,TE as a,HE as b,qE as c,ri as d,Poe as e,im as f,Ec as g,Lk as h,b as i,Foe as j,_y as m,fn as u,ut as z};