iobroker.javascript 10.1.1 → 10.1.3

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 (90) hide show
  1. package/README.md +21 -6
  2. package/admin/assets/{AiChatPanel-C_WbKMGX.js → AiChatPanel-rQsCR89v.js} +11 -11
  3. package/admin/assets/AiDiffView-BoglEOaq.js +1 -0
  4. package/admin/assets/{Debugger-DAdJnEhw.js → Debugger-Bj4PsKNm.js} +4 -4
  5. package/admin/assets/Error-RANTMuGx.js +1 -0
  6. package/admin/assets/Import-CJgQwwNY.js +1 -0
  7. package/admin/assets/RulesEditor-BcGsf9n4.css +1 -0
  8. package/admin/assets/RulesEditor-PYpUIg7N.js +1 -0
  9. package/admin/assets/{ScriptEditor-CZSc7rwE.js → ScriptEditor-C6ekGK_v.js} +2 -2
  10. package/admin/assets/{ScriptEditorVanillaMonaco-DEKg14_A.js → ScriptEditorVanillaMonaco-BzazJaUa.js} +3 -3
  11. package/admin/assets/{_virtual_mf-localSharedImportMap___mfe_internal__iobroker_javascript__mf_owner__1-DPmwd_G2.js → _virtual_mf-localSharedImportMap___mfe_internal__iobroker_javascript__mf_owner__1-CL_S1FIh.js} +1 -1
  12. package/admin/assets/{_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-C8inUeKt.js → _virtual_mf___mfe_internal__iobroker_javascript__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BAOcdAz5.js} +92 -92
  13. package/admin/assets/{_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-VcQjt7_9.js → _virtual_mf___mfe_internal__iobroker_javascript__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-DdX5BXjB.js} +1 -1
  14. package/admin/assets/aiPromptBuilder-a2bvj40X.js +1 -0
  15. package/admin/assets/blocks_action-CaHoI2vK.js +1 -0
  16. package/admin/assets/{blocks_convert-CX0i-JfS.js → blocks_convert-Dno4Uyat.js} +2 -2
  17. package/admin/assets/{blocks_logic-D-QSzw95.js → blocks_logic-C4MPyL6T.js} +1 -1
  18. package/admin/assets/{blocks_number-D7JuNYsw.js → blocks_number-BMu9V-ca.js} +1 -1
  19. package/admin/assets/blocks_object-vU59tx8A.js +1 -0
  20. package/admin/assets/{blocks_procedures-BJMz6HWW.js → blocks_procedures-CfhGGNAK.js} +1 -1
  21. package/admin/assets/{blocks_sendto-DRh7lk9o.js → blocks_sendto-oZjHfEt6.js} +3 -3
  22. package/admin/assets/{blocks_switch-BfmboMex.js → blocks_switch-DtRe2uV0.js} +1 -1
  23. package/admin/assets/blocks_system-CWkKMHLd.js +1 -0
  24. package/admin/assets/{blocks_text-CGbR0Ozw.js → blocks_text-CunCNUrR.js} +1 -1
  25. package/admin/assets/blocks_time-B_Duc9-g.js +1 -0
  26. package/admin/assets/blocks_timeout-B5PA_0Xv.js +1 -0
  27. package/admin/assets/blocks_trigger-BePNP-VV.js +2 -0
  28. package/admin/assets/blocks_words-bpwd7Ia0.js +1 -0
  29. package/admin/assets/{cronHoverProvider-DpgESCox.js → cronHoverProvider-COaB74MF.js} +1 -1
  30. package/admin/assets/dist-BF-PlO2i.js +4 -0
  31. package/admin/assets/{field_cron-B40zwSfJ.js → field_cron-BkiRQvy7.js} +1 -1
  32. package/admin/assets/{field_oid-KfoBnEM9.js → field_oid-pEOMkwS7.js} +1 -1
  33. package/admin/assets/{field_script-yXhe1iCp.js → field_script-D8TaeXTc.js} +1 -1
  34. package/admin/assets/{helpers-B0ByElPJ.js → helpers-Cbd0K4kn.js} +1 -1
  35. package/admin/assets/{hostInit-9REPDUe7.js → hostInit-PWanFl0v.js} +1 -1
  36. package/admin/assets/index-4M2aGX3M.js +871 -0
  37. package/admin/assets/{inlineChatWidget-B9y_gQcH.js → inlineChatWidget-CmSJN0Rv.js} +1 -1
  38. package/admin/assets/{inlineDiffController-C07CdIFo.js → inlineDiffController-CauFSimb.js} +1 -1
  39. package/admin/assets/{mf-entry-bootstrap-0-efcb49d3.js → mf-entry-bootstrap-0-66751765.js} +2 -2
  40. package/admin/assets/{stateHoverProvider-CqeoOjXs.js → stateHoverProvider-g3dqXZ8K.js} +1 -1
  41. package/admin/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__iobroker_javascript__remoteEntry_js-Dc9L2TVn.js +1 -0
  42. package/admin/custom/assets/{Components-BCQTjBgm.js → Components-uxORfFYU.js} +1 -1
  43. package/admin/custom/assets/{_virtual_mf-localSharedImportMap___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1-BuAc8OyX.js → _virtual_mf-localSharedImportMap___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1-Bd9Y-jyc.js} +1 -1
  44. package/admin/custom/assets/{_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-aRlxyEhq.js → _virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-DMefPDeL.js} +92 -92
  45. package/admin/custom/assets/{_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__.js-DQwzYx75.js → _virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__.js-D81YCXgE.js} +65 -65
  46. package/admin/custom/assets/{_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-xxszBNje.js → _virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-CxkJmLDG.js} +1 -1
  47. package/admin/custom/assets/{_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__prebuild__date_mf_2_fns__prebuild__-Tq7tesSS.js → _virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__prebuild__date_mf_2_fns__prebuild__-BNLW3sTg.js} +1 -1
  48. package/admin/custom/assets/{hostInit-CHwrowP4.js → hostInit-CxnK2NMF.js} +1 -1
  49. package/admin/custom/assets/{index-Cm6xl9K4.js → index-CHg-uG3r.js} +1 -1
  50. package/admin/custom/assets/{lib-bhrFL6jR.js → lib-D4Fc4r7w.js} +1 -1
  51. package/admin/custom/assets/{mf-entry-bootstrap-0-f08941e2.js → mf-entry-bootstrap-0-16561517.js} +2 -2
  52. package/admin/custom/assets/{setYear-DzTZ2h9A.js → setYear-Dhce8K9j.js} +1 -1
  53. package/admin/custom/assets/virtualExposes-DUFP2Erj.js +1 -0
  54. package/admin/custom/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-jnBHXUID.js +1 -0
  55. package/admin/custom/assets/{virtual_mf-exposes___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-C3ImybiM.js → virtual_mf-exposes___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-PH1CCUgS.js} +2 -2
  56. package/admin/custom/customComponents.js +2 -2
  57. package/admin/mf-manifest.json +1 -1
  58. package/admin/mf-stats.json +1 -1
  59. package/admin/remoteEntry.js +2 -2
  60. package/admin/tab.html +4 -4
  61. package/build/lib/mirror.js +21 -4
  62. package/build/lib/mirror.js.map +1 -1
  63. package/build/lib/sandbox.js +59 -31
  64. package/build/lib/sandbox.js.map +1 -1
  65. package/build/lib/tools.js +13 -0
  66. package/build/lib/tools.js.map +1 -1
  67. package/build/main.js +3 -0
  68. package/build/main.js.map +1 -1
  69. package/docs/en/javascript.md +11 -0
  70. package/io-package.json +27 -27
  71. package/package.json +4 -4
  72. package/admin/assets/AiDiffView-BtXbDWZ8.js +0 -1
  73. package/admin/assets/Error-DQ1pzKcf.js +0 -1
  74. package/admin/assets/Import-BjMtH6Gk.js +0 -1
  75. package/admin/assets/RulesEditor-dDRPHw4X.js +0 -1
  76. package/admin/assets/RulesEditor-k-DMHotH.css +0 -1
  77. package/admin/assets/aiPromptBuilder-D5FDo74i.js +0 -1
  78. package/admin/assets/back-CXiqI7Po.jpg +0 -0
  79. package/admin/assets/blocks_action-BqfWEwpf.js +0 -1
  80. package/admin/assets/blocks_object-C9DzAlc7.js +0 -1
  81. package/admin/assets/blocks_system-B-78JfAc.js +0 -1
  82. package/admin/assets/blocks_time-5vS2geJg.js +0 -1
  83. package/admin/assets/blocks_timeout-BdaTywfN.js +0 -1
  84. package/admin/assets/blocks_trigger-D8kgHKbg.js +0 -2
  85. package/admin/assets/blocks_words-BhHIf_1o.js +0 -1
  86. package/admin/assets/dist-CaOsN0XW.js +0 -4
  87. package/admin/assets/index-07o_WKsX.js +0 -726
  88. package/admin/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__iobroker_javascript__remoteEntry_js-BwSvIKEV.js +0 -1
  89. package/admin/custom/assets/virtualExposes-B5LJmnfO.js +0 -1
  90. package/admin/custom/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-ML-chjs6.js +0 -1
@@ -632,6 +632,17 @@ let sch = schedule('*/2 * * * *', () => { /* ... */ });
632
632
  clearSchedule(sch);
633
633
  ```
634
634
 
635
+ `clearSchedule` accepts everything `schedule` returns (a CRON job object or the ID of a schedule of the time wizard)
636
+ and also the entries of [getSchedules](#getschedules):
637
+
638
+ ```js
639
+ // Clear all schedules of this script
640
+ getSchedules().forEach(sch => clearSchedule(sch));
641
+ ```
642
+
643
+ It returns `true` if the schedule was found and cleared, otherwise `false`.
644
+ Schedules created with the astro option cannot be cleared this way.
645
+
635
646
  ### getAttr
636
647
  ```js
637
648
  getAttr({ attr1: { attr2: 5 } }, 'attr1.attr2');
package/io-package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "javascript",
4
- "version": "10.1.1",
4
+ "version": "10.1.3",
5
5
  "blockedVersions": [
6
6
  "8.0.0",
7
7
  "8.0.1"
@@ -40,6 +40,32 @@
40
40
  "Matthias Kleine <info@haus-automatisierung.com>"
41
41
  ],
42
42
  "news": {
43
+ "10.1.3": {
44
+ "en": "The plain text export named its files after the script ID instead of the script name, so every dot of a name came out as an underscore - `HK-Balkontuer_v0.1` was exported as `HK-Balkontuer_v0_1.js`, and importing it back renamed the script to that. The files are now named after the script (#2364)\nImporting a plain text export treated a dot inside a file name as a folder level, so `PW-TV-Control_v0.6.js` created a folder `PW-TV-Control_v0` containing a script named `6`. Only the directories of the ZIP are folders now (#2364)\nThe folder icons in the script tree were drawn at less than half the size of the script icons next to them: they spaced themselves with a padding, and since `CssBaseline` sets `box-sizing: border-box` that padding was subtracted from their 20px instead of being added to them. They use a margin now, like the script icons always did (#2360)\nThe log below the editor could not be resized while a script was open: the editor area guessed its height from the height the tabs and the toolbar were expected to have, hung over the bottom edge of its pane and covered the 8px splitter with the horizontal scrollbar of the editor, which swallowed the mouse click. The three parts now share the height as a flex column (#2351)\nThe script list cut off long names, although there was still free space next to them: the space for the buttons at the end of a row was a fixed 185px, which is more than the three buttons occupy, and it did not account for the icon column\nFixed the Blockly comment block: the text was written in white on the yellow block and could not be read, the editor opened somewhere else on the page instead of over the block, and on a smartphone or tablet it did not open at all and left the whole workspace unusable until the page was reloaded (#2348)\nFixed the script mirror for folder names containing regular expression characters: a folder called e.g. `Lampen (Flur` aborted the synchronization with a `SyntaxError`, a folder called e.g. `[ab]` silently synchronized the scripts of another folder (#2239)\nThe Blockly block \"http (POST)\" got a \"content type\" selector, so an API that insists on `Content-Type: application/json` no longer needs an `exec` block. \"automatic\" is the default and behaves exactly as before, \"own\" allows any other type (#1983)\n`getSchedules()` returned the schedules of the time wizard of **all** scripts, even without the argument `true`. Now only the schedules of the own script are returned (#2164)\n`clearSchedule()` did not accept the objects that `getSchedules()` returns for schedules of the time wizard, so such a schedule stayed in the script and in the schedule counter (#2164)\n`clearSchedule()` can now clear the CRON jobs of other scripts too, as documented for `getSchedules(true)` (#2164)\n`getSchedules()` no longer lists the already canceled schedules of the own script in an `onStop` callback (#2164)",
45
+ "de": "Beim Export im Klartext wurden die Dateien nach der Skript-ID anstatt nach dem Skriptnamen benannt. Dadurch wurde jeder Punkt im Namen als Unterstrich dargestellt – beispielsweise wurde `HK-Balkontuer_v0.1` als `HK-Balkontuer_v0_1.js` exportiert, und beim erneuten Import wurde das Skript entsprechend umbenannt. Die Dateien sind nun nach dem Skript benannt (#2364).\nBeim Importieren eines Klartextexports wurde ein Punkt im Dateinamen als Ordnerebene interpretiert, sodass `PW-TV-Control_v0.6.js` einen Ordner `PW-TV-Control_v0` mit einem Skript namens `6` erstellte. Nur die Verzeichnisse der ZIP-Datei sind jetzt Ordner (#2364).\nDie Ordnersymbole im Skriptbaum wurden mit weniger als der halben Größe der daneben liegenden Skriptsymbole dargestellt: Sie hatten einen Innenabstand (Padding), und da `CssBaseline` `box-sizing: border-box` festlegt, wurde dieser Innenabstand von ihren 20 Pixeln abgezogen, anstatt addiert zu werden. Sie verwenden nun einen Außenabstand (Margin), wie es bei den Skriptsymbolen immer der Fall war (#2360).\nDer Bereich unterhalb des Editors konnte nicht in der Größe angepasst werden, solange ein Skript geöffnet war: Der Editorbereich berechnete seine Höhe anhand der erwarteten Höhe der Tabs und der Symbolleiste, ragte über den unteren Rand des Fensters hinaus und verdeckte den 8-Pixel-Trennstreifen mit der horizontalen Scrollleiste des Editors, wodurch der Mausklick blockiert wurde. Die drei Bereiche teilen sich nun die Höhe als Flexbox-Spalte (#2351).\nDie Skriptliste schnitt lange Namen ab, obwohl daneben noch Platz war: Der Platz für die Schaltflächen am Ende einer Zeile betrug feste 185 Pixel, was mehr ist, als die drei Schaltflächen einnehmen, und die Spalte für die Symbole nicht berücksichtigte.\nDer Blockly-Kommentarblock wurde korrigiert: Der Text wurde in Weiß auf dem gelben Block geschrieben und war unlesbar, der Editor öffnete sich an einer anderen Stelle auf der Seite anstatt über dem Block, und auf einem Smartphone oder Tablet öffnete er sich überhaupt nicht und der gesamte Arbeitsbereich war unbrauchbar, bis die Seite neu geladen wurde (#2348).\nDas Problem mit der Skriptspiegelung für Ordnernamen, die reguläre Ausdrücke enthalten, wurde behoben: Ein Ordner namens z. B. `Lampen (Flur` brach die Synchronisierung mit einem `SyntaxError` ab, ein Ordner namens z. B. `[ab]` synchronisierte stillschweigend die Skripte eines anderen Ordners (#2239).\nDer Blockly-Block „http (POST)“ hat einen „Content-Type“-Selektor erhalten, sodass eine API, die auf `Content-Type: application/json` besteht, keinen `exec`-Block mehr benötigt. „automatic“ ist die Standardeinstellung und verhält sich wie zuvor, „own“ erlaubt jeden anderen Typ (#1983).\n`getSchedules()` gab die Zeitpläne des Zeitassistenten **aller** Skripte zurück, selbst ohne das Argument `true`. Jetzt werden nur noch die Zeitpläne des eigenen Skripts zurückgegeben (#2164).\n`clearSchedule()` akzeptierte die Objekte nicht, die `getSchedules()` für Zeitpläne des Zeitassistenten zurückgibt, sodass ein solcher Zeitplan im Skript und im Zeitplanzähler verblieb (#2164).\n`clearSchedule()` kann nun auch die CRON-Jobs anderer Skripte löschen, wie für `getSchedules(true)` dokumentiert (#2164).\n`getSchedules()` listet die bereits abgebrochenen Zeitpläne des eigenen Skripts nicht mehr in einem `onStop`-Callback auf (#2164).",
46
+ "ru": "При экспорте в текстовом формате файлы назывались по идентификатору скрипта, а не по его имени, поэтому каждая точка в имени отображалась как нижнее подчеркивание — `HK-Balkontuer_v0.1` экспортировался как `HK-Balkontuer_v0_1.js`, а при обратном импорте скрипт переименовывался в это имя. Теперь файлы называются по имени скрипта (#2364)\nПри импорте файла в виде простого текста точка внутри имени файла рассматривалась как уровень папки, поэтому файл `PW-TV-Control_v0.6.js` создал папку `PW-TV-Control_v0`, содержащую скрипт с именем `6`. Теперь только каталоги ZIP-архива являются папками (#2364)\nЗначки папок в дереве скриптов отображались в размере менее половины размера значков скриптов рядом с ними: они отступали, и поскольку `CssBaseline` устанавливает `box-sizing: border-box`, этот отступ вычитался из их 20 пикселей, а не добавлялся к ним. Теперь они используют поля, как и всегда использовали значки скриптов (#2360)\nРазмер области под редактором нельзя было изменить, пока открыт скрипт: область редактора определяла свою высоту исходя из ожидаемой высоты вкладок и панели инструментов, выступала за нижний край своей панели и закрывала 8-пиксельный разделитель горизонтальной полосой прокрутки редактора, которая «проглатывала» щелчок мыши. Теперь все три части имеют одинаковую высоту в виде гибкой колонки (#2351)\nВ списке скриптов длинные имена были обрезаны, хотя рядом с ними оставалось свободное место: пространство для кнопок в конце строки составляло фиксированные 185 пикселей, что больше, чем занимают три кнопки, и это не учитывало столбец с иконками.\nИсправлена ошибка в блоке комментариев Blockly: текст писался белым цветом на желтом фоне и не читался, редактор открывался в другом месте страницы, а не поверх блока, и на смартфоне или планшете он вообще не открывался, оставляя все рабочее пространство недоступным до перезагрузки страницы (#2348)\nИсправлена ошибка зеркалирования скриптов для папок с именами, содержащими символы регулярных выражений: папка с именем, например, `Lampen (Flur`), прерывала синхронизацию с ошибкой `SyntaxError`, а папка с именем, например, `[ab]` молча синхронизировала скрипты другой папки (#2239)\nБлок Blockly \"http (POST)\" получил селектор \"тип содержимого\", поэтому API, который настаивает на `Content-Type: application/json`, больше не нуждается в блоке `exec`. \"automatic\" является значением по умолчанию и ведет себя точно так же, как и раньше, \"own\" допускает любой другой тип (#1983)\nФункция `getSchedules()` возвращала расписания мастера времени **всех** скриптов, даже без аргумента `true`. Теперь возвращаются только расписания собственного скрипта (#2164)\nФункция `clearSchedule()` не принимала объекты, возвращаемые функцией `getSchedules()` для расписаний мастера времени, поэтому такое расписание оставалось в скрипте и в счетчике расписаний (#2164)\nТеперь функция `clearSchedule()` может очищать задания CRON и других скриптов, как это описано в документации для функции `getSchedules(true)` (#2164).\nФункция `getSchedules()` больше не отображает уже отмененные расписания собственного скрипта в функции обратного вызова `onStop` (#2164)",
47
+ "pt": "A exportação em texto simples nomeava os arquivos de acordo com o ID do script em vez do nome do script, então cada ponto de um nome era interpretado como um sublinhado - `HK-Balkontuer_v0.1` foi exportado como `HK-Balkontuer_v0_1.js`, e ao importá-lo de volta, o script foi renomeado para esse nome. Os arquivos agora estão nomeados de acordo com o script (#2364)\nA importação de uma exportação de texto simples tratava um ponto dentro de um nome de arquivo como um nível de pasta, então `PW-TV-Control_v0.6.js` criou uma pasta `PW-TV-Control_v0` contendo um script chamado `6`. Somente os diretórios do ZIP são pastas agora (#2364)\nOs ícones de pasta na árvore de scripts eram desenhados com menos da metade do tamanho dos ícones de script ao lado: eles se espaçavam com um preenchimento, e como `CssBaseline` define `box-sizing: border-box`, esse preenchimento era subtraído de seus 20px em vez de ser adicionado. Agora eles usam uma margem, como os ícones de script sempre usaram (#2360)\nO log abaixo do editor não podia ser redimensionado enquanto um script estivesse aberto: a área do editor estimava sua altura com base na altura esperada das abas e da barra de ferramentas, ultrapassava a borda inferior do painel e cobria o divisor de 8px com a barra de rolagem horizontal do editor, que anulava o clique do mouse. As três partes agora compartilham a mesma altura como uma coluna flexível (#2351)\nA lista de scripts cortou nomes longos, embora ainda houvesse espaço livre ao lado deles: o espaço para os botões no final de uma linha era fixo em 185px, o que é mais do que os três botões ocupam, e não levava em conta a coluna de ícones.\nCorrigido o bloco de comentários do Blockly: o texto era escrito em branco no bloco amarelo e não podia ser lido, o editor abria em outro lugar da página em vez de sobre o bloco e em um smartphone ou tablet ele não abria de jeito nenhum e deixava todo o espaço de trabalho inutilizável até que a página fosse recarregada (#2348)\nCorrigido o espelhamento de scripts para nomes de pastas contendo caracteres de expressão regular: uma pasta chamada, por exemplo, `Lampen (Flur)` abortava a sincronização com um `SyntaxError`, uma pasta chamada, por exemplo, `[ab]` sincronizava silenciosamente os scripts de outra pasta (#2239)\nO bloco Blockly \"http (POST)\" recebeu um seletor de \"tipo de conteúdo\", então uma API que exige `Content-Type: application/json` não precisa mais de um bloco `exec`. \"automatic\" é o padrão e se comporta exatamente como antes, \"own\" permite qualquer outro tipo (#1983)\n`getSchedules()` retornava os agendamentos do assistente de tempo de **todos** os scripts, mesmo sem o argumento `true`. Agora, apenas os agendamentos do próprio script são retornados (#2164)\n`clearSchedule()` não aceitou os objetos que `getSchedules()` retorna para agendamentos do assistente de tempo, então tal agendamento permaneceu no script e no contador de agendamentos (#2164)\n`clearSchedule()` agora também pode limpar os trabalhos CRON de outros scripts, conforme documentado para `getSchedules(true)` (#2164)\n`getSchedules()` não lista mais os agendamentos já cancelados do próprio script em um retorno de chamada `onStop` (#2164)",
48
+ "nl": "Bij de export in platte tekst werden de bestanden vernoemd naar de script-ID in plaats van de scriptnaam, waardoor elke punt in een naam als een underscore werd weergegeven - `HK-Balkontuer_v0.1` werd geëxporteerd als `HK-Balkontuer_v0_1.js`, en bij het terug importeren werd het script hernoemd naar die naam. De bestanden zijn nu vernoemd naar het script (#2364).\nBij het importeren van een platte tekstexport werd een punt in een bestandsnaam als mapniveau behandeld, dus `PW-TV-Control_v0.6.js` creëerde een map `PW-TV-Control_v0` met daarin een script met de naam `6`. Alleen de mappen in het ZIP-bestand zijn nu nog mappen (#2364)\nDe mappictogrammen in de scriptstructuur werden getekend op minder dan de helft van de grootte van de scriptpictogrammen ernaast: ze hadden een opvulling (padding) en omdat `CssBaseline` `box-sizing: border-box` instelt, werd die opvulling van hun 20px afgetrokken in plaats van erbij opgeteld. Ze gebruiken nu een marge, zoals de scriptpictogrammen altijd al deden (#2360).\nHet logbestand onder de editor kon niet worden aangepast qua grootte terwijl een script open was: het editorgebied schatte zijn hoogte op basis van de hoogte die de tabbladen en de werkbalk zouden moeten hebben, stak over de onderrand van het paneel heen en bedekte de 8px-splitter met de horizontale schuifbalk van de editor, die de muisklik blokkeerde. De drie onderdelen delen nu de hoogte als een flexibele kolom (#2351).\nDe scriptlijst kortte lange namen af, hoewel er nog vrije ruimte naast was: de ruimte voor de knoppen aan het einde van een rij was een vaste 185px, wat meer is dan de drie knoppen innemen, en er werd geen rekening gehouden met de pictogramkolom.\nHet probleem met het Blockly-commentaarblok is opgelost: de tekst werd in het wit op het gele blok geschreven en was onleesbaar, de editor opende ergens anders op de pagina in plaats van over het blok heen, en op een smartphone of tablet opende hij helemaal niet, waardoor de hele werkruimte onbruikbaar werd totdat de pagina opnieuw werd geladen (#2348)\nHet probleem met de scriptspiegeling voor mapnamen die reguliere expressietekens bevatten, is opgelost: een map met de naam bijvoorbeeld `Lampen (Flur)` brak de synchronisatie af met een `SyntaxError`, terwijl een map met de naam bijvoorbeeld `[ab]` de scripts van een andere map stilzwijgend synchroniseerde (#2239).\nHet Blockly-blok \"http (POST)\" heeft een \"content type\"-selector gekregen, waardoor een API die aandringt op `Content-Type: application/json` geen `exec`-blok meer nodig heeft. \"automatic\" is de standaardinstelling en gedraagt zich precies zoals voorheen, \"own\" staat elk ander type toe (#1983).\n`getSchedules()` gaf de schema's van de tijdwizard van **alle** scripts terug, zelfs zonder het argument `true`. Nu worden alleen de schema's van het eigen script teruggestuurd (#2164)\n`clearSchedule()` accepteerde de objecten die `getSchedules()` retourneert voor de schema's van de tijdwizard niet, dus bleef een dergelijk schema in het script en in de schemateller staan (#2164).\n`clearSchedule()` kan nu ook de CRON-taken van andere scripts wissen, zoals gedocumenteerd voor `getSchedules(true)` (#2164).\n`getSchedules()` geeft niet langer de reeds geannuleerde schema's van het eigen script weer in een `onStop`-callback (#2164)",
49
+ "fr": "L'exportation en texte brut nommait les fichiers d'après l'identifiant du script au lieu de son nom. Par conséquent, chaque point d'un nom était remplacé par un tiret bas : `HK-Balkontuer_v0.1` était exporté en `HK-Balkontuer_v0_1.js`, et l'importation du script l'a renommé en conséquence. Les fichiers portent désormais le nom du script (#2364).\nL'importation d'un fichier texte brut interprétait un point dans un nom de fichier comme un niveau de dossier ; ainsi, `PW-TV-Control_v0.6.js` créait un dossier `PW-TV-Control_v0` contenant un script nommé `6`. Seuls les répertoires de l'archive ZIP sont désormais considérés comme des dossiers (#2364).\nLes icônes de dossiers dans l'arborescence des scripts étaient dessinées à une taille inférieure à la moitié de celle des icônes de scripts adjacentes : elles étaient espacées par un remplissage, et comme `CssBaseline` définit `box-sizing: border-box`, ce remplissage était soustrait de leurs 20 px au lieu d'y être ajouté. Elles utilisent désormais une marge, comme le faisaient auparavant les icônes de scripts (#2360).\nImpossible de redimensionner le journal situé sous l'éditeur lorsqu'un script était ouvert : la zone de l'éditeur, dont la hauteur était estimée à partir de celle des onglets et de la barre d'outils, dépassait le bord inférieur de son panneau et masquait le séparateur de 8 px avec la barre de défilement horizontale, qui empêchait le clic de la souris d'être pris en compte. Les trois éléments partagent désormais la même hauteur sous forme de colonne flexible (#2351).\nLa liste des scripts tronquait les noms longs, bien qu'il restât de l'espace libre à côté : l'espace réservé aux boutons en fin de ligne était de 185 px, ce qui est supérieur à la surface occupée par les trois boutons, et ne tenait pas compte de la colonne d'icônes.\nCorrection du bloc de commentaires Blockly : le texte était écrit en blanc sur le bloc jaune et était illisible, l’éditeur s’ouvrait ailleurs sur la page au lieu de se superposer au bloc, et sur un smartphone ou une tablette, il ne s’ouvrait pas du tout et rendait l’espace de travail inutilisable jusqu’au rechargement de la page (#2348)\nCorrection du problème de synchronisation des scripts pour les noms de dossiers contenant des caractères d'expression régulière : un dossier appelé par exemple `Lampen (Flur)` interrompait la synchronisation avec une `SyntaxError`, un dossier appelé par exemple `[ab]` synchronisait silencieusement les scripts d'un autre dossier (#2239)\nLe bloc Blockly « http (POST) » dispose désormais d'un sélecteur de type de contenu. Ainsi, une API exigeant `Content-Type: application/json` n'a plus besoin d'un bloc `exec`. La valeur par défaut est « automatic » et son comportement reste inchangé ; « own » autorise tout autre type (#1983).\nLa fonction `getSchedules()` renvoyait les planifications de l'assistant de planification de l'heure de **tous** les scripts, même sans l'argument `true`. Désormais, seules les planifications du script lui-même sont renvoyées (#2164).\n`clearSchedule()` n'acceptait pas les objets que `getSchedules()` renvoie pour les planifications de l'assistant de planification, donc une telle planification est restée dans le script et dans le compteur de planification (#2164)\n`clearSchedule()` peut désormais également effacer les tâches CRON d'autres scripts, comme indiqué dans la documentation de `getSchedules(true)` (#2164).\n`getSchedules()` ne liste plus les planifications déjà annulées du propre script dans un rappel `onStop` (#2164)",
50
+ "it": "L'esportazione in testo semplice denominava i file in base all'ID dello script anziché al nome dello script stesso, quindi ogni punto del nome veniva visualizzato come un trattino basso: `HK-Balkontuer_v0.1` veniva esportato come `HK-Balkontuer_v0_1.js` e, importandolo nuovamente, lo script veniva rinominato in quel modo. Ora i file sono denominati in base allo script (#2364).\nL'importazione di un'esportazione in testo semplice trattava il punto all'interno del nome del file come livello di cartella, quindi `PW-TV-Control_v0.6.js` creava una cartella `PW-TV-Control_v0` contenente uno script chiamato `6`. Ora solo le directory dello ZIP sono cartelle (#2364)\nLe icone delle cartelle nell'albero degli script venivano disegnate con dimensioni inferiori alla metà rispetto alle icone degli script adiacenti: si distanziavano con un padding e, poiché `CssBaseline` imposta `box-sizing: border-box`, tale padding veniva sottratto dai loro 20px anziché essere aggiunto. Ora utilizzano un margine, come hanno sempre fatto le icone degli script (#2360).\nIl registro sotto l'editor non poteva essere ridimensionato mentre uno script era aperto: l'area dell'editor deduceva la sua altezza dall'altezza prevista per le schede e la barra degli strumenti, sporgeva dal bordo inferiore del suo riquadro e copriva il divisore da 8px con la barra di scorrimento orizzontale dell'editor, che inghiottiva il clic del mouse. Ora le tre parti condividono l'altezza come una colonna flex (#2351)\nL'elenco degli script troncava i nomi lunghi, sebbene ci fosse ancora spazio libero accanto a essi: lo spazio per i pulsanti alla fine di una riga era fisso a 185px, che è più di quanto occupato dai tre pulsanti, e non teneva conto della colonna delle icone.\nRisolto il problema del blocco commenti di Blockly: il testo veniva scritto in bianco sul blocco giallo e non era leggibile, l'editor si apriva in un altro punto della pagina invece che sopra il blocco e su smartphone o tablet non si apriva affatto, lasciando l'intera area di lavoro inutilizzabile fino al ricaricamento della pagina (#2348)\nCorretto il mirroring degli script per i nomi delle cartelle contenenti caratteri di espressione regolare: una cartella chiamata ad esempio `Lampen (Flur` interrompeva la sincronizzazione con un `SyntaxError`, una cartella chiamata ad esempio `[ab]` sincronizzava silenziosamente gli script di un'altra cartella (#2239)\nIl blocco Blockly \"http (POST)\" ha ora un selettore \"content type\", quindi un'API che richiede `Content-Type: application/json` non necessita più di un blocco `exec`. \"automatic\" è l'impostazione predefinita e si comporta esattamente come prima, \"own\" consente qualsiasi altro tipo (#1983).\n`getSchedules()` restituiva gli orari della procedura guidata oraria di **tutti** gli script, anche senza l'argomento `true`. Ora vengono restituiti solo gli orari del proprio script (#2164)\n`clearSchedule()` non accetta gli oggetti che `getSchedules()` restituisce per le pianificazioni della procedura guidata oraria, quindi tale pianificazione rimane nello script e nel contatore delle pianificazioni (#2164)\n`clearSchedule()` ora può cancellare anche i processi CRON di altri script, come documentato per `getSchedules(true)` (#2164)\n`getSchedules()` non elenca più le pianificazioni già annullate del proprio script in una callback `onStop` (#2164)",
51
+ "es": "La exportación en texto plano nombró los archivos según el ID del script en lugar del nombre del script, por lo que cada punto del nombre se convirtió en un guion bajo: `HK-Balkontuer_v0.1` se exportó como `HK-Balkontuer_v0_1.js`, y al importarlo de nuevo, el script se renombró así. Ahora los archivos se nombran según el script (#2364).\nAl importar una exportación de texto plano, el punto dentro del nombre del archivo se interpretaba como un nivel de carpeta, por lo que `PW-TV-Control_v0.6.js` creaba una carpeta llamada `PW-TV-Control_v0` que contenía un script llamado `6`. Ahora solo los directorios del archivo ZIP son carpetas (#2364).\nLos iconos de carpeta en el árbol de scripts se dibujaban con un tamaño inferior a la mitad del de los iconos de script adyacentes: se espaciaban con un relleno, y dado que `CssBaseline` establece `box-sizing: border-box`, ese relleno se restaba de sus 20 px en lugar de sumarse. Ahora usan un margen, como siempre lo hicieron los iconos de script (#2360).\nEl registro debajo del editor no se podía redimensionar mientras había un script abierto: el área del editor calculaba su altura a partir de la altura esperada de las pestañas y la barra de herramientas, sobresalía del borde inferior de su panel y cubría el divisor de 8 px con la barra de desplazamiento horizontal del editor, que absorbía el clic del ratón. Ahora las tres partes comparten la altura como una columna flexible (#2351).\nLa lista de scripts truncaba los nombres largos, aunque aún quedaba espacio libre junto a ellos: el espacio para los botones al final de una fila era fijo, de 185 px, más de lo que ocupan los tres botones, y no tenía en cuenta la columna de iconos.\nSe corrigió el bloque de comentarios de Blockly: el texto se escribía en blanco sobre el bloque amarillo y no se podía leer, el editor se abría en otra parte de la página en lugar de sobre el bloque, y en un teléfono inteligente o tableta no se abría en absoluto y dejaba todo el espacio de trabajo inutilizable hasta que se recargaba la página (#2348).\nSe corrigió el espejo de scripts para nombres de carpetas que contienen caracteres de expresiones regulares: una carpeta llamada, por ejemplo, `Lampen (Flur` abortaba la sincronización con un `SyntaxError`, una carpeta llamada, por ejemplo, `[ab]` sincronizaba silenciosamente los scripts de otra carpeta (#2239)\nEl bloque de Blockly \"http (POST)\" ahora tiene un selector de \"tipo de contenido\", por lo que una API que insiste en `Content-Type: application/json` ya no necesita un bloque `exec`. \"automatic\" es el valor predeterminado y se comporta exactamente igual que antes, \"own\" permite cualquier otro tipo (#1983).\n`getSchedules()` devolvía los horarios del asistente de tiempo de **todos** los scripts, incluso sin el argumento `true`. Ahora solo se devuelven los horarios del propio script (#2164).\n`clearSchedule()` no aceptaba los objetos que `getSchedules()` devuelve para los horarios del asistente de tiempo, por lo que dicho horario permaneció en el script y en el contador de horarios (#2164).\n`clearSchedule()` ahora también puede borrar las tareas CRON de otros scripts, como se documenta para `getSchedules(true)` (#2164).\n`getSchedules()` ya no muestra las programaciones canceladas del propio script en una llamada de retorno `onStop` (#2164)",
52
+ "pl": "Eksport zwykłego tekstu nazwał pliki identyfikatorem skryptu, a nie jego nazwą, więc każda kropka w nazwie była podkreślona – „HK-Balkontuer_v0.1” został wyeksportowany jako „HK-Balkontuer_v0_1.js”, a po ponownym zaimportowaniu zmienił nazwę skryptu na tę. Pliki noszą teraz nazwy pochodzące od skryptu (#2364).\nImportowanie eksportu zwykłego tekstu traktowało kropkę w nazwie pliku jako poziom folderu, więc `PW-TV-Control_v0.6.js` utworzyło folder `PW-TV-Control_v0` zawierający skrypt o nazwie `6`. Teraz tylko katalogi w pliku ZIP są folderami (#2364).\nIkony folderów w drzewie skryptów były narysowane w rozmiarze mniejszym niż połowa rozmiaru ikon skryptów obok nich: były oddzielone odstępem, a ponieważ `CssBaseline` ustawia `box-sizing: border-box`, odstęp ten został odjęty od ich 20 pikseli zamiast zostać do nich dodany. Teraz używają marginesu, tak jak zawsze ikony skryptów (#2360).\nRozmiar logu pod edytorem nie mógł zostać zmieniony, gdy skrypt był otwarty: obszar edytora odgadł swoją wysokość na podstawie wysokości, jaką miały mieć zakładki i pasek narzędzi, zawisł nad dolną krawędzią panelu i zakrył 8-pikselowy separator poziomym paskiem przewijania edytora, co uniemożliwiało kliknięcie myszką. Te trzy części mają teraz wspólną wysokość jako elastyczna kolumna (#2351).\nLista skryptów obcięła długie nazwy, chociaż obok nich wciąż było wolne miejsce: przestrzeń na przyciski na końcu wiersza wynosiła stałe 185 px, co jest więcej niż zajmują trzy przyciski, i nie uwzględniało kolumny z ikonami\nNaprawiono blok komentarza Blockly: tekst był napisany na biało na żółtym bloku i nie dało się go odczytać, edytor otwierał się w innym miejscu strony zamiast nad blokiem, a na smartfonie lub tablecie w ogóle się nie otwierał i cała przestrzeń robocza pozostawała bezużyteczna do momentu ponownego załadowania strony (#2348)\nNaprawiono lustrzane odbicie skryptów dla nazw folderów zawierających znaki wyrażeń regularnych: folder o nazwie np. `Lampen (Flur` przerywał synchronizację z błędem `SyntaxError`, folder o nazwie np. `[ab]` po cichu synchronizował skrypty innego folderu (#2239)\nBlok Blockly „http (POST)” otrzymał selektor „typu zawartości”, więc API, które wymaga „Content-Type: application/json”, nie potrzebuje już bloku „exec”. Domyślnym typem jest „automatic”, który zachowuje się dokładnie tak samo jak wcześniej, „own” dopuszcza każdy inny typ (#1983).\nFunkcja `getSchedules()` zwróciła harmonogramy kreatora czasu **wszystkich** skryptów, nawet bez argumentu `true`. Teraz zwracane są tylko harmonogramy własnego skryptu (#2164).\n`clearSchedule()` nie akceptował obiektów zwracanych przez `getSchedules()` dla harmonogramów kreatora czasu, więc taki harmonogram pozostał w skrypcie i liczniku harmonogramu (#2164)\n`clearSchedule()` może teraz czyścić zadania CRON także innych skryptów, zgodnie z dokumentacją dla `getSchedules(true)` (#2164)\n`getSchedules()` nie wyświetla już anulowanych harmonogramów własnego skryptu w wywołaniu zwrotnym `onStop` (#2164)",
53
+ "uk": "Експорт у звичайний текст назвав свої файли за ідентифікатором скрипта, а не за назвою скрипта, тому кожна крапка в назві відображалася як символ підкреслення – `HK-Balkontuer_v0.1` було експортовано як `HK-Balkontuer_v0_1.js`, а його зворотний імпорт перейменував скрипт на це. Файли тепер названі за назвою скрипта (#2364)\nІмпорт експорту звичайного тексту обробляв крапку всередині назви файлу як рівень папки, тому `PW-TV-Control_v0.6.js` створив папку `PW-TV-Control_v0`, що містить скрипт під назвою `6`. Тепер лише каталоги ZIP-архіву є папками (#2364)\nРозмір іконок папок у дереві скриптів був меншим, ніж половина розміру іконок скриптів поруч: вони мали інтервал між собою з відступом, і оскільки `CssBaseline` встановлює `box-sizing: border-box`, цей відступ віднімався від їхніх 20px, а не додавався до них. Тепер вони використовують відступ, як і завжди використовували іконки скриптів (#2360)\nРозмір журналу під редактором не можна було змінити, коли скрипт був відкритий: область редактора визначала свою висоту на основі висоти вкладок та панелі інструментів, нависала над нижнім краєм своєї панелі та перекривала роздільник розміром 8 пікселів горизонтальною смугою прокручування редактора, яка поглинала клацання миші. Тепер три частини мають однакову висоту як гнучкий стовпець (#2351).\nСписок скриптів обрізав довгі назви, хоча поруч із ними все ще залишався вільний простір: простір для кнопок у кінці рядка становив фіксовані 185 пікселів, що більше, ніж займають три кнопки, і це не враховувало стовпець значків.\nВиправлено блок коментарів Blockly: текст писався білим кольором на жовтому блоці та не міг бути прочитаний, редактор відкривався деінде на сторінці, а не над блоком, а на смартфоні чи планшеті він взагалі не відкривався та залишав увесь робочий простір непридатним для використання до перезавантаження сторінки (#2348)\nВиправлено дзеркало скриптів для імен папок, що містять символи регулярних виразів: папка з назвою, наприклад, `Lampen (Flur`, переривала синхронізацію з помилкою `SyntaxError`, папка з назвою, наприклад, `[ab]`, непомітно синхронізувала скрипти іншої папки (#2239)\nБлок Blockly \"http (POST)\" отримав селектор \"content type\", тому API, який наполягає на `Content-Type: application/json`, більше не потребує блоку `exec`. \"automatic\" є значенням за замовчуванням і поводиться точно так само, як і раніше, \"own\" дозволяє будь-який інший тип (#1983)\n`getSchedules()` повертав розклади майстра часу **всіх** скриптів, навіть без аргументу `true`. Тепер повертаються лише розклади власного скрипта (#2164)\n`clearSchedule()` не приймав об'єкти, які повертає `getSchedules()` для розкладів майстра часу, тому такий розклад залишався у скрипті та в лічильнику розкладів (#2164)\n`clearSchedule()` тепер може очищати CRON-завдання інших скриптів, як задокументовано для `getSchedules(true)` (#2164)\n`getSchedules()` більше не відображає вже скасовані розклади власного скрипта у зворотному виклику `onStop` (#2164)",
54
+ "zh-cn": "纯文本导出时,文件名使用的是脚本 ID 而不是脚本名称,因此脚本名称中的每个点号都被转换成了下划线——例如,`HK-Balkontuer_v0.1` 被导出为 `HK-Balkontuer_v0_1.js`,重新导入后,脚本名称也随之更改。现在,文件名已正确更改为脚本名称 (#2364)。\n导入纯文本导出文件时,文件名中的点号会被识别为文件夹级别,因此 `PW-TV-Control_v0.6.js` 会创建一个名为 `PW-TV-Control_v0` 的文件夹,其中包含一个名为 `6` 的脚本。现在只有 ZIP 文件中的目录才是文件夹(#2364)。\n脚本树中的文件夹图标绘制尺寸不到旁边脚本图标的一半:它们通过内边距来保持间距,而由于 `CssBaseline` 设置了 `box-sizing: border-box`,所以这个内边距从它们的 20px 宽度中减去了,而不是加到了宽度上。现在它们使用外边距,就像脚本图标一直以来那样 (#2360)。\n当脚本打开时,编辑器下方的日志区域无法调整大小:编辑器区域会根据标签页和工具栏的预期高度来估算自身高度,导致其超出面板底部边缘,并且编辑器的水平滚动条会覆盖 8 像素的分隔线,从而吞噬鼠标点击。现在,这三个部分共享高度,形成一个弹性列(#2351)。\n脚本列表会截断过长的名称,尽管名称旁边还有剩余空间:每行末尾按钮的空间固定为 185 像素,这比三个按钮实际占用的空间要大,而且也没有考虑到图标列。\n修复了 Blockly 评论块的问题:文本显示在黄色块上时为白色,无法阅读;编辑器打开的位置在页面的其他位置而不是评论块上方;在智能手机或平板电脑上,编辑器根本无法打开,导致整个工作区无法使用,直到页面重新加载为止 (#2348)\n修复了文件夹名称包含正则表达式字符时的脚本镜像问题:例如,名为 `Lampen (Flur)` 的文件夹会因 `SyntaxError` 而中止同步,例如,名为 `[ab]` 的文件夹会静默同步另一个文件夹的脚本 (#2239)\nBlockly 的“http (POST)”代码块新增了“content type”选择器,因此,如果 API 要求使用 `Content-Type: application/json`,则不再需要 `exec` 代码块。“automatic”是默认值,其行为与之前完全相同;“own”则允许使用任何其他类型(#1983)。\n`getSchedules()` 函数会返回**所有**脚本的时间向导日程表,即使没有指定参数 `true` 也是如此。现在,它只会返回自身脚本的日程表 (#2164)。\n`clearSchedule()` 不接受时间向导的 `getSchedules()` 返回的日程对象,因此这样的日程会保留在脚本和日程计数器中 (#2164)\n`clearSchedule()` 现在也可以清除其他脚本的 CRON 作业,如 `getSchedules(true)` 的文档中所述 (#2164)\n`getSchedules()` 函数不再在 `onStop` 回调函数中列出自身脚本已取消的日程安排 (#2164)"
55
+ },
56
+ "10.1.2": {
57
+ "en": "Added new rule blocks\nFixed saving of Blockly scripts under Blockly 13: a script containing a named timeout, interval or schedule could not be saved anymore - the save button did not appear (#2349)\nFixed saving of Blockly scripts containing a function with a return value and no statements (#1958)\nThe Blockly regression tests now also cover saving: every block is serialized the way the editor does it and reloaded to the same code\nWhen a block fails while the script is regenerated after a change, the editor now shows the error instead of silently never offering the save button; a failing export shows its error too",
58
+ "de": "Neue Regelblöcke hinzugefügt\nProblem beim Speichern von Blockly-Skripten unter Blockly 13 behoben: Ein Skript, das ein benanntes Timeout, Intervall oder einen Zeitplan enthielt, konnte nicht mehr gespeichert werden – die Schaltfläche „Speichern“ wurde nicht angezeigt (#2349).\nProblem beim Speichern von Blockly-Skripten behoben, die eine Funktion mit Rückgabewert, aber keine Anweisungen enthalten (#1958)\nDie Blockly-Regressionstests umfassen nun auch das Speichern: Jeder Block wird auf die gleiche Weise wie vom Editor serialisiert und in denselben Code wieder geladen.\nWenn ein Block beim Neugenerieren des Skripts nach einer Änderung fehlschlägt, zeigt der Editor nun den Fehler an, anstatt die Schaltfläche „Speichern“ stillschweigend nicht anzubieten; auch ein fehlgeschlagener Export zeigt seinen Fehler an.",
59
+ "ru": "Добавлены новые блоки правил.\nИсправлена ошибка сохранения скриптов Blockly в Blockly 13: скрипт, содержащий именованный таймаут, интервал или расписание, больше нельзя было сохранить — кнопка сохранения не отображалась (#2349)\nИсправлена ошибка сохранения скриптов Blockly, содержащих функцию с возвращаемым значением и без операторов (#1958)\nВ тестах регрессии Blockly теперь также проверяется сохранение: каждый блок сериализуется так же, как это делает редактор, и загружается в тот же самый код.\nТеперь, если при перегенерации скрипта после внесения изменений блок кода завершается с ошибкой, редактор отображает сообщение об ошибке, вместо того чтобы молча предлагать кнопку сохранения; при неудачном экспорте также отображается сообщение об ошибке.",
60
+ "pt": "Adicionados novos blocos de regras\nCorreção no salvamento de scripts Blockly no Blockly 13: um script contendo um tempo limite, intervalo ou agendamento nomeado não podia mais ser salvo - o botão de salvar não aparecia (#2349)\nCorreção no salvamento de scripts Blockly contendo uma função com um valor de retorno e nenhuma instrução (#1958)\nOs testes de regressão do Blockly agora também abrangem o salvamento: cada bloco é serializado da mesma forma que o editor faz e recarregado com o mesmo código.\nQuando um bloco falha durante a regeneração do script após uma alteração, o editor agora exibe o erro em vez de simplesmente não oferecer o botão de salvar; uma exportação com falha também exibe o erro.",
61
+ "nl": "Nieuwe regelblokken toegevoegd\nOpgelost probleem met het opslaan van Blockly-scripts onder Blockly 13: een script met een benoemde time-out, interval of schema kon niet meer worden opgeslagen - de knop 'Opslaan' verscheen niet (#2349)\nHet opslaan van Blockly-scripts met een functie met een retourwaarde en zonder instructies is nu opgelost (#1958).\nDe regressietests van Blockly omvatten nu ook het opslaan: elk blok wordt geserialiseerd zoals de editor dat doet en opnieuw geladen met dezelfde code.\nAls een codeblok mislukt tijdens het opnieuw genereren van het script na een wijziging, toont de editor nu de foutmelding in plaats van de knop 'Opslaan' stilzwijgend te negeren; een mislukte export toont ook de bijbehorende foutmelding.",
62
+ "fr": "Ajout de nouveaux blocs de règles\nCorrection de l'enregistrement des scripts Blockly sous Blockly 13 : un script contenant un délai d'expiration, un intervalle ou une planification nommés ne pouvait plus être enregistré - le bouton d'enregistrement n'apparaissait pas (#2349)\nCorrection de l'enregistrement des scripts Blockly contenant une fonction avec une valeur de retour et aucune instruction (#1958)\nLes tests de régression de Blockly couvrent désormais également la sauvegarde : chaque bloc est sérialisé de la même manière que l’éditeur et rechargé avec le même code.\nLorsqu'un bloc échoue pendant la régénération du script après une modification, l'éditeur affiche désormais l'erreur au lieu de ne jamais proposer le bouton Enregistrer ; une exportation ayant échoué affiche également son erreur.",
63
+ "it": "Sono stati aggiunti nuovi blocchi di regole.\nRisolto il problema di salvataggio degli script di Blockly in Blockly 13: uno script contenente un timeout, un intervallo o una pianificazione con nome non poteva più essere salvato - il pulsante di salvataggio non veniva visualizzato (#2349)\nRisolto il problema di salvataggio degli script Blockly contenenti una funzione con un valore di ritorno e senza istruzioni (#1958)\nI test di regressione di Blockly ora coprono anche il salvataggio: ogni blocco viene serializzato nello stesso modo in cui lo fa l'editor e ricaricato nello stesso codice\nQuando un blocco fallisce durante la rigenerazione dello script dopo una modifica, l'editor ora mostra l'errore invece di non offrire mai silenziosamente il pulsante di salvataggio; anche un'esportazione non riuscita mostra il relativo errore.",
64
+ "es": "Se agregaron nuevos bloques de reglas\nSe corrigió el guardado de scripts de Blockly en Blockly 13: un script que contenía un tiempo de espera, intervalo o programación con nombre ya no se podía guardar; el botón de guardar no aparecía (#2349).\nSe corrigió el guardado de scripts de Blockly que contienen una función con un valor de retorno y sin instrucciones (#1958).\nLas pruebas de regresión de Blockly ahora también cubren el guardado: cada bloque se serializa de la forma en que lo hace el editor y se vuelve a cargar en el mismo código.\nCuando un bloque falla mientras el script se regenera después de un cambio, el editor ahora muestra el error en lugar de no ofrecer nunca el botón de guardar; una exportación fallida también muestra su error.",
65
+ "pl": "Dodano nowe bloki reguł\nNaprawiono zapisywanie skryptów Blockly w Blockly 13: skryptu zawierającego nazwany limit czasu, interwał lub harmonogram nie można było już zapisać — przycisk zapisu nie pojawiał się (#2349)\nNaprawiono zapisywanie skryptów Blockly zawierających funkcję z wartością zwracaną i bez instrukcji (#1958)\nTesty regresji Blockly obejmują teraz również zapisywanie: każdy blok jest serializowany w taki sam sposób, w jaki robi to edytor, a następnie ładowany ponownie do tego samego kodu\nGdy blok ulegnie awarii podczas ponownego generowania skryptu po zmianie, edytor teraz wyświetla błąd zamiast nie wyświetlać przycisku zapisu; nieudany eksport również wyświetla swój błąd",
66
+ "uk": "Додано нові блоки правил\nВиправлено збереження скриптів Blockly у Blockly 13: скрипт, що містить іменований тайм-аут, інтервал або розклад, більше не міг бути збережений - кнопка збереження не відображалася (#2349)\nВиправлено збереження блокових скриптів, що містять функцію з поверненим значенням та без операторів (#1958).\nРегресійні тести Blockly тепер також охоплюють збереження: кожен блок серіалізується так само, як це робить редактор, і перезавантажується в той самий код.\nКоли блок завершується невдачею під час перегенерації скрипта після зміни, редактор тепер показує помилку, а не мовчки ніколи не пропонував кнопку збереження; невдалий експорт також показує свою помилку.",
67
+ "zh-cn": "新增规则块\n修复了 Blockly 13 下 Blockly 脚本的保存问题:包含命名超时、间隔或计划的脚本无法再保存 - 保存按钮不显示 (#2349)\n修复了保存包含带返回值但没有语句的函数的 Blockly 脚本的问题 (#1958)\nBlockly 的回归测试现在也涵盖了保存操作:每个代码块都会按照编辑器的方式进行序列化,并重新加载到相同的代码中。\n如果脚本在修改后重新生成时某个代码块执行失败,编辑器现在会显示错误信息,而不是像以前那样默默地不提供保存按钮;导出失败也会显示错误信息。"
68
+ },
43
69
  "10.1.1": {
44
70
  "en": "The credentials of the central storage (Basic settings -> Credentials) are available in the scripts as `SECRETS`, e.g. `SECRETS.CameraPassword.key`. The values are decrypted, read-only and are updated live when a credential is edited in the admin UI\nThe editor knows the credentials that exist: after `SECRETS.` it offers their names, and after the next dot exactly the fields the selected credential has\nAdded the Blockly block \"credential\", which reads one field of the central credential storage\nThe instance settings list the available credentials with their fields and the expression a script uses for them",
45
71
  "de": "Die Zugangsdaten für den zentralen Speicher (Grundeinstellungen → Zugangsdaten) sind in den Skripten als `SECRETS` verfügbar, z. B. `SECRETS.CameraPassword.key`. Die Werte sind entschlüsselt, schreibgeschützt und werden live aktualisiert, sobald ein Zugangsdatum in der Admin-Oberfläche bearbeitet wird.\nDer Editor kennt die vorhandenen Zugangsdaten: Nach `SECRETS.` werden deren Namen angezeigt, und nach dem nächsten Punkt genau die Felder, die die ausgewählten Zugangsdaten enthalten.\nDer Blockly-Block „credential“ wurde hinzugefügt, der ein Feld des zentralen Anmeldeinformationsspeichers ausliest.\nDie Instanzeinstellungen listen die verfügbaren Anmeldeinformationen mit ihren Feldern und dem Ausdruck auf, den ein Skript dafür verwendet.",
@@ -104,32 +130,6 @@
104
130
  "pl": "Wprowadzono obsługę menedżera poświadczeń w konfiguracji\nDodano możliwość wykonywania skryptów z poziomu agenta AI",
105
131
  "uk": "Реалізовано підтримку менеджера облікових даних у конфігурації\nДодано можливість виконання скриптів з агента штучного інтелекту",
106
132
  "zh-cn": "在配置中实现了对凭据管理器的支持\n增加了从 AI 代理执行脚本的功能。"
107
- },
108
- "9.2.4": {
109
- "en": "Performance optimizations part 2\nfix filter in tab scripts\nFixed a subscription leak on script stop for RegExp-notation string ids (dispatch index)\n`extendObject` no longer throws into the script when the object contains non-clonable values (e.g. functions)",
110
- "de": "Performance Optimierungen Teil 2\nfix-filter in tab-scripts\nBehebung eines Abonnementlecks bei Skriptstopp für RegExp-Notation String-IDs (Dispatch-Index)\n`extendObject` wirft nicht mehr in das Skript, wenn das Objekt nicht-klonbare Werte (z.B. Funktionen) enthält",
111
- "ru": "Оптимизация производительности часть 2\nисправить фильтр в скриптах вкладок\nИсправлена утечка подписки на остановке скрипта для строковых идентификаторов RegExp-notation (индекс отправки)\n«extendObject» больше не бросается в сценарий, когда объект содержит неклонируемые значения (например, функции)",
112
- "pt": "Otimização de desempenho parte 2\ncorrigir o filtro nos scripts de páginas\nCorrigido um vazamento de assinatura na parada do script para IDs de strings de notação RegExp (índice de distribuição)\n`extendObject` já não é lançado no script quando o objeto contém valores não clonáveis (por exemplo, funções)",
113
- "nl": "Prestatieoptimalisaties deel 2\nfilter herstellen in tabscripts\nVaste een abonnement lek op scriptstop voor RegExp-notatie string-id's (verzendindex)\nHet object wordt niet meer in het script gegooid als het object niet-kloonbare waarden bevat (bv. functies)",
114
- "fr": "Optimisation des performances partie 2\ncorrection du filtre dans les scripts des onglets\nCorrection d'une fuite d'abonnement sur l'arrêt du script pour les ids de chaîne RegExp-notation (index de distribution)\n`extendObject` ne lance plus dans le script lorsque l'objet contient des valeurs non-clonables (par exemple des fonctions)",
115
- "it": "Ottimizzazione delle prestazioni parte 2\ncorrezione del filtro negli script di scheda\nRisolto una perdita di abbonamento sulla fermata dello script per RegExp-notation string ids (indice dispatch)\n`extendObject` non getta più nello script quando l'oggetto contiene valori non clonabili (ad esempio funzioni)",
116
- "es": "Optimizaciones de rendimiento parte 2\nfijar filtro en scripts de pestaña\nSe ha fijado una fuga de suscripción en la parada de script para los ids de cadena RegExp (índice de despacha)\n`extendObject` ya no se lanza al script cuando el objeto contiene valores no visibles (por ejemplo, funciones)",
117
- "pl": "Optymalizacja wydajności część 2\nnaprawić filtr w skryptach kart\nNaprawiono przeciek subskrypcji przy zatrzymaniu skryptu dla idów łańcuchowych RegExp- notation (wskaźnik wysyłkowy)\n'extendObject' nie wrzuca się już do skryptu, gdy obiekt zawiera wartości niemodne (np. funkcje)",
118
- "uk": "Оптимізація продуктивності частини 2\nвиправити фільтр в скриптах вкладок\nВиправлено протікання підписки на сценарій зупинки для рядкових полів RegExp-notation (диспетчерський індекс)\n`extendObject` не завантажується в скрипт, коли об’єкт містить неклоновані значення (наприклад, функції)",
119
- "zh-cn": "业绩优化第2部分\n在标签脚本中修正过滤器\n修复 RegExp Notation 字符串 IDs( 发送索引) 的脚本站订阅漏洞\n当对象包含不可克隆值(例如函数)时,`extend Object'不再丢入脚本"
120
- },
121
- "9.2.3": {
122
- "en": "Performance optimizations done\nAdded on mouse over the value of the state",
123
- "de": "Leistungsoptimierungen durchgeführt\nAuf der Maus über den Wert des Zustands hinzugefügt",
124
- "ru": "Оптимизация производительности\nДобавлено на мыши над стоимостью государства",
125
- "pt": "Otimizações de desempenho feitas\nAdicionado no mouse sobre o valor do estado",
126
- "nl": "Prestatieoptimalisaties uitgevoerd\nToegevoegd aan muis boven de waarde van de status",
127
- "fr": "Optimisations des performances effectuées\nAjouté sur la souris sur la valeur de l'état",
128
- "it": "Ottimizzazione delle prestazioni\nAggiunto sul mouse sopra il valore dello stato",
129
- "es": "Optimizaciones de rendimiento realizadas\nAñadido en el ratón sobre el valor del estado",
130
- "pl": "Optymalizacja wykonania\nDodano na myszce nad wartością stanu",
131
- "uk": "Оптимізація продуктивності\nДодано на мишу над значенням держави",
132
- "zh-cn": "业绩优化\n在鼠标上大于状态值"
133
133
  }
134
134
  },
135
135
  "platform": "Javascript/Node.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.javascript",
3
- "version": "10.1.1",
3
+ "version": "10.1.3",
4
4
  "description": "Rules Engine for ioBroker",
5
5
  "author": "bluefox <dogafox@gmail.com>",
6
6
  "contributors": [
@@ -43,13 +43,13 @@
43
43
  "dependencies": {
44
44
  "@iobroker/adapter-core": "^3.4.3",
45
45
  "@iobroker/types": "^7.2.2",
46
- "@types/node": "^22.19.43",
47
- "axios": "^1.19.0",
46
+ "@types/node": "^22.20.1",
47
+ "axios": "^1.20.0",
48
48
  "jsonata": "^2.2.2",
49
49
  "jszip": "^3.10.1",
50
50
  "node-inspect": "^2.0.0",
51
51
  "node-schedule": "2.1.1",
52
- "nodemailer": "^9.0.5",
52
+ "nodemailer": "^9.0.6",
53
53
  "prettier": "^3.9.6",
54
54
  "promisify-child-process": "^5.0.1",
55
55
  "semver": "^7.8.5",
@@ -1 +0,0 @@
1
- import{Bt as e,Cr as t,Ht as n,Jn as r,Lt as i,dr as a,f as o,pr as s,qn as c,vr as l,xt as u,yt as d,zt as f}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-C8inUeKt.js";t();var p=({originalCode:t,modifiedCode:p,language:m,themeType:h,onAccept:g,onReject:_})=>{let v=l(null),y=l(null),b=l(null);s(()=>{let e=window.monaco;if(!e||!v.current)return;let n=e.editor.createDiffEditor(v.current,{readOnly:!1,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,theme:h===`dark`?`vs-dark`:`vs`,scrollBeyondLastLine:!1,minimap:{enabled:!1}}),r=e.editor.createModel(t,m),i=e.editor.createModel(p,m);return b.current=i,n.setModel({original:r,modified:i}),y.current=n,()=>{n.dispose(),r.dispose(),i.dispose(),y.current=null,b.current=null}},[t,p,m,h]);let x=a(()=>{var e;g(((e=b.current)==null?void 0:e.getValue())||p)},[p,g]);return r(e,{sx:{display:`flex`,flexDirection:`column`,height:`100%`,width:`100%`},children:[r(i,{variant:`dense`,sx:{minHeight:36,bgcolor:`background.paper`,borderBottom:`1px solid`,borderColor:`divider`,gap:1,flexShrink:0},children:[c(f,{variant:`subtitle2`,sx:{flex:1},children:o.t(`AI suggested changes`)}),c(n,{variant:`contained`,color:`success`,size:`small`,startIcon:c(u,{}),onClick:x,children:o.t(`Accept`)}),c(n,{variant:`outlined`,color:`error`,size:`small`,startIcon:c(d,{}),onClick:_,children:o.t(`Reject`)})]}),c(e,{ref:v,sx:{flex:1,overflow:`hidden`}})]})};export{p as default};
@@ -1 +0,0 @@
1
- import{$t as e,Cr as t,Ht as n,In as r,Jn as i,en as a,f as o,nn as s,qn as c,rn as l,tn as u,tr as d,xt as f}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-C8inUeKt.js";t();var p={title:e=>({background:e.palette.error.main,color:e.palette.error.contrastText,"&>h2":{color:e.palette.error.contrastText}})},m=class extends d.Component{constructor(...e){super(...e),r(this,`handleOk`,()=>{this.props.onClose()})}render(){return i(e,{open:!0,maxWidth:`sm`,fullWidth:!0,onClose:()=>this.handleOk(),"aria-labelledby":`alert-dialog-title`,"aria-describedby":`alert-dialog-description`,children:[c(l,{sx:p.title,id:`alert-dialog-title`,children:this.props.title||o.t(`Error`)}),c(u,{children:c(s,{id:`alert-dialog-description`,children:this.props.text||o.t(`Unknown error!`)})}),c(a,{children:c(n,{variant:`contained`,onClick:()=>this.handleOk(),color:`primary`,autoFocus:!0,startIcon:c(f,{}),children:o.t(`Ok`)})})]})}};export{m as t};
@@ -1 +0,0 @@
1
- import{$t as e,A as t,Cr as n,Dn as r,En as i,Ht as a,Jn as o,Ln as s,R as c,St as l,ct as u,en as d,f,g as p,nt as m,qn as h,rn as g,sn as _,tn as v,tr as y,x as b,xt as x}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-C8inUeKt.js";var S=s(h(`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`);n();var C={textArea:{width:`100%`,height:`100%`,overflow:`auto`},textAreaLight:{background:`lightgray`},dialog:{height:`95%`},typography:{padding:16},overflowY:{overflowY:`hidden`}},w=class extends y.Component{constructor(e){super(e),this.state={anchorEl:null,popper:``}}handleCancel(){this.props.onClose()}onCopy(e){p.copyToClipboard(this.props.text);let t=e.currentTarget;setTimeout(()=>{this.setState({popper:f.t(`Copied`),anchorEl:t}),setTimeout(()=>this.setState({popper:``,anchorEl:null}),1e3)},50)}render(){let t=new Blob([this.props.text],{type:`application/xml`}),n=`${this.props.scriptId.substring(10)}.xml`;return o(e,{onClose:()=>!1,maxWidth:`lg`,sx:{"& .MuiDialog-paper":C.dialog},fullWidth:!0,open:!0,"aria-labelledby":`export-dialog-title`,children:[h(g,{id:`export-dialog-title`,children:f.t(`Export selected blocks`)}),h(v,{style:C.overflowY,children:h(`pre`,{id:`export-text`,style:{...C.textArea,...this.props.themeType===`dark`?void 0:C.textAreaLight},children:this.props.text})}),o(d,{children:[h(a,{variant:`contained`,color:`secondary`,startIcon:h(m,{}),children:h(`a`,{download:n,target:`_blank`,rel:`noreferrer`,href:URL.createObjectURL(t),style:{textDecoration:`inherit`,color:`inherit`},children:f.t(`Download as file`)})}),h(a,{variant:`contained`,onClick:e=>this.onCopy(e),color:`secondary`,startIcon:h(S,{}),children:f.t(`Copy to clipboard`)}),h(a,{variant:`contained`,onClick:()=>this.handleCancel(),color:`primary`,startIcon:h(l,{}),children:f.t(`Close`)}),h(r,{id:`popper`,style:{zIndex:1e4},open:!!this.state.popper,placement:`top`,anchorEl:this.state.anchorEl,transition:!0,children:({TransitionProps:e})=>h(_,{...e,timeout:350,children:h(i,{children:h(`p`,{style:C.typography,children:this.state.popper})})})}),h(`textarea`,{id:`copy_input`,readOnly:!0,style:{position:`absolute`,left:-9999},tabIndex:-1,"aria-hidden":!0,value:this.props.text})]})]},`export-dialog`)}};n();var T={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`}},E=class n extends y.Component{constructor(e){super(e),this.state={text:``,imageStatus:``,error:``}}componentDidMount(){setTimeout(()=>{try{var e;(e=window.document.getElementById(`import-text-area`))==null||e.focus()}catch{}},100)}static readFileDataUrl(e,t){let n=new FileReader;n.onload=()=>{t(null,{data:n.result,name:e.name})},n.onabort=()=>{console.error(`file reading was aborted`),t(f.t(`file reading was aborted`))},n.onerror=e=>{console.error(`file reading has failed`),t(f.t(`file reading has failed: %s`,e))},n.readAsText(e)}handleDropFile(e){if(!(e!=null&&e.length))return;let t=e[e.length-1];t&&n.readFileDataUrl(t,(e,t)=>{if(e||!t)this.setState({error:e||`No data`});else{var n;this.setState({text:((n=t.data)==null?void 0:n.toString())||``})}})}handleCancel(){this.props.onClose()}handleOk(){this.props.onClose(this.state.text)}onChange(e){this.setState({text:e.target.value})}render(){let n={...T.dropzone,...this.state.imageStatus===`accepted`?T.dropzoneAccepted:this.state.imageStatus===`rejected`?T.dropzoneRejected:void 0};return o(e,{onClose:()=>!1,maxWidth:`lg`,sx:{"& .MuiDialog-paper":T.dialog},fullWidth:!0,open:!0,"aria-labelledby":`import-dialog-title`,children:[h(g,{id:`import-dialog-title`,children:f.t(`Import blocks`)}),o(v,{style:T.fullHeight,children:[h(`textarea`,{autoFocus:!0,id:`import-text-area`,placeholder:f.t(`Paste your blocks here`),style:{...T.textArea,color:this.props.themeType===`dark`?`#ffffff`:`#000000`},onChange:e=>this.onChange(e),value:this.state.text}),h(u,{maxSize:5e7,onDrop:(e,t)=>{if(e.length)this.handleDropFile(e);else{var n;window.alert((t==null||(n=t[0])==null||(n=n.errors)==null||(n=n[0])==null?void 0:n.message)||f.t(`ra_Cannot upload`))}},multiple:!1,accept:{"text/plain":[],"text/xml":[],"application/xml":[]},children:({getRootProps:e,getInputProps:r,isDragActive:i,isDragReject:a})=>a?(this.state.imageStatus!==`rejected`&&this.setState({imageStatus:`rejected`}),o(`div`,{style:{...n,...T.dropzoneDiv},...e(),children:[h(`input`,{...r()}),h(`span`,{style:T.text,children:f.t(`Some files will be rejected`)},`text`),h(t,{style:{...T.icon,...T.iconError}},`icon`)]})):i?(this.state.imageStatus!==`accepted`&&this.setState({imageStatus:`accepted`}),o(`div`,{style:{...n,...T.dropzoneDiv},...e(),children:[h(`input`,{...r()}),h(`span`,{style:T.text,children:f.t(`All files will be accepted`)},`text`),h(b,{style:{...T.icon,...T.iconOk}},`icon`)]})):(this.state.imageStatus!==`wait`&&this.setState({imageStatus:`wait`}),o(`div`,{style:{...n,...T.dropzoneDiv},...e(),children:[h(`input`,{...r()}),h(`span`,{style:T.text,children:f.t(`Drop some files here or click...`)},`text`),h(c,{style:T.icon},`icon`)]}))})]}),o(d,{children:[h(a,{variant:`contained`,disabled:!this.state.text,onClick:()=>this.handleOk(),color:`primary`,startIcon:h(x,{}),children:f.t(`Import`)}),h(a,{color:`grey`,variant:`contained`,onClick:()=>this.handleCancel(),startIcon:h(l,{}),children:f.t(`Close`)})]})]})}};export{w as n,E as t};
@@ -1 +0,0 @@
1
- import{$t as e,Cn as t,Cr as n,Ct as r,Dt as i,Ht as a,Jn as o,Ln as s,On as c,Pn as l,Pt as u,Tn as d,Tt as f,Zt as p,dr as m,dt as h,en as g,f as _,fr as v,g as y,gr as b,lr as x,mr as S,nn as C,pn as w,pr as T,qn as E,rn as D,tn as O,vr as k,wt as A,xt as j,yr as M,yt as N}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-C8inUeKt.js";import{n as P,t as ee}from"./Import-BjMtH6Gk.js";import{_ as F,a as I,g as L,h as R,i as z,n as te,o as B,r as ne,t as V,v as H,x as U,y as W}from"./index-07o_WKsX.js";var re=s(E(`path`,{d:`M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.996.996 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12z`}),`AutoFixHigh`),ie=s(E(`path`,{d:`M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z`}),`ChevronLeft`),ae=s(E(`path`,{d:`M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z`}),`ChevronRight`),oe=s(E(`path`,{d:`M16 9v10H8V9zm-1.5-6h-5l-1 1H5v2h14V4h-3.5zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2z`}),`DeleteOutlined`),se=s(E(`path`,{d:`M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z`}),`NavigateBefore`);n();function ce(e){let t=H().getMonitor(),[n,r]=W(t,e);return T(()=>t.subscribeToOffsetChange(r)),T(()=>t.subscribeToStateChange(r)),n}var le;function ue(){return le||(le=new Image,le.src=`data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==`),le}var G={wrapperRules:`_wrapperRules_1fisr_1`,rootWrapper:`_rootWrapper_1fisr_9`,bands:`_bands_1fisr_21`,emptyRule:`_emptyRule_1fisr_34`,emptyRuleText:`_emptyRuleText_1fisr_46`},de={switchesItem:`_switchesItem_10ls3_1`,switchesItemActive:`_switchesItemActive_10ls3_28`,iconTheme:`_iconTheme_10ls3_36`};n();var fe=({name:e,id:t,active:n,icon:r,adapter:i,socket:a,onDoubleClick:s,title:c,onTouchMove:l,style:u})=>o(`div`,{onDoubleClick:s,onTouchMove:l,title:c?_.t(c):void 0,className:y.clsx(de.switchesItem,n&&de.switchesItemActive,`block-${t}`),children:[E(I,{iconName:r,className:de.iconTheme,adapter:i,socket:a,style:u}),E(`span`,{children:e?_.t(e):``})]},t),K={cardStyle:`_cardStyle_vibq0_1`,railTriggers:`_railTriggers_vibq0_25`,railConditions:`_railConditions_vibq0_29`,railActions:`_railActions_vibq0_33`,cardStyleActive:`_cardStyleActive_vibq0_37`,controlMenu:`_controlMenu_vibq0_42`,closeBtn:`_closeBtn_vibq0_60`,isDelete:`_isDelete_vibq0_102`,drag_mobile:`_drag_mobile_vibq0_121`};function q(e,t,n){let r;switch(e){case`actions`:if(n===`else`)return r={...t,actions:{...t[e],else:[...t[e].else]}},r;if(n===`then`)return r={...t,actions:{...t[e],then:[...t[e].then]}},r;throw console.error(`Unknown additionalParameter: ${n}`),Error(`Unknown additionalParameter: ${n}`);case`triggers`:return r={...t,triggers:[...t.triggers]},r;case`conditions`:return r={...t,conditions:[...t.conditions]},r;default:throw Error(`Unknown name: ${e}`)}}function J(e,t,n,r){switch(e){case`actions`:return t.actions[n]=t.actions[n].filter(e=>e._id!==r),t;case`conditions`:var i;return t.conditions[n]=(i=t.conditions[n])==null?void 0:i.filter(e=>e._id!==r),t;default:return t.triggers=t.triggers.filter(e=>e._id!==r),t}}function pe(e,t,n){let{_id:r,acceptedBy:i}=e,a;if(!i||!t[i])return console.warn(`Cannot find ${i}`),t;switch(i){case`actions`:if(a=t.actions[n].find(e=>e._id===r),!a)console.warn(`Cannot find ${r}`);else{let r=t.actions[n].indexOf(a);t.actions[n][r]=e}return t;case`conditions`:if(a=t.conditions[n].find(e=>e._id===r),!a)console.warn(`Cannot find ${r}`);else{let r=t.conditions[n].indexOf(a);t.conditions[n][r]=e}return t;default:if(a=t.triggers.find(e=>e._id===r),!a)console.warn(`Cannot find ${r}`);else{let n=t.triggers.indexOf(a);t.triggers[n]=e}return t}}n();var me={triggers:K.railTriggers,conditions:K.railConditions,actions:K.railActions},he=x(e=>{var t;let{setUserRules:n,userRules:r,_id:i,id:a,blockValue:s,active:c,acceptedBy:l,isTourOpen:u,setTourStep:d,tourStep:f}=e,{blocks:p,socket:h,onUpdate:g,setOnUpdate:_,onDebugMessage:y,enableSimulation:x}=v(V),S=m(e=>p==null?void 0:p.find(t=>t.getStaticData().id===e),[p]),C=m(e=>{let t=pe(e,r,s);t&&n(t)},[r]),w=b(()=>{let t=S(a)||z;return E(t,{...e,notFound:!S(a),isTourOpen:u,setTourStep:d,tourStep:f,onUpdate:g,setOnUpdate:_,enableSimulation:x,onDebugMessage:y,onChange:C,className:void 0,socket:h})},[r,g,y,x]),[T,D]=M(!1);return o(`div`,{onMouseDown:e=>{if(e.ctrlKey){let e,t=q(l,r,s);l===`conditions`?(e=t.conditions[s].find(e=>e._id===i),e&&t.conditions[s].splice(t.conditions[s].indexOf(e),0,{...e,_id:Date.now()})):l===`actions`?(e=t.actions[s].find(e=>e._id===i),e&&t.actions[s].splice(t.actions[s].indexOf(e),0,{...e,_id:Date.now()})):(e=t.triggers.find(e=>e._id===i),e&&t.triggers.splice(t[l].indexOf(e),0,{...e,_id:Date.now()})),n(t)}},id:`height`,style:c?{width:(((t=document.getElementById(`width`))==null?void 0:t.clientWidth)||0)-70}:void 0,className:[K.cardStyle,me[l],c&&K.cardStyleActive,T&&K.isDelete].filter(Boolean).join(` `),children:[E(`div`,{className:K.drag_mobile}),w,n&&E(`div`,{className:K.controlMenu,children:E(`div`,{onClick:()=>{let e=q(l,r,s);e=J(l,e,s,i),D(!0),setTimeout(()=>{l===`triggers`&&_(!0),n(e)},300)},className:K.closeBtn})})]})});n();var ge={position:`fixed`,pointerEvents:`none`,zIndex:100,left:0,top:0,width:`100%`,height:`100%`},_e=(e,t)=>[Math.round(e/32)*32,Math.round(t/32)*32],ve=(e,t,n)=>{if(!e||!t)return{display:`none`};let{x:r,y:i}=t;n&&(r-=e.x,i-=e.y,[r,i]=_e(r,i),r+=e.x,i+=e.y);let a=`translate(${r}px, ${i}px)`;return{transform:a,WebkitTransform:a}},ye=e=>{let{itemType:t,isDragging:n,item:r,initialOffset:i,currentOffset:a,targetIds:o}=ce(e=>({item:e.getItem(),itemType:e.getItemType(),initialOffset:e.getInitialSourceClientOffset(),currentOffset:e.getSourceClientOffset(),isDragging:e.isDragging(),targetIds:e.getTargetIds()}));return n?E(`div`,{style:ge,children:E(`div`,{style:ve(i,a),children:(()=>{switch(t){case`box`:return o.length?E(he,{active:!0,...r,allBlocks:e.allBlocks}):E(fe,{active:!0,...r,socket:e.socket});default:return null}})()})}):null},Y={emptyBlockStyle:`_emptyBlockStyle_p7qtf_1`,emptyBlock:`_emptyBlock_p7qtf_1`,marginTop:`_marginTop_p7qtf_1`,selectOnChange:`_selectOnChange_p7qtf_17`,selectOnChangeHelp:`_selectOnChangeHelp_p7qtf_23`,selectOnChangeHelpIcon:`_selectOnChangeHelpIcon_p7qtf_29`,emptyBlockNone:`_emptyBlockNone_p7qtf_44`,bandTriggers:`_bandTriggers_p7qtf_57`,bandConditions:`_bandConditions_p7qtf_61`,bandActions:`_bandActions_p7qtf_65`,mainBlockItemRules:`_mainBlockItemRules_p7qtf_69`,nameBlockItems:`_nameBlockItems_p7qtf_93`,contentBlockItem:`_contentBlockItem_p7qtf_119`,wrapperMargin:`_wrapperMargin_p7qtf_127`,contentHeightOn:`_contentHeightOn_p7qtf_134`,heightBlock:`_heightBlock_p7qtf_1`,contentHeightOff:`_contentHeightOff_p7qtf_146`,cardAdd:`_cardAdd_p7qtf_152`,blockCardAdd:`_blockCardAdd_p7qtf_172`};n();function be(e,t){let[n,r]=M(window.localStorage.getItem(t)?JSON.parse(window.localStorage.getItem(t)||``):e);return[n,e=>{window.localStorage.setItem(t,JSON.stringify(e)),r(e)},!!window.localStorage.getItem(t)]}function xe(e,t){let n=0,r=null,i;return function(...a){let o=Date.now();i=a,o-n>=t?(n=o,e.apply(this,a)):r||=setTimeout(()=>{n=Date.now(),r=null,e.apply(this,i)},t-(o-n))}}function X(e){if(Array.isArray(e))return e.map(e=>X(e));if(typeof e==`function`)return e.bind(null);if(e&&typeof e==`object`){let t={};return Object.keys(e).forEach(n=>{t[n]=X(e[n])}),t}return e}var Se=xe((e,t)=>e(t),0);function Ce(e,t){let n=t.find(t=>t._id===e);return{card:n,index:n?t.indexOf(n):-1}}function we(e,t,n,r,i,a,o,s,c){let{card:l,index:u}=Ce(e,n);if(!(u<t&&s<c)&&!(u>t&&s>c)&&l&&u!==t){let e=X(n);e.splice(u,1),e.splice(t,0,l);let s=X(i);switch(a){case`actions`:s.actions[o]=e,Se(r,s);return;case`conditions`:s.conditions[o]=e,Se(r,s);return;default:s.triggers=e,Se(r,s);return}}}var Te={drag:`_drag_7xfhc_1`,root:`_root_7xfhc_11`};n();var Ee=({typeBlock:e,allProperties:t,id:n,isActive:r,setUserRules:i,userRules:a,children:s,_id:c,blockValue:l})=>{let{setOnUpdate:u}=v(V),[{opacity:d},f,p]=F({type:`box`,item:()=>({...t,id:n,isActive:r,_id:c}),end:(e,t)=>{let{acceptedBy:n}=e,r=t.getDropResult(),o;if(!r)return typeof c==`number`&&!t.getTargetIds().length&&(o=q(n,a,l),o=J(n,o,l,c),i(o)),null;if(r.blockValue!==l){let t=typeof c==`number`?c:Date.now();o=q(n,a,r.blockValue);let s={id:e.id,acceptedBy:e.acceptedBy};switch(n){case`actions`:return l&&(o=J(`actions`,o,l,t)),o=J(`actions`,o,r.blockValue,t),o.actions[r.blockValue].push({...s,_id:t}),i(o);case`conditions`:return typeof l==`number`&&(o=J(`conditions`,o,l,t)),o=J(`conditions`,o,r.blockValue,t),o.conditions[r.blockValue].push({...s,_id:t}),i(o);default:return u(!0),o=J(`triggers`,o,r.blockValue,t),o.triggers.push({...s,_id:t}),i(o)}}},collect:e=>({opacity:e.isDragging()?.4:1,isDragging:e.isDragging()})}),m=k(null),[,h]=L({accept:`box`,canDrop:()=>!1,hover({_id:t,acceptedBy:n},r){var o;if(!m.current||e!==n)return;let s=(o=m.current)==null?void 0:o.getBoundingClientRect(),u=(s.bottom-s.top)/2,d=r.getClientOffset(),f=((d==null?void 0:d.y)||0)-s.top;if(c&&t!==c)switch(n){case`actions`:if(l===`then`||l===`else`){let{index:e}=Ce(c,a.actions[l]);e!==t&&we(t,e,a[n][l],i,a,n,l,f,u)}return;case`conditions`:if(typeof l==`number`){let{index:e}=Ce(c,a[n][l]);e!==t&&we(t,e,a[n][l],i,a,n,l,f,u)}return;default:{let{index:e}=Ce(c,a[n]);e!==t&&we(t,e,a[n],i,a,n,void 0,f,u);return}}}});T(()=>{p(ue(),{captureDraggingState:!0})},[]),f(h(m));let g=window.innerWidth<600;return o(`div`,{ref:g&&c?null:m,className:Te.root,style:{opacity:d},children:[E(`div`,{className:c?Te.drag:null,ref:c&&g?m:null}),s]})};n();var De=({onClose:t,open:n})=>o(e,{open:n,onClose:t,"aria-labelledby":`alert-dialog-title`,"aria-describedby":`alert-dialog-description`,children:[E(O,{children:o(`div`,{style:{fontSize:`1rem`,fontFamily:`"Roboto", "Helvetica", "Arial", sans-serif`,fontWeight:400,lineHeight:1.5,letterSpacing:`0.00938em`},children:[E(`h3`,{children:_.t(`On condition change`)}),E(`div`,{children:_.t(`help_on_change`)}),E(`h3`,{children:_.t(`Just check`)}),E(`div`,{children:_.t(`help_just_check`)})]})}),E(g,{children:E(a,{onClick:t,color:`primary`,autoFocus:!0,startIcon:E(j,{}),children:_.t(`OK`)})})]});n();var Oe=({onClose:t,open:n})=>o(e,{open:n,onClose:t,"aria-labelledby":`alert-dialog-title`,"aria-describedby":`alert-dialog-description`,children:[E(O,{children:o(C,{id:`alert-dialog-description`,children:[E(`h3`,{children:_.t(`On condition change`)}),E(`div`,{children:_.t(`help_on_change`)}),E(`h3`,{children:_.t(`Just check`)}),E(`div`,{children:_.t(`help_just_check`)})]})}),E(g,{children:E(a,{onClick:t,color:`primary`,autoFocus:!0,children:_.t(`OK`)})})]});n();var ke={triggers:Y.bandTriggers,conditions:Y.bandConditions,actions:Y.bandActions},Ae=({blockValue:e,boolean:t,typeBlock:n,userRules:r,setUserRules:i,animation:a,setTourStep:s,tourStep:c,isTourOpen:l,theme:u,themeType:d,themeName:f})=>{var p;let[m,h]=M(!1),[g,_]=M(!1),[v,b]=M(!1),[x,S]=M(``);t===void 0&&(t=!0);let C=L({accept:`box`,drop:()=>({blockValue:e}),hover:({acceptedBy:e,_id:t},r)=>{h(e===n),b(!!t),S(r.getHandlerId()||``)},canDrop:({acceptedBy:e})=>(_(e===n),e===n),collect:e=>{var t;return{isOver:e.isOver(),canDrop:((t=e.getItem())==null?void 0:t.acceptedBy)===n,offset:e.getClientOffset(),targetId:e.getHandlerId()}}}),{canDrop:w,isOver:D,offset:O,targetId:k}=C[0],A=C[1];T(()=>{S(``)},[O]);let j=w&&D,N=``;j?N=m?`#00fb003d`:`#fb00002e`:w?N=g?`#00fb003d`:`#fb00002e`:O&&(N=k===x?`#fb00002e`:``);let P;return P=n===`actions`?r.actions[e]:n===`conditions`?r.conditions[e]:r.triggers,E(`div`,{ref:e=>{A(e)},style:{backgroundColor:N},className:y.clsx(Y.contentBlockItem,t?a&&Y.contentHeightOn:Y.contentHeightOff),children:o(`div`,{className:Y.wrapperMargin,children:[P.map(t=>E(Ee,{typeBlock:n,...t,blockValue:e,allProperties:t,userRules:r,setUserRules:i,children:E(he,{...t,isTourOpen:l,setTourStep:s,tourStep:c,settings:t,blockValue:e,userRules:r,setUserRules:i,theme:u,themeType:d,themeName:f})},t._id)),E(`div`,{style:j&&m&&!v?{height:((p=document.getElementById(`height`))==null?void 0:p.clientHeight)||200}:void 0,className:`${Y.emptyBlockStyle} ${j&&m&&!v?Y.emptyBlock:Y.emptyBlockNone}`})]})})},je=({typeBlock:e,name:t,nameAdditionally:n,additionally:r,userRules:i,setUserRules:a,iconName:s,adapter:l,socket:u,setTourStep:f,tourStep:p,isTourOpen:m,theme:h,themeType:g,themeName:v})=>{let[y,b,x]=be(e!==`actions`&&[],`additionallyClickItems_${e}`),[C,D]=M(!1),[O,k]=M(!1);T(()=>{if(e===`conditions`&&(y==null?void 0:y.length)!==i.conditions.length-1){let e=[];i.conditions.forEach((t,n)=>{n>0&&e.push({_id:Date.now(),open:!0})}),b([...y,...e])}e===`actions`&&!x&&i.actions.else.length&&b(!0)},[]);let[A,j]=M(!1);return o(`div`,{className:`${Y.mainBlockItemRules} ${ke[e]}`,children:[o(`span`,{id:`width`,className:Y.nameBlockItems,children:[E(I,{iconName:s,className:Y.iconThemCard,adapter:l,socket:u}),t]}),e===`conditions`?o(`div`,{style:{width:`100%`},children:[o(c,{variant:`standard`,className:Y.selectOnChange,value:i.justCheck||!1,onChange:e=>{let t=q(`conditions`,i);t.justCheck=e.target.value===`true`,a(t)},children:[E(d,{value:`false`,children:_.t(`on condition change`)}),E(d,{value:`true`,children:_.t(`just check`)})]}),E(w,{size:`small`,title:_.t(`Explanation`),className:Y.selectOnChangeHelp,onClick:()=>D(!0),children:E(U,{className:Y.selectOnChangeHelpIcon})})]}):null,E(Ae,{setTourStep:f,tourStep:p,isTourOpen:m,blockValue:e===`actions`?`then`:e===`conditions`?0:e,typeBlock:e,setUserRules:a,userRules:i,theme:h,themeName:v,themeType:g}),r&&[...Array(e===`actions`?1:i.conditions.length-1)].map((t,r)=>{let s=(t=r)=>e===`actions`?!!y:!!y.find((e,n)=>n===t&&e.open);return o(S,{children:[o(`div`,{onClick:()=>{if(e===`actions`)return b(!y),null;let t=JSON.parse(JSON.stringify(y));if(i.conditions[r+1].length)return t[r].open=!t[r].open,b(t),null;t=t.filter((e,t)=>t!==r),b(t),j(r),setTimeout(()=>{j(!1),a({...i,conditions:[...i.conditions.filter((e,t)=>t!==r+1)]})},250)},className:Y.blockCardAdd,children:[s()?`-`:`+`,E(`div`,{className:Y.cardAdd,children:n})]},r),E(Ae,{blockValue:e===`actions`?`else`:e===`conditions`?r+1:e,typeBlock:e,setUserRules:a,userRules:i,boolean:s(),animation:A===r,theme:h,themeName:v,themeType:g})]},`${r}_block_${e}`)}),r&&e===`conditions`&&o(`div`,{onClick:()=>{b([...y,{_id:Date.now(),open:!0}]),a({...i,conditions:[...i.conditions,[]]}),j(i.conditions.length-1),setTimeout(()=>j(!1),1e3)},className:Y.blockCardAdd,children:[`+`,E(`div`,{className:Y.cardAdd,children:n})]}),E(De,{open:C,onClose:()=>D(!1)}),E(Oe,{open:O,onClose:()=>k(!1)})]})},Z={menuRules:`_menuRules_1b2q2_1`,wizardButton:`_wizardButton_1b2q2_13`,switchesRenderWrapper:`_switchesRenderWrapper_1b2q2_21`,menuOff:`_menuOff_1b2q2_30`,menuTitle:`_menuTitle_1b2q2_36`,marginAuto:`_marginAuto_1b2q2_50`,inputWidth:`_inputWidth_1b2q2_55`,menuWrapper:`_menuWrapper_1b2q2_60`,hamburgerWrapper:`_hamburgerWrapper_1b2q2_68`,hamburgerOff:`_hamburgerOff_1b2q2_96`,nothingFound:`_nothingFound_1b2q2_104`,resetSearch:`_resetSearch_1b2q2_111`,controlPanel:`_controlPanel_1b2q2_123`,controlPanelAppBar:`_controlPanelAppBar_1b2q2_134`,addClassMenu:`_addClassMenu_1b2q2_148`,addClassBackground:`_addClassBackground_1b2q2_154`,addClassPosition:`_addClassPosition_1b2q2_158`};n();var Me=e=>{let{allProperties:t,allProperties:{acceptedBy:n,id:r},setUserRules:i,userRules:a,setTourStep:o,tourStep:s,isTourOpen:c,onTouchMove:l,isActive:u}=e;return E(Ee,{allProperties:t,id:t.id,isActive:u,setUserRules:i,userRules:a,children:E(fe,{onDoubleClick:()=>{c&&s===R.addScheduleByDoubleClick&&r===`TriggerScheduleBlock`&&o(R.openTagsMenu),c&&s===R.addActionPrintText&&r===`ActionPrintText`&&o(R.showJavascript);let e=Date.now(),t;switch(n){case`actions`:t=`then`;break;case`conditions`:t=a[n].length-1}let l=q(n,a,t),u={id:r,_id:e,acceptedBy:n};t===void 0?l.triggers.push({...u}):n===`actions`?l.actions[t].push({...u}):n===`conditions`&&l.conditions[t].push({...u}),i(l)},...e,...t,onTouchMove:l})})};n();var Ne=({addClass:e,setAllBlocks:n,allBlocks:r,userRules:s,onChangeBlocks:c,setTourStep:l,tourStep:d,isTourOpen:f,onStartWizard:m})=>{let{blocks:h,socket:g}=v(V),[b,x]=be(!1,`hamburgerOnOff`),[C,w]=be({text:``,type:`triggers`,index:0},`filterControlPanel`),D=(e=C.text,t=C.type)=>{if(!h)return;let r=[...h];r=r.filter(t=>{if(!e)return!0;let{name:n}=t.getStaticData();return n&&_.t(n).toLowerCase().includes(e.toLowerCase())}),r=r.filter(e=>t===e.getStaticData().acceptedBy),n(r)},O=(e,t)=>{f&&t===0&&d===R.selectTriggers&&l(R.addScheduleByDoubleClick),f&&t===2&&d===R.selectActions&&l(R.addActionPrintText),w({...C,index:t,type:[`triggers`,`conditions`,`actions`][t]}),D(C.text,[`triggers`,`conditions`,`actions`][t])},k=e=>({id:`scrollable-force-tab-${e}`,"aria-controls":`scrollable-force-tabpanel-${e}`});return T(()=>{D()},[h]),E(p,{mouseEvent:!1,touchEvent:`onTouchStart`,onClickAway:()=>x(!0),children:o(`div`,{className:y.clsx(Z.menuWrapper,e[1035]&&Z.addClassMenu),children:[E(`div`,{className:`${Z.hamburgerWrapper} ${b?Z.hamburgerOff:null}`,onClick:()=>x(!b),children:E(b?ae:ie,{})}),o(`div`,{className:`${y.clsx(Z.menuRules,e[1035]&&Z.addClassBackground,e[835]&&Z.addClassPosition)} ${b?Z.menuOff:null}`,children:[E(a,{className:Z.wizardButton,fullWidth:!0,size:`small`,variant:`outlined`,startIcon:E(re,{}),onClick:m,children:_.t(`Wizard`)}),E(`div`,{className:Z.controlPanel,children:E(t,{className:Z.controlPanelAppBar,position:`static`,children:o(u,{value:C.index,onChange:O,children:[E(i,{className:`blocks-triggers`,title:_.t(`Triggers`),icon:E(I,{iconName:`FlashOn`}),...k(0)}),E(i,{title:_.t(`Conditions`),className:`blocks-conditions`,icon:E(I,{iconName:`Help`}),...k(1)}),E(i,{title:_.t(`Actions`),className:`blocks-actions`,icon:E(I,{iconName:`PlayForWork`}),...k(2)})]})})}),E(`div`,{className:Z.switchesRenderWrapper,children:o(`span`,{children:[r.map(e=>{let{name:t,id:n,icon:r,adapter:i}=e.getStaticData();return E(S,{children:E(Me,{adapter:i,allProperties:e.getStaticData(),icon:r,id:n,isActive:!1,isTourOpen:f,name:t,onTouchMove:()=>x(!0),setTourStep:l,setUserRules:c,socket:g,tourStep:d,userRules:s})},n)}),!r.length&&o(`div`,{className:Z.nothingFound,children:[_.t(`Nothing found`),`...`,E(`div`,{className:Z.resetSearch,onClick:()=>{w({...C,text:``}),D(``)},children:_.t(`reset search`)})]})]})}),E(`div`,{className:y.clsx(Z.menuTitle,Z.marginAuto)}),E(B,{className:Z.inputWidth,fullWidth:!0,customValue:!0,value:C.text,size:`small`,autoComplete:`off`,label:_.t(`search`),variant:`outlined`,onChange:e=>{w({...C,text:e}),D(e)}})]})]})})},Q={bandTriggers:`_bandTriggers_91vrz_5`,bandConditions:`_bandConditions_91vrz_9`,bandActions:`_bandActions_91vrz_13`,paper:`_paper_91vrz_17`,title:`_title_91vrz_22`,close:`_close_91vrz_29`,content:`_content_91vrz_35`,stepper:`_stepper_91vrz_40`,step:`_step_91vrz_40`,hint:`_hint_91vrz_56`,warning:`_warning_91vrz_61`,blockCard:`_blockCard_91vrz_68`,blockBody:`_blockBody_91vrz_79`,remove:`_remove_91vrz_86`,notFound:`_notFound_91vrz_93`,chooser:`_chooser_91vrz_99`,choice:`_choice_91vrz_105`,choiceIcon:`_choiceIcon_91vrz_128`,choiceName:`_choiceName_91vrz_136`,addMore:`_addMore_91vrz_144`,summaryBand:`_summaryBand_91vrz_150`,summaryLabel:`_summaryLabel_91vrz_156`,preview:`_preview_91vrz_164`,actions:`_actions_91vrz_169`,spacer:`_spacer_91vrz_173`};n();var $=[`triggers`,`conditions`,`actions`],Pe={triggers:`Triggers`,conditions:`Conditions`,actions:`Actions`},Fe={triggers:`What should start the rule?`,conditions:`When should the rule run? This step is optional.`,actions:`What should happen?`},Ie={triggers:`when`,conditions:`and`,actions:`then`},Le={triggers:Q.bandTriggers,conditions:Q.bandConditions,actions:Q.bandActions},Re=()=>({triggers:[],conditions:[],actions:[]}),ze=({onCreate:t,onClose:n,hasRule:i,socket:s,theme:c,themeType:u,themeName:d})=>{let{blocks:p}=v(V),[m,x]=M(0),[S,C]=M(Re),[T,j]=M(null),P=k(0),ee=b(()=>{let e={triggers:[],conditions:[],actions:[]};return p==null||p.forEach(t=>{var n;let{acceptedBy:r}=t.getStaticData();(n=e[r])==null||n.push(t)}),e},[p]),F=b(()=>({triggers:S.triggers,conditions:S.conditions.length?[S.conditions]:[[]],justCheck:!1,actions:{then:S.actions,else:[]}}),[S]),L=(e,t)=>{P.current+=1,C(n=>({...n,[e]:[...n[e],{id:t,_id:P.current,acceptedBy:e}]})),j(null)},R=(e,t)=>C(n=>({...n,[e]:n[e].filter(e=>e._id!==t)})),z=(e,t,n)=>C(r=>({...r,[e]:r[e].map(r=>r._id===t?{...n,_id:t,id:r.id,acceptedBy:e}:r)})),te=(e,t,n)=>{let r=p==null?void 0:p.find(t=>t.getStaticData().id===e.id);return r?E(r,{_id:e._id,settings:e,acceptedBy:t,onChange:n?()=>{}:n=>z(t,e._id,n),socket:s,theme:c,themeType:u,themeName:d,enableSimulation:!1,userRules:F,onUpdate:!1,setOnUpdate:()=>{}}):E(`div`,{className:Q.notFound,children:_.t(`Block not found`)})},B=e=>E(`div`,{className:Q.chooser,children:ee[e].map(t=>{let{id:n,name:r,icon:i,adapter:a,title:c}=t.getStaticData();return o(`button`,{type:`button`,className:Q.choice,title:c?_.t(c):void 0,onClick:()=>L(e,n),children:[E(I,{iconName:i,adapter:a,socket:s,className:Q.choiceIcon}),E(`span`,{className:Q.choiceName,children:_.t(r)})]},n)})}),ne=(e,t)=>o(`div`,{className:Q.step,hidden:m!==t,children:[E(`div`,{className:Q.hint,children:_.t(Fe[e])}),S[e].map(t=>o(`div`,{className:y.clsx(Q.blockCard,Le[e]),children:[E(`div`,{className:Q.blockBody,children:te(t,e)}),E(w,{className:Q.remove,size:`small`,title:_.t(`Delete`),onClick:()=>R(e,t._id),children:E(oe,{fontSize:`small`})})]},t._id)),T===e||!S[e].length?B(e):E(a,{className:Q.addMore,startIcon:E(r,{}),onClick:()=>j(e),children:_.t(`Add another`)})]},e),H=()=>o(`div`,{className:Q.step,children:[$.map(e=>S[e].length?o(`div`,{className:Q.summaryBand,children:[E(`div`,{className:y.clsx(Q.summaryLabel,Le[e]),children:_.t(Ie[e])}),S[e].map(t=>E(`div`,{className:y.clsx(Q.blockCard,Q.preview,Le[e]),children:E(`div`,{className:Q.blockBody,children:te(t,e,!0)})},t._id))]},e):null),S.conditions.length?null:E(`div`,{className:Q.hint,children:_.t(`Without a condition the rule always runs`)}),i?E(`div`,{className:Q.warning,children:_.t(`The current rule will be replaced`)}):null]}),U=m===$.length,W=U||m===1||!!S[$[m]].length;return o(e,{open:!0,fullWidth:!0,maxWidth:`md`,onClose:n,classes:{paper:Q.paper},children:[o(D,{className:Q.title,children:[_.t(`Create a rule step by step`),E(w,{className:Q.close,size:`small`,title:_.t(`Close`),onClick:n,children:E(N,{})})]}),o(O,{className:Q.content,children:[o(f,{className:Q.stepper,activeStep:m,children:[$.map(e=>E(l,{children:E(A,{children:_.t(Pe[e])})},e)),E(l,{children:E(A,{children:_.t(`Summary`)})})]}),$.map(ne),U?H():null]}),o(g,{className:Q.actions,children:[E(a,{disabled:!m,startIcon:E(se,{}),onClick:()=>x(m-1),children:_.t(`Back`)}),E(`div`,{className:Q.spacer}),E(a,{onClick:n,children:_.t(`Cancel`)}),U?E(a,{variant:`contained`,color:`primary`,onClick:()=>{t(F),n()},children:_.t(i?`Replace rule`:`Create rule`)}):E(a,{variant:`contained`,color:`primary`,disabled:!W,endIcon:E(h,{}),onClick:()=>x(m+1),children:_.t(m===1&&!S.conditions.length?`Skip`:`Next`)})]})]})};n();var Be=[],Ve=({code:e,onChange:t,themeName:n,themeType:r,theme:i,setTourStep:s,tourStep:c,isTourOpen:l,command:u,scriptId:d,changed:f,running:p,newRuleId:h,onNewRuleHandled:g})=>{var y;let{blocks:b,socket:x,setOnUpdate:S,setOnDebugMessage:C,setEnableSimulation:w}=v(V),[D,O]=M([]),[A,j]=M(te(e)),[N,F]=M(``),[I,L]=M(!1),[R,z]=M(!1);T(()=>{let e,t,n=(n,r)=>{n===`${e}.alive`&&t!==(r==null?void 0:r.val)&&(t=!!(r!=null&&r.val),t&&e&&(x==null||x.sendTo(e.replace(/^system\.adapter\./,``),`rulesOn`,d)))},r=(r,i)=>{var a;if(x&&e!==(i==null||(a=i.common)==null?void 0:a.engine)){var o;e&&(x.unsubscribeState(`${e}.alive`,n),t&&x.sendTo(e.replace(/^system\.adapter\./,``),`rulesOn`,d)),e=i==null||(o=i.common)==null?void 0:o.engine,e&&e&&x.subscribeState(`${e}.alive`,n)}},i=(e,t)=>{if(t)try{let e=JSON.parse(t.val),n=Date.now();if(e.ruleId===d&&n-e.ts<1e3){let t=[...Be,{blockId:e.blockId,data:e.data,ts:e.ts}];t.length>200&&t.splice(0,t.length-200);for(let e=t.length-1;e>=0;e--)if(t[e].ts<n-5e3){t.splice(0,e);break}Be=t,C(t)}}catch{console.error(`Cannot parse: ${t.val}`)}};return x==null||x.getObject(d).then(t=>{var a;e=t==null||(a=t.common)==null?void 0:a.engine,x.subscribeObject(d,r),e&&(x.subscribeState(`${e}.alive`,n),x.subscribeState(`${e.replace(/^system\.adapter\./,``)}.debug.rules`,i))}),function(){x==null||x.unsubscribeObject(d,r),e&&(x==null||x.unsubscribeState(`${e}.alive`,n),t&&(x==null||x.sendTo(e.replace(/^system\.adapter\./,``),`rulesOff`,d)),x==null||x.unsubscribeState(`${e.replace(/^system\.adapter\./,``)}.debug.rules`,i))}},[]),T(()=>{w(!f&&p)},[f,p,w]),T(()=>{u&&(F(u),I||L(!0))},[u]),T(()=>{let t=te(e);JSON.stringify(t)!==JSON.stringify(A)&&(j(t),S(!0))},[e]),T(()=>{document.getElementsByTagName(`HTML`)[0].className=n||`blue`},[n]),T(()=>{h&&h===d&&(g(),z(!0))},[h,d,g]);let B=m(e=>{j(e),b&&t(ne(e,b))},[b,t]),H=k(null),[U,W]=M({835:!1,1035:!1});if(T(()=>{H.current&&(H.current.clientWidth<=1035&&W({835:!1,1035:!0}),H.current.clientWidth<=835&&W({1035:!0,835:!0}),H.current.clientWidth>1035&&W({835:!1,1035:!1}))},[((y=H.current)==null?void 0:y.clientWidth)||0]),!b||!x)return null;let ie=!A.triggers.length&&!A.actions.then.length&&!A.actions.else.length&&!A.conditions.some(e=>e.length);return o(`div`,{className:G.wrapperRules,ref:H,children:[E(ye,{allBlocks:D,socket:x}),I?N===`export`?E(P,{scriptId:d,themeType:r,onClose:()=>L(!1),text:JSON.stringify(A,null,2)}):E(ee,{themeType:r,onClose:e=>{L(!1),e&&B(JSON.parse(e))}}):null,R?E(ze,{hasRule:!ie,socket:x,theme:i,themeType:r,themeName:n,onCreate:B,onClose:()=>z(!1)}):null,o(`div`,{className:G.rootWrapper,children:[E(Ne,{setAllBlocks:O,allBlocks:D,userRules:A,onChangeBlocks:B,setTourStep:s,tourStep:c,addClass:U,isTourOpen:l,onStartWizard:()=>z(!0)}),o(`div`,{className:G.bands,children:[ie?o(`div`,{className:G.emptyRule,children:[E(`div`,{className:G.emptyRuleText,children:_.t(`Create a rule step by step`)}),E(a,{variant:`contained`,color:`primary`,startIcon:E(re,{}),onClick:()=>z(!0),children:_.t(`Wizard`)})]}):null,E(je,{socket:x,setUserRules:B,userRules:A,isTourOpen:l,setTourStep:s,tourStep:c,name:`${_.t(`when`)}...`,typeBlock:`triggers`,iconName:`FlashOn`,themeType:r,themeName:n,theme:i}),E(je,{socket:x,setUserRules:B,isTourOpen:l,setTourStep:s,tourStep:c,userRules:A,name:`...${_.t(`and`)}...`,typeBlock:`conditions`,iconName:`Help`,nameAdditionally:_.t(`or`),additionally:!0,themeType:r,themeName:n,theme:i}),E(je,{socket:x,setUserRules:B,isTourOpen:l,setTourStep:s,tourStep:c,userRules:A,name:`...${_.t(`then`)}`,typeBlock:`actions`,iconName:`PlayForWork`,nameAdditionally:_.t(`else`),additionally:!0,themeType:r,themeName:n,theme:i})]})]})]},`rulesEditor`)};export{Ve as default};
@@ -1 +0,0 @@
1
- ._wrapperRules_1fisr_1{background:linear-gradient(0deg, var(--backgroundGlobalColor), var(--backgroundGlobalColor)), url(./back-CXiqI7Po.jpg);background-repeat:no-repeat;background-size:cover;height:100%;display:flex}._rootWrapper_1fisr_9{width:100%;display:flex}._bands_1fisr_21{flex-direction:column;flex:1;min-width:0;display:flex;overflow:auto}._emptyRule_1fisr_34{border:1px dashed var(--lineColor);border-radius:8px;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;margin:12px 12px 0 56px;padding:14px 16px;display:flex}._emptyRuleText_1fisr_46{color:var(--colorBlock);font-size:14px}@media screen and (max-width:835px){._rootWrapper_1fisr_9{flex-direction:column;height:auto;overflow:auto}}._switchesItem_10ls3_1{width:auto;max-width:200px;color:var(--colorInput);border:1px solid #fff0;align-items:center;margin:5px 0;padding:12px 0;transition:all .7s;display:flex}._switchesItem_10ls3_1 span{text-overflow:ellipsis;width:100%;color:var(--lineColorActive);white-space:nowrap;margin-left:15px;overflow:hidden}._switchesItem_10ls3_1:hover,._switchesItemActive_10ls3_28{border:1px solid var(--lineColor);color:var(--lineColorHover);background:var(--backgroundColor);cursor:pointer;border-radius:6px}._iconTheme_10ls3_36{margin-left:5px;width:30px!important;height:30px!important}._iconTheme_10ls3_36 *{color:var(--lineColorActive)!important}._cardStyle_vibq0_1{cursor:pointer;background:var(--backgroundCurrentItem);border-left:3px solid #0000;border-radius:6px;align-items:flex-start;width:auto;min-width:200px;height:fit-content;margin:6px 12px;padding:8px 34px 8px 10px;transition:border-color .2s;display:flex;position:relative;box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f}._railTriggers_vibq0_25{border-left-color:var(--railTrigger)}._railConditions_vibq0_29{border-left-color:var(--railCondition)}._railActions_vibq0_33{border-left-color:var(--railAction)}._cardStyleActive_vibq0_37{z-index:100;width:300px}._controlMenu_vibq0_42{z-index:2;opacity:0;pointer-events:none;width:22px;transition:opacity .3s;display:flex;position:absolute;top:4px;right:4px}._cardStyle_vibq0_1:hover ._controlMenu_vibq0_42{opacity:1;pointer-events:auto}._closeBtn_vibq0_60{z-index:1;cursor:pointer;border-radius:20px;width:20px;height:20px;margin:5px auto;position:relative}._closeBtn_vibq0_60:before{content:"+";color:#f7060684;z-index:2;font-size:30px;line-height:1;transition:all .3s cubic-bezier(.77,0,.2,.85);position:absolute;top:-6px;left:2px;transform:rotate(45deg)}._closeBtn_vibq0_60:after{content:"";background:var(--backgroundColorHumburger);z-index:1;border-radius:100%;width:100%;height:100%;transition:all .3s cubic-bezier(.77,0,.2,.85);position:absolute;top:0;left:0;transform:scale(.01)}._closeBtn_vibq0_60:hover:after{transform:scale(1)}._closeBtn_vibq0_60:hover:before{color:#fff;transform:scale(.8)rotate(45deg)}._isDelete_vibq0_102{opacity:.8;background:#fff;height:0;min-height:0;margin:0 12px;padding:0 10px;transition:all .25s;overflow:hidden;box-shadow:0 0 10px #6accff}@media screen and (max-width:835px){._controlMenu_vibq0_42{opacity:1;pointer-events:auto}}._drag_mobile_vibq0_121{display:none}@media screen and (max-width:600px){._drag_mobile_vibq0_121{background:repeating-linear-gradient(180deg, var(--lineColorActive), var(--lineColorActive) 4px, var(--backgroundColorHumburger) 4px, var(--backgroundColorHumburger) 8px);border:1px solid var(--lineColorActive);cursor:pointer;border-radius:5px 0 0;width:30px;height:20px;display:flex;position:absolute;top:0;left:0}}._emptyBlockStyle_p7qtf_1{cursor:pointer;background:var(--backgroundEmptyBlock);border-radius:4px;align-items:center;width:auto;margin:10px 40px 10px 10px;display:flex}._emptyBlock_p7qtf_1{margin-top:10px;padding:10px;animation:.12s _marginTop_p7qtf_1}._selectOnChange_p7qtf_17{width:calc(100% - 42px);margin-left:12px;color:var(--lineColor)!important}._selectOnChangeHelp_p7qtf_23{color:var(--lineColor);vertical-align:middle;cursor:pointer}._selectOnChangeHelpIcon_p7qtf_29{color:var(--lineColor)}@keyframes _marginTop_p7qtf_1{0%{height:0;margin-top:70px;padding:0}to{margin-top:10px;padding:10px}}._emptyBlockNone_p7qtf_44{height:0;transition:height 20ms;animation:none}._bandTriggers_p7qtf_57{--bandColor:var(--railTrigger)}._bandConditions_p7qtf_61{--bandColor:var(--railCondition)}._bandActions_p7qtf_65{--bandColor:var(--railAction)}._mainBlockItemRules_p7qtf_69{overflow:initial;flex-direction:column;flex:none;padding-bottom:8px;padding-left:44px;display:flex;position:relative}._mainBlockItemRules_p7qtf_69:before{content:"";background:var(--bandColor);opacity:.06;pointer-events:none;position:absolute;inset:0}._mainBlockItemRules_p7qtf_69 ._nameBlockItems_p7qtf_93{color:var(--bandColor);letter-spacing:.08em;text-transform:uppercase;justify-content:flex-start;align-items:center;gap:6px;width:100%;height:fit-content;margin:12px 0 2px;padding-left:14px;font-size:12px;font-weight:600;display:flex}._mainBlockItemRules_p7qtf_69 ._nameBlockItems_p7qtf_93 svg{color:var(--bandColor);font-size:18px}._mainBlockItemRules_p7qtf_69+._mainBlockItemRules_p7qtf_69{border-top:1px solid var(--lineColor)}._contentBlockItem_p7qtf_119{flex-direction:column;min-height:64px;transition:height .3s,background .5s;display:flex}._wrapperMargin_p7qtf_127{flex-direction:column;max-width:900px;display:flex}._contentHeightOn_p7qtf_134{animation:.3s _heightBlock_p7qtf_1}@keyframes _heightBlock_p7qtf_1{0%{height:0}to{height:100%}}._contentHeightOff_p7qtf_146{height:0;animation:none;overflow:hidden}._cardAdd_p7qtf_152{text-align:center;width:100%;color:var(--lineColor);align-items:center;margin:0 10px;display:flex}._cardAdd_p7qtf_152:after,._cardAdd_p7qtf_152:before{content:"";border-bottom:1px solid;flex:1}._cardAdd_p7qtf_152:after{margin-left:.25em}._cardAdd_p7qtf_152:before{margin-right:.25em}._blockCardAdd_p7qtf_172{color:var(--colorAddBlock);cursor:pointer;align-items:center;padding:0 10px 6px;display:flex}._blockCardAdd_p7qtf_172 *{color:var(--colorAddBlock);opacity:.7}@media screen and (max-width:835px){._contentHeightOff_p7qtf_146{min-height:0;transition:min-height .3s}._contentHeightOn_p7qtf_134{transition:min-height .3s}}._drag_7xfhc_1{z-index:1;cursor:pointer;width:32px;height:22px;position:absolute;top:23px;left:12px}._root_7xfhc_11{position:relative}._menuRules_1b2q2_1{background:var(--backgroundColor);border-right:1px solid var(--lineColor);opacity:1;flex-direction:column;width:200px;padding:10px;transition:width .5s,opacity .2s,padding .5s,background .2s,border-right .2s;display:flex;overflow-x:hidden}._wizardButton_1b2q2_13{white-space:nowrap;flex:none;color:var(--lineColorActive)!important;border-color:var(--lineColor)!important;margin-bottom:8px!important}._switchesRenderWrapper_1b2q2_21{direction:rtl;overflow:hidden auto}._switchesRenderWrapper_1b2q2_21 span{direction:ltr}._menuOff_1b2q2_30{opacity:0;width:0;padding:0}._menuTitle_1b2q2_36{text-align:center;color:var(--lineColor);white-space:nowrap;align-items:center;transition:color .2s;display:flex}._menuTitle_1b2q2_36:after,._menuTitle_1b2q2_36:before{content:"";border-bottom:1px solid;flex:1}._marginAuto_1b2q2_50{margin-top:auto;margin-bottom:20px}._inputWidth_1b2q2_55{margin-top:0!important;margin-bottom:5px!important}._menuWrapper_1b2q2_60{height:100%;display:flex;position:relative}._hamburgerWrapper_1b2q2_68{background:var(--backgroundColorHumburger);width:24px;height:40px;color:var(--lineColorActive);border:1px solid var(--lineColor);cursor:pointer;z-index:10;border-radius:0 6px 6px 0;justify-content:center;align-items:center;transition:left .5s,border-radius .7s,width .7s,height .7s,background .2s,border .2s,color .2s;display:flex;position:absolute;top:4px;left:calc(100% - 1px)}._hamburgerWrapper_1b2q2_68 svg{font-size:20px}._hamburgerOff_1b2q2_96{border-radius:0 20px 20px 0;width:30px;height:34px}._nothingFound_1b2q2_104{color:var(--lineColor);margin:16px;font-size:21px;transition:color .2s}._resetSearch_1b2q2_111{color:var(--lineColor);cursor:pointer;margin:10px 0;font-weight:700;transition:color .3s,font-size .3s}._resetSearch_1b2q2_111:hover{color:var(--lineColorHover);font-size:22px}._controlPanel_1b2q2_123{align-items:center;width:200px;display:flex}._controlPanel_1b2q2_123 button{width:33.3333%;min-width:auto;color:var(--lineColor);transition:color .2s}._controlPanel_1b2q2_123 ._controlPanelAppBar_1b2q2_134{box-shadow:none;background:0 0}._controlPanel_1b2q2_123 [class*=Mui-selected]{color:var(--lineColorActive)!important}._controlPanel_1b2q2_123 [class*=MuiTabs-indicator]{background-color:var(--lineColorActive)}._controlPanel_1b2q2_123 [class*=Mui-disabled]{color:var(--disabledColor)!important}._addClassMenu_1b2q2_148{z-index:12;position:absolute;top:0}._addClassBackground_1b2q2_154{background:var(--backgroundMobile)}._addClassPosition_1b2q2_158{z-index:2222;position:sticky;top:0;left:0}@media screen and (max-width:1035px){._menuWrapper_1b2q2_60{z-index:12;position:absolute;top:0}._menuRules_1b2q2_1{background:var(--backgroundMobile)}}@media screen and (max-width:835px){._menuRules_1b2q2_1{z-index:2222;position:sticky;top:0;left:0}}._bandTriggers_91vrz_5{--bandColor:var(--railTrigger)}._bandConditions_91vrz_9{--bandColor:var(--railCondition)}._bandActions_91vrz_13{--bandColor:var(--railAction)}._paper_91vrz_17{min-height:70vh}._title_91vrz_22{align-items:center;gap:8px;padding-right:48px;display:flex}._close_91vrz_29{top:12px;right:12px;position:absolute!important}._content_91vrz_35{flex-direction:column;display:flex}._stepper_91vrz_40{background:0 0!important;padding:8px 0 20px!important}._step_91vrz_40{flex-direction:column;gap:10px;display:flex}._step_91vrz_40[hidden]{display:none}._hint_91vrz_56{color:var(--colorBlockHover);font-size:13px}._warning_91vrz_61{color:var(--debugColor);font-size:13px;font-weight:600}._blockCard_91vrz_68{border-left:3px solid var(--bandColor);background:var(--backgroundCurrentItem);border-radius:6px;align-items:flex-start;padding:8px 40px 8px 10px;display:flex;position:relative;box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f}._blockBody_91vrz_79{flex:1;align-items:flex-start;min-width:0;display:flex}._remove_91vrz_86{top:4px;right:4px;color:var(--colorBlockHover)!important;position:absolute!important}._notFound_91vrz_93{color:var(--debugColor);font-size:13px}._chooser_91vrz_99{grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:8px;display:grid}._choice_91vrz_105{border:1px solid var(--lineColor);min-height:84px;color:var(--colorBlock);font:inherit;text-align:center;cursor:pointer;background:0 0;border-radius:6px;flex-direction:column;justify-content:center;align-items:center;gap:6px;padding:12px 8px;font-size:13px;transition:border-color .2s,background .2s;display:flex}._choice_91vrz_105:hover{border-color:var(--lineColorActive);background:var(--backgroundCurrentItem)}._choiceIcon_91vrz_128{width:28px!important;height:28px!important}._choiceIcon_91vrz_128 *{color:var(--colorBlock)!important}._choiceName_91vrz_136{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}._addMore_91vrz_144{align-self:flex-start;color:var(--lineColorActive)!important}._summaryBand_91vrz_150{flex-direction:column;gap:6px;display:flex}._summaryLabel_91vrz_156{color:var(--bandColor);letter-spacing:.08em;text-transform:uppercase;font-size:12px;font-weight:600}._preview_91vrz_164{pointer-events:none}._actions_91vrz_169{padding:12px 24px!important}._spacer_91vrz_173{flex:1}:root,:root.blue,:root.colored{--backgroundColor:#3052813b;--lineColor:#4caaf47d;--lineColorHover:#ccceff;--lineColorActive:#4caaf4;--backgroundColorHumburger:#436a93b8;--colorBlock:#02124b;--colorBlockHover:#02124b8c;--colorInput:#02124b;--backgroundBlock:#c9e7ffab;--railTrigger:#b4600f;--railCondition:#6b4fb5;--railAction:#0f7268;--backgroundGlobalColor:#fff0;--backgroundMobile:#041c35d4;--backgroundCurrentItem:#ffffff6b;--disabledColor:#210025cc;--backgroundEmptyBlock:#ffffff1f;--colorAddBlock:#fff;--debugColor:#c6511b}:root.dark{--backgroundColor:#1f1f1f3b;--lineColor:#f3f3f37d;--lineColorHover:#a0a0a0;--lineColorActive:#dedede;--backgroundColorHumburger:#3e3e3eb8;--colorBlock:#080808;--colorBlockHover:#0808088c;--colorInput:#ddd;--backgroundBlock:#c1c1c1ab;--railTrigger:#e0904f;--railCondition:#a894e4;--railAction:#4fb9aa;--backgroundGlobalColor:#1c1c1ced;--backgroundMobile:#040303eb;--backgroundCurrentItem:#ffffff6b;--disabledColor:#210025cc;--backgroundEmptyBlock:#ffffff1f;--colorAddBlock:#fff;--debugColor:#c6511b}:root.light{--backgroundColor:#3131313b;--lineColor:#0001257d;--lineColorHover:#a0a0a0;--lineColorActive:#07002f;--backgroundColorHumburger:#333542a3;--colorBlock:#090929;--colorBlockHover:#c7c6c68c;--colorInput:#090929;--backgroundBlock:#000;--railTrigger:#b4600f;--railCondition:#6b4fb5;--railAction:#0f7268;--backgroundGlobalColor:#ffffff40;--backgroundMobile:#b4b2c7bf;--backgroundCurrentItem:#ffffff6b;--disabledColor:#210025cc;--backgroundEmptyBlock:#ffffff1f;--colorAddBlock:#fff;--debugColor:#c6511b}:root.modernDark{--backgroundColor:#141c29cc;--lineColor:#8b97a8;--lineColorHover:#e8edf5;--lineColorActive:#4b9bfa;--backgroundColorHumburger:#1a2434f2;--colorBlock:#e8edf5;--colorBlockHover:#4b9bfa;--colorInput:#e8edf5;--backgroundBlock:#121a26f2;--railTrigger:#e0904f;--railCondition:#a894e4;--railAction:#4fb9aa;--backgroundGlobalColor:#0a121df0;--backgroundMobile:#141c29f7;--backgroundCurrentItem:#1a24348c;--disabledColor:#586576;--backgroundEmptyBlock:#ffffff0f;--colorAddBlock:#e8edf5;--debugColor:#e8a33d}:root.modernLight{--backgroundColor:#fffc;--lineColor:#5b6878;--lineColorHover:#101827;--lineColorActive:#0b62d6;--backgroundColorHumburger:#eef2f7f2;--colorBlock:#101827;--colorBlockHover:#0b62d6;--colorInput:#101827;--backgroundBlock:#fffffff2;--railTrigger:#b4600f;--railCondition:#6b4fb5;--railAction:#0f7268;--backgroundGlobalColor:#f4f7fbf0;--backgroundMobile:#fffffff7;--backgroundCurrentItem:#ffffff8c;--disabledColor:#98a4b3;--backgroundEmptyBlock:#1018270a;--colorAddBlock:#101827;--debugColor:#c77700}
@@ -1 +0,0 @@
1
- import{t as e}from"./AiChatPanel-C_WbKMGX.js";export{e as buildActionPrompt};
Binary file
@@ -1 +0,0 @@
1
- import{i as e,o as t,r as n,t as r}from"./blockly-DBw-ytY1.js";import{c as i,l as a}from"./index-07o_WKsX.js";import{f as o,i as s,o as c,r as l,u}from"./helpers-B0ByElPJ.js";function d(){let d=window.Blockly,f=d.Translate,p=window.getHelp;d.CustomBlocks=d.CustomBlocks||[],d.CustomBlocks.push(`Action`),d.Action={HUE:330,blocks:{}};let m=()=>new n(`FALSE`,function(e){this.getSourceBlock().updateShape_(l(e))}),h=()=>[[f(`http_timeout_ms`),`ms`],[f(`http_timeout_sec`),`sec`]],g=()=>[[f(`http_type_text`),`text`],[f(`http_type_arraybuffer`),`arraybuffer`]],_={mutationToDom:function(){let e=document.createElement(`mutation`);return e.setAttribute(`with_statement`,String(l(this.getFieldValue(`WITH_STATEMENT`)))),e},domToMutation:function(e){this.updateShape_(l(e.getAttribute(`with_statement`)))},updateShape_:function(e){u(this,e)}},v=(t,n,s,c,l,u)=>{r[t]={init:function(){this.appendDummyInput().appendField(n),this.appendDummyInput(`ATTR`).appendField(new e(s),`ATTR`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(d.Action.HUE),this.setTooltip(f(`${t}_tooltip`)),u&&this.setHelpUrl(p(u))},onchange:function(){o(this,c,l)},FUNCTION_TYPES:c},a.forBlock[t]=function(e){return[e.getFieldValue(`ATTR`),i.ATOMIC]}};d.Action.blocks.exec=`<block type="exec"> <mutation with_statement="false"></mutation> <field name="WITH_STATEMENT">FALSE</field> <field name="LOG"></field> <value name="COMMAND"> <shadow type="text"> <field name="TEXT">pwd</field> </shadow> </value></block>`,r.exec={init:function(){this.appendDummyInput(`TEXT`).appendField(`» ${f(`exec`)}`),this.appendValueInput(`COMMAND`).appendField(f(`exec_command`)),this.appendDummyInput(`WITH_STATEMENT`).appendField(f(`with_results`)).appendField(m(),`WITH_STATEMENT`),this.appendDummyInput(`LOG`).appendField(f(`loglevel`)).appendField(new e(s()),`LOG`),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(d.Action.HUE),this.setTooltip(f(`exec_tooltip`)),this.setHelpUrl(p(`exec_help`))},..._},a.forBlock.exec=function(e){let t=a.valueToCode(e,`COMMAND`,i.ATOMIC),n=e.getFieldValue(`LOG`),r=``;if(n&&(r=`console.${n}('exec: ' + ${t});\n`),l(e.getFieldValue(`WITH_STATEMENT`))){let n=a.statementToCode(e,`STATEMENT`);if(n)return`exec(${t}, async (error, result, stderr) => {\n${n}});\n${r}`}return`exec(${t});\n${r}`},d.Action.blocks.exec_result=`<sep gap="5"></sep><block type="exec_result"> <field name="ATTR">result</field></block>`,v(`exec_result`,`»`,[[f(`exec_result_result`),`result`],[f(`exec_result_stderr`),`stderr`],[f(`exec_result_error`),`error`]],[`exec`],`exec_result_warning`,`exec_help`),d.Action.blocks.http_get=`<block type="http_get"> <field name="TIMEOUT">2000</field> <field name="UNIT">ms</field> <field name="TYPE">text</field> <value name="URL"> <shadow type="text"> <field name="TEXT">http://</field> </shadow> </value></block>`,r.http_get={init:function(){this.appendValueInput(`URL`).appendField(`🌐 ${f(`http_get`)}`),this.appendDummyInput().appendField(f(`http_timeout`)).appendField(new t(`2000`),`TIMEOUT`).appendField(new e(h()),`UNIT`),this.appendDummyInput(`TYPE`).appendField(f(`http_type`)).appendField(new e(g()),`TYPE`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(d.Action.HUE),this.setTooltip(f(`http_get_tooltip`)),this.setHelpUrl(p(`http_get_help`))}},a.forBlock.http_get=function(e){let t=a.valueToCode(e,`URL`,i.ATOMIC),n=e.getFieldValue(`UNIT`),r=e.getFieldValue(`TIMEOUT`);Number.isNaN(r)&&(r=2e3),n===`sec`&&(r*=1e3);let o=e.getFieldValue(`TYPE`)||`text`,s=a.statementToCode(e,`STATEMENT`);return`httpGet(${t}, { timeout: ${r}, responseType: '${o}' }, async (err, response) => {\n${s}});\n`},d.Action.blocks.http_post=`<sep gap="5"></sep><block type="http_post"> <field name="TIMEOUT">2000</field> <field name="UNIT">ms</field> <field name="TYPE">text</field> <value name="URL"> <shadow type="text"> <field name="TEXT">http://</field> </shadow> </value> <value name="DATA"> <shadow type="logic_null"></shadow> </value></block>`,r.http_post={init:function(){this.appendValueInput(`URL`).appendField(`🌐 ${f(`http_post`)}`),this.appendDummyInput().appendField(f(`http_timeout`)).appendField(new t(`2000`),`TIMEOUT`).appendField(new e(h()),`UNIT`),this.appendDummyInput(`TYPE`).appendField(f(`http_type`)).appendField(new e(g()),`TYPE`),this.appendValueInput(`DATA`).appendField(f(`http_post_data`)),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(d.Action.HUE),this.setTooltip(f(`http_post_tooltip`)),this.setHelpUrl(p(`http_post_help`))}},a.forBlock.http_post=function(e){let t=a.valueToCode(e,`URL`,i.ATOMIC),n=e.getFieldValue(`UNIT`),r=e.getFieldValue(`TIMEOUT`);isNaN(r)&&(r=2e3),n===`sec`&&(r*=1e3);let o=e.getFieldValue(`TYPE`)||`text`,s=a.valueToCode(e,`DATA`,i.ATOMIC)||`null`,c=a.statementToCode(e,`STATEMENT`);return`httpPost(${t}, ${s}, { timeout: ${r}, responseType: '${o}' }, async (err, response) => {\n${c}});\n`},d.Action.blocks.http_response=`<sep gap="5"></sep><block type="http_response"> <field name="ATTR">response.data</field></block>`,v(`http_response`,`🌐`,[[f(`http_response_data`),`response.data`],[f(`http_response_statuscode`),`response.statusCode`],[f(`http_response_responsetime`),`response.responseTime`],[f(`http_response_headers`),`response.headers`],[f(`http_response_error`),`err`]],[`http_get`,`http_post`],`http_response_warning`,`http_response_help`),d.Action.blocks.http_response_tofile=`<sep gap="5"></sep><block type="http_response_tofile"> <value name="FILENAME"> <shadow type="text"> <field name="TEXT">temp.jpg</field> </shadow> </value></block>`,r.http_response_tofile={init:function(){this.appendDummyInput().appendField(`🌐 ${f(`http_response_tofile`)}`),this.appendValueInput(`FILENAME`).appendField(f(`http_response_tofile_filename`)).setCheck(null),this.setInputsInline(!1),this.setOutput(!0,`String`),this.setColour(d.Action.HUE),this.setTooltip(f(`http_response_tofile_tooltip`)),this.setHelpUrl(p(`http_response_tofile_help`))},onchange:function(){o(this,[`http_get`,`http_post`],`http_response_warning`)},FUNCTION_TYPES:[`http_get`,`http_post`]},a.forBlock.http_response_tofile=function(e){return[`createTempFile(${a.valueToCode(e,`FILENAME`,i.ATOMIC)}, response.data)`,i.ATOMIC]};let y=()=>`${a.prefixLines(`if (err) {`,a.INDENT)}\n${a.prefixLines(`console.error(err);`,a.INDENT+a.INDENT)}\n${a.prefixLines(`}`,a.INDENT)}\n`;d.Action.blocks.file_write=`<block type="file_write"> <value name="OID"> <shadow type="field_oid_meta"> <field name="oid">0_userdata.0</field> </shadow> </value> <value name="FILE"> <shadow type="text"> <field name="TEXT">demo.json</field> </shadow> </value></block>`,r.file_write={init:function(){this.appendValueInput(`OID`).appendField(`📁 ${f(`file_write`)}`),this.appendValueInput(`FILE`).appendField(f(`file_write_filename`)).setCheck(null),this.appendValueInput(`DATA`).appendField(f(`file_write_data`)),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(d.Action.HUE),this.setTooltip(f(`file_write_tooltip`)),this.setHelpUrl(p(`file_write_help`))}},a.forBlock.file_write=function(e){let t=a.valueToCode(e,`OID`,i.ATOMIC),n=a.valueToCode(e,`FILE`,i.ATOMIC),r=a.valueToCode(e,`DATA`,i.ATOMIC),o=c(t);return`writeFile(${t}${o?` /* ${o} */`:``}, String(${n}), ${r||`null`}, (err) => {\n${y()}});\n`},d.Action.blocks.file_read=`<sep gap="5"></sep><block type="file_read"> <value name="OID"> <shadow type="field_oid_meta"> <field name="oid">0_userdata.0</field> </shadow> </value> <value name="FILE"> <shadow type="text"> <field name="TEXT">demo.json</field> </shadow> </value></block>`,r.file_read={init:function(){this.appendValueInput(`OID`).appendField(`📁 ${f(`file_read`)}`),this.appendValueInput(`FILE`).appendField(f(`file_read_filename`)).setCheck(null),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(d.Action.HUE),this.setTooltip(f(`file_read_tooltip`)),this.setHelpUrl(p(`file_read_help`))}},a.forBlock.file_read=function(e){let t=a.valueToCode(e,`OID`,i.ATOMIC),n=a.valueToCode(e,`FILE`,i.ATOMIC),r=a.statementToCode(e,`STATEMENT`),o=c(t);return`readFile(${t}${o?` /* ${o} */`:``}, String(${n}), (err, data, mimeType) => {\n${y()}${r}});\n`},d.Action.blocks.file_data=`<sep gap="5"></sep><block type="file_data"> <field name="ATTR">data</field></block>`,v(`file_data`,`📁`,[[f(`file_data_data`),`data`],[f(`file_data_mimeType`),`mimeType`]],[`file_read`],`file_data_warning`),d.Action.blocks.request=`<block type="request"> <mutation with_statement="false"></mutation> <field name="WITH_STATEMENT">FALSE</field> <field name="LOG"></field> <value name="URL"> <shadow type="text"> <field name="TEXT">http://</field> </shadow> </value></block>`,r.request={init:function(){this.appendDummyInput(`TEXT`).appendField(f(`request`)),this.appendValueInput(`URL`).appendField(f(`request_url`)),this.appendDummyInput(`WITH_STATEMENT`).appendField(f(`with_results`)).appendField(m(),`WITH_STATEMENT`),this.appendDummyInput(`LOG`).appendField(f(`loglevel`)).appendField(new e(s()),`LOG`),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(d.Action.HUE),this.setTooltip(f(`request_tooltip`)),this.setHelpUrl(f(`request_help`))},..._},a.forBlock.request=function(e){let t=a.valueToCode(e,`URL`,i.ATOMIC),n=e.getFieldValue(`LOG`),r=``;if(n&&(r=`console.${n}('request: ' + ${t});\n`),l(e.getFieldValue(`WITH_STATEMENT`))){let n=a.statementToCode(e,`STATEMENT`);if(n)return`try {\n require("request")(${t}, async (error, response, result) => {\n ${n} }).on("error", (e) => { console.error(e); });\n} catch (e) { console.error(e); }\n${r}`}return`try {\n require("request")(${t}).on("error", (e) => { console.error(e); });\n} catch (e) { console.error(e); }\n${r}`}}export{d as install};
@@ -1 +0,0 @@
1
- import{f as e,o as t,p as n,t as r}from"./blockly-DBw-ytY1.js";import{c as i,l as a}from"./index-07o_WKsX.js";import{c as o,s}from"./helpers-B0ByElPJ.js";function c(){let c=window.Blockly,l=c.Translate;c.CustomBlocks=c.CustomBlocks||[],c.CustomBlocks.push(`Object`),c.Object={HUE:40,blocks:{}},c.Object.blocks.object_new=`<block type="object_new"></block>`,r.object_new_container={init:function(){this.setColour(c.Object.HUE),this.appendDummyInput().appendField(l(`object_new_attributes`)),this.appendStatementInput(`STACK`),this.setTooltip(l(`object_new_tooltip`)),this.contextMenu=!1}},r.object_new_mutator={init:function(){this.setColour(c.Object.HUE),this.appendDummyInput(`ATTR`).appendField(l(`object_new_attribute`)).appendField(new t(`attribute1`),`ATTR`),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(l(`object_new_tooltip`)),this.contextMenu=!1}},r.object_new={init:function(){this.appendDummyInput(`NAME`).appendField(l(`object_new`)),this.attributes_=[],this.itemCount_=0,this.setMutator(new e.MutatorIcon([`object_new_mutator`],this)),this.setInputsInline(!1),this.setOutput(!0),this.setColour(c.Object.HUE),this.setTooltip(l(`object_new_tooltip`))},mutationToDom:function(){let e=document.createElement(`mutation`);for(let t=0;t<this.attributes_.length;t++){let n=document.createElement(`attribute`);n.setAttribute(`id`,`ATTR_${t}`),n.setAttribute(`name`,this.attributes_[t]),e.appendChild(n)}return e},domToMutation:function(e){this.attributes_=[];for(let t=0,n;n=e.childNodes[t];t++)n.nodeName.toLowerCase()===`attribute`&&this.attributes_.push(n.getAttribute(`name`));this.itemCount_=this.attributes_.length,this.updateShape_()},decompose:function(e){var t;let n=e.newBlock(`object_new_container`);n.initSvg();let r=(t=n.getInput(`STACK`))==null?void 0:t.connection;for(let t=0;t<this.itemCount_;t++){let n=e.newBlock(`object_new_mutator`);n.setFieldValue(this.attributes_[t],`ATTR`),n.initSvg(),r.connect(n.previousConnection),r=n.nextConnection}return n},compose:function(e){this.attributes_=[];let t=e.getInputTargetBlock(`STACK`),n=[];for(;t;){let e=t.getFieldValue(`ATTR`);this.attributes_.push(e),n.push(t.valueConnection_),t=t.nextConnection&&t.nextConnection.targetBlock()}for(let e=0;e<this.itemCount_;e++){var r;let t=(r=this.getInput(`ATTR_${e}`))==null||(r=r.connection)==null?void 0:r.targetConnection;t&&!n.includes(t)&&t.disconnect()}this.itemCount_=n.length,this.itemCount_<0&&(this.itemCount_=0),this.updateShape_();for(let e=0;e<this.itemCount_;e++)o(n[e],this,`ATTR_${e}`)},saveConnections:function(e){let t=e.getInputTargetBlock(`STACK`),n=0;for(;t;){var r,i;let e=this.getInput(`ATTR_${n}`);t.valueConnection_=e==null||(r=e.connection)==null?void 0:r.targetConnection,n++,t=(i=t.nextConnection)==null?void 0:i.targetBlock()}},updateShape_:function(){let e=this.workspace;for(let t=0;t<this.itemCount_;t++){let r=this.getInput(`ATTR_${t}`);r?r.fieldRow[0].setValue(this.attributes_[t]):(r=this.appendValueInput(`ATTR_${t}`).setAlign(n.Align.RIGHT),r.appendField(this.attributes_[t])),setTimeout(t=>{var n;if(!((n=t.connection)!=null&&n.isConnected())){let n=e.newBlock(`text`);n.setShadow(!0),n.initSvg(),n.render(),n.outputConnection.connect(t.connection)}},100,r)}for(let e=this.itemCount_;this.getInput(`ATTR_${e}`);e++)this.removeInput(`ATTR_${e}`)}},a.forBlock.object_new=function(e){let t=e,n=[];for(let r=0;r<t.itemCount_;r++){let o=a.valueToCode(e,`ATTR_${r}`,i.COMMA);o&&n.push(`${s(t.attributes_[r])}: ${o}`)}return[`{ ${n.length?n.join(`, `):``} }`,i.ATOMIC]},c.Object.blocks.object_set_attr=`<block type="object_set_attr"> <field name="ATTR">attribute1</field> <value name="VALUE"> <shadow type="text"> <field name="TEXT">value</field> </shadow> </value></block>`,r.object_set_attr={init:function(){this.appendDummyInput(`ATTR`).appendField(l(`object_set_attr`)).appendField(new t(`attribute1`),`ATTR`),this.appendValueInput(`OBJECT`).appendField(l(`object_set_attr_object`)),this.appendValueInput(`VALUE`).setCheck(null).appendField(l(`object_set_attr_value`)),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(c.Object.HUE),this.setTooltip(l(`object_set_attr_tooltip`))}},a.forBlock.object_set_attr=function(e){let t=e.getFieldValue(`ATTR`),n=a.valueToCode(e,`VALUE`,i.ATOMIC),r=a.valueToCode(e,`OBJECT`,i.ATOMIC);return r||=`{}`,`((obj) => { if (typeof obj === 'object') { obj[${s(t)}] = ${n}; } })(${r});\n`},c.Object.blocks.object_del_attr=`<block type="object_del_attr"> <field name="ATTR">attribute1</field></block>`,r.object_del_attr={init:function(){this.appendDummyInput(`ATTR`).appendField(l(`object_del_attr`)).appendField(new t(`attribute1`),`ATTR`),this.appendValueInput(`OBJECT`).appendField(l(`object_del_attr_object`)),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(c.Object.HUE),this.setTooltip(l(`object_del_attr_tooltip`))}},a.forBlock.object_del_attr=function(e){let t=e.getFieldValue(`ATTR`),n=a.valueToCode(e,`OBJECT`,i.ATOMIC);return n||=`{}`,`((obj) => { if (typeof obj === 'object') { delete obj[${s(t)}]; } })(${n});\n`},c.Object.blocks.object_has_attr=`<block type="object_has_attr"> <field name="ATTR">attribute1</field> <value name="OBJECT"> <shadow type="get_object"> <field name="OID">Object ID</field> </shadow> </value></block>`,r.object_has_attr={init:function(){this.appendValueInput(`OBJECT`).appendField(l(`object_has_attr`)),this.appendDummyInput(`ATTR`).appendField(l(`object_has_attr_attr`)).appendField(new t(`attribute1`),`ATTR`),this.setInputsInline(!0),this.setOutput(!0,`Boolean`),this.setColour(c.Object.HUE),this.setTooltip(l(`object_has_attr_tooltip`))}},a.forBlock.object_has_attr=function(e){let t=a.valueToCode(e,`OBJECT`,i.ATOMIC),n=e.getFieldValue(`ATTR`);return[`Object.prototype.hasOwnProperty.call(${t}, ${s(n)})`,i.ATOMIC]},c.Object.blocks.object_keys=`<block type="object_keys"> <value name="OBJECT"> <shadow type="get_object"> <field name="OID">Object ID</field> </shadow> </value></block>`,r.object_keys={init:function(){this.appendValueInput(`OBJECT`).appendField(l(`object_keys`)),this.setInputsInline(!0),this.setOutput(!0,`Array`),this.setColour(c.Object.HUE),this.setTooltip(l(`object_keys_tooltip`))}},a.forBlock.object_keys=function(e){let t=a.valueToCode(e,`OBJECT`,i.ATOMIC);return t||=`{}`,[`Object.keys(${t})`,i.ATOMIC]}}export{c as install};
@@ -1 +0,0 @@
1
- import{i as e,o as t,r as n,s as r,t as i}from"./blockly-DBw-ytY1.js";import{c as a,l as o}from"./index-07o_WKsX.js";import{a as s,l as c,r as l,s as u}from"./helpers-B0ByElPJ.js";import{FieldOID as d}from"./field_oid-KfoBnEM9.js";function f(){let f=window.Blockly,p=f.Translate,m=window.getHelp;f.CustomBlocks=f.CustomBlocks||[],f.CustomBlocks.push(`System`),f.System={HUE:210,blocks:{},WARNING_PARENTS:[`on_ext`]};let h=e=>[[p(`get_value_val`),`val`],[p(`get_value_ack`),`ack`],[p(`get_value_ts`),`ts`],[p(`get_value_lc`),`lc`],[p(`get_value_q`),`q`],[p(`get_value_comment`),`c`],[p(`get_value_from`),`from`],...e?[[p(`get_value_user`),`user`]]:[],[p(`get_common_name`),`common.name`],[p(`get_common_desc`),`common.desc`],[p(`get_common_unit`),`common.unit`],[p(`get_common_role`),`common.role`],[p(`get_common_state_type`),`common.type`],[p(`get_common_read`),`common.read`],[p(`get_common_write`),`common.write`]],g=e=>e===`type`||e.startsWith(`common.`),_=function(){let e=this.getParent();e&&f.System.WARNING_PARENTS.includes(e.type)?this.setWarningText(p(`false_connection_trigger_warning`),this.id):this.setWarningText(null,this.id)},v=r=>({mutationToDom:function(){let e=document.createElement(`mutation`);return e.setAttribute(`delay_input`,String(l(this.getFieldValue(`WITH_DELAY`)))),e},domToMutation:function(e){this.updateShape_(l(e.getAttribute(`delay_input`)))},updateShape_:function(i){i?this.getInput(`DELAY`)||this.appendDummyInput(`DELAY`).appendField(` `).appendField(new t(`1000`),`DELAY_MS`).appendField(new e([[p(`control_ms`),`ms`],[p(`control_sec`),`sec`],[p(`control_min`),`min`]]),`UNIT`):this.getInput(`DELAY`)&&this.removeInput(`DELAY`),i?this.getInput(`CLEAR_RUNNING_INPUT`)||this.appendDummyInput(`CLEAR_RUNNING_INPUT`).appendField(p(r)).appendField(new n,`CLEAR_RUNNING`):this.getInput(`CLEAR_RUNNING_INPUT`)&&this.removeInput(`CLEAR_RUNNING_INPUT`)}}),y=()=>new n(`FALSE`,function(e){this.getSourceBlock().updateShape_(l(e))}),b=e=>c(e.getFieldValue(`DELAY_MS`),e.getFieldValue(`UNIT`));f.System.blocks.global_var=`<block type="global_var"> <field name="VAR">scriptName</field></block>`,i.global_var={init:function(){this.appendDummyInput(`VAR`).appendField(new e([[p(`global_var_scriptname`),`scriptName`],[p(`global_var_defaultdatadir`),`defaultDataDir`],[p(`global_var_verbose`),`verbose`]]),`VAR`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(f.System.HUE),this.setTooltip(p(`global_var_tooltip`)),this.setHelpUrl(m(`global_var`))}},o.forBlock.global_var=function(e){return[e.getFieldValue(`VAR`),a.ATOMIC]},f.System.blocks.secret=`<block type="secret"></block>`;let x=()=>{var e;return((e=window.main)==null?void 0:e.secrets)||[]},S=()=>x().length?x().map(e=>[e.name,e.name]):[[p(`secret_no_secrets`),``]],C=function(){var e,t;let n=(e=this.getSourceBlock())==null?void 0:e.getFieldValue(`NAME`),r=(t=x().find(e=>e.name===n))==null?void 0:t.fields;return(r!=null&&r.length?r:[`key`,`login`,`password`]).map(e=>[e,e])};i.secret={init:function(){let n=this.appendDummyInput(`SECRET`).appendField(p(`secret`));x().length?n.appendField(new e(S),`NAME`):n.appendField(new t(`CameraPassword`),`NAME`),n.appendField(p(`secret_attr`)).appendField(new e(C),`ATTR`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(f.System.HUE),this.setTooltip(p(`secret_tooltip`)),this.setHelpUrl(m(`secret_help`))}},o.forBlock.secret=function(e){let t=e.getFieldValue(`NAME`),n=e.getFieldValue(`ATTR`),r=/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n)?`.${n}`:`[${u(n)}]`;return[`SECRETS[${u(t)}]?${r}`,a.ATOMIC]},f.System.blocks.debug=`<block type="debug"> <field name="Severity">info</field> <value name="TEXT"> <shadow type="text"> <field name="TEXT">test</field> </shadow> </value></block>`,i.debug={init:function(){this.appendValueInput(`TEXT`).setCheck(null).appendField(p(`debug`)),this.appendDummyInput(`Severity`).appendField(new e([[p(`loglevel_debug`),`debug`],[p(`loglevel_info`),`info`],[p(`loglevel_warn`),`warn`],[p(`loglevel_error`),`error`]]),`Severity`),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`debug_tooltip`)),this.setHelpUrl(m(`debug_help`))}},o.forBlock.debug=function(e){let t=o.valueToCode(e,`TEXT`,a.ATOMIC);return`console.${e.getFieldValue(`Severity`)}(${t});\n`},f.System.blocks.comment=`<block type="comment"></block>`,i.comment={init:function(){this.appendDummyInput(`COMMENT`).appendField(new f.FieldMultilineInput(p(`comment`)),`COMMENT`),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(`#FFFF00`),this.setTooltip(p(`comment_tooltip`))}},o.forBlock.comment=function(e){return`${o.prefixLines(e.getFieldValue(`COMMENT`),`// `)}\n`},f.System.blocks.control=`<block type="control"> <mutation delay_input="false"></mutation> <field name="WITH_DELAY">FALSE</field></block>`,i.control={init:function(){this.appendDummyInput().appendField(p(`control`)),this.appendDummyInput(`OID`).appendField(new d(p(`select_id`),`state`),`OID`),this.appendValueInput(`VALUE`).setCheck(null).appendField(p(`control_with`)),this.appendDummyInput(`WITH_DELAY`).appendField(p(`control_delay`)).appendField(y(),`WITH_DELAY`),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`control_tooltip`)),this.setHelpUrl(m(`control_help`))},...v(`control_clear_running`)},o.forBlock.control=function(e){let t=e.getFieldValue(`OID`);r.VARIABLES_DEFAULT_NAME=`value`;let n=b(e),i=l(e.getFieldValue(`CLEAR_RUNNING`)),c=o.valueToCode(e,`VALUE`,a.ATOMIC),u=s(t),d=u?` /* ${u} */`:``;return l(e.getFieldValue(`WITH_DELAY`))?`setStateDelayed('${t}'${d}, ${c}, ${n}, ${i});\n`:`setState('${t}'${d}, ${c});\n`},f.System.blocks.toggle=`<sep gap="5"></sep><block type="toggle"> <mutation delay_input="false"></mutation> <field name="WITH_DELAY">FALSE</field></block>`,i.toggle={init:function(){this.appendDummyInput().appendField(p(`toggle`)),this.appendDummyInput(`OID`).appendField(new d(p(`select_id`),`state`),`OID`),this.appendDummyInput(`WITH_DELAY`).appendField(p(`toggle_delay`)).appendField(y(),`WITH_DELAY`),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`toggle_tooltip`)),this.setHelpUrl(m(`toggle_help`))},...v(`toggle_clear_running`)},o.forBlock.toggle=function(e){var t;let n=e.getFieldValue(`OID`);r.VARIABLES_DEFAULT_NAME=`value`;let i=b(e),a=(t=window.main)==null||(t=t.objects[n])==null?void 0:t.common,c=(a==null?void 0:a.type)||`boolean`,u=s(n),d=u?` /* ${u} */`:``,f=l(e.getFieldValue(`CLEAR_RUNNING`)),p;if(c===`number`){let e=a.max===void 0?100:parseFloat(a.max),t=a.min===void 0?0:parseFloat(a.min);p=`setState('${n}'${d}, state ? (state.val === ${t} ? ${e} : ${t}) : ${e});`}else p=`setState('${n}'${d}, state ? !state.val : true);`;let m=l(e.getFieldValue(`WITH_DELAY`))?`setStateDelayed('${n}'${d}, state ? !state.val : true, ${i}, ${f});`:p;return`getState('${n}', (err, state) => {\n${o.prefixLines(m,o.INDENT)}\n});\n`},f.System.blocks.update=`<sep gap="5"></sep><block type="update"> <mutation delay_input="false"></mutation> <field name="WITH_DELAY">FALSE</field></block>`,i.update={init:function(){this.appendDummyInput().appendField(p(`update`)),this.appendDummyInput(`OID`).appendField(new d(p(`select_id`),`state`),`OID`),this.appendValueInput(`VALUE`).setCheck(null).appendField(p(`update_with`)),this.appendDummyInput(`WITH_DELAY`).appendField(p(`update_delay`)).appendField(y(),`WITH_DELAY`),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`update_tooltip`)),this.setHelpUrl(m(`update_help`))},...v(`control_clear_running`)},o.forBlock.update=function(e){let t=e.getFieldValue(`OID`);r.VARIABLES_DEFAULT_NAME=`value`;let n=o.valueToCode(e,`VALUE`,a.ATOMIC),i=b(e),c=l(e.getFieldValue(`CLEAR_RUNNING`)),u=s(t),d=u?` /* ${u} */`:``;return l(e.getFieldValue(`WITH_DELAY`))?`setStateDelayed('${t}'${d}, ${n}, true, ${i}, ${c});\n`:`setState('${t}'${d}, ${n}, true);\n`},f.System.blocks.control_ex=`<sep gap="5"></sep><block type="control_ex"> <field name="TYPE">false</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="OID"> <shadow type="field_oid"> </shadow> </value> <value name="VALUE"> <shadow type="logic_boolean"> <field name="BOOL">TRUE</field> </shadow> </value> <value name="DELAY_MS"> <shadow type="math_number"> <field name="NUM">0</field> </shadow> </value> <value name="EXPIRE"> <shadow type="math_number"> <field name="NUM">0</field> </shadow> </value></block>`,i.control_ex={init:function(){this.appendDummyInput().appendField(p(`control_ex`)),this.appendValueInput(`OID`).setCheck(`String`).appendField(p(`field_oid_OID`)),this.appendDummyInput(`TYPE`).appendField(new e([[p(`control_ex_control`),`false`],[p(`control_ex_update`),`true`]]),`TYPE`),this.appendValueInput(`VALUE`).setCheck(null).appendField(p(`control_ex_value`)),this.appendValueInput(`DELAY_MS`).setCheck(`Number`).appendField(p(`control_ex_delay`)),this.appendValueInput(`EXPIRE`).setCheck(`Number`).appendField(p(`control_ex_expire`)),this.appendDummyInput(`CLEAR_RUNNING_INPUT`).appendField(p(`control_ex_clear_running`)).appendField(new n,`CLEAR_RUNNING`),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`control_tooltip`)),this.setHelpUrl(m(`control_help`))}},o.forBlock.control_ex=function(e){let t=o.valueToCode(e,`OID`,a.ATOMIC),n=o.valueToCode(e,`VALUE`,a.ATOMIC),r=o.valueToCode(e,`DELAY_MS`,a.ATOMIC),i=o.valueToCode(e,`EXPIRE`,a.ATOMIC),s=l(e.getFieldValue(`CLEAR_RUNNING`));return`setStateDelayed(${t}, { val: ${n}, ack: ${l(e.getFieldValue(`TYPE`))}${i?`, expire: ${i}`:``} }, parseInt(((${r}) || '').toString(), 10), ${s});\n`},f.System.blocks.create=`<block type="create"> <field name="NAME">0_userdata.0.example</field></block>`,i.create={init:function(){this.appendDummyInput().appendField(p(`create`)),this.appendDummyInput(`NAME`).appendField(p(`create_oid`)).appendField(new t(`0_userdata.0.example`),`NAME`);let e=this.appendValueInput(`VALUE`).setCheck(null).appendField(p(`create_init`));e.connection&&(e.connection._optional=!0);let n=this.appendValueInput(`COMMON`).setCheck(null).appendField(p(`create_common`));n.connection&&(n.connection._optional=!0),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`create_tooltip`)),this.setHelpUrl(m(`create_help`))}},o.forBlock.create=function(e){let t=e.getFieldValue(`NAME`),n=o.valueToCode(e,`VALUE`,a.ATOMIC),r=n!==null&&n!==``?`, ${n}`:``,i=o.valueToCode(e,`COMMON`,a.ATOMIC),s=i!==null&&i!==``?`, ((common) => typeof common !== 'object' ? JSON.parse(common) : common)(${i})`:``,c=o.statementToCode(e,`STATEMENT`);return`createState(${u(t)}${r}${s}, async () => {\n${c}});\n`},f.System.blocks.create_ex=`<sep gap="5"></sep><block type="create_ex"> <field name="NAME">0_userdata.0.example</field> <field name="TYPE">string</field> <field name="READABLE">FALSE</field> <field name="WRITEABLE">FALSE</field></block>`,i.create_ex={init:function(){this.appendDummyInput().appendField(p(`create`)),this.appendDummyInput(`NAME`).appendField(p(`create_oid`)).appendField(new t(`0_userdata.0.example`),`NAME`),this.appendDummyInput(`TYPE`).appendField(p(`create_type`)).appendField(new e([[p(`create_type_string`),`string`],[p(`create_type_number`),`number`],[p(`create_type_boolean`),`boolean`],[p(`create_type_json`),`json`],[p(`create_type_object`),`object`],[p(`create_type_array`),`array`]]),`TYPE`);let r=this.appendValueInput(`VALUE`).setCheck(null).appendField(p(`create_init`));r.connection&&(r.connection._optional=!0),this.appendDummyInput(`READABLE_INPUT`).appendField(p(`create_readable`)).appendField(new n(`FALSE`),`READABLE`),this.appendDummyInput(`WRITEABLE_INPUT`).appendField(p(`create_writeable`)).appendField(new n(`FALSE`),`WRITEABLE`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`create_tooltip`)),this.setHelpUrl(m(`create_help`))}},o.forBlock.create_ex=function(e){let t=e.getFieldValue(`NAME`),n=e.getFieldValue(`TYPE`),r=``,i=o.valueToCode(e,`VALUE`,a.ATOMIC);i!==null&&i!==``&&(r=n===`number`?`, parseFloat(${i})`:n===`boolean`?`, !!${i}`:n===`string`?`, String(${i})`:`, ${i}`);let s=l(e.getFieldValue(`READABLE`)),c=l(e.getFieldValue(`WRITEABLE`)),d=o.statementToCode(e,`STATEMENT`);return`createState(${u(t)}${r}, { type: '${n}', read: ${s}, write: ${c} }, async () => {\n${d}});\n`},f.System.blocks.get_value=`<block type="get_value"> <field name="ATTR">val</field></block>`,i.get_value={init:function(){this.appendDummyInput(`ATTR`).appendField(new e(h(!0)),`ATTR`),this.appendDummyInput().appendField(p(`get_value_OID`)),this.appendDummyInput().appendField(new d(p(`select_id`),`state`),`OID`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(f.System.HUE),this.setTooltip(p(`get_value_tooltip`)),this.setHelpUrl(m(`get_value_help`))},onchange:_},o.forBlock.get_value=function(e){let t=e.getFieldValue(`OID`),n=e.getFieldValue(`ATTR`);return g(n)?[`(await getObjectAsync('${t}')).${n}`,a.ATOMIC]:[`getState(${u(t)}).${n}`,a.ATOMIC]},f.System.blocks.get_value_var=`<sep gap="5"></sep><block type="get_value_var"> <field name="ATTR">val</field> <value name="OID"> <shadow type="field_oid"> </shadow> </value></block>`,i.get_value_var={init:function(){this.appendDummyInput(`ATTR`).appendField(new e(h(!1)),`ATTR`),this.appendDummyInput().appendField(p(`get_value_OID`)),this.appendValueInput(`OID`).setCheck(null),this.setInputsInline(!0),this.setOutput(!0),this.setColour(f.System.HUE),this.setTooltip(p(`get_value_tooltip`)),this.setHelpUrl(m(`get_value_help`))},onchange:_},o.forBlock.get_value_var=function(e){let t=o.valueToCode(e,`OID`,a.ATOMIC),n=e.getFieldValue(`ATTR`);return g(n)?[`(await getObjectAsync(${t})).${n}`,a.ATOMIC]:[`getState(${t}).${n}`,a.ATOMIC]},f.System.blocks.get_value_async=`<sep gap="5"></sep><block type="get_value_async"> <field name="ATTR">val</field></block>`,i.get_value_async={init:function(){this.appendDummyInput(`ATTR`).appendField(new e(h(!1)),`ATTR`),this.appendDummyInput().appendField(p(`get_value_OID`)),this.appendDummyInput().appendField(new d(p(`select_id`),`state`),`OID`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`get_value_tooltip`)),this.setHelpUrl(m(`get_value_help`))}},o.forBlock.get_value_async=function(e){let t=e.getFieldValue(`OID`),n=e.getFieldValue(`ATTR`),r=o.statementToCode(e,`STATEMENT`),i=g(n)?{call:`getObjectAsync`,args:`(err, obj)`,from:`obj`}:{call:`getState`,args:`(err, state)`,from:`state`};return`${i.call}(${u(t)}, async ${i.args} => {\n${o.prefixLines(`let value = ${i.from}.${n};`,o.INDENT)}\n${r}});\n`},f.System.blocks.get_object=`<block type="get_object"></block>`,i.get_object={init:function(){this.appendDummyInput().appendField(p(`get_object`)),this.appendDummyInput().appendField(new d(p(`select_id`),`all`),`OID`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(f.Object.HUE),this.setTooltip(p(`get_object_tooltip`)),this.setHelpUrl(m(`get_object_help`))},onchange:function(){let e=this.getParent();e&&f.System.WARNING_PARENTS.includes(e.type)?this.setWarningText(p(`false_connection_trigger_warning`),this.id):e&&[`direct`,`control_ex`,`get_value_var`].includes(e.type)?this.setWarningText(p(`get_object_connection_warning`),this.id):this.setWarningText(null,this.id)}},o.forBlock.get_object=function(e){return[`getObject(${u(e.getFieldValue(`OID`))})`,a.ATOMIC]},f.System.blocks.get_object_async=`<sep gap="5"></sep><block type="get_object_async"></block>`,i.get_object_async={init:function(){this.appendDummyInput().appendField(p(`get_object`)),this.appendDummyInput().appendField(new d(p(`select_id`),`all`),`OID`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setColour(f.Object.HUE),this.setTooltip(p(`get_object_tooltip`)),this.setHelpUrl(m(`get_object_help`))}},o.forBlock.get_object_async=function(e){let t=o.statementToCode(e,`STATEMENT`);return`getObjectAsync(${u(e.getFieldValue(`OID`))}).then(async (obj) => {\n${t}});\n`},f.System.blocks.state_exists_var=`<sep gap="5"></sep><block type="state_exists_var"> <value name="OID"> <shadow type="field_oid"> </shadow> </value></block>`,i.state_exists_var={init:function(){this.appendDummyInput().appendField(p(`state_exists`)),this.appendValueInput(`OID`).setCheck(null),this.setInputsInline(!0),this.setOutput(!0,`Boolean`),this.setColour(f.System.HUE),this.setTooltip(p(`state_exists_tooltip`)),this.setHelpUrl(m(`state_exists_help`))}},o.forBlock.state_exists_var=function(e){return[`(await existsStateAsync(${o.valueToCode(e,`OID`,a.ATOMIC)||`''`}))`,a.ATOMIC]};let w=(e,t,n)=>{i[e]={init:function(){this.appendDummyInput().appendField(p(t)),this.appendDummyInput().appendField(new d(p(`select_id`),n),`oid`),this.setInputsInline(!0),this.setOutput(!0,`String`),this.setColour(`%{BKY_TEXTS_HUE}`),this.setTooltip(p(`field_oid_tooltip`))}},o.forBlock[e]=function(e){return[u(e.getFieldValue(`oid`)),a.ATOMIC]}};f.System.blocks.field_oid=`<block type="field_oid"></block>`,w(`field_oid`,`field_oid_OID`,`state`),f.System.blocks.field_oid_meta=`<sep gap="5"></sep><block type="field_oid_meta"></block>`,w(`field_oid_meta`,`field_oid_OID_meta`,`meta`),f.System.blocks.field_oid_script=`<sep gap="5"></sep><block type="field_oid_script"></block>`,w(`field_oid_script`,`field_oid_OID_script`,`script`),f.System.blocks.get_attr=`<block type="get_attr"> <value name="PATH"> <shadow type="text"> <field name="TEXT">attribute1</field> </shadow> </value> <value name="OBJECT"> <shadow type="get_object"> <field name="OID">Object ID</field> </shadow> </value></block>`,i.get_attr={init:function(){this.appendValueInput(`PATH`).setCheck(null).appendField(p(`get_attr_path`)),this.appendValueInput(`OBJECT`).appendField(p(`get_attr_by`)),this.setInputsInline(!0),this.setOutput(!0),this.setColour(f.System.HUE),this.setTooltip(p(`get_attr_tooltip`)),this.setHelpUrl(m(`get_attr_help`))}},o.forBlock.get_attr=function(e){return[`getAttr(${o.valueToCode(e,`OBJECT`,a.ATOMIC)}, ${o.valueToCode(e,`PATH`,a.ATOMIC)})`,a.ATOMIC]},f.System.blocks.direct=`<block type="direct"> <field name="ONLY_CHANGES">TRUE</field> <value name="OID_SRC"> <shadow type="field_oid"> <field name="oid">Object ID 1</field> </shadow> </value> <value name="OID_DST"> <shadow type="field_oid"> <field name="oid">Object ID 2</field> </shadow> </value></block>`,i.direct={init:function(){this.appendDummyInput().appendField(p(`direct`)),this.appendValueInput(`OID_SRC`).setCheck(`String`).appendField(p(`direct_oid_src`)),this.appendValueInput(`OID_DST`).setCheck(`String`).appendField(p(`direct_oid_dst`)),this.appendDummyInput(`ONLY_CHANGES`).appendField(p(`direct_only_changes`)).appendField(new n(`TRUE`),`ONLY_CHANGES`),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.Trigger.HUE),this.setTooltip(p(`direct_tooltip`)),this.setHelpUrl(m(`direct_help`))}},o.forBlock.direct=function(e){let t=o.valueToCode(e,`OID_SRC`,a.ATOMIC),n=o.valueToCode(e,`OID_DST`,a.ATOMIC);return`on({ id: ${t}, change: '${l(e.getFieldValue(`ONLY_CHANGES`))?`ne`:`any`}' }, (obj) => {\n${o.prefixLines(`setState(${n}, obj.state.val);`,o.INDENT)}\n});\n`},f.System.blocks.control_instance=`<block type="control_instance"> <field name="INSTANCE">admin.0</field> <field name="ACTION">restartInstanceAsync</field></block>`,i.control_instance={init:function(){var n;let r=[];if((n=window.main)!=null&&n.instances){for(let e of window.main.instances){let t=e.substring(15);r.push([t,t])}r.length||r.push([p(`control_instance_no_instances`),``]),this.appendDummyInput(`INSTANCE`).appendField(p(`control_instance`)).appendField(new e(r),`INSTANCE`)}else this.appendDummyInput(`INSTANCE`).appendField(p(`control_instance`)).appendField(new t(`adapter.0`),`INSTANCE`);this.appendDummyInput(`ACTION`).appendField(p(`control_instance_action`)).appendField(new e([[p(`control_instance_start`),`startInstanceAsync`],[p(`control_instance_stop`),`stopInstanceAsync`],[p(`control_instance_restart`),`restartInstanceAsync`]]),`ACTION`),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`control_instance_tooltip`)),this.setHelpUrl(m(`control_instance_help`))}},o.forBlock.control_instance=function(e){return`await ${e.getFieldValue(`ACTION`)}(${u(e.getFieldValue(`INSTANCE`))});\n`},f.System.blocks.control_script=`<block type="control_script"> <field name="ACTION">startScriptAsync</field></block>`,i.control_script={init:function(){this.appendDummyInput(`OID`).appendField(p(`control_script`)).appendField(new d(p(`select_id`),`script`),`OID`),this.appendDummyInput(`ACTION`).appendField(p(`control_instance_action`)).appendField(new e([[p(`control_script_start`),`startScriptAsync`],[p(`control_script_stop`),`stopScriptAsync`]]),`ACTION`),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`control_script_tooltip`)),this.setHelpUrl(m(`control_script_help`))}},o.forBlock.control_script=function(e){return`await ${e.getFieldValue(`ACTION`)}(${u(e.getFieldValue(`OID`))});\n`},f.System.blocks.regex=`<block type="regex"> <field name="TEXT">(.*)</field></block>`,i.regex={init:function(){this.appendDummyInput().appendField(`RegExp`),this.appendDummyInput(`TEXT`).appendField(new t(`(.*)`),`TEXT`),this.setInputsInline(!0),this.setOutput(!0,`Array`),this.setColour(f.System.HUE)}},o.forBlock.regex=function(e){return[`new RegExp(${u(e.getFieldValue(`TEXT`))})`,a.ATOMIC]},f.System.blocks.selector=`<block type="selector"> <field name="TEXT">channel[state.id=*]</field></block>`,i.selector={init:function(){this.appendDummyInput().appendField(`${p(`selector`)} $(`),this.appendDummyInput(`TEXT`).appendField(new t(`channel[state.id=*]`),`TEXT`),this.appendDummyInput().appendField(`)`),this.setInputsInline(!0),this.setOutput(!0,`Array`),this.setColour(f.System.HUE)}},o.forBlock.selector=function(e){return[`Array.prototype.slice.apply($(${u(e.getFieldValue(`TEXT`))}))`,a.ATOMIC]}}export{f as install};
@@ -1 +0,0 @@
1
- import{i as e,o as t,r as n,t as r}from"./blockly-DBw-ytY1.js";import{c as i,l as a}from"./index-07o_WKsX.js";import{n as o,s,t as c}from"./helpers-B0ByElPJ.js";var l={"time_get_yyyy.mm.dd":`YYYY.MM.DD`,"time_get_yyyy/mm/dd":`YYYY/MM/DD`,"time_get_yy.mm.dd":`YY.MM.DD`,"time_get_yy/mm/dd":`YY/MM/DD`,"time_get_dd.mm.yyyy":`DD.MM.YYYY`,"time_get_dd/mm/yyyy":`DD/MM/YYYY`,"time_get_dd.mm.yy":`DD.MM.YY`,"time_get_dd/mm/yy":`DD/MM/YY`,"time_get_mm/dd/yyyy":`MM/DD/YYYY`,"time_get_mm/dd/yy":`MM/DD/YY`,"time_get_dd.mm":`DD.MM.`,"time_get_dd/mm":`DD/MM`,"time_get_mm.dd":`MM.DD`,"time_get_mm/dd":`MM/DD`,time_get_hh_mm:`hh:mm`,time_get_hh_mm_ss:`hh:mm:ss`,"time_get_hh_mm_ss.sss":`hh:mm:ss.sss`};function u(e){return e===!0||e===`true`||e===`TRUE`}function d(){let d=window.Blockly,f=d.Translate,p=window.getHelp;d.CustomBlocks=d.CustomBlocks||[],d.CustomBlocks.push(`Time`),d.Time={HUE:270,blocks:{}};for(let[e,t]of Object.entries(l))d.Words[e].format=t;let m=()=>[[f(`time_compare_lt`),`<`],[f(`time_compare_le`),`<=`],[f(`time_compare_gt`),`>`],[f(`time_compare_ge`),`>=`],[f(`time_compare_eq`),`==`],[f(`time_compare_bw`),`between`],[f(`time_compare_nb`),`not between`]];d.Time.blocks.time_compare_ex=`<block type="time_compare_ex"> <mutation end_time="false" actual_time="true"></mutation> <field name="USE_ACTUAL_TIME">TRUE</field> <field name="OPTION">&lt;</field> <value name="START_TIME"> <shadow type="text"> <field name="TEXT">12:00</field> </shadow> </value></block>`,r.time_compare_ex={init:function(){this.appendDummyInput(`TIME_TEXT`).appendField(f(`time_compare_ex`)),this.appendDummyInput(`USE_ACTUAL_TIME`).appendField(new n(`TRUE`,function(e){this.getSourceBlock().updateShape_(void 0,e)}),`USE_ACTUAL_TIME`),this.appendDummyInput().appendField(f(`time_compare_is_ex`)),this.appendDummyInput(`OPTION`).appendField(new e(m(),function(e){this.getSourceBlock().updateShape_(e===`between`||e===`not between`)}),`OPTION`),this.appendDummyInput().appendField(` `),this.appendValueInput(`START_TIME`),this.setInputsInline(!0),this.setOutput(!0,`Boolean`),this.setColour(d.Time.HUE),this.setTooltip(f(`time_compare_ex_tooltip`)),this.setHelpUrl(p(`time_compare_ex_help`))},mutationToDom:function(){let e=document.createElement(`mutation`),t=this.getFieldValue(`OPTION`),n=this.getFieldValue(`USE_ACTUAL_TIME`);return e.setAttribute(`end_time`,t===`between`||t===`not between`?`true`:`false`),e.setAttribute(`actual_time`,u(n)?`true`:`false`),e},domToMutation:function(e){this.updateShape_(u(e.getAttribute(`end_time`)),u(e.getAttribute(`actual_time`)))},updateShape_:function(e,t){if(e===void 0&&(e=this.getFieldValue(`OPTION`)===`between`||this.getFieldValue(`OPTION`)===`not between`),e){if(!this.getInput(`END_TIME`)&&(this.getInput(`CUSTOM_TIME`)&&(this.removeInput(`CUSTOM_TIME`),this.removeInput(`CUSTOM_TEXT`)),this.appendDummyInput(`AND`).appendField(f(`time_compare_and`)),this.appendValueInput(`END_TIME`),!window.scripts.loading)){let e=this.workspace;setTimeout(()=>{var t;let n=this.getInput(`END_TIME`);if(!(n!=null&&(t=n.connection)!=null&&t.isConnected())){let t=e.newBlock(`text`);t.setShadow(!0),t.setFieldValue(`18:00`,`TEXT`),t.outputConnection.connect(n.connection),t.initSvg(),t.render()}},100)}}else this.getInput(`END_TIME`)&&(this.removeInput(`END_TIME`),this.removeInput(`AND`));t===void 0&&(t=this.getFieldValue(`USE_ACTUAL_TIME`));let n=u(t),r=this.getInput(`CUSTOM_TIME`);n?r&&(this.getInput(`TIME_TEXT`).fieldRow[0].setValue(f(`time_compare_ex`)),this.removeInput(`CUSTOM_TIME`),this.removeInput(`CUSTOM_TEXT`)):(this.getInput(`TIME_TEXT`).fieldRow[0].setValue(f(`time_compare_custom_ex`)),r||(this.appendDummyInput(`CUSTOM_TEXT`).appendField(f(`time_compare_ex_custom`)),this.appendValueInput(`CUSTOM_TIME`)))}},a.forBlock.time_compare_ex=function(e){let t=e.getFieldValue(`OPTION`);return[`compareTime(${a.valueToCode(e,`START_TIME`,i.ATOMIC)}, ${e.getInput(`END_TIME`)&&a.valueToCode(e,`END_TIME`,i.ATOMIC)||null}, '${t}', ${e.getInput(`CUSTOM_TIME`)&&a.valueToCode(e,`CUSTOM_TIME`,i.ATOMIC)||null})`,i.ATOMIC]},d.Time.blocks.time_compare=`<block type="time_compare"> <mutation end_time="false"></mutation> <field name="OPTION">&lt;</field> <field name="START_TIME">12:00</field></block>`,r.time_compare={init:function(){this.appendDummyInput().appendField(f(`time_compare`)),this.appendDummyInput(`OPTION`).appendField(new e(m(),function(e){this.getSourceBlock().updateShape_(e===`between`||e===`not between`)}),`OPTION`),this.appendDummyInput().appendField(` `),this.appendDummyInput(`START_TIME`).appendField(new t(`12:00`),`START_TIME`),this.setInputsInline(!0),this.setOutput(!0,`Boolean`),this.setColour(d.Time.HUE),this.setTooltip(f(`time_compare_tooltip`)),this.setHelpUrl(p(`time_compare_help`))},mutationToDom:function(){let e=document.createElement(`mutation`),t=this.getFieldValue(`OPTION`);return e.setAttribute(`end_time`,t===`between`||t===`not between`?`true`:`false`),e},domToMutation:function(e){this.updateShape_(u(e.getAttribute(`end_time`)))},updateShape_:function(e){e?this.getInput(`END_TIME`)||(this.appendDummyInput(`AND`).appendField(f(`time_compare_and`)),this.appendDummyInput(`END_TIME`).appendField(new t(`18:00`),`END_TIME`)):this.getInput(`END_TIME`)&&(this.removeInput(`END_TIME`),this.removeInput(`AND`))}},a.forBlock.time_compare=function(e){let t=e.getFieldValue(`OPTION`),n=e.getFieldValue(`START_TIME`),r=e.getFieldValue(`END_TIME`);return[`compareTime(${s(n)}, ${r?s(r):`null`}, ${s(t)})`,i.ATOMIC]},d.Time.blocks.time_get=`<block type="time_get"> <mutation format="false" language="false"></mutation> <field name="OPTION">object</field></block>`,r.time_get={init:function(){this.appendDummyInput().appendField(f(`time_get`)),this.appendDummyInput(`OPTION`).appendField(new e(c(),function(e){this.getSourceBlock().updateShape_(e===`custom`,e===`wdt`||e===`wdts`||e===`Mt`||e===`Mts`)}),`OPTION`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(d.Time.HUE),this.setTooltip(f(`time_get_tooltip`))},mutationToDom:function(){let e=document.createElement(`mutation`),t=this.getFieldValue(`OPTION`);return e.setAttribute(`format`,t===`custom`?`true`:`false`),e.setAttribute(`language`,t===`wdt`||t===`wdts`||t===`Mt`||t===`Mts`?`true`:`false`),e},domToMutation:function(e){this.updateShape_(u(e.getAttribute(`format`)),u(e.getAttribute(`language`)))},updateShape_:function(n,r){n?this.getInput(`FORMAT`)||this.appendDummyInput(`FORMAT`).appendField(` `).appendField(new t(f(`time_get_default_format`)),`FORMAT`):this.getInput(`FORMAT`)&&this.removeInput(`FORMAT`),r?this.getInput(`LANGUAGE`)||this.appendDummyInput(`LANGUAGE`).appendField(new e(o()),`LANGUAGE`):this.getInput(`LANGUAGE`)&&this.removeInput(`LANGUAGE`)}},a.forBlock.time_get=function(e){let t=e.getFieldValue(`OPTION`),n=e.getFieldValue(`FORMAT`),r=e.getFieldValue(`LANGUAGE`),a;return a=t===`object`?`(new Date().getTime())`:t===`ms`?`(new Date().getMilliseconds())`:t===`s`?`(new Date().getSeconds())`:t===`sid`?`(() => { const v = new Date(); return v.getHours() * 3600 + v.getMinutes() * 60 + v.getSeconds(); })()`:t===`m`?`(new Date().getMinutes())`:t===`mid`?`(() => { const v = new Date(); return v.getHours() * 60 + v.getMinutes(); })()`:t===`h`?`(new Date().getHours())`:t===`d`?`(new Date().getDate())`:t===`M`?`(new Date().getMonth() + 1)`:t===`Mt`?`formatDate(new Date(), 'OO', '${r}')`:t===`Mts`?`formatDate(new Date(), 'O', '${r}')`:t===`y`?`(new Date().getYear())`:t===`fy`?`(new Date().getFullYear())`:t===`wdt`?`formatDate(new Date(), 'WW', '${r}')`:t===`wdts`?`formatDate(new Date(), 'W', '${r}')`:t===`wd`?`(() => { const d = new Date().getDay(); return d === 0 ? 7 : d; })()`:t===`cw`?`((date) => { const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())); const dayNum = d.getUTCDay() || 7; d.setUTCDate(d.getUTCDate() + 4 - dayNum); const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1)); return Math.ceil(((d.getTime() - yearStart.getTime()) / 86400000 + 1) / 7); })(new Date())`:t===`custom`?`formatDate(new Date(), ${s(n)})`:`formatDate(new Date(), ${s(t)})`,[a,i.ATOMIC]},d.Time.blocks.time_get_special=`<block type="time_get_special"> <field name="TYPE">dayStart</field></block>`,r.time_get_special={init:function(){this.appendDummyInput().appendField(f(`time_get_special`)),this.appendDummyInput(`TYPE`).appendField(new e([[f(`time_get_special_day_start`),`dayStart`],[f(`time_get_special_day_end`),`dayEnd`],[f(`time_get_special_week_start`),`weekStart`],[f(`time_get_special_week_end`),`weekEnd`],[f(`time_get_special_month_start`),`monthStart`],[f(`time_get_special_month_end`),`monthEnd`]]),`TYPE`),this.setInputsInline(!0),this.setOutput(!0,`Number`),this.setColour(d.Time.HUE),this.setTooltip(f(`time_get_special_tooltip`))}},a.forBlock.time_get_special=function(e){let t=e.getFieldValue(`TYPE`),n=``;return t===`dayStart`?n=`/* start of day */ (() => { const d = new Date(); d.setHours(0, 0, 0, 0); return d.getTime(); })()`:t===`dayEnd`?n=`/* end of day */ (() => { const d = new Date(); d.setHours(23, 59, 59, 999); return d.getTime(); })()`:t===`weekStart`?n=`/* start of week */ (() => { const d = new Date(); d.setHours(0, 0, 0, 0); return new Date(d.getFullYear(), d.getMonth(), d.getDate() - d.getDay() + (d.getDay() == 0 ? -6 : 1)).getTime(); })()`:t===`weekEnd`?n=`/* end of week */ (() => { const d = new Date(); d.setHours(0, 0, 0, 0); return new Date(d.getFullYear(), d.getMonth(), d.getDate() + (8 - d.getDay())).getTime() - 1; })()`:t===`monthStart`?n=`/* start of month */ (() => { const d = new Date(); d.setHours(0, 0, 0, 0); d.setDate(1); return d.getTime(); })()`:t===`monthEnd`&&(n=`/* end of month */ (() => { const d = new Date(); d.setHours(0, 0, 0, 0); return new Date(d.getFullYear(), d.getMonth() + 1, 1).getTime() - 1; })()`),[n,i.ATOMIC]},d.Time.blocks.time_astro=`<block type="time_astro"> <field name="TYPE">sunrise</field> <field name="OFFSET">0</field></block>`,r.time_astro={init:function(){this.appendDummyInput().appendField(f(`time_astro`)),this.appendDummyInput(`TYPE`).appendField(new e([[f(`astro_sunriseText`),`sunrise`],[f(`astro_sunriseEndText`),`sunriseEnd`],[f(`astro_goldenHourEndText`),`goldenHourEnd`],[f(`astro_solarNoonText`),`solarNoon`],[f(`astro_goldenHourText`),`goldenHour`],[f(`astro_sunsetStartText`),`sunsetStart`],[f(`astro_sunsetText`),`sunset`],[f(`astro_duskText`),`dusk`],[f(`astro_nauticalDuskText`),`nauticalDusk`],[f(`astro_nightText`),`night`],[f(`astro_nightEndText`),`nightEnd`],[f(`astro_nauticalDawnText`),`nauticalDawn`],[f(`astro_dawnText`),`dawn`],[f(`astro_nadirText`),`nadir`]]),`TYPE`),this.appendDummyInput(`OFFSET`).appendField(f(`time_astro_offset`)).appendField(new t(`0`),`OFFSET`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(d.Time.HUE),this.setTooltip(f(`time_astro_tooltip`)),this.setHelpUrl(p(`time_astro_help`))}},a.forBlock.time_astro=function(e){return[`getAstroDate('${e.getFieldValue(`TYPE`)}', undefined, ${parseFloat(e.getFieldValue(`OFFSET`))})`,i.ATOMIC]},d.Time.blocks.time_calculation=`<block type="time_calculation"> <field name="OPERATION">+</field> <field name="UNIT">ms</field> <value name="DATE_TIME"> <shadow type="time_get"> <mutation format="false" language="false"></mutation> <field name="OPTION">object</field> </shadow> </value> <value name="VALUE"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> </value></block>`,r.time_calculation={init:function(){this.appendDummyInput(`NAME`).appendField(f(`time_calculation`)),this.appendValueInput(`DATE_TIME`).appendField(f(`time_calculation_on`)).setCheck(null),this.appendDummyInput(`OPERATION`).appendField(new e([[`+`,`+`],[`-`,`-`]]),`OPERATION`),this.appendValueInput(`VALUE`),this.appendDummyInput(`UNIT`).appendField(new e([[f(`time_calculation_ms`),`ms`],[f(`time_calculation_sec`),`sec`],[f(`time_calculation_min`),`min`],[f(`time_calculation_hour`),`hour`],[f(`time_calculation_day`),`day`],[f(`time_calculation_week`),`week`]]),`UNIT`),this.setInputsInline(!0),this.setOutput(!0,`Number`),this.setColour(d.Time.HUE),this.setTooltip(f(`time_calculation_tooltip`))}},a.forBlock.time_calculation=function(e){let t=a.valueToCode(e,`DATE_TIME`,i.ATOMIC),n=e.getFieldValue(`OPERATION`),r=a.valueToCode(e,`VALUE`,i.ATOMIC),o=e.getFieldValue(`UNIT`),s=1;return o===`sec`?s=1e3:o===`min`?s=6e4:o===`hour`?s=36e5:o===`day`?s=864e5:o===`week`&&(s=6048e5),[`/* time calculation */ ((dateTime) => { const ts = (typeof dateTime === 'object' ? dateTime.getTime() : dateTime); return ts ${n} ((${r}) * ${s}); })(${t})`,i.ATOMIC]}}export{d as install};
@@ -1 +0,0 @@
1
- import{c as e,i as t,o as n,t as r}from"./blockly-DBw-ytY1.js";import{c as i,l as a}from"./index-07o_WKsX.js";var o={id:`timeout`,marker:`isTimeout_`,variableType:`timeout`},s={id:`interval`,marker:`isInterval_`,variableType:`interval`};function c(e,t){let n=parseFloat(e);return t===`min`?n*6e4:t===`sec`?n*1e3:n}function l(e){return a.nameDB_.safeName(e.getFieldValue(`NAME`))}function u(){let u=window.Blockly,d=u.Translate,f=window.getHelp;u.CustomBlocks=u.CustomBlocks||[],u.CustomBlocks.push(`Timeouts`);let p=()=>[[d(`timeouts_settimeout_ms`),`ms`],[d(`timeouts_settimeout_sec`),`sec`],[d(`timeouts_settimeout_min`),`min`]],m=(t,n,r)=>{for(let i of n.getAllBlocks())if(i!==r&&(i.isTimeout_||i.isInterval_)&&e.equals(i.getFieldValue(`NAME`),t))return!1;return!0},h=(e,t)=>{if(t.isInFlyout)return e;for(;!m(e,t.workspace,t);){let t=e.match(/^(.*?)(\d+)$/);t?e=t[1]+(parseInt(t[2],10)+1):e+=`2`}return e},g=function(e){return h(e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,``),this.getSourceBlock())},_=(e,t)=>{let n=[];for(let r of e.getAllBlocks())if(r[t.marker]){let e=r.getFieldValue(`NAME`);n.push([e,e])}if(window.scripts.loading)for(let t of e.getVariableMap().getVariablesOfType(``))n.find(e=>e[0]===t.getName())||n.push([t.getName(),t.getName()]);for(let r of e.getVariableMap().getVariablesOfType(t.variableType))n.find(e=>e[0]===r.getName())||n.push([r.getName(),r.getName()]);return n.length||n.push([``,``]),n};u.Timeouts={HUE:70,blocks:{},getAllTimeouts:e=>_(e,o),getAllIntervals:e=>_(e,s)};let v=e=>new t(()=>{var t;return(t=window.scripts)!=null&&t.blocklyWorkspace?_(window.scripts.blocklyWorkspace,e):[]});u.Timeouts.blocks.timeouts_wait=`<block type="timeouts_wait"> <field name="DELAY">1000</field> <field name="UNIT">ms</field></block>`,r.timeouts_wait={init:function(){this.appendDummyInput().appendField(d(`timeouts_wait`)).appendField(new n(`1000`),`DELAY`).appendField(new t(p()),`UNIT`),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(u.Timeouts.HUE),this.setTooltip(d(`timeouts_wait_tooltip`)),this.setHelpUrl(f(`timeouts_wait_help`))}},a.forBlock.timeouts_wait=function(e){return`await wait(${c(e.getFieldValue(`DELAY`),e.getFieldValue(`UNIT`))});\n`};let y=(e,o)=>{let s=e.id===`timeout`,m=`timeouts_set${e.id}${o?`_variable`:``}`,_=s?`DELAY`:`INTERVAL`,v=s?`DELAY_MS`:`INTERVAL_MS`,y=`timeouts_set${e.id}`,b=s?`timeout`:d(`timeouts_setinterval_name`);r[m]={init:function(){let e=new n(h(b,this),g);e.setSpellcheck(!1);let r=this.appendDummyInput().appendField(d(y)).appendField(e,`NAME`).appendField(d(`${y}_in`));o?this.appendValueInput(v).setCheck(`Number`).appendField(d(`timeouts_settimeout_ms`)):r.appendField(new n(`1000`),_).appendField(new t(p()),`UNIT`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(o),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(u.Timeouts.HUE),this.setTooltip(d(`${y}_tooltip`)),this.setHelpUrl(f(`${y}_help`))},[e.marker]:!0,getVars:function(){return[this.getFieldValue(`NAME`)]},getVarModels:function(){let t=this.getFieldValue(`NAME`);return[{getId:()=>t,name:t,type:e.variableType}]}},a.forBlock[m]=function(e){let t=l(e),n=a.statementToCode(e,`STATEMENT`),r=o?`parseInt(${a.valueToCode(e,v,i.ATOMIC)})`:String(c(e.getFieldValue(_),e.getFieldValue(`UNIT`))),u=s?`${a.prefixLines(`${t} = null;`,a.INDENT)}\n`:``;return`${t} = ${s?`setTimeout`:`setInterval`}(async () => {\n${u}${n}}, ${r});\n`}},b=e=>{let t=`timeouts_clear${e.id}`,n=`timeouts_get${e.id}`;u.Timeouts.blocks[t]=`<sep gap="5"></sep><block type="${t}"> <field name="NAME"></field></block>`,r[t]={init:function(){this.appendDummyInput(`NAME`).appendField(d(t)).appendField(v(e),`NAME`),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(u.Timeouts.HUE),this.setTooltip(d(`${t}_tooltip`)),this.setHelpUrl(f(`${t}_help`))}},a.forBlock[t]=function(t){let n=l(t);return`(() => { if (${n}) { ${e.id===`timeout`?`clearTimeout`:`clearInterval`}(${n}); ${n} = null; }})();\n`},u.Timeouts.blocks[n]=`<sep gap="5"></sep><block type="${n}"> <field name="NAME"></field></block>`,r[n]={init:function(){this.appendDummyInput(`NAME`).appendField(d(n)).appendField(v(e),`NAME`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(u.Timeouts.HUE),this.setTooltip(d(`${n}_tooltip`)),this.setHelpUrl(f(`${n}_help`))}},a.forBlock[n]=function(e){return[l(e),i.ATOMIC]}};u.Timeouts.blocks.timeouts_settimeout=`<block type="timeouts_settimeout"> <field name="NAME">timeout</field> <field name="DELAY">1000</field> <field name="UNIT">ms</field></block>`,y(o,!1),u.Timeouts.blocks.timeouts_settimeout_variable=`<sep gap="5"></sep><block type="timeouts_settimeout_variable"> <value name="DELAY_MS"> <shadow type="math_number"> <field name="NUM">1000</field> </shadow> </value></block>`,y(o,!0),b(o),u.Timeouts.blocks.timeouts_setinterval=`<block type="timeouts_setinterval"> <field name="INTERVAL">1000</field> <field name="UNIT">ms</field></block>`,y(s,!1),u.Timeouts.blocks.timeouts_setinterval_variable=`<sep gap="5"></sep><block type="timeouts_setinterval_variable"> <value name="INTERVAL_MS"> <shadow type="math_number"> <field name="NUM">1000</field> </shadow> </value></block>`,y(s,!0),b(s)}export{u as install};