@commentkit/comment-kit 0.6.8 → 0.7.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 (339) hide show
  1. package/CHANGELOG.md +71 -2
  2. package/LICENSE +18 -2
  3. package/README.md +198 -125
  4. package/SECURITY.md +48 -0
  5. package/dist/THIRD_PARTY_NOTICES.txt +284 -0
  6. package/dist/angular.es.js +68 -3419
  7. package/dist/comment-kit.es.js +33 -3192
  8. package/dist/demo.es.js +472 -0
  9. package/dist/headless.es.js +4 -0
  10. package/dist/preact.es.js +79 -3443
  11. package/dist/qwik.es.js +1 -3474
  12. package/dist/qwik.qwik.mjs +114 -0
  13. package/dist/react.es.js +80 -28447
  14. package/dist/shared/ShadowRootContext-Bv-4aElu.js +13 -0
  15. package/dist/shared/annotation-icons-Dh-bmNYK.js +172 -0
  16. package/dist/shared/annotation-toolbar-B9SxYqoF.js +1093 -0
  17. package/dist/shared/bridge-CJoGYngu.js +177 -0
  18. package/dist/shared/button-By0hGrJK.js +505 -0
  19. package/dist/shared/button-group-Cl9CrvvU.js +93 -0
  20. package/dist/shared/comment-drawing-canvas-Dzb5YoFw.js +124 -0
  21. package/dist/shared/comment-image-lightbox-BPYJT1sB.js +183 -0
  22. package/dist/shared/comment-kit-core-BaSuMzp9.js +3381 -0
  23. package/dist/shared/comment-kit-ui-CzfdAZs2.js +20181 -0
  24. package/dist/shared/comment-screenshot-annotator-C7X-_bm6.js +151 -0
  25. package/dist/shared/comment-screenshot-overlay-wIrZrcRy.js +206 -0
  26. package/dist/shared/comment-utils-BycYTSxA.js +602 -0
  27. package/dist/shared/createReactComponent-BZHeRbD0.js +45 -0
  28. package/dist/shared/dev-export-panel-FwFVdady.js +208 -0
  29. package/dist/shared/dev-grab-DDqg0LQf.js +203 -0
  30. package/dist/shared/dist-De294MVF.js +623 -0
  31. package/dist/{core/dom-x9svfpMk.js → shared/dom-Bhf4WFtY.js} +2 -2
  32. package/dist/shared/element-selector-BhJm-NSs.js +858 -0
  33. package/dist/shared/errors-Bu5ajEmB.js +22 -0
  34. package/dist/shared/icons-nzMOLzrm.js +266 -0
  35. package/dist/shared/mount-ui--ijs8pWT.js +193 -0
  36. package/dist/{angular/pusher-Vs-W-c8I.js → shared/pusher-ipHMJnO_.js} +93 -127
  37. package/dist/shared/realtime-Dk41VwKg.js +302 -0
  38. package/dist/shared/separator-XDBsaWyw.js +4021 -0
  39. package/dist/shared/shadow-root-C5v-T8lQ.js +135 -0
  40. package/dist/shared/styles-D3yMtaec.js +2 -0
  41. package/dist/shared/useValueChanged-CrzfD8l-.js +92 -0
  42. package/dist/{angular/limits-AEqOBweE.js → shared/validation-C7QG8j7Z.js} +2 -28
  43. package/dist/{core/websocket-manager-D1_TEuy_.js → shared/websocket-manager-DhLWh3Jr.js} +90 -148
  44. package/dist/solid.es.js +63 -3427
  45. package/dist/svelte.es.js +78 -3442
  46. package/dist/types/adapters/bridge.d.ts +10 -13
  47. package/dist/types/angular/index.d.ts +17 -7
  48. package/dist/types/core/api-client.d.ts +16 -17
  49. package/dist/types/core/comment-kit-core.d.ts +29 -12
  50. package/dist/types/core/local-demo.d.ts +60 -0
  51. package/dist/types/core/types.d.ts +68 -0
  52. package/dist/types/demo.d.ts +17 -0
  53. package/dist/types/headless.d.ts +8 -0
  54. package/dist/types/index.d.ts +22 -20
  55. package/dist/types/qwik/index.d.ts +4 -1
  56. package/dist/vue.es.js +80 -3443
  57. package/docs/api-reference.md +372 -0
  58. package/docs/local-demo.md +60 -0
  59. package/package.json +69 -41
  60. package/dist/angular/chunk-Cyg4N8Ue.js +0 -11
  61. package/dist/angular/comment-kit-ui-D-LUFD6n.js +0 -24898
  62. package/dist/angular/dom-Cx1nMbdI.js +0 -104
  63. package/dist/angular/mount-ui-C9PJ5aK_.js +0 -72
  64. package/dist/angular/realtime-VrKV0lPI.js +0 -567
  65. package/dist/angular/shadow-root-yMOaW9pk.js +0 -93
  66. package/dist/angular/styles-CMz7-p8x.js +0 -2
  67. package/dist/angular/widget-theme-CYPYAwhR.js +0 -24
  68. package/dist/comment-kit.css +0 -2
  69. package/dist/core/chunk-t7YoJN_i.js +0 -11
  70. package/dist/core/comment-kit-ui-Ct4E18do.js +0 -24898
  71. package/dist/core/error-boundary-CN_BGsYl.js +0 -21
  72. package/dist/core/mount-ui-Bfnuuesk.js +0 -72
  73. package/dist/core/pusher-CizoY5NA.js +0 -2504
  74. package/dist/core/realtime-C3_O7gi2.js +0 -278
  75. package/dist/core/shadow-root-DAtdjHG2.js +0 -93
  76. package/dist/core/styles-ClRoB6ro.js +0 -2
  77. package/dist/core/widget-theme-BWDYr7VR.js +0 -24
  78. package/dist/preact/chunk-CZ0PdaaN.js +0 -11
  79. package/dist/preact/comment-kit-ui-DEzn7J_P.js +0 -24898
  80. package/dist/preact/dom-_ULpq7rg.js +0 -104
  81. package/dist/preact/error-boundary-B4-Bfy3g.js +0 -21
  82. package/dist/preact/limits-C3ZEKcL_.js +0 -71
  83. package/dist/preact/mount-ui-Dx8en--W.js +0 -72
  84. package/dist/preact/pusher-BP4kCufH.js +0 -2504
  85. package/dist/preact/realtime-COin_nJF.js +0 -567
  86. package/dist/preact/shadow-root-D-NcwruG.js +0 -93
  87. package/dist/preact/styles-D6i7be5-.js +0 -2
  88. package/dist/preact/widget-theme-B7Z2pbaA.js +0 -24
  89. package/dist/qwik/chunk-CKKKzG2Q.js +0 -11
  90. package/dist/qwik/comment-kit-ui-Dvwee2tw.js +0 -24898
  91. package/dist/qwik/dom-Dm3gzBBJ.js +0 -104
  92. package/dist/qwik/error-boundary-C4hlYQwS.js +0 -21
  93. package/dist/qwik/limits-DK35yjGY.js +0 -71
  94. package/dist/qwik/mount-ui-DSAwNk_d.js +0 -72
  95. package/dist/qwik/pusher-B1KgC4iB.js +0 -2504
  96. package/dist/qwik/realtime-DhfcBrwF.js +0 -567
  97. package/dist/qwik/shadow-root-PkjcnvPe.js +0 -93
  98. package/dist/qwik/styles-DmEmq5Lh.js +0 -2
  99. package/dist/qwik/widget-theme-lbPF3I0A.js +0 -24
  100. package/dist/react/chunk--MHYZ-zp.js +0 -12
  101. package/dist/react/limits-CpprSem3.js +0 -175
  102. package/dist/react/pusher-3dki8s2l.js +0 -2505
  103. package/dist/react/realtime-DGqScuox.js +0 -567
  104. package/dist/solid/chunk-B2NCWFvW.js +0 -11
  105. package/dist/solid/comment-kit-ui-ACW8BpEm.js +0 -24898
  106. package/dist/solid/dom-DqDH-Gml.js +0 -104
  107. package/dist/solid/error-boundary-9mimpbZA.js +0 -21
  108. package/dist/solid/limits-B_69IbLl.js +0 -71
  109. package/dist/solid/mount-ui-Dq1wj_tx.js +0 -72
  110. package/dist/solid/pusher-_RVNpj1f.js +0 -2504
  111. package/dist/solid/realtime-DbUJK4gU.js +0 -567
  112. package/dist/solid/shadow-root-CssU3bQb.js +0 -93
  113. package/dist/solid/styles-DbueS9xx.js +0 -2
  114. package/dist/solid/widget-theme-B4DJ14fI.js +0 -24
  115. package/dist/svelte/chunk-Pi70BKld.js +0 -11
  116. package/dist/svelte/comment-kit-ui-Cx4u1g77.js +0 -24898
  117. package/dist/svelte/dom-MyTrWzy_.js +0 -104
  118. package/dist/svelte/error-boundary-C3GWI_IX.js +0 -21
  119. package/dist/svelte/limits-CURF22v3.js +0 -71
  120. package/dist/svelte/mount-ui-CBoNGLNS.js +0 -72
  121. package/dist/svelte/pusher-DN1BiUDw.js +0 -2504
  122. package/dist/svelte/realtime-M1CJbCBA.js +0 -567
  123. package/dist/svelte/shadow-root-DG8inbf6.js +0 -93
  124. package/dist/svelte/styles-BK_MaUpD.js +0 -2
  125. package/dist/svelte/widget-theme-CkfJNysI.js +0 -24
  126. package/dist/types/adapters/errors.d.ts +0 -3
  127. package/dist/types/core/auth.d.ts +0 -18
  128. package/dist/types/core/comments.d.ts +0 -43
  129. package/dist/types/core/dev-grab.d.ts +0 -14
  130. package/dist/types/core/keyboard.d.ts +0 -12
  131. package/dist/types/core/limits.d.ts +0 -52
  132. package/dist/types/core/offline-queue.d.ts +0 -23
  133. package/dist/types/core/realtime.d.ts +0 -9
  134. package/dist/types/core/screenshot.d.ts +0 -12
  135. package/dist/types/core/session.d.ts +0 -9
  136. package/dist/types/core/source-resolver.d.ts +0 -19
  137. package/dist/types/core/state.d.ts +0 -24
  138. package/dist/types/react/comment-kit-ui.d.ts +0 -9
  139. package/dist/types/react/comments/comment-flow.d.ts +0 -8
  140. package/dist/types/react/comments/outcomes.d.ts +0 -28
  141. package/dist/types/react/comments/pin-geometry.d.ts +0 -12
  142. package/dist/types/react/comments/view-model.d.ts +0 -66
  143. package/dist/types/react/components/annotation-toolbar.d.ts +0 -36
  144. package/dist/types/react/components/build-panel-shared-props.d.ts +0 -25
  145. package/dist/types/react/components/comment-actions.d.ts +0 -19
  146. package/dist/types/react/components/comment-body.d.ts +0 -8
  147. package/dist/types/react/components/comment-branch-filter.d.ts +0 -15
  148. package/dist/types/react/components/comment-composer-actions.d.ts +0 -26
  149. package/dist/types/react/components/comment-composer-extras-fields.d.ts +0 -32
  150. package/dist/types/react/components/comment-composer-extras-toolbar.d.ts +0 -9
  151. package/dist/types/react/components/comment-composer-extras.d.ts +0 -10
  152. package/dist/types/react/components/comment-composer-extras.state.d.ts +0 -24
  153. package/dist/types/react/components/comment-composer-hook.d.ts +0 -1
  154. package/dist/types/react/components/comment-composer-media.d.ts +0 -17
  155. package/dist/types/react/components/comment-composer.d.ts +0 -4
  156. package/dist/types/react/components/comment-composer.types.d.ts +0 -41
  157. package/dist/types/react/components/comment-composer.utils.d.ts +0 -3
  158. package/dist/types/react/components/comment-connection-alert.d.ts +0 -7
  159. package/dist/types/react/components/comment-cursor-layer.d.ts +0 -14
  160. package/dist/types/react/components/comment-custom-cursor.d.ts +0 -14
  161. package/dist/types/react/components/comment-drawing-canvas.d.ts +0 -10
  162. package/dist/types/react/components/comment-emoji-picker.d.ts +0 -12
  163. package/dist/types/react/components/comment-error-banner.d.ts +0 -8
  164. package/dist/types/react/components/comment-extension-banner.d.ts +0 -8
  165. package/dist/types/react/components/comment-fab-tools.d.ts +0 -37
  166. package/dist/types/react/components/comment-fab.d.ts +0 -34
  167. package/dist/types/react/components/comment-filter-assignee.d.ts +0 -9
  168. package/dist/types/react/components/comment-filter-bar.d.ts +0 -27
  169. package/dist/types/react/components/comment-filter-popover.d.ts +0 -20
  170. package/dist/types/react/components/comment-format-toolbar.constants.d.ts +0 -34
  171. package/dist/types/react/components/comment-format-toolbar.d.ts +0 -6
  172. package/dist/types/react/components/comment-header.d.ts +0 -34
  173. package/dist/types/react/components/comment-highlight-layer.d.ts +0 -11
  174. package/dist/types/react/components/comment-highlight-marker.d.ts +0 -9
  175. package/dist/types/react/components/comment-image-lightbox.d.ts +0 -10
  176. package/dist/types/react/components/comment-images.d.ts +0 -7
  177. package/dist/types/react/components/comment-item.d.ts +0 -26
  178. package/dist/types/react/components/comment-keyboard-shortcuts.d.ts +0 -7
  179. package/dist/types/react/components/comment-kit-overlays.d.ts +0 -15
  180. package/dist/types/react/components/comment-kit.d.ts +0 -12
  181. package/dist/types/react/components/comment-list-filters.d.ts +0 -14
  182. package/dist/types/react/components/comment-login-modal.d.ts +0 -20
  183. package/dist/types/react/components/comment-marker-layer-composer.d.ts +0 -21
  184. package/dist/types/react/components/comment-marker-layer.d.ts +0 -27
  185. package/dist/types/react/components/comment-marker-popover.d.ts +0 -12
  186. package/dist/types/react/components/comment-marker.d.ts +0 -15
  187. package/dist/types/react/components/comment-member-list.d.ts +0 -10
  188. package/dist/types/react/components/comment-mode-bar.d.ts +0 -15
  189. package/dist/types/react/components/comment-online-users.d.ts +0 -8
  190. package/dist/types/react/components/comment-page-ref.d.ts +0 -9
  191. package/dist/types/react/components/comment-panel-header.d.ts +0 -22
  192. package/dist/types/react/components/comment-panel-mobile.d.ts +0 -9
  193. package/dist/types/react/components/comment-panel-utils.d.ts +0 -6
  194. package/dist/types/react/components/comment-panel-view-body.d.ts +0 -23
  195. package/dist/types/react/components/comment-panel.d.ts +0 -37
  196. package/dist/types/react/components/comment-quoted-text.d.ts +0 -9
  197. package/dist/types/react/components/comment-reactions.d.ts +0 -11
  198. package/dist/types/react/components/comment-remote-cursor.d.ts +0 -11
  199. package/dist/types/react/components/comment-screenshot-annotator.d.ts +0 -11
  200. package/dist/types/react/components/comment-screenshot-overlay.d.ts +0 -10
  201. package/dist/types/react/components/comment-search-bar.d.ts +0 -7
  202. package/dist/types/react/components/comment-settings-view.d.ts +0 -20
  203. package/dist/types/react/components/comment-skeletons.d.ts +0 -9
  204. package/dist/types/react/components/comment-thread-detail-badges.d.ts +0 -16
  205. package/dist/types/react/components/comment-thread-detail-meta.d.ts +0 -9
  206. package/dist/types/react/components/comment-thread-detail-replies.d.ts +0 -13
  207. package/dist/types/react/components/comment-thread-detail.d.ts +0 -13
  208. package/dist/types/react/components/comment-thread-footer.d.ts +0 -12
  209. package/dist/types/react/components/comment-thread-list-item.d.ts +0 -15
  210. package/dist/types/react/components/comment-thread-list.d.ts +0 -16
  211. package/dist/types/react/components/comment-user-avatar-tooltip.d.ts +0 -12
  212. package/dist/types/react/components/comment-users-context.d.ts +0 -15
  213. package/dist/types/react/components/comment-utils.d.ts +0 -20
  214. package/dist/types/react/components/comment.d.ts +0 -26
  215. package/dist/types/react/components/constants.d.ts +0 -50
  216. package/dist/types/react/components/dev-export-panel.d.ts +0 -10
  217. package/dist/types/react/components/drawing-path-renderer.d.ts +0 -10
  218. package/dist/types/react/components/element-selector.d.ts +0 -11
  219. package/dist/types/react/components/live-region.d.ts +0 -16
  220. package/dist/types/react/components/screenshot-capture.d.ts +0 -17
  221. package/dist/types/react/components/status-indicator.d.ts +0 -43
  222. package/dist/types/react/components/ui.d.ts +0 -44
  223. package/dist/types/react/components/use-comment-composer.d.ts +0 -28
  224. package/dist/types/react/error-boundary.d.ts +0 -25
  225. package/dist/types/react/hooks/use-comment-fab-drag.d.ts +0 -21
  226. package/dist/types/react/hooks/use-comment-hash-link.d.ts +0 -20
  227. package/dist/types/react/hooks/use-comment-kit-filters.d.ts +0 -19
  228. package/dist/types/react/hooks/use-comment-kit-keyboard.d.ts +0 -11
  229. package/dist/types/react/hooks/use-comment-kit-prop-sync.d.ts +0 -12
  230. package/dist/types/react/hooks/use-comment-marker-drag.d.ts +0 -23
  231. package/dist/types/react/hooks/use-comment-panel-navigation.d.ts +0 -21
  232. package/dist/types/react/hooks/use-comment-realtime.d.ts +0 -6
  233. package/dist/types/react/hooks/use-comment-thread-actions.d.ts +0 -15
  234. package/dist/types/react/hooks/use-connection-retry.d.ts +0 -9
  235. package/dist/types/react/hooks/use-drawing.d.ts +0 -32
  236. package/dist/types/react/hooks/use-extension-conflicts.d.ts +0 -13
  237. package/dist/types/react/hooks/use-filtered-threads.d.ts +0 -7
  238. package/dist/types/react/hooks/use-marker-layer.d.ts +0 -19
  239. package/dist/types/react/hooks/use-screenshot.d.ts +0 -18
  240. package/dist/types/react/hooks/use-text-selection.d.ts +0 -17
  241. package/dist/types/react/hooks/use-websocket.d.ts +0 -9
  242. package/dist/types/react/is-local-host.d.ts +0 -2
  243. package/dist/types/react/mount-ui.d.ts +0 -19
  244. package/dist/types/react/shadow-root.d.ts +0 -23
  245. package/dist/types/react/shims/use-sync-external-store-with-selector.d.ts +0 -4
  246. package/dist/types/react/shims/use-sync-external-store.d.ts +0 -1
  247. package/dist/types/react/ui/lib/ShadowRootContext.d.ts +0 -10
  248. package/dist/types/react/ui/lib/cn.d.ts +0 -12
  249. package/dist/types/react/ui/lib/widget-theme.d.ts +0 -7
  250. package/dist/types/react/ui/primitives/alert/alert.d.ts +0 -8
  251. package/dist/types/react/ui/primitives/alert/index.d.ts +0 -1
  252. package/dist/types/react/ui/primitives/alert-dialog/alert-dialog.d.ts +0 -23
  253. package/dist/types/react/ui/primitives/alert-dialog/index.d.ts +0 -1
  254. package/dist/types/react/ui/primitives/avatar/avatar.d.ts +0 -10
  255. package/dist/types/react/ui/primitives/avatar/index.d.ts +0 -1
  256. package/dist/types/react/ui/primitives/badge/badge.d.ts +0 -5
  257. package/dist/types/react/ui/primitives/badge/index.d.ts +0 -1
  258. package/dist/types/react/ui/primitives/breadcrumb/breadcrumb.d.ts +0 -10
  259. package/dist/types/react/ui/primitives/breadcrumb/index.d.ts +0 -1
  260. package/dist/types/react/ui/primitives/button/button.d.ts +0 -6
  261. package/dist/types/react/ui/primitives/button/index.d.ts +0 -1
  262. package/dist/types/react/ui/primitives/button-group/button-group.d.ts +0 -9
  263. package/dist/types/react/ui/primitives/button-group/index.d.ts +0 -1
  264. package/dist/types/react/ui/primitives/card/card.d.ts +0 -11
  265. package/dist/types/react/ui/primitives/card/index.d.ts +0 -1
  266. package/dist/types/react/ui/primitives/checkbox/checkbox.d.ts +0 -3
  267. package/dist/types/react/ui/primitives/checkbox/index.d.ts +0 -1
  268. package/dist/types/react/ui/primitives/dialog/dialog.d.ts +0 -17
  269. package/dist/types/react/ui/primitives/dialog/index.d.ts +0 -1
  270. package/dist/types/react/ui/primitives/dropdown-menu/dropdown-menu.d.ts +0 -29
  271. package/dist/types/react/ui/primitives/dropdown-menu/index.d.ts +0 -1
  272. package/dist/types/react/ui/primitives/empty/empty.d.ts +0 -10
  273. package/dist/types/react/ui/primitives/empty/index.d.ts +0 -1
  274. package/dist/types/react/ui/primitives/field/field.d.ts +0 -22
  275. package/dist/types/react/ui/primitives/field/index.d.ts +0 -1
  276. package/dist/types/react/ui/primitives/hover-card/hover-card.d.ts +0 -6
  277. package/dist/types/react/ui/primitives/hover-card/index.d.ts +0 -1
  278. package/dist/types/react/ui/primitives/input/index.d.ts +0 -1
  279. package/dist/types/react/ui/primitives/input/input.d.ts +0 -3
  280. package/dist/types/react/ui/primitives/input-group/index.d.ts +0 -1
  281. package/dist/types/react/ui/primitives/input-group/input-group.d.ts +0 -16
  282. package/dist/types/react/ui/primitives/input-otp/index.d.ts +0 -1
  283. package/dist/types/react/ui/primitives/input-otp/input-otp.d.ts +0 -11
  284. package/dist/types/react/ui/primitives/kbd/index.d.ts +0 -1
  285. package/dist/types/react/ui/primitives/kbd/kbd.d.ts +0 -4
  286. package/dist/types/react/ui/primitives/label/index.d.ts +0 -1
  287. package/dist/types/react/ui/primitives/label/label.d.ts +0 -3
  288. package/dist/types/react/ui/primitives/native-select/index.d.ts +0 -1
  289. package/dist/types/react/ui/primitives/native-select/native-select.d.ts +0 -7
  290. package/dist/types/react/ui/primitives/popover/index.d.ts +0 -1
  291. package/dist/types/react/ui/primitives/popover/popover.d.ts +0 -9
  292. package/dist/types/react/ui/primitives/preview/component-preview.d.ts +0 -8
  293. package/dist/types/react/ui/primitives/progress/index.d.ts +0 -1
  294. package/dist/types/react/ui/primitives/progress/progress.d.ts +0 -7
  295. package/dist/types/react/ui/primitives/radio-group/index.d.ts +0 -1
  296. package/dist/types/react/ui/primitives/radio-group/radio-group.d.ts +0 -6
  297. package/dist/types/react/ui/primitives/scroll-area/index.d.ts +0 -1
  298. package/dist/types/react/ui/primitives/scroll-area/scroll-area.d.ts +0 -6
  299. package/dist/types/react/ui/primitives/select/index.d.ts +0 -1
  300. package/dist/types/react/ui/primitives/select/select.d.ts +0 -15
  301. package/dist/types/react/ui/primitives/separator/index.d.ts +0 -1
  302. package/dist/types/react/ui/primitives/separator/separator.d.ts +0 -3
  303. package/dist/types/react/ui/primitives/sheet/index.d.ts +0 -1
  304. package/dist/types/react/ui/primitives/sheet/sheet.d.ts +0 -14
  305. package/dist/types/react/ui/primitives/skeleton/index.d.ts +0 -1
  306. package/dist/types/react/ui/primitives/skeleton/skeleton.d.ts +0 -3
  307. package/dist/types/react/ui/primitives/slider/index.d.ts +0 -1
  308. package/dist/types/react/ui/primitives/slider/slider.d.ts +0 -7
  309. package/dist/types/react/ui/primitives/sonner/index.d.ts +0 -1
  310. package/dist/types/react/ui/primitives/sonner/sonner.d.ts +0 -4
  311. package/dist/types/react/ui/primitives/spinner/index.d.ts +0 -1
  312. package/dist/types/react/ui/primitives/spinner/spinner.d.ts +0 -3
  313. package/dist/types/react/ui/primitives/switch/index.d.ts +0 -1
  314. package/dist/types/react/ui/primitives/switch/switch.d.ts +0 -5
  315. package/dist/types/react/ui/primitives/tabs/index.d.ts +0 -1
  316. package/dist/types/react/ui/primitives/tabs/tabs.d.ts +0 -8
  317. package/dist/types/react/ui/primitives/textarea/index.d.ts +0 -1
  318. package/dist/types/react/ui/primitives/textarea/textarea.d.ts +0 -3
  319. package/dist/types/react/ui/primitives/toggle/index.d.ts +0 -1
  320. package/dist/types/react/ui/primitives/toggle/toggle.d.ts +0 -7
  321. package/dist/types/react/ui/primitives/toggle-group/index.d.ts +0 -1
  322. package/dist/types/react/ui/primitives/toggle-group/toggle-group.d.ts +0 -14
  323. package/dist/types/react/ui/primitives/tooltip/index.d.ts +0 -1
  324. package/dist/types/react/ui/primitives/tooltip/tooltip.d.ts +0 -7
  325. package/dist/types/utils/freeze-animations.d.ts +0 -8
  326. package/dist/types/utils/text.d.ts +0 -9
  327. package/dist/types/utils/validation.d.ts +0 -10
  328. package/dist/vue/chunk-DHrubWSL.js +0 -11
  329. package/dist/vue/comment-kit-ui-C3zijClM.js +0 -24898
  330. package/dist/vue/dom-C7krZAR8.js +0 -104
  331. package/dist/vue/error-boundary-DW6uGR8U.js +0 -21
  332. package/dist/vue/limits-B6csdQeI.js +0 -71
  333. package/dist/vue/mount-ui-18BnLwCO.js +0 -72
  334. package/dist/vue/pusher-cmjNbW6a.js +0 -2504
  335. package/dist/vue/realtime-B0B5cE-E.js +0 -567
  336. package/dist/vue/shadow-root-zwd_wUIP.js +0 -93
  337. package/dist/vue/styles-B0NAkbKu.js +0 -2
  338. package/dist/vue/widget-theme-D7Vkagk7.js +0 -24
  339. /package/dist/{angular/error-boundary-CxhCm8iF.js → shared/error-boundary-D3PD74vI.js} +0 -0
@@ -0,0 +1,858 @@
1
+ import { a as e, i as t, m as n, n as r, o as i } from "./dom-Bhf4WFtY.js";
2
+ import { n as a } from "./dist-De294MVF.js";
3
+ import { t as o } from "./button-By0hGrJK.js";
4
+ import { t as s } from "./createReactComponent-BZHeRbD0.js";
5
+ import { R as c, n as ee, y as te } from "./comment-kit-ui-CzfdAZs2.js";
6
+ import * as l from "react";
7
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
8
+ var ne = s("outline", "paperclip", "Paperclip", [["path", {
9
+ d: "M15 7l-6.5 6.5a1.5 1.5 0 0 0 3 3l6.5 -6.5a3 3 0 0 0 -6 -6l-6.5 6.5a4.5 4.5 0 0 0 9 9l6.5 -6.5",
10
+ key: "svg-0"
11
+ }]]), re = s("outline", "x", "X", [["path", {
12
+ d: "M18 6l-12 12",
13
+ key: "svg-0"
14
+ }], ["path", {
15
+ d: "M6 6l12 12",
16
+ key: "svg-1"
17
+ }]]), p = ".ck-element-selector{z-index:calc(var(--z-ck-fab) - 1);pointer-events:none;position:fixed;inset:0}.ck-element-selector-outline,.ck-element-selector-mark{pointer-events:none;border-radius:4px;position:fixed}.ck-element-selector-outline{z-index:calc(var(--z-ck-fab) - 1);border:2px solid var(--primary);background-color:color-mix(in oklch, var(--primary) 8%, transparent);box-shadow:0 0 0 1px color-mix(in oklch, var(--background) 95%, transparent), 0 0 0 4px color-mix(in oklch, var(--primary) 18%, transparent)}.ck-element-selector-outline[data-state=selected]{background-color:color-mix(in oklch, var(--primary) 12%, transparent);border-style:solid}.ck-element-selector-outline[data-state=multi]{border-style:dashed;border-color:color-mix(in oklch, var(--primary) 70%, var(--foreground));background-color:color-mix(in oklch, var(--primary) 6%, transparent)}.ck-element-selector-outline[data-state=multi]:before{content:attr(data-multi-index);top:-10px;background:var(--primary);min-width:20px;height:20px;color:var(--primary-foreground,white);text-align:center;border-radius:999px;padding:0 6px;font:600 11px/20px ui-monospace,SF Mono,Menlo,monospace;position:absolute;inset-inline-start:-10px;box-shadow:0 1px 3px #00000040}.ck-element-selector-multibar{bottom:24px;z-index:calc(var(--z-ck-fab) + 1);border:1px solid var(--border);background-color:var(--popover);color:var(--popover-foreground);box-shadow:0 18px 30px -12px #00000047, 0 0 0 1px color-mix(in oklch, var(--foreground) 8%, transparent);pointer-events:auto;border-radius:999px;align-items:center;gap:8px;padding:6px 10px;font:13px/1 system-ui,sans-serif;display:inline-flex;position:fixed;inset-inline-start:50%;transform:translate(-50%)}.ck-element-selector-multibar-count{color:var(--popover-foreground);padding:0 4px}.ck-element-selector-marquee{z-index:calc(var(--z-ck-fab) - 1);border:1px dashed var(--primary);background-color:color-mix(in oklch, var(--primary) 12%, transparent);pointer-events:none;border-radius:4px;position:fixed}.ck-element-selector-context-menu{z-index:calc(var(--z-ck-fab) + 2);border:1px solid var(--border);background-color:var(--popover);min-width:200px;color:var(--popover-foreground);box-shadow:0 18px 30px -12px #0000004d, 0 0 0 1px color-mix(in oklch, var(--foreground) 8%, transparent);pointer-events:auto;border-radius:8px;margin:0;padding:4px;font:13px/1 system-ui,sans-serif;list-style:none;position:fixed}.ck-element-selector-context-menu li{list-style:none}.ck-element-selector-context-menu button{width:100%;color:inherit;text-align:left;cursor:pointer;font:inherit;background:0 0;border:0;border-radius:4px;padding:8px 10px}.ck-element-selector-context-menu button:hover,.ck-element-selector-context-menu button:focus-visible{background-color:color-mix(in oklch, var(--primary) 14%, transparent);outline:none}.ck-element-selector-mark{z-index:calc(var(--z-ck-fab) - 2);border:2px solid color-mix(in oklch, var(--primary) 78%, var(--foreground));box-shadow:inset 0 0 0 1px color-mix(in oklch, var(--background) 80%, transparent), 0 0 0 3px color-mix(in oklch, var(--primary) 14%, transparent)}.ck-element-selector-composer{z-index:var(--z-ck-fab);border:1px solid var(--border);background-color:var(--popover);width:min(28rem,100vw - 1rem);color:var(--popover-foreground);box-shadow:0 22px 42px -16px #00000052, 0 0 0 1px color-mix(in oklch, var(--foreground) 8%, transparent);pointer-events:auto;border-radius:8px;align-items:stretch;gap:.625rem;padding:.75rem;display:grid;position:fixed}.ck-element-selector-input-row{min-width:0}.ck-element-selector-composer .ck-input{border-radius:7px;width:100%;min-width:0;min-height:3rem;padding-inline:.875rem;font-size:.875rem;line-height:1.25rem}.ck-element-selector-actions{align-items:center;gap:.5rem;width:100%;display:flex}.ck-element-selector-actions .ck-button{min-height:2.375rem}.ck-element-selector-attach-action{gap:.375rem;margin-inline-end:auto}.ck-element-selector-grab-action{min-width:8.75rem}.ck-element-selector-action-icon{flex:none;width:.95rem;height:.95rem}.ck-element-selector-file-input{clip:rect(0 0 0 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.ck-element-selector-attachment{border:1px solid color-mix(in oklch, var(--border) 80%, transparent);background-color:color-mix(in oklch, var(--muted) 55%, transparent);border-radius:7px;align-items:center;gap:.625rem;width:100%;min-width:0;padding:.5rem;display:flex}.ck-element-selector-attachment-image{object-fit:cover;border-radius:6px;flex:none;width:2.5rem;height:2.5rem}.ck-element-selector-attachment-meta{flex:1;gap:.125rem;min-width:0;display:grid}.ck-element-selector-attachment-name,.ck-element-selector-attachment-path,.ck-element-selector-attachment-size{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.ck-element-selector-attachment-name{color:var(--foreground);font-size:.75rem;font-weight:600;line-height:1rem}.ck-element-selector-attachment-path,.ck-element-selector-attachment-size{color:var(--muted-foreground);font-size:.6875rem;line-height:.875rem}.ck-element-selector-error{width:100%;color:var(--destructive);font-size:.75rem;line-height:1rem}@media (width<=420px){.ck-element-selector-actions{flex-wrap:wrap}.ck-element-selector-attach-action{margin-inline-end:0}.ck-element-selector-save-action,.ck-element-selector-grab-action{flex:auto}}", m = "data-commentkit-freeze", h = "\n*, *::before, *::after {\n animation-play-state: paused !important;\n transition: none !important;\n}\n", g = 0, _ = null, v = [];
18
+ function y() {
19
+ if (_ || typeof document > "u") return;
20
+ let e = document.createElement("style");
21
+ e.setAttribute(m, ""), e.textContent = h, document.head.appendChild(e), _ = e;
22
+ }
23
+ function b() {
24
+ _ &&= (_.remove(), null);
25
+ }
26
+ function x() {
27
+ typeof document < "u" && typeof document.getAnimations == "function" && (v = document.getAnimations().filter((e) => {
28
+ if (e.playState !== "running") return !1;
29
+ try {
30
+ return e.pause(), !0;
31
+ } catch {
32
+ return !1;
33
+ }
34
+ }));
35
+ }
36
+ function S() {
37
+ for (let e of v) try {
38
+ e.play();
39
+ } catch {}
40
+ v = [];
41
+ }
42
+ function ie() {
43
+ g++, g === 1 && (y(), x());
44
+ let e = !1;
45
+ return () => {
46
+ e || (e = !0, g = Math.max(0, g - 1), g === 0 && (b(), S()));
47
+ };
48
+ }
49
+ var C = 448, ae = 236, w = 8, T = .9, E = 1e3, D = 2147483600;
50
+ function O(e) {
51
+ return typeof Element < "u" && e instanceof Element;
52
+ }
53
+ function k() {
54
+ let e = document.activeElement;
55
+ for (; e?.shadowRoot?.activeElement;) e = e.shadowRoot.activeElement;
56
+ return e;
57
+ }
58
+ function oe(e) {
59
+ let t = typeof e.composedPath == "function" ? e.composedPath()[0] ?? e.target : e.target;
60
+ if (!O(t)) return !1;
61
+ let n = t.tagName.toLowerCase();
62
+ return n === "input" || n === "textarea" || n === "select" || t instanceof HTMLElement && t.isContentEditable;
63
+ }
64
+ function A(e) {
65
+ let t = e.getRootNode();
66
+ return !!(e.closest("[data-commentkit], [data-commentkit-host], [data-commentkit-ui], .ck-root") || typeof ShadowRoot < "u" && t instanceof ShadowRoot && t.host.matches("[data-commentkit], [data-commentkit-host], [data-commentkit-ui]"));
67
+ }
68
+ function j(e, t = B(e)) {
69
+ let n = e.tagName.toLowerCase();
70
+ if (n === "html" || n === "body" || A(e) || e.closest("[data-commentkit-ignore], [data-react-grab-ignore]") || !le(t)) return !1;
71
+ let r = window.getComputedStyle(e);
72
+ if (r.display === "none" || r.visibility === "hidden") return !1;
73
+ let i = Number.parseFloat(r.opacity || "1");
74
+ if (Number.isFinite(i) && i <= .01) return !1;
75
+ let a = Number.parseInt(r.zIndex || "", 10), o = r.position === "fixed" || r.position === "absolute", s = t.width / Math.max(window.innerWidth, 1) >= T && t.height / Math.max(window.innerHeight, 1) >= T;
76
+ return !(r.pointerEvents === "none" && r.position === "fixed" && Number.isFinite(a) && a >= D || s && o && (r.backgroundColor === "transparent" || r.backgroundColor === "rgba(0, 0, 0, 0)" || Number.isFinite(i) && i < .1 || Number.isFinite(a) && a > E));
77
+ }
78
+ function M(e) {
79
+ return typeof e.composedPath == "function" ? e.composedPath() : e.target ? [e.target] : [];
80
+ }
81
+ function N(e) {
82
+ return M(e).some((e) => O(e) && A(e));
83
+ }
84
+ function P(e, t) {
85
+ if (typeof document.elementsFromPoint == "function") return document.elementsFromPoint(e, t);
86
+ let n = document.elementFromPoint?.(e, t);
87
+ return n ? [n] : [];
88
+ }
89
+ function F(e, t) {
90
+ return P(e, t).find((e) => j(e)) ?? null;
91
+ }
92
+ function se(e) {
93
+ let t = Math.min(e.startX, e.x), n = Math.min(e.startY, e.y), r = Math.abs(e.x - e.startX), i = Math.abs(e.y - e.startY);
94
+ return {
95
+ left: t,
96
+ top: n,
97
+ width: r,
98
+ height: i,
99
+ right: t + r,
100
+ bottom: n + i
101
+ };
102
+ }
103
+ function I(e, t) {
104
+ return !(e.right < t.left || e.left > t.right || e.bottom < t.top || e.top > t.bottom);
105
+ }
106
+ var L = 200, R = 5e3;
107
+ function z(e) {
108
+ let t = window.getComputedStyle(e), n = (e) => e === "hidden" || e === "clip";
109
+ return n(t.overflowX) || n(t.overflowY) || n(t.overflow);
110
+ }
111
+ function ce(e) {
112
+ let t = [];
113
+ if (typeof document > "u") return t;
114
+ let n = 0, r = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT, { acceptNode(r) {
115
+ if (n >= R || t.length >= L) return NodeFilter.FILTER_REJECT;
116
+ n += 1;
117
+ let i = r, a = B(i), o = le(a) && I(a, e);
118
+ return !o && z(i) ? NodeFilter.FILTER_REJECT : o && j(i, a) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
119
+ } }), i = r.nextNode();
120
+ for (; i && (t.push(i), !(t.length >= L || n >= R));) i = r.nextNode();
121
+ return t;
122
+ }
123
+ function B(e) {
124
+ let t = e.getBoundingClientRect();
125
+ return {
126
+ top: t.top,
127
+ left: t.left,
128
+ width: t.width,
129
+ height: t.height,
130
+ bottom: t.bottom,
131
+ right: t.right
132
+ };
133
+ }
134
+ function le(e) {
135
+ return e.width > 0 && e.height > 0;
136
+ }
137
+ function V(n) {
138
+ return {
139
+ element: n,
140
+ selector: t(n),
141
+ xpath: e(n),
142
+ rect: B(n)
143
+ };
144
+ }
145
+ function H(e, t, n) {
146
+ return Math.min(n, Math.max(t, e));
147
+ }
148
+ function U() {
149
+ return {
150
+ width: Math.max(window.innerWidth || 0, 16),
151
+ height: Math.max(window.innerHeight || 0, 16)
152
+ };
153
+ }
154
+ function ue(e) {
155
+ let t = U(), r = H(e.rect.left + e.rect.width / 2, 0, t.width), i = H(e.rect.top + e.rect.height / 2, 0, t.height);
156
+ return {
157
+ ...n(r, i, t),
158
+ element: e.selector,
159
+ xpath: e.xpath
160
+ };
161
+ }
162
+ function de(e) {
163
+ return typeof e != "number" || !Number.isFinite(e) ? "" : e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
164
+ }
165
+ function W(e, t) {
166
+ let n = e.path;
167
+ if (typeof n == "string" && n.trim()) return {
168
+ path: n.trim(),
169
+ pathSource: "native"
170
+ };
171
+ if (e.webkitRelativePath) return {
172
+ path: e.webkitRelativePath,
173
+ pathSource: "relative"
174
+ };
175
+ let r = t.value.trim();
176
+ return r && !r.includes("\\fakepath\\") ? {
177
+ path: r,
178
+ pathSource: "native"
179
+ } : {
180
+ path: e.name,
181
+ pathSource: "browser-fallback"
182
+ };
183
+ }
184
+ function fe(e, t) {
185
+ let { path: n, pathSource: r } = W(e, t);
186
+ return {
187
+ name: e.name,
188
+ path: n,
189
+ pathSource: r,
190
+ type: e.type || "application/octet-stream",
191
+ size: e.size,
192
+ lastModified: e.lastModified,
193
+ previewUrl: e.type.startsWith("image/") && typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : null
194
+ };
195
+ }
196
+ function G(e) {
197
+ e && typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL(e);
198
+ }
199
+ async function pe(e, t) {
200
+ try {
201
+ if (!navigator.clipboard?.writeText) throw Error("clipboard unavailable");
202
+ await navigator.clipboard.writeText(e);
203
+ try {
204
+ a.success(`${t} copied`);
205
+ } catch {}
206
+ } catch {
207
+ try {
208
+ a.error(`Could not copy ${t.toLowerCase()}`);
209
+ } catch {}
210
+ }
211
+ }
212
+ function K(e) {
213
+ return {
214
+ top: e.top,
215
+ left: e.left,
216
+ width: e.width,
217
+ height: e.height
218
+ };
219
+ }
220
+ function me(e, t = ae) {
221
+ let n = U(), r = Math.max(w, n.width - C - w), i = H(e.left, w, r), a = e.bottom + w, o = e.top - t - w;
222
+ return {
223
+ left: i,
224
+ top: a + t <= n.height - w ? a : H(o, w, n.height - t - w)
225
+ };
226
+ }
227
+ var he = 220, ge = 200;
228
+ function _e(e) {
229
+ let t = U();
230
+ return {
231
+ left: H(e.x, w, Math.max(w, t.width - he - w)),
232
+ top: H(e.y, w, Math.max(w, t.height - ge - w))
233
+ };
234
+ }
235
+ function ve(e) {
236
+ return e.status === "open" && !!(e.position.element || e.position.xpath);
237
+ }
238
+ function ye(e) {
239
+ return e.flatMap((e) => {
240
+ if (!ve(e)) return [];
241
+ let t = r(e.position.element ?? "", e.position.xpath);
242
+ if (!t) return [];
243
+ let n = B(t);
244
+ return j(t, n) ? [{
245
+ id: e.id,
246
+ rect: n
247
+ }] : [];
248
+ });
249
+ }
250
+ function be(e) {
251
+ let [t, n] = l.useState(0);
252
+ return l.useEffect(() => {
253
+ if (!e) return;
254
+ let t = 0, r = () => {
255
+ t ||= window.requestAnimationFrame(() => {
256
+ t = 0, n((e) => e + 1);
257
+ });
258
+ };
259
+ window.addEventListener("scroll", r, !0), window.addEventListener("resize", r);
260
+ let i = typeof MutationObserver < "u" ? new MutationObserver(r) : null;
261
+ return i?.observe(document.body, {
262
+ childList: !0,
263
+ subtree: !0,
264
+ attributes: !0,
265
+ attributeFilter: [
266
+ "class",
267
+ "style",
268
+ "hidden",
269
+ "data-state"
270
+ ]
271
+ }), () => {
272
+ t && window.cancelAnimationFrame(t), window.removeEventListener("scroll", r, !0), window.removeEventListener("resize", r), i?.disconnect();
273
+ };
274
+ }, [e]), t;
275
+ }
276
+ var xe = l.memo(function({ core: n, state: r, active: a }) {
277
+ let s = c(), [p, m] = l.useState(null), [h, g] = l.useState(null), [_, v] = l.useState([]), [y, b] = l.useState(null), [x, S] = l.useState(null), [C, w] = l.useState(""), [T, E] = l.useState(null), [D, O] = l.useState(!1), [A, j] = l.useState(!1), [M, P] = l.useState(null), I = l.useRef(null), L = l.useRef(null), R = l.useRef(null), z = l.useRef(null), [le, H] = l.useState(ae), U = i().path, W = l.useMemo(() => r.comments.filter((e) => e.page?.path === U), [r.comments, U]), he = W.some(ve), ge = be(a || he || !!h || _.length > 0), xe = l.useRef(null), q = l.useRef([]), Se = l.useRef(""), Ce = l.useRef(null);
278
+ l.useEffect(() => {
279
+ xe.current = h?.element ?? p?.element ?? null;
280
+ }, [p, h]), l.useEffect(() => {
281
+ q.current = _;
282
+ }, [_]), l.useEffect(() => {
283
+ Se.current = C;
284
+ }, [C]), l.useEffect(() => {
285
+ Ce.current = T;
286
+ }, [T]);
287
+ let we = l.useMemo(() => ye(W), [W, ge]);
288
+ l.useEffect(() => {
289
+ a || (m(null), g(null), v([]), S(null), w(""), E((e) => (G(e?.previewUrl), null)), O(!1), P(null), b(null), Z.current = null, Q.current = !1);
290
+ }, [a]), l.useEffect(() => () => {
291
+ G(Ce.current?.previewUrl);
292
+ }, []), l.useEffect(() => {
293
+ if (!a) return;
294
+ let e = document.body.style.cursor;
295
+ document.body.style.cursor = "crosshair";
296
+ let t = ie();
297
+ return () => {
298
+ document.body.style.cursor = e, t();
299
+ };
300
+ }, [a]);
301
+ let J = a && !!h;
302
+ l.useEffect(() => {
303
+ if (!J) return;
304
+ let e = k();
305
+ return e instanceof HTMLElement && !I.current?.contains(e) && (z.current = e), I.current?.querySelector("[data-ck-composer-input]")?.focus({ preventScroll: !0 }), () => {
306
+ let e = z.current;
307
+ z.current = null, e && e.isConnected && e.focus({ preventScroll: !0 });
308
+ };
309
+ }, [J]);
310
+ let Te = l.useRef(r.isAuthenticated);
311
+ l.useEffect(() => {
312
+ let e = !Te.current && r.isAuthenticated;
313
+ if (Te.current = r.isAuthenticated, !e || !J || !C.trim()) return;
314
+ let t = I.current?.querySelector("[data-ck-composer-input]");
315
+ t?.focus({ preventScroll: !0 });
316
+ let n = t?.value.length ?? 0;
317
+ t?.setSelectionRange?.(n, n), P((e) => e && e.startsWith("Sign in to save comments") ? null : e);
318
+ }, [
319
+ r.isAuthenticated,
320
+ J,
321
+ C
322
+ ]), l.useLayoutEffect(() => {
323
+ if (!J) return;
324
+ let e = I.current;
325
+ if (!e) return;
326
+ let t = () => {
327
+ let t = e.getBoundingClientRect().height;
328
+ t > 0 && H((e) => Math.abs(e - t) > 1 ? t : e);
329
+ };
330
+ t();
331
+ let n = null;
332
+ try {
333
+ typeof ResizeObserver < "u" && (n = new ResizeObserver(t), n.observe(e));
334
+ } catch {
335
+ n = null;
336
+ }
337
+ return () => n?.disconnect();
338
+ }, [
339
+ J,
340
+ T,
341
+ M
342
+ ]), l.useEffect(() => {
343
+ if (!a) return;
344
+ let e = () => {
345
+ g((e) => e && {
346
+ ...e,
347
+ rect: B(e.element)
348
+ }), m((e) => e && {
349
+ ...e,
350
+ rect: B(e.element)
351
+ }), v((e) => e.map((e) => ({
352
+ ...e,
353
+ rect: B(e.element)
354
+ })));
355
+ };
356
+ return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
357
+ window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
358
+ };
359
+ }, [a]);
360
+ let Y = l.useCallback(async (e, t, r) => {
361
+ if (!e || A) return !1;
362
+ j(!0), P(null);
363
+ try {
364
+ let i = t?.trim(), a = r ? [{
365
+ name: r.name,
366
+ path: r.path,
367
+ pathSource: r.pathSource,
368
+ type: r.type,
369
+ size: r.size,
370
+ lastModified: r.lastModified
371
+ }] : [], o = i || a.length > 0 ? {
372
+ ...i ? { comment: i } : {},
373
+ ...a.length > 0 ? { attachments: a } : {}
374
+ } : void 0, s = o ? await n.grabElement(e, o) : await n.grabElement(e);
375
+ return j(!1), s ? (g(null), m(null), w(""), E((e) => (G(e?.previewUrl), null)), n.setTool(null), !0) : (P("Could not grab this element."), !1);
376
+ } catch {
377
+ return j(!1), P("Could not copy this element for the agent."), !1;
378
+ }
379
+ }, [n, A]), X = l.useCallback(async (e) => {
380
+ if (e.length === 0 || A) return !1;
381
+ j(!0), P(null);
382
+ try {
383
+ let t = await n.grabElements(e);
384
+ return j(!1), t ? (v([]), g(null), m(null), w(""), E((e) => (G(e?.previewUrl), null)), n.setTool(null), !0) : (P("Could not grab these elements."), !1);
385
+ } catch {
386
+ return j(!1), P("Could not copy these elements for the agent."), !1;
387
+ }
388
+ }, [n, A]), Ee = l.useCallback(() => {
389
+ let e = q.current.map((e) => e.element);
390
+ X(e);
391
+ }, [X]), De = l.useCallback(() => {
392
+ v([]);
393
+ }, []), Z = l.useRef(null), Q = l.useRef(!1), $ = l.useRef(null);
394
+ $.current = y;
395
+ let Oe = l.useRef(null);
396
+ Oe.current = x, l.useEffect(() => {
397
+ if (!x) return;
398
+ let e = n.blockEscape();
399
+ return () => e();
400
+ }, [x, n]), l.useEffect(() => {
401
+ if (!x) return;
402
+ let e = k();
403
+ return e instanceof HTMLElement && !R.current?.contains(e) && (z.current = e), R.current?.querySelector("[role=\"menuitem\"]")?.focus({ preventScroll: !0 }), () => {
404
+ let e = z.current;
405
+ z.current = null, e && e.isConnected && e.focus({ preventScroll: !0 });
406
+ };
407
+ }, [x]);
408
+ let ke = l.useCallback((e) => {
409
+ let t = R.current;
410
+ if (!t) return;
411
+ let n = Array.from(t.querySelectorAll("[role=\"menuitem\"]"));
412
+ if (n.length === 0) return;
413
+ let r = k(), i = n.findIndex((e) => e === r), a = (e) => {
414
+ n[(e + n.length) % n.length]?.focus({ preventScroll: !0 });
415
+ };
416
+ switch (e.key) {
417
+ case "ArrowDown":
418
+ e.preventDefault(), e.stopPropagation(), a(i < 0 ? 0 : i + 1);
419
+ break;
420
+ case "ArrowUp":
421
+ e.preventDefault(), e.stopPropagation(), a(i < 0 ? n.length - 1 : i - 1);
422
+ break;
423
+ case "Home":
424
+ e.preventDefault(), e.stopPropagation(), a(0);
425
+ break;
426
+ case "End":
427
+ e.preventDefault(), e.stopPropagation(), a(n.length - 1);
428
+ break;
429
+ case "Enter":
430
+ case " ": e.preventDefault(), e.stopPropagation(), k()?.click();
431
+ }
432
+ }, []);
433
+ l.useEffect(() => {
434
+ if (!a) return;
435
+ let r = (e) => {
436
+ e.button !== 0 || N(e) || h || (S(null), Z.current = {
437
+ x: e.clientX,
438
+ y: e.clientY
439
+ }, Q.current = !1);
440
+ }, i = (n) => {
441
+ if (N(n)) return;
442
+ let r = F(n.clientX, n.clientY);
443
+ r && (n.preventDefault(), n.stopPropagation(), S({
444
+ element: r,
445
+ selector: t(r),
446
+ xpath: e(r),
447
+ x: n.clientX,
448
+ y: n.clientY
449
+ }));
450
+ }, o = null, s = null, c = () => {
451
+ o &&= (clearTimeout(o), null), s = null;
452
+ }, ee = (n) => {
453
+ if (N(n) || n.touches.length !== 1) return;
454
+ let r = n.touches[0];
455
+ if (!r) return;
456
+ let i = F(r.clientX, r.clientY);
457
+ i && (s = {
458
+ x: r.clientX,
459
+ y: r.clientY,
460
+ element: i
461
+ }, o = setTimeout(() => {
462
+ s && (S({
463
+ element: s.element,
464
+ selector: t(s.element),
465
+ xpath: e(s.element),
466
+ x: s.x,
467
+ y: s.y
468
+ }), s = null, o = null);
469
+ }, 550));
470
+ }, te = (e) => {
471
+ if (!s || e.touches.length !== 1) return;
472
+ let t = e.touches[0];
473
+ if (!t) return;
474
+ let n = t.clientX - s.x, r = t.clientY - s.y;
475
+ (Math.abs(n) > 10 || Math.abs(r) > 10) && c();
476
+ }, l = () => {
477
+ c();
478
+ }, u = (e) => {
479
+ if (N(e)) return;
480
+ let t = Z.current;
481
+ if (t) {
482
+ if (e.pointerType === "mouse" && !(e.buttons & 1)) Z.current = null, Q.current = !1, b(null);
483
+ else {
484
+ let n = e.clientX - t.x, r = e.clientY - t.y;
485
+ if ($.current || Math.abs(n) > 6 || Math.abs(r) > 6) {
486
+ Q.current = !0, b({
487
+ startX: t.x,
488
+ startY: t.y,
489
+ x: e.clientX,
490
+ y: e.clientY
491
+ }), m(null);
492
+ return;
493
+ }
494
+ }
495
+ }
496
+ if (h) return;
497
+ let n = F(e.clientX, e.clientY);
498
+ m(n ? V(n) : null);
499
+ }, d = () => {
500
+ Z.current = null, Q.current = !1, b(null);
501
+ }, f = (e) => {
502
+ let t = Z.current;
503
+ Z.current = null;
504
+ let n = $.current;
505
+ if (!t || !n) return;
506
+ let r = se({
507
+ ...n,
508
+ x: e.clientX,
509
+ y: e.clientY
510
+ });
511
+ if (r.width < 6 || r.height < 6) {
512
+ b(null);
513
+ return;
514
+ }
515
+ let i = ce(r);
516
+ if (i.length > 0) {
517
+ let e = i.map(V);
518
+ v((t) => {
519
+ let n = new Set(t.map((e) => e.element)), r = [...t];
520
+ for (let t of e) n.has(t.element) || r.push(t);
521
+ return r;
522
+ });
523
+ }
524
+ b(null);
525
+ }, ne = (e) => {
526
+ if (N(e)) return;
527
+ if (Q.current) {
528
+ Q.current = !1, e.preventDefault(), e.stopPropagation();
529
+ return;
530
+ }
531
+ e.preventDefault(), e.stopPropagation();
532
+ let t = F(e.clientX, e.clientY);
533
+ h && !e.shiftKey ? (g(null), m(null), w(""), E((e) => (G(e?.previewUrl), null)), P(null)) : t && (e.shiftKey ? (v((e) => e.some((e) => e.element === t) ? e.filter((e) => e.element !== t) : [...h && !e.some((e) => e.element === h.element) ? [...e, h] : e, V(t)]), m(null), g(null), w(""), E((e) => (G(e?.previewUrl), null)), P(null)) : (g(V(t)), m(null), w(""), E((e) => (G(e?.previewUrl), null)), P(null)));
534
+ }, re = (e) => {
535
+ if (e.key === "Escape") {
536
+ if (e.isComposing) return;
537
+ if (Oe.current) {
538
+ e.preventDefault(), e.stopPropagation(), S(null);
539
+ return;
540
+ }
541
+ e.preventDefault(), e.stopPropagation(), g(null), m(null), w(""), E((e) => (G(e?.previewUrl), null)), P(null), n.setTool(null);
542
+ return;
543
+ }
544
+ if (!e.metaKey && !e.ctrlKey || e.shiftKey || e.altKey || e.key !== "c" && e.key !== "C" && e.code !== "KeyC" || oe(e)) return;
545
+ let t = typeof window < "u" ? window.getSelection() : null;
546
+ if (t && !t.isCollapsed && t.toString().length > 0) return;
547
+ let r = q.current;
548
+ if (r.length > 0) {
549
+ e.preventDefault(), e.stopPropagation(), X(r.map((e) => e.element));
550
+ return;
551
+ }
552
+ let i = xe.current;
553
+ if (!i) return;
554
+ e.preventDefault(), e.stopPropagation();
555
+ let a = h?.element === i;
556
+ Y(i, a ? Se.current : void 0, a ? Ce.current : null);
557
+ };
558
+ return document.addEventListener("pointerdown", r, !0), document.addEventListener("pointermove", u, !0), document.addEventListener("pointerup", f, !0), document.addEventListener("pointercancel", d, !0), document.addEventListener("click", ne, !0), document.addEventListener("contextmenu", i, !0), document.addEventListener("touchstart", ee, {
559
+ capture: !0,
560
+ passive: !0
561
+ }), document.addEventListener("touchmove", te, {
562
+ capture: !0,
563
+ passive: !0
564
+ }), document.addEventListener("touchend", l, {
565
+ capture: !0,
566
+ passive: !0
567
+ }), document.addEventListener("touchcancel", l, {
568
+ capture: !0,
569
+ passive: !0
570
+ }), window.addEventListener("keydown", re, !0), () => {
571
+ document.removeEventListener("pointerdown", r, !0), document.removeEventListener("pointermove", u, !0), document.removeEventListener("pointerup", f, !0), document.removeEventListener("pointercancel", d, !0), document.removeEventListener("click", ne, !0), document.removeEventListener("contextmenu", i, !0), document.removeEventListener("touchstart", ee, !0), document.removeEventListener("touchmove", te, !0), document.removeEventListener("touchend", l, !0), document.removeEventListener("touchcancel", l, !0), window.removeEventListener("keydown", re, !0), c();
572
+ };
573
+ }, [
574
+ a,
575
+ n,
576
+ Y,
577
+ X,
578
+ h
579
+ ]);
580
+ let Ae = l.useCallback(async (e) => {
581
+ e.preventDefault();
582
+ let t = C.trim();
583
+ if (h && t && !D) {
584
+ if (!r.currentUser) P("Sign in to save comments. You can still use Grab for agent without signing in."), n.toggleLoginModal();
585
+ else {
586
+ O(!0), P(null);
587
+ try {
588
+ await n.createComment("pin", t, ue(h)), O(!1), g(null), w(""), E((e) => (G(e?.previewUrl), null)), n.setTool(null);
589
+ } catch {
590
+ O(!1), P("Could not save this comment. Try again.");
591
+ }
592
+ }
593
+ }
594
+ }, [
595
+ C,
596
+ n,
597
+ D,
598
+ h,
599
+ r.currentUser
600
+ ]), je = l.useCallback(() => {
601
+ Y(h?.element ?? null, C, T);
602
+ }, [
603
+ T,
604
+ C,
605
+ Y,
606
+ h
607
+ ]), Me = l.useCallback(() => {
608
+ L.current?.click();
609
+ }, []), Ne = l.useCallback((e) => {
610
+ let t = e.currentTarget, n = t.files?.[0] ?? null;
611
+ E((e) => (G(e?.previewUrl), n ? fe(n, t) : null)), t.value = "";
612
+ }, []), Pe = l.useCallback(() => {
613
+ E((e) => (G(e?.previewUrl), null));
614
+ }, []), Fe = l.useMemo(() => ee(), []);
615
+ return !a && we.length === 0 ? null : /* @__PURE__ */ f("div", {
616
+ className: "ck-element-selector",
617
+ "data-testid": "ck-element-selector",
618
+ children: [
619
+ we.map((e) => /* @__PURE__ */ d("div", {
620
+ "aria-hidden": "true",
621
+ className: "ck-element-selector-mark",
622
+ "data-comment-id": e.id,
623
+ style: K(e.rect)
624
+ }, e.id)),
625
+ a && p && !y && /* @__PURE__ */ d("div", {
626
+ "aria-hidden": "true",
627
+ className: "ck-element-selector-outline",
628
+ "data-state": "hover",
629
+ style: K(p.rect)
630
+ }),
631
+ a && y && /* @__PURE__ */ d("div", {
632
+ "aria-hidden": "true",
633
+ className: "ck-element-selector-marquee",
634
+ "data-testid": "ck-element-selector-marquee",
635
+ style: {
636
+ left: Math.min(y.startX, y.x),
637
+ top: Math.min(y.startY, y.y),
638
+ width: Math.abs(y.x - y.startX),
639
+ height: Math.abs(y.y - y.startY)
640
+ }
641
+ }),
642
+ a && _.map((e, t) => /* @__PURE__ */ d("div", {
643
+ "aria-hidden": "true",
644
+ className: "ck-element-selector-outline",
645
+ "data-state": "multi",
646
+ "data-multi-index": t + 1,
647
+ style: K(e.rect)
648
+ }, `multi-${t}-${e.selector}-${e.xpath}`)),
649
+ a && x && /* @__PURE__ */ f("ul", {
650
+ ref: R,
651
+ className: "ck-element-selector-context-menu",
652
+ "data-testid": "ck-element-selector-context-menu",
653
+ role: "menu",
654
+ "aria-label": "Element actions",
655
+ onKeyDown: ke,
656
+ style: _e(x),
657
+ children: [
658
+ /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d("button", {
659
+ type: "button",
660
+ role: "menuitem",
661
+ "data-testid": "ck-context-menu-grab",
662
+ onClick: () => {
663
+ let e = x.element;
664
+ S(null), Y(e);
665
+ },
666
+ children: "Grab for agent"
667
+ }) }),
668
+ /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d("button", {
669
+ type: "button",
670
+ role: "menuitem",
671
+ "data-testid": "ck-context-menu-comment",
672
+ onClick: () => {
673
+ let e = V(x.element);
674
+ S(null), g(e);
675
+ },
676
+ children: "Add comment"
677
+ }) }),
678
+ /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d("button", {
679
+ type: "button",
680
+ role: "menuitem",
681
+ "data-testid": "ck-context-menu-copy-selector",
682
+ onClick: () => {
683
+ let e = x.selector;
684
+ S(null), pe(e, "CSS selector");
685
+ },
686
+ children: "Copy CSS selector"
687
+ }) }),
688
+ /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d("button", {
689
+ type: "button",
690
+ role: "menuitem",
691
+ "data-testid": "ck-context-menu-copy-xpath",
692
+ onClick: () => {
693
+ let e = x.xpath;
694
+ S(null), pe(e, "XPath");
695
+ },
696
+ children: "Copy XPath"
697
+ }) }),
698
+ /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d("button", {
699
+ type: "button",
700
+ role: "menuitem",
701
+ "data-testid": "ck-context-menu-inspect",
702
+ onClick: () => {
703
+ console.log("[CommentKit] inspect", x.element), S(null);
704
+ },
705
+ children: "Inspect (log to console)"
706
+ }) })
707
+ ]
708
+ }),
709
+ a && _.length > 0 && /* @__PURE__ */ f("div", {
710
+ className: "ck-element-selector-multibar",
711
+ "data-testid": "ck-element-selector-multibar",
712
+ children: [
713
+ /* @__PURE__ */ f("span", {
714
+ className: "ck-element-selector-multibar-count",
715
+ children: [_.length, " selected"]
716
+ }),
717
+ /* @__PURE__ */ d(o, {
718
+ type: "button",
719
+ size: "sm",
720
+ onClick: Ee,
721
+ disabled: A,
722
+ "data-testid": "ck-element-grab-many-button",
723
+ children: A ? "Grabbing…" : `Grab ${_.length} for agent`
724
+ }),
725
+ /* @__PURE__ */ d(o, {
726
+ type: "button",
727
+ size: "sm",
728
+ variant: "ghost",
729
+ onClick: De,
730
+ disabled: A,
731
+ "data-testid": "ck-element-grab-clear-button",
732
+ children: "Clear"
733
+ })
734
+ ]
735
+ }),
736
+ a && h && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("div", {
737
+ "aria-hidden": "true",
738
+ className: "ck-element-selector-outline",
739
+ "data-state": "selected",
740
+ style: K(h.rect)
741
+ }), /* @__PURE__ */ f("form", {
742
+ ref: I,
743
+ className: "ck-element-selector-composer",
744
+ style: me(h.rect, le),
745
+ onSubmit: Ae,
746
+ children: [
747
+ /* @__PURE__ */ d("div", {
748
+ className: "ck-element-selector-input-row",
749
+ children: /* @__PURE__ */ d(te, {
750
+ "data-ck-composer-input": "",
751
+ "aria-label": "Element comment",
752
+ value: C,
753
+ placeholder: "Add comment",
754
+ disabled: D || A,
755
+ onChange: (e) => {
756
+ w(e.currentTarget.value), M && P(null);
757
+ }
758
+ })
759
+ }),
760
+ !s && /* @__PURE__ */ d("input", {
761
+ ref: L,
762
+ "aria-label": "Attach file",
763
+ className: "ck-element-selector-file-input",
764
+ type: "file",
765
+ onChange: Ne
766
+ }),
767
+ T && /* @__PURE__ */ f("div", {
768
+ className: "ck-element-selector-attachment",
769
+ "data-testid": "ck-element-attachment-preview",
770
+ children: [
771
+ T.previewUrl && /* @__PURE__ */ d("img", {
772
+ alt: "",
773
+ "aria-hidden": "true",
774
+ className: "ck-element-selector-attachment-image",
775
+ src: T.previewUrl
776
+ }),
777
+ /* @__PURE__ */ f("div", {
778
+ className: "ck-element-selector-attachment-meta",
779
+ children: [
780
+ /* @__PURE__ */ d("span", {
781
+ className: "ck-element-selector-attachment-name",
782
+ children: T.name
783
+ }),
784
+ /* @__PURE__ */ d("span", {
785
+ className: "ck-element-selector-attachment-path",
786
+ title: T.path,
787
+ children: T.path
788
+ }),
789
+ /* @__PURE__ */ d("span", {
790
+ className: "ck-element-selector-attachment-size",
791
+ children: de(T.size)
792
+ })
793
+ ]
794
+ }),
795
+ /* @__PURE__ */ d(o, {
796
+ type: "button",
797
+ size: "icon-xs",
798
+ variant: "ghost",
799
+ "aria-label": "Remove attachment",
800
+ disabled: D || A,
801
+ onClick: Pe,
802
+ children: /* @__PURE__ */ d(re, {
803
+ className: "ck-element-selector-action-icon",
804
+ "aria-hidden": "true"
805
+ })
806
+ })
807
+ ]
808
+ }),
809
+ /* @__PURE__ */ f("div", {
810
+ className: "ck-element-selector-actions",
811
+ children: [
812
+ !s && /* @__PURE__ */ f(o, {
813
+ type: "button",
814
+ variant: "outline",
815
+ className: "ck-element-selector-attach-action",
816
+ disabled: D || A,
817
+ onClick: Me,
818
+ "data-testid": "ck-element-attach-button",
819
+ children: [/* @__PURE__ */ d(ne, {
820
+ className: "ck-element-selector-action-icon",
821
+ "aria-hidden": "true"
822
+ }), /* @__PURE__ */ d("span", { children: "Attach" })]
823
+ }),
824
+ /* @__PURE__ */ d(o, {
825
+ type: "submit",
826
+ className: "ck-element-selector-save-action",
827
+ disabled: !C.trim() || D || A,
828
+ children: D ? "Saving" : "Save"
829
+ }),
830
+ /* @__PURE__ */ d(o, {
831
+ type: "button",
832
+ className: "ck-element-selector-grab-action",
833
+ variant: Fe ? "default" : "outline",
834
+ disabled: D || A,
835
+ onClick: je,
836
+ title: s ? "Copy element context to clipboard for your agent" : "Copy element source + screenshot to clipboard for your agent",
837
+ "data-testid": "ck-element-grab-button",
838
+ children: A ? "Grabbing…" : "Grab for agent"
839
+ })
840
+ ]
841
+ }),
842
+ M && /* @__PURE__ */ d("p", {
843
+ className: "ck-element-selector-error",
844
+ role: "alert",
845
+ children: M
846
+ })
847
+ ]
848
+ })] })
849
+ ]
850
+ });
851
+ });
852
+ function q(e) {
853
+ return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("style", {
854
+ "data-ck-tool-styles": "element-selector",
855
+ children: p
856
+ }), /* @__PURE__ */ d(xe, { ...e })] });
857
+ }
858
+ export { q as ElementSelector };