@sprawlify/primitives 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (378) hide show
  1. package/dist/anatomy.cjs +3 -0
  2. package/dist/anatomy.d.cts +2 -0
  3. package/dist/anatomy.d.mts +2 -0
  4. package/dist/anatomy.mjs +3 -0
  5. package/dist/aria-hidden-DqYx0f_y.mjs +177 -0
  6. package/dist/aria-hidden-DtLU6hSU.cjs +182 -0
  7. package/dist/aria-hidden.cjs +4 -0
  8. package/dist/aria-hidden.d.cts +16 -0
  9. package/dist/aria-hidden.d.mts +16 -0
  10. package/dist/aria-hidden.mjs +4 -0
  11. package/dist/auto-resize-D3qHtFy1.mjs +114 -0
  12. package/dist/auto-resize-xzlPFDyD.cjs +125 -0
  13. package/dist/auto-resize.cjs +5 -0
  14. package/dist/auto-resize.d.cts +17 -0
  15. package/dist/auto-resize.d.mts +17 -0
  16. package/dist/auto-resize.mjs +4 -0
  17. package/dist/chunk-CbDLau6x.cjs +34 -0
  18. package/dist/collection-8XqaNHs_.mjs +1279 -0
  19. package/dist/collection-DIoIDISa.cjs +1326 -0
  20. package/dist/collection.cjs +11 -0
  21. package/dist/collection.d.cts +5 -0
  22. package/dist/collection.d.mts +5 -0
  23. package/dist/collection.mjs +4 -0
  24. package/dist/color-BkAP1Tkd.d.mts +60 -0
  25. package/dist/color-VKewNv2e.d.cts +60 -0
  26. package/dist/color-utils-Cc5GVXZh.mjs +657 -0
  27. package/dist/color-utils-LER_6Zwu.cjs +680 -0
  28. package/dist/color-utils.cjs +7 -0
  29. package/dist/color-utils.d.cts +19 -0
  30. package/dist/color-utils.d.mts +19 -0
  31. package/dist/color-utils.mjs +4 -0
  32. package/dist/core-30pJjyC2.d.mts +49 -0
  33. package/dist/core-CQFbMdTl.cjs +176 -0
  34. package/dist/core-CefBjbst.d.cts +49 -0
  35. package/dist/core-DCFNMTZF.mjs +129 -0
  36. package/dist/core.cjs +12 -0
  37. package/dist/core.d.cts +3 -0
  38. package/dist/core.d.mts +3 -0
  39. package/dist/core.mjs +5 -0
  40. package/dist/create-anatomy-B3XYc-qG.d.mts +70 -0
  41. package/dist/create-anatomy-BGQ8pv8J.d.cts +70 -0
  42. package/dist/create-anatomy-BbDZbHpC.mjs +39 -0
  43. package/dist/create-anatomy-CDsIFUXg.cjs +45 -0
  44. package/dist/create-props-BnF_vl-E.mjs +5 -0
  45. package/dist/create-props-YKy7JIKj.cjs +11 -0
  46. package/dist/data-url-C3ITPVRX.d.cts +10 -0
  47. package/dist/data-url-DLwZ9M77.d.mts +10 -0
  48. package/dist/date-utils-D2xPHa_I.cjs +738 -0
  49. package/dist/date-utils-wEa1hhpc.mjs +474 -0
  50. package/dist/date-utils.cjs +46 -0
  51. package/dist/date-utils.d.cts +101 -0
  52. package/dist/date-utils.d.mts +2 -0
  53. package/dist/date-utils.mjs +3 -0
  54. package/dist/defineProperty-BoUOT9Ie.cjs +49 -0
  55. package/dist/defineProperty-DrXfyjd4.mjs +43 -0
  56. package/dist/dismissable-CTfKZ4OG.cjs +282 -0
  57. package/dist/dismissable-DDrx0xnH.mjs +271 -0
  58. package/dist/dismissable-layer-C7pZU2wi.d.cts +39 -0
  59. package/dist/dismissable-layer-t_b0fk-p.d.mts +39 -0
  60. package/dist/dismissable.cjs +7 -0
  61. package/dist/dismissable.d.cts +3 -0
  62. package/dist/dismissable.d.mts +3 -0
  63. package/dist/dismissable.mjs +6 -0
  64. package/dist/dom-query-CWZdWUGp.cjs +2141 -0
  65. package/dist/dom-query-DFCRhyj1.mjs +1374 -0
  66. package/dist/dom-query.cjs +130 -0
  67. package/dist/dom-query.d.cts +307 -0
  68. package/dist/dom-query.d.mts +307 -0
  69. package/dist/dom-query.mjs +3 -0
  70. package/dist/file-utils.cjs +220 -0
  71. package/dist/file-utils.d.cts +51 -0
  72. package/dist/file-utils.d.mts +51 -0
  73. package/dist/file-utils.mjs +210 -0
  74. package/dist/focus-trap-D-bypQEJ.mjs +485 -0
  75. package/dist/focus-trap-D4i52S9A.cjs +496 -0
  76. package/dist/focus-trap.cjs +5 -0
  77. package/dist/focus-trap.d.cts +88 -0
  78. package/dist/focus-trap.d.mts +88 -0
  79. package/dist/focus-trap.mjs +4 -0
  80. package/dist/focus-visible-DYTWdWpa.cjs +210 -0
  81. package/dist/focus-visible-irppYatv.mjs +175 -0
  82. package/dist/focus-visible.cjs +9 -0
  83. package/dist/focus-visible.d.cts +31 -0
  84. package/dist/focus-visible.d.mts +31 -0
  85. package/dist/focus-visible.mjs +4 -0
  86. package/dist/functions-BOkTDEFM.d.cts +15 -0
  87. package/dist/functions-IZtWcC8Q.d.mts +15 -0
  88. package/dist/highlight-word.cjs +100 -0
  89. package/dist/highlight-word.d.cts +24 -0
  90. package/dist/highlight-word.d.mts +24 -0
  91. package/dist/highlight-word.mjs +99 -0
  92. package/dist/hotkeys.cjs +758 -0
  93. package/dist/hotkeys.d.cts +130 -0
  94. package/dist/hotkeys.d.mts +130 -0
  95. package/dist/hotkeys.mjs +754 -0
  96. package/dist/i18n-utils.cjs +450 -0
  97. package/dist/i18n-utils.d.cts +61 -0
  98. package/dist/i18n-utils.d.mts +61 -0
  99. package/dist/i18n-utils.mjs +440 -0
  100. package/dist/index-BkzYij2j.d.mts +25 -0
  101. package/dist/index-Bqw3r34-.d.cts +1383 -0
  102. package/dist/index-C0MKXQmE.d.mts +1383 -0
  103. package/dist/index-C9-feK5c.d.cts +25 -0
  104. package/dist/index-CD5FN7kY.d.mts +114 -0
  105. package/dist/index-CJji6wHl.d.cts +15 -0
  106. package/dist/index-CNi5FkPe.d.mts +15 -0
  107. package/dist/index-D96rs8B0.d.mts +115 -0
  108. package/dist/index.cjs +0 -0
  109. package/dist/index.d.cts +1 -0
  110. package/dist/index.d.mts +1 -0
  111. package/dist/index.mjs +1 -0
  112. package/dist/interact-outside-BplxR9cR.mjs +200 -0
  113. package/dist/interact-outside-C8-oFBpB.cjs +205 -0
  114. package/dist/interact-outside.cjs +5 -0
  115. package/dist/interact-outside.d.cts +2 -0
  116. package/dist/interact-outside.d.mts +2 -0
  117. package/dist/interact-outside.mjs +5 -0
  118. package/dist/json-tree-utils.cjs +1512 -0
  119. package/dist/json-tree-utils.d.cts +117 -0
  120. package/dist/json-tree-utils.d.mts +117 -0
  121. package/dist/json-tree-utils.mjs +1463 -0
  122. package/dist/list-collection-BIMJGQjn.d.cts +61 -0
  123. package/dist/list-collection-Db3eixRU.d.mts +61 -0
  124. package/dist/live-region-CcZPGo89.cjs +52 -0
  125. package/dist/live-region-CnPh21WH.mjs +46 -0
  126. package/dist/live-region.cjs +3 -0
  127. package/dist/live-region.d.cts +2 -0
  128. package/dist/live-region.d.mts +2 -0
  129. package/dist/live-region.mjs +3 -0
  130. package/dist/machines/accordion/index.cjs +328 -0
  131. package/dist/machines/accordion/index.d.cts +83 -0
  132. package/dist/machines/accordion/index.d.mts +83 -0
  133. package/dist/machines/accordion/index.mjs +322 -0
  134. package/dist/machines/async-list/index.cjs +311 -0
  135. package/dist/machines/async-list/index.d.cts +89 -0
  136. package/dist/machines/async-list/index.d.mts +89 -0
  137. package/dist/machines/async-list/index.mjs +310 -0
  138. package/dist/machines/avatar/index.cjs +169 -0
  139. package/dist/machines/avatar/index.d.cts +63 -0
  140. package/dist/machines/avatar/index.d.mts +63 -0
  141. package/dist/machines/avatar/index.mjs +165 -0
  142. package/dist/machines/bottom-sheet/index.cjs +676 -0
  143. package/dist/machines/bottom-sheet/index.d.cts +239 -0
  144. package/dist/machines/bottom-sheet/index.d.mts +239 -0
  145. package/dist/machines/bottom-sheet/index.mjs +672 -0
  146. package/dist/machines/carousel/index.cjs +859 -0
  147. package/dist/machines/carousel/index.d.cts +146 -0
  148. package/dist/machines/carousel/index.d.mts +146 -0
  149. package/dist/machines/carousel/index.mjs +851 -0
  150. package/dist/machines/checkbox/index.cjs +316 -0
  151. package/dist/machines/checkbox/index.d.cts +81 -0
  152. package/dist/machines/checkbox/index.d.mts +81 -0
  153. package/dist/machines/checkbox/index.mjs +312 -0
  154. package/dist/machines/clipboard/index.cjs +225 -0
  155. package/dist/machines/clipboard/index.d.cts +68 -0
  156. package/dist/machines/clipboard/index.d.mts +68 -0
  157. package/dist/machines/clipboard/index.mjs +219 -0
  158. package/dist/machines/collapsible/index.cjs +362 -0
  159. package/dist/machines/collapsible/index.d.cts +82 -0
  160. package/dist/machines/collapsible/index.d.mts +82 -0
  161. package/dist/machines/collapsible/index.mjs +358 -0
  162. package/dist/machines/color-picker/index.cjs +1529 -0
  163. package/dist/machines/color-picker/index.d.cts +205 -0
  164. package/dist/machines/color-picker/index.d.mts +205 -0
  165. package/dist/machines/color-picker/index.mjs +1514 -0
  166. package/dist/machines/combobox/index.cjs +1593 -0
  167. package/dist/machines/combobox/index.d.cts +214 -0
  168. package/dist/machines/combobox/index.d.mts +214 -0
  169. package/dist/machines/combobox/index.mjs +1582 -0
  170. package/dist/machines/date-picker/index.cjs +2177 -0
  171. package/dist/machines/date-picker/index.d.cts +350 -0
  172. package/dist/machines/date-picker/index.d.mts +350 -0
  173. package/dist/machines/date-picker/index.mjs +2161 -0
  174. package/dist/machines/dialog/index.cjs +325 -0
  175. package/dist/machines/dialog/index.d.cts +80 -0
  176. package/dist/machines/dialog/index.d.mts +80 -0
  177. package/dist/machines/dialog/index.mjs +321 -0
  178. package/dist/machines/editable/index.cjs +551 -0
  179. package/dist/machines/editable/index.d.cts +114 -0
  180. package/dist/machines/editable/index.d.mts +114 -0
  181. package/dist/machines/editable/index.mjs +547 -0
  182. package/dist/machines/floating-panel/index.cjs +995 -0
  183. package/dist/machines/floating-panel/index.d.cts +147 -0
  184. package/dist/machines/floating-panel/index.d.mts +147 -0
  185. package/dist/machines/floating-panel/index.mjs +988 -0
  186. package/dist/machines/hover-card/index.cjs +383 -0
  187. package/dist/machines/hover-card/index.d.cts +69 -0
  188. package/dist/machines/hover-card/index.d.mts +69 -0
  189. package/dist/machines/hover-card/index.mjs +379 -0
  190. package/dist/machines/image-cropper/index.cjs +1995 -0
  191. package/dist/machines/image-cropper/index.d.cts +182 -0
  192. package/dist/machines/image-cropper/index.d.mts +182 -0
  193. package/dist/machines/image-cropper/index.mjs +1990 -0
  194. package/dist/machines/listbox/index.cjs +794 -0
  195. package/dist/machines/listbox/index.d.cts +168 -0
  196. package/dist/machines/listbox/index.d.mts +168 -0
  197. package/dist/machines/listbox/index.mjs +782 -0
  198. package/dist/machines/marquee/index.cjs +395 -0
  199. package/dist/machines/marquee/index.d.cts +102 -0
  200. package/dist/machines/marquee/index.d.mts +102 -0
  201. package/dist/machines/marquee/index.mjs +391 -0
  202. package/dist/machines/menu/index.cjs +1298 -0
  203. package/dist/machines/menu/index.d.cts +175 -0
  204. package/dist/machines/menu/index.d.mts +175 -0
  205. package/dist/machines/menu/index.mjs +1286 -0
  206. package/dist/machines/navigation-menu/index.cjs +861 -0
  207. package/dist/machines/navigation-menu/index.d.cts +127 -0
  208. package/dist/machines/navigation-menu/index.d.mts +127 -0
  209. package/dist/machines/navigation-menu/index.mjs +857 -0
  210. package/dist/machines/number-input/index.cjs +996 -0
  211. package/dist/machines/number-input/index.d.cts +134 -0
  212. package/dist/machines/number-input/index.d.mts +134 -0
  213. package/dist/machines/number-input/index.mjs +991 -0
  214. package/dist/machines/pagination/index.cjs +419 -0
  215. package/dist/machines/pagination/index.d.cts +139 -0
  216. package/dist/machines/pagination/index.d.mts +139 -0
  217. package/dist/machines/pagination/index.mjs +411 -0
  218. package/dist/machines/password-input/index.cjs +228 -0
  219. package/dist/machines/password-input/index.d.cts +71 -0
  220. package/dist/machines/password-input/index.d.mts +71 -0
  221. package/dist/machines/password-input/index.mjs +224 -0
  222. package/dist/machines/pin-input/index.cjs +523 -0
  223. package/dist/machines/pin-input/index.d.cts +105 -0
  224. package/dist/machines/pin-input/index.d.mts +105 -0
  225. package/dist/machines/pin-input/index.mjs +519 -0
  226. package/dist/machines/popover/index.cjs +430 -0
  227. package/dist/machines/popover/index.d.cts +88 -0
  228. package/dist/machines/popover/index.d.mts +88 -0
  229. package/dist/machines/popover/index.mjs +426 -0
  230. package/dist/machines/presence/index.cjs +192 -0
  231. package/dist/machines/presence/index.d.cts +44 -0
  232. package/dist/machines/presence/index.d.mts +44 -0
  233. package/dist/machines/presence/index.mjs +190 -0
  234. package/dist/machines/progress/index.cjs +288 -0
  235. package/dist/machines/progress/index.d.cts +96 -0
  236. package/dist/machines/progress/index.d.mts +96 -0
  237. package/dist/machines/progress/index.mjs +284 -0
  238. package/dist/machines/qr-code/index.cjs +172 -0
  239. package/dist/machines/qr-code/index.d.cts +70 -0
  240. package/dist/machines/qr-code/index.d.mts +70 -0
  241. package/dist/machines/qr-code/index.mjs +167 -0
  242. package/dist/machines/radio-group/index.cjs +436 -0
  243. package/dist/machines/radio-group/index.d.cts +106 -0
  244. package/dist/machines/radio-group/index.d.mts +106 -0
  245. package/dist/machines/radio-group/index.mjs +430 -0
  246. package/dist/machines/rating-group/index.cjs +405 -0
  247. package/dist/machines/rating-group/index.d.cts +101 -0
  248. package/dist/machines/rating-group/index.d.mts +101 -0
  249. package/dist/machines/rating-group/index.mjs +399 -0
  250. package/dist/machines/scroll-area/index.cjs +857 -0
  251. package/dist/machines/scroll-area/index.d.cts +159 -0
  252. package/dist/machines/scroll-area/index.d.mts +159 -0
  253. package/dist/machines/scroll-area/index.mjs +853 -0
  254. package/dist/machines/select/index.cjs +1165 -0
  255. package/dist/machines/select/index.d.cts +183 -0
  256. package/dist/machines/select/index.d.mts +183 -0
  257. package/dist/machines/select/index.mjs +1154 -0
  258. package/dist/machines/signature-pad/index.cjs +334 -0
  259. package/dist/machines/signature-pad/index.d.cts +108 -0
  260. package/dist/machines/signature-pad/index.d.mts +108 -0
  261. package/dist/machines/signature-pad/index.mjs +328 -0
  262. package/dist/machines/slider/index.cjs +957 -0
  263. package/dist/machines/slider/index.d.cts +149 -0
  264. package/dist/machines/slider/index.d.mts +149 -0
  265. package/dist/machines/slider/index.mjs +949 -0
  266. package/dist/machines/splitter/index.cjs +1112 -0
  267. package/dist/machines/splitter/index.d.cts +155 -0
  268. package/dist/machines/splitter/index.d.mts +155 -0
  269. package/dist/machines/splitter/index.mjs +1103 -0
  270. package/dist/machines/steps/index.cjs +289 -0
  271. package/dist/machines/steps/index.d.cts +97 -0
  272. package/dist/machines/steps/index.d.mts +97 -0
  273. package/dist/machines/steps/index.mjs +285 -0
  274. package/dist/machines/switch/index.cjs +305 -0
  275. package/dist/machines/switch/index.d.cts +80 -0
  276. package/dist/machines/switch/index.d.mts +80 -0
  277. package/dist/machines/switch/index.mjs +301 -0
  278. package/dist/machines/tabs/index.cjs +508 -0
  279. package/dist/machines/tabs/index.d.cts +111 -0
  280. package/dist/machines/tabs/index.d.mts +111 -0
  281. package/dist/machines/tabs/index.mjs +500 -0
  282. package/dist/machines/tags-input/index.cjs +1127 -0
  283. package/dist/machines/tags-input/index.d.cts +179 -0
  284. package/dist/machines/tags-input/index.d.mts +179 -0
  285. package/dist/machines/tags-input/index.mjs +1121 -0
  286. package/dist/machines/timer/index.cjs +329 -0
  287. package/dist/machines/timer/index.d.cts +98 -0
  288. package/dist/machines/timer/index.d.mts +98 -0
  289. package/dist/machines/timer/index.mjs +324 -0
  290. package/dist/machines/toast/index.cjs +1155 -0
  291. package/dist/machines/toast/index.d.cts +195 -0
  292. package/dist/machines/toast/index.d.mts +195 -0
  293. package/dist/machines/toast/index.mjs +1151 -0
  294. package/dist/machines/toggle/index.cjs +103 -0
  295. package/dist/machines/toggle/index.d.cts +46 -0
  296. package/dist/machines/toggle/index.d.mts +46 -0
  297. package/dist/machines/toggle/index.mjs +99 -0
  298. package/dist/machines/toggle-group/index.cjs +328 -0
  299. package/dist/machines/toggle-group/index.d.cts +81 -0
  300. package/dist/machines/toggle-group/index.d.mts +81 -0
  301. package/dist/machines/toggle-group/index.mjs +322 -0
  302. package/dist/machines/tooltip/index.cjs +516 -0
  303. package/dist/machines/tooltip/index.d.cts +71 -0
  304. package/dist/machines/tooltip/index.d.mts +71 -0
  305. package/dist/machines/tooltip/index.mjs +512 -0
  306. package/dist/machines/tour/index.cjs +1108 -0
  307. package/dist/machines/tour/index.d.cts +206 -0
  308. package/dist/machines/tour/index.d.mts +206 -0
  309. package/dist/machines/tour/index.mjs +1101 -0
  310. package/dist/machines/tree-view/index.cjs +1271 -0
  311. package/dist/machines/tree-view/index.d.cts +215 -0
  312. package/dist/machines/tree-view/index.d.mts +215 -0
  313. package/dist/machines/tree-view/index.mjs +1263 -0
  314. package/dist/node-BctU8GXk.d.mts +24 -0
  315. package/dist/node-CSsuPZVZ.d.cts +24 -0
  316. package/dist/popper-BPJeAtcA.mjs +349 -0
  317. package/dist/popper-D0FAW_p7.cjs +373 -0
  318. package/dist/popper.cjs +8 -0
  319. package/dist/popper.d.cts +74 -0
  320. package/dist/popper.d.mts +2 -0
  321. package/dist/popper.mjs +5 -0
  322. package/dist/raf-BnlYUlDi.d.mts +15 -0
  323. package/dist/raf-Cd2FGy0z.d.cts +15 -0
  324. package/dist/rect-utils-0ellN0a_.mjs +854 -0
  325. package/dist/rect-utils-DKLRhP8G.cjs +1147 -0
  326. package/dist/rect-utils.cjs +51 -0
  327. package/dist/rect-utils.d.cts +198 -0
  328. package/dist/rect-utils.d.mts +198 -0
  329. package/dist/rect-utils.mjs +3 -0
  330. package/dist/remove-scroll-Lrfv79X_.mjs +58 -0
  331. package/dist/remove-scroll-Uvzg1L9r.cjs +63 -0
  332. package/dist/remove-scroll.cjs +0 -0
  333. package/dist/remove-scroll.d.cts +1 -0
  334. package/dist/remove-scroll.d.mts +1 -0
  335. package/dist/remove-scroll.mjs +1 -0
  336. package/dist/scroll-snap-CrTmQRzA.mjs +152 -0
  337. package/dist/scroll-snap-zyiZLv7W.cjs +175 -0
  338. package/dist/scroll-snap.cjs +7 -0
  339. package/dist/scroll-snap.d.cts +14 -0
  340. package/dist/scroll-snap.d.mts +14 -0
  341. package/dist/scroll-snap.mjs +4 -0
  342. package/dist/selection-BIhSzkF7.d.mts +50 -0
  343. package/dist/selection-CS1GBp8e.d.cts +50 -0
  344. package/dist/store-BZcXv49B.cjs +305 -0
  345. package/dist/store-DEojWy9H.mjs +263 -0
  346. package/dist/store.cjs +9 -0
  347. package/dist/store.d.cts +26 -0
  348. package/dist/store.d.mts +26 -0
  349. package/dist/store.mjs +3 -0
  350. package/dist/stringify-state.cjs +49 -0
  351. package/dist/stringify-state.d.cts +8 -0
  352. package/dist/stringify-state.d.mts +8 -0
  353. package/dist/stringify-state.mjs +46 -0
  354. package/dist/tree-collection-BwU5WhGQ.d.mts +78 -0
  355. package/dist/tree-collection-DP_eznnI.d.cts +78 -0
  356. package/dist/typeahead-BdNwVP09.d.cts +45 -0
  357. package/dist/typeahead-XN6lZ7G9.d.mts +45 -0
  358. package/dist/types-BivBkYg9.d.cts +57 -0
  359. package/dist/types-Bl_6JtPQ.d.mts +57 -0
  360. package/dist/types-CPUMVt7c.d.mts +54 -0
  361. package/dist/types-CT_W6HWr.d.cts +54 -0
  362. package/dist/types-DDTcG99l.d.mts +201 -0
  363. package/dist/types-DejIu60O.d.cts +201 -0
  364. package/dist/types-DiIdKZ3K.d.cts +45 -0
  365. package/dist/types-GxLIgJib.d.cts +17 -0
  366. package/dist/types.cjs +15 -0
  367. package/dist/types.d.cts +2 -0
  368. package/dist/types.d.mts +2 -0
  369. package/dist/types.mjs +14 -0
  370. package/dist/utils-BZyrxWWR.mjs +525 -0
  371. package/dist/utils-_6frwjgJ.cjs +1040 -0
  372. package/dist/utils.cjs +88 -0
  373. package/dist/utils.d.cts +144 -0
  374. package/dist/utils.d.mts +144 -0
  375. package/dist/utils.mjs +3 -0
  376. package/dist/wait-for-CMjPsqWk.d.cts +10 -0
  377. package/dist/wait-for-D2nkdD4z.d.mts +10 -0
  378. package/package.json +399 -0
@@ -0,0 +1,1147 @@
1
+ const require_defineProperty = require('./defineProperty-BoUOT9Ie.cjs');
2
+
3
+ //#region src/shared/rect-utils/affine-transform.ts
4
+ var AffineTransform = class AffineTransform {
5
+ constructor([m00, m01, m02, m10, m11, m12] = [
6
+ 0,
7
+ 0,
8
+ 0,
9
+ 0,
10
+ 0,
11
+ 0
12
+ ]) {
13
+ require_defineProperty._defineProperty(this, "m00", void 0);
14
+ require_defineProperty._defineProperty(this, "m01", void 0);
15
+ require_defineProperty._defineProperty(this, "m02", void 0);
16
+ require_defineProperty._defineProperty(this, "m10", void 0);
17
+ require_defineProperty._defineProperty(this, "m11", void 0);
18
+ require_defineProperty._defineProperty(this, "m12", void 0);
19
+ require_defineProperty._defineProperty(this, "rotate", (...args) => {
20
+ return this.prepend(AffineTransform.rotate(...args));
21
+ });
22
+ require_defineProperty._defineProperty(this, "scale", (...args) => {
23
+ return this.prepend(AffineTransform.scale(...args));
24
+ });
25
+ require_defineProperty._defineProperty(this, "translate", (...args) => {
26
+ return this.prepend(AffineTransform.translate(...args));
27
+ });
28
+ this.m00 = m00;
29
+ this.m01 = m01;
30
+ this.m02 = m02;
31
+ this.m10 = m10;
32
+ this.m11 = m11;
33
+ this.m12 = m12;
34
+ }
35
+ applyTo(point) {
36
+ const { x, y } = point;
37
+ const { m00, m01, m02, m10, m11, m12 } = this;
38
+ return {
39
+ x: m00 * x + m01 * y + m02,
40
+ y: m10 * x + m11 * y + m12
41
+ };
42
+ }
43
+ prepend(other) {
44
+ return new AffineTransform([
45
+ this.m00 * other.m00 + this.m01 * other.m10,
46
+ this.m00 * other.m01 + this.m01 * other.m11,
47
+ this.m00 * other.m02 + this.m01 * other.m12 + this.m02,
48
+ this.m10 * other.m00 + this.m11 * other.m10,
49
+ this.m10 * other.m01 + this.m11 * other.m11,
50
+ this.m10 * other.m02 + this.m11 * other.m12 + this.m12
51
+ ]);
52
+ }
53
+ append(other) {
54
+ return new AffineTransform([
55
+ other.m00 * this.m00 + other.m01 * this.m10,
56
+ other.m00 * this.m01 + other.m01 * this.m11,
57
+ other.m00 * this.m02 + other.m01 * this.m12 + other.m02,
58
+ other.m10 * this.m00 + other.m11 * this.m10,
59
+ other.m10 * this.m01 + other.m11 * this.m11,
60
+ other.m10 * this.m02 + other.m11 * this.m12 + other.m12
61
+ ]);
62
+ }
63
+ get determinant() {
64
+ return this.m00 * this.m11 - this.m01 * this.m10;
65
+ }
66
+ get isInvertible() {
67
+ const det = this.determinant;
68
+ return isFinite(det) && isFinite(this.m02) && isFinite(this.m12) && det !== 0;
69
+ }
70
+ invert() {
71
+ const det = this.determinant;
72
+ return new AffineTransform([
73
+ this.m11 / det,
74
+ -this.m01 / det,
75
+ (this.m01 * this.m12 - this.m11 * this.m02) / det,
76
+ -this.m10 / det,
77
+ this.m00 / det,
78
+ (this.m10 * this.m02 - this.m00 * this.m12) / det
79
+ ]);
80
+ }
81
+ get array() {
82
+ return [
83
+ this.m00,
84
+ this.m01,
85
+ this.m02,
86
+ this.m10,
87
+ this.m11,
88
+ this.m12,
89
+ 0,
90
+ 0,
91
+ 1
92
+ ];
93
+ }
94
+ get float32Array() {
95
+ return new Float32Array(this.array);
96
+ }
97
+ static get identity() {
98
+ return new AffineTransform([
99
+ 1,
100
+ 0,
101
+ 0,
102
+ 0,
103
+ 1,
104
+ 0
105
+ ]);
106
+ }
107
+ static rotate(theta, origin) {
108
+ const rotation = new AffineTransform([
109
+ Math.cos(theta),
110
+ -Math.sin(theta),
111
+ 0,
112
+ Math.sin(theta),
113
+ Math.cos(theta),
114
+ 0
115
+ ]);
116
+ if (origin && (origin.x !== 0 || origin.y !== 0)) return AffineTransform.multiply(AffineTransform.translate(origin.x, origin.y), rotation, AffineTransform.translate(-origin.x, -origin.y));
117
+ return rotation;
118
+ }
119
+ static scale(sx, sy = sx, origin = {
120
+ x: 0,
121
+ y: 0
122
+ }) {
123
+ const scale = new AffineTransform([
124
+ sx,
125
+ 0,
126
+ 0,
127
+ 0,
128
+ sy,
129
+ 0
130
+ ]);
131
+ if (origin.x !== 0 || origin.y !== 0) return AffineTransform.multiply(AffineTransform.translate(origin.x, origin.y), scale, AffineTransform.translate(-origin.x, -origin.y));
132
+ return scale;
133
+ }
134
+ static translate(tx, ty) {
135
+ return new AffineTransform([
136
+ 1,
137
+ 0,
138
+ tx,
139
+ 0,
140
+ 1,
141
+ ty
142
+ ]);
143
+ }
144
+ static multiply(...[first, ...rest]) {
145
+ if (!first) return AffineTransform.identity;
146
+ return rest.reduce((result, item) => result.prepend(item), first);
147
+ }
148
+ get a() {
149
+ return this.m00;
150
+ }
151
+ get b() {
152
+ return this.m10;
153
+ }
154
+ get c() {
155
+ return this.m01;
156
+ }
157
+ get d() {
158
+ return this.m11;
159
+ }
160
+ get tx() {
161
+ return this.m02;
162
+ }
163
+ get ty() {
164
+ return this.m12;
165
+ }
166
+ get scaleComponents() {
167
+ return {
168
+ x: this.a,
169
+ y: this.d
170
+ };
171
+ }
172
+ get translationComponents() {
173
+ return {
174
+ x: this.tx,
175
+ y: this.ty
176
+ };
177
+ }
178
+ get skewComponents() {
179
+ return {
180
+ x: this.c,
181
+ y: this.b
182
+ };
183
+ }
184
+ toString() {
185
+ return `matrix(${this.a}, ${this.b}, ${this.c}, ${this.d}, ${this.tx}, ${this.ty})`;
186
+ }
187
+ };
188
+
189
+ //#endregion
190
+ //#region src/shared/rect-utils/align.ts
191
+ function hAlign(a, ref, h) {
192
+ let x = ref.minX;
193
+ if (h === "left-inside") x = ref.minX;
194
+ if (h === "left-outside") x = ref.minX - ref.width;
195
+ if (h === "right-inside") x = ref.maxX - ref.width;
196
+ if (h === "right-outside") x = ref.maxX;
197
+ if (h === "center") x = ref.midX - ref.width / 2;
198
+ return {
199
+ ...a,
200
+ x
201
+ };
202
+ }
203
+ function vAlign(a, ref, v) {
204
+ let y = ref.minY;
205
+ if (v === "top-inside") y = ref.minY;
206
+ if (v === "top-outside") y = ref.minY - a.height;
207
+ if (v === "bottom-inside") y = ref.maxY - a.height;
208
+ if (v === "bottom-outside") y = ref.maxY;
209
+ if (v === "center") y = ref.midY - a.height / 2;
210
+ return {
211
+ ...a,
212
+ y
213
+ };
214
+ }
215
+ function alignRect(a, ref, options) {
216
+ const { h, v } = options;
217
+ return vAlign(hAlign(a, ref, h), ref, v);
218
+ }
219
+
220
+ //#endregion
221
+ //#region src/shared/rect-utils/angle.ts
222
+ function getPointAngle(rect, point, reference = rect.center) {
223
+ const x = point.x - reference.x;
224
+ const y = point.y - reference.y;
225
+ return 360 - (Math.atan2(x, y) * (180 / Math.PI) + 180);
226
+ }
227
+
228
+ //#endregion
229
+ //#region src/shared/rect-utils/clamp.ts
230
+ const clamp = (value, min$2, max$1) => Math.min(Math.max(value, min$2), max$1);
231
+ const clampPoint = (position, size, boundaryRect) => {
232
+ return {
233
+ x: clamp(position.x, boundaryRect.x, boundaryRect.x + boundaryRect.width - size.width),
234
+ y: clamp(position.y, boundaryRect.y, boundaryRect.y + boundaryRect.height - size.height)
235
+ };
236
+ };
237
+ const defaultMinSize = {
238
+ width: 0,
239
+ height: 0
240
+ };
241
+ const defaultMaxSize = {
242
+ width: Infinity,
243
+ height: Infinity
244
+ };
245
+ const clampSize = (size, minSize = defaultMinSize, maxSize = defaultMaxSize) => {
246
+ return {
247
+ width: Math.min(Math.max(size.width, minSize.width), maxSize.width),
248
+ height: Math.min(Math.max(size.height, minSize.height), maxSize.height)
249
+ };
250
+ };
251
+
252
+ //#endregion
253
+ //#region src/shared/rect-utils/rect.ts
254
+ const createPoint = (x, y) => ({
255
+ x,
256
+ y
257
+ });
258
+ const subtractPoints = (a, b) => {
259
+ if (!b) return a;
260
+ return createPoint(a.x - b.x, a.y - b.y);
261
+ };
262
+ const addPoints = (a, b) => createPoint(a.x + b.x, a.y + b.y);
263
+ function isPoint(v) {
264
+ return Reflect.has(v, "x") && Reflect.has(v, "y");
265
+ }
266
+ function createRect(r) {
267
+ const { x, y, width, height } = r;
268
+ const midX = x + width / 2;
269
+ const midY = y + height / 2;
270
+ return {
271
+ x,
272
+ y,
273
+ width,
274
+ height,
275
+ minX: x,
276
+ minY: y,
277
+ maxX: x + width,
278
+ maxY: y + height,
279
+ midX,
280
+ midY,
281
+ center: createPoint(midX, midY)
282
+ };
283
+ }
284
+ function isRect(v) {
285
+ return Reflect.has(v, "x") && Reflect.has(v, "y") && Reflect.has(v, "width") && Reflect.has(v, "height");
286
+ }
287
+ function getRectCenters(v) {
288
+ return {
289
+ top: createPoint(v.midX, v.minY),
290
+ right: createPoint(v.maxX, v.midY),
291
+ bottom: createPoint(v.midX, v.maxY),
292
+ left: createPoint(v.minX, v.midY)
293
+ };
294
+ }
295
+ function getRectCorners(v) {
296
+ return {
297
+ top: createPoint(v.minX, v.minY),
298
+ right: createPoint(v.maxX, v.minY),
299
+ bottom: createPoint(v.maxX, v.maxY),
300
+ left: createPoint(v.minX, v.maxY)
301
+ };
302
+ }
303
+ function getRectEdges(v) {
304
+ const c = getRectCorners(v);
305
+ return {
306
+ top: [c.top, c.right],
307
+ right: [c.right, c.bottom],
308
+ bottom: [c.left, c.bottom],
309
+ left: [c.top, c.left]
310
+ };
311
+ }
312
+
313
+ //#endregion
314
+ //#region src/shared/rect-utils/intersection.ts
315
+ function intersects(a, b) {
316
+ return a.x < b.maxX && a.y < b.maxY && a.maxX > b.x && a.maxY > b.y;
317
+ }
318
+ function intersection(a, b) {
319
+ const x = Math.max(a.x, b.x);
320
+ const y = Math.max(a.y, b.y);
321
+ const x2 = Math.min(a.x + a.width, b.x + b.width);
322
+ const y2 = Math.min(a.y + a.height, b.y + b.height);
323
+ return createRect({
324
+ x,
325
+ y,
326
+ width: x2 - x,
327
+ height: y2 - y
328
+ });
329
+ }
330
+ function collisions(a, b) {
331
+ return {
332
+ top: a.minY <= b.minY,
333
+ right: a.maxX >= b.maxX,
334
+ bottom: a.maxY >= b.maxY,
335
+ left: a.minX <= b.minX
336
+ };
337
+ }
338
+
339
+ //#endregion
340
+ //#region src/shared/rect-utils/distance.ts
341
+ function distance(a, b = {
342
+ x: 0,
343
+ y: 0
344
+ }) {
345
+ return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
346
+ }
347
+ function distanceFromPoint(r, p) {
348
+ let x = 0;
349
+ let y = 0;
350
+ if (p.x < r.x) x = r.x - p.x;
351
+ else if (p.x > r.maxX) x = p.x - r.maxX;
352
+ if (p.y < r.y) y = r.y - p.y;
353
+ else if (p.y > r.maxY) y = p.y - r.maxY;
354
+ return {
355
+ x,
356
+ y,
357
+ value: distance({
358
+ x,
359
+ y
360
+ })
361
+ };
362
+ }
363
+ function distanceFromRect(a, b) {
364
+ if (intersects(a, b)) return {
365
+ x: 0,
366
+ y: 0,
367
+ value: 0
368
+ };
369
+ const left = a.x < b.x ? a : b;
370
+ const right = b.x < a.x ? a : b;
371
+ const upper = a.y < b.y ? a : b;
372
+ const lower = b.y < a.y ? a : b;
373
+ let x = left.x === right.x ? 0 : right.x - left.maxX;
374
+ x = Math.max(0, x);
375
+ let y = upper.y === lower.y ? 0 : lower.y - upper.maxY;
376
+ y = Math.max(0, y);
377
+ return {
378
+ x,
379
+ y,
380
+ value: distance({
381
+ x,
382
+ y
383
+ })
384
+ };
385
+ }
386
+ function distanceBtwEdges(a, b) {
387
+ return {
388
+ left: b.x - a.x,
389
+ top: b.y - a.y,
390
+ right: a.maxX - b.maxX,
391
+ bottom: a.maxY - b.maxY
392
+ };
393
+ }
394
+
395
+ //#endregion
396
+ //#region src/shared/rect-utils/closest.ts
397
+ function closest(...pts) {
398
+ return (a) => {
399
+ const ds = pts.map((b) => distance(b, a));
400
+ const c = Math.min.apply(Math, ds);
401
+ return pts[ds.indexOf(c)];
402
+ };
403
+ }
404
+ function closestSideToRect(ref, r) {
405
+ if (r.maxX <= ref.minX) return "left";
406
+ if (r.minX >= ref.maxX) return "right";
407
+ if (r.maxY <= ref.minY) return "top";
408
+ if (r.minY >= ref.maxY) return "bottom";
409
+ return "left";
410
+ }
411
+ function closestSideToPoint(ref, p) {
412
+ const { x, y } = p;
413
+ const dl = x - ref.minX;
414
+ const dr = ref.maxX - x;
415
+ const dt = y - ref.minY;
416
+ const db = ref.maxY - y;
417
+ let closest$1 = dl;
418
+ let side = "left";
419
+ if (dr < closest$1) {
420
+ closest$1 = dr;
421
+ side = "right";
422
+ }
423
+ if (dt < closest$1) {
424
+ closest$1 = dt;
425
+ side = "top";
426
+ }
427
+ if (db < closest$1) side = "bottom";
428
+ return side;
429
+ }
430
+
431
+ //#endregion
432
+ //#region src/shared/rect-utils/constrain.ts
433
+ const constrainRect = (rect, boundary) => {
434
+ return {
435
+ x: Math.max(boundary.x, Math.min(rect.x, boundary.x + boundary.width - rect.width)),
436
+ y: Math.max(boundary.y, Math.min(rect.y, boundary.y + boundary.height - rect.height)),
437
+ width: Math.min(rect.width, boundary.width),
438
+ height: Math.min(rect.height, boundary.height)
439
+ };
440
+ };
441
+
442
+ //#endregion
443
+ //#region src/shared/rect-utils/contains.ts
444
+ function containsPoint(r, p) {
445
+ return r.minX <= p.x && p.x <= r.maxX && r.minY <= p.y && p.y <= r.maxY;
446
+ }
447
+ function containsRect(a, b) {
448
+ return Object.values(getRectCorners(b)).every((c) => containsPoint(a, c));
449
+ }
450
+ function contains(r, v) {
451
+ return isRect(v) ? containsRect(r, v) : containsPoint(r, v);
452
+ }
453
+
454
+ //#endregion
455
+ //#region src/shared/rect-utils/equality.ts
456
+ const isSizeEqual = (a, b) => {
457
+ return a.width === b?.width && a.height === b?.height;
458
+ };
459
+ const isPointEqual = (a, b) => {
460
+ return a.x === b?.x && a.y === b?.y;
461
+ };
462
+ const isRectEqual = (a, b) => {
463
+ return isPointEqual(a, b) && isSizeEqual(a, b);
464
+ };
465
+
466
+ //#endregion
467
+ //#region src/shared/rect-utils/from-element.ts
468
+ const styleCache = /* @__PURE__ */ new WeakMap();
469
+ function getCacheComputedStyle(el) {
470
+ if (!styleCache.has(el)) {
471
+ const win = el.ownerDocument.defaultView || window;
472
+ styleCache.set(el, win.getComputedStyle(el));
473
+ }
474
+ return styleCache.get(el);
475
+ }
476
+ function getElementRect(el, opts = {}) {
477
+ return createRect(getClientRect(el, opts));
478
+ }
479
+ function getClientRect(el, opts = {}) {
480
+ const { excludeScrollbar = false, excludeBorders = false } = opts;
481
+ const { x, y, width, height } = el.getBoundingClientRect();
482
+ const r = {
483
+ x,
484
+ y,
485
+ width,
486
+ height
487
+ };
488
+ const { borderLeftWidth, borderTopWidth, borderRightWidth, borderBottomWidth } = getCacheComputedStyle(el);
489
+ const borderXWidth = sum(borderLeftWidth, borderRightWidth);
490
+ const borderYWidth = sum(borderTopWidth, borderBottomWidth);
491
+ if (excludeBorders) {
492
+ r.width -= borderXWidth;
493
+ r.height -= borderYWidth;
494
+ r.x += px(borderLeftWidth);
495
+ r.y += px(borderTopWidth);
496
+ }
497
+ if (excludeScrollbar) {
498
+ const scrollbarWidth = el.offsetWidth - el.clientWidth - borderXWidth;
499
+ const scrollbarHeight = el.offsetHeight - el.clientHeight - borderYWidth;
500
+ r.width -= scrollbarWidth;
501
+ r.height -= scrollbarHeight;
502
+ }
503
+ return r;
504
+ }
505
+ const px = (v) => parseFloat(v.replace("px", ""));
506
+ const sum = (...vals) => vals.reduce((sum$1, v) => sum$1 + (v ? px(v) : 0), 0);
507
+
508
+ //#endregion
509
+ //#region src/shared/rect-utils/from-points.ts
510
+ function getRectFromPoints(...pts) {
511
+ const xs = pts.map((p) => p.x);
512
+ const ys = pts.map((p) => p.y);
513
+ const x = Math.min(...xs);
514
+ const y = Math.min(...ys);
515
+ return createRect({
516
+ x,
517
+ y,
518
+ width: Math.max(...xs) - x,
519
+ height: Math.max(...ys) - y
520
+ });
521
+ }
522
+
523
+ //#endregion
524
+ //#region src/shared/rect-utils/union.ts
525
+ const { min: min$1, max } = Math;
526
+ function union(...rs) {
527
+ return getRectFromPoints({
528
+ x: min$1(...rs.map((r) => r.minX)),
529
+ y: min$1(...rs.map((r) => r.minY))
530
+ }, {
531
+ x: max(...rs.map((r) => r.maxX)),
532
+ y: max(...rs.map((r) => r.maxY))
533
+ });
534
+ }
535
+
536
+ //#endregion
537
+ //#region src/shared/rect-utils/from-range.ts
538
+ function fromRange(range) {
539
+ let rs = [];
540
+ const rects = Array.from(range.getClientRects());
541
+ if (rects.length) {
542
+ rs = rs.concat(rects.map(createRect));
543
+ return union.apply(void 0, rs);
544
+ }
545
+ let start = range.startContainer;
546
+ if (start.nodeType === Node.TEXT_NODE) start = start.parentNode;
547
+ if (start instanceof HTMLElement) {
548
+ const r = getElementRect(start);
549
+ rs.push({
550
+ ...r,
551
+ x: r.maxX,
552
+ width: 0
553
+ });
554
+ }
555
+ return union.apply(void 0, rs);
556
+ }
557
+
558
+ //#endregion
559
+ //#region src/shared/rect-utils/from-rotation.ts
560
+ function toRad(d) {
561
+ return d % 360 * Math.PI / 180;
562
+ }
563
+ function rotate(a, d, c) {
564
+ const r = toRad(d);
565
+ const sin = Math.sin(r);
566
+ const cos = Math.cos(r);
567
+ const x = a.x - c.x;
568
+ const y = a.y - c.y;
569
+ return {
570
+ x: c.x + x * cos - y * sin,
571
+ y: c.y + x * sin + y * cos
572
+ };
573
+ }
574
+ function getRotationRect(r, deg) {
575
+ const rr = Object.values(getRectCorners(r)).map((p) => rotate(p, deg, r.center));
576
+ const xs = rr.map((p) => p.x);
577
+ const ys = rr.map((p) => p.y);
578
+ const minX = Math.min(...xs);
579
+ const minY = Math.min(...ys);
580
+ const maxX = Math.max(...xs);
581
+ const maxY = Math.max(...ys);
582
+ return createRect({
583
+ x: minX,
584
+ y: minY,
585
+ width: maxX - minX,
586
+ height: maxY - minY
587
+ });
588
+ }
589
+
590
+ //#endregion
591
+ //#region src/shared/rect-utils/from-window.ts
592
+ function getWindowRect(win, opts = {}) {
593
+ return createRect(getViewportRect(win, opts));
594
+ }
595
+ function getViewportRect(win, opts) {
596
+ const { excludeScrollbar = false } = opts;
597
+ const { innerWidth, innerHeight, document: doc, visualViewport } = win;
598
+ const rect = {
599
+ x: 0,
600
+ y: 0,
601
+ width: visualViewport?.width || innerWidth,
602
+ height: visualViewport?.height || innerHeight
603
+ };
604
+ if (excludeScrollbar) {
605
+ const scrollbarWidth = innerWidth - doc.documentElement.clientWidth;
606
+ const scrollbarHeight = innerHeight - doc.documentElement.clientHeight;
607
+ rect.width -= scrollbarWidth;
608
+ rect.height -= scrollbarHeight;
609
+ }
610
+ return rect;
611
+ }
612
+
613
+ //#endregion
614
+ //#region src/shared/rect-utils/operations.ts
615
+ const isSymmetric = (v) => "dx" in v || "dy" in v;
616
+ function inset(r, i) {
617
+ const { top = 0, right = 0, bottom = 0, left = 0 } = isSymmetric(i) ? {
618
+ left: i.dx,
619
+ right: i.dx,
620
+ top: i.dy,
621
+ bottom: i.dy
622
+ } : i;
623
+ return createRect({
624
+ x: r.x + left,
625
+ y: r.y + top,
626
+ width: r.width - left - right,
627
+ height: r.height - top - bottom
628
+ });
629
+ }
630
+ function expand(r, v) {
631
+ return inset(r, typeof v === "number" ? {
632
+ dx: -v,
633
+ dy: -v
634
+ } : v);
635
+ }
636
+ function shrink(r, v) {
637
+ return inset(r, typeof v === "number" ? {
638
+ dx: -v,
639
+ dy: -v
640
+ } : v);
641
+ }
642
+ function shift(r, o) {
643
+ const { x = 0, y = 0 } = o;
644
+ return createRect({
645
+ x: r.x + x,
646
+ y: r.y + y,
647
+ width: r.width,
648
+ height: r.height
649
+ });
650
+ }
651
+
652
+ //#endregion
653
+ //#region src/shared/rect-utils/polygon.ts
654
+ function getElementPolygon(rectValue, placement) {
655
+ const { top, right, left, bottom } = getRectCorners(createRect(rectValue));
656
+ const [base] = placement.split("-");
657
+ return {
658
+ top: [
659
+ left,
660
+ top,
661
+ right,
662
+ bottom
663
+ ],
664
+ right: [
665
+ top,
666
+ right,
667
+ bottom,
668
+ left
669
+ ],
670
+ bottom: [
671
+ top,
672
+ left,
673
+ bottom,
674
+ right
675
+ ],
676
+ left: [
677
+ right,
678
+ top,
679
+ left,
680
+ bottom
681
+ ]
682
+ }[base];
683
+ }
684
+ function isPointInPolygon(polygon, point) {
685
+ const { x, y } = point;
686
+ let c = false;
687
+ for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
688
+ const xi = polygon[i].x;
689
+ const yi = polygon[i].y;
690
+ const xj = polygon[j].x;
691
+ const yj = polygon[j].y;
692
+ if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) c = !c;
693
+ }
694
+ return c;
695
+ }
696
+ function createPolygonElement() {
697
+ const id = "debug-polygon";
698
+ const existingPolygon = document.getElementById(id);
699
+ if (existingPolygon) return existingPolygon;
700
+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
701
+ Object.assign(svg.style, {
702
+ top: "0",
703
+ left: "0",
704
+ width: "100%",
705
+ height: "100%",
706
+ opacity: "0.15",
707
+ position: "fixed",
708
+ pointerEvents: "none",
709
+ fill: "red"
710
+ });
711
+ const polygon = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
712
+ polygon.setAttribute("id", id);
713
+ polygon.setAttribute("points", "0,0 0,0");
714
+ svg.appendChild(polygon);
715
+ document.body.appendChild(svg);
716
+ return polygon;
717
+ }
718
+ function debugPolygon(polygon) {
719
+ const el = createPolygonElement();
720
+ const points = polygon.map((point) => `${point.x},${point.y}`).join(" ");
721
+ el.setAttribute("points", points);
722
+ return () => {
723
+ el.remove();
724
+ };
725
+ }
726
+
727
+ //#endregion
728
+ //#region src/shared/rect-utils/compass.ts
729
+ const compassDirectionMap = {
730
+ n: {
731
+ x: .5,
732
+ y: 0
733
+ },
734
+ ne: {
735
+ x: 1,
736
+ y: 0
737
+ },
738
+ e: {
739
+ x: 1,
740
+ y: .5
741
+ },
742
+ se: {
743
+ x: 1,
744
+ y: 1
745
+ },
746
+ s: {
747
+ x: .5,
748
+ y: 1
749
+ },
750
+ sw: {
751
+ x: 0,
752
+ y: 1
753
+ },
754
+ w: {
755
+ x: 0,
756
+ y: .5
757
+ },
758
+ nw: {
759
+ x: 0,
760
+ y: 0
761
+ }
762
+ };
763
+ const oppositeDirectionMap = {
764
+ n: "s",
765
+ ne: "sw",
766
+ e: "w",
767
+ se: "nw",
768
+ s: "n",
769
+ sw: "ne",
770
+ w: "e",
771
+ nw: "se"
772
+ };
773
+
774
+ //#endregion
775
+ //#region src/shared/rect-utils/resize.ts
776
+ const { sign, abs, min } = Math;
777
+ function getRectExtentPoint(rect, direction) {
778
+ const { minX, minY, maxX, maxY, midX, midY } = rect;
779
+ return {
780
+ x: direction.includes("w") ? minX : direction.includes("e") ? maxX : midX,
781
+ y: direction.includes("n") ? minY : direction.includes("s") ? maxY : midY
782
+ };
783
+ }
784
+ function getOppositeDirection(direction) {
785
+ return oppositeDirectionMap[direction];
786
+ }
787
+ function resizeRect(rect, offset, direction, opts) {
788
+ const { scalingOriginMode, lockAspectRatio } = opts;
789
+ const extent = getRectExtentPoint(rect, direction);
790
+ const oppositeExtent = getRectExtentPoint(rect, getOppositeDirection(direction));
791
+ if (scalingOriginMode === "center") offset = {
792
+ x: offset.x * 2,
793
+ y: offset.y * 2
794
+ };
795
+ const newExtent = {
796
+ x: extent.x + offset.x,
797
+ y: extent.y + offset.y
798
+ };
799
+ const multiplier = {
800
+ x: compassDirectionMap[direction].x * 2 - 1,
801
+ y: compassDirectionMap[direction].y * 2 - 1
802
+ };
803
+ const newSize = {
804
+ width: newExtent.x - oppositeExtent.x,
805
+ height: newExtent.y - oppositeExtent.y
806
+ };
807
+ const scaleX = multiplier.x * newSize.width / rect.width;
808
+ const scaleY = multiplier.y * newSize.height / rect.height;
809
+ const largestMagnitude = abs(scaleX) > abs(scaleY) ? scaleX : scaleY;
810
+ const scale = lockAspectRatio ? {
811
+ x: largestMagnitude,
812
+ y: largestMagnitude
813
+ } : {
814
+ x: extent.x === oppositeExtent.x ? 1 : scaleX,
815
+ y: extent.y === oppositeExtent.y ? 1 : scaleY
816
+ };
817
+ if (extent.y === oppositeExtent.y) scale.y = abs(scale.y);
818
+ else if (sign(scale.y) !== sign(scaleY)) scale.y *= -1;
819
+ if (extent.x === oppositeExtent.x) scale.x = abs(scale.x);
820
+ else if (sign(scale.x) !== sign(scaleX)) scale.x *= -1;
821
+ switch (scalingOriginMode) {
822
+ case "extent": return transformRect(rect, AffineTransform.scale(scale.x, scale.y, oppositeExtent), false);
823
+ case "center": return transformRect(rect, AffineTransform.scale(scale.x, scale.y, {
824
+ x: rect.midX,
825
+ y: rect.midY
826
+ }), false);
827
+ }
828
+ }
829
+ function createRectFromPoints(initialPoint, finalPoint, normalized = true) {
830
+ if (normalized) return {
831
+ x: min(finalPoint.x, initialPoint.x),
832
+ y: min(finalPoint.y, initialPoint.y),
833
+ width: abs(finalPoint.x - initialPoint.x),
834
+ height: abs(finalPoint.y - initialPoint.y)
835
+ };
836
+ return {
837
+ x: initialPoint.x,
838
+ y: initialPoint.y,
839
+ width: finalPoint.x - initialPoint.x,
840
+ height: finalPoint.y - initialPoint.y
841
+ };
842
+ }
843
+ function transformRect(rect, transform, normalized = true) {
844
+ return createRectFromPoints(transform.applyTo({
845
+ x: rect.minX,
846
+ y: rect.minY
847
+ }), transform.applyTo({
848
+ x: rect.maxX,
849
+ y: rect.maxY
850
+ }), normalized);
851
+ }
852
+
853
+ //#endregion
854
+ Object.defineProperty(exports, 'AffineTransform', {
855
+ enumerable: true,
856
+ get: function () {
857
+ return AffineTransform;
858
+ }
859
+ });
860
+ Object.defineProperty(exports, 'addPoints', {
861
+ enumerable: true,
862
+ get: function () {
863
+ return addPoints;
864
+ }
865
+ });
866
+ Object.defineProperty(exports, 'alignRect', {
867
+ enumerable: true,
868
+ get: function () {
869
+ return alignRect;
870
+ }
871
+ });
872
+ Object.defineProperty(exports, 'clampPoint', {
873
+ enumerable: true,
874
+ get: function () {
875
+ return clampPoint;
876
+ }
877
+ });
878
+ Object.defineProperty(exports, 'clampSize', {
879
+ enumerable: true,
880
+ get: function () {
881
+ return clampSize;
882
+ }
883
+ });
884
+ Object.defineProperty(exports, 'closest', {
885
+ enumerable: true,
886
+ get: function () {
887
+ return closest;
888
+ }
889
+ });
890
+ Object.defineProperty(exports, 'closestSideToPoint', {
891
+ enumerable: true,
892
+ get: function () {
893
+ return closestSideToPoint;
894
+ }
895
+ });
896
+ Object.defineProperty(exports, 'closestSideToRect', {
897
+ enumerable: true,
898
+ get: function () {
899
+ return closestSideToRect;
900
+ }
901
+ });
902
+ Object.defineProperty(exports, 'collisions', {
903
+ enumerable: true,
904
+ get: function () {
905
+ return collisions;
906
+ }
907
+ });
908
+ Object.defineProperty(exports, 'constrainRect', {
909
+ enumerable: true,
910
+ get: function () {
911
+ return constrainRect;
912
+ }
913
+ });
914
+ Object.defineProperty(exports, 'contains', {
915
+ enumerable: true,
916
+ get: function () {
917
+ return contains;
918
+ }
919
+ });
920
+ Object.defineProperty(exports, 'containsPoint', {
921
+ enumerable: true,
922
+ get: function () {
923
+ return containsPoint;
924
+ }
925
+ });
926
+ Object.defineProperty(exports, 'containsRect', {
927
+ enumerable: true,
928
+ get: function () {
929
+ return containsRect;
930
+ }
931
+ });
932
+ Object.defineProperty(exports, 'createPoint', {
933
+ enumerable: true,
934
+ get: function () {
935
+ return createPoint;
936
+ }
937
+ });
938
+ Object.defineProperty(exports, 'createRect', {
939
+ enumerable: true,
940
+ get: function () {
941
+ return createRect;
942
+ }
943
+ });
944
+ Object.defineProperty(exports, 'debugPolygon', {
945
+ enumerable: true,
946
+ get: function () {
947
+ return debugPolygon;
948
+ }
949
+ });
950
+ Object.defineProperty(exports, 'distance', {
951
+ enumerable: true,
952
+ get: function () {
953
+ return distance;
954
+ }
955
+ });
956
+ Object.defineProperty(exports, 'distanceBtwEdges', {
957
+ enumerable: true,
958
+ get: function () {
959
+ return distanceBtwEdges;
960
+ }
961
+ });
962
+ Object.defineProperty(exports, 'distanceFromPoint', {
963
+ enumerable: true,
964
+ get: function () {
965
+ return distanceFromPoint;
966
+ }
967
+ });
968
+ Object.defineProperty(exports, 'distanceFromRect', {
969
+ enumerable: true,
970
+ get: function () {
971
+ return distanceFromRect;
972
+ }
973
+ });
974
+ Object.defineProperty(exports, 'expand', {
975
+ enumerable: true,
976
+ get: function () {
977
+ return expand;
978
+ }
979
+ });
980
+ Object.defineProperty(exports, 'fromRange', {
981
+ enumerable: true,
982
+ get: function () {
983
+ return fromRange;
984
+ }
985
+ });
986
+ Object.defineProperty(exports, 'getElementPolygon', {
987
+ enumerable: true,
988
+ get: function () {
989
+ return getElementPolygon;
990
+ }
991
+ });
992
+ Object.defineProperty(exports, 'getElementRect', {
993
+ enumerable: true,
994
+ get: function () {
995
+ return getElementRect;
996
+ }
997
+ });
998
+ Object.defineProperty(exports, 'getPointAngle', {
999
+ enumerable: true,
1000
+ get: function () {
1001
+ return getPointAngle;
1002
+ }
1003
+ });
1004
+ Object.defineProperty(exports, 'getRectCenters', {
1005
+ enumerable: true,
1006
+ get: function () {
1007
+ return getRectCenters;
1008
+ }
1009
+ });
1010
+ Object.defineProperty(exports, 'getRectCorners', {
1011
+ enumerable: true,
1012
+ get: function () {
1013
+ return getRectCorners;
1014
+ }
1015
+ });
1016
+ Object.defineProperty(exports, 'getRectEdges', {
1017
+ enumerable: true,
1018
+ get: function () {
1019
+ return getRectEdges;
1020
+ }
1021
+ });
1022
+ Object.defineProperty(exports, 'getRectFromPoints', {
1023
+ enumerable: true,
1024
+ get: function () {
1025
+ return getRectFromPoints;
1026
+ }
1027
+ });
1028
+ Object.defineProperty(exports, 'getRotationRect', {
1029
+ enumerable: true,
1030
+ get: function () {
1031
+ return getRotationRect;
1032
+ }
1033
+ });
1034
+ Object.defineProperty(exports, 'getViewportRect', {
1035
+ enumerable: true,
1036
+ get: function () {
1037
+ return getViewportRect;
1038
+ }
1039
+ });
1040
+ Object.defineProperty(exports, 'getWindowRect', {
1041
+ enumerable: true,
1042
+ get: function () {
1043
+ return getWindowRect;
1044
+ }
1045
+ });
1046
+ Object.defineProperty(exports, 'inset', {
1047
+ enumerable: true,
1048
+ get: function () {
1049
+ return inset;
1050
+ }
1051
+ });
1052
+ Object.defineProperty(exports, 'intersection', {
1053
+ enumerable: true,
1054
+ get: function () {
1055
+ return intersection;
1056
+ }
1057
+ });
1058
+ Object.defineProperty(exports, 'intersects', {
1059
+ enumerable: true,
1060
+ get: function () {
1061
+ return intersects;
1062
+ }
1063
+ });
1064
+ Object.defineProperty(exports, 'isPoint', {
1065
+ enumerable: true,
1066
+ get: function () {
1067
+ return isPoint;
1068
+ }
1069
+ });
1070
+ Object.defineProperty(exports, 'isPointEqual', {
1071
+ enumerable: true,
1072
+ get: function () {
1073
+ return isPointEqual;
1074
+ }
1075
+ });
1076
+ Object.defineProperty(exports, 'isPointInPolygon', {
1077
+ enumerable: true,
1078
+ get: function () {
1079
+ return isPointInPolygon;
1080
+ }
1081
+ });
1082
+ Object.defineProperty(exports, 'isRect', {
1083
+ enumerable: true,
1084
+ get: function () {
1085
+ return isRect;
1086
+ }
1087
+ });
1088
+ Object.defineProperty(exports, 'isRectEqual', {
1089
+ enumerable: true,
1090
+ get: function () {
1091
+ return isRectEqual;
1092
+ }
1093
+ });
1094
+ Object.defineProperty(exports, 'isSizeEqual', {
1095
+ enumerable: true,
1096
+ get: function () {
1097
+ return isSizeEqual;
1098
+ }
1099
+ });
1100
+ Object.defineProperty(exports, 'isSymmetric', {
1101
+ enumerable: true,
1102
+ get: function () {
1103
+ return isSymmetric;
1104
+ }
1105
+ });
1106
+ Object.defineProperty(exports, 'resizeRect', {
1107
+ enumerable: true,
1108
+ get: function () {
1109
+ return resizeRect;
1110
+ }
1111
+ });
1112
+ Object.defineProperty(exports, 'rotate', {
1113
+ enumerable: true,
1114
+ get: function () {
1115
+ return rotate;
1116
+ }
1117
+ });
1118
+ Object.defineProperty(exports, 'shift', {
1119
+ enumerable: true,
1120
+ get: function () {
1121
+ return shift;
1122
+ }
1123
+ });
1124
+ Object.defineProperty(exports, 'shrink', {
1125
+ enumerable: true,
1126
+ get: function () {
1127
+ return shrink;
1128
+ }
1129
+ });
1130
+ Object.defineProperty(exports, 'subtractPoints', {
1131
+ enumerable: true,
1132
+ get: function () {
1133
+ return subtractPoints;
1134
+ }
1135
+ });
1136
+ Object.defineProperty(exports, 'toRad', {
1137
+ enumerable: true,
1138
+ get: function () {
1139
+ return toRad;
1140
+ }
1141
+ });
1142
+ Object.defineProperty(exports, 'union', {
1143
+ enumerable: true,
1144
+ get: function () {
1145
+ return union;
1146
+ }
1147
+ });