@m3ui-vue/m3ui-vue 1.10.2 → 1.11.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 (292) hide show
  1. package/README.md +19 -4
  2. package/dist/API.md +195 -56
  3. package/dist/MButton-gWoOzFWf.js +284 -0
  4. package/dist/MButton-gWoOzFWf.js.map +1 -0
  5. package/dist/MColorPickerModal-CJYMvlgK.js +466 -0
  6. package/dist/MColorPickerModal-CJYMvlgK.js.map +1 -0
  7. package/dist/MDialog-CU8EYgCC.js +226 -0
  8. package/dist/MDialog-CU8EYgCC.js.map +1 -0
  9. package/dist/{MIcon-BSsJZhK7.js → MIcon-CkUc9kuQ.js} +10 -4
  10. package/dist/MIcon-CkUc9kuQ.js.map +1 -0
  11. package/dist/MIconButton-DTFOfsTy.js +317 -0
  12. package/dist/MIconButton-DTFOfsTy.js.map +1 -0
  13. package/dist/MListItem-Cdw2FqCT.js +1306 -0
  14. package/dist/MListItem-Cdw2FqCT.js.map +1 -0
  15. package/dist/MLoadingIndicator-BxAy2x7P.js +115 -0
  16. package/dist/MLoadingIndicator-BxAy2x7P.js.map +1 -0
  17. package/dist/{MMenuItem-US0Zbglq.js → MMenuItem-CEIKYvaX.js} +216 -214
  18. package/dist/MMenuItem-CEIKYvaX.js.map +1 -0
  19. package/dist/{MPdfViewer-DL9mRsd2.js → MPdfViewer-CEfyXGq2.js} +674 -671
  20. package/dist/MPdfViewer-CEfyXGq2.js.map +1 -0
  21. package/dist/MProgressBar-BzZMxq7M.js.map +1 -1
  22. package/dist/MSeekBar-B3_D-PwH.js +435 -0
  23. package/dist/MSeekBar-B3_D-PwH.js.map +1 -0
  24. package/dist/{MSegmentedButton-DMou-8sG.js → MSegmentedButton-Dg07j-4r.js} +4 -4
  25. package/dist/{MSegmentedButton-DMou-8sG.js.map → MSegmentedButton-Dg07j-4r.js.map} +1 -1
  26. package/dist/{MSignaturePad-WuvE_Cyl.js → MSignaturePad-3nddtLKI.js} +2 -2
  27. package/dist/{MSignaturePad-WuvE_Cyl.js.map → MSignaturePad-3nddtLKI.js.map} +1 -1
  28. package/dist/{MSlider-7TzhFHKS.js → MSlider-BrpLbqwt.js} +4 -4
  29. package/dist/{MSlider-7TzhFHKS.js.map → MSlider-BrpLbqwt.js.map} +1 -1
  30. package/dist/{MSpinner-CkIVBuGE.js → MSpinner-CLwzDH33.js} +2 -2
  31. package/dist/{MSpinner-CkIVBuGE.js.map → MSpinner-CLwzDH33.js.map} +1 -1
  32. package/dist/{MTextField-B6_iOczK.js → MTextField-CZRizAwA.js} +136 -134
  33. package/dist/MTextField-CZRizAwA.js.map +1 -0
  34. package/dist/{_useFieldValidation-COBJ1tWr.js → _useFieldValidation-DVcqyy9g.js} +2 -2
  35. package/dist/{_useFieldValidation-COBJ1tWr.js.map → _useFieldValidation-DVcqyy9g.js.map} +1 -1
  36. package/dist/api.json +1 -1
  37. package/dist/chart.js +1 -1
  38. package/dist/code-editor.js +3 -3
  39. package/dist/code-editor.js.map +1 -1
  40. package/dist/components/MAlert.vue.d.ts +1 -1
  41. package/dist/components/MAudioPlayer.vue.d.ts +3 -3
  42. package/dist/components/MAvatar.vue.d.ts +19 -1
  43. package/dist/components/MButton.vue.d.ts +2 -1
  44. package/dist/components/MChatBubble.vue.d.ts +2 -0
  45. package/dist/components/MCheckbox.vue.d.ts +2 -0
  46. package/dist/components/MDataTable.vue.d.ts +31 -3
  47. package/dist/components/MFlow.vue.d.ts +1 -1
  48. package/dist/components/MHotkeys.vue.d.ts +1 -0
  49. package/dist/components/MIcon.vue.d.ts +6 -0
  50. package/dist/components/MIconButton.vue.d.ts +5 -0
  51. package/dist/components/MKanban.vue.d.ts +1 -1
  52. package/dist/components/MLink.vue.d.ts +59 -0
  53. package/dist/components/MListItem.vue.d.ts +3 -1
  54. package/dist/components/MMapControl.vue.d.ts +1 -1
  55. package/dist/components/MNotificationCenter.vue.d.ts +1 -1
  56. package/dist/components/MNumberField.vue.d.ts +1 -1
  57. package/dist/components/MPagination.vue.d.ts +14 -1
  58. package/dist/components/MPdfSigner.vue.d.ts +2 -2
  59. package/dist/components/MRadio.vue.d.ts +2 -0
  60. package/dist/components/MRadioGroup.vue.d.ts +2 -0
  61. package/dist/components/MStatCard.vue.d.ts +2 -2
  62. package/dist/components/MSwitch.vue.d.ts +2 -0
  63. package/dist/components/MText.vue.d.ts +4 -2
  64. package/dist/components/MTextField.vue.d.ts +2 -0
  65. package/dist/components/_MDrawerItemList.vue.d.ts +6 -0
  66. package/dist/composables/_menuGroups.d.ts +10 -1
  67. package/dist/composables/_splitAttrs.d.ts +6 -0
  68. package/dist/composables/_springAnimation.d.ts +2 -2
  69. package/dist/composables/_useFocusTrap.d.ts +15 -0
  70. package/dist/composables/_usePaneResize.d.ts +1 -1
  71. package/dist/composables/_useSpring.d.ts +4 -4
  72. package/dist/composables/dynamicColor.d.ts +9 -1
  73. package/dist/composables/motion.d.ts +63 -0
  74. package/dist/composables/useConfirm.d.ts +28 -0
  75. package/dist/composables/useDevice.d.ts +8 -1
  76. package/dist/composables/useLocale.d.ts +14 -0
  77. package/dist/composables/useScrollReveal.d.ts +1 -1
  78. package/dist/composables/useTheme.d.ts +1 -0
  79. package/dist/composables/useToast.d.ts +7 -0
  80. package/dist/draw.js +556 -556
  81. package/dist/draw.js.map +1 -1
  82. package/dist/flow.js +854 -851
  83. package/dist/flow.js.map +1 -1
  84. package/dist/gantt.js +1118 -1096
  85. package/dist/gantt.js.map +1 -1
  86. package/dist/index.d.ts +8 -5
  87. package/dist/locales/index.d.ts +1 -0
  88. package/dist/locales/index.js +833 -1
  89. package/dist/locales/index.js.map +1 -1
  90. package/dist/locales/pl.d.ts +2 -0
  91. package/dist/m3ui-vue.css +1 -1
  92. package/dist/m3ui.js +10327 -9796
  93. package/dist/m3ui.js.map +1 -1
  94. package/dist/map.js +860 -860
  95. package/dist/map.js.map +1 -1
  96. package/dist/{material-color-utilities-CEFytLsr.js → material-color-utilities-BZsBNIhi.js} +276 -217
  97. package/dist/material-color-utilities-BZsBNIhi.js.map +1 -0
  98. package/dist/media.js +7 -7
  99. package/dist/{motion-BcejVTeX.js → motion-BqYcqcim.js} +15 -5
  100. package/dist/motion-BqYcqcim.js.map +1 -0
  101. package/dist/pdf-sign.js +140 -137
  102. package/dist/pdf-sign.js.map +1 -1
  103. package/dist/pdf.js +1 -1
  104. package/dist/plugin.d.ts +11 -0
  105. package/dist/rich-text-editor.js +7 -7
  106. package/dist/styles/theme.css +40 -0
  107. package/dist/styles.css +1 -1
  108. package/dist/terminal.js +1 -1
  109. package/dist/{useLocale-YRaOT12S.js → useLocale-BjcYauXr.js} +60 -4
  110. package/dist/useLocale-BjcYauXr.js.map +1 -0
  111. package/dist/{useThemeTokens-DyAdPQB0.js → useThemeTokens-D5nr5KHf.js} +28 -27
  112. package/dist/useThemeTokens-D5nr5KHf.js.map +1 -0
  113. package/package.json +17 -2
  114. package/src/__tests__/MAvatarImage.test.ts +37 -0
  115. package/src/__tests__/MDataTableControlled.test.ts +68 -0
  116. package/src/__tests__/MHotkeysSequence.test.ts +53 -0
  117. package/src/__tests__/MIconAxes.test.ts +16 -0
  118. package/src/__tests__/MIconButtonWidth.test.ts +22 -0
  119. package/src/__tests__/MLink.test.ts +46 -0
  120. package/src/__tests__/MPaginationPages.test.ts +43 -0
  121. package/src/__tests__/MTextEmphasized.test.ts +14 -0
  122. package/src/__tests__/controlDescription.test.ts +34 -0
  123. package/src/__tests__/customColor.test.ts +27 -0
  124. package/src/__tests__/dynamicColor.test.ts +3 -2
  125. package/src/__tests__/focusTrap.test.ts +124 -0
  126. package/src/__tests__/formatMessage.test.ts +20 -0
  127. package/src/__tests__/inputAttrs.test.ts +103 -0
  128. package/src/__tests__/localePresets.test.ts +2 -0
  129. package/src/__tests__/menuGroupsRemount.test.ts +40 -0
  130. package/src/__tests__/menuHydration.test.ts +41 -0
  131. package/src/__tests__/motionPrefs.test.ts +28 -0
  132. package/src/__tests__/ssr.test.ts +11 -0
  133. package/src/__tests__/ssrToast.test.ts +20 -0
  134. package/src/__tests__/toastDetails.test.ts +39 -0
  135. package/src/__tests__/useConfirm.test.ts +47 -0
  136. package/src/__tests__/useTheme.test.ts +14 -0
  137. package/src/__tests__/warningRole.test.ts +22 -0
  138. package/src/components/MAlert.vue +2 -2
  139. package/src/components/MAnimatedNumber.vue +9 -3
  140. package/src/components/MAutocomplete.vue +16 -4
  141. package/src/components/MAvailabilityCalendar.vue +3 -3
  142. package/src/components/MAvatar.vue +32 -5
  143. package/src/components/MAvatarGroup.vue +7 -2
  144. package/src/components/MBottomSheet.vue +18 -2
  145. package/src/components/MButton.vue +18 -5
  146. package/src/components/MCarousel.vue +3 -3
  147. package/src/components/MChatBubble.vue +14 -1
  148. package/src/components/MCheckbox.vue +21 -4
  149. package/src/components/MChip.vue +4 -2
  150. package/src/components/MCollapse.vue +7 -1
  151. package/src/components/MCommandPalette.vue +6 -2
  152. package/src/components/MContextMenu.vue +4 -4
  153. package/src/components/MCreditCardInput.vue +5 -0
  154. package/src/components/MDashboardGrid.vue +2 -1
  155. package/src/components/MDataTable.vue +63 -16
  156. package/src/components/MDialog.vue +21 -3
  157. package/src/components/MDiffViewer.vue +3 -3
  158. package/src/components/MDrawLayers.vue +3 -3
  159. package/src/components/MFabMenu.vue +7 -0
  160. package/src/components/MFloorPlan.vue +3 -3
  161. package/src/components/MFloorPlanInspector.vue +3 -3
  162. package/src/components/MFlow.vue +9 -5
  163. package/src/components/MFlowControls.vue +6 -0
  164. package/src/components/MFormBuilder.vue +1 -1
  165. package/src/components/MGantt.vue +10 -10
  166. package/src/components/MHotkeys.vue +61 -16
  167. package/src/components/MIcon.vue +17 -1
  168. package/src/components/MIconButton.vue +29 -6
  169. package/src/components/MImageCropper.vue +1 -1
  170. package/src/components/MKanban.vue +2 -1
  171. package/src/components/MLightbox.vue +5 -4
  172. package/src/components/MLink.vue +136 -0
  173. package/src/components/MListDetail.vue +7 -0
  174. package/src/components/MListItem.vue +7 -4
  175. package/src/components/MLoadingIndicator.vue +2 -1
  176. package/src/components/MMap.vue +3 -0
  177. package/src/components/MMapCluster.vue +2 -2
  178. package/src/components/MMapControl.vue +2 -2
  179. package/src/components/MMapMeasure.vue +1 -1
  180. package/src/components/MMaskField.vue +16 -3
  181. package/src/components/MMenu.vue +4 -4
  182. package/src/components/MMenuItem.vue +2 -2
  183. package/src/components/MMeterGroup.vue +3 -2
  184. package/src/components/MMortgageCalculator.vue +3 -3
  185. package/src/components/MMultiAutocomplete.vue +19 -7
  186. package/src/components/MMultiSelect.vue +19 -7
  187. package/src/components/MNavigationDrawer.vue +10 -3
  188. package/src/components/MNavigationRail.vue +5 -1
  189. package/src/components/MNotificationCenter.vue +2 -1
  190. package/src/components/MNotificationHost.vue +3 -3
  191. package/src/components/MNumberField.vue +23 -6
  192. package/src/components/MOdontogram.vue +4 -4
  193. package/src/components/MOrderBook.vue +4 -0
  194. package/src/components/MPagination.vue +91 -12
  195. package/src/components/MPdfSigner.vue +3 -3
  196. package/src/components/MPdfViewer.vue +7 -7
  197. package/src/components/MPhoneInput.vue +17 -4
  198. package/src/components/MProductConfigurator.vue +4 -4
  199. package/src/components/MProgressBar.vue +5 -0
  200. package/src/components/MQuiz.vue +8 -5
  201. package/src/components/MRadio.vue +24 -5
  202. package/src/components/MRadioGroup.vue +3 -0
  203. package/src/components/MReactions.vue +2 -2
  204. package/src/components/MResourceTimeline.vue +3 -3
  205. package/src/components/MResult.vue +1 -1
  206. package/src/components/MScrollField.vue +1 -1
  207. package/src/components/MSearchField.vue +6 -5
  208. package/src/components/MSeatMap.vue +5 -0
  209. package/src/components/MSeekBar.vue +3 -2
  210. package/src/components/MSelect.vue +16 -4
  211. package/src/components/MSideSheet.vue +25 -3
  212. package/src/components/MSimpleCarousel.vue +2 -2
  213. package/src/components/MSnackbar.vue +16 -13
  214. package/src/components/MSparkline.vue +2 -1
  215. package/src/components/MSpinner.vue +8 -0
  216. package/src/components/MSplitter.vue +1 -1
  217. package/src/components/MSpotlightSearch.vue +6 -2
  218. package/src/components/MSpreadsheet.vue +1 -1
  219. package/src/components/MStatCard.vue +2 -1
  220. package/src/components/MSwitch.vue +21 -4
  221. package/src/components/MTabs.vue +2 -1
  222. package/src/components/MTagInput.vue +19 -6
  223. package/src/components/MText.vue +23 -4
  224. package/src/components/MTextField.vue +25 -6
  225. package/src/components/MTimeline.vue +5 -5
  226. package/src/components/MToolbar.vue +2 -2
  227. package/src/components/MTour.vue +3 -0
  228. package/src/components/MTrackingTimeline.vue +6 -0
  229. package/src/components/MTypewriter.vue +7 -1
  230. package/src/components/MWindow.vue +10 -1
  231. package/src/components/_MColorPanel.vue +4 -4
  232. package/src/components/_MComment.vue +3 -2
  233. package/src/components/_MFlowNodeShell.vue +1 -1
  234. package/src/components/_MPdfPage.vue +1 -1
  235. package/src/components/_MTransferPane.vue +10 -0
  236. package/src/composables/_effectCanvas.ts +2 -1
  237. package/src/composables/_menuGroups.ts +10 -1
  238. package/src/composables/_splitAttrs.ts +29 -0
  239. package/src/composables/_springAnimation.ts +3 -3
  240. package/src/composables/_themeTransition.ts +3 -2
  241. package/src/composables/_useFocusTrap.ts +142 -0
  242. package/src/composables/_useMenuNav.ts +3 -3
  243. package/src/composables/_usePaneResize.ts +2 -1
  244. package/src/composables/_useSheetMotion.ts +3 -4
  245. package/src/composables/_useSpring.ts +16 -10
  246. package/src/composables/cron.ts +7 -6
  247. package/src/composables/dynamicColor.ts +21 -2
  248. package/src/composables/motion.ts +27 -0
  249. package/src/composables/useConfirm.ts +116 -0
  250. package/src/composables/useDevice.ts +23 -3
  251. package/src/composables/useFieldBg.ts +4 -0
  252. package/src/composables/useLocale.ts +74 -0
  253. package/src/composables/useNotification.ts +3 -0
  254. package/src/composables/useScrollReveal.ts +3 -3
  255. package/src/composables/useTheme.ts +8 -2
  256. package/src/composables/useToast.ts +27 -4
  257. package/src/directives/vSparkle.ts +2 -1
  258. package/src/index.ts +8 -5
  259. package/src/locales/ar.ts +7 -0
  260. package/src/locales/de.ts +7 -0
  261. package/src/locales/es.ts +7 -0
  262. package/src/locales/fr.ts +7 -0
  263. package/src/locales/index.ts +1 -0
  264. package/src/locales/ja.ts +7 -0
  265. package/src/locales/ko.ts +7 -0
  266. package/src/locales/pl.ts +807 -0
  267. package/src/locales/pt.ts +7 -0
  268. package/src/locales/zh.ts +7 -0
  269. package/src/plugin.ts +16 -0
  270. package/src/styles/theme.css +40 -0
  271. package/dist/MButton-B9RCM06i.js +0 -171
  272. package/dist/MButton-B9RCM06i.js.map +0 -1
  273. package/dist/MColorPickerModal-ChRtcZOo.js +0 -577
  274. package/dist/MColorPickerModal-ChRtcZOo.js.map +0 -1
  275. package/dist/MDialog-dk07tify.js +0 -167
  276. package/dist/MDialog-dk07tify.js.map +0 -1
  277. package/dist/MIcon-BSsJZhK7.js.map +0 -1
  278. package/dist/MIconButton-CrBPZidd.js +0 -288
  279. package/dist/MIconButton-CrBPZidd.js.map +0 -1
  280. package/dist/MListItem-h9H223vx.js +0 -1239
  281. package/dist/MListItem-h9H223vx.js.map +0 -1
  282. package/dist/MLoadingIndicator-YTV1Ov5w.js +0 -114
  283. package/dist/MLoadingIndicator-YTV1Ov5w.js.map +0 -1
  284. package/dist/MMenuItem-US0Zbglq.js.map +0 -1
  285. package/dist/MPdfViewer-DL9mRsd2.js.map +0 -1
  286. package/dist/MSeekBar-JFZcoJ8y.js +0 -434
  287. package/dist/MSeekBar-JFZcoJ8y.js.map +0 -1
  288. package/dist/MTextField-B6_iOczK.js.map +0 -1
  289. package/dist/material-color-utilities-CEFytLsr.js.map +0 -1
  290. package/dist/motion-BcejVTeX.js.map +0 -1
  291. package/dist/useLocale-YRaOT12S.js.map +0 -1
  292. package/dist/useThemeTokens-DyAdPQB0.js.map +0 -1
package/dist/draw.js CHANGED
@@ -1,11 +1,11 @@
1
- import { i as e } from "./useLocale-YRaOT12S.js";
2
- import { t } from "./MIconButton-CrBPZidd.js";
3
- import { n, t as r } from "./MMenuItem-US0Zbglq.js";
4
- import { t as i } from "./MTooltip-Cn_DYm9M.js";
5
- import { t as a } from "./MColorPickerModal-ChRtcZOo.js";
6
- import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, inject as h, mergeModels as g, mergeProps as _, nextTick as v, normalizeClass as y, normalizeStyle as b, onBeforeUnmount as x, onMounted as S, openBlock as C, provide as ee, ref as w, renderList as T, renderSlot as E, shallowRef as D, toDisplayString as te, unref as O, useId as ne, useModel as k, vModelText as re, watch as ie, withCtx as A, withDirectives as j, withKeys as ae, withModifiers as M } from "vue";
1
+ import { a as e, i as t } from "./useLocale-BjcYauXr.js";
2
+ import { t as n } from "./MIconButton-DTFOfsTy.js";
3
+ import { n as r, t as i } from "./MMenuItem-CEIKYvaX.js";
4
+ import { t as a } from "./MTooltip-Cn_DYm9M.js";
5
+ import { t as o } from "./MColorPickerModal-CJYMvlgK.js";
6
+ import { Fragment as s, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, inject as ee, mergeModels as g, mergeProps as _, nextTick as v, normalizeClass as y, normalizeStyle as b, onBeforeUnmount as te, onMounted as ne, openBlock as x, provide as re, ref as S, renderList as C, renderSlot as w, shallowRef as T, toDisplayString as ie, unref as E, useId as D, useModel as O, vModelText as k, watch as ae, withCtx as A, withDirectives as oe, withKeys as j, withModifiers as se } from "vue";
7
7
  // src/composables/drawGeometry.ts
8
- var N = 0, oe = () => `d${Date.now().toString(36)}${(N++).toString(36)}`, se = {
8
+ var ce = 0, le = () => `d${Date.now().toString(36)}${(ce++).toString(36)}`, ue = {
9
9
  pen: {
10
10
  thinning: .6,
11
11
  taper: .4,
@@ -26,8 +26,8 @@ var N = 0, oe = () => `d${Date.now().toString(36)}${(N++).toString(36)}`, se = {
26
26
  taper: 0,
27
27
  opacity: .35
28
28
  }
29
- }, P = (e) => Math.round(e * 100) / 100;
30
- function ce(e, t = .5, n = 4) {
29
+ }, M = (e) => Math.round(e * 100) / 100;
30
+ function de(e, t = .5, n = 4) {
31
31
  if (e.length < 2) return e.slice();
32
32
  let r = 1 - Math.min(.9, Math.max(0, t) * .85), i = Math.max(.5, n * .1), a = [e[0]], [o, s] = e[0];
33
33
  for (let t = 1; t < e.length; t++) {
@@ -47,7 +47,7 @@ function ce(e, t = .5, n = 4) {
47
47
  c[2]
48
48
  ], a;
49
49
  }
50
- function le(e, t) {
50
+ function fe(e, t) {
51
51
  let n = .5;
52
52
  return e.map((r, i) => {
53
53
  if (!i) return [
@@ -63,8 +63,8 @@ function le(e, t) {
63
63
  ];
64
64
  });
65
65
  }
66
- function ue(e, t, n) {
67
- let { thinning: r, taper: i } = se[n], a = [0];
66
+ function N(e, t, n) {
67
+ let { thinning: r, taper: i } = ue[n], a = [0];
68
68
  for (let t = 1; t < e.length; t++) a.push(a[t - 1] + Math.hypot(e[t][0] - e[t - 1][0], e[t][1] - e[t - 1][1]));
69
69
  let o = a[a.length - 1], s = Math.min(o / 3, t * 3 * i);
70
70
  return e.map((e, n) => {
@@ -76,13 +76,13 @@ function ue(e, t, n) {
76
76
  return Math.max(.25, i);
77
77
  });
78
78
  }
79
- function de(e) {
79
+ function pe(e) {
80
80
  let t = e.points;
81
81
  if (!t.length) return "";
82
- let n = ue(t, e.size, e.pen);
82
+ let n = N(t, e.size, e.pen);
83
83
  if (t.length === 1 || t.every((e) => Math.hypot(e[0] - t[0][0], e[1] - t[0][1]) < .5)) {
84
- let [e, r] = t[0], i = P(Math.max(...n));
85
- return `M${P(e - i)} ${P(r)}a${i} ${i} 0 1 0 ${i * 2} 0a${i} ${i} 0 1 0 ${-i * 2} 0Z`;
84
+ let [e, r] = t[0], i = M(Math.max(...n));
85
+ return `M${M(e - i)} ${M(r)}a${i} ${i} 0 1 0 ${i * 2} 0a${i} ${i} 0 1 0 ${-i * 2} 0Z`;
86
86
  }
87
87
  let r = [], i = [];
88
88
  for (let e = 0; e < t.length; e++) {
@@ -95,35 +95,35 @@ function de(e) {
95
95
  let t = "";
96
96
  for (let n = 1; n < e.length - 1; n++) {
97
97
  let [r, i] = e[n], [a, o] = e[n + 1];
98
- t += `Q${P(r)} ${P(i)} ${P((r + a) / 2)} ${P((i + o) / 2)}`;
98
+ t += `Q${M(r)} ${M(i)} ${M((r + a) / 2)} ${M((i + o) / 2)}`;
99
99
  }
100
100
  let n = e[e.length - 1];
101
- return `${t}L${P(n[0])} ${P(n[1])}`;
102
- }, o = P(n[n.length - 1]), s = P(n[0]), c = i.slice().reverse();
103
- return `M${P(r[0][0])} ${P(r[0][1])}${a(r)}A${o} ${o} 0 0 1 ${P(c[0][0])} ${P(c[0][1])}${a(c)}A${s} ${s} 0 0 1 ${P(r[0][0])} ${P(r[0][1])}Z`;
101
+ return `${t}L${M(n[0])} ${M(n[1])}`;
102
+ }, o = M(n[n.length - 1]), s = M(n[0]), c = i.slice().reverse();
103
+ return `M${M(r[0][0])} ${M(r[0][1])}${a(r)}A${o} ${o} 0 0 1 ${M(c[0][0])} ${M(c[0][1])}${a(c)}A${s} ${s} 0 0 1 ${M(r[0][0])} ${M(r[0][1])}Z`;
104
104
  }
105
- function fe(e) {
105
+ function me(e) {
106
106
  let [t, n] = e.from, [r, i] = e.to;
107
107
  switch (e.shape) {
108
108
  case "rect": {
109
109
  let e = Math.min(t, r), a = Math.min(n, i);
110
- return { d: `M${P(e)} ${P(a)}h${P(Math.abs(r - t))}v${P(Math.abs(i - n))}h${P(-Math.abs(r - t))}Z` };
110
+ return { d: `M${M(e)} ${M(a)}h${M(Math.abs(r - t))}v${M(Math.abs(i - n))}h${M(-Math.abs(r - t))}Z` };
111
111
  }
112
112
  case "ellipse": {
113
113
  let e = Math.abs(r - t) / 2, a = Math.abs(i - n) / 2, o = (t + r) / 2, s = (n + i) / 2;
114
- return { d: `M${P(o - e)} ${P(s)}a${P(e)} ${P(a)} 0 1 0 ${P(e * 2)} 0a${P(e)} ${P(a)} 0 1 0 ${P(-e * 2)} 0Z` };
114
+ return { d: `M${M(o - e)} ${M(s)}a${M(e)} ${M(a)} 0 1 0 ${M(e * 2)} 0a${M(e)} ${M(a)} 0 1 0 ${M(-e * 2)} 0Z` };
115
115
  }
116
116
  case "arrow": {
117
117
  let a = Math.hypot(r - t, i - n) || 1, o = (r - t) / a, s = (i - n) / a, c = Math.min(a * .6, Math.max(10, e.size * 4)), l = c * .55, u = r - o * c, d = i - s * c;
118
118
  return {
119
- d: `M${P(t)} ${P(n)}L${P(u + o * .5)} ${P(d + s * .5)}`,
120
- head: `M${P(r)} ${P(i)}L${P(u - s * l)} ${P(d + o * l)}L${P(u + s * l)} ${P(d - o * l)}Z`
119
+ d: `M${M(t)} ${M(n)}L${M(u + o * .5)} ${M(d + s * .5)}`,
120
+ head: `M${M(r)} ${M(i)}L${M(u - s * l)} ${M(d + o * l)}L${M(u + s * l)} ${M(d - o * l)}Z`
121
121
  };
122
122
  }
123
- default: return { d: `M${P(t)} ${P(n)}L${P(r)} ${P(i)}` };
123
+ default: return { d: `M${M(t)} ${M(n)}L${M(r)} ${M(i)}` };
124
124
  }
125
125
  }
126
- function pe(e, t, n) {
126
+ function he(e, t, n) {
127
127
  let r = n[0] - t[0], i = n[1] - t[1];
128
128
  if (e === "rect" || e === "ellipse") {
129
129
  let e = Math.max(Math.abs(r), Math.abs(i));
@@ -132,18 +132,18 @@ function pe(e, t, n) {
132
132
  let a = Math.round(Math.atan2(i, r) / (Math.PI / 4)) * (Math.PI / 4), o = Math.hypot(r, i);
133
133
  return [t[0] + Math.cos(a) * o, t[1] + Math.sin(a) * o];
134
134
  }
135
- var me = 1.25;
136
- function F(e) {
135
+ var ge = 1.25;
136
+ function _e(e) {
137
137
  let t = e.text.split("\n");
138
138
  return {
139
139
  x: e.at[0],
140
140
  y: e.at[1],
141
141
  width: Math.max(e.size, ...t.map((t) => t.length * e.size * .56)),
142
- height: t.length * e.size * me
142
+ height: t.length * e.size * ge
143
143
  };
144
144
  }
145
- function he(e) {
146
- if (e.type === "text") return F(e);
145
+ function ve(e) {
146
+ if (e.type === "text") return _e(e);
147
147
  let t = e.type === "stroke" ? e.points.map((e) => [e[0], e[1]]) : [e.from, e.to], n = e.size / 2, r = Infinity, i = Infinity, a = -Infinity, o = -Infinity;
148
148
  for (let [e, n] of t) r = Math.min(r, e), i = Math.min(i, n), a = Math.max(a, e), o = Math.max(o, n);
149
149
  return {
@@ -153,7 +153,7 @@ function he(e) {
153
153
  height: o - i + n * 2
154
154
  };
155
155
  }
156
- function ge(e) {
156
+ function ye(e) {
157
157
  if (!e.length) return null;
158
158
  let t = Math.min(...e.map((e) => e.x)), n = Math.min(...e.map((e) => e.y)), r = Math.max(...e.map((e) => e.x + e.width)), i = Math.max(...e.map((e) => e.y + e.height));
159
159
  return {
@@ -163,11 +163,11 @@ function ge(e) {
163
163
  height: i - n
164
164
  };
165
165
  }
166
- function _e(e, t, n, r, i, a) {
166
+ function P(e, t, n, r, i, a) {
167
167
  let o = i - n, s = a - r, c = o * o + s * s, l = c ? Math.max(0, Math.min(1, ((e - n) * o + (t - r) * s) / c)) : 0;
168
168
  return Math.hypot(n + l * o - e, r + l * s - t);
169
169
  }
170
- function I(e) {
170
+ function F(e) {
171
171
  let [t, n] = e.from, [r, i] = e.to;
172
172
  if (e.shape === "rect") return [
173
173
  [t, n],
@@ -182,39 +182,39 @@ function I(e) {
182
182
  }
183
183
  return [e.from, e.to];
184
184
  }
185
- function ve(e, t, n, r = 4) {
185
+ function be(e, t, n, r = 4) {
186
186
  if (e.type === "text") {
187
- let i = F(e);
187
+ let i = _e(e);
188
188
  return t >= i.x - r && t <= i.x + i.width + r && n >= i.y - r && n <= i.y + i.height + r;
189
189
  }
190
190
  if (e.type === "shape" && e.fill && (e.shape === "rect" || e.shape === "ellipse")) {
191
- let r = he(e);
191
+ let r = ve(e);
192
192
  if (t >= r.x && t <= r.x + r.width && n >= r.y && n <= r.y + r.height) {
193
193
  if (e.shape === "rect") return !0;
194
194
  let i = r.width / 2, a = r.height / 2;
195
195
  if (((t - r.x - i) / i) ** 2 + ((n - r.y - a) / a) ** 2 <= 1) return !0;
196
196
  }
197
197
  }
198
- let i = e.type === "stroke" ? e.points.map((e) => [e[0], e[1]]) : I(e), a = e.size / 2 + r;
198
+ let i = e.type === "stroke" ? e.points.map((e) => [e[0], e[1]]) : F(e), a = e.size / 2 + r;
199
199
  if (i.length === 1) return Math.hypot(i[0][0] - t, i[0][1] - n) <= a;
200
- for (let e = 1; e < i.length; e++) if (_e(t, n, i[e - 1][0], i[e - 1][1], i[e][0], i[e][1]) <= a) return !0;
200
+ for (let e = 1; e < i.length; e++) if (P(t, n, i[e - 1][0], i[e - 1][1], i[e][0], i[e][1]) <= a) return !0;
201
201
  return !1;
202
202
  }
203
- function ye(e, t, n, r) {
204
- if (e.type !== "stroke") return ve(e, t, n, r) ? [] : [e];
203
+ function xe(e, t, n, r) {
204
+ if (e.type !== "stroke") return be(e, t, n, r) ? [] : [e];
205
205
  let i = r + e.size / 2, a = e.points;
206
206
  if (a.length === 1) return Math.hypot(a[0][0] - t, a[0][1] - n) <= i ? [] : [e];
207
207
  let o = !1, s = [], c = [];
208
208
  return a.forEach((e, r) => {
209
- let l = a[r - 1], u = Math.hypot(e[0] - t, e[1] - n) <= i, d = !!l && c.length > 0 && _e(t, n, l[0], l[1], e[0], e[1]) <= i;
209
+ let l = a[r - 1], u = Math.hypot(e[0] - t, e[1] - n) <= i, d = !!l && c.length > 0 && P(t, n, l[0], l[1], e[0], e[1]) <= i;
210
210
  u || d ? (o = !0, c.length > 1 && s.push(c), c = u ? [] : [e]) : c.push(e);
211
211
  }), c.length > 1 && s.push(c), o ? s.map((t, n) => ({
212
212
  ...e,
213
- id: n ? oe() : e.id,
213
+ id: n ? le() : e.id,
214
214
  points: t
215
215
  })) : [e];
216
216
  }
217
- function L(e, t, n) {
217
+ function I(e, t, n) {
218
218
  let r = !1;
219
219
  for (let i = 0, a = n.length - 1; i < n.length; a = i++) {
220
220
  let [o, s] = n[i], [c, l] = n[a];
@@ -222,13 +222,13 @@ function L(e, t, n) {
222
222
  }
223
223
  return r;
224
224
  }
225
- function be(e, t) {
225
+ function Se(e, t) {
226
226
  if (t.length < 3) return !1;
227
227
  let n;
228
228
  if (e.type === "stroke") n = e.points.map((e) => [e[0], e[1]]);
229
- else if (e.type === "shape") n = I(e);
229
+ else if (e.type === "shape") n = F(e);
230
230
  else {
231
- let t = F(e);
231
+ let t = _e(e);
232
232
  n = [
233
233
  [t.x, t.y],
234
234
  [t.x + t.width, t.y],
@@ -236,9 +236,9 @@ function be(e, t) {
236
236
  [t.x + t.width, t.y + t.height]
237
237
  ];
238
238
  }
239
- return n.filter(([e, n]) => L(e, n, t)).length >= Math.max(1, n.length * .5);
239
+ return n.filter(([e, n]) => I(e, n, t)).length >= Math.max(1, n.length * .5);
240
240
  }
241
- function xe(e, t) {
241
+ function Ce(e, t) {
242
242
  let { dx: n = 0, dy: r = 0, sx: i = 1, sy: a = 1, ox: o = 0, oy: s = 0 } = t, c = (e) => o + (e - o) * i + n, l = (e) => s + (e - s) * a + r, u = Math.sqrt(Math.abs(i * a));
243
243
  return e.type === "stroke" ? {
244
244
  ...e,
@@ -259,26 +259,26 @@ function xe(e, t) {
259
259
  at: [c(e.at[0]), l(e.at[1])]
260
260
  };
261
261
  }
262
- var R = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
263
- function z(e, t = "sans-serif") {
262
+ var L = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
263
+ function R(e, t = "sans-serif") {
264
264
  if (e.type === "stroke") {
265
- let t = se[e.pen].opacity;
266
- return `<path d="${de(e)}" fill="${R(e.color)}"${t < 1 ? ` fill-opacity="${t}"` : ""}/>`;
265
+ let t = ue[e.pen].opacity;
266
+ return `<path d="${pe(e)}" fill="${L(e.color)}"${t < 1 ? ` fill-opacity="${t}"` : ""}/>`;
267
267
  }
268
268
  if (e.type === "shape") {
269
- let { d: t, head: n } = fe(e);
270
- return `<path d="${t}" fill="${e.fill && (e.shape === "rect" || e.shape === "ellipse") ? R(e.fill) : "none"}" stroke="${R(e.color)}" stroke-width="${e.size}" stroke-linecap="round" stroke-linejoin="round"/>${n ? `<path d="${n}" fill="${R(e.color)}"/>` : ""}`;
269
+ let { d: t, head: n } = me(e);
270
+ return `<path d="${t}" fill="${e.fill && (e.shape === "rect" || e.shape === "ellipse") ? L(e.fill) : "none"}" stroke="${L(e.color)}" stroke-width="${e.size}" stroke-linecap="round" stroke-linejoin="round"/>${n ? `<path d="${n}" fill="${L(e.color)}"/>` : ""}`;
271
271
  }
272
272
  let n = e.text.split("\n");
273
- return `<text x="${e.at[0]}" y="${e.at[1]}" font-size="${e.size}" font-family="${R(t)}" fill="${R(e.color)}">${n.map((t, n) => `<tspan x="${e.at[0]}" dy="${n ? e.size * me : e.size * .95}">${R(t) || " "}</tspan>`).join("")}</text>`;
273
+ return `<text x="${e.at[0]}" y="${e.at[1]}" font-size="${e.size}" font-family="${L(t)}" fill="${L(e.color)}">${n.map((t, n) => `<tspan x="${e.at[0]}" dy="${n ? e.size * ge : e.size * .95}">${L(t) || " "}</tspan>`).join("")}</text>`;
274
274
  }
275
- function Se(e, t) {
275
+ function we(e, t) {
276
276
  if (!t?.length) return e;
277
277
  let n = (e) => e.layer === void 0 ? 0 : Math.max(0, t.indexOf(e.layer));
278
278
  return e.map((e, t) => [e, t]).sort((e, t) => n(e[0]) - n(t[0]) || e[1] - t[1]).map(([e]) => e);
279
279
  }
280
- function Ce(e, t = {}) {
281
- let n = Se(e, t.layers).filter((e) => (t.page === void 0 || (e.page ?? 0) === t.page) && !t.hiddenLayers?.includes(e.layer ?? "")), r = t.padding ?? 16, i = t.box ?? ge(n.map(he)) ?? {
280
+ function Te(e, t = {}) {
281
+ let n = we(e, t.layers).filter((e) => (t.page === void 0 || (e.page ?? 0) === t.page) && !t.hiddenLayers?.includes(e.layer ?? "")), r = t.padding ?? 16, i = t.box ?? ye(n.map(ve)) ?? {
282
282
  x: 0,
283
283
  y: 0,
284
284
  width: 1,
@@ -288,10 +288,10 @@ function Ce(e, t = {}) {
288
288
  y: i.y - r,
289
289
  width: i.width + r * 2,
290
290
  height: i.height + r * 2
291
- }, o = t.background ? `<rect x="${a.x}" y="${a.y}" width="${a.width}" height="${a.height}" fill="${R(t.background)}"/>` : "";
292
- return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${P(a.x)} ${P(a.y)} ${P(a.width)} ${P(a.height)}" width="${Math.ceil(a.width)}" height="${Math.ceil(a.height)}">${o}${n.map((e) => z(e, t.fontFamily)).join("")}</svg>`;
291
+ }, o = t.background ? `<rect x="${a.x}" y="${a.y}" width="${a.width}" height="${a.height}" fill="${L(t.background)}"/>` : "";
292
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${M(a.x)} ${M(a.y)} ${M(a.width)} ${M(a.height)}" width="${Math.ceil(a.width)}" height="${Math.ceil(a.height)}">${o}${n.map((e) => R(e, t.fontFamily)).join("")}</svg>`;
293
293
  }
294
- async function we(e, t = 2) {
294
+ async function Ee(e, t = 2) {
295
295
  let n = URL.createObjectURL(new Blob([e], { type: "image/svg+xml" }));
296
296
  try {
297
297
  let e = new Image();
@@ -303,83 +303,83 @@ async function we(e, t = 2) {
303
303
  }
304
304
  }
305
305
  // src/composables/useDrawing.ts
306
- var Te = Symbol("m3-draw");
307
- function Ee() {
308
- let e = h(Te, null);
306
+ var De = Symbol("m3-draw");
307
+ function Oe() {
308
+ let e = ee(De, null);
309
309
  if (!e) throw Error("useDrawing() must be called inside <MDrawCanvas>");
310
310
  return e;
311
311
  }
312
312
  // src/components/MDrawCanvas.vue?vue&type=script&setup=true&lang.ts
313
- var De = ["aria-label"], Oe = [
313
+ var ke = ["aria-label"], Ae = [
314
314
  "id",
315
315
  "width",
316
316
  "height"
317
- ], ke = ["d", "stroke-width"], Ae = [
317
+ ], je = ["d", "stroke-width"], Me = [
318
318
  "id",
319
319
  "width",
320
320
  "height"
321
- ], je = [
321
+ ], Ne = [
322
322
  "cx",
323
323
  "cy",
324
324
  "r"
325
- ], Me = [
325
+ ], Pe = [
326
326
  "id",
327
327
  "width",
328
328
  "height"
329
- ], Ne = ["d", "stroke-width"], Pe = ["id"], Fe = ["width", "height"], Ie = ["transform"], Le = ["fill"], Re = ["href"], ze = ["fill"], Be = ["transform"], Ve = [
329
+ ], Fe = ["d", "stroke-width"], Ie = ["id"], Le = ["width", "height"], Re = ["transform"], ze = ["fill"], Be = ["href"], Ve = ["fill"], He = ["transform"], Ue = [
330
330
  "width",
331
331
  "height",
332
332
  "fill"
333
- ], He = [
333
+ ], We = [
334
334
  "href",
335
335
  "width",
336
336
  "height"
337
- ], Ue = [
337
+ ], Ge = [
338
338
  "width",
339
339
  "height",
340
340
  "fill"
341
- ], We = ["clip-path"], Ge = [
341
+ ], Ke = ["clip-path"], qe = [
342
342
  "d",
343
343
  "fill",
344
344
  "fill-opacity"
345
- ], Ke = [
345
+ ], Je = [
346
346
  "d",
347
347
  "fill",
348
348
  "stroke",
349
349
  "stroke-width"
350
- ], qe = ["d", "fill"], Je = [
350
+ ], Ye = ["d", "fill"], Xe = [
351
351
  "x",
352
352
  "y",
353
353
  "font-size",
354
354
  "fill"
355
- ], Ye = ["x", "dy"], Xe = [
355
+ ], Ze = ["x", "dy"], Qe = [
356
356
  "d",
357
357
  "fill",
358
358
  "fill-opacity"
359
- ], Ze = [
359
+ ], $e = [
360
360
  "d",
361
361
  "fill",
362
362
  "stroke",
363
363
  "stroke-width"
364
- ], Qe = ["d", "fill"], $e = [
364
+ ], et = ["d", "fill"], tt = [
365
365
  "points",
366
366
  "stroke-width",
367
367
  "stroke-dasharray"
368
- ], et = [
368
+ ], nt = [
369
369
  "x",
370
370
  "y",
371
371
  "width",
372
372
  "height",
373
373
  "stroke-width",
374
374
  "stroke-dasharray"
375
- ], tt = [
375
+ ], rt = [
376
376
  "x",
377
377
  "y",
378
378
  "width",
379
379
  "height",
380
380
  "rx",
381
381
  "stroke-width"
382
- ], nt = ["aria-label", "onKeydown"], rt = 24, it = 10, at = /* @__PURE__ */ m({
382
+ ], it = ["aria-label", "onKeydown"], at = 24, ot = 10, st = /* @__PURE__ */ h({
383
383
  __name: "MDrawCanvas",
384
384
  props: /*@__PURE__*/ g({
385
385
  mode: { default: "infinite" },
@@ -456,81 +456,81 @@ var De = ["aria-label"], Oe = [
456
456
  "update:viewport"
457
457
  ]),
458
458
  setup(t, { expose: n, emit: r }) {
459
- let i = t, a = k(t, "modelValue"), c = k(t, "tool"), f = k(t, "color"), p = k(t, "size"), m = k(t, "fill"), h = k(t, "layers"), g = k(t, "layer"), y = k(t, "pages"), A = k(t, "selection"), N = k(t, "viewport"), P = r, ue = e(), F = w(), _e = w(), I = w({
459
+ let i = t, a = O(t, "modelValue"), o = O(t, "tool"), l = O(t, "color"), p = O(t, "size"), m = O(t, "fill"), h = O(t, "layers"), ee = O(t, "layer"), g = O(t, "pages"), y = O(t, "selection"), A = O(t, "viewport"), ce = r, M = e(), N = S(), _e = S(), P = S({
460
460
  width: 0,
461
461
  height: 0
462
- }), L = (e) => e * (i.pageSize.height + rt), R = s(() => i.mode === "pages"), z = D(null), Ee = s(() => z.value ?? a.value), at = s(() => h.value.map((e) => e.id)), ot = s(() => g.value ?? h.value[h.value.length - 1]?.id), st = (e) => h.value.find((t) => t.id === (e.layer ?? h.value[0]?.id)), ct = (e) => st(e)?.visible !== !1, B = (e) => ct(e) && !st(e)?.locked, lt = s(() => Se(Ee.value, at.value).filter(ct)), V = D([]), H = D([]);
463
- function U(e) {
464
- i.history && (V.value = [...V.value, a.value].slice(-i.historySize), H.value = []), a.value = e, P("change", e);
465
- }
466
- function ut() {
467
- V.value.length && (H.value = [a.value, ...H.value], a.value = V.value[V.value.length - 1], V.value = V.value.slice(0, -1), A.value = A.value.filter((e) => a.value.some((t) => t.id === e)), P("change", a.value));
462
+ }), F = (e) => e * (i.pageSize.height + at), I = c(() => i.mode === "pages"), L = T(null), R = c(() => L.value ?? a.value), Oe = c(() => h.value.map((e) => e.id)), st = c(() => ee.value ?? h.value[h.value.length - 1]?.id), ct = (e) => h.value.find((t) => t.id === (e.layer ?? h.value[0]?.id)), lt = (e) => ct(e)?.visible !== !1, z = (e) => lt(e) && !ct(e)?.locked, ut = c(() => we(R.value, Oe.value).filter(lt)), B = T([]), V = T([]);
463
+ function H(e) {
464
+ i.history && (B.value = [...B.value, a.value].slice(-i.historySize), V.value = []), a.value = e, ce("change", e);
468
465
  }
469
466
  function dt() {
470
- H.value.length && (V.value = [...V.value, a.value], a.value = H.value[0], H.value = H.value.slice(1), P("change", a.value));
467
+ B.value.length && (V.value = [a.value, ...V.value], a.value = B.value[B.value.length - 1], B.value = B.value.slice(0, -1), y.value = y.value.filter((e) => a.value.some((t) => t.id === e)), ce("change", a.value));
471
468
  }
472
469
  function ft() {
473
- a.value.length && U(a.value.filter((e) => !B(e))), A.value = [];
470
+ V.value.length && (B.value = [...B.value, a.value], a.value = V.value[0], V.value = V.value.slice(1), ce("change", a.value));
474
471
  }
475
472
  function pt() {
476
- if (!A.value.length) return;
477
- let e = new Set(A.value);
478
- U(a.value.filter((t) => !e.has(t.id))), A.value = [];
473
+ a.value.length && H(a.value.filter((e) => !z(e))), y.value = [];
474
+ }
475
+ function mt() {
476
+ if (!y.value.length) return;
477
+ let e = new Set(y.value);
478
+ H(a.value.filter((t) => !e.has(t.id))), y.value = [];
479
479
  }
480
- let W = s(() => N.value);
481
- function G(e) {
482
- let t = F.value.getBoundingClientRect();
480
+ let U = c(() => A.value);
481
+ function W(e) {
482
+ let t = N.value.getBoundingClientRect();
483
483
  return {
484
- x: (e.clientX - t.left - W.value.x) / W.value.zoom,
485
- y: (e.clientY - t.top - W.value.y) / W.value.zoom
484
+ x: (e.clientX - t.left - U.value.x) / U.value.zoom,
485
+ y: (e.clientY - t.top - U.value.y) / U.value.zoom
486
486
  };
487
487
  }
488
- function mt(e) {
489
- if (!R.value) return;
490
- let t = Math.floor(e / (i.pageSize.height + rt));
491
- return Math.max(0, Math.min(y.value - 1, t));
488
+ function ht(e) {
489
+ if (!I.value) return;
490
+ let t = Math.floor(e / (i.pageSize.height + at));
491
+ return Math.max(0, Math.min(g.value - 1, t));
492
492
  }
493
- let ht = (e, t) => ({
493
+ let gt = (e, t) => ({
494
494
  x: e.x,
495
- y: t === void 0 ? e.y : e.y - L(t)
496
- }), gt = (e) => R.value ? L(e.page ?? 0) : 0, _t = (e) => Math.min(i.maxZoom, Math.max(i.minZoom, e));
497
- function vt(e, t, n) {
498
- let r = W.value, i = _t(e);
499
- N.value = {
495
+ y: t === void 0 ? e.y : e.y - F(t)
496
+ }), _t = (e) => I.value ? F(e.page ?? 0) : 0, vt = (e) => Math.min(i.maxZoom, Math.max(i.minZoom, e));
497
+ function yt(e, t, n) {
498
+ let r = U.value, i = vt(e);
499
+ A.value = {
500
500
  zoom: i,
501
501
  x: t - (t - r.x) / r.zoom * i,
502
502
  y: n - (n - r.y) / r.zoom * i
503
503
  };
504
504
  }
505
- let yt = (e) => vt(W.value.zoom * e, I.value.width / 2, I.value.height / 2);
506
- function bt() {
507
- let { width: e, height: t } = I.value;
505
+ let bt = (e) => yt(U.value.zoom * e, P.value.width / 2, P.value.height / 2);
506
+ function xt() {
507
+ let { width: e, height: t } = P.value;
508
508
  if (!e || !t) return;
509
- let n = R.value ? {
509
+ let n = I.value ? {
510
510
  x: 0,
511
511
  y: 0,
512
512
  width: i.pageSize.width,
513
- height: L(y.value - 1) + i.pageSize.height
514
- } : ge([...lt.value.map((e) => he(e)), ...i.backgroundImage && i.backgroundImageBox ? [i.backgroundImageBox] : []]);
513
+ height: F(g.value - 1) + i.pageSize.height
514
+ } : ye([...ut.value.map((e) => ve(e)), ...i.backgroundImage && i.backgroundImageBox ? [i.backgroundImageBox] : []]);
515
515
  if (!n) {
516
- N.value = {
516
+ A.value = {
517
517
  x: e / 2,
518
518
  y: t / 2,
519
519
  zoom: 1
520
520
  };
521
521
  return;
522
522
  }
523
- let r = _t(R.value ? Math.min((e - 48) / n.width, 1.5) : Math.min((e - 48) / n.width, (t - 48) / n.height, 2));
524
- N.value = {
523
+ let r = vt(I.value ? Math.min((e - 48) / n.width, 1.5) : Math.min((e - 48) / n.width, (t - 48) / n.height, 2));
524
+ A.value = {
525
525
  zoom: r,
526
526
  x: (e - n.width * r) / 2 - n.x * r,
527
- y: R.value ? 24 : (t - n.height * r) / 2 - n.y * r
527
+ y: I.value ? 24 : (t - n.height * r) / 2 - n.y * r
528
528
  };
529
529
  }
530
- let K = D(null), q = /* @__PURE__ */ new Map(), J = null, xt = w(!1), St = w(!1), Ct = s(() => i.penOnly === !0 || i.penOnly === "auto" && xt.value), Y = D(null), wt = D(null), Tt = (e) => e === "pen" || e === "brush" || e === "marker" || e === "highlighter", Et = (e) => e === "line" || e === "arrow" || e === "rect" || e === "ellipse", Dt = (e) => i.pressure && e.pointerType === "pen" && e.pressure > 0 ? e.pressure : .5;
530
+ let G = T(null), K = /* @__PURE__ */ new Map(), q = null, St = S(!1), Ct = S(!1), wt = c(() => i.penOnly === !0 || i.penOnly === "auto" && St.value), J = T(null), Y = T(null), Tt = (e) => e === "pen" || e === "brush" || e === "marker" || e === "highlighter", Et = (e) => e === "line" || e === "arrow" || e === "rect" || e === "ellipse", Dt = (e) => i.pressure && e.pointerType === "pen" && e.pressure > 0 ? e.pressure : .5;
531
531
  function Ot(e) {
532
- let t = c.value, n = e.points;
533
- return !(e.pen && i.pressure) && se[t].thinning > 0 && (n = le(n, p.value)), n = ce(n, i.smoothing, p.value).map(([e, t, n]) => [
532
+ let t = o.value, n = e.points;
533
+ return !(e.pen && i.pressure) && ue[t].thinning > 0 && (n = fe(n, p.value)), n = de(n, i.smoothing, p.value).map(([e, t, n]) => [
534
534
  Math.round(e * 100) / 100,
535
535
  Math.round(t * 100) / 100,
536
536
  Math.round(n * 100) / 100
@@ -538,96 +538,96 @@ var De = ["aria-label"], Oe = [
538
538
  id: "live",
539
539
  type: "stroke",
540
540
  pen: t,
541
- color: f.value,
541
+ color: l.value,
542
542
  size: p.value,
543
543
  points: n,
544
- layer: ot.value,
544
+ layer: st.value,
545
545
  page: e.page
546
546
  };
547
547
  }
548
548
  function kt() {
549
- let [e, t] = [...q.values()];
549
+ let [e, t] = [...K.values()];
550
550
  if (!e || !t) return;
551
- let n = F.value.getBoundingClientRect();
552
- J = {
551
+ let n = N.value.getBoundingClientRect();
552
+ q = {
553
553
  d: Math.hypot(e.x - t.x, e.y - t.y) || 1,
554
554
  mx: (e.x + t.x) / 2 - n.left,
555
555
  my: (e.y + t.y) / 2 - n.top,
556
- vp: { ...W.value }
557
- }, K.value = {
556
+ vp: { ...U.value }
557
+ }, G.value = {
558
558
  kind: "pinch",
559
- ids: [...q.keys()].slice(0, 2)
559
+ ids: [...K.keys()].slice(0, 2)
560
560
  };
561
561
  }
562
- let At = (e) => e.target === F.value || !!_e.value?.contains(e.target);
562
+ let At = (e) => e.target === N.value || !!_e.value?.contains(e.target);
563
563
  function jt(e) {
564
564
  if (!At(e)) return;
565
- F.value.focus({ preventScroll: !0 }), e.pointerType === "touch" && q.set(e.pointerId, {
565
+ N.value.focus({ preventScroll: !0 }), e.pointerType === "touch" && K.set(e.pointerId, {
566
566
  x: e.clientX,
567
567
  y: e.clientY
568
- }), e.pointerType === "pen" && (xt.value = !0);
569
- let t = K.value;
570
- if (e.pointerType === "touch" && q.size === 2 && (!t || t.kind === "pan" || t.kind === "draw" && t.touch || t.kind === "lasso" || t.kind === "shape" || t.kind === "erase")) {
571
- t?.kind === "erase" && (z.value = null), Y.value = null, wt.value = null, kt();
568
+ }), e.pointerType === "pen" && (St.value = !0);
569
+ let t = G.value;
570
+ if (e.pointerType === "touch" && K.size === 2 && (!t || t.kind === "pan" || t.kind === "draw" && t.touch || t.kind === "lasso" || t.kind === "shape" || t.kind === "erase")) {
571
+ t?.kind === "erase" && (L.value = null), J.value = null, Y.value = null, kt();
572
572
  return;
573
573
  }
574
574
  if (t) return;
575
575
  try {
576
- F.value.setPointerCapture(e.pointerId);
576
+ N.value.setPointerCapture(e.pointerId);
577
577
  } catch {}
578
- let n = G(e);
579
- if (e.button === 1 || St.value || c.value === "pan" || i.readonly || e.pointerType === "touch" && Ct.value) {
580
- K.value = {
578
+ let n = W(e);
579
+ if (e.button === 1 || Ct.value || o.value === "pan" || i.readonly || e.pointerType === "touch" && wt.value) {
580
+ G.value = {
581
581
  kind: "pan",
582
582
  id: e.pointerId,
583
583
  sx: e.clientX,
584
584
  sy: e.clientY,
585
- vx: W.value.x,
586
- vy: W.value.y
585
+ vx: U.value.x,
586
+ vy: U.value.y
587
587
  };
588
588
  return;
589
589
  }
590
590
  if (e.button !== 0 && (e.pointerType !== "pen" || e.button !== 5)) return;
591
- let r = e.pointerType === "pen" && (e.button === 5 || e.buttons & 32) ? "eraser" : c.value;
591
+ let r = e.pointerType === "pen" && (e.button === 5 || e.buttons & 32) ? "eraser" : o.value;
592
592
  if (r === "eraser" || r === "stroke-eraser") {
593
- K.value = {
593
+ G.value = {
594
594
  kind: "erase",
595
595
  id: e.pointerId,
596
596
  whole: r === "stroke-eraser",
597
597
  last: n
598
- }, z.value = a.value, Pt(n);
598
+ }, L.value = a.value, Pt(n);
599
599
  return;
600
600
  }
601
- let o = mt(n.y), s = ht(n, o);
602
- if (Tt(r)) K.value = {
601
+ let s = ht(n.y), c = gt(n, s);
602
+ if (Tt(r)) G.value = {
603
603
  kind: "draw",
604
604
  id: e.pointerId,
605
- page: o,
605
+ page: s,
606
606
  points: [[
607
- s.x,
608
- s.y,
607
+ c.x,
608
+ c.y,
609
609
  Dt(e)
610
610
  ]],
611
611
  pen: e.pointerType === "pen",
612
612
  touch: e.pointerType === "touch",
613
613
  started: performance.now()
614
- }, Y.value = Ot(K.value);
615
- else if (Et(r)) K.value = {
614
+ }, J.value = Ot(G.value);
615
+ else if (Et(r)) G.value = {
616
616
  kind: "shape",
617
617
  id: e.pointerId,
618
- page: o,
618
+ page: s,
619
619
  shape: r,
620
- from: [s.x, s.y],
621
- to: [s.x, s.y]
620
+ from: [c.x, c.y],
621
+ to: [c.x, c.y]
622
622
  };
623
623
  else if (r === "text") {
624
624
  let t = Ft(n, (e) => e.type === "text");
625
- t ? Ut(t) : Ht(s, o), e.preventDefault();
625
+ t ? Ut(t) : Ht(c, s), e.preventDefault();
626
626
  } else if (r === "select") {
627
627
  let t = Bt(n);
628
628
  if (t) {
629
629
  let r = X.value, i = t.includes("l") ? r.x + r.width : r.x, o = t.includes("t") ? r.y + r.height : r.y;
630
- K.value = {
630
+ G.value = {
631
631
  kind: "scale",
632
632
  id: e.pointerId,
633
633
  origin: {
@@ -635,39 +635,39 @@ var De = ["aria-label"], Oe = [
635
635
  y: o
636
636
  },
637
637
  from: n
638
- }, z.value = a.value;
638
+ }, L.value = a.value;
639
639
  return;
640
640
  }
641
641
  let r = Ft(n), i = X.value && n.x >= X.value.x && n.x <= X.value.x + X.value.width && n.y >= X.value.y && n.y <= X.value.y + X.value.height;
642
- if (r && !A.value.includes(r.id) && !i && (A.value = e.shiftKey ? [...A.value, r.id] : [r.id]), r || i) {
643
- K.value = {
642
+ if (r && !y.value.includes(r.id) && !i && (y.value = e.shiftKey ? [...y.value, r.id] : [r.id]), r || i) {
643
+ G.value = {
644
644
  kind: "move",
645
645
  id: e.pointerId,
646
646
  from: n,
647
647
  moved: !1
648
- }, z.value = a.value;
648
+ }, L.value = a.value;
649
649
  return;
650
650
  }
651
- K.value = {
651
+ G.value = {
652
652
  kind: "lasso",
653
653
  id: e.pointerId,
654
654
  points: [[n.x, n.y]],
655
655
  add: e.shiftKey
656
- }, wt.value = [[n.x, n.y]];
656
+ }, Y.value = [[n.x, n.y]];
657
657
  }
658
658
  }
659
659
  function Mt(e) {
660
- e.pointerType === "touch" && q.has(e.pointerId) && q.set(e.pointerId, {
660
+ e.pointerType === "touch" && K.has(e.pointerId) && K.set(e.pointerId, {
661
661
  x: e.clientX,
662
662
  y: e.clientY
663
663
  });
664
- let t = K.value;
664
+ let t = G.value;
665
665
  if (!t) return;
666
666
  if (t.kind === "pinch") {
667
- let [e, n] = t.ids.map((e) => q.get(e));
668
- if (!e || !n || !J) return;
669
- let r = F.value.getBoundingClientRect(), i = Math.hypot(e.x - n.x, e.y - n.y), a = (e.x + n.x) / 2 - r.left, o = (e.y + n.y) / 2 - r.top, s = _t(J.vp.zoom * (i / J.d)), c = (J.mx - J.vp.x) / J.vp.zoom, l = (J.my - J.vp.y) / J.vp.zoom;
670
- N.value = {
667
+ let [e, n] = t.ids.map((e) => K.get(e));
668
+ if (!e || !n || !q) return;
669
+ let r = N.value.getBoundingClientRect(), i = Math.hypot(e.x - n.x, e.y - n.y), a = (e.x + n.x) / 2 - r.left, o = (e.y + n.y) / 2 - r.top, s = vt(q.vp.zoom * (i / q.d)), c = (q.mx - q.vp.x) / q.vp.zoom, l = (q.my - q.vp.y) / q.vp.zoom;
670
+ A.value = {
671
671
  zoom: s,
672
672
  x: a - c * s,
673
673
  y: o - l * s
@@ -676,8 +676,8 @@ var De = ["aria-label"], Oe = [
676
676
  }
677
677
  if ("id" in t && t.id !== e.pointerId) return;
678
678
  if (t.kind === "pan") {
679
- N.value = {
680
- ...W.value,
679
+ A.value = {
680
+ ...U.value,
681
681
  x: t.vx + e.clientX - t.sx,
682
682
  y: t.vy + e.clientY - t.sy
683
683
  };
@@ -686,21 +686,21 @@ var De = ["aria-label"], Oe = [
686
686
  let n = (e.getCoalescedEvents?.() ?? []).length ? e.getCoalescedEvents() : [e];
687
687
  if (t.kind === "draw") {
688
688
  for (let e of n) {
689
- let n = ht(G(e), t.page);
689
+ let n = gt(W(e), t.page);
690
690
  t.points.push([
691
691
  n.x,
692
692
  n.y,
693
693
  Dt(e)
694
694
  ]);
695
695
  }
696
- Y.value = Ot(t);
696
+ J.value = Ot(t);
697
697
  return;
698
698
  }
699
- let r = G(e);
699
+ let r = W(e);
700
700
  if (t.kind === "erase") {
701
- let e = i.eraserSize / W.value.zoom / 2;
701
+ let e = i.eraserSize / U.value.zoom / 2;
702
702
  for (let r of n) {
703
- let n = G(r), i = Math.max(1, Math.ceil(Math.hypot(n.x - t.last.x, n.y - t.last.y) / e));
703
+ let n = W(r), i = Math.max(1, Math.ceil(Math.hypot(n.x - t.last.x, n.y - t.last.y) / e));
704
704
  for (let e = 1; e <= i; e++) Pt({
705
705
  x: t.last.x + (n.x - t.last.x) * e / i,
706
706
  y: t.last.y + (n.y - t.last.y) * e / i
@@ -708,144 +708,144 @@ var De = ["aria-label"], Oe = [
708
708
  t.last = n;
709
709
  }
710
710
  } else if (t.kind === "shape") {
711
- let n = ht(r, t.page);
712
- t.to = e.shiftKey ? pe(t.shape, t.from, [n.x, n.y]) : [n.x, n.y], Y.value = {
711
+ let n = gt(r, t.page);
712
+ t.to = e.shiftKey ? he(t.shape, t.from, [n.x, n.y]) : [n.x, n.y], J.value = {
713
713
  id: "live",
714
714
  type: "shape",
715
715
  shape: t.shape,
716
716
  from: t.from,
717
717
  to: t.to,
718
- color: f.value,
718
+ color: l.value,
719
719
  size: p.value,
720
- fill: m.value ? f.value : null,
721
- layer: ot.value,
720
+ fill: m.value ? l.value : null,
721
+ layer: st.value,
722
722
  page: t.page
723
723
  };
724
- } else if (t.kind === "lasso") t.points.push([r.x, r.y]), wt.value = t.points.slice();
724
+ } else if (t.kind === "lasso") t.points.push([r.x, r.y]), Y.value = t.points.slice();
725
725
  else if (t.kind === "move") {
726
726
  let e = r.x - t.from.x, n = r.y - t.from.y;
727
- if (!t.moved && Math.hypot(e, n) * W.value.zoom < 3) return;
727
+ if (!t.moved && Math.hypot(e, n) * U.value.zoom < 3) return;
728
728
  t.moved = !0;
729
- let i = new Set(A.value);
730
- z.value = a.value.map((t) => i.has(t.id) ? xe(t, {
729
+ let i = new Set(y.value);
730
+ L.value = a.value.map((t) => i.has(t.id) ? Ce(t, {
731
731
  dx: e,
732
732
  dy: n
733
733
  }) : t);
734
734
  } else if (t.kind === "scale") {
735
- let e = Math.hypot(t.from.x - t.origin.x, t.from.y - t.origin.y) || 1, n = Math.max(.05, Math.hypot(r.x - t.origin.x, r.y - t.origin.y) / e), i = new Set(A.value);
736
- z.value = a.value.map((e) => i.has(e.id) ? xe(e, {
735
+ let e = Math.hypot(t.from.x - t.origin.x, t.from.y - t.origin.y) || 1, n = Math.max(.05, Math.hypot(r.x - t.origin.x, r.y - t.origin.y) / e), i = new Set(y.value);
736
+ L.value = a.value.map((e) => i.has(e.id) ? Ce(e, {
737
737
  sx: n,
738
738
  sy: n,
739
739
  ox: t.origin.x,
740
- oy: t.origin.y - gt(e)
740
+ oy: t.origin.y - _t(e)
741
741
  }) : e);
742
742
  }
743
743
  }
744
744
  function Nt(e) {
745
- q.delete(e.pointerId);
746
- let t = K.value;
745
+ K.delete(e.pointerId);
746
+ let t = G.value;
747
747
  if (!t) return;
748
748
  if (t.kind === "pinch") {
749
749
  if (!t.ids.includes(e.pointerId)) return;
750
- K.value = null, J = null;
751
- let [n, r] = [...q.entries()][0] ?? [];
752
- n !== void 0 && r && (K.value = {
750
+ G.value = null, q = null;
751
+ let [n, r] = [...K.entries()][0] ?? [];
752
+ n !== void 0 && r && (G.value = {
753
753
  kind: "pan",
754
754
  id: n,
755
755
  sx: r.x,
756
756
  sy: r.y,
757
- vx: W.value.x,
758
- vy: W.value.y
757
+ vx: U.value.x,
758
+ vy: U.value.y
759
759
  });
760
760
  return;
761
761
  }
762
762
  if (t.id !== e.pointerId) return;
763
- K.value = null;
763
+ G.value = null;
764
764
  let n = e.type === "pointercancel";
765
765
  if (t.kind === "draw") {
766
766
  let e = Ot(t);
767
- Y.value = null, n || U([...a.value, {
767
+ J.value = null, n || H([...a.value, {
768
768
  ...e,
769
- id: oe()
769
+ id: le()
770
770
  }]);
771
771
  } else if (t.kind === "shape") {
772
- let e = Y.value;
773
- Y.value = null, e && !n && Math.hypot(t.to[0] - t.from[0], t.to[1] - t.from[1]) > 2 && U([...a.value, {
772
+ let e = J.value;
773
+ J.value = null, e && !n && Math.hypot(t.to[0] - t.from[0], t.to[1] - t.from[1]) > 2 && H([...a.value, {
774
774
  ...e,
775
- id: oe()
775
+ id: le()
776
776
  }]);
777
777
  } else if (t.kind === "erase" || t.kind === "move" || t.kind === "scale") {
778
- let r = z.value;
779
- if (z.value = null, r && r !== a.value && !n && (t.kind !== "move" || t.moved) && U(r), t.kind === "move" && !t.moved && !e.shiftKey) {
780
- let t = Ft(G(e));
781
- A.value = t ? [t.id] : [];
778
+ let r = L.value;
779
+ if (L.value = null, r && r !== a.value && !n && (t.kind !== "move" || t.moved) && H(r), t.kind === "move" && !t.moved && !e.shiftKey) {
780
+ let t = Ft(W(e));
781
+ y.value = t ? [t.id] : [];
782
782
  }
783
783
  } else if (t.kind === "lasso") {
784
784
  let e = t.points;
785
- if (wt.value = null, e.length < 3) {
786
- t.add || (A.value = []);
785
+ if (Y.value = null, e.length < 3) {
786
+ t.add || (y.value = []);
787
787
  return;
788
788
  }
789
- let n = Ee.value.filter((t) => B(t) && be(t, e.map(([e, n]) => [e, n - gt(t)]))).map((e) => e.id);
790
- A.value = t.add ? [.../* @__PURE__ */ new Set([...A.value, ...n])] : n;
789
+ let n = R.value.filter((t) => z(t) && Se(t, e.map(([e, n]) => [e, n - _t(t)]))).map((e) => e.id);
790
+ y.value = t.add ? [.../* @__PURE__ */ new Set([...y.value, ...n])] : n;
791
791
  }
792
792
  }
793
793
  function Pt(e) {
794
- let t = i.eraserSize / W.value.zoom, n = K.value, r = n?.kind === "erase" && n.whole, o = !1, s = [];
795
- for (let n of z.value ?? a.value) {
796
- if (!B(n)) {
794
+ let t = i.eraserSize / U.value.zoom, n = G.value, r = n?.kind === "erase" && n.whole, o = !1, s = [];
795
+ for (let n of L.value ?? a.value) {
796
+ if (!z(n)) {
797
797
  s.push(n);
798
798
  continue;
799
799
  }
800
- let i = e.x, a = e.y - gt(n);
800
+ let i = e.x, a = e.y - _t(n);
801
801
  if (r) {
802
- ve(n, i, a, t) ? o = !0 : s.push(n);
802
+ be(n, i, a, t) ? o = !0 : s.push(n);
803
803
  continue;
804
804
  }
805
- let c = ye(n, i, a, t);
805
+ let c = xe(n, i, a, t);
806
806
  (c.length !== 1 || c[0] !== n) && (o = !0), s.push(...c);
807
807
  }
808
- o && (z.value = s);
808
+ o && (L.value = s);
809
809
  }
810
810
  function Ft(e, t = () => !0) {
811
- let n = 6 / W.value.zoom, r = lt.value;
811
+ let n = 6 / U.value.zoom, r = ut.value;
812
812
  for (let i = r.length - 1; i >= 0; i--) {
813
813
  let a = r[i];
814
- if (B(a) && t(a) && ve(a, e.x, e.y - gt(a), n)) return a;
814
+ if (z(a) && t(a) && be(a, e.x, e.y - _t(a), n)) return a;
815
815
  }
816
816
  return null;
817
817
  }
818
818
  function It(e) {
819
819
  if (!At(e)) return;
820
820
  e.preventDefault();
821
- let t = F.value.getBoundingClientRect();
822
- if (e.ctrlKey || e.metaKey) vt(W.value.zoom * Math.exp(-e.deltaY * (e.deltaMode ? .05 : .01)), e.clientX - t.left, e.clientY - t.top);
821
+ let t = N.value.getBoundingClientRect();
822
+ if (e.ctrlKey || e.metaKey) yt(U.value.zoom * Math.exp(-e.deltaY * (e.deltaMode ? .05 : .01)), e.clientX - t.left, e.clientY - t.top);
823
823
  else {
824
824
  let t = e.deltaMode ? 16 : 1, n = e.shiftKey && !e.deltaX ? e.deltaY : e.deltaX, r = e.shiftKey && !e.deltaX ? 0 : e.deltaY;
825
- N.value = {
826
- ...W.value,
827
- x: W.value.x - n * t,
828
- y: W.value.y - r * t
825
+ A.value = {
826
+ ...U.value,
827
+ x: U.value.x - n * t,
828
+ y: U.value.y - r * t
829
829
  };
830
830
  }
831
831
  }
832
832
  function Lt(e) {
833
833
  if (!At(e)) return;
834
834
  let t = e.ctrlKey || e.metaKey;
835
- t && e.key.toLowerCase() === "z" ? (e.preventDefault(), e.shiftKey ? dt() : ut()) : t && e.key.toLowerCase() === "y" ? (e.preventDefault(), dt()) : t && e.key.toLowerCase() === "a" && !i.readonly ? (e.preventDefault(), c.value = "select", A.value = Ee.value.filter(B).map((e) => e.id)) : (e.key === "Delete" || e.key === "Backspace") && A.value.length ? (e.preventDefault(), pt()) : e.key === "Escape" ? A.value = [] : e.key === " " && !e.repeat && (e.preventDefault(), St.value = !0);
835
+ t && e.key.toLowerCase() === "z" ? (e.preventDefault(), e.shiftKey ? ft() : dt()) : t && e.key.toLowerCase() === "y" ? (e.preventDefault(), ft()) : t && e.key.toLowerCase() === "a" && !i.readonly ? (e.preventDefault(), o.value = "select", y.value = R.value.filter(z).map((e) => e.id)) : (e.key === "Delete" || e.key === "Backspace") && y.value.length ? (e.preventDefault(), mt()) : e.key === "Escape" ? y.value = [] : e.key === " " && !e.repeat && (e.preventDefault(), Ct.value = !0);
836
836
  }
837
- let Rt = (e) => e.key === " " && (St.value = !1), X = s(() => {
838
- let e = new Set(A.value);
839
- return ge(Ee.value.filter((t) => e.has(t.id)).map((e) => {
840
- let t = he(e);
837
+ let Rt = (e) => e.key === " " && (Ct.value = !1), X = c(() => {
838
+ let e = new Set(y.value);
839
+ return ye(R.value.filter((t) => e.has(t.id)).map((e) => {
840
+ let t = ve(e);
841
841
  return {
842
842
  ...t,
843
- y: t.y + gt(e)
843
+ y: t.y + _t(e)
844
844
  };
845
845
  }));
846
- }), zt = s(() => {
846
+ }), zt = c(() => {
847
847
  let e = X.value;
848
- return !e || c.value !== "select" ? [] : [
848
+ return !e || o.value !== "select" ? [] : [
849
849
  {
850
850
  id: "tl",
851
851
  x: e.x,
@@ -873,11 +873,11 @@ var De = ["aria-label"], Oe = [
873
873
  ];
874
874
  });
875
875
  function Bt(e) {
876
- let t = it * 1.2 / W.value.zoom;
876
+ let t = ot * 1.2 / U.value.zoom;
877
877
  return zt.value.find((n) => Math.abs(n.x - e.x) <= t && Math.abs(n.y - e.y) <= t)?.id;
878
878
  }
879
- ie(c, (e) => e !== "select" && (A.value = []));
880
- let Z = w(null), Vt = w();
879
+ ae(o, (e) => e !== "select" && (y.value = []));
880
+ let Z = S(null), Vt = S();
881
881
  function Ht(e, t) {
882
882
  if (Z.value) return Wt();
883
883
  let n = Math.max(12, p.value * 4);
@@ -887,7 +887,7 @@ var De = ["aria-label"], Oe = [
887
887
  page: t,
888
888
  text: "",
889
889
  size: n,
890
- color: f.value
890
+ color: l.value
891
891
  }, v(() => Vt.value?.focus());
892
892
  }
893
893
  function Ut(e) {
@@ -910,129 +910,129 @@ var De = ["aria-label"], Oe = [
910
910
  if (e.id) {
911
911
  let n = a.value.find((t) => t.id === e.id);
912
912
  if (!n) return;
913
- t ? n.type === "text" && n.text !== t && U(a.value.map((n) => n.id === e.id ? {
913
+ t ? n.type === "text" && n.text !== t && H(a.value.map((n) => n.id === e.id ? {
914
914
  ...n,
915
915
  text: t
916
- } : n)) : U(a.value.filter((t) => t.id !== e.id));
917
- } else t && U([...a.value, {
918
- id: oe(),
916
+ } : n)) : H(a.value.filter((t) => t.id !== e.id));
917
+ } else t && H([...a.value, {
918
+ id: le(),
919
919
  type: "text",
920
920
  at: e.at,
921
921
  text: t,
922
922
  size: e.size,
923
923
  color: e.color,
924
- layer: ot.value,
924
+ layer: st.value,
925
925
  page: e.page
926
926
  }]);
927
927
  }
928
- let Gt = s(() => {
928
+ let Gt = c(() => {
929
929
  let e = Z.value;
930
930
  if (!e) return {};
931
- let t = W.value.zoom, n = e.page === void 0 ? 0 : L(e.page), r = e.text.split("\n");
931
+ let t = U.value.zoom, n = e.page === void 0 ? 0 : F(e.page), r = e.text.split("\n");
932
932
  return {
933
- left: `${e.at[0] * t + W.value.x}px`,
934
- top: `${(e.at[1] + n) * t + W.value.y}px`,
933
+ left: `${e.at[0] * t + U.value.x}px`,
934
+ top: `${(e.at[1] + n) * t + U.value.y}px`,
935
935
  fontSize: `${e.size * t}px`,
936
- lineHeight: String(me),
936
+ lineHeight: String(ge),
937
937
  color: e.color,
938
938
  width: `${Math.max(4, ...r.map((e) => e.length + 1)) * .6}em`,
939
- height: `${r.length * me}em`
939
+ height: `${r.length * ge}em`
940
940
  };
941
941
  });
942
942
  function Kt(e) {
943
- if (c.value !== "select" || i.readonly) return;
944
- let t = Ft(G(e), (e) => e.type === "text");
943
+ if (o.value !== "select" || i.readonly) return;
944
+ let t = Ft(W(e), (e) => e.type === "text");
945
945
  t && Ut(t);
946
946
  }
947
947
  let qt = /* @__PURE__ */ new WeakMap();
948
948
  function Jt(e) {
949
949
  let t = qt.get(e);
950
- return t || (t = e.type === "stroke" ? { d: de(e) } : e.type === "shape" ? fe(e) : { d: "" }, qt.set(e, t)), t;
950
+ return t || (t = e.type === "stroke" ? { d: pe(e) } : e.type === "shape" ? me(e) : { d: "" }, qt.set(e, t)), t;
951
951
  }
952
- let Yt = s(() => Z.value?.id), Xt = s(() => R.value ? Array.from({ length: Math.max(1, y.value) }, (e, t) => t) : [void 0]), Zt = (e) => lt.value.filter((t) => (e === void 0 || (t.page ?? 0) === e) && t.id !== Yt.value), Qt = s(() => {
953
- let e = W.value.zoom;
952
+ let Yt = c(() => Z.value?.id), Xt = c(() => I.value ? Array.from({ length: Math.max(1, g.value) }, (e, t) => t) : [void 0]), Zt = (e) => ut.value.filter((t) => (e === void 0 || (t.page ?? 0) === e) && t.id !== Yt.value), Qt = c(() => {
953
+ let e = U.value.zoom;
954
954
  return {
955
- x: -W.value.x / e,
956
- y: -W.value.y / e,
957
- width: I.value.width / e,
958
- height: I.value.height / e
955
+ x: -U.value.x / e,
956
+ y: -U.value.y / e,
957
+ width: P.value.width / e,
958
+ height: P.value.height / e
959
959
  };
960
- }), Q = `m3d${ne().replace(/[^a-zA-Z0-9-]/g, "")}`, $ = s(() => i.backgroundSize), $t = s(() => K.value?.kind === "pan" || K.value?.kind === "pinch" ? "grabbing" : St.value || c.value === "pan" || i.readonly ? "grab" : c.value === "text" ? "text" : c.value === "select" ? "default" : "crosshair"), en = s(() => h.value.filter((e) => e.visible === !1).map((e) => e.id));
960
+ }), Q = `m3d${D().replace(/[^a-zA-Z0-9-]/g, "")}`, $ = c(() => i.backgroundSize), $t = c(() => G.value?.kind === "pan" || G.value?.kind === "pinch" ? "grabbing" : Ct.value || o.value === "pan" || i.readonly ? "grab" : o.value === "text" ? "text" : o.value === "select" ? "default" : "crosshair"), en = c(() => h.value.filter((e) => e.visible === !1).map((e) => e.id));
961
961
  function tn(e = {}) {
962
- let t = F.value ? getComputedStyle(F.value).fontFamily : "sans-serif", n = R.value ? e.page ?? 0 : void 0;
963
- return Ce(a.value, {
962
+ let t = N.value ? getComputedStyle(N.value).fontFamily : "sans-serif", n = I.value ? e.page ?? 0 : void 0;
963
+ return Te(a.value, {
964
964
  page: n,
965
- box: R.value ? {
965
+ box: I.value ? {
966
966
  x: 0,
967
967
  y: 0,
968
968
  ...i.pageSize
969
969
  } : void 0,
970
970
  background: e.background === !1 ? void 0 : i.paper,
971
971
  hiddenLayers: en.value,
972
- layers: at.value,
972
+ layers: Oe.value,
973
973
  fontFamily: t
974
974
  });
975
975
  }
976
- let nn = (e = {}) => we(tn(e), e.scale ?? 2), rn = null;
977
- return S(() => {
978
- let e = F.value;
976
+ let nn = (e = {}) => Ee(tn(e), e.scale ?? 2), rn = null;
977
+ return ne(() => {
978
+ let e = N.value;
979
979
  e.addEventListener("wheel", It, { passive: !1 });
980
- let t = () => I.value = {
980
+ let t = () => P.value = {
981
981
  width: e.clientWidth,
982
982
  height: e.clientHeight
983
983
  };
984
984
  t(), rn = new ResizeObserver(t), rn.observe(e);
985
- let n = N.value;
986
- n.x === 0 && n.y === 0 && n.zoom === 1 && bt();
987
- }), x(() => {
988
- rn?.disconnect(), F.value?.removeEventListener("wheel", It);
989
- }), ee(Te, {
990
- tool: c,
991
- color: f,
985
+ let n = A.value;
986
+ n.x === 0 && n.y === 0 && n.zoom === 1 && xt();
987
+ }), te(() => {
988
+ rn?.disconnect(), N.value?.removeEventListener("wheel", It);
989
+ }), re(De, {
990
+ tool: o,
991
+ color: l,
992
992
  size: p,
993
993
  fill: m,
994
- items: s(() => a.value),
995
- selection: A,
996
- layers: s(() => h.value),
994
+ items: c(() => a.value),
995
+ selection: y,
996
+ layers: c(() => h.value),
997
997
  setLayers: (e) => h.value = e,
998
- layer: s({
999
- get: () => ot.value,
1000
- set: (e) => g.value = e
998
+ layer: c({
999
+ get: () => st.value,
1000
+ set: (e) => ee.value = e
1001
1001
  }),
1002
- mode: s(() => i.mode),
1003
- pages: y,
1004
- addPage: () => y.value += 1,
1005
- zoom: s(() => W.value.zoom),
1006
- zoomIn: () => yt(1.25),
1007
- zoomOut: () => yt(.8),
1008
- fitView: bt,
1009
- canUndo: s(() => V.value.length > 0),
1010
- canRedo: s(() => H.value.length > 0),
1011
- undo: ut,
1012
- redo: dt,
1013
- clear: ft,
1014
- deleteSelection: pt,
1002
+ mode: c(() => i.mode),
1003
+ pages: g,
1004
+ addPage: () => g.value += 1,
1005
+ zoom: c(() => U.value.zoom),
1006
+ zoomIn: () => bt(1.25),
1007
+ zoomOut: () => bt(.8),
1008
+ fitView: xt,
1009
+ canUndo: c(() => B.value.length > 0),
1010
+ canRedo: c(() => V.value.length > 0),
1011
+ undo: dt,
1012
+ redo: ft,
1013
+ clear: pt,
1014
+ deleteSelection: mt,
1015
1015
  exportSvg: tn,
1016
1016
  exportPng: nn
1017
1017
  }), n({
1018
- undo: ut,
1019
- redo: dt,
1020
- clear: ft,
1021
- deleteSelection: pt,
1022
- fitView: bt,
1023
- zoomIn: () => yt(1.25),
1024
- zoomOut: () => yt(.8),
1018
+ undo: dt,
1019
+ redo: ft,
1020
+ clear: pt,
1021
+ deleteSelection: mt,
1022
+ fitView: xt,
1023
+ zoomIn: () => bt(1.25),
1024
+ zoomOut: () => bt(.8),
1025
1025
  exportSvg: tn,
1026
1026
  exportPng: nn,
1027
- toContent: G
1028
- }), (e, n) => (C(), u("div", {
1027
+ toContent: W
1028
+ }), (e, n) => (x(), d("div", {
1029
1029
  ref_key: "root",
1030
- ref: F,
1030
+ ref: N,
1031
1031
  class: "m3-draw-canvas outline-none select-none [touch-action:none]",
1032
1032
  style: b({ cursor: $t.value }),
1033
1033
  tabindex: "0",
1034
1034
  role: "application",
1035
- "aria-label": t.label ?? O(ue).drawCanvas,
1035
+ "aria-label": t.label ?? E(M).drawCanvas,
1036
1036
  onPointerdown: jt,
1037
1037
  onPointermove: Mt,
1038
1038
  onPointerup: Nt,
@@ -1041,81 +1041,81 @@ var De = ["aria-label"], Oe = [
1041
1041
  onDblclick: Kt,
1042
1042
  onKeydown: Lt,
1043
1043
  onKeyup: Rt,
1044
- onContextmenu: n[2] ||= M(() => {}, ["prevent"])
1044
+ onContextmenu: n[2] ||= se(() => {}, ["prevent"])
1045
1045
  }, [
1046
- (C(), u("svg", {
1046
+ (x(), d("svg", {
1047
1047
  ref_key: "svgEl",
1048
1048
  ref: _e,
1049
1049
  class: "absolute inset-0 size-full",
1050
1050
  "aria-hidden": "true"
1051
- }, [d("defs", null, [
1052
- d("pattern", {
1051
+ }, [f("defs", null, [
1052
+ f("pattern", {
1053
1053
  id: `${Q}-grid`,
1054
1054
  width: $.value,
1055
1055
  height: $.value,
1056
1056
  patternUnits: "userSpaceOnUse"
1057
- }, [d("path", {
1057
+ }, [f("path", {
1058
1058
  d: `M${$.value} 0H0V${$.value}`,
1059
1059
  fill: "none",
1060
1060
  stroke: "rgba(0,0,0,.12)",
1061
- "stroke-width": 1 / W.value.zoom
1062
- }, null, 8, ke)], 8, Oe),
1063
- d("pattern", {
1061
+ "stroke-width": 1 / U.value.zoom
1062
+ }, null, 8, je)], 8, Ae),
1063
+ f("pattern", {
1064
1064
  id: `${Q}-dots`,
1065
1065
  width: $.value,
1066
1066
  height: $.value,
1067
1067
  patternUnits: "userSpaceOnUse"
1068
- }, [d("circle", {
1068
+ }, [f("circle", {
1069
1069
  cx: $.value / 2,
1070
1070
  cy: $.value / 2,
1071
- r: Math.max(.8, 1.2 / W.value.zoom),
1071
+ r: Math.max(.8, 1.2 / U.value.zoom),
1072
1072
  fill: "rgba(0,0,0,.22)"
1073
- }, null, 8, je)], 8, Ae),
1074
- d("pattern", {
1073
+ }, null, 8, Ne)], 8, Me),
1074
+ f("pattern", {
1075
1075
  id: `${Q}-lines`,
1076
1076
  width: $.value * 4,
1077
1077
  height: $.value * 1.25,
1078
1078
  patternUnits: "userSpaceOnUse"
1079
- }, [d("path", {
1079
+ }, [f("path", {
1080
1080
  d: `M0 ${$.value * 1.25 - .5}H${$.value * 4}`,
1081
1081
  fill: "none",
1082
1082
  stroke: "rgba(30,90,200,.22)",
1083
- "stroke-width": 1 / W.value.zoom
1084
- }, null, 8, Ne)], 8, Me),
1085
- (C(!0), u(o, null, T(R.value ? Xt.value : [], (e) => (C(), u("clipPath", {
1083
+ "stroke-width": 1 / U.value.zoom
1084
+ }, null, 8, Fe)], 8, Pe),
1085
+ (x(!0), d(s, null, C(I.value ? Xt.value : [], (e) => (x(), d("clipPath", {
1086
1086
  id: `${Q}-page${e}`,
1087
1087
  key: e ?? "x"
1088
- }, [d("rect", {
1088
+ }, [f("rect", {
1089
1089
  x: "0",
1090
1090
  y: "0",
1091
1091
  width: t.pageSize.width,
1092
1092
  height: t.pageSize.height
1093
- }, null, 8, Fe)], 8, Pe))), 128))
1094
- ]), d("g", { transform: `translate(${W.value.x} ${W.value.y}) scale(${W.value.zoom})` }, [
1095
- R.value ? l("", !0) : (C(), u(o, { key: 0 }, [
1096
- d("rect", _(Qt.value, { fill: t.paper }), null, 16, Le),
1097
- t.backgroundImage ? (C(), u("image", _({
1093
+ }, null, 8, Le)], 8, Ie))), 128))
1094
+ ]), f("g", { transform: `translate(${U.value.x} ${U.value.y}) scale(${U.value.zoom})` }, [
1095
+ I.value ? u("", !0) : (x(), d(s, { key: 0 }, [
1096
+ f("rect", _(Qt.value, { fill: t.paper }), null, 16, ze),
1097
+ t.backgroundImage ? (x(), d("image", _({
1098
1098
  key: 0,
1099
1099
  href: t.backgroundImage
1100
1100
  }, t.backgroundImageBox ?? {
1101
1101
  x: 0,
1102
1102
  y: 0
1103
- }, { preserveAspectRatio: "xMidYMid slice" }), null, 16, Re)) : l("", !0),
1104
- t.background === "none" ? l("", !0) : (C(), u("rect", _({ key: 1 }, Qt.value, { fill: `url(#${Q}-${t.background})` }), null, 16, ze))
1103
+ }, { preserveAspectRatio: "xMidYMid slice" }), null, 16, Be)) : u("", !0),
1104
+ t.background === "none" ? u("", !0) : (x(), d("rect", _({ key: 1 }, Qt.value, { fill: `url(#${Q}-${t.background})` }), null, 16, Ve))
1105
1105
  ], 64)),
1106
- (C(!0), u(o, null, T(Xt.value, (e) => (C(), u("g", {
1106
+ (x(!0), d(s, null, C(Xt.value, (e) => (x(), d("g", {
1107
1107
  key: e ?? "all",
1108
- transform: e === void 0 ? void 0 : `translate(0 ${L(e)})`
1109
- }, [e === void 0 ? l("", !0) : (C(), u(o, { key: 0 }, [
1110
- d("rect", {
1108
+ transform: e === void 0 ? void 0 : `translate(0 ${F(e)})`
1109
+ }, [e === void 0 ? u("", !0) : (x(), d(s, { key: 0 }, [
1110
+ f("rect", {
1111
1111
  x: "0",
1112
1112
  y: "0",
1113
1113
  width: t.pageSize.width,
1114
1114
  height: t.pageSize.height,
1115
1115
  fill: t.paper,
1116
1116
  class: "m3-draw-page"
1117
- }, null, 8, Ve),
1118
- t.backgroundImage ? (C(), u("image", {
1117
+ }, null, 8, Ue),
1118
+ t.backgroundImage ? (x(), d("image", {
1119
1119
  key: 0,
1120
1120
  href: t.backgroundImage,
1121
1121
  x: "0",
@@ -1123,88 +1123,88 @@ var De = ["aria-label"], Oe = [
1123
1123
  width: t.pageSize.width,
1124
1124
  height: t.pageSize.height,
1125
1125
  preserveAspectRatio: "xMidYMid meet"
1126
- }, null, 8, He)) : l("", !0),
1127
- t.background === "none" ? l("", !0) : (C(), u("rect", {
1126
+ }, null, 8, We)) : u("", !0),
1127
+ t.background === "none" ? u("", !0) : (x(), d("rect", {
1128
1128
  key: 1,
1129
1129
  x: "0",
1130
1130
  y: "0",
1131
1131
  width: t.pageSize.width,
1132
1132
  height: t.pageSize.height,
1133
1133
  fill: `url(#${Q}-${t.background})`
1134
- }, null, 8, Ue))
1135
- ], 64)), d("g", { "clip-path": e === void 0 ? void 0 : `url(#${Q}-page${e})` }, [(C(!0), u(o, null, T(Zt(e), (e) => (C(), u(o, { key: e.id }, [e.type === "stroke" ? (C(), u("path", {
1134
+ }, null, 8, Ge))
1135
+ ], 64)), f("g", { "clip-path": e === void 0 ? void 0 : `url(#${Q}-page${e})` }, [(x(!0), d(s, null, C(Zt(e), (e) => (x(), d(s, { key: e.id }, [e.type === "stroke" ? (x(), d("path", {
1136
1136
  key: 0,
1137
1137
  d: Jt(e).d,
1138
1138
  fill: e.color,
1139
- "fill-opacity": O(se)[e.pen].opacity
1140
- }, null, 8, Ge)) : e.type === "shape" ? (C(), u(o, { key: 1 }, [d("path", {
1139
+ "fill-opacity": E(ue)[e.pen].opacity
1140
+ }, null, 8, qe)) : e.type === "shape" ? (x(), d(s, { key: 1 }, [f("path", {
1141
1141
  d: Jt(e).d,
1142
1142
  fill: e.fill && (e.shape === "rect" || e.shape === "ellipse") ? e.fill : "none",
1143
1143
  stroke: e.color,
1144
1144
  "stroke-width": e.size,
1145
1145
  "stroke-linecap": "round",
1146
1146
  "stroke-linejoin": "round"
1147
- }, null, 8, Ke), Jt(e).head ? (C(), u("path", {
1147
+ }, null, 8, Je), Jt(e).head ? (x(), d("path", {
1148
1148
  key: 0,
1149
1149
  d: Jt(e).head,
1150
1150
  fill: e.color
1151
- }, null, 8, qe)) : l("", !0)], 64)) : (C(), u("text", {
1151
+ }, null, 8, Ye)) : u("", !0)], 64)) : (x(), d("text", {
1152
1152
  key: 2,
1153
1153
  x: e.at[0],
1154
1154
  y: e.at[1],
1155
1155
  "font-size": e.size,
1156
1156
  fill: e.color,
1157
1157
  class: "m3-draw-text"
1158
- }, [(C(!0), u(o, null, T(e.text.split("\n"), (t, n) => (C(), u("tspan", {
1158
+ }, [(x(!0), d(s, null, C(e.text.split("\n"), (t, n) => (x(), d("tspan", {
1159
1159
  key: n,
1160
1160
  x: e.at[0],
1161
- dy: n ? e.size * O(me) : e.size * .95
1162
- }, te(t || " "), 9, Ye))), 128))], 8, Je))], 64))), 128)), Y.value && (e === void 0 || Y.value.page === e) ? (C(), u(o, { key: 0 }, [Y.value.type === "stroke" ? (C(), u("path", {
1161
+ dy: n ? e.size * E(ge) : e.size * .95
1162
+ }, ie(t || " "), 9, Ze))), 128))], 8, Xe))], 64))), 128)), J.value && (e === void 0 || J.value.page === e) ? (x(), d(s, { key: 0 }, [J.value.type === "stroke" ? (x(), d("path", {
1163
1163
  key: 0,
1164
- d: O(de)(Y.value),
1165
- fill: Y.value.color,
1166
- "fill-opacity": O(se)[Y.value.pen].opacity
1167
- }, null, 8, Xe)) : Y.value.type === "shape" ? (C(), u(o, { key: 1 }, [d("path", {
1168
- d: O(fe)(Y.value).d,
1169
- fill: Y.value.fill && (Y.value.shape === "rect" || Y.value.shape === "ellipse") ? Y.value.fill : "none",
1170
- stroke: Y.value.color,
1171
- "stroke-width": Y.value.size,
1164
+ d: E(pe)(J.value),
1165
+ fill: J.value.color,
1166
+ "fill-opacity": E(ue)[J.value.pen].opacity
1167
+ }, null, 8, Qe)) : J.value.type === "shape" ? (x(), d(s, { key: 1 }, [f("path", {
1168
+ d: E(me)(J.value).d,
1169
+ fill: J.value.fill && (J.value.shape === "rect" || J.value.shape === "ellipse") ? J.value.fill : "none",
1170
+ stroke: J.value.color,
1171
+ "stroke-width": J.value.size,
1172
1172
  "stroke-linecap": "round",
1173
1173
  "stroke-linejoin": "round"
1174
- }, null, 8, Ze), O(fe)(Y.value).head ? (C(), u("path", {
1174
+ }, null, 8, $e), E(me)(J.value).head ? (x(), d("path", {
1175
1175
  key: 0,
1176
- d: O(fe)(Y.value).head,
1177
- fill: Y.value.color
1178
- }, null, 8, Qe)) : l("", !0)], 64)) : l("", !0)], 64)) : l("", !0)], 8, We)], 8, Be))), 128)),
1179
- wt.value ? (C(), u("polygon", {
1176
+ d: E(me)(J.value).head,
1177
+ fill: J.value.color
1178
+ }, null, 8, et)) : u("", !0)], 64)) : u("", !0)], 64)) : u("", !0)], 8, Ke)], 8, He))), 128)),
1179
+ Y.value ? (x(), d("polygon", {
1180
1180
  key: 1,
1181
- points: wt.value.map((e) => e.join(",")).join(" "),
1181
+ points: Y.value.map((e) => e.join(",")).join(" "),
1182
1182
  class: "fill-primary/8 stroke-primary",
1183
- "stroke-width": 1.5 / W.value.zoom,
1184
- "stroke-dasharray": `${4 / W.value.zoom} ${3 / W.value.zoom}`
1185
- }, null, 8, $e)) : l("", !0),
1186
- X.value && c.value === "select" ? (C(), u(o, { key: 2 }, [d("rect", {
1187
- x: X.value.x - 4 / W.value.zoom,
1188
- y: X.value.y - 4 / W.value.zoom,
1189
- width: X.value.width + 8 / W.value.zoom,
1190
- height: X.value.height + 8 / W.value.zoom,
1183
+ "stroke-width": 1.5 / U.value.zoom,
1184
+ "stroke-dasharray": `${4 / U.value.zoom} ${3 / U.value.zoom}`
1185
+ }, null, 8, tt)) : u("", !0),
1186
+ X.value && o.value === "select" ? (x(), d(s, { key: 2 }, [f("rect", {
1187
+ x: X.value.x - 4 / U.value.zoom,
1188
+ y: X.value.y - 4 / U.value.zoom,
1189
+ width: X.value.width + 8 / U.value.zoom,
1190
+ height: X.value.height + 8 / U.value.zoom,
1191
1191
  fill: "none",
1192
1192
  class: "stroke-primary",
1193
- "stroke-width": 1.5 / W.value.zoom,
1194
- "stroke-dasharray": `${5 / W.value.zoom} ${4 / W.value.zoom}`
1195
- }, null, 8, et), (C(!0), u(o, null, T(zt.value, (e) => (C(), u("rect", {
1193
+ "stroke-width": 1.5 / U.value.zoom,
1194
+ "stroke-dasharray": `${5 / U.value.zoom} ${4 / U.value.zoom}`
1195
+ }, null, 8, nt), (x(!0), d(s, null, C(zt.value, (e) => (x(), d("rect", {
1196
1196
  key: e.id,
1197
- x: e.x - it / 2 / W.value.zoom,
1198
- y: e.y - it / 2 / W.value.zoom,
1199
- width: it / W.value.zoom,
1200
- height: it / W.value.zoom,
1201
- rx: 2 / W.value.zoom,
1197
+ x: e.x - ot / 2 / U.value.zoom,
1198
+ y: e.y - ot / 2 / U.value.zoom,
1199
+ width: ot / U.value.zoom,
1200
+ height: ot / U.value.zoom,
1201
+ rx: 2 / U.value.zoom,
1202
1202
  class: "fill-surface stroke-primary",
1203
- "stroke-width": 1.5 / W.value.zoom,
1203
+ "stroke-width": 1.5 / U.value.zoom,
1204
1204
  style: b({ cursor: e.cursor })
1205
- }, null, 12, tt))), 128))], 64)) : l("", !0)
1206
- ], 8, Ie)], 512)),
1207
- Z.value ? j((C(), u("textarea", {
1205
+ }, null, 12, rt))), 128))], 64)) : u("", !0)
1206
+ ], 8, Re)], 512)),
1207
+ Z.value ? oe((x(), d("textarea", {
1208
1208
  key: 0,
1209
1209
  ref_key: "textarea",
1210
1210
  ref: Vt,
@@ -1212,22 +1212,22 @@ var De = ["aria-label"], Oe = [
1212
1212
  "data-draw-overlay": "",
1213
1213
  class: "m3-draw-text absolute resize-none overflow-hidden border-0 bg-transparent p-0 whitespace-pre outline-1 outline-primary outline-dashed",
1214
1214
  style: b(Gt.value),
1215
- "aria-label": O(ue).drawText,
1215
+ "aria-label": E(M).drawText,
1216
1216
  spellcheck: "false",
1217
1217
  onBlur: Wt,
1218
- onKeydown: [ae(M(Wt, ["prevent"]), ["esc"]), n[1] ||= M(() => {}, ["stop"])]
1219
- }, null, 44, nt)), [[re, Z.value.text]]) : l("", !0),
1220
- E(e.$slots, "default")
1221
- ], 44, De));
1218
+ onKeydown: [j(se(Wt, ["prevent"]), ["esc"]), n[1] ||= se(() => {}, ["stop"])]
1219
+ }, null, 44, it)), [[k, Z.value.text]]) : u("", !0),
1220
+ w(e.$slots, "default")
1221
+ ], 44, ke));
1222
1222
  }
1223
- }), ot = ["aria-label"], st = {
1223
+ }), ct = ["aria-label"], lt = {
1224
1224
  key: 1,
1225
1225
  class: "flex items-center"
1226
- }, ct = ["aria-label"], B = [
1226
+ }, z = ["aria-label"], ut = [
1227
1227
  "aria-label",
1228
1228
  "aria-pressed",
1229
1229
  "onClick"
1230
- ], lt = ["aria-label", "aria-pressed"], V = {
1230
+ ], B = ["aria-label", "aria-pressed"], V = {
1231
1231
  key: 0,
1232
1232
  class: "material-symbols-outlined text-[16px] text-white drop-shadow",
1233
1233
  "aria-hidden": "true"
@@ -1235,7 +1235,7 @@ var De = ["aria-label"], Oe = [
1235
1235
  "aria-label",
1236
1236
  "aria-pressed",
1237
1237
  "onClick"
1238
- ], U = /* @__PURE__ */ m({
1238
+ ], dt = /* @__PURE__ */ h({
1239
1239
  __name: "MDrawToolbar",
1240
1240
  props: {
1241
1241
  tools: { default: () => [
@@ -1278,10 +1278,10 @@ var De = ["aria-label"], Oe = [
1278
1278
  default: !0
1279
1279
  }
1280
1280
  },
1281
- setup(m) {
1282
- let g = m, _ = h(Te, null);
1283
- if (!_) throw Error("MDrawToolbar must be inside <MDrawCanvas>");
1284
- let v = _, x = e(), S = {
1281
+ setup(t) {
1282
+ let h = t, g = ee(De, null);
1283
+ if (!g) throw Error("MDrawToolbar must be inside <MDrawCanvas>");
1284
+ let _ = g, v = e(), te = {
1285
1285
  select: {
1286
1286
  icon: "arrow_selector_tool",
1287
1287
  key: "drawSelect"
@@ -1334,7 +1334,7 @@ var De = ["aria-label"], Oe = [
1334
1334
  icon: "text_fields",
1335
1335
  key: "drawText"
1336
1336
  }
1337
- }, ee = [
1337
+ }, ne = [
1338
1338
  ["select"],
1339
1339
  ["pan"],
1340
1340
  [
@@ -1351,32 +1351,32 @@ var De = ["aria-label"], Oe = [
1351
1351
  "ellipse"
1352
1352
  ],
1353
1353
  ["text"]
1354
- ], D = s(() => ee.map((e) => e.filter((e) => g.tools.includes(e))).filter((e) => e.length)), ne = w({}), k = (e, t) => e.includes(v.tool.value) ? v.tool.value : ne.value[t] ?? e[0];
1355
- ie(v.tool, (e) => {
1356
- let t = D.value.findIndex((t) => t.includes(e));
1357
- t >= 0 && (ne.value = {
1358
- ...ne.value,
1354
+ ], re = c(() => ne.map((e) => e.filter((e) => h.tools.includes(e))).filter((e) => e.length)), T = S({}), D = (e, t) => e.includes(_.tool.value) ? _.tool.value : T.value[t] ?? e[0];
1355
+ ae(_.tool, (e) => {
1356
+ let t = re.value.findIndex((t) => t.includes(e));
1357
+ t >= 0 && (T.value = {
1358
+ ...T.value,
1359
1359
  [t]: e
1360
1360
  });
1361
1361
  }, { immediate: !0 });
1362
- let re = s(() => ["rect", "ellipse"].includes(v.tool.value)), j = (e) => x[S[e].key], ae = w(!1), M = s(() => !g.colors.some((e) => e.toLowerCase() === v.color.value.toLowerCase()));
1363
- return (e, s) => (C(), u("div", {
1362
+ let O = c(() => ["rect", "ellipse"].includes(_.tool.value)), k = (e) => v[te[e].key], oe = S(!1), j = c(() => !h.colors.some((e) => e.toLowerCase() === _.color.value.toLowerCase()));
1363
+ return (e, c) => (x(), d("div", {
1364
1364
  class: "m3-draw-toolbar flex max-w-[calc(100%-16px)] items-center gap-0.5 overflow-x-auto rounded-full bg-surface-container px-2 py-1 text-on-surface shadow-elevation-3 [scrollbar-width:none]",
1365
1365
  role: "toolbar",
1366
- "aria-label": O(x).drawTools
1366
+ "aria-label": E(v).drawTools
1367
1367
  }, [
1368
- E(e.$slots, "default"),
1369
- (C(!0), u(o, null, T(D.value, (e, a) => (C(), u(o, { key: a }, [e.length === 1 ? (C(), c(i, {
1368
+ w(e.$slots, "default"),
1369
+ (x(!0), d(s, null, C(re.value, (e, t) => (x(), d(s, { key: t }, [e.length === 1 ? (x(), l(a, {
1370
1370
  key: 0,
1371
- text: j(e[0]),
1371
+ text: k(e[0]),
1372
1372
  placement: "top"
1373
1373
  }, {
1374
- default: A(() => [p(t, {
1375
- icon: S[e[0]].icon,
1376
- label: j(e[0]),
1377
- variant: O(v).tool.value === e[0] ? "filled" : "standard",
1378
- "aria-pressed": O(v).tool.value === e[0],
1379
- onClick: (t) => O(v).tool.value = e[0]
1374
+ default: A(() => [m(n, {
1375
+ icon: te[e[0]].icon,
1376
+ label: k(e[0]),
1377
+ variant: E(_).tool.value === e[0] ? "filled" : "standard",
1378
+ "aria-pressed": E(_).tool.value === e[0],
1379
+ onClick: (t) => E(_).tool.value = e[0]
1380
1380
  }, null, 8, [
1381
1381
  "icon",
1382
1382
  "label",
@@ -1385,16 +1385,16 @@ var De = ["aria-label"], Oe = [
1385
1385
  "onClick"
1386
1386
  ])]),
1387
1387
  _: 2
1388
- }, 1032, ["text"])) : (C(), u("div", st, [p(i, {
1389
- text: j(k(e, a)),
1388
+ }, 1032, ["text"])) : (x(), d("div", lt, [m(a, {
1389
+ text: k(D(e, t)),
1390
1390
  placement: "top"
1391
1391
  }, {
1392
- default: A(() => [p(t, {
1393
- icon: S[k(e, a)].icon,
1394
- label: j(k(e, a)),
1395
- variant: e.includes(O(v).tool.value) ? "filled" : "standard",
1396
- "aria-pressed": e.includes(O(v).tool.value),
1397
- onClick: (t) => O(v).tool.value = k(e, a)
1392
+ default: A(() => [m(n, {
1393
+ icon: te[D(e, t)].icon,
1394
+ label: k(D(e, t)),
1395
+ variant: e.includes(E(_).tool.value) ? "filled" : "standard",
1396
+ "aria-pressed": e.includes(E(_).tool.value),
1397
+ onClick: (n) => E(_).tool.value = D(e, t)
1398
1398
  }, null, 8, [
1399
1399
  "icon",
1400
1400
  "label",
@@ -1403,22 +1403,22 @@ var De = ["aria-label"], Oe = [
1403
1403
  "onClick"
1404
1404
  ])]),
1405
1405
  _: 2
1406
- }, 1032, ["text"]), p(n, null, {
1407
- trigger: A(() => [d("button", {
1406
+ }, 1032, ["text"]), m(r, null, {
1407
+ trigger: A(() => [f("button", {
1408
1408
  type: "button",
1409
1409
  class: "flex h-10 w-4 items-center justify-center rounded-full text-on-surface-variant hover:bg-on-surface/8",
1410
- "aria-label": O(x).drawMore
1411
- }, [...s[7] ||= [d("span", {
1410
+ "aria-label": E(v).drawMore
1411
+ }, [...c[7] ||= [f("span", {
1412
1412
  class: "material-symbols-outlined text-[18px]",
1413
1413
  "aria-hidden": "true"
1414
- }, "arrow_drop_down", -1)]], 8, ct)]),
1415
- default: A(() => [(C(!0), u(o, null, T(e, (e) => (C(), c(r, {
1414
+ }, "arrow_drop_down", -1)]], 8, z)]),
1415
+ default: A(() => [(x(!0), d(s, null, C(e, (e) => (x(), l(i, {
1416
1416
  key: e,
1417
- icon: S[e].icon,
1418
- selected: O(v).tool.value === e,
1419
- onClick: (t) => O(v).tool.value = e
1417
+ icon: te[e].icon,
1418
+ selected: E(_).tool.value === e,
1419
+ onClick: (t) => E(_).tool.value = e
1420
1420
  }, {
1421
- default: A(() => [f(te(j(e)), 1)]),
1421
+ default: A(() => [p(ie(k(e)), 1)]),
1422
1422
  _: 2
1423
1423
  }, 1032, [
1424
1424
  "icon",
@@ -1427,114 +1427,114 @@ var De = ["aria-label"], Oe = [
1427
1427
  ]))), 128))]),
1428
1428
  _: 2
1429
1429
  }, 1024)]))], 64))), 128)),
1430
- re.value ? (C(), c(i, {
1430
+ O.value ? (x(), l(a, {
1431
1431
  key: 0,
1432
- text: O(x).drawFill,
1432
+ text: E(v).drawFill,
1433
1433
  placement: "top"
1434
1434
  }, {
1435
- default: A(() => [p(t, {
1435
+ default: A(() => [m(n, {
1436
1436
  icon: "format_color_fill",
1437
- label: O(x).drawFill,
1438
- variant: O(v).fill.value ? "tonal" : "standard",
1439
- "aria-pressed": O(v).fill.value,
1440
- onClick: s[0] ||= (e) => O(v).fill.value = !O(v).fill.value
1437
+ label: E(v).drawFill,
1438
+ variant: E(_).fill.value ? "tonal" : "standard",
1439
+ "aria-pressed": E(_).fill.value,
1440
+ onClick: c[0] ||= (e) => E(_).fill.value = !E(_).fill.value
1441
1441
  }, null, 8, [
1442
1442
  "label",
1443
1443
  "variant",
1444
1444
  "aria-pressed"
1445
1445
  ])]),
1446
1446
  _: 1
1447
- }, 8, ["text"])) : l("", !0),
1448
- s[9] ||= d("span", { class: "mx-1 h-6 w-px shrink-0 bg-outline-variant" }, null, -1),
1449
- (C(!0), u(o, null, T(m.colors, (e) => (C(), u("button", {
1447
+ }, 8, ["text"])) : u("", !0),
1448
+ c[9] ||= f("span", { class: "mx-1 h-6 w-px shrink-0 bg-outline-variant" }, null, -1),
1449
+ (x(!0), d(s, null, C(t.colors, (e) => (x(), d("button", {
1450
1450
  key: e,
1451
1451
  type: "button",
1452
- class: y(["m-0.5 size-7 shrink-0 rounded-full border border-outline-variant outline-offset-2 transition-[outline-color] duration-150", O(v).color.value.toLowerCase() === e.toLowerCase() ? "outline-2 outline-primary" : "outline-2 outline-transparent"]),
1452
+ class: y(["m-0.5 size-7 shrink-0 rounded-full border border-outline-variant outline-offset-2 transition-[outline-color] duration-150", E(_).color.value.toLowerCase() === e.toLowerCase() ? "outline-2 outline-primary" : "outline-2 outline-transparent"]),
1453
1453
  style: b({ background: e }),
1454
- "aria-label": `${O(x).drawColor} ${e}`,
1455
- "aria-pressed": O(v).color.value.toLowerCase() === e.toLowerCase(),
1456
- onClick: (t) => O(v).color.value = e
1457
- }, null, 14, B))), 128)),
1458
- m.customColor ? (C(), c(i, {
1454
+ "aria-label": `${E(v).drawColor} ${e}`,
1455
+ "aria-pressed": E(_).color.value.toLowerCase() === e.toLowerCase(),
1456
+ onClick: (t) => E(_).color.value = e
1457
+ }, null, 14, ut))), 128)),
1458
+ t.customColor ? (x(), l(a, {
1459
1459
  key: 1,
1460
- text: O(x).drawCustomColor,
1460
+ text: E(v).drawCustomColor,
1461
1461
  placement: "top"
1462
1462
  }, {
1463
- default: A(() => [d("button", {
1463
+ default: A(() => [f("button", {
1464
1464
  type: "button",
1465
- class: y(["m-0.5 flex size-7 shrink-0 items-center justify-center rounded-full outline-offset-2 transition-[outline-color] duration-150", M.value ? "outline-2 outline-primary" : "outline-2 outline-transparent"]),
1466
- style: b({ background: M.value ? O(v).color.value : "conic-gradient(#f44336, #ffeb3b, #4caf50, #00bcd4, #3f51b5, #e91e63, #f44336)" }),
1467
- "aria-label": O(x).drawCustomColor,
1468
- "aria-pressed": M.value,
1469
- onClick: s[1] ||= (e) => ae.value = !0
1470
- }, [M.value ? l("", !0) : (C(), u("span", V, "add"))], 14, lt)]),
1465
+ class: y(["m-0.5 flex size-7 shrink-0 items-center justify-center rounded-full outline-offset-2 transition-[outline-color] duration-150", j.value ? "outline-2 outline-primary" : "outline-2 outline-transparent"]),
1466
+ style: b({ background: j.value ? E(_).color.value : "conic-gradient(#f44336, #ffeb3b, #4caf50, #00bcd4, #3f51b5, #e91e63, #f44336)" }),
1467
+ "aria-label": E(v).drawCustomColor,
1468
+ "aria-pressed": j.value,
1469
+ onClick: c[1] ||= (e) => oe.value = !0
1470
+ }, [j.value ? u("", !0) : (x(), d("span", V, "add"))], 14, B)]),
1471
1471
  _: 1
1472
- }, 8, ["text"])) : l("", !0),
1473
- m.customColor ? (C(), c(a, {
1472
+ }, 8, ["text"])) : u("", !0),
1473
+ t.customColor ? (x(), l(o, {
1474
1474
  key: 2,
1475
- modelValue: O(v).color.value,
1476
- "onUpdate:modelValue": s[2] ||= (e) => O(v).color.value = e,
1477
- show: ae.value,
1478
- "onUpdate:show": s[3] ||= (e) => ae.value = e
1479
- }, null, 8, ["modelValue", "show"])) : l("", !0),
1480
- s[10] ||= d("span", { class: "mx-1 h-6 w-px shrink-0 bg-outline-variant" }, null, -1),
1481
- (C(!0), u(o, null, T(m.sizes, (e) => (C(), u("button", {
1475
+ modelValue: E(_).color.value,
1476
+ "onUpdate:modelValue": c[2] ||= (e) => E(_).color.value = e,
1477
+ show: oe.value,
1478
+ "onUpdate:show": c[3] ||= (e) => oe.value = e
1479
+ }, null, 8, ["modelValue", "show"])) : u("", !0),
1480
+ c[10] ||= f("span", { class: "mx-1 h-6 w-px shrink-0 bg-outline-variant" }, null, -1),
1481
+ (x(!0), d(s, null, C(t.sizes, (e) => (x(), d("button", {
1482
1482
  key: e,
1483
1483
  type: "button",
1484
- class: y(["flex size-9 shrink-0 items-center justify-center rounded-full transition-colors", O(v).size.value === e ? "bg-secondary-container" : "hover:bg-on-surface/8"]),
1485
- "aria-label": `${O(x).drawSize} ${e}`,
1486
- "aria-pressed": O(v).size.value === e,
1487
- onClick: (t) => O(v).size.value = e
1488
- }, [d("span", {
1484
+ class: y(["flex size-9 shrink-0 items-center justify-center rounded-full transition-colors", E(_).size.value === e ? "bg-secondary-container" : "hover:bg-on-surface/8"]),
1485
+ "aria-label": `${E(v).drawSize} ${e}`,
1486
+ "aria-pressed": E(_).size.value === e,
1487
+ onClick: (t) => E(_).size.value = e
1488
+ }, [f("span", {
1489
1489
  class: "rounded-full bg-on-surface",
1490
1490
  style: b({
1491
1491
  width: `${Math.min(20, Math.max(3, e * 1.2))}px`,
1492
1492
  height: `${Math.min(20, Math.max(3, e * 1.2))}px`
1493
1493
  })
1494
1494
  }, null, 4)], 10, H))), 128)),
1495
- m.history ? (C(), u(o, { key: 3 }, [
1496
- s[8] ||= d("span", { class: "mx-1 h-6 w-px shrink-0 bg-outline-variant" }, null, -1),
1497
- p(i, {
1498
- text: O(x).drawUndo,
1495
+ t.history ? (x(), d(s, { key: 3 }, [
1496
+ c[8] ||= f("span", { class: "mx-1 h-6 w-px shrink-0 bg-outline-variant" }, null, -1),
1497
+ m(a, {
1498
+ text: E(v).drawUndo,
1499
1499
  placement: "top"
1500
1500
  }, {
1501
- default: A(() => [p(t, {
1501
+ default: A(() => [m(n, {
1502
1502
  icon: "undo",
1503
- label: O(x).drawUndo,
1504
- disabled: !O(v).canUndo.value,
1505
- onClick: s[4] ||= (e) => O(v).undo()
1503
+ label: E(v).drawUndo,
1504
+ disabled: !E(_).canUndo.value,
1505
+ onClick: c[4] ||= (e) => E(_).undo()
1506
1506
  }, null, 8, ["label", "disabled"])]),
1507
1507
  _: 1
1508
1508
  }, 8, ["text"]),
1509
- p(i, {
1510
- text: O(x).drawRedo,
1509
+ m(a, {
1510
+ text: E(v).drawRedo,
1511
1511
  placement: "top"
1512
1512
  }, {
1513
- default: A(() => [p(t, {
1513
+ default: A(() => [m(n, {
1514
1514
  icon: "redo",
1515
- label: O(x).drawRedo,
1516
- disabled: !O(v).canRedo.value,
1517
- onClick: s[5] ||= (e) => O(v).redo()
1515
+ label: E(v).drawRedo,
1516
+ disabled: !E(_).canRedo.value,
1517
+ onClick: c[5] ||= (e) => E(_).redo()
1518
1518
  }, null, 8, ["label", "disabled"])]),
1519
1519
  _: 1
1520
1520
  }, 8, ["text"])
1521
- ], 64)) : l("", !0),
1522
- O(v).selection.value.length ? (C(), c(i, {
1521
+ ], 64)) : u("", !0),
1522
+ E(_).selection.value.length ? (x(), l(a, {
1523
1523
  key: 4,
1524
- text: O(x).drawDelete,
1524
+ text: E(v).drawDelete,
1525
1525
  placement: "top"
1526
1526
  }, {
1527
- default: A(() => [p(t, {
1527
+ default: A(() => [m(n, {
1528
1528
  icon: "delete",
1529
- label: O(x).drawDelete,
1530
- onClick: s[6] ||= (e) => O(v).deleteSelection()
1529
+ label: E(v).drawDelete,
1530
+ onClick: c[6] ||= (e) => E(_).deleteSelection()
1531
1531
  }, null, 8, ["label"])]),
1532
1532
  _: 1
1533
- }, 8, ["text"])) : l("", !0),
1534
- E(e.$slots, "end")
1535
- ], 8, ot));
1533
+ }, 8, ["text"])) : u("", !0),
1534
+ w(e.$slots, "end")
1535
+ ], 8, ct));
1536
1536
  }
1537
- }), ut = ["aria-label"], dt = { class: "flex items-center pb-1 pl-2" }, ft = { class: "flex-1 text-title-small" }, pt = [
1537
+ }), ft = ["aria-label"], pt = { class: "flex items-center pb-1 pl-2" }, mt = { class: "flex-1 text-title-small" }, U = [
1538
1538
  "value",
1539
1539
  "aria-label",
1540
1540
  "onKeydown",
@@ -1543,90 +1543,90 @@ var De = ["aria-label"], Oe = [
1543
1543
  "aria-pressed",
1544
1544
  "onClick",
1545
1545
  "onDblclick"
1546
- ], G = { class: "hidden flex-col group-hover:flex group-focus-within:flex" }, mt = ["aria-label", "onClick"], ht = ["aria-label", "onClick"], gt = /* @__PURE__ */ m({
1546
+ ], ht = { class: "hidden flex-col group-hover:flex group-focus-within:flex" }, gt = ["aria-label", "onClick"], _t = ["aria-label", "onClick"], vt = /* @__PURE__ */ h({
1547
1547
  __name: "MDrawLayers",
1548
- setup(n) {
1549
- let r = h(Te, null);
1550
- if (!r) throw Error("MDrawLayers must be inside <MDrawCanvas>");
1551
- let a = r, f = e(), m = s(() => a.layers.value.length ? a.layers.value : [{
1548
+ setup(r) {
1549
+ let i = ee(De, null);
1550
+ if (!i) throw Error("MDrawLayers must be inside <MDrawCanvas>");
1551
+ let o = i, p = e(), h = c(() => o.layers.value.length ? o.layers.value : [{
1552
1552
  id: "layer-1",
1553
- name: f.drawLayer.replace("{n}", "1")
1554
- }]), g = s(() => m.value.slice().reverse()), _ = (e) => a.setLayers(e), b = (e, t) => _(m.value.map((n) => n.id === e ? {
1553
+ name: t(p.drawLayer, { n: "1" }, p.lang)
1554
+ }]), g = c(() => h.value.slice().reverse()), _ = (e) => o.setLayers(e), b = (e, t) => _(h.value.map((n) => n.id === e ? {
1555
1555
  ...n,
1556
1556
  ...t
1557
1557
  } : n));
1558
- function x() {
1558
+ function te() {
1559
1559
  let e = {
1560
- id: oe(),
1561
- name: f.drawLayer.replace("{n}", String(m.value.length + 1))
1560
+ id: le(),
1561
+ name: t(p.drawLayer, { n: String(h.value.length + 1) }, p.lang)
1562
1562
  };
1563
- _([...m.value, e]), a.layer.value = e.id;
1563
+ _([...h.value, e]), o.layer.value = e.id;
1564
1564
  }
1565
- function S(e) {
1566
- if (m.value.length < 2) return;
1567
- let t = m.value[0].id, n = a.items.value.filter((n) => (n.layer ?? t) === e).map((e) => e.id);
1568
- n.length && (a.selection.value = n, a.deleteSelection());
1569
- let r = m.value.filter((t) => t.id !== e);
1570
- _(r), a.layer.value === e && (a.layer.value = r[r.length - 1].id);
1565
+ function ne(e) {
1566
+ if (h.value.length < 2) return;
1567
+ let t = h.value[0].id, n = o.items.value.filter((n) => (n.layer ?? t) === e).map((e) => e.id);
1568
+ n.length && (o.selection.value = n, o.deleteSelection());
1569
+ let r = h.value.filter((t) => t.id !== e);
1570
+ _(r), o.layer.value === e && (o.layer.value = r[r.length - 1].id);
1571
1571
  }
1572
- function ee(e, t) {
1573
- let n = m.value.findIndex((t) => t.id === e), r = n + t;
1574
- if (r < 0 || r >= m.value.length) return;
1575
- let i = m.value.slice();
1572
+ function re(e, t) {
1573
+ let n = h.value.findIndex((t) => t.id === e), r = n + t;
1574
+ if (r < 0 || r >= h.value.length) return;
1575
+ let i = h.value.slice();
1576
1576
  [i[n], i[r]] = [i[r], i[n]], _(i);
1577
1577
  }
1578
- let E = w(""), D = w();
1579
- function ne(e) {
1580
- E.value = e, v(() => D.value?.[0]?.select());
1578
+ let w = S(""), T = S();
1579
+ function D(e) {
1580
+ w.value = e, v(() => T.value?.[0]?.select());
1581
1581
  }
1582
- function k(e, t) {
1583
- E.value === e && (E.value = "", t.trim() && b(e, { name: t.trim() }));
1582
+ function O(e, t) {
1583
+ w.value === e && (w.value = "", t.trim() && b(e, { name: t.trim() }));
1584
1584
  }
1585
- return (e, n) => (C(), u("div", {
1585
+ return (e, t) => (x(), d("div", {
1586
1586
  class: "m3-draw-layers flex w-64 flex-col rounded-xl bg-surface-container p-2 text-on-surface shadow-elevation-2",
1587
1587
  role: "group",
1588
- "aria-label": O(f).drawLayers
1589
- }, [d("div", dt, [d("span", ft, te(O(f).drawLayers), 1), p(i, {
1590
- text: O(f).drawAddLayer,
1588
+ "aria-label": E(p).drawLayers
1589
+ }, [f("div", pt, [f("span", mt, ie(E(p).drawLayers), 1), m(a, {
1590
+ text: E(p).drawAddLayer,
1591
1591
  placement: "left"
1592
1592
  }, {
1593
- default: A(() => [p(t, {
1593
+ default: A(() => [m(n, {
1594
1594
  icon: "add",
1595
1595
  size: "xs",
1596
- label: O(f).drawAddLayer,
1597
- onClick: x
1596
+ label: E(p).drawAddLayer,
1597
+ onClick: te
1598
1598
  }, null, 8, ["label"])]),
1599
1599
  _: 1
1600
- }, 8, ["text"])]), (C(!0), u(o, null, T(g.value, (e) => (C(), u("div", {
1600
+ }, 8, ["text"])]), (x(!0), d(s, null, C(g.value, (e) => (x(), d("div", {
1601
1601
  key: e.id,
1602
- class: y(["group flex h-10 items-center gap-1 rounded-full pr-1 pl-3 text-body-medium", O(a).layer.value === e.id ? "bg-secondary-container text-on-secondary-container" : "hover:bg-on-surface/8"])
1602
+ class: y(["group flex h-10 items-center gap-1 rounded-full pr-1 pl-3 text-body-medium", E(o).layer.value === e.id ? "bg-secondary-container text-on-secondary-container" : "hover:bg-on-surface/8"])
1603
1603
  }, [
1604
- E.value === e.id ? (C(), u("input", {
1604
+ w.value === e.id ? (x(), d("input", {
1605
1605
  key: 0,
1606
1606
  ref_for: !0,
1607
1607
  ref_key: "input",
1608
- ref: D,
1608
+ ref: T,
1609
1609
  value: e.name,
1610
- "aria-label": O(f).drawLayerName,
1610
+ "aria-label": E(p).drawLayerName,
1611
1611
  class: "h-7 min-w-0 flex-1 rounded-xs bg-surface px-1 ring-1 ring-primary outline-none",
1612
- onKeydown: [ae((t) => k(e.id, t.target.value), ["enter"]), n[0] ||= ae((e) => E.value = "", ["esc"])],
1613
- onBlur: (t) => k(e.id, t.target.value)
1614
- }, null, 40, pt)) : (C(), u("button", {
1612
+ onKeydown: [j((t) => O(e.id, t.target.value), ["enter"]), t[0] ||= j((e) => w.value = "", ["esc"])],
1613
+ onBlur: (t) => O(e.id, t.target.value)
1614
+ }, null, 40, U)) : (x(), d("button", {
1615
1615
  key: 1,
1616
1616
  type: "button",
1617
1617
  class: y(["min-w-0 flex-1 truncate text-left outline-none", e.visible === !1 && "opacity-50"]),
1618
- "aria-pressed": O(a).layer.value === e.id,
1619
- onClick: (t) => O(a).layer.value = e.id,
1620
- onDblclick: (t) => ne(e.id)
1621
- }, te(e.name), 43, W)),
1622
- p(i, {
1623
- text: e.visible === !1 ? O(f).drawShowLayer : O(f).drawHideLayer,
1618
+ "aria-pressed": E(o).layer.value === e.id,
1619
+ onClick: (t) => E(o).layer.value = e.id,
1620
+ onDblclick: (t) => D(e.id)
1621
+ }, ie(e.name), 43, W)),
1622
+ m(a, {
1623
+ text: e.visible === !1 ? E(p).drawShowLayer : E(p).drawHideLayer,
1624
1624
  placement: "left"
1625
1625
  }, {
1626
- default: A(() => [p(t, {
1626
+ default: A(() => [m(n, {
1627
1627
  icon: e.visible === !1 ? "visibility_off" : "visibility",
1628
1628
  size: "xs",
1629
- label: e.visible === !1 ? O(f).drawShowLayer : O(f).drawHideLayer,
1629
+ label: e.visible === !1 ? E(p).drawShowLayer : E(p).drawHideLayer,
1630
1630
  onClick: (t) => b(e.id, { visible: e.visible === !1 })
1631
1631
  }, null, 8, [
1632
1632
  "icon",
@@ -1635,14 +1635,14 @@ var De = ["aria-label"], Oe = [
1635
1635
  ])]),
1636
1636
  _: 2
1637
1637
  }, 1032, ["text"]),
1638
- p(i, {
1639
- text: e.locked ? O(f).drawUnlockLayer : O(f).drawLockLayer,
1638
+ m(a, {
1639
+ text: e.locked ? E(p).drawUnlockLayer : E(p).drawLockLayer,
1640
1640
  placement: "left"
1641
1641
  }, {
1642
- default: A(() => [p(t, {
1642
+ default: A(() => [m(n, {
1643
1643
  icon: e.locked ? "lock" : "lock_open",
1644
1644
  size: "xs",
1645
- label: e.locked ? O(f).drawUnlockLayer : O(f).drawLockLayer,
1645
+ label: e.locked ? E(p).drawUnlockLayer : E(p).drawLockLayer,
1646
1646
  onClick: (t) => b(e.id, { locked: !e.locked })
1647
1647
  }, null, 8, [
1648
1648
  "icon",
@@ -1651,33 +1651,33 @@ var De = ["aria-label"], Oe = [
1651
1651
  ])]),
1652
1652
  _: 2
1653
1653
  }, 1032, ["text"]),
1654
- d("div", G, [d("button", {
1654
+ f("div", ht, [f("button", {
1655
1655
  type: "button",
1656
1656
  class: "h-4 leading-none text-on-surface-variant",
1657
- "aria-label": O(f).drawLayerUp,
1658
- onClick: (t) => ee(e.id, 1)
1659
- }, [...n[1] ||= [d("span", {
1657
+ "aria-label": E(p).drawLayerUp,
1658
+ onClick: (t) => re(e.id, 1)
1659
+ }, [...t[1] ||= [f("span", {
1660
1660
  class: "material-symbols-outlined text-[16px]",
1661
1661
  "aria-hidden": "true"
1662
- }, "arrow_drop_up", -1)]], 8, mt), d("button", {
1662
+ }, "arrow_drop_up", -1)]], 8, gt), f("button", {
1663
1663
  type: "button",
1664
1664
  class: "h-4 leading-none text-on-surface-variant",
1665
- "aria-label": O(f).drawLayerDown,
1666
- onClick: (t) => ee(e.id, -1)
1667
- }, [...n[2] ||= [d("span", {
1665
+ "aria-label": E(p).drawLayerDown,
1666
+ onClick: (t) => re(e.id, -1)
1667
+ }, [...t[2] ||= [f("span", {
1668
1668
  class: "material-symbols-outlined text-[16px]",
1669
1669
  "aria-hidden": "true"
1670
- }, "arrow_drop_down", -1)]], 8, ht)]),
1671
- m.value.length > 1 ? (C(), c(t, {
1670
+ }, "arrow_drop_down", -1)]], 8, _t)]),
1671
+ h.value.length > 1 ? (x(), l(n, {
1672
1672
  key: 2,
1673
1673
  icon: "delete",
1674
1674
  size: "xs",
1675
- label: O(f).drawDeleteLayer,
1676
- onClick: (t) => S(e.id)
1677
- }, null, 8, ["label", "onClick"])) : l("", !0)
1678
- ], 2))), 128))], 8, ut));
1675
+ label: E(p).drawDeleteLayer,
1676
+ onClick: (t) => ne(e.id)
1677
+ }, null, 8, ["label", "onClick"])) : u("", !0)
1678
+ ], 2))), 128))], 8, ft));
1679
1679
  }
1680
1680
  });
1681
- export { at as MDrawCanvas, gt as MDrawLayers, U as MDrawToolbar, pe as constrain, oe as drawId, ye as eraseAt, ve as hitItem, be as inLasso, he as itemBox, z as itemSvg, fe as shapePath, le as simulatePressure, ce as smoothPoints, Se as sortByLayer, de as strokePath, we as svgToPng, F as textBox, Ce as toDrawSvg, xe as transformItem, ge as unionBox, Ee as useDrawing };
1681
+ export { st as MDrawCanvas, vt as MDrawLayers, dt as MDrawToolbar, he as constrain, le as drawId, xe as eraseAt, be as hitItem, Se as inLasso, ve as itemBox, R as itemSvg, me as shapePath, fe as simulatePressure, de as smoothPoints, we as sortByLayer, pe as strokePath, Ee as svgToPng, _e as textBox, Te as toDrawSvg, Ce as transformItem, ye as unionBox, Oe as useDrawing };
1682
1682
 
1683
1683
  //# sourceMappingURL=draw.js.map