@softistx/material 3.248.0 → 3.249.0

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 (223) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +6 -2
  3. package/dist/adopt-styles-C3MfGnxE.js +20 -0
  4. package/dist/{async-slice-C5HfFq1M.js → async-slice-DdEr7vFx.js} +1 -1
  5. package/dist/{audio-player-2kKst8lH.js → audio-player-DMYszRGT.js} +3 -3
  6. package/dist/{audio-player-viewer-D9DsYBcy.js → audio-player-viewer-z13yCjo4.js} +2 -2
  7. package/dist/{autocomplete-JuRCjl48.js → autocomplete-Bgf_AJ6U.js} +11 -11
  8. package/dist/{avatar-CvvdaBu4.js → avatar-WvTropuJ.js} +1 -1
  9. package/dist/blank-placeholder-DZIFJ0DG.js +17 -0
  10. package/dist/{breadcrumb-DacRqg91.js → breadcrumb-DYa6pVsq.js} +5 -5
  11. package/dist/{button-CpUMPIdk.js → button-RsWgka2v.js} +1 -1
  12. package/dist/{calculator-BYgFgWHL.js → calculator-DPHCuAZy.js} +11 -11
  13. package/dist/calculator-field.js +6 -6
  14. package/dist/{calculator-segment-DCHWZy6b.js → calculator-segment-Ckn9Fua9.js} +1 -1
  15. package/dist/calculator.js +1 -1
  16. package/dist/canvas-BShNj4yp.js +144 -0
  17. package/dist/capture-outputs-qcYUPW6K.js +174 -0
  18. package/dist/capture-toolbar.css +2 -0
  19. package/dist/capture-toolbar.js +858 -0
  20. package/dist/capture.js +53 -139
  21. package/dist/charts.js +3 -3
  22. package/dist/{chip-CjJPmAYO.js → chip-tyDM0lpO.js} +2 -2
  23. package/dist/{code-editor-nNcxtslA.js → code-editor-gHHXEwF-.js} +6 -6
  24. package/dist/code-editor.js +6 -6
  25. package/dist/{code-file-viewer-CcESl49v.js → code-file-viewer-CYQcskvt.js} +4 -4
  26. package/dist/{code-language-items-CW8_Si05.js → code-language-items-DDFuDf_E.js} +2 -2
  27. package/dist/{components-BdMaUeOm.js → components-BbAylWQW.js} +16711 -20831
  28. package/dist/components.js +83 -79
  29. package/dist/{confirm-dialog-B2eonW2X.js → confirm-dialog-IHvPA3O2.js} +4 -4
  30. package/dist/{conversion-variant-DZm_xgUK.js → conversion-variant-MWTjnFnG.js} +5 -5
  31. package/dist/{currency-field-UIkYAlvP.js → currency-field-Bd9od1Ee.js} +5 -5
  32. package/dist/{detail-panel-header-CL2_tUG0.js → detail-panel-header-D2a63Sk3.js} +1 -1
  33. package/dist/{details-content-CPzj3vUr.js → details-content-CnN_ukTA.js} +6 -6
  34. package/dist/{details-header-band-D-CyB_Xx.js → details-header-band-wcgmC7qC.js} +5 -5
  35. package/dist/{details-host-BvYgFIWx.js → details-host-DKEaGH4P.js} +1 -1
  36. package/dist/{details-sheet-D4PTV_jR.js → details-sheet-CtNM4oDU.js} +2 -2
  37. package/dist/{details-shell-D4XoPRBu.js → details-shell-DZ80h6mN.js} +1 -1
  38. package/dist/{dialog-CleLsHkZ.js → dialog-DwUxG2-o.js} +1 -1
  39. package/dist/{dialog-app-bar-CLC990e6.js → dialog-app-bar-BsJ4UwKb.js} +2 -2
  40. package/dist/dist-Cb17ixQs.js +16 -0
  41. package/dist/dist-CyqFzDZ6.js +11 -0
  42. package/dist/dnd.js +1 -1
  43. package/dist/draw.js +1 -1
  44. package/dist/{drop-overlay-BTkVfscF.js → drop-overlay-B26hx0-T.js} +2 -2
  45. package/dist/{dropdown-menu-BoJC2DEH.js → dropdown-menu-D-PRbHaP.js} +1 -1
  46. package/dist/{editable-section-CTRGfbLJ.js → editable-section-DPmF1flG.js} +3 -3
  47. package/dist/editor.js +14 -14
  48. package/dist/embed-chunks/{avatar-GlGqPU7B.js → avatar-CSDtFCum.js} +1 -1
  49. package/dist/embed-chunks/{dist-BrYZYfsJ.js → dist-C-lAK_LC.js} +2 -2
  50. package/dist/embed-chunks/{emoji-picker-BSYBi_C8.js → emoji-picker-BWDQFdQu.js} +4 -4
  51. package/dist/embed-chunks/{mention-list-NW43QcRq.js → mention-list-CdUr0h3X.js} +3 -3
  52. package/dist/embed-chunks/{nxgt-theme-provider-B1aeqDja.js → nxgt-theme-provider-DdDsiEPj.js} +2 -2
  53. package/dist/embed-chunks/{switch-control-ChcowM3u.js → switch-control-B95ZWvna.js} +1 -1
  54. package/dist/embed-chunks/{tabs-root-CY-uLp1C.js → tabs-root-MF9lEHbq.js} +2 -2
  55. package/dist/embed-chunks/{use-shape-morph-NrJQMv7i.js → use-shape-morph-D1MOoQ4T.js} +110 -2
  56. package/dist/embed-chunks/{useLatest-B57qw3XH.js → useLatest-RGIW0nya.js} +1 -1
  57. package/dist/embed.js +626 -613
  58. package/dist/{emoji-picker-DZbTd3Fr.js → emoji-picker-DabgsEVQ.js} +7 -7
  59. package/dist/{empty-state-DBSJDLKL.js → empty-state-BylD7RYH.js} +1 -1
  60. package/dist/{error-state-kauz4If4.js → error-state-BTe_NzTC.js} +2 -2
  61. package/dist/fab-DUnGwNE7.js +41 -0
  62. package/dist/fab-dock-By2pLVh7.js +49 -0
  63. package/dist/{feature-popup-CcXMGFES.js → feature-popup-CW7VS2fx.js} +1 -1
  64. package/dist/{blank-placeholder-DeDn5Xor.js → field-box-BXN-uyrv.js} +1 -16
  65. package/dist/{field-group-BpV74Ttu.js → field-group-B2Ozd5Jn.js} +1 -1
  66. package/dist/{file-dialogs-CbdvmY__.js → file-dialogs-CgEXaCev.js} +7 -7
  67. package/dist/{file-manager-shell-DLaJ5Z_L.js → file-manager-shell-Tqduf5lh.js} +21 -21
  68. package/dist/{file-preview-host-RhZvGGqC.js → file-preview-host-CM4pV3ZD.js} +2367 -2384
  69. package/dist/{file-viewer-body-DM3RkXGn.js → file-viewer-body-DrWFmnp4.js} +3 -3
  70. package/dist/{file-viewer-dialog-impl-ei5EYj8k.js → file-viewer-dialog-impl-DZpuZZ7x.js} +2 -2
  71. package/dist/files-drop.js +1 -1
  72. package/dist/files-picker.js +8 -8
  73. package/dist/files.js +3 -3
  74. package/dist/{financial-variant-BNdOqzA5.js → financial-variant-ljdP0JL4.js} +5 -5
  75. package/dist/{flow-diagram-BBB6r8--.js → flow-diagram-DwUnyl0u.js} +1 -1
  76. package/dist/{gallery-CIIJHpmj.js → gallery-DfN2KE4Y.js} +11 -11
  77. package/dist/{gallery-file-viewer-DkshswFr.js → gallery-file-viewer-BfFWfLIF.js} +3 -3
  78. package/dist/{gl-markers-abqcNuYT.js → gl-markers-CBNFeWIk.js} +3 -3
  79. package/dist/{hooks-D6lOSXA5.js → hooks-DiAhgchz.js} +3 -3
  80. package/dist/hooks.js +3 -3
  81. package/dist/i18n.js +3 -3
  82. package/dist/{icon-button-GKYj7uC4.js → icon-button-D-gi4Plg.js} +1 -1
  83. package/dist/image-editor-mmhbsqs-.js +4423 -0
  84. package/dist/image-editor.css +1 -1
  85. package/dist/image-editor.js +1124 -848
  86. package/dist/image-markup-editor-D-QkZWKf.js +24 -0
  87. package/dist/input-CWf3Apid.js +18 -0
  88. package/dist/input-box-moFuoMt0.js +15 -0
  89. package/dist/{input-group-CKO68Pyi.js → input-group-Bb8sAFRF.js} +3 -2
  90. package/dist/{item-details-l_-rk3Hj.js → item-details-BWdHMfsS.js} +7 -7
  91. package/dist/keypad.js +2 -2
  92. package/dist/lib/capture/engine/canvas.d.ts +17 -0
  93. package/dist/lib/capture/engine/capture.d.ts +19 -0
  94. package/dist/lib/capture/engine/filters.d.ts +27 -0
  95. package/dist/lib/capture/engine/rect.d.ts +26 -0
  96. package/dist/lib/capture/engine/types.d.ts +66 -0
  97. package/dist/lib/capture/index.d.ts +16 -0
  98. package/dist/lib/capture/modes/capture-mode.d.ts +24 -0
  99. package/dist/lib/capture/modes/countdown.d.ts +16 -0
  100. package/dist/lib/capture/modes/full-page.d.ts +14 -0
  101. package/dist/lib/capture/modes/pick-element.d.ts +22 -0
  102. package/dist/lib/capture/modes/scroller.d.ts +13 -0
  103. package/dist/lib/capture/modes/visible.d.ts +3 -0
  104. package/dist/lib/capture-toolbar/index.d.ts +25 -0
  105. package/dist/lib/capture-toolbar/lazy-capture-outputs.d.ts +2 -0
  106. package/dist/lib/capture-toolbar/outputs-encode.d.ts +25 -0
  107. package/dist/lib/capture-toolbar/outputs.d.ts +38 -0
  108. package/dist/lib/capture-toolbar/partials/capture-editor.d.ts +11 -0
  109. package/dist/lib/capture-toolbar/partials/capture-outputs.d.ts +16 -0
  110. package/dist/lib/capture-toolbar/region-overlay.d.ts +15 -0
  111. package/dist/lib/capture-toolbar/screen-capture-toolbar.d.ts +31 -0
  112. package/dist/lib/capture-toolbar/types.d.ts +117 -0
  113. package/dist/lib/capture-toolbar/use-screen-capture.d.ts +16 -0
  114. package/dist/lib/components/ui/media/attachment-list/attachment-list.d.ts +2 -2
  115. package/dist/lib/components/ui/media/image-editor/image-markup-editor.d.ts +11 -3
  116. package/dist/lib/components/ui/media/image-editor/types-edits.d.ts +7 -0
  117. package/dist/lib/components/ui/media/image-editor/types-session.d.ts +1 -1
  118. package/dist/lib/components/ui/media/image-editor/types.d.ts +8 -0
  119. package/dist/lib/embed/index.d.ts +2 -0
  120. package/dist/lib/i18n/resources/resources.d.ts +108 -0
  121. package/dist/lib/i18n/translator.d.ts +1 -1
  122. package/dist/lib/image-editor/index.d.ts +1 -1
  123. package/dist/lib.js +38 -56
  124. package/dist/{list-sheet-D22J9I-K.js → list-sheet-CejfrKJr.js} +1 -1
  125. package/dist/{loading-indicator-sDzxZg8f.js → loading-indicator-BBjOF25N.js} +1 -1
  126. package/dist/main.js +103 -98
  127. package/dist/{map-draw-DfbfT0eJ.js → map-draw-DyRy9SSV.js} +2 -2
  128. package/dist/map-draw.js +5 -5
  129. package/dist/map-static.js +1 -1
  130. package/dist/{map-view-DAx2zvV-.js → map-view-YfuYD3zS.js} +9 -9
  131. package/dist/map-zone-events.js +1 -1
  132. package/dist/map-zone-field.js +7 -7
  133. package/dist/map.js +10 -10
  134. package/dist/{marker-button-D7hEvEZD.js → marker-button-CXBaToHp.js} +1 -1
  135. package/dist/{marker-count-image-CWS3G-k8.js → marker-count-image-DHuzSev9.js} +1 -1
  136. package/dist/material.css +1 -1
  137. package/dist/{measure-manual-Bfvu8B_R.js → measure-manual-CcESmV1d.js} +3 -3
  138. package/dist/{measurement-B-OeWv7j.js → measurement-D2or6yM_.js} +1 -1
  139. package/dist/{media-player-DGXmWK7W.js → media-player-qW9RXFuO.js} +451 -567
  140. package/dist/{media-player-viewer-C3vXYcd8.js → media-player-viewer-DozPiF6T.js} +2 -2
  141. package/dist/{media-surface-BySonDjv.js → media-surface-BJsdNynm.js} +6 -6
  142. package/dist/{mention-list-BpoZHwO6.js → mention-list-z1wnlJgs.js} +2 -2
  143. package/dist/{native-select-Dg4bc7aC.js → native-select-BnDOVnER.js} +1 -1
  144. package/dist/{nxgt-theme-Ob-uFqU_.js → nxgt-theme-EYZ5aFHi.js} +6 -15
  145. package/dist/nxgt-theme-provider-BPXd3h82.js +40 -0
  146. package/dist/outputs-DF-aVqUO.js +81 -0
  147. package/dist/passkey.js +1 -1
  148. package/dist/{pdf-form-filler-DgH52W2Q.js → pdf-form-filler-Ct4eexhZ.js} +34 -34
  149. package/dist/pdf-form.js +2 -2
  150. package/dist/{pdf-reader-Bilz5foK.js → pdf-reader-khpMMEjU.js} +16 -16
  151. package/dist/{pdf-reader-viewer-DwQP2IpV.js → pdf-reader-viewer-B3_TdFOn.js} +2 -2
  152. package/dist/pdf-reader.js +2 -2
  153. package/dist/{percent-field-Ldc7K2wC.js → percent-field-Bu-PmCNR.js} +2 -2
  154. package/dist/{picker-surface-DZQbBgvA.js → picker-surface-THexE1OU.js} +3 -3
  155. package/dist/{popover-DwsaHFrK.js → popover-osl5duoA.js} +1 -1
  156. package/dist/portal-container-provider-fZFUk-ZB.js +11 -0
  157. package/dist/{pos-types-CKDG7pZA.js → pos-types-BPPae99i.js} +1 -1
  158. package/dist/{pos-variant-9nhz-ZzW.js → pos-variant-D6bDUqwV.js} +4 -4
  159. package/dist/print.js +1 -1
  160. package/dist/{programmer-variant-BzwfeMGC.js → programmer-variant-CDlFE24o.js} +2 -2
  161. package/dist/{progress-BBfp7sMi.js → progress-DjHnanxA.js} +2 -2
  162. package/dist/{progress-linear-BOJbHnzd.js → progress-linear-CTJ_U6kY.js} +1 -1
  163. package/dist/{public-I8nb8pCC.js → public-u9u2Osmx.js} +6 -6
  164. package/dist/{rendition-stage-A1nHXYrA.js → rendition-stage-BXjQpfKK.js} +2 -2
  165. package/dist/{rich-code-block-BJERY3N3.js → rich-code-block-DWSzyQRw.js} +5 -5
  166. package/dist/{scientific-variant-st2NBm1K.js → scientific-variant-DCgApH87.js} +2 -2
  167. package/dist/{scroll-area-B3XstZU2.js → scroll-area-BxKiT4Dn.js} +155 -164
  168. package/dist/{search-field-D3AOJr7s.js → search-field-Cgqa2bQf.js} +2 -2
  169. package/dist/{select-DhfzCkun.js → select-BGhRlBh4.js} +166 -179
  170. package/dist/{sheet-B8cO1T5K.js → sheet-BvNVroog.js} +1 -1
  171. package/dist/{signature-dialog-BNLMPgao.js → signature-dialog-x--_QWRB.js} +5 -5
  172. package/dist/signature.js +1 -1
  173. package/dist/{site-footer-cta-Cx7zsvkq.js → site-footer-cta-B3Kfqpep.js} +4 -4
  174. package/dist/{site-footer-link-Di8IMIw0.js → site-footer-link-SFHrO4ld.js} +1 -1
  175. package/dist/{size-slot-D1cKqb09.js → size-slot-Cb-W2Zm4.js} +1 -1
  176. package/dist/{sortable-provider-DrLnoygf.js → sortable-provider-KRScvvYx.js} +2 -2
  177. package/dist/{spinner-BpH9tE8R.js → spinner-DpB6XvJJ.js} +1 -1
  178. package/dist/switch-c_6OtXzW.js +125 -0
  179. package/dist/{tabs-root-BUnIfDah.js → tabs-root-C2n3K_Yv.js} +1 -1
  180. package/dist/{tags-form-BwqR4UVj.js → tags-form-BKB9fP03.js} +5 -5
  181. package/dist/{text-field-CFCHo07X.js → text-field-Dl7xTxZe.js} +2 -2
  182. package/dist/{textarea-B_iMDYgM.js → textarea-C3BGZELU.js} +1 -1
  183. package/dist/{textarea-field-DIOGxyUd.js → textarea-field-mqWhhbis.js} +2 -2
  184. package/dist/theme-picker.js +5 -4
  185. package/dist/{theme-toggle-CsBe64lm.js → theme-toggle-K-n5eq0T.js} +3 -3
  186. package/dist/theme-value-CD2nDrj_.js +12 -0
  187. package/dist/themes.js +15 -48
  188. package/dist/{toasts-McZnLRHP.js → toasts-DFLecXh0.js} +5 -5
  189. package/dist/{toggle-group-DKN1XLBS.js → toggle-group-DMDjNJWx.js} +1 -1
  190. package/dist/{toolbar-group-BmzGP_JO.js → toolbar-group-bttMdvg4.js} +1 -1
  191. package/dist/{toolbar-item-slot-BnqQLkVd.js → toolbar-item-slot-CBn3YjeE.js} +1 -1
  192. package/dist/{toolbar-items-C9uasXZ2.js → toolbar-items-zL5TYLf2.js} +4 -4
  193. package/dist/{toolbar-keep-focus-Vc5V-dX2.js → toolbar-keep-focus-C6bnzvpE.js} +2 -2
  194. package/dist/{tracked-layer-CjCXB_O6.js → tracked-layer-CYdLWRK-.js} +4 -4
  195. package/dist/{translate-material-C-qVvGLn.js → translate-material-DZNgWjYu.js} +1 -1
  196. package/dist/{translator-BrzI307E.js → translator-CrIFDzAz.js} +110 -2
  197. package/dist/{tree-DOAs456A.js → tree-CFXDccIe.js} +1 -1
  198. package/dist/{upload-host-ZpSSql8v.js → upload-host-DDktVohu.js} +9 -8
  199. package/dist/{use-calculator-keyboard-Ss25SRoM.js → use-calculator-keyboard-BWkYuIw5.js} +1 -1
  200. package/dist/{use-chat-composer-DopDN-zP.js → use-chat-composer-C1Qlnw2i.js} +20 -20
  201. package/dist/{use-file-meta-DyJX0JVs.js → use-file-meta-DcfQCh52.js} +1 -1
  202. package/dist/{use-heading-spy-CA2IAqMe.js → use-heading-spy-B9xEMHbZ.js} +2 -2
  203. package/dist/use-image-preview-BNq_RQm5.js +20 -0
  204. package/dist/{use-item-entries-CYbS5otl.js → use-item-entries-BKQHcWFx.js} +1 -1
  205. package/dist/{use-material-translation-eYySryw3.js → use-material-translation-ZEUtduro.js} +1 -1
  206. package/dist/{use-media-viewer-DoNdrzhN.js → use-media-viewer-DViJNx75.js} +1 -1
  207. package/dist/{use-text-preview-BQE4U9cT.js → use-text-preview-Ci97JKKo.js} +2 -2
  208. package/dist/{use-unsaved-guard-CSfDvdxd.js → use-unsaved-guard-CWlHEvjN.js} +2 -2
  209. package/dist/{viewer-CXF1dAv0.js → viewer-DDPJOxBt.js} +5 -5
  210. package/dist/{viewer-stage-class-CpyA8o-M.js → viewer-stage-class-DJ1uod4l.js} +4 -4
  211. package/dist/{viewer-states-BXyCdNhE.js → viewer-states-DkaPBkK4.js} +3 -3
  212. package/dist/{virtual-layer-rows-DHy8vAup.js → virtual-layer-rows-DKejQ_Jd.js} +1 -1
  213. package/dist/visible-B-IFZ4Nv.js +475 -0
  214. package/docs/components/media-and-files.md +1 -1
  215. package/docs/guides/capture.md +248 -0
  216. package/docs/guides/csp.md +1 -1
  217. package/docs/guides/embed.md +50 -2
  218. package/docs/roadmap.md +2 -1
  219. package/docs/troubleshooting.md +56 -0
  220. package/package.json +18 -1
  221. package/dist/fab-dock-DqwbI-5n.js +0 -86
  222. package/dist/input-BaBE_MR_.js +0 -27
  223. /package/dist/{dist-B1qFabLJ.js → dist-B1qFabLJ2.js} +0 -0
@@ -0,0 +1,858 @@
1
+ import { t as e } from "./utils-BLfntITJ.js";
2
+ import { n as t } from "./use-inert-others-C2jaI7YC.js";
3
+ import { c as n, d as r, f as i, n as a, t as o } from "./dropdown-menu-D-PRbHaP.js";
4
+ import { t as s } from "./icon--cTIDybi.js";
5
+ import { t as c } from "./button-RsWgka2v.js";
6
+ import { n as l } from "./translate-material-DZNgWjYu.js";
7
+ import { t as u } from "./use-material-translation-ZEUtduro.js";
8
+ import { t as d } from "./icon-button-D-gi4Plg.js";
9
+ import { r as f } from "./fab-DUnGwNE7.js";
10
+ import { t as p } from "./chip-tyDM0lpO.js";
11
+ import { t as m } from "./portal-container-provider-fZFUk-ZB.js";
12
+ import { t as h } from "./adopt-styles-C3MfGnxE.js";
13
+ import { t as g } from "./nxgt-theme-provider-BPXd3h82.js";
14
+ import { a as _, c as v, g as y, n as b, o as x, r as S, s as C, t as w, u as T } from "./visible-B-IFZ4Nv.js";
15
+ import { r as ee, s as E } from "./canvas-BShNj4yp.js";
16
+ import { a as te, c as ne, i as re, l as ie, n as ae, o as oe, r as se, s as ce, t as le } from "./outputs-DF-aVqUO.js";
17
+ import { Suspense as D, lazy as O, useCallback as k, useEffect as A, useId as ue, useMemo as de, useRef as j, useState as M } from "react";
18
+ import { Fragment as fe, jsx as N, jsxs as P } from "react/jsx-runtime";
19
+ //#region lib/capture-toolbar/lazy-capture-outputs.ts
20
+ var F = O(() => import("./capture-outputs-qcYUPW6K.js").then((e) => ({ default: e.CaptureOutputs }))), pe = O(() => import("./image-markup-editor-D-QkZWKf.js").then((e) => ({ default: e.ImageMarkupEditor })));
21
+ function I({ blob: e, onDone: n, onCancel: r }) {
22
+ let { t: i } = u(), a = j(null), o = t(!0, a);
23
+ return A(() => {
24
+ let e = document.activeElement;
25
+ return a.current?.focus({ preventScroll: !0 }), () => e?.focus?.({ preventScroll: !0 });
26
+ }, []), /* @__PURE__ */ N("div", {
27
+ ref: o,
28
+ tabIndex: -1,
29
+ onKeyDown: (e) => {
30
+ let t = e.target;
31
+ e.key !== "Escape" || e.defaultPrevented || t.closest("input, textarea, [contenteditable=\"true\"]") || (e.stopPropagation(), r());
32
+ },
33
+ role: "dialog",
34
+ "aria-modal": "true",
35
+ "aria-label": i("material.capture.editor", "Edit the capture"),
36
+ "data-slot": "capture-editor",
37
+ className: "fixed inset-0 z-[2147483647] bg-background outline-none",
38
+ children: /* @__PURE__ */ N(D, {
39
+ fallback: /* @__PURE__ */ N("p", {
40
+ role: "status",
41
+ className: "sr-only",
42
+ children: i("material.capture.editor-loading", "Opening the editor")
43
+ }),
44
+ children: /* @__PURE__ */ N(pe, {
45
+ src: e,
46
+ fileName: "capture",
47
+ crop: !0,
48
+ toolbar: "floating",
49
+ saveLabel: i("material.capture.done", "Done"),
50
+ onSave: (e) => n(e.blob),
51
+ onCancel: r,
52
+ className: "h-full"
53
+ })
54
+ })
55
+ });
56
+ }
57
+ function me(e, t, n, r = 120, i = 4) {
58
+ let a = r / i;
59
+ return {
60
+ sx: (e - a / 2) * n,
61
+ sy: (t - a / 2) * n,
62
+ sw: a * n,
63
+ sh: a * n
64
+ };
65
+ }
66
+ var L = (e, t) => e.x < t.x + t.w && t.x < e.x + e.w && e.y < t.y + t.h && t.y < e.y + e.h, R = {
67
+ w: 100,
68
+ h: 28
69
+ }, z = {
70
+ w: 184,
71
+ h: 44
72
+ }, B = 8, V = (e) => e.y >= 40, H = (e, t) => e.y + e.h + 56 <= t;
73
+ function he(e, t) {
74
+ let n = e.x + e.w / 2, r = V(e) ? e.y - 8 - R.h : e.y + 8, i = H(e, t) ? e.y + e.h + 12 : e.y + e.h - 12 - z.h, a = (e, t, r) => ({
75
+ x: n - e / 2 - B,
76
+ y: r - B,
77
+ w: e + 2 * B,
78
+ h: t + 2 * B
79
+ });
80
+ return [a(R.w, R.h, r), a(z.w, z.h, i)];
81
+ }
82
+ function ge(e, t, n, { avoid: r = [], size: i = 120, gap: a = 16, room: o = 28 } = {}) {
83
+ if (r.some((n) => L({
84
+ x: e,
85
+ y: t,
86
+ w: 1,
87
+ h: 1
88
+ }, n))) return null;
89
+ let s = i + o, c = [e + a, e - a - i], l = [t + a, t - a - s], u = [
90
+ [c[0], l[0]],
91
+ [c[1], l[0]],
92
+ [c[0], l[1]],
93
+ [c[1], l[1]]
94
+ ];
95
+ for (let [e, t] of u) {
96
+ let a = {
97
+ x: e,
98
+ y: t,
99
+ w: i,
100
+ h: s
101
+ };
102
+ if (e >= 0 && t >= 0 && e + i <= n.w && t + s <= n.h && !r.some((e) => L(a, e))) return {
103
+ left: e,
104
+ top: t
105
+ };
106
+ }
107
+ return null;
108
+ }
109
+ //#endregion
110
+ //#region lib/capture-toolbar/partials/region-guides.tsx
111
+ function _e({ rect: t }) {
112
+ let { t: n } = u();
113
+ return /* @__PURE__ */ N("div", {
114
+ "data-slot": "region-snap",
115
+ className: "pointer-events-none absolute rounded-sm border-2 border-dashed border-primary bg-[color-mix(in_oklab,var(--primary)_12%,transparent)]",
116
+ style: {
117
+ left: t.x,
118
+ top: t.y,
119
+ width: t.w,
120
+ height: t.h
121
+ },
122
+ children: /* @__PURE__ */ P("span", {
123
+ className: e("absolute left-0 inline-flex items-center gap-1 rounded-full bg-primary px-2 py-0.5 text-xs font-medium text-primary-foreground", t.y >= 28 ? "bottom-full mb-1" : "top-1 left-1"),
124
+ children: [/* @__PURE__ */ N(s, {
125
+ name: "crosshairs",
126
+ "aria-hidden": "true",
127
+ className: "size-3"
128
+ }), n("material.capture.region.snap", "Snap")]
129
+ })
130
+ });
131
+ }
132
+ function ve({ x: e, y: t, source: n, avoid: r }) {
133
+ let { t: i } = u(), a = j(null);
134
+ A(() => {
135
+ let r = a.current?.getContext("2d");
136
+ if (!r) return;
137
+ let { sx: i, sy: o, sw: s, sh: c } = me(e, t, n.scale);
138
+ r.clearRect(0, 0, 120, 120), r.imageSmoothingEnabled = !1, r.drawImage(n.canvas, i, o, s, c, 0, 0, 120, 120);
139
+ }, [
140
+ e,
141
+ t,
142
+ n
143
+ ]);
144
+ let o = ge(e, t, {
145
+ w: window.innerWidth,
146
+ h: window.innerHeight
147
+ }, { avoid: r });
148
+ return o ? /* @__PURE__ */ P("div", {
149
+ "data-slot": "region-loupe",
150
+ "aria-hidden": "true",
151
+ className: "pointer-events-none absolute flex flex-col items-center gap-1 pointer-coarse:hidden",
152
+ style: {
153
+ left: o.left,
154
+ top: o.top,
155
+ width: 120
156
+ },
157
+ children: [/* @__PURE__ */ P("div", {
158
+ className: "relative overflow-hidden rounded-full border-2 border-primary bg-card shadow-md",
159
+ style: {
160
+ width: 120,
161
+ height: 120
162
+ },
163
+ children: [
164
+ /* @__PURE__ */ N("canvas", {
165
+ ref: a,
166
+ width: 120,
167
+ height: 120,
168
+ className: "size-full"
169
+ }),
170
+ /* @__PURE__ */ N("span", { className: "absolute inset-y-0 left-1/2 w-px bg-primary/70" }),
171
+ /* @__PURE__ */ N("span", { className: "absolute inset-x-0 top-1/2 h-px bg-primary/70" })
172
+ ]
173
+ }), /* @__PURE__ */ N("span", {
174
+ className: "rounded-full bg-card px-2 py-0.5 text-xs tabular-nums text-card-foreground shadow-sm",
175
+ children: i("material.capture.region.coords", "{x}, {y}", {
176
+ x: Math.round(e),
177
+ y: Math.round(t)
178
+ })
179
+ })]
180
+ }) : null;
181
+ }
182
+ //#endregion
183
+ //#region lib/capture-toolbar/region-geometry.ts
184
+ var ye = [
185
+ "nw",
186
+ "n",
187
+ "ne",
188
+ "e",
189
+ "se",
190
+ "s",
191
+ "sw",
192
+ "w"
193
+ ], U = (e, t, n) => Math.min(Math.max(e, t), n);
194
+ function W(e, t) {
195
+ let n = Math.min(e.w, t.w), r = Math.min(e.h, t.h);
196
+ return {
197
+ x: U(e.x, 0, t.w - n),
198
+ y: U(e.y, 0, t.h - r),
199
+ w: n,
200
+ h: r
201
+ };
202
+ }
203
+ function G(e, t, n, r) {
204
+ return W({
205
+ ...e,
206
+ x: e.x + t,
207
+ y: e.y + n
208
+ }, r);
209
+ }
210
+ function K(e, t, n, r) {
211
+ let i = e.x, a = e.x + e.w, o = e.y, s = e.y + e.h, c = U(n.x, 0, r.w), l = U(n.y, 0, r.h);
212
+ return t.includes("w") && (i = c), t.includes("e") && (a = c), t.includes("n") && (o = l), t.includes("s") && (s = l), {
213
+ x: Math.min(i, a),
214
+ y: Math.min(o, s),
215
+ w: Math.abs(a - i),
216
+ h: Math.abs(s - o)
217
+ };
218
+ }
219
+ function q(e) {
220
+ return !!e && e.w >= 8 && e.h >= 8;
221
+ }
222
+ function be(e, t, n, r) {
223
+ let i = n.shift ? 10 : 1, a = t === "ArrowLeft" ? [-i, 0] : t === "ArrowRight" ? [i, 0] : t === "ArrowUp" ? [0, -i] : t === "ArrowDown" ? [0, i] : null;
224
+ return a ? n.resize ? K(e, "se", {
225
+ x: e.x + e.w + a[0],
226
+ y: e.y + e.h + a[1]
227
+ }, r) : G(e, a[0], a[1], r) : null;
228
+ }
229
+ function xe(e, t) {
230
+ let n = W({
231
+ x: e.left,
232
+ y: e.top,
233
+ w: e.width,
234
+ h: e.height
235
+ }, t);
236
+ return q(n) ? n : null;
237
+ }
238
+ //#endregion
239
+ //#region lib/capture-toolbar/partials/region-selection.tsx
240
+ var Se = {
241
+ nw: "left-0 top-0 cursor-nwse-resize",
242
+ n: "left-1/2 top-0 cursor-ns-resize",
243
+ ne: "left-full top-0 cursor-nesw-resize",
244
+ e: "left-full top-1/2 cursor-ew-resize",
245
+ se: "left-full top-full cursor-nwse-resize",
246
+ s: "left-1/2 top-full cursor-ns-resize",
247
+ sw: "left-0 top-full cursor-nesw-resize",
248
+ w: "left-0 top-1/2 cursor-ew-resize"
249
+ };
250
+ function Ce({ rect: t, usable: n, onConfirm: r, onCancel: i }) {
251
+ let { t: a } = u(), o = V(t), s = H(t, window.innerHeight);
252
+ return /* @__PURE__ */ P("div", {
253
+ "data-slot": "region-selection",
254
+ className: "pointer-events-none absolute border-[3px] border-primary shadow-[0_0_0_100vmax_color-mix(in_oklab,black_55%,transparent)]",
255
+ style: {
256
+ left: t.x,
257
+ top: t.y,
258
+ width: t.w,
259
+ height: t.h
260
+ },
261
+ children: [
262
+ /* @__PURE__ */ N("output", {
263
+ className: e("absolute left-1/2 -translate-x-1/2 whitespace-nowrap rounded-full bg-primary px-3 py-1 text-xs font-medium tabular-nums text-primary-foreground shadow-sm", o ? "bottom-full mb-2" : "top-2"),
264
+ children: a("material.capture.region.size", "{w} × {h} px", {
265
+ w: Math.round(t.w),
266
+ h: Math.round(t.h)
267
+ })
268
+ }),
269
+ ye.map((t) => /* @__PURE__ */ N("span", {
270
+ "data-handle": t,
271
+ "aria-hidden": "true",
272
+ className: e("pointer-events-auto absolute size-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-[3px] border-primary bg-background pointer-coarse:size-5", "after:absolute after:-inset-2.5 after:content-[\"\"]", Se[t])
273
+ }, t)),
274
+ /* @__PURE__ */ P("div", {
275
+ "data-region-action": !0,
276
+ className: e("pointer-events-auto absolute left-1/2 flex -translate-x-1/2 gap-2 rounded-full bg-card p-1 shadow-md", s ? "top-full mt-3" : "bottom-3"),
277
+ children: [/* @__PURE__ */ N(c, {
278
+ variant: "tonal",
279
+ size: "sm",
280
+ onClick: i,
281
+ children: a("material.capture.cancel", "Cancel")
282
+ }), /* @__PURE__ */ N(c, {
283
+ size: "sm",
284
+ disabled: !n,
285
+ onClick: r,
286
+ children: a("material.capture.capture", "Capture")
287
+ })]
288
+ })
289
+ ]
290
+ });
291
+ }
292
+ //#endregion
293
+ //#region lib/capture-toolbar/use-loupe-source.ts
294
+ function we() {
295
+ let [e, t] = M(null);
296
+ return A(() => {
297
+ if (window.matchMedia?.("(pointer: coarse)").matches) return;
298
+ let e = !0, n = null;
299
+ return w().then(({ canvas: r, scale: i }) => {
300
+ n = r, e ? t({
301
+ canvas: r,
302
+ scale: i
303
+ }) : r.width = 0;
304
+ }).catch(() => {}), () => {
305
+ e = !1, n && (n.width = 0);
306
+ };
307
+ }, []), e;
308
+ }
309
+ //#endregion
310
+ //#region lib/capture-toolbar/region-drag.ts
311
+ var Te = (e, t, n) => t >= e.x && t <= e.x + e.w && n >= e.y && n <= e.y + e.h;
312
+ function Ee(e, t, n, r) {
313
+ let i = e.closest("[data-handle]")?.dataset.handle;
314
+ return i ? {
315
+ kind: "handle",
316
+ handle: i
317
+ } : r && Te(r, t, n) ? {
318
+ kind: "move",
319
+ x: t,
320
+ y: n,
321
+ from: r
322
+ } : {
323
+ kind: "draw",
324
+ x: t,
325
+ y: n,
326
+ moved: !1
327
+ };
328
+ }
329
+ function De(e, t, n, r) {
330
+ return e.kind === "handle" ? t ? K(t, e.handle, n, r) : null : e.kind === "move" ? G(e.from, n.x - e.x, n.y - e.y, r) : !(Math.hypot(n.x - e.x, n.y - e.y) >= 4) && !e.moved ? null : (e.moved = !0, K({
331
+ x: e.x,
332
+ y: e.y,
333
+ w: 0,
334
+ h: 0
335
+ }, "se", n, r));
336
+ }
337
+ function Oe(e, t, n, r) {
338
+ if (e.key === "Escape") return { kind: "cancel" };
339
+ if (e.key === "Enter" && n) return { kind: "confirm" };
340
+ if (!t) return null;
341
+ let i = be(t, e.key, {
342
+ shift: e.shiftKey,
343
+ resize: e.altKey
344
+ }, r);
345
+ return i ? {
346
+ kind: "nudge",
347
+ rect: i
348
+ } : null;
349
+ }
350
+ //#endregion
351
+ //#region lib/capture-toolbar/use-region-selection.ts
352
+ var J = () => ({
353
+ w: window.innerWidth,
354
+ h: window.innerHeight
355
+ });
356
+ function ke(e, t) {
357
+ for (let n of document.elementsFromPoint(e, t)) if (!n.closest("[data-capture-exclude]")) return n === document.documentElement || n === document.body ? null : xe(n.getBoundingClientRect(), J());
358
+ return null;
359
+ }
360
+ var Ae = (e) => ({
361
+ x: Math.round(e.x),
362
+ y: Math.round(e.y),
363
+ w: Math.round(e.w),
364
+ h: Math.round(e.h)
365
+ });
366
+ function je(e, t) {
367
+ let [n, r] = M(null), i = j(null), a = k((e) => {
368
+ i.current = e, r(e);
369
+ }, []), [o, s] = M(null), [c, l] = M(null), [u, d] = M(!1), f = j(null), p = k(() => {
370
+ let t = i.current;
371
+ q(t) && e(Ae(t));
372
+ }, [e]);
373
+ return {
374
+ rect: n,
375
+ pointer: o,
376
+ snap: n || u ? null : c,
377
+ dragging: u,
378
+ confirm: p,
379
+ reset: () => a(null),
380
+ handlers: {
381
+ onPointerDown: (e) => {
382
+ e.target.closest("[data-region-action]") || (e.currentTarget.setPointerCapture(e.pointerId), f.current = Ee(e.target, e.clientX, e.clientY, i.current), d(!0));
383
+ },
384
+ onPointerMove: (e) => {
385
+ let t = {
386
+ x: e.clientX,
387
+ y: e.clientY
388
+ };
389
+ s(t);
390
+ let n = f.current, r = i.current;
391
+ if (!n) {
392
+ l(r ? null : ke(t.x, t.y));
393
+ return;
394
+ }
395
+ let o = De(n, r, t, J());
396
+ o && (n.kind === "draw" && l(null), a(o));
397
+ },
398
+ onPointerUp: () => {
399
+ let e = f.current;
400
+ f.current = null, d(!1), e?.kind === "draw" && !e.moved ? a(c) : e?.kind === "draw" && !q(i.current) && a(null);
401
+ },
402
+ onKeyDown: (e) => {
403
+ let n = i.current, r = Oe(e, n, q(n), J());
404
+ r && (e.preventDefault(), r.kind === "cancel" ? (e.stopPropagation(), t()) : r.kind === "confirm" ? p() : a(r.rect));
405
+ }
406
+ }
407
+ };
408
+ }
409
+ //#endregion
410
+ //#region lib/capture-toolbar/region-overlay.tsx
411
+ function Y({ onSelect: t, onCancel: n }) {
412
+ let { t: r } = u(), i = j(null), a = ue(), o = je(t, n), s = we();
413
+ A(() => i.current?.focus({ preventScroll: !0 }), []);
414
+ let { rect: c, snap: l, pointer: d } = o, f = c ? r("material.capture.region.adjust", "Drag the handles or use the arrow keys. Enter captures, Esc cancels.") : r("material.capture.region.hint", "Drag to select an area, or click an element. Esc cancels.");
415
+ return /* @__PURE__ */ P("div", {
416
+ ref: i,
417
+ [T]: "",
418
+ "data-slot": "region-overlay",
419
+ role: "group",
420
+ "aria-label": r("material.capture.region.label", "Select the area to capture"),
421
+ "aria-describedby": a,
422
+ tabIndex: 0,
423
+ className: "fixed inset-0 z-[2147483646] cursor-crosshair touch-none select-none outline-none",
424
+ ...o.handlers,
425
+ children: [
426
+ !c && /* @__PURE__ */ N("div", { className: "absolute inset-0 bg-black/55" }),
427
+ l && /* @__PURE__ */ N(_e, { rect: l }),
428
+ c && /* @__PURE__ */ N(Ce, {
429
+ rect: c,
430
+ usable: q(c),
431
+ onConfirm: o.confirm,
432
+ onCancel: n
433
+ }),
434
+ /* @__PURE__ */ N("p", {
435
+ id: a,
436
+ className: e("pointer-events-none", c ? "sr-only" : "absolute left-1/2 top-4 max-w-[calc(100%-2rem)] -translate-x-1/2 rounded-full bg-card px-4 py-2 text-center text-sm text-card-foreground shadow-md"),
437
+ children: f
438
+ }),
439
+ d && s && (!c || o.dragging) && /* @__PURE__ */ N(ve, {
440
+ x: d.x,
441
+ y: d.y,
442
+ source: s,
443
+ avoid: c ? he(c, window.innerHeight) : void 0
444
+ })
445
+ ]
446
+ });
447
+ }
448
+ //#endregion
449
+ //#region lib/capture-toolbar/partials/mode-chips.tsx
450
+ var Me = {
451
+ visible: ["expand", "Visible"],
452
+ region: ["crop-simple", "Region"],
453
+ element: ["arrow-pointer", "Element"],
454
+ "full-page": ["arrows-up-down", "Full page"],
455
+ system: ["display", "Window"]
456
+ }, X = "color-mix(in oklab, var(--primary) 10%, var(--card))";
457
+ function Ne(e) {
458
+ let [t, n] = M({
459
+ start: !1,
460
+ end: !1
461
+ });
462
+ return A(() => {
463
+ let t = e.current;
464
+ if (!t) return;
465
+ let r = () => {
466
+ let e = t.scrollWidth - t.clientWidth, r = Math.abs(t.scrollLeft);
467
+ n({
468
+ start: r > 1,
469
+ end: r < e - 1
470
+ });
471
+ };
472
+ r(), t.addEventListener("scroll", r, { passive: !0 });
473
+ let i = typeof ResizeObserver > "u" ? null : new ResizeObserver(r);
474
+ i?.observe(t);
475
+ for (let e of Array.from(t.children)) i?.observe(e);
476
+ let a = typeof MutationObserver > "u" ? null : new MutationObserver(() => {
477
+ for (let e of Array.from(t.children)) i?.observe(e);
478
+ r();
479
+ });
480
+ return a?.observe(t, { childList: !0 }), i || window.addEventListener("resize", r), () => {
481
+ t.removeEventListener("scroll", r), i?.disconnect(), a?.disconnect(), window.removeEventListener("resize", r);
482
+ };
483
+ }, []), t;
484
+ }
485
+ var Z = "pointer-events-none absolute inset-y-0 w-6 opacity-0 transition-opacity data-visible:opacity-100";
486
+ function Pe({ modes: e, value: t, disabled: n, onChange: r }) {
487
+ let { t: i } = u(), a = j(null), o = Ne(a);
488
+ return /* @__PURE__ */ P("div", {
489
+ className: "relative min-w-0 max-w-full",
490
+ children: [
491
+ /* @__PURE__ */ N("div", {
492
+ ref: a,
493
+ role: "radiogroup",
494
+ "aria-label": i("material.capture.mode", "Capture mode"),
495
+ onKeyDown: (n) => {
496
+ let i = e.indexOf(t), o = n.key === "ArrowRight" || n.key === "ArrowDown" ? (i + 1) % e.length : n.key === "ArrowLeft" || n.key === "ArrowUp" ? (i - 1 + e.length) % e.length : n.key === "Home" ? 0 : n.key === "End" ? e.length - 1 : -1, s = e[o];
497
+ s && (n.preventDefault(), r(s), a.current?.querySelectorAll("[role=\"radio\"]")[o]?.focus());
498
+ },
499
+ className: "flex items-center gap-1 overflow-x-auto [scrollbar-width:none] [&>*]:shrink-0",
500
+ children: e.map((a) => {
501
+ let [o, c] = Me[a];
502
+ return /* @__PURE__ */ N(p, {
503
+ role: "radio",
504
+ "aria-checked": a === t,
505
+ tabIndex: a === (e.includes(t) ? t : e[0]) ? 0 : -1,
506
+ variant: "tonal",
507
+ size: "lg",
508
+ active: a === t,
509
+ disabled: n,
510
+ leading: /* @__PURE__ */ N(s, {
511
+ name: o,
512
+ "aria-hidden": "true"
513
+ }),
514
+ label: i(`material.capture.mode-${a}`, c),
515
+ onClick: () => r(a)
516
+ }, a);
517
+ })
518
+ }),
519
+ /* @__PURE__ */ N("div", {
520
+ "aria-hidden": "true",
521
+ "data-visible": o.start || void 0,
522
+ className: `${Z} start-0 bg-linear-to-r to-transparent rtl:bg-linear-to-l`,
523
+ style: { "--tw-gradient-from": X }
524
+ }),
525
+ /* @__PURE__ */ N("div", {
526
+ "aria-hidden": "true",
527
+ "data-visible": o.end || void 0,
528
+ className: `${Z} end-0 bg-linear-to-l to-transparent rtl:bg-linear-to-r`,
529
+ style: { "--tw-gradient-from": X }
530
+ })
531
+ ]
532
+ });
533
+ }
534
+ //#endregion
535
+ //#region lib/capture-toolbar/partials/outputs-frame.tsx
536
+ function Fe({ className: e, result: t, outputs: n, onClose: r }) {
537
+ return /* @__PURE__ */ N("div", {
538
+ [T]: "",
539
+ "data-slot": "screen-capture-outputs",
540
+ className: e,
541
+ children: /* @__PURE__ */ N(D, {
542
+ fallback: null,
543
+ children: /* @__PURE__ */ N(F, {
544
+ result: t,
545
+ outputs: n,
546
+ onClose: r
547
+ })
548
+ })
549
+ });
550
+ }
551
+ //#endregion
552
+ //#region lib/capture-toolbar/partials/timer-menu.tsx
553
+ function Ie({ value: e, disabled: t, onChange: l }) {
554
+ let { t: d } = u(), f = (e) => d("material.capture.timer-seconds", "{seconds} s", { seconds: e });
555
+ return /* @__PURE__ */ P(o, { children: [/* @__PURE__ */ N(n, {
556
+ asChild: !0,
557
+ children: /* @__PURE__ */ P(c, {
558
+ variant: "ghost",
559
+ size: "sm",
560
+ disabled: t,
561
+ "aria-label": d("material.capture.timer", "Timer"),
562
+ children: [
563
+ /* @__PURE__ */ N(s, {
564
+ name: "stopwatch",
565
+ "aria-hidden": "true"
566
+ }),
567
+ e ? f(e) : d("material.capture.timer-off", "No timer"),
568
+ /* @__PURE__ */ N(s, {
569
+ name: "chevron-down",
570
+ "aria-hidden": "true",
571
+ className: "size-3"
572
+ })
573
+ ]
574
+ })
575
+ }), /* @__PURE__ */ N(a, {
576
+ align: "center",
577
+ side: "top",
578
+ children: /* @__PURE__ */ P(r, {
579
+ value: String(e),
580
+ onValueChange: (e) => l(Number(e)),
581
+ children: [/* @__PURE__ */ N(i, {
582
+ value: "0",
583
+ children: d("material.capture.timer-off", "No timer")
584
+ }), _.map((e) => /* @__PURE__ */ N(i, {
585
+ value: String(e),
586
+ children: f(e)
587
+ }, e))]
588
+ })
589
+ })] });
590
+ }
591
+ //#endregion
592
+ //#region lib/capture-toolbar/types.ts
593
+ var Q = [
594
+ "visible",
595
+ "region",
596
+ "element",
597
+ "full-page",
598
+ "system"
599
+ ];
600
+ //#endregion
601
+ //#region lib/capture-toolbar/use-restore-focus.ts
602
+ function Le(e) {
603
+ let t = j(null), n = j(!1);
604
+ return A(() => {
605
+ if (e) {
606
+ n.current = !0;
607
+ return;
608
+ }
609
+ if (!n.current) return;
610
+ n.current = !1;
611
+ let r = document.activeElement;
612
+ if (!(!r || r === document.body || t.current?.contains(r))) return;
613
+ let i = t.current?.querySelectorAll("button");
614
+ i?.[i.length - 1]?.focus({ preventScroll: !0 });
615
+ }, [e]), t;
616
+ }
617
+ //#endregion
618
+ //#region lib/capture-toolbar/run-capture.ts
619
+ function Re(e, t) {
620
+ let { controller: n, setStatus: r, setReview: i } = t, { signal: a } = n;
621
+ return new Promise((t) => {
622
+ let n = () => {
623
+ a.removeEventListener("abort", n), i(null), t();
624
+ };
625
+ if (a.aborted) return n();
626
+ a.addEventListener("abort", n), r("reviewing"), i({
627
+ result: e,
628
+ onClose: n
629
+ });
630
+ });
631
+ }
632
+ async function ze(e, t, n, r, i) {
633
+ return e === "element" ? C(await i(), t) : e === "region" ? v(await r(), t) : e === "full-page" ? S({
634
+ ...t,
635
+ target: n
636
+ }) : e === "system" ? C(void 0, {
637
+ ...t,
638
+ engine: "system"
639
+ }) : w(t);
640
+ }
641
+ function Be(e) {
642
+ let { controller: t, setStatus: n, setRegion: r } = e, { signal: i } = t;
643
+ return new Promise((e, a) => {
644
+ let o = () => {
645
+ i.removeEventListener("abort", s), r(null);
646
+ }, s = () => {
647
+ o(), a(new E("cancelled", "The capture was cancelled"));
648
+ };
649
+ i.addEventListener("abort", s), n("selecting"), r({
650
+ onSelect: (t) => {
651
+ o(), e(t);
652
+ },
653
+ onCancel: () => t.abort()
654
+ });
655
+ });
656
+ }
657
+ function Ve(e, t) {
658
+ let { controller: n, setStatus: r, setEditor: i } = t, { signal: a } = n;
659
+ return new Promise((t, o) => {
660
+ let s = () => {
661
+ a.removeEventListener("abort", c), i(null);
662
+ }, c = () => {
663
+ s(), o(new E("cancelled", "The capture was cancelled"));
664
+ };
665
+ if (a.aborted) return c();
666
+ a.addEventListener("abort", c), r("editing"), i({
667
+ blob: e,
668
+ onDone: (e) => {
669
+ s(), t(e);
670
+ },
671
+ onCancel: () => {
672
+ n.abort(), c();
673
+ }
674
+ });
675
+ });
676
+ }
677
+ async function He(e, t) {
678
+ let { options: n, delay: r, controller: i, setStatus: a, setLeft: o } = t, { signal: s } = i;
679
+ r && (a("counting"), await x(r, {
680
+ signal: s,
681
+ onTick: o
682
+ })), e !== "region" && e !== "element" && a("capturing");
683
+ let c = await ze(e, { ...n.capture }, n.target, async () => {
684
+ let e = await Be(t);
685
+ return a("capturing"), e;
686
+ }, async () => {
687
+ a("picking");
688
+ let e = await b({ signal: s });
689
+ return a("capturing"), e;
690
+ }), l = await ee(c.canvas), u = {
691
+ blob: n.edit ? await Ve(l, t) : l,
692
+ edited: !!n.edit,
693
+ mode: e,
694
+ ...c
695
+ };
696
+ n.onCapture?.(u), n.review && await Re(u, t);
697
+ }
698
+ //#endregion
699
+ //#region lib/capture-toolbar/shortcut.ts
700
+ var Ue = {
701
+ alt: "alt",
702
+ option: "alt",
703
+ ctrl: "ctrl",
704
+ control: "ctrl",
705
+ meta: "meta",
706
+ cmd: "meta",
707
+ command: "meta",
708
+ shift: "shift"
709
+ };
710
+ function We(e) {
711
+ let t = {
712
+ key: "",
713
+ alt: !1,
714
+ ctrl: !1,
715
+ meta: !1,
716
+ shift: !1
717
+ };
718
+ for (let n of e.split("+")) {
719
+ let e = n.trim();
720
+ if (!e) continue;
721
+ let r = Ue[e.toLowerCase()];
722
+ r && r !== "key" ? t[r] = !0 : t.key = e.toLowerCase();
723
+ }
724
+ return t.key ? t : null;
725
+ }
726
+ function Ge(e, t) {
727
+ return (e.key.toLowerCase() === t.key || e.code === `Key${t.key.toUpperCase()}` || e.code === `Digit${t.key}`) && e.altKey === t.alt && e.ctrlKey === t.ctrl && e.metaKey === t.meta && e.shiftKey === t.shift;
728
+ }
729
+ //#endregion
730
+ //#region lib/capture-toolbar/use-screen-capture.ts
731
+ function Ke(e = {}) {
732
+ let { defaultMode: t = "visible", defaultDelay: n = 0, shortcut: r } = e, [i, a] = M(t), [o, s] = M(n), [c, l] = M("idle"), [u, d] = M(0), [f, p] = M(null), [m, h] = M(null), [g, _] = M(null), [v, y] = M(null), b = j(null), x = j({
733
+ options: e,
734
+ mode: i,
735
+ delay: o
736
+ });
737
+ x.current = {
738
+ options: e,
739
+ mode: i,
740
+ delay: o
741
+ };
742
+ let S = k(() => b.current?.abort(), []), C = k((e) => {
743
+ if (b.current) return;
744
+ let { options: t, mode: n, delay: r } = x.current, i = new AbortController();
745
+ b.current = i, p(null), He(e ?? n, {
746
+ options: t,
747
+ delay: r,
748
+ controller: i,
749
+ setStatus: l,
750
+ setLeft: d,
751
+ setRegion: h,
752
+ setEditor: _,
753
+ setReview: y
754
+ }).catch((e) => {
755
+ e instanceof E && e.code === "cancelled" || (p(e), t.onError?.(e));
756
+ }).finally(() => {
757
+ b.current = null, h(null), _(null), y(null), l("idle");
758
+ });
759
+ }, []);
760
+ return A(() => () => b.current?.abort(), []), A(() => {
761
+ let e = r ? We(r) : null;
762
+ if (!e) return;
763
+ let t = (t) => {
764
+ b.current || !Ge(t, e) || (t.preventDefault(), C());
765
+ };
766
+ return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
767
+ }, [r, C]), {
768
+ mode: i,
769
+ setMode: a,
770
+ delay: o,
771
+ setDelay: s,
772
+ status: c,
773
+ left: u,
774
+ error: f,
775
+ start: C,
776
+ cancel: S,
777
+ region: m,
778
+ editor: g,
779
+ review: v
780
+ };
781
+ }
782
+ //#endregion
783
+ //#region lib/capture-toolbar/screen-capture-toolbar.tsx
784
+ var $ = "pointer-events-none fixed inset-x-0 z-[2147483645] flex justify-center px-4";
785
+ function qe(e) {
786
+ let { t } = u();
787
+ return e.status === "counting" ? t("material.capture.counting", "Capturing in {seconds}", { seconds: e.left }) : e.status === "picking" ? t("material.capture.picking", "Click the element to capture. Esc cancels.") : e.status === "capturing" ? t("material.capture.capturing", "Capturing") : e.status === "editing" ? t("material.capture.editing", "Editing the capture") : e.error ? t("material.capture.error", "The capture failed") : "";
788
+ }
789
+ function Je({ cap: e }) {
790
+ let { t } = u();
791
+ return e.status === "idle" ? /* @__PURE__ */ N(f, {
792
+ variant: "filled",
793
+ icon: /* @__PURE__ */ N(s, {
794
+ name: "camera",
795
+ "aria-hidden": "true",
796
+ className: "size-(--fab-icon)"
797
+ }),
798
+ label: t("material.capture.capture", "Capture"),
799
+ onClick: () => e.start()
800
+ }) : /* @__PURE__ */ N(d, {
801
+ variant: "tonal",
802
+ size: "xl",
803
+ tooltip: t("material.capture.cancel", "Cancel"),
804
+ "aria-label": t("material.capture.cancel", "Cancel"),
805
+ onClick: e.cancel,
806
+ children: /* @__PURE__ */ N(s, {
807
+ name: "xmark",
808
+ "aria-hidden": "true"
809
+ })
810
+ });
811
+ }
812
+ function Ye({ modes: t, position: n = "bottom", className: r, edit: i = !0, outputs: a, ...o }) {
813
+ let { t: s } = u(), c = Ke({
814
+ ...o,
815
+ edit: i,
816
+ review: !!a
817
+ }), l = de(() => (t ?? Q).filter((e) => e !== "system" || y()), [t]), d = c.status !== "idle", f = qe(c), p = Le(d || !!c.review);
818
+ return /* @__PURE__ */ P(fe, { children: [
819
+ !c.review && /* @__PURE__ */ P("div", {
820
+ ref: p,
821
+ "data-capture-exclude": "",
822
+ "data-slot": "screen-capture-toolbar",
823
+ role: "toolbar",
824
+ "aria-label": s("material.capture.toolbar", "Screen capture"),
825
+ className: e($, n === "top" ? "top-4" : "bottom-4", r),
826
+ children: [/* @__PURE__ */ P("div", {
827
+ className: "pointer-events-auto flex max-w-full flex-wrap items-center justify-center gap-1 rounded-[2rem] border bg-[color-mix(in_oklab,var(--primary)_10%,var(--card))] p-1.5 shadow-lg",
828
+ children: [/* @__PURE__ */ N(Pe, {
829
+ modes: l,
830
+ value: c.mode,
831
+ disabled: d,
832
+ onChange: c.setMode
833
+ }), /* @__PURE__ */ P("div", {
834
+ className: "flex items-center gap-1 max-sm:w-full max-sm:justify-between",
835
+ children: [/* @__PURE__ */ N(Ie, {
836
+ value: c.delay,
837
+ disabled: d,
838
+ onChange: c.setDelay
839
+ }), /* @__PURE__ */ N(Je, { cap: c })]
840
+ })]
841
+ }), /* @__PURE__ */ N("p", {
842
+ role: "status",
843
+ className: "sr-only",
844
+ children: f
845
+ })]
846
+ }),
847
+ c.review && a && /* @__PURE__ */ N(Fe, {
848
+ className: e($, n === "top" ? "top-4" : "bottom-4", r),
849
+ result: c.review.result,
850
+ outputs: a,
851
+ onClose: c.review.onClose
852
+ }),
853
+ c.region && /* @__PURE__ */ N(Y, { ...c.region }),
854
+ c.editor && /* @__PURE__ */ N(I, { ...c.editor })
855
+ ] });
856
+ }
857
+ //#endregion
858
+ export { I as CaptureEditor, ce as CaptureOutputError, F as CaptureOutputs, l as I18nProvider, g as NxgtThemeProvider, m as PortalContainerProvider, Y as RegionOverlay, Q as SCREEN_CAPTURE_MODES, Ye as ScreenCaptureToolbar, h as adoptStyles, le as canCopyCapture, ae as canShareCapture, ne as captureFileName, se as copyCapture, re as downloadCapture, ie as encodeCapture, te as shareCapture, oe as uploadCapture, Ke as useScreenCapture };