@nice2dev/ui 1.1.10 → 1.2.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 (269) hide show
  1. package/CHANGELOG.md +183 -0
  2. package/README.md +12 -20
  3. package/dist/NiceApiExplorer.doc-CFJndg5h.js +25 -0
  4. package/dist/NiceApiExplorer.doc-TEx67kV5.cjs +1 -0
  5. package/dist/NiceBPMNDesigner.doc-6lK1pXRq.js +32 -0
  6. package/dist/NiceBPMNDesigner.doc-BY8t7qOi.cjs +8 -0
  7. package/dist/NiceBackupDiffViewer.doc-CYvOeX19.js +25 -0
  8. package/dist/NiceBackupDiffViewer.doc-ChQaZCg1.cjs +1 -0
  9. package/dist/NiceBackupList.doc-BdQCw0_D.cjs +1 -0
  10. package/dist/NiceBackupList.doc-BwjIAoqz.js +25 -0
  11. package/dist/NiceBackupRestoreDialog.doc-B2iiqTps.cjs +1 -0
  12. package/dist/NiceBackupRestoreDialog.doc-DuXSGJiD.js +25 -0
  13. package/dist/NiceBackupScheduler.doc-BpY45181.js +31 -0
  14. package/dist/NiceBackupScheduler.doc-ByeL3iH1.cjs +7 -0
  15. package/dist/NiceBackupStatusBadge.doc-BA3dYgiW.cjs +1 -0
  16. package/dist/NiceBackupStatusBadge.doc-CxwkVarP.js +25 -0
  17. package/dist/NiceBackupTagEditor.doc-Bej1KHco.cjs +7 -0
  18. package/dist/NiceBackupTagEditor.doc-CNy4uNws.js +31 -0
  19. package/dist/NiceBottomSheet.doc-keq-Fzlz.cjs +8 -0
  20. package/dist/NiceBottomSheet.doc-v-UPUKQk.js +32 -0
  21. package/dist/NiceBranchManager.doc-BTyRjX7X.cjs +6 -0
  22. package/dist/NiceBranchManager.doc-Cz4SyEqE.js +30 -0
  23. package/dist/NiceButton-3AcJJ15c.cjs +1 -0
  24. package/dist/NiceButton-5tWvfXKl.cjs +1 -0
  25. package/dist/NiceButton-DHSgQT1_.js +112 -0
  26. package/dist/NiceButton-vkI07DP0.js +88 -0
  27. package/dist/NiceCodeEditor-B8At55f5.js +1179 -0
  28. package/dist/NiceCodeEditor-BJSEzhcY.cjs +260 -0
  29. package/dist/NiceCodeEditor-VGIDWSkS.js +1181 -0
  30. package/dist/NiceCodeEditor-qX39PSnQ.cjs +260 -0
  31. package/dist/NiceColorPicker-CQhhjZ8w.cjs +1 -0
  32. package/dist/NiceColorPicker-Cbop7VMu.js +491 -0
  33. package/dist/NiceColorPicker-DCgmE-3H.cjs +1 -0
  34. package/dist/NiceColorPicker-DK30kJgy.js +486 -0
  35. package/dist/NiceColorPicker-DtPFxDKM.cjs +1 -0
  36. package/dist/NiceColorPicker-bNJBAU_c.js +598 -0
  37. package/dist/NiceConnectorConfigForm.doc-BKrDuhXw.cjs +7 -0
  38. package/dist/NiceConnectorConfigForm.doc-BsHeXz3M.js +31 -0
  39. package/dist/NiceDataBranchGraph.doc-Axidz41W.js +29 -0
  40. package/dist/NiceDataBranchGraph.doc-sjLmrrtE.cjs +5 -0
  41. package/dist/NiceDataBranchManager.doc-B1-Rp2X4.cjs +6 -0
  42. package/dist/NiceDataBranchManager.doc-GUqfTFvW.js +30 -0
  43. package/dist/NiceDataConflictResolver.doc-CjQryrTu.cjs +5 -0
  44. package/dist/NiceDataConflictResolver.doc-L-TcnQMX.js +29 -0
  45. package/dist/NiceDataDiffViewer.doc-BzGrf0U-.cjs +6 -0
  46. package/dist/NiceDataDiffViewer.doc-goxhSldH.js +30 -0
  47. package/dist/NiceDataGrid-BDEIbuBS.js +2218 -0
  48. package/dist/NiceDataGrid-BOCJr6XF.js +2217 -0
  49. package/dist/NiceDataGrid-BV5Oh-gy.cjs +10 -0
  50. package/dist/NiceDataGrid-CS5aB-EN.cjs +10 -0
  51. package/dist/NiceDataGrid-Dd7SI-M6.cjs +10 -0
  52. package/dist/NiceDataGrid-DjZchXYG.js +2217 -0
  53. package/dist/NiceDataMapper.doc-QmnmnvVq.js +30 -0
  54. package/dist/NiceDataMapper.doc-ytGVtYVr.cjs +6 -0
  55. package/dist/NiceDataMergeBuilder.doc-BcmzKxh2.cjs +6 -0
  56. package/dist/NiceDataMergeBuilder.doc-BvYa4aUJ.js +30 -0
  57. package/dist/NiceDataSnapshot.doc-C73K1biG.cjs +6 -0
  58. package/dist/NiceDataSnapshot.doc-hU7wnOzM.js +30 -0
  59. package/dist/NiceDesktopViews.doc-DJjYlyP2.cjs +1 -0
  60. package/dist/NiceDesktopViews.doc-ly-VUAJj.js +25 -0
  61. package/dist/NiceDeviceControlCard.doc-BZIo92-w.cjs +1 -0
  62. package/dist/NiceDeviceControlCard.doc-DIzZcW9L.js +25 -0
  63. package/dist/NiceDocumentViewer-B9VIVKyw.js +726 -0
  64. package/dist/NiceDocumentViewer-CDXAmPp7.cjs +180 -0
  65. package/dist/NiceDocumentationViewer.doc-BSNGa7a_.js +25 -0
  66. package/dist/NiceDocumentationViewer.doc-CrwlvPFg.cjs +1 -0
  67. package/dist/NiceEnergyChart.doc-DW-jllDV.cjs +1 -0
  68. package/dist/NiceEnergyChart.doc-DnEehTff.js +25 -0
  69. package/dist/NiceFeatureGate.doc-DN17uS_B.cjs +3 -0
  70. package/dist/NiceFeatureGate.doc-DNfFSRrh.js +27 -0
  71. package/dist/NiceForm-BCEXovJR.cjs +1 -0
  72. package/dist/NiceForm-BcN4p2kG.cjs +1 -0
  73. package/dist/NiceForm-D7oyWHXg.js +4820 -0
  74. package/dist/NiceForm-DUhxXArr.js +4817 -0
  75. package/dist/NiceForm-tIXS-M6b.js +4770 -0
  76. package/dist/NiceForm-uCeVmTrD.cjs +1 -0
  77. package/dist/NiceFormItem.doc-BJwEnDz2.js +36 -0
  78. package/dist/NiceFormItem.doc-Ck3PgaPD.cjs +12 -0
  79. package/dist/NiceGantt-CTbqCuwv.cjs +1 -0
  80. package/dist/NiceGantt-Dao7pN9z.js +328 -0
  81. package/dist/NiceGantt.doc-B6YZcJvG.cjs +11 -0
  82. package/dist/NiceGantt.doc-DsI1QXly.js +48 -0
  83. package/dist/NiceGitBlame.doc-BQ2KvGkD.js +30 -0
  84. package/dist/NiceGitBlame.doc-DuTSjZVN.cjs +6 -0
  85. package/dist/NiceGitDiffViewer.doc-D24AGos_.js +30 -0
  86. package/dist/NiceGitDiffViewer.doc-D9FVquBC.cjs +6 -0
  87. package/dist/NiceGitGraph.doc-C-8VGMIz.js +29 -0
  88. package/dist/NiceGitGraph.doc-eRvTmefl.cjs +5 -0
  89. package/dist/NiceGitHooks.doc-DCTVw7HX.cjs +5 -0
  90. package/dist/NiceGitHooks.doc-OCFj5w6v.js +29 -0
  91. package/dist/NiceHtmlEditor-BYk1roA4.cjs +10 -0
  92. package/dist/NiceHtmlEditor-C5kLeF9H.cjs +10 -0
  93. package/dist/NiceHtmlEditor-CFVMIC5L.js +848 -0
  94. package/dist/NiceHtmlEditor-DUwcqj5N.cjs +10 -0
  95. package/dist/NiceHtmlEditor-DiAphF1k.js +889 -0
  96. package/dist/NiceHtmlEditor-mWebBmy1.js +849 -0
  97. package/dist/NiceInstanceMonitor.doc-BSDZp5xa.js +31 -0
  98. package/dist/NiceInstanceMonitor.doc-HVbLufnh.cjs +7 -0
  99. package/dist/NiceLocaleManager.doc-CbVHDEWu.js +25 -0
  100. package/dist/NiceLocaleManager.doc-XH6hMW0Z.cjs +1 -0
  101. package/dist/NiceLockButton.doc-BMhSj3TB.cjs +1 -0
  102. package/dist/NiceLockButton.doc-DvHGhcfm.js +25 -0
  103. package/dist/NiceLoginForm-BHyDY7br.cjs +1 -0
  104. package/dist/NiceLoginForm-BuxFY2Rk.js +750 -0
  105. package/dist/NiceLoginForm-DQe77Isv.js +747 -0
  106. package/dist/NiceLoginForm-NBCo-DUZ.cjs +1 -0
  107. package/dist/NiceLoginForm.css +1 -0
  108. package/dist/NiceMAM.doc-CsQ57saR.cjs +8 -0
  109. package/dist/NiceMAM.doc-hjW7buTH.js +32 -0
  110. package/dist/NiceMention--3P3vO-W.cjs +430 -0
  111. package/dist/NiceMention-CA7CL5BI.js +11263 -0
  112. package/dist/NiceMention-CHcKRl-L.cjs +430 -0
  113. package/dist/NiceMention-Co2cqkVM.js +11316 -0
  114. package/dist/NiceMention-DJD0BLcp.js +11269 -0
  115. package/dist/NiceMention-DcaUEMSg.cjs +430 -0
  116. package/dist/NiceMention.css +1 -1
  117. package/dist/NiceModal-C4p8a82e.cjs +1 -0
  118. package/dist/NiceModal-TNlkaL_i.js +85 -0
  119. package/dist/NiceModuleLifecyclePanel-BWbKdVC_.js +7054 -0
  120. package/dist/NiceModuleLifecyclePanel-CZHIzvkE.cjs +1 -0
  121. package/dist/NiceModuleLifecyclePanel-DV3F_QdI.cjs +1 -0
  122. package/dist/NiceModuleLifecyclePanel-OC9YK2kG.js +7052 -0
  123. package/dist/NiceModuleLifecyclePanel-_OcfDmtC.cjs +1 -0
  124. package/dist/NiceModuleLifecyclePanel-gaZkIEtK.js +6825 -0
  125. package/dist/NiceModuleLifecyclePanel.css +1 -1
  126. package/dist/NiceNetworkDiscoveryPanel.doc-B0RtGaS3.js +25 -0
  127. package/dist/NiceNetworkDiscoveryPanel.doc-BFgFZI5G.cjs +1 -0
  128. package/dist/NicePagination-8XsBbMNx.js +165 -0
  129. package/dist/NicePagination-B3nZDZem.js +165 -0
  130. package/dist/NicePagination-B8rg1Y67.cjs +1 -0
  131. package/dist/NicePagination-CkOoXf0f.js +165 -0
  132. package/dist/NicePagination-D7lek1G7.cjs +1 -0
  133. package/dist/NicePagination-OjTEfZJE.cjs +1 -0
  134. package/dist/NicePipelineEditor.doc-CjqDKe2x.js +29 -0
  135. package/dist/NicePipelineEditor.doc-DZ0pTVTp.cjs +5 -0
  136. package/dist/NicePipelineMonitor.doc-C88-TagI.cjs +5 -0
  137. package/dist/NicePipelineMonitor.doc-CFtH4XJx.js +29 -0
  138. package/dist/NicePivotGrid-BJRSciWl.js +1183 -0
  139. package/dist/NicePivotGrid-BaZa2YZW.js +1157 -0
  140. package/dist/NicePivotGrid-CS1dPmNI.cjs +152 -0
  141. package/dist/NicePivotGrid-D2AxqDzJ.js +1183 -0
  142. package/dist/NicePivotGrid-DxQ6Py9D.cjs +152 -0
  143. package/dist/NicePivotGrid-DyOPhPO8.cjs +152 -0
  144. package/dist/NiceRoomGrid.doc-DJPVUQVg.cjs +8 -0
  145. package/dist/NiceRoomGrid.doc-DLHJS_Wb.js +32 -0
  146. package/dist/NiceSavedQueryPanel-B5HhqlAI.cjs +586 -0
  147. package/dist/NiceSavedQueryPanel-BC84uRfh.cjs +586 -0
  148. package/dist/NiceSavedQueryPanel-CMStDOKe.js +5125 -0
  149. package/dist/NiceSavedQueryPanel-CMfcODIO.js +5120 -0
  150. package/dist/NiceSavedQueryPanel-D2i34e_b.cjs +586 -0
  151. package/dist/NiceSavedQueryPanel-mPO2THs7.js +5142 -0
  152. package/dist/NiceSavedQueryPanel.css +1 -1
  153. package/dist/NiceSceneBar.doc-09sc3yuF.cjs +1 -0
  154. package/dist/NiceSceneBar.doc-DLePMuVU.js +25 -0
  155. package/dist/NiceSceneSelector.doc-CPzCAy-d.cjs +7 -0
  156. package/dist/NiceSceneSelector.doc-FCLZvPc0.js +31 -0
  157. package/dist/NiceScheduler-7gP7vcLy.cjs +5 -0
  158. package/dist/NiceScheduler-BAJRzFQN.js +1690 -0
  159. package/dist/NiceScheduler-Cy7F9tgH.js +1693 -0
  160. package/dist/NiceScheduler-DquRUZxD.cjs +5 -0
  161. package/dist/NiceScheduler-dJ7gHDv7.cjs +5 -0
  162. package/dist/NiceScheduler-l8N4yCWd.js +1716 -0
  163. package/dist/NiceSchedulerViews.doc-C9opZpgg.cjs +1 -0
  164. package/dist/NiceSchedulerViews.doc-Dy7ZH1iL.js +25 -0
  165. package/dist/NiceSelect-CZR8Zu_k.js +420 -0
  166. package/dist/NiceSelect-DIKGbaJo.cjs +1 -0
  167. package/dist/NiceSelect-DZB1Rs9x.js +435 -0
  168. package/dist/NiceSelect-tMz9QQUs.cjs +1 -0
  169. package/dist/NiceSensorGaugePanel.doc-BHirbWLn.cjs +8 -0
  170. package/dist/NiceSensorGaugePanel.doc-DjKmooI6.js +32 -0
  171. package/dist/NiceSpotlight.doc-BVZFfDVI.cjs +10 -0
  172. package/dist/NiceSpotlight.doc-JqwkzrEm.js +34 -0
  173. package/dist/NiceStateDesigner.doc-CfnwiwfU.js +29 -0
  174. package/dist/NiceStateDesigner.doc-DV4zEC50.cjs +5 -0
  175. package/dist/NiceStepper.doc-5VjaLM6r.js +31 -0
  176. package/dist/NiceStepper.doc-f8lYpr33.cjs +7 -0
  177. package/dist/NiceStreamDashboard.doc-74KUXya1.cjs +8 -0
  178. package/dist/NiceStreamDashboard.doc-k8PQfCM0.js +32 -0
  179. package/dist/NiceTaskInbox.doc-CHrxthqp.js +32 -0
  180. package/dist/NiceTaskInbox.doc-CdCTfgBq.cjs +8 -0
  181. package/dist/NiceTestBuilder.doc-BoBzLfa0.js +30 -0
  182. package/dist/NiceTestBuilder.doc-Cj1fNTvk.cjs +6 -0
  183. package/dist/NiceTranscoder.doc-Dnirl3wg.cjs +7 -0
  184. package/dist/NiceTranscoder.doc-cInCYZh7.js +31 -0
  185. package/dist/NiceVideoAnnotator.doc-C1iEi7OM.cjs +7 -0
  186. package/dist/NiceVideoAnnotator.doc-C8zyfKH_.js +31 -0
  187. package/dist/NiceVideoEditor.doc-C6mhEb-q.cjs +7 -0
  188. package/dist/NiceVideoEditor.doc-lrwmKjqj.js +31 -0
  189. package/dist/NiceWindow-BEov3s9F.js +2094 -0
  190. package/dist/NiceWindow-CDt6PCEg.cjs +1 -0
  191. package/dist/NiceWindow-CWN8OCHF.js +2109 -0
  192. package/dist/NiceWindow-Dd8qjkIW.cjs +1 -0
  193. package/dist/NiceWindow.css +1 -1
  194. package/dist/charts-Bo2WAI5T.cjs +768 -0
  195. package/dist/charts-ByrdMeQP.js +4767 -0
  196. package/dist/charts-C047IMVn.cjs +768 -0
  197. package/dist/charts-CCXSb3xk.js +4752 -0
  198. package/dist/charts-CqETcUhH.js +4752 -0
  199. package/dist/charts-DouiiHOT.cjs +768 -0
  200. package/dist/charts.cjs +1 -1
  201. package/dist/charts.css +1 -1
  202. package/dist/charts.d.ts +28 -18
  203. package/dist/charts.mjs +1 -1
  204. package/dist/core-B8eBUE4m.js +438 -0
  205. package/dist/core-BL-KmGYC.js +795 -0
  206. package/dist/core-Chg-oYCr.cjs +1 -0
  207. package/dist/core-CxBnKAhs.cjs +1 -0
  208. package/dist/core-D_LRh59n.js +795 -0
  209. package/dist/core-lBFqvT0V.cjs +1 -0
  210. package/dist/core-lazy-Bh2yg4Et.js +351 -0
  211. package/dist/core-lazy-CkWKjfc6.cjs +1 -0
  212. package/dist/data-branching-Dak1_ZKR.cjs +1 -0
  213. package/dist/data-branching-DiLAO4Qt.js +6386 -0
  214. package/dist/data-branching-Km4lc8P_.cjs +1 -0
  215. package/dist/data-branching-YQtJJEtn.js +6273 -0
  216. package/dist/data-branching.cjs +1 -1
  217. package/dist/data-branching.mjs +1 -1
  218. package/dist/data.cjs +1 -1
  219. package/dist/data.d.ts +22 -69
  220. package/dist/data.mjs +3 -3
  221. package/dist/devops-D5yIDM3e.js +8312 -0
  222. package/dist/devops-DkVluHBp.cjs +17 -0
  223. package/dist/devops-rVpB0ZAX.cjs +17 -0
  224. package/dist/devops-zsMUueTd.js +8648 -0
  225. package/dist/devops.cjs +1 -1
  226. package/dist/devops.d.ts +3 -3
  227. package/dist/devops.mjs +1 -1
  228. package/dist/editors.cjs +1 -1
  229. package/dist/editors.d.ts +106 -63
  230. package/dist/editors.mjs +55 -54
  231. package/dist/feedback.cjs +1 -1
  232. package/dist/feedback.d.ts +76 -2
  233. package/dist/feedback.mjs +10 -9
  234. package/dist/index.cjs +261 -261
  235. package/dist/index.css +1 -1
  236. package/dist/index.d.ts +831 -433
  237. package/dist/index.mjs +27339 -26540
  238. package/dist/injectStyleOnce-BzC_BCs_.js +9 -0
  239. package/dist/injectStyleOnce-DeWaxcdf.cjs +1 -0
  240. package/dist/lazy.cjs +1 -1
  241. package/dist/lazy.d.ts +9 -7
  242. package/dist/lazy.mjs +55 -55
  243. package/dist/navigation.cjs +1 -1
  244. package/dist/navigation.css +1 -0
  245. package/dist/navigation.d.ts +99 -43
  246. package/dist/navigation.mjs +504 -547
  247. package/dist/no-code-6WyYb3hL.cjs +331 -0
  248. package/dist/no-code-BH5oVFC6.js +8186 -0
  249. package/dist/no-code-CnHG5_Vn.js +8186 -0
  250. package/dist/no-code-DMKlg1Zl.cjs +331 -0
  251. package/dist/no-code-DiTEnuRv.js +8288 -0
  252. package/dist/no-code-wG9c0z_T.cjs +331 -0
  253. package/dist/no-code.cjs +1 -1
  254. package/dist/no-code.css +1 -1
  255. package/dist/no-code.d.ts +25 -18
  256. package/dist/no-code.mjs +3 -3
  257. package/dist/overlays.cjs +1 -1
  258. package/dist/overlays.d.ts +36 -30
  259. package/dist/overlays.mjs +24 -490
  260. package/dist/pickerCommons-0vyK1Knv.js +547 -0
  261. package/dist/pickerCommons-BCRiHDE_.cjs +1 -0
  262. package/dist/pickerCommons-BFbItm8o.cjs +1 -0
  263. package/dist/pickerCommons-BHirHJyn.js +548 -0
  264. package/dist/pickerCommons-Bt8JIaTN.cjs +1 -0
  265. package/dist/pickerCommons-DkumQ3KE.js +548 -0
  266. package/dist/pickerCommons.css +1 -1
  267. package/dist/style.css +15 -9
  268. package/package.json +4 -6
  269. package/css/legacy-bg-text-aliases.css +0 -87
@@ -0,0 +1,1181 @@
1
+ import { jsxs as M, jsx as o } from "react/jsx-runtime";
2
+ import { useNiceTranslation as Se, useControllableState as ie, NiceTutorialButton as $e, resolveTutorial as Ue, NiceIcon as L } from "@nice2dev/ui-core";
3
+ import { forwardRef as Be, useRef as w, useState as z, useMemo as _e, useEffect as x, useImperativeHandle as qe, useCallback as xe } from "react";
4
+ import { i as ge } from "./injectStyleOnce-BzC_BCs_.js";
5
+ const He = [
6
+ {
7
+ target: ".nice-code-editor-wrap",
8
+ titleKey: "tutorial.codeEditor.intro.title",
9
+ title: "Code editor",
10
+ contentKey: "tutorial.codeEditor.intro.content",
11
+ content: "Edit code with syntax highlighting, IntelliSense and the toolbar. Ctrl+S saves; the status bar shows the cursor position and any problems.",
12
+ placement: "auto"
13
+ }
14
+ ];
15
+ let G = null, re = null;
16
+ const Ke = "0.45.0", Le = `https://cdn.jsdelivr.net/npm/monaco-editor@${Ke}/min`, me = `${Le}/vs`, Ne = 15e3;
17
+ function Ee() {
18
+ const u = window;
19
+ if (u.MonacoEnvironment?.getWorkerUrl)
20
+ return;
21
+ const g = `self.MonacoEnvironment={baseUrl:'${Le}/'};importScripts('${me}/base/worker/workerMain.js');`, f = URL.createObjectURL(new Blob([g], { type: "text/javascript" }));
22
+ u.MonacoEnvironment = {
23
+ getWorkerUrl: () => f
24
+ };
25
+ }
26
+ function J(u) {
27
+ if (u !== "auto")
28
+ return u;
29
+ if (typeof document > "u")
30
+ return "vs";
31
+ const g = document.documentElement.dataset.theme;
32
+ return g === "dark" ? "vs-dark" : g === "light" ? "vs" : window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "vs-dark" : "vs";
33
+ }
34
+ function Oe() {
35
+ return re ? Promise.resolve(re) : G || (G = new Promise((u, g) => {
36
+ if (window.monaco) {
37
+ Ee(), re = window.monaco, u(re);
38
+ return;
39
+ }
40
+ let f = !1;
41
+ const c = window.setTimeout(() => {
42
+ f || (f = !0, G = null, g(new Error(`Monaco editor failed to load within ${Ne}ms`)));
43
+ }, Ne), y = document.createElement("script");
44
+ y.src = `${me}/loader.min.js`, y.async = !0, y.onload = () => {
45
+ const W = window.require;
46
+ W.config({ paths: { vs: me } }), Ee(), W(["vs/editor/editor.main"], (T) => {
47
+ f || (f = !0, window.clearTimeout(c), re = T, u(T));
48
+ });
49
+ }, y.onerror = () => {
50
+ f || (f = !0, window.clearTimeout(c), G = null, g(new Error("Failed to load Monaco Editor loader script")));
51
+ }, document.head.appendChild(y);
52
+ }), G);
53
+ }
54
+ const et = /* @__PURE__ */ Be(
55
+ function(g, f) {
56
+ const { t: c } = Se();
57
+ ge(fe, he);
58
+ const {
59
+ value: y,
60
+ defaultValue: W,
61
+ onChange: T,
62
+ language: k = "plaintext",
63
+ theme: _ = "auto",
64
+ options: i = {},
65
+ height: X = 400,
66
+ width: D = "100%",
67
+ markers: R = [],
68
+ decorations: V = [],
69
+ completionProvider: m,
70
+ onMount: j,
71
+ onCursorPositionChange: F,
72
+ onSelectionChange: P,
73
+ onSave: K,
74
+ loading: S,
75
+ disabled: A = !1,
76
+ showToolbar: H = !1,
77
+ showStatusBar: I = !1,
78
+ editorSize: Y = "standard",
79
+ className: ee,
80
+ "data-testid": $,
81
+ lsp: N,
82
+ extraLibs: s,
83
+ tutorial: l
84
+ } = g, [d, E, O] = ie({
85
+ value: y,
86
+ defaultValue: W,
87
+ fallbackValue: "",
88
+ onChange: T,
89
+ componentName: "NiceCodeEditor"
90
+ }), U = w(E);
91
+ U.current = E;
92
+ const te = w(d);
93
+ te.current = d;
94
+ const h = w(!1), v = w(null), r = w(null), C = w(null), Q = w([]), B = w(null), [Z, be] = z(!0), [ce, Te] = z(null), [ke, Re] = z({
95
+ lineNumber: 1,
96
+ column: 1
97
+ }), [ve, Pe] = z(""), [de, Ae] = z(i.wordWrap === "on"), se = _e(() => ({
98
+ automaticLayout: !0,
99
+ readOnly: A || i.readOnly,
100
+ minimap: { enabled: i.minimap ?? !0 },
101
+ lineNumbers: i.lineNumbers ?? "on",
102
+ wordWrap: i.wordWrap ?? "off",
103
+ tabSize: i.tabSize ?? 2,
104
+ insertSpaces: i.insertSpaces ?? !0,
105
+ fontSize: i.fontSize ?? 14,
106
+ fontFamily: i.fontFamily ?? "'Fira Code', 'Consolas', 'Monaco', monospace",
107
+ fontLigatures: i.fontLigatures ?? !0,
108
+ cursorStyle: i.cursorStyle ?? "line",
109
+ cursorBlinking: i.cursorBlinking ?? "blink",
110
+ autoClosingBrackets: i.autoClosingBrackets ?? "languageDefined",
111
+ autoClosingQuotes: i.autoClosingQuotes ?? "languageDefined",
112
+ formatOnPaste: i.formatOnPaste ?? !1,
113
+ formatOnType: i.formatOnType ?? !1,
114
+ renderWhitespace: i.renderWhitespace ?? "selection",
115
+ renderControlCharacters: i.renderControlCharacters ?? !1,
116
+ scrollBeyondLastLine: i.scrollBeyondLastLine ?? !0,
117
+ smoothScrolling: i.smoothScrolling ?? !0,
118
+ folding: i.folding ?? !0,
119
+ showFoldingControls: i.showFoldingControls ?? "mouseover",
120
+ "bracketPairColorization.enabled": i.bracketPairColorization ?? !0,
121
+ guides: i.guides ?? {
122
+ bracketPairs: !0,
123
+ indentation: !0,
124
+ highlightActiveIndentation: !0
125
+ },
126
+ stickyScroll: { enabled: i.stickyScroll ?? !1 },
127
+ quickSuggestions: i.quickSuggestions ?? !0,
128
+ suggestOnTriggerCharacters: i.suggestOnTriggerCharacters ?? !0,
129
+ acceptSuggestionOnEnter: i.acceptSuggestionOnEnter ?? "on",
130
+ inlayHints: { enabled: i.inlayHints ? "on" : "off" }
131
+ }), [i, A]);
132
+ x(() => {
133
+ if (!v.current)
134
+ return;
135
+ let e = !0;
136
+ return Oe().then(async (n) => {
137
+ if (!e || !v.current)
138
+ return;
139
+ C.current = n;
140
+ const t = n.editor.create(v.current, {
141
+ value: te.current,
142
+ language: k,
143
+ theme: J(_),
144
+ ...se
145
+ });
146
+ if (r.current = t, be(!1), t.onDidChangeModelContent(() => {
147
+ h.current || U.current(t.getValue());
148
+ }), t.onDidChangeCursorPosition(
149
+ (a) => {
150
+ Re({ lineNumber: a.position.lineNumber, column: a.position.column }), F?.({
151
+ lineNumber: a.position.lineNumber,
152
+ column: a.position.column
153
+ });
154
+ }
155
+ ), t.onDidChangeCursorSelection(
156
+ (a) => {
157
+ const b = a.selection, p = t.getModel()?.getValueInRange(b) ?? "";
158
+ Pe(p), P?.({
159
+ startLineNumber: b.startLineNumber,
160
+ startColumn: b.startColumn,
161
+ endLineNumber: b.endLineNumber,
162
+ endColumn: b.endColumn
163
+ });
164
+ }
165
+ ), t.addCommand(n.KeyMod.CtrlCmd | n.KeyCode.KeyS, () => {
166
+ K?.(t.getValue());
167
+ }), N && typeof window < "u")
168
+ try {
169
+ await ae(
170
+ "https://cdn.jsdelivr.net/npm/vscode-ws-jsonrpc@1.0.2/lib/browser/index.min.js"
171
+ ), await ae(
172
+ "https://cdn.jsdelivr.net/npm/monaco-languageclient@0.15.0/lib/monaco-languageclient.min.js"
173
+ );
174
+ const a = window, b = a.ReconnectingWebSocket, { MonacoLanguageClient: p, CloseAction: ne, ErrorAction: oe, createConnection: ye } = a.monacoLanguageClient || {};
175
+ if (p && ye) {
176
+ const We = N.url, De = N.language, Ce = new b(We), Ve = new a.VSCodeWebSocketMessageReader(Ce), je = new a.VSCodeWebSocketMessageWriter(Ce), Fe = ye(Ve, je), we = new p({
177
+ name: "LSP Client",
178
+ clientOptions: {
179
+ documentSelector: [De],
180
+ initializationOptions: N.initOptions,
181
+ errorHandler: {
182
+ error: () => oe.Continue,
183
+ closed: () => ne.Restart
184
+ }
185
+ },
186
+ connectionProvider: {
187
+ get: () => Promise.resolve(Fe)
188
+ }
189
+ });
190
+ we.start(), r.current.__lspClient = we;
191
+ }
192
+ } catch (a) {
193
+ console.warn("LSP bridge failed to load:", a);
194
+ }
195
+ j?.(t, n);
196
+ }).catch((n) => {
197
+ e && (Te(n.message ?? "Failed to load editor"), be(!1));
198
+ }), () => {
199
+ if (e = !1, r.current?.dispose(), B.current?.dispose(), r.current && r.current.__lspClient)
200
+ try {
201
+ r.current.__lspClient.stop();
202
+ } catch {
203
+ }
204
+ };
205
+ }, [N]), x(() => {
206
+ const e = r.current;
207
+ if (!O || !e || d === e.getValue())
208
+ return;
209
+ const n = e.getPosition();
210
+ h.current = !0;
211
+ try {
212
+ e.setValue(d);
213
+ } finally {
214
+ h.current = !1;
215
+ }
216
+ n && e.setPosition(n);
217
+ }, [d, O]), x(() => {
218
+ const e = r.current, n = C.current;
219
+ if (e && n) {
220
+ const t = e.getModel();
221
+ t && n.editor.setModelLanguage(t, k);
222
+ }
223
+ }, [k]), x(() => {
224
+ const e = C.current;
225
+ if (!e || Z || !s || s.length === 0 || k !== "javascript" && k !== "typescript")
226
+ return;
227
+ const n = e.languages?.typescript;
228
+ if (!n)
229
+ return;
230
+ const t = [];
231
+ try {
232
+ s.forEach((a, b) => {
233
+ const p = a.filePath ?? `inmemory://model/nice-extralib-${b}.d.ts`, ne = n.typescriptDefaults?.addExtraLib(a.content, p);
234
+ ne && t.push(ne);
235
+ const oe = n.javascriptDefaults?.addExtraLib(a.content, p);
236
+ oe && t.push(oe);
237
+ });
238
+ } catch (a) {
239
+ console.warn("Failed to register extraLibs:", a);
240
+ }
241
+ return () => {
242
+ t.forEach((a) => {
243
+ try {
244
+ a.dispose();
245
+ } catch {
246
+ }
247
+ });
248
+ };
249
+ }, [s, k, Z]), x(() => {
250
+ const e = C.current;
251
+ if (!e || (e.editor.setTheme(J(_)), _ !== "auto" || typeof document > "u"))
252
+ return;
253
+ const n = () => {
254
+ C.current?.editor.setTheme(J("auto"));
255
+ }, t = new MutationObserver(n);
256
+ t.observe(document.documentElement, {
257
+ attributes: !0,
258
+ attributeFilter: ["data-theme", "class"]
259
+ });
260
+ const a = window.matchMedia?.("(prefers-color-scheme: dark)");
261
+ return a?.addEventListener?.("change", n), () => {
262
+ t.disconnect(), a?.removeEventListener?.("change", n);
263
+ };
264
+ }, [_]), x(() => {
265
+ const e = r.current;
266
+ e && e.updateOptions(se);
267
+ }, [se]), x(() => {
268
+ const e = r.current, n = C.current;
269
+ if (e && n) {
270
+ const t = e.getModel();
271
+ if (t) {
272
+ const a = R.map((b) => ({
273
+ startLineNumber: b.startLineNumber,
274
+ startColumn: b.startColumn,
275
+ endLineNumber: b.endLineNumber,
276
+ endColumn: b.endColumn,
277
+ message: b.message,
278
+ severity: b.severity
279
+ }));
280
+ n.editor.setModelMarkers(t, "owner", a);
281
+ }
282
+ }
283
+ }, [R]), x(() => {
284
+ const e = r.current;
285
+ if (e && V.length > 0) {
286
+ const n = V.map((t) => ({
287
+ range: {
288
+ startLineNumber: t.range.startLineNumber,
289
+ startColumn: t.range.startColumn,
290
+ endLineNumber: t.range.endLineNumber,
291
+ endColumn: t.range.endColumn
292
+ },
293
+ options: {
294
+ className: t.className,
295
+ glyphMarginClassName: t.glyphMarginClassName,
296
+ hoverMessage: t.hoverMessage ? { value: t.hoverMessage } : void 0,
297
+ isWholeLine: t.isWholeLine
298
+ }
299
+ }));
300
+ Q.current = e.deltaDecorations(
301
+ Q.current,
302
+ n
303
+ );
304
+ }
305
+ }, [V]), x(() => {
306
+ const e = C.current;
307
+ if (!e || !m)
308
+ return;
309
+ B.current?.dispose();
310
+ const n = {
311
+ text: 0,
312
+ method: 1,
313
+ function: 2,
314
+ constructor: 3,
315
+ field: 4,
316
+ variable: 5,
317
+ class: 6,
318
+ interface: 7,
319
+ module: 8,
320
+ property: 9,
321
+ keyword: 13,
322
+ snippet: 14,
323
+ color: 15,
324
+ file: 16,
325
+ reference: 17,
326
+ folder: 18
327
+ };
328
+ return B.current = e.languages.registerCompletionItemProvider(k, {
329
+ provideCompletionItems: async (t, a) => ({
330
+ suggestions: (await m(t, a)).map((p) => ({
331
+ label: p.label,
332
+ kind: n[p.kind] ?? 0,
333
+ insertText: p.insertText,
334
+ insertTextRules: p.insertTextRules === "insertAsSnippet" ? 4 : void 0,
335
+ documentation: p.documentation,
336
+ detail: p.detail,
337
+ range: {
338
+ startLineNumber: a.lineNumber,
339
+ startColumn: a.column,
340
+ endLineNumber: a.lineNumber,
341
+ endColumn: a.column
342
+ }
343
+ }))
344
+ })
345
+ }), () => {
346
+ B.current?.dispose();
347
+ };
348
+ }, [k, m]), qe(
349
+ f,
350
+ () => ({
351
+ getEditor: () => r.current,
352
+ getMonaco: () => C.current,
353
+ focus: () => r.current?.focus(),
354
+ getValue: () => r.current?.getValue() ?? "",
355
+ setValue: (e) => r.current?.setValue(e),
356
+ getSelection: () => {
357
+ const e = r.current;
358
+ if (!e)
359
+ return "";
360
+ const n = e.getSelection();
361
+ return n ? e.getModel()?.getValueInRange(n) ?? "" : "";
362
+ },
363
+ insertText: (e) => {
364
+ const n = r.current;
365
+ if (!n)
366
+ return;
367
+ const t = n.getSelection();
368
+ t && n.executeEdits("", [{ range: t, text: e }]);
369
+ },
370
+ formatDocument: () => {
371
+ r.current?.getAction("editor.action.formatDocument")?.run();
372
+ },
373
+ goToLine: (e, n = 1) => {
374
+ const t = r.current;
375
+ t && (t.setPosition({ lineNumber: e, column: n }), t.revealLineInCenter(e), t.focus());
376
+ },
377
+ findReplace: () => {
378
+ r.current?.getAction("editor.action.startFindReplaceAction")?.run();
379
+ },
380
+ undo: () => {
381
+ r.current?.trigger("keyboard", "undo", null);
382
+ },
383
+ redo: () => {
384
+ r.current?.trigger("keyboard", "redo", null);
385
+ },
386
+ getCursorPosition: () => {
387
+ const e = r.current?.getPosition();
388
+ return { lineNumber: e?.lineNumber ?? 1, column: e?.column ?? 1 };
389
+ },
390
+ setMarkers: (e) => {
391
+ const n = r.current, t = C.current;
392
+ if (n && t) {
393
+ const a = n.getModel();
394
+ if (a) {
395
+ const b = e.map((p) => ({
396
+ startLineNumber: p.startLineNumber,
397
+ startColumn: p.startColumn,
398
+ endLineNumber: p.endLineNumber,
399
+ endColumn: p.endColumn,
400
+ message: p.message,
401
+ severity: p.severity
402
+ }));
403
+ t.editor.setModelMarkers(a, "owner", b);
404
+ }
405
+ }
406
+ }
407
+ }),
408
+ []
409
+ );
410
+ const q = _e(
411
+ () => ({
412
+ format: () => r.current?.getAction("editor.action.formatDocument")?.run(),
413
+ undo: () => r.current?.trigger("keyboard", "undo", null),
414
+ redo: () => r.current?.trigger("keyboard", "redo", null),
415
+ find: () => r.current?.getAction("editor.action.startFindReplaceAction")?.run(),
416
+ toggleWordWrap: () => {
417
+ const e = !de;
418
+ Ae(e), r.current?.updateOptions({ wordWrap: e ? "on" : "off" });
419
+ },
420
+ toggleMinimap: () => {
421
+ const e = r.current?.getOption?.(
422
+ C.current?.editor?.EditorOption?.minimap
423
+ );
424
+ r.current?.updateOptions({ minimap: { enabled: !e?.enabled } });
425
+ },
426
+ foldAll: () => r.current?.getAction("editor.foldAll")?.run(),
427
+ unfoldAll: () => r.current?.getAction("editor.unfoldAll")?.run()
428
+ }),
429
+ [de]
430
+ ), Ie = d.split(`
431
+ `).length, ze = d.length;
432
+ return /* @__PURE__ */ M(
433
+ "div",
434
+ {
435
+ className: `nice-code-editor-wrap nice-editor--${Y} ${ee ?? ""}`,
436
+ style: { height: X, width: D, display: "flex", flexDirection: "column", position: "relative" },
437
+ "data-testid": $,
438
+ children: [
439
+ /* @__PURE__ */ o("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 20 }, children: /* @__PURE__ */ o($e, { steps: Ue(l, He) }) }),
440
+ ce && /* @__PURE__ */ M(
441
+ "div",
442
+ {
443
+ className: "nice-code-editor__error",
444
+ style: {
445
+ position: "absolute",
446
+ inset: 0,
447
+ zIndex: 2,
448
+ background: "var(--nice-bg-primary, #fff)"
449
+ },
450
+ children: [
451
+ /* @__PURE__ */ M("span", { children: [
452
+ /* @__PURE__ */ o(L, { name: "warning", size: 16 }),
453
+ " ",
454
+ ce
455
+ ] }),
456
+ /* @__PURE__ */ o(
457
+ "textarea",
458
+ {
459
+ value: d,
460
+ onChange: (e) => E(e.target.value),
461
+ readOnly: A || i.readOnly,
462
+ style: { width: "100%", height: "100%", fontFamily: "monospace" }
463
+ }
464
+ )
465
+ ]
466
+ }
467
+ ),
468
+ Z && !ce && /* @__PURE__ */ o(
469
+ "div",
470
+ {
471
+ className: "nice-code-editor__loader-overlay",
472
+ style: {
473
+ position: "absolute",
474
+ inset: 0,
475
+ zIndex: 2,
476
+ display: "flex",
477
+ alignItems: "center",
478
+ justifyContent: "center",
479
+ background: "var(--nice-bg-primary, #fff)"
480
+ },
481
+ children: S ?? /* @__PURE__ */ o("div", { className: "nice-code-editor__loader", children: c("codeEditor.loadingEditor", "Loading editor...") })
482
+ }
483
+ ),
484
+ H && /* @__PURE__ */ M("div", { className: "nice-code-editor__toolbar", children: [
485
+ /* @__PURE__ */ o(
486
+ "button",
487
+ {
488
+ className: "nice-code-editor__toolbar-btn",
489
+ onClick: q.undo,
490
+ title: c("codeEditor.undoCtrlZ", "Undo (Ctrl+Z)"),
491
+ "aria-label": c("codeEditor.undo", "Undo"),
492
+ children: /* @__PURE__ */ o(L, { name: "reply", size: 16 })
493
+ }
494
+ ),
495
+ /* @__PURE__ */ o(
496
+ "button",
497
+ {
498
+ className: "nice-code-editor__toolbar-btn",
499
+ onClick: q.redo,
500
+ title: c("codeEditor.redoCtrlY", "Redo (Ctrl+Y)"),
501
+ "aria-label": c("codeEditor.redo", "Redo"),
502
+ children: /* @__PURE__ */ o(L, { name: "forward", size: 16 })
503
+ }
504
+ ),
505
+ /* @__PURE__ */ o("span", { className: "nice-code-editor__toolbar-sep" }),
506
+ /* @__PURE__ */ o(
507
+ "button",
508
+ {
509
+ className: "nice-code-editor__toolbar-btn",
510
+ onClick: q.format,
511
+ title: c("codeEditor.formatShiftAltF", "Format (Shift+Alt+F)"),
512
+ "aria-label": c("codeEditor.format", "Format"),
513
+ children: /* @__PURE__ */ o(L, { name: "type", size: 16 })
514
+ }
515
+ ),
516
+ /* @__PURE__ */ o(
517
+ "button",
518
+ {
519
+ className: "nice-code-editor__toolbar-btn",
520
+ onClick: q.find,
521
+ title: c("codeEditor.findReplaceCtrlH", "Find & Replace (Ctrl+H)"),
522
+ "aria-label": c("codeEditor.findReplace", "Find & Replace"),
523
+ children: /* @__PURE__ */ o(L, { name: "search", size: 16 })
524
+ }
525
+ ),
526
+ /* @__PURE__ */ o("span", { className: "nice-code-editor__toolbar-sep" }),
527
+ /* @__PURE__ */ o(
528
+ "button",
529
+ {
530
+ className: `nice-code-editor__toolbar-btn${de ? " nice-code-editor__toolbar-btn--active" : ""}`,
531
+ onClick: q.toggleWordWrap,
532
+ title: c("codeEditor.toggleWordWrap", "Toggle Word Wrap"),
533
+ "aria-label": c("codeEditor.toggleWordWrap", "Toggle Word Wrap"),
534
+ children: /* @__PURE__ */ o(L, { name: "align-left", size: 16 })
535
+ }
536
+ ),
537
+ /* @__PURE__ */ o(
538
+ "button",
539
+ {
540
+ className: "nice-code-editor__toolbar-btn",
541
+ onClick: q.toggleMinimap,
542
+ title: c("codeEditor.toggleMinimap", "Toggle Minimap"),
543
+ "aria-label": c("codeEditor.toggleMinimap", "Toggle Minimap"),
544
+ children: /* @__PURE__ */ o(L, { name: "columns", size: 16 })
545
+ }
546
+ ),
547
+ /* @__PURE__ */ o("span", { className: "nice-code-editor__toolbar-sep" }),
548
+ /* @__PURE__ */ o(
549
+ "button",
550
+ {
551
+ className: "nice-code-editor__toolbar-btn",
552
+ onClick: q.foldAll,
553
+ title: c("codeEditor.foldAll", "Fold All"),
554
+ "aria-label": c("codeEditor.foldAll", "Fold All"),
555
+ children: /* @__PURE__ */ o(L, { name: "collapse", size: 16 })
556
+ }
557
+ ),
558
+ /* @__PURE__ */ o(
559
+ "button",
560
+ {
561
+ className: "nice-code-editor__toolbar-btn",
562
+ onClick: q.unfoldAll,
563
+ title: c("codeEditor.unfoldAll", "Unfold All"),
564
+ "aria-label": c("codeEditor.unfoldAll", "Unfold All"),
565
+ children: /* @__PURE__ */ o(L, { name: "expand", size: 16 })
566
+ }
567
+ )
568
+ ] }),
569
+ /* @__PURE__ */ o("div", { ref: v, className: "nice-code-editor", style: { flex: 1, minHeight: 0 } }),
570
+ I && /* @__PURE__ */ M("div", { className: "nice-code-editor__statusbar", children: [
571
+ /* @__PURE__ */ M("span", { children: [
572
+ "Ln ",
573
+ ke.lineNumber,
574
+ ", Col ",
575
+ ke.column
576
+ ] }),
577
+ ve.length > 0 && /* @__PURE__ */ M("span", { children: [
578
+ "(",
579
+ ve.length,
580
+ " selected)"
581
+ ] }),
582
+ /* @__PURE__ */ o("span", { className: "nice-code-editor__statusbar-spacer" }),
583
+ /* @__PURE__ */ M("span", { children: [
584
+ Ie,
585
+ " lines · ",
586
+ ze,
587
+ " chars"
588
+ ] }),
589
+ /* @__PURE__ */ o("span", { className: "nice-code-editor__statusbar-lang", children: k }),
590
+ R.length > 0 && /* @__PURE__ */ M("span", { className: "nice-code-editor__statusbar-markers", children: [
591
+ /* @__PURE__ */ o(L, { name: "warning", size: 14 }),
592
+ " ",
593
+ R.length
594
+ ] })
595
+ ] })
596
+ ]
597
+ }
598
+ );
599
+ }
600
+ );
601
+ function tt(u) {
602
+ const { t: g } = Se();
603
+ ge(fe, he);
604
+ const {
605
+ original: f,
606
+ defaultOriginal: c,
607
+ modified: y,
608
+ defaultModified: W,
609
+ language: T = "plaintext",
610
+ theme: k = "auto",
611
+ height: _ = 400,
612
+ width: i = "100%",
613
+ inline: X = !1,
614
+ renderSideBySide: D = !0,
615
+ originalEditable: R = !1,
616
+ modifiedEditable: V = !1,
617
+ onOriginalChange: m,
618
+ onModifiedChange: j,
619
+ loading: F,
620
+ className: P,
621
+ "data-testid": K
622
+ } = u, [S, A, H] = ie({
623
+ value: f,
624
+ defaultValue: c,
625
+ fallbackValue: "",
626
+ onChange: m,
627
+ componentName: "NiceCodeDiffEditor.original"
628
+ }), [I, Y, ee] = ie({
629
+ value: y,
630
+ defaultValue: W,
631
+ fallbackValue: "",
632
+ onChange: j,
633
+ componentName: "NiceCodeDiffEditor.modified"
634
+ }), $ = w({ currentOriginal: S, currentModified: I, setOriginal: A, setModified: Y });
635
+ $.current = { currentOriginal: S, currentModified: I, setOriginal: A, setModified: Y };
636
+ const N = w(!1), s = w(null), l = w(null), d = w(null), [E, O] = z(!0), [U, te] = z(null);
637
+ return x(() => {
638
+ if (!s.current)
639
+ return;
640
+ let h = !0;
641
+ return Oe().then((v) => {
642
+ if (!h || !s.current)
643
+ return;
644
+ d.current = v;
645
+ const { currentOriginal: r, currentModified: C } = $.current, Q = v.editor.createModel(r, T), B = v.editor.createModel(C, T), Z = v.editor.createDiffEditor(s.current, {
646
+ automaticLayout: !0,
647
+ theme: J(k),
648
+ renderSideBySide: !X && D,
649
+ originalEditable: R,
650
+ readOnly: !V
651
+ });
652
+ Z.setModel({
653
+ original: Q,
654
+ modified: B
655
+ }), l.current = Z, O(!1), R && Q.onDidChangeContent(() => {
656
+ N.current || $.current.setOriginal(Q.getValue());
657
+ }), V && B.onDidChangeContent(() => {
658
+ N.current || $.current.setModified(B.getValue());
659
+ });
660
+ }).catch((v) => {
661
+ h && (te(v.message ?? "Failed to load diff editor"), O(!1));
662
+ }), () => {
663
+ h = !1, l.current?.dispose();
664
+ };
665
+ }, []), x(() => {
666
+ const h = l.current?.getModel();
667
+ if (h) {
668
+ N.current = !0;
669
+ try {
670
+ H && h.original.getValue() !== S && h.original.setValue(S), ee && h.modified.getValue() !== I && h.modified.setValue(I);
671
+ } finally {
672
+ N.current = !1;
673
+ }
674
+ }
675
+ }, [S, I, H, ee]), x(() => {
676
+ const h = d.current;
677
+ if (!h || (h.editor.setTheme(J(k)), k !== "auto" || typeof document > "u"))
678
+ return;
679
+ const v = () => {
680
+ d.current?.editor.setTheme(J("auto"));
681
+ }, r = new MutationObserver(v);
682
+ r.observe(document.documentElement, {
683
+ attributes: !0,
684
+ attributeFilter: ["data-theme", "class"]
685
+ });
686
+ const C = window.matchMedia?.("(prefers-color-scheme: dark)");
687
+ return C?.addEventListener?.("change", v), () => {
688
+ r.disconnect(), C?.removeEventListener?.("change", v);
689
+ };
690
+ }, [k, E]), U ? /* @__PURE__ */ o(
691
+ "div",
692
+ {
693
+ className: `nice-code-diff-editor nice-code-diff-editor--error ${P ?? ""}`,
694
+ style: { height: _, width: i },
695
+ "data-testid": K,
696
+ children: /* @__PURE__ */ o("div", { className: "nice-code-editor__error", children: /* @__PURE__ */ M("span", { children: [
697
+ /* @__PURE__ */ o(L, { name: "warning", size: 16 }),
698
+ " ",
699
+ U
700
+ ] }) })
701
+ }
702
+ ) : /* @__PURE__ */ M(
703
+ "div",
704
+ {
705
+ className: `nice-code-diff-editor ${P ?? ""}`,
706
+ style: { height: _, width: i, position: "relative" },
707
+ "data-testid": K,
708
+ children: [
709
+ /* @__PURE__ */ o("div", { ref: s, style: { position: "absolute", inset: 0 } }),
710
+ E && /* @__PURE__ */ o(
711
+ "div",
712
+ {
713
+ style: {
714
+ position: "absolute",
715
+ inset: 0,
716
+ display: "flex",
717
+ alignItems: "center",
718
+ justifyContent: "center",
719
+ background: "var(--nice-bg-primary, #fff)",
720
+ zIndex: 2
721
+ },
722
+ children: F ?? /* @__PURE__ */ o("div", { className: "nice-code-editor__loader", children: g("codeEditor.loadingDiffEditor", "Loading diff editor...") })
723
+ }
724
+ )
725
+ ]
726
+ }
727
+ );
728
+ }
729
+ const Ye = "1.29.0", Me = `https://cdn.jsdelivr.net/npm/prismjs@${Ye}`;
730
+ let le = null;
731
+ const pe = {
732
+ javascript: "javascript",
733
+ typescript: "typescript",
734
+ json: "json",
735
+ html: "markup",
736
+ css: "css",
737
+ scss: "scss",
738
+ less: "less",
739
+ markdown: "markdown",
740
+ xml: "markup",
741
+ yaml: "yaml",
742
+ sql: "sql",
743
+ python: "python",
744
+ csharp: "csharp",
745
+ java: "java",
746
+ cpp: "cpp",
747
+ c: "c",
748
+ go: "go",
749
+ rust: "rust",
750
+ php: "php",
751
+ ruby: "ruby",
752
+ shell: "bash",
753
+ powershell: "powershell",
754
+ plaintext: "plain"
755
+ };
756
+ function ae(u) {
757
+ return new Promise((g, f) => {
758
+ if (document.querySelector(`script[data-prism-src="${u}"]`)) {
759
+ g();
760
+ return;
761
+ }
762
+ const c = document.createElement("script");
763
+ c.src = u, c.async = !0, c.dataset.prismSrc = u, c.onload = () => g(), c.onerror = () => f(new Error(`Failed to load ${u}`)), document.head.appendChild(c);
764
+ });
765
+ }
766
+ function Qe(u) {
767
+ if (typeof window > "u")
768
+ return Promise.resolve(null);
769
+ const g = window, f = pe[u] ?? "plain", c = async () => {
770
+ if (f !== "plain" && !g.Prism?.languages?.[f])
771
+ try {
772
+ await ae(`${Me}/components/prism-${f}.min.js`);
773
+ } catch {
774
+ }
775
+ };
776
+ return g.Prism?.languages ? c().then(() => g.Prism) : (le || (le = (async () => (window.Prism = { manual: !0 }, await ae(`${Me}/prism.min.js`), window.Prism))()), le.then(async () => (await c(), window.Prism)));
777
+ }
778
+ function ue(u) {
779
+ return u.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
780
+ }
781
+ function rt(u) {
782
+ ge(fe, he);
783
+ const {
784
+ value: g,
785
+ defaultValue: f,
786
+ onChange: c,
787
+ language: y = "plaintext",
788
+ height: W = 300,
789
+ width: T = "100%",
790
+ readOnly: k = !1,
791
+ tabSize: _ = 2,
792
+ lineNumbers: i = !0,
793
+ placeholder: X,
794
+ theme: D = "auto",
795
+ className: R,
796
+ "data-testid": V
797
+ } = u, [m, j] = ie({
798
+ value: g,
799
+ defaultValue: f,
800
+ fallbackValue: "",
801
+ onChange: c,
802
+ componentName: "NiceSimpleCodeEditor"
803
+ }), F = w(null), P = w(null), [K, S] = z(() => ue(m)), [A, H] = z("light");
804
+ x(() => {
805
+ const s = () => {
806
+ if (D !== "auto")
807
+ return D;
808
+ if (typeof document > "u")
809
+ return "light";
810
+ const O = document.documentElement.dataset.theme;
811
+ return O === "dark" ? "dark" : O === "light" ? "light" : window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
812
+ };
813
+ if (H(s()), D !== "auto" || typeof document > "u")
814
+ return;
815
+ const l = () => H(s()), d = new MutationObserver(l);
816
+ d.observe(document.documentElement, {
817
+ attributes: !0,
818
+ attributeFilter: ["data-theme", "class"]
819
+ });
820
+ const E = window.matchMedia?.("(prefers-color-scheme: dark)");
821
+ return E?.addEventListener?.("change", l), () => {
822
+ d.disconnect(), E?.removeEventListener?.("change", l);
823
+ };
824
+ }, [D]), x(() => {
825
+ let s = !0;
826
+ return Qe(y).then((l) => {
827
+ if (!s)
828
+ return;
829
+ const d = pe[y] ?? "plain";
830
+ if (l?.languages?.[d])
831
+ try {
832
+ const E = l.highlight(m, l.languages[d], d);
833
+ S(E);
834
+ return;
835
+ } catch {
836
+ }
837
+ S(ue(m));
838
+ }).catch(() => {
839
+ s && S(ue(m));
840
+ }), () => {
841
+ s = !1;
842
+ };
843
+ }, [m, y]);
844
+ const I = xe(() => {
845
+ !P.current || !F.current || (P.current.scrollTop = F.current.scrollTop, P.current.scrollLeft = F.current.scrollLeft);
846
+ }, []), Y = xe(
847
+ (s) => {
848
+ if (s.key === "Tab") {
849
+ s.preventDefault();
850
+ const l = s.currentTarget, d = l.selectionStart, E = l.selectionEnd, O = " ".repeat(_);
851
+ if (s.shiftKey) {
852
+ const h = m.substring(0, d).lastIndexOf(`
853
+ `) + 1;
854
+ if ((m.substring(h, d).match(/^(\s*)/)?.[1] ?? "").length >= _) {
855
+ const r = m.substring(0, h) + m.substring(h + _);
856
+ j(r), setTimeout(() => {
857
+ l.selectionStart = l.selectionEnd = d - _;
858
+ }, 0);
859
+ }
860
+ } else {
861
+ const U = m.substring(0, d) + O + m.substring(E);
862
+ j(U), setTimeout(() => {
863
+ l.selectionStart = l.selectionEnd = d + _;
864
+ }, 0);
865
+ }
866
+ }
867
+ },
868
+ [m, j, _]
869
+ ), $ = m.split(`
870
+ `).length, N = pe[y] ?? "plain";
871
+ return /* @__PURE__ */ M(
872
+ "div",
873
+ {
874
+ className: `nice-simple-code-editor nice-simple-code-editor--${A} ${R ?? ""}`,
875
+ style: { height: W, width: T },
876
+ "data-testid": V,
877
+ "data-language": y,
878
+ "data-theme": A,
879
+ children: [
880
+ i && /* @__PURE__ */ o("div", { className: "nice-simple-code-editor__line-numbers", children: Array.from({ length: $ }, (s, l) => /* @__PURE__ */ o("div", { className: "nice-simple-code-editor__line-number", children: l + 1 }, l)) }),
881
+ /* @__PURE__ */ M("div", { className: "nice-simple-code-editor__editor-area", children: [
882
+ /* @__PURE__ */ o(
883
+ "pre",
884
+ {
885
+ ref: P,
886
+ "aria-hidden": "true",
887
+ className: `nice-simple-code-editor__highlight language-${N}`,
888
+ children: /* @__PURE__ */ o(
889
+ "code",
890
+ {
891
+ className: `language-${N}`,
892
+ dangerouslySetInnerHTML: {
893
+ __html: K + (m.endsWith(`
894
+ `) ? `
895
+ ` : "")
896
+ }
897
+ }
898
+ )
899
+ }
900
+ ),
901
+ /* @__PURE__ */ o(
902
+ "textarea",
903
+ {
904
+ ref: F,
905
+ className: "nice-simple-code-editor__textarea",
906
+ value: m,
907
+ onChange: (s) => j(s.target.value),
908
+ onKeyDown: Y,
909
+ onScroll: I,
910
+ readOnly: k,
911
+ placeholder: X,
912
+ spellCheck: !1,
913
+ autoCapitalize: "off",
914
+ autoCorrect: "off"
915
+ }
916
+ )
917
+ ] })
918
+ ]
919
+ }
920
+ );
921
+ }
922
+ const fe = "nice-code-editor-styles", he = `
923
+ .nice-code-editor,
924
+ .nice-code-diff-editor {
925
+ border: 1px solid var(--nice-border, #e0e0e0);
926
+ border-radius: var(--nice-radius-sm, 4px);
927
+ overflow: hidden;
928
+ }
929
+
930
+ .nice-code-editor--loading,
931
+ .nice-code-editor--error,
932
+ .nice-code-diff-editor--loading {
933
+ display: flex;
934
+ align-items: center;
935
+ justify-content: center;
936
+ background: var(--nice-bg-tertiary, #f5f5f5);
937
+ }
938
+
939
+ .nice-code-editor__loader {
940
+ color: var(--nice-text-secondary, #666);
941
+ font-size: 14px;
942
+ }
943
+
944
+ .nice-code-editor__error {
945
+ display: flex;
946
+ flex-direction: column;
947
+ width: 100%;
948
+ height: 100%;
949
+ padding: var(--nice-space-2, 8px);
950
+ gap: var(--nice-space-2, 8px);
951
+ }
952
+
953
+ .nice-code-editor__error span {
954
+ color: var(--nice-error, #d32f2f);
955
+ }
956
+
957
+ /* Simple code editor */
958
+ .nice-simple-code-editor {
959
+ display: flex;
960
+ border: 1px solid var(--nice-border-color, var(--nice-border, #e0e0e0));
961
+ border-radius: var(--nice-radius-sm, 4px);
962
+ overflow: hidden;
963
+ font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
964
+ font-size: 14px;
965
+ line-height: 1.5;
966
+ background: var(--nice-bg-primary, var(--nice-bg-surface, #fff));
967
+ color: var(--nice-text-primary, var(--nice-text-primary, #333));
968
+ }
969
+ .nice-simple-code-editor--dark {
970
+ background: var(--nice-bg, #1e1e1e);
971
+ color: var(--nice-text, #d4d4d4);
972
+ }
973
+
974
+ .nice-simple-code-editor__line-numbers {
975
+ padding: var(--nice-space-2, 8px) 0;
976
+ background: var(--nice-bg-secondary, var(--nice-bg-tertiary, #f5f5f5));
977
+ border-right: 1px solid var(--nice-border-color, var(--nice-border, #e0e0e0));
978
+ user-select: none;
979
+ text-align: right;
980
+ color: var(--nice-text-secondary, var(--nice-text-secondary, #999));
981
+ overflow: hidden;
982
+ }
983
+ .nice-simple-code-editor--dark .nice-simple-code-editor__line-numbers {
984
+ background: var(--nice-bg-secondary, #252526);
985
+ border-right-color: var(--nice-border, #3c3c3c);
986
+ color: var(--nice-text-muted, #858585);
987
+ }
988
+
989
+ .nice-simple-code-editor__line-number {
990
+ padding: 0 var(--nice-space-3, 12px);
991
+ min-width: 40px;
992
+ }
993
+
994
+ .nice-simple-code-editor__editor-area {
995
+ position: relative;
996
+ flex: 1;
997
+ overflow: hidden;
998
+ }
999
+
1000
+ .nice-simple-code-editor__highlight,
1001
+ .nice-simple-code-editor__textarea {
1002
+ position: absolute;
1003
+ inset: 0;
1004
+ margin: 0;
1005
+ padding: var(--nice-space-2, 8px) var(--nice-space-3, 12px);
1006
+ border: 0;
1007
+ font: inherit;
1008
+ line-height: inherit;
1009
+ white-space: pre;
1010
+ overflow: auto;
1011
+ tab-size: 2;
1012
+ }
1013
+
1014
+ .nice-simple-code-editor__highlight {
1015
+ pointer-events: none;
1016
+ background: transparent;
1017
+ color: inherit;
1018
+ }
1019
+ .nice-simple-code-editor__highlight code {
1020
+ font: inherit;
1021
+ background: transparent;
1022
+ }
1023
+
1024
+ .nice-simple-code-editor__textarea {
1025
+ background: transparent;
1026
+ color: transparent;
1027
+ caret-color: var(--nice-text-primary, var(--nice-text-primary, #333));
1028
+ resize: none;
1029
+ outline: none;
1030
+ -webkit-text-fill-color: transparent;
1031
+ }
1032
+ .nice-simple-code-editor--dark .nice-simple-code-editor__textarea {
1033
+ caret-color: var(--nice-text, #d4d4d4);
1034
+ }
1035
+
1036
+ .nice-simple-code-editor__textarea::placeholder {
1037
+ color: var(--nice-text-secondary, var(--nice-text-secondary, #999));
1038
+ -webkit-text-fill-color: var(--nice-text-secondary, var(--nice-text-secondary, #999));
1039
+ }
1040
+ .nice-simple-code-editor--dark .nice-simple-code-editor__textarea::placeholder {
1041
+ color: var(--nice-text-muted, #858585);
1042
+ -webkit-text-fill-color: var(--nice-text-muted, #858585);
1043
+ }
1044
+
1045
+ /* Prism token colors — light */
1046
+ .nice-simple-code-editor .token.comment,
1047
+ .nice-simple-code-editor .token.prolog,
1048
+ .nice-simple-code-editor .token.doctype,
1049
+ .nice-simple-code-editor .token.cdata { color: #6a737d; font-style: italic; }
1050
+ .nice-simple-code-editor .token.punctuation { color: #586069; }
1051
+ .nice-simple-code-editor .token.property,
1052
+ .nice-simple-code-editor .token.tag,
1053
+ .nice-simple-code-editor .token.boolean,
1054
+ .nice-simple-code-editor .token.number,
1055
+ .nice-simple-code-editor .token.constant,
1056
+ .nice-simple-code-editor .token.symbol,
1057
+ .nice-simple-code-editor .token.deleted { color: #005cc5; }
1058
+ .nice-simple-code-editor .token.selector,
1059
+ .nice-simple-code-editor .token.attr-name,
1060
+ .nice-simple-code-editor .token.string,
1061
+ .nice-simple-code-editor .token.char,
1062
+ .nice-simple-code-editor .token.builtin,
1063
+ .nice-simple-code-editor .token.inserted { color: #032f62; }
1064
+ .nice-simple-code-editor .token.operator,
1065
+ .nice-simple-code-editor .token.entity,
1066
+ .nice-simple-code-editor .token.url,
1067
+ .nice-simple-code-editor .token.variable { color: var(--nice-danger, #d73a49); }
1068
+ .nice-simple-code-editor .token.atrule,
1069
+ .nice-simple-code-editor .token.attr-value,
1070
+ .nice-simple-code-editor .token.keyword { color: var(--nice-danger, #d73a49); font-weight: 600; }
1071
+ .nice-simple-code-editor .token.function,
1072
+ .nice-simple-code-editor .token.class-name { color: #6f42c1; }
1073
+ .nice-simple-code-editor .token.regex,
1074
+ .nice-simple-code-editor .token.important { color: #e36209; }
1075
+
1076
+ /* Prism token colors — dark */
1077
+ .nice-simple-code-editor--dark .token.comment,
1078
+ .nice-simple-code-editor--dark .token.prolog,
1079
+ .nice-simple-code-editor--dark .token.doctype,
1080
+ .nice-simple-code-editor--dark .token.cdata { color: var(--nice-success, #6a9955); font-style: italic; }
1081
+ .nice-simple-code-editor--dark .token.punctuation { color: var(--nice-text, #d4d4d4); }
1082
+ .nice-simple-code-editor--dark .token.property,
1083
+ .nice-simple-code-editor--dark .token.tag,
1084
+ .nice-simple-code-editor--dark .token.boolean,
1085
+ .nice-simple-code-editor--dark .token.number,
1086
+ .nice-simple-code-editor--dark .token.constant,
1087
+ .nice-simple-code-editor--dark .token.symbol,
1088
+ .nice-simple-code-editor--dark .token.deleted { color: var(--nice-success-light, #b5cea8); }
1089
+ .nice-simple-code-editor--dark .token.selector,
1090
+ .nice-simple-code-editor--dark .token.attr-name,
1091
+ .nice-simple-code-editor--dark .token.string,
1092
+ .nice-simple-code-editor--dark .token.char,
1093
+ .nice-simple-code-editor--dark .token.builtin,
1094
+ .nice-simple-code-editor--dark .token.inserted { color: var(--nice-warning, #ce9178); }
1095
+ .nice-simple-code-editor--dark .token.operator,
1096
+ .nice-simple-code-editor--dark .token.entity,
1097
+ .nice-simple-code-editor--dark .token.url,
1098
+ .nice-simple-code-editor--dark .token.variable { color: var(--nice-primary, #569cd6); }
1099
+ .nice-simple-code-editor--dark .token.atrule,
1100
+ .nice-simple-code-editor--dark .token.attr-value,
1101
+ .nice-simple-code-editor--dark .token.keyword { color: #c586c0; font-weight: 600; }
1102
+ .nice-simple-code-editor--dark .token.function,
1103
+ .nice-simple-code-editor--dark .token.class-name { color: #dcdcaa; }
1104
+ .nice-simple-code-editor--dark .token.regex,
1105
+ .nice-simple-code-editor--dark .token.important { color: #d7ba7d; }
1106
+
1107
+ /* Toolbar */
1108
+ .nice-code-editor-wrap {
1109
+ border: 1px solid var(--nice-border, #e0e0e0);
1110
+ border-radius: var(--nice-radius-sm, 4px);
1111
+ overflow: hidden;
1112
+ }
1113
+ .nice-code-editor-wrap .nice-code-editor {
1114
+ border: none;
1115
+ border-radius: 0;
1116
+ }
1117
+ .nice-code-editor__toolbar {
1118
+ display: flex;
1119
+ align-items: center;
1120
+ gap: var(--nice-space-0-5, 2px);
1121
+ padding: var(--nice-space-0-75, 3px) var(--nice-space-1-5, 6px);
1122
+ background: var(--nice-bg-tertiary, #f5f5f5);
1123
+ border-bottom: 1px solid var(--nice-border, #e0e0e0);
1124
+ }
1125
+ .nice-code-editor__toolbar-btn {
1126
+ display: inline-flex;
1127
+ align-items: center;
1128
+ justify-content: center;
1129
+ width: 26px;
1130
+ height: 26px;
1131
+ border: none;
1132
+ border-radius: var(--nice-radius-sm, 3px);
1133
+ background: transparent;
1134
+ color: var(--nice-text-secondary, #666);
1135
+ cursor: pointer;
1136
+ font-size: 14px;
1137
+ transition: background 0.15s, color 0.15s;
1138
+ }
1139
+ .nice-code-editor__toolbar-btn:hover {
1140
+ background: var(--nice-hover-bg, #e0e0e0);
1141
+ color: var(--nice-text-primary, #333);
1142
+ }
1143
+ .nice-code-editor__toolbar-btn--active {
1144
+ background: var(--nice-accent, #1976d2);
1145
+ color: var(--nice-text-on-primary, #FFF);
1146
+ }
1147
+ .nice-code-editor__toolbar-sep {
1148
+ width: 1px;
1149
+ height: 18px;
1150
+ background: var(--nice-border, #e0e0e0);
1151
+ margin: 0 var(--nice-space-1, 4px);
1152
+ }
1153
+
1154
+ /* Status bar */
1155
+ .nice-code-editor__statusbar {
1156
+ display: flex;
1157
+ align-items: center;
1158
+ gap: var(--nice-space-3, 12px);
1159
+ padding: var(--nice-space-0-5, 2px) var(--nice-space-2-5, 10px);
1160
+ background: var(--nice-bg-tertiary, #f5f5f5);
1161
+ border-top: 1px solid var(--nice-border, #e0e0e0);
1162
+ font-size: 12px;
1163
+ color: var(--nice-text-secondary, #666);
1164
+ user-select: none;
1165
+ }
1166
+ .nice-code-editor__statusbar-spacer { flex: 1; }
1167
+ .nice-code-editor__statusbar-lang {
1168
+ text-transform: uppercase;
1169
+ font-weight: 600;
1170
+ font-size: 11px;
1171
+ }
1172
+ .nice-code-editor__statusbar-markers {
1173
+ color: var(--nice-warning, #f39c12);
1174
+ font-weight: 600;
1175
+ }
1176
+ `;
1177
+ export {
1178
+ tt as NiceCodeDiffEditor,
1179
+ et as NiceCodeEditor,
1180
+ rt as NiceSimpleCodeEditor
1181
+ };