New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

post-robot

Package Overview
Dependencies
Maintainers
2
Versions
246
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

post-robot - npm Package Compare versions

Comparing version 10.0.0 to 10.0.1

2

dist/post-robot.ie.min.js

@@ -1,2 +0,2 @@

!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("postRobot",[],e):"object"==typeof exports?exports.postRobot=e():n.postRobot=e()}("undefined"!=typeof self?self:this,function(){return function(n){var e={};function r(t){if(e[t])return e[t].exports;var o=e[t]={i:t,l:!1,exports:{}};return n[t].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=n,r.c=e,r.d=function(n,e,t){r.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:t})},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,e){if(1&e&&(n=r(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var t=Object.create(null);if(r.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var o in n)r.d(t,o,function(e){return n[e]}.bind(null,o));return t},r.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(e,"a",e),e},r.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},r.p="",r(r.s=0)}([function(n,e,r){"use strict";r.r(e);var t={};function o(n){return"[object RegExp]"===Object.prototype.toString.call(n)}r.r(t),r.d(t,"WeakMap",function(){return K});var i={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},a="*",u="Call was rejected by callee.\r\n";function s(n){return void 0===n&&(n=window),n.location.protocol===i.ABOUT}function c(n){if(n)try{if(n.parent&&n.parent!==n)return n.parent}catch(n){}}function f(n){if(n&&!c(n))try{return n.opener}catch(n){}}function d(n){try{return n&&n.location&&n.location.href,!0}catch(n){}return!1}function w(n){var e=(n=n||window).location;if(!e)throw new Error("Can not read window location");var r=e.protocol;if(!r)throw new Error("Can not read window protocol");if(r===i.FILE)return i.FILE+"//";if(r===i.ABOUT){var t=c(n);return t&&d(t)?w(t):i.ABOUT+"//"}var o=e.host;if(!o)throw new Error("Can not read window host");return r+"//"+o}function l(n){var e=w(n=n||window);return e&&n.mockDomain&&0===n.mockDomain.indexOf(i.MOCK)?n.mockDomain:e}function h(n){try{if(n===window)return!0}catch(n){}try{var e=Object.getOwnPropertyDescriptor(n,"location");if(e&&!1===e.enumerable)return!1}catch(n){}try{if(s(n)&&d(n))return!0}catch(n){}try{if(w(n)===w(window))return!0}catch(n){}return!1}function m(n){if(!h(n))return!1;try{if(n===window)return!0;if(s(n)&&d(n))return!0;if(l(window)===l(n))return!0}catch(n){}return!1}function v(n,e){if(!n||!e)return!1;var r=c(e);return r?r===n:-1!==function(n){var e=[];try{for(;n.parent!==n;)e.push(n.parent),n=n.parent}catch(n){}return e}(e).indexOf(n)}function p(n){var e,r,t=[];try{e=n.frames}catch(r){e=n}try{r=e.length}catch(n){}if(0===r)return t;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=e[o]}catch(n){continue}t.push(i)}return t}for(var a=0;a<100;a++){var u=void 0;try{u=e[a]}catch(n){return t}if(!u)return t;t.push(u)}return t}function g(n){for(var e=[],r=0,t=p(n);r<t.length;r++){var o=t[r];e.push(o);for(var i=0,a=g(o);i<a.length;i++){var u=a[i];e.push(u)}}return e}function y(n){if(n){try{if(n.top)return n.top}catch(n){}if(c(n)===n)return n;try{if(v(window,n)&&window.top)return window.top}catch(n){}try{if(v(n,window)&&window.top)return window.top}catch(n){}for(var e=0,r=g(n);e<r.length;e++){var t=r[e];try{if(t.top)return t.top}catch(n){}if(c(t)===t)return t}}}function E(n){var e=y(n);if(!e)throw new Error("Can not determine top window");return[].concat(g(e),[e])}var _=[],O=[];function b(n,e){void 0===e&&(e=!0);try{if(n===window)return!1}catch(n){return!0}try{if(!n)return!0}catch(n){return!0}try{if(n.closed)return!0}catch(n){return!n||n.message!==u}if(e&&m(n))try{if(n.mockclosed)return!0}catch(n){}try{if(!n.parent||!n.top)return!0}catch(n){}var r=function(n,e){for(var r=0;r<n.length;r++)try{if(n[r]===e)return r}catch(n){}return-1}(_,n);if(-1!==r){var t=O[r];if(t&&function(n){if(!n.contentWindow)return!0;if(!n.parentNode)return!0;var e=n.ownerDocument;return!(!e||!e.documentElement||e.documentElement.contains(n))}(t))return!0}return!1}function W(n){return(n=n||window).navigator.mockUserAgent||n.navigator.userAgent}function S(n,e){for(var r=p(n),t=0;t<r.length;t++){var o=r[t];try{if(m(o)&&o.name===e&&-1!==r.indexOf(o))return o}catch(n){}}try{if(-1!==r.indexOf(n.frames[e]))return n.frames[e]}catch(n){}try{if(-1!==r.indexOf(n[e]))return n[e]}catch(n){}}function R(n,e){return n===f(e)}function A(n){return f(n=n||window)||c(n)||void 0}function N(n,e){for(var r=0;r<n.length;r++)for(var t=n[r],o=0;o<e.length;o++)if(t===e[o])return!0;return!1}function x(n,e){var r=y(n)||n,t=y(e)||e;try{if(r&&t)return r===t}catch(n){}var o=E(n),i=E(e);if(N(o,i))return!0;var a=f(r),u=f(t);return!(a&&N(E(a),i)||(u&&N(E(u),o),1))}function M(n,e){if("string"==typeof n){if("string"==typeof e)return n===a||e===n;if(o(e))return!1;if(Array.isArray(e))return!1}return o(n)?o(e)?n.toString()===e.toString():!Array.isArray(e)&&Boolean(e.match(n)):!!Array.isArray(n)&&(Array.isArray(e)?JSON.stringify(n)===JSON.stringify(e):!o(e)&&n.some(function(n){return M(n,e)}))}function j(n){return n.match(/^(https?|mock|file):\/\//)?n.split("/").slice(0,3).join("/"):l()}function P(n){try{if(n===window)return!0}catch(n){if(n&&n.message===u)return!0}try{if("[object Window]"===Object.prototype.toString.call(n))return!0}catch(n){if(n&&n.message===u)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(n){if(n&&n.message===u)return!0}try{if(n&&n.self===n)return!0}catch(n){if(n&&n.message===u)return!0}try{if(n&&n.parent===n)return!0}catch(n){if(n&&n.message===u)return!0}try{if(n&&n.top===n)return!0}catch(n){if(n&&n.message===u)return!0}try{n&&n.__cross_domain_utils_window_check__}catch(n){return!0}return!1}function I(n){try{if(!n)return!1;if("undefined"!=typeof Promise&&n instanceof Promise)return!0;if("undefined"!=typeof window&&window.Window&&n instanceof window.Window)return!1;if("undefined"!=typeof window&&window.constructor&&n instanceof window.constructor)return!1;var e={}.toString;if(e){var r=e.call(n);if("[object Window]"===r||"[object global]"===r||"[object DOMWindow]"===r)return!1}if("function"==typeof n.then)return!0}catch(n){return!1}return!1}var k,T=[],D=[],C=0;function L(){if(!C&&k){var n=k;k=null,n.resolve()}}function B(){C+=1}function z(){C-=1,L()}var F=function(){function n(n){var e=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],n){var r,t,o=!1,i=!1,a=!1;B();try{n(function(n){a?e.resolve(n):(o=!0,r=n)},function(n){a?e.reject(n):(i=!0,t=n)})}catch(n){return z(),void this.reject(n)}z(),a=!0,o?this.resolve(r):i&&this.reject(t)}}var e=n.prototype;return e.resolve=function(n){if(this.resolved||this.rejected)return this;if(I(n))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=n,this.dispatch(),this},e.reject=function(n){var e=this;if(this.resolved||this.rejected)return this;if(I(n))throw new Error("Can not reject promise with another promise");if(!n){var r=n&&"function"==typeof n.toString?n.toString():Object.prototype.toString.call(n);n=new Error("Expected reject to be called with Error, got "+r)}return this.rejected=!0,this.error=n,this.errorHandled||setTimeout(function(){e.errorHandled||function(n,e){if(-1===T.indexOf(n)){T.push(n),setTimeout(function(){throw n},1);for(var r=0;r<D.length;r++)D[r](n,e)}}(n,e)},1),this.dispatch(),this},e.asyncReject=function(n){return this.errorHandled=!0,this.reject(n),this},e.dispatch=function(){var e=this,r=this.dispatching,t=this.resolved,o=this.rejected,i=this.handlers;if(!r&&(t||o)){this.dispatching=!0,B();for(var a=function(r){var a=i[r],u=a.onSuccess,s=a.onError,c=a.promise,f=void 0;if(t)try{f=u?u(e.value):e.value}catch(n){return c.reject(n),"continue"}else if(o){if(!s)return c.reject(e.error),"continue";try{f=s(e.error)}catch(n){return c.reject(n),"continue"}}f instanceof n&&(f.resolved||f.rejected)?(f.resolved?c.resolve(f.value):c.reject(f.error),f.errorHandled=!0):I(f)?f instanceof n&&(f.resolved||f.rejected)?f.resolved?c.resolve(f.value):c.reject(f.error):f.then(function(n){c.resolve(n)},function(n){c.reject(n)}):c.resolve(f)},u=0;u<i.length;u++)a(u);i.length=0,this.dispatching=!1,z()}},e.then=function(e,r){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.then expected a function for success handler");if(r&&"function"!=typeof r&&!r.call)throw new Error("Promise.then expected a function for error handler");var t=new n;return this.handlers.push({promise:t,onSuccess:e,onError:r}),this.errorHandled=!0,this.dispatch(),t},e.catch=function(n){return this.then(void 0,n)},e.finally=function(e){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return n.try(e).then(function(){return r})},function(r){return n.try(e).then(function(){throw r})})},e.timeout=function(n,e){var r=this;if(this.resolved||this.rejected)return this;var t=setTimeout(function(){r.resolved||r.rejected||r.reject(e||new Error("Promise timed out after "+n+"ms"))},n);return this.then(function(n){return clearTimeout(t),n})},e.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},n.resolve=function(e){return e instanceof n?e:I(e)?new n(function(n,r){return e.then(n,r)}):(new n).resolve(e)},n.reject=function(e){return(new n).reject(e)},n.asyncReject=function(e){return(new n).asyncReject(e)},n.all=function(e){var r=new n,t=e.length,o=[];if(!t)return r.resolve(o),r;for(var i=function(i){var a=e[i];if(a instanceof n){if(a.resolved)return o[i]=a.value,t-=1,"continue"}else if(!I(a))return o[i]=a,t-=1,"continue";n.resolve(a).then(function(n){o[i]=n,0==(t-=1)&&r.resolve(o)},function(n){r.reject(n)})},a=0;a<e.length;a++)i(a);return 0===t&&r.resolve(o),r},n.hash=function(e){var r={};return n.all(Object.keys(e).map(function(t){return n.resolve(e[t]).then(function(n){r[t]=n})})).then(function(){return r})},n.map=function(e,r){return n.all(e.map(r))},n.onPossiblyUnhandledException=function(n){return function(n){return D.push(n),{cancel:function(){D.splice(D.indexOf(n),1)}}}(n)},n.try=function(e,r,t){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.try expected a function");var o;B();try{o=e.apply(r,t||[])}catch(e){return z(),n.reject(e)}return z(),n.resolve(o)},n.delay=function(e){return new n(function(n){setTimeout(n,e)})},n.isPromise=function(e){return!!(e&&e instanceof n)||I(e)},n.flush=function(){return e=k=k||new n,L(),e;var e},n}();function U(){return(U=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(n[t]=r[t])}return n}).apply(this,arguments)}function H(n,e){for(var r=0;r<n.length;r++)try{if(n[r]===e)return r}catch(n){}return-1}var q,G=Object.defineProperty,J=Date.now()%1e9,K=function(){function n(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,J+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+J,function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var n=new WeakMap,e={};return Object.freeze(e),n.set(e,"__testvalue__"),"__testvalue__"===n.get(e)}catch(n){return!1}}())try{this.weakmap=new WeakMap}catch(n){}this.keys=[],this.values=[]}var e=n.prototype;return e._cleanupClosedWindows=function(){for(var n=this.weakmap,e=this.keys,r=0;r<e.length;r++){var t=e[r];if(P(t)&&b(t)){if(n)try{n.delete(t)}catch(n){}e.splice(r,1),this.values.splice(r,1),r-=1}}},e.isSafeToReadWrite=function(n){if(P(n))return!1;try{n&&n.self,n&&n[this.name]}catch(n){return!1}return!0},e.set=function(n,e){if(!n)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.set(n,e)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var t=this.name,o=n[t];o&&o[0]===n?o[1]=e:G(n,t,{value:[n,e],writable:!0})}else{this._cleanupClosedWindows();var i=this.keys,a=this.values,u=H(i,n);-1===u?(i.push(n),a.push(e)):a[u]=e}},e.get=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(n))return e.get(n)}catch(n){delete this.weakmap}if(!this.isSafeToReadWrite(n)){this._cleanupClosedWindows();var r=H(this.keys,n);if(-1===r)return;return this.values[r]}var t=n[this.name];if(t&&t[0]===n)return t[1]},e.delete=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{e.delete(n)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var r=n[this.name];r&&r[0]===n&&(r[0]=r[1]=void 0)}else{this._cleanupClosedWindows();var t=this.keys,o=H(t,n);-1!==o&&(t.splice(o,1),this.values.splice(o,1))}},e.has=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(n))return!0}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var r=n[this.name];return!(!r||r[0]!==n)}return this._cleanupClosedWindows(),-1!==H(this.keys,n)},e.getOrSet=function(n,e){if(this.has(n))return this.get(n);var r=e();return this.set(n,r),r},n}();function X(){var n="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,function(){return n.charAt(Math.floor(Math.random()*n.length))})+"_"+function(n){if("function"==typeof btoa)return btoa(n);if("undefined"!=typeof Buffer)return Buffer.from(n,"utf8").toString("base64");throw new Error("Can not find window.btoa or Buffer")}((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function Y(){}function Z(n){return"[object RegExp]"===Object.prototype.toString.call(n)}function Q(n,e,r){if(n.hasOwnProperty(e))return n[e];var t=r();return n[e]=t,t}Object.create(Error.prototype);var V=5e3,$=2e3,nn=1e4,en=-1,rn={REQUEST:"postrobot_message_request",RESPONSE:"postrobot_message_response",ACK:"postrobot_message_ack"},tn={METHOD:"postrobot_method",HELLO:"postrobot_hello",OPEN_TUNNEL:"postrobot_open_tunnel"},on="__postrobot_bridge__",an="*",un={CROSS_DOMAIN_ZALGO_PROMISE:"cross_domain_zalgo_promise",CROSS_DOMAIN_FUNCTION:"cross_domain_function",CROSS_DOMAIN_WINDOW:"cross_domain_window"};function sn(n){return void 0===n&&(n=window),n!==window?n.__post_robot_10_0_0__:n.__post_robot_10_0_0__=n.__post_robot_10_0_0__||{}}var cn=function(){return{}};function fn(n,e){return void 0===n&&(n="store"),void 0===e&&(e=cn),Q(sn(),n,function(){var n=e();return{has:function(e){return n.hasOwnProperty(e)},get:function(e,r){return n.hasOwnProperty(e)?n[e]:r},set:function(e,r){return n[e]=r,r},del:function(e){delete n[e]},getOrSet:function(e,r){return Q(n,e,r)},reset:function(){n=e()},keys:function(){return Object.keys(n)}}})}var dn=function(){};function wn(){var n=sn();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new dn,n.WINDOW_WILDCARD}function ln(n,e){return void 0===n&&(n="store"),void 0===e&&(e=cn),fn("windowStore").getOrSet(n,function(){var r=new K,t=function(n){return r.getOrSet(n,e)};return{has:function(e){return t(e).hasOwnProperty(n)},get:function(e,r){var o=t(e);return o.hasOwnProperty(n)?o[n]:r},set:function(e,r){return t(e)[n]=r,r},del:function(e){delete t(e)[n]},getOrSet:function(e,r){return Q(t(e),n,r)}}})}function hn(){return fn("instance").getOrSet("instanceID",X)}function mn(n){return ln("helloPromises").getOrSet(n,function(){return new F})}function vn(n,e){return(0,e.send)(n,tn.HELLO,{instanceID:hn()},{domain:an,timeout:-1}).then(function(e){var r=e.origin,t=e.data.instanceID;return mn(n).resolve({win:n,domain:r}),{win:n,domain:r,instanceID:t}})}function pn(n,e){var r=e.send;return ln("windowInstanceIDPromises").getOrSet(n,function(){return vn(n,{send:r}).then(function(n){return n.instanceID})})}function gn(n,e,r){void 0===e&&(e=5e3),void 0===r&&(r="Window");var t=mn(n);return-1!==e&&(t=t.timeout(e,new Error(r+" did not load after "+e+"ms"))),t}function yn(n){ln("knownWindows").set(n,!0)}var En,_n={FUNCTION:"function",ERROR:"error",PROMISE:"promise",REGEX:"regex",DATE:"date",ARRAY:"array",OBJECT:"object",STRING:"string",NUMBER:"number",BOOLEAN:"boolean",NULL:"null",UNDEFINED:"undefined"};function On(n){return"object"==typeof n&&null!==n&&"string"==typeof n.__type__}function bn(n){return void 0===n?_n.UNDEFINED:null===n?_n.NULL:Array.isArray(n)?_n.ARRAY:"function"==typeof n?_n.FUNCTION:"object"==typeof n?n instanceof Error?_n.ERROR:"function"==typeof n.then?_n.PROMISE:"[object RegExp]"===Object.prototype.toString.call(n)?_n.REGEX:"[object Date]"===Object.prototype.toString.call(n)?_n.DATE:_n.OBJECT:"string"==typeof n?_n.STRING:"number"==typeof n?_n.NUMBER:"boolean"==typeof n?_n.BOOLEAN:void 0}function Wn(n,e){return{__type__:n,__val__:e}}var Sn,Rn=((En={})[_n.FUNCTION]=function(){},En[_n.ERROR]=function(n){var e=n.message,r=n.stack,t=n.code;return Wn(_n.ERROR,{message:e,stack:r,code:t})},En[_n.PROMISE]=function(){},En[_n.REGEX]=function(n){return Wn(_n.REGEX,n.source)},En[_n.DATE]=function(n){return Wn(_n.DATE,n.toJSON())},En[_n.ARRAY]=function(n){return n},En[_n.OBJECT]=function(n){return n},En[_n.STRING]=function(n){return n},En[_n.NUMBER]=function(n){return n},En[_n.BOOLEAN]=function(n){return n},En[_n.NULL]=function(n){return n},En),An={},Nn=((Sn={})[_n.FUNCTION]=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},Sn[_n.ERROR]=function(n){var e=n.message,r=n.stack,t=n.code,o=new Error(e);return o.code=t,o.stack=r+"\n\n"+o.stack,o},Sn[_n.PROMISE]=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},Sn[_n.REGEX]=function(n){return new RegExp(n)},Sn[_n.DATE]=function(n){return new Date(n)},Sn[_n.ARRAY]=function(n){return n},Sn[_n.OBJECT]=function(n){return n},Sn[_n.STRING]=function(n){return n},Sn[_n.NUMBER]=function(n){return n},Sn[_n.BOOLEAN]=function(n){return n},Sn[_n.NULL]=function(n){return n},Sn),xn={};function Mn(){return!!W(window).match(/MSIE|trident|edge\/12|edge\/13/i)}function jn(n){return!x(window,n)}function Pn(n,e){if(n){if(l()!==j(n))return!0}else if(e&&!m(e))return!0;return!1}function In(n){var e=n.win,r=n.domain;return!(!Mn()||r&&!Pn(r,e)||e&&!jn(e))}function kn(n){var e=(n=n||j(n)).replace(/[^a-zA-Z0-9]+/g,"_");return on+"_"+e}function Tn(){return Boolean(window.name&&window.name===kn(l()))}var Dn=new F(function(n){if(window.document&&window.document.body)return n(window.document.body);var e=setInterval(function(){if(window.document&&window.document.body)return clearInterval(e),n(window.document.body)},10)});function Cn(n){ln("remoteWindowPromises").getOrSet(n,function(){return new F})}function Ln(n){var e=ln("remoteWindowPromises").get(n);if(!e)throw new Error("Remote window promise not found");return e}function Bn(n,e,r){Ln(n).resolve(function(t,o,i){if(t!==n)throw new Error("Remote window does not match window");if(!M(o,e))throw new Error("Remote domain "+o+" does not match domain "+e);r.fireAndForget(i)})}function zn(n,e){Ln(n).reject(e).catch(Y)}function Fn(n){for(var e=n.win,r=n.name,t=n.domain,o=fn("popupWindowsByName"),i=ln("popupWindowsByWin"),a=0,u=o.keys();a<u.length;a++){var s=u[a];b(o.get(s).win)&&o.del(s)}var c=i.getOrSet(e,function(){return r?o.getOrSet(r,function(){return{win:e,name:r}}):{win:e}});if(c.win&&c.win!==e)throw new Error("Different window already linked for window: "+(r||"undefined"));if(r){if(c.name&&c.name!==r)throw new Error("Different window already linked for name "+r+": "+c.name);c.name=r,o.set(r,c)}return t&&(c.domain=t,Cn(e)),i.set(e,c),c}function Un(n){var e,r=n.on,t=n.send,o=n.receiveMessage;e=window.open,window.open=function(n,r,t,o){var a=e.call(this,function(n){if(0!==j(n).indexOf(i.MOCK))return n;throw new Error("Mock urls not supported out of test mode")}(n),r,t,o);return a?(Fn({win:a,name:r,domain:n?j(n):null}),a):a},function(n){var e=n.on,r=n.send,t=n.receiveMessage,o=fn("popupWindowsByName");e(tn.OPEN_TUNNEL,function(n){var i=n.source,a=n.origin,u=n.data,s=fn("bridges").get(a);if(!s)throw new Error("Can not find bridge promise for domain "+a);return s.then(function(n){if(i!==n)throw new Error("Message source does not matched registered bridge for domain "+a);if(!u.name)throw new Error("Register window expected to be passed window name");if(!u.sendMessage)throw new Error("Register window expected to be passed sendMessage method");if(!o.has(u.name))throw new Error("Window with name "+u.name+" does not exist, or was not opened by this window");if(!o.get(u.name).domain)throw new Error("We do not have a registered domain for window "+u.name);if(o.get(u.name).domain!==a)throw new Error("Message origin "+a+" does not matched registered window origin "+o.get(u.name).domain);return Bn(o.get(u.name).win,a,u.sendMessage),{sendMessage:function(n){if(window&&!window.closed){var i=o.get(u.name);if(i)try{t({data:n,origin:i.domain,source:i.win},{on:e,send:r})}catch(n){F.reject(n)}}}}})})}({on:r,send:t,receiveMessage:o}),function(n){var e=n.send;sn(window).openTunnelToParent=function(n){var r=n.name,t=n.source,o=n.canary,i=n.sendMessage,a=fn("tunnelWindows"),u=c(window);if(!u)throw new Error("No parent window found to open tunnel to");var s=function(n){var e=n.name,r=n.source,t=n.canary,o=n.sendMessage;!function(){for(var n=fn("tunnelWindows"),e=0,r=n.keys();e<r.length;e++){var t=r[e],o=n[t];try{o.source}catch(e){n.del(t);continue}b(o.source)&&n.del(t)}}();var i=X();return fn("tunnelWindows").set(i,{name:e,source:r,canary:t,sendMessage:o}),i}({name:r,source:t,canary:o,sendMessage:i});return e(u,tn.OPEN_TUNNEL,{name:r,sendMessage:function(){var n=a.get(s);try{n&&n.source}catch(n){return void a.del(s)}if(n&&n.source&&!b(n.source)){try{n.canary()}catch(n){return}n.sendMessage.apply(this,arguments)}}},{domain:an})}}({on:r,send:t}),function(n){var e=n.on,r=n.send,t=n.receiveMessage;F.try(function(){var n,o=f(window);if(o&&In({win:o}))return Cn(o),(n=o,ln("remoteBridgeAwaiters").getOrSet(n,function(){return F.try(function(){var e=S(n,kn(l()));if(!e)throw new Error("Bridge not found for domain: "+l());return m(e)&&sn(e)?e:new F(function(n,r){var t,o;t=setInterval(function(){if(e&&m(e)&&sn(e))return clearInterval(t),clearTimeout(o),n(e)},100),o=setTimeout(function(){return clearInterval(t),r(new Error("Bridge not found for domain: "+l()))},2e3)})})})).then(function(n){return window.name?sn(n).openTunnelToParent({name:window.name,source:window,canary:function(){},sendMessage:function(n){if(window&&!window.closed)try{t({data:n,origin:this.origin,source:this.source},{on:e,send:r})}catch(n){F.reject(n)}}}).then(function(n){var e=n.source,r=n.origin,t=n.data;if(e!==o)throw new Error("Source does not match opener");Bn(e,r,t.sendMessage)}).catch(function(n){throw zn(o,n),n}):zn(o,new Error("Can not register with opener: window does not have a name"))})})}({on:r,send:t,receiveMessage:o})}function Hn(){for(var n=fn("idToProxyWindow"),e=0,r=n.keys();e<r.length;e++){var t=r[e];n.get(t).shouldClean()&&n.del(t)}}var qn=function(){function n(n,e,r){var t=r.send;this.isProxyWindow=!0,this.serializedWindow=void 0,this.actualWindow=void 0,this.actualWindowPromise=void 0,this.send=void 0,this.serializedWindow=n,this.actualWindowPromise=new F,e&&this.setWindow(e),this.serializedWindow.getInstanceID=function(n){var e={};function r(){for(var r=arguments.length,t=new Array(r),o=0;o<r;o++)t[o]=arguments[o];var i=function(n){try{return JSON.stringify(Array.prototype.slice.call(n),function(n,e){return"function"==typeof e?"memoize["+function(n){if(q=q||new K,null==n||"object"!=typeof n&&"function"!=typeof n)throw new Error("Invalid object");var e=q.get(n);return e||(e=typeof n+":"+X(),q.set(n,e)),e}(e)+"]":e})}catch(n){throw new Error("Arguments not serializable -- can not be used to memoize")}}(t);return e.hasOwnProperty(i)?e[i]:(e[i]=n.apply(this,arguments).finally(function(){delete e[i]}),e[i])}return r.reset=function(){e={}},r}(this.serializedWindow.getInstanceID),this.send=t}var e=n.prototype;return e.getType=function(){return this.serializedWindow.type},e.isPopup=function(){return"popup"===this.getType()},e.isIframe=function(){return"iframe"===this.getType()},e.setLocation=function(n){var e=this;return F.try(function(){if(!e.actualWindow)return e.serializedWindow.setLocation(n);e.actualWindow.location=n}).then(function(){return e})},e.setName=function(n){var e=this;return F.try(function(){if(!e.actualWindow)return e.serializedWindow.setName(n);if(!m(e.actualWindow))throw new Error("Can not set name for window on different domain");e.actualWindow.name=n,e.actualWindow.frameElement&&e.actualWindow.frameElement.setAttribute("name",n),Fn({win:e.actualWindow,name:n})}).then(function(){return e})},e.close=function(){var n=this;return F.try(function(){if(!n.actualWindow)return n.serializedWindow.close();n.actualWindow.close()}).then(function(){return n})},e.focus=function(){var n=this;return F.try(function(){return n.actualWindow&&n.actualWindow.focus(),n.serializedWindow.focus()}).then(function(){return n})},e.isClosed=function(){var n=this;return F.try(function(){return n.actualWindow?b(n.actualWindow):n.serializedWindow.isClosed()})},e.getWindow=function(){return this.actualWindow},e.setWindow=function(n){this.actualWindow=n,this.actualWindowPromise.resolve(n)},e.awaitWindow=function(){return this.actualWindowPromise},e.matchWindow=function(n){var e=this;return F.try(function(){return e.actualWindow?n===e.actualWindow:F.all([e.getInstanceID(),pn(n,{send:e.send})]).then(function(r){var t=r[0]===r[1];return t&&e.setWindow(n),t})})},e.unwrap=function(){return this.actualWindow||this},e.getInstanceID=function(){return this.actualWindow?pn(this.actualWindow,{send:this.send}):this.serializedWindow.getInstanceID()},e.serialize=function(){return this.serializedWindow},e.shouldClean=function(){return this.actualWindow&&b(this.actualWindow)},n.unwrap=function(e){return n.isProxyWindow(e)?e.unwrap():e},n.serialize=function(e,r){var t=r.send;return Hn(),n.toProxyWindow(e,{send:t}).serialize()},n.deserialize=function(e,r){var t=r.on,o=r.send;return Hn(),fn("idToProxyWindow").getOrSet(e.id,function(){return new n(e,null,{on:t,send:o})})},n.isProxyWindow=function(n){return Boolean(n&&!P(n)&&n.isProxyWindow)},n.toProxyWindow=function(e,r){var t=r.send;return Hn(),n.isProxyWindow(e)?e:ln("winToProxyWindow").getOrSet(e,function(){var r=X();return fn("idToProxyWindow").set(r,new n({id:r,type:f(e)?"popup":"iframe",getInstanceID:function(){return pn(e,{send:t})},close:function(){return F.try(function(){e.close()})},focus:function(){return F.try(function(){e.focus()})},isClosed:function(){return F.try(function(){return b(e)})},setLocation:function(n){return F.try(function(){if(m(e))try{if(e.location&&"function"==typeof e.location.replace)return void e.location.replace(n)}catch(n){}e.location=n})},setName:function(n){return F.try(function(){Fn({win:e,name:n}),e.name=n})}},e,{send:t}))})},n}();function Gn(n,e,r,t,o){var i=ln("methodStore"),a=fn("proxyWindowMethods");qn.isProxyWindow(t)?a.set(n,{val:e,name:r,domain:o,source:t}):(a.del(n),i.getOrSet(t,function(){return{}})[n]={domain:o,name:r,val:e,source:t})}function Jn(n,e){var r=ln("methodStore"),t=fn("proxyWindowMethods");return r.getOrSet(n,function(){return{}})[e]||t.get(e)}function Kn(n,e,r,t,o){!function(n){var e=o.on;fn("builtinListeners").getOrSet("functionCalls",function(){return e(tn.METHOD,{domain:an},function(n){var e=n.source,r=n.origin,t=n.data,o=t.id,i=t.name,a=Jn(e,o);if(!a)throw new Error("Could not find method '"+t.name+"' with id: "+t.id+" in "+l(window));var u=a.source,s=a.domain,c=a.val;return F.try(function(){if(!M(s,r))throw new Error("Method '"+t.name+"' domain "+JSON.stringify(Z(a.domain)?a.domain.source:a.domain)+" does not match origin "+r+" in "+l(window));if(qn.isProxyWindow(u))return u.matchWindow(e).then(function(n){if(!n)throw new Error("Method call '"+t.name+"' failed - proxy window does not match source in "+l(window))})}).then(function(){return c.apply({source:e,origin:r},t.args)},function(n){return F.try(function(){if(c.onError)return c.onError(n)}).then(function(){throw n})}).then(function(n){return{result:n,id:o,name:i}})})})}();var i=r.__id__||X();n=qn.unwrap(n);var a=r.__name__||r.name||t;return qn.isProxyWindow(n)?(Gn(i,r,a,n,e),n.awaitWindow().then(function(n){Gn(i,r,a,n,e)})):Gn(i,r,a,n,e),Wn(un.CROSS_DOMAIN_FUNCTION,{id:i,name:a})}function Xn(n,e,r,t){var o,i=t.on,a=t.send;return function(n,e){void 0===e&&(e=An);var r=JSON.stringify(n,function(n){var r=this[n];if(On(this))return r;var t=bn(r);if(!t)return r;var o=e[t]||Rn[t];return o?o(r,n):r});return void 0===r?_n.UNDEFINED:r}(r,((o={})[_n.PROMISE]=function(r,t){return function(n,e,r,t,o){var i=o.on,a=o.send;return Wn(un.CROSS_DOMAIN_ZALGO_PROMISE,{then:Kn(n,e,function(n,e){return r.then(n,e)},t,{on:i,send:a})})}(n,e,r,t,{on:i,send:a})},o[_n.FUNCTION]=function(r,t){return Kn(n,e,r,t,{on:i,send:a})},o[_n.OBJECT]=function(n){return P(n)||qn.isProxyWindow(n)?function(n,e,r,t){var o=t.send;return Wn(un.CROSS_DOMAIN_WINDOW,qn.serialize(r,{send:o}))}(0,0,n,{on:i,send:a}):n},o))}function Yn(n,e,r,t){var o,i=t.on,a=t.send;return function(n,e){if(void 0===e&&(e=xn),n!==_n.UNDEFINED)return JSON.parse(n,function(n,r){if(On(this))return r;var t,o;if(On(r)?(t=r.__type__,o=r.__val__):(t=bn(r),o=r),!t)return o;var i=e[t]||Nn[t];return i?i(o,n):o})}(r,((o={})[un.CROSS_DOMAIN_ZALGO_PROMISE]=function(n){return e=n.then,new F(e);var e},o[un.CROSS_DOMAIN_FUNCTION]=function(r){return function(n,e,r,t){var o=r.id,i=r.name,a=t.send,u=function(r){function t(){var u=arguments;return qn.toProxyWindow(n,{send:a}).awaitWindow().then(function(n){var s=Jn(n,o);return s&&s.val!==t?s.val.apply({source:window,origin:l()},u):a(n,tn.METHOD,{id:o,name:i,args:Array.prototype.slice.call(u)},{domain:e,fireAndForget:r.fireAndForget}).then(function(n){if(!r.fireAndForget)return n.data.result})}).catch(function(n){throw n})}return void 0===r&&(r={}),t.__name__=i,t.__origin__=e,t.__source__=n,t.__id__=o,t.origin=e,t},s=u();return s.fireAndForget=u({fireAndForget:!0}),s}(n,e,r,{on:i,send:a})},o[un.CROSS_DOMAIN_WINDOW]=function(n){return function(n,e,r,t){var o=t.on,i=t.send;return qn.deserialize(r,{on:o,send:i})}(0,0,n,{on:i,send:a})},o))}var Zn={};function Qn(n,e,r,t){var o,i=t.on,a=t.send;if(b(n))throw new Error("Window is closed");for(var u,s=Xn(n,e,((o={}).__post_robot_10_0_0__=U({id:X()},r),o),{on:i,send:a}),c=!1,f=0,d=Object.keys(Zn);f<d.length;f++){var w=d[f];try{Zn[w](n,s,e),c=!0}catch(n){u=u||n}}if(!c)throw u}Zn.postrobot_post_message=function(n,e,r){(Array.isArray(r)?r:"string"==typeof r?[r]:[an]).map(function(e){if(0===e.indexOf(i.MOCK)){if(window.location.protocol===i.FILE)return an;if(!h(n))throw new Error("Attempting to send messsage to mock domain "+e+", but window is actually cross-domain");return w(n)}return 0===e.indexOf(i.FILE)?an:e}).forEach(function(r){n.postMessage(e,r)})},Zn.postrobot_bridge=function(n,e,r){if(Mn()||Tn()){if(m(n))throw new Error("Post message through bridge disabled between same domain windows");if(!1!==x(window,n))throw new Error("Can only use bridge to communicate between two different windows, not between frames");!function(n,e,r){var t=R(window,n),o=R(n,window);if(!t&&!o)throw new Error("Can only send messages to and from parent and popup windows");Ln(n).then(function(t){return t(n,e,r)})}(n,r,e)}},Zn.postrobot_global=function(n,e){if(W(window).match(/MSIE|rv:11|trident|edge\/12|edge\/13/i)){if(!m(n))throw new Error("Post message through global disabled between different domain windows");if(!1!==x(window,n))throw new Error("Can only use global to communicate between two different windows, not between frames");var r=sn(n);if(!r)throw new Error("Can not find postRobot global on foreign window");r.receiveMessage({source:window,origin:l(),data:e})}};var Vn,$n="__domain_regex__";function ne(n){return fn("responseListeners").get(n)}function ee(n){fn("responseListeners").del(n)}function re(n){return fn("erroredResponseListeners").has(n)}function te(n){var e=n.name,r=n.win,t=n.domain,o=ln("requestListeners");if(r===an&&(r=null),t===an&&(t=null),!e)throw new Error("Name required to get request listener");for(var i=0,a=[r,wn()];i<a.length;i++){var u=a[i];if(u){var s=o.get(u);if(s){var c=s[e];if(c){if(t&&"string"==typeof t){if(c[t])return c[t];if(c[$n])for(var f=0,d=c[$n];f<d.length;f++){var w=d[f],l=w.regex,h=w.listener;if(M(l,t))return h}}if(c[an])return c[an]}}}}}var oe,ie=((Vn={})[rn.REQUEST]=function(n,e,r,t){var o=t.on,i=t.send,a=te({name:r.name,win:n,domain:e});function u(t,a,u){void 0===u&&(u={}),r.fireAndForget||b(n)||Qn(n,e,U({type:t,ack:a,hash:r.hash,name:r.name},u),{on:o,send:i})}return r.name===tn.METHOD&&r.data&&"string"==typeof r.data.name?r.data.name:r.name,F.all([u(rn.ACK),F.try(function(){if(!a)throw new Error("No handler found for post message: "+r.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!M(a.domain,e))throw new Error("Request origin "+e+" does not match domain "+a.domain.toString());var t=r.data;return a.handler({source:n,origin:e,data:t})}).then(function(n){return u(rn.RESPONSE,"success",{data:n})},function(n){return u(rn.RESPONSE,"error",{error:n})})]).then(Y).catch(function(n){if(a&&a.handleError)return a.handleError(n);throw n})},Vn[rn.ACK]=function(n,e,r){if(!re(r.hash)){var t=ne(r.hash);if(!t)throw new Error("No handler found for post message ack for message: "+r.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!M(t.domain,e))throw new Error("Ack origin "+e+" does not match domain "+t.domain.toString());if(n!==t.win)throw new Error("Ack source does not match registered window");t.ack=!0}},Vn[rn.RESPONSE]=function(n,e,r){if(!re(r.hash)){var t,i=ne(r.hash);if(!i)throw new Error("No handler found for post message response for message: "+r.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!M(i.domain,e))throw new Error("Response origin "+e+" does not match domain "+(t=i.domain,Array.isArray(t)?"("+t.join(" | ")+")":o(t)?"RegExp("+t.toString():t.toString()));if(n!==i.win)throw new Error("Response source does not match registered window");ee(r.hash),r.name===tn.METHOD&&r.data&&"string"==typeof r.data.name?r.data.name:r.name,"error"===r.ack?i.promise.reject(r.error):"success"===r.ack&&i.promise.resolve({source:n,origin:e,data:r.data})}},Vn);function ae(n,e){var r=e.on,t=e.send,o=fn("receivedMessages");if(!window||window.closed)throw new Error("Message recieved in closed window");try{if(!n.source)return}catch(n){return}var i=n.source,a=n.origin,u=function(n,e,r,t){var o,i=t.on,a=t.send;try{o=Yn(e,r,n,{on:i,send:a})}catch(n){return}if(o&&"object"==typeof o&&null!==o&&(o=o.__post_robot_10_0_0__)&&"object"==typeof o&&null!==o&&o.type&&"string"==typeof o.type&&ie[o.type])return o}(n.data,i,a,{on:r,send:t});u&&(yn(i),o.has(u.id)||(o.set(u.id,!0),b(i)&&!u.fireAndForget||ie[u.type](i,a,u,{on:r,send:t})))}function ue(n,e,r){if(!n)throw new Error("Expected name");if("function"==typeof e&&(r=e,e={}),!r)throw new Error("Expected handler");(e=e||{}).name=n,e.handler=r||e.handler;var t=e.window,o=e.domain,i=function n(e,r){var t=e.name,o=e.win,i=e.domain,a=ln("requestListeners");if(!t||"string"!=typeof t)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var u=[],s=0,c=o;s<c.length;s++){var f=c[s];u.push(n({name:t,domain:i,win:f},r))}return{cancel:function(){for(var n=0;n<u.length;n++)u[n].cancel()}}}if(Array.isArray(i)){for(var d=[],w=0,l=i;w<l.length;w++){var h=l[w];d.push(n({name:t,win:o,domain:h},r))}return{cancel:function(){for(var n=0;n<d.length;n++)d[n].cancel()}}}var m=te({name:t,win:o,domain:i});if(o&&o!==an||(o=wn()),i=i||an,m)throw o&&i?new Error("Request listener already exists for "+t+" on domain "+i.toString()+" for "+(o===wn()?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+t+" for "+(o===wn()?"wildcard":"specified")+" window"):i?new Error("Request listener already exists for "+t+" on domain "+i.toString()):new Error("Request listener already exists for "+t);var v,p,g=a.getOrSet(o,function(){return{}}),y=Q(g,t,function(){return{}}),E=i.toString();return Z(i)?(v=Q(y,$n,function(){return[]}),p={regex:i,listener:r},v.push(p)):y[E]=r,{cancel:function(){delete y[E],p&&(v.splice(v.indexOf(p,1)),v.length||delete y[$n]),Object.keys(y).length||delete g[t],o&&!Object.keys(g).length&&a.del(o)}}}({name:n,win:t,domain:o},{handler:e.handler,handleError:e.errorHandler||function(n){throw n},window:t,domain:o||an,name:n});return{cancel:function(){i.cancel()}}}function se(n,e,r){"function"==typeof(e=e||{})&&(r=e,e={});var t,o=new F;return e.errorHandler=function(n){t.cancel(),o.reject(n)},t=ue(n,e,function(n){if(t.cancel(),o.resolve(n),r)return r(n)}),o.cancel=t.cancel,o}function ce(n,e,r,t){var o=(t=t||{}).domain||an,i=t.timeout||en,a=t.timeout||V,u=t.fireAndForget||!1;return F.try(function(){if(!e)throw new Error("Expected name");if(o&&"string"!=typeof o&&!Array.isArray(o)&&!Z(o))throw new TypeError("Expected domain to be a string, array, or regex");if(b(n))throw new Error("Target window is closed");var t=ln("requestPromises").getOrSet(n,function(){return[]}),s=F.try(function(){return function(n,e){var r=A(e);if(r)return r===n;if(e===n)return!1;if(y(e)===e)return!1;for(var t=0,o=p(n);t<o.length;t++)if(o[t]===e)return!0;return!1}(window,n)?gn(n,a):Z(o)?vn(n,{send:ce}):void 0}).then(function(a){var c=(void 0===a?{}:a).domain;if(Z(o)){if(!M(o,c))throw new Error("Remote window domain "+c+" does not match regex: "+o.source);o=c}e===tn.METHOD&&r&&"string"==typeof r.name&&r.name;var f=!1,d=new F;d.finally(function(){f=!0,t.splice(t.indexOf(s,1))}).catch(Y);var w=e+"_"+X();if(Qn(n,o,{type:rn.REQUEST,hash:w,name:e,data:r,fireAndForget:u},{on:ue,send:ce}),u)return d.resolve();d.catch(function(){!function(n){fn("erroredResponseListeners").set(n,!0)}(w),ee(w)});var h={name:e,win:n,domain:o,promise:d};!function(n,e){fn("responseListeners").set(n,e)}(w,h);var m=function(n){return ln("knownWindows").get(n,!1)}(n)?nn:$,v=i,p=m,g=v,y=100;return setTimeout(function r(){if(!f){if(b(n))return h.ack?d.reject(new Error("Window closed for "+e+" before response")):d.reject(new Error("Window closed for "+e+" before ack"));if(p=Math.max(p-y,0),-1!==g&&(g=Math.max(g-y,0)),h.ack){if(-1===g)return;y=Math.min(g,2e3)}else{if(0===p)return d.reject(new Error("No ack for postMessage "+e+" in "+l()+" in "+m+"ms"));if(0===g)return d.reject(new Error("No response for postMessage "+e+" in "+l()+" in "+v+"ms"))}setTimeout(r,y)}},y),d});return t.push(s),s})}function fe(n,e,r){return Xn(n,e,r,{on:ue,send:ce})}function de(n,e,r){return Yn(n,e,r,{on:ue,send:ce})}function we(n){return qn.toProxyWindow(n,{send:ce})}function le(){var n,e,r,t;sn().initialized||(sn().initialized=!0,function(n){var e=n.on,r=n.send;fn().getOrSet("postMessageListeners",function(){return n=window,t=function(n){!function(n,e){var r=e.on,t=e.send;try{n.source}catch(n){return}var o={source:n.source||n.sourceElement,origin:n.origin||n.originalEvent&&n.originalEvent.origin,data:n.data};if(o.source){if(!o.origin)throw new Error("Post message did not have origin domain");ae(o,{on:r,send:t})}}(n,{on:e,send:r})},n.addEventListener("message",t),{cancel:function(){n.removeEventListener("message",t)}};var n,t})}({on:ue,send:ce}),Un({on:ue,send:ce,receiveMessage:ae}),function(n){var e=n.on,r=n.send;fn("builtinListeners").getOrSet("helloListener",function(){var n=e(tn.HELLO,{domain:an},function(n){var e=n.source,r=n.origin;return mn(e).resolve({win:e,domain:r}),{instanceID:hn()}}),t=A();return t&&vn(t,{send:r}).catch(Y),n})}({on:ue,send:ce}),e=(n={on:ue,send:ce}).on,r=n.send,(t=sn()).receiveMessage=t.receiveMessage||function(n){return ae(n,{on:e,send:r})})}function he(n){for(var e=0,r=ln("requestPromises").get(n,[]);e<r.length;e++)r[e].reject(new Error("Window cleaned up before response")).catch(Y)}r.d(e,"bridge",function(){return oe}),r.d(e,"Promise",function(){return F}),r.d(e,"TYPES",function(){return!0}),r.d(e,"ProxyWindow",function(){return qn}),r.d(e,"setup",function(){return le}),r.d(e,"serializeMessage",function(){return fe}),r.d(e,"deserializeMessage",function(){return de}),r.d(e,"toProxyWindow",function(){return we}),r.d(e,"on",function(){return ue}),r.d(e,"once",function(){return se}),r.d(e,"send",function(){return ce}),r.d(e,"markWindowKnown",function(){return yn}),r.d(e,"cleanUpWindow",function(){return he}),oe={setupBridge:Un,openBridge:function(n,e){var r=fn("bridges"),t=fn("bridgeFrames");return e=e||j(n),r.getOrSet(e,function(){return F.try(function(){if(l()===e)throw new Error("Can not open bridge on the same domain as current domain: "+e);var r=kn(e);if(S(window,r))throw new Error("Frame with name "+r+" already exists on page");var o=function(n,e){var r=document.createElement("iframe");return r.setAttribute("name",n),r.setAttribute("id",n),r.setAttribute("style","display: none; margin: 0; padding: 0; border: 0px none; overflow: hidden;"),r.setAttribute("frameborder","0"),r.setAttribute("border","0"),r.setAttribute("scrolling","no"),r.setAttribute("allowTransparency","true"),r.setAttribute("tabindex","-1"),r.setAttribute("hidden","true"),r.setAttribute("title",""),r.setAttribute("role","presentation"),r.src=e,r}(r,n);return t.set(e,o),Dn.then(function(e){e.appendChild(o);var r=o.contentWindow;return new F(function(n,e){o.addEventListener("load",n),o.addEventListener("error",e)}).then(function(){return gn(r,5e3,"Bridge "+n)}).then(function(){return r})})})})},linkWindow:Fn,linkUrl:function(n,e){Fn({win:n,domain:j(e)})},isBridge:Tn,needsBridge:In,needsBridgeForBrowser:Mn,hasBridge:function(n,e){return fn("bridges").has(e||j(n))},needsBridgeForWin:jn,needsBridgeForDomain:Pn,destroyBridges:function(){for(var n=fn("bridges"),e=fn("bridgeFrames"),r=0,t=e.keys();r<t.length;r++){var o=t[r],i=e.get(o);i&&i.parentNode&&i.parentNode.removeChild(i)}e.reset(),n.reset()}},le()}])});
!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("postRobot",[],e):"object"==typeof exports?exports.postRobot=e():n.postRobot=e()}("undefined"!=typeof self?self:this,function(){return function(n){var e={};function r(t){if(e[t])return e[t].exports;var o=e[t]={i:t,l:!1,exports:{}};return n[t].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=n,r.c=e,r.d=function(n,e,t){r.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:t})},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,e){if(1&e&&(n=r(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var t=Object.create(null);if(r.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var o in n)r.d(t,o,function(e){return n[e]}.bind(null,o));return t},r.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(e,"a",e),e},r.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},r.p="",r(r.s=0)}([function(n,e,r){"use strict";r.r(e);var t={};function o(n){return"[object RegExp]"===Object.prototype.toString.call(n)}r.r(t),r.d(t,"WeakMap",function(){return K});var i={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},a="*",u="Call was rejected by callee.\r\n";function s(n){return void 0===n&&(n=window),n.location.protocol===i.ABOUT}function c(n){if(n)try{if(n.parent&&n.parent!==n)return n.parent}catch(n){}}function f(n){if(n&&!c(n))try{return n.opener}catch(n){}}function d(n){try{return n&&n.location&&n.location.href,!0}catch(n){}return!1}function w(n){var e=(n=n||window).location;if(!e)throw new Error("Can not read window location");var r=e.protocol;if(!r)throw new Error("Can not read window protocol");if(r===i.FILE)return i.FILE+"//";if(r===i.ABOUT){var t=c(n);return t&&d(t)?w(t):i.ABOUT+"//"}var o=e.host;if(!o)throw new Error("Can not read window host");return r+"//"+o}function l(n){var e=w(n=n||window);return e&&n.mockDomain&&0===n.mockDomain.indexOf(i.MOCK)?n.mockDomain:e}function h(n){try{if(n===window)return!0}catch(n){}try{var e=Object.getOwnPropertyDescriptor(n,"location");if(e&&!1===e.enumerable)return!1}catch(n){}try{if(s(n)&&d(n))return!0}catch(n){}try{if(w(n)===w(window))return!0}catch(n){}return!1}function m(n){if(!h(n))return!1;try{if(n===window)return!0;if(s(n)&&d(n))return!0;if(l(window)===l(n))return!0}catch(n){}return!1}function v(n,e){if(!n||!e)return!1;var r=c(e);return r?r===n:-1!==function(n){var e=[];try{for(;n.parent!==n;)e.push(n.parent),n=n.parent}catch(n){}return e}(e).indexOf(n)}function p(n){var e,r,t=[];try{e=n.frames}catch(r){e=n}try{r=e.length}catch(n){}if(0===r)return t;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=e[o]}catch(n){continue}t.push(i)}return t}for(var a=0;a<100;a++){var u=void 0;try{u=e[a]}catch(n){return t}if(!u)return t;t.push(u)}return t}function g(n){for(var e=[],r=0,t=p(n);r<t.length;r++){var o=t[r];e.push(o);for(var i=0,a=g(o);i<a.length;i++){var u=a[i];e.push(u)}}return e}function y(n){if(n){try{if(n.top)return n.top}catch(n){}if(c(n)===n)return n;try{if(v(window,n)&&window.top)return window.top}catch(n){}try{if(v(n,window)&&window.top)return window.top}catch(n){}for(var e=0,r=g(n);e<r.length;e++){var t=r[e];try{if(t.top)return t.top}catch(n){}if(c(t)===t)return t}}}function E(n){var e=y(n);if(!e)throw new Error("Can not determine top window");return[].concat(g(e),[e])}var _=[],O=[];function b(n,e){void 0===e&&(e=!0);try{if(n===window)return!1}catch(n){return!0}try{if(!n)return!0}catch(n){return!0}try{if(n.closed)return!0}catch(n){return!n||n.message!==u}if(e&&m(n))try{if(n.mockclosed)return!0}catch(n){}try{if(!n.parent||!n.top)return!0}catch(n){}var r=function(n,e){for(var r=0;r<n.length;r++)try{if(n[r]===e)return r}catch(n){}return-1}(_,n);if(-1!==r){var t=O[r];if(t&&function(n){if(!n.contentWindow)return!0;if(!n.parentNode)return!0;var e=n.ownerDocument;return!(!e||!e.documentElement||e.documentElement.contains(n))}(t))return!0}return!1}function W(n){return(n=n||window).navigator.mockUserAgent||n.navigator.userAgent}function S(n,e){for(var r=p(n),t=0;t<r.length;t++){var o=r[t];try{if(m(o)&&o.name===e&&-1!==r.indexOf(o))return o}catch(n){}}try{if(-1!==r.indexOf(n.frames[e]))return n.frames[e]}catch(n){}try{if(-1!==r.indexOf(n[e]))return n[e]}catch(n){}}function R(n,e){return n===f(e)}function A(n){return f(n=n||window)||c(n)||void 0}function N(n,e){for(var r=0;r<n.length;r++)for(var t=n[r],o=0;o<e.length;o++)if(t===e[o])return!0;return!1}function x(n,e){var r=y(n)||n,t=y(e)||e;try{if(r&&t)return r===t}catch(n){}var o=E(n),i=E(e);if(N(o,i))return!0;var a=f(r),u=f(t);return!(a&&N(E(a),i)||(u&&N(E(u),o),1))}function M(n,e){if("string"==typeof n){if("string"==typeof e)return n===a||e===n;if(o(e))return!1;if(Array.isArray(e))return!1}return o(n)?o(e)?n.toString()===e.toString():!Array.isArray(e)&&Boolean(e.match(n)):!!Array.isArray(n)&&(Array.isArray(e)?JSON.stringify(n)===JSON.stringify(e):!o(e)&&n.some(function(n){return M(n,e)}))}function j(n){return n.match(/^(https?|mock|file):\/\//)?n.split("/").slice(0,3).join("/"):l()}function P(n){try{if(n===window)return!0}catch(n){if(n&&n.message===u)return!0}try{if("[object Window]"===Object.prototype.toString.call(n))return!0}catch(n){if(n&&n.message===u)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(n){if(n&&n.message===u)return!0}try{if(n&&n.self===n)return!0}catch(n){if(n&&n.message===u)return!0}try{if(n&&n.parent===n)return!0}catch(n){if(n&&n.message===u)return!0}try{if(n&&n.top===n)return!0}catch(n){if(n&&n.message===u)return!0}try{n&&n.__cross_domain_utils_window_check__}catch(n){return!0}return!1}function I(n){try{if(!n)return!1;if("undefined"!=typeof Promise&&n instanceof Promise)return!0;if("undefined"!=typeof window&&window.Window&&n instanceof window.Window)return!1;if("undefined"!=typeof window&&window.constructor&&n instanceof window.constructor)return!1;var e={}.toString;if(e){var r=e.call(n);if("[object Window]"===r||"[object global]"===r||"[object DOMWindow]"===r)return!1}if("function"==typeof n.then)return!0}catch(n){return!1}return!1}var k,T=[],D=[],C=0;function L(){if(!C&&k){var n=k;k=null,n.resolve()}}function B(){C+=1}function z(){C-=1,L()}var F=function(){function n(n){var e=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],n){var r,t,o=!1,i=!1,a=!1;B();try{n(function(n){a?e.resolve(n):(o=!0,r=n)},function(n){a?e.reject(n):(i=!0,t=n)})}catch(n){return z(),void this.reject(n)}z(),a=!0,o?this.resolve(r):i&&this.reject(t)}}var e=n.prototype;return e.resolve=function(n){if(this.resolved||this.rejected)return this;if(I(n))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=n,this.dispatch(),this},e.reject=function(n){var e=this;if(this.resolved||this.rejected)return this;if(I(n))throw new Error("Can not reject promise with another promise");if(!n){var r=n&&"function"==typeof n.toString?n.toString():Object.prototype.toString.call(n);n=new Error("Expected reject to be called with Error, got "+r)}return this.rejected=!0,this.error=n,this.errorHandled||setTimeout(function(){e.errorHandled||function(n,e){if(-1===T.indexOf(n)){T.push(n),setTimeout(function(){throw n},1);for(var r=0;r<D.length;r++)D[r](n,e)}}(n,e)},1),this.dispatch(),this},e.asyncReject=function(n){return this.errorHandled=!0,this.reject(n),this},e.dispatch=function(){var e=this,r=this.dispatching,t=this.resolved,o=this.rejected,i=this.handlers;if(!r&&(t||o)){this.dispatching=!0,B();for(var a=function(r){var a=i[r],u=a.onSuccess,s=a.onError,c=a.promise,f=void 0;if(t)try{f=u?u(e.value):e.value}catch(n){return c.reject(n),"continue"}else if(o){if(!s)return c.reject(e.error),"continue";try{f=s(e.error)}catch(n){return c.reject(n),"continue"}}f instanceof n&&(f.resolved||f.rejected)?(f.resolved?c.resolve(f.value):c.reject(f.error),f.errorHandled=!0):I(f)?f instanceof n&&(f.resolved||f.rejected)?f.resolved?c.resolve(f.value):c.reject(f.error):f.then(function(n){c.resolve(n)},function(n){c.reject(n)}):c.resolve(f)},u=0;u<i.length;u++)a(u);i.length=0,this.dispatching=!1,z()}},e.then=function(e,r){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.then expected a function for success handler");if(r&&"function"!=typeof r&&!r.call)throw new Error("Promise.then expected a function for error handler");var t=new n;return this.handlers.push({promise:t,onSuccess:e,onError:r}),this.errorHandled=!0,this.dispatch(),t},e.catch=function(n){return this.then(void 0,n)},e.finally=function(e){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return n.try(e).then(function(){return r})},function(r){return n.try(e).then(function(){throw r})})},e.timeout=function(n,e){var r=this;if(this.resolved||this.rejected)return this;var t=setTimeout(function(){r.resolved||r.rejected||r.reject(e||new Error("Promise timed out after "+n+"ms"))},n);return this.then(function(n){return clearTimeout(t),n})},e.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},n.resolve=function(e){return e instanceof n?e:I(e)?new n(function(n,r){return e.then(n,r)}):(new n).resolve(e)},n.reject=function(e){return(new n).reject(e)},n.asyncReject=function(e){return(new n).asyncReject(e)},n.all=function(e){var r=new n,t=e.length,o=[];if(!t)return r.resolve(o),r;for(var i=function(i){var a=e[i];if(a instanceof n){if(a.resolved)return o[i]=a.value,t-=1,"continue"}else if(!I(a))return o[i]=a,t-=1,"continue";n.resolve(a).then(function(n){o[i]=n,0==(t-=1)&&r.resolve(o)},function(n){r.reject(n)})},a=0;a<e.length;a++)i(a);return 0===t&&r.resolve(o),r},n.hash=function(e){var r={};return n.all(Object.keys(e).map(function(t){return n.resolve(e[t]).then(function(n){r[t]=n})})).then(function(){return r})},n.map=function(e,r){return n.all(e.map(r))},n.onPossiblyUnhandledException=function(n){return function(n){return D.push(n),{cancel:function(){D.splice(D.indexOf(n),1)}}}(n)},n.try=function(e,r,t){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.try expected a function");var o;B();try{o=e.apply(r,t||[])}catch(e){return z(),n.reject(e)}return z(),n.resolve(o)},n.delay=function(e){return new n(function(n){setTimeout(n,e)})},n.isPromise=function(e){return!!(e&&e instanceof n)||I(e)},n.flush=function(){return e=k=k||new n,L(),e;var e},n}();function U(){return(U=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(n[t]=r[t])}return n}).apply(this,arguments)}function H(n,e){for(var r=0;r<n.length;r++)try{if(n[r]===e)return r}catch(n){}return-1}var q,G=Object.defineProperty,J=Date.now()%1e9,K=function(){function n(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,J+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+J,function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var n=new WeakMap,e={};return Object.freeze(e),n.set(e,"__testvalue__"),"__testvalue__"===n.get(e)}catch(n){return!1}}())try{this.weakmap=new WeakMap}catch(n){}this.keys=[],this.values=[]}var e=n.prototype;return e._cleanupClosedWindows=function(){for(var n=this.weakmap,e=this.keys,r=0;r<e.length;r++){var t=e[r];if(P(t)&&b(t)){if(n)try{n.delete(t)}catch(n){}e.splice(r,1),this.values.splice(r,1),r-=1}}},e.isSafeToReadWrite=function(n){if(P(n))return!1;try{n&&n.self,n&&n[this.name]}catch(n){return!1}return!0},e.set=function(n,e){if(!n)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.set(n,e)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var t=this.name,o=n[t];o&&o[0]===n?o[1]=e:G(n,t,{value:[n,e],writable:!0})}else{this._cleanupClosedWindows();var i=this.keys,a=this.values,u=H(i,n);-1===u?(i.push(n),a.push(e)):a[u]=e}},e.get=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(n))return e.get(n)}catch(n){delete this.weakmap}if(!this.isSafeToReadWrite(n)){this._cleanupClosedWindows();var r=H(this.keys,n);if(-1===r)return;return this.values[r]}var t=n[this.name];if(t&&t[0]===n)return t[1]},e.delete=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{e.delete(n)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var r=n[this.name];r&&r[0]===n&&(r[0]=r[1]=void 0)}else{this._cleanupClosedWindows();var t=this.keys,o=H(t,n);-1!==o&&(t.splice(o,1),this.values.splice(o,1))}},e.has=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(n))return!0}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var r=n[this.name];return!(!r||r[0]!==n)}return this._cleanupClosedWindows(),-1!==H(this.keys,n)},e.getOrSet=function(n,e){if(this.has(n))return this.get(n);var r=e();return this.set(n,r),r},n}();function X(){var n="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,function(){return n.charAt(Math.floor(Math.random()*n.length))})+"_"+function(n){if("function"==typeof btoa)return btoa(n);if("undefined"!=typeof Buffer)return Buffer.from(n,"utf8").toString("base64");throw new Error("Can not find window.btoa or Buffer")}((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function Y(){}function Z(n){return"[object RegExp]"===Object.prototype.toString.call(n)}function Q(n,e,r){if(n.hasOwnProperty(e))return n[e];var t=r();return n[e]=t,t}Object.create(Error.prototype);var V=5e3,$=2e3,nn=1e4,en=-1,rn={REQUEST:"postrobot_message_request",RESPONSE:"postrobot_message_response",ACK:"postrobot_message_ack"},tn={METHOD:"postrobot_method",HELLO:"postrobot_hello",OPEN_TUNNEL:"postrobot_open_tunnel"},on="__postrobot_bridge__",an="*",un={CROSS_DOMAIN_ZALGO_PROMISE:"cross_domain_zalgo_promise",CROSS_DOMAIN_FUNCTION:"cross_domain_function",CROSS_DOMAIN_WINDOW:"cross_domain_window"};function sn(n){return void 0===n&&(n=window),n!==window?n.__post_robot_10_0_1__:n.__post_robot_10_0_1__=n.__post_robot_10_0_1__||{}}var cn=function(){return{}};function fn(n,e){return void 0===n&&(n="store"),void 0===e&&(e=cn),Q(sn(),n,function(){var n=e();return{has:function(e){return n.hasOwnProperty(e)},get:function(e,r){return n.hasOwnProperty(e)?n[e]:r},set:function(e,r){return n[e]=r,r},del:function(e){delete n[e]},getOrSet:function(e,r){return Q(n,e,r)},reset:function(){n=e()},keys:function(){return Object.keys(n)}}})}var dn=function(){};function wn(){var n=sn();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new dn,n.WINDOW_WILDCARD}function ln(n,e){return void 0===n&&(n="store"),void 0===e&&(e=cn),fn("windowStore").getOrSet(n,function(){var r=new K,t=function(n){return r.getOrSet(n,e)};return{has:function(e){return t(e).hasOwnProperty(n)},get:function(e,r){var o=t(e);return o.hasOwnProperty(n)?o[n]:r},set:function(e,r){return t(e)[n]=r,r},del:function(e){delete t(e)[n]},getOrSet:function(e,r){return Q(t(e),n,r)}}})}function hn(){return fn("instance").getOrSet("instanceID",X)}function mn(n){return ln("helloPromises").getOrSet(n,function(){return new F})}function vn(n,e){return(0,e.send)(n,tn.HELLO,{instanceID:hn()},{domain:an,timeout:-1}).then(function(e){var r=e.origin,t=e.data.instanceID;return mn(n).resolve({win:n,domain:r}),{win:n,domain:r,instanceID:t}})}function pn(n,e){var r=e.send;return ln("windowInstanceIDPromises").getOrSet(n,function(){return vn(n,{send:r}).then(function(n){return n.instanceID})})}function gn(n,e,r){void 0===e&&(e=5e3),void 0===r&&(r="Window");var t=mn(n);return-1!==e&&(t=t.timeout(e,new Error(r+" did not load after "+e+"ms"))),t}function yn(n){ln("knownWindows").set(n,!0)}var En,_n={FUNCTION:"function",ERROR:"error",PROMISE:"promise",REGEX:"regex",DATE:"date",ARRAY:"array",OBJECT:"object",STRING:"string",NUMBER:"number",BOOLEAN:"boolean",NULL:"null",UNDEFINED:"undefined"};function On(n){return"object"==typeof n&&null!==n&&"string"==typeof n.__type__}function bn(n){return void 0===n?_n.UNDEFINED:null===n?_n.NULL:Array.isArray(n)?_n.ARRAY:"function"==typeof n?_n.FUNCTION:"object"==typeof n?n instanceof Error?_n.ERROR:"function"==typeof n.then?_n.PROMISE:"[object RegExp]"===Object.prototype.toString.call(n)?_n.REGEX:"[object Date]"===Object.prototype.toString.call(n)?_n.DATE:_n.OBJECT:"string"==typeof n?_n.STRING:"number"==typeof n?_n.NUMBER:"boolean"==typeof n?_n.BOOLEAN:void 0}function Wn(n,e){return{__type__:n,__val__:e}}var Sn,Rn=((En={})[_n.FUNCTION]=function(){},En[_n.ERROR]=function(n){var e=n.message,r=n.stack,t=n.code;return Wn(_n.ERROR,{message:e,stack:r,code:t})},En[_n.PROMISE]=function(){},En[_n.REGEX]=function(n){return Wn(_n.REGEX,n.source)},En[_n.DATE]=function(n){return Wn(_n.DATE,n.toJSON())},En[_n.ARRAY]=function(n){return n},En[_n.OBJECT]=function(n){return n},En[_n.STRING]=function(n){return n},En[_n.NUMBER]=function(n){return n},En[_n.BOOLEAN]=function(n){return n},En[_n.NULL]=function(n){return n},En),An={},Nn=((Sn={})[_n.FUNCTION]=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},Sn[_n.ERROR]=function(n){var e=n.message,r=n.stack,t=n.code,o=new Error(e);return o.code=t,o.stack=r+"\n\n"+o.stack,o},Sn[_n.PROMISE]=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},Sn[_n.REGEX]=function(n){return new RegExp(n)},Sn[_n.DATE]=function(n){return new Date(n)},Sn[_n.ARRAY]=function(n){return n},Sn[_n.OBJECT]=function(n){return n},Sn[_n.STRING]=function(n){return n},Sn[_n.NUMBER]=function(n){return n},Sn[_n.BOOLEAN]=function(n){return n},Sn[_n.NULL]=function(n){return n},Sn),xn={};function Mn(){return!!W(window).match(/MSIE|trident|edge\/12|edge\/13/i)}function jn(n){return!x(window,n)}function Pn(n,e){if(n){if(l()!==j(n))return!0}else if(e&&!m(e))return!0;return!1}function In(n){var e=n.win,r=n.domain;return!(!Mn()||r&&!Pn(r,e)||e&&!jn(e))}function kn(n){var e=(n=n||j(n)).replace(/[^a-zA-Z0-9]+/g,"_");return on+"_"+e}function Tn(){return Boolean(window.name&&window.name===kn(l()))}var Dn=new F(function(n){if(window.document&&window.document.body)return n(window.document.body);var e=setInterval(function(){if(window.document&&window.document.body)return clearInterval(e),n(window.document.body)},10)});function Cn(n){ln("remoteWindowPromises").getOrSet(n,function(){return new F})}function Ln(n){var e=ln("remoteWindowPromises").get(n);if(!e)throw new Error("Remote window promise not found");return e}function Bn(n,e,r){Ln(n).resolve(function(t,o,i){if(t!==n)throw new Error("Remote window does not match window");if(!M(o,e))throw new Error("Remote domain "+o+" does not match domain "+e);r.fireAndForget(i)})}function zn(n,e){Ln(n).reject(e).catch(Y)}function Fn(n){for(var e=n.win,r=n.name,t=n.domain,o=fn("popupWindowsByName"),i=ln("popupWindowsByWin"),a=0,u=o.keys();a<u.length;a++){var s=u[a];b(o.get(s).win)&&o.del(s)}var c=i.getOrSet(e,function(){return r?o.getOrSet(r,function(){return{win:e,name:r}}):{win:e}});if(c.win&&c.win!==e)throw new Error("Different window already linked for window: "+(r||"undefined"));if(r){if(c.name&&c.name!==r)throw new Error("Different window already linked for name "+r+": "+c.name);c.name=r,o.set(r,c)}return t&&(c.domain=t,Cn(e)),i.set(e,c),c}function Un(n){var e,r=n.on,t=n.send,o=n.receiveMessage;e=window.open,window.open=function(n,r,t,o){var a=e.call(this,function(n){if(0!==j(n).indexOf(i.MOCK))return n;throw new Error("Mock urls not supported out of test mode")}(n),r,t,o);return a?(Fn({win:a,name:r,domain:n?j(n):null}),a):a},function(n){var e=n.on,r=n.send,t=n.receiveMessage,o=fn("popupWindowsByName");e(tn.OPEN_TUNNEL,function(n){var i=n.source,a=n.origin,u=n.data,s=fn("bridges").get(a);if(!s)throw new Error("Can not find bridge promise for domain "+a);return s.then(function(n){if(i!==n)throw new Error("Message source does not matched registered bridge for domain "+a);if(!u.name)throw new Error("Register window expected to be passed window name");if(!u.sendMessage)throw new Error("Register window expected to be passed sendMessage method");if(!o.has(u.name))throw new Error("Window with name "+u.name+" does not exist, or was not opened by this window");if(!o.get(u.name).domain)throw new Error("We do not have a registered domain for window "+u.name);if(o.get(u.name).domain!==a)throw new Error("Message origin "+a+" does not matched registered window origin "+o.get(u.name).domain);return Bn(o.get(u.name).win,a,u.sendMessage),{sendMessage:function(n){if(window&&!window.closed){var i=o.get(u.name);if(i)try{t({data:n,origin:i.domain,source:i.win},{on:e,send:r})}catch(n){F.reject(n)}}}}})})}({on:r,send:t,receiveMessage:o}),function(n){var e=n.send;sn(window).openTunnelToParent=function(n){var r=n.name,t=n.source,o=n.canary,i=n.sendMessage,a=fn("tunnelWindows"),u=c(window);if(!u)throw new Error("No parent window found to open tunnel to");var s=function(n){var e=n.name,r=n.source,t=n.canary,o=n.sendMessage;!function(){for(var n=fn("tunnelWindows"),e=0,r=n.keys();e<r.length;e++){var t=r[e],o=n[t];try{o.source}catch(e){n.del(t);continue}b(o.source)&&n.del(t)}}();var i=X();return fn("tunnelWindows").set(i,{name:e,source:r,canary:t,sendMessage:o}),i}({name:r,source:t,canary:o,sendMessage:i});return e(u,tn.OPEN_TUNNEL,{name:r,sendMessage:function(){var n=a.get(s);try{n&&n.source}catch(n){return void a.del(s)}if(n&&n.source&&!b(n.source)){try{n.canary()}catch(n){return}n.sendMessage.apply(this,arguments)}}},{domain:an})}}({on:r,send:t}),function(n){var e=n.on,r=n.send,t=n.receiveMessage;F.try(function(){var n,o=f(window);if(o&&In({win:o}))return Cn(o),(n=o,ln("remoteBridgeAwaiters").getOrSet(n,function(){return F.try(function(){var e=S(n,kn(l()));if(!e)throw new Error("Bridge not found for domain: "+l());return m(e)&&sn(e)?e:new F(function(n,r){var t,o;t=setInterval(function(){if(e&&m(e)&&sn(e))return clearInterval(t),clearTimeout(o),n(e)},100),o=setTimeout(function(){return clearInterval(t),r(new Error("Bridge not found for domain: "+l()))},2e3)})})})).then(function(n){return window.name?sn(n).openTunnelToParent({name:window.name,source:window,canary:function(){},sendMessage:function(n){if(window&&!window.closed)try{t({data:n,origin:this.origin,source:this.source},{on:e,send:r})}catch(n){F.reject(n)}}}).then(function(n){var e=n.source,r=n.origin,t=n.data;if(e!==o)throw new Error("Source does not match opener");Bn(e,r,t.sendMessage)}).catch(function(n){throw zn(o,n),n}):zn(o,new Error("Can not register with opener: window does not have a name"))})})}({on:r,send:t,receiveMessage:o})}function Hn(){for(var n=fn("idToProxyWindow"),e=0,r=n.keys();e<r.length;e++){var t=r[e];n.get(t).shouldClean()&&n.del(t)}}var qn=function(){function n(n,e,r){var t=r.send;this.isProxyWindow=!0,this.serializedWindow=void 0,this.actualWindow=void 0,this.actualWindowPromise=void 0,this.send=void 0,this.serializedWindow=n,this.actualWindowPromise=new F,e&&this.setWindow(e),this.serializedWindow.getInstanceID=function(n){var e={};function r(){for(var r=arguments.length,t=new Array(r),o=0;o<r;o++)t[o]=arguments[o];var i=function(n){try{return JSON.stringify(Array.prototype.slice.call(n),function(n,e){return"function"==typeof e?"memoize["+function(n){if(q=q||new K,null==n||"object"!=typeof n&&"function"!=typeof n)throw new Error("Invalid object");var e=q.get(n);return e||(e=typeof n+":"+X(),q.set(n,e)),e}(e)+"]":e})}catch(n){throw new Error("Arguments not serializable -- can not be used to memoize")}}(t);return e.hasOwnProperty(i)?e[i]:(e[i]=n.apply(this,arguments).finally(function(){delete e[i]}),e[i])}return r.reset=function(){e={}},r}(this.serializedWindow.getInstanceID),this.send=t}var e=n.prototype;return e.getType=function(){return this.serializedWindow.type},e.isPopup=function(){return"popup"===this.getType()},e.isIframe=function(){return"iframe"===this.getType()},e.setLocation=function(n){var e=this;return F.try(function(){if(!e.actualWindow)return e.serializedWindow.setLocation(n);e.actualWindow.location=n}).then(function(){return e})},e.setName=function(n){var e=this;return F.try(function(){if(!e.actualWindow)return e.serializedWindow.setName(n);if(!m(e.actualWindow))throw new Error("Can not set name for window on different domain");e.actualWindow.name=n,e.actualWindow.frameElement&&e.actualWindow.frameElement.setAttribute("name",n),Fn({win:e.actualWindow,name:n})}).then(function(){return e})},e.close=function(){var n=this;return F.try(function(){if(!n.actualWindow)return n.serializedWindow.close();n.actualWindow.close()}).then(function(){return n})},e.focus=function(){var n=this;return F.try(function(){return n.actualWindow&&n.actualWindow.focus(),n.serializedWindow.focus()}).then(function(){return n})},e.isClosed=function(){var n=this;return F.try(function(){return n.actualWindow?b(n.actualWindow):n.serializedWindow.isClosed()})},e.getWindow=function(){return this.actualWindow},e.setWindow=function(n){this.actualWindow=n,this.actualWindowPromise.resolve(n)},e.awaitWindow=function(){return this.actualWindowPromise},e.matchWindow=function(n){var e=this;return F.try(function(){return e.actualWindow?n===e.actualWindow:F.all([e.getInstanceID(),pn(n,{send:e.send})]).then(function(r){var t=r[0]===r[1];return t&&e.setWindow(n),t})})},e.unwrap=function(){return this.actualWindow||this},e.getInstanceID=function(){return this.actualWindow?pn(this.actualWindow,{send:this.send}):this.serializedWindow.getInstanceID()},e.serialize=function(){return this.serializedWindow},e.shouldClean=function(){return this.actualWindow&&b(this.actualWindow)},n.unwrap=function(e){return n.isProxyWindow(e)?e.unwrap():e},n.serialize=function(e,r){var t=r.send;return Hn(),n.toProxyWindow(e,{send:t}).serialize()},n.deserialize=function(e,r){var t=r.on,o=r.send;return Hn(),fn("idToProxyWindow").getOrSet(e.id,function(){return new n(e,null,{on:t,send:o})})},n.isProxyWindow=function(n){return Boolean(n&&!P(n)&&n.isProxyWindow)},n.toProxyWindow=function(e,r){var t=r.send;return Hn(),n.isProxyWindow(e)?e:ln("winToProxyWindow").getOrSet(e,function(){var r=X();return fn("idToProxyWindow").set(r,new n({id:r,type:f(e)?"popup":"iframe",getInstanceID:function(){return pn(e,{send:t})},close:function(){return F.try(function(){e.close()})},focus:function(){return F.try(function(){e.focus()})},isClosed:function(){return F.try(function(){return b(e)})},setLocation:function(n){return F.try(function(){if(m(e))try{if(e.location&&"function"==typeof e.location.replace)return void e.location.replace(n)}catch(n){}e.location=n})},setName:function(n){return F.try(function(){Fn({win:e,name:n}),e.name=n})}},e,{send:t}))})},n}();function Gn(n,e,r,t,o){var i=ln("methodStore"),a=fn("proxyWindowMethods");qn.isProxyWindow(t)?a.set(n,{val:e,name:r,domain:o,source:t}):(a.del(n),i.getOrSet(t,function(){return{}})[n]={domain:o,name:r,val:e,source:t})}function Jn(n,e){var r=ln("methodStore"),t=fn("proxyWindowMethods");return r.getOrSet(n,function(){return{}})[e]||t.get(e)}function Kn(n,e,r,t,o){!function(n){var e=o.on;fn("builtinListeners").getOrSet("functionCalls",function(){return e(tn.METHOD,{domain:an},function(n){var e=n.source,r=n.origin,t=n.data,o=t.id,i=t.name,a=Jn(e,o);if(!a)throw new Error("Could not find method '"+t.name+"' with id: "+t.id+" in "+l(window));var u=a.source,s=a.domain,c=a.val;return F.try(function(){if(!M(s,r))throw new Error("Method '"+t.name+"' domain "+JSON.stringify(Z(a.domain)?a.domain.source:a.domain)+" does not match origin "+r+" in "+l(window));if(qn.isProxyWindow(u))return u.matchWindow(e).then(function(n){if(!n)throw new Error("Method call '"+t.name+"' failed - proxy window does not match source in "+l(window))})}).then(function(){return c.apply({source:e,origin:r},t.args)},function(n){return F.try(function(){if(c.onError)return c.onError(n)}).then(function(){throw n})}).then(function(n){return{result:n,id:o,name:i}})})})}();var i=r.__id__||X();n=qn.unwrap(n);var a=r.__name__||r.name||t;return qn.isProxyWindow(n)?(Gn(i,r,a,n,e),n.awaitWindow().then(function(n){Gn(i,r,a,n,e)})):Gn(i,r,a,n,e),Wn(un.CROSS_DOMAIN_FUNCTION,{id:i,name:a})}function Xn(n,e,r,t){var o,i=t.on,a=t.send;return function(n,e){void 0===e&&(e=An);var r=JSON.stringify(n,function(n){var r=this[n];if(On(this))return r;var t=bn(r);if(!t)return r;var o=e[t]||Rn[t];return o?o(r,n):r});return void 0===r?_n.UNDEFINED:r}(r,((o={})[_n.PROMISE]=function(r,t){return function(n,e,r,t,o){var i=o.on,a=o.send;return Wn(un.CROSS_DOMAIN_ZALGO_PROMISE,{then:Kn(n,e,function(n,e){return r.then(n,e)},t,{on:i,send:a})})}(n,e,r,t,{on:i,send:a})},o[_n.FUNCTION]=function(r,t){return Kn(n,e,r,t,{on:i,send:a})},o[_n.OBJECT]=function(n){return P(n)||qn.isProxyWindow(n)?function(n,e,r,t){var o=t.send;return Wn(un.CROSS_DOMAIN_WINDOW,qn.serialize(r,{send:o}))}(0,0,n,{on:i,send:a}):n},o))}function Yn(n,e,r,t){var o,i=t.on,a=t.send;return function(n,e){if(void 0===e&&(e=xn),n!==_n.UNDEFINED)return JSON.parse(n,function(n,r){if(On(this))return r;var t,o;if(On(r)?(t=r.__type__,o=r.__val__):(t=bn(r),o=r),!t)return o;var i=e[t]||Nn[t];return i?i(o,n):o})}(r,((o={})[un.CROSS_DOMAIN_ZALGO_PROMISE]=function(n){return e=n.then,new F(e);var e},o[un.CROSS_DOMAIN_FUNCTION]=function(r){return function(n,e,r,t){var o=r.id,i=r.name,a=t.send,u=function(r){function t(){var u=arguments;return qn.toProxyWindow(n,{send:a}).awaitWindow().then(function(n){var s=Jn(n,o);return s&&s.val!==t?s.val.apply({source:window,origin:l()},u):a(n,tn.METHOD,{id:o,name:i,args:Array.prototype.slice.call(u)},{domain:e,fireAndForget:r.fireAndForget}).then(function(n){if(!r.fireAndForget)return n.data.result})}).catch(function(n){throw n})}return void 0===r&&(r={}),t.__name__=i,t.__origin__=e,t.__source__=n,t.__id__=o,t.origin=e,t},s=u();return s.fireAndForget=u({fireAndForget:!0}),s}(n,e,r,{on:i,send:a})},o[un.CROSS_DOMAIN_WINDOW]=function(n){return function(n,e,r,t){var o=t.on,i=t.send;return qn.deserialize(r,{on:o,send:i})}(0,0,n,{on:i,send:a})},o))}var Zn={};function Qn(n,e,r,t){var o,i=t.on,a=t.send;if(b(n))throw new Error("Window is closed");for(var u,s=Xn(n,e,((o={}).__post_robot_10_0_1__=U({id:X()},r),o),{on:i,send:a}),c=!1,f=0,d=Object.keys(Zn);f<d.length;f++){var w=d[f];try{Zn[w](n,s,e),c=!0}catch(n){u=u||n}}if(!c)throw u}Zn.postrobot_post_message=function(n,e,r){(Array.isArray(r)?r:"string"==typeof r?[r]:[an]).map(function(e){if(0===e.indexOf(i.MOCK)){if(window.location.protocol===i.FILE)return an;if(!h(n))throw new Error("Attempting to send messsage to mock domain "+e+", but window is actually cross-domain");return w(n)}return 0===e.indexOf(i.FILE)?an:e}).forEach(function(r){n.postMessage(e,r)})},Zn.postrobot_bridge=function(n,e,r){if(Mn()||Tn()){if(m(n))throw new Error("Post message through bridge disabled between same domain windows");if(!1!==x(window,n))throw new Error("Can only use bridge to communicate between two different windows, not between frames");!function(n,e,r){var t=R(window,n),o=R(n,window);if(!t&&!o)throw new Error("Can only send messages to and from parent and popup windows");Ln(n).then(function(t){return t(n,e,r)})}(n,r,e)}},Zn.postrobot_global=function(n,e){if(W(window).match(/MSIE|rv:11|trident|edge\/12|edge\/13/i)){if(!m(n))throw new Error("Post message through global disabled between different domain windows");if(!1!==x(window,n))throw new Error("Can only use global to communicate between two different windows, not between frames");var r=sn(n);if(!r)throw new Error("Can not find postRobot global on foreign window");r.receiveMessage({source:window,origin:l(),data:e})}};var Vn,$n="__domain_regex__";function ne(n){return fn("responseListeners").get(n)}function ee(n){fn("responseListeners").del(n)}function re(n){return fn("erroredResponseListeners").has(n)}function te(n){var e=n.name,r=n.win,t=n.domain,o=ln("requestListeners");if(r===an&&(r=null),t===an&&(t=null),!e)throw new Error("Name required to get request listener");for(var i=0,a=[r,wn()];i<a.length;i++){var u=a[i];if(u){var s=o.get(u);if(s){var c=s[e];if(c){if(t&&"string"==typeof t){if(c[t])return c[t];if(c[$n])for(var f=0,d=c[$n];f<d.length;f++){var w=d[f],l=w.regex,h=w.listener;if(M(l,t))return h}}if(c[an])return c[an]}}}}}var oe,ie=((Vn={})[rn.REQUEST]=function(n,e,r,t){var o=t.on,i=t.send,a=te({name:r.name,win:n,domain:e});function u(t,a,u){void 0===u&&(u={}),r.fireAndForget||b(n)||Qn(n,e,U({type:t,ack:a,hash:r.hash,name:r.name},u),{on:o,send:i})}return r.name===tn.METHOD&&r.data&&"string"==typeof r.data.name?r.data.name:r.name,F.all([u(rn.ACK),F.try(function(){if(!a)throw new Error("No handler found for post message: "+r.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!M(a.domain,e))throw new Error("Request origin "+e+" does not match domain "+a.domain.toString());var t=r.data;return a.handler({source:n,origin:e,data:t})}).then(function(n){return u(rn.RESPONSE,"success",{data:n})},function(n){return u(rn.RESPONSE,"error",{error:n})})]).then(Y).catch(function(n){if(a&&a.handleError)return a.handleError(n);throw n})},Vn[rn.ACK]=function(n,e,r){if(!re(r.hash)){var t=ne(r.hash);if(!t)throw new Error("No handler found for post message ack for message: "+r.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!M(t.domain,e))throw new Error("Ack origin "+e+" does not match domain "+t.domain.toString());if(n!==t.win)throw new Error("Ack source does not match registered window");t.ack=!0}},Vn[rn.RESPONSE]=function(n,e,r){if(!re(r.hash)){var t,i=ne(r.hash);if(!i)throw new Error("No handler found for post message response for message: "+r.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!M(i.domain,e))throw new Error("Response origin "+e+" does not match domain "+(t=i.domain,Array.isArray(t)?"("+t.join(" | ")+")":o(t)?"RegExp("+t.toString():t.toString()));if(n!==i.win)throw new Error("Response source does not match registered window");ee(r.hash),r.name===tn.METHOD&&r.data&&"string"==typeof r.data.name?r.data.name:r.name,"error"===r.ack?i.promise.reject(r.error):"success"===r.ack&&i.promise.resolve({source:n,origin:e,data:r.data})}},Vn);function ae(n,e){var r=e.on,t=e.send,o=fn("receivedMessages");if(!window||window.closed)throw new Error("Message recieved in closed window");try{if(!n.source)return}catch(n){return}var i=n.source,a=n.origin,u=function(n,e,r,t){var o,i=t.on,a=t.send;try{o=Yn(e,r,n,{on:i,send:a})}catch(n){return}if(o&&"object"==typeof o&&null!==o&&(o=o.__post_robot_10_0_1__)&&"object"==typeof o&&null!==o&&o.type&&"string"==typeof o.type&&ie[o.type])return o}(n.data,i,a,{on:r,send:t});u&&(yn(i),o.has(u.id)||(o.set(u.id,!0),b(i)&&!u.fireAndForget||ie[u.type](i,a,u,{on:r,send:t})))}function ue(n,e,r){if(!n)throw new Error("Expected name");if("function"==typeof e&&(r=e,e={}),!r)throw new Error("Expected handler");(e=e||{}).name=n,e.handler=r||e.handler;var t=e.window,o=e.domain,i=function n(e,r){var t=e.name,o=e.win,i=e.domain,a=ln("requestListeners");if(!t||"string"!=typeof t)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var u=[],s=0,c=o;s<c.length;s++){var f=c[s];u.push(n({name:t,domain:i,win:f},r))}return{cancel:function(){for(var n=0;n<u.length;n++)u[n].cancel()}}}if(Array.isArray(i)){for(var d=[],w=0,l=i;w<l.length;w++){var h=l[w];d.push(n({name:t,win:o,domain:h},r))}return{cancel:function(){for(var n=0;n<d.length;n++)d[n].cancel()}}}var m=te({name:t,win:o,domain:i});if(o&&o!==an||(o=wn()),i=i||an,m)throw o&&i?new Error("Request listener already exists for "+t+" on domain "+i.toString()+" for "+(o===wn()?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+t+" for "+(o===wn()?"wildcard":"specified")+" window"):i?new Error("Request listener already exists for "+t+" on domain "+i.toString()):new Error("Request listener already exists for "+t);var v,p,g=a.getOrSet(o,function(){return{}}),y=Q(g,t,function(){return{}}),E=i.toString();return Z(i)?(v=Q(y,$n,function(){return[]}),p={regex:i,listener:r},v.push(p)):y[E]=r,{cancel:function(){delete y[E],p&&(v.splice(v.indexOf(p,1)),v.length||delete y[$n]),Object.keys(y).length||delete g[t],o&&!Object.keys(g).length&&a.del(o)}}}({name:n,win:t,domain:o},{handler:e.handler,handleError:e.errorHandler||function(n){throw n},window:t,domain:o||an,name:n});return{cancel:function(){i.cancel()}}}function se(n,e,r){"function"==typeof(e=e||{})&&(r=e,e={});var t,o=new F;return e.errorHandler=function(n){t.cancel(),o.reject(n)},t=ue(n,e,function(n){if(t.cancel(),o.resolve(n),r)return r(n)}),o.cancel=t.cancel,o}function ce(n,e,r,t){var o=(t=t||{}).domain||an,i=t.timeout||en,a=t.timeout||V,u=t.fireAndForget||!1;return F.try(function(){if(!e)throw new Error("Expected name");if(o&&"string"!=typeof o&&!Array.isArray(o)&&!Z(o))throw new TypeError("Expected domain to be a string, array, or regex");if(b(n))throw new Error("Target window is closed");var t=ln("requestPromises").getOrSet(n,function(){return[]}),s=F.try(function(){return function(n,e){var r=A(e);if(r)return r===n;if(e===n)return!1;if(y(e)===e)return!1;for(var t=0,o=p(n);t<o.length;t++)if(o[t]===e)return!0;return!1}(window,n)?gn(n,a):Z(o)?vn(n,{send:ce}):void 0}).then(function(a){var c=(void 0===a?{}:a).domain;if(Z(o)){if(!M(o,c))throw new Error("Remote window domain "+c+" does not match regex: "+o.source);o=c}e===tn.METHOD&&r&&"string"==typeof r.name&&r.name;var f=!1,d=new F;d.finally(function(){f=!0,t.splice(t.indexOf(s,1))}).catch(Y);var w=e+"_"+X();if(Qn(n,o,{type:rn.REQUEST,hash:w,name:e,data:r,fireAndForget:u},{on:ue,send:ce}),u)return d.resolve();d.catch(function(){!function(n){fn("erroredResponseListeners").set(n,!0)}(w),ee(w)});var h={name:e,win:n,domain:o,promise:d};!function(n,e){fn("responseListeners").set(n,e)}(w,h);var m=function(n){return ln("knownWindows").get(n,!1)}(n)?nn:$,v=i,p=m,g=v,y=100;return setTimeout(function r(){if(!f){if(b(n))return h.ack?d.reject(new Error("Window closed for "+e+" before response")):d.reject(new Error("Window closed for "+e+" before ack"));if(p=Math.max(p-y,0),-1!==g&&(g=Math.max(g-y,0)),h.ack){if(-1===g)return;y=Math.min(g,2e3)}else{if(0===p)return d.reject(new Error("No ack for postMessage "+e+" in "+l()+" in "+m+"ms"));if(0===g)return d.reject(new Error("No response for postMessage "+e+" in "+l()+" in "+v+"ms"))}setTimeout(r,y)}},y),d});return t.push(s),s})}function fe(n,e,r){return Xn(n,e,r,{on:ue,send:ce})}function de(n,e,r){return Yn(n,e,r,{on:ue,send:ce})}function we(n){return qn.toProxyWindow(n,{send:ce})}function le(){var n,e,r,t;sn().initialized||(sn().initialized=!0,function(n){var e=n.on,r=n.send;fn().getOrSet("postMessageListeners",function(){return n=window,t=function(n){!function(n,e){var r=e.on,t=e.send;try{n.source}catch(n){return}var o={source:n.source||n.sourceElement,origin:n.origin||n.originalEvent&&n.originalEvent.origin,data:n.data};if(o.source){if(!o.origin)throw new Error("Post message did not have origin domain");ae(o,{on:r,send:t})}}(n,{on:e,send:r})},n.addEventListener("message",t),{cancel:function(){n.removeEventListener("message",t)}};var n,t})}({on:ue,send:ce}),Un({on:ue,send:ce,receiveMessage:ae}),function(n){var e=n.on,r=n.send;fn("builtinListeners").getOrSet("helloListener",function(){var n=e(tn.HELLO,{domain:an},function(n){var e=n.source,r=n.origin;return mn(e).resolve({win:e,domain:r}),{instanceID:hn()}}),t=A();return t&&vn(t,{send:r}).catch(Y),n})}({on:ue,send:ce}),e=(n={on:ue,send:ce}).on,r=n.send,(t=sn()).receiveMessage=t.receiveMessage||function(n){return ae(n,{on:e,send:r})})}function he(n){for(var e=0,r=ln("requestPromises").get(n,[]);e<r.length;e++)r[e].reject(new Error("Window cleaned up before response")).catch(Y)}r.d(e,"bridge",function(){return oe}),r.d(e,"Promise",function(){return F}),r.d(e,"TYPES",function(){return!0}),r.d(e,"ProxyWindow",function(){return qn}),r.d(e,"setup",function(){return le}),r.d(e,"serializeMessage",function(){return fe}),r.d(e,"deserializeMessage",function(){return de}),r.d(e,"toProxyWindow",function(){return we}),r.d(e,"on",function(){return ue}),r.d(e,"once",function(){return se}),r.d(e,"send",function(){return ce}),r.d(e,"markWindowKnown",function(){return yn}),r.d(e,"cleanUpWindow",function(){return he}),oe={setupBridge:Un,openBridge:function(n,e){var r=fn("bridges"),t=fn("bridgeFrames");return e=e||j(n),r.getOrSet(e,function(){return F.try(function(){if(l()===e)throw new Error("Can not open bridge on the same domain as current domain: "+e);var r=kn(e);if(S(window,r))throw new Error("Frame with name "+r+" already exists on page");var o=function(n,e){var r=document.createElement("iframe");return r.setAttribute("name",n),r.setAttribute("id",n),r.setAttribute("style","display: none; margin: 0; padding: 0; border: 0px none; overflow: hidden;"),r.setAttribute("frameborder","0"),r.setAttribute("border","0"),r.setAttribute("scrolling","no"),r.setAttribute("allowTransparency","true"),r.setAttribute("tabindex","-1"),r.setAttribute("hidden","true"),r.setAttribute("title",""),r.setAttribute("role","presentation"),r.src=e,r}(r,n);return t.set(e,o),Dn.then(function(e){e.appendChild(o);var r=o.contentWindow;return new F(function(n,e){o.addEventListener("load",n),o.addEventListener("error",e)}).then(function(){return gn(r,5e3,"Bridge "+n)}).then(function(){return r})})})})},linkWindow:Fn,linkUrl:function(n,e){Fn({win:n,domain:j(e)})},isBridge:Tn,needsBridge:In,needsBridgeForBrowser:Mn,hasBridge:function(n,e){return fn("bridges").has(e||j(n))},needsBridgeForWin:jn,needsBridgeForDomain:Pn,destroyBridges:function(){for(var n=fn("bridges"),e=fn("bridgeFrames"),r=0,t=e.keys();r<t.length;r++){var o=t[r],i=e.get(o);i&&i.parentNode&&i.parentNode.removeChild(i)}e.reset(),n.reset()}},le()}])});
//# sourceMappingURL=post-robot.ie.min.js.map

@@ -1,2 +0,2 @@

!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("postRobot",[],e):"object"==typeof exports?exports.postRobot=e():n.postRobot=e()}("undefined"!=typeof self?self:this,function(){return function(n){var e={};function r(t){if(e[t])return e[t].exports;var o=e[t]={i:t,l:!1,exports:{}};return n[t].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=n,r.c=e,r.d=function(n,e,t){r.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:t})},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,e){if(1&e&&(n=r(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var t=Object.create(null);if(r.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var o in n)r.d(t,o,function(e){return n[e]}.bind(null,o));return t},r.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(e,"a",e),e},r.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},r.p="",r(r.s=0)}([function(n,e,r){"use strict";r.r(e);var t={};function o(n){return"[object RegExp]"===Object.prototype.toString.call(n)}r.r(t),r.d(t,"WeakMap",function(){return L});var i={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},a="*",u="Call was rejected by callee.\r\n";function c(n){return void 0===n&&(n=window),n.location.protocol===i.ABOUT}function s(n){if(n)try{if(n.parent&&n.parent!==n)return n.parent}catch(n){}}function f(n){if(n&&!s(n))try{return n.opener}catch(n){}}function d(n){try{return n&&n.location&&n.location.href,!0}catch(n){}return!1}function l(n){var e=(n=n||window).location;if(!e)throw new Error("Can not read window location");var r=e.protocol;if(!r)throw new Error("Can not read window protocol");if(r===i.FILE)return i.FILE+"//";if(r===i.ABOUT){var t=s(n);return t&&d(t)?l(t):i.ABOUT+"//"}var o=e.host;if(!o)throw new Error("Can not read window host");return r+"//"+o}function h(n){var e=l(n=n||window);return e&&n.mockDomain&&0===n.mockDomain.indexOf(i.MOCK)?n.mockDomain:e}function w(n){try{if(n===window)return!0}catch(n){}try{var e=Object.getOwnPropertyDescriptor(n,"location");if(e&&!1===e.enumerable)return!1}catch(n){}try{if(c(n)&&d(n))return!0}catch(n){}try{if(l(n)===l(window))return!0}catch(n){}return!1}function p(n){if(!w(n))return!1;try{if(n===window)return!0;if(c(n)&&d(n))return!0;if(h(window)===h(n))return!0}catch(n){}return!1}function v(n,e){if(!n||!e)return!1;var r=s(e);return r?r===n:-1!==function(n){var e=[];try{for(;n.parent!==n;)e.push(n.parent),n=n.parent}catch(n){}return e}(e).indexOf(n)}function m(n){var e,r,t=[];try{e=n.frames}catch(r){e=n}try{r=e.length}catch(n){}if(0===r)return t;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=e[o]}catch(n){continue}t.push(i)}return t}for(var a=0;a<100;a++){var u=void 0;try{u=e[a]}catch(n){return t}if(!u)return t;t.push(u)}return t}var y=[],g=[];function E(n,e){void 0===e&&(e=!0);try{if(n===window)return!1}catch(n){return!0}try{if(!n)return!0}catch(n){return!0}try{if(n.closed)return!0}catch(n){return!n||n.message!==u}if(e&&p(n))try{if(n.mockclosed)return!0}catch(n){}try{if(!n.parent||!n.top)return!0}catch(n){}var r=function(n,e){for(var r=0;r<n.length;r++)try{if(n[r]===e)return r}catch(n){}return-1}(y,n);if(-1!==r){var t=g[r];if(t&&function(n){if(!n.contentWindow)return!0;if(!n.parentNode)return!0;var e=n.ownerDocument;return!(!e||!e.documentElement||e.documentElement.contains(n))}(t))return!0}return!1}function _(n){return f(n=n||window)||s(n)||void 0}function O(n,e){if("string"==typeof n){if("string"==typeof e)return n===a||e===n;if(o(e))return!1;if(Array.isArray(e))return!1}return o(n)?o(e)?n.toString()===e.toString():!Array.isArray(e)&&Boolean(e.match(n)):!!Array.isArray(n)&&(Array.isArray(e)?JSON.stringify(n)===JSON.stringify(e):!o(e)&&n.some(function(n){return O(n,e)}))}function W(n){try{if(n===window)return!0}catch(n){if(n&&n.message===u)return!0}try{if("[object Window]"===Object.prototype.toString.call(n))return!0}catch(n){if(n&&n.message===u)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(n){if(n&&n.message===u)return!0}try{if(n&&n.self===n)return!0}catch(n){if(n&&n.message===u)return!0}try{if(n&&n.parent===n)return!0}catch(n){if(n&&n.message===u)return!0}try{if(n&&n.top===n)return!0}catch(n){if(n&&n.message===u)return!0}try{n&&n.__cross_domain_utils_window_check__}catch(n){return!0}return!1}function S(n){try{if(!n)return!1;if("undefined"!=typeof Promise&&n instanceof Promise)return!0;if("undefined"!=typeof window&&window.Window&&n instanceof window.Window)return!1;if("undefined"!=typeof window&&window.constructor&&n instanceof window.constructor)return!1;var e={}.toString;if(e){var r=e.call(n);if("[object Window]"===r||"[object global]"===r||"[object DOMWindow]"===r)return!1}if("function"==typeof n.then)return!0}catch(n){return!1}return!1}var b,R=[],j=[],x=0;function N(){if(!x&&b){var n=b;b=null,n.resolve()}}function A(){x+=1}function I(){x-=1,N()}var P=function(){function n(n){var e=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],n){var r,t,o=!1,i=!1,a=!1;A();try{n(function(n){a?e.resolve(n):(o=!0,r=n)},function(n){a?e.reject(n):(i=!0,t=n)})}catch(n){return I(),void this.reject(n)}I(),a=!0,o?this.resolve(r):i&&this.reject(t)}}var e=n.prototype;return e.resolve=function(n){if(this.resolved||this.rejected)return this;if(S(n))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=n,this.dispatch(),this},e.reject=function(n){var e=this;if(this.resolved||this.rejected)return this;if(S(n))throw new Error("Can not reject promise with another promise");if(!n){var r=n&&"function"==typeof n.toString?n.toString():Object.prototype.toString.call(n);n=new Error("Expected reject to be called with Error, got "+r)}return this.rejected=!0,this.error=n,this.errorHandled||setTimeout(function(){e.errorHandled||function(n,e){if(-1===R.indexOf(n)){R.push(n),setTimeout(function(){throw n},1);for(var r=0;r<j.length;r++)j[r](n,e)}}(n,e)},1),this.dispatch(),this},e.asyncReject=function(n){return this.errorHandled=!0,this.reject(n),this},e.dispatch=function(){var e=this,r=this.dispatching,t=this.resolved,o=this.rejected,i=this.handlers;if(!r&&(t||o)){this.dispatching=!0,A();for(var a=function(r){var a=i[r],u=a.onSuccess,c=a.onError,s=a.promise,f=void 0;if(t)try{f=u?u(e.value):e.value}catch(n){return s.reject(n),"continue"}else if(o){if(!c)return s.reject(e.error),"continue";try{f=c(e.error)}catch(n){return s.reject(n),"continue"}}f instanceof n&&(f.resolved||f.rejected)?(f.resolved?s.resolve(f.value):s.reject(f.error),f.errorHandled=!0):S(f)?f instanceof n&&(f.resolved||f.rejected)?f.resolved?s.resolve(f.value):s.reject(f.error):f.then(function(n){s.resolve(n)},function(n){s.reject(n)}):s.resolve(f)},u=0;u<i.length;u++)a(u);i.length=0,this.dispatching=!1,I()}},e.then=function(e,r){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.then expected a function for success handler");if(r&&"function"!=typeof r&&!r.call)throw new Error("Promise.then expected a function for error handler");var t=new n;return this.handlers.push({promise:t,onSuccess:e,onError:r}),this.errorHandled=!0,this.dispatch(),t},e.catch=function(n){return this.then(void 0,n)},e.finally=function(e){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return n.try(e).then(function(){return r})},function(r){return n.try(e).then(function(){throw r})})},e.timeout=function(n,e){var r=this;if(this.resolved||this.rejected)return this;var t=setTimeout(function(){r.resolved||r.rejected||r.reject(e||new Error("Promise timed out after "+n+"ms"))},n);return this.then(function(n){return clearTimeout(t),n})},e.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},n.resolve=function(e){return e instanceof n?e:S(e)?new n(function(n,r){return e.then(n,r)}):(new n).resolve(e)},n.reject=function(e){return(new n).reject(e)},n.asyncReject=function(e){return(new n).asyncReject(e)},n.all=function(e){var r=new n,t=e.length,o=[];if(!t)return r.resolve(o),r;for(var i=function(i){var a=e[i];if(a instanceof n){if(a.resolved)return o[i]=a.value,t-=1,"continue"}else if(!S(a))return o[i]=a,t-=1,"continue";n.resolve(a).then(function(n){o[i]=n,0==(t-=1)&&r.resolve(o)},function(n){r.reject(n)})},a=0;a<e.length;a++)i(a);return 0===t&&r.resolve(o),r},n.hash=function(e){var r={};return n.all(Object.keys(e).map(function(t){return n.resolve(e[t]).then(function(n){r[t]=n})})).then(function(){return r})},n.map=function(e,r){return n.all(e.map(r))},n.onPossiblyUnhandledException=function(n){return function(n){return j.push(n),{cancel:function(){j.splice(j.indexOf(n),1)}}}(n)},n.try=function(e,r,t){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.try expected a function");var o;A();try{o=e.apply(r,t||[])}catch(e){return I(),n.reject(e)}return I(),n.resolve(o)},n.delay=function(e){return new n(function(n){setTimeout(n,e)})},n.isPromise=function(e){return!!(e&&e instanceof n)||S(e)},n.flush=function(){return e=b=b||new n,N(),e;var e},n}();function k(){return(k=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(n[t]=r[t])}return n}).apply(this,arguments)}function D(n,e){for(var r=0;r<n.length;r++)try{if(n[r]===e)return r}catch(n){}return-1}var M,T=Object.defineProperty,C=Date.now()%1e9,L=function(){function n(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,C+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+C,function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var n=new WeakMap,e={};return Object.freeze(e),n.set(e,"__testvalue__"),"__testvalue__"===n.get(e)}catch(n){return!1}}())try{this.weakmap=new WeakMap}catch(n){}this.keys=[],this.values=[]}var e=n.prototype;return e._cleanupClosedWindows=function(){for(var n=this.weakmap,e=this.keys,r=0;r<e.length;r++){var t=e[r];if(W(t)&&E(t)){if(n)try{n.delete(t)}catch(n){}e.splice(r,1),this.values.splice(r,1),r-=1}}},e.isSafeToReadWrite=function(n){if(W(n))return!1;try{n&&n.self,n&&n[this.name]}catch(n){return!1}return!0},e.set=function(n,e){if(!n)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.set(n,e)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var t=this.name,o=n[t];o&&o[0]===n?o[1]=e:T(n,t,{value:[n,e],writable:!0})}else{this._cleanupClosedWindows();var i=this.keys,a=this.values,u=D(i,n);-1===u?(i.push(n),a.push(e)):a[u]=e}},e.get=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(n))return e.get(n)}catch(n){delete this.weakmap}if(!this.isSafeToReadWrite(n)){this._cleanupClosedWindows();var r=D(this.keys,n);if(-1===r)return;return this.values[r]}var t=n[this.name];if(t&&t[0]===n)return t[1]},e.delete=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{e.delete(n)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var r=n[this.name];r&&r[0]===n&&(r[0]=r[1]=void 0)}else{this._cleanupClosedWindows();var t=this.keys,o=D(t,n);-1!==o&&(t.splice(o,1),this.values.splice(o,1))}},e.has=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(n))return!0}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var r=n[this.name];return!(!r||r[0]!==n)}return this._cleanupClosedWindows(),-1!==D(this.keys,n)},e.getOrSet=function(n,e){if(this.has(n))return this.get(n);var r=e();return this.set(n,r),r},n}();function z(){var n="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,function(){return n.charAt(Math.floor(Math.random()*n.length))})+"_"+function(n){if("function"==typeof btoa)return btoa(n);if("undefined"!=typeof Buffer)return Buffer.from(n,"utf8").toString("base64");throw new Error("Can not find window.btoa or Buffer")}((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function U(){}function F(n){return"[object RegExp]"===Object.prototype.toString.call(n)}function B(n,e,r){if(n.hasOwnProperty(e))return n[e];var t=r();return n[e]=t,t}Object.create(Error.prototype);var H=5e3,q=2e3,G=1e4,J=-1,K={REQUEST:"postrobot_message_request",RESPONSE:"postrobot_message_response",ACK:"postrobot_message_ack"},X={METHOD:"postrobot_method",HELLO:"postrobot_hello",OPEN_TUNNEL:"postrobot_open_tunnel"},Y="*",Z={CROSS_DOMAIN_ZALGO_PROMISE:"cross_domain_zalgo_promise",CROSS_DOMAIN_FUNCTION:"cross_domain_function",CROSS_DOMAIN_WINDOW:"cross_domain_window"};function Q(n){return void 0===n&&(n=window),n!==window?n.__post_robot_10_0_0__:n.__post_robot_10_0_0__=n.__post_robot_10_0_0__||{}}var V=function(){return{}};function $(n,e){return void 0===n&&(n="store"),void 0===e&&(e=V),B(Q(),n,function(){var n=e();return{has:function(e){return n.hasOwnProperty(e)},get:function(e,r){return n.hasOwnProperty(e)?n[e]:r},set:function(e,r){return n[e]=r,r},del:function(e){delete n[e]},getOrSet:function(e,r){return B(n,e,r)},reset:function(){n=e()},keys:function(){return Object.keys(n)}}})}var nn=function(){};function en(){var n=Q();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new nn,n.WINDOW_WILDCARD}function rn(n,e){return void 0===n&&(n="store"),void 0===e&&(e=V),$("windowStore").getOrSet(n,function(){var r=new L,t=function(n){return r.getOrSet(n,e)};return{has:function(e){return t(e).hasOwnProperty(n)},get:function(e,r){var o=t(e);return o.hasOwnProperty(n)?o[n]:r},set:function(e,r){return t(e)[n]=r,r},del:function(e){delete t(e)[n]},getOrSet:function(e,r){return B(t(e),n,r)}}})}function tn(){return $("instance").getOrSet("instanceID",z)}function on(n){return rn("helloPromises").getOrSet(n,function(){return new P})}function an(n,e){return(0,e.send)(n,X.HELLO,{instanceID:tn()},{domain:Y,timeout:-1}).then(function(e){var r=e.origin,t=e.data.instanceID;return on(n).resolve({win:n,domain:r}),{win:n,domain:r,instanceID:t}})}function un(n,e){var r=e.send;return rn("windowInstanceIDPromises").getOrSet(n,function(){return an(n,{send:r}).then(function(n){return n.instanceID})})}function cn(n){rn("knownWindows").set(n,!0)}var sn,fn={FUNCTION:"function",ERROR:"error",PROMISE:"promise",REGEX:"regex",DATE:"date",ARRAY:"array",OBJECT:"object",STRING:"string",NUMBER:"number",BOOLEAN:"boolean",NULL:"null",UNDEFINED:"undefined"};function dn(n){return"object"==typeof n&&null!==n&&"string"==typeof n.__type__}function ln(n){return void 0===n?fn.UNDEFINED:null===n?fn.NULL:Array.isArray(n)?fn.ARRAY:"function"==typeof n?fn.FUNCTION:"object"==typeof n?n instanceof Error?fn.ERROR:"function"==typeof n.then?fn.PROMISE:"[object RegExp]"===Object.prototype.toString.call(n)?fn.REGEX:"[object Date]"===Object.prototype.toString.call(n)?fn.DATE:fn.OBJECT:"string"==typeof n?fn.STRING:"number"==typeof n?fn.NUMBER:"boolean"==typeof n?fn.BOOLEAN:void 0}function hn(n,e){return{__type__:n,__val__:e}}var wn,pn=((sn={})[fn.FUNCTION]=function(){},sn[fn.ERROR]=function(n){var e=n.message,r=n.stack,t=n.code;return hn(fn.ERROR,{message:e,stack:r,code:t})},sn[fn.PROMISE]=function(){},sn[fn.REGEX]=function(n){return hn(fn.REGEX,n.source)},sn[fn.DATE]=function(n){return hn(fn.DATE,n.toJSON())},sn[fn.ARRAY]=function(n){return n},sn[fn.OBJECT]=function(n){return n},sn[fn.STRING]=function(n){return n},sn[fn.NUMBER]=function(n){return n},sn[fn.BOOLEAN]=function(n){return n},sn[fn.NULL]=function(n){return n},sn),vn={},mn=((wn={})[fn.FUNCTION]=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},wn[fn.ERROR]=function(n){var e=n.message,r=n.stack,t=n.code,o=new Error(e);return o.code=t,o.stack=r+"\n\n"+o.stack,o},wn[fn.PROMISE]=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},wn[fn.REGEX]=function(n){return new RegExp(n)},wn[fn.DATE]=function(n){return new Date(n)},wn[fn.ARRAY]=function(n){return n},wn[fn.OBJECT]=function(n){return n},wn[fn.STRING]=function(n){return n},wn[fn.NUMBER]=function(n){return n},wn[fn.BOOLEAN]=function(n){return n},wn[fn.NULL]=function(n){return n},wn),yn={};function gn(){for(var n=$("idToProxyWindow"),e=0,r=n.keys();e<r.length;e++){var t=r[e];n.get(t).shouldClean()&&n.del(t)}}new P(function(n){if(window.document&&window.document.body)return n(window.document.body);var e=setInterval(function(){if(window.document&&window.document.body)return clearInterval(e),n(window.document.body)},10)});var En=function(){function n(n,e,r){var t=r.send;this.isProxyWindow=!0,this.serializedWindow=void 0,this.actualWindow=void 0,this.actualWindowPromise=void 0,this.send=void 0,this.serializedWindow=n,this.actualWindowPromise=new P,e&&this.setWindow(e),this.serializedWindow.getInstanceID=function(n){var e={};function r(){for(var r=arguments.length,t=new Array(r),o=0;o<r;o++)t[o]=arguments[o];var i=function(n){try{return JSON.stringify(Array.prototype.slice.call(n),function(n,e){return"function"==typeof e?"memoize["+function(n){if(M=M||new L,null==n||"object"!=typeof n&&"function"!=typeof n)throw new Error("Invalid object");var e=M.get(n);return e||(e=typeof n+":"+z(),M.set(n,e)),e}(e)+"]":e})}catch(n){throw new Error("Arguments not serializable -- can not be used to memoize")}}(t);return e.hasOwnProperty(i)?e[i]:(e[i]=n.apply(this,arguments).finally(function(){delete e[i]}),e[i])}return r.reset=function(){e={}},r}(this.serializedWindow.getInstanceID),this.send=t}var e=n.prototype;return e.getType=function(){return this.serializedWindow.type},e.isPopup=function(){return"popup"===this.getType()},e.isIframe=function(){return"iframe"===this.getType()},e.setLocation=function(n){var e=this;return P.try(function(){if(!e.actualWindow)return e.serializedWindow.setLocation(n);e.actualWindow.location=n}).then(function(){return e})},e.setName=function(n){var e=this;return P.try(function(){if(!e.actualWindow)return e.serializedWindow.setName(n);if(!p(e.actualWindow))throw new Error("Can not set name for window on different domain");e.actualWindow.name=n,e.actualWindow.frameElement&&e.actualWindow.frameElement.setAttribute("name",n)}).then(function(){return e})},e.close=function(){var n=this;return P.try(function(){if(!n.actualWindow)return n.serializedWindow.close();n.actualWindow.close()}).then(function(){return n})},e.focus=function(){var n=this;return P.try(function(){return n.actualWindow&&n.actualWindow.focus(),n.serializedWindow.focus()}).then(function(){return n})},e.isClosed=function(){var n=this;return P.try(function(){return n.actualWindow?E(n.actualWindow):n.serializedWindow.isClosed()})},e.getWindow=function(){return this.actualWindow},e.setWindow=function(n){this.actualWindow=n,this.actualWindowPromise.resolve(n)},e.awaitWindow=function(){return this.actualWindowPromise},e.matchWindow=function(n){var e=this;return P.try(function(){return e.actualWindow?n===e.actualWindow:P.all([e.getInstanceID(),un(n,{send:e.send})]).then(function(r){var t=r[0]===r[1];return t&&e.setWindow(n),t})})},e.unwrap=function(){return this.actualWindow||this},e.getInstanceID=function(){return this.actualWindow?un(this.actualWindow,{send:this.send}):this.serializedWindow.getInstanceID()},e.serialize=function(){return this.serializedWindow},e.shouldClean=function(){return this.actualWindow&&E(this.actualWindow)},n.unwrap=function(e){return n.isProxyWindow(e)?e.unwrap():e},n.serialize=function(e,r){var t=r.send;return gn(),n.toProxyWindow(e,{send:t}).serialize()},n.deserialize=function(e,r){var t=r.on,o=r.send;return gn(),$("idToProxyWindow").getOrSet(e.id,function(){return new n(e,null,{on:t,send:o})})},n.isProxyWindow=function(n){return Boolean(n&&!W(n)&&n.isProxyWindow)},n.toProxyWindow=function(e,r){var t=r.send;return gn(),n.isProxyWindow(e)?e:rn("winToProxyWindow").getOrSet(e,function(){var r=z();return $("idToProxyWindow").set(r,new n({id:r,type:f(e)?"popup":"iframe",getInstanceID:function(){return un(e,{send:t})},close:function(){return P.try(function(){e.close()})},focus:function(){return P.try(function(){e.focus()})},isClosed:function(){return P.try(function(){return E(e)})},setLocation:function(n){return P.try(function(){if(p(e))try{if(e.location&&"function"==typeof e.location.replace)return void e.location.replace(n)}catch(n){}e.location=n})},setName:function(n){return P.try(function(){e.name=n})}},e,{send:t}))})},n}();function _n(n,e,r,t,o){var i=rn("methodStore"),a=$("proxyWindowMethods");En.isProxyWindow(t)?a.set(n,{val:e,name:r,domain:o,source:t}):(a.del(n),i.getOrSet(t,function(){return{}})[n]={domain:o,name:r,val:e,source:t})}function On(n,e){var r=rn("methodStore"),t=$("proxyWindowMethods");return r.getOrSet(n,function(){return{}})[e]||t.get(e)}function Wn(n,e,r,t,o){!function(n){var e=o.on;$("builtinListeners").getOrSet("functionCalls",function(){return e(X.METHOD,{domain:Y},function(n){var e=n.source,r=n.origin,t=n.data,o=t.id,i=t.name,a=On(e,o);if(!a)throw new Error("Could not find method '"+t.name+"' with id: "+t.id+" in "+h(window));var u=a.source,c=a.domain,s=a.val;return P.try(function(){if(!O(c,r))throw new Error("Method '"+t.name+"' domain "+JSON.stringify(F(a.domain)?a.domain.source:a.domain)+" does not match origin "+r+" in "+h(window));if(En.isProxyWindow(u))return u.matchWindow(e).then(function(n){if(!n)throw new Error("Method call '"+t.name+"' failed - proxy window does not match source in "+h(window))})}).then(function(){return s.apply({source:e,origin:r},t.args)},function(n){return P.try(function(){if(s.onError)return s.onError(n)}).then(function(){throw n})}).then(function(n){return{result:n,id:o,name:i}})})})}();var i=r.__id__||z();n=En.unwrap(n);var a=r.__name__||r.name||t;return En.isProxyWindow(n)?(_n(i,r,a,n,e),n.awaitWindow().then(function(n){_n(i,r,a,n,e)})):_n(i,r,a,n,e),hn(Z.CROSS_DOMAIN_FUNCTION,{id:i,name:a})}function Sn(n,e,r,t){var o,i=t.on,a=t.send;return function(n,e){void 0===e&&(e=vn);var r=JSON.stringify(n,function(n){var r=this[n];if(dn(this))return r;var t=ln(r);if(!t)return r;var o=e[t]||pn[t];return o?o(r,n):r});return void 0===r?fn.UNDEFINED:r}(r,((o={})[fn.PROMISE]=function(r,t){return function(n,e,r,t,o){var i=o.on,a=o.send;return hn(Z.CROSS_DOMAIN_ZALGO_PROMISE,{then:Wn(n,e,function(n,e){return r.then(n,e)},t,{on:i,send:a})})}(n,e,r,t,{on:i,send:a})},o[fn.FUNCTION]=function(r,t){return Wn(n,e,r,t,{on:i,send:a})},o[fn.OBJECT]=function(n){return W(n)||En.isProxyWindow(n)?function(n,e,r,t){var o=t.send;return hn(Z.CROSS_DOMAIN_WINDOW,En.serialize(r,{send:o}))}(0,0,n,{on:i,send:a}):n},o))}function bn(n,e,r,t){var o,i=t.on,a=t.send;return function(n,e){if(void 0===e&&(e=yn),n!==fn.UNDEFINED)return JSON.parse(n,function(n,r){if(dn(this))return r;var t,o;if(dn(r)?(t=r.__type__,o=r.__val__):(t=ln(r),o=r),!t)return o;var i=e[t]||mn[t];return i?i(o,n):o})}(r,((o={})[Z.CROSS_DOMAIN_ZALGO_PROMISE]=function(n){return e=n.then,new P(e);var e},o[Z.CROSS_DOMAIN_FUNCTION]=function(r){return function(n,e,r,t){var o=r.id,i=r.name,a=t.send,u=function(r){function t(){var u=arguments;return En.toProxyWindow(n,{send:a}).awaitWindow().then(function(n){var c=On(n,o);return c&&c.val!==t?c.val.apply({source:window,origin:h()},u):a(n,X.METHOD,{id:o,name:i,args:Array.prototype.slice.call(u)},{domain:e,fireAndForget:r.fireAndForget}).then(function(n){if(!r.fireAndForget)return n.data.result})}).catch(function(n){throw n})}return void 0===r&&(r={}),t.__name__=i,t.__origin__=e,t.__source__=n,t.__id__=o,t.origin=e,t},c=u();return c.fireAndForget=u({fireAndForget:!0}),c}(n,e,r,{on:i,send:a})},o[Z.CROSS_DOMAIN_WINDOW]=function(n){return function(n,e,r,t){var o=t.on,i=t.send;return En.deserialize(r,{on:o,send:i})}(0,0,n,{on:i,send:a})},o))}var Rn={};function jn(n,e,r,t){var o,i=t.on,a=t.send;if(E(n))throw new Error("Window is closed");for(var u,c=Sn(n,e,((o={}).__post_robot_10_0_0__=k({id:z()},r),o),{on:i,send:a}),s=!1,f=0,d=Object.keys(Rn);f<d.length;f++){var l=d[f];try{Rn[l](n,c,e),s=!0}catch(n){u=u||n}}if(!s)throw u}Rn.postrobot_post_message=function(n,e,r){(Array.isArray(r)?r:"string"==typeof r?[r]:[Y]).map(function(e){if(0===e.indexOf(i.MOCK)){if(window.location.protocol===i.FILE)return Y;if(!w(n))throw new Error("Attempting to send messsage to mock domain "+e+", but window is actually cross-domain");return l(n)}return 0===e.indexOf(i.FILE)?Y:e}).forEach(function(r){n.postMessage(e,r)})};var xn,Nn="__domain_regex__";function An(n){return $("responseListeners").get(n)}function In(n){$("responseListeners").del(n)}function Pn(n){return $("erroredResponseListeners").has(n)}function kn(n){var e=n.name,r=n.win,t=n.domain,o=rn("requestListeners");if(r===Y&&(r=null),t===Y&&(t=null),!e)throw new Error("Name required to get request listener");for(var i=0,a=[r,en()];i<a.length;i++){var u=a[i];if(u){var c=o.get(u);if(c){var s=c[e];if(s){if(t&&"string"==typeof t){if(s[t])return s[t];if(s[Nn])for(var f=0,d=s[Nn];f<d.length;f++){var l=d[f],h=l.regex,w=l.listener;if(O(h,t))return w}}if(s[Y])return s[Y]}}}}}var Dn=((xn={})[K.REQUEST]=function(n,e,r,t){var o=t.on,i=t.send,a=kn({name:r.name,win:n,domain:e});function u(t,a,u){void 0===u&&(u={}),r.fireAndForget||E(n)||jn(n,e,k({type:t,ack:a,hash:r.hash,name:r.name},u),{on:o,send:i})}return r.name===X.METHOD&&r.data&&"string"==typeof r.data.name?r.data.name:r.name,P.all([u(K.ACK),P.try(function(){if(!a)throw new Error("No handler found for post message: "+r.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!O(a.domain,e))throw new Error("Request origin "+e+" does not match domain "+a.domain.toString());var t=r.data;return a.handler({source:n,origin:e,data:t})}).then(function(n){return u(K.RESPONSE,"success",{data:n})},function(n){return u(K.RESPONSE,"error",{error:n})})]).then(U).catch(function(n){if(a&&a.handleError)return a.handleError(n);throw n})},xn[K.ACK]=function(n,e,r){if(!Pn(r.hash)){var t=An(r.hash);if(!t)throw new Error("No handler found for post message ack for message: "+r.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!O(t.domain,e))throw new Error("Ack origin "+e+" does not match domain "+t.domain.toString());if(n!==t.win)throw new Error("Ack source does not match registered window");t.ack=!0}},xn[K.RESPONSE]=function(n,e,r){if(!Pn(r.hash)){var t,i=An(r.hash);if(!i)throw new Error("No handler found for post message response for message: "+r.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!O(i.domain,e))throw new Error("Response origin "+e+" does not match domain "+(t=i.domain,Array.isArray(t)?"("+t.join(" | ")+")":o(t)?"RegExp("+t.toString():t.toString()));if(n!==i.win)throw new Error("Response source does not match registered window");In(r.hash),r.name===X.METHOD&&r.data&&"string"==typeof r.data.name?r.data.name:r.name,"error"===r.ack?i.promise.reject(r.error):"success"===r.ack&&i.promise.resolve({source:n,origin:e,data:r.data})}},xn);function Mn(n,e){var r=e.on,t=e.send,o=$("receivedMessages");if(!window||window.closed)throw new Error("Message recieved in closed window");try{if(!n.source)return}catch(n){return}var i=n.source,a=n.origin,u=function(n,e,r,t){var o,i=t.on,a=t.send;try{o=bn(e,r,n,{on:i,send:a})}catch(n){return}if(o&&"object"==typeof o&&null!==o&&(o=o.__post_robot_10_0_0__)&&"object"==typeof o&&null!==o&&o.type&&"string"==typeof o.type&&Dn[o.type])return o}(n.data,i,a,{on:r,send:t});u&&(cn(i),o.has(u.id)||(o.set(u.id,!0),E(i)&&!u.fireAndForget||Dn[u.type](i,a,u,{on:r,send:t})))}function Tn(n,e,r){if(!n)throw new Error("Expected name");if("function"==typeof e&&(r=e,e={}),!r)throw new Error("Expected handler");(e=e||{}).name=n,e.handler=r||e.handler;var t=e.window,o=e.domain,i=function n(e,r){var t=e.name,o=e.win,i=e.domain,a=rn("requestListeners");if(!t||"string"!=typeof t)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var u=[],c=0,s=o;c<s.length;c++){var f=s[c];u.push(n({name:t,domain:i,win:f},r))}return{cancel:function(){for(var n=0;n<u.length;n++)u[n].cancel()}}}if(Array.isArray(i)){for(var d=[],l=0,h=i;l<h.length;l++){var w=h[l];d.push(n({name:t,win:o,domain:w},r))}return{cancel:function(){for(var n=0;n<d.length;n++)d[n].cancel()}}}var p=kn({name:t,win:o,domain:i});if(o&&o!==Y||(o=en()),i=i||Y,p)throw o&&i?new Error("Request listener already exists for "+t+" on domain "+i.toString()+" for "+(o===en()?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+t+" for "+(o===en()?"wildcard":"specified")+" window"):i?new Error("Request listener already exists for "+t+" on domain "+i.toString()):new Error("Request listener already exists for "+t);var v,m,y=a.getOrSet(o,function(){return{}}),g=B(y,t,function(){return{}}),E=i.toString();return F(i)?(v=B(g,Nn,function(){return[]}),m={regex:i,listener:r},v.push(m)):g[E]=r,{cancel:function(){delete g[E],m&&(v.splice(v.indexOf(m,1)),v.length||delete g[Nn]),Object.keys(g).length||delete y[t],o&&!Object.keys(y).length&&a.del(o)}}}({name:n,win:t,domain:o},{handler:e.handler,handleError:e.errorHandler||function(n){throw n},window:t,domain:o||Y,name:n});return{cancel:function(){i.cancel()}}}function Cn(n,e,r){"function"==typeof(e=e||{})&&(r=e,e={});var t,o=new P;return e.errorHandler=function(n){t.cancel(),o.reject(n)},t=Tn(n,e,function(n){if(t.cancel(),o.resolve(n),r)return r(n)}),o.cancel=t.cancel,o}function Ln(n,e,r,t){var o=(t=t||{}).domain||Y,i=t.timeout||J,a=t.timeout||H,u=t.fireAndForget||!1;return P.try(function(){if(!e)throw new Error("Expected name");if(o&&"string"!=typeof o&&!Array.isArray(o)&&!F(o))throw new TypeError("Expected domain to be a string, array, or regex");if(E(n))throw new Error("Target window is closed");var t=rn("requestPromises").getOrSet(n,function(){return[]}),c=P.try(function(){return function(n,e){var r=_(e);if(r)return r===n;if(e===n)return!1;if(function(n){if(n){try{if(n.top)return n.top}catch(n){}if(s(n)===n)return n;try{if(v(window,n)&&window.top)return window.top}catch(n){}try{if(v(n,window)&&window.top)return window.top}catch(n){}for(var e=0,r=function n(e){for(var r=[],t=0,o=m(e);t<o.length;t++){var i=o[t];r.push(i);for(var a=0,u=n(i);a<u.length;a++){var c=u[a];r.push(c)}}return r}(n);e<r.length;e++){var t=r[e];try{if(t.top)return t.top}catch(n){}if(s(t)===t)return t}}}(e)===e)return!1;for(var t=0,o=m(n);t<o.length;t++)if(o[t]===e)return!0;return!1}(window,n)?function(n,e,r){void 0===e&&(e=5e3),void 0===r&&(r="Window");var t=on(n);return-1!==e&&(t=t.timeout(e,new Error(r+" did not load after "+e+"ms"))),t}(n,a):F(o)?an(n,{send:Ln}):void 0}).then(function(a){var s=(void 0===a?{}:a).domain;if(F(o)){if(!O(o,s))throw new Error("Remote window domain "+s+" does not match regex: "+o.source);o=s}e===X.METHOD&&r&&"string"==typeof r.name&&r.name;var f=!1,d=new P;d.finally(function(){f=!0,t.splice(t.indexOf(c,1))}).catch(U);var l=e+"_"+z();if(jn(n,o,{type:K.REQUEST,hash:l,name:e,data:r,fireAndForget:u},{on:Tn,send:Ln}),u)return d.resolve();d.catch(function(){!function(n){$("erroredResponseListeners").set(n,!0)}(l),In(l)});var w={name:e,win:n,domain:o,promise:d};!function(n,e){$("responseListeners").set(n,e)}(l,w);var p=function(n){return rn("knownWindows").get(n,!1)}(n)?G:q,v=i,m=p,y=v,g=100;return setTimeout(function r(){if(!f){if(E(n))return w.ack?d.reject(new Error("Window closed for "+e+" before response")):d.reject(new Error("Window closed for "+e+" before ack"));if(m=Math.max(m-g,0),-1!==y&&(y=Math.max(y-g,0)),w.ack){if(-1===y)return;g=Math.min(y,2e3)}else{if(0===m)return d.reject(new Error("No ack for postMessage "+e+" in "+h()+" in "+p+"ms"));if(0===y)return d.reject(new Error("No response for postMessage "+e+" in "+h()+" in "+v+"ms"))}setTimeout(r,g)}},g),d});return t.push(c),c})}function zn(n,e,r){return Sn(n,e,r,{on:Tn,send:Ln})}function Un(n,e,r){return bn(n,e,r,{on:Tn,send:Ln})}function Fn(n){return En.toProxyWindow(n,{send:Ln})}function Bn(){var n,e,r,t;Q().initialized||(Q().initialized=!0,function(n){var e=n.on,r=n.send;$().getOrSet("postMessageListeners",function(){return n=window,t=function(n){!function(n,e){var r=e.on,t=e.send;try{n.source}catch(n){return}var o={source:n.source||n.sourceElement,origin:n.origin||n.originalEvent&&n.originalEvent.origin,data:n.data};if(o.source){if(!o.origin)throw new Error("Post message did not have origin domain");Mn(o,{on:r,send:t})}}(n,{on:e,send:r})},n.addEventListener("message",t),{cancel:function(){n.removeEventListener("message",t)}};var n,t})}({on:Tn,send:Ln}),function(n){var e=n.on,r=n.send;$("builtinListeners").getOrSet("helloListener",function(){var n=e(X.HELLO,{domain:Y},function(n){var e=n.source,r=n.origin;return on(e).resolve({win:e,domain:r}),{instanceID:tn()}}),t=_();return t&&an(t,{send:r}).catch(U),n})}({on:Tn,send:Ln}),e=(n={on:Tn,send:Ln}).on,r=n.send,(t=Q()).receiveMessage=t.receiveMessage||function(n){return Mn(n,{on:e,send:r})})}function Hn(n){for(var e=0,r=rn("requestPromises").get(n,[]);e<r.length;e++)r[e].reject(new Error("Window cleaned up before response")).catch(U)}r.d(e,"bridge",function(){}),r.d(e,"Promise",function(){return P}),r.d(e,"TYPES",function(){return!0}),r.d(e,"ProxyWindow",function(){return En}),r.d(e,"setup",function(){return Bn}),r.d(e,"serializeMessage",function(){return zn}),r.d(e,"deserializeMessage",function(){return Un}),r.d(e,"toProxyWindow",function(){return Fn}),r.d(e,"on",function(){return Tn}),r.d(e,"once",function(){return Cn}),r.d(e,"send",function(){return Ln}),r.d(e,"markWindowKnown",function(){return cn}),r.d(e,"cleanUpWindow",function(){return Hn}),Bn()}])});
!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("postRobot",[],e):"object"==typeof exports?exports.postRobot=e():n.postRobot=e()}("undefined"!=typeof self?self:this,function(){return function(n){var e={};function r(t){if(e[t])return e[t].exports;var o=e[t]={i:t,l:!1,exports:{}};return n[t].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=n,r.c=e,r.d=function(n,e,t){r.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:t})},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,e){if(1&e&&(n=r(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var t=Object.create(null);if(r.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var o in n)r.d(t,o,function(e){return n[e]}.bind(null,o));return t},r.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(e,"a",e),e},r.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},r.p="",r(r.s=0)}([function(n,e,r){"use strict";r.r(e);var t={};function o(n){return"[object RegExp]"===Object.prototype.toString.call(n)}r.r(t),r.d(t,"WeakMap",function(){return L});var i={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},a="*",u="Call was rejected by callee.\r\n";function c(n){return void 0===n&&(n=window),n.location.protocol===i.ABOUT}function s(n){if(n)try{if(n.parent&&n.parent!==n)return n.parent}catch(n){}}function f(n){if(n&&!s(n))try{return n.opener}catch(n){}}function d(n){try{return n&&n.location&&n.location.href,!0}catch(n){}return!1}function l(n){var e=(n=n||window).location;if(!e)throw new Error("Can not read window location");var r=e.protocol;if(!r)throw new Error("Can not read window protocol");if(r===i.FILE)return i.FILE+"//";if(r===i.ABOUT){var t=s(n);return t&&d(t)?l(t):i.ABOUT+"//"}var o=e.host;if(!o)throw new Error("Can not read window host");return r+"//"+o}function h(n){var e=l(n=n||window);return e&&n.mockDomain&&0===n.mockDomain.indexOf(i.MOCK)?n.mockDomain:e}function w(n){try{if(n===window)return!0}catch(n){}try{var e=Object.getOwnPropertyDescriptor(n,"location");if(e&&!1===e.enumerable)return!1}catch(n){}try{if(c(n)&&d(n))return!0}catch(n){}try{if(l(n)===l(window))return!0}catch(n){}return!1}function p(n){if(!w(n))return!1;try{if(n===window)return!0;if(c(n)&&d(n))return!0;if(h(window)===h(n))return!0}catch(n){}return!1}function v(n,e){if(!n||!e)return!1;var r=s(e);return r?r===n:-1!==function(n){var e=[];try{for(;n.parent!==n;)e.push(n.parent),n=n.parent}catch(n){}return e}(e).indexOf(n)}function m(n){var e,r,t=[];try{e=n.frames}catch(r){e=n}try{r=e.length}catch(n){}if(0===r)return t;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=e[o]}catch(n){continue}t.push(i)}return t}for(var a=0;a<100;a++){var u=void 0;try{u=e[a]}catch(n){return t}if(!u)return t;t.push(u)}return t}var y=[],g=[];function E(n,e){void 0===e&&(e=!0);try{if(n===window)return!1}catch(n){return!0}try{if(!n)return!0}catch(n){return!0}try{if(n.closed)return!0}catch(n){return!n||n.message!==u}if(e&&p(n))try{if(n.mockclosed)return!0}catch(n){}try{if(!n.parent||!n.top)return!0}catch(n){}var r=function(n,e){for(var r=0;r<n.length;r++)try{if(n[r]===e)return r}catch(n){}return-1}(y,n);if(-1!==r){var t=g[r];if(t&&function(n){if(!n.contentWindow)return!0;if(!n.parentNode)return!0;var e=n.ownerDocument;return!(!e||!e.documentElement||e.documentElement.contains(n))}(t))return!0}return!1}function _(n){return f(n=n||window)||s(n)||void 0}function O(n,e){if("string"==typeof n){if("string"==typeof e)return n===a||e===n;if(o(e))return!1;if(Array.isArray(e))return!1}return o(n)?o(e)?n.toString()===e.toString():!Array.isArray(e)&&Boolean(e.match(n)):!!Array.isArray(n)&&(Array.isArray(e)?JSON.stringify(n)===JSON.stringify(e):!o(e)&&n.some(function(n){return O(n,e)}))}function W(n){try{if(n===window)return!0}catch(n){if(n&&n.message===u)return!0}try{if("[object Window]"===Object.prototype.toString.call(n))return!0}catch(n){if(n&&n.message===u)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(n){if(n&&n.message===u)return!0}try{if(n&&n.self===n)return!0}catch(n){if(n&&n.message===u)return!0}try{if(n&&n.parent===n)return!0}catch(n){if(n&&n.message===u)return!0}try{if(n&&n.top===n)return!0}catch(n){if(n&&n.message===u)return!0}try{n&&n.__cross_domain_utils_window_check__}catch(n){return!0}return!1}function S(n){try{if(!n)return!1;if("undefined"!=typeof Promise&&n instanceof Promise)return!0;if("undefined"!=typeof window&&window.Window&&n instanceof window.Window)return!1;if("undefined"!=typeof window&&window.constructor&&n instanceof window.constructor)return!1;var e={}.toString;if(e){var r=e.call(n);if("[object Window]"===r||"[object global]"===r||"[object DOMWindow]"===r)return!1}if("function"==typeof n.then)return!0}catch(n){return!1}return!1}var b,R=[],j=[],x=0;function N(){if(!x&&b){var n=b;b=null,n.resolve()}}function A(){x+=1}function I(){x-=1,N()}var P=function(){function n(n){var e=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],n){var r,t,o=!1,i=!1,a=!1;A();try{n(function(n){a?e.resolve(n):(o=!0,r=n)},function(n){a?e.reject(n):(i=!0,t=n)})}catch(n){return I(),void this.reject(n)}I(),a=!0,o?this.resolve(r):i&&this.reject(t)}}var e=n.prototype;return e.resolve=function(n){if(this.resolved||this.rejected)return this;if(S(n))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=n,this.dispatch(),this},e.reject=function(n){var e=this;if(this.resolved||this.rejected)return this;if(S(n))throw new Error("Can not reject promise with another promise");if(!n){var r=n&&"function"==typeof n.toString?n.toString():Object.prototype.toString.call(n);n=new Error("Expected reject to be called with Error, got "+r)}return this.rejected=!0,this.error=n,this.errorHandled||setTimeout(function(){e.errorHandled||function(n,e){if(-1===R.indexOf(n)){R.push(n),setTimeout(function(){throw n},1);for(var r=0;r<j.length;r++)j[r](n,e)}}(n,e)},1),this.dispatch(),this},e.asyncReject=function(n){return this.errorHandled=!0,this.reject(n),this},e.dispatch=function(){var e=this,r=this.dispatching,t=this.resolved,o=this.rejected,i=this.handlers;if(!r&&(t||o)){this.dispatching=!0,A();for(var a=function(r){var a=i[r],u=a.onSuccess,c=a.onError,s=a.promise,f=void 0;if(t)try{f=u?u(e.value):e.value}catch(n){return s.reject(n),"continue"}else if(o){if(!c)return s.reject(e.error),"continue";try{f=c(e.error)}catch(n){return s.reject(n),"continue"}}f instanceof n&&(f.resolved||f.rejected)?(f.resolved?s.resolve(f.value):s.reject(f.error),f.errorHandled=!0):S(f)?f instanceof n&&(f.resolved||f.rejected)?f.resolved?s.resolve(f.value):s.reject(f.error):f.then(function(n){s.resolve(n)},function(n){s.reject(n)}):s.resolve(f)},u=0;u<i.length;u++)a(u);i.length=0,this.dispatching=!1,I()}},e.then=function(e,r){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.then expected a function for success handler");if(r&&"function"!=typeof r&&!r.call)throw new Error("Promise.then expected a function for error handler");var t=new n;return this.handlers.push({promise:t,onSuccess:e,onError:r}),this.errorHandled=!0,this.dispatch(),t},e.catch=function(n){return this.then(void 0,n)},e.finally=function(e){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return n.try(e).then(function(){return r})},function(r){return n.try(e).then(function(){throw r})})},e.timeout=function(n,e){var r=this;if(this.resolved||this.rejected)return this;var t=setTimeout(function(){r.resolved||r.rejected||r.reject(e||new Error("Promise timed out after "+n+"ms"))},n);return this.then(function(n){return clearTimeout(t),n})},e.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},n.resolve=function(e){return e instanceof n?e:S(e)?new n(function(n,r){return e.then(n,r)}):(new n).resolve(e)},n.reject=function(e){return(new n).reject(e)},n.asyncReject=function(e){return(new n).asyncReject(e)},n.all=function(e){var r=new n,t=e.length,o=[];if(!t)return r.resolve(o),r;for(var i=function(i){var a=e[i];if(a instanceof n){if(a.resolved)return o[i]=a.value,t-=1,"continue"}else if(!S(a))return o[i]=a,t-=1,"continue";n.resolve(a).then(function(n){o[i]=n,0==(t-=1)&&r.resolve(o)},function(n){r.reject(n)})},a=0;a<e.length;a++)i(a);return 0===t&&r.resolve(o),r},n.hash=function(e){var r={};return n.all(Object.keys(e).map(function(t){return n.resolve(e[t]).then(function(n){r[t]=n})})).then(function(){return r})},n.map=function(e,r){return n.all(e.map(r))},n.onPossiblyUnhandledException=function(n){return function(n){return j.push(n),{cancel:function(){j.splice(j.indexOf(n),1)}}}(n)},n.try=function(e,r,t){if(e&&"function"!=typeof e&&!e.call)throw new Error("Promise.try expected a function");var o;A();try{o=e.apply(r,t||[])}catch(e){return I(),n.reject(e)}return I(),n.resolve(o)},n.delay=function(e){return new n(function(n){setTimeout(n,e)})},n.isPromise=function(e){return!!(e&&e instanceof n)||S(e)},n.flush=function(){return e=b=b||new n,N(),e;var e},n}();function k(){return(k=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(n[t]=r[t])}return n}).apply(this,arguments)}function D(n,e){for(var r=0;r<n.length;r++)try{if(n[r]===e)return r}catch(n){}return-1}var M,T=Object.defineProperty,C=Date.now()%1e9,L=function(){function n(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,C+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+C,function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var n=new WeakMap,e={};return Object.freeze(e),n.set(e,"__testvalue__"),"__testvalue__"===n.get(e)}catch(n){return!1}}())try{this.weakmap=new WeakMap}catch(n){}this.keys=[],this.values=[]}var e=n.prototype;return e._cleanupClosedWindows=function(){for(var n=this.weakmap,e=this.keys,r=0;r<e.length;r++){var t=e[r];if(W(t)&&E(t)){if(n)try{n.delete(t)}catch(n){}e.splice(r,1),this.values.splice(r,1),r-=1}}},e.isSafeToReadWrite=function(n){if(W(n))return!1;try{n&&n.self,n&&n[this.name]}catch(n){return!1}return!0},e.set=function(n,e){if(!n)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.set(n,e)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var t=this.name,o=n[t];o&&o[0]===n?o[1]=e:T(n,t,{value:[n,e],writable:!0})}else{this._cleanupClosedWindows();var i=this.keys,a=this.values,u=D(i,n);-1===u?(i.push(n),a.push(e)):a[u]=e}},e.get=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(n))return e.get(n)}catch(n){delete this.weakmap}if(!this.isSafeToReadWrite(n)){this._cleanupClosedWindows();var r=D(this.keys,n);if(-1===r)return;return this.values[r]}var t=n[this.name];if(t&&t[0]===n)return t[1]},e.delete=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{e.delete(n)}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var r=n[this.name];r&&r[0]===n&&(r[0]=r[1]=void 0)}else{this._cleanupClosedWindows();var t=this.keys,o=D(t,n);-1!==o&&(t.splice(o,1),this.values.splice(o,1))}},e.has=function(n){if(!n)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(n))return!0}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(n)){var r=n[this.name];return!(!r||r[0]!==n)}return this._cleanupClosedWindows(),-1!==D(this.keys,n)},e.getOrSet=function(n,e){if(this.has(n))return this.get(n);var r=e();return this.set(n,r),r},n}();function z(){var n="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,function(){return n.charAt(Math.floor(Math.random()*n.length))})+"_"+function(n){if("function"==typeof btoa)return btoa(n);if("undefined"!=typeof Buffer)return Buffer.from(n,"utf8").toString("base64");throw new Error("Can not find window.btoa or Buffer")}((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function U(){}function F(n){return"[object RegExp]"===Object.prototype.toString.call(n)}function B(n,e,r){if(n.hasOwnProperty(e))return n[e];var t=r();return n[e]=t,t}Object.create(Error.prototype);var H=5e3,q=2e3,G=1e4,J=-1,K={REQUEST:"postrobot_message_request",RESPONSE:"postrobot_message_response",ACK:"postrobot_message_ack"},X={METHOD:"postrobot_method",HELLO:"postrobot_hello",OPEN_TUNNEL:"postrobot_open_tunnel"},Y="*",Z={CROSS_DOMAIN_ZALGO_PROMISE:"cross_domain_zalgo_promise",CROSS_DOMAIN_FUNCTION:"cross_domain_function",CROSS_DOMAIN_WINDOW:"cross_domain_window"};function Q(n){return void 0===n&&(n=window),n!==window?n.__post_robot_10_0_1__:n.__post_robot_10_0_1__=n.__post_robot_10_0_1__||{}}var V=function(){return{}};function $(n,e){return void 0===n&&(n="store"),void 0===e&&(e=V),B(Q(),n,function(){var n=e();return{has:function(e){return n.hasOwnProperty(e)},get:function(e,r){return n.hasOwnProperty(e)?n[e]:r},set:function(e,r){return n[e]=r,r},del:function(e){delete n[e]},getOrSet:function(e,r){return B(n,e,r)},reset:function(){n=e()},keys:function(){return Object.keys(n)}}})}var nn=function(){};function en(){var n=Q();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new nn,n.WINDOW_WILDCARD}function rn(n,e){return void 0===n&&(n="store"),void 0===e&&(e=V),$("windowStore").getOrSet(n,function(){var r=new L,t=function(n){return r.getOrSet(n,e)};return{has:function(e){return t(e).hasOwnProperty(n)},get:function(e,r){var o=t(e);return o.hasOwnProperty(n)?o[n]:r},set:function(e,r){return t(e)[n]=r,r},del:function(e){delete t(e)[n]},getOrSet:function(e,r){return B(t(e),n,r)}}})}function tn(){return $("instance").getOrSet("instanceID",z)}function on(n){return rn("helloPromises").getOrSet(n,function(){return new P})}function an(n,e){return(0,e.send)(n,X.HELLO,{instanceID:tn()},{domain:Y,timeout:-1}).then(function(e){var r=e.origin,t=e.data.instanceID;return on(n).resolve({win:n,domain:r}),{win:n,domain:r,instanceID:t}})}function un(n,e){var r=e.send;return rn("windowInstanceIDPromises").getOrSet(n,function(){return an(n,{send:r}).then(function(n){return n.instanceID})})}function cn(n){rn("knownWindows").set(n,!0)}var sn,fn={FUNCTION:"function",ERROR:"error",PROMISE:"promise",REGEX:"regex",DATE:"date",ARRAY:"array",OBJECT:"object",STRING:"string",NUMBER:"number",BOOLEAN:"boolean",NULL:"null",UNDEFINED:"undefined"};function dn(n){return"object"==typeof n&&null!==n&&"string"==typeof n.__type__}function ln(n){return void 0===n?fn.UNDEFINED:null===n?fn.NULL:Array.isArray(n)?fn.ARRAY:"function"==typeof n?fn.FUNCTION:"object"==typeof n?n instanceof Error?fn.ERROR:"function"==typeof n.then?fn.PROMISE:"[object RegExp]"===Object.prototype.toString.call(n)?fn.REGEX:"[object Date]"===Object.prototype.toString.call(n)?fn.DATE:fn.OBJECT:"string"==typeof n?fn.STRING:"number"==typeof n?fn.NUMBER:"boolean"==typeof n?fn.BOOLEAN:void 0}function hn(n,e){return{__type__:n,__val__:e}}var wn,pn=((sn={})[fn.FUNCTION]=function(){},sn[fn.ERROR]=function(n){var e=n.message,r=n.stack,t=n.code;return hn(fn.ERROR,{message:e,stack:r,code:t})},sn[fn.PROMISE]=function(){},sn[fn.REGEX]=function(n){return hn(fn.REGEX,n.source)},sn[fn.DATE]=function(n){return hn(fn.DATE,n.toJSON())},sn[fn.ARRAY]=function(n){return n},sn[fn.OBJECT]=function(n){return n},sn[fn.STRING]=function(n){return n},sn[fn.NUMBER]=function(n){return n},sn[fn.BOOLEAN]=function(n){return n},sn[fn.NULL]=function(n){return n},sn),vn={},mn=((wn={})[fn.FUNCTION]=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},wn[fn.ERROR]=function(n){var e=n.message,r=n.stack,t=n.code,o=new Error(e);return o.code=t,o.stack=r+"\n\n"+o.stack,o},wn[fn.PROMISE]=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},wn[fn.REGEX]=function(n){return new RegExp(n)},wn[fn.DATE]=function(n){return new Date(n)},wn[fn.ARRAY]=function(n){return n},wn[fn.OBJECT]=function(n){return n},wn[fn.STRING]=function(n){return n},wn[fn.NUMBER]=function(n){return n},wn[fn.BOOLEAN]=function(n){return n},wn[fn.NULL]=function(n){return n},wn),yn={};function gn(){for(var n=$("idToProxyWindow"),e=0,r=n.keys();e<r.length;e++){var t=r[e];n.get(t).shouldClean()&&n.del(t)}}new P(function(n){if(window.document&&window.document.body)return n(window.document.body);var e=setInterval(function(){if(window.document&&window.document.body)return clearInterval(e),n(window.document.body)},10)});var En=function(){function n(n,e,r){var t=r.send;this.isProxyWindow=!0,this.serializedWindow=void 0,this.actualWindow=void 0,this.actualWindowPromise=void 0,this.send=void 0,this.serializedWindow=n,this.actualWindowPromise=new P,e&&this.setWindow(e),this.serializedWindow.getInstanceID=function(n){var e={};function r(){for(var r=arguments.length,t=new Array(r),o=0;o<r;o++)t[o]=arguments[o];var i=function(n){try{return JSON.stringify(Array.prototype.slice.call(n),function(n,e){return"function"==typeof e?"memoize["+function(n){if(M=M||new L,null==n||"object"!=typeof n&&"function"!=typeof n)throw new Error("Invalid object");var e=M.get(n);return e||(e=typeof n+":"+z(),M.set(n,e)),e}(e)+"]":e})}catch(n){throw new Error("Arguments not serializable -- can not be used to memoize")}}(t);return e.hasOwnProperty(i)?e[i]:(e[i]=n.apply(this,arguments).finally(function(){delete e[i]}),e[i])}return r.reset=function(){e={}},r}(this.serializedWindow.getInstanceID),this.send=t}var e=n.prototype;return e.getType=function(){return this.serializedWindow.type},e.isPopup=function(){return"popup"===this.getType()},e.isIframe=function(){return"iframe"===this.getType()},e.setLocation=function(n){var e=this;return P.try(function(){if(!e.actualWindow)return e.serializedWindow.setLocation(n);e.actualWindow.location=n}).then(function(){return e})},e.setName=function(n){var e=this;return P.try(function(){if(!e.actualWindow)return e.serializedWindow.setName(n);if(!p(e.actualWindow))throw new Error("Can not set name for window on different domain");e.actualWindow.name=n,e.actualWindow.frameElement&&e.actualWindow.frameElement.setAttribute("name",n)}).then(function(){return e})},e.close=function(){var n=this;return P.try(function(){if(!n.actualWindow)return n.serializedWindow.close();n.actualWindow.close()}).then(function(){return n})},e.focus=function(){var n=this;return P.try(function(){return n.actualWindow&&n.actualWindow.focus(),n.serializedWindow.focus()}).then(function(){return n})},e.isClosed=function(){var n=this;return P.try(function(){return n.actualWindow?E(n.actualWindow):n.serializedWindow.isClosed()})},e.getWindow=function(){return this.actualWindow},e.setWindow=function(n){this.actualWindow=n,this.actualWindowPromise.resolve(n)},e.awaitWindow=function(){return this.actualWindowPromise},e.matchWindow=function(n){var e=this;return P.try(function(){return e.actualWindow?n===e.actualWindow:P.all([e.getInstanceID(),un(n,{send:e.send})]).then(function(r){var t=r[0]===r[1];return t&&e.setWindow(n),t})})},e.unwrap=function(){return this.actualWindow||this},e.getInstanceID=function(){return this.actualWindow?un(this.actualWindow,{send:this.send}):this.serializedWindow.getInstanceID()},e.serialize=function(){return this.serializedWindow},e.shouldClean=function(){return this.actualWindow&&E(this.actualWindow)},n.unwrap=function(e){return n.isProxyWindow(e)?e.unwrap():e},n.serialize=function(e,r){var t=r.send;return gn(),n.toProxyWindow(e,{send:t}).serialize()},n.deserialize=function(e,r){var t=r.on,o=r.send;return gn(),$("idToProxyWindow").getOrSet(e.id,function(){return new n(e,null,{on:t,send:o})})},n.isProxyWindow=function(n){return Boolean(n&&!W(n)&&n.isProxyWindow)},n.toProxyWindow=function(e,r){var t=r.send;return gn(),n.isProxyWindow(e)?e:rn("winToProxyWindow").getOrSet(e,function(){var r=z();return $("idToProxyWindow").set(r,new n({id:r,type:f(e)?"popup":"iframe",getInstanceID:function(){return un(e,{send:t})},close:function(){return P.try(function(){e.close()})},focus:function(){return P.try(function(){e.focus()})},isClosed:function(){return P.try(function(){return E(e)})},setLocation:function(n){return P.try(function(){if(p(e))try{if(e.location&&"function"==typeof e.location.replace)return void e.location.replace(n)}catch(n){}e.location=n})},setName:function(n){return P.try(function(){e.name=n})}},e,{send:t}))})},n}();function _n(n,e,r,t,o){var i=rn("methodStore"),a=$("proxyWindowMethods");En.isProxyWindow(t)?a.set(n,{val:e,name:r,domain:o,source:t}):(a.del(n),i.getOrSet(t,function(){return{}})[n]={domain:o,name:r,val:e,source:t})}function On(n,e){var r=rn("methodStore"),t=$("proxyWindowMethods");return r.getOrSet(n,function(){return{}})[e]||t.get(e)}function Wn(n,e,r,t,o){!function(n){var e=o.on;$("builtinListeners").getOrSet("functionCalls",function(){return e(X.METHOD,{domain:Y},function(n){var e=n.source,r=n.origin,t=n.data,o=t.id,i=t.name,a=On(e,o);if(!a)throw new Error("Could not find method '"+t.name+"' with id: "+t.id+" in "+h(window));var u=a.source,c=a.domain,s=a.val;return P.try(function(){if(!O(c,r))throw new Error("Method '"+t.name+"' domain "+JSON.stringify(F(a.domain)?a.domain.source:a.domain)+" does not match origin "+r+" in "+h(window));if(En.isProxyWindow(u))return u.matchWindow(e).then(function(n){if(!n)throw new Error("Method call '"+t.name+"' failed - proxy window does not match source in "+h(window))})}).then(function(){return s.apply({source:e,origin:r},t.args)},function(n){return P.try(function(){if(s.onError)return s.onError(n)}).then(function(){throw n})}).then(function(n){return{result:n,id:o,name:i}})})})}();var i=r.__id__||z();n=En.unwrap(n);var a=r.__name__||r.name||t;return En.isProxyWindow(n)?(_n(i,r,a,n,e),n.awaitWindow().then(function(n){_n(i,r,a,n,e)})):_n(i,r,a,n,e),hn(Z.CROSS_DOMAIN_FUNCTION,{id:i,name:a})}function Sn(n,e,r,t){var o,i=t.on,a=t.send;return function(n,e){void 0===e&&(e=vn);var r=JSON.stringify(n,function(n){var r=this[n];if(dn(this))return r;var t=ln(r);if(!t)return r;var o=e[t]||pn[t];return o?o(r,n):r});return void 0===r?fn.UNDEFINED:r}(r,((o={})[fn.PROMISE]=function(r,t){return function(n,e,r,t,o){var i=o.on,a=o.send;return hn(Z.CROSS_DOMAIN_ZALGO_PROMISE,{then:Wn(n,e,function(n,e){return r.then(n,e)},t,{on:i,send:a})})}(n,e,r,t,{on:i,send:a})},o[fn.FUNCTION]=function(r,t){return Wn(n,e,r,t,{on:i,send:a})},o[fn.OBJECT]=function(n){return W(n)||En.isProxyWindow(n)?function(n,e,r,t){var o=t.send;return hn(Z.CROSS_DOMAIN_WINDOW,En.serialize(r,{send:o}))}(0,0,n,{on:i,send:a}):n},o))}function bn(n,e,r,t){var o,i=t.on,a=t.send;return function(n,e){if(void 0===e&&(e=yn),n!==fn.UNDEFINED)return JSON.parse(n,function(n,r){if(dn(this))return r;var t,o;if(dn(r)?(t=r.__type__,o=r.__val__):(t=ln(r),o=r),!t)return o;var i=e[t]||mn[t];return i?i(o,n):o})}(r,((o={})[Z.CROSS_DOMAIN_ZALGO_PROMISE]=function(n){return e=n.then,new P(e);var e},o[Z.CROSS_DOMAIN_FUNCTION]=function(r){return function(n,e,r,t){var o=r.id,i=r.name,a=t.send,u=function(r){function t(){var u=arguments;return En.toProxyWindow(n,{send:a}).awaitWindow().then(function(n){var c=On(n,o);return c&&c.val!==t?c.val.apply({source:window,origin:h()},u):a(n,X.METHOD,{id:o,name:i,args:Array.prototype.slice.call(u)},{domain:e,fireAndForget:r.fireAndForget}).then(function(n){if(!r.fireAndForget)return n.data.result})}).catch(function(n){throw n})}return void 0===r&&(r={}),t.__name__=i,t.__origin__=e,t.__source__=n,t.__id__=o,t.origin=e,t},c=u();return c.fireAndForget=u({fireAndForget:!0}),c}(n,e,r,{on:i,send:a})},o[Z.CROSS_DOMAIN_WINDOW]=function(n){return function(n,e,r,t){var o=t.on,i=t.send;return En.deserialize(r,{on:o,send:i})}(0,0,n,{on:i,send:a})},o))}var Rn={};function jn(n,e,r,t){var o,i=t.on,a=t.send;if(E(n))throw new Error("Window is closed");for(var u,c=Sn(n,e,((o={}).__post_robot_10_0_1__=k({id:z()},r),o),{on:i,send:a}),s=!1,f=0,d=Object.keys(Rn);f<d.length;f++){var l=d[f];try{Rn[l](n,c,e),s=!0}catch(n){u=u||n}}if(!s)throw u}Rn.postrobot_post_message=function(n,e,r){(Array.isArray(r)?r:"string"==typeof r?[r]:[Y]).map(function(e){if(0===e.indexOf(i.MOCK)){if(window.location.protocol===i.FILE)return Y;if(!w(n))throw new Error("Attempting to send messsage to mock domain "+e+", but window is actually cross-domain");return l(n)}return 0===e.indexOf(i.FILE)?Y:e}).forEach(function(r){n.postMessage(e,r)})};var xn,Nn="__domain_regex__";function An(n){return $("responseListeners").get(n)}function In(n){$("responseListeners").del(n)}function Pn(n){return $("erroredResponseListeners").has(n)}function kn(n){var e=n.name,r=n.win,t=n.domain,o=rn("requestListeners");if(r===Y&&(r=null),t===Y&&(t=null),!e)throw new Error("Name required to get request listener");for(var i=0,a=[r,en()];i<a.length;i++){var u=a[i];if(u){var c=o.get(u);if(c){var s=c[e];if(s){if(t&&"string"==typeof t){if(s[t])return s[t];if(s[Nn])for(var f=0,d=s[Nn];f<d.length;f++){var l=d[f],h=l.regex,w=l.listener;if(O(h,t))return w}}if(s[Y])return s[Y]}}}}}var Dn=((xn={})[K.REQUEST]=function(n,e,r,t){var o=t.on,i=t.send,a=kn({name:r.name,win:n,domain:e});function u(t,a,u){void 0===u&&(u={}),r.fireAndForget||E(n)||jn(n,e,k({type:t,ack:a,hash:r.hash,name:r.name},u),{on:o,send:i})}return r.name===X.METHOD&&r.data&&"string"==typeof r.data.name?r.data.name:r.name,P.all([u(K.ACK),P.try(function(){if(!a)throw new Error("No handler found for post message: "+r.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!O(a.domain,e))throw new Error("Request origin "+e+" does not match domain "+a.domain.toString());var t=r.data;return a.handler({source:n,origin:e,data:t})}).then(function(n){return u(K.RESPONSE,"success",{data:n})},function(n){return u(K.RESPONSE,"error",{error:n})})]).then(U).catch(function(n){if(a&&a.handleError)return a.handleError(n);throw n})},xn[K.ACK]=function(n,e,r){if(!Pn(r.hash)){var t=An(r.hash);if(!t)throw new Error("No handler found for post message ack for message: "+r.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!O(t.domain,e))throw new Error("Ack origin "+e+" does not match domain "+t.domain.toString());if(n!==t.win)throw new Error("Ack source does not match registered window");t.ack=!0}},xn[K.RESPONSE]=function(n,e,r){if(!Pn(r.hash)){var t,i=An(r.hash);if(!i)throw new Error("No handler found for post message response for message: "+r.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!O(i.domain,e))throw new Error("Response origin "+e+" does not match domain "+(t=i.domain,Array.isArray(t)?"("+t.join(" | ")+")":o(t)?"RegExp("+t.toString():t.toString()));if(n!==i.win)throw new Error("Response source does not match registered window");In(r.hash),r.name===X.METHOD&&r.data&&"string"==typeof r.data.name?r.data.name:r.name,"error"===r.ack?i.promise.reject(r.error):"success"===r.ack&&i.promise.resolve({source:n,origin:e,data:r.data})}},xn);function Mn(n,e){var r=e.on,t=e.send,o=$("receivedMessages");if(!window||window.closed)throw new Error("Message recieved in closed window");try{if(!n.source)return}catch(n){return}var i=n.source,a=n.origin,u=function(n,e,r,t){var o,i=t.on,a=t.send;try{o=bn(e,r,n,{on:i,send:a})}catch(n){return}if(o&&"object"==typeof o&&null!==o&&(o=o.__post_robot_10_0_1__)&&"object"==typeof o&&null!==o&&o.type&&"string"==typeof o.type&&Dn[o.type])return o}(n.data,i,a,{on:r,send:t});u&&(cn(i),o.has(u.id)||(o.set(u.id,!0),E(i)&&!u.fireAndForget||Dn[u.type](i,a,u,{on:r,send:t})))}function Tn(n,e,r){if(!n)throw new Error("Expected name");if("function"==typeof e&&(r=e,e={}),!r)throw new Error("Expected handler");(e=e||{}).name=n,e.handler=r||e.handler;var t=e.window,o=e.domain,i=function n(e,r){var t=e.name,o=e.win,i=e.domain,a=rn("requestListeners");if(!t||"string"!=typeof t)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var u=[],c=0,s=o;c<s.length;c++){var f=s[c];u.push(n({name:t,domain:i,win:f},r))}return{cancel:function(){for(var n=0;n<u.length;n++)u[n].cancel()}}}if(Array.isArray(i)){for(var d=[],l=0,h=i;l<h.length;l++){var w=h[l];d.push(n({name:t,win:o,domain:w},r))}return{cancel:function(){for(var n=0;n<d.length;n++)d[n].cancel()}}}var p=kn({name:t,win:o,domain:i});if(o&&o!==Y||(o=en()),i=i||Y,p)throw o&&i?new Error("Request listener already exists for "+t+" on domain "+i.toString()+" for "+(o===en()?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+t+" for "+(o===en()?"wildcard":"specified")+" window"):i?new Error("Request listener already exists for "+t+" on domain "+i.toString()):new Error("Request listener already exists for "+t);var v,m,y=a.getOrSet(o,function(){return{}}),g=B(y,t,function(){return{}}),E=i.toString();return F(i)?(v=B(g,Nn,function(){return[]}),m={regex:i,listener:r},v.push(m)):g[E]=r,{cancel:function(){delete g[E],m&&(v.splice(v.indexOf(m,1)),v.length||delete g[Nn]),Object.keys(g).length||delete y[t],o&&!Object.keys(y).length&&a.del(o)}}}({name:n,win:t,domain:o},{handler:e.handler,handleError:e.errorHandler||function(n){throw n},window:t,domain:o||Y,name:n});return{cancel:function(){i.cancel()}}}function Cn(n,e,r){"function"==typeof(e=e||{})&&(r=e,e={});var t,o=new P;return e.errorHandler=function(n){t.cancel(),o.reject(n)},t=Tn(n,e,function(n){if(t.cancel(),o.resolve(n),r)return r(n)}),o.cancel=t.cancel,o}function Ln(n,e,r,t){var o=(t=t||{}).domain||Y,i=t.timeout||J,a=t.timeout||H,u=t.fireAndForget||!1;return P.try(function(){if(!e)throw new Error("Expected name");if(o&&"string"!=typeof o&&!Array.isArray(o)&&!F(o))throw new TypeError("Expected domain to be a string, array, or regex");if(E(n))throw new Error("Target window is closed");var t=rn("requestPromises").getOrSet(n,function(){return[]}),c=P.try(function(){return function(n,e){var r=_(e);if(r)return r===n;if(e===n)return!1;if(function(n){if(n){try{if(n.top)return n.top}catch(n){}if(s(n)===n)return n;try{if(v(window,n)&&window.top)return window.top}catch(n){}try{if(v(n,window)&&window.top)return window.top}catch(n){}for(var e=0,r=function n(e){for(var r=[],t=0,o=m(e);t<o.length;t++){var i=o[t];r.push(i);for(var a=0,u=n(i);a<u.length;a++){var c=u[a];r.push(c)}}return r}(n);e<r.length;e++){var t=r[e];try{if(t.top)return t.top}catch(n){}if(s(t)===t)return t}}}(e)===e)return!1;for(var t=0,o=m(n);t<o.length;t++)if(o[t]===e)return!0;return!1}(window,n)?function(n,e,r){void 0===e&&(e=5e3),void 0===r&&(r="Window");var t=on(n);return-1!==e&&(t=t.timeout(e,new Error(r+" did not load after "+e+"ms"))),t}(n,a):F(o)?an(n,{send:Ln}):void 0}).then(function(a){var s=(void 0===a?{}:a).domain;if(F(o)){if(!O(o,s))throw new Error("Remote window domain "+s+" does not match regex: "+o.source);o=s}e===X.METHOD&&r&&"string"==typeof r.name&&r.name;var f=!1,d=new P;d.finally(function(){f=!0,t.splice(t.indexOf(c,1))}).catch(U);var l=e+"_"+z();if(jn(n,o,{type:K.REQUEST,hash:l,name:e,data:r,fireAndForget:u},{on:Tn,send:Ln}),u)return d.resolve();d.catch(function(){!function(n){$("erroredResponseListeners").set(n,!0)}(l),In(l)});var w={name:e,win:n,domain:o,promise:d};!function(n,e){$("responseListeners").set(n,e)}(l,w);var p=function(n){return rn("knownWindows").get(n,!1)}(n)?G:q,v=i,m=p,y=v,g=100;return setTimeout(function r(){if(!f){if(E(n))return w.ack?d.reject(new Error("Window closed for "+e+" before response")):d.reject(new Error("Window closed for "+e+" before ack"));if(m=Math.max(m-g,0),-1!==y&&(y=Math.max(y-g,0)),w.ack){if(-1===y)return;g=Math.min(y,2e3)}else{if(0===m)return d.reject(new Error("No ack for postMessage "+e+" in "+h()+" in "+p+"ms"));if(0===y)return d.reject(new Error("No response for postMessage "+e+" in "+h()+" in "+v+"ms"))}setTimeout(r,g)}},g),d});return t.push(c),c})}function zn(n,e,r){return Sn(n,e,r,{on:Tn,send:Ln})}function Un(n,e,r){return bn(n,e,r,{on:Tn,send:Ln})}function Fn(n){return En.toProxyWindow(n,{send:Ln})}function Bn(){var n,e,r,t;Q().initialized||(Q().initialized=!0,function(n){var e=n.on,r=n.send;$().getOrSet("postMessageListeners",function(){return n=window,t=function(n){!function(n,e){var r=e.on,t=e.send;try{n.source}catch(n){return}var o={source:n.source||n.sourceElement,origin:n.origin||n.originalEvent&&n.originalEvent.origin,data:n.data};if(o.source){if(!o.origin)throw new Error("Post message did not have origin domain");Mn(o,{on:r,send:t})}}(n,{on:e,send:r})},n.addEventListener("message",t),{cancel:function(){n.removeEventListener("message",t)}};var n,t})}({on:Tn,send:Ln}),function(n){var e=n.on,r=n.send;$("builtinListeners").getOrSet("helloListener",function(){var n=e(X.HELLO,{domain:Y},function(n){var e=n.source,r=n.origin;return on(e).resolve({win:e,domain:r}),{instanceID:tn()}}),t=_();return t&&an(t,{send:r}).catch(U),n})}({on:Tn,send:Ln}),e=(n={on:Tn,send:Ln}).on,r=n.send,(t=Q()).receiveMessage=t.receiveMessage||function(n){return Mn(n,{on:e,send:r})})}function Hn(n){for(var e=0,r=rn("requestPromises").get(n,[]);e<r.length;e++)r[e].reject(new Error("Window cleaned up before response")).catch(U)}r.d(e,"bridge",function(){}),r.d(e,"Promise",function(){return P}),r.d(e,"TYPES",function(){return!0}),r.d(e,"ProxyWindow",function(){return En}),r.d(e,"setup",function(){return Bn}),r.d(e,"serializeMessage",function(){return zn}),r.d(e,"deserializeMessage",function(){return Un}),r.d(e,"toProxyWindow",function(){return Fn}),r.d(e,"on",function(){return Tn}),r.d(e,"once",function(){return Cn}),r.d(e,"send",function(){return Ln}),r.d(e,"markWindowKnown",function(){return cn}),r.d(e,"cleanUpWindow",function(){return Hn}),Bn()}])});
//# sourceMappingURL=post-robot.min.js.map
{
"name": "post-robot",
"version": "10.0.0",
"version": "10.0.1",
"description": "Simple postMessage based server.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -51,3 +51,3 @@ /* @flow */

export function once(name : string, options : ServerOptionsType | HandlerType, handler : ?HandlerType) : ZalgoPromise<{ source : mixed, origin : string, data : Object }> {
export function once(name : string, options? : ServerOptionsType | HandlerType, handler? : HandlerType) : ZalgoPromise<{ source : mixed, origin : string, data : Object }> {

@@ -54,0 +54,0 @@ // $FlowFixMe

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc