@chaibuilder/sdk 1.1.18 → 1.2.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 (122) hide show
  1. package/dist/AddBlocks-57-vroWk.cjs +1 -0
  2. package/dist/AddBlocks-QvCc-oag.js +225 -0
  3. package/dist/BrandingOptions-arKT1zCy.cjs +1 -0
  4. package/dist/{BrandingOptions-zFJ28xmJ.js → BrandingOptions-mZXO7thQ.js} +27 -25
  5. package/dist/{CanvasArea-vTV3O27-.js → CanvasArea-59Gm0EZx.js} +581 -598
  6. package/dist/CanvasArea-jRg53jrS.cjs +59 -0
  7. package/dist/CurrentPage-MLObvs0K.cjs +1 -0
  8. package/dist/{CurrentPage-Ay7X9h9y.js → CurrentPage-YPI5QTjk.js} +17 -14
  9. package/dist/Functions-7jnEwJyw.js +15 -0
  10. package/dist/Functions-N3yhPYKY.cjs +1 -0
  11. package/dist/{Layers-CWnzKXMo.js → Layers-no2keK4N.js} +149 -146
  12. package/dist/Layers-x_mWeT_q.cjs +1 -0
  13. package/dist/MODIFIERS-2FeVfZQ9.cjs +1 -0
  14. package/dist/{MODIFIERS-MLfpKQY1.js → MODIFIERS-RiXS5Mn1.js} +7 -13
  15. package/dist/MarkAsGlobalBlock-S2BhHTsK.cjs +1 -0
  16. package/dist/{MarkAsGlobalBlock-uhj0kGZo.js → MarkAsGlobalBlock-SPWd6Flk.js} +9 -7
  17. package/dist/{PagesPanel-ALbBHaO3.js → PagesPanel-Q08uN4X3.js} +12 -9
  18. package/dist/PagesPanel-pOIuFPOA.cjs +1 -0
  19. package/dist/ProjectPanel-4bN_GyNm.cjs +1 -0
  20. package/dist/{ProjectPanel-tIDarI9R.js → ProjectPanel-zzYV9yrV.js} +25 -22
  21. package/dist/{Settings-5uDMY9SU.js → Settings-28A7R61i.js} +334 -331
  22. package/dist/Settings-KlTtgu3w.cjs +1 -0
  23. package/dist/{SidePanels-D6U95ur1.js → SidePanels--ZK6Iqou.js} +80 -77
  24. package/dist/SidePanels-eJBA_cUu.cjs +1 -0
  25. package/dist/{Topbar-_-1HX-EE.js → Topbar-ks1ckGLz.js} +15 -13
  26. package/dist/Topbar-u5XKdWgQ.cjs +1 -0
  27. package/dist/{UnsplashImages-mqK09h8E.js → UnsplashImages-8vJPuqrF.js} +25 -23
  28. package/dist/UnsplashImages-V8oKEHfi.cjs +1 -0
  29. package/dist/{UploadImages-IDkkRuhx.js → UploadImages-6N6UrjLo.js} +26 -24
  30. package/dist/UploadImages-eHYxwWAp.cjs +1 -0
  31. package/dist/_commonjsHelpers-UyOWmZb0.js +8 -0
  32. package/dist/_commonjsHelpers-wDK0ZLPo.cjs +1 -0
  33. package/dist/{add-page-modal-C1UGoRkw.js → add-page-modal-EHIYTW4T.js} +27 -24
  34. package/dist/add-page-modal-OvNXLGf0.cjs +1 -0
  35. package/dist/{confirm-alert-ea5xpncD.js → confirm-alert-biqvaLT-.js} +9 -7
  36. package/dist/confirm-alert-f3DYO5Hj.cjs +1 -0
  37. package/dist/controls-Dy1qa8Dc.cjs +1 -0
  38. package/dist/controls-XPXGHKht.js +182 -0
  39. package/dist/core.cjs +1 -1
  40. package/dist/core.d.ts +10 -1
  41. package/dist/core.js +60 -57
  42. package/dist/delete-page-modal-U4yiuhx0.cjs +1 -0
  43. package/dist/{delete-page-modal-0GxR128b.js → delete-page-modal-qZJCk_JH.js} +15 -12
  44. package/dist/email-blocks.cjs +1 -0
  45. package/dist/email-blocks.d.ts +3 -0
  46. package/dist/email-blocks.js +35 -0
  47. package/dist/{form-irY39wvJ.js → form-Moz_psOw.js} +16 -16
  48. package/dist/form-lJhy9DEC.cjs +1 -0
  49. package/dist/functions-Ox_svtKm.cjs +1 -0
  50. package/dist/functions-xIebp8Aw.js +23 -0
  51. package/dist/html-to-json-dfALTAdG.cjs +1 -0
  52. package/dist/{html-to-json-wmbV9eZP.js → html-to-json-xKBERAI1.js} +47 -46
  53. package/dist/index-IIJ_o44s.cjs +1 -0
  54. package/dist/{index-qEix1meh.js → index-QEchoZ98.js} +8 -8
  55. package/dist/{index-0OqmBgqo.js → index-_OgCuSUz.js} +528 -533
  56. package/dist/{index-npVo1wi3.cjs → index-hMoPNZVn.cjs} +2 -2
  57. package/dist/{jsx-runtime-NV737rRe.js → jsx-runtime-WbnYoNE9.js} +1 -1
  58. package/dist/{jsx-runtime-WUGKV8jN.cjs → jsx-runtime-Z_BpKhVy.cjs} +7 -7
  59. package/dist/lib.cjs +2 -2
  60. package/dist/lib.d.ts +1 -1
  61. package/dist/lib.js +47 -44
  62. package/dist/page-viewer-WhM1FSU0.cjs +1 -0
  63. package/dist/{page-viewer-mgnZt6nO.js → page-viewer-zFLkUu2I.js} +17 -14
  64. package/dist/{project-general-setting-M52W-vUp.js → project-general-setting-MWGOOurD.js} +16 -13
  65. package/dist/project-general-setting-y8daY7V9.cjs +1 -0
  66. package/dist/project-seo-setting-9JGBPzcA.cjs +1 -0
  67. package/dist/{project-seo-setting-EhqUcTKy.js → project-seo-setting-dXclexQW.js} +15 -13
  68. package/dist/render.cjs +1 -1
  69. package/dist/render.d.ts +1 -1
  70. package/dist/render.js +50 -49
  71. package/dist/server.cjs +1 -1
  72. package/dist/server.d.ts +1 -1
  73. package/dist/server.js +11 -11
  74. package/dist/single-page-detail--xPv74bX.cjs +1 -0
  75. package/dist/{single-page-detail-61UDUgWG.js → single-page-detail-C48IPzbd.js} +77 -74
  76. package/dist/studio.cjs +1 -1
  77. package/dist/studio.js +11 -8
  78. package/dist/ui.cjs +1 -1
  79. package/dist/ui.d.ts +3 -3
  80. package/dist/ui.js +144 -142
  81. package/dist/useAddBlockByDrop-_nd8yZBa.cjs +1 -0
  82. package/dist/useAddBlockByDrop-uPXvrg4G.js +20 -0
  83. package/dist/{utils-XsPKXMVo.js → utils-AvyFzbPC.js} +26 -35
  84. package/dist/utils-PTxFk6qT.cjs +1 -0
  85. package/dist/web-blocks.cjs +9 -0
  86. package/dist/web-blocks.d.ts +3 -0
  87. package/dist/web-blocks.js +1033 -0
  88. package/package.json +5 -2
  89. package/dist/AddBlocks-sKF4ti68.js +0 -222
  90. package/dist/AddBlocks-yPovJXtD.cjs +0 -1
  91. package/dist/BrandingOptions-TRVyCvVq.cjs +0 -1
  92. package/dist/CanvasArea-xxqOiENt.cjs +0 -59
  93. package/dist/CurrentPage-ju6otPNk.cjs +0 -1
  94. package/dist/Layers-d9OU0HRE.cjs +0 -1
  95. package/dist/MODIFIERS-WFzDQfiT.cjs +0 -1
  96. package/dist/MarkAsGlobalBlock-CDmEHNx7.cjs +0 -1
  97. package/dist/PagesPanel-F9Cdi4Pf.cjs +0 -1
  98. package/dist/ProjectPanel-T49RUDyt.cjs +0 -1
  99. package/dist/Settings-eZnusNbR.cjs +0 -1
  100. package/dist/SidePanels-BVM5JwGC.cjs +0 -1
  101. package/dist/Topbar-gQxbcPtG.cjs +0 -1
  102. package/dist/UnsplashImages-PNp5fYCc.cjs +0 -1
  103. package/dist/UploadImages-BoSSsLtD.cjs +0 -1
  104. package/dist/add-page-modal-HP1yv9yJ.cjs +0 -1
  105. package/dist/confirm-alert-dHRDZrA1.cjs +0 -1
  106. package/dist/controls-QnyBNkXG.cjs +0 -36
  107. package/dist/controls-kEuiMMDf.js +0 -4600
  108. package/dist/delete-page-modal-yOgfPcHr.cjs +0 -1
  109. package/dist/form-6qGAOYI3.cjs +0 -1
  110. package/dist/functions-86L6n983.js +0 -23
  111. package/dist/functions-Jr7gX_RX.cjs +0 -1
  112. package/dist/html-to-json-AqLy6ye-.cjs +0 -1
  113. package/dist/index-d55M5MRz.cjs +0 -1
  114. package/dist/lodash-2us0VT8I.cjs +0 -36
  115. package/dist/lodash-3gkdNK5u.js +0 -4538
  116. package/dist/page-viewer-G2YIKVSt.cjs +0 -1
  117. package/dist/project-general-setting-sinIiBKe.cjs +0 -1
  118. package/dist/project-seo-setting-N0OnBCvh.cjs +0 -1
  119. package/dist/single-page-detail-oa-yTXhQ.cjs +0 -1
  120. package/dist/useAddBlockByDrop-5QW86HjG.js +0 -20
  121. package/dist/useAddBlockByDrop-Ckzuvu-s.cjs +0 -1
  122. package/dist/utils-37UXq2O5.cjs +0 -1
@@ -1,13 +1,14 @@
1
- import { j as e } from "./jsx-runtime-NV737rRe.js";
1
+ import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import o, { useMemo as m, Suspense as c } from "react";
3
3
  import { FontFamilyIcon as x } from "@radix-ui/react-icons";
4
- import { i as a, aq as d, ar as h, as as u, at as g, aB as j, aC as v, au as r, ag as f, aD as S, aE as b, aF as N, aG as C, S as p, aH as w } from "./index-0OqmBgqo.js";
4
+ import { i as a, aq as d, ar as h, as as u, at as g, aA as j, aB as v, au as r, ag as f, aC as S, aD as b, aE as N, aF as C, S as p, aG as w } from "./index-_OgCuSUz.js";
5
5
  import { useTranslation as y } from "react-i18next";
6
- import "./MODIFIERS-MLfpKQY1.js";
6
+ import "./_commonjsHelpers-UyOWmZb0.js";
7
7
  import "@radix-ui/react-toggle";
8
8
  import "class-variance-authority";
9
- import "./utils-XsPKXMVo.js";
10
- import "./lodash-3gkdNK5u.js";
9
+ import "./utils-AvyFzbPC.js";
10
+ import "lodash-es";
11
+ import "./MODIFIERS-RiXS5Mn1.js";
11
12
  import "clsx";
12
13
  import "tailwind-merge";
13
14
  import "@radix-ui/react-switch";
@@ -33,6 +34,7 @@ import "react-dom";
33
34
  import "react-quill";
34
35
  import "jotai";
35
36
  import "flat-to-nested";
37
+ import "./Functions-7jnEwJyw.js";
36
38
  import "redux-undo";
37
39
  import "@chaibuilder/runtime";
38
40
  import "@react-hookz/web";
@@ -55,7 +57,7 @@ const A = () => a("languages", ["en"]), B = () => A().length === 1 ? null : /* @
55
57
  /* @__PURE__ */ e.jsx(r, { value: "pineapple", children: "Pineapple" })
56
58
  ] }) })
57
59
  ] }) }), T = () => {
58
- const { savePage: l, syncState: t } = f(), { t: i } = y(), n = m(() => {
60
+ const { savePage: i, syncState: t } = f(), { t: l } = y(), n = m(() => {
59
61
  switch (t) {
60
62
  case "SAVING":
61
63
  return "animate-pulse bg-gray-500 text-gray-900";
@@ -70,7 +72,7 @@ const A = () => a("languages", ["en"]), B = () => A().length === 1 ? null : /* @
70
72
  N,
71
73
  {
72
74
  onClick: (s) => {
73
- s.preventDefault(), l();
75
+ s.preventDefault(), i();
74
76
  },
75
77
  className: `flex h-auto w-20 items-center gap-x-1 rounded-full p-1 px-2 ${n}`,
76
78
  size: "sm",
@@ -83,17 +85,17 @@ const A = () => a("languages", ["en"]), B = () => A().length === 1 ? null : /* @
83
85
  d: "M.274.086a.02.02 0 0 1 0 .028l-.12.12a.02.02 0 0 1-.028 0l-.06-.06A.02.02 0 0 1 .094.146L.14.192.246.086a.02.02 0 0 1 .028 0Z"
84
86
  }
85
87
  ) }),
86
- t === "SAVING" ? "Saving..." : t === "SAVED" ? i("Saved") : "Save"
88
+ t === "SAVING" ? "Saving..." : t === "SAVED" ? l("Saved") : "Save"
87
89
  ]
88
90
  }
89
91
  ) }),
90
92
  /* @__PURE__ */ e.jsx(C, { children: /* @__PURE__ */ e.jsx("p", { children: t === "SAVING" ? "Saving..." : t === "SAVED" ? "Saved" : "Save changes" }) })
91
93
  ] }) });
92
- }, de = () => {
93
- const l = a("topBarComponents.left", []), t = a("topBarComponents.center", []), i = a("topBarComponents.right", []), n = a("editable", !0);
94
+ }, ue = () => {
95
+ const i = a("topBarComponents.left", []), t = a("topBarComponents.center", []), l = a("topBarComponents.right", []), n = a("editable", !0);
94
96
  return /* @__PURE__ */ e.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
95
97
  /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2 font-bold", children: o.Children.toArray(
96
- l.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
98
+ i.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
97
99
  ) }) }),
98
100
  /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: o.Children.toArray(
99
101
  t.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
@@ -103,11 +105,11 @@ const A = () => a("languages", ["en"]), B = () => A().length === 1 ? null : /* @
103
105
  /* @__PURE__ */ e.jsx(w, { orientation: "vertical" }),
104
106
  n ? /* @__PURE__ */ e.jsx(T, {}) : null,
105
107
  o.Children.toArray(
106
- i.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
108
+ l.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
107
109
  )
108
110
  ] })
109
111
  ] });
110
112
  };
111
113
  export {
112
- de as default
114
+ ue as default
113
115
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),n=require("react"),l=require("@radix-ui/react-icons"),r=require("./index-IIJ_o44s.cjs"),a=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("lodash-es");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("jotai");require("flat-to-nested");require("./Functions-N3yhPYKY.cjs");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");const o=()=>r.useBuilderProp("languages",["en"]),c=()=>o().length===1?null:e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(r.Select,{children:[e.jsxRuntimeExports.jsx(r.SelectTrigger,{className:"w-[150px] border-0",children:e.jsxRuntimeExports.jsx(r.SelectValue,{placeholder:e.jsxRuntimeExports.jsxs("span",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(l.FontFamilyIcon,{className:"h-4 w-4"})," English(US)"]})})}),e.jsxRuntimeExports.jsx(r.SelectContent,{children:e.jsxRuntimeExports.jsxs(r.SelectGroup,{children:[e.jsxRuntimeExports.jsx(r.SelectLabel,{children:"Fruits"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"apple",children:"Apple"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"banana",children:"Banana"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"blueberry",children:"Blueberry"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"grapes",children:"Grapes"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"pineapple",children:"Pineapple"})]})})]})}),p=()=>{const{savePage:i,syncState:s}=r.useSavePage(),{t:x}=a.useTranslation(),u=n.useMemo(()=>{switch(s){case"SAVING":return"animate-pulse bg-gray-500 text-gray-900";case"SAVED":return"bg-green-500 text-white hover:bg-green-600 hover:text-white";default:return"bg-gray-200 text-gray-500 hover:bg-gray-100"}},[s]);return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(r.Tooltip,{children:[e.jsxRuntimeExports.jsx(r.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(r.Toggle,{onClick:t=>{t.preventDefault(),i()},className:`flex h-auto w-20 items-center gap-x-1 rounded-full p-1 px-2 ${u}`,size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx("svg",{fill:"currentColor",width:"16",height:"16",viewBox:"0 0 0.32 0.32",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",d:"M.274.086a.02.02 0 0 1 0 .028l-.12.12a.02.02 0 0 1-.028 0l-.06-.06A.02.02 0 0 1 .094.146L.14.192.246.086a.02.02 0 0 1 .028 0Z"})}),s==="SAVING"?"Saving...":s==="SAVED"?x("Saved"):"Save"]})}),e.jsxRuntimeExports.jsx(r.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:s==="SAVING"?"Saving...":s==="SAVED"?"Saved":"Save changes"})})]})})},m=()=>{const i=r.useBuilderProp("topBarComponents.left",[]),s=r.useBuilderProp("topBarComponents.center",[]),x=r.useBuilderProp("topBarComponents.right",[]),u=r.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(i.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:n.Children.toArray(s.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(c,{}),e.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),u?e.jsxRuntimeExports.jsx(p,{}):null,n.Children.toArray(x.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))]})]})};exports.default=m;
@@ -1,15 +1,16 @@
1
- import { j as e } from "./jsx-runtime-NV737rRe.js";
1
+ import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import { useState as p, useEffect as D } from "react";
3
- import { a as d, O as E } from "./lodash-3gkdNK5u.js";
3
+ import { isEmpty as d, startCase as E } from "lodash-es";
4
4
  import { MixerHorizontalIcon as L } from "@radix-ui/react-icons";
5
5
  import { createApi as B } from "unsplash-js";
6
- import { i as F, bl as K, b0 as O, b1 as U, b2 as V, aq as P, ar as C, as as S, at as I, au as h, bo as Q, B as H } from "./index-0OqmBgqo.js";
7
- import { useDebouncedState as R } from "@react-hookz/web";
8
- import { Loader as $ } from "lucide-react";
9
- import "./MODIFIERS-MLfpKQY1.js";
6
+ import { i as F, bk as K, a$ as U, b0 as V, b1 as O, aq as P, ar as C, as as S, at as k, au as h, bn as Q, B as $ } from "./index-_OgCuSUz.js";
7
+ import { useDebouncedState as H } from "@react-hookz/web";
8
+ import { Loader as R } from "lucide-react";
9
+ import "./_commonjsHelpers-UyOWmZb0.js";
10
10
  import "@radix-ui/react-toggle";
11
11
  import "class-variance-authority";
12
- import "./utils-XsPKXMVo.js";
12
+ import "./utils-AvyFzbPC.js";
13
+ import "./MODIFIERS-RiXS5Mn1.js";
13
14
  import "clsx";
14
15
  import "tailwind-merge";
15
16
  import "@radix-ui/react-switch";
@@ -35,23 +36,24 @@ import "react-dom";
35
36
  import "react-quill";
36
37
  import "jotai";
37
38
  import "flat-to-nested";
39
+ import "./Functions-7jnEwJyw.js";
38
40
  import "redux-undo";
39
41
  import "@chaibuilder/runtime";
40
42
  import "react-i18next";
41
- const k = async (x, g) => new Promise((o, r) => {
43
+ const I = async (x, g) => new Promise((o, r) => {
42
44
  B({ accessKey: g }).search.getPhotos(x).then((i) => {
43
45
  o(i);
44
46
  }).catch((i) => r(i));
45
- }), _e = ({ isModalView: x, onSelect: g }) => {
46
- const o = F("unsplashAccessKey", ""), [r, j] = p([]), [i, v] = p(0), [l, q] = p(), [n, A] = p(), [z, y] = p(0), [u, T] = R("", 1e3), [f, c] = p(!1), _ = async (s) => {
47
+ }), Ee = ({ isModalView: x, onSelect: g }) => {
48
+ const o = F("unsplashAccessKey", ""), [r, j] = p([]), [i, v] = p(0), [l, q] = p(), [n, A] = p(), [z, y] = p(0), [u, T] = H("", 1e3), [f, c] = p(!1), _ = async (s) => {
47
49
  if (d(u))
48
50
  return;
49
51
  let t = i + 1;
50
52
  s && (s.preventDefault(), t = 1), c(!0), v(t);
51
53
  const m = { query: u, page: t };
52
- l && (m.orientation = l), n && (m.color = n), k(m, o).then((a) => {
53
- var b, N, w;
54
- j(t === 1 ? ((b = a == null ? void 0 : a.response) == null ? void 0 : b.results) || [] : [...r, ...((N = a == null ? void 0 : a.response) == null ? void 0 : N.results) || []]), y((w = a == null ? void 0 : a.response) == null ? void 0 : w.total_pages), c(!1);
54
+ l && (m.orientation = l), n && (m.color = n), I(m, o).then((a) => {
55
+ var N, b, w;
56
+ j(t === 1 ? ((N = a == null ? void 0 : a.response) == null ? void 0 : N.results) || [] : [...r, ...((b = a == null ? void 0 : a.response) == null ? void 0 : b.results) || []]), y((w = a == null ? void 0 : a.response) == null ? void 0 : w.total_pages), c(!1);
55
57
  }).catch(() => {
56
58
  c(!1);
57
59
  });
@@ -60,7 +62,7 @@ const k = async (x, g) => new Promise((o, r) => {
60
62
  if (!d(u) && o) {
61
63
  c(!0);
62
64
  const s = { query: u, page: 1 };
63
- l && (s.orientation = l), n && (s.color = n), v(1), k(s, o).then((t) => {
65
+ l && (s.orientation = l), n && (s.color = n), v(1), I(s, o).then((t) => {
64
66
  var m, a;
65
67
  j(((m = t == null ? void 0 : t.response) == null ? void 0 : m.results) || []), y((a = t == null ? void 0 : t.response) == null ? void 0 : a.total_pages), c(!1);
66
68
  }).catch(() => {
@@ -91,10 +93,10 @@ const k = async (x, g) => new Promise((o, r) => {
91
93
  onChange: (s) => T(s.target.value)
92
94
  }
93
95
  ),
94
- /* @__PURE__ */ e.jsxs(O, { children: [
95
- /* @__PURE__ */ e.jsx(U, { asChild: !0, className: "h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200", children: /* @__PURE__ */ e.jsx(L, {}) }),
96
+ /* @__PURE__ */ e.jsxs(U, { children: [
97
+ /* @__PURE__ */ e.jsx(V, { asChild: !0, className: "h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200", children: /* @__PURE__ */ e.jsx(L, {}) }),
96
98
  /* @__PURE__ */ e.jsx(
97
- V,
99
+ O,
98
100
  {
99
101
  side: x ? "bottom" : "right",
100
102
  className: "z-[9999] flex w-max items-center justify-center",
@@ -102,7 +104,7 @@ const k = async (x, g) => new Promise((o, r) => {
102
104
  /* @__PURE__ */ e.jsx("div", { className: "py-1 text-sm font-medium", children: "Orientation" }),
103
105
  /* @__PURE__ */ e.jsxs(P, { defaultValue: l, onValueChange: (s) => q(s), children: [
104
106
  /* @__PURE__ */ e.jsx(C, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(S, { placeholder: "Select" }) }),
105
- /* @__PURE__ */ e.jsxs(I, { className: "z-[9999]", children: [
107
+ /* @__PURE__ */ e.jsxs(k, { className: "z-[9999]", children: [
106
108
  /* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
107
109
  /* @__PURE__ */ e.jsx(h, { value: "landscape", children: "Landscape" }),
108
110
  /* @__PURE__ */ e.jsx(h, { value: "portrait", children: "Portrait" }),
@@ -112,7 +114,7 @@ const k = async (x, g) => new Promise((o, r) => {
112
114
  /* @__PURE__ */ e.jsx("div", { className: "pb-1 pt-2 text-sm font-medium", children: "Color" }),
113
115
  /* @__PURE__ */ e.jsxs(P, { defaultValue: n, onValueChange: (s) => A(s), children: [
114
116
  /* @__PURE__ */ e.jsx(C, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(S, { placeholder: "Select" }) }),
115
- /* @__PURE__ */ e.jsxs(I, { className: "z-[9999]", children: [
117
+ /* @__PURE__ */ e.jsxs(k, { className: "z-[9999]", children: [
116
118
  /* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
117
119
  [
118
120
  "black_and_white",
@@ -172,11 +174,11 @@ const k = async (x, g) => new Promise((o, r) => {
172
174
  ) }) }, s.id)
173
175
  )),
174
176
  f && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center py-8", children: [
175
- /* @__PURE__ */ e.jsx($, { className: "animate-spin w-6 h-6" }),
177
+ /* @__PURE__ */ e.jsx(R, { className: "animate-spin w-6 h-6" }),
176
178
  "  Loading..."
177
179
  ] }),
178
180
  !d(r) && i < z && !f && /* @__PURE__ */ e.jsx(
179
- H,
181
+ $,
180
182
  {
181
183
  size: "sm",
182
184
  variant: "link",
@@ -192,6 +194,6 @@ const k = async (x, g) => new Promise((o, r) => {
192
194
  ] });
193
195
  };
194
196
  export {
195
- _e as default,
196
- k as fetchImage
197
+ Ee as default,
198
+ I as fetchImage
197
199
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),o=require("react"),l=require("lodash-es"),C=require("@radix-ui/react-icons"),k=require("unsplash-js"),t=require("./index-IIJ_o44s.cjs"),A=require("@react-hookz/web"),T=require("lucide-react");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("jotai");require("flat-to-nested");require("./Functions-N3yhPYKY.cjs");require("redux-undo");require("@chaibuilder/runtime");require("react-i18next");const g=async(d,E)=>new Promise((a,n)=>{k.createApi({accessKey:E}).search.getPhotos(d).then(c=>{a(c)}).catch(c=>n(c))}),z=({isModalView:d,onSelect:E})=>{const a=t.useBuilderProp("unsplashAccessKey",""),[n,f]=o.useState([]),[c,q]=o.useState(0),[u,S]=o.useState(),[x,b]=o.useState(),[I,R]=o.useState(0),[j,w]=A.useDebouncedState("",1e3),[h,m]=o.useState(!1),P=async s=>{if(l.isEmpty(j))return;let i=c+1;s&&(s.preventDefault(),i=1),m(!0),q(i);const p={query:j,page:i};u&&(p.orientation=u),x&&(p.color=x),g(p,a).then(r=>{var y,v,N;f(i===1?((y=r==null?void 0:r.response)==null?void 0:y.results)||[]:[...n,...((v=r==null?void 0:r.response)==null?void 0:v.results)||[]]),R((N=r==null?void 0:r.response)==null?void 0:N.total_pages),m(!1)}).catch(()=>{m(!1)})};return o.useEffect(()=>{if(!l.isEmpty(j)&&a){m(!0);const s={query:j,page:1};u&&(s.orientation=u),x&&(s.color=x),q(1),g(s,a).then(i=>{var p,r;f(((p=i==null?void 0:i.response)==null?void 0:p.results)||[]),R((r=i==null?void 0:i.response)==null?void 0:r.total_pages),m(!1)}).catch(()=>{m(!1)})}},[u,x,j,a]),l.isEmpty(a)?e.jsxRuntimeExports.jsx("div",{className:"h-full flex 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:"underline px-1 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 rounded-md border bg-gray-100 p-px",children:[e.jsxRuntimeExports.jsx(t.Input,{type:"text",name:"query",className:"input",placeholder:'Try "dog" or "apple"',onChange:s=>w(s.target.value)}),e.jsxRuntimeExports.jsxs(t.Popover,{children:[e.jsxRuntimeExports.jsx(t.PopoverTrigger,{asChild:!0,className:"h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200",children:e.jsxRuntimeExports.jsx(C.MixerHorizontalIcon,{})}),e.jsxRuntimeExports.jsx(t.PopoverContent,{side:d?"bottom":"right",className:"z-[9999] flex w-max items-center justify-center",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:"py-1 text-sm font-medium",children:"Orientation"}),e.jsxRuntimeExports.jsxs(t.Select,{defaultValue:u,onValueChange:s=>S(s),children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(t.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(t.SelectItem,{value:"",children:"All"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"landscape",children:"Landscape"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"portrait",children:"Portrait"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"squarish",children:"Square"})]})]}),e.jsxRuntimeExports.jsx("div",{className:"pb-1 pt-2 text-sm font-medium",children:"Color"}),e.jsxRuntimeExports.jsxs(t.Select,{defaultValue:x,onValueChange:s=>b(s),children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(t.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(t.SelectItem,{value:"",children:"All"}),["black_and_white","black","white","yellow","orange","red","purple","magenta","green","teal","blue"].map(s=>e.jsxRuntimeExports.jsx(t.SelectItem,{value:s,children:l.startCase(s)},s))]})]})]})})]})]}),e.jsxRuntimeExports.jsxs(t.ScrollArea,{className:`h-full ${d&&!l.isEmpty(n)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[l.isEmpty(n)&&!h&&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"})]}),d?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:n.map(s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>E(s.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:s.alt_description,src:s.urls.small})})},s.id))}):n.map(s=>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:s.alt_description,src:s.urls.small})})},s.id)),h&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsxRuntimeExports.jsx(T.Loader,{className:"animate-spin w-6 h-6"}),"  Loading..."]}),!l.isEmpty(n)&&c<I&&!h&&e.jsxRuntimeExports.jsx(t.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>P(void 0),disabled:h,children:h?"":"Load More"})]})]})};exports.default=z;exports.fetchImage=g;
@@ -1,13 +1,14 @@
1
- import { j as e } from "./jsx-runtime-NV737rRe.js";
2
- import { useState as a, useEffect as w } from "react";
3
- import { a as g, d as b } from "./lodash-3gkdNK5u.js";
1
+ import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
+ import { useState as i, useEffect as w } from "react";
3
+ import { isEmpty as g, map as b } from "lodash-es";
4
4
  import { GearIcon as C, UploadIcon as U, Cross1Icon as k } from "@radix-ui/react-icons";
5
5
  import { atom as F, useAtom as E } from "jotai";
6
- import { i as j, bo as A } from "./index-0OqmBgqo.js";
7
- import "./MODIFIERS-MLfpKQY1.js";
6
+ import { i as j, bn as A } from "./index-_OgCuSUz.js";
7
+ import "./_commonjsHelpers-UyOWmZb0.js";
8
8
  import "@radix-ui/react-toggle";
9
9
  import "class-variance-authority";
10
- import "./utils-XsPKXMVo.js";
10
+ import "./utils-AvyFzbPC.js";
11
+ import "./MODIFIERS-RiXS5Mn1.js";
11
12
  import "clsx";
12
13
  import "tailwind-merge";
13
14
  import "@radix-ui/react-switch";
@@ -32,17 +33,18 @@ import "react-icons-picker";
32
33
  import "react-dom";
33
34
  import "react-quill";
34
35
  import "flat-to-nested";
36
+ import "./Functions-7jnEwJyw.js";
35
37
  import "redux-undo";
36
38
  import "@chaibuilder/runtime";
37
39
  import "@react-hookz/web";
38
40
  import "react-i18next";
39
- const R = F([]), he = ({ isModalView: s, onSelect: i }) => {
40
- const v = j("uploadMediaCallback", () => ""), c = j("fetchMediaCallback", () => []), [r, n] = E(R), [o, p] = a(!1), [u, x] = a(!1), [m, d] = a(), [f, y] = a("");
41
+ const R = F([]), be = ({ isModalView: r, onSelect: a }) => {
42
+ const v = j("uploadMediaCallback", () => ""), c = j("fetchMediaCallback", () => []), [s, m] = E(R), [o, p] = i(!1), [u, x] = i(!1), [n, d] = i(), [f, y] = i("");
41
43
  w(() => {
42
44
  (async () => {
43
45
  x(!0);
44
46
  const t = await c();
45
- n(t || []), x(!1);
47
+ m(t || []), x(!1);
46
48
  })();
47
49
  }, []);
48
50
  const N = (t) => {
@@ -51,21 +53,21 @@ const R = F([]), he = ({ isModalView: s, onSelect: i }) => {
51
53
  }, I = async () => {
52
54
  p(!0);
53
55
  try {
54
- const { url: t } = await v(m);
55
- i(t), d(void 0);
56
+ const { url: t } = await v(n);
57
+ a(t), d(void 0);
56
58
  const l = await c();
57
- n(l);
59
+ m(l);
58
60
  } catch (t) {
59
- n([]), y((t == null ? void 0 : t.message) || "Something went wrong.");
61
+ m([]), y((t == null ? void 0 : t.message) || "Something went wrong.");
60
62
  }
61
63
  p(!1);
62
64
  };
63
65
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
64
- m ? /* @__PURE__ */ e.jsxs("div", { className: "relative flex w-full flex-col items-center justify-center rounded-md border bg-slate-50 p-2 px-1", children: [
66
+ n ? /* @__PURE__ */ e.jsxs("div", { className: "relative flex w-full flex-col items-center justify-center rounded-md border bg-slate-50 p-2 px-1", children: [
65
67
  /* @__PURE__ */ e.jsx(
66
68
  "img",
67
69
  {
68
- src: URL.createObjectURL(m),
70
+ src: URL.createObjectURL(n),
69
71
  alt: "",
70
72
  className: "h-auto w-full max-w-sm rounded-md max-h-96 object-contain"
71
73
  }
@@ -99,26 +101,26 @@ const R = F([]), he = ({ isModalView: s, onSelect: i }) => {
99
101
  }
100
102
  )
101
103
  ] })
102
- ] }) : /* @__PURE__ */ e.jsxs("label", { htmlFor: s ? "upload-in-modal" : "upload-in-panel", children: [
104
+ ] }) : /* @__PURE__ */ e.jsxs("label", { htmlFor: r ? "upload-in-modal" : "upload-in-panel", children: [
103
105
  /* @__PURE__ */ e.jsxs("div", { className: "flex w-full cursor-pointer flex-col items-center justify-center rounded-md border border-dashed border-blue-900 bg-gray-200 py-8 hover:bg-blue-50", children: [
104
106
  /* @__PURE__ */ e.jsx("div", { className: "text-3xl", children: "+" }),
105
107
  /* @__PURE__ */ e.jsx("div", { children: "Click to choose file" })
106
108
  ] }),
107
- /* @__PURE__ */ e.jsx("input", { type: "file", id: s ? "upload-in-modal" : "upload-in-panel", hidden: !0, onChange: N })
109
+ /* @__PURE__ */ e.jsx("input", { type: "file", id: r ? "upload-in-modal" : "upload-in-panel", hidden: !0, onChange: N })
108
110
  ] }),
109
- /* @__PURE__ */ e.jsxs(A, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${s ? "px-2" : ""} pt-2`, children: [
110
- g(r) && u && /* @__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: "Fetching..." }) }),
111
- g(r) && !u && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center py-6", children: /* @__PURE__ */ e.jsx("div", { className: "font-medium", children: "No Images" }) }),
112
- s ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: b(r, (t) => /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "my-1 flex", onClick: () => i(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
111
+ /* @__PURE__ */ e.jsxs(A, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${r ? "px-2" : ""} pt-2`, children: [
112
+ g(s) && u && /* @__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: "Fetching..." }) }),
113
+ g(s) && !u && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center py-6", children: /* @__PURE__ */ e.jsx("div", { className: "font-medium", children: "No Images" }) }),
114
+ r ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: b(s, (t) => /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "my-1 flex", onClick: () => a(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
113
115
  "img",
114
116
  {
115
117
  className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
116
118
  alt: t.name,
117
119
  src: t.thumbUrl
118
120
  }
119
- ) }) }, t.id)) }) : b(r, (t) => (
121
+ ) }) }, t.id)) }) : b(s, (t) => (
120
122
  // TODO: Drag and Drop Image to Canvas from Here use `pic.url` for image quality
121
- /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "px-2 py-1", onClick: () => i(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
123
+ /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "px-2 py-1", onClick: () => a(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
122
124
  "img",
123
125
  {
124
126
  className: "h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",
@@ -131,5 +133,5 @@ const R = F([]), he = ({ isModalView: s, onSelect: i }) => {
131
133
  ] });
132
134
  };
133
135
  export {
134
- he as default
136
+ be as default
135
137
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),s=require("react"),l=require("lodash-es"),d=require("@radix-ui/react-icons"),b=require("jotai"),m=require("./index-IIJ_o44s.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("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");const N=b.atom([]),I=({isModalView:t,onSelect:a})=>{const E=m.useBuilderProp("uploadMediaCallback",()=>""),p=m.useBuilderProp("fetchMediaCallback",()=>[]),[i,u]=b.useAtom(N),[n,j]=s.useState(!1),[h,f]=s.useState(!1),[x,c]=s.useState(),[g,R]=s.useState("");s.useEffect(()=>{(async()=>{f(!0);const r=await p();u(r||[]),f(!1)})()},[]);const v=r=>{var o,q;r&&((q=(o=r==null?void 0:r.target)==null?void 0:o.files)==null?void 0:q.length)>0&&c(r.target.files[0])},y=async()=>{j(!0);try{const{url:r}=await E(x);a(r),c(void 0);const o=await p();u(o)}catch(r){u([]),R((r==null?void 0:r.message)||"Something went wrong.")}j(!1)};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[x?e.jsxRuntimeExports.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center rounded-md border bg-slate-50 p-2 px-1",children:[e.jsxRuntimeExports.jsx("img",{src:URL.createObjectURL(x),alt:"",className:"h-auto w-full max-w-sm rounded-md max-h-96 object-contain"}),g&&e.jsxRuntimeExports.jsx("div",{className:"w-full pt-2 text-center text-sm text-red-500",children:g}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center justify-center gap-2 pt-2",children:[e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:y,disabled:n,className:"flex items-center rounded-full bg-blue-500 px-3 py-1 text-sm text-white hover:bg-blue-600 hover:text-white",children:[n?e.jsxRuntimeExports.jsx(d.GearIcon,{className:"animate-spin"}):e.jsxRuntimeExports.jsx(d.UploadIcon,{className:"animate-bounce"}),"  ",n?"Uploading...":"Upload"]}),!n&&e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center rounded-full border border-gray-300 px-3 py-1 text-sm hover:bg-gray-200",onClick:()=>c(void 0),children:[e.jsxRuntimeExports.jsx(d.Cross1Icon,{}),"  Cancel"]})]})]}):e.jsxRuntimeExports.jsxs("label",{htmlFor:t?"upload-in-modal":"upload-in-panel",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex w-full cursor-pointer flex-col items-center justify-center rounded-md border border-dashed border-blue-900 bg-gray-200 py-8 hover:bg-blue-50",children:[e.jsxRuntimeExports.jsx("div",{className:"text-3xl",children:"+"}),e.jsxRuntimeExports.jsx("div",{children:"Click to choose file"})]}),e.jsxRuntimeExports.jsx("input",{type:"file",id:t?"upload-in-modal":"upload-in-panel",hidden:!0,onChange:v})]}),e.jsxRuntimeExports.jsxs(m.ScrollArea,{className:`-mx-2 flex h-full flex-col pb-8 pt-2 ${t?"px-2":""} pt-2`,children:[l.isEmpty(i)&&h&&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:"Fetching..."})}),l.isEmpty(i)&&!h&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Images"})}),t?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:l.map(i,r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>a(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))}):l.map(i,r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>a(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=I;
@@ -0,0 +1,8 @@
1
+ var t = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
2
+ function r(e) {
3
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
4
+ }
5
+ export {
6
+ t as c,
7
+ r as g
8
+ };
@@ -0,0 +1 @@
1
+ "use strict";var t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}exports.commonjsGlobal=t;exports.getDefaultExportFromCjs=o;
@@ -1,14 +1,15 @@
1
- import { j as t } from "./jsx-runtime-NV737rRe.js";
1
+ import { j as t } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import { useState as c } from "react";
3
- import { a0 as j } from "./lodash-3gkdNK5u.js";
4
- import { al as b, B as u, ak as C, ba as A } from "./index-0OqmBgqo.js";
5
- import { R as g } from "./controls-kEuiMMDf.js";
6
- import { F as D } from "./form-irY39wvJ.js";
7
- import { g as N } from "./index-qEix1meh.js";
8
- import "./MODIFIERS-MLfpKQY1.js";
3
+ import { kebabCase as j } from "lodash-es";
4
+ import { al as b, B as u, ak as C, b9 as A } from "./index-_OgCuSUz.js";
5
+ import { u as g } from "./controls-XPXGHKht.js";
6
+ import { F as D } from "./form-Moz_psOw.js";
7
+ import { g as N } from "./index-QEchoZ98.js";
8
+ import "./_commonjsHelpers-UyOWmZb0.js";
9
9
  import "@radix-ui/react-toggle";
10
10
  import "class-variance-authority";
11
- import "./utils-XsPKXMVo.js";
11
+ import "./utils-AvyFzbPC.js";
12
+ import "./MODIFIERS-RiXS5Mn1.js";
12
13
  import "clsx";
13
14
  import "tailwind-merge";
14
15
  import "@radix-ui/react-switch";
@@ -35,6 +36,7 @@ import "react-dom";
35
36
  import "react-quill";
36
37
  import "jotai";
37
38
  import "flat-to-nested";
39
+ import "./Functions-7jnEwJyw.js";
38
40
  import "redux-undo";
39
41
  import "@chaibuilder/runtime";
40
42
  import "@react-hookz/web";
@@ -49,12 +51,13 @@ import "react-dnd";
49
51
  import "@minoru/react-dnd-treeview";
50
52
  import "react-hotkeys-hook";
51
53
  import "sonner";
52
- import "./html-to-json-wmbV9eZP.js";
54
+ import "./html-to-json-xKBERAI1.js";
53
55
  import "himalaya";
56
+ import "lodash";
54
57
  import "lucide-react";
55
- const R = ({ closeModal: e }) => {
56
- var p, s;
57
- const i = N(), [o, f] = c({
58
+ const S = ({ closeModal: i }) => {
59
+ var a, s;
60
+ const e = N(), [o, f] = c({
58
61
  name: "",
59
62
  slug: "",
60
63
  blocks: [],
@@ -62,14 +65,14 @@ const R = ({ closeModal: e }) => {
62
65
  seoData: {},
63
66
  template: ""
64
67
  }), x = () => {
65
- i.mutate(o, { onSuccess: () => e() });
68
+ e.mutate(o, { onSuccess: () => i() });
66
69
  }, h = ({ formData: m }, r) => {
67
70
  f((l) => {
68
71
  var n, d;
69
- const a = { [r]: m[r] };
70
- return r === "name" ? a.slug = j((n = m[r]) == null ? void 0 : n.replace(/\d/g, "")) : r === "slug" && (a.slug = (d = m[r]) == null ? void 0 : d.replace(/\d/g, "").replace(/\s+/g, "").replace("--", "-").replace("__", "_")), {
72
+ const p = { [r]: m[r] };
73
+ return r === "name" ? p.slug = j((n = m[r]) == null ? void 0 : n.replace(/\d/g, "")) : r === "slug" && (p.slug = (d = m[r]) == null ? void 0 : d.replace(/\d/g, "").replace(/\s+/g, "").replace("--", "-").replace("__", "_")), {
71
74
  ...l,
72
- ...a
75
+ ...p
73
76
  };
74
77
  });
75
78
  }, P = {
@@ -81,24 +84,24 @@ const R = ({ closeModal: e }) => {
81
84
  };
82
85
  return /* @__PURE__ */ t.jsxs(b, { children: [
83
86
  /* @__PURE__ */ t.jsx("div", { className: "px-1 font-bold", children: "Add Page" }),
84
- /* @__PURE__ */ t.jsx(D, { formData: o, properties: P, onChange: h, disabled: i.isPending }),
87
+ /* @__PURE__ */ t.jsx(D, { formData: o, properties: P, onChange: h, disabled: e.isPending }),
85
88
  /* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ t.jsx(
86
89
  u,
87
90
  {
88
91
  type: "submit",
89
- disabled: !o.name || !o.slug || ((p = o.name) == null ? void 0 : p.length) < 2 || ((s = o.slug) == null ? void 0 : s.length) < 2 || i.isPending,
92
+ disabled: !o.name || !o.slug || ((a = o.name) == null ? void 0 : a.length) < 2 || ((s = o.slug) == null ? void 0 : s.length) < 2 || e.isPending,
90
93
  onClick: x,
91
94
  children: "Add Page"
92
95
  }
93
96
  ) })
94
97
  ] });
95
- }, St = () => {
96
- const [e, i] = c(!1);
97
- return /* @__PURE__ */ t.jsxs(C, { open: e, onOpenChange: () => i(!e), children: [
98
- /* @__PURE__ */ t.jsx(A, { asChild: !0, children: /* @__PURE__ */ t.jsx(u, { size: "sm", variant: "link", className: "text-blue-500", onClick: () => i(!e), children: "+ New Page" }) }),
99
- e && /* @__PURE__ */ t.jsx(R, { closeModal: () => i(!e) })
98
+ }, _t = () => {
99
+ const [i, e] = c(!1);
100
+ return /* @__PURE__ */ t.jsxs(C, { open: i, onOpenChange: () => e(!i), children: [
101
+ /* @__PURE__ */ t.jsx(A, { asChild: !0, children: /* @__PURE__ */ t.jsx(u, { size: "sm", variant: "link", className: "text-blue-500", onClick: () => e(!i), children: "+ New Page" }) }),
102
+ i && /* @__PURE__ */ t.jsx(S, { closeModal: () => e(!i) })
100
103
  ] });
101
104
  };
102
105
  export {
103
- St as default
106
+ _t as default
104
107
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),x=require("react"),P=require("lodash-es"),t=require("./index-IIJ_o44s.cjs"),g=require("./controls-Dy1qa8Dc.cjs"),R=require("./form-lJhy9DEC.cjs"),f=require("./index-hMoPNZVn.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-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("@react-hookz/web");require("react-i18next");require("@rjsf/core");require("@rjsf/validator-ajv8");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-dfALTAdG.cjs");require("himalaya");require("lodash");require("lucide-react");const b=({closeModal:i})=>{var l,q;const u=f.useAddPage(),[r,m]=x.useState({name:"",slug:"",blocks:[],type:"STATIC",seoData:{},template:""}),p=()=>{u.mutate(r,{onSuccess:()=>i()})},j=({formData:n},s)=>{m(o=>{var d,c;const a={[s]:n[s]};return s==="name"?a.slug=P.kebabCase((d=n[s])==null?void 0:d.replace(/\d/g,"")):s==="slug"&&(a.slug=(c=n[s])==null?void 0:c.replace(/\d/g,"").replace(/\s+/g,"").replace("--","-").replace("__","_")),{...o,...a}})},h={name:g.u({title:"Page Name",default:r.name}),slug:g.u({title:"Page Slug",default:r.slug})};return e.jsxRuntimeExports.jsxs(t.DialogContent,{children:[e.jsxRuntimeExports.jsx("div",{className:"px-1 font-bold",children:"Add Page"}),e.jsxRuntimeExports.jsx(R.Form,{formData:r,properties:h,onChange:j,disabled:u.isPending}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-end",children:e.jsxRuntimeExports.jsx(t.Button,{type:"submit",disabled:!r.name||!r.slug||((l=r.name)==null?void 0:l.length)<2||((q=r.slug)==null?void 0:q.length)<2||u.isPending,onClick:p,children:"Add Page"})})]})},E=()=>{const[i,u]=x.useState(!1);return e.jsxRuntimeExports.jsxs(t.Dialog,{open:i,onOpenChange:()=>u(!i),children:[e.jsxRuntimeExports.jsx(t.DialogTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(t.Button,{size:"sm",variant:"link",className:"text-blue-500",onClick:()=>u(!i),children:"+ New Page"})}),i&&e.jsxRuntimeExports.jsx(b,{closeModal:()=>u(!i)})]})};exports.default=E;
@@ -1,11 +1,12 @@
1
- import { j as i } from "./jsx-runtime-NV737rRe.js";
2
- import { D as a, F as n, H as c, I as x, K as j, B as d } from "./index-0OqmBgqo.js";
3
- import "./MODIFIERS-MLfpKQY1.js";
1
+ import { j as i } from "./jsx-runtime-WbnYoNE9.js";
2
+ import { D as a, F as n, H as c, I as x, K as j, B as d } from "./index-_OgCuSUz.js";
3
+ import "./_commonjsHelpers-UyOWmZb0.js";
4
4
  import "react";
5
5
  import "@radix-ui/react-toggle";
6
6
  import "class-variance-authority";
7
- import "./utils-XsPKXMVo.js";
8
- import "./lodash-3gkdNK5u.js";
7
+ import "./utils-AvyFzbPC.js";
8
+ import "lodash-es";
9
+ import "./MODIFIERS-RiXS5Mn1.js";
9
10
  import "clsx";
10
11
  import "tailwind-merge";
11
12
  import "@radix-ui/react-switch";
@@ -32,11 +33,12 @@ import "react-dom";
32
33
  import "react-quill";
33
34
  import "jotai";
34
35
  import "flat-to-nested";
36
+ import "./Functions-7jnEwJyw.js";
35
37
  import "redux-undo";
36
38
  import "@chaibuilder/runtime";
37
39
  import "@react-hookz/web";
38
40
  import "react-i18next";
39
- const b = ({
41
+ const ri = ({
40
42
  open: o,
41
43
  onCancel: m = () => {
42
44
  },
@@ -55,5 +57,5 @@ const b = ({
55
57
  ] })
56
58
  ] }) });
57
59
  export {
58
- b as default
60
+ ri as default
59
61
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("./index-IIJ_o44s.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("lodash-es");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("@react-hookz/web");require("react-i18next");const x=({open:t,onCancel:q=()=>{},onConfirm:s,title:n,description:i,disabled:u,cancelText:l="Discard",confirmText:o="Save"})=>e.jsxRuntimeExports.jsx(r.AlertDialog,{open:t,children:e.jsxRuntimeExports.jsxs(r.AlertDialogContent,{children:[e.jsxRuntimeExports.jsx(r.AlertDialogTitle,{children:n}),i&&e.jsxRuntimeExports.jsx(r.AlertDialogDescription,{children:i}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-3",children:[e.jsxRuntimeExports.jsx(r.AlertDialogCancel,{disabled:u,onClick:q,children:l}),e.jsxRuntimeExports.jsx(r.Button,{variant:"default",onClick:s,disabled:u,children:o})]})]})});exports.default=x;
@@ -0,0 +1 @@
1
+ "use strict";const t=require("lodash-es"),n="#styles:";const a=i=>({type:"singular",default:i.default||"",binding:t.get(i,"binding",!0),i18n:i.i18n||!1,dataType:"string",required:i.required||!1,schema:{type:"string",...t.omit(i,["i18n","required"])},uiSchema:{"ui:placeholder":i.placeholder||"Enter here"}}),d=i=>({type:"singular",default:i.default||"",binding:t.get(i,"binding",!0),dataType:"string",i18n:i.i18n||!1,required:i.required||!1,schema:{type:"string",...t.omit(i,["i18n","required","rows"])},uiSchema:{"ui:widget":"textarea","ui:placeholder":i.placeholder||"Enter here","ui:options":{rows:i.rows||4}}}),r=i=>({type:"singular",i18n:i.i18n||!1,default:i.default||!1,dataType:"boolean",binding:t.get(i,"binding",!0),schema:{type:"boolean",...t.omit(i,["i18n","required"])},uiSchema:{"ui:title":i.title||"Select Item","ui:description":""}}),u=i=>({type:"singular",default:i.default||"",binding:t.get(i,"binding",!0),dataType:"number",i18n:i.i18n||!1,required:i.required||!1,schema:{type:"number",...t.omit(i,["i18n","required"])},uiSchema:{}}),g=i=>({type:"singular",default:i.default||"",binding:t.get(i,"binding",!0),i18n:i.i18n||!1,required:i.required||!1,dataType:"string",schema:{type:"string",...t.omit(i,["i18n","required","options","binding"]),oneOf:i.options.map(e=>({const:e.value,title:e.title}))},uiSchema:{"ui:widget":"select"}}),l=i=>({type:"singular",i18n:i.i18n||!1,default:i.default||"",binding:t.get(i,"binding",!0),dataType:"string",schema:{type:"string",...t.omit(i,["i18n","required"])},uiSchema:{"ui:widget":"color"}});const s=i=>({type:"singular",default:i.default||"",i18n:i.i18n||!1,binding:t.get(i,"binding",!0),dataType:"string",schema:{type:"string",...t.omit(i,["i18n","required"])},uiSchema:{"ui:widget":"richtext"}}),p=i=>({type:"model",title:i.title,dataType:"object",default:i.default||{},binding:t.get(i,"binding",!0),properties:i.properties}),y=i=>({type:"list",itemProperties:i.itemProperties,binding:t.get(i,"binding",!0),title:i.title,dataType:"array",default:i.default||[],itemTitle:i.getItemLabel?i.getItemLabel({}):()=>""}),o=i=>({type:"styles",binding:!1,default:`${n},${i.default||""}`}),m=i=>({default:i.default||"",binding:t.get(i,"binding",!0),type:"singular",i18n:i.i18n||!1,dataType:"string",schema:{type:"string",title:"Icon",default:i.default||""},uiSchema:{"ui:widget":"icon"}}),c=i=>({default:i.default,type:"singular",binding:t.get(i,"binding",!0),dataType:"object",i18n:i.i18n||!1,schema:{type:"object",...i||{},properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}}},uiSchema:{"ui:field":"link"}}),b=i=>({type:"singular",default:i.default||"",binding:t.get(i,"binding",!0),dataType:"string",i18n:i.i18n||!1,schema:{type:"string",...t.omit(i,["i18n","required"])},uiSchema:{"ui:widget":"image"}});exports.S=o;exports.T=m;exports.b=p;exports.c=u;exports.f=g;exports.g=d;exports.h=y;exports.m=s;exports.o=b;exports.q=c;exports.r=r;exports.u=a;exports.y=l;