(function(N,R){typeof exports=="object"&&typeof module<"u"?R(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],R):(N=typeof globalThis<"u"?globalThis:N||self,R(N.FlexPreview={},N.React))})(this,function(N,R){"use strict";var jr=Object.defineProperty;var Or=(N,R,D)=>R in N?jr(N,R,{enumerable:!0,configurable:!0,writable:!0,value:D}):N[R]=D;var X=(N,R,D)=>(Or(N,typeof R!="symbol"?R+"":R,D),D);var D={exports:{}},H={};/** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var xe;function at(){if(xe)return H;xe=1;var e=R,a=Symbol.for("react.element"),t=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,l=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function d(c,g,C){var E,j={},M=null,ne=null;C!==void 0&&(M=""+C),g.key!==void 0&&(M=""+g.key),g.ref!==void 0&&(ne=g.ref);for(E in g)i.call(g,E)&&!o.hasOwnProperty(E)&&(j[E]=g[E]);if(c&&c.defaultProps)for(E in g=c.defaultProps,g)j[E]===void 0&&(j[E]=g[E]);return{$$typeof:a,type:c,key:M,ref:ne,props:j,_owner:l.current}}return H.Fragment=t,H.jsx=d,H.jsxs=d,H}var G={};/** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Ce;function nt(){return Ce||(Ce=1,process.env.NODE_ENV!=="production"&&function(){var e=R,a=Symbol.for("react.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),d=Symbol.for("react.provider"),c=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),ne=Symbol.for("react.offscreen"),je=Symbol.iterator,Jt="@@iterator";function Kt(r){if(r===null||typeof r!="object")return null;var n=je&&r[je]||r[Jt];return typeof n=="function"?n:null}var z=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(r){{for(var n=arguments.length,s=new Array(n>1?n-1:0),u=1;u=1&&b>=0&&f[y]!==S[b];)b--;for(;y>=1&&b>=0;y--,b--)if(f[y]!==S[b]){if(y!==1||b!==1)do if(y--,b--,b<0||f[y]!==S[b]){var k=` `+f[y].replace(" at new "," at ");return r.displayName&&k.includes("")&&(k=k.replace("",r.displayName)),typeof r=="function"&&le.set(r,k),k}while(y>=1&&b>=0);break}}}finally{pe=!1,ce.current=h,lr(),Error.prepareStackTrace=v}var U=r?r.displayName||r.name:"",I=U?ie(U):"";return typeof r=="function"&&le.set(r,I),I}function or(r,n,s){return Ye(r,!1)}function ur(r){var n=r.prototype;return!!(n&&n.isReactComponent)}function se(r,n,s){if(r==null)return"";if(typeof r=="function")return Ye(r,ur(r));if(typeof r=="string")return ie(r);switch(r){case C:return ie("Suspense");case E:return ie("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case g:return or(r.render);case j:return se(r.type,n,s);case M:{var u=r,v=u._payload,h=u._init;try{return se(h(v),n,s)}catch{}}}return""}var Z=Object.prototype.hasOwnProperty,ze={},Ve=z.ReactDebugCurrentFrame;function oe(r){if(r){var n=r._owner,s=se(r.type,r._source,n?n.type:null);Ve.setExtraStackFrame(s)}else Ve.setExtraStackFrame(null)}function dr(r,n,s,u,v){{var h=Function.call.bind(Z);for(var p in r)if(h(r,p)){var f=void 0;try{if(typeof r[p]!="function"){var S=Error((u||"React class")+": "+s+" type `"+p+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[p]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw S.name="Invariant Violation",S}f=r[p](n,p,u,s,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(y){f=y}f&&!(f instanceof Error)&&(oe(v),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",u||"React class",s,p,typeof f),oe(null)),f instanceof Error&&!(f.message in ze)&&(ze[f.message]=!0,oe(v),x("Failed %s type: %s",s,f.message),oe(null))}}}var cr=Array.isArray;function ve(r){return cr(r)}function fr(r){{var n=typeof Symbol=="function"&&Symbol.toStringTag,s=n&&r[Symbol.toStringTag]||r.constructor.name||"Object";return s}}function pr(r){try{return Ue(r),!1}catch{return!0}}function Ue(r){return""+r}function He(r){if(pr(r))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",fr(r)),Ue(r)}var Q=z.ReactCurrentOwner,vr={key:!0,ref:!0,__self:!0,__source:!0},Ge,Je,me;me={};function mr(r){if(Z.call(r,"ref")){var n=Object.getOwnPropertyDescriptor(r,"ref").get;if(n&&n.isReactWarning)return!1}return r.ref!==void 0}function hr(r){if(Z.call(r,"key")){var n=Object.getOwnPropertyDescriptor(r,"key").get;if(n&&n.isReactWarning)return!1}return r.key!==void 0}function gr(r,n){if(typeof r.ref=="string"&&Q.current&&n&&Q.current.stateNode!==n){var s=F(Q.current.type);me[s]||(x('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',F(Q.current.type),r.ref),me[s]=!0)}}function yr(r,n){{var s=function(){Ge||(Ge=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",n))};s.isReactWarning=!0,Object.defineProperty(r,"key",{get:s,configurable:!0})}}function br(r,n){{var s=function(){Je||(Je=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",n))};s.isReactWarning=!0,Object.defineProperty(r,"ref",{get:s,configurable:!0})}}var xr=function(r,n,s,u,v,h,p){var f={$$typeof:a,type:r,key:n,ref:s,props:p,_owner:h};return f._store={},Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(f,"_self",{configurable:!1,enumerable:!1,writable:!1,value:u}),Object.defineProperty(f,"_source",{configurable:!1,enumerable:!1,writable:!1,value:v}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f};function Cr(r,n,s,u,v){{var h,p={},f=null,S=null;s!==void 0&&(He(s),f=""+s),hr(n)&&(He(n.key),f=""+n.key),mr(n)&&(S=n.ref,gr(n,v));for(h in n)Z.call(n,h)&&!vr.hasOwnProperty(h)&&(p[h]=n[h]);if(r&&r.defaultProps){var y=r.defaultProps;for(h in y)p[h]===void 0&&(p[h]=y[h])}if(f||S){var b=typeof r=="function"?r.displayName||r.name||"Unknown":r;f&&yr(p,b),S&&br(p,b)}return xr(r,f,S,v,u,Q.current,p)}}var he=z.ReactCurrentOwner,Ke=z.ReactDebugCurrentFrame;function V(r){if(r){var n=r._owner,s=se(r.type,r._source,n?n.type:null);Ke.setExtraStackFrame(s)}else Ke.setExtraStackFrame(null)}var ge;ge=!1;function ye(r){return typeof r=="object"&&r!==null&&r.$$typeof===a}function qe(){{if(he.current){var r=F(he.current.type);if(r)return` Check the render method of \``+r+"`."}return""}}function Er(r){return""}var Ze={};function Sr(r){{var n=qe();if(!n){var s=typeof r=="string"?r:r.displayName||r.name;s&&(n=` Check the top-level render call using <`+s+">.")}return n}}function Qe(r,n){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var s=Sr(n);if(Ze[s])return;Ze[s]=!0;var u="";r&&r._owner&&r._owner!==he.current&&(u=" It was passed a child from "+F(r._owner.type)+"."),V(r),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',s,u),V(null)}}function et(r,n){{if(typeof r!="object")return;if(ve(r))for(var s=0;s",f=" Did you accidentally export a JSX literal instead of a component?"):y=typeof r,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",y,f)}var b=Cr(r,n,s,v,h);if(b==null)return b;if(p){var k=n.children;if(k!==void 0)if(u)if(ve(k)){for(var U=0;U0?"{key: someKey, "+T.join(": ..., ")+": ...}":"{key: someKey}";if(!tt[I+be]){var Pr=T.length>0?"{"+T.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`,be,I,Pr,I),tt[I+be]=!0}}return r===i?wr(b):Rr(b),b}}function _r(r,n,s){return rt(r,n,s,!0)}function Tr(r,n,s){return rt(r,n,s,!1)}var Nr=Tr,kr=_r;G.Fragment=i,G.jsx=Nr,G.jsxs=kr}()),G}process.env.NODE_ENV==="production"?D.exports=at():D.exports=nt();var it=D.exports,lt={giga:"LyGi",mega:"LyMe",kilo:"LyKi",hecto:"LyHe",deca:"LyDe",micro:"LyMi",nano:"LyNa"},st={ltr:"fxLTR",rtl:"fxRTL"},Ee={header:"t1Header",hero:"t1Hero",body:"t1Body",footer:"t1Footer"},O={box:"MdBx",text:"MdTxt",icon:"MdIco",button:"MdBtn",separator:"MdSep",image:"MdImg",filler:"mdBxFiller",span:"MdSpn",video:"MdVid",spacer:"mdBxSpacer"},ot={vertical:"vr",horizontal:"hr",baseline:"hr bl"},ut={relative:"",absolute:"ExAbs"},dt={none:"",xs:"spcXs",sm:"spcSm",md:"spcMd",lg:"spcLg",xl:"spcXl",xxl:"spcXXl"},ct={link:"ExBtnL",primary:"ExBtn1",secondary:"ExBtn2"},ft={cover:"ExCover",fit:"ExFit"},pt={xxs:"ExXXs",xs:"ExXs",sm:"ExSm",md:"ExMd",lg:"ExLg",xl:"ExXl",xxl:"ExXXl","3xl":"Ex3Xl","4xl":"Ex4Xl","5xl":"Ex5Xl",full:"ExFull"},vt={start:"ExAlgS",end:"ExAlgE",center:"ExAlgC"},mt={top:"",bottom:"grvB",center:"grvC"},ht={center:"itms-jfcC","flex-start":"itms-jfcS","flex-end":"itms-jfcE","space-between":"itms-jfcSB","space-around":"itms-jfcSA","space-evenly":"itms-jfcSE"},gt={center:"itms-algC","flex-start":"itms-algS","flex-end":"itms-algE"},P={none:"None",xxs:"XXs",xs:"Xs",sm:"Sm",md:"Md",lg:"Lg",xl:"Xl",xxl:"XXl","3xl":"3Xl","4xl":"4Xl","5xl":"5Xl",full:"Full"},yt={0:"fl0",1:"fl1",2:"fl2",3:"fl3"},bt={regular:"ExWR",bold:"ExWB"},xt={none:"",light:"ExBdrWdtLgh",normal:"ExBdrWdtNml",medium:"ExBdrWdtMdm","semi-bold":"ExBdrWdtSbd",bold:"ExBdrWdtBld"},Ct={normal:"ExFntStyNml",italic:"ExFntStyIt"},Et={none:"ExTxtDecNone",underline:"ExTxtDecUl","line-through":"ExTxtDecLt"},A=["none","xxs","xs","sm","md","lg","xl","xxl","3xl","4xl","5xl","full"],w=/^(-?[\d\.]+)px$/,_=/^(-?[\d\.]+)%$/,Se=(e,a)=>{if(!a||a==="none")return e;let t=dt[a]||void 0;return t&&e.addClassNames(t),e},Y=(e,a,t)=>{if(!a)return e;let i=Ne(t)?"L":"T",l=P[a]||void 0;if(l)e.addClassNames(`ExMgn${i}${l}`);else{let o=a.match(w),d=a.match(_);(o||d)&&(i==="T"?e.setStyle("marginTop",a):i==="L"&&e.setStyle("marginLeft",a))}return e},St=(e,a)=>{if(!a)return e;let t=ft[a]||void 0;return t&&e.addClassNames(t),e},$=(e,a,t="height")=>{if(!a)return e;let i=pt[a]||void 0;if(i)e.addClassNames(i);else{let l=a.match(w),o=a.match(_);(l||o)&&e.setStyle(t,a)}return e},Re=(e,a)=>{if(!a)return e;let t=bt[a]||void 0;return t&&e.addClassNames(t),e},Rt=(e,a)=>{let t=100,i=a==null?void 0:a.match(/^([\d.]+):([\d.]+)$/);return i&&(t=Number(i[2])/Number(i[1])*100),e.setStyle("paddingBottom",`${t}%`),e},we=(e,a)=>{if(!a)return e;let t=vt[a]||void 0;return t&&e.addClassNames(t),e},ue=(e,a)=>{if(!a)return e;let t=mt[a]||void 0;return t&&e.addClassNames(t),e},J=(e,a)=>{if(!a)return e;let t=ut[a]||void 0;return t&&e.addClassNames(t),e},wt=(e,a)=>{if(!a)return e;let t=gt[a]||void 0;return t&&e.addClassNames(t),e},_t=(e,a)=>{if(!a)return e;let t=ht[a]||void 0;return t&&e.addClassNames(t),e},K=(e,{offsetBottom:a,offsetEnd:t,offsetStart:i,offsetTop:l})=>{if(!a&&!t&&!i&&!l)return e;if(a)if(A.includes(a))e.addClassNames(`ExB${P[a]}`);else{let o=a.match(w),d=a.match(_);(o||d)&&e.setStyle("bottom",a)}if(l)if(A.includes(l))e.addClassNames(`ExT${P[l]}`);else{let o=l.match(w),d=l.match(_);(o||d)&&e.setStyle("top",l)}if(t)if(A.includes(t))e.addClassNames(`ExR${P[t]}`);else{let o=t.match(w),d=t.match(_);(o||d)&&e.setStyle("right",t)}if(i)if(A.includes(i))e.addClassNames(`ExL${P[i]}`);else{let o=i.match(w),d=i.match(_);(o||d)&&e.setStyle("left",i)}return e},Tt=(e,{paddingAll:a,paddingBottom:t,paddingEnd:i,paddingStart:l,paddingTop:o})=>{if(!a&&!t&&!i&&!l&&!o)return e;if(a)if(A.includes(a))e.addClassNames(`ExPadA${P[a]}`);else{let d=a.match(w),c=a.match(_);(d||c)&&e.setStyle("padding",a)}if(t)if(A.includes(t))e.addClassNames(`ExPadB${P[t]}`);else{let d=t.match(w),c=t.match(_);(d||c)&&e.setStyle("paddingBottom",t)}if(i)if(A.includes(i))e.addClassNames(`ExPadR${P[i]}`);else{let d=i.match(w),c=i.match(_);(d||c)&&e.setStyle("paddingRight",i)}if(l)if(A.includes(l))e.addClassNames(`ExPadL${P[l]}`);else{let d=l.match(w),c=l.match(_);(d||c)&&e.setStyle("paddingLeft",l)}if(o)if(A.includes(o))e.addClassNames(`ExPadT${P[o]}`);else{let d=o.match(w),c=o.match(_);(d||c)&&e.setStyle("paddingTop",o)}return e},L=(e,a)=>{if(a==null)return e;let t=a.toString(),i=yt[t]||void 0;return i?e.addClassNames(i):(e.setStyle("WebkitFlex",t),e.setStyle("flexGrow",t)),e},Nt=(e,a)=>{if(!a)return e;let t=ct[a]||void 0;return t&&e.addClassNames(t),e},ee=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,W=(e,a,t="color")=>(a&&a.match(ee)&&e.setStyle(t,a),e),kt=(e,a)=>{if(!a)return e;if(a.type==="linearGradient"){let{angle:t,startColor:i,endColor:l,centerColor:o,centerPosition:d}=a,c=t==null?void 0:t.match(/^(\d+)deg$/),g=i==null?void 0:i.match(ee),C=l==null?void 0:l.match(ee),E=o==null?void 0:o.match(ee),j=d==null?void 0:d.match(/^([\d.]+)%$/);!o||!d?c&&g&&C&&e.setStyle("background",`linear-gradient(${t}deg, ${i}, ${l})`):c&&g&&E&&j&&C&&e.setStyle("background",`linear-gradient(${t}deg, ${i} 0%, ${o} ${d}, ${l} 100%)`)}return e},Pt=(e,a)=>(a&&e.addClassNames("ExWrap"),e),$t=(e,a)=>{if(!a)return e;let t=xt[a]||void 0;if(t)e.addClassNames(t);else{let i=a.match(w),l=a.match(_);(i||l)&&e.setStyle("borderWidth",a)}return e},jt=(e,a)=>{if(!a)return e;let t=P[a]||void 0;if(t)e.addClassNames(`ExBdrRad${t}`);else{let i=a.match(w),l=a.match(_);(i||l)&&e.setStyle("borderRadius",a)}return e},Ot=(e,a)=>{let t=1,i=a==null?void 0:a.match(/^([\d.]+):([\d.]+)$/);return i&&(t=Number(i[1])/Number(i[2])),e.setStyle("width",`${t}em`),e},_e=(e,a)=>{if(!a)return e;let t=Ct[a]||void 0;return t&&e.addClassNames(t),e},Te=(e,a)=>{if(!a)return e;let t=Et[a]||void 0;return t&&e.addClassNames(t),e},te=(e,a,t,i)=>{if(a){let{separator:l,separatorColor:o,backgroundColor:d}=a;if(e=W(e,d,"backgroundColor"),t!=="header"&&l){let c=$e({type:"separator",color:o});i==null||i.appendChild(c)}}return[e,i]},re=(e,a)=>{if(!a)return e;switch(a.type){case"uri":e.setAttribute("target","_blank"),e.setAttribute("href",a.uri||""),e.setAttribute("onclick",`window.open('${a.uri||""}')`);break;case"message":e.setAttribute("onclick",`alert('Send Message: ${a.text} to chatroom')`);break;case"postback":e.setAttribute("onclick",`alert('Send Postback: ${a.data}')`);break;case"datetimepicker":e.setAttribute("onclick","alert('Open Datepicker')");break;case"clipboard":e.setAttribute("onclick",`window.navigator.clipboard.writeText('${a.clipboardText}').then(() => alert('Copied to Clipboard: ${a.clipboardText}'))`);break}return e.setStyle("cursor","pointer"),e},At=e=>e&&A.includes(e),Ft=e=>e&&(w.test(e)||_.test(e)),Ne=e=>(e==null?void 0:e.type)==="box"&&(e.layout==="horizontal"||e.layout==="baseline"),Dt=e=>e.replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`),m=class{constructor(e,a={},t=[],i={},l=[],o=void 0){X(this,"tagName");X(this,"attributes");X(this,"className");X(this,"style");X(this,"children");X(this,"textContent");this.tagName=e,this.attributes=a,this.className=t,this.style=i,this.children=l,this.textContent=o}getTagName(){return this.tagName}setTextContent(e){this.textContent=e||void 0}getTextContent(){return this.textContent}removeTextContent(){this.textContent=void 0}getAttribute(e){return this.attributes[e]}setAttribute(e,a){this.attributes[e]=a}removeAttribute(e){delete this.attributes[e]}getClassName(){return this.className}addClassName(e){this.className.push(e)}addClassNames(...e){this.className.push(...e)}removeClassName(e){this.className=this.className.filter(a=>a!==e)}getStyle(){return this.style}setStyle(e,a){this.style[e]=a}removeStyle(e){delete this.style[e]}appendChild(e){this.children.push(e)}render(){let e=Object.entries(this.attributes).map(([o,d])=>`${o}="${d}"`).join(" "),a=this.className.join(" "),t=Object.entries(this.style).map(([o,d])=>`${Dt(o)}:${d.replace(/"/g,"").replace(/,/g,";").replace(/\//g,"/")}`).join(";"),i=`${e!==""?e:""} ${a!==""?`class="${a}"`:""} ${t!==""?`style="${t}"`:""}`.trim(),l=this.children.map(o=>o.render()).join("");return`<${this.tagName}${i!==""?` ${i}`:""}>${l!==""?l:this.textContent||""}`}},Lt=e=>{let a=new m("div");if(a.addClassNames("flex-preview"),e.type==="carousel"){let t=Wt(e);a.appendChild(t)}else{let t=ke(e);a.appendChild(t)}return a.render()},Wt=e=>{let a=new m("div");a.addClassName("lyInner");for(let i of e.contents){let l=ke(i);l.addClassNames("lyItem"),a.appendChild(l)}let t=new m("div");return t.addClassName("LySlider"),t.appendChild(a),t},ke=e=>{var a,t,i,l;let o=new m("div");if(o.addClassNames("T1",st[e.direction||"ltr"]),o.setAttribute("dir",e.direction||"ltr"),e.header){let c=de("header",e.header),[g]=te(c,(a=e.styles)==null?void 0:a.header,"header",o);c=g,o.appendChild(c)}if(e.hero){let c=Mt(e.hero),[g,C]=te(c,(t=e.styles)==null?void 0:t.hero,"hero",o);c=g,o=C,o.appendChild(c)}if(e.body){let c=de("body",e.body);e.footer&&c.addClassNames("ExHasFooter");let[g,C]=te(c,(i=e.styles)==null?void 0:i.body,"body",o);c=g,o=C,o.appendChild(c)}if(e.footer){let c=de("footer",e.footer),[g,C]=te(c,(l=e.styles)==null?void 0:l.footer,"footer",o);c=g,o=C,o.appendChild(c)}let d=new m("div");return d.addClassName(lt[e.size||"mega"]),d.appendChild(o),d},de=(e,a)=>{let t=new m("div");t.addClassNames(Ee[e]);let i=Pe(a);return t.appendChild(i),t},Mt=e=>{let a=new m("div");a.addClassNames(Ee.hero);let t=ae(e);return t&&a.appendChild(t),a},Pe=(e,a)=>{let t=new m("div");if(e.contents)for(let i of e.contents){let l=ae(i,e);l&&t.appendChild(l)}return t.addClassNames(O.box,...ot[e.layout||"vertical"].split(" ")),t=J(t,e.position),t=e.height||e.width?L(t,0):L(t,e.flex),t=Se(t,e.spacing),t=Y(t,e.margin,a),t=$(t,e.width,"width"),t=$(t,e.height,"height"),t=$(t,e.maxWidth,"maxWidth"),t=$(t,e.maxHeight,"maxHeight"),t=W(t,e.backgroundColor,"backgroundColor"),t=$t(t,e.borderWidth),t=W(t,e.borderColor,"borderColor"),t=jt(t,e.cornerRadius),t=_t(t,e.justifyContent),t=wt(t,e.alignItems),t=K(t,e),t=Tt(t,e),t=kt(t,e.background),e.action&&(t=re(t,e.action)),t},ae=(e,a)=>{switch(e.type){case"box":return Pe(e,a);case"button":return Bt(e,a);case"image":return It(e,a);case"video":return Ut(e);case"icon":return Xt(e,a);case"text":return Yt(e,a);case"span":return zt(e);case"separator":return $e(e,a);case"filler":return Vt(e);case"spacer":return Ht(e);default:return null}},Bt=(e,a)=>{let t=new m("div");if(t.addClassNames(O.button),e.action){let i=new m("a");i=W(i,e.color,e.style==="primary"||e.style==="secondary"?"backgroundColor":"color");let l=new m("div");l.setTextContent(e.action.label),i.appendChild(l),i=re(i,e.action),t.appendChild(i)}return t=L(t,e.flex),t=J(t,e.position),t=Y(t,e.margin,a),t=$(t,e.height,"height"),t=Nt(t,e.style||"link"),t=ue(t,e.gravity),t=K(t,e),t},It=(e,a)=>{let t=new m("div");t.addClassNames(O.image),t=L(t,e.flex),t=J(t,e.position),t=Y(t,e.margin,a),t=we(t,e.align),t=ue(t,e.gravity),At(e.size||"md")&&(t=$(t,e.size||"md")),t=St(t,e.aspectMode||"fit"),t=K(t,e);let i=new m("span");i.setStyle("background-image",`url("${e.url}")`),i=W(i,e.backgroundColor,"backgroundColor");let l=new m("a");l=Rt(l,e.aspectRatio),l=re(l,e.action),l.appendChild(i);let o=new m("div");return Ft(e.size||"md")&&(o=$(o,e.size,Ne(a)?"width":"height")),o.appendChild(l),t.appendChild(o),t},Xt=(e,a)=>{let t=new m("div");t.addClassNames(O.icon);let i=new m("span");i.setStyle("background-image",`url(${e.url})`),t=J(t,e.position),t=Y(t,e.margin,a),t=$(t,e.size),i=Ot(i,e.aspectRatio),t=K(t,e),t=L(t,0);let l=new m("div");return l.appendChild(i),t.appendChild(l),t},Yt=(e,a)=>{let t=new m("div");if(t.addClassNames(O.text),e.contents&&e.contents.length>0)for(let i of e.contents){let l=ae(i,e);if(!l)continue;let o=new m("p");o.appendChild(l),t.appendChild(o)}else if(e.text){let i=new m("p");if(i.setTextContent(e.text),e.action){let l=new m("a");l=re(l,e.action),l.appendChild(i),t.appendChild(l)}else t.appendChild(i)}return t=L(t,e.flex),t=Y(t,e.margin,a),t=$(t,e.size,"fontSize"),t=$(t,e.lineSpacing,"lineHeight"),t=W(t,e.color,"color"),t=Re(t,e.weight),t=_e(t,e.style),t=Te(t,e.decoration),t=J(t,e.position),t=we(t,e.align),t=ue(t,e.gravity),t=Pt(t,e.wrap),t=K(t,e),t},zt=(e,a)=>{let t=new m("span");return t.addClassNames(O.span),t.setTextContent(e.text),t=$(t,e.size,"fontSize"),t=W(t,e.color,"color"),t=Re(t,e.weight),t=_e(t,e.style),t=Te(t,e.decoration),t},$e=(e,a)=>{let t=new m("div");return t.addClassNames(O.separator),t=Y(t,e.margin,a),t=W(t,e.color,"borderColor"),t},Vt=(e,a)=>{let t=new m("div");return t.addClassNames(O.filler),t=L(t,e.flex),t},Ut=(e,a)=>{let t=new m("div");if(t.addClassNames(O.video),e.altContent){let i=ae(e.altContent);i&&t.appendChild(i)}return t},Ht=(e,a)=>{let t=new m("div");return t.addClassNames(O.spacer),t=L(t,0),t=Se(t,e.size||"md"),t};const Gt=({json:e})=>it.jsx("div",{dangerouslySetInnerHTML:{__html:Lt(e)}});N.FlexPreview=Gt,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})});