@maily-to/render 0.1.3 → 0.1.4

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
@@ -1,4 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { CSSProperties } from 'react';
2
3
  import { HtmlProps } from '@react-email/components';
3
4
  import { JSONContent } from '@tiptap/core';
4
5
  export { JSONContent } from '@tiptap/core';
@@ -50,15 +51,16 @@ interface ThemeOptions {
50
51
  linkCardBadgeBackground: string;
51
52
  linkCardSubTitle: string;
52
53
  }>;
54
+ container?: Partial<CSSProperties>;
53
55
  fontSize?: Partial<{
54
- paragraph: {
56
+ paragraph: Partial<{
55
57
  size: string;
56
58
  lineHeight: string;
57
- };
58
- footer: {
59
+ }>;
60
+ footer: Partial<{
59
61
  size: string;
60
62
  lineHeight: string;
61
- };
63
+ }>;
62
64
  }>;
63
65
  }
64
66
  interface MailyConfig {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { CSSProperties } from 'react';
2
3
  import { HtmlProps } from '@react-email/components';
3
4
  import { JSONContent } from '@tiptap/core';
4
5
  export { JSONContent } from '@tiptap/core';
@@ -50,15 +51,16 @@ interface ThemeOptions {
50
51
  linkCardBadgeBackground: string;
51
52
  linkCardSubTitle: string;
52
53
  }>;
54
+ container?: Partial<CSSProperties>;
53
55
  fontSize?: Partial<{
54
- paragraph: {
56
+ paragraph: Partial<{
55
57
  size: string;
56
58
  lineHeight: string;
57
- };
58
- footer: {
59
+ }>;
60
+ footer: Partial<{
59
61
  size: string;
60
62
  lineHeight: string;
61
- };
63
+ }>;
62
64
  }>;
63
65
  }
64
66
  interface MailyConfig {
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var St=Object.create;var M=Object.defineProperty,bt=Object.defineProperties,Ot=Object.getOwnPropertyDescriptor,wt=Object.getOwnPropertyDescriptors,Ct=Object.getOwnPropertyNames,k=Object.getOwnPropertySymbols,Nt=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var U=(a,t,e)=>t in a?M(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(k)for(var e of k(t))W.call(t,e)&&U(a,e,t[e]);return a},S=(a,t)=>bt(a,wt(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&&k)for(var n of k(a))t.indexOf(n)<0&&W.call(a,n)&&(e[n]=a[n]);return e};var Tt=(a,t)=>{for(var e in t)M(a,e,{get:t[e],enumerable:!0})},H=(a,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ct(t))!F.call(a,r)&&r!==e&&M(a,r,{get:()=>t[r],enumerable:!(n=Ot(t,r))||n.enumerable});return a};var Et=(a,t,e)=>(e=a!=null?St(Nt(a)):{},H(t||!a||!a.__esModule?M(e,"default",{value:a,enumerable:!0}):e,a)),vt=a=>H(M({},"__esModule",{value:!0}),a);var L=(a,t,e)=>new Promise((n,r)=>{var i=c=>{try{l(e.next(c))}catch(d){r(d)}},s=c=>{try{l(e.throw(c))}catch(d){r(d)}},l=c=>c.done?n(c.value):Promise.resolve(c.value).then(i,s);l((e=e.apply(a,t)).next())});var zt={};Tt(zt,{DEFAULT_BUTTON_PADDING_BOTTOM:()=>yt,DEFAULT_BUTTON_PADDING_LEFT:()=>xt,DEFAULT_BUTTON_PADDING_RIGHT:()=>ft,DEFAULT_BUTTON_PADDING_TOP:()=>gt,DEFAULT_COLUMNS_GAP:()=>ct,DEFAULT_COLUMNS_WIDTH:()=>kt,DEFAULT_COLUMN_BACKGROUND_COLOR:()=>Pt,DEFAULT_COLUMN_BORDER_COLOR:()=>Bt,DEFAULT_COLUMN_BORDER_RADIUS:()=>Jt,DEFAULT_COLUMN_BORDER_WIDTH:()=>It,DEFAULT_COLUMN_PADDING_BOTTOM:()=>Wt,DEFAULT_COLUMN_PADDING_LEFT:()=>Ht,DEFAULT_COLUMN_PADDING_RIGHT:()=>Ut,DEFAULT_COLUMN_PADDING_TOP:()=>Ft,DEFAULT_HTML_PROPS:()=>mt,DEFAULT_INLINE_IMAGE_HEIGHT:()=>pt,DEFAULT_INLINE_IMAGE_WIDTH:()=>ut,DEFAULT_META_TAGS:()=>dt,DEFAULT_SECTION_ALIGN:()=>Q,DEFAULT_SECTION_BACKGROUND_COLOR:()=>Y,DEFAULT_SECTION_BORDER_COLOR:()=>tt,DEFAULT_SECTION_BORDER_WIDTH:()=>Z,DEFAULT_SECTION_MARGIN_BOTTOM:()=>rt,DEFAULT_SECTION_MARGIN_LEFT:()=>ot,DEFAULT_SECTION_MARGIN_RIGHT:()=>nt,DEFAULT_SECTION_MARGIN_TOP:()=>et,DEFAULT_SECTION_PADDING_BOTTOM:()=>at,DEFAULT_SECTION_PADDING_LEFT:()=>lt,DEFAULT_SECTION_PADDING_RIGHT:()=>st,DEFAULT_SECTION_PADDING_TOP:()=>it,LINK_PROTOCOL_REGEX:()=>ht,Maily:()=>R,render:()=>Xt});module.exports=vt(zt);var V=require("react"),p=require("@react-email/components"),$=require("@react-email/render");var _t=a=>Object.prototype.toString.call(a);var Mt=a=>_t(a)==="[object Object]";function Lt(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)&&Lt(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 Mt(a)&&!Array.isArray(a)}var Qt=Symbol("p-void");function B(){return Math.random().toString(36).substr(2,6)}var A=require("react/jsx-runtime");function z(a){return a.filter((t,e,n)=>{let r=X(t);return e===n.findIndex(i=>X(i)===r)}).map(At).filter(Boolean)}function At(a){if("tagName"in a){let t=a,{tagName:e}=t,n=P(t,["tagName"]);return(0,A.jsx)(e,f({},n),JSON.stringify(n))}return"title"in a?(0,A.jsx)("title",{children:a.title}):"charSet"in a?(0,A.jsx)("meta",{charSet:a.charSet}):(0,A.jsx)("meta",f({},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 q=require("node-html-parser"),K=Et(require("juice"));var o=require("react/jsx-runtime"),D={WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"};var Dt={h1:{fontSize:"36px",lineHeight:"40px",fontWeight:800},h2:{fontSize:"30px",lineHeight:"36px",fontWeight:700},h3:{fontSize:"24px",lineHeight:"38px",fontWeight:600}};var j={sm:"40px",md:"48px",lg:"64px"},Vt={pretty:!1,plainText:!1},G={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"}}},Rt='SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',Y="#ffffff",Q="left",Z=1,tt="#000000",et=0,nt=0,rt=0,ot=0,it=5,st=5,at=5,lt=5,kt="100%",ct=8,Pt="transparent",Jt=0,It=0,Bt="transparent",Ft=0,Ut=0,Wt=0,Ht=0,pt=20,ut=20,ht=/https?:\/\//,dt=[{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"}],mt={lang:"en",dir:"ltr"},gt=10,ft=32,yt=10,xt=32,R=class{constructor(t={type:"doc",content:[]}){this.config={theme:G};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=dt;this.htmlProps=mt;this.content=t}setPreviewText(t){this.config.preview=t}setTheme(t){this.config.theme=I(this.config.theme||G,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 u;let d=(u=c.attrs)==null?void 0:u.href;c.type==="link"&&n(d)&&e.add(d)}),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 L(this,arguments,function*(t=Vt){let e=this.markup();return(0,$.renderAsync)(e,t)})}markup(){let t=this.content.content||[],e=t.map((l,c)=>{let d={prev:t[c-1],next:t[c+1],parent:l},u=this.renderNode(l,d);return u?(0,o.jsx)(V.Fragment,{children:u},B()):null}),{preview:n}=this.config,r=z(this.meta),i=this.htmlProps;return(0,o.jsxs)(p.Html,S(f({},i),{children:[(0,o.jsxs)(p.Head,{children:[(0,o.jsx)(p.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)(p.Body,{style:{margin:0},children:[n?(0,o.jsx)(p.Preview,{id:"__react-email-preview",children:n}):null,(0,o.jsx)(p.Container,{style:{maxWidth:"600px",minWidth:"300px",width:"100%",marginLeft:"auto",marginRight:"auto",padding:"0.5rem"},children:e}),this.openTrackingPixel?(0,o.jsx)(p.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",d=(n==null?void 0:n.type)==="section"&&!i,u=(n==null?void 0:n.type)==="section"&&!r,h=(n==null?void 0:n.type)==="column"&&!i,m=(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,x=(n==null?void 0:n.type)==="show"&&!r,b=(n==null?void 0:n.type)==="show"&&!i;return{isNextSpacer:s,isPrevSpacer:l,isLastSectionElement:d,isFirstSectionElement:u,isParentListItem:c,isLastColumnElement:h,isFirstColumnElement:m,isFirstRepeatElement:g,isLastRepeatElement:y,isFirstShowElement:x,isLastShowElement:b,shouldRemoveTopMargin:l||u||m||g||x,shouldRemoveBottomMargin:s||d||h||y||b}}getMappedContent(t,e){let n=t.content||[];return n.map((r,i)=>{let s=this.renderNode(r,S(f({},e),{next:n[i+1],prev:n[i-1]}));return s?(0,o.jsx)(V.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 d,u,h,m,g,y,x,b;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)(p.Text,{style:S(f(f({},r!=="left"?{textAlign:r}:{}),D),{fontSize:(h=(u=(d=this.config.theme)==null?void 0:d.fontSize)==null?void 0:u.paragraph)==null?void 0:h.size,lineHeight:(y=(g=(m=this.config.theme)==null?void 0:m.fontSize)==null?void 0:g.paragraph)==null?void 0:y.lineHeight,color:(b=(x=this.config.theme)==null?void 0:x.colors)==null?void 0:b.paragraph,margin:`0 0 ${c}px 0`}),children:t.content?this.getMappedContent(t,S(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)(V.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 d,u,h;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((d=r==null?void 0:r.isUrlVariable)!=null?d:!1){let m=this.removeLinkProtocol(i);i=this.variableUrlValue(m,n)}else i=this.linkValues.get(i)||i;return(0,o.jsx)(p.Link,{href:i,rel:l,style:{fontWeight:500,textDecoration:"none",color:(h=(u=this.config.theme)==null?void 0:u.colors)==null?void 0:h.heading},target:s,children:e})}removeLinkProtocol(t){return t.replace(ht,"")}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 h,m;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:d}=Dt[r];return this.shouldShow(t,e)?(0,o.jsx)(p.Heading,{as:r,style:{textAlign:i,color:(m=(h=this.config.theme)==null?void 0:h.colors)==null?void 0:m.heading,fontSize:l,lineHeight:c,fontWeight:d},mb:s?0:12,mt:0,mx:0,children:this.getMappedContent(t,S(f({},e),{parent:t}))}):(0,o.jsx)(o.Fragment,{})}variable(t,e){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.getVariableValue(r,i,e);return t!=null&&t.marks?this.renderMark({text:l,marks:t.marks},e):(0,o.jsx)(o.Fragment,{children:l})}getVariableValue(t,e,n){var s,l,c;let{payloadValue:r}=n||{},i=this.variableFormatter({variable:t,fallback:e});return this.shouldReplaceVariableValues&&(i=(c=(l=(s=typeof r=="object"?r[t]:r)!=null?s:this.variableValues.get(t))!=null?l:e)!=null?c:i),i}horizontalRule(t,e){return(0,o.jsx)(p.Hr,{style:{marginTop:"32px",marginBottom:"32px"}})}orderedList(t,e){let{shouldRemoveBottomMargin:n}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)(p.Container,{children:(0,o.jsx)("ol",{style:{marginTop:"0px",marginBottom:n?"0":"20px",paddingLeft:"26px",listStyleType:"decimal"},children:this.getMappedContent(t,S(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)(p.Container,{style:{maxWidth:"100%"},children:(0,o.jsx)("ul",{style:{marginTop:"0px",marginBottom:i?"0":"20px",paddingLeft:"26px",listStyleType:"disc"},children:this.getMappedContent(t,S(f({},e),{parent:t}))})})}listItem(t,e){return(0,o.jsx)("li",{style:f({marginBottom:"8px",paddingLeft:"6px"},D),children:this.getMappedContent(t,S(f({},e),{parent:t}))})}button(t,e){let{attrs:n}=t,{text:r,isTextVariable:i,url:s,isUrlVariable:l,variant:c,buttonColor:d,textColor:u,borderRadius:h,alignment:m="left",paddingTop:g=gt,paddingRight:y=ft,paddingBottom:x=yt,paddingLeft:b=xt}=n||{};if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let O="0px";h==="round"?O="9999px":h==="smooth"&&(O="6px");let{shouldRemoveBottomMargin:C}=this.getMarginOverrideConditions(t,e),N=l?this.variableUrlValue(s,e):this.linkValues.get(s)||s,T=i?this.variableUrlValue(r,e):r;return g+=2,x+=2,(0,o.jsx)(p.Container,{style:{textAlign:m,maxWidth:"100%",marginBottom:C?"0px":"20px"},children:(0,o.jsx)(p.Button,{href:N,style:{color:String(u),backgroundColor:c==="filled"?String(d):"transparent",borderColor:String(d),borderWidth:"2px",borderStyle:"solid",textDecoration:"none",fontSize:"14px",fontWeight:500,borderRadius:O,padding:`${g}px ${y}px ${x}px ${b}px`},children:T})})}spacer(t,e){let{attrs:n}=t,{height:r}=n||{};return this.shouldShow(t,e)?(0,o.jsx)(p.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:d="left"}=n||{};if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});r=i?this.variableUrlValue(r,e):r;let{shouldRemoveBottomMargin:h}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)(p.Row,{style:{marginTop:"0px",marginBottom:h?"0px":"32px"},children:(0,o.jsx)(p.Column,{align:d,children:(0,o.jsx)(p.Img,{alt:s||l||"Logo",src:r,style:{width:j[c]||c,height:j[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:d="center",externalLink:u="",isExternalLinkVariable:h,borderRadius:m=0}=n||{};if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let{shouldRemoveBottomMargin:y}=this.getMarginOverrideConditions(t,e);r=i?this.variableUrlValue(r,e):r,u=h?this.variableUrlValue(u,e):u;let x=c==="auto"?"auto":Number(c),b=x==="auto"?"auto":`${x}px`,w=(0,o.jsx)(p.Img,{alt:s||l||"Image",src:r,style:{width:b,maxWidth:"100%",outline:"none",border:"none",textDecoration:"none",display:"block",borderRadius:m},title:l||s||"Image"});return(0,o.jsx)(p.Row,{style:{marginTop:"0px",marginBottom:y?"0px":"32px"},children:(0,o.jsx)(p.Column,{align:d,children:u?(0,o.jsx)("a",{href:u,rel:"noopener noreferrer",style:{display:"block",maxWidth:"100%",textDecoration:"none"},target:"_blank",children:w}):w})})}footer(t,e){var s,l,c,d,u,h,m,g;let{attrs:n}=t,{textAlign:r="left"}=n||{},{shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)(p.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:(h=(u=(d=this.config.theme)==null?void 0:d.fontSize)==null?void 0:u.footer)==null?void 0:h.lineHeight,color:(g=(m=this.config.theme)==null?void 0:m.colors)==null?void 0:g.footer,marginTop:"0px",marginBottom:i?"0px":"20px",textAlign:r},D),children:this.getMappedContent(t,S(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,S(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:Rt,fontWeight:400,letterSpacing:0},children:e})}linkCard(t,e){var g,y,x,b,w,O,C,N,T,v,E,_;let{attrs:n}=t,{shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,e),{title:i,description:s,link:l,linkTitle:c,image:d,badgeText:u,subTitle:h}=n||{},m=this.linkValues.get(l)||this.variableValues.get(l)||l||"#";return(0,o.jsxs)("a",{href:m,rel:"noopener noreferrer",style:{border:"1px solid #eaeaea",borderRadius:"10px",textDecoration:"none",color:"inherit",display:"block",marginBottom:r?"0px":"20px"},target:"_blank",children:[d?(0,o.jsx)(p.Row,{style:{marginBottom:"6px"},children:(0,o.jsx)(p.Column,{style:{width:"100%",height:"100%"},children:(0,o.jsx)(p.Img,{alt:i||"Link Card",src:d,style:{borderRadius:"10px 10px 0 0",width:"100%",height:"100%",objectFit:"cover"},title:i||"Link Card"})})}):null,(0,o.jsx)(p.Row,{style:{padding:"15px",marginTop:0,marginBottom:0},children:(0,o.jsxs)(p.Column,{style:{verticalAlign:"top"},children:[(0,o.jsxs)(p.Row,{align:void 0,style:{marginBottom:"8px",marginTop:"0px"},width:"auto",children:[(0,o.jsx)(p.Column,{children:(0,o.jsx)(p.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"},D),children:i})}),u||h?(0,o.jsxs)(p.Column,{style:{paddingLeft:"6px",verticalAlign:"middle"},children:[u?(0,o.jsx)("span",{style:{fontWeight:600,color:(b=(x=this.config.theme)==null?void 0:x.colors)==null?void 0:b.linkCardBadgeText,padding:"4px 8px",borderRadius:"8px",backgroundColor:(O=(w=this.config.theme)==null?void 0:w.colors)==null?void 0:O.linkCardBadgeBackground,fontSize:"12px",lineHeight:"12px"},children:u}):null," ",h&&!u?(0,o.jsx)("span",{style:{fontWeight:"normal",color:(N=(C=this.config.theme)==null?void 0:C.colors)==null?void 0:N.linkCardSubTitle,fontSize:"12px",lineHeight:"12px"},children:h}):null]}):null]}),(0,o.jsxs)(p.Text,{style:f({fontSize:"16px",color:(v=(T=this.config.theme)==null?void 0:T.colors)==null?void 0:v.linkCardDescription,marginTop:"0px",marginBottom:"0px"},D),children:[s," ",c?(0,o.jsx)("a",{href:m,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=Y,align:s=Q,borderWidth:l=Z,borderColor:c=tt,marginTop:d=et,marginRight:u=nt,marginBottom:h=rt,marginLeft:m=ot,paddingTop:g=it,paddingRight:y=st,paddingBottom:x=at,paddingLeft:b=lt}=n||{};return this.shouldShow(t,e)?(0,o.jsx)(p.Row,{style:{marginTop:d,marginRight:u,marginBottom:h,marginLeft:m},children:(0,o.jsx)(p.Column,{align:s,style:{borderColor:c,borderWidth:l,borderStyle:"solid",backgroundColor:i,borderRadius:r,paddingTop:g,paddingRight:y,paddingBottom:x,paddingLeft:b},children:this.getMappedContent(t,S(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)(p.Row,{width:`${s}%`,style:{margin:0,padding:0,width:`${s}%`},className:"tab-row-full",children:this.getMappedContent(i,S(f({},e),{parent:i}))})}adjustColumnsContent(t){var h;let{content:e=[]}=t,n=100,r=e.filter(m=>{var g;return m.type==="column"&&!!Number(((g=m.attrs)==null?void 0:g.width)||0)}),i=e.filter(m=>{var g,y;return m.type==="column"&&(((g=m.attrs)==null?void 0:g.width)==="auto"||!((y=m.attrs)!=null&&y.width))}),s=r.reduce((m,g)=>{var y;return m+Number((y=g.attrs)==null?void 0:y.width)},0),l=n-s,c=Math.round(l/i.length),d=e.filter(m=>m.type==="column").length,u=((h=t.attrs)==null?void 0:h.gap)||ct;return[S(f({},t),{content:e.map((m,g)=>{var N,T,v;let y=m.type==="column"&&(((N=m.attrs)==null?void 0:N.width)==="auto"||!((T=m.attrs)!=null&&T.width)),x=g===0,b=g>0&&g<d-1,w=g===e.length-1,O=0,C=0;if(d<3)O=x?0:u/2,C=w?0:u/2;else{let E=u/2*1.5,_=E/2;O=x?0:b?_:E,C=w?0:b?_:E}return O=Math.round(O*100)/100,C=Math.round(C*100)/100,S(f({},m),{attrs:S(f({},m.attrs),{width:y?c:(v=m.attrs)==null?void 0:v.width,isFirstColumn:x,isLastColumn:w,index:g,paddingLeft:O,paddingRight:C})})})}),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)(p.Column,{width:`${Number(r)}%`,style:{width:`${Number(r)}%`,margin:0,verticalAlign:i},className:"tab-col-full",children:(0,o.jsx)(p.Section,{style:{margin:0,paddingLeft:s,paddingRight:l},className:"tab-pad",children:this.getMappedContent(t,S(f({},e),{parent:t}))})})}repeat(t,e){var c,d;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=(d=(c=this.payloadValues.get(r))!=null?c:s[r])!=null?d:[];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(u=>(0,o.jsx)(V.Fragment,{children:this.getMappedContent(t,S(f({},e),{parent:t,payloadValue:u}))},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 d;if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let r=((d=t.content)==null?void 0:d.reduce((u,h)=>{var m,g;if((h==null?void 0:h.type)==="text")return u+(h==null?void 0:h.text);if((h==null?void 0:h.type)==="variable"){let y=this.getVariableValue((m=h==null?void 0:h.attrs)==null?void 0:m.id,(g=h==null?void 0:h.attrs)==null?void 0:g.fallback,e);return u+y}return u},""))||"",i=(0,K.default)(r),s=(0,q.parse)(i),l=s==null?void 0:s.querySelector("head");l==null||l.remove();let c=s.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:c}})})})})}inlineImage(t,e){let{attrs:n}=t,{src:r,isSrcVariable:i,alt:s="",title:l="",height:c=pt,width:d=ut,externalLink:u="",isExternalLinkVariable:h}=n||{};r=i?this.variableUrlValue(r,e):r,u=h?this.variableUrlValue(u,e):u;let m=(0,o.jsx)("img",{src:r,alt:s,title:l,width:d,height:c,style:{display:"inline",verticalAlign:"middle",width:`${d}px`,height:`${c}px`,outline:"none",border:"none",textDecoration:"none"}});return u?(0,o.jsx)("a",{href:u,rel:"noopener noreferrer",style:{display:"inline",textDecoration:"none"},target:"_blank",children:m}):m}};function Xt(a,t){return L(this,null,function*(){let s=t||{},{theme:e,preview:n}=s,r=P(s,["theme","preview"]),i=new R(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});
1
+ "use strict";var yt=Object.create;var M=Object.defineProperty,bt=Object.defineProperties,Ot=Object.getOwnPropertyDescriptor,wt=Object.getOwnPropertyDescriptors,Ct=Object.getOwnPropertyNames,R=Object.getOwnPropertySymbols,Nt=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var U=(a,t,e)=>t in a?M(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,g=(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)=>bt(a,wt(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 Tt=(a,t)=>{for(var e in t)M(a,e,{get:t[e],enumerable:!0})},H=(a,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ct(t))!F.call(a,r)&&r!==e&&M(a,r,{get:()=>t[r],enumerable:!(n=Ot(t,r))||n.enumerable});return a};var Et=(a,t,e)=>(e=a!=null?yt(Nt(a)):{},H(t||!a||!a.__esModule?M(e,"default",{value:a,enumerable:!0}):e,a)),vt=a=>H(M({},"__esModule",{value:!0}),a);var L=(a,t,e)=>new Promise((n,r)=>{var i=c=>{try{l(e.next(c))}catch(d){r(d)}},s=c=>{try{l(e.throw(c))}catch(d){r(d)}},l=c=>c.done?n(c.value):Promise.resolve(c.value).then(i,s);l((e=e.apply(a,t)).next())});var zt={};Tt(zt,{DEFAULT_BUTTON_PADDING_BOTTOM:()=>St,DEFAULT_BUTTON_PADDING_LEFT:()=>xt,DEFAULT_BUTTON_PADDING_RIGHT:()=>gt,DEFAULT_BUTTON_PADDING_TOP:()=>ft,DEFAULT_COLUMNS_GAP:()=>ct,DEFAULT_COLUMNS_WIDTH:()=>Rt,DEFAULT_COLUMN_BACKGROUND_COLOR:()=>Pt,DEFAULT_COLUMN_BORDER_COLOR:()=>Bt,DEFAULT_COLUMN_BORDER_RADIUS:()=>Jt,DEFAULT_COLUMN_BORDER_WIDTH:()=>It,DEFAULT_COLUMN_PADDING_BOTTOM:()=>Wt,DEFAULT_COLUMN_PADDING_LEFT:()=>Ht,DEFAULT_COLUMN_PADDING_RIGHT:()=>Ut,DEFAULT_COLUMN_PADDING_TOP:()=>Ft,DEFAULT_HTML_PROPS:()=>mt,DEFAULT_INLINE_IMAGE_HEIGHT:()=>ut,DEFAULT_INLINE_IMAGE_WIDTH:()=>pt,DEFAULT_META_TAGS:()=>dt,DEFAULT_SECTION_ALIGN:()=>Q,DEFAULT_SECTION_BACKGROUND_COLOR:()=>Y,DEFAULT_SECTION_BORDER_COLOR:()=>tt,DEFAULT_SECTION_BORDER_WIDTH:()=>Z,DEFAULT_SECTION_MARGIN_BOTTOM:()=>rt,DEFAULT_SECTION_MARGIN_LEFT:()=>ot,DEFAULT_SECTION_MARGIN_RIGHT:()=>nt,DEFAULT_SECTION_MARGIN_TOP:()=>et,DEFAULT_SECTION_PADDING_BOTTOM:()=>at,DEFAULT_SECTION_PADDING_LEFT:()=>lt,DEFAULT_SECTION_PADDING_RIGHT:()=>st,DEFAULT_SECTION_PADDING_TOP:()=>it,LINK_PROTOCOL_REGEX:()=>ht,Maily:()=>k,render:()=>Xt});module.exports=vt(zt);var V=require("react"),p=require("@react-email/components"),$=require("@react-email/render");var _t=a=>Object.prototype.toString.call(a);var Mt=a=>_t(a)==="[object Object]";function Lt(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)&&Lt(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 Mt(a)&&!Array.isArray(a)}var Qt=Symbol("p-void");function B(){return Math.random().toString(36).substr(2,6)}var A=require("react/jsx-runtime");function z(a){return a.filter((t,e,n)=>{let r=X(t);return e===n.findIndex(i=>X(i)===r)}).map(At).filter(Boolean)}function At(a){if("tagName"in a){let t=a,{tagName:e}=t,n=P(t,["tagName"]);return(0,A.jsx)(e,g({},n),JSON.stringify(n))}return"title"in a?(0,A.jsx)("title",{children:a.title}):"charSet"in a?(0,A.jsx)("meta",{charSet:a.charSet}):(0,A.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 q=require("node-html-parser"),K=Et(require("juice"));var o=require("react/jsx-runtime"),D={WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"};var Dt={h1:{fontSize:"36px",lineHeight:"40px",fontWeight:800},h2:{fontSize:"30px",lineHeight:"36px",fontWeight:700},h3:{fontSize:"24px",lineHeight:"38px",fontWeight:600}};var j={sm:"40px",md:"48px",lg:"64px"},Vt={pretty:!1,plainText:!1},G={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"},container:{maxWidth:"600px",minWidth:"300px",width:"100%",marginLeft:"auto",marginRight:"auto",padding:"0.5rem"},fontSize:{paragraph:{size:"15px",lineHeight:"26.25px"},footer:{size:"14px",lineHeight:"24px"}}},kt='SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',Y="#ffffff",Q="left",Z=1,tt="#000000",et=0,nt=0,rt=0,ot=0,it=5,st=5,at=5,lt=5,Rt="100%",ct=8,Pt="transparent",Jt=0,It=0,Bt="transparent",Ft=0,Ut=0,Wt=0,Ht=0,ut=20,pt=20,ht=/https?:\/\//,dt=[{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"}],mt={lang:"en",dir:"ltr"},ft=10,gt=32,St=10,xt=32,k=class{constructor(t={type:"doc",content:[]}){this.config={theme:G};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=dt;this.htmlProps=mt;this.content=t}setPreviewText(t){this.config.preview=t}setTheme(t){this.config.theme=I(this.config.theme||G,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=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 m;let d=(m=c.attrs)==null?void 0:m.href;c.type==="link"&&n(d)&&e.add(d)}),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 L(this,arguments,function*(t=Vt){let e=this.markup();return(0,$.renderAsync)(e,t)})}markup(){var c;let t=this.content.content||[],e=t.map((d,m)=>{let u={prev:t[m-1],next:t[m+1],parent:d},h=this.renderNode(d,u);return h?(0,o.jsx)(V.Fragment,{children:h},B()):null}),{preview:n}=this.config,r=z(this.meta),i=this.htmlProps,s=(c=this.config.theme)==null?void 0:c.container;return(0,o.jsxs)(p.Html,b(g({},i),{children:[(0,o.jsxs)(p.Head,{children:[(0,o.jsx)(p.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)(p.Body,{style:{margin:0},children:[n?(0,o.jsx)(p.Preview,{id:"__react-email-preview",children:n}):null,(0,o.jsx)(p.Container,{style:s,children:e}),this.openTrackingPixel?(0,o.jsx)(p.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",d=(n==null?void 0:n.type)==="section"&&!i,m=(n==null?void 0:n.type)==="section"&&!r,u=(n==null?void 0:n.type)==="column"&&!i,h=(n==null?void 0:n.type)==="column"&&!r,f=(n==null?void 0:n.type)==="repeat"&&!r,S=(n==null?void 0:n.type)==="repeat"&&!i,x=(n==null?void 0:n.type)==="show"&&!r,y=(n==null?void 0:n.type)==="show"&&!i;return{isNextSpacer:s,isPrevSpacer:l,isLastSectionElement:d,isFirstSectionElement:m,isParentListItem:c,isLastColumnElement:u,isFirstColumnElement:h,isFirstRepeatElement:f,isLastRepeatElement:S,isFirstShowElement:x,isLastShowElement:y,shouldRemoveTopMargin:l||m||h||f||x,shouldRemoveBottomMargin:s||d||u||S||y}}getMappedContent(t,e){let n=t.content||[];return n.map((r,i)=>{let s=this.renderNode(r,b(g({},e),{next:n[i+1],prev:n[i-1]}));return s?(0,o.jsx)(V.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 d,m,u,h,f,S,x,y;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)(p.Text,{style:b(g(g({},r!=="left"?{textAlign:r}:{}),D),{fontSize:(u=(m=(d=this.config.theme)==null?void 0:d.fontSize)==null?void 0:m.paragraph)==null?void 0:u.size,lineHeight:(S=(f=(h=this.config.theme)==null?void 0:h.fontSize)==null?void 0:f.paragraph)==null?void 0:S.lineHeight,color:(y=(x=this.config.theme)==null?void 0:x.colors)==null?void 0:y.paragraph,margin:`0 0 ${c}px 0`}),children:t.content?this.getMappedContent(t,b(g({},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)(V.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 d,m,u;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((d=r==null?void 0:r.isUrlVariable)!=null?d:!1){let h=this.removeLinkProtocol(i);i=this.variableUrlValue(h,n)}else i=this.linkValues.get(i)||i;return(0,o.jsx)(p.Link,{href:i,rel:l,style:{fontWeight:500,textDecoration:"none",color:(u=(m=this.config.theme)==null?void 0:m.colors)==null?void 0:u.heading},target:s,children:e})}removeLinkProtocol(t){return t.replace(ht,"")}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 u,h;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:d}=Dt[r];return this.shouldShow(t,e)?(0,o.jsx)(p.Heading,{as:r,style:{textAlign:i,color:(h=(u=this.config.theme)==null?void 0:u.colors)==null?void 0:h.heading,fontSize:l,lineHeight:c,fontWeight:d},mb:s?0:12,mt:0,mx:0,children:this.getMappedContent(t,b(g({},e),{parent:t}))}):(0,o.jsx)(o.Fragment,{})}variable(t,e){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.getVariableValue(r,i,e);return t!=null&&t.marks?this.renderMark({text:l,marks:t.marks},e):(0,o.jsx)(o.Fragment,{children:l})}getVariableValue(t,e,n){var s,l,c;let{payloadValue:r}=n||{},i=this.variableFormatter({variable:t,fallback:e});return this.shouldReplaceVariableValues&&(i=(c=(l=(s=typeof r=="object"?r[t]:r)!=null?s:this.variableValues.get(t))!=null?l:e)!=null?c:i),i}horizontalRule(t,e){return(0,o.jsx)(p.Hr,{style:{marginTop:"32px",marginBottom:"32px"}})}orderedList(t,e){let{shouldRemoveBottomMargin:n}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)(p.Container,{children:(0,o.jsx)("ol",{style:{marginTop:"0px",marginBottom:n?"0":"20px",paddingLeft:"26px",listStyleType:"decimal"},children:this.getMappedContent(t,b(g({},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)(p.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(g({},e),{parent:t}))})})}listItem(t,e){return(0,o.jsx)("li",{style:g({marginBottom:"8px",paddingLeft:"6px"},D),children:this.getMappedContent(t,b(g({},e),{parent:t}))})}button(t,e){let{attrs:n}=t,{text:r,isTextVariable:i,url:s,isUrlVariable:l,variant:c,buttonColor:d,textColor:m,borderRadius:u,alignment:h="left",paddingTop:f=ft,paddingRight:S=gt,paddingBottom:x=St,paddingLeft:y=xt}=n||{};if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let O="0px";u==="round"?O="9999px":u==="smooth"&&(O="6px");let{shouldRemoveBottomMargin:w}=this.getMarginOverrideConditions(t,e),N=l?this.variableUrlValue(s,e):this.linkValues.get(s)||s,T=i?this.variableUrlValue(r,e):r;return f+=2,x+=2,(0,o.jsx)(p.Container,{style:{textAlign:h,maxWidth:"100%",marginBottom:w?"0px":"20px"},children:(0,o.jsx)(p.Button,{href:N,style:{color:String(m),backgroundColor:c==="filled"?String(d):"transparent",borderColor:String(d),borderWidth:"2px",borderStyle:"solid",textDecoration:"none",fontSize:"14px",fontWeight:500,borderRadius:O,padding:`${f}px ${S}px ${x}px ${y}px`},children:T})})}spacer(t,e){let{attrs:n}=t,{height:r}=n||{};return this.shouldShow(t,e)?(0,o.jsx)(p.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:d="left"}=n||{};if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});r=i?this.variableUrlValue(r,e):r;let{shouldRemoveBottomMargin:u}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)(p.Row,{style:{marginTop:"0px",marginBottom:u?"0px":"32px"},children:(0,o.jsx)(p.Column,{align:d,children:(0,o.jsx)(p.Img,{alt:s||l||"Logo",src:r,style:{width:j[c]||c,height:j[c]||c},title:l||s||"Logo"})})})}image(t,e){let{attrs:n}=t,{src:r,isSrcVariable:i,alt:s,title:l,width:c="auto",height:d="auto",alignment:m="center",externalLink:u="",isExternalLinkVariable:h,borderRadius:f=0}=n||{};if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let{shouldRemoveBottomMargin:x}=this.getMarginOverrideConditions(t,e);r=i?this.variableUrlValue(r,e):r,u=h?this.variableUrlValue(u,e):u;let y=c==="auto"?"auto":Number(c),C=y==="auto"?"auto":`${y}px`,O=d==="auto"?"auto":Number(d),w=O==="auto"?"auto":`${O}px`,N=(0,o.jsx)(p.Img,{alt:s||l||"Image",src:r,style:{width:C,height:w,maxWidth:"100%",outline:"none",border:"none",textDecoration:"none",display:"block",borderRadius:f},title:l||s||"Image"});return(0,o.jsx)(p.Row,{style:{marginTop:"0px",marginBottom:x?"0px":"32px"},children:(0,o.jsx)(p.Column,{align:m,children:u?(0,o.jsx)("a",{href:u,rel:"noopener noreferrer",style:{display:"block",maxWidth:"100%",textDecoration:"none"},target:"_blank",children:N}):N})})}footer(t,e){var s,l,c,d,m,u,h,f;let{attrs:n}=t,{textAlign:r="left"}=n||{},{shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)(p.Text,{style:g({fontSize:(c=(l=(s=this.config.theme)==null?void 0:s.fontSize)==null?void 0:l.footer)==null?void 0:c.size,lineHeight:(u=(m=(d=this.config.theme)==null?void 0:d.fontSize)==null?void 0:m.footer)==null?void 0:u.lineHeight,color:(f=(h=this.config.theme)==null?void 0:h.colors)==null?void 0:f.footer,marginTop:"0px",marginBottom:i?"0px":"20px",textAlign:r},D),children:this.getMappedContent(t,b(g({},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(g({},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:kt,fontWeight:400,letterSpacing:0},children:e})}linkCard(t,e){var f,S,x,y,C,O,w,N,T,v,E,_;let{attrs:n}=t,{shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,e),{title:i,description:s,link:l,linkTitle:c,image:d,badgeText:m,subTitle:u}=n||{},h=this.linkValues.get(l)||this.variableValues.get(l)||l||"#";return(0,o.jsxs)("a",{href:h,rel:"noopener noreferrer",style:{border:"1px solid #eaeaea",borderRadius:"10px",textDecoration:"none",color:"inherit",display:"block",marginBottom:r?"0px":"20px"},target:"_blank",children:[d?(0,o.jsx)(p.Row,{style:{marginBottom:"6px"},children:(0,o.jsx)(p.Column,{style:{width:"100%",height:"100%"},children:(0,o.jsx)(p.Img,{alt:i||"Link Card",src:d,style:{borderRadius:"10px 10px 0 0",width:"100%",height:"100%",objectFit:"cover"},title:i||"Link Card"})})}):null,(0,o.jsx)(p.Row,{style:{padding:"15px",marginTop:0,marginBottom:0},children:(0,o.jsxs)(p.Column,{style:{verticalAlign:"top"},children:[(0,o.jsxs)(p.Row,{align:void 0,style:{marginBottom:"8px",marginTop:"0px"},width:"auto",children:[(0,o.jsx)(p.Column,{children:(0,o.jsx)(p.Text,{style:g({fontSize:"18px",fontWeight:600,color:(S=(f=this.config.theme)==null?void 0:f.colors)==null?void 0:S.linkCardTitle,margin:"0px"},D),children:i})}),m||u?(0,o.jsxs)(p.Column,{style:{paddingLeft:"6px",verticalAlign:"middle"},children:[m?(0,o.jsx)("span",{style:{fontWeight:600,color:(y=(x=this.config.theme)==null?void 0:x.colors)==null?void 0:y.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:m}):null," ",u&&!m?(0,o.jsx)("span",{style:{fontWeight:"normal",color:(N=(w=this.config.theme)==null?void 0:w.colors)==null?void 0:N.linkCardSubTitle,fontSize:"12px",lineHeight:"12px"},children:u}):null]}):null]}),(0,o.jsxs)(p.Text,{style:g({fontSize:"16px",color:(v=(T=this.config.theme)==null?void 0:T.colors)==null?void 0:v.linkCardDescription,marginTop:"0px",marginBottom:"0px"},D),children:[s," ",c?(0,o.jsx)("a",{href:h,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=Y,align:s=Q,borderWidth:l=Z,borderColor:c=tt,marginTop:d=et,marginRight:m=nt,marginBottom:u=rt,marginLeft:h=ot,paddingTop:f=it,paddingRight:S=st,paddingBottom:x=at,paddingLeft:y=lt}=n||{};return this.shouldShow(t,e)?(0,o.jsx)(p.Row,{style:{marginTop:d,marginRight:m,marginBottom:u,marginLeft:h},children:(0,o.jsx)(p.Column,{align:s,style:{borderColor:c,borderWidth:l,borderStyle:"solid",backgroundColor:i,borderRadius:r,paddingTop:f,paddingRight:S,paddingBottom:x,paddingLeft:y},children:this.getMappedContent(t,b(g({},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)(p.Row,{width:`${s}%`,style:{margin:0,padding:0,width:`${s}%`},className:"tab-row-full",children:this.getMappedContent(i,b(g({},e),{parent:i}))})}adjustColumnsContent(t){var u;let{content:e=[]}=t,n=100,r=e.filter(h=>{var f;return h.type==="column"&&!!Number(((f=h.attrs)==null?void 0:f.width)||0)}),i=e.filter(h=>{var f,S;return h.type==="column"&&(((f=h.attrs)==null?void 0:f.width)==="auto"||!((S=h.attrs)!=null&&S.width))}),s=r.reduce((h,f)=>{var S;return h+Number((S=f.attrs)==null?void 0:S.width)},0),l=n-s,c=Math.round(l/i.length),d=e.filter(h=>h.type==="column").length,m=((u=t.attrs)==null?void 0:u.gap)||ct;return[b(g({},t),{content:e.map((h,f)=>{var N,T,v;let S=h.type==="column"&&(((N=h.attrs)==null?void 0:N.width)==="auto"||!((T=h.attrs)!=null&&T.width)),x=f===0,y=f>0&&f<d-1,C=f===e.length-1,O=0,w=0;if(d<3)O=x?0:m/2,w=C?0:m/2;else{let E=m/2*1.5,_=E/2;O=x?0:y?_:E,w=C?0:y?_:E}return O=Math.round(O*100)/100,w=Math.round(w*100)/100,b(g({},h),{attrs:b(g({},h.attrs),{width:S?c:(v=h.attrs)==null?void 0:v.width,isFirstColumn:x,isLastColumn:C,index:f,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)(p.Column,{width:`${Number(r)}%`,style:{width:`${Number(r)}%`,margin:0,verticalAlign:i},className:"tab-col-full",children:(0,o.jsx)(p.Section,{style:{margin:0,paddingLeft:s,paddingRight:l},className:"tab-pad",children:this.getMappedContent(t,b(g({},e),{parent:t}))})})}repeat(t,e){var c,d;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=(d=(c=this.payloadValues.get(r))!=null?c:s[r])!=null?d:[];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(m=>(0,o.jsx)(V.Fragment,{children:this.getMappedContent(t,b(g({},e),{parent:t,payloadValue:m}))},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 d;if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let r=((d=t.content)==null?void 0:d.reduce((m,u)=>{var h,f;if((u==null?void 0:u.type)==="text")return m+(u==null?void 0:u.text);if((u==null?void 0:u.type)==="variable"){let S=this.getVariableValue((h=u==null?void 0:u.attrs)==null?void 0:h.id,(f=u==null?void 0:u.attrs)==null?void 0:f.fallback,e);return m+S}return m},""))||"",i=(0,K.default)(r),s=(0,q.parse)(i),l=s==null?void 0:s.querySelector("head");l==null||l.remove();let c=s.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:c}})})})})}inlineImage(t,e){let{attrs:n}=t,{src:r,isSrcVariable:i,alt:s="",title:l="",height:c=ut,width:d=pt,externalLink:m="",isExternalLinkVariable:u}=n||{};r=i?this.variableUrlValue(r,e):r,m=u?this.variableUrlValue(m,e):m;let h=(0,o.jsx)("img",{src:r,alt:s,title:l,width:d,height:c,style:{display:"inline",verticalAlign:"middle",width:`${d}px`,height:`${c}px`,outline:"none",border:"none",textDecoration:"none"}});return m?(0,o.jsx)("a",{href:m,rel:"noopener noreferrer",style:{display:"inline",textDecoration:"none"},target:"_blank",children:h}):h}};function Xt(a,t){return L(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