next-cloudinary 0.0.1 → 0.0.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.
@@ -1,5 +1,5 @@
1
- import { Cloudinary } from '@cloudinary/url-gen';
2
1
  import Image from 'next/image';
2
+ import { Cloudinary } from '@cloudinary/url-gen';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
5
5
  function _extends() {
@@ -34,49 +34,389 @@ function _objectWithoutPropertiesLoose(source, excluded) {
34
34
  return target;
35
35
  }
36
36
 
37
- const _excluded = ["effects", "removeBackground"];
38
- const cld = new Cloudinary({
37
+ const cld$1 = new Cloudinary({
39
38
  cloud: {
40
39
  cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME
40
+ },
41
+ url: {
42
+ // Used to avoid issues with SSR particularly for the blurred placeholder
43
+ analytics: false
41
44
  }
42
45
  });
46
+ /**
47
+ * createPlaceholderUrl
48
+ */
43
49
 
44
- function cloudinaryLoader(options, cldOptions) {
50
+ function createPlaceholderUrl({
51
+ src,
52
+ placeholder
53
+ }) {
54
+ const cldImage = cld$1.image(src).resize('c_limit,w_100').delivery('q_1').format('auto');
55
+
56
+ if (placeholder === 'grayscale') {
57
+ cldImage.effect('e_grayscale');
58
+ }
59
+
60
+ if (placeholder.includes('color:')) {
61
+ const color = placeholder.split(':').splice(1).join(':');
62
+ cldImage.effect('e_grayscale');
63
+ cldImage.effect(`e_colorize:60,co_${color}`);
64
+ }
65
+
66
+ return cldImage.toURL();
67
+ }
68
+
69
+ const cropsGravityAuto = ['crop', 'fill', 'lfill', 'fill_pad', 'thumb'];
70
+ function croppingPlugin({
71
+ cldImage,
72
+ options,
73
+ cldOptions
74
+ } = {}) {
45
75
  const {
46
- src,
47
76
  width,
48
- format = 'auto',
49
- quality = 'auto'
77
+ height
50
78
  } = options;
51
79
  const {
52
- effects = [],
80
+ crop = 'limit',
81
+ gravity
82
+ } = cldOptions;
83
+ let transformationString = `c_${crop},w_${width}`;
84
+
85
+ if (!gravity && cropsGravityAuto.includes(crop)) {
86
+ gravity = 'auto';
87
+ }
88
+
89
+ if (!['limit'].includes(crop)) {
90
+ transformationString = `${transformationString},h_${height}`;
91
+ }
92
+
93
+ if (gravity) {
94
+ if (gravity === 'auto' && !cropsGravityAuto.includes(crop)) {
95
+ console.warn('Auto gravity can only be used with crop, fill, lfill, fill_pad or thumb. Not applying gravity.');
96
+ } else {
97
+ transformationString = `${transformationString},g_${gravity}`;
98
+ }
99
+ }
100
+
101
+ cldImage.resize(transformationString);
102
+ }
103
+
104
+ // aspectRatio
105
+ const primary = {
106
+ aspectRatio: {
107
+ qualifier: 'ar'
108
+ },
109
+ crop: {
110
+ qualifier: 'c'
111
+ },
112
+ gravity: {
113
+ qualifier: 'g'
114
+ },
115
+ height: {
116
+ qualifier: 'h'
117
+ },
118
+ width: {
119
+ qualifier: 'w'
120
+ }
121
+ };
122
+ const position = {
123
+ angle: {
124
+ qualifier: 'a'
125
+ },
126
+ gravity: {
127
+ qualifier: 'g'
128
+ },
129
+ x: {
130
+ qualifier: 'x'
131
+ },
132
+ y: {
133
+ qualifier: 'y'
134
+ }
135
+ };
136
+ const text = {
137
+ color: {
138
+ qualifier: 'co',
139
+ location: 'primary'
140
+ },
141
+ textDecoration: {
142
+ qualifier: false
143
+ },
144
+ fontFamily: {
145
+ qualifier: false
146
+ },
147
+ fontSize: {
148
+ qualifier: false
149
+ },
150
+ fontWeight: {
151
+ qualifier: false
152
+ },
153
+ letterSpacing: {
154
+ qualifier: 'letter_spacing'
155
+ }
156
+ };
157
+
158
+ const _excluded$2 = ["publicId", "position", "text", "effects"];
159
+ function overlaysPlugin({
160
+ cldImage,
161
+ options,
162
+ cldOptions
163
+ } = {}) {
164
+ const {
165
+ overlays = []
166
+ } = cldOptions;
167
+ const type = 'overlay';
168
+ const typeQualifier = 'l';
169
+ overlays.forEach(_ref => {
170
+ let {
171
+ publicId,
172
+ position: position$1,
173
+ text: text$1,
174
+ effects: layerEffects = []
175
+ } = _ref,
176
+ options = _objectWithoutPropertiesLoose(_ref, _excluded$2);
177
+
178
+ const hasPublicId = typeof publicId === 'string';
179
+ const hasText = typeof text$1 === 'object';
180
+ const hasPosition = typeof position$1 === 'object';
181
+
182
+ if (!hasPublicId && !hasText) {
183
+ console.warn(`An ${type} is missing Public ID or Text`);
184
+ return;
185
+ } // Start to construct the transformation string using text or the public ID
186
+ // if it's image-based
187
+
188
+
189
+ let layerTransformation;
190
+
191
+ if (hasText) {
192
+ layerTransformation = `${typeQualifier}_text`;
193
+ } else {
194
+ layerTransformation = `${typeQualifier}_${publicId.replace(/\//g, ':')}`;
195
+ } // Begin organizing transformations based on what it is and the location
196
+ // it needs to be placed in the URL
197
+
198
+
199
+ const primary$1 = [];
200
+ const applied = []; // Gemeral options
201
+
202
+ Object.keys(options).forEach(key => {
203
+ if (!primary[key]) return;
204
+ const {
205
+ qualifier
206
+ } = primary[key];
207
+ primary$1.push(`${qualifier}_${options[key]}`);
208
+ }); // Layer effects
209
+
210
+ layerEffects.forEach(effect => {
211
+ Object.keys(effect).forEach(key => {
212
+ if (!primary[key]) return;
213
+ const {
214
+ qualifier
215
+ } = primary[key];
216
+ primary$1.push(`${qualifier}_${effect[key]}`);
217
+ });
218
+ }); // Text styling
219
+
220
+ if (hasText) {
221
+ const textTransformations = [];
222
+ Object.keys(text$1).forEach(key => {
223
+ if (!text[key]) return;
224
+ const {
225
+ qualifier,
226
+ location
227
+ } = text[key];
228
+
229
+ if (location === 'primary') {
230
+ primary$1.push(`${qualifier}_${text$1[key]}`);
231
+ } else {
232
+ textTransformations.push(text$1[key]);
233
+ }
234
+ });
235
+ layerTransformation = `${layerTransformation}:${textTransformations.join('_')}:${text$1.text}`;
236
+ } // Positioning
237
+
238
+
239
+ if (hasPosition) {
240
+ Object.keys(position$1).forEach(key => {
241
+ if (!position[key]) return;
242
+ const {
243
+ qualifier
244
+ } = position[key];
245
+ applied.push(`${qualifier}_${position$1[key]}`);
246
+ });
247
+ } // Add all primary transformations
248
+
249
+
250
+ layerTransformation = `${layerTransformation},${primary$1.join(',')}`; // Add all applied transformations
251
+
252
+ layerTransformation = `${layerTransformation}/fl_layer_apply`;
253
+
254
+ if (applied.length > 0) {
255
+ layerTransformation = `${layerTransformation},${applied.join(',')}`;
256
+ } // Finally add it to the image
257
+
258
+
259
+ cldImage.addTransformation(layerTransformation);
260
+ });
261
+ }
262
+
263
+ function removeBackgroundPlugin({
264
+ cldImage,
265
+ options,
266
+ cldOptions
267
+ } = {}) {
268
+ const {
53
269
  removeBackground = false
54
270
  } = cldOptions;
55
- const cldImage = cld.image(src);
56
271
 
57
272
  if (removeBackground) {
58
273
  cldImage.effect('e_background_removal');
59
274
  }
275
+ }
276
+
277
+ const _excluded$1 = ["publicId", "type", "position", "text", "effects"];
278
+ function underlaysPlugin({
279
+ cldImage,
280
+ options,
281
+ cldOptions
282
+ } = {}) {
283
+ const {
284
+ underlays = []
285
+ } = cldOptions;
286
+ const typeQualifier = 'u';
287
+ underlays.forEach(_ref => {
288
+ let {
289
+ publicId,
290
+ type,
291
+ position: position$1,
292
+ effects: layerEffects = []
293
+ } = _ref,
294
+ options = _objectWithoutPropertiesLoose(_ref, _excluded$1);
295
+
296
+ const hasPublicId = typeof publicId === 'string';
297
+ const hasPosition = typeof position$1 === 'object';
298
+
299
+ if (!hasPublicId) {
300
+ console.warn(`An ${type} is missing a Public ID`);
301
+ return;
302
+ } // Start to construct the transformation string using text or the public ID
303
+ // if it's image-based
304
+
305
+
306
+ let layerTransformation = `${typeQualifier}_${publicId.replace(/\//g, ':')}`; // Begin organizing transformations based on what it is and the location
307
+ // it needs to be placed in the URL
308
+
309
+ const primary$1 = [];
310
+ const applied = []; // Gemeral options
311
+
312
+ Object.keys(options).forEach(key => {
313
+ if (!primary[key]) return;
314
+ const {
315
+ qualifier
316
+ } = primary[key];
317
+ primary$1.push(`${qualifier}_${options[key]}`);
318
+ }); // Layer effects
319
+
320
+ layerEffects.forEach(effect => {
321
+ Object.keys(effect).forEach(key => {
322
+ if (!primary[key]) return;
323
+ const {
324
+ qualifier
325
+ } = primary[key];
326
+ primary$1.push(`${qualifier}_${effect[key]}`);
327
+ });
328
+ }); // Positioning
329
+
330
+ if (hasPosition) {
331
+ Object.keys(position$1).forEach(key => {
332
+ if (!position[key]) return;
333
+ const {
334
+ qualifier
335
+ } = position[key];
336
+ applied.push(`${qualifier}_${position$1[key]}`);
337
+ });
338
+ } // Add all primary transformations
339
+
340
+
341
+ layerTransformation = `${layerTransformation},${primary$1.join(',')}`; // Add all applied transformations
60
342
 
61
- effects.forEach(effect => cldImage.effect(effect));
62
- return cldImage.resize(`c_limit,w_${width}`).format(format).delivery(`q_${quality}`).toURL();
343
+ layerTransformation = `${layerTransformation}/fl_layer_apply`;
344
+
345
+ if (applied.length > 0) {
346
+ layerTransformation = `${layerTransformation},${applied.join(',')}`;
347
+ } // Finally add it to the image
348
+
349
+
350
+ cldImage.addTransformation(layerTransformation);
351
+ });
352
+ }
353
+
354
+ const cld = new Cloudinary({
355
+ cloud: {
356
+ cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME
357
+ }
358
+ });
359
+ const transformationPlugins = [// Background Removal must always come first
360
+ removeBackgroundPlugin, croppingPlugin, overlaysPlugin, underlaysPlugin];
361
+ function cloudinaryLoader(options, cldOptions) {
362
+ const {
363
+ src,
364
+ width,
365
+ format = 'auto',
366
+ quality = 'auto'
367
+ } = options;
368
+ const cldImage = cld.image(src);
369
+ transformationPlugins.forEach(plugin => {
370
+ plugin({
371
+ cldImage,
372
+ options,
373
+ cldOptions
374
+ });
375
+ });
376
+ return cldImage.format(format).delivery(`q_${quality}`).toURL();
63
377
  }
64
378
 
379
+ const _excluded = ["crop", "gravity", "overlays", "removeBackground", "underlays"];
380
+
65
381
  const CldImage = _ref => {
66
382
  let {
67
- effects,
68
- removeBackground
383
+ crop,
384
+ gravity,
385
+ overlays,
386
+ removeBackground,
387
+ underlays
69
388
  } = _ref,
70
389
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
71
390
 
72
391
  const cldOptions = {
73
- effects,
74
- removeBackground
392
+ crop,
393
+ gravity,
394
+ overlays,
395
+ removeBackground,
396
+ underlays
75
397
  };
76
- return /*#__PURE__*/jsx(Image, _extends({}, props, {
77
- loader: options => cloudinaryLoader(options, cldOptions)
398
+ const imageProps = {}; // If we see a placeholder option, configure a Cloudinary-based URL.
399
+ // The resulting image will always be blurred per Next.js, so we're
400
+ // limited on options for placeholders.
401
+ // https://nextjs.org/docs/api-reference/next/image#blurdataurl
402
+
403
+ if (props.placeholder) {
404
+ imageProps.blurDataURL = createPlaceholderUrl({
405
+ src: props.src,
406
+ placeholder: props.placeholder
407
+ });
408
+
409
+ if (props.placeholder !== 'blur') {
410
+ props.placeholder = 'blur';
411
+ }
412
+ }
413
+
414
+ return /*#__PURE__*/jsx(Image, _extends({}, imageProps, props, {
415
+ loader: options => cloudinaryLoader(_extends({}, props, {
416
+ options
417
+ }), cldOptions)
78
418
  }));
79
419
  };
80
420
 
81
- export { CldImage };
421
+ export { CldImage, cloudinaryLoader, position, primary, text };
82
422
  //# sourceMappingURL=next-cloudinary.modern.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"next-cloudinary.modern.mjs","sources":["../src/components/CldImage/CldImage.js"],"sourcesContent":["import { Cloudinary } from '@cloudinary/url-gen';\nimport Image from 'next/image';\n\nconst cld = new Cloudinary({\n cloud: {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME\n }\n});\n\nfunction cloudinaryLoader(options, cldOptions) {\n const {\n src,\n width,\n format = 'auto',\n quality = 'auto'\n } = options;\n\n const {\n effects = [],\n removeBackground = false\n } = cldOptions;\n\n const cldImage = cld.image(src);\n\n if ( removeBackground ) {\n cldImage.effect('e_background_removal');\n }\n\n effects.forEach(effect => cldImage.effect(effect));\n\n return cldImage.resize(`c_limit,w_${width}`).format(format).delivery(`q_${quality}`).toURL();\n}\n\nconst CldImage = ({ effects, removeBackground, ...props }) => {\n const cldOptions = {\n effects,\n removeBackground\n };\n return <Image {...props} loader={(options) => cloudinaryLoader(options, cldOptions)} />\n}\n\nexport default CldImage;"],"names":["cld","Cloudinary","cloud","cloudName","process","env","NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME","cloudinaryLoader","options","cldOptions","src","width","format","quality","effects","removeBackground","cldImage","image","effect","forEach","resize","delivery","toURL","CldImage","props","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAMA,GAAG,GAAG,IAAIC,UAAJ,CAAe;AACzBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,SAAS,EAAEC,OAAO,CAACC,GAAR,CAAYC,iCAAAA;AADlB,GAAA;AADkB,CAAf,CAAZ,CAAA;;AAMA,SAASC,gBAAT,CAA0BC,OAA1B,EAAmCC,UAAnC,EAA+C;EAC7C,MAAM;IACJC,GADI;IAEJC,KAFI;AAGJC,IAAAA,MAAM,GAAG,MAHL;AAIJC,IAAAA,OAAO,GAAG,MAAA;AAJN,GAAA,GAKFL,OALJ,CAAA;EAOA,MAAM;AACJM,IAAAA,OAAO,GAAG,EADN;AAEJC,IAAAA,gBAAgB,GAAG,KAAA;AAFf,GAAA,GAGFN,UAHJ,CAAA;AAKA,EAAA,MAAMO,QAAQ,GAAGhB,GAAG,CAACiB,KAAJ,CAAUP,GAAV,CAAjB,CAAA;;AAEA,EAAA,IAAKK,gBAAL,EAAwB;IACtBC,QAAQ,CAACE,MAAT,CAAgB,sBAAhB,CAAA,CAAA;AACD,GAAA;;EAEDJ,OAAO,CAACK,OAAR,CAAgBD,MAAM,IAAIF,QAAQ,CAACE,MAAT,CAAgBA,MAAhB,CAA1B,CAAA,CAAA;AAEA,EAAA,OAAOF,QAAQ,CAACI,MAAT,CAAiB,CAAYT,UAAAA,EAAAA,KAAM,EAAnC,CAAsCC,CAAAA,MAAtC,CAA6CA,MAA7C,CAAA,CAAqDS,QAArD,CAA+D,CAAA,EAAA,EAAIR,OAAQ,CAA3E,CAAA,CAAA,CAA8ES,KAA9E,EAAP,CAAA;AACD,CAAA;;AAEKC,MAAAA,QAAQ,GAAG,IAA6C,IAAA;EAAA,IAA5C;IAAET,OAAF;AAAWC,IAAAA,gBAAAA;GAAiC,GAAA,IAAA;AAAA,MAAZS,KAAY,GAAA,6BAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;;AAC5D,EAAA,MAAMf,UAAU,GAAG;IACjBK,OADiB;AAEjBC,IAAAA,gBAAAA;GAFF,CAAA;EAIA,oBAAOU,GAAA,CAAC,KAAD,EAAA,QAAA,CAAA,EAAA,EAAWD,KAAX,EAAA;AAAkB,IAAA,MAAM,EAAGhB,OAAD,IAAaD,gBAAgB,CAACC,OAAD,EAAUC,UAAV,CAAA;GAA9D,CAAA,CAAA,CAAA;AACD;;;;"}
1
+ {"version":3,"file":"next-cloudinary.modern.mjs","sources":["../src/lib/cloudinary.js","../src/plugins/cropping.js","../src/constants/qualifiers.js","../src/plugins/overlays.js","../src/plugins/remove-background.js","../src/plugins/underlays.js","../src/loaders/cloudinary-loader.js","../src/components/CldImage/CldImage.js"],"sourcesContent":["import { Cloudinary } from '@cloudinary/url-gen';\n\nconst cld = new Cloudinary({\n cloud: {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME\n },\n url: {\n // Used to avoid issues with SSR particularly for the blurred placeholder\n analytics: false\n }\n});\n\n/**\n * createPlaceholderUrl\n */\n\nexport function createPlaceholderUrl({ src, placeholder }) {\n const cldImage = cld.image(src)\n .resize('c_limit,w_100')\n .delivery('q_1')\n .format('auto');\n\n if ( placeholder === 'grayscale' ) {\n cldImage.effect('e_grayscale');\n }\n\n if ( placeholder.includes('color:') ) {\n const color = placeholder.split(':').splice(1).join(':')\n cldImage.effect('e_grayscale');\n cldImage.effect(`e_colorize:60,co_${color}`);\n }\n\n return cldImage.toURL();\n}","const cropsGravityAuto = [ 'crop', 'fill', 'lfill', 'fill_pad', 'thumb' ];\n\nexport function croppingPlugin({ cldImage, options, cldOptions } = {}) {\n const { width, height } = options;\n const { crop = 'limit', gravity } = cldOptions;\n\n let transformationString = `c_${crop},w_${width}`;\n\n if ( !gravity && cropsGravityAuto.includes(crop) ) {\n gravity = 'auto';\n }\n\n if ( !['limit'].includes(crop) ) {\n transformationString = `${transformationString},h_${height}`;\n }\n\n if ( gravity ) {\n if ( gravity === 'auto' && !cropsGravityAuto.includes(crop) ) {\n console.warn('Auto gravity can only be used with crop, fill, lfill, fill_pad or thumb. Not applying gravity.');\n } else {\n transformationString = `${transformationString},g_${gravity}`;\n }\n }\n\n cldImage.resize(transformationString);\n}","// aspectRatio\n\nexport const primary = {\n aspectRatio: {\n qualifier: 'ar'\n },\n crop: {\n qualifier: 'c'\n },\n gravity: {\n qualifier: 'g'\n },\n height: {\n qualifier: 'h'\n },\n width: {\n qualifier: 'w'\n },\n};\n\nexport const position = {\n angle: {\n qualifier: 'a'\n },\n gravity: {\n qualifier: 'g'\n },\n x: {\n qualifier: 'x'\n },\n y: {\n qualifier: 'y'\n },\n}\n\nexport const text = {\n color: {\n qualifier: 'co',\n location: 'primary'\n },\n textDecoration: {\n qualifier: false\n },\n fontFamily: {\n qualifier: false\n },\n fontSize: {\n qualifier: false\n },\n fontWeight: {\n qualifier: false\n },\n letterSpacing: {\n qualifier: 'letter_spacing'\n }\n}","import {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport function overlaysPlugin({ cldImage, options, cldOptions } = {}) {\n const { overlays = [] } = cldOptions;\n\n const type = 'overlay';\n const typeQualifier = 'l';\n\n overlays.forEach(({ publicId, position, text, effects: layerEffects = [], ...options }) => {\n const hasPublicId = typeof publicId === 'string';\n const hasText = typeof text === 'object';\n const hasPosition = typeof position === 'object';\n\n if ( !hasPublicId && !hasText ) {\n console.warn(`An ${type} is missing Public ID or Text`);\n return;\n }\n\n // Start to construct the transformation string using text or the public ID\n // if it's image-based\n\n let layerTransformation;\n\n if ( hasText ) {\n layerTransformation = `${typeQualifier}_text`;\n } else {\n layerTransformation = `${typeQualifier}_${publicId.replace(/\\//g, ':')}`;\n }\n\n // Begin organizing transformations based on what it is and the location\n // it needs to be placed in the URL\n\n const primary = [];\n const applied = [];\n\n // Gemeral options\n\n Object.keys(options).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${options[key]}`);\n });\n\n // Layer effects\n\n layerEffects.forEach(effect => {\n Object.keys(effect).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${effect[key]}`);\n });\n });\n\n // Text styling\n\n if ( hasText ) {\n const textTransformations = [];\n\n Object.keys(text).forEach(key => {\n if ( !qualifiersText[key] ) return;\n\n const { qualifier, location } = qualifiersText[key];\n\n if ( location === 'primary' ) {\n primary.push(`${qualifier}_${text[key]}`);\n } else {\n textTransformations.push(text[key]);\n }\n });\n\n layerTransformation = `${layerTransformation}:${textTransformations.join('_')}:${text.text}`\n }\n\n // Positioning\n\n if ( hasPosition ) {\n Object.keys(position).forEach(key => {\n if ( !qualifiersPosition[key] ) return;\n\n const { qualifier } = qualifiersPosition[key];\n\n applied.push(`${qualifier}_${position[key]}`);\n });\n }\n\n // Add all primary transformations\n\n layerTransformation = `${layerTransformation},${primary.join(',')}`;\n\n // Add all applied transformations\n\n layerTransformation = `${layerTransformation}/fl_layer_apply`;\n\n if ( applied.length > 0 ) {\n layerTransformation = `${layerTransformation},${applied.join(',')}`;\n }\n\n // Finally add it to the image\n\n cldImage.addTransformation(layerTransformation);\n });\n}","export function removeBackgroundPlugin({ cldImage, options, cldOptions } = {}) {\n const { removeBackground = false } = cldOptions;\n if ( removeBackground ) {\n cldImage.effect('e_background_removal');\n }\n}","import {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport function underlaysPlugin({ cldImage, options, cldOptions } = {}) {\n const { underlays = [] } = cldOptions;\n\n const type = 'underlay';\n const typeQualifier = 'u';\n\n underlays.forEach(({ publicId, type, position, text, effects: layerEffects = [], ...options }) => {\n const hasPublicId = typeof publicId === 'string';\n const hasPosition = typeof position === 'object';\n\n if ( !hasPublicId ) {\n console.warn(`An ${type} is missing a Public ID`);\n return;\n }\n\n // Start to construct the transformation string using text or the public ID\n // if it's image-based\n\n let layerTransformation = `${typeQualifier}_${publicId.replace(/\\//g, ':')}`;\n\n // Begin organizing transformations based on what it is and the location\n // it needs to be placed in the URL\n\n const primary = [];\n const applied = [];\n\n // Gemeral options\n\n Object.keys(options).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${options[key]}`);\n });\n\n // Layer effects\n\n layerEffects.forEach(effect => {\n Object.keys(effect).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${effect[key]}`);\n });\n });\n\n // Positioning\n\n if ( hasPosition ) {\n Object.keys(position).forEach(key => {\n if ( !qualifiersPosition[key] ) return;\n\n const { qualifier } = qualifiersPosition[key];\n\n applied.push(`${qualifier}_${position[key]}`);\n });\n }\n\n // Add all primary transformations\n\n layerTransformation = `${layerTransformation},${primary.join(',')}`;\n\n // Add all applied transformations\n\n layerTransformation = `${layerTransformation}/fl_layer_apply`;\n\n if ( applied.length > 0 ) {\n layerTransformation = `${layerTransformation},${applied.join(',')}`;\n }\n\n // Finally add it to the image\n\n cldImage.addTransformation(layerTransformation);\n });\n}","import { Cloudinary } from '@cloudinary/url-gen';\n\nimport { croppingPlugin } from '../plugins/cropping';\nimport { overlaysPlugin } from '../plugins/overlays';\nimport { removeBackgroundPlugin } from '../plugins/remove-background';\nimport { underlaysPlugin } from '../plugins/underlays';\n\nimport {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nconst cld = new Cloudinary({\n cloud: {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME\n },\n});\n\nconst transformationPlugins = [\n // Background Removal must always come first\n removeBackgroundPlugin,\n\n croppingPlugin,\n overlaysPlugin,\n underlaysPlugin\n];\n\nexport function cloudinaryLoader(options, cldOptions) {\n const {\n src,\n width,\n format = 'auto',\n quality = 'auto',\n } = options;\n\n const cldImage = cld.image(src);\n\n transformationPlugins.forEach(plugin => {\n plugin({\n cldImage,\n options,\n cldOptions\n });\n });\n\n return cldImage.format(format).delivery(`q_${quality}`).toURL();\n}","import Image from 'next/image';\n\nimport { createPlaceholderUrl } from '../../lib/cloudinary';\nimport { cloudinaryLoader } from '../../loaders/cloudinary-loader';\n\nconst CldImage = ({ crop, gravity, overlays, removeBackground, underlays, ...props }) => {\n const cldOptions = {\n crop,\n gravity,\n overlays,\n removeBackground,\n underlays,\n };\n\n const imageProps = {};\n\n // If we see a placeholder option, configure a Cloudinary-based URL.\n // The resulting image will always be blurred per Next.js, so we're\n // limited on options for placeholders.\n // https://nextjs.org/docs/api-reference/next/image#blurdataurl\n\n if ( props.placeholder ) {\n imageProps.blurDataURL = createPlaceholderUrl({\n src: props.src,\n placeholder: props.placeholder\n });\n\n if ( props.placeholder !== 'blur' ) {\n props.placeholder = 'blur';\n }\n }\n\n return (\n <Image\n {...imageProps}\n {...props}\n loader={(options) => cloudinaryLoader({ ...props, options }, cldOptions)}\n />\n );\n}\n\nexport default CldImage;"],"names":["cld","Cloudinary","cloud","cloudName","process","env","NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME","url","analytics","createPlaceholderUrl","src","placeholder","cldImage","image","resize","delivery","format","effect","includes","color","split","splice","join","toURL","cropsGravityAuto","croppingPlugin","options","cldOptions","width","height","crop","gravity","transformationString","console","warn","primary","aspectRatio","qualifier","position","angle","x","y","text","location","textDecoration","fontFamily","fontSize","fontWeight","letterSpacing","overlaysPlugin","overlays","type","typeQualifier","forEach","publicId","effects","layerEffects","_excluded","hasPublicId","hasText","hasPosition","layerTransformation","replace","applied","Object","keys","key","qualifiersPrimary","push","textTransformations","qualifiersText","qualifiersPosition","length","addTransformation","removeBackgroundPlugin","removeBackground","underlaysPlugin","underlays","transformationPlugins","cloudinaryLoader","quality","plugin","CldImage","props","imageProps","blurDataURL","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAMA,KAAG,GAAG,IAAIC,UAAJ,CAAe;AACzBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,SAAS,EAAEC,OAAO,CAACC,GAAR,CAAYC,iCAAAA;GAFA;AAIzBC,EAAAA,GAAG,EAAE;AACH;AACAC,IAAAA,SAAS,EAAE,KAAA;AAFR,GAAA;AAJoB,CAAf,CAAZ,CAAA;AAUA;AACA;AACA;;AAEO,SAASC,oBAAT,CAA8B;EAAEC,GAAF;AAAOC,EAAAA,WAAAA;AAAP,CAA9B,EAAoD;AACzD,EAAA,MAAMC,QAAQ,GAAGZ,KAAG,CAACa,KAAJ,CAAUH,GAAV,CACII,CAAAA,MADJ,CACW,eADX,CAAA,CAEIC,QAFJ,CAEa,KAFb,EAGIC,MAHJ,CAGW,MAHX,CAAjB,CAAA;;EAKA,IAAKL,WAAW,KAAK,WAArB,EAAmC;IACjCC,QAAQ,CAACK,MAAT,CAAgB,aAAhB,CAAA,CAAA;AACD,GAAA;;AAED,EAAA,IAAKN,WAAW,CAACO,QAAZ,CAAqB,QAArB,CAAL,EAAsC;AACpC,IAAA,MAAMC,KAAK,GAAGR,WAAW,CAACS,KAAZ,CAAkB,GAAlB,CAAuBC,CAAAA,MAAvB,CAA8B,CAA9B,CAAA,CAAiCC,IAAjC,CAAsC,GAAtC,CAAd,CAAA;IACAV,QAAQ,CAACK,MAAT,CAAgB,aAAhB,CAAA,CAAA;AACAL,IAAAA,QAAQ,CAACK,MAAT,CAAiB,CAAA,iBAAA,EAAmBE,KAAM,CAA1C,CAAA,CAAA,CAAA;AACD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