ethers.js/packages/shims/dist/index.min.js

1 line
138 KiB
JavaScript
Raw Normal View History

2020-10-19 06:19:16 +03:00
!function(){return function t(r,e,n){function o(a,s){if(!e[a]){if(!r[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var h=e[a]={exports:{}};r[a][0].call(h.exports,function(t){return o(r[a][1][t]||t)},h,h.exports,t,r,e,n)}return e[a].exports}for(var i="function"==typeof require&&require,a=0;a<n.length;a++)o(n[a]);return o}}()({1:[function(t,r,e){var n,o;n=void 0!==e?e:this,o=function(t){if(t.atob)try{t.atob(" ")}catch(n){t.atob=(r=t.atob,(e=function(t){return r(String(t).replace(/[\t\n\f\r ]+/g,""))}).original=r,e)}else{var r,e,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;t.btoa=function(t){for(var r,e,o,i,a="",s=0,u=(t=String(t)).length%3;s<t.length;){if((e=t.charCodeAt(s++))>255||(o=t.charCodeAt(s++))>255||(i=t.charCodeAt(s++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");a+=n.charAt((r=e<<16|o<<8|i)>>18&63)+n.charAt(r>>12&63)+n.charAt(r>>6&63)+n.charAt(63&r)}return u?a.slice(0,u-3)+"===".substring(u):a},t.atob=function(t){if(t=String(t).replace(/[\t\n\f\r ]+/g,""),!o.test(t))throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");t+="==".slice(2-(3&t.length));for(var r,e,i,a="",s=0;s<t.length;)r=n.indexOf(t.charAt(s++))<<18|n.indexOf(t.charAt(s++))<<12|(e=n.indexOf(t.charAt(s++)))<<6|(i=n.indexOf(t.charAt(s++))),a+=64===e?String.fromCharCode(r>>16&255):64===i?String.fromCharCode(r>>16&255,r>>8&255):String.fromCharCode(r>>16&255,r>>8&255,255&r);return a}}},"function"==typeof define&&define.amd?define([],function(){o(n)}):o(n)},{}],2:[function(t,r,e){(function(r){(function(){"use strict";!function(){var e=[];try{for(var n=[],o=["NFD","NFC","NFKD","NFKC"],i=0;i<o.length;i++)try{if("test"!=="test".normalize(o[i]))throw new Error("failed to normalize")}catch(t){n.push(o[i])}if(n.length)throw e.push("String.prototype.normalize (missing: "+n.join(", ")+")"),new Error("bad normalize");if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw e.push("String.prototype.normalize (broken)"),new Error("bad normalize")}catch(r){var a=t("./unorm.js");String.prototype.normalize=function(t){var r=a[(t||"NFC").toLowerCase()];if(!r)throw new RangeError("invalid form - "+t);return r(this)}}var s=t("./base64.js");r.atob||(e.push("atob"),r.atob=s.atob),r.btoa||(e.push("btoa"),r.btoa=s.btoa),ArrayBuffer.isView||(e.push("ArrayBuffer.isView"),ArrayBuffer.isView=function(t){return!!t.buffer}),r.nextTick||(e.push("nextTick"),r.nextTick=function(t){setTimeout(t,0)}),r.crypto||(r.crypto={}),r.crypto.getRandomValues||(e.push("crypto.getRandomValues"),console.log("WARNING: This environment is missing a secure random source; generated private keys may be at risk, think VERY carefully about not adding a better secure source."),r.crypto.getRandomValues=function(t){for(var r=Math.floor((new Date).getTime())%t.length,e=0;e<t.length;e++)t[(r+e)%t.length]=Math.floor(256*Math.random())});try{var u=new FileReader;try{return void u.readAsArrayBuffer(new Blob(["hello"],{type:"text/plain"}))}catch(t){}e.push("FileReader.prototype.readAsArrayBuffer"),FileReader.prototype.readAsArrayBuffer=function(t){if(this.readyState===this.LOADING)throw new Error("InvalidStateError");this._setReadyState(this.LOADING),this._result=null,this._error=null;var r=new FileReader;r.onloadend=(()=>{var t=atob(r.result.split(",").pop().trim()),e=new ArrayBuffer(t.length);new Uint8Array(e).set(Array.from(t).map(t=>t.charCodeAt(0))),this._result=e,this._setReadyState(this.DONE)}),r.readAsDataURL(t)}}catch(t){console.log("Missing FileReader; unsupported platform")}if(e.length){console.log("Shims Injected:");for(i=0;i<e.length;i++)console.log(" - "+e[i])}}()}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./base64.js