post-robot
Advanced tools
Comparing version 10.0.18 to 10.0.19
@@ -23,6 +23,5 @@ "use strict"; | ||
return; | ||
} // $FlowFixMe | ||
} | ||
if ((0, _src2.isSameDomain)(frame) && (0, _src2.isSameDomain)(frame) && (0, _global.getGlobal)(frame)) { | ||
if ((0, _src2.isSameDomain)(frame) && (0, _global.getGlobal)((0, _src2.assertSameDomain)(frame))) { | ||
return frame; | ||
@@ -37,4 +36,3 @@ } | ||
// eslint-disable-line prefer-const | ||
// $FlowFixMe | ||
if (frame && (0, _src2.isSameDomain)(frame) && (0, _global.getGlobal)(frame)) { | ||
if (frame && (0, _src2.isSameDomain)(frame) && (0, _global.getGlobal)((0, _src2.assertSameDomain)(frame))) { | ||
clearInterval(interval); | ||
@@ -76,6 +74,5 @@ clearTimeout(timeout); | ||
return (0, _common.rejectRemoteSendMessage)(opener, new Error(`Can not register with opener: window does not have a name`)); | ||
} // $FlowFixMe | ||
} | ||
return (0, _global.getGlobal)(bridge).openTunnelToParent({ | ||
return (0, _global.getGlobal)((0, _src2.assertSameDomain)(bridge)).openTunnelToParent({ | ||
name: window.name, | ||
@@ -82,0 +79,0 @@ source: window, |
@@ -42,5 +42,3 @@ "use strict"; | ||
return bridgePromise.then(bridge => { | ||
// $FlowFixMe | ||
if (source !== bridge) { | ||
// $FlowFixMe | ||
throw new Error(`Message source does not matched registered bridge for domain ${origin}`); | ||
@@ -59,16 +57,12 @@ } | ||
throw new Error(`Window with name ${data.name} does not exist, or was not opened by this window`); | ||
} // $FlowFixMe | ||
} | ||
if (!popupWindowsByName.get(data.name).domain) { | ||
throw new Error(`We do not have a registered domain for window ${data.name}`); | ||
} // $FlowFixMe | ||
} | ||
if (popupWindowsByName.get(data.name).domain !== origin) { | ||
// $FlowFixMe | ||
throw new Error(`Message origin ${origin} does not matched registered window origin ${popupWindowsByName.get(data.name).domain}`); | ||
} // $FlowFixMe | ||
} | ||
(0, _common.registerRemoteSendMessage)(popupWindowsByName.get(data.name).win, origin, data.sendMessage); | ||
@@ -171,3 +165,5 @@ return { | ||
// $FlowFixMe | ||
if ((0, _src2.isWindowClosed)(popupWindowsByName.get(winName).win)) { | ||
const details = popupWindowsByName.get(winName); | ||
if (!details || (0, _src2.isWindowClosed)(details.win)) { | ||
popupWindowsByName.del(winName); | ||
@@ -174,0 +170,0 @@ } |
@@ -208,4 +208,3 @@ "use strict"; | ||
const nameListeners = requestListeners.getOrSet(win, () => ({})); // $FlowFixMe | ||
const nameListeners = requestListeners.getOrSet(win, () => ({})); | ||
const domainListeners = (0, _src2.getOrSet)(nameListeners, name, () => ({})); | ||
@@ -240,7 +239,5 @@ const strDomain = domain.toString(); | ||
if (!Object.keys(domainListeners).length) { | ||
// $FlowFixMe | ||
delete nameListeners[name]; | ||
} // $FlowFixMe | ||
} | ||
if (win && !Object.keys(nameListeners).length) { | ||
@@ -247,0 +244,0 @@ requestListeners.del(win); |
@@ -181,3 +181,2 @@ "use strict"; | ||
return (0, _global.globalStore)().getOrSet('postMessageListener', () => { | ||
// $FlowFixMe | ||
return (0, _src2.addEventListener)(window, 'message', event => { | ||
@@ -184,0 +183,0 @@ // $FlowFixMe |
@@ -30,3 +30,2 @@ "use strict"; | ||
// $FlowFixMe | ||
function globalStore(key = 'store', defStore = getObj) { | ||
@@ -74,3 +73,2 @@ return (0, _src2.getOrSet)(getGlobal(), key, () => { | ||
// $FlowFixMe | ||
function windowStore(key = 'store', defStore = getObj) { | ||
@@ -77,0 +75,0 @@ return globalStore('windowStore').getOrSet(key, () => { |
@@ -10,2 +10,3 @@ "use strict"; | ||
deserializeMessage: true, | ||
createProxyWindow: true, | ||
toProxyWindow: true, | ||
@@ -20,3 +21,3 @@ on: true, | ||
}; | ||
exports.bridge = exports.cleanUpWindow = exports.markWindowKnown = exports.send = exports.once = exports.on = exports.toProxyWindow = exports.deserializeMessage = exports.serializeMessage = exports.destroy = exports.ProxyWindow = exports.Promise = void 0; | ||
exports.bridge = exports.cleanUpWindow = exports.markWindowKnown = exports.send = exports.once = exports.on = exports.toProxyWindow = exports.createProxyWindow = exports.deserializeMessage = exports.serializeMessage = exports.destroy = exports.ProxyWindow = exports.Promise = void 0; | ||
@@ -29,2 +30,3 @@ var _setup = require("./setup"); | ||
exports.deserializeMessage = _setup.deserializeMessage; | ||
exports.createProxyWindow = _setup.createProxyWindow; | ||
exports.toProxyWindow = _setup.toProxyWindow; | ||
@@ -31,0 +33,0 @@ |
@@ -64,3 +64,2 @@ "use strict"; | ||
const send = (win, name, data, options) => { | ||
// $FlowFixMe | ||
options = options || {}; | ||
@@ -67,0 +66,0 @@ let domain = options.domain || _conf.WILDCARD; |
@@ -53,3 +53,4 @@ "use strict"; | ||
function listenForFunctionCalls({ | ||
on | ||
on, | ||
send | ||
}) { | ||
@@ -87,3 +88,5 @@ return (0, _global.globalStore)('builtinListeners').getOrSet('functionCalls', () => { | ||
// $FlowFixMe | ||
return methodSource.matchWindow(source).then(match => { | ||
return methodSource.matchWindow(source, { | ||
send | ||
}).then(match => { | ||
if (!match) { | ||
@@ -125,6 +128,8 @@ throw new Error(`Method call '${data.name}' failed - proxy window does not match source in ${(0, _src.getDomain)(window)}`); | ||
function serializeFunction(destination, domain, val, key, { | ||
on | ||
on, | ||
send | ||
}) { | ||
listenForFunctionCalls({ | ||
on | ||
on, | ||
send | ||
}); | ||
@@ -131,0 +136,0 @@ const id = val.__id__ || (0, _src3.uniqueID)(); |
@@ -52,3 +52,2 @@ "use strict"; | ||
[_conf.SERIALIZATION_TYPE.CROSS_DOMAIN_WINDOW]: serializedWindow => (0, _window.deserializeWindow)(source, origin, serializedWindow, { | ||
on, | ||
send | ||
@@ -55,0 +54,0 @@ }) |
@@ -35,16 +35,17 @@ "use strict"; | ||
function getSerializedWindow(id, win, { | ||
function getSerializedWindow(winPromise, { | ||
send | ||
}) { | ||
let windowName; | ||
const id = (0, _src3.uniqueID)(); | ||
return { | ||
id, | ||
type: (0, _src.getOpener)(win) ? _src.WINDOW_TYPE.POPUP : _src.WINDOW_TYPE.IFRAME, | ||
getInstanceID: (0, _src3.memoizePromise)(() => (0, _lib.getWindowInstanceID)(win, { | ||
getType: () => winPromise.then(win => { | ||
return (0, _src.getOpener)(win) ? _src.WINDOW_TYPE.POPUP : _src.WINDOW_TYPE.IFRAME; | ||
}), | ||
getInstanceID: (0, _src3.memoizePromise)(() => winPromise.then(win => (0, _lib.getWindowInstanceID)(win, { | ||
send | ||
})), | ||
close: () => _src2.ZalgoPromise.try(() => { | ||
(0, _src.closeWindow)(win); | ||
}), | ||
getName: () => _src2.ZalgoPromise.try(() => { | ||
}))), | ||
close: () => winPromise.then(_src.closeWindow), | ||
getName: () => winPromise.then(win => { | ||
if ((0, _src.isWindowClosed)(win)) { | ||
@@ -56,9 +57,9 @@ return; | ||
}), | ||
focus: () => _src2.ZalgoPromise.try(() => { | ||
focus: () => winPromise.then(win => { | ||
win.focus(); | ||
}), | ||
isClosed: () => _src2.ZalgoPromise.try(() => { | ||
isClosed: () => winPromise.then(win => { | ||
return (0, _src.isWindowClosed)(win); | ||
}), | ||
setLocation: href => _src2.ZalgoPromise.try(() => { | ||
setLocation: href => winPromise.then(win => { | ||
if ((0, _src.isSameDomain)(win)) { | ||
@@ -77,3 +78,3 @@ try { | ||
}), | ||
setName: name => _src2.ZalgoPromise.try(() => { | ||
setName: name => winPromise.then(win => { | ||
if (__POST_ROBOT__.__IE_POPUP_SUPPORT__) { | ||
@@ -86,7 +87,7 @@ (0, _bridge.linkWindow)({ | ||
win = (0, _src.assertSameDomain)(win); | ||
win.name = name; | ||
const sameDomainWin = (0, _src.assertSameDomain)(win); | ||
sameDomainWin.name = name; | ||
if (win.frameElement) { | ||
win.frameElement.setAttribute('name', name); | ||
if (sameDomainWin.frameElement) { | ||
sameDomainWin.frameElement.setAttribute('name', name); | ||
} | ||
@@ -100,5 +101,8 @@ | ||
class ProxyWindow { | ||
constructor(serializedWindow, actualWindow, { | ||
send | ||
constructor({ | ||
send, | ||
win, | ||
serializedWindow | ||
}) { | ||
this.id = void 0; | ||
this.isProxyWindow = true; | ||
@@ -110,13 +114,19 @@ this.serializedWindow = void 0; | ||
this.name = void 0; | ||
this.serializedWindow = serializedWindow; | ||
this.actualWindowPromise = new _src2.ZalgoPromise(); | ||
this.send = send; | ||
this.serializedWindow = serializedWindow || getSerializedWindow(this.actualWindowPromise, { | ||
send | ||
}); | ||
(0, _global.globalStore)('idToProxyWindow').set(this.getID(), this); | ||
if (actualWindow) { | ||
this.setWindow(actualWindow); | ||
if (win) { | ||
this.setWindow(win); | ||
} | ||
} | ||
getID() { | ||
return this.serializedWindow.id; | ||
} | ||
getType() { | ||
return this.serializedWindow.type; | ||
return this.serializedWindow.getType(); | ||
} | ||
@@ -128,6 +138,2 @@ | ||
isIframe() { | ||
return this.getType() === _src.WINDOW_TYPE.IFRAME; | ||
} | ||
setLocation(href) { | ||
@@ -137,2 +143,6 @@ return this.serializedWindow.setLocation(href).then(() => this); | ||
getName() { | ||
return this.serializedWindow.getName(); | ||
} | ||
setName(name) { | ||
@@ -147,9 +157,7 @@ return this.serializedWindow.setName(name).then(() => this); | ||
focus() { | ||
return _src2.ZalgoPromise.try(() => { | ||
return _src2.ZalgoPromise.all([this.isPopup() && this.serializedWindow.getName().then(name => { | ||
if (name) { | ||
window.open('', name); | ||
} | ||
}), this.serializedWindow.focus()]); | ||
}).then(() => this); | ||
return _src2.ZalgoPromise.all([this.isPopup() && this.getName().then(name => { | ||
if (name) { | ||
window.open('', name); | ||
} | ||
}), this.serializedWindow.focus()]).then(() => this); | ||
} | ||
@@ -167,6 +175,4 @@ | ||
this.actualWindow = win; | ||
this.serializedWindow = getSerializedWindow(this.serializedWindow.id, win, { | ||
send: this.send | ||
}); | ||
this.actualWindowPromise.resolve(win); | ||
this.actualWindowPromise.resolve(this.actualWindow); | ||
(0, _global.windowStore)('winToProxyWindow').set(win, this); | ||
} | ||
@@ -178,3 +184,5 @@ | ||
matchWindow(win) { | ||
matchWindow(win, { | ||
send | ||
}) { | ||
return _src2.ZalgoPromise.try(() => { | ||
@@ -188,3 +196,3 @@ if (this.actualWindow) { | ||
knownWindowInstanceID: (0, _lib.getWindowInstanceID)(win, { | ||
send: this.send | ||
send | ||
}) | ||
@@ -214,2 +222,6 @@ }).then(({ | ||
shouldClean() { | ||
return Boolean(this.actualWindow && (0, _src.isWindowClosed)(this.actualWindow)); | ||
} | ||
serialize() { | ||
@@ -219,6 +231,2 @@ return this.serializedWindow; | ||
shouldClean() { | ||
return this.actualWindow && (0, _src.isWindowClosed)(this.actualWindow); | ||
} | ||
static unwrap(win) { | ||
@@ -239,11 +247,8 @@ return ProxyWindow.isProxyWindow(win) // $FlowFixMe | ||
static deserialize(serializedWindow, { | ||
on, | ||
send | ||
}) { | ||
cleanupProxyWindows(); | ||
return (0, _global.globalStore)('idToProxyWindow').getOrSet(serializedWindow.id, () => { | ||
return new ProxyWindow(serializedWindow, null, { | ||
on, | ||
send | ||
}); | ||
return (0, _global.globalStore)('idToProxyWindow').get(serializedWindow.id) || new ProxyWindow({ | ||
serializedWindow, | ||
send | ||
}); | ||
@@ -268,13 +273,6 @@ } | ||
const realWin = win; // $FlowFixMe | ||
return (0, _global.windowStore)('winToProxyWindow').getOrSet(win, () => { | ||
const id = (0, _src3.uniqueID)(); | ||
const serializedWindow = getSerializedWindow(id, realWin, { | ||
send | ||
}); | ||
const proxyWindow = new ProxyWindow(serializedWindow, realWin, { | ||
send | ||
}); | ||
return (0, _global.globalStore)('idToProxyWindow').set(id, proxyWindow); | ||
const actualWindow = win; | ||
return (0, _global.windowStore)('winToProxyWindow').get(actualWindow) || new ProxyWindow({ | ||
win: actualWindow, | ||
send | ||
}); | ||
@@ -296,9 +294,7 @@ } | ||
function deserializeWindow(source, origin, win, { | ||
on, | ||
send | ||
}) { | ||
return ProxyWindow.deserialize(win, { | ||
on, | ||
send | ||
}); | ||
} |
@@ -6,2 +6,3 @@ "use strict"; | ||
exports.deserializeMessage = deserializeMessage; | ||
exports.createProxyWindow = createProxyWindow; | ||
exports.toProxyWindow = toProxyWindow; | ||
@@ -37,2 +38,9 @@ exports.setup = setup; | ||
function createProxyWindow(win) { | ||
return new _serialize.ProxyWindow({ | ||
send: _public.send, | ||
win | ||
}); | ||
} | ||
function toProxyWindow(win) { | ||
@@ -39,0 +47,0 @@ return _serialize.ProxyWindow.toProxyWindow(win, { |
@@ -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{}.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]"==={}.toString.call(n)}r.r(t),r.d(t,"WeakMap",function(){return X});var i={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},a="*",u={IFRAME:"iframe",POPUP:"popup"},s="Call was rejected by callee.\r\n";function c(n){return void 0===n&&(n=window),n.location.protocol===i.ABOUT}function f(n){if(void 0===n&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch(n){}}function d(n){if(void 0===n&&(n=window),n&&!f(n))try{return n.opener}catch(n){}}function w(n){try{return!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=f(n);return t&&w()?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 m(n){if(!function(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)&&w())return!0}catch(n){}try{if(l(n)===l(window))return!0}catch(n){}return!1}(n))return!1;try{if(n===window)return!0;if(c(n)&&w())return!0;if(h(window)===h(n))return!0}catch(n){}return!1}function v(n,e){if(!n||!e)return!1;var r=f(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++)e.push(a[i])}return e}function y(n){if(n){try{if(n.top)return n.top}catch(n){}if(f(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(f(t)===t)return t}}}function _(n){var e=y(n);if(!e)throw new Error("Can not determine top window");return[].concat(g(e),[e])}var E=[],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!==s}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}(E,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 x(n,e){return n===d(e)}function A(n){return void 0===n&&(n=window),d(n=n||window)||f(n)||void 0}function R(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 N(n,e){var r=y(n)||n,t=y(e)||e;try{if(r&&t)return r===t}catch(n){}var o=_(n),i=_(e);if(R(o,i))return!0;var a=d(r),u=d(t);return!(a&&R(_(a),i)||(u&&R(_(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 k(n){return n.match(/^(https?|mock|file):\/\//)?n.split("/").slice(0,3).join("/"):h()}function I(n){try{if(n===window)return!0}catch(n){if(n&&n.message===s)return!0}try{if("[object Window]"==={}.toString.call(n))return!0}catch(n){if(n&&n.message===s)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(n){if(n&&n.message===s)return!0}try{if(n&&n.self===n)return!0}catch(n){if(n&&n.message===s)return!0}try{if(n&&n.parent===n)return!0}catch(n){if(n&&n.message===s)return!0}try{if(n&&n.top===n)return!0}catch(n){if(n&&n.message===s)return!0}try{if(n&&"__unlikely_value__"===n.__cross_domain_utils_window_check__)return!1}catch(n){return!0}return!1}function P(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 j,D=[],T=[],C=0;function L(){if(!C&&j){var n=j;j=null,n.resolve()}}function F(){C+=1}function B(){C-=1,L()}var z=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;F();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 B(),void this.reject(n)}B(),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(P(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(P(n))throw new Error("Can not reject promise with another promise");if(!n){var r=n&&"function"==typeof n.toString?n.toString():{}.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===D.indexOf(n)){D.push(n),setTimeout(function(){throw n},1);for(var r=0;r<T.length;r++)T[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.resolved,t=this.rejected,o=this.handlers;if(!this.dispatching&&(r||t)){this.dispatching=!0,F();for(var i=function(i){var a=o[i],u=a.onSuccess,s=a.onError,c=a.promise,f=void 0;if(r)try{f=u?u(e.value):e.value}catch(n){return c.reject(n),"continue"}else if(t){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):P(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)},a=0;a<o.length;a++)i(a);o.length=0,this.dispatching=!1,B()}},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:P(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(!P(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 T.push(n),{cancel:function(){T.splice(T.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;F();try{o=e.apply(r,t||[])}catch(e){return B(),n.reject(e)}return B(),n.resolve(o)},n.delay=function(e){return new n(function(n){setTimeout(n,e)})},n.isPromise=function(e){return!!(e&&e instanceof n)||P(e)},n.flush=function(){return e=j=j||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)({}).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,X=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(I(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){return!I(n)},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))try{var t=this.name,o=n[t];return void(o&&o[0]===n?o[1]=e:G(n,t,{value:[n,e],writable:!0}))}catch(n){}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))try{var r=n[this.name];return r&&r[0]===n?r[1]:void 0}catch(n){}this._cleanupClosedWindows();var t=H(this.keys,n);if(-1!==t)return this.values[t]},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))try{var r=n[this.name];r&&r[0]===n&&(r[0]=r[1]=void 0)}catch(n){}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))try{var r=n[this.name];return!(!r||r[0]!==n)}catch(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 Y(){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 Z(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([].slice.call(n),function(n,e){return"function"==typeof e?"memoize["+function(n){if(q=q||new X,null==n||"object"!=typeof n&&"function"!=typeof n)throw new Error("Invalid object");var e=q.get(n);return e||(e=typeof n+":"+Y(),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}function K(){}function Q(n,e){if(void 0===e&&(e=1),e>=3)return"stringifyError stack overflow";try{if(!n)return"<unknown error: "+{}.toString.call(n)+">";if("string"==typeof n)return n;if(n instanceof Error){var r=n&&n.stack,t=n&&n.message;if(r&&t)return-1!==r.indexOf(t)?r:t+"\n"+r;if(r)return r;if(t)return t}return n&&n.toString&&"function"==typeof n.toString?n.toString():{}.toString.call(n)}catch(n){return"Error while stringifying error: "+Q(n,e+1)}}function V(n){return"string"==typeof n?n:n&&n.toString&&"function"==typeof n.toString?n.toString():{}.toString.call(n)}function $(n){return"[object RegExp]"==={}.toString.call(n)}function nn(n,e,r){if(n.hasOwnProperty(e))return n[e];var t=r();return n[e]=t,t}Object.create(Error.prototype);var en={METHOD:"postrobot_method",HELLO:"postrobot_hello",OPEN_TUNNEL:"postrobot_open_tunnel"},rn="__postrobot_bridge__",tn="*",on={CROSS_DOMAIN_ZALGO_PROMISE:"cross_domain_zalgo_promise",CROSS_DOMAIN_FUNCTION:"cross_domain_function",CROSS_DOMAIN_WINDOW:"cross_domain_window"};function an(n){return void 0===n&&(n=window),n!==window?n.__post_robot_10_0_18__:n.__post_robot_10_0_18__=n.__post_robot_10_0_18__||{}}var un=function(){return{}};function sn(n,e){return void 0===n&&(n="store"),void 0===e&&(e=un),nn(an(),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 nn(n,e,r)},reset:function(){n=e()},keys:function(){return Object.keys(n)}}})}var cn=function(){};function fn(){var n=an();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new cn,n.WINDOW_WILDCARD}function dn(n,e){return void 0===n&&(n="store"),void 0===e&&(e=un),sn("windowStore").getOrSet(n,function(){var r=new X,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 nn(t(e),n,r)}}})}function wn(){return sn("instance").getOrSet("instanceID",Y)}function ln(n){return dn("helloPromises").getOrSet(n,function(){return new z})}function hn(n,e){return(0,e.send)(n,en.HELLO,{instanceID:wn()},{domain:tn,timeout:-1}).then(function(e){var r=e.origin,t=e.data.instanceID;return ln(n).resolve({win:n,domain:r}),{win:n,domain:r,instanceID:t}})}function mn(n,e){var r=e.send;return dn("windowInstanceIDPromises").getOrSet(n,function(){return hn(n,{send:r}).then(function(n){return n.instanceID})})}function vn(n,e,r){void 0===e&&(e=5e3),void 0===r&&(r="Window");var t=ln(n);return-1!==e&&(t=t.timeout(e,new Error(r+" did not load after "+e+"ms"))),t}function pn(n){dn("knownWindows").set(n,!0)}var gn,yn={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 _n(n){return"object"==typeof n&&null!==n&&"string"==typeof n.__type__}function En(n){return void 0===n?yn.UNDEFINED:null===n?yn.NULL:Array.isArray(n)?yn.ARRAY:"function"==typeof n?yn.FUNCTION:"object"==typeof n?n instanceof Error?yn.ERROR:"function"==typeof n.then?yn.PROMISE:"[object RegExp]"==={}.toString.call(n)?yn.REGEX:"[object Date]"==={}.toString.call(n)?yn.DATE:yn.OBJECT:"string"==typeof n?yn.STRING:"number"==typeof n?yn.NUMBER:"boolean"==typeof n?yn.BOOLEAN:void 0}function On(n,e){return{__type__:n,__val__:e}}var bn,Wn=((gn={})[yn.FUNCTION]=function(){},gn[yn.ERROR]=function(n){return On(yn.ERROR,{message:n.message,stack:n.stack,code:n.code})},gn[yn.PROMISE]=function(){},gn[yn.REGEX]=function(n){return On(yn.REGEX,n.source)},gn[yn.DATE]=function(n){return On(yn.DATE,n.toJSON())},gn[yn.ARRAY]=function(n){return n},gn[yn.OBJECT]=function(n){return n},gn[yn.STRING]=function(n){return n},gn[yn.NUMBER]=function(n){return n},gn[yn.BOOLEAN]=function(n){return n},gn[yn.NULL]=function(n){return n},gn),Sn={},xn=((bn={})[yn.FUNCTION]=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},bn[yn.ERROR]=function(n){var e=n.stack,r=n.code,t=new Error(n.message);return t.code=r,t.stack=e+"\n\n"+t.stack,t},bn[yn.PROMISE]=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},bn[yn.REGEX]=function(n){return new RegExp(n)},bn[yn.DATE]=function(n){return new Date(n)},bn[yn.ARRAY]=function(n){return n},bn[yn.OBJECT]=function(n){return n},bn[yn.STRING]=function(n){return n},bn[yn.NUMBER]=function(n){return n},bn[yn.BOOLEAN]=function(n){return n},bn[yn.NULL]=function(n){return n},bn),An={};function Rn(){return!!W(window).match(/MSIE|trident|edge\/12|edge\/13/i)}function Nn(n){return!N(window,n)}function Mn(n,e){if(n){if(h()!==k(n))return!0}else if(e&&!m(e))return!0;return!1}function kn(n){var e=n.win,r=n.domain;return!(!Rn()||r&&!Mn(r,e)||e&&!Nn(e))}function In(n){var e=(n=n||k(n)).replace(/[^a-zA-Z0-9]+/g,"_");return rn+"_"+e}function Pn(){return Boolean(window.name&&window.name===In(h()))}var jn=new z(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 Dn(n){dn("remoteWindowPromises").getOrSet(n,function(){return new z})}function Tn(n){var e=dn("remoteWindowPromises").get(n);if(!e)throw new Error("Remote window promise not found");return e}function Cn(n,e,r){Tn(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 Ln(n,e){Tn(n).reject(e).catch(K)}function Fn(n){for(var e=n.win,r=n.name,t=n.domain,o=sn("popupWindowsByName"),i=dn("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,Dn(e)),i.set(e,c),c}function Bn(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!==k(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?k(n):null}),a):a},function(n){var e=n.on,r=n.send,t=n.receiveMessage,o=sn("popupWindowsByName");e(en.OPEN_TUNNEL,function(n){var i=n.source,a=n.origin,u=n.data,s=sn("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 Cn(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){z.reject(n)}}}}})})}({on:r,send:t,receiveMessage:o}),function(n){var e=n.send;an(window).openTunnelToParent=function(n){var r=n.name,t=n.source,o=n.canary,i=n.sendMessage,a=sn("tunnelWindows"),u=f(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=sn("tunnelWindows"),e=0,r=n.keys();e<r.length;e++){var t=r[e];b(n[t].source)&&n.del(t)}}();var i=Y();return sn("tunnelWindows").set(i,{name:e,source:r,canary:t,sendMessage:o}),i}({name:r,source:t,canary:o,sendMessage:i});return e(u,en.OPEN_TUNNEL,{name:r,sendMessage:function(){var n=a.get(s);if(n&&n.source&&!b(n.source)){try{n.canary()}catch(n){return}n.sendMessage.apply(this,arguments)}}},{domain:tn})}}({on:r,send:t}),function(n){var e=n.on,r=n.send,t=n.receiveMessage;z.try(function(){var n,o=d(window);if(o&&kn({win:o}))return Dn(o),(n=o,dn("remoteBridgeAwaiters").getOrSet(n,function(){return z.try(function(){var e=S(n,In(h()));if(e)return m(e)&&m(e)&&an(e)?e:new z(function(n){var r,t;r=setInterval(function(){if(e&&m(e)&&an(e))return clearInterval(r),clearTimeout(t),n(e)},100),t=setTimeout(function(){return clearInterval(r),n()},2e3)})})})).then(function(n){return n?window.name?an(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){z.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");Cn(e,r,t.sendMessage)}).catch(function(n){throw Ln(o,n),n}):Ln(o,new Error("Can not register with opener: window does not have a name")):Ln(o,new Error("Can not register with opener: no bridge found in opener"))})})}({on:r,send:t,receiveMessage:o})}function zn(){for(var n=sn("idToProxyWindow"),e=0,r=n.keys();e<r.length;e++){var t=r[e];n.get(t).shouldClean()&&n.del(t)}}function Un(n,e,r){var t,o=r.send;return{id:n,type:d(e)?u.POPUP:u.IFRAME,getInstanceID:Z(function(){return mn(e,{send:o})}),close:function(){return z.try(function(){!function(n){try{n.close()}catch(n){}}(e)})},getName:function(){return z.try(function(){if(!b(e))return t})},focus:function(){return z.try(function(){e.focus()})},isClosed:function(){return z.try(function(){return b(e)})},setLocation:function(n){return z.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 z.try(function(){Fn({win:e,name:n}),(e=function(n){if(!m(n))throw new Error("Expected window to be same domain");return n}(e)).name=n,e.frameElement&&e.frameElement.setAttribute("name",n),t=n})}}}var Hn=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.name=void 0,this.serializedWindow=n,this.actualWindowPromise=new z,this.send=t,e&&this.setWindow(e)}var e=n.prototype;return e.getType=function(){return this.serializedWindow.type},e.isPopup=function(){return this.getType()===u.POPUP},e.isIframe=function(){return this.getType()===u.IFRAME},e.setLocation=function(n){var e=this;return this.serializedWindow.setLocation(n).then(function(){return e})},e.setName=function(n){var e=this;return this.serializedWindow.setName(n).then(function(){return e})},e.close=function(){var n=this;return this.serializedWindow.close().then(function(){return n})},e.focus=function(){var n=this;return z.try(function(){return z.all([n.isPopup()&&n.serializedWindow.getName().then(function(n){n&&window.open("",n)}),n.serializedWindow.focus()])}).then(function(){return n})},e.isClosed=function(){return this.serializedWindow.isClosed()},e.getWindow=function(){return this.actualWindow},e.setWindow=function(n){this.actualWindow=n,this.serializedWindow=Un(this.serializedWindow.id,n,{send:this.send}),this.actualWindowPromise.resolve(n)},e.awaitWindow=function(){return this.actualWindowPromise},e.matchWindow=function(n){var e=this;return z.try(function(){return e.actualWindow?n===e.actualWindow:z.hash({proxyInstanceID:e.getInstanceID(),knownWindowInstanceID:mn(n,{send:e.send})}).then(function(r){var t=r.proxyInstanceID===r.knownWindowInstanceID;return t&&e.setWindow(n),t})})},e.unwrap=function(){return this.actualWindow||this},e.getInstanceID=function(){return 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 zn(),n.toProxyWindow(e,{send:t}).serialize()},n.deserialize=function(e,r){var t=r.on,o=r.send;return zn(),sn("idToProxyWindow").getOrSet(e.id,function(){return new n(e,null,{on:t,send:o})})},n.isProxyWindow=function(n){return Boolean(n&&!I(n)&&n.isProxyWindow)},n.toProxyWindow=function(e,r){var t=r.send;if(zn(),n.isProxyWindow(e))return e;var o=e;return dn("winToProxyWindow").getOrSet(e,function(){var e=Y(),r=new n(Un(e,o,{send:t}),o,{send:t});return sn("idToProxyWindow").set(e,r)})},n}();function qn(n,e,r,t,o){var i=dn("methodStore"),a=sn("proxyWindowMethods");Hn.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 Gn(n,e){var r=dn("methodStore"),t=sn("proxyWindowMethods");return r.getOrSet(n,function(){return{}})[e]||t.get(e)}function Jn(n,e,r,t,o){!function(n){var e=o.on;sn("builtinListeners").getOrSet("functionCalls",function(){return e(en.METHOD,{domain:tn},function(n){var e=n.source,r=n.origin,t=n.data,o=t.id,i=t.name,a=Gn(e,o);if(!a)throw new Error("Could not find method '"+t.name+"' with id: "+t.id+" in "+h(window));var u=a.source,s=a.domain,c=a.val;return z.try(function(){if(!M(s,r))throw new Error("Method '"+t.name+"' domain "+JSON.stringify($(a.domain)?a.domain.source:a.domain)+" does not match origin "+r+" in "+h(window));if(Hn.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 c.apply({source:e,origin:r},t.args)},function(n){return z.try(function(){if(c.onError)return c.onError(n)}).then(function(){throw n.stack&&(n.stack="Remote call to "+i+"()\n\n"+n.stack),n})}).then(function(n){return{result:n,id:o,name:i}})})})}();var i=r.__id__||Y();n=Hn.unwrap(n);var a=r.__name__||r.name||t;return Hn.isProxyWindow(n)?(qn(i,r,a,n,e),n.awaitWindow().then(function(n){qn(i,r,a,n,e)})):qn(i,r,a,n,e),On(on.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=Sn);var r=JSON.stringify(n,function(n){var r=this[n];if(_n(this))return r;var t=En(r);if(!t)return r;var o=e[t]||Wn[t];return o?o(r,n):r});return void 0===r?yn.UNDEFINED:r}(r,((o={})[yn.PROMISE]=function(r,t){return function(n,e,r,t,o){return On(on.CROSS_DOMAIN_ZALGO_PROMISE,{then:Jn(n,e,function(n,e){return r.then(n,e)},t,{on:o.on,send:o.send})})}(n,e,r,t,{on:i,send:a})},o[yn.FUNCTION]=function(r,t){return Jn(n,e,r,t,{on:i,send:a})},o[yn.OBJECT]=function(n){return I(n)||Hn.isProxyWindow(n)?On(on.CROSS_DOMAIN_WINDOW,Hn.serialize(n,{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=An),n!==yn.UNDEFINED)return JSON.parse(n,function(n,r){if(_n(this))return r;var t,o;if(_n(r)?(t=r.__type__,o=r.__val__):(t=En(r),o=r),!t)return o;var i=e[t]||xn[t];return i?i(o,n):o})}(r,((o={})[on.CROSS_DOMAIN_ZALGO_PROMISE]=function(n){return new z(n.then)},o[on.CROSS_DOMAIN_FUNCTION]=function(r){return function(n,e,t,o){var i=r.id,a=r.name,u=o.send,s=function(r){function t(){var o=arguments;return Hn.toProxyWindow(n,{send:u}).awaitWindow().then(function(n){var s=Gn(n,i);if(s&&s.val!==t)return s.val.apply({source:window,origin:h()},o);var c={domain:e,fireAndForget:r.fireAndForget},f=[].slice.call(o);return u(n,en.METHOD,{id:i,name:a,args:f},c).then(function(n){if(!r.fireAndForget)return n.data.result})}).catch(function(n){throw n})}return void 0===r&&(r={}),t.__name__=a,t.__origin__=e,t.__source__=n,t.__id__=i,t.origin=e,t},c=s();return c.fireAndForget=s({fireAndForget:!0}),c}(n,e,0,{on:i,send:a})},o[on.CROSS_DOMAIN_WINDOW]=function(n){return Hn.deserialize(n,{on:(e={on:i,send:a}).on,send:e.send});var e},o))}var Zn={};function Kn(n,e,r,t){var o,i=t.on,a=t.send;if(b(n))throw new Error("Window is closed");for(var u=Xn(n,e,((o={}).__post_robot_10_0_18__=U({id:Y(),origin:h(window)},r),o),{on:i,send:a}),s=Object.keys(Zn),c=[],f=0;f<s.length;f++){var d=s[f];try{Zn[d](n,u,e)}catch(n){c.push(n)}}if(c.length===s.length)throw new Error("All post-robot messaging strategies failed:\n\n"+c.map(Q).join("\n\n"))}Zn.postrobot_post_message=function(n,e,r){(Array.isArray(r)?r:"string"==typeof r?[r]:[tn]).map(function(n){return 0===n.indexOf(i.FILE)?tn:n}).forEach(function(r){n.postMessage(e,r)})},Zn.postrobot_bridge=function(n,e,r){if(Rn()||Pn()){if(m(n))throw new Error("Post message through bridge disabled between same domain windows");if(!1!==N(window,n))throw new Error("Can only use bridge to communicate between two different windows, not between frames");!function(n,e,r){var t=x(window,n),o=x(n,window);if(!t&&!o)throw new Error("Can only send messages to and from parent and popup windows");Tn(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!==N(window,n))throw new Error("Can only use global to communicate between two different windows, not between frames");var r=an(n);if(!r)throw new Error("Can not find postRobot global on foreign window");r.receiveMessage({source:window,origin:h(),data:e})}};var Qn,Vn="__domain_regex__";function $n(n){return sn("responseListeners").get(n)}function ne(n){sn("responseListeners").del(n)}function ee(n){return sn("erroredResponseListeners").has(n)}function re(n){var e=n.name,r=n.win,t=n.domain,o=dn("requestListeners");if(r===tn&&(r=null),t===tn&&(t=null),!e)throw new Error("Name required to get request listener");for(var i=0,a=[r,fn()];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[Vn])for(var f=0,d=c[Vn];f<d.length;f++){var w=d[f],l=w.listener;if(M(w.regex,t))return l}}if(c[tn])return c[tn]}}}}}var te=((Qn={}).postrobot_message_request=function(n,e,r,t){var o=t.on,i=t.send,a=re({name:r.name,win:n,domain:e});function u(t,a,u){void 0===u&&(u={}),r.fireAndForget||b(n)||Kn(n,e,U({type:t,ack:a,hash:r.hash,name:r.name},u),{on:o,send:i})}return z.all([u("postrobot_message_ack"),z.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());return a.handler({source:n,origin:e,data:r.data})}).then(function(n){return u("postrobot_message_response","success",{data:n})},function(n){return u("postrobot_message_response","error",{error:n})})]).then(K).catch(function(n){if(a&&a.handleError)return a.handleError(n);throw n})},Qn.postrobot_message_ack=function(n,e,r){if(!ee(r.hash)){var t=$n(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}},Qn.postrobot_message_response=function(n,e,r){if(!ee(r.hash)){var t,i=$n(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");ne(r.hash),"error"===r.ack?i.promise.reject(r.error):"success"===r.ack&&i.promise.resolve({source:n,origin:e,data:r.data})}},Qn);function oe(n,e){var r=e.on,t=e.send,o=sn("receivedMessages");if(!window||window.closed)throw new Error("Message recieved in closed window");try{if(!n.source)return}catch(n){return}var a=n.source,u=n.origin,s=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_18__)&&"object"==typeof o&&null!==o&&o.type&&"string"==typeof o.type&&te[o.type])return o}(n.data,a,u,{on:r,send:t});s&&(pn(a),o.has(s.id)||(o.set(s.id,!0),b(a)&&!s.fireAndForget||(0===s.origin.indexOf(i.FILE)&&(u=i.FILE+"//"),te[s.type](a,u,s,{on:r,send:t}))))}function ie(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=dn("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++)u.push(n({name:t,domain:i,win:c[s]},r));return{cancel:function(){for(var n=0;n<u.length;n++)u[n].cancel()}}}if(Array.isArray(i)){for(var f=[],d=0,w=i;d<w.length;d++)f.push(n({name:t,win:o,domain:w[d]},r));return{cancel:function(){for(var n=0;n<f.length;n++)f[n].cancel()}}}var l=re({name:t,win:o,domain:i});if(o&&o!==tn||(o=fn()),i=i||tn,l)throw o&&i?new Error("Request listener already exists for "+t+" on domain "+i.toString()+" for "+(o===fn()?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+t+" for "+(o===fn()?"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 h,m,v=a.getOrSet(o,function(){return{}}),p=nn(v,t,function(){return{}}),g=i.toString();return $(i)?(h=nn(p,Vn,function(){return[]})).push(m={regex:i,listener:r}):p[g]=r,{cancel:function(){delete p[g],m&&(h.splice(h.indexOf(m,1)),h.length||delete p[Vn]),Object.keys(p).length||delete v[t],o&&!Object.keys(v).length&&a.del(o)}}}({name:n,win:t,domain:o},{handler:e.handler,handleError:e.errorHandler||function(n){throw n},window:t,domain:o||tn,name:n});return{cancel:function(){i.cancel()}}}function ae(n,e,r){"function"==typeof(e=e||{})&&(r=e,e={});var t,o=new z;return e.errorHandler=function(n){t.cancel(),o.reject(n)},t=ie(n,e,function(n){if(t.cancel(),o.resolve(n),r)return r(n)}),o.cancel=t.cancel,o}var ue,se=function n(e,r,t,o){var i=(o=o||{}).domain||tn,a=o.timeout||-1,u=o.timeout||5e3,s=o.fireAndForget||!1;return z.try(function(){return function(n,e,r){if(!n)throw new Error("Expected name");if(r&&"string"!=typeof r&&!Array.isArray(r)&&!$(r))throw new TypeError("Expected domain to be a string, array, or regex");if(b(e))throw new Error("Target window is closed")}(r,e,i),function(n,e,r,t){var o=t.send;return z.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)?vn(n,r):$(e)?hn(n,{send:o}):{domain:e}}).then(function(n){return n.domain})}(e,i,u,{send:n})}).then(function(o){if(!M(i,o))throw new Error("Domain "+V(i)+" does not match "+V(o));i=o;var u,c,f=r===en.METHOD&&t&&"string"==typeof t.name?t.name+"()":r,d=new z,w=r+"_"+Y();if(!s){var l={name:r,win:e,domain:i,promise:d};!function(n,e){sn("responseListeners").set(n,e)}(w,l);var m=dn("requestPromises").getOrSet(e,function(){return[]});m.push(d),d.catch(function(){!function(n){sn("erroredResponseListeners").set(n,!0)}(w),ne(w)});var v=function(n){return dn("knownWindows").get(n,!1)}(e)?1e4:2e3,p=a,g=v,y=p,_=(u=function(){return b(e)?d.reject(new Error("Window closed for "+r+" before "+(l.ack?"response":"ack"))):l.cancelled?d.reject(new Error("Response listener was cancelled for "+r)):(g=Math.max(g-500,0),-1!==y&&(y=Math.max(y-500,0)),l.ack||0!==g?0===y?d.reject(new Error("No response for postMessage "+f+" in "+h()+" in "+p+"ms")):void 0:d.reject(new Error("No ack for postMessage "+f+" in "+h()+" in "+v+"ms")))},500,function n(){c=setTimeout(function(){u(),n()},500)}(),{cancel:function(){clearTimeout(c)}});d.finally(function(){_.cancel(),m.splice(m.indexOf(d,1))}).catch(K)}return Kn(e,i,{type:"postrobot_message_request",hash:w,name:r,data:t,fireAndForget:s},{on:ie,send:n}),s?d.resolve():d})};function ce(n,e,r){return Xn(n,e,r,{on:ie,send:se})}function fe(n,e,r){return Yn(n,e,r,{on:ie,send:se})}function de(n){return Hn.toProxyWindow(n,{send:se})}function we(){var n,e,r;an().initialized||(an().initialized=!0,function(n){var e=n.on,r=n.send,t=an();t.receiveMessage=t.receiveMessage||function(n){return oe(n,{on:e,send:r})}}({on:ie,send:se}),e=(n={on:ie,send:se}).on,r=n.send,sn().getOrSet("postMessageListener",function(){return(n=window).addEventListener("message",t=function(n){!function(n,e){var r=e.on,t=e.send,o=n.source||n.sourceElement,a=n.origin||n.originalEvent&&n.originalEvent.origin,u=n.data;if("null"===a&&(a=i.FILE+"//"),o){if(!a)throw new Error("Post message did not have origin domain");oe({source:o,origin:a,data:u},{on:r,send:t})}}(n,{on:e,send:r})}),{cancel:function(){n.removeEventListener("message",t)}};var n,t}),Bn({on:ie,send:se,receiveMessage:oe}),function(n){var e=n.on,r=n.send;sn("builtinListeners").getOrSet("helloListener",function(){var n=e(en.HELLO,{domain:tn},function(n){var e=n.source,r=n.origin;return ln(e).resolve({win:e,domain:r}),{instanceID:wn()}}),t=A();return t&&hn(t,{send:r}).catch(K),n})}({on:ie,send:se}))}function le(){var n;!function(){for(var n=sn("responseListeners"),e=0,r=n.keys();e<r.length;e++){var t=r[e],o=n.get(t);o&&(o.cancelled=!0),n.del(t)}}(),(n=sn().get("postMessageListener"))&&n.cancel(),delete window.__post_robot_10_0_18__}function he(n){for(var e=0,r=dn("requestPromises").get(n,[]);e<r.length;e++)r[e].reject(new Error("Window cleaned up before response")).catch(K)}r.d(e,"bridge",function(){return ue}),r.d(e,"Promise",function(){return z}),r.d(e,"TYPES",function(){return!0}),r.d(e,"ProxyWindow",function(){return Hn}),r.d(e,"setup",function(){return we}),r.d(e,"destroy",function(){return le}),r.d(e,"serializeMessage",function(){return ce}),r.d(e,"deserializeMessage",function(){return fe}),r.d(e,"toProxyWindow",function(){return de}),r.d(e,"on",function(){return ie}),r.d(e,"once",function(){return ae}),r.d(e,"send",function(){return se}),r.d(e,"markWindowKnown",function(){return pn}),r.d(e,"cleanUpWindow",function(){return he}),ue={setupBridge:Bn,openBridge:function(n,e){var r=sn("bridges"),t=sn("bridgeFrames");return e=e||k(n),r.getOrSet(e,function(){return z.try(function(){if(h()===e)throw new Error("Can not open bridge on the same domain as current domain: "+e);var r=In(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),jn.then(function(e){e.appendChild(o);var r=o.contentWindow;return new z(function(n,e){o.addEventListener("load",n),o.addEventListener("error",e)}).then(function(){return vn(r,5e3,"Bridge "+n)}).then(function(){return r})})})})},linkWindow:Fn,linkUrl:function(n,e){Fn({win:n,domain:k(e)})},isBridge:Pn,needsBridge:kn,needsBridgeForBrowser:Rn,hasBridge:function(n,e){return sn("bridges").has(e||k(n))},needsBridgeForWin:Nn,needsBridgeForDomain:Mn,destroyBridges:function(){for(var n=sn("bridges"),e=sn("bridgeFrames"),r=0,t=e.keys();r<t.length;r++){var o=e.get(t[r]);o&&o.parentNode&&o.parentNode.removeChild(o)}e.reset(),n.reset()}},we()}])}); | ||
!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{}.hasOwnProperty.call(n,e)},r.p="",r(r.s=0)}([function(n,e,r){"use strict";function t(n){return"[object RegExp]"==={}.toString.call(n)}r.r(e);var o={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},i="*",a={IFRAME:"iframe",POPUP:"popup"},u="Call was rejected by callee.\r\n";function s(n){return void 0===n&&(n=window),n.location.protocol===o.ABOUT}function c(n){if(void 0===n&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch(n){}}function f(n){if(void 0===n&&(n=window),n&&!c(n))try{return n.opener}catch(n){}}function d(n){try{return!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===o.FILE)return o.FILE+"//";if(r===o.ABOUT){var t=c(n);return t&&d()?w(t):o.ABOUT+"//"}var i=e.host;if(!i)throw new Error("Can not read window host");return r+"//"+i}function h(n){var e=w(n=n||window);return e&&n.mockDomain&&0===n.mockDomain.indexOf(o.MOCK)?n.mockDomain:e}function l(n){if(!function(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())return!0}catch(n){}try{if(w(n)===w(window))return!0}catch(n){}return!1}(n))return!1;try{if(n===window)return!0;if(s(n)&&d())return!0;if(h(window)===h(n))return!0}catch(n){}return!1}function m(n){if(!l(n))throw new Error("Expected window to be same domain");return n}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++)e.push(a[i])}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 _(n){var e=y(n);if(!e)throw new Error("Can not determine top window");return[].concat(g(e),[e])}var E=[],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&&l(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}(E,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(l(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 x(n,e){return n===f(e)}function A(n){return void 0===n&&(n=window),f(n=n||window)||c(n)||void 0}function R(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 N(n,e){var r=y(n)||n,t=y(e)||e;try{if(r&&t)return r===t}catch(n){}var o=_(n),i=_(e);if(R(o,i))return!0;var a=f(r),u=f(t);return!(a&&R(_(a),i)||(u&&R(_(u),o),1))}function P(n,e){if("string"==typeof n){if("string"==typeof e)return n===i||e===n;if(t(e))return!1;if(Array.isArray(e))return!1}return t(n)?t(e)?n.toString()===e.toString():!Array.isArray(e)&&Boolean(e.match(n)):!!Array.isArray(n)&&(Array.isArray(e)?JSON.stringify(n)===JSON.stringify(e):!t(e)&&n.some((function(n){return P(n,e)})))}function I(n){return n.match(/^(https?|mock|file):\/\//)?n.split("/").slice(0,3).join("/"):h()}function M(n){try{if(n===window)return!0}catch(n){if(n&&n.message===u)return!0}try{if("[object Window]"==={}.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{if(n&&"__unlikely_value__"===n.__cross_domain_utils_window_check__)return!1}catch(n){return!0}return!1}function k(n){try{n.close()}catch(n){}}function j(n){try{if(!n)return!1;if("undefined"!=typeof Promise&&n instanceof Promise)return!0;if("undefined"!=typeof window&&"function"==typeof window.Window&&n instanceof window.Window)return!1;if("undefined"!=typeof window&&"function"==typeof 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 D,T=[],C=[],L=0;function B(){if(!L&&D){var n=D;D=null,n.resolve()}}function F(){L+=1}function z(){L-=1,B()}var U=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;F();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(j(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(j(n))throw new Error("Can not reject promise with another promise");if(!n){var r=n&&"function"==typeof n.toString?n.toString():{}.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<C.length;r++)C[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.resolved,t=this.rejected,o=this.handlers;if(!this.dispatching&&(r||t)){this.dispatching=!0,F();for(var i=function(i){var a=o[i],u=a.onSuccess,s=a.onError,c=a.promise,f=void 0;if(r)try{f=u?u(e.value):e.value}catch(n){return c.reject(n),"continue"}else if(t){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):j(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)},a=0;a<o.length;a++)i(a);o.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:j(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(!j(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 C.push(n),{cancel:function(){C.splice(C.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;F();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)||j(e)},n.flush=function(){return e=D=D||new n,B(),e;var e},n}();function H(){return(H=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var t in r)({}).hasOwnProperty.call(r,t)&&(n[t]=r[t])}return n}).apply(this,arguments)}function q(n,e){for(var r=0;r<n.length;r++)try{if(n[r]===e)return r}catch(n){}return-1}var G,J=function(){function n(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",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(M(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){return!M(n)},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))try{var t=this.name,o=n[t];return void(o&&o[0]===n?o[1]=e:Object.defineProperty(n,t,{value:[n,e],writable:!0}))}catch(n){}this._cleanupClosedWindows();var i=this.keys,a=this.values,u=q(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))try{var r=n[this.name];return r&&r[0]===n?r[1]:void 0}catch(n){}this._cleanupClosedWindows();var t=q(this.keys,n);if(-1!==t)return this.values[t]},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))try{var r=n[this.name];r&&r[0]===n&&(r[0]=r[1]=void 0)}catch(n){}this._cleanupClosedWindows();var t=this.keys,o=q(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))try{var r=n[this.name];return!(!r||r[0]!==n)}catch(n){}return this._cleanupClosedWindows(),-1!==q(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(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,(function(n,e){return String.fromCharCode(parseInt(e,16))})));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(n){var e={};function r(){for(var r=this,t=arguments,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];var u=function(n){try{return JSON.stringify([].slice.call(n),(function(n,e){return"function"==typeof e?"memoize["+function(n){if(G=G||new J,null==n||"object"!=typeof n&&"function"!=typeof n)throw new Error("Invalid object");var e=G.get(n);return e||(e=typeof n+":"+X(),G.set(n,e)),e}(e)+"]":e}))}catch(n){throw new Error("Arguments not serializable -- can not be used to memoize")}}(i);return e.hasOwnProperty(u)?e[u]:(e[u]=U.try((function(){return n.apply(r,t)})).finally((function(){delete e[u]})),e[u])}return r.reset=function(){e={}},r}function Z(){}function K(n,e){if(void 0===e&&(e=1),e>=3)return"stringifyError stack overflow";try{if(!n)return"<unknown error: "+{}.toString.call(n)+">";if("string"==typeof n)return n;if(n instanceof Error){var r=n&&n.stack,t=n&&n.message;if(r&&t)return-1!==r.indexOf(t)?r:t+"\n"+r;if(r)return r;if(t)return t}return n&&n.toString&&"function"==typeof n.toString?n.toString():{}.toString.call(n)}catch(n){return"Error while stringifying error: "+K(n,e+1)}}function Q(n){return"string"==typeof n?n:n&&n.toString&&"function"==typeof n.toString?n.toString():{}.toString.call(n)}function V(n){return"[object RegExp]"==={}.toString.call(n)}function $(n,e,r){if(n.hasOwnProperty(e))return n[e];var t=r();return n[e]=t,t}Object.create(Error.prototype);var nn={METHOD:"postrobot_method",HELLO:"postrobot_hello",OPEN_TUNNEL:"postrobot_open_tunnel"},en="__postrobot_bridge__",rn="*",tn={CROSS_DOMAIN_ZALGO_PROMISE:"cross_domain_zalgo_promise",CROSS_DOMAIN_FUNCTION:"cross_domain_function",CROSS_DOMAIN_WINDOW:"cross_domain_window"};function on(n){return void 0===n&&(n=window),n!==window?n.__post_robot_10_0_19__:n.__post_robot_10_0_19__=n.__post_robot_10_0_19__||{}}var an=function(){return{}};function un(n,e){return void 0===n&&(n="store"),void 0===e&&(e=an),$(on(),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 $(n,e,r)},reset:function(){n=e()},keys:function(){return Object.keys(n)}}}))}var sn=function(){};function cn(){var n=on();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new sn,n.WINDOW_WILDCARD}function fn(n,e){return void 0===n&&(n="store"),void 0===e&&(e=an),un("windowStore").getOrSet(n,(function(){var r=new J,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 $(t(e),n,r)}}}))}function dn(){return un("instance").getOrSet("instanceID",X)}function wn(n){return fn("helloPromises").getOrSet(n,(function(){return new U}))}function hn(n,e){return(0,e.send)(n,nn.HELLO,{instanceID:dn()},{domain:rn,timeout:-1}).then((function(e){var r=e.origin,t=e.data.instanceID;return wn(n).resolve({win:n,domain:r}),{win:n,domain:r,instanceID:t}}))}function ln(n,e){var r=e.send;return fn("windowInstanceIDPromises").getOrSet(n,(function(){return hn(n,{send:r}).then((function(n){return n.instanceID}))}))}function mn(n,e,r){void 0===e&&(e=5e3),void 0===r&&(r="Window");var t=wn(n);return-1!==e&&(t=t.timeout(e,new Error(r+" did not load after "+e+"ms"))),t}function vn(n){fn("knownWindows").set(n,!0)}var pn,gn={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 yn(n){return"object"==typeof n&&null!==n&&"string"==typeof n.__type__}function _n(n){return void 0===n?gn.UNDEFINED:null===n?gn.NULL:Array.isArray(n)?gn.ARRAY:"function"==typeof n?gn.FUNCTION:"object"==typeof n?n instanceof Error?gn.ERROR:"function"==typeof n.then?gn.PROMISE:"[object RegExp]"==={}.toString.call(n)?gn.REGEX:"[object Date]"==={}.toString.call(n)?gn.DATE:gn.OBJECT:"string"==typeof n?gn.STRING:"number"==typeof n?gn.NUMBER:"boolean"==typeof n?gn.BOOLEAN:void 0}function En(n,e){return{__type__:n,__val__:e}}var On,bn=((pn={})[gn.FUNCTION]=function(){},pn[gn.ERROR]=function(n){return En(gn.ERROR,{message:n.message,stack:n.stack,code:n.code})},pn[gn.PROMISE]=function(){},pn[gn.REGEX]=function(n){return En(gn.REGEX,n.source)},pn[gn.DATE]=function(n){return En(gn.DATE,n.toJSON())},pn[gn.ARRAY]=function(n){return n},pn[gn.OBJECT]=function(n){return n},pn[gn.STRING]=function(n){return n},pn[gn.NUMBER]=function(n){return n},pn[gn.BOOLEAN]=function(n){return n},pn[gn.NULL]=function(n){return n},pn),Wn={},Sn=((On={})[gn.FUNCTION]=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},On[gn.ERROR]=function(n){var e=n.stack,r=n.code,t=new Error(n.message);return t.code=r,t.stack=e+"\n\n"+t.stack,t},On[gn.PROMISE]=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},On[gn.REGEX]=function(n){return new RegExp(n)},On[gn.DATE]=function(n){return new Date(n)},On[gn.ARRAY]=function(n){return n},On[gn.OBJECT]=function(n){return n},On[gn.STRING]=function(n){return n},On[gn.NUMBER]=function(n){return n},On[gn.BOOLEAN]=function(n){return n},On[gn.NULL]=function(n){return n},On),xn={};function An(){return!!W(window).match(/MSIE|trident|edge\/12|edge\/13/i)}function Rn(n){return!N(window,n)}function Nn(n,e){if(n){if(h()!==I(n))return!0}else if(e&&!l(e))return!0;return!1}function Pn(n){var e=n.win,r=n.domain;return!(!An()||r&&!Nn(r,e)||e&&!Rn(e))}function In(n){var e=(n=n||I(n)).replace(/[^a-zA-Z0-9]+/g,"_");return en+"_"+e}function Mn(){return Boolean(window.name&&window.name===In(h()))}var kn=new U((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 jn(n){fn("remoteWindowPromises").getOrSet(n,(function(){return new U}))}function Dn(n){var e=fn("remoteWindowPromises").get(n);if(!e)throw new Error("Remote window promise not found");return e}function Tn(n,e,r){Dn(n).resolve((function(t,o,i){if(t!==n)throw new Error("Remote window does not match window");if(!P(o,e))throw new Error("Remote domain "+o+" does not match domain "+e);r.fireAndForget(i)}))}function Cn(n,e){Dn(n).reject(e).catch(Z)}function Ln(n){for(var e=n.win,r=n.name,t=n.domain,o=un("popupWindowsByName"),i=fn("popupWindowsByWin"),a=0,u=o.keys();a<u.length;a++){var s=u[a],c=o.get(s);c&&!b(c.win)||o.del(s)}var f=i.getOrSet(e,(function(){return r?o.getOrSet(r,(function(){return{win:e,name:r}})):{win:e}}));if(f.win&&f.win!==e)throw new Error("Different window already linked for window: "+(r||"undefined"));if(r){if(f.name&&f.name!==r)throw new Error("Different window already linked for name "+r+": "+f.name);f.name=r,o.set(r,f)}return t&&(f.domain=t,jn(e)),i.set(e,f),f}function Bn(n){var e,r=n.on,t=n.send,i=n.receiveMessage;e=window.open,window.open=function(n,r,t,i){var a=e.call(this,function(n){if(0!==I(n).indexOf(o.MOCK))return n;throw new Error("Mock urls not supported out of test mode")}(n),r,t,i);return a?(Ln({win:a,name:r,domain:n?I(n):null}),a):a},function(n){var e=n.on,r=n.send,t=n.receiveMessage,o=un("popupWindowsByName");e(nn.OPEN_TUNNEL,(function(n){var i=n.source,a=n.origin,u=n.data,s=un("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 Tn(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){U.reject(n)}}}}}))}))}({on:r,send:t,receiveMessage:i}),function(n){var e=n.send;on(window).openTunnelToParent=function(n){var r=n.name,t=n.source,o=n.canary,i=n.sendMessage,a=un("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=un("tunnelWindows"),e=0,r=n.keys();e<r.length;e++){var t=r[e];b(n[t].source)&&n.del(t)}}();var i=X();return un("tunnelWindows").set(i,{name:e,source:r,canary:t,sendMessage:o}),i}({name:r,source:t,canary:o,sendMessage:i});return e(u,nn.OPEN_TUNNEL,{name:r,sendMessage:function(){var n=a.get(s);if(n&&n.source&&!b(n.source)){try{n.canary()}catch(n){return}n.sendMessage.apply(this,arguments)}}},{domain:rn})}}({on:r,send:t}),function(n){var e=n.on,r=n.send,t=n.receiveMessage;U.try((function(){var n,o=f(window);if(o&&Pn({win:o}))return jn(o),(n=o,fn("remoteBridgeAwaiters").getOrSet(n,(function(){return U.try((function(){var e=S(n,In(h()));if(e)return l(e)&&on(m(e))?e:new U((function(n){var r,t;r=setInterval((function(){if(e&&l(e)&&on(m(e)))return clearInterval(r),clearTimeout(t),n(e)}),100),t=setTimeout((function(){return clearInterval(r),n()}),2e3)}))}))}))).then((function(n){return n?window.name?on(m(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){U.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");Tn(e,r,t.sendMessage)})).catch((function(n){throw Cn(o,n),n})):Cn(o,new Error("Can not register with opener: window does not have a name")):Cn(o,new Error("Can not register with opener: no bridge found in opener"))}))}))}({on:r,send:t,receiveMessage:i})}function Fn(){for(var n=un("idToProxyWindow"),e=0,r=n.keys();e<r.length;e++){var t=r[e];n.get(t).shouldClean()&&n.del(t)}}var zn=function(){function n(n){var e=n.send,r=n.win,t=n.serializedWindow;this.id=void 0,this.isProxyWindow=!0,this.serializedWindow=void 0,this.actualWindow=void 0,this.actualWindowPromise=void 0,this.send=void 0,this.name=void 0,this.actualWindowPromise=new U,this.serializedWindow=t||function(n,e){var r,t=e.send;return{id:X(),getType:function(){return n.then((function(n){return f(n)?a.POPUP:a.IFRAME}))},getInstanceID:Y((function(){return n.then((function(n){return ln(n,{send:t})}))})),close:function(){return n.then(k)},getName:function(){return n.then((function(n){if(!b(n))return r}))},focus:function(){return n.then((function(n){n.focus()}))},isClosed:function(){return n.then((function(n){return b(n)}))},setLocation:function(e){return n.then((function(n){if(l(n))try{if(n.location&&"function"==typeof n.location.replace)return void n.location.replace(e)}catch(n){}n.location=e}))},setName:function(e){return n.then((function(n){Ln({win:n,name:e});var t=m(n);t.name=e,t.frameElement&&t.frameElement.setAttribute("name",e),r=e}))}}}(this.actualWindowPromise,{send:e}),un("idToProxyWindow").set(this.getID(),this),r&&this.setWindow(r)}var e=n.prototype;return e.getID=function(){return this.serializedWindow.id},e.getType=function(){return this.serializedWindow.getType()},e.isPopup=function(){return this.getType()===a.POPUP},e.setLocation=function(n){var e=this;return this.serializedWindow.setLocation(n).then((function(){return e}))},e.getName=function(){return this.serializedWindow.getName()},e.setName=function(n){var e=this;return this.serializedWindow.setName(n).then((function(){return e}))},e.close=function(){var n=this;return this.serializedWindow.close().then((function(){return n}))},e.focus=function(){var n=this;return U.all([this.isPopup()&&this.getName().then((function(n){n&&window.open("",n)})),this.serializedWindow.focus()]).then((function(){return n}))},e.isClosed=function(){return this.serializedWindow.isClosed()},e.getWindow=function(){return this.actualWindow},e.setWindow=function(n){this.actualWindow=n,this.actualWindowPromise.resolve(this.actualWindow),fn("winToProxyWindow").set(n,this)},e.awaitWindow=function(){return this.actualWindowPromise},e.matchWindow=function(n,e){var r=this,t=e.send;return U.try((function(){return r.actualWindow?n===r.actualWindow:U.hash({proxyInstanceID:r.getInstanceID(),knownWindowInstanceID:ln(n,{send:t})}).then((function(e){var t=e.proxyInstanceID===e.knownWindowInstanceID;return t&&r.setWindow(n),t}))}))},e.unwrap=function(){return this.actualWindow||this},e.getInstanceID=function(){return this.serializedWindow.getInstanceID()},e.shouldClean=function(){return Boolean(this.actualWindow&&b(this.actualWindow))},e.serialize=function(){return this.serializedWindow},n.unwrap=function(e){return n.isProxyWindow(e)?e.unwrap():e},n.serialize=function(e,r){var t=r.send;return Fn(),n.toProxyWindow(e,{send:t}).serialize()},n.deserialize=function(e,r){var t=r.send;return Fn(),un("idToProxyWindow").get(e.id)||new n({serializedWindow:e,send:t})},n.isProxyWindow=function(n){return Boolean(n&&!M(n)&&n.isProxyWindow)},n.toProxyWindow=function(e,r){var t=r.send;if(Fn(),n.isProxyWindow(e))return e;var o=e;return fn("winToProxyWindow").get(o)||new n({win:o,send:t})},n}();function Un(n,e,r,t,o){var i=fn("methodStore"),a=un("proxyWindowMethods");zn.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 Hn(n,e){var r=fn("methodStore"),t=un("proxyWindowMethods");return r.getOrSet(n,(function(){return{}}))[e]||t.get(e)}function qn(n,e,r,t,o){!function(n){var e=n.on,r=n.send;un("builtinListeners").getOrSet("functionCalls",(function(){return e(nn.METHOD,{domain:rn},(function(n){var e=n.source,t=n.origin,o=n.data,i=o.id,a=o.name,u=Hn(e,i);if(!u)throw new Error("Could not find method '"+o.name+"' with id: "+o.id+" in "+h(window));var s=u.source,c=u.domain,f=u.val;return U.try((function(){if(!P(c,t))throw new Error("Method '"+o.name+"' domain "+JSON.stringify(V(u.domain)?u.domain.source:u.domain)+" does not match origin "+t+" in "+h(window));if(zn.isProxyWindow(s))return s.matchWindow(e,{send:r}).then((function(n){if(!n)throw new Error("Method call '"+o.name+"' failed - proxy window does not match source in "+h(window))}))})).then((function(){return f.apply({source:e,origin:t},o.args)}),(function(n){return U.try((function(){if(f.onError)return f.onError(n)})).then((function(){throw n.stack&&(n.stack="Remote call to "+a+"()\n\n"+n.stack),n}))})).then((function(n){return{result:n,id:i,name:a}}))}))}))}({on:o.on,send:o.send});var i=r.__id__||X();n=zn.unwrap(n);var a=r.__name__||r.name||t;return zn.isProxyWindow(n)?(Un(i,r,a,n,e),n.awaitWindow().then((function(n){Un(i,r,a,n,e)}))):Un(i,r,a,n,e),En(tn.CROSS_DOMAIN_FUNCTION,{id:i,name:a})}function Gn(n,e,r,t){var o,i=t.on,a=t.send;return function(n,e){void 0===e&&(e=Wn);var r=JSON.stringify(n,(function(n){var r=this[n];if(yn(this))return r;var t=_n(r);if(!t)return r;var o=e[t]||bn[t];return o?o(r,n):r}));return void 0===r?gn.UNDEFINED:r}(r,((o={})[gn.PROMISE]=function(r,t){return function(n,e,r,t,o){return En(tn.CROSS_DOMAIN_ZALGO_PROMISE,{then:qn(n,e,(function(n,e){return r.then(n,e)}),t,{on:o.on,send:o.send})})}(n,e,r,t,{on:i,send:a})},o[gn.FUNCTION]=function(r,t){return qn(n,e,r,t,{on:i,send:a})},o[gn.OBJECT]=function(n){return M(n)||zn.isProxyWindow(n)?En(tn.CROSS_DOMAIN_WINDOW,zn.serialize(n,{send:a})):n},o))}function Jn(n,e,r,t){var o,i=t.on,a=t.send;return function(n,e){if(void 0===e&&(e=xn),n!==gn.UNDEFINED)return JSON.parse(n,(function(n,r){if(yn(this))return r;var t,o;if(yn(r)?(t=r.__type__,o=r.__val__):(t=_n(r),o=r),!t)return o;var i=e[t]||Sn[t];return i?i(o,n):o}))}(r,((o={})[tn.CROSS_DOMAIN_ZALGO_PROMISE]=function(n){return function(n,e,r){return new U(r.then)}(0,0,n)},o[tn.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 zn.toProxyWindow(n,{send:a}).awaitWindow().then((function(n){var s=Hn(n,o);if(s&&s.val!==t)return s.val.apply({source:window,origin:h()},u);var c={domain:e,fireAndForget:r.fireAndForget},f=[].slice.call(u);return a(n,nn.METHOD,{id:o,name:i,args:f},c).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[tn.CROSS_DOMAIN_WINDOW]=function(n){return zn.deserialize(n,{send:a})},o))}var Xn={};function Yn(n,e,r,t){var o,i=t.on,a=t.send;if(b(n))throw new Error("Window is closed");for(var u=Gn(n,e,((o={}).__post_robot_10_0_19__=H({id:X(),origin:h(window)},r),o),{on:i,send:a}),s=Object.keys(Xn),c=[],f=0;f<s.length;f++){var d=s[f];try{Xn[d](n,u,e)}catch(n){c.push(n)}}if(c.length===s.length)throw new Error("All post-robot messaging strategies failed:\n\n"+c.map(K).join("\n\n"))}Xn.postrobot_post_message=function(n,e,r){(Array.isArray(r)?r:"string"==typeof r?[r]:[rn]).map((function(n){return 0===n.indexOf(o.FILE)?rn:n})).forEach((function(r){n.postMessage(e,r)}))},Xn.postrobot_bridge=function(n,e,r){if(An()||Mn()){if(l(n))throw new Error("Post message through bridge disabled between same domain windows");if(!1!==N(window,n))throw new Error("Can only use bridge to communicate between two different windows, not between frames");!function(n,e,r){var t=x(window,n),o=x(n,window);if(!t&&!o)throw new Error("Can only send messages to and from parent and popup windows");Dn(n).then((function(t){return t(n,e,r)}))}(n,r,e)}},Xn.postrobot_global=function(n,e){if(W(window).match(/MSIE|rv:11|trident|edge\/12|edge\/13/i)){if(!l(n))throw new Error("Post message through global disabled between different domain windows");if(!1!==N(window,n))throw new Error("Can only use global to communicate between two different windows, not between frames");var r=on(n);if(!r)throw new Error("Can not find postRobot global on foreign window");r.receiveMessage({source:window,origin:h(),data:e})}};var Zn,Kn="__domain_regex__";function Qn(n){return un("responseListeners").get(n)}function Vn(n){un("responseListeners").del(n)}function $n(n){return un("erroredResponseListeners").has(n)}function ne(n){var e=n.name,r=n.win,t=n.domain,o=fn("requestListeners");if(r===rn&&(r=null),t===rn&&(t=null),!e)throw new Error("Name required to get request listener");for(var i=0,a=[r,cn()];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[Kn])for(var f=0,d=c[Kn];f<d.length;f++){var w=d[f],h=w.listener;if(P(w.regex,t))return h}}if(c[rn])return c[rn]}}}}}var ee=((Zn={}).postrobot_message_request=function(n,e,r,t){var o=t.on,i=t.send,a=ne({name:r.name,win:n,domain:e});function u(t,a,u){void 0===u&&(u={}),r.fireAndForget||b(n)||Yn(n,e,H({type:t,ack:a,hash:r.hash,name:r.name},u),{on:o,send:i})}return U.all([u("postrobot_message_ack"),U.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(!P(a.domain,e))throw new Error("Request origin "+e+" does not match domain "+a.domain.toString());return a.handler({source:n,origin:e,data:r.data})})).then((function(n){return u("postrobot_message_response","success",{data:n})}),(function(n){return u("postrobot_message_response","error",{error:n})}))]).then(Z).catch((function(n){if(a&&a.handleError)return a.handleError(n);throw n}))},Zn.postrobot_message_ack=function(n,e,r){if(!$n(r.hash)){var t=Qn(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(!P(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}},Zn.postrobot_message_response=function(n,e,r){if(!$n(r.hash)){var o,i=Qn(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(!P(i.domain,e))throw new Error("Response origin "+e+" does not match domain "+(o=i.domain,Array.isArray(o)?"("+o.join(" | ")+")":t(o)?"RegExp("+o.toString():o.toString()));if(n!==i.win)throw new Error("Response source does not match registered window");Vn(r.hash),"error"===r.ack?i.promise.reject(r.error):"success"===r.ack&&i.promise.resolve({source:n,origin:e,data:r.data})}},Zn);function re(n,e){var r=e.on,t=e.send,i=un("receivedMessages");if(!window||window.closed)throw new Error("Message recieved in closed window");try{if(!n.source)return}catch(n){return}var a=n.source,u=n.origin,s=function(n,e,r,t){var o,i=t.on,a=t.send;try{o=Jn(e,r,n,{on:i,send:a})}catch(n){return}if(o&&"object"==typeof o&&null!==o&&(o=o.__post_robot_10_0_19__)&&"object"==typeof o&&null!==o&&o.type&&"string"==typeof o.type&&ee[o.type])return o}(n.data,a,u,{on:r,send:t});s&&(vn(a),i.has(s.id)||(i.set(s.id,!0),b(a)&&!s.fireAndForget||(0===s.origin.indexOf(o.FILE)&&(u=o.FILE+"//"),ee[s.type](a,u,s,{on:r,send:t}))))}function te(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=fn("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++)u.push(n({name:t,domain:i,win:c[s]},r));return{cancel:function(){for(var n=0;n<u.length;n++)u[n].cancel()}}}if(Array.isArray(i)){for(var f=[],d=0,w=i;d<w.length;d++)f.push(n({name:t,win:o,domain:w[d]},r));return{cancel:function(){for(var n=0;n<f.length;n++)f[n].cancel()}}}var h=ne({name:t,win:o,domain:i});if(o&&o!==rn||(o=cn()),i=i||rn,h)throw o&&i?new Error("Request listener already exists for "+t+" on domain "+i.toString()+" for "+(o===cn()?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+t+" for "+(o===cn()?"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 l,m,v=a.getOrSet(o,(function(){return{}})),p=$(v,t,(function(){return{}})),g=i.toString();return V(i)?(l=$(p,Kn,(function(){return[]}))).push(m={regex:i,listener:r}):p[g]=r,{cancel:function(){delete p[g],m&&(l.splice(l.indexOf(m,1)),l.length||delete p[Kn]),Object.keys(p).length||delete v[t],o&&!Object.keys(v).length&&a.del(o)}}}({name:n,win:t,domain:o},{handler:e.handler,handleError:e.errorHandler||function(n){throw n},window:t,domain:o||rn,name:n});return{cancel:function(){i.cancel()}}}function oe(n,e,r){"function"==typeof(e=e||{})&&(r=e,e={});var t,o=new U;return e.errorHandler=function(n){t.cancel(),o.reject(n)},t=te(n,e,(function(n){if(t.cancel(),o.resolve(n),r)return r(n)})),o.cancel=t.cancel,o}var ie,ae=function n(e,r,t,o){var i=(o=o||{}).domain||rn,a=o.timeout||-1,u=o.timeout||5e3,s=o.fireAndForget||!1;return U.try((function(){return function(n,e,r){if(!n)throw new Error("Expected name");if(r&&"string"!=typeof r&&!Array.isArray(r)&&!V(r))throw new TypeError("Expected domain to be a string, array, or regex");if(b(e))throw new Error("Target window is closed")}(r,e,i),function(n,e,r,t){var o=t.send;return U.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)?mn(n,r):V(e)?hn(n,{send:o}):{domain:e}})).then((function(n){return n.domain}))}(e,i,u,{send:n})})).then((function(o){if(!P(i,o))throw new Error("Domain "+Q(i)+" does not match "+Q(o));i=o;var u,c,f=r===nn.METHOD&&t&&"string"==typeof t.name?t.name+"()":r,d=new U,w=r+"_"+X();if(!s){var l={name:r,win:e,domain:i,promise:d};!function(n,e){un("responseListeners").set(n,e)}(w,l);var m=fn("requestPromises").getOrSet(e,(function(){return[]}));m.push(d),d.catch((function(){!function(n){un("erroredResponseListeners").set(n,!0)}(w),Vn(w)}));var v=function(n){return fn("knownWindows").get(n,!1)}(e)?1e4:2e3,p=a,g=v,y=p,_=(u=function(){return b(e)?d.reject(new Error("Window closed for "+r+" before "+(l.ack?"response":"ack"))):l.cancelled?d.reject(new Error("Response listener was cancelled for "+r)):(g=Math.max(g-500,0),-1!==y&&(y=Math.max(y-500,0)),l.ack||0!==g?0===y?d.reject(new Error("No response for postMessage "+f+" in "+h()+" in "+p+"ms")):void 0:d.reject(new Error("No ack for postMessage "+f+" in "+h()+" in "+v+"ms")))},500,function n(){c=setTimeout((function(){u(),n()}),500)}(),{cancel:function(){clearTimeout(c)}});d.finally((function(){_.cancel(),m.splice(m.indexOf(d,1))})).catch(Z)}return Yn(e,i,{type:"postrobot_message_request",hash:w,name:r,data:t,fireAndForget:s},{on:te,send:n}),s?d.resolve():d}))};function ue(n,e,r){return Gn(n,e,r,{on:te,send:ae})}function se(n,e,r){return Jn(n,e,r,{on:te,send:ae})}function ce(n){return new zn({send:ae,win:n})}function fe(n){return zn.toProxyWindow(n,{send:ae})}function de(){var n,e,r;on().initialized||(on().initialized=!0,function(n){var e=n.on,r=n.send,t=on();t.receiveMessage=t.receiveMessage||function(n){return re(n,{on:e,send:r})}}({on:te,send:ae}),e=(n={on:te,send:ae}).on,r=n.send,un().getOrSet("postMessageListener",(function(){return(n=window).addEventListener("message",t=function(n){!function(n,e){var r=e.on,t=e.send,i=n.source||n.sourceElement,a=n.origin||n.originalEvent&&n.originalEvent.origin,u=n.data;if("null"===a&&(a=o.FILE+"//"),i){if(!a)throw new Error("Post message did not have origin domain");re({source:i,origin:a,data:u},{on:r,send:t})}}(n,{on:e,send:r})}),{cancel:function(){n.removeEventListener("message",t)}};var n,t})),Bn({on:te,send:ae,receiveMessage:re}),function(n){var e=n.on,r=n.send;un("builtinListeners").getOrSet("helloListener",(function(){var n=e(nn.HELLO,{domain:rn},(function(n){var e=n.source,r=n.origin;return wn(e).resolve({win:e,domain:r}),{instanceID:dn()}})),t=A();return t&&hn(t,{send:r}).catch(Z),n}))}({on:te,send:ae}))}function we(){var n;!function(){for(var n=un("responseListeners"),e=0,r=n.keys();e<r.length;e++){var t=r[e],o=n.get(t);o&&(o.cancelled=!0),n.del(t)}}(),(n=un().get("postMessageListener"))&&n.cancel(),delete window.__post_robot_10_0_19__}function he(n){for(var e=0,r=fn("requestPromises").get(n,[]);e<r.length;e++)r[e].reject(new Error("Window cleaned up before response")).catch(Z)}r.d(e,"bridge",(function(){return ie})),r.d(e,"Promise",(function(){return U})),r.d(e,"TYPES",(function(){return!0})),r.d(e,"ProxyWindow",(function(){return zn})),r.d(e,"setup",(function(){return de})),r.d(e,"destroy",(function(){return we})),r.d(e,"serializeMessage",(function(){return ue})),r.d(e,"deserializeMessage",(function(){return se})),r.d(e,"createProxyWindow",(function(){return ce})),r.d(e,"toProxyWindow",(function(){return fe})),r.d(e,"on",(function(){return te})),r.d(e,"once",(function(){return oe})),r.d(e,"send",(function(){return ae})),r.d(e,"markWindowKnown",(function(){return vn})),r.d(e,"cleanUpWindow",(function(){return he})),ie={setupBridge:Bn,openBridge:function(n,e){var r=un("bridges"),t=un("bridgeFrames");return e=e||I(n),r.getOrSet(e,(function(){return U.try((function(){if(h()===e)throw new Error("Can not open bridge on the same domain as current domain: "+e);var r=In(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),kn.then((function(e){e.appendChild(o);var r=o.contentWindow;return new U((function(n,e){o.addEventListener("load",n),o.addEventListener("error",e)})).then((function(){return mn(r,5e3,"Bridge "+n)})).then((function(){return r}))}))}))}))},linkWindow:Ln,linkUrl:function(n,e){Ln({win:n,domain:I(e)})},isBridge:Mn,needsBridge:Pn,needsBridgeForBrowser:An,hasBridge:function(n,e){return un("bridges").has(e||I(n))},needsBridgeForWin:Rn,needsBridgeForDomain:Nn,destroyBridges:function(){for(var n=un("bridges"),e=un("bridgeFrames"),r=0,t=e.keys();r<t.length;r++){var o=e.get(t[r]);o&&o.parentNode&&o.parentNode.removeChild(o)}e.reset(),n.reset()}},de()}])})); | ||
//# 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{}.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]"==={}.toString.call(n)}r.r(t),r.d(t,"WeakMap",function(){return C});var i={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},u="*",a={IFRAME:"iframe",POPUP:"popup"},c="Call was rejected by callee.\r\n";function s(n){return void 0===n&&(n=window),n.location.protocol===i.ABOUT}function f(n){if(void 0===n&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch(n){}}function d(n){if(void 0===n&&(n=window),n&&!f(n))try{return n.opener}catch(n){}}function l(n){try{return!0}catch(n){}return!1}function h(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=f(n);return t&&l()?h(t):i.ABOUT+"//"}var o=e.host;if(!o)throw new Error("Can not read window host");return r+"//"+o}function w(n){var e=h(n=n||window);return e&&n.mockDomain&&0===n.mockDomain.indexOf(i.MOCK)?n.mockDomain:e}function v(n){if(!function(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)&&l())return!0}catch(n){}try{if(h(n)===h(window))return!0}catch(n){}return!1}(n))return!1;try{if(n===window)return!0;if(s(n)&&l())return!0;if(w(window)===w(n))return!0}catch(n){}return!1}function p(n,e){if(!n||!e)return!1;var r=f(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 u=0;u<100;u++){var a=void 0;try{a=e[u]}catch(n){return t}if(!a)return t;t.push(a)}return t}var y=[],g=[];function _(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!==c}if(e&&v(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 E(n){return void 0===n&&(n=window),d(n=n||window)||f(n)||void 0}function O(n,e){if("string"==typeof n){if("string"==typeof e)return n===u||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===c)return!0}try{if("[object Window]"==={}.toString.call(n))return!0}catch(n){if(n&&n.message===c)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(n){if(n&&n.message===c)return!0}try{if(n&&n.self===n)return!0}catch(n){if(n&&n.message===c)return!0}try{if(n&&n.parent===n)return!0}catch(n){if(n&&n.message===c)return!0}try{if(n&&n.top===n)return!0}catch(n){if(n&&n.message===c)return!0}try{if(n&&"__unlikely_value__"===n.__cross_domain_utils_window_check__)return!1}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=[],x=[],I=0;function N(){if(!I&&b){var n=b;b=null,n.resolve()}}function P(){I+=1}function j(){I-=1,N()}var k=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,u=!1;P();try{n(function(n){u?e.resolve(n):(o=!0,r=n)},function(n){u?e.reject(n):(i=!0,t=n)})}catch(n){return j(),void this.reject(n)}j(),u=!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():{}.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<x.length;r++)x[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.resolved,t=this.rejected,o=this.handlers;if(!this.dispatching&&(r||t)){this.dispatching=!0,P();for(var i=function(i){var u=o[i],a=u.onSuccess,c=u.onError,s=u.promise,f=void 0;if(r)try{f=a?a(e.value):e.value}catch(n){return s.reject(n),"continue"}else if(t){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<o.length;u++)i(u);o.length=0,this.dispatching=!1,j()}},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 u=e[i];if(u instanceof n){if(u.resolved)return o[i]=u.value,t-=1,"continue"}else if(!S(u))return o[i]=u,t-=1,"continue";n.resolve(u).then(function(n){o[i]=n,0==(t-=1)&&r.resolve(o)},function(n){r.reject(n)})},u=0;u<e.length;u++)i(u);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 x.push(n),{cancel:function(){x.splice(x.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;P();try{o=e.apply(r,t||[])}catch(e){return j(),n.reject(e)}return j(),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 A(){return(A=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var t in r)({}).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,L=Date.now()%1e9,C=function(){function n(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,L+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+L,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)&&_(t)){if(n)try{n.delete(t)}catch(n){}e.splice(r,1),this.values.splice(r,1),r-=1}}},e.isSafeToReadWrite=function(n){return!W(n)},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))try{var t=this.name,o=n[t];return void(o&&o[0]===n?o[1]=e:T(n,t,{value:[n,e],writable:!0}))}catch(n){}this._cleanupClosedWindows();var i=this.keys,u=this.values,a=D(i,n);-1===a?(i.push(n),u.push(e)):u[a]=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))try{var r=n[this.name];return r&&r[0]===n?r[1]:void 0}catch(n){}this._cleanupClosedWindows();var t=D(this.keys,n);if(-1!==t)return this.values[t]},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))try{var r=n[this.name];r&&r[0]===n&&(r[0]=r[1]=void 0)}catch(n){}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))try{var r=n[this.name];return!(!r||r[0]!==n)}catch(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 F(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([].slice.call(n),function(n,e){return"function"==typeof e?"memoize["+function(n){if(M=M||new C,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}function U(){}function B(n,e){if(void 0===e&&(e=1),e>=3)return"stringifyError stack overflow";try{if(!n)return"<unknown error: "+{}.toString.call(n)+">";if("string"==typeof n)return n;if(n instanceof Error){var r=n&&n.stack,t=n&&n.message;if(r&&t)return-1!==r.indexOf(t)?r:t+"\n"+r;if(r)return r;if(t)return t}return n&&n.toString&&"function"==typeof n.toString?n.toString():{}.toString.call(n)}catch(n){return"Error while stringifying error: "+B(n,e+1)}}function H(n){return"string"==typeof n?n:n&&n.toString&&"function"==typeof n.toString?n.toString():{}.toString.call(n)}function q(n){return"[object RegExp]"==={}.toString.call(n)}function G(n,e,r){if(n.hasOwnProperty(e))return n[e];var t=r();return n[e]=t,t}Object.create(Error.prototype);var J={METHOD:"postrobot_method",HELLO:"postrobot_hello",OPEN_TUNNEL:"postrobot_open_tunnel"},X="*",Y={CROSS_DOMAIN_ZALGO_PROMISE:"cross_domain_zalgo_promise",CROSS_DOMAIN_FUNCTION:"cross_domain_function",CROSS_DOMAIN_WINDOW:"cross_domain_window"};function Z(n){return void 0===n&&(n=window),n!==window?n.__post_robot_10_0_18__:n.__post_robot_10_0_18__=n.__post_robot_10_0_18__||{}}var K=function(){return{}};function Q(n,e){return void 0===n&&(n="store"),void 0===e&&(e=K),G(Z(),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 G(n,e,r)},reset:function(){n=e()},keys:function(){return Object.keys(n)}}})}var V=function(){};function $(){var n=Z();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new V,n.WINDOW_WILDCARD}function nn(n,e){return void 0===n&&(n="store"),void 0===e&&(e=K),Q("windowStore").getOrSet(n,function(){var r=new C,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 G(t(e),n,r)}}})}function en(){return Q("instance").getOrSet("instanceID",z)}function rn(n){return nn("helloPromises").getOrSet(n,function(){return new k})}function tn(n,e){return(0,e.send)(n,J.HELLO,{instanceID:en()},{domain:X,timeout:-1}).then(function(e){var r=e.origin,t=e.data.instanceID;return rn(n).resolve({win:n,domain:r}),{win:n,domain:r,instanceID:t}})}function on(n,e){var r=e.send;return nn("windowInstanceIDPromises").getOrSet(n,function(){return tn(n,{send:r}).then(function(n){return n.instanceID})})}function un(n){nn("knownWindows").set(n,!0)}var an,cn={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 sn(n){return"object"==typeof n&&null!==n&&"string"==typeof n.__type__}function fn(n){return void 0===n?cn.UNDEFINED:null===n?cn.NULL:Array.isArray(n)?cn.ARRAY:"function"==typeof n?cn.FUNCTION:"object"==typeof n?n instanceof Error?cn.ERROR:"function"==typeof n.then?cn.PROMISE:"[object RegExp]"==={}.toString.call(n)?cn.REGEX:"[object Date]"==={}.toString.call(n)?cn.DATE:cn.OBJECT:"string"==typeof n?cn.STRING:"number"==typeof n?cn.NUMBER:"boolean"==typeof n?cn.BOOLEAN:void 0}function dn(n,e){return{__type__:n,__val__:e}}var ln,hn=((an={})[cn.FUNCTION]=function(){},an[cn.ERROR]=function(n){return dn(cn.ERROR,{message:n.message,stack:n.stack,code:n.code})},an[cn.PROMISE]=function(){},an[cn.REGEX]=function(n){return dn(cn.REGEX,n.source)},an[cn.DATE]=function(n){return dn(cn.DATE,n.toJSON())},an[cn.ARRAY]=function(n){return n},an[cn.OBJECT]=function(n){return n},an[cn.STRING]=function(n){return n},an[cn.NUMBER]=function(n){return n},an[cn.BOOLEAN]=function(n){return n},an[cn.NULL]=function(n){return n},an),wn={},vn=((ln={})[cn.FUNCTION]=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},ln[cn.ERROR]=function(n){var e=n.stack,r=n.code,t=new Error(n.message);return t.code=r,t.stack=e+"\n\n"+t.stack,t},ln[cn.PROMISE]=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},ln[cn.REGEX]=function(n){return new RegExp(n)},ln[cn.DATE]=function(n){return new Date(n)},ln[cn.ARRAY]=function(n){return n},ln[cn.OBJECT]=function(n){return n},ln[cn.STRING]=function(n){return n},ln[cn.NUMBER]=function(n){return n},ln[cn.BOOLEAN]=function(n){return n},ln[cn.NULL]=function(n){return n},ln),pn={};function mn(){for(var n=Q("idToProxyWindow"),e=0,r=n.keys();e<r.length;e++){var t=r[e];n.get(t).shouldClean()&&n.del(t)}}function yn(n,e,r){var t,o=r.send;return{id:n,type:d(e)?a.POPUP:a.IFRAME,getInstanceID:F(function(){return on(e,{send:o})}),close:function(){return k.try(function(){!function(n){try{n.close()}catch(n){}}(e)})},getName:function(){return k.try(function(){if(!_(e))return t})},focus:function(){return k.try(function(){e.focus()})},isClosed:function(){return k.try(function(){return _(e)})},setLocation:function(n){return k.try(function(){if(v(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 k.try(function(){(e=function(n){if(!v(n))throw new Error("Expected window to be same domain");return n}(e)).name=n,e.frameElement&&e.frameElement.setAttribute("name",n),t=n})}}}new k(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 gn=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.name=void 0,this.serializedWindow=n,this.actualWindowPromise=new k,this.send=t,e&&this.setWindow(e)}var e=n.prototype;return e.getType=function(){return this.serializedWindow.type},e.isPopup=function(){return this.getType()===a.POPUP},e.isIframe=function(){return this.getType()===a.IFRAME},e.setLocation=function(n){var e=this;return this.serializedWindow.setLocation(n).then(function(){return e})},e.setName=function(n){var e=this;return this.serializedWindow.setName(n).then(function(){return e})},e.close=function(){var n=this;return this.serializedWindow.close().then(function(){return n})},e.focus=function(){var n=this;return k.try(function(){return k.all([n.isPopup()&&n.serializedWindow.getName().then(function(n){n&&window.open("",n)}),n.serializedWindow.focus()])}).then(function(){return n})},e.isClosed=function(){return this.serializedWindow.isClosed()},e.getWindow=function(){return this.actualWindow},e.setWindow=function(n){this.actualWindow=n,this.serializedWindow=yn(this.serializedWindow.id,n,{send:this.send}),this.actualWindowPromise.resolve(n)},e.awaitWindow=function(){return this.actualWindowPromise},e.matchWindow=function(n){var e=this;return k.try(function(){return e.actualWindow?n===e.actualWindow:k.hash({proxyInstanceID:e.getInstanceID(),knownWindowInstanceID:on(n,{send:e.send})}).then(function(r){var t=r.proxyInstanceID===r.knownWindowInstanceID;return t&&e.setWindow(n),t})})},e.unwrap=function(){return this.actualWindow||this},e.getInstanceID=function(){return this.serializedWindow.getInstanceID()},e.serialize=function(){return this.serializedWindow},e.shouldClean=function(){return this.actualWindow&&_(this.actualWindow)},n.unwrap=function(e){return n.isProxyWindow(e)?e.unwrap():e},n.serialize=function(e,r){var t=r.send;return mn(),n.toProxyWindow(e,{send:t}).serialize()},n.deserialize=function(e,r){var t=r.on,o=r.send;return mn(),Q("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;if(mn(),n.isProxyWindow(e))return e;var o=e;return nn("winToProxyWindow").getOrSet(e,function(){var e=z(),r=new n(yn(e,o,{send:t}),o,{send:t});return Q("idToProxyWindow").set(e,r)})},n}();function _n(n,e,r,t,o){var i=nn("methodStore"),u=Q("proxyWindowMethods");gn.isProxyWindow(t)?u.set(n,{val:e,name:r,domain:o,source:t}):(u.del(n),i.getOrSet(t,function(){return{}})[n]={domain:o,name:r,val:e,source:t})}function En(n,e){var r=nn("methodStore"),t=Q("proxyWindowMethods");return r.getOrSet(n,function(){return{}})[e]||t.get(e)}function On(n,e,r,t,o){!function(n){var e=o.on;Q("builtinListeners").getOrSet("functionCalls",function(){return e(J.METHOD,{domain:X},function(n){var e=n.source,r=n.origin,t=n.data,o=t.id,i=t.name,u=En(e,o);if(!u)throw new Error("Could not find method '"+t.name+"' with id: "+t.id+" in "+w(window));var a=u.source,c=u.domain,s=u.val;return k.try(function(){if(!O(c,r))throw new Error("Method '"+t.name+"' domain "+JSON.stringify(q(u.domain)?u.domain.source:u.domain)+" does not match origin "+r+" in "+w(window));if(gn.isProxyWindow(a))return a.matchWindow(e).then(function(n){if(!n)throw new Error("Method call '"+t.name+"' failed - proxy window does not match source in "+w(window))})}).then(function(){return s.apply({source:e,origin:r},t.args)},function(n){return k.try(function(){if(s.onError)return s.onError(n)}).then(function(){throw n.stack&&(n.stack="Remote call to "+i+"()\n\n"+n.stack),n})}).then(function(n){return{result:n,id:o,name:i}})})})}();var i=r.__id__||z();n=gn.unwrap(n);var u=r.__name__||r.name||t;return gn.isProxyWindow(n)?(_n(i,r,u,n,e),n.awaitWindow().then(function(n){_n(i,r,u,n,e)})):_n(i,r,u,n,e),dn(Y.CROSS_DOMAIN_FUNCTION,{id:i,name:u})}function Wn(n,e,r,t){var o,i=t.on,u=t.send;return function(n,e){void 0===e&&(e=wn);var r=JSON.stringify(n,function(n){var r=this[n];if(sn(this))return r;var t=fn(r);if(!t)return r;var o=e[t]||hn[t];return o?o(r,n):r});return void 0===r?cn.UNDEFINED:r}(r,((o={})[cn.PROMISE]=function(r,t){return function(n,e,r,t,o){return dn(Y.CROSS_DOMAIN_ZALGO_PROMISE,{then:On(n,e,function(n,e){return r.then(n,e)},t,{on:o.on,send:o.send})})}(n,e,r,t,{on:i,send:u})},o[cn.FUNCTION]=function(r,t){return On(n,e,r,t,{on:i,send:u})},o[cn.OBJECT]=function(n){return W(n)||gn.isProxyWindow(n)?dn(Y.CROSS_DOMAIN_WINDOW,gn.serialize(n,{send:u})):n},o))}function Sn(n,e,r,t){var o,i=t.on,u=t.send;return function(n,e){if(void 0===e&&(e=pn),n!==cn.UNDEFINED)return JSON.parse(n,function(n,r){if(sn(this))return r;var t,o;if(sn(r)?(t=r.__type__,o=r.__val__):(t=fn(r),o=r),!t)return o;var i=e[t]||vn[t];return i?i(o,n):o})}(r,((o={})[Y.CROSS_DOMAIN_ZALGO_PROMISE]=function(n){return new k(n.then)},o[Y.CROSS_DOMAIN_FUNCTION]=function(r){return function(n,e,t,o){var i=r.id,u=r.name,a=o.send,c=function(r){function t(){var o=arguments;return gn.toProxyWindow(n,{send:a}).awaitWindow().then(function(n){var c=En(n,i);if(c&&c.val!==t)return c.val.apply({source:window,origin:w()},o);var s={domain:e,fireAndForget:r.fireAndForget},f=[].slice.call(o);return a(n,J.METHOD,{id:i,name:u,args:f},s).then(function(n){if(!r.fireAndForget)return n.data.result})}).catch(function(n){throw n})}return void 0===r&&(r={}),t.__name__=u,t.__origin__=e,t.__source__=n,t.__id__=i,t.origin=e,t},s=c();return s.fireAndForget=c({fireAndForget:!0}),s}(n,e,0,{on:i,send:u})},o[Y.CROSS_DOMAIN_WINDOW]=function(n){return gn.deserialize(n,{on:(e={on:i,send:u}).on,send:e.send});var e},o))}var bn={};function Rn(n,e,r,t){var o,i=t.on,u=t.send;if(_(n))throw new Error("Window is closed");for(var a=Wn(n,e,((o={}).__post_robot_10_0_18__=A({id:z(),origin:w(window)},r),o),{on:i,send:u}),c=Object.keys(bn),s=[],f=0;f<c.length;f++){var d=c[f];try{bn[d](n,a,e)}catch(n){s.push(n)}}if(s.length===c.length)throw new Error("All post-robot messaging strategies failed:\n\n"+s.map(B).join("\n\n"))}bn.postrobot_post_message=function(n,e,r){(Array.isArray(r)?r:"string"==typeof r?[r]:[X]).map(function(n){return 0===n.indexOf(i.FILE)?X:n}).forEach(function(r){n.postMessage(e,r)})};var xn,In="__domain_regex__";function Nn(n){return Q("responseListeners").get(n)}function Pn(n){Q("responseListeners").del(n)}function jn(n){return Q("erroredResponseListeners").has(n)}function kn(n){var e=n.name,r=n.win,t=n.domain,o=nn("requestListeners");if(r===X&&(r=null),t===X&&(t=null),!e)throw new Error("Name required to get request listener");for(var i=0,u=[r,$()];i<u.length;i++){var a=u[i];if(a){var c=o.get(a);if(c){var s=c[e];if(s){if(t&&"string"==typeof t){if(s[t])return s[t];if(s[In])for(var f=0,d=s[In];f<d.length;f++){var l=d[f],h=l.listener;if(O(l.regex,t))return h}}if(s[X])return s[X]}}}}}var An=((xn={}).postrobot_message_request=function(n,e,r,t){var o=t.on,i=t.send,u=kn({name:r.name,win:n,domain:e});function a(t,u,a){void 0===a&&(a={}),r.fireAndForget||_(n)||Rn(n,e,A({type:t,ack:u,hash:r.hash,name:r.name},a),{on:o,send:i})}return k.all([a("postrobot_message_ack"),k.try(function(){if(!u)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(u.domain,e))throw new Error("Request origin "+e+" does not match domain "+u.domain.toString());return u.handler({source:n,origin:e,data:r.data})}).then(function(n){return a("postrobot_message_response","success",{data:n})},function(n){return a("postrobot_message_response","error",{error:n})})]).then(U).catch(function(n){if(u&&u.handleError)return u.handleError(n);throw n})},xn.postrobot_message_ack=function(n,e,r){if(!jn(r.hash)){var t=Nn(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.postrobot_message_response=function(n,e,r){if(!jn(r.hash)){var t,i=Nn(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");Pn(r.hash),"error"===r.ack?i.promise.reject(r.error):"success"===r.ack&&i.promise.resolve({source:n,origin:e,data:r.data})}},xn);function Dn(n,e){var r=e.on,t=e.send,o=Q("receivedMessages");if(!window||window.closed)throw new Error("Message recieved in closed window");try{if(!n.source)return}catch(n){return}var u=n.source,a=n.origin,c=function(n,e,r,t){var o,i=t.on,u=t.send;try{o=Sn(e,r,n,{on:i,send:u})}catch(n){return}if(o&&"object"==typeof o&&null!==o&&(o=o.__post_robot_10_0_18__)&&"object"==typeof o&&null!==o&&o.type&&"string"==typeof o.type&&An[o.type])return o}(n.data,u,a,{on:r,send:t});c&&(un(u),o.has(c.id)||(o.set(c.id,!0),_(u)&&!c.fireAndForget||(0===c.origin.indexOf(i.FILE)&&(a=i.FILE+"//"),An[c.type](u,a,c,{on:r,send:t}))))}function Mn(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,u=nn("requestListeners");if(!t||"string"!=typeof t)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var a=[],c=0,s=o;c<s.length;c++)a.push(n({name:t,domain:i,win:s[c]},r));return{cancel:function(){for(var n=0;n<a.length;n++)a[n].cancel()}}}if(Array.isArray(i)){for(var f=[],d=0,l=i;d<l.length;d++)f.push(n({name:t,win:o,domain:l[d]},r));return{cancel:function(){for(var n=0;n<f.length;n++)f[n].cancel()}}}var h=kn({name:t,win:o,domain:i});if(o&&o!==X||(o=$()),i=i||X,h)throw o&&i?new Error("Request listener already exists for "+t+" on domain "+i.toString()+" for "+(o===$()?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+t+" for "+(o===$()?"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 w,v,p=u.getOrSet(o,function(){return{}}),m=G(p,t,function(){return{}}),y=i.toString();return q(i)?(w=G(m,In,function(){return[]})).push(v={regex:i,listener:r}):m[y]=r,{cancel:function(){delete m[y],v&&(w.splice(w.indexOf(v,1)),w.length||delete m[In]),Object.keys(m).length||delete p[t],o&&!Object.keys(p).length&&u.del(o)}}}({name:n,win:t,domain:o},{handler:e.handler,handleError:e.errorHandler||function(n){throw n},window:t,domain:o||X,name:n});return{cancel:function(){i.cancel()}}}function Tn(n,e,r){"function"==typeof(e=e||{})&&(r=e,e={});var t,o=new k;return e.errorHandler=function(n){t.cancel(),o.reject(n)},t=Mn(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.send;return k.try(function(){return function(n,e){var r=E(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(f(n)===n)return n;try{if(p(window,n)&&window.top)return window.top}catch(n){}try{if(p(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 u=0,a=n(i);u<a.length;u++)r.push(a[u])}return r}(n);e<r.length;e++){var t=r[e];try{if(t.top)return t.top}catch(n){}if(f(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=rn(n);return-1!==e&&(t=t.timeout(e,new Error(r+" did not load after "+e+"ms"))),t}(n,r):q(e)?tn(n,{send:o}):{domain:e}}).then(function(n){return n.domain})}var Cn=function n(e,r,t,o){var i=(o=o||{}).domain||X,u=o.timeout||-1,a=o.timeout||5e3,c=o.fireAndForget||!1;return k.try(function(){return function(n,e,r){if(!n)throw new Error("Expected name");if(r&&"string"!=typeof r&&!Array.isArray(r)&&!q(r))throw new TypeError("Expected domain to be a string, array, or regex");if(_(e))throw new Error("Target window is closed")}(r,e,i),Ln(e,i,a,{send:n})}).then(function(o){if(!O(i,o))throw new Error("Domain "+H(i)+" does not match "+H(o));i=o;var a,s,f=r===J.METHOD&&t&&"string"==typeof t.name?t.name+"()":r,d=new k,l=r+"_"+z();if(!c){var h={name:r,win:e,domain:i,promise:d};!function(n,e){Q("responseListeners").set(n,e)}(l,h);var v=nn("requestPromises").getOrSet(e,function(){return[]});v.push(d),d.catch(function(){!function(n){Q("erroredResponseListeners").set(n,!0)}(l),Pn(l)});var p=function(n){return nn("knownWindows").get(n,!1)}(e)?1e4:2e3,m=u,y=p,g=m,E=(a=function(){return _(e)?d.reject(new Error("Window closed for "+r+" before "+(h.ack?"response":"ack"))):h.cancelled?d.reject(new Error("Response listener was cancelled for "+r)):(y=Math.max(y-500,0),-1!==g&&(g=Math.max(g-500,0)),h.ack||0!==y?0===g?d.reject(new Error("No response for postMessage "+f+" in "+w()+" in "+m+"ms")):void 0:d.reject(new Error("No ack for postMessage "+f+" in "+w()+" in "+p+"ms")))},500,function n(){s=setTimeout(function(){a(),n()},500)}(),{cancel:function(){clearTimeout(s)}});d.finally(function(){E.cancel(),v.splice(v.indexOf(d,1))}).catch(U)}return Rn(e,i,{type:"postrobot_message_request",hash:l,name:r,data:t,fireAndForget:c},{on:Mn,send:n}),c?d.resolve():d})};function zn(n,e,r){return Wn(n,e,r,{on:Mn,send:Cn})}function Fn(n,e,r){return Sn(n,e,r,{on:Mn,send:Cn})}function Un(n){return gn.toProxyWindow(n,{send:Cn})}function Bn(){var n,e,r;Z().initialized||(Z().initialized=!0,function(n){var e=n.on,r=n.send,t=Z();t.receiveMessage=t.receiveMessage||function(n){return Dn(n,{on:e,send:r})}}({on:Mn,send:Cn}),e=(n={on:Mn,send:Cn}).on,r=n.send,Q().getOrSet("postMessageListener",function(){return(n=window).addEventListener("message",t=function(n){!function(n,e){var r=e.on,t=e.send,o=n.source||n.sourceElement,u=n.origin||n.originalEvent&&n.originalEvent.origin,a=n.data;if("null"===u&&(u=i.FILE+"//"),o){if(!u)throw new Error("Post message did not have origin domain");Dn({source:o,origin:u,data:a},{on:r,send:t})}}(n,{on:e,send:r})}),{cancel:function(){n.removeEventListener("message",t)}};var n,t}),function(n){var e=n.on,r=n.send;Q("builtinListeners").getOrSet("helloListener",function(){var n=e(J.HELLO,{domain:X},function(n){var e=n.source,r=n.origin;return rn(e).resolve({win:e,domain:r}),{instanceID:en()}}),t=E();return t&&tn(t,{send:r}).catch(U),n})}({on:Mn,send:Cn}))}function Hn(){var n;!function(){for(var n=Q("responseListeners"),e=0,r=n.keys();e<r.length;e++){var t=r[e],o=n.get(t);o&&(o.cancelled=!0),n.del(t)}}(),(n=Q().get("postMessageListener"))&&n.cancel(),delete window.__post_robot_10_0_18__}function qn(n){for(var e=0,r=nn("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 k}),r.d(e,"TYPES",function(){return!0}),r.d(e,"ProxyWindow",function(){return gn}),r.d(e,"setup",function(){return Bn}),r.d(e,"destroy",function(){return Hn}),r.d(e,"serializeMessage",function(){return zn}),r.d(e,"deserializeMessage",function(){return Fn}),r.d(e,"toProxyWindow",function(){return Un}),r.d(e,"on",function(){return Mn}),r.d(e,"once",function(){return Tn}),r.d(e,"send",function(){return Cn}),r.d(e,"markWindowKnown",function(){return un}),r.d(e,"cleanUpWindow",function(){return qn}),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{}.hasOwnProperty.call(n,e)},r.p="",r(r.s=0)}([function(n,e,r){"use strict";function t(n){return"[object RegExp]"==={}.toString.call(n)}r.r(e);var o={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},i="*",u={IFRAME:"iframe",POPUP:"popup"},a="Call was rejected by callee.\r\n";function c(n){return void 0===n&&(n=window),n.location.protocol===o.ABOUT}function s(n){if(void 0===n&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch(n){}}function f(n){if(void 0===n&&(n=window),n&&!s(n))try{return n.opener}catch(n){}}function d(n){try{return!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===o.FILE)return o.FILE+"//";if(r===o.ABOUT){var t=s(n);return t&&d()?l(t):o.ABOUT+"//"}var i=e.host;if(!i)throw new Error("Can not read window host");return r+"//"+i}function h(n){var e=l(n=n||window);return e&&n.mockDomain&&0===n.mockDomain.indexOf(o.MOCK)?n.mockDomain:e}function w(n){if(!function(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())return!0}catch(n){}try{if(l(n)===l(window))return!0}catch(n){}return!1}(n))return!1;try{if(n===window)return!0;if(c(n)&&d())return!0;if(h(window)===h(n))return!0}catch(n){}return!1}function p(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 v(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 u=0;u<100;u++){var a=void 0;try{a=e[u]}catch(n){return t}if(!a)return t;t.push(a)}return t}var m=[],y=[];function g(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!==a}if(e&&w(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}(m,n);if(-1!==r){var t=y[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 void 0===n&&(n=window),f(n=n||window)||s(n)||void 0}function E(n,e){if("string"==typeof n){if("string"==typeof e)return n===i||e===n;if(t(e))return!1;if(Array.isArray(e))return!1}return t(n)?t(e)?n.toString()===e.toString():!Array.isArray(e)&&Boolean(e.match(n)):!!Array.isArray(n)&&(Array.isArray(e)?JSON.stringify(n)===JSON.stringify(e):!t(e)&&n.some((function(n){return E(n,e)})))}function O(n){try{if(n===window)return!0}catch(n){if(n&&n.message===a)return!0}try{if("[object Window]"==={}.toString.call(n))return!0}catch(n){if(n&&n.message===a)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(n){if(n&&n.message===a)return!0}try{if(n&&n.self===n)return!0}catch(n){if(n&&n.message===a)return!0}try{if(n&&n.parent===n)return!0}catch(n){if(n&&n.message===a)return!0}try{if(n&&n.top===n)return!0}catch(n){if(n&&n.message===a)return!0}try{if(n&&"__unlikely_value__"===n.__cross_domain_utils_window_check__)return!1}catch(n){return!0}return!1}function W(n){try{n.close()}catch(n){}}function S(n){try{if(!n)return!1;if("undefined"!=typeof Promise&&n instanceof Promise)return!0;if("undefined"!=typeof window&&"function"==typeof window.Window&&n instanceof window.Window)return!1;if("undefined"!=typeof window&&"function"==typeof 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=[],x=[],I=0;function P(){if(!I&&b){var n=b;b=null,n.resolve()}}function N(){I+=1}function j(){I-=1,P()}var A=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,u=!1;N();try{n((function(n){u?e.resolve(n):(o=!0,r=n)}),(function(n){u?e.reject(n):(i=!0,t=n)}))}catch(n){return j(),void this.reject(n)}j(),u=!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():{}.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<x.length;r++)x[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.resolved,t=this.rejected,o=this.handlers;if(!this.dispatching&&(r||t)){this.dispatching=!0,N();for(var i=function(i){var u=o[i],a=u.onSuccess,c=u.onError,s=u.promise,f=void 0;if(r)try{f=a?a(e.value):e.value}catch(n){return s.reject(n),"continue"}else if(t){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<o.length;u++)i(u);o.length=0,this.dispatching=!1,j()}},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 u=e[i];if(u instanceof n){if(u.resolved)return o[i]=u.value,t-=1,"continue"}else if(!S(u))return o[i]=u,t-=1,"continue";n.resolve(u).then((function(n){o[i]=n,0==(t-=1)&&r.resolve(o)}),(function(n){r.reject(n)}))},u=0;u<e.length;u++)i(u);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 x.push(n),{cancel:function(){x.splice(x.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;N();try{o=e.apply(r,t||[])}catch(e){return j(),n.reject(e)}return j(),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,P(),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)({}).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=function(){function n(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",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(O(t)&&g(t)){if(n)try{n.delete(t)}catch(n){}e.splice(r,1),this.values.splice(r,1),r-=1}}},e.isSafeToReadWrite=function(n){return!O(n)},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))try{var t=this.name,o=n[t];return void(o&&o[0]===n?o[1]=e:Object.defineProperty(n,t,{value:[n,e],writable:!0}))}catch(n){}this._cleanupClosedWindows();var i=this.keys,u=this.values,a=D(i,n);-1===a?(i.push(n),u.push(e)):u[a]=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))try{var r=n[this.name];return r&&r[0]===n?r[1]:void 0}catch(n){}this._cleanupClosedWindows();var t=D(this.keys,n);if(-1!==t)return this.values[t]},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))try{var r=n[this.name];r&&r[0]===n&&(r[0]=r[1]=void 0)}catch(n){}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))try{var r=n[this.name];return!(!r||r[0]!==n)}catch(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 C(){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(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,(function(n,e){return String.fromCharCode(parseInt(e,16))})));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 L(n){var e={};function r(){for(var r=this,t=arguments,o=arguments.length,i=new Array(o),u=0;u<o;u++)i[u]=arguments[u];var a=function(n){try{return JSON.stringify([].slice.call(n),(function(n,e){return"function"==typeof e?"memoize["+function(n){if(M=M||new T,null==n||"object"!=typeof n&&"function"!=typeof n)throw new Error("Invalid object");var e=M.get(n);return e||(e=typeof n+":"+C(),M.set(n,e)),e}(e)+"]":e}))}catch(n){throw new Error("Arguments not serializable -- can not be used to memoize")}}(i);return e.hasOwnProperty(a)?e[a]:(e[a]=A.try((function(){return n.apply(r,t)})).finally((function(){delete e[a]})),e[a])}return r.reset=function(){e={}},r}function z(){}function F(n,e){if(void 0===e&&(e=1),e>=3)return"stringifyError stack overflow";try{if(!n)return"<unknown error: "+{}.toString.call(n)+">";if("string"==typeof n)return n;if(n instanceof Error){var r=n&&n.stack,t=n&&n.message;if(r&&t)return-1!==r.indexOf(t)?r:t+"\n"+r;if(r)return r;if(t)return t}return n&&n.toString&&"function"==typeof n.toString?n.toString():{}.toString.call(n)}catch(n){return"Error while stringifying error: "+F(n,e+1)}}function U(n){return"string"==typeof n?n:n&&n.toString&&"function"==typeof n.toString?n.toString():{}.toString.call(n)}function B(n){return"[object RegExp]"==={}.toString.call(n)}function H(n,e,r){if(n.hasOwnProperty(e))return n[e];var t=r();return n[e]=t,t}Object.create(Error.prototype);var q={METHOD:"postrobot_method",HELLO:"postrobot_hello",OPEN_TUNNEL:"postrobot_open_tunnel"},G="*",J={CROSS_DOMAIN_ZALGO_PROMISE:"cross_domain_zalgo_promise",CROSS_DOMAIN_FUNCTION:"cross_domain_function",CROSS_DOMAIN_WINDOW:"cross_domain_window"};function X(n){return void 0===n&&(n=window),n!==window?n.__post_robot_10_0_19__:n.__post_robot_10_0_19__=n.__post_robot_10_0_19__||{}}var Y=function(){return{}};function Z(n,e){return void 0===n&&(n="store"),void 0===e&&(e=Y),H(X(),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 H(n,e,r)},reset:function(){n=e()},keys:function(){return Object.keys(n)}}}))}var K=function(){};function Q(){var n=X();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new K,n.WINDOW_WILDCARD}function V(n,e){return void 0===n&&(n="store"),void 0===e&&(e=Y),Z("windowStore").getOrSet(n,(function(){var r=new T,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 H(t(e),n,r)}}}))}function $(){return Z("instance").getOrSet("instanceID",C)}function nn(n){return V("helloPromises").getOrSet(n,(function(){return new A}))}function en(n,e){return(0,e.send)(n,q.HELLO,{instanceID:$()},{domain:G,timeout:-1}).then((function(e){var r=e.origin,t=e.data.instanceID;return nn(n).resolve({win:n,domain:r}),{win:n,domain:r,instanceID:t}}))}function rn(n,e){var r=e.send;return V("windowInstanceIDPromises").getOrSet(n,(function(){return en(n,{send:r}).then((function(n){return n.instanceID}))}))}function tn(n){V("knownWindows").set(n,!0)}var on,un={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 an(n){return"object"==typeof n&&null!==n&&"string"==typeof n.__type__}function cn(n){return void 0===n?un.UNDEFINED:null===n?un.NULL:Array.isArray(n)?un.ARRAY:"function"==typeof n?un.FUNCTION:"object"==typeof n?n instanceof Error?un.ERROR:"function"==typeof n.then?un.PROMISE:"[object RegExp]"==={}.toString.call(n)?un.REGEX:"[object Date]"==={}.toString.call(n)?un.DATE:un.OBJECT:"string"==typeof n?un.STRING:"number"==typeof n?un.NUMBER:"boolean"==typeof n?un.BOOLEAN:void 0}function sn(n,e){return{__type__:n,__val__:e}}var fn,dn=((on={})[un.FUNCTION]=function(){},on[un.ERROR]=function(n){return sn(un.ERROR,{message:n.message,stack:n.stack,code:n.code})},on[un.PROMISE]=function(){},on[un.REGEX]=function(n){return sn(un.REGEX,n.source)},on[un.DATE]=function(n){return sn(un.DATE,n.toJSON())},on[un.ARRAY]=function(n){return n},on[un.OBJECT]=function(n){return n},on[un.STRING]=function(n){return n},on[un.NUMBER]=function(n){return n},on[un.BOOLEAN]=function(n){return n},on[un.NULL]=function(n){return n},on),ln={},hn=((fn={})[un.FUNCTION]=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},fn[un.ERROR]=function(n){var e=n.stack,r=n.code,t=new Error(n.message);return t.code=r,t.stack=e+"\n\n"+t.stack,t},fn[un.PROMISE]=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},fn[un.REGEX]=function(n){return new RegExp(n)},fn[un.DATE]=function(n){return new Date(n)},fn[un.ARRAY]=function(n){return n},fn[un.OBJECT]=function(n){return n},fn[un.STRING]=function(n){return n},fn[un.NUMBER]=function(n){return n},fn[un.BOOLEAN]=function(n){return n},fn[un.NULL]=function(n){return n},fn),wn={};function pn(){for(var n=Z("idToProxyWindow"),e=0,r=n.keys();e<r.length;e++){var t=r[e];n.get(t).shouldClean()&&n.del(t)}}new A((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 vn=function(){function n(n){var e=n.send,r=n.win,t=n.serializedWindow;this.id=void 0,this.isProxyWindow=!0,this.serializedWindow=void 0,this.actualWindow=void 0,this.actualWindowPromise=void 0,this.send=void 0,this.name=void 0,this.actualWindowPromise=new A,this.serializedWindow=t||function(n,e){var r,t=e.send;return{id:C(),getType:function(){return n.then((function(n){return f(n)?u.POPUP:u.IFRAME}))},getInstanceID:L((function(){return n.then((function(n){return rn(n,{send:t})}))})),close:function(){return n.then(W)},getName:function(){return n.then((function(n){if(!g(n))return r}))},focus:function(){return n.then((function(n){n.focus()}))},isClosed:function(){return n.then((function(n){return g(n)}))},setLocation:function(e){return n.then((function(n){if(w(n))try{if(n.location&&"function"==typeof n.location.replace)return void n.location.replace(e)}catch(n){}n.location=e}))},setName:function(e){return n.then((function(n){var t=function(n){if(!w(n))throw new Error("Expected window to be same domain");return n}(n);t.name=e,t.frameElement&&t.frameElement.setAttribute("name",e),r=e}))}}}(this.actualWindowPromise,{send:e}),Z("idToProxyWindow").set(this.getID(),this),r&&this.setWindow(r)}var e=n.prototype;return e.getID=function(){return this.serializedWindow.id},e.getType=function(){return this.serializedWindow.getType()},e.isPopup=function(){return this.getType()===u.POPUP},e.setLocation=function(n){var e=this;return this.serializedWindow.setLocation(n).then((function(){return e}))},e.getName=function(){return this.serializedWindow.getName()},e.setName=function(n){var e=this;return this.serializedWindow.setName(n).then((function(){return e}))},e.close=function(){var n=this;return this.serializedWindow.close().then((function(){return n}))},e.focus=function(){var n=this;return A.all([this.isPopup()&&this.getName().then((function(n){n&&window.open("",n)})),this.serializedWindow.focus()]).then((function(){return n}))},e.isClosed=function(){return this.serializedWindow.isClosed()},e.getWindow=function(){return this.actualWindow},e.setWindow=function(n){this.actualWindow=n,this.actualWindowPromise.resolve(this.actualWindow),V("winToProxyWindow").set(n,this)},e.awaitWindow=function(){return this.actualWindowPromise},e.matchWindow=function(n,e){var r=this,t=e.send;return A.try((function(){return r.actualWindow?n===r.actualWindow:A.hash({proxyInstanceID:r.getInstanceID(),knownWindowInstanceID:rn(n,{send:t})}).then((function(e){var t=e.proxyInstanceID===e.knownWindowInstanceID;return t&&r.setWindow(n),t}))}))},e.unwrap=function(){return this.actualWindow||this},e.getInstanceID=function(){return this.serializedWindow.getInstanceID()},e.shouldClean=function(){return Boolean(this.actualWindow&&g(this.actualWindow))},e.serialize=function(){return this.serializedWindow},n.unwrap=function(e){return n.isProxyWindow(e)?e.unwrap():e},n.serialize=function(e,r){var t=r.send;return pn(),n.toProxyWindow(e,{send:t}).serialize()},n.deserialize=function(e,r){var t=r.send;return pn(),Z("idToProxyWindow").get(e.id)||new n({serializedWindow:e,send:t})},n.isProxyWindow=function(n){return Boolean(n&&!O(n)&&n.isProxyWindow)},n.toProxyWindow=function(e,r){var t=r.send;if(pn(),n.isProxyWindow(e))return e;var o=e;return V("winToProxyWindow").get(o)||new n({win:o,send:t})},n}();function mn(n,e,r,t,o){var i=V("methodStore"),u=Z("proxyWindowMethods");vn.isProxyWindow(t)?u.set(n,{val:e,name:r,domain:o,source:t}):(u.del(n),i.getOrSet(t,(function(){return{}}))[n]={domain:o,name:r,val:e,source:t})}function yn(n,e){var r=V("methodStore"),t=Z("proxyWindowMethods");return r.getOrSet(n,(function(){return{}}))[e]||t.get(e)}function gn(n,e,r,t,o){!function(n){var e=n.on,r=n.send;Z("builtinListeners").getOrSet("functionCalls",(function(){return e(q.METHOD,{domain:G},(function(n){var e=n.source,t=n.origin,o=n.data,i=o.id,u=o.name,a=yn(e,i);if(!a)throw new Error("Could not find method '"+o.name+"' with id: "+o.id+" in "+h(window));var c=a.source,s=a.domain,f=a.val;return A.try((function(){if(!E(s,t))throw new Error("Method '"+o.name+"' domain "+JSON.stringify(B(a.domain)?a.domain.source:a.domain)+" does not match origin "+t+" in "+h(window));if(vn.isProxyWindow(c))return c.matchWindow(e,{send:r}).then((function(n){if(!n)throw new Error("Method call '"+o.name+"' failed - proxy window does not match source in "+h(window))}))})).then((function(){return f.apply({source:e,origin:t},o.args)}),(function(n){return A.try((function(){if(f.onError)return f.onError(n)})).then((function(){throw n.stack&&(n.stack="Remote call to "+u+"()\n\n"+n.stack),n}))})).then((function(n){return{result:n,id:i,name:u}}))}))}))}({on:o.on,send:o.send});var i=r.__id__||C();n=vn.unwrap(n);var u=r.__name__||r.name||t;return vn.isProxyWindow(n)?(mn(i,r,u,n,e),n.awaitWindow().then((function(n){mn(i,r,u,n,e)}))):mn(i,r,u,n,e),sn(J.CROSS_DOMAIN_FUNCTION,{id:i,name:u})}function _n(n,e,r,t){var o,i=t.on,u=t.send;return function(n,e){void 0===e&&(e=ln);var r=JSON.stringify(n,(function(n){var r=this[n];if(an(this))return r;var t=cn(r);if(!t)return r;var o=e[t]||dn[t];return o?o(r,n):r}));return void 0===r?un.UNDEFINED:r}(r,((o={})[un.PROMISE]=function(r,t){return function(n,e,r,t,o){return sn(J.CROSS_DOMAIN_ZALGO_PROMISE,{then:gn(n,e,(function(n,e){return r.then(n,e)}),t,{on:o.on,send:o.send})})}(n,e,r,t,{on:i,send:u})},o[un.FUNCTION]=function(r,t){return gn(n,e,r,t,{on:i,send:u})},o[un.OBJECT]=function(n){return O(n)||vn.isProxyWindow(n)?sn(J.CROSS_DOMAIN_WINDOW,vn.serialize(n,{send:u})):n},o))}function En(n,e,r,t){var o,i=t.on,u=t.send;return function(n,e){if(void 0===e&&(e=wn),n!==un.UNDEFINED)return JSON.parse(n,(function(n,r){if(an(this))return r;var t,o;if(an(r)?(t=r.__type__,o=r.__val__):(t=cn(r),o=r),!t)return o;var i=e[t]||hn[t];return i?i(o,n):o}))}(r,((o={})[J.CROSS_DOMAIN_ZALGO_PROMISE]=function(n){return function(n,e,r){return new A(r.then)}(0,0,n)},o[J.CROSS_DOMAIN_FUNCTION]=function(r){return function(n,e,r,t){var o=r.id,i=r.name,u=t.send,a=function(r){function t(){var a=arguments;return vn.toProxyWindow(n,{send:u}).awaitWindow().then((function(n){var c=yn(n,o);if(c&&c.val!==t)return c.val.apply({source:window,origin:h()},a);var s={domain:e,fireAndForget:r.fireAndForget},f=[].slice.call(a);return u(n,q.METHOD,{id:o,name:i,args:f},s).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=a();return c.fireAndForget=a({fireAndForget:!0}),c}(n,e,r,{on:i,send:u})},o[J.CROSS_DOMAIN_WINDOW]=function(n){return vn.deserialize(n,{send:u})},o))}var On={};function Wn(n,e,r,t){var o,i=t.on,u=t.send;if(g(n))throw new Error("Window is closed");for(var a=_n(n,e,((o={}).__post_robot_10_0_19__=k({id:C(),origin:h(window)},r),o),{on:i,send:u}),c=Object.keys(On),s=[],f=0;f<c.length;f++){var d=c[f];try{On[d](n,a,e)}catch(n){s.push(n)}}if(s.length===c.length)throw new Error("All post-robot messaging strategies failed:\n\n"+s.map(F).join("\n\n"))}On.postrobot_post_message=function(n,e,r){(Array.isArray(r)?r:"string"==typeof r?[r]:[G]).map((function(n){return 0===n.indexOf(o.FILE)?G:n})).forEach((function(r){n.postMessage(e,r)}))};var Sn,bn="__domain_regex__";function Rn(n){return Z("responseListeners").get(n)}function xn(n){Z("responseListeners").del(n)}function In(n){return Z("erroredResponseListeners").has(n)}function Pn(n){var e=n.name,r=n.win,t=n.domain,o=V("requestListeners");if(r===G&&(r=null),t===G&&(t=null),!e)throw new Error("Name required to get request listener");for(var i=0,u=[r,Q()];i<u.length;i++){var a=u[i];if(a){var c=o.get(a);if(c){var s=c[e];if(s){if(t&&"string"==typeof t){if(s[t])return s[t];if(s[bn])for(var f=0,d=s[bn];f<d.length;f++){var l=d[f],h=l.listener;if(E(l.regex,t))return h}}if(s[G])return s[G]}}}}}var Nn=((Sn={}).postrobot_message_request=function(n,e,r,t){var o=t.on,i=t.send,u=Pn({name:r.name,win:n,domain:e});function a(t,u,a){void 0===a&&(a={}),r.fireAndForget||g(n)||Wn(n,e,k({type:t,ack:u,hash:r.hash,name:r.name},a),{on:o,send:i})}return A.all([a("postrobot_message_ack"),A.try((function(){if(!u)throw new Error("No handler found for post message: "+r.name+" from "+e+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!E(u.domain,e))throw new Error("Request origin "+e+" does not match domain "+u.domain.toString());return u.handler({source:n,origin:e,data:r.data})})).then((function(n){return a("postrobot_message_response","success",{data:n})}),(function(n){return a("postrobot_message_response","error",{error:n})}))]).then(z).catch((function(n){if(u&&u.handleError)return u.handleError(n);throw n}))},Sn.postrobot_message_ack=function(n,e,r){if(!In(r.hash)){var t=Rn(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(!E(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}},Sn.postrobot_message_response=function(n,e,r){if(!In(r.hash)){var o,i=Rn(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(!E(i.domain,e))throw new Error("Response origin "+e+" does not match domain "+(o=i.domain,Array.isArray(o)?"("+o.join(" | ")+")":t(o)?"RegExp("+o.toString():o.toString()));if(n!==i.win)throw new Error("Response source does not match registered window");xn(r.hash),"error"===r.ack?i.promise.reject(r.error):"success"===r.ack&&i.promise.resolve({source:n,origin:e,data:r.data})}},Sn);function jn(n,e){var r=e.on,t=e.send,i=Z("receivedMessages");if(!window||window.closed)throw new Error("Message recieved in closed window");try{if(!n.source)return}catch(n){return}var u=n.source,a=n.origin,c=function(n,e,r,t){var o,i=t.on,u=t.send;try{o=En(e,r,n,{on:i,send:u})}catch(n){return}if(o&&"object"==typeof o&&null!==o&&(o=o.__post_robot_10_0_19__)&&"object"==typeof o&&null!==o&&o.type&&"string"==typeof o.type&&Nn[o.type])return o}(n.data,u,a,{on:r,send:t});c&&(tn(u),i.has(c.id)||(i.set(c.id,!0),g(u)&&!c.fireAndForget||(0===c.origin.indexOf(o.FILE)&&(a=o.FILE+"//"),Nn[c.type](u,a,c,{on:r,send:t}))))}function An(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,u=V("requestListeners");if(!t||"string"!=typeof t)throw new Error("Name required to add request listener");if(Array.isArray(o)){for(var a=[],c=0,s=o;c<s.length;c++)a.push(n({name:t,domain:i,win:s[c]},r));return{cancel:function(){for(var n=0;n<a.length;n++)a[n].cancel()}}}if(Array.isArray(i)){for(var f=[],d=0,l=i;d<l.length;d++)f.push(n({name:t,win:o,domain:l[d]},r));return{cancel:function(){for(var n=0;n<f.length;n++)f[n].cancel()}}}var h=Pn({name:t,win:o,domain:i});if(o&&o!==G||(o=Q()),i=i||G,h)throw o&&i?new Error("Request listener already exists for "+t+" on domain "+i.toString()+" for "+(o===Q()?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+t+" for "+(o===Q()?"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 w,p,v=u.getOrSet(o,(function(){return{}})),m=H(v,t,(function(){return{}})),y=i.toString();return B(i)?(w=H(m,bn,(function(){return[]}))).push(p={regex:i,listener:r}):m[y]=r,{cancel:function(){delete m[y],p&&(w.splice(w.indexOf(p,1)),w.length||delete m[bn]),Object.keys(m).length||delete v[t],o&&!Object.keys(v).length&&u.del(o)}}}({name:n,win:t,domain:o},{handler:e.handler,handleError:e.errorHandler||function(n){throw n},window:t,domain:o||G,name:n});return{cancel:function(){i.cancel()}}}function kn(n,e,r){"function"==typeof(e=e||{})&&(r=e,e={});var t,o=new A;return e.errorHandler=function(n){t.cancel(),o.reject(n)},t=An(n,e,(function(n){if(t.cancel(),o.resolve(n),r)return r(n)})),o.cancel=t.cancel,o}function Dn(n,e,r,t){var o=t.send;return A.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(p(window,n)&&window.top)return window.top}catch(n){}try{if(p(n,window)&&window.top)return window.top}catch(n){}for(var e=0,r=function n(e){for(var r=[],t=0,o=v(e);t<o.length;t++){var i=o[t];r.push(i);for(var u=0,a=n(i);u<a.length;u++)r.push(a[u])}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=v(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=nn(n);return-1!==e&&(t=t.timeout(e,new Error(r+" did not load after "+e+"ms"))),t}(n,r):B(e)?en(n,{send:o}):{domain:e}})).then((function(n){return n.domain}))}var Mn=function n(e,r,t,o){var i=(o=o||{}).domain||G,u=o.timeout||-1,a=o.timeout||5e3,c=o.fireAndForget||!1;return A.try((function(){return function(n,e,r){if(!n)throw new Error("Expected name");if(r&&"string"!=typeof r&&!Array.isArray(r)&&!B(r))throw new TypeError("Expected domain to be a string, array, or regex");if(g(e))throw new Error("Target window is closed")}(r,e,i),Dn(e,i,a,{send:n})})).then((function(o){if(!E(i,o))throw new Error("Domain "+U(i)+" does not match "+U(o));i=o;var a,s,f=r===q.METHOD&&t&&"string"==typeof t.name?t.name+"()":r,d=new A,l=r+"_"+C();if(!c){var w={name:r,win:e,domain:i,promise:d};!function(n,e){Z("responseListeners").set(n,e)}(l,w);var p=V("requestPromises").getOrSet(e,(function(){return[]}));p.push(d),d.catch((function(){!function(n){Z("erroredResponseListeners").set(n,!0)}(l),xn(l)}));var v=function(n){return V("knownWindows").get(n,!1)}(e)?1e4:2e3,m=u,y=v,_=m,O=(a=function(){return g(e)?d.reject(new Error("Window closed for "+r+" before "+(w.ack?"response":"ack"))):w.cancelled?d.reject(new Error("Response listener was cancelled for "+r)):(y=Math.max(y-500,0),-1!==_&&(_=Math.max(_-500,0)),w.ack||0!==y?0===_?d.reject(new Error("No response for postMessage "+f+" in "+h()+" in "+m+"ms")):void 0:d.reject(new Error("No ack for postMessage "+f+" in "+h()+" in "+v+"ms")))},500,function n(){s=setTimeout((function(){a(),n()}),500)}(),{cancel:function(){clearTimeout(s)}});d.finally((function(){O.cancel(),p.splice(p.indexOf(d,1))})).catch(z)}return Wn(e,i,{type:"postrobot_message_request",hash:l,name:r,data:t,fireAndForget:c},{on:An,send:n}),c?d.resolve():d}))};function Tn(n,e,r){return _n(n,e,r,{on:An,send:Mn})}function Cn(n,e,r){return En(n,e,r,{on:An,send:Mn})}function Ln(n){return new vn({send:Mn,win:n})}function zn(n){return vn.toProxyWindow(n,{send:Mn})}function Fn(){var n,e,r;X().initialized||(X().initialized=!0,function(n){var e=n.on,r=n.send,t=X();t.receiveMessage=t.receiveMessage||function(n){return jn(n,{on:e,send:r})}}({on:An,send:Mn}),e=(n={on:An,send:Mn}).on,r=n.send,Z().getOrSet("postMessageListener",(function(){return(n=window).addEventListener("message",t=function(n){!function(n,e){var r=e.on,t=e.send,i=n.source||n.sourceElement,u=n.origin||n.originalEvent&&n.originalEvent.origin,a=n.data;if("null"===u&&(u=o.FILE+"//"),i){if(!u)throw new Error("Post message did not have origin domain");jn({source:i,origin:u,data:a},{on:r,send:t})}}(n,{on:e,send:r})}),{cancel:function(){n.removeEventListener("message",t)}};var n,t})),function(n){var e=n.on,r=n.send;Z("builtinListeners").getOrSet("helloListener",(function(){var n=e(q.HELLO,{domain:G},(function(n){var e=n.source,r=n.origin;return nn(e).resolve({win:e,domain:r}),{instanceID:$()}})),t=_();return t&&en(t,{send:r}).catch(z),n}))}({on:An,send:Mn}))}function Un(){var n;!function(){for(var n=Z("responseListeners"),e=0,r=n.keys();e<r.length;e++){var t=r[e],o=n.get(t);o&&(o.cancelled=!0),n.del(t)}}(),(n=Z().get("postMessageListener"))&&n.cancel(),delete window.__post_robot_10_0_19__}function Bn(n){for(var e=0,r=V("requestPromises").get(n,[]);e<r.length;e++)r[e].reject(new Error("Window cleaned up before response")).catch(z)}r.d(e,"bridge",(function(){})),r.d(e,"Promise",(function(){return A})),r.d(e,"TYPES",(function(){return!0})),r.d(e,"ProxyWindow",(function(){return vn})),r.d(e,"setup",(function(){return Fn})),r.d(e,"destroy",(function(){return Un})),r.d(e,"serializeMessage",(function(){return Tn})),r.d(e,"deserializeMessage",(function(){return Cn})),r.d(e,"createProxyWindow",(function(){return Ln})),r.d(e,"toProxyWindow",(function(){return zn})),r.d(e,"on",(function(){return An})),r.d(e,"once",(function(){return kn})),r.d(e,"send",(function(){return Mn})),r.d(e,"markWindowKnown",(function(){return tn})),r.d(e,"cleanUpWindow",(function(){return Bn})),Fn()}])})); | ||
//# sourceMappingURL=post-robot.min.js.map |
{ | ||
"name": "post-robot", | ||
"version": "10.0.18", | ||
"version": "10.0.19", | ||
"description": "Simple postMessage based server.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
/* @flow */ | ||
import { ZalgoPromise } from 'zalgo-promise/src'; | ||
import { isSameDomain, getOpener, getDomain, getFrameByName, type CrossDomainWindowType } from 'cross-domain-utils/src'; | ||
import { isSameDomain, getOpener, getDomain, getFrameByName, assertSameDomain, type CrossDomainWindowType } from 'cross-domain-utils/src'; | ||
import { noop } from 'belter/src'; | ||
@@ -21,4 +21,3 @@ | ||
// $FlowFixMe | ||
if (isSameDomain(frame) && isSameDomain(frame) && getGlobal(frame)) { | ||
if (isSameDomain(frame) && getGlobal(assertSameDomain(frame))) { | ||
return frame; | ||
@@ -33,4 +32,3 @@ } | ||
interval = setInterval(() => { // eslint-disable-line prefer-const | ||
// $FlowFixMe | ||
if (frame && isSameDomain(frame) && getGlobal(frame)) { | ||
if (frame && isSameDomain(frame) && getGlobal(assertSameDomain(frame))) { | ||
clearInterval(interval); | ||
@@ -71,4 +69,3 @@ clearTimeout(timeout); | ||
// $FlowFixMe | ||
return getGlobal(bridge).openTunnelToParent({ | ||
return getGlobal(assertSameDomain(bridge)).openTunnelToParent({ | ||
@@ -75,0 +72,0 @@ name: window.name, |
@@ -24,6 +24,3 @@ /* @flow */ | ||
return bridgePromise.then(bridge => { | ||
// $FlowFixMe | ||
if (source !== bridge) { | ||
// $FlowFixMe | ||
throw new Error(`Message source does not matched registered bridge for domain ${ origin }`); | ||
@@ -44,3 +41,2 @@ } | ||
// $FlowFixMe | ||
if (!popupWindowsByName.get(data.name).domain) { | ||
@@ -50,9 +46,6 @@ throw new Error(`We do not have a registered domain for window ${ data.name }`); | ||
// $FlowFixMe | ||
if (popupWindowsByName.get(data.name).domain !== origin) { | ||
// $FlowFixMe | ||
throw new Error(`Message origin ${ origin } does not matched registered window origin ${ popupWindowsByName.get(data.name).domain }`); | ||
} | ||
// $FlowFixMe | ||
registerRemoteSendMessage(popupWindowsByName.get(data.name).win, origin, data.sendMessage); | ||
@@ -172,3 +165,4 @@ | ||
// $FlowFixMe | ||
if (isWindowClosed(popupWindowsByName.get(winName).win)) { | ||
const details = popupWindowsByName.get(winName); | ||
if (!details || isWindowClosed(details.win)) { | ||
popupWindowsByName.del(winName); | ||
@@ -178,3 +172,3 @@ } | ||
const details : WinDetails = popupWindowsByWin.getOrSet(win, () => { | ||
const details = popupWindowsByWin.getOrSet(win, () : WinDetails => { | ||
if (!name) { | ||
@@ -184,3 +178,3 @@ return { win }; | ||
return popupWindowsByName.getOrSet(name, () => { | ||
return popupWindowsByName.getOrSet(name, () : WinDetails => { | ||
return { win, name }; | ||
@@ -187,0 +181,0 @@ }); |
@@ -184,3 +184,2 @@ /* @flow */ | ||
const nameListeners = requestListeners.getOrSet(win, () => ({})); | ||
// $FlowFixMe | ||
const domainListeners = getOrSet(nameListeners, name, () => ({})); | ||
@@ -214,7 +213,5 @@ | ||
if (!Object.keys(domainListeners).length) { | ||
// $FlowFixMe | ||
delete nameListeners[name]; | ||
} | ||
// $FlowFixMe | ||
if (win && !Object.keys(nameListeners).length) { | ||
@@ -221,0 +218,0 @@ requestListeners.del(win); |
@@ -142,3 +142,2 @@ /* @flow */ | ||
return globalStore().getOrSet('postMessageListener', () => { | ||
// $FlowFixMe | ||
return addEventListener(window, 'message', event => { | ||
@@ -145,0 +144,0 @@ // $FlowFixMe |
@@ -34,3 +34,2 @@ /* @flow */ | ||
// $FlowFixMe | ||
export function globalStore<T : mixed>(key? : string = 'store', defStore? : ObjectGetter = getObj) : GlobalStore<T> { | ||
@@ -85,3 +84,2 @@ return getOrSet(getGlobal(), key, () => { | ||
// $FlowFixMe | ||
export function windowStore<T>(key? : string = 'store', defStore? : ObjectGetter = getObj) : WindowStore<T> { | ||
@@ -88,0 +86,0 @@ return globalStore('windowStore').getOrSet(key, () => { |
@@ -11,3 +11,3 @@ /* @flow */ | ||
export { ProxyWindow } from './serialize'; | ||
export { setup, destroy, serializeMessage, deserializeMessage, toProxyWindow } from './setup'; | ||
export { setup, destroy, serializeMessage, deserializeMessage, createProxyWindow, toProxyWindow } from './setup'; | ||
export { on, once, send } from './public'; | ||
@@ -14,0 +14,0 @@ export { markWindowKnown } from './lib'; |
@@ -51,4 +51,2 @@ /* @flow */ | ||
export const send : SendType = (win, name, data, options) => { | ||
// $FlowFixMe | ||
options = options || {}; | ||
@@ -55,0 +53,0 @@ let domain = options.domain || WILDCARD; |
@@ -42,3 +42,3 @@ /* @flow */ | ||
function listenForFunctionCalls({ on } : { on : OnType }) : CancelableType { | ||
function listenForFunctionCalls({ on, send } : { on : OnType, send : SendType }) : CancelableType { | ||
return globalStore('builtinListeners').getOrSet('functionCalls', () => { | ||
@@ -64,3 +64,3 @@ return on(MESSAGE_NAME.METHOD, { domain: WILDCARD }, ({ source, origin, data } : { source : CrossDomainWindowType, origin : string, data : Object }) => { | ||
// $FlowFixMe | ||
return methodSource.matchWindow(source).then(match => { | ||
return methodSource.matchWindow(source, { send }).then(match => { | ||
if (!match) { | ||
@@ -106,4 +106,4 @@ throw new Error(`Method call '${ data.name }' failed - proxy window does not match source in ${ getDomain(window) }`); | ||
export function serializeFunction<T>(destination : CrossDomainWindowType | ProxyWindow, domain : DomainMatcher, val : SerializableFunction<T>, key : string, { on } : { on : OnType }) : SerializedFunction { | ||
listenForFunctionCalls({ on }); | ||
export function serializeFunction<T>(destination : CrossDomainWindowType | ProxyWindow, domain : DomainMatcher, val : SerializableFunction<T>, key : string, { on, send } : { on : OnType, send : SendType }) : SerializedFunction { | ||
listenForFunctionCalls({ on, send }); | ||
@@ -110,0 +110,0 @@ const id = val.__id__ || uniqueID(); |
@@ -27,4 +27,4 @@ /* @flow */ | ||
[ SERIALIZATION_TYPE.CROSS_DOMAIN_FUNCTION ]: (serializedFunction) => deserializeFunction(source, origin, serializedFunction, { on, send }), | ||
[ SERIALIZATION_TYPE.CROSS_DOMAIN_WINDOW ]: (serializedWindow) => deserializeWindow(source, origin, serializedWindow, { on, send }) | ||
[ SERIALIZATION_TYPE.CROSS_DOMAIN_WINDOW ]: (serializedWindow) => deserializeWindow(source, origin, serializedWindow, { send }) | ||
}); | ||
} |
@@ -13,3 +13,3 @@ /* @flow */ | ||
import { linkWindow } from '../bridge'; | ||
import type { OnType, SendType } from '../types'; | ||
import type { SendType } from '../types'; | ||
@@ -26,5 +26,5 @@ function cleanupProxyWindows() { | ||
type SerializedProxyWindow = {| | ||
type SerializedWindowType = {| | ||
id : string, | ||
type : $Values<typeof WINDOW_TYPE>, | ||
getType : () => ZalgoPromise<$Values<typeof WINDOW_TYPE>>, | ||
close : () => ZalgoPromise<void>, | ||
@@ -39,13 +39,15 @@ focus : () => ZalgoPromise<void>, | ||
function getSerializedWindow(id : string, win : CrossDomainWindowType, { send } : { send : SendType }) : SerializedProxyWindow { | ||
function getSerializedWindow(winPromise : ZalgoPromise<CrossDomainWindowType>, { send } : { send : SendType }) : SerializedWindowType { | ||
let windowName; | ||
const id = uniqueID(); | ||
return { | ||
id, | ||
type: getOpener(win) ? WINDOW_TYPE.POPUP : WINDOW_TYPE.IFRAME, | ||
getInstanceID: memoizePromise(() => getWindowInstanceID(win, { send })), | ||
close: () => ZalgoPromise.try(() => { | ||
closeWindow(win); | ||
getType: () => winPromise.then(win => { | ||
return getOpener(win) ? WINDOW_TYPE.POPUP : WINDOW_TYPE.IFRAME; | ||
}), | ||
getName: () => ZalgoPromise.try(() => { | ||
getInstanceID: memoizePromise(() => winPromise.then(win => getWindowInstanceID(win, { send }))), | ||
close: () => winPromise.then(closeWindow), | ||
getName: () => winPromise.then(win => { | ||
if (isWindowClosed(win)) { | ||
@@ -57,9 +59,9 @@ return; | ||
}), | ||
focus: () => ZalgoPromise.try(() => { | ||
focus: () => winPromise.then(win => { | ||
win.focus(); | ||
}), | ||
isClosed: () => ZalgoPromise.try(() => { | ||
isClosed: () => winPromise.then(win => { | ||
return isWindowClosed(win); | ||
}), | ||
setLocation: (href) => ZalgoPromise.try(() => { | ||
setLocation: (href) => winPromise.then(win => { | ||
if (isSameDomain(win)) { | ||
@@ -79,3 +81,3 @@ try { | ||
}), | ||
setName: (name) => ZalgoPromise.try(() => { | ||
setName: (name) => winPromise.then(win => { | ||
if (__POST_ROBOT__.__IE_POPUP_SUPPORT__) { | ||
@@ -85,8 +87,8 @@ linkWindow({ win, name }); | ||
win = assertSameDomain(win); | ||
const sameDomainWin = assertSameDomain(win); | ||
win.name = name; | ||
sameDomainWin.name = name; | ||
if (win.frameElement) { | ||
win.frameElement.setAttribute('name', name); | ||
if (sameDomainWin.frameElement) { | ||
sameDomainWin.frameElement.setAttribute('name', name); | ||
} | ||
@@ -101,5 +103,6 @@ | ||
id : string | ||
isProxyWindow : true = true | ||
serializedWindow : SerializedProxyWindow | ||
actualWindow : CrossDomainWindowType | ||
serializedWindow : SerializedWindowType | ||
actualWindow : ?CrossDomainWindowType | ||
actualWindowPromise : ZalgoPromise<CrossDomainWindowType> | ||
@@ -109,15 +112,19 @@ send : SendType | ||
constructor(serializedWindow : SerializedProxyWindow, actualWindow? : ?CrossDomainWindowType, { send } : { send : SendType }) { | ||
this.serializedWindow = serializedWindow; | ||
constructor({ send, win, serializedWindow } : { win? : CrossDomainWindowType, serializedWindow? : SerializedWindowType, send : SendType }) { | ||
this.actualWindowPromise = new ZalgoPromise(); | ||
this.send = send; | ||
if (actualWindow) { | ||
this.setWindow(actualWindow); | ||
this.serializedWindow = serializedWindow || getSerializedWindow(this.actualWindowPromise, { send }); | ||
globalStore('idToProxyWindow').set(this.getID(), this); | ||
if (win) { | ||
this.setWindow(win); | ||
} | ||
} | ||
getType() : $Values<typeof WINDOW_TYPE> { | ||
return this.serializedWindow.type; | ||
getID() : string { | ||
return this.serializedWindow.id; | ||
} | ||
getType() : ZalgoPromise<$Values<typeof WINDOW_TYPE>> { | ||
return this.serializedWindow.getType(); | ||
} | ||
isPopup() : boolean { | ||
@@ -127,6 +134,2 @@ return this.getType() === WINDOW_TYPE.POPUP; | ||
isIframe() : boolean { | ||
return this.getType() === WINDOW_TYPE.IFRAME; | ||
} | ||
setLocation(href : string) : ZalgoPromise<ProxyWindow> { | ||
@@ -136,2 +139,6 @@ return this.serializedWindow.setLocation(href).then(() => this); | ||
getName() : ZalgoPromise<?string> { | ||
return this.serializedWindow.getName(); | ||
} | ||
setName(name : string) : ZalgoPromise<ProxyWindow> { | ||
@@ -146,12 +153,10 @@ return this.serializedWindow.setName(name).then(() => this); | ||
focus() : ZalgoPromise<ProxyWindow> { | ||
return ZalgoPromise.try(() => { | ||
return ZalgoPromise.all([ | ||
this.isPopup() && this.serializedWindow.getName().then(name => { | ||
if (name) { | ||
window.open('', name); | ||
} | ||
}), | ||
this.serializedWindow.focus() | ||
]); | ||
}).then(() => this); | ||
return ZalgoPromise.all([ | ||
this.isPopup() && this.getName().then(name => { | ||
if (name) { | ||
window.open('', name); | ||
} | ||
}), | ||
this.serializedWindow.focus() | ||
]).then(() => this); | ||
} | ||
@@ -169,4 +174,4 @@ | ||
this.actualWindow = win; | ||
this.serializedWindow = getSerializedWindow(this.serializedWindow.id, win, { send: this.send }); | ||
this.actualWindowPromise.resolve(win); | ||
this.actualWindowPromise.resolve(this.actualWindow); | ||
windowStore('winToProxyWindow').set(win, this); | ||
} | ||
@@ -178,3 +183,3 @@ | ||
matchWindow(win : CrossDomainWindowType) : ZalgoPromise<boolean> { | ||
matchWindow(win : CrossDomainWindowType, { send } : { send : SendType }) : ZalgoPromise<boolean> { | ||
return ZalgoPromise.try(() => { | ||
@@ -187,3 +192,3 @@ if (this.actualWindow) { | ||
proxyInstanceID: this.getInstanceID(), | ||
knownWindowInstanceID: getWindowInstanceID(win, { send: this.send }) | ||
knownWindowInstanceID: getWindowInstanceID(win, { send }) | ||
}).then(({ proxyInstanceID, knownWindowInstanceID }) => { | ||
@@ -209,8 +214,8 @@ const match = proxyInstanceID === knownWindowInstanceID; | ||
serialize() : SerializedProxyWindow { | ||
return this.serializedWindow; | ||
shouldClean() : boolean { | ||
return Boolean(this.actualWindow && isWindowClosed(this.actualWindow)); | ||
} | ||
shouldClean() : boolean { | ||
return this.actualWindow && isWindowClosed(this.actualWindow); | ||
serialize() : SerializedWindowType { | ||
return this.serializedWindow; | ||
} | ||
@@ -225,14 +230,10 @@ | ||
static serialize(win : CrossDomainWindowType | ProxyWindow, { send } : { send : SendType }) : SerializedProxyWindow { | ||
static serialize(win : CrossDomainWindowType | ProxyWindow, { send } : { send : SendType }) : SerializedWindowType { | ||
cleanupProxyWindows(); | ||
return ProxyWindow.toProxyWindow(win, { send }).serialize(); | ||
} | ||
static deserialize(serializedWindow : SerializedProxyWindow, { on, send } : { on : OnType, send : SendType }) : ProxyWindow { | ||
static deserialize(serializedWindow : SerializedWindowType, { send } : { send : SendType }) : ProxyWindow { | ||
cleanupProxyWindows(); | ||
return globalStore('idToProxyWindow').getOrSet(serializedWindow.id, () => { | ||
return new ProxyWindow(serializedWindow, null, { on, send }); | ||
}); | ||
return globalStore('idToProxyWindow').get(serializedWindow.id) || new ProxyWindow({ serializedWindow, send }); | ||
} | ||
@@ -254,16 +255,9 @@ | ||
// $FlowFixMe | ||
const realWin : CrossDomainWindowType = win; | ||
// $FlowFixMe | ||
return windowStore('winToProxyWindow').getOrSet(win, () => { | ||
const id = uniqueID(); | ||
const serializedWindow = getSerializedWindow(id, realWin, { send }); | ||
const proxyWindow = new ProxyWindow(serializedWindow, realWin, { send }); | ||
return globalStore('idToProxyWindow').set(id, proxyWindow); | ||
}); | ||
const actualWindow : CrossDomainWindowType = win; | ||
return windowStore('winToProxyWindow').get(actualWindow) || new ProxyWindow({ win: actualWindow, send }); | ||
} | ||
} | ||
export type SerializedWindow = CustomSerializedType<typeof SERIALIZATION_TYPE.CROSS_DOMAIN_WINDOW, SerializedProxyWindow>; | ||
export type SerializedWindow = CustomSerializedType<typeof SERIALIZATION_TYPE.CROSS_DOMAIN_WINDOW, SerializedWindowType>; | ||
@@ -274,4 +268,4 @@ export function serializeWindow(destination : CrossDomainWindowType | ProxyWindow, domain : DomainMatcher, win : CrossDomainWindowType, { send } : { send : SendType }) : SerializedWindow { | ||
export function deserializeWindow(source : CrossDomainWindowType | ProxyWindow, origin : string, win : SerializedProxyWindow, { on, send } : { on : OnType, send : SendType }) : ProxyWindow { | ||
return ProxyWindow.deserialize(win, { on, send }); | ||
export function deserializeWindow(source : CrossDomainWindowType | ProxyWindow, origin : string, win : SerializedWindowType, { send } : { send : SendType }) : ProxyWindow { | ||
return ProxyWindow.deserialize(win, { send }); | ||
} |
@@ -20,2 +20,6 @@ /* @flow */ | ||
export function createProxyWindow(win? : CrossDomainWindowType) : ProxyWindow { | ||
return new ProxyWindow({ send, win }); | ||
} | ||
export function toProxyWindow(win : CrossDomainWindowType | ProxyWindow) : ProxyWindow { | ||
@@ -22,0 +26,0 @@ return ProxyWindow.toProxyWindow(win, { send }); |
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
8793
1523745