quickwin 2.3.1 → 3.0.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 (172) hide show
  1. package/README.en.md +1 -2
  2. package/README.md +1 -2
  3. package/constants.ts +15 -0
  4. package/enum_map.d.ts +3 -0
  5. package/examples/PdfCanvas.js +1 -1
  6. package/examples/PdfCanvas.tsx +2 -2
  7. package/examples/execd/main.js +334 -188
  8. package/examples/pdf_preview2.js +76 -67
  9. package/examples/pdf_preview2.ts +84 -64
  10. package/examples/pdf_viewer.js +4932 -1029
  11. package/examples/pdf_viewer.tsx +11 -22
  12. package/examples/test_gallery.js +308 -143
  13. package/examples/test_gallery.tsx +12 -7
  14. package/examples/test_react_lazy.js +295 -133
  15. package/examples/test_react_lazy.tsx +4 -3
  16. package/examples/test_react_listbox.js +293 -132
  17. package/examples/test_react_listbox.tsx +3 -2
  18. package/examples/test_root_window.js +283 -126
  19. package/examples/test_tab.js +295 -133
  20. package/examples/test_tab.tsx +4 -3
  21. package/examples/tray_demo.js +37 -30
  22. package/examples/tray_demo.tsx +39 -32
  23. package/lib/abort.d.ts +21 -0
  24. package/lib/assert.d.ts +2 -0
  25. package/lib/bitmap.d.ts +7 -0
  26. package/lib/bitmap.js +40 -0
  27. package/lib/cache-utils.d.ts +6 -0
  28. package/lib/certs.d.ts +1 -0
  29. package/lib/certs.js +31 -3
  30. package/lib/dpi.d.ts +9 -0
  31. package/lib/dpi.js +30 -0
  32. package/lib/dumpRects.d.ts +2 -0
  33. package/lib/dumpRects.js +14 -7
  34. package/lib/exec-log.d.ts +23 -0
  35. package/lib/fetch.d.ts +4 -0
  36. package/lib/ffi/bind.d.ts +70 -0
  37. package/lib/ffi/bind.js +5 -4
  38. package/lib/ffi/ctype.d.ts +117 -0
  39. package/lib/ffi/index.d.ts +2 -0
  40. package/lib/ffi/struct.d.ts +174 -0
  41. package/lib/http-common.d.ts +143 -0
  42. package/lib/http-server.d.ts +59 -0
  43. package/lib/polyfill.d.ts +22 -0
  44. package/lib/react-qw/components/Button.d.ts +9 -0
  45. package/lib/react-qw/components/CheckBox.d.ts +11 -0
  46. package/lib/react-qw/components/ComboBox.d.ts +11 -0
  47. package/lib/react-qw/components/DateTimePicker.d.ts +15 -0
  48. package/lib/react-qw/components/DateTimePicker.js +6 -7
  49. package/lib/react-qw/components/Input.d.ts +15 -0
  50. package/lib/react-qw/components/Input.js +5 -1
  51. package/lib/react-qw/components/Link.d.ts +12 -0
  52. package/lib/react-qw/components/ListBox.d.ts +13 -0
  53. package/lib/react-qw/components/ListView.d.ts +37 -0
  54. package/lib/react-qw/components/ListView.js +8 -6
  55. package/lib/react-qw/components/PathPicker.d.ts +23 -0
  56. package/lib/react-qw/components/ProgressBar.d.ts +9 -0
  57. package/lib/react-qw/components/RadioButton.d.ts +11 -0
  58. package/lib/react-qw/components/ScrollView.d.ts +9 -0
  59. package/lib/react-qw/components/ScrollView.js +28 -22
  60. package/lib/react-qw/components/Slider.d.ts +12 -0
  61. package/lib/react-qw/components/Tab.d.ts +14 -0
  62. package/lib/react-qw/components/Tooltip.d.ts +7 -0
  63. package/lib/react-qw/components/TreeView.d.ts +18 -0
  64. package/lib/react-qw/components/index.d.ts +16 -0
  65. package/lib/react-qw/index.d.ts +24 -0
  66. package/lib/react-qw/index.js +7 -5
  67. package/lib/react-qw/layout.d.ts +29 -0
  68. package/lib/react-qw/nmhdr.d.ts +1 -0
  69. package/lib/react-qw/props.d.ts +2 -0
  70. package/lib/react-qw/props.js +3 -3
  71. package/lib/react-qw/reconciler.d.ts +21 -0
  72. package/lib/react-qw/reconciler.js +12 -17
  73. package/lib/stream.d.ts +20 -0
  74. package/lib/text-codec.d.ts +39 -0
  75. package/lib/text-measure.d.ts +14 -0
  76. package/lib/text-measure.js +9 -6
  77. package/lib/url.d.ts +54 -0
  78. package/lib/websocket.d.ts +73 -0
  79. package/lib/windows/{advapi32.ts → advapi32.d.ts} +6 -21
  80. package/lib/windows/comctl32.d.ts +14 -0
  81. package/lib/windows/comctl32.js +3 -2
  82. package/lib/windows/comdlg32.d.ts +4 -0
  83. package/lib/windows/{gdi32.ts → gdi32.d.ts} +184 -97
  84. package/lib/windows/gdi32.js +28 -6
  85. package/lib/windows/{kernel32.ts → kernel32.d.ts} +145 -113
  86. package/lib/windows/kernel32.js +9 -0
  87. package/lib/windows/{msimg32.ts → msimg32.d.ts} +11 -14
  88. package/lib/windows/ntdll.d.ts +5 -0
  89. package/lib/windows/ole32.d.ts +3 -0
  90. package/lib/windows/{psapi.ts → psapi.d.ts} +9 -18
  91. package/lib/windows/shell32.d.ts +51 -0
  92. package/lib/windows/shell32.js +11 -2
  93. package/lib/windows/structs.d.ts +3141 -0
  94. package/lib/windows/structs.js +51 -0
  95. package/lib/windows/user32.d.ts +623 -0
  96. package/lib/windows/user32.js +6 -5
  97. package/lib/windows/version.d.ts +27 -0
  98. package/lib/windows/{winspool.ts → winspool.d.ts} +18 -32
  99. package/main.js +13 -5
  100. package/package.json +16 -7
  101. package/quickwin.d.ts +13 -115
  102. package/qwin-nowasm-x86.exe +0 -0
  103. package/qwin-nowasm.exe +0 -0
  104. package/qwin-x86.exe +0 -0
  105. package/qwin.exe +0 -0
  106. package/test/bench_ffi_callraw.js +3 -4
  107. package/test/bench_ffi_callraw.ts +3 -4
  108. package/test/debug/mupdf_debug.js +4 -22
  109. package/test/debug/wasm_export_debug.js +2 -12
  110. package/test/debug/wasm_names.js +3 -13
  111. package/test/example.pdf +0 -0
  112. package/test/mupdf-cdn.js +40 -0
  113. package/test/mupdf-cdn.ts +43 -0
  114. package/test/test_ffi.js +8 -9
  115. package/test/test_ffi.ts +8 -9
  116. package/test/test_ffi_abi.js +6 -6
  117. package/test/test_ffi_abi.ts +8 -8
  118. package/test/test_ffi_windows.js +82 -11
  119. package/test/test_ffi_windows.ts +85 -11
  120. package/test/test_gdi_draw.js +3 -3
  121. package/test/test_gdi_draw.ts +4 -4
  122. package/test/test_mupdf_render.js +4 -22
  123. package/test/test_mupdf_render.ts +4 -23
  124. package/test/test_mupdf_twice.js +4 -19
  125. package/test/test_mupdf_twice.ts +4 -20
  126. package/test/test_mupdf_wasm.js +10 -4
  127. package/test/test_mupdf_wasm.ts +6 -4
  128. package/test/test_react_complex.js +316 -140
  129. package/test/test_react_counter.js +295 -133
  130. package/test/test_react_flex.js +297 -138
  131. package/test/test_react_hidden.js +296 -134
  132. package/test/test_react_listview_link.js +288 -131
  133. package/test/test_react_notify.js +290 -133
  134. package/test/test_react_render.js +295 -133
  135. package/lib/abort.ts +0 -69
  136. package/lib/assert.ts +0 -7
  137. package/lib/cache-utils.ts +0 -40
  138. package/lib/certs.ts +0 -229
  139. package/lib/dumpRects.ts +0 -26
  140. package/lib/exec-log.ts +0 -30
  141. package/lib/fetch.ts +0 -589
  142. package/lib/ffi/bind.ts +0 -539
  143. package/lib/ffi/ctype.ts +0 -371
  144. package/lib/ffi/index.ts +0 -6
  145. package/lib/ffi/struct.ts +0 -780
  146. package/lib/http-common.ts +0 -441
  147. package/lib/http-server.ts +0 -604
  148. package/lib/polyfill.ts +0 -171
  149. package/lib/react-qw/components/index.ts +0 -17
  150. package/lib/react-qw/index.ts +0 -96
  151. package/lib/react-qw/layout.ts +0 -111
  152. package/lib/react-qw/nmhdr.ts +0 -7
  153. package/lib/react-qw/props.ts +0 -41
  154. package/lib/react-qw/reconciler.ts +0 -383
  155. package/lib/stream.ts +0 -22
  156. package/lib/text-codec.ts +0 -171
  157. package/lib/text-measure.ts +0 -41
  158. package/lib/url.ts +0 -201
  159. package/lib/websocket.ts +0 -600
  160. package/lib/windows/comctl32.ts +0 -19
  161. package/lib/windows/comdlg32.ts +0 -10
  162. package/lib/windows/ntdll.ts +0 -11
  163. package/lib/windows/ole32.ts +0 -9
  164. package/lib/windows/shell32.ts +0 -39
  165. package/lib/windows/structs.ts +0 -752
  166. package/lib/windows/user32.ts +0 -619
  167. package/lib/windows/version.ts +0 -35
  168. package/vendor/mupdf-wasm/mupdf-wasm.d.ts +0 -571
  169. package/vendor/mupdf-wasm/mupdf-wasm.js +0 -2749
  170. package/vendor/mupdf-wasm/mupdf-wasm.wasm +0 -0
  171. package/vendor/mupdf-wasm/mupdf.d.ts +0 -939
  172. package/vendor/mupdf-wasm/mupdf.js +0 -3317
@@ -1367,9 +1367,9 @@ var require_scheduler_development = __commonJS({
1367
1367
  }
1368
1368
  return first;
1369
1369
  }
1370
- function compare(a, b6) {
1371
- var diff = a.sortIndex - b6.sortIndex;
1372
- return 0 !== diff ? diff : a.id - b6.id;
1370
+ function compare(a, b7) {
1371
+ var diff = a.sortIndex - b7.sortIndex;
1372
+ return 0 !== diff ? diff : a.id - b7.id;
1373
1373
  }
1374
1374
  function advanceTimers(currentTime) {
1375
1375
  for (var timer = peek(timerQueue); null !== timer; ) {
@@ -1667,14 +1667,14 @@ var require_react_reconciler_development = __commonJS({
1667
1667
  throw Error("Unable to find node on an unmounted component.");
1668
1668
  return alternate !== fiber ? null : fiber;
1669
1669
  }
1670
- for (var a = fiber, b6 = alternate; ; ) {
1670
+ for (var a = fiber, b7 = alternate; ; ) {
1671
1671
  var parentA = a.return;
1672
1672
  if (null === parentA) break;
1673
1673
  var parentB = parentA.alternate;
1674
1674
  if (null === parentB) {
1675
- b6 = parentA.return;
1676
- if (null !== b6) {
1677
- a = b6;
1675
+ b7 = parentA.return;
1676
+ if (null !== b7) {
1677
+ a = b7;
1678
1678
  continue;
1679
1679
  }
1680
1680
  break;
@@ -1682,23 +1682,23 @@ var require_react_reconciler_development = __commonJS({
1682
1682
  if (parentA.child === parentB.child) {
1683
1683
  for (parentB = parentA.child; parentB; ) {
1684
1684
  if (parentB === a) return assertIsMounted(parentA), fiber;
1685
- if (parentB === b6) return assertIsMounted(parentA), alternate;
1685
+ if (parentB === b7) return assertIsMounted(parentA), alternate;
1686
1686
  parentB = parentB.sibling;
1687
1687
  }
1688
1688
  throw Error("Unable to find node on an unmounted component.");
1689
1689
  }
1690
- if (a.return !== b6.return) a = parentA, b6 = parentB;
1690
+ if (a.return !== b7.return) a = parentA, b7 = parentB;
1691
1691
  else {
1692
1692
  for (var didFindChild = false, _child = parentA.child; _child; ) {
1693
1693
  if (_child === a) {
1694
1694
  didFindChild = true;
1695
1695
  a = parentA;
1696
- b6 = parentB;
1696
+ b7 = parentB;
1697
1697
  break;
1698
1698
  }
1699
- if (_child === b6) {
1699
+ if (_child === b7) {
1700
1700
  didFindChild = true;
1701
- b6 = parentA;
1701
+ b7 = parentA;
1702
1702
  a = parentB;
1703
1703
  break;
1704
1704
  }
@@ -1709,12 +1709,12 @@ var require_react_reconciler_development = __commonJS({
1709
1709
  if (_child === a) {
1710
1710
  didFindChild = true;
1711
1711
  a = parentB;
1712
- b6 = parentA;
1712
+ b7 = parentA;
1713
1713
  break;
1714
1714
  }
1715
- if (_child === b6) {
1715
+ if (_child === b7) {
1716
1716
  didFindChild = true;
1717
- b6 = parentB;
1717
+ b7 = parentB;
1718
1718
  a = parentA;
1719
1719
  break;
1720
1720
  }
@@ -1726,7 +1726,7 @@ var require_react_reconciler_development = __commonJS({
1726
1726
  );
1727
1727
  }
1728
1728
  }
1729
- if (a.alternate !== b6)
1729
+ if (a.alternate !== b7)
1730
1730
  throw Error(
1731
1731
  "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue."
1732
1732
  );
@@ -15071,10 +15071,10 @@ var require_react_reconciler_development = __commonJS({
15071
15071
  setCurrentUpdatePriority(previousPriority), ReactSharedInternals.T = prevTransition;
15072
15072
  }
15073
15073
  };
15074
- exports2.discreteUpdates = function(fn, a, b6, c, d) {
15074
+ exports2.discreteUpdates = function(fn, a, b7, c, d) {
15075
15075
  var prevTransition = ReactSharedInternals.T, previousPriority = getCurrentUpdatePriority();
15076
15076
  try {
15077
- return setCurrentUpdatePriority(2), ReactSharedInternals.T = null, fn(a, b6, c, d);
15077
+ return setCurrentUpdatePriority(2), ReactSharedInternals.T = null, fn(a, b7, c, d);
15078
15078
  } finally {
15079
15079
  setCurrentUpdatePriority(previousPriority), ReactSharedInternals.T = prevTransition, executionContext === NoContext && (workInProgressRootRenderTargetTime = now$1() + RENDER_TIMEOUT_MS);
15080
15080
  }
@@ -15357,10 +15357,10 @@ var require_constants = __commonJS({
15357
15357
  var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
15358
15358
  var import_react18 = __toESM(require_react(), 1);
15359
15359
  import "../lib/polyfill.js";
15360
- import * as gui18 from "gui";
15360
+ import * as gui17 from "gui";
15361
15361
 
15362
15362
  // _build/lib/react-qw/index.js
15363
- import * as gui17 from "gui";
15363
+ import * as gui16 from "gui";
15364
15364
 
15365
15365
  // _build/lib/windows/user32.js
15366
15366
  import * as os3 from "os";
@@ -15369,7 +15369,6 @@ import * as os3 from "os";
15369
15369
  import * as ffi from "ffi";
15370
15370
  import * as os2 from "os";
15371
15371
  import * as std from "std";
15372
- import * as win from "win";
15373
15372
 
15374
15373
  // _build/lib/text-codec.js
15375
15374
  var _labelMap = {
@@ -15391,19 +15390,19 @@ function _normalizeLabel(label) {
15391
15390
  function _decodeUTF8(buf, fatal) {
15392
15391
  let out = "";
15393
15392
  for (let i = 0; i < buf.length; ) {
15394
- const b6 = buf[i++];
15395
- if (b6 < 128) {
15396
- out += String.fromCharCode(b6);
15393
+ const b7 = buf[i++];
15394
+ if (b7 < 128) {
15395
+ out += String.fromCharCode(b7);
15397
15396
  continue;
15398
15397
  }
15399
- if (b6 < 192) {
15398
+ if (b7 < 192) {
15400
15399
  out += fatal ? (() => {
15401
15400
  throw new TypeError("unexpected continuation byte");
15402
15401
  })() : "\uFFFD";
15403
15402
  continue;
15404
15403
  }
15405
15404
  let c, min;
15406
- if (b6 < 224) {
15405
+ if (b7 < 224) {
15407
15406
  if (i >= buf.length) {
15408
15407
  out += fatal ? (() => {
15409
15408
  throw new TypeError("incomplete utf-8");
@@ -15415,9 +15414,9 @@ function _decodeUTF8(buf, fatal) {
15415
15414
  out += "\uFFFD";
15416
15415
  continue;
15417
15416
  }
15418
- c = (b6 & 31) << 6 | b22 & 63;
15417
+ c = (b7 & 31) << 6 | b22 & 63;
15419
15418
  min = 128;
15420
- } else if (b6 < 240) {
15419
+ } else if (b7 < 240) {
15421
15420
  if (i + 1 >= buf.length) {
15422
15421
  out += fatal ? (() => {
15423
15422
  throw new TypeError("incomplete utf-8");
@@ -15430,9 +15429,9 @@ function _decodeUTF8(buf, fatal) {
15430
15429
  out += "\uFFFD";
15431
15430
  continue;
15432
15431
  }
15433
- c = (b6 & 15) << 12 | (b22 & 63) << 6 | b32 & 63;
15432
+ c = (b7 & 15) << 12 | (b22 & 63) << 6 | b32 & 63;
15434
15433
  min = 2048;
15435
- } else if (b6 < 248) {
15434
+ } else if (b7 < 248) {
15436
15435
  if (i + 2 >= buf.length) {
15437
15436
  out += fatal ? (() => {
15438
15437
  throw new TypeError("incomplete utf-8");
@@ -15446,7 +15445,7 @@ function _decodeUTF8(buf, fatal) {
15446
15445
  out += "\uFFFD";
15447
15446
  continue;
15448
15447
  }
15449
- c = (b6 & 7) << 18 | (b22 & 63) << 12 | (b32 & 63) << 6 | b42 & 63;
15448
+ c = (b7 & 7) << 18 | (b22 & 63) << 12 | (b32 & 63) << 6 | b42 & 63;
15450
15449
  min = 65536;
15451
15450
  } else {
15452
15451
  out += fatal ? (() => {
@@ -15750,7 +15749,7 @@ function loadDll(dll) {
15750
15749
  const cached = _dllCache.get(dll);
15751
15750
  if (cached !== void 0)
15752
15751
  return cached;
15753
- const loaded = win.LoadLibrary(dll);
15752
+ const loaded = ffi.LoadLibrary(dll);
15754
15753
  if (!loaded)
15755
15754
  throw new Error(`ffi-bind: LoadLibrary("${dll}") failed`);
15756
15755
  _dllCache.set(dll, loaded);
@@ -15960,7 +15959,7 @@ var BYTE = {
15960
15959
  };
15961
15960
  var builtinCodecs = { WCHAR, BYTE };
15962
15961
  function bind(dll, name, sig, encoders, decoders) {
15963
- const proc = win.GetProcAddress(loadDll(dll), name);
15962
+ const proc = ffi.GetProcAddress(loadDll(dll), name);
15964
15963
  if (!proc)
15965
15964
  throw new Error(`ffi-bind: proc "${name}" not found in ${dll}`);
15966
15965
  const effDec = decoders ?? encoders;
@@ -16000,13 +15999,13 @@ function lower(v) {
16000
15999
  type: { tag: "array", elementType: el.type, elementSize: el.size }
16001
16000
  };
16002
16001
  }
16003
- const b6 = /^([A-Za-z_]\w*):(\d+)$/.exec(v);
16004
- if (b6) {
16005
- const rawUnit = b6[1];
16002
+ const b7 = /^([A-Za-z_]\w*):(\d+)$/.exec(v);
16003
+ if (b7) {
16004
+ const rawUnit = b7[1];
16006
16005
  const unit = normToken(rawUnit);
16007
16006
  if (!isCNumberToken(unit) || unit === "f32" || unit === "f64")
16008
16007
  throw new Error(`ffi-struct: bitfield unit must be an integer type, got "${rawUnit}"`);
16009
- const width = Number(b6[2]);
16008
+ const width = Number(b7[2]);
16010
16009
  const s2 = SizeAlign[unit];
16011
16010
  const cap = s2 * 8;
16012
16011
  if (!Number.isInteger(width) || width < 1)
@@ -16322,10 +16321,10 @@ function buildDecl(kind, member, pack) {
16322
16321
  decl[k] = v;
16323
16322
  return decl;
16324
16323
  }
16325
- function struct(a, b6, c) {
16324
+ function struct(a, b7, c) {
16326
16325
  const isNamed = typeof a === "string";
16327
- const raw = isNamed ? b6 : a;
16328
- const opts = isNamed ? c : b6;
16326
+ const raw = isNamed ? b7 : a;
16327
+ const opts = isNamed ? c : b7;
16329
16328
  return createStruct(buildDecl("struct", raw, opts?.pack));
16330
16329
  }
16331
16330
 
@@ -16350,6 +16349,17 @@ var SIZE_DECL = {
16350
16349
  cy: "i32"
16351
16350
  };
16352
16351
  var SIZE = /* @__PURE__ */ struct("SIZE", SIZE_DECL);
16352
+ var SCROLLINFO_DECL = {
16353
+ "#": "struct",
16354
+ cbSize: "u32",
16355
+ fMask: "u32",
16356
+ nMin: "i32",
16357
+ nMax: "i32",
16358
+ nPage: "u32",
16359
+ nPos: "i32",
16360
+ nTrackPos: "i32"
16361
+ };
16362
+ var SCROLLINFO = /* @__PURE__ */ struct("SCROLLINFO", SCROLLINFO_DECL);
16353
16363
  var LOGFONTW_DECL = {
16354
16364
  "#": "struct",
16355
16365
  lfHeight: "i32",
@@ -16368,6 +16378,41 @@ var LOGFONTW_DECL = {
16368
16378
  lfFaceName: "u16[32]@utf-16le"
16369
16379
  };
16370
16380
  var LOGFONTW = /* @__PURE__ */ struct("LOGFONTW", LOGFONTW_DECL);
16381
+ var NONCLIENTMETRICSW_DECL = {
16382
+ "#": "struct",
16383
+ cbSize: "u32",
16384
+ iBorderWidth: "i32",
16385
+ iScrollWidth: "i32",
16386
+ iScrollHeight: "i32",
16387
+ iCaptionWidth: "i32",
16388
+ iCaptionHeight: "i32",
16389
+ lfCaptionFont: LOGFONTW_DECL,
16390
+ iSmCaptionWidth: "i32",
16391
+ iSmCaptionHeight: "i32",
16392
+ lfSmCaptionFont: LOGFONTW_DECL,
16393
+ iMenuWidth: "i32",
16394
+ iMenuHeight: "i32",
16395
+ lfMenuFont: LOGFONTW_DECL,
16396
+ lfStatusFont: LOGFONTW_DECL,
16397
+ lfMessageFont: LOGFONTW_DECL,
16398
+ iPaddedBorderWidth: "i32"
16399
+ };
16400
+ var NONCLIENTMETRICSW = /* @__PURE__ */ struct("NONCLIENTMETRICSW", NONCLIENTMETRICSW_DECL);
16401
+ var BITMAPINFOHEADER_DECL = {
16402
+ "#": "struct",
16403
+ biSize: "u32",
16404
+ biWidth: "i32",
16405
+ biHeight: "i32",
16406
+ biPlanes: "u16",
16407
+ biBitCount: "u16",
16408
+ biCompression: "u32",
16409
+ biSizeImage: "u32",
16410
+ biXPelsPerMeter: "i32",
16411
+ biYPelsPerMeter: "i32",
16412
+ biClrUsed: "u32",
16413
+ biClrImportant: "u32"
16414
+ };
16415
+ var BITMAPINFOHEADER = /* @__PURE__ */ struct("BITMAPINFOHEADER", BITMAPINFOHEADER_DECL);
16371
16416
  var OPENFILENAMEW_DECL = {
16372
16417
  "#": "struct",
16373
16418
  lStructSize: "u32",
@@ -16574,24 +16619,34 @@ var NOTIFYICONIDENTIFIER = /* @__PURE__ */ struct("NOTIFYICONIDENTIFIER", NOTIFY
16574
16619
  var b = (name, sig, encoders) => bind("user32.dll", name, sig, encoders);
16575
16620
  var _bProbe = b("GetDesktopWindow", " -> <HWND>ptr");
16576
16621
  var LONG_PTR_SYM = os3.arch === "x64" ? "PtrW" : "W";
16622
+ var ShowWindow = /* @__PURE__ */ b("ShowWindow", "<HWND>ptr i32@ShowWindowCmd -> i32");
16577
16623
  var SetWindowPos = /* @__PURE__ */ b("SetWindowPos", "<HWND>ptr <>ptr@SetWindowPosHwnd i32 i32 i32 i32 u32 -> i32");
16624
+ var GetWindowRect = /* @__PURE__ */ b("GetWindowRect", "<HWND>ptr <RECT>ptr -> i32");
16625
+ var GetClientRect = /* @__PURE__ */ b("GetClientRect", "<HWND>ptr <RECT>ptr -> i32");
16626
+ var GetWindowText = /* @__PURE__ */ b("GetWindowTextW", "<HWND>ptr <BYTE>ptr i32 -> i32");
16578
16627
  var SetWindowText = /* @__PURE__ */ b("SetWindowTextW", "<HWND>ptr <WCHAR>ptr -> i32");
16628
+ var GetWindowTextLength = /* @__PURE__ */ b("GetWindowTextLengthW", "<HWND>ptr -> i32");
16579
16629
  var GetWindowLongPtr = /* @__PURE__ */ b("GetWindowLong" + LONG_PTR_SYM, "<HWND>ptr i32@Gwlp -> <>ptr");
16580
16630
  var SetWindowLongPtr = /* @__PURE__ */ b("SetWindowLong" + LONG_PTR_SYM, "<HWND>ptr i32@Gwlp <>ptr -> <>ptr");
16581
16631
  var EnableWindow = /* @__PURE__ */ b("EnableWindow", "<HWND>ptr i32 -> i32");
16582
16632
  var SetParent = /* @__PURE__ */ b("SetParent", "<HWND>ptr <HWND>ptr -> <HWND>ptr");
16633
+ var PostQuitMessage = /* @__PURE__ */ b("PostQuitMessage", "i32 -> void");
16583
16634
  var DefWindowProc = /* @__PURE__ */ b("DefWindowProcW", "<HWND>ptr u32@AnyMsg <>ptr <>ptr -> <>ptr");
16584
16635
  var CallWindowProc = /* @__PURE__ */ b("CallWindowProcW", "<>ptr <HWND>ptr u32@AnyMsg <>ptr <>ptr -> <>ptr");
16585
16636
  var GetDC = /* @__PURE__ */ b("GetDC", "<HWND>ptr -> <HDC>ptr");
16586
16637
  var ReleaseDC = /* @__PURE__ */ b("ReleaseDC", "<HWND>ptr <HDC>ptr! -> i32");
16587
16638
  var DrawText = /* @__PURE__ */ b("DrawTextW", "<HDC>ptr! <WCHAR>ptr i32 <RECT>ptr i32 -> i32");
16588
16639
  var InvalidateRect = /* @__PURE__ */ b("InvalidateRect", "<HWND>ptr <RECT>ptr i32 -> i32", { RECT });
16640
+ var UpdateWindow = /* @__PURE__ */ b("UpdateWindow", "<HWND>ptr -> i32");
16589
16641
  var SetCursor = /* @__PURE__ */ b("SetCursor", "<HCURSOR>ptr -> <HCURSOR>ptr");
16590
16642
  var LoadCursor = /* @__PURE__ */ b("LoadCursorW", "<HMODULE>ptr <>ptr -> <HCURSOR>ptr");
16591
16643
  var GetCursorPos = /* @__PURE__ */ b("GetCursorPos", "<POINT>ptr -> i32");
16592
16644
  var ScreenToClient = /* @__PURE__ */ b("ScreenToClient", "<HWND>ptr <POINT>ptr -> i32");
16645
+ var SetScrollInfo = /* @__PURE__ */ b("SetScrollInfo", "<HWND>ptr u32 <SCROLLINFO>ptr i32 -> i32", { SCROLLINFO });
16646
+ var GetScrollInfo = /* @__PURE__ */ b("GetScrollInfo", "<HWND>ptr u32 <SCROLLINFO>ptr -> i32");
16593
16647
  var ShowScrollBar = /* @__PURE__ */ b("ShowScrollBar", "<HWND>ptr u32 i32 -> i32");
16594
16648
  var GetSystemMetrics = /* @__PURE__ */ b("GetSystemMetrics", "i32 -> i32");
16649
+ var SystemParametersInfo = /* @__PURE__ */ b("SystemParametersInfoW", "u32 u32 <BYTE>ptr u32 -> i32");
16595
16650
 
16596
16651
  // _build/lib/react-qw/reconciler.js
16597
16652
  var import_react_reconciler = __toESM(require_react_reconciler(), 1);
@@ -16606,8 +16661,33 @@ var DeleteObject = /* @__PURE__ */ b2("DeleteObject", "<HGDIOBJ>ptr -> i32");
16606
16661
  var GetDeviceCaps = /* @__PURE__ */ b2("GetDeviceCaps", "<HDC>ptr! i32@DeviceCap -> i32");
16607
16662
  var CreateFontIndirect = /* @__PURE__ */ b2("CreateFontIndirectW", "<LOGFONTW>ptr -> <HGDIOBJ>ptr", { LOGFONTW });
16608
16663
  var SelectObject = /* @__PURE__ */ b2("SelectObject", "<HDC>ptr! <HGDIOBJ>ptr -> <HGDIOBJ>ptr");
16664
+ var CreateDIBSection = /* @__PURE__ */ b2("CreateDIBSection", "<HDC>ptr <>ptr u32@ColorUse <>ptr <>ptr u32 -> <HGDIOBJ>ptr");
16665
+ var SetDIBits = /* @__PURE__ */ b2("SetDIBits", "<HDC>ptr <HGDIOBJ>ptr! u32 u32 <BYTE>ptr <>ptr u32@ColorUse -> i32");
16609
16666
  var GetObject = /* @__PURE__ */ b2("GetObjectW", "<HGDIOBJ>ptr i32 <BYTE>ptr -> i32");
16610
16667
 
16668
+ // _build/lib/dpi.js
16669
+ function getScaleFactor() {
16670
+ const hdc = GetDC(NULL);
16671
+ const dpi = hdc ? GetDeviceCaps(
16672
+ hdc,
16673
+ 88
16674
+ /* DeviceCap.LOGPIXELSX */
16675
+ ) : 96;
16676
+ if (hdc)
16677
+ ReleaseDC(NULL, hdc);
16678
+ return dpi / 96;
16679
+ }
16680
+ function createSystemDpiFont() {
16681
+ const ncm = NONCLIENTMETRICSW.encode({ cbSize: NONCLIENTMETRICSW.size });
16682
+ if (!SystemParametersInfo(41, NONCLIENTMETRICSW.size, ncm, 0)) {
16683
+ const legacySize = NONCLIENTMETRICSW.size - 4;
16684
+ NONCLIENTMETRICSW.encode({ cbSize: legacySize }, ncm);
16685
+ if (!SystemParametersInfo(41, legacySize, ncm, 0))
16686
+ return NULL;
16687
+ }
16688
+ return CreateFontIndirect(NONCLIENTMETRICSW.decode(ncm).lfMessageFont);
16689
+ }
16690
+
16611
16691
  // _build/lib/react-qw/props.js
16612
16692
  import * as gui from "gui";
16613
16693
  function applyProps(instance, newProps, _oldProps) {
@@ -16631,14 +16711,14 @@ function applyProps(instance, newProps, _oldProps) {
16631
16711
  EnableWindow(hwnd2, !newProps.disabled ? 1 : 0);
16632
16712
  }
16633
16713
  if ("hidden" in newProps) {
16634
- gui.ShowWindow(
16714
+ ShowWindow(
16635
16715
  hwnd2,
16636
16716
  newProps.hidden ? 0 : 5
16637
16717
  /* ShowWindowCmd.SHOW */
16638
16718
  );
16639
16719
  }
16640
16720
  if ("visible" in newProps) {
16641
- gui.ShowWindow(
16721
+ ShowWindow(
16642
16722
  hwnd2,
16643
16723
  newProps.visible ? 5 : 0
16644
16724
  /* ShowWindowCmd.HIDE */
@@ -16758,24 +16838,21 @@ function measureTextForHwnd(hwnd2, text) {
16758
16838
  if (hFont)
16759
16839
  SelectObject(hdc, oldFont);
16760
16840
  ReleaseDC(hwnd2, hdc);
16761
- const wr = gui2.GetWindowRect(hwnd2);
16762
- const cr = gui2.GetClientRect(hwnd2);
16763
- if (wr && cr) {
16764
- result.width += wr.right - wr.left - (cr.right - cr.left);
16765
- result.height += wr.bottom - wr.top - (cr.bottom - cr.top);
16841
+ const wr = RECT.alloc();
16842
+ const cr = RECT.alloc();
16843
+ const okWr = GetWindowRect(hwnd2, wr.ptr);
16844
+ const okCr = GetClientRect(hwnd2, cr.ptr);
16845
+ if (okWr && okCr) {
16846
+ const w = RECT.decode(wr), c = RECT.decode(cr);
16847
+ result.width += w.right - w.left - (c.right - c.left);
16848
+ result.height += w.bottom - w.top - (c.bottom - c.top);
16766
16849
  }
16767
16850
  return result;
16768
16851
  }
16769
16852
 
16770
16853
  // _build/lib/react-qw/reconciler.js
16771
- var dpiFont = gui3.CreateSystemDpiFont();
16772
- var scaleFactor = (() => {
16773
- const hdc = GetDC(NULL);
16774
- const dpi = hdc ? GetDeviceCaps(hdc, 88) : 96;
16775
- if (hdc)
16776
- ReleaseDC(NULL, hdc);
16777
- return dpi / 96;
16778
- })();
16854
+ var dpiFont = createSystemDpiFont();
16855
+ var scaleFactor = getScaleFactor();
16779
16856
  var DELAYED_CONTROLS = /* @__PURE__ */ new Set(["SysListView32", "SysTreeView32", "LISTBOX", "COMBOBOX", "msctls_trackbar32", "SysDateTimePick32", "SysLink"]);
16780
16857
  function isDelayedControl(winClass) {
16781
16858
  return DELAYED_CONTROLS.has(winClass);
@@ -16821,11 +16898,12 @@ function runFlexLayout(inst) {
16821
16898
  const visible = children.filter((c) => !c.props.hidden);
16822
16899
  if (visible.length === 0)
16823
16900
  return;
16824
- const rect = gui3.GetClientRect(inst.hwnd);
16825
- if (!rect) {
16901
+ const rcBuf = RECT.alloc();
16902
+ if (!GetClientRect(inst.hwnd, rcBuf.ptr)) {
16826
16903
  console.log("flex: no rect for", inst.hwnd, inst.type);
16827
16904
  return;
16828
16905
  }
16906
+ const rect = RECT.decode(rcBuf);
16829
16907
  const pw = (rect.right - rect.left) / scaleFactor;
16830
16908
  const ph = (rect.bottom - rect.top) / scaleFactor;
16831
16909
  if (pw <= 0 || ph <= 0) {
@@ -17026,7 +17104,7 @@ var hostConfig = {
17026
17104
  },
17027
17105
  hideInstance(instance) {
17028
17106
  if (instance.hwnd !== null)
17029
- gui3.ShowWindow(
17107
+ ShowWindow(
17030
17108
  instance.hwnd,
17031
17109
  0
17032
17110
  /* ShowWindowCmd.HIDE */
@@ -17034,7 +17112,7 @@ var hostConfig = {
17034
17112
  },
17035
17113
  hideTextInstance(instance) {
17036
17114
  if (instance.hwnd !== null)
17037
- gui3.ShowWindow(
17115
+ ShowWindow(
17038
17116
  instance.hwnd,
17039
17117
  0
17040
17118
  /* ShowWindowCmd.HIDE */
@@ -17042,7 +17120,7 @@ var hostConfig = {
17042
17120
  },
17043
17121
  unhideInstance(instance, _props) {
17044
17122
  if (instance.hwnd !== null)
17045
- gui3.ShowWindow(
17123
+ ShowWindow(
17046
17124
  instance.hwnd,
17047
17125
  5
17048
17126
  /* ShowWindowCmd.SHOW */
@@ -17050,7 +17128,7 @@ var hostConfig = {
17050
17128
  },
17051
17129
  unhideTextInstance(instance, _text) {
17052
17130
  if (instance.hwnd !== null)
17053
- gui3.ShowWindow(
17131
+ ShowWindow(
17054
17132
  instance.hwnd,
17055
17133
  5
17056
17134
  /* ShowWindowCmd.SHOW */
@@ -17297,11 +17375,10 @@ var DateTimePicker = (0, import_react5.forwardRef)(function DateTimePicker2({ va
17297
17375
  if (!h)
17298
17376
  return;
17299
17377
  InvalidateRect(h, NULL, 1);
17300
- const cr = gui6.GetClientRect(h);
17301
- if (cr) {
17302
- const w = cr.right - cr.left;
17303
- const hh = cr.bottom - cr.top;
17304
- gui6.SendMessage(h, 5, 0, hh << 16 | w);
17378
+ const cr = RECT.alloc();
17379
+ if (GetClientRect(h, cr.ptr)) {
17380
+ const { left, top, right, bottom } = RECT.decode(cr);
17381
+ gui6.SendMessage(h, 5, 0, bottom - top << 16 | right - left);
17305
17382
  }
17306
17383
  }, []);
17307
17384
  return (0, import_jsx_runtime4.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, ref, onEvent: (e) => {
@@ -17362,7 +17439,10 @@ var Input = (0, import_react6.forwardRef)(({ value: controlledValue, defaultValu
17362
17439
  const h = inputRef.current;
17363
17440
  if (!h)
17364
17441
  return;
17365
- const newText = gui7.GetWindowText(h);
17442
+ const cap = GetWindowTextLength(h) + 1;
17443
+ const buf = WCHAR.alloc(cap);
17444
+ GetWindowText(h, buf, cap);
17445
+ const newText = WCHAR.decode(buf);
17366
17446
  if (!isControlled)
17367
17447
  setInternalValue(newText);
17368
17448
  onChange?.(newText);
@@ -17450,6 +17530,49 @@ var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
17450
17530
  var import_react9 = __toESM(require_react(), 1);
17451
17531
  import * as gui9 from "gui";
17452
17532
  import * as ffi3 from "ffi";
17533
+
17534
+ // _build/lib/bitmap.js
17535
+ function createBitmapFromPixels(width, height, pixels) {
17536
+ if (width <= 0 || height <= 0)
17537
+ return NULL;
17538
+ const len = width * height * 4;
17539
+ if (pixels.byteLength < len)
17540
+ return NULL;
17541
+ const bi = BITMAPINFOHEADER.encode({
17542
+ biSize: BITMAPINFOHEADER.size,
17543
+ biWidth: width,
17544
+ biHeight: -height,
17545
+ biPlanes: 1,
17546
+ biBitCount: 32
17547
+ });
17548
+ const hbm = CreateDIBSection(NULL, bi.ptr, 0, NULL, NULL, 0);
17549
+ if (!hbm)
17550
+ return NULL;
17551
+ const src = new PtrArrayBuffer(len);
17552
+ new Uint8Array(src).set(new Uint8Array(pixels, 0, len));
17553
+ if (SetDIBits(
17554
+ NULL,
17555
+ hbm,
17556
+ 0,
17557
+ height,
17558
+ src,
17559
+ bi.ptr,
17560
+ 0
17561
+ /* ColorUse.RGB_COLORS */
17562
+ ) !== height) {
17563
+ DeleteObject(hbm);
17564
+ return NULL;
17565
+ }
17566
+ return hbm;
17567
+ }
17568
+
17569
+ // _build/lib/windows/comctl32.js
17570
+ var b3 = (name, sig) => bind("comctl32.dll", name, sig);
17571
+ var ImageListCreate = /* @__PURE__ */ b3("ImageList_Create", "i32 i32 u32 i32 i32 -> <HIMAGELIST>ptr");
17572
+ var ImageListAdd = /* @__PURE__ */ b3("ImageList_Add", "<HIMAGELIST>ptr <HGDIOBJ>ptr <HGDIOBJ>ptr -> i32");
17573
+ var ImageListDestroy = /* @__PURE__ */ b3("ImageList_Destroy", "<HIMAGELIST>ptr -> i32");
17574
+
17575
+ // _build/lib/react-qw/components/ListView.js
17453
17576
  function writeU32(ptr, offset, v) {
17454
17577
  ffi3.writeByte(ptr + offset, v & 255);
17455
17578
  ffi3.writeByte(ptr + offset + 1, v >> 8 & 255);
@@ -17539,7 +17662,7 @@ function resolveCellStyle(columns, data, row, colIndex) {
17539
17662
  }
17540
17663
  function makeLVItem(i, sub, text, image) {
17541
17664
  const textBuf = WCHAR.encode(text);
17542
- const b6 = LVITEMW.encode({
17665
+ const b7 = LVITEMW.encode({
17543
17666
  mask: 1 | (image !== void 0 ? 2 : 0),
17544
17667
  iItem: i,
17545
17668
  iSubItem: sub,
@@ -17556,32 +17679,32 @@ function makeLVItem(i, sub, text, image) {
17556
17679
  piColFmt: 0,
17557
17680
  iGroup: 0
17558
17681
  });
17559
- b6.__textBuf = textBuf;
17560
- return b6;
17682
+ b7.__textBuf = textBuf;
17683
+ return b7;
17561
17684
  }
17562
17685
  var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns, data, style, icons, iconSize, getIcon }, ref) {
17563
17686
  const lvRef = (0, import_react9.useRef)(null);
17564
- const iconListRef = (0, import_react9.useRef)(0);
17687
+ const iconListRef = (0, import_react9.useRef)(NULL);
17565
17688
  (0, import_react9.useEffect)(() => {
17566
17689
  const h = lvRef.current;
17567
17690
  if (!h)
17568
17691
  return;
17569
17692
  const il = iconListRef.current;
17570
- iconListRef.current = 0;
17693
+ iconListRef.current = NULL;
17571
17694
  if (il) {
17572
17695
  gui9.SendMessage(h, 4099, 1, 0);
17573
- gui9.ImageListDestroy(il);
17696
+ ImageListDestroy(il);
17574
17697
  }
17575
17698
  if (!icons || icons.length === 0)
17576
17699
  return;
17577
17700
  const size = iconSize ?? 32;
17578
- const img = gui9.ImageListCreate(size, size, 32, icons.length, 1);
17701
+ const img = ImageListCreate(size, size, 32, icons.length, 1);
17579
17702
  if (!img)
17580
17703
  return;
17581
17704
  for (const p of icons) {
17582
- const hbm = gui9.CreateBitmapFromPixels(size, size, p);
17705
+ const hbm = createBitmapFromPixels(size, size, p);
17583
17706
  if (hbm) {
17584
- gui9.ImageListAdd(img, hbm);
17707
+ ImageListAdd(img, hbm, NULL);
17585
17708
  DeleteObject(hbm);
17586
17709
  }
17587
17710
  }
@@ -17762,22 +17885,19 @@ var RadioButton = (0, import_react11.forwardRef)(({ checked: controlledChecked,
17762
17885
  // _build/lib/react-qw/components/ScrollView.js
17763
17886
  var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
17764
17887
  var import_react12 = __toESM(require_react(), 1);
17765
- import * as gui12 from "gui";
17766
17888
  var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth, contentHeight }, ref) => {
17767
17889
  const svRef = (0, import_react12.useRef)(null);
17768
17890
  const contentRef = (0, import_react12.useRef)(null);
17769
17891
  const scrollXRef = (0, import_react12.useRef)(0);
17770
17892
  const scrollYRef = (0, import_react12.useRef)(0);
17771
17893
  function updateScroll(sv, content) {
17772
- const svRect = gui12.GetClientRect(sv);
17773
- if (!svRect)
17894
+ const svBuf = RECT.alloc();
17895
+ if (!GetClientRect(sv, svBuf.ptr))
17774
17896
  return;
17775
- const svW = svRect.right - svRect.left;
17776
- const svH = svRect.bottom - svRect.top;
17777
- const hdc = GetDC(NULL);
17778
- const scale = hdc ? GetDeviceCaps(hdc, 88) / 96 : 1;
17779
- if (hdc)
17780
- ReleaseDC(NULL, hdc);
17897
+ const { left, top, right, bottom } = RECT.decode(svBuf);
17898
+ const svW = right - left;
17899
+ const svH = bottom - top;
17900
+ const scale = getScaleFactor();
17781
17901
  const natW = Math.round((contentWidth ?? svW / scale) * scale);
17782
17902
  const natH = Math.round((contentHeight ?? svH / scale) * scale);
17783
17903
  scrollXRef.current = Math.max(0, Math.min(scrollXRef.current, natW - svW));
@@ -17794,14 +17914,28 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17794
17914
  );
17795
17915
  forceFlexLayout(content);
17796
17916
  if (natW > svW) {
17797
- gui12.SetScrollInfo(sv, 0, { min: 0, max: natW - 1, page: svW, pos: scrollXRef.current }, true);
17917
+ SetScrollInfo(sv, 0, {
17918
+ cbSize: SCROLLINFO.size,
17919
+ fMask: 1 | 2 | 4,
17920
+ nMin: 0,
17921
+ nMax: natW - 1,
17922
+ nPage: svW,
17923
+ nPos: scrollXRef.current
17924
+ }, 1);
17798
17925
  ShowScrollBar(sv, 0, 1);
17799
17926
  } else {
17800
17927
  scrollXRef.current = 0;
17801
17928
  ShowScrollBar(sv, 0, 0);
17802
17929
  }
17803
17930
  if (natH > svH) {
17804
- gui12.SetScrollInfo(sv, 1, { min: 0, max: natH - 1, page: svH, pos: scrollYRef.current }, true);
17931
+ SetScrollInfo(sv, 1, {
17932
+ cbSize: SCROLLINFO.size,
17933
+ fMask: 1 | 2 | 4,
17934
+ nMin: 0,
17935
+ nMax: natH - 1,
17936
+ nPage: svH,
17937
+ nPos: scrollYRef.current
17938
+ }, 1);
17805
17939
  ShowScrollBar(sv, 1, 1);
17806
17940
  } else {
17807
17941
  scrollYRef.current = 0;
@@ -17831,15 +17965,21 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17831
17965
  1 | 4
17832
17966
  /* SetWindowPosFlag.SWP_NOZORDER */
17833
17967
  );
17834
- gui12.SetScrollInfo(sv, bar, { pos: newPos }, true);
17968
+ SetScrollInfo(sv, bar, { cbSize: SCROLLINFO.size, fMask: 4, nPos: newPos }, 1);
17835
17969
  }
17836
17970
  function handleScroll(e, bar) {
17837
17971
  const sv = svRef.current;
17838
17972
  const content = contentRef.current;
17839
17973
  if (!sv || !content)
17840
17974
  return;
17841
- const info = gui12.GetScrollInfo(sv, bar);
17842
- const maxPos = info.max - info.page + 1;
17975
+ const si = SCROLLINFO.encode({
17976
+ cbSize: SCROLLINFO.size,
17977
+ fMask: 23
17978
+ /* ScrollInfoFlag.ALL */
17979
+ });
17980
+ GetScrollInfo(sv, bar, si.ptr);
17981
+ const info = SCROLLINFO.decode(si);
17982
+ const maxPos = info.nMax - info.nPage + 1;
17843
17983
  const code = e.wParam & 65535;
17844
17984
  const ref_ = bar === 1 ? scrollYRef : scrollXRef;
17845
17985
  let newPos = ref_.current;
@@ -17850,9 +17990,9 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17850
17990
  else if (code === 1)
17851
17991
  newPos += 20;
17852
17992
  else if (code === 2)
17853
- newPos -= info.page;
17993
+ newPos -= info.nPage;
17854
17994
  else if (code === 3)
17855
- newPos += info.page;
17995
+ newPos += info.nPage;
17856
17996
  else
17857
17997
  return;
17858
17998
  newPos = Math.max(0, Math.min(maxPos, newPos));
@@ -17872,8 +18012,14 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17872
18012
  if (!isHorz && contentHeight === void 0)
17873
18013
  return;
17874
18014
  const bar = isHorz ? 0 : 1;
17875
- const info = gui12.GetScrollInfo(sv, bar);
17876
- const maxPos = info.max - info.page + 1;
18015
+ const si = SCROLLINFO.encode({
18016
+ cbSize: SCROLLINFO.size,
18017
+ fMask: 23
18018
+ /* ScrollInfoFlag.ALL */
18019
+ });
18020
+ GetScrollInfo(sv, bar, si.ptr);
18021
+ const info = SCROLLINFO.decode(si);
18022
+ const maxPos = info.nMax - info.nPage + 1;
17877
18023
  const ref_ = isHorz ? scrollXRef : scrollYRef;
17878
18024
  let newPos = ref_.current + dy;
17879
18025
  newPos = Math.max(0, Math.min(maxPos, newPos));
@@ -17921,7 +18067,7 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17921
18067
  // _build/lib/react-qw/components/Slider.js
17922
18068
  var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
17923
18069
  var import_react13 = __toESM(require_react(), 1);
17924
- import * as gui13 from "gui";
18070
+ import * as gui12 from "gui";
17925
18071
  var Slider = (0, import_react13.forwardRef)(({ value, onChange, min = 0, max = 100, vertical = false, disabled, style }, ref) => {
17926
18072
  const wrapperRef = (0, import_react13.useRef)(null);
17927
18073
  const sliderRef = (0, import_react13.useRef)(null);
@@ -17930,14 +18076,14 @@ var Slider = (0, import_react13.forwardRef)(({ value, onChange, min = 0, max = 1
17930
18076
  if (!h)
17931
18077
  return;
17932
18078
  const lParam = min & 65535 | (max & 65535) << 16;
17933
- gui13.SendMessage(h, 1030, 0, lParam);
17934
- gui13.SendMessage(h, 1029, 1, value);
18079
+ gui12.SendMessage(h, 1030, 0, lParam);
18080
+ gui12.SendMessage(h, 1029, 1, value);
17935
18081
  }, [min, max]);
17936
18082
  (0, import_react13.useEffect)(() => {
17937
18083
  const h = sliderRef.current;
17938
18084
  if (!h)
17939
18085
  return;
17940
- gui13.SendMessage(h, 1029, 1, value);
18086
+ gui12.SendMessage(h, 1029, 1, value);
17941
18087
  }, [value]);
17942
18088
  const tbStyle = 268435456 | 65536 | 1 | (vertical ? 2 : 0);
17943
18089
  return (0, import_jsx_runtime12.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style, ref: (h) => {
@@ -17954,7 +18100,7 @@ var Slider = (0, import_react13.forwardRef)(({ value, onChange, min = 0, max = 1
17954
18100
  const h = sliderRef.current;
17955
18101
  if (!h)
17956
18102
  return 0;
17957
- const pos = gui13.SendMessage(h, 1024, 0, 0);
18103
+ const pos = gui12.SendMessage(h, 1024, 0, 0);
17958
18104
  onChange?.(pos);
17959
18105
  return 0;
17960
18106
  }
@@ -17967,7 +18113,7 @@ var Slider = (0, import_react13.forwardRef)(({ value, onChange, min = 0, max = 1
17967
18113
  // _build/lib/react-qw/components/Tab.js
17968
18114
  var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
17969
18115
  var import_react14 = __toESM(require_react(), 1);
17970
- import * as gui14 from "gui";
18116
+ import * as gui13 from "gui";
17971
18117
  var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex, defaultSelectedIndex = 0, onChange, style }, ref) => {
17972
18118
  const [internalIndex, setInternalIndex] = (0, import_react14.useState)(defaultSelectedIndex);
17973
18119
  const isControlled = controlledIndex !== void 0;
@@ -17977,7 +18123,7 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
17977
18123
  const h = tabHwnd.current;
17978
18124
  if (!h)
17979
18125
  return;
17980
- gui14.SendMessage(h, 4873, 0, 0);
18126
+ gui13.SendMessage(h, 4873, 0, 0);
17981
18127
  for (let i = 0; i < tabs.length; i++) {
17982
18128
  const titleBuf = WCHAR.encode(tabs[i].title);
17983
18129
  const tci = TCITEMW.encode({
@@ -17990,14 +18136,14 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
17990
18136
  lParam: 0
17991
18137
  });
17992
18138
  const tciPtr = tci.ptr;
17993
- gui14.SendMessage(h, 4926, i, tciPtr);
18139
+ gui13.SendMessage(h, 4926, i, tciPtr);
17994
18140
  }
17995
- gui14.SendMessage(h, 4876, sel, 0);
18141
+ gui13.SendMessage(h, 4876, sel, 0);
17996
18142
  }, [tabs]);
17997
18143
  (0, import_react14.useEffect)(() => {
17998
18144
  const h = tabHwnd.current;
17999
18145
  if (h)
18000
- gui14.SendMessage(h, 4876, sel, 0);
18146
+ gui13.SendMessage(h, 4876, sel, 0);
18001
18147
  }, [sel]);
18002
18148
  return (0, import_jsx_runtime13.jsxs)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, ref, onEvent: (e) => {
18003
18149
  if (e.msg === 78) {
@@ -18006,7 +18152,7 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
18006
18152
  return;
18007
18153
  const code = nmCode(e.lParam);
18008
18154
  if (code === -552 || code === -2) {
18009
- const newSel = gui14.SendMessage(h, 4875, 0, 0);
18155
+ const newSel = gui13.SendMessage(h, 4875, 0, 0);
18010
18156
  if (newSel !== sel) {
18011
18157
  if (!isControlled)
18012
18158
  setInternalIndex(newSel);
@@ -18019,12 +18165,12 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
18019
18165
 
18020
18166
  // _build/lib/react-qw/components/Tooltip.js
18021
18167
  var import_react15 = __toESM(require_react(), 1);
18022
- import * as gui15 from "gui";
18168
+ import * as gui14 from "gui";
18023
18169
 
18024
18170
  // _build/lib/react-qw/components/TreeView.js
18025
18171
  var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
18026
18172
  var import_react16 = __toESM(require_react(), 1);
18027
- import * as gui16 from "gui";
18173
+ import * as gui15 from "gui";
18028
18174
  function buildTvItem(textPtr, cChildren) {
18029
18175
  let mask = 1;
18030
18176
  if (cChildren > 0)
@@ -18049,20 +18195,20 @@ function insertItems(hTree, nodes, parentHandle, hItemMap, keyMap) {
18049
18195
  const itemBuf = buildTvItem(textBuf.ptr, cChildren);
18050
18196
  const item = TVITEM.decode(itemBuf);
18051
18197
  const tvins = TVINSERTSTRUCT.encode({ hParent: parentHandle, hInsertAfter: -65536, item });
18052
- const hItem = gui16.SendMessage(hTree, 4402, 0, tvins.ptr);
18198
+ const hItem = gui15.SendMessage(hTree, 4402, 0, tvins.ptr);
18053
18199
  hItemMap.set(hItem, node);
18054
18200
  if (node.key)
18055
18201
  keyMap.set(node.key, hItem);
18056
18202
  if (node.children && node.children.length > 0) {
18057
18203
  insertItems(hTree, node.children, hItem, hItemMap, keyMap);
18058
- gui16.SendMessage(hTree, 4354, 2, hItem);
18204
+ gui15.SendMessage(hTree, 4354, 2, hItem);
18059
18205
  }
18060
18206
  }
18061
18207
  }
18062
18208
  function deleteAllItems(hTree) {
18063
- const n = gui16.SendMessage(hTree, 4357, 0, 0);
18209
+ const n = gui15.SendMessage(hTree, 4357, 0, 0);
18064
18210
  if (n > 0)
18065
- gui16.SendMessage(
18211
+ gui15.SendMessage(
18066
18212
  hTree,
18067
18213
  4353,
18068
18214
  1,
@@ -18094,7 +18240,7 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onS
18094
18240
  const h = tvRef.current;
18095
18241
  if (!h)
18096
18242
  return;
18097
- gui16.SendMessage(
18243
+ gui15.SendMessage(
18098
18244
  h,
18099
18245
  4396,
18100
18246
  0,
@@ -18110,7 +18256,7 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onS
18110
18256
  return;
18111
18257
  const hItem = keyMapRef.current.get(selKey);
18112
18258
  if (hItem !== void 0)
18113
- gui16.SendMessage(h, 4363, 9, hItem);
18259
+ gui15.SendMessage(h, 4363, 9, hItem);
18114
18260
  }, [selKey]);
18115
18261
  return (0, import_jsx_runtime14.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, ref, onEvent: (e) => {
18116
18262
  if (e.msg === 78) {
@@ -18119,7 +18265,7 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onS
18119
18265
  const h = tvRef.current;
18120
18266
  if (!h)
18121
18267
  return;
18122
- const hCaret = gui16.SendMessage(h, 4362, 9, 0);
18268
+ const hCaret = gui15.SendMessage(h, 4362, 9, 0);
18123
18269
  const node = hItemMapRef.current.get(hCaret) ?? null;
18124
18270
  const key = node?.key ?? null;
18125
18271
  if (!isControlled)
@@ -18137,24 +18283,24 @@ var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
18137
18283
  var import_react17 = __toESM(require_react(), 1);
18138
18284
 
18139
18285
  // _build/lib/windows/comdlg32.js
18140
- var b3 = (name, sig) => bind("comdlg32.dll", name, sig);
18141
- var GetOpenFileName = /* @__PURE__ */ b3("GetOpenFileNameW", "<OPENFILENAMEW>ptr -> u32");
18286
+ var b4 = (name, sig) => bind("comdlg32.dll", name, sig);
18287
+ var GetOpenFileName = /* @__PURE__ */ b4("GetOpenFileNameW", "<OPENFILENAMEW>ptr -> u32");
18142
18288
 
18143
18289
  // _build/lib/windows/shell32.js
18144
- var b4 = (name, sig, encoders) => bind("shell32.dll", name, sig, encoders);
18145
- var SHBrowseForFolder = /* @__PURE__ */ b4("SHBrowseForFolderW", "<BROWSEINFOW>ptr -> <>ptr");
18146
- var SHGetPathFromIDList = /* @__PURE__ */ b4("SHGetPathFromIDListW", "<>ptr <BYTE>ptr -> u32");
18290
+ var b5 = (name, sig, encoders) => bind("shell32.dll", name, sig, encoders);
18291
+ var SHBrowseForFolder = /* @__PURE__ */ b5("SHBrowseForFolderW", "<BROWSEINFOW>ptr -> <>ptr");
18292
+ var SHGetPathFromIDList = /* @__PURE__ */ b5("SHGetPathFromIDListW", "<>ptr <BYTE>ptr -> u32");
18147
18293
  var Shell_NotifyIconGetRect = (() => {
18148
18294
  try {
18149
- return b4("Shell_NotifyIconGetRect", "<NOTIFYICONIDENTIFIER>ptr <RECT>ptr -> i32", { NOTIFYICONIDENTIFIER });
18295
+ return b5("Shell_NotifyIconGetRect", "<NOTIFYICONIDENTIFIER>ptr <RECT>ptr -> i32", { NOTIFYICONIDENTIFIER });
18150
18296
  } catch {
18151
18297
  return null;
18152
18298
  }
18153
18299
  })();
18154
18300
 
18155
18301
  // _build/lib/windows/ole32.js
18156
- var b5 = (name, sig) => bind("ole32.dll", name, sig);
18157
- var CoTaskMemFree = /* @__PURE__ */ b5("CoTaskMemFree", "<>ptr -> void");
18302
+ var b6 = (name, sig) => bind("ole32.dll", name, sig);
18303
+ var CoTaskMemFree = /* @__PURE__ */ b6("CoTaskMemFree", "<>ptr -> void");
18158
18304
 
18159
18305
  // _build/lib/react-qw/components/PathPicker.js
18160
18306
  function openFileDialog(owner, filter, title, multiple) {
@@ -18249,7 +18395,7 @@ var rootMap = /* @__PURE__ */ new Map();
18249
18395
  function ensureDefaultClass() {
18250
18396
  if (defaultClassRegistered)
18251
18397
  return DEFAULT_CLASS;
18252
- gui17.RegisterClass(DEFAULT_CLASS, (hwnd2, msg, wParam, lParam) => {
18398
+ gui16.RegisterClass(DEFAULT_CLASS, (hwnd2, msg, wParam, lParam) => {
18253
18399
  const entry = rootMap.get(hwnd2);
18254
18400
  if (msg === 2 && entry) {
18255
18401
  rootMap.delete(hwnd2);
@@ -18275,15 +18421,27 @@ function createRoot(container) {
18275
18421
  const ws = (cfg.ws ?? 0) | 13565952;
18276
18422
  const w = (cfg.width ?? 800) * scaleFactor;
18277
18423
  const h = (cfg.height ?? 600) * scaleFactor;
18278
- const [sw, sh] = [GetSystemMetrics(0), GetSystemMetrics(1)];
18424
+ const [sw, sh] = [GetSystemMetrics(
18425
+ 0
18426
+ /* SysMetrics.CXSCREEN */
18427
+ ), GetSystemMetrics(
18428
+ 1
18429
+ /* SysMetrics.CYSCREEN */
18430
+ )];
18279
18431
  const x = cfg.x === void 0 ? (sw - w) / 2 | 0 : cfg.x === -2147483648 ? -2147483648 : cfg.x * scaleFactor;
18280
18432
  const y = cfg.y === void 0 ? (sh - h) / 2 | 0 : cfg.y === -2147483648 ? -2147483648 : cfg.y * scaleFactor;
18281
- const hwin = gui17.CreateWindow(className, cfg.text || "", ws, x, y, w, h, null, null);
18433
+ const hwin = gui16.CreateWindow(className, cfg.text || "", ws, x, y, w, h, null, null);
18282
18434
  if (!hwin)
18283
18435
  throw new Error("CreateWindow failed");
18284
18436
  hwnd2 = hwin;
18285
- if (!cfg.noShowWindow)
18286
- gui17.ShowWindow(hwnd2);
18437
+ if (!cfg.noShowWindow) {
18438
+ ShowWindow(
18439
+ hwnd2,
18440
+ 1
18441
+ /* ShowWindowCmd.SHOWNORMAL */
18442
+ );
18443
+ UpdateWindow(hwnd2);
18444
+ }
18287
18445
  } else {
18288
18446
  hwnd2 = container;
18289
18447
  }
@@ -18311,14 +18469,14 @@ function render(element, containerOrConfig, _callback) {
18311
18469
  }
18312
18470
 
18313
18471
  // _build/examples/test_react_lazy.js
18314
- gui18.RegisterClass("LazyTest", (hwnd2, msg, wParam, lParam) => {
18472
+ gui17.RegisterClass("LazyTest", (hwnd2, msg, wParam, lParam) => {
18315
18473
  if (!hwnd2)
18316
- return gui18.DefWindowProc(hwnd2, msg, wParam, lParam);
18474
+ return gui17.DefWindowProc(hwnd2, msg, wParam, lParam);
18317
18475
  if (msg === 2) {
18318
- gui18.PostQuitMessage(0);
18476
+ PostQuitMessage(0);
18319
18477
  return 0;
18320
18478
  }
18321
- return gui18.DefWindowProc(hwnd2, msg, wParam, lParam);
18479
+ return gui17.DefWindowProc(hwnd2, msg, wParam, lParam);
18322
18480
  });
18323
18481
  function SimpleComponent() {
18324
18482
  return (0, import_jsx_runtime16.jsx)("w", { type: "STATIC", text: "Hello from lazy component!", ws: 1073741824 | 268435456, style: { width: 300, height: 30 } });
@@ -18334,9 +18492,13 @@ function App() {
18334
18492
  setShow(!show);
18335
18493
  } }), show && (0, import_jsx_runtime16.jsx)(import_react18.Suspense, { fallback: (0, import_jsx_runtime16.jsx)("w", { type: "STATIC", text: "Loading...", ws: 1073741824 | 268435456, style: { width: 200, height: 30 } }), children: (0, import_jsx_runtime16.jsx)(LazySimple, {}) })] });
18336
18494
  }
18337
- var hwnd = gui18.CreateWindow("LazyTest", "React.lazy Test", 13565952, 200, 200, 400, 300, null, null);
18495
+ var hwnd = gui17.CreateWindow("LazyTest", "React.lazy Test", 13565952, 200, 200, 400, 300, null, null);
18338
18496
  if (hwnd) {
18339
- gui18.ShowWindow(hwnd);
18497
+ ShowWindow(
18498
+ hwnd,
18499
+ 1
18500
+ /* ShowWindowCmd.SHOWNORMAL */
18501
+ );
18340
18502
  render((0, import_jsx_runtime16.jsx)(App, {}), hwnd);
18341
18503
  }
18342
18504
  /*! Bundled license information: