iobroker.sql 4.3.0 → 4.4.1

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 (71) hide show
  1. package/README.md +55 -14
  2. package/admin/custom/assets/{Components-CWJJ3bu1.js → Components-Biqn0PcX.js} +1 -1
  3. package/admin/custom/assets/DataBrowser-DTTVoTBj.js +7 -0
  4. package/admin/custom/assets/{_virtual_mf-localSharedImportMap___mfe_internal__SqlComponentsSet__mf_owner__1-D9xu_nUa.js → _virtual_mf-localSharedImportMap___mfe_internal__SqlComponentsSet__mf_owner__1-DAGgRMdx.js} +1 -1
  5. package/admin/custom/assets/{_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__233965516817701__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-D_KAxrKJ.js → _virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__264649249385412__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-DiZBpJW2.js} +541 -303
  6. package/admin/custom/assets/{_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__233965516817701__loadShare__shared-CdBNI0v_.js → _virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__264649249385412__loadShare__shared-DmziGsfK.js} +2 -2
  7. package/admin/custom/assets/{_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__233965516817701__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-CH3Bc0Pg.js → _virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__264649249385412__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-CY-VVm-e.js} +5 -5
  8. package/admin/custom/assets/{_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__233965516817701__prebuild__react_mf_2_dom_mf_1_client__prebuild__-DKp49xnK.js → _virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__264649249385412__prebuild__react_mf_2_dom_mf_1_client__prebuild__-SIym-UC8.js} +1 -1
  9. package/admin/custom/assets/{dist-B3E7IYuQ.js → dist-ChhOvPa4.js} +1 -1
  10. package/admin/custom/assets/helpers-CwABI1ut.js +1 -0
  11. package/admin/custom/assets/hostInit-Bp3K06oA.js +1 -0
  12. package/admin/custom/assets/index-BACEccc0.js +1 -0
  13. package/admin/custom/assets/{lib-3uQoRWeQ.js → lib-BlyWjmi5.js} +1 -1
  14. package/admin/custom/assets/{mf-entry-bootstrap-0-3e3d8b70.js → mf-entry-bootstrap-0-03451604.js} +3 -3
  15. package/admin/custom/assets/pendingShares-BhtJBPS2.js +2 -0
  16. package/admin/custom/assets/{utils-Bi7ATSfV.js → utils-Cqsn1la4.js} +1 -1
  17. package/admin/custom/customComponents.js +2 -2
  18. package/admin/custom/i18n/de.json +15 -0
  19. package/admin/custom/i18n/en.json +15 -0
  20. package/admin/custom/i18n/es.json +15 -0
  21. package/admin/custom/i18n/fr.json +15 -0
  22. package/admin/custom/i18n/it.json +15 -0
  23. package/admin/custom/i18n/nl.json +15 -0
  24. package/admin/custom/i18n/pl.json +15 -0
  25. package/admin/custom/i18n/pt.json +15 -0
  26. package/admin/custom/i18n/ru.json +15 -0
  27. package/admin/custom/i18n/uk.json +15 -0
  28. package/admin/custom/i18n/zh-cn.json +15 -0
  29. package/admin/custom/mf-manifest.json +1 -1
  30. package/admin/jsonConfig.json +3 -0
  31. package/build/lib/connection-factory.js +5 -0
  32. package/build/lib/connection-factory.js.map +1 -1
  33. package/build/lib/errors.js +6 -0
  34. package/build/lib/errors.js.map +1 -1
  35. package/build/lib/messages.js +250 -0
  36. package/build/lib/messages.js.map +1 -1
  37. package/build/lib/mssql.js +19 -15
  38. package/build/lib/mssql.js.map +1 -1
  39. package/build/lib/mysql-client.js +87 -13
  40. package/build/lib/mysql-client.js.map +1 -1
  41. package/build/lib/mysql.js +186 -135
  42. package/build/lib/mysql.js.map +1 -1
  43. package/build/lib/names.js +47 -0
  44. package/build/lib/names.js.map +1 -0
  45. package/build/lib/optional-drivers.js.map +1 -1
  46. package/build/lib/postgresql.js +23 -13
  47. package/build/lib/postgresql.js.map +1 -1
  48. package/build/lib/sql-client-pool.js +7 -1
  49. package/build/lib/sql-client-pool.js.map +1 -1
  50. package/build/lib/sql-client.js +25 -5
  51. package/build/lib/sql-client.js.map +1 -1
  52. package/build/lib/sql-string.js +74 -0
  53. package/build/lib/sql-string.js.map +1 -0
  54. package/build/lib/sqlite.js +21 -14
  55. package/build/lib/sqlite.js.map +1 -1
  56. package/build/lib/statement.js +27 -0
  57. package/build/lib/statement.js.map +1 -0
  58. package/build/lib/values.js +27 -0
  59. package/build/lib/values.js.map +1 -1
  60. package/build/lib/write-buffer.js +80 -0
  61. package/build/lib/write-buffer.js.map +1 -0
  62. package/build/main.js +572 -357
  63. package/build/main.js.map +1 -1
  64. package/io-package.json +28 -28
  65. package/package.json +3 -3
  66. package/admin/custom/assets/DataBrowser-CXd6Wilm.js +0 -1
  67. package/admin/custom/assets/helpers-DE61bb74.js +0 -1
  68. package/admin/custom/assets/hostInit-DI6V2HBN.js +0 -1
  69. package/admin/custom/assets/index-DVNkzy1M.js +0 -1
  70. package/admin/custom/assets/pendingShares-Cg-jucDv.js +0 -2
  71. /package/admin/custom/assets/{_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__233965516817701__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__--SURtz9t.js → _virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__264649249385412__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__--SURtz9t.js} +0 -0
package/README.md CHANGED
@@ -270,7 +270,7 @@ Possible options:
270
270
  - **q** - if *q* field should be included in answer
271
271
  - **addId** - if *id* field should be included in answer
272
272
  - **limit** - do not return more entries than limit
273
- - **round** - round result to number of digits after decimal point
273
+ - **round** - round result to number of digits after decimal point. Default: "Round real to" of the datapoint, then of the instance. The stored values are not changed.
274
274
  - **ignoreNull** - if null values should be included (false), replaced by last not null value (true) or replaced with 0 (0)
275
275
  - **removeBorderValues** - By default, additional border values are returned to optimize charting. Set this option to true if this is not wanted (e.g. for script data processing)
276
276
  - **returnNewestEntries** - The returned data are always sorted by timestamp ascending. When using aggregate "none" and also providing "count" or "limit", this means that normally the oldest entries are returned (unless no start data is provided). Set this option to true to get the newest entries instead.
@@ -356,11 +356,36 @@ Example if your database is called 'iobroker':
356
356
  | MS-SQL | `SELECT * FROM iobroker.dbo.datapoints ...` |
357
357
  | MySQL | `SELECT * FROM iobroker.datapoints ...` |
358
358
 
359
- ## Data browser
359
+ ## Data browser and export
360
360
  The instance settings contain a tab **Data browser**: on the left all datapoints that have data in the
361
361
  database, on the right the stored values of the selected one. The values can be paged through, edited,
362
362
  deleted and new ones can be inserted. The tab needs a running instance.
363
363
 
364
+ The export button in its toolbar writes all values of the selected datapoint in the selected time range
365
+ into a file, oldest first:
366
+
367
+ - **CSV** with the columns `ts` (milliseconds since 1970, UTC), `time` (local time), `val`, `ack`, `q` and
368
+ `from`. Column and decimal separator can be chosen; the preselection (`;` and `,` for most languages,
369
+ `,` and `.` for English and Chinese) is what Excel usually expects with the language of the admin.
370
+ - **JSON** as an array of `{ts, val, ack, q, from}` - the format [`storeState`](#storestate) accepts, so
371
+ the values can be written back, e.g. to another datapoint:
372
+
373
+ ```javascript
374
+ const fs = require('fs');
375
+ const values = JSON.parse(fs.readFileSync('/opt/export/hm-rpc.0.ABC123.1.TEMPERATURE.json', 'utf8'));
376
+ sendTo('sql.0', 'storeState', { id: 'javascript.0.temperatureCopy', state: values }, result =>
377
+ console.log(JSON.stringify(result)),
378
+ );
379
+ ```
380
+
381
+ In contrast to `getRawEntries`, both formats contain `ack` and the values of a boolean datapoint as
382
+ `true`/`false` in every database, so that `storeState` creates a boolean datapoint again.
383
+
384
+ The export reads the range in time windows of a few thousand values each, every one a range query on the
385
+ `(id, ts)` index. So even for a datapoint with millions of values the database never has to skip
386
+ millions of rows for an `OFFSET`. A very large export still takes a while and needs the memory of the
387
+ browser for the whole file.
388
+
364
389
  The component is a JSON-Config `custom` component. Its sources are in `src-admin`, the built bundle in
365
390
  `admin/custom` is committed:
366
391
 
@@ -396,9 +421,10 @@ sendTo(
396
421
  id: 'system.adapter.admin.0.memRss',
397
422
  start: Date.now() - 3600000, // optional, inclusive
398
423
  end: Date.now(), // optional, inclusive
399
- limit: 100, // optional, default 100, maximum 2000
424
+ limit: 100, // optional, default 100, maximum 5000
400
425
  offset: 0, // optional, default 0
401
426
  sort: 'desc', // optional, 'desc' (newest first, default) or 'asc'
427
+ noTotal: false, // optional, true skips counting the entries: `total` is then missing
402
428
  },
403
429
  result => {
404
430
  if (result.error) {
@@ -419,7 +445,11 @@ The answer additionally contains `id`, `index` (the ID in the `datapoints` table
419
445
 
420
446
  The values are returned as they come from the database and are **not** converted: `ack` and boolean values
421
447
  are `0`/`1` in most databases, and `val` of a string datapoint is the stored string. `from` is `null` if no
422
- source was stored.
448
+ source was stored. Only `ts` is always a number, although PostgreSQL and MS SQL deliver it as string.
449
+
450
+ Counting the entries is a scan of the whole range. A caller that reads a long range in consecutive windows
451
+ (`start`/`end` of one window inclusive) needs the count only once and can pass `noTotal: true` for all
452
+ other requests.
423
453
 
424
454
  Like `update`, `delete` and `storeState`, this works for datapoints whose logging is disabled too, as long as
425
455
  they still have entries in the database. If the datapoint is unknown, the answer contains an `error`.
@@ -619,6 +649,27 @@ sendTo('sql.0', 'getEnabledDPs', {}, function (result) {
619
649
  -->
620
650
 
621
651
  ## Changelog
652
+ ### 4.4.1 (2026-11-08)
653
+ * (@GermanBluefox) `getDpOverview` with an empty `datapoints` table answers again and returns its connection. Before, the request never got an answer and the connection stayed borrowed, which with SQLite (one connection) blocked every further request (#587)
654
+ * (@GermanBluefox) "Round real to" of a datapoint now applies to `getHistory`. Before, the field was shown but had no effect, only the setting of the instance counted. As with the instance setting, the values are rounded when read, the stored values stay as they are (#587)
655
+ * (@GermanBluefox) phpMyAdmin container: new instances listen on `127.0.0.1` by default instead of on all network interfaces. Existing instances keep their setting; to reach phpMyAdmin from another machine, choose the IP in the instance settings (#587)
656
+ * (@Schimi1983) PostgreSQL: text values, datapoint IDs and sources are written as escape string literals (`E'...'`), so a backslash can no longer end a value early when `standard_conforming_strings` is off for the database or the user (#587)
657
+
658
+ ### 4.4.0 (2026-11-05)
659
+ * (@Schimi1983) Booleans are stored the same in all databases: `on`/`yes`/`true`/`1` as true, `off`/`no`/`false`/`0` and an empty text as false, any other text as NULL. Before, PostgreSQL failed the whole batch on such a text or a number, SQLite and MS SQL stored `off` as true. `storeState` says "values are kept, do not send them again" also when its values were written together with others of the same datapoint (#587)
660
+ * (@Schimi1983) Messages are checked before they reach the database: `update`, `delete`, `deleteRange`, `deleteAll`, `storeState`, `getHistory` and `getCounter` refuse an entry without an ID, with a timestamp that is not a point in time, or with a value that does not fit the stored type, and report it in the answer instead of writing it into the SQL. Before, a `deleteRange` with an unparsable `start` deleted the whole history of the datapoint, a `delete` without an ID the history of the first datapoint of the table, a `start` given as a numeric string became `NaN`, and a value with a quote or a quote in a datapoint ID broke the statement (PostgreSQL, SQLite, MSSQL: quotes are now stored as they are instead of being removed, `Infinity` is stored as NULL). `storeState` with a value that is not a number for a numeric datapoint is answered again instead of waiting forever; a list of entries is answered after the last entry was written, with the errors of the entries that failed; a message with an unexpected shape no longer stops the adapter; "Maximum concurrent connections" of 0 no longer blocks every write (#587)
661
+ * (@Schimi1983) MySQL: if the server's `sql_mode` contains `NO_BACKSLASH_ESCAPES`, the adapter removes it for its own connections and says so in the log - with that mode, values with `'` or `\` cannot be stored safely. The server's setting and other clients are not changed. Booleans: `on`/`yes`/`true`/`1` are stored as true, `off`/`no`/`false`/`0` and an empty text as false, any other text as NULL instead of true; a number is true unless it is 0 (#587)
662
+ * (@Schimi1983) Stopping with many datapoints no longer loses values: the buffers of all datapoints are written at once instead of 50 per second, which did not finish within the 10 s stop timeout beyond about 450 datapoints. SQLite: buffered values of more than 100 datapoints no longer hit the task limit ("Cannot queue new requests"), a datapoint has one queued insert that takes further values (#587)
663
+ * (@Schimi1983) MySQL: values, datapoint IDs and sources are passed as bound parameters instead of being inlined. Text values keep their single quotes (`it's` was stored as `its`), a value ending with a backslash no longer makes the whole batch fail, and the `delete`/`update`/`storeState` messages cannot inject SQL any more. `NaN`/`Infinity` are stored as NULL instead of failing the batch (#587)
664
+ * (copilot) Adapter requires node.js >= 22.19.0 now
665
+ * (@GermanBluefox) Fixed: values stored without `from` were missing in `getHistory` with `from: true`, e.g. in the history data of admin
666
+ * (@Schimi1983) A failed write is no longer silently dropped: the error is passed on, so `storeState` reports it instead of `success: true`. If the database was not reachable, the values are kept and written with the next write of the datapoint (at most 2000 per datapoint, the oldest are dropped first, with a warning). Pooled connections that were idle for more than 60 s are closed and replaced, so a server-side `wait_timeout` no longer resets them; the warning "SQL connection lost" every few minutes on hosted databases is gone (#587)
667
+ * (@GermanBluefox) The values kept while the database is not reachable are also limited to 200000 for all datapoints together (about 70 MB), so a long outage with many datapoints can no longer exhaust the memory. The warning about them is one line per minute for all datapoints instead of one per datapoint, and the error of `storeState` says when the values were kept, so they are not sent twice (#587)
668
+ * (@GermanBluefox) Data browser: the values of a datapoint can be exported as CSV (e.g. for Excel) or as JSON (the format of `storeState`) for the selected time range. `getRawEntries` returns up to 5000 entries per call and accepts `noTotal` to skip the count
669
+ * (@GermanBluefox) Data browser: PostgreSQL and MS SQL showed the time of a value as a bare number, because `getRawEntries` returned `ts` as string there
670
+ * (@GermanBluefox) MySQL/MariaDB and MS SQL: datapoints whose IDs differ only in case (e.g. `alias.0.Licht` and `alias.0.licht`) or by trailing spaces no longer write into one series with the type of the first one. The second one gets its own row from now on; values that were already mixed stay where they are (#588)
671
+ * (@GermanBluefox) MS SQL: `@azure/msal-node`, a dependency of the driver, was updated to 7.2.0 because of CVE-2026-109461 (GHSA-xcx6-jx8p-x3h5). It concerns the Azure authorization code flow, which the adapter does not use
672
+
622
673
  ### 4.3.0 (2026-10-29)
623
674
  * (@GermanBluefox) `getHistory` accepts `intervalBorders`: the client can send the borders of the intervals itself, e.g. the local days of a chart. With `count` or `step` every interval after a switch of the daylight saving time ended an hour away from the midnight, so a value written at 23:59:59 was shown on the next day (ioBroker/ioBroker.echarts#1311)
624
675
  * (@Schimi1983) Fixed every write failing with "Can't add new command when connection is in closed state" until a restart: a connection the server closed while a statement was running was handed out again, because mysql2 reports that only to the statement and not as a connection error. Such a connection is also no longer handed to a write that waits for a free connection, and the reconnect is logged as a warning in this case too (#587)
@@ -653,16 +704,6 @@ sendTo('sql.0', 'getEnabledDPs', {}, function (result) {
653
704
  * (@GermanBluefox) Fixed crash (UNCAUGHT_EXCEPTION) when the database server closes the connection: the driver's `error` event had no listener (#527)
654
705
  * (@GermanBluefox) A connection that the server dropped is now replaced instead of being handed out again
655
706
 
656
- ### 4.1.6 (2026-10-01)
657
- * (@DutchmanNL) Fixed `getCounter` on PostgreSQL: the queries used MySQL-style backtick quoting
658
- * (@DutchmanNL) Fixed `getCounter` on SQLite: `ORDER BY`/`LIMIT` is not allowed on a compound-select member
659
- * (@DutchmanNL) Fixed `getCounter` on MS SQL: the counter subquery filtered on `ts_number` instead of `ts_counter`
660
- * (@GermanBluefox) `getCounter` now sorts in the outer query on all dialects, so the row order no longer depends on the query plan
661
- * (@DutchmanNL) Added `getCounter` test coverage for all four dialects
662
-
663
- ### 4.1.5 (2026-08-28)
664
- * (@GermanBluefox) Updated packages
665
-
666
707
  [Older changelogs can be found there](CHANGELOG_OLD.md)
667
708
 
668
709
  ## License
@@ -1 +1 @@
1
- import{An as e,Bn as t,En as n,Gt as r,H as i,Jr as a,Jt as o,Kt as s,L as c,O as l,On as u,Ot as d,Tn as f,Ut as p,Wt as m,Xr as h,Yr as g,Yt as _,Zt as v,an as y,cn as b,en as x,f as S,fn as C,gn as w,hn as T,mn as E,pn as D,qt as O,rn as k,sn as A,tn as j,xn as M}from"./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__233965516817701__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-D_KAxrKJ.js";import{t as N}from"./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__233965516817701__loadShare__shared-CdBNI0v_.js";import{t as P}from"./DataBrowser-CXd6Wilm.js";function F(e){if(e==null)return`—`;let t=[`B`,`KiB`,`MiB`,`GiB`,`TiB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${r===0?n:n.toFixed(1)} ${t[r]}`}function I(e){return e?new Date(e).toLocaleString():`—`}var L={active:`success`,loggingDisabled:`warning`,objectMissing:`error`},R={active:`sql_status_active`,loggingDisabled:`sql_status_disabled`,objectMissing:`sql_status_missing`},z={DataBrowser:P,Statistics:class extends N{constructor(e){super(e),Object.assign(this.state,{stats:null,summary:null,loading:!1,errorText:``,filter:``,sortField:`count`,sortAsc:!1,preview:null,includeDisabled:!1,deleting:!1,doneText:``})}async componentDidMount(){await super.componentDidMount(),this.props.alive&&await this.load()}async componentDidUpdate(e){this.props.alive&&!e.alive&&!this.state.stats&&await this.load()}get instance(){return`${this.props.oContext.adapterName}.${this.props.oContext.instance}`}async sendToInstance(e,t){let n=await this.props.oContext.socket.sendTo(this.instance,e,t);if(n!=null&&n.error)throw Error(n.error);return n}async load(){this.setState({loading:!0,errorText:``,doneText:``});try{let e=await this.sendToInstance(`getDpStatistics`,{});this.setState({stats:(e==null?void 0:e.result)||[],summary:(e==null?void 0:e.summary)||null,loading:!1})}catch(e){this.setState({loading:!1,stats:[],summary:null,errorText:e.message})}}async requestPreview(e){this.setState({loading:!0,errorText:``});try{let t=await this.sendToInstance(`cleanupOrphaned`,{scope:{objectMissing:!0,loggingDisabled:e}});this.setState({loading:!1,includeDisabled:e,preview:{datapoints:t.datapoints,rows:t.rows,estimatedBytes:t.estimatedBytes,items:t.items||[]}})}catch(e){this.setState({loading:!1,errorText:e.message})}}async confirmCleanup(){this.setState({deleting:!0,errorText:``});try{let e=await this.sendToInstance(`cleanupOrphaned`,{scope:{objectMissing:!0,loggingDisabled:this.state.includeDisabled},confirm:!0});this.setState({deleting:!1,preview:null,doneText:S.t(`sql_cleanup_done`,e.deleted.rows,e.deleted.datapoints)},()=>void this.load())}catch(e){this.setState({deleting:!1,errorText:e.message})}}sortedStats(){let{stats:e,filter:t,sortField:n,sortAsc:r}=this.state,i=t.trim().toLowerCase(),a=(e||[]).filter(e=>!i||e.id.toLowerCase().includes(i)),o=r?1:-1;return a.sort((e,t)=>{let r=e[n],i=t[n];return r===i?e.id>t.id?1:e.id<t.id?-1:0:r==null?1:i==null?-1:(r>i?1:-1)*o})}renderSortLabel(e,t){return g(_,{active:this.state.sortField===e,direction:this.state.sortField===e&&this.state.sortAsc?`asc`:`desc`,onClick:()=>this.setState({sortField:e,sortAsc:this.state.sortField!==e||!this.state.sortAsc}),children:S.t(t)})}renderSummary(){let{summary:e}=this.state;if(!e)return null;let t=e.byStatus.objectMissing,n=e.byStatus.loggingDisabled;return h(k,{sx:{display:`flex`,gap:2,flexWrap:`wrap`,alignItems:`center`,mb:1},children:[g(j,{variant:`body2`,children:S.t(`sql_summary_total`,e.datapoints,e.rows,F(e.estimatedBytes))}),!!t.datapoints&&g(b,{color:`error`,size:`small`,label:S.t(`sql_summary_missing`,t.datapoints,t.rows)}),!!n.datapoints&&g(b,{color:`warning`,size:`small`,label:S.t(`sql_summary_disabled`,n.datapoints,n.rows)})]})}renderConfirmDialog(){let{preview:e,includeDisabled:n,deleting:u}=this.state;return e?h(C,{open:!0,onClose:()=>!u&&this.setState({preview:null}),maxWidth:`md`,fullWidth:!0,children:[g(w,{children:S.t(`sql_cleanup_confirm_title`)}),g(E,{children:e.datapoints?h(a,{children:[g(T,{sx:{mb:1},children:S.t(`sql_cleanup_confirm_text`,e.datapoints,e.rows,F(e.estimatedBytes))}),g(s,{component:t,sx:{maxHeight:320},children:h(p,{size:`small`,stickyHeader:!0,children:[g(O,{children:h(o,{children:[g(r,{children:S.t(`sql_col_id`)}),g(r,{children:S.t(`sql_col_status`)}),g(r,{align:`right`,children:S.t(`sql_col_count`)}),g(r,{align:`right`,children:S.t(`sql_col_size`)})]})}),g(m,{children:e.items.map(e=>h(o,{children:[g(r,{sx:{wordBreak:`break-all`},children:e.id}),g(r,{children:g(b,{size:`small`,color:L[e.status],label:S.t(R[e.status])})}),g(r,{align:`right`,children:e.count.toLocaleString()}),g(r,{align:`right`,children:F(e.estimatedBytes)})]},e.index))})]})}),n&&g(f,{severity:`warning`,icon:g(l,{}),sx:{mt:1},children:S.t(`sql_cleanup_disabled_warning`)})]}):g(T,{children:S.t(`sql_cleanup_nothing`)})}),h(D,{children:[g(y,{onClick:()=>this.setState({preview:null}),disabled:u,startIcon:g(c,{}),children:S.t(`sql_cancel`)}),g(y,{variant:`contained`,color:`error`,disabled:u||!e.datapoints,startIcon:g(i,{}),onClick:()=>void this.confirmCleanup(),children:S.t(`sql_cleanup_delete`)})]})]}):null}renderItem(){if(!this.props.alive)return g(f,{severity:`info`,children:S.t(`sql_instance_not_running`)});let a=this.sortedStats();return h(k,{sx:{width:`100%`},children:[h(k,{sx:{display:`flex`,gap:1,alignItems:`center`,flexWrap:`wrap`,mb:1},children:[g(v,{variant:`standard`,size:`small`,value:this.state.filter,placeholder:S.t(`sql_filter`),onChange:e=>this.setState({filter:e.target.value}),slotProps:{input:{endAdornment:this.state.filter?g(u,{position:`end`,children:g(n,{size:`small`,onClick:()=>this.setState({filter:``}),children:g(c,{})})}):null}}}),g(x,{title:S.t(`sql_reload`),children:g(n,{onClick:()=>void this.load(),disabled:this.state.loading,children:g(d,{})})}),g(k,{sx:{flexGrow:1}}),g(M,{control:g(A,{checked:this.state.includeDisabled,onChange:e=>this.setState({includeDisabled:e.target.checked})}),label:S.t(`sql_include_disabled`)}),g(y,{variant:`contained`,color:`error`,startIcon:g(i,{}),disabled:this.state.loading,onClick:()=>void this.requestPreview(this.state.includeDisabled),children:S.t(`sql_cleanup`)})]}),this.state.loading&&g(e,{}),!!this.state.errorText&&g(f,{severity:`error`,sx:{mb:1},onClose:()=>this.setState({errorText:``}),children:this.state.errorText}),!!this.state.doneText&&g(f,{severity:`success`,sx:{mb:1},onClose:()=>this.setState({doneText:``}),children:this.state.doneText}),this.renderSummary(),g(s,{component:t,children:h(p,{size:`small`,stickyHeader:!0,children:[g(O,{children:h(o,{children:[g(r,{children:this.renderSortLabel(`id`,`sql_col_id`)}),g(r,{children:S.t(`sql_col_type`)}),g(r,{children:this.renderSortLabel(`status`,`sql_col_status`)}),g(r,{align:`right`,children:this.renderSortLabel(`count`,`sql_col_count`)}),g(r,{align:`right`,children:this.renderSortLabel(`estimatedBytes`,`sql_col_size`)}),g(r,{children:S.t(`sql_col_first`)}),g(r,{children:this.renderSortLabel(`lastTs`,`sql_col_last`)})]})}),h(m,{children:[a.map(e=>h(o,{hover:!0,children:[g(r,{sx:{wordBreak:`break-all`},children:e.id}),g(r,{children:e.type||`—`}),g(r,{children:g(b,{size:`small`,color:L[e.status],label:S.t(R[e.status])})}),g(r,{align:`right`,children:e.count.toLocaleString()}),g(r,{align:`right`,children:F(e.estimatedBytes)}),g(r,{children:I(e.firstTs)}),g(r,{children:I(e.lastTs)})]},e.index)),!a.length&&!this.state.loading&&g(o,{children:g(r,{colSpan:7,children:g(j,{variant:`body2`,sx:{opacity:.7},children:S.t(this.state.filter?`sql_no_data`:`sql_no_datapoints`)})})})]})]})}),g(j,{variant:`caption`,sx:{display:`block`,mt:1,opacity:.7},children:S.t(`sql_size_is_estimate`)}),this.renderConfirmDialog()]})}}};export{z as default};
1
+ import{An as e,Bn as t,En as n,Gt as r,H as i,Jr as a,Jt as o,Kt as s,L as c,O as l,On as u,Ot as d,Tn as f,Ut as p,Wt as m,Xr as h,Yr as g,Yt as _,Zt as v,an as y,cn as b,en as x,f as S,fn as C,gn as w,hn as T,mn as E,pn as D,qt as O,rn as k,sn as A,tn as j,xn as M}from"./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__264649249385412__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-DiZBpJW2.js";import{t as N}from"./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__264649249385412__loadShare__shared-DmziGsfK.js";import{t as P}from"./DataBrowser-DTTVoTBj.js";function F(e){if(e==null)return`—`;let t=[`B`,`KiB`,`MiB`,`GiB`,`TiB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${r===0?n:n.toFixed(1)} ${t[r]}`}function I(e){return e?new Date(e).toLocaleString():`—`}var L={active:`success`,loggingDisabled:`warning`,objectMissing:`error`},R={active:`sql_status_active`,loggingDisabled:`sql_status_disabled`,objectMissing:`sql_status_missing`},z={DataBrowser:P,Statistics:class extends N{constructor(e){super(e),Object.assign(this.state,{stats:null,summary:null,loading:!1,errorText:``,filter:``,sortField:`count`,sortAsc:!1,preview:null,includeDisabled:!1,deleting:!1,doneText:``})}async componentDidMount(){await super.componentDidMount(),this.props.alive&&await this.load()}async componentDidUpdate(e){this.props.alive&&!e.alive&&!this.state.stats&&await this.load()}get instance(){return`${this.props.oContext.adapterName}.${this.props.oContext.instance}`}async sendToInstance(e,t){let n=await this.props.oContext.socket.sendTo(this.instance,e,t);if(n!=null&&n.error)throw Error(n.error);return n}async load(){this.setState({loading:!0,errorText:``,doneText:``});try{let e=await this.sendToInstance(`getDpStatistics`,{});this.setState({stats:(e==null?void 0:e.result)||[],summary:(e==null?void 0:e.summary)||null,loading:!1})}catch(e){this.setState({loading:!1,stats:[],summary:null,errorText:e.message})}}async requestPreview(e){this.setState({loading:!0,errorText:``});try{let t=await this.sendToInstance(`cleanupOrphaned`,{scope:{objectMissing:!0,loggingDisabled:e}});this.setState({loading:!1,includeDisabled:e,preview:{datapoints:t.datapoints,rows:t.rows,estimatedBytes:t.estimatedBytes,items:t.items||[]}})}catch(e){this.setState({loading:!1,errorText:e.message})}}async confirmCleanup(){this.setState({deleting:!0,errorText:``});try{let e=await this.sendToInstance(`cleanupOrphaned`,{scope:{objectMissing:!0,loggingDisabled:this.state.includeDisabled},confirm:!0});this.setState({deleting:!1,preview:null,doneText:S.t(`sql_cleanup_done`,e.deleted.rows,e.deleted.datapoints)},()=>void this.load())}catch(e){this.setState({deleting:!1,errorText:e.message})}}sortedStats(){let{stats:e,filter:t,sortField:n,sortAsc:r}=this.state,i=t.trim().toLowerCase(),a=(e||[]).filter(e=>!i||e.id.toLowerCase().includes(i)),o=r?1:-1;return a.sort((e,t)=>{let r=e[n],i=t[n];return r===i?e.id>t.id?1:e.id<t.id?-1:0:r==null?1:i==null?-1:(r>i?1:-1)*o})}renderSortLabel(e,t){return g(_,{active:this.state.sortField===e,direction:this.state.sortField===e&&this.state.sortAsc?`asc`:`desc`,onClick:()=>this.setState({sortField:e,sortAsc:this.state.sortField!==e||!this.state.sortAsc}),children:S.t(t)})}renderSummary(){let{summary:e}=this.state;if(!e)return null;let t=e.byStatus.objectMissing,n=e.byStatus.loggingDisabled;return h(k,{sx:{display:`flex`,gap:2,flexWrap:`wrap`,alignItems:`center`,mb:1},children:[g(j,{variant:`body2`,children:S.t(`sql_summary_total`,e.datapoints,e.rows,F(e.estimatedBytes))}),!!t.datapoints&&g(b,{color:`error`,size:`small`,label:S.t(`sql_summary_missing`,t.datapoints,t.rows)}),!!n.datapoints&&g(b,{color:`warning`,size:`small`,label:S.t(`sql_summary_disabled`,n.datapoints,n.rows)})]})}renderConfirmDialog(){let{preview:e,includeDisabled:n,deleting:u}=this.state;return e?h(C,{open:!0,onClose:()=>!u&&this.setState({preview:null}),maxWidth:`md`,fullWidth:!0,children:[g(w,{children:S.t(`sql_cleanup_confirm_title`)}),g(E,{children:e.datapoints?h(a,{children:[g(T,{sx:{mb:1},children:S.t(`sql_cleanup_confirm_text`,e.datapoints,e.rows,F(e.estimatedBytes))}),g(s,{component:t,sx:{maxHeight:320},children:h(p,{size:`small`,stickyHeader:!0,children:[g(O,{children:h(o,{children:[g(r,{children:S.t(`sql_col_id`)}),g(r,{children:S.t(`sql_col_status`)}),g(r,{align:`right`,children:S.t(`sql_col_count`)}),g(r,{align:`right`,children:S.t(`sql_col_size`)})]})}),g(m,{children:e.items.map(e=>h(o,{children:[g(r,{sx:{wordBreak:`break-all`},children:e.id}),g(r,{children:g(b,{size:`small`,color:L[e.status],label:S.t(R[e.status])})}),g(r,{align:`right`,children:e.count.toLocaleString()}),g(r,{align:`right`,children:F(e.estimatedBytes)})]},e.index))})]})}),n&&g(f,{severity:`warning`,icon:g(l,{}),sx:{mt:1},children:S.t(`sql_cleanup_disabled_warning`)})]}):g(T,{children:S.t(`sql_cleanup_nothing`)})}),h(D,{children:[g(y,{onClick:()=>this.setState({preview:null}),disabled:u,startIcon:g(c,{}),children:S.t(`sql_cancel`)}),g(y,{variant:`contained`,color:`error`,disabled:u||!e.datapoints,startIcon:g(i,{}),onClick:()=>void this.confirmCleanup(),children:S.t(`sql_cleanup_delete`)})]})]}):null}renderItem(){if(!this.props.alive)return g(f,{severity:`info`,children:S.t(`sql_instance_not_running`)});let a=this.sortedStats();return h(k,{sx:{width:`100%`},children:[h(k,{sx:{display:`flex`,gap:1,alignItems:`center`,flexWrap:`wrap`,mb:1},children:[g(v,{variant:`standard`,size:`small`,value:this.state.filter,placeholder:S.t(`sql_filter`),onChange:e=>this.setState({filter:e.target.value}),slotProps:{input:{endAdornment:this.state.filter?g(u,{position:`end`,children:g(n,{size:`small`,onClick:()=>this.setState({filter:``}),children:g(c,{})})}):null}}}),g(x,{title:S.t(`sql_reload`),children:g(n,{onClick:()=>void this.load(),disabled:this.state.loading,children:g(d,{})})}),g(k,{sx:{flexGrow:1}}),g(M,{control:g(A,{checked:this.state.includeDisabled,onChange:e=>this.setState({includeDisabled:e.target.checked})}),label:S.t(`sql_include_disabled`)}),g(y,{variant:`contained`,color:`error`,startIcon:g(i,{}),disabled:this.state.loading,onClick:()=>void this.requestPreview(this.state.includeDisabled),children:S.t(`sql_cleanup`)})]}),this.state.loading&&g(e,{}),!!this.state.errorText&&g(f,{severity:`error`,sx:{mb:1},onClose:()=>this.setState({errorText:``}),children:this.state.errorText}),!!this.state.doneText&&g(f,{severity:`success`,sx:{mb:1},onClose:()=>this.setState({doneText:``}),children:this.state.doneText}),this.renderSummary(),g(s,{component:t,children:h(p,{size:`small`,stickyHeader:!0,children:[g(O,{children:h(o,{children:[g(r,{children:this.renderSortLabel(`id`,`sql_col_id`)}),g(r,{children:S.t(`sql_col_type`)}),g(r,{children:this.renderSortLabel(`status`,`sql_col_status`)}),g(r,{align:`right`,children:this.renderSortLabel(`count`,`sql_col_count`)}),g(r,{align:`right`,children:this.renderSortLabel(`estimatedBytes`,`sql_col_size`)}),g(r,{children:S.t(`sql_col_first`)}),g(r,{children:this.renderSortLabel(`lastTs`,`sql_col_last`)})]})}),h(m,{children:[a.map(e=>h(o,{hover:!0,children:[g(r,{sx:{wordBreak:`break-all`},children:e.id}),g(r,{children:e.type||`—`}),g(r,{children:g(b,{size:`small`,color:L[e.status],label:S.t(R[e.status])})}),g(r,{align:`right`,children:e.count.toLocaleString()}),g(r,{align:`right`,children:F(e.estimatedBytes)}),g(r,{children:I(e.firstTs)}),g(r,{children:I(e.lastTs)})]},e.index)),!a.length&&!this.state.loading&&g(o,{children:g(r,{colSpan:7,children:g(j,{variant:`body2`,sx:{opacity:.7},children:S.t(this.state.filter?`sql_no_data`:`sql_no_datapoints`)})})})]})]})}),g(j,{variant:`caption`,sx:{display:`block`,mt:1,opacity:.7},children:S.t(`sql_size_is_estimate`)}),this.renderConfirmDialog()]})}}};export{z as default};
@@ -0,0 +1,7 @@
1
+ import{An as e,Bn as t,Cr as n,En as r,F as i,Gt as a,I as o,Jr as s,Jt as c,L as l,Ln as u,Mn as d,On as f,Ot as p,Pn as m,Pt as h,Tn as g,Un as _,Ut as v,V as y,W as b,Wt as x,Xr as S,Y as C,Yr as w,Zt as T,an as E,b as D,en as O,f as k,fn as A,ft as j,gn as M,gt as N,jn as P,jt as F,mn as I,pn as L,qt as R,rn as z,sn as B,tn as V}from"./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__264649249385412__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-DiZBpJW2.js";import{t as H}from"./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__264649249385412__loadShare__shared-DmziGsfK.js";var U=5e3,W=U*.75,G={root:{display:`flex`,width:`100%`,height:`calc(100vh - 220px)`,minHeight:400,gap:8},list:{width:320,minWidth:220,display:`flex`,flexDirection:`column`,overflow:`hidden`},filterField:{padding:8,flexShrink:0},listItems:{overflowY:`auto`,flexGrow:1,minHeight:0},data:{flexGrow:1,display:`flex`,flexDirection:`column`,overflow:`hidden`},toolbar:{display:`flex`,alignItems:`center`,flexWrap:`nowrap`,gap:8,padding:8,overflow:`hidden`,flexShrink:0},title:{display:`flex`,flexDirection:`column`,flexGrow:1,minWidth:60,overflow:`hidden`},titleId:{fontWeight:`bold`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},titleName:{fontSize:`smaller`,opacity:.7,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},dateField:{width:200,flexShrink:0},table:{overflowY:`auto`,flexGrow:1,minHeight:0},nowrap:{whiteSpace:`nowrap`},pageInfo:{whiteSpace:`nowrap`,flexShrink:0},grow:{flexGrow:1}},K=e=>({"& input::-webkit-calendar-picker-indicator":{filter:e.palette.mode===`dark`?`invert(1)`:`none`,cursor:`pointer`}});function q(e){let t=new Date(e);if(isNaN(t.getTime()))return String(e);let n=(e,t)=>e.toString().padStart(t||2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}.${n(t.getMilliseconds(),3)}`}function J(e){let t=e=>e.toString().padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function Y(e){let t=e=>e.toString().padStart(2,`0`);return`${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}`}function X(e){if(!e)return;let t=new Date(e).getTime();return isNaN(t)?void 0:t}function Z(){let e=k.getLanguage();return e===`en`||e===`zh-cn`?{separator:`,`,decimal:`.`}:{separator:`;`,decimal:`,`}}function Q(e,t){return e.includes(t)||e.includes(`"`)||e.includes(`
2
+ `)||e.includes(`\r`)?`"${e.replace(/"/g,`""`)}"`:e}var $=[`ts`,`time`,`val`,`ack`,`q`,`from`],ee=``;function te(e,t){return{ts:e.ts,val:t===`Boolean`&&typeof e.val==`number`?!!e.val:e.val,ack:e.ack===void 0||e.ack===null?e.ack:!!e.ack,q:e.q,from:e.from}}function ne(e,t,n){let r=``;return e.val!==null&&e.val!==void 0&&(r=typeof e.val==`number`&&n===`,`?e.val.toString().replace(`.`,`,`):e.val.toString()),[e.ts.toString(),q(e.ts),r,e.ack===void 0||e.ack===null?``:(!!e.ack).toString(),e.q===void 0||e.q===null?``:e.q.toString(),e.from||``].map(e=>Q(e,t)).join(t)}function re(e,t,n,r){let i=[e.replace(/[^\w.-]+/g,`_`)];return t!==void 0&&i.push(J(new Date(t))),n!==void 0&&i.push(J(new Date(n))),`${i.join(`_`)}.${r}`}function ie(e,t,n){let r=URL.createObjectURL(new Blob(e,{type:n})),i=document.createElement(`a`);i.href=r,i.download=t,document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(r),6e4)}var ae=class extends H{constructor(e){super(e),n(this,`exportCancelled`,!1),this.state={...this.state,points:null,names:{},filter:``,selected:null,rows:[],total:0,page:0,rowsPerPage:100,sort:`desc`,start:``,end:``,checked:[],loadingPoints:!1,loadingRows:!1,errorText:``,entryDialog:null,exportDialog:null,confirmText:``,confirmAction:null}}componentWillUnmount(){this.exportCancelled=!0,super.componentWillUnmount()}async componentDidMount(){await super.componentDidMount(),this.props.alive&&await this.loadDatapoints()}async componentDidUpdate(e){this.props.alive&&!e.alive&&!this.state.points&&await this.loadDatapoints()}get instance(){return`${this.props.oContext.adapterName}.${this.props.oContext.instance}`}async sendToInstance(e,t){let n=await this.props.oContext.socket.sendTo(this.instance,e,t);if(n!=null&&n.error)throw Error(n.error);return n}async loadDatapoints(){this.setState({loadingPoints:!0,errorText:``});try{let e=await this.sendToInstance(`getDatapoints`,{}),t=(e==null?void 0:e.result)||[];this.setState({points:t,loadingPoints:!1},()=>void this.loadNames(t))}catch(e){this.setState({loadingPoints:!1,points:[],errorText:e.message})}}async loadNames(e){if(e.length)try{let t=await this.props.oContext.socket.getObjectsById(e.map(e=>e.id)),n={};for(let r of e){let e=t==null?void 0:t[r.id],i=e?D.getObjectNameFromObj(e,null,{language:k.getLanguage()}):``;i&&i!==r.id&&(n[r.id]=i)}this.setState({names:n})}catch(e){console.warn(`Cannot read the names of the objects: ${e.message}`)}}async loadRows(e){let t=this.state.selected;if(t){this.setState(t=>({loadingRows:!0,errorText:e?t.errorText:``}));try{let e=await this.sendToInstance(`getRawEntries`,{id:t.id,start:X(this.state.start),end:X(this.state.end),limit:this.state.rowsPerPage,offset:this.state.page*this.state.rowsPerPage,sort:this.state.sort});this.setState({rows:(e==null?void 0:e.result)||[],total:(e==null?void 0:e.total)||0,checked:[],loadingRows:!1})}catch(e){this.setState({rows:[],total:0,loadingRows:!1,errorText:e.message})}}}selectDatapoint(e){this.setState({selected:e,page:0,rows:[],total:0,checked:[]},()=>void this.loadRows())}parseValue(e){var t,n;if(e===``)return null;if(((t=this.state.selected)==null?void 0:t.type)===`Number`){let t=parseFloat(e.replace(`,`,`.`));return isNaN(t)?0:t}return((n=this.state.selected)==null?void 0:n.type)===`Boolean`?e===`true`||e===`1`:e}async saveEntry(){let e=this.state.entryDialog,t=this.state.selected;if(!e||!t)return;let n=parseInt(e.ts,10);if(!n){this.setState({errorText:`Invalid timestamp`});return}let r={ts:n,val:this.parseValue(e.val),ack:e.ack,q:parseInt(e.q,10)||0};this.setState({entryDialog:null,loadingRows:!0});try{e.original?await this.sendToInstance(`update`,{id:t.id,state:r}):await this.sendToInstance(`storeState`,{id:t.id,state:r})}catch(e){this.setState({errorText:e.message})}await this.loadRows(!0)}async deleteEntries(e){let t=this.state.selected;if(t&&e.length){this.setState({loadingRows:!0});try{e.length===1?await this.sendToInstance(`delete`,{id:t.id,ts:e[0]}):await this.sendToInstance(`delete`,e.map(e=>({id:t.id,ts:e})))}catch(e){this.setState({errorText:e.message})}await this.loadRows(!0)}}async readExportPage(e,t,n,r){let i=await this.sendToInstance(`getRawEntries`,{id:e,start:t,end:n,sort:`asc`,limit:U,offset:r,noTotal:!0}),a=(i==null?void 0:i.result)||[];return{entries:a,full:!!a.length&&a.length>=((i==null?void 0:i.limit)||U)}}async exportWindowByOffset(e,t,n,r){let i=0;for(;!this.exportCancelled;){let{entries:a,full:o}=await this.readExportPage(e,t,n,i);if(r(a),i+=a.length,!o)return}}async exportEntries(){let e=this.state.selected,t=this.state.exportDialog;if(!e||!t)return;let n=X(this.state.start),r=X(this.state.end),{format:i,separator:a,decimal:o}=t;this.exportCancelled=!1;let s={...t,running:!0,exported:0,total:0,info:``,error:``};this.setState({exportDialog:s});let c=i===`csv`?[`${ee}${$.join(a)}\r\n`]:[`[`],l=0,u=t=>{if(this.exportCancelled||!t.length)return;let n=t.map(t=>te(t,e.type));i===`csv`?c.push(`${n.map(e=>ne(e,a,o)).join(`\r
3
+ `)}\r\n`):c.push(`${l?`,`:``}\n${n.map(e=>JSON.stringify(e)).join(`,
4
+ `)}`),l+=n.length,s={...s,exported:l},this.setState({exportDialog:s})};try{var d;let t=await this.sendToInstance(`getRawEntries`,{id:e.id,start:n,end:r,sort:`asc`,limit:1,offset:0}),a=t==null||(d=t.result)==null?void 0:d[0];if(this.exportCancelled)return;if(!a){this.setState({exportDialog:{...s,running:!1,info:k.t(`sql_export_nothing`)}});return}let o=t.total||0;s={...s,total:o},this.setState({exportDialog:s});let f=r??Date.now(),p=a.ts,m=Math.max(1,Math.round((f-a.ts+1)*W/Math.max(o,1)));for(;p<=f&&!this.exportCancelled;){let t=Math.min(f,p+m-1),{entries:n,full:r}=await this.readExportPage(e.id,p,t,0);if(!r){u(n),p=t+1;let e=n.length?W/n.length:8;m=Math.max(1,Math.round(m*Math.min(8,Math.max(.125,e))));continue}let i=n[n.length-1].ts;n[0].ts===i?(await this.exportWindowByOffset(e.id,i,i,u),p=i+1):(u(n.filter(e=>e.ts<i)),m=Math.max(1,Math.round((i-p)*W/n.length)),p=i)}if(r===void 0&&!this.exportCancelled&&await this.exportWindowByOffset(e.id,p,void 0,u),this.exportCancelled)return;i===`json`&&c.push(l?`
5
+ ]
6
+ `:`]
7
+ `),ie(c,re(e.id,n,r,i),i===`csv`?`text/csv;charset=utf-8`:`application/json`),this.setState({exportDialog:null})}catch(e){this.exportCancelled||this.setState({exportDialog:{...s,running:!1,error:e.message}})}}renderDatapoints(){let n=this.state.filter.toLowerCase(),i=(this.state.points||[]).filter(e=>{var t;return!n||e.id.toLowerCase().includes(n)||((t=this.state.names[e.id])==null?void 0:t.toLowerCase().includes(n))});return S(t,{style:G.list,children:[w(T,{variant:`standard`,style:G.filterField,value:this.state.filter,onChange:e=>this.setState({filter:e.target.value}),placeholder:k.t(`sql_filter`),slotProps:{input:{startAdornment:w(f,{position:`start`,children:w(F,{})}),endAdornment:this.state.filter?w(f,{position:`end`,children:w(r,{size:`small`,onClick:()=>this.setState({filter:``}),children:w(l,{})})}):null}}}),this.state.loadingPoints?w(e,{}):null,S(P,{dense:!0,style:G.listItems,children:[i.map(e=>{var t;return w(d,{selected:((t=this.state.selected)==null?void 0:t.id)===e.id,onClick:()=>this.selectDatapoint(e),sx:e=>({"&.Mui-selected":{backgroundColor:e.palette.primary.main,color:e.palette.primary.contrastText,"& .MuiListItemText-secondary":{color:e.palette.primary.contrastText,opacity:.8},"&:hover":{backgroundColor:e.palette.primary.dark}}}),children:w(m,{primary:e.id,secondary:S(s,{children:[this.state.names[e.id]?w(`b`,{children:this.state.names[e.id]}):null,this.state.names[e.id]?` `:``,`[${e.type||`?`}]`]}),slotProps:{primary:{style:{wordBreak:`break-all`}},secondary:{style:{wordBreak:`break-word`}}}})},e.id)}),!i.length&&!this.state.loadingPoints?w(V,{style:{padding:16,opacity:.7},children:k.t(this.state.filter?`sql_no_data`:`sql_no_datapoints`)}):null]})]})}renderToolbar(){var e,t;let{page:n,rowsPerPage:a,total:s}=this.state,c=s?n*a+1:0,l=Math.min((n+1)*a,s);return S(`div`,{style:G.toolbar,children:[S(`div`,{style:G.title,children:[w(O,{title:((e=this.state.selected)==null?void 0:e.id)||``,children:w(`span`,{style:G.titleId,children:(t=this.state.selected)==null?void 0:t.id})}),this.state.selected&&this.state.names[this.state.selected.id]?w(`span`,{style:G.titleName,children:this.state.names[this.state.selected.id]}):null]}),w(O,{title:k.t(`sql_range_start`),children:w(T,{variant:`outlined`,size:`small`,style:G.dateField,sx:K,type:`datetime-local`,value:this.state.start,onChange:e=>this.setState({start:e.target.value,page:0},()=>void this.loadRows())})}),w(O,{title:k.t(`sql_range_end`),children:w(T,{variant:`outlined`,size:`small`,style:G.dateField,sx:K,type:`datetime-local`,value:this.state.end,onChange:e=>this.setState({end:e.target.value,page:0},()=>void this.loadRows())})}),w(_,{variant:`outlined`,size:`small`,value:a,onChange:e=>this.setState({rowsPerPage:Number(e.target.value),page:0},()=>void this.loadRows()),children:[50,100,500,1e3].map(e=>w(u,{value:e,children:e},e))}),w(O,{title:k.t(this.state.sort===`desc`?`sql_sort_desc`:`sql_sort_asc`),children:w(r,{size:`small`,onClick:()=>this.setState({sort:this.state.sort===`desc`?`asc`:`desc`,page:0},()=>void this.loadRows()),children:this.state.sort===`desc`?w(j,{}):w(N,{})})}),w(V,{style:G.pageInfo,children:k.t(`sql_page`,c.toString(),l.toString(),s.toString())}),w(r,{size:`small`,disabled:!n,onClick:()=>this.setState({page:n-1},()=>void this.loadRows()),children:w(i,{})}),w(r,{size:`small`,disabled:l>=s,onClick:()=>this.setState({page:n+1},()=>void this.loadRows()),children:w(o,{})}),w(O,{title:k.t(`sql_refresh`),children:w(r,{size:`small`,onClick:()=>void this.loadRows(),children:w(p,{})})}),w(O,{title:k.t(`sql_export`),children:w(`span`,{children:w(r,{size:`small`,disabled:!s,onClick:()=>this.setState({exportDialog:{format:`csv`,...Z(),running:!1,exported:0,total:0,info:``,error:``}}),children:w(C,{})})})}),w(O,{title:k.t(`sql_add`),children:w(r,{size:`small`,color:`primary`,onClick:()=>this.setState({entryDialog:{original:null,ts:Date.now().toString(),val:``,ack:!0,q:`0`}}),children:w(h,{})})}),w(O,{title:k.t(`sql_delete_selected`),children:w(`span`,{children:w(r,{size:`small`,disabled:!this.state.checked.length,onClick:()=>this.setState({confirmText:k.t(`sql_confirm_delete`,this.state.checked.length.toString()),confirmAction:()=>void this.deleteEntries(this.state.checked)}),children:w(y,{})})})})]})}renderTable(){return S(`div`,{style:G.table,children:[S(v,{size:`small`,stickyHeader:!0,children:[w(R,{children:S(c,{children:[w(a,{padding:`checkbox`,children:w(B,{indeterminate:!!this.state.checked.length&&this.state.checked.length<this.state.rows.length,checked:!!this.state.rows.length&&this.state.checked.length===this.state.rows.length,onChange:e=>this.setState({checked:e.target.checked?this.state.rows.map(e=>e.ts):[]})})}),w(a,{children:k.t(`sql_time`)}),w(a,{children:k.t(`sql_value`)}),w(a,{children:k.t(`sql_ack`)}),w(a,{children:k.t(`sql_quality`)}),w(a,{children:k.t(`sql_from`)}),w(a,{})]})}),w(x,{children:this.state.rows.map(e=>S(c,{hover:!0,children:[w(a,{padding:`checkbox`,children:w(B,{checked:this.state.checked.includes(e.ts),onChange:t=>this.setState({checked:t.target.checked?[...this.state.checked,e.ts]:this.state.checked.filter(t=>t!==e.ts)})})}),w(a,{style:G.nowrap,children:w(O,{title:e.ts.toString(),children:w(`span`,{children:q(e.ts)})})}),w(a,{style:{wordBreak:`break-all`},children:e.val===null||e.val===void 0?w(`span`,{style:{opacity:.5},children:`null`}):e.val.toString()}),w(a,{children:e.ack?`✓`:``}),w(a,{children:e.q??``}),w(a,{style:{opacity:.7},children:e.from||``}),S(a,{padding:`none`,children:[w(r,{size:`small`,onClick:()=>this.setState({entryDialog:{original:e,ts:e.ts.toString(),val:e.val===null||e.val===void 0?``:e.val.toString(),ack:!!e.ack,q:(e.q??0).toString()}}),children:w(b,{fontSize:`small`})}),w(r,{size:`small`,onClick:()=>this.setState({confirmText:k.t(`sql_confirm_delete_one`,q(e.ts)),confirmAction:()=>void this.deleteEntries([e.ts])}),children:w(y,{fontSize:`small`})})]})]},e.ts))})]}),!this.state.rows.length&&!this.state.loadingRows?w(V,{style:{padding:16,opacity:.7},children:k.t(`sql_no_data`)}):null]})}renderTimeSelector(e){let t=parseInt(e.ts,10),n=!isNaN(t),r=!!e.original,i=(r,i)=>{let a=new Date(n?t:Date.now()),o=J(a),s=Y(a),c=a.getMilliseconds();if(r===`date`){if(!i)return;o=i}else if(r===`time`){if(!i)return;s=i.length===5?`${i}:00`:i}else c=Math.min(999,Math.max(0,parseInt(i,10)||0));let l=new Date(`${o}T${s}.${c.toString().padStart(3,`0`)}`).getTime();isNaN(l)||this.setState({entryDialog:{...e,ts:l.toString()}})};return S(`div`,{children:[S(`div`,{style:{display:`flex`,gap:8,alignItems:`center`},children:[w(T,{label:k.t(`sql_date`),type:`date`,value:n?J(new Date(t)):``,disabled:r,style:{flexGrow:1},sx:K,slotProps:{inputLabel:{shrink:!0}},onChange:e=>i(`date`,e.target.value)}),w(T,{label:k.t(`sql_time`),type:`time`,value:n?Y(new Date(t)):``,disabled:r,style:{flexGrow:1},sx:K,slotProps:{inputLabel:{shrink:!0},htmlInput:{step:1}},onChange:e=>i(`time`,e.target.value)}),w(T,{label:k.t(`sql_ms`),type:`number`,value:n?new Date(t).getMilliseconds():``,disabled:r,style:{width:100},slotProps:{inputLabel:{shrink:!0},htmlInput:{min:0,max:999}},onChange:e=>i(`ms`,e.target.value)})]}),w(V,{variant:`caption`,style:{opacity:.7},children:n?`${q(t)} · ${t}`:``})]})}renderEntryDialog(){var e;let t=this.state.entryDialog;return t?S(A,{open:!0,maxWidth:`sm`,fullWidth:!0,onClose:()=>this.setState({entryDialog:null}),children:[w(M,{children:k.t(t.original?`sql_save`:`sql_add`)}),S(I,{style:{display:`flex`,flexDirection:`column`,gap:16,paddingTop:8},children:[this.renderTimeSelector(t),((e=this.state.selected)==null?void 0:e.type)===`Boolean`?S(_,{value:t.val===`true`||t.val===`1`?`true`:`false`,onChange:e=>this.setState({entryDialog:{...t,val:e.target.value}}),children:[w(u,{value:`true`,children:`true`}),w(u,{value:`false`,children:`false`})]}):w(T,{label:k.t(`sql_value`),value:t.val,autoFocus:!0,onChange:e=>this.setState({entryDialog:{...t,val:e.target.value}})}),S(`div`,{style:{display:`flex`,alignItems:`center`,gap:16},children:[w(B,{checked:t.ack,onChange:e=>this.setState({entryDialog:{...t,ack:e.target.checked}})}),w(V,{children:k.t(`sql_ack`)}),w(T,{label:k.t(`sql_quality`),value:t.q,type:`number`,onChange:e=>this.setState({entryDialog:{...t,q:e.target.value}})})]})]}),S(L,{children:[w(E,{variant:`contained`,color:`primary`,onClick:()=>void this.saveEntry(),children:k.t(`sql_save`)}),w(E,{variant:`outlined`,onClick:()=>this.setState({entryDialog:null}),children:k.t(`sql_cancel`)})]})]}):null}renderExportDialog(){var t;let n=this.state.exportDialog;if(!n)return null;let r=X(this.state.start),i=X(this.state.end),a=r===void 0&&i===void 0?k.t(`sql_range_all`):`${r===void 0?`…`:q(r)} – ${i===void 0?`…`:q(i)}`,o=n.total?Math.min(100,n.exported/n.total*100):0,s=()=>{this.exportCancelled=!0,this.setState({exportDialog:null})};return S(A,{open:!0,maxWidth:`sm`,fullWidth:!0,onClose:()=>!n.running&&s(),children:[w(M,{children:k.t(`sql_export`)}),S(I,{style:{display:`flex`,flexDirection:`column`,gap:16,paddingTop:8},children:[S(`div`,{children:[w(V,{style:{fontWeight:`bold`,wordBreak:`break-all`},children:(t=this.state.selected)==null?void 0:t.id}),w(V,{variant:`body2`,children:`${k.t(`sql_export_range`)}: ${a}`})]}),S(T,{select:!0,label:k.t(`sql_export_format`),value:n.format,disabled:n.running,onChange:e=>this.setState({exportDialog:{...n,format:e.target.value}}),children:[w(u,{value:`csv`,children:`CSV`}),w(u,{value:`json`,children:`JSON`})]}),n.format===`csv`?S(`div`,{style:{display:`flex`,gap:16},children:[S(T,{select:!0,label:k.t(`sql_export_separator`),value:n.separator,disabled:n.running,style:{flexGrow:1},onChange:e=>this.setState({exportDialog:{...n,separator:e.target.value}}),children:[w(u,{value:`;`,children:k.t(`sql_export_semicolon`)}),w(u,{value:`,`,children:k.t(`sql_export_comma`)}),w(u,{value:` `,children:k.t(`sql_export_tab`)})]}),S(T,{select:!0,label:k.t(`sql_export_decimal`),value:n.decimal,disabled:n.running,style:{flexGrow:1},onChange:e=>this.setState({exportDialog:{...n,decimal:e.target.value}}),children:[w(u,{value:`.`,children:k.t(`sql_export_point`)}),w(u,{value:`,`,children:k.t(`sql_export_comma`)})]})]}):null,w(V,{variant:`body2`,style:{opacity:.7},children:k.t(n.format===`csv`?`sql_export_csv_info`:`sql_export_json_info`)}),n.running?S(`div`,{children:[w(e,{variant:n.total?`determinate`:`indeterminate`,value:o}),w(V,{variant:`caption`,children:k.t(`sql_export_progress`,n.exported.toString(),n.total.toString())})]}):null,n.info?w(g,{severity:`info`,children:n.info}):null,n.error?w(g,{severity:`error`,children:n.error}):null]}),S(L,{children:[w(E,{variant:`contained`,color:`primary`,startIcon:w(C,{}),disabled:n.running,onClick:()=>void this.exportEntries(),children:k.t(`sql_export_start`)}),w(E,{variant:`outlined`,onClick:s,children:k.t(`sql_cancel`)})]})]})}renderConfirmDialog(){return this.state.confirmAction?S(A,{open:!0,onClose:()=>this.setState({confirmText:``,confirmAction:null}),children:[w(M,{children:k.t(`sql_delete`)}),w(I,{children:this.state.confirmText}),S(L,{children:[w(E,{variant:`contained`,color:`error`,startIcon:w(y,{}),onClick:()=>{let e=this.state.confirmAction;this.setState({confirmText:``,confirmAction:null},()=>e==null?void 0:e())},children:k.t(`sql_delete`)}),w(E,{variant:`outlined`,onClick:()=>this.setState({confirmText:``,confirmAction:null}),children:k.t(`sql_cancel`)})]})]}):null}renderItem(){return this.props.alive?S(z,{style:G.root,children:[this.renderDatapoints(),S(t,{style:G.data,children:[this.state.errorText?w(g,{severity:`error`,style:{flexShrink:0},onClose:()=>this.setState({errorText:``}),children:this.state.errorText}):null,this.state.selected?S(s,{children:[this.renderToolbar(),this.state.loadingRows?w(e,{}):null,this.renderTable()]}):w(V,{style:{padding:16,opacity:.7},children:k.t(`sql_select_datapoint`)})]}),this.renderEntryDialog(),this.renderExportDialog(),this.renderConfirmDialog()]}):w(g,{severity:`info`,children:k.t(`sql_instance_not_alive`)})}};export{ae as t};
@@ -1 +1 @@
1
- import{t as e}from"./vite-preload-helper-BbbETgeG.js";import"./dist-B3E7IYuQ.js";var t=e=>{let t=e;for(let e=0;e<5;e++){let e=t==null?void 0:t.default;if(!e||typeof e!=`object`||Object.keys(e).length===0)break;let n=Object.getPrototypeOf(e);if(n!==null&&n!==Object.prototype)break;let r=Object.keys(t).filter(e=>e!=="default").map(e=>t[e]);if(r.length>0&&r.some(e=>e!==void 0))break;t=e}return t},n=(e,t,n,r)=>{var i,a;let o=(i=globalThis.__mf_module_cache__)==null?void 0:i.share,s=t.map(e=>o==null?void 0:o[e]).find(e=>e!==void 0),c=e=>{let t=String(e||``).split(/[^0-9]+/).map(Number),r=String(n||``).split(/[^0-9]+/).map(Number);for(let e=0;e<Math.max(t.length,r.length);e++){if((t[e]||0)<(r[e]||0))return!0;if((t[e]||0)>(r[e]||0))return!1}return!1};if(!c((s==null?void 0:s.version)??(s==null||(a=s.default)==null?void 0:a.version)))for(let t of e){var l,u;let e=o==null?void 0:o[t];if(e===void 0)continue;let n=(e==null?void 0:e.version)??(e==null||(l=e.default)==null?void 0:l.version);if(!(n!==void 0&&c(n))&&(!r||typeof(e==null?void 0:e[r])==`function`||typeof(e==null||(u=e.default)==null?void 0:u[r])==`function`)){let n=typeof(e==null?void 0:e[r])==`function`?e:e==null?void 0:e.default,i=n==null?void 0:n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;if(!r||t.endsWith(`/client`)||!i)return e;let a={};for(let e of[`createRoot`,`hydrateRoot`])a[e]=(...t)=>{i.usingClientEntryPoint=!0;try{return n[e](...t)}finally{i.usingClientEntryPoint=!1}};return{...a,default:a}}}},r={react:async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__233965516817701__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-D_KAxrKJ.js`).then(e=>e.xi),[],import.meta.url),"react/jsx-runtime":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__233965516817701__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__--SURtz9t.js`),[],import.meta.url),"react-dom":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__233965516817701__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-D_KAxrKJ.js`).then(e=>e.gr),[],import.meta.url),"react-dom/client":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__233965516817701__prebuild__react_mf_2_dom_mf_1_client__prebuild__-DKp49xnK.js`),[],import.meta.url),"@mui/material":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__233965516817701__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-D_KAxrKJ.js`).then(e=>e.Kn),[],import.meta.url),"@mui/icons-material":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__233965516817701__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-D_KAxrKJ.js`).then(e=>e.zt),[],import.meta.url),"@iobroker/gui-components":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__233965516817701__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-D_KAxrKJ.js`).then(e=>e.S),[],import.meta.url),"@iobroker/json-config":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__233965516817701__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-CH3Bc0Pg.js`),[],import.meta.url)},i={react:{name:`react`,version:`19.3.1`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i.react;return e.lib?e.lib:(e.loading||=(async()=>{try{let{react:n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"react/jsx-runtime":{name:`react/jsx-runtime`,version:`19.3.1`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`react/jsx-runtime`];if(e.lib)return e.lib;if(e.loading)return e.loading;let a=n([`default:react/jsx-runtime`,`react/jsx-runtime`],[`default:react`,`react`],`19.3.1`,void 0);return a===void 0?(e.loading=(async()=>{try{let{"react/jsx-runtime":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading):(e.lib=function(){return a},e.loaded=!0,e.lib)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"react-dom":{name:`react-dom`,version:`19.3.1`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`react-dom`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"react-dom":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"react-dom/client":{name:`react-dom/client`,version:`19.3.1`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`react-dom/client`];if(e.lib)return e.lib;if(e.loading)return e.loading;let a=n([`default:react-dom/client`,`react-dom/client`,`default:react-dom`,`react-dom`],[`default:react`,`react`],`19.3.1`,`createRoot`);return a===void 0?(e.loading=(async()=>{try{let{"react-dom/client":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading):(e.lib=function(){return a},e.loaded=!0,e.lib)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@mui/material":{name:`@mui/material`,version:`9.5.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`@mui/material`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"@mui/material":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@mui/icons-material":{name:`@mui/icons-material`,version:`9.5.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`@mui/icons-material`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"@mui/icons-material":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@iobroker/gui-components":{name:`@iobroker/gui-components`,version:`10.3.14`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`@iobroker/gui-components`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"@iobroker/gui-components":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@iobroker/json-config":{name:`@iobroker/json-config`,version:`10.1.11`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`@iobroker/json-config`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"@iobroker/json-config":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}}},a=[];export{a as usedRemotes,i as usedShared};
1
+ import{t as e}from"./vite-preload-helper-BbbETgeG.js";import"./dist-ChhOvPa4.js";var t=e=>{let t=e;for(let e=0;e<5;e++){let e=t==null?void 0:t.default;if(!e||typeof e!=`object`||Object.keys(e).length===0)break;let n=Object.getPrototypeOf(e);if(n!==null&&n!==Object.prototype)break;let r=Object.keys(t).filter(e=>e!=="default").map(e=>t[e]);if(r.length>0&&r.some(e=>e!==void 0))break;t=e}return t},n=(e,t,n,r)=>{var i,a;let o=(i=globalThis.__mf_module_cache__)==null?void 0:i.share,s=t.map(e=>o==null?void 0:o[e]).find(e=>e!==void 0),c=e=>{let t=String(e||``).split(/[^0-9]+/).map(Number),r=String(n||``).split(/[^0-9]+/).map(Number);for(let e=0;e<Math.max(t.length,r.length);e++){if((t[e]||0)<(r[e]||0))return!0;if((t[e]||0)>(r[e]||0))return!1}return!1};if(!c((s==null?void 0:s.version)??(s==null||(a=s.default)==null?void 0:a.version)))for(let t of e){var l,u;let e=o==null?void 0:o[t];if(e===void 0)continue;let n=(e==null?void 0:e.version)??(e==null||(l=e.default)==null?void 0:l.version);if(!(n!==void 0&&c(n))&&(!r||typeof(e==null?void 0:e[r])==`function`||typeof(e==null||(u=e.default)==null?void 0:u[r])==`function`)){let n=typeof(e==null?void 0:e[r])==`function`?e:e==null?void 0:e.default,i=n==null?void 0:n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;if(!r||t.endsWith(`/client`)||!i)return e;let a={};for(let e of[`createRoot`,`hydrateRoot`])a[e]=(...t)=>{i.usingClientEntryPoint=!0;try{return n[e](...t)}finally{i.usingClientEntryPoint=!1}};return{...a,default:a}}}},r={react:async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__264649249385412__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-DiZBpJW2.js`).then(e=>e.xi),[],import.meta.url),"react/jsx-runtime":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__264649249385412__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__--SURtz9t.js`),[],import.meta.url),"react-dom":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__264649249385412__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-DiZBpJW2.js`).then(e=>e.gr),[],import.meta.url),"react-dom/client":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__264649249385412__prebuild__react_mf_2_dom_mf_1_client__prebuild__-SIym-UC8.js`),[],import.meta.url),"@mui/material":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__264649249385412__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-DiZBpJW2.js`).then(e=>e.Kn),[],import.meta.url),"@mui/icons-material":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__264649249385412__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-DiZBpJW2.js`).then(e=>e.zt),[],import.meta.url),"@iobroker/gui-components":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__264649249385412__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-DiZBpJW2.js`).then(e=>e.S),[],import.meta.url),"@iobroker/json-config":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__264649249385412__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-CY-VVm-e.js`),[],import.meta.url)},i={react:{name:`react`,version:`19.3.1`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i.react;return e.lib?e.lib:(e.loading||=(async()=>{try{let{react:n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"react/jsx-runtime":{name:`react/jsx-runtime`,version:`19.3.1`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`react/jsx-runtime`];if(e.lib)return e.lib;if(e.loading)return e.loading;let a=n([`default:react/jsx-runtime`,`react/jsx-runtime`],[`default:react`,`react`],`19.3.1`,void 0);return a===void 0?(e.loading=(async()=>{try{let{"react/jsx-runtime":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading):(e.lib=function(){return a},e.loaded=!0,e.lib)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"react-dom":{name:`react-dom`,version:`19.3.1`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`react-dom`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"react-dom":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"react-dom/client":{name:`react-dom/client`,version:`19.3.1`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`react-dom/client`];if(e.lib)return e.lib;if(e.loading)return e.loading;let a=n([`default:react-dom/client`,`react-dom/client`,`default:react-dom`,`react-dom`],[`default:react`,`react`],`19.3.1`,`createRoot`);return a===void 0?(e.loading=(async()=>{try{let{"react-dom/client":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading):(e.lib=function(){return a},e.loaded=!0,e.lib)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@mui/material":{name:`@mui/material`,version:`9.5.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`@mui/material`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"@mui/material":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@mui/icons-material":{name:`@mui/icons-material`,version:`9.5.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`@mui/icons-material`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"@mui/icons-material":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@iobroker/gui-components":{name:`@iobroker/gui-components`,version:`10.3.16`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`@iobroker/gui-components`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"@iobroker/gui-components":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@iobroker/json-config":{name:`@iobroker/json-config`,version:`10.1.12`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`@iobroker/json-config`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"@iobroker/json-config":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}}},a=[];export{a as usedRemotes,i as usedShared};