PageSourceSearch

https://static.naf.no/static/npm.react-qrcode-logo.efbc558be113b430.js

js naf.no collected 2026-10-02 03:14:58 UTC 6,851 bytes, 2 lines download raw bytes

1"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[2785],{305(e,t,o){o.d(t,{rg:()=>f});var r=o(12888),a=o(79544);function l(e,t,o,r,a,l,i,n){n.lineWidth=e,n.fillStyle=a,n.strokeStyle=a,o+=e/2,t+=e/2,r-=e,Array.isArray(l)||(l=[l,l,l,l]);let f=(l=l.map(e=>(e=Math.min(e,r/2))<0?0:e))[0]||0,s=l[1]||0,c=l[2]||0,u=l[3]||0;n.beginPath(),n.moveTo(t+f,o),n.lineTo(t+r-s,o),s&&n.quadraticCurveTo(t+r,o,t+r,o+s),n.lineTo(t+r,o+r-c),c&&n.quadraticCurveTo(t+r,o+r,t+r-c,o+r),n.lineTo(t+u,o+r),u&&n.quadraticCurveTo(t,o+r,t,o+r-u),n.lineTo(t,o+f),f&&n.quadraticCurveTo(t,o,t+f,o),n.closePath(),n.stroke(),i&&n.fill()}let i={value:"https://reactjs.org/",ecLevel:"M",enableCORS:!1,size:150,quietZone:10,bgColor:"#FFFFFF",fgColor:"#000000",logoOpacity:1,qrStyle:"squares",eyeRadius:[0,0,0],logoPaddingStyle:"square",logoPaddingRadius:0,removeQrCodeBehindLogo:!1};async function n(e,t){if("u"<typeof document)throw Error("renderQRCodeToCanvas must be called in a browser environment");let o={...i,...t},r=e.getContext("2d");if(!r)throw Error("Canvas 2D context not available");let n=+o.size,f=+o.quietZone,s=o.logoWidth?+o.logoWidth:0,c=o.logoHeight?+o.logoHeight:0,u=o.logoPadding?+o.logoPadding:0,d=(0,a.Ay)(0,o.ecLevel);d.addData(function(e){let t="",o,r,a=e.length;for(o=0;o<a;o++)(r=e.charCodeAt(o))>=1&&r<=127?t+=e.charAt(o):(r>2047?(t+=String.fromCharCode(224|r>>12&15),t+=String.fromCharCode(128|r>>6&63)):t+=String.fromCharCode(192|r>>6&31),t+=String.fromCharCode(128|63&r));return t}(o.value)),d.make();let h=n+2*f,g=d.getModuleCount(),y=n/g,p=o.pixelRatio??window.devicePixelRatio??1,M=s||.2*n,m=c||M,C=(n-M)/2,v=(n-m)/2;e.height=e.width=h*p,r.setTransform(p,0,0,p,0,0),r.fillStyle=o.bgColor,r.fillRect(0,0,h,h);let b=[{row:0,col:0},{row:0,col:g-7},{row:g-7,col:0}];r.strokeStyle=o.fgColor;let S=(e,t)=>b.some(o=>e>=o.row&&e<=o.row+7&&t>=o.col&&t<=o.col+7)||function(e,t,o,r,a,l,i,n,f,s,c=0,u="square"){if(!e||!s)return!1;let d=Math.ceil(c/n)*n,h=l+f,g=i+f,y=Math.round(o*n)+f,p=Math.round(t*n)+f,M=y+(Math.ceil((o+1)*n)-Math.floor(o*n)),m=p+(Math.ceil((t+1)*n)-Math.floor(t*n));if("square"===u)return y<h+r+d&&M>h-d&&p<g+a+d&&m>g-d;if("circle"===u){let e=h+r/2,t=g+a/2,o=Math.max(r,a)/2+d,l=Math.max(y,Math.min(e,M)),i=Math.max(p,Math.min(t,m)),n=e-l,f=t-i;return n*n+f*f<o*o}return!1}(o.removeQrCodeBehindLogo,e,t,M,m,C,v,y,f,o.logoImage,u,o.logoPaddingStyle);if("dots"===o.qrStyle){r.fillStyle=o.fgColor;let e=y/2;for(let t=0;t<g;t++)for(let o=0;o<g;o++)d.isDark(t,o)&&!S(t,o)&&(r.beginPath(),r.arc(Math.round(o*y)+e+f,Math.round(t*y)+e+f,e/100*75,0,2*Math.PI,!1),r.closePath(),r.fill())}else if("fluid"===o.qrStyle){let e=Math.ceil(y/2);for(let t=0;t<g;t++)for(let a=0;a<g;a++)if(d.isDark(t,a)&&!S(t,a)){let l=[!1,!1,!1,!1];t>0&&!d.isDark(t-1,a)&&a>0&&!d.isDark(t,a-1)&&(l[0]=!0),t>0&&!d.isDark(t-1,a)&&a<g-1&&!d.isDark(t,a+1)&&(l[1]=!0),t<g-1&&!d.isDark(t+1,a)&&a<g-1&&!d.isDark(t,a+1)&&(l[2]=!0),t<g-1&&!d.isDark(t+1,a)&&a>0&&!d.isDark(t,a-1)&&(l[3]=!0);let i=Math.ceil((a+1)*y)-Math.floor(a*y),n=Math.ceil((t+1)*y)-Math.floor(t*y);r.fillStyle=o.fgColor,r.beginPath(),r.arc(Math.round(a*y)+e+f,Math.round(t*y)+e+f,e,0,2*Math.PI,!1),r.closePath(),r.fill(),l[0]||r.fillRect(Math.round(a*y)+f,Math.round(t*y)+f,i/2,n/2),l[1]||r.fillRect(Math.round(a*y)+f+Math.floor(i/2),Math.round(t*y)+f,i/2,n/2),l[2]||r.fillRect(Math.round(a*y)+f+Math.floor(i/2),Math.round(t*y)+f+Math.floor(n/2),i/2,n/2),l[3]||r.fillRect(Math.round(a*y)+f,Math.round(t*y)+f+Math.floor(n/2),i/2,n/2)}}else for(let e=0;e<g;e++)for(let t=0;t<g;t++)if(d.isDark(e,t)&&!S(e,t)){r.fillStyle=o.fgColor;let a=Math.ceil((t+1)*y)-Math.floor(t*y),l=Math.ceil((e+1)*y)-Math.floor(e*y);r.fillRect(Math.round(t*y)+f,Math.round(e*y)+f,a,l)}for(let e=0;e<3;e++){let{row:a,col:i}=b[e],n=o.eyeRadius;Array.isArray(n)&&(n=n[e]),"number"==typeof n&&(n=[n,n,n,n]),function(e,t,o,r,a,i,n=[0,0,0,0]){let f,s,c,u,d=Math.ceil(t);"number"==typeof n||Array.isArray(n)?s=f=n:(f=n.outer||0,s=n.inner||0),"string"!=typeof i?(c=i.outer,u=i.inner):(c=i,u=i);let h=r*t+o,g=a*t+o,y=7*t;l(d,g,h,y,c,f,!1,e),y=3*t,h+=2*t,l(d,g+=2*t,h,y,u,s,!0,e)}(r,y,f,a,i,t.eyeColor?Array.isArray(t.eyeColor)?t.eyeColor[e]:t.eyeColor:o.fgColor,n)}if(o.logoImage)try{var R,w;let{image:e,event:a}=await (R=o.logoImage,w=o.enableCORS,new Promise((e,t)=>
1{let o=new Image;w&&(o.crossOrigin="Anonymous"),o.onload=t=>e({image:o,event:t}),o.onerror=()=>t(Error(`Failed to load logo image: ${R}`)),o.src=R}));if(r.save(),u){r.beginPath(),r.strokeStyle=o.bgColor,r.fillStyle=o.bgColor;let e=M+2*u,t=m+2*u,a=C+f-u,l=v+f-u;"circle"===o.logoPaddingStyle?r.ellipse(a+e/2,l+t/2,e/2,t/2,0,0,2*Math.PI):r.roundRect(a,l,e,t,o.logoPaddingRadius),r.stroke(),r.fill()}r.globalAlpha=o.logoOpacity,r.drawImage(e,C+f,v+f,M,m),r.restore(),t.logoOnLoad&&t.logoOnLoad(a)}catch(e){console.warn("[react-qrcode-logo] QRCode logo loading failed:",e)}return e}class f extends r.Component{canvasRef=r.createRef();download(e,t){var o;let r;this.canvasRef.current&&(o=this.canvasRef.current.toDataURL(function(e="png"){switch(e){case"jpg":return"image/jpeg";case"webp":return"image/webp";default:return"image/png"}}(e),1),(r=document.createElement("a")).download=t??"react-qrcode-logo",r.href=o,document.body.appendChild(r),r.click(),r.remove())}shouldComponentUpdate(e){return!function e(t,o,r=new WeakMap){if(Object.is(t,o))return!0;if(typeof t!=typeof o||null==t||null==o)return!1;if("function"==typeof t||"function"==typeof o)return t===o;if("object"==typeof t&&"object"==typeof o){if(r.has(t)&&r.get(t)===o)return!0;r.set(t,o)}if(t instanceof Date&&o instanceof Date)return t.getTime()===o.getTime();if(Array.isArray(t)&&Array.isArray(o)){if(t.length!==o.length)return!1;for(let a=0;a<t.length;a++)if(!e(t[a],o[a],r))return!1;return!0}if(t instanceof Set&&o instanceof Set){if(t.size!==o.size)return!1;for(let a of t)if(![...o].some(t=>e(a,t,r)))return!1;return!0}if(t instanceof Map&&o instanceof Map){if(t.size!==o.size)return!1;for(let[a,l]of t)if(!o.has(a)||!e(l,o.get(a),r))return!1;return!0}if(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t)){let a=Object.keys(t),l=Object.keys(o);if(a.length!==l.length)return!1;for(let i of a)if(!l.includes(i)||!e(t[i],o[i],r))return!1;return!0}try{return JSON.stringify(t)===JSON.stringify(o)}catch{return!1}}(this.props,e)}componentDidMount(){this.update()}componentDidUpdate(){this.update()}update(){this.canvasRef.current&&n(this.canvasRef.current,this.props).catch(e=>{console.error("[react-qrcode-logo] QRCode render failed:",e)})}render(){let e=+(this.props.size??i.size)+2*(this.props.quietZone??i.quietZone);return r.createElement("canvas",{id:this.props.id??"react-qrcode-logo",height:e,width:e,style:{height:e+"px",width:e+"px",...this.props.style},ref:this.canvasRef})}}}}]);
2//# sourceMappingURL=npm.react-qrcode-logo.efbc558be113b430.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.