@chaibuilder/sdk 3.2.7 → 3.2.8

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 +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 i=e.split(/,(?![^\[]*\])/);if(i.length===1)return{baseClasses:"",classes:i[0].trim()};const[s,...n]=i;return{baseClasses:s.trim(),classes:n.join(",").trim().replace(/ +(?= )/g,"")}},X=e=>{const i=/(?: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 i.test(e)||s.test(e)},G=e=>{if(t.isEmpty(e))return e;const i=/<video[^>]+src=['"]([^'">]+)['"]/,s=/<iframe[^>]+src=['"]([^'">]+)['"]/,n=e.match(i),a=e.match(s),l=n?n[1]:a?a[1]:null,r=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,o=/(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;return l&&(r.test(l)||o.test(l))?l: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,i)=>e.children.length===1&&t.includes(["Heading","Paragraph","Span","ListItem","Button","Label","TableCell","Link","RichText"],i._type),E=e=>e.map(i=>i.type==="text"?t.get(i,"content",""):t.isEmpty(i.children)?"":E(i.children)).join(""),B=e=>e===null?"":e,O=e=>{const i=t.compact(t.map(e.split(/\s+/),t.trim)),s=t.find(i,o=>/^w-/.test(o)),n=t.find(i,o=>/^h-/.test(o));if(!n||!s)return{height:"",width:""};const a=o=>{if(!o)return;const d=o.match(/^[wh]-(?:\[(.*?)\]|(.+))$/);if(!d)return;if(d[1])return d[1];const c=d[2];return/^\d+(\.\d+)?$/.test(c)?`${Number(c)*4}px`:c==="auto"||t.includes(c,"%")?c:"16px"},l=a(s),r=a(n);return{width:t.includes(l,"px")?l:"16px",height:t.includes(r,"px")?r:"16px"}},q=e=>{if(e.tagName==="svg")return{};const i={},s=Z[e.tagName]||{},n=e.attributes;return t.forEach(n,({key:a,value:l})=>{var r;if(!t.includes(M,a))if(a==="bid"&&(i._bid=B(l)),s[a]){if(e.tagName==="img"&&a==="src"&&!l.startsWith("http")){const o=t.find(e.attributes,{key:"width"}),d=t.find(e.attributes,{key:"height"});o&&d?l=`https://picsum.photos/${o==null?void 0:o.value}x${d==null?void 0:d.value}`:l="https://picsum.photos/150x150"}else if(e.tagName==="a"){const o=t.find(e.attributes,{key:"href"});o&&typeof(o==null?void 0:o.value)=="string"&&((r=o==null?void 0:o.value)!=null&&r.startsWith("pageType:"))&&t.set(i,"link.type","pageType")}t.set(i,s[a],B(l))}else t.includes(["style","class","srcset","bid"],a)||(t.has(i,"styles_attrs")||(i.styles_attrs={}),t.startsWith(a,"@")&&(a=a.replace("@","x-on:")),i.styles_attrs[`${a}`]=B(l))}),delete i.class,i},tt=(e,i="styles")=>{if(!e.attributes)return{[i]:`${m},`};const s=t.find(e.attributes,{key:"class"});if(s){const n=s.value;return{[i]:`${m},${n}`}}return{[i]:`${m},`}},et=e=>{const i=t.get(e,"attributes",[]),s=i.find(c=>c.key==="data-chai-richtext"||c.key==="chai-richtext"),n=i.find(c=>c.key==="data-chai-lightbox"||c.key==="chai-lightbox"),a=i.find(c=>c.key==="data-chai-dropdown"||c.key==="chai-dropdown"),l=i.find(c=>c.key==="data-chai-dropdown-button"||c.key==="chai-dropdown-button"),r=i.find(c=>c.key==="data-chai-dropdown-content"||c.key==="chai-dropdown-content"),o=i.find(c=>c.key==="class"),d=o&&o.value.split(/\s+/).includes("rte");if(a)return{_type:"Dropdown"};if(l)return{_type:"DropdownButton"};if(r)return{_type:"DropdownContent"};if(s||d)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,i=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(i&&(n._parent=i.block._id),s.type==="text")return t.isEmpty(t.get(s,"content",""))?[]:i&&Q(i.node,i.block)?(t.set(i,"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"}),y=(u==null?void 0:u.value)||t.startCase(s.tagName.replace("chai-","")).replace(/\s+/g,"");n._type=y,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",[]),l=s.tagName==="p"||a.find(p=>p.key==="data-chai-richtext"||p.key==="chai-richtext"),r=a.find(p=>p.key==="class"),o=r&&r.value.split(/\s+/).includes("rte"),d=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(l||o)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(d){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||[],y=>(y==null?void 0:y.tagName)!=="span");n.content=E(p);const u=t.find(s.children||[],y=>(y==null?void 0:y.tagName)==="span"&&t.some(y.children||[],g=>(g==null?void 0:g.tagName)==="svg"));if(u){const y=t.find(u.children||[],g=>(g==null?void 0:g.tagName)==="svg");if(y){n.icon=k.stringify([y]);const{height:g,width:h}=st(y,"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:y}=O(p);if(u&&y)n.styles=`${m}, ${T.cn(`w-${y} h-${u}`,p)}`.trim(),n.height=u==null?void 0:u.replace("px",""),n.width=y==null?void 0:y.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"&&i&&((R=i.block)==null?void 0:R._type)==="Select")return i.block.options.push({label:E(s.children),...q(s)}),[];const x=w(s.children,{block:n,node:s});return[n,...x]}),st=(e,i,s)=>{var d,c;const n=t.get(e,"attributes",[]),{height:a,width:l}=O(t.get(t.find(n,{key:"class"}),"value",""));if(a&&l)return{height:`[${a}px]`,width:`[${l}px]`};const r=(d=t.find(n,{key:"height"}))==null?void 0:d.value,o=(c=t.find(n,{key:"width"}))==null?void 0:c.value;return{height:r?`[${r}px]`:s,width:o?`[${o}px]`:i}},nt=e=>{e=e.replace(/(\w+)=\\?"(.*?)\\?"/g,(n,a,l)=>{let r=l.replace(/\\"/g,'"');return r=r.replace(/{([^}]+)}/g,o=>o.replace(/"/g,'\\"')),`${a}="${r.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 i=e.match(/<body[^>]*>[\s\S]*?<\/body>/);return(i&&i.length>0?i[0].replace(/<body/,"<div").replace(/<\/body>/,"</div>"):e).replace(/\s+/g," ").replaceAll("> <","><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").trim()},at=(e,i)=>t.find(e,{_id:i}),lt=(e,i)=>t.isEmpty(i)?e.map(s=>(t.unset(s,"_bid"),s)):t.map(e,s=>{const n=t.isEmpty(s._bid)?void 0:at(i,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 i=k.parse(nt(e));return t.isEmpty(e)?[]:t.flatten(w(i))};function rt(e,i,s){const n=t.get(s,"i18nProps",[]);if(t.isEmpty(i)||t.isEmpty(n))return e;const a=t.cloneDeep(e);return t.forEach(t.keys(a),l=>{if(t.includes(n,l)&&!t.isEmpty(i)){const r=t.get(a,l),o=t.get(a,`${l}-${i}`,"");t.isString(r)?a[l]=t.isString(o)&&!t.isEmpty(o.trim())&&o.trimStart()||r:a[l]=t.isEmpty(o)?r:o}}),a}const F=(e,i)=>{const{baseClasses:s,classes:n}=H(e),l=n.split(" ").filter(o=>o.startsWith(v)).map(o=>{var d;return(d=i[o])==null?void 0:d.value}),r=n.split(" ").filter(o=>!o.startsWith(v)).join(" ");return U.twMerge.apply(null,[s,...l,r])};function ct(e,i){return t.get(e,`${i}_attrs`,{})}function pt(e,i=!0,s={}){const n={};return Object.keys(e).forEach(a=>{if(t.isString(e[a])&&e[a].startsWith(m)){const l=F(e[a],s),r=ct(e,a);n[a]={...!t.isEmpty(l)&&{className:l},...r,...i?{"data-style-prop":a,"data-block-parent":e._id,"data-style-id":`${a}-${e._id}`}:{}}}}),n}const ut=t.memoize(e=>{const i=z.getRegisteredChaiBlock(e),s=t.get(i,"schema.properties",{});return Object.fromEntries(Object.entries(s).filter(([,n])=>t.get(n,"runtime",!1)))}),dt=(e,i)=>{if(!t.isArray(e))return e;let s=e,n;return typeof i.limit=="number"&&i.limit>0&&(n=i.limit),n!==void 0&&(s=s.slice(0,n)),s},yt=(e,i)=>{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 l=/\{\{(.*?)\}\}/g,r=a.match(l);r&&r.forEach(o=>{let d=o.slice(2,-2);const c=t.get(i,d,o);a=t.isArray(c)?c:a.replace(o,c)}),s[n]=a}}),s},gt=(e,i)=>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],i)}`}),s}),ht=e=>{const i=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 l=s===i?"":" ";s[n[a]]=`${s[n[a]].trim()}${l}`}return s})},S=(e,i,{index:s,key:n},a)=>{if(t.isString(e)){let l=e;const r=/\{\{(.*?)\}\}/g,o=e.match(r);if(o){const d=a==="image"||a==="mobileImage";o.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(i,b);x===void 0?l=l.replace(c,""):d&&!t.isArray(x)?l=x:l=t.isArray(x)?x:l.replace(c,x)})}return l}if(t.isArray(e))return e.map(l=>S(l,i,{index:s,key:n},a));if(e&&typeof e=="object"){const l={};return t.forEach(t.keys(e),r=>{!t.startsWith(r,"_")&&r!=="$repeaterItemsKey"?l[r]=S(e[r],i,{index:s,key:n},r):l[r]=e[r]}),l}return e},mt=(e,i,{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,i,{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
+ "use strict";const T=require("./common-functions-B3a4xKt_.cjs"),t=require("lodash-es"),V=require("@chaibuilder/runtime"),k=require("himalaya"),U=require("tailwind-merge"),m="#styles:",Y="__ADD_BLOCK_INTERNAL_ROOT",K="@",H="#",v="dt#",M=e=>{if(e=e.replace(m,""),!e)return{baseClasses:"",classes:""};const i=e.split(/,(?![^\[]*\])/);if(i.length===1)return{baseClasses:"",classes:i[0].trim()};const[s,...n]=i;return{baseClasses:s.trim(),classes:n.join(",").trim().replace(/ +(?= )/g,"")}},X=e=>{const i=/(?: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 i.test(e)||s.test(e)},G=e=>{if(t.isEmpty(e))return e;const i=/<video[^>]+src=['"]([^'">]+)['"]/,s=/<iframe[^>]+src=['"]([^'">]+)['"]/,n=e.match(i),a=e.match(s),l=n?n[1]:a?a[1]:null,r=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,o=/(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;return l&&(r.test(l)||o.test(l))?l:e},O=["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,i)=>e.children.length===1&&t.includes(["Heading","Paragraph","Span","ListItem","Button","Label","TableCell","Link","RichText"],i._type),E=e=>e.map(i=>i.type==="text"?t.get(i,"content",""):t.isEmpty(i.children)?"":E(i.children)).join(""),B=e=>e===null?"":e,F=e=>{const i=t.compact(t.map(e.split(/\s+/),t.trim)),s=t.find(i,o=>/^w-/.test(o)),n=t.find(i,o=>/^h-/.test(o));if(!n||!s)return{height:"",width:""};const a=o=>{if(!o)return;const d=o.match(/^[wh]-(?:\[(.*?)\]|(.+))$/);if(!d)return;if(d[1])return d[1];const c=d[2];return/^\d+(\.\d+)?$/.test(c)?`${Number(c)*4}px`:c==="auto"||t.includes(c,"%")?c:"16px"},l=a(s),r=a(n);return{width:t.includes(l,"px")?l:"16px",height:t.includes(r,"px")?r:"16px"}},q=e=>{if(e.tagName==="svg")return{};const i={},s=Z[e.tagName]||{},n=e.attributes;return t.forEach(n,({key:a,value:l})=>{var r;if(!t.includes(O,a))if(a==="bid"&&(i._bid=B(l)),s[a]){if(e.tagName==="img"&&a==="src"&&!l.startsWith("http")){const o=t.find(e.attributes,{key:"width"}),d=t.find(e.attributes,{key:"height"});o&&d?l=`https://picsum.photos/${o==null?void 0:o.value}x${d==null?void 0:d.value}`:l="https://picsum.photos/150x150"}else if(e.tagName==="a"){const o=t.find(e.attributes,{key:"href"});o&&typeof(o==null?void 0:o.value)=="string"&&((r=o==null?void 0:o.value)!=null&&r.startsWith("pageType:"))&&t.set(i,"link.type","pageType")}t.set(i,s[a],B(l))}else t.includes(["style","class","srcset","bid"],a)||(t.has(i,"styles_attrs")||(i.styles_attrs={}),t.startsWith(a,"@")&&(a=a.replace("@","x-on:")),i.styles_attrs[`${a}`]=B(l))}),delete i.class,i},tt=(e,i="styles")=>{if(!e.attributes)return{[i]:`${m},`};const s=t.find(e.attributes,{key:"class"});if(s){const n=s.value;return{[i]:`${m},${n}`}}return{[i]:`${m},`}},et=e=>{const i=t.get(e,"attributes",[]),s=i.find(c=>c.key==="data-chai-richtext"||c.key==="chai-richtext"),n=i.find(c=>c.key==="data-chai-lightbox"||c.key==="chai-lightbox"),a=i.find(c=>c.key==="data-chai-dropdown"||c.key==="chai-dropdown"),l=i.find(c=>c.key==="data-chai-dropdown-button"||c.key==="chai-dropdown-button"),r=i.find(c=>c.key==="data-chai-dropdown-content"||c.key==="chai-dropdown-content"),o=i.find(c=>c.key==="class"),d=o&&o.value.split(/\s+/).includes("rte");if(a)return{_type:"Dropdown"};if(l)return{_type:"DropdownButton"};if(r)return{_type:"DropdownContent"};if(s||d)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,i=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(i&&(n._parent=i.block._id),s.type==="text")return t.isEmpty(t.get(s,"content",""))?[]:i&&Q(i.node,i.block)?(t.set(i,"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"}),y=(u==null?void 0:u.value)||t.startCase(s.tagName.replace("chai-","")).replace(/\s+/g,"");n._type=y,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 z=t.startsWith(h,"_")?h:t.camelCase(h);let f=B(j);typeof f=="string"&&t.startsWith(f,"#styles:")&&(f=f.replace("#styles:","#styles:,")),n[z]=f});const g=w(s.children,{block:n,node:s});return[n,...g]}const a=t.get(s,"attributes",[]),l=s.tagName==="p"||a.find(p=>p.key==="data-chai-richtext"||p.key==="chai-richtext"),r=a.find(p=>p.key==="class"),o=r&&r.value.split(/\s+/).includes("rte"),d=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(O,u.key));p&&(n._name=p.value)}if(l||o)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(d){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||[],y=>(y==null?void 0:y.tagName)!=="span");n.content=E(p);const u=t.find(s.children||[],y=>(y==null?void 0:y.tagName)==="span"&&t.some(y.children||[],g=>(g==null?void 0:g.tagName)==="svg"));if(u){const y=t.find(u.children||[],g=>(g==null?void 0:g.tagName)==="svg");if(y){n.icon=k.stringify([y]);const{height:g,width:h}=st(y,"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:y}=F(p);if(u&&y)n.styles=`${m}, ${T.cn(`w-${y} h-${u}`,p)}`.trim(),n.height=u==null?void 0:u.replace("px",""),n.width=y==null?void 0:y.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"&&i&&((R=i.block)==null?void 0:R._type)==="Select")return i.block.options.push({label:E(s.children),...q(s)}),[];const x=w(s.children,{block:n,node:s});return[n,...x]}),st=(e,i,s)=>{var d,c;const n=t.get(e,"attributes",[]),{height:a,width:l}=F(t.get(t.find(n,{key:"class"}),"value",""));if(a&&l)return{height:`[${a}px]`,width:`[${l}px]`};const r=(d=t.find(n,{key:"height"}))==null?void 0:d.value,o=(c=t.find(n,{key:"width"}))==null?void 0:c.value;return{height:r?`[${r}px]`:s,width:o?`[${o}px]`:i}},nt=e=>{e=e.replace(/(\w+)=\\?"(.*?)\\?"/g,(n,a,l)=>{let r=l.replace(/\\"/g,'"');return r=r.replace(/{([^}]+)}/g,o=>o.replace(/"/g,'\\"')),`${a}="${r.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 i=e.match(/<body[^>]*>[\s\S]*?<\/body>/);return(i&&i.length>0?i[0].replace(/<body/,"<div").replace(/<\/body>/,"</div>"):e).replace(/\s+/g," ").replaceAll("> <","><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").trim()},at=(e,i)=>t.find(e,{_id:i}),lt=(e,i)=>t.isEmpty(i)?e.map(s=>(t.unset(s,"_bid"),s)):t.map(e,s=>{const n=t.isEmpty(s._bid)?void 0:at(i,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 i=k.parse(nt(e));if(t.isEmpty(e))return[];const s=t.flatten(w(i));return V.syncBlocksWithDefaults(s)};function rt(e,i,s){const n=t.get(s,"i18nProps",[]);if(t.isEmpty(i)||t.isEmpty(n))return e;const a=t.cloneDeep(e);return t.forEach(t.keys(a),l=>{if(t.includes(n,l)&&!t.isEmpty(i)){const r=t.get(a,l),o=t.get(a,`${l}-${i}`,"");t.isString(r)?a[l]=t.isString(o)&&!t.isEmpty(o.trim())&&o.trimStart()||r:a[l]=t.isEmpty(o)?r:o}}),a}const J=(e,i)=>{const{baseClasses:s,classes:n}=M(e),l=n.split(" ").filter(o=>o.startsWith(v)).map(o=>{var d;return(d=i[o])==null?void 0:d.value}),r=n.split(" ").filter(o=>!o.startsWith(v)).join(" ");return U.twMerge.apply(null,[s,...l,r])};function ct(e,i){return t.get(e,`${i}_attrs`,{})}function pt(e,i=!0,s={}){const n={};return Object.keys(e).forEach(a=>{if(t.isString(e[a])&&e[a].startsWith(m)){const l=J(e[a],s),r=ct(e,a);n[a]={...!t.isEmpty(l)&&{className:l},...r,...i?{"data-style-prop":a,"data-block-parent":e._id,"data-style-id":`${a}-${e._id}`}:{}}}}),n}const ut=t.memoize(e=>{const i=V.getRegisteredChaiBlock(e),s=t.get(i,"schema.properties",{});return Object.fromEntries(Object.entries(s).filter(([,n])=>t.get(n,"runtime",!1)))}),dt=(e,i)=>{if(!t.isArray(e))return e;let s=e,n;return typeof i.limit=="number"&&i.limit>0&&(n=i.limit),n!==void 0&&(s=s.slice(0,n)),s},yt=(e,i)=>{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 l=/\{\{(.*?)\}\}/g,r=a.match(l);r&&r.forEach(o=>{let d=o.slice(2,-2);const c=t.get(i,d,o);a=t.isArray(c)?c:a.replace(o,c)}),s[n]=a}}),s},gt=(e,i)=>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},${J(s[a],i)}`}),s}),ht=e=>{const i=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 l=s===i?"":" ";s[n[a]]=`${s[n[a]].trim()}${l}`}return s})},S=(e,i,{index:s,key:n},a)=>{if(t.isString(e)){let l=e;const r=/\{\{(.*?)\}\}/g,o=e.match(r);if(o){const d=a==="image"||a==="mobileImage";o.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(i,b);x===void 0?l=l.replace(c,""):d&&!t.isArray(x)?l=x:l=t.isArray(x)?x:l.replace(c,x)})}return l}if(t.isArray(e))return e.map(l=>S(l,i,{index:s,key:n},a));if(e&&typeof e=="object"){const l={};return t.forEach(t.keys(e),r=>{!t.startsWith(r,"_")&&r!=="$repeaterItemsKey"?l[r]=S(e[r],i,{index:s,key:n},r):l[r]=e[r]}),l}return e},mt=(e,i,{index:s,key:n})=>{let a=t.cloneDeep(e);return a.repeaterItems&&(a.$repeaterItemsKey=a.repeaterItems,t.startsWith(a.repeaterItems,`{{${H}`)&&(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,i,{index:s,key:n})};exports.COLLECTION_PREFIX=H;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=M;exports.mergeBlocksWithExisting=lt;
@@ -1,9 +1,9 @@
1
1
  import { g as ct, c as P } from "./common-functions-D2lMFR6K.js";
2
2
  import { isEmpty as x, flatten as pt, flatMapDeep as ut, get as y, set as w, startsWith as k, find as m, startCase as dt, forEach as N, camelCase as yt, includes as T, has as A, filter as Q, some as ht, unset as H, map as st, compact as mt, trim as gt, capitalize as bt, memoize as xt, cloneDeep as M, keys as R, isString as $, isArray as I, each as ft, last as _t } from "lodash-es";
3
- import { parse as kt, stringify as D } from "himalaya";
4
- import { getRegisteredChaiBlock as vt } from "@chaibuilder/runtime";
5
- import { twMerge as wt } from "tailwind-merge";
6
- const f = "#styles:", qt = "__ADD_BLOCK_INTERNAL_ROOT", Mt = "@", Tt = "#", tt = "dt#", at = (e) => {
3
+ import { syncBlocksWithDefaults as kt, getRegisteredChaiBlock as vt } from "@chaibuilder/runtime";
4
+ import { parse as wt, stringify as C } from "himalaya";
5
+ import { twMerge as Tt } from "tailwind-merge";
6
+ const f = "#styles:", Mt = "__ADD_BLOCK_INTERNAL_ROOT", Ot = "@", Bt = "#", tt = "dt#", at = (e) => {
7
7
  if (e = e.replace(f, ""), !e) return { baseClasses: "", classes: "" };
8
8
  const n = e.split(/,(?![^\[]*\])/);
9
9
  if (n.length === 1)
@@ -46,14 +46,14 @@ import.meta.vitest && describe("getSplitChaiClasses", () => {
46
46
  }
47
47
  });
48
48
  });
49
- const Bt = (e) => {
49
+ const Et = (e) => {
50
50
  const n = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, t = /(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;
51
51
  return n.test(e) || t.test(e);
52
- }, Et = (e) => {
52
+ }, $t = (e) => {
53
53
  if (x(e)) return e;
54
54
  const n = /<video[^>]+src=['"]([^'">]+)['"]/, t = /<iframe[^>]+src=['"]([^'">]+)['"]/, s = e.match(n), a = e.match(t), o = s ? s[1] : a ? a[1] : null, i = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, l = /(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;
55
55
  return o && (i.test(o) || l.test(o)) ? o : e;
56
- }, nt = ["chai-name", "data-chai-name"], $t = {
56
+ }, nt = ["chai-name", "data-chai-name"], Nt = {
57
57
  img: { alt: "alt", width: "width", height: "height", src: "image" },
58
58
  video: {
59
59
  src: "url",
@@ -89,7 +89,7 @@ const Bt = (e) => {
89
89
  form: {
90
90
  action: "action"
91
91
  }
92
- }, Nt = (e, n) => e.children.length === 1 && T(
92
+ }, St = (e, n) => e.children.length === 1 && T(
93
93
  ["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link", "RichText"],
94
94
  n._type
95
95
  ), j = (e) => e.map((n) => n.type === "text" ? y(n, "content", "") : x(n.children) ? "" : j(n.children)).join(""), W = (e) => e === null ? "" : e, ot = (e) => {
@@ -109,7 +109,7 @@ const Bt = (e) => {
109
109
  };
110
110
  }, et = (e) => {
111
111
  if (e.tagName === "svg") return {};
112
- const n = {}, t = $t[e.tagName] || {}, s = e.attributes;
112
+ const n = {}, t = Nt[e.tagName] || {}, s = e.attributes;
113
113
  return N(s, ({ key: a, value: o }) => {
114
114
  var i;
115
115
  if (!T(nt, a))
@@ -124,7 +124,7 @@ const Bt = (e) => {
124
124
  w(n, t[a], W(o));
125
125
  } else T(["style", "class", "srcset", "bid"], a) || (A(n, "styles_attrs") || (n.styles_attrs = {}), k(a, "@") && (a = a.replace("@", "x-on:")), n.styles_attrs[`${a}`] = W(o));
126
126
  }), delete n.class, n;
127
- }, St = (e, n = "styles") => {
127
+ }, It = (e, n = "styles") => {
128
128
  if (!e.attributes) return { [n]: `${f},` };
129
129
  const t = m(e.attributes, { key: "class" });
130
130
  if (t) {
@@ -132,7 +132,7 @@ const Bt = (e) => {
132
132
  return { [n]: `${f},${s}` };
133
133
  }
134
134
  return { [n]: `${f},` };
135
- }, It = (e) => {
135
+ }, Dt = (e) => {
136
136
  const n = y(e, "attributes", []), t = n.find((r) => r.key === "data-chai-richtext" || r.key === "chai-richtext"), s = n.find((r) => r.key === "data-chai-lightbox" || r.key === "chai-lightbox"), a = n.find((r) => r.key === "data-chai-dropdown" || r.key === "chai-dropdown"), o = n.find(
137
137
  (r) => r.key === "data-chai-dropdown-button" || r.key === "chai-dropdown-button"
138
138
  ), i = n.find(
@@ -239,7 +239,7 @@ const Bt = (e) => {
239
239
  if (t.type === "comment") return [];
240
240
  let s = { _id: ct() };
241
241
  if (n && (s._parent = n.block._id), t.type === "text")
242
- return x(y(t, "content", "")) ? [] : n && Nt(n.node, n.block) ? (w(n, "block.content", y(t, "content", "")), []) : { ...s, _type: "Text", content: y(t, "content", "") };
242
+ return x(y(t, "content", "")) ? [] : n && St(n.node, n.block) ? (w(n, "block.content", y(t, "content", "")), []) : { ...s, _type: "Text", content: y(t, "content", "") };
243
243
  if (k(t.tagName, "chai-")) {
244
244
  const c = t.attributes, p = m(c, { key: "chai-type" }), d = (p == null ? void 0 : p.value) || dt(t.tagName.replace("chai-", "")).replace(/\s+/g, "");
245
245
  s._type = d, N(c, ({ key: g, value: G }) => {
@@ -261,20 +261,20 @@ const Bt = (e) => {
261
261
  (c) => c.key === "data-chai-dropdown" || c.key === "chai-dropdown"
262
262
  ), B = a.find(
263
263
  (c) => c.key === "data-chai-dropdown-button" || c.key === "chai-dropdown-button"
264
- ), C = a.find(
264
+ ), D = a.find(
265
265
  (c) => c.key === "data-chai-dropdown-content" || c.key === "chai-dropdown-content"
266
266
  );
267
267
  if (s = {
268
268
  ...s,
269
- ...It(t),
269
+ ...Dt(t),
270
270
  ...et(t),
271
- ...St(t)
271
+ ...It(t)
272
272
  }, t.attributes) {
273
273
  const c = t.attributes.find((p) => T(nt, p.key));
274
274
  c && (s._name = c.value);
275
275
  }
276
276
  if (o || l)
277
- 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];
277
+ return s.content = `<p>${C(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];
278
278
  if (u) {
279
279
  const c = [
280
280
  "data-chai-lightbox",
@@ -298,7 +298,7 @@ const Bt = (e) => {
298
298
  A(s, `styles_attrs.${p}`) && delete s.styles_attrs[p];
299
299
  });
300
300
  }
301
- if (r && (delete s.styles_attrs, s.showDropdown = !1), C && delete s.styles_attrs, B) {
301
+ if (r && (delete s.styles_attrs, s.showDropdown = !1), D && delete s.styles_attrs, B) {
302
302
  delete s.styles_attrs;
303
303
  const c = Q(t.children || [], (d) => (d == null ? void 0 : d.tagName) !== "span");
304
304
  s.content = j(c);
@@ -309,7 +309,7 @@ const Bt = (e) => {
309
309
  if (p) {
310
310
  const d = m(p.children || [], (h) => (h == null ? void 0 : h.tagName) === "svg");
311
311
  if (d) {
312
- s.icon = D([d]);
312
+ s.icon = C([d]);
313
313
  const { height: h, width: g } = Ct(d, "16px", "16px");
314
314
  s.iconHeight = h, s.iconWidth = g;
315
315
  }
@@ -320,8 +320,8 @@ const Bt = (e) => {
320
320
  const c = s.inputType || "text";
321
321
  c === "checkbox" ? w(s, "_type", "Checkbox") : c === "radio" && w(s, "_type", "Radio");
322
322
  } else if (t.tagName === "video" || t.tagName === "iframe") {
323
- const c = D([t]);
324
- return Bt(c) && (w(s, "_type", "Video"), w(s, "url", Et(c)), w(s, "styles", `${f},`), w(s, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), s.content = c, [s];
323
+ const c = C([t]);
324
+ return Et(c) && (w(s, "_type", "Video"), w(s, "url", $t(c)), w(s, "styles", `${f},`), w(s, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), s.content = c, [s];
325
325
  } else if (t.tagName === "svg") {
326
326
  const c = y(m(t.attributes, { key: "class" }), "value", ""), { height: p, width: d } = ot(c);
327
327
  if (p && d)
@@ -330,7 +330,7 @@ const Bt = (e) => {
330
330
  const h = (K = m(t.attributes, { key: "height" })) == null ? void 0 : K.value, g = (X = m(t.attributes, { key: "width" })) == null ? void 0 : X.value;
331
331
  h && g ? (s.styles = `${f}, ${P(`w-[${g}px] h-[${h}px]`, c)}`.trim(), s.height = h, s.width = g) : s.styles = `${f}, ${P("w-full h-full", c)}`.trim();
332
332
  }
333
- return t.attributes = Q(t.attributes, (h) => !T(["style", "width", "height", "class"], h.key)), s.icon = D([t]), [s];
333
+ return t.attributes = Q(t.attributes, (h) => !T(["style", "width", "height", "class"], h.key)), s.icon = C([t]), [s];
334
334
  } else if (t.tagName == "option" && n && ((Z = n.block) == null ? void 0 : Z._type) === "Select")
335
335
  return n.block.options.push({
336
336
  label: j(t.children),
@@ -353,26 +353,28 @@ const Bt = (e) => {
353
353
  height: i ? `[${i}px]` : t,
354
354
  width: l ? `[${l}px]` : n
355
355
  };
356
- }, Dt = (e) => {
356
+ }, Lt = (e) => {
357
357
  e = e.replace(/(\w+)=\\?"(.*?)\\?"/g, (s, a, o) => {
358
358
  let i = o.replace(/\\"/g, '"');
359
359
  return i = i.replace(/{([^}]+)}/g, (l) => l.replace(/"/g, '\\"')), `${a}="${i.replace(/\\"/g, '"')}"`;
360
360
  }), e = e.replace(/\\n/g, "").replace(/\\\\/g, "").replace(/\\([/<>])/g, "$1").replace(/\\./g, "").replace(/[\n\r\t\f\v]/g, ""), e = e.replace(/\$name="[^"]*"/g, "");
361
361
  const n = e.match(/<body[^>]*>[\s\S]*?<\/body>/);
362
362
  return (n && n.length > 0 ? n[0].replace(/<body/, "<div").replace(/<\/body>/, "</div>") : e).replace(/\s+/g, " ").replaceAll("> <", "><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").trim();
363
- }, Lt = (e, n) => m(e, { _id: n }), Ot = (e, n) => x(n) ? e.map((t) => (H(t, "_bid"), t)) : st(e, (t) => {
364
- const s = x(t._bid) ? void 0 : Lt(n, t._bid);
363
+ }, At = (e, n) => m(e, { _id: n }), Vt = (e, n) => x(n) ? e.map((t) => (H(t, "_bid"), t)) : st(e, (t) => {
364
+ const s = x(t._bid) ? void 0 : At(n, t._bid);
365
365
  if (s) {
366
366
  s._type === "Icon" && y(t, "icon", "").match(/chai-default-svg/) && delete t.icon;
367
367
  const a = { ...s, ...t };
368
368
  return H(a, "_bid"), a;
369
369
  }
370
370
  return H(t, "_bid"), t;
371
- }), Vt = (e) => {
372
- const n = kt(Dt(e));
373
- return x(e) ? [] : pt(q(n));
371
+ }), Jt = (e) => {
372
+ const n = wt(Lt(e));
373
+ if (x(e)) return [];
374
+ const t = pt(q(n));
375
+ return kt(t);
374
376
  };
375
- function Jt(e, n, t) {
377
+ function zt(e, n, t) {
376
378
  const s = y(t, "i18nProps", []);
377
379
  if (x(n) || x(s)) return e;
378
380
  const a = M(e);
@@ -388,16 +390,16 @@ const lt = (e, n) => {
388
390
  var u;
389
391
  return (u = n[l]) == null ? void 0 : u.value;
390
392
  }), i = s.split(" ").filter((l) => !l.startsWith(tt)).join(" ");
391
- return wt.apply(null, [t, ...o, i]);
393
+ return Tt.apply(null, [t, ...o, i]);
392
394
  };
393
- function At(e, n) {
395
+ function Wt(e, n) {
394
396
  return y(e, `${n}_attrs`, {});
395
397
  }
396
- function zt(e, n = !0, t = {}) {
398
+ function Ft(e, n = !0, t = {}) {
397
399
  const s = {};
398
400
  return Object.keys(e).forEach((a) => {
399
401
  if ($(e[a]) && e[a].startsWith(f)) {
400
- const o = lt(e[a], t), i = At(e, a);
402
+ const o = lt(e[a], t), i = Wt(e, a);
401
403
  s[a] = {
402
404
  ...!x(o) && { className: o },
403
405
  ...i,
@@ -410,14 +412,14 @@ function zt(e, n = !0, t = {}) {
410
412
  }
411
413
  }), s;
412
414
  }
413
- const Ft = xt((e) => {
415
+ const Ut = xt((e) => {
414
416
  const n = vt(e), t = y(n, "schema.properties", {});
415
417
  return Object.fromEntries(Object.entries(t).filter(([, s]) => y(s, "runtime", !1)));
416
- }), Ut = (e, n) => {
418
+ }), Yt = (e, n) => {
417
419
  if (!I(e)) return e;
418
420
  let t = e, s;
419
421
  return typeof n.limit == "number" && n.limit > 0 && (s = n.limit), s !== void 0 && (t = t.slice(0, s)), t;
420
- }, Yt = (e, n) => {
422
+ }, Kt = (e, n) => {
421
423
  const t = M(e);
422
424
  return N(R(t), (s) => {
423
425
  if ($(t[s]) && !k(s, "_")) {
@@ -629,8 +631,8 @@ const b = (e, n, { index: t, key: s }, a) => {
629
631
  if (l) {
630
632
  const u = a === "image" || a === "mobileImage";
631
633
  l.forEach((r) => {
632
- let B = r.slice(2, -2).trim(), C = s.slice(2, -2).trim();
633
- t !== -1 && k(B, "$index.") ? B = `${C}.${t}.${B.slice(7)}` : t !== -1 && k(B, "$index") && (B = `${C}.${t}`);
634
+ let B = r.slice(2, -2).trim(), D = s.slice(2, -2).trim();
635
+ t !== -1 && k(B, "$index.") ? B = `${D}.${t}.${B.slice(7)}` : t !== -1 && k(B, "$index") && (B = `${D}.${t}`);
634
636
  const E = y(n, B);
635
637
  E === void 0 ? o = o.replace(r, "") : u && !I(E) ? o = E : o = I(E) ? E : o.replace(r, E);
636
638
  });
@@ -648,7 +650,7 @@ const b = (e, n, { index: t, key: s }, a) => {
648
650
  return e;
649
651
  }, L = (e, n, { index: t, key: s }) => {
650
652
  let a = M(e);
651
- return a.repeaterItems && (a.$repeaterItemsKey = a.repeaterItems, k(a.repeaterItems, `{{${Tt}`) && (a.$repeaterItemsKey = a.repeaterItems = `${a.repeaterItems.replace("}}", `/${a._id}}}`)}`), !x(a.repeaterItems) && a.pagination && (a.repeaterTotalItems = `${a.repeaterItems.replace("}}", `/${a._id}/totalItems}}`)}`)), b(a, n, { index: t, key: s });
653
+ return a.repeaterItems && (a.$repeaterItemsKey = a.repeaterItems, k(a.repeaterItems, `{{${Bt}`) && (a.$repeaterItemsKey = a.repeaterItems = `${a.repeaterItems.replace("}}", `/${a._id}}}`)}`), !x(a.repeaterItems) && a.pagination && (a.repeaterTotalItems = `${a.repeaterItems.replace("}}", `/${a._id}/totalItems}}`)}`)), b(a, n, { index: t, key: s });
652
654
  };
653
655
  import.meta.vitest && (describe("applyBindingToValue", () => {
654
656
  it("should handle string values with bindings", () => {
@@ -822,20 +824,20 @@ import.meta.vitest && (describe("applyBindingToValue", () => {
822
824
  });
823
825
  }));
824
826
  export {
825
- Tt as C,
827
+ Bt as C,
826
828
  tt as D,
827
- Mt as R,
829
+ Ot as R,
828
830
  f as S,
829
831
  L as a,
830
- Jt as b,
831
- Ft as c,
832
- Ut as d,
832
+ zt as b,
833
+ Ut as c,
834
+ Yt as d,
833
835
  v as e,
834
- Yt as f,
835
- zt as g,
836
- Vt as h,
836
+ Kt as f,
837
+ Ft as g,
838
+ Jt as h,
837
839
  _ as i,
838
840
  at as j,
839
- qt as k,
840
- Ot as m
841
+ Mt as k,
842
+ Vt as m
841
843
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("./index-BVbLLob7.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-CuANr9iH.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-H6m-0wVZ.js";
2
+ import { u as C, a as k, b as v, c as g } from "./index-DvdOXKUE.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-BVbLLob7.cjs"),s=require("./common-functions-B3a4xKt_.cjs"),a=require("./apply-binding-DWIWrG2P.cjs"),i=require("react-i18next"),l=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.useActiveSettingsTab=e.useActiveSettingsTab;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:()=>i.useTranslation});exports.i18n=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CuANr9iH.cjs"),s=require("./common-functions-B3a4xKt_.cjs"),a=require("./apply-binding-Bn1KC8uC.cjs"),i=require("react-i18next"),l=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.useActiveSettingsTab=e.useActiveSettingsTab;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:()=>i.useTranslation});exports.i18n=l;
package/dist/core.js CHANGED
@@ -1,6 +1,6 @@
1
- import { j as e, A as i, f as o, 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 g, I as k, L as n, g as h, T as S, U as p, h as m, z as P, P as A, n as F, o as T, p as b, q as I, r as M, F as v, G as y, 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, X as j, aD as q, Y as G, Z as V, _ as Z, aF as J, aE as K, $ as N, H as Q, J as X, u as Y, a0 as _, a1 as $, a2 as aa, a3 as sa, a4 as ea, a5 as ia, a6 as oa, a7 as la, a8 as ra, a9 as ta, aa as ua, ab as ca, ac as da, M as Ca, ad as Ba, ae as ga, af as ka, ag as na, ah as ha, ai as Sa, aj as pa, ak as ma, al as Pa, am as Aa, an as Fa, ao as Ta, ap as ba, aG as Ia, aq as Ma, ar as va, as as ya, a as La, at as fa, au as Ha, aH as Ra, av as Da, aI as Ea, aw as Ua, ax as xa, ay as Wa, az as Oa, aA as wa, K as za, aB as ja, b as qa, c as Ga, aC as Va } from "./index-H6m-0wVZ.js";
2
- import { g as Ja, c as Ka } from "./common-functions-D2lMFR6K.js";
3
- import { h as Qa, h as Xa } from "./apply-binding-IFVE37dG.js";
1
+ import { q as e, A as i, l as o, s as l, B as r, k as t, C as u, p as c, D as d, t as C, v as B, E as g, I as k, L as n, m as h, T as S, U as p, n as m, Q as P, Z as A, w as F, y as T, z as b, F as I, x as M, R as v, S as y, H as L, J as H, G as R, K as f, O as D, P as E, _ as U, $ as x, a0 as W, a1 as O, a2 as w, a3 as z, g as j, aI as q, a4 as G, h as J, a5 as K, aK as N, aJ as V, a6 as Z, V as Q, W as X, u as Y, a7 as _, a8 as $, a9 as aa, aa as sa, ab as ea, ac as ia, ad as oa, ae as la, af as ra, ag as ta, ah as ua, i as ca, ai as da, Y as Ca, aj as Ba, ak as ga, al as ka, am as na, an as ha, ao as Sa, ap as pa, aq as ma, ar as Pa, as as Aa, at as Fa, au as Ta, j as ba, aL as Ia, av as Ma, aw as va, ax as ya, a as La, ay as Ha, az as Ra, aM as fa, aA as Da, aN as Ea, aB as Ua, aC as xa, aD as Wa, aE as Oa, aF as wa, X as za, aG as ja, b as qa, c as Ga, aH as Ja } from "./index-DvdOXKUE.js";
2
+ import { g as Na, c as Va } from "./common-functions-D2lMFR6K.js";
3
+ import { h as Qa, h as Xa } from "./apply-binding-DLaiD20q.js";
4
4
  import { useTranslation as _a } from "react-i18next";
5
5
  import { default as as } from "i18next";
6
6
  export {
@@ -25,11 +25,11 @@ export {
25
25
  P as IfChaiFeatureFlag,
26
26
  A as PERMISSIONS,
27
27
  Qa as convertHTMLToChaiBlocks,
28
- Ja as generateBlockId,
28
+ Na as generateBlockId,
29
29
  Xa as getBlocksFromHTML,
30
30
  F as getClassValueAndUnit,
31
31
  as as i18n,
32
- Ka as mergeClasses,
32
+ Va as mergeClasses,
33
33
  T as registerBlockSettingField,
34
34
  b as registerBlockSettingTemplate,
35
35
  I as registerBlockSettingWidget,
@@ -37,9 +37,9 @@ export {
37
37
  v as registerChaiFeatureFlag,
38
38
  y as registerChaiFeatureFlags,
39
39
  L as registerChaiLibrary,
40
- f as registerChaiMediaManager,
41
- H as registerChaiPreImportHTMLHook,
42
- R as registerChaiSaveToLibrary,
40
+ H as registerChaiMediaManager,
41
+ R as registerChaiPreImportHTMLHook,
42
+ f as registerChaiSaveToLibrary,
43
43
  D as registerChaiSidebarPanel,
44
44
  E as registerChaiTopBar,
45
45
  U as useActiveSettingsTab,
@@ -51,11 +51,11 @@ export {
51
51
  j as useBlocksStore,
52
52
  q as useBlocksStoreUndoableActions,
53
53
  G as useBrandingOptions,
54
- V as useBuilderProp,
55
- Z as useBuilderReset,
56
- J as useCanvasDisplayWidth,
57
- K as useCanvasWidth,
58
- N as useCanvasZoom,
54
+ J as useBuilderProp,
55
+ K as useBuilderReset,
56
+ N as useCanvasDisplayWidth,
57
+ V as useCanvasWidth,
58
+ Z as useCanvasZoom,
59
59
  Q as useChaiFeatureFlag,
60
60
  X as useChaiFeatureFlags,
61
61
  Y as useCodeEditor,
@@ -91,9 +91,9 @@ export {
91
91
  va as useSelectedBlockAllClasses,
92
92
  ya as useSelectedBlockCurrentClasses,
93
93
  La as useSelectedBlockIds,
94
- fa as useSelectedBlocksDisplayChild,
95
- Ha as useSelectedBreakpoints,
96
- Ra as useSelectedLibrary,
94
+ Ha as useSelectedBlocksDisplayChild,
95
+ Ra as useSelectedBreakpoints,
96
+ fa as useSelectedLibrary,
97
97
  Da as useSelectedStylingBlocks,
98
98
  Ea as useSidebarActivePanel,
99
99
  Ua as useStreamMultipleBlocksProps,
@@ -106,5 +106,5 @@ export {
106
106
  ja as useUndoManager,
107
107
  qa as useUpdateBlocksProps,
108
108
  Ga as useUpdateBlocksPropsRealtime,
109
- Va as useWrapperBlock
109
+ Ja as useWrapperBlock
110
110
  };
@@ -0,0 +1,40 @@
1
+ import { jsxs as e, jsx as t } from "react/jsx-runtime";
2
+ import { g as i, q as n, j as c, m as d, p as m, k as h, l as g, i as u, h as x } from "./tooltip-DUosa-uC.js";
3
+ import { useTranslation as p } from "react-i18next";
4
+ const N = ({ tokenName: l, tokenValue: s, onDelete: a, children: o }) => {
5
+ const { t: r } = p();
6
+ return /* @__PURE__ */ e(i, { children: [
7
+ /* @__PURE__ */ t(n, { asChild: !0, children: o }),
8
+ /* @__PURE__ */ e(c, { className: "max-w-md", children: [
9
+ /* @__PURE__ */ e(d, { children: [
10
+ /* @__PURE__ */ e(m, { className: "text-base", children: [
11
+ r("Delete"),
12
+ ' "',
13
+ l,
14
+ '"?'
15
+ ] }),
16
+ /* @__PURE__ */ t(h, { asChild: !0, children: /* @__PURE__ */ e("div", { className: "space-y-3 pt-1 text-sm", children: [
17
+ /* @__PURE__ */ t("p", { className: "text-muted-foreground", children: r("This action cannot be undone. This will permanently remove the design token from your project.") }),
18
+ /* @__PURE__ */ e("div", { className: "rounded-md border bg-muted/50 p-3", children: [
19
+ /* @__PURE__ */ t("p", { className: "mb-1 text-xs font-medium text-foreground", children: r("Token classes") }),
20
+ /* @__PURE__ */ t("p", { className: "font-mono text-xs text-muted-foreground", children: s })
21
+ ] })
22
+ ] }) })
23
+ ] }),
24
+ /* @__PURE__ */ e(g, { children: [
25
+ /* @__PURE__ */ t(u, { className: "h-7 text-xs", children: r("Cancel") }),
26
+ /* @__PURE__ */ t(
27
+ x,
28
+ {
29
+ onClick: a,
30
+ className: "h-7 bg-destructive text-xs text-destructive-foreground hover:bg-destructive/90",
31
+ children: r("Delete")
32
+ }
33
+ )
34
+ ] })
35
+ ] })
36
+ ] });
37
+ };
38
+ export {
39
+ N as default
40
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./tooltip-Ba1-8jmj.cjs"),i=require("react-i18next"),a=({tokenName:r,tokenValue:l,onDelete:n,children:o})=>{const{t:s}=i.useTranslation();return e.jsxs(t.AlertDialog,{children:[e.jsx(t.AlertDialogTrigger,{asChild:!0,children:o}),e.jsxs(t.AlertDialogContent,{className:"max-w-md",children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsxs(t.AlertDialogTitle,{className:"text-base",children:[s("Delete"),' "',r,'"?']}),e.jsx(t.AlertDialogDescription,{asChild:!0,children:e.jsxs("div",{className:"space-y-3 pt-1 text-sm",children:[e.jsx("p",{className:"text-muted-foreground",children:s("This action cannot be undone. This will permanently remove the design token from your project.")}),e.jsxs("div",{className:"rounded-md border bg-muted/50 p-3",children:[e.jsx("p",{className:"mb-1 text-xs font-medium text-foreground",children:s("Token classes")}),e.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:l})]})]})})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{className:"h-7 text-xs",children:s("Cancel")}),e.jsx(t.AlertDialogAction,{onClick:n,className:"h-7 bg-destructive text-xs text-destructive-foreground hover:bg-destructive/90",children:s("Delete")})]})]})]})};exports.default=a;