42353.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. "use strict";
  2. exports.id = 42353;
  3. exports.ids = [42353];
  4. exports.modules = {
  5. /***/ 42353:
  6. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  7. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  8. /* harmony export */ "y": () => (/* binding */ getBlurDataUrl)
  9. /* harmony export */ });
  10. /* unused harmony export shimmer */
  11. const DEFAULT_COLOR1 = "#f7f7f7";
  12. const DEFAULT_COLOR2 = "#d1d1d1";
  13. /**
  14. * Convert a string to a base64.
  15. *
  16. * @param {string} str
  17. * @returns {string}
  18. */ const toBase64 = (str)=> true ? Buffer.from(str).toString("base64") : 0;
  19. /**
  20. * Get the shimmer SVG.
  21. *
  22. * @param {number} w
  23. * @param {number} h
  24. * @param {string} color1
  25. * @param {string} color2
  26. * @returns {string}
  27. */ const shimmer = (w, h, color1, color2)=>`
  28. <svg width="${w}" height="${h}" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  29. <defs>
  30. <linearGradient id="g">
  31. <stop stop-color="${color1}" offset="20%" />
  32. <stop stop-color="${color2}" offset="50%" />
  33. <stop stop-color="${color1}" offset="70%" />
  34. </linearGradient>
  35. </defs>
  36. <rect width="${w}" height="${h}" fill="${color1}" />
  37. <rect id="r" width="${w}" height="${h}" fill="url(#g)" />
  38. <animate xlink:href="#r" attributeName="x" from="-${w}" to="${w}" dur="1.2s" repeatCount="indefinite" />
  39. </svg>`;
  40. /**
  41. * Get the blue data url that Next.js will use before loading the actual image.
  42. *
  43. * @param {number} h Height
  44. * @param {number} w Width
  45. * @param {string} color1
  46. * @param {string} color2
  47. * @returns {string}
  48. */ const getBlurDataUrl = (h, w, color1 = DEFAULT_COLOR1, color2 = DEFAULT_COLOR2)=>`data:image/svg+xml;base64,${toBase64(shimmer(w, h, color1, color2))}`;
  49. /***/ })
  50. };
  51. ;
  52. //# sourceMappingURL=42353.js.map