42353.js.map 2.7 KB

1
  1. {"version":3,"file":"42353.js","mappings":";;;;;;;;;;;;AAAA,MAAMA,cAAc,GAAG,SAAS;AAChC,MAAMC,cAAc,GAAG,SAAS;AAEhC;;;;;CAKC,GACD,MAAMC,QAAQ,GAAG,CAACC,GAAW,GAC3B,KAA6B,GAAGC,MAAM,CAACC,IAAI,CAACF,GAAG,CAAC,CAACG,QAAQ,CAAC,QAAQ,CAAC,GAAGC,CAAgB;AAExF;;;;;;;;CAQC,GACM,MAAME,OAAO,GAAG,CAACC,CAAS,EAAEC,CAAS,EAAEC,MAAc,EAAEC,MAAc,GAAa,CAAC;cAC5E,EAAEH,CAAC,CAAC,UAAU,EAAEC,CAAC,CAAC;;;0BAGN,EAAEC,MAAM,CAAC;0BACT,EAAEC,MAAM,CAAC;0BACT,EAAED,MAAM,CAAC;;;iBAGlB,EAAEF,CAAC,CAAC,UAAU,EAAEC,CAAC,CAAC,QAAQ,EAAEC,MAAM,CAAC;wBAC5B,EAAEF,CAAC,CAAC,UAAU,EAAEC,CAAC,CAAC;sDACY,EAAED,CAAC,CAAC,MAAM,EAAEA,CAAC,CAAC;QAC5D,CAAC,CAAC;AAEV;;;;;;;;CAQC,GACM,MAAMI,cAAc,GAAG,CAC5BH,CAAS,EACTD,CAAS,EACTE,MAAc,GAAGZ,cAAc,EAC/Ba,MAAc,GAAGZ,cAAc,GACpB,CAAC,0BAA0B,EAAEC,QAAQ,CAACO,OAAO,CAACC,CAAC,EAAEC,CAAC,EAAEC,MAAM,EAAEC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC","sources":["webpack://quran.com/./src/utils/image.ts"],"sourcesContent":["const DEFAULT_COLOR1 = '#f7f7f7';\nconst DEFAULT_COLOR2 = '#d1d1d1';\n\n/**\n * Convert a string to a base64.\n *\n * @param {string} str\n * @returns {string}\n */\nconst toBase64 = (str: string): string =>\n typeof window === 'undefined' ? Buffer.from(str).toString('base64') : window.btoa(str);\n\n/**\n * Get the shimmer SVG.\n *\n * @param {number} w\n * @param {number} h\n * @param {string} color1\n * @param {string} color2\n * @returns {string}\n */\nexport const shimmer = (w: number, h: number, color1: string, color2: string): string => `\n <svg width=\"${w}\" height=\"${h}\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <defs>\n <linearGradient id=\"g\">\n <stop stop-color=\"${color1}\" offset=\"20%\" />\n <stop stop-color=\"${color2}\" offset=\"50%\" />\n <stop stop-color=\"${color1}\" offset=\"70%\" />\n </linearGradient>\n </defs>\n <rect width=\"${w}\" height=\"${h}\" fill=\"${color1}\" />\n <rect id=\"r\" width=\"${w}\" height=\"${h}\" fill=\"url(#g)\" />\n <animate xlink:href=\"#r\" attributeName=\"x\" from=\"-${w}\" to=\"${w}\" dur=\"1.2s\" repeatCount=\"indefinite\" />\n </svg>`;\n\n/**\n * Get the blue data url that Next.js will use before loading the actual image.\n *\n * @param {number} h Height\n * @param {number} w Width\n * @param {string} color1\n * @param {string} color2\n * @returns {string}\n */\nexport const getBlurDataUrl = (\n h: number,\n w: number,\n color1: string = DEFAULT_COLOR1,\n color2: string = DEFAULT_COLOR2,\n): string => `data:image/svg+xml;base64,${toBase64(shimmer(w, h, color1, color2))}`;\n"],"names":["DEFAULT_COLOR1","DEFAULT_COLOR2","toBase64","str","Buffer","from","toString","window","btoa","shimmer","w","h","color1","color2","getBlurDataUrl"],"sourceRoot":""}