@chaibuilder/sdk 3.2.1 → 3.2.2

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.
@@ -1,5 +1,5 @@
1
1
  import { g as ct, c as P } from "./common-functions-D2lMFR6K.js";
2
- import { isEmpty as x, flatten as pt, flatMapDeep as ut, get as d, set as E, startsWith as k, find as m, startCase as dt, forEach as S, camelCase as ht, includes as w, has as A, filter as Q, some as yt, unset as H, map as st, compact as mt, trim as gt, capitalize as bt, memoize as xt, cloneDeep as M, keys as W, isString as $, isArray as I, each as ft, last as _t } from "lodash-es";
2
+ import { isEmpty as x, flatten as pt, flatMapDeep as ut, get as d, set as E, startsWith as k, find as m, startCase as dt, forEach as N, camelCase as ht, includes as w, has as A, filter as Q, some as yt, unset as H, map as st, compact as mt, trim as gt, capitalize as bt, memoize as xt, cloneDeep as M, keys as W, isString as $, isArray as I, each as ft, last as _t } from "lodash-es";
3
3
  import { parse as kt, stringify as D } from "himalaya";
4
4
  import { getRegisteredChaiBlock as vt } from "@chaibuilder/runtime";
5
5
  import { twMerge as wt } from "tailwind-merge";
@@ -89,7 +89,7 @@ const Bt = (e) => {
89
89
  form: {
90
90
  action: "action"
91
91
  }
92
- }, St = (e, a) => e.children.length === 1 && w(
92
+ }, Nt = (e, a) => e.children.length === 1 && w(
93
93
  ["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link", "RichText"],
94
94
  a._type
95
95
  ), j = (e) => e.map((a) => a.type === "text" ? d(a, "content", "") : x(a.children) ? "" : j(a.children)).join(""), R = (e) => e === null ? "" : e, ot = (e) => {
@@ -110,7 +110,7 @@ const Bt = (e) => {
110
110
  }, et = (e) => {
111
111
  if (e.tagName === "svg") return {};
112
112
  const a = {}, t = $t[e.tagName] || {}, s = e.attributes;
113
- return S(s, ({ key: n, value: o }) => {
113
+ return N(s, ({ key: n, value: o }) => {
114
114
  if (!w(at, n))
115
115
  if (n === "bid" && (a._bid = R(o)), t[n]) {
116
116
  if (e.tagName === "img" && n === "src" && !o.startsWith("http")) {
@@ -120,7 +120,7 @@ const Bt = (e) => {
120
120
  E(a, t[n], R(o));
121
121
  } else w(["style", "class", "srcset", "bid"], n) || (A(a, "styles_attrs") || (a.styles_attrs = {}), k(n, "@") && (n = n.replace("@", "x-on:")), a.styles_attrs[`${n}`] = R(o));
122
122
  }), delete a.class, a;
123
- }, Nt = (e, a = "styles") => {
123
+ }, St = (e, a = "styles") => {
124
124
  if (!e.attributes) return { [a]: `${f},` };
125
125
  const t = m(e.attributes, { key: "class" });
126
126
  if (t) {
@@ -235,25 +235,23 @@ const Bt = (e) => {
235
235
  if (t.type === "comment") return [];
236
236
  let s = { _id: ct() };
237
237
  if (a && (s._parent = a.block._id), t.type === "text")
238
- return x(d(t, "content", "")) ? [] : a && St(a.node, a.block) ? (E(a, "block.content", d(t, "content", "")), []) : { ...s, _type: "Text", content: d(t, "content", "") };
238
+ return x(d(t, "content", "")) ? [] : a && Nt(a.node, a.block) ? (E(a, "block.content", d(t, "content", "")), []) : { ...s, _type: "Text", content: d(t, "content", "") };
239
239
  if (k(t.tagName, "chai-")) {
240
240
  const c = t.attributes, p = m(c, { key: "chai-type" }), u = (p == null ? void 0 : p.value) || dt(t.tagName.replace("chai-", "")).replace(/\s+/g, "");
241
- s._type = u, S(c, ({ key: g, value: G }) => {
241
+ s._type = u, N(c, ({ key: g, value: G }) => {
242
242
  if (g === "about-this-component" || g === "chai-type" || g === "can-move" || g === "can-delete") return;
243
243
  if (g === "id") {
244
244
  s._id = G;
245
245
  return;
246
246
  }
247
247
  const rt = k(g, "_") ? g : ht(g);
248
- let N = R(G);
249
- typeof N == "string" && k(N, "#styles:") && (N = N.replace("#styles:", "#styles:,")), s[rt] = N;
248
+ let S = R(G);
249
+ typeof S == "string" && k(S, "#styles:") && (S = S.replace("#styles:", "#styles:,")), s[rt] = S;
250
250
  });
251
251
  const y = q(t.children, { block: s, node: t });
252
252
  return [s, ...y];
253
253
  }
254
- const n = d(t, "attributes", []), o = n.find(
255
- (c) => c.key === "data-chai-richtext" || c.key === "chai-richtext"
256
- ), l = n.find((c) => c.key === "class"), i = l && l.value.split(/\s+/).includes("rte"), h = n.find(
254
+ const n = d(t, "attributes", []), o = t.tagName === "p" || n.find((c) => c.key === "data-chai-richtext" || c.key === "chai-richtext"), l = n.find((c) => c.key === "class"), i = l && l.value.split(/\s+/).includes("rte"), h = n.find(
257
255
  (c) => c.key === "data-chai-lightbox" || c.key === "chai-lightbox"
258
256
  ), r = n.find(
259
257
  (c) => c.key === "data-chai-dropdown" || c.key === "chai-dropdown"
@@ -266,13 +264,13 @@ const Bt = (e) => {
266
264
  ...s,
267
265
  ...It(t),
268
266
  ...et(t),
269
- ...Nt(t)
267
+ ...St(t)
270
268
  }, t.attributes) {
271
269
  const c = t.attributes.find((p) => w(at, p.key));
272
270
  c && (s._name = c.value);
273
271
  }
274
272
  if (o || i)
275
- return s.content = D(t.children), A(s, "styles_attrs.data-chai-richtext") && delete s.styles_attrs["data-chai-richtext"], A(s, "styles_attrs.chai-richtext") && delete s.styles_attrs["chai-richtext"], [s];
273
+ return s.content = `<p>${D(t.children || [])}</p>`, A(s, "styles_attrs.data-chai-richtext") && delete s.styles_attrs["data-chai-richtext"], A(s, "styles_attrs.chai-richtext") && delete s.styles_attrs["chai-richtext"], [s];
276
274
  if (h) {
277
275
  const c = [
278
276
  "data-chai-lightbox",
@@ -292,7 +290,7 @@ const Bt = (e) => {
292
290
  maxWidth: ((F = (z = n.find((p) => p.key === "data-maxwidth")) == null ? void 0 : z.value) == null ? void 0 : F.replace("px", "")) || "",
293
291
  backdropColor: ((U = n.find((p) => p.key === "data-overlay")) == null ? void 0 : U.value) || "",
294
292
  galleryName: ((Y = n.find((p) => p.key === "data-gall")) == null ? void 0 : Y.value) || ""
295
- }, S(c, (p) => {
293
+ }, N(c, (p) => {
296
294
  A(s, `styles_attrs.${p}`) && delete s.styles_attrs[p];
297
295
  });
298
296
  }
@@ -374,7 +372,7 @@ function Jt(e, a, t) {
374
372
  const s = d(t, "i18nProps", []);
375
373
  if (x(a) || x(s)) return e;
376
374
  const n = M(e);
377
- return S(W(n), (o) => {
375
+ return N(W(n), (o) => {
378
376
  if (w(s, o) && !x(a)) {
379
377
  const l = d(n, o), i = d(n, `${o}-${a}`, "");
380
378
  $(l) ? n[o] = $(i) && !x(i.trim()) && i.trimStart() || l : n[o] = x(i) ? l : i;
@@ -417,7 +415,7 @@ const Ft = xt((e) => {
417
415
  return typeof a.limit == "number" && a.limit > 0 && (s = a.limit), s !== void 0 && (t = t.slice(0, s)), t;
418
416
  }, Yt = (e, a) => {
419
417
  const t = M(e);
420
- return S(W(t), (s) => {
418
+ return N(W(t), (s) => {
421
419
  if ($(t[s]) && !k(s, "_")) {
422
420
  let n = t[s];
423
421
  s === "repeaterItems" && (t.repeaterItemsBinding = n);
@@ -639,7 +637,7 @@ const b = (e, a, { index: t, key: s }, n) => {
639
637
  return e.map((o) => b(o, a, { index: t, key: s }, n));
640
638
  if (e && typeof e == "object") {
641
639
  const o = {};
642
- return S(W(e), (l) => {
640
+ return N(W(e), (l) => {
643
641
  !k(l, "_") && l !== "$repeaterItemsKey" ? o[l] = b(e[l], a, { index: t, key: s }, l) : o[l] = e[l];
644
642
  }), o;
645
643
  }
@@ -0,0 +1 @@
1
+ "use strict";const T=require("./common-functions-B3a4xKt_.cjs"),t=require("lodash-es"),k=require("himalaya"),z=require("@chaibuilder/runtime"),U=require("tailwind-merge"),m="#styles:",Y="__ADD_BLOCK_INTERNAL_ROOT",K="@",V="#",v="dt#",H=e=>{if(e=e.replace(m,""),!e)return{baseClasses:"",classes:""};const l=e.split(/,(?![^\[]*\])/);if(l.length===1)return{baseClasses:"",classes:l[0].trim()};const[s,...n]=l;return{baseClasses:s.trim(),classes:n.join(",").trim().replace(/ +(?= )/g,"")}},X=e=>{const l=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,s=/(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;return l.test(e)||s.test(e)},G=e=>{if(t.isEmpty(e))return e;const l=/<video[^>]+src=['"]([^'">]+)['"]/,s=/<iframe[^>]+src=['"]([^'">]+)['"]/,n=e.match(l),a=e.match(s),i=n?n[1]:a?a[1]:null,o=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,r=/(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;return i&&(o.test(i)||r.test(i))?i:e},M=["chai-name","data-chai-name"],Z={img:{alt:"alt",width:"width",height:"height",src:"image"},video:{src:"url",autoplay:"controls.autoPlay",muted:"controls.muted",loop:"controls.loop",controls:"controls.widgets"},a:{href:"link.href",target:"link.target",type:""},input:{placeholder:"placeholder",required:"required",type:"inputType",name:"fieldName"},textarea:{placeholder:"placeholder",required:"required",type:"inputType",name:"fieldName"},select:{placeholder:"placeholder",required:"required",multiple:"multiple",name:"fieldName"},form:{action:"action"}},Q=(e,l)=>e.children.length===1&&t.includes(["Heading","Paragraph","Span","ListItem","Button","Label","TableCell","Link","RichText"],l._type),E=e=>e.map(l=>l.type==="text"?t.get(l,"content",""):t.isEmpty(l.children)?"":E(l.children)).join(""),B=e=>e===null?"":e,O=e=>{const l=t.compact(t.map(e.split(/\s+/),t.trim)),s=t.find(l,r=>/^w-/.test(r)),n=t.find(l,r=>/^h-/.test(r));if(!n||!s)return{height:"",width:""};const a=r=>{if(!r)return;const y=r.match(/^[wh]-(?:\[(.*?)\]|(.+))$/);if(!y)return;if(y[1])return y[1];const c=y[2];return/^\d+(\.\d+)?$/.test(c)?`${Number(c)*4}px`:c==="auto"||t.includes(c,"%")?c:"16px"},i=a(s),o=a(n);return{width:t.includes(i,"px")?i:"16px",height:t.includes(o,"px")?o:"16px"}},q=e=>{if(e.tagName==="svg")return{};const l={},s=Z[e.tagName]||{},n=e.attributes;return t.forEach(n,({key:a,value:i})=>{if(!t.includes(M,a))if(a==="bid"&&(l._bid=B(i)),s[a]){if(e.tagName==="img"&&a==="src"&&!i.startsWith("http")){const o=t.find(e.attributes,{key:"width"}),r=t.find(e.attributes,{key:"height"});o&&r?i=`https://picsum.photos/${o==null?void 0:o.value}x${r==null?void 0:r.value}`:i="https://picsum.photos/150x150"}t.set(l,s[a],B(i))}else t.includes(["style","class","srcset","bid"],a)||(t.has(l,"styles_attrs")||(l.styles_attrs={}),t.startsWith(a,"@")&&(a=a.replace("@","x-on:")),l.styles_attrs[`${a}`]=B(i))}),delete l.class,l},tt=(e,l="styles")=>{if(!e.attributes)return{[l]:`${m},`};const s=t.find(e.attributes,{key:"class"});if(s){const n=s.value;return{[l]:`${m},${n}`}}return{[l]:`${m},`}},et=e=>{const l=t.get(e,"attributes",[]),s=l.find(c=>c.key==="data-chai-richtext"||c.key==="chai-richtext"),n=l.find(c=>c.key==="data-chai-lightbox"||c.key==="chai-lightbox"),a=l.find(c=>c.key==="data-chai-dropdown"||c.key==="chai-dropdown"),i=l.find(c=>c.key==="data-chai-dropdown-button"||c.key==="chai-dropdown-button"),o=l.find(c=>c.key==="data-chai-dropdown-content"||c.key==="chai-dropdown-content"),r=l.find(c=>c.key==="class"),y=r&&r.value.split(/\s+/).includes("rte");if(a)return{_type:"Dropdown"};if(i)return{_type:"DropdownButton"};if(o)return{_type:"DropdownContent"};if(s||y)return{_type:"Paragraph"};if(n)return{_type:"LightBoxLink"};switch(e.tagName){case"img":return{_type:"Image"};case"input":return{_type:"Input",showLabel:!1};case"hr":return{_type:"Divider"};case"br":return{_type:"LineBreak"};case"textarea":return{_type:"TextArea",showLabel:!1};case"audio":return{_type:"Audio"};case"canvas":return{_type:"Canvas"};case"video":case"iframe":return{_type:"CustomHTML"};case"svg":return{_type:"Icon"};case"select":return{_type:"Select",options:[]};case"option":return{_type:"Option"};case"ul":case"ol":case"dl":return{_type:"List",tag:e.tagName,_listType:e.tagName==="ol"?"list-decimal":"list-none"};case"li":case"dt":return{_type:"ListItem",tag:e.tagName};case"span":case"figcaption":case"legend":return{_type:"Span",tag:e.tagName};case"p":return{_type:"Paragraph",content:""};case"a":return{_type:"Link"};case"form":return{_type:"Form"};case"label":return{_type:"Label"};case"button":return{_type:"Button"};case"code":return{_type:"Box",_name:"Code"};case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return{_type:"Heading",tag:e.tagName};case"table":return{_type:"Table"};case"tr":return{_type:"TableRow"};case"td":case"th":return{_type:"TableCell",tag:e.tagName};case"thead":return{_type:"TableHead"};case"tbody":return{_type:"TableBody"};case"tfoot":return{_type:"TableFooter"};default:{const c=t.get(e,"children",[]).length>0?"Box":"EmptyBox";return{_type:c,tag:e.tagName,_name:c=="EmptyBox"||e.tagName==="div"?c:t.capitalize(e.tagName)}}}},w=(e,l=null)=>t.flatMapDeep(e,s=>{var D,I,C,$,N,L,W,A,P,R;if(s.type==="comment")return[];let n={_id:T.generateUUID()};if(l&&(n._parent=l.block._id),s.type==="text")return t.isEmpty(t.get(s,"content",""))?[]:l&&Q(l.node,l.block)?(t.set(l,"block.content",t.get(s,"content","")),[]):{...n,_type:"Text",content:t.get(s,"content","")};if(t.startsWith(s.tagName,"chai-")){const p=s.attributes,u=t.find(p,{key:"chai-type"}),d=(u==null?void 0:u.value)||t.startCase(s.tagName.replace("chai-","")).replace(/\s+/g,"");n._type=d,t.forEach(p,({key:h,value:j})=>{if(h==="about-this-component"||h==="chai-type"||h==="can-move"||h==="can-delete")return;if(h==="id"){n._id=j;return}const J=t.startsWith(h,"_")?h:t.camelCase(h);let f=B(j);typeof f=="string"&&t.startsWith(f,"#styles:")&&(f=f.replace("#styles:","#styles:,")),n[J]=f});const g=w(s.children,{block:n,node:s});return[n,...g]}const a=t.get(s,"attributes",[]),i=s.tagName==="p"||a.find(p=>p.key==="data-chai-richtext"||p.key==="chai-richtext"),o=a.find(p=>p.key==="class"),r=o&&o.value.split(/\s+/).includes("rte"),y=a.find(p=>p.key==="data-chai-lightbox"||p.key==="chai-lightbox"),c=a.find(p=>p.key==="data-chai-dropdown"||p.key==="chai-dropdown"),b=a.find(p=>p.key==="data-chai-dropdown-button"||p.key==="chai-dropdown-button"),_=a.find(p=>p.key==="data-chai-dropdown-content"||p.key==="chai-dropdown-content");if(n={...n,...et(s),...q(s),...tt(s)},s.attributes){const p=s.attributes.find(u=>t.includes(M,u.key));p&&(n._name=p.value)}if(i||r)return n.content=`<p>${k.stringify(s.children||[])}</p>`,t.has(n,"styles_attrs.data-chai-richtext")&&delete n.styles_attrs["data-chai-richtext"],t.has(n,"styles_attrs.chai-richtext")&&delete n.styles_attrs["chai-richtext"],[n];if(y){const p=["data-chai-lightbox","chai-lightbox","data-vbtype","data-autoplay","data-maxwidth","data-overlay","data-gall","href"];n={...n,href:((D=a.find(u=>u.key==="href"))==null?void 0:D.value)||"",hrefType:((I=a.find(u=>u.key==="data-vbtype"))==null?void 0:I.value)||"video",autoplay:((C=a.find(u=>u.key==="data-autoplay"))==null?void 0:C.value)==="true"?"true":"false",maxWidth:((N=($=a.find(u=>u.key==="data-maxwidth"))==null?void 0:$.value)==null?void 0:N.replace("px",""))||"",backdropColor:((L=a.find(u=>u.key==="data-overlay"))==null?void 0:L.value)||"",galleryName:((W=a.find(u=>u.key==="data-gall"))==null?void 0:W.value)||""},t.forEach(p,u=>{t.has(n,`styles_attrs.${u}`)&&delete n.styles_attrs[u]})}if(c&&(delete n.styles_attrs,n.showDropdown=!1),_&&delete n.styles_attrs,b){delete n.styles_attrs;const p=t.filter(s.children||[],d=>(d==null?void 0:d.tagName)!=="span");n.content=E(p);const u=t.find(s.children||[],d=>(d==null?void 0:d.tagName)==="span"&&t.some(d.children||[],g=>(g==null?void 0:g.tagName)==="svg"));if(u){const d=t.find(u.children||[],g=>(g==null?void 0:g.tagName)==="svg");if(d){n.icon=k.stringify([d]);const{height:g,width:h}=st(d,"16px","16px");n.iconHeight=g,n.iconWidth=h}}return[n]}if(n._type==="Input"){const p=n.inputType||"text";p==="checkbox"?t.set(n,"_type","Checkbox"):p==="radio"&&t.set(n,"_type","Radio")}else if(s.tagName==="video"||s.tagName==="iframe"){const p=k.stringify([s]);return X(p)&&(t.set(n,"_type","Video"),t.set(n,"url",G(p)),t.set(n,"styles",`${m},`),t.set(n,"controls",{autoPlay:!1,muted:!0,loop:!1,controls:!1})),n.content=p,[n]}else if(s.tagName==="svg"){const p=t.get(t.find(s.attributes,{key:"class"}),"value",""),{height:u,width:d}=O(p);if(u&&d)n.styles=`${m}, ${T.cn(`w-${d} h-${u}`,p)}`.trim(),n.height=u==null?void 0:u.replace("px",""),n.width=d==null?void 0:d.replace("px","");else{const g=(A=t.find(s.attributes,{key:"height"}))==null?void 0:A.value,h=(P=t.find(s.attributes,{key:"width"}))==null?void 0:P.value;g&&h?(n.styles=`${m}, ${T.cn(`w-[${h}px] h-[${g}px]`,p)}`.trim(),n.height=g,n.width=h):n.styles=`${m}, ${T.cn("w-full h-full",p)}`.trim()}return s.attributes=t.filter(s.attributes,g=>!t.includes(["style","width","height","class"],g.key)),n.icon=k.stringify([s]),[n]}else if(s.tagName=="option"&&l&&((R=l.block)==null?void 0:R._type)==="Select")return l.block.options.push({label:E(s.children),...q(s)}),[];const x=w(s.children,{block:n,node:s});return[n,...x]}),st=(e,l,s)=>{var y,c;const n=t.get(e,"attributes",[]),{height:a,width:i}=O(t.get(t.find(n,{key:"class"}),"value",""));if(a&&i)return{height:`[${a}px]`,width:`[${i}px]`};const o=(y=t.find(n,{key:"height"}))==null?void 0:y.value,r=(c=t.find(n,{key:"width"}))==null?void 0:c.value;return{height:o?`[${o}px]`:s,width:r?`[${r}px]`:l}},nt=e=>{e=e.replace(/(\w+)=\\?"(.*?)\\?"/g,(n,a,i)=>{let o=i.replace(/\\"/g,'"');return o=o.replace(/{([^}]+)}/g,r=>r.replace(/"/g,'\\"')),`${a}="${o.replace(/\\"/g,'"')}"`}),e=e.replace(/\\n/g,"").replace(/\\\\/g,"").replace(/\\([/<>])/g,"$1").replace(/\\./g,"").replace(/[\n\r\t\f\v]/g,""),e=e.replace(/\$name="[^"]*"/g,"");const l=e.match(/<body[^>]*>[\s\S]*?<\/body>/);return(l&&l.length>0?l[0].replace(/<body/,"<div").replace(/<\/body>/,"</div>"):e).replace(/\s+/g," ").replaceAll("> <","><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").trim()},at=(e,l)=>t.find(e,{_id:l}),lt=(e,l)=>t.isEmpty(l)?e.map(s=>(t.unset(s,"_bid"),s)):t.map(e,s=>{const n=t.isEmpty(s._bid)?void 0:at(l,s._bid);if(n){n._type==="Icon"&&t.get(s,"icon","").match(/chai-default-svg/)&&delete s.icon;const a={...n,...s};return t.unset(a,"_bid"),a}return t.unset(s,"_bid"),s}),ot=e=>{const l=k.parse(nt(e));return t.isEmpty(e)?[]:t.flatten(w(l))};function rt(e,l,s){const n=t.get(s,"i18nProps",[]);if(t.isEmpty(l)||t.isEmpty(n))return e;const a=t.cloneDeep(e);return t.forEach(t.keys(a),i=>{if(t.includes(n,i)&&!t.isEmpty(l)){const o=t.get(a,i),r=t.get(a,`${i}-${l}`,"");t.isString(o)?a[i]=t.isString(r)&&!t.isEmpty(r.trim())&&r.trimStart()||o:a[i]=t.isEmpty(r)?o:r}}),a}const F=(e,l)=>{const{baseClasses:s,classes:n}=H(e),i=n.split(" ").filter(r=>r.startsWith(v)).map(r=>{var y;return(y=l[r])==null?void 0:y.value}),o=n.split(" ").filter(r=>!r.startsWith(v)).join(" ");return U.twMerge.apply(null,[s,...i,o])};function ct(e,l){return t.get(e,`${l}_attrs`,{})}function pt(e,l=!0,s={}){const n={};return Object.keys(e).forEach(a=>{if(t.isString(e[a])&&e[a].startsWith(m)){const i=F(e[a],s),o=ct(e,a);n[a]={...!t.isEmpty(i)&&{className:i},...o,...l?{"data-style-prop":a,"data-block-parent":e._id,"data-style-id":`${a}-${e._id}`}:{}}}}),n}const ut=t.memoize(e=>{const l=z.getRegisteredChaiBlock(e),s=t.get(l,"schema.properties",{});return Object.fromEntries(Object.entries(s).filter(([,n])=>t.get(n,"runtime",!1)))}),dt=(e,l)=>{if(!t.isArray(e))return e;let s=e,n;return typeof l.limit=="number"&&l.limit>0&&(n=l.limit),n!==void 0&&(s=s.slice(0,n)),s},yt=(e,l)=>{const s=t.cloneDeep(e);return t.forEach(t.keys(s),n=>{if(t.isString(s[n])&&!t.startsWith(n,"_")){let a=s[n];n==="repeaterItems"&&(s.repeaterItemsBinding=a);const i=/\{\{(.*?)\}\}/g,o=a.match(i);o&&o.forEach(r=>{let y=r.slice(2,-2);const c=t.get(l,y,r);a=t.isArray(c)?c:a.replace(r,c)}),s[n]=a}}),s},gt=(e,l)=>e.map(s=>{const n=t.keys(s).filter(a=>t.isString(s[a])&&s[a].startsWith(m));return t.each(n,a=>{s[a]=`${m},${F(s[a],l)}`}),s}),ht=e=>{const l=t.last(e);return e.map(s=>{const n=Object.keys(s);for(let a=0;a<n.length;a++)if(t.isString(s[n[a]])&&t.startsWith(n[a],"content")){const i=s===l?"":" ";s[n[a]]=`${s[n[a]].trim()}${i}`}return s})},S=(e,l,{index:s,key:n},a)=>{if(t.isString(e)){let i=e;const o=/\{\{(.*?)\}\}/g,r=e.match(o);if(r){const y=a==="image"||a==="mobileImage";r.forEach(c=>{let b=c.slice(2,-2).trim(),_=n.slice(2,-2).trim();s!==-1&&t.startsWith(b,"$index.")?b=`${_}.${s}.${b.slice(7)}`:s!==-1&&t.startsWith(b,"$index")&&(b=`${_}.${s}`);const x=t.get(l,b);x===void 0?i=i.replace(c,""):y&&!t.isArray(x)?i=x:i=t.isArray(x)?x:i.replace(c,x)})}return i}if(t.isArray(e))return e.map(i=>S(i,l,{index:s,key:n},a));if(e&&typeof e=="object"){const i={};return t.forEach(t.keys(e),o=>{!t.startsWith(o,"_")&&o!=="$repeaterItemsKey"?i[o]=S(e[o],l,{index:s,key:n},o):i[o]=e[o]}),i}return e},mt=(e,l,{index:s,key:n})=>{let a=t.cloneDeep(e);return a.repeaterItems&&(a.$repeaterItemsKey=a.repeaterItems,t.startsWith(a.repeaterItems,`{{${V}`)&&(a.$repeaterItemsKey=a.repeaterItems=`${a.repeaterItems.replace("}}",`/${a._id}}}`)}`),!t.isEmpty(a.repeaterItems)&&a.pagination&&(a.repeaterTotalItems=`${a.repeaterItems.replace("}}",`/${a._id}/totalItems}}`)}`)),S(a,l,{index:s,key:n})};exports.COLLECTION_PREFIX=V;exports.DESIGN_TOKEN_PREFIX=v;exports.REPEATER_PREFIX=K;exports.ROOT_TEMP_KEY=Y;exports.STYLES_KEY=m;exports.adjustSpacingInContentBlocks=ht;exports.applyBindingToBlockProps=mt;exports.applyChaiDataBinding=yt;exports.applyDesignTokens=gt;exports.applyLanguage=rt;exports.applyLimit=dt;exports.getBlockRuntimeProps=ut;exports.getBlockTagAttributes=pt;exports.getBlocksFromHTML=ot;exports.getSplitChaiClasses=H;exports.mergeBlocksWithExisting=lt;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("./index-CjZEAWCM.cjs");require("clsx");require("lodash-es");require("nanoid");require("tailwind-merge");require("tree-model");const c=require("react");require("jotai");require("@chaibuilder/runtime");require("sonner");const q=require("react-i18next"),r=require("./tooltip-Ba1-8jmj.cjs"),g=require("@react-hookz/web"),m=n=>{const s=document.createElement("div");return s.innerHTML=n,s.innerHTML};function j(){const{t:n}=q.useTranslation(),[s,h]=c.useState(!1),[a,p]=c.useState(""),[t,d]=i.useCodeEditor(),[u]=i.useSelectedBlockIds(),b=i.useUpdateBlocksProps(),f=i.useUpdateBlocksPropsRealtime(),C=g.useThrottledCallback(o=>{const l=m(o);f([t.blockId],{[t.blockProp]:l})},[],300),x=c.useCallback(()=>{if(s){const o=m(a);b([t.blockId],{[t.blockProp]:o})}},[s,a]);c.useEffect(()=>{u.includes(t==null?void 0:t.blockId)||(x(),d(null))},[u]);const k=()=>{x(),d(null)};return e.jsx(r.Dialog,{open:!0,onOpenChange:k,children:e.jsxs(r.DialogContent,{className:"flex max-h-[400px] min-h-[200px] max-w-4xl flex-col border-gray-700 text-black",children:[e.jsx(r.DialogHeader,{className:"shrink-0 border-b border-gray-700 pb-3",children:e.jsx(r.DialogTitle,{className:"flex items-center justify-between text-black",children:e.jsxs("div",{className:"space-x-3 text-sm font-semibold",children:[e.jsx("span",{children:n("HTML Code Editor |")}),e.jsx("span",{className:"text-xs text-gray-400",children:n("Scripts will be only executed in preview and live mode.")})]})})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(r.Textarea,{className:"h-full w-full resize-none font-mono text-xs",value:a||t.initialCode,onChange:o=>{const l=o.target.value;h(!0),p(l),C(l)},rows:10,placeholder:"Enter your code here..."})})]})})}exports.default=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("./index-IErL-ZZD.cjs");require("clsx");require("lodash-es");require("nanoid");require("tailwind-merge");require("tree-model");const c=require("react");require("jotai");require("@chaibuilder/runtime");require("sonner");const q=require("react-i18next"),r=require("./tooltip-Ba1-8jmj.cjs"),g=require("@react-hookz/web"),m=n=>{const s=document.createElement("div");return s.innerHTML=n,s.innerHTML};function j(){const{t:n}=q.useTranslation(),[s,h]=c.useState(!1),[a,p]=c.useState(""),[t,d]=i.useCodeEditor(),[u]=i.useSelectedBlockIds(),b=i.useUpdateBlocksProps(),f=i.useUpdateBlocksPropsRealtime(),C=g.useThrottledCallback(o=>{const l=m(o);f([t.blockId],{[t.blockProp]:l})},[],300),x=c.useCallback(()=>{if(s){const o=m(a);b([t.blockId],{[t.blockProp]:o})}},[s,a]);c.useEffect(()=>{u.includes(t==null?void 0:t.blockId)||(x(),d(null))},[u]);const k=()=>{x(),d(null)};return e.jsx(r.Dialog,{open:!0,onOpenChange:k,children:e.jsxs(r.DialogContent,{className:"flex max-h-[400px] min-h-[200px] max-w-4xl flex-col border-gray-700 text-black",children:[e.jsx(r.DialogHeader,{className:"shrink-0 border-b border-gray-700 pb-3",children:e.jsx(r.DialogTitle,{className:"flex items-center justify-between text-black",children:e.jsxs("div",{className:"space-x-3 text-sm font-semibold",children:[e.jsx("span",{children:n("HTML Code Editor |")}),e.jsx("span",{className:"text-xs text-gray-400",children:n("Scripts will be only executed in preview and live mode.")})]})})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(r.Textarea,{className:"h-full w-full resize-none font-mono text-xs",value:a||t.initialCode,onChange:o=>{const l=o.target.value;h(!0),p(l),C(l)},rows:10,placeholder:"Enter your code here..."})})]})})}exports.default=j;
@@ -1,5 +1,5 @@
1
1
  import { jsx as o, jsxs as d } from "react/jsx-runtime";
2
- import { u as C, a as k, b as v, c as g } from "./index-CXFBOH6M.js";
2
+ import { u as C, a as k, b as v, c as g } from "./index-CPvjpLmN.js";
3
3
  import "clsx";
4
4
  import "lodash-es";
5
5
  import "nanoid";
package/dist/core.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CjZEAWCM.cjs"),s=require("./common-functions-B3a4xKt_.cjs"),a=require("./apply-binding-DLHh7HoS.cjs"),l=require("react-i18next"),i=require("i18next");exports.ChaiAddBlocksDialog=e.AddBlocksDialog;exports.ChaiAddBlocksPanel=e.AddBlocksPanel;exports.ChaiAskAiUserPrompt=e.AIUserPrompt;exports.ChaiBlockAttributesEditor=e.BlockAttributesEditor;exports.ChaiBlockPropsEditor=e.BlockSettings;exports.ChaiBlockStyleEditor=e.BlockStyling;exports.ChaiBuilderCanvas=e.CanvasArea;exports.ChaiBuilderEditor=e.ChaiBuilderEditor;exports.ChaiDarkModeSwitcher=e.DarkMode;exports.ChaiDefaultBlocks=e.DefaultChaiBlocks;exports.ChaiDraggableBlock=e.ChaiDraggableBlock;exports.ChaiExportCodeModal=e.ExportCodeModal;exports.ChaiImportHTML=e.ImportHTML;exports.ChaiOutline=e.ListTree;exports.ChaiScreenSizes=e.Breakpoints;exports.ChaiThemeConfigPanel=e.ThemeConfigPanel;exports.ChaiUILibrariesPanel=e.UILibrariesPanel;exports.ChaiUndoRedo=e.UndoRedo;exports.IfChaiFeatureFlag=e.IfChaiFeatureFlag;exports.PERMISSIONS=e.PERMISSIONS;exports.getClassValueAndUnit=e.getClassValueAndUnit;exports.registerBlockSettingField=e.registerBlockSettingField;exports.registerBlockSettingTemplate=e.registerBlockSettingTemplate;exports.registerBlockSettingWidget=e.registerBlockSettingWidget;exports.registerChaiAddBlockTab=e.registerChaiAddBlockTab;exports.registerChaiFeatureFlag=e.registerChaiFeatureFlag;exports.registerChaiFeatureFlags=e.registerChaiFeatureFlags;exports.registerChaiLibrary=e.registerChaiLibrary;exports.registerChaiMediaManager=e.registerChaiMediaManager;exports.registerChaiPreImportHTMLHook=e.registerChaiPreImportHTMLHook;exports.registerChaiSaveToLibrary=e.registerChaiSaveToLibrary;exports.registerChaiSidebarPanel=e.registerChaiSidebarPanel;exports.registerChaiTopBar=e.registerChaiTopBar;exports.useAddBlock=e.useAddBlock;exports.useAddClassesToBlocks=e.useAddClassesToBlocks;exports.useAskAi=e.useAskAi;exports.useBlockHighlight=e.useBlockHighlight;exports.useBlocksHtmlForAi=e.useBlocksHtmlForAi;exports.useBlocksStore=e.useBlocksStore;exports.useBlocksStoreUndoableActions=e.useBlocksStoreUndoableActions;exports.useBrandingOptions=e.useBrandingOptions;exports.useBuilderProp=e.useBuilderProp;exports.useBuilderReset=e.useBuilderReset;exports.useCanvasDisplayWidth=e.useCanvasDisplayWidth;exports.useCanvasWidth=e.useCanvasWidth;exports.useCanvasZoom=e.useCanvasZoom;exports.useChaiFeatureFlag=e.useChaiFeatureFlag;exports.useChaiFeatureFlags=e.useChaiFeatureFlags;exports.useCodeEditor=e.useCodeEditor;exports.useCopyBlockIds=e.useCopyBlocks;exports.useCopyToClipboard=e.useCopyToClipboard;exports.useCurrentPage=e.useCurrentPage;exports.useCutBlockIds=e.useCutBlockIds;exports.useDarkMode=e.useDarkMode;exports.useDuplicateBlocks=e.useDuplicateBlocks;exports.useHighlightBlockId=e.useHighlightBlockId;exports.useHtmlToBlocks=e.useHtmlToBlocks;exports.useI18nBlocks=e.useI18nBlocks;exports.useInlineEditing=e.useInlineEditing;exports.useIsPageLoaded=e.useIsPageLoaded;exports.useLanguages=e.useLanguages;exports.useLibraryBlocks=e.useLibraryBlocks;exports.useMediaManagerComponent=e.useMediaManagerComponent;exports.usePartailBlocksStore=e.usePartialBlocksStore;exports.usePartialBlocksList=e.usePartialBlocksList;exports.usePasteBlocks=e.usePasteBlocks;exports.usePermissions=e.usePermissions;exports.usePreviewMode=e.usePreviewMode;exports.usePubSub=e.usePubSub;exports.useRemoveAllClassesForBlock=e.useRemoveAllClassesForBlock;exports.useRemoveBlocks=e.useRemoveBlocks;exports.useRemoveClassesFromBlocks=e.useRemoveClassesFromBlocks;exports.useReplaceBlock=e.useReplaceBlock;exports.useResetBlockStyles=e.useResetBlockStyles;exports.useRightPanel=e.useRightPanel;exports.useSavePage=e.useSavePage;exports.useScreenSizeWidth=e.useScreenSizeWidth;exports.useSelectedBlock=e.useSelectedBlock;exports.useSelectedBlockAllClasses=e.useSelectedBlockAllClasses;exports.useSelectedBlockCurrentClasses=e.useSelectedBlockCurrentClasses;exports.useSelectedBlockIds=e.useSelectedBlockIds;exports.useSelectedBlocksDisplayChild=e.useSelectedBlocksDisplayChild;exports.useSelectedBreakpoints=e.useSelectedBreakpoints;exports.useSelectedLibrary=e.useSelectedLibrary;exports.useSelectedStylingBlocks=e.useSelectedStylingBlocks;exports.useSidebarActivePanel=e.useSidebarActivePanel;exports.useStreamMultipleBlocksProps=e.useStreamMultipleBlocksProps;exports.useStylingBreakpoint=e.useStylingBreakpoint;exports.useStylingState=e.useStylingState;exports.useTheme=e.useTheme;exports.useThemeOptions=e.useThemeOptions;exports.useToggleChaiFeatureFlag=e.useToggleChaiFeatureFlag;exports.useUndoManager=e.useUndoManager;exports.useUpdateBlocksProps=e.useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=e.useUpdateBlocksPropsRealtime;exports.useWrapperBlock=e.useWrapperBlock;exports.generateBlockId=s.generateUUID;exports.mergeClasses=s.cn;exports.convertHTMLToChaiBlocks=a.getBlocksFromHTML;exports.getBlocksFromHTML=a.getBlocksFromHTML;Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:()=>l.useTranslation});exports.i18n=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-IErL-ZZD.cjs"),s=require("./common-functions-B3a4xKt_.cjs"),a=require("./apply-binding-DOJpwjiG.cjs"),l=require("react-i18next"),i=require("i18next");exports.ChaiAddBlocksDialog=e.AddBlocksDialog;exports.ChaiAddBlocksPanel=e.AddBlocksPanel;exports.ChaiAskAiUserPrompt=e.AIUserPrompt;exports.ChaiBlockAttributesEditor=e.BlockAttributesEditor;exports.ChaiBlockPropsEditor=e.BlockSettings;exports.ChaiBlockStyleEditor=e.BlockStyling;exports.ChaiBuilderCanvas=e.CanvasArea;exports.ChaiBuilderEditor=e.ChaiBuilderEditor;exports.ChaiDarkModeSwitcher=e.DarkMode;exports.ChaiDefaultBlocks=e.DefaultChaiBlocks;exports.ChaiDraggableBlock=e.ChaiDraggableBlock;exports.ChaiExportCodeModal=e.ExportCodeModal;exports.ChaiImportHTML=e.ImportHTML;exports.ChaiOutline=e.ListTree;exports.ChaiScreenSizes=e.Breakpoints;exports.ChaiThemeConfigPanel=e.ThemeConfigPanel;exports.ChaiUILibrariesPanel=e.UILibrariesPanel;exports.ChaiUndoRedo=e.UndoRedo;exports.IfChaiFeatureFlag=e.IfChaiFeatureFlag;exports.PERMISSIONS=e.PERMISSIONS;exports.getClassValueAndUnit=e.getClassValueAndUnit;exports.registerBlockSettingField=e.registerBlockSettingField;exports.registerBlockSettingTemplate=e.registerBlockSettingTemplate;exports.registerBlockSettingWidget=e.registerBlockSettingWidget;exports.registerChaiAddBlockTab=e.registerChaiAddBlockTab;exports.registerChaiFeatureFlag=e.registerChaiFeatureFlag;exports.registerChaiFeatureFlags=e.registerChaiFeatureFlags;exports.registerChaiLibrary=e.registerChaiLibrary;exports.registerChaiMediaManager=e.registerChaiMediaManager;exports.registerChaiPreImportHTMLHook=e.registerChaiPreImportHTMLHook;exports.registerChaiSaveToLibrary=e.registerChaiSaveToLibrary;exports.registerChaiSidebarPanel=e.registerChaiSidebarPanel;exports.registerChaiTopBar=e.registerChaiTopBar;exports.useAddBlock=e.useAddBlock;exports.useAddClassesToBlocks=e.useAddClassesToBlocks;exports.useAskAi=e.useAskAi;exports.useBlockHighlight=e.useBlockHighlight;exports.useBlocksHtmlForAi=e.useBlocksHtmlForAi;exports.useBlocksStore=e.useBlocksStore;exports.useBlocksStoreUndoableActions=e.useBlocksStoreUndoableActions;exports.useBrandingOptions=e.useBrandingOptions;exports.useBuilderProp=e.useBuilderProp;exports.useBuilderReset=e.useBuilderReset;exports.useCanvasDisplayWidth=e.useCanvasDisplayWidth;exports.useCanvasWidth=e.useCanvasWidth;exports.useCanvasZoom=e.useCanvasZoom;exports.useChaiFeatureFlag=e.useChaiFeatureFlag;exports.useChaiFeatureFlags=e.useChaiFeatureFlags;exports.useCodeEditor=e.useCodeEditor;exports.useCopyBlockIds=e.useCopyBlocks;exports.useCopyToClipboard=e.useCopyToClipboard;exports.useCurrentPage=e.useCurrentPage;exports.useCutBlockIds=e.useCutBlockIds;exports.useDarkMode=e.useDarkMode;exports.useDuplicateBlocks=e.useDuplicateBlocks;exports.useHighlightBlockId=e.useHighlightBlockId;exports.useHtmlToBlocks=e.useHtmlToBlocks;exports.useI18nBlocks=e.useI18nBlocks;exports.useInlineEditing=e.useInlineEditing;exports.useIsPageLoaded=e.useIsPageLoaded;exports.useLanguages=e.useLanguages;exports.useLibraryBlocks=e.useLibraryBlocks;exports.useMediaManagerComponent=e.useMediaManagerComponent;exports.usePartailBlocksStore=e.usePartialBlocksStore;exports.usePartialBlocksList=e.usePartialBlocksList;exports.usePasteBlocks=e.usePasteBlocks;exports.usePermissions=e.usePermissions;exports.usePreviewMode=e.usePreviewMode;exports.usePubSub=e.usePubSub;exports.useRemoveAllClassesForBlock=e.useRemoveAllClassesForBlock;exports.useRemoveBlocks=e.useRemoveBlocks;exports.useRemoveClassesFromBlocks=e.useRemoveClassesFromBlocks;exports.useReplaceBlock=e.useReplaceBlock;exports.useResetBlockStyles=e.useResetBlockStyles;exports.useRightPanel=e.useRightPanel;exports.useSavePage=e.useSavePage;exports.useScreenSizeWidth=e.useScreenSizeWidth;exports.useSelectedBlock=e.useSelectedBlock;exports.useSelectedBlockAllClasses=e.useSelectedBlockAllClasses;exports.useSelectedBlockCurrentClasses=e.useSelectedBlockCurrentClasses;exports.useSelectedBlockIds=e.useSelectedBlockIds;exports.useSelectedBlocksDisplayChild=e.useSelectedBlocksDisplayChild;exports.useSelectedBreakpoints=e.useSelectedBreakpoints;exports.useSelectedLibrary=e.useSelectedLibrary;exports.useSelectedStylingBlocks=e.useSelectedStylingBlocks;exports.useSidebarActivePanel=e.useSidebarActivePanel;exports.useStreamMultipleBlocksProps=e.useStreamMultipleBlocksProps;exports.useStylingBreakpoint=e.useStylingBreakpoint;exports.useStylingState=e.useStylingState;exports.useTheme=e.useTheme;exports.useThemeOptions=e.useThemeOptions;exports.useToggleChaiFeatureFlag=e.useToggleChaiFeatureFlag;exports.useUndoManager=e.useUndoManager;exports.useUpdateBlocksProps=e.useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=e.useUpdateBlocksPropsRealtime;exports.useWrapperBlock=e.useWrapperBlock;exports.generateBlockId=s.generateUUID;exports.mergeClasses=s.cn;exports.convertHTMLToChaiBlocks=a.getBlocksFromHTML;exports.getBlocksFromHTML=a.getBlocksFromHTML;Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:()=>l.useTranslation});exports.i18n=i;
package/dist/core.js CHANGED
@@ -1,6 +1,6 @@
1
- import { j as e, A as o, f as i, k as l, B as r, e as t, C as u, i as c, D as d, l as C, m as B, E as k, I as g, L as n, g as h, T as p, U as S, h as m, z as P, P as F, n as A, o as T, p as b, q as M, r as y, F as I, G as v, t as L, v as f, s as H, w as R, x as D, y as E, O as U, Q as x, R as W, S as O, V as w, W as z, aC as j, X as q, Y as G, Z as V, aE as Z, aD as J, _ as K, H as N, J as Q, u as X, $ as Y, a0 as _, a1 as $, a2 as aa, a3 as sa, a4 as ea, a5 as oa, a6 as ia, a7 as la, a8 as ra, a9 as ta, aa as ua, ab as ca, M as da, ac as Ca, ad as Ba, ae as ka, af as ga, ag as na, ah as ha, ai as pa, aj as Sa, ak as ma, al as Pa, am as Fa, an as Aa, ao as Ta, aF as ba, ap as Ma, aq as ya, ar as Ia, a as va, as as La, at as fa, aG as Ha, au as Ra, aH as Da, av as Ea, aw as Ua, ax as xa, ay as Wa, az as Oa, K as wa, aA as za, b as ja, c as qa, aB as Ga } from "./index-CXFBOH6M.js";
1
+ import { j as e, A as o, f as i, k as l, B as r, e as t, C as u, i as c, D as d, l as C, m as B, E as k, I as g, L as n, g as h, T as p, U as S, h as m, z as P, P as F, n as A, o as T, p as b, q as M, r as y, F as I, G as v, t as L, v as f, s as H, w as R, x as D, y as E, O as U, Q as x, R as W, S as O, V as w, W as z, aC as j, X as q, Y as G, Z as V, aE as Z, aD as J, _ as K, H as N, J as Q, u as X, $ as Y, a0 as _, a1 as $, a2 as aa, a3 as sa, a4 as ea, a5 as oa, a6 as ia, a7 as la, a8 as ra, a9 as ta, aa as ua, ab as ca, M as da, ac as Ca, ad as Ba, ae as ka, af as ga, ag as na, ah as ha, ai as pa, aj as Sa, ak as ma, al as Pa, am as Fa, an as Aa, ao as Ta, aF as ba, ap as Ma, aq as ya, ar as Ia, a as va, as as La, at as fa, aG as Ha, au as Ra, aH as Da, av as Ea, aw as Ua, ax as xa, ay as Wa, az as Oa, K as wa, aA as za, b as ja, c as qa, aB as Ga } from "./index-CPvjpLmN.js";
2
2
  import { g as Za, c as Ja } from "./common-functions-D2lMFR6K.js";
3
- import { h as Na, h as Qa } from "./apply-binding-CSWwWMjY.js";
3
+ import { h as Na, h as Qa } from "./apply-binding-B11pPFEE.js";
4
4
  import { useTranslation as Ya } from "react-i18next";
5
5
  import { default as $a } from "i18next";
6
6
  export {
@@ -13,7 +13,7 @@ import { twMerge } from "tailwind-merge";
13
13
  import TreeModel from "tree-model";
14
14
  import * as React from "react";
15
15
  import React__default, { useEffect, useCallback, useState, useMemo, useRef, Component, Children, memo, createElement, createContext, useContext, Suspense, lazy, useReducer, useDebugValue } from "react";
16
- import { C as COLLECTION_PREFIX, S as STYLES_KEY, j as getSplitChaiClasses, h as getBlocksFromHTML, m as mergeBlocksWithExisting, e as adjustSpacingInContentBlocks, a as applyBindingToBlockProps, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as REPEATER_PREFIX, D as DESIGN_TOKEN_PREFIX, k as ROOT_TEMP_KEY } from "./apply-binding-CSWwWMjY.js";
16
+ import { C as COLLECTION_PREFIX, S as STYLES_KEY, j as getSplitChaiClasses, h as getBlocksFromHTML, m as mergeBlocksWithExisting, e as adjustSpacingInContentBlocks, a as applyBindingToBlockProps, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as REPEATER_PREFIX, D as DESIGN_TOKEN_PREFIX, k as ROOT_TEMP_KEY } from "./apply-binding-B11pPFEE.js";
17
17
  import { d as defaultThemeOptions, f as defaultThemeValues, a as getChaiThemeCssVariables, g as getChaiThemeOptions, p as plugin, h as getThemeFontsUrls, i as getThemeCustomFontFace } from "./plugin-BOcGV_IY.js";
18
18
  import { isObject } from "@rjsf/utils";
19
19
  import { toast, Toaster } from "sonner";
@@ -3538,14 +3538,14 @@ function detectDropZone(o, n, r, a, i) {
3538
3538
  if (l === "canvas" && hasChildBlocks(o)) {
3539
3539
  const w = getChildBlocks(o), j = w[w.length - 1];
3540
3540
  if (j) {
3541
- const v = j.getBoundingClientRect(), _ = o.getBoundingClientRect(), N = window.getComputedStyle(o), I = parseFloat(N.paddingLeft) || 0, D = parseFloat(N.paddingRight) || 0, P = _.width - I - D, R = _.left + x + I;
3541
+ const v = j.getBoundingClientRect(), _ = o.getBoundingClientRect(), N = window.getComputedStyle(o), I = parseFloat(N.paddingLeft) || 0, P = parseFloat(N.paddingRight) || 0, D = _.width - I - P, R = _.left + x + I;
3542
3542
  return {
3543
3543
  position: "after",
3544
3544
  placeholderOrientation: "horizontal",
3545
3545
  rect: {
3546
3546
  top: v.bottom + h,
3547
3547
  left: R,
3548
- width: P,
3548
+ width: D,
3549
3549
  height: 4
3550
3550
  },
3551
3551
  targetElement: j,
@@ -3559,13 +3559,13 @@ function detectDropZone(o, n, r, a, i) {
3559
3559
  if (f && !m && hasChildBlocks(o)) {
3560
3560
  const w = detectGapZone(o, n, r, g);
3561
3561
  if (w) {
3562
- const j = w.before.getBoundingClientRect(), v = w.after.getBoundingClientRect(), _ = o.getBoundingClientRect(), N = window.getComputedStyle(o), I = parseFloat(N.paddingLeft) || 0, D = parseFloat(N.paddingRight) || 0, P = getChildBlocks(o), R = getSiblingsInSameRow(P, w.before, g);
3562
+ const j = w.before.getBoundingClientRect(), v = w.after.getBoundingClientRect(), _ = o.getBoundingClientRect(), N = window.getComputedStyle(o), I = parseFloat(N.paddingLeft) || 0, P = parseFloat(N.paddingRight) || 0, D = getChildBlocks(o), R = getSiblingsInSameRow(D, w.before, g);
3563
3563
  let $ = 0;
3564
3564
  if (R.forEach((F) => {
3565
3565
  const O = F.getBoundingClientRect();
3566
3566
  O.height > $ && ($ = O.height);
3567
3567
  }), g === "vertical") {
3568
- const F = _.width - I - D, O = _.left + x + I;
3568
+ const F = _.width - I - P, O = _.left + x + I;
3569
3569
  return {
3570
3570
  position: "after",
3571
3571
  placeholderOrientation: "horizontal",
@@ -3605,7 +3605,7 @@ function detectDropZone(o, n, r, a, i) {
3605
3605
  if (d && p) {
3606
3606
  const w = detectParentEdgeProximity(d, n, r, u);
3607
3607
  if (w) {
3608
- const j = d.getBoundingClientRect(), v = window.getComputedStyle(d), _ = parseFloat(v.paddingLeft) || 0, N = parseFloat(v.paddingRight) || 0, I = parseFloat(v.paddingTop) || 0, D = parseFloat(v.paddingBottom) || 0, P = ((B = i.defaultView) == null ? void 0 : B.scrollY) || 0, R = ((E = i.defaultView) == null ? void 0 : E.scrollX) || 0, $ = u === "vertical" ? "horizontal" : "vertical", F = getMaxSiblingDimensions(d);
3608
+ const j = d.getBoundingClientRect(), v = window.getComputedStyle(d), _ = parseFloat(v.paddingLeft) || 0, N = parseFloat(v.paddingRight) || 0, I = parseFloat(v.paddingTop) || 0, P = parseFloat(v.paddingBottom) || 0, D = ((B = i.defaultView) == null ? void 0 : B.scrollY) || 0, R = ((E = i.defaultView) == null ? void 0 : E.scrollX) || 0, $ = u === "vertical" ? "horizontal" : "vertical", F = getMaxSiblingDimensions(d);
3609
3609
  if (w === "start") {
3610
3610
  const O = getChildBlocks(d)[0];
3611
3611
  if (O) {
@@ -3616,7 +3616,7 @@ function detectDropZone(o, n, r, a, i) {
3616
3616
  position: "before",
3617
3617
  placeholderOrientation: $,
3618
3618
  rect: {
3619
- top: L.top + P - 2,
3619
+ top: L.top + D - 2,
3620
3620
  left: M,
3621
3621
  width: T,
3622
3622
  height: 4
@@ -3627,7 +3627,7 @@ function detectDropZone(o, n, r, a, i) {
3627
3627
  confidence: 0.9
3628
3628
  };
3629
3629
  } else {
3630
- const T = j.top + P + I, M = F.maxHeight > 0 ? F.maxHeight : j.height - I - D;
3630
+ const T = j.top + D + I, M = F.maxHeight > 0 ? F.maxHeight : j.height - I - P;
3631
3631
  return {
3632
3632
  position: "before",
3633
3633
  placeholderOrientation: $,
@@ -3654,7 +3654,7 @@ function detectDropZone(o, n, r, a, i) {
3654
3654
  position: "after",
3655
3655
  placeholderOrientation: $,
3656
3656
  rect: {
3657
- top: T.bottom + P - 2,
3657
+ top: T.bottom + D - 2,
3658
3658
  left: H,
3659
3659
  width: M,
3660
3660
  height: 4
@@ -3665,7 +3665,7 @@ function detectDropZone(o, n, r, a, i) {
3665
3665
  confidence: 0.9
3666
3666
  };
3667
3667
  } else {
3668
- const M = j.top + P + I, H = F.maxHeight > 0 ? F.maxHeight : j.height - I - D;
3668
+ const M = j.top + D + I, H = F.maxHeight > 0 ? F.maxHeight : j.height - I - P;
3669
3669
  return {
3670
3670
  position: "after",
3671
3671
  placeholderOrientation: $,
@@ -3759,25 +3759,25 @@ function getSiblingsInSameRow(o, n, r) {
3759
3759
  });
3760
3760
  }
3761
3761
  function calculatePlaceholderRect(o, n, r, a, i) {
3762
- var I, D;
3763
- const l = o.getBoundingClientRect(), c = window.getComputedStyle(o), d = ((I = i.defaultView) == null ? void 0 : I.scrollY) || 0, p = ((D = i.defaultView) == null ? void 0 : D.scrollX) || 0, u = parseFloat(c.marginTop) || 0, g = parseFloat(c.marginBottom) || 0, m = parseFloat(c.marginLeft) || 0, f = parseFloat(c.marginRight) || 0, h = parseFloat(c.paddingTop) || 0, x = parseFloat(c.paddingBottom) || 0, b = parseFloat(c.paddingLeft) || 0, y = parseFloat(c.paddingRight) || 0, C = n == null ? void 0 : n.getBoundingClientRect(), k = n && parseFloat(window.getComputedStyle(n).paddingLeft) || 0, S = n && parseFloat(window.getComputedStyle(n).paddingRight) || 0, A = n && parseFloat(window.getComputedStyle(n).paddingTop) || 0, B = n && parseFloat(window.getComputedStyle(n).paddingBottom) || 0, E = n ? getMaxSiblingDimensions(n) : { maxWidth: 0, maxHeight: 0 }, w = n ? getOrientation(n) : "vertical", j = n ? getChildBlocks(n) : [], v = getSiblingsInSameRow(j, o, w);
3762
+ var I, P;
3763
+ const l = o.getBoundingClientRect(), c = window.getComputedStyle(o), d = ((I = i.defaultView) == null ? void 0 : I.scrollY) || 0, p = ((P = i.defaultView) == null ? void 0 : P.scrollX) || 0, u = parseFloat(c.marginTop) || 0, g = parseFloat(c.marginBottom) || 0, m = parseFloat(c.marginLeft) || 0, f = parseFloat(c.marginRight) || 0, h = parseFloat(c.paddingTop) || 0, x = parseFloat(c.paddingBottom) || 0, b = parseFloat(c.paddingLeft) || 0, y = parseFloat(c.paddingRight) || 0, C = n == null ? void 0 : n.getBoundingClientRect(), k = n && parseFloat(window.getComputedStyle(n).paddingLeft) || 0, S = n && parseFloat(window.getComputedStyle(n).paddingRight) || 0, A = n && parseFloat(window.getComputedStyle(n).paddingTop) || 0, B = n && parseFloat(window.getComputedStyle(n).paddingBottom) || 0, E = n ? getMaxSiblingDimensions(n) : { maxWidth: 0, maxHeight: 0 }, w = n ? getOrientation(n) : "vertical", j = n ? getChildBlocks(n) : [], v = getSiblingsInSameRow(j, o, w);
3764
3764
  let _ = 0, N = 0;
3765
- if (v.forEach((P) => {
3766
- const R = P.getBoundingClientRect();
3765
+ if (v.forEach((D) => {
3766
+ const R = D.getBoundingClientRect();
3767
3767
  R.height > _ && (_ = R.height), R.width > N && (N = R.width);
3768
3768
  }), r === "before")
3769
3769
  if (a === "horizontal") {
3770
- const P = C ? C.width - k - S : l.width, R = C ? C.left + p + k : l.left + p;
3770
+ const D = C ? C.width - k - S : l.width, R = C ? C.left + p + k : l.left + p;
3771
3771
  return {
3772
3772
  top: l.top + d - u - 2,
3773
3773
  left: R,
3774
- width: P,
3774
+ width: D,
3775
3775
  height: 4
3776
3776
  };
3777
3777
  } else {
3778
- const P = l.top + d, R = w === "horizontal" && _ > 0 ? _ : E.maxHeight > 0 ? E.maxHeight : C ? C.height - A - B : l.height;
3778
+ const D = l.top + d, R = w === "horizontal" && _ > 0 ? _ : E.maxHeight > 0 ? E.maxHeight : C ? C.height - A - B : l.height;
3779
3779
  return {
3780
- top: P,
3780
+ top: D,
3781
3781
  left: l.left + p - m - 2,
3782
3782
  width: 4,
3783
3783
  height: R
@@ -3785,17 +3785,17 @@ function calculatePlaceholderRect(o, n, r, a, i) {
3785
3785
  }
3786
3786
  else if (r === "after")
3787
3787
  if (a === "horizontal") {
3788
- const P = C ? C.width - k - S : l.width, R = C ? C.left + p + k : l.left + p;
3788
+ const D = C ? C.width - k - S : l.width, R = C ? C.left + p + k : l.left + p;
3789
3789
  return {
3790
3790
  top: l.bottom + d + g - 2,
3791
3791
  left: R,
3792
- width: P,
3792
+ width: D,
3793
3793
  height: 4
3794
3794
  };
3795
3795
  } else {
3796
- const P = l.top + d, R = w === "horizontal" && _ > 0 ? _ : E.maxHeight > 0 ? E.maxHeight : C ? C.height - A - B : l.height;
3796
+ const D = l.top + d, R = w === "horizontal" && _ > 0 ? _ : E.maxHeight > 0 ? E.maxHeight : C ? C.height - A - B : l.height;
3797
3797
  return {
3798
- top: P,
3798
+ top: D,
3799
3799
  left: l.right + p + f - 2,
3800
3800
  width: 4,
3801
3801
  height: R
@@ -3886,8 +3886,8 @@ const LEAF_BLOCK_TYPES = [
3886
3886
  }
3887
3887
  const j = S === "up" ? -E : E;
3888
3888
  f.scrollBy(0, j);
3889
- const v = f.scrollY, _ = v > 0, N = v + h < b, I = p.current, D = h - p.current;
3890
- S === "up" && _ && I < AUTO_SCROLL_CONFIG.EDGE_ZONE || S === "down" && N && D < AUTO_SCROLL_CONFIG.EDGE_ZONE ? d.current = requestAnimationFrame(w) : d.current = null;
3889
+ const v = f.scrollY, _ = v > 0, N = v + h < b, I = p.current, P = h - p.current;
3890
+ S === "up" && _ && I < AUTO_SCROLL_CONFIG.EDGE_ZONE || S === "down" && N && P < AUTO_SCROLL_CONFIG.EDGE_ZONE ? d.current = requestAnimationFrame(w) : d.current = null;
3891
3891
  };
3892
3892
  d.current === null && (d.current = requestAnimationFrame(w));
3893
3893
  }
@@ -5628,18 +5628,18 @@ const RichTextEditor = memo(
5628
5628
  () => u(l._id, getBlockRuntimeProps(l._type)),
5629
5629
  [l._id, l._type, u, getBlockRuntimeProps]
5630
5630
  ), w = useMemo(() => {
5631
- const D = {
5631
+ const P = {
5632
5632
  "data-block-id": l._id,
5633
5633
  "data-block-type": l._type,
5634
5634
  "data-block-index": h
5635
5635
  };
5636
5636
  return k && C ? {
5637
- ...D,
5637
+ ...P,
5638
5638
  draggable: !0,
5639
5639
  onMouseDown: S.onMouseDown,
5640
5640
  onDragStart: S.onDragStart,
5641
5641
  onDragEnd: S.onDragEnd
5642
- } : D;
5642
+ } : P;
5643
5643
  }, [l._id, l._type, h, k, C, S]), j = useMemo(
5644
5644
  () => ({
5645
5645
  blockProps: w,
@@ -5837,7 +5837,7 @@ const RichTextEditor = memo(
5837
5837
  /* @__PURE__ */ jsx("p", { className: "font-semibold", children: o("Oops! Something went wrong.") }),
5838
5838
  /* @__PURE__ */ jsx("p", { children: o("Please try again.") })
5839
5839
  ] }) });
5840
- }, CodeEditor$1 = React__default.lazy(() => import("./code-editor-BNuPxnsb.js")), CanvasArea = () => {
5840
+ }, CodeEditor$1 = React__default.lazy(() => import("./code-editor-zas3OmxC.js")), CanvasArea = () => {
5841
5841
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
5842
5842
  return /* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40", children: [
5843
5843
  /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
@@ -6406,7 +6406,7 @@ const DataBindingSelector = ({
6406
6406
  ]
6407
6407
  }
6408
6408
  ) });
6409
- }, RTEModal = React__default.lazy(() => import("./rte-widget-modal-DuUAGYPy.js")), RichTextEditorFieldComp = ({ blockId: o, id: n, placeholder: r, value: a, onChange: i, onBlur: l }) => {
6409
+ }, RTEModal = React__default.lazy(() => import("./rte-widget-modal-2S4dpCHF.js")), RichTextEditorFieldComp = ({ blockId: o, id: n, placeholder: r, value: a, onChange: i, onBlur: l }) => {
6410
6410
  const c = useRef(null), [d, p] = useState(!1), u = useRTEditor({
6411
6411
  blockId: o,
6412
6412
  value: a,
@@ -7160,8 +7160,8 @@ const BlockStylingProps = () => {
7160
7160
  }
7161
7161
  if (get(_, "value") === "")
7162
7162
  return;
7163
- const D = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
7164
- v ? E(D) : B(D);
7163
+ const P = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
7164
+ v ? E(P) : B(P);
7165
7165
  },
7166
7166
  [B, E, a, m, d, u]
7167
7167
  ), j = useCallback(
@@ -7177,8 +7177,8 @@ const BlockStylingProps = () => {
7177
7177
  }
7178
7178
  if (get(_, "value") === "")
7179
7179
  return;
7180
- const N = get(_, "unit") !== "" ? get(_, "unit") : v, D = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
7181
- B(D);
7180
+ const N = get(_, "unit") !== "" ? get(_, "unit") : v, P = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
7181
+ B(P);
7182
7182
  },
7183
7183
  [B, a, d, u]
7184
7184
  );
@@ -7211,8 +7211,8 @@ const BlockStylingProps = () => {
7211
7211
  const _ = parseInt$1(v.target.value);
7212
7212
  let N = isNaN$1(_) ? 0 : _;
7213
7213
  v.keyCode === 38 && (N += 1), v.keyCode === 40 && (N -= 1);
7214
- const I = `${N}`, P = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${m === "-" ? "" : m}]`;
7215
- E(P);
7214
+ const I = `${N}`, D = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${m === "-" ? "" : m}]`;
7215
+ E(D);
7216
7216
  },
7217
7217
  onKeyUp: (v) => {
7218
7218
  S && (v.preventDefault(), A(!1));
@@ -8117,7 +8117,7 @@ function ManualClasses() {
8117
8117
  return v(z);
8118
8118
  }, I = () => {
8119
8119
  v([]);
8120
- }, D = (L) => L.name, P = (L) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-md p-1", children: [
8120
+ }, P = (L) => L.name, D = (L) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-md p-1", children: [
8121
8121
  L.isDesignToken && /* @__PURE__ */ jsx(DesignTokensIcon, { className: "h-4 w-4 text-gray-600" }),
8122
8122
  /* @__PURE__ */ jsx("span", { children: L.name })
8123
8123
  ] }), R = useMemo(
@@ -8169,8 +8169,8 @@ function ManualClasses() {
8169
8169
  suggestions: j,
8170
8170
  onSuggestionsFetchRequested: N,
8171
8171
  onSuggestionsClearRequested: I,
8172
- getSuggestionValue: D,
8173
- renderSuggestion: P,
8172
+ getSuggestionValue: P,
8173
+ renderSuggestion: D,
8174
8174
  inputProps: R,
8175
8175
  highlightFirstSuggestion: !0,
8176
8176
  onSuggestionSelected: (L, { suggestionValue: T }) => {
@@ -8942,8 +8942,8 @@ const BlockCard = ({
8942
8942
  const { t: c } = useTranslation(), [d] = useBlocksStore(), [p, u] = useState(""), g = useRef(null), [m] = useAtom$1(addBlockTabAtom), f = (N = find(d, (I) => I._id === r)) == null ? void 0 : N._type, [h, x] = useState("all"), [b, y] = useState(null), C = useRef(null), k = useBuilderProp("flags.dragAndDrop", !1);
8943
8943
  useEffect(() => {
8944
8944
  const I = setTimeout(() => {
8945
- var D;
8946
- (D = g.current) == null || D.focus();
8945
+ var P;
8946
+ (P = g.current) == null || P.focus();
8947
8947
  }, 0);
8948
8948
  return () => clearTimeout(I);
8949
8949
  }, [m]), useEffect(() => {
@@ -8962,8 +8962,8 @@ const BlockCard = ({
8962
8962
  }, []), E = useMemo(
8963
8963
  () => p ? values(n).filter(
8964
8964
  (I) => {
8965
- var D, P;
8966
- return (((D = I.label) == null ? void 0 : D.toLowerCase()) + " " + ((P = I.type) == null ? void 0 : P.toLowerCase())).includes(p.toLowerCase());
8965
+ var P, D;
8966
+ return (((P = I.label) == null ? void 0 : P.toLowerCase()) + " " + ((D = I.type) == null ? void 0 : D.toLowerCase())).includes(p.toLowerCase());
8967
8967
  }
8968
8968
  ) : n,
8969
8969
  [n, p]
@@ -9012,12 +9012,12 @@ const BlockCard = ({
9012
9012
  ' "',
9013
9013
  p,
9014
9014
  '"'
9015
- ] }) }) : /* @__PURE__ */ jsx("div", { className: `${l ? "p-0" : "p-4"} space-y-6`, children: _.map((I) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
9015
+ ] }) }) : /* @__PURE__ */ jsx("div", { className: `${l ? "p-0" : "p-4"} space-y-6`, children: _.map((I, P) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
9016
9016
  /* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(c(I.toLowerCase())) }),
9017
9017
  /* @__PURE__ */ jsx("div", { className: "grid gap-2 " + i, children: reject(
9018
9018
  h === "all" ? filter(values(v), { group: I }) : values(v),
9019
9019
  { hidden: !0 }
9020
- ).map((D) => /* @__PURE__ */ jsx(
9020
+ ).map((D, R) => /* @__PURE__ */ jsx(
9021
9021
  CoreBlock,
9022
9022
  {
9023
9023
  parentId: r,
@@ -9025,7 +9025,7 @@ const BlockCard = ({
9025
9025
  block: D,
9026
9026
  disabled: !k && (!canAcceptChildBlock(f, D.type) || !canBeNestedInside(f, D.type))
9027
9027
  },
9028
- D.type
9028
+ D.type + "-" + P + "-" + R
9029
9029
  )) })
9030
9030
  ] }, I)) }) })
9031
9031
  }
@@ -9513,7 +9513,7 @@ const useStructureValidation = () => {
9513
9513
  I(), o.parent.isSelected || _((T = o == null ? void 0 : o.parent) == null ? void 0 : T.id);
9514
9514
  }, I = () => {
9515
9515
  _(null);
9516
- }, D = (T) => {
9516
+ }, P = (T) => {
9517
9517
  I(), T.stopPropagation(), !o.isOpen && B && o.toggle(), k(T);
9518
9518
  };
9519
9519
  useEffect(() => {
@@ -9522,7 +9522,7 @@ const useStructureValidation = () => {
9522
9522
  }, 500);
9523
9523
  return () => clearTimeout(T);
9524
9524
  }, [b, o, y]);
9525
- const P = (T, M) => {
9525
+ const D = (T, M) => {
9526
9526
  const H = l.contentDocument || l.contentWindow.document, W = H.querySelector(`[data-block-id=${T}]`);
9527
9527
  W && W.setAttribute("data-drop", M);
9528
9528
  const z = W.getBoundingClientRect(), V = l.getBoundingClientRect();
@@ -9556,20 +9556,20 @@ const useStructureValidation = () => {
9556
9556
  {
9557
9557
  onMouseEnter: () => u(f),
9558
9558
  onMouseLeave: () => g(),
9559
- onClick: D,
9559
+ onClick: P,
9560
9560
  style: n,
9561
9561
  "data-node-id": f,
9562
9562
  ref: r,
9563
9563
  onDragStart: () => w(o),
9564
9564
  onDragEnd: () => j(o),
9565
9565
  onDragOver: (T) => {
9566
- T.preventDefault(), P(f, "yes");
9566
+ T.preventDefault(), D(f, "yes");
9567
9567
  },
9568
9568
  onDragLeave: (T) => {
9569
- T.preventDefault(), P(f, "no");
9569
+ T.preventDefault(), D(f, "no");
9570
9570
  },
9571
9571
  onDrop: (T) => {
9572
- T.preventDefault(), P(f, "no");
9572
+ T.preventDefault(), D(f, "no");
9573
9573
  },
9574
9574
  children: [
9575
9575
  c(PERMISSIONS.ADD_BLOCK) && !m && (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((L = o == null ? void 0 : o.parent) == null ? void 0 : L.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
@@ -11024,19 +11024,19 @@ const UndoRedo = () => {
11024
11024
  }, B = (w) => {
11025
11025
  w.key === "Enter" && !w.shiftKey && (w.preventDefault(), u !== null ? A() : C());
11026
11026
  }, E = useCallback((w) => {
11027
- const j = (N) => /[.,!?;:]/.test(N), v = (N, I, D) => {
11028
- let P = "", R = "";
11027
+ const j = (N) => /[.,!?;:]/.test(N), v = (N, I, P) => {
11028
+ let D = "", R = "";
11029
11029
  const $ = I > 0 ? N[I - 1] : "", F = I < N.length ? N[I] : "";
11030
- return I > 0 && ($ === "." || !j($) && $ !== " ") && (P = " "), I < N.length && !j(F) && F !== " " && (R = " "), {
11031
- text: P + D + R,
11032
- prefixLength: P.length,
11030
+ return I > 0 && ($ === "." || !j($) && $ !== " ") && (D = " "), I < N.length && !j(F) && F !== " " && (R = " "), {
11031
+ text: D + P + R,
11032
+ prefixLength: D.length,
11033
11033
  suffixLength: R.length
11034
11034
  };
11035
11035
  }, _ = x.current;
11036
11036
  if (_) {
11037
- const N = _.selectionStart || 0, I = _.value || "", D = _.selectionEnd || N;
11038
- if (D > N) {
11039
- const O = `{{${w}}}`, { text: L } = v(I, N, O), T = I.slice(0, N) + L + I.slice(D);
11037
+ const N = _.selectionStart || 0, I = _.value || "", P = _.selectionEnd || N;
11038
+ if (P > N) {
11039
+ const O = `{{${w}}}`, { text: L } = v(I, N, O), T = I.slice(0, N) + L + I.slice(P);
11040
11040
  p(T);
11041
11041
  return;
11042
11042
  }
@@ -11408,10 +11408,10 @@ const PartialWrapper = ({ partialBlockId: o }) => {
11408
11408
  }, I = (L) => {
11409
11409
  const T = { ...n };
11410
11410
  delete T[L], r(T), w(), toast.success(o("Token deleted successfully"));
11411
- }, D = (L) => {
11411
+ }, P = (L) => {
11412
11412
  const T = n[L];
11413
11413
  T && (c(L), y(T.name), k(T.value), i(!1), g(!0));
11414
- }, P = () => {
11414
+ }, D = () => {
11415
11415
  i(!0), c(null), f(""), x(""), A(""), p(!0);
11416
11416
  }, R = () => {
11417
11417
  c(null), y(""), k(""), E(""), g(!1);
@@ -11429,7 +11429,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
11429
11429
  Button,
11430
11430
  {
11431
11431
  variant: "outline",
11432
- onClick: P,
11432
+ onClick: D,
11433
11433
  disabled: a || l !== null,
11434
11434
  size: "sm",
11435
11435
  className: "h-7 text-xs",
@@ -11455,7 +11455,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
11455
11455
  {
11456
11456
  variant: "ghost",
11457
11457
  size: "sm",
11458
- onClick: () => D(L),
11458
+ onClick: () => P(L),
11459
11459
  disabled: a || l !== null,
11460
11460
  className: "h-6 w-6 p-0",
11461
11461
  children: /* @__PURE__ */ jsx(Pencil1Icon, { className: "h-3 w-3" })