@chaibuilder/sdk 4.0.0-beta.1 → 4.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/README.md +27 -20
  2. package/dist/2SSKDMRQ-BnsZi3K3.cjs +1 -0
  3. package/dist/2SSKDMRQ-CnSDkQcy.js +42 -0
  4. package/dist/AP7HFJJL-B31839PG.cjs +1228 -0
  5. package/dist/AP7HFJJL-CymCmW14.js +9214 -0
  6. package/dist/IconPicker-B1rWC-Ex.js +59 -0
  7. package/dist/IconPicker-DREyo007.cjs +1 -0
  8. package/dist/WDYDFRGG-BUVnbAci.js +33 -0
  9. package/dist/WDYDFRGG-BxhOCHc3.cjs +1 -0
  10. package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
  11. package/dist/_commonjsHelpers-DwGv2jUC.cjs +1 -0
  12. package/dist/actions-registery-CZ1w0NKa.js +15545 -0
  13. package/dist/actions-registery-YnFmU21O.cjs +418 -0
  14. package/dist/actions.cjs +1 -0
  15. package/dist/actions.d.ts +3202 -0
  16. package/dist/actions.js +216 -0
  17. package/dist/active-in-another-tab-B47YjQGN.cjs +1 -0
  18. package/dist/active-in-another-tab-CyjngVA6.js +34 -0
  19. package/dist/add-new-language-page-88xzrUy8.cjs +1 -0
  20. package/dist/add-new-language-page-WmlCnytQ.js +401 -0
  21. package/dist/add-new-page-VW2wAYZp.js +31 -0
  22. package/dist/add-new-page-soZ8GAkN.cjs +1 -0
  23. package/dist/ai-panel-content-7zCil042.cjs +1 -0
  24. package/dist/ai-panel-content-D_o7Q_A-.js +61 -0
  25. package/dist/ai-panel-default-lang-COYaxNwn.cjs +3 -0
  26. package/dist/ai-panel-default-lang-DnElspF0.js +341 -0
  27. package/dist/ai-panel-other-lang-CkynNlAU.cjs +1 -0
  28. package/dist/ai-panel-other-lang-Dp0E9_Hx.js +162 -0
  29. package/dist/ai-prompt-input-Bhc0ds7X.js +655 -0
  30. package/dist/ai-prompt-input-CThbVp0_.cjs +1 -0
  31. package/dist/ai-translation-prompt-C2kJQFDX.cjs +1 -0
  32. package/dist/ai-translation-prompt-CZ55HQmo.js +28 -0
  33. package/dist/apply-binding-6iwlED02.js +833 -0
  34. package/dist/apply-binding-KKp5PnpZ.cjs +1 -0
  35. package/dist/code-display-BnqzqzoP.cjs +1 -0
  36. package/dist/{code-display-337R7Dev.js → code-display-DhD_RBcg.js} +1 -1
  37. package/dist/code-editor-DRIAnNbb.js +50 -0
  38. package/dist/code-editor-o3___nu2.cjs +1 -0
  39. package/dist/common-functions-B3a4xKt_.cjs +1 -0
  40. package/dist/common-functions-D2lMFR6K.js +13 -0
  41. package/dist/continue-editing-in-this-client-CS2aQ7yY.js +24 -0
  42. package/dist/continue-editing-in-this-client-CtMYsk-A.cjs +1 -0
  43. package/dist/core-BoRDjj4h.cjs +1 -0
  44. package/dist/core-yvI6kCyw.js +56 -0
  45. package/dist/core.cjs +1 -1
  46. package/dist/core.d.ts +51 -383
  47. package/dist/core.js +39 -106
  48. package/dist/{css-import-modal-DA2L6kwP.js → css-import-modal-Byg6wV0O.js} +36 -36
  49. package/dist/css-import-modal-CyqkXWCO.cjs +13 -0
  50. package/dist/delete-design-token-BRZZiWtQ.js +40 -0
  51. package/dist/delete-design-token-DkVs1oBf.cjs +1 -0
  52. package/dist/delete-page-BzyX9TN-.js +70 -0
  53. package/dist/delete-page-DxX7PFIE.cjs +1 -0
  54. package/dist/design-token-usage-CAHzEGgJ.cjs +1 -0
  55. package/dist/design-token-usage-xQs6SlaJ.js +113 -0
  56. package/dist/digital-asset-manager--uO8Agia.cjs +1 -0
  57. package/dist/digital-asset-manager-DbtwzxRz.js +876 -0
  58. package/dist/duplicate-page-BR7Dlo9d.js +133 -0
  59. package/dist/duplicate-page-CaNAbXwV.cjs +1 -0
  60. package/dist/dynamic-page-selector-Cb5r_W8s.js +85 -0
  61. package/dist/dynamic-page-selector-Cxk_gjni.cjs +1 -0
  62. package/dist/fonts-B-Xt29pe.cjs +1 -0
  63. package/dist/fonts-DRly3Wzd.js +78 -0
  64. package/dist/{get-chai-builder-tailwind-config-C6MHaUM0.cjs → get-chai-builder-tailwind-config-B9rCyiQo.cjs} +1 -1
  65. package/dist/{get-chai-builder-tailwind-config-BqaIvg8p.js → get-chai-builder-tailwind-config-DjoVOuAf.js} +13 -10
  66. package/dist/{get-chai-builder-theme-D0IsUvK4.js → get-chai-builder-theme-BYtp20KD.js} +4 -4
  67. package/dist/get-chai-builder-theme-Dl72X7cz.cjs +1 -0
  68. package/dist/get-seo-defaults-9zHebckY.js +65 -0
  69. package/dist/get-seo-defaults-Cw7vFt-B.cjs +1 -0
  70. package/dist/image-compression-DZ9WMmyn.cjs +1 -0
  71. package/dist/image-compression-DsZ1oqpb.js +37 -0
  72. package/dist/image-editor-DV8kUKhl.js +108 -0
  73. package/dist/image-editor-G-K28aTS.cjs +1 -0
  74. package/dist/index-B-rSiAp_.cjs +1 -0
  75. package/dist/index-Ct7ElCGK.js +19069 -0
  76. package/dist/index-DF5DEvqb.cjs +160 -0
  77. package/dist/index-Dxfyt4d4.js +39 -0
  78. package/dist/index-WQwzsC7A.cjs +5 -0
  79. package/dist/index-ZuacEL1j.js +4732 -0
  80. package/dist/json-diff-viewer-D7z4zNvv.cjs +8 -0
  81. package/dist/json-diff-viewer-krslPepD.js +258 -0
  82. package/dist/lang-panel-BwIewMyw.js +215 -0
  83. package/dist/lang-panel-DT96k1xg.cjs +1 -0
  84. package/dist/manage-design-tokens-Caz_20VK.js +240 -0
  85. package/dist/manage-design-tokens-CrmLe7UT.cjs +1 -0
  86. package/dist/mark-as-template-D295ZQtU.js +156 -0
  87. package/dist/mark-as-template-W3LmpiqN.cjs +1 -0
  88. package/dist/models-5gOsRC56.cjs +1 -0
  89. package/dist/models-D95ZYr_x.js +70 -0
  90. package/dist/nested-path-selector-content-CKYYK-C5.js +87 -0
  91. package/dist/nested-path-selector-content-CoS_d3dc.cjs +1 -0
  92. package/dist/no-language-page-content-BvqRBP6y.js +42 -0
  93. package/dist/no-language-page-content-DkfeMl90.cjs +1 -0
  94. package/dist/no-language-page-dialog-BcEoqyQB.cjs +1 -0
  95. package/dist/no-language-page-dialog-PjNqTUpl.js +10 -0
  96. package/dist/page-creator-C4gc5NSC.cjs +1 -0
  97. package/dist/page-creator-DiOITEMw.js +795 -0
  98. package/dist/page-lock-BdYmCks0.cjs +1 -0
  99. package/dist/page-lock-Bfbs6RgL.js +30 -0
  100. package/dist/page-locked-dialog-B1FAtK92.cjs +1 -0
  101. package/dist/page-locked-dialog-B6MKTRfY.js +133 -0
  102. package/dist/page-manager-new-CHDueBDk.cjs +1 -0
  103. package/dist/page-manager-new-CzX22g2n.js +394 -0
  104. package/dist/page-manager-search-and-filter-CM0UMb6U.js +201 -0
  105. package/dist/page-manager-search-and-filter-DkkRIH86.cjs +1 -0
  106. package/dist/page-revisions-content-ChY-4f2V.cjs +1 -0
  107. package/dist/page-revisions-content-NH9JK4Ey.js +445 -0
  108. package/dist/pages.cjs +1 -0
  109. package/dist/pages.d.ts +491 -0
  110. package/dist/pages.js +27 -0
  111. package/dist/plugin-3ZKK6RXm.js +245 -0
  112. package/dist/plugin-C6rgJDNQ.cjs +22 -0
  113. package/dist/publish-pages-content-D9aixMN5.js +178 -0
  114. package/dist/publish-pages-content-x-JuSFJ9.cjs +1 -0
  115. package/dist/register-partial-type-BjtdfKHE.js +36 -0
  116. package/dist/register-partial-type-ig9fUWIJ.cjs +1 -0
  117. package/dist/render.cjs +2 -2
  118. package/dist/render.d.ts +26 -13
  119. package/dist/render.js +130 -124
  120. package/dist/rte-widget-modal-BaHIuEjF.cjs +1 -0
  121. package/dist/rte-widget-modal-DOJEXLIf.js +38 -0
  122. package/dist/runtime.cjs +1 -1
  123. package/dist/runtime.d.ts +306 -7
  124. package/dist/runtime.js +44 -1
  125. package/dist/save-to-lib-Cgpxw8-g.cjs +1 -0
  126. package/dist/save-to-lib-eiOc_SSN.js +422 -0
  127. package/dist/sdk.css +1 -1
  128. package/dist/selected-block-display-BgRY82CT.cjs +16 -0
  129. package/dist/selected-block-display-CBFePS19.js +319 -0
  130. package/dist/seo-panel-C1-iMOR1.js +798 -0
  131. package/dist/seo-panel-DfAb8U7W.cjs +2 -0
  132. package/dist/shared-json-ld-B4PxAM_0.js +565 -0
  133. package/dist/shared-json-ld-DzG398hr.cjs +1 -0
  134. package/dist/slug-input-AwNJs9im.js +86 -0
  135. package/dist/slug-input-C_ijLQ_X.cjs +1 -0
  136. package/dist/supabase-actions.cjs +1 -0
  137. package/dist/supabase-actions.d.ts +284 -0
  138. package/dist/supabase-actions.js +524 -0
  139. package/dist/take-over-request-BNxcjY2j.cjs +1 -0
  140. package/dist/take-over-request-C4FeDtN_.js +63 -0
  141. package/dist/theme-panel-footer-Cq9pljro.cjs +1 -0
  142. package/dist/theme-panel-footer-uBQqSJXm.js +25 -0
  143. package/dist/translation-warning-modal-B64YqlbI.js +26 -0
  144. package/dist/translation-warning-modal-BZAcwM2_.cjs +1 -0
  145. package/dist/unmark-as-template-CZ9sQp_P.js +39 -0
  146. package/dist/unmark-as-template-EVvk0vmp.cjs +1 -0
  147. package/dist/unpublish-page-D4VwOlxc.js +27 -0
  148. package/dist/unpublish-page-bdSmwAVQ.cjs +1 -0
  149. package/dist/use-page-expand-manager-B6XTvk0E.cjs +1 -0
  150. package/dist/use-page-expand-manager-Cf4MUEJw.js +85 -0
  151. package/dist/{tailwind.cjs → utils.cjs} +1 -1
  152. package/dist/{tailwind.d.ts → utils.d.ts} +12 -11
  153. package/dist/utils.js +7 -0
  154. package/dist/web-blocks.cjs +1 -1
  155. package/dist/web-blocks.d.ts +0 -6
  156. package/dist/web-blocks.js +248 -241
  157. package/dist/web-preview-Cio70gk5.cjs +1 -0
  158. package/dist/web-preview-Djy6WIyj.js +73 -0
  159. package/package.json +175 -105
  160. package/dist/IconPicker-CGWn9C4u.cjs +0 -1
  161. package/dist/IconPicker-QvxJ-4Ez.js +0 -64
  162. package/dist/apply-binding-DCno1xQL.js +0 -711
  163. package/dist/apply-binding-DvHNFLQD.cjs +0 -1
  164. package/dist/code-display-BZ1x7SqI.cjs +0 -1
  165. package/dist/code-editor-B28LoECM.cjs +0 -1
  166. package/dist/code-editor-CfG2FhJ-.js +0 -58
  167. package/dist/common-functions-BGzDsf1z.js +0 -14
  168. package/dist/common-functions-BZmyleS1.cjs +0 -1
  169. package/dist/css-import-modal-CENUYvcl.cjs +0 -13
  170. package/dist/get-chai-builder-theme-Ck_Z4Q-M.cjs +0 -1
  171. package/dist/index-CaGNHF7f.js +0 -12209
  172. package/dist/index-Gn6pJt2v.cjs +0 -166
  173. package/dist/mockServiceWorker.js +0 -307
  174. package/dist/plugin-B5627hMN.js +0 -195
  175. package/dist/plugin-UxTRfDum.cjs +0 -22
  176. package/dist/rte-widget-modal-DL739qeQ.cjs +0 -1
  177. package/dist/rte-widget-modal-Dte0od04.js +0 -41
  178. package/dist/tailwind.js +0 -7
  179. package/dist/tooltip-A4qGk781.cjs +0 -1
  180. package/dist/tooltip-tLiIOgjq.js +0 -1067
  181. package/dist/ui.cjs +0 -1
  182. package/dist/ui.d.ts +0 -415
  183. package/dist/ui.js +0 -129
  184. package/dist/vite.svg +0 -1
@@ -1 +0,0 @@
1
- "use strict";const T=require("./common-functions-BZmyleS1.cjs"),t=require("lodash-es"),_=require("himalaya"),E=require("lodash"),J=require("@chaibuilder/runtime"),z=require("tailwind-merge"),m="#styles:",Y="__ADD_BLOCK_INTERNAL_ROOT",K="@",V="#",M=s=>{if(s=s.replace(m,""),!s)return{baseClasses:"",classes:""};const n=s.split(/,(?![^\[]*\])/);if(n.length===1)return{baseClasses:"",classes:n[0].trim()};const[a,...e]=n;return{baseClasses:a.trim(),classes:e.join(",").trim().replace(/ +(?= )/g,"")}},U=s=>{const n=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,a=/(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;return n.test(s)||a.test(s)},X=s=>{if(t.isEmpty(s))return s;const n=/<video[^>]+src=['"]([^'">]+)['"]/,a=/<iframe[^>]+src=['"]([^'">]+)['"]/,e=s.match(n),i=s.match(a),r=e?e[1]:i?i[1]:null,l=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,p=/(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;return r&&(l.test(r)||p.test(r))?r:s},W=["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"}},G=(s,n)=>s.children.length===1&&t.includes(["Heading","Paragraph","Span","ListItem","Button","Label","TableCell","Link","RichText"],n._type),v=s=>s.map(n=>n.type==="text"?t.get(n,"content",""):t.isEmpty(n.children)?"":v(n.children)).join(""),B=s=>s===null?"":s,O=s=>{const n=t.compact(t.map(s.split(/\s+/),t.trim)),a=t.find(n,p=>/^w-/.test(p)),e=t.find(n,p=>/^h-/.test(p));if(!e||!a)return{height:"",width:""};const i=p=>{if(!p)return;const h=p.match(/^[wh]-(?:\[(.*?)\]|(.+))$/);if(!h)return;if(h[1])return h[1];const o=h[2];return/^\d+(\.\d+)?$/.test(o)?`${Number(o)*4}px`:o==="auto"||t.includes(o,"%")?o:"16px"},r=i(a),l=i(e);return{width:t.includes(r,"px")?r:"16px",height:t.includes(l,"px")?l:"16px"}},H=s=>{if(s.tagName==="svg")return{};const n={},a=Z[s.tagName]||{},e=s.attributes;return t.forEach(e,({key:i,value:r})=>{if(!t.includes(W,i))if(i==="bid"&&(n._bid=B(r)),a[i]){if(s.tagName==="img"&&i==="src"&&!r.startsWith("http")){const l=t.find(s.attributes,{key:"width"}),p=t.find(s.attributes,{key:"height"});l&&p?r=`https://picsum.photos/${l==null?void 0:l.value}x${p==null?void 0:p.value}`:r="https://picsum.photos/150x150"}t.set(n,a[i],B(r))}else t.includes(["style","class","srcset","bid"],i)||(t.has(n,"styles_attrs")||(n.styles_attrs={}),t.startsWith(i,"@")&&(i=i.replace("@","x-on:")),n.styles_attrs[`${i}`]=B(r))}),delete n.class,n},Q=(s,n="styles")=>{if(!s.attributes)return{[n]:`${m},`};const a=t.find(s.attributes,{key:"class"});if(a){const e=a.value;return{[n]:`${m},${e}`}}return{[n]:`${m},`}},tt=s=>{const n=t.get(s,"attributes",[]),a=n.find(o=>o.key==="data-chai-richtext"||o.key==="chai-richtext"),e=n.find(o=>o.key==="data-chai-lightbox"||o.key==="chai-lightbox"),i=n.find(o=>o.key==="data-chai-dropdown"||o.key==="chai-dropdown"),r=n.find(o=>o.key==="data-chai-dropdown-button"||o.key==="chai-dropdown-button"),l=n.find(o=>o.key==="data-chai-dropdown-content"||o.key==="chai-dropdown-content"),p=n.find(o=>o.key==="class"),h=p&&p.value.split(/\s+/).includes("rte");if(i)return{_type:"Dropdown"};if(r)return{_type:"DropdownButton"};if(l)return{_type:"DropdownContent"};if(a||h)return{_type:"Paragraph"};if(e)return{_type:"LightBoxLink"};switch(s.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:s.tagName,_listType:s.tagName==="ol"?"list-decimal":"list-none"};case"li":case"dt":return{_type:"ListItem",tag:s.tagName};case"span":case"figcaption":case"legend":return{_type:"Span",tag:s.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:s.tagName};case"table":return{_type:"Table"};case"tr":return{_type:"TableRow"};case"td":case"th":return{_type:"TableCell",tag:s.tagName};case"thead":return{_type:"TableHead"};case"tbody":return{_type:"TableBody"};case"tfoot":return{_type:"TableFooter"};default:{const o=t.get(s,"children",[]).length>0?"Box":"EmptyBox";return{_type:o,tag:s.tagName,_name:o=="EmptyBox"||s.tagName==="div"?o:t.capitalize(s.tagName)}}}},w=(s,n=null)=>t.flatMapDeep(s,a=>{var $,C,S,D,N,L,A,R,j,P;if(a.type==="comment")return[];let e={_id:T.generateUUID()};if(n&&(e._parent=n.block._id),a.type==="text")return t.isEmpty(t.get(a,"content",""))?[]:n&&G(n.node,n.block)?(t.set(n,"block.content",t.get(a,"content","")),[]):{...e,_type:"Text",content:t.get(a,"content","")};if(t.startsWith(a.tagName,"chai-")){const c=a.attributes,u=t.find(c,{key:"chai-type"}),d=(u==null?void 0:u.value)||t.startCase(a.tagName.replace("chai-","")).replace(/\s+/g,"");e._type=d,t.forEach(c,({key:y,value:q})=>{if(y==="about-this-component"||y==="chai-type"||y==="can-move"||y==="can-delete")return;if(y==="id"){e._id=q;return}const F=t.startsWith(y,"_")?y:t.camelCase(y);let x=B(q);typeof x=="string"&&t.startsWith(x,"#styles:")&&(x=x.replace("#styles:","#styles:,")),e[F]=x});const g=w(a.children,{block:e,node:a});return[e,...g]}const i=t.get(a,"attributes",[]),r=i.find(c=>c.key==="data-chai-richtext"||c.key==="chai-richtext"),l=i.find(c=>c.key==="class"),p=l&&l.value.split(/\s+/).includes("rte"),h=i.find(c=>c.key==="data-chai-lightbox"||c.key==="chai-lightbox"),o=i.find(c=>c.key==="data-chai-dropdown"||c.key==="chai-dropdown"),f=i.find(c=>c.key==="data-chai-dropdown-button"||c.key==="chai-dropdown-button"),k=i.find(c=>c.key==="data-chai-dropdown-content"||c.key==="chai-dropdown-content");if(e={...e,...tt(a),...H(a),...Q(a)},a.attributes){const c=a.attributes.find(u=>t.includes(W,u.key));c&&(e._name=c.value)}if(r||p)return e.content=_.stringify(a.children),t.has(e,"styles_attrs.data-chai-richtext")&&delete e.styles_attrs["data-chai-richtext"],t.has(e,"styles_attrs.chai-richtext")&&delete e.styles_attrs["chai-richtext"],[e];if(h){const c=["data-chai-lightbox","chai-lightbox","data-vbtype","data-autoplay","data-maxwidth","data-overlay","data-gall","href"];e={...e,href:(($=i.find(u=>u.key==="href"))==null?void 0:$.value)||"",hrefType:((C=i.find(u=>u.key==="data-vbtype"))==null?void 0:C.value)||"video",autoplay:((S=i.find(u=>u.key==="data-autoplay"))==null?void 0:S.value)==="true"?"true":"false",maxWidth:((N=(D=i.find(u=>u.key==="data-maxwidth"))==null?void 0:D.value)==null?void 0:N.replace("px",""))||"",backdropColor:((L=i.find(u=>u.key==="data-overlay"))==null?void 0:L.value)||"",galleryName:((A=i.find(u=>u.key==="data-gall"))==null?void 0:A.value)||""},t.forEach(c,u=>{t.has(e,`styles_attrs.${u}`)&&delete e.styles_attrs[u]})}if(o&&(delete e.styles_attrs,e.showDropdown=!1),k&&delete e.styles_attrs,f){delete e.styles_attrs;const c=t.filter(a.children||[],d=>(d==null?void 0:d.tagName)!=="span");e.content=v(c);const u=t.find(a.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){e.icon=_.stringify([d]);const{height:g,width:y}=et(d,"16px","16px");e.iconHeight=g,e.iconWidth=y}}return[e]}if(e._type==="Input"){const c=e.inputType||"text";c==="checkbox"?t.set(e,"_type","Checkbox"):c==="radio"&&t.set(e,"_type","Radio")}else if(a.tagName==="video"||a.tagName==="iframe"){const c=_.stringify([a]);return U(c)&&(t.set(e,"_type","Video"),t.set(e,"url",X(c)),t.set(e,"styles",`${m},`),t.set(e,"controls",{autoPlay:!1,muted:!0,loop:!1,controls:!1})),e.content=c,[e]}else if(a.tagName==="svg"){const c=t.get(t.find(a.attributes,{key:"class"}),"value",""),{height:u,width:d}=O(c);if(u&&d)e.styles=`${m}, ${T.cn(`w-${d} h-${u}`,c)}`.trim(),e.height=u==null?void 0:u.replace("px",""),e.width=d==null?void 0:d.replace("px","");else{const g=(R=t.find(a.attributes,{key:"height"}))==null?void 0:R.value,y=(j=t.find(a.attributes,{key:"width"}))==null?void 0:j.value;g&&y?(e.styles=`${m}, ${T.cn(`w-[${y}px] h-[${g}px]`,c)}`.trim(),e.height=g,e.width=y):e.styles=`${m}, ${T.cn("w-full h-full",c)}`.trim()}return a.attributes=t.filter(a.attributes,g=>!t.includes(["style","width","height","class"],g.key)),e.icon=_.stringify([a]),[e]}else if(a.tagName=="option"&&n&&((P=n.block)==null?void 0:P._type)==="Select")return n.block.options.push({label:v(a.children),...H(a)}),[];const b=w(a.children,{block:e,node:a});return[e,...b]}),et=(s,n,a)=>{var h,o;const e=t.get(s,"attributes",[]),{height:i,width:r}=O(t.get(t.find(e,{key:"class"}),"value",""));if(i&&r)return{height:`[${i}px]`,width:`[${r}px]`};const l=(h=t.find(e,{key:"height"}))==null?void 0:h.value,p=(o=t.find(e,{key:"width"}))==null?void 0:o.value;return{height:l?`[${l}px]`:a,width:p?`[${p}px]`:n}},st=s=>{s=s.replace(/(\w+)=\\?"(.*?)\\?"/g,(e,i,r)=>{let l=r.replace(/\\"/g,'"');return l=l.replace(/{([^}]+)}/g,p=>p.replace(/"/g,'\\"')),`${i}="${l.replace(/\\"/g,'"')}"`}),s=s.replace(/\\n/g,"").replace(/\\\\/g,"").replace(/\\([/<>])/g,"$1").replace(/\\./g,"").replace(/[\n\r\t\f\v]/g,""),s=s.replace(/\$name="[^"]*"/g,"");const n=s.match(/<body[^>]*>[\s\S]*?<\/body>/);return(n&&n.length>0?n[0].replace(/<body/,"<div").replace(/<\/body>/,"</div>"):s).replace(/\s+/g," ").replaceAll("> <","><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").trim()},at=(s,n)=>t.find(s,{_id:n}),nt=(s,n)=>t.isEmpty(n)?s.map(a=>(E.unset(a,"_bid"),a)):t.map(s,a=>{const e=t.isEmpty(a._bid)?void 0:at(n,a._bid);if(e){e._type==="Icon"&&t.get(a,"icon","").match(/chai-default-svg/)&&delete a.icon;const i={...e,...a};return E.unset(i,"_bid"),i}return E.unset(a,"_bid"),a}),rt=s=>{const n=_.parse(st(s));return t.isEmpty(s)?[]:t.flatten(w(n))};function ot(s,n,a){const e=t.get(a,"i18nProps",[]);if(t.isEmpty(n)||t.isEmpty(e))return s;const i=t.cloneDeep(s);return t.forEach(t.keys(i),r=>{if(t.includes(e,r)&&!t.isEmpty(n)){const l=t.get(i,r),p=t.get(i,`${r}-${n}`,"");t.isString(l)?i[r]=t.isString(p)&&!t.isEmpty(p.trim())&&p.trimStart()||l:i[r]=t.isEmpty(p)?l:p}}),i}const lt=t.memoize(s=>{const{baseClasses:n,classes:a}=M(s);return z.twMerge(n,a)});function ct(s,n){return t.get(s,`${n}_attrs`,{})}function pt(s,n=!0){const a={};return Object.keys(s).forEach(e=>{if(t.isString(s[e])&&s[e].startsWith(m)){const i=lt(s[e]),r=ct(s,e);a[e]={...!t.isEmpty(i)&&{className:i},...r,...n?{"data-style-prop":e,"data-block-parent":s._id,"data-style-id":`${e}-${s._id}`}:{}}}}),a}const ut=t.memoize(s=>{const n=J.getRegisteredChaiBlock(s),a=t.get(n,"schema.properties",{});return Object.fromEntries(Object.entries(a).filter(([,e])=>t.get(e,"runtime",!1)))}),dt=(s,n)=>{if(!t.isArray(s))return s;let a=s,e;return typeof n.limit=="number"&&n.limit>0&&(e=n.limit),e!==void 0&&(a=a.slice(0,e)),a},gt=(s,n)=>{const a=t.cloneDeep(s);return t.forEach(t.keys(a),e=>{if(t.isString(a[e])&&!t.startsWith(e,"_")){let i=a[e];e==="repeaterItems"&&(a.repeaterItemsBinding=i);const r=/\{\{(.*?)\}\}/g,l=i.match(r);l&&l.forEach(p=>{let h=p.slice(2,-2);const o=t.get(n,h,p);i=t.isArray(o)?o:i.replace(p,o)}),a[e]=i}}),a},ht=s=>{const n=t.last(s);return s.map(a=>{const e=Object.keys(a);for(let i=0;i<e.length;i++)if(t.isString(a[e[i]])&&t.startsWith(e[i],"content")){const r=a===n?"":" ";a[e[i]]=`${a[e[i]].trim()}${r}`}return a})},I=(s,n,{index:a,key:e},i)=>{if(t.isString(s)){let r=s;const l=/\{\{(.*?)\}\}/g,p=s.match(l);if(p){const h=i==="image"||i==="mobileImage";p.forEach(o=>{let f=o.slice(2,-2).trim(),k=e.slice(2,-2).trim();a!==-1&&t.startsWith(f,"$index.")?f=`${k}.${a}.${f.slice(7)}`:a!==-1&&t.startsWith(f,"$index")&&(f=`${k}.${a}`);const b=t.get(n,f);b===void 0?r=r.replace(o,""):h&&!t.isArray(b)?r=b:r=t.isArray(b)?b:r.replace(o,b)})}return r}if(t.isArray(s))return s.map(r=>I(r,n,{index:a,key:e},i));if(s&&typeof s=="object"){const r={};return t.forEach(t.keys(s),l=>{!t.startsWith(l,"_")&&l!=="$repeaterItemsKey"?r[l]=I(s[l],n,{index:a,key:e},l):r[l]=s[l]}),r}return s},yt=(s,n,{index:a,key:e})=>{let i=t.cloneDeep(s);return i.repeaterItems&&(i.$repeaterItemsKey=i.repeaterItems,t.startsWith(i.repeaterItems,`{{${V}`)&&(i.$repeaterItemsKey=i.repeaterItems=`${i.repeaterItems.replace("}}",`/${i._id}}}`)}`),!t.isEmpty(i.repeaterItems)&&i.pagination&&(i.repeaterTotalItems=`${i.repeaterItems.replace("}}",`/${i._id}/totalItems}}`)}`)),I(i,n,{index:a,key:e})};exports.COLLECTION_PREFIX=V;exports.REPEATER_PREFIX=K;exports.ROOT_TEMP_KEY=Y;exports.STYLES_KEY=m;exports.adjustSpacingInContentBlocks=ht;exports.applyBindingToBlockProps=yt;exports.applyChaiDataBinding=gt;exports.applyLanguage=ot;exports.applyLimit=dt;exports.getBlockRuntimeProps=ut;exports.getBlockTagAttributes=pt;exports.getBlocksFromHTML=rt;exports.getSplitChaiClasses=M;exports.mergeBlocksWithExisting=nt;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("./tooltip-A4qGk781.cjs"),m=require("@monaco-editor/react"),o=require("@radix-ui/react-icons"),l=require("react");function j({code:r,onCopy:d,language:s="javascript",onDownload:c,downloadText:u="Download"}){const[n,a]=l.useState(!1),[t,p]=l.useState(r),f=()=>{d(t),a(!0),setTimeout(()=>{a(!1)},2e3)},h=()=>{c(t)};return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"h-[500px] max-h-full overflow-hidden rounded-md border py-2",children:e.jsx(m,{height:"100%",defaultLanguage:s,language:s,value:t,onChange:x=>p(x||""),theme:"vs-light",options:{minimap:{enabled:!1},fontSize:12,lineNumbers:"off",roundedSelection:!1,scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,insertSpaces:!0,wordWrap:"on",bracketPairColorization:{enabled:!0},suggest:{showKeywords:!1,showSnippets:!1}}})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(i.Button,{type:"button",variant:"outline",onClick:f,children:[n?e.jsx(o.CheckIcon,{className:"text-green-500"}):e.jsx(o.CopyIcon,{})," ",n?"Copied":"Copy"]}),e.jsxs(i.Button,{type:"button",onClick:h,children:[e.jsx(o.DownloadIcon,{})," ",u]})]})]})}exports.default=j;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./index-Gn6pJt2v.cjs");require("lodash-es");require("clsx");require("tailwind-merge");require("tree-model");const i=require("react");require("jotai");require("@chaibuilder/runtime");require("sonner");const q=require("react-i18next"),r=require("./tooltip-A4qGk781.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]=i.useState(!1),[a,p]=i.useState(""),[t,d]=c.useCodeEditor(),[u]=c.useSelectedBlockIds(),b=c.useUpdateBlocksProps(),f=c.useUpdateBlocksPropsRealtime(),C=g.useThrottledCallback(o=>{const l=m(o);f([t.blockId],{[t.blockProp]:l})},[],300),x=i.useCallback(()=>{if(s){const o=m(a);b([t.blockId],{[t.blockProp]:o})}},[s,a]);i.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,58 +0,0 @@
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-CaGNHF7f.js";
3
- import "lodash-es";
4
- import "clsx";
5
- import "tailwind-merge";
6
- import "tree-model";
7
- import { useState as m, useCallback as T, useEffect as y } from "react";
8
- import "jotai";
9
- import "@chaibuilder/runtime";
10
- import "sonner";
11
- import { useTranslation as w } from "react-i18next";
12
- import { a1 as N, a3 as E, a6 as D, a9 as H, b1 as P } from "./tooltip-tLiIOgjq.js";
13
- import { useThrottledCallback as B } from "@react-hookz/web";
14
- const p = (a) => {
15
- const t = document.createElement("div");
16
- return t.innerHTML = a, t.innerHTML;
17
- };
18
- function K() {
19
- const { t: a } = w(), [t, u] = m(!1), [r, f] = m(""), [e, n] = C(), [i] = k(), h = v(), x = g(), b = B(
20
- (s) => {
21
- const l = p(s);
22
- x([e.blockId], { [e.blockProp]: l });
23
- },
24
- [],
25
- 300
26
- ), c = T(() => {
27
- if (t) {
28
- const s = p(r);
29
- h([e.blockId], { [e.blockProp]: s });
30
- }
31
- }, [t, r]);
32
- return y(() => {
33
- i.includes(e == null ? void 0 : e.blockId) || (c(), n(null));
34
- }, [i]), /* @__PURE__ */ o(N, { open: !0, onOpenChange: () => {
35
- c(), n(null);
36
- }, children: /* @__PURE__ */ d(E, { className: "flex max-h-[400px] min-h-[200px] max-w-4xl flex-col border-gray-700 text-black", children: [
37
- /* @__PURE__ */ o(D, { className: "shrink-0 border-b border-gray-700 pb-3", children: /* @__PURE__ */ o(H, { className: "flex items-center justify-between text-black", children: /* @__PURE__ */ d("div", { className: "space-x-3 text-sm font-semibold", children: [
38
- /* @__PURE__ */ o("span", { children: a("HTML Code Editor |") }),
39
- /* @__PURE__ */ o("span", { className: "text-xs text-gray-400", children: a("Scripts will be only executed in preview and live mode.") })
40
- ] }) }) }),
41
- /* @__PURE__ */ o("div", { className: "min-h-0 flex-1 overflow-hidden", children: /* @__PURE__ */ o(
42
- P,
43
- {
44
- className: "h-full w-full resize-none font-mono text-xs",
45
- value: r || e.initialCode,
46
- onChange: (s) => {
47
- const l = s.target.value;
48
- u(!0), f(l), b(l);
49
- },
50
- rows: 10,
51
- placeholder: "Enter your code here..."
52
- }
53
- ) })
54
- ] }) });
55
- }
56
- export {
57
- K as default
58
- };
@@ -1,14 +0,0 @@
1
- import "lodash-es";
2
- import { clsx as n } from "clsx";
3
- import { twMerge as a } from "tailwind-merge";
4
- function c(e = 6, o = "abcdefghijklmnopqrstuvwxyzABCD") {
5
- let r = "";
6
- for (let t = e; t > 0; --t) r += o[Math.floor(Math.random() * o.length)];
7
- return r;
8
- }
9
- const f = (e) => e >= 1536 ? "2XL" : e >= 1280 ? "XL" : e >= 1024 ? "LG" : e >= 768 ? "MD" : e >= 640 ? "SM" : "XS", g = (...e) => a(n(e));
10
- export {
11
- f as a,
12
- g as c,
13
- c as g
14
- };
@@ -1 +0,0 @@
1
- "use strict";require("lodash-es");const o=require("clsx"),l=require("tailwind-merge");function a(e=6,r="abcdefghijklmnopqrstuvwxyzABCD"){let t="";for(let n=e;n>0;--n)t+=r[Math.floor(Math.random()*r.length)];return t}const c=e=>e>=1536?"2XL":e>=1280?"XL":e>=1024?"LG":e>=768?"MD":e>=640?"SM":"XS",u=(...e)=>l.twMerge(o.clsx(e));exports.cn=u;exports.generateUUID=a;exports.getBreakpointValue=c;
@@ -1,13 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),w=require("react"),c=require("./tooltip-A4qGk781.cjs"),T=require("@chaibuilder/runtime"),V=require("culori"),N=require("react-i18next");function $(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const S=$(w),y=$(V),f=e=>e?e%1===0?e:e.toFixed(4):"0",R=e=>`hsl(${f(e.h)} ${f(e.s*100)}% ${f(e.l*100)}%)`,E=(e,o="hsl",t="4")=>{try{const r=y.parse(e);if(!r)throw new Error("Invalid color input");switch(o){case"hsl":{const s=y.converter("hsl")(r);return t==="4"?R(s):`${f(s.h)} ${f(s.s*100)}% ${f(s.l*100)}%`}case"rgb":return y.formatRgb(r);case"oklch":{const s=y.converter("oklch")(r);return`oklch(${f(s.l)} ${f(s.c)} ${f(s.h)})`}case"hex":return y.formatHex(r);default:return e}}catch(r){return console.error(`Failed to convert color: ${e}`,r),e}},b=e=>E(e,"hex"),I=e=>{const o={fontFamily:{heading:"",body:""},borderRadius:"",colors:{}};try{const t=F(e);if(!t.isValid)return console.warn("CSS validation failed:",t.error),k();const r=C(e,":root"),s=C(e,".dark"),l=m(r,"--font-sans")||m(r,"--font-family")||m(r,"--font-heading")||m(r,"--font-body"),a=D(l);o.fontFamily={heading:a,body:a};const u=m(r,"--radius")||m(r,"--border-radius")||"0.5rem";o.borderRadius=P(u),["background","foreground","primary","primary-foreground","secondary","secondary-foreground","muted","muted-foreground","accent","accent-foreground","destructive","destructive-foreground","border","input","ring","card","card-foreground","popover","popover-foreground"].forEach(i=>{const p=m(r,`--${i}`),g=m(s,`--${i}`);if(p||g){const d=p?v(p):"#000000",x=g?v(g):d;o.colors[i]=[d,x]}})}catch(t){return console.error("Error parsing CSS to ChaiThemeValues:",t),k()}return o},C=(e,o)=>{var r,s;const t=new RegExp(`${j(o)}\\s*{([^}]+)}`);return((s=(r=e.match(t))==null?void 0:r[1])==null?void 0:s.trim())||null},m=(e,o)=>{var s;if(!e)return null;const t=new RegExp(`${j(o)}\\s*:\\s*([^;]+)`),r=e.match(t);return((s=r==null?void 0:r[1])==null?void 0:s.trim())||null},v=e=>{if(!e||typeof e!="string")return"#000000";try{const o=e.replace(/var\([^)]+\)/g,"").trim();if(!o)return"#000000";if(/^[a-z]+$/i.test(o))return b(o)||"#000000";if(/^#?([0-9A-F]{3,4}|[0-9A-F]{6}|[0-9A-F]{8})$/i.test(o.replace(/#/g,""))){const r=o.startsWith("#")?o:`#${o}`;return r.length<=5?`#${r.slice(1).split("").map(s=>s+s).join("")}`.slice(0,7):r.length>7?r.slice(0,7):r}if(/^(rgb|hsl|oklch)a?\(/i.test(o))return b(o)||"#000000";const t=o.match(/^(\d+\.?\d*)\s+(\d+\.?\d*)%\s+(\d+\.?\d*)%$/);if(t){const[r,s,l,a]=t,u=`hsl(${s} ${l}% ${a}%)`;return b(u)||"#000000"}if(/^[\d.]+[\s,]+[\d.]+[\s,]+[\d.]+(?:[\s,/]+[\d.]+)?$/.test(o)){const r=o.split(/[\s,]+/).filter(Boolean);if(r.length>=3){const l=r.some(a=>a.includes("%"))?`hsl(${r[0]} ${r[1]} ${r[2]})`:`rgb(${r[0]}, ${r[1]}, ${r[2]})`;return b(l)||"#000000"}}return b(o)||"#000000"}catch(o){return console.warn("Failed to process color:",e,o),"#000000"}},D=e=>{const o=T.getAllRegisteredFonts();if(!e)return"ui-sans-serif, system-ui, sans-serif";try{const r=e.replace(/["']/g,"").trim().split(",")[0].trim(),s=o.find(l=>l.family.toLowerCase()===r.toLowerCase());return(s==null?void 0:s.family)||"ui-sans-serif, system-ui, sans-serif"}catch(t){return console.warn("Error processing font family:",e,t),"ui-sans-serif, system-ui, sans-serif"}},P=e=>{if(!e)return"8px";try{const o=e.trim();if(o.endsWith("px"))return o;if(o.endsWith("rem")){const r=parseFloat(o.replace("rem",""));if(!isNaN(r))return`${Math.round(r*16)}px`}if(o.endsWith("em")){const r=parseFloat(o.replace("em",""));if(!isNaN(r))return`${Math.round(r*16)}px`}const t=parseFloat(o);return isNaN(t)?"8px":`${Math.round(t)}px`}catch(o){return console.warn("Error converting border radius to px:",e,o),"8px"}},k=()=>({fontFamily:{heading:"ui-sans-serif, system-ui, sans-serif",body:"ui-sans-serif, system-ui, sans-serif"},borderRadius:"8px",colors:{background:["#ffffff","#000000"],foreground:["#000000","#ffffff"],primary:["#3b82f6","#60a5fa"],"primary-foreground":["#ffffff","#1e293b"],secondary:["#f1f5f9","#334155"],"secondary-foreground":["#0f172a","#f8fafc"],muted:["#f8fafc","#1e293b"],"muted-foreground":["#64748b","#94a3b8"],accent:["#f1f5f9","#334155"],"accent-foreground":["#0f172a","#f8fafc"],destructive:["#ef4444","#f87171"],"destructive-foreground":["#ffffff","#1e293b"],border:["#e2e8f0","#475569"],input:["#e2e8f0","#475569"],ring:["#3b82f6","#60a5fa"],card:["#ffffff","#0f172a"],"card-foreground":["#000000","#f8fafc"],popover:["#ffffff","#0f172a"],"popover-foreground":["#000000","#f8fafc"]}}),j=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=e=>["background","foreground","primary","primary-foreground"].every(r=>e.colors[r]&&Array.isArray(e.colors[r])&&e.colors[r].length>=2)&&!!e.fontFamily.heading&&!!e.fontFamily.body&&!!e.borderRadius,F=e=>{if(!e||typeof e!="string")return{isValid:!1,error:"Please enter valid CSS content"};const o=e.trim();if(!o)return{isValid:!1,error:"Please enter CSS content"};try{if(!o.includes("{")||!o.includes("}"))return{isValid:!1,error:"Invalid CSS format. CSS should contain proper block structure with { }"};const t=(o.match(/{/g)||[]).length,r=(o.match(/}/g)||[]).length;return t!==r?{isValid:!1,error:"Invalid CSS format. Unmatched braces detected"}:!o.includes("--")||!o.includes(":")?{isValid:!1,error:"Invalid CSS format. CSS should contain variable definitions like --primary: #color"}:!o.includes(":root")&&!o.includes(".dark")?{isValid:!1,error:"CSS should contain at least :root or .dark selector with theme variables"}:{isValid:!0}}catch(t){return console.error("CSS validation error:",t),{isValid:!1,error:"Failed to parse CSS. Please check your syntax."}}},M=`:root {
2
- --background: 0 0% 100%;
3
- --foreground: oklch(0.52 0.13 144.17);
4
- --primary: #3e2723;
5
- --primary-foreground: #ffffff;
6
- }
7
-
8
- .dark {
9
- --background: 222.2 84% 4.9%;
10
- --foreground: hsl(37.50 36.36% 95.69%);
11
- --primary: rgb(46, 125, 50);
12
- --primary-foreground: #ffffff;
13
- }`,_=({open:e,onOpenChange:o,onImport:t})=>{const[r,s]=S.useState(""),[l,a]=S.useState(null),[u,h]=S.useState(!1),{t:i}=N.useTranslation(),p=async()=>{h(!0),a(null);try{const d=F(r);if(!d.isValid){a(d.error||i("Invalid CSS format")),setTimeout(()=>{a(null)},5e3),h(!1);return}const x=I(r);if(!q(x)){a(i("The CSS doesn't contain enough theme information. Please ensure it includes at least background, foreground, primary, and primary-foreground colors.")),setTimeout(()=>{a(null)},5e3),h(!1);return}t(x),s(""),a(null),o(!1)}catch(d){console.error("Error importing CSS:",d),a(i("Failed to parse CSS. Please check your syntax and try again.")),setTimeout(()=>{a(null)},5e3)}finally{h(!1)}},g=()=>{s(""),a(null),o(!1)};return n.jsx(c.Dialog,{open:e,onOpenChange:o,children:n.jsxs(c.DialogContent,{className:"flex max-h-[80vh] max-w-2xl flex-col",children:[n.jsxs(c.DialogHeader,{children:[n.jsx(c.DialogTitle,{children:i("Import CSS Theme")}),n.jsxs(c.DialogDescription,{className:"space-y-2",children:[n.jsx("p",{children:i("Paste your CSS variables to import a custom theme. The CSS should contain :root and .dark blocks with CSS custom properties.")}),n.jsxs("div",{className:"flex items-center",children:[n.jsx("p",{className:"font-bold",children:"Get theme resources:"}),n.jsx(c.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://tweakcn.com/","_blank"),children:"TweakCN"}),n.jsx(c.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://ui.shadcn.com/themes#themes","_blank"),children:"shadcn/ui Themes"}),n.jsx(c.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://zippystarter.com/tools/shadcn-ui-theme-generator","_blank"),children:"ZippyStarter"})]})]})]}),n.jsxs("div",{className:"flex-1 space-y-4 overflow-hidden",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(c.Label,{htmlFor:"css-input",children:i("CSS Variables")}),n.jsx(c.Textarea,{id:"css-input",placeholder:M,value:r,onChange:d=>s(d.target.value),className:"min-h-[300px] resize-none font-mono text-sm",disabled:u})]}),l&&n.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 p-3",children:n.jsx("p",{className:"text-sm text-red-600",children:l})})]}),n.jsxs(c.DialogFooter,{className:"gap-2",children:[n.jsx(c.Button,{variant:"outline",onClick:g,disabled:u,children:i("Cancel")}),n.jsx(c.Button,{onClick:p,disabled:!r.trim()||u,children:i(u?"Importing...":"Import Theme")})]})]})})};exports.CssImportModal=_;
@@ -1 +0,0 @@
1
- "use strict";const n=require("./plugin-UxTRfDum.cjs"),e=n.u(function({addBase:i,theme:o}){i({"h1,h2,h3,h4,h5,h6":{fontFamily:o("fontFamily.heading")},body:{fontFamily:o("fontFamily.body"),color:o("colors.foreground"),backgroundColor:o("colors.background")}})}),r=(i=n.defaultThemeOptions)=>({container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},...n.getChaiThemeOptions(i)});exports.chaiBuilderPlugin=e;exports.getChaiBuilderTheme=r;