@maily-to/render 0.0.18 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -24,13 +24,17 @@ type MetaDescriptor = {
24
24
  };
25
25
  type MetaDescriptors = MetaDescriptor[];
26
26
 
27
+ interface NodeOptions {
28
+ parent?: JSONContent;
29
+ prev?: JSONContent;
30
+ next?: JSONContent;
31
+ payloadValue?: PayloadValue;
32
+ }
27
33
  interface MarkType {
28
34
  [key: string]: any;
29
35
  type: string;
30
36
  attrs?: Record<string, any> | undefined;
31
37
  }
32
- declare const allowedSpacers: readonly ["sm", "md", "lg", "xl"];
33
- type AllowedSpacers = (typeof allowedSpacers)[number];
34
38
  interface ThemeOptions {
35
39
  colors?: Partial<{
36
40
  heading: string;
@@ -47,7 +51,10 @@ interface ThemeOptions {
47
51
  linkCardSubTitle: string;
48
52
  }>;
49
53
  fontSize?: Partial<{
50
- paragraph: string;
54
+ paragraph: {
55
+ size: string;
56
+ lineHeight: string;
57
+ };
51
58
  footer: {
52
59
  size: string;
53
60
  lineHeight: string;
@@ -126,6 +133,8 @@ declare const DEFAULT_COLUMN_PADDING_TOP = 0;
126
133
  declare const DEFAULT_COLUMN_PADDING_RIGHT = 0;
127
134
  declare const DEFAULT_COLUMN_PADDING_BOTTOM = 0;
128
135
  declare const DEFAULT_COLUMN_PADDING_LEFT = 0;
136
+ declare const DEFAULT_INLINE_IMAGE_HEIGHT = 20;
137
+ declare const DEFAULT_INLINE_IMAGE_WIDTH = 20;
129
138
  declare const LINK_PROTOCOL_REGEX: RegExp;
130
139
  declare const DEFAULT_META_TAGS: MetaDescriptors;
131
140
  declare const DEFAULT_HTML_PROPS: HtmlProps;
@@ -265,10 +274,21 @@ declare class Maily {
265
274
  private columns;
266
275
  private adjustColumnsContent;
267
276
  private column;
277
+ private repeat;
278
+ /**
279
+ * @deprecated
280
+ * This for node is an alias for the repeat node
281
+ * we will remove this in the future
282
+ * @param node
283
+ * @param options
284
+ * @returns JSX.Element
285
+ */
268
286
  private for;
269
287
  private shouldShow;
288
+ htmlCodeBlock(node: JSONContent, options?: NodeOptions): JSX.Element;
289
+ private inlineImage;
270
290
  }
271
291
 
272
292
  declare function render(content: JSONContent, config?: MailyConfig & RenderOptions): Promise<string>;
273
293
 
274
- export { type AllowedSpacers, DEFAULT_BUTTON_PADDING_BOTTOM, DEFAULT_BUTTON_PADDING_LEFT, DEFAULT_BUTTON_PADDING_RIGHT, DEFAULT_BUTTON_PADDING_TOP, DEFAULT_COLUMNS_GAP, DEFAULT_COLUMNS_WIDTH, DEFAULT_COLUMN_BACKGROUND_COLOR, DEFAULT_COLUMN_BORDER_COLOR, DEFAULT_COLUMN_BORDER_RADIUS, DEFAULT_COLUMN_BORDER_WIDTH, DEFAULT_COLUMN_PADDING_BOTTOM, DEFAULT_COLUMN_PADDING_LEFT, DEFAULT_COLUMN_PADDING_RIGHT, DEFAULT_COLUMN_PADDING_TOP, DEFAULT_HTML_PROPS, DEFAULT_META_TAGS, DEFAULT_SECTION_ALIGN, DEFAULT_SECTION_BACKGROUND_COLOR, DEFAULT_SECTION_BORDER_COLOR, DEFAULT_SECTION_BORDER_WIDTH, DEFAULT_SECTION_MARGIN_BOTTOM, DEFAULT_SECTION_MARGIN_LEFT, DEFAULT_SECTION_MARGIN_RIGHT, DEFAULT_SECTION_MARGIN_TOP, DEFAULT_SECTION_PADDING_BOTTOM, DEFAULT_SECTION_PADDING_LEFT, DEFAULT_SECTION_PADDING_RIGHT, DEFAULT_SECTION_PADDING_TOP, LINK_PROTOCOL_REGEX, type LinkValues, Maily, type MailyConfig, type MarkType, type PayloadValue, type PayloadValues, type RenderOptions, type ThemeOptions, type VariableFormatter, type VariableValues, render };
294
+ export { DEFAULT_BUTTON_PADDING_BOTTOM, DEFAULT_BUTTON_PADDING_LEFT, DEFAULT_BUTTON_PADDING_RIGHT, DEFAULT_BUTTON_PADDING_TOP, DEFAULT_COLUMNS_GAP, DEFAULT_COLUMNS_WIDTH, DEFAULT_COLUMN_BACKGROUND_COLOR, DEFAULT_COLUMN_BORDER_COLOR, DEFAULT_COLUMN_BORDER_RADIUS, DEFAULT_COLUMN_BORDER_WIDTH, DEFAULT_COLUMN_PADDING_BOTTOM, DEFAULT_COLUMN_PADDING_LEFT, DEFAULT_COLUMN_PADDING_RIGHT, DEFAULT_COLUMN_PADDING_TOP, DEFAULT_HTML_PROPS, DEFAULT_INLINE_IMAGE_HEIGHT, DEFAULT_INLINE_IMAGE_WIDTH, DEFAULT_META_TAGS, DEFAULT_SECTION_ALIGN, DEFAULT_SECTION_BACKGROUND_COLOR, DEFAULT_SECTION_BORDER_COLOR, DEFAULT_SECTION_BORDER_WIDTH, DEFAULT_SECTION_MARGIN_BOTTOM, DEFAULT_SECTION_MARGIN_LEFT, DEFAULT_SECTION_MARGIN_RIGHT, DEFAULT_SECTION_MARGIN_TOP, DEFAULT_SECTION_PADDING_BOTTOM, DEFAULT_SECTION_PADDING_LEFT, DEFAULT_SECTION_PADDING_RIGHT, DEFAULT_SECTION_PADDING_TOP, LINK_PROTOCOL_REGEX, type LinkValues, Maily, type MailyConfig, type MarkType, type PayloadValue, type PayloadValues, type RenderOptions, type ThemeOptions, type VariableFormatter, type VariableValues, render };
package/dist/index.d.ts CHANGED
@@ -24,13 +24,17 @@ type MetaDescriptor = {
24
24
  };
25
25
  type MetaDescriptors = MetaDescriptor[];
26
26
 
27
+ interface NodeOptions {
28
+ parent?: JSONContent;
29
+ prev?: JSONContent;
30
+ next?: JSONContent;
31
+ payloadValue?: PayloadValue;
32
+ }
27
33
  interface MarkType {
28
34
  [key: string]: any;
29
35
  type: string;
30
36
  attrs?: Record<string, any> | undefined;
31
37
  }
32
- declare const allowedSpacers: readonly ["sm", "md", "lg", "xl"];
33
- type AllowedSpacers = (typeof allowedSpacers)[number];
34
38
  interface ThemeOptions {
35
39
  colors?: Partial<{
36
40
  heading: string;
@@ -47,7 +51,10 @@ interface ThemeOptions {
47
51
  linkCardSubTitle: string;
48
52
  }>;
49
53
  fontSize?: Partial<{
50
- paragraph: string;
54
+ paragraph: {
55
+ size: string;
56
+ lineHeight: string;
57
+ };
51
58
  footer: {
52
59
  size: string;
53
60
  lineHeight: string;
@@ -126,6 +133,8 @@ declare const DEFAULT_COLUMN_PADDING_TOP = 0;
126
133
  declare const DEFAULT_COLUMN_PADDING_RIGHT = 0;
127
134
  declare const DEFAULT_COLUMN_PADDING_BOTTOM = 0;
128
135
  declare const DEFAULT_COLUMN_PADDING_LEFT = 0;
136
+ declare const DEFAULT_INLINE_IMAGE_HEIGHT = 20;
137
+ declare const DEFAULT_INLINE_IMAGE_WIDTH = 20;
129
138
  declare const LINK_PROTOCOL_REGEX: RegExp;
130
139
  declare const DEFAULT_META_TAGS: MetaDescriptors;
131
140
  declare const DEFAULT_HTML_PROPS: HtmlProps;
@@ -265,10 +274,21 @@ declare class Maily {
265
274
  private columns;
266
275
  private adjustColumnsContent;
267
276
  private column;
277
+ private repeat;
278
+ /**
279
+ * @deprecated
280
+ * This for node is an alias for the repeat node
281
+ * we will remove this in the future
282
+ * @param node
283
+ * @param options
284
+ * @returns JSX.Element
285
+ */
268
286
  private for;
269
287
  private shouldShow;
288
+ htmlCodeBlock(node: JSONContent, options?: NodeOptions): JSX.Element;
289
+ private inlineImage;
270
290
  }
271
291
 
272
292
  declare function render(content: JSONContent, config?: MailyConfig & RenderOptions): Promise<string>;
273
293
 
274
- export { type AllowedSpacers, DEFAULT_BUTTON_PADDING_BOTTOM, DEFAULT_BUTTON_PADDING_LEFT, DEFAULT_BUTTON_PADDING_RIGHT, DEFAULT_BUTTON_PADDING_TOP, DEFAULT_COLUMNS_GAP, DEFAULT_COLUMNS_WIDTH, DEFAULT_COLUMN_BACKGROUND_COLOR, DEFAULT_COLUMN_BORDER_COLOR, DEFAULT_COLUMN_BORDER_RADIUS, DEFAULT_COLUMN_BORDER_WIDTH, DEFAULT_COLUMN_PADDING_BOTTOM, DEFAULT_COLUMN_PADDING_LEFT, DEFAULT_COLUMN_PADDING_RIGHT, DEFAULT_COLUMN_PADDING_TOP, DEFAULT_HTML_PROPS, DEFAULT_META_TAGS, DEFAULT_SECTION_ALIGN, DEFAULT_SECTION_BACKGROUND_COLOR, DEFAULT_SECTION_BORDER_COLOR, DEFAULT_SECTION_BORDER_WIDTH, DEFAULT_SECTION_MARGIN_BOTTOM, DEFAULT_SECTION_MARGIN_LEFT, DEFAULT_SECTION_MARGIN_RIGHT, DEFAULT_SECTION_MARGIN_TOP, DEFAULT_SECTION_PADDING_BOTTOM, DEFAULT_SECTION_PADDING_LEFT, DEFAULT_SECTION_PADDING_RIGHT, DEFAULT_SECTION_PADDING_TOP, LINK_PROTOCOL_REGEX, type LinkValues, Maily, type MailyConfig, type MarkType, type PayloadValue, type PayloadValues, type RenderOptions, type ThemeOptions, type VariableFormatter, type VariableValues, render };
294
+ export { DEFAULT_BUTTON_PADDING_BOTTOM, DEFAULT_BUTTON_PADDING_LEFT, DEFAULT_BUTTON_PADDING_RIGHT, DEFAULT_BUTTON_PADDING_TOP, DEFAULT_COLUMNS_GAP, DEFAULT_COLUMNS_WIDTH, DEFAULT_COLUMN_BACKGROUND_COLOR, DEFAULT_COLUMN_BORDER_COLOR, DEFAULT_COLUMN_BORDER_RADIUS, DEFAULT_COLUMN_BORDER_WIDTH, DEFAULT_COLUMN_PADDING_BOTTOM, DEFAULT_COLUMN_PADDING_LEFT, DEFAULT_COLUMN_PADDING_RIGHT, DEFAULT_COLUMN_PADDING_TOP, DEFAULT_HTML_PROPS, DEFAULT_INLINE_IMAGE_HEIGHT, DEFAULT_INLINE_IMAGE_WIDTH, DEFAULT_META_TAGS, DEFAULT_SECTION_ALIGN, DEFAULT_SECTION_BACKGROUND_COLOR, DEFAULT_SECTION_BORDER_COLOR, DEFAULT_SECTION_BORDER_WIDTH, DEFAULT_SECTION_MARGIN_BOTTOM, DEFAULT_SECTION_MARGIN_LEFT, DEFAULT_SECTION_MARGIN_RIGHT, DEFAULT_SECTION_MARGIN_TOP, DEFAULT_SECTION_PADDING_BOTTOM, DEFAULT_SECTION_PADDING_LEFT, DEFAULT_SECTION_PADDING_RIGHT, DEFAULT_SECTION_PADDING_TOP, LINK_PROTOCOL_REGEX, type LinkValues, Maily, type MailyConfig, type MarkType, type PayloadValue, type PayloadValues, type RenderOptions, type ThemeOptions, type VariableFormatter, type VariableValues, render };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var k=Object.defineProperty,mt=Object.defineProperties,ft=Object.getOwnPropertyDescriptor,gt=Object.getOwnPropertyDescriptors,xt=Object.getOwnPropertyNames,R=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var U=(a,t,e)=>t in a?k(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,g=(a,t)=>{for(var e in t||(t={}))I.call(t,e)&&U(a,e,t[e]);if(R)for(var e of R(t))W.call(t,e)&&U(a,e,t[e]);return a},y=(a,t)=>mt(a,gt(t));var V=(a,t)=>{var e={};for(var n in a)I.call(a,n)&&t.indexOf(n)<0&&(e[n]=a[n]);if(a!=null&&R)for(var n of R(a))t.indexOf(n)<0&&W.call(a,n)&&(e[n]=a[n]);return e};var yt=(a,t)=>{for(var e in t)k(a,e,{get:t[e],enumerable:!0})},St=(a,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of xt(t))!I.call(a,r)&&r!==e&&k(a,r,{get:()=>t[r],enumerable:!(n=ft(t,r))||n.enumerable});return a};var bt=a=>St(k({},"__esModule",{value:!0}),a);var M=(a,t,e)=>new Promise((n,r)=>{var o=p=>{try{l(e.next(p))}catch(u){r(u)}},s=p=>{try{l(e.throw(p))}catch(u){r(u)}},l=p=>p.done?n(p.value):Promise.resolve(p.value).then(o,s);l((e=e.apply(a,t)).next())});var Ft={};yt(Ft,{DEFAULT_BUTTON_PADDING_BOTTOM:()=>ht,DEFAULT_BUTTON_PADDING_LEFT:()=>dt,DEFAULT_BUTTON_PADDING_RIGHT:()=>ut,DEFAULT_BUTTON_PADDING_TOP:()=>pt,DEFAULT_COLUMNS_GAP:()=>st,DEFAULT_COLUMNS_WIDTH:()=>Mt,DEFAULT_COLUMN_BACKGROUND_COLOR:()=>Lt,DEFAULT_COLUMN_BORDER_COLOR:()=>Rt,DEFAULT_COLUMN_BORDER_RADIUS:()=>At,DEFAULT_COLUMN_BORDER_WIDTH:()=>Dt,DEFAULT_COLUMN_PADDING_BOTTOM:()=>Pt,DEFAULT_COLUMN_PADDING_LEFT:()=>Jt,DEFAULT_COLUMN_PADDING_RIGHT:()=>Vt,DEFAULT_COLUMN_PADDING_TOP:()=>kt,DEFAULT_HTML_PROPS:()=>ct,DEFAULT_META_TAGS:()=>lt,DEFAULT_SECTION_ALIGN:()=>q,DEFAULT_SECTION_BACKGROUND_COLOR:()=>$,DEFAULT_SECTION_BORDER_COLOR:()=>Y,DEFAULT_SECTION_BORDER_WIDTH:()=>K,DEFAULT_SECTION_MARGIN_BOTTOM:()=>tt,DEFAULT_SECTION_MARGIN_LEFT:()=>et,DEFAULT_SECTION_MARGIN_RIGHT:()=>Z,DEFAULT_SECTION_MARGIN_TOP:()=>Q,DEFAULT_SECTION_PADDING_BOTTOM:()=>ot,DEFAULT_SECTION_PADDING_LEFT:()=>it,DEFAULT_SECTION_PADDING_RIGHT:()=>rt,DEFAULT_SECTION_PADDING_TOP:()=>nt,LINK_PROTOCOL_REGEX:()=>at,Maily:()=>D,render:()=>Bt});module.exports=bt(Ft);var F=require("react"),c=require("@react-email/components"),G=require("@react-email/render");var Ot=a=>Object.prototype.toString.call(a);var wt=a=>Ot(a)==="[object Object]";function Ct(a){return Object.keys(a)}function J(a,...t){if(!t.length)return a;let e=t.shift();return e===void 0?a:(P(a)&&P(e)&&Ct(e).forEach(n=>{n==="__proto__"||n==="constructor"||n==="prototype"||(P(e[n])?(a[n]||(a[n]={}),P(a[n])?J(a[n],e[n]):a[n]=e[n]):a[n]=e[n])}),J(a,...t))}function P(a){return wt(a)&&!Array.isArray(a)}var jt=Symbol("p-void");function B(){return Math.random().toString(36).substr(2,6)}var L=require("react/jsx-runtime");function z(a){return a.filter((t,e,n)=>{let r=X(t);return e===n.findIndex(o=>X(o)===r)}).map(Tt).filter(Boolean)}function Tt(a){if("tagName"in a){let t=a,{tagName:e}=t,n=V(t,["tagName"]);return(0,L.jsx)(e,g({},n),JSON.stringify(n))}return"title"in a?(0,L.jsx)("title",{children:a.title}):"charSet"in a?(0,L.jsx)("meta",{charSet:a.charSet}):(0,L.jsx)("meta",g({},a),JSON.stringify(a))}function X(a){let t=Object.keys(a).sort().reduce((e,n)=>{let r=n;return e[r]=a[r],e},{});return JSON.stringify(t)}var i=require("react/jsx-runtime");var Nt={sm:"8px",md:"16px",lg:"32px",xl:"64px"},A={WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"};var vt={h1:{fontSize:"36px",lineHeight:"40px",fontWeight:800},h2:{fontSize:"30px",lineHeight:"36px",fontWeight:700},h3:{fontSize:"24px",lineHeight:"38px",fontWeight:600}};var H={sm:"40px",md:"48px",lg:"64px"},Et={pretty:!1,plainText:!1},j={colors:{heading:"#111827",paragraph:"#374151",horizontal:"#EAEAEA",footer:"#64748B",blockquoteBorder:"#D1D5DB",codeBackground:"#EFEFEF",codeText:"#111827",linkCardTitle:"#111827",linkCardDescription:"#6B7280",linkCardBadgeText:"#111827",linkCardBadgeBackground:"#FEF08A",linkCardSubTitle:"#6B7280"},fontSize:{paragraph:"15px",footer:{size:"14px",lineHeight:"24px"}}},_t='SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',$="#ffffff",q="left",K=1,Y="#000000",Q=0,Z=0,tt=0,et=0,nt=5,rt=5,ot=5,it=5,Mt="100%",st=8,Lt="transparent",At=0,Dt=0,Rt="transparent",kt=0,Vt=0,Pt=0,Jt=0,at=/https?:\/\//,lt=[{name:"viewport",content:"width=device-width"},{httpEquiv:"X-UA-Compatible",content:"IE=edge"},{name:"x-apple-disable-message-reformatting"},{name:"format-detection",content:"telephone=no,address=no,email=no,date=no,url=no"},{name:"color-scheme",content:"light"},{name:"supported-color-schemes",content:"light"}],ct={lang:"en",dir:"ltr"},pt=10,ut=32,ht=10,dt=32,D=class{constructor(t={type:"doc",content:[]}){this.config={theme:j};this.variableFormatter=({variable:t,fallback:e})=>e?`{{${t},fallback=${e}}}`:`{{${t}}}`;this.shouldReplaceVariableValues=!1;this.variableValues=new Map;this.linkValues=new Map;this.payloadValues=new Map;this.marksOrder=["underline","bold","italic","textStyle","link"];this.meta=lt;this.htmlProps=ct;this.content=t}setPreviewText(t){this.config.preview=t}setTheme(t){this.config.theme=J(this.config.theme||j,t)}setVariableFormatter(t){this.variableFormatter=t}setVariableValue(t,e){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.variableValues.set(t,e)}setVariableValues(t){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),Object.entries(t).forEach(([e,n])=>{this.setVariableValue(e,n)})}setLinkValue(t,e){this.linkValues.set(t,e)}setLinkValues(t){Object.entries(t).forEach(([e,n])=>{this.setLinkValue(e,n)})}setPayloadValue(t,e){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.payloadValues.set(t,e)}setPayloadValues(t){Object.entries(t).forEach(([e,n])=>{this.setPayloadValue(e,n)})}setOpenTrackingPixel(t){this.openTrackingPixel=t}setShouldReplaceVariableValues(t){this.shouldReplaceVariableValues=t}setMetaTags(t){this.meta.push(...t)}setHtmlProps(t){this.htmlProps=g(g({},this.htmlProps),t)}getAllLinks(){let t=this.content.content||[],e=new Set,n=o=>o&&this.isValidUrl(o)&&!o.startsWith("#")&&!o.startsWith("mailto:")&&!o.startsWith("tel:")&&typeof o=="string",r=o=>{var s;if(o.type==="button"){let l=(s=o.attrs)==null?void 0:s.url;n(l)&&l&&e.add(l)}else o.content&&o.content.forEach(l=>{l.marks&&l.marks.forEach(p=>{var h;let u=(h=p.attrs)==null?void 0:h.href;p.type==="link"&&n(u)&&e.add(u)}),l.content&&r(l)})};return t.forEach(o=>{r(o)}),e}isValidUrl(t){try{let e=new URL(t);return!0}catch(e){return!1}}render(){return M(this,arguments,function*(t=Et){let e=this.markup();return(0,G.renderAsync)(e,t)})}markup(){let t=this.content.content||[],e=t.map((l,p)=>{let u={prev:t[p-1],next:t[p+1],parent:l},h=this.renderNode(l,u);return h?(0,i.jsx)(F.Fragment,{children:h},B()):null}),{preview:n}=this.config,r=z(this.meta),o=this.htmlProps;return(0,i.jsxs)(c.Html,y(g({},o),{children:[(0,i.jsxs)(c.Head,{children:[(0,i.jsx)(c.Font,{fallbackFontFamily:"sans-serif",fontFamily:"Inter",fontStyle:"normal",fontWeight:400,webFont:{url:"https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19",format:"woff2"}}),(0,i.jsx)("style",{dangerouslySetInnerHTML:{__html:"blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}@media only screen and (max-width:425px){.tab-row-full{width:100%!important}.tab-col-full{display:block!important;width:100%!important}.tab-pad{padding:0!important}}"}}),r]}),(0,i.jsxs)(c.Body,{style:{margin:0},children:[n?(0,i.jsx)(c.Preview,{id:"__react-email-preview",children:n}):null,(0,i.jsx)(c.Container,{style:{maxWidth:"600px",minWidth:"300px",width:"100%",marginLeft:"auto",marginRight:"auto",padding:"0.5rem"},children:e}),this.openTrackingPixel?(0,i.jsx)(c.Img,{alt:"",src:this.openTrackingPixel,style:{display:"none",width:"1px",height:"1px"}}):null]})]}))}getMarginOverrideConditions(t,e){let{parent:n,prev:r,next:o}=e||{},s=(o==null?void 0:o.type)==="spacer",l=(r==null?void 0:r.type)==="spacer",p=(n==null?void 0:n.type)==="listItem",u=(n==null?void 0:n.type)==="section"&&!o,h=(n==null?void 0:n.type)==="section"&&!r,m=(n==null?void 0:n.type)==="column"&&!o,d=(n==null?void 0:n.type)==="column"&&!r,f=(n==null?void 0:n.type)==="for"&&!r,x=(n==null?void 0:n.type)==="for"&&!o,S=(n==null?void 0:n.type)==="show"&&!r,b=(n==null?void 0:n.type)==="show"&&!o;return{isNextSpacer:s,isPrevSpacer:l,isLastSectionElement:u,isFirstSectionElement:h,isParentListItem:p,isLastColumnElement:m,isFirstColumnElement:d,isFirstForElement:f,isLastForElement:x,isFirstShowElement:S,isLastShowElement:b,shouldRemoveTopMargin:l||h||d||f||S,shouldRemoveBottomMargin:s||u||m||x||b}}getMappedContent(t,e){let n=t.content||[];return n.map((r,o)=>{let s=this.renderNode(r,y(g({},e),{next:n[o+1],prev:n[o-1]}));return s?(0,i.jsx)(F.Fragment,{children:s},B()):null}).filter(r=>r!==null)}renderNode(t,e={}){var r;let n=t.type||"";if(n in this)return(r=this[n])==null?void 0:r.call(this,t,e);throw new Error(`Node type "${n}" is not supported.`)}renderMark(t,e){let n=(t==null?void 0:t.text)||(0,i.jsx)(i.Fragment,{children:"\xA0"}),r=(t==null?void 0:t.marks)||[];return r.sort((o,s)=>this.marksOrder.indexOf(o.type)-this.marksOrder.indexOf(s.type)),r.reduce((o,s)=>{var p;let l=s.type;if(l in this)return(p=this[l])==null?void 0:p.call(this,s,o);throw new Error(`Mark type "${l}" is not supported.`)},(0,i.jsx)(i.Fragment,{children:n}))}paragraph(t,e){var p,u,h,m;let{attrs:n}=t,r=(n==null?void 0:n.textAlign)||"left",{isParentListItem:o,shouldRemoveBottomMargin:s}=this.getMarginOverrideConditions(t,e);return this.shouldShow(t,e)?(0,i.jsx)(c.Text,{style:g(y(g({},r!=="left"?{textAlign:r}:{}),{marginBottom:o||s?"0px":"20px",marginTop:"0px",fontSize:(u=(p=this.config.theme)==null?void 0:p.fontSize)==null?void 0:u.paragraph,color:(m=(h=this.config.theme)==null?void 0:h.colors)==null?void 0:m.paragraph}),A),children:t.content?this.getMappedContent(t,y(g({},e),{parent:t})):(0,i.jsx)(i.Fragment,{children:"\xA0"})}):(0,i.jsx)(i.Fragment,{})}text(t,e){let n=t.text||"&nbsp";return t.marks?this.renderMark(t,e):(0,i.jsx)(i.Fragment,{children:n})}bold(t,e){return(0,i.jsx)("strong",{children:e})}italic(t,e){return(0,i.jsx)("em",{children:e})}underline(t,e){return(0,i.jsx)("u",{children:e})}strike(t,e){return(0,i.jsx)("s",{style:{textDecoration:"line-through"},children:e})}textStyle(t,e){var o,s;let{attrs:n}=t,{color:r=(s=(o=this.config.theme)==null?void 0:o.colors)==null?void 0:s.paragraph}=n||{};return(0,i.jsx)("span",{style:{color:r},children:e})}link(t,e,n){var u,h,m;let{attrs:r}=t,o=(r==null?void 0:r.href)||"#",s=(r==null?void 0:r.target)||"_blank",l=(r==null?void 0:r.rel)||"noopener noreferrer nofollow";if((u=r==null?void 0:r.isUrlVariable)!=null?u:!1){let d=this.removeLinkProtocol(o);o=this.variableUrlValue(d,n)}else o=this.linkValues.get(o)||o;return(0,i.jsx)(c.Link,{href:o,rel:l,style:{fontWeight:500,textDecoration:"none",color:(m=(h=this.config.theme)==null?void 0:h.colors)==null?void 0:m.heading},target:s,children:e})}removeLinkProtocol(t){return t.replace(at,"")}variableUrlValue(t,e){var o,s;let{payloadValue:n}=e||{},r=this.removeLinkProtocol(t);return(s=(o=typeof n=="object"?n[r]:n)!=null?o:this.variableValues.get(r))!=null?s:t}heading(t,e){var m,d;let{attrs:n}=t,r=`h${Number(n==null?void 0:n.level)||1}`,o=(n==null?void 0:n.textAlign)||"left",{shouldRemoveBottomMargin:s}=this.getMarginOverrideConditions(t,e),{fontSize:l,lineHeight:p,fontWeight:u}=vt[r];return this.shouldShow(t,e)?(0,i.jsx)(c.Heading,{as:r,style:{textAlign:o,color:(d=(m=this.config.theme)==null?void 0:m.colors)==null?void 0:d.heading,marginBottom:s?"0":"12px",marginTop:0,fontSize:l,lineHeight:p,fontWeight:u},children:this.getMappedContent(t,y(g({},e),{parent:t}))}):(0,i.jsx)(i.Fragment,{})}variable(t,e){var p,u,h;let{payloadValue:n}=e||{},{id:r,fallback:o}=t.attrs||{};if(!this.shouldShow(t,e)||!r)return(0,i.jsx)(i.Fragment,{});let l=this.variableFormatter({variable:r,fallback:o});return this.shouldReplaceVariableValues&&(l=(h=(u=(p=typeof n=="object"?n[r]:n)!=null?p:this.variableValues.get(r))!=null?u:o)!=null?h:l),t!=null&&t.marks?this.renderMark({text:l,marks:t.marks},e):(0,i.jsx)(i.Fragment,{children:l})}horizontalRule(t,e){return(0,i.jsx)(c.Hr,{style:{marginTop:"32px",marginBottom:"32px"}})}orderedList(t,e){let{shouldRemoveBottomMargin:n}=this.getMarginOverrideConditions(t,e);return(0,i.jsx)(c.Container,{children:(0,i.jsx)("ol",{style:{marginTop:"0px",marginBottom:n?"0":"20px",paddingLeft:"26px",listStyleType:"decimal"},children:this.getMappedContent(t,y(g({},e),{parent:t}))})})}bulletList(t,e){let{parent:n,next:r}=e||{},{shouldRemoveBottomMargin:o}=this.getMarginOverrideConditions(t,{parent:n,next:r});return(0,i.jsx)(c.Container,{style:{maxWidth:"100%"},children:(0,i.jsx)("ul",{style:{marginTop:"0px",marginBottom:o?"0":"20px",paddingLeft:"26px",listStyleType:"disc"},children:this.getMappedContent(t,y(g({},e),{parent:t}))})})}listItem(t,e){return(0,i.jsx)("li",{style:g({marginBottom:"8px",paddingLeft:"6px"},A),children:this.getMappedContent(t,y(g({},e),{parent:t}))})}button(t,e){let{attrs:n}=t,{text:r,isTextVariable:o,url:s,isUrlVariable:l,variant:p,buttonColor:u,textColor:h,borderRadius:m,alignment:d="left",paddingTop:f=pt,paddingRight:x=ut,paddingBottom:S=ht,paddingLeft:b=dt}=n||{};if(!this.shouldShow(t,e))return(0,i.jsx)(i.Fragment,{});let O="0px";m==="round"?O="9999px":m==="smooth"&&(O="6px");let{shouldRemoveBottomMargin:w}=this.getMarginOverrideConditions(t,e),T=l?this.variableUrlValue(s,e):this.linkValues.get(s)||s,N=o?this.variableUrlValue(r,e):r;return f+=2,S+=2,(0,i.jsx)(c.Container,{style:{textAlign:d,maxWidth:"100%",marginBottom:w?"0px":"20px"},children:(0,i.jsx)(c.Button,{href:T,style:{color:String(h),backgroundColor:p==="filled"?String(u):"transparent",borderColor:String(u),borderWidth:"2px",borderStyle:"solid",textDecoration:"none",fontSize:"14px",fontWeight:500,borderRadius:O,padding:`${f}px ${x}px ${S}px ${b}px`},children:N})})}spacer(t,e){let{attrs:n}=t,{height:r="auto"}=n||{};return this.shouldShow(t,e)?(0,i.jsx)(c.Container,{style:{height:Nt[r]||r}}):(0,i.jsx)(i.Fragment,{})}hardBreak(t,e){return(0,i.jsx)("br",{})}logo(t,e){let{attrs:n}=t,{src:r,isSrcVariable:o,alt:s,title:l,size:p,alignment:u="left"}=n||{};if(!this.shouldShow(t,e))return(0,i.jsx)(i.Fragment,{});r=o?this.variableUrlValue(r,e):r;let{shouldRemoveBottomMargin:m}=this.getMarginOverrideConditions(t,e);return(0,i.jsx)(c.Row,{style:{marginTop:"0px",marginBottom:m?"0px":"32px"},children:(0,i.jsx)(c.Column,{align:u,children:(0,i.jsx)(c.Img,{alt:s||l||"Logo",src:r,style:{width:H[p]||p,height:H[p]||p},title:l||s||"Logo"})})})}image(t,e){let{attrs:n}=t,{src:r,isSrcVariable:o,alt:s,title:l,width:p="auto",alignment:u="center",externalLink:h="",isExternalLinkVariable:m}=n||{};if(!this.shouldShow(t,e))return(0,i.jsx)(i.Fragment,{});let{shouldRemoveBottomMargin:f}=this.getMarginOverrideConditions(t,e);r=o?this.variableUrlValue(r,e):r,h=m?this.variableUrlValue(h,e):h;let x=p==="auto"?"auto":Number(p),S=x==="auto"?"auto":`${x}px`,b=(0,i.jsx)(c.Img,{alt:s||l||"Image",src:r,style:{width:S,maxWidth:"100%",outline:"none",border:"none",textDecoration:"none",display:"block"},title:l||s||"Image"});return(0,i.jsx)(c.Row,{style:{marginTop:"0px",marginBottom:f?"0px":"32px"},children:(0,i.jsx)(c.Column,{align:u,children:h?(0,i.jsx)("a",{href:h,rel:"noopener noreferrer",style:{display:"block",maxWidth:"100%",textDecoration:"none"},target:"_blank",children:b}):b})})}footer(t,e){var s,l,p,u,h,m,d,f;let{attrs:n}=t,{textAlign:r="left"}=n||{},{shouldRemoveBottomMargin:o}=this.getMarginOverrideConditions(t,e);return(0,i.jsx)(c.Text,{style:g({fontSize:(p=(l=(s=this.config.theme)==null?void 0:s.fontSize)==null?void 0:l.footer)==null?void 0:p.size,lineHeight:(m=(h=(u=this.config.theme)==null?void 0:u.fontSize)==null?void 0:h.footer)==null?void 0:m.lineHeight,color:(f=(d=this.config.theme)==null?void 0:d.colors)==null?void 0:f.footer,marginTop:"0px",marginBottom:o?"0px":"20px",textAlign:r},A),children:this.getMappedContent(t,y(g({},e),{parent:t}))})}blockquote(t,e){var o,s;let{isPrevSpacer:n,shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,e);return(0,i.jsx)("blockquote",{style:{borderLeftWidth:"4px",borderLeftStyle:"solid",borderLeftColor:(s=(o=this.config.theme)==null?void 0:o.colors)==null?void 0:s.blockquoteBorder,paddingLeft:"16px",marginLeft:"0px",marginRight:"0px",marginTop:n?"0px":"20px",marginBottom:r?"0px":"20px"},children:this.getMappedContent(t,y(g({},e),{parent:t}))})}code(t,e){var n,r,o,s;return(0,i.jsx)("code",{style:{backgroundColor:(r=(n=this.config.theme)==null?void 0:n.colors)==null?void 0:r.codeBackground,color:(s=(o=this.config.theme)==null?void 0:o.colors)==null?void 0:s.codeText,padding:"2px 4px",borderRadius:"6px",fontFamily:_t,fontWeight:400,letterSpacing:0},children:e})}linkCard(t,e){var f,x,S,b,C,O,w,T,N,E,v,_;let{attrs:n}=t,{shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,e),{title:o,description:s,link:l,linkTitle:p,image:u,badgeText:h,subTitle:m}=n||{},d=this.linkValues.get(l)||this.variableValues.get(l)||l||"#";return(0,i.jsxs)("a",{href:d,rel:"noopener noreferrer",style:{border:"1px solid #eaeaea",borderRadius:"10px",textDecoration:"none",color:"inherit",display:"block",marginBottom:r?"0px":"20px"},target:"_blank",children:[u?(0,i.jsx)(c.Row,{style:{marginBottom:"6px"},children:(0,i.jsx)(c.Column,{style:{width:"100%",height:"100%"},children:(0,i.jsx)(c.Img,{alt:o||"Link Card",src:u,style:{borderRadius:"10px 10px 0 0",width:"100%",height:"100%",objectFit:"cover"},title:o||"Link Card"})})}):null,(0,i.jsx)(c.Row,{style:{padding:"15px",marginTop:0,marginBottom:0},children:(0,i.jsxs)(c.Column,{style:{verticalAlign:"top"},children:[(0,i.jsxs)(c.Row,{align:void 0,style:{marginBottom:"8px",marginTop:"0px"},width:"auto",children:[(0,i.jsx)(c.Column,{children:(0,i.jsx)(c.Text,{style:g({fontSize:"18px",fontWeight:600,color:(x=(f=this.config.theme)==null?void 0:f.colors)==null?void 0:x.linkCardTitle,margin:"0px"},A),children:o})}),h||m?(0,i.jsxs)(c.Column,{style:{paddingLeft:"6px",verticalAlign:"middle"},children:[h?(0,i.jsx)("span",{style:{fontWeight:600,color:(b=(S=this.config.theme)==null?void 0:S.colors)==null?void 0:b.linkCardBadgeText,padding:"4px 8px",borderRadius:"8px",backgroundColor:(O=(C=this.config.theme)==null?void 0:C.colors)==null?void 0:O.linkCardBadgeBackground,fontSize:"12px",lineHeight:"12px"},children:h}):null," ",m&&!h?(0,i.jsx)("span",{style:{fontWeight:"normal",color:(T=(w=this.config.theme)==null?void 0:w.colors)==null?void 0:T.linkCardSubTitle,fontSize:"12px",lineHeight:"12px"},children:m}):null]}):null]}),(0,i.jsxs)(c.Text,{style:g({fontSize:"16px",color:(E=(N=this.config.theme)==null?void 0:N.colors)==null?void 0:E.linkCardDescription,marginTop:"0px",marginBottom:"0px"},A),children:[s," ",p?(0,i.jsx)("a",{href:d,rel:"noopener noreferrer",style:{color:(_=(v=this.config.theme)==null?void 0:v.colors)==null?void 0:_.linkCardTitle,fontSize:"14px",fontWeight:600,textDecoration:"underline"},children:p}):null]})]})})]})}section(t,e){let{attrs:n}=t,{borderRadius:r=0,backgroundColor:o=$,align:s=q,borderWidth:l=K,borderColor:p=Y,marginTop:u=Q,marginRight:h=Z,marginBottom:m=tt,marginLeft:d=et,paddingTop:f=nt,paddingRight:x=rt,paddingBottom:S=ot,paddingLeft:b=it}=n||{};return this.shouldShow(t,e)?(0,i.jsx)(c.Row,{style:{marginTop:u,marginRight:h,marginBottom:m,marginLeft:d},children:(0,i.jsx)(c.Column,{align:s,style:{borderColor:p,borderWidth:l,borderStyle:"solid",backgroundColor:o,borderRadius:r,paddingTop:f,paddingRight:x,paddingBottom:S,paddingLeft:b},children:this.getMappedContent(t,y(g({},e),{parent:t}))})}):(0,i.jsx)(i.Fragment,{})}columns(t,e){let{attrs:n}=t;if(!this.shouldShow(t,e))return(0,i.jsx)(i.Fragment,{});let[o,s]=this.adjustColumnsContent(t);return(0,i.jsx)(c.Row,{width:`${s}%`,style:{margin:0,padding:0,width:`${s}%`},className:"tab-row-full",children:this.getMappedContent(o,y(g({},e),{parent:o}))})}adjustColumnsContent(t){var m;let{content:e=[]}=t,n=100,r=e.filter(d=>{var f;return d.type==="column"&&!!Number(((f=d.attrs)==null?void 0:f.width)||0)}),o=e.filter(d=>{var f,x;return d.type==="column"&&(((f=d.attrs)==null?void 0:f.width)==="auto"||!((x=d.attrs)!=null&&x.width))}),s=r.reduce((d,f)=>{var x;return d+Number((x=f.attrs)==null?void 0:x.width)},0),l=n-s,p=Math.round(l/o.length),u=e.filter(d=>d.type==="column").length,h=((m=t.attrs)==null?void 0:m.gap)||st;return[y(g({},t),{content:e.map((d,f)=>{var T,N,E;let x=d.type==="column"&&(((T=d.attrs)==null?void 0:T.width)==="auto"||!((N=d.attrs)!=null&&N.width)),S=f===0,b=f>0&&f<u-1,C=f===e.length-1,O=0,w=0;if(u<3)O=S?0:h/2,w=C?0:h/2;else{let v=h/2*1.5,_=v/2;O=S?0:b?_:v,w=C?0:b?_:v}return O=Math.round(O*100)/100,w=Math.round(w*100)/100,y(g({},d),{attrs:y(g({},d.attrs),{width:x?p:(E=d.attrs)==null?void 0:E.width,isFirstColumn:S,isLastColumn:C,index:f,paddingLeft:O,paddingRight:w})})})}),o.length===0?Math.min(n,s):n]}column(t,e){let{attrs:n}=t,{width:r,verticalAlign:o="top",paddingLeft:s=0,paddingRight:l=0}=n||{};return(0,i.jsx)(c.Column,{width:`${Number(r)}%`,style:{width:`${Number(r)}%`,margin:0,verticalAlign:o},className:"tab-col-full",children:(0,i.jsx)(c.Section,{style:{margin:0,paddingLeft:s,paddingRight:l},className:"tab-pad",children:this.getMappedContent(t,y(g({},e),{parent:t}))})})}for(t,e){var p,u;let{attrs:n}=t,{each:r=""}=n||{};if(!this.shouldShow(t,e))return(0,i.jsx)(i.Fragment,{});let{payloadValue:s}=e||{};s=typeof s=="object"?s:{};let l=(u=(p=this.payloadValues.get(r))!=null?p:s[r])!=null?u:[];if(!Array.isArray(l))throw new Error(`Payload value for each "${r}" is not an array`);return(0,i.jsx)(i.Fragment,{children:l.map(h=>(0,i.jsx)(F.Fragment,{children:this.getMappedContent(t,y(g({},e),{parent:t,payloadValue:h}))},B()))})}shouldShow(t,e){var o,s,l;let n=(s=(o=t==null?void 0:t.attrs)==null?void 0:o.showIfKey)!=null?s:"";if(!n)return!0;let{payloadValue:r}=e||{};return r=typeof r=="object"?r:{},!!((l=this.payloadValues.get(n))!=null?l:r[n])}};function Bt(a,t){return M(this,null,function*(){let s=t||{},{theme:e,preview:n}=s,r=V(s,["theme","preview"]),o=new D(a);return o.setPreviewText(n),o.setTheme(e||{}),o.render(r)})}0&&(module.exports={DEFAULT_BUTTON_PADDING_BOTTOM,DEFAULT_BUTTON_PADDING_LEFT,DEFAULT_BUTTON_PADDING_RIGHT,DEFAULT_BUTTON_PADDING_TOP,DEFAULT_COLUMNS_GAP,DEFAULT_COLUMNS_WIDTH,DEFAULT_COLUMN_BACKGROUND_COLOR,DEFAULT_COLUMN_BORDER_COLOR,DEFAULT_COLUMN_BORDER_RADIUS,DEFAULT_COLUMN_BORDER_WIDTH,DEFAULT_COLUMN_PADDING_BOTTOM,DEFAULT_COLUMN_PADDING_LEFT,DEFAULT_COLUMN_PADDING_RIGHT,DEFAULT_COLUMN_PADDING_TOP,DEFAULT_HTML_PROPS,DEFAULT_META_TAGS,DEFAULT_SECTION_ALIGN,DEFAULT_SECTION_BACKGROUND_COLOR,DEFAULT_SECTION_BORDER_COLOR,DEFAULT_SECTION_BORDER_WIDTH,DEFAULT_SECTION_MARGIN_BOTTOM,DEFAULT_SECTION_MARGIN_LEFT,DEFAULT_SECTION_MARGIN_RIGHT,DEFAULT_SECTION_MARGIN_TOP,DEFAULT_SECTION_PADDING_BOTTOM,DEFAULT_SECTION_PADDING_LEFT,DEFAULT_SECTION_PADDING_RIGHT,DEFAULT_SECTION_PADDING_TOP,LINK_PROTOCOL_REGEX,Maily,render});
1
+ "use strict";var V=Object.defineProperty,yt=Object.defineProperties,St=Object.getOwnPropertyDescriptor,xt=Object.getOwnPropertyDescriptors,bt=Object.getOwnPropertyNames,R=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var U=(a,t,e)=>t in a?V(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,f=(a,t)=>{for(var e in t||(t={}))F.call(t,e)&&U(a,e,t[e]);if(R)for(var e of R(t))W.call(t,e)&&U(a,e,t[e]);return a},b=(a,t)=>yt(a,xt(t));var P=(a,t)=>{var e={};for(var n in a)F.call(a,n)&&t.indexOf(n)<0&&(e[n]=a[n]);if(a!=null&&R)for(var n of R(a))t.indexOf(n)<0&&W.call(a,n)&&(e[n]=a[n]);return e};var Ot=(a,t)=>{for(var e in t)V(a,e,{get:t[e],enumerable:!0})},wt=(a,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of bt(t))!F.call(a,r)&&r!==e&&V(a,r,{get:()=>t[r],enumerable:!(n=St(t,r))||n.enumerable});return a};var Ct=a=>wt(V({},"__esModule",{value:!0}),a);var M=(a,t,e)=>new Promise((n,r)=>{var i=c=>{try{l(e.next(c))}catch(h){r(h)}},s=c=>{try{l(e.throw(c))}catch(h){r(h)}},l=c=>c.done?n(c.value):Promise.resolve(c.value).then(i,s);l((e=e.apply(a,t)).next())});var Ut={};Ot(Ut,{DEFAULT_BUTTON_PADDING_BOTTOM:()=>gt,DEFAULT_BUTTON_PADDING_LEFT:()=>ft,DEFAULT_BUTTON_PADDING_RIGHT:()=>mt,DEFAULT_BUTTON_PADDING_TOP:()=>dt,DEFAULT_COLUMNS_GAP:()=>at,DEFAULT_COLUMNS_WIDTH:()=>At,DEFAULT_COLUMN_BACKGROUND_COLOR:()=>Dt,DEFAULT_COLUMN_BORDER_COLOR:()=>Vt,DEFAULT_COLUMN_BORDER_RADIUS:()=>kt,DEFAULT_COLUMN_BORDER_WIDTH:()=>Rt,DEFAULT_COLUMN_PADDING_BOTTOM:()=>It,DEFAULT_COLUMN_PADDING_LEFT:()=>Bt,DEFAULT_COLUMN_PADDING_RIGHT:()=>Jt,DEFAULT_COLUMN_PADDING_TOP:()=>Pt,DEFAULT_HTML_PROPS:()=>ht,DEFAULT_INLINE_IMAGE_HEIGHT:()=>lt,DEFAULT_INLINE_IMAGE_WIDTH:()=>ct,DEFAULT_META_TAGS:()=>ut,DEFAULT_SECTION_ALIGN:()=>K,DEFAULT_SECTION_BACKGROUND_COLOR:()=>q,DEFAULT_SECTION_BORDER_COLOR:()=>Q,DEFAULT_SECTION_BORDER_WIDTH:()=>Y,DEFAULT_SECTION_MARGIN_BOTTOM:()=>et,DEFAULT_SECTION_MARGIN_LEFT:()=>nt,DEFAULT_SECTION_MARGIN_RIGHT:()=>tt,DEFAULT_SECTION_MARGIN_TOP:()=>Z,DEFAULT_SECTION_PADDING_BOTTOM:()=>it,DEFAULT_SECTION_PADDING_LEFT:()=>st,DEFAULT_SECTION_PADDING_RIGHT:()=>ot,DEFAULT_SECTION_PADDING_TOP:()=>rt,LINK_PROTOCOL_REGEX:()=>pt,Maily:()=>k,render:()=>Ft});module.exports=Ct(Ut);var D=require("react"),u=require("@react-email/components"),G=require("@react-email/render");var Tt=a=>Object.prototype.toString.call(a);var Nt=a=>Tt(a)==="[object Object]";function Et(a){return Object.keys(a)}function I(a,...t){if(!t.length)return a;let e=t.shift();return e===void 0?a:(J(a)&&J(e)&&Et(e).forEach(n=>{n==="__proto__"||n==="constructor"||n==="prototype"||(J(e[n])?(a[n]||(a[n]={}),J(a[n])?I(a[n],e[n]):a[n]=e[n]):a[n]=e[n])}),I(a,...t))}function J(a){return Nt(a)&&!Array.isArray(a)}var $t=Symbol("p-void");function B(){return Math.random().toString(36).substr(2,6)}var L=require("react/jsx-runtime");function X(a){return a.filter((t,e,n)=>{let r=H(t);return e===n.findIndex(i=>H(i)===r)}).map(vt).filter(Boolean)}function vt(a){if("tagName"in a){let t=a,{tagName:e}=t,n=P(t,["tagName"]);return(0,L.jsx)(e,f({},n),JSON.stringify(n))}return"title"in a?(0,L.jsx)("title",{children:a.title}):"charSet"in a?(0,L.jsx)("meta",{charSet:a.charSet}):(0,L.jsx)("meta",f({},a),JSON.stringify(a))}function H(a){let t=Object.keys(a).sort().reduce((e,n)=>{let r=n;return e[r]=a[r],e},{});return JSON.stringify(t)}var $=require("node-html-parser");var o=require("react/jsx-runtime"),A={WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"};var _t={h1:{fontSize:"36px",lineHeight:"40px",fontWeight:800},h2:{fontSize:"30px",lineHeight:"36px",fontWeight:700},h3:{fontSize:"24px",lineHeight:"38px",fontWeight:600}};var z={sm:"40px",md:"48px",lg:"64px"},Mt={pretty:!1,plainText:!1},j={colors:{heading:"#111827",paragraph:"#374151",horizontal:"#EAEAEA",footer:"#64748B",blockquoteBorder:"#D1D5DB",codeBackground:"#EFEFEF",codeText:"#111827",linkCardTitle:"#111827",linkCardDescription:"#6B7280",linkCardBadgeText:"#111827",linkCardBadgeBackground:"#FEF08A",linkCardSubTitle:"#6B7280"},fontSize:{paragraph:{size:"15px",lineHeight:"26.25px"},footer:{size:"14px",lineHeight:"24px"}}},Lt='SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',q="#ffffff",K="left",Y=1,Q="#000000",Z=0,tt=0,et=0,nt=0,rt=5,ot=5,it=5,st=5,At="100%",at=8,Dt="transparent",kt=0,Rt=0,Vt="transparent",Pt=0,Jt=0,It=0,Bt=0,lt=20,ct=20,pt=/https?:\/\//,ut=[{name:"viewport",content:"width=device-width"},{httpEquiv:"X-UA-Compatible",content:"IE=edge"},{name:"x-apple-disable-message-reformatting"},{name:"format-detection",content:"telephone=no,address=no,email=no,date=no,url=no"},{name:"color-scheme",content:"light"},{name:"supported-color-schemes",content:"light"}],ht={lang:"en",dir:"ltr"},dt=10,mt=32,gt=10,ft=32,k=class{constructor(t={type:"doc",content:[]}){this.config={theme:j};this.variableFormatter=({variable:t,fallback:e})=>e?`{{${t},fallback=${e}}}`:`{{${t}}}`;this.shouldReplaceVariableValues=!1;this.variableValues=new Map;this.linkValues=new Map;this.payloadValues=new Map;this.marksOrder=["underline","bold","italic","textStyle","link"];this.meta=ut;this.htmlProps=ht;this.content=t}setPreviewText(t){this.config.preview=t}setTheme(t){this.config.theme=I(this.config.theme||j,t)}setVariableFormatter(t){this.variableFormatter=t}setVariableValue(t,e){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.variableValues.set(t,e)}setVariableValues(t){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),Object.entries(t).forEach(([e,n])=>{this.setVariableValue(e,n)})}setLinkValue(t,e){this.linkValues.set(t,e)}setLinkValues(t){Object.entries(t).forEach(([e,n])=>{this.setLinkValue(e,n)})}setPayloadValue(t,e){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.payloadValues.set(t,e)}setPayloadValues(t){Object.entries(t).forEach(([e,n])=>{this.setPayloadValue(e,n)})}setOpenTrackingPixel(t){this.openTrackingPixel=t}setShouldReplaceVariableValues(t){this.shouldReplaceVariableValues=t}setMetaTags(t){this.meta.push(...t)}setHtmlProps(t){this.htmlProps=f(f({},this.htmlProps),t)}getAllLinks(){let t=this.content.content||[],e=new Set,n=i=>i&&this.isValidUrl(i)&&!i.startsWith("#")&&!i.startsWith("mailto:")&&!i.startsWith("tel:")&&typeof i=="string",r=i=>{var s;if(i.type==="button"){let l=(s=i.attrs)==null?void 0:s.url;n(l)&&l&&e.add(l)}else i.content&&i.content.forEach(l=>{l.marks&&l.marks.forEach(c=>{var p;let h=(p=c.attrs)==null?void 0:p.href;c.type==="link"&&n(h)&&e.add(h)}),l.content&&r(l)})};return t.forEach(i=>{r(i)}),e}isValidUrl(t){try{let e=new URL(t);return!0}catch(e){return!1}}render(){return M(this,arguments,function*(t=Mt){let e=this.markup();return(0,G.renderAsync)(e,t)})}markup(){let t=this.content.content||[],e=t.map((l,c)=>{let h={prev:t[c-1],next:t[c+1],parent:l},p=this.renderNode(l,h);return p?(0,o.jsx)(D.Fragment,{children:p},B()):null}),{preview:n}=this.config,r=X(this.meta),i=this.htmlProps;return(0,o.jsxs)(u.Html,b(f({},i),{children:[(0,o.jsxs)(u.Head,{children:[(0,o.jsx)(u.Font,{fallbackFontFamily:"sans-serif",fontFamily:"Inter",fontStyle:"normal",fontWeight:400,webFont:{url:"https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19",format:"woff2"}}),(0,o.jsx)("style",{dangerouslySetInnerHTML:{__html:"blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}@media only screen and (max-width:425px){.tab-row-full{width:100%!important}.tab-col-full{display:block!important;width:100%!important}.tab-pad{padding:0!important}}"}}),r]}),(0,o.jsxs)(u.Body,{style:{margin:0},children:[n?(0,o.jsx)(u.Preview,{id:"__react-email-preview",children:n}):null,(0,o.jsx)(u.Container,{style:{maxWidth:"600px",minWidth:"300px",width:"100%",marginLeft:"auto",marginRight:"auto",padding:"0.5rem"},children:e}),this.openTrackingPixel?(0,o.jsx)(u.Img,{alt:"",src:this.openTrackingPixel,style:{display:"none",width:"1px",height:"1px"}}):null]})]}))}getMarginOverrideConditions(t,e){let{parent:n,prev:r,next:i}=e||{},s=(i==null?void 0:i.type)==="spacer",l=(r==null?void 0:r.type)==="spacer",c=(n==null?void 0:n.type)==="listItem",h=(n==null?void 0:n.type)==="section"&&!i,p=(n==null?void 0:n.type)==="section"&&!r,m=(n==null?void 0:n.type)==="column"&&!i,d=(n==null?void 0:n.type)==="column"&&!r,g=(n==null?void 0:n.type)==="repeat"&&!r,y=(n==null?void 0:n.type)==="repeat"&&!i,S=(n==null?void 0:n.type)==="show"&&!r,x=(n==null?void 0:n.type)==="show"&&!i;return{isNextSpacer:s,isPrevSpacer:l,isLastSectionElement:h,isFirstSectionElement:p,isParentListItem:c,isLastColumnElement:m,isFirstColumnElement:d,isFirstRepeatElement:g,isLastRepeatElement:y,isFirstShowElement:S,isLastShowElement:x,shouldRemoveTopMargin:l||p||d||g||S,shouldRemoveBottomMargin:s||h||m||y||x}}getMappedContent(t,e){let n=t.content||[];return n.map((r,i)=>{let s=this.renderNode(r,b(f({},e),{next:n[i+1],prev:n[i-1]}));return s?(0,o.jsx)(D.Fragment,{children:s},B()):null}).filter(r=>r!==null)}renderNode(t,e={}){var r;let n=t.type||"";if(n in this)return(r=this[n])==null?void 0:r.call(this,t,e);throw new Error(`Node type "${n}" is not supported.`)}renderMark(t,e){let n=(t==null?void 0:t.text)||(0,o.jsx)(o.Fragment,{children:"\xA0"}),r=(t==null?void 0:t.marks)||[];return r.sort((i,s)=>this.marksOrder.indexOf(i.type)-this.marksOrder.indexOf(s.type)),r.reduce((i,s)=>{var c;let l=s.type;if(l in this)return(c=this[l])==null?void 0:c.call(this,s,i);throw new Error(`Mark type "${l}" is not supported.`)},(0,o.jsx)(o.Fragment,{children:n}))}paragraph(t,e){var h,p,m,d,g,y,S,x;let{attrs:n}=t,r=(n==null?void 0:n.textAlign)||"left",{isParentListItem:i,shouldRemoveBottomMargin:s}=this.getMarginOverrideConditions(t,e);if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let c=i||s?0:20;return(0,o.jsx)(u.Text,{style:b(f(f({},r!=="left"?{textAlign:r}:{}),A),{fontSize:(m=(p=(h=this.config.theme)==null?void 0:h.fontSize)==null?void 0:p.paragraph)==null?void 0:m.size,lineHeight:(y=(g=(d=this.config.theme)==null?void 0:d.fontSize)==null?void 0:g.paragraph)==null?void 0:y.lineHeight,color:(x=(S=this.config.theme)==null?void 0:S.colors)==null?void 0:x.paragraph,margin:`0 0 ${c}px 0`}),children:t.content?this.getMappedContent(t,b(f({},e),{parent:t})):(0,o.jsx)(o.Fragment,{children:"\xA0"})})}text(t,e){let n=t.text||"&nbsp";if(t.marks)return this.renderMark(t,e);let r=n==null?void 0:n.match(/\s/g);return r&&r.length===n.length?(0,o.jsx)(o.Fragment,{children:r.map((i,s)=>(0,o.jsx)(D.Fragment,{children:"\xA0"},s))}):(0,o.jsx)(o.Fragment,{children:n})}bold(t,e){return(0,o.jsx)("strong",{children:e})}italic(t,e){return(0,o.jsx)("em",{children:e})}underline(t,e){return(0,o.jsx)("u",{children:e})}strike(t,e){return(0,o.jsx)("s",{style:{textDecoration:"line-through"},children:e})}textStyle(t,e){var i,s;let{attrs:n}=t,{color:r=(s=(i=this.config.theme)==null?void 0:i.colors)==null?void 0:s.paragraph}=n||{};return(0,o.jsx)("span",{style:{color:r},children:e})}link(t,e,n){var h,p,m;let{attrs:r}=t,i=(r==null?void 0:r.href)||"#",s=(r==null?void 0:r.target)||"_blank",l=(r==null?void 0:r.rel)||"noopener noreferrer nofollow";if((h=r==null?void 0:r.isUrlVariable)!=null?h:!1){let d=this.removeLinkProtocol(i);i=this.variableUrlValue(d,n)}else i=this.linkValues.get(i)||i;return(0,o.jsx)(u.Link,{href:i,rel:l,style:{fontWeight:500,textDecoration:"none",color:(m=(p=this.config.theme)==null?void 0:p.colors)==null?void 0:m.heading},target:s,children:e})}removeLinkProtocol(t){return t.replace(pt,"")}variableUrlValue(t,e){var i,s;let{payloadValue:n}=e||{},r=this.removeLinkProtocol(t);return(s=(i=typeof n=="object"?n[r]:n)!=null?i:this.variableValues.get(r))!=null?s:t}heading(t,e){var m,d;let{attrs:n}=t,r=`h${Number(n==null?void 0:n.level)||1}`,i=(n==null?void 0:n.textAlign)||"left",{shouldRemoveBottomMargin:s}=this.getMarginOverrideConditions(t,e),{fontSize:l,lineHeight:c,fontWeight:h}=_t[r];return this.shouldShow(t,e)?(0,o.jsx)(u.Heading,{as:r,style:{textAlign:i,color:(d=(m=this.config.theme)==null?void 0:m.colors)==null?void 0:d.heading,fontSize:l,lineHeight:c,fontWeight:h},mb:s?0:12,mt:0,mx:0,children:this.getMappedContent(t,b(f({},e),{parent:t}))}):(0,o.jsx)(o.Fragment,{})}variable(t,e){var c,h,p;let{payloadValue:n}=e||{},{id:r,fallback:i}=t.attrs||{};if(!this.shouldShow(t,e)||!r)return(0,o.jsx)(o.Fragment,{});let l=this.variableFormatter({variable:r,fallback:i});return this.shouldReplaceVariableValues&&(l=(p=(h=(c=typeof n=="object"?n[r]:n)!=null?c:this.variableValues.get(r))!=null?h:i)!=null?p:l),t!=null&&t.marks?this.renderMark({text:l,marks:t.marks},e):(0,o.jsx)(o.Fragment,{children:l})}horizontalRule(t,e){return(0,o.jsx)(u.Hr,{style:{marginTop:"32px",marginBottom:"32px"}})}orderedList(t,e){let{shouldRemoveBottomMargin:n}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)(u.Container,{children:(0,o.jsx)("ol",{style:{marginTop:"0px",marginBottom:n?"0":"20px",paddingLeft:"26px",listStyleType:"decimal"},children:this.getMappedContent(t,b(f({},e),{parent:t}))})})}bulletList(t,e){let{parent:n,next:r}=e||{},{shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(t,{parent:n,next:r});return(0,o.jsx)(u.Container,{style:{maxWidth:"100%"},children:(0,o.jsx)("ul",{style:{marginTop:"0px",marginBottom:i?"0":"20px",paddingLeft:"26px",listStyleType:"disc"},children:this.getMappedContent(t,b(f({},e),{parent:t}))})})}listItem(t,e){return(0,o.jsx)("li",{style:f({marginBottom:"8px",paddingLeft:"6px"},A),children:this.getMappedContent(t,b(f({},e),{parent:t}))})}button(t,e){let{attrs:n}=t,{text:r,isTextVariable:i,url:s,isUrlVariable:l,variant:c,buttonColor:h,textColor:p,borderRadius:m,alignment:d="left",paddingTop:g=dt,paddingRight:y=mt,paddingBottom:S=gt,paddingLeft:x=ft}=n||{};if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let O="0px";m==="round"?O="9999px":m==="smooth"&&(O="6px");let{shouldRemoveBottomMargin:w}=this.getMarginOverrideConditions(t,e),T=l?this.variableUrlValue(s,e):this.linkValues.get(s)||s,N=i?this.variableUrlValue(r,e):r;return g+=2,S+=2,(0,o.jsx)(u.Container,{style:{textAlign:d,maxWidth:"100%",marginBottom:w?"0px":"20px"},children:(0,o.jsx)(u.Button,{href:T,style:{color:String(p),backgroundColor:c==="filled"?String(h):"transparent",borderColor:String(h),borderWidth:"2px",borderStyle:"solid",textDecoration:"none",fontSize:"14px",fontWeight:500,borderRadius:O,padding:`${g}px ${y}px ${S}px ${x}px`},children:N})})}spacer(t,e){let{attrs:n}=t,{height:r}=n||{};return this.shouldShow(t,e)?(0,o.jsx)(u.Container,{style:{height:`${r}px`}}):(0,o.jsx)(o.Fragment,{})}hardBreak(t,e){return(0,o.jsx)("br",{})}logo(t,e){let{attrs:n}=t,{src:r,isSrcVariable:i,alt:s,title:l,size:c,alignment:h="left"}=n||{};if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});r=i?this.variableUrlValue(r,e):r;let{shouldRemoveBottomMargin:m}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)(u.Row,{style:{marginTop:"0px",marginBottom:m?"0px":"32px"},children:(0,o.jsx)(u.Column,{align:h,children:(0,o.jsx)(u.Img,{alt:s||l||"Logo",src:r,style:{width:z[c]||c,height:z[c]||c},title:l||s||"Logo"})})})}image(t,e){let{attrs:n}=t,{src:r,isSrcVariable:i,alt:s,title:l,width:c="auto",alignment:h="center",externalLink:p="",isExternalLinkVariable:m}=n||{};if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let{shouldRemoveBottomMargin:g}=this.getMarginOverrideConditions(t,e);r=i?this.variableUrlValue(r,e):r,p=m?this.variableUrlValue(p,e):p;let y=c==="auto"?"auto":Number(c),S=y==="auto"?"auto":`${y}px`,x=(0,o.jsx)(u.Img,{alt:s||l||"Image",src:r,style:{width:S,maxWidth:"100%",outline:"none",border:"none",textDecoration:"none",display:"block"},title:l||s||"Image"});return(0,o.jsx)(u.Row,{style:{marginTop:"0px",marginBottom:g?"0px":"32px"},children:(0,o.jsx)(u.Column,{align:h,children:p?(0,o.jsx)("a",{href:p,rel:"noopener noreferrer",style:{display:"block",maxWidth:"100%",textDecoration:"none"},target:"_blank",children:x}):x})})}footer(t,e){var s,l,c,h,p,m,d,g;let{attrs:n}=t,{textAlign:r="left"}=n||{},{shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)(u.Text,{style:f({fontSize:(c=(l=(s=this.config.theme)==null?void 0:s.fontSize)==null?void 0:l.footer)==null?void 0:c.size,lineHeight:(m=(p=(h=this.config.theme)==null?void 0:h.fontSize)==null?void 0:p.footer)==null?void 0:m.lineHeight,color:(g=(d=this.config.theme)==null?void 0:d.colors)==null?void 0:g.footer,marginTop:"0px",marginBottom:i?"0px":"20px",textAlign:r},A),children:this.getMappedContent(t,b(f({},e),{parent:t}))})}blockquote(t,e){var i,s;let{isPrevSpacer:n,shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)("blockquote",{style:{borderLeftWidth:"4px",borderLeftStyle:"solid",borderLeftColor:(s=(i=this.config.theme)==null?void 0:i.colors)==null?void 0:s.blockquoteBorder,paddingLeft:"16px",marginLeft:"0px",marginRight:"0px",marginTop:n?"0px":"20px",marginBottom:r?"0px":"20px"},children:this.getMappedContent(t,b(f({},e),{parent:t}))})}code(t,e){var n,r,i,s;return(0,o.jsx)("code",{style:{backgroundColor:(r=(n=this.config.theme)==null?void 0:n.colors)==null?void 0:r.codeBackground,color:(s=(i=this.config.theme)==null?void 0:i.colors)==null?void 0:s.codeText,padding:"2px 4px",borderRadius:"6px",fontFamily:Lt,fontWeight:400,letterSpacing:0},children:e})}linkCard(t,e){var g,y,S,x,C,O,w,T,N,v,E,_;let{attrs:n}=t,{shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,e),{title:i,description:s,link:l,linkTitle:c,image:h,badgeText:p,subTitle:m}=n||{},d=this.linkValues.get(l)||this.variableValues.get(l)||l||"#";return(0,o.jsxs)("a",{href:d,rel:"noopener noreferrer",style:{border:"1px solid #eaeaea",borderRadius:"10px",textDecoration:"none",color:"inherit",display:"block",marginBottom:r?"0px":"20px"},target:"_blank",children:[h?(0,o.jsx)(u.Row,{style:{marginBottom:"6px"},children:(0,o.jsx)(u.Column,{style:{width:"100%",height:"100%"},children:(0,o.jsx)(u.Img,{alt:i||"Link Card",src:h,style:{borderRadius:"10px 10px 0 0",width:"100%",height:"100%",objectFit:"cover"},title:i||"Link Card"})})}):null,(0,o.jsx)(u.Row,{style:{padding:"15px",marginTop:0,marginBottom:0},children:(0,o.jsxs)(u.Column,{style:{verticalAlign:"top"},children:[(0,o.jsxs)(u.Row,{align:void 0,style:{marginBottom:"8px",marginTop:"0px"},width:"auto",children:[(0,o.jsx)(u.Column,{children:(0,o.jsx)(u.Text,{style:f({fontSize:"18px",fontWeight:600,color:(y=(g=this.config.theme)==null?void 0:g.colors)==null?void 0:y.linkCardTitle,margin:"0px"},A),children:i})}),p||m?(0,o.jsxs)(u.Column,{style:{paddingLeft:"6px",verticalAlign:"middle"},children:[p?(0,o.jsx)("span",{style:{fontWeight:600,color:(x=(S=this.config.theme)==null?void 0:S.colors)==null?void 0:x.linkCardBadgeText,padding:"4px 8px",borderRadius:"8px",backgroundColor:(O=(C=this.config.theme)==null?void 0:C.colors)==null?void 0:O.linkCardBadgeBackground,fontSize:"12px",lineHeight:"12px"},children:p}):null," ",m&&!p?(0,o.jsx)("span",{style:{fontWeight:"normal",color:(T=(w=this.config.theme)==null?void 0:w.colors)==null?void 0:T.linkCardSubTitle,fontSize:"12px",lineHeight:"12px"},children:m}):null]}):null]}),(0,o.jsxs)(u.Text,{style:f({fontSize:"16px",color:(v=(N=this.config.theme)==null?void 0:N.colors)==null?void 0:v.linkCardDescription,marginTop:"0px",marginBottom:"0px"},A),children:[s," ",c?(0,o.jsx)("a",{href:d,rel:"noopener noreferrer",style:{color:(_=(E=this.config.theme)==null?void 0:E.colors)==null?void 0:_.linkCardTitle,fontSize:"14px",fontWeight:600,textDecoration:"underline"},children:c}):null]})]})})]})}section(t,e){let{attrs:n}=t,{borderRadius:r=0,backgroundColor:i=q,align:s=K,borderWidth:l=Y,borderColor:c=Q,marginTop:h=Z,marginRight:p=tt,marginBottom:m=et,marginLeft:d=nt,paddingTop:g=rt,paddingRight:y=ot,paddingBottom:S=it,paddingLeft:x=st}=n||{};return this.shouldShow(t,e)?(0,o.jsx)(u.Row,{style:{marginTop:h,marginRight:p,marginBottom:m,marginLeft:d},children:(0,o.jsx)(u.Column,{align:s,style:{borderColor:c,borderWidth:l,borderStyle:"solid",backgroundColor:i,borderRadius:r,paddingTop:g,paddingRight:y,paddingBottom:S,paddingLeft:x},children:this.getMappedContent(t,b(f({},e),{parent:t}))})}):(0,o.jsx)(o.Fragment,{})}columns(t,e){let{attrs:n}=t;if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let[i,s]=this.adjustColumnsContent(t);return(0,o.jsx)(u.Row,{width:`${s}%`,style:{margin:0,padding:0,width:`${s}%`},className:"tab-row-full",children:this.getMappedContent(i,b(f({},e),{parent:i}))})}adjustColumnsContent(t){var m;let{content:e=[]}=t,n=100,r=e.filter(d=>{var g;return d.type==="column"&&!!Number(((g=d.attrs)==null?void 0:g.width)||0)}),i=e.filter(d=>{var g,y;return d.type==="column"&&(((g=d.attrs)==null?void 0:g.width)==="auto"||!((y=d.attrs)!=null&&y.width))}),s=r.reduce((d,g)=>{var y;return d+Number((y=g.attrs)==null?void 0:y.width)},0),l=n-s,c=Math.round(l/i.length),h=e.filter(d=>d.type==="column").length,p=((m=t.attrs)==null?void 0:m.gap)||at;return[b(f({},t),{content:e.map((d,g)=>{var T,N,v;let y=d.type==="column"&&(((T=d.attrs)==null?void 0:T.width)==="auto"||!((N=d.attrs)!=null&&N.width)),S=g===0,x=g>0&&g<h-1,C=g===e.length-1,O=0,w=0;if(h<3)O=S?0:p/2,w=C?0:p/2;else{let E=p/2*1.5,_=E/2;O=S?0:x?_:E,w=C?0:x?_:E}return O=Math.round(O*100)/100,w=Math.round(w*100)/100,b(f({},d),{attrs:b(f({},d.attrs),{width:y?c:(v=d.attrs)==null?void 0:v.width,isFirstColumn:S,isLastColumn:C,index:g,paddingLeft:O,paddingRight:w})})})}),i.length===0?Math.min(n,s):n]}column(t,e){let{attrs:n}=t,{width:r,verticalAlign:i="top",paddingLeft:s=0,paddingRight:l=0}=n||{};return(0,o.jsx)(u.Column,{width:`${Number(r)}%`,style:{width:`${Number(r)}%`,margin:0,verticalAlign:i},className:"tab-col-full",children:(0,o.jsx)(u.Section,{style:{margin:0,paddingLeft:s,paddingRight:l},className:"tab-pad",children:this.getMappedContent(t,b(f({},e),{parent:t}))})})}repeat(t,e){var c,h;let{attrs:n}=t,{each:r=""}=n||{};if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let{payloadValue:s}=e||{};s=typeof s=="object"?s:{};let l=(h=(c=this.payloadValues.get(r))!=null?c:s[r])!=null?h:[];if(!Array.isArray(l))throw new Error(`Payload value for each "${r}" is not an array`);return(0,o.jsx)(o.Fragment,{children:l.map(p=>(0,o.jsx)(D.Fragment,{children:this.getMappedContent(t,b(f({},e),{parent:t,payloadValue:p}))},B()))})}for(t,e){return this.repeat(t,e)}shouldShow(t,e){var i,s,l;let n=(s=(i=t==null?void 0:t.attrs)==null?void 0:i.showIfKey)!=null?s:"";if(!n)return!0;let{payloadValue:r}=e||{};return r=typeof r=="object"?r:{},!!((l=this.payloadValues.get(n))!=null?l:r[n])}htmlCodeBlock(t,e){var c;if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let r=((c=t.content)==null?void 0:c.reduce((h,p)=>h+(p==null?void 0:p.text),""))||"",i=(0,$.parse)(r),s=i.querySelector("head");s==null||s.remove();let l=i.toString();return(0,o.jsx)("table",{align:"left",width:"100%",border:0,cellPadding:"0",cellSpacing:"0",role:"presentation",children:(0,o.jsx)("tbody",{children:(0,o.jsx)("tr",{style:{width:"100%"},children:(0,o.jsx)("td",{style:{width:"100%"},dangerouslySetInnerHTML:{__html:l}})})})})}inlineImage(t,e){let{attrs:n}=t,{src:r,isSrcVariable:i,alt:s="",title:l="",height:c=lt,width:h=ct,externalLink:p="",isExternalLinkVariable:m}=n||{};r=i?this.variableUrlValue(r,e):r,p=m?this.variableUrlValue(p,e):p;let d=(0,o.jsx)("img",{src:r,alt:s,title:l,width:h,height:c,style:{display:"inline",verticalAlign:"middle",width:`${h}px`,height:`${c}px`,outline:"none",border:"none",textDecoration:"none"}});return p?(0,o.jsx)("a",{href:p,rel:"noopener noreferrer",style:{display:"inline",textDecoration:"none"},target:"_blank",children:d}):d}};function Ft(a,t){return M(this,null,function*(){let s=t||{},{theme:e,preview:n}=s,r=P(s,["theme","preview"]),i=new k(a);return i.setPreviewText(n),i.setTheme(e||{}),i.render(r)})}0&&(module.exports={DEFAULT_BUTTON_PADDING_BOTTOM,DEFAULT_BUTTON_PADDING_LEFT,DEFAULT_BUTTON_PADDING_RIGHT,DEFAULT_BUTTON_PADDING_TOP,DEFAULT_COLUMNS_GAP,DEFAULT_COLUMNS_WIDTH,DEFAULT_COLUMN_BACKGROUND_COLOR,DEFAULT_COLUMN_BORDER_COLOR,DEFAULT_COLUMN_BORDER_RADIUS,DEFAULT_COLUMN_BORDER_WIDTH,DEFAULT_COLUMN_PADDING_BOTTOM,DEFAULT_COLUMN_PADDING_LEFT,DEFAULT_COLUMN_PADDING_RIGHT,DEFAULT_COLUMN_PADDING_TOP,DEFAULT_HTML_PROPS,DEFAULT_INLINE_IMAGE_HEIGHT,DEFAULT_INLINE_IMAGE_WIDTH,DEFAULT_META_TAGS,DEFAULT_SECTION_ALIGN,DEFAULT_SECTION_BACKGROUND_COLOR,DEFAULT_SECTION_BORDER_COLOR,DEFAULT_SECTION_BORDER_WIDTH,DEFAULT_SECTION_MARGIN_BOTTOM,DEFAULT_SECTION_MARGIN_LEFT,DEFAULT_SECTION_MARGIN_RIGHT,DEFAULT_SECTION_MARGIN_TOP,DEFAULT_SECTION_PADDING_BOTTOM,DEFAULT_SECTION_PADDING_LEFT,DEFAULT_SECTION_PADDING_RIGHT,DEFAULT_SECTION_PADDING_TOP,LINK_PROTOCOL_REGEX,Maily,render});
2
2
  //# sourceMappingURL=index.js.map