@chaibuilder/sdk 1.2.93 → 1.2.95

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 (44) hide show
  1. package/dist/{CodeEditor-7AhH7ll8.js → CodeEditor-rsNTHAnV.js} +28 -30
  2. package/dist/CodeEditor-sMmjIL-u.cjs +1 -0
  3. package/dist/{Topbar-X_79oQQf.js → Topbar-TkCq6YMq.js} +19 -21
  4. package/dist/Topbar-f4B5oRp1.cjs +1 -0
  5. package/dist/{UnsplashImages-TlLU5BkT.js → UnsplashImages-Ax3Ik6fg.js} +33 -35
  6. package/dist/UnsplashImages-vCpHQ4up.cjs +1 -0
  7. package/dist/{UploadImages-GiKofaXX.js → UploadImages-Jar31A7w.js} +62 -37
  8. package/dist/UploadImages-KO8wFdE8.cjs +1 -0
  9. package/dist/{context-menu-yLeOsx9j.js → context-menu-9cWJcKdh.js} +463 -427
  10. package/dist/context-menu-sQn7ryJ6.cjs +1 -0
  11. package/dist/core.cjs +1 -1
  12. package/dist/core.js +77 -79
  13. package/dist/iconBase-HBZkvN04.js +330 -0
  14. package/dist/iconBase-kuD_VwQx.cjs +1 -0
  15. package/dist/index-cUydM1n4.cjs +223 -0
  16. package/dist/{index-GjgkZP8W.js → index-esmAeUzA.js} +9012 -7760
  17. package/dist/{plugin-BXpjdQxx.cjs → plugin-P0tpo_XZ.cjs} +1 -1
  18. package/dist/plugin-_F-KZp1i.cjs +1 -0
  19. package/dist/{plugin-DdKuAR7p.js → plugin-f5uJtdXY.js} +1 -1
  20. package/dist/plugin-sJ3Hzvpv.js +57 -0
  21. package/dist/render.cjs +2 -2
  22. package/dist/render.js +6 -7
  23. package/dist/style.css +1 -1
  24. package/dist/tailwind.cjs +1 -1
  25. package/dist/tailwind.js +6 -7
  26. package/dist/ui.cjs +1 -1
  27. package/dist/ui.js +112 -113
  28. package/dist/web-blocks.cjs +1 -1
  29. package/dist/web-blocks.js +235 -265
  30. package/package.json +1 -1
  31. package/dist/CodeEditor-Iy57NpaR.cjs +0 -1
  32. package/dist/Topbar-oXx57vCi.cjs +0 -1
  33. package/dist/UnsplashImages-smJeXVat.cjs +0 -1
  34. package/dist/UploadImages-Ic_iZgWY.cjs +0 -1
  35. package/dist/_commonjsHelpers-f3sTPFkQ.js +0 -8
  36. package/dist/_commonjsHelpers-f52AuuUj.cjs +0 -1
  37. package/dist/button-9Duvj2dH.js +0 -42
  38. package/dist/button-oQgWN0j0.cjs +0 -1
  39. package/dist/context-menu-8MWP_Ikf.cjs +0 -1
  40. package/dist/iconBase-BnEC5_qG.js +0 -1583
  41. package/dist/iconBase-_bgMuxa5.cjs +0 -1
  42. package/dist/index-f5CPA351.cjs +0 -223
  43. package/dist/plugin-02QsHeBE.cjs +0 -1
  44. package/dist/plugin-VDzc8jUO.js +0 -52
@@ -1,25 +1,16 @@
1
1
  import { j as t } from "./jsx-runtime-Sp0orL4X.js";
2
2
  import k from "@monaco-editor/react";
3
- import { B as C } from "./button-9Duvj2dH.js";
3
+ import { B as C } from "./context-menu-9cWJcKdh.js";
4
4
  import { useTranslation as j } from "react-i18next";
5
5
  import { useState as l, useCallback as v, useEffect as g } from "react";
6
- import { a as y, n as N, D as T } from "./iconBase-BnEC5_qG.js";
7
- import { u as E } from "./index-GjgkZP8W.js";
6
+ import { u as y, a as N, b as T, c as E } from "./index-esmAeUzA.js";
8
7
  import { Cross2Icon as w } from "@radix-ui/react-icons";
9
8
  import { useThrottledCallback as B } from "@react-hookz/web";
10
- import "@radix-ui/react-slot";
11
- import "class-variance-authority";
12
- import "clsx";
13
- import "tailwind-merge";
14
- import "lodash-es";
15
- import "jotai";
16
- import "./_commonjsHelpers-f3sTPFkQ.js";
17
- import "@chaibuilder/runtime";
18
- import "tree-model";
19
- import "./context-menu-yLeOsx9j.js";
20
9
  import "@radix-ui/react-switch";
21
10
  import "@radix-ui/react-accordion";
11
+ import "class-variance-authority";
22
12
  import "@radix-ui/react-alert-dialog";
13
+ import "@radix-ui/react-slot";
23
14
  import "@radix-ui/react-label";
24
15
  import "@radix-ui/react-scroll-area";
25
16
  import "@radix-ui/react-tabs";
@@ -33,6 +24,14 @@ import "@radix-ui/react-toast";
33
24
  import "cmdk";
34
25
  import "@radix-ui/react-dialog";
35
26
  import "@radix-ui/react-context-menu";
27
+ import "clsx";
28
+ import "tailwind-merge";
29
+ import "lodash-es";
30
+ import "jotai";
31
+ import "./iconBase-HBZkvN04.js";
32
+ import "@chaibuilder/runtime";
33
+ import "./plugin-sJ3Hzvpv.js";
34
+ import "tree-model";
36
35
  import "react-quill";
37
36
  import "./STRINGS-TDN5UhWi.js";
38
37
  import "flagged";
@@ -44,7 +43,6 @@ import "@tailwindcss/typography";
44
43
  import "@tailwindcss/forms";
45
44
  import "@tailwindcss/aspect-ratio";
46
45
  import "tailwindcss-palette-generator";
47
- import "./plugin-VDzc8jUO.js";
48
46
  import "react-wrap-balancer";
49
47
  import "react-dom";
50
48
  import "prop-types";
@@ -60,24 +58,24 @@ import "react-autosuggest";
60
58
  import "fuse.js";
61
59
  import "i18next";
62
60
  import "framer-motion";
63
- const n = (r) => {
64
- const e = document.createElement("div");
65
- return e.innerHTML = r, e.innerHTML;
61
+ const a = (r) => {
62
+ const i = document.createElement("div");
63
+ return i.innerHTML = r, i.innerHTML;
66
64
  };
67
- function Dt() {
68
- const { t: r } = j(), [e, a] = l(!1), [m, c] = l(""), [o, s] = E(), [p] = y(), d = N(), u = T(), f = B(
69
- (i) => {
70
- const b = n(i);
65
+ function Rt() {
66
+ const { t: r } = j(), [i, n] = l(!1), [m, c] = l(""), [o, s] = y(), [p] = N(), d = T(), u = E(), f = B(
67
+ (e) => {
68
+ const b = a(e);
71
69
  u([o.blockId], { [o.blockProp]: b });
72
70
  },
73
71
  [],
74
72
  300
75
73
  ), x = v(() => {
76
- if (e) {
77
- const i = n(m);
78
- d([o.blockId], { [o.blockProp]: i });
74
+ if (i) {
75
+ const e = a(m);
76
+ d([o.blockId], { [o.blockProp]: e });
79
77
  }
80
- }, [e, m]);
78
+ }, [i, m]);
81
79
  g(() => {
82
80
  p.includes(o == null ? void 0 : o.blockId) || (x(), s(null));
83
81
  }, [p]);
@@ -106,11 +104,11 @@ function Dt() {
106
104
  /* @__PURE__ */ t.jsx(
107
105
  k,
108
106
  {
109
- onMount: (i) => {
110
- i.setValue(o.initialCode);
107
+ onMount: (e) => {
108
+ e.setValue(o.initialCode);
111
109
  },
112
- onChange: (i) => {
113
- a(!0), c(i), f(i);
110
+ onChange: (e) => {
111
+ n(!0), c(e), f(e);
114
112
  },
115
113
  height: "100%",
116
114
  defaultLanguage: "html",
@@ -127,5 +125,5 @@ function Dt() {
127
125
  ] });
128
126
  }
129
127
  export {
130
- Dt as default
128
+ Rt as default
131
129
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),b=require("@monaco-editor/react"),k=require("./context-menu-sQn7ryJ6.cjs"),C=require("react-i18next"),u=require("react"),n=require("./index-cUydM1n4.cjs"),E=require("@radix-ui/react-icons"),R=require("@react-hookz/web");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");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-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-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("lodash-es");require("jotai");require("./iconBase-kuD_VwQx.cjs");require("@chaibuilder/runtime");require("./plugin-_F-KZp1i.cjs");require("tree-model");require("react-quill");require("./STRINGS-Yl7cSWDc.cjs");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("react-event-hook");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("lucide-react");require("@rjsf/validator-ajv8");require("@rjsf/core");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const a=s=>{const i=document.createElement("div");return i.innerHTML=s,i.innerHTML};function g(){const{t:s}=C.useTranslation(),[i,d]=u.useState(!1),[l,q]=u.useState(""),[r,o]=n.useCodeEditor(),[c]=n.useSelectedBlockIds(),x=n.useUpdateBlocksProps(),m=n.useUpdateBlocksPropsRealtime(),p=R.useThrottledCallback(t=>{const h=a(t);m([r.blockId],{[r.blockProp]:h})},[],300),j=u.useCallback(()=>{if(i){const t=a(l);x([r.blockId],{[r.blockProp]:t})}},[i,l]);u.useEffect(()=>{c.includes(r==null?void 0:r.blockId)||(j(),o(null))},[c]);const f=()=>{o(null)};return e.jsxRuntimeExports.jsxs("div",{className:"h-full rounded-t-lg border-t-4 border-black bg-black text-white",children:[e.jsxRuntimeExports.jsx("button",{onClick:f,className:"fixed inset-0 z-[100000] cursor-default bg-gray-400/20"}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100001] h-full w-full flex-col gap-y-1",children:[e.jsxRuntimeExports.jsxs("div",{className:"-mt-1 flex items-center justify-between px-2 py-2",children:[e.jsxRuntimeExports.jsxs("h3",{className:"space-x-3 text-sm font-semibold",children:[e.jsxRuntimeExports.jsx("span",{children:s("HTML Code Editor |")}),e.jsxRuntimeExports.jsx("span",{className:"text-xs text-gray-400",children:s("Scripts will be only executed in preview and live mode.")})]}),e.jsxRuntimeExports.jsx("div",{className:"flex gap-x-2",children:e.jsxRuntimeExports.jsx(k.Button,{onClick:()=>o(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsxRuntimeExports.jsx(E.Cross2Icon,{})})})]}),e.jsxRuntimeExports.jsx(b,{onMount:t=>{t.setValue(r.initialCode)},onChange:t=>{d(!0),q(t),p(t)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})]})}exports.default=g;
@@ -1,15 +1,15 @@
1
1
  import { j as t } from "./jsx-runtime-Sp0orL4X.js";
2
2
  import m, { Suspense as p } from "react";
3
- import { S as n, ab as x } from "./context-menu-yLeOsx9j.js";
4
- import { B as l } from "./button-9Duvj2dH.js";
5
- import { T as d, B as h, m as s } from "./iconBase-BnEC5_qG.js";
6
- import { useTranslation as c } from "react-i18next";
7
- import { F as f, a as u } from "./index-GjgkZP8W.js";
3
+ import { B as c, S as n, ac as x } from "./context-menu-9cWJcKdh.js";
4
+ import { d, F as h, e as o, f } from "./index-esmAeUzA.js";
5
+ import { useTranslation as l } from "react-i18next";
6
+ import { c as u } from "./iconBase-HBZkvN04.js";
8
7
  import { EyeOpenIcon as v } from "@radix-ui/react-icons";
9
8
  import "@radix-ui/react-switch";
10
9
  import "@radix-ui/react-accordion";
11
10
  import "class-variance-authority";
12
11
  import "@radix-ui/react-alert-dialog";
12
+ import "@radix-ui/react-slot";
13
13
  import "@radix-ui/react-label";
14
14
  import "@radix-ui/react-scroll-area";
15
15
  import "@radix-ui/react-tabs";
@@ -23,14 +23,13 @@ import "@radix-ui/react-toast";
23
23
  import "cmdk";
24
24
  import "@radix-ui/react-dialog";
25
25
  import "@radix-ui/react-context-menu";
26
- import "@radix-ui/react-slot";
27
26
  import "clsx";
28
27
  import "tailwind-merge";
29
28
  import "lodash-es";
30
29
  import "jotai";
31
- import "./_commonjsHelpers-f3sTPFkQ.js";
32
- import "@react-hookz/web";
33
30
  import "@chaibuilder/runtime";
31
+ import "./plugin-sJ3Hzvpv.js";
32
+ import "@react-hookz/web";
34
33
  import "tree-model";
35
34
  import "react-quill";
36
35
  import "./STRINGS-TDN5UhWi.js";
@@ -43,7 +42,6 @@ import "@tailwindcss/typography";
43
42
  import "@tailwindcss/forms";
44
43
  import "@tailwindcss/aspect-ratio";
45
44
  import "tailwindcss-palette-generator";
46
- import "./plugin-VDzc8jUO.js";
47
45
  import "react-wrap-balancer";
48
46
  import "react-dom";
49
47
  import "prop-types";
@@ -60,14 +58,14 @@ import "fuse.js";
60
58
  import "i18next";
61
59
  import "framer-motion";
62
60
  const j = () => {
63
- const { savePage: a, saveState: e } = d(), { t: o } = c(), i = /* @__PURE__ */ t.jsxs(
64
- l,
61
+ const { savePage: a, saveState: e } = d(), { t: s } = l(), i = /* @__PURE__ */ t.jsxs(
62
+ c,
65
63
  {
66
64
  disabled: e === "SAVING",
67
65
  onClick: (r) => {
68
66
  r.preventDefault(), a();
69
67
  },
70
- className: h(
68
+ className: u(
71
69
  "flex h-auto w-fit items-center gap-x-2 p-1 px-2",
72
70
  // UNSAVED sate
73
71
  "bg-gray-200 text-gray-500 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-400",
@@ -79,19 +77,19 @@ const j = () => {
79
77
  size: "sm",
80
78
  variant: "outline",
81
79
  children: [
82
- /* @__PURE__ */ t.jsx(f, { className: "text-sm text-white" }),
83
- /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: o(e === "SAVING" ? "saving" : e === "SAVED" ? "saved" : "unsaved") })
80
+ /* @__PURE__ */ t.jsx(h, { className: "text-sm text-white" }),
81
+ /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: s(e === "SAVING" ? "saving" : e === "SAVED" ? "saved" : "unsaved") })
84
82
  ]
85
83
  }
86
84
  );
87
85
  return /* @__PURE__ */ t.jsx("div", { className: "flex items-center", children: i });
88
86
  }, g = function() {
89
- const e = s("previewComponent"), [, o] = u(), { t: i } = c();
87
+ const e = o("previewComponent"), [, s] = f(), { t: i } = l();
90
88
  return e ? /* @__PURE__ */ t.jsxs(
91
- l,
89
+ c,
92
90
  {
93
91
  onClick: (r) => {
94
- r.preventDefault(), o(!0);
92
+ r.preventDefault(), s(!0);
95
93
  },
96
94
  className: "flex h-auto w-fit items-center gap-x-2 p-1 px-2",
97
95
  size: "sm",
@@ -102,8 +100,8 @@ const j = () => {
102
100
  ]
103
101
  }
104
102
  ) : null;
105
- }, At = () => {
106
- const a = s("topBarComponents.left", []), e = s("topBarComponents.center", []), o = s("topBarComponents.right", []), i = s("editable", !0);
103
+ }, St = () => {
104
+ const a = o("topBarComponents.left", []), e = o("topBarComponents.center", []), s = o("topBarComponents.right", []), i = o("editable", !0);
107
105
  return /* @__PURE__ */ t.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
108
106
  /* @__PURE__ */ t.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ t.jsx("div", { className: "flex items-center space-x-2 font-bold", children: m.Children.toArray(
109
107
  a.map((r) => /* @__PURE__ */ t.jsx(p, { fallback: /* @__PURE__ */ t.jsx(n, { className: "h-10" }), children: /* @__PURE__ */ t.jsx(r, {}) }))
@@ -116,11 +114,11 @@ const j = () => {
116
114
  /* @__PURE__ */ t.jsx(x, { orientation: "vertical" }),
117
115
  i ? /* @__PURE__ */ t.jsx(j, {}) : null,
118
116
  m.Children.toArray(
119
- o.map((r) => /* @__PURE__ */ t.jsx(p, { fallback: /* @__PURE__ */ t.jsx(n, { className: "h-10" }), children: /* @__PURE__ */ t.jsx(r, {}) }))
117
+ s.map((r) => /* @__PURE__ */ t.jsx(p, { fallback: /* @__PURE__ */ t.jsx(n, { className: "h-10" }), children: /* @__PURE__ */ t.jsx(r, {}) }))
120
118
  )
121
119
  ] })
122
120
  ] });
123
121
  };
124
122
  export {
125
- At as default
123
+ St as default
126
124
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),n=require("react"),u=require("./context-menu-sQn7ryJ6.cjs"),s=require("./index-cUydM1n4.cjs"),x=require("react-i18next"),c=require("./iconBase-kuD_VwQx.cjs"),l=require("@radix-ui/react-icons");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");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-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-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("lodash-es");require("jotai");require("@chaibuilder/runtime");require("./plugin-_F-KZp1i.cjs");require("@react-hookz/web");require("tree-model");require("react-quill");require("./STRINGS-Yl7cSWDc.cjs");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("react-event-hook");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("lucide-react");require("@rjsf/validator-ajv8");require("@rjsf/core");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const p=()=>{const{savePage:a,saveState:r}=s.useSavePage(),{t:i}=x.useTranslation(),o=e.jsxRuntimeExports.jsxs(u.Button,{disabled:r==="SAVING",onClick:t=>{t.preventDefault(),a()},className:c.cn("flex h-auto w-fit items-center gap-x-2 p-1 px-2","bg-gray-200 text-gray-500 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-400",{"animate-pulse bg-gray-300 text-gray-900":r==="SAVING","bg-green-500 text-white hover:bg-green-600 hover:text-white dark:bg-green-600 dark:text-white":r==="SAVED"}),size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(s.FaCheck,{className:"text-sm text-white"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:i(r==="SAVING"?"saving":r==="SAVED"?"saved":"unsaved")})]});return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:o})},m=function(){const r=s.useBuilderProp("previewComponent"),[,i]=s.usePreviewMode(),{t:o}=x.useTranslation();return r?e.jsxRuntimeExports.jsxs(u.Button,{onClick:t=>{t.preventDefault(),i(!0)},className:"flex h-auto w-fit items-center gap-x-2 p-1 px-2",size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(l.EyeOpenIcon,{className:"text-xs"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:o("preview")})]}):null},q=()=>{const a=s.useBuilderProp("topBarComponents.left",[]),r=s.useBuilderProp("topBarComponents.center",[]),i=s.useBuilderProp("topBarComponents.right",[]),o=s.useBuilderProp("editable",!0);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:n.Children.toArray(a.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(u.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:n.Children.toArray(r.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(u.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsxRuntimeExports.jsx(m,{}),e.jsxRuntimeExports.jsx(u.Separator,{orientation:"vertical"}),o?e.jsxRuntimeExports.jsx(p,{}):null,n.Children.toArray(i.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(u.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))]})]})};exports.default=q;
@@ -2,21 +2,17 @@ import { j as e } from "./jsx-runtime-Sp0orL4X.js";
2
2
  import { useState as c, useEffect as S } from "react";
3
3
  import { isEmpty as d } from "lodash-es";
4
4
  import { createApi as B } from "unsplash-js";
5
- import { B as D } from "./button-9Duvj2dH.js";
6
- import { M as E, U as L } from "./context-menu-yLeOsx9j.js";
5
+ import { N as D, V as E, B as L } from "./context-menu-9cWJcKdh.js";
7
6
  import { useTranslation as T } from "react-i18next";
8
- import { m as U } from "./iconBase-BnEC5_qG.js";
7
+ import { e as V, C as k } from "./index-esmAeUzA.js";
9
8
  import { useDebouncedState as F } from "@react-hookz/web";
10
9
  import { Loader as K } from "lucide-react";
11
- import { C as k } from "./index-GjgkZP8W.js";
12
- import "@radix-ui/react-slot";
13
- import "class-variance-authority";
14
- import "clsx";
15
- import "tailwind-merge";
16
10
  import "@radix-ui/react-switch";
17
11
  import "@radix-ui/react-accordion";
18
12
  import "@radix-ui/react-icons";
13
+ import "class-variance-authority";
19
14
  import "@radix-ui/react-alert-dialog";
15
+ import "@radix-ui/react-slot";
20
16
  import "@radix-ui/react-label";
21
17
  import "@radix-ui/react-scroll-area";
22
18
  import "@radix-ui/react-tabs";
@@ -30,9 +26,12 @@ import "@radix-ui/react-toast";
30
26
  import "cmdk";
31
27
  import "@radix-ui/react-dialog";
32
28
  import "@radix-ui/react-context-menu";
29
+ import "clsx";
30
+ import "tailwind-merge";
33
31
  import "jotai";
34
- import "./_commonjsHelpers-f3sTPFkQ.js";
32
+ import "./iconBase-HBZkvN04.js";
35
33
  import "@chaibuilder/runtime";
34
+ import "./plugin-sJ3Hzvpv.js";
36
35
  import "tree-model";
37
36
  import "react-quill";
38
37
  import "./STRINGS-TDN5UhWi.js";
@@ -45,7 +44,6 @@ import "@tailwindcss/typography";
45
44
  import "@tailwindcss/forms";
46
45
  import "@tailwindcss/aspect-ratio";
47
46
  import "tailwindcss-palette-generator";
48
- import "./plugin-VDzc8jUO.js";
49
47
  import "react-wrap-balancer";
50
48
  import "react-dom";
51
49
  import "prop-types";
@@ -64,16 +62,16 @@ const C = async (f, g) => new Promise((s, r) => {
64
62
  B({ accessKey: g }).search.getPhotos(f).then((i) => {
65
63
  s(i);
66
64
  }).catch((i) => r(i));
67
- }), Ge = ({ isModalView: f, onSelect: g }) => {
68
- const s = U("unsplashAccessKey", ""), [r, x] = c([]), [i, v] = c(0), [l, P] = c(), [n, A] = c(), [_, b] = c(0), [h, q] = F("", 1e3), [u, m] = c(!1), { t: j } = T(), I = async (o) => {
65
+ }), $e = ({ isModalView: f, onSelect: g }) => {
66
+ const s = V("unsplashAccessKey", ""), [r, x] = c([]), [i, v] = c(0), [l, P] = c(), [n, A] = c(), [_, b] = c(0), [h, q] = F("", 1e3), [u, m] = c(!1), { t: j } = T(), I = async (a) => {
69
67
  if (d(h))
70
68
  return;
71
69
  let t = i + 1;
72
- o && (o.preventDefault(), t = 1), m(!0), v(t);
70
+ a && (a.preventDefault(), t = 1), m(!0), v(t);
73
71
  const p = { query: h, page: t };
74
- l && (p.orientation = l), n && (p.color = n), C(p, s).then((a) => {
72
+ l && (p.orientation = l), n && (p.color = n), C(p, s).then((o) => {
75
73
  var y, N, w;
76
- x(t === 1 ? ((y = a == null ? void 0 : a.response) == null ? void 0 : y.results) || [] : [...r, ...((N = a == null ? void 0 : a.response) == null ? void 0 : N.results) || []]), b((w = a == null ? void 0 : a.response) == null ? void 0 : w.total_pages), m(!1);
74
+ x(t === 1 ? ((y = o == null ? void 0 : o.response) == null ? void 0 : y.results) || [] : [...r, ...((N = o == null ? void 0 : o.response) == null ? void 0 : N.results) || []]), b((w = o == null ? void 0 : o.response) == null ? void 0 : w.total_pages), m(!1);
77
75
  }).catch(() => {
78
76
  m(!1);
79
77
  });
@@ -81,10 +79,10 @@ const C = async (f, g) => new Promise((s, r) => {
81
79
  return S(() => {
82
80
  if (!d(h) && s) {
83
81
  m(!0);
84
- const o = { query: h, page: 1 };
85
- l && (o.orientation = l), n && (o.color = n), v(1), C(o, s).then((t) => {
86
- var p, a;
87
- x(((p = t == null ? void 0 : t.response) == null ? void 0 : p.results) || []), b((a = t == null ? void 0 : t.response) == null ? void 0 : a.total_pages), m(!1);
82
+ const a = { query: h, page: 1 };
83
+ l && (a.orientation = l), n && (a.color = n), v(1), C(a, s).then((t) => {
84
+ var p, o;
85
+ x(((p = t == null ? void 0 : t.response) == null ? void 0 : p.results) || []), b((o = t == null ? void 0 : t.response) == null ? void 0 : o.total_pages), m(!1);
88
86
  }).catch(() => {
89
87
  m(!1);
90
88
  });
@@ -104,13 +102,13 @@ const C = async (f, g) => new Promise((s, r) => {
104
102
  ] }) }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
105
103
  /* @__PURE__ */ e.jsxs("form", { className: "flex items-center gap-x-2 rounded-md border border-border bg-background p-px", children: [
106
104
  /* @__PURE__ */ e.jsx(
107
- E,
105
+ D,
108
106
  {
109
107
  type: "text",
110
108
  name: "query",
111
109
  className: "text-foreground",
112
110
  placeholder: 'Try "dog" or "apple"',
113
- onChange: (o) => q(o.target.value)
111
+ onChange: (a) => q(a.target.value)
114
112
  }
115
113
  ),
116
114
  /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(
@@ -137,7 +135,7 @@ const C = async (f, g) => new Promise((s, r) => {
137
135
  }
138
136
  ],
139
137
  defaultValue: l,
140
- onValueChange: (o) => P(o)
138
+ onValueChange: (a) => P(a)
141
139
  }
142
140
  ) }),
143
141
  /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(
@@ -179,12 +177,12 @@ const C = async (f, g) => new Promise((s, r) => {
179
177
  }
180
178
  ],
181
179
  defaultValue: n,
182
- onValueChange: (o) => A(o)
180
+ onValueChange: (a) => A(a)
183
181
  }
184
182
  ) })
185
183
  ] }),
186
184
  /* @__PURE__ */ e.jsxs(
187
- L,
185
+ E,
188
186
  {
189
187
  className: `h-full ${f && !d(r) ? "-mx-2 flex flex-wrap px-2" : "-mx-2 flex flex-col pb-8 pt-2"}`,
190
188
  children: [
@@ -192,40 +190,40 @@ const C = async (f, g) => new Promise((s, r) => {
192
190
  /* @__PURE__ */ e.jsx("div", { className: "font-medium", children: "No Data" }),
193
191
  /* @__PURE__ */ e.jsx("div", { className: "text-sm text-gray-500", children: "Enter query and press enter" })
194
192
  ] }),
195
- f ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: r.map((o) => /* @__PURE__ */ e.jsx(
193
+ f ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: r.map((a) => /* @__PURE__ */ e.jsx(
196
194
  "div",
197
195
  {
198
196
  role: "button",
199
197
  tabIndex: 0,
200
198
  className: "my-1 flex",
201
- onClick: () => g(o.urls.regular),
199
+ onClick: () => g(a.urls.regular),
202
200
  children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
203
201
  "img",
204
202
  {
205
203
  className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
206
- alt: o.alt_description,
207
- src: o.urls.small
204
+ alt: a.alt_description,
205
+ src: a.urls.small
208
206
  }
209
207
  ) })
210
208
  },
211
- o.id
212
- )) }) : r.map((o) => (
209
+ a.id
210
+ )) }) : r.map((a) => (
213
211
  // TODO: Drag and Drop Image to Canvas from Here use `pic.urls.[small, regular, full]` for image quality
214
212
  /* @__PURE__ */ e.jsx("div", { className: "w-full px-2 py-1", children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
215
213
  "img",
216
214
  {
217
215
  className: "h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",
218
- alt: o.alt_description,
219
- src: o.urls.small
216
+ alt: a.alt_description,
217
+ src: a.urls.small
220
218
  }
221
- ) }) }, o.id)
219
+ ) }) }, a.id)
222
220
  )),
223
221
  u && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center py-8", children: [
224
222
  /* @__PURE__ */ e.jsx(K, { className: "h-6 w-6 animate-spin" }),
225
223
  "  Loading..."
226
224
  ] }),
227
225
  !d(r) && i < _ && !u && /* @__PURE__ */ e.jsx(
228
- D,
226
+ L,
229
227
  {
230
228
  size: "sm",
231
229
  variant: "link",
@@ -241,6 +239,6 @@ const C = async (f, g) => new Promise((s, r) => {
241
239
  ] });
242
240
  };
243
241
  export {
244
- Ge as default,
242
+ $e as default,
245
243
  C as fetchImage
246
244
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),n=require("react"),p=require("lodash-es"),A=require("unsplash-js"),f=require("./context-menu-sQn7ryJ6.cjs"),_=require("react-i18next"),g=require("./index-cUydM1n4.cjs"),T=require("@react-hookz/web"),B=require("lucide-react");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");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-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-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("jotai");require("./iconBase-kuD_VwQx.cjs");require("@chaibuilder/runtime");require("./plugin-_F-KZp1i.cjs");require("tree-model");require("react-quill");require("./STRINGS-Yl7cSWDc.cjs");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("react-event-hook");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("@rjsf/validator-ajv8");require("@rjsf/core");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const v=async(h,j)=>new Promise((i,a)=>{A.createApi({accessKey:j}).search.getPhotos(h).then(l=>{i(l)}).catch(l=>a(l))}),D=({isModalView:h,onSelect:j})=>{const i=g.useBuilderProp("unsplashAccessKey",""),[a,q]=n.useState([]),[l,b]=n.useState(0),[o,w]=n.useState(),[u,k]=n.useState(),[C,y]=n.useState(0),[d,P]=T.useDebouncedState("",1e3),[m,c]=n.useState(!1),{t:E}=_.useTranslation(),I=async r=>{if(p.isEmpty(d))return;let t=l+1;r&&(r.preventDefault(),t=1),c(!0),b(t);const x={query:d,page:t};o&&(x.orientation=o),u&&(x.color=u),v(x,i).then(s=>{var R,N,S;q(t===1?((R=s==null?void 0:s.response)==null?void 0:R.results)||[]:[...a,...((N=s==null?void 0:s.response)==null?void 0:N.results)||[]]),y((S=s==null?void 0:s.response)==null?void 0:S.total_pages),c(!1)}).catch(()=>{c(!1)})};return n.useEffect(()=>{if(!p.isEmpty(d)&&i){c(!0);const r={query:d,page:1};o&&(r.orientation=o),u&&(r.color=u),b(1),v(r,i).then(t=>{var x,s;q(((x=t==null?void 0:t.response)==null?void 0:x.results)||[]),y((s=t==null?void 0:t.response)==null?void 0:s.total_pages),c(!1)}).catch(()=>{c(!1)})}},[o,u,d,i]),p.isEmpty(i)?e.jsxRuntimeExports.jsx("div",{className:"flex h-full flex-col items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"max-w-3xl text-center text-gray-500",children:["To enable Unsplash, kindly provide your",e.jsxRuntimeExports.jsx("a",{href:"https://unsplash.com/documentation#public-authentication",className:"px-1 underline hover:text-blue-400",target:"_blank",rel:"noopener noreferrer",children:"Unsplash Access Key"})]})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("form",{className:"flex items-center gap-x-2 rounded-md border border-border bg-background p-px",children:[e.jsxRuntimeExports.jsx(f.Input,{type:"text",name:"query",className:"text-foreground",placeholder:'Try "dog" or "apple"',onChange:r=>P(r.target.value)}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(g.ChaiSelect,{className:"w-40",placeholder:E("Orientation"),options:[{value:"",label:"All"},{value:"landscape",label:"Landscape"},{value:"portrait",label:"Portrait"},{value:"squarish",label:"Square"}],defaultValue:o,onValueChange:r=>w(r)})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(g.ChaiSelect,{placeholder:E("Color"),options:[{value:"",label:"All"},{value:"black_and_white",label:"Black and White"},{value:"black",label:"Black"},{value:"white",label:"White"},{value:"night",label:"Night"},{value:"warm",label:"Warm"},{value:"cool",label:"Cool"},{value:"sepia",label:"Sepia"}],defaultValue:u,onValueChange:r=>k(r)})})]}),e.jsxRuntimeExports.jsxs(f.ScrollArea,{className:`h-full ${h&&!p.isEmpty(a)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[p.isEmpty(a)&&!m&&e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center py-6",children:[e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Data"}),e.jsxRuntimeExports.jsx("div",{className:"text-sm text-gray-500",children:"Enter query and press enter"})]}),h?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:a.map(r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>j(r.urls.regular),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:r.alt_description,src:r.urls.small})})},r.id))}):a.map(r=>e.jsxRuntimeExports.jsx("div",{className:"w-full px-2 py-1",children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:r.alt_description,src:r.urls.small})})},r.id)),m&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsxRuntimeExports.jsx(B.Loader,{className:"h-6 w-6 animate-spin"}),"  Loading..."]}),!p.isEmpty(a)&&l<C&&!m&&e.jsxRuntimeExports.jsx(f.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>I(void 0),disabled:m,children:m?"":"Load More"})]})]})};exports.default=D;exports.fetchImage=v;
@@ -1,20 +1,17 @@
1
1
  import { j as e } from "./jsx-runtime-Sp0orL4X.js";
2
- import { useState as i, useEffect as k } from "react";
2
+ import { useState as l, useEffect as k } from "react";
3
3
  import { isEmpty as j, map as b } from "lodash-es";
4
- import { atom as U, useAtom as F } from "jotai";
5
- import { U as C } from "./context-menu-yLeOsx9j.js";
4
+ import { atom as F, useAtom as U } from "jotai";
5
+ import { V as C } from "./context-menu-9cWJcKdh.js";
6
6
  import { useTranslation as E } from "react-i18next";
7
- import { m as N } from "./iconBase-BnEC5_qG.js";
7
+ import { e as N } from "./index-esmAeUzA.js";
8
8
  import { Upload as G, Loader as P } from "lucide-react";
9
9
  import "@radix-ui/react-switch";
10
- import "./button-9Duvj2dH.js";
11
- import "@radix-ui/react-slot";
12
- import "class-variance-authority";
13
- import "clsx";
14
- import "tailwind-merge";
15
10
  import "@radix-ui/react-accordion";
16
11
  import "@radix-ui/react-icons";
12
+ import "class-variance-authority";
17
13
  import "@radix-ui/react-alert-dialog";
14
+ import "@radix-ui/react-slot";
18
15
  import "@radix-ui/react-label";
19
16
  import "@radix-ui/react-scroll-area";
20
17
  import "@radix-ui/react-tabs";
@@ -28,43 +25,71 @@ import "@radix-ui/react-toast";
28
25
  import "cmdk";
29
26
  import "@radix-ui/react-dialog";
30
27
  import "@radix-ui/react-context-menu";
31
- import "./_commonjsHelpers-f3sTPFkQ.js";
32
- import "@react-hookz/web";
28
+ import "clsx";
29
+ import "tailwind-merge";
30
+ import "./iconBase-HBZkvN04.js";
33
31
  import "@chaibuilder/runtime";
32
+ import "./plugin-sJ3Hzvpv.js";
33
+ import "@react-hookz/web";
34
34
  import "tree-model";
35
- const S = U([]), ue = ({ isModalView: r, onSelect: m }) => {
36
- const { t: s } = E(), p = N("uploadMediaCallback"), n = N("fetchMediaCallback"), [l, d] = F(S), [y, u] = i(!1), [x, f] = i(!1), [, v] = i(), [h, c] = i("");
35
+ import "react-quill";
36
+ import "./STRINGS-TDN5UhWi.js";
37
+ import "flagged";
38
+ import "react-hotkeys-hook";
39
+ import "@floating-ui/dom";
40
+ import "@floating-ui/react-dom";
41
+ import "react-event-hook";
42
+ import "@tailwindcss/typography";
43
+ import "@tailwindcss/forms";
44
+ import "@tailwindcss/aspect-ratio";
45
+ import "tailwindcss-palette-generator";
46
+ import "react-wrap-balancer";
47
+ import "react-dom";
48
+ import "prop-types";
49
+ import "react-error-boundary";
50
+ import "re-resizable";
51
+ import "@rjsf/validator-ajv8";
52
+ import "@rjsf/core";
53
+ import "react-arborist";
54
+ import "himalaya";
55
+ import "react-icons-picker";
56
+ import "react-autosuggest";
57
+ import "fuse.js";
58
+ import "i18next";
59
+ import "framer-motion";
60
+ const S = F([]), Re = ({ isModalView: s, onSelect: m }) => {
61
+ const { t: r } = E(), c = N("uploadMediaCallback"), n = N("fetchMediaCallback"), [i, p] = U(S), [y, u] = l(!1), [x, f] = l(!1), [, v] = l(), [h, d] = l("");
37
62
  k(() => {
38
63
  (async () => {
39
64
  if (!n)
40
65
  return;
41
66
  f(!0);
42
67
  const t = await n();
43
- d(t || []), f(!1);
68
+ p(t || []), f(!1);
44
69
  })();
45
70
  }, []);
46
71
  const w = (t) => {
47
- var a, o;
48
- if (c(""), t && ((o = (a = t == null ? void 0 : t.target) == null ? void 0 : a.files) == null ? void 0 : o.length) > 0) {
72
+ var o, a;
73
+ if (d(""), t && ((a = (o = t == null ? void 0 : t.target) == null ? void 0 : o.files) == null ? void 0 : a.length) > 0) {
49
74
  const g = t.target.files[0];
50
- g.type.startsWith("image") ? I(g) : c(s("Please select an image"));
75
+ g.type.startsWith("image") ? I(g) : d(r("Please select an image"));
51
76
  }
52
77
  }, I = async (t) => {
53
- if (p) {
78
+ if (c) {
54
79
  u(!0);
55
80
  try {
56
- const { url: a } = await p(t);
57
- m(a), v(void 0);
58
- const o = await n();
59
- d(o);
60
- } catch (a) {
61
- d([]), c((a == null ? void 0 : a.message) || "Something went wrong.");
81
+ const { url: o } = await c(t);
82
+ m(o), v(void 0);
83
+ const a = await n();
84
+ p(a);
85
+ } catch (o) {
86
+ p([]), d((o == null ? void 0 : o.message) || "Something went wrong.");
62
87
  }
63
88
  u(!1);
64
89
  }
65
90
  };
66
91
  return /* @__PURE__ */ e.jsxs("div", { children: [
67
- /* @__PURE__ */ e.jsxs("label", { htmlFor: r ? "upload-in-modal" : "upload-in-panel", children: [
92
+ /* @__PURE__ */ e.jsxs("label", { htmlFor: s ? "upload-in-modal" : "upload-in-panel", children: [
68
93
  /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center rounded-lg", children: /* @__PURE__ */ e.jsxs(
69
94
  "label",
70
95
  {
@@ -73,14 +98,14 @@ const S = U([]), ue = ({ isModalView: r, onSelect: m }) => {
73
98
  children: [
74
99
  /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center pb-6 pt-5", children: [
75
100
  /* @__PURE__ */ e.jsx(G, { className: "mb-3 h-10 w-10 text-gray-400" }),
76
- /* @__PURE__ */ e.jsx("p", { className: "mb-2 text-sm text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ e.jsx("span", { className: "font-semibold", children: s("Click to upload") }) }),
77
- /* @__PURE__ */ e.jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: s("SVG, PNG, JPG or GIF (Max. 2mb)") })
101
+ /* @__PURE__ */ e.jsx("p", { className: "mb-2 text-sm text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ e.jsx("span", { className: "font-semibold", children: r("Click to upload") }) }),
102
+ /* @__PURE__ */ e.jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: r("SVG, PNG, JPG or GIF (Max. 2mb)") })
78
103
  ] }),
79
104
  y ? /* @__PURE__ */ e.jsxs("div", { className: "flex h-full w-full items-center justify-center", children: [
80
105
  /* @__PURE__ */ e.jsx(P, { className: "h-6 w-6 animate-spin" }),
81
- /* @__PURE__ */ e.jsx("span", { className: "ml-2 text-sm text-gray-500", children: s("Uploading...") })
106
+ /* @__PURE__ */ e.jsx("span", { className: "ml-2 text-sm text-gray-500", children: r("Uploading...") })
82
107
  ] }) : null,
83
- h && /* @__PURE__ */ e.jsx("p", { className: "pb-2 text-xs text-red-500", children: h || s("Something went wrong") })
108
+ h && /* @__PURE__ */ e.jsx("p", { className: "pb-2 text-xs text-red-500", children: h || r("Something went wrong") })
84
109
  ]
85
110
  }
86
111
  ) }),
@@ -95,21 +120,21 @@ const S = U([]), ue = ({ isModalView: r, onSelect: m }) => {
95
120
  }
96
121
  )
97
122
  ] }),
98
- /* @__PURE__ */ e.jsxs(C, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${r ? "px-2" : ""} pt-2`, children: [
99
- j(l) && x && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center py-6", children: /* @__PURE__ */ e.jsx("div", { className: "animate-pulse font-medium", children: s("Fetching...") }) }),
100
- j(l) && !x && /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col items-center justify-center text-center", children: [
123
+ /* @__PURE__ */ e.jsxs(C, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${s ? "px-2" : ""} pt-2`, children: [
124
+ j(i) && x && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center py-6", children: /* @__PURE__ */ e.jsx("div", { className: "animate-pulse font-medium", children: r("Fetching...") }) }),
125
+ j(i) && !x && /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col items-center justify-center text-center", children: [
101
126
  /* @__PURE__ */ e.jsx("div", { className: "mb-4 h-12 rounded-full p-6" }),
102
- /* @__PURE__ */ e.jsx("h3", { className: "mb-2 text-sm font-semibold", children: s("No images found") }),
103
- /* @__PURE__ */ e.jsx("p", { className: "mb-4 max-w-sm text-muted-foreground", children: s("It looks like you haven't uploaded any images yet. Start by clicking the upload button above.") })
127
+ /* @__PURE__ */ e.jsx("h3", { className: "mb-2 text-sm font-semibold", children: r("No images found") }),
128
+ /* @__PURE__ */ e.jsx("p", { className: "mb-4 max-w-sm text-muted-foreground", children: r("It looks like you haven't uploaded any images yet. Start by clicking the upload button above.") })
104
129
  ] }),
105
- r ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: b(l, (t) => /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "my-1 flex", onClick: () => m(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
130
+ s ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: b(i, (t) => /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "my-1 flex", onClick: () => m(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
106
131
  "img",
107
132
  {
108
133
  className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
109
134
  alt: t.name,
110
135
  src: t.thumbUrl
111
136
  }
112
- ) }) }, t.id)) }) : b(l, (t) => (
137
+ ) }) }, t.id)) }) : b(i, (t) => (
113
138
  // TODO: Drag and Drop Image to Canvas from Here use `pic.url` for image quality
114
139
  /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "px-2 py-1", onClick: () => m(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
115
140
  "img",
@@ -124,5 +149,5 @@ const S = U([]), ue = ({ isModalView: r, onSelect: m }) => {
124
149
  ] });
125
150
  };
126
151
  export {
127
- ue as default
152
+ Re as default
128
153
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),i=require("react"),n=require("lodash-es"),E=require("jotai"),I=require("./context-menu-sQn7ryJ6.cjs"),w=require("react-i18next"),g=require("./index-cUydM1n4.cjs"),b=require("lucide-react");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");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-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-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("./iconBase-kuD_VwQx.cjs");require("@chaibuilder/runtime");require("./plugin-_F-KZp1i.cjs");require("@react-hookz/web");require("tree-model");require("react-quill");require("./STRINGS-Yl7cSWDc.cjs");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("react-event-hook");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("@rjsf/validator-ajv8");require("@rjsf/core");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const k=E.atom([]),S=({isModalView:a,onSelect:o})=>{const{t:s}=w.useTranslation(),d=g.useBuilderProp("uploadMediaCallback"),x=g.useBuilderProp("fetchMediaCallback"),[u,c]=E.useAtom(k),[R,p]=i.useState(!1),[j,q]=i.useState(!1),[,y]=i.useState(),[h,m]=i.useState("");i.useEffect(()=>{(async()=>{if(!x)return;q(!0);const r=await x();c(r||[]),q(!1)})()},[]);const N=r=>{var t,l;if(m(""),r&&((l=(t=r==null?void 0:r.target)==null?void 0:t.files)==null?void 0:l.length)>0){const f=r.target.files[0];f.type.startsWith("image")?v(f):m(s("Please select an image"))}},v=async r=>{if(d){p(!0);try{const{url:t}=await d(r);o(t),y(void 0);const l=await x();c(l)}catch(t){c([]),m((t==null?void 0:t.message)||"Something went wrong.")}p(!1)}};return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("label",{htmlFor:a?"upload-in-modal":"upload-in-panel",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center rounded-lg",children:e.jsxRuntimeExports.jsxs("label",{htmlFor:"image-upload",className:"flex w-full cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed border-border",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center pb-6 pt-5",children:[e.jsxRuntimeExports.jsx(b.Upload,{className:"mb-3 h-10 w-10 text-gray-400"}),e.jsxRuntimeExports.jsx("p",{className:"mb-2 text-sm text-gray-500 dark:text-gray-400",children:e.jsxRuntimeExports.jsx("span",{className:"font-semibold",children:s("Click to upload")})}),e.jsxRuntimeExports.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s("SVG, PNG, JPG or GIF (Max. 2mb)")})]}),R?e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full items-center justify-center",children:[e.jsxRuntimeExports.jsx(b.Loader,{className:"h-6 w-6 animate-spin"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2 text-sm text-gray-500",children:s("Uploading...")})]}):null,h&&e.jsxRuntimeExports.jsx("p",{className:"pb-2 text-xs text-red-500",children:h||s("Something went wrong")})]})}),e.jsxRuntimeExports.jsx("input",{type:"file",id:"image-upload",accept:"image/*",hidden:!0,onChange:N})]}),e.jsxRuntimeExports.jsxs(I.ScrollArea,{className:`-mx-2 flex h-full flex-col pb-8 pt-2 ${a?"px-2":""} pt-2`,children:[n.isEmpty(u)&&j&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"animate-pulse font-medium",children:s("Fetching...")})}),n.isEmpty(u)&&!j&&e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[e.jsxRuntimeExports.jsx("div",{className:"mb-4 h-12 rounded-full p-6"}),e.jsxRuntimeExports.jsx("h3",{className:"mb-2 text-sm font-semibold",children:s("No images found")}),e.jsxRuntimeExports.jsx("p",{className:"mb-4 max-w-sm text-muted-foreground",children:s("It looks like you haven't uploaded any images yet. Start by clicking the upload button above.")})]}),a?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:n.map(u,r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>o(r.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:r.name,src:r.thumbUrl})})},r.id))}):n.map(u,r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>o(r.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:r.name,src:r.url})})},r.id))]})]})};exports.default=S;