@chaibuilder/sdk 1.2.9 → 1.2.10-7.beta.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 (122) hide show
  1. package/README.md +26 -21
  2. package/dist/CodeEditor-3Vp79cuE.cjs +1 -0
  3. package/dist/CodeEditor-bUqM7eCa.js +129 -0
  4. package/dist/STRINGS-Xxstm-7I.js +7 -0
  5. package/dist/STRINGS-Yl7cSWDc.cjs +1 -0
  6. package/dist/Topbar-P7-9Rps1.js +124 -0
  7. package/dist/Topbar-xwQ4JUZD.cjs +1 -0
  8. package/dist/UnsplashImages-BxgbXGB6.cjs +1 -0
  9. package/dist/UnsplashImages-nQSvWPU0.js +244 -0
  10. package/dist/UploadImages-L9LlI-jl.cjs +1 -0
  11. package/dist/UploadImages-SVnIHigg.js +153 -0
  12. package/dist/context-menu-YGd09SE1.js +979 -0
  13. package/dist/context-menu-sQn7ryJ6.cjs +1 -0
  14. package/dist/{controls-XPXGHKht.js → controls-lEwMTdPQ.js} +96 -44
  15. package/dist/controls-p9IwFnPx.cjs +1 -0
  16. package/dist/core.cjs +1 -1
  17. package/dist/core.d.ts +344 -119
  18. package/dist/core.js +111 -88
  19. package/dist/iconBase-Ief2hJUZ.js +130 -0
  20. package/dist/iconBase-aZzpqff_.cjs +1 -0
  21. package/dist/index-3NV_rst1.js +9051 -0
  22. package/dist/index-qTKBamQ6.cjs +63 -0
  23. package/dist/jsx-runtime-JYMCiFoE.cjs +27 -0
  24. package/dist/{jsx-runtime-WbnYoNE9.js → jsx-runtime-Sp0orL4X.js} +106 -109
  25. package/dist/mockServiceWorker.js +18 -10
  26. package/dist/plugin-UiUFs2fK.js +44 -0
  27. package/dist/plugin-f6SDZ_Or.js +108 -0
  28. package/dist/plugin-jum1MjXp.cjs +1 -0
  29. package/dist/plugin-xOpS-UNV.cjs +1 -0
  30. package/dist/render.cjs +3 -1
  31. package/dist/render.d.ts +21 -40
  32. package/dist/render.js +129 -85
  33. package/dist/runtime.cjs +1 -0
  34. package/dist/runtime.d.ts +5 -0
  35. package/dist/runtime.js +21 -0
  36. package/dist/style.css +2 -2
  37. package/dist/tailwind.cjs +1 -1
  38. package/dist/tailwind.d.ts +49 -8
  39. package/dist/tailwind.js +16 -20
  40. package/dist/ui.cjs +1 -1
  41. package/dist/ui.d.ts +3 -13
  42. package/dist/ui.js +363 -163
  43. package/dist/web-blocks.cjs +3 -9
  44. package/dist/web-blocks.d.ts +1 -1
  45. package/dist/web-blocks.js +722 -770
  46. package/package.json +66 -83
  47. package/dist/AddBlocks-tMxKPoen.js +0 -225
  48. package/dist/AddBlocks-x2LkOHSj.cjs +0 -1
  49. package/dist/BrandingOptions-EzT9UYd6.cjs +0 -1
  50. package/dist/BrandingOptions-QJJ1y5ez.js +0 -194
  51. package/dist/CanvasArea-mlNKmCOh.js +0 -1425
  52. package/dist/CanvasArea-xs4wM64L.cjs +0 -60
  53. package/dist/CurrentPage-aaU4F7wi.cjs +0 -1
  54. package/dist/CurrentPage-lBy25sZn.js +0 -111
  55. package/dist/Functions-7jnEwJyw.js +0 -15
  56. package/dist/Functions-N3yhPYKY.cjs +0 -1
  57. package/dist/Layers-3Xs4A5i8.js +0 -404
  58. package/dist/Layers-eaHy5PK9.cjs +0 -1
  59. package/dist/MODIFIERS-2FeVfZQ9.cjs +0 -1
  60. package/dist/MODIFIERS-RiXS5Mn1.js +0 -67
  61. package/dist/MarkAsGlobalBlock-BjP-Rqlf.js +0 -88
  62. package/dist/MarkAsGlobalBlock-X5dNmZcb.cjs +0 -1
  63. package/dist/PagesPanel--BZhafnt.js +0 -69
  64. package/dist/PagesPanel-gGKCV394.cjs +0 -1
  65. package/dist/ProjectPanel-YcLkM-DW.js +0 -90
  66. package/dist/ProjectPanel-yFJRy0_E.cjs +0 -1
  67. package/dist/Settings-7wlLcvoh.cjs +0 -1
  68. package/dist/Settings-TAgX4hov.js +0 -2186
  69. package/dist/SidePanels-5H4j0mIs.cjs +0 -1
  70. package/dist/SidePanels-btVQQkVK.js +0 -349
  71. package/dist/Topbar-V8xCetWF.cjs +0 -1
  72. package/dist/Topbar-j4t4AgCq.js +0 -116
  73. package/dist/UnsplashImages-41Y3q5_Q.js +0 -200
  74. package/dist/UnsplashImages-DbHky6cj.cjs +0 -1
  75. package/dist/UploadImages-DnQ95_NW.cjs +0 -1
  76. package/dist/UploadImages-xBg-kbKv.js +0 -138
  77. package/dist/_commonjsHelpers-UyOWmZb0.js +0 -8
  78. package/dist/_commonjsHelpers-wDK0ZLPo.cjs +0 -1
  79. package/dist/add-page-modal-MwS7iXn_.cjs +0 -1
  80. package/dist/add-page-modal-cm8damU2.js +0 -108
  81. package/dist/confirm-alert-U7-NcG7G.cjs +0 -1
  82. package/dist/confirm-alert-i4pM3mOt.js +0 -62
  83. package/dist/controls-Dy1qa8Dc.cjs +0 -1
  84. package/dist/delete-page-modal-5o4jXu-z.cjs +0 -1
  85. package/dist/delete-page-modal-YrIBvfFA.js +0 -88
  86. package/dist/email-blocks.cjs +0 -1
  87. package/dist/email-blocks.d.ts +0 -3
  88. package/dist/email-blocks.js +0 -274
  89. package/dist/form-OVmsLOrc.js +0 -125
  90. package/dist/form-VbouZlAW.cjs +0 -1
  91. package/dist/functions-Ox_svtKm.cjs +0 -1
  92. package/dist/functions-xIebp8Aw.js +0 -23
  93. package/dist/html-to-json-2PeOCVey.cjs +0 -1
  94. package/dist/html-to-json-57841sEK.js +0 -183
  95. package/dist/index-H6vIwGfD.cjs +0 -1
  96. package/dist/index-N50dZnlC.cjs +0 -206
  97. package/dist/index-e0c8PmRQ.js +0 -205
  98. package/dist/index-gi1LIOCw.cjs +0 -1
  99. package/dist/index-niHREMmR.js +0 -2938
  100. package/dist/index-pZhGT8uT.js +0 -41620
  101. package/dist/jsx-runtime-Z_BpKhVy.cjs +0 -27
  102. package/dist/lib.cjs +0 -4
  103. package/dist/lib.d.ts +0 -78
  104. package/dist/lib.js +0 -1322
  105. package/dist/page-viewer-SLt8XgYv.cjs +0 -1
  106. package/dist/page-viewer-feqJr1QI.js +0 -115
  107. package/dist/project-general-setting-SgagORzW.js +0 -83
  108. package/dist/project-general-setting-ym0yCdOq.cjs +0 -1
  109. package/dist/project-seo-setting-Snn2nZgS.cjs +0 -1
  110. package/dist/project-seo-setting-wxAGEkd_.js +0 -85
  111. package/dist/server.cjs +0 -1
  112. package/dist/server.d.ts +0 -299
  113. package/dist/server.js +0 -216
  114. package/dist/single-page-detail-IPod1o5P.cjs +0 -1
  115. package/dist/single-page-detail-dnWMyg6P.js +0 -222
  116. package/dist/studio.cjs +0 -1
  117. package/dist/studio.d.ts +0 -13
  118. package/dist/studio.js +0 -58
  119. package/dist/useAddBlockByDrop-_nwI4W3q.js +0 -20
  120. package/dist/useAddBlockByDrop-inkD7Lck.cjs +0 -1
  121. package/dist/utils-AvyFzbPC.js +0 -1075
  122. package/dist/utils-PTxFk6qT.cjs +0 -1
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@chaibuilder/sdk",
3
- "description": "Open source low-code visual builder",
3
+ "description": "AI Enabled Open source visual builder",
4
4
  "private": false,
5
5
  "author": "Suraj Air",
6
6
  "license": "BSD-3-Clause",
7
7
  "homepage": "https://chaibuilder.com",
8
- "version": "1.2.9",
8
+ "version": "1.2.107.beta.1",
9
9
  "type": "module",
10
10
  "repository": {
11
11
  "type": "git",
@@ -16,6 +16,20 @@
16
16
  ],
17
17
  "main": "dist/core.js",
18
18
  "sideEffects": false,
19
+ "scripts": {
20
+ "dev": "vite",
21
+ "build": "tsc && vite build",
22
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
23
+ "preview": "vite preview",
24
+ "test": "jest --colors --verbose",
25
+ "test:watch": "jest --watch --colors",
26
+ "test:coverage": "jest --coverage --colors",
27
+ "e2e": "playwright test",
28
+ "e2e:report": "playwright show-report",
29
+ "e2e:ui": "playwright test --ui",
30
+ "docs": "typedoc --plugin typedoc-plugin-clarity",
31
+ "prepare": "husky"
32
+ },
19
33
  "exports": {
20
34
  ".": {
21
35
  "import": "./dist/core.js",
@@ -32,21 +46,6 @@
32
46
  "require": "./dist/ui.cjs",
33
47
  "types": "./dist/ui.d.ts"
34
48
  },
35
- "./lib": {
36
- "import": "./dist/lib.js",
37
- "require": "./dist/lib.cjs",
38
- "types": "./dist/lib.d.ts"
39
- },
40
- "./server": {
41
- "import": "./dist/server.js",
42
- "require": "./dist/server.cjs",
43
- "types": "./dist/server.d.ts"
44
- },
45
- "./studio": {
46
- "import": "./dist/studio.js",
47
- "require": "./dist/studio.cjs",
48
- "types": "./dist/studio.d.ts"
49
- },
50
49
  "./tailwind": {
51
50
  "import": "./dist/tailwind.js",
52
51
  "require": "./dist/tailwind.cjs",
@@ -61,53 +60,39 @@
61
60
  "require": "./dist/web-blocks.cjs",
62
61
  "types": "./dist/web-blocks.d.ts"
63
62
  },
64
- "./email-blocks": {
65
- "import": "./dist/email-blocks.js",
66
- "require": "./dist/email-blocks.cjs",
67
- "types": "./dist/email-blocks.d.ts"
63
+ "./runtime": {
64
+ "import": "./dist/runtime.js",
65
+ "require": "./dist/runtime.cjs",
66
+ "types": "./dist/runtime.d.ts"
68
67
  }
69
68
  },
70
- "scripts": {
71
- "dev": "vite",
72
- "build": "tsc && vite build",
73
- "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
74
- "preview": "vite preview",
75
- "test": "jest --colors --verbose",
76
- "test:watch": "jest --watch --colors",
77
- "test:coverage": "jest --coverage --colors",
78
- "e2e": "playwright test",
79
- "e2e:report": "playwright show-report",
80
- "e2e:ui": "playwright test --ui",
81
- "docs": "jsdoc -c jsdoc.conf.json",
82
- "prepare": "husky"
83
- },
84
69
  "dependencies": {
85
- "@bobthered/tailwindcss-palette-generator": "3.1.1",
86
- "@chaibuilder/runtime": "0.2.2",
70
+ "@bobthered/tailwindcss-palette-generator": "^4.0.0",
71
+ "@chaibuilder/runtime": "0.2.12",
87
72
  "@floating-ui/dom": "1.4.5",
88
73
  "@floating-ui/react-dom": "2.0.1",
89
- "@mhsdesign/jit-browser-tailwindcss": "0.4.0",
90
- "@minoru/react-dnd-treeview": "3.4.4",
74
+ "@mhsdesign/jit-browser-tailwindcss": "0.4.1",
75
+ "@monaco-editor/react": "^4.6.0",
91
76
  "@radix-ui/react-accordion": "^1.1.2",
92
- "@radix-ui/react-alert-dialog": "^1.0.4",
93
- "@radix-ui/react-context-menu": "^2.1.4",
94
- "@radix-ui/react-dialog": "^1.0.4",
95
- "@radix-ui/react-dropdown-menu": "^2.0.5",
96
- "@radix-ui/react-hover-card": "^1.0.6",
77
+ "@radix-ui/react-alert-dialog": "^1.0.5",
78
+ "@radix-ui/react-context-menu": "^2.1.5",
79
+ "@radix-ui/react-dialog": "^1.0.5",
80
+ "@radix-ui/react-dropdown-menu": "^2.0.6",
81
+ "@radix-ui/react-hover-card": "^1.0.7",
97
82
  "@radix-ui/react-icons": "^1.3.0",
98
83
  "@radix-ui/react-label": "^2.0.2",
99
- "@radix-ui/react-menubar": "^1.0.3",
100
- "@radix-ui/react-navigation-menu": "^1.1.3",
101
- "@radix-ui/react-popover": "^1.0.6",
102
- "@radix-ui/react-scroll-area": "^1.0.4",
84
+ "@radix-ui/react-menubar": "^1.0.4",
85
+ "@radix-ui/react-navigation-menu": "^1.1.4",
86
+ "@radix-ui/react-popover": "^1.0.7",
87
+ "@radix-ui/react-scroll-area": "^1.0.5",
103
88
  "@radix-ui/react-select": "^1.2.2",
104
89
  "@radix-ui/react-separator": "^1.0.3",
105
90
  "@radix-ui/react-slot": "^1.0.2",
106
91
  "@radix-ui/react-switch": "^1.0.3",
107
92
  "@radix-ui/react-tabs": "^1.0.4",
108
- "@radix-ui/react-toast": "^1.1.4",
93
+ "@radix-ui/react-toast": "^1.1.5",
109
94
  "@radix-ui/react-toggle": "^1.0.3",
110
- "@radix-ui/react-tooltip": "^1.0.6",
95
+ "@radix-ui/react-tooltip": "^1.0.7",
111
96
  "@react-email/components": "^0.0.18",
112
97
  "@react-email/render": "^0.0.14",
113
98
  "@react-hookz/web": "23.1.0",
@@ -118,51 +103,41 @@
118
103
  "@tailwindcss/forms": "^0.5.6",
119
104
  "@tailwindcss/line-clamp": "^0.4.4",
120
105
  "@tailwindcss/typography": "^0.5.10",
121
- "@tanstack/react-query": "^5.8.4",
122
106
  "class-variance-authority": "0.6.1",
123
107
  "clsx": "1.2.1",
124
108
  "cmdk": "0.2.0",
125
- "date-fns": "^2.30.0",
126
109
  "flagged": "2.0.9",
127
- "flat-to-nested": "1.1.1",
128
- "focus-trap-react": "^10.2.1",
129
- "forgiving-xml-parser": "1.4.0",
130
- "framer-motion": "^10.12.18",
110
+ "framer-motion": "^11.4.0",
131
111
  "fuse.js": "6.6.2",
132
- "gray-matter": "^4.0.3",
133
112
  "himalaya": "^1.1.0",
134
- "html-formatter": "0.1.9",
135
- "i18next": "^23.2.8",
113
+ "i18next": "^23.6.0",
136
114
  "jotai": "2.2.2",
137
115
  "lodash": "^4.17.21",
138
116
  "lodash-es": "4.17.21",
139
117
  "lucide-react": "^0.244.0",
140
- "nanoid": "^4.0.2",
141
- "post-robot": "10.0.46",
142
- "react": "^18",
118
+ "re-resizable": "^6.9.17",
119
+ "react": "^18.2.0",
120
+ "react-arborist": "^3.4.0",
143
121
  "react-autosuggest": "10.1.0",
144
122
  "react-colorful": "5.6.1",
145
- "react-dnd": "16.0.1",
146
- "react-dnd-html5-backend": "16.0.1",
147
- "react-dom": "^18",
123
+ "react-dom": "^18.2.0",
148
124
  "react-email": "^2.1.3",
125
+ "react-error-boundary": "^4.0.13",
126
+ "react-event-hook": "^3.1.2",
149
127
  "react-hotkeys-hook": "4.4.1",
150
128
  "react-i18next": "13.0.1",
151
- "react-icons": "^4.10.1",
129
+ "react-icons": "5.3.0",
152
130
  "react-icons-picker": "^1.0.9",
153
131
  "react-json-view-lite": "^1.4.0",
154
132
  "react-quill": "^2.0.0",
155
- "react-textarea-autosize": "^8.5.2",
156
- "react-wrap-balancer": "^1.0.0",
157
- "redux-undo": "1.1.0",
158
- "sonner": "^1.2.0",
159
- "tailwind-merge": "1.13.2",
160
- "tippy.js": "^6.3.7",
133
+ "react-wrap-balancer": "^1.1.0",
134
+ "tailwind-merge": "2.3.0",
135
+ "tree-model": "^1.0.7",
161
136
  "undo-manager": "^1.1.1",
162
- "unist-util-visit": "^4.1.2",
163
137
  "unsplash-js": "^7.0.18"
164
138
  },
165
139
  "devDependencies": {
140
+ "@ai-sdk/openai": "^0.0.37",
166
141
  "@commitlint/cli": "17.7.1",
167
142
  "@commitlint/config-conventional": "17.7.0",
168
143
  "@emotion/react": "^11.11.1",
@@ -170,24 +145,27 @@
170
145
  "@nozbe/watermelondb": "^0.27.1",
171
146
  "@playwright/test": "^1.39.0",
172
147
  "@tanstack/eslint-plugin-query": "^5.8.4",
148
+ "@testing-library/react": "^16.0.0",
173
149
  "@testing-library/react-hooks": "^8.0.1",
174
- "@types/better-sqlite3": "^7.6.7",
175
150
  "@types/jest": "^29.5.7",
176
151
  "@types/lodash": "^4.14.200",
177
152
  "@types/node": "^20.8.10",
178
- "@types/react": "^18.2.15",
179
- "@types/react-dom": "^18.2.7",
180
- "@typescript-eslint/eslint-plugin": "^6.0.0",
181
- "@typescript-eslint/parser": "^6.0.0",
182
- "@vitejs/plugin-react-swc": "^3.3.2",
153
+ "@types/react": "^18.2.34",
154
+ "@types/react-dom": "^18.2.14",
155
+ "@typescript-eslint/eslint-plugin": "^6.9.1",
156
+ "@typescript-eslint/parser": "^6.9.1",
157
+ "@vitejs/plugin-react-swc": "^3.4.1",
158
+ "ai": "^3.2.32",
183
159
  "autoprefixer": "^10.4.16",
160
+ "axios": "^1.7.7",
184
161
  "better-docs": "^2.7.2",
185
- "better-sqlite3": "^9.1.1",
162
+ "cheerio": "1.0.0-rc.12",
163
+ "dotenv": "^16.4.5",
186
164
  "drizzle-kit": "^0.20.4",
187
165
  "drizzle-orm": "^0.29.0",
188
- "eslint": "^8.45.0",
166
+ "eslint": "^8.53.0",
189
167
  "eslint-plugin-react-hooks": "^4.6.0",
190
- "eslint-plugin-react-refresh": "^0.4.3",
168
+ "eslint-plugin-react-refresh": "^0.4.4",
191
169
  "husky": "^9.0.10",
192
170
  "jest": "^29.7.0",
193
171
  "jest-environment-jsdom": "^29.7.0",
@@ -202,9 +180,14 @@
202
180
  "tailwindcss": "^3.3.5",
203
181
  "tailwindcss-animate": "1.0.6",
204
182
  "ts-jest": "^29.1.1",
183
+ "ts-node": "^10.9.2",
184
+ "typedoc": "^0.26.7",
185
+ "typedoc-github-theme": "^0.1.2",
186
+ "typedoc-plugin-clarity": "^1.6.0",
205
187
  "typescript": "^5.2.2",
206
188
  "vite": "^5.0.12",
207
- "vite-plugin-dts": "^3.6.3"
189
+ "vite-plugin-dts": "^3.6.3",
190
+ "zod": "^3.23.8"
208
191
  },
209
192
  "msw": {
210
193
  "workerDirectory": "public"
@@ -1,225 +0,0 @@
1
- import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
- import B, { createElement as U, useState as b, useCallback as W, useMemo as J, useEffect as K, Suspense as $ } from "react";
3
- import { has as D, first as u, omit as Q, isEmpty as j, filter as v, values as y, groupBy as N, mergeWith as X, isArray as L, keys as Y, get as Z, map as A, includes as _, find as H, uniq as ee, reject as F } from "lodash-es";
4
- import { useAtom as k } from "jotai";
5
- import { useTranslation as G } from "react-i18next";
6
- import { P, j as w, $ as se, aw as S, aD as re, aE as te, aG as oe, i as z, a9 as M, ar as le, as as ae, at as ie, au as ne, av as E, bo as ce, bp as de, bq as me, br as pe, aI as ue, bs as xe, bt as he, B as fe, bu as ge, bv as be, bw as je, af as ve, ax as ye, ay as Be, az as C, bn as ke, bg as we, bh as Te, bi as Ce, bj as Ne, S as Ae } from "./index-niHREMmR.js";
7
- import { BoxIcon as _e } from "@radix-ui/react-icons";
8
- import { syncBlocksWithDefaults as q, useChaiBlocks as V } from "@chaibuilder/runtime";
9
- import { useFeature as Pe } from "flagged";
10
- import { Loader as Se } from "lucide-react";
11
- import { useDrag as Ie, DragPreviewImage as Le } from "react-dnd";
12
- import { g as He } from "./html-to-json-57841sEK.js";
13
- import "./_commonjsHelpers-UyOWmZb0.js";
14
- import "@radix-ui/react-toggle";
15
- import "class-variance-authority";
16
- import "./utils-AvyFzbPC.js";
17
- import "./MODIFIERS-RiXS5Mn1.js";
18
- import "clsx";
19
- import "tailwind-merge";
20
- import "@radix-ui/react-switch";
21
- import "@radix-ui/react-slot";
22
- import "@radix-ui/react-accordion";
23
- import "@radix-ui/react-alert-dialog";
24
- import "@radix-ui/react-dialog";
25
- import "@radix-ui/react-label";
26
- import "@radix-ui/react-scroll-area";
27
- import "@radix-ui/react-tabs";
28
- import "@radix-ui/react-tooltip";
29
- import "@radix-ui/react-popover";
30
- import "@radix-ui/react-menubar";
31
- import "@radix-ui/react-hover-card";
32
- import "@radix-ui/react-select";
33
- import "@radix-ui/react-dropdown-menu";
34
- import "@radix-ui/react-separator";
35
- import "@radix-ui/react-toast";
36
- import "cmdk";
37
- import "@radix-ui/react-context-menu";
38
- import "react-icons-picker";
39
- import "react-dom";
40
- import "react-quill";
41
- import "flat-to-nested";
42
- import "./Functions-7jnEwJyw.js";
43
- import "redux-undo";
44
- import "lodash";
45
- import "@react-hookz/web";
46
- import "himalaya";
47
- const Fe = ({ block: s }) => {
48
- const { type: r, icon: t, label: l } = s, { addCoreBlock: d, addPredefinedBlock: n } = P(), [m, o] = w(), [, x] = se(), [, p] = k(S), i = () => {
49
- D(s, "blocks") ? n(q(s.blocks), u(m)) : d(s, u(m)), p("layers");
50
- }, a = Pe("dnd");
51
- return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(re, { children: [
52
- /* @__PURE__ */ e.jsx(te, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
53
- "button",
54
- {
55
- onClick: i,
56
- type: "button",
57
- onDragStart: (f) => {
58
- f.dataTransfer.setData("text/plain", JSON.stringify(Q(s, ["component", "icon"]))), setTimeout(() => {
59
- o([]), x(null), p("layers");
60
- }, 200);
61
- },
62
- draggable: a ? "true" : "false",
63
- className: "space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 " + (a ? "cursor-grab" : "cursor-pointer"),
64
- children: [
65
- U(t || _e, { className: "w-4 h-4 mx-auto" }),
66
- /* @__PURE__ */ e.jsx("p", { className: "truncate text-xs", children: l || r })
67
- ]
68
- }
69
- ) }),
70
- /* @__PURE__ */ e.jsx(oe, { children: /* @__PURE__ */ e.jsx("p", { children: l || r }) })
71
- ] }) });
72
- }, Ee = ({ block: s, closePopover: r }) => {
73
- var a;
74
- const [t, l] = b(!1), d = z("getExternalPredefinedBlock"), { addCoreBlock: n, addPredefinedBlock: m } = P(), [o] = w(), [, x, p] = Ie(
75
- () => ({
76
- type: "CHAI_BLOCK",
77
- item: s
78
- }),
79
- [s]
80
- ), i = W(
81
- async (f) => {
82
- if (f.stopPropagation(), D(s, "component")) {
83
- n(s, u(o)), r();
84
- return;
85
- }
86
- l(!0);
87
- const h = await d(s);
88
- j(h) || m(q(h), u(o)), r();
89
- },
90
- [s]
91
- );
92
- return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
93
- /* @__PURE__ */ e.jsx(
94
- Le,
95
- {
96
- connect: p,
97
- src: "https://placehold.co/100x30/000000/FFF?text=" + ((a = s.name || s.label) == null ? void 0 : a.replace(" ", "+"))
98
- }
99
- ),
100
- /* @__PURE__ */ e.jsxs(
101
- "div",
102
- {
103
- ref: x,
104
- onClick: t ? () => {
105
- } : i,
106
- className: "relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",
107
- children: [
108
- t && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70", children: [
109
- /* @__PURE__ */ e.jsx(Se, { className: "animate-spin", size: 15, color: "white" }),
110
- " ",
111
- /* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
112
- ] }),
113
- s.preview ? /* @__PURE__ */ e.jsx(
114
- "img",
115
- {
116
- src: s.preview,
117
- className: "min-h-[50px] w-full rounded-md border border-gray-300",
118
- alt: s.label
119
- }
120
- ) : /* @__PURE__ */ e.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200", children: /* @__PURE__ */ e.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: s.label }) })
121
- ]
122
- }
123
- )
124
- ] });
125
- }, Re = () => {
126
- const { data: s } = M(), r = V(), t = v(y(r), { category: "custom" }), l = N(t, "group"), d = N(s, "group"), n = J(() => X(l, d, (i, a) => {
127
- if (L(i) && L(a))
128
- return [...i, ...a];
129
- }), [l, d]), [m, o] = b(u(Y(n)) || ""), [, x] = k(S), p = Z(n, m, []);
130
- return /* @__PURE__ */ e.jsxs("div", { className: "relative flex flex-col h-full max-h-full overflow-hidden py-2", children: [
131
- /* @__PURE__ */ e.jsx("div", { className: "p-3 sticky top-0 flex w-full items-center", children: /* @__PURE__ */ e.jsxs(le, { value: m, onValueChange: (i) => o(i), children: [
132
- /* @__PURE__ */ e.jsx(ae, { className: "w-full", children: /* @__PURE__ */ e.jsx(ie, { placeholder: "Select a provider" }) }),
133
- /* @__PURE__ */ e.jsxs(ne, { children: [
134
- /* @__PURE__ */ e.jsx(E, { value: "", children: "Choose" }),
135
- B.Children.toArray(
136
- A(n, (i, a) => /* @__PURE__ */ e.jsx(E, { value: a, children: a }, a))
137
- )
138
- ] })
139
- ] }) }),
140
- /* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-2", children: B.Children.toArray(
141
- p.map((i) => /* @__PURE__ */ e.jsx(Ee, { block: i, closePopover: () => x("layers") }))
142
- ) })
143
- ] });
144
- }, De = () => {
145
- const { t: s } = G(), [r, t] = b(""), { addPredefinedBlock: l } = P(), [d] = w(), [, n] = k(S), m = () => {
146
- const o = He(r);
147
- l([...o], u(d) || null), t(""), n("layers");
148
- };
149
- return /* @__PURE__ */ e.jsxs(ce, { className: "border-border/0 p-0 shadow-none", children: [
150
- /* @__PURE__ */ e.jsx(de, { className: "p-3", children: /* @__PURE__ */ e.jsx(me, { children: s("html_snippet_description") }) }),
151
- /* @__PURE__ */ e.jsx(pe, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
152
- /* @__PURE__ */ e.jsx(ue, { htmlFor: "current", className: "text-sm", children: s("tailwind_html_snippet") }),
153
- /* @__PURE__ */ e.jsx(
154
- xe,
155
- {
156
- autoFocus: !0,
157
- tabIndex: 1,
158
- ref: (o) => o && o.focus(),
159
- onChange: (o) => t(o.target.value),
160
- rows: 12,
161
- value: r,
162
- placeholder: s("enter_code_snippet"),
163
- className: "resize-none bg-gray-100 overflow-x-auto whitespace-pre text-xs font-mono font-normal"
164
- }
165
- )
166
- ] }) }),
167
- /* @__PURE__ */ e.jsxs(he, { className: "flex flex-col justify-end p-3", children: [
168
- /* @__PURE__ */ e.jsx(fe, { disabled: r.trim() === "", onClick: () => m(), size: "sm", className: "w-full", children: s("import_html") }),
169
- /* @__PURE__ */ e.jsx(ge, { variant: "default", className: "mt-2 p-1 border-none text-gray-400", children: /* @__PURE__ */ e.jsx(be, { className: "text-xs font-normal leading-4", children: s("note_imported_html") }) })
170
- ] })
171
- ] });
172
- }, R = ["ListItem", "TableHead", "TableBody", "TableRow", "TableCell", "Column"], Ge = (s, r) => {
173
- if (!s)
174
- return !_(R, r);
175
- const t = s._type;
176
- return t === "List" ? r === "ListItem" : t === "Table" ? r === "TableHead" || r === "TableBody" : t === "TableHead" || t === "TableBody" ? r === "TableRow" : t === "TableRow" ? r === "TableCell" : t === "Row" ? r === "Column" : t === "Heading" || t === "Text" ? r === "RawText" : !_(R, r);
177
- }, Is = () => {
178
- const { t: s } = G(), [r, t] = b("core"), [l, d] = b("basic"), n = V(), [, m] = k(je), o = z("importHTMLSupport", !0), [x] = w(), p = ve(), i = H(p, { _id: u(x) }), { data: a, isLoading: f } = M(), h = N(
179
- v(n, (c) => Ge(i, c.type)),
180
- "category"
181
- ), g = ee(A(h.core, "group"));
182
- K(() => {
183
- !_(g, l) && !j(g) && !j(l) && d(u(g));
184
- }, [g, l]);
185
- const O = (c) => d((T) => T === c ? "" : c), I = !f && !j(a) || H(y(n), { category: "custom" }) !== void 0;
186
- return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
187
- /* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: [
188
- /* @__PURE__ */ e.jsx("h1", { className: "flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col", children: s("add_block") }),
189
- /* @__PURE__ */ e.jsx("span", { className: "p-0 text-xs font-light leading-3 opacity-80 xl:pl-1", children: s(r === "html" ? "enter_paste_tailwind_html" : "click_to_add_block") })
190
- ] }),
191
- /* @__PURE__ */ e.jsx(
192
- ye,
193
- {
194
- onValueChange: (c) => {
195
- m(""), t(c);
196
- },
197
- value: r,
198
- className: "h-max",
199
- children: /* @__PURE__ */ e.jsxs(Be, { className: "grid w-full " + (I && o ? "grid-cols-3" : "grid-cols-2"), children: [
200
- /* @__PURE__ */ e.jsx(C, { value: "core", children: s("core") }),
201
- I ? /* @__PURE__ */ e.jsx(C, { value: "ui-blocks", children: s("custom_blocks") }) : null,
202
- o ? /* @__PURE__ */ e.jsx(C, { value: "html", children: s("import") }) : null
203
- ] })
204
- }
205
- ),
206
- r === "core" && /* @__PURE__ */ e.jsx(ke, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(we, { type: "single", value: l, className: "w-full px-3", children: B.Children.toArray(
207
- A(
208
- g,
209
- (c) => F(v(y(h.core), { group: c }), {
210
- hidden: !0
211
- }).length ? /* @__PURE__ */ e.jsxs(Te, { value: c, className: "border-border", children: [
212
- /* @__PURE__ */ e.jsx(Ce, { onClick: () => O(c), className: "py-2 capitalize", children: c }),
213
- /* @__PURE__ */ e.jsx(Ne, { children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3 gap-2", children: B.Children.toArray(
214
- F(v(y(h.core), { group: c }), { hidden: !0 }).map((T) => /* @__PURE__ */ e.jsx(Fe, { block: T }))
215
- ) }) })
216
- ] }) : null
217
- )
218
- ) }) }),
219
- r === "ui-blocks" && /* @__PURE__ */ e.jsx($, { fallback: /* @__PURE__ */ e.jsx(Ae, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Re, {}) }),
220
- r === "html" && o ? /* @__PURE__ */ e.jsx(De, {}) : null
221
- ] });
222
- };
223
- export {
224
- Is as default
225
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),a=require("react"),t=require("lodash-es"),R=require("jotai"),q=require("react-i18next"),s=require("./index-H6vIwGfD.cjs"),C=require("@radix-ui/react-icons"),b=require("@chaibuilder/runtime"),w=require("flagged"),N=require("lucide-react"),B=require("react-dnd"),A=require("./html-to-json-2PeOCVey.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("./MODIFIERS-2FeVfZQ9.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("./Functions-N3yhPYKY.cjs");require("redux-undo");require("lodash");require("@react-hookz/web");require("himalaya");const S=({block:r})=>{const{type:o,icon:i,label:n}=r,{addCoreBlock:m,addPredefinedBlock:d}=s.useAddBlock(),[p,l]=s.useSelectedBlockIds(),[,h]=s.useHighlightBlockId(),[,j]=R.useAtom(s.activePanelAtom),u=()=>{t.has(r,"blocks")?d(b.syncBlocksWithDefaults(r.blocks),t.first(p)):m(r,t.first(p)),j("layers")},c=w.useFeature("dnd");return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:u,type:"button",onDragStart:g=>{g.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),setTimeout(()=>{l([]),h(null),j("layers")},200)},draggable:c?"true":"false",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(c?"cursor-grab":"cursor-pointer"),children:[a.createElement(i||C.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:n||o})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:n||o})})]})})},I=({block:r,closePopover:o})=>{var c;const[i,n]=a.useState(!1),m=s.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:d,addPredefinedBlock:p}=s.useAddBlock(),[l]=s.useSelectedBlockIds(),[,h,j]=B.useDrag(()=>({type:"CHAI_BLOCK",item:r}),[r]),u=a.useCallback(async g=>{if(g.stopPropagation(),t.has(r,"component")){d(r,t.first(l)),o();return}n(!0);const f=await m(r);t.isEmpty(f)||p(b.syncBlocksWithDefaults(f),t.first(l)),o()},[r]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(B.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+((c=r.name||r.label)==null?void 0:c.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:h,onClick:i?()=>{}:u,className:"relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[i&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(N.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),r.preview?e.jsxRuntimeExports.jsx("img",{src:r.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:r.label}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:r.label})})]})]})},P=()=>{const{data:r}=s.useUILibraryBlocks(),o=b.useChaiBlocks(),i=t.filter(t.values(o),{category:"custom"}),n=t.groupBy(i,"group"),m=t.groupBy(r,"group"),d=a.useMemo(()=>t.mergeWith(n,m,(u,c)=>{if(t.isArray(u)&&t.isArray(c))return[...u,...c]}),[n,m]),[p,l]=a.useState(t.first(t.keys(d))||""),[,h]=R.useAtom(s.activePanelAtom),j=t.get(d,p,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("div",{className:"p-3 sticky top-0 flex w-full items-center",children:e.jsxRuntimeExports.jsxs(s.Select,{value:p,onValueChange:u=>l(u),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:"Choose"}),a.Children.toArray(t.map(d,(u,c)=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:c,children:c},c)))]})]})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-2",children:a.Children.toArray(j.map(u=>e.jsxRuntimeExports.jsx(I,{block:u,closePopover:()=>h("layers")})))})]})},_=()=>{const{t:r}=q.useTranslation(),[o,i]=a.useState(""),{addPredefinedBlock:n}=s.useAddBlock(),[m]=s.useSelectedBlockIds(),[,d]=R.useAtom(s.activePanelAtom),p=()=>{const l=A.getBlocksFromHTML(o);n([...l],t.first(m)||null),i(""),d("layers")};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsx(s.CardHeader,{className:"p-3",children:e.jsxRuntimeExports.jsx(s.CardDescription,{children:r("html_snippet_description")})}),e.jsxRuntimeExports.jsx(s.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(s.Label,{htmlFor:"current",className:"text-sm",children:r("tailwind_html_snippet")}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:l=>l&&l.focus(),onChange:l=>i(l.target.value),rows:12,value:o,placeholder:r("enter_code_snippet"),className:"resize-none bg-gray-100 overflow-x-auto whitespace-pre text-xs font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:o.trim()==="",onClick:()=>p(),size:"sm",className:"w-full",children:r("import_html")}),e.jsxRuntimeExports.jsx(s.Alert,{variant:"default",className:"mt-2 p-1 border-none text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:r("note_imported_html")})})]})]})},k=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],L=(r,o)=>{if(!r)return!t.includes(k,o);const i=r._type;return i==="List"?o==="ListItem":i==="Table"?o==="TableHead"||o==="TableBody":i==="TableHead"||i==="TableBody"?o==="TableRow":i==="TableRow"?o==="TableCell":i==="Row"?o==="Column":i==="Heading"||i==="Text"?o==="RawText":!t.includes(k,o)},H=()=>{const{t:r}=q.useTranslation(),[o,i]=a.useState("core"),[n,m]=a.useState("basic"),d=b.useChaiBlocks(),[,p]=R.useAtom(s.showPredefinedBlockCategoryAtom),l=s.useBuilderProp("importHTMLSupport",!0),[h]=s.useSelectedBlockIds(),j=s.useAllBlocks(),u=t.find(j,{_id:t.first(h)}),{data:c,isLoading:g}=s.useUILibraryBlocks(),f=t.groupBy(t.filter(d,x=>L(u,x.type)),"category"),E=t.uniq(t.map(f.core,"group"));a.useEffect(()=>{!t.includes(E,n)&&!t.isEmpty(E)&&!t.isEmpty(n)&&m(t.first(E))},[E,n]);const T=x=>m(y=>y===x?"":x),v=!g&&!t.isEmpty(c)||t.find(t.values(d),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col",children:r("add_block")}),e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:r(o==="html"?"enter_paste_tailwind_html":"click_to_add_block")})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:x=>{p(""),i(x)},value:o,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(v&&l?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:r("core")}),v?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:r("custom_blocks")}):null,l?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:r("import")}):null]})}),o==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:n,className:"w-full px-3",children:a.Children.toArray(t.map(E,x=>t.reject(t.filter(t.values(f.core),{group:x}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:x,className:"border-border",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{onClick:()=>T(x),className:"py-2 capitalize",children:x}),e.jsxRuntimeExports.jsx(s.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:a.Children.toArray(t.reject(t.filter(t.values(f.core),{group:x}),{hidden:!0}).map(y=>e.jsxRuntimeExports.jsx(S,{block:y})))})})]}):null))})}),o==="ui-blocks"&&e.jsxRuntimeExports.jsx(a.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(P,{})}),o==="html"&&l?e.jsxRuntimeExports.jsx(_,{}):null]})};exports.default=H;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./jsx-runtime-Z_BpKhVy.cjs"),B=require("react"),R=require("@rjsf/validator-ajv8"),E=require("@rjsf/core"),p=require("./index-H6vIwGfD.cjs"),r=require("./controls-Dy1qa8Dc.cjs"),m=require("lodash-es");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("./MODIFIERS-2FeVfZQ9.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("./Functions-N3yhPYKY.cjs");require("redux-undo");require("@chaibuilder/runtime");require("lodash");require("@react-hookz/web");require("react-i18next");function N(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const l=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const x=N(B),k=({value:t,onChange:e,id:i,onBlur:l})=>{const n=m.debounce(e,200),v=u=>n(u.target.value);return a.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:a.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:a.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:t,onBlur:({target:{value:u}})=>l(i,u),onChange:v})})})},f=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],P=()=>{const t=p.useBuilderProp("onSaveBrandingOptions",async()=>{}),[e,i]=p.useBrandingOptions(),[l]=p.useBlocksContainer(),n=x.useRef(e);x.useEffect(()=>()=>{m.isEqual(e,n.current)||t(n.current)},[]);const v=({formData:o},d)=>{d&&(i(o),n.current=o)},{bodyFont:u,headingFont:q,primaryColor:y,bodyTextDarkColor:b,bodyTextLightColor:h,bodyBgDarkColor:S,secondaryColor:C,bodyBgLightColor:O,roundedCorners:j}=e;let s={headingFont:r.f({title:"Heading font",default:q,options:f}),bodyFont:r.f({title:"Body font",default:u,options:f}),roundedCorners:r.c({title:"Rounded Corner",default:parseInt(j||5,10)}),primaryColor:r.y({title:"Primary",default:y}),secondaryColor:r.y({title:"Secondary",default:C})};l||(s={...s,bodyBgLightColor:r.y({title:"Body Background (Light)",default:O}),bodyBgDarkColor:r.y({title:"Body Background (Dark)",default:S}),bodyTextLightColor:r.y({title:"Body Text (Light)",default:b}),bodyTextDarkColor:r.y({title:"Body Text (Dark)",default:h})});const c={type:"object",properties:{}},g={};return Object.keys(s).forEach(o=>{const d=s[o];return c.properties||(c.properties={}),c.properties[o]=d.schema,g[o]=d.uiSchema,!0}),a.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[a.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:a.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),a.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:a.jsxRuntimeExports.jsx(E,{widgets:{color:k},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:g,schema:c,formData:e,validator:R,onChange:v})})]})};exports.default=P;