@maily-to/render 0.1.5 → 0.2.1

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.ts CHANGED
@@ -1,117 +1,91 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { CSSProperties } from 'react';
3
- import { HtmlProps } from '@react-email/components';
4
- import { JSONContent } from '@tiptap/core';
5
- export { JSONContent } from '@tiptap/core';
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import { HtmlProps } from "@react-email/components";
3
+ import { JSONContent, JSONContent as JSONContent$1 } from "@tiptap/core";
4
+ import { RendererThemeOptions } from "@maily-to/shared";
6
5
 
6
+ //#region src/meta.d.ts
7
7
  type MetaDescriptor = {
8
- charSet: 'utf-8';
8
+ charSet: 'utf-8';
9
9
  } | {
10
- title: string;
10
+ title: string;
11
11
  } | {
12
- name: string;
13
- content: string;
12
+ name: string;
13
+ content: string;
14
14
  } | {
15
- property: string;
16
- content: string;
15
+ property: string;
16
+ content: string;
17
17
  } | {
18
- httpEquiv: string;
19
- content: string;
18
+ httpEquiv: string;
19
+ content: string;
20
20
  } | {
21
- tagName: 'meta' | 'link';
22
- [attribute: string]: string;
21
+ tagName: 'meta' | 'link';
22
+ [attribute: string]: string;
23
23
  } | {
24
- [name: string]: string;
24
+ [name: string]: string;
25
25
  };
26
26
  type MetaDescriptors = MetaDescriptor[];
27
-
27
+ //#endregion
28
+ //#region src/maily.d.ts
28
29
  interface NodeOptions {
29
- parent?: JSONContent;
30
- prev?: JSONContent;
31
- next?: JSONContent;
32
- payloadValue?: PayloadValue;
30
+ parent?: JSONContent$1;
31
+ prev?: JSONContent$1;
32
+ next?: JSONContent$1;
33
+ payloadValue?: PayloadValue;
33
34
  }
34
35
  interface MarkType {
35
- [key: string]: any;
36
- type: string;
37
- attrs?: Record<string, any> | undefined;
38
- }
39
- interface ThemeOptions {
40
- colors?: Partial<{
41
- heading: string;
42
- paragraph: string;
43
- horizontal: string;
44
- footer: string;
45
- blockquoteBorder: string;
46
- codeBackground: string;
47
- codeText: string;
48
- linkCardTitle: string;
49
- linkCardDescription: string;
50
- linkCardBadgeText: string;
51
- linkCardBadgeBackground: string;
52
- linkCardSubTitle: string;
53
- }>;
54
- container?: Partial<CSSProperties>;
55
- fontSize?: Partial<{
56
- paragraph: Partial<{
57
- size: string;
58
- lineHeight: string;
59
- }>;
60
- footer: Partial<{
61
- size: string;
62
- lineHeight: string;
63
- }>;
64
- }>;
36
+ [key: string]: any;
37
+ type: string;
38
+ attrs?: Record<string, any> | undefined;
65
39
  }
66
40
  interface MailyConfig {
67
- /**
68
- * The preview text is the snippet of text that is pulled into the inbox
69
- * preview of an email client, usually right after the subject line.
70
- *
71
- * Default: `undefined`
72
- */
73
- preview?: string;
74
- /**
75
- * The theme object allows you to customize the colors and font sizes of the
76
- * rendered email.
77
- *
78
- * Default:
79
- * ```js
80
- * {
81
- * colors: {
82
- * heading: '#111827',
83
- * paragraph: '#374151',
84
- * horizontal: '#EAEAEA',
85
- * footer: '#64748B',
86
- * },
87
- * fontSize: {
88
- * paragraph: '15px',
89
- * footer: {
90
- * size: '14px',
91
- * lineHeight: '24px',
92
- * },
93
- * },
94
- * }
95
- * ```
96
- *
97
- * @example
98
- * ```js
99
- * const maily = new Maily(content, {
100
- * theme: {
101
- * colors: {
102
- * heading: '#111827',
103
- * },
104
- * fontSize: {
105
- * footer: {
106
- * size: '14px',
107
- * lineHeight: '24px',
108
- * },
109
- * },
110
- * },
111
- * });
112
- * ```
113
- */
114
- theme?: Partial<ThemeOptions>;
41
+ /**
42
+ * The preview text is the snippet of text that is pulled into the inbox
43
+ * preview of an email client, usually right after the subject line.
44
+ *
45
+ * Default: `undefined`
46
+ */
47
+ preview?: string;
48
+ /**
49
+ * The theme object allows you to customize the colors and font sizes of the
50
+ * rendered email.
51
+ *
52
+ * Default:
53
+ * ```js
54
+ * {
55
+ * colors: {
56
+ * heading: '#111827',
57
+ * paragraph: '#374151',
58
+ * horizontal: '#EAEAEA',
59
+ * footer: '#64748B',
60
+ * },
61
+ * fontSize: {
62
+ * paragraph: '15px',
63
+ * footer: {
64
+ * size: '14px',
65
+ * lineHeight: '24px',
66
+ * },
67
+ * },
68
+ * }
69
+ * ```
70
+ *
71
+ * @example
72
+ * ```js
73
+ * const maily = new Maily(content, {
74
+ * theme: {
75
+ * colors: {
76
+ * heading: '#111827',
77
+ * },
78
+ * fontSize: {
79
+ * footer: {
80
+ * size: '14px',
81
+ * lineHeight: '24px',
82
+ * },
83
+ * },
84
+ * },
85
+ * });
86
+ * ```
87
+ */
88
+ theme?: Partial<RendererThemeOptions>;
115
89
  }
116
90
  declare const DEFAULT_SECTION_BACKGROUND_COLOR = "#ffffff";
117
91
  declare const DEFAULT_SECTION_ALIGN = "left";
@@ -140,158 +114,165 @@ declare const DEFAULT_INLINE_IMAGE_WIDTH = 20;
140
114
  declare const LINK_PROTOCOL_REGEX: RegExp;
141
115
  declare const DEFAULT_META_TAGS: MetaDescriptors;
142
116
  declare const DEFAULT_HTML_PROPS: HtmlProps;
143
- declare const DEFAULT_BUTTON_PADDING_TOP = 10;
144
- declare const DEFAULT_BUTTON_PADDING_RIGHT = 32;
145
- declare const DEFAULT_BUTTON_PADDING_BOTTOM = 10;
146
- declare const DEFAULT_BUTTON_PADDING_LEFT = 32;
147
117
  interface RenderOptions {
148
- /**
149
- * The options object allows you to customize the output of the rendered
150
- * email.
151
- * - `pretty` - If `true`, the output will be formatted with indentation and
152
- * line breaks.
153
- * - `plainText` - If `true`, the output will be plain text instead of HTML.
154
- * This is useful for testing purposes.
155
- *
156
- * Default: `pretty` - `false`, `plainText` - `false`
157
- */
158
- pretty?: boolean;
159
- plainText?: boolean;
118
+ /**
119
+ * The options object allows you to customize the output of the rendered
120
+ * email.
121
+ * - `pretty` - If `true`, the output will be formatted with indentation and
122
+ * line breaks.
123
+ * - `plainText` - If `true`, the output will be plain text instead of HTML.
124
+ * This is useful for testing purposes.
125
+ *
126
+ * Default: `pretty` - `false`, `plainText` - `false`
127
+ */
128
+ pretty?: boolean;
129
+ plainText?: boolean;
160
130
  }
161
131
  type VariableFormatter = (options: {
162
- variable: string;
163
- fallback?: string;
132
+ variable: string;
133
+ fallback?: string;
164
134
  }) => string;
165
135
  type VariableValues = Map<string, string>;
166
136
  type LinkValues = Map<string, string>;
167
137
  type PayloadValue = Record<string, any> | boolean;
168
138
  type PayloadValues = Map<string, PayloadValue>;
169
139
  declare class Maily {
170
- private readonly content;
171
- private config;
172
- private variableFormatter;
173
- private shouldReplaceVariableValues;
174
- private variableValues;
175
- private linkValues;
176
- private openTrackingPixel;
177
- private payloadValues;
178
- private marksOrder;
179
- private meta;
180
- private htmlProps;
181
- constructor(content?: JSONContent);
182
- setPreviewText(preview?: string): void;
183
- setTheme(theme: Partial<ThemeOptions>): void;
184
- setVariableFormatter(formatter: VariableFormatter): void;
185
- /**
186
- * `setVariableValue` will set the variable value.
187
- * It will also set `shouldReplaceVariableValues` to `true`.
188
- *
189
- * @param variable - The variable name
190
- * @param value - The variable value
191
- */
192
- setVariableValue(variable: string, value: string): void;
193
- /**
194
- * `setVariableValues` will set the variable values.
195
- * It will also set `shouldReplaceVariableValues` to `true`.
196
- *
197
- * @param values - The variable values
198
- *
199
- * @example
200
- * ```js
201
- * const maily = new Maily(content);
202
- * maily.setVariableValues({
203
- * name: 'John Doe',
204
- * email: 'john@doe.com',
205
- * });
206
- * ```
207
- */
208
- setVariableValues(values: Record<string, string>): void;
209
- setLinkValue(link: string, value: string): void;
210
- setLinkValues(values: Record<string, string>): void;
211
- setPayloadValue(key: string, value: PayloadValue): void;
212
- setPayloadValues(values: Record<string, PayloadValue>): void;
213
- /**
214
- * `setOpenTrackingPixel` will set the open tracking pixel.
215
- *
216
- * @param pixel - The open tracking pixel
217
- */
218
- setOpenTrackingPixel(pixel?: string): void;
219
- /**
220
- * `setShouldReplaceVariableValues` will determine whether to replace the
221
- * variable values or not. Otherwise, it will just return the formatted variable.
222
- *
223
- * Default: `false`
224
- */
225
- setShouldReplaceVariableValues(shouldReplace: boolean): void;
226
- /**
227
- * `setMetaTags` will add the meta tags.
228
- *
229
- * @param meta - The meta tags
230
- */
231
- setMetaTags(meta: MetaDescriptors): void;
232
- /**
233
- * `setHtmlProps` will set the HTML props.
234
- *
235
- * @param props - The HTML props
236
- */
237
- setHtmlProps(props: HtmlProps): void;
238
- getAllLinks(): Set<string>;
239
- private isValidUrl;
240
- render(options?: RenderOptions): Promise<string>;
241
- /**
242
- * `markup` will render the JSON content into React Email markup.
243
- * and return the raw React Tree.
244
- */
245
- markup(): react_jsx_runtime.JSX.Element;
246
- private getMarginOverrideConditions;
247
- private getMappedContent;
248
- private renderNode;
249
- private renderMark;
250
- private paragraph;
251
- private text;
252
- private bold;
253
- private italic;
254
- private underline;
255
- private strike;
256
- private textStyle;
257
- private link;
258
- private removeLinkProtocol;
259
- private variableUrlValue;
260
- private heading;
261
- private variable;
262
- private getVariableValue;
263
- private horizontalRule;
264
- private orderedList;
265
- private bulletList;
266
- private listItem;
267
- private button;
268
- private spacer;
269
- private hardBreak;
270
- private logo;
271
- private image;
272
- private footer;
273
- private blockquote;
274
- private code;
275
- private linkCard;
276
- private section;
277
- private columns;
278
- private adjustColumnsContent;
279
- private column;
280
- private repeat;
281
- /**
282
- * @deprecated
283
- * This for node is an alias for the repeat node
284
- * we will remove this in the future
285
- * @param node
286
- * @param options
287
- * @returns JSX.Element
288
- */
289
- private for;
290
- private shouldShow;
291
- htmlCodeBlock(node: JSONContent, options?: NodeOptions): JSX.Element;
292
- private inlineImage;
140
+ private readonly content;
141
+ private config;
142
+ private variableFormatter;
143
+ private shouldReplaceVariableValues;
144
+ private variableValues;
145
+ private linkValues;
146
+ private openTrackingPixel;
147
+ private payloadValues;
148
+ private marksOrder;
149
+ private meta;
150
+ private htmlProps;
151
+ constructor(content?: JSONContent$1);
152
+ setPreviewText(preview?: string): void;
153
+ setTheme(theme: Partial<RendererThemeOptions>): void;
154
+ setVariableFormatter(formatter: VariableFormatter): void;
155
+ /**
156
+ * `setVariableValue` will set the variable value.
157
+ * It will also set `shouldReplaceVariableValues` to `true`.
158
+ *
159
+ * @param variable - The variable name
160
+ * @param value - The variable value
161
+ */
162
+ setVariableValue(variable: string, value: string): void;
163
+ /**
164
+ * `setVariableValues` will set the variable values.
165
+ * It will also set `shouldReplaceVariableValues` to `true`.
166
+ *
167
+ * @param values - The variable values
168
+ *
169
+ * @example
170
+ * ```js
171
+ * const maily = new Maily(content);
172
+ * maily.setVariableValues({
173
+ * name: 'John Doe',
174
+ * email: 'john@doe.com',
175
+ * });
176
+ * ```
177
+ */
178
+ setVariableValues(values: Record<string, string>): void;
179
+ setLinkValue(link: string, value: string): void;
180
+ setLinkValues(values: Record<string, string>): void;
181
+ setPayloadValue(key: string, value: PayloadValue): void;
182
+ setPayloadValues(values: Record<string, PayloadValue>): void;
183
+ /**
184
+ * `setOpenTrackingPixel` will set the open tracking pixel.
185
+ *
186
+ * @param pixel - The open tracking pixel
187
+ */
188
+ setOpenTrackingPixel(pixel?: string): void;
189
+ /**
190
+ * `setShouldReplaceVariableValues` will determine whether to replace the
191
+ * variable values or not. Otherwise, it will just return the formatted variable.
192
+ *
193
+ * Default: `false`
194
+ */
195
+ setShouldReplaceVariableValues(shouldReplace: boolean): void;
196
+ /**
197
+ * `setMetaTags` will add the meta tags.
198
+ *
199
+ * @param meta - The meta tags
200
+ */
201
+ setMetaTags(meta: MetaDescriptors): void;
202
+ /**
203
+ * `setHtmlProps` will set the HTML props.
204
+ *
205
+ * @param props - The HTML props
206
+ */
207
+ setHtmlProps(props: HtmlProps): void;
208
+ getAllLinks(): Set<string>;
209
+ private isValidUrl;
210
+ render(options?: RenderOptions): Promise<string>;
211
+ /**
212
+ * `children` will return the children of the content.
213
+ * this is useful for rendering the content in a custom component.
214
+ *
215
+ * @returns The children of the content as JSX elements
216
+ */
217
+ children(): (react_jsx_runtime0.JSX.Element | null)[];
218
+ /**
219
+ * `markup` will render the JSON content into React Email markup.
220
+ * and return the raw React Tree.
221
+ */
222
+ markup(): react_jsx_runtime0.JSX.Element;
223
+ private getMarginOverrideConditions;
224
+ private getMappedContent;
225
+ private renderNode;
226
+ private renderMark;
227
+ private paragraph;
228
+ private text;
229
+ private bold;
230
+ private italic;
231
+ private underline;
232
+ private strike;
233
+ private textStyle;
234
+ private link;
235
+ private removeLinkProtocol;
236
+ private variableUrlValue;
237
+ private heading;
238
+ private variable;
239
+ private getVariableValue;
240
+ private horizontalRule;
241
+ private orderedList;
242
+ private bulletList;
243
+ private listItem;
244
+ private button;
245
+ private spacer;
246
+ private hardBreak;
247
+ private logo;
248
+ private image;
249
+ private footer;
250
+ private blockquote;
251
+ private code;
252
+ private linkCard;
253
+ private section;
254
+ private columns;
255
+ private adjustColumnsContent;
256
+ private column;
257
+ private repeat;
258
+ /**
259
+ * @deprecated
260
+ * This for node is an alias for the repeat node
261
+ * we will remove this in the future
262
+ * @param node
263
+ * @param options
264
+ * @returns JSX.Element
265
+ */
266
+ private for;
267
+ private shouldShow;
268
+ htmlCodeBlock(node: JSONContent$1, options?: NodeOptions): JSX.Element;
269
+ private inlineImage;
293
270
  }
271
+ //#endregion
272
+ //#region src/render.d.ts
273
+ declare function render(content: JSONContent$1, config?: MailyConfig & RenderOptions): Promise<string>;
274
+ //# sourceMappingURL=render.d.ts.map
294
275
 
295
- declare function render(content: JSONContent, config?: MailyConfig & RenderOptions): Promise<string>;
296
-
297
- 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 };
276
+ //#endregion
277
+ export { 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, JSONContent, LINK_PROTOCOL_REGEX, LinkValues, Maily, MailyConfig, MarkType, PayloadValue, PayloadValues, RenderOptions, VariableFormatter, VariableValues, render };
278
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/meta.tsx","../src/maily.tsx","../src/render.ts"],"sourcesContent":[],"mappings":";;;;;;KAAY,cAAA;;;;;;EAAA,OAAA,EAAA,MAAA;AA2BZ,CAAA,GAAY;;;;ECUF,SAAA,EAAA,MAAW;EAAA,OAAA,EAAA,MAAA;CAAA,GAAA;EACC,OACb,EAAA,MAAA,GAAA,MAAA;EAAW,CAAA,SACX,EAAA,MAAA,CAAA,EAAA,MAAA;CAAW,GAAA;EAES,CAAA,IAAA,EAAA,MAAA,CAAA,EAAA,MAAA;AAG7B,CAAA;AAyCiB,KD3DL,eAAA,GAAkB,cC2DF,EAAA;;;UAjDlB,WAAA;WACC;EDtCC,IAAA,CAAA,ECuCH,aDvCiB;EA2Bd,IAAA,CAAA,ECaH,aDbkB;iBCeV;;UAGA,QAAA;EARP,CAAA,GAAA,EAAA,MAAA,CAAA,EAAW,GAAA;EAAA,IAAA,EAAA,MAAA;EAAA,KACV,CAAA,EAUD,MAVC,CAAA,MAAA,EAAA,GAAA,CAAA,GAAA,SAAA;;AAEF,UA8CQ,WAAA,CA9CR;EAAW;AAES;AAG7B;AAyCA;;;EAgD8B,OAApB,CAAA,EAAA,MAAA;EAAO;AAKjB;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AAEA;AA4BA;AAUA;AAeA;AAIA;AACA;AAEA;AACA;;;;AAA+B;AAE/B;;EAAkB,KAqBK,CAAA,EA1Hb,OA0Ha,CA1HL,oBA0HK,CAAA;;AAQL,cA7HL,gCAAA,GA6HK,SAAA;AAOgB,cAnIrB,qBAAA,GAmIqB,MAAA;AAkCN,cApKf,4BAAA,GAoKe,CAAA;AAcJ,cAjLX,4BAAA,GAiLW,SAAA;AAMc,cArLzB,0BAAA,GAqLyB,CAAA;AAQI,cA5L7B,4BAAA,GA4L6B,CAAA;AAAf,cA3Ld,6BAAA,GA2Lc,CAAA;AA8BP,cAxNP,2BAAA,GAwNO,CAAA;AASE,cA/NT,2BAAA,GA+NS,CAAA;AAOT,cArOA,6BAAA,GAqOA,CAAA;AAuDA,cA3RA,8BAAA,GA2RA,CAAA;AACR,cA3RQ,4BAAA,GA2RR,CAAA;AAYK,cArSG,qBAAA,GAqSH,MAAA;AAwBF,cA5TK,mBAAA,GA4TL,CAAA;AAutCc,cAjhDT,+BAAA,GAihDS,aAAA;AAAuB,cAhhDhC,4BAAA,GAghDgC,CAAA;AAAc,cA/gD9C,2BAAA,GA+gDkD,CAAA;AAAO,cA9gDzD,2BAAA,GA8gDyD,aAAA;cA5gDzD,0BAAA;cACA,4BAAA;cACA,6BAAA;AChKS,cDiKT,2BAAA,GCjKe,CAAA;AAAA,cDmKf,2BAAA,GCnKe,EAAA;AACjB,cDmKE,0BAAA,GCnKF,EAAA;AACA,cDoKE,mBCpKF,EDoKqB,MCpKrB;AAAc,cDsKZ,iBCtKY,EDsKO,eCtKP;AACtB,cDiMU,kBCjMV,EDiM8B,SCjM9B;AAAO,UD2MO,aAAA,CC3MP;;;;;;;;;;;;;;KD0NE,iBAAA;;;;KAIA,cAAA,GAAiB;KACjB,UAAA,GAAa;KAEb,YAAA,GAAe;KACf,aAAA,GAAgB,YAAY;cAE3B,KAAA;;;;;;;;;;;;wBAqBU;;kBAQL,QAAQ;kCAOQ;;;;;;;;;;;;;;;;;;;;;;;;4BAkCN;;wBAcJ;sCAMc;2BAQX,eAAe;;;;;;;;;;;;;;;;;;;oBA8BtB;;;;;;sBASE;iBAOT;;mBAuDA,gBACR;;;;;;;eAYK,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;YAwBF,kBAAA,CAAA,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAutCc,yBAAuB,cAAc,GAAA,CAAI;;;;;iBC1qDzC,MAAA,UACX,wBACA,cAAc,gBACtB"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var bt=Object.create;var M=Object.defineProperty,Ot=Object.defineProperties,wt=Object.getOwnPropertyDescriptor,Ct=Object.getOwnPropertyDescriptors,Nt=Object.getOwnPropertyNames,R=Object.getOwnPropertySymbols,Tt=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var W=(a,t,e)=>t in a?M(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,S=(a,t)=>{for(var e in t||(t={}))F.call(t,e)&&W(a,e,t[e]);if(R)for(var e of R(t))H.call(t,e)&&W(a,e,t[e]);return a},b=(a,t)=>Ot(a,Ct(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&&H.call(a,n)&&(e[n]=a[n]);return e};var Et=(a,t)=>{for(var e in t)M(a,e,{get:t[e],enumerable:!0})},X=(a,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Nt(t))!F.call(a,r)&&r!==e&&M(a,r,{get:()=>t[r],enumerable:!(n=wt(t,r))||n.enumerable});return a};var vt=(a,t,e)=>(e=a!=null?bt(Tt(a)):{},X(t||!a||!a.__esModule?M(e,"default",{value:a,enumerable:!0}):e,a)),_t=a=>X(M({},"__esModule",{value:!0}),a);var L=(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 jt={};Et(jt,{DEFAULT_BUTTON_PADDING_BOTTOM:()=>xt,DEFAULT_BUTTON_PADDING_LEFT:()=>yt,DEFAULT_BUTTON_PADDING_RIGHT:()=>St,DEFAULT_BUTTON_PADDING_TOP:()=>gt,DEFAULT_COLUMNS_GAP:()=>ut,DEFAULT_COLUMNS_WIDTH:()=>Pt,DEFAULT_COLUMN_BACKGROUND_COLOR:()=>Jt,DEFAULT_COLUMN_BORDER_COLOR:()=>Ft,DEFAULT_COLUMN_BORDER_RADIUS:()=>It,DEFAULT_COLUMN_BORDER_WIDTH:()=>Bt,DEFAULT_COLUMN_PADDING_BOTTOM:()=>Ht,DEFAULT_COLUMN_PADDING_LEFT:()=>Xt,DEFAULT_COLUMN_PADDING_RIGHT:()=>Wt,DEFAULT_COLUMN_PADDING_TOP:()=>Ut,DEFAULT_HTML_PROPS:()=>ft,DEFAULT_INLINE_IMAGE_HEIGHT:()=>pt,DEFAULT_INLINE_IMAGE_WIDTH:()=>ht,DEFAULT_META_TAGS:()=>mt,DEFAULT_SECTION_ALIGN:()=>Z,DEFAULT_SECTION_BACKGROUND_COLOR:()=>Q,DEFAULT_SECTION_BORDER_COLOR:()=>et,DEFAULT_SECTION_BORDER_WIDTH:()=>tt,DEFAULT_SECTION_MARGIN_BOTTOM:()=>ot,DEFAULT_SECTION_MARGIN_LEFT:()=>it,DEFAULT_SECTION_MARGIN_RIGHT:()=>rt,DEFAULT_SECTION_MARGIN_TOP:()=>nt,DEFAULT_SECTION_PADDING_BOTTOM:()=>lt,DEFAULT_SECTION_PADDING_LEFT:()=>ct,DEFAULT_SECTION_PADDING_RIGHT:()=>at,DEFAULT_SECTION_PADDING_TOP:()=>st,LINK_PROTOCOL_REGEX:()=>dt,Maily:()=>k,render:()=>zt});module.exports=_t(jt);var V=require("react"),p=require("@react-email/components"),q=require("@react-email/render");var Mt=a=>Object.prototype.toString.call(a);var Lt=a=>Mt(a)==="[object Object]";function At(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)&&At(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 Lt(a)&&!Array.isArray(a)}var Zt=Symbol("p-void");function B(){return Math.random().toString(36).substr(2,6)}var A=require("react/jsx-runtime");function j(a){return a.filter((t,e,n)=>{let r=z(t);return e===n.findIndex(i=>z(i)===r)}).map(Dt).filter(Boolean)}function Dt(a){if("tagName"in a){let t=a,{tagName:e}=t,n=P(t,["tagName"]);return(0,A.jsx)(e,S({},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",S({},a),JSON.stringify(a))}function z(a){let t=Object.keys(a).sort().reduce((e,n)=>{let r=n;return e[r]=a[r],e},{});return JSON.stringify(t)}var K=require("node-html-parser"),Y=vt(require("juice"));var o=require("react/jsx-runtime"),D={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 G={sm:"40px",md:"48px",lg:"64px"},kt={pretty:!1,plainText:!1},$={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"}}},Rt='SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',Q="#ffffff",Z="left",tt=1,et="#000000",nt=0,rt=0,ot=0,it=0,st=5,at=5,lt=5,ct=5,Pt="100%",ut=8,Jt="transparent",It=0,Bt=0,Ft="transparent",Ut=0,Wt=0,Ht=0,Xt=0,pt=20,ht=20,dt=/https?:\/\//,mt=[{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"}],ft={lang:"en",dir:"ltr"},gt=10,St=32,xt=10,yt=32,k=class{constructor(t={type:"doc",content:[]}){this.config={theme:$};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=mt;this.htmlProps=ft;this.content=t}setPreviewText(t){this.config.preview=t}setTheme(t){this.config.theme=I(this.config.theme||$,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=S(S({},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 d;let h=(d=c.attrs)==null?void 0:d.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 L(this,arguments,function*(t=kt){let e=this.markup();return(0,q.renderAsync)(e,t)})}markup(){var c;let t=this.content.content||[],e=t.map((h,d)=>{let u={prev:t[d-1],next:t[d+1],parent:h},f=this.renderNode(h,u);return f?(0,o.jsx)(V.Fragment,{children:f},B()):null}),{preview:n}=this.config,r=j(this.meta),i=this.htmlProps,s=(c=this.config.theme)==null?void 0:c.container;return(0,o.jsxs)(p.Html,b(S({},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",h=(n==null?void 0:n.type)==="section"&&!i,d=(n==null?void 0:n.type)==="section"&&!r,u=(n==null?void 0:n.type)==="column"&&!i,f=(n==null?void 0:n.type)==="column"&&!r,m=(n==null?void 0:n.type)==="repeat"&&!r,g=(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:h,isFirstSectionElement:d,isParentListItem:c,isLastColumnElement:u,isFirstColumnElement:f,isFirstRepeatElement:m,isLastRepeatElement:g,isFirstShowElement:x,isLastShowElement:y,shouldRemoveTopMargin:l||d||f||m||x,shouldRemoveBottomMargin:s||h||u||g||y}}getMappedContent(t,e){let n=t.content||[];return n.map((r,i)=>{let s=this.renderNode(r,b(S({},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 h,d,u,f,m,g,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(S(S({},r!=="left"?{textAlign:r}:{}),D),{fontSize:(u=(d=(h=this.config.theme)==null?void 0:h.fontSize)==null?void 0:d.paragraph)==null?void 0:u.size,lineHeight:(g=(m=(f=this.config.theme)==null?void 0:f.fontSize)==null?void 0:m.paragraph)==null?void 0:g.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(S({},e),{parent:t})):(0,o.jsx)(o.Fragment,{children:"\xA0"})})}text(t,e){if(t.marks)return this.renderMark(t,e);let n=t.text,r=n==null?void 0:n.match(/\s/g);return r&&r.length===(n==null?void 0:n.length)?(0,o.jsx)(o.Fragment,{children:r.map((i,s)=>(0,o.jsx)(V.Fragment,{children:"\xA0"},s))}):n?(0,o.jsx)(o.Fragment,{children:n}):(0,o.jsx)(o.Fragment,{children:"\xA0"})}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,d,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((h=r==null?void 0:r.isUrlVariable)!=null?h:!1){let f=this.removeLinkProtocol(i);i=this.variableUrlValue(f,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=(d=this.config.theme)==null?void 0:d.colors)==null?void 0:u.heading},target:s,children:e})}removeLinkProtocol(t){return t.replace(dt,"")}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,f;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}=Vt[r];return this.shouldShow(t,e)?(0,o.jsx)(p.Heading,{as:r,style:{textAlign:i,color:(f=(u=this.config.theme)==null?void 0:u.colors)==null?void 0:f.heading,fontSize:l,lineHeight:c,fontWeight:h},mb:s?0:12,mt:0,mx:0,children:this.getMappedContent(t,b(S({},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(S({},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(S({},e),{parent:t}))})})}listItem(t,e){return(0,o.jsx)("li",{style:S({marginBottom:"8px",paddingLeft:"6px"},D),children:this.getMappedContent(t,b(S({},e),{parent:t}))})}button(t,e){let{attrs:n}=t,{text:r,isTextVariable:i,url:s,isUrlVariable:l,variant:c,buttonColor:h,textColor:d,borderRadius:u,alignment:f="left",paddingTop:m=gt,paddingRight:g=St,paddingBottom:x=xt,paddingLeft:y=yt}=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:C}=this.getMarginOverrideConditions(t,e),w=l?this.variableUrlValue(s,e):this.linkValues.get(s)||s,T=i?this.variableUrlValue(r,e):r;return m+=2,x+=2,(0,o.jsx)(p.Container,{style:{textAlign:f,maxWidth:"100%",marginBottom:C?"0px":"20px"},children:(0,o.jsx)(p.Button,{href:w,style:{color:String(d),backgroundColor:c==="filled"?String(h):"transparent",borderColor:String(h),borderWidth:"2px",borderStyle:"solid",textDecoration:"none",fontSize:"14px",fontWeight:500,borderRadius:O,padding:`${m}px ${g}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:h="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:h,children:(0,o.jsx)(p.Img,{alt:s||l||"Logo",src:r,style:{width:G[c]||c,height:G[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:h="auto",alignment:d="center",externalLink:u="",isExternalLinkVariable:f,borderRadius:m=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=f?this.variableUrlValue(u,e):u;let y=c==="auto"?"auto":Number(c),N=y==="auto"?"auto":`${y}px`,O=h==="auto"?"auto":Number(h),C=O==="auto"?"auto":`${O}px`,w=(0,o.jsx)(p.Img,{alt:s||l||"Image",src:r,style:{width:N,height:C,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:x?"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,h,d,u,f,m;let{attrs:n}=t,{textAlign:r="left"}=n||{},{shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)(p.Text,{style:S({fontSize:(c=(l=(s=this.config.theme)==null?void 0:s.fontSize)==null?void 0:l.footer)==null?void 0:c.size,lineHeight:(u=(d=(h=this.config.theme)==null?void 0:h.fontSize)==null?void 0:d.footer)==null?void 0:u.lineHeight,color:(m=(f=this.config.theme)==null?void 0:f.colors)==null?void 0:m.footer,marginTop:"0px",marginBottom:i?"0px":"20px",textAlign:r},D),children:this.getMappedContent(t,b(S({},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(S({},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 m,g,x,y,N,O,C,w,T,v,_,E;let{attrs:n}=t,{shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,e),{title:i,description:s,link:l,linkTitle:c,image:h,badgeText:d,subTitle:u}=n||{},f=this.linkValues.get(l)||this.variableValues.get(l)||l||"#";return(0,o.jsxs)("a",{href:f,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)(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:h,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:S({fontSize:"18px",fontWeight:600,color:(g=(m=this.config.theme)==null?void 0:m.colors)==null?void 0:g.linkCardTitle,margin:"0px"},D),children:i})}),d||u?(0,o.jsxs)(p.Column,{style:{paddingLeft:"6px",verticalAlign:"middle"},children:[d?(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=(N=this.config.theme)==null?void 0:N.colors)==null?void 0:O.linkCardBadgeBackground,fontSize:"12px",lineHeight:"12px"},children:d}):null," ",u&&!d?(0,o.jsx)("span",{style:{fontWeight:"normal",color:(w=(C=this.config.theme)==null?void 0:C.colors)==null?void 0:w.linkCardSubTitle,fontSize:"12px",lineHeight:"12px"},children:u}):null]}):null]}),(0,o.jsxs)(p.Text,{style:S({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:f,rel:"noopener noreferrer",style:{color:(E=(_=this.config.theme)==null?void 0:_.colors)==null?void 0:E.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=Z,borderWidth:l=tt,borderColor:c=et,marginTop:h=nt,marginRight:d=rt,marginBottom:u=ot,marginLeft:f=it,paddingTop:m=st,paddingRight:g=at,paddingBottom:x=lt,paddingLeft:y=ct}=n||{};return this.shouldShow(t,e)?(0,o.jsx)(p.Row,{style:{marginTop:h,marginRight:d,marginBottom:u,marginLeft:f},children:(0,o.jsx)(p.Column,{align:s,style:{borderColor:c,borderWidth:l,borderStyle:"solid",backgroundColor:i,borderRadius:r,paddingTop:m,paddingRight:g,paddingBottom:x,paddingLeft:y},children:this.getMappedContent(t,b(S({},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(S({},e),{parent:i}))})}adjustColumnsContent(t){var u,f;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,x;return m.type==="column"&&(((g=m.attrs)==null?void 0:g.width)==="auto"||!((x=m.attrs)!=null&&x.width))}),s=r.reduce((m,g)=>{var x;return m+Number((x=g.attrs)==null?void 0:x.width)},0),l=n-s,c=Math.round(l/i.length),h=e.filter(m=>m.type==="column").length,d=(f=(u=t.attrs)==null?void 0:u.gap)!=null?f:ut;return[b(S({},t),{content:e.map((m,g)=>{var T,v,_;let x=m.type==="column"&&(((T=m.attrs)==null?void 0:T.width)==="auto"||!((v=m.attrs)!=null&&v.width)),y=g===0,N=g>0&&g<h-1,O=g===e.length-1,C=0,w=0;if(h<3)C=y?0:d/2,w=O?0:d/2;else{let E=d/2*1.5,U=E/2;C=y?0:N?U:E,w=O?0:N?U:E}return C=Math.round(C*100)/100,w=Math.round(w*100)/100,b(S({},m),{attrs:b(S({},m.attrs),{width:x?c:(_=m.attrs)==null?void 0:_.width,isFirstColumn:y,isLastColumn:O,index:g,paddingLeft:C,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(S({},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(d=>(0,o.jsx)(V.Fragment,{children:this.getMappedContent(t,b(S({},e),{parent:t,payloadValue:d}))},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 h;if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let r=((h=t.content)==null?void 0:h.reduce((d,u)=>{var f,m;if((u==null?void 0:u.type)==="text")return d+(u==null?void 0:u.text);if((u==null?void 0:u.type)==="variable"){let g=this.getVariableValue((f=u==null?void 0:u.attrs)==null?void 0:f.id,(m=u==null?void 0:u.attrs)==null?void 0:m.fallback,e);return d+g}return d},""))||"",i=(0,Y.default)(r),s=(0,K.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:h=ht,externalLink:d="",isExternalLinkVariable:u}=n||{};r=i?this.variableUrlValue(r,e):r,d=u?this.variableUrlValue(d,e):d;let f=(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 d?(0,o.jsx)("a",{href:d,rel:"noopener noreferrer",style:{display:"inline",textDecoration:"none"},target:"_blank",children:f}):f}};function zt(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});
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=s(require(`react`)),l=s(require(`@react-email/components`)),u=s(require(`@react-email/render`)),d=s(require(`react/jsx-runtime`)),f=s(require(`node-html-parser`)),p=s(require(`juice`)),m=e=>Object.prototype.toString.call(e),h=e=>m(e)===`[object Object]`;function g(e){return Object.keys(e)}function _(e,...t){if(!t.length)return e;let n=t.shift();return n===void 0?e:(v(e)&&v(n)&&g(n).forEach(t=>{t===`__proto__`||t===`constructor`||t===`prototype`||(v(n[t])?(e[t]||(e[t]={}),v(e[t])?_(e[t],n[t]):e[t]=n[t]):e[t]=n[t])}),_(e,...t))}function v(e){return h(e)&&!Array.isArray(e)}const y=Symbol(`p-void`);function b(){return Math.random().toString(36).substr(2,6)}function x(e){return e.filter((e,t,n)=>{let r=C(e);return t===n.findIndex(e=>C(e)===r)}).map(S).filter(Boolean)}function S(e){if(`tagName`in e){let{tagName:t,...n}=e,r=t;return(0,d.jsx)(r,{...n},JSON.stringify(n))}return`title`in e?(0,d.jsx)(`title`,{children:e.title}):`charSet`in e?(0,d.jsx)(`meta`,{charSet:e.charSet}):(0,d.jsx)(`meta`,{...e},JSON.stringify(e))}function C(e){let t=Object.keys(e).sort().reduce((t,n)=>{let r=n;return t[r]=e[r],t},{});return JSON.stringify(t)}const w={fallbackFontFamily:`sans-serif`,fontFamily:`Inter`,webFont:{url:`https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19`,format:`woff2`}},T=`#111827`,E={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`}},container:{backgroundColor:`#ffffff`,maxWidth:`600px`,minWidth:`300px`,paddingTop:`0.5rem`,paddingRight:`0.5rem`,paddingBottom:`0.5rem`,paddingLeft:`0.5rem`,borderRadius:`0px`,borderWidth:`0px`,borderColor:`transparent`},body:{backgroundColor:`#ffffff`,paddingTop:`0px`,paddingRight:`0px`,paddingBottom:`0px`,paddingLeft:`0px`},button:{backgroundColor:`#000000`,color:`#ffffff`,paddingTop:`10px`,paddingRight:`32px`,paddingBottom:`10px`,paddingLeft:`32px`},link:{color:T},font:w},D={WebkitFontSmoothing:`antialiased`,MozOsxFontSmoothing:`grayscale`},O={h1:{fontSize:`36px`,lineHeight:`40px`,fontWeight:800},h2:{fontSize:`30px`,lineHeight:`36px`,fontWeight:700},h3:{fontSize:`24px`,lineHeight:`38px`,fontWeight:600}},k={sm:`40px`,md:`48px`,lg:`64px`},A=`SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace`,j=`#ffffff`,M=`left`,N=1,P=`#000000`,F=0,I=0,L=0,R=0,z=5,B=5,V=5,H=5,U=`100%`,W=8,G=`transparent`,K=0,q=0,ee=`transparent`,te=0,ne=0,re=0,ie=0,J=20,Y=20,X=/https?:\/\//,Z=[{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`}],Q={lang:`en`,dir:`ltr`},ae={pretty:!1,plainText:!1};var $=class{content;config={theme:E};variableFormatter=({variable:e,fallback:t})=>t?`{{${e},fallback=${t}}}`:`{{${e}}}`;shouldReplaceVariableValues=!1;variableValues=new Map;linkValues=new Map;openTrackingPixel;payloadValues=new Map;marksOrder=[`underline`,`bold`,`italic`,`textStyle`,`link`];meta=Z;htmlProps=Q;constructor(e={type:`doc`,content:[]}){this.content=e}setPreviewText(e){this.config.preview=e}setTheme(e){this.config.theme=_(this.config.theme||E,e)}setVariableFormatter(e){this.variableFormatter=e}setVariableValue(e,t){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.variableValues.set(e,t)}setVariableValues(e){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),Object.entries(e).forEach(([e,t])=>{this.setVariableValue(e,t)})}setLinkValue(e,t){this.linkValues.set(e,t)}setLinkValues(e){Object.entries(e).forEach(([e,t])=>{this.setLinkValue(e,t)})}setPayloadValue(e,t){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.payloadValues.set(e,t)}setPayloadValues(e){Object.entries(e).forEach(([e,t])=>{this.setPayloadValue(e,t)})}setOpenTrackingPixel(e){this.openTrackingPixel=e}setShouldReplaceVariableValues(e){this.shouldReplaceVariableValues=e}setMetaTags(e){this.meta.push(...e)}setHtmlProps(e){this.htmlProps={...this.htmlProps,...e}}getAllLinks(){let e=this.content.content||[],t=new Set,n=e=>e&&this.isValidUrl(e)&&!e.startsWith(`#`)&&!e.startsWith(`mailto:`)&&!e.startsWith(`tel:`)&&typeof e==`string`,r=e=>{if(e.type===`button`){let r=e.attrs?.url;n(r)&&r&&t.add(r)}else e.content&&e.content.forEach(e=>{e.marks&&e.marks.forEach(e=>{let r=e.attrs?.href;e.type===`link`&&n(r)&&t.add(r)}),e.content&&r(e)})};return e.forEach(e=>{r(e)}),t}isValidUrl(e){try{let t=new URL(e);return!0}catch(e){return!1}}async render(e=ae){let t=this.markup();return(0,u.renderAsync)(t,e)}children(){let e=this.content.content||[],t=e.map((t,n)=>{let r={prev:e[n-1],next:e[n+1],parent:t},i=this.renderNode(t,r);return i?(0,d.jsx)(c.Fragment,{children:i},b()):null});return t}markup(){let e=this.children(),{preview:t}=this.config,n=x(this.meta),r=this.htmlProps,i=this.config.theme?.container,a={...this.config.theme?.font||w,fontStyle:`normal`,fontWeight:400},o={margin:`0px`,...this.config.theme?.body},s=(0,d.jsxs)(l.Html,{...r,children:[(0,d.jsxs)(l.Head,{children:[(0,d.jsx)(l.Font,{...a}),(0,d.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}}`}}),n]}),(0,d.jsxs)(l.Body,{style:o,children:[t?(0,d.jsx)(l.Preview,{id:`__react-email-preview`,children:t}):null,(0,d.jsx)(l.Container,{style:{width:`100%`,marginLeft:`auto`,marginRight:`auto`,borderStyle:`solid`,...i},children:e}),this.openTrackingPixel?(0,d.jsx)(l.Img,{alt:``,src:this.openTrackingPixel,style:{display:`none`,width:`1px`,height:`1px`}}):null]})]});return s}getMarginOverrideConditions(e,t){let{parent:n,prev:r,next:i}=t||{},a=i?.type===`spacer`,o=r?.type===`spacer`,s=n?.type===`listItem`,c=n?.type===`section`&&!i,l=n?.type===`section`&&!r,u=n?.type===`column`&&!i,d=n?.type===`column`&&!r,f=n?.type===`repeat`&&!r,p=n?.type===`repeat`&&!i,m=n?.type===`show`&&!r,h=n?.type===`show`&&!i;return{isNextSpacer:a,isPrevSpacer:o,isLastSectionElement:c,isFirstSectionElement:l,isParentListItem:s,isLastColumnElement:u,isFirstColumnElement:d,isFirstRepeatElement:f,isLastRepeatElement:p,isFirstShowElement:m,isLastShowElement:h,shouldRemoveTopMargin:o||l||d||f||m,shouldRemoveBottomMargin:a||c||u||p||h}}getMappedContent(e,t){let n=e.content||[];return n.map((e,r)=>{let i=this.renderNode(e,{...t,next:n[r+1],prev:n[r-1]});return i?(0,d.jsx)(c.Fragment,{children:i},b()):null}).filter(e=>e!==null)}renderNode(e,t={}){let n=e.type||``;if(n in this)return this[n]?.(e,t);throw Error(`Node type "${n}" is not supported.`)}renderMark(e,t){let n=e?.text||(0,d.jsx)(d.Fragment,{children:`\xA0`}),r=e?.marks||[];return r.sort((e,t)=>this.marksOrder.indexOf(e.type)-this.marksOrder.indexOf(t.type)),r.reduce((e,t)=>{let n=t.type;if(n in this)return this[n]?.(t,e);throw Error(`Mark type "${n}" is not supported.`)},(0,d.jsx)(d.Fragment,{children:n}))}paragraph(e,t){let{attrs:n}=e,r=n?.textAlign||`left`,{isParentListItem:i,shouldRemoveBottomMargin:a}=this.getMarginOverrideConditions(e,t),o=this.shouldShow(e,t);if(!o)return(0,d.jsx)(d.Fragment,{});let s=i||a?0:20;return(0,d.jsx)(l.Text,{style:{...r===`left`?{}:{textAlign:r},...D,fontSize:this.config.theme?.fontSize?.paragraph?.size,lineHeight:this.config.theme?.fontSize?.paragraph?.lineHeight,color:this.config.theme?.colors?.paragraph,margin:`0 0 ${s}px 0`},children:e.content?this.getMappedContent(e,{...t,parent:e}):(0,d.jsx)(d.Fragment,{children:`\xA0`})})}text(e,t){if(e.marks)return this.renderMark(e,t);let n=e.text,r=n?.match(/\s/g);return r&&r.length===n?.length?(0,d.jsx)(d.Fragment,{children:r.map((e,t)=>(0,d.jsx)(c.Fragment,{children:`\xA0`},t))}):n?(0,d.jsx)(d.Fragment,{children:n}):(0,d.jsx)(d.Fragment,{children:`\xA0`})}bold(e,t){return(0,d.jsx)(`strong`,{children:t})}italic(e,t){return(0,d.jsx)(`em`,{children:t})}underline(e,t){return(0,d.jsx)(`u`,{children:t})}strike(e,t){return(0,d.jsx)(`s`,{style:{textDecoration:`line-through`},children:t})}textStyle(e,t){let{attrs:n}=e,{color:r=this.config.theme?.colors?.paragraph}=n||{};return(0,d.jsx)(`span`,{style:{color:r},children:t})}link(e,t,n){let{attrs:r}=e,i=this.config.theme?.link,a=r?.href||`#`,o=r?.target||`_blank`,s=r?.rel||`noopener noreferrer nofollow`,c=r?.isUrlVariable??!1;if(c){let e=this.removeLinkProtocol(a);a=this.variableUrlValue(e,n)}else a=this.linkValues.get(a)||a;return(0,d.jsx)(l.Link,{href:a,rel:s,style:{fontWeight:500,textDecoration:`none`,color:i?.color||T},target:o,children:t})}removeLinkProtocol(e){return e.replace(X,``)}variableUrlValue(e,t){let{payloadValue:n}=t||{},r=this.removeLinkProtocol(e);return this.shouldReplaceVariableValues?(typeof n==`object`?n[r]:n)??this.variableValues.get(r)??e:this.variableFormatter({variable:r})}heading(e,t){let{attrs:n}=e,r=`h${Number(n?.level)||1}`,i=n?.textAlign||`left`,{shouldRemoveBottomMargin:a}=this.getMarginOverrideConditions(e,t),{fontSize:o,lineHeight:s,fontWeight:c}=O[r],u=this.shouldShow(e,t);return u?(0,d.jsx)(l.Heading,{as:r,style:{textAlign:i,color:this.config.theme?.colors?.heading,fontSize:o,lineHeight:s,fontWeight:c},mb:a?0:12,mt:0,mx:0,children:this.getMappedContent(e,{...t,parent:e})}):(0,d.jsx)(d.Fragment,{})}variable(e,t){let{payloadValue:n}=t||{},{id:r,fallback:i}=e.attrs||{},a=this.shouldShow(e,t);if(!a||!r)return(0,d.jsx)(d.Fragment,{});let o=this.getVariableValue(r,i,t);return e?.marks?this.renderMark({text:o,marks:e.marks},t):(0,d.jsx)(d.Fragment,{children:o})}getVariableValue(e,t,n){let{payloadValue:r}=n||{},i=this.variableFormatter({variable:e,fallback:t});return this.shouldReplaceVariableValues&&(i=(typeof r==`object`?r[e]:r)??this.variableValues.get(e)??t??i),i}horizontalRule(e,t){return(0,d.jsx)(l.Hr,{style:{marginTop:`32px`,marginBottom:`32px`}})}orderedList(e,t){let{shouldRemoveBottomMargin:n}=this.getMarginOverrideConditions(e,t);return(0,d.jsx)(l.Container,{style:{marginTop:`0px`,marginBottom:n?`0`:`20px`},children:(0,d.jsx)(`ol`,{style:{paddingLeft:`26px`,listStyleType:`decimal`},children:this.getMappedContent(e,{...t,parent:e})})})}bulletList(e,t){let{parent:n,next:r}=t||{},{shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(e,{parent:n,next:r});return(0,d.jsx)(l.Container,{style:{maxWidth:`100%`,marginTop:`0px`,marginBottom:i?`0`:`20px`},children:(0,d.jsx)(`ul`,{style:{paddingLeft:`26px`,listStyleType:`disc`},children:this.getMappedContent(e,{...t,parent:e})})})}listItem(e,t){return(0,d.jsx)(`li`,{style:{marginBottom:`8px`,marginTop:`8px`,paddingLeft:`6px`,...D},children:this.getMappedContent(e,{...t,parent:e})})}button(e,t){let{attrs:n}=e,r=this.config.theme?.button,{text:i,isTextVariable:a,url:o,isUrlVariable:s,variant:c,buttonColor:u,textColor:f,borderRadius:p,alignment:m=`left`,paddingTop:h,paddingRight:g,paddingBottom:_,paddingLeft:v}=n||{},y=u||r?.backgroundColor,b=f||r?.color,x=parseInt(String(h||r?.paddingTop))||0,S=parseInt(String(g||r?.paddingRight))||0,C=parseInt(String(_||r?.paddingBottom))||0,w=parseInt(String(v||r?.paddingLeft))||0,T=this.shouldShow(e,t);if(!T)return(0,d.jsx)(d.Fragment,{});let E=`0px`;p===`round`?E=`9999px`:p===`smooth`&&(E=`6px`);let{shouldRemoveBottomMargin:D}=this.getMarginOverrideConditions(e,t),O=s?this.variableUrlValue(o,t):this.linkValues.get(o)||o,k=a?this.variableUrlValue(i,t):i;return x+=2,C+=2,(0,d.jsx)(l.Container,{style:{textAlign:m,maxWidth:`100%`,marginBottom:D?`0px`:`20px`},children:(0,d.jsx)(l.Button,{href:O,style:{color:String(b),backgroundColor:c===`filled`?String(y):`transparent`,borderColor:String(y),borderWidth:`2px`,borderStyle:`solid`,textDecoration:`none`,fontSize:`14px`,fontWeight:500,borderRadius:E,padding:`${x}px ${S}px ${C}px ${w}px`},children:k})})}spacer(e,t){let{attrs:n}=e,{height:r}=n||{},i=this.shouldShow(e,t);return i?(0,d.jsx)(l.Container,{style:{height:`${r}px`}}):(0,d.jsx)(d.Fragment,{})}hardBreak(e,t){return(0,d.jsx)(`br`,{})}logo(e,t){let{attrs:n}=e,{src:r,isSrcVariable:i,alt:a,title:o,size:s,alignment:c=`left`}=n||{},u=this.shouldShow(e,t);if(!u)return(0,d.jsx)(d.Fragment,{});r=i?this.variableUrlValue(r,t):r;let{shouldRemoveBottomMargin:f}=this.getMarginOverrideConditions(e,t);return(0,d.jsx)(l.Row,{style:{marginTop:`0px`,marginBottom:f?`0px`:`32px`},children:(0,d.jsx)(l.Column,{align:c,children:(0,d.jsx)(l.Img,{alt:a||o||`Logo`,src:r,style:{width:k[s]||s,height:k[s]||s},title:o||a||`Logo`})})})}image(e,t){let{attrs:n}=e,{src:r,isSrcVariable:i,alt:a,title:o,width:s=`auto`,height:c=`auto`,alignment:u=`center`,externalLink:f=``,isExternalLinkVariable:p,borderRadius:m=0}=n||{},h=this.shouldShow(e,t);if(!h)return(0,d.jsx)(d.Fragment,{});let{shouldRemoveBottomMargin:g}=this.getMarginOverrideConditions(e,t);r=i?this.variableUrlValue(r,t):r,f=p?this.variableUrlValue(f,t):f;let _=s===`auto`?`auto`:Number(s),v=_===`auto`?`auto`:`${_}px`,y=c===`auto`?`auto`:Number(c),b=y===`auto`?`auto`:`${y}px`,x=(0,d.jsx)(l.Img,{alt:a||o||`Image`,src:r,style:{width:v,height:b,maxWidth:`100%`,outline:`none`,border:`none`,textDecoration:`none`,display:`block`,borderRadius:m},title:o||a||`Image`});return(0,d.jsx)(l.Row,{style:{marginTop:`0px`,marginBottom:g?`0px`:`32px`},children:(0,d.jsx)(l.Column,{align:u,children:f?(0,d.jsx)(`a`,{href:f,rel:`noopener noreferrer`,style:{display:`block`,maxWidth:`100%`,textDecoration:`none`},target:`_blank`,children:x}):x})})}footer(e,t){let{attrs:n}=e,{textAlign:r=`left`}=n||{},{shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(e,t);return(0,d.jsx)(l.Text,{style:{fontSize:this.config.theme?.fontSize?.footer?.size,lineHeight:this.config.theme?.fontSize?.footer?.lineHeight,color:this.config.theme?.colors?.footer,marginTop:`0px`,marginBottom:i?`0px`:`20px`,textAlign:r,...D},children:this.getMappedContent(e,{...t,parent:e})})}blockquote(e,t){let{isPrevSpacer:n,shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(e,t);return(0,d.jsx)(`blockquote`,{style:{borderLeftWidth:`4px`,borderLeftStyle:`solid`,borderLeftColor:this.config.theme?.colors?.blockquoteBorder,paddingLeft:`16px`,marginLeft:`0px`,marginRight:`0px`,marginTop:n?`0px`:`20px`,marginBottom:r?`0px`:`20px`},children:this.getMappedContent(e,{...t,parent:e})})}code(e,t){return(0,d.jsx)(`code`,{style:{backgroundColor:this.config.theme?.colors?.codeBackground,color:this.config.theme?.colors?.codeText,padding:`2px 4px`,borderRadius:`6px`,fontFamily:A,fontWeight:400,letterSpacing:0},children:t})}linkCard(e,t){let{attrs:n}=e,{shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(e,t),{title:i,description:a,link:o,linkTitle:s,image:c,badgeText:u,subTitle:f}=n||{},p=this.linkValues.get(o)||this.variableValues.get(o)||o||`#`;return(0,d.jsxs)(`a`,{href:p,rel:`noopener noreferrer`,style:{border:`1px solid #eaeaea`,borderRadius:`10px`,textDecoration:`none`,color:`inherit`,display:`block`,marginBottom:r?`0px`:`20px`},target:`_blank`,children:[c?(0,d.jsx)(l.Row,{style:{marginBottom:`6px`},children:(0,d.jsx)(l.Column,{style:{width:`100%`,height:`100%`},children:(0,d.jsx)(l.Img,{alt:i||`Link Card`,src:c,style:{borderRadius:`10px 10px 0 0`,width:`100%`,height:`100%`,objectFit:`cover`},title:i||`Link Card`})})}):null,(0,d.jsx)(l.Row,{style:{padding:`15px`,marginTop:0,marginBottom:0},children:(0,d.jsxs)(l.Column,{style:{verticalAlign:`top`},children:[(0,d.jsxs)(l.Row,{align:void 0,style:{marginBottom:`8px`,marginTop:`0px`},width:`auto`,children:[(0,d.jsx)(l.Column,{children:(0,d.jsx)(l.Text,{style:{fontSize:`18px`,fontWeight:600,color:this.config.theme?.colors?.linkCardTitle,margin:`0px`,...D},children:i})}),u||f?(0,d.jsxs)(l.Column,{style:{paddingLeft:`6px`,verticalAlign:`middle`},children:[u?(0,d.jsx)(`span`,{style:{fontWeight:600,color:this.config.theme?.colors?.linkCardBadgeText,padding:`4px 8px`,borderRadius:`8px`,backgroundColor:this.config.theme?.colors?.linkCardBadgeBackground,fontSize:`12px`,lineHeight:`12px`},children:u}):null,` `,f&&!u?(0,d.jsx)(`span`,{style:{fontWeight:`normal`,color:this.config.theme?.colors?.linkCardSubTitle,fontSize:`12px`,lineHeight:`12px`},children:f}):null]}):null]}),(0,d.jsxs)(l.Text,{style:{fontSize:`16px`,color:this.config.theme?.colors?.linkCardDescription,marginTop:`0px`,marginBottom:`0px`,...D},children:[a,` `,s?(0,d.jsx)(`a`,{href:p,rel:`noopener noreferrer`,style:{color:this.config.theme?.colors?.linkCardTitle,fontSize:`14px`,fontWeight:600,textDecoration:`underline`},children:s}):null]})]})})]})}section(e,t){let{attrs:n}=e,{borderRadius:r=0,backgroundColor:i=j,align:a=M,borderWidth:o=N,borderColor:s=P,marginTop:c=F,marginRight:u=I,marginBottom:f=L,marginLeft:p=R,paddingTop:m=z,paddingRight:h=B,paddingBottom:g=V,paddingLeft:_=H}=n||{},v=this.shouldShow(e,t);return v?(0,d.jsx)(l.Row,{style:{marginTop:c,marginRight:u,marginBottom:f,marginLeft:p},children:(0,d.jsx)(l.Column,{align:a,style:{borderColor:s,borderWidth:o,borderStyle:`solid`,backgroundColor:i,borderRadius:r,paddingTop:m,paddingRight:h,paddingBottom:g,paddingLeft:_},children:this.getMappedContent(e,{...t,parent:e})})}):(0,d.jsx)(d.Fragment,{})}columns(e,t){let{attrs:n}=e,r=this.shouldShow(e,t);if(!r)return(0,d.jsx)(d.Fragment,{});let[i,a]=this.adjustColumnsContent(e);return(0,d.jsx)(l.Row,{width:`${a}%`,style:{margin:0,padding:0,width:`${a}%`},className:`tab-row-full`,children:this.getMappedContent(i,{...t,parent:i})})}adjustColumnsContent(e){let{content:t=[]}=e,n=100,r=t.filter(e=>e.type===`column`&&!!Number(e.attrs?.width||0)),i=t.filter(e=>e.type===`column`&&(e.attrs?.width===`auto`||!e.attrs?.width)),a=r.reduce((e,t)=>e+Number(t.attrs?.width),0),o=n-a,s=Math.round(o/i.length),c=t.filter(e=>e.type===`column`).length,l=e.attrs?.gap??W;return[{...e,content:t.map((e,n)=>{let r=e.type===`column`&&(e.attrs?.width===`auto`||!e.attrs?.width),i=n===0,a=n>0&&n<c-1,o=n===t.length-1,u=0,d=0;if(c<3)u=i?0:l/2,d=o?0:l/2;else{let e=l/2*1.5,t=e/2;u=i?0:a?t:e,d=o?0:a?t:e}return u=Math.round(u*100)/100,d=Math.round(d*100)/100,{...e,attrs:{...e.attrs,width:r?s:e.attrs?.width,isFirstColumn:i,isLastColumn:o,index:n,paddingLeft:u,paddingRight:d}}})},i.length===0?Math.min(n,a):n]}column(e,t){let{attrs:n}=e,{width:r,verticalAlign:i=`top`,paddingLeft:a=0,paddingRight:o=0}=n||{};return(0,d.jsx)(l.Column,{width:`${Number(r)}%`,style:{width:`${Number(r)}%`,margin:0,verticalAlign:i},className:`tab-col-full`,children:(0,d.jsx)(l.Section,{style:{margin:0,paddingLeft:a,paddingRight:o},className:`tab-pad`,children:this.getMappedContent(e,{...t,parent:e})})})}repeat(e,t){let{attrs:n}=e,{each:r=``}=n||{},i=this.shouldShow(e,t);if(!i)return(0,d.jsx)(d.Fragment,{});let{payloadValue:a}=t||{};a=typeof a==`object`?a:{};let o=this.payloadValues.get(r)??a[r]??[];if(!Array.isArray(o))throw Error(`Payload value for each "${r}" is not an array`);return(0,d.jsx)(d.Fragment,{children:o.map(n=>(0,d.jsx)(c.Fragment,{children:this.getMappedContent(e,{...t,parent:e,payloadValue:n})},b()))})}for(e,t){return this.repeat(e,t)}shouldShow(e,t){let n=e?.attrs?.showIfKey??``;if(!n)return!0;let{payloadValue:r}=t||{};return r=typeof r==`object`?r:{},!!(this.payloadValues.get(n)??r[n])}htmlCodeBlock(e,t){let n=this.shouldShow(e,t);if(!n)return(0,d.jsx)(d.Fragment,{});let r=e.content?.reduce((e,n)=>{if(n?.type===`text`)return e+n?.text;if(n?.type===`variable`){let r=this.getVariableValue(n?.attrs?.id,n?.attrs?.fallback,t);return e+r}return e},``)||``,i=(0,p.default)(r),a=(0,f.parse)(i),o=a?.querySelector(`head`);o?.remove();let s=a.toString();return(0,d.jsx)(`table`,{align:`left`,width:`100%`,border:0,cellPadding:`0`,cellSpacing:`0`,role:`presentation`,children:(0,d.jsx)(`tbody`,{children:(0,d.jsx)(`tr`,{style:{width:`100%`},children:(0,d.jsx)(`td`,{style:{width:`100%`},dangerouslySetInnerHTML:{__html:s}})})})})}inlineImage(e,t){let{attrs:n}=e,{src:r,isSrcVariable:i,alt:a=``,title:o=``,height:s=J,width:c=Y,externalLink:l=``,isExternalLinkVariable:u}=n||{};r=i?this.variableUrlValue(r,t):r,l=u?this.variableUrlValue(l,t):l;let f=(0,d.jsx)(`img`,{src:r,alt:a,title:o,width:c,height:s,style:{display:`inline`,verticalAlign:`middle`,width:`${c}px`,height:`${s}px`,outline:`none`,border:`none`,textDecoration:`none`}});return l?(0,d.jsx)(`a`,{href:l,rel:`noopener noreferrer`,style:{display:`inline`,textDecoration:`none`},target:`_blank`,children:f}):f}};async function oe(e,t){let{theme:n,preview:r,...i}=t||{},a=new $(e);return a.setPreviewText(r),a.setTheme(n||{}),a.render(i)}exports.DEFAULT_COLUMNS_GAP=W,exports.DEFAULT_COLUMNS_WIDTH=U,exports.DEFAULT_COLUMN_BACKGROUND_COLOR=G,exports.DEFAULT_COLUMN_BORDER_COLOR=ee,exports.DEFAULT_COLUMN_BORDER_RADIUS=K,exports.DEFAULT_COLUMN_BORDER_WIDTH=q,exports.DEFAULT_COLUMN_PADDING_BOTTOM=re,exports.DEFAULT_COLUMN_PADDING_LEFT=ie,exports.DEFAULT_COLUMN_PADDING_RIGHT=ne,exports.DEFAULT_COLUMN_PADDING_TOP=te,exports.DEFAULT_HTML_PROPS=Q,exports.DEFAULT_INLINE_IMAGE_HEIGHT=J,exports.DEFAULT_INLINE_IMAGE_WIDTH=Y,exports.DEFAULT_META_TAGS=Z,exports.DEFAULT_SECTION_ALIGN=M,exports.DEFAULT_SECTION_BACKGROUND_COLOR=j,exports.DEFAULT_SECTION_BORDER_COLOR=P,exports.DEFAULT_SECTION_BORDER_WIDTH=N,exports.DEFAULT_SECTION_MARGIN_BOTTOM=L,exports.DEFAULT_SECTION_MARGIN_LEFT=R,exports.DEFAULT_SECTION_MARGIN_RIGHT=I,exports.DEFAULT_SECTION_MARGIN_TOP=F,exports.DEFAULT_SECTION_PADDING_BOTTOM=V,exports.DEFAULT_SECTION_PADDING_LEFT=H,exports.DEFAULT_SECTION_PADDING_RIGHT=B,exports.DEFAULT_SECTION_PADDING_TOP=z,exports.LINK_PROTOCOL_REGEX=X,exports.Maily=$,exports.render=oe;
2
2
  //# sourceMappingURL=index.js.map