@deweb.id/ui-kit 0.0.0-stage → 0.1.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 (408) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -2
  3. package/css/ui-kit.css +901 -0
  4. package/dist/chunk-028rzptn.js +253 -0
  5. package/dist/chunk-028rzptn.js.map +10 -0
  6. package/dist/chunk-0x0et52k.js +82 -0
  7. package/dist/chunk-0x0et52k.js.map +10 -0
  8. package/dist/chunk-17gmkyd1.js +195 -0
  9. package/dist/chunk-17gmkyd1.js.map +10 -0
  10. package/dist/chunk-19jsevr8.js +17 -0
  11. package/dist/chunk-19jsevr8.js.map +10 -0
  12. package/dist/chunk-1t1fbbme.js +171 -0
  13. package/dist/chunk-1t1fbbme.js.map +10 -0
  14. package/dist/chunk-26ban96z.js +151 -0
  15. package/dist/chunk-26ban96z.js.map +10 -0
  16. package/dist/chunk-39hey5ns.js +2034 -0
  17. package/dist/chunk-39hey5ns.js.map +19 -0
  18. package/dist/chunk-3f0bjycv.js +481 -0
  19. package/dist/chunk-3f0bjycv.js.map +10 -0
  20. package/dist/chunk-3zpf64v4.js +108 -0
  21. package/dist/chunk-3zpf64v4.js.map +10 -0
  22. package/dist/chunk-4jrq15v9.js +919 -0
  23. package/dist/chunk-4jrq15v9.js.map +10 -0
  24. package/dist/chunk-8dacesjp.js +289 -0
  25. package/dist/chunk-8dacesjp.js.map +10 -0
  26. package/dist/chunk-8een770x.js +2546 -0
  27. package/dist/chunk-8een770x.js.map +29 -0
  28. package/dist/chunk-8jv2g2ne.js +371 -0
  29. package/dist/chunk-8jv2g2ne.js.map +10 -0
  30. package/dist/chunk-abdqb4e5.js +156 -0
  31. package/dist/chunk-abdqb4e5.js.map +10 -0
  32. package/dist/chunk-af27xdf2.js +891 -0
  33. package/dist/chunk-af27xdf2.js.map +11 -0
  34. package/dist/chunk-amsyqyh9.js +23 -0
  35. package/dist/chunk-amsyqyh9.js.map +9 -0
  36. package/dist/chunk-czbcw9e1.js +503 -0
  37. package/dist/chunk-czbcw9e1.js.map +11 -0
  38. package/dist/chunk-dar8mz91.js +73 -0
  39. package/dist/chunk-dar8mz91.js.map +10 -0
  40. package/dist/chunk-dsddmmdk.js +136 -0
  41. package/dist/chunk-dsddmmdk.js.map +10 -0
  42. package/dist/chunk-edx7tas6.js +89 -0
  43. package/dist/chunk-edx7tas6.js.map +10 -0
  44. package/dist/chunk-es4tgmvr.js +1686 -0
  45. package/dist/chunk-es4tgmvr.js.map +12 -0
  46. package/dist/chunk-f2aqj672.js +240 -0
  47. package/dist/chunk-f2aqj672.js.map +11 -0
  48. package/dist/chunk-h6k57hyd.js +146 -0
  49. package/dist/chunk-h6k57hyd.js.map +10 -0
  50. package/dist/chunk-hkx78qgj.js +1548 -0
  51. package/dist/chunk-hkx78qgj.js.map +12 -0
  52. package/dist/chunk-hq57r97c.js +770 -0
  53. package/dist/chunk-hq57r97c.js.map +11 -0
  54. package/dist/chunk-jct2e2h1.js +139 -0
  55. package/dist/chunk-jct2e2h1.js.map +10 -0
  56. package/dist/chunk-je0j5sn4.js +246 -0
  57. package/dist/chunk-je0j5sn4.js.map +10 -0
  58. package/dist/chunk-k2b698v5.js +754 -0
  59. package/dist/chunk-k2b698v5.js.map +12 -0
  60. package/dist/chunk-kv58555q.js +267 -0
  61. package/dist/chunk-kv58555q.js.map +11 -0
  62. package/dist/chunk-m0msvrte.js +15 -0
  63. package/dist/chunk-m0msvrte.js.map +10 -0
  64. package/dist/chunk-m3t14v77.js +30 -0
  65. package/dist/chunk-m3t14v77.js.map +10 -0
  66. package/dist/chunk-mctp30cp.js +1466 -0
  67. package/dist/chunk-mctp30cp.js.map +10 -0
  68. package/dist/chunk-n37qb5m5.js +1408 -0
  69. package/dist/chunk-n37qb5m5.js.map +10 -0
  70. package/dist/chunk-nhhgsdt3.js +570 -0
  71. package/dist/chunk-nhhgsdt3.js.map +11 -0
  72. package/dist/chunk-pxydj130.js +28 -0
  73. package/dist/chunk-pxydj130.js.map +10 -0
  74. package/dist/chunk-qmbwp4k7.js +3275 -0
  75. package/dist/chunk-qmbwp4k7.js.map +13 -0
  76. package/dist/chunk-qzxf0aa2.js +149 -0
  77. package/dist/chunk-qzxf0aa2.js.map +10 -0
  78. package/dist/chunk-rbjyp9ff.js +47 -0
  79. package/dist/chunk-rbjyp9ff.js.map +10 -0
  80. package/dist/chunk-rbkc50xg.js +103 -0
  81. package/dist/chunk-rbkc50xg.js.map +10 -0
  82. package/dist/chunk-rn6f0s6x.js +66 -0
  83. package/dist/chunk-rn6f0s6x.js.map +9 -0
  84. package/dist/chunk-rswzbfa2.js +422 -0
  85. package/dist/chunk-rswzbfa2.js.map +10 -0
  86. package/dist/chunk-rzns0reg.js +157 -0
  87. package/dist/chunk-rzns0reg.js.map +10 -0
  88. package/dist/chunk-s851vtje.js +90 -0
  89. package/dist/chunk-s851vtje.js.map +10 -0
  90. package/dist/chunk-vak164kx.js +15 -0
  91. package/dist/chunk-vak164kx.js.map +9 -0
  92. package/dist/chunk-vpvnvegz.js +480 -0
  93. package/dist/chunk-vpvnvegz.js.map +10 -0
  94. package/dist/chunk-x4pk7vxm.js +10 -0
  95. package/dist/chunk-x4pk7vxm.js.map +10 -0
  96. package/dist/chunk-xd2fwgek.js +53 -0
  97. package/dist/chunk-xd2fwgek.js.map +10 -0
  98. package/dist/chunk-y71rd8qf.js +499 -0
  99. package/dist/chunk-y71rd8qf.js.map +10 -0
  100. package/dist/chunk-zjmt193s.js +34 -0
  101. package/dist/chunk-zjmt193s.js.map +9 -0
  102. package/dist/components/blocks/CustomHtmlBlock.d.ts +14 -0
  103. package/dist/components/blocks/LoginFormBlock.d.ts +16 -0
  104. package/dist/components/blocks/SidebarMenuBlock.d.ts +11 -0
  105. package/dist/components/blocks/SliderBlock.d.ts +13 -0
  106. package/dist/components/code/code-editor.d.ts +58 -0
  107. package/dist/components/code/code-preview.d.ts +18 -0
  108. package/dist/components/code/index.d.ts +4 -0
  109. package/dist/components/code/validator.d.ts +10 -0
  110. package/dist/components/code/vsc-themes.d.ts +6 -0
  111. package/dist/components/dashboard/compound/context.d.ts +14 -0
  112. package/dist/components/dashboard/compound/dashboard.d.ts +14 -0
  113. package/dist/components/dashboard/compound/index.d.ts +18 -0
  114. package/dist/components/dashboard/compound/main.d.ts +25 -0
  115. package/dist/components/dashboard/compound/sidebar.d.ts +5 -0
  116. package/dist/components/dashboard/dashboard-head-info.d.ts +38 -0
  117. package/dist/components/dashboard/dashboard-head.d.ts +19 -0
  118. package/dist/components/dashboard/dataview.d.ts +19 -0
  119. package/dist/components/dashboard/detailview.d.ts +1 -0
  120. package/dist/components/dashboard/formview.d.ts +265 -0
  121. package/dist/components/dashboard/pageformview.d.ts +79 -0
  122. package/dist/components/dashboard/styling/background-color-control.d.ts +34 -0
  123. package/dist/components/dashboard/styling/background-control.d.ts +45 -0
  124. package/dist/components/dashboard/styling/border-control.d.ts +14 -0
  125. package/dist/components/dashboard/styling/color-control.d.ts +22 -0
  126. package/dist/components/dashboard/styling/index.d.ts +7 -0
  127. package/dist/components/dashboard/styling/radius-control.d.ts +15 -0
  128. package/dist/components/dashboard/styling/spacing-control.d.ts +17 -0
  129. package/dist/components/dashboard/styling/types.d.ts +50 -0
  130. package/dist/components/document/index.d.ts +25 -0
  131. package/dist/components/ecommerce/commerce-cards.d.ts +37 -0
  132. package/dist/components/effect/action-animation.d.ts +14 -0
  133. package/dist/components/effect/element-animation.d.ts +41 -0
  134. package/dist/components/effect/page-transition.d.ts +10 -0
  135. package/dist/components/layout/BlockPalette.d.ts +14 -0
  136. package/dist/components/layout/DynamicLayout.d.ts +56 -0
  137. package/dist/components/layout/GridRow.d.ts +37 -0
  138. package/dist/components/layout/LayoutBuilder.d.ts +52 -0
  139. package/dist/components/layout/WidgetFieldsForm.d.ts +15 -0
  140. package/dist/components/ui/accordion.d.ts +36 -0
  141. package/dist/components/ui/action-bar.d.ts +46 -0
  142. package/dist/components/ui/alert.d.ts +25 -0
  143. package/dist/components/ui/animated.d.ts +41 -0
  144. package/dist/components/ui/app-shell.d.ts +53 -0
  145. package/dist/components/ui/avatar.d.ts +18 -0
  146. package/dist/components/ui/badge.d.ts +15 -0
  147. package/dist/components/ui/breadcrumb.d.ts +20 -0
  148. package/dist/components/ui/button-icon.d.ts +9 -0
  149. package/dist/components/ui/button.d.ts +37 -0
  150. package/dist/components/ui/calendar.d.ts +14 -0
  151. package/dist/components/ui/card-skeleton-aware.d.ts +2 -0
  152. package/dist/components/ui/card.d.ts +36 -0
  153. package/dist/components/ui/chart.d.ts +75 -0
  154. package/dist/components/ui/chat-bubble.d.ts +74 -0
  155. package/dist/components/ui/code.d.ts +85 -0
  156. package/dist/components/ui/code.js +21 -0
  157. package/dist/components/ui/code.js.map +9 -0
  158. package/dist/components/ui/collapsible.d.ts +25 -0
  159. package/dist/components/ui/control-group.d.ts +39 -0
  160. package/dist/components/ui/dashboard-grid/DashboardDropSlot.d.ts +10 -0
  161. package/dist/components/ui/dashboard-grid/DashboardGrid.d.ts +5 -0
  162. package/dist/components/ui/dashboard-grid/DashboardWidgetCard.d.ts +43 -0
  163. package/dist/components/ui/dashboard-grid/useDashboardDnd.d.ts +36 -0
  164. package/dist/components/ui/data-empty.d.ts +24 -0
  165. package/dist/components/ui/data-list.d.ts +16 -0
  166. package/dist/components/ui/data-table.d.ts +48 -0
  167. package/dist/components/ui/data-view/DataView.d.ts +46 -0
  168. package/dist/components/ui/data-view/DataViewCalendar.d.ts +18 -0
  169. package/dist/components/ui/data-view/DataViewContent.d.ts +5 -0
  170. package/dist/components/ui/data-view/DataViewFilter.d.ts +8 -0
  171. package/dist/components/ui/data-view/DataViewGrid.d.ts +32 -0
  172. package/dist/components/ui/data-view/DataViewHeader.d.ts +22 -0
  173. package/dist/components/ui/data-view/DataViewKanban.d.ts +16 -0
  174. package/dist/components/ui/data-view/DataViewPivot.d.ts +15 -0
  175. package/dist/components/ui/data-view/DataViewTable.d.ts +33 -0
  176. package/dist/components/ui/data-view/index.d.ts +9 -0
  177. package/dist/components/ui/date-time-picker.d.ts +205 -0
  178. package/dist/components/ui/drawer.d.ts +71 -0
  179. package/dist/components/ui/dropdown-animation.d.ts +7 -0
  180. package/dist/components/ui/dropdown.d.ts +71 -0
  181. package/dist/components/ui/error-state.d.ts +15 -0
  182. package/dist/components/ui/filter-bar.d.ts +50 -0
  183. package/dist/components/ui/filter-bar.js +19 -0
  184. package/dist/components/ui/filter-bar.js.map +9 -0
  185. package/dist/components/ui/font.d.ts +24 -0
  186. package/dist/components/ui/form-advanced.d.ts +198 -0
  187. package/dist/components/ui/form-compound.d.ts +58 -0
  188. package/dist/components/ui/form-context.d.ts +19 -0
  189. package/dist/components/ui/form.d.ts +451 -0
  190. package/dist/components/ui/format-currency.d.ts +10 -0
  191. package/dist/components/ui/format-date.d.ts +28 -0
  192. package/dist/components/ui/format-number.d.ts +22 -0
  193. package/dist/components/ui/format-time.d.ts +5 -0
  194. package/dist/components/ui/grid.d.ts +30 -0
  195. package/dist/components/ui/heading.d.ts +9 -0
  196. package/dist/components/ui/indicator.d.ts +17 -0
  197. package/dist/components/ui/initial-icon.d.ts +11 -0
  198. package/dist/components/ui/input-code.d.ts +27 -0
  199. package/dist/components/ui/input-grid.d.ts +54 -0
  200. package/dist/components/ui/input.d.ts +37 -0
  201. package/dist/components/ui/invoice-blocks.d.ts +124 -0
  202. package/dist/components/ui/invoice-document.d.ts +63 -0
  203. package/dist/components/ui/kanban.d.ts +16 -0
  204. package/dist/components/ui/label.d.ts +4 -0
  205. package/dist/components/ui/lazy-load.d.ts +13 -0
  206. package/dist/components/ui/lightbox.d.ts +15 -0
  207. package/dist/components/ui/list.d.ts +33 -0
  208. package/dist/components/ui/loading.d.ts +79 -0
  209. package/dist/components/ui/media-card.d.ts +50 -0
  210. package/dist/components/ui/media-player.d.ts +47 -0
  211. package/dist/components/ui/menu.d.ts +24 -0
  212. package/dist/components/ui/modal.d.ts +233 -0
  213. package/dist/components/ui/page.d.ts +51 -0
  214. package/dist/components/ui/pagination.d.ts +16 -0
  215. package/dist/components/ui/print.d.ts +173 -0
  216. package/dist/components/ui/project-card.d.ts +43 -0
  217. package/dist/components/ui/radius-control.d.ts +36 -0
  218. package/dist/components/ui/rich-text-editor.d.ts +32 -0
  219. package/dist/components/ui/select-card.d.ts +56 -0
  220. package/dist/components/ui/sidebar-logo.d.ts +11 -0
  221. package/dist/components/ui/sidebar-menu.d.ts +82 -0
  222. package/dist/components/ui/sidebar-search.d.ts +7 -0
  223. package/dist/components/ui/skeletons.d.ts +46 -0
  224. package/dist/components/ui/surface.d.ts +13 -0
  225. package/dist/components/ui/table-pivot.d.ts +10 -0
  226. package/dist/components/ui/table.d.ts +258 -0
  227. package/dist/components/ui/tabs.d.ts +79 -0
  228. package/dist/components/ui/task-board.d.ts +29 -0
  229. package/dist/components/ui/terminal.d.ts +51 -0
  230. package/dist/components/ui/text-sensor.d.ts +9 -0
  231. package/dist/components/ui/theme-styler.d.ts +3 -0
  232. package/dist/components/ui/theme-toggle.d.ts +23 -0
  233. package/dist/components/ui/tooltip.d.ts +11 -0
  234. package/dist/components/website/account-banner.d.ts +11 -0
  235. package/dist/components/website/account-layout.d.ts +20 -0
  236. package/dist/components/website/account.d.ts +46 -0
  237. package/dist/components/website/ambient.d.ts +19 -0
  238. package/dist/components/website/auth.d.ts +35 -0
  239. package/dist/components/website/blog/blog-list-custom.d.ts +3 -0
  240. package/dist/components/website/blog/blog-list-gallery.d.ts +2 -0
  241. package/dist/components/website/blog/blog-list-grid.d.ts +2 -0
  242. package/dist/components/website/blog/blog-list-list.d.ts +2 -0
  243. package/dist/components/website/blog.d.ts +50 -0
  244. package/dist/components/website/carousel.d.ts +58 -0
  245. package/dist/components/website/cart.d.ts +31 -0
  246. package/dist/components/website/catalogue-view.d.ts +81 -0
  247. package/dist/components/website/catalogue.d.ts +96 -0
  248. package/dist/components/website/comment.d.ts +52 -0
  249. package/dist/components/website/eclipse.d.ts +15 -0
  250. package/dist/components/website/feature-grid.d.ts +58 -0
  251. package/dist/components/website/filter.d.ts +109 -0
  252. package/dist/components/website/hero.d.ts +89 -0
  253. package/dist/components/website/localize.d.ts +36 -0
  254. package/dist/components/website/logo.d.ts +24 -0
  255. package/dist/components/website/megamenu.d.ts +10 -0
  256. package/dist/components/website/navbar.d.ts +42 -0
  257. package/dist/components/website/notification.d.ts +58 -0
  258. package/dist/components/website/price.d.ts +26 -0
  259. package/dist/components/website/pricing.d.ts +21 -0
  260. package/dist/components/website/product.d.ts +32 -0
  261. package/dist/components/website/rating.d.ts +36 -0
  262. package/dist/components/website/review-form.d.ts +54 -0
  263. package/dist/components/website/reviews.d.ts +119 -0
  264. package/dist/components/website/search.d.ts +30 -0
  265. package/dist/entries/accordion.d.ts +1 -0
  266. package/dist/entries/accordion.js +9 -0
  267. package/dist/entries/accordion.js.map +9 -0
  268. package/dist/entries/alert.d.ts +1 -0
  269. package/dist/entries/alert.js +10 -0
  270. package/dist/entries/alert.js.map +9 -0
  271. package/dist/entries/badge.d.ts +1 -0
  272. package/dist/entries/badge.js +11 -0
  273. package/dist/entries/badge.js.map +9 -0
  274. package/dist/entries/breadcrumb.d.ts +1 -0
  275. package/dist/entries/breadcrumb.js +10 -0
  276. package/dist/entries/breadcrumb.js.map +9 -0
  277. package/dist/entries/button.d.ts +1 -0
  278. package/dist/entries/button.js +12 -0
  279. package/dist/entries/button.js.map +9 -0
  280. package/dist/entries/card.d.ts +1 -0
  281. package/dist/entries/card.js +25 -0
  282. package/dist/entries/card.js.map +9 -0
  283. package/dist/entries/chart.d.ts +1 -0
  284. package/dist/entries/chart.js +130 -0
  285. package/dist/entries/chart.js.map +10 -0
  286. package/dist/entries/components.d.ts +53 -0
  287. package/dist/entries/components.js +643 -0
  288. package/dist/entries/components.js.map +9 -0
  289. package/dist/entries/dashboard/dataview.d.ts +1 -0
  290. package/dist/entries/dashboard/dataview.js +82 -0
  291. package/dist/entries/dashboard/dataview.js.map +10 -0
  292. package/dist/entries/dashboard/pageformview.d.ts +1 -0
  293. package/dist/entries/dashboard/pageformview.js +34 -0
  294. package/dist/entries/dashboard/pageformview.js.map +9 -0
  295. package/dist/entries/data-table.d.ts +1 -0
  296. package/dist/entries/data-table.js +22 -0
  297. package/dist/entries/data-table.js.map +9 -0
  298. package/dist/entries/date-time-picker.d.ts +1 -0
  299. package/dist/entries/date-time-picker.js +28 -0
  300. package/dist/entries/date-time-picker.js.map +9 -0
  301. package/dist/entries/document.d.ts +1 -0
  302. package/dist/entries/document.js +69 -0
  303. package/dist/entries/document.js.map +10 -0
  304. package/dist/entries/drawer.d.ts +1 -0
  305. package/dist/entries/drawer.js +20 -0
  306. package/dist/entries/drawer.js.map +9 -0
  307. package/dist/entries/dropdown.d.ts +1 -0
  308. package/dist/entries/dropdown.js +29 -0
  309. package/dist/entries/dropdown.js.map +9 -0
  310. package/dist/entries/error-state.d.ts +1 -0
  311. package/dist/entries/error-state.js +14 -0
  312. package/dist/entries/error-state.js.map +9 -0
  313. package/dist/entries/favorite-button.d.ts +1 -0
  314. package/dist/entries/favorite-button.js +7 -0
  315. package/dist/entries/favorite-button.js.map +10 -0
  316. package/dist/entries/font.d.ts +1 -0
  317. package/dist/entries/font.js +10 -0
  318. package/dist/entries/font.js.map +9 -0
  319. package/dist/entries/form-advanced.d.ts +1 -0
  320. package/dist/entries/form-advanced.js +39 -0
  321. package/dist/entries/form-advanced.js.map +9 -0
  322. package/dist/entries/form.d.ts +1 -0
  323. package/dist/entries/form.js +74 -0
  324. package/dist/entries/form.js.map +9 -0
  325. package/dist/entries/heading.d.ts +1 -0
  326. package/dist/entries/heading.js +8 -0
  327. package/dist/entries/heading.js.map +9 -0
  328. package/dist/entries/input.d.ts +1 -0
  329. package/dist/entries/input.js +11 -0
  330. package/dist/entries/input.js.map +9 -0
  331. package/dist/entries/layout.d.ts +4 -0
  332. package/dist/entries/layout.js +101 -0
  333. package/dist/entries/layout.js.map +9 -0
  334. package/dist/entries/lazy-load.d.ts +1 -0
  335. package/dist/entries/lazy-load.js +9 -0
  336. package/dist/entries/lazy-load.js.map +9 -0
  337. package/dist/entries/list.d.ts +1 -0
  338. package/dist/entries/list.js +13 -0
  339. package/dist/entries/list.js.map +9 -0
  340. package/dist/entries/loading.d.ts +1 -0
  341. package/dist/entries/loading.js +18 -0
  342. package/dist/entries/loading.js.map +9 -0
  343. package/dist/entries/menu.d.ts +1 -0
  344. package/dist/entries/menu.js +17 -0
  345. package/dist/entries/menu.js.map +9 -0
  346. package/dist/entries/modal.d.ts +1 -0
  347. package/dist/entries/modal.js +33 -0
  348. package/dist/entries/modal.js.map +9 -0
  349. package/dist/entries/product.d.ts +2 -0
  350. package/dist/entries/product.js +10 -0
  351. package/dist/entries/product.js.map +9 -0
  352. package/dist/entries/select-card.d.ts +1 -0
  353. package/dist/entries/select-card.js +13 -0
  354. package/dist/entries/select-card.js.map +9 -0
  355. package/dist/entries/skeletons.d.ts +1 -0
  356. package/dist/entries/skeletons.js +35 -0
  357. package/dist/entries/skeletons.js.map +9 -0
  358. package/dist/entries/surface.d.ts +1 -0
  359. package/dist/entries/surface.js +10 -0
  360. package/dist/entries/surface.js.map +9 -0
  361. package/dist/entries/table.d.ts +1 -0
  362. package/dist/entries/table.js +65 -0
  363. package/dist/entries/table.js.map +9 -0
  364. package/dist/entries/tabs.d.ts +1 -0
  365. package/dist/entries/tabs.js +20 -0
  366. package/dist/entries/tabs.js.map +9 -0
  367. package/dist/entries/theme-styler.d.ts +1 -0
  368. package/dist/entries/theme-styler.js +26 -0
  369. package/dist/entries/theme-styler.js.map +9 -0
  370. package/dist/entries/toast.d.ts +1 -0
  371. package/dist/entries/toast.js +13 -0
  372. package/dist/entries/toast.js.map +9 -0
  373. package/dist/index.d.ts +163 -0
  374. package/dist/index.js +19864 -0
  375. package/dist/index.js.map +92 -0
  376. package/dist/lib/color/className.d.ts +14 -0
  377. package/dist/lib/color/config.d.ts +82 -0
  378. package/dist/lib/color/engine.d.ts +221 -0
  379. package/dist/lib/color/generator.d.ts +45 -0
  380. package/dist/lib/color/index.d.ts +5 -0
  381. package/dist/lib/color/safelist.d.ts +1 -0
  382. package/dist/lib/color/types.d.ts +12 -0
  383. package/dist/lib/font/config.d.ts +13 -0
  384. package/dist/lib/font/engine.d.ts +77 -0
  385. package/dist/lib/font/index.d.ts +3 -0
  386. package/dist/lib/font/types.d.ts +27 -0
  387. package/dist/lib/icon/config.d.ts +37 -0
  388. package/dist/lib/icon/engine.d.ts +84 -0
  389. package/dist/lib/icon/index.d.ts +3 -0
  390. package/dist/lib/icon/presets.d.ts +71 -0
  391. package/dist/lib/layout/config.d.ts +7 -0
  392. package/dist/lib/layout/engine.d.ts +224 -0
  393. package/dist/lib/layout/types.d.ts +151 -0
  394. package/dist/lib/layout/useActiveBreakpoint.d.ts +14 -0
  395. package/dist/lib/layout/useBlockDrag.d.ts +47 -0
  396. package/dist/lib/layout/useSectionDrag.d.ts +30 -0
  397. package/dist/lib/layout/useSpanResize.d.ts +31 -0
  398. package/dist/lib/localize/data.d.ts +9 -0
  399. package/dist/lib/product-utils.d.ts +7 -0
  400. package/dist/lib/sanitize/sanitizeHtml.d.ts +52 -0
  401. package/dist/lib/theme/motion.d.ts +27 -0
  402. package/dist/lib/theme/motion.js +12 -0
  403. package/dist/lib/theme/motion.js.map +9 -0
  404. package/dist/lib/theme/types.d.ts +133 -0
  405. package/dist/lib/useUndoRedo.d.ts +21 -0
  406. package/dist/lib/utils.d.ts +2 -0
  407. package/dist/types/product.d.ts +27 -0
  408. package/package.json +442 -4
@@ -0,0 +1,1686 @@
1
+ import {
2
+ cn2
3
+ } from "./chunk-x4pk7vxm.js";
4
+ import {
5
+ Collapsible2,
6
+ CollapsibleContent2
7
+ } from "./chunk-1t1fbbme.js";
8
+ import {
9
+ Card2
10
+ } from "./chunk-h6k57hyd.js";
11
+ import {
12
+ Tabs2,
13
+ TabList2,
14
+ Tab2,
15
+ TabPanels2,
16
+ TabPanel2
17
+ } from "./chunk-y71rd8qf.js";
18
+ import {
19
+ __preload,
20
+ __chunks
21
+ } from "./chunk-zjmt193s.js";
22
+
23
+ // src/components/ui/code.tsx
24
+ import * as React2 from "react";
25
+ import { Copy as Copy2, Check as Check2, Download as Download2, WrapText as WrapText2, ChevronDown as ChevronDown2, Code2 as Code22, Globe, Braces } from "lucide-react";
26
+
27
+ // src/components/code/code-editor.tsx
28
+ import * as React from "react";
29
+ import { createPortal } from "react-dom";
30
+ import ace2 from "ace-builds";
31
+ import {
32
+ Copy,
33
+ Check,
34
+ Download,
35
+ WrapText,
36
+ RotateCcw,
37
+ RotateCw,
38
+ Trash2,
39
+ Info,
40
+ Sun,
41
+ Moon,
42
+ ChevronDown,
43
+ Search
44
+ } from "lucide-react";
45
+
46
+ // src/components/code/vsc-themes.ts
47
+ import ace from "ace-builds";
48
+ if (typeof window !== "undefined") {
49
+ window.ace = window.ace || ace;
50
+ }
51
+ if (typeof globalThis !== "undefined") {
52
+ globalThis.ace = globalThis.ace || ace;
53
+ }
54
+ var VSC_DARK_PLUS_CSS = `
55
+ .ace-vsc-dark-plus {
56
+ background-color: #1e1e1e !important;
57
+ color: #d4d4d4 !important;
58
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
59
+ }
60
+
61
+ .ace-vsc-dark-plus .ace_gutter {
62
+ background: #1e1e1e !important;
63
+ color: #858585 !important;
64
+ border-right: 1px solid rgba(255, 255, 255, 0.07) !important;
65
+ }
66
+
67
+ .ace-vsc-dark-plus .ace_gutter-active-line {
68
+ background-color: #282828 !important;
69
+ color: #c6c6c6 !important;
70
+ }
71
+
72
+ .ace-vsc-dark-plus .ace_print-margin {
73
+ width: 1px;
74
+ background: rgba(255, 255, 255, 0.08);
75
+ }
76
+
77
+ .ace-vsc-dark-plus .ace_cursor {
78
+ color: #aeafad !important;
79
+ }
80
+
81
+ .ace-vsc-dark-plus .ace_marker-layer .ace_selection {
82
+ background: #264F78 !important;
83
+ }
84
+
85
+ .ace-vsc-dark-plus .ace_marker-layer .ace_step {
86
+ background: #c6dbae !important;
87
+ }
88
+
89
+ .ace-vsc-dark-plus .ace_marker-layer .ace_bracket {
90
+ margin: -1px 0 0 -1px;
91
+ border: 1px solid #747369;
92
+ }
93
+
94
+ .ace-vsc-dark-plus .ace_marker-layer .ace_active-line {
95
+ background: rgba(255, 255, 255, 0.05) !important;
96
+ }
97
+
98
+ .ace-vsc-dark-plus .ace_marker-layer .ace_selected-word {
99
+ border: 1px solid #3d4350;
100
+ }
101
+
102
+ .ace-vsc-dark-plus .ace_fold {
103
+ background-color: #569cd6 !important;
104
+ border-color: #858585 !important;
105
+ }
106
+
107
+ /* 1. KEYWORDS (import, from, export, default, return, if, else, etc.) -> Ungu */
108
+ .ace-vsc-dark-plus .ace_keyword {
109
+ color: #c586c0 !important;
110
+ }
111
+
112
+ /* 2. STORAGE / DECLARATION (const, let, var, function, class, type) -> Biru */
113
+ .ace-vsc-dark-plus .ace_storage,
114
+ .ace-vsc-dark-plus .ace_storage.ace_type {
115
+ color: #569cd6 !important;
116
+ }
117
+
118
+ /* 3. FUNCTION NAMES (InputCodeDemo2, useState, console.log) -> Kuning Emas */
119
+ .ace-vsc-dark-plus .ace_entity.ace_name.ace_function,
120
+ .ace-vsc-dark-plus .ace_support.ace_function {
121
+ color: #dcdcaa !important;
122
+ }
123
+
124
+ /* 4. REACT COMPONENTS / CLASSES / TYPES (React, InputCode, Button) -> Teal */
125
+ .ace-vsc-dark-plus .ace_support.ace_class,
126
+ .ace-vsc-dark-plus .ace_support.ace_type,
127
+ .ace-vsc-dark-plus .ace_entity.ace_name.ace_type,
128
+ .ace-vsc-dark-plus .ace_support.ace_class.ace_component,
129
+ .ace-vsc-dark-plus .ace_support.ace_class.ace_identifier {
130
+ color: #4ec9b0 !important;
131
+ }
132
+
133
+ /* 5. IDENTIFIERS & VARIABLES (code3, setCode3, props) -> Biru Muda */
134
+ .ace-vsc-dark-plus .ace_identifier,
135
+ .ace-vsc-dark-plus .ace_variable,
136
+ .ace-vsc-dark-plus .ace_variable.ace_parameter {
137
+ color: #9cdcfe !important;
138
+ }
139
+
140
+ /* 6. STRINGS ('react', '@deweb/ui-kit', "flex") -> Cokelat Oranye */
141
+ .ace-vsc-dark-plus .ace_string,
142
+ .ace-vsc-dark-plus .ace_string.ace_attribute-value {
143
+ color: #ce9178 !important;
144
+ }
145
+
146
+ /* 7. NUMBERS (6, 10, 100) -> Hijau Muda */
147
+ .ace-vsc-dark-plus .ace_constant.ace_numeric {
148
+ color: #b5cea8 !important;
149
+ }
150
+
151
+ /* 8. CONSTANTS & BOOLEANS (true, false, null, undefined) -> Biru */
152
+ .ace-vsc-dark-plus .ace_constant.ace_language {
153
+ color: #569cd6 !important;
154
+ }
155
+
156
+ /* 9. COMMENTS (// @ts-nocheck, /* ... * /) -> Hijau */
157
+ .ace-vsc-dark-plus .ace_comment {
158
+ color: #6a9955 !important;
159
+ font-style: italic !important;
160
+ }
161
+
162
+ /* 10. REGEX (/^[a-zA-Z0-9]$/) -> Merah Bata */
163
+ .ace-vsc-dark-plus .ace_string.ace_regexp {
164
+ color: #d16969 !important;
165
+ }
166
+
167
+ /* 11. HTML / XML / JSX TAGS */
168
+ /* Simbol kurung siku tag (<, >, </, />) -> Abu-abu */
169
+ .ace-vsc-dark-plus .ace_meta.ace_tag.ace_punctuation,
170
+ .ace-vsc-dark-plus .ace_meta.ace_tag .ace_punctuation {
171
+ color: #808080 !important;
172
+ }
173
+
174
+ /* Nama tag bawaan (div, h3, p, span) -> Biru */
175
+ .ace-vsc-dark-plus .ace_meta.ace_tag.ace_tag-name,
176
+ .ace-vsc-dark-plus .ace_entity.ace_name.ace_tag {
177
+ color: #569cd6 !important;
178
+ }
179
+
180
+ /* Nama tag komponen React (InputCode) -> Teal */
181
+ .ace-vsc-dark-plus .ace_support.ace_class.ace_component.ace_xml {
182
+ color: #4ec9b0 !important;
183
+ }
184
+
185
+ /* 12. ATTRIBUTES (className, length, pattern, id, style) -> Biru Muda */
186
+ .ace-vsc-dark-plus .ace_entity.ace_other.ace_attribute-name {
187
+ color: #9cdcfe !important;
188
+ }
189
+
190
+ /* 13. CSS RULES */
191
+ .ace-vsc-dark-plus .ace_entity.ace_other.ace_attribute-name.ace_class {
192
+ color: #d7ba7d !important;
193
+ }
194
+ .ace-vsc-dark-plus .ace_entity.ace_other.ace_attribute-name.ace_id {
195
+ color: #569cd6 !important;
196
+ }
197
+ .ace-vsc-dark-plus .ace_support.ace_type.ace_property-name {
198
+ color: #9cdcfe !important;
199
+ }
200
+ .ace-vsc-dark-plus .ace_support.ace_constant.ace_property-value {
201
+ color: #ce9178 !important;
202
+ }
203
+
204
+ /* 14. OPERATORS & PUNCTUATION (=, +, -, *, /, =>, {, }, (, )) */
205
+ .ace-vsc-dark-plus .ace_keyword.ace_operator {
206
+ color: #d4d4d4 !important;
207
+ }
208
+ .ace-vsc-dark-plus .ace_paren,
209
+ .ace-vsc-dark-plus .ace_punctuation.ace_operator {
210
+ color: #d4d4d4 !important;
211
+ }
212
+
213
+ /* 15. SCROLLBAR MODERN VS CODE DARK */
214
+ .ace-vsc-dark-plus .ace_scrollbar {
215
+ z-index: 15 !important;
216
+ }
217
+ .ace-vsc-dark-plus .ace_scrollbar::-webkit-scrollbar {
218
+ width: 10px;
219
+ height: 10px;
220
+ }
221
+ .ace-vsc-dark-plus .ace_scrollbar::-webkit-scrollbar-track {
222
+ background: transparent;
223
+ }
224
+ .ace-vsc-dark-plus .ace_scrollbar::-webkit-scrollbar-thumb {
225
+ background: rgba(255, 255, 255, 0.22);
226
+ border-radius: 5px;
227
+ border: 2px solid transparent;
228
+ background-clip: padding-box;
229
+ }
230
+ .ace-vsc-dark-plus .ace_scrollbar::-webkit-scrollbar-thumb:hover {
231
+ background: rgba(255, 255, 255, 0.38);
232
+ background-clip: padding-box;
233
+ }
234
+
235
+ /* 16. FLOATING SEARCHBOX DARK MODE */
236
+ .ace-vsc-dark-plus .ace_search {
237
+ background: #252526 !important;
238
+ color: #d4d4d4 !important;
239
+ border: 1px solid rgba(255, 255, 255, 0.15) !important;
240
+ border-top: none !important;
241
+ box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5) !important;
242
+ border-radius: 0 0 6px 6px !important;
243
+ padding: 6px 10px !important;
244
+ }
245
+ .ace-vsc-dark-plus .ace_search_field {
246
+ background: #3c3c3c !important;
247
+ color: #ffffff !important;
248
+ border: 1px solid rgba(255, 255, 255, 0.2) !important;
249
+ border-radius: 4px !important;
250
+ padding: 3px 8px !important;
251
+ outline: none !important;
252
+ }
253
+ .ace-vsc-dark-plus .ace_search_field:focus {
254
+ border-color: #569cd6 !important;
255
+ }
256
+ .ace-vsc-dark-plus .ace_searchbtn {
257
+ background: #333333 !important;
258
+ color: #cccccc !important;
259
+ border: 1px solid rgba(255, 255, 255, 0.12) !important;
260
+ border-radius: 4px !important;
261
+ margin: 0 2px !important;
262
+ }
263
+ .ace-vsc-dark-plus .ace_searchbtn:hover {
264
+ background: #444444 !important;
265
+ color: #ffffff !important;
266
+ }
267
+ .ace-vsc-dark-plus .ace_button {
268
+ background: #333333 !important;
269
+ color: #cccccc !important;
270
+ border: 1px solid rgba(255, 255, 255, 0.15) !important;
271
+ border-radius: 4px !important;
272
+ }
273
+ .ace-vsc-dark-plus .ace_button.checked {
274
+ background: #094771 !important;
275
+ border-color: #007acc !important;
276
+ color: #ffffff !important;
277
+ }
278
+ .ace-vsc-dark-plus .ace_search_counter {
279
+ color: #858585 !important;
280
+ }
281
+ `;
282
+ var VSC_LIGHT_PLUS_CSS = `
283
+ .ace-vsc-light-plus {
284
+ background-color: #ffffff !important;
285
+ color: #000000 !important;
286
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
287
+ }
288
+
289
+ .ace-vsc-light-plus .ace_gutter {
290
+ background: #ffffff !important;
291
+ color: #237893 !important;
292
+ border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
293
+ }
294
+
295
+ .ace-vsc-light-plus .ace_gutter-active-line {
296
+ background-color: #f3f3f3 !important;
297
+ color: #0b216f !important;
298
+ }
299
+
300
+ .ace-vsc-light-plus .ace_print-margin {
301
+ width: 1px;
302
+ background: rgba(0, 0, 0, 0.08);
303
+ }
304
+
305
+ .ace-vsc-light-plus .ace_cursor {
306
+ color: #000000 !important;
307
+ }
308
+
309
+ .ace-vsc-light-plus .ace_marker-layer .ace_selection {
310
+ background: #add6ff !important;
311
+ }
312
+
313
+ .ace-vsc-light-plus .ace_marker-layer .ace_active-line {
314
+ background: #f8f8f8 !important;
315
+ }
316
+
317
+ .ace-vsc-light-plus .ace_fold {
318
+ background-color: #0000ff !important;
319
+ border-color: #237893 !important;
320
+ }
321
+
322
+ /* 1. KEYWORDS (import, from, export, default, return) -> Ungu */
323
+ .ace-vsc-light-plus .ace_keyword {
324
+ color: #af00db !important;
325
+ }
326
+
327
+ /* 2. STORAGE (const, let, var, function, class) -> Biru */
328
+ .ace-vsc-light-plus .ace_storage,
329
+ .ace-vsc-light-plus .ace_storage.ace_type {
330
+ color: #0000ff !important;
331
+ }
332
+
333
+ /* 3. FUNCTION NAMES -> Cokelat Emas */
334
+ .ace-vsc-light-plus .ace_entity.ace_name.ace_function,
335
+ .ace-vsc-light-plus .ace_support.ace_function {
336
+ color: #795e26 !important;
337
+ }
338
+
339
+ /* 4. REACT COMPONENTS / CLASSES -> Teal Biru */
340
+ .ace-vsc-light-plus .ace_support.ace_class,
341
+ .ace-vsc-light-plus .ace_support.ace_type,
342
+ .ace-vsc-light-plus .ace_entity.ace_name.ace_type,
343
+ .ace-vsc-light-plus .ace_support.ace_class.ace_component,
344
+ .ace-vsc-light-plus .ace_support.ace_class.ace_identifier {
345
+ color: #267f99 !important;
346
+ }
347
+
348
+ /* 5. IDENTIFIERS & VARIABLES -> Biru Tua */
349
+ .ace-vsc-light-plus .ace_identifier,
350
+ .ace-vsc-light-plus .ace_variable,
351
+ .ace-vsc-light-plus .ace_variable.ace_parameter {
352
+ color: #001080 !important;
353
+ }
354
+
355
+ /* 6. STRINGS -> Merah Gelap */
356
+ .ace-vsc-light-plus .ace_string,
357
+ .ace-vsc-light-plus .ace_string.ace_attribute-value {
358
+ color: #a31515 !important;
359
+ }
360
+
361
+ /* 7. NUMBERS -> Hijau Gelap */
362
+ .ace-vsc-light-plus .ace_constant.ace_numeric {
363
+ color: #098658 !important;
364
+ }
365
+
366
+ /* 8. CONSTANTS -> Biru */
367
+ .ace-vsc-light-plus .ace_constant.ace_language {
368
+ color: #0000ff !important;
369
+ }
370
+
371
+ /* 9. COMMENTS -> Hijau */
372
+ .ace-vsc-light-plus .ace_comment {
373
+ color: #008000 !important;
374
+ font-style: italic !important;
375
+ }
376
+
377
+ /* 10. TAGS & PUNCTUATION */
378
+ .ace-vsc-light-plus .ace_meta.ace_tag.ace_punctuation,
379
+ .ace-vsc-light-plus .ace_meta.ace_tag .ace_punctuation {
380
+ color: #800000 !important;
381
+ }
382
+
383
+ .ace-vsc-light-plus .ace_meta.ace_tag.ace_tag-name,
384
+ .ace-vsc-light-plus .ace_entity.ace_name.ace_tag {
385
+ color: #800000 !important;
386
+ }
387
+
388
+ .ace-vsc-light-plus .ace_support.ace_class.ace_component.ace_xml {
389
+ color: #267f99 !important;
390
+ }
391
+
392
+ /* 11. ATTRIBUTES -> Merah */
393
+ .ace-vsc-light-plus .ace_entity.ace_other.ace_attribute-name {
394
+ color: #e50000 !important;
395
+ }
396
+
397
+ /* 12. CSS RULES */
398
+ .ace-vsc-light-plus .ace_entity.ace_other.ace_attribute-name.ace_class {
399
+ color: #267f99 !important;
400
+ }
401
+ .ace-vsc-light-plus .ace_support.ace_type.ace_property-name {
402
+ color: #001080 !important;
403
+ }
404
+
405
+ .ace-vsc-light-plus .ace_keyword.ace_operator {
406
+ color: #000000 !important;
407
+ }
408
+
409
+ /* 13. SCROLLBAR MODERN VS CODE LIGHT */
410
+ .ace-vsc-light-plus .ace_scrollbar {
411
+ z-index: 15 !important;
412
+ }
413
+ .ace-vsc-light-plus .ace_scrollbar::-webkit-scrollbar {
414
+ width: 10px;
415
+ height: 10px;
416
+ }
417
+ .ace-vsc-light-plus .ace_scrollbar::-webkit-scrollbar-track {
418
+ background: transparent;
419
+ }
420
+ .ace-vsc-light-plus .ace_scrollbar::-webkit-scrollbar-thumb {
421
+ background: rgba(0, 0, 0, 0.22);
422
+ border-radius: 5px;
423
+ border: 2px solid transparent;
424
+ background-clip: padding-box;
425
+ }
426
+ .ace-vsc-light-plus .ace_scrollbar::-webkit-scrollbar-thumb:hover {
427
+ background: rgba(0, 0, 0, 0.4);
428
+ background-clip: padding-box;
429
+ }
430
+
431
+ /* 14. FLOATING SEARCHBOX LIGHT MODE */
432
+ .ace-vsc-light-plus .ace_search {
433
+ background: #f3f3f3 !important;
434
+ color: #333333 !important;
435
+ border: 1px solid #d4d4d4 !important;
436
+ border-top: none !important;
437
+ box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15) !important;
438
+ border-radius: 0 0 6px 6px !important;
439
+ padding: 6px 10px !important;
440
+ }
441
+ .ace-vsc-light-plus .ace_search_field {
442
+ background: #ffffff !important;
443
+ color: #000000 !important;
444
+ border: 1px solid #cccccc !important;
445
+ border-radius: 4px !important;
446
+ padding: 3px 8px !important;
447
+ outline: none !important;
448
+ }
449
+ .ace-vsc-light-plus .ace_search_field:focus {
450
+ border-color: #007acc !important;
451
+ }
452
+ .ace-vsc-light-plus .ace_searchbtn {
453
+ background: #ffffff !important;
454
+ color: #333333 !important;
455
+ border: 1px solid #cccccc !important;
456
+ border-radius: 4px !important;
457
+ margin: 0 2px !important;
458
+ }
459
+ .ace-vsc-light-plus .ace_searchbtn:hover {
460
+ background: #e8e8e8 !important;
461
+ }
462
+ .ace-vsc-light-plus .ace_button {
463
+ background: #ffffff !important;
464
+ color: #333333 !important;
465
+ border: 1px solid #cccccc !important;
466
+ border-radius: 4px !important;
467
+ }
468
+ .ace-vsc-light-plus .ace_button.checked {
469
+ background: #e5f1fb !important;
470
+ border-color: #007acc !important;
471
+ color: #007acc !important;
472
+ }
473
+ .ace-vsc-light-plus .ace_search_counter {
474
+ color: #666666 !important;
475
+ }
476
+ `;
477
+ function registerVscThemes() {
478
+ if (typeof window === "undefined")
479
+ return;
480
+ try {
481
+ const aceTarget = typeof window !== "undefined" && window.ace ? window.ace : ace;
482
+ const aceAny = aceTarget;
483
+ if (!aceAny || !aceAny.define)
484
+ return;
485
+ aceAny.define("ace/theme/vsc_dark_plus-css", ["require", "exports", "module"], function(_req, _exports, module) {
486
+ module.exports = VSC_DARK_PLUS_CSS;
487
+ });
488
+ aceAny.define("ace/theme/vsc_dark_plus", ["require", "exports", "module", "ace/theme/vsc_dark_plus-css", "ace/lib/dom"], function(require2, exports) {
489
+ exports.isDark = true;
490
+ exports.cssClass = "ace-vsc-dark-plus";
491
+ exports.cssText = require2("./vsc_dark_plus-css");
492
+ const dom = require2("../lib/dom");
493
+ if (dom && dom.importCssString) {
494
+ dom.importCssString(exports.cssText, exports.cssClass, false);
495
+ }
496
+ });
497
+ aceAny.define("ace/theme/vsc_light_plus-css", ["require", "exports", "module"], function(_req, _exports, module) {
498
+ module.exports = VSC_LIGHT_PLUS_CSS;
499
+ });
500
+ aceAny.define("ace/theme/vsc_light_plus", ["require", "exports", "module", "ace/theme/vsc_light_plus-css", "ace/lib/dom"], function(require2, exports) {
501
+ exports.isDark = false;
502
+ exports.cssClass = "ace-vsc-light-plus";
503
+ exports.cssText = require2("./vsc_light_plus-css");
504
+ const dom = require2("../lib/dom");
505
+ if (dom && dom.importCssString) {
506
+ dom.importCssString(exports.cssText, exports.cssClass, false);
507
+ }
508
+ });
509
+ } catch (err) {
510
+ console.warn("[CodeEditor] Gagal mendaftarkan tema VS Code ke Ace:", err);
511
+ }
512
+ }
513
+
514
+ // src/components/code/code-editor.tsx
515
+ import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
516
+ if (typeof window !== "undefined") {
517
+ window.ace = ace2;
518
+ }
519
+ if (typeof globalThis !== "undefined") {
520
+ globalThis.ace = ace2;
521
+ }
522
+ var modesPromise = null;
523
+ function ensureAceModes2() {
524
+ if (typeof window === "undefined") {
525
+ return Promise.resolve();
526
+ }
527
+ window.ace = ace2;
528
+ globalThis.ace = ace2;
529
+ registerVscThemes();
530
+ if (!modesPromise) {
531
+ modesPromise = Promise.all([
532
+ import("ace-builds/src-noconflict/theme-one_dark"),
533
+ import("ace-builds/src-noconflict/theme-chrome"),
534
+ import("ace-builds/src-noconflict/mode-css"),
535
+ import("ace-builds/src-noconflict/mode-html"),
536
+ import("ace-builds/src-noconflict/mode-javascript"),
537
+ import("ace-builds/src-noconflict/mode-jsx"),
538
+ import("ace-builds/src-noconflict/mode-tsx"),
539
+ import("ace-builds/src-noconflict/mode-typescript"),
540
+ import("ace-builds/src-noconflict/mode-json"),
541
+ import("ace-builds/src-noconflict/mode-sql"),
542
+ import("ace-builds/src-noconflict/ext-searchbox")
543
+ ]).then(() => {
544
+ return;
545
+ });
546
+ }
547
+ return modesPromise;
548
+ }
549
+ var SUPPORTED_LANGUAGES = [
550
+ { id: "auto", label: "Otomatis" },
551
+ { id: "html", label: "HTML" },
552
+ { id: "jsx", label: "JSX / React" },
553
+ { id: "tsx", label: "TSX / React" },
554
+ { id: "javascript", label: "JavaScript" },
555
+ { id: "typescript", label: "TypeScript" },
556
+ { id: "css", label: "CSS" },
557
+ { id: "json", label: "JSON" },
558
+ { id: "sql", label: "SQL" }
559
+ ];
560
+ function resolveAceMode2(code, preferredLang) {
561
+ const p = (preferredLang || "").toLowerCase().trim();
562
+ if (p === "css")
563
+ return "ace/mode/css";
564
+ if (p === "json")
565
+ return "ace/mode/json";
566
+ if (p === "sql")
567
+ return "ace/mode/sql";
568
+ if (p === "jsx" || p === "react")
569
+ return "ace/mode/jsx";
570
+ if (p === "tsx")
571
+ return "ace/mode/tsx";
572
+ if (p === "ts" || p === "typescript")
573
+ return "ace/mode/typescript";
574
+ if (p === "js" || p === "javascript")
575
+ return "ace/mode/javascript";
576
+ if (code && typeof code === "string") {
577
+ const trimmed = code.trim();
578
+ const hasJsMarkers = /^(import\s+|export\s+|const\s+|let\s+|var\s+|function\s+|class\s+|\/\/\s*@ts)/m.test(trimmed) || /useState\(|useEffect\(|className=|<[A-Z]\w+/.test(trimmed) && !/<!DOCTYPE|<html|<head|<body/i.test(trimmed);
579
+ if (hasJsMarkers) {
580
+ if (/:\s*(string|number|boolean|any|React\.)|interface\s+\w+|type\s+\w+\s*=|as\s+\w+/i.test(trimmed)) {
581
+ return "ace/mode/tsx";
582
+ }
583
+ return "ace/mode/jsx";
584
+ }
585
+ if (/^[.#@][\w-]+\s*\{/m.test(trimmed) && !/<style/i.test(trimmed)) {
586
+ return "ace/mode/css";
587
+ }
588
+ if (/^[\{\[]\s*["']/.test(trimmed) && /[\}\]]$/.test(trimmed)) {
589
+ try {
590
+ JSON.parse(trimmed);
591
+ return "ace/mode/json";
592
+ } catch (_) {}
593
+ }
594
+ }
595
+ if (p === "html" || p === "htm")
596
+ return "ace/mode/html";
597
+ return p ? `ace/mode/${p}` : "ace/mode/html";
598
+ }
599
+ function enhanceModeTokenizer2(session) {
600
+ try {
601
+ const mode = session.getMode();
602
+ const tokenizer = mode.getTokenizer();
603
+ if (!tokenizer || tokenizer.__vscEnhanced)
604
+ return;
605
+ const origGetLineTokens = tokenizer.getLineTokens;
606
+ tokenizer.getLineTokens = function(line, startState) {
607
+ const result = origGetLineTokens.call(this, line, startState);
608
+ for (const token of result.tokens) {
609
+ if (token.type === "meta.tag.tag-name.xml" && /^[A-Z]/.test(token.value)) {
610
+ token.type = "support.class.component.xml";
611
+ } else if (token.type === "identifier" && /^[A-Z]/.test(token.value)) {
612
+ token.type = "support.class.identifier";
613
+ }
614
+ }
615
+ return result;
616
+ };
617
+ tokenizer.__vscEnhanced = true;
618
+ } catch (_) {}
619
+ }
620
+ function CodeEditor2({
621
+ value = "",
622
+ onChange,
623
+ lang = "auto",
624
+ theme = "light",
625
+ placeholder,
626
+ helpText,
627
+ rows,
628
+ height = "360px",
629
+ width,
630
+ line = true,
631
+ wrap = true,
632
+ fold = true,
633
+ highlightActiveLine = true,
634
+ readOnly = false,
635
+ downloadFilename,
636
+ languageBadge = true,
637
+ showStats = true,
638
+ allowThemeToggle = true,
639
+ allowLanguageSelect = true,
640
+ onValidationChange,
641
+ className
642
+ }) {
643
+ const containerRef = React.useRef(null);
644
+ const editorRef = React.useRef(null);
645
+ const isInternalChangeRef = React.useRef(false);
646
+ const latestValueRef = React.useRef(value);
647
+ latestValueRef.current = value;
648
+ const [selectedLang, setSelectedLang] = React.useState(lang);
649
+ const [isLangMenuOpen, setIsLangMenuOpen] = React.useState(false);
650
+ const [langMenuPos, setLangMenuPos] = React.useState({ top: 0, left: 0 });
651
+ const langMenuRef = React.useRef(null);
652
+ const langButtonRef = React.useRef(null);
653
+ const langPortalRef = React.useRef(null);
654
+ const [currentTheme, setCurrentTheme] = React.useState(() => {
655
+ if (theme === "auto") {
656
+ return typeof document !== "undefined" && document.documentElement.classList.contains("dark") ? "dark" : "light";
657
+ }
658
+ return theme;
659
+ });
660
+ const [copied, setCopied] = React.useState(false);
661
+ const [isWrapped, setIsWrapped] = React.useState(wrap);
662
+ const [showClearConfirm, setShowClearConfirm] = React.useState(false);
663
+ const [canUndo, setCanUndo] = React.useState(false);
664
+ const [canRedo, setCanRedo] = React.useState(false);
665
+ const [cursorPos, setCursorPos] = React.useState({ row: 1, col: 1 });
666
+ const [stats, setStats] = React.useState({ lines: 1, chars: 0 });
667
+ const resolvedMode = React.useMemo(() => {
668
+ return resolveAceMode2(value, selectedLang);
669
+ }, [value, selectedLang]);
670
+ const badgeLabel = React.useMemo(() => {
671
+ const parts = resolvedMode.split("/");
672
+ const modeName = parts[parts.length - 1] || "code";
673
+ if (modeName === "jsx")
674
+ return "JSX";
675
+ if (modeName === "tsx")
676
+ return "TSX";
677
+ if (modeName === "javascript")
678
+ return "JS";
679
+ if (modeName === "typescript")
680
+ return "TS";
681
+ return modeName.toUpperCase();
682
+ }, [resolvedMode]);
683
+ React.useEffect(() => {
684
+ const handleClickOutside = (event) => {
685
+ const target = event.target;
686
+ const insideTrigger = langMenuRef.current?.contains(target);
687
+ const insidePortal = langPortalRef.current?.contains(target);
688
+ if (!insideTrigger && !insidePortal) {
689
+ setIsLangMenuOpen(false);
690
+ }
691
+ };
692
+ const handleScrollOrResize = () => {
693
+ if (isLangMenuOpen && langButtonRef.current) {
694
+ const rect = langButtonRef.current.getBoundingClientRect();
695
+ setLangMenuPos({ top: rect.bottom + 4, left: rect.left });
696
+ }
697
+ };
698
+ document.addEventListener("mousedown", handleClickOutside);
699
+ window.addEventListener("scroll", handleScrollOrResize, true);
700
+ window.addEventListener("resize", handleScrollOrResize);
701
+ return () => {
702
+ document.removeEventListener("mousedown", handleClickOutside);
703
+ window.removeEventListener("scroll", handleScrollOrResize, true);
704
+ window.removeEventListener("resize", handleScrollOrResize);
705
+ };
706
+ }, [isLangMenuOpen]);
707
+ React.useEffect(() => {
708
+ if (!containerRef.current)
709
+ return;
710
+ let isMounted = true;
711
+ ensureAceModes2().then(() => {
712
+ if (!isMounted || !containerRef.current)
713
+ return;
714
+ registerVscThemes();
715
+ const editor = ace2.edit(containerRef.current, {
716
+ mode: resolvedMode,
717
+ theme: currentTheme === "dark" ? "ace/theme/vsc_dark_plus" : "ace/theme/vsc_light_plus",
718
+ value: latestValueRef.current || "",
719
+ placeholder: placeholder || undefined,
720
+ readOnly,
721
+ showLineNumbers: line,
722
+ showGutter: line,
723
+ showPrintMargin: false,
724
+ highlightActiveLine,
725
+ showFoldWidgets: fold,
726
+ foldStyle: "markbegin",
727
+ wrap: isWrapped,
728
+ tabSize: 2,
729
+ useSoftTabs: true,
730
+ fontSize: "13px",
731
+ fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",
732
+ scrollPastEnd: 0.5,
733
+ vScrollBarAlwaysVisible: true
734
+ });
735
+ editor.session.setUseWorker(false);
736
+ enhanceModeTokenizer2(editor.session);
737
+ if (onValidationChange) {
738
+ onValidationChange(true, []);
739
+ }
740
+ editor.commands.addCommand({
741
+ name: "gotolineCustom",
742
+ bindKey: { win: "Ctrl-G", mac: "Command-G" },
743
+ exec: (ed) => {
744
+ const currentLine = ed.getCursorPosition().row + 1;
745
+ const total = ed.session.getLength();
746
+ const target = window.prompt(`Menuju ke nomor baris (1 - ${total}):`, String(currentLine));
747
+ if (target !== null) {
748
+ const lineNum = parseInt(target.trim(), 10);
749
+ if (!isNaN(lineNum) && lineNum > 0) {
750
+ ed.gotoLine(lineNum, 0, true);
751
+ ed.focus();
752
+ }
753
+ }
754
+ }
755
+ });
756
+ editorRef.current = editor;
757
+ editor.on("change", () => {
758
+ const newVal = editor.getValue();
759
+ const undoManager = editor.session.getUndoManager();
760
+ setCanUndo(undoManager ? undoManager.hasUndo() : false);
761
+ setCanRedo(undoManager ? undoManager.hasRedo() : false);
762
+ const lineCount = editor.session.getLength();
763
+ setStats({ lines: lineCount, chars: newVal.length });
764
+ if (!isInternalChangeRef.current) {
765
+ onChange?.(newVal);
766
+ }
767
+ });
768
+ editor.selection.on("changeCursor", () => {
769
+ const pos = editor.getCursorPosition();
770
+ setCursorPos({ row: pos.row + 1, col: pos.column + 1 });
771
+ });
772
+ setStats({
773
+ lines: editor.session.getLength(),
774
+ chars: (latestValueRef.current || "").length
775
+ });
776
+ });
777
+ return () => {
778
+ isMounted = false;
779
+ if (editorRef.current) {
780
+ editorRef.current.destroy();
781
+ editorRef.current = null;
782
+ }
783
+ };
784
+ }, []);
785
+ React.useEffect(() => {
786
+ const editor = editorRef.current;
787
+ if (!editor)
788
+ return;
789
+ const currentVal = editor.getValue();
790
+ if (value !== currentVal) {
791
+ isInternalChangeRef.current = true;
792
+ const pos = editor.getCursorPosition();
793
+ editor.setValue(value || "", -1);
794
+ editor.moveCursorToPosition(pos);
795
+ isInternalChangeRef.current = false;
796
+ const undoManager = editor.session.getUndoManager();
797
+ setCanUndo(undoManager ? undoManager.hasUndo() : false);
798
+ setCanRedo(undoManager ? undoManager.hasRedo() : false);
799
+ setStats({
800
+ lines: editor.session.getLength(),
801
+ chars: (value || "").length
802
+ });
803
+ }
804
+ }, [value]);
805
+ React.useEffect(() => {
806
+ const editor = editorRef.current;
807
+ if (editor) {
808
+ editor.session.setMode(resolvedMode);
809
+ enhanceModeTokenizer2(editor.session);
810
+ }
811
+ }, [resolvedMode]);
812
+ React.useEffect(() => {
813
+ const editor = editorRef.current;
814
+ if (editor) {
815
+ editor.setTheme(currentTheme === "dark" ? "ace/theme/vsc_dark_plus" : "ace/theme/vsc_light_plus");
816
+ }
817
+ }, [currentTheme]);
818
+ React.useEffect(() => {
819
+ const editor = editorRef.current;
820
+ if (editor) {
821
+ editor.session.setUseWrapMode(isWrapped);
822
+ }
823
+ }, [isWrapped]);
824
+ React.useEffect(() => {
825
+ const editor = editorRef.current;
826
+ if (editor) {
827
+ editor.setReadOnly(readOnly);
828
+ }
829
+ }, [readOnly]);
830
+ const handleUndo = () => {
831
+ const editor = editorRef.current;
832
+ if (!editor)
833
+ return;
834
+ editor.undo();
835
+ const undoManager = editor.session.getUndoManager();
836
+ setCanUndo(undoManager ? undoManager.hasUndo() : false);
837
+ setCanRedo(undoManager ? undoManager.hasRedo() : false);
838
+ };
839
+ const handleRedo = () => {
840
+ const editor = editorRef.current;
841
+ if (!editor)
842
+ return;
843
+ editor.redo();
844
+ const undoManager = editor.session.getUndoManager();
845
+ setCanUndo(undoManager ? undoManager.hasUndo() : false);
846
+ setCanRedo(undoManager ? undoManager.hasRedo() : false);
847
+ };
848
+ const handleCopy = () => {
849
+ const editor = editorRef.current;
850
+ const val = editor ? editor.getValue() : value;
851
+ navigator.clipboard.writeText(val);
852
+ setCopied(true);
853
+ setTimeout(() => setCopied(false), 2000);
854
+ };
855
+ const handleDownload = () => {
856
+ if (!downloadFilename)
857
+ return;
858
+ const editor = editorRef.current;
859
+ const val = editor ? editor.getValue() : value;
860
+ const blob = new Blob([val], { type: "text/plain" });
861
+ const url = URL.createObjectURL(blob);
862
+ const a = document.createElement("a");
863
+ a.href = url;
864
+ a.download = downloadFilename;
865
+ a.click();
866
+ URL.revokeObjectURL(url);
867
+ };
868
+ const handleConfirmClear = () => {
869
+ const editor = editorRef.current;
870
+ if (editor) {
871
+ editor.setValue("", -1);
872
+ }
873
+ setShowClearConfirm(false);
874
+ };
875
+ const toggleTheme = () => {
876
+ setCurrentTheme((prev) => prev === "light" ? "dark" : "light");
877
+ };
878
+ const handleOpenSearch = () => {
879
+ if (editorRef.current) {
880
+ editorRef.current.execCommand("find");
881
+ }
882
+ };
883
+ const handleOpenGoToLine = () => {
884
+ if (editorRef.current) {
885
+ editorRef.current.execCommand("gotolineCustom");
886
+ }
887
+ };
888
+ const calculatedHeight = React.useMemo(() => {
889
+ if (rows) {
890
+ const numRows = typeof rows === "string" ? parseInt(rows, 10) : rows;
891
+ return `${numRows * 21 + 80}px`;
892
+ }
893
+ return typeof height === "number" ? `${height}px` : height;
894
+ }, [rows, height]);
895
+ const isDark = currentTheme === "dark";
896
+ return /* @__PURE__ */ jsxDEV("div", {
897
+ className: cn2("w-full relative group overflow-hidden flex flex-col font-mono text-[13px] border transition-colors", isDark ? "bg-[#1e1e1e] text-[#d4d4d4] border-white/10" : "bg-white text-zinc-900 border-zinc-200 shadow-2xs", className),
898
+ style: { height: calculatedHeight, width },
899
+ children: [
900
+ /* @__PURE__ */ jsxDEV("div", {
901
+ className: cn2("flex items-center justify-between px-3.5 py-1.5 border-b select-none shrink-0 min-h-[38px] transition-colors relative z-20", isDark ? "bg-[#252526] border-white/10 text-zinc-300" : "bg-zinc-50 border-zinc-200 text-zinc-700"),
902
+ children: [
903
+ /* @__PURE__ */ jsxDEV("div", {
904
+ className: "flex items-center gap-2 min-w-0",
905
+ ref: langMenuRef,
906
+ children: [
907
+ languageBadge && /* @__PURE__ */ jsxDEV("div", {
908
+ className: "relative",
909
+ children: [
910
+ /* @__PURE__ */ jsxDEV("button", {
911
+ ref: langButtonRef,
912
+ type: "button",
913
+ onClick: () => {
914
+ if (!allowLanguageSelect)
915
+ return;
916
+ if (!isLangMenuOpen && langButtonRef.current) {
917
+ const rect = langButtonRef.current.getBoundingClientRect();
918
+ setLangMenuPos({ top: rect.bottom + 4, left: rect.left });
919
+ }
920
+ setIsLangMenuOpen(!isLangMenuOpen);
921
+ },
922
+ className: cn2("text-[10px] font-bold uppercase tracking-wider px-2 py-0.5 rounded border transition-colors flex items-center gap-1", isDark ? "text-[#569cd6] bg-[#569cd6]/15 border-[#569cd6]/30 hover:bg-[#569cd6]/25" : "text-primary bg-primary/10 border-primary/20 hover:bg-primary/15", !allowLanguageSelect && "pointer-events-none"),
923
+ title: "Pilih mode sintaks bahasa",
924
+ children: [
925
+ /* @__PURE__ */ jsxDEV("span", {
926
+ children: badgeLabel
927
+ }, undefined, false, undefined, this),
928
+ allowLanguageSelect && /* @__PURE__ */ jsxDEV(ChevronDown, {
929
+ size: 11,
930
+ className: "opacity-70"
931
+ }, undefined, false, undefined, this)
932
+ ]
933
+ }, undefined, true, undefined, this),
934
+ isLangMenuOpen && typeof document !== "undefined" && createPortal(/* @__PURE__ */ jsxDEV("div", {
935
+ ref: langPortalRef,
936
+ style: { position: "fixed", top: langMenuPos.top, left: langMenuPos.left },
937
+ className: cn2("w-40 max-h-72 overflow-y-auto rounded-md shadow-lg border py-1 z-[9999] text-xs font-sans", isDark ? "bg-[#252526] border-white/15 text-zinc-200" : "bg-white border-zinc-200 text-zinc-800"),
938
+ children: SUPPORTED_LANGUAGES.map((l) => /* @__PURE__ */ jsxDEV("button", {
939
+ type: "button",
940
+ onClick: () => {
941
+ setSelectedLang(l.id);
942
+ setIsLangMenuOpen(false);
943
+ },
944
+ className: cn2("w-full text-left px-3 py-1.5 transition-colors flex items-center justify-between cursor-pointer", selectedLang === l.id ? isDark ? "bg-white/10 text-primary font-medium" : "bg-zinc-100 text-primary font-medium" : isDark ? "hover:bg-white/5" : "hover:bg-zinc-50"),
945
+ children: [
946
+ /* @__PURE__ */ jsxDEV("span", {
947
+ children: l.label
948
+ }, undefined, false, undefined, this),
949
+ selectedLang === l.id && /* @__PURE__ */ jsxDEV(Check, {
950
+ size: 12,
951
+ className: "text-primary"
952
+ }, undefined, false, undefined, this)
953
+ ]
954
+ }, l.id, true, undefined, this))
955
+ }, undefined, false, undefined, this), document.body)
956
+ ]
957
+ }, undefined, true, undefined, this),
958
+ readOnly && /* @__PURE__ */ jsxDEV("span", {
959
+ className: "text-[10px] uppercase font-semibold text-amber-500 bg-amber-500/10 border border-amber-500/20 px-1.5 py-0.5 rounded",
960
+ children: "Read Only"
961
+ }, undefined, false, undefined, this)
962
+ ]
963
+ }, undefined, true, undefined, this),
964
+ /* @__PURE__ */ jsxDEV("div", {
965
+ className: "flex items-center gap-1",
966
+ children: [
967
+ /* @__PURE__ */ jsxDEV("button", {
968
+ type: "button",
969
+ onClick: handleUndo,
970
+ disabled: !canUndo || readOnly,
971
+ title: "Urungkan perubahan (Ctrl+Z)",
972
+ "aria-label": "Undo",
973
+ className: cn2("p-1.5 rounded transition-colors disabled:opacity-30 disabled:pointer-events-none", isDark ? "text-zinc-400 hover:text-zinc-100 hover:bg-white/10" : "text-zinc-600 hover:text-zinc-900 hover:bg-zinc-200/70"),
974
+ children: /* @__PURE__ */ jsxDEV(RotateCcw, {
975
+ size: 14
976
+ }, undefined, false, undefined, this)
977
+ }, undefined, false, undefined, this),
978
+ /* @__PURE__ */ jsxDEV("button", {
979
+ type: "button",
980
+ onClick: handleRedo,
981
+ disabled: !canRedo || readOnly,
982
+ title: "Ulangi perubahan (Ctrl+Y)",
983
+ "aria-label": "Redo",
984
+ className: cn2("p-1.5 rounded transition-colors disabled:opacity-30 disabled:pointer-events-none", isDark ? "text-zinc-400 hover:text-zinc-100 hover:bg-white/10" : "text-zinc-600 hover:text-zinc-900 hover:bg-zinc-200/70"),
985
+ children: /* @__PURE__ */ jsxDEV(RotateCw, {
986
+ size: 14
987
+ }, undefined, false, undefined, this)
988
+ }, undefined, false, undefined, this),
989
+ allowThemeToggle && /* @__PURE__ */ jsxDEV("button", {
990
+ type: "button",
991
+ onClick: toggleTheme,
992
+ title: isDark ? "Beralih ke Tema Terang (Light)" : "Beralih ke Tema Gelap (Dark)",
993
+ "aria-label": "Toggle Theme",
994
+ className: cn2("p-1.5 rounded transition-colors ml-0.5", isDark ? "text-amber-400 hover:bg-white/10" : "text-zinc-600 hover:text-zinc-900 hover:bg-zinc-200/70"),
995
+ children: isDark ? /* @__PURE__ */ jsxDEV(Sun, {
996
+ size: 14
997
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV(Moon, {
998
+ size: 14
999
+ }, undefined, false, undefined, this)
1000
+ }, undefined, false, undefined, this),
1001
+ /* @__PURE__ */ jsxDEV("span", {
1002
+ className: cn2("w-px h-3.5 mx-1", isDark ? "bg-white/15" : "bg-zinc-300")
1003
+ }, undefined, false, undefined, this),
1004
+ /* @__PURE__ */ jsxDEV("button", {
1005
+ type: "button",
1006
+ onClick: () => setIsWrapped(!isWrapped),
1007
+ title: isWrapped ? "Nonaktifkan bungkus baris (Wrap)" : "Aktifkan bungkus baris (Wrap)",
1008
+ "aria-label": "Wrap text",
1009
+ className: cn2("p-1.5 rounded transition-colors", isWrapped ? isDark ? "text-primary bg-primary/20" : "text-primary bg-primary/10" : isDark ? "text-zinc-400 hover:text-zinc-100 hover:bg-white/10" : "text-zinc-600 hover:text-zinc-900 hover:bg-zinc-200/70"),
1010
+ children: /* @__PURE__ */ jsxDEV(WrapText, {
1011
+ size: 14
1012
+ }, undefined, false, undefined, this)
1013
+ }, undefined, false, undefined, this),
1014
+ /* @__PURE__ */ jsxDEV("button", {
1015
+ type: "button",
1016
+ onClick: handleOpenSearch,
1017
+ title: "Cari teks (Ctrl+F)",
1018
+ "aria-label": "Find text",
1019
+ className: cn2("p-1.5 rounded transition-colors", isDark ? "text-zinc-400 hover:text-zinc-100 hover:bg-white/10" : "text-zinc-600 hover:text-zinc-900 hover:bg-zinc-200/70"),
1020
+ children: /* @__PURE__ */ jsxDEV(Search, {
1021
+ size: 14
1022
+ }, undefined, false, undefined, this)
1023
+ }, undefined, false, undefined, this),
1024
+ downloadFilename && /* @__PURE__ */ jsxDEV("button", {
1025
+ type: "button",
1026
+ onClick: handleDownload,
1027
+ title: "Unduh berkas kode",
1028
+ "aria-label": "Download code",
1029
+ className: cn2("p-1.5 rounded transition-colors", isDark ? "text-zinc-400 hover:text-zinc-100 hover:bg-white/10" : "text-zinc-600 hover:text-zinc-900 hover:bg-zinc-200/70"),
1030
+ children: /* @__PURE__ */ jsxDEV(Download, {
1031
+ size: 14
1032
+ }, undefined, false, undefined, this)
1033
+ }, undefined, false, undefined, this),
1034
+ /* @__PURE__ */ jsxDEV("button", {
1035
+ type: "button",
1036
+ onClick: handleCopy,
1037
+ title: "Salin seluruh kode ke papan klip",
1038
+ "aria-label": "Copy code",
1039
+ className: cn2("p-1.5 rounded transition-colors", isDark ? "text-zinc-400 hover:text-zinc-100 hover:bg-white/10" : "text-zinc-600 hover:text-zinc-900 hover:bg-zinc-200/70"),
1040
+ children: copied ? /* @__PURE__ */ jsxDEV(Check, {
1041
+ size: 14,
1042
+ className: "text-emerald-500"
1043
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV(Copy, {
1044
+ size: 14
1045
+ }, undefined, false, undefined, this)
1046
+ }, undefined, false, undefined, this),
1047
+ value && !readOnly && (showClearConfirm ? /* @__PURE__ */ jsxDEV("div", {
1048
+ className: "flex items-center gap-1 bg-rose-500/10 border border-rose-500/30 rounded px-1.5 py-0.5 ml-1",
1049
+ children: [
1050
+ /* @__PURE__ */ jsxDEV("span", {
1051
+ className: "text-[10px] text-rose-600 dark:text-rose-400 font-sans",
1052
+ children: "Hapus?"
1053
+ }, undefined, false, undefined, this),
1054
+ /* @__PURE__ */ jsxDEV("button", {
1055
+ type: "button",
1056
+ onClick: handleConfirmClear,
1057
+ className: "text-[10px] text-white bg-rose-600 hover:bg-rose-700 px-1.5 py-0.5 rounded font-sans transition-colors",
1058
+ children: "Ya"
1059
+ }, undefined, false, undefined, this),
1060
+ /* @__PURE__ */ jsxDEV("button", {
1061
+ type: "button",
1062
+ onClick: () => setShowClearConfirm(false),
1063
+ className: "text-[10px] text-zinc-500 hover:text-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-200 px-1 py-0.5 font-sans",
1064
+ children: "Batal"
1065
+ }, undefined, false, undefined, this)
1066
+ ]
1067
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV("button", {
1068
+ type: "button",
1069
+ onClick: () => setShowClearConfirm(true),
1070
+ title: "Bersihkan seluruh kode",
1071
+ "aria-label": "Clear code",
1072
+ className: cn2("p-1.5 rounded transition-colors ml-0.5", isDark ? "text-zinc-400 hover:text-rose-400 hover:bg-rose-500/15" : "text-zinc-600 hover:text-rose-600 hover:bg-rose-50"),
1073
+ children: /* @__PURE__ */ jsxDEV(Trash2, {
1074
+ size: 14
1075
+ }, undefined, false, undefined, this)
1076
+ }, undefined, false, undefined, this))
1077
+ ]
1078
+ }, undefined, true, undefined, this)
1079
+ ]
1080
+ }, undefined, true, undefined, this),
1081
+ /* @__PURE__ */ jsxDEV("div", {
1082
+ className: "flex-1 w-full h-full relative overflow-hidden",
1083
+ children: /* @__PURE__ */ jsxDEV("div", {
1084
+ ref: containerRef,
1085
+ className: "absolute inset-0 w-full h-full",
1086
+ style: {
1087
+ lineHeight: "21px",
1088
+ fontSize: "13px"
1089
+ }
1090
+ }, undefined, false, undefined, this)
1091
+ }, undefined, false, undefined, this),
1092
+ /* @__PURE__ */ jsxDEV("div", {
1093
+ className: cn2("px-3.5 py-1.5 border-t text-[11px] flex items-center justify-between shrink-0 select-none min-h-[30px] transition-colors relative z-20", isDark ? "bg-[#252526] border-white/10 text-zinc-400" : "bg-zinc-50 border-zinc-200 text-zinc-600"),
1094
+ children: [
1095
+ /* @__PURE__ */ jsxDEV("div", {
1096
+ className: "flex items-center gap-1.5 min-w-0 pr-3",
1097
+ children: helpText ? /* @__PURE__ */ jsxDEV(Fragment, {
1098
+ children: [
1099
+ /* @__PURE__ */ jsxDEV(Info, {
1100
+ size: 13,
1101
+ className: "text-primary shrink-0"
1102
+ }, undefined, false, undefined, this),
1103
+ /* @__PURE__ */ jsxDEV("span", {
1104
+ className: cn2("truncate", isDark ? "text-zinc-300" : "text-zinc-700"),
1105
+ children: helpText
1106
+ }, undefined, false, undefined, this)
1107
+ ]
1108
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV("span", {
1109
+ className: "font-mono text-[10px] text-zinc-400",
1110
+ children: "Siap mengetik"
1111
+ }, undefined, false, undefined, this)
1112
+ }, undefined, false, undefined, this),
1113
+ /* @__PURE__ */ jsxDEV("div", {
1114
+ className: "flex items-center gap-3 shrink-0 font-mono text-[10.5px]",
1115
+ children: [
1116
+ /* @__PURE__ */ jsxDEV("button", {
1117
+ type: "button",
1118
+ onClick: handleOpenGoToLine,
1119
+ title: "Klik atau tekan Ctrl+G untuk menuju baris spesifik",
1120
+ className: cn2("hover:underline cursor-pointer transition-colors focus:outline-none font-medium", isDark ? "text-zinc-300 hover:text-white" : "text-zinc-700 hover:text-zinc-950"),
1121
+ children: [
1122
+ "Ln ",
1123
+ cursorPos.row,
1124
+ ", Col ",
1125
+ cursorPos.col
1126
+ ]
1127
+ }, undefined, true, undefined, this),
1128
+ showStats && /* @__PURE__ */ jsxDEV("span", {
1129
+ children: [
1130
+ stats.lines,
1131
+ " baris · ",
1132
+ stats.chars,
1133
+ " karakter"
1134
+ ]
1135
+ }, undefined, true, undefined, this),
1136
+ /* @__PURE__ */ jsxDEV("span", {
1137
+ className: "hidden sm:inline-block text-zinc-400",
1138
+ children: "Tab: 2 spasi · UTF-8"
1139
+ }, undefined, false, undefined, this)
1140
+ ]
1141
+ }, undefined, true, undefined, this)
1142
+ ]
1143
+ }, undefined, true, undefined, this)
1144
+ ]
1145
+ }, undefined, true, undefined, this);
1146
+ }
1147
+ // src/components/ui/code.tsx
1148
+ import ace3 from "ace-builds";
1149
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
1150
+ var LazyCodeEditor = React2.lazy(() => (__preload("vak164kx"), import("./chunk-vak164kx.js")).then((m) => ({ default: m.CodeEditor })));
1151
+ var LazyCodePreview = React2.lazy(() => (__preload("amsyqyh9"), import("./chunk-amsyqyh9.js")).then((m) => ({ default: m.CodePreview })));
1152
+ var VSC_DARK_CODE_CSS = `
1153
+ .ace-one-dark, .ace-one-dark .ace_scroller, .ace-one-dark .ace_content {
1154
+ background-color: #1e1e1e !important;
1155
+ color: #d4d4d4 !important;
1156
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
1157
+ }
1158
+ .ace-one-dark .ace_line {
1159
+ color: #d4d4d4 !important;
1160
+ }
1161
+ .ace-one-dark .ace_gutter {
1162
+ background: #1e1e1e !important;
1163
+ color: #858585 !important;
1164
+ border-right: 1px solid rgba(255, 255, 255, 0.07) !important;
1165
+ }
1166
+ .ace-one-dark .ace_gutter-active-line {
1167
+ background-color: #282828 !important;
1168
+ color: #c6c6c6 !important;
1169
+ }
1170
+ .ace-one-dark .ace_fold {
1171
+ background-color: #569cd6 !important;
1172
+ border-color: #858585 !important;
1173
+ }
1174
+ .ace-one-dark .ace_fold-widget {
1175
+ cursor: pointer !important;
1176
+ }
1177
+ .ace-one-dark .ace_keyword {
1178
+ color: #c586c0 !important;
1179
+ }
1180
+ .ace-one-dark .ace_storage,
1181
+ .ace-one-dark .ace_storage.ace_type {
1182
+ color: #569cd6 !important;
1183
+ }
1184
+ .ace-one-dark .ace_entity.ace_name.ace_function,
1185
+ .ace-one-dark .ace_support.ace_function {
1186
+ color: #dcdcaa !important;
1187
+ }
1188
+ .ace-one-dark .ace_support.ace_class,
1189
+ .ace-one-dark .ace_support.ace_type {
1190
+ color: #4ec9b0 !important;
1191
+ }
1192
+ .ace-one-dark .ace_identifier,
1193
+ .ace-one-dark .ace_variable {
1194
+ color: #9cdcfe !important;
1195
+ }
1196
+ .ace-one-dark .ace_string {
1197
+ color: #ce9178 !important;
1198
+ }
1199
+ .ace-one-dark .ace_constant.ace_numeric {
1200
+ color: #b5cea8 !important;
1201
+ }
1202
+ .ace-one-dark .ace_constant.ace_language {
1203
+ color: #569cd6 !important;
1204
+ }
1205
+ .ace-one-dark .ace_comment {
1206
+ color: #6a9955 !important;
1207
+ font-style: italic !important;
1208
+ }
1209
+ .ace-one-dark .ace_keyword.ace_operator,
1210
+ .ace-one-dark .ace_paren,
1211
+ .ace-one-dark .ace_punctuation {
1212
+ color: #d4d4d4 !important;
1213
+ }
1214
+ `;
1215
+ function ensureThemeCss() {
1216
+ if (typeof document === "undefined")
1217
+ return;
1218
+ let styleEl = document.getElementById("deweb-code-ace-theme");
1219
+ if (!styleEl) {
1220
+ styleEl = document.createElement("style");
1221
+ styleEl.id = "deweb-code-ace-theme";
1222
+ styleEl.textContent = VSC_DARK_CODE_CSS;
1223
+ document.head.appendChild(styleEl);
1224
+ }
1225
+ }
1226
+ function CodeBlock({
1227
+ children,
1228
+ lang = "text",
1229
+ rows,
1230
+ height,
1231
+ width,
1232
+ className,
1233
+ theme,
1234
+ line = true,
1235
+ wrap = true,
1236
+ fold = true,
1237
+ downloadFilename,
1238
+ languageBadge = true,
1239
+ expandable = 10,
1240
+ expanded,
1241
+ onExpandedChange
1242
+ }) {
1243
+ const codeText = typeof children === "string" ? children : String(children ?? "");
1244
+ const containerRef = React2.useRef(null);
1245
+ const editorRef = React2.useRef(null);
1246
+ const [copied, setCopied] = React2.useState(false);
1247
+ const [isWrapped, setIsWrapped] = React2.useState(wrap);
1248
+ const [aceReady, setAceReady] = React2.useState(false);
1249
+ const linesCount = codeText ? codeText.split(`
1250
+ `).length : 0;
1251
+ const isExpandable = expandable > 0 && linesCount > expandable;
1252
+ const [internalExpanded, setInternalExpanded] = React2.useState(!isExpandable);
1253
+ const isExpanded = !isExpandable ? true : expanded !== undefined ? expanded : internalExpanded;
1254
+ const themeColors = React2.useMemo(() => {
1255
+ if (!theme)
1256
+ return { bg: "#1e1e1e", fg: "#d4d4d4" };
1257
+ const bg = theme['pre[class*="language-"]']?.background || theme["pre"]?.background || theme['code[class*="language-"]']?.background || "#1e1e1e";
1258
+ const fg = theme['pre[class*="language-"]']?.color || theme["pre"]?.color || theme['code[class*="language-"]']?.color || "#d4d4d4";
1259
+ return { bg, fg };
1260
+ }, [theme]);
1261
+ const collapsedMaxHeight = React2.useMemo(() => {
1262
+ if (!isExpandable)
1263
+ return "3000px";
1264
+ const paddingTop = languageBadge ? 28 : 20;
1265
+ const paddingBottom = 20;
1266
+ const calculatedPx = expandable * 19.5 + paddingTop + paddingBottom;
1267
+ return `${calculatedPx}px`;
1268
+ }, [isExpandable, expandable, languageBadge]);
1269
+ const calculatedHeight = React2.useMemo(() => {
1270
+ if (height)
1271
+ return height;
1272
+ if (rows) {
1273
+ const numRows = typeof rows === "string" ? parseInt(rows, 10) : rows;
1274
+ return `${numRows * 1.5 + 2}em`;
1275
+ }
1276
+ return;
1277
+ }, [rows, height]);
1278
+ const resolvedMode = React2.useMemo(() => {
1279
+ return resolveAceMode2(codeText, lang);
1280
+ }, [codeText, lang]);
1281
+ React2.useEffect(() => {
1282
+ if (!containerRef.current)
1283
+ return;
1284
+ let isMounted = true;
1285
+ ensureAceModes2().then(() => {
1286
+ if (!isMounted || !containerRef.current)
1287
+ return;
1288
+ ensureThemeCss();
1289
+ const editor = ace3.edit(containerRef.current, {
1290
+ mode: resolvedMode,
1291
+ theme: "ace/theme/one_dark",
1292
+ value: codeText,
1293
+ readOnly: true,
1294
+ showLineNumbers: line,
1295
+ showGutter: line,
1296
+ showPrintMargin: false,
1297
+ highlightActiveLine: false,
1298
+ showFoldWidgets: fold,
1299
+ foldStyle: "markbegin",
1300
+ wrap: isWrapped,
1301
+ tabSize: 2,
1302
+ useSoftTabs: true,
1303
+ fontSize: "13px",
1304
+ fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",
1305
+ scrollPastEnd: 0,
1306
+ maxLines: calculatedHeight ? undefined : Infinity
1307
+ });
1308
+ editor.session.setUseWorker(false);
1309
+ enhanceModeTokenizer2(editor.session);
1310
+ if (editor.renderer && editor.renderer.$cursorLayer) {
1311
+ editor.renderer.$cursorLayer.element.style.display = "none";
1312
+ }
1313
+ editor.resize(true);
1314
+ editorRef.current = editor;
1315
+ setAceReady(true);
1316
+ });
1317
+ return () => {
1318
+ isMounted = false;
1319
+ if (editorRef.current) {
1320
+ editorRef.current.destroy();
1321
+ editorRef.current = null;
1322
+ }
1323
+ };
1324
+ }, []);
1325
+ React2.useEffect(() => {
1326
+ const editor = editorRef.current;
1327
+ if (editor && editor.getValue() !== codeText) {
1328
+ editor.setValue(codeText, -1);
1329
+ editor.resize(true);
1330
+ }
1331
+ }, [codeText]);
1332
+ React2.useEffect(() => {
1333
+ const editor = editorRef.current;
1334
+ if (editor) {
1335
+ editor.session.setMode(resolvedMode);
1336
+ enhanceModeTokenizer2(editor.session);
1337
+ editor.resize(true);
1338
+ }
1339
+ }, [resolvedMode]);
1340
+ React2.useEffect(() => {
1341
+ const editor = editorRef.current;
1342
+ if (editor) {
1343
+ editor.session.setUseWrapMode(isWrapped);
1344
+ }
1345
+ }, [isWrapped]);
1346
+ const handleCopy = () => {
1347
+ navigator.clipboard.writeText(codeText);
1348
+ setCopied(true);
1349
+ setTimeout(() => setCopied(false), 2000);
1350
+ };
1351
+ const handleDownload = () => {
1352
+ if (!downloadFilename)
1353
+ return;
1354
+ const blob = new Blob([codeText], { type: "text/plain" });
1355
+ const url = URL.createObjectURL(blob);
1356
+ const a = document.createElement("a");
1357
+ a.href = url;
1358
+ a.download = downloadFilename;
1359
+ a.click();
1360
+ URL.revokeObjectURL(url);
1361
+ };
1362
+ return /* @__PURE__ */ jsxDEV2("div", {
1363
+ className: cn2("w-full relative group overflow-hidden flex flex-col font-mono text-[13px] rounded-[var(--ui-card-radius,var(--ui-radius-md,8px))]", className),
1364
+ style: { height: calculatedHeight, width, backgroundColor: themeColors.bg },
1365
+ children: [
1366
+ /* @__PURE__ */ jsxDEV2("div", {
1367
+ className: "absolute right-2 top-2 z-20 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",
1368
+ children: [
1369
+ downloadFilename && /* @__PURE__ */ jsxDEV2("button", {
1370
+ onClick: handleDownload,
1371
+ title: "Download file",
1372
+ className: "p-1.5 rounded-md transition-all opacity-70 hover:opacity-100 backdrop-blur-sm cursor-pointer",
1373
+ style: { color: themeColors.fg, backgroundColor: `color-mix(in srgb, ${themeColors.fg} 10%, transparent)` },
1374
+ children: /* @__PURE__ */ jsxDEV2(Download2, {
1375
+ size: 14
1376
+ }, undefined, false, undefined, this)
1377
+ }, undefined, false, undefined, this),
1378
+ wrap && /* @__PURE__ */ jsxDEV2("button", {
1379
+ onClick: () => setIsWrapped(!isWrapped),
1380
+ title: "Wrap text",
1381
+ className: "p-1.5 rounded-md transition-all opacity-70 hover:opacity-100 backdrop-blur-sm cursor-pointer",
1382
+ style: {
1383
+ color: isWrapped ? themeColors.bg : themeColors.fg,
1384
+ backgroundColor: isWrapped ? themeColors.fg : `color-mix(in srgb, ${themeColors.fg} 10%, transparent)`
1385
+ },
1386
+ children: /* @__PURE__ */ jsxDEV2(WrapText2, {
1387
+ size: 14
1388
+ }, undefined, false, undefined, this)
1389
+ }, undefined, false, undefined, this),
1390
+ /* @__PURE__ */ jsxDEV2("button", {
1391
+ onClick: handleCopy,
1392
+ title: "Copy code",
1393
+ className: "p-1.5 rounded-md transition-all opacity-70 hover:opacity-100 backdrop-blur-sm cursor-pointer",
1394
+ style: {
1395
+ color: copied ? themeColors.bg : themeColors.fg,
1396
+ backgroundColor: copied ? themeColors.fg : `color-mix(in srgb, ${themeColors.fg} 10%, transparent)`
1397
+ },
1398
+ children: copied ? /* @__PURE__ */ jsxDEV2(Check2, {
1399
+ size: 14,
1400
+ className: "text-emerald-500"
1401
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2(Copy2, {
1402
+ size: 14
1403
+ }, undefined, false, undefined, this)
1404
+ }, undefined, false, undefined, this)
1405
+ ]
1406
+ }, undefined, true, undefined, this),
1407
+ languageBadge && lang && lang !== "text" && /* @__PURE__ */ jsxDEV2("div", {
1408
+ className: "absolute left-4 top-2 z-20 pointer-events-none",
1409
+ children: /* @__PURE__ */ jsxDEV2("span", {
1410
+ className: "text-[10px] font-mono font-bold uppercase tracking-wider text-[color:color-mix(in_srgb,var(--color-foreground)_30%,transparent)] select-none",
1411
+ children: lang
1412
+ }, undefined, false, undefined, this)
1413
+ }, undefined, false, undefined, this),
1414
+ /* @__PURE__ */ jsxDEV2(Collapsible2, {
1415
+ open: isExpanded,
1416
+ children: /* @__PURE__ */ jsxDEV2(CollapsibleContent2, {
1417
+ collapsedHeight: collapsedMaxHeight,
1418
+ className: cn2("flex-1 relative", isExpandable && !isExpanded && "[mask-image:linear-gradient(to_bottom,black_50%,transparent_100%)]"),
1419
+ children: /* @__PURE__ */ jsxDEV2("div", {
1420
+ className: cn2("w-full relative", languageBadge ? "pt-6" : "pt-4", isExpandable && !isExpanded ? "pb-8" : "pb-4"),
1421
+ style: { minHeight: calculatedHeight || "120px" },
1422
+ children: /* @__PURE__ */ jsxDEV2("div", {
1423
+ ref: containerRef,
1424
+ className: "w-full",
1425
+ style: {
1426
+ minHeight: calculatedHeight || `${Math.max(linesCount * 21, 80)}px`,
1427
+ fontSize: "13px",
1428
+ lineHeight: "21px"
1429
+ }
1430
+ }, undefined, false, undefined, this)
1431
+ }, undefined, false, undefined, this)
1432
+ }, undefined, false, undefined, this)
1433
+ }, undefined, false, undefined, this),
1434
+ isExpandable && /* @__PURE__ */ jsxDEV2("div", {
1435
+ className: cn2("absolute inset-x-0 bottom-0 flex justify-center z-20 pointer-events-none transition-all duration-300 ease-out", !isExpanded ? "pt-12 pb-2" : "py-2"),
1436
+ style: {
1437
+ background: !isExpanded ? expandable <= 5 ? `linear-gradient(to top, ${themeColors.bg} 0%, color-mix(in srgb, ${themeColors.bg} 70%, transparent) 60%, transparent 100%)` : `linear-gradient(to top, ${themeColors.bg} 0%, ${themeColors.bg} 60%, transparent 100%)` : "transparent"
1438
+ },
1439
+ children: /* @__PURE__ */ jsxDEV2("div", {
1440
+ className: cn2("transition-transform duration-300 ease-out", !isExpanded && expandable <= 5 ? "-translate-y-11" : "translate-y-0"),
1441
+ children: /* @__PURE__ */ jsxDEV2("button", {
1442
+ type: "button",
1443
+ onClick: () => {
1444
+ const next = !isExpanded;
1445
+ if (onExpandedChange)
1446
+ onExpandedChange(next);
1447
+ else
1448
+ setInternalExpanded(next);
1449
+ },
1450
+ className: "pointer-events-auto flex items-center gap-1.5 font-sans text-[13px] font-medium leading-none rounded-[var(--ui-radius-lg,12px)] border border-white/15 px-4 py-2 hover:px-5 opacity-95 hover:opacity-100 transition-all duration-200 ease-out shadow-md cursor-pointer",
1451
+ style: {
1452
+ color: themeColors.fg,
1453
+ backgroundColor: `color-mix(in srgb, ${themeColors.fg} 16%, ${themeColors.bg})`
1454
+ },
1455
+ children: [
1456
+ /* @__PURE__ */ jsxDEV2(ChevronDown2, {
1457
+ size: 14,
1458
+ className: cn2("transition-transform duration-300 ease-out", isExpanded && "rotate-180")
1459
+ }, undefined, false, undefined, this),
1460
+ /* @__PURE__ */ jsxDEV2("span", {
1461
+ children: isExpanded ? "Collapse" : "Show More"
1462
+ }, undefined, false, undefined, this)
1463
+ ]
1464
+ }, undefined, true, undefined, this)
1465
+ }, undefined, false, undefined, this)
1466
+ }, undefined, false, undefined, this)
1467
+ ]
1468
+ }, undefined, true, undefined, this);
1469
+ }
1470
+ function Code2(props) {
1471
+ const {
1472
+ mode,
1473
+ files,
1474
+ lang,
1475
+ children,
1476
+ variant,
1477
+ size,
1478
+ className,
1479
+ onChange,
1480
+ value,
1481
+ reactCode,
1482
+ htmlCode,
1483
+ jsonCode,
1484
+ jsxCode,
1485
+ title,
1486
+ description,
1487
+ id,
1488
+ responsive,
1489
+ numbered,
1490
+ bleed,
1491
+ rows,
1492
+ height,
1493
+ width,
1494
+ theme,
1495
+ line,
1496
+ wrap,
1497
+ fold,
1498
+ downloadFilename,
1499
+ languageBadge,
1500
+ expandable,
1501
+ placeholder,
1502
+ helpText,
1503
+ highlightActiveLine,
1504
+ readOnly,
1505
+ showStats,
1506
+ allowThemeToggle,
1507
+ allowLanguageSelect,
1508
+ onValidationChange
1509
+ } = props;
1510
+ const resolvedMode = React2.useMemo(() => {
1511
+ if (mode)
1512
+ return mode;
1513
+ if (files && files.length > 0)
1514
+ return "block";
1515
+ if (typeof onChange === "function")
1516
+ return "editor";
1517
+ if (reactCode || htmlCode || jsonCode || jsxCode)
1518
+ return "preview";
1519
+ if (lang)
1520
+ return "block";
1521
+ if (typeof children === "string" && children.includes(`
1522
+ `))
1523
+ return "block";
1524
+ return "inline";
1525
+ }, [mode, files, onChange, reactCode, htmlCode, jsonCode, jsxCode, lang, children]);
1526
+ if (resolvedMode === "inline") {
1527
+ return /* @__PURE__ */ jsxDEV2(InlineCode2, {
1528
+ variant,
1529
+ size,
1530
+ className,
1531
+ children
1532
+ }, undefined, false, undefined, this);
1533
+ }
1534
+ if (resolvedMode === "editor") {
1535
+ return /* @__PURE__ */ jsxDEV2(React2.Suspense, {
1536
+ fallback: /* @__PURE__ */ jsxDEV2("div", {
1537
+ className: cn2("w-full min-h-[180px] rounded-[var(--ui-card-radius,var(--ui-radius-md,8px))] border border-[color:var(--color-border)] bg-[var(--color-card)] animate-pulse", className)
1538
+ }, undefined, false, undefined, this),
1539
+ children: /* @__PURE__ */ jsxDEV2(LazyCodeEditor, {
1540
+ value: value ?? (typeof children === "string" ? children : ""),
1541
+ onChange,
1542
+ lang,
1543
+ theme,
1544
+ placeholder,
1545
+ helpText,
1546
+ rows: typeof rows === "string" ? parseInt(rows, 10) : rows,
1547
+ height,
1548
+ width,
1549
+ line,
1550
+ wrap,
1551
+ fold,
1552
+ highlightActiveLine,
1553
+ readOnly,
1554
+ downloadFilename,
1555
+ languageBadge,
1556
+ showStats,
1557
+ allowThemeToggle,
1558
+ allowLanguageSelect,
1559
+ onValidationChange,
1560
+ className
1561
+ }, undefined, false, undefined, this)
1562
+ }, undefined, false, undefined, this);
1563
+ }
1564
+ if (resolvedMode === "preview") {
1565
+ return /* @__PURE__ */ jsxDEV2(React2.Suspense, {
1566
+ fallback: /* @__PURE__ */ jsxDEV2("div", {
1567
+ className: cn2("w-full min-h-[220px] rounded-[var(--ui-card-radius,var(--ui-radius-md,8px))] border border-[color:var(--color-border)] bg-[var(--color-card)] animate-pulse", className)
1568
+ }, undefined, false, undefined, this),
1569
+ children: /* @__PURE__ */ jsxDEV2(LazyCodePreview, {
1570
+ id,
1571
+ title,
1572
+ description,
1573
+ reactCode,
1574
+ htmlCode,
1575
+ jsonCode,
1576
+ jsxCode,
1577
+ responsive,
1578
+ numbered,
1579
+ bleed,
1580
+ children
1581
+ }, undefined, false, undefined, this)
1582
+ }, undefined, false, undefined, this);
1583
+ }
1584
+ if (files && files.length > 0) {
1585
+ const getLangIcon = (fileLang) => {
1586
+ const l = (fileLang || "").toLowerCase();
1587
+ if (l === "json")
1588
+ return /* @__PURE__ */ jsxDEV2(Braces, {
1589
+ size: 12
1590
+ }, undefined, false, undefined, this);
1591
+ if (l === "html")
1592
+ return /* @__PURE__ */ jsxDEV2(Globe, {
1593
+ size: 12
1594
+ }, undefined, false, undefined, this);
1595
+ return /* @__PURE__ */ jsxDEV2(Code22, {
1596
+ size: 12
1597
+ }, undefined, false, undefined, this);
1598
+ };
1599
+ return /* @__PURE__ */ jsxDEV2(Card2, {
1600
+ className: cn2("flex flex-col border-[color:var(--color-border)] overflow-hidden shadow-sm", className),
1601
+ children: /* @__PURE__ */ jsxDEV2(Tabs2, {
1602
+ defaultIndex: 0,
1603
+ className: "w-full",
1604
+ children: [
1605
+ /* @__PURE__ */ jsxDEV2("div", {
1606
+ className: "bg-[#181818] border-b border-white/10 px-4 flex items-center justify-between",
1607
+ children: [
1608
+ /* @__PURE__ */ jsxDEV2("h3", {
1609
+ className: "text-[10px] font-semibold text-zinc-400 uppercase tracking-widest py-2",
1610
+ children: "Source"
1611
+ }, undefined, false, undefined, this),
1612
+ /* @__PURE__ */ jsxDEV2(TabList2, {
1613
+ children: files.map((file, idx) => /* @__PURE__ */ jsxDEV2(Tab2, {
1614
+ className: "text-[13px] font-medium text-zinc-400 hover:text-zinc-200 aria-selected:text-white",
1615
+ children: /* @__PURE__ */ jsxDEV2("div", {
1616
+ className: "flex items-center gap-1.5",
1617
+ children: [
1618
+ getLangIcon(file.lang || lang),
1619
+ /* @__PURE__ */ jsxDEV2("span", {
1620
+ children: file.label
1621
+ }, undefined, false, undefined, this)
1622
+ ]
1623
+ }, undefined, true, undefined, this)
1624
+ }, `${file.label}-${idx}`, false, undefined, this))
1625
+ }, undefined, false, undefined, this)
1626
+ ]
1627
+ }, undefined, true, undefined, this),
1628
+ /* @__PURE__ */ jsxDEV2(TabPanels2, {
1629
+ className: "",
1630
+ children: files.map((file, idx) => /* @__PURE__ */ jsxDEV2(TabPanel2, {
1631
+ className: "p-0",
1632
+ children: /* @__PURE__ */ jsxDEV2(CodeBlock, {
1633
+ lang: file.lang || lang || "text",
1634
+ rows,
1635
+ height,
1636
+ width,
1637
+ theme,
1638
+ line,
1639
+ wrap,
1640
+ fold,
1641
+ downloadFilename: file.downloadFilename,
1642
+ languageBadge,
1643
+ expandable,
1644
+ className: "rounded-none",
1645
+ children: file.code
1646
+ }, undefined, false, undefined, this)
1647
+ }, `${file.label}-${idx}`, false, undefined, this))
1648
+ }, undefined, false, undefined, this)
1649
+ ]
1650
+ }, undefined, true, undefined, this)
1651
+ }, undefined, false, undefined, this);
1652
+ }
1653
+ return /* @__PURE__ */ jsxDEV2(CodeBlock, {
1654
+ ...props
1655
+ }, undefined, false, undefined, this);
1656
+ }
1657
+ function InlineCode2({
1658
+ children,
1659
+ className,
1660
+ variant = "subtle",
1661
+ size = "sm",
1662
+ ...props
1663
+ }) {
1664
+ const sizeMap = {
1665
+ xs: "text-[10.5px] px-1.5 py-0",
1666
+ sm: "text-[11.5px] px-1.5 py-0",
1667
+ md: "text-[12.5px] px-2 py-[1px]"
1668
+ };
1669
+ let variantClass = "";
1670
+ if (variant === "outline") {
1671
+ variantClass = "border border-[color:var(--color-primary-safe,#1d5b96)] bg-transparent text-[color:var(--color-primary-safe,#1d5b96)] dark:border-[color:var(--color-primary,#3377bb)] dark:text-[color:var(--color-primary,#3377bb)]";
1672
+ } else if (variant === "solid") {
1673
+ variantClass = "bg-[var(--color-primary)] text-[color:var(--color-primary-foreground)]";
1674
+ } else {
1675
+ variantClass = "border border-[color:var(--color-border)] bg-[color:color-mix(in_srgb,var(--color-foreground)_6%,transparent)] text-[color:var(--color-primary-safe,#1d5b96)] dark:text-[color:var(--color-primary,#3377bb)]";
1676
+ }
1677
+ return /* @__PURE__ */ jsxDEV2("code", {
1678
+ className: cn2("inline-block align-baseline font-mono font-semibold rounded-[var(--ui-radius-sm,4px)] leading-[1.15] tracking-tight", sizeMap[size] || sizeMap.sm, variantClass, className),
1679
+ ...props,
1680
+ children
1681
+ }, undefined, false, undefined, this);
1682
+ }
1683
+
1684
+ export { ensureAceModes2, resolveAceMode2, enhanceModeTokenizer2, CodeEditor2, Code2, InlineCode2 };
1685
+
1686
+ //# debugId=A27644E761486E5264756E2164756E21