(function(){function e(e,t){try{const n=window.webkit;delete window["webkit"];window.webkit.messageHandlers[e].postMessage(t);window.webkit=n}catch(e){}}function t(){const e=new Uint32Array(4);window.crypto.getRandomValues(e);return e.reduce(((e="",t)=>e+t.toString(16).padStart(8,"0")),"")}class n{registeredApis={};frameId=t();registerApi(e,t){if(this.registeredApis[e]!==undefined){throw new Error(`API ${e} already registered.`)}this.registeredApis[e]=t}getRegisteredApi(e){return this.registeredApis[e]}getFrameId(){if(!this.frameId){this.frameId=t()}return this.frameId}registerFrame(){e("FrameBecameAvailable",{crwFrameId:this.getFrameId()})}}if(!window.__gCrWeb){window.__gCrWeb=new n}const r=window.__gCrWeb;function i(t,n){const r=function(n,r){e("ImageFetchMessageHandler",{id:t,data:n,from:r})};const i=function(){e("ImageFetchMessageHandler",{id:t})};const s=o(n);if(s){r(s,"canvas");return}a(n,100,r,i)}function o(e){const t=e.split(".").pop();if(!t||t.toLowerCase()==="gif"){return null}for(const n of document.images){if(n&&n.src===e){const e=document.createElement("canvas");e.width=n.naturalWidth;e.height=n.naturalHeight;const r=e.getContext("2d");if(!r)continue;r.drawImage(n,0,0);let i;try{i=e.toDataURL("image/"+t)}catch(e){return null}return i.split(",")[1]}}return null}function a(e,t,n,r){const i=new XMLHttpRequest;i.open("GET",e);i.timeout=t;i.responseType="blob";i.onload=function(){if(i.status!==200){r();return}const e=new FileReader;e.onload=function(){n(btoa(e.result),"xhr")};e.onabort=r;e.onerror=r;e.readAsBinaryString(i.response)};i.onabort=r;i.onerror=r;i.ontimeout=r;i.send()}r.imageFetch={getImageData:i}})();