UNPKG

appium-remote-debugger

Version:
10 lines (9 loc) 6.15 kB
function(){return (function(){var e=this||self; function f(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"== b&&"undefined"==typeof a.call)return"object";return b}function m(a){var b=f(a);return"array"==b||"object"==b&&"number"==typeof a.length}function q(a){var b=typeof a;return"object"==b&&null!=a||"function"==b}function r(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var d=c.slice();d.push.apply(d,arguments);return a.apply(this,d)}}var t=Date.now||function(){return+new Date};function u(a,b){function c(){}c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};function v(a,b){this.code=a;this.b=w[a]||x;this.message=b||"";a=this.b.replace(/((?:^|\s+)[a-z])/g,function(c){return c.toUpperCase().replace(/^[\s\xa0]+/g,"")});b=a.length-5;if(0>b||a.indexOf("Error",b)!=b)a+="Error";this.name=a;a=Error(this.message);a.name=this.name;this.stack=a.stack||""}u(v,Error);var x="unknown error",w={15:"element not selectable",11:"element not visible"};w[31]=x;w[30]=x;w[24]="invalid cookie domain";w[29]="invalid element coordinates";w[12]="invalid element state";w[32]="invalid selector"; w[51]="invalid selector";w[52]="invalid selector";w[17]="javascript error";w[405]="unsupported operation";w[34]="move target out of bounds";w[27]="no such alert";w[7]="no such element";w[8]="no such frame";w[23]="no such window";w[28]="script timeout";w[33]="session not created";w[10]="stale element reference";w[21]="timeout";w[25]="unable to set cookie";w[26]="unexpected alert open";w[13]=x;w[9]="unknown command";var y=Array.prototype.map?function(a,b){return Array.prototype.map.call(a,b,void 0)}:function(a,b){for(var c=a.length,d=Array(c),g="string"===typeof a?a.split(""):a,h=0;h<c;h++)h in g&&(d[h]=b.call(void 0,g[h],h,a));return d};function z(a,b){var c={},d;for(d in a)b.call(void 0,a[d],d,a)&&(c[d]=a[d]);return c}function B(a,b){var c={},d;for(d in a)c[d]=b.call(void 0,a[d],d,a);return c}function C(a,b){return null!==a&&b in a}function D(a,b){for(var c in a)if(b.call(void 0,a[c],c,a))return c};function E(a){return-1!=F.indexOf(a)};var F;a:{var G=e.navigator;if(G){var H=G.userAgent;if(H){F=H;break a}}F=""};function I(){return E("Firefox")||E("FxiOS")}function J(){return(E("Chrome")||E("CriOS"))&&!E("Edge")};function K(){return E("iPhone")&&!E("iPod")&&!E("iPad")};var L=I(),M=K()||E("iPod"),N=E("iPad"),O=E("Android")&&!(J()||I()||E("Opera")||E("Silk")),Q=J(),aa=E("Safari")&&!(J()||E("Coast")||E("Opera")||E("Edge")||E("Edg/")||E("OPR")||I()||E("Silk")||E("Android"))&&!(K()||E("iPad")||E("iPod"));function R(a){return(a=a.exec(F))?a[1]:""}(function(){if(L)return R(/Firefox\/([0-9.]+)/);if(Q)return K()||E("iPad")||E("iPod")?R(/CriOS\/([0-9.]+)/):R(/Chrome\/([0-9.]+)/);if(aa&&!(K()||E("iPad")||E("iPod")))return R(/Version\/([0-9.]+)/);if(M||N){var a=/Version\/(\S+).*Mobile\/(\S+)/.exec(F);if(a)return a[1]+"."+a[2]}else if(O)return(a=R(/Android\s+([0-9.]+)/))?a:R(/Version\/([0-9.]+)/);return""})();var ba=JSON.stringify;function ca(a){function b(c,d){switch(f(c)){case "string":case "number":case "boolean":return c;case "function":return c.toString();case "array":return y(c,function(h){return b(h,d)});case "object":if(0<=d.indexOf(c))throw new v(17,"Recursive object cannot be transferred");if(C(c,"nodeType")&&(1==c.nodeType||9==c.nodeType)){var g={};g.ELEMENT=S(c);return g}if(C(c,"document"))return g={},g.WINDOW=S(c),g;d.push(c);if(m(c))return y(c,function(h){return b(h,d)});c=z(c,function(h,n){return"number"==typeof n|| "string"==typeof n});return B(c,function(h){return b(h,d)});default:return null}}return b(a,[])}function T(a,b){return"array"==f(a)?y(a,function(c){return T(c,b)}):q(a)?"function"==typeof a?a:C(a,"ELEMENT")?U(a.ELEMENT,b):C(a,"WINDOW")?U(a.WINDOW,b):B(a,function(c){return T(c,b)}):a}function da(a,b){if("string"==typeof a)try{return new b.Function(a)}catch(c){throw c;}return b==window?a:new b.Function("return ("+a+").apply(null,arguments);")} function V(a){a=a||document;var b=a.$wdc_;b||(b=a.$wdc_={},b.a=t());b.a||(b.a=t());return b}function S(a){var b=V(a.ownerDocument),c=D(b,function(d){return d==a});c||(c=":wdc:"+b.a++,b[c]=a);return c} function U(a,b){a=decodeURIComponent(a);b=b||document;var c=V(b);if(!C(c,a))throw new v(10,"Element does not exist in cache");var d=c[a];if(C(d,"setInterval")){if(d.closed)throw delete c[a],new v(23,"Window has been closed.");return d}for(var g=d;g;){if(g==b.documentElement)return d;g.host&&11===g.nodeType&&(g=g.host);g=g.parentNode}delete c[a];throw new v(10,"Element is no longer attached to the DOM");};function W(a,b,c,d,g,h){function n(l,p){P||(k.removeEventListener?k.removeEventListener("unload",A,!0):k.detachEvent("onunload",A),k.clearTimeout(ea),0!=l?(l=new v(l,p.message||p+""),l.stack=p.stack,p={status:C(l,"code")?l.code:13,value:{message:l.message}}):p={status:0,value:ca(p)},d(g?ba(p):p),P=!0)}function A(){n(13,Error("Detected a page unload event; asynchronous script execution does not work across page loads."))}var k=h||window,P=!1;h=r(n,13);if(k.closed)h("Unable to execute script; the target window is closed."); else{a=da(a,k);b=T(b,k.document);b.push(r(n,0));k.addEventListener?k.addEventListener("unload",A,!0):k.attachEvent("onunload",A);var fa=t();try{a.apply(k,b);var ea=k.setTimeout(function(){n(28,Error("Timed out waiting for asynchronous script result after "+(t()-fa)+" ms"))},Math.max(0,c))}catch(l){n(l.code||13,l)}}}var X=["_"],Y=e;X[0]in Y||"undefined"==typeof Y.execScript||Y.execScript("var "+X[0]); for(var Z;X.length&&(Z=X.shift());)X.length||void 0===W?Y[Z]&&Y[Z]!==Object.prototype[Z]?Y=Y[Z]:Y=Y[Z]={}:Y[Z]=W;; return this._.apply(null,arguments);}).apply(window, arguments);}