-
Notifications
You must be signed in to change notification settings - Fork 176
/
proxy.min.js
5 lines (5 loc) · 2.64 KB
/
proxy.min.js
1
2
3
4
5
(function(){function n(){function w(){return null}function m(a){return a?"object"===typeof a||"function"===typeof a:!1}function p(a){if(null!==a&&!m(a))throw new TypeError("Object prototype may only be an Object or null: "+a);}function x(a,c,B){function k(){}if(!m(a)||!m(c))throw new TypeError("Cannot create proxy with a non-object as target or handler");var g=c;c={get:null,set:null,apply:null,construct:null};for(var h in g){if(!(h in c))throw new TypeError("Proxy polyfill does not support trap '"+h+"'");c[h]=
g[h]}"function"===typeof g&&(c.apply=g.apply.bind(g));g=C(a);var q=!1,r=!1;if("function"===typeof a){var f=function(){var b=this&&this.constructor===f,d=Array.prototype.slice.call(arguments);k(b?"construct":"apply");return b&&c.construct?c.construct.call(this,a,d):!b&&c.apply?c.apply(a,this,d):b?(d.unshift(a),new (a.bind.apply(a,d))):a.apply(this,d)};q=!0}else a instanceof Array?(f=[],r=!0):f=y||null!==g?D(g):{};var z=c.get?function(b){k("get");return c.get(this,b,f)}:function(b){k("get");return this[b]},
E=c.set?function(b,d){k("set");c.set(this,b,d,f)}:function(b,d){k("set");this[b]=d};h=e.getOwnPropertyNames(a).map(function(b){return{name:b,source:a}});for(var l=g;l&&l!==e.prototype;)h=h.concat(e.getOwnPropertyNames(l).map(function(b){return{name:b,source:l}})),l=e.getPrototypeOf(l);var t={};h.forEach(function(b){var d=b.name;(q||r)&&d in f||t[d]||(b=e.getOwnPropertyDescriptor(b.source,d),e.defineProperty(f,d,{enumerable:!!b.enumerable,get:z.bind(a,d),set:E.bind(a,d)}),t[d]=!0)});h=!0;if(q||r){var F=
e.setPrototypeOf||([].__proto__===Array.prototype?function(b,d){p(d);b.__proto__=d;return b}:w);g&&F(f,g)||(h=!1)}if(c.get||!h)for(var u in a)t[u]||e.defineProperty(f,u,{get:z.bind(a,u)});e.seal(a);e.seal(f);return B?{proxy:f,revoke:function(){a=null;k=function(b){throw new TypeError("Cannot perform '"+b+"' on a proxy that has been revoked");}}}:f}var e=Object,y=!!e.create||!({__proto__:null}instanceof e),D=e.create||(y?function(a){p(a);return{__proto__:a}}:function(a){function c(){}p(a);if(null===
a)throw new SyntaxError("Native Object.create is required to create objects with null prototype");c.prototype=a;return new c}),C=e.getPrototypeOf||([].__proto__===Array.prototype?function(a){a=a.__proto__;return m(a)?a:null}:w);var v=function(a,c){if(void 0===(this&&this instanceof v?this.constructor:void 0))throw new TypeError("Constructor Proxy requires 'new'");return x(a,c)};v.revocable=function(a,c){return x(a,c,!0)};return v};var A="undefined"!==typeof process&&"[object process]"==={}.toString.call(process)||"undefined"!==typeof navigator&&"ReactNative"===navigator.product?global:self;A.Proxy||(A.Proxy=n(),A.Proxy.revocable=A.Proxy.revocable);})();